From 7bf41d48279fa6961794dc7a15e0ae4724cd54c7 Mon Sep 17 00:00:00 2001 From: ppenguin Date: Thu, 13 Jan 2022 16:02:52 +0100 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit d95f26c4bd2ad9f7a92de54bc4525219104b7ed3 Author: Alessandro Arzilli Date: Thu Jan 6 18:07:53 2022 +0100 proc: interpret value of DW_AT_inline correctly (#2859) All values greater than or equal to 1 indicate that the function has been inlined. commit 466f9b8c938727c36a226eafd3333a97c5d51cae Author: Alessandro Arzilli Date: Thu Jan 6 18:07:26 2022 +0100 proc: change UserCurrent to exclude internal and runtime/internal (#2853) packages Changes UserCurrent to exclude frames stopped inside the 'internal' and 'runtime/internal' packages of the standard library. Before this change a goroutine blocked accepting or reading from a socket would be reported as having a user current frame of: internal/poll.runtime_pollWait After this change accepting goroutines will be reported with a user current frame of: net.(*netFD).accept and reading goroutines as: net.(*netFD).read commit a2927f6117e9bc630d0766e8b8eabb253fe54cd1 Author: Suzy Mueller Date: Thu Jan 6 10:02:19 2022 -0700 service/dap: set min/max addresses for invalid instructions (#2832) commit 66478f21e35f3e8da7bad8cd1ad733699fb479c1 Author: Suzy Mueller Date: Thu Jan 6 10:01:47 2022 -0700 pkg/proc: set stop reason for step instruction (#2828) * service/dap: move presentationHint to frame from source * pkg/proc: set stop reason for step instruction commit 21bdb466f181970e4881bc05f4784c736c693657 Author: Hyang-Ah Hana Kim Date: Thu Jan 6 12:01:09 2022 -0500 dap: support 'Env' attribute for launch requests (#2846) * dap: support 'Env' attribute for launch requests Env is applied in addition to the delve process environment variables. The env setting is done by calling os.Setenv as early as possible when a Launch request is received. Prior discussion is in https://github.com/go-delve/delve/pull/2582 In Visual Studio Code, setting null for an environment variable in launch.json or tasks.json indicates users want to unset the environment variable. Support the behavior by accepting nil value. * dap: Env field itself can be omitempty * edit comment commit 79d5db24a57f6b512488ea8150c1bb21e913ce3f Author: Fabio Falzoi Date: Thu Jan 6 18:00:46 2022 +0100 Automatically disable breakpoints with hitcount conditions that will never be satisfied again (#2833) * service/debugger: disable breakpoints with hitcond not satisfiable To avoid slowing down the debugged process unnecessarily, we disable breakpoints with a hit condition that can no longer be hit again. * test: add integration tests for hit conditions no more satisfiable * proc/test: fix typo in breakpoints related tests * test: use the new API for hitcond integration tests commit 7afe6407730b777de89a371c5bf0dae19d345d1a Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jan 6 08:58:08 2022 -0800 Documentation: add DAP API page (#2856) * Documentation: add DAP API page * Respond to review feedback * Clarify about Ctrl-C * Add hidden TODO for more things to document Co-authored-by: Polina Sokolova commit 4c1f8b4b2536beb8b06c6a6ef0b0383a7928e188 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jan 6 08:57:40 2022 -0800 commmands: update DAP overview in help (#2850) Co-authored-by: Polina Sokolova commit f09896a593c044b4c23acb2eeceb6a4661d862ef Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jan 6 08:57:12 2022 -0800 Documentation: add overview usage info for all dlv commands (#2857) * Documentation: add overview usage info for all dlv commands * Separate trace, adjust headless wording * Add headless command note Co-authored-by: Polina Sokolova commit 0ecdc6e4a9da693e52f0aa7fb38606cb08f24095 Author: Tim Hockin Date: Thu Jan 6 08:56:21 2022 -0800 pkg/terminal: Support `b` and `t` without a linespec (#2863) This could probably be more user-friendly, in that you can't give a name to such a breakpoint. To add support for names, we would need to try a single arg first as a location, and if that fails try it as a name for current line. That seems somewht dubious, so I didn't try. commit 5842c1fe9e4009ebf020839fe4901a24c930ecb3 Author: Suzy Mueller Date: Tue Jan 4 04:03:20 2022 -0700 service/dap: fix race in no debug test (#2766) Check for a possible output event when disconnecting from a process that has already exited. Fixes #2763 commit fcc9561cbeb4ed333a7ecac9d1aeea42fb695ed9 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Jan 3 01:58:13 2022 -0800 service/dap: update request inventory comments and labels in Server.handleRequest (#2854) Co-authored-by: Polina Sokolova commit 661cb3369949ca0c55c262978fa200c4131af729 Author: Derek Parker Date: Thu Dec 30 11:14:37 2021 -0800 pkg/proc: switch to Dual MIT/GPL license for ebpf (#2849) commit a88c9bde4ac6d58543748ef0482e78883fd90e61 Author: Derek Parker Date: Thu Dec 30 00:04:59 2021 -0800 pkg/proc: add build scripts & docker image for ebpf (#2847) Adds a few build scripts and a container image for reproducible builds of the ebpf programs. commit 38410993c9b2f4774b16ec1f1b56d0762a5ceef9 Author: Derek Parker Date: Thu Dec 23 10:25:21 2021 -0800 v1.8 (#2840) * v1.8 commit 4a94b3eff2a822e57ee60d7946d4bf29d1a8d2a6 Author: Alessandro Arzilli Date: Wed Dec 22 19:26:21 2021 +0100 Updates for go1.18beta1 (#2831) * go.mod: update golang.org/x/tools to v0.1.8 Fixes TestGeneratedDoc on go1.18 * TeamCity: bump test matrix Add 1.18 to test matrix. Remove 1.15 from test matrix and from support range. * proc,tests: update for regabi on arm64 and 386 Make sure that stacktrace registers always contain the PC register of the current frame, even though the debug_frame rules might not specify it on architectures that use a link register. The PC register is needed to look up loclist entries for variable evaluation. * goversion: bump maximum supported Go version to 1.18 * proc: disable asyncpreempt on linux/arm64 Asyncpreempt on linux/arm64 can sometimes restart a sequence of instructions which will make breakpoint appear to be hit twice in some cases. commit 07bcf0cb130d348320078dc7e6bb2b7c8b9e8392 Author: Alessandro Arzilli Date: Wed Dec 22 18:38:39 2021 +0100 Documentation: document runtime.curg and runtime.frameoff (#2835) commit b81f618fb3aacbc0245db655be8230abccb8f8c8 Author: Alessandro Arzilli Date: Tue Dec 14 15:26:08 2021 +0100 proc/native: ignore 'pf' mappings during core dump creation (#2761) Fixes #2630 commit b192d8467018b922864e0e51f1df8d0b8c4fe84a Author: Alessandro Arzilli Date: Mon Dec 13 20:41:28 2021 +0100 service: use name w/o parameters for breakpoints on generic funcs (#2774) When printing breakpoints on generic functions use the function name without parameters instead of using the name of the first instantiation that appears on the list. commit 617d934d3e722c2f61d25af2b4c5e5a788a9a668 Author: Alessandro Arzilli Date: Mon Dec 13 20:39:20 2021 +0100 proc/gdbserial: allow rewind to work after process exit with rr (#2815) * service/debugger: fix bug internal err with Restart on recorded target If Restart is called after a Continue and Rewind on a recorded target that has already terminated it will return an internal error. * proc/gdbserial: allow rewind to work after process exit with rr It is sometimes useful to set breakpoints and rewind a terminated process when using rr, for example if interested in the last execution of some function. RR will not allow a backward continue after the process exit packet has been sent, however rr will also generate a synthetic SIGKILL right before process exit. Treat this packet as a process exit and change some things so both continuing backwards and setting breakpoints can be done, on recorded targets, after process exit has been reported. commit 3d334e4a5bb51e85569117ff4a48a8d89cf85534 Author: Zhaoyang Date: Tue Dec 14 02:25:23 2021 +0800 fmt code (#2826) commit d514b4c6e9e7fa108630e9968b286a425e58565b Author: Herby Gillot Date: Mon Dec 13 13:24:41 2021 -0500 _scripts: add option to disable invoking git during build (#2798) This is useful to be able to build using Delve's build scripts when working from within a directory that has been extracted from a source tarball, or wherever we wouldn't have git history. This can be invoked as: ``` go run _scripts/make.go build --no-git ``` commit c0fa4e32d7ccaf135364d0a7fd7af7effeed8e64 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Dec 12 10:30:21 2021 -0800 Documentation: add more installation instuctions (#2824) Co-authored-by: Polina Sokolova commit 15bb95ccc328d9b7ee59b3f2c7e1cd9f02c2435c Author: kaddy-tom <71744781+kaddy-tom@users.noreply.github.com> Date: Fri Dec 10 20:52:05 2021 +1100 terminal/command: fix up OoB in `deferred` command (#2823) Prior to this, sending a `deferred` command with no arguments would immediately crash the debug session. commit 2f13672765fead22e5376fb4754c48a96c33cc0b Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Dec 8 02:37:35 2021 -0800 service/dap: fix compile error from merge conflict (#2818) Co-authored-by: Polina Sokolova commit a4ac69e87df34bc7619fb6119db25816f5cf1ae1 Author: Suzy Mueller Date: Tue Dec 7 12:23:55 2021 -0500 service/dap: support goroutine filters in dap (#2759) * service/dap: filter goroutines * adjust defaults * add tests * remove label change * fix typos * send invalidated areas * respond to review, and allow to clear goroutineFilters commit d0898e4de13e4ac3dcade0f10b774cb7d4fe3a9c Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Dec 7 09:23:26 2021 -0800 service/dap: misc remote attach improvements (#2778) Co-authored-by: Polina Sokolova commit b8a9ae26f6bec3b43f0db978a4bf6502260878de Author: Alessandro Arzilli Date: Tue Dec 7 18:21:53 2021 +0100 proc: fix signal handling during stepping (#2803) Fix signal handling during thread single stepping so that signals that are generated by executing the current instruction are immediately propagated to the inferior, while signals other signals sent to the thread are delayed until the full resume happens. Fixes a bug where a breakpoint set on an instruction that causes a SIGSEGV would make Delve hang and a bug where signals received during single step would make it look like an instruction is executed twice. Fixes #2801 Fixes #2792 commit 2cd9d268d35d9df702ee853064aac2fd51dcc16d Author: Alessandro Arzilli Date: Tue Dec 7 18:20:10 2021 +0100 proc: add dummy files to fix vendoring of Delve (#2807) Add some dummy go files so that 'go mod vendor' works for modules that require Delve, becuase directories that do not contain any go code will not be vendored. commit 1a815365d552baab5730f23b17193d447cb190c2 Author: hitzhangjie Date: Thu Dec 2 19:17:47 2021 +0800 godwarf/type: fix typo (#2813) commit 3833c3d029645915254739ca222b6a4ac3f9dc3c Author: Suzy Mueller Date: Wed Dec 1 04:57:03 2021 -0500 service/dap: move presentationHint to frame from source (#2810) commit 75bbbbb60cecda0d65c63de7ae8cb8b8412d6fc3 Author: Alessandro Arzilli Date: Fri Nov 26 17:11:29 2021 +0100 proc: support DWARF5 on Windows/macOS (#2791) * proc: log errors reading debug_info Because of an incorrect use of debug/dwarf.Reader errors encountered while reading debug_info were not reported. Updates #2786 * proc: use debug_line_str section for PE and Macho-O files Updates #2786 commit 01b01423aecbcc00110d680dd6ee20ff905d90e7 Author: Alessandro Arzilli Date: Fri Nov 26 17:06:23 2021 +0100 proc/*: minor miscellaneous code cleanups (#2790) * made Pid a method of Target instead of a method of Process * changed argument of NewTarget to ProcessInternal, since that's the interface that backends have to implement * removed warnings about ProcessInternal since there is no way for users of pkg/proc to access those methods anyway * made RecordingManipulation an optional interface for backends, Target supplies its own dummy implementation when the backend doesn't * inlined small interfaces that only existed to be inlined in proc.Process anyway * removed unused function findExecutable in the Windows and no-native darwin backends * removed (*EvalScope).EvalVariable, an old synonym for EvalExpression commit 88dca53e5c6ecc705139700375cdb16ad3a3675b Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Nov 24 13:46:14 2021 -0800 service/dap: fix TestNextParked (#2784) Co-authored-by: Polina Sokolova commit f34a1e6a5ef74be01afc7c4a283a796a93fe09c1 Author: Alessandro Arzilli Date: Wed Nov 24 22:45:28 2021 +0100 version: fix build version using buildInfo (#2789) In go1.18 buildInfo will include the git revision hash, use that to fix the Build field of Version so that it is correct even if Delve wasn't built using make.go. commit b69bcf53d692c9168d622c1fbc9c0cf39fdad572 Author: Alessandro Arzilli Date: Wed Nov 24 22:44:49 2021 +0100 _scripts: fix test_linux.sh version check (#2785) The version check to disable the buildvcs option is wrong, it doesn't matter now but it will start failing when 1.18.1 is released. commit 935161f8bf30917d9a18b455a46438de6b8c6856 Author: Suzy Mueller Date: Wed Nov 24 16:38:37 2021 -0500 service/dap: expose sources command in evaluate request (#2797) * service/dap: expose sources command in evaluate request commit 389cccf08b05a4030cc9d28fc0f17eab9f04f73d Author: Alessandro Arzilli Date: Wed Nov 24 22:09:43 2021 +0100 TeamCity: fix scripts selecting Go version (#2804) s/golang.org/go.dev/ commit cba1a524a8015c7caecfe11b694eeb381ed346ac Author: Derek Parker Date: Wed Nov 17 07:33:11 2021 -0800 v1.7.3 (#2796) commit a350aafaa730c7559480b8c43e6bfcdf23219f6a Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Nov 17 06:49:09 2021 -0800 v1.7.3 Changelog (#2793) * v1.7.3 Changelog Co-authored-by: Polina Sokolova commit 9013a121d8bc6359018bccfaa1f256a8870d01c7 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Nov 9 00:24:26 2021 -0800 server/dap: stop running command if conn closed - fixes nil dereference bug (#2781) Co-authored-by: Polina Sokolova commit 183bb8dffd9fe164f27f06c1f435100c5daadf54 Author: Alessandro Arzilli Date: Wed Nov 3 17:49:26 2021 +0100 TeamCity: disable Windows Defender (#2775) Shaves off 3 minutes out of every windows build. commit cd9e6c02a6ca5f0d66c1f770ee10a0d8f4419333 Author: Derek Parker Date: Wed Nov 3 08:58:04 2021 -0700 *: Replace libbpfgo with cilium/ebpf (#2771) commit c207db792a0757e8db7420d6729b3da2608c5f31 Author: Alessandro Arzilli Date: Sat Oct 30 20:52:26 2021 +0200 proc,locspec: support setting breakpoints by func name on generic funcs (#2745) * proc,locspec: support setting breakpoints by func name on generic funcs Changes proc.Function to parse function names correctly when they contain instantiation lists and locspec to match generic functions. * vendor: update golang.org/x/tools The old version of golang.org/x/tools is incompatible with the new iexport format. commit 884ef4f3381639745a57cbad421025ccc30f7e8a Author: Alessandro Arzilli Date: Sat Oct 30 20:51:02 2021 +0200 proc/gdbserial: workaround for debugserver register set bug (#2770) Debugserver has a bug where writing to a AVX-2 or AVX-512 register does not work unless it is followed by at least a write to a AVX (not 2 or 512) register. See also: https://bugs.llvm.org/show_bug.cgi?id=52362 Fixes #2767 commit af1c36365b6eba164bc397963c7f5a1a6783dc6e Author: Alessandro Arzilli Date: Sat Oct 30 15:47:38 2021 +0200 proc/native: disable watchpoints on Windows (#2769) There are persistent issues with watchpoints on Windows, it is not clear whether it's a problem with the VM running the tests or if there is a real bug in our implementation of hardware breakpoints on Windows. Until the cause can be determined watchpoints on Windows will be disabled. Updates #2768 commit 19ce116bb2c14140b0286041cdd72b12f64da590 Author: Suzy Mueller Date: Fri Oct 29 22:41:30 2021 -0400 service/dap: allow expression evaluation in log messages (#2747) From the DAP spec: If this attribute exists and is non-empty, the backend must not 'break' (stop) but log the message instead. Expressions within {} are interpolated. This change parses the log messages and stores the parsed values as a format string and list of expressions to evaluate and get the string value of. Updates golang/vscode-go#123 commit f8deab85224b61b2dab6a0cec4ea2ac9234761dc Author: Suzy Mueller Date: Fri Oct 29 22:40:16 2021 -0400 service/dap: fix goroutine id selection for hardcoded breakpoints (#2748) * service/dap: fix goroutine id selection for hardcoded breakpoints Determining the stopped goroutine id on a breakpoint required checking for breakpoints since some may be tracepoints. However, there may be goroutines stopped on hardcoded breakpoints with no breakpoint. We fix this by checking for runtime.breakpoint or StopReason=proc.StopHardcodedBreakpoint. commit 922c4cebd4884bb0faca183361f9566da2868984 Author: Suzy Mueller Date: Fri Oct 29 22:35:13 2021 -0400 service/dap: add config expressions to evaluate requests (#2750) We want to provide more flexibility for users to make changes to their configurations while the debug session is running. This could be accomplished by creating a custom request, but that were require a new UI as well, and every client of dlv dap to provide its own UI for this. By using the evaluate context, users can use the already existing debug console to change their configurations. This change includes a refactor of the terminal code in order to share the code with the dap package. This change provides a very similar to UI as the terminal package, but there are different configuration options that are DAP specific. We plan to use this same mechanism to expose a few other commands including "sources" to help users debug an ineffective substitutePath configuration. commit b48ceec161d567a840def125e33ad734f8171b09 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Oct 26 10:11:55 2021 -0700 service/dap: improve shutdown logic and test coverage (#2749) This high-level goal is to push more shutdown logic into Session and not rely Server.Stop() because dap's version of Stop() is different from rpccommon. That means triggering the same shutdown steps in multiple places, so additional safeguards are added to make some of the duplicate steps no-ops to avoid errors, extra logging, etc. This includes the following changes: close client conn when request loop in serveDAPCodec exits (to match rpccommon) exit request loop after processing a disconnect request (instead of relying on next read to fail because conn got closed by triggered Stop(), which is skipped in case of accept-multiclient and is not closed in Stop() in rpccommon) reset debugger to nil to avoid shutting it down more than once and causing duplicate logging (in case stopDebugSession is called from onDisconnectRequest and Server.Stop or Session.Close as things shut down) reset binaryToRemove to "" upon removal to avoid duplicate error (in case Close() is called more than once outside of Stop(), which technically is not the case right now) expand testing for all possible server shutdown triggers testing for Session-only shutdown as it will be integrated into rpccommon without dap.Server wrapper updates golang/vscode-go#1830 updates #2328 Co-authored-by: Polina Sokolova commit b31565d8aabfdedead0831d579b44805060741f8 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Oct 25 12:39:28 2021 -0700 service/dap: support JSON-RPC and DAP on the same port from "dlv debug/exec/test/attach" (#2755) * Support JSON-RPC and DAP on the same port * Fix test Co-authored-by: Polina Sokolova commit fe100bcb1169e5bcd6835577e77b72881e59bd94 Author: Alessandro Arzilli Date: Mon Oct 25 21:38:58 2021 +0200 _scripts: fix latestver.py (#2756) Fix latestver to sort rc and beta versions before normal releases. commit 689e08260be7359776cc14b1c7f8907069132d5a Author: Derek Parker Date: Mon Oct 25 12:37:36 2021 -0700 eBPF tracing backend return value parsing (#2704) Add return value parsing for eBPF tracing backend. commit 8ebd2d83aeef44de5011b696de040d20cd8d6395 Author: Alessandro Arzilli Date: Mon Oct 18 22:17:47 2021 +0200 Misc fixes for test problems (#2751) * service/dap: remove deadlock in TestLaunchDebugRequest Fixes #2746 * terminal: fix TestScopePrefix flakiness When there are more than 10 frames api.PrintStack will prefix the output with spaces to right justify the frame number, which confuses TestScopePrefix. * _scripts: pass -buildvcs for Go 1.18 and later on TeamCity Go 1.18 will try to stamp builds with the VCS version, this doesn't work on TeamCity because the checkout isn't a valid repository (but looks like it). Pass -buildvcs=false to disable this feature. * proc: switch to goroutine stack if first frame's func can not be found If the first frame on the system stack can not be resolved to a function switch directly to the goroutine stack. commit b99d5f59718932a0dacafcdba5699da29f6eff30 Author: Suzy Mueller Date: Mon Oct 18 16:13:12 2021 -0400 service/dap: add option to hide system goroutines (#2743) commit ea18bc6d6d9b05890a477ef7c34e0b1c09b7f869 Author: Alessandro Arzilli Date: Mon Oct 18 22:11:59 2021 +0200 proc/native: support watchpoints on linux/arm64 (#2667) commit 99f03597c325e492581fdb94e43aaf18c45e9b74 Author: Suzy Mueller Date: Fri Oct 15 07:57:50 2021 -0400 service/dap: add registers configuration for variables response (#2742) commit 9a5d5bc996d9668e0b52c1cb11d2fa0f481ac9fa Author: Alessandro Arzilli Date: Thu Oct 14 20:06:14 2021 +0200 proc/gdbserial: support call injection with rr backend (#2740) Normally calls can't be performed on recorded processes, becuase the future instructions executed by the target are predetermined. The rr debugger however has a mechanism that allows this by taking the current state of the recording and allowing it to diverge from the recording, temporarily. This commit adds support for starting and ending such diversions around function calls. Note: this requires rr version 5.5 of later to work, see: https://github.com/rr-debugger/rr/pull/2748 commit c8f6c3a6853760d0ff8cd96368b8b17c86b599aa Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Oct 14 10:58:53 2021 -0700 service/dap: support remote-attaching to running debugger (#2737) Co-authored-by: Polina Sokolova commit ce5238944d4ccb995dc577d23a2f4f5694bc90ae Author: Suzy Mueller Date: Thu Oct 14 13:44:36 2021 -0400 service/dap: support disassemble request (#2728) This adds support for disassembling a region of code using the instructionPointerReference value returned in the stack trace request. commit 6cf7a7149d35fe8c349a03caa57627860bf48ddd Author: Alessandro Arzilli Date: Thu Oct 14 03:46:20 2021 +0200 cmd/dlv,config: obey logflags config for LoadConfig warnings (#2701) LoadConfig warnings should obey the logflags configuration and should also be delayed until after the "listening at" message, which should always be the first thing output. Co-authored-by: Suzy Mueller commit 64f2200202811e3d20812f556fc2a63006eff052 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Oct 13 18:38:22 2021 -0700 service/dap: fix data race for noDebugProcess.ProcessState (#2735) Co-authored-by: Polina Sokolova commit 8a9f141d512e223cfdb3af29ab6eddf62b126acc Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Oct 13 12:05:47 2021 -0700 service/dap: log parsed and applied launch configs (#2732) * service/dap: log parsed and applied launch configs Co-authored-by: Polina Sokolova commit 98a0bcf772d161cd6285096e88b6870679df20f6 Author: Hyang-Ah Hana Kim Date: Wed Oct 13 14:43:47 2021 -0400 cmd/dlv: add --client-addr flag to run dap with a predefined client (#2568) This adds a new `--client-addr=host:port` flag to `dlv dap`. If it is supplied, the dap process will dial into the tcp port where a DAP client is waiting, and work with only the DAP client. The DAP client is supposed to start the normal DAP message exchange starting with the 'initialize' request after the dlv dap process dials in and the connection is set up. VS Code Go extension plans to use this mode for * reliably detecting `dlv dap` readiness. Currently it depends on watching the log stream. After this PR, it can listen on a network port. * running `dlv dap` from any terminal (part of RunInTerminal workflow implementation). commit 6c4029c765f8afb049d1de5340f2491c2da7df62 Author: Suzy Mueller Date: Wed Oct 13 11:52:06 2021 -0400 service/dap: auto resume execution when setting breakpoints (#2726) A set breakpoints request could come in while the program is running. For a seamless user experience, the server should set the breakpoint and then continue program execution. Updates golang/vscode-go#1676 commit bdcbcc68366980a0347eef8eb3fa959ab6ac3f2b Author: Alessandro Arzilli Date: Wed Oct 13 17:44:59 2021 +0200 proc: return error when assigning between function variables (#2692) Fixes #2691 commit 1893c9769b8273a2be81e0a5f38b3c210b815481 Author: Alessandro Arzilli Date: Wed Oct 13 17:43:54 2021 +0200 Miscellaneous fixes for Windows native backend (#2736) * proc/native: always stop after RequestManualStop on Windows On Windows RequestManualStop will generate an exception on a special DbgUiRemoteBreakin thread, sometimes this thread will die before we finish stopping the process. We need to account for that and still stop even if the thread is gone and no other thread hit a breakpoint. Fixes flakiness of TestIssue419. * proc/native: fix watchpoints with new threads on Windows When a new thread is created we must reapply all watchpoints to it, like we do on linux. * tests: be lenient on goroutinestackprog tests on Windows We can not guarantee that we find all goroutines stopped in a good place and sometimes the stacktrace fails on Windows. commit d1c888f22aa1d49d3f4ac3063557a104bbc65db9 Author: Suzy Mueller Date: Wed Oct 13 11:34:09 2021 -0400 service/dap: set instruction breakpoints (#2716) Support setting instruction breakpoints, this is newly supported in VS Code for the disassembly view. commit 7899e94ff2972a1689355b00c3d933fbd22d9e41 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Oct 13 00:10:55 2021 -0700 _fixtures/loopprog: print less often (#2738) Co-authored-by: Polina Sokolova commit d613f8ec457fa388302f4da189a6962c87e27d44 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Oct 10 06:57:06 2021 -0700 service/dap: use constants for testing error codes (#2741) Co-authored-by: Polina Sokolova commit 3515be1db154659949a18c2d19dc28bcb36cd516 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Oct 10 06:52:52 2021 -0700 service/dap: support accept-multiclient shutdown in remote attach mode (#2731) Co-authored-by: Polina Sokolova commit 69634d5d6023a6aa4bfdd383ba4af4d9ec53b015 Author: Suzy Mueller Date: Fri Oct 8 02:58:19 2021 -0400 service/dap: allow "instruction" stepping granularity (#2713) commit 0baf3b7cf1d67e510f968af5b7270114a9c0f4c2 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Oct 7 23:57:51 2021 -0700 service/dap: fix nil dereference when byte array cannot be converted to string (#2733) Co-authored-by: Polina Sokolova commit b3b177dc4052a3f4f314864fc4a04f5aa388150b Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Oct 7 02:28:15 2021 -0700 service/dap: rename delveCwd to dlvCwd and clarify comments (#2734) Co-authored-by: Polina Sokolova commit b2a2b32336eb2e2a9039f8d0d3667276476cc298 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Oct 7 02:27:04 2021 -0700 service/dap: Dap => DAP (#2739) Co-authored-by: Polina Sokolova commit b48dd09251436d072baaf398d6f724441e591838 Author: Suzy Mueller Date: Tue Oct 5 21:29:46 2021 -0400 service/dap: log goroutine id and include source info (#2730) commit 70df230e72d97fe5b6e801ca6afae5db8546c71f Author: Suzy Mueller Date: Tue Oct 5 13:35:14 2021 -0400 service/dap: merge arguments and local scopes (#2717) commit fa10cec9fa539f9cfc81d0d2e65db1ebbda100ad Author: Hyang-Ah Hana Kim Date: Tue Oct 5 07:40:17 2021 -0400 dap: support delveCwd and use a temporary file as default debug binary (#2660) commit 348c72298167f8825e9c825f4557ca7f16da2efe Author: Alessandro Arzilli Date: Mon Oct 4 23:45:05 2021 +0200 proc/gdbserver: support watchpoints (#2659) Adds watchpoint support to gdbserver backend for rr debugger and debugserver on macOS/amd64 and macOS/arm64. Also changes stack watchpoints to support reverse execution. commit dc2f615c9a2b73e500bd335e8e0bd4c1619c7858 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Oct 4 09:13:17 2021 -0700 service/dap: refactor the server into two layers (#2729) * service/dap: refactor the server into two layers * Add delay before setting debugger in remote tests Co-authored-by: Polina Sokolova commit 6a282112cce8ac3ec47205a7a34e4ddc397b806c Author: aarzilli Date: Fri Sep 17 08:48:05 2021 +0200 TeamCity: enable tests on go-tip commit 9f908584dce1277308eb330cd1e8e1225ca2a59e Author: aarzilli Date: Fri Sep 17 08:47:46 2021 +0200 proc/test: update RegabiSupported Change RegabiSupported to match the current state of Go 1.18 commit 18f2a4c46b8712188cc23f68cb0dc884a0a99f8b Author: aarzilli Date: Thu Sep 16 21:26:36 2021 +0200 proc,dwarf/godwarf: support parametric types with dictionaries Change debug_info type reader and proc to convert parametric types into their real types by reading the corresponding dictionary entry and using the same method used for interfaces to retrieve the DIE from a runtime._type address. '2586e9b1'. commit 4e7b689e1a97428c7974bdb4ba3b1ba1e74ea3d1 Author: aarzilli Date: Thu Sep 16 16:51:51 2021 +0200 proc: rewrite FindFileLocation to support generics With generics a single function can have multiple concrete instantiations, the old version of FindFileLocation supported at most one concrete instantiation per function and any number of inlined calls, this supports any number of inlined calls and concrete functions. commit 878a52539ef8330af75095a88f37712e0c621edf Author: aarzilli Date: Thu Sep 16 15:38:15 2021 +0200 proc: use trampoline attribute to detect autogenerated wrappers Go 1.18 abandoned the 'dwrap' tag introduced by Go 1.17 commit ee1719f6ebdf4f6b9422bf702433334a095ccd7c Author: aarzilli Date: Fri Sep 3 14:20:21 2021 +0200 proc: only apply regabiMallocgcWorkaround to first image The workaround for runtime.mallocgc with regabi should only be applied to the first image. commit 4a004e4bc1a7d2e2714a715768a1578b8da06228 Author: aarzilli Date: Mon Aug 23 10:03:54 2021 +0200 proc: do not check return args when loading return vals of call injection When the function we are calling is an autogenerated stub (because, for example, we are calling it through a function pointer) the declaration line of variables is meaningless and could cause us to discard valid return arguments. commit de322cd113d83a7d678e7269a560f3c1fd0ae835 Author: aarzilli Date: Sun Aug 22 16:46:00 2021 +0200 proc: fix deferreturn detection for Go 1.18 Go 1.18 removed the jmpdefer call from deferreturn, now deferreturn is a normal function call that can appear on the stack, rules for detecting a deferreturn call must be changed and new code must be added to skip it while stepping out. commit cf58ba438043d85b9a15b190bc3e1b602b1fecc8 Author: aarzilli Date: Sun Aug 22 16:12:07 2021 +0200 tests: miscellaneus test fixes for Go 1.18 commit a97da22762ac08478db61373a7efe372f84d2d79 Author: Alessandro Arzilli Date: Wed Sep 29 12:01:37 2021 +0200 proc: do not assign temporary breakpoint IDs (#2650) Internal breakpoints do not need IDs and assigning them from a counter separate from the user ID counter can be a cause of confusion. If a user breakpoint is overlayed on top of a pre-existing internal breakpoint the temporary ID will be surfaced as if it was a user ID, possibly conflicting with another user ID. If a temporary breakpoint is overlayed on top of a pre-existing user breakpoint and the user breakpoint is first deleted and then re-created, the user ID will be resurrected along with the breakpoint, instead of allocating a fresh one. This change removes internal breakpoint IDs entirely, only user breakpoints receive an ID. commit b8f8cd82a63338662782825c762ddb180944794d Author: Alessandro Arzilli Date: Wed Sep 29 09:53:27 2021 +0200 service/rpccommon,service/dap: warn about listening to remote connections (#2721) Updates #2669 commit 29eae8f61731a77b95d61f69a782a2cde1e019bf Author: Alessandro Arzilli Date: Tue Sep 28 21:07:42 2021 +0200 *: clean up staticcheck problems (#2723) Fix problems that can be fixed, ignore the ones that don't make sense commit efc44831754e5e66b66ec7375a3ca424426310ad Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sat Sep 25 08:41:00 2021 -0700 pkg/goversion: visibly warn the user with --check-go-version=false (#2684) Co-authored-by: Polina Sokolova commit 038cd99b7310574bde3c5689d4e26e8a9adf40dd Author: Alessandro Arzilli Date: Sat Sep 25 00:31:54 2021 +0200 tests: run staticcheck during tests (#2705) commit 041eedd1268323788606580a3463f6e8911ff30e Author: Michael Knyszek Date: Fri Sep 24 18:27:44 2021 -0400 pkg/proc: merge register data before writing to register (#2699) Right now, if (*compositeMemory).WriteMemory needs to write a value to a register that's smaller than the full size of the register (say, a uint32 being passed as an argument), then (*AMD64Registers).SetReg can later fail a sanity check that ensures the passed DwarfRegister is a full size register. Fix this by reading the old value of the register and overwriting just the relevant parts with the new register. For the purposes of an argument, it would probably be fine to just pad with zeroes, but merging with the existing value is what gdb does. Fixes #2698 commit 4b30ba4228ee143ee24f88b2473ee6998c26ccba Author: Suzy Mueller Date: Fri Sep 24 16:22:32 2021 -0600 service/dap: add basic log points (#2634) Log points are special kinds of breakpoints that do not 'break' but instead log a message and then continue. This change implements basic log points that simply log the provided message, without any interpolation. In order to resume execution after hitting a breakpoint, I added a new lock resumeMu and tracked the running state within the DAP server. resumeMu must be held in order to issue a debugger request that would start execution. This means it can be used to make sure that another goroutine does not resume execution while you are holding the lock. Most of the synchronization logic is taken from PR #2530 Updates golang/vscode-go#123 commit e00670b9018d273c67ec4fc93244c98597e4aa83 Author: Suzy Mueller Date: Fri Sep 24 16:18:28 2021 -0600 service/debugger: return correct exit status on manual halt (#2674) * service/dap: add test for nonzero exit status commit b50052cc1767e2d5ebd6edc31f459bbace131722 Author: Alessandro Arzilli Date: Sat Sep 25 00:17:46 2021 +0200 proc/native: support watchpoints on Windows (#2651) commit 2b306e32a6133da96e5b23613b978d69a0ef5d18 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Sep 24 04:43:46 2021 -0700 service/dap: initial remote attach (handler support only) (#2709) commit eef04b964697f8fbdb4d28bf59869e1e09782ab0 Author: Hyang-Ah Hana Kim Date: Fri Sep 24 01:17:01 2021 -0400 dap: delete unused function (#2720) staticcheck reported a warning (U1000) commit c7e2a9b6fb902d685e77b28b001c0c95e5eb95b3 Author: Suzy Mueller Date: Wed Sep 22 22:29:05 2021 -0600 service/dap: remove unused test helper arg (#2714) commit b03d468b24248bad102f35cbe2a73ee52ebdc2ba Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 22 21:26:40 2021 -0700 go.mod: update google/go-dap to 0.6.0 (#2710) Co-authored-by: Polina Sokolova commit ff52a37a6a0b25c4b24fa2640e3a25c4200972c6 Author: Yang Wei Date: Thu Sep 23 13:25:31 2021 +0900 cmd/dlv: Parse Go+BoringCrypto version (#2712) This changes allow us to parse Go+BoringCrypto which formatted in b so that we can surpress `Version of Go is too old for this version of Delve` error. Fixes #2711 commit 9f8b352a98292cd72e5d9e9807c535dcfc01beb9 Author: Davide Masserut Date: Thu Sep 23 06:15:02 2021 +0200 vendor: update liner dependency (#2700) This change update liner to the latest release that adds support to delete the next and the previous word with Alt-d and Alt-BackSpace plus a small amount of fixes. commit a3897eafa771adcd5fa3de02ce3398750d84a5a9 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 22 21:12:48 2021 -0700 service/dap: client must treat non-build launch/attach errors as visible (#2671) Co-authored-by: Polina Sokolova commit 2adb72d05373c119b76ed6b4b7a631d8268b0134 Author: Derek Parker Date: Wed Sep 22 21:05:04 2021 -0700 v1.7.2 (#2708) Release v1.7.2, update CHANGELOG. commit cf106473606dd3c858447c60919e635e644bfcdb Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Sep 20 08:53:01 2021 -0700 service/dap: fix test setup for forcing server stop, add extra test (#2702) Co-authored-by: Polina Sokolova commit ab38d71147ddb85aef56a81ed6d564c384e4bbf6 Author: Suzy Mueller Date: Thu Sep 16 04:19:01 2021 -0600 service/dap: show decimal and hex values for uint (#2694) commit 53eed299004f638707abace9293082a7cbced742 Author: Suzy Mueller Date: Mon Sep 13 15:42:21 2021 -0600 pkg/proc: update check for system goroutine (#2585) * pkg/proc: update check for system goroutine The finalizer goroutine can be either a system goroutine or a user goroutine. It is considered a user goroutine only when it calls back to user code. This change attempts to get closer to the implementation in the src/runtime/traceback.go by checking the value of fingRunning. We could alternatively adopt the approximation done by src/cmd/trace/trace.go which only special cases "runtime.main", and always considers the finalizer to be a system goroutine. commit 4bcb8fb14438542a49c7f3c374b14a3d80316ac8 Author: Claus Lensbøl Date: Mon Sep 13 12:11:45 2021 -0400 terminal/make: Add GOARCH and GOOS arguments (#2696) This change adds '--GOARCH=[arch]' and '--GOOS=[os]' as arguments for the make script to simplify the process of cross compilling. commit 822c1ed2f1da018a8313eae34590178aa7813099 Author: Gabriel Vasile Date: Mon Sep 13 11:55:06 2021 +0300 Documentation: remove individual os install instruction links (#2697) Since the install instructions are more or less the same on all four operating systems, remove individual install instruction links from readme. commit 09798471003d55918581b8b835c0046e0c2f560a Author: Suzy Mueller Date: Thu Sep 9 09:49:11 2021 -0600 service/dap: do not send a halt request if the debuggee is not running (#2686) updates go-delve/delve#2685 commit 5d158820f69484106bee28f025bb6660c80bd6e3 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 1 10:31:37 2021 -0700 service/rpccommon: halt before detach in Stop (#2677) * service/rpccommon: halt before detach in Stop * Addd IsRunning check Co-authored-by: Polina Sokolova commit 45f44bc21837976a2aa9d87fbf429aeecfa5abfb Author: Johannes Altmanninger Date: Wed Sep 1 19:03:58 2021 +0200 Prefer string variant for source-list-line-color config option (#2676) The string variant is more powerful and can be passed directly to "echo -e" / "printf" and friends. Remove the mention of the integer variant from the default config. This makes the option appear more consistent with other color options. The user shouldn't care about the historic differences. commit 47d07e095c3efd70ffec917dbf4ea92e60cbd5ff Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 1 09:59:51 2021 -0700 service/dap: add test coverage for Stop() (#2678) Co-authored-by: Polina Sokolova commit f5105c57f7560f5c009c209259236d7429ea73aa Author: Johannes Altmanninger Date: Wed Sep 1 18:59:15 2021 +0200 terminal: config -list to print strings inside interfaces in quotes (#2680) Commit 3d6bbbe9 made "config -list" print strings in quotes to avoid the strings being interpreted as terminal escape codes. This commit does the same for "source-list-line-color", which is a raw interface. This fixes "config -list" with a config like source-list-line-color: "\x1b[34m" The "int" variant is already printed correctly, so just use the default case for that. commit 88b163d038ebb776332621cfdd5514780987884e Author: Suzy Mueller Date: Wed Sep 1 10:58:42 2021 -0600 service/dap: include selected goroutine in threads request (#2683) When we set a limit on the number of threads that would be returned, it was possible that the selected thread was not included in the list of threads. This could cause issues because the stopped reason is associated with the selected goroutine, so users could be missing out on important info. This change makes sure that the selected goroutine is included by adding it to the end of the list. commit 7dddcc186ee7c03234a576e7eb40ddda7d47c7f0 Author: Alessandro Arzilli Date: Tue Aug 31 19:44:57 2021 +0200 tests: fix TestIssue419 (#2682) errChan should not be closed otherwise the function that requests the manual stop might find it closed. commit 1433c079574bca60a9044feb319051f79c440e38 Author: Hyang-Ah Hana Kim Date: Thu Aug 26 08:42:58 2021 -0400 dap: define LaunchConfig/AttachConfig types (#2571) Formally define these types and document their meaning. We will auto-generate the dlv-dap documentation from these Go type doc. mapToStruct is a helper that sets the given struct's fields with the info in map[string]interface{} (launch/attach's Arguments). We achieve this by reencoding map[string]interface{} to json and decoding back to the target struct. If go-dap left the implementation-specific arguments as json.RawMessage and let the implementation decode as needed, this reencoding could've been avoided. encoding/json itself does not have mean to enforce required fields. There was a test case that checks substitutePath elements must set both from/to fields. Path.UnmarshalJSON implements the check. I am not yet sure about the need for distinction between missing 'from/to' and empty strings yet. (empty value is useful when dealing with a binary built with trimpath, right?) A minor behavior change - previously, if noDebug is not a boolean type, we ignored the attribute silently. Since we use json decoding, any mismatched types will cause an error and this non-boolean type noDebug attribute will result in launch failure. commit 7c91fa0d72d184f5954ab943c44474f8e45d8b25 Author: Johannes Altmanninger Date: Wed Aug 25 17:51:11 2021 +0200 pkg/terminal: avoid bright colors in default syntax highlighting (#2675) These two were hard to read on default xterm or on Konsole's "White on Black" theme. The non-bright colors still work on dark backgrounds. See https://github.com/go-delve/delve/pull/2294#discussion_r691076091 commit 914e1bc80e98423b00737f7894e0635a579c51fd Author: Derek Parker Date: Wed Aug 25 04:29:28 2021 -0700 pkg/proc: attempt to leverage debuginfod-find (#2670) If we cannot find debug information locally on the system, try and invoke debuginfod-find in order to ask the linux distribution we're on to find the debug information for us. commit a1a726d3152481f48ac1f1612988a70c1bdabf5f Author: Alessandro Arzilli Date: Tue Aug 24 17:21:17 2021 +0200 tests: correctly check for 1.17 + regabi (#2673) regabi is not supported on FreeBSD, the tests must act accordingly commit 1b2f7f00519cdb14e150d61e225e7a1250ec4dc8 Author: Derek Parker Date: Tue Aug 24 05:53:27 2021 -0700 pkg/proc: Parse Goroutine ID in eBPF tracer (#2654) This patch enables the eBPF tracer backend to parse the ID of the Goroutine which hit the uprobe. This implementation is specific to AMD64 and will have to be generalized further in order to be used on other architectures. commit c379296cc8525333db69322cd56019be591a72be Author: Alessandro Arzilli Date: Mon Aug 23 20:32:02 2021 +0200 _scripts: auto check that pkg/proc and runtime are synchronized (#2557) Adds a script that check automatically that the the assumptions that pkg/proc makes about runtime are met by the actual runtime, using a combination of parsing and magic comments. Also emits a file describing all the struct fields, constants and variables of the runtime that we use in pkg/proc. commit 3d6bbbe92ab7813bacb421027fce8f69ba3ddeec Author: Alessandro Arzilli Date: Mon Aug 23 20:28:27 2021 +0200 terminal: config -list should print strings in quotes (#2605) Commit 8e91d3b0b added a number of configuration options to control the colors of sytnax highlighting, unfortunately 'config -list' will print all of those to stdout without quoting them, resulting in the color of the last one being applied to all subsequent text. Change 'config -list' to print strings in quotes so that we don't accidentally send escape sequences to the terminal. commit 7cdf48605be2809aecbd11f61a16f9edd32c5d15 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Aug 23 11:27:49 2021 -0700 service/dap: clarify handling of relative program path (#2653) * service/dap: add test verifying handling of relative program path * Add exec test, log build dir and document in --help Co-authored-by: Polina Sokolova commit d76181bba5814083b1f5e2dcd5ae83914d7ac82e Author: Alessandro Arzilli Date: Fri Aug 20 18:32:56 2021 +0200 Documentation: add notes on porting Delve to other architectures (#2666) commit df1108b277fc7e2e19f25e5c002f1fd781328c44 Author: Derek Parker Date: Wed Aug 18 00:08:57 2021 -0700 *: v1.7.1 (#2662) commit a4d416d5f182592fdb0bf8e1cf356fa95b301296 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Aug 17 11:40:31 2021 -0700 service/dap: add test that verifies output path is relative to wd (#2656) * service/dap: add test that verifies output path is relative to wd * Use cleanExeName to get the right output name on Win Co-authored-by: Polina Sokolova commit 694b45c8939efcc56320dfbe4bceb5274eb8b38a Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Aug 16 08:51:23 2021 -0700 service/dap: fix noDebug mode to handle requests while running (#2658) Co-authored-by: Polina Sokolova commit 513751573ea101f1d0f9373ed9b02fb716bfe566 Author: Alessandro Arzilli Date: Tue Aug 10 11:40:39 2021 +0200 service: fix sameuser check (#2642) Change the socket search to check both the remote and local fields of the socket match the socket we want to find. Sockets are identified by the 4-uple local_addr, local_port, remote_addr, remote_port Two socket can differ by a single one of this four elements. It is possible for the same local_port to be used by two different sockets, as long as they are connecting to different remote addresses (or remote ports). An example of this bug in action can be seen at: https://github.com/golang/vscode-go/runs/3141270564?check_suite_focus=true There the server starts listening on 127.0.0.1:46011 and rejects a valid client connection by finding the following socket: 60: 0100007F:DD82 0100007F:962D 06 00000000:00000000 03:00000133 00000000 0 0 0 3 0000000000000000 the local address of this socket is 0100007F:DD82 (127.0.0.1:56706), and the remote address is 0100007F:962D (127.0.0.1:38445). The reported error is: closing connection from different user (127.0.0.1:56706): connections to localhost are only accepted from the same UNIX user for security reasons note how the local port does match the socket line (56706) but the remote port is wrong (38445 instead of 46011). Note also that the state of this socket is 06, or TIME_WAIT, which would be impossible if this was the right socket, since the right socket would still be open. Fixes https://github.com/golang/vscode-go/issues/1555 commit c426c5b38dbec14921633f33290a9f7442953bf4 Author: Suzy Mueller Date: Mon Aug 9 11:56:20 2021 -0600 pkg/proc: configure target to not clear stepping breakpoints (#2635) In order for DAP to support halting the program (either manually or on a breakpoint) performing some action and then resuming execution, there needs to be a way to stop the program without clearing the internal breakpoints. This is necessary for log points and stopping the program to set breakpoints. The debugging UI makes it seem like a user should be able to set or clear a breakpoint at any time. Adding this ability to complete synchronous requests while the program is running is thus important to create a seamless user experience. This change just adds a configuration to determine whether the target should clear the stepping breakpoints, and changes the server to use this new mode. Using the new mode means that the DAP server must determine when it expect the next to be canceled and do this manually. commit 4264bf00f2e88927cda8eddb7ef8a04c84b58522 Author: Alessandro Arzilli Date: Mon Aug 9 19:41:25 2021 +0200 proc,terminal,service: support stack watchpoints (#2521) * terminal,service: add way to see internal breakpoints Now that Delve has internal breakpoints that survive for long periods of time it will be useful to have an option to display them. * proc,terminal,service: support stack watchpoints Adds support for watchpoints on stack allocated variables. When a stack variable is watched, in addition to the normal watchpoint some support breakpoints are created: - one breakpoint inside runtime.copystack, used to adjust the address of the watchpoint when the stack is resized - one or more breakpoints used to detect when the stack variable goes out of scope, those are similar to the breakpoints set by StepOut. Implements #279 commit f3e76238e353e27b8abdc3db9b97025948a791eb Author: Alessandro Arzilli Date: Mon Aug 9 19:16:24 2021 +0200 proc: move breakpoint condition evaluation out of backends (#2628) * proc: move breakpoint condition evaluation out of backends Moves breakpoint condition evaluation from the point where breakpoints are set, inside ContinueOnce, to (*Target).Continue. This accomplishes three things: 1. the breakpoint evaluation method needs not be exported anymore 2. breakpoint condition evaluation can be done with a full scope, containing a Target object, something that wasn't possible before because ContinueOnce doesn't have access to the Target object. 3. moves breakpoint condition evaluation out of the critical section where some of the threads of the target process might be still running. * proc/native: handle process death during stop() on Windows It is possible that the thread dies while we are inside the stop() function. This results in an Access is denied error being returned by SuspendThread being called on threads that no longer exist. Delay the reporting the error from SuspendThread until the end of stop() and only report it if the thread still exists at that point. Fixes flakyness with TestIssue1101 that was exacerbated by moving breakpoint condition evaluation outside of the backends. commit 4e5bddee9b8e4e819c7d641be065605f469e22d8 Author: hitzhangjie Date: Tue Aug 10 01:08:12 2021 +0800 cmd/dlv: use simple chan read instead of select-case (#2649) commit 6b83e6baae93c39bf983969c901a01a00d4a9fcd Author: hitzhangjie Date: Fri Aug 6 14:26:44 2021 +0800 vendor: run go mod vendor (#2647) commit e175d68e97ce02cee258ed248059148348db9f95 Author: Alessandro Arzilli Date: Fri Aug 6 07:19:27 2021 +0200 service/dap: fix race condition in TestContinueOnEntry (#2641) The Threads request sent immediately after the ConfigurationDone request can be processed in two possible states: - while the program is being executed, when it will return Id=1, Name=Dummy - after the program terminates, when it will return Id=-1, Name=Current additionally the response could be received in any order with the Terminate event. Remove the problematic Threads request from the test. commit 43d50202f365ca6d988cae6dc92dbfe7ae8b9946 Author: Derek Parker Date: Thu Aug 5 10:55:27 2021 -0700 pkg/terminal: Allow fuzzy searching tab completions (#2633) This patch implements fuzzy searching for tab completions in the terminal client. Under the hood it is using a trie data structure (https://en.wikipedia.org/wiki/Trie) to perform very fast prefix / fuzzy searches. commit 985eca462c9f67ff0b014990f9dbe57d417741e6 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Aug 5 10:16:15 2021 -0700 service/dap: log execution-halted message when setting breakpoints (#2631) Co-authored-by: Polina Sokolova commit 7caa534d7617b2d12b7e821394be95c59cbb8ada Author: Derek Parker Date: Thu Aug 5 04:53:09 2021 -0700 service/debugger: Remove target lock on GetBufferedTracepoints (#2645) There is already a lock on the actual buffered tracepoints collection within proc, and this method call doesn't do anything to mutate Target otherwise so we shouldn't be opening ourselves up for a race condition error or any other kind of parallelism problem. Additionally, with this lock we essentially can never get the data until the process has exited becuase `continue` will lock the target. This change allows us to get the buffered tracepoint information immediately and display it as the program is running. commit 2971fd4c685aeda74b087078f203436c73f94a07 Author: Alessandro Arzilli Date: Wed Aug 4 23:12:58 2021 +0200 service/dap: fix TestNextParked/TestStepInParked (#2643) The loop searching for a suitable goroutine is not guaranteed to ever find it, and failing to find one is not an error. Changes testStepParkedHelper to match the behavior of TestNextParked in proc_test.go. Deletes TestStepInParked because it does not test anything meaningful beyond what's already tested by TestNextParked. commit 4e242098f8f2ffe6b80a5422bf4340ef370c651e Author: Alessandro Arzilli Date: Wed Aug 4 23:12:15 2021 +0200 tests: check presence of gcc for cgo tests (#2644) The install of gcc sometimes fails on our CI, it is not an error if the tests for cgo can not run because there's no C compiler. commit f95340ae1bf9fed8740d5fd39f5758d41770d967 Author: Derek Parker Date: Wed Aug 4 01:00:32 2021 -0700 pkg/proc: Fix build errors (#2637) Fix ebpf build errors on Windows and update bininfo.Location API call. Fixes #2636 commit 7462767355bec5818d2f3f287ee27c4a01bc7751 Author: nd Date: Tue Aug 3 19:42:53 2021 +0200 teamcity: report go test exit code on windows (#2638) commit fdb5189e8cf9721f0500a3512993fd4ecef71369 Author: Alessandro Arzilli Date: Tue Aug 3 18:51:15 2021 +0200 dwarf/op,proc: implement more DWARF expression opcodes (#2606) commit 229fcf1559ac4755b013c734181f0e956670af20 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Aug 3 09:48:01 2021 -0700 cmd: refactor building logic into a helper (#2629) * cmd: refactor building logic into a helper * Address review comments Co-authored-by: Polina Sokolova commit df5812bf2d623647ef705cacb9ac5fc4eb37f29e Author: Suzy Mueller Date: Tue Aug 3 10:47:24 2021 -0600 pkg/proc: add tests for next interrupted by bp (#2632) Adds tests that make sure that when a next request is interrupted by a breakpoint, the stepping breakpoints are cleared. commit 10406f96d539d905fbe8e8d102d7a01e61f26f04 Author: Derek Parker Date: Sat Jul 31 08:16:26 2021 -0700 *: Initial eBPF tracing support (#2625) commit 89ed5a0b19725999db55706a7b191a6e94065414 Author: Suzy Mueller Date: Thu Jul 29 11:34:01 2021 -0600 service/dap: page stack frames (#2597) Returning monotonically increasing totalFrames values for subsequent requests can be used to enforce paging in the client. If we are not at the end of the stackFrames that are returned, we return a higher total frames to suggest to the client that they should request more frames. commit b87a1fc55d6175de83ab20d0a712eacb5253509d Author: Suzy Mueller Date: Thu Jul 29 11:27:49 2021 -0600 service/dap: make next while nexting error more clear (#2622) To make it more clear that the user can resume the program when they encounter a next while nexting error, make the exception information have instructions for resuming the program. This implements the suggestions outlined by @polinasok in #2443. commit a2b839990e21690e9e60a74c582c4acece6196d8 Author: Austin Clements Date: Wed Jul 28 11:18:20 2021 -0400 Fix crashes on Go dev.typeparams (soon to be Go main branch) (#2627) * proc: Go 1.18 removes the _defer.siz field As of Go 1.17, the _defer.siz field is always 0 because _defer no longer stores defer call arguments at all. golang.org/cl/326062 removes it entirely for Go 1.18. Simply treat it as 0 if the field is missing from the _defer type. * proc: Go 1.18 changes _defer.fn from *funcval to func() golang.org/cl/325918 changed the type of the _defer.fn field from *funcval to func() for Go 1.18. This CL was later reverted because it caused failures in Delve, but we would like to un-revert it. Handle this change by inspecting the type of this field before decoding it. commit cb73ef8f83d7837486b3f7b9043ce07df96e466c Author: Derek Parker Date: Wed Jul 28 04:13:32 2021 -0700 pkg/terminal: Ignore existing breakpoints for continue until (#2624) Ignore existing breakpoints when using the continue command to continue to a specific location such as `continue main.main`. The point of this command is to continue to a specific location, so if there is already a breakpoint set there there should be no error returned, just continue until we hit the breakpoint already set in that location. commit 56731bd88a880ae8563ff23498793e6b3bd6641e Author: Derek Parker Date: Wed Jul 28 04:12:51 2021 -0700 Documentation: Improve help output for examinemem (#2623) Before this change when you typed `help` at the Delve prompt you would only see the following: ``` examinemem (alias: x) Examine memory: ``` Now with this patch the output is more descriptive: ``` examinemem (alias: x) Examine raw memory at the given address. ``` commit f6681c60903cc126ba060f01e2eab1341b06b526 Author: Derek Parker Date: Tue Jul 27 23:58:02 2021 -0700 pkg/proc: Prefer throw instead of fatalthrow (#2616) * pkg/proc: Prefer throw instead of fatalthrow Currently there is a breakpoint set at runtime.fatalthrow to catch any situation where the runtime crashes (e.g. deadlock). When we do this, we go up a frame in order to parse the crash reason. The problem is that there is no guarentee the "s" variable we attempt to parse will still be considered "live". Since runtime.fatalthrow is never called directly, set a breakpoint on runtime.throw instead and prevent having to search up a stack frame in order to get the throw reason. Fixes #2602 * service/dap: Fix TestFatalThrowBreakpoint * Reenable TestFatalThrow DAP test * service/dap: Don't skip test on < 1.17 * service/dap: Update test constraint for 1.16 * pkg/proc: Reinstate runtime.fatalthrow as switchstack exception commit 26e7f67cc403d6729e9291f629cf2741bc173c61 Author: Hyang-Ah Hana Kim Date: Tue Jul 27 12:38:48 2021 -0400 cmd/dlv: dlv version --verbose (#2615) * cmd/dlv: dlv version --verbose That prints out runtime/debug.BuildInfo read from the dlv binary. Users can retrieve the same info using `go version -m ` but I think it is convenient to have. If dlv was built from cloned delve repo: ``` $ ./dlv version -v Delve Debugger Version: 1.7.0 Build: $Id: e353a65161e6ed74952b96bbb62ebfc56090832b $ Build Details: go1.16.5 mod github.com/go-delve/delve (devel) dep github.com/cosiner/argv v0.1.0 h1:BVDiEL32lwHukgJKP87btEPenzrrHUjajs/8yzaqcXg= ... ``` If dlv was built with `go install github.com/go-delve/delve@latest` with go1.16+, or `GO111MODULE=on go get github.com/go-delve/delve@latest` from a clean main module: ``` $ ./dlv version -v Delve Debugger Version: 1.7.0 Build: $Id: e353a65161e6ed74952b96bbb62ebfc56090832b $ Build Details: go1.16.5 mod github.com/go-delve/delve v1.7.0 dep github.com/cosiner/argv v0.1.0 h1:BVDiEL32lwHukgJKP87btEPenzrrHUjajs/8yzaqcXg= ... ``` * remove an accidentally added bogus test commit 2ecc025311ce39aa2ec4bdb24c05934351c191fd Author: Alessandro Arzilli Date: Mon Jul 26 17:57:09 2021 +0200 terminal: add prompt when breakpoint is hit during next/step/stepout (#2548) * terminal: add prompt when breakpoint is hit during next/step/stepout Adds a prompt asking the user what to do when a breakpoint is hit on a different goroutine while next/step/stepout is being executed. Gives the user the opportunity to cancel next/step/stepout, continue once skipping the breakpoint or automatically skipping all other concurrent breakpoints until next/step/stepout is finished. Fixes #2317 commit e9b20d5ee10aea3fcc600ce57685af7309fba921 Author: Alessandro Arzilli Date: Mon Jul 26 17:40:12 2021 +0200 proc: use signed comparison when searching image for module data (#2621) StaticBase is the difference between the entry point declared in the image file and the entry point as loaded in memory, since this difference could be a negative number we have to use a signed comparison when searching for a mapping. Causes intermittent test failures on windows when resolving interface types for position independent executables. Fixes #2620 commit 150ef04177a8aa8be26b8988847702b2ccc30444 Author: nd Date: Sat Jul 24 20:14:45 2021 +0200 TeamCity: prefer go rc builds over beta (#2619) Works around https://github.com/golang/go/issues/47367. commit aaed14ffcbc76d7d856e8bcf3961789ad9fe5a42 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Jul 23 14:04:53 2021 -0700 service/dap: fix backend parsing in replay mode (#2618) Co-authored-by: Polina Sokolova commit f1edc45f7518ab976b5ab3e26775f8c17707be66 Author: Suzy Mueller Date: Fri Jul 23 11:12:57 2021 -0600 service/dap: disable TestFatalThrowBreakpoint for Go 1.17 (#2614) * service/dap: disable TestFatalThrowBreakpoint for Go 1.17 commit 39274f6028b38e7b7b674e84bf96694080e537fe Author: Alessandro Arzilli Date: Fri Jul 23 18:21:24 2021 +0200 proc: make moduleDataToImage more robust (#2613) Conversion form a moduledata object into an image object was implemented by looking for a function covering the start address of the text section of the moduledata object, and then converting that into its corresponding image. Unfortunately this seems to not always work. In particular it does not work on linux/386 with go1.17 (but it might also fail on other combinations): the start address of the text section is, for whatever reason, not part of any function. As a fallback simply scan all images we know of and return the closest one that has start address less than or equal to the start address of the text section we are looking for. Fixes TestPluginVariables on go1.17/linux/386. Fixes #2611 Co-authored-by: a commit f74b7a6e395ab9885b740e7fe80e5efa7cc73690 Author: Hyang-Ah Hana Kim Date: Thu Jul 22 14:05:37 2021 -0400 all: update github.com/spf13/cobra to v1.1.3 (#2572) This removes indirect dependencies from go.mod, and includes the fix for the missing -help flag info. The latest cobra release is v1.2.1. Given that there were minor security-related dependency cleanup during v1.2 release, I was tempted to pick up the latest version, but that caused dependency updates in golang.org/x/sys and golang.org/x/tools which may be too recent (golang.org/x/* follow the go's release support policy, so recent versions may not be compatible with go versions beyond go's official version support policy). Verified that dlv still builds with go1.12.x. (go1.12 is the oldest version of go that can build the latest delve already). $ go get -d github.com/spf13/cobra@v1.1.3 $ go mod tidy $ go mod vendor $ go run _scripts/gen-usage-docs.go commit 898907354835213f97d10adbd4ba62caba127b08 Author: Alessandro Arzilli Date: Thu Jul 22 19:16:42 2021 +0200 terminal: improve 'on' command (#2556) * terminal: improve 'on' command Adds the ability to edit the list of commands executed after stopping on a breakpoint, as well as converting a breakpoint into a tracepoint and vice versa. Prior to this it was possible to add commands to a breakpoint but removing commands or changing a breakpoint into a tracepoint, or vice versa, could only be done by removing and recreating the breakpoint. commit b7d8edcdaf67e7255c9610e7fed224b0db75fb02 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jul 22 08:52:04 2021 -0700 service/dap: handle unexpected debugger termination (EOF) error (#2574) Using issue419.go, I observed that the continue command fails with an error when debugger receives and forwards an interrupt. In spite of the stopped event, vscode still shows the state as RUNNING because the threads request is unable to retrieve any threads, but at least one dummy thread is always expected. Co-authored-by: Polina Sokolova commit b41e47a30539294818283b89dae4d4879242e0c5 Author: nd Date: Wed Jul 21 17:35:36 2021 +0200 teamcity: use same token everywhere (#2609) commit 3941af1d02e85e5c316d72ac4077ff13cdaa2e08 Author: Suzy Mueller Date: Wed Jul 21 10:26:40 2021 -0500 service/dap: limit the number of goroutines to return from a threads request (#2595) This adds a cap and a log message if there are many goroutines. This will help prevent the debugger from freezing, but does not yet address making sure the interesting goroutines are the ones that are returned. Updates golang/vscode-go#129 commit 658d36cb1909cd4267e538b10f2f84df8f752216 Author: Alessandro Arzilli Date: Wed Jul 21 17:24:19 2021 +0200 proc: allow multiple overlapping internal breakpoints (#2519) Changes Breakpoint to allow multiple overlapping internal breakpoints on the same instruction address. This is done by changing the Breakpoint structure to contain a list of "breaklets", each breaklet has a BreakpointKind and a condition expression, independent of the other. A breakpoint is considered active if any of its breaklets are active. A breakpoint is removed when all its breaklets are removed. We also change the terminology "internal breakpoint" to "stepping breakpoint": HasInternalBreakpoints -> HasSteppingBreakpoints IsInternal -> IsStepping etc... The motivation for this change is implementing watchpoints on stack variables. Watching a stack variable requires also setting a special breakpoint to find out when the variable goes out of scope. These breakpoints can not be UserBreakpoints because only one user breakpoint is allowed on the same instruction and they can not be internal breakpoints because they should not be cleared when a next operation is completed (they should be cleared when the variable watch is cleared). Updates #279 commit c5e533b131d8c8f1801a9b1cc15f68241f746833 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Jul 21 07:43:06 2021 -0700 Treat SIGTERM as a server disconnect signal (#2580) Co-authored-by: Polina Sokolova commit 69615b3604d5921c574f0df79be4b865614db50a Author: Luis Gabriel Gomez Date: Wed Jul 21 11:38:04 2021 -0300 service/dap: Support for replay and core modes (#2367) This PR aims to add support for rr replay and core actions from the DAP layer. This basically encloses the following: New launch modes: replay and core The following modes are added: replay: Replays an rr trace, allowing backwards flows (reverse continue and stepback). Requires a traceDirPath property on launch.json pointing to a valid rr trace directory. Equivalent to dlv replay command. core: Replays a core dump file, showing its callstack and the file matching the callsite. Requires a coreFilePath property on launch.json pointing to a valid coredump file. Equivalent to dlv core command. Dependencies To achieve this the following additional changes were made: Implement the onStepBackRequest and onReverseContinueRequest methods on service/dap Adapt onLaunchRequest with the requried validations and logic for these new modes Use CapabilitiesEvent responses to enable the StepBack controls on the supported scenarios (see dicussion here) Add the corresponding launch.json support on vs code: Support for replay and core modes golang/vscode-go#1268 commit a14bec4cfc52e00806e359a8dd2ca4f10126ea14 Author: nd Date: Wed Jul 21 16:26:13 2021 +0200 Make teamcity ui settings readonly (#2608) * teamcity: specify working github token in dsl * teamcity: disable settings editing in UI If VCS root doesn't have push permissions, push of settings changes made in UI fail. After that synchronization with VCS is disabled in order to not loose UI changes. With read-only UI all changes have to be made in dsl. commit 65f436494cbad4841a89f8c76dda45395698a391 Author: nd Date: Wed Jul 21 16:19:23 2021 +0200 teamcity: specify working github token in dsl (#2607) commit 776b86ffc2259ca76cfa95a4dd891e5aad0f0616 Author: Suzy Mueller Date: Tue Jul 20 10:51:08 2021 -0500 service/dap: send continued event before step response (#2594) * service/dap: send continued event before step response Send the continued event before the step response to make sure that there is no time where the client believes that only a single thread is running. Updates golang/vscode-go#1617 * move to helper commit 38aaf274a92fc620119bdf257500ee3b3f677774 Author: Alessandro Arzilli Date: Mon Jul 19 17:09:18 2021 +0200 service/dap: fix TestPreSetBreakpoint (#2600) TestPreSetBreakpoint sometimes fail because a goroutine is stopped in some runtime/internal package instead of just 'runtime'. commit d6556b85b1fbf563a9cd9aa2d3ebf88742ab0b82 Author: Alessandro Arzilli Date: Mon Jul 19 17:03:18 2021 +0200 TeamCity: remove 1.16 testing for linux/arm64, windows/amd64 and mac/* (#2601) We've only ever tested the latest version of Go on everything except linux/amd64. commit 4e78f7f39113c623856de634fe6831553a774e03 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Jul 18 11:06:52 2021 -0700 service/dap: add modes comments (TODO from PR/2367) (#2575) Co-authored-by: Polina Sokolova commit af378d396f6d2a1e8a7286fbfa984a4674037b7a Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Jul 18 02:37:41 2021 -0700 service/dap: add backend launch/attach attribute (#2567) Co-authored-by: Polina Sokolova commit 2a22af2e77fad64c4ed9b9f1076e3165fc18116c Author: nd Date: Sat Jul 17 18:58:45 2021 +0200 teamcity: fix settings (#2598) commit feb55342eb28c836e15110f67e9dbf237c5097c8 Author: Suzy Mueller Date: Fri Jul 16 16:50:37 2021 +0000 service/dap: add len as metadata for map (#2584) commit 5459034a98090c303617cee43f571dd34dde52a6 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Jul 16 09:49:16 2021 -0700 cmd/dap: server - always headless, target - always foregrounded (#2589) Co-authored-by: Polina Sokolova commit 584191a75c7b4b5606c4c2882f78ade1b38e0a25 Author: Derek Parker Date: Fri Jul 16 06:31:52 2021 -0700 *: Release 1.7.0 (#2591) commit 9df8f1499f10432698ea184c839a2a6f75264e93 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jul 15 14:15:49 2021 -0700 service/dap: variables response must not have null variables array (#2592) Co-authored-by: Polina Sokolova commit 890cde3d4c766d8b918ad945501257fd1ddd3ba8 Author: Suzy Mueller Date: Wed Jul 14 17:32:46 2021 -0400 service/dap: send terminated event when disconnecting (#2587) * service/dap: send terminated event when disconnecting If the program terminates while disconnecting, either because it was killed or otherwise, send a terminated event. commit 175ca0c769270459b7db28a371534031c002d31c Author: Derek Parker Date: Wed Jul 14 09:28:54 2021 -0700 service/rpc2: Fix panic in ListDynamicLibraries (#2586) The slice `out.List` is created with a length of 0 but a capacity of `len(imgs)`. This causes the line below to panic as we try to index into the `out.List` slice instead of append to it. This patch resolves the issue by appending instead of indexing into the slice. Co-authored-by: Derek Parker commit f86ed675d8eec075b2ededb1f88990e5fc5dd9ea Author: Suzy Mueller Date: Tue Jul 13 11:38:28 2021 -0400 service/dap: add panic and throw text to stopped event (#2559) * service/dap: add panic and throw text to stopped event We can add more information to the stopped events on errors using the `Text` field in the stopped event. We already use this to display the runtime errors. Adding this information to the stopped reason will also help to show the user additional info when a stopped event is not associated with a particular goroutine. commit 686989e1b3d996ce44c6b5dd8cd77c21cbe15013 Author: Augusto Yao <727004611@qq.com> Date: Tue Jul 13 23:37:26 2021 +0800 debugserver: fix typo in checking whether debugserver support unmask_… (#2581) * debugserver: fix typo in checking whether debugserver support unmask_signals * gdbserver.go: fix issues in deepsource:go commit 569b772b82f9d47ba3b7e90b392f007f7a1a97dc Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Jul 12 09:49:02 2021 -0700 proc/gdbserial: ContinueOnce returns StopUnknown, not StopExited on non-exited error (#2577) Co-authored-by: Polina Sokolova commit 1399f20585448a5240c2500acc16031b8c52ecb3 Author: Alessandro Arzilli Date: Mon Jul 12 18:48:11 2021 +0200 TeamCity: add go1.17 to test matrix, disable go-tip builds (#2576) commit f0a32c8e1b6571c8c1cd4ed89dcb9c784481f422 Author: Alessandro Arzilli Date: Thu Jul 8 17:47:53 2021 +0200 Go 1.17 support branch (#2451) * proc: support new Go 1.17 panic/defer mechanism Go 1.17 will create wrappers for deferred calls that take arguments. Change defer reading code so that wrappers are automatically unwrapped. Also the deferred function is called directly by runtime.gopanic, without going through runtime.callN which means that sometimes when a panic happens the stack is either: 0. deferred function call 1. deferred call wrapper 2. runtime.gopanic or: 0. deferred function call 1. runtime.gopanic instead of always being: 0. deferred function call 1. runtime.callN 2. runtime.gopanic the isPanicCall check is changed accordingly. * test: miscellaneous minor test fixes for Go 1.17 * proc: resolve inlined calls when stepping out of runtime.breakpoint Calls to runtime.Breakpoint are inlined in Go 1.17 when inlining is enabled, resolve inlined calls in stepInstructionOut. * proc: add support for debugCallV2 with regabi This change adds support for the new debug call protocol which had to change for the new register ABI introduced in Go 1.17. Summary of changes: - Abstracts over the debug call version depending on the Go version found in the binary. - Uses R12 instead of RAX as the debug protocol register when the binary is from Go 1.17 or later. - Creates a variable directly from the DWARF entry for function arguments to support passing arguments however the ABI expects. - Computes a very conservative stack frame size for the call when injecting a call into a Go process whose version is >=1.17. Co-authored-by: Michael Anthony Knyszek Co-authored-by: Alessandro Arzilli * TeamCity: enable tests on go-tip * goversion: version compatibility bump * TeamCity: fix go-tip builds on macOS/arm64 Co-authored-by: Michael Anthony Knyszek commit e1febcf6093bfab21830a1f18bc55e8787b7f538 Author: Suzy Mueller Date: Thu Jul 8 01:27:54 2021 -0400 service/dap: send dap error response on dap error (#2561) The code previously expected the server to close when receiving a message that it could not decode. However, there may be changes to the spec that make new requests that we have not handled yet. In that case, it would be preferable to return an error and continue handling incoming requests. commit 0bf3e790cd4abbcff1d4cbc42896eed188059cf3 Author: Suzy Mueller Date: Thu Jul 8 01:08:52 2021 -0400 service/dap: set hit breakpoint ids (#2550) commit c617ed8189a92399e7b25197c0bb20ecf7503888 Author: Alessandro Arzilli Date: Tue Jul 6 18:28:53 2021 +0200 proc/core/minidump,proc/gdbserial: update broken ext links (#2570) The LLVM project archived their repository and moved it elsewhere, Microsoft broke their minidump documentation URLs. commit b9fcb03ff473f83d3885b5f3f852192e7ccc049b Author: Alessandro Arzilli Date: Tue Jul 6 17:53:39 2021 +0200 proc/native,proc/gdbserial: detect and complain about Rosetta (#2569) Delve does not run under Rosetta. Detect this condition and point confused users towards the solution. commit de117a2f4f16350a59b06970693d383613399782 Author: Suzy Mueller Date: Sat Jul 3 09:48:35 2021 -0400 pkg/proc: fix bug where frame parameter is ignored if no goroutine (#2563) ConvertEvalScope() attempts to find the scope for the specified goroutine id and frame index. If the goroutine that is found is nil, then it falls back to the threads stack trace to find the scope. This fix makes sure that the frame id is taken into account for thread strack traces as well. commit 9dfd164cf9b9beb5ef3dc731b1445ce593ee1dd3 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Jul 2 10:14:43 2021 -0700 service/dap: tune up shutdown logic (#2564) Co-authored-by: Polina Sokolova commit 1b0c4310c440ef0ebf0a53983e20bfd28cdff34a Author: Alessandro Arzilli Date: Fri Jul 2 18:37:55 2021 +0200 proc: give unique addresses to registerized variables (#2527) We told clients that further loading of variables can be done by specifying a type cast using the address of a variable that we returned. This does not work for registerized variables (or, in general, variables that have a complex location expression) because we don't give them unique addresses and we throw away the compositeMemory object we made to read them. This commit changes proc so that: 1. variables with location expression divided in pieces do get a unique memory address 2. the compositeMemory object is saved somewhere 3. when an integer is cast back into a pointer type we look through our saved compositeMemory objects to see if there is one that covers the specified address and use it. The unique memory addresses we generate have the MSB set to 1, as specified by the Intel 86x64 manual addresses in this form are reserved for kernel memory (which we can not read anyway) so we are guaranteed to never generate a fake memory address that overlaps a real memory address of the application. The unfortunate side effect of this is that it will break clients that do not deserialize the address to a 64bit integer. This practice is contrary to how we defined our types and contrary to the specification of the JSON format, as of json.org, however it is also fairly common, due to javascript itself having only 53bit integers. We could come up with a new mechanism but then even more old clients would have to be changed. commit 7c82164264198b4009fe438910754257f89d8af3 Author: Alessandro Arzilli Date: Thu Jul 1 20:25:33 2021 +0200 terminal,service: Add filtering and grouping to goroutines command (#2504) Adds filtering and grouping to the goroutines command. The current implementation of the goroutines command is modeled after the threads command of gdb. It works well for programs that have up to a couple dozen goroutines but becomes unusable quickly after that. This commit adds the ability to filter and group goroutines by several different properties, allowing a better debugging experience on programs that have hundreds or thousands of goroutines. commit 4fd6c483e1efe349e0ed98d61693984f764a23fb Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Jun 29 06:15:47 2021 -0700 dap: update dlv dap --help (#2558) Co-authored-by: Polina Sokolova commit 96b379b5a2aecd818cdd34689a9695f32aab956f Author: Derek Parker Date: Tue Jun 29 06:14:24 2021 -0700 service/debugger: improve CreateBreakpoint docs (#2553) The existing documentation was a little light on details. This patch gives more insight into how the argument to this function is used and interpreted. * service/rpc2,service/debugger: more doc updates Combine debugger.CreateBreakpoint documentation with the documentation that already existed for the rpc2 server CreateBreakpoint method. Also adds more contextual information for both the server and client with links to debugger.CreateBreakpoint documentation. commit d9ba60dcfe6aee5998eada4c52def680b123b090 Author: Alessandro Arzilli Date: Mon Jun 28 18:48:51 2021 +0200 test: disable avx512 test when backend is 'rr' (#2547) The rr backend does not report avx512 registers back to us. commit 7f527d26a8e1e2d961dabc9c56b976f52f1d6eef Author: Alessandro Arzilli Date: Mon Jun 28 17:42:06 2021 +0200 gdbserial: actually fix ZMM register support (#2516) PR #2498 / commit d552b338 left out some code due to a clerical error. commit 1ebfc5c37b461206e08b17c2a90cc1bc246f388e Author: Suzy Mueller Date: Mon Jun 28 11:39:34 2021 -0400 service/dap: add throw reason to exception info (#2524) We can get the throw reason by looking at the argument "s" in runtime.throw. This is not currently working in Go 1.16 or Go 1.17 (see golang/go#46425), but does work in Go 1.15 and Go 1.14 commit 7411290468494f281820b4d9b083015c14521cc0 Author: Derek Parker Date: Sat Jun 26 00:16:35 2021 -0700 *: Add .vscode to .gitignore (#2554) We should ignore this by default. commit 7b98f5870d1506a4551cc45b0fd8eea5372c35f7 Author: Suzy Mueller Date: Wed Jun 23 19:51:57 2021 -0400 service/dap: add string value of byte/rune slice as child (#2541) Load limit for metadata string is set to MaxStringLen commit 0b38b5d4ec9d7f00c6ddf50806536d6a0979f933 Author: Suzy Mueller Date: Wed Jun 23 14:21:19 2021 -0400 service/dap: fix error string format (#2549) commit 0a19c780210dd8bff5af1f0e153fc54d90914b48 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Jun 22 08:14:47 2021 -0700 service/dap: increase default string loading limit and refactor (#2546) Co-authored-by: Polina Sokolova commit 544a803a80a313c44668204f79f1dafc6e199f26 Author: Derek Parker Date: Tue Jun 22 04:37:46 2021 -0700 proc,dwarf: Improve DWARF v5 support (#2544) While Go still mostly uses DWARF v4, newer versions of GCC will emit DWARF v5 by default. This patch improves support for DWARF v5 by parsing the .debug_line_str section and using that during file:line lookups. This patch only includes support for files, not directories. Co-authored-by: Derek Parker commit 42ecbd4413a7092f8665f465dbad0e7337e3f43e Author: Derek Parker Date: Tue Jun 22 04:35:13 2021 -0700 proc,terminal: Ensure correct exit status (#2543) Ensure that any command executed after the process we are trying to debug prints a correct and consistent exit status. Previously the exit code was being lost after the first time we printed that a process has exited. Additionally, certain commands would print the PID of the process and other would not. This change makes everything more correct and consistent. commit d3f4a8d44395b8318d177c4227ebe4eee26d6020 Author: Derek Parker Date: Thu Jun 17 05:35:33 2021 -0700 proc: remove stack barrier support (#2540) * proc: remove stack barrier support Stack barriers were removed way back in Go 1.9 so it's safe to eliminate and clean up this code now. commit 69485a639d36eee0fd2ce6b0ab33fd02fe36c458 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Jun 16 13:27:38 2021 -0700 service/dap: separate tests for var value truncation and str loading limits (#2539) Co-authored-by: Polina Sokolova commit 29825d41a6f60f08d1ccfa84e301e03768a45e84 Author: Alessandro Arzilli Date: Wed Jun 16 22:05:17 2021 +0200 terminal,api: move PrintStack function (#2537) Commit 30cdedae6910f5e9af6739845bacfd5b8778e745 introduced a dependency from service/dap to pkg/terminal to call a stack printing function, it's weird to have code that implements the DAP protocol depend on the code for the JSON-RPC client. Move PrintStack to a different package that can be called by both. commit 1ecdb3be05034ad3497b893ead545fb0942a3000 Author: Hyang-Ah Hana Kim Date: Tue Jun 15 09:36:39 2021 -0400 sameuser: log the uid/remoteUID when they are not matching (#2535) Updates https://github.com/golang/vscode-go/issues/1555 commit 688f94a4f8383e22972df8da8631eb282dac1c8c Author: Suzy Mueller Date: Fri Jun 11 13:46:49 2021 -0400 service/dap: truncate value for expandable types in hover (#2529) On hovers, including the full value for complex types is unnecessary, since the user will likely need to expand the children to inspect the values. Additionally, this can really slow down getting the hover values. This change will allow truncating the value in hover if the variable has a variables reference. Updates golang/vscode-go#1435 commit aa377789b0cea0c6857c0cbf97f541585a5b1426 Author: Suzy Mueller Date: Thu Jun 10 13:59:24 2021 -0400 service/dap: deemphasize internal runtime stack frames (#2522) Apply a presentation hint to the internal runtime stack frames, so that these can be deemphasized in the UI. This should allow users to more easily inspect their own code, and will keep the option to view those frames if they choose to. commit 30b3cc2c6fa87ad7d6f24cc6f0767d4535d2bbda Author: Suzy Mueller Date: Thu Jun 10 12:34:20 2021 -0400 service/dap: implement array, slice, and map paging (#2512) If the client supports paging, we allow them to fetch array and slice items in chunks that we assume will be of a reasonable size. For example, VS Code requests indexed variables in chunks of 100. Fixes golang/vscode-go#1518 commit fb4d6f1144c7ed41840909061455205c6e0339ef Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jun 10 09:30:31 2021 -0700 service/dap: handle no-such-process error on disconnect and fix flaky test (#2476) Co-authored-by: Polina Sokolova commit 7a3faca71f7e01a97833e11ebf0683543e8159cb Author: Suzy Mueller Date: Fri Jun 4 11:35:50 2021 -0400 service/dap: make stopped event description more concise (#2523) commit 152c74e94e14aac13055c01039c6d6fe835bcf93 Author: Hyang-Ah Hana Kim Date: Fri Jun 4 03:27:57 2021 -0400 dap: add 'clipboard' support, and truncate a long value (#2513) - add 'clipboard' capability - apply a larger string limit for 'hover' and 'clipboard' context - truncate the string representation of compound (or pointer of compound) type variable commit 054e3f8ef211b50f1fa72b319e6ca44e0d673ce6 Author: Suzy Mueller Date: Thu Jun 3 12:50:53 2021 -0400 service/dap: generate continued events for step tests (#2525) commit d72b03b846925c08021607db98d30bd286283962 Author: Alessandro Arzilli Date: Wed Jun 2 22:47:32 2021 +0200 terminal: support setting hitcount conditions on breakpoints (#2518) Adds a -hitcount argument to condition that sets a hitcount condition on breakpoints. commit 585c711ce5a5c98151ade6d02f83a6da419f422a Author: Alessandro Arzilli Date: Wed Jun 2 22:46:24 2021 +0200 proc: when converting registers to slices set Base address (#2517) If the base address isn't set then indexing and slicing will not work. Large floating point registers already had the base set but small general purpose registers did not. commit b2afb7cd209e3d883513e74b71151d7a24eed74e Author: Suzy Mueller Date: Fri May 28 14:21:53 2021 -0400 pkg/proc: add support for hit count condition breakpoints (#2490) * pkg/proc: implement support for hit count breakpoints * update comment * udpate hitcount comment * update HitCond description * add test for hit condition error * respond to review * service/dap: add support for hit count breakpoints * use amendbps to preserve hit counts * update test health doc * fix failing test * simplify hit conditions * REmove RequestString, use name instead * update backend_test_health.md * document hit count cond * fix tests commit 0e5b81528f20d5fb81b325db287321a5c72a252d Author: Hyang-Ah Hana Kim Date: Thu May 27 17:23:32 2021 -0400 dap: clean output executable name for windows (#2514) If the output binary name does not end with .exe, it can't run on Windows in noDebug mode. If user-provided output name doesn't have file extension name (.exe), append it. Fixes golang/vscode-go#1473 commit 9de003043972098f4ead0c65f5d300f9561eda16 Author: Dmitry Wagin Date: Wed May 26 20:23:27 2021 +0300 fix cast to smaller integer type 'int' from 'void *' (#2511) commit d552b33822c7d913110789a4a4ca282a4c5c93c6 Author: Alessandro Arzilli Date: Wed May 26 17:21:03 2021 +0200 gdbserial,regnum: support ZMM registers, disable 'g' on debugserver (#2498) Adds DWARF register number and support for AVX-512 registers. Changes proc/gdbserial so that the 'g' and 'G' commands are never used with debugserver since they seem to corrupt the thread state when used on AVX-512 capable hardware. Also changes TestClientServer_FpRegisters to be simpler and more resilient to changes to the Go runtime. Fixes #2479 commit 680bc9a78dbbb9aea4ad2de8d55a9b44cc782d74 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed May 26 08:15:39 2021 -0700 service/dap: test refactoring (#2508) Co-authored-by: Polina Sokolova commit 1d6fc3735c966b31f82a3bc268a8d7ff745b3857 Author: Alessandro Arzilli Date: Tue May 25 19:50:07 2021 +0200 Documentation: add vimspector to list of editor plugins (#2506) commit 854552fa002227289c3971f1855aec247b704ef8 Author: Alessandro Arzilli Date: Tue May 25 19:49:46 2021 +0200 _scripts: change gen-backend_test_health.go to be more stable (#2505) Change gen-backend_test_health.go so that it only prints the number of tests skipped and not the total or the percentage. As it is it causes too many merge conflicts. commit 5e12091da29888dd85d5e2c7a60f52144919aee2 Author: Hyang-Ah Hana Kim Date: Tue May 25 13:23:41 2021 -0400 dap: use larger string type variable load limits in 'repl', 'variables' context (#2418) * dap: use larger variable load limits in 'repl', 'variables' context When evaluate requests are triggered in the context of 'repl' (DEBUG CONSOLE in VSCode) or 'variables' (copy values from VARIABLES section in VSCode), they are the result of human action and have more rooms to display. So it is not too bad to apply longer limits. Variable auto-loading for strings or arrays is nice but currently it's unclear to me how this should be integrated in the DEBUG CONSOLE or with the Copy Value feature. Until we have better ideas and tools, let's go with these larger limits. Unfortunately, the "Copy Value" from WATCH section triggers evaluate requests with "watch" context and we don't want to load large data automatically for "watch". So, users who want to query a large value should first copy the expression to DEBUG CONSOLE and evaluate it. Not ideal but not the end of the world either. Updates golang/vscode-go#1318 * dap: apply large limit only to the string type result * dap: move string reload logic to convertVariable* where other reload logic is Currently we are thinking string reload for evaluation as a temporary workaround until we figure out an intutitive way to present long strings. So, I hope moving this logic near other reload logic may be better. And, use the address based expression when reloading - when handling the function return values, we may not have an expression to use. * dap: make deep source check happy * dap: move string reevaluation logic back to onEvaluateRequest Reloading string variables is tricky if they are in registers. We don't attempt to reload them but for clarity, move this up to the onEvaluateRequest handler. For function call, use a generous limit for string load since the results are volatile. * dap: check variable isn't affected by evaluate in other context commit 63985d1d9efc4e3e27b133ac79e01b3b6eaece1e Author: Derek Parker Date: Mon May 24 12:32:44 2021 -0700 pkg/proc: Skip TestCgoStacktrace on linux/arm64 commit b440ca4ec5c5028c8a3e1672505eff2288f2bf39 Author: Derek Parker Date: Thu May 6 11:49:28 2021 -0700 Documentation: Update backend test health commit 429c02486d5a38255fd454b72c1160b74f33e21c Author: Derek Parker Date: Thu May 6 11:43:31 2021 -0700 pkg/proc: Enable CGO Stacktrace tests on arm64 These seem to magically work again on my M1 Mac so, enabling them again. commit a25d95bd236e5586026f47bbaef916cfa456a424 Author: Suzy Mueller Date: Thu May 20 16:39:28 2021 -0400 service/dap: remove unnecessary capability check The Types field is only set in childrenToDAPVariables if the client capability is supported. There is no need to check again after the children have been calculated. commit c8934dc33bb9afedb175ba35670f277bec0aa5f9 Author: Hyang-Ah Hana Kim Date: Thu May 20 13:05:47 2021 -0400 dap: handle SetVariable requests (#2440) * dap: handle SetVariable requests The handler invokes debugger.SetVariableInScope, except for string type variables. For which, we rely on the `call` command. Moved the call expression handling logic to the new `doCall` function, so it can be reused by the SetVariable requenst handler. With this PR, every successful SetVariable request triggers a StoppedEvent - that's a hack to reset the variablesHandle map internally and notify the client of this change. It will be nice if we can just update cached data corresponding to the updated variable. But I cannot find an easy and safe way to achieve this yet. Also fixed a small bug in the call expression evaluation - Previously, dlv dap returned an error "Unable to evaluate expression: call stopped" if the call expression is for variable assignment. (e.g. "call animal = "rabbit"). * dap: address comments from aarzilli resetHandlesForStop & sendStoppedEvent unconditionally after call command is left as a TODO - This is an existing code path (just refactored) and an preexisting bug. Fixing it here requires updates in TestEvaluateCallRequest and I prefer addressing it in a separate cl. Disabled call injection testing on arm64. Separated TestSetVariable into two, one that doesn't involve call injection and another that may involve call injection. Fixed variableByName by removing unnecessary recursion. * dap: address polina's comments - removed the hard reset for every variable set - added tests for various variable types - added tests that involves interrupted function calls. (breakpoint/panic) And, - changed to utilize EvalVariableInScope to access the variable instead of searching the children by name. - changed to utilize evaluate requests when verifying whether the variable is changed as expected in testing. Since now we avoid resetting the variable handles after variable reset, either we need to trigger scope changes explicitly, or stop depending on the variables request. * dap: address comments - Discuss the problem around the current doCall implementation and the implication. - Refine the description on how VS Code handles after setVariable and evaluate request (there could be followup scopes/evaluate requests). - Use the explicit line numbers for breakpoints in the SetVariable tests. - Do not use errors.Is - we could've used golang.org/x/xerrors polyfill but that's an additional dependency, and we will remove this check once tests that depend on old behavior are fixed. * dap: remove errTerminated and adjust the test * dap: evaluate in the outer frame, instead of advancing to the next bp commit 4f11320e4c4c3d78a90c7838f5c3b8f459a34003 Author: Alessandro Arzilli Date: Thu May 20 19:04:02 2021 +0200 terminal,service: add API and commands for watchpoints (#2488) Adds API calls and terminal commands to set watchpoints. commit 370ce5c01c2a4eb5a8166aa74435ff0c789f61a5 Author: Alessandro Arzilli Date: Thu May 20 19:01:20 2021 +0200 tests: increase stack depth for TestFrameEvaluation (#2501) Sometimes on Windows TestFrameEvaluation fails because the stacktrace doesn't look deep enough. commit 95674dd463ee8df0584b70af646d8843edb56b18 Author: Suzy Mueller Date: Thu May 20 13:00:51 2021 -0400 service/dap: set function breakpoints while running (#2499) commit b72bce30cce71cf3ba81bbd96ed87b54d9ccb3d2 Author: Suzy Mueller Date: Wed May 19 14:17:36 2021 -0400 service/dap: support evaluate for hover context (#2496) We can support evaluate for hover context in order to provide more useful hover info for our users. Updates go-delve/delve#2491 Updates golang/vscode-go#1510 commit 83fe779193c78239c3be2c29101f9feb84e226f8 Author: Alessandro Arzilli Date: Wed May 19 19:42:10 2021 +0200 proc: fix runtimeTypeToDIE setup (#2486) The code populating runtimeTypeToDIE was incorrectly adding StaticBase to the offset. We never noticed because on statically compiled executables StaticBase is always zero and on PIE and plugins the fallback code took care of the problem anyway. A change in Go 1.17 broke the fallback code, making the issue apparent. This commit fixes the setup of runtimeTypeToDIE and disables the fallback code for Go 1.17 and later. This change also fixes a rare failure in TestPluginVariables when PIE is enabled. commit 669fc2d8d3ea6de43778d7978bac94b0c1da4fe9 Author: Hyang-Ah Hana Kim Date: Wed May 19 13:29:05 2021 -0400 dap: add sameuser check (#2494) On linux, delve RPC server allows only connections from the same user if --only-same-user is set (true, by default). Do the same for DAP server. Moved the sameuser check logic to service/internal/sameuser. Considered importing service/rpccommon from the dap server, but when we eventually migrate to multiplex rpc and dap from one port, I am afraid that can cause cyclic imports. commit 5dd4b7df9da1770edb4c2fd86535b58b1df294e7 Author: Derek Parker Date: Tue May 18 11:09:36 2021 -0700 all: v1.6.1 commit 745a5131795d51d050301b7aae6b10f6820e896f Author: Suzy Mueller Date: Tue May 18 13:25:16 2021 -0400 service/dap: implement function breakpoints (#2450) * service/dap: implement setFunctionBreakpoints request * Fix the errors that would not allow func set * use find locations instead of FindFunctionLocation * add function breakpoint tests * return after sending error response * revert changes to debugger * exclude regexp function names * remove switch statement with one case * remove ReadFile ambiguous test * Remove TODO for multiple locs * remove unnecessary setting of bp.Verified on error * tighten condition for breakpoint name to match function breakpoint * add tests for different loc types, add FindLocationSpec * add test using base name of file * make functionBreakpoint name a constant * update stop reason to function breakpoint * remove comment about optimizing onSetFunctionBreakpoints * respond to review * add comments to test * change functionBpPrefix to const * handle relative paths * fix capabilites check * update function breakpoint tests to check for failure * use negative line number to determine which are errors commit 4e582fa553dba4409b6acfd2d60a867752a9b57c Author: Suzy Mueller Date: Mon May 17 23:34:27 2021 -0400 service/dap: send 'continued' event on next/step/stepout requests (#2480) * service/dap: send 'continued' event on next/step/stepout requests Next/step/stepout requests assume that execution is only resumed on the thread that was specified. We cannot resume execution on only a single thread, so we need to send a continued event to let the client know that all threads have resumed. * update set breakpoints test with continued event commit c10b222bad3970ecff635cd33a82c33c13593f39 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon May 17 10:37:15 2021 -0700 service/dap: support pause request (#2466) * service/dap: support pause request * service/dap: validate the client configurations in initialize request (#2435) The client can specify certain configurations in the initialize request. For example, pathFormat determines the pathFormat. We do not currently support configuring pathFormat, linesStartAt1, or columnsStartAt1, so we report an error if the client attempts to set these to an unsupported value. * TeamCity: fix Windows builds (#2467) Bintray is shutting down and the URL we used to install mingw is no longer available. Use chocolatey instead. * proc/native: low level support for watchpoints in linux/amd64 (#2301) Adds the low-level support for watchpoints (aka data breakpoints) to the native linux/amd64 backend. Does not add user interface or functioning support for watchpoints on stack variables. Updates #279 * simplify pause test Co-authored-by: Polina Sokolova Co-authored-by: Suzy Mueller Co-authored-by: Alessandro Arzilli commit 32946b2d7c9953fd424b615be9350011e84c116a Author: Alessandro Arzilli Date: Mon May 17 19:31:05 2021 +0200 proc: correctly truncate the result of binary ops on integers (#2463) Truncates the result of binary operations on integers to the size of the resulting type. Also rewrites convertInt to not require allocations. Fixes #2454 commit db291698e0b98edd195e841e759e62e0d92a3061 Author: Alessandro Arzilli Date: Mon May 17 19:27:33 2021 +0200 gdbserial: for the 'g' command on debugserver treat E74 as unsupported (#2487) The maintainer of debugserver says he wants to fix the problem with the 'g' command but doesn't know when it will happen. Treat the error 'E74' for the 'g' command on debugserver as if the server had returned an unsupported error so that, for this specific problem, the error doesn't resurface in the future. commit 54f8703186ac56d970393525f6b4af559bbcee65 Author: Alessandro Arzilli Date: Mon May 17 19:26:49 2021 +0200 dwarf/op,proc: fix handling of DW_OP_piece (#2485) According to DWARFv4 section 2.6.1.3 having a DW_OP_piece when nothing is on the stack is legal and represents uninitialized/unavailable memory. commit 547388750bdfbadcc80cbafa15ba4b8254f2e683 Author: John-Michael Faircloth Date: Mon May 17 12:14:09 2021 -0500 service/dap: Fix build error due to unresolved merge conflict (#2493) My local build of delve which apparently pulls in the master branch starting breaking. This is the culprit. Error: ``` ``` commit d2bca7a30775188878770361f6d34574ca2a7560 Author: Alessandro Arzilli Date: Mon May 17 18:56:42 2021 +0200 pkg/proc/native/linux: fix target crashes induced by RequestManualStop (#2484) A RequestManualStop received while the target program is stopped can induce a crash when the target is restarted. This is caused by the phantom breakpoint detection that was introduced in PR #2179 / commit e69d536. Instead of always interpreting an unexplained SIGTRAP as a phantom breakpoint memorize all possible unreported breakpoint hits and only act on it when the thread hasn't moved from one. Also clarifies the behavior of the halt command when it is received while the target is stopped or in the process of stopping. commit bd2a4fe56e9a584a2ac14a43a294d5db1ee5abc3 Author: Alessandro Arzilli Date: Mon May 17 18:48:48 2021 +0200 proc/native/linux: better handling of process death due to signals (#2477) Handle the signaled status for the thread leader like we handle the exited status, by returning ErrProcessExited and recording the killer signal in it. Prior to this commit we would find out about the death of the thread later in the loop, the condition would still be reported as ErrProcessExited, but without recording the signal number anywhere. Also fixes a bug in TestAttachStopOnEntry where the test would inadvertently cause a SIGPIPE to be sent to the target process, making it terminate early. commit 30cdedae6910f5e9af6739845bacfd5b8778e745 Author: Suzy Mueller Date: Mon May 17 12:25:41 2021 -0400 service/dap: implement exception info (#2444) * service/dap: implement exception info * remove adding additional thread * Fix tests * add exceptionInfo tests * update comments * map paths to client paths * remove launch.json * remove change to ConvertEvalScope * correct name of supportsExceptionInfoRequest * Add TODO for deleting output event * Print Stack header to buffer * Try to move resolving exception info to onExceptionInfoRequest * save the error and return if it is the current thread * rename thread to g * findgoroutine returns goroutine * clean up findgoroutine * log errors * remove output event * fix grammar commit 1e9c5c3b07dc5f0f2b3b1fb17bde6444cbf7ca30 Author: Suzy Mueller Date: Mon May 17 12:21:15 2021 -0400 service/dap: warn users of debugging optimized functions (#2475) * service/dap: warn users of debugging optimized functions * Add test for optimized scopes * service/dap: warn users of debugging optimized functions * rename functionscope * update warning message commit 11cf6e689f2bf36192c02c04ab9e8852143b722c Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon May 17 09:17:00 2021 -0700 service/dap: support setting breakpoints while running (#2472) * service/dap: support setting breakpoints while running * Review comments, faster test * Fix comments * Address review comments * Do not continue automatically * Add TODO to resume exeuction * Handle async test messages in either order Co-authored-by: Polina Sokolova commit 32021981a7069fa9a26b584549558405d42d401a Author: Suzy Mueller Date: Mon May 17 12:13:25 2021 -0400 service/dap: move build error to output event (#2482) commit 252bcc4ebc631fba820bfb4368f85c471c30ece6 Author: Suzy Mueller Date: Mon May 17 03:07:55 2021 -0400 service/dap: fix continueOnEntryTest (#2489) Accept the empty response in case the threads request arrived after the program terminated commit 5fa4a3527c4fbc13657f630cc082f792fa3e54d1 Author: Suzy Mueller Date: Sat May 15 01:34:59 2021 -0400 service/dap: fix flaky TestPreSetBreakpoint test (#2483) commit 66782f9b27318b39130032f840cd684832ee05f8 Author: Hyang-Ah Hana Kim Date: Wed May 12 22:58:38 2021 -0400 daptest/gen: use %#v instead of %q (#2478) Messages don't look good with %q. commit 8057f5c96b2ca6b550fbe0139298091e6c7e41bf Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon May 10 11:36:03 2021 -0700 proc: fix typo 'unkown' => 'unknown' (#2473) Co-authored-by: Polina Sokolova commit 1b8428eb6ce7217bcb9c3b03a64c0263459ea493 Author: Suzy Mueller Date: Mon May 10 14:34:42 2021 -0400 service/dap: add type information to dap variables (#2465) * service/dap: add type information to dap variables * add comment explaining map type choice * rename to setClientCapabilities * respond to review * update TypeString definition commit 58762685e317b33a7cf415ab6c21415deabf07f4 Author: Alessandro Arzilli Date: Thu May 6 19:33:56 2021 +0200 proc/native: low level support for watchpoints in linux/amd64 (#2301) Adds the low-level support for watchpoints (aka data breakpoints) to the native linux/amd64 backend. Does not add user interface or functioning support for watchpoints on stack variables. Updates #279 commit 1962c3a627797da672d89c5acdffe9144475b8ea Author: Alessandro Arzilli Date: Thu May 6 19:05:17 2021 +0200 TeamCity: fix Windows builds (#2467) Bintray is shutting down and the URL we used to install mingw is no longer available. Use chocolatey instead. commit 4b4f7a589ad395c867e47ad20a6529728512d681 Author: Hyang-Ah Hana Kim Date: Thu May 6 05:11:45 2021 -0400 daptest/gen: autogenerate some assertion functions (#2441) daptest has type assertion functions that panic if the read response/event message is not the expected type. This is not only against the recommended style guideline (Don't Panic, Useful Test Failures, ...), but also it prevents from quickly diagnosing test failures occurred in remote CIs. This PR changes the type assertion to the two return value type assertion, and t.Fatal with details if the type is not expected. service/dap/daptest/main.go is a program that auto generates those assertion functions in resp.go. Run `go generate` from the service/dap directory to update resp.go. commit 49555a9e8a0ddda842ab1ad5aa9cc8842bc3a6cc Author: Suzy Mueller Date: Thu May 6 03:56:29 2021 -0400 service/dap: validate the client configurations in initialize request (#2435) The client can specify certain configurations in the initialize request. For example, pathFormat determines the pathFormat. We do not currently support configuring pathFormat, linesStartAt1, or columnsStartAt1, so we report an error if the client attempts to set these to an unsupported value. commit c5d58f494a266d9f95bf597bce894bd8d9204a65 Author: Alessandro Arzilli Date: Tue May 4 21:56:17 2021 +0200 proc: add way to use CPU registers in expressions (#2446) Changes the expression evaluation code so that register names, when not shadowed by local or global variables, will evaluate to the current value of the corresponding CPU register. This allows a greater flexibility with displaying CPU registers than is possible with using the ListRegisters API call. Also it allows debuggers users to view register values even if the frontend they are using does not implement a register view. commit 32f646e3e8f780a58da14a988aa5063ad768d5d4 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue May 4 12:53:42 2021 -0700 service/dap: auto-loading for fully missing children of nested vars (#2455) * service/dap: auto-loading for fully missing pointers, structs, maps, slices and arrays * Add call test * Add TODO Co-authored-by: Polina Sokolova commit 03f1ec1dfcb623fc2b78ef9b44935545bd566c38 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue May 4 12:49:52 2021 -0700 service/dap: support running requests asynchronously (#2423) * service/dap: refine teardown logic * Address review comments + add missing lock/unlock * Narrow lock scope * Update comments only * Remove redundan temp var from stopNoDebugProcess * Clarify comment * service/dap: support running requests asynchronously * Respond to review comments * Remove debugging printf * Refine locking. Add call TODO. Use -1 for running thread id. * Fix TestAttachStopOnEntry: it can terminate on halt * Respond to review comments * Recover panics in async requests handling * defer releasing asyncSetupDone, so it happens on panic Co-authored-by: Polina Sokolova commit 0da1c9a9d732ccf1b79c4a127b24bdb8901c3821 Author: Alessandro Arzilli Date: Tue May 4 21:37:09 2021 +0200 Documentation: document passing arguments to the test program (#2459) Add documentation on how to pass arguments to the program generated by `dlv test`. Fixes #2458 commit c6e52ecf5cff2caca242c0a1860eed68f3d6dec6 Author: Alessandro Arzilli Date: Tue May 4 21:36:22 2021 +0200 dwarf: make debug_line header parser more resilient (#2456) Check for errors, log them and return early, do not try to allocate large chunks of memory that we can never possibly read from the file. Fixes #2449 commit 6a25ee09f56b3495caed91fd7f42dcda19f6d401 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue May 4 12:33:50 2021 -0700 go.mod: update google/go-dap to 0.5.0 (#2460) * go.mod: update google/go-dap to 0.5.0 * Go mod tidy Co-authored-by: Polina Sokolova commit 4bd16ad7565e89be1ee22b2f7a8f6f8577a3552a Author: Christian Banse Date: Tue May 4 21:33:10 2021 +0200 Slightly better version check for gdb server on newer macOS (arm64) (#2461) * proc: Slightly better version check for gdb server on newer macOS * Adjusted version to be >= 1200 and <= 1205 commit 9ed4ba0c49d916bf128ecf69fcc109235aeed075 Author: Hyang-Ah Hana Kim Date: Tue May 4 02:39:01 2021 -0400 Documentation: correct the flag name used to configure log destination (#2464) The documentation mentions flags that do not exist. Replace them with the existing, --log-dest flag. commit ef337d3022d3b0f4abda75fda9fe6073194ec2f7 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Apr 29 02:15:32 2021 -0700 service/dap: log stacktrace when panic is recovered (#2457) commit 35d4f05c4eca61dcb714108d23bc9e9b5264d43e Author: Alessandro Arzilli Date: Wed Apr 28 19:00:26 2021 +0200 proc: remove duplicate Registers.Get implementations (#2415) Moves the implementation of Registers.Get out of the backends and into proc where it can be implemented only once per architecture. commit 7bf5482b328673e0b7dc3ebe7c6afe92c602aee2 Author: Felix Geisendörfer Date: Mon Apr 26 19:36:24 2021 +0200 examinememory: evaluate addr as expression (#2385) * examinememory: evaluate addr as expression This makes it easy to read memory locations at an offset of a known address, e.g.: x 0xc000046800 + 32 * use feedback from @aarzilli - expression mode is now enabled via -x flag - support "-x var", "-x &var" in addition to "-x " - some refactoring * add test cases * deal with double spaces * update docs * add new failing test * fix docs * simplify implementation, update test & docs * Fix docs commit bbae9a9d127337215acff8adb7f261f96c1d4da7 Author: Suzy Mueller Date: Mon Apr 26 13:31:59 2021 -0400 service/dap: add go build stderr to error response (#2448) * service/dap: add go build stderr to error response * service/dap: add go build stderr to error response * Skip message check for build errors * test for flag provided message commit ee5729e107e6acc3a6fc0847ecac9b2c1a14e369 Author: Suzy Mueller Date: Fri Apr 23 09:17:38 2021 -0400 service/dap: log working directory of launch program (#2447) commit 6a85f349664a6765aef2d14d470b5f196ebebea1 Author: Alessandro Arzilli Date: Wed Apr 21 22:39:19 2021 +0200 debugger: report error when switching goroutine is impossible (#2424) Due to variable shadowing the SwitchGoroutine command never failed. commit ea9541b860b9448fa4acea0d7dd89351ae41bc47 Author: Alessandro Arzilli Date: Wed Apr 21 22:37:53 2021 +0200 proc: disable part of TestAttachDetach test on macOS (#2429) There seems to be a problem where debugserver will leave a zombie process instead of detaching correctly, we are sending the right commands, it doesn't seem to be a problem with Delve. commit e141c47eb8b96cc80db83def2182e39341e8b737 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Apr 21 13:28:15 2021 -0700 service/dap: refine teardown logic (#2414) * service/dap: refine teardown logic * Address review comments + add missing lock/unlock * Narrow lock scope * Update comments only * Remove redundan temp var from stopNoDebugProcess * Clarify comment * Set debugger to nil after detach to prevent dup teardown in Stop() Co-authored-by: Polina Sokolova commit af1796d171967f37e05ac4df62b994b777ab68c1 Author: Suzy Mueller Date: Tue Apr 20 03:40:34 2021 -0400 service/dap: rename launch configuration 'wd' to 'cwd' (#2433) Rename the launch configuration for specifying the working directory. commit 2408ed87bf8773032c2ccb94f8b9d5aa6d629272 Author: Suzy Mueller Date: Mon Apr 19 14:14:50 2021 -0400 service/dap: annotate shadowed variable names in variables request (#2428) * service/dap: annotate shadowed variable names in variables request In order to distinguish variables that are shadowed, this change updates the names from 'name' to '(name)'. This is the same syntax used in the terminal package. * remove unnecessary comment * Add todo for evaluate name * Check the evaluateName result is the unshadowed var commit e3d438876e4211625a6982b33b1843ef31443cf2 Author: Alessandro Arzilli Date: Mon Apr 19 20:12:51 2021 +0200 service/rpccommon: fix shutdown related bugs (#2439) * service/rpcommon: resolve race between Detach and shutdown Detach will close DisconnectChan causing the server to initiate shutdown, there is a race between Detach writing its response to the client and the shutdown terminating the server process. If Detach loses the race the response to the Detach request is never sent to the client and the client will report an EOF error instead. This change delays the start of the shutdown process until after Detach has written its response. Fixes an occasional failure of TestContinue. * service/rpccommon: ignore listener error when shutting down Ignore the closed listener error when the server is being shut down in response to a SIGINT signal. Fixes #1633 commit 7d343b6b7b9dc3ad6b8d4d4f85d66ce86fda3ff5 Author: Koichi Shiraishi Date: Sat Apr 17 19:33:33 2021 +0900 _scripts: support macOS Big Sur (#2437) commit 4eb54b01e7afbacb4ef781035d605c3f977f5ea4 Author: Suzy Mueller Date: Thu Apr 15 19:35:37 2021 -0400 service/dap: add substitutePath configuration (#2379) * service/dap: add substitutePath configuration Similar to substitute-path configuration in the dlv cli, substitutePath in dap allows users to specify path mappings that are applied to the source files in stacktrace and breakpoint requests. Updates #2203 * service/dap: refactor the startup of the fixture for attach Add a helper function for starting up a process to attach to. * service/dap: update substitute path tests for windows * service/dap: remove lines that should have been removed in merge * respond to comments on pr * move logging to helper functions * make test comments more clear * Add comments about absolute paths * fix log messages * clarify test comments * remove comment about absolute paths commit 747f037883156ad3cf52759ae912ca4edd3a7c2d Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Apr 14 00:22:40 2021 -0700 service/dap: fix temp binary deletion race (#2413) Co-authored-by: Polina Sokolova commit 3c69f7435ee6dccc495d3e0ade0d91bd176a5c80 Author: Alessandro Arzilli Date: Tue Apr 13 08:52:29 2021 +0200 *: Never use pointer to proc.ErrProcessExited (#2431) We have some places where we use proc.ErrProcessExited and some places that use &proc.ErrProcessExited, resulting in checks for process exited errors occasionally failing on some architectures. Uniform use of ErrProcessExited to the non-pointer version. Fixes intermittent failure of TestStepOutPreservesGoroutine. commit fe616c27ff86e1d23881a480e806f13c5e452570 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Apr 12 15:00:26 2021 -0700 service/dap: fallback to CurrentThread if SelectedGouroutine is not available (#2422) Co-authored-by: Polina Sokolova commit 781ad72d624ffb6550dce3577813f759844da32b Author: Alessandro Arzilli Date: Mon Apr 12 23:59:43 2021 +0200 service: fix breakpoint IDs after Restart with disabled breakpoints (#2425) When restarting we must take care of setting breakpoint IDs correctly so that enabled breakpoints do not end up having the same ID as a disabled breakpoint, also we must make sure that breakpoints created after restart will not get an ID already used by a disabled breakpoint. commit f3d7b25fdfd4c87b3a4e73df0404b8e12c8404d1 Author: Alessandro Arzilli Date: Mon Apr 12 23:57:39 2021 +0200 *: remove unused code, variables and constants (#2426) commit 623667b0f4a985fb6b9612ebf0dde71f7d7002b0 Author: Alessandro Arzilli Date: Mon Apr 12 23:56:12 2021 +0200 *: Skipped tests review (#2430) Delete tests for old versions of Go that are no longer run, remove skip from tests that seemingly work. commit 1ffe2413c277d4181103517b5dbca23b9b5453f7 Author: Ernie Hershey Date: Mon Apr 12 17:54:13 2021 -0400 Typo and comma for readability (#2434) commit aa426a2e50553081b0c4279b3399bf28e6db52fd Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Apr 12 14:50:15 2021 -0700 service/dap: delay disconnect response and log teardown progress (#2427) Co-authored-by: Polina Sokolova commit 8b206092276a50aaa7edd682fa22d95ca9ba8070 Author: Hyang-Ah Hana Kim Date: Fri Apr 9 04:03:59 2021 -0400 dap: suppress error popup for failed evaluation request in repl mode (#2420) It's expected that users enter invalid expressions through DEBUG CONSOLE. Pop up for every error is not pleasant. commit 79e6f7fa9086d101c7a0ba9436dc979c87007efe Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Apr 8 02:09:41 2021 -0700 service/dap: minor test refactoring (#2421) commit c4b9c85843095b96f7d37ef38f6f7db9234625f0 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Apr 7 01:00:14 2021 -0700 service/dap: handle terminated events in TestStepOutPreservesGoroutine (#2417) Co-authored-by: Polina Sokolova commit 618f366998a64cabd2fddacc05587d07f171fdf8 Author: Alessandro Arzilli Date: Mon Apr 5 20:50:59 2021 +0200 proc: be more lenient when parsing debug_info (#2394) - allow a concrete subprogram to be treated as the abstract origin for an inlined call - allow nameless concrete and abstract subprograms Fixes #2393 commit da27e3421704a1ed02189f8197b2bfcebb9091b6 Author: Hyang-Ah Hana Kim Date: Mon Apr 5 14:44:02 2021 -0400 dap: change how noDebug launch request is served (#2407) * dap: change how noDebug launch request is served PR #2400 added support for noDebug launch requests - that was done by directly starting the target program using os/exec.Cmd and blocking the launch request indefinitely until the program terminates or is stopped with a disconnect request (when dlv dap can support it). Even though the approach seemed to work for user, that adds an extra control flow and complexity to the codebase. This change takes a different approach to implement the noDebug launch feature. Instead of using os/exec.Cmd, this uses the existing debug launch path, but avoids setting breakpoints. Finally, the program will start upon receiving onConfigurationDoneRequest and blocks there until the program terminates. This simplifies the code. The DAP spec does not explicitly specify what to do about other requests. It seems like VSCode can issue evaluate requests or other requests after the configuration done request. Currently they are blocked because the program is in running state. We can consider checking s.noDebug and responding with an error in the future if we want/need to. See the log below for a typical DAP request/response sequence: 2021-03-29T01:42:53-04:00 debug layer=dap building binary at /Users/hakim/projects/s/__debug_bin 2021-03-29T01:42:55-04:00 info layer=debugger launching process with args: [/Users/hakim/projects/s/__debug_bin] 2021-03-29T01:42:55-04:00 debug layer=dap [-> to client]{"seq":0,"type":"event","event":"initialized"} 2021-03-29T01:42:55-04:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":2,"success":true,"command":"launch"} 2021-03-29T01:42:55-04:00 debug layer=dap [<- from client]{"seq":3,"type":"request","command":"setBreakpoints","arguments":{"source":{"name":"main.go","path":"/Users/hakim/projects/s/main.go"},"breakpoints":[{"line":9}],"lines":[9]}} 2021-03-29T01:42:55-04:00 error layer=dap Unable to set or clear breakpoints: running in noDebug mode 2021-03-29T01:42:55-04:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":3,"success":false,"command":"setBreakpoints","message":"Unable to set or clear breakpoints","body":{"error":{"id":2002,"format":"Unable to set or clear breakpoints: running in noDebug mode"}}} 2021-03-29T01:42:55-04:00 debug layer=dap [<- from client]{"seq":4,"type":"request","command":"configurationDone","arguments":{}} 2021-03-29T01:42:55-04:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":4,"success":true,"command":"configurationDone"} 2021-03-29T01:42:55-04:00 debug layer=debugger continuing Hello 2021-03-29T01:43:00-04:00 debug layer=dap [-> to client]{"seq":0,"type":"event","event":"terminated","body":{}} 2021-03-29T01:43:00-04:00 debug layer=dap [<- from client]{"seq":5,"type":"request","command":"threads"} 2021-03-29T01:43:00-04:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":5,"success":true,"command":"threads","body":{"threads":null}} 2021-03-29T01:43:00-04:00 debug layer=dap [<- from client]{"seq":6,"type":"request","command":"disconnect","arguments":{}} 2021-03-29T01:43:00-04:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":6,"success":true,"command":"disconnect"} 2021-03-29T01:43:00-04:00 debug layer=debugger halting 2021-03-29T01:43:00-04:00 error layer=dap Process 27219 has exited with status 0 2021-03-29T01:43:00-04:00 debug layer=debugger detaching Updates https://github.com/golang/vscode-go/issues/1111 * service/dap: address polina's comments for noDebug logic Reworked so the noDebug launch request again blocks launch request handler after responding with the launch response. By skipping the initialized event, it should prevent well-behaving clients from sending any further requests. Currently, doesn't matter because the handler goroutine will be blocked until the program termination anyway. Placed mutex back, since I noticed that's the only way to prevent racing between Stop and the handler goroutine. The synchronization lotic (in particular, during teardown) should be revisited after asynchronous request support work is done. * dap: address more comments commit 7ace7a8e7616354af64172f9101d672acd0d5cfc Author: Alessandro Arzilli Date: Mon Apr 5 20:23:32 2021 +0200 proc/gdbserial: remove unnecessary conditional compilation (#2389) Remove unnecessary conditionally compiled files introduced with the darwin/arm64 port. commit c223ef656da3ddbab3a58ea87108d4217731a01c Author: Alessandro Arzilli Date: Fri Apr 2 18:34:44 2021 +0200 Documentation: mention developer group in macOS install instructions (#2409) Some users seem to need to do this in order to use a debugger. commit 370ec4e6e401291f06738f3feaa5229534157293 Author: Suzy Mueller Date: Fri Apr 2 12:19:16 2021 -0400 service/dap: switch goroutines when stepping (#2403) * service/dap: switch goroutine before stepping The correct goroutine needs to be selected when stepping in order for the step to execute to the correct location. * handle next in progress while stepping * Add tests for steps when switching goroutine * remove nextInProgress handling * add new step out test and review debug state check * update text of stopped event and set goroutine id commit 743f243841186e1dd964bb7cf09b6185a8228858 Author: Hyang-Ah Hana Kim Date: Fri Apr 2 12:17:43 2021 -0400 service/dap: change dap error response logging to debug level (#2412) Error level logging shows up in the users' consoles/terminals so be more conservative when logging. Move the followings to Debug logging. - DAP error reponses caused by invalid requests. They are application level errors and DAP clients should handle them. - Errors reported when debugee already exited. Fixes golang/vscode-go#1392 commit b120b11cc383554064e3e2da36d29e4c5299a988 Author: Alessandro Arzilli Date: Thu Mar 25 17:45:30 2021 +0100 terminal: add optional format argument to print, display (#2398) Changes print so a format argument can be specified by using '%' as prefix. For example: print %x d will print variable 'd' in hexadecimal. The interpretarion of the format argument is the same as that of fmt's package. Fixes #1038 Fixes #1800 Fixes #2159 commit 2414dcdd3092c871190fe306feb24ae27243820e Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Mar 25 09:44:32 2021 -0700 service/dap: truncate long compound map keys and use unique address suffix for uniqueness (#2399) * Truncate long compound map keys and use address suffix only for those * Remove test typo that causes failures Co-authored-by: Polina Sokolova commit c44252b6fefc665da0fb8042a0a97590bd8feff8 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Mar 24 11:02:22 2021 -0700 service/dap: clarify treatment of relative output path (#2402) * Add logging and comments to clarify relative output path treatement * Use absolute output path in one of the unittests Co-authored-by: Polina Sokolova commit 3c1b94276a31d7992465637223d5f92941941b2b Author: Hyang-Ah Hana Kim Date: Tue Mar 23 15:10:21 2021 -0400 service/dap: supports noDebug launch requests (#2400) If the launch requests has noDebug attribute set, run the built binary directly. The launch request handler will block until the binary terminates, so the editor won't send additional requests like breakpoint setting etc. Still disconnect or restart requests can flow in though and they should trigger killing of the target process if it's still running. In order to run the binary using os/exec on windows, the target binary has to have .exe as its extension. So, add .exe to the default output name if it is on windows. I am not sure though yet we want to modify the user-specified output or not yet. Considering how go commands behave (not automatically append .exe for 'go build -o') I think respecting what user specified is right, but the failure (file not exist) may be mysterious. commit 1c9a10529ef615f228989fddc0f97d1009cadabb Author: Suzy Mueller Date: Mon Mar 22 23:06:09 2021 -0400 service/dap: use specified working directory for launch requests (#2360) * service/dap: use specified working directory for launch requests If a user specifies a working directory in the launch request, then the process should use that working directory. This may affect how the program runs and the user should be able to have control over this. * service/dap: add tests for launch with working dir Added tests to make sure the working directory is set correctly. * service/dap: fix TestWorkingDir on windows * service/dap: use %q to print quoted string * cmd/dlv: update dap warning about working dir * service/dap: change the launch argument to be wd` * update warning to specify only launch request commit f5d2e132bca763d222680815ace98601c2396517 Author: Álex Sáez Date: Fri Mar 19 19:02:23 2021 +0100 *: Adds toggle command (#2208) * Adds toggle command Also adds two rpc2 tests for testing the new functionality * Removes Debuggers' ToggleBreakpoint method rpc2's ToggleBreakpoint now calls AmendBreakpoint Refactors the ClearBreakpoint to avoid a lock. commit 333e84a0cb209a9ec762b753cbd4ecbc679104d4 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Mar 15 09:36:46 2021 -0700 service/dap: use (*api.Variable).SinglelinesString() for dap.Variable values (#2383) * Use (*api.Variable).SinglelinesString() for dap.Variable values * Make DeepSource happy * Adjust unreadable regex in tests * Use regex for runtime.mutex variable test Co-authored-by: Polina Sokolova commit 5e7169e65015f2b85efd66506e6e5b931074e435 Author: Andrei Matei Date: Mon Mar 15 12:36:11 2021 -0400 godwarf: assert children are not ignored (#2388) The godwarf package provides two ways to turn a dwarf.Entry into a godwarf.Tree: LoadTree and EntryToTree. The former doesn't handle children - it doesn't advance a Reader past them (in fact, it doesn't even know about a Reader). EntryToTree is only used for variables and formal param DIEs, which don't have children, and it would very likely be incorrect to use it for DIEs with children. This patch makes the function panic if the entry can have children. commit 658d5ece2b7c85e98e6f4cc92135745f61592f1b Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Mar 15 09:34:26 2021 -0700 Skip 'access denied' failures in tests (#2386) Co-authored-by: Polina Sokolova commit 363086b7eda5c87c41f01d2e636395976c184852 Author: Alessandro Arzilli Date: Mon Mar 15 17:33:13 2021 +0100 terminal: fix TestContinueUntil on linux/386 (#2387) commit 14951e0e4c7e15221881077498437d5fca732198 Author: Andrei Matei Date: Mon Mar 15 10:54:13 2021 -0400 service: fix link to eval expression documentation (#2390) The wiki was removed a long time ago. commit 6c6331c1509a67770631496ac25d6bd4a7d40fbf Author: Bryan Heden Date: Fri Mar 12 10:49:15 2021 -0600 Documentation: fix spelling error (#2337) * fix spelling error * Revert "fix spelling error" This reverts commit 08058c9efbcee5d86ef429be5bd66f8307fb02d8. * update doc source and doc/fix spelling error commit d1834df3c55d42a1bcba94ac14d43868a60210fc Author: Ilia Choly Date: Thu Mar 11 16:27:29 2021 -0500 terminal: Add [linespec] argument to 'continue' command (#2376) This change allows specifying an optional linespec after the 'continue' command which sets a temporary breakpoint. Fixes #2373 commit 375f4429497596f0b0254049414c67bb54a9aa43 Author: Ilia Choly Date: Tue Mar 9 14:06:07 2021 -0500 terminal/command: Check for missing argument to 'dump' command (#2377) commit a3c7ba8808f3b5d597c1b8cc77c9df9af4e46c96 Author: Alessandro Arzilli Date: Tue Mar 9 11:35:24 2021 +0100 proc: add workaround for debug_frame bug on macOS (#2374) This adds a workaround for the bug described at: https://github.com/golang/go/issues/25841 Because dsymutil running on PIE does not adjust the address of debug_frame entries (but adjusts debug_info entries) we try to do the adjustment ourselves. Updates #2346 commit b40774c6fefbf9788e3e6b51606e02d205d0de34 Author: Alessandro Arzilli Date: Mon Mar 8 19:16:41 2021 +0100 gobuild: wait longer when removing files on Windows (#2372) 1usec is very much not enough commit fe904c14d1c4984ca52b66cc8626362597094d21 Author: Alessandro Arzilli Date: Mon Mar 8 19:05:10 2021 +0100 service: serialize calls to Command API (#2370) * service: serialize calls to Command API Wait until the target process has resumed before accepting new calls to Command. Before this if a 'continue' was immediately followed by a 'halt' the 'halt' could be processed before the 'continue'. Fixes #1608 Fixes #2216 * service/rpccommon: fix DeepSource issues commit a3de99ab97316bc0d06164408f2226fd9a1cb304 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Mar 8 09:42:54 2021 -0800 service/dap: clarify default attributes behavior with tests (#2365) * service/dap: clarify default attributes behavior with tests * Minor clean-up post-merge Co-authored-by: Polina Sokolova commit 90fb0a535fbe3035095f13d580dd2358a85d0cb0 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Mar 8 09:41:47 2021 -0800 service/dap: support auto-loading of unloaded interfaces (#2362) * service/dap: support auto-loading of unloaded interfaces * Make DeepSource happy * Don't set reference if data failed to auto-load * Use frame-less expressions * Refine interface recursion capping test case Co-authored-by: Polina Sokolova commit f0ed4a71e1c93a6f22b9067b85db3e2fce90c36f Author: Alessandro Arzilli Date: Mon Mar 8 18:35:56 2021 +0100 Continuous Integration cleanup (#2369) - remove github workflow for testing macOS/amd64 that is now covered by TeamCity - fix DeepSource glob patterns to actually match what they are intended to match (did the interpretation change?) - disable some cgo tests on darwin/arm64 commit 4364c728f0697ea63da7ddf90d8bb6a99c414dc8 Author: Luis Gabriel Gomez Date: Fri Mar 5 06:07:23 2021 -0300 dap: reduce branching on onLaunchRequest mode validations (#2364) commit 314ae669a371873bc1615081d35e3f70836a7f3b Author: Alessandro Arzilli Date: Fri Mar 5 05:17:00 2021 +0100 dwarf/frame,proc: use eh_frame section (#2344) The eh_frame section is similar to debug_frame but uses a slightly different format. Gcc and clang by default only emit eh_frame. commit 6a70d531bbacb1833213edd912ea123be0b1a4f2 Author: Alessandro Arzilli Date: Thu Mar 4 19:28:28 2021 +0100 proc/*: implement proc.(*compositeMemory).WriteMemory (#2271) Delve represents registerized variables (fully or partially) using compositeMemory, implementing proc.(*compositeMemory).WriteMemory is necessary to make SetVariable and function calls work when Go will switch to using the register calling convention in 1.17. This commit also makes some refactoring by moving the code that converts between register numbers and register names out of pkg/proc into a different package. commit 3088b8b579e24188057d4420ed91340432d32adf Author: nd Date: Thu Mar 4 18:38:56 2021 +0100 TeamCity: add mac/arm64 build and use DelveBot account (#2368) commit 62d52e78d4af7c6981f915fada64558be6d27628 Author: derekparker Date: Wed Mar 3 19:06:12 2021 +0000 TeamCity change in 'Delve' project: copy of 'go-delve/delve' VCS root was created commit 5534839ff7165639d73fdb33950990e3841e2a3d Author: Alessandro Arzilli Date: Mon Mar 1 17:23:05 2021 +0100 TeamCity: select latest patch version of go for mac builds (#2363) Also adds a disabled tip builder for the next-version support branch. commit 2e80b32c417494ab3fabe929e7051076a7049f7c Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Feb 24 08:19:07 2021 -0800 service/dap: avoid double removal of temp built binary (#2335) * Avoid double removal of temp binary * Add back accidentally removed empty line * Simplify regex * Use unique build output directories in test cases * Recover TestLaunchDebugRequest hidden logging and refine error check * Special case access-denied error on Windows * Remove special case for access denied on Windows * Increase remove delay on Win Co-authored-by: Polina Sokolova commit 92fb17519244390aaa3cdbe90fa0c3c64b830d2e Author: Alessandro Arzilli Date: Wed Feb 24 17:18:23 2021 +0100 TeamCity: add linux/arm64/tip and disable failing arm64 tests (#2359) * TeamCity: add linux/arm64/tip configuration So that it can be tested when we make the next-version-support-branch. * tests: disable failing cgo tests on arm64 commit 5360c628694940076554421d2fb250618377e619 Author: Dmitry Neverov Date: Wed Feb 24 10:00:33 2021 +0100 TeamCity: fix go dist link on mac commit 56afd507e4d467402f38d15d57daa813c642e6c4 Author: Dmitry Neverov Date: Wed Feb 24 09:52:05 2021 +0100 TeamCity: set execution timeout so that builds don't hang if agents are not available commit a6685247e03b6e1a8ae4703f0b7fab866db1a899 Author: Alessandro Arzilli Date: Tue Feb 23 21:38:52 2021 +0100 proc/native: correctly read g address on linux/arm64 (#2343) When cgo is used the address of the g struct is saved on the special register TPIDR_EL0. Because executing C code could overwrite the contents of R28 that normally contains the address of g we should read it from TPIDR_EL0 instead when runtime.iscgo is set. commit d196b7ddfcbf2b8c16c30b2d023733ca5fdf54c4 Author: Dmitry Neverov Date: Tue Feb 23 17:33:01 2021 +0100 Run linux/386 builds only on amd64 agents commit 129a9fe46cc4a6b65993e59bf4e8960968c0e126 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Feb 23 08:29:06 2021 -0800 service/dap: detect and report unloaded variables (#2353) * Detect and report unloaded variables * Make DeepSource happy Co-authored-by: Polina Sokolova commit 946f9d7bd48c69b41d50c7c0e7d1a62caa99b757 Author: Alessandro Arzilli Date: Tue Feb 23 17:20:34 2021 +0100 TeamCity: fix mac test script name (#2354) commit 9ff5bb49c7664f1d3bbaa3c6ee54e1af9d14fca2 Author: nd Date: Tue Feb 23 17:19:59 2021 +0100 Fix linux/arm64 docker image name (#2355) commit baa580b626de4e5c55b9ab15adb0bba602fb43b6 Author: nd Date: Tue Feb 23 11:16:23 2021 +0100 Add mac/amd64 & linux/arm64 builders (#2349) * Add mac/amd64 build * Set arch requirements for all builds * Add linux/arm64 build commit d739cb04e3fa9081b7169eaaea7c3b181e413364 Author: Alessandro Arzilli Date: Mon Feb 22 22:31:06 2021 +0100 test: increase num of frames examined by TestClientServer_FullStacktrace (#2334) When the runtime is allocating memory the stack trace needed to reach user code might be greater than 10 frames. commit 54d0d56b9e3bd7b1dcd161087234dc6c519038a9 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Feb 21 11:17:14 2021 -0800 Add binary removal delay on Windows to avoid access denied (#2351) Co-authored-by: Polina Sokolova commit 780bcac9ccbc1711b4310b9cae653e759a23c1c0 Author: Alessandro Arzilli Date: Sun Feb 21 20:04:55 2021 +0100 Documentation: update install instructions (#2352) Remove OS specific install instructions that all repeat the same thing. Since `go get ...` is being deprecated (to install executables) recommend an install procedure that works on all supported versions of go (`git clone && go install`) but also mention the new `go install` mode in 1.16. commit 540e63a55ee965f7707fe4f7f9a35f755db1ee78 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Feb 21 08:02:42 2021 -0800 Include optional breakpoint info in setBreakpoints responses to reliably populate the UI (#2347) Co-authored-by: Polina Sokolova commit 98728d8fe18a7b61eeffd3fda1b7bac22162cd23 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Feb 21 08:00:05 2021 -0800 service/dap: improve test coverage for evaluateName feature based on known vscode-go bugs (#2341) * DAP test for github.com/golang/vscode-go/issues/1056 * DAP test for github.com/golang/vscode-go/issues/884 * DAP test for github.com/golang/vscode-go/issues/851 * DAP test for github.com/golang/vscode-go/issues/1053 * DAP test for github.com/golang/vscode-go/issues/1054 * Make DeepSource happy Co-authored-by: Polina Sokolova commit 8a8e540fa6b01769c00aaacb96a231e4c50b1fd1 Author: Alessandro Arzilli Date: Sun Feb 21 16:58:56 2021 +0100 teamcity,goversion: drop Go version 1.13 from test matrix (#2345) Go 1.16 has been released. commit 3269d7a120516d7ab1a56dbb157d0bbab8517f47 Author: Mark Eibes Date: Sun Feb 21 10:30:04 2021 +0100 service/dap: Update server.go (#2350) commit 32a45afa093579260eff155744cb31a4edd1e3f1 Author: Armin Becher Date: Sun Feb 21 07:48:12 2021 +0100 Fix broken link to JSON-RPC (#2348) commit c068861f95ec570fb7ea93638c87338f25c96af3 Author: Alessandro Arzilli Date: Wed Feb 10 18:31:37 2021 +0100 locspec,proc: improve documentation (#2338) * Reformat pkg/locspec documentation so that it is formatted correctly by godoc/pkgsite * Unexport some types and variables in proc that don't need to be exported. commit 74223baf90834b8d57ac01917709edaa717e5800 Author: Chris Hines Date: Fri Feb 5 18:05:55 2021 -0500 *: Update link to Go extension for VS Code (#2336) commit 2c1a822632776fa78b8ab23ac74fa0ea2fa1d7bf Author: Alessandro Arzilli Date: Fri Jan 29 22:39:33 2021 +0100 terminal,service,proc/*: adds dump command (gcore equivalent) (#2173) * proc/core: off-by-one error reading ELF core files core.(*splicedMemory).ReadMemory checked the entry interval erroneously when dealing with contiguous entries. * terminal,service,proc/*: adds dump command (gcore equivalent) Adds the `dump` command that creates a core file from the target process. Backends will need to implement a new, optional, method `MemoryMap` that returns a list of mapped memory regions. Additionally the method `DumpProcessNotes` can be implemented to write out to the core file notes describing the target process and its threads. If DumpProcessNotes is not implemented `proc.Dump` will write a description of the process and its threads in a OS/arch-independent format (that only Delve understands). Currently only linux/amd64 implements `DumpProcessNotes`. Core files are only written in ELF, there is no minidump or macho-o writers. commit 11e4ed2bf9c5b7600bb62198ac609ca138642a03 Author: Alessandro Arzilli Date: Fri Jan 29 22:39:04 2021 +0100 proc/core: off-by-one error reading ELF core files (#2333) core.(*splicedMemory).ReadMemory checked the entry interval erroneously when dealing with contiguous entries. commit f19d5e5c135128d35bad9a61813d293f78f99aac Author: Alessandro Arzilli Date: Fri Jan 29 18:25:31 2021 +0100 proc: fix embedded field search (#2320) Both structMember and findMethod implemented a depth-first search in embedded fields but the Go specification requires a breadth-first search. They also allowed promotion of fields in the concrete type of embedded interfaces even though this is not allowed by Go. Furthermore they both lacked protection from infinite recursion when a type embeds itself and the user requests a non-existent field. Fixes #2316 commit dceffacb896d23759cc076961484fcbecf106b4b Author: Than McIntosh Date: Fri Jan 29 12:23:52 2021 -0500 pkg/proc: fix for file reference handling with DWARF 5 compilation units (#2327) Add a helper method for collecting line table file references that does the correct thing for DWARF 5 vs DWARF 4 (in the latter case you have an implicit 0 entry which is the comp dir, whereas in the former case you do not). This is to avoid out-of-bounds errors when examining the file table section of a DWARF 5 compilation unit's line table. Included is a new linux/amd-only test that includes a precompiled C object file with a DWARF-5 section that triggers the bug in question. Fixes #2319 commit 75485427957fba167a6eaca76b1ee9549d62916f Author: Alessandro Arzilli Date: Thu Jan 28 22:42:42 2021 +0100 all: bump version and release notes (#2331) Thank you to: @andreimatei, @hitzhangjie, @dlsniper, @nd, @polinasok, @oxisto, @zamai, @artspb. commit 8e91d3b0bfea3e577d8f5ddfd06184e06348ee43 Author: Alessandro Arzilli Date: Thu Jan 28 16:08:14 2021 +0100 terminal: Go syntax highlighting for listings (#2294) Fixes #1273 commit c40774d3d40a1065cdf0e5e83e7486e6719383b6 Author: Alessandro Arzilli Date: Wed Jan 27 16:27:54 2021 +0100 proc: refactor common code in WriteBreakpoint (#2300) Moves common backend code in WriteBreakpoint to proc.(*Target).SetBreakpoint. commit f5d5a681d0465bcde77fa6370dfae038517cbf87 Author: Alessandro Arzilli Date: Wed Jan 27 15:58:48 2021 +0100 proc: do not assume abstract origins precede their uses (#2293) The DWARF standard does not say that a DW_ATTR_abstract_origin can only reference entries that appear before it, this change fixes BinaryInfo to comply. See #2284 for an example of this happening. commit 3c86d68a993eb2aa2b9f51748ef80d63811df793 Author: Alessandro Arzilli Date: Wed Jan 27 15:54:50 2021 +0100 proc: remove dead code (#2321) commit fa016faa523023c91fa8c69596d0205a133f8312 Author: Alessandro Arzilli Date: Tue Jan 26 19:37:47 2021 +0100 proc: correctly format ARM64 floating point registers (#2289) Fixes #2198 Co-authored-by: du.jinze commit fc9e0be8e7aaff70e3c0d50f80eda0069d302cc9 Author: Alessandro Arzilli Date: Tue Jan 26 19:07:06 2021 +0100 tests: changes to investigate TestClientServer_FullStacktrace errors (#2236) Changs TestClientServer_FullStacktrace and Test1ClientServer_FullStacktrace to log more information, also removes code from TestFrameEvaluation that could mask the error. Updates #2231 commit 3d0a93c58fe44ed097df4e98ebe677ef25f3258e Author: Derek Parker Date: Tue Jan 26 06:49:15 2021 -0800 *: Remove linux builders from GH matrix Removes linux builders from the GitHub action matrix. These are covered via the TeamCity CI solution now. commit 8a78568f8c16a3bb09779b1a2e44e69d7d637286 Author: Alessandro Arzilli Date: Tue Jan 26 15:44:13 2021 +0100 Fix .teamcity/settings.kts (#2325) Add missing comma. commit 715224cea034f4119c574c29b6b9f2cbdcc22f4c Author: Alessandro Arzilli Date: Tue Jan 26 05:48:27 2021 +0100 Change TeamCity test matrix and drop appveyor/travis-ci configurations (#2315) * TeamCity: change test matrix and test scripts Changes test matrix to test: * 1.13 through 1.16 on linux/amd64 * 1.15, 1.16 on windows/amd64 * 1.15 on linux/386 Also includes tests on go-tip for windows/amd64 and linux/amd64 (currently disabled, but can be turned on in a PR). Changes test scripts to automatically select the latest patch version of Go. * CI: remove Travis-CI and Appveyor configuration commit 25178e265fc3c10d96ef8b3cc92998e0a95d89ed Author: aarzilli Date: Wed Jan 20 20:22:55 2021 +0000 TeamCity change in 'Delve' project: 'https://github.com/aarzilli/delve' VCS root was removed commit 3dfd18c6933f88d317774f5e58119c0129e986b3 Author: aarzilli Date: Wed Jan 20 20:17:47 2021 +0000 TeamCity change in 'Delve (matrix change test)' project: 'https://github.com/aarzilli/delve' VCS root was created commit 0593a1cebc3b96b0f43d3f0bff4c7bab996909e5 Author: Alessandro Arzilli Date: Wed Jan 20 18:40:03 2021 +0100 cmd/dlv/tests: fix TestGeneratedDoc on Windows (#2314) Change TestGeneratedDoc to ignore differences in line terminators. commit 27f66762d0f949f16f8901f5af6c35ce751e2e91 Author: nd Date: Wed Jan 20 14:49:11 2021 +0100 Fix compilation error in TC settings (#2313) commit 9c03e2b5ded1c8939e349f2313d9276b2d6a9d9c Author: nd Date: Wed Jan 20 14:02:58 2021 +0100 Fixing branch selection in TeamCity builds (#2311) * Enable pull-requests in all builds Otherwise test builds always use the master branch * Apply change in settings made in UI commit 9030fc837b48db30411536769eb563d98100c0d6 Author: hitzhangjie Date: Wed Jan 20 15:55:16 2021 +0800 service: examinemem outputs wrong starting address (#2309) commit eb8becfb56f5297b0a26f9937ee67dd49d6902f8 Author: Artem Khvastunov Date: Tue Jan 19 21:58:54 2021 +0100 use SVG TeamCity icon (#2306) commit 6a3a08b8aac9b676f4088c61c727f81d6d9a55eb Author: derekparker Date: Tue Jan 19 19:50:38 2021 +0000 TeamCity change in 'Delve' project: build features of 'Aggregator' build configuration were updated commit fe9ce7b148f6a8ca241220c2b34e3adfa1cde7cc Author: Artem Khvastunov Date: Tue Jan 19 00:51:29 2021 +0100 change GitHub user from 'artspb' to 'derekparker' in TeamCity DSL (#2307) commit f2ec3e49a8b955425785ba065dee99cc5377b4d6 Author: Artem Khvastunov Date: Mon Jan 18 16:48:06 2021 +0100 Introduce TeamCity builds (#2298) * add -json flag when running tests on TeamCity * introduce TeamCity builds * restore gdbserial constants for 386 Otherwise compilation fails. * skip TestAttachRequest on Windows as it never finishes * run tests on 1.16beta1 commit 82fcd2cb268bd0ab2cb8d8a2f0050906f3d32b64 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jan 14 10:53:12 2021 -0800 service/dap: Add support for evaluateName for variables (#2292) * Add support for evaluateName for variables * More evaluateName logic tweaks and tests * Make DeepSource happy Co-authored-by: Polina Sokolova commit 1b2357092c8fee7406988d8191f71059700c5399 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Jan 13 04:10:15 2021 -0800 cmd: update dlv dap --help (#2299) Co-authored-by: Polina Sokolova commit a224f17374c45bc5a572ee2da587cef968adcee6 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Jan 8 09:17:54 2021 -0800 service/dap: use address, not index to differentiate compound map keys (#2291) * Use address, not index to differentiate compound map keys * Clean up calls to expectVarRegex Co-authored-by: Polina Sokolova commit 3e0ddf2bd1d6dfe744ce886d58e226669b43bbed Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Jan 6 09:07:47 2021 -0800 Fix race condition in TestAttachStopOnEntry (#2290) Co-authored-by: Polina Sokolova commit 6d1c00e56de888e1cb73b53ad2e0a26fbb5d83d0 Author: Alessandro Arzilli Date: Tue Jan 5 19:59:17 2021 +0100 terminal,service: print WaitReason, WaitSince for goroutines (#2270) Fixes #637 commit 433eafb280c116fd09e0724aef7915a0d8616921 Author: Alex Zamai Date: Tue Jan 5 20:57:30 2021 +0200 *: Expand --build-flags= description in the document (#2273) add example for multiple --build-flags add example description to --build-flags commit 6dd686ca49e6da2e3fda1e0355623fed72500504 Author: Alessandro Arzilli Date: Tue Jan 5 19:56:30 2021 +0100 Go 1.16 support branch (#2214) * proc: misc test fixes for Go 1.16 * proc: fix cgo stacktraces in Go 1.16 with simplified C -> Go call path * dwarf/line: make dwarf/line correct when '\\' are used Our code depends heavily on paths being '/' separated because go always produced '/' separated file paths. The call to filepath.Join will normalize the paths, on windows, to always be '\\' separated, which violated our assumptions. This didn't use to be a problem because the codepath that calls filepath.Join was never exercised by executable files produced by Go, but Go 1.16 started producing debug_line sections that use the directory table with https://go-review.googlesource.com/c/go/+/263017/. Fix this to always use path.Join after making sure, on windows, to always normalize paths to use '/' as a separator. Replace the use of filepath.IsAbs with an operating system independent version. * goversion: bump supported Go version commit 75f00b963c06e5d7a2840075a23a2de40b0ae7e2 Author: Alessandro Arzilli Date: Mon Jan 4 17:54:39 2021 +0100 terminal: add way to cancel goroutines command with ctrl-C (#2278) The goroutines command can take a long time to complete if there are many goroutines, add the possibility to terminate it early by pressing ctrl-C. commit 6726ec3aa3ce436b505c81277497877a88e9956c Author: nd Date: Mon Jan 4 17:53:23 2021 +0100 pkg/proc: Fix panic in goroutine parsing for binaries compiled with go1.10 (#2283) Before go1.11 waitreason field was a string, not an int. Return 0 waitreason for old go versions. Should fix #2282 commit 57f033e4bcc94b6b9fee3ea93707f4a375437d78 Author: Christian Banse Date: Mon Jan 4 17:52:04 2021 +0100 proc/gdbserial: Added support for darwin/arm64 using gdbserver (#2285) * Added support for reading darwin/arm64 using gdbserver * Trying to fix test failures * Addressing review comments commit 6328edaa1b0fcf80cfd0df68539605309fdc0ba9 Author: Alessandro Arzilli Date: Mon Jan 4 17:42:08 2021 +0100 pkg/prog/native/linux: change handling of ESRCH in trapWaitInternal (#2286) If a thread exits while we are looking at it just treat it as if the status had reported it as exited instead of doing something special. Fixes flakiness in TestIssue387. commit 796278ecba12bdef3d5ac4f8f1e4d9863755c2aa Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Dec 28 09:14:15 2020 -0800 service/dap: Support local attach (#2260) * Support local attach * Undo loopprog change * Remove test check for system-specific error message * Skip attach tests on freebasd Co-authored-by: Polina Sokolova commit 6667387e010851d378133ca101917bbf82a953b6 Author: Alessandro Arzilli Date: Mon Dec 28 18:12:33 2020 +0100 pkg/proc/native: fix nil pointer dereference in linux backend (#2279) commit 8462d5c7d4ec94c11ba193422366c39e5fd8e4ca Author: Alessandro Arzilli Date: Mon Dec 28 18:08:47 2020 +0100 native/proc/linux: wait for the target process to be killed in kill (#2280) Waits for the target process to have received the kill signal in native.nativeProcess.kill. Fixes an infrequent error in TestKill. commit 0ae77bd6c5c7bffe5ae85447c790ea7d920fb593 Author: nd Date: Mon Dec 28 18:07:50 2020 +0100 Don't call suspend on DbgUiRemoteBreakin threads (#2281) Sometimes it makes debuggee to hang. Should fix #2244 commit 7dcd7b4d1ec471bec7a3597d473ce2c3861cb5cf Author: Alessandro Arzilli Date: Mon Dec 28 00:11:02 2020 +0100 Miscellaneous fixes for problems uncovered by Github Actions tests (#2274) Fix bug in DAP test: TestEvaluateCallRequest. In Go 1.15 the call injection will be executed on a different goroutine from the goroutine where it was started on to avoid confusing the garbage collector, the test must be aware of this fact and use the goroutine ID from the stopped response instead of assuming 1 is the currently selected goroutine. Disables TestAttachDetach when running in Github Actions. Disable some coredump tests when running in Github Actions (core size limits?). commit e7558c5bc5a3b1c39c7da47d4682d46279eea01b Author: Alessandro Arzilli Date: Mon Dec 21 19:56:09 2020 +0100 proc/native: fix linux/386 native backend (#2276) Change 24ec175 (use CPUID to determine maximum size of XSAVE area) broke the linux/386 backend, this commit fixes it. commit 8221250e6502a274898db5228afaef4bf6770b74 Author: Alessandro Arzilli Date: Wed Dec 16 17:56:15 2020 +0100 split testing load between more CI services (#2251) commit d61bf018f04c211093a9b157d37d811c8c57b224 Author: Alessandro Arzilli Date: Tue Dec 15 17:13:13 2020 +0100 debugger: check that target is valid when detaching (#2263) Do not call detach if the target is no longer valid. Fixes #2259 Co-authored-by: a commit 24ec1754b2c8ed6382d05271bbe99ec9e9170610 Author: Alessandro Arzilli Date: Mon Dec 14 18:39:01 2020 +0100 proc: use CPUID to determine maximum size of XSAVE area (#2256) the maximum size of the Xsave area was previously hardcoded but the CPUID instruction can be used to determine its maximum size. commit 7ac317a7e8097413f7fb4983b7350aa8e8746324 Author: Florin Pățan Date: Mon Dec 14 19:31:45 2020 +0200 service/api: Expose WaitSince and WaitReason fields for goroutines (#2264) This adds the WaitSince and WaitReason fields for the goroutines to allow the users to easily understand why a goroutine is waiting. commit d481eabab941a7baafbcd583be72fbc9d60442ed Author: hitzhangjie Date: Tue Dec 15 01:31:11 2020 +0800 dwarf/*: add godoc comments (#2265) commit 69009f87bb1dd9abb2104ff2eb1a91847d11518b Author: Alessandro Arzilli Date: Mon Dec 14 18:13:07 2020 +0100 _scripts: remove accidentally committed file (#2268) commit 36050b1a37c98d2f57c0f471126e472ef1356af0 Author: Andrei Matei Date: Mon Dec 14 12:00:27 2020 -0500 proc: update a comment (#2266) The comment on the advanceRegs() method was referencing several nonexistent fields. This patch fixes that, and improves the comment to reference the peculiar interaction between the method and it.regs. commit fbfad81968ff62f617a6312f34318d17d5c68fe7 Author: Alessandro Arzilli Date: Thu Dec 10 18:04:35 2020 +0100 proc/gdbserial: use --unmask-signal debugserver option (#2255) Fixes #852 Co-authored-by: a commit d3e9158e9e75981cef45be9d4b2a91926bc18775 Author: Alessandro Arzilli Date: Thu Dec 10 18:03:11 2020 +0100 proc: make nested function calls work when stopped at a sw breakpoint (#2232) evalFunctionCall needs to remove the breakpoint from the current thread after starting the function call injection, otherwise Continue will think that the thread is stopped at a breakpoint and return to the user instead of continuing the call injection. commit 807664b34bab833940ddf665aa1cf70da41b8e49 Author: Alessandro Arzilli Date: Thu Dec 10 17:57:50 2020 +0100 proc: add flag to distinguish ReturnValues (#2230) Adds a flag that distinguishes the return values of an injected function call from the return values of a function call executed by the target program. commit f7542d69fe14ca3d43015a19e0094d1bddd9f90e Author: aarzilli Date: Sat Dec 5 16:12:09 2020 +0100 all: bump version and release notes Thank you to: @polinasok, @aurkenb, @pohzipohzi, @chainhelen, @hitzhangjie, @eliben, @suzmue, @andreimatei, @aaronsky. commit 60b5e9d4ba9eb6a71f78d6da05af52bbcf1aef45 Author: Andrei Matei Date: Tue Dec 8 14:46:40 2020 -0500 dwarf/reader: minor comments around variable resolving (#2253) Fix some stale comments and add some comments that I would have found useful. commit 34ffa2e763d02881dfbf4dbf7ff00068871b21e7 Author: Alessandro Arzilli Date: Fri Dec 4 18:35:57 2020 +0100 dwarf/line: do not consider end of sequence entries valid (#2235) This is needed to fix the problem we have with 1.15.4+ after the backport is applied to it. The DWARF standard isn't clear on what should happen with the end_of_sequence opcode but this is consistent with debug/dwarf.LineReader as well as gdb. commit 731f5ed3464cbd5b605f1cc34b526ff09d70f112 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Dec 4 08:58:55 2020 -0800 go.mod: update google/go-dap to 0.4.0 (#2248) Co-authored-by: Polina Sokolova commit 98cba03f7d3153f3e74032b401d928b31629af5b Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Nov 30 09:43:37 2020 -0800 service/dap: expand goroutine info in threads response (#2233) * service/dap: expand goroutine info in threads response * Fix checks * Make DeepSource happy Co-authored-by: Polina Sokolova commit d3d2910de27e69ea5473a1c8c5a53e9cf93c6801 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Nov 30 09:43:09 2020 -0800 Enable supportsDelayedStackTraceLoading capability (#2238) Co-authored-by: Polina Sokolova commit 579b17ce27357a526268b959a2138723d6e65446 Author: Aaron Sky Date: Tue Nov 17 11:49:15 2020 -0500 proc/gdbserial: Use the active xcode-select path instead of a hardcoded Xcode path (#2229) * Use the active xcode-select path instead of a hardcoded Xcode path * Refactored exec.Command to invoke Output instead of running with a custom buffer for stdout Addresses review comment by @derekparker commit db93049813b48b48ca60187aea1ab6e15b04826f Author: aarzilli Date: Mon Oct 26 13:36:52 2020 +0100 service,terminal: apply substitute path to trace/break argument Change FindLocation to apply substitute path rules to location expressions. Changes terminal to always print paths after applying substitutions. Implements #2203 commit 6ab6929b9a8b65515cf156b98e5e565e6b5c9b58 Author: aarzilli Date: Mon Nov 9 09:31:12 2020 +0100 proc/gdbserial: fix redirect bugs with debugserver 1. Forward stdin/stdout/stderr to the target process when in foreground mode instead of always forwarding the current tty (issue #1964) 2. When redirecting a file descriptor make sure to also specify something for all three otherwise debugserver will misbehave (either exit on launch or run but giving the target process a closed file descriptor). Fixes #1964 commit 4f03ef0bc4922cb619d8e1038843747422e7e0dd Author: Alessandro Arzilli Date: Mon Nov 16 19:37:21 2020 +0100 proc: fix TestStepIntoWrapperForEmbeddedPointer for Go 1.15.4 (#2223) commit fe1db25d1643e51c5ad7f888467ab15a0f9b6c71 Author: Alessandro Arzilli Date: Mon Nov 16 19:36:32 2020 +0100 Travis-CI: hold back version of Go 1.15.x (#2225) See https://github.com/golang/go/issues/42484 commit 42f56e28622ead9a393ca337e52419954f5653c0 Author: Andrei Matei Date: Mon Nov 16 11:55:59 2020 -0500 proc: add minor comments (#2228) This patch adds some comments around RequestManualStop(). commit c94db60d2728e2b11e5c8c9eb9ba59745b52f357 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Nov 12 15:24:31 2020 -0800 service/dap: support evaluate requests with expressions and calls (#2185) * Support evaluate request * Fix failing tests * Call support * Remove debugger.CurrentThread() that got accidentally reintroduced during merge * Address review comments * Function to stringify stop reason * Add resetHandlesForStop * Handle stop inside call * More tests * Address review comments * Check all threads to determine if call completed * Fix test * Fix test * Fix test * Address review comments Co-authored-by: Polina Sokolova commit 08433760186ee0bac71db940d1cae298c45bc587 Author: Alessandro Arzilli Date: Mon Nov 9 20:28:40 2020 +0100 proc/*: remove proc.Thread.Blocked, refactor memory access (#2206) On linux we can not read memory if the thread we use to do it is occupied doing certain system calls. The exact conditions when this happens have never been clear. This problem was worked around by using the Blocked method which recognized the most common circumstances where this would happen. However this is a hack: Blocked returning true doesn't mean that the problem will manifest and Blocked returning false doesn't necessarily mean the problem will not manifest. A side effect of this is issue associated goroutine. This commit fixes this problem by always reading memory using a thread we know to be good for this, specifically the one returned by ContinueOnce. In particular the changes are as follows: 1. Remove (ProcessInternal).CurrentThread and (ProcessInternal).SetCurrentThread, the "current thread" becomes a field of Target, CurrentThread becomes a (*Target) method and (*Target).SwitchThread basically just sets a field Target. 2. The backends keep track of their own internal idea of what the current thread is, to use it to read memory, this is the thread they return from ContinueOnce as trapthread 3. The current thread in the backend and the current thread in Target only ever get synchronized in two places: when the backend creates a Target object the currentThread field of Target is initialized with the backend's current thread and when (*Target).Restart gets called (when a recording is rewound the currentThread used by Target might not exist anymore). 4. We remove the MemoryReadWriter interface embedded in Thread and instead add a Memory method to Process that returns a MemoryReadWriter. The backends will return something here that will read memory using the current thread saved by the backend. 5. The Thread.Blocked method is removed One possible problem with this change is processes that have threads with different memory maps. As far as I can determine this could happen on old versions of linux but this option was removed in linux 2.5. Fixes #2151 commit e69d536e819bbbd3539d5748d61942330863cf11 Author: Alessandro Arzilli Date: Tue Nov 3 19:28:37 2020 +0100 proc/native: fix flakyness of TestStepConcurrentDirect on linux/386 (#2179) TestStepConcurrentDirect will occasionally fail (7% of the time on my setup) by either causing the target processs to execute an invalid instruction or (more infrequently) by switching to the wrong thread. Both of those are caused by receiving SIGTRAPs for threads hitting a breakpoint after it has been removed (the thread hits the breakpoint, we stop everything and remove the breakpoint and only after we receive the signal). Change native.(*nativeProcess).stop to handle SIGTRAPs that can't be attributed to a breakpoint, a hardcoded breakpoint in the program's text, or manual stops (and therefore are likely caused by phantom breakpoint hits). Co-authored-by: a commit 1f552c5a4c97df196cea28862890e2d398811602 Author: Alessandro Arzilli Date: Tue Nov 3 16:19:09 2020 +0100 pkg/proc/native: increase max size of XSTATE area to support newer CPUs (#2220) Fixes #2219 commit 42a4c806783742812a425b56bf1281571b654926 Author: Polina Sokolova Date: Tue Nov 3 01:20:09 2020 -0800 Remove redundant check in call tests commit 3fd78fc498d462e2ebf4feb904b4aeaf5d751536 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Oct 30 05:53:54 2020 -0700 Relax flaky check in TestScopesAndVariables on windows/go1.15 (#2215) Co-authored-by: Polina Sokolova commit 775c923ec41e92db72122482d69343ef712546c7 Author: Alessandro Arzilli Date: Thu Oct 22 17:26:19 2020 +0200 proc: support reading deferred calls' arguments on linux/arm64 (#2210) commit 1a782d321d93e91436f3c3858aca6683cf4cabcf Author: Alessandro Arzilli Date: Thu Oct 22 17:23:55 2020 +0200 service/rpccommon: log error for conns rejected by --only-same-user (#2211) * service/rpccommon: log error for conns rejected by --only-same-user If no logger is enabled manually write to stderr instead. Fixes #2209 * logflags: fix style complaints from DeepSource commit 9a3c9ebad126bbb951087edfc0d6afad9255d8a6 Author: Alessandro Arzilli Date: Wed Oct 21 21:50:52 2020 +0200 proc/*: add launch option to disable ASLR (#2202) Fixes #1847 commit 0bbf9e4eafaecd4de39f483c880ffb13e34c4038 Author: chainhelen Date: Tue Oct 20 05:44:04 2020 +0800 *: Closer close and use assertNoError for testcase (#2204) commit 9b7bc638861e7f91f983a6adaa3d5d27ff17f226 Author: chainhelen Date: Mon Oct 19 23:21:03 2020 +0800 Doc: update KnownBugs and faq. (#2196) 1. Remove bug about unsupport systems, because we has pretty error msg. 2. Add usage for remote debugging. Relate: #1883, #1829, #861, #1332. commit a31631b5f9ffaaf831bdf9017260939a30626df0 Author: Alessandro Arzilli Date: Tue Oct 13 00:07:24 2020 +0200 proc/test: fix TestStepCallPtr on linux/386 (#2193) The test needs to set a breakpoint on main.CallFn after the prologue, on linux/386 this function does not have any instruction after the prologue on the function header line because it doesn't need to allocate space for local variables. Change the fixture so that this isn't a problem. This bug results on the test failing a small percentage of the time. Co-authored-by: a commit a2550b4809706313481be722aee9cabad2d32300 Author: Alessandro Arzilli Date: Tue Oct 13 00:05:28 2020 +0200 proc: Remove (*Arch).Prologues method (#2192) It returns an unexported type and is only used in a single place. commit db716e4678f8868598dabe8dede9dd0e634962f0 Author: Alessandro Arzilli Date: Tue Oct 13 00:04:32 2020 +0200 proc/test: enable TestCgoStacktrace2 (#2194) Due to a missing check TestCgoStacktrace2 didn't actually check anything. Enable it and then skip it on linux/386 and linux/arm64 where it's broken. Co-authored-by: a commit 1374962f72b813cec3a88e561c361a48c1512420 Author: Alessandro Arzilli Date: Tue Oct 13 00:02:55 2020 +0200 proc/native/linux: get exit status if proc exits after receiving signal (#2195) If the process receives a signal (or sends a singal to itself) and then dies before we can route the signal back to it we still need to retrieve its exit status. Fixes a rare failure of TestIssue1101 in proc_test.go Co-authored-by: a commit 5632cf92be1920e578468dc15ed34a85da20eb48 Author: Suzy Mueller Date: Wed Oct 7 11:24:40 2020 -0400 service/dap: add "panic" and "fatal error" as stopped reasons (#2186) * service/dap: add "panic" and "fatal error" as stopped reasons The unrecovered panic and fatal throw breakpoints are not set by the user. We now check for these special breakpoints and send appropriate stopped reasons to the client. * Add getter for StopReason * Set threadID and stop reason correctly If there is no selected goroutine, no goroutine ID should be set in the stopped event. The stopped reason can be better determined using the process StopReason. * Update panic breakpoint on next test to work with Go 1.13 runtime When running panic.go with Go1.13, the next line that is stepped to after panic('boom') is the defer function in the runtime package. The unrecovered panic breakpoint is not hit until after several steps. The test now steps until the breakpoint is hit, or the program terminates without hitting the unrecovered panic breakpoint, in which case it fails. * Skip breakpoint on next test in < Go 1.14 commit 80d0c8e717ae879920a8911a8be7985c9439c7c3 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Oct 2 09:18:33 2020 -0700 service/dap: support clearing breakpoints and setting breakpoint conditions (#2188) * Support clearing breakpoints and setting conditions * Return unverified breakpoints with errors Co-authored-by: Polina Sokolova commit 551c54173718d2962fabbd1af34b93705f6754ac Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Sep 29 07:03:53 2020 -0700 service/dap: make interface variable to dap.Variable conversion more readable (#2184) * Add underlying type when printing interface type * Add todo to remove one level from interface printing Co-authored-by: Polina Sokolova commit 1c4c1fd7fdb14f539bdc385f21bc6b223497907a Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Sep 28 02:05:33 2020 -0700 Remove irrelevant left-over comment (#2183) Co-authored-by: Polina Sokolova commit 84328ed8703eb493072899d418ab04a4b37759e5 Author: Alessandro Arzilli Date: Thu Sep 24 17:10:20 2020 +0200 proc/tests: keep track of tests skipped due to backend problems (#2178) * proc/tests: keep track of tests skipped due to backend problems Mark tests skipped due to backend problems and add a script to keep track of them. * Travis-CI: add ignorechecksum option to chocolatey command Looks like a configuration problem on chocolatey's end. commit 7e00666b9f8d3fcdbda94c6f578d4484ed7bc2c7 Author: Alessandro Arzilli Date: Thu Sep 24 17:05:24 2020 +0200 proc: use argument position for addr only when injecting function calls (#2181) * proc: use argument position for addr only when injecting function calls We can not, in general, use the argument position to determine the address of a formal parameter, it will not work in presence of optimizations or inlining. In those cases formal arguments could be stored in registers. Fixes #2176 * Travis-CI: add ignorechecksum option to chocolatey command Looks like a configuration problem on chocolatey's end. Co-authored-by: a commit 2bd38fff90f9f76647bda190ed40e7c33637aebf Author: Alessandro Arzilli Date: Thu Sep 24 17:03:46 2020 +0200 dwarf/line: ignore end_of_sequence entry if AllPCsBetween (#2180) * dwarf/line: ignore end_of_sequence entry if AllPCsBetween Go 1.15 (but possibly prior versions of Go too) has a tendency to use an address in the middle of an instruction for this entry, but if it was correct it would be after the last instruction of the function anyway. This problem manifests especially frequently as a target crash in TestStepConcurrentPtr on linux/arm64 (~6% of the runs). * Travis-CI: add ignorechecksum option to chocolatey command Looks like a configuration problem on chocolatey's end. Co-authored-by: a commit 310a124dba5556615b603f69054387fb297f3795 Author: Alessandro Arzilli Date: Thu Sep 24 17:02:29 2020 +0200 service/*: remove threadID argument of (*Debugger).PackageVariables (#2182) * Travis-CI: add ignorechecksum option to chocolatey command Looks like a configuration problem on chocolatey's end. * service/*: remove threadID argument of (*Debugger).PackageVariables Which thread is used doesn't make any difference to the list of package variables that is returned and this option was only ever used by an old v1 API call. commit 85952c08267be75f85cf3ad92254cd57bebd8dc2 Author: Alessandro Arzilli Date: Tue Sep 15 23:49:30 2020 +0200 proc: resolve symlinks when searching for split debug_info if path is /proc/pid/exe (#2170) * Revert "proc: Find executable should follow symbol links." This reverts commit 3e04ad0fada0c3ab57caf58bc024e4c0f9a3e01a. * proc: resolve symlinks when searching for split debug_info if path is /proc/pid/exe Fixes #2168 commit 347777295d00c159aba199230c709e904f757609 Author: Eli Bendersky Date: Tue Sep 15 14:43:13 2020 -0700 service/dap: pull in newer version of google/go-dap (#2167) Pulls in v0.3.0 of google/go-dap; this version has some fixes and API improvements which service/dap will be able to leverage to clean up some code. commit 4dc8aedc4da06c9b809defc62e72158311005b5d Author: Alessandro Arzilli Date: Tue Sep 15 22:15:49 2020 +0200 proc/gdbserial: fix two protocol bugs (#2172) During the testing of the core dump generation feature two bugs were discovered in gdbserial: 1. we don't check that both bytes of the checksum are read, if the buffer only has one byte we can end up reading only one byte instead of two and the second byte will mess up the parsing of the next packet 2. binary encoded packets can start with an 'E' and not be errors, when using binary responses add an extra check for the lenght of the response before deciding that the response is an error. Unfortunately this encoding is inherently ambiguous (we can't distinguish a 3 byte response starting with 'E' from an error) so binary requests that lead to short responses should be avoided. Testing this is complicated, they will be tested implicitly by the upcoming core dump test. Co-authored-by: a commit 4980fff8cea86d01305d13187a036cd5244e1bf5 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Sep 15 13:14:55 2020 -0700 service/dap: Add support for package globals to scopes/variables requests (#2160) * Support global variables * Respond to review comments * Clarify comment * Add more details to test error messages * Remove flaky main..inittask checks * Rename globals flag to match vscode-go * Normalize filepath with slash separator * Improve handling for unknown package * Tweak error message * More refactoring, normalization and error details to deal with Win test failures * Clean up optional launch args processing * Add CurrentPackage to debugger and use instead of ListPackagesBuildInfo Co-authored-by: Polina Sokolova commit 37d1e0100a7b19aa47870196ed1fc0766ffa4eb6 Author: hitzhangjie Date: Fri Sep 11 14:21:11 2020 +0800 terminal: add -size argument to examinemem command Adds a -size argument to examinemem that specifies how to group bytes on output. commit 6ef7aa87437b1e45cae87ad0cd74a4560fc5a8ea Author: aarzilli Date: Tue Jul 7 15:21:18 2020 +0200 service: move some type conversions from service/debugger to rpc pkgs Move the conversion of some 'proc' types from service/debugger into service/rpc1 and service/rpc2. The methods of service/debugger.(*Debugger) are also used by service/dap which requires these types to be converted differently and converting them twice is inefficent and doesn't make much sense. Updates #2161 commit e8dbbef3746799f50558a8340371095c7f16903e Author: Alessandro Arzilli Date: Thu Sep 10 16:11:19 2020 +0200 Travis-CI: bump version of Go used to test linux/386 to 1.15 (#2169) Fixes #2134 commit 0fd4ff4260566e10c0a488c6f35a90fdeb4fc556 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 9 12:47:18 2020 -0700 Use 'nil' as string value for interfaces with 0 addr (#2158) Co-authored-by: Polina Sokolova commit 12009e9833e4efa970458618d6696e5b87ea3fbe Author: Alessandro Arzilli Date: Wed Sep 9 19:36:15 2020 +0200 proc/*,service: replace uses of uintptr with uint64 (#2163) Since proc is supposed to work independently from the target architecture it shouldn't use architecture-dependent types, like uintptr. For example when reading a 64bit core file on a 32bit architecture, uintptr will be 32bit but the addresses proc needs to represent will be 64bit. commit e07bfd318099868d6dd12ecc5b5a32861bfa6b98 Author: chainhelen Date: Wed Sep 9 06:18:49 2020 +0800 pkg/proc: fix dlv panic when sameGCond is nil. (#2164) `sameFrameCond` should not be constructed as one `And Express` when `sameGCond` which is the first child of `BinaryExpr` is nil. Fixes: #2162 --- .deepsource.toml | 2 +- .gitignore | 6 +- .teamcity/pom.xml | 104 + .teamcity/settings.kts | 249 + .travis.yml | 82 - CHANGELOG.md | 255 + Documentation/EditorIntegration.md | 3 +- Documentation/KnownBugs.md | 1 - Documentation/api/ClientHowto.md | 2 +- Documentation/api/README.md | 13 +- Documentation/api/dap/README.md | 116 + Documentation/api/json-rpc/README.md | 4 +- Documentation/backend_test_health.md | 26 + Documentation/cli/README.md | 179 +- Documentation/cli/expr.md | 27 + Documentation/cli/getting_started.md | 4 +- Documentation/cli/starlark.md | 13 +- Documentation/faq.md | 39 +- Documentation/installation/README.md | 68 +- Documentation/installation/freebsd/install.md | 21 +- Documentation/installation/linux/install.md | 20 +- Documentation/installation/osx/install.md | 35 +- Documentation/installation/windows/install.md | 12 +- Documentation/internal/README.md | 3 +- Documentation/internal/portnotes.md | 154 + Documentation/usage/README.md | 34 +- Documentation/usage/dlv.md | 18 +- Documentation/usage/dlv_attach.md | 16 +- Documentation/usage/dlv_backend.md | 19 +- Documentation/usage/dlv_connect.md | 23 +- Documentation/usage/dlv_core.md | 23 +- Documentation/usage/dlv_dap.md | 49 +- Documentation/usage/dlv_debug.md | 16 +- Documentation/usage/dlv_exec.md | 16 +- Documentation/usage/dlv_log.md | 19 +- Documentation/usage/dlv_redirect.md | 19 +- Documentation/usage/dlv_replay.md | 21 +- Documentation/usage/dlv_run.md | 21 +- Documentation/usage/dlv_test.md | 22 +- Documentation/usage/dlv_trace.md | 19 +- Documentation/usage/dlv_version.md | 22 +- Makefile | 15 +- README.md | 6 +- _fixtures/asmnilptr/main.go | 9 + _fixtures/asmnilptr/main_386.s | 7 + _fixtures/asmnilptr/main_amd64.s | 7 + _fixtures/asmnilptr/main_arm64.s | 7 + _fixtures/cat.go | 15 + _fixtures/databpcountstest.go | 31 + _fixtures/databpeasy.go | 48 + _fixtures/databpstack.go | 25 + _fixtures/fatalerror.go | 6 + _fixtures/fncall.go | 53 +- _fixtures/fputest/fputest.go | 4 +- _fixtures/fputest/fputest_amd64.s | 7 + _fixtures/genericbp.go | 12 + _fixtures/goroutinebreak.go | 26 + _fixtures/goroutinegroup.go | 75 + _fixtures/issue2162.go | 7 + _fixtures/issue2319/README.txt | 57 + _fixtures/issue2319/asm-linux-amd64.s | 5 + _fixtures/issue2319/cfile-linux-amd64.syso | Bin 0 -> 5840 bytes _fixtures/issue2319/main.go | 7 + _fixtures/locationsprog_generic.go | 24 + _fixtures/longstrings.go | 22 + _fixtures/loopprog.go | 2 +- _fixtures/morestringarg.go | 11 + _fixtures/setymmreg/main.go | 7 + _fixtures/setymmreg/setymmreg_amd64.s | 9 + _fixtures/sigchldprog.go | 3 +- _fixtures/testenv.go | 4 +- _fixtures/teststepprog.go | 8 +- _fixtures/testtoggle.go | 23 + _fixtures/testvariables.go | 12 +- _fixtures/testvariables2.go | 56 +- _fixtures/testvariables_generic.go | 22 + _scripts/gen-backend_test_health.go | 110 + _scripts/gen-starlark-bindings.go | 2 + _scripts/gen-travis.go | 112 +- _scripts/latestver.py | 27 + _scripts/make.go | 118 +- _scripts/rtype-out.txt | 78 + _scripts/rtype.go | 666 + _scripts/staticcheck-out.txt | 0 _scripts/test_linux.sh | 60 + _scripts/test_mac.sh | 45 + _scripts/test_windows.ps1 | 76 + cmd/dlv/cmds/commands.go | 322 +- cmd/dlv/dlv_test.go | 534 +- go.mod | 22 +- go.sum | 355 +- pkg/config/config.go | 73 +- pkg/config/split.go | 140 + pkg/config/split_test.go | 64 + pkg/dwarf/dwarfbuilder/builder.go | 1 + pkg/dwarf/dwarfbuilder/info.go | 16 +- pkg/dwarf/frame/entries.go | 81 +- pkg/dwarf/frame/entries_test.go | 2 +- pkg/dwarf/frame/parser.go | 197 +- pkg/dwarf/frame/parser_test.go | 3 +- pkg/dwarf/frame/table.go | 6 +- pkg/dwarf/godwarf/tree.go | 14 +- pkg/dwarf/godwarf/type.go | 31 +- pkg/dwarf/line/line_parser.go | 148 +- pkg/dwarf/line/line_parser_test.go | 19 +- pkg/dwarf/line/parse_util.go | 52 +- pkg/dwarf/line/state_machine.go | 98 +- pkg/dwarf/line/state_machine_test.go | 8 +- pkg/dwarf/op/op.go | 419 +- pkg/dwarf/op/op_test.go | 61 +- pkg/dwarf/op/opcodes.go | 109 +- pkg/dwarf/op/opcodes.table | 216 +- pkg/dwarf/op/regs.go | 39 +- pkg/dwarf/reader/reader.go | 36 +- pkg/dwarf/reader/variables.go | 18 +- pkg/dwarf/regnum/amd64.go | 162 + pkg/dwarf/regnum/arm64.go | 56 + pkg/dwarf/regnum/i386.go | 102 + pkg/dwarf/util/buf.go | 38 +- pkg/dwarf/util/util.go | 31 +- pkg/elfwriter/delve_core_notes.go | 11 + pkg/elfwriter/writer.go | 183 + pkg/gobuild/gobuild.go | 71 +- pkg/goversion/compat.go | 29 +- pkg/goversion/go_version.go | 35 +- pkg/goversion/version_test.go | 2 + pkg/locspec/doc.go | 18 +- pkg/locspec/locations.go | 123 +- pkg/logflags/logflags.go | 33 +- pkg/proc/amd64_arch.go | 166 +- pkg/proc/amd64_disasm.go | 83 +- pkg/proc/amd64util/debugregs.go | 130 + pkg/proc/amd64util/xsave.go | 190 + pkg/proc/amd64util/xsave_amd64.go | 30 + pkg/proc/amd64util/xsave_amd64.s | 9 + pkg/proc/amd64util/xsave_other.go | 8 + pkg/proc/arch.go | 84 +- pkg/proc/arm64_arch.go | 251 +- pkg/proc/arm64_disasm.go | 17 +- pkg/proc/bininfo.go | 885 +- pkg/proc/breakpoints.go | 744 +- pkg/proc/core/core.go | 113 +- pkg/proc/core/core_test.go | 70 +- pkg/proc/core/delve_core.go | 160 + pkg/proc/core/linux_core.go | 132 +- pkg/proc/core/minidump/fileflags_string.go | 2 +- pkg/proc/core/minidump/minidump.go | 20 +- pkg/proc/core/windows_amd64_minidump.go | 17 +- pkg/proc/disasm.go | 21 +- pkg/proc/dump.go | 420 + pkg/proc/dwarf_export_test.go | 19 + pkg/proc/dwarf_expr_test.go | 119 +- pkg/proc/eval.go | 381 +- pkg/proc/fbsdutil/regs.go | 176 +- pkg/proc/fbsdutil/regs_test.go | 60 - pkg/proc/fncall.go | 381 +- pkg/proc/gdbserial/gdbserver.go | 840 +- pkg/proc/gdbserial/gdbserver_conn.go | 419 +- pkg/proc/gdbserial/gdbserver_unix.go | 1 + pkg/proc/gdbserial/rr.go | 11 +- pkg/proc/gdbserial/rr_test.go | 18 +- pkg/proc/goroutine_cache.go | 6 +- pkg/proc/i386_arch.go | 133 +- pkg/proc/i386_disasm.go | 41 +- pkg/proc/interface.go | 105 +- pkg/proc/internal/ebpf/bpf/dummy.go | 4 + pkg/proc/internal/ebpf/bpf/include/dummy.go | 4 + .../ebpf/bpf/include/function_vals.bpf.h | 43 + .../internal/ebpf/bpf/include/trace.bpf.h | 25 + pkg/proc/internal/ebpf/bpf/include/vmlinux.h | 124044 +++++++++++++++ pkg/proc/internal/ebpf/bpf/trace.bpf.c | 247 + .../ebpf/build/build-ebpf-builder-img.sh | 5 + .../internal/ebpf/build/build-ebpf-objects.sh | 17 + pkg/proc/internal/ebpf/build/ebpf-Dockerfile | 19 + pkg/proc/internal/ebpf/context.go | 34 + pkg/proc/internal/ebpf/dummy.go | 14 + pkg/proc/internal/ebpf/helpers.go | 227 + pkg/proc/internal/ebpf/helpers_disabled.go | 44 + pkg/proc/internal/ebpf/trace_bpfel_x86.go | 126 + pkg/proc/internal/ebpf/trace_bpfel_x86.o | Bin 0 -> 911344 bytes pkg/proc/linutil/dynamic.go | 10 +- pkg/proc/linutil/regs_amd64_arch.go | 328 +- pkg/proc/linutil/regs_arm64_arch.go | 33 +- pkg/proc/linutil/regs_i386_arch.go | 175 +- pkg/proc/linutil/regs_test.go | 60 - pkg/proc/macutil/rosetta_darwin.go | 19 + pkg/proc/macutil/rosetta_other.go | 10 + pkg/proc/mem.go | 141 +- pkg/proc/moduledata.go | 36 +- pkg/proc/native/dump_linux.go | 123 + pkg/proc/native/dump_linux_amd64.go | 152 + pkg/proc/native/dump_linux_other.go | 12 + pkg/proc/native/dump_other.go | 17 + pkg/proc/native/dump_windows_amd64.go | 91 + pkg/proc/native/hwbreak_amd64.go | 39 + pkg/proc/native/hwbreak_other.go | 22 + pkg/proc/native/nonative_darwin.go | 40 +- pkg/proc/native/proc.go | 196 +- pkg/proc/native/proc_darwin.go | 51 +- pkg/proc/native/proc_ebpf_linux.go | 8 + pkg/proc/native/proc_freebsd.c | 15 +- pkg/proc/native/proc_freebsd.go | 31 +- pkg/proc/native/proc_freebsd.h | 4 +- pkg/proc/native/proc_linux.go | 276 +- pkg/proc/native/proc_no_ebpf_linux.go | 8 + pkg/proc/native/proc_unix.go | 1 + pkg/proc/native/proc_windows.go | 120 +- pkg/proc/native/ptrace_darwin.go | 3 +- pkg/proc/native/ptrace_freebsd.go | 6 +- pkg/proc/native/ptrace_linux.go | 9 + pkg/proc/native/ptrace_linux_386.go | 15 +- pkg/proc/native/ptrace_linux_64bit.go | 1 + pkg/proc/native/ptrace_linux_amd64.go | 13 +- pkg/proc/native/register_linux_386.go | 52 +- pkg/proc/native/registers_darwin_amd64.go | 21 +- pkg/proc/native/registers_freebsd_amd64.go | 47 +- pkg/proc/native/registers_linux_amd64.go | 54 +- pkg/proc/native/registers_linux_arm64.go | 50 +- pkg/proc/native/registers_windows_amd64.go | 73 +- pkg/proc/native/syscall_windows.go | 27 + pkg/proc/native/threads.go | 71 +- pkg/proc/native/threads_darwin.go | 31 +- pkg/proc/native/threads_freebsd.go | 24 +- pkg/proc/native/threads_linux.go | 58 +- pkg/proc/native/threads_linux_amd64.go | 42 +- pkg/proc/native/threads_linux_arm64.go | 146 + pkg/proc/native/threads_windows.go | 70 +- pkg/proc/native/zsyscall_windows.go | 72 +- pkg/proc/pe.go | 98 +- pkg/proc/proc_general_test.go | 56 +- pkg/proc/proc_linux_test.go | 2 +- pkg/proc/proc_test.go | 1558 +- pkg/proc/proc_unexported_test.go | 23 + pkg/proc/proc_unix_test.go | 38 +- pkg/proc/registers.go | 1 - pkg/proc/scope_test.go | 6 +- pkg/proc/stack.go | 185 +- pkg/proc/stackwatch.go | 192 + pkg/proc/target.go | 357 +- pkg/proc/target_exec.go | 249 +- pkg/proc/test/support.go | 26 +- pkg/proc/threads.go | 38 +- pkg/proc/types.go | 97 +- pkg/proc/variables.go | 477 +- pkg/proc/winutil/regs.go | 160 - pkg/proc/x86_disasm.go | 14 +- pkg/terminal/colorize/colorize.go | 298 + pkg/terminal/command.go | 1149 +- pkg/terminal/command_test.go | 376 +- pkg/terminal/config.go | 99 +- pkg/terminal/starbind/conv.go | 10 +- pkg/terminal/starbind/starlark.go | 13 - pkg/terminal/starbind/starlark_mapping.go | 242 + pkg/terminal/starlark_test.go | 4 - pkg/terminal/terminal.go | 209 +- pkg/terminal/terminal_other.go | 1 + pkg/version/buildinfo.go | 33 + pkg/version/fixbuild.go | 23 + pkg/version/version.go | 21 +- service/api/command.go | 153 + service/api/conversions.go | 225 +- service/api/prettyprint.go | 248 +- service/api/prettyprint_test.go | 27 +- service/api/types.go | 120 +- service/client.go | 21 +- service/dap/command.go | 160 + service/dap/config.go | 75 + service/dap/config_test.go | 197 + service/dap/daptest/client.go | 428 +- service/dap/daptest/gen/main.go | 118 + service/dap/daptest/resp.go | 1131 + service/dap/error_ids.go | 28 +- service/dap/handles.go | 41 + service/dap/server.go | 3941 +- service/dap/server_test.go | 6930 +- service/dap/types.go | 251 + service/dap/utils.go | 10 - service/debugger/debugger.go | 1086 +- service/debugger/debugger_linux.go | 2 + service/debugger/debugger_unix.go | 1 + service/debugger/debugger_unix_test.go | 1 + service/internal/sameuser/doc.go | 3 + service/internal/sameuser/sameuser.go | 10 + service/internal/sameuser/sameuser_linux.go | 134 + .../sameuser}/sameuser_linux_test.go | 37 +- service/rpc1/client.go | 11 +- service/rpc1/server.go | 96 +- service/rpc2/client.go | 83 +- service/rpc2/server.go | 330 +- service/rpccallback.go | 5 + service/rpccommon/sameuser.go | 9 - service/rpccommon/sameuser_linux.go | 115 - service/rpccommon/server.go | 79 +- service/test/common_test.go | 17 +- service/test/integration1_test.go | 60 +- service/test/integration2_test.go | 807 +- service/test/variables_test.go | 130 +- vendor/github.com/cilium/ebpf/.clang-format | 17 + vendor/github.com/cilium/ebpf/.gitignore | 14 + vendor/github.com/cilium/ebpf/.golangci.yaml | 28 + vendor/github.com/cilium/ebpf/ARCHITECTURE.md | 80 + .../github.com/cilium/ebpf/CODE_OF_CONDUCT.md | 46 + vendor/github.com/cilium/ebpf/CONTRIBUTING.md | 40 + vendor/github.com/cilium/ebpf/LICENSE | 23 + vendor/github.com/cilium/ebpf/Makefile | 73 + vendor/github.com/cilium/ebpf/README.md | 70 + vendor/github.com/cilium/ebpf/asm/alu.go | 149 + .../github.com/cilium/ebpf/asm/alu_string.go | 107 + vendor/github.com/cilium/ebpf/asm/doc.go | 2 + vendor/github.com/cilium/ebpf/asm/func.go | 201 + .../github.com/cilium/ebpf/asm/func_string.go | 191 + .../github.com/cilium/ebpf/asm/instruction.go | 511 + vendor/github.com/cilium/ebpf/asm/jump.go | 109 + .../github.com/cilium/ebpf/asm/jump_string.go | 53 + .../github.com/cilium/ebpf/asm/load_store.go | 204 + .../cilium/ebpf/asm/load_store_string.go | 80 + vendor/github.com/cilium/ebpf/asm/opcode.go | 237 + .../cilium/ebpf/asm/opcode_string.go | 38 + vendor/github.com/cilium/ebpf/asm/register.go | 49 + .../cilium/ebpf/attachtype_string.go | 65 + vendor/github.com/cilium/ebpf/collection.go | 668 + vendor/github.com/cilium/ebpf/doc.go | 16 + vendor/github.com/cilium/ebpf/elf_reader.go | 1077 + .../github.com/cilium/ebpf/elf_reader_fuzz.go | 22 + vendor/github.com/cilium/ebpf/go.mod | 9 + vendor/github.com/cilium/ebpf/go.sum | 13 + vendor/github.com/cilium/ebpf/info.go | 273 + .../github.com/cilium/ebpf/internal/align.go | 6 + .../cilium/ebpf/internal/btf/btf.go | 798 + .../cilium/ebpf/internal/btf/btf_types.go | 287 + .../ebpf/internal/btf/btf_types_string.go | 44 + .../cilium/ebpf/internal/btf/core.go | 888 + .../cilium/ebpf/internal/btf/doc.go | 8 + .../cilium/ebpf/internal/btf/ext_info.go | 312 + .../cilium/ebpf/internal/btf/fuzz.go | 50 + .../cilium/ebpf/internal/btf/info.go | 48 + .../cilium/ebpf/internal/btf/strings.go | 54 + .../cilium/ebpf/internal/btf/syscalls.go | 31 + .../cilium/ebpf/internal/btf/types.go | 957 + vendor/github.com/cilium/ebpf/internal/cpu.go | 62 + vendor/github.com/cilium/ebpf/internal/elf.go | 68 + .../github.com/cilium/ebpf/internal/endian.go | 29 + .../github.com/cilium/ebpf/internal/errors.go | 51 + vendor/github.com/cilium/ebpf/internal/fd.go | 69 + .../cilium/ebpf/internal/feature.go | 100 + vendor/github.com/cilium/ebpf/internal/io.go | 16 + .../cilium/ebpf/internal/pinning.go | 44 + vendor/github.com/cilium/ebpf/internal/ptr.go | 31 + .../cilium/ebpf/internal/ptr_32_be.go | 15 + .../cilium/ebpf/internal/ptr_32_le.go | 15 + .../github.com/cilium/ebpf/internal/ptr_64.go | 14 + .../cilium/ebpf/internal/syscall.go | 304 + .../cilium/ebpf/internal/syscall_string.go | 56 + .../cilium/ebpf/internal/unix/types_linux.go | 208 + .../cilium/ebpf/internal/unix/types_other.go | 267 + .../cilium/ebpf/internal/version.go | 163 + vendor/github.com/cilium/ebpf/link/cgroup.go | 171 + vendor/github.com/cilium/ebpf/link/doc.go | 2 + .../github.com/cilium/ebpf/link/freplace.go | 88 + vendor/github.com/cilium/ebpf/link/iter.go | 100 + vendor/github.com/cilium/ebpf/link/kprobe.go | 444 + vendor/github.com/cilium/ebpf/link/link.go | 233 + vendor/github.com/cilium/ebpf/link/netns.go | 60 + .../github.com/cilium/ebpf/link/perf_event.go | 272 + .../github.com/cilium/ebpf/link/platform.go | 25 + vendor/github.com/cilium/ebpf/link/program.go | 76 + .../cilium/ebpf/link/raw_tracepoint.go | 61 + .../github.com/cilium/ebpf/link/syscalls.go | 191 + .../github.com/cilium/ebpf/link/tracepoint.go | 60 + vendor/github.com/cilium/ebpf/link/uprobe.go | 288 + vendor/github.com/cilium/ebpf/linker.go | 159 + vendor/github.com/cilium/ebpf/map.go | 1267 + vendor/github.com/cilium/ebpf/marshalers.go | 253 + vendor/github.com/cilium/ebpf/prog.go | 761 + vendor/github.com/cilium/ebpf/ringbuf/doc.go | 6 + .../github.com/cilium/ebpf/ringbuf/reader.go | 258 + vendor/github.com/cilium/ebpf/ringbuf/ring.go | 109 + vendor/github.com/cilium/ebpf/run-tests.sh | 125 + vendor/github.com/cilium/ebpf/syscalls.go | 464 + vendor/github.com/cilium/ebpf/types.go | 278 + vendor/github.com/cilium/ebpf/types_string.go | 119 + .../cpuguy83/go-md2man/md2man/md2man.go | 20 - .../cpuguy83/go-md2man/md2man/roff.go | 285 - .../cpuguy83/go-md2man/{ => v2}/LICENSE.md | 0 .../cpuguy83/go-md2man/v2/md2man/md2man.go | 14 + .../cpuguy83/go-md2man/v2/md2man/roff.go | 345 + .../derekparker/trie/.deepsource.toml | 13 + vendor/github.com/derekparker/trie/.gitignore | 1 + vendor/github.com/derekparker/trie/LICENSE | 20 + vendor/github.com/derekparker/trie/README.md | 62 + vendor/github.com/derekparker/trie/trie.go | 306 + vendor/github.com/google/go-dap/.travis.yml | 12 - vendor/github.com/google/go-dap/README.md | 3 +- vendor/github.com/google/go-dap/codec.go | 120 +- vendor/github.com/google/go-dap/doc.go | 20 + vendor/github.com/google/go-dap/io.go | 4 +- .../github.com/google/go-dap/schematypes.go | 823 +- .../mattn/go-colorable/colorable_appengine.go | 2 + .../mattn/go-colorable/colorable_others.go | 2 + .../mattn/go-colorable/colorable_windows.go | 52 +- .../github.com/mattn/go-runewidth/.travis.yml | 8 + vendor/github.com/mattn/go-runewidth/LICENSE | 21 + .../github.com/mattn/go-runewidth/README.mkd | 27 + .../mattn/go-runewidth/runewidth.go | 1235 + .../mattn/go-runewidth/runewidth_js.go | 8 + .../mattn/go-runewidth/runewidth_posix.go | 77 + .../mattn/go-runewidth/runewidth_windows.go | 25 + vendor/github.com/peterh/liner/README.md | 3 +- vendor/github.com/peterh/liner/common.go | 11 +- .../github.com/peterh/liner/fallbackinput.go | 2 + vendor/github.com/peterh/liner/go.mod | 3 + vendor/github.com/peterh/liner/go.sum | 2 + vendor/github.com/peterh/liner/input.go | 10 +- .../github.com/peterh/liner/input_windows.go | 39 +- vendor/github.com/peterh/liner/line.go | 192 +- vendor/github.com/peterh/liner/output.go | 3 - .../github.com/peterh/liner/output_windows.go | 4 - vendor/github.com/peterh/liner/width.go | 31 +- vendor/github.com/russross/blackfriday/doc.go | 32 - vendor/github.com/russross/blackfriday/go.mod | 1 - .../github.com/russross/blackfriday/html.go | 938 - .../github.com/russross/blackfriday/latex.go | 334 - .../russross/blackfriday/{ => v2}/.gitignore | 0 .../russross/blackfriday/{ => v2}/.travis.yml | 4 +- .../russross/blackfriday/{ => v2}/LICENSE.txt | 0 .../russross/blackfriday/{ => v2}/README.md | 126 +- .../russross/blackfriday/{ => v2}/block.go | 836 +- .../github.com/russross/blackfriday/v2/doc.go | 18 + .../github.com/russross/blackfriday/v2/esc.go | 34 + .../github.com/russross/blackfriday/v2/go.mod | 1 + .../russross/blackfriday/v2/html.go | 949 + .../russross/blackfriday/{ => v2}/inline.go | 566 +- .../russross/blackfriday/{ => v2}/markdown.go | 693 +- .../russross/blackfriday/v2/node.go | 354 + .../blackfriday/{ => v2}/smartypants.go | 139 +- .../sanitized_anchor_name/.travis.yml | 16 + .../shurcooL/sanitized_anchor_name/LICENSE | 21 + .../shurcooL/sanitized_anchor_name/README.md | 36 + .../shurcooL/sanitized_anchor_name/go.mod | 1 + .../shurcooL/sanitized_anchor_name/main.go | 29 + vendor/github.com/spf13/cobra/.gitignore | 5 +- vendor/github.com/spf13/cobra/.golangci.yml | 48 + vendor/github.com/spf13/cobra/.travis.yml | 39 +- vendor/github.com/spf13/cobra/CHANGELOG.md | 51 + vendor/github.com/spf13/cobra/CONDUCT.md | 37 + vendor/github.com/spf13/cobra/CONTRIBUTING.md | 50 + vendor/github.com/spf13/cobra/Makefile | 40 + vendor/github.com/spf13/cobra/README.md | 952 +- vendor/github.com/spf13/cobra/args.go | 109 + .../spf13/cobra/bash_completions.go | 630 +- .../spf13/cobra/bash_completions.md | 137 +- vendor/github.com/spf13/cobra/cobra.go | 62 +- vendor/github.com/spf13/cobra/command.go | 1039 +- vendor/github.com/spf13/cobra/command_win.go | 16 +- .../spf13/cobra/custom_completions.go | 557 + vendor/github.com/spf13/cobra/doc/README.md | 12 + vendor/github.com/spf13/cobra/doc/man_docs.go | 92 +- vendor/github.com/spf13/cobra/doc/man_docs.md | 7 +- vendor/github.com/spf13/cobra/doc/md_docs.go | 100 +- vendor/github.com/spf13/cobra/doc/md_docs.md | 20 +- .../github.com/spf13/cobra/doc/rest_docs.go | 185 + .../github.com/spf13/cobra/doc/rest_docs.md | 114 + vendor/github.com/spf13/cobra/doc/util.go | 2 +- .../github.com/spf13/cobra/doc/yaml_docs.go | 21 +- .../github.com/spf13/cobra/doc/yaml_docs.md | 13 +- .../spf13/cobra/fish_completions.go | 207 + .../spf13/cobra/fish_completions.md | 4 + vendor/github.com/spf13/cobra/go.mod | 12 + vendor/github.com/spf13/cobra/go.sum | 313 + .../spf13/cobra/powershell_completions.go | 285 + .../spf13/cobra/powershell_completions.md | 3 + .../spf13/cobra/projects_using_cobra.md | 38 + .../spf13/cobra/shell_completions.go | 84 + .../spf13/cobra/shell_completions.md | 483 + .../github.com/spf13/cobra/zsh_completions.go | 240 + .../github.com/spf13/cobra/zsh_completions.md | 48 + vendor/github.com/spf13/pflag/.travis.yml | 22 +- vendor/github.com/spf13/pflag/README.md | 23 +- vendor/github.com/spf13/pflag/bool_slice.go | 38 + vendor/github.com/spf13/pflag/bytes.go | 209 + vendor/github.com/spf13/pflag/count.go | 20 +- .../github.com/spf13/pflag/duration_slice.go | 166 + vendor/github.com/spf13/pflag/flag.go | 342 +- .../github.com/spf13/pflag/float32_slice.go | 174 + .../github.com/spf13/pflag/float64_slice.go | 166 + vendor/github.com/spf13/pflag/go.mod | 3 + vendor/github.com/spf13/pflag/go.sum | 0 vendor/github.com/spf13/pflag/golangflag.go | 4 + vendor/github.com/spf13/pflag/int16.go | 88 + vendor/github.com/spf13/pflag/int32_slice.go | 174 + vendor/github.com/spf13/pflag/int64_slice.go | 166 + vendor/github.com/spf13/pflag/int_slice.go | 30 + vendor/github.com/spf13/pflag/ip_slice.go | 40 +- vendor/github.com/spf13/pflag/string_array.go | 34 +- vendor/github.com/spf13/pflag/string_slice.go | 34 + .../github.com/spf13/pflag/string_to_int.go | 149 + .../github.com/spf13/pflag/string_to_int64.go | 149 + .../spf13/pflag/string_to_string.go | 160 + vendor/github.com/spf13/pflag/uint_slice.go | 42 + vendor/golang.org/x/mod/LICENSE | 27 + vendor/golang.org/x/mod/PATENTS | 22 + .../{tools/internal => mod}/semver/semver.go | 27 +- vendor/golang.org/x/sys/execabs/execabs.go | 102 + vendor/golang.org/x/sys/unix/README.md | 6 +- vendor/golang.org/x/sys/unix/aliases.go | 3 +- vendor/golang.org/x/sys/unix/asm_aix_ppc64.s | 3 +- .../unix/{asm_freebsd_386.s => asm_bsd_386.s} | 12 +- .../{asm_netbsd_amd64.s => asm_bsd_amd64.s} | 10 +- .../unix/{asm_netbsd_arm.s => asm_bsd_arm.s} | 10 +- .../{asm_darwin_amd64.s => asm_bsd_arm64.s} | 10 +- vendor/golang.org/x/sys/unix/asm_darwin_386.s | 29 - vendor/golang.org/x/sys/unix/asm_darwin_arm.s | 30 - .../golang.org/x/sys/unix/asm_darwin_arm64.s | 30 - .../x/sys/unix/asm_dragonfly_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_arm64.s | 29 - vendor/golang.org/x/sys/unix/asm_linux_386.s | 3 +- .../golang.org/x/sys/unix/asm_linux_amd64.s | 3 +- vendor/golang.org/x/sys/unix/asm_linux_arm.s | 3 +- .../golang.org/x/sys/unix/asm_linux_arm64.s | 3 +- .../golang.org/x/sys/unix/asm_linux_mips64x.s | 3 +- .../golang.org/x/sys/unix/asm_linux_mipsx.s | 3 +- .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 3 +- .../golang.org/x/sys/unix/asm_linux_riscv64.s | 4 +- .../golang.org/x/sys/unix/asm_linux_s390x.s | 5 +- vendor/golang.org/x/sys/unix/asm_netbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_arm64.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_arm.s | 29 - ...m_openbsd_arm64.s => asm_openbsd_mips64.s} | 5 +- .../golang.org/x/sys/unix/asm_solaris_amd64.s | 3 +- vendor/golang.org/x/sys/unix/asm_zos_s390x.s | 426 + vendor/golang.org/x/sys/unix/cap_freebsd.go | 1 + vendor/golang.org/x/sys/unix/constants.go | 3 +- vendor/golang.org/x/sys/unix/dev_aix_ppc.go | 4 +- vendor/golang.org/x/sys/unix/dev_aix_ppc64.go | 4 +- vendor/golang.org/x/sys/unix/dev_zos.go | 29 + vendor/golang.org/x/sys/unix/dirent.go | 1 + vendor/golang.org/x/sys/unix/endian_big.go | 3 +- vendor/golang.org/x/sys/unix/endian_little.go | 3 +- vendor/golang.org/x/sys/unix/env_unix.go | 3 +- vendor/golang.org/x/sys/unix/epoll_zos.go | 221 + vendor/golang.org/x/sys/unix/fcntl.go | 1 + vendor/golang.org/x/sys/unix/fcntl_darwin.go | 6 + .../x/sys/unix/fcntl_linux_32bit.go | 5 +- vendor/golang.org/x/sys/unix/fdset.go | 3 +- vendor/golang.org/x/sys/unix/fstatfs_zos.go | 164 + vendor/golang.org/x/sys/unix/gccgo.go | 6 +- vendor/golang.org/x/sys/unix/gccgo_c.c | 6 + .../x/sys/unix/gccgo_linux_amd64.go | 1 + vendor/golang.org/x/sys/unix/ifreq_linux.go | 149 + vendor/golang.org/x/sys/unix/ioctl.go | 10 + vendor/golang.org/x/sys/unix/ioctl_linux.go | 196 + vendor/golang.org/x/sys/unix/ioctl_zos.go | 74 + vendor/golang.org/x/sys/unix/mkall.sh | 29 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 73 +- vendor/golang.org/x/sys/unix/pagesize_unix.go | 1 + vendor/golang.org/x/sys/unix/ptrace_darwin.go | 12 + vendor/golang.org/x/sys/unix/ptrace_ios.go | 12 + vendor/golang.org/x/sys/unix/race.go | 1 + vendor/golang.org/x/sys/unix/race0.go | 3 +- .../x/sys/unix/readdirent_getdents.go | 1 + .../x/sys/unix/readdirent_getdirentries.go | 1 + vendor/golang.org/x/sys/unix/sockcmsg_unix.go | 3 +- .../x/sys/unix/sockcmsg_unix_other.go | 13 +- vendor/golang.org/x/sys/unix/str.go | 1 + vendor/golang.org/x/sys/unix/syscall.go | 46 +- vendor/golang.org/x/sys/unix/syscall_aix.go | 29 +- .../golang.org/x/sys/unix/syscall_aix_ppc.go | 4 +- .../x/sys/unix/syscall_aix_ppc64.go | 4 +- vendor/golang.org/x/sys/unix/syscall_bsd.go | 45 +- .../x/sys/unix/syscall_darwin.1_12.go | 5 +- .../x/sys/unix/syscall_darwin.1_13.go | 6 +- .../golang.org/x/sys/unix/syscall_darwin.go | 249 +- .../x/sys/unix/syscall_darwin_386.1_11.go | 9 - .../x/sys/unix/syscall_darwin_386.go | 57 - .../x/sys/unix/syscall_darwin_amd64.1_11.go | 9 - .../x/sys/unix/syscall_darwin_amd64.go | 12 +- .../x/sys/unix/syscall_darwin_arm.go | 57 - .../x/sys/unix/syscall_darwin_arm64.1_11.go | 11 - .../x/sys/unix/syscall_darwin_arm64.go | 14 +- .../x/sys/unix/syscall_darwin_libSystem.go | 10 +- .../x/sys/unix/syscall_dragonfly.go | 40 +- .../x/sys/unix/syscall_dragonfly_amd64.go | 1 + .../golang.org/x/sys/unix/syscall_freebsd.go | 36 +- .../x/sys/unix/syscall_freebsd_386.go | 1 + .../x/sys/unix/syscall_freebsd_amd64.go | 1 + .../x/sys/unix/syscall_freebsd_arm.go | 1 + .../x/sys/unix/syscall_freebsd_arm64.go | 1 + .../golang.org/x/sys/unix/syscall_illumos.go | 141 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 406 +- .../x/sys/unix/syscall_linux_386.go | 50 +- .../x/sys/unix/syscall_linux_amd64.go | 49 +- .../x/sys/unix/syscall_linux_amd64_gc.go | 4 +- .../x/sys/unix/syscall_linux_arm.go | 60 +- .../x/sys/unix/syscall_linux_arm64.go | 56 +- .../golang.org/x/sys/unix/syscall_linux_gc.go | 3 +- .../x/sys/unix/syscall_linux_gc_386.go | 3 +- .../x/sys/unix/syscall_linux_gc_arm.go | 14 + .../x/sys/unix/syscall_linux_gccgo_386.go | 1 + .../x/sys/unix/syscall_linux_gccgo_arm.go | 1 + .../x/sys/unix/syscall_linux_mips64x.go | 40 +- .../x/sys/unix/syscall_linux_mipsx.go | 44 +- .../x/sys/unix/syscall_linux_ppc.go | 237 + .../x/sys/unix/syscall_linux_ppc64x.go | 39 +- .../x/sys/unix/syscall_linux_riscv64.go | 52 +- .../x/sys/unix/syscall_linux_s390x.go | 43 +- .../x/sys/unix/syscall_linux_sparc64.go | 38 +- .../golang.org/x/sys/unix/syscall_netbsd.go | 40 +- .../x/sys/unix/syscall_netbsd_386.go | 1 + .../x/sys/unix/syscall_netbsd_amd64.go | 1 + .../x/sys/unix/syscall_netbsd_arm.go | 1 + .../x/sys/unix/syscall_netbsd_arm64.go | 1 + .../golang.org/x/sys/unix/syscall_openbsd.go | 23 +- .../x/sys/unix/syscall_openbsd_386.go | 1 + .../x/sys/unix/syscall_openbsd_amd64.go | 1 + .../x/sys/unix/syscall_openbsd_arm.go | 1 + .../x/sys/unix/syscall_openbsd_arm64.go | 1 + .../x/sys/unix/syscall_openbsd_mips64.go | 35 + .../golang.org/x/sys/unix/syscall_solaris.go | 270 +- .../x/sys/unix/syscall_solaris_amd64.go | 1 + vendor/golang.org/x/sys/unix/syscall_unix.go | 5 + .../golang.org/x/sys/unix/syscall_unix_gc.go | 5 +- .../x/sys/unix/syscall_unix_gc_ppc64x.go | 3 +- .../x/sys/unix/syscall_zos_s390x.go | 1829 + vendor/golang.org/x/sys/unix/sysvshm_linux.go | 21 + vendor/golang.org/x/sys/unix/sysvshm_unix.go | 61 + .../x/sys/unix/sysvshm_unix_other.go | 14 + vendor/golang.org/x/sys/unix/timestruct.go | 29 +- vendor/golang.org/x/sys/unix/xattr_bsd.go | 1 + .../golang.org/x/sys/unix/zerrors_aix_ppc.go | 1 + .../x/sys/unix/zerrors_aix_ppc64.go | 1 + .../x/sys/unix/zerrors_darwin_amd64.go | 3046 +- .../x/sys/unix/zerrors_darwin_arm.go | 1784 - .../x/sys/unix/zerrors_darwin_arm64.go | 3046 +- .../x/sys/unix/zerrors_dragonfly_amd64.go | 139 +- .../x/sys/unix/zerrors_freebsd_386.go | 18 + .../x/sys/unix/zerrors_freebsd_amd64.go | 18 + .../x/sys/unix/zerrors_freebsd_arm.go | 27 + .../x/sys/unix/zerrors_freebsd_arm64.go | 18 + vendor/golang.org/x/sys/unix/zerrors_linux.go | 572 +- .../x/sys/unix/zerrors_linux_386.go | 36 +- .../x/sys/unix/zerrors_linux_amd64.go | 36 +- .../x/sys/unix/zerrors_linux_arm.go | 36 +- .../x/sys/unix/zerrors_linux_arm64.go | 40 +- .../x/sys/unix/zerrors_linux_mips.go | 36 +- .../x/sys/unix/zerrors_linux_mips64.go | 36 +- .../x/sys/unix/zerrors_linux_mips64le.go | 36 +- .../x/sys/unix/zerrors_linux_mipsle.go | 36 +- .../x/sys/unix/zerrors_linux_ppc.go | 881 + .../x/sys/unix/zerrors_linux_ppc64.go | 36 +- .../x/sys/unix/zerrors_linux_ppc64le.go | 36 +- .../x/sys/unix/zerrors_linux_riscv64.go | 36 +- .../x/sys/unix/zerrors_linux_s390x.go | 38 +- .../x/sys/unix/zerrors_linux_sparc64.go | 36 +- .../x/sys/unix/zerrors_netbsd_386.go | 7 + .../x/sys/unix/zerrors_netbsd_amd64.go | 7 + .../x/sys/unix/zerrors_netbsd_arm.go | 7 + .../x/sys/unix/zerrors_netbsd_arm64.go | 7 + .../x/sys/unix/zerrors_openbsd_386.go | 11 + .../x/sys/unix/zerrors_openbsd_amd64.go | 8 + .../x/sys/unix/zerrors_openbsd_arm.go | 11 + .../x/sys/unix/zerrors_openbsd_arm64.go | 8 + ...arwin_386.go => zerrors_openbsd_mips64.go} | 1663 +- .../x/sys/unix/zerrors_solaris_amd64.go | 26 +- .../x/sys/unix/zerrors_zos_s390x.go | 860 + .../x/sys/unix/zptrace_armnn_linux.go | 1 + .../x/sys/unix/zptrace_mipsnn_linux.go | 1 + .../x/sys/unix/zptrace_mipsnnle_linux.go | 1 + .../x/sys/unix/zptrace_x86_linux.go | 1 + .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 1 + .../x/sys/unix/zsyscall_aix_ppc64.go | 1 + .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 4 +- .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 4 +- .../x/sys/unix/zsyscall_darwin_386.1_11.go | 1809 - .../x/sys/unix/zsyscall_darwin_386.1_13.go | 41 - .../x/sys/unix/zsyscall_darwin_386.1_13.s | 12 - .../x/sys/unix/zsyscall_darwin_386.go | 2497 - .../x/sys/unix/zsyscall_darwin_386.s | 284 - .../x/sys/unix/zsyscall_darwin_amd64.1_11.go | 1809 - .../x/sys/unix/zsyscall_darwin_amd64.1_13.go | 11 +- .../x/sys/unix/zsyscall_darwin_amd64.1_13.s | 19 +- .../x/sys/unix/zsyscall_darwin_amd64.go | 885 +- .../x/sys/unix/zsyscall_darwin_amd64.s | 883 +- .../x/sys/unix/zsyscall_darwin_arm.1_11.go | 1782 - .../x/sys/unix/zsyscall_darwin_arm.1_13.go | 41 - .../x/sys/unix/zsyscall_darwin_arm.1_13.s | 12 - .../x/sys/unix/zsyscall_darwin_arm.go | 2482 - .../x/sys/unix/zsyscall_darwin_arm.s | 282 - .../x/sys/unix/zsyscall_darwin_arm64.1_13.go | 11 +- .../x/sys/unix/zsyscall_darwin_arm64.1_13.s | 19 +- .../x/sys/unix/zsyscall_darwin_arm64.go | 870 +- .../x/sys/unix/zsyscall_darwin_arm64.s | 881 +- .../x/sys/unix/zsyscall_dragonfly_amd64.go | 45 +- .../x/sys/unix/zsyscall_freebsd_386.go | 1 + .../x/sys/unix/zsyscall_freebsd_amd64.go | 1 + .../x/sys/unix/zsyscall_freebsd_arm.go | 1 + .../x/sys/unix/zsyscall_freebsd_arm64.go | 1 + .../x/sys/unix/zsyscall_illumos_amd64.go | 43 +- .../golang.org/x/sys/unix/zsyscall_linux.go | 169 +- .../x/sys/unix/zsyscall_linux_386.go | 54 +- .../x/sys/unix/zsyscall_linux_amd64.go | 54 +- .../x/sys/unix/zsyscall_linux_arm.go | 54 +- .../x/sys/unix/zsyscall_linux_arm64.go | 1 + .../x/sys/unix/zsyscall_linux_mips.go | 56 +- .../x/sys/unix/zsyscall_linux_mips64.go | 33 +- .../x/sys/unix/zsyscall_linux_mips64le.go | 33 +- .../x/sys/unix/zsyscall_linux_mipsle.go | 56 +- .../x/sys/unix/zsyscall_linux_ppc.go | 709 + .../x/sys/unix/zsyscall_linux_ppc64.go | 54 +- .../x/sys/unix/zsyscall_linux_ppc64le.go | 54 +- .../x/sys/unix/zsyscall_linux_riscv64.go | 1 + .../x/sys/unix/zsyscall_linux_s390x.go | 44 +- .../x/sys/unix/zsyscall_linux_sparc64.go | 43 +- .../x/sys/unix/zsyscall_netbsd_386.go | 11 + .../x/sys/unix/zsyscall_netbsd_amd64.go | 11 + .../x/sys/unix/zsyscall_netbsd_arm.go | 11 + .../x/sys/unix/zsyscall_netbsd_arm64.go | 11 + .../x/sys/unix/zsyscall_openbsd_386.go | 1 + .../x/sys/unix/zsyscall_openbsd_amd64.go | 1 + .../x/sys/unix/zsyscall_openbsd_arm.go | 1 + .../x/sys/unix/zsyscall_openbsd_arm64.go | 1 + ...m64.1_11.go => zsyscall_openbsd_mips64.go} | 497 +- .../x/sys/unix/zsyscall_solaris_amd64.go | 105 +- .../x/sys/unix/zsyscall_zos_s390x.go | 1255 + .../x/sys/unix/zsysctl_openbsd_386.go | 1 + .../x/sys/unix/zsysctl_openbsd_amd64.go | 1 + .../x/sys/unix/zsysctl_openbsd_arm.go | 1 + .../x/sys/unix/zsysctl_openbsd_arm64.go | 1 + .../x/sys/unix/zsysctl_openbsd_mips64.go | 280 + .../x/sys/unix/zsysnum_darwin_386.go | 436 - .../x/sys/unix/zsysnum_darwin_amd64.go | 2 + .../x/sys/unix/zsysnum_darwin_arm.go | 436 - .../x/sys/unix/zsysnum_darwin_arm64.go | 2 + .../x/sys/unix/zsysnum_dragonfly_amd64.go | 256 +- .../x/sys/unix/zsysnum_freebsd_386.go | 1 + .../x/sys/unix/zsysnum_freebsd_amd64.go | 1 + .../x/sys/unix/zsysnum_freebsd_arm.go | 1 + .../x/sys/unix/zsysnum_freebsd_arm64.go | 1 + .../x/sys/unix/zsysnum_linux_386.go | 11 + .../x/sys/unix/zsysnum_linux_amd64.go | 709 +- .../x/sys/unix/zsysnum_linux_arm.go | 10 + .../x/sys/unix/zsysnum_linux_arm64.go | 599 +- .../x/sys/unix/zsysnum_linux_mips.go | 10 + .../x/sys/unix/zsysnum_linux_mips64.go | 694 +- .../x/sys/unix/zsysnum_linux_mips64le.go | 694 +- .../x/sys/unix/zsysnum_linux_mipsle.go | 10 + .../x/sys/unix/zsysnum_linux_ppc.go | 438 + .../x/sys/unix/zsysnum_linux_ppc64.go | 792 +- .../x/sys/unix/zsysnum_linux_ppc64le.go | 792 +- .../x/sys/unix/zsysnum_linux_riscv64.go | 596 +- .../x/sys/unix/zsysnum_linux_s390x.go | 722 +- .../x/sys/unix/zsysnum_linux_sparc64.go | 750 +- .../x/sys/unix/zsysnum_netbsd_386.go | 1 + .../x/sys/unix/zsysnum_netbsd_amd64.go | 1 + .../x/sys/unix/zsysnum_netbsd_arm.go | 1 + .../x/sys/unix/zsysnum_netbsd_arm64.go | 1 + .../x/sys/unix/zsysnum_openbsd_386.go | 1 + .../x/sys/unix/zsysnum_openbsd_amd64.go | 1 + .../x/sys/unix/zsysnum_openbsd_arm.go | 1 + .../x/sys/unix/zsysnum_openbsd_arm64.go | 1 + .../x/sys/unix/zsysnum_openbsd_mips64.go | 221 + .../x/sys/unix/zsysnum_zos_s390x.go | 2670 + .../golang.org/x/sys/unix/ztypes_aix_ppc.go | 2 + .../golang.org/x/sys/unix/ztypes_aix_ppc64.go | 2 + .../x/sys/unix/ztypes_darwin_386.go | 499 - .../x/sys/unix/ztypes_darwin_amd64.go | 291 +- .../x/sys/unix/ztypes_darwin_arm.go | 500 - .../x/sys/unix/ztypes_darwin_arm64.go | 291 +- .../x/sys/unix/ztypes_dragonfly_amd64.go | 51 +- .../x/sys/unix/ztypes_freebsd_386.go | 18 +- .../x/sys/unix/ztypes_freebsd_amd64.go | 18 +- .../x/sys/unix/ztypes_freebsd_arm.go | 18 +- .../x/sys/unix/ztypes_freebsd_arm64.go | 18 +- .../x/sys/unix/ztypes_illumos_amd64.go | 42 + vendor/golang.org/x/sys/unix/ztypes_linux.go | 2827 +- .../golang.org/x/sys/unix/ztypes_linux_386.go | 79 +- .../x/sys/unix/ztypes_linux_amd64.go | 79 +- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 82 +- .../x/sys/unix/ztypes_linux_arm64.go | 79 +- .../x/sys/unix/ztypes_linux_mips.go | 81 +- .../x/sys/unix/ztypes_linux_mips64.go | 79 +- .../x/sys/unix/ztypes_linux_mips64le.go | 79 +- .../x/sys/unix/ztypes_linux_mipsle.go | 81 +- .../golang.org/x/sys/unix/ztypes_linux_ppc.go | 678 + .../x/sys/unix/ztypes_linux_ppc64.go | 78 +- .../x/sys/unix/ztypes_linux_ppc64le.go | 78 +- .../x/sys/unix/ztypes_linux_riscv64.go | 79 +- .../x/sys/unix/ztypes_linux_s390x.go | 78 +- .../x/sys/unix/ztypes_linux_sparc64.go | 78 +- .../x/sys/unix/ztypes_netbsd_386.go | 6 +- .../x/sys/unix/ztypes_netbsd_amd64.go | 6 +- .../x/sys/unix/ztypes_netbsd_arm.go | 6 +- .../x/sys/unix/ztypes_netbsd_arm64.go | 6 +- .../x/sys/unix/ztypes_openbsd_386.go | 6 +- .../x/sys/unix/ztypes_openbsd_amd64.go | 6 +- .../x/sys/unix/ztypes_openbsd_arm.go | 6 +- .../x/sys/unix/ztypes_openbsd_arm64.go | 6 +- .../x/sys/unix/ztypes_openbsd_mips64.go | 569 + .../x/sys/unix/ztypes_solaris_amd64.go | 73 +- .../golang.org/x/sys/unix/ztypes_zos_s390x.go | 406 + .../golang.org/x/sys/windows/dll_windows.go | 3 +- vendor/golang.org/x/sys/windows/empty.s | 1 + .../golang.org/x/sys/windows/exec_windows.go | 98 + .../x/sys/windows/memory_windows.go | 31 +- vendor/golang.org/x/sys/windows/mkerrors.bash | 7 + .../x/sys/windows/security_windows.go | 44 +- vendor/golang.org/x/sys/windows/service.go | 8 + .../x/sys/windows/setupapierrors_windows.go | 100 + vendor/golang.org/x/sys/windows/syscall.go | 46 +- .../x/sys/windows/syscall_windows.go | 273 +- .../golang.org/x/sys/windows/types_windows.go | 1131 +- .../x/sys/windows/types_windows_386.go | 13 + .../x/sys/windows/types_windows_amd64.go | 12 + .../x/sys/windows/types_windows_arm.go | 13 + .../x/sys/windows/types_windows_arm64.go | 34 + .../x/sys/windows/zerrors_windows.go | 2619 +- .../x/sys/windows/zsyscall_windows.go | 5089 +- .../x/tools/go/gcexportdata/gcexportdata.go | 55 +- .../x/tools/go/internal/gcimporter/bexport.go | 23 +- .../x/tools/go/internal/gcimporter/bimport.go | 52 +- .../go/internal/gcimporter/exportdata.go | 16 +- .../go/internal/gcimporter/gcimporter.go | 22 +- .../x/tools/go/internal/gcimporter/iexport.go | 364 +- .../x/tools/go/internal/gcimporter/iimport.go | 373 +- .../go/internal/gcimporter/newInterface10.go | 1 + .../go/internal/gcimporter/newInterface11.go | 1 + .../go/internal/gcimporter/support_go117.go | 16 + .../go/internal/gcimporter/support_go118.go | 23 + .../tools/go/internal/packagesdriver/sizes.go | 155 +- vendor/golang.org/x/tools/go/packages/doc.go | 3 +- .../x/tools/go/packages/external.go | 9 +- .../golang.org/x/tools/go/packages/golist.go | 1100 +- .../x/tools/go/packages/golist_overlay.go | 444 +- .../x/tools/go/packages/loadmode_string.go | 2 +- .../x/tools/go/packages/packages.go | 149 +- .../golang.org/x/tools/go/packages/visit.go | 4 + .../x/tools/internal/event/core/event.go | 85 + .../x/tools/internal/event/core/export.go | 70 + .../x/tools/internal/event/core/fast.go | 77 + .../internal/event/doc.go} | 10 +- .../x/tools/internal/event/event.go | 127 + .../x/tools/internal/event/keys/keys.go | 564 + .../x/tools/internal/event/keys/standard.go | 22 + .../x/tools/internal/event/label/label.go | 215 + .../x/tools/internal/fastwalk/fastwalk.go | 196 - .../fastwalk/fastwalk_dirent_fileno.go | 13 - .../internal/fastwalk/fastwalk_dirent_ino.go | 14 - .../fastwalk/fastwalk_dirent_namlen_linux.go | 29 - .../internal/fastwalk/fastwalk_portable.go | 37 - .../tools/internal/fastwalk/fastwalk_unix.go | 127 - .../x/tools/internal/gocommand/invoke.go | 273 + .../x/tools/internal/gocommand/vendor.go | 107 + .../x/tools/internal/gocommand/version.go | 51 + .../x/tools/internal/gopathwalk/walk.go | 270 - .../internal/packagesinternal/packages.go | 28 + .../golang.org/x/tools/internal/span/parse.go | 100 - .../golang.org/x/tools/internal/span/span.go | 285 - .../golang.org/x/tools/internal/span/token.go | 179 - .../x/tools/internal/span/token111.go | 39 - .../x/tools/internal/span/token112.go | 16 - .../golang.org/x/tools/internal/span/uri.go | 152 - .../golang.org/x/tools/internal/span/utf16.go | 94 - .../x/tools/internal/typeparams/common.go | 32 + .../internal/typeparams/enabled_go117.go | 12 + .../internal/typeparams/enabled_go118.go | 15 + .../x/tools/internal/typeparams/normalize.go | 216 + .../x/tools/internal/typeparams/termlist.go | 172 + .../internal/typeparams/typeparams_go117.go | 224 + .../internal/typeparams/typeparams_go118.go | 196 + .../x/tools/internal/typeparams/typeterm.go | 170 + .../tools/internal/typesinternal/errorcode.go | 1368 + .../typesinternal/errorcode_string.go | 153 + .../x/tools/internal/typesinternal/types.go | 50 + vendor/golang.org/x/xerrors/LICENSE | 27 + vendor/golang.org/x/xerrors/PATENTS | 22 + vendor/golang.org/x/xerrors/README | 2 + vendor/golang.org/x/xerrors/adaptor.go | 193 + vendor/golang.org/x/xerrors/codereview.cfg | 1 + vendor/golang.org/x/xerrors/doc.go | 22 + vendor/golang.org/x/xerrors/errors.go | 33 + vendor/golang.org/x/xerrors/fmt.go | 187 + vendor/golang.org/x/xerrors/format.go | 34 + vendor/golang.org/x/xerrors/frame.go | 56 + vendor/golang.org/x/xerrors/go.mod | 3 + .../internal/internal.go} | 11 +- vendor/golang.org/x/xerrors/wrap.go | 106 + vendor/gopkg.in/yaml.v2/.travis.yml | 19 +- vendor/gopkg.in/yaml.v2/apic.go | 5 + vendor/gopkg.in/yaml.v2/decode.go | 48 +- vendor/gopkg.in/yaml.v2/encode.go | 28 + vendor/gopkg.in/yaml.v2/go.mod | 8 +- vendor/gopkg.in/yaml.v2/resolve.go | 2 +- vendor/gopkg.in/yaml.v2/scannerc.go | 123 +- vendor/gopkg.in/yaml.v2/yaml.go | 16 +- vendor/gopkg.in/yaml.v2/yamlh.go | 1 + vendor/modules.txt | 73 +- 899 files changed, 227904 insertions(+), 44267 deletions(-) create mode 100644 .teamcity/pom.xml create mode 100644 .teamcity/settings.kts delete mode 100644 .travis.yml create mode 100644 Documentation/api/dap/README.md create mode 100644 Documentation/backend_test_health.md create mode 100644 Documentation/internal/portnotes.md create mode 100644 _fixtures/asmnilptr/main.go create mode 100644 _fixtures/asmnilptr/main_386.s create mode 100644 _fixtures/asmnilptr/main_amd64.s create mode 100644 _fixtures/asmnilptr/main_arm64.s create mode 100644 _fixtures/cat.go create mode 100644 _fixtures/databpcountstest.go create mode 100644 _fixtures/databpeasy.go create mode 100644 _fixtures/databpstack.go create mode 100644 _fixtures/fatalerror.go create mode 100644 _fixtures/genericbp.go create mode 100644 _fixtures/goroutinebreak.go create mode 100644 _fixtures/goroutinegroup.go create mode 100644 _fixtures/issue2162.go create mode 100644 _fixtures/issue2319/README.txt create mode 100644 _fixtures/issue2319/asm-linux-amd64.s create mode 100644 _fixtures/issue2319/cfile-linux-amd64.syso create mode 100644 _fixtures/issue2319/main.go create mode 100644 _fixtures/locationsprog_generic.go create mode 100644 _fixtures/longstrings.go create mode 100644 _fixtures/morestringarg.go create mode 100644 _fixtures/setymmreg/main.go create mode 100644 _fixtures/setymmreg/setymmreg_amd64.s create mode 100644 _fixtures/testtoggle.go create mode 100644 _fixtures/testvariables_generic.go create mode 100644 _scripts/gen-backend_test_health.go create mode 100644 _scripts/latestver.py create mode 100644 _scripts/rtype-out.txt create mode 100644 _scripts/rtype.go create mode 100644 _scripts/staticcheck-out.txt create mode 100755 _scripts/test_linux.sh create mode 100644 _scripts/test_mac.sh create mode 100644 _scripts/test_windows.ps1 create mode 100644 pkg/dwarf/regnum/amd64.go create mode 100644 pkg/dwarf/regnum/arm64.go create mode 100644 pkg/dwarf/regnum/i386.go create mode 100644 pkg/elfwriter/delve_core_notes.go create mode 100644 pkg/elfwriter/writer.go create mode 100644 pkg/proc/amd64util/debugregs.go create mode 100644 pkg/proc/amd64util/xsave.go create mode 100644 pkg/proc/amd64util/xsave_amd64.go create mode 100644 pkg/proc/amd64util/xsave_amd64.s create mode 100644 pkg/proc/amd64util/xsave_other.go create mode 100644 pkg/proc/core/delve_core.go create mode 100644 pkg/proc/dump.go delete mode 100644 pkg/proc/fbsdutil/regs_test.go create mode 100644 pkg/proc/internal/ebpf/bpf/dummy.go create mode 100644 pkg/proc/internal/ebpf/bpf/include/dummy.go create mode 100644 pkg/proc/internal/ebpf/bpf/include/function_vals.bpf.h create mode 100644 pkg/proc/internal/ebpf/bpf/include/trace.bpf.h create mode 100644 pkg/proc/internal/ebpf/bpf/include/vmlinux.h create mode 100644 pkg/proc/internal/ebpf/bpf/trace.bpf.c create mode 100755 pkg/proc/internal/ebpf/build/build-ebpf-builder-img.sh create mode 100755 pkg/proc/internal/ebpf/build/build-ebpf-objects.sh create mode 100644 pkg/proc/internal/ebpf/build/ebpf-Dockerfile create mode 100644 pkg/proc/internal/ebpf/context.go create mode 100644 pkg/proc/internal/ebpf/dummy.go create mode 100644 pkg/proc/internal/ebpf/helpers.go create mode 100644 pkg/proc/internal/ebpf/helpers_disabled.go create mode 100644 pkg/proc/internal/ebpf/trace_bpfel_x86.go create mode 100644 pkg/proc/internal/ebpf/trace_bpfel_x86.o delete mode 100644 pkg/proc/linutil/regs_test.go create mode 100644 pkg/proc/macutil/rosetta_darwin.go create mode 100644 pkg/proc/macutil/rosetta_other.go create mode 100644 pkg/proc/native/dump_linux.go create mode 100644 pkg/proc/native/dump_linux_amd64.go create mode 100644 pkg/proc/native/dump_linux_other.go create mode 100644 pkg/proc/native/dump_other.go create mode 100644 pkg/proc/native/dump_windows_amd64.go create mode 100644 pkg/proc/native/hwbreak_amd64.go create mode 100644 pkg/proc/native/hwbreak_other.go create mode 100644 pkg/proc/native/proc_ebpf_linux.go create mode 100644 pkg/proc/native/proc_no_ebpf_linux.go create mode 100644 pkg/proc/stackwatch.go create mode 100644 pkg/terminal/colorize/colorize.go create mode 100644 pkg/version/buildinfo.go create mode 100644 pkg/version/fixbuild.go create mode 100644 service/api/command.go create mode 100644 service/dap/command.go create mode 100644 service/dap/config.go create mode 100644 service/dap/config_test.go create mode 100644 service/dap/daptest/gen/main.go create mode 100644 service/dap/daptest/resp.go create mode 100644 service/dap/types.go delete mode 100644 service/dap/utils.go create mode 100644 service/internal/sameuser/doc.go create mode 100644 service/internal/sameuser/sameuser.go create mode 100644 service/internal/sameuser/sameuser_linux.go rename service/{rpccommon => internal/sameuser}/sameuser_linux_test.go (64%) delete mode 100644 service/rpccommon/sameuser.go delete mode 100644 service/rpccommon/sameuser_linux.go create mode 100644 vendor/github.com/cilium/ebpf/.clang-format create mode 100644 vendor/github.com/cilium/ebpf/.gitignore create mode 100644 vendor/github.com/cilium/ebpf/.golangci.yaml create mode 100644 vendor/github.com/cilium/ebpf/ARCHITECTURE.md create mode 100644 vendor/github.com/cilium/ebpf/CODE_OF_CONDUCT.md create mode 100644 vendor/github.com/cilium/ebpf/CONTRIBUTING.md create mode 100644 vendor/github.com/cilium/ebpf/LICENSE create mode 100644 vendor/github.com/cilium/ebpf/Makefile create mode 100644 vendor/github.com/cilium/ebpf/README.md create mode 100644 vendor/github.com/cilium/ebpf/asm/alu.go create mode 100644 vendor/github.com/cilium/ebpf/asm/alu_string.go create mode 100644 vendor/github.com/cilium/ebpf/asm/doc.go create mode 100644 vendor/github.com/cilium/ebpf/asm/func.go create mode 100644 vendor/github.com/cilium/ebpf/asm/func_string.go create mode 100644 vendor/github.com/cilium/ebpf/asm/instruction.go create mode 100644 vendor/github.com/cilium/ebpf/asm/jump.go create mode 100644 vendor/github.com/cilium/ebpf/asm/jump_string.go create mode 100644 vendor/github.com/cilium/ebpf/asm/load_store.go create mode 100644 vendor/github.com/cilium/ebpf/asm/load_store_string.go create mode 100644 vendor/github.com/cilium/ebpf/asm/opcode.go create mode 100644 vendor/github.com/cilium/ebpf/asm/opcode_string.go create mode 100644 vendor/github.com/cilium/ebpf/asm/register.go create mode 100644 vendor/github.com/cilium/ebpf/attachtype_string.go create mode 100644 vendor/github.com/cilium/ebpf/collection.go create mode 100644 vendor/github.com/cilium/ebpf/doc.go create mode 100644 vendor/github.com/cilium/ebpf/elf_reader.go create mode 100644 vendor/github.com/cilium/ebpf/elf_reader_fuzz.go create mode 100644 vendor/github.com/cilium/ebpf/go.mod create mode 100644 vendor/github.com/cilium/ebpf/go.sum create mode 100644 vendor/github.com/cilium/ebpf/info.go create mode 100644 vendor/github.com/cilium/ebpf/internal/align.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/btf.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/btf_types.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/btf_types_string.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/core.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/doc.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/ext_info.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/fuzz.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/info.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/strings.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/syscalls.go create mode 100644 vendor/github.com/cilium/ebpf/internal/btf/types.go create mode 100644 vendor/github.com/cilium/ebpf/internal/cpu.go create mode 100644 vendor/github.com/cilium/ebpf/internal/elf.go create mode 100644 vendor/github.com/cilium/ebpf/internal/endian.go create mode 100644 vendor/github.com/cilium/ebpf/internal/errors.go create mode 100644 vendor/github.com/cilium/ebpf/internal/fd.go create mode 100644 vendor/github.com/cilium/ebpf/internal/feature.go create mode 100644 vendor/github.com/cilium/ebpf/internal/io.go create mode 100644 vendor/github.com/cilium/ebpf/internal/pinning.go create mode 100644 vendor/github.com/cilium/ebpf/internal/ptr.go create mode 100644 vendor/github.com/cilium/ebpf/internal/ptr_32_be.go create mode 100644 vendor/github.com/cilium/ebpf/internal/ptr_32_le.go create mode 100644 vendor/github.com/cilium/ebpf/internal/ptr_64.go create mode 100644 vendor/github.com/cilium/ebpf/internal/syscall.go create mode 100644 vendor/github.com/cilium/ebpf/internal/syscall_string.go create mode 100644 vendor/github.com/cilium/ebpf/internal/unix/types_linux.go create mode 100644 vendor/github.com/cilium/ebpf/internal/unix/types_other.go create mode 100644 vendor/github.com/cilium/ebpf/internal/version.go create mode 100644 vendor/github.com/cilium/ebpf/link/cgroup.go create mode 100644 vendor/github.com/cilium/ebpf/link/doc.go create mode 100644 vendor/github.com/cilium/ebpf/link/freplace.go create mode 100644 vendor/github.com/cilium/ebpf/link/iter.go create mode 100644 vendor/github.com/cilium/ebpf/link/kprobe.go create mode 100644 vendor/github.com/cilium/ebpf/link/link.go create mode 100644 vendor/github.com/cilium/ebpf/link/netns.go create mode 100644 vendor/github.com/cilium/ebpf/link/perf_event.go create mode 100644 vendor/github.com/cilium/ebpf/link/platform.go create mode 100644 vendor/github.com/cilium/ebpf/link/program.go create mode 100644 vendor/github.com/cilium/ebpf/link/raw_tracepoint.go create mode 100644 vendor/github.com/cilium/ebpf/link/syscalls.go create mode 100644 vendor/github.com/cilium/ebpf/link/tracepoint.go create mode 100644 vendor/github.com/cilium/ebpf/link/uprobe.go create mode 100644 vendor/github.com/cilium/ebpf/linker.go create mode 100644 vendor/github.com/cilium/ebpf/map.go create mode 100644 vendor/github.com/cilium/ebpf/marshalers.go create mode 100644 vendor/github.com/cilium/ebpf/prog.go create mode 100644 vendor/github.com/cilium/ebpf/ringbuf/doc.go create mode 100644 vendor/github.com/cilium/ebpf/ringbuf/reader.go create mode 100644 vendor/github.com/cilium/ebpf/ringbuf/ring.go create mode 100644 vendor/github.com/cilium/ebpf/run-tests.sh create mode 100644 vendor/github.com/cilium/ebpf/syscalls.go create mode 100644 vendor/github.com/cilium/ebpf/types.go create mode 100644 vendor/github.com/cilium/ebpf/types_string.go delete mode 100644 vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go delete mode 100644 vendor/github.com/cpuguy83/go-md2man/md2man/roff.go rename vendor/github.com/cpuguy83/go-md2man/{ => v2}/LICENSE.md (100%) create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go create mode 100644 vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go create mode 100644 vendor/github.com/derekparker/trie/.deepsource.toml create mode 100644 vendor/github.com/derekparker/trie/.gitignore create mode 100644 vendor/github.com/derekparker/trie/LICENSE create mode 100644 vendor/github.com/derekparker/trie/README.md create mode 100644 vendor/github.com/derekparker/trie/trie.go delete mode 100644 vendor/github.com/google/go-dap/.travis.yml create mode 100644 vendor/github.com/google/go-dap/doc.go create mode 100644 vendor/github.com/mattn/go-runewidth/.travis.yml create mode 100644 vendor/github.com/mattn/go-runewidth/LICENSE create mode 100644 vendor/github.com/mattn/go-runewidth/README.mkd create mode 100644 vendor/github.com/mattn/go-runewidth/runewidth.go create mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_js.go create mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_posix.go create mode 100644 vendor/github.com/mattn/go-runewidth/runewidth_windows.go create mode 100644 vendor/github.com/peterh/liner/go.mod create mode 100644 vendor/github.com/peterh/liner/go.sum delete mode 100644 vendor/github.com/russross/blackfriday/doc.go delete mode 100644 vendor/github.com/russross/blackfriday/go.mod delete mode 100644 vendor/github.com/russross/blackfriday/html.go delete mode 100644 vendor/github.com/russross/blackfriday/latex.go rename vendor/github.com/russross/blackfriday/{ => v2}/.gitignore (100%) rename vendor/github.com/russross/blackfriday/{ => v2}/.travis.yml (90%) rename vendor/github.com/russross/blackfriday/{ => v2}/LICENSE.txt (100%) rename vendor/github.com/russross/blackfriday/{ => v2}/README.md (67%) rename vendor/github.com/russross/blackfriday/{ => v2}/block.go (56%) create mode 100644 vendor/github.com/russross/blackfriday/v2/doc.go create mode 100644 vendor/github.com/russross/blackfriday/v2/esc.go create mode 100644 vendor/github.com/russross/blackfriday/v2/go.mod create mode 100644 vendor/github.com/russross/blackfriday/v2/html.go rename vendor/github.com/russross/blackfriday/{ => v2}/inline.go (63%) rename vendor/github.com/russross/blackfriday/{ => v2}/markdown.go (50%) create mode 100644 vendor/github.com/russross/blackfriday/v2/node.go rename vendor/github.com/russross/blackfriday/{ => v2}/smartypants.go (66%) create mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/.travis.yml create mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/LICENSE create mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/README.md create mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/go.mod create mode 100644 vendor/github.com/shurcooL/sanitized_anchor_name/main.go create mode 100644 vendor/github.com/spf13/cobra/.golangci.yml create mode 100644 vendor/github.com/spf13/cobra/CHANGELOG.md create mode 100644 vendor/github.com/spf13/cobra/CONDUCT.md create mode 100644 vendor/github.com/spf13/cobra/CONTRIBUTING.md create mode 100644 vendor/github.com/spf13/cobra/Makefile create mode 100644 vendor/github.com/spf13/cobra/args.go create mode 100644 vendor/github.com/spf13/cobra/custom_completions.go create mode 100644 vendor/github.com/spf13/cobra/doc/README.md create mode 100644 vendor/github.com/spf13/cobra/doc/rest_docs.go create mode 100644 vendor/github.com/spf13/cobra/doc/rest_docs.md create mode 100644 vendor/github.com/spf13/cobra/fish_completions.go create mode 100644 vendor/github.com/spf13/cobra/fish_completions.md create mode 100644 vendor/github.com/spf13/cobra/go.mod create mode 100644 vendor/github.com/spf13/cobra/go.sum create mode 100644 vendor/github.com/spf13/cobra/powershell_completions.go create mode 100644 vendor/github.com/spf13/cobra/powershell_completions.md create mode 100644 vendor/github.com/spf13/cobra/projects_using_cobra.md create mode 100644 vendor/github.com/spf13/cobra/shell_completions.go create mode 100644 vendor/github.com/spf13/cobra/shell_completions.md create mode 100644 vendor/github.com/spf13/cobra/zsh_completions.go create mode 100644 vendor/github.com/spf13/cobra/zsh_completions.md create mode 100644 vendor/github.com/spf13/pflag/bytes.go create mode 100644 vendor/github.com/spf13/pflag/duration_slice.go create mode 100644 vendor/github.com/spf13/pflag/float32_slice.go create mode 100644 vendor/github.com/spf13/pflag/float64_slice.go create mode 100644 vendor/github.com/spf13/pflag/go.mod create mode 100644 vendor/github.com/spf13/pflag/go.sum create mode 100644 vendor/github.com/spf13/pflag/int16.go create mode 100644 vendor/github.com/spf13/pflag/int32_slice.go create mode 100644 vendor/github.com/spf13/pflag/int64_slice.go create mode 100644 vendor/github.com/spf13/pflag/string_to_int.go create mode 100644 vendor/github.com/spf13/pflag/string_to_int64.go create mode 100644 vendor/github.com/spf13/pflag/string_to_string.go create mode 100644 vendor/golang.org/x/mod/LICENSE create mode 100644 vendor/golang.org/x/mod/PATENTS rename vendor/golang.org/x/{tools/internal => mod}/semver/semver.go (92%) create mode 100644 vendor/golang.org/x/sys/execabs/execabs.go rename vendor/golang.org/x/sys/unix/{asm_freebsd_386.s => asm_bsd_386.s} (70%) rename vendor/golang.org/x/sys/unix/{asm_netbsd_amd64.s => asm_bsd_amd64.s} (71%) rename vendor/golang.org/x/sys/unix/{asm_netbsd_arm.s => asm_bsd_arm.s} (74%) rename vendor/golang.org/x/sys/unix/{asm_darwin_amd64.s => asm_bsd_arm64.s} (73%) delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_darwin_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_arm.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_386.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s delete mode 100644 vendor/golang.org/x/sys/unix/asm_openbsd_arm.s rename vendor/golang.org/x/sys/unix/{asm_openbsd_arm64.s => asm_openbsd_mips64.s} (89%) create mode 100644 vendor/golang.org/x/sys/unix/asm_zos_s390x.s create mode 100644 vendor/golang.org/x/sys/unix/dev_zos.go create mode 100644 vendor/golang.org/x/sys/unix/epoll_zos.go create mode 100644 vendor/golang.org/x/sys/unix/fstatfs_zos.go create mode 100644 vendor/golang.org/x/sys/unix/ifreq_linux.go create mode 100644 vendor/golang.org/x/sys/unix/ioctl_linux.go create mode 100644 vendor/golang.org/x/sys/unix/ioctl_zos.go create mode 100644 vendor/golang.org/x/sys/unix/ptrace_darwin.go create mode 100644 vendor/golang.org/x/sys/unix/ptrace_ios.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_ppc.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_zos_s390x.go create mode 100644 vendor/golang.org/x/sys/unix/sysvshm_linux.go create mode 100644 vendor/golang.org/x/sys/unix/sysvshm_unix.go create mode 100644 vendor/golang.org/x/sys/unix/sysvshm_unix_other.go delete mode 100644 vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go create mode 100644 vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go rename vendor/golang.org/x/sys/unix/{zerrors_darwin_386.go => zerrors_openbsd_mips64.go} (52%) create mode 100644 vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go delete mode 100644 vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s create mode 100644 vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go rename vendor/golang.org/x/sys/unix/{zsyscall_darwin_arm64.1_11.go => zsyscall_openbsd_mips64.go} (86%) create mode 100644 vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go create mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go create mode 100644 vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go create mode 100644 vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go create mode 100644 vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_386.go delete mode 100644 vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go create mode 100644 vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go create mode 100644 vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go create mode 100644 vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go create mode 100644 vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go create mode 100644 vendor/golang.org/x/sys/windows/setupapierrors_windows.go create mode 100644 vendor/golang.org/x/sys/windows/types_windows_arm64.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/event.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/export.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/fast.go rename vendor/golang.org/x/{sys/unix/syscall_darwin_arm.1_11.go => tools/internal/event/doc.go} (53%) create mode 100644 vendor/golang.org/x/tools/internal/event/event.go create mode 100644 vendor/golang.org/x/tools/internal/event/keys/keys.go create mode 100644 vendor/golang.org/x/tools/internal/event/keys/standard.go create mode 100644 vendor/golang.org/x/tools/internal/event/label/label.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go delete mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/invoke.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/vendor.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/version.go delete mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk.go create mode 100644 vendor/golang.org/x/tools/internal/packagesinternal/packages.go delete mode 100644 vendor/golang.org/x/tools/internal/span/parse.go delete mode 100644 vendor/golang.org/x/tools/internal/span/span.go delete mode 100644 vendor/golang.org/x/tools/internal/span/token.go delete mode 100644 vendor/golang.org/x/tools/internal/span/token111.go delete mode 100644 vendor/golang.org/x/tools/internal/span/token112.go delete mode 100644 vendor/golang.org/x/tools/internal/span/uri.go delete mode 100644 vendor/golang.org/x/tools/internal/span/utf16.go create mode 100644 vendor/golang.org/x/tools/internal/typeparams/common.go create mode 100644 vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go create mode 100644 vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go create mode 100644 vendor/golang.org/x/tools/internal/typeparams/normalize.go create mode 100644 vendor/golang.org/x/tools/internal/typeparams/termlist.go create mode 100644 vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go create mode 100644 vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go create mode 100644 vendor/golang.org/x/tools/internal/typeparams/typeterm.go create mode 100644 vendor/golang.org/x/tools/internal/typesinternal/errorcode.go create mode 100644 vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go create mode 100644 vendor/golang.org/x/tools/internal/typesinternal/types.go create mode 100644 vendor/golang.org/x/xerrors/LICENSE create mode 100644 vendor/golang.org/x/xerrors/PATENTS create mode 100644 vendor/golang.org/x/xerrors/README create mode 100644 vendor/golang.org/x/xerrors/adaptor.go create mode 100644 vendor/golang.org/x/xerrors/codereview.cfg create mode 100644 vendor/golang.org/x/xerrors/doc.go create mode 100644 vendor/golang.org/x/xerrors/errors.go create mode 100644 vendor/golang.org/x/xerrors/fmt.go create mode 100644 vendor/golang.org/x/xerrors/format.go create mode 100644 vendor/golang.org/x/xerrors/frame.go create mode 100644 vendor/golang.org/x/xerrors/go.mod rename vendor/golang.org/x/{tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go => xerrors/internal/internal.go} (50%) create mode 100644 vendor/golang.org/x/xerrors/wrap.go diff --git a/.deepsource.toml b/.deepsource.toml index 6889372df3..5f2b68ef2a 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -2,7 +2,7 @@ version = 1 test_patterns = ["**/*_test.go"] -exclude_patterns = ["vendor", "_fixtures", "_scripts"] +exclude_patterns = ["vendor/**", "_fixtures/**", "_scripts/**"] [[analyzers]] name = "go" diff --git a/.gitignore b/.gitignore index 82378981cd..adbd0ac955 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,11 @@ .tags* tags .dbg_history -cmd/dlv/dlv +**/**/dlv .vagrant **/*.swp localtests +.idea +*.iml +.teamcity/target +.vscode diff --git a/.teamcity/pom.xml b/.teamcity/pom.xml new file mode 100644 index 0000000000..1292800ac5 --- /dev/null +++ b/.teamcity/pom.xml @@ -0,0 +1,104 @@ + + + 4.0.0 + Delve Config DSL Script + Delve + Delve_dsl + 1.0-SNAPSHOT + + + org.jetbrains.teamcity + configs-dsl-kotlin-parent + 1.0-SNAPSHOT + + + + + jetbrains-all + https://download.jetbrains.com/teamcity-repository + + true + + + + teamcity-server + https://delve.beta.teamcity.com/app/dsl-plugins-repository + + true + + + + + + + JetBrains + https://download.jetbrains.com/teamcity-repository + + + + + ${basedir} + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + org.jetbrains.teamcity + teamcity-configs-maven-plugin + ${teamcity.dsl.version} + + kotlin + target/generated-configs + + + + + + + + org.jetbrains.teamcity + configs-dsl-kotlin + ${teamcity.dsl.version} + compile + + + org.jetbrains.teamcity + configs-dsl-kotlin-plugins + 1.0-SNAPSHOT + pom + compile + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + compile + + + org.jetbrains.kotlin + kotlin-script-runtime + ${kotlin.version} + compile + + + \ No newline at end of file diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts new file mode 100644 index 0000000000..e157212daf --- /dev/null +++ b/.teamcity/settings.kts @@ -0,0 +1,249 @@ +import jetbrains.buildServer.configs.kotlin.v2019_2.* +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.PullRequests +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.commitStatusPublisher +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.golang +import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.pullRequests +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.dockerCommand +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.exec +import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.powerShell +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.BuildFailureOnMetric +import jetbrains.buildServer.configs.kotlin.v2019_2.failureConditions.failOnMetricChange +import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs + +/* +The settings script is an entry point for defining a TeamCity +project hierarchy. The script should contain a single call to the +project() function with a Project instance or an init function as +an argument. + +VcsRoots, BuildTypes, Templates, and subprojects can be +registered inside the project using the vcsRoot(), buildType(), +template(), and subProject() methods respectively. + +To debug settings scripts in command-line, run the + + mvnDebug org.jetbrains.teamcity:teamcity-configs-maven-plugin:generate + +command and attach your debugger to the port 8000. + +To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View +-> Tool Windows -> Maven Projects), find the generate task node +(Plugins -> teamcity-configs -> teamcity-configs:generate), the +'Debug' option is available in the context menu for the task. +*/ + +version = "2020.2" + +val targets = arrayOf( + "linux/amd64/1.16", + "linux/amd64/1.17", + "linux/amd64/1.18", + "linux/amd64/tip", + + "linux/386/1.18", + + "linux/arm64/1.18", + "linux/arm64/tip", + + "windows/amd64/1.18", + "windows/amd64/tip", + + "mac/amd64/1.18", + "mac/amd64/tip", + + "mac/arm64/1.18", + "mac/arm64/tip" +) + +project { + val tests = targets.map { target -> + val (os, arch, version) = target.split("/") + TestBuild(os, arch, version, AbsoluteId("Delve_${os}_${arch}_${version.replace('.', '_')}")) + } + tests.map { test -> + test.os + }.distinct().forEach { os -> + subProject(OSProject(os, tests.filter { test -> + test.os == os + })) + } + buildType(AggregatorBuild(tests)) + params { + param("teamcity.ui.settings.readOnly", "true") + } +} + +class AggregatorBuild(tests: Collection) : BuildType({ + name = "Aggregator" + type = Type.COMPOSITE + + vcs { + root(DslContext.settingsRoot) + } + + triggers { + vcs { + } + } + + dependencies { + tests.forEach { test -> + snapshot(test) { + } + } + } + + features { + pullRequests { + vcsRootExtId = "${DslContext.settingsRoot.id}" + provider = github { + authType = token { + token = "credentialsJSON:1312c856-0e13-4b04-8c40-ac26d4a5f700" + } + filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY + } + } + commitStatusPublisher { + vcsRootExtId = "${DslContext.settingsRoot.id}" + publisher = github { + githubUrl = "https://api.github.com" + authType = personalToken { + token = "credentialsJSON:1312c856-0e13-4b04-8c40-ac26d4a5f700" + } + } + param("github_oauth_user", "") + } + } + + failureConditions { + executionTimeoutMin = 60 + } +}) + +class OSProject(os: String, tests: List) : Project({ + id = AbsoluteId("Delve_$os") + name = os.capitalize() + + tests.map { test -> + test.arch + }.distinct().forEach { arch -> + subProject(ArchProject(os, arch, tests.filter { test -> + test.arch == arch + })) + } +}) + +class ArchProject(os: String, arch: String, tests: List) : Project({ + id = AbsoluteId("Delve_${os}_${arch}") + name = arch + + tests.forEach { test -> + buildType(test) + } +}) + +class TestBuild(val os: String, val arch: String, version: String, buildId: AbsoluteId) : BuildType({ + id = buildId + name = version + + vcs { + root(DslContext.settingsRoot) + } + + failureConditions { + executionTimeoutMin = 30 + + if (version != "tip") { + failOnMetricChange { + metric = BuildFailureOnMetric.MetricType.TEST_COUNT + units = BuildFailureOnMetric.MetricUnit.DEFAULT_UNIT + comparison = BuildFailureOnMetric.MetricComparison.LESS + compareTo = value() + } + } + } + + steps { + when (os) { + "linux" -> { + val dockerArch = when (arch) { + "386" -> "i386" + "arm64" -> "arm64v8" + else -> { + arch + } + } + dockerCommand { + name = "Pull Ubuntu" + commandType = other { + subCommand = "pull" + commandArgs = "$dockerArch/ubuntu:20.04" + } + } + dockerCommand { + name = "Test" + commandType = other { + subCommand = "run" + commandArgs = """ + -v %teamcity.build.checkoutDir%:/delve + --env TEAMCITY_VERSION=${'$'}TEAMCITY_VERSION + --env CI=true + --privileged + $dockerArch/ubuntu:20.04 + /delve/_scripts/test_linux.sh ${"go$version"} $arch + """.trimIndent() + } + } + } + "windows" -> { + powerShell { + name = "Test" + scriptMode = file { + path = "_scripts/test_windows.ps1" + } + param("jetbrains_powershell_scriptArguments", "-version ${"go$version"} -arch $arch") + } + } + "mac" -> { + exec { + name = "Test" + path = "_scripts/test_mac.sh" + arguments = "${"go$version"} $arch %system.teamcity.build.tempDir%" + } + } + } + } + + requirements { + when (arch) { + "386", "amd64" -> equals("teamcity.agent.jvm.os.arch", if (os == "mac") "x86_64" else "amd64") + "arm64" -> equals("teamcity.agent.jvm.os.arch", "aarch64") + } + when (os) { + "linux" -> { + matches("teamcity.agent.jvm.os.family", "Linux") + } + "windows" -> { + matches("teamcity.agent.jvm.os.family", "Windows") + } + "mac" -> { + matches("teamcity.agent.jvm.os.family", "Mac OS") + } + } + } + + features { + pullRequests { + vcsRootExtId = "${DslContext.settingsRoot.id}" + provider = github { + authType = token { + token = "credentialsJSON:1312c856-0e13-4b04-8c40-ac26d4a5f700" + } + filterAuthorRole = PullRequests.GitHubRoleFilter.EVERYBODY + } + } + golang { + testFormat = "json" + } + } +}) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 496044c8a7..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,82 +0,0 @@ -language: go -sudo: required -go_import_path: github.com/go-delve/delve - -os: - - linux - - osx - - windows - -arch: - - amd64 - - arm64 - -go: - - 1.15.x - - 1.14.x - - 1.13.x - - tip - -matrix: - allow_failures: - - go: tip - exclude: - - os: osx - arch: arm64 - - os: windows - arch: arm64 - - os: windows - go: 1.14.x - - os: windows - go: 1.13.x - - os: osx - go: 1.14.x - - os: osx - go: 1.13.x - - arch: arm64 - go: 1.14.x - - arch: arm64 - go: 1.13.x - - os: windows - go: tip - - arch: arm64 - go: tip - -before_install: - - export GOFLAGS=-mod=vendor - - if [ $TRAVIS_OS_NAME = "linux" ]; then sudo apt-get -qq update; sudo apt-get install -y dwz; echo "dwz version $(dwz --version)"; fi - - if [ $TRAVIS_OS_NAME = "windows" ]; then choco install procdump make; fi - - -# 386 linux -jobs: - include: - - os: linux - services: docker - env: go_32_version=1.14 # Linux/i386 tests held back to Go1.14 until issue #2134 is fixed - -script: >- - if [ $TRAVIS_OS_NAME = "linux" ] && [ $go_32_version ]; then - docker pull i386/centos:7; - docker run \ - -v $(pwd):/delve \ - --env TRAVIS=true \ - --env CI=true \ - --privileged i386/centos:7 \ - /bin/bash -c "set -x && \ - cd delve && \ - yum -y update && yum -y upgrade && \ - yum -y install wget make git gcc && \ - wget -q https://dl.google.com/go/go${go_32_version}.linux-386.tar.gz && \ - tar -C /usr/local -xzf go${go_32_version}.linux-386.tar.gz && \ - export PATH=$PATH:/usr/local/go/bin && \ - go version && \ - uname -a && \ - make test"; - else - make test; - fi - -cache: - directories: - - $HOME/AppData/Local/Temp/chocolatey diff --git a/CHANGELOG.md b/CHANGELOG.md index bad1eb716a..7a0212f326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,263 @@ + # Changelog All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning. +## [1.8.0] 2021-12-23 + +### Added + +* Go 1.18 support +* Support for DWARF5 on Windows/MacOS (@aarzilli) +* Added more installation instructions to documentation (@polinasok) +* Allow for rewind to work after process exit with RR backend (@aarzilli) +* Added documentation on runtime.curg and runtime.frameoff in eval (@aarzilli) +* DAP: Expose sources command in evaluate request (@suzmue) +* DAP: Support Goroutine filters (@suzmue) + +### Fixed + +* Fix build version using buildinfo (@aarzilli) +* Fix crash when using deferred with no args (@kaddy-tom) +* DAP: Misc remote attach improvements (@polinasok) + +### Changed + +* Misc cleanup and refactoring (@aarzilli) +* Added option to disable invoking git during build (@herbygillot) +* Ignore 'pf' mappings during core dump creation (@aarzilli) + +## [1.7.3] 2021-11-16 + +### Added + +* Misc changes to prepare for Go 1.18 and generics (#2703, @2745, @aarzilli) +* Watchpoint support (disabled on Windows) (#2651, #2659, #2667, #2769, @aarzilli) +* Warn about listening to remote connections (#2721, @aarzilli) +* Support call injection with rr backend (#2740, @aarzilli) +* Support JSON-RPC and DAP on the same port from 'dlv debug/exec/test/attach' (#2755, @polinasok) +* DAP: Remote attach support (#2709, @polinasok) +* DAP: Multi-client support (#2731, #2737, #2781, @polinasok) +* DAP: Logpoints support (#2634, #2730, #2747, #2748, @suzmue) +* DAP: Dissasembly view support (#2713, #2716, #2728, #2742, @suzmue) +* DAP: Support dlvCwd and use a temp file as default debug binary (#2660, #2734, @hyangah, @polinasok) +* DAP: Auto-resume execution when setting breakpoints while running (#2726, @suzmue) +* DAP: Add --client-addr flag to run dap with a predefined client (#2568, @hyangah) +* DAP: Log parsed and applied launch configs (#2732, @polinasok) +* DAP: Add option to hide system goroutines (#2743, @suzmue) +* DAP: Add support for special 'config' expressions (#2750, @suzmue) + +### Fixed + +* Return correct exit status from Halt command (#2674, @suzmue) +* Merge register data before writing to register (#2699, @mknyszek) +* Do not assign temp breakpoint IDs to avoid conflicts with user breakpoints (#2650, @aarzilli) +* Miscellaneous fixes for Windows native backend (#2736, @aarzilli) +* Return error when assigning between function variables (#2692, @aarzilli) +* Obey logflags config for LoadConfig warnings (#2701, @aarzilli, @suzmue) +* Workaround for debugserver register set bug (#2770, @aarzilli) +* DAP: Fix nil dereference when byte array cannot be converted to string (#2733, @polinasok) +* DAP: Fix data race for noDebugProcess.ProcessState (#2735, @polinasok) + +### Changed + +* Refine handling of version-too-old errors (#2684, #2712, @polinasok, @yang-wei) +* eBPF tracing backend return value parsing (#2704, @derekparker) +* Replace libbpfgo with cilium/ebpf (##2771, @derekparker) +* DAP: Merge Arguments and Locals scopes (#2717, @suzmue) +* DAP: Refine launch/attach error visibility (#2671, @polinasok) +* DAP: Server refactoring to separate listener and client session layers (#2729, @polinasok) +* DAP: Improve shutdown logic and test coverage (#2749, @polinasok) + +## [1.7.2] 2021-09-21 + +### Added + +* Documentation: Add notes on porting Delve to other architectures (@aarzilli) +* Add internal checks to ensure we're synched with Go runtime internals (@aarzilli) +* eBPF backend can parse goroutine info (@derekparker) +* Add support for debuginfo-find (@derekparker) +* Add MAKE arguments for GOOS / GOARCH (@cmol) + +### Fixed + +* Correctly check for 1.17 and regabi (@aarzilli) +* Print config output strings quouted (@aarzilli, @krobelus) +* Update check for system goroutines (@suzmue) +* DAP: Halt before detach in Stop (@polinasok) +* DAP: Do not send halt request if debuggee is not running (@suzmue) + +### Changed + +* Include selected goroutine in threads request (@suzmue) +* Remove individual OS install instructions (@gabriel-vasile) +* DAP: Show decimal / hex values for uint (@suzmue) +* Avoid bright colors in default syntax highlighting (@krobelus) + +## [1.7.1] 2021-08-18 + +### Added + +- *EXPERIMENTAL* Added support for eBPF based trace backend (@derekparker) +- Added fuzzy completion for the CLI for commands and breakpoint locations (@derekparker) +- Added stack watchpoints (@aarzilli) +- Added verbose version output (@hyangah) +- DAP: Support for replay and core modes (@Iggomez) +- DAP: Added ability to page stack frames (@suzmue) +- DAP: Added len as metadata for maps (@suzmue) +- DAP: Add 'backend' launch/attach attribute (@polinasok) + +### Fixed + +- Fix handling of runtime throws (@derekparker) +- DAP: Handle unexpected debugger termination (@polinasok) + +### Changed + +- Added configuration for Target to not clear stepping breakpoints (@suzmue) +- Ignore existing breakpoints for continue-until (@derekparker) +- Improve help output for examinemem (@derekparker) +- Clarify next-while-nexting error (@suzmue) +- DWARF improvements for additional opcodes (@aarzilli) +- Treat SIGTERM as server disconnect signal (@polinasok) +- Update Cobra lib to v1.1.3 (@hyangah) +- Improvements to 'on' command (@aarzilli) +- Terminal will now prompt when breakpoint is hit during next/step/stepout (@aarzilli) +- DAP: Ensure server is always headless and target foregrounded (@polinasok) +- DAP: Set hit breakpoint IDs (@suzmue) + +## [1.7.0] 2021-07-19 + +### Added + +- Go 1.17 support (@aarzilli, @mknyszek) +- Add new API and terminal command for setting watchpoints (@aarzilli) +- Add filtering and grouping to goroutines command (@aarzilli) +- Added support for hit count condition on breakpoints (@suzmue, @aarzilli) +- DAP server: Handle SetVariable requests (@hyangah) +- DAP server: Add clipboard support (@hyangah) + +### Fixed + +- DAP server: Several shutdown / disconnect fixes (@suzmue, @polinasok) +- DAP server: Clean output executable name on Windows (@hyangah) +- DAP server: Variables response must not have null variables array (@polinasok) +- Fix runtimeTypeToDIE setup (necessary for Go 1.17) (@aarzilli) +- Reenable CGO stacktrace test on arm64 (@derekparker) +- Fix incorrect integer casts in freebsd C backend (@dwagin) +- Ensure correct exit status reported on commands following process death (@derekparker) +- Misc flakey test fixes / test refactoring (@polinasok) +- Fix for frame parameter being ignored in ConvertEvalScope when no goroutine is found (@suzmue) +- Ensure ContinueOnce returns StopExited if process exited, otherwise return StopUnknown (@polinasok) +- Fix panic in RPC2.ListDynamicLibraries (@derekparker) +- Fix typo in flag passed to check if debugserver supports unmask_signals (@staugust) + +### Changed + +- DAP server: Add sameuser security check (@hyangah) +- DAP server: Changes to context-dependent load limits for string type (@hyangah, @polinasok) +- DAP server: Add paging for arrays, slices and maps (@suzmue) +- DAP server: Deemphasize internal runtime stack frames (@suzmue) +- DAP server: Add throw reason to exception information upon panic (@suzmue) +- DAP server: Set breakpoint hit ID (@suzmue) +- DAP server: Add string value of byte/rune slice as child (@suzmue) +- Documentation: Add viminspector to list of editor plugins (@aarzilli) +- Support for ZMM registers in gdbserial backend (@aarzilli) +- Remove support for stack barriers (@derekparker) +- Improve support for DWARF5 (@derekparker) +- Improve documentation (@derekparker, @aarzilli) +- Print message and exit if Delve detects it is running under Rosetta on M1 macs (@aarzilli) +- Drop official Go 1.14 support (@derekparker) + +## [1.6.1] 2021-05-18 + +### Added + +- Dump command: generate core dumps from within Delve (@aarzilli) +- Toggle command: toggle breakpoints on or off (@alexsaezm) +- DAP server improvements (@polinasok, @hyangah, @suzmue) +- Delve now parses and uses the .eh_frame section when available (@aarzilli) +- Add linespec argument to 'continue' command (@icholy) +- Add optional format argument to 'print' and 'display' commands (@aarzilli) + +### Fixed + +- Fixed file reference handling with DWARF5 compilation units (@thanm) +- Fix embedded field searching (@aarzilli) +- Fix off by one error reading core files (@aarzilli) +- Correctly read G address on linux/arm64 +- Avoid double removal of temp built binary (@polinasok) +- Fix temp binary deletion race in DAP server (@polinasok) +- Fix shutdown related bugs in RPC server (@aarzilli) +- Fix crashes induced by RequestManualStop (@aarzilli) +- Fix handling of DW_OP_piece (@aarzilli) +- Correctly truncate the result of binary operations on integers (@aarzilli) + +### Changed + +- Dropped Go 1.13 support (@aarzilli) +- Improved documentation (@ChrisHines, @aarzilli, @becheran, @hedenface, @andreimatei, @ehershey , @hyangah) +- Allow examinememory to use an expression (@felixge) +- Improve gdb server check on newer ARM based macs (@oxisto) +- CPU registers can now be used in expressions (@aarzilli) +- DAP: Add type information to variables (@suzmue) +- DAP: Support setting breakpoints while target is running (@polinasok) +- DAP: Implement function breakpoints (@suzmue) + +## [1.6.0] 2021-01-28 + +### Added + +- Support for debugging darwin/arm64 (i.e. macOS on Apple Silicon) (#2285, @oxisto) +- Support for debugging Go1.16 (#2214, @aarzilli) +- DAP: support for attaching to a local process (#2260, @polinasok) +- DAP: fill the `evaluateName` field when returning variables, enabling "Add to Watch" and "Copy as Expression" features of VSCode (#2292, @polinasok) +- Added WaitSince, WaitReason to `service/api.Goroutine` and to the `goroutines` command (#2264, #2283, #2270, @dlsniper, @nd, @aarzilli) +- Syntax highlighting for Go code (#2294, @aarzilli) +- Added flag `CallReturn` to `service/api.Thread` to distinguish return values filled by a `stepOut` command from the ones filled by a `call` command (#2230, @aarzilli) + +### Fixed + +- Fix occasional "Access is denied" error when debugging on Windows (#2281, @nd) +- Register formatting on ARM64 (#2289, @dujinze) +- Miscellaneous bug fixes (#2232, #2255, #2280, #2286, #2291, #2309, #2293, @aarzilli, @polinasok, @hitzhangjie) + +### Changed + +- The `goroutines` command can be interrupted by pressing Ctrl-C (#2278, @aarzilli) +- Using a TeamCity instance provided by JetBrains for Continuous Integration (#2298, #2307, #2311, #2315, #2326, @artspb, @nd, @aarzilli, @derekparker) +- Improvements to documentation and error messages (#2266, #2265, #2273, #2299, @andreimatei, @hitzhangjie, @zamai, @polinasok) + +## [1.5.1] 2020-12-09 + +### Added +- DAP: Scope and variable requests, including call injection (#2111, #2158, #2160, #2184, #2185, @polinasok) +- DAP: Support removing breakpoints and breakpoint conditions (#2188, @polinasok) +- DAP: Support next, stepIn, stepOut requests (#2143, @polinasok) +- DAP: Miscellaneous improvements (#2167, #2186, #2238, #2233, #2248, @eliben, @suzmue, @polinasok) +- Command line flag `-r` to redirect standard file descriptors of the target process (#2146, #2222, @aarzilli) +- `-size` flag for `examinemem` command (##2147, @hitzhangjie) +- Command line flag to disable ASLR (#2202, @aarzilli) +- Support for DWARFv5 loclists (#2097, @aarzilli) + +### Fixed +- Support for Go version >= 1.15.4 (#2235, @aarzilli) +- Fix displaying AVX registers (#2139, @aarzilli) +- Panic during `next`, `step` when there is no current goroutine (#2164, @chainhelen) +- Reading a deferred call's arguments on linux/arm64 (#2210, @aarzilli) +- Miscellaneous bug fixes (#2135, #2131, #2142, #2140, #2127, #2113, #2172, #2181, #2195, #2193, #2220, #2179, #2206, #2223, @aarzilli) + +### Changed +- `dlv test` switches to the package directory like `go test` does (#2128, @aarzilli) +- Delve will no longer resolve symbolic links when searching for split debug_info if the executable path is not /proc/pid/exe (#2170, @aarzilli) +- Starlark scripts can now be interrupted using Ctrl-C even if they are not making any API calls (#2149, @aarzilli) +- An error message will be displayed more prominently if a connection is rejected due to the `--only-same-user` flag (which is enabled by default) (#2211, @aarzilli) +- Substitute path rules are applied to the argument of `break` and `trace` (#2213, @aarzilli) +- The output of `xcode-select --print-path` will be used to determine the location of `debugserver` instead of a hardcoded path (#2229, @aaronsky) +- Improvements to documentation and error messages (#2148, #2154, #2196, #2228, @aurkenb, @pohzipohzi, @chainhelen, @andreimatei) + + ## [1.5.0] 2020-07-29 ### Added diff --git a/Documentation/EditorIntegration.md b/Documentation/EditorIntegration.md index 3bfc030866..732e6ad298 100644 --- a/Documentation/EditorIntegration.md +++ b/Documentation/EditorIntegration.md @@ -22,9 +22,10 @@ The following editor plugins for delve are available: * [vim-go](https://github.com/fatih/vim-go) (both Vim and Neovim) * [vim-delve](https://github.com/sebdah/vim-delve) (both Vim and Neovim) * [vim-godebug](https://github.com/jodosha/vim-godebug) (only Neovim) +* [vimspector](https://github.com/puremourning/vimspector/) **VisualStudio Code** -* [Go for Visual Studio Code](https://github.com/Microsoft/vscode-go) +* [Go for Visual Studio Code](https://github.com/golang/vscode-go) **Sublime** * [Go Debugger for Sublime](https://github.com/dishmaev/GoDebug) diff --git a/Documentation/KnownBugs.md b/Documentation/KnownBugs.md index 9aa24cbbfd..3b0545dbdc 100644 --- a/Documentation/KnownBugs.md +++ b/Documentation/KnownBugs.md @@ -1,6 +1,5 @@ # Known Bugs -- Delve does not currently support 32bit systems. This will usually manifest as a compiler error in `proc/disasm.go`. See [Issue #20](https://github.com/go-delve/delve/issues/20). - When Delve is compiled with versions of go prior to 1.7.0 it is not possible to set a breakpoint on a function in a remote package using the `Receiver.MethodName` syntax. See [Issue #528](https://github.com/go-delve/delve/issues/528). - When running Delve on binaries compiled with a version of go prior to 1.9.0 `locals` will print all local variables, including ones that are out of scope, the shadowed flag will be applied arbitrarily. If there are multiple variables defined with the same name in the current function `print` will not be able to select the correct one for the current line. - `reverse step` will not reverse step into functions called by deferred calls. diff --git a/Documentation/api/ClientHowto.md b/Documentation/api/ClientHowto.md index dc58a8f334..34807c13d5 100644 --- a/Documentation/api/ClientHowto.md +++ b/Documentation/api/ClientHowto.md @@ -33,7 +33,7 @@ This will, however, cause problems if you actually spawn multiple instances of t It's probably better to let Delve pick a random unused port number on its own. To do this do not specify any `--listen` option and read one line of output from dlv's stdout. If the first line emitted by dlv starts with "API server listening at: " then dlv started correctly and the rest of the line specifies the address that Delve is listening at. -The `--log-to-file` and `--log-to-fd` options can be used to redirect the "API server listening at:" message to a file or to a file descriptor. If neither is specified the message will be output to stdout. +The `--log-dest` option can be used to redirect the "API server listening at:" message to a file or to a file descriptor. If the flag is not specified, the message will be output to stdout while other log messages are output to stderr. ## Controlling the backend diff --git a/Documentation/api/README.md b/Documentation/api/README.md index 916b7390ee..c98e3c78a0 100644 --- a/Documentation/api/README.md +++ b/Documentation/api/README.md @@ -1,20 +1,20 @@ -# API Documentation +# Server/Client API Documentation -Delve exposes an API interface so that other programs, mostly IDEs and editors, can interact with Delve programmatically. The API is used by the terminal client, so will always stay up to date in lockstep regardless of new features. +Delve exposes two API interfaces, JSON-RPC and DAP, so that frontends other than the built-in [terminal client](../cli/README.md), such as [IDEs and editors](../EditorIntegration.md), can interact with Delve programmatically. The [JSON-RPC API](json-rpc/README.md) is used by the [terminal client](../cli/README.md), and will always stay up to date in lockstep regardless of new features. The [DAP API](dap/README.md) is a popular generic API already in use by many [tools](https://microsoft.github.io/debug-adapter-protocol/implementors/tools/). ## Usage In order to run Delve in "API mode", simply invoke with one of the standard commands, providing the `--headless` flag, like so: ``` -$ dlv debug --headless --api-version=2 --log --listen=127.0.0.1:8181 +$ dlv debug --headless --api-version=2 --log --log-output=debugger,dap,rpc --listen=127.0.0.1:8181 ``` -This will start the debugger in a non-interactive mode, listening on the specified address, and will enable logging. The last two flags are optional, of course. +This will start the debugger in a non-interactive mode, listening on the specified address, and will enable logging. The logging flags as well as the server address are optional, of course. -Optionally, you may also specify the `--accept-multiclient` flag if you would like to connect multiple clients to the API. +Optionally, you may also specify the `--accept-multiclient` flag if you would like to connect multiple JSON-RPC or DAP clients to the API. -You can connect the headless debugger from Delve itself using the `connect` subcommand: +You can connect to the headless debugger from Delve itself using the `connect` subcommand: ``` $ dlv connect 127.0.0.1:8181 @@ -29,3 +29,4 @@ Delve has been architected in such a way as to allow multiple client/server impl ### Current API Interfaces - [JSON-RPC](json-rpc/README.md) +- [DAP](dap/README.md) diff --git a/Documentation/api/dap/README.md b/Documentation/api/dap/README.md new file mode 100644 index 0000000000..a03b5955f6 --- /dev/null +++ b/Documentation/api/dap/README.md @@ -0,0 +1,116 @@ +# DAP Interface + +Delve exposes a [DAP](https://microsoft.github.io/debug-adapter-protocol/overview) API interface. + +This interface is served over a streaming TCP socket using `dlv` server in one of the two headless modes: +* `dlv dap` - starts a single-use DAP-only server that waits for a client to specify launch/attach configuration for starting the debug session. +* `dlv --headless ` - starts a general server, enters a debug session for the specified debuggee and waits for a [JSON-RPC](../json-rpc/README.md) or a [DAP](https://microsoft.github.io/debug-adapter-protocol/overview) client to begin interactive debugging. Can be used in multi-client mode with the following options: + * `--accept-multiclient` - use to support connections from multiple clients + * `--continue` - use to resume debuggee execution as soon as server session starts + +The primary user of this mode is [VS Code Go](https://github.com/golang/vscode-go). Please see its +detailed [debugging documentation](https://github.com/golang/vscode-go/blob/master/docs/debugging.md) for additional information. + +## Debug Adapter Protocol + +[DAP](https://microsoft.github.io/debug-adapter-protocol/specification) is a general debugging protocol supported by many [tools](https://microsoft.github.io/debug-adapter-protocol/implementors/tools/) and [programming languages](https://microsoft.github.io/debug-adapter-protocol/implementors/adapters/). We tailored it to Go specifics, such as mapping [threads request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Threads) to communicate goroutines and [exceptionInfo request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_ExceptionInfo) to support panics and fatal errors. + +See [dap.Server.handleRequest](https://github.com/go-delve/delve/search?q=handleRequest) and capabilities set in [dap.Server.onInitializeRequest](https://github.com/go-delve/delve/search?q=onInitializeRequest) for an up-to-date list of supported requests and options. + +## Launch and Attach Configurations + +In addition to the general [DAP spec](https://microsoft.github.io/debug-adapter-protocol/specification), the server supports the following implementation-specific configuration options for starting the debug session: + * [AttachRequestArguments](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Attach) - see [AttachConfig godoc](https://pkg.go.dev/github.com/go-delve/delve/service/dap#AttachConfig) + * [LaunchRequestArguments](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Launch) - see [LaunchConfig godoc](https://pkg.go.dev/github.com/go-delve/delve/service/dap#LaunchConfig) + +Not all of the configurations are supported by each of the two available DAP servers: + + + + + + + + + +
request"mode":`dlv dap``dlv --headless` +
launch"debug"
"test"
"exec"
...
supportedNOT supported +
attach"local"supportedNOT supported +
attach"remote"NOT supportedsupported +
+ +## Disconnect and Shutdown + +### Single-Client Mode + +When used with `dlv dap` or `dlv --headless --accept-multiclient=false` (default), the DAP server will shut itself down at the end of the debug session, when the client sends a [disconnect request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect). If the debuggee was launched, it will be taken down as well. If the debugee was attached to, `terminateDebuggee` option will be respected. + +When the program terminates, we send a [terminated event](https://microsoft.github.io/debug-adapter-protocol/specification#Events_Terminated), which is expected to trigger a [disconnect request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect) from the client for a session and a server shutdown. The [restart request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Restart) is not yet supported. + +The server also shuts down in case of a client connection error or SIGTERM signal, taking down a launched process, but letting an attached process continue. + +Pressing Ctrl-C on the terminal where a headless server is running sends SIGINT to the debuggee, foregrounded in headless mode to support debugging interactive programs. + +### Multi-Client Mode + +When used with `dlv --headless --accept-multiclient=true`, the DAP server will honor the multi-client mode when a client [disconnects](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect)) or client connection fails. The server will remain running and ready for a new client connection, and the debuggee will remain in whatever state it was at the time of disconnect - running or halted. Once [`suspendDebuggee`](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect) option is supported by frontends like VS Code ([vscode/issues/134412](https://github.com/microsoft/vscode/issues/134412)), we will update the server to offer this as a way to specify debuggee state on disconnect. + +The client may request full shutdown of the server and the debuggee with [`terminateDebuggee`](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect) option. + +The server shuts down in response to a SIGTERM signal, taking down a launched process, but letting an attached process continue. + +Pressing Ctrl-C on the terminal where a headless server is running sends SIGINT to the debuggee, foregrounded in headless mode to support debugging interactive programs. + +## Debugger Output + +The debugger always logs one of the following on start-up to stdout: +* `dlv dap`: + * `DAP server listening at: :` +* `dlv --headless`: + * `API server listening at: :` + +This can be used to confirm that server start-up succeeded. + +The server uses [output events](https://microsoft.github.io/debug-adapter-protocol/specification#Events_Output) to communicate errors and select status messages to the client. For example: + +``` +Step interrupted by a breakpoint. Use 'Continue' to resume the original step command. +invalid command: Unable to step while the previous step is interrupted by a breakpoint. +Use 'Continue' to resume the original step command. +Detaching and terminating target process +``` + +More detailed logging can be enabled with `--log --log-output=dap` as part of the [`dlv` command](../../usage/dlv.md). +It will record the server-side DAP message traffic. For example, +``` +2022-01-04T00:27:57-08:00 debug layer=dap [<- from client]{"seq":1,"type":"request","command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"go","locale":"en-us","linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path","supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"supportsMemoryReferences":true,"supportsProgressReporting":true,"supportsInvalidatedEvent":true}} +2022-01-04T00:27:57-08:00 debug layer=dap [-> to client]{"seq":0,"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":true,"supportsConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"supportsSetVariable":true,"supportsExceptionInfoRequest":true,"supportTerminateDebuggee":true,"supportsDelayedStackTraceLoading":true,"supportsLogPoints":true,"supportsDisassembleRequest":true,"supportsClipboardContext":true,"supportsSteppingGranularity":true,"supportsInstructionBreakpoints":true}} +2022-01-04T00:27:57-08:00 debug layer=dap [<- from client]{"seq":2,"type":"request","command":"launch","arguments":{"name":"Launch file","type":"go","request":"launch","mode":"debug","program":"./temp.go","hideSystemGoroutines":true,"__buildDir":"/Users/polina/go/src","__sessionId":"2ad0f0c1-a1fd-4fff-9fff-b8bc9a933fe5"}} +2022-01-04T00:27:57-08:00 debug layer=dap parsed launch config: { + "mode": "debug", + "program": "./temp.go", + "backend": "default", + "stackTraceDepth": 50, + "hideSystemGoroutines": true +} +... +``` +This logging is written to stderr and is not forwarded via +[output events](https://microsoft.github.io/debug-adapter-protocol/specification#Events_Output). + +## Debuggee Output + +Debuggee's stdout and stderr are written to stdout and stderr respectfully and are not forwarded via +[output events](https://microsoft.github.io/debug-adapter-protocol/specification#Events_Output). + +## Versions + +The initial DAP support was released in v1.6.1 with many additional improvements in subsequent versions. The [remote attach](https://github.com/go-delve/delve/issues/2328) support was added in v1.7.3. + +The DAP API changes are backward-compatible as all new features are opt-in only. To update to a new [DAP version](https://microsoft.github.io/debug-adapter-protocol/changelog) and import a new DAP feature into delve, +one must first update the [go-dap](https://github.com/google/go-dap) dependency. + + \ No newline at end of file diff --git a/Documentation/api/json-rpc/README.md b/Documentation/api/json-rpc/README.md index c690c48088..4c1fb2ea82 100644 --- a/Documentation/api/json-rpc/README.md +++ b/Documentation/api/json-rpc/README.md @@ -1,11 +1,9 @@ # JSON-RPC interface -Delve exposes a [JSON-RPC](http://json-rpc.org/) API interface. +Delve exposes a [JSON-RPC](https://www.jsonrpc.org/specification_v1) API interface. Note that this JSON-RPC interface is served over a streaming socket, *not* over HTTP. -Here is an (incomplete) [list of language implementations](http://json-rpc.org/wiki/implementations). - # API versions Delve currently supports two versions of its API. By default a headless instance of `dlv` will serve APIv1 for backward compatibility with old clients, however new clients should use APIv2 as new features will only be made available through version 2. To select APIv2 use `--api-version=2` command line argument. diff --git a/Documentation/backend_test_health.md b/Documentation/backend_test_health.md new file mode 100644 index 0000000000..48c1725bf4 --- /dev/null +++ b/Documentation/backend_test_health.md @@ -0,0 +1,26 @@ +Tests skipped by each supported backend: + +* 386 skipped = 7 + * 1 broken + * 3 broken - cgo stacktraces + * 3 not implemented +* arm64 skipped = 2 + * 1 broken + * 1 broken - global variable symbolication +* darwin/arm64 skipped = 1 + * 1 broken - cgo stacktraces +* darwin/lldb skipped = 1 + * 1 upstream issue +* freebsd skipped = 15 + * 11 broken + * 4 not implemented +* linux/386/pie skipped = 1 + * 1 broken +* linux/arm64 skipped = 1 + * 1 broken - cgo stacktraces +* pie skipped = 2 + * 2 upstream issue - https://github.com/golang/go/issues/29322 +* windows skipped = 5 + * 1 broken + * 3 see https://github.com/go-delve/delve/issues/2768 + * 1 upstream issue diff --git a/Documentation/cli/README.md b/Documentation/cli/README.md index 89e5691c81..951a94c95f 100644 --- a/Documentation/cli/README.md +++ b/Documentation/cli/README.md @@ -32,7 +32,9 @@ Command | Description [clearall](#clearall) | Deletes multiple breakpoints. [condition](#condition) | Set breakpoint condition. [on](#on) | Executes a command when a breakpoint is hit. +[toggle](#toggle) | Toggles on or off a breakpoint. [trace](#trace) | Set tracepoint. +[watch](#watch) | Set watchpoint. ## Viewing program variables and memory @@ -41,7 +43,7 @@ Command | Description --------|------------ [args](#args) | Print function arguments. [display](#display) | Print value of an expression every time the program stops. -[examinemem](#examinemem) | Examine memory: +[examinemem](#examinemem) | Examine raw memory at the given address. [locals](#locals) | Print local variables. [print](#print) | Evaluate an expression. [regs](#regs) | Print contents of CPU registers. @@ -80,6 +82,7 @@ Command | Description [clear-checkpoint](#clear-checkpoint) | Deletes checkpoint. [config](#config) | Changes configuration parameters. [disassemble](#disassemble) | Disassembler. +[dump](#dump) | Creates a core dump from the current process state [edit](#edit) | Open where you are in $DELVE_EDITOR or $EDITOR [exit](#exit) | Exit the debugger. [funcs](#funcs) | Print list of functions. @@ -101,9 +104,9 @@ If regex is specified only function arguments with a name matching it will be re ## break Sets a breakpoint. - break [name] + break [name] [linespec] -See [Documentation/cli/locspec.md](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md) for the syntax of linespec. +See [Documentation/cli/locspec.md](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md) for the syntax of linespec. If linespec is omitted a breakpoint will be set on the current line. See also: "help on", "help cond" and "help clear" @@ -111,6 +114,10 @@ Aliases: b ## breakpoints Print out info for active breakpoints. + + breakpoints [-a] + +Specifying -a prints all physical breakpoint, including internal breakpoints. Aliases: bp @@ -171,8 +178,28 @@ If called with the linespec argument it will delete all the breakpoints matching Set breakpoint condition. condition . + condition -hitcount + +Specifies that the breakpoint, tracepoint or watchpoint should break only if the boolean expression is true. + +See Documentation/cli/expr.md for a description of supported expressions. + +With the -hitcount option a condition on the breakpoint hit count can be set, the following operators are supported + + condition -hitcount bp > n + condition -hitcount bp >= n + condition -hitcount bp < n + condition -hitcount bp <= n + condition -hitcount bp == n + condition -hitcount bp != n + condition -hitcount bp % n + +The '% n' form means we should stop at the breakpoint when the hitcount is a multiple of n. + +Examples: + cond 2 i == 10 breakpoint 2 will stop when variable i equals 10 + cond name runtime.curg.goid == 5 breakpoint 'name' will stop only on goroutine 5 -Specifies that the breakpoint or tracepoint should break only if the boolean expression is true. Aliases: cond @@ -205,6 +232,16 @@ Defines as an alias to or removes an alias. ## continue Run until breakpoint or program termination. + continue [] + +Optional linespec argument allows you to continue until a specific location is reached. The program will halt if a breakpoint is hit before reaching the specified location. + +For example: + + continue main.main + continue encoding/json.Marshal + + Aliases: c ## deferred @@ -230,7 +267,7 @@ Aliases: disass ## display Print value of an expression every time the program stops. - display -a + display -a [%format] display -d The '-a' option adds an expression to the list of expression printed every time the program stops. The '-d' option removes the specified expression from the list. @@ -247,6 +284,14 @@ Move the current frame down. Move the current frame down by . The second form runs the command on the given frame. +## dump +Creates a core dump from the current process state + + dump + +The core dump is always written in ELF, even on systems (windows, macOS) where this is not customary. For environments other than linux/amd64 threads and registers are dumped in a format that only Delve can read back. + + ## edit Open where you are in $DELVE_EDITOR or $EDITOR @@ -257,17 +302,24 @@ If locspec is omitted edit will open the current source file in the editor, othe Aliases: ed ## examinemem +Examine raw memory at the given address. + Examine memory: - examinemem [-fmt ] [-len ]
+ examinemem [-fmt ] [-count|-len ] [-size ]
+ examinemem [-fmt ] [-count|-len ] [-size ] -x -Format represents the data format and the value is one of this list (default hex): bin(binary), oct(octal), dec(decimal), hex(hexadecimal),. +Format represents the data format and the value is one of this list (default hex): bin(binary), oct(octal), dec(decimal), hex(hexadecimal), addr(address). Length is the number of bytes (default 1) and must be less than or equal to 1000. -Address is the memory location of the target to examine. +Address is the memory location of the target to examine. Please note '-len' is deprecated by '-count and -size'. +Expression can be an integer expression or pointer value of the memory location to examine. For example: - x -fmt hex -len 20 0xc00008af38 + x -fmt hex -count 20 -size 1 0xc00008af38 + x -fmt hex -count 20 -size 1 -x 0xc00008af38 + 8 + x -fmt hex -count 20 -size 1 -x &myVar + x -fmt hex -count 20 -size 1 -x myPtrVar Aliases: x @@ -314,18 +366,62 @@ Aliases: gr ## goroutines List program goroutines. - goroutines [-u (default: user location)|-r (runtime location)|-g (go statement location)|-s (start location)] [-t (stack trace)] [-l (labels)] + goroutines [-u|-r|-g|-s] [-t [depth]] [-l] [-with loc expr] [-without loc expr] [-group argument] Print out info for every goroutine. The flag controls what information is shown along with each goroutine: - -u displays location of topmost stackframe in user code + -u displays location of topmost stackframe in user code (default) -r displays location of topmost stackframe (including frames inside private runtime functions) -g displays location of go instruction that created the goroutine -s displays location of the start function - -t displays goroutine's stacktrace + -t displays goroutine's stacktrace (an optional depth value can be specified, default: 10) -l displays goroutine's labels -If no flag is specified the default is -u. +If no flag is specified the default is -u, i.e. the first frame within the first 30 frames that is not executing a runtime private function. + +FILTERING + +If -with or -without are specified only goroutines that match the given condition are returned. + +To only display goroutines where the specified location contains (or does not contain, for -without and -wo) expr as a substring, use: + + goroutines -with (userloc|curloc|goloc|startloc) expr + goroutines -w (userloc|curloc|goloc|startloc) expr + goroutines -without (userloc|curloc|goloc|startloc) expr + goroutines -wo (userloc|curloc|goloc|startloc) expr + +To only display goroutines that have (or do not have) the specified label key and value, use: + + + goroutines -with label key=value + goroutines -without label key=value + +To only display goroutines that have (or do not have) the specified label key, use: + + goroutines -with label key + goroutines -without label key + +To only display goroutines that are running (or are not running) on a OS thread, use: + + + goroutines -with running + goroutines -without running + +To only display user (or runtime) goroutines, use: + + goroutines -with user + goroutines -without user + +GROUPING + + goroutines -group (userloc|curloc|goloc|startloc|running|user) + +Groups goroutines by the given location, running status or user classification, up to 5 goroutines per group will be displayed as well as the total number of goroutines in the group. + + goroutines -group label key + +Groups goroutines by the value of the label with the specified key. + Aliases: grs @@ -371,7 +467,7 @@ If regex is specified only local variables with a name matching it will be retur ## next Step over to next source line. - next [count] + next [count] Optional [count] argument allows you to skip multiple lines. @@ -381,17 +477,28 @@ Aliases: n ## on Executes a command when a breakpoint is hit. - on . + on + on -edit + + +Supported commands: print, stack, goroutine, trace and cond. +To convert a breakpoint into a tracepoint use: + + on trace + +The command 'on cond ' is equivalent to 'cond '. -Supported commands: print, stack and goroutine) +The command 'on x -edit' can be used to edit the list of commands executed when the breakpoint is hit. ## print Evaluate an expression. - [goroutine ] [frame ] print + [goroutine ] [frame ] print [%format] + +See Documentation/cli/expr.md for a description of supported expressions. -See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions. +The optional format argument is a format specifier, like the ones used by the fmt package. For example "print %x v" will print v as an hexadecimal number. Aliases: p @@ -404,7 +511,7 @@ Print contents of CPU registers. regs [-a] -Argument -a shows more registers. +Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See Documentation/cli/expr.md. ## restart @@ -412,7 +519,7 @@ Restart process. For recorded targets the command takes the following forms: - restart resets ot the start of the recording + restart resets to the start of the recording restart [checkpoint] resets the recording to the given checkpoint restart -r [newargv...] [redirects...] re-records the target process @@ -447,7 +554,7 @@ Changes the value of a variable. [goroutine ] [frame ] set = -See [Documentation/cli/expr.md](//github.com/go-delve/delve/tree/master/Documentation/cli/expr.md) for a description of supported expressions. Only numerical variables and pointers can be changed. +See Documentation/cli/expr.md for a description of supported expressions. Only numerical variables and pointers can be changed. ## source @@ -512,12 +619,18 @@ Aliases: tr Print out info for every traced thread. +## toggle +Toggles on or off a breakpoint. + +toggle + + ## trace Set tracepoint. - trace [name] + trace [name] [linespec] -A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See [Documentation/cli/locspec.md](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md) for the syntax of linespec. +A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See [Documentation/cli/locspec.md](//github.com/go-delve/delve/tree/master/Documentation/cli/locspec.md) for the syntax of linespec. If linespec is omitted a tracepoint will be set on the current line. See also: "help on", "help cond" and "help clear" @@ -548,6 +661,26 @@ Print package variables. If regex is specified only package variables with a name matching it will be returned. If -v is specified more information about each package variable will be shown. +## watch +Set watchpoint. + + watch [-r|-w|-rw] + + -r stops when the memory location is read + -w stops when the memory location is written + -rw stops when the memory location is read or written + +The memory location is specified with the same expression language used by 'print', for example: + + watch v + +will watch the address of variable 'v'. + +Note that writes that do not change the value of the watched memory address might not be reported. + +See also: "help print". + + ## whatis Prints type of an expression. diff --git a/Documentation/cli/expr.md b/Documentation/cli/expr.md index fcf027f033..3cb67d7ad2 100644 --- a/Documentation/cli/expr.md +++ b/Documentation/cli/expr.md @@ -14,6 +14,13 @@ Delve can evaluate a subset of go expression language, specifically the followin - Calls to builtin functions: `cap`, `len`, `complex`, `imag` and `real` - Type assertion on interface variables (i.e. `somevar.(concretetype)`) +# Special Variables + +Delve defines two special variables: + +* `runtime.curg` evaluates to the 'g' struct for the current goroutine, in particular `runtime.curg.goid` is the goroutine id of the current goroutine. +* `runtime.frameoff` is the offset of the frame's base address from the bottom of the stack. + # Nesting limit When delve evaluates a memory address it will automatically return the value of nested struct members, array and slice items and dereference pointers. @@ -110,3 +117,23 @@ Packages with the same name can be disambiguated by using the full package path. # Pointers in Cgo Char pointers are always treated as NUL terminated strings, both indexing and the slice operator can be applied to them. Other C pointers can also be used similarly to Go slices, with indexing and the slice operator. In both of these cases it is up to the user to respect array bounds. + + +# CPU Registers + +The name of a CPU register, in all uppercase letters, will resolve to the value of that CPU register in the current frame. For example on AMD64 the expression `RAX` will evaluate to the value of the RAX register. + +Register names are shadowed by both local and global variables, so if a local variable called "RAX" exists, the `RAX` expression will evaluate to it instead of the CPU register. + +Register names can optionally be prefixed by any number of underscore characters, so `RAX`, `_RAX`, `__RAX`, etc... can all be used to refer to the same RAX register and, in absence of shadowing from other variables, will all evaluate to the same value. + +Registers of 64bits or less are returned as uint64 variables. Larger registers are returned as strings of hexadecimal digits. + +Because many architectures have SIMD registers that can be used by the application in different ways the following syntax is also available: + +* `REGNAME.intN` returns the register REGNAME as an array of intN elements. +* `REGNAME.uintN` returns the register REGNAME as an array of uintN elements. +* `REGNAME.floatN` returns the register REGNAME as an array fo floatN elements. + +In all cases N must be a power of 2. + diff --git a/Documentation/cli/getting_started.md b/Documentation/cli/getting_started.md index 23a9d96cf9..504a287e70 100644 --- a/Documentation/cli/getting_started.md +++ b/Documentation/cli/getting_started.md @@ -25,7 +25,7 @@ For example given this project layout: │ └── bar_test.go ``` -If you are in the directory `github.com/me/foo/cmd/foo` you can simple run `dlv debug` +If you are in the directory `github.com/me/foo/cmd/foo` you can simply run `dlv debug` from the command line. From anywhere else, say the project root, you can simply provide the package: `dlv debug github.com/me/foo/cmd/foo`. To pass flags to your program separate them with `--`: `dlv debug github.com/me/foo/cmd/foo -- -arg1 value`. @@ -86,6 +86,6 @@ As you can see, we began debugging the test binary, found our test function via the `funcs` command which takes a regexp to filter the list of functions, set a breakpoint and then continued execution until we hit that breakpoint. -For more information on subcommands you can use type `dlv help`, and once in a +For more information on subcommands you can use, type `dlv help`, and once in a debug session you can see all of the commands available to you by typing `help` at any time. diff --git a/Documentation/cli/starlark.md b/Documentation/cli/starlark.md index f4a286e234..a78f36ae38 100644 --- a/Documentation/cli/starlark.md +++ b/Documentation/cli/starlark.md @@ -26,22 +26,28 @@ clear_breakpoint(Id, Name) | Equivalent to API call [ClearBreakpoint](https://go clear_checkpoint(ID) | Equivalent to API call [ClearCheckpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ClearCheckpoint) raw_command(Name, ThreadID, GoroutineID, ReturnInfoLoadConfig, Expr, UnsafeCall) | Equivalent to API call [Command](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Command) create_breakpoint(Breakpoint) | Equivalent to API call [CreateBreakpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.CreateBreakpoint) +create_ebpf_tracepoint(FunctionName) | Equivalent to API call [CreateEBPFTracepoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.CreateEBPFTracepoint) +create_watchpoint(Scope, Expr, Type) | Equivalent to API call [CreateWatchpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.CreateWatchpoint) detach(Kill) | Equivalent to API call [Detach](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Detach) disassemble(Scope, StartPC, EndPC, Flavour) | Equivalent to API call [Disassemble](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Disassemble) +dump_cancel() | Equivalent to API call [DumpCancel](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.DumpCancel) +dump_start(Destination) | Equivalent to API call [DumpStart](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.DumpStart) +dump_wait(Wait) | Equivalent to API call [DumpWait](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.DumpWait) eval(Scope, Expr, Cfg) | Equivalent to API call [Eval](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Eval) examine_memory(Address, Length) | Equivalent to API call [ExamineMemory](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ExamineMemory) -find_location(Scope, Loc, IncludeNonExecutableLines) | Equivalent to API call [FindLocation](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.FindLocation) +find_location(Scope, Loc, IncludeNonExecutableLines, SubstitutePathRules) | Equivalent to API call [FindLocation](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.FindLocation) function_return_locations(FnName) | Equivalent to API call [FunctionReturnLocations](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.FunctionReturnLocations) get_breakpoint(Id, Name) | Equivalent to API call [GetBreakpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.GetBreakpoint) +get_buffered_tracepoints() | Equivalent to API call [GetBufferedTracepoints](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.GetBufferedTracepoints) get_thread(Id) | Equivalent to API call [GetThread](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.GetThread) is_multiclient() | Equivalent to API call [IsMulticlient](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.IsMulticlient) last_modified() | Equivalent to API call [LastModified](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.LastModified) -breakpoints() | Equivalent to API call [ListBreakpoints](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListBreakpoints) +breakpoints(All) | Equivalent to API call [ListBreakpoints](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListBreakpoints) checkpoints() | Equivalent to API call [ListCheckpoints](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListCheckpoints) dynamic_libraries() | Equivalent to API call [ListDynamicLibraries](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListDynamicLibraries) function_args(Scope, Cfg) | Equivalent to API call [ListFunctionArgs](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListFunctionArgs) functions(Filter) | Equivalent to API call [ListFunctions](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListFunctions) -goroutines(Start, Count) | Equivalent to API call [ListGoroutines](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListGoroutines) +goroutines(Start, Count, Filters, GoroutineGroupingOptions) | Equivalent to API call [ListGoroutines](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListGoroutines) local_vars(Scope, Cfg) | Equivalent to API call [ListLocalVars](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListLocalVars) package_vars(Filter, Cfg) | Equivalent to API call [ListPackageVars](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListPackageVars) packages_build_info(IncludeFiles) | Equivalent to API call [ListPackagesBuildInfo](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ListPackagesBuildInfo) @@ -55,6 +61,7 @@ restart(Position, ResetArgs, NewArgs, Rerecord, Rebuild, NewRedirects) | Equival set_expr(Scope, Symbol, Value) | Equivalent to API call [Set](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Set) stacktrace(Id, Depth, Full, Defers, Opts, Cfg) | Equivalent to API call [Stacktrace](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.Stacktrace) state(NonBlocking) | Equivalent to API call [State](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.State) +toggle_breakpoint(Id, Name) | Equivalent to API call [ToggleBreakpoint](https://godoc.org/github.com/go-delve/delve/service/rpc2#RPCServer.ToggleBreakpoint) dlv_command(command) | Executes the specified command as if typed at the dlv_prompt read_file(path) | Reads the file as a string write_file(path, contents) | Writes string to a file diff --git a/Documentation/faq.md b/Documentation/faq.md index cd8b02c68c..6fd10eb3ce 100644 --- a/Documentation/faq.md +++ b/Documentation/faq.md @@ -3,16 +3,20 @@ #### I'm getting an error while compiling Delve / unsupported architectures and OSs The most likely cause of this is that you are running an unsupported Operating System or architecture. -Currently Delve supports Linux, Windows and macOS on the amd64 (also known as Intel 86x64) architecture and Linux on the arm64 (also known as ARM AArch64) and i386 architectures. - -For example if you are getting the `undefined: ArchInst` error message while compiling Delve, that means that Delve doesn't currently support your processor architecture. +Currently Delve supports (GOOS / GOARCH): +* linux / amd64 (86x64) +* linux / arm64 (AARCH64) +* linux / 386 +* windows / amd64 +* darwin (macOS) / amd64 There is no planned ETA for support of other architectures or operating systems. Bugs tracking requested support are: -- [i386 support](https://github.com/go-delve/delve/issues/20) -- [ARM support](https://github.com/go-delve/delve/issues/118) +- [32bit ARM support](https://github.com/go-delve/delve/issues/328) - [PowerPC support](https://github.com/go-delve/delve/issues/1564) -- [FreeBSD support](https://github.com/go-delve/delve/issues/213) +- [OpenBSD](https://github.com/go-delve/delve/issues/1477) + +See also: [backend test health](backend_test_health.md). #### How do I use Delve with Docker? @@ -49,3 +53,26 @@ the terminal TTY. 1. Assign the process its own TTY. This can be done on UNIX systems via the `--tty` flag for the `dlv debug` and `dlv exec` commands. For the best experience, you should create your own PTY and assign it as the TTY. This can be done via [ptyme](https://github.com/derekparker/ptyme). + +#### How can I use Delve for remote debugging? + +It is best not to use remote debugging on a public network. If you have to do this, we recommend using ssh tunnels or a vpn connection. + +##### ```Example ``` + +Remote server: +``` +dlv exec --headless --listen localhost:4040 /path/to/executable +``` + +Local client: +1. connect to the server and start a local port forward + +``` +ssh -NL 4040:localhost:4040 user@remote.ip +``` + +2. connect local port +``` +dlv connect :4040 +``` diff --git a/Documentation/installation/README.md b/Documentation/installation/README.md index 8daa64340c..d0204fa634 100644 --- a/Documentation/installation/README.md +++ b/Documentation/installation/README.md @@ -1,10 +1,66 @@ # Installation +The following instructions are known to work on Linux, macOS, Windows and FreeBSD. -Directions for installing Delve on all supported platforms is provided here. +Clone the git repository and build: -Please note you *must* have **Go 1.10** or higher installed in order to compile Delve. +``` +$ git clone https://github.com/go-delve/delve +$ cd delve +$ go install github.com/go-delve/delve/cmd/dlv +``` -- [OSX](osx/install.md) -- [Linux](linux/install.md) -- [Windows](windows/install.md) -- [FreeBSD](freebsd/install.md) \ No newline at end of file +Alternatively, on Go version 1.16 or later: + +``` +# Install the latest release: +$ go install github.com/go-delve/delve/cmd/dlv@latest + +# Install at tree head: +$ go install github.com/go-delve/delve/cmd/dlv@master + +# Install at a specific version or pseudo-version: +$ go install github.com/go-delve/delve/cmd/dlv@v1.7.3 +$ go install github.com/go-delve/delve/cmd/dlv@v1.7.4-0.20211208103735-2f13672765fe +``` +See [Versions](https://go.dev/ref/mod#versions) and [Pseudo-versions](https://go.dev/ref/mod#pseudo-versions) for how to format the version suffixes. + +See `go help install` for details on where the `dlv` executable is saved. + +If during the install step you receive an error similar to this: + +``` +found packages native (proc.go) and your_operating_system_and_architecture_combination_is_not_supported_by_delve (support_sentinel.go) in /home/pi/go/src/github.com/go-delve/delve/pkg/proc/native +``` + +It means that your combination of operating system and CPU architecture is not supported, check the output of `go version`. + +## macOS considerations + +On macOS make sure you also install the command line developer tools: + +``` +$ xcode-select --install +``` + +If you didn't enable Developer Mode using Xcode you will be asked to authorize the debugger every time you use it. To enable Developer Mode and only have to authorize once per session use: + +``` +sudo /usr/sbin/DevToolsSecurity -enable +``` + +You might also need to add your user to the developer group: + +``` +sudo dscl . append /Groups/_developer GroupMembership $(whoami) +``` + +## Compiling macOS native backend + +You do not need the macOS native backend and it [has known problems](https://github.com/go-delve/delve/issues/1112). If you still want to build it: + +1. Run `xcode-select --install` +2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg` +3. Clone the repo into `$GOPATH/src/github.com/go-delve/delve` +4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate) + +The makefile will take care of creating and installing a self-signed certificate automatically. diff --git a/Documentation/installation/freebsd/install.md b/Documentation/installation/freebsd/install.md index 46c6e4bef3..ddb60cc446 100644 --- a/Documentation/installation/freebsd/install.md +++ b/Documentation/installation/freebsd/install.md @@ -1,20 +1 @@ -# Installation on FreeBSD - -Please use the following steps to build and install Delve on FreeBSD. - -There are two ways to install on FreeBSD. First is the standard `go get` method: - -``` -go get github.com/go-delve/delve/cmd/dlv -``` - -Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency. - -Alternatively make sure $GOPATH is set (e.g. as `~/.go`) and: - -``` -$ git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve -$ cd $GOPATH/src/github.com/go-delve/delve -$ gmake install -``` - +See [general install instructions](../README.md). \ No newline at end of file diff --git a/Documentation/installation/linux/install.md b/Documentation/installation/linux/install.md index ffa27325f0..0efc16edbe 100644 --- a/Documentation/installation/linux/install.md +++ b/Documentation/installation/linux/install.md @@ -1,19 +1 @@ -# Installation on Linux - -Please use the following steps to build and install Delve on Linux. - -There are two ways to install on Linux. First is the standard `go get` method: - -``` -go get github.com/go-delve/delve/cmd/dlv -``` - -Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency. - -Alternatively make sure $GOPATH is set (e.g. as `~/.go`) and: - -``` -$ git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve -$ cd $GOPATH/src/github.com/go-delve/delve -$ make install -``` +See [general install instructions](../README.md). diff --git a/Documentation/installation/osx/install.md b/Documentation/installation/osx/install.md index f4f3f88e84..0efc16edbe 100644 --- a/Documentation/installation/osx/install.md +++ b/Documentation/installation/osx/install.md @@ -1,34 +1 @@ -# Installation on macOS - -Ensure you have a proper compilation toolchain. - -This should be as simple as: - -`xcode-select --install` - -Now you can install delve using `go get`: - -``` -$ go get github.com/go-delve/delve/cmd/dlv -``` - -Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency. - -With this method you will not be able to use delve's native backend, *but you don't need it anyway*: the native backend on macOS [has known problems](https://github.com/go-delve/delve/issues/1112) on recent issues of the OS and is not currently maintained. - -If you didn't enable Developer Mode using Xcode you will be asked to authorize the debugger every time you use it. To enable Developer Mode and only have to authorize once per session use: - -``` -sudo /usr/sbin/DevToolsSecurity -enable -``` - -## Compiling the native backend - -Only do this if you have a valid reason to use the native backend. - -1. Run `xcode-select --install` -2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg` -3. Clone the repo into `$GOPATH/src/github.com/go-delve/delve` -4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate) - -The makefile will take care of creating and installing a self-signed certificate automatically. +See [general install instructions](../README.md). diff --git a/Documentation/installation/windows/install.md b/Documentation/installation/windows/install.md index 30baabce68..ddb60cc446 100644 --- a/Documentation/installation/windows/install.md +++ b/Documentation/installation/windows/install.md @@ -1,11 +1 @@ -# Installation on Windows - -Please use the standard `go get` command to build and install Delve on Windows. - -``` -go get github.com/go-delve/delve/cmd/dlv -``` - -Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency. - -Also, if not already set, you have to add the %GOPATH%\bin directory to your PATH variable. +See [general install instructions](../README.md). \ No newline at end of file diff --git a/Documentation/internal/README.md b/Documentation/internal/README.md index 3fd1bf4576..c227900598 100644 --- a/Documentation/internal/README.md +++ b/Documentation/internal/README.md @@ -1,6 +1,7 @@ # Internal Documentation -[Architecture of Delve slides](https://speakerdeck.com/aarzilli/internal-architecture-of-delve). +* [Architecture of Delve slides](https://speakerdeck.com/aarzilli/internal-architecture-of-delve). +* [Notes on porting Delve to other architectures](portnotes.md) TODO(derekparker) diff --git a/Documentation/internal/portnotes.md b/Documentation/internal/portnotes.md new file mode 100644 index 0000000000..c73f0ad8e5 --- /dev/null +++ b/Documentation/internal/portnotes.md @@ -0,0 +1,154 @@ +# Notes on porting Delve to other architectures + +## Continuous Integration requirements + +Code that isn't tested doesn't work, we like to run CI on all supported platforms. Currently our CI is done on an [instance of TeamCity cloud provided by JetBrains](https://delve.teamcity.com/), with the exception of the FreeBSD port, which is tested by Cirrus-CI. + +TeamCity settings are in `.teamcity/settings.kts` which in turn runs one of `_scripts/test_linux.sh`, `_scripts/test_mac.sh` or `_scripts/test_windows.ps1`. +All test scripts eventually end up calling into our main test program `_scripts/make.go`, which makes the appropriate `go test` calls. + +If you plan to port Delve to a new platform you should first figure out how we are going to add your port to our CI, there are three possible solutions: + +1. the platform can be run on existing agents we have on TeamCity (linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64) through Docker or similar solutions. +2. there is a free CI service that integrates with GitHub that we can use +3. you provide the hardware to be added to TeamCity to test it + +Exception to this requirement can be discussed in special cases. + +## General code organization + +An introduction to the architecture of Delve can be found in the 2018 Gophercon Iceland talk: [slides](https://speakerdeck.com/aarzilli/internal-architecture-of-delve), [video](https://www.youtube.com/watch?v=IKnTr7Zms1k). + +### Packages you shouldn't worry about + +* `cmd/dlv/...` implements the command line program +* `pkg/terminal/...` implements the command line user interface +* `service/...` with the exception of `service/test`, implements our API as well as DAP +* `pkg/dwarf/...` with the exception of `pkg/dwarf/regnum`, implements DWARF features not covered by the standard library +* anything else in `pkg` that isn't inside `pkg/proc` + +### pkg/proc + +`pkg/proc` is the symbolic layer of Delve, its job is to bridge the distance between the API and low level Operating System and CPU features. Almost all features of Delve are implemented here, **except for the interaction with the OS/CPU**, which is provided by one of three backends: `pkg/proc/native`, `pkg/proc/core` or `pkg/proc/gdbserial`. + +This package also contains the main test suite for Delve's backends in `pkg/proc/proc_test.go`. The tests for reading variables, however, are inside `service/test` for historical reasons. + +When porting Delve to a new CPU a new instance of the `proc.Arch` structure should be filled, see `pkg/proc/arch.go` and `pkg/proc/amd64_arch.go` as an example. To do this you will have to: + +- provide a disassembler for the port architecture +- provide a mapping between DWARF register numbers and hardware registers in `pkg/dwarf/regnum` (see `pkg/dwarf/regnum/amd64.go` as an example). This mapping *is not arbitrary* it needs to be described in some standard document which should be linked to in the documentation of `pkg/dwarf/regnum`, for example the mapping for amd64 is described by the System V ABI AMD64 Architecture Processor Supplement v. 1.0 on page 61 figure 3.36. +- if you don't know what `proc.Arch.fixFrameUnwindContext` or `porc.Arch.switchStack` should do *leave them empty* +- the `proc.Arch.prologues` field needs to be filled by looking at the relevant parts of the Go linker (`cmd/link`), the code is somewhere inside `$GOROOT/src/cmd/internal/obj`, usually the function is called `stacksplit`. + +If your target OS uses an executable file format other than ELF, Mach-O or PE you will also have to change `pkg/proc/bininfo.go` . + +**See also** the note on [build tags](#buildtags). + +### pkg/proc/gdbserial + +This implements GDB remote serial protocol, it is used as the main backend on macOS as well as connecting to [rr](https://rr-project.org/). + +Unless you are making a macOS port you shouldn't worry about this. + +### pkg/proc/core + +This implements code for reading core files. You don't need to support this for the port platform, see the note on [skippable features](#skippable). +If you decide to do it anyway see the note on [build tags](#buildtags). + +### pkg/proc/native + +This is the interface between Delve and the OS/CPU, you will definitely want to work on this and it will be the bulk of the port job. The tests for this code however are not in this directory, they are in `pkg/proc` and `service/test`. + +## General port process + +1. Edit `pkg/proc/native/support_sentinel.go` to disable it in the port platform +2. Fill `proc.Arch` struct for target architecture if it isn't supported already +3. Go in `pkg/proc` + * run `go test -v` + * fix compiler errors + * repeat until compilation succeeds + * fix test failures + * repeat until almost all tests pass (see note on [skippable tests and features](#skippable)) +5. Go in `service/test` + * run `go test -v` + * fix compiler errors + * repeat until compilation succeeds + * fix test failures + * repeat until almost all tests pass (see note on [skippable tests and features](#skippable)) +6. Go to the root directory of the project + * run `go run _scripts/make.go test` + * fix compiler errors + * repeat until compilation succeeds + * fix test failures + * repeat until almost all tests pass (see note on [skippable tests and features](#skippable)) + +## Miscellaneous + +### Uses of build tags, runtime.GOOS and runtime.GOARCH + +Delve has the ability to read cross-platform core files: you can read a core file of any supported platform with Delve running on any other supported platform. +For example, a core file produced by linux/arm64 can be read using Delve running under windows/amd64. +This feature has far reaching consequences, for example the stack unwinding code in `pkg/proc/stack.go` could be asked to unwind a stack for an architecture different from the one its running under. + +What this means in practice is that, in general, using build tags (like `_amd64.go`) or checking `runtime.GOOS` and `runtime.GOARCH` is forbidden throughout Delve's source tree, with two important exceptions: + +* `pkg/proc/native` is allowed to check runtime.GOOS/runtime.GOARCH as well as using build tags +* test files are allowed to check runtime.GOOS/runtime.GOARCH as well as using build tags + +Other exceptions can be considered, but in general code outside of `pkg/proc/native` should: + +* use `proc.BinaryInfo.GOOS` instead of `runtime.GOOS` +* use `proc.BinaryInfo.Arch.Name` instead of `runtime.GOARCH` +* use `proc.BinaryInfo.Arch.PtrSize()` instead of determining the pointer size with `unsafe.Sizeof` +* use `uint64` wherever an address-sized integer is needed, instead of `uintptr` +* use `amd64_filename.go` instead of the build tag version, `filename_amd64.go` + +### Features and tests that can be skipped by a port + +Delve offers many features, however not all of them are necessary for a useful port of Delve. The following features are optional to implement for a port: + +- Reading core files (i.e. `pkg/proc/core`) +- Writing core files (i.e. `pkg/proc/native/dump_*.go`) +- Watchpoints (`(*nativeThread).writeHardwareBreakpoint` etc) +- Supporting CGO calls (`proc.Arch.switchStack`) +- eBPF (`pkg/proc/internal/ebpf`) +- Working with Position Independent Executables (PIE), unless the default buildmode for the port platform is PIE +- Function call injection (`pkg/proc/fncall.go` -- it is probably not supported on the port architecture anyway) + +For all these features it is acceptable (and possibly advisable) to either leave the implementation empty or to write a stub that always returns an "not implemented" error. Tests relative to these features can be skipped, `proc_test.go` has a `skipOn` utility function that can be called to skip a specific test on some architectures. + +Other tests should pass reliably, it is acceptable to skip some of them as long as most of them will pass. +The following tests should not be skipped even if you will be tempted to: + +* `proc.TestNextConcurrent` +* `proc.TestNextConcurrentVariant2` +* `proc.TestBreakpointCounts` (enable `proc.TestBreakpointCountsWithDetection` if you have problems with this) +* `proc.TestStepConcurrentDirect` +* `proc.TestStepConcurrentPtr` + +### Porting to Big Endian architectures + +Delve was initially written for amd64 and assumed 64bit and little endianness everywhere. The assumption on pointer size has been removed throughout the codebase, the assumption about endianness hasn't. Both `pkg/dwarf/loclist` and `pkg/dwarf/frame` incorrectly assume little endian encoding. Other parts of the code might do the same. + +### Porting to ARM32, MIPS and Software Single Stepping + +When resuming a thread stopped at a breakpoint Delve will: + +1. remove the breakpoint temporarily +2. make the thread execute a single instruction +3. write the breakpoint back + +Step 2 is implemented using the hardware single step feature that many CPUs have and that is exposed via PTRACE_SINGLESTEP or similar features. +ARM32 and MIPS do not have a hardware single step implemented, this means that it has to be implemented in software. +The linux kernel used to have a software implementation of PTRACE_SINGLESTEP but those have been removed because they were too burdensome to maintain and delegated the feature to userspace debuggers entirely. + +A software singlestep implementation would work like this: + +1. decode the current instruction +2. figure out all the possible places where the PC registers could be after executing the current instruction +3. set a breakpoint on all of them +4. resume the thread normally +5. clear all breakpoints created on step 3 + +Delve does not currently have any infrastructure to help implement this, which means that porting to architectures without hardware singlestep is even more complicated. + diff --git a/Documentation/usage/README.md b/Documentation/usage/README.md index 3bc7c5b07c..851fda7b11 100644 --- a/Documentation/usage/README.md +++ b/Documentation/usage/README.md @@ -1,5 +1,35 @@ # Using Delve -You can invoke Delve in multiple ways, depending on your usage needs. Delve makes every attempt to be user-friendly, ensuring the user has to do the least amount of work possible to begin debugging their program. +You can invoke Delve in [multiple ways](dlv.md), depending on your usage needs. Delve makes every attempt to be user-friendly, ensuring the user has to do the least amount of work possible to begin debugging their program. -Refer to the [main usage document](dlv.md) to further explore commands. +The [available commands](dlv.md) can be grouped into the following categories: + +* Specify target and start debugging with the default [terminal interface](../cli/README.md): + * [dlv debug [package]](dlv_debug.md) + * [dlv test [package]](dlv_test.md) + * [dlv exec \](dlv_exec.md) + * [dlv attach \](dlv_attach.md) + * [dlv core \ \](dlv_core.md) + * [dlv replay \ ](dlv_replay.md) +* Trace target program execution + * [dlv trace [package] \](dlv_trace.md) +* Start a headless backend server only and connect with an external [frontend client](../EditorIntegration.md): + * [dlv **--headless** \ \ \ ](../api/ClientHowto.md#spawning-the-backend) + * starts a server, enters a debug session for the specified target and waits to accept a client connection over JSON-RPC or DAP + * `` can be any of `debug`, `test`, `exec`, `attach`, `core` or `replay` + * if `--headless` flag is not specified the default [terminal client](../cli/README.md) will be automatically started instead + * compatible with [dlv connect](dlv_connect.md), [VS Code Go](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#remote-debugging), [GoLand](https://www.jetbrains.com/help/go/attach-to-running-go-processes-with-debugger.html#attach-to-a-process-on-a-remote-machine) + * [dlv dap](dlv_dap.md) + * starts a DAP-only server and waits for a DAP client connection to specify the target and arguments + * compatible with [VS Code Go](https://github.com/golang/vscode-go/blob/master/docs/debugging.md#remote-debugging) + * NOT compatible with [dlv connect](dlv_connect.md), [GoLand](https://www.jetbrains.com/help/go/attach-to-running-go-processes-with-debugger.html#attach-to-a-process-on-a-remote-machine) + * [dlv connect \](dlv_connect.md) + * starts a [terminal interface client](../cli/README.md) and connects it to a running headless server over JSON-RPC +* Help information + * [dlv help [command]](dlv.md) + * [dlv log](dlv_log.md) + * [dlv backend](dlv_backend.md) + * [dlv redirect](dlv_redirect.md) + * [dlv version](dlv_version.md) + +The above list may be incomplete. Refer to the auto-generated [complete usage document](dlv.md) to further explore all available commands. diff --git a/Documentation/usage/dlv.md b/Documentation/usage/dlv.md index f7e72b12ac..5e75d2a3ec 100644 --- a/Documentation/usage/dlv.md +++ b/Documentation/usage/dlv.md @@ -4,7 +4,6 @@ Delve is a debugger for the Go programming language. ### Synopsis - Delve is a source level debugger for Go programs. Delve enables you to interact with your program by controlling the execution of the process, @@ -19,13 +18,15 @@ Pass flags to the program you are debugging using `--`, for example: ### Options ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. + -h, --help help for dlv --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -37,10 +38,11 @@ Pass flags to the program you are debugging using `--`, for example: ``` ### SEE ALSO + * [dlv attach](dlv_attach.md) - Attach to running process and begin debugging. -* [dlv connect](dlv_connect.md) - Connect to a headless debug server. +* [dlv connect](dlv_connect.md) - Connect to a headless debug server with a terminal client. * [dlv core](dlv_core.md) - Examine a core dump. -* [dlv dap](dlv_dap.md) - [EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP). +* [dlv dap](dlv_dap.md) - Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP). * [dlv debug](dlv_debug.md) - Compile and begin debugging main package in current directory, or the package specified. * [dlv exec](dlv_exec.md) - Execute a precompiled binary, and begin a debug session. * [dlv replay](dlv_replay.md) - Replays a rr trace. diff --git a/Documentation/usage/dlv_attach.md b/Documentation/usage/dlv_attach.md index 730cc6ef85..3b9c22de2b 100644 --- a/Documentation/usage/dlv_attach.md +++ b/Documentation/usage/dlv_attach.md @@ -4,7 +4,6 @@ Attach to running process and begin debugging. ### Synopsis - Attach to an already running process and begin debugging it. This command will cause Delve to take control of an already running process, and @@ -13,25 +12,27 @@ option to let the process continue or kill it. ``` -dlv attach pid [executable] +dlv attach pid [executable] [flags] ``` ### Options ``` --continue Continue the debugged process on start. + -h, --help help for attach ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -43,5 +44,6 @@ dlv attach pid [executable] ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_backend.md b/Documentation/usage/dlv_backend.md index 09e992245a..3ccc9ba9c9 100644 --- a/Documentation/usage/dlv_backend.md +++ b/Documentation/usage/dlv_backend.md @@ -4,7 +4,6 @@ Help about the --backend flag. ### Synopsis - The --backend flag specifies which backend should be used, possible values are: @@ -15,16 +14,23 @@ are: +### Options + +``` + -h, --help help for backend +``` + ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -36,5 +42,6 @@ are: ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_connect.md b/Documentation/usage/dlv_connect.md index 9b1cbe9952..266e3ccea8 100644 --- a/Documentation/usage/dlv_connect.md +++ b/Documentation/usage/dlv_connect.md @@ -1,26 +1,32 @@ ## dlv connect -Connect to a headless debug server. +Connect to a headless debug server with a terminal client. ### Synopsis +Connect to a running headless debug server with a terminal client. -Connect to a running headless debug server. +``` +dlv connect addr [flags] +``` + +### Options ``` -dlv connect addr + -h, --help help for connect ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -32,5 +38,6 @@ dlv connect addr ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_core.md b/Documentation/usage/dlv_core.md index c625bec593..51a2c33411 100644 --- a/Documentation/usage/dlv_core.md +++ b/Documentation/usage/dlv_core.md @@ -4,29 +4,35 @@ Examine a core dump. ### Synopsis - Examine a core dump (only supports linux and windows core dumps). The core command will open the specified core file and the associated executable and let you examine the state of the process when the core dump was taken. -Currently supports linux/amd64 and linux/arm64 core files and windows/amd64 minidumps. +Currently supports linux/amd64 and linux/arm64 core files, windows/amd64 minidumps and core files generated by Delve's 'dump' command. + +``` +dlv core [flags] +``` + +### Options ``` -dlv core + -h, --help help for core ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -38,5 +44,6 @@ dlv core ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_dap.md b/Documentation/usage/dlv_dap.md index 931d7a2753..b76fbe1f38 100644 --- a/Documentation/usage/dlv_dap.md +++ b/Documentation/usage/dlv_dap.md @@ -1,33 +1,53 @@ ## dlv dap -[EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP). +Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP). ### Synopsis +Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP). -[EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP). +The server is always headless and requires a DAP client like VS Code to connect and request a binary +to be launched or a process to be attached to. The following modes can be specified via the client's launch config: +- launch + exec (executes precompiled binary, like 'dlv exec') +- launch + debug (builds and launches, like 'dlv debug') +- launch + test (builds and tests, like 'dlv test') +- launch + replay (replays an rr trace, like 'dlv replay') +- launch + core (replays a core dump file, like 'dlv core') +- attach + local (attaches to a running process, like 'dlv attach') -The server supports debugging of a precompiled binary akin to 'dlv exec' via a launch request. -It does not yet support support specification of program arguments. -It does not yet support launch requests with 'debug' and 'test' modes that require compilation. -It does not yet support attach requests to debug a running process like with 'dlv attach'. -It does not yet support asynchronous request-response communication. -The server does not accept multiple client connections. +Program and output binary paths will be interpreted relative to dlv's working directory. + +This server does not accept multiple client connections (--accept-multiclient). +Use 'dlv [command] --headless' instead and a DAP client with attach + remote config. +While --continue is not supported, stopOnEntry launch/attach attribute can be used to control if +execution is resumed at the start of the debug session. + +The --client-addr flag is a special flag that makes the server initiate a debug session +by dialing in to the host:port where a DAP client is waiting. This server process +will exit when the debug session ends. ``` -dlv dap +dlv dap [flags] +``` + +### Options + +``` + --client-addr string host:port where the DAP client is waiting for the DAP server to dial in + -h, --help help for dap ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -39,5 +59,6 @@ dlv dap ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_debug.md b/Documentation/usage/dlv_debug.md index c5ea8f7166..718ae476c6 100644 --- a/Documentation/usage/dlv_debug.md +++ b/Documentation/usage/dlv_debug.md @@ -4,7 +4,6 @@ Compile and begin debugging main package in current directory, or the package sp ### Synopsis - Compiles your program with optimizations disabled, starts and attaches to it. By default, with no arguments, Delve will compile the 'main' package in the @@ -13,13 +12,14 @@ package name and Delve will compile that package instead, and begin a new debug session. ``` -dlv debug [package] +dlv debug [package] [flags] ``` ### Options ``` --continue Continue the debugged process on start. + -h, --help help for debug --output string Output path for the binary. (default "./__debug_bin") --tty string TTY to use for the target program ``` @@ -27,13 +27,14 @@ dlv debug [package] ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -45,5 +46,6 @@ dlv debug [package] ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_exec.md b/Documentation/usage/dlv_exec.md index 350e41833a..38e0716bfd 100644 --- a/Documentation/usage/dlv_exec.md +++ b/Documentation/usage/dlv_exec.md @@ -4,7 +4,6 @@ Execute a precompiled binary, and begin a debug session. ### Synopsis - Execute a precompiled binary and begin a debug session. This command will cause Delve to exec the binary and immediately attach to it to @@ -14,26 +13,28 @@ consider compiling debugging binaries with -gcflags="all=-N -l" on Go 1.10 or later, -gcflags="-N -l" on earlier versions of Go. ``` -dlv exec +dlv exec [flags] ``` ### Options ``` --continue Continue the debugged process on start. + -h, --help help for exec --tty string TTY to use for the target program ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -45,5 +46,6 @@ dlv exec ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_log.md b/Documentation/usage/dlv_log.md index 503f6ed16c..39f92e158b 100644 --- a/Documentation/usage/dlv_log.md +++ b/Documentation/usage/dlv_log.md @@ -4,7 +4,6 @@ Help about logging flags. ### Synopsis - Logging can be enabled by specifying the --log flag and using the --log-output flag to select which components should produce logs. @@ -30,16 +29,23 @@ and dap modes. +### Options + +``` + -h, --help help for log +``` + ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -51,5 +57,6 @@ and dap modes. ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_redirect.md b/Documentation/usage/dlv_redirect.md index eda3926883..940b135931 100644 --- a/Documentation/usage/dlv_redirect.md +++ b/Documentation/usage/dlv_redirect.md @@ -4,7 +4,6 @@ Help about file redirection. ### Synopsis - The standard file descriptors of the target process can be controlled using the '-r' and '--tty' arguments. The --tty argument allows redirecting all standard descriptors to a terminal, specified as an argument to --tty. @@ -18,16 +17,23 @@ Where source is one of 'stdin', 'stdout' or 'stderr' and destination is the path File redirects can also be changed using the 'restart' command. +### Options + +``` + -h, --help help for redirect +``` + ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -39,5 +45,6 @@ File redirects can also be changed using the 'restart' command. ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_replay.md b/Documentation/usage/dlv_replay.md index 16b5fc0d85..fcc995b86d 100644 --- a/Documentation/usage/dlv_replay.md +++ b/Documentation/usage/dlv_replay.md @@ -4,7 +4,6 @@ Replays a rr trace. ### Synopsis - Replays a rr trace. The replay command will open a trace generated by mozilla rr. Mozilla rr must be installed: @@ -12,19 +11,26 @@ https://github.com/mozilla/rr ``` -dlv replay [trace directory] +dlv replay [trace directory] [flags] +``` + +### Options + +``` + -h, --help help for replay ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -36,5 +42,6 @@ dlv replay [trace directory] ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_run.md b/Documentation/usage/dlv_run.md index 979c1e9f3f..6ab4b67400 100644 --- a/Documentation/usage/dlv_run.md +++ b/Documentation/usage/dlv_run.md @@ -2,25 +2,27 @@ Deprecated command. Use 'debug' instead. -### Synopsis +``` +dlv run [flags] +``` - -Deprecated command. Use 'debug' instead. +### Options ``` -dlv run + -h, --help help for run ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -32,5 +34,6 @@ dlv run ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_test.md b/Documentation/usage/dlv_test.md index 87737be8a9..9da841160c 100644 --- a/Documentation/usage/dlv_test.md +++ b/Documentation/usage/dlv_test.md @@ -4,34 +4,39 @@ Compile test binary and begin debugging program. ### Synopsis - Compiles a test binary with optimizations disabled and begins a new debug session. The test command allows you to begin a new debug session in the context of your unit tests. By default Delve will debug the tests in the current directory. Alternatively you can specify a package name, and Delve will debug the tests in -that package instead. +that package instead. Double-dashes `--` can be used to pass arguments to the test program: + +dlv test [package] -- -test.v -other-argument + +See also: 'go help testflag'. ``` -dlv test [package] +dlv test [package] [flags] ``` ### Options ``` + -h, --help help for test --output string Output path for the binary. (default "debug.test") ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -43,5 +48,6 @@ dlv test [package] ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_trace.md b/Documentation/usage/dlv_trace.md index 8e7cc4d493..67a601561c 100644 --- a/Documentation/usage/dlv_trace.md +++ b/Documentation/usage/dlv_trace.md @@ -4,7 +4,6 @@ Compile and begin tracing program. ### Synopsis - Trace program execution. The trace sub command will set a tracepoint on every function matching the @@ -16,29 +15,32 @@ The output of the trace sub command is printed to stderr, so if you would like t only see the output of the trace operations you can redirect stdout. ``` -dlv trace [package] regexp +dlv trace [package] regexp [flags] ``` ### Options ``` + --ebpf Trace using eBPF (experimental). -e, --exec string Binary file to exec and trace. + -h, --help help for trace --output string Output path for the binary. (default "debug") -p, --pid int Pid to attach to. - -s, --stack int Show stack trace with given depth. + -s, --stack int Show stack trace with given depth. (Ignored with -ebpf) -t, --test Trace a test binary. ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -50,5 +52,6 @@ dlv trace [package] regexp ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Documentation/usage/dlv_version.md b/Documentation/usage/dlv_version.md index c0ab1f4b7e..b1d2101c7c 100644 --- a/Documentation/usage/dlv_version.md +++ b/Documentation/usage/dlv_version.md @@ -2,25 +2,28 @@ Prints version. -### Synopsis +``` +dlv version [flags] +``` - -Prints version. +### Options ``` -dlv version + -h, --help help for version + -v, --verbose print verbose version info ``` ### Options inherited from parent commands ``` - --accept-multiclient Allows a headless server to accept multiple client connections. + --accept-multiclient Allows a headless server to accept multiple client connections via JSON-RPC or DAP. --allow-non-terminal-interactive Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr - --api-version int Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) + --api-version int Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md. (default 1) --backend string Backend selection (see 'dlv help backend'). (default "default") - --build-flags string Build flags, to be passed to the compiler. - --check-go-version Checks that the version of Go in use is compatible with Delve. (default true) - --headless Run debug server only, in headless mode. + --build-flags string Build flags, to be passed to the compiler. For example: --build-flags="-tags=integration -mod=vendor -cover -v" + --check-go-version Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve. (default true) + --disable-aslr Disables address space randomization + --headless Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections. --init string Init file, executed by the terminal client. -l, --listen string Debugging server listen address. (default "127.0.0.1:0") --log Enable debugging server logging. @@ -32,5 +35,6 @@ dlv version ``` ### SEE ALSO + * [dlv](dlv.md) - Delve is a debugger for the Go programming language. diff --git a/Makefile b/Makefile index 813e0b3011..fef7998a18 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,15 @@ .DEFAULT_GOAL=test +SHELL := /bin/bash +GO_SRC := $(shell find . -type f -not -path './_fixtures/*' -not -path './vendor/*' -not -path './_scripts/*' -not -path './localtests/*' -name '*.go') + check-cert: @go run _scripts/make.go check-cert -build: +build: $(GO_SRC) @go run _scripts/make.go build -install: +install: $(GO_SRC) @go run _scripts/make.go install uninstall: @@ -27,4 +30,10 @@ test-integration-run: vendor: @go run _scripts/make.go vendor -.PHONY: vendor test-integration-run test-proc-run test check-cert install build vet +build-ebpf-image: + ./pkg/proc/internal/ebpf/build/build-ebpf-builder-img.sh + +build-ebpf-object: build-ebpf-image + ./pkg/proc/internal/ebpf/build/build-ebpf-objects.sh + +.PHONY: vendor test-integration-run test-proc-run test check-cert install build vet uninstall build-ebpf-image build-ebpf-object diff --git a/README.md b/README.md index a594e7b15b..a607a13a2e 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,13 @@ [![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/go-delve/delve/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-delve/delve?status.svg)](https://godoc.org/github.com/go-delve/delve) -[![Build Status](https://travis-ci.org/go-delve/delve.svg?branch=master)](https://travis-ci.org/go-delve/delve) +[![Build Status](https://delve.beta.teamcity.com/app/rest/builds/buildType:(id:Delve_AggregatorBuild)/statusIcon.svg)](https://delve.beta.teamcity.com/viewType.html?buildTypeId=Delve_AggregatorBuild&guest=1) The GitHub issue tracker is for **bugs** only. Please use the [developer mailing list](https://groups.google.com/forum/#!forum/delve-dev) for any feature proposals and discussions. ### About Delve - [Installation](Documentation/installation) - - [Linux](Documentation/installation/linux/install.md) - - [macOS](Documentation/installation/osx/install.md) - - [Windows](Documentation/installation/windows/install.md) - - [FreeBSD](Documentation/installation/freebsd/install.md) - [Getting Started](Documentation/cli/getting_started.md) - [Documentation](Documentation) - [Command line options](Documentation/usage/dlv.md) diff --git a/_fixtures/asmnilptr/main.go b/_fixtures/asmnilptr/main.go new file mode 100644 index 0000000000..97d6d1f792 --- /dev/null +++ b/_fixtures/asmnilptr/main.go @@ -0,0 +1,9 @@ +package main + +import "fmt" + +func asmFunc(*int) int + +func main() { + fmt.Printf("%d\n", asmFunc(nil)) +} diff --git a/_fixtures/asmnilptr/main_386.s b/_fixtures/asmnilptr/main_386.s new file mode 100644 index 0000000000..1b199d586b --- /dev/null +++ b/_fixtures/asmnilptr/main_386.s @@ -0,0 +1,7 @@ +#include "textflag.h" + +TEXT ·asmFunc(SB),0,$0-16 + MOVL arg+0(FP), AX + MOVL (AX), AX + MOVL AX, ret+4(FP) + RET diff --git a/_fixtures/asmnilptr/main_amd64.s b/_fixtures/asmnilptr/main_amd64.s new file mode 100644 index 0000000000..bc365a57d8 --- /dev/null +++ b/_fixtures/asmnilptr/main_amd64.s @@ -0,0 +1,7 @@ +#include "textflag.h" + +TEXT ·asmFunc(SB),0,$0-16 + MOVQ arg+0(FP), AX + MOVQ (AX), AX + MOVQ AX, ret+8(FP) + RET diff --git a/_fixtures/asmnilptr/main_arm64.s b/_fixtures/asmnilptr/main_arm64.s new file mode 100644 index 0000000000..fb57de19f6 --- /dev/null +++ b/_fixtures/asmnilptr/main_arm64.s @@ -0,0 +1,7 @@ +#include "textflag.h" + +TEXT ·asmFunc(SB),0,$0-16 + MOVD arg+0(FP), R5 + MOVD (R5), R5 + MOVD R5, ret+8(FP) + RET diff --git a/_fixtures/cat.go b/_fixtures/cat.go new file mode 100644 index 0000000000..eb4e91f4ec --- /dev/null +++ b/_fixtures/cat.go @@ -0,0 +1,15 @@ +package main + +import ( + "bufio" + "fmt" + "os" +) + +func main() { + s := bufio.NewScanner(os.Stdin) + for s.Scan() { + fmt.Printf("read %q\n", s.Text()) + } + os.Stdout.Close() +} diff --git a/_fixtures/databpcountstest.go b/_fixtures/databpcountstest.go new file mode 100644 index 0000000000..6a79a28b8b --- /dev/null +++ b/_fixtures/databpcountstest.go @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "math/rand" + "sync" + "time" +) + +var globalvar1 int + +func demo(id int, wait *sync.WaitGroup) { + for i := 0; i < 100; i++ { + sleep := rand.Intn(10) + 1 + fmt.Printf("id: %d step: %d sleeping %d\n", id, i, sleep) + globalvar1 = globalvar1 + 1 + time.Sleep(time.Duration(sleep) * time.Millisecond) + } + + wait.Done() +} + +func main() { + wait := new(sync.WaitGroup) + wait.Add(1) + wait.Add(1) + go demo(1, wait) + go demo(2, wait) + + wait.Wait() +} diff --git a/_fixtures/databpeasy.go b/_fixtures/databpeasy.go new file mode 100644 index 0000000000..cb071345ea --- /dev/null +++ b/_fixtures/databpeasy.go @@ -0,0 +1,48 @@ +package main + +import ( + "fmt" + "runtime" + "sync" + "time" +) + +var globalvar1 = 0 +var globalvar2 = 0 + +func main() { // Position 0 + runtime.LockOSThread() + globalvar2 = 1 + fmt.Printf("%d %d\n", globalvar1, globalvar2) + globalvar2 = globalvar1 + 1 + globalvar1 = globalvar2 + 1 + fmt.Printf("%d %d\n", globalvar1, globalvar2) // Position 1 + + globalvar2 = globalvar2 + 1 // Position 2 + globalvar2 = globalvar1 + globalvar2 // Position 3 + fmt.Printf("%d %d\n", globalvar1, globalvar2) + globalvar1 = globalvar2 + 1 + fmt.Printf("%d %d\n", globalvar1, globalvar2) + + done := make(chan struct{}) // Position 4 + var wg sync.WaitGroup + for i := 0; i < 20; i++ { + wg.Add(1) + go waitfunc(i, &wg) + } + wg.Wait() + go f(done) + <-done +} + +func f(done chan struct{}) { + runtime.LockOSThread() + globalvar1 = globalvar2 + 2 + close(done) // Position 5 +} + +func waitfunc(i int, wg *sync.WaitGroup) { + runtime.LockOSThread() + wg.Done() + time.Sleep(50 * time.Second) +} diff --git a/_fixtures/databpstack.go b/_fixtures/databpstack.go new file mode 100644 index 0000000000..e2c3330805 --- /dev/null +++ b/_fixtures/databpstack.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + // +) + +func f() { + w := 0 + + g(1000, &w) // Position 0 +} + +func g(cnt int, p *int) { + if cnt == 0 { + *p = 10 + return // Position 1 + } + g(cnt-1, p) +} + +func main() { + f() + fmt.Printf("done\n") // Position 2 +} diff --git a/_fixtures/fatalerror.go b/_fixtures/fatalerror.go new file mode 100644 index 0000000000..ad1e9bfa17 --- /dev/null +++ b/_fixtures/fatalerror.go @@ -0,0 +1,6 @@ +package main + +func main() { + var f func() + go f() +} diff --git a/_fixtures/fncall.go b/_fixtures/fncall.go index 6824fcf8bb..326ebade0e 100644 --- a/_fixtures/fncall.go +++ b/_fixtures/fncall.go @@ -2,10 +2,13 @@ package main import ( "fmt" + "os" "runtime" "strings" ) +var call = "this is a variable named `call`" + func callstacktrace() (stacktrace string) { for skip := 0; ; skip++ { pc, file, line, ok := runtime.Caller(skip) @@ -18,16 +21,35 @@ func callstacktrace() (stacktrace string) { return stacktrace } +func call0(a, b int) { + fmt.Printf("call0: first: %d second: %d\n", a, b) +} + func call1(a, b int) int { fmt.Printf("first: %d second: %d\n", a, b) return a + b } +func call2(a, b int) (int, int) { + fmt.Printf("call2: first: %d second: %d\n", a, b) + return a, b +} + +func callexit() { + fmt.Printf("about to exit\n") + os.Exit(0) +} + func callpanic() { fmt.Printf("about to panic\n") panic("callpanic panicked") } +func callbreak() { + fmt.Printf("about to break") + runtime.Breakpoint() +} + func stringsJoin(v []string, sep string) string { // This is needed because strings.Join is in an optimized package and // because of a bug in the compiler arguments of optimized functions don't @@ -146,6 +168,25 @@ func (_ X2) CallMe(i int) int { return i * i } +func regabistacktest(s1, s2, s3, s4, s5 string, n uint8) (string, string, string, string, string, uint8) { + return s1 + s2, s2 + s3, s3 + s4, s4 + s5, s5 + s1, 2 * n +} + +func regabistacktest2(n1, n2, n3, n4, n5, n6, n7, n8, n9, n10 int) (int, int, int, int, int, int, int, int, int, int) { + return n1 + n2, n2 + n3, n3 + n4, n4 + n5, n5 + n6, n6 + n7, n7 + n8, n8 + n9, n9 + n10, n10 + n1 +} + +type Issue2698 struct { + a uint32 + b uint8 + c uint8 + d uintptr +} + +func (i Issue2698) String() string { + return fmt.Sprintf("%d %d %d %d", i.a, i.b, i.c, i.d) +} + func main() { one, two := 1, 2 intslice := []int{1, 2, 3} @@ -156,12 +197,18 @@ func main() { a2 := a2struct{Y: 7} var pa2 *astruct var str string = "old string value" - + longstrs := []string{"very long string 0123456789a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789g012345678h90123456789i0123456789j0123456789"} var vable_a VRcvrable = a var vable_pa VRcvrable = pa var pable_pa PRcvrable = pa var x X = 2 var x2 X2 = 2 + issue2698 := Issue2698{ + a: 1, + b: 2, + c: 3, + d: 4, + } fn2clos := makeclos(pa) fn2glob := call1 @@ -171,12 +218,12 @@ func main() { d := &Derived{3, Base{4}} - runtime.Breakpoint() + runtime.Breakpoint() // breakpoint here call1(one, two) fn2clos(2) strings.LastIndexByte(stringslice[1], 'w') d.Method() d.Base.Method() x.CallMe() - fmt.Println(one, two, zero, callpanic, callstacktrace, stringsJoin, intslice, stringslice, comma, a.VRcvr, a.PRcvr, pa, vable_a, vable_pa, pable_pa, fn2clos, fn2glob, fn2valmeth, fn2ptrmeth, fn2nil, ga, escapeArg, a2, square, intcallpanic, onetwothree, curriedAdd, getAStruct, getAStructPtr, getVRcvrableFromAStruct, getPRcvrableFromAStructPtr, getVRcvrableFromAStructPtr, pa2, noreturncall, str, d, x, x2.CallMe(5)) + fmt.Println(one, two, zero, call, call0, call2, callexit, callpanic, callbreak, callstacktrace, stringsJoin, intslice, stringslice, comma, a.VRcvr, a.PRcvr, pa, vable_a, vable_pa, pable_pa, fn2clos, fn2glob, fn2valmeth, fn2ptrmeth, fn2nil, ga, escapeArg, a2, square, intcallpanic, onetwothree, curriedAdd, getAStruct, getAStructPtr, getVRcvrableFromAStruct, getPRcvrableFromAStructPtr, getVRcvrableFromAStructPtr, pa2, noreturncall, str, d, x, x2.CallMe(5), longstrs, regabistacktest, regabistacktest2, issue2698.String()) } diff --git a/_fixtures/fputest/fputest.go b/_fixtures/fputest/fputest.go index 9e3d44253d..cbc9ea1f96 100644 --- a/_fixtures/fputest/fputest.go +++ b/_fixtures/fputest/fputest.go @@ -5,7 +5,7 @@ import ( "runtime" ) -func fputestsetup(f64a, f64b, f64c, f64d float64, f32a, f32b, f32c, f32d float32, avx2, avx512 bool) +func fputestsetup(f64a, f64b, f64c, f64d float64, f32a, f32b, f32c, f32d float32, avx2, avx512, dobreak bool) func getCPUID70() (ebx, ecx uint32) func main() { @@ -22,7 +22,7 @@ func main() { avx2 := ebx&(1<<5) != 0 avx512 := ebx&(1<<16) != 0 - fputestsetup(f64a, f64b, f64c, f64d, f32a, f32b, f32c, f32d, avx2, avx512) + fputestsetup(f64a, f64b, f64c, f64d, f32a, f32b, f32c, f32d, avx2, avx512, len(os.Args) < 2 || os.Args[1] != "panic") if len(os.Args) < 2 || os.Args[1] != "panic" { runtime.Breakpoint() } else { diff --git a/_fixtures/fputest/fputest_amd64.s b/_fixtures/fputest/fputest_amd64.s index 83427eba2f..753c5acb90 100644 --- a/_fixtures/fputest/fputest_amd64.s +++ b/_fixtures/fputest/fputest_amd64.s @@ -56,6 +56,8 @@ TEXT ·fputestsetup(SB),$0-50 MOVAPS X1, X9 MOVAPS X2, X10 + MOVQ $42, AX + CMPB avx2+48(FP), $0x0 JE done //copy XMM1 to both halves of YMM11 @@ -67,6 +69,11 @@ TEXT ·fputestsetup(SB),$0-50 VSHUFF64X2 $0x44, Z11, Z11, Z12 done: + CMPB dobreak+50(FP), $0x0 + JE return + BYTE $0xcc // INT 3 + +return: RET TEXT ·getCPUID70(SB),$0 diff --git a/_fixtures/genericbp.go b/_fixtures/genericbp.go new file mode 100644 index 0000000000..b3f43d8d55 --- /dev/null +++ b/_fixtures/genericbp.go @@ -0,0 +1,12 @@ +package main + +import "fmt" + +func testfn[T any](arg T) { + fmt.Println(arg) +} + +func main() { + testfn[uint16](1) + testfn[float64](2.1) +} diff --git a/_fixtures/goroutinebreak.go b/_fixtures/goroutinebreak.go new file mode 100644 index 0000000000..438d1ed80e --- /dev/null +++ b/_fixtures/goroutinebreak.go @@ -0,0 +1,26 @@ +package main + +import "runtime" + +const N = 10 + +func agoroutine(started chan<- struct{}, done chan<- struct{}, i int) { + started <- struct{}{} + done <- struct{}{} +} + +func main() { + done := make(chan struct{}) + started := make(chan struct{}) + for i := 0; i < N; i++ { + runtime.Breakpoint() + go agoroutine(started, done, i) + } + for i := 0; i < N; i++ { + <-started + } + runtime.Gosched() + for i := 0; i < N; i++ { + <-done + } +} diff --git a/_fixtures/goroutinegroup.go b/_fixtures/goroutinegroup.go new file mode 100644 index 0000000000..7b5bad866b --- /dev/null +++ b/_fixtures/goroutinegroup.go @@ -0,0 +1,75 @@ +package main + +import ( + "context" + "runtime" + "runtime/pprof" + "sync" + "time" +) + +func sleepyfunc(wg *sync.WaitGroup, lbl string) { + defer wg.Done() + pprof.SetGoroutineLabels(pprof.WithLabels(context.Background(), pprof.Labels("name", lbl))) + time.Sleep(10 * 60 * time.Second) +} + +func gopoint1(wg *sync.WaitGroup, lbl string, f func(*sync.WaitGroup, string)) { + go f(wg, lbl) +} + +func gopoint2(wg *sync.WaitGroup, lbl string, f func(*sync.WaitGroup, string)) { + go f(wg, lbl) +} + +func gopoint3(wg *sync.WaitGroup, lbl string, f func(*sync.WaitGroup, string)) { + go f(wg, lbl) +} + +func gopoint4(wg *sync.WaitGroup, lbl string, f func(*sync.WaitGroup, string)) { + go f(wg, lbl) +} + +func gopoint5(wg *sync.WaitGroup, lbl string, f func(*sync.WaitGroup, string)) { + go f(wg, lbl) +} + +func startpoint1(wg *sync.WaitGroup, lbl string) { + sleepyfunc(wg, lbl) +} + +func startpoint2(wg *sync.WaitGroup, lbl string) { + sleepyfunc(wg, lbl) +} + +func startpoint3(wg *sync.WaitGroup, lbl string) { + sleepyfunc(wg, lbl) +} + +func startpoint4(wg *sync.WaitGroup, lbl string) { + sleepyfunc(wg, lbl) +} + +func startpoint5(wg *sync.WaitGroup, lbl string) { + sleepyfunc(wg, lbl) +} + +func main() { + var wg sync.WaitGroup + + for _, lbl := range []string{"one", "two", "three", "four", "five"} { + for _, f := range []func(*sync.WaitGroup, string){startpoint1, startpoint2, startpoint3, startpoint4, startpoint5} { + for i := 0; i < 1000; i++ { + wg.Add(5) + gopoint1(&wg, lbl, f) + gopoint2(&wg, lbl, f) + gopoint3(&wg, lbl, f) + gopoint4(&wg, lbl, f) + gopoint5(&wg, lbl, f) + } + } + } + time.Sleep(2 * time.Second) + runtime.Breakpoint() + wg.Wait() +} diff --git a/_fixtures/issue2162.go b/_fixtures/issue2162.go new file mode 100644 index 0000000000..5b579031f1 --- /dev/null +++ b/_fixtures/issue2162.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("test dlv") +} diff --git a/_fixtures/issue2319/README.txt b/_fixtures/issue2319/README.txt new file mode 100644 index 0000000000..e9f7e5c131 --- /dev/null +++ b/_fixtures/issue2319/README.txt @@ -0,0 +1,57 @@ + +Note: +----- + +cfile-linux-amd64.syso was generated from the C source file that appears below. + +Build with Clang version 10: + + $ clang-10 -O -gdwarf-5 -c cfile.c -o cfile.syso + +The DWARF of interest is for the function "qtop". Triggering the bug +requires that the source file in question appears as the first item +in the DWARF line table file section, e.g. + +$ llvm-dwarfdump-10 --debug-line cfile.syso +.... +standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0 +standard_opcode_lengths[DW_LNS_set_isa] = 1 +include_directories[ 0] = "/ssd2/go1/src/tmp/dlvbug" +file_names[ 0]: + name: "cfile.c" + dir_index: 0 + md5_checksum: ... + + +// ------------------------begin source code for cfile.c---------------- + +#include +#include + +int glob = 99; + +inline int qleaf(int lx, int ly, int *lv) +{ + lv[lx&3] += 3; + return lv[ly&3]; +} + +int qmid(int mx, int my, int *lv, int *mv) +{ + mv[mx&3] += qleaf(mx, my, lv); + return mv[my&3]; +} + +int qtop(int mx, int my) +{ + int mv[64], lv[66], n = (mx < 64 ? 64 : mx); + + memset(&mv[0], 9, sizeof(mv)); + memset(&lv[0], 11, sizeof(mv)); + return qmid(mx, my, lv, mv) + qleaf(mx, my, lv); +} + +void Cfunc(int x) { + glob += qtop(x, 43); +} + diff --git a/_fixtures/issue2319/asm-linux-amd64.s b/_fixtures/issue2319/asm-linux-amd64.s new file mode 100644 index 0000000000..81dbd16c6c --- /dev/null +++ b/_fixtures/issue2319/asm-linux-amd64.s @@ -0,0 +1,5 @@ + +#include "textflag.h" + +TEXT ·cfunc(SB),$0 + JMP Cfunc(SB) diff --git a/_fixtures/issue2319/cfile-linux-amd64.syso b/_fixtures/issue2319/cfile-linux-amd64.syso new file mode 100644 index 0000000000000000000000000000000000000000..f92d43a5a624068bd322e88b093b1c2df2a35cd7 GIT binary patch literal 5840 zcmd^DU2I%e5uUsE-reh6uXk-HO57y%HnkzabZw_r8$p|Fs6*`3P&aM!Q-QYY^{(r7 z?RC5x$FY#&;6N!(CHEns4^(lbA|6msf&vm%id+?y2M`JfA$R~HKu`%Dir@u-2=m=L zV_%;*tpvO=(m6Bpotbmy%$a-c-93A7=#vr4A|;FV(VC_x(T(()ob$yTZDq@aKiUh< z8}`B<>_z8Wmh;_3=jz+#Y^wddZ&O|xIQQpQc)rvw7eH$F`Hm&w%fhb+UlD#o_)X#O z2}fA)PYcfo?-8C8J}mqh;Zwrr!8MHjj``H?{*EPd%jmA4TS0dN-A#1wrFJ_V5Yp%} z=z7rQ&<&$|2Hh0rV6p%D{7VD&i$mAvk&2;f^VWsy*y+Mb^hF+9?7uc|pT7oV;N16- zk+;jK_I_ypZ~0jq>bPJgr{jWszT>N$9Lp~gO%VeP1|SU(3C)<BlSYtzNZJyz}Q23nt( z>K?7kjGP*yu}XD>#wY7^vQjFPsWMBIGgO(OlM~~kG%-sPXJ~@8dUcBO`2$Ce95|7G zV({sM`6o{dAI#@zk{&6ank>>R{gij)l1I(Vxt{1Sw_$EaxqXHk67U?iX>N1eKF{sT z+%9r^mD|_2UFP;}ZY$gzvaP4Mk6TZ!moqO!Fp#+z!N~cD@&GpV<;WWm=k)y9OXRFX zzV5*D2f|->0$ur=&aWIXg=jZ-T_UU5>g;TF?at{f=`Gtjo42(@Yg;Z@TZkfkWOoj> z?r-~8;^T?PRwBEDfqi`L9DCNXJAr?=4Hg-OT$e`y4Ym?RQv?>vT9`1mb*`oz^zKP!Y4)+b#D%6^*7`2LGX?; zi5HihB&k(*;tRYJpEotq=GQo)CXY5>1y9jt7*Yy-`Z7Z~YHspkYx*as#ofWUbu3NW zTNBN+9j0+?J?e2sI}%hCWX-0nZH+Mxm5^r4F9GIi!w)<4a08*D=up$L zZMRr_JiaaNc@Xj+jBWPEfZgDRYw|(nmSz2;DG3HcZY;Dz9doT>&269WAq_66@Ao=GjEI@aN`fVHj5Pfk!#0KM_#a6 zUC%xlIckaJWwCtBo~yg@Q*OJRI?Nt*_V^`xR85a~^s?Ky&e)rEt+9y5LErJ^vhEdx zechRU&O;9U<(6r&)6W5K*`T!GIG-@J37!dqEXM@ba|;jKw3^N^Og2T=>8jX#ejAZZ z4I9BcPy7zJf3Mv(W)m*o+sP*XepxqwdTQbLbN>FM<{0}mw`Q(1CC%Uu8GyZ#*7Rw? zGcw@UHOn6n9Uf@^ycN*Z5N?O?!x9H#UGbYz)~SxGmOls%p$*p0#f{L z(X|c~?-E@1r+B~Mc!oiW4+iS$v#$831kVUp{0Y%J4E(6*yA1q<=pQw3d>VnYE_MDw z08^iE#YaWoYv5y|KV;y~iJmj?s_2>zoqs{_0mJ?aqU+tJ_KSk+839LA!sj3eSd5$6 zX(a>KGi8z5(J=wXTSD#c1;_*(Pnr7YILZt4qonl!Jp2^vxhtL#2jz-85SVra47amC zPeyP(FU9rw({oY$kl5#pc{-%-2MqjS!83wG4acwbpt#x%8}=H{PQj74@NJVdaQ_|8 zm>G|l5oJe9{Cgo^7#W!^%}{o_R4HWZrP(@Vi`9vV690k_i%PXv8L!oAViUO4>eKmZ zxm+s&Uxiexj8B&GY_iU!FgiLN{O|}C3%tfB%T>xwR_mqgp-(?`U#(s!K2O<7Wo9A| zhuZkqx=Apz0HtU1<>|siDfnp<{A|&mNB*y%EJsi;j8L|AX2R#Ag?fRVtKivUt={_p zWrrRa9^8}f4TN45_T+mM(ZX0w+!falroZe46`zlrfm}a0^qPZ0Myh z$g-}l{N4~2HhoL{@x2r#^-~PGiDB$3vZ;Tmp>Wgo9OEVi(~I&+aZ2(i?zh=~jt4f% z--=v9;ra>R^IAX8v;Rix$0gApbbjSKtiQJ@i1-%)^XnHOndf&GV_4rjzo*4e-%~Qp zYOESF&R1o%0Y9S)g+Z20+qVL2%1ATKi~qBRzd7x79^WYcX}LcJ#2@vGceMIz{;x1* z#srsl#qeiPLS)*0gU2>n|M&*$<7?MkAKy`!)6D;M`NaMZkA+FsSB}4w?4es#X7gb? fy+0Mh{z2*&XheTv!OT6z-j((B`G+4$%8dWtKld}) literal 0 HcmV?d00001 diff --git a/_fixtures/issue2319/main.go b/_fixtures/issue2319/main.go new file mode 100644 index 0000000000..56bf801af9 --- /dev/null +++ b/_fixtures/issue2319/main.go @@ -0,0 +1,7 @@ +package main + +func cfunc() + +func main() { + cfunc() +} diff --git a/_fixtures/locationsprog_generic.go b/_fixtures/locationsprog_generic.go new file mode 100644 index 0000000000..a622a51604 --- /dev/null +++ b/_fixtures/locationsprog_generic.go @@ -0,0 +1,24 @@ +package main + +import "fmt" + +type ParamReceiver[T any] struct { + field T +} + +func (r *ParamReceiver[T]) Amethod() { + fmt.Printf("%v\n", r.field) +} + +func ParamFunc[T any](arg T) { + fmt.Printf("%v\n", arg) +} + +func main() { + var x ParamReceiver[int] + var y ParamReceiver[float64] + x.Amethod() + y.Amethod() + ParamFunc[int](2) + ParamFunc[float32](2) +} diff --git a/_fixtures/longstrings.go b/_fixtures/longstrings.go new file mode 100644 index 0000000000..8ad14dbe35 --- /dev/null +++ b/_fixtures/longstrings.go @@ -0,0 +1,22 @@ +package main + +import ( + "runtime" +) + +func buildString(length int) string { + s := "" + for i := 0; i < length; i++ { + s = s + "x" + } + return s +} + +func main() { + s513 := buildString(513) + s1025 := buildString(1025) + s4097 := buildString(4097) + nested := map[int]string{513: s513, 1025: s1025, 4097: s4097} + runtime.Breakpoint() + _ = nested +} diff --git a/_fixtures/loopprog.go b/_fixtures/loopprog.go index 063e20f582..c795674b39 100644 --- a/_fixtures/loopprog.go +++ b/_fixtures/loopprog.go @@ -6,7 +6,7 @@ func loop() { i := 0 for { i++ - if (i % 100000) == 0 { + if (i % 1000000) == 0 { fmt.Println(i) } } diff --git a/_fixtures/morestringarg.go b/_fixtures/morestringarg.go new file mode 100644 index 0000000000..888273544b --- /dev/null +++ b/_fixtures/morestringarg.go @@ -0,0 +1,11 @@ +package main + +import "fmt" + +func f(s, q string) { + fmt.Println(s) +} + +func main() { + f("very long string 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789X", "very long string B 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789X2") +} diff --git a/_fixtures/setymmreg/main.go b/_fixtures/setymmreg/main.go new file mode 100644 index 0000000000..fe8d642039 --- /dev/null +++ b/_fixtures/setymmreg/main.go @@ -0,0 +1,7 @@ +package main + +func asmFunc() + +func main() { + asmFunc() +} diff --git a/_fixtures/setymmreg/setymmreg_amd64.s b/_fixtures/setymmreg/setymmreg_amd64.s new file mode 100644 index 0000000000..5f7ed2f788 --- /dev/null +++ b/_fixtures/setymmreg/setymmreg_amd64.s @@ -0,0 +1,9 @@ +#include "textflag.h" + +TEXT ·asmFunc(SB),0,$0-0 + XORQ AX, AX + XORQ AX, AX + XORQ AX, AX + XORQ AX, AX + XORQ AX, AX + RET diff --git a/_fixtures/sigchldprog.go b/_fixtures/sigchldprog.go index 417e149816..130c3c678d 100644 --- a/_fixtures/sigchldprog.go +++ b/_fixtures/sigchldprog.go @@ -13,12 +13,13 @@ func main() { if err != nil { log.Fatalln(err) } + defer reader.Close() + scanner := bufio.NewScanner(reader) go func() { for scanner.Scan() { fmt.Println(scanner.Text()) } - reader.Close() }() cmd.Start() cmd.Wait() diff --git a/_fixtures/testenv.go b/_fixtures/testenv.go index fdd55ea50c..98cf58b8af 100644 --- a/_fixtures/testenv.go +++ b/_fixtures/testenv.go @@ -7,7 +7,7 @@ import ( ) func main() { - x := os.Getenv("SOMEVAR") + x, y := os.LookupEnv("SOMEVAR") runtime.Breakpoint() - fmt.Printf("SOMEVAR=%s\n", x) + fmt.Printf("SOMEVAR=%s\n%v", x, y) } diff --git a/_fixtures/teststepprog.go b/_fixtures/teststepprog.go index 76971c8bc4..69aefabbb7 100644 --- a/_fixtures/teststepprog.go +++ b/_fixtures/teststepprog.go @@ -2,12 +2,12 @@ package main var n = 0 -func CallFn2() { +func CallFn2(x int) { n++ } -func CallFn(fn func()) { - fn() +func CallFn(x int, fn func(x int)) { + fn(x + 1) } func CallEface(eface interface{}) { @@ -17,6 +17,6 @@ func CallEface(eface interface{}) { } func main() { - CallFn(CallFn2) + CallFn(0, CallFn2) CallEface(n) } diff --git a/_fixtures/testtoggle.go b/_fixtures/testtoggle.go new file mode 100644 index 0000000000..aa5bf2362b --- /dev/null +++ b/_fixtures/testtoggle.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" +) + +func lineOne() { + fmt.Println("lineOne function") +} + +func lineTwo() { + fmt.Println("lineTwo function") +} + +func lineThree() { + fmt.Println("lineThree function") +} + +func main() { + lineOne() + lineTwo() + lineThree() +} diff --git a/_fixtures/testvariables.go b/_fixtures/testvariables.go index c086e981ac..41bbf429b0 100644 --- a/_fixtures/testvariables.go +++ b/_fixtures/testvariables.go @@ -1,7 +1,9 @@ package main -import "fmt" -import "runtime" +import ( + "fmt" + "runtime" +) type FooBar struct { Baz int @@ -54,13 +56,15 @@ func foobar(baz string, bar FooBar) { c128 = complex(float64(2), float64(3)) i32 = [2]int32{1, 2} f = barfoo - ms = Nest{0, &Nest{1, &Nest{2, &Nest{3, &Nest{4, nil}}}}} // Test recursion capping + ms = Nest{0, &Nest{1, &Nest{2, &Nest{3, &Nest{4, nil}}}}} // Test recursion capping on structs + ni = []interface{}([]interface{}{[]interface{}{123}}) // Test recursion capping on interfaces ba = make([]int, 200, 200) // Test array size capping + mp = map[int]interface{}{1: 42, 2: 43} ) runtime.Breakpoint() barfoo() - fmt.Println(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, b1, b2, baz, neg, i8, u8, u16, u32, u64, up, f32, c64, c128, i32, bar, f, ms, ba, p1) + fmt.Println(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, b1, b2, baz, neg, i8, u8, u16, u32, u64, up, f32, c64, c128, i32, bar, f, ms, ni, ba, p1, mp) } var p1 = 10 diff --git a/_fixtures/testvariables2.go b/_fixtures/testvariables2.go index 99caa7b39c..ae60ff9900 100644 --- a/_fixtures/testvariables2.go +++ b/_fixtures/testvariables2.go @@ -8,6 +8,8 @@ import ( "unsafe" ) +type Byte byte + type astruct struct { A int B int @@ -106,12 +108,45 @@ type List struct { Next *List } +type T struct { + F string +} + +type W1 struct { + T +} + +func (*W1) M() {} + +type I interface{ M() } + +type W2 struct { + W1 + T +} + +type W3 struct { + I + T +} + +type W4 struct { + I +} + +type W5 struct { + *W5 +} + +var _ I = (*W2)(nil) + func main() { i1 := 1 i2 := 2 f1 := 3.0 i3 := 3 p1 := &i1 + pp1 := &p1 s1 := []string{"one", "two", "three", "four", "five"} s3 := make([]int, 0, 6) a0 := [0]int{} @@ -282,22 +317,28 @@ func main() { zsvmap := map[string]struct{}{"testkey": struct{}{}} var tm truncatedMap tm.v = []map[string]astruct{m1} + var rettm = func() truncatedMap { return tm } emptyslice := []string{} emptymap := make(map[string]string) byteslice := []byte{116, 195, 168, 115, 116} + bytestypeslice := []Byte{116, 195, 168, 115, 116} runeslice := []rune{116, 232, 115, 116} bytearray := [5]byte{116, 195, 168, 115, 116} + bytetypearray := [5]Byte{116, 195, 168, 115, 116} runearray := [4]rune{116, 232, 115, 116} longstr := "very long string 0123456789a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789g012345678h90123456789i0123456789j0123456789" - + m5 := map[C]int{{longstr}: 1} + m6 := map[string]int{longstr: 123} + m7 := map[C]C{{longstr}: {"hello"}} + cl := C{s: longstr} var nilstruct *astruct = nil + val := A{val: 1} // val vs val.val var as2 astruct - s4 := []int{1, 2, 3, 4, 5, 6, 7, 8, 9, 0} var iface2map interface{} = map[string]interface{}{ @@ -312,12 +353,21 @@ func main() { ll := &List{0, &List{1, &List{2, &List{3, &List{4, nil}}}}} unread := (*int)(unsafe.Pointer(uintptr(12345))) + w2 := &W2{W1{T{"T-inside-W1"}}, T{"T-inside-W2"}} + w3 := &W3{&W1{T{"T-inside-W1"}}, T{"T-inside-W3"}} + w4 := &W4{&W1{T{"T-inside-W1"}}} + w5 := &W5{nil} + w5.W5 = w5 + var amb1 = 1 runtime.Breakpoint() for amb1 := 0; amb1 < 10; amb1++ { fmt.Println(amb1) } + longarr := [100]int{} + longslice := make([]int, 100, 100) + runtime.Breakpoint() - fmt.Println(i1, i2, i3, p1, amb1, s1, s3, a0, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, m4, upnil, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2, bencharr, benchparr, mapinf, mainMenu, b, b2, sd, anonstruct1, anonstruct2, anoniface1, anonfunc, mapanonstruct1, ifacearr, efacearr, ni8, ni16, ni32, ni64, pinf, ninf, nan, zsvmap, zsslice, zsvar, tm, errtypednil, emptyslice, emptymap, byteslice, runeslice, bytearray, runearray, longstr, nilstruct, as2, as2.NonPointerRecieverMethod, s4, iface2map, issue1578, ll, unread) + fmt.Println(i1, i2, i3, p1, pp1, amb1, s1, s3, a0, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, m4, m5, upnil, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2, bencharr, benchparr, mapinf, mainMenu, b, b2, sd, anonstruct1, anonstruct2, anoniface1, anonfunc, mapanonstruct1, ifacearr, efacearr, ni8, ni16, ni32, ni64, pinf, ninf, nan, zsvmap, zsslice, zsvar, tm, rettm, errtypednil, emptyslice, emptymap, byteslice, bytestypeslice, runeslice, bytearray, bytetypearray, runearray, longstr, nilstruct, as2, as2.NonPointerRecieverMethod, s4, iface2map, issue1578, ll, unread, w2, w3, w4, w5, longarr, longslice, val, m6, m7, cl) } diff --git a/_fixtures/testvariables_generic.go b/_fixtures/testvariables_generic.go new file mode 100644 index 0000000000..25860026c5 --- /dev/null +++ b/_fixtures/testvariables_generic.go @@ -0,0 +1,22 @@ +package main + +import ( + "fmt" + "runtime" +) + +type astruct struct { + x, y int +} + +func testfn[T any, K comparable](arg1 T, arg2 K) { + m := make(map[K]T) + m[arg2] = arg1 + runtime.Breakpoint() + fmt.Println(arg1, arg2, m) +} + +func main() { + testfn[int, float32](3, 2.1) + testfn(&astruct{0, 1}, astruct{2, 3}) +} diff --git a/_scripts/gen-backend_test_health.go b/_scripts/gen-backend_test_health.go new file mode 100644 index 0000000000..387f1593de --- /dev/null +++ b/_scripts/gen-backend_test_health.go @@ -0,0 +1,110 @@ +package main + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "io" + "log" + "os" + "sort" + "strconv" + "strings" +) + +func main() { + f, err := parser.ParseFile(new(token.FileSet), "pkg/proc/proc_test.go", nil, 0) + if err != nil { + log.Fatalf("could not compile proc_test.go: %v", err) + } + ntests := 0 + skipped := make(map[string]map[string]int) + ast.Inspect(f, func(node ast.Node) bool { + switch node := node.(type) { + case *ast.File: + return true + case *ast.FuncDecl: + if !strings.HasPrefix(node.Name.Name, "Test") { + return false + } + ntests++ + stmtLoop: + for _, stmt := range node.Body.List { + expr, isexpr := stmt.(*ast.ExprStmt) + if !isexpr { + continue + } + call, ok := expr.X.(*ast.CallExpr) + if !ok { + return false + } + fun, ok := call.Fun.(*ast.Ident) + if !ok { + return false + } + switch fun.Name { + case "skipOn": + reason, conditions := skipOnArgs(call.Args) + if reason == "N/A" { + ntests-- + break stmtLoop + } + if skipped[conditions] == nil { + skipped[conditions] = make(map[string]int) + } + skipped[conditions][reason]++ + case "skipUnlessOn": + ntests-- + break stmtLoop + } + } + } + return false + }) + var fh io.WriteCloser + if len(os.Args) > 1 && os.Args[1] == "-" { + fh = os.Stdout + } else { + fh, err = os.Create("./Documentation/backend_test_health.md") + if err != nil { + log.Fatalf("could not create backend_test_health.md: %v", err) + } + } + fmt.Fprintf(fh, "Tests skipped by each supported backend:\n\n") + conds := []string{} + for cond := range skipped { + conds = append(conds, cond) + } + sort.Strings(conds) + for _, cond := range conds { + tot := 0 + for _, v := range skipped[cond] { + tot += v + } + fmt.Fprintf(fh, "* %s skipped = %d\n", cond, tot) + reasons := []string{} + for reason := range skipped[cond] { + reasons = append(reasons, reason) + } + sort.Strings(reasons) + for _, reason := range reasons { + fmt.Fprintf(fh, "\t* %d %s\n", skipped[cond][reason], reason) + } + } + err = fh.Close() + if err != nil { + log.Fatalf("could not close output file: %v", err) + } +} + +func skipOnArgs(args []ast.Expr) (reason string, conditions string) { + reason, _ = strconv.Unquote(args[1].(*ast.BasicLit).Value) + conds := []string{} + for _, arg := range args[2:] { + cond, _ := strconv.Unquote(arg.(*ast.BasicLit).Value) + conds = append(conds, cond) + } + conditions = strings.Join(conds, "/") + return reason, conditions +} diff --git a/_scripts/gen-starlark-bindings.go b/_scripts/gen-starlark-bindings.go index 91e0d069cc..8706b2ead5 100644 --- a/_scripts/gen-starlark-bindings.go +++ b/_scripts/gen-starlark-bindings.go @@ -111,6 +111,8 @@ func processServerMethods(serverMethods []*types.Func) []binding { name = "set_expr" case "command": name = "raw_command" + case "create_e_b_p_f_tracepoint": + name = "create_ebpf_tracepoint" default: // remove list_ prefix, it looks better const listPrefix = "list_" diff --git a/_scripts/gen-travis.go b/_scripts/gen-travis.go index 7e5be0ad6c..a6028c92ec 100644 --- a/_scripts/gen-travis.go +++ b/_scripts/gen-travis.go @@ -55,95 +55,41 @@ func main() { } } - out := bufio.NewWriter(os.Stdout) - err := template.Must(template.New("travis.yml").Parse(`language: go -sudo: required -go_import_path: github.com/go-delve/delve - -os: - - linux - - osx - - windows - -arch: - - amd64 - - arm64 - -go: -{{- range .GoVersions}} - - {{.DotX}} -{{- end}} - - tip - -matrix: - allow_failures: - - go: tip - exclude: - - os: osx - arch: arm64 - - os: windows - arch: arm64 -{{- /* Exclude all testing on anything except the most recent version of Go for anything that isn't (GOOS=linux, GOARCH=amd64)*/ -}} -{{- range .GoVersions}}{{if not .MaxVersion}} - - os: windows - go: {{.DotX}} -{{- end}}{{end -}} -{{- range .GoVersions}}{{if not .MaxVersion}} - - os: osx - go: {{.DotX}} -{{- end}}{{end -}} -{{- range .GoVersions}}{{if not .MaxVersion}} - - arch: arm64 - go: {{.DotX}} -{{- end}}{{end}} - - os: windows - go: tip - - arch: arm64 - go: tip - -before_install: - - export GOFLAGS=-mod=vendor - - if [ $TRAVIS_OS_NAME = "linux" ]; then sudo apt-get -qq update; sudo apt-get install -y dwz; echo "dwz version $(dwz --version)"; fi - - if [ $TRAVIS_OS_NAME = "windows" ]; then choco install procdump make; fi - - -# 386 linux + githubfh, err := os.Create(".github/workflows/test.yml") + if err != nil { + fmt.Fprintf(os.Stderr, "Could not create .github/test.yml: %v", err) + os.Exit(1) + } + out := bufio.NewWriter(githubfh) + err = template.Must(template.New(".github/workflows/test.yml").Parse(`name: Delve CI + +on: [push, pull_request] + jobs: - include: - - os: linux - services: docker - env: go_32_version={{index .GoVersions 1}} # Linux/i386 tests held back to Go1.14 until issue #2134 is fixed - -script: >- - if [ $TRAVIS_OS_NAME = "linux" ] && [ $go_32_version ]; then - docker pull i386/centos:7; - docker run \ - -v $(pwd):/delve \ - --env TRAVIS=true \ - --env CI=true \ - --privileged i386/centos:7 \ - /bin/bash -c "set -x && \ - cd delve && \ - yum -y update && yum -y upgrade && \ - yum -y install wget make git gcc && \ - wget -q https://dl.google.com/go/go${go_32_version}.linux-386.tar.gz && \ - tar -C /usr/local -xzf go${go_32_version}.linux-386.tar.gz && \ - export PATH=$PATH:/usr/local/go/bin && \ - go version && \ - uname -a && \ - make test"; - else - make test; - fi - -cache: - directories: - - $HOME/AppData/Local/Temp/chocolatey + build: + runs-on: ${{"{{"}}matrix.os{{"}}"}} + strategy: + matrix: + include: + - go: {{index .GoVersions 0}} + os: macos-latest + - go: {{index .GoVersions 1}} + os: ubuntu-latest + - go: {{index .GoVersions 2}} + os: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v1 + with: + go-version: ${{"{{"}}matrix.go{{"}}"}} + - run: go run _scripts/make.go test `)).Execute(out, args) if err != nil { fmt.Fprintf(os.Stderr, "Error executing template: %v", err) os.Exit(1) } + _ = out.Flush() + _ = githubfh.Close() } diff --git a/_scripts/latestver.py b/_scripts/latestver.py new file mode 100644 index 0000000000..b8483009c4 --- /dev/null +++ b/_scripts/latestver.py @@ -0,0 +1,27 @@ +#!/usr/bin/python +import json +import urllib +import sys +import re + +def splitver(x): + v = re.split(r'([^\d]+)', x) + v[0] = int(v[0]) + if len(v) > 2: + v[2] = int(v[2]) + if len(v) > 4: + v[4] = int(v[4]) + # make rc/beta versions sort before normal versions + if len(v) > 3 and v[3] == '.': + v[3] = '~' + elif len(v) == 3: + v.append('~') + return v + +ver = sys.argv[1] +d = json.loads(urllib.urlopen('https://go.dev/dl/?mode=json&include=all').read()) +ds = sorted(d, reverse=True, key=lambda it: splitver(it['version'][2:])) +for x in ds: + if x['version'][:len(ver)] == ver: + print x['version'] + exit(0) diff --git a/_scripts/make.go b/_scripts/make.go index dca12f8ffd..9bc133110c 100644 --- a/_scripts/make.go +++ b/_scripts/make.go @@ -19,7 +19,12 @@ const DelveMainPackagePath = "github.com/go-delve/delve/cmd/dlv" var Verbose bool var NOTimeout bool +var TestIncludePIE bool var TestSet, TestRegex, TestBackend, TestBuildMode string +var Tags *[]string +var Architecture string +var OS string +var DisableGit bool func NewMakeCommands() *cobra.Command { RootCommand := &cobra.Command{ @@ -33,17 +38,41 @@ func NewMakeCommands() *cobra.Command { Run: checkCertCmd, }) - RootCommand.AddCommand(&cobra.Command{ + buildCmd := &cobra.Command{ Use: "build", Short: "Build delve", Run: func(cmd *cobra.Command, args []string) { tagFlag := prepareMacnative() - execute("go", "build", tagFlag, buildFlags(), DelveMainPackagePath) + if len(*Tags) > 0 { + if len(tagFlag) == 0 { + tagFlag = "-tags=" + } else { + tagFlag += "," + } + tagFlag += strings.Join(*Tags, ",") + } + envflags := []string{} + if len(Architecture) > 0 { + envflags = append(envflags, "GOARCH="+Architecture) + } + if len(OS) > 0 { + envflags = append(envflags, "GOOS="+OS) + } + if len(envflags) > 0 { + executeEnv(envflags, "go", "build", "-ldflags", "-extldflags -static", tagFlag, buildFlags(), DelveMainPackagePath) + } else { + execute("go", "build", "-ldflags", "-extldflags -static", tagFlag, buildFlags(), DelveMainPackagePath) + } if runtime.GOOS == "darwin" && os.Getenv("CERT") != "" && canMacnative() { codesign("./dlv") } }, - }) + } + Tags = buildCmd.PersistentFlags().StringArray("tags", []string{}, "Build tags") + buildCmd.PersistentFlags().BoolVarP(&DisableGit, "no-git", "G", false, "Do not use git") + buildCmd.PersistentFlags().StringVar(&Architecture, "GOARCH", "", "Architecture to build for") + buildCmd.PersistentFlags().StringVar(&OS, "GOOS", "", "OS to build for") + RootCommand.AddCommand(buildCmd) RootCommand.AddCommand(&cobra.Command{ Use: "install", @@ -94,6 +123,7 @@ This option can only be specified if testset is basic or a single package.`) pie PIE buildmode This option can only be specified if testset is basic or a single package.`) + test.PersistentFlags().BoolVarP(&TestIncludePIE, "pie", "", true, "Standard testing should include PIE") RootCommand.AddCommand(test) @@ -152,11 +182,14 @@ func strflatten(v []interface{}) []string { return r } -func executeq(cmd string, args ...interface{}) { +func executeq(env []string, cmd string, args ...interface{}) { x := exec.Command(cmd, strflatten(args)...) x.Stdout = os.Stdout x.Stderr = os.Stderr x.Env = os.Environ() + for _, e := range env { + x.Env = append(x.Env, e) + } err := x.Run() if x.ProcessState != nil && !x.ProcessState.Success() { os.Exit(1) @@ -168,7 +201,14 @@ func executeq(cmd string, args ...interface{}) { func execute(cmd string, args ...interface{}) { fmt.Printf("%s %s\n", cmd, strings.Join(quotemaybe(strflatten(args)), " ")) - executeq(cmd, args...) + env := []string{} + executeq(env, cmd, args...) +} + +func executeEnv(env []string, cmd string, args ...interface{}) { + fmt.Printf("%s %s %s\n", strings.Join(env, " "), + cmd, strings.Join(quotemaybe(strflatten(args)), " ")) + executeq(env, cmd, args...) } func quotemaybe(args []string) []string { @@ -211,7 +251,7 @@ func installedExecutablePath() string { // i.e. cgo enabled and the legacy SDK headers: // https://forums.developer.apple.com/thread/104296 func canMacnative() bool { - if runtime.GOOS != "darwin" { + if !(runtime.GOOS == "darwin" && runtime.GOARCH == "amd64") { return false } if strings.TrimSpace(getoutput("go", "env", "CGO_ENABLED")) != "1" { @@ -219,13 +259,18 @@ func canMacnative() bool { } macOSVersion := strings.Split(strings.TrimSpace(getoutput("/usr/bin/sw_vers", "-productVersion")), ".") + + major, err := strconv.ParseInt(macOSVersion[0], 10, 64) + if err != nil { + return false + } minor, err := strconv.ParseInt(macOSVersion[1], 10, 64) if err != nil { return false } typesHeader := "/usr/include/sys/types.h" - if minor >= 15 { + if major >= 11 || (major == 10 && minor >= 15) { typesHeader = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/types.h" } _, err = os.Stat(typesHeader) @@ -248,11 +293,11 @@ func prepareMacnative() string { } func buildFlags() []string { - buildSHA, err := exec.Command("git", "rev-parse", "HEAD").CombinedOutput() + buildSHA, err := getBuildSHA() if err != nil { - log.Fatal(err) + log.Fatal(fmt.Errorf("error getting build SHA via git: %w", err)) } - ldFlags := "-X main.Build=" + strings.TrimSpace(string(buildSHA)) + ldFlags := "-X main.Build=" + buildSHA if runtime.GOOS == "darwin" { ldFlags = "-s " + ldFlags } @@ -274,6 +319,9 @@ func testFlags() []string { // Make test timeout shorter than Travis' own timeout so that Go can report which test hangs. testFlags = append(testFlags, "-timeout", "9m") } + if len(os.Getenv("TEAMCITY_VERSION")) > 0 { + testFlags = append(testFlags, "-json") + } if runtime.GOOS == "darwin" { testFlags = append(testFlags, "-exec="+wd+"/_scripts/testsign") } @@ -292,7 +340,8 @@ func testCmd(cmd *cobra.Command, args []string) { fmt.Println("\nTesting") os.Setenv("PROCTEST", "lldb") - executeq("sudo", "-E", "go", "test", testFlags(), allPackages()) + env := []string{} + executeq(env, "sudo", "-E", "go", "test", testFlags(), allPackages()) return } @@ -332,10 +381,30 @@ func testStandard() { fmt.Println("\nTesting RR backend") testCmdIntl("basic", "", "rr", "normal") } - if runtime.GOOS == "linux" || (runtime.GOOS == "windows" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 15)) { - fmt.Println("\nTesting PIE buildmode, default backend") - testCmdIntl("basic", "", "default", "pie") - testCmdIntl("core", "", "default", "pie") + if TestIncludePIE { + dopie := false + switch runtime.GOOS { + case "linux": + dopie = true + case "windows": + // only on Go 1.15 or later, with CGO_ENABLED and gcc found in path + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { + out, err := exec.Command("go", "env", "CGO_ENABLED").CombinedOutput() + if err != nil { + panic(err) + } + if strings.TrimSpace(string(out)) == "1" { + if _, err = exec.LookPath("gcc"); err == nil { + dopie = true + } + } + } + } + if dopie { + fmt.Println("\nTesting PIE buildmode, default backend") + testCmdIntl("basic", "", "default", "pie") + testCmdIntl("core", "", "default", "pie") + } } if runtime.GOOS == "linux" && inpath("rr") { fmt.Println("\nTesting PIE buildmode, RR backend") @@ -374,7 +443,8 @@ func testCmdIntl(testSet, testRegex, testBackend, testBuildMode string) { } if len(testPackages) > 3 { - executeq("go", "test", testFlags(), buildFlags(), testPackages, backendFlag, buildModeFlag) + env := []string{} + executeq(env, "go", "test", testFlags(), buildFlags(), testPackages, backendFlag, buildModeFlag) } else if testRegex != "" { execute("go", "test", testFlags(), buildFlags(), testPackages, "-run="+testRegex, backendFlag, buildModeFlag) } else { @@ -428,6 +498,22 @@ func allPackages() []string { return r } +// getBuildSHA will invoke git to return the current SHA of the commit at HEAD. +// If invoking git has been disabled, it will return an empty string instead. +func getBuildSHA() (string, error) { + if DisableGit { + return "", nil + } + + buildSHA, err := exec.Command("git", "rev-parse", "HEAD").CombinedOutput() + if err != nil { + return "", err + } + + shaStr := strings.TrimSpace(string(buildSHA)) + return shaStr, nil +} + func main() { allPackages() // checks that vendor directory is synced as a side effect NewMakeCommands().Execute() diff --git a/_scripts/rtype-out.txt b/_scripts/rtype-out.txt new file mode 100644 index 0000000000..b463d3c79a --- /dev/null +++ b/_scripts/rtype-out.txt @@ -0,0 +1,78 @@ +var firstmoduledata moduledata + +var debug anytype + +type _defer struct { + fn anytype + pc uintptr + sp uintptr + siz int32 (optional) + link *_defer +} + +type bmap struct { + tophash [8]uint8 +} + +type eface struct { + _type *_type + data unsafe.Pointer +} + +type g struct { + sched gobuf + goid int64 + gopc uintptr + startpc uintptr + waitsince int64 + waitreason waitReason (optional) + stack stack + atomicstatus uint32 +} + +type gobuf struct { + pc uintptr + sp uintptr + bp uintptr (optional) + lr uintptr (optional) +} + +type hmap struct { + count int + B uint8 + buckets unsafe.Pointer + oldbuckets unsafe.Pointer +} + +type iface struct { + tab *itab + data unsafe.Pointer +} + +type itab struct { + _type *_type +} + +type moduledata struct { + text uintptr + types uintptr +} + +type stack struct { + hi uintptr + lo uintptr +} + +const emptyOne = 1 + +const emptyRest = 0 + +const kindDirectIface = 32 + +const kindGCProg = 64 + +const kindMask = 31 + +const minTopHash = 4 +or const minTopHash = 5 + diff --git a/_scripts/rtype.go b/_scripts/rtype.go new file mode 100644 index 0000000000..88f38ce086 --- /dev/null +++ b/_scripts/rtype.go @@ -0,0 +1,666 @@ +// This script checks that the Go runtime hasn't changed in ways that Delve +// doesn't understand. It accomplishes this task by parsing the pkg/proc +// package and extracting rules from all the comments starting with the +// magic string '+rtype'. +// +// COMMAND LINE +// +// go run _scripts/rtype.go (report [output-file]|check) +// +// Invoked with the command 'report' it will extract rules from pkg/proc and +// print them to stdout. +// Invoked with the command 'check' it will actually check that the runtime +// conforms to the rules in pkg/proc. +// +// RTYPE RULES +// +// // +rtype -var V T +// +// checks that variable runtime.V exists and has type T +// +// // +rtype -field S.F T +// +// checks that struct runtime.S has a field called F of type T +// +// const C1 = V // +rtype C2 +// +// checks that constant runtime.C2 exists and has value V +// +// case "F": // +rtype -fieldof S T +// +// checks that struct runtime.S has a field called F of type T +// +// v := ... // +rtype T +// +// if v is declared as *proc.Variable it will assume that it has type +// runtime.T and it will then parse the enclosing function, searching for +// all calls to: +// v.loadFieldNamed +// v.fieldVariable +// v.structMember +// and check that type T has the specified fields. +// +// v.loadFieldNamed("F") // +rtype T +// v.loadFieldNamed("F") // +rtype -opt T +// +// checks that field F of the struct type declared for v has type T. Can +// also be used for fieldVariable, structMember and, inside parseG, +// loadInt64Maybe. +// The -opt flag specifies that the field can be missing (but if it exists +// it must have type T). +// +// +// Anywhere a type is required anytype can be used to specify that we don't +// care about its type. + +package main + +import ( + "bytes" + "fmt" + "go/ast" + "go/constant" + "go/printer" + "go/token" + "go/types" + "log" + "os" + "path/filepath" + "sort" + "strconv" + "strings" + + "golang.org/x/tools/go/packages" +) + +const magicCommentPrefix = "+rtype" + +var fset = &token.FileSet{} +var checkVarTypeRules = []*checkVarType{} +var checkFieldTypeRules = map[string][]*checkFieldType{} +var checkConstValRules = map[string][]*checkConstVal{} +var showRuleOrigin = false + +// rtypeCmnt represents a +rtype comment +type rtypeCmnt struct { + slash token.Pos + txt string + node ast.Node // associated node + toplevel ast.Decl // toplevel declaration that contains the Slash of the comment + stmt ast.Stmt +} + +type checkVarType struct { + V, T string // V must have type T + pos token.Pos +} + +func (c *checkVarType) String() string { + if showRuleOrigin { + pos := fset.Position(c.pos) + return fmt.Sprintf("var %s %s // %s:%d", c.V, c.T, relative(pos.Filename), pos.Line) + } + return fmt.Sprintf("var %s %s", c.V, c.T) +} + +type checkFieldType struct { + S, F, T string // S.F must have type T + opt bool + pos token.Pos +} + +func (c *checkFieldType) String() string { + pos := fset.Position(c.pos) + return fmt.Sprintf("field %s.%s %s // %s:%d", c.S, c.F, c.T, relative(pos.Filename), pos.Line) +} + +type checkConstVal struct { + C string // const C = V + V constant.Value + pos token.Pos +} + +func (c *checkConstVal) String() string { + if showRuleOrigin { + pos := fset.Position(c.pos) + return fmt.Sprintf("const %s = %s // %s:%d", c.C, c.V, relative(pos.Filename), pos.Line) + } + return fmt.Sprintf("const %s = %s", c.C, c.V) +} + +func main() { + if len(os.Args) < 2 { + fmt.Fprintf(os.Stderr, "Wrong number of arguments.\n\trtype (report [output-file]|check)\n") + os.Exit(1) + } + + command := os.Args[1] + + setup() + + switch command { + case "report": + if len(os.Args) > 2 { + fh, err := os.Create(os.Args[2]) + if err != nil { + log.Fatalf("error creating output file: %v", err) + } + defer fh.Close() + os.Stdout = fh + } + report() + case "check": + check() + default: + fmt.Fprintf(os.Stderr, "Wrong argument %s\n", command) + os.Exit(1) + } +} + +// setup parses the proc package, extracting all +rtype comments and +// converting them into rules. +func setup() { + pkgs, err := packages.Load(&packages.Config{Mode: packages.LoadSyntax, Fset: fset}, "github.com/go-delve/delve/pkg/proc") + if err != nil { + log.Fatalf("could not load proc package: %v", err) + } + + for _, file := range pkgs[0].Syntax { + cmntmap := ast.NewCommentMap(fset, file, file.Comments) + rtypeCmnts := getRtypeCmnts(file, cmntmap) + for _, rtcmnt := range rtypeCmnts { + if rtcmnt == nil { + continue + } + process(pkgs[0], rtcmnt, cmntmap, rtypeCmnts) + } + } +} + +// getRtypeCmnts returns all +rtype comments inside 'file'. It also +// decorates them with the toplevel declaration that contains them as well +// as the statement they are associated with (where applicable). +func getRtypeCmnts(file *ast.File, cmntmap ast.CommentMap) []*rtypeCmnt { + r := []*rtypeCmnt{} + + for n, cmntgrps := range cmntmap { + for _, cmntgrp := range cmntgrps { + if len(cmntgrp.List) == 0 { + continue + } + + for _, cmnt := range cmntgrp.List { + txt := cleanupCommentText(cmnt.Text) + if !strings.HasPrefix(txt, magicCommentPrefix) { + continue + } + + r = append(r, &rtypeCmnt{slash: cmnt.Slash, txt: txt, node: n}) + } + + } + } + + sort.Slice(r, func(i, j int) bool { return r[i].slash < r[j].slash }) + + // assign each comment to the toplevel declaration that contains it + for i, j := 0, 0; i < len(r) && j < len(file.Decls); { + decl := file.Decls[j] + if decl.Pos() <= r[i].slash && r[i].slash < decl.End() { + r[i].toplevel = decl + i++ + } else { + j++ + } + } + + // for comments declared inside a function also find the statement that contains them. + for i := range r { + fndecl, ok := r[i].toplevel.(*ast.FuncDecl) + if !ok { + continue + } + + var lastStmt ast.Stmt + ast.Inspect(fndecl, func(n ast.Node) bool { + if stmt, _ := n.(ast.Stmt); stmt != nil { + lastStmt = stmt + } + if n == r[i].node { + r[i].stmt = lastStmt + } + return true + }) + } + + return r +} + +func cleanupCommentText(txt string) string { + if strings.HasPrefix(txt, "/*") || strings.HasPrefix(txt, "//") { + txt = txt[2:] + } + return strings.TrimSpace(strings.TrimSuffix(txt, "*/")) +} + +// process processes a single +rtype comment, turning it into a rule. +// If the +rtype comment is associated with a *proc.Variable declaration +// then it also checks the containing function for all uses of that +// variable. +func process(pkg *packages.Package, rtcmnt *rtypeCmnt, cmntmap ast.CommentMap, rtcmnts []*rtypeCmnt) { + tinfo := pkg.TypesInfo + fields := strings.Split(rtcmnt.txt, " ") + + switch fields[1] { + case "-var": + // -var V T + // requests that variable V is of type T + addCheckVarType(fields[2], fields[3], rtcmnt.slash) + case "-field": + // -field S.F T + // requests that field F of type S is of type T + v := strings.Split(fields[2], ".") + addCheckFieldType(v[0], v[1], fields[3], false, rtcmnt.slash) + default: + ok := false + if ident := isProcVariableDecl(rtcmnt.stmt, tinfo); ident != nil { + if len(fields) == 2 { + processProcVariableUses(rtcmnt.toplevel, tinfo, ident, cmntmap, rtcmnts, fields[1]) + ok = true + } else if len(fields) == 3 && fields[1] == "-opt" { + processProcVariableUses(rtcmnt.toplevel, tinfo, ident, cmntmap, rtcmnts, fields[2]) + ok = true + } + } else if ident := isConstDecl(rtcmnt.toplevel, rtcmnt.node); len(fields) == 2 && ident != nil { + addCheckConstVal(fields[1], constValue(tinfo.Defs[ident]), rtcmnt.slash) + ok = true + } else if F := isStringCaseClause(rtcmnt.stmt); F != "" && len(fields) == 4 && fields[1] == "-fieldof" { + addCheckFieldType(fields[2], F, fields[3], false, rtcmnt.slash) + ok = true + } + if !ok { + pos := fset.Position(rtcmnt.slash) + log.Fatalf("%s:%d: unrecognized +rtype comment\n", pos.Filename, pos.Line) + } + } +} + +// isProcVariableDecl returns true if stmt is a declaration of a +// *proc.Variable variable. +func isProcVariableDecl(stmt ast.Stmt, tinfo *types.Info) *ast.Ident { + ass, _ := stmt.(*ast.AssignStmt) + if ass == nil { + return nil + } + if len(ass.Lhs) == 0 { + return nil + } + ident, _ := ass.Lhs[0].(*ast.Ident) + if ident == nil { + return nil + } + var typ types.Type + if def := tinfo.Defs[ident]; def != nil { + typ = def.Type() + } + if tv, ok := tinfo.Types[ident]; ok { + typ = tv.Type + } + if typ == nil { + return nil + } + if typ == nil || typ.String() != "*github.com/go-delve/delve/pkg/proc.Variable" { + return nil + } + return ident +} + +func isConstDecl(toplevel ast.Decl, node ast.Node) *ast.Ident { + gendecl, _ := toplevel.(*ast.GenDecl) + if gendecl == nil { + return nil + } + if gendecl.Tok != token.CONST { + return nil + } + valspec, _ := node.(*ast.ValueSpec) + if valspec == nil { + return nil + } + if len(valspec.Names) != 1 { + return nil + } + return valspec.Names[0] +} + +func isStringCaseClause(stmt ast.Stmt) string { + c, _ := stmt.(*ast.CaseClause) + if c == nil { + return "" + } + if len(c.List) != 1 { + return "" + } + lit := c.List[0].(*ast.BasicLit) + if lit == nil { + return "" + } + if lit.Kind != token.STRING { + return "" + } + r, _ := strconv.Unquote(lit.Value) + return r +} + +// processProcVariableUses scans the body of the function declaration 'decl' +// looking for uses of 'procVarIdent' which is assumed to be an identifier +// for a *proc.Variable variable. +func processProcVariableUses(decl ast.Node, tinfo *types.Info, procVarIdent *ast.Ident, cmntmap ast.CommentMap, rtcmnts []*rtypeCmnt, S string) { + if len(S) > 0 && S[0] == '*' { + S = S[1:] + } + isParseG := false + if fndecl, _ := decl.(*ast.FuncDecl); fndecl != nil { + if fndecl.Name.Name == "parseG" { + if procVarIdent.Name == "v" { + isParseG = true + } + } + } + var lastStmt ast.Stmt + ast.Inspect(decl, func(n ast.Node) bool { + if stmt, _ := n.(ast.Stmt); stmt != nil { + lastStmt = stmt + } + + fncall, _ := n.(*ast.CallExpr) + if fncall == nil { + return true + } + var methodName string + if isParseG { + if xident, _ := fncall.Fun.(*ast.Ident); xident != nil && xident.Name == "loadInt64Maybe" { + methodName = "loadInt64Maybe" + } + } + if methodName == "" { + sel, _ := fncall.Fun.(*ast.SelectorExpr) + if sel == nil { + return true + } + methodName = sel.Sel.Name + xident, _ := sel.X.(*ast.Ident) + if xident == nil { + return true + } + if xident.Obj != procVarIdent.Obj { + return true + } + } + if len(fncall.Args) < 1 { + return true + } + arg0, _ := fncall.Args[0].(*ast.BasicLit) + if arg0 == nil { + return true + } + if arg0.Kind != token.STRING { + return true + } + + switch methodName { + case "loadFieldNamed", "fieldVariable", "loadInt64Maybe", "structMember": + rtcmntIdx := -1 + if cmntgrps := cmntmap[lastStmt]; len(cmntgrps) > 0 && len(cmntgrps[0].List) > 0 { + rtcmntIdx = findComment(cmntgrps[0].List[0].Slash, rtcmnts) + } + typ := "anytype" + opt := false + + if rtcmntIdx >= 0 { + fields := strings.Split(rtcmnts[rtcmntIdx].txt, " ") + if len(fields) == 2 { + typ = fields[1] + } else if len(fields) == 3 && fields[1] == "-opt" { + opt = true + typ = fields[2] + } + if isProcVariableDecl(lastStmt, tinfo) == nil { + // remove it because we have already processed it + rtcmnts[rtcmntIdx] = nil + } + } + F, _ := strconv.Unquote(arg0.Value) + addCheckFieldType(S, F, typ, opt, fncall.Pos()) + //printNode(fset, fncall) + default: + pos := fset.Position(n.Pos()) + log.Fatalf("unknown node at %s:%d", pos.Filename, pos.Line) + } + return true + }) +} + +func findComment(slash token.Pos, rtcmnts []*rtypeCmnt) int { + for i := range rtcmnts { + if rtcmnts[i] != nil && rtcmnts[i].slash == slash { + return i + } + } + return -1 +} + +func addCheckVarType(V, T string, pos token.Pos) { + checkVarTypeRules = append(checkVarTypeRules, &checkVarType{V, T, pos}) +} + +func addCheckFieldType(S, F, T string, opt bool, pos token.Pos) { + checkFieldTypeRules[S] = append(checkFieldTypeRules[S], &checkFieldType{S, F, T, opt, pos}) +} + +func addCheckConstVal(C string, V constant.Value, pos token.Pos) { + checkConstValRules[C] = append(checkConstValRules[C], &checkConstVal{C, V, pos}) +} + +// report writes a report of all rules derived from the proc package to stdout. +func report() { + for _, rule := range checkVarTypeRules { + fmt.Printf("%s\n\n", rule.String()) + } + + var Ss []string + for S := range checkFieldTypeRules { + Ss = append(Ss, S) + } + sort.Strings(Ss) + for _, S := range Ss { + rules := checkFieldTypeRules[S] + fmt.Printf("type %s struct {\n", S) + for _, rule := range rules { + fmt.Printf("\t%s %s", rule.F, rule.T) + if rule.opt { + fmt.Printf(" (optional)") + } + pos := fset.Position(rule.pos) + if showRuleOrigin { + fmt.Printf("\t// %s:%d", relative(pos.Filename), pos.Line) + } + fmt.Printf("\n") + } + fmt.Printf("}\n\n") + } + + var Cs []string + for C := range checkConstValRules { + Cs = append(Cs, C) + } + sort.Strings(Cs) + for _, C := range Cs { + rules := checkConstValRules[C] + for i, rule := range rules { + if i == 0 { + fmt.Printf("%s\n", rule.String()) + } else { + fmt.Printf("or %s\n", rule.String()) + } + } + fmt.Printf("\n") + } +} + +// check parses the runtime package and checks that all the rules retrieved +// from the 'proc' package pass. +func check() { + pkgs2, err := packages.Load(&packages.Config{Mode: packages.LoadSyntax, Fset: fset}, "runtime") + if err != nil { + log.Fatalf("could not load runtime package: %v", err) + } + + allok := true + + for _, rule := range checkVarTypeRules { + //TODO: implement + pos := fset.Position(rule.pos) + def := pkgs2[0].Types.Scope().Lookup(rule.V) + if def == nil { + fmt.Fprintf(os.Stderr, "%s:%d: could not find variable %s\n", pos.Filename, pos.Line, rule.V) + allok = false + continue + } + if !matchType(def.Type(), rule.T) { + fmt.Fprintf(os.Stderr, "%s:%d: wrong type for variable %s, expected %s got %s\n", pos.Filename, pos.Line, rule.V, rule.T, typeStr(def.Type())) + allok = false + continue + } + } + + var Ss []string + for S := range checkFieldTypeRules { + Ss = append(Ss, S) + } + sort.Strings(Ss) + for _, S := range Ss { + rules := checkFieldTypeRules[S] + pos := fset.Position(rules[0].pos) + + def := pkgs2[0].Types.Scope().Lookup(S) + if def == nil { + fmt.Fprintf(os.Stderr, "%s:%d: could not find struct %s\n", pos.Filename, pos.Line, S) + allok = false + continue + } + + typ := def.Type() + if typ == nil { + fmt.Fprintf(os.Stderr, "%s:%d: could not find struct %s\n", pos.Filename, pos.Line, S) + allok = false + continue + } + styp, _ := typ.Underlying().(*types.Struct) + if styp == nil { + fmt.Fprintf(os.Stderr, "%s:%d: could not find struct %s\n", pos.Filename, pos.Line, S) + allok = false + continue + } + + for _, rule := range rules { + pos := fset.Position(rule.pos) + fieldType := fieldTypeByName(styp, rule.F) + if fieldType == nil { + if rule.opt { + continue + } + fmt.Fprintf(os.Stderr, "%s:%d: could not find field %s.%s\n", pos.Filename, pos.Line, rule.S, rule.F) + allok = false + continue + } + if !matchType(fieldType, rule.T) { + fmt.Fprintf(os.Stderr, "%s:%d: wrong type for field %s.%s, expected %s got %s\n", pos.Filename, pos.Line, rule.S, rule.F, rule.T, typeStr(fieldType)) + allok = false + continue + } + } + } + + var Cs []string + for C := range checkConstValRules { + Cs = append(Cs, C) + } + sort.Strings(Cs) + for _, C := range Cs { + rules := checkConstValRules[C] + pos := fset.Position(rules[0].pos) + def := pkgs2[0].Types.Scope().Lookup(C) + if def == nil { + fmt.Fprintf(os.Stderr, "%s:%d: could not find constant %s\n", pos.Filename, pos.Line, C) + allok = false + continue + } + + val := constValue(def) + found := false + for _, rule := range rules { + if val == rule.V { + found = true + } + } + if !found { + fmt.Fprintf(os.Stderr, "%s:%d: wrong value for constant %s (%s)\n", pos.Filename, pos.Line, C, val.String()) + allok = false + continue + } + } + + if !allok { + os.Exit(1) + } +} + +func fieldTypeByName(typ *types.Struct, name string) types.Type { + for i := 0; i < typ.NumFields(); i++ { + field := typ.Field(i) + if field.Name() == name { + return field.Type() + } + } + return nil +} + +func matchType(typ types.Type, T string) bool { + if T == "anytype" { + return true + } + return typeStr(typ) == T +} + +func typeStr(typ types.Type) string { + return types.TypeString(typ, func(pkg *types.Package) string { + if pkg.Path() == "runtime" { + return "" + } + return pkg.Path() + }) +} + +func constValue(obj types.Object) constant.Value { + return obj.(*types.Const).Val() +} + +func printNode(fset *token.FileSet, n ast.Node) { + ast.Fprint(os.Stderr, fset, n, nil) +} + +func exprToString(t ast.Expr) string { + var buf bytes.Buffer + printer.Fprint(&buf, token.NewFileSet(), t) + return buf.String() +} + +func relative(s string) string { + wd, _ := os.Getwd() + r, err := filepath.Rel(wd, s) + if err != nil { + return s + } + return r +} diff --git a/_scripts/staticcheck-out.txt b/_scripts/staticcheck-out.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/_scripts/test_linux.sh b/_scripts/test_linux.sh new file mode 100755 index 0000000000..c37bae056f --- /dev/null +++ b/_scripts/test_linux.sh @@ -0,0 +1,60 @@ +#!/bin/bash +set -e +set -x + +apt-get -qq update +apt-get install -y dwz wget make git gcc curl jq lsof + +dwz --version + +version=$1 +arch=$2 + +function getgo { + export GOROOT=/usr/local/go/$1 + if [ ! -d "$GOROOT" ]; then + wget -q https://dl.google.com/go/"$1".linux-"${arch}".tar.gz + mkdir -p /usr/local/go + tar -C /usr/local/go -xzf "$1".linux-"${arch}".tar.gz + mv -f /usr/local/go/go "$GOROOT" + fi +} + +if [ "$version" = "gotip" ]; then + echo Building Go from tip + getgo $(curl https://go.dev/VERSION?m=text) + export GOROOT_BOOTSTRAP=$GOROOT + export GOROOT=/usr/local/go/go-tip + git clone https://go.googlesource.com/go /usr/local/go/go-tip + cd /usr/local/go/go-tip/src + ./make.bash + cd - +else + echo Finding latest patch version for $version + version=$(curl 'https://go.dev/dl/?mode=json&include=all' | jq '.[].version' --raw-output | egrep ^$version'($|\.|beta|rc)' | sort -rV | head -1) + echo "Go $version on $arch" + getgo $version +fi + + +GOPATH=$(pwd)/go +export GOPATH +export PATH=$PATH:$GOROOT/bin:$GOPATH/bin +go version +go install honnef.co/go/tools/cmd/staticcheck@2021.1.1 || true + +uname -a +echo "$PATH" +echo "$GOROOT" +echo "$GOPATH" +cd delve + +# Starting with go1.18 'go build' and 'go run' will try to stamp the build +# with the current VCS revision, which does not work with TeamCity +if [ "$version" = "gotip" ]; then + export GOFLAGS=-buildvcs=false +elif [ ${version:4:2} -gt 17 ]; then + export GOFLAGS=-buildvcs=false +fi + +make test diff --git a/_scripts/test_mac.sh b/_scripts/test_mac.sh new file mode 100644 index 0000000000..93af0c1fc0 --- /dev/null +++ b/_scripts/test_mac.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +set -x +set -e + +GOVERSION=$1 +ARCH=$2 +TMPDIR=$3 + +if [ "$GOVERSION" = "gotip" ]; then + bootstrapver=$(curl https://go.dev/VERSION?m=text) + cd $TMPDIR + curl -sSL "https://storage.googleapis.com/golang/$bootstrapver.darwin-$ARCH.tar.gz" | tar -xz + cd - + if [ -x $TMPDIR/go-tip ]; then + cd $TMPDIR/go-tip + git pull origin + else + git clone https://go.googlesource.com/go $TMPDIR/go-tip + fi + export GOROOT_BOOTSTRAP=$TMPDIR/go + export GOROOT=$TMPDIR/go-tip + cd $TMPDIR/go-tip/src + ./make.bash + cd - +else + echo Finding latest patch version for $GOVERSION + GOVERSION=$(python _scripts/latestver.py $GOVERSION) + echo Go $GOVERSION on $ARCH + cd $TMPDIR + curl -sSL "https://storage.googleapis.com/golang/$GOVERSION.darwin-$ARCH.tar.gz" | tar -xz + cd - + export GOROOT="$TMPDIR/go" +fi + +mkdir -p $TMPDIR/gopath + +go env + +export GOPATH="$TMPDIR/gopath" +export GOARCH="$ARCH" +export PATH="$GOROOT/bin:$PATH" +go version + +make test diff --git a/_scripts/test_windows.ps1 b/_scripts/test_windows.ps1 new file mode 100644 index 0000000000..65b56fffb6 --- /dev/null +++ b/_scripts/test_windows.ps1 @@ -0,0 +1,76 @@ +param ( + [Parameter(Mandatory = $true)][string]$version, + [Parameter(Mandatory = $true)][string]$arch +) + +Set-MpPreference -DisableRealtimeMonitoring $true + +# Install Chocolatey +#Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + +# Install MinGW. +choco install -y mingw --version 10.2.0 + +# Install Procdump +if (-Not(Test-Path "C:\procdump")) +{ + mkdir C:\procdump + Invoke-WebRequest -UserAgent wget -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile C:\procdump\procdump.zip + &7z x -oC:\procdump\ C:\procdump\procdump.zip > $null +} + +$env:PATH += ";C:\procdump;C:\mingw64\bin" + +function GetGo($version) { + $env:GOROOT = "C:\go\$version" + if (-Not(Test-Path $env:GOROOT)) + { + $file = "$version.windows-$arch.zip" + $url = "https://dl.google.com/go/$file" + Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file + &7z x -oC:\go $file > $null + Move-Item -Path C:\go\go -Destination $env:GOROOT -force + } +} + +if ($version -eq "gotip") { + #Exit 0 + $latest = Invoke-WebRequest -Uri https://golang.org/VERSION?m=text -UseBasicParsing | Select-Object -ExpandProperty Content + GetGo $latest + $env:GOROOT_BOOTSTRAP = $env:GOROOT + $env:GOROOT = "C:\go\go-tip" + Write-Host "Building Go with GOROOT_BOOTSTRAP $env:GOROOT_BOOTSTRAP" + if (-Not(Test-Path $env:GOROOT)) { + git clone https://go.googlesource.com/go C:\go\go-tip + Push-Location -Path C:\go\go-tip\src + } else { + Push-Location -Path C:\go\go-tip\src + git pull + } + .\make.bat + Pop-Location +} else { + # Install Go + Write-Host "Finding latest patch version for $version" + $versions = Invoke-WebRequest -Uri 'https://golang.org/dl/?mode=json&include=all' -UseBasicParsing | foreach {$_.Content} | ConvertFrom-Json + $v = $versions | foreach {$_.version} | Select-String -Pattern "^$version($|\.)" | Sort-Object -Descending | Select-Object -First 1 + if ($v -eq $null) { + $v = $versions | foreach {$_.version} | Select-String -Pattern "^$version(rc)" | Sort-Object -Descending | Select-Object -First 1 + } + if ($v -eq $null) { + $v = $versions | foreach {$_.version} | Select-String -Pattern "^$version(beta)" | Sort-Object -Descending | Select-Object -First 1 + } + Write-Host "Go $v on $arch" + GetGo $v +} + +$env:GOPATH = "C:\gopath" +$env:PATH += ";$env:GOROOT\bin;$env:GOPATH\bin" +Write-Host $env:PATH +Write-Host $env:GOROOT +Write-Host $env:GOPATH + +go version +go env +go run _scripts/make.go test +Exit $LastExitCode diff --git a/cmd/dlv/cmds/commands.go b/cmd/dlv/cmds/commands.go index e28a0a1638..8a0c753ae0 100644 --- a/cmd/dlv/cmds/commands.go +++ b/cmd/dlv/cmds/commands.go @@ -9,6 +9,7 @@ import ( "os/exec" "os/signal" "path/filepath" + "reflect" "runtime" "strconv" "strings" @@ -58,6 +59,13 @@ var ( checkLocalConnUser bool // tty is used to provide an alternate TTY for the program you wish to debug. tty string + // disableASLR is used to disable ASLR + disableASLR bool + + // dapClientAddr is dap subcommand's flag that specifies the address of a DAP client. + // If it is specified, the dap server starts a debug session by dialing to the client. + // The dap server will serve only for the debug session. + dapClientAddr string // backend selection backend string @@ -74,13 +82,15 @@ var ( traceExecFile string traceTestBinary bool traceStackDepth int + traceUseEBPF bool // redirect specifications for target process redirects []string allowNonTerminalInteractive bool - conf *config.Config + conf *config.Config + loadConfErr error ) const dlvCommandLongDesc = `Delve is a source level debugger for Go programs. @@ -97,7 +107,10 @@ Pass flags to the program you are debugging using ` + "`--`" + `, for example: // New returns an initialized command tree. func New(docCall bool) *cobra.Command { // Config setup and load. - conf = config.LoadConfig() + conf, loadConfErr = config.LoadConfig() + // Delay reporting errors about configuration loading delayed until after the + // server is started so that the "server listening at" message is always + // the first thing emitted. Also logflags hasn't been setup yet at this point. buildFlagsDefault := "" if runtime.GOOS == "windows" { ver, _ := goversion.Installed() @@ -120,17 +133,18 @@ func New(docCall bool) *cobra.Command { rootCommand.PersistentFlags().StringVarP(&logOutput, "log-output", "", "", `Comma separated list of components that should produce debug output (see 'dlv help log')`) rootCommand.PersistentFlags().StringVarP(&logDest, "log-dest", "", "", "Writes logs to the specified file or file descriptor (see 'dlv help log').") - rootCommand.PersistentFlags().BoolVarP(&headless, "headless", "", false, "Run debug server only, in headless mode.") - rootCommand.PersistentFlags().BoolVarP(&acceptMulti, "accept-multiclient", "", false, "Allows a headless server to accept multiple client connections.") - rootCommand.PersistentFlags().IntVar(&apiVersion, "api-version", 1, "Selects API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md.") + rootCommand.PersistentFlags().BoolVarP(&headless, "headless", "", false, "Run debug server only, in headless mode. Server will accept both JSON-RPC or DAP client connections.") + rootCommand.PersistentFlags().BoolVarP(&acceptMulti, "accept-multiclient", "", false, "Allows a headless server to accept multiple client connections via JSON-RPC or DAP.") + rootCommand.PersistentFlags().IntVar(&apiVersion, "api-version", 1, "Selects JSON-RPC API version when headless. New clients should use v2. Can be reset via RPCServer.SetApiVersion. See Documentation/api/json-rpc/README.md.") rootCommand.PersistentFlags().StringVar(&initFile, "init", "", "Init file, executed by the terminal client.") - rootCommand.PersistentFlags().StringVar(&buildFlags, "build-flags", buildFlagsDefault, "Build flags, to be passed to the compiler.") + rootCommand.PersistentFlags().StringVar(&buildFlags, "build-flags", buildFlagsDefault, "Build flags, to be passed to the compiler. For example: --build-flags=\"-tags=integration -mod=vendor -cover -v\"") rootCommand.PersistentFlags().StringVar(&workingDir, "wd", "", "Working directory for running the program.") - rootCommand.PersistentFlags().BoolVarP(&checkGoVersion, "check-go-version", "", true, "Checks that the version of Go in use is compatible with Delve.") + rootCommand.PersistentFlags().BoolVarP(&checkGoVersion, "check-go-version", "", true, "Exits if the version of Go in use is not compatible (too old or too new) with the version of Delve.") rootCommand.PersistentFlags().BoolVarP(&checkLocalConnUser, "only-same-user", "", true, "Only connections from the same user that started this instance of Delve are allowed to connect.") rootCommand.PersistentFlags().StringVar(&backend, "backend", "default", `Backend selection (see 'dlv help backend').`) rootCommand.PersistentFlags().StringArrayVarP(&redirects, "redirect", "r", []string{}, "Specifies redirect rules for target process (see 'dlv help redirect')") rootCommand.PersistentFlags().BoolVar(&allowNonTerminalInteractive, "allow-non-terminal-interactive", false, "Allows interactive sessions of Delve that don't have a terminal as stdin, stdout and stderr") + rootCommand.PersistentFlags().BoolVar(&disableASLR, "disable-aslr", false, "Disables address space randomization") // 'attach' subcommand. attachCommand := &cobra.Command{ @@ -156,8 +170,8 @@ option to let the process continue or kill it. // 'connect' subcommand. connectCommand := &cobra.Command{ Use: "connect addr", - Short: "Connect to a headless debug server.", - Long: "Connect to a running headless debug server.", + Short: "Connect to a headless debug server with a terminal client.", + Long: "Connect to a running headless debug server with a terminal client.", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if len(args) == 0 { return errors.New("you must provide an address as the first argument") @@ -171,17 +185,33 @@ option to let the process continue or kill it. // 'dap' subcommand. dapCommand := &cobra.Command{ Use: "dap", - Short: "[EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP).", - Long: `[EXPERIMENTAL] Starts a TCP server communicating via Debug Adaptor Protocol (DAP). - -The server supports debugging of a precompiled binary akin to 'dlv exec' via a launch request. -It does not yet support support specification of program arguments. -It does not yet support launch requests with 'debug' and 'test' modes that require compilation. -It does not yet support attach requests to debug a running process like with 'dlv attach'. -It does not yet support asynchronous request-response communication. -The server does not accept multiple client connections.`, + Short: "Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP).", + Long: `Starts a headless TCP server communicating via Debug Adaptor Protocol (DAP). + +The server is always headless and requires a DAP client like VS Code to connect and request a binary +to be launched or a process to be attached to. The following modes can be specified via the client's launch config: +- launch + exec (executes precompiled binary, like 'dlv exec') +- launch + debug (builds and launches, like 'dlv debug') +- launch + test (builds and tests, like 'dlv test') +- launch + replay (replays an rr trace, like 'dlv replay') +- launch + core (replays a core dump file, like 'dlv core') +- attach + local (attaches to a running process, like 'dlv attach') + +Program and output binary paths will be interpreted relative to dlv's working directory. + +This server does not accept multiple client connections (--accept-multiclient). +Use 'dlv [command] --headless' instead and a DAP client with attach + remote config. +While --continue is not supported, stopOnEntry launch/attach attribute can be used to control if +execution is resumed at the start of the debug session. + +The --client-addr flag is a special flag that makes the server initiate a debug session +by dialing in to the host:port where a DAP client is waiting. This server process +will exit when the debug session ends.`, Run: dapCmd, } + dapCommand.Flags().StringVar(&dapClientAddr, "client-addr", "", "host:port where the DAP client is waiting for the DAP server to dial in") + + // TODO(polina): support --tty when dlv dap allows to launch a program from command-line rootCommand.AddCommand(dapCommand) // 'debug' subcommand. @@ -246,7 +276,11 @@ or later, -gcflags="-N -l" on earlier versions of Go.`, The test command allows you to begin a new debug session in the context of your unit tests. By default Delve will debug the tests in the current directory. Alternatively you can specify a package name, and Delve will debug the tests in -that package instead.`, +that package instead. Double-dashes ` + "`--`" + ` can be used to pass arguments to the test program: + +dlv test [package] -- -test.v -other-argument + +See also: 'go help testflag'.`, Run: testCmd, } testCommand.Flags().String("output", "debug.test", "Output path for the binary.") @@ -270,7 +304,8 @@ only see the output of the trace operations you can redirect stdout.`, traceCommand.Flags().IntVarP(&traceAttachPid, "pid", "p", 0, "Pid to attach to.") traceCommand.Flags().StringVarP(&traceExecFile, "exec", "e", "", "Binary file to exec and trace.") traceCommand.Flags().BoolVarP(&traceTestBinary, "test", "t", false, "Trace a test binary.") - traceCommand.Flags().IntVarP(&traceStackDepth, "stack", "s", 0, "Show stack trace with given depth.") + traceCommand.Flags().BoolVarP(&traceUseEBPF, "ebpf", "", false, "Trace using eBPF (experimental).") + traceCommand.Flags().IntVarP(&traceStackDepth, "stack", "s", 0, "Show stack trace with given depth. (Ignored with -ebpf)") traceCommand.Flags().String("output", "debug", "Output path for the binary.") rootCommand.AddCommand(traceCommand) @@ -283,7 +318,7 @@ The core command will open the specified core file and the associated executable and let you examine the state of the process when the core dump was taken. -Currently supports linux/amd64 and linux/arm64 core files and windows/amd64 minidumps.`, +Currently supports linux/amd64 and linux/arm64 core files, windows/amd64 minidumps and core files generated by Delve's 'dump' command.`, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if len(args) != 2 { return errors.New("you must provide a core file and an executable") @@ -295,13 +330,18 @@ Currently supports linux/amd64 and linux/arm64 core files and windows/amd64 mini rootCommand.AddCommand(coreCommand) // 'version' subcommand. + var versionVerbose = false versionCommand := &cobra.Command{ Use: "version", Short: "Prints version.", Run: func(cmd *cobra.Command, args []string) { fmt.Printf("Delve Debugger\n%s\n", version.DelveVersion) + if versionVerbose { + fmt.Printf("Build Details: %s\n", version.BuildInfo()) + } }, } + versionCommand.Flags().BoolVarP(&versionVerbose, "verbose", "v", false, "print verbose version info") rootCommand.AddCommand(versionCommand) if path, _ := exec.LookPath("rr"); path != "" || docCall { @@ -399,11 +439,15 @@ func dapCmd(cmd *cobra.Command, args []string) { } defer logflags.Close() - if headless { - fmt.Fprintf(os.Stderr, "Warning: headless mode not supported with dap\n") + if loadConfErr != nil { + logflags.DebuggerLogger().Errorf("%v", loadConfErr) + } + + if cmd.Flag("headless").Changed { + fmt.Fprintf(os.Stderr, "Warning: dap mode is always headless\n") } if acceptMulti { - fmt.Fprintf(os.Stderr, "Warning: accept multiclient mode not supported with dap\n") + fmt.Fprintf(os.Stderr, "Warning: accept-multiclient mode not supported with dap\n") } if initFile != "" { fmt.Fprint(os.Stderr, "Warning: init file ignored with dap\n") @@ -411,11 +455,14 @@ func dapCmd(cmd *cobra.Command, args []string) { if continueOnStart { fmt.Fprintf(os.Stderr, "Warning: continue ignored with dap; specify via launch/attach request instead\n") } + if backend != "default" { + fmt.Fprintf(os.Stderr, "Warning: backend ignored with dap; specify via launch/attach request instead\n") + } if buildFlags != "" { fmt.Fprintf(os.Stderr, "Warning: build flags ignored with dap; specify via launch/attach request instead\n") } if workingDir != "" { - fmt.Fprintf(os.Stderr, "Warning: working directory ignored with dap; launch requests must specify full program path\n") + fmt.Fprintf(os.Stderr, "Warning: working directory ignored with dap: specify via launch request instead\n") } dlvArgs, targetArgs := splitArgs(cmd, args) if len(dlvArgs) > 0 { @@ -425,44 +472,71 @@ func dapCmd(cmd *cobra.Command, args []string) { fmt.Fprintf(os.Stderr, "Warning: program flags ignored with dap; specify via launch/attach request instead\n") } - listener, err := net.Listen("tcp", addr) - if err != nil { - fmt.Printf("couldn't start listener: %s\n", err) - return 1 - } disconnectChan := make(chan struct{}) - server := dap.NewServer(&service.Config{ - Listener: listener, + config := &service.Config{ DisconnectChan: disconnectChan, Debugger: debugger.Config{ Backend: backend, - Foreground: headless && tty == "", + Foreground: true, // server always runs without terminal client DebugInfoDirectories: conf.DebugInfoDirectories, CheckGoVersion: checkGoVersion, - TTY: tty, }, - }) - defer server.Stop() + CheckLocalConnUser: checkLocalConnUser, + } + var conn net.Conn + if dapClientAddr == "" { + listener, err := net.Listen("tcp", addr) + if err != nil { + fmt.Printf("couldn't start listener: %s\n", err) + return 1 + } + config.Listener = listener + } else { // with a predetermined client. + var err error + conn, err = net.Dial("tcp", dapClientAddr) + if err != nil { + fmt.Fprintf(os.Stderr, "Failed to connect to the DAP client: %v\n", err) + return 1 + } + } - server.Run() + server := dap.NewServer(config) + defer server.Stop() + if conn == nil { + server.Run() + } else { // work with a predetermined client. + server.RunWithClient(conn) + } waitForDisconnectSignal(disconnectChan) return 0 }() os.Exit(status) } +func buildBinary(cmd *cobra.Command, args []string, isTest bool) (string, bool) { + debugname, err := filepath.Abs(cmd.Flag("output").Value.String()) + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + return "", false + } + + if isTest { + err = gobuild.GoTestBuild(debugname, args, buildFlags) + } else { + err = gobuild.GoBuild(debugname, args, buildFlags) + } + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + return "", false + } + return debugname, true +} + func debugCmd(cmd *cobra.Command, args []string) { status := func() int { - debugname, err := filepath.Abs(cmd.Flag("output").Value.String()) - if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - return 1 - } - dlvArgs, targetArgs := splitArgs(cmd, args) - err = gobuild.GoBuild(debugname, dlvArgs, buildFlags) - if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) + debugname, ok := buildBinary(cmd, dlvArgs, false) + if !ok { return 1 } defer gobuild.Remove(debugname) @@ -480,6 +554,9 @@ func traceCmd(cmd *cobra.Command, args []string) { fmt.Fprintf(os.Stderr, "%v\n", err) return 1 } + if loadConfErr != nil { + logflags.DebuggerLogger().Errorf("%v", loadConfErr) + } if headless { fmt.Fprintf(os.Stderr, "Warning: headless mode not supported with trace\n") @@ -501,30 +578,20 @@ func traceCmd(cmd *cobra.Command, args []string) { dlvArgs = dlvArgs[:dlvArgsLen-1] } + var debugname string if traceAttachPid == 0 { if dlvArgsLen >= 2 && traceExecFile != "" { fmt.Fprintln(os.Stderr, "Cannot specify package when using exec.") return 1 } - debugname := traceExecFile + debugname = traceExecFile if traceExecFile == "" { - debugname, err = filepath.Abs(cmd.Flag("output").Value.String()) - if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) + debugexe, ok := buildBinary(cmd, dlvArgs, traceTestBinary) + if !ok { return 1 } - if traceTestBinary { - if err := gobuild.GoTestBuild(debugname, dlvArgs, buildFlags); err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - return 1 - } - } else { - if err := gobuild.GoBuild(debugname, dlvArgs, buildFlags); err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - return 1 - } - } + debugname = debugexe defer gobuild.Remove(debugname) } @@ -562,39 +629,89 @@ func traceCmd(cmd *cobra.Command, args []string) { return 1 } for i := range funcs { - _, err = client.CreateBreakpoint(&api.Breakpoint{ - FunctionName: funcs[i], - Tracepoint: true, - Line: -1, - Stacktrace: traceStackDepth, - LoadArgs: &terminal.ShortLoadConfig, - }) - if err != nil && !isBreakpointExistsErr(err) { - fmt.Fprintln(os.Stderr, err) - return 1 - } - addrs, err := client.FunctionReturnLocations(funcs[i]) - if err != nil { - fmt.Fprintln(os.Stderr, err) - return 1 - } - for i := range addrs { + if traceUseEBPF { + err := client.CreateEBPFTracepoint(funcs[i]) + if err != nil { + fmt.Fprintln(os.Stderr, err) + return 1 + } + } else { + // Fall back to breakpoint based tracing if we get an error. _, err = client.CreateBreakpoint(&api.Breakpoint{ - Addr: addrs[i], - TraceReturn: true, - Stacktrace: traceStackDepth, - Line: -1, - LoadArgs: &terminal.ShortLoadConfig, + FunctionName: funcs[i], + Tracepoint: true, + Line: -1, + Stacktrace: traceStackDepth, + LoadArgs: &terminal.ShortLoadConfig, }) if err != nil && !isBreakpointExistsErr(err) { fmt.Fprintln(os.Stderr, err) return 1 } + addrs, err := client.FunctionReturnLocations(funcs[i]) + if err != nil { + fmt.Fprintln(os.Stderr, err) + return 1 + } + for i := range addrs { + _, err = client.CreateBreakpoint(&api.Breakpoint{ + Addr: addrs[i], + TraceReturn: true, + Stacktrace: traceStackDepth, + Line: -1, + LoadArgs: &terminal.ShortLoadConfig, + }) + if err != nil && !isBreakpointExistsErr(err) { + fmt.Fprintln(os.Stderr, err) + return 1 + } + } } } cmds := terminal.DebugCommands(client) t := terminal.New(client, nil) defer t.Close() + if traceUseEBPF { + done := make(chan struct{}) + defer close(done) + go func() { + gFnEntrySeen := map[int]struct{}{} + for { + select { + case <-done: + return + default: + tracepoints, err := client.GetBufferedTracepoints() + if err != nil { + panic(err) + } + for _, t := range tracepoints { + var params strings.Builder + for _, p := range t.InputParams { + if params.Len() > 0 { + params.WriteString(", ") + } + if p.Kind == reflect.String { + params.WriteString(fmt.Sprintf("%q", p.Value)) + } else { + params.WriteString(p.Value) + } + } + _, seen := gFnEntrySeen[t.GoroutineID] + if seen { + for _, p := range t.ReturnParams { + fmt.Fprintf(os.Stderr, "=> %#v\n", p.Value) + } + delete(gFnEntrySeen, t.GoroutineID) + } else { + gFnEntrySeen[t.GoroutineID] = struct{}{} + fmt.Fprintf(os.Stderr, "> (%d) %s(%s)\n", t.GoroutineID, t.FunctionName, params.String()) + } + } + } + } + }() + } cmds.Call("continue", t) return 0 }() @@ -607,16 +724,9 @@ func isBreakpointExistsErr(err error) bool { func testCmd(cmd *cobra.Command, args []string) { status := func() int { - debugname, err := filepath.Abs(cmd.Flag("output").Value.String()) - if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) - return 1 - } - dlvArgs, targetArgs := splitArgs(cmd, args) - err = gobuild.GoTestBuild(debugname, dlvArgs, buildFlags) - if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) + debugname, ok := buildBinary(cmd, dlvArgs, true) + if !ok { return 1 } defer gobuild.Remove(debugname) @@ -665,6 +775,15 @@ func coreCmd(cmd *cobra.Command, args []string) { } func connectCmd(cmd *cobra.Command, args []string) { + if err := logflags.Setup(log, logOutput, logDest); err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + os.Exit(1) + return + } + defer logflags.Close() + if loadConfErr != nil { + logflags.DebuggerLogger().Errorf("%v", loadConfErr) + } addr := args[0] if addr == "" { fmt.Fprint(os.Stderr, "An empty address was provided. You must provide an address as the first argument.\n") @@ -674,28 +793,23 @@ func connectCmd(cmd *cobra.Command, args []string) { } // waitForDisconnectSignal is a blocking function that waits for either -// a SIGINT (Ctrl-C) signal from the OS or for disconnectChan to be closed -// by the server when the client disconnects. +// a SIGINT (Ctrl-C) or SIGTERM (kill -15) OS signal or for disconnectChan +// to be closed by the server when the client disconnects. // Note that in headless mode, the debugged process is foregrounded // (to have control of the tty for debugging interactive programs), // so SIGINT gets sent to the debuggee and not to delve. func waitForDisconnectSignal(disconnectChan chan struct{}) { ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGINT) + signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) if runtime.GOOS == "windows" { // On windows Ctrl-C sent to inferior process is delivered // as SIGINT to delve. Ignore it instead of stopping the server // in order to be able to debug signal handlers. go func() { - for { - select { - case <-ch: - } + for range ch { } }() - select { - case <-disconnectChan: - } + <-disconnectChan } else { select { case <-ch: @@ -748,6 +862,9 @@ func execute(attachPid int, processArgs []string, conf *config.Config, coreFile return 1 } defer logflags.Close() + if loadConfErr != nil { + logflags.DebuggerLogger().Errorf("%v", loadConfErr) + } if headless && (initFile != "") { fmt.Fprint(os.Stderr, "Warning: init file ignored with --headless\n") @@ -842,6 +959,7 @@ func execute(attachPid int, processArgs []string, conf *config.Config, coreFile CheckGoVersion: checkGoVersion, TTY: tty, Redirects: redirects, + DisableASLR: disableASLR, }, }) default: diff --git a/cmd/dlv/dlv_test.go b/cmd/dlv/dlv_test.go index c6609f6c66..eb1f0b6eb3 100644 --- a/cmd/dlv/dlv_test.go +++ b/cmd/dlv/dlv_test.go @@ -10,8 +10,10 @@ import ( "go/types" "io" "io/ioutil" + "net" "os" "os/exec" + "os/user" "path/filepath" "runtime" "strconv" @@ -19,14 +21,22 @@ import ( "testing" "time" + "github.com/go-delve/delve/pkg/goversion" protest "github.com/go-delve/delve/pkg/proc/test" "github.com/go-delve/delve/pkg/terminal" + "github.com/go-delve/delve/service/dap" "github.com/go-delve/delve/service/dap/daptest" "github.com/go-delve/delve/service/rpc2" + godap "github.com/google/go-dap" "golang.org/x/tools/go/packages" ) var testBackend string +var ldFlags string + +func init() { + ldFlags = os.Getenv("CGO_LDFLAGS") +} func TestMain(m *testing.M) { flag.StringVar(&testBackend, "backend", "", "selects backend") @@ -44,6 +54,7 @@ func TestMain(m *testing.M) { } func assertNoError(err error, t testing.TB, s string) { + t.Helper() if err != nil { _, file, line, _ := runtime.Caller(1) fname := filepath.Base(file) @@ -93,7 +104,9 @@ func TestBuild(t *testing.T) { cmd.Dir = buildtestdir stderr, err := cmd.StderrPipe() assertNoError(err, t, "stderr pipe") - cmd.Start() + defer stderr.Close() + + assertNoError(cmd.Start(), t, "dlv debug") scan := bufio.NewScanner(stderr) // wait for the debugger to start @@ -134,15 +147,13 @@ func testOutput(t *testing.T, dlvbin, output string, delveCmds []string) (stdout cmd := exec.Command(c[0], c[1:]...) cmd.Dir = buildtestdir stdin, err := cmd.StdinPipe() - if err != nil { - t.Fatal(err) - } + assertNoError(err, t, "stdin pipe") + defer stdin.Close() + cmd.Stdout = &stdoutBuf cmd.Stderr = &stderrBuf - if err := cmd.Start(); err != nil { - t.Fatal(err) - } + assertNoError(cmd.Start(), t, "dlv debug with output") // Give delve some time to compile and write the binary. foundIt := false @@ -170,14 +181,14 @@ func testOutput(t *testing.T, dlvbin, output string, delveCmds []string) (stdout _, err = os.Stat(debugbin) if err == nil { - if strings.ToLower(os.Getenv("TRAVIS")) == "true" && runtime.GOOS == "windows" { - // Sometimes delve on Travis on Windows can't remove the built binary before - // exiting and gets an "Access is denied" error when trying. - // Just ignore it. - // See: https://travis-ci.com/go-delve/delve/jobs/296325131 - return + // Sometimes delve on Windows can't remove the built binary before + // exiting and gets an "Access is denied" error when trying. + // See: https://travis-ci.com/go-delve/delve/jobs/296325131) + // We have added a delay to gobuild.Remove, but to avoid any test + // flakiness, we guard against this failure here as well. + if runtime.GOOS != "windows" || !strings.Contains(err.Error(), "Access is denied") { + t.Errorf("running %q: file %v was not deleted\nstdout is %q, stderr is %q", delveCmds, debugbin, stdout, stderr) } - t.Errorf("running %q: file %v was not deleted\nstdout is %q, stderr is %q", delveCmds, debugbin, stdout, stderr) return } if !os.IsNotExist(err) { @@ -188,13 +199,29 @@ func testOutput(t *testing.T, dlvbin, output string, delveCmds []string) (stdout } func getDlvBin(t *testing.T) (string, string) { + // In case this was set in the environment + // from getDlvBinEBPF lets clear it here so + // we can ensure we don't get build errors + // depending on the test ordering. + os.Setenv("CGO_LDFLAGS", ldFlags) + return getDlvBinInternal(t) +} + +func getDlvBinEBPF(t *testing.T) (string, string) { + return getDlvBinInternal(t, "-tags", "ebpf") +} + +func getDlvBinInternal(t *testing.T, goflags ...string) (string, string) { tmpdir, err := ioutil.TempDir("", "TestDlv") if err != nil { t.Fatal(err) } dlvbin := filepath.Join(tmpdir, "dlv.exe") - out, err := exec.Command("go", "build", "-o", dlvbin, "github.com/go-delve/delve/cmd/dlv").CombinedOutput() + args := append([]string{"build", "-o", dlvbin}, goflags...) + args = append(args, "github.com/go-delve/delve/cmd/dlv") + + out, err := exec.Command("go", args...).CombinedOutput() if err != nil { t.Fatalf("go build -o %v github.com/go-delve/delve/cmd/dlv: %v\n%s", dlvbin, err, string(out)) } @@ -230,10 +257,10 @@ func TestContinue(t *testing.T) { cmd := exec.Command(dlvbin, "debug", "--headless", "--continue", "--accept-multiclient", "--listen", listenAddr) cmd.Dir = buildtestdir stdout, err := cmd.StdoutPipe() - assertNoError(err, t, "stderr pipe") - if err := cmd.Start(); err != nil { - t.Fatalf("could not start headless instance: %v", err) - } + assertNoError(err, t, "stdout pipe") + defer stdout.Close() + + assertNoError(cmd.Start(), t, "start headless instance") scan := bufio.NewScanner(stdout) // wait for the debugger to start @@ -275,10 +302,10 @@ func TestChildProcessExitWhenNoDebugInfo(t *testing.T) { // search the running process named fix.Name cmd := exec.Command("ps", "-aux") stdout, err := cmd.StdoutPipe() - assertNoError(err, t, "stderr pipe") - if err := cmd.Start(); err != nil { - t.Fatalf("`ps -aux` failed: %v", err) - } + assertNoError(err, t, "stdout pipe") + defer stdout.Close() + + assertNoError(cmd.Start(), t, "start `ps -aux`") var foundFlag bool scan := bufio.NewScanner(stdout) @@ -296,15 +323,58 @@ func TestChildProcessExitWhenNoDebugInfo(t *testing.T) { } } +// TestRedirect verifies that redirecting stdin works +func TestRedirect(t *testing.T) { + const listenAddr = "127.0.0.1:40573" + + dlvbin, tmpdir := getDlvBin(t) + defer os.RemoveAll(tmpdir) + + catfixture := filepath.Join(protest.FindFixturesDir(), "cat.go") + cmd := exec.Command(dlvbin, "debug", "--headless", "--continue", "--accept-multiclient", "--listen", listenAddr, "-r", catfixture, catfixture) + stdout, err := cmd.StdoutPipe() + assertNoError(err, t, "stdout pipe") + defer stdout.Close() + + assertNoError(cmd.Start(), t, "start headless instance") + + scan := bufio.NewScanner(stdout) + // wait for the debugger to start + for scan.Scan() { + t.Log(scan.Text()) + if scan.Text() == "read \"}\"" { + break + } + } + + // and detach from and kill the headless instance + client := rpc2.NewClient(listenAddr) + _ = client.Detach(true) + cmd.Wait() +} + +const checkAutogenDocLongOutput = false + func checkAutogenDoc(t *testing.T, filename, gencommand string, generated []byte) { saved := slurpFile(t, filepath.Join(projectRoot(), filename)) + saved = bytes.ReplaceAll(saved, []byte("\r\n"), []byte{'\n'}) + generated = bytes.ReplaceAll(generated, []byte("\r\n"), []byte{'\n'}) + if len(saved) != len(generated) { + if checkAutogenDocLongOutput { + t.Logf("generated %q saved %q\n", generated, saved) + } + diffMaybe(t, filename, generated) t.Fatalf("%s: needs to be regenerated; run %s", filename, gencommand) } for i := range saved { if saved[i] != generated[i] { + if checkAutogenDocLongOutput { + t.Logf("generated %q saved %q\n", generated, saved) + } + diffMaybe(t, filename, generated) t.Fatalf("%s: needs to be regenerated; run %s", filename, gencommand) } } @@ -318,6 +388,22 @@ func slurpFile(t *testing.T, filename string) []byte { return saved } +func diffMaybe(t *testing.T, filename string, generated []byte) { + _, err := exec.LookPath("diff") + if err != nil { + return + } + cmd := exec.Command("diff", filename, "-") + cmd.Dir = projectRoot() + stdin, _ := cmd.StdinPipe() + go func() { + stdin.Write(generated) + stdin.Close() + }() + out, _ := cmd.CombinedOutput() + t.Logf("diff:\n%s", string(out)) +} + // TestGeneratedDoc tests that the autogenerated documentation has been // updated. func TestGeneratedDoc(t *testing.T) { @@ -359,6 +445,10 @@ func TestGeneratedDoc(t *testing.T) { checkAutogenDoc(t, "pkg/terminal/starbind/starlark_mapping.go", "'go generate' inside pkg/terminal/starbind", runScript("_scripts/gen-starlark-bindings.go", "go", "-")) checkAutogenDoc(t, "Documentation/cli/starlark.md", "'go generate' inside pkg/terminal/starbind", runScript("_scripts/gen-starlark-bindings.go", "doc/dummy", "Documentation/cli/starlark.md")) + checkAutogenDoc(t, "Documentation/backend_test_health.md", "go run _scripts/gen-backend_test_health.go", runScript("_scripts/gen-backend_test_health.go", "-")) + checkAutogenDoc(t, "_scripts/rtype-out.txt", "go run _scripts/rtype.go report _scripts/rtype-out.txt", runScript("_scripts/rtype.go", "report")) + + runScript("_scripts/rtype.go", "check") } func TestExitInInit(t *testing.T) { @@ -559,8 +649,8 @@ func TestTypecheckRPC(t *testing.T) { } } -// TestDap verifies that a dap server can be started and shut down. -func TestDap(t *testing.T) { +// TestDAPCmd verifies that a dap server can be started and shut down. +func TestDAPCmd(t *testing.T) { const listenAddr = "127.0.0.1:40575" dlvbin, tmpdir := getDlvBin(t) @@ -569,11 +659,12 @@ func TestDap(t *testing.T) { cmd := exec.Command(dlvbin, "dap", "--log-output=dap", "--log", "--listen", listenAddr) stdout, err := cmd.StdoutPipe() assertNoError(err, t, "stdout pipe") + defer stdout.Close() stderr, err := cmd.StderrPipe() assertNoError(err, t, "stderr pipe") - if err := cmd.Start(); err != nil { - t.Fatalf("could not start dap instance: %v", err) - } + defer stderr.Close() + + assertNoError(cmd.Start(), t, "start dap instance") scanOut := bufio.NewScanner(stdout) scanErr := bufio.NewScanner(stderr) @@ -594,6 +685,7 @@ func TestDap(t *testing.T) { client := daptest.NewClient(listenAddr) client.DisconnectRequest() client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) if _, err := client.ReadMessage(); err != io.EOF { t.Errorf("got %q, want \"EOF\"\n", err) } @@ -601,6 +693,238 @@ func TestDap(t *testing.T) { cmd.Wait() } +func newDAPRemoteClient(t *testing.T, addr string) *daptest.Client { + c := daptest.NewClient(addr) + c.AttachRequest(map[string]interface{}{"mode": "remote", "stopOnEntry": true}) + c.ExpectInitializedEvent(t) + c.ExpectAttachResponse(t) + c.ConfigurationDoneRequest() + c.ExpectStoppedEvent(t) + c.ExpectConfigurationDoneResponse(t) + return c +} + +func TestRemoteDAPClient(t *testing.T) { + const listenAddr = "127.0.0.1:40576" + + dlvbin, tmpdir := getDlvBin(t) + defer os.RemoveAll(tmpdir) + + buildtestdir := filepath.Join(protest.FindFixturesDir(), "buildtest") + cmd := exec.Command(dlvbin, "debug", "--headless", "--log-output=dap", "--log", "--listen", listenAddr) + cmd.Dir = buildtestdir + stdout, err := cmd.StdoutPipe() + assertNoError(err, t, "stdout pipe") + defer stdout.Close() + stderr, err := cmd.StderrPipe() + assertNoError(err, t, "stderr pipe") + defer stderr.Close() + assertNoError(cmd.Start(), t, "start headless instance") + + scanOut := bufio.NewScanner(stdout) + scanErr := bufio.NewScanner(stderr) + // Wait for the debug server to start + scanOut.Scan() + t.Log(scanOut.Text()) + go func() { // Capture logging + for scanErr.Scan() { + t.Log(scanErr.Text()) + } + }() + + client := newDAPRemoteClient(t, listenAddr) + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectTerminatedEvent(t) + + client.DisconnectRequest() + client.ExpectOutputEventProcessExited(t, 0) + client.ExpectOutputEventDetaching(t) + client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) + if _, err := client.ReadMessage(); err == nil { + t.Error("expected read error upon shutdown") + } + client.Close() + cmd.Wait() +} + +func closeDAPRemoteMultiClient(t *testing.T, c *daptest.Client, expectStatus string) { + c.DisconnectRequest() + c.ExpectOutputEventClosingClient(t, expectStatus) + c.ExpectDisconnectResponse(t) + c.ExpectTerminatedEvent(t) + c.Close() + time.Sleep(10 * time.Millisecond) +} + +func TestRemoteDAPClientMulti(t *testing.T) { + const listenAddr = "127.0.0.1:40577" + + dlvbin, tmpdir := getDlvBin(t) + defer os.RemoveAll(tmpdir) + + buildtestdir := filepath.Join(protest.FindFixturesDir(), "buildtest") + cmd := exec.Command(dlvbin, "debug", "--headless", "--accept-multiclient", "--log-output=debugger", "--log", "--listen", listenAddr) + cmd.Dir = buildtestdir + stdout, err := cmd.StdoutPipe() + assertNoError(err, t, "stdout pipe") + defer stdout.Close() + stderr, err := cmd.StderrPipe() + assertNoError(err, t, "stderr pipe") + defer stderr.Close() + assertNoError(cmd.Start(), t, "start headless instance") + + scanOut := bufio.NewScanner(stdout) + scanErr := bufio.NewScanner(stderr) + // Wait for the debug server to start + scanOut.Scan() + t.Log(scanOut.Text()) + go func() { // Capture logging + for scanErr.Scan() { + t.Log(scanErr.Text()) + } + }() + + // Client 0 connects but with the wrong attach request + dapclient0 := daptest.NewClient(listenAddr) + dapclient0.AttachRequest(map[string]interface{}{"mode": "local"}) + dapclient0.ExpectErrorResponse(t) + + // Client 1 connects and continues to main.main + dapclient := newDAPRemoteClient(t, listenAddr) + dapclient.SetFunctionBreakpointsRequest([]godap.FunctionBreakpoint{{Name: "main.main"}}) + dapclient.ExpectSetFunctionBreakpointsResponse(t) + dapclient.ContinueRequest(1) + dapclient.ExpectContinueResponse(t) + dapclient.ExpectStoppedEvent(t) + dapclient.CheckStopLocation(t, 1, "main.main", 5) + closeDAPRemoteMultiClient(t, dapclient, "halted") + + // Client 2 reconnects at main.main and continues to process exit + dapclient2 := newDAPRemoteClient(t, listenAddr) + dapclient2.CheckStopLocation(t, 1, "main.main", 5) + dapclient2.ContinueRequest(1) + dapclient2.ExpectContinueResponse(t) + dapclient2.ExpectTerminatedEvent(t) + closeDAPRemoteMultiClient(t, dapclient2, "exited") + + // Attach to exited processs is an error + dapclient3 := daptest.NewClient(listenAddr) + dapclient3.AttachRequest(map[string]interface{}{"mode": "remote", "stopOnEntry": true}) + dapclient3.ExpectErrorResponseWith(t, dap.FailedToAttach, `Process \d+ has exited with status 0`, true) + closeDAPRemoteMultiClient(t, dapclient3, "exited") + + // But rpc clients can still connect and restart + rpcclient := rpc2.NewClient(listenAddr) + if _, err := rpcclient.Restart(false); err != nil { + t.Errorf("error restarting with rpc client: %v", err) + } + if err := rpcclient.Detach(true); err != nil { + t.Fatalf("error detaching from headless instance: %v", err) + } + cmd.Wait() +} + +func TestRemoteDAPClientAfterContinue(t *testing.T) { + const listenAddr = "127.0.0.1:40578" + + dlvbin, tmpdir := getDlvBin(t) + defer os.RemoveAll(tmpdir) + + fixture := protest.BuildFixture("loopprog", 0) + cmd := exec.Command(dlvbin, "exec", fixture.Path, "--headless", "--continue", "--accept-multiclient", "--log-output=debugger,dap", "--log", "--listen", listenAddr) + stdout, err := cmd.StdoutPipe() + assertNoError(err, t, "stdout pipe") + defer stdout.Close() + stderr, err := cmd.StderrPipe() + assertNoError(err, t, "stderr pipe") + defer stderr.Close() + assertNoError(cmd.Start(), t, "start headless instance") + + scanOut := bufio.NewScanner(stdout) + scanErr := bufio.NewScanner(stderr) + // Wait for the debug server to start + scanOut.Scan() // "API server listening..."" + t.Log(scanOut.Text()) + // Wait for the program to start + scanOut.Scan() // "past main" + t.Log(scanOut.Text()) + + go func() { // Capture logging + for scanErr.Scan() { + text := scanErr.Text() + if strings.Contains(text, "Internal Error") { + t.Error("ERROR", text) + } else { + t.Log(text) + } + } + }() + + c := newDAPRemoteClient(t, listenAddr) + c.ContinueRequest(1) + c.ExpectContinueResponse(t) + c.DisconnectRequest() + c.ExpectOutputEventClosingClient(t, "running") + c.ExpectDisconnectResponse(t) + c.ExpectTerminatedEvent(t) + c.Close() + + c = newDAPRemoteClient(t, listenAddr) + c.DisconnectRequestWithKillOption(true) + c.ExpectOutputEventDetachingKill(t) + c.ExpectDisconnectResponse(t) + c.ExpectTerminatedEvent(t) + if _, err := c.ReadMessage(); err == nil { + t.Error("expected read error upon shutdown") + } + c.Close() + cmd.Wait() +} + +// TestDAPCmdWithClient tests dlv dap --client-addr can be started and shut down. +func TestDAPCmdWithClient(t *testing.T) { + listener, err := net.Listen("tcp", ":0") + if err != nil { + t.Fatalf("cannot setup listener required for testing: %v", err) + } + defer listener.Close() + + dlvbin, tmpdir := getDlvBin(t) + defer os.RemoveAll(tmpdir) + + cmd := exec.Command(dlvbin, "dap", "--log-output=dap", "--log", "--client-addr", listener.Addr().String()) + buf := &bytes.Buffer{} + cmd.Stdin = buf + cmd.Stdout = buf + assertNoError(cmd.Start(), t, "start dlv dap process with --client-addr flag") + + // Wait for the connection. + conn, err := listener.Accept() + if err != nil { + cmd.Process.Kill() // release the port + t.Fatalf("Failed to get connection: %v", err) + } + t.Log("dlv dap process dialed in successfully") + + client := daptest.NewClientFromConn(conn) + client.InitializeRequest() + client.ExpectInitializeResponse(t) + + // Close the connection. + if err := conn.Close(); err != nil { + cmd.Process.Kill() + t.Fatalf("Failed to get connection: %v", err) + } + + // Connection close should trigger dlv-reverse command's normal exit. + if err := cmd.Wait(); err != nil { + cmd.Process.Kill() + t.Fatalf("command failed: %v\n%s\n%v", err, buf.Bytes(), cmd.Process.Pid) + } +} + func TestTrace(t *testing.T) { dlvbin, tmpdir := getDlvBin(t) defer os.RemoveAll(tmpdir) @@ -610,18 +934,16 @@ func TestTrace(t *testing.T) { fixtures := protest.FindFixturesDir() cmd := exec.Command(dlvbin, "trace", "--output", filepath.Join(tmpdir, "__debug"), filepath.Join(fixtures, "issue573.go"), "foo") rdr, err := cmd.StderrPipe() - if err != nil { - t.Fatal(err) - } + assertNoError(err, t, "stderr pipe") + defer rdr.Close() + cmd.Dir = filepath.Join(fixtures, "buildtest") - err = cmd.Start() - if err != nil { - t.Fatalf("error running trace: %v", err) - } + + assertNoError(cmd.Start(), t, "running trace") + output, err := ioutil.ReadAll(rdr) - if err != nil { - t.Fatal(err) - } + assertNoError(err, t, "ReadAll") + if !bytes.Contains(output, expected) { t.Fatalf("expected:\n%s\ngot:\n%s", string(expected), string(output)) } @@ -645,9 +967,8 @@ func TestTracePid(t *testing.T) { // make process run fix := protest.BuildFixture("issue2023", 0) targetCmd := exec.Command(fix.Path) - if err := targetCmd.Start(); err != nil { - t.Fatal(err) - } + assertNoError(targetCmd.Start(), t, "execute issue2023") + if targetCmd.Process == nil || targetCmd.Process.Pid == 0 { t.Fatal("expected target process runninng") } @@ -656,17 +977,14 @@ func TestTracePid(t *testing.T) { // dlv attach the process by pid cmd := exec.Command(dlvbin, "trace", "-p", strconv.Itoa(targetCmd.Process.Pid), "main.A") rdr, err := cmd.StderrPipe() - if err != nil { - t.Fatal(err) - } - err = cmd.Start() - if err != nil { - t.Fatalf("error running trace: %#v", err) - } + assertNoError(err, t, "stderr pipe") + defer rdr.Close() + + assertNoError(cmd.Start(), t, "running trace") + output, err := ioutil.ReadAll(rdr) - if err != nil { - t.Fatal(err) - } + assertNoError(err, t, "ReadAll") + if !bytes.Contains(output, expected) { t.Fatalf("expected:\n%s\ngot:\n%s", string(expected), string(output)) } @@ -684,20 +1002,18 @@ func TestTraceBreakpointExists(t *testing.T) { // TODO: Perhaps we shouldn't be setting these default breakpoints in trace mode, however. cmd := exec.Command(dlvbin, "trace", "--output", filepath.Join(tmpdir, "__debug"), filepath.Join(fixtures, "issue573.go"), "runtime.*") rdr, err := cmd.StderrPipe() - if err != nil { - t.Fatal(err) - } + assertNoError(err, t, "stderr pipe") + defer rdr.Close() + cmd.Dir = filepath.Join(fixtures, "buildtest") - err = cmd.Start() - if err != nil { - t.Fatalf("error running trace: %v", err) - } + + assertNoError(cmd.Start(), t, "running trace") + defer cmd.Wait() output, err := ioutil.ReadAll(rdr) - if err != nil { - t.Fatal(err) - } + assertNoError(err, t, "ReadAll") + if bytes.Contains(output, []byte("Breakpoint exists")) { t.Fatal("Breakpoint exists errors should be ignored") } @@ -710,23 +1026,60 @@ func TestTracePrintStack(t *testing.T) { fixtures := protest.FindFixturesDir() cmd := exec.Command(dlvbin, "trace", "--output", filepath.Join(tmpdir, "__debug"), "--stack", "2", filepath.Join(fixtures, "issue573.go"), "foo") rdr, err := cmd.StderrPipe() - if err != nil { - t.Fatal(err) - } + assertNoError(err, t, "stderr pipe") + defer rdr.Close() + cmd.Dir = filepath.Join(fixtures, "buildtest") - err = cmd.Start() - if err != nil { - t.Fatalf("error running trace: %v", err) - } + assertNoError(cmd.Start(), t, "running trace") + defer cmd.Wait() output, err := ioutil.ReadAll(rdr) + assertNoError(err, t, "ReadAll") + + if !bytes.Contains(output, []byte("Stack:")) && !bytes.Contains(output, []byte("main.main")) { + t.Fatal("stacktrace not printed") + } +} + +func TestTraceEBPF(t *testing.T) { + if os.Getenv("CI") == "true" { + t.Skip("cannot run test in CI, requires kernel compiled with btf support") + } + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { + t.Skip("not implemented on non linux/amd64 systems") + } + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 16) { + t.Skip("requires at least Go 1.16 to run test") + } + usr, err := user.Current() if err != nil { t.Fatal(err) } - if !bytes.Contains(output, []byte("Stack:")) && !bytes.Contains(output, []byte("main.main")) { - t.Fatal("stacktrace not printed") + if usr.Uid != "0" { + t.Skip("test must be run as root") + } + + dlvbin, tmpdir := getDlvBinEBPF(t) + defer os.RemoveAll(tmpdir) + + expected := []byte("> (1) main.foo(99, 9801)\n=> \"9900\"") + + fixtures := protest.FindFixturesDir() + cmd := exec.Command(dlvbin, "trace", "--ebpf", "--output", filepath.Join(tmpdir, "__debug"), filepath.Join(fixtures, "issue573.go"), "foo") + rdr, err := cmd.StderrPipe() + assertNoError(err, t, "stderr pipe") + defer rdr.Close() + + assertNoError(cmd.Start(), t, "running trace") + + output, err := ioutil.ReadAll(rdr) + assertNoError(err, t, "ReadAll") + + if !bytes.Contains(output, expected) { + t.Fatalf("expected:\n%s\ngot:\n%s", string(expected), string(output)) } + cmd.Wait() } func TestDlvTestChdir(t *testing.T) { @@ -748,3 +1101,44 @@ func TestDlvTestChdir(t *testing.T) { t.Errorf("output did not contain expected string %q", tgt) } } + +func TestVersion(t *testing.T) { + dlvbin, tmpdir := getDlvBin(t) + defer os.RemoveAll(tmpdir) + + got, err := exec.Command(dlvbin, "version", "-v").CombinedOutput() + if err != nil { + t.Fatalf("error executing `dlv version`: %v\n%s\n", err, got) + } + want1 := []byte("mod\tgithub.com/go-delve/delve") + want2 := []byte("dep\tgithub.com/google/go-dap") + if !bytes.Contains(got, want1) || !bytes.Contains(got, want2) { + t.Errorf("got %s\nwant %v and %v in the output", got, want1, want2) + } +} + +func TestStaticcheck(t *testing.T) { + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) { + //TODO(aarzilli): remove this before version 1.8.0 is released + t.Skip("staticcheck does not currently support Go 1.18") + } + _, err := exec.LookPath("staticcheck") + if err != nil { + t.Skip("staticcheck not installed") + } + // default checks minus SA1019 which complains about deprecated identifiers, which change between versions of Go. + args := []string{"-tests=false", "-checks=all,-SA1019,-ST1000,-ST1003,-ST1016,-S1021,-ST1023", "github.com/go-delve/delve/..."} + // * SA1019 is disabled because new deprecations get added on every version + // of Go making the output of staticcheck inconsistent depending on the + // version of Go used to run it. + // * ST1000,ST1003,ST1016 are disabled in the default + // staticcheck configuration + // * S1021 "Merge variable declaration and assignment" is disabled because + // where we don't do this it is a deliberate style choice. + // * ST1023 "Redundant type in variable declaration" same as S1021. + cmd := exec.Command("staticcheck", args...) + cmd.Dir = projectRoot() + cmd.Env = append(os.Environ(), "GOOS=linux", "GOARCH=amd64") + out, _ := cmd.CombinedOutput() + checkAutogenDoc(t, "_scripts/staticcheck-out.txt", fmt.Sprintf("staticcheck %s > _scripts/staticcheck-out.txt", strings.Join(args, " ")), out) +} diff --git a/go.mod b/go.mod index f473794e9e..8eb5d769e9 100644 --- a/go.mod +++ b/go.mod @@ -1,23 +1,23 @@ module github.com/go-delve/delve -go 1.11 +go 1.16 require ( + github.com/cilium/ebpf v0.7.0 github.com/cosiner/argv v0.1.0 - github.com/cpuguy83/go-md2man v1.0.10 // indirect github.com/creack/pty v1.1.9 - github.com/google/go-dap v0.2.0 + github.com/derekparker/trie v0.0.0-20200317170641-1fdf38b7b0e9 + github.com/google/go-dap v0.6.0 github.com/hashicorp/golang-lru v0.5.4 - github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561 + github.com/mattn/go-colorable v0.0.9 github.com/mattn/go-isatty v0.0.3 - github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b + github.com/peterh/liner v1.2.1 github.com/sirupsen/logrus v1.6.0 - github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372 - github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1 // indirect + github.com/spf13/cobra v1.1.3 + github.com/stretchr/testify v1.7.0 // indirect go.starlark.net v0.0.0-20200821142938-949cc6f4b097 golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4 - golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae - golang.org/x/tools v0.0.0-20191127201027-ecd32218bd7f - gopkg.in/yaml.v2 v2.2.1 + golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 + golang.org/x/tools v0.1.8 + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 6e15ea3d50..e79c3fd923 100644 --- a/go.sum +++ b/go.sum @@ -1,72 +1,359 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5 h1:rIXlvz2IWiupMFlC45cZCXZFvKX/ExBcSLrDy2G0Lp8= -github.com/cosiner/argv v0.0.0-20170225145430-13bacc38a0a5/go.mod h1:p/NrK5tF6ICIly4qwEDsf6VDirFiWWz0FenfYBwJaKQ= +github.com/cilium/ebpf v0.7.0 h1:1k/q3ATgxSXRdrmPfH8d7YK0GfqVsEKZAX9dQZvs56k= +github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosiner/argv v0.1.0 h1:BVDiEL32lwHukgJKP87btEPenzrrHUjajs/8yzaqcXg= github.com/cosiner/argv v0.1.0/go.mod h1:EusR6TucWKX+zFgtdUsKT2Cvg45K5rtpCcWz4hK06d8= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/go-dap v0.2.0 h1:whjIGQRumwbR40qRU7CEKuFLmePUUc2s4Nt9DoXXxWk= -github.com/google/go-dap v0.2.0/go.mod h1:5q8aYQFnHOAZEMP+6vmq25HKYAEwE+LF5yh7JKrrhSQ= +github.com/derekparker/trie v0.0.0-20200317170641-1fdf38b7b0e9 h1:G765iDCq7bP5opdrPkXk+4V3yfkgV9iGFuheWZ/X/zY= +github.com/derekparker/trie v0.0.0-20200317170641-1fdf38b7b0e9/go.mod h1:D6ICZm05D9VN1n/8iOtBxLpXtoGp6HDFUJ1RNVieOSE= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-dap v0.6.0 h1:Y1RHGUtv3R8y6sXq2dtGRMYrFB2hSqyFVws7jucrzX4= +github.com/google/go-dap v0.6.0/go.mod h1:5q8aYQFnHOAZEMP+6vmq25HKYAEwE+LF5yh7JKrrhSQ= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561 h1:isR/L+BIZ+rqODWYR/f526ygrBMGKZYFhaaFRDGvuZ8= -github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b h1:8uaXtUkxiy+T/zdLWuxa/PG4so0TPZDZfafFNNSaptE= -github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= +github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4= +github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/peterh/liner v1.2.1 h1:O4BlKaq/LWu6VRWmol4ByWfzx6MfXc5Op5HETyIy5yg= +github.com/peterh/liner v1.2.1/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372 h1:eRfW1vRS4th8IX2iQeyqQ8cOUNOySvAYJ0IUvTXGoYA= -github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1 h1:7bozMfSdo41n2NOc0GsVTTVUiA+Ncaj6pXNpm4UHKys= -github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.1.3 h1:xghbfqPkxzxP3C/f3n5DdpAbdKLj4ZE4BWQI362l53M= +github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -go.starlark.net v0.0.0-20190702223751-32f345186213 h1:lkYv5AKwvvduv5XWP6szk/bvvgO6aDeUujhZQXIFTes= -go.starlark.net v0.0.0-20190702223751-32f345186213/go.mod h1:c1/X6cHgvdXj6pUlmWKMkuqRnW4K8x2vwt6JAaaircg= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.starlark.net v0.0.0-20200821142938-949cc6f4b097 h1:YiRMXXgG+Pg26t1fjq+iAjaauKWMC9cmGFrtOEuwDDg= go.starlark.net v0.0.0-20200821142938-949cc6f4b097/go.mod h1:f0znQkUKRrkk36XxWbGjMqQM8wGv/xHBVE2qc3B5oFU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4 h1:QlVATYS7JBoZMVaf+cNjb90WD/beKVHnIxFKT4QaHVI= golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.5.1 h1:OJxoQ/rynoF0dcCdI7cLPktw/hR2cueqYfjm43oqK38= +golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 h1:id054HUawV2/6IGm2IV8KZQjqtwAOo2CYlOToYqa0d0= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191127201027-ecd32218bd7f h1:3MlESg/jvTr87F4ttA/q4B+uhe/q6qleC9/DP+IwQmY= -golang.org/x/tools v0.0.0-20191127201027-ecd32218bd7f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200415034506-5d8e1897c761 h1:FVw4lelfGRNPqB3C8qX1m+QyeM2vzToIwlFhEZX42y8= -golang.org/x/tools v0.0.0-20200415034506-5d8e1897c761/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc= +golang.org/x/tools v0.1.8-0.20211028023602-8de2a7fd1736 h1:cw6nUxdoEN5iEIWYD8aAsTZ8iYjLVNiHAb7xz/80WO4= +golang.org/x/tools v0.1.8-0.20211028023602-8de2a7fd1736/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= +golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w= +golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/pkg/config/config.go b/pkg/config/config.go index 34fd642660..6e9622ad2a 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -53,9 +53,24 @@ type Config struct { // expression for its argument. ShowLocationExpr bool `yaml:"show-location-expr"` - // Source list line-number color (3/4 bit color codes as defined - // here: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) - SourceListLineColor int `yaml:"source-list-line-color"` + // Source list line-number color, as a terminal escape sequence. + // For historic reasons, this can also be an integer color code. + SourceListLineColor interface{} `yaml:"source-list-line-color"` + + // Source list arrow color, as a terminal escape sequence. + SourceListArrowColor string `yaml:"source-list-arrow-color"` + + // Source list keyword color, as a terminal escape sequence. + SourceListKeywordColor string `yaml:"source-list-keyword-color"` + + // Source list string color, as a terminal escape sequence. + SourceListStringColor string `yaml:"source-list-string-color"` + + // Source list number color, as a terminal escape sequence. + SourceListNumberColor string `yaml:"source-list-number-color"` + + // Source list comment color, as a terminal escape sequence. + SourceListCommentColor string `yaml:"source-list-comment-color"` // number of lines to list above and below cursor when printfile() is // called (i.e. when execution stops, listCommand is used, etc) @@ -76,34 +91,27 @@ func (c *Config) GetSourceListLineCount() int { } // LoadConfig attempts to populate a Config object from the config.yml file. -func LoadConfig() *Config { +func LoadConfig() (*Config, error) { err := createConfigPath() if err != nil { - fmt.Printf("Could not create config directory: %v.", err) - return &Config{} + return &Config{}, fmt.Errorf("could not create config directory: %v", err) } fullConfigFile, err := GetConfigFilePath(configFile) if err != nil { - fmt.Printf("Unable to get config file path: %v.", err) - return &Config{} + return &Config{}, fmt.Errorf("unable to get config file path: %v", err) } - hasOldConfig, err := hasOldConfig() - if err != nil { - fmt.Fprintf(os.Stderr, "Unable to determine if old config exists: %v\n", err) - } + hasOldConfig, _ := hasOldConfig() if hasOldConfig { userHomeDir := getUserHomeDir() oldLocation := path.Join(userHomeDir, configDirHidden) if err := moveOldConfig(); err != nil { - fmt.Fprintf(os.Stderr, "Unable to move old config: %v\n", err) - return &Config{} + return &Config{}, fmt.Errorf("unable to move old config: %v", err) } if err := os.RemoveAll(oldLocation); err != nil { - fmt.Fprintf(os.Stderr, "Unable to remove old config location: %v\n", err) - return &Config{} + return &Config{}, fmt.Errorf("unable to remove old config location: %v", err) } fmt.Fprintf(os.Stderr, "Successfully moved config from: %s to: %s\n", oldLocation, fullConfigFile) } @@ -112,35 +120,27 @@ func LoadConfig() *Config { if err != nil { f, err = createDefaultConfig(fullConfigFile) if err != nil { - fmt.Printf("Error creating default config file: %v", err) - return &Config{} + return &Config{}, fmt.Errorf("error creating default config file: %v", err) } } - defer func() { - err := f.Close() - if err != nil { - fmt.Printf("Closing config file failed: %v.", err) - } - }() + defer f.Close() data, err := ioutil.ReadAll(f) if err != nil { - fmt.Printf("Unable to read config data: %v.", err) - return &Config{} + return &Config{}, fmt.Errorf("unable to read config data: %v", err) } var c Config err = yaml.Unmarshal(data, &c) if err != nil { - fmt.Printf("Unable to decode config file: %v.", err) - return &Config{} + return &Config{}, fmt.Errorf("unable to decode config file: %v", err) } if len(c.DebugInfoDirectories) == 0 { c.DebugInfoDirectories = []string{"/usr/lib/debug/.build-id"} } - return &c + return &c, nil } // SaveConfig will marshal and save the config struct @@ -212,10 +212,17 @@ func writeDefaultConfig(f *os.File) error { # This is the default configuration file. Available options are provided, but disabled. # Delete the leading hash mark to enable an item. -# Uncomment the following line and set your preferred ANSI foreground color -# for source line numbers in the (list) command (if unset, default is 34, -# dark blue) See https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit -# source-list-line-color: 34 +# Uncomment the following line and set your preferred ANSI color for source +# line numbers in the (list) command. The default is 34 (dark blue). See +# https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit +# source-list-line-color: "\x1b[34m" + +# Uncomment the following lines to change the colors used by syntax highlighting. +# source-list-keyword-color: "\x1b[0m" +# source-list-string-color: "\x1b[92m" +# source-list-number-color: "\x1b[0m" +# source-list-comment-color: "\x1b[95m" +# source-list-arrow-color: "\x1b[93m" # Uncomment to change the number of lines printed above and below cursor when # listing source code. diff --git a/pkg/config/split.go b/pkg/config/split.go index 8279f22bca..22fe18cb52 100644 --- a/pkg/config/split.go +++ b/pkg/config/split.go @@ -2,6 +2,11 @@ package config import ( "bytes" + "fmt" + "io" + "reflect" + "strconv" + "strings" "unicode" ) @@ -61,3 +66,138 @@ func SplitQuotedFields(in string, quote rune) []string { return r } + +func ConfigureSetSimple(rest string, cfgname string, field reflect.Value) error { + simpleArg := func(typ reflect.Type) (reflect.Value, error) { + switch typ.Kind() { + case reflect.Int: + n, err := strconv.Atoi(rest) + if err != nil { + return reflect.ValueOf(nil), fmt.Errorf("argument to %q must be a number", cfgname) + } + if n < 0 { + return reflect.ValueOf(nil), fmt.Errorf("argument to %q must be a number greater than zero", cfgname) + } + return reflect.ValueOf(&n), nil + case reflect.Bool: + v := rest == "true" + return reflect.ValueOf(&v), nil + case reflect.String: + return reflect.ValueOf(&rest), nil + default: + return reflect.ValueOf(nil), fmt.Errorf("unsupported type for configuration key %q", cfgname) + } + } + + if field.Kind() == reflect.Ptr { + val, err := simpleArg(field.Type().Elem()) + if err != nil { + return err + } + field.Set(val) + } else { + val, err := simpleArg(field.Type()) + if err != nil { + return err + } + field.Set(val.Elem()) + } + return nil +} + +func ConfigureList(w io.Writer, config interface{}, tag string) { + it := IterateConfiguration(config, tag) + for it.Next() { + fieldName, field := it.Field() + if fieldName == "" { + continue + } + + writeField(w, field, fieldName) + } +} + +func writeField(w io.Writer, field reflect.Value, fieldName string) { + switch field.Kind() { + case reflect.Interface: + switch field := field.Interface().(type) { + case string: + fmt.Fprintf(w, "%s\t%q\n", fieldName, field) + default: + fmt.Fprintf(w, "%s\t%v\n", fieldName, field) + } + case reflect.Ptr: + if !field.IsNil() { + fmt.Fprintf(w, "%s\t%v\n", fieldName, field.Elem()) + } else { + fmt.Fprintf(w, "%s\t\n", fieldName) + } + case reflect.String: + fmt.Fprintf(w, "%s\t%q\n", fieldName, field) + default: + fmt.Fprintf(w, "%s\t%v\n", fieldName, field) + } +} + +type configureIterator struct { + cfgValue reflect.Value + cfgType reflect.Type + i int + tag string +} + +func IterateConfiguration(conf interface{}, tag string) *configureIterator { + cfgValue := reflect.ValueOf(conf).Elem() + cfgType := cfgValue.Type() + + return &configureIterator{cfgValue, cfgType, -1, tag} +} + +func (it *configureIterator) Next() bool { + it.i++ + return it.i < it.cfgValue.NumField() +} + +func (it *configureIterator) Field() (name string, field reflect.Value) { + name = it.cfgType.Field(it.i).Tag.Get(it.tag) + if comma := strings.Index(name, ","); comma >= 0 { + name = name[:comma] + } + field = it.cfgValue.Field(it.i) + return +} + +func ConfigureListByName(conf interface{}, name, tag string) string { + if name == "" { + return "" + } + it := IterateConfiguration(conf, tag) + for it.Next() { + fieldName, field := it.Field() + if fieldName == name { + var buf bytes.Buffer + writeField(&buf, field, fieldName) + return buf.String() + } + } + return "" +} + +func ConfigureFindFieldByName(conf interface{}, name, tag string) reflect.Value { + it := IterateConfiguration(conf, tag) + for it.Next() { + fieldName, field := it.Field() + if fieldName == name { + return field + } + } + return reflect.ValueOf(nil) +} + +func Split2PartsBySpace(s string) []string { + v := strings.SplitN(s, " ", 2) + for i := range v { + v[i] = strings.TrimSpace(v[i]) + } + return v +} diff --git a/pkg/config/split_test.go b/pkg/config/split_test.go index c49283b080..d2c258d0ec 100644 --- a/pkg/config/split_test.go +++ b/pkg/config/split_test.go @@ -35,3 +35,67 @@ func TestSplitDoubleQuotedFields(t *testing.T) { } } } + +func TestConfigureListByName(t *testing.T) { + type testConfig struct { + boolArg bool `cfgName:"bool-arg"` + listArg []string `cfgName:"list-arg"` + } + + type args struct { + sargs *testConfig + cfgname string + } + tests := []struct { + name string + args args + want string + }{ + { + name: "basic bool", + args: args{ + sargs: &testConfig{ + boolArg: true, + listArg: []string{}, + }, + cfgname: "bool-arg", + }, + want: "bool-arg true\n", + }, + { + name: "list arg", + args: args{ + sargs: &testConfig{ + boolArg: true, + listArg: []string{"item 1", "item 2"}, + }, + + cfgname: "list-arg", + }, + want: "list-arg [item 1 item 2]\n", + }, + { + name: "empty", + args: args{ + sargs: &testConfig{}, + cfgname: "", + }, + want: "", + }, + { + name: "invalid", + args: args{ + sargs: &testConfig{}, + cfgname: "nonexistent", + }, + want: "", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := ConfigureListByName(tt.args.sargs, tt.args.cfgname, "cfgName"); got != tt.want { + t.Errorf("ConfigureListByName() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/pkg/dwarf/dwarfbuilder/builder.go b/pkg/dwarf/dwarfbuilder/builder.go index 84fafe5290..37473bc9e6 100644 --- a/pkg/dwarf/dwarfbuilder/builder.go +++ b/pkg/dwarf/dwarfbuilder/builder.go @@ -9,6 +9,7 @@ import ( "fmt" ) +// Builder dwarf builder type Builder struct { info bytes.Buffer loc bytes.Buffer diff --git a/pkg/dwarf/dwarfbuilder/info.go b/pkg/dwarf/dwarfbuilder/info.go index 7d264b01cd..95b0f05d31 100644 --- a/pkg/dwarf/dwarfbuilder/info.go +++ b/pkg/dwarf/dwarfbuilder/info.go @@ -119,14 +119,14 @@ func (b *Builder) TagClose() { b.info.WriteByte(0) } b.tagStack = b.tagStack[:len(b.tagStack)-1] - return } // Attr adds an attribute to the current DIE. -func (b *Builder) Attr(attr dwarf.Attr, val interface{}) { - if len(b.tagStack) < 0 { +func (b *Builder) Attr(attr dwarf.Attr, val interface{}) dwarf.Offset { + if len(b.tagStack) == 0 { panic("Attr with no open tags") } + off := dwarf.Offset(b.info.Len()) tag := b.tagStack[len(b.tagStack)-1] if tag.children { panic("Can't add attributes after adding children") @@ -179,6 +179,16 @@ func (b *Builder) Attr(attr dwarf.Attr, val interface{}) { default: panic("unknown value type") } + + return off +} + +// PatchOffset writes the offset 'patch' at offset patchedOffset. +func (b *Builder) PatchOffset(patchedOffset, patch dwarf.Offset) { + infoBytes := b.info.Bytes() + buf := new(bytes.Buffer) + binary.Write(buf, binary.LittleEndian, patch) + copy(infoBytes[patchedOffset:], buf.Bytes()) } func sameTagDescr(a, b tagDescr) bool { diff --git a/pkg/dwarf/frame/entries.go b/pkg/dwarf/frame/entries.go index f78b1853b6..4c6f94d05b 100644 --- a/pkg/dwarf/frame/entries.go +++ b/pkg/dwarf/frame/entries.go @@ -6,7 +6,7 @@ import ( "sort" ) -// Represents a Common Information Entry in +// CommonInformationEntry represents a Common Information Entry in // the Dwarf .debug_frame section. type CommonInformationEntry struct { Length uint32 @@ -18,9 +18,12 @@ type CommonInformationEntry struct { ReturnAddressRegister uint64 InitialInstructions []byte staticBase uint64 + + // eh_frame pointer encoding + ptrEncAddr ptrEnc } -// Represents a Frame Descriptor Entry in the +// FrameDescriptionEntry represents a Frame Descriptor Entry in the // Dwarf .debug_frame section. type FrameDescriptionEntry struct { Length uint32 @@ -30,23 +33,28 @@ type FrameDescriptionEntry struct { order binary.ByteOrder } -// Returns whether or not the given address is within the +// Cover returns whether or not the given address is within the // bounds of this frame. func (fde *FrameDescriptionEntry) Cover(addr uint64) bool { return (addr - fde.begin) < fde.size } -// Address of first location for this frame. +// Begin returns address of first location for this frame. func (fde *FrameDescriptionEntry) Begin() uint64 { return fde.begin } -// Address of last location for this frame. +// End returns address of last location for this frame. func (fde *FrameDescriptionEntry) End() uint64 { return fde.begin + fde.size } -// Set up frame for the given PC. +// Translate moves the beginning of fde forward by delta. +func (fde *FrameDescriptionEntry) Translate(delta uint64) { + fde.begin += delta +} + +// EstablishFrame set up frame for the given PC. func (fde *FrameDescriptionEntry) EstablishFrame(pc uint64) *FrameContext { return executeDwarfProgramUntilPC(fde, pc) } @@ -57,6 +65,7 @@ func newFrameIndex() FrameDescriptionEntries { return make(FrameDescriptionEntries, 0, 1000) } +// ErrNoFDEForPC FDE for PC not found error type ErrNoFDEForPC struct { PC uint64 } @@ -65,7 +74,7 @@ func (err *ErrNoFDEForPC) Error() string { return fmt.Sprintf("could not find FDE for PC %#v", err.PC) } -// Returns the Frame Description Entry for the given PC. +// FDEForPC returns the Frame Description Entry for the given PC. func (fdes FrameDescriptionEntries) FDEForPC(pc uint64) (*FrameDescriptionEntry, error) { idx := sort.Search(len(fdes), func(i int) bool { return fdes[i].Cover(pc) || fdes[i].Begin() >= pc @@ -79,8 +88,64 @@ func (fdes FrameDescriptionEntries) FDEForPC(pc uint64) (*FrameDescriptionEntry, // Append appends otherFDEs to fdes and returns the result. func (fdes FrameDescriptionEntries) Append(otherFDEs FrameDescriptionEntries) FrameDescriptionEntries { r := append(fdes, otherFDEs...) - sort.Slice(r, func(i, j int) bool { + sort.SliceStable(r, func(i, j int) bool { return r[i].Begin() < r[j].Begin() }) + // remove duplicates + uniqFDEs := fdes[:0] + for _, fde := range fdes { + if len(uniqFDEs) > 0 { + last := uniqFDEs[len(uniqFDEs)-1] + if last.Begin() == fde.Begin() && last.End() == fde.End() { + continue + } + } + uniqFDEs = append(uniqFDEs, fde) + } return r } + +// ptrEnc represents a pointer encoding value, used during eh_frame decoding +// to determine how pointers were encoded. +// Least significant 4 (0xf) bytes encode the size as well as its +// signed-ness, most significant 4 bytes (0xf0) are flags describing how +// the value should be interpreted (absolute, relative...) +// See https://www.airs.com/blog/archives/460. +type ptrEnc uint8 + +const ( + ptrEncAbs ptrEnc = 0x00 // pointer-sized unsigned integer + ptrEncOmit ptrEnc = 0xff // omitted + ptrEncUleb ptrEnc = 0x01 // ULEB128 + ptrEncUdata2 ptrEnc = 0x02 // 2 bytes + ptrEncUdata4 ptrEnc = 0x03 // 4 bytes + ptrEncUdata8 ptrEnc = 0x04 // 8 bytes + ptrEncSigned ptrEnc = 0x08 // pointer-sized signed integer + ptrEncSleb ptrEnc = 0x09 // SLEB128 + ptrEncSdata2 ptrEnc = 0x0a // 2 bytes, signed + ptrEncSdata4 ptrEnc = 0x0b // 4 bytes, signed + ptrEncSdata8 ptrEnc = 0x0c // 8 bytes, signed + + ptrEncPCRel ptrEnc = 0x10 // value is relative to the memory address where it appears + ptrEncTextRel ptrEnc = 0x20 // value is relative to the address of the text section + ptrEncDataRel ptrEnc = 0x30 // value is relative to the address of the data section + ptrEncFuncRel ptrEnc = 0x40 // value is relative to the start of the function + ptrEncAligned ptrEnc = 0x50 // value should be aligned + ptrEncIndirect ptrEnc = 0x80 // value is an address where the real value of the pointer is stored +) + +// Supported returns true if this pointer encoding is supported. +func (ptrEnc ptrEnc) Supported() bool { + if ptrEnc != ptrEncOmit { + szenc := ptrEnc & 0x0f + if ((szenc > ptrEncUdata8) && (szenc < ptrEncSigned)) || (szenc > ptrEncSdata8) { + // These values aren't defined at the moment + return false + } + if ptrEnc&0xf0 != ptrEncPCRel { + // Currently only the PC relative flag is supported + return false + } + } + return true +} diff --git a/pkg/dwarf/frame/entries_test.go b/pkg/dwarf/frame/entries_test.go index 30506380cf..593d451689 100644 --- a/pkg/dwarf/frame/entries_test.go +++ b/pkg/dwarf/frame/entries_test.go @@ -67,7 +67,7 @@ func BenchmarkFDEForPC(b *testing.B) { if err != nil { b.Fatal(err) } - fdes := Parse(data, binary.BigEndian, 0, ptrSizeByRuntimeArch()) + fdes, _ := Parse(data, binary.BigEndian, 0, ptrSizeByRuntimeArch(), 0) for i := 0; i < b.N; i++ { // bench worst case, exhaustive search diff --git a/pkg/dwarf/frame/parser.go b/pkg/dwarf/frame/parser.go index 086b131c71..bcec7e5696 100644 --- a/pkg/dwarf/frame/parser.go +++ b/pkg/dwarf/frame/parser.go @@ -6,6 +6,8 @@ package frame import ( "bytes" "encoding/binary" + "fmt" + "io" "github.com/go-delve/delve/pkg/dwarf/util" ) @@ -15,82 +17,135 @@ type parsefunc func(*parseContext) parsefunc type parseContext struct { staticBase uint64 - buf *bytes.Buffer - entries FrameDescriptionEntries - common *CommonInformationEntry - frame *FrameDescriptionEntry - length uint32 - ptrSize int + buf *bytes.Buffer + totalLen int + entries FrameDescriptionEntries + ciemap map[int]*CommonInformationEntry + common *CommonInformationEntry + frame *FrameDescriptionEntry + length uint32 + ptrSize int + ehFrameAddr uint64 + err error } -// Parse takes in data (a byte slice) and returns a slice of -// commonInformationEntry structures. Each commonInformationEntry -// has a slice of frameDescriptionEntry structures. -func Parse(data []byte, order binary.ByteOrder, staticBase uint64, ptrSize int) FrameDescriptionEntries { +// Parse takes in data (a byte slice) and returns FrameDescriptionEntries, +// which is a slice of FrameDescriptionEntry. Each FrameDescriptionEntry +// has a pointer to CommonInformationEntry. +// If ehFrameAddr is not zero the .eh_frame format will be used, a minor variant of DWARF described at https://www.airs.com/blog/archives/460. +// The value of ehFrameAddr will be used as the address at which eh_frame will be mapped into memory +func Parse(data []byte, order binary.ByteOrder, staticBase uint64, ptrSize int, ehFrameAddr uint64) (FrameDescriptionEntries, error) { var ( buf = bytes.NewBuffer(data) - pctx = &parseContext{buf: buf, entries: newFrameIndex(), staticBase: staticBase, ptrSize: ptrSize} + pctx = &parseContext{buf: buf, totalLen: len(data), entries: newFrameIndex(), staticBase: staticBase, ptrSize: ptrSize, ehFrameAddr: ehFrameAddr, ciemap: map[int]*CommonInformationEntry{}} ) for fn := parselength; buf.Len() != 0; { fn = fn(pctx) + if pctx.err != nil { + return nil, pctx.err + } } for i := range pctx.entries { pctx.entries[i].order = order } - return pctx.entries + return pctx.entries, nil } -func cieEntry(data []byte) bool { - return bytes.Equal(data, []byte{0xff, 0xff, 0xff, 0xff}) +func (ctx *parseContext) parsingEHFrame() bool { + return ctx.ehFrameAddr > 0 +} + +func (ctx *parseContext) cieEntry(cieid uint32) bool { + if ctx.parsingEHFrame() { + return cieid == 0x00 + } + return cieid == 0xffffffff +} + +func (ctx *parseContext) offset() int { + return ctx.totalLen - ctx.buf.Len() } func parselength(ctx *parseContext) parsefunc { - binary.Read(ctx.buf, binary.LittleEndian, &ctx.length) + start := ctx.offset() + binary.Read(ctx.buf, binary.LittleEndian, &ctx.length) //TODO(aarzilli): this does not support 64bit DWARF if ctx.length == 0 { // ZERO terminator return parselength } - var data = ctx.buf.Next(4) + var cieid uint32 + binary.Read(ctx.buf, binary.LittleEndian, &cieid) ctx.length -= 4 // take off the length of the CIE id / CIE pointer. - if cieEntry(data) { - ctx.common = &CommonInformationEntry{Length: ctx.length, staticBase: ctx.staticBase} + if ctx.cieEntry(cieid) { + ctx.common = &CommonInformationEntry{Length: ctx.length, staticBase: ctx.staticBase, CIE_id: cieid} + ctx.ciemap[start] = ctx.common return parseCIE } - ctx.frame = &FrameDescriptionEntry{Length: ctx.length, CIE: ctx.common} + if ctx.ehFrameAddr > 0 { + cieid = uint32(start - int(cieid) + 4) + } + + common := ctx.ciemap[int(cieid)] + + if common == nil { + ctx.err = fmt.Errorf("unknown CIE_id %#x at %#x", cieid, start) + } + + ctx.frame = &FrameDescriptionEntry{Length: ctx.length, CIE: common} return parseFDE } func parseFDE(ctx *parseContext) parsefunc { - var num uint64 + startOff := ctx.offset() r := ctx.buf.Next(int(ctx.length)) reader := bytes.NewReader(r) - num, _ = util.ReadUintRaw(reader, binary.LittleEndian, ctx.ptrSize) + num := ctx.readEncodedPtr(addrSum(ctx.ehFrameAddr+uint64(startOff), reader), reader, ctx.frame.CIE.ptrEncAddr) ctx.frame.begin = num + ctx.staticBase - num, _ = util.ReadUintRaw(reader, binary.LittleEndian, ctx.ptrSize) - ctx.frame.size = num + + // For the size field in .eh_frame only the size encoding portion of the + // address pointer encoding is considered. + // See decode_frame_entry_1 in gdb/dwarf2-frame.c. + // For .debug_frame ptrEncAddr is always ptrEncAbs and never has flags. + sizePtrEnc := ctx.frame.CIE.ptrEncAddr & 0x0f + ctx.frame.size = ctx.readEncodedPtr(0, reader, sizePtrEnc) // Insert into the tree after setting address range begin // otherwise compares won't work. ctx.entries = append(ctx.entries, ctx.frame) + if ctx.parsingEHFrame() && len(ctx.frame.CIE.Augmentation) > 0 { + // If we are parsing a .eh_frame and we saw an agumentation string then we + // need to read the augmentation data, which are encoded as a ULEB128 + // size followed by 'size' bytes. + n, _ := util.DecodeULEB128(reader) + reader.Seek(int64(n), io.SeekCurrent) + } + // The rest of this entry consists of the instructions // so we can just grab all of the data from the buffer // cursor to length. - ctx.frame.Instructions = r[2*ctx.ptrSize:] + + off, _ := reader.Seek(0, io.SeekCurrent) + ctx.frame.Instructions = r[off:] ctx.length = 0 return parselength } +func addrSum(base uint64, buf *bytes.Reader) uint64 { + n, _ := buf.Seek(0, io.SeekCurrent) + return base + uint64(n) +} + func parseCIE(ctx *parseContext) parsefunc { data := ctx.buf.Next(int(ctx.length)) buf := bytes.NewBuffer(data) @@ -100,6 +155,15 @@ func parseCIE(ctx *parseContext) parsefunc { // parse augmentation ctx.common.Augmentation, _ = util.ParseString(buf) + if ctx.parsingEHFrame() { + if ctx.common.Augmentation == "eh" { + ctx.err = fmt.Errorf("unsupported 'eh' augmentation at %#x", ctx.offset()) + } + if len(ctx.common.Augmentation) > 0 && ctx.common.Augmentation[0] != 'z' { + ctx.err = fmt.Errorf("unsupported augmentation at %#x (does not start with 'z')", ctx.offset()) + } + } + // parse code alignment factor ctx.common.CodeAlignmentFactor, _ = util.DecodeULEB128(buf) @@ -107,7 +171,48 @@ func parseCIE(ctx *parseContext) parsefunc { ctx.common.DataAlignmentFactor, _ = util.DecodeSLEB128(buf) // parse return address register - ctx.common.ReturnAddressRegister, _ = util.DecodeULEB128(buf) + if ctx.parsingEHFrame() && ctx.common.Version == 1 { + b, _ := buf.ReadByte() + ctx.common.ReturnAddressRegister = uint64(b) + } else { + ctx.common.ReturnAddressRegister, _ = util.DecodeULEB128(buf) + } + + ctx.common.ptrEncAddr = ptrEncAbs + + if ctx.parsingEHFrame() && len(ctx.common.Augmentation) > 0 { + _, _ = util.DecodeULEB128(buf) // augmentation data length + for i := 1; i < len(ctx.common.Augmentation); i++ { + switch ctx.common.Augmentation[i] { + case 'L': + _, _ = buf.ReadByte() // LSDA pointer encoding, we don't support this. + case 'R': + // Pointer encoding, describes how begin and size fields of FDEs are encoded. + b, _ := buf.ReadByte() + ctx.common.ptrEncAddr = ptrEnc(b) + if !ctx.common.ptrEncAddr.Supported() { + ctx.err = fmt.Errorf("pointer encoding not supported %#x at %#x", ctx.common.ptrEncAddr, ctx.offset()) + return nil + } + case 'S': + // Signal handler invocation frame, we don't support this but there is no associated data to read. + case 'P': + // Personality function encoded as a pointer encoding byte followed by + // the pointer to the personality function encoded as specified by the + // pointer encoding. + // We don't support this but have to read it anyway. + e, _ := buf.ReadByte() + if !ptrEnc(e).Supported() { + ctx.err = fmt.Errorf("pointer encoding not supported %#x at %#x", e, ctx.offset()) + return nil + } + ctx.readEncodedPtr(0, buf, ptrEnc(e)) + default: + ctx.err = fmt.Errorf("unsupported augmentation character %c at %#x", ctx.common.Augmentation[i], ctx.offset()) + return nil + } + } + } // parse initial instructions // The rest of this entry consists of the instructions @@ -119,6 +224,48 @@ func parseCIE(ctx *parseContext) parsefunc { return parselength } +// readEncodedPtr reads a pointer from buf encoded as specified by ptrEnc. +// This function is used to read pointers from a .eh_frame section, when +// used to parse a .debug_frame section ptrEnc will always be ptrEncAbs. +// The parameter addr is the address that the current byte of 'buf' will be +// mapped to when the executable file containing the eh_frame section being +// parse is loaded in memory. +func (ctx *parseContext) readEncodedPtr(addr uint64, buf util.ByteReaderWithLen, ptrEnc ptrEnc) uint64 { + if ptrEnc == ptrEncOmit { + return 0 + } + + var ptr uint64 + + switch ptrEnc & 0xf { + case ptrEncAbs, ptrEncSigned: + ptr, _ = util.ReadUintRaw(buf, binary.LittleEndian, ctx.ptrSize) + case ptrEncUleb: + ptr, _ = util.DecodeULEB128(buf) + case ptrEncUdata2: + ptr, _ = util.ReadUintRaw(buf, binary.LittleEndian, 2) + case ptrEncSdata2: + ptr, _ = util.ReadUintRaw(buf, binary.LittleEndian, 2) + ptr = uint64(int16(ptr)) + case ptrEncUdata4: + ptr, _ = util.ReadUintRaw(buf, binary.LittleEndian, 4) + case ptrEncSdata4: + ptr, _ = util.ReadUintRaw(buf, binary.LittleEndian, 4) + ptr = uint64(int32(ptr)) + case ptrEncUdata8, ptrEncSdata8: + ptr, _ = util.ReadUintRaw(buf, binary.LittleEndian, 8) + case ptrEncSleb: + n, _ := util.DecodeSLEB128(buf) + ptr = uint64(n) + } + + if ptrEnc&0xf0 == ptrEncPCRel { + ptr += addr + } + + return ptr +} + // DwarfEndian determines the endianness of the DWARF by using the version number field in the debug_info section // Trick borrowed from "debug/dwarf".New() func DwarfEndian(infoSec []byte) binary.ByteOrder { diff --git a/pkg/dwarf/frame/parser_test.go b/pkg/dwarf/frame/parser_test.go index ce6c9e509c..752ff3b5f2 100644 --- a/pkg/dwarf/frame/parser_test.go +++ b/pkg/dwarf/frame/parser_test.go @@ -14,6 +14,7 @@ func TestParseCIE(t *testing.T) { common: &CommonInformationEntry{Length: 12}, length: 12, } + ctx.totalLen = ctx.buf.Len() _ = parseCIE(ctx) common := ctx.common @@ -53,6 +54,6 @@ func BenchmarkParse(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - Parse(data, binary.BigEndian, 0, ptrSizeByRuntimeArch()) + Parse(data, binary.BigEndian, 0, ptrSizeByRuntimeArch(), 0) } } diff --git a/pkg/dwarf/frame/table.go b/pkg/dwarf/frame/table.go index c22a95f5c7..a0f3f1e306 100644 --- a/pkg/dwarf/frame/table.go +++ b/pkg/dwarf/frame/table.go @@ -8,6 +8,7 @@ import ( "github.com/go-delve/delve/pkg/dwarf/util" ) +// DWRule wrapper of rule defined for register values. type DWRule struct { Rule Rule Offset int64 @@ -15,6 +16,7 @@ type DWRule struct { Expression []byte } +// FrameContext wrapper of FDE context type FrameContext struct { loc uint64 order binary.ByteOrder @@ -62,7 +64,7 @@ const ( DW_CFA_restore = (0x3 << 6) // High 2 bits: 0x3, low 6: register ) -// Rules defined for register values. +// Rule rule defined for register values. type Rule byte const ( @@ -148,7 +150,7 @@ func (frame *FrameContext) executeDwarfProgram() { } } -// Execute dwarf instructions. +// ExecuteUntilPC execute dwarf instructions. func (frame *FrameContext) ExecuteUntilPC(instructions []byte) { frame.buf.Truncate(0) frame.buf.Write(instructions) diff --git a/pkg/dwarf/godwarf/tree.go b/pkg/dwarf/godwarf/tree.go index 2cb56a7aa8..64cb84d57d 100644 --- a/pkg/dwarf/godwarf/tree.go +++ b/pkg/dwarf/godwarf/tree.go @@ -75,7 +75,7 @@ func LoadTree(off dwarf.Offset, dw *dwarf.Data, staticBase uint64) (*Tree, error if err != nil { return nil, err } - r := EntryToTree(e) + r := entryToTreeInternal(e) r.Children, err = loadTreeChildren(e, rdr) if err != nil { return nil, err @@ -90,8 +90,16 @@ func LoadTree(off dwarf.Offset, dw *dwarf.Data, staticBase uint64) (*Tree, error return r, nil } -// EntryToTree converts a single entry, without children to a *Tree object +// EntryToTree converts a single entry, without children, to a *Tree object. func EntryToTree(entry *dwarf.Entry) *Tree { + if entry.Children { + panic(fmt.Sprintf("EntryToTree called on entry with children; "+ + "LoadTree should have been used instead. entry: %+v", entry)) + } + return entryToTreeInternal(entry) +} + +func entryToTreeInternal(entry *dwarf.Entry) *Tree { return &Tree{Entry: entry, Offset: entry.Offset, Tag: entry.Tag} } @@ -108,7 +116,7 @@ func loadTreeChildren(e *dwarf.Entry, rdr *dwarf.Reader) ([]*Tree, error) { if e.Tag == 0 { break } - child := EntryToTree(e) + child := entryToTreeInternal(e) child.Children, err = loadTreeChildren(e, rdr) if err != nil { return nil, err diff --git a/pkg/dwarf/godwarf/type.go b/pkg/dwarf/godwarf/type.go index c9605ec299..5e257d28f1 100644 --- a/pkg/dwarf/godwarf/type.go +++ b/pkg/dwarf/godwarf/type.go @@ -27,6 +27,7 @@ const ( AttrGoEmbeddedField dwarf.Attr = 0x2903 AttrGoRuntimeType dwarf.Attr = 0x2904 AttrGoPackageName dwarf.Attr = 0x2905 + AttrGoDictIndex dwarf.Attr = 0x2906 ) // Basic type encodings -- the value for AttrEncoding in a TagBaseType Entry. @@ -513,6 +514,11 @@ func (t *ChanType) stringIntl(recCheck recCheck) string { return "chan " + t.ElemType.String() } +type ParametricType struct { + TypedefType + DictIndex int64 +} + // An UnsupportedType is a placeholder returned in situations where we // encounter a type that isn't supported. type UnsupportedType struct { @@ -529,7 +535,7 @@ func (t *UnsupportedType) stringIntl(recCheck) string { func (t *UnsupportedType) String() string { return t.stringIntl(nil) } -// Type reads the type at off in the DWARF ``info'' section. +// ReadType reads the type at off in the DWARF ``info'' section. func ReadType(d *dwarf.Data, index int, off dwarf.Offset, typeCache map[dwarf.Offset]Type) (Type, error) { typ, err := readType(d, "info", d.Reader(), off, typeCache, nil) if typ != nil { @@ -549,7 +555,7 @@ type delayedSize struct { } // readType reads a type from r at off of name using and updating a -// type cache, callers sohuld pass nil to delayedSize, it is used for recursion. +// type cache, callers should pass nil to delayedSize, it is used for recursion. func readType(d *dwarf.Data, name string, r *dwarf.Reader, off dwarf.Offset, typeCache map[dwarf.Offset]Type, delayedSizes *[]delayedSize) (Type, error) { if t, ok := typeCache[off]; ok { return t, nil @@ -787,6 +793,7 @@ func readType(d *dwarf.Data, name string, r *dwarf.Reader, off dwarf.Offset, typ case reflect.String: str := new(StringType) t = &str.StructType + str.ReflectKind = reflect.String typ = str default: typ = t @@ -1010,7 +1017,15 @@ func readType(d *dwarf.Data, name string, r *dwarf.Reader, off dwarf.Offset, typ typeCache[off] = it t = &it.TypedefType default: - typ = t + if dictIndex, ok := e.Val(AttrGoDictIndex).(int64); ok { + pt := new(ParametricType) + pt.DictIndex = dictIndex + typ = pt + typeCache[off] = pt + t = &pt.TypedefType + } else { + typ = t + } } typeCache[off] = typ t.Name, _ = e.Val(dwarf.AttrName).(string) @@ -1084,13 +1099,3 @@ func zeroArray(t Type) { t = at.Type } } - -func resolveTypedef(typ Type) Type { - for { - if tt, ok := typ.(*TypedefType); ok { - typ = tt.Type - } else { - return typ - } - } -} diff --git a/pkg/dwarf/line/line_parser.go b/pkg/dwarf/line/line_parser.go index 8bf58b4410..a9a0aed948 100644 --- a/pkg/dwarf/line/line_parser.go +++ b/pkg/dwarf/line/line_parser.go @@ -3,12 +3,13 @@ package line import ( "bytes" "encoding/binary" - "path/filepath" + "path" "strings" "github.com/go-delve/delve/pkg/dwarf/util" ) +// DebugLinePrologue prologue of .debug_line data. type DebugLinePrologue struct { UnitLength uint32 Version uint16 @@ -22,6 +23,7 @@ type DebugLinePrologue struct { StdOpLengths []uint8 } +// DebugLineInfo info of .debug_line data. type DebugLineInfo struct { Prologue *DebugLinePrologue IncludeDirs []string @@ -37,14 +39,19 @@ type DebugLineInfo struct { // lastMachineCache[pc] is a state machine stopped at an address after pc lastMachineCache map[uint64]*StateMachine + // debugLineStr is the contents of the .debug_line_str section. + debugLineStr []byte + // staticBase is the address at which the executable is loaded, 0 for non-PIEs staticBase uint64 // if normalizeBackslash is true all backslashes (\) will be converted into forward slashes (/) normalizeBackslash bool ptrSize int + endSeqIsValid bool } +// FileEntry file entry in File Name Table. type FileEntry struct { Path string DirIdx uint64 @@ -55,7 +62,7 @@ type FileEntry struct { type DebugLines []*DebugLineInfo // ParseAll parses all debug_line segments found in data -func ParseAll(data []byte, logfn func(string, ...interface{}), staticBase uint64, normalizeBackslash bool, ptrSize int) DebugLines { +func ParseAll(data []byte, debugLineStr []byte, logfn func(string, ...interface{}), staticBase uint64, normalizeBackslash bool, ptrSize int) DebugLines { var ( lines = make(DebugLines, 0) buf = bytes.NewBuffer(data) @@ -63,7 +70,7 @@ func ParseAll(data []byte, logfn func(string, ...interface{}), staticBase uint64 // We have to parse multiple file name tables here. for buf.Len() > 0 { - lines = append(lines, Parse("", buf, logfn, staticBase, normalizeBackslash, ptrSize)) + lines = append(lines, Parse("", buf, debugLineStr, logfn, staticBase, normalizeBackslash, ptrSize)) } return lines @@ -71,9 +78,12 @@ func ParseAll(data []byte, logfn func(string, ...interface{}), staticBase uint64 // Parse parses a single debug_line segment from buf. Compdir is the // DW_AT_comp_dir attribute of the associated compile unit. -func Parse(compdir string, buf *bytes.Buffer, logfn func(string, ...interface{}), staticBase uint64, normalizeBackslash bool, ptrSize int) *DebugLineInfo { +func Parse(compdir string, buf *bytes.Buffer, debugLineStr []byte, logfn func(string, ...interface{}), staticBase uint64, normalizeBackslash bool, ptrSize int) *DebugLineInfo { dbl := new(DebugLineInfo) dbl.Logf = logfn + if logfn == nil { + dbl.Logf = func(string, ...interface{}) {} + } dbl.staticBase = staticBase dbl.ptrSize = ptrSize dbl.Lookup = make(map[string]*FileEntry) @@ -82,14 +92,23 @@ func Parse(compdir string, buf *bytes.Buffer, logfn func(string, ...interface{}) dbl.stateMachineCache = make(map[uint64]*StateMachine) dbl.lastMachineCache = make(map[uint64]*StateMachine) dbl.normalizeBackslash = normalizeBackslash + dbl.debugLineStr = debugLineStr parseDebugLinePrologue(dbl, buf) if dbl.Prologue.Version >= 5 { - parseIncludeDirs5(dbl, buf) - parseFileEntries5(dbl, buf) + if !parseIncludeDirs5(dbl, buf) { + return nil + } + if !parseFileEntries5(dbl, buf) { + return nil + } } else { - parseIncludeDirs2(dbl, buf) - parseFileEntries2(dbl, buf) + if !parseIncludeDirs2(dbl, buf) { + return nil + } + if !parseFileEntries2(dbl, buf) { + return nil + } } // Instructions size calculation breakdown: @@ -111,10 +130,9 @@ func parseDebugLinePrologue(dbl *DebugLineInfo, buf *bytes.Buffer) { dbl.ptrSize += int(buf.Next(1)[0]) // segment_selector_size } - // Version 4 or earlier p.Length = binary.LittleEndian.Uint32(buf.Next(4)) p.MinInstrLength = uint8(buf.Next(1)[0]) - if p.Version == 4 { + if p.Version >= 4 { p.MaxOpPerInstr = uint8(buf.Next(1)[0]) } else { p.MaxOpPerInstr = 1 @@ -131,20 +149,30 @@ func parseDebugLinePrologue(dbl *DebugLineInfo, buf *bytes.Buffer) { } // parseIncludeDirs2 parses the directory table for DWARF version 2 through 4. -func parseIncludeDirs2(info *DebugLineInfo, buf *bytes.Buffer) { +func parseIncludeDirs2(info *DebugLineInfo, buf *bytes.Buffer) bool { for { - str, _ := util.ParseString(buf) + str, err := util.ParseString(buf) + if err != nil { + if info.Logf != nil { + info.Logf("error reading string: %v", err) + } + return false + } if str == "" { break } info.IncludeDirs = append(info.IncludeDirs, str) } + return true } // parseIncludeDirs5 parses the directory table for DWARF version 5. -func parseIncludeDirs5(info *DebugLineInfo, buf *bytes.Buffer) { +func parseIncludeDirs5(info *DebugLineInfo, buf *bytes.Buffer) bool { dirEntryFormReader := readEntryFormat(buf, info.Logf) + if dirEntryFormReader == nil { + return false + } dirCount, _ := util.DecodeULEB128(buf) info.IncludeDirs = make([]string, 0, dirCount) for i := uint64(0); i < dirCount; i++ { @@ -152,10 +180,14 @@ func parseIncludeDirs5(info *DebugLineInfo, buf *bytes.Buffer) { for dirEntryFormReader.next(buf) { switch dirEntryFormReader.contentType { case _DW_LNCT_path: - if dirEntryFormReader.formCode != _DW_FORM_string { + switch dirEntryFormReader.formCode { + case _DW_FORM_string: info.IncludeDirs = append(info.IncludeDirs, dirEntryFormReader.str) - } else { - //TODO(aarzilli): support debug_string, debug_line_str + case _DW_FORM_line_strp: + buf := bytes.NewBuffer(info.debugLineStr[dirEntryFormReader.u64:]) + dir, _ := util.ParseString(buf) + info.IncludeDirs = append(info.IncludeDirs, dir) + default: info.Logf("unsupported string form %#x", dirEntryFormReader.formCode) } case _DW_LNCT_directory_index: @@ -164,13 +196,23 @@ func parseIncludeDirs5(info *DebugLineInfo, buf *bytes.Buffer) { case _DW_LNCT_MD5: } } + if dirEntryFormReader.err != nil { + if info.Logf != nil { + info.Logf("error reading directory entries table: %v", dirEntryFormReader.err) + } + return false + } } + return true } // parseFileEntries2 parses the file table for DWARF 2 through 4 -func parseFileEntries2(info *DebugLineInfo, buf *bytes.Buffer) { +func parseFileEntries2(info *DebugLineInfo, buf *bytes.Buffer) bool { for { entry := readFileEntry(info, buf, true) + if entry == nil { + return false + } if entry.Path == "" { break } @@ -178,50 +220,81 @@ func parseFileEntries2(info *DebugLineInfo, buf *bytes.Buffer) { info.FileNames = append(info.FileNames, entry) info.Lookup[entry.Path] = entry } + return true } func readFileEntry(info *DebugLineInfo, buf *bytes.Buffer, exitOnEmptyPath bool) *FileEntry { entry := new(FileEntry) - entry.Path, _ = util.ParseString(buf) + var err error + entry.Path, err = util.ParseString(buf) + if err != nil { + if info.Logf != nil { + info.Logf("error reading file entry: %v", err) + } + return nil + } if entry.Path == "" && exitOnEmptyPath { return entry } if info.normalizeBackslash { - entry.Path = strings.Replace(entry.Path, "\\", "/", -1) + entry.Path = strings.ReplaceAll(entry.Path, "\\", "/") } entry.DirIdx, _ = util.DecodeULEB128(buf) entry.LastModTime, _ = util.DecodeULEB128(buf) entry.Length, _ = util.DecodeULEB128(buf) - if !filepath.IsAbs(entry.Path) { - if entry.DirIdx >= 0 && entry.DirIdx < uint64(len(info.IncludeDirs)) { - entry.Path = filepath.Join(info.IncludeDirs[entry.DirIdx], entry.Path) + if !pathIsAbs(entry.Path) { + if entry.DirIdx < uint64(len(info.IncludeDirs)) { + entry.Path = path.Join(info.IncludeDirs[entry.DirIdx], entry.Path) } } return entry } +// pathIsAbs returns true if this is an absolute path. +// We can not use path.IsAbs because it will not recognize windows paths as +// absolute. We also can not use filepath.Abs because we want this +// processing to be independent of the host operating system (we could be +// reading an executable file produced on windows on a unix machine or vice +// versa). +func pathIsAbs(s string) bool { + if len(s) >= 1 && s[0] == '/' { + return true + } + if len(s) >= 2 && s[1] == ':' && (('a' <= s[0] && s[0] <= 'z') || ('A' <= s[0] && s[0] <= 'Z')) { + return true + } + return false +} + // parseFileEntries5 parses the file table for DWARF 5 -func parseFileEntries5(info *DebugLineInfo, buf *bytes.Buffer) { +func parseFileEntries5(info *DebugLineInfo, buf *bytes.Buffer) bool { fileEntryFormReader := readEntryFormat(buf, info.Logf) + if fileEntryFormReader == nil { + return false + } fileCount, _ := util.DecodeULEB128(buf) info.FileNames = make([]*FileEntry, 0, fileCount) for i := 0; i < int(fileCount); i++ { fileEntryFormReader.reset() for fileEntryFormReader.next(buf) { entry := new(FileEntry) - var path string - var diridx int = -1 + var p string + var diridx int + diridx = -1 switch fileEntryFormReader.contentType { case _DW_LNCT_path: - if fileEntryFormReader.formCode != _DW_FORM_string { - path = fileEntryFormReader.str - } else { - //TODO(aarzilli): support debug_string, debug_line_str + switch fileEntryFormReader.formCode { + case _DW_FORM_string: + p = fileEntryFormReader.str + case _DW_FORM_line_strp: + buf := bytes.NewBuffer(info.debugLineStr[fileEntryFormReader.u64:]) + p, _ = util.ParseString(buf) + default: info.Logf("unsupported string form %#x", fileEntryFormReader.formCode) } case _DW_LNCT_directory_index: @@ -234,12 +307,23 @@ func parseFileEntries5(info *DebugLineInfo, buf *bytes.Buffer) { // not implemented } - if diridx >= 0 && !filepath.IsAbs(path) && diridx < len(info.IncludeDirs) { - path = filepath.Join(info.IncludeDirs[diridx], path) + if info.normalizeBackslash { + p = strings.ReplaceAll(p, "\\", "/") + } + + if diridx >= 0 && !pathIsAbs(p) && diridx < len(info.IncludeDirs) { + p = path.Join(info.IncludeDirs[diridx], p) } - entry.Path = path + entry.Path = p info.FileNames = append(info.FileNames, entry) info.Lookup[entry.Path] = entry } + if fileEntryFormReader.err != nil { + if info.Logf != nil { + info.Logf("error reading file entries table: %v", fileEntryFormReader.err) + } + return false + } } + return true } diff --git a/pkg/dwarf/line/line_parser_test.go b/pkg/dwarf/line/line_parser_test.go index f5d0901ec1..043a16bfe6 100644 --- a/pkg/dwarf/line/line_parser_test.go +++ b/pkg/dwarf/line/line_parser_test.go @@ -11,12 +11,14 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "strings" "testing" "time" "unsafe" "github.com/go-delve/delve/pkg/dwarf/godwarf" + "github.com/go-delve/delve/pkg/goversion" ) var userTestFile string @@ -72,7 +74,7 @@ func ptrSizeByRuntimeArch() int { func testDebugLinePrologueParser(p string, t *testing.T) { data := grabDebugLineSection(p, t) - debugLines := ParseAll(data, nil, 0, true, ptrSizeByRuntimeArch()) + debugLines := ParseAll(data, nil, nil, 0, true, ptrSizeByRuntimeArch()) mainFileFound := false for _, dbl := range debugLines { @@ -113,8 +115,10 @@ func testDebugLinePrologueParser(p string, t *testing.T) { } } - if len(dbl.IncludeDirs) != 1 { - t.Fatal("Include dirs not parsed correctly") + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 16) { + if len(dbl.IncludeDirs) != 1 { + t.Fatal("Include dirs not parsed correctly") + } } for _, ln := range dbl.Lookup { @@ -127,6 +131,7 @@ func testDebugLinePrologueParser(p string, t *testing.T) { } for _, n := range dbl.FileNames { + t.Logf("file %s\n", n.Path) if strings.Contains(n.Path, "/_fixtures/testnextprog.go") { mainFileFound = true break @@ -176,7 +181,7 @@ func BenchmarkLineParser(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { - _ = ParseAll(data, nil, 0, true, ptrSizeByRuntimeArch()) + _ = ParseAll(data, nil, nil, 0, true, ptrSizeByRuntimeArch()) } } @@ -191,7 +196,7 @@ func loadBenchmarkData(tb testing.TB) DebugLines { tb.Fatal("Could not read test data", err) } - return ParseAll(data, nil, 0, true, ptrSizeByRuntimeArch()) + return ParseAll(data, nil, nil, 0, true, ptrSizeByRuntimeArch()) } func BenchmarkStateMachine(b *testing.B) { @@ -311,7 +316,7 @@ func TestDebugLineC(t *testing.T) { t.Fatal("Could not read test data", err) } - parsed := ParseAll(data, nil, 0, true, ptrSizeByRuntimeArch()) + parsed := ParseAll(data, nil, nil, 0, true, ptrSizeByRuntimeArch()) if len(parsed) == 0 { t.Fatal("Parser result is empty") @@ -360,7 +365,7 @@ func TestDebugLineDwarf4(t *testing.T) { t.Fatal("Could not read test data", err) } - debugLines := ParseAll(data, nil, 0, true, 8) + debugLines := ParseAll(data, nil, nil, 0, true, 8) for _, dbl := range debugLines { if dbl.Prologue.Version == 4 { diff --git a/pkg/dwarf/line/parse_util.go b/pkg/dwarf/line/parse_util.go index 10dd963362..867d9b7b3b 100644 --- a/pkg/dwarf/line/parse_util.go +++ b/pkg/dwarf/line/parse_util.go @@ -3,6 +3,7 @@ package line import ( "bytes" "encoding/binary" + "errors" "github.com/go-delve/delve/pkg/dwarf/util" ) @@ -39,6 +40,8 @@ const ( _DW_LNCT_MD5 ) +var ErrBufferUnderflow = errors.New("buffer underflow") + type formReader struct { logf func(string, ...interface{}) contentTypes []uint64 @@ -51,11 +54,15 @@ type formReader struct { u64 uint64 i64 int64 str string + err error nexti int } func readEntryFormat(buf *bytes.Buffer, logf func(string, ...interface{})) *formReader { + if buf.Len() < 1 { + return nil + } count := buf.Next(1)[0] r := &formReader{ logf: logf, @@ -70,10 +77,14 @@ func readEntryFormat(buf *bytes.Buffer, logf func(string, ...interface{})) *form } func (rdr *formReader) reset() { + rdr.err = nil rdr.nexti = 0 } func (rdr *formReader) next(buf *bytes.Buffer) bool { + if rdr.err != nil { + return false + } if rdr.nexti >= len(rdr.contentTypes) { return false } @@ -87,24 +98,52 @@ func (rdr *formReader) next(buf *bytes.Buffer) bool { rdr.readBlock(buf, n) case _DW_FORM_block1: + if buf.Len() < 1 { + rdr.err = ErrBufferUnderflow + return false + } rdr.readBlock(buf, uint64(buf.Next(1)[0])) case _DW_FORM_block2: + if buf.Len() < 2 { + rdr.err = ErrBufferUnderflow + return false + } rdr.readBlock(buf, uint64(binary.LittleEndian.Uint16(buf.Next(2)))) case _DW_FORM_block4: + if buf.Len() < 4 { + rdr.err = ErrBufferUnderflow + return false + } rdr.readBlock(buf, uint64(binary.LittleEndian.Uint32(buf.Next(4)))) case _DW_FORM_data1, _DW_FORM_flag, _DW_FORM_strx1: + if buf.Len() < 1 { + rdr.err = ErrBufferUnderflow + return false + } rdr.u64 = uint64(buf.Next(1)[0]) case _DW_FORM_data2, _DW_FORM_strx2: + if buf.Len() < 2 { + rdr.err = ErrBufferUnderflow + return false + } rdr.u64 = uint64(binary.LittleEndian.Uint16(buf.Next(2))) case _DW_FORM_data4, _DW_FORM_line_strp, _DW_FORM_sec_offset, _DW_FORM_strp, _DW_FORM_strx4: + if buf.Len() < 4 { + rdr.err = ErrBufferUnderflow + return false + } rdr.u64 = uint64(binary.LittleEndian.Uint32(buf.Next(4))) case _DW_FORM_data8: + if buf.Len() < 8 { + rdr.err = ErrBufferUnderflow + return false + } rdr.u64 = binary.LittleEndian.Uint64(buf.Next(8)) case _DW_FORM_data16: @@ -120,15 +159,20 @@ func (rdr *formReader) next(buf *bytes.Buffer) bool { rdr.str, _ = util.ParseString(buf) case _DW_FORM_strx3: + if buf.Len() < 3 { + rdr.err = ErrBufferUnderflow + return false + } rdr.u64 = uint64(binary.LittleEndian.Uint32(append(buf.Next(3), 0x0))) + case ^uint64(0): + // do nothing + default: if rdr.logf != nil { rdr.logf("unknown form code %#x", rdr.formCode) } rdr.formCodes[rdr.nexti] = ^uint64(0) // only print error once - case ^uint64(0): - // do nothing } rdr.nexti++ @@ -136,6 +180,10 @@ func (rdr *formReader) next(buf *bytes.Buffer) bool { } func (rdr *formReader) readBlock(buf *bytes.Buffer, n uint64) { + if uint64(buf.Len()) < n { + rdr.err = ErrBufferUnderflow + return + } if cap(rdr.block) < int(n) { rdr.block = make([]byte, 0, n) } diff --git a/pkg/dwarf/line/state_machine.go b/pkg/dwarf/line/state_machine.go index b5c8abd2e6..d2e3afa773 100644 --- a/pkg/dwarf/line/state_machine.go +++ b/pkg/dwarf/line/state_machine.go @@ -49,14 +49,6 @@ type StateMachine struct { ptrSize int } -type opcodeKind uint8 - -const ( - specialOpcode opcodeKind = iota - standardOpcode - extendedOpcode -) - type opcodefn func(*StateMachine, *bytes.Buffer) // Special opcodes @@ -111,9 +103,13 @@ func newStateMachine(dbl *DebugLineInfo, instructions []byte, ptrSize int) *Stat for op := range standardopcodes { opcodes[op] = standardopcodes[op] } + var file string + if len(dbl.FileNames) > 0 { + file = dbl.FileNames[0].Path + } sm := &StateMachine{ dbl: dbl, - file: dbl.FileNames[0].Path, + file: file, line: 1, buf: bytes.NewBuffer(instructions), opcodes: opcodes, @@ -152,15 +148,15 @@ func (lineInfo *DebugLineInfo) AllPCsForFileLines(f string, m map[int][]uint64) } } } - return } -var NoSourceError = errors.New("no source available") +var ErrNoSource = errors.New("no source available") -// AllPCsBetween returns all PC addresses between begin and end (including both begin and end) that have the is_stmt flag set and do not belong to excludeFile:excludeLine +// AllPCsBetween returns all PC addresses between begin and end (including both begin and end) +// that have the is_stmt flag set and do not belong to excludeFile:excludeLine. func (lineInfo *DebugLineInfo) AllPCsBetween(begin, end uint64, excludeFile string, excludeLine int) ([]uint64, error) { if lineInfo == nil { - return nil, NoSourceError + return nil, ErrNoSource } var ( @@ -182,7 +178,7 @@ func (lineInfo *DebugLineInfo) AllPCsBetween(begin, end uint64, excludeFile stri if (sm.address > end) && (end >= sm.lastAddress) { break } - if sm.address >= begin && sm.address <= end && sm.address > lastaddr && sm.isStmt && ((sm.file != excludeFile) || (sm.line != excludeLine)) { + if sm.address >= begin && sm.address <= end && sm.address > lastaddr && sm.isStmt && !sm.endSeq && ((sm.file != excludeFile) || (sm.line != excludeLine)) { lastaddr = sm.address pcs = append(pcs, sm.address) } @@ -281,76 +277,35 @@ func (sm *StateMachine) PCToLine(pc uint64) (string, int, bool) { return "", 0, false } -// LineToPC returns the first PC address associated with filename:lineno. -func (lineInfo *DebugLineInfo) LineToPC(filename string, lineno int) uint64 { +// PCStmt is a PC address with its is_stmt flag +type PCStmt struct { + PC uint64 + Stmt bool +} + +// LineToPCs returns all PCs associated with filename:lineno +func (lineInfo *DebugLineInfo) LineToPCs(filename string, lineno int) []PCStmt { if lineInfo == nil { - return 0 + return nil } sm := newStateMachine(lineInfo, lineInfo.Instructions, lineInfo.ptrSize) - // if no instruction marked is_stmt is found fallback to the first - // instruction assigned to the filename:line. - var fallbackPC uint64 + pcstmts := []PCStmt{} for { if err := sm.next(); err != nil { if lineInfo.Logf != nil && err != io.EOF { - lineInfo.Logf("LineToPC error: %v", err) + lineInfo.Logf("LineToPCs error: %v", err) } break } if sm.line == lineno && sm.file == filename && sm.valid { - if sm.isStmt { - return sm.address - } else if fallbackPC == 0 { - fallbackPC = sm.address - } - } - } - return fallbackPC -} - -// LineToPCIn returns the first PC for filename:lineno in the interval [startPC, endPC). -// This function is used to find the instruction corresponding to -// filename:lineno for a function that has been inlined. -// basePC will be used for caching, it's normally the entry point for the -// function containing pc. -func (lineInfo *DebugLineInfo) LineToPCIn(filename string, lineno int, basePC, startPC, endPC uint64) uint64 { - if lineInfo == nil { - return 0 - } - if basePC > startPC { - panic(fmt.Errorf("basePC after startPC %#x %#x", basePC, startPC)) - } - - sm := lineInfo.stateMachineFor(basePC, startPC) - - var fallbackPC uint64 - - for { - if sm.valid && sm.started { - if sm.address >= endPC { - break - } - if sm.line == lineno && sm.file == filename && sm.address >= startPC { - if sm.isStmt { - return sm.address - } else { - fallbackPC = sm.address - } - } + pcstmts = append(pcstmts, PCStmt{sm.address, sm.isStmt}) } - if err := sm.next(); err != nil { - if lineInfo.Logf != nil && err != io.EOF { - lineInfo.Logf("LineToPC error: %v", err) - } - break - } - } - return fallbackPC + return pcstmts } // PrologueEndPC returns the first PC address marked as prologue_end in the half open interval [start, end) @@ -543,7 +498,7 @@ func fixedadvancepc(sm *StateMachine, buf *bytes.Buffer) { func endsequence(sm *StateMachine, buf *bytes.Buffer) { sm.endSeq = true - sm.valid = true + sm.valid = sm.dbl.endSeqIsValid } func setaddress(sm *StateMachine, buf *bytes.Buffer) { @@ -559,8 +514,9 @@ func setdiscriminator(sm *StateMachine, buf *bytes.Buffer) { } func definefile(sm *StateMachine, buf *bytes.Buffer) { - entry := readFileEntry(sm.dbl, sm.buf, false) - sm.definedFiles = append(sm.definedFiles, entry) + if entry := readFileEntry(sm.dbl, sm.buf, false); entry != nil { + sm.definedFiles = append(sm.definedFiles, entry) + } } func prologueend(sm *StateMachine, buf *bytes.Buffer) { diff --git a/pkg/dwarf/line/state_machine_test.go b/pkg/dwarf/line/state_machine_test.go index 5088c4f4a9..b728115126 100644 --- a/pkg/dwarf/line/state_machine_test.go +++ b/pkg/dwarf/line/state_machine_test.go @@ -30,11 +30,6 @@ func slurpGzip(path string) ([]byte, error) { return ioutil.ReadAll(gzin) } -const ( - newCompileUnit = "NEW COMPILE UNIT" - debugLineEnd = "END" -) - func TestGrafana(t *testing.T) { // Compares a full execution of our state machine on the debug_line section // of grafana to the output generated using debug/dwarf.LineReader on the @@ -79,7 +74,8 @@ func TestGrafana(t *testing.T) { } cuname, _ := e.Val(dwarf.AttrName).(string) - lineInfo := Parse(e.Val(dwarf.AttrCompDir).(string), debugLineBuffer, t.Logf, 0, false, 8) + lineInfo := Parse(e.Val(dwarf.AttrCompDir).(string), debugLineBuffer, nil, t.Logf, 0, false, 8) + lineInfo.endSeqIsValid = true sm := newStateMachine(lineInfo, lineInfo.Instructions, 8) lnrdr, err := data.LineReader(e) diff --git a/pkg/dwarf/op/op.go b/pkg/dwarf/op/op.go index 7410f7c127..ee37b162bb 100644 --- a/pkg/dwarf/op/op.go +++ b/pkg/dwarf/op/op.go @@ -18,47 +18,64 @@ type Opcode byte type stackfn func(Opcode, *context) error +type ReadMemoryFunc func([]byte, uint64) (int, error) + type context struct { buf *bytes.Buffer + prog []byte stack []int64 pieces []Piece - reg bool ptrSize int DwarfRegisters + readMemory ReadMemoryFunc } // Piece is a piece of memory stored either at an address or in a register. type Piece struct { - Size int - Addr int64 - RegNum uint64 - IsRegister bool + Size int + Kind PieceKind + Val uint64 + Bytes []byte } +// PieceKind describes the kind of a piece. +type PieceKind uint8 + +const ( + AddrPiece PieceKind = iota // The piece is stored in memory, Val is the address + RegPiece // The piece is stored in a register, Val is the register number + ImmPiece // The piece is an immediate value, Val or Bytes is the value +) + +var ( + ErrStackUnderflow = errors.New("DWARF stack underflow") + ErrStackIndexOutOfBounds = errors.New("DWARF stack index out of bounds") + ErrMemoryReadUnavailable = errors.New("memory read unavailable") +) + +const arbitraryExecutionLimitFactor = 10 + // ExecuteStackProgram executes a DWARF location expression and returns // either an address (int64), or a slice of Pieces for location expressions // that don't evaluate to an address (such as register and composite expressions). -func ExecuteStackProgram(regs DwarfRegisters, instructions []byte, ptrSize int) (int64, []Piece, error) { +func ExecuteStackProgram(regs DwarfRegisters, instructions []byte, ptrSize int, readMemory ReadMemoryFunc) (int64, []Piece, error) { ctxt := &context{ buf: bytes.NewBuffer(instructions), + prog: instructions, stack: make([]int64, 0, 3), DwarfRegisters: regs, ptrSize: ptrSize, } - for { + for tick := 0; tick < len(instructions)*arbitraryExecutionLimitFactor; tick++ { opcodeByte, err := ctxt.buf.ReadByte() if err != nil { break } opcode := Opcode(opcodeByte) - if ctxt.reg && opcode != DW_OP_piece { - // last opcode was DW_OP_regN and next one isn't DW_OP_piece so convert - // the register piece into a stack value. - ctxt.stack = append(ctxt.stack, int64(regs.Uint64Val(ctxt.pieces[len(ctxt.pieces)-1].RegNum))) - ctxt.pieces = ctxt.pieces[:len(ctxt.pieces)-1] - ctxt.reg = false + if opcode == DW_OP_nop { + continue } fn, ok := oplut[opcode] if !ok { @@ -72,8 +89,8 @@ func ExecuteStackProgram(regs DwarfRegisters, instructions []byte, ptrSize int) } if ctxt.pieces != nil { - if len(ctxt.pieces) == 1 && ctxt.pieces[0].IsRegister { - return int64(regs.Uint64Val(ctxt.pieces[0].RegNum)), ctxt.pieces, nil + if len(ctxt.pieces) == 1 && ctxt.pieces[0].Kind == RegPiece { + return int64(regs.Uint64Val(ctxt.pieces[0].Val)), ctxt.pieces, nil } return 0, ctxt.pieces, nil } @@ -135,9 +152,44 @@ func PrettyPrint(out io.Writer, instructions []byte) { } } +// closeLoc is called by opcodes that can only appear at the end of a +// location expression (DW_OP_regN, DW_OP_regx, DW_OP_stack_value...). +// It checks that we are at the end of the program or that the following +// opcode is DW_OP_piece or DW_OP_bit_piece and processes them. +func (ctxt *context) closeLoc(opcode0 Opcode, piece Piece) error { + if ctxt.buf.Len() == 0 { + ctxt.pieces = append(ctxt.pieces, piece) + return nil + } + + // DWARF doesn't say what happens to the operand stack at the end of a + // location expression, resetting it here. + ctxt.stack = ctxt.stack[:0] + + b, err := ctxt.buf.ReadByte() + if err != nil { + return err + } + opcode := Opcode(b) + + switch opcode { + case DW_OP_piece: + sz, _ := util.DecodeULEB128(ctxt.buf) + piece.Size = int(sz) + ctxt.pieces = append(ctxt.pieces, piece) + return nil + + case DW_OP_bit_piece: + // not supported + return fmt.Errorf("invalid instruction %#v", opcode) + default: + return fmt.Errorf("invalid instruction %#v after %#v", opcode, opcode0) + } +} + func callframecfa(opcode Opcode, ctxt *context) error { if ctxt.CFA == 0 { - return fmt.Errorf("Could not retrieve CFA for current PC") + return errors.New("could not retrieve CFA for current PC") } ctxt.stack = append(ctxt.stack, int64(ctxt.CFA)) return nil @@ -153,17 +205,6 @@ func addr(opcode Opcode, ctxt *context) error { return nil } -func plus(opcode Opcode, ctxt *context) error { - var ( - slen = len(ctxt.stack) - digits = ctxt.stack[slen-2 : slen] - st = ctxt.stack[:slen-2] - ) - - ctxt.stack = append(st, digits[0]+digits[1]) - return nil -} - func plusuconsts(opcode Opcode, ctxt *context) error { slen := len(ctxt.stack) num, _ := util.DecodeULEB128(ctxt.buf) @@ -184,30 +225,332 @@ func framebase(opcode Opcode, ctxt *context) error { } func register(opcode Opcode, ctxt *context) error { - ctxt.reg = true + var regnum uint64 if opcode == DW_OP_regx { - n, _ := util.DecodeSLEB128(ctxt.buf) - ctxt.pieces = append(ctxt.pieces, Piece{IsRegister: true, RegNum: uint64(n)}) + regnum, _ = util.DecodeULEB128(ctxt.buf) + } else { + regnum = uint64(opcode - DW_OP_reg0) + } + return ctxt.closeLoc(opcode, Piece{Kind: RegPiece, Val: regnum}) +} + +func bregister(opcode Opcode, ctxt *context) error { + var regnum uint64 + if opcode == DW_OP_bregx { + regnum, _ = util.DecodeULEB128(ctxt.buf) } else { - ctxt.pieces = append(ctxt.pieces, Piece{IsRegister: true, RegNum: uint64(opcode - DW_OP_reg0)}) + regnum = uint64(opcode - DW_OP_breg0) } + offset, _ := util.DecodeSLEB128(ctxt.buf) + if ctxt.Reg(regnum) == nil { + return fmt.Errorf("register %d not available", regnum) + } + ctxt.stack = append(ctxt.stack, int64(ctxt.Uint64Val(regnum))+offset) return nil } func piece(opcode Opcode, ctxt *context) error { sz, _ := util.DecodeULEB128(ctxt.buf) - if ctxt.reg { - ctxt.reg = false - ctxt.pieces[len(ctxt.pieces)-1].Size = int(sz) - return nil - } if len(ctxt.stack) == 0 { - return errors.New("empty OP stack") + // nothing on the stack means this piece is unavailable (padding, + // optimized away...), see DWARFv4 sec. 2.6.1.3 page 30. + ctxt.pieces = append(ctxt.pieces, Piece{Size: int(sz), Kind: ImmPiece, Val: 0}) + return nil } addr := ctxt.stack[len(ctxt.stack)-1] - ctxt.pieces = append(ctxt.pieces, Piece{Size: int(sz), Addr: addr}) + ctxt.pieces = append(ctxt.pieces, Piece{Size: int(sz), Kind: AddrPiece, Val: uint64(addr)}) ctxt.stack = ctxt.stack[:0] return nil } + +func literal(opcode Opcode, ctxt *context) error { + ctxt.stack = append(ctxt.stack, int64(opcode-DW_OP_lit0)) + return nil +} + +func constnu(opcode Opcode, ctxt *context) error { + var ( + n uint64 + err error + ) + switch opcode { + case DW_OP_const1u: + var b uint8 + b, err = ctxt.buf.ReadByte() + n = uint64(b) + case DW_OP_const2u: + n, err = util.ReadUintRaw(ctxt.buf, binary.LittleEndian, 2) + case DW_OP_const4u: + n, err = util.ReadUintRaw(ctxt.buf, binary.LittleEndian, 4) + case DW_OP_const8u: + n, err = util.ReadUintRaw(ctxt.buf, binary.LittleEndian, 8) + default: + panic("internal error") + } + if err != nil { + return err + } + ctxt.stack = append(ctxt.stack, int64(n)) + return nil +} + +func constns(opcode Opcode, ctxt *context) error { + var ( + n uint64 + err error + ) + switch opcode { + case DW_OP_const1s: + var b uint8 + b, err = ctxt.buf.ReadByte() + n = uint64(int64(int8(b))) + case DW_OP_const2s: + n, err = util.ReadUintRaw(ctxt.buf, binary.LittleEndian, 2) + n = uint64(int64(int16(n))) + case DW_OP_const4s: + n, err = util.ReadUintRaw(ctxt.buf, binary.LittleEndian, 4) + n = uint64(int64(int32(n))) + case DW_OP_const8s: + n, err = util.ReadUintRaw(ctxt.buf, binary.LittleEndian, 8) + default: + panic("internal error") + } + if err != nil { + return err + } + ctxt.stack = append(ctxt.stack, int64(n)) + return nil +} + +func constu(opcode Opcode, ctxt *context) error { + num, _ := util.DecodeULEB128(ctxt.buf) + ctxt.stack = append(ctxt.stack, int64(num)) + return nil +} + +func dup(_ Opcode, ctxt *context) error { + if len(ctxt.stack) <= 0 { + return ErrStackUnderflow + } + ctxt.stack = append(ctxt.stack, ctxt.stack[len(ctxt.stack)-1]) + return nil +} + +func drop(_ Opcode, ctxt *context) error { + if len(ctxt.stack) <= 0 { + return ErrStackUnderflow + } + ctxt.stack = ctxt.stack[:len(ctxt.stack)-1] + return nil +} + +func pick(opcode Opcode, ctxt *context) error { + var n byte + switch opcode { + case DW_OP_pick: + n, _ = ctxt.buf.ReadByte() + case DW_OP_over: + n = 1 + default: + panic("internal error") + } + idx := len(ctxt.stack) - 1 - int(uint8(n)) + if idx < 0 || idx >= len(ctxt.stack) { + return ErrStackIndexOutOfBounds + } + ctxt.stack = append(ctxt.stack, ctxt.stack[idx]) + return nil +} + +func swap(_ Opcode, ctxt *context) error { + if len(ctxt.stack) < 2 { + return ErrStackUnderflow + } + ctxt.stack[len(ctxt.stack)-1], ctxt.stack[len(ctxt.stack)-2] = ctxt.stack[len(ctxt.stack)-2], ctxt.stack[len(ctxt.stack)-1] + return nil +} + +func rot(_ Opcode, ctxt *context) error { + if len(ctxt.stack) < 3 { + return ErrStackUnderflow + } + ctxt.stack[len(ctxt.stack)-1], ctxt.stack[len(ctxt.stack)-2], ctxt.stack[len(ctxt.stack)-3] = ctxt.stack[len(ctxt.stack)-2], ctxt.stack[len(ctxt.stack)-3], ctxt.stack[len(ctxt.stack)-1] + return nil +} + +func unaryop(opcode Opcode, ctxt *context) error { + if len(ctxt.stack) < 1 { + return ErrStackUnderflow + } + operand := ctxt.stack[len(ctxt.stack)-1] + switch opcode { + case DW_OP_abs: + if operand < 0 { + operand = -operand + } + case DW_OP_neg: + operand = -operand + case DW_OP_not: + operand = ^operand + default: + panic("internal error") + } + ctxt.stack[len(ctxt.stack)-1] = operand + return nil +} + +func binaryop(opcode Opcode, ctxt *context) error { + if len(ctxt.stack) < 2 { + return ErrStackUnderflow + } + second := ctxt.stack[len(ctxt.stack)-2] + top := ctxt.stack[len(ctxt.stack)-1] + var r int64 + ctxt.stack = ctxt.stack[:len(ctxt.stack)-2] + switch opcode { + case DW_OP_and: + r = second & top + case DW_OP_div: + r = second / top + case DW_OP_minus: + r = second - top + case DW_OP_mod: + r = second % top + case DW_OP_mul: + r = second * top + case DW_OP_or: + r = second | top + case DW_OP_plus: + r = second + top + case DW_OP_shl: + r = second << uint64(top) + case DW_OP_shr: + r = second >> uint64(top) + case DW_OP_shra: + r = int64(uint64(second) >> uint64(top)) + case DW_OP_xor: + r = second ^ top + case DW_OP_le: + r = bool2int(second <= top) + case DW_OP_ge: + r = bool2int(second >= top) + case DW_OP_eq: + r = bool2int(second == top) + case DW_OP_lt: + r = bool2int(second < top) + case DW_OP_gt: + r = bool2int(second > top) + case DW_OP_ne: + r = bool2int(second != top) + default: + panic("internal error") + } + ctxt.stack = append(ctxt.stack, r) + return nil +} + +func bool2int(b bool) int64 { + if b { + return 1 + } + return 0 +} + +func (ctxt *context) jump(n int16) error { + i := len(ctxt.prog) - ctxt.buf.Len() + int(n) + if i < 0 { + return ErrStackUnderflow + } + if i >= len(ctxt.prog) { + i = len(ctxt.prog) + } + ctxt.buf = bytes.NewBuffer(ctxt.prog[i:]) + return nil +} + +func skip(_ Opcode, ctxt *context) error { + var n int16 + binary.Read(ctxt.buf, binary.LittleEndian, &n) + return ctxt.jump(n) +} + +func bra(_ Opcode, ctxt *context) error { + var n int16 + binary.Read(ctxt.buf, binary.LittleEndian, &n) + + if len(ctxt.stack) < 1 { + return ErrStackUnderflow + } + top := ctxt.stack[len(ctxt.stack)-1] + ctxt.stack = ctxt.stack[:len(ctxt.stack)-1] + if top != 0 { + return ctxt.jump(n) + } + return nil +} + +func stackvalue(_ Opcode, ctxt *context) error { + if len(ctxt.stack) < 1 { + return ErrStackUnderflow + } + val := ctxt.stack[len(ctxt.stack)-1] + ctxt.stack = ctxt.stack[:len(ctxt.stack)-1] + return ctxt.closeLoc(DW_OP_stack_value, Piece{Kind: ImmPiece, Val: uint64(val)}) +} + +func implicitvalue(_ Opcode, ctxt *context) error { + sz, _ := util.DecodeULEB128(ctxt.buf) + block := make([]byte, sz) + n, _ := ctxt.buf.Read(block) + if uint64(n) != sz { + return fmt.Errorf("insufficient bytes read while reading DW_OP_implicit_value's block %d (expected: %d)", n, sz) + } + return ctxt.closeLoc(DW_OP_implicit_value, Piece{Kind: ImmPiece, Bytes: block, Size: int(sz)}) +} + +func deref(op Opcode, ctxt *context) error { + if ctxt.readMemory == nil { + return ErrMemoryReadUnavailable + } + + sz := ctxt.ptrSize + if op == DW_OP_deref_size || op == DW_OP_xderef_size { + n, err := ctxt.buf.ReadByte() + if err != nil { + return err + } + sz = int(n) + } + + if len(ctxt.stack) <= 0 { + return ErrStackUnderflow + } + + addr := ctxt.stack[len(ctxt.stack)-1] + ctxt.stack = ctxt.stack[:len(ctxt.stack)-1] + + if op == DW_OP_xderef || op == DW_OP_xderef_size { + if len(ctxt.stack) <= 0 { + return ErrStackUnderflow + } + // the second element on the stack is the "address space identifier" which we don't do anything with + ctxt.stack = ctxt.stack[:len(ctxt.stack)-1] + } + + buf := make([]byte, sz) + _, err := ctxt.readMemory(buf, uint64(addr)) + if err != nil { + return err + } + + x, err := util.ReadUintRaw(bytes.NewReader(buf), binary.LittleEndian, sz) + if err != nil { + return err + } + + ctxt.stack = append(ctxt.stack, int64(x)) + + return nil +} diff --git a/pkg/dwarf/op/op_test.go b/pkg/dwarf/op/op_test.go index 0a346261e9..1faab63ed3 100644 --- a/pkg/dwarf/op/op_test.go +++ b/pkg/dwarf/op/op_test.go @@ -1,25 +1,58 @@ package op import ( + "strings" "testing" - "unsafe" ) -func ptrSizeByRuntimeArch() int { - return int(unsafe.Sizeof(uintptr(0))) -} - -func TestExecuteStackProgram(t *testing.T) { - var ( - instructions = []byte{byte(DW_OP_consts), 0x1c, byte(DW_OP_consts), 0x1c, byte(DW_OP_plus)} - expected = int64(56) - ) - actual, _, err := ExecuteStackProgram(DwarfRegisters{}, instructions, ptrSizeByRuntimeArch()) +func assertExprResult(t *testing.T, expected int64, instructions []byte) { + t.Helper() + actual, _, err := ExecuteStackProgram(DwarfRegisters{}, instructions, 8, nil) if err != nil { - t.Fatal(err) + t.Error(err) } - if actual != expected { - t.Fatalf("actual %d != expected %d", actual, expected) + buf := new(strings.Builder) + PrettyPrint(buf, instructions) + t.Errorf("actual %d != expected %d (in %s)", actual, expected, buf.String()) } } + +func TestExecuteStackProgram(t *testing.T) { + assertExprResult(t, 56, []byte{byte(DW_OP_consts), 0x1c, byte(DW_OP_consts), 0x1c, byte(DW_OP_plus)}) +} + +func TestSignExtension(t *testing.T) { + var tgt uint64 = 0xffffffffffffff88 + assertExprResult(t, int64(tgt), []byte{byte(DW_OP_const1s), 0x88}) + tgt = 0xffffffffffff8888 + assertExprResult(t, int64(tgt), []byte{byte(DW_OP_const2s), 0x88, 0x88}) +} + +func TestStackOps(t *testing.T) { + assertExprResult(t, 1, []byte{byte(DW_OP_lit1), byte(DW_OP_lit2), byte(DW_OP_drop)}) + assertExprResult(t, 0, []byte{byte(DW_OP_lit1), byte(DW_OP_lit0), byte(DW_OP_pick), 0}) + assertExprResult(t, 1, []byte{byte(DW_OP_lit1), byte(DW_OP_lit0), byte(DW_OP_pick), 1}) +} + +func TestBra(t *testing.T) { + assertExprResult(t, 32, []byte{ + byte(DW_OP_lit1), + byte(DW_OP_lit5), + + byte(DW_OP_dup), + byte(DW_OP_lit0), + byte(DW_OP_eq), + byte(DW_OP_bra), 9, 0x0, + + byte(DW_OP_swap), + byte(DW_OP_dup), + byte(DW_OP_plus), + byte(DW_OP_swap), + byte(DW_OP_lit1), + byte(DW_OP_minus), + byte(DW_OP_skip), 0xf1, 0xff, + + byte(DW_OP_drop), + }) +} diff --git a/pkg/dwarf/op/opcodes.go b/pkg/dwarf/op/opcodes.go index c315859e86..e53088c029 100644 --- a/pkg/dwarf/op/opcodes.go +++ b/pkg/dwarf/op/opcodes.go @@ -473,9 +473,79 @@ var opcodeArgs = map[Opcode]string{ } var oplut = map[Opcode]stackfn{ DW_OP_addr: addr, + DW_OP_deref: deref, + DW_OP_const1u: constnu, + DW_OP_const1s: constns, + DW_OP_const2u: constnu, + DW_OP_const2s: constns, + DW_OP_const4u: constnu, + DW_OP_const4s: constns, + DW_OP_const8u: constnu, + DW_OP_const8s: constns, + DW_OP_constu: constu, DW_OP_consts: consts, - DW_OP_plus: plus, + DW_OP_dup: dup, + DW_OP_drop: drop, + DW_OP_over: pick, + DW_OP_pick: pick, + DW_OP_swap: swap, + DW_OP_rot: rot, + DW_OP_xderef: deref, + DW_OP_abs: unaryop, + DW_OP_and: binaryop, + DW_OP_div: binaryop, + DW_OP_minus: binaryop, + DW_OP_mod: binaryop, + DW_OP_mul: binaryop, + DW_OP_neg: unaryop, + DW_OP_not: unaryop, + DW_OP_or: binaryop, + DW_OP_plus: binaryop, DW_OP_plus_uconst: plusuconsts, + DW_OP_shl: binaryop, + DW_OP_shr: binaryop, + DW_OP_shra: binaryop, + DW_OP_xor: binaryop, + DW_OP_bra: bra, + DW_OP_eq: binaryop, + DW_OP_ge: binaryop, + DW_OP_gt: binaryop, + DW_OP_le: binaryop, + DW_OP_lt: binaryop, + DW_OP_ne: binaryop, + DW_OP_skip: skip, + DW_OP_lit0: literal, + DW_OP_lit1: literal, + DW_OP_lit2: literal, + DW_OP_lit3: literal, + DW_OP_lit4: literal, + DW_OP_lit5: literal, + DW_OP_lit6: literal, + DW_OP_lit7: literal, + DW_OP_lit8: literal, + DW_OP_lit9: literal, + DW_OP_lit10: literal, + DW_OP_lit11: literal, + DW_OP_lit12: literal, + DW_OP_lit13: literal, + DW_OP_lit14: literal, + DW_OP_lit15: literal, + DW_OP_lit16: literal, + DW_OP_lit17: literal, + DW_OP_lit18: literal, + DW_OP_lit19: literal, + DW_OP_lit20: literal, + DW_OP_lit21: literal, + DW_OP_lit22: literal, + DW_OP_lit23: literal, + DW_OP_lit24: literal, + DW_OP_lit25: literal, + DW_OP_lit26: literal, + DW_OP_lit27: literal, + DW_OP_lit28: literal, + DW_OP_lit29: literal, + DW_OP_lit30: literal, + DW_OP_lit31: literal, DW_OP_reg0: register, DW_OP_reg1: register, DW_OP_reg2: register, @@ -508,8 +578,45 @@ var oplut = map[Opcode]stackfn{ DW_OP_reg29: register, DW_OP_reg30: register, DW_OP_reg31: register, + DW_OP_breg0: bregister, + DW_OP_breg1: bregister, + DW_OP_breg2: bregister, + DW_OP_breg3: bregister, + DW_OP_breg4: bregister, + DW_OP_breg5: bregister, + DW_OP_breg6: bregister, + DW_OP_breg7: bregister, + DW_OP_breg8: bregister, + DW_OP_breg9: bregister, + DW_OP_breg10: bregister, + DW_OP_breg11: bregister, + DW_OP_breg12: bregister, + DW_OP_breg13: bregister, + DW_OP_breg14: bregister, + DW_OP_breg15: bregister, + DW_OP_breg16: bregister, + DW_OP_breg17: bregister, + DW_OP_breg18: bregister, + DW_OP_breg19: bregister, + DW_OP_breg20: bregister, + DW_OP_breg21: bregister, + DW_OP_breg22: bregister, + DW_OP_breg23: bregister, + DW_OP_breg24: bregister, + DW_OP_breg25: bregister, + DW_OP_breg26: bregister, + DW_OP_breg27: bregister, + DW_OP_breg28: bregister, + DW_OP_breg29: bregister, + DW_OP_breg30: bregister, + DW_OP_breg31: bregister, DW_OP_regx: register, DW_OP_fbreg: framebase, + DW_OP_bregx: bregister, DW_OP_piece: piece, + DW_OP_deref_size: deref, + DW_OP_xderef_size: deref, DW_OP_call_frame_cfa: callframecfa, + DW_OP_implicit_value: implicitvalue, + DW_OP_stack_value: stackvalue, } diff --git a/pkg/dwarf/op/opcodes.table b/pkg/dwarf/op/opcodes.table index f1dadc0793..e49e2c0aef 100644 --- a/pkg/dwarf/op/opcodes.table +++ b/pkg/dwarf/op/opcodes.table @@ -20,79 +20,79 @@ DW_OP_addr 0x03 "8" addr -DW_OP_deref 0x06 "" -DW_OP_const1u 0x08 "1" -DW_OP_const1s 0x09 "1" -DW_OP_const2u 0x0a "2" -DW_OP_const2s 0x0b "2" -DW_OP_const4u 0x0c "4" -DW_OP_const4s 0x0d "4" -DW_OP_const8u 0x0e "8" -DW_OP_const8s 0x0f "8" -DW_OP_constu 0x10 "u" +DW_OP_deref 0x06 "" deref +DW_OP_const1u 0x08 "1" constnu +DW_OP_const1s 0x09 "1" constns +DW_OP_const2u 0x0a "2" constnu +DW_OP_const2s 0x0b "2" constns +DW_OP_const4u 0x0c "4" constnu +DW_OP_const4s 0x0d "4" constns +DW_OP_const8u 0x0e "8" constnu +DW_OP_const8s 0x0f "8" constns +DW_OP_constu 0x10 "u" constu DW_OP_consts 0x11 "s" consts -DW_OP_dup 0x12 "" -DW_OP_drop 0x13 "" -DW_OP_over 0x14 "" -DW_OP_pick 0x15 "" -DW_OP_swap 0x16 "" -DW_OP_rot 0x17 "" -DW_OP_xderef 0x18 "" -DW_OP_abs 0x19 "" -DW_OP_and 0x1a "" -DW_OP_div 0x1b "" -DW_OP_minus 0x1c "" -DW_OP_mod 0x1d "" -DW_OP_mul 0x1e "" -DW_OP_neg 0x1f "" -DW_OP_not 0x20 "" -DW_OP_or 0x21 "" -DW_OP_plus 0x22 "" plus +DW_OP_dup 0x12 "" dup +DW_OP_drop 0x13 "" drop +DW_OP_over 0x14 "" pick +DW_OP_pick 0x15 "" pick +DW_OP_swap 0x16 "" swap +DW_OP_rot 0x17 "" rot +DW_OP_xderef 0x18 "" deref +DW_OP_abs 0x19 "" unaryop +DW_OP_and 0x1a "" binaryop +DW_OP_div 0x1b "" binaryop +DW_OP_minus 0x1c "" binaryop +DW_OP_mod 0x1d "" binaryop +DW_OP_mul 0x1e "" binaryop +DW_OP_neg 0x1f "" unaryop +DW_OP_not 0x20 "" unaryop +DW_OP_or 0x21 "" binaryop +DW_OP_plus 0x22 "" binaryop DW_OP_plus_uconst 0x23 "u" plusuconsts -DW_OP_shl 0x24 "" -DW_OP_shr 0x25 "" -DW_OP_shra 0x26 "" -DW_OP_xor 0x27 "" -DW_OP_bra 0x28 "2" -DW_OP_eq 0x29 "" -DW_OP_ge 0x2a "" -DW_OP_gt 0x2b "" -DW_OP_le 0x2c "" -DW_OP_lt 0x2d "" -DW_OP_ne 0x2e "" -DW_OP_skip 0x2f "2" -DW_OP_lit0 0x30 "" -DW_OP_lit1 0x31 "" -DW_OP_lit2 0x32 "" -DW_OP_lit3 0x33 "" -DW_OP_lit4 0x34 "" -DW_OP_lit5 0x35 "" -DW_OP_lit6 0x36 "" -DW_OP_lit7 0x37 "" -DW_OP_lit8 0x38 "" -DW_OP_lit9 0x39 "" -DW_OP_lit10 0x3a "" -DW_OP_lit11 0x3b "" -DW_OP_lit12 0x3c "" -DW_OP_lit13 0x3d "" -DW_OP_lit14 0x3e "" -DW_OP_lit15 0x3f "" -DW_OP_lit16 0x40 "" -DW_OP_lit17 0x41 "" -DW_OP_lit18 0x42 "" -DW_OP_lit19 0x43 "" -DW_OP_lit20 0x44 "" -DW_OP_lit21 0x45 "" -DW_OP_lit22 0x46 "" -DW_OP_lit23 0x47 "" -DW_OP_lit24 0x48 "" -DW_OP_lit25 0x49 "" -DW_OP_lit26 0x4a "" -DW_OP_lit27 0x4b "" -DW_OP_lit28 0x4c "" -DW_OP_lit29 0x4d "" -DW_OP_lit30 0x4e "" -DW_OP_lit31 0x4f "" +DW_OP_shl 0x24 "" binaryop +DW_OP_shr 0x25 "" binaryop +DW_OP_shra 0x26 "" binaryop +DW_OP_xor 0x27 "" binaryop +DW_OP_bra 0x28 "2" bra +DW_OP_eq 0x29 "" binaryop +DW_OP_ge 0x2a "" binaryop +DW_OP_gt 0x2b "" binaryop +DW_OP_le 0x2c "" binaryop +DW_OP_lt 0x2d "" binaryop +DW_OP_ne 0x2e "" binaryop +DW_OP_skip 0x2f "2" skip +DW_OP_lit0 0x30 "" literal +DW_OP_lit1 0x31 "" literal +DW_OP_lit2 0x32 "" literal +DW_OP_lit3 0x33 "" literal +DW_OP_lit4 0x34 "" literal +DW_OP_lit5 0x35 "" literal +DW_OP_lit6 0x36 "" literal +DW_OP_lit7 0x37 "" literal +DW_OP_lit8 0x38 "" literal +DW_OP_lit9 0x39 "" literal +DW_OP_lit10 0x3a "" literal +DW_OP_lit11 0x3b "" literal +DW_OP_lit12 0x3c "" literal +DW_OP_lit13 0x3d "" literal +DW_OP_lit14 0x3e "" literal +DW_OP_lit15 0x3f "" literal +DW_OP_lit16 0x40 "" literal +DW_OP_lit17 0x41 "" literal +DW_OP_lit18 0x42 "" literal +DW_OP_lit19 0x43 "" literal +DW_OP_lit20 0x44 "" literal +DW_OP_lit21 0x45 "" literal +DW_OP_lit22 0x46 "" literal +DW_OP_lit23 0x47 "" literal +DW_OP_lit24 0x48 "" literal +DW_OP_lit25 0x49 "" literal +DW_OP_lit26 0x4a "" literal +DW_OP_lit27 0x4b "" literal +DW_OP_lit28 0x4c "" literal +DW_OP_lit29 0x4d "" literal +DW_OP_lit30 0x4e "" literal +DW_OP_lit31 0x4f "" literal DW_OP_reg0 0x50 "" register DW_OP_reg1 0x51 "" register DW_OP_reg2 0x52 "" register @@ -125,44 +125,44 @@ DW_OP_reg28 0x6c "" register DW_OP_reg29 0x6d "" register DW_OP_reg30 0x6e "" register DW_OP_reg31 0x6f "" register -DW_OP_breg0 0x70 "s" -DW_OP_breg1 0x71 "s" -DW_OP_breg2 0x72 "s" -DW_OP_breg3 0x73 "s" -DW_OP_breg4 0x74 "s" -DW_OP_breg5 0x75 "s" -DW_OP_breg6 0x76 "s" -DW_OP_breg7 0x77 "s" -DW_OP_breg8 0x78 "s" -DW_OP_breg9 0x79 "s" -DW_OP_breg10 0x7a "s" -DW_OP_breg11 0x7b "s" -DW_OP_breg12 0x7c "s" -DW_OP_breg13 0x7d "s" -DW_OP_breg14 0x7e "s" -DW_OP_breg15 0x7f "s" -DW_OP_breg16 0x80 "s" -DW_OP_breg17 0x81 "s" -DW_OP_breg18 0x82 "s" -DW_OP_breg19 0x83 "s" -DW_OP_breg20 0x84 "s" -DW_OP_breg21 0x85 "s" -DW_OP_breg22 0x86 "s" -DW_OP_breg23 0x87 "s" -DW_OP_breg24 0x88 "s" -DW_OP_breg25 0x89 "s" -DW_OP_breg26 0x8a "s" -DW_OP_breg27 0x8b "s" -DW_OP_breg28 0x8c "s" -DW_OP_breg29 0x8d "s" -DW_OP_breg30 0x8e "s" -DW_OP_breg31 0x8f "s" +DW_OP_breg0 0x70 "s" bregister +DW_OP_breg1 0x71 "s" bregister +DW_OP_breg2 0x72 "s" bregister +DW_OP_breg3 0x73 "s" bregister +DW_OP_breg4 0x74 "s" bregister +DW_OP_breg5 0x75 "s" bregister +DW_OP_breg6 0x76 "s" bregister +DW_OP_breg7 0x77 "s" bregister +DW_OP_breg8 0x78 "s" bregister +DW_OP_breg9 0x79 "s" bregister +DW_OP_breg10 0x7a "s" bregister +DW_OP_breg11 0x7b "s" bregister +DW_OP_breg12 0x7c "s" bregister +DW_OP_breg13 0x7d "s" bregister +DW_OP_breg14 0x7e "s" bregister +DW_OP_breg15 0x7f "s" bregister +DW_OP_breg16 0x80 "s" bregister +DW_OP_breg17 0x81 "s" bregister +DW_OP_breg18 0x82 "s" bregister +DW_OP_breg19 0x83 "s" bregister +DW_OP_breg20 0x84 "s" bregister +DW_OP_breg21 0x85 "s" bregister +DW_OP_breg22 0x86 "s" bregister +DW_OP_breg23 0x87 "s" bregister +DW_OP_breg24 0x88 "s" bregister +DW_OP_breg25 0x89 "s" bregister +DW_OP_breg26 0x8a "s" bregister +DW_OP_breg27 0x8b "s" bregister +DW_OP_breg28 0x8c "s" bregister +DW_OP_breg29 0x8d "s" bregister +DW_OP_breg30 0x8e "s" bregister +DW_OP_breg31 0x8f "s" bregister DW_OP_regx 0x90 "s" register DW_OP_fbreg 0x91 "s" framebase -DW_OP_bregx 0x92 "us" +DW_OP_bregx 0x92 "us" bregister DW_OP_piece 0x93 "u" piece -DW_OP_deref_size 0x94 "1" -DW_OP_xderef_size 0x95 "1" +DW_OP_deref_size 0x94 "1" deref +DW_OP_xderef_size 0x95 "1" deref DW_OP_nop 0x96 "" DW_OP_push_object_address 0x97 "" DW_OP_call2 0x98 "2" @@ -171,5 +171,5 @@ DW_OP_call_ref 0x9a "4" DW_OP_form_tls_address 0x9b "" DW_OP_call_frame_cfa 0x9c "" callframecfa DW_OP_bit_piece 0x9d "uu" -DW_OP_implicit_value 0x9e "B" -DW_OP_stack_value 0x9f "" +DW_OP_implicit_value 0x9e "B" implicitvalue +DW_OP_stack_value 0x9f "" stackvalue diff --git a/pkg/dwarf/op/regs.go b/pkg/dwarf/op/regs.go index 3e4b6b6be9..7696b92893 100644 --- a/pkg/dwarf/op/regs.go +++ b/pkg/dwarf/op/regs.go @@ -14,11 +14,12 @@ type DwarfRegisters struct { ObjBase int64 regs []*DwarfRegister - ByteOrder binary.ByteOrder - PCRegNum uint64 - SPRegNum uint64 - BPRegNum uint64 - LRRegNum uint64 + ByteOrder binary.ByteOrder + PCRegNum uint64 + SPRegNum uint64 + BPRegNum uint64 + LRRegNum uint64 + ChangeFunc RegisterChangeFunc FloatLoadError error // error produced when loading floating point registers loadMoreCallback func() @@ -29,6 +30,8 @@ type DwarfRegister struct { Bytes []byte } +type RegisterChangeFunc func(regNum uint64, reg *DwarfRegister) error + // NewDwarfRegisters returns a new DwarfRegisters object. func NewDwarfRegisters(staticBase uint64, regs []*DwarfRegister, byteOrder binary.ByteOrder, pcRegNum, spRegNum, bpRegNum, lrRegNum uint64) *DwarfRegisters { return &DwarfRegisters{ @@ -152,3 +155,29 @@ func DwarfRegisterFromBytes(bytes []byte) *DwarfRegister { } return &DwarfRegister{Uint64Val: v, Bytes: bytes} } + +// FillBytes fills the Bytes slice of reg using Uint64Val. +func (reg *DwarfRegister) FillBytes() { + if reg.Bytes != nil { + return + } + reg.Bytes = make([]byte, 8) + binary.LittleEndian.PutUint64(reg.Bytes, reg.Uint64Val) +} + +// Overwrite takes the contents of reg1 and overwrites them with the contents +// of reg2 in little-endian order, returning a new register. The new register +// will always contain the complete contents of both registers, so if reg2 is +// larger than reg1, the final register will be reg2's size. +func (reg1 *DwarfRegister) Overwrite(reg2 *DwarfRegister) *DwarfRegister { + reg1.FillBytes() + reg2.FillBytes() + width := len(reg1.Bytes) + if len(reg2.Bytes) > len(reg1.Bytes) { + width = len(reg2.Bytes) + } + b := make([]byte, width) + copy(b, reg1.Bytes) + copy(b, reg2.Bytes) + return DwarfRegisterFromBytes(b) +} diff --git a/pkg/dwarf/reader/reader.go b/pkg/dwarf/reader/reader.go index 8fa99571eb..d0a8691177 100644 --- a/pkg/dwarf/reader/reader.go +++ b/pkg/dwarf/reader/reader.go @@ -33,7 +33,7 @@ func (reader *Reader) SeekToEntry(entry *dwarf.Entry) error { return err } -// Returns the address for the named entry. +// AddrFor returns the address for the named entry. func (reader *Reader) AddrFor(name string, staticBase uint64, ptrSize int) (uint64, error) { entry, err := reader.FindEntryNamed(name, false) if err != nil { @@ -43,38 +43,14 @@ func (reader *Reader) AddrFor(name string, staticBase uint64, ptrSize int) (uint if !ok { return 0, fmt.Errorf("type assertion failed") } - addr, _, err := op.ExecuteStackProgram(op.DwarfRegisters{StaticBase: staticBase}, instructions, ptrSize) + addr, _, err := op.ExecuteStackProgram(op.DwarfRegisters{StaticBase: staticBase}, instructions, ptrSize, nil) if err != nil { return 0, err } return uint64(addr), nil } -// Returns the address for the named struct member. Expects the reader to be at the parent entry -// or one of the parents children, thus does not seek to parent by itself. -func (reader *Reader) AddrForMember(member string, initialInstructions []byte, ptrSize int) (uint64, error) { - for { - entry, err := reader.NextMemberVariable() - if err != nil { - return 0, err - } - if entry == nil { - return 0, fmt.Errorf("nil entry for member named %s", member) - } - name, ok := entry.Val(dwarf.AttrName).(string) - if !ok || name != member { - continue - } - instructions, ok := entry.Val(dwarf.AttrDataMemberLoc).([]byte) - if !ok { - continue - } - addr, _, err := op.ExecuteStackProgram(op.DwarfRegisters{}, append(initialInstructions, instructions...), ptrSize) - return uint64(addr), err - } -} - -var TypeNotFoundErr = errors.New("no type entry found, use 'types' for a list of valid types") +var ErrTypeNotFound = errors.New("no type entry found, use 'types' for a list of valid types") // SeekToType moves the reader to the type specified by the entry, // optionally resolving typedefs and pointer types. If the reader is set @@ -110,7 +86,7 @@ func (reader *Reader) SeekToType(entry *dwarf.Entry, resolveTypedefs bool, resol reader.Seek(offset) } - return nil, TypeNotFoundErr + return nil, ErrTypeNotFound } func (reader *Reader) NextType() (*dwarf.Entry, error) { @@ -148,10 +124,10 @@ func (reader *Reader) SeekToTypeNamed(name string) (*dwarf.Entry, error) { } } - return nil, TypeNotFoundErr + return nil, ErrTypeNotFound } -// Finds the entry for 'name'. +// FindEntryNamed finds the entry for 'name'. func (reader *Reader) FindEntryNamed(name string, member bool) (*dwarf.Entry, error) { depth := 1 for entry, err := reader.Next(); entry != nil; entry, err = reader.Next() { diff --git a/pkg/dwarf/reader/variables.go b/pkg/dwarf/reader/variables.go index 13640e6585..d39f9d68ae 100644 --- a/pkg/dwarf/reader/variables.go +++ b/pkg/dwarf/reader/variables.go @@ -8,6 +8,11 @@ import ( type Variable struct { *godwarf.Tree + // Depth represents the depth of the lexical block in which this variable + // was declared, relative to a root scope (e.g. a function) passed to + // Variables(). The depth is used to figure out if a variable is shadowed at + // a particular pc by another one with the same name declared in an inner + // block. Depth int } @@ -18,15 +23,20 @@ const ( VariablesOnlyVisible VariablesFlags = 1 << iota VariablesSkipInlinedSubroutines VariablesTrustDeclLine + VariablesNoDeclLineCheck ) // Variables returns a list of variables contained inside 'root'. -// If onlyVisible is true only variables visible at pc will be returned. -// If skipInlinedSubroutines is true inlined subroutines will be skipped +// +// If the VariablesOnlyVisible flag is set, only variables visible at 'pc' will be +// returned. If the VariablesSkipInlinedSubroutines is set, variables from +// inlined subroutines will be skipped. func Variables(root *godwarf.Tree, pc uint64, line int, flags VariablesFlags) []Variable { return variablesInternal(nil, root, 0, pc, line, flags) } +// variablesInternal appends to 'v' variables from 'root'. The function calls +// itself with an incremented scope for all sub-blocks in 'root'. func variablesInternal(v []Variable, root *godwarf.Tree, depth int, pc uint64, line int, flags VariablesFlags) []Variable { switch root.Tag { case dwarf.TagInlinedSubroutine: @@ -35,6 +45,8 @@ func variablesInternal(v []Variable, root *godwarf.Tree, depth int, pc uint64, l } fallthrough case dwarf.TagLexDwarfBlock, dwarf.TagSubprogram: + // Recurse into blocks and functions, if the respective block contains + // pc (or if we don't care about visibility). if (flags&VariablesOnlyVisible == 0) || root.ContainsPC(pc) { for _, child := range root.Children { v = variablesInternal(v, child, depth+1, pc, line, flags) @@ -49,7 +61,7 @@ func variablesInternal(v []Variable, root *godwarf.Tree, depth int, pc uint64, l // are defined. o = 1 } - if declLine, ok := root.Val(dwarf.AttrDeclLine).(int64); !ok || line >= int(declLine)+o { + if declLine, ok := root.Val(dwarf.AttrDeclLine).(int64); (flags&VariablesNoDeclLineCheck != 0) || !ok || line >= int(declLine)+o { return append(v, Variable{root, depth}) } return v diff --git a/pkg/dwarf/regnum/amd64.go b/pkg/dwarf/regnum/amd64.go new file mode 100644 index 0000000000..2fcbb4e6b3 --- /dev/null +++ b/pkg/dwarf/regnum/amd64.go @@ -0,0 +1,162 @@ +package regnum + +import ( + "fmt" + "strings" +) + +// The mapping between hardware registers and DWARF registers is specified +// in the System V ABI AMD64 Architecture Processor Supplement v. 1.0 page 61, +// figure 3.36 +// https://gitlab.com/x86-psABIs/x86-64-ABI/-/tree/master + +const ( + AMD64_Rax = 0 + AMD64_Rdx = 1 + AMD64_Rcx = 2 + AMD64_Rbx = 3 + AMD64_Rsi = 4 + AMD64_Rdi = 5 + AMD64_Rbp = 6 + AMD64_Rsp = 7 + AMD64_R8 = 8 + AMD64_R9 = 9 + AMD64_R10 = 10 + AMD64_R11 = 11 + AMD64_R12 = 12 + AMD64_R13 = 13 + AMD64_R14 = 14 + AMD64_R15 = 15 + AMD64_Rip = 16 + AMD64_XMM0 = 17 // XMM1 through XMM15 follow + AMD64_ST0 = 33 // ST(1) through ST(7) follow + AMD64_Rflags = 49 + AMD64_Es = 50 + AMD64_Cs = 51 + AMD64_Ss = 52 + AMD64_Ds = 53 + AMD64_Fs = 54 + AMD64_Gs = 55 + AMD64_Fs_base = 58 + AMD64_Gs_base = 59 + AMD64_MXCSR = 64 + AMD64_CW = 65 + AMD64_SW = 66 + AMD64_XMM16 = 67 // XMM17 through XMM31 follow + AMD64_K0 = 118 // k1 through k7 follow +) + +var amd64DwarfToName = map[uint64]string{ + AMD64_Rax: "Rax", + AMD64_Rdx: "Rdx", + AMD64_Rcx: "Rcx", + AMD64_Rbx: "Rbx", + AMD64_Rsi: "Rsi", + AMD64_Rdi: "Rdi", + AMD64_Rbp: "Rbp", + AMD64_Rsp: "Rsp", + AMD64_R8: "R8", + AMD64_R9: "R9", + AMD64_R10: "R10", + AMD64_R11: "R11", + AMD64_R12: "R12", + AMD64_R13: "R13", + AMD64_R14: "R14", + AMD64_R15: "R15", + AMD64_Rip: "Rip", + AMD64_XMM0: "XMM0", + AMD64_XMM0 + 1: "XMM1", + AMD64_XMM0 + 2: "XMM2", + AMD64_XMM0 + 3: "XMM3", + AMD64_XMM0 + 4: "XMM4", + AMD64_XMM0 + 5: "XMM5", + AMD64_XMM0 + 6: "XMM6", + AMD64_XMM0 + 7: "XMM7", + AMD64_XMM0 + 8: "XMM8", + AMD64_XMM0 + 9: "XMM9", + AMD64_XMM0 + 10: "XMM10", + AMD64_XMM0 + 11: "XMM11", + AMD64_XMM0 + 12: "XMM12", + AMD64_XMM0 + 13: "XMM13", + AMD64_XMM0 + 14: "XMM14", + AMD64_XMM0 + 15: "XMM15", + AMD64_ST0: "ST(0)", + AMD64_ST0 + 1: "ST(1)", + AMD64_ST0 + 2: "ST(2)", + AMD64_ST0 + 3: "ST(3)", + AMD64_ST0 + 4: "ST(4)", + AMD64_ST0 + 5: "ST(5)", + AMD64_ST0 + 6: "ST(6)", + AMD64_ST0 + 7: "ST(7)", + AMD64_Rflags: "Rflags", + AMD64_Es: "Es", + AMD64_Cs: "Cs", + AMD64_Ss: "Ss", + AMD64_Ds: "Ds", + AMD64_Fs: "Fs", + AMD64_Gs: "Gs", + AMD64_Fs_base: "Fs_base", + AMD64_Gs_base: "Gs_base", + AMD64_MXCSR: "MXCSR", + AMD64_CW: "CW", + AMD64_SW: "SW", + AMD64_XMM16: "XMM16", + AMD64_XMM16 + 1: "XMM17", + AMD64_XMM16 + 2: "XMM18", + AMD64_XMM16 + 3: "XMM19", + AMD64_XMM16 + 4: "XMM20", + AMD64_XMM16 + 5: "XMM21", + AMD64_XMM16 + 6: "XMM22", + AMD64_XMM16 + 7: "XMM23", + AMD64_XMM16 + 8: "XMM24", + AMD64_XMM16 + 9: "XMM25", + AMD64_XMM16 + 10: "XMM26", + AMD64_XMM16 + 11: "XMM27", + AMD64_XMM16 + 12: "XMM28", + AMD64_XMM16 + 13: "XMM29", + AMD64_XMM16 + 14: "XMM30", + AMD64_XMM16 + 15: "XMM31", + AMD64_K0: "K0", + AMD64_K0 + 1: "K1", + AMD64_K0 + 2: "K2", + AMD64_K0 + 3: "K3", + AMD64_K0 + 4: "K4", + AMD64_K0 + 5: "K5", + AMD64_K0 + 6: "K6", + AMD64_K0 + 7: "K7", +} + +var AMD64NameToDwarf = func() map[string]int { + r := make(map[string]int) + for regNum, regName := range amd64DwarfToName { + r[strings.ToLower(regName)] = int(regNum) + } + r["eflags"] = 49 + r["st0"] = 33 + r["st1"] = 34 + r["st2"] = 35 + r["st3"] = 36 + r["st4"] = 37 + r["st5"] = 38 + r["st6"] = 39 + r["st7"] = 40 + return r +}() + +func AMD64MaxRegNum() uint64 { + max := uint64(AMD64_Rip) + for i := range amd64DwarfToName { + if i > max { + max = i + } + } + return max +} + +func AMD64ToName(num uint64) string { + name, ok := amd64DwarfToName[num] + if ok { + return name + } + return fmt.Sprintf("unknown%d", num) +} diff --git a/pkg/dwarf/regnum/arm64.go b/pkg/dwarf/regnum/arm64.go new file mode 100644 index 0000000000..3f7805b93c --- /dev/null +++ b/pkg/dwarf/regnum/arm64.go @@ -0,0 +1,56 @@ +package regnum + +import ( + "fmt" +) + +// The mapping between hardware registers and DWARF registers is specified +// in the DWARF for the ARM® Architecture page 7, +// Table 1 +// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040b/IHI0040B_aadwarf.pdf + +const ( + ARM64_X0 = 0 // X1 through X30 follow + ARM64_BP = 29 // also X29 + ARM64_LR = 30 // also X30 + ARM64_SP = 31 + ARM64_PC = 32 + ARM64_V0 = 64 // V1 through V31 follow + _ARM64_MaxRegNum = ARM64_V0 + 31 +) + +func ARM64ToName(num uint64) string { + switch { + case num <= 30: + return fmt.Sprintf("X%d", num) + case num == ARM64_SP: + return "SP" + case num == ARM64_PC: + return "PC" + case num >= ARM64_V0 && num <= 95: + return fmt.Sprintf("V%d", num-64) + default: + return fmt.Sprintf("unknown%d", num) + } +} + +func ARM64MaxRegNum() uint64 { + return _ARM64_MaxRegNum +} + +var ARM64NameToDwarf = func() map[string]int { + r := make(map[string]int) + for i := 0; i <= 32; i++ { + r[fmt.Sprintf("x%d", i)] = ARM64_X0 + i + } + r["fp"] = 29 + r["lr"] = 30 + r["sp"] = 31 + r["pc"] = 32 + + for i := 0; i <= 31; i++ { + r[fmt.Sprintf("v%d", i)] = ARM64_V0 + i + } + + return r +}() diff --git a/pkg/dwarf/regnum/i386.go b/pkg/dwarf/regnum/i386.go new file mode 100644 index 0000000000..ab7227000a --- /dev/null +++ b/pkg/dwarf/regnum/i386.go @@ -0,0 +1,102 @@ +package regnum + +import ( + "fmt" + "strings" +) + +// The mapping between hardware registers and DWARF registers is specified +// in the System V ABI Intel386 Architecture Processor Supplement page 25, +// table 2.14 +// https://www.uclibc.org/docs/psABI-i386.pdf + +const ( + I386_Eax = 0 + I386_Ecx = 1 + I386_Edx = 2 + I386_Ebx = 3 + I386_Esp = 4 + I386_Ebp = 5 + I386_Esi = 6 + I386_Edi = 7 + I386_Eip = 8 + I386_Eflags = 9 + I386_ST0 = 11 // ST(1) through ST(7) follow + I386_XMM0 = 21 // XMM1 through XMM7 follow + I386_Es = 40 + I386_Cs = 41 + I386_Ss = 42 + I386_Ds = 43 + I386_Fs = 44 + I386_Gs = 45 +) + +var i386DwarfToName = map[int]string{ + I386_Eax: "Eax", + I386_Ecx: "Ecx", + I386_Edx: "Edx", + I386_Ebx: "Ebx", + I386_Esp: "Esp", + I386_Ebp: "Ebp", + I386_Esi: "Esi", + I386_Edi: "Edi", + I386_Eip: "Eip", + I386_Eflags: "Eflags", + I386_ST0: "ST(0)", + I386_ST0 + 1: "ST(1)", + I386_ST0 + 2: "ST(2)", + I386_ST0 + 3: "ST(3)", + I386_ST0 + 4: "ST(4)", + I386_ST0 + 5: "ST(5)", + I386_ST0 + 6: "ST(6)", + I386_ST0 + 7: "ST(7)", + I386_XMM0: "XMM0", + I386_XMM0 + 1: "XMM1", + I386_XMM0 + 2: "XMM2", + I386_XMM0 + 3: "XMM3", + I386_XMM0 + 4: "XMM4", + I386_XMM0 + 5: "XMM5", + I386_XMM0 + 6: "XMM6", + I386_XMM0 + 7: "XMM7", + I386_Es: "Es", + I386_Cs: "Cs", + I386_Ss: "Ss", + I386_Ds: "Ds", + I386_Fs: "Fs", + I386_Gs: "Gs", +} + +var I386NameToDwarf = func() map[string]int { + r := make(map[string]int) + for regNum, regName := range i386DwarfToName { + r[strings.ToLower(regName)] = regNum + } + r["eflags"] = 9 + r["st0"] = 11 + r["st1"] = 12 + r["st2"] = 13 + r["st3"] = 14 + r["st4"] = 15 + r["st5"] = 16 + r["st6"] = 17 + r["st7"] = 18 + return r +}() + +func I386MaxRegNum() int { + max := int(I386_Eip) + for i := range i386DwarfToName { + if i > max { + max = i + } + } + return max +} + +func I386ToName(num int) string { + name, ok := i386DwarfToName[num] + if ok { + return name + } + return fmt.Sprintf("unknown%d", num) +} diff --git a/pkg/dwarf/util/buf.go b/pkg/dwarf/util/buf.go index 52349fe077..12899f8aa3 100644 --- a/pkg/dwarf/util/buf.go +++ b/pkg/dwarf/util/buf.go @@ -4,6 +4,8 @@ // Buffered reading and decoding of DWARF data streams. +//lint:file-ignore ST1021 imported file + package util import ( @@ -53,14 +55,6 @@ func MakeBuf(d *dwarf.Data, format dataFormat, name string, off dwarf.Offset, da return buf{d, format, name, off, data, nil} } -func (b *buf) slice(length int) buf { - n := *b - data := b.data - b.skip(length) // Will validate length. - n.data = data[:length] - return n -} - func (b *buf) Uint8() uint8 { if len(b.data) < 1 { b.error("underflow") @@ -72,34 +66,6 @@ func (b *buf) Uint8() uint8 { return val } -func (b *buf) bytes(n int) []byte { - if len(b.data) < n { - b.error("underflow") - return nil - } - data := b.data[0:n] - b.data = b.data[n:] - b.off += dwarf.Offset(n) - return data -} - -func (b *buf) skip(n int) { b.bytes(n) } - -// string returns the NUL-terminated (C-like) string at the start of the buffer. -// The terminal NUL is discarded. -func (b *buf) string() string { - for i := 0; i < len(b.data); i++ { - if b.data[i] == 0 { - s := string(b.data[0:i]) - b.data = b.data[i+1:] - b.off += dwarf.Offset(i + 1) - return s - } - } - b.error("underflow") - return "" -} - // Read a varint, which is 7 bits per byte, little endian. // the 0x80 bit means read another byte. func (b *buf) Varint() (c uint64, bits uint) { diff --git a/pkg/dwarf/util/util.go b/pkg/dwarf/util/util.go index 1cb036fa18..4e199cb26d 100644 --- a/pkg/dwarf/util/util.go +++ b/pkg/dwarf/util/util.go @@ -8,12 +8,20 @@ import ( "io" ) +// ByteReaderWithLen is a io.ByteReader with a Len method. This interface is +// satisified by both bytes.Buffer and bytes.Reader. +type ByteReaderWithLen interface { + io.ByteReader + io.Reader + Len() int +} + // The Little Endian Base 128 format is defined in the DWARF v4 standard, // section 7.6, page 161 and following. // DecodeULEB128 decodes an unsigned Little Endian Base 128 // represented number. -func DecodeULEB128(buf *bytes.Buffer) (uint64, uint32) { +func DecodeULEB128(buf ByteReaderWithLen) (uint64, uint32) { var ( result uint64 shift uint64 @@ -46,7 +54,7 @@ func DecodeULEB128(buf *bytes.Buffer) (uint64, uint32) { // DecodeSLEB128 decodes a signed Little Endian Base 128 // represented number. -func DecodeSLEB128(buf *bytes.Buffer) (int64, uint32) { +func DecodeSLEB128(buf ByteReaderWithLen) (int64, uint32) { var ( b byte err error @@ -119,18 +127,25 @@ func EncodeSLEB128(out io.ByteWriter, x int64) { } } -func ParseString(data *bytes.Buffer) (string, uint32) { +// ParseString reads a null-terminated string from data. +func ParseString(data *bytes.Buffer) (string, error) { str, err := data.ReadString(0x0) if err != nil { - panic("Could not parse string") + return "", err } - return str[:len(str)-1], uint32(len(str)) + return str[:len(str)-1], nil } // ReadUintRaw reads an integer of ptrSize bytes, with the specified byte order, from reader. func ReadUintRaw(reader io.Reader, order binary.ByteOrder, ptrSize int) (uint64, error) { switch ptrSize { + case 2: + var n uint16 + if err := binary.Read(reader, order, &n); err != nil { + return 0, err + } + return uint64(n), nil case 4: var n uint32 if err := binary.Read(reader, order, &n); err != nil { @@ -144,7 +159,7 @@ func ReadUintRaw(reader io.Reader, order binary.ByteOrder, ptrSize int) (uint64, } return n, nil } - return 0, fmt.Errorf("not supprted ptr size %d", ptrSize) + return 0, fmt.Errorf("pointer size %d not supported", ptrSize) } // WriteUint writes an integer of ptrSize bytes to writer, in the specified byte order. @@ -155,10 +170,10 @@ func WriteUint(writer io.Writer, order binary.ByteOrder, ptrSize int, data uint6 case 8: return binary.Write(writer, order, data) } - return fmt.Errorf("not support prt size %d", ptrSize) + return fmt.Errorf("pointer size %d not supported", ptrSize) } -// ReadDwarfLength reads a DWARF length field followed by a version field +// ReadDwarfLengthVersion reads a DWARF length field followed by a version field func ReadDwarfLengthVersion(data []byte) (length uint64, dwarf64 bool, version uint8, byteOrder binary.ByteOrder) { if len(data) < 4 { return 0, false, 0, binary.LittleEndian diff --git a/pkg/elfwriter/delve_core_notes.go b/pkg/elfwriter/delve_core_notes.go new file mode 100644 index 0000000000..15b82bcdf0 --- /dev/null +++ b/pkg/elfwriter/delve_core_notes.go @@ -0,0 +1,11 @@ +package elfwriter + +const ( + DelveHeaderNoteType = 0x444C5645 // DLVE + DelveThreadNodeType = 0x444C5654 // DLVT + + DelveHeaderTargetPidPrefix = "Target Pid: " + DelveHeaderEntryPointPrefix = "Entry Point: " +) + +//TODO(aarzilli): these constants probably need to be in a better place. diff --git a/pkg/elfwriter/writer.go b/pkg/elfwriter/writer.go new file mode 100644 index 0000000000..3876b260ee --- /dev/null +++ b/pkg/elfwriter/writer.go @@ -0,0 +1,183 @@ +// elfwriter is a package to write ELF files without having their entire +// contents in memory at any one time. +// This package is incomplete, only features needed to write core files are +// implemented, notably missing: +// - section headers +// - program headers at the beginning of the file + +package elfwriter + +import ( + "debug/elf" + "encoding/binary" + "io" +) + +// WriteCloserSeeker is the union of io.Writer, io.Closer and io.Seeker. +type WriteCloserSeeker interface { + io.Writer + io.Seeker + io.Closer +} + +// Writer writes ELF files. +type Writer struct { + w WriteCloserSeeker + Err error + Progs []*elf.ProgHeader + + seekProgHeader int64 + seekProgNum int64 +} + +type Note struct { + Type elf.NType + Name string + Data []byte +} + +// New creates a new Writer. +func New(w WriteCloserSeeker, fhdr *elf.FileHeader) *Writer { + const ( + ehsize = 64 + phentsize = 56 + ) + + if seek, _ := w.Seek(0, io.SeekCurrent); seek != 0 { + panic("can't write halfway through a file") + } + + r := &Writer{w: w} + + if fhdr.Class != elf.ELFCLASS64 { + panic("unsupported") + } + + if fhdr.Data != elf.ELFDATA2LSB { + panic("unsupported") + } + + // e_ident + r.Write([]byte{0x7f, 'E', 'L', 'F', byte(fhdr.Class), byte(fhdr.Data), byte(fhdr.Version), byte(fhdr.OSABI), byte(fhdr.ABIVersion), 0, 0, 0, 0, 0, 0, 0}) + + r.u16(uint16(fhdr.Type)) // e_type + r.u16(uint16(fhdr.Machine)) // e_machine + r.u32(uint32(fhdr.Version)) // e_version + r.u64(0) // e_entry + r.seekProgHeader = r.Here() + r.u64(0) // e_phoff + r.u64(0) // e_shoff + r.u32(0) // e_flags + r.u16(ehsize) // e_ehsize + r.u16(phentsize) // e_phentsize + r.seekProgNum = r.Here() + r.u16(0) // e_phnum + r.u16(0) // e_shentsize + r.u16(0) // e_shnum + r.u16(uint16(elf.SHN_UNDEF)) // e_shstrndx + + // Sanity check, size of file header should be the same as ehsize + if sz, _ := w.Seek(0, io.SeekCurrent); sz != ehsize { + panic("internal error, ELF header size") + } + + return r +} + +// WriteNotes writes notes to the current location, returns a ProgHeader describing the +// notes. +func (w *Writer) WriteNotes(notes []Note) *elf.ProgHeader { + if len(notes) == 0 { + return nil + } + h := &elf.ProgHeader{ + Type: elf.PT_NOTE, + Align: 4, + } + for i := range notes { + note := ¬es[i] + w.Align(4) + if h.Off == 0 { + h.Off = uint64(w.Here()) + } + w.u32(uint32(len(note.Name))) + w.u32(uint32(len(note.Data))) + w.u32(uint32(note.Type)) + w.Write([]byte(note.Name)) + w.Align(4) + w.Write(note.Data) + } + h.Filesz = uint64(w.Here()) - h.Off + return h +} + +// WriteProgramHeaders writes the program headers at the current location +// and patches the file header accordingly. +func (w *Writer) WriteProgramHeaders() { + phoff := w.Here() + + // Patch File Header + w.w.Seek(w.seekProgHeader, io.SeekStart) + w.u64(uint64(phoff)) + w.w.Seek(w.seekProgNum, io.SeekStart) + w.u64(uint64(len(w.Progs))) + w.w.Seek(0, io.SeekEnd) + + for _, prog := range w.Progs { + w.u32(uint32(prog.Type)) + w.u32(uint32(prog.Flags)) + w.u64(prog.Off) + w.u64(prog.Vaddr) + w.u64(prog.Paddr) + w.u64(prog.Filesz) + w.u64(prog.Memsz) + w.u64(prog.Align) + } +} + +// Here returns the current seek offset from the start of the file. +func (w *Writer) Here() int64 { + r, err := w.w.Seek(0, io.SeekCurrent) + if err != nil && w.Err == nil { + w.Err = err + } + return r +} + +// Align writes as many padding bytes as needed to make the current file +// offset a multiple of align. +func (w *Writer) Align(align int64) { + off := w.Here() + alignOff := (off + (align - 1)) &^ (align - 1) + if alignOff-off > 0 { + w.Write(make([]byte, alignOff-off)) + } +} + +func (w *Writer) Write(buf []byte) { + _, err := w.w.Write(buf) + if err != nil && w.Err == nil { + w.Err = err + } +} + +func (w *Writer) u16(n uint16) { + err := binary.Write(w.w, binary.LittleEndian, n) + if err != nil && w.Err == nil { + w.Err = err + } +} + +func (w *Writer) u32(n uint32) { + err := binary.Write(w.w, binary.LittleEndian, n) + if err != nil && w.Err == nil { + w.Err = err + } +} + +func (w *Writer) u64(n uint64) { + err := binary.Write(w.w, binary.LittleEndian, n) + if err != nil && w.Err == nil { + w.Err = err + } +} diff --git a/pkg/gobuild/gobuild.go b/pkg/gobuild/gobuild.go index fde64f80c6..bf57118093 100644 --- a/pkg/gobuild/gobuild.go +++ b/pkg/gobuild/gobuild.go @@ -6,6 +6,9 @@ import ( "fmt" "os" "os/exec" + "runtime" + "strings" + "time" "github.com/go-delve/delve/pkg/config" "github.com/go-delve/delve/pkg/goversion" @@ -14,7 +17,17 @@ import ( // Remove the file at path and issue a warning to stderr if this fails. // This can be used to remove the temporary binary generated for the session. func Remove(path string) { - err := os.Remove(path) + var err error + for i := 0; i < 20; i++ { + err = os.Remove(path) + // Open files can be removed on Unix, but not on Windows, where there also appears + // to be a delay in releasing the binary when the process exits. + // Leaving temporary files behind can be annoying to users, so we try again. + if err == nil || runtime.GOOS != "windows" { + break + } + time.Sleep(1 * time.Millisecond) + } if err != nil { fmt.Fprintf(os.Stderr, "could not remove %v: %v\n", path, err) } @@ -42,32 +55,60 @@ func optflags(args []string) []string { // GoBuild builds non-test files in 'pkgs' with the specified 'buildflags' // and writes the output at 'debugname'. func GoBuild(debugname string, pkgs []string, buildflags string) error { - args := []string{"-o", debugname} - args = optflags(args) - if buildflags != "" { - args = append(args, config.SplitQuotedFields(buildflags, '\'')...) - } - args = append(args, pkgs...) - return gocommand("build", args...) + args := goBuildArgs(debugname, pkgs, buildflags, false) + return gocommandRun("build", args...) +} + +// GoBuildCombinedOutput builds non-test files in 'pkgs' with the specified 'buildflags' +// and writes the output at 'debugname'. +func GoBuildCombinedOutput(debugname string, pkgs []string, buildflags string) (string, []byte, error) { + args := goBuildArgs(debugname, pkgs, buildflags, false) + return gocommandCombinedOutput("build", args...) } -// GoBuild builds test files 'pkgs' with the specified 'buildflags' +// GoTestBuild builds test files 'pkgs' with the specified 'buildflags' // and writes the output at 'debugname'. func GoTestBuild(debugname string, pkgs []string, buildflags string) error { - args := []string{"-c", "-o", debugname} + args := goBuildArgs(debugname, pkgs, buildflags, true) + return gocommandRun("test", args...) +} + +// GoTestBuildCombinedOutput builds test files 'pkgs' with the specified 'buildflags' +// and writes the output at 'debugname'. +func GoTestBuildCombinedOutput(debugname string, pkgs []string, buildflags string) (string, []byte, error) { + args := goBuildArgs(debugname, pkgs, buildflags, true) + return gocommandCombinedOutput("test", args...) +} + +func goBuildArgs(debugname string, pkgs []string, buildflags string, isTest bool) []string { + args := []string{"-o", debugname} + if isTest { + args = append([]string{"-c"}, args...) + } args = optflags(args) if buildflags != "" { args = append(args, config.SplitQuotedFields(buildflags, '\'')...) } args = append(args, pkgs...) - return gocommand("test", args...) + return args } -func gocommand(command string, args ...string) error { +func gocommandRun(command string, args ...string) error { + _, goBuild := gocommandExecCmd(command, args...) + goBuild.Stderr = os.Stdout + goBuild.Stdout = os.Stderr + return goBuild.Run() +} + +func gocommandCombinedOutput(command string, args ...string) (string, []byte, error) { + buildCmd, goBuild := gocommandExecCmd(command, args...) + out, err := goBuild.CombinedOutput() + return buildCmd, out, err +} + +func gocommandExecCmd(command string, args ...string) (string, *exec.Cmd) { allargs := []string{command} allargs = append(allargs, args...) goBuild := exec.Command("go", allargs...) - goBuild.Stderr = os.Stderr - goBuild.Stdout = os.Stdout - return goBuild.Run() + return strings.Join(append([]string{"go"}, allargs...), " "), goBuild } diff --git a/pkg/goversion/compat.go b/pkg/goversion/compat.go index d1502fee51..8366056463 100644 --- a/pkg/goversion/compat.go +++ b/pkg/goversion/compat.go @@ -2,29 +2,42 @@ package goversion import ( "fmt" + + "github.com/go-delve/delve/pkg/logflags" ) var ( MinSupportedVersionOfGoMajor = 1 - MinSupportedVersionOfGoMinor = 13 + MinSupportedVersionOfGoMinor = 16 MaxSupportedVersionOfGoMajor = 1 - MaxSupportedVersionOfGoMinor = 15 - goTooOldErr = fmt.Errorf("Version of Go is too old for this version of Delve (minimum supported version %d.%d, suppress this error with --check-go-version=false)", MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor) - dlvTooOldErr = fmt.Errorf("Version of Delve is too old for this version of Go (maximum supported version %d.%d, suppress this error with --check-go-version=false)", MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor) + MaxSupportedVersionOfGoMinor = 18 + goTooOldErr = fmt.Sprintf("Go version %%s is too old for this version of Delve (minimum supported version %d.%d, suppress this error with --check-go-version=false)", MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor) + goTooOldWarn = fmt.Sprintf("WARNING: undefined behavior - Go version %%s is too old for this version of Delve (minimum supported version %d.%d)", MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor) + dlvTooOldErr = fmt.Sprintf("Version of Delve is too old for Go version %%s (maximum supported version %d.%d, suppress this error with --check-go-version=false)", MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor) + dlvTooOldWarn = fmt.Sprintf("WARNING: undefined behavior - version of Delve is too old for Go version %%s (maximum supported version %d.%d)", MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor) ) // Compatible checks that the version specified in the producer string is compatible with // this version of delve. -func Compatible(producer string) error { - ver := parseProducer(producer) +func Compatible(producer string, warnonly bool) error { + ver := ParseProducer(producer) if ver.IsDevel() { return nil } + verstr := fmt.Sprintf("%d.%d.%d", ver.Major, ver.Minor, ver.Rev) if !ver.AfterOrEqual(GoVersion{MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor, -1, 0, 0, ""}) { - return goTooOldErr + if warnonly { + logflags.WriteError(fmt.Sprintf(goTooOldWarn, verstr)) + return nil + } + return fmt.Errorf(goTooOldErr, verstr) } if ver.AfterOrEqual(GoVersion{MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor + 1, -1, 0, 0, ""}) { - return dlvTooOldErr + if warnonly { + logflags.WriteError(fmt.Sprintf(dlvTooOldWarn, verstr)) + return nil + } + return fmt.Errorf(dlvTooOldErr, verstr) } return nil } diff --git a/pkg/goversion/go_version.go b/pkg/goversion/go_version.go index 5caf1b9bbf..b980ffac74 100644 --- a/pkg/goversion/go_version.go +++ b/pkg/goversion/go_version.go @@ -37,9 +37,14 @@ func Parse(ver string) (GoVersion, bool) { switch len(v) { case 2: r.Major, err1 = strconv.Atoi(v[0]) - vr := strings.SplitN(v[1], "beta", 2) - if len(vr) == 2 { + var vr []string + + if vr = strings.SplitN(v[1], "beta", 2); len(vr) == 2 { r.Beta, err3 = strconv.Atoi(vr[1]) + } else if vr = strings.SplitN(v[1], "b", 2); len(vr) == 2 { + if _, err := strconv.Atoi(vr[1]); err != nil { + return GoVersion{}, false + } } else { vr = strings.SplitN(v[1], "rc", 2) if len(vr) == 2 { @@ -67,7 +72,14 @@ func Parse(ver string) (GoVersion, bool) { r.Major, err1 = strconv.Atoi(v[0]) r.Minor, err2 = strconv.Atoi(v[1]) - r.Rev, err3 = strconv.Atoi(v[2]) + + vr := strings.SplitN(v[2], "b", 2) + if len(vr) == 2 { + r.Rev, err3 = strconv.Atoi(vr[0]) + } else { + r.Rev, err3 = strconv.Atoi(v[2]) + } + r.Proposal = "" if err1 != nil || err2 != nil || err3 != nil { return GoVersion{}, false @@ -155,11 +167,18 @@ func Installed() (GoVersion, bool) { // or go version) is major.minor or a later version, or a development // version. func VersionAfterOrEqual(version string, major, minor int) bool { + return VersionAfterOrEqualRev(version, major, minor, -1) +} + +// VersionAfterOrEqualRev checks that version (as returned by runtime.Version() +// or go version) is major.minor or a later version, or a development +// version. +func VersionAfterOrEqualRev(version string, major, minor, rev int) bool { ver, _ := Parse(version) if ver.IsDevel() { return true } - return ver.AfterOrEqual(GoVersion{major, minor, -1, 0, 0, ""}) + return ver.AfterOrEqual(GoVersion{major, minor, rev, 0, 0, ""}) } const producerVersionPrefix = "Go cmd/compile " @@ -167,17 +186,15 @@ const producerVersionPrefix = "Go cmd/compile " // ProducerAfterOrEqual checks that the DW_AT_producer version is // major.minor or a later version, or a development version. func ProducerAfterOrEqual(producer string, major, minor int) bool { - ver := parseProducer(producer) + ver := ParseProducer(producer) if ver.IsDevel() { return true } return ver.AfterOrEqual(GoVersion{major, minor, -1, 0, 0, ""}) } -func parseProducer(producer string) GoVersion { - if strings.HasPrefix(producer, producerVersionPrefix) { - producer = producer[len(producerVersionPrefix):] - } +func ParseProducer(producer string) GoVersion { + producer = strings.TrimPrefix(producer, producerVersionPrefix) ver, _ := Parse(producer) return ver } diff --git a/pkg/goversion/version_test.go b/pkg/goversion/version_test.go index 43c09eac18..dd67814141 100644 --- a/pkg/goversion/version_test.go +++ b/pkg/goversion/version_test.go @@ -24,6 +24,8 @@ func TestParseVersionString(t *testing.T) { versionAfterOrEqual(t, "go1.5rc2", GoVersion{1, 5, -1, 0, 2, ""}) versionAfterOrEqual(t, "go1.6.1 (appengine-1.9.37)", GoVersion{1, 6, 1, 0, 0, ""}) versionAfterOrEqual(t, "go1.8.1.typealias", GoVersion{1, 6, 1, 0, 0, ""}) + versionAfterOrEqual(t, "go1.8b1", GoVersion{1, 8, -1, 0, 0, ""}) + versionAfterOrEqual(t, "go1.16.4b7", GoVersion{1, 16, 4, 0, 0, ""}) ver, ok := Parse("devel +17efbfc Tue Jul 28 17:39:19 2015 +0000 linux/amd64") if !ok { t.Fatalf("Could not parse devel version string") diff --git a/pkg/locspec/doc.go b/pkg/locspec/doc.go index 5278ab158d..1f75ac03d7 100644 --- a/pkg/locspec/doc.go +++ b/pkg/locspec/doc.go @@ -3,13 +3,13 @@ // // Location spec examples: // -// locStr ::= : | [:] | // | (+|-) | | *
-// * can be the full path of a file or just a suffix -// * ::= .. | .(*). | . | . | (*). | -// * must be unambiguous -// * // will return a location for each function matched by regex -// * + returns a location for the line that is lines after the current line -// * - returns a location for the line that is lines before the current line -// * returns a location for a line in the current file -// * *
returns the location corresponding to the specified address +// locStr ::= : | [:] | // | (+|-) | | *
+// * can be the full path of a file or just a suffix +// * ::= .. | .(*). | . | . | (*). | +// must be unambiguous +// * // will return a location for each function matched by regex +// * + returns a location for the line that is lines after the current line +// * - returns a location for the line that is lines before the current line +// * returns a location for a line in the current file +// * *
returns the location corresponding to the specified address package locspec diff --git a/pkg/locspec/locations.go b/pkg/locspec/locations.go index decc892e4a..0ca6c19f4c 100644 --- a/pkg/locspec/locations.go +++ b/pkg/locspec/locations.go @@ -20,7 +20,7 @@ const maxFindLocationCandidates = 5 // LocationSpec is an interface that represents a parsed location spec string. type LocationSpec interface { // Find returns all locations that match the location spec. - Find(t *proc.Target, processArgs []string, scope *proc.EvalScope, locStr string, includeNonExecutableLines bool) ([]api.Location, error) + Find(t *proc.Target, processArgs []string, scope *proc.EvalScope, locStr string, includeNonExecutableLines bool, substitutePathRules [][2]string) ([]api.Location, error) } // NormalLocationSpec represents a basic location spec. @@ -68,6 +68,7 @@ func Parse(locStr string) (LocationSpec, error) { rest := locStr malformed := func(reason string) error { + //lint:ignore ST1005 backwards compatibility return fmt.Errorf("Malformed breakpoint location \"%s\" at %d: %s", locStr, len(locStr)-len(rest), reason) } @@ -107,6 +108,7 @@ func Parse(locStr string) (LocationSpec, error) { func parseLocationSpecDefault(locStr, rest string) (LocationSpec, error) { malformed := func(reason string) error { + //lint:ignore ST1005 backwards compatibility return fmt.Errorf("Malformed breakpoint location \"%s\" at %d: %s", locStr, len(locStr)-len(rest), reason) } @@ -230,7 +232,7 @@ func stripReceiverDecoration(in string) string { } // Match will return whether the provided function matches the location spec. -func (spec *FuncLocationSpec) Match(sym proc.Function, packageMap map[string][]string) bool { +func (spec *FuncLocationSpec) Match(sym *proc.Function, packageMap map[string][]string) bool { if spec.BaseName != sym.BaseName() { return false } @@ -267,7 +269,7 @@ func packageMatch(specPkg, symPkg string, packageMap map[string][]string) bool { // Find will search all functions in the target program and filter them via the // regex location spec. Only functions matching the regex will be returned. -func (loc *RegexLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, locStr string, includeNonExecutableLines bool) ([]api.Location, error) { +func (loc *RegexLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, locStr string, includeNonExecutableLines bool, _ [][2]string) ([]api.Location, error) { funcs := scope.BinInfo.Functions matches, err := regexFilterFuncs(loc.FuncRegex, funcs) if err != nil { @@ -284,7 +286,7 @@ func (loc *RegexLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalS } // Find returns the locations specified via the address location spec. -func (loc *AddrLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, locStr string, includeNonExecutableLines bool) ([]api.Location, error) { +func (loc *AddrLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, locStr string, includeNonExecutableLines bool, _ [][2]string) ([]api.Location, error) { if scope == nil { addr, err := strconv.ParseInt(loc.AddrExpr, 0, 64) if err != nil { @@ -365,12 +367,16 @@ func (ale AmbiguousLocationError) Error() string { // Find will return a list of locations that match the given location spec. // This matches each other location spec that does not already have its own spec // implemented (such as regex, or addr). -func (loc *NormalLocationSpec) Find(t *proc.Target, processArgs []string, scope *proc.EvalScope, locStr string, includeNonExecutableLines bool) ([]api.Location, error) { +func (loc *NormalLocationSpec) Find(t *proc.Target, processArgs []string, scope *proc.EvalScope, locStr string, includeNonExecutableLines bool, substitutePathRules [][2]string) ([]api.Location, error) { limit := maxFindLocationCandidates var candidateFiles []string - for _, file := range scope.BinInfo.Sources { - if loc.FileMatch(file) || (len(processArgs) >= 1 && tryMatchRelativePathByProc(loc.Base, processArgs[0], file)) { - candidateFiles = append(candidateFiles, file) + for _, sourceFile := range scope.BinInfo.Sources { + substFile := sourceFile + if len(substitutePathRules) > 0 { + substFile = SubstitutePath(sourceFile, substitutePathRules) + } + if loc.FileMatch(substFile) || (len(processArgs) >= 1 && tryMatchRelativePathByProc(loc.Base, processArgs[0], substFile)) { + candidateFiles = append(candidateFiles, sourceFile) if len(candidateFiles) >= limit { break } @@ -380,21 +386,8 @@ func (loc *NormalLocationSpec) Find(t *proc.Target, processArgs []string, scope limit -= len(candidateFiles) var candidateFuncs []string - if loc.FuncBase != nil { - for _, f := range scope.BinInfo.Functions { - if !loc.FuncBase.Match(f, scope.BinInfo.PackageMap) { - continue - } - if loc.Base == f.Name { - // if an exact match for the function name is found use it - candidateFuncs = []string{f.Name} - break - } - candidateFuncs = append(candidateFuncs, f.Name) - if len(candidateFuncs) >= limit { - break - } - } + if loc.FuncBase != nil && limit > 0 { + candidateFuncs = loc.findFuncCandidates(scope, limit) } if matching := len(candidateFiles) + len(candidateFuncs); matching == 0 { @@ -402,7 +395,7 @@ func (loc *NormalLocationSpec) Find(t *proc.Target, processArgs []string, scope // expression that the user forgot to prefix with '*', try treating it as // such. addrSpec := &AddrLocationSpec{AddrExpr: locStr} - locs, err := addrSpec.Find(t, processArgs, scope, locStr, includeNonExecutableLines) + locs, err := addrSpec.Find(t, processArgs, scope, locStr, includeNonExecutableLines, nil) if err != nil { return nil, fmt.Errorf("location \"%s\" not found", locStr) } @@ -416,6 +409,7 @@ func (loc *NormalLocationSpec) Find(t *proc.Target, processArgs []string, scope var err error if len(candidateFiles) == 1 { if loc.LineOffset < 0 { + //lint:ignore ST1005 backwards compatibility return nil, fmt.Errorf("Malformed breakpoint location, no line offset specified") } addrs, err = proc.FindFileLocation(t, candidateFiles[0], loc.LineOffset) @@ -434,6 +428,83 @@ func (loc *NormalLocationSpec) Find(t *proc.Target, processArgs []string, scope return []api.Location{addressesToLocation(addrs)}, nil } +func (loc *NormalLocationSpec) findFuncCandidates(scope *proc.EvalScope, limit int) []string { + candidateFuncs := map[string]struct{}{} + // See if it matches generic functions first + for fname := range scope.BinInfo.LookupGenericFunc() { + if len(candidateFuncs) >= limit { + break + } + if !loc.FuncBase.Match(&proc.Function{Name: fname}, scope.BinInfo.PackageMap) { + continue + } + if loc.Base == fname { + return []string{fname} + } + candidateFuncs[fname] = struct{}{} + } + for _, f := range scope.BinInfo.LookupFunc { + if len(candidateFuncs) >= limit { + break + } + if !loc.FuncBase.Match(f, scope.BinInfo.PackageMap) { + continue + } + if loc.Base == f.Name { + // if an exact match for the function name is found use it + return []string{f.Name} + } + // If f is an instantiation of a generic function see if we should add its generic version instead. + if gn := f.NameWithoutTypeParams(); gn != "" { + if _, alreadyAdded := candidateFuncs[gn]; !alreadyAdded { + candidateFuncs[f.Name] = struct{}{} + } + } else { + candidateFuncs[f.Name] = struct{}{} + } + } + // convert candidateFuncs map into an array of its keys + r := make([]string, 0, len(candidateFuncs)) + for s := range candidateFuncs { + r = append(r, s) + } + return r +} + +func crossPlatformPath(path string) string { + if runtime.GOOS == "windows" { + return strings.ToLower(path) + } + return path +} + +// SubstitutePath applies the specified path substitution rules to path. +func SubstitutePath(path string, rules [][2]string) string { + path = crossPlatformPath(path) + // On windows paths returned from headless server are as c:/dir/dir + // though os.PathSeparator is '\\' + + separator := "/" //make it default + if strings.Contains(path, "\\") { //dependent on the path + separator = "\\" + } + for _, r := range rules { + from := crossPlatformPath(r[0]) + to := r[1] + + if !strings.HasSuffix(from, separator) { + from = from + separator + } + if !strings.HasSuffix(to, separator) { + to = to + separator + } + if strings.HasPrefix(path, from) { + return strings.Replace(path, from, to, 1) + } + } + return path +} + func addressesToLocation(addrs []uint64) api.Location { if len(addrs) <= 0 { return api.Location{} @@ -442,7 +513,7 @@ func addressesToLocation(addrs []uint64) api.Location { } // Find returns the location after adding the offset amount to the current line number. -func (loc *OffsetLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, _ string, includeNonExecutableLines bool) ([]api.Location, error) { +func (loc *OffsetLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, _ string, includeNonExecutableLines bool, _ [][2]string) ([]api.Location, error) { if scope == nil { return nil, fmt.Errorf("could not determine current location (scope is nil)") } @@ -463,7 +534,7 @@ func (loc *OffsetLocationSpec) Find(t *proc.Target, _ []string, scope *proc.Eval } // Find will return the location at the given line in the current file. -func (loc *LineLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, _ string, includeNonExecutableLines bool) ([]api.Location, error) { +func (loc *LineLocationSpec) Find(t *proc.Target, _ []string, scope *proc.EvalScope, _ string, includeNonExecutableLines bool, _ [][2]string) ([]api.Location, error) { if scope == nil { return nil, fmt.Errorf("could not determine current location (scope is nil)") } diff --git a/pkg/logflags/logflags.go b/pkg/logflags/logflags.go index a066bed872..430cd566b1 100644 --- a/pkg/logflags/logflags.go +++ b/pkg/logflags/logflags.go @@ -7,6 +7,7 @@ import ( "io" "io/ioutil" "log" + "net" "os" "sort" "strconv" @@ -16,6 +17,7 @@ import ( "github.com/sirupsen/logrus" ) +var any = false var debugger = false var gdbWire = false var lldbServerOutput = false @@ -40,6 +42,11 @@ func makeLogger(flag bool, fields logrus.Fields) *logrus.Entry { return logger } +// Any returns true if any logging is enabled. +func Any() bool { + return any +} + // GdbWire returns true if the gdbserial package should log all the packets // exchanged with the stub. func GdbWire() bool { @@ -112,22 +119,37 @@ func MinidumpLogger() *logrus.Entry { } // WriteDAPListeningMessage writes the "DAP server listening" message in dap mode. -func WriteDAPListeningMessage(addr string) { +func WriteDAPListeningMessage(addr net.Addr) { writeListeningMessage("DAP", addr) } // WriteAPIListeningMessage writes the "API server listening" message in headless mode. -func WriteAPIListeningMessage(addr string) { +func WriteAPIListeningMessage(addr net.Addr) { writeListeningMessage("API", addr) } -func writeListeningMessage(server string, addr string) { - msg := fmt.Sprintf("%s server listening at: %s", server, addr) +func writeListeningMessage(server string, addr net.Addr) { + msg := fmt.Sprintf("%s server listening at: %s", server, addr) if logOut != nil { fmt.Fprintln(logOut, msg) } else { fmt.Println(msg) } + tcpAddr, _ := addr.(*net.TCPAddr) + if tcpAddr == nil || tcpAddr.IP.IsLoopback() { + return + } + logger := RPCLogger() + logger.Logger.Level = logrus.WarnLevel + logger.Warnln("Listening for remote connections (connections are not authenticated nor encrypted)") +} + +func WriteError(msg string) { + if logOut != nil { + fmt.Fprintln(logOut, msg) + } else { + fmt.Fprintln(os.Stderr, msg) + } } var errLogstrWithoutLog = errors.New("--log-output specified without --log") @@ -135,7 +157,7 @@ var errLogstrWithoutLog = errors.New("--log-output specified without --log") // Setup sets debugger flags based on the contents of logstr. // If logDest is not empty logs will be redirected to the file descriptor or // file path specified by logDest. -func Setup(logFlag bool, logstr string, logDest string) error { +func Setup(logFlag bool, logstr, logDest string) error { if logDest != "" { n, err := strconv.Atoi(logDest) if err == nil { @@ -159,6 +181,7 @@ func Setup(logFlag bool, logstr string, logDest string) error { if logstr == "" { logstr = "debugger" } + any = true v := strings.Split(logstr, ",") for _, logcmd := range v { // If adding another value, do make sure to diff --git a/pkg/proc/amd64_arch.go b/pkg/proc/amd64_arch.go index 5ac810246d..c8bccdffb2 100644 --- a/pkg/proc/amd64_arch.go +++ b/pkg/proc/amd64_arch.go @@ -10,12 +10,7 @@ import ( "github.com/go-delve/delve/pkg/dwarf/frame" "github.com/go-delve/delve/pkg/dwarf/op" -) - -const ( - amd64DwarfIPRegNum uint64 = 16 - amd64DwarfSPRegNum uint64 = 7 - amd64DwarfBPRegNum uint64 = 6 + "github.com/go-delve/delve/pkg/dwarf/regnum" ) var amd64BreakInstruction = []byte{0xCC} @@ -39,6 +34,12 @@ func AMD64Arch(goos string) *Arch { DwarfRegisterToString: amd64DwarfRegisterToString, inhibitStepInto: func(*BinaryInfo, uint64) bool { return false }, asmDecode: amd64AsmDecode, + PCRegNum: regnum.AMD64_Rip, + SPRegNum: regnum.AMD64_Rsp, + BPRegNum: regnum.AMD64_Rbp, + ContextRegNum: regnum.AMD64_Rdx, + asmRegisters: amd64AsmRegisters, + RegisterNameToDwarf: nameToDwarfFunc(regnum.AMD64NameToDwarf), } } @@ -68,24 +69,24 @@ func amd64FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *Binary // here). return &frame.FrameContext{ - RetAddrReg: amd64DwarfIPRegNum, + RetAddrReg: regnum.AMD64_Rip, Regs: map[uint64]frame.DWRule{ - amd64DwarfIPRegNum: { + regnum.AMD64_Rip: { Rule: frame.RuleOffset, Offset: int64(-a.PtrSize()), }, - amd64DwarfBPRegNum: { + regnum.AMD64_Rbp: { Rule: frame.RuleOffset, Offset: int64(-2 * a.PtrSize()), }, - amd64DwarfSPRegNum: { + regnum.AMD64_Rsp: { Rule: frame.RuleValOffset, Offset: 0, }, }, CFA: frame.DWRule{ Rule: frame.RuleCFA, - Reg: amd64DwarfBPRegNum, + Reg: regnum.AMD64_Rbp, Offset: int64(2 * a.PtrSize()), }, } @@ -112,10 +113,10 @@ func amd64FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *Binary // so that we can use it to unwind the stack even when we encounter frames // without descriptor entries. // If there isn't a rule already we emit one. - if fctxt.Regs[amd64DwarfBPRegNum].Rule == frame.RuleUndefined { - fctxt.Regs[amd64DwarfBPRegNum] = frame.DWRule{ + if fctxt.Regs[regnum.AMD64_Rbp].Rule == frame.RuleUndefined { + fctxt.Regs[regnum.AMD64_Rbp] = frame.DWRule{ Rule: frame.RuleFramePointer, - Reg: amd64DwarfBPRegNum, + Reg: regnum.AMD64_Rbp, Offset: 0, } } @@ -130,6 +131,10 @@ const amd64cgocallSPOffsetSaveSlot = 0x28 func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { if it.frame.Current.Fn == nil { + if it.systemstack && it.g != nil && it.top { + it.switchToGoroutineStack() + return true + } return false } switch it.frame.Current.Fn.Name { @@ -142,7 +147,7 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { // switches from the goroutine stack to the system stack. // Since we are unwinding the stack from callee to caller we have to switch // from the system stack to the goroutine stack. - off, _ := readIntRaw(it.mem, uintptr(it.regs.SP()+amd64cgocallSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize())) // reads "offset of SP from StackHi" from where runtime.asmcgocall saved it + off, _ := readIntRaw(it.mem, uint64(it.regs.SP()+amd64cgocallSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize())) // reads "offset of SP from StackHi" from where runtime.asmcgocall saved it oldsp := it.regs.SP() it.regs.Reg(it.regs.SPRegNum).Uint64Val = uint64(int64(it.stackhi) - off) @@ -155,13 +160,13 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { // advances to the next frame in the call stack it.frame.addrret = uint64(int64(it.regs.SP()) + int64(it.bi.Arch.PtrSize())) - it.frame.Ret, _ = readUintRaw(it.mem, uintptr(it.frame.addrret), int64(it.bi.Arch.PtrSize())) + it.frame.Ret, _ = readUintRaw(it.mem, it.frame.addrret, int64(it.bi.Arch.PtrSize())) it.pc = it.frame.Ret it.top = false return true - case "runtime.cgocallback_gofunc": + case "runtime.cgocallback_gofunc", "runtime.cgocallback": // For a detailed description of how this works read the long comment at // the start of $GOROOT/src/runtime/cgocall.go and the source code of // runtime.cgocallback_gofunc in $GOROOT/src/runtime/asm_amd64.s @@ -183,7 +188,7 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { // entering the system stack it.regs.Reg(it.regs.SPRegNum).Uint64Val = it.g0_sched_sp // reads the previous value of g0.sched.sp that runtime.cgocallback_gofunc saved on the stack - it.g0_sched_sp, _ = readUintRaw(it.mem, uintptr(it.regs.SP()), int64(it.bi.Arch.PtrSize())) + it.g0_sched_sp, _ = readUintRaw(it.mem, uint64(it.regs.SP()), int64(it.bi.Arch.PtrSize())) it.top = false callFrameRegs, ret, retaddr := it.advanceRegs() frameOnSystemStack := it.newStackframe(ret, retaddr) @@ -218,7 +223,7 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { return true default: - if it.systemstack && it.top && it.g != nil && strings.HasPrefix(it.frame.Current.Fn.Name, "runtime.") && it.frame.Current.Fn.Name != "runtime.fatalthrow" { + if it.systemstack && it.top && it.g != nil && strings.HasPrefix(it.frame.Current.Fn.Name, "runtime.") && it.frame.Current.Fn.Name != "runtime.throw" && it.frame.Current.Fn.Name != "runtime.fatalthrow" { // The runtime switches to the system stack in multiple places. // This usually happens through a call to runtime.systemstack but there // are functions that switch to the system stack manually (for example @@ -227,7 +232,7 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { // calls we switch directly to the goroutine stack if we detect that the // function at the top of the stack is a runtime function. // - // The function "runtime.fatalthrow" is deliberately excluded from this + // The function "runtime.throw" is deliberately excluded from this // because it can end up in the stack during a cgo call and switching to // the goroutine stack will exclude all the C functions from the stack // trace. @@ -244,111 +249,23 @@ func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { // in the System V ABI AMD64 Architecture Processor Supplement page 57, // figure 3.36 // https://www.uclibc.org/docs/psABI-x86_64.pdf -func amd64RegSize(regnum uint64) int { +func amd64RegSize(rn uint64) int { // XMM registers - if regnum > amd64DwarfIPRegNum && regnum <= 32 { + if rn > regnum.AMD64_Rip && rn <= 32 { return 16 } // x87 registers - if regnum >= 33 && regnum <= 40 { + if rn >= 33 && rn <= 40 { return 10 } return 8 } -// The mapping between hardware registers and DWARF registers is specified -// in the System V ABI AMD64 Architecture Processor Supplement page 57, -// figure 3.36 -// https://www.uclibc.org/docs/psABI-x86_64.pdf - -var amd64DwarfToName = map[int]string{ - 0: "Rax", - 1: "Rdx", - 2: "Rcx", - 3: "Rbx", - 4: "Rsi", - 5: "Rdi", - 6: "Rbp", - 7: "Rsp", - 8: "R8", - 9: "R9", - 10: "R10", - 11: "R11", - 12: "R12", - 13: "R13", - 14: "R14", - 15: "R15", - 16: "Rip", - 17: "XMM0", - 18: "XMM1", - 19: "XMM2", - 20: "XMM3", - 21: "XMM4", - 22: "XMM5", - 23: "XMM6", - 24: "XMM7", - 25: "XMM8", - 26: "XMM9", - 27: "XMM10", - 28: "XMM11", - 29: "XMM12", - 30: "XMM13", - 31: "XMM14", - 32: "XMM15", - 33: "ST(0)", - 34: "ST(1)", - 35: "ST(2)", - 36: "ST(3)", - 37: "ST(4)", - 38: "ST(5)", - 39: "ST(6)", - 40: "ST(7)", - 49: "Rflags", - 50: "Es", - 51: "Cs", - 52: "Ss", - 53: "Ds", - 54: "Fs", - 55: "Gs", - 58: "Fs_base", - 59: "Gs_base", - 64: "MXCSR", - 65: "CW", - 66: "SW", -} - -var amd64NameToDwarf = func() map[string]int { - r := make(map[string]int) - for regNum, regName := range amd64DwarfToName { - r[strings.ToLower(regName)] = regNum - } - r["eflags"] = 49 - r["st0"] = 33 - r["st1"] = 34 - r["st2"] = 35 - r["st3"] = 36 - r["st4"] = 37 - r["st5"] = 38 - r["st6"] = 39 - r["st7"] = 40 - return r -}() - -func maxAmd64DwarfRegister() int { - max := int(amd64DwarfIPRegNum) - for i := range amd64DwarfToName { - if i > max { - max = i - } - } - return max -} - -func amd64RegistersToDwarfRegisters(staticBase uint64, regs Registers) op.DwarfRegisters { - dregs := initDwarfRegistersFromSlice(maxAmd64DwarfRegister(), regs, amd64NameToDwarf) - dr := op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, amd64DwarfIPRegNum, amd64DwarfSPRegNum, amd64DwarfBPRegNum, 0) - dr.SetLoadMoreCallback(loadMoreDwarfRegistersFromSliceFunc(dr, regs, amd64NameToDwarf)) - return *dr +func amd64RegistersToDwarfRegisters(staticBase uint64, regs Registers) *op.DwarfRegisters { + dregs := initDwarfRegistersFromSlice(int(regnum.AMD64MaxRegNum()), regs, regnum.AMD64NameToDwarf) + dr := op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, regnum.AMD64_Rip, regnum.AMD64_Rsp, regnum.AMD64_Rbp, 0) + dr.SetLoadMoreCallback(loadMoreDwarfRegistersFromSliceFunc(dr, regs, regnum.AMD64NameToDwarf)) + return dr } func initDwarfRegistersFromSlice(maxRegs int, regs Registers, nameToDwarf map[string]int) []*op.DwarfRegister { @@ -389,18 +306,19 @@ func loadMoreDwarfRegistersFromSliceFunc(dr *op.DwarfRegisters, regs Registers, } func amd64AddrAndStackRegsToDwarfRegisters(staticBase, pc, sp, bp, lr uint64) op.DwarfRegisters { - dregs := make([]*op.DwarfRegister, amd64DwarfIPRegNum+1) - dregs[amd64DwarfIPRegNum] = op.DwarfRegisterFromUint64(pc) - dregs[amd64DwarfSPRegNum] = op.DwarfRegisterFromUint64(sp) - dregs[amd64DwarfBPRegNum] = op.DwarfRegisterFromUint64(bp) + dregs := make([]*op.DwarfRegister, regnum.AMD64_Rip+1) + dregs[regnum.AMD64_Rip] = op.DwarfRegisterFromUint64(pc) + dregs[regnum.AMD64_Rsp] = op.DwarfRegisterFromUint64(sp) + dregs[regnum.AMD64_Rbp] = op.DwarfRegisterFromUint64(bp) - return *op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, amd64DwarfIPRegNum, amd64DwarfSPRegNum, amd64DwarfBPRegNum, 0) + return *op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, regnum.AMD64_Rip, regnum.AMD64_Rsp, regnum.AMD64_Rbp, 0) } func amd64DwarfRegisterToString(i int, reg *op.DwarfRegister) (name string, floatingPoint bool, repr string) { - name, ok := amd64DwarfToName[i] - if !ok { - name = fmt.Sprintf("unknown%d", i) + name = regnum.AMD64ToName(uint64(i)) + + if reg == nil { + return name, false, "" } switch n := strings.ToLower(name); n { diff --git a/pkg/proc/amd64_disasm.go b/pkg/proc/amd64_disasm.go index cbacd72695..be855e19c8 100644 --- a/pkg/proc/amd64_disasm.go +++ b/pkg/proc/amd64_disasm.go @@ -5,10 +5,13 @@ package proc import ( + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" + "golang.org/x/arch/x86/x86asm" ) -func amd64AsmDecode(asmInst *AsmInstruction, mem []byte, regs Registers, memrw MemoryReadWriter, bi *BinaryInfo) error { +func amd64AsmDecode(asmInst *AsmInstruction, mem []byte, regs *op.DwarfRegisters, memrw MemoryReadWriter, bi *BinaryInfo) error { return x86AsmDecode(asmInst, mem, regs, memrw, bi, 64) } @@ -36,3 +39,81 @@ func init() { } } } + +var amd64AsmRegisters = map[int]asmRegister{ + // 8-bit + int(x86asm.AL): asmRegister{regnum.AMD64_Rax, 0, mask8}, + int(x86asm.CL): asmRegister{regnum.AMD64_Rcx, 0, mask8}, + int(x86asm.DL): asmRegister{regnum.AMD64_Rdx, 0, mask8}, + int(x86asm.BL): asmRegister{regnum.AMD64_Rbx, 0, mask8}, + int(x86asm.AH): asmRegister{regnum.AMD64_Rax, 8, mask8}, + int(x86asm.CH): asmRegister{regnum.AMD64_Rcx, 8, mask8}, + int(x86asm.DH): asmRegister{regnum.AMD64_Rdx, 8, mask8}, + int(x86asm.BH): asmRegister{regnum.AMD64_Rbx, 8, mask8}, + int(x86asm.SPB): asmRegister{regnum.AMD64_Rsp, 0, mask8}, + int(x86asm.BPB): asmRegister{regnum.AMD64_Rbp, 0, mask8}, + int(x86asm.SIB): asmRegister{regnum.AMD64_Rsi, 0, mask8}, + int(x86asm.DIB): asmRegister{regnum.AMD64_Rdi, 0, mask8}, + int(x86asm.R8B): asmRegister{regnum.AMD64_R8, 0, mask8}, + int(x86asm.R9B): asmRegister{regnum.AMD64_R9, 0, mask8}, + int(x86asm.R10B): asmRegister{regnum.AMD64_R10, 0, mask8}, + int(x86asm.R11B): asmRegister{regnum.AMD64_R11, 0, mask8}, + int(x86asm.R12B): asmRegister{regnum.AMD64_R12, 0, mask8}, + int(x86asm.R13B): asmRegister{regnum.AMD64_R13, 0, mask8}, + int(x86asm.R14B): asmRegister{regnum.AMD64_R14, 0, mask8}, + int(x86asm.R15B): asmRegister{regnum.AMD64_R15, 0, mask8}, + + // 16-bit + int(x86asm.AX): asmRegister{regnum.AMD64_Rax, 0, mask16}, + int(x86asm.CX): asmRegister{regnum.AMD64_Rcx, 0, mask16}, + int(x86asm.DX): asmRegister{regnum.AMD64_Rdx, 0, mask16}, + int(x86asm.BX): asmRegister{regnum.AMD64_Rbx, 0, mask16}, + int(x86asm.SP): asmRegister{regnum.AMD64_Rsp, 0, mask16}, + int(x86asm.BP): asmRegister{regnum.AMD64_Rbp, 0, mask16}, + int(x86asm.SI): asmRegister{regnum.AMD64_Rsi, 0, mask16}, + int(x86asm.DI): asmRegister{regnum.AMD64_Rdi, 0, mask16}, + int(x86asm.R8W): asmRegister{regnum.AMD64_R8, 0, mask16}, + int(x86asm.R9W): asmRegister{regnum.AMD64_R9, 0, mask16}, + int(x86asm.R10W): asmRegister{regnum.AMD64_R10, 0, mask16}, + int(x86asm.R11W): asmRegister{regnum.AMD64_R11, 0, mask16}, + int(x86asm.R12W): asmRegister{regnum.AMD64_R12, 0, mask16}, + int(x86asm.R13W): asmRegister{regnum.AMD64_R13, 0, mask16}, + int(x86asm.R14W): asmRegister{regnum.AMD64_R14, 0, mask16}, + int(x86asm.R15W): asmRegister{regnum.AMD64_R15, 0, mask16}, + + // 32-bit + int(x86asm.EAX): asmRegister{regnum.AMD64_Rax, 0, mask32}, + int(x86asm.ECX): asmRegister{regnum.AMD64_Rcx, 0, mask32}, + int(x86asm.EDX): asmRegister{regnum.AMD64_Rdx, 0, mask32}, + int(x86asm.EBX): asmRegister{regnum.AMD64_Rbx, 0, mask32}, + int(x86asm.ESP): asmRegister{regnum.AMD64_Rsp, 0, mask32}, + int(x86asm.EBP): asmRegister{regnum.AMD64_Rbp, 0, mask32}, + int(x86asm.ESI): asmRegister{regnum.AMD64_Rsi, 0, mask32}, + int(x86asm.EDI): asmRegister{regnum.AMD64_Rdi, 0, mask32}, + int(x86asm.R8L): asmRegister{regnum.AMD64_R8, 0, mask32}, + int(x86asm.R9L): asmRegister{regnum.AMD64_R9, 0, mask32}, + int(x86asm.R10L): asmRegister{regnum.AMD64_R10, 0, mask32}, + int(x86asm.R11L): asmRegister{regnum.AMD64_R11, 0, mask32}, + int(x86asm.R12L): asmRegister{regnum.AMD64_R12, 0, mask32}, + int(x86asm.R13L): asmRegister{regnum.AMD64_R13, 0, mask32}, + int(x86asm.R14L): asmRegister{regnum.AMD64_R14, 0, mask32}, + int(x86asm.R15L): asmRegister{regnum.AMD64_R15, 0, mask32}, + + // 64-bit + int(x86asm.RAX): asmRegister{regnum.AMD64_Rax, 0, 0}, + int(x86asm.RCX): asmRegister{regnum.AMD64_Rcx, 0, 0}, + int(x86asm.RDX): asmRegister{regnum.AMD64_Rdx, 0, 0}, + int(x86asm.RBX): asmRegister{regnum.AMD64_Rbx, 0, 0}, + int(x86asm.RSP): asmRegister{regnum.AMD64_Rsp, 0, 0}, + int(x86asm.RBP): asmRegister{regnum.AMD64_Rbp, 0, 0}, + int(x86asm.RSI): asmRegister{regnum.AMD64_Rsi, 0, 0}, + int(x86asm.RDI): asmRegister{regnum.AMD64_Rdi, 0, 0}, + int(x86asm.R8): asmRegister{regnum.AMD64_R8, 0, 0}, + int(x86asm.R9): asmRegister{regnum.AMD64_R9, 0, 0}, + int(x86asm.R10): asmRegister{regnum.AMD64_R10, 0, 0}, + int(x86asm.R11): asmRegister{regnum.AMD64_R11, 0, 0}, + int(x86asm.R12): asmRegister{regnum.AMD64_R12, 0, 0}, + int(x86asm.R13): asmRegister{regnum.AMD64_R13, 0, 0}, + int(x86asm.R14): asmRegister{regnum.AMD64_R14, 0, 0}, + int(x86asm.R15): asmRegister{regnum.AMD64_R15, 0, 0}, +} diff --git a/pkg/proc/amd64util/debugregs.go b/pkg/proc/amd64util/debugregs.go new file mode 100644 index 0000000000..23de122bbb --- /dev/null +++ b/pkg/proc/amd64util/debugregs.go @@ -0,0 +1,130 @@ +package amd64util + +import ( + "errors" + "fmt" +) + +// DebugRegisters represents x86 debug registers described in the Intel 64 +// and IA-32 Architectures Software Developer's Manual, Vol. 3B, section +// 17.2 +type DebugRegisters struct { + pAddrs [4]*uint64 + pDR6, pDR7 *uint64 + Dirty bool +} + +func NewDebugRegisters(pDR0, pDR1, pDR2, pDR3, pDR6, pDR7 *uint64) *DebugRegisters { + return &DebugRegisters{ + pAddrs: [4]*uint64{pDR0, pDR1, pDR2, pDR3}, + pDR6: pDR6, + pDR7: pDR7, + Dirty: false, + } +} + +func lenrwBitsOffset(idx uint8) uint8 { + return 16 + idx*4 +} + +func enableBitOffset(idx uint8) uint8 { + return idx * 2 +} + +func (drs *DebugRegisters) breakpoint(idx uint8) (addr uint64, read, write bool, sz int) { + enable := *(drs.pDR7) & (1 << enableBitOffset(idx)) + if enable == 0 { + return 0, false, false, 0 + } + + addr = *(drs.pAddrs[idx]) + lenrw := (*(drs.pDR7) >> lenrwBitsOffset(idx)) & 0xf + write = (lenrw & 0x1) != 0 + read = (lenrw & 0x2) != 0 + switch lenrw >> 2 { + case 0x0: + sz = 1 + case 0x1: + sz = 2 + case 0x2: + sz = 8 // sic + case 0x3: + sz = 4 + } + return addr, read, write, sz +} + +// SetBreakpoint sets hardware breakpoint at index 'idx' to the specified +// address, read/write flags and size. +// If the breakpoint is already in use but the parameters match it does +// nothing. +func (drs *DebugRegisters) SetBreakpoint(idx uint8, addr uint64, read, write bool, sz int) error { + if int(idx) >= len(drs.pAddrs) { + return fmt.Errorf("hardware breakpoints exhausted") + } + curaddr, curread, curwrite, cursz := drs.breakpoint(idx) + if curaddr != 0 { + if (curaddr != addr) || (curread != read) || (curwrite != write) || (cursz != sz) { + return fmt.Errorf("hardware breakpoint %d already in use (address %#x)", idx, curaddr) + } + // hardware breakpoint already set + return nil + } + + if read && !write { + return errors.New("break on read only not supported") + } + + *(drs.pAddrs[idx]) = addr + var lenrw uint64 + if write { + lenrw |= 0x1 + } + if read { + lenrw |= 0x2 + } + switch sz { + case 1: + // already ok + case 2: + lenrw |= 0x1 << 2 + case 4: + lenrw |= 0x3 << 2 + case 8: + lenrw |= 0x2 << 2 + default: + return fmt.Errorf("data breakpoint of size %d not supported", sz) + } + *(drs.pDR7) &^= (0xf << lenrwBitsOffset(idx)) // clear old settings + *(drs.pDR7) |= lenrw << lenrwBitsOffset(idx) + *(drs.pDR7) |= 1 << enableBitOffset(idx) // enable + drs.Dirty = true + return nil +} + +// ClearBreakpoint disables the hardware breakpoint at index 'idx'. If the +// breakpoint was already disabled it does nothing. +func (drs *DebugRegisters) ClearBreakpoint(idx uint8) { + if *(drs.pDR7)&(1<= len(xstateargs) { + return nil + } + if readLegacy { + rdr := bytes.NewReader(xstateargs[:_XSAVE_HEADER_START]) + if err := binary.Read(rdr, binary.LittleEndian, ®set.AMD64PtraceFpRegs); err != nil { + return err + } + } + xsaveheader := xstateargs[_XSAVE_HEADER_START : _XSAVE_HEADER_START+_XSAVE_HEADER_LEN] + xstate_bv := binary.LittleEndian.Uint64(xsaveheader[0:8]) + xcomp_bv := binary.LittleEndian.Uint64(xsaveheader[8:16]) + + if xcomp_bv&(1<<63) != 0 { + // compact format not supported + return nil + } + + if xstate_bv&(1<<2) == 0 { + // AVX state not present + return nil + } + + avxstate := xstateargs[_XSAVE_EXTENDED_REGION_START:] + regset.AvxState = true + copy(regset.YmmSpace[:], avxstate[:len(regset.YmmSpace)]) + + if xstate_bv&(1<<6) == 0 { + // AVX512 state not present + return nil + } + + avx512state := xstateargs[_XSAVE_AVX512_ZMM_REGION_START:] + regset.Avx512State = true + copy(regset.ZmmSpace[:], avx512state[:len(regset.ZmmSpace)]) + + // TODO(aarzilli): if xstate_bv&(1<<7) is set then xstateargs[1664:2688] + // contains ZMM16 through ZMM31, those aren't just the higher 256bits, it's + // the full register so each is 64 bytes (512bits) + + return nil +} + +func (xstate *AMD64Xstate) SetXmmRegister(n int, value []byte) error { + if n >= 16 { + return fmt.Errorf("setting register XMM%d not supported", n) + } + if len(value) > 64 { + return fmt.Errorf("value of register XMM%d too large (%d bytes)", n, len(value)) + } + + // Copy least significant 16 bytes to Xsave area + + xmmval := value + if len(xmmval) > 16 { + xmmval = xmmval[:16] + } + rest := value[len(xmmval):] + + xmmpos := _XSAVE_XMM_REGION_START + (n * 16) + if xmmpos >= len(xstate.Xsave) { + return fmt.Errorf("could not set XMM%d: not in XSAVE area", n) + } + + copy(xstate.Xsave[xmmpos:], xmmval) + + if len(rest) == 0 { + return nil + } + + // Copy bytes [16, 32) to Xsave area + + ymmval := rest + if len(ymmval) > 16 { + ymmval = ymmval[:16] + } + rest = rest[len(ymmval):] + + ymmpos := _XSAVE_EXTENDED_REGION_START + (n * 16) + if ymmpos >= len(xstate.Xsave) { + return fmt.Errorf("could not set XMM%d: bytes 16..%d not in XSAVE area", n, 16+len(ymmval)) + } + + copy(xstate.Xsave[ymmpos:], ymmval) + + if len(rest) == 0 { + return nil + } + + // Copy bytes [32, 64) to Xsave area + + zmmval := rest + zmmpos := _XSAVE_AVX512_ZMM_REGION_START + (n * 32) + if zmmpos >= len(xstate.Xsave) { + return fmt.Errorf("could not set XMM%d: bytes 32..%d not in XSAVE area", n, 32+len(zmmval)) + } + + copy(xstate.Xsave[zmmpos:], zmmval) + return nil +} diff --git a/pkg/proc/amd64util/xsave_amd64.go b/pkg/proc/amd64util/xsave_amd64.go new file mode 100644 index 0000000000..539914d9cf --- /dev/null +++ b/pkg/proc/amd64util/xsave_amd64.go @@ -0,0 +1,30 @@ +package amd64util + +import ( + "sync" +) + +var xstateMaxSize int +var loadXstateMaxSizeOnce sync.Once + +func cpuid(axIn, cxIn uint32) (axOut, bxOut, cxOut, dxOut uint32) + +func AMD64XstateMaxSize() int { + loadXstateMaxSizeOnce.Do(func() { + // See Intel 64 and IA-32 Architecture Software Developer's Manual, Vol. 1 + // chapter 13.2 and Vol. 2A CPUID instruction for a description of all the + // magic constants. + + _, _, cx, _ := cpuid(0x01, 0x00) + + if cx&(1<<26) == 0 { // Vol. 2A, Table 3-10, XSAVE enabled bit check + // XSAVE not supported by this processor + xstateMaxSize = _XSTATE_MAX_KNOWN_SIZE + return + } + + _, _, cx, _ = cpuid(0x0d, 0x00) // processor extended state enumeration main leaf + xstateMaxSize = int(cx) + }) + return xstateMaxSize +} diff --git a/pkg/proc/amd64util/xsave_amd64.s b/pkg/proc/amd64util/xsave_amd64.s new file mode 100644 index 0000000000..130e374554 --- /dev/null +++ b/pkg/proc/amd64util/xsave_amd64.s @@ -0,0 +1,9 @@ +TEXT ·cpuid(SB),$0-24 + MOVL axIn+0(FP), AX + MOVL cxIn+4(FP), CX + CPUID + MOVL AX, axOut+8(FP) + MOVL BX, bxOut+12(FP) + MOVL CX, cxOut+16(FP) + MOVL DX, dxOut+20(FP) + RET diff --git a/pkg/proc/amd64util/xsave_other.go b/pkg/proc/amd64util/xsave_other.go new file mode 100644 index 0000000000..3905712c90 --- /dev/null +++ b/pkg/proc/amd64util/xsave_other.go @@ -0,0 +1,8 @@ +//go:build !amd64 +// +build !amd64 + +package amd64util + +func AMD64XstateMaxSize() int { + return _XSTATE_MAX_KNOWN_SIZE +} diff --git a/pkg/proc/arch.go b/pkg/proc/arch.go index 17e726a757..f6db9953a4 100644 --- a/pkg/proc/arch.go +++ b/pkg/proc/arch.go @@ -1,6 +1,9 @@ package proc import ( + "fmt" + "strings" + "github.com/go-delve/delve/pkg/dwarf/frame" "github.com/go-delve/delve/pkg/dwarf/op" ) @@ -9,16 +12,22 @@ import ( type Arch struct { Name string // architecture name - ptrSize int - maxInstructionLength int - prologues []opcodeSeq - breakpointInstruction []byte - breakInstrMovesPC bool - derefTLS bool + ptrSize int + maxInstructionLength int + prologues []opcodeSeq + breakpointInstruction []byte + altBreakpointInstruction []byte + breakInstrMovesPC bool + derefTLS bool + usesLR bool // architecture uses a link register, also called RA on some architectures + PCRegNum uint64 + SPRegNum uint64 + BPRegNum uint64 + ContextRegNum uint64 // register used to pass a closure context when calling a function pointer // asmDecode decodes the assembly instruction starting at mem[0:] into asmInst. // It assumes that the Loc and AtPC fields of asmInst have already been filled. - asmDecode func(asmInst *AsmInstruction, mem []byte, regs Registers, memrw MemoryReadWriter, bi *BinaryInfo) error + asmDecode func(asmInst *AsmInstruction, mem []byte, regs *op.DwarfRegisters, memrw MemoryReadWriter, bi *BinaryInfo) error // fixFrameUnwindContext applies architecture specific rules for unwinding a stack frame // on the given arch. fixFrameUnwindContext func(*frame.FrameContext, uint64, *BinaryInfo) *frame.FrameContext @@ -28,14 +37,20 @@ type Arch struct { // regSize returns the size (in bytes) of register regnum. regSize func(uint64) int // RegistersToDwarfRegisters maps hardware registers to DWARF registers. - RegistersToDwarfRegisters func(uint64, Registers) op.DwarfRegisters + RegistersToDwarfRegisters func(uint64, Registers) *op.DwarfRegisters // addrAndStackRegsToDwarfRegisters returns DWARF registers from the passed in // PC, SP, and BP registers in the format used by the DWARF expression interpreter. addrAndStackRegsToDwarfRegisters func(uint64, uint64, uint64, uint64, uint64) op.DwarfRegisters - // DwarfRegisterToString returns the name and value representation of the given register. + // DwarfRegisterToString returns the name and value representation of the + // given register, the register value can be nil in which case only the + // register name will be returned. DwarfRegisterToString func(int, *op.DwarfRegister) (string, bool, string) // inhibitStepInto returns whether StepBreakpoint can be set at pc. - inhibitStepInto func(bi *BinaryInfo, pc uint64) bool + inhibitStepInto func(bi *BinaryInfo, pc uint64) bool + RegisterNameToDwarf func(s string) (int, bool) + + // asmRegisters maps assembly register numbers to dwarf registers. + asmRegisters map[int]asmRegister // crosscall2fn is the DIE of crosscall2, a function used by the go runtime // to call C functions. This function in go 1.9 (and previous versions) had @@ -49,6 +64,18 @@ type Arch struct { sigreturnfn *Function } +type asmRegister struct { + dwarfNum uint64 + offset uint + mask uint64 +} + +const ( + mask8 = 0x000000ff + mask16 = 0x0000ffff + mask32 = 0xffffffff +) + // PtrSize returns the size of a pointer for the architecture. func (a *Arch) PtrSize() int { return a.ptrSize @@ -59,18 +86,17 @@ func (a *Arch) MaxInstructionLength() int { return a.maxInstructionLength } -// Prologues returns a list of stack split prologues -// that are inserted at function entry. -func (a *Arch) Prologues() []opcodeSeq { - return a.prologues -} - // BreakpointInstruction is the instruction that will trigger a breakpoint trap for // the given architecture. func (a *Arch) BreakpointInstruction() []byte { return a.breakpointInstruction } +// AltBreakpointInstruction returns an alternate encoding for the breakpoint instruction. +func (a *Arch) AltBreakpointInstruction() []byte { + return a.altBreakpointInstruction +} + // BreakInstrMovesPC is true if hitting the breakpoint instruction advances the // instruction counter by the size of the breakpoint instruction. func (a *Arch) BreakInstrMovesPC() bool { @@ -88,6 +114,32 @@ func (a *Arch) DerefTLS() bool { return a.derefTLS } +// getAsmRegister returns the value of the asm register asmreg using the asmRegisters table of arch. +// The interpretation of asmreg is architecture specific and defined by the disassembler. +// A mask value of 0 inside asmRegisters is equivalent to ^uint64(0). +func (arch *Arch) getAsmRegister(regs *op.DwarfRegisters, asmreg int) (uint64, error) { + hwreg, ok := arch.asmRegisters[asmreg] + if !ok { + return 0, ErrUnknownRegister + } + reg := regs.Reg(hwreg.dwarfNum) + if reg == nil { + return 0, fmt.Errorf("register %#x not found", asmreg) + } + n := (reg.Uint64Val >> hwreg.offset) + if hwreg.mask != 0 { + n = n & hwreg.mask + } + return n, nil +} + +func nameToDwarfFunc(n2d map[string]int) func(string) (int, bool) { + return func(name string) (int, bool) { + r, ok := n2d[strings.ToLower(name)] + return r, ok + } +} + // crosscall2 is defined in $GOROOT/src/runtime/cgo/asm_amd64.s. const ( crosscall2SPOffsetBad = 0x8 diff --git a/pkg/proc/arm64_arch.go b/pkg/proc/arm64_arch.go index 5f2bb165eb..e846523d1e 100644 --- a/pkg/proc/arm64_arch.go +++ b/pkg/proc/arm64_arch.go @@ -4,19 +4,11 @@ import ( "bytes" "encoding/binary" "fmt" - "io" "strings" "github.com/go-delve/delve/pkg/dwarf/frame" "github.com/go-delve/delve/pkg/dwarf/op" - "golang.org/x/arch/arm64/arm64asm" -) - -const ( - arm64DwarfIPRegNum uint64 = 32 - arm64DwarfSPRegNum uint64 = 31 - arm64DwarfLRRegNum uint64 = 30 - arm64DwarfBPRegNum uint64 = 29 + "github.com/go-delve/delve/pkg/dwarf/regnum" ) var arm64BreakInstruction = []byte{0x0, 0x0, 0x20, 0xd4} @@ -40,6 +32,11 @@ func ARM64Arch(goos string) *Arch { DwarfRegisterToString: arm64DwarfRegisterToString, inhibitStepInto: func(*BinaryInfo, uint64) bool { return false }, asmDecode: arm64AsmDecode, + usesLR: true, + PCRegNum: regnum.ARM64_PC, + SPRegNum: regnum.ARM64_SP, + asmRegisters: arm64AsmRegisters, + RegisterNameToDwarf: nameToDwarfFunc(regnum.ARM64NameToDwarf), } } @@ -69,24 +66,24 @@ func arm64FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *Binary // here). return &frame.FrameContext{ - RetAddrReg: arm64DwarfIPRegNum, + RetAddrReg: regnum.ARM64_PC, Regs: map[uint64]frame.DWRule{ - arm64DwarfIPRegNum: frame.DWRule{ + regnum.ARM64_PC: frame.DWRule{ Rule: frame.RuleOffset, Offset: int64(-a.PtrSize()), }, - arm64DwarfBPRegNum: frame.DWRule{ + regnum.ARM64_BP: frame.DWRule{ Rule: frame.RuleOffset, Offset: int64(-2 * a.PtrSize()), }, - arm64DwarfSPRegNum: frame.DWRule{ + regnum.ARM64_SP: frame.DWRule{ Rule: frame.RuleValOffset, Offset: 0, }, }, CFA: frame.DWRule{ Rule: frame.RuleCFA, - Reg: arm64DwarfBPRegNum, + Reg: regnum.ARM64_BP, Offset: int64(2 * a.PtrSize()), }, } @@ -113,17 +110,17 @@ func arm64FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *Binary // so that we can use it to unwind the stack even when we encounter frames // without descriptor entries. // If there isn't a rule already we emit one. - if fctxt.Regs[arm64DwarfBPRegNum].Rule == frame.RuleUndefined { - fctxt.Regs[arm64DwarfBPRegNum] = frame.DWRule{ + if fctxt.Regs[regnum.ARM64_BP].Rule == frame.RuleUndefined { + fctxt.Regs[regnum.ARM64_BP] = frame.DWRule{ Rule: frame.RuleFramePointer, - Reg: arm64DwarfBPRegNum, + Reg: regnum.ARM64_BP, Offset: 0, } } - if fctxt.Regs[arm64DwarfLRRegNum].Rule == frame.RuleUndefined { - fctxt.Regs[arm64DwarfLRRegNum] = frame.DWRule{ + if fctxt.Regs[regnum.ARM64_LR].Rule == frame.RuleUndefined { + fctxt.Regs[regnum.ARM64_LR] = frame.DWRule{ Rule: frame.RuleFramePointer, - Reg: arm64DwarfLRRegNum, + Reg: regnum.ARM64_LR, Offset: 0, } } @@ -133,12 +130,15 @@ func arm64FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *Binary const arm64cgocallSPOffsetSaveSlot = 0x8 const prevG0schedSPOffsetSaveSlot = 0x10 -const spAlign = 16 func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool { + if it.frame.Current.Fn == nil && it.systemstack && it.g != nil && it.top { + it.switchToGoroutineStack() + return true + } if it.frame.Current.Fn != nil { switch it.frame.Current.Fn.Name { - case "runtime.asmcgocall", "runtime.cgocallback_gofunc", "runtime.sigpanic": + case "runtime.asmcgocall", "runtime.cgocallback_gofunc", "runtime.sigpanic", "runtime.cgocallback": //do nothing case "runtime.goexit", "runtime.rt0_go", "runtime.mcall": // Look for "top of stack" functions. @@ -146,9 +146,9 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool return true case "crosscall2": //The offsets get from runtime/cgo/asm_arm64.s:10 - newsp, _ := readUintRaw(it.mem, uintptr(it.regs.SP()+8*24), int64(it.bi.Arch.PtrSize())) - newbp, _ := readUintRaw(it.mem, uintptr(it.regs.SP()+8*14), int64(it.bi.Arch.PtrSize())) - newlr, _ := readUintRaw(it.mem, uintptr(it.regs.SP()+8*15), int64(it.bi.Arch.PtrSize())) + newsp, _ := readUintRaw(it.mem, uint64(it.regs.SP()+8*24), int64(it.bi.Arch.PtrSize())) + newbp, _ := readUintRaw(it.mem, uint64(it.regs.SP()+8*14), int64(it.bi.Arch.PtrSize())) + newlr, _ := readUintRaw(it.mem, uint64(it.regs.SP()+8*15), int64(it.bi.Arch.PtrSize())) if it.regs.Reg(it.regs.BPRegNum) != nil { it.regs.Reg(it.regs.BPRegNum).Uint64Val = uint64(newbp) } else { @@ -160,7 +160,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool it.pc = newlr return true default: - if it.systemstack && it.top && it.g != nil && strings.HasPrefix(it.frame.Current.Fn.Name, "runtime.") && it.frame.Current.Fn.Name != "runtime.fatalthrow" { + if it.systemstack && it.top && it.g != nil && strings.HasPrefix(it.frame.Current.Fn.Name, "runtime.") && it.frame.Current.Fn.Name != "runtime.throw" && it.frame.Current.Fn.Name != "runtime.fatalthrow" { // The runtime switches to the system stack in multiple places. // This usually happens through a call to runtime.systemstack but there // are functions that switch to the system stack manually (for example @@ -188,7 +188,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool // switches from the goroutine stack to the system stack. // Since we are unwinding the stack from callee to caller we have to switch // from the system stack to the goroutine stack. - off, _ := readIntRaw(it.mem, uintptr(callFrameRegs.SP()+arm64cgocallSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize())) + off, _ := readIntRaw(it.mem, uint64(callFrameRegs.SP()+arm64cgocallSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize())) oldsp := callFrameRegs.SP() newsp := uint64(int64(it.stackhi) - off) @@ -201,7 +201,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool callFrameRegs.Reg(callFrameRegs.SPRegNum).Uint64Val = uint64(int64(newsp)) return false - case "runtime.cgocallback_gofunc": + case "runtime.cgocallback_gofunc", "runtime.cgocallback": // For a detailed description of how this works read the long comment at // the start of $GOROOT/src/runtime/cgocall.go and the source code of // runtime.cgocallback_gofunc in $GOROOT/src/runtime/asm_arm64.s @@ -223,7 +223,7 @@ func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool callFrameRegs.Reg(callFrameRegs.SPRegNum).Uint64Val = it.g0_sched_sp // reads the previous value of g0.sched.sp that runtime.cgocallback_gofunc saved on the stack - it.g0_sched_sp, _ = readUintRaw(it.mem, uintptr(callFrameRegs.SP()+prevG0schedSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize())) + it.g0_sched_sp, _ = readUintRaw(it.mem, uint64(callFrameRegs.SP()+prevG0schedSPOffsetSaveSlot), int64(it.bi.Arch.PtrSize())) it.systemstack = true return false } @@ -240,85 +240,13 @@ func arm64RegSize(regnum uint64) int { return 8 // general registers } -// The mapping between hardware registers and DWARF registers is specified -// in the DWARF for the ARM® Architecture page 7, -// Table 1 -// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040b/IHI0040B_aadwarf.pdf -var arm64DwarfToHardware = map[int]arm64asm.Reg{ - 0: arm64asm.X0, - 1: arm64asm.X1, - 2: arm64asm.X2, - 3: arm64asm.X3, - 4: arm64asm.X4, - 5: arm64asm.X5, - 6: arm64asm.X6, - 7: arm64asm.X7, - 8: arm64asm.X8, - 9: arm64asm.X9, - 10: arm64asm.X10, - 11: arm64asm.X11, - 12: arm64asm.X12, - 13: arm64asm.X13, - 14: arm64asm.X14, - 15: arm64asm.X15, - 16: arm64asm.X16, - 17: arm64asm.X17, - 18: arm64asm.X18, - 19: arm64asm.X19, - 20: arm64asm.X20, - 21: arm64asm.X21, - 22: arm64asm.X22, - 23: arm64asm.X23, - 24: arm64asm.X24, - 25: arm64asm.X25, - 26: arm64asm.X26, - 27: arm64asm.X27, - 28: arm64asm.X28, - 29: arm64asm.X29, - 30: arm64asm.X30, - 31: arm64asm.SP, - - 64: arm64asm.V0, - 65: arm64asm.V1, - 66: arm64asm.V2, - 67: arm64asm.V3, - 68: arm64asm.V4, - 69: arm64asm.V5, - 70: arm64asm.V6, - 71: arm64asm.V7, - 72: arm64asm.V8, - 73: arm64asm.V9, - 74: arm64asm.V10, - 75: arm64asm.V11, - 76: arm64asm.V12, - 77: arm64asm.V13, - 78: arm64asm.V14, - 79: arm64asm.V15, - 80: arm64asm.V16, - 81: arm64asm.V17, - 82: arm64asm.V18, - 83: arm64asm.V19, - 84: arm64asm.V20, - 85: arm64asm.V21, - 86: arm64asm.V22, - 87: arm64asm.V23, - 88: arm64asm.V24, - 89: arm64asm.V25, - 90: arm64asm.V26, - 91: arm64asm.V27, - 92: arm64asm.V28, - 93: arm64asm.V29, - 94: arm64asm.V30, - 95: arm64asm.V31, -} - var arm64NameToDwarf = func() map[string]int { r := make(map[string]int) for i := 0; i <= 30; i++ { r[fmt.Sprintf("x%d", i)] = i } - r["pc"] = int(arm64DwarfIPRegNum) - r["lr"] = int(arm64DwarfLRRegNum) + r["pc"] = int(regnum.ARM64_PC) + r["lr"] = int(regnum.ARM64_LR) r["sp"] = 31 for i := 0; i <= 31; i++ { r[fmt.Sprintf("v%d", i)] = i + 64 @@ -326,61 +254,28 @@ var arm64NameToDwarf = func() map[string]int { return r }() -func maxArm64DwarfRegister() int { - max := int(arm64DwarfIPRegNum) - for i := range arm64DwarfToHardware { - if i > max { - max = i - } - } - return max -} - -func arm64RegistersToDwarfRegisters(staticBase uint64, regs Registers) op.DwarfRegisters { - dregs := make([]*op.DwarfRegister, maxArm64DwarfRegister()+1) - - dregs[arm64DwarfIPRegNum] = op.DwarfRegisterFromUint64(regs.PC()) - dregs[arm64DwarfSPRegNum] = op.DwarfRegisterFromUint64(regs.SP()) - dregs[arm64DwarfBPRegNum] = op.DwarfRegisterFromUint64(regs.BP()) - if lr, err := regs.Get(int(arm64asm.X30)); err != nil { - dregs[arm64DwarfLRRegNum] = op.DwarfRegisterFromUint64(lr) - } - - for dwarfReg, asmReg := range arm64DwarfToHardware { - v, err := regs.Get(int(asmReg)) - if err == nil { - dregs[dwarfReg] = op.DwarfRegisterFromUint64(v) - } - } - - dr := op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, arm64DwarfIPRegNum, arm64DwarfSPRegNum, arm64DwarfBPRegNum, arm64DwarfLRRegNum) +func arm64RegistersToDwarfRegisters(staticBase uint64, regs Registers) *op.DwarfRegisters { + dregs := initDwarfRegistersFromSlice(int(regnum.ARM64MaxRegNum()), regs, regnum.ARM64NameToDwarf) + dr := op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, regnum.ARM64_PC, regnum.ARM64_SP, regnum.ARM64_BP, regnum.ARM64_LR) dr.SetLoadMoreCallback(loadMoreDwarfRegistersFromSliceFunc(dr, regs, arm64NameToDwarf)) - return *dr + return dr } func arm64AddrAndStackRegsToDwarfRegisters(staticBase, pc, sp, bp, lr uint64) op.DwarfRegisters { - dregs := make([]*op.DwarfRegister, arm64DwarfIPRegNum+1) - dregs[arm64DwarfIPRegNum] = op.DwarfRegisterFromUint64(pc) - dregs[arm64DwarfSPRegNum] = op.DwarfRegisterFromUint64(sp) - dregs[arm64DwarfBPRegNum] = op.DwarfRegisterFromUint64(bp) - dregs[arm64DwarfLRRegNum] = op.DwarfRegisterFromUint64(lr) + dregs := make([]*op.DwarfRegister, regnum.ARM64_PC+1) + dregs[regnum.ARM64_PC] = op.DwarfRegisterFromUint64(pc) + dregs[regnum.ARM64_SP] = op.DwarfRegisterFromUint64(sp) + dregs[regnum.ARM64_BP] = op.DwarfRegisterFromUint64(bp) + dregs[regnum.ARM64_LR] = op.DwarfRegisterFromUint64(lr) - return *op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, arm64DwarfIPRegNum, arm64DwarfSPRegNum, arm64DwarfBPRegNum, arm64DwarfLRRegNum) + return *op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, regnum.ARM64_PC, regnum.ARM64_SP, regnum.ARM64_BP, regnum.ARM64_LR) } func arm64DwarfRegisterToString(i int, reg *op.DwarfRegister) (name string, floatingPoint bool, repr string) { - // see arm64DwarfToHardware table for explanation - switch { - case i <= 30: - name = fmt.Sprintf("X%d", i) - case i == 31: - name = "SP" - case i == 32: - name = "PC" - case i >= 64 && i <= 95: - name = fmt.Sprintf("V%d", i-64) - default: - name = fmt.Sprintf("unknown%d", i) + name = regnum.ARM64ToName(uint64(i)) + + if reg == nil { + return name, false, "" } if reg.Bytes != nil && name[0] == 'V' { @@ -389,33 +284,37 @@ func arm64DwarfRegisterToString(i int, reg *op.DwarfRegister) (name string, floa var out bytes.Buffer var vi [16]uint8 for i := range vi { - binary.Read(buf, binary.LittleEndian, &vi[i]) + _ = binary.Read(buf, binary.LittleEndian, &vi[i]) } - - fmt.Fprintf(&out, "0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", vi[15], vi[14], vi[13], vi[12], vi[11], vi[10], vi[9], vi[8], vi[7], vi[6], vi[5], vi[4], vi[3], vi[2], vi[1], vi[0]) - - fmt.Fprintf(&out, "\tv2_int={ %02x%02x%02x%02x%02x%02x%02x%02x %02x%02x%02x%02x%02x%02x%02x%02x }", vi[7], vi[6], vi[5], vi[4], vi[3], vi[2], vi[1], vi[0], vi[15], vi[14], vi[13], vi[12], vi[11], vi[10], vi[9], vi[8]) - - fmt.Fprintf(&out, "\tv4_int={ %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x %02x%02x%02x%02x }", vi[3], vi[2], vi[1], vi[0], vi[7], vi[6], vi[5], vi[4], vi[11], vi[10], vi[9], vi[8], vi[15], vi[14], vi[13], vi[12]) - - fmt.Fprintf(&out, "\tv8_int={ %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x %02x%02x }", vi[1], vi[0], vi[3], vi[2], vi[5], vi[4], vi[7], vi[6], vi[9], vi[8], vi[11], vi[10], vi[13], vi[12], vi[15], vi[14]) - - fmt.Fprintf(&out, "\tv16_int={ %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x }", vi[0], vi[1], vi[2], vi[3], vi[4], vi[5], vi[6], vi[7], vi[8], vi[9], vi[10], vi[11], vi[12], vi[13], vi[14], vi[15]) - - buf.Seek(0, io.SeekStart) - var v2 [2]float64 - for i := range v2 { - binary.Read(buf, binary.LittleEndian, &v2[i]) - } - fmt.Fprintf(&out, "\tv2_float={ %g %g }", v2[0], v2[1]) - - buf.Seek(0, io.SeekStart) - var v4 [4]float32 - for i := range v4 { - binary.Read(buf, binary.LittleEndian, &v4[i]) - } - fmt.Fprintf(&out, "\tv4_float={ %g %g %g %g }", v4[0], v4[1], v4[2], v4[3]) - + //D + fmt.Fprintf(&out, " {\n\tD = {u = {0x%02x%02x%02x%02x%02x%02x%02x%02x,", vi[7], vi[6], vi[5], vi[4], vi[3], vi[2], vi[1], vi[0]) + fmt.Fprintf(&out, " 0x%02x%02x%02x%02x%02x%02x%02x%02x},", vi[15], vi[14], vi[13], vi[12], vi[11], vi[10], vi[9], vi[8]) + fmt.Fprintf(&out, " s = {0x%02x%02x%02x%02x%02x%02x%02x%02x,", vi[7], vi[6], vi[5], vi[4], vi[3], vi[2], vi[1], vi[0]) + fmt.Fprintf(&out, " 0x%02x%02x%02x%02x%02x%02x%02x%02x}},", vi[15], vi[14], vi[13], vi[12], vi[11], vi[10], vi[9], vi[8]) + + //S + fmt.Fprintf(&out, " \n\tS = {u = {0x%02x%02x%02x%02x,0x%02x%02x%02x%02x,", vi[3], vi[2], vi[1], vi[0], vi[7], vi[6], vi[5], vi[4]) + fmt.Fprintf(&out, " 0x%02x%02x%02x%02x,0x%02x%02x%02x%02x},", vi[11], vi[10], vi[9], vi[8], vi[15], vi[14], vi[13], vi[12]) + fmt.Fprintf(&out, " s = {0x%02x%02x%02x%02x,0x%02x%02x%02x%02x,", vi[3], vi[2], vi[1], vi[0], vi[7], vi[6], vi[5], vi[4]) + fmt.Fprintf(&out, " 0x%02x%02x%02x%02x,0x%02x%02x%02x%02x}},", vi[11], vi[10], vi[9], vi[8], vi[15], vi[14], vi[13], vi[12]) + + //H + fmt.Fprintf(&out, " \n\tH = {u = {0x%02x%02x,0x%02x%02x,0x%02x%02x,0x%02x%02x,", vi[1], vi[0], vi[3], vi[2], vi[5], vi[4], vi[7], vi[6]) + fmt.Fprintf(&out, " 0x%02x%02x,0x%02x%02x,0x%02x%02x,0x%02x%02x},", vi[9], vi[8], vi[11], vi[10], vi[13], vi[12], vi[15], vi[14]) + fmt.Fprintf(&out, " s = {0x%02x%02x,0x%02x%02x,0x%02x%02x,0x%02x%02x,", vi[1], vi[0], vi[3], vi[2], vi[5], vi[4], vi[7], vi[6]) + fmt.Fprintf(&out, " 0x%02x%02x,0x%02x%02x,0x%02x%02x,0x%02x%02x}},", vi[9], vi[8], vi[11], vi[10], vi[13], vi[12], vi[15], vi[14]) + + //B + fmt.Fprintf(&out, " \n\tB = {u = {0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,", vi[0], vi[1], vi[2], vi[3], vi[4], vi[5], vi[6], vi[7]) + fmt.Fprintf(&out, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x},", vi[8], vi[9], vi[10], vi[11], vi[12], vi[13], vi[14], vi[15]) + fmt.Fprintf(&out, " s = {0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,", vi[0], vi[1], vi[2], vi[3], vi[4], vi[5], vi[6], vi[7]) + fmt.Fprintf(&out, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}}", vi[8], vi[9], vi[10], vi[11], vi[12], vi[13], vi[14], vi[15]) + + //Q + fmt.Fprintf(&out, " \n\tQ = {u = {0x%02x%02x%02x%02x%02x%02x%02x%02x", vi[15], vi[14], vi[13], vi[12], vi[11], vi[10], vi[9], vi[8]) + fmt.Fprintf(&out, "%02x%02x%02x%02x%02x%02x%02x%02x},", vi[7], vi[6], vi[5], vi[4], vi[3], vi[2], vi[1], vi[0]) + fmt.Fprintf(&out, " s = {0x%02x%02x%02x%02x%02x%02x%02x%02x", vi[15], vi[14], vi[13], vi[12], vi[11], vi[10], vi[9], vi[8]) + fmt.Fprintf(&out, "%02x%02x%02x%02x%02x%02x%02x%02x}}\n\t}", vi[7], vi[6], vi[5], vi[4], vi[3], vi[2], vi[1], vi[0]) return name, true, out.String() } else if reg.Bytes == nil || (reg.Bytes != nil && len(reg.Bytes) < 16) { return name, false, fmt.Sprintf("%#016x", reg.Uint64Val) diff --git a/pkg/proc/arm64_disasm.go b/pkg/proc/arm64_disasm.go index 8a137a1ba0..bd918f4a9a 100644 --- a/pkg/proc/arm64_disasm.go +++ b/pkg/proc/arm64_disasm.go @@ -5,10 +5,13 @@ package proc import ( + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" + "golang.org/x/arch/arm64/arm64asm" ) -func arm64AsmDecode(asmInst *AsmInstruction, mem []byte, regs Registers, memrw MemoryReadWriter, bi *BinaryInfo) error { +func arm64AsmDecode(asmInst *AsmInstruction, mem []byte, regs *op.DwarfRegisters, memrw MemoryReadWriter, bi *BinaryInfo) error { asmInst.Size = 4 asmInst.Bytes = mem[:asmInst.Size] @@ -37,7 +40,7 @@ func arm64AsmDecode(asmInst *AsmInstruction, mem []byte, regs Registers, memrw M return nil } -func resolveCallArgARM64(inst *arm64asm.Inst, instAddr uint64, currentGoroutine bool, regs Registers, mem MemoryReadWriter, bininfo *BinaryInfo) *Location { +func resolveCallArgARM64(inst *arm64asm.Inst, instAddr uint64, currentGoroutine bool, regs *op.DwarfRegisters, mem MemoryReadWriter, bininfo *BinaryInfo) *Location { switch inst.Op { case arm64asm.BL, arm64asm.BLR, arm64asm.B, arm64asm.BR: //ok @@ -55,7 +58,7 @@ func resolveCallArgARM64(inst *arm64asm.Inst, instAddr uint64, currentGoroutine if !currentGoroutine || regs == nil { return nil } - pc, err = regs.Get(int(arg)) + pc, err = bininfo.Arch.getAsmRegister(regs, int(arg)) if err != nil { return nil } @@ -118,3 +121,11 @@ func (inst *arm64ArchInst) OpcodeEquals(op uint64) bool { } return uint64(inst.Op) == op } + +var arm64AsmRegisters = func() map[int]asmRegister { + r := make(map[int]asmRegister) + for i := arm64asm.X0; i <= arm64asm.X30; i++ { + r[int(i)] = asmRegister{regnum.ARM64_X0 + uint64(i-arm64asm.X0), 0, 0} + } + return r +}() diff --git a/pkg/proc/bininfo.go b/pkg/proc/bininfo.go index 011ac21f52..d98a48b83e 100644 --- a/pkg/proc/bininfo.go +++ b/pkg/proc/bininfo.go @@ -14,6 +14,7 @@ import ( "go/token" "io" "os" + "os/exec" "path/filepath" "sort" "strconv" @@ -57,6 +58,9 @@ type BinaryInfo struct { Sources []string // LookupFunc maps function names to a description of the function. LookupFunc map[string]*Function + // lookupGenericFunc maps function names, with their type parameters removed, to functions. + // Functions that are not generic are not added to this map. + lookupGenericFunc map[string][]*Function // SymNames maps addr to a description *elf.Symbol of this addr. SymNames map[uint64]*elf.Symbol @@ -69,9 +73,6 @@ type BinaryInfo struct { lastModified time.Time // Time the executable of this process was last modified - closer io.Closer - sepDebugCloser io.Closer - // PackageMap maps package names to package paths, needed to lookup types inside DWARF info. // On Go1.12 this mapping is determined by using the last element of a package path, for example: // github.com/go-delve/delve @@ -93,7 +94,7 @@ type BinaryInfo struct { // nameOfRuntimeType maps an address of a runtime._type struct to its // decoded name. Used with versions of Go <= 1.10 to figure out the DIE of // the concrete type of interfaces. - nameOfRuntimeType map[uintptr]nameOfRuntimeTypeEntry + nameOfRuntimeType map[uint64]nameOfRuntimeTypeEntry // consts[off] lists all the constants with the type defined at offset off. consts constantsMap @@ -103,6 +104,12 @@ type BinaryInfo struct { // function starts. inlinedCallLines map[fileLine][]uint64 + // dwrapUnwrapCache caches unwrapping of defer wrapper functions (dwrap) + dwrapUnwrapCache map[uint64]*Function + + // Go 1.17 register ABI is enabled. + regabi bool + logger *logrus.Entry } @@ -124,12 +131,13 @@ var ( elf.EM_ARM: true, } - supportedWindowsArch = map[PEMachine]bool{ - IMAGE_FILE_MACHINE_AMD64: true, + supportedWindowsArch = map[_PEMachine]bool{ + _IMAGE_FILE_MACHINE_AMD64: true, } supportedDarwinArch = map[macho.Cpu]bool{ macho.CpuAmd64: true, + macho.CpuArm64: true, } ) @@ -145,34 +153,192 @@ func (err *ErrFunctionNotFound) Error() string { // FindFileLocation returns the PC for a given file:line. // Assumes that `file` is normalized to lower case and '/' on Windows. -func FindFileLocation(p Process, fileName string, lineno int) ([]uint64, error) { - pcs, err := p.BinInfo().LineToPC(fileName, lineno) - if err != nil { - return nil, err +func FindFileLocation(p Process, filename string, lineno int) ([]uint64, error) { + // A single file:line can appear in multiple concrete functions, because of + // generics instantiation as well as multiple inlined calls into other + // concrete functions. + + // 1. Find all instructions assigned in debug_line to filename:lineno. + + bi := p.BinInfo() + + fileFound := false + pcs := []line.PCStmt{} + for _, image := range bi.Images { + for _, cu := range image.compileUnits { + if cu.lineInfo == nil || cu.lineInfo.Lookup[filename] == nil { + continue + } + + fileFound = true + pcs = append(pcs, cu.lineInfo.LineToPCs(filename, lineno)...) + } } + + if len(pcs) == 0 { + // Check if the line contained a call to a function that was inlined, in + // that case it's possible for the line itself to not appear in debug_line + // at all, but it will still be in debug_info as the call site for an + // inlined subroutine entry. + for _, pc := range bi.inlinedCallLines[fileLine{filename, lineno}] { + pcs = append(pcs, line.PCStmt{PC: pc, Stmt: true}) + } + } + + if len(pcs) == 0 { + return nil, &ErrCouldNotFindLine{fileFound, filename, lineno} + } + + // 2. assign all occurences of filename:lineno to their containing function + + pcByFunc := map[*Function][]line.PCStmt{} + sort.Slice(pcs, func(i, j int) bool { return pcs[i].PC < pcs[j].PC }) var fn *Function - for i := range pcs { - if fn == nil || pcs[i] < fn.Entry || pcs[i] >= fn.End { - fn = p.BinInfo().PCToFunc(pcs[i]) + for _, pcstmt := range pcs { + if fn == nil || (pcstmt.PC < fn.Entry) || (pcstmt.PC >= fn.End) { + fn = p.BinInfo().PCToFunc(pcstmt.PC) + } + if fn != nil { + pcByFunc[fn] = append(pcByFunc[fn], pcstmt) + } + } + + selectedPCs := []uint64{} + + for fn, pcs := range pcByFunc { + + // 3. for each concrete function split instruction between the inlined functions it contains + + if strings.Contains(fn.Name, "·dwrap·") || fn.trampoline { + // skip autogenerated functions + continue + } + + dwtree, err := fn.cu.image.getDwarfTree(fn.offset) + if err != nil { + return nil, fmt.Errorf("loading DWARF for %s@%#x: %v", fn.Name, fn.offset, err) } - if fn != nil && fn.Entry == pcs[i] { - pcs[i], _ = FirstPCAfterPrologue(p, fn, true) + inlrngs := allInlineCallRanges(dwtree) + + // findInlRng returns the DWARF offset of the inlined call containing pc. + // If multiple nested inlined calls contain pc the deepest one is returned + // (since allInlineCallRanges returns inlined call by decreasing depth + // this is the first matching entry of the slice). + findInlRng := func(pc uint64) dwarf.Offset { + for _, inlrng := range inlrngs { + if inlrng.rng[0] <= pc && pc < inlrng.rng[1] { + return inlrng.off + } + } + return fn.offset } + + pcsByOff := map[dwarf.Offset][]line.PCStmt{} + + for _, pc := range pcs { + off := findInlRng(pc.PC) + pcsByOff[off] = append(pcsByOff[off], pc) + } + + // 4. pick the first instruction with stmt set for each inlined call as + // well as the main body of the concrete function. If nothing has + // is_stmt set pick the first instruction instead. + + for off, pcs := range pcsByOff { + sort.Slice(pcs, func(i, j int) bool { return pcs[i].PC < pcs[j].PC }) + + var selectedPC uint64 + for _, pc := range pcs { + if pc.Stmt { + selectedPC = pc.PC + break + } + } + + if selectedPC == 0 && len(pcs) > 0 { + selectedPC = pcs[0].PC + } + + if selectedPC == 0 { + continue + } + + // 5. if we picked the entry point of the function, skip it + + if off == fn.offset && fn.Entry == selectedPC { + selectedPC, _ = FirstPCAfterPrologue(p, fn, true) + } + + selectedPCs = append(selectedPCs, selectedPC) + } + } + + sort.Slice(selectedPCs, func(i, j int) bool { return selectedPCs[i] < selectedPCs[j] }) + + return selectedPCs, nil +} + +// inlRnage is the range of an inlined call +type inlRange struct { + off dwarf.Offset + depth uint32 + rng [2]uint64 +} + +// allInlineCallRanges returns all inlined calls contained inside 'tree' in +// reverse nesting order (i.e. the most nested calls are returned first). +// Note that a single inlined call might not have a continuous range of +// addresses and therefore appear multiple times in the returned slice. +func allInlineCallRanges(tree *godwarf.Tree) []inlRange { + r := []inlRange{} + + var visit func(*godwarf.Tree, uint32) + visit = func(n *godwarf.Tree, depth uint32) { + if n.Tag == dwarf.TagInlinedSubroutine { + for _, rng := range n.Ranges { + r = append(r, inlRange{off: n.Offset, depth: depth, rng: rng}) + } + } + for _, child := range n.Children { + visit(child, depth+1) + } + } + visit(tree, 0) + + sort.SliceStable(r, func(i, j int) bool { return r[i].depth > r[j].depth }) + return r +} + +// FindFunction returns the functions with name funcName. +func (bi *BinaryInfo) FindFunction(funcName string) ([]*Function, error) { + if fn := bi.LookupFunc[funcName]; fn != nil { + return []*Function{fn}, nil } - return pcs, nil + fns := bi.LookupGenericFunc()[funcName] + if len(fns) == 0 { + return nil, &ErrFunctionNotFound{funcName} + } + return fns, nil } // FindFunctionLocation finds address of a function's line // If lineOffset is passed FindFunctionLocation will return the address of that line func FindFunctionLocation(p Process, funcName string, lineOffset int) ([]uint64, error) { bi := p.BinInfo() - origfn := bi.LookupFunc[funcName] - if origfn == nil { - return nil, &ErrFunctionNotFound{funcName} + origfns, err := bi.FindFunction(funcName) + if err != nil { + return nil, err + } + + if lineOffset > 0 { + fn := origfns[0] + filename, lineno := fn.cu.lineInfo.PCToLine(fn.Entry, fn.Entry) + return FindFileLocation(p, filename, lineno+lineOffset) } - if lineOffset <= 0 { - r := make([]uint64, 0, len(origfn.InlinedCalls)+1) + r := make([]uint64, 0, len(origfns[0].InlinedCalls)+len(origfns)) + + for _, origfn := range origfns { if origfn.Entry > 0 { // add concrete implementation of the function pc, err := FirstPCAfterPrologue(p, origfn, false) @@ -188,10 +354,9 @@ func FindFunctionLocation(p Process, funcName string, lineOffset int) ([]uint64, if len(r) == 0 { return nil, &ErrFunctionNotFound{funcName} } - return r, nil } - filename, lineno := origfn.cu.lineInfo.PCToLine(origfn.Entry, origfn.Entry) - return bi.LineToPC(filename, lineno+lineOffset) + sort.Slice(r, func(i, j int) bool { return r[i] < r[j] }) + return r, nil } // FirstPCAfterPrologue returns the address of the first @@ -227,30 +392,30 @@ func FirstPCAfterPrologue(p Process, fn *Function, sameline bool) (uint64, error return pc, nil } -// CpuArch is a stringer interface representing CPU architectures. -type CpuArch interface { +// cpuArch is a stringer interface representing CPU architectures. +type cpuArch interface { String() string } // ErrUnsupportedArch is returned when attempting to debug a binary compiled for an unsupported architecture. type ErrUnsupportedArch struct { os string - cpuArch CpuArch + cpuArch cpuArch } func (e *ErrUnsupportedArch) Error() string { - var supportArchs []CpuArch + var supportArchs []cpuArch switch e.os { case "linux": - for linuxArch, _ := range supportedLinuxArch { + for linuxArch := range supportedLinuxArch { supportArchs = append(supportArchs, linuxArch) } case "windows": - for windowArch, _ := range supportedWindowsArch { + for windowArch := range supportedWindowsArch { supportArchs = append(supportArchs, windowArch) } case "darwin": - for darwinArch, _ := range supportedDarwinArch { + for darwinArch := range supportedDarwinArch { supportArchs = append(supportArchs, darwinArch) } } @@ -310,15 +475,41 @@ type Function struct { offset dwarf.Offset cu *compileUnit + trampoline bool // DW_AT_trampoline attribute set to true + // InlinedCalls lists all inlined calls to this function InlinedCalls []InlinedCall } +// instRange returns the indexes in fn.Name of the type parameter +// instantiation, which is the position of the outermost '[' and ']'. +// If fn is not an instantiated function both returned values will be len(fn.Name) +func (fn *Function) instRange() [2]int { + d := len(fn.Name) + inst := [2]int{d, d} + if strings.HasPrefix(fn.Name, "type..") { + return inst + } + inst[0] = strings.Index(fn.Name, "[") + if inst[0] < 0 { + inst[0] = d + return inst + } + inst[1] = strings.LastIndex(fn.Name, "]") + if inst[1] < 0 { + inst[0] = d + inst[1] = d + return inst + } + return inst +} + // PackageName returns the package part of the symbol name, // or the empty string if there is none. // Borrowed from $GOROOT/debug/gosym/symtab.go func (fn *Function) PackageName() string { - return packageName(fn.Name) + inst := fn.instRange() + return packageName(fn.Name[:inst[0]]) } func packageName(name string) string { @@ -337,27 +528,44 @@ func packageName(name string) string { // or the empty string if there is none. // Borrowed from $GOROOT/debug/gosym/symtab.go func (fn *Function) ReceiverName() string { - pathend := strings.LastIndex(fn.Name, "/") + inst := fn.instRange() + pathend := strings.LastIndex(fn.Name[:inst[0]], "/") if pathend < 0 { pathend = 0 } l := strings.Index(fn.Name[pathend:], ".") - r := strings.LastIndex(fn.Name[pathend:], ".") - if l == -1 || r == -1 || l == r { + if l == -1 { return "" } - return fn.Name[pathend+l+1 : pathend+r] + if r := strings.LastIndex(fn.Name[inst[1]:], "."); r != -1 && pathend+l != inst[1]+r { + return fn.Name[pathend+l+1 : inst[1]+r] + } else if r := strings.LastIndex(fn.Name[pathend:inst[0]], "."); r != -1 && l != r { + return fn.Name[pathend+l+1 : pathend+r] + } + return "" } // BaseName returns the symbol name without the package or receiver name. // Borrowed from $GOROOT/debug/gosym/symtab.go func (fn *Function) BaseName() string { - if i := strings.LastIndex(fn.Name, "."); i != -1 { + inst := fn.instRange() + if i := strings.LastIndex(fn.Name[inst[1]:], "."); i != -1 { + return fn.Name[inst[1]+i+1:] + } else if i := strings.LastIndex(fn.Name[:inst[0]], "."); i != -1 { return fn.Name[i+1:] } return fn.Name } +// NameWithoutTypeParams returns the function name without instantiation parameters +func (fn *Function) NameWithoutTypeParams() string { + inst := fn.instRange() + if inst[0] == inst[1] { + return fn.Name + } + return fn.Name[:inst[0]] + fn.Name[inst[1]+1:] +} + // Optimized returns true if the function was optimized by the compiler. func (fn *Function) Optimized() bool { return fn.cu.optimized @@ -426,7 +634,7 @@ type ElfDynamicSection struct { // NewBinaryInfo returns an initialized but unloaded BinaryInfo struct. func NewBinaryInfo(goos, goarch string) *BinaryInfo { - r := &BinaryInfo{GOOS: goos, nameOfRuntimeType: make(map[uintptr]nameOfRuntimeTypeEntry), logger: logflags.DebuggerLogger()} + r := &BinaryInfo{GOOS: goos, nameOfRuntimeType: make(map[uint64]nameOfRuntimeTypeEntry), logger: logflags.DebuggerLogger()} // TODO: find better way to determine proc arch (perhaps use executable file info). switch goarch { @@ -517,69 +725,6 @@ func (err *ErrCouldNotFindLine) Error() string { return fmt.Sprintf("could not find file %s", err.filename) } -// LineToPC converts a file:line into a list of matching memory addresses, -// corresponding to the first instruction matching the specified file:line -// in the containing function and all its inlined calls. -func (bi *BinaryInfo) LineToPC(filename string, lineno int) (pcs []uint64, err error) { - fileFound := false - var pc uint64 -pcsearch: - for _, image := range bi.Images { - for _, cu := range image.compileUnits { - if cu.lineInfo == nil || cu.lineInfo.Lookup[filename] == nil { - continue - } - fileFound = true - pc = cu.lineInfo.LineToPC(filename, lineno) - if pc != 0 { - break pcsearch - } - } - } - - if pc == 0 { - // Check if the line contained a call to a function that was inlined, in - // that case it's possible for the line itself to not appear in debug_line - // at all, but it will still be in debug_info as the call site for an - // inlined subroutine entry. - if pcs := bi.inlinedCallLines[fileLine{filename, lineno}]; len(pcs) != 0 { - return pcs, nil - } - return nil, &ErrCouldNotFindLine{fileFound, filename, lineno} - } - // The code above will find the first occurence of an instruction - // corresponding to filename:line. If the function corresponding to that - // instruction has been inlined we don't just want to return the first - // occurence (which could be either the concrete version of the function or - // one of the inlinings) but instead: - // - the first instruction corresponding to filename:line in the concrete - // version of the function - // - the first instruction corresponding to filename:line in each inlined - // instance of the function. - fn := bi.PCToInlineFunc(pc) - if fn == nil { - return []uint64{pc}, nil - } - pcs = make([]uint64, 0, len(fn.InlinedCalls)+1) - pcs = appendLineToPCIn(pcs, filename, lineno, fn.cu, fn, fn.Entry, fn.End) - for _, call := range fn.InlinedCalls { - pcs = appendLineToPCIn(pcs, filename, lineno, call.cu, bi.PCToFunc(call.LowPC), call.LowPC, call.HighPC) - } - return pcs, nil -} - -func appendLineToPCIn(pcs []uint64, filename string, lineno int, cu *compileUnit, containingFn *Function, lowPC, highPC uint64) []uint64 { - var entry uint64 - if containingFn != nil { - entry = containingFn.Entry - } - pc := cu.lineInfo.LineToPCIn(filename, lineno, entry, lowPC, highPC) - if pc != 0 { - return append(pcs, pc) - } - return pcs -} - // AllPCsForFileLines returns a map providing all PC addresses for filename and each line in linenos func (bi *BinaryInfo) AllPCsForFileLines(filename string, linenos []int) map[int][]uint64 { r := make(map[int][]uint64) @@ -612,27 +757,6 @@ func (bi *BinaryInfo) PCToFunc(pc uint64) *Function { return nil } -// PCToInlineFunc returns the function containing the given PC address. -// If the PC address belongs to an inlined call it will return the inlined function. -func (bi *BinaryInfo) PCToInlineFunc(pc uint64) *Function { - fn := bi.PCToFunc(pc) - dwarfTree, err := fn.cu.image.getDwarfTree(fn.offset) - if err != nil { - return fn - } - entries := reader.InlineStack(dwarfTree, pc) - if len(entries) == 0 { - return fn - } - - fnname, okname := entries[0].Val(dwarf.AttrName).(string) - if !okname { - return fn - } - - return bi.LookupFunc[fnname] -} - // PCToImage returns the image containing the given PC address. func (bi *BinaryInfo) PCToImage(pc uint64) *Image { fn := bi.PCToFunc(pc) @@ -650,17 +774,19 @@ type Image struct { closer io.Closer sepDebugCloser io.Closer - dwarf *dwarf.Data - dwarfReader *dwarf.Reader - loclist2 *loclist.Dwarf2Reader - loclist5 *loclist.Dwarf5Reader - debugAddr *godwarf.DebugAddrSection + dwarf *dwarf.Data + dwarfReader *dwarf.Reader + loclist2 *loclist.Dwarf2Reader + loclist5 *loclist.Dwarf5Reader + debugAddr *godwarf.DebugAddrSection + debugLineStr []byte typeCache map[dwarf.Offset]godwarf.Type compileUnits []*compileUnit // compileUnits is sorted by increasing DWARF offset - dwarfTreeCache *simplelru.LRU + dwarfTreeCache *simplelru.LRU + runtimeMallocgcTree *godwarf.Tree // patched version of runtime.mallocgc's DIE // runtimeTypeToDIE maps between the offset of a runtime._type in // runtime.moduledata.types and the offset of the DIE in debug_info. This @@ -675,7 +801,7 @@ type Image struct { func (image *Image) registerRuntimeTypeToDIE(entry *dwarf.Entry, ardr *reader.Reader) { if off, ok := entry.Val(godwarf.AttrGoRuntimeType).(uint64); ok { if _, ok := image.runtimeTypeToDIE[off]; !ok { - image.runtimeTypeToDIE[off+image.StaticBase] = runtimeTypeDIE{entry.Offset, -1} + image.runtimeTypeToDIE[off] = runtimeTypeDIE{entry.Offset, -1} } } } @@ -706,19 +832,34 @@ func (bi *BinaryInfo) AddImage(path string, addr uint64) error { if err != nil { bi.Images[len(bi.Images)-1].loadErr = err } + bi.macOSDebugFrameBugWorkaround() return err } // moduleDataToImage finds the image corresponding to the given module data object. func (bi *BinaryInfo) moduleDataToImage(md *moduleData) *Image { - return bi.funcToImage(bi.PCToFunc(uint64(md.text))) + fn := bi.PCToFunc(uint64(md.text)) + if fn != nil { + return bi.funcToImage(fn) + } + // Try searching for the image with the closest address preceding md.text + var so *Image + for i := range bi.Images { + if int64(bi.Images[i].StaticBase) > int64(md.text) { + continue + } + if so == nil || int64(bi.Images[i].StaticBase) > int64(so.StaticBase) { + so = bi.Images[i] + } + } + return so } // imageToModuleData finds the module data in mds corresponding to the given image. func (bi *BinaryInfo) imageToModuleData(image *Image, mds []moduleData) *moduleData { for _, md := range mds { im2 := bi.moduleDataToImage(&md) - if im2.index == image.index { + if im2 != nil && im2.index == image.index { return &md } } @@ -773,10 +914,13 @@ func (image *Image) Close() error { return err2 } -func (image *Image) setLoadError(fmtstr string, args ...interface{}) { +func (image *Image) setLoadError(logger *logrus.Entry, fmtstr string, args ...interface{}) { image.loadErrMu.Lock() image.loadErr = fmt.Errorf(fmtstr, args...) image.loadErrMu.Unlock() + if logger != nil { + logger.Errorf("error loading binary %q: %v", image.Path, image.loadErr) + } } // LoadError returns any error incurred while loading this image. @@ -785,6 +929,9 @@ func (image *Image) LoadError() error { } func (image *Image) getDwarfTree(off dwarf.Offset) (*godwarf.Tree, error) { + if image.runtimeMallocgcTree != nil && off == image.runtimeMallocgcTree.Offset { + return image.runtimeMallocgcTree, nil + } if r, ok := image.dwarfTreeCache.Get(off); ok { return r.(*godwarf.Tree), nil } @@ -811,7 +958,7 @@ func (bi *BinaryInfo) LoadImageFromData(dwdata *dwarf.Data, debugFrameBytes, deb image.dwarfTreeCache, _ = simplelru.NewLRU(dwarfTreeCacheSize, nil) if debugFrameBytes != nil { - bi.frameEntries = frame.Parse(debugFrameBytes, frame.DwarfEndian(debugFrameBytes), 0, bi.Arch.PtrSize()) + bi.frameEntries, _ = frame.Parse(debugFrameBytes, frame.DwarfEndian(debugFrameBytes), 0, bi.Arch.PtrSize(), 0) } image.loclist2 = loclist.NewDwarf2Reader(debugLocBytes, bi.Arch.PtrSize()) @@ -915,12 +1062,16 @@ func (bi *BinaryInfo) LocationCovers(entry *dwarf.Entry, attr dwarf.Attr) ([][2] // This will either be an int64 address or a slice of Pieces for locations // that don't correspond to a single memory address (registers, composite // locations). -func (bi *BinaryInfo) Location(entry godwarf.Entry, attr dwarf.Attr, pc uint64, regs op.DwarfRegisters) (int64, []op.Piece, *locationExpr, error) { +func (bi *BinaryInfo) Location(entry godwarf.Entry, attr dwarf.Attr, pc uint64, regs op.DwarfRegisters, mem MemoryReadWriter) (int64, []op.Piece, *locationExpr, error) { instr, descr, err := bi.locationExpr(entry, attr, pc) if err != nil { return 0, nil, nil, err } - addr, pieces, err := op.ExecuteStackProgram(regs, instr, bi.Arch.PtrSize()) + readMemory := op.ReadMemoryFunc(nil) + if mem != nil { + readMemory = mem.ReadMemory + } + addr, pieces, err := op.ExecuteStackProgram(regs, instr, bi.Arch.PtrSize(), readMemory) return addr, pieces, descr, err } @@ -1011,6 +1162,38 @@ func (bi *BinaryInfo) funcToImage(fn *Function) *Image { return fn.cu.image } +// parseDebugFrameGeneral parses a debug_frame and a eh_frame section. +// At least one of the two must be present and parsed correctly, if +// debug_frame is present it must be parsable correctly. +func (bi *BinaryInfo) parseDebugFrameGeneral(image *Image, debugFrameBytes []byte, debugFrameName string, debugFrameErr error, ehFrameBytes []byte, ehFrameAddr uint64, ehFrameName string, byteOrder binary.ByteOrder) { + if debugFrameBytes == nil && ehFrameBytes == nil { + image.setLoadError(bi.logger, "could not get %s section: %v", debugFrameName, debugFrameErr) + return + } + + if debugFrameBytes != nil { + fe, err := frame.Parse(debugFrameBytes, byteOrder, image.StaticBase, bi.Arch.PtrSize(), 0) + if err != nil { + image.setLoadError(bi.logger, "could not parse %s section: %v", debugFrameName, err) + return + } + bi.frameEntries = bi.frameEntries.Append(fe) + } + + if ehFrameBytes != nil && ehFrameAddr > 0 { + fe, err := frame.Parse(ehFrameBytes, byteOrder, image.StaticBase, bi.Arch.PtrSize(), ehFrameAddr) + if err != nil { + if debugFrameBytes == nil { + image.setLoadError(bi.logger, "could not parse %s section: %v", ehFrameName, err) + return + } + bi.logger.Warnf("could not parse %s section: %v", ehFrameName, err) + return + } + bi.frameEntries = bi.frameEntries.Append(fe) + } +} + // ELF /////////////////////////////////////////////////////////////// // ErrNoBuildIDNote is used in openSeparateDebugInfo to signal there's no @@ -1032,14 +1215,16 @@ func (e *ErrNoBuildIDNote) Error() string { // will look in directories specified by the debug-info-directories config value. func (bi *BinaryInfo) openSeparateDebugInfo(image *Image, exe *elf.File, debugInfoDirectories []string) (*os.File, *elf.File, error) { var debugFilePath string + desc1, desc2, _ := parseBuildID(exe) for _, dir := range debugInfoDirectories { var potentialDebugFilePath string if strings.Contains(dir, "build-id") { - desc1, desc2, err := parseBuildID(exe) - if err != nil { - continue - } potentialDebugFilePath = fmt.Sprintf("%s/%s/%s.debug", dir, desc1, desc2) + } else if strings.HasPrefix(image.Path, "/proc") { + path, err := filepath.EvalSymlinks(image.Path) + if err == nil { + potentialDebugFilePath = fmt.Sprintf("%s/%s.debug", dir, filepath.Base(path)) + } } else { potentialDebugFilePath = fmt.Sprintf("%s/%s.debug", dir, filepath.Base(image.Path)) } @@ -1049,8 +1234,20 @@ func (bi *BinaryInfo) openSeparateDebugInfo(image *Image, exe *elf.File, debugIn break } } + // We cannot find the debug information locally on the system. Try and see if we're on a system that + // has debuginfod so that we can use that in order to find any relevant debug information. if debugFilePath == "" { - return nil, nil, ErrNoDebugInfoFound + const debuginfodFind = "debuginfod-find" + if _, err := exec.LookPath(debuginfodFind); err == nil { + cmd := exec.Command(debuginfodFind, "debuginfo", desc1+desc2) + out, err := cmd.CombinedOutput() + if err != nil { + return nil, nil, ErrNoDebugInfoFound + } + debugFilePath = string(out) + } else { + return nil, nil, ErrNoDebugInfoFound + } } sepFile, err := os.OpenFile(debugFilePath, 0, os.ModePerm) if err != nil { @@ -1169,6 +1366,8 @@ func loadBinaryInfoElf(bi *BinaryInfo, image *Image, path string, addr uint64, w image.loclist5 = loclist.NewDwarf5Reader(debugLoclistBytes) debugAddrBytes, _ := godwarf.GetDebugSectionElf(dwarfFile, "addr") image.debugAddr = godwarf.ParseAddr(debugAddrBytes) + debugLineStrBytes, _ := godwarf.GetDebugSectionElf(dwarfFile, "line_str") + image.debugLineStr = debugLineStrBytes wg.Add(3) go bi.parseDebugFrameElf(image, dwarfFile, debugInfoBytes, wg) @@ -1182,8 +1381,8 @@ func loadBinaryInfoElf(bi *BinaryInfo, image *Image, path string, addr uint64, w return nil } -// STT_FUNC is a code object, see /usr/include/elf.h for a full definition. -const STT_FUNC = 2 +// _STT_FUNC is a code object, see /usr/include/elf.h for a full definition. +const _STT_FUNC = 2 func (bi *BinaryInfo) loadSymbolName(image *Image, file *elf.File, wg *sync.WaitGroup) { defer wg.Done() @@ -1191,12 +1390,10 @@ func (bi *BinaryInfo) loadSymbolName(image *Image, file *elf.File, wg *sync.Wait bi.SymNames = make(map[uint64]*elf.Symbol) } symSecs, _ := file.Symbols() - if symSecs != nil { - for _, symSec := range symSecs { - if symSec.Info == STT_FUNC { // TODO(chainhelen), need to parse others types. - s := symSec - bi.SymNames[symSec.Value+image.StaticBase] = &s - } + for _, symSec := range symSecs { + if symSec.Info == _STT_FUNC { // TODO(chainhelen), need to parse others types. + s := symSec + bi.SymNames[symSec.Value+image.StaticBase] = &s } } } @@ -1204,13 +1401,16 @@ func (bi *BinaryInfo) loadSymbolName(image *Image, file *elf.File, wg *sync.Wait func (bi *BinaryInfo) parseDebugFrameElf(image *Image, exe *elf.File, debugInfoBytes []byte, wg *sync.WaitGroup) { defer wg.Done() - debugFrameData, err := godwarf.GetDebugSectionElf(exe, "frame") - if err != nil { - image.setLoadError("could not get .debug_frame section: %v", err) - return + debugFrameData, debugFrameErr := godwarf.GetDebugSectionElf(exe, "frame") + ehFrameSection := exe.Section(".eh_frame") + var ehFrameData []byte + var ehFrameAddr uint64 + if ehFrameSection != nil { + ehFrameAddr = ehFrameSection.Addr + ehFrameData, _ = ehFrameSection.Data() } - bi.frameEntries = bi.frameEntries.Append(frame.Parse(debugFrameData, frame.DwarfEndian(debugInfoBytes), image.StaticBase, bi.Arch.PtrSize())) + bi.parseDebugFrameGeneral(image, debugFrameData, ".debug_frame", debugFrameErr, ehFrameData, ehFrameAddr, ".eh_frame", frame.DwarfEndian(debugInfoBytes)) } func (bi *BinaryInfo) setGStructOffsetElf(image *Image, exe *elf.File, wg *sync.WaitGroup) { @@ -1224,19 +1424,9 @@ func (bi *BinaryInfo) setGStructOffsetElf(image *Image, exe *elf.File, wg *sync. // - Otherwise, Go asks the external linker to place the G pointer by // emitting runtime.tlsg, a TLS symbol, which is relocated to the chosen // offset in libc's TLS block. - symbols, err := exe.Symbols() - if err != nil { - image.setLoadError("could not parse ELF symbols: %v", err) - return - } - var tlsg *elf.Symbol - for _, symbol := range symbols { - if symbol.Name == "runtime.tlsg" { - s := symbol - tlsg = &s - break - } - } + // - On ARM64 (but really, any architecture other than i386 and 86x64) the + // offset is calculate using runtime.tls_g and the formula is different. + var tls *elf.Prog for _, prog := range exe.Progs { if prog.Type == elf.PT_TLS { @@ -1244,20 +1434,54 @@ func (bi *BinaryInfo) setGStructOffsetElf(image *Image, exe *elf.File, wg *sync. break } } - if tlsg == nil || tls == nil { - bi.gStructOffset = ^uint64(bi.Arch.PtrSize()) + 1 //-ptrSize - return + + switch exe.Machine { + case elf.EM_X86_64, elf.EM_386: + tlsg := getSymbol(image, bi.logger, exe, "runtime.tlsg") + if tlsg == nil || tls == nil { + bi.gStructOffset = ^uint64(bi.Arch.PtrSize()) + 1 //-ptrSize + return + } + + // According to https://reviews.llvm.org/D61824, linkers must pad the actual + // size of the TLS segment to ensure that (tlsoffset%align) == (vaddr%align). + // This formula, copied from the lld code, matches that. + // https://github.com/llvm-mirror/lld/blob/9aef969544981d76bea8e4d1961d3a6980980ef9/ELF/InputSection.cpp#L643 + memsz := tls.Memsz + (-tls.Vaddr-tls.Memsz)&(tls.Align-1) + + // The TLS register points to the end of the TLS block, which is + // tls.Memsz long. runtime.tlsg is an offset from the beginning of that block. + bi.gStructOffset = ^(memsz) + 1 + tlsg.Value // -tls.Memsz + tlsg.Value + + case elf.EM_AARCH64: + tlsg := getSymbol(image, bi.logger, exe, "runtime.tls_g") + if tlsg == nil || tls == nil { + bi.gStructOffset = 2 * uint64(bi.Arch.PtrSize()) + return + } + + bi.gStructOffset = tlsg.Value + uint64(bi.Arch.PtrSize()*2) + ((tls.Vaddr - uint64(bi.Arch.PtrSize()*2)) & (tls.Align - 1)) + + default: + // we should never get here + panic("architecture not supported") } +} - // According to https://reviews.llvm.org/D61824, linkers must pad the actual - // size of the TLS segment to ensure that (tlsoffset%align) == (vaddr%align). - // This formula, copied from the lld code, matches that. - // https://github.com/llvm-mirror/lld/blob/9aef969544981d76bea8e4d1961d3a6980980ef9/ELF/InputSection.cpp#L643 - memsz := tls.Memsz + (-tls.Vaddr-tls.Memsz)&(tls.Align-1) +func getSymbol(image *Image, logger *logrus.Entry, exe *elf.File, name string) *elf.Symbol { + symbols, err := exe.Symbols() + if err != nil { + image.setLoadError(logger, "could not parse ELF symbols: %v", err) + return nil + } - // The TLS register points to the end of the TLS block, which is - // tls.Memsz long. runtime.tlsg is an offset from the beginning of that block. - bi.gStructOffset = ^(memsz) + 1 + tlsg.Value // -tls.Memsz + tlsg.Value + for _, symbol := range symbols { + if symbol.Name == name { + s := symbol + return &s + } + } + return nil } // PE //////////////////////////////////////////////////////////////// @@ -1271,7 +1495,7 @@ func loadBinaryInfoPE(bi *BinaryInfo, image *Image, path string, entryPoint uint return err } image.closer = closer - cpuArch := PEMachine(peFile.Machine) + cpuArch := _PEMachine(peFile.Machine) if !supportedWindowsArch[cpuArch] { return &ErrUnsupportedArch{os: "windows", cpuArch: cpuArch} } @@ -1306,6 +1530,8 @@ func loadBinaryInfoPE(bi *BinaryInfo, image *Image, path string, entryPoint uint image.loclist5 = loclist.NewDwarf5Reader(debugLoclistBytes) debugAddrBytes, _ := godwarf.GetDebugSectionPE(peFile, "addr") image.debugAddr = godwarf.ParseAddr(debugAddrBytes) + debugLineStrBytes, _ := godwarf.GetDebugSectionPE(peFile, "line_str") + image.debugLineStr = debugLineStrBytes wg.Add(2) go bi.parseDebugFramePE(image, peFile, debugInfoBytes, wg) @@ -1336,29 +1562,7 @@ func (bi *BinaryInfo) parseDebugFramePE(image *Image, exe *pe.File, debugInfoByt defer wg.Done() debugFrameBytes, err := godwarf.GetDebugSectionPE(exe, "frame") - if err != nil { - image.setLoadError("could not get .debug_frame section: %v", err) - return - } - - bi.frameEntries = bi.frameEntries.Append(frame.Parse(debugFrameBytes, frame.DwarfEndian(debugInfoBytes), image.StaticBase, bi.Arch.PtrSize())) -} - -// Borrowed from https://golang.org/src/cmd/internal/objfile/pe.go -func findPESymbol(f *pe.File, name string) (*pe.Symbol, error) { - for _, s := range f.Symbols { - if s.Name != name { - continue - } - if s.SectionNumber <= 0 { - return nil, fmt.Errorf("symbol %s: invalid section number %d", name, s.SectionNumber) - } - if len(f.Sections) < int(s.SectionNumber) { - return nil, fmt.Errorf("symbol %s: section number %d is larger than max %d", name, s.SectionNumber, len(f.Sections)) - } - return s, nil - } - return nil, fmt.Errorf("no %s symbol found", name) + bi.parseDebugFrameGeneral(image, debugFrameBytes, ".debug_frame", err, nil, 0, "", frame.DwarfEndian(debugInfoBytes)) } // MACH-O //////////////////////////////////////////////////////////// @@ -1366,9 +1570,19 @@ func findPESymbol(f *pe.File, name string) (*pe.Symbol, error) { // loadBinaryInfoMacho specifically loads information from a Mach-O binary. func loadBinaryInfoMacho(bi *BinaryInfo, image *Image, path string, entryPoint uint64, wg *sync.WaitGroup) error { exe, err := macho.Open(path) + if err != nil { return err } + + if entryPoint != 0 { + // This is a little bit hacky. We use the entryPoint variable, but it + // actually holds the address of the mach-o header. We can use this + // to calculate the offset to the non-aslr location of the mach-o header + // (which is 0x100000000) + image.StaticBase = entryPoint - 0x100000000 + } + image.closer = exe if !supportedDarwinArch[exe.Cpu] { return &ErrUnsupportedArch{os: "darwin", cpuArch: exe.Cpu} @@ -1394,6 +1608,8 @@ func loadBinaryInfoMacho(bi *BinaryInfo, image *Image, path string, entryPoint u image.loclist5 = loclist.NewDwarf5Reader(debugLoclistBytes) debugAddrBytes, _ := godwarf.GetDebugSectionMacho(exe, "addr") image.debugAddr = godwarf.ParseAddr(debugAddrBytes) + debugLineStrBytes, _ := godwarf.GetDebugSectionMacho(exe, "line_str") + image.debugLineStr = debugLineStrBytes wg.Add(2) go bi.parseDebugFrameMacho(image, exe, debugInfoBytes, wg) @@ -1416,20 +1632,101 @@ func (bi *BinaryInfo) setGStructOffsetMacho() { func (bi *BinaryInfo) parseDebugFrameMacho(image *Image, exe *macho.File, debugInfoBytes []byte, wg *sync.WaitGroup) { defer wg.Done() - debugFrameBytes, err := godwarf.GetDebugSectionMacho(exe, "frame") - if err != nil { - image.setLoadError("could not get __debug_frame section: %v", err) + debugFrameBytes, debugFrameErr := godwarf.GetDebugSectionMacho(exe, "frame") + ehFrameSection := exe.Section("__eh_frame") + var ehFrameBytes []byte + var ehFrameAddr uint64 + if ehFrameSection != nil { + ehFrameAddr = ehFrameSection.Addr + ehFrameBytes, _ = ehFrameSection.Data() + } + + bi.parseDebugFrameGeneral(image, debugFrameBytes, "__debug_frame", debugFrameErr, ehFrameBytes, ehFrameAddr, "__eh_frame", frame.DwarfEndian(debugInfoBytes)) +} + +// macOSDebugFrameBugWorkaround applies a workaround for: +// https://github.com/golang/go/issues/25841 +// It finds the Go function with the lowest entry point and the first +// debug_frame FDE, calculates the difference between the start of the +// function and the start of the FDE and sums it to all debug_frame FDEs. +// A number of additional checks are performed to make sure we don't ruin +// executables unaffected by this bug. +func (bi *BinaryInfo) macOSDebugFrameBugWorkaround() { + //TODO: log extensively because of bugs in the field + if bi.GOOS != "darwin" || bi.Arch.Name != "arm64" { + return + } + if len(bi.Images) > 1 { + // Only do this for the first executable, but it might work for plugins as + // well if we had a way to distinguish where entries in bi.frameEntries + // come from + return + } + exe, ok := bi.Images[0].closer.(*macho.File) + if !ok { + return + } + if exe.Flags&macho.FlagPIE == 0 { + bi.logger.Infof("debug_frame workaround not needed: not a PIE (%#x)", exe.Flags) + return + } + + // Find first Go function (first = lowest entry point) + var fn *Function + for i := range bi.Functions { + if bi.Functions[i].cu.isgo && bi.Functions[i].Entry > 0 { + fn = &bi.Functions[i] + break + } + } + if fn == nil { + bi.logger.Warn("debug_frame workaround not applied: could not find a Go function") + return + } + + if fde, _ := bi.frameEntries.FDEForPC(fn.Entry); fde != nil { + // Function is covered, no need to apply workaround + bi.logger.Warnf("debug_frame workaround not applied: function %s (at %#x) covered by %#x-%#x", fn.Name, fn.Entry, fde.Begin(), fde.End()) + return + } + + // Find lowest FDE in debug_frame + var fde *frame.FrameDescriptionEntry + for i := range bi.frameEntries { + if bi.frameEntries[i].CIE.CIE_id == ^uint32(0) { + fde = bi.frameEntries[i] + break + } + } + + if fde == nil { + bi.logger.Warnf("debug_frame workaround not applied because there are no debug_frame entries (%d)", len(bi.frameEntries)) return } - bi.frameEntries = bi.frameEntries.Append(frame.Parse(debugFrameBytes, frame.DwarfEndian(debugInfoBytes), image.StaticBase, bi.Arch.PtrSize())) + fnsize := fn.End - fn.Entry + + if fde.End()-fde.Begin() != fnsize || fde.Begin() > fn.Entry { + bi.logger.Warnf("debug_frame workaround not applied: function %s (at %#x-%#x) has a different size than the first FDE (%#x-%#x) (or the FDE starts after the function)", fn.Name, fn.Entry, fn.End, fde.Begin(), fde.End()) + return + } + + delta := fn.Entry - fde.Begin() + + bi.logger.Infof("applying debug_frame workaround +%#x: function %s (at %#x-%#x) and FDE %#x-%#x", delta, fn.Name, fn.Entry, fn.End, fde.Begin(), fde.End()) + + for i := range bi.frameEntries { + if bi.frameEntries[i].CIE.CIE_id == ^uint32(0) { + bi.frameEntries[i].Translate(delta) + } + } } // Do not call this function directly it isn't able to deal correctly with package paths func (bi *BinaryInfo) findType(name string) (godwarf.Type, error) { ref, found := bi.types[name] if !found { - return nil, reader.TypeNotFoundErr + return nil, reader.ErrTypeNotFound } image := bi.Images[ref.imageIndex] return godwarf.ReadType(image.dwarf, ref.imageIndex, ref.offset, image.typeCache) @@ -1549,6 +1846,9 @@ func (bi *BinaryInfo) loadDebugInfoMaps(image *Image, debugInfoBytes, debugLineB if bi.inlinedCallLines == nil { bi.inlinedCallLines = make(map[fileLine][]uint64) } + if bi.dwrapUnwrapCache == nil { + bi.dwrapUnwrapCache = make(map[uint64]*Function) + } image.runtimeTypeToDIE = make(map[uint64]runtimeTypeDIE) @@ -1556,9 +1856,13 @@ func (bi *BinaryInfo) loadDebugInfoMaps(image *Image, debugInfoBytes, debugLineB reader := image.DwarfReader() - for entry, err := reader.Next(); entry != nil; entry, err = reader.Next() { + for { + entry, err := reader.Next() if err != nil { - image.setLoadError("error reading debug_info: %v", err) + image.setLoadError(bi.logger, "error reading debug_info: %v", err) + break + } + if entry == nil { break } switch entry.Tag { @@ -1594,7 +1898,7 @@ func (bi *BinaryInfo) loadDebugInfoMaps(image *Image, debugInfoBytes, debugLineB logger.Printf(fmt, args) } } - cu.lineInfo = line.Parse(compdir, bytes.NewBuffer(debugLineBytes[lineInfoOffset:]), logfn, image.StaticBase, bi.GOOS == "windows", bi.Arch.PtrSize()) + cu.lineInfo = line.Parse(compdir, bytes.NewBuffer(debugLineBytes[lineInfoOffset:]), image.debugLineStr, logfn, image.StaticBase, bi.GOOS == "windows", bi.Arch.PtrSize()) } cu.producer, _ = entry.Val(dwarf.AttrProducer).(string) if cu.isgo && cu.producer != "" { @@ -1603,6 +1907,13 @@ func (bi *BinaryInfo) loadDebugInfoMaps(image *Image, debugInfoBytes, debugLineB cu.optimized = goversion.ProducerAfterOrEqual(cu.producer, 1, 10) } else { cu.optimized = !strings.Contains(cu.producer[semicolon:], "-N") || !strings.Contains(cu.producer[semicolon:], "-l") + const regabi = " regabi" + if i := strings.Index(cu.producer[semicolon:], regabi); i > 0 { + i += semicolon + if i+len(regabi) >= len(cu.producer) || cu.producer[i+len(regabi)] == ' ' { + bi.regabi = true + } + } cu.producer = cu.producer[:semicolon] } } @@ -1629,6 +1940,7 @@ func (bi *BinaryInfo) loadDebugInfoMaps(image *Image, debugInfoBytes, debugLineB sort.Sort(packageVarsByAddr(bi.packageVars)) bi.LookupFunc = make(map[string]*Function) + bi.lookupGenericFunc = nil for i := range bi.Functions { bi.LookupFunc[bi.Functions[i].Name] = &bi.Functions[i] } @@ -1643,22 +1955,60 @@ func (bi *BinaryInfo) loadDebugInfoMaps(image *Image, debugInfoBytes, debugLineB sort.Strings(bi.Sources) bi.Sources = uniq(bi.Sources) + if bi.regabi { + // prepare patch for runtime.mallocgc's DIE + fn := bi.LookupFunc["runtime.mallocgc"] + if fn != nil && fn.cu.image == image { + tree, err := image.getDwarfTree(fn.offset) + if err == nil { + tree.Children, err = regabiMallocgcWorkaround(bi) + if err != nil { + bi.logger.Errorf("could not patch runtime.mallogc: %v", err) + } else { + image.runtimeMallocgcTree = tree + } + } + } + } + if cont != nil { cont() } } +// LookupGenericFunc returns a map that allows searching for instantiations of generic function by specificying a function name without type parameters. +// For example the key "pkg.(*Receiver).Amethod" will find all instantiations of Amethod: +// - pkg.(*Receiver[.shape.int]).Amethod" +// - pkg.(*Receiver[.shape.*uint8]).Amethod" +// - etc. +func (bi *BinaryInfo) LookupGenericFunc() map[string][]*Function { + if bi.lookupGenericFunc == nil { + bi.lookupGenericFunc = make(map[string][]*Function) + for i := range bi.Functions { + dn := bi.Functions[i].NameWithoutTypeParams() + if dn != bi.Functions[i].Name { + bi.lookupGenericFunc[dn] = append(bi.lookupGenericFunc[dn], &bi.Functions[i]) + } + } + } + return bi.lookupGenericFunc +} + // loadDebugInfoMapsCompileUnit loads entry from a single compile unit. func (bi *BinaryInfo) loadDebugInfoMapsCompileUnit(ctxt *loadDebugInfoMapsContext, image *Image, reader *reader.Reader, cu *compileUnit) { hasAttrGoPkgName := goversion.ProducerAfterOrEqual(cu.producer, 1, 13) depth := 0 - for entry, err := reader.Next(); entry != nil; entry, err = reader.Next() { + for { + entry, err := reader.Next() if err != nil { - image.setLoadError("error reading debug_info: %v", err) + image.setLoadError(bi.logger, "error reading debug_info: %v", err) return } + if entry == nil { + break + } switch entry.Tag { case 0: if depth == 0 { @@ -1722,7 +2072,7 @@ func (bi *BinaryInfo) loadDebugInfoMapsCompileUnit(ctxt *loadDebugInfoMapsContex case dwarf.TagSubprogram: inlined := false if inval, ok := entry.Val(dwarf.AttrInline).(int64); ok { - inlined = inval == 1 + inlined = inval >= 1 } if inlined { @@ -1768,24 +2118,19 @@ func (bi *BinaryInfo) addAbstractSubprogram(entry *dwarf.Entry, ctxt *loadDebugI name, ok := subprogramEntryName(entry, cu) if !ok { bi.logger.Warnf("reading debug_info: abstract subprogram without name at %#x", entry.Offset) - if entry.Children { - reader.SkipChildren() - } - return - } - - fn := Function{ - Name: name, - offset: entry.Offset, - cu: cu, + // In some cases clang produces abstract subprograms that do not have a + // name, but we should process them anyway. } if entry.Children { bi.loadDebugInfoMapsInlinedCalls(ctxt, reader, cu) } - bi.Functions = append(bi.Functions, fn) - ctxt.abstractOriginTable[entry.Offset] = len(bi.Functions) - 1 + originIdx := ctxt.lookupAbstractOrigin(bi, entry.Offset) + fn := &bi.Functions[originIdx] + fn.Name = name + fn.offset = entry.Offset + fn.cu = cu } // addConcreteInlinedSubprogram adds the concrete entry of a subprogram that was also inlined. @@ -1799,19 +2144,12 @@ func (bi *BinaryInfo) addConcreteInlinedSubprogram(entry *dwarf.Entry, originOff return } - originIdx, ok := ctxt.abstractOriginTable[originOffset] - if !ok { - bi.logger.Warnf("reading debug_info: could not find abstract origin of concrete inlined subprogram at %#x (origin offset %#x)", entry.Offset, originOffset) - if entry.Children { - reader.SkipChildren() - } - return - } - + originIdx := ctxt.lookupAbstractOrigin(bi, originOffset) fn := &bi.Functions[originIdx] fn.offset = entry.Offset fn.Entry = lowpc fn.End = highpc + fn.cu = cu if entry.Children { bi.loadDebugInfoMapsInlinedCalls(ctxt, reader, cu) @@ -1824,29 +2162,28 @@ func (bi *BinaryInfo) addConcreteSubprogram(entry *dwarf.Entry, ctxt *loadDebugI lowpc, highpc, ok := subprogramEntryRange(entry, cu.image) if !ok { bi.logger.Warnf("reading debug_info: concrete subprogram without address range at %#x", entry.Offset) - if entry.Children { - reader.SkipChildren() - } - return + // When clang inlines a function, in some cases, it produces a concrete + // subprogram without address range and then inlined calls that reference + // it, instead of producing an abstract subprogram. + // It is unclear if this behavior is standard. } name, ok := subprogramEntryName(entry, cu) if !ok { bi.logger.Warnf("reading debug_info: concrete subprogram without name at %#x", entry.Offset) - if entry.Children { - reader.SkipChildren() - } - return } - fn := Function{ - Name: name, - Entry: lowpc, - End: highpc, - offset: entry.Offset, - cu: cu, - } - bi.Functions = append(bi.Functions, fn) + trampoline, _ := entry.Val(dwarf.AttrTrampoline).(bool) + + originIdx := ctxt.lookupAbstractOrigin(bi, entry.Offset) + fn := &bi.Functions[originIdx] + + fn.Name = name + fn.Entry = lowpc + fn.End = highpc + fn.offset = entry.Offset + fn.cu = cu + fn.trampoline = trampoline if entry.Children { bi.loadDebugInfoMapsInlinedCalls(ctxt, reader, cu) @@ -1878,7 +2215,7 @@ func (bi *BinaryInfo) loadDebugInfoMapsInlinedCalls(ctxt *loadDebugInfoMapsConte for { entry, err := reader.Next() if err != nil { - cu.image.setLoadError("error reading debug_info: %v", err) + cu.image.setLoadError(bi.logger, "error reading debug_info: %v", err) return } switch entry.Tag { @@ -1892,14 +2229,6 @@ func (bi *BinaryInfo) loadDebugInfoMapsInlinedCalls(ctxt *loadDebugInfoMapsConte continue } - originIdx, ok := ctxt.abstractOriginTable[originOffset] - if !ok { - bi.logger.Warnf("reading debug_info: could not find abstract origin (%#x) of inlined call at %#x", originOffset, entry.Offset) - reader.SkipChildren() - continue - } - fn := &bi.Functions[originIdx] - lowpc, highpc, ok := subprogramEntryRange(entry, cu.image) if !ok { bi.logger.Warnf("reading debug_info: inlined call without address range at %#x", entry.Offset) @@ -1914,17 +2243,15 @@ func (bi *BinaryInfo) loadDebugInfoMapsInlinedCalls(ctxt *loadDebugInfoMapsConte reader.SkipChildren() continue } - if cu.lineInfo == nil { - bi.logger.Warnf("reading debug_info: inlined call on a compilation unit without debug_line section at %#x", entry.Offset) - reader.SkipChildren() - continue - } - if int(callfileidx-1) >= len(cu.lineInfo.FileNames) { - bi.logger.Warnf("reading debug_info: CallFile (%d) of inlined call does not exist in compile unit file table at %#x", callfileidx, entry.Offset) + callfile, cferr := cu.filePath(int(callfileidx), entry) + if cferr != nil { + bi.logger.Warnf("%v", cferr) reader.SkipChildren() continue } - callfile := cu.lineInfo.FileNames[callfileidx-1].Path + + originIdx := ctxt.lookupAbstractOrigin(bi, originOffset) + fn := &bi.Functions[originIdx] fn.InlinedCalls = append(fn.InlinedCalls, InlinedCall{ cu: cu, @@ -1932,6 +2259,10 @@ func (bi *BinaryInfo) loadDebugInfoMapsInlinedCalls(ctxt *loadDebugInfoMapsConte HighPC: highpc, }) + if fn.cu == nil { + fn.cu = cu + } + fl := fileLine{callfile, int(callline)} bi.inlinedCallLines[fl] = append(bi.inlinedCallLines[fl], lowpc) } @@ -2085,3 +2416,25 @@ func (bi *BinaryInfo) ListPackagesBuildInfo(includeFiles bool) []*PackageBuildIn sort.Slice(r, func(i, j int) bool { return r[i].ImportPath < r[j].ImportPath }) return r } + +// cuFilePath takes a compilation unit "cu" and a file index reference +// "fileidx" and returns the corresponding file name entry from the +// DWARF line table associated with the unit; "entry" is the offset of +// the attribute where the file reference originated, for logging +// purposes. Return value is the file string and an error value; error +// will be non-nil if the file could not be recovered, perhaps due to +// malformed DWARF. +func (cu *compileUnit) filePath(fileidx int, entry *dwarf.Entry) (string, error) { + if cu.lineInfo == nil { + return "", fmt.Errorf("reading debug_info: file reference within a compilation unit without debug_line section at %#x", entry.Offset) + } + // File numbering is slightly different before and after DWARF 5; + // account for this here. See section 6.2.4 of the DWARF 5 spec. + if cu.Version < 5 { + fileidx-- + } + if fileidx < 0 || fileidx >= len(cu.lineInfo.FileNames) { + return "", fmt.Errorf("reading debug_info: file index (%d) out of range in compile unit file table at %#x", fileidx, entry.Offset) + } + return cu.lineInfo.FileNames[fileidx].Path, nil +} diff --git a/pkg/proc/breakpoints.go b/pkg/proc/breakpoints.go index bcd7cb2736..538746a4bd 100644 --- a/pkg/proc/breakpoints.go +++ b/pkg/proc/breakpoints.go @@ -1,11 +1,20 @@ package proc import ( + "debug/dwarf" "errors" "fmt" "go/ast" "go/constant" + "go/parser" + "go/token" "reflect" + + "github.com/go-delve/delve/pkg/dwarf/godwarf" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/reader" + "github.com/go-delve/delve/pkg/goversion" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" ) const ( @@ -18,6 +27,8 @@ const ( unrecoveredPanicID = -1 fatalThrowID = -2 + + NoLogicalID = -1000 // Logical breakpoint ID for breakpoints internal breakpoints. ) // Breakpoint represents a physical breakpoint. Stores information on the break @@ -32,23 +43,43 @@ type Breakpoint struct { Addr uint64 // Address breakpoint is set for. OriginalData []byte // If software breakpoint, the data we replace with breakpoint instruction. Name string // User defined name of the breakpoint - LogicalID int // ID of the logical breakpoint that owns this physical breakpoint - // Kind describes whether this is an internal breakpoint (for next'ing or + WatchExpr string + WatchType WatchType + HWBreakIndex uint8 // hardware breakpoint index + watchStackOff int64 // for watchpoints of stack variables, offset of the address from top of the stack + + // Breaklets is the list of overlapping breakpoints on this physical breakpoint. + // There can be at most one UserBreakpoint in this list but multiple internal breakpoints are allowed. + Breaklets []*Breaklet + + // Breakpoint information + Tracepoint bool // Tracepoint flag + TraceReturn bool + Goroutine bool // Retrieve goroutine information + Stacktrace int // Number of stack frames to retrieve + Variables []string // Variables to evaluate + LoadArgs *LoadConfig + LoadLocals *LoadConfig + UserData interface{} // Any additional information about the breakpoint + + // ReturnInfo describes how to collect return variables when this + // breakpoint is hit as a return breakpoint. + returnInfo *returnBreakpointInfo +} + +// Breaklet represents one of multiple breakpoints that can overlap on a +// single physical breakpoint. +type Breaklet struct { + // Kind describes whether this is a stepping breakpoint (for next'ing or // stepping). - // A single breakpoint can be both a UserBreakpoint and some kind of - // internal breakpoint, but it can not be two different kinds of internal - // breakpoint. Kind BreakpointKind - // Breakpoint information - Tracepoint bool // Tracepoint flag - TraceReturn bool - Goroutine bool // Retrieve goroutine information - Stacktrace int // Number of stack frames to retrieve - Variables []string // Variables to evaluate - LoadArgs *LoadConfig - LoadLocals *LoadConfig + LogicalID int // ID of the logical breakpoint that owns this physical breakpoint + + // Cond: if not nil the breakpoint will be triggered only if evaluating Cond returns true + Cond ast.Expr + HitCount map[int]uint64 // Number of times a breakpoint has been reached in a certain goroutine TotalHitCount uint64 // Number of times a breakpoint has been reached @@ -62,14 +93,27 @@ type Breakpoint struct { // function only triggers on panic or on the defer call to // the function, not when the function is called directly DeferReturns []uint64 - // Cond: if not nil the breakpoint will be triggered only if evaluating Cond returns true - Cond ast.Expr - // internalCond is the same as Cond but used for the condition of internal breakpoints - internalCond ast.Expr - // ReturnInfo describes how to collect return variables when this - // breakpoint is hit as a return breakpoint. - returnInfo *returnBreakpointInfo + // HitCond: if not nil the breakpoint will be triggered only if the evaluated HitCond returns + // true with the TotalHitCount. + HitCond *struct { + Op token.Token + Val int + } + + // checkPanicCall checks that the breakpoint happened while the function was + // called by a panic. It is only checked for WatchOutOfScopeBreakpoint Kind. + checkPanicCall bool + + // callback is called if every other condition for this breaklet is met, + // the return value will determine if the breaklet should be considered + // active. + // The callback can have side-effects. + callback func(th Thread) bool + + // For WatchOutOfScopeBreakpoints and StackResizeBreakpoints the watchpoint + // field contains the watchpoint related to this out of scope sentinel. + watchpoint *Breakpoint } // BreakpointKind determines the behavior of delve when the @@ -91,10 +135,91 @@ const ( // Continue will set a new breakpoint (of NextBreakpoint kind) on the // destination of CALL, delete this breakpoint and then continue again StepBreakpoint + + // WatchOutOfScopeBreakpoint is a breakpoint used to detect when a watched + // stack variable goes out of scope. + WatchOutOfScopeBreakpoint + + // StackResizeBreakpoint is a breakpoint used to detect stack resizes to + // adjust the watchpoint of stack variables. + StackResizeBreakpoint + + steppingMask = NextBreakpoint | NextDeferBreakpoint | StepBreakpoint +) + +// WatchType is the watchpoint type +type WatchType uint8 + +const ( + WatchRead WatchType = 1 << iota + WatchWrite ) +// Read returns true if the hardware breakpoint should trigger on memory reads. +func (wtype WatchType) Read() bool { + return wtype&WatchRead != 0 +} + +// Write returns true if the hardware breakpoint should trigger on memory writes. +func (wtype WatchType) Write() bool { + return wtype&WatchWrite != 0 +} + +// Size returns the size in bytes of the hardware breakpoint. +func (wtype WatchType) Size() int { + return int(wtype >> 4) +} + +// withSize returns a new HWBreakType with the size set to the specified value +func (wtype WatchType) withSize(sz uint8) WatchType { + return WatchType((sz << 4) | uint8(wtype&0xf)) +} + +var ErrHWBreakUnsupported = errors.New("hardware breakpoints not implemented") + func (bp *Breakpoint) String() string { - return fmt.Sprintf("Breakpoint %d at %#v %s:%d (%d)", bp.LogicalID, bp.Addr, bp.File, bp.Line, bp.TotalHitCount) + return fmt.Sprintf("Breakpoint %d at %#v %s:%d", bp.LogicalID(), bp.Addr, bp.File, bp.Line) +} + +func (bp *Breakpoint) LogicalID() int { + for _, breaklet := range bp.Breaklets { + if breaklet.Kind == UserBreakpoint { + return breaklet.LogicalID + } + } + return NoLogicalID +} + +// VerboseDescr returns a string describing parts of the breakpoint struct +// that aren't otherwise user visible, for debugging purposes. +func (bp *Breakpoint) VerboseDescr() []string { + r := []string{} + + r = append(r, fmt.Sprintf("OriginalData=%#x", bp.OriginalData)) + + if bp.WatchType != 0 { + r = append(r, fmt.Sprintf("HWBreakIndex=%#x watchStackOff=%#x", bp.HWBreakIndex, bp.watchStackOff)) + } + + for _, breaklet := range bp.Breaklets { + switch breaklet.Kind { + case UserBreakpoint: + r = append(r, fmt.Sprintf("User Cond=%q HitCond=%v", exprToString(breaklet.Cond), breaklet.HitCond)) + case NextBreakpoint: + r = append(r, fmt.Sprintf("Next Cond=%q", exprToString(breaklet.Cond))) + case NextDeferBreakpoint: + r = append(r, fmt.Sprintf("NextDefer Cond=%q DeferReturns=%#x", exprToString(breaklet.Cond), breaklet.DeferReturns)) + case StepBreakpoint: + r = append(r, fmt.Sprintf("Step Cond=%q", exprToString(breaklet.Cond))) + case WatchOutOfScopeBreakpoint: + r = append(r, fmt.Sprintf("WatchOutOfScope Cond=%q checkPanicCall=%v", exprToString(breaklet.Cond), breaklet.checkPanicCall)) + case StackResizeBreakpoint: + r = append(r, fmt.Sprintf("StackResizeBreakpoint Cond=%q", exprToString(breaklet.Cond))) + default: + r = append(r, fmt.Sprintf("Unknown %d", breaklet.Kind)) + } + } + return r } // BreakpointExistsError is returned when trying to set a breakpoint at @@ -127,45 +252,133 @@ type returnBreakpointInfo struct { } // CheckCondition evaluates bp's condition on thread. -func (bp *Breakpoint) CheckCondition(thread Thread) BreakpointState { - bpstate := BreakpointState{Breakpoint: bp, Active: false, Internal: false, CondError: nil} - if bp.Cond == nil && bp.internalCond == nil { - bpstate.Active = true - bpstate.Internal = bp.IsInternal() - return bpstate - } - nextDeferOk := true - if bp.Kind&NextDeferBreakpoint != 0 { - var err error - frames, err := ThreadStacktrace(thread, 2) - if err == nil { - nextDeferOk = isPanicCall(frames) - if !nextDeferOk { - nextDeferOk, _ = isDeferReturnCall(frames, bp.DeferReturns) +func (bp *Breakpoint) checkCondition(tgt *Target, thread Thread, bpstate *BreakpointState) { + *bpstate = BreakpointState{Breakpoint: bp, Active: false, Stepping: false, SteppingInto: false, CondError: nil} + for _, breaklet := range bp.Breaklets { + bpstate.checkCond(tgt, breaklet, thread) + } +} + +func (bpstate *BreakpointState) checkCond(tgt *Target, breaklet *Breaklet, thread Thread) { + var condErr error + active := true + if breaklet.Cond != nil { + active, condErr = evalBreakpointCondition(tgt, thread, breaklet.Cond) + } + + if condErr != nil && bpstate.CondError == nil { + bpstate.CondError = condErr + } + if !active { + return + } + + switch breaklet.Kind { + case UserBreakpoint: + if g, err := GetG(thread); err == nil { + breaklet.HitCount[g.ID]++ + } + breaklet.TotalHitCount++ + active = checkHitCond(breaklet) + + case StepBreakpoint, NextBreakpoint, NextDeferBreakpoint: + nextDeferOk := true + if breaklet.Kind&NextDeferBreakpoint != 0 { + var err error + frames, err := ThreadStacktrace(thread, 2) + if err == nil { + nextDeferOk, _ = isPanicCall(frames) + if !nextDeferOk { + nextDeferOk, _ = isDeferReturnCall(frames, breaklet.DeferReturns) + } + } + } + active = active && nextDeferOk + if active { + bpstate.Stepping = true + if breaklet.Kind == StepBreakpoint { + bpstate.SteppingInto = true + } + } + + case WatchOutOfScopeBreakpoint: + if breaklet.checkPanicCall { + frames, err := ThreadStacktrace(thread, 2) + if err == nil { + ipc, _ := isPanicCall(frames) + active = active && ipc } } + + case StackResizeBreakpoint: + // no further checks + + default: + bpstate.CondError = fmt.Errorf("internal error unknown breakpoint kind %v", breaklet.Kind) } - if bp.IsInternal() { - // Check internalCondition if this is also an internal breakpoint - bpstate.Active, bpstate.CondError = evalBreakpointCondition(thread, bp.internalCond) - bpstate.Active = bpstate.Active && nextDeferOk - if bpstate.Active || bpstate.CondError != nil { - bpstate.Internal = true - return bpstate + + if active { + if breaklet.callback != nil { + active = breaklet.callback(thread) } + bpstate.Active = active } - if bp.IsUser() { - // Check normal condition if this is also a user breakpoint - bpstate.Active, bpstate.CondError = evalBreakpointCondition(thread, bp.Cond) +} + +// checkHitCond evaluates bp's hit condition on thread. +func checkHitCond(breaklet *Breaklet) bool { + if breaklet.HitCond == nil { + return true + } + // Evaluate the breakpoint condition. + switch breaklet.HitCond.Op { + case token.EQL: + return int(breaklet.TotalHitCount) == breaklet.HitCond.Val + case token.NEQ: + return int(breaklet.TotalHitCount) != breaklet.HitCond.Val + case token.GTR: + return int(breaklet.TotalHitCount) > breaklet.HitCond.Val + case token.LSS: + return int(breaklet.TotalHitCount) < breaklet.HitCond.Val + case token.GEQ: + return int(breaklet.TotalHitCount) >= breaklet.HitCond.Val + case token.LEQ: + return int(breaklet.TotalHitCount) <= breaklet.HitCond.Val + case token.REM: + return int(breaklet.TotalHitCount)%breaklet.HitCond.Val == 0 } - return bpstate + return false } -func isPanicCall(frames []Stackframe) bool { - return len(frames) >= 3 && frames[2].Current.Fn != nil && frames[2].Current.Fn.Name == "runtime.gopanic" +func isPanicCall(frames []Stackframe) (bool, int) { + // In Go prior to 1.17 the call stack for a panic is: + // 0. deferred function call + // 1. runtime.callN + // 2. runtime.gopanic + // in Go after 1.17 it is either: + // 0. deferred function call + // 1. deferred call wrapper + // 2. runtime.gopanic + // or: + // 0. deferred function call + // 1. runtime.gopanic + if len(frames) >= 3 && frames[2].Current.Fn != nil && frames[2].Current.Fn.Name == "runtime.gopanic" { + return true, 2 + } + if len(frames) >= 2 && frames[1].Current.Fn != nil && frames[1].Current.Fn.Name == "runtime.gopanic" { + return true, 1 + } + return false, 0 } func isDeferReturnCall(frames []Stackframe, deferReturns []uint64) (bool, uint64) { + if len(frames) >= 2 && (len(deferReturns) > 0) { + // On Go 1.18 and later runtime.deferreturn doesn't use jmpdefer anymore, + // it's a normal function making normal calls to deferred functions. + if frames[1].Current.Fn != nil && frames[1].Current.Fn.Name == "runtime.deferreturn" { + return true, 0 + } + } if len(frames) >= 1 { for _, pc := range deferReturns { if frames[0].Ret == pc { @@ -176,27 +389,48 @@ func isDeferReturnCall(frames []Stackframe, deferReturns []uint64) (bool, uint64 return false, 0 } -// IsInternal returns true if bp is an internal breakpoint. -// User-set breakpoints can overlap with internal breakpoints, in that case -// both IsUser and IsInternal will be true. -func (bp *Breakpoint) IsInternal() bool { - return bp.Kind != UserBreakpoint +// IsStepping returns true if bp is an stepping breakpoint. +// User-set breakpoints can overlap with stepping breakpoints, in that case +// both IsUser and IsStepping will be true. +func (bp *Breakpoint) IsStepping() bool { + for _, breaklet := range bp.Breaklets { + if breaklet.Kind&steppingMask != 0 { + return true + } + } + return false } // IsUser returns true if bp is a user-set breakpoint. -// User-set breakpoints can overlap with internal breakpoints, in that case -// both IsUser and IsInternal will be true. +// User-set breakpoints can overlap with stepping breakpoints, in that case +// both IsUser and IsStepping will be true. func (bp *Breakpoint) IsUser() bool { - return bp.Kind&UserBreakpoint != 0 + for _, breaklet := range bp.Breaklets { + if breaklet.Kind == UserBreakpoint { + return true + } + } + return false } -func evalBreakpointCondition(thread Thread, cond ast.Expr) (bool, error) { +// UserBreaklet returns the user breaklet for this breakpoint, or nil if +// none exist. +func (bp *Breakpoint) UserBreaklet() *Breaklet { + for _, breaklet := range bp.Breaklets { + if breaklet.Kind == UserBreakpoint { + return breaklet + } + } + return nil +} + +func evalBreakpointCondition(tgt *Target, thread Thread, cond ast.Expr) (bool, error) { if cond == nil { return true, nil } - scope, err := GoroutineScope(thread) + scope, err := GoroutineScope(tgt, thread) if err != nil { - scope, err = ThreadScope(thread) + scope, err = ThreadScope(tgt, thread) if err != nil { return true, err } @@ -229,8 +463,11 @@ func (nbp NoBreakpointError) Error() string { type BreakpointMap struct { M map[uint64]*Breakpoint - breakpointIDCounter int - internalBreakpointIDCounter int + // WatchOutOfScope is the list of watchpoints that went out of scope during + // the last resume operation + WatchOutOfScope []*Breakpoint + + breakpointIDCounter int } // NewBreakpointMap creates a new BreakpointMap. @@ -243,128 +480,363 @@ func NewBreakpointMap() BreakpointMap { // SetBreakpoint sets a breakpoint at addr, and stores it in the process wide // break point table. func (t *Target) SetBreakpoint(addr uint64, kind BreakpointKind, cond ast.Expr) (*Breakpoint, error) { - if valid, err := t.Valid(); !valid { + return t.setBreakpointInternal(addr, kind, 0, cond) +} + +// SetEBPFTracepoint will attach a uprobe to the function +// specified by 'fnName'. +func (t *Target) SetEBPFTracepoint(fnName string) error { + // Not every OS/arch that we support has support for eBPF, + // so check early and return an error if this is called on an + // unsupported system. + if !t.proc.SupportsBPF() { + return errors.New("eBPF is not supported") + } + fns, err := t.BinInfo().FindFunction(fnName) + if err != nil { + return err + } + + // Get information on the Goroutine so we can tell the + // eBPF program where to find it in order to get the + // goroutine ID. + rdr := t.BinInfo().Images[0].DwarfReader() + rdr.SeekToTypeNamed("runtime.g") + typ, err := t.BinInfo().findType("runtime.g") + if err != nil { + return errors.New("could not find type for runtime.g") + } + var goidOffset int64 + switch t := typ.(type) { + case *godwarf.StructType: + for _, field := range t.Field { + if field.Name == "goid" { + goidOffset = field.ByteOffset + break + } + } + } + + for _, fn := range fns { + err := t.setEBPFTracepointOnFunc(fn, goidOffset) + if err != nil { + return err + } + } + return nil +} + +func (t *Target) setEBPFTracepointOnFunc(fn *Function, goidOffset int64) error { + // Start putting together the argument map. This will tell the eBPF program + // all of the arguments we want to trace and how to find them. + + // Start looping through each argument / return parameter for the function we + // are setting the uprobe on. Parse location information so that we can pass it + // along to the eBPF program. + dwarfTree, err := fn.cu.image.getDwarfTree(fn.offset) + if err != nil { + return err + } + variablesFlags := reader.VariablesOnlyVisible + if t.BinInfo().Producer() != "" && goversion.ProducerAfterOrEqual(t.BinInfo().Producer(), 1, 15) { + variablesFlags |= reader.VariablesTrustDeclLine + } + _, l, _ := t.BinInfo().PCToLine(fn.Entry) + + var args []ebpf.UProbeArgMap + varEntries := reader.Variables(dwarfTree, fn.Entry, l, variablesFlags) + for _, entry := range varEntries { + _, dt, err := readVarEntry(entry.Tree, fn.cu.image) + if err != nil { + return err + } + + offset, pieces, _, err := t.BinInfo().Location(entry, dwarf.AttrLocation, fn.Entry, op.DwarfRegisters{}, nil) + if err != nil { + return err + } + paramPieces := make([]int, 0, len(pieces)) + for _, piece := range pieces { + if piece.Kind == op.RegPiece { + paramPieces = append(paramPieces, int(piece.Val)) + } + } + isret, _ := entry.Val(dwarf.AttrVarParam).(bool) + offset += int64(t.BinInfo().Arch.PtrSize()) + args = append(args, ebpf.UProbeArgMap{ + Offset: offset, + Size: dt.Size(), + Kind: dt.Common().ReflectKind, + Pieces: paramPieces, + InReg: len(pieces) > 0, + Ret: isret, + }) + } + + //TODO(aarzilli): inlined calls? + + // Finally, set the uprobe on the function. + t.proc.SetUProbe(fn.Name, goidOffset, args) + return nil +} + +// SetWatchpoint sets a data breakpoint at addr and stores it in the +// process wide break point table. +func (t *Target) SetWatchpoint(scope *EvalScope, expr string, wtype WatchType, cond ast.Expr) (*Breakpoint, error) { + if (wtype&WatchWrite == 0) && (wtype&WatchRead == 0) { + return nil, errors.New("at least one of read and write must be set for watchpoint") + } + + n, err := parser.ParseExpr(expr) + if err != nil { + return nil, err + } + xv, err := scope.evalAST(n) + if err != nil { return nil, err } + if xv.Addr == 0 || xv.Flags&VariableFakeAddress != 0 || xv.DwarfType == nil { + return nil, fmt.Errorf("can not watch %q", expr) + } + if xv.Unreadable != nil { + return nil, fmt.Errorf("expression %q is unreadable: %v", expr, xv.Unreadable) + } + if xv.Kind == reflect.UnsafePointer || xv.Kind == reflect.Invalid { + return nil, fmt.Errorf("can not watch variable of type %s", xv.Kind.String()) + } + sz := xv.DwarfType.Size() + if sz <= 0 || sz > int64(t.BinInfo().Arch.PtrSize()) { + //TODO(aarzilli): it is reasonable to expect to be able to watch string + //and interface variables and we could support it by watching certain + //member fields here. + return nil, fmt.Errorf("can not watch variable of type %s", xv.DwarfType.String()) + } + + stackWatch := scope.g != nil && !scope.g.SystemStack && xv.Addr >= scope.g.stack.lo && xv.Addr < scope.g.stack.hi + + if stackWatch && wtype&WatchRead != 0 { + // In theory this would work except for the fact that the runtime will + // read them randomly to resize stacks so it doesn't make sense to do + // this. + return nil, errors.New("can not watch stack allocated variable for reads") + } + + bp, err := t.setBreakpointInternal(xv.Addr, UserBreakpoint, wtype.withSize(uint8(sz)), cond) + if err != nil { + return bp, err + } + bp.WatchExpr = expr + + if stackWatch { + bp.watchStackOff = int64(bp.Addr) - int64(scope.g.stack.hi) + err := t.setStackWatchBreakpoints(scope, bp) + if err != nil { + return bp, err + } + } + + return bp, nil +} + +func (t *Target) setBreakpointInternal(addr uint64, kind BreakpointKind, wtype WatchType, cond ast.Expr) (*Breakpoint, error) { + if valid, err := t.Valid(); !valid { + recorded, _ := t.Recorded() + if !recorded { + return nil, err + } + } bpmap := t.Breakpoints() + newBreaklet := &Breaklet{Kind: kind, Cond: cond} + if kind == UserBreakpoint { + newBreaklet.HitCount = map[int]uint64{} + bpmap.breakpointIDCounter++ + newBreaklet.LogicalID = bpmap.breakpointIDCounter + } if bp, ok := bpmap.M[addr]; ok { - // We can overlap one internal breakpoint with one user breakpoint, we - // need to support this otherwise a conditional breakpoint can mask a - // breakpoint set by next or step. - if (kind != UserBreakpoint && bp.Kind != UserBreakpoint) || (kind == UserBreakpoint && bp.IsUser()) { + if !bp.canOverlap(kind) { return bp, BreakpointExistsError{bp.File, bp.Line, bp.Addr} } - bp.Kind |= kind - if kind != UserBreakpoint { - bp.internalCond = cond - } else { - bp.Cond = cond + if kind == UserBreakpoint { + bp.Tracepoint = false + bp.TraceReturn = false + bp.Goroutine = false + bp.Stacktrace = 0 + bp.Variables = nil + bp.LoadArgs = nil + bp.LoadLocals = nil } + bp.Breaklets = append(bp.Breaklets, newBreaklet) return bp, nil } - f, l, fn, originalData, err := t.proc.WriteBreakpoint(addr) - if err != nil { - return nil, err - } + f, l, fn := t.BinInfo().PCToLine(uint64(addr)) fnName := "" if fn != nil { fnName = fn.Name } + hwidx := uint8(0) + if wtype != 0 { + m := make(map[uint8]bool) + for _, bp := range bpmap.M { + if bp.WatchType != 0 { + m[bp.HWBreakIndex] = true + } + } + for hwidx = 0; true; hwidx++ { + if !m[hwidx] { + break + } + } + } + newBreakpoint := &Breakpoint{ FunctionName: fnName, + WatchType: wtype, + HWBreakIndex: hwidx, File: f, Line: l, Addr: addr, - Kind: kind, - OriginalData: originalData, - HitCount: map[int]uint64{}, } - if kind != UserBreakpoint { - bpmap.internalBreakpointIDCounter++ - newBreakpoint.LogicalID = bpmap.internalBreakpointIDCounter - newBreakpoint.internalCond = cond - } else { - bpmap.breakpointIDCounter++ - newBreakpoint.LogicalID = bpmap.breakpointIDCounter - newBreakpoint.Cond = cond + err := t.proc.WriteBreakpoint(newBreakpoint) + if err != nil { + return nil, err } + newBreakpoint.Breaklets = append(newBreakpoint.Breaklets, newBreaklet) + bpmap.M[addr] = newBreakpoint return newBreakpoint, nil } -// setBreakpointWithID creates a breakpoint at addr, with the specified logical ID. -func (t *Target) setBreakpointWithID(id int, addr uint64) (*Breakpoint, error) { +// SetBreakpointWithID creates a breakpoint at addr, with the specified logical ID. +func (t *Target) SetBreakpointWithID(id int, addr uint64) (*Breakpoint, error) { bpmap := t.Breakpoints() bp, err := t.SetBreakpoint(addr, UserBreakpoint, nil) if err == nil { - bp.LogicalID = id - bpmap.breakpointIDCounter-- + for _, breaklet := range bp.Breaklets { + if breaklet.Kind == UserBreakpoint { + breaklet.LogicalID = id + bpmap.breakpointIDCounter-- + break + } + } } return bp, err } +// canOverlap returns true if a breakpoint of kind can be overlapped to the +// already existing breaklets in bp. +// At most one user breakpoint can be set but multiple internal breakpoints are allowed. +// All other internal breakpoints are allowed to overlap freely. +func (bp *Breakpoint) canOverlap(kind BreakpointKind) bool { + if kind == UserBreakpoint { + return !bp.IsUser() + } + return true +} + // ClearBreakpoint clears the breakpoint at addr. -func (t *Target) ClearBreakpoint(addr uint64) (*Breakpoint, error) { +func (t *Target) ClearBreakpoint(addr uint64) error { if valid, err := t.Valid(); !valid { - return nil, err + recorded, _ := t.Recorded() + if !recorded { + return err + } } - bpmap := t.Breakpoints() - bp, ok := bpmap.M[addr] + bp, ok := t.Breakpoints().M[addr] if !ok { - return nil, NoBreakpointError{Addr: addr} + return NoBreakpointError{Addr: addr} } - bp.Kind &= ^UserBreakpoint - bp.Cond = nil - if bp.Kind != 0 { - return bp, nil + for i := range bp.Breaklets { + if bp.Breaklets[i].Kind == UserBreakpoint { + bp.Breaklets[i] = nil + } } - if err := t.proc.EraseBreakpoint(bp); err != nil { - return nil, err + _, err := t.finishClearBreakpoint(bp) + if err != nil { + return err } - delete(bpmap.M, addr) + if bp.WatchExpr != "" && bp.watchStackOff != 0 { + // stack watchpoint, must remove all its WatchOutOfScopeBreakpoints/StackResizeBreakpoints + err := t.clearStackWatchBreakpoints(bp) + if err != nil { + return err + } + } - return bp, nil + return nil } -// ClearInternalBreakpoints removes all internal breakpoints from the map, +// ClearSteppingBreakpoints removes all stepping breakpoints from the map, // calling clearBreakpoint on each one. -func (t *Target) ClearInternalBreakpoints() error { +func (t *Target) ClearSteppingBreakpoints() error { bpmap := t.Breakpoints() threads := t.ThreadList() - for addr, bp := range bpmap.M { - bp.Kind = bp.Kind & UserBreakpoint - bp.internalCond = nil - bp.returnInfo = nil - if bp.Kind != 0 { - continue - } - if err := t.proc.EraseBreakpoint(bp); err != nil { + for _, bp := range bpmap.M { + for i := range bp.Breaklets { + if bp.Breaklets[i].Kind&steppingMask != 0 { + bp.Breaklets[i] = nil + } + } + cleared, err := t.finishClearBreakpoint(bp) + if err != nil { return err } - for _, thread := range threads { - if thread.Breakpoint().Breakpoint == bp { - thread.Breakpoint().Clear() + if cleared { + for _, thread := range threads { + if thread.Breakpoint().Breakpoint == bp { + thread.Breakpoint().Clear() + } } } - delete(bpmap.M, addr) } return nil } -// HasInternalBreakpoints returns true if bpmap has at least one internal +// finishClearBreakpoint clears nil breaklets from the breaklet list of bp +// and if it is empty erases the breakpoint. +// Returns true if the breakpoint was deleted +func (t *Target) finishClearBreakpoint(bp *Breakpoint) (bool, error) { + oldBreaklets := bp.Breaklets + bp.Breaklets = bp.Breaklets[:0] + for _, breaklet := range oldBreaklets { + if breaklet != nil { + bp.Breaklets = append(bp.Breaklets, breaklet) + } + } + if len(bp.Breaklets) > 0 { + return false, nil + } + if err := t.proc.EraseBreakpoint(bp); err != nil { + return false, err + } + + delete(t.Breakpoints().M, bp.Addr) + return true, nil +} + +// HasSteppingBreakpoints returns true if bpmap has at least one stepping // breakpoint set. -func (bpmap *BreakpointMap) HasInternalBreakpoints() bool { +func (bpmap *BreakpointMap) HasSteppingBreakpoints() bool { + for _, bp := range bpmap.M { + if bp.IsStepping() { + return true + } + } + return false +} + +// HasHWBreakpoints returns true if there are hardware breakpoints. +func (bpmap *BreakpointMap) HasHWBreakpoints() bool { for _, bp := range bpmap.M { - if bp.IsInternal() { + if bp.WatchType != 0 { return true } } @@ -374,11 +846,14 @@ func (bpmap *BreakpointMap) HasInternalBreakpoints() bool { // BreakpointState describes the state of a breakpoint in a thread. type BreakpointState struct { *Breakpoint - // Active is true if the breakpoint condition was met. + // Active is true if the condition of any breaklet is met. Active bool - // Internal is true if the breakpoint was matched as an internal + // Stepping is true if one of the active breaklets is a stepping // breakpoint. - Internal bool + Stepping bool + // SteppingInto is true if one of the active stepping breaklets has Kind == + // StepBreakpoint. + SteppingInto bool // CondError contains any error encountered while evaluating the // breakpoint's condition. CondError error @@ -388,7 +863,8 @@ type BreakpointState struct { func (bpstate *BreakpointState) Clear() { bpstate.Breakpoint = nil bpstate.Active = false - bpstate.Internal = false + bpstate.Stepping = false + bpstate.SteppingInto = false bpstate.CondError = nil } @@ -397,8 +873,8 @@ func (bpstate *BreakpointState) String() string { if bpstate.Active { s += " active" } - if bpstate.Internal { - s += " internal" + if bpstate.Stepping { + s += " stepping" } return s } @@ -415,18 +891,18 @@ func configureReturnBreakpoint(bi *BinaryInfo, bp *Breakpoint, topframe *Stackfr } } -func (rbpi *returnBreakpointInfo) Collect(thread Thread) []*Variable { +func (rbpi *returnBreakpointInfo) Collect(t *Target, thread Thread) []*Variable { if rbpi == nil { return nil } g, err := GetG(thread) if err != nil { - return returnInfoError("could not get g", err, thread) + return returnInfoError("could not get g", err, thread.ProcessMemory()) } - scope, err := GoroutineScope(thread) + scope, err := GoroutineScope(t, thread) if err != nil { - return returnInfoError("could not get scope", err, thread) + return returnInfoError("could not get scope", err, thread.ProcessMemory()) } v, err := scope.evalAST(rbpi.retFrameCond) if err != nil || v.Unreadable != nil || v.Kind != reflect.Bool { @@ -444,12 +920,12 @@ func (rbpi *returnBreakpointInfo) Collect(thread Thread) []*Variable { oldSP := uint64(rbpi.spOffset + int64(g.stack.hi)) err = fakeFunctionEntryScope(scope, rbpi.fn, oldFrameOffset, oldSP) if err != nil { - return returnInfoError("could not read function entry", err, thread) + return returnInfoError("could not read function entry", err, thread.ProcessMemory()) } - vars, err := scope.Locals() + vars, err := scope.Locals(0) if err != nil { - return returnInfoError("could not evaluate return variables", err, thread) + return returnInfoError("could not evaluate return variables", err, thread.ProcessMemory()) } vars = filterVariables(vars, func(v *Variable) bool { return (v.Flags & VariableReturnArgument) != 0 diff --git a/pkg/proc/core/core.go b/pkg/proc/core/core.go index 984ffdf3fe..10ff09740e 100644 --- a/pkg/proc/core/core.go +++ b/pkg/proc/core/core.go @@ -5,9 +5,15 @@ import ( "fmt" "io" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/elfwriter" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" ) +// ErrNoThreads core file did not contain any threads. +var ErrNoThreads = errors.New("no threads found in core file") + // A splicedMemory represents a memory space formed from multiple regions, // each of which may override previously regions. For example, in the following // core, the program text was loaded at 0x400000: @@ -26,13 +32,13 @@ type splicedMemory struct { } type readerEntry struct { - offset uintptr - length uintptr + offset uint64 + length uint64 reader proc.MemoryReader } // Add adds a new region to the SplicedMemory, which may override existing regions. -func (r *splicedMemory) Add(reader proc.MemoryReader, off, length uintptr) { +func (r *splicedMemory) Add(reader proc.MemoryReader, off, length uint64) { if length == 0 { return } @@ -92,10 +98,10 @@ func (r *splicedMemory) Add(reader proc.MemoryReader, off, length uintptr) { } // ReadMemory implements MemoryReader.ReadMemory. -func (r *splicedMemory) ReadMemory(buf []byte, addr uintptr) (n int, err error) { +func (r *splicedMemory) ReadMemory(buf []byte, addr uint64) (n int, err error) { started := false for _, entry := range r.readers { - if entry.offset+entry.length < addr { + if entry.offset+entry.length <= addr { if !started { continue } @@ -107,7 +113,7 @@ func (r *splicedMemory) ReadMemory(buf []byte, addr uintptr) (n int, err error) // Don't go past the region. pb := buf - if addr+uintptr(len(buf)) > entry.offset+entry.length { + if addr+uint64(len(buf)) > entry.offset+entry.length { pb = pb[:entry.offset+entry.length-addr] } pn, err := entry.reader.ReadMemory(pb, addr) @@ -119,7 +125,7 @@ func (r *splicedMemory) ReadMemory(buf []byte, addr uintptr) (n int, err error) return n, nil } buf = buf[pn:] - addr += uintptr(pn) + addr += uint64(pn) if len(buf) == 0 { // Done, don't bother scanning the rest. return n, nil @@ -138,11 +144,11 @@ func (r *splicedMemory) ReadMemory(buf []byte, addr uintptr) (n int, err error) // to return the results of a read in that part of the address space. type offsetReaderAt struct { reader io.ReaderAt - offset uintptr + offset uint64 } // ReadMemory will read the memory at addr-offset. -func (r *offsetReaderAt) ReadMemory(buf []byte, addr uintptr) (n int, err error) { +func (r *offsetReaderAt) ReadMemory(buf []byte, addr uint64) (n int, err error) { return r.reader.ReadAt(buf, int64(addr-r.offset)) } @@ -154,13 +160,10 @@ type process struct { entryPoint uint64 - bi *proc.BinaryInfo - breakpoints proc.BreakpointMap - currentThread *thread + bi *proc.BinaryInfo + breakpoints proc.BreakpointMap } -var _ proc.ProcessInternal = &process{} - // thread represents a thread in the core file being debugged. type thread struct { th osThread @@ -188,9 +191,9 @@ var ( ErrChangeRegisterCore = errors.New("can not change register values of core process") ) -type openFn func(string, string) (*process, error) +type openFn func(string, string) (*process, proc.Thread, error) -var openFns = []openFn{readLinuxCore, readAMD64Minidump} +var openFns = []openFn{readLinuxOrPlatformIndependentCore, readAMD64Minidump} // ErrUnrecognizedFormat is returned when the core file is not recognized as // any of the supported formats. @@ -201,9 +204,10 @@ var ErrUnrecognizedFormat = errors.New("unrecognized core format") // for external debug files in the directories passed in. func OpenCore(corePath, exePath string, debugInfoDirs []string) (*proc.Target, error) { var p *process + var currentThread proc.Thread var err error for _, openFn := range openFns { - p, err = openFn(corePath, exePath) + p, currentThread, err = openFn(corePath, exePath) if err != ErrUnrecognizedFormat { break } @@ -212,11 +216,16 @@ func OpenCore(corePath, exePath string, debugInfoDirs []string) (*proc.Target, e return nil, err } - return proc.NewTarget(p, proc.NewTargetConfig{ + if currentThread == nil { + return nil, ErrNoThreads + } + + return proc.NewTarget(p, p.pid, currentThread, proc.NewTargetConfig{ Path: exePath, DebugInfoDirs: debugInfoDirs, DisableAsyncPreempt: false, - StopReason: proc.StopAttached}) + StopReason: proc.StopAttached, + CanDump: false}) } // BinInfo will return the binary info. @@ -231,15 +240,15 @@ func (p *process) EntryPoint() (uint64, error) { // WriteBreakpoint is a noop function since you // cannot write breakpoints into core files. -func (p *process) WriteBreakpoint(addr uint64) (file string, line int, fn *proc.Function, originalData []byte, err error) { - return "", 0, nil, nil, errors.New("cannot write a breakpoint to a core file") +func (p *process) WriteBreakpoint(*proc.Breakpoint) error { + return errors.New("cannot write a breakpoint to a core file") } // Recorded returns whether this is a live or recorded process. Always returns true for core files. func (p *process) Recorded() (bool, string) { return true, "" } // Restart will only return an error for core files, as they are not executing. -func (p *process) Restart(string) error { return ErrContinueCore } +func (p *process) Restart(string) (proc.Thread, error) { return nil, ErrContinueCore } // ChangeDirection will only return an error as you cannot continue a core process. func (p *process) ChangeDirection(proc.Direction) error { return ErrContinueCore } @@ -259,11 +268,30 @@ func (p *process) Checkpoints() ([]proc.Checkpoint, error) { return nil, nil } // ClearCheckpoint clears a checkpoint, but will only return an error for core files. func (p *process) ClearCheckpoint(int) error { return errors.New("checkpoint not found") } +func (p *process) SupportsBPF() bool { + return false +} + +func (dbp *process) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error { + panic("not implemented") +} + +// StartCallInjection notifies the backend that we are about to inject a function call. +func (p *process) StartCallInjection() (func(), error) { return func() {}, nil } + +func (dbp *process) EnableURetProbes() error { + panic("not implemented") +} + +func (dbp *process) DisableURetProbes() error { + panic("not implemented") +} + // ReadMemory will return memory from the core file at the specified location and put the // read memory into `data`, returning the length read, and returning an error if // the length read is shorter than the length of the `data` buffer. -func (t *thread) ReadMemory(data []byte, addr uintptr) (n int, err error) { - n, err = t.p.mem.ReadMemory(data, addr) +func (p *process) ReadMemory(data []byte, addr uint64) (n int, err error) { + n, err = p.mem.ReadMemory(data, addr) if err == nil && n != len(data) { err = ErrShortRead } @@ -272,10 +300,15 @@ func (t *thread) ReadMemory(data []byte, addr uintptr) (n int, err error) { // WriteMemory will only return an error for core files, you cannot write // to the memory of a core process. -func (t *thread) WriteMemory(addr uintptr, data []byte) (int, error) { +func (p *process) WriteMemory(addr uint64, data []byte) (int, error) { return 0, ErrWriteCore } +// ProcessMemory returns the memory of this thread's process. +func (t *thread) ProcessMemory() proc.MemoryReadWriter { + return t.p +} + // Location returns the location of this thread based on // the value of the instruction pointer register. func (t *thread) Location() (*proc.Location, error) { @@ -358,6 +391,12 @@ func (t *thread) SetDX(uint64) error { return ErrChangeRegisterCore } +// ChangeRegs will always return an error, you cannot +// change register values when debugging core files. +func (t *thread) SetReg(regNum uint64, reg *op.DwarfRegister) error { + return ErrChangeRegisterCore +} + // Breakpoints will return all breakpoints for the process. func (p *process) Breakpoints() *proc.BreakpointMap { return &p.breakpoints @@ -400,9 +439,9 @@ func (p *process) CheckAndClearManualStopRequest() bool { return false } -// CurrentThread returns the current active thread. -func (p *process) CurrentThread() proc.Thread { - return p.currentThread +// Memory returns the process memory. +func (p *process) Memory() proc.MemoryReadWriter { + return p } // Detach will always return nil and have no @@ -418,11 +457,6 @@ func (p *process) Valid() (bool, error) { return true, nil } -// Pid returns the process ID of this process. -func (p *process) Pid() int { - return p.pid -} - // ResumeNotify is a no-op on core files as we cannot // control execution. func (p *process) ResumeNotify(chan<- struct{}) { @@ -443,7 +477,14 @@ func (p *process) FindThread(threadID int) (proc.Thread, bool) { return t, ok } -// SetCurrentThread is used internally by proc.Target to change the current thread. -func (p *process) SetCurrentThread(th proc.Thread) { - p.currentThread = th.(*thread) +func (p *process) MemoryMap() ([]proc.MemoryMapEntry, error) { + return nil, proc.ErrMemoryMapNotSupported +} + +func (p *process) DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (threadsDone bool, out []elfwriter.Note, err error) { + return false, notes, nil +} + +func (dbp *process) GetBufferedTracepoints() []ebpf.RawUProbeParams { + return nil } diff --git a/pkg/proc/core/core_test.go b/pkg/proc/core/core_test.go index 297da186d7..25c0882689 100644 --- a/pkg/proc/core/core_test.go +++ b/pkg/proc/core/core_test.go @@ -50,13 +50,13 @@ func TestSplicedReader(t *testing.T) { type region struct { data []byte - off uintptr - length uintptr + off uint64 + length uint64 } tests := []struct { name string regions []region - readAddr uintptr + readAddr uint64 readLen int want []byte }{ @@ -146,6 +146,56 @@ func TestSplicedReader(t *testing.T) { } }) } + + // Test some ReadMemory errors + + mem := &splicedMemory{} + for _, region := range []region{ + {[]byte{0xa1, 0xa2, 0xa3, 0xa4}, 0x1000, 4}, + {[]byte{0xb1, 0xb2, 0xb3, 0xb4}, 0x1004, 4}, + {[]byte{0xc1, 0xc2, 0xc3, 0xc4}, 0x1010, 4}, + } { + r := bytes.NewReader(region.data) + mem.Add(&offsetReaderAt{r, region.off}, region.off, region.length) + } + + got := make([]byte, 4) + + // Read before the first mapping + _, err := mem.ReadMemory(got, 0x900) + if err == nil || !strings.HasPrefix(err.Error(), "error while reading spliced memory at 0x900") { + t.Errorf("Read before the start of memory didn't fail (or wrong error): %v", err) + } + + // Read after the last mapping + _, err = mem.ReadMemory(got, 0x1100) + if err == nil || (err.Error() != "offset 4352 did not match any regions") { + t.Errorf("Read after the end of memory didn't fail (or wrong error): %v", err) + } + + // Read at the start of the first entry + _, err = mem.ReadMemory(got, 0x1000) + if err != nil || !bytes.Equal(got, []byte{0xa1, 0xa2, 0xa3, 0xa4}) { + t.Errorf("Reading at the start of the first entry: %v %#x", err, got) + } + + // Read at the start of the second entry + _, err = mem.ReadMemory(got, 0x1004) + if err != nil || !bytes.Equal(got, []byte{0xb1, 0xb2, 0xb3, 0xb4}) { + t.Errorf("Reading at the start of the second entry: %v %#x", err, got) + } + + // Read straddling entries 1 and 2 + _, err = mem.ReadMemory(got, 0x1002) + if err != nil || !bytes.Equal(got, []byte{0xa3, 0xa4, 0xb1, 0xb2}) { + t.Errorf("Straddled read of the second entry: %v %#x", err, got) + } + + // Read past the end of the second entry + _, err = mem.ReadMemory(got, 0x1007) + if err == nil || !strings.HasPrefix(err.Error(), "error while reading spliced memory at 0x1008") { + t.Errorf("Read into gap: %v", err) + } } func withCoreFile(t *testing.T, name, args string) *proc.Target { @@ -202,6 +252,9 @@ func TestCore(t *testing.T) { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { return } + if runtime.GOOS == "linux" && os.Getenv("CI") == "true" && buildMode == "pie" { + t.Skip("disabled on linux, Github Actions, with PIE buildmode") + } p := withCoreFile(t, "panic", "") gs, _, err := proc.GoroutinesInfo(p, 0, 0) @@ -244,7 +297,7 @@ func TestCore(t *testing.T) { if mainFrame == nil { t.Fatalf("Couldn't find main in stack %v", panickingStack) } - msg, err := proc.FrameToScope(p.BinInfo(), p.CurrentThread(), nil, *mainFrame).EvalVariable("msg", proc.LoadConfig{MaxStringLen: 64}) + msg, err := proc.FrameToScope(p, p.Memory(), nil, *mainFrame).EvalExpression("msg", proc.LoadConfig{MaxStringLen: 64}) if err != nil { t.Fatalf("Couldn't EvalVariable(msg, ...): %v", err) } @@ -349,6 +402,9 @@ func TestCoreWithEmptyString(t *testing.T) { if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { return } + if runtime.GOOS == "linux" && os.Getenv("CI") == "true" && buildMode == "pie" { + t.Skip("disabled on linux, Github Actions, with PIE buildmode") + } p := withCoreFile(t, "coreemptystring", "") gs, _, err := proc.GoroutinesInfo(p, 0, 0) @@ -371,13 +427,13 @@ mainSearch: t.Fatal("could not find main.main frame") } - scope := proc.FrameToScope(p.BinInfo(), p.CurrentThread(), nil, *mainFrame) + scope := proc.FrameToScope(p, p.Memory(), nil, *mainFrame) loadConfig := proc.LoadConfig{FollowPointers: true, MaxVariableRecurse: 1, MaxStringLen: 64, MaxArrayValues: 64, MaxStructFields: -1} - v1, err := scope.EvalVariable("t", loadConfig) + v1, err := scope.EvalExpression("t", loadConfig) assertNoError(err, t, "EvalVariable(t)") assertNoError(v1.Unreadable, t, "unreadable variable 't'") t.Logf("t = %#v\n", v1) - v2, err := scope.EvalVariable("s", loadConfig) + v2, err := scope.EvalExpression("s", loadConfig) assertNoError(err, t, "EvalVariable(s)") assertNoError(v2.Unreadable, t, "unreadable variable 's'") t.Logf("s = %#v\n", v2) diff --git a/pkg/proc/core/delve_core.go b/pkg/proc/core/delve_core.go new file mode 100644 index 0000000000..8dbc88db60 --- /dev/null +++ b/pkg/proc/core/delve_core.go @@ -0,0 +1,160 @@ +package core + +import ( + "bytes" + "encoding/binary" + "fmt" + "strconv" + "strings" + + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/elfwriter" + "github.com/go-delve/delve/pkg/proc" +) + +func platformFromNotes(notes []*note) (goos, goarch string, err error) { + for _, note := range notes { + if note.Type != elfwriter.DelveHeaderNoteType { + continue + } + lines := strings.Split(string(note.Desc.([]byte)), "\n") + v := strings.Split(lines[0], "/") + if len(v) != 2 { + return "", "", fmt.Errorf("malformed delve header note: %q", string(note.Desc.([]byte))) + } + return v[0], v[1], nil + } + panic("internal error") +} + +func threadsFromDelveNotes(p *process, notes []*note) (proc.Thread, error) { + var currentThread proc.Thread + for _, note := range notes { + if note.Type == elfwriter.DelveHeaderNoteType { + buf := bytes.NewBuffer(note.Desc.([]byte)) + for { + line, err := buf.ReadString('\n') + if err != nil { + break + } + if len(line) > 0 && line[len(line)-1] == '\n' { + line = line[:len(line)-1] + } + switch { + case strings.HasPrefix(line, elfwriter.DelveHeaderTargetPidPrefix): + pid, err := strconv.ParseUint(line[len(elfwriter.DelveHeaderTargetPidPrefix):], 10, 64) + if err != nil { + return nil, fmt.Errorf("malformed delve header note (bad pid): %v", err) + } + p.pid = int(pid) + case strings.HasPrefix(line, elfwriter.DelveHeaderEntryPointPrefix): + entry, err := strconv.ParseUint(line[len(elfwriter.DelveHeaderEntryPointPrefix):], 0, 64) + if err != nil { + return nil, fmt.Errorf("malformed delve header note (bad entry point): %v", err) + } + p.entryPoint = entry + } + } + } + + if note.Type != elfwriter.DelveThreadNodeType { + continue + } + body := bytes.NewReader(note.Desc.([]byte)) + th := new(delveThread) + th.regs = new(delveRegisters) + + var readerr error + read := func(out interface{}) { + if readerr != nil { + return + } + readerr = binary.Read(body, binary.LittleEndian, out) + } + + read(&th.id) + + read(&th.regs.pc) + read(&th.regs.sp) + read(&th.regs.bp) + read(&th.regs.tls) + read(&th.regs.hasGAddr) + read(&th.regs.gaddr) + + var n uint32 + read(&n) + + if readerr != nil { + return nil, fmt.Errorf("error reading thread note header for thread %d: %v", th.id, readerr) + } + + th.regs.slice = make([]proc.Register, n) + + readBytes := func(maxlen uint16, kind string) []byte { + if readerr != nil { + return nil + } + var len uint16 + read(&len) + if maxlen > 0 && len > maxlen { + readerr = fmt.Errorf("maximum len exceeded (%d) reading %s", len, kind) + return nil + } + buf := make([]byte, len) + if readerr != nil { + return nil + } + _, readerr = body.Read(buf) + return buf + } + + for i := 0; i < int(n); i++ { + name := string(readBytes(20, "register name")) + value := readBytes(2048, "register value") + th.regs.slice[i] = proc.Register{Name: name, Reg: op.DwarfRegisterFromBytes(value)} + if readerr != nil { + return nil, fmt.Errorf("error reading thread note registers for thread %d: %v", th.id, readerr) + } + } + + p.Threads[int(th.id)] = &thread{th, p, proc.CommonThread{}} + if currentThread == nil { + currentThread = p.Threads[int(th.id)] + } + } + return currentThread, nil +} + +type delveThread struct { + id uint64 + regs *delveRegisters +} + +func (th *delveThread) pid() int { + return int(th.id) +} + +func (th *delveThread) registers() (proc.Registers, error) { + return th.regs, nil +} + +type delveRegisters struct { + pc, sp, bp, tls uint64 + hasGAddr bool + gaddr uint64 + slice []proc.Register +} + +func (regs *delveRegisters) PC() uint64 { return regs.pc } +func (regs *delveRegisters) BP() uint64 { return regs.bp } +func (regs *delveRegisters) SP() uint64 { return regs.sp } +func (regs *delveRegisters) TLS() uint64 { return regs.tls } +func (regs *delveRegisters) GAddr() (uint64, bool) { return regs.gaddr, regs.hasGAddr } + +func (regs *delveRegisters) Copy() (proc.Registers, error) { + return regs, nil +} + +func (regs *delveRegisters) Slice(bool) ([]proc.Register, error) { + return regs.slice, nil +} diff --git a/pkg/proc/core/linux_core.go b/pkg/proc/core/linux_core.go index 0cf071a15d..a06178c4c9 100644 --- a/pkg/proc/core/linux_core.go +++ b/pkg/proc/core/linux_core.go @@ -9,7 +9,9 @@ import ( "os" "strings" + "github.com/go-delve/delve/pkg/elfwriter" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" "github.com/go-delve/delve/pkg/proc/linutil" ) @@ -43,7 +45,8 @@ const ( const elfErrorBadMagicNumber = "bad magic number" -func linuxThreadsFromNotes(p *process, notes []*note, machineType elf.Machine) { +func linuxThreadsFromNotes(p *process, notes []*note, machineType elf.Machine) proc.Thread { + var currentThread proc.Thread var lastThreadAMD *linuxAMD64Thread var lastThreadARM64 *linuxARM64Thread var lastThreadARM *linuxARMThread @@ -54,8 +57,8 @@ func linuxThreadsFromNotes(p *process, notes []*note, machineType elf.Machine) { t := note.Desc.(*linuxPrStatusAMD64) lastThreadAMD = &linuxAMD64Thread{linutil.AMD64Registers{Regs: &t.Reg}, t} p.Threads[int(t.Pid)] = &thread{lastThreadAMD, p, proc.CommonThread{}} - if p.currentThread == nil { - p.currentThread = p.Threads[int(t.Pid)] + if currentThread == nil { + currentThread = p.Threads[int(t.Pid)] } } else if machineType == _EM_AARCH64 { t := note.Desc.(*linuxPrStatusARM64) @@ -68,8 +71,8 @@ func linuxThreadsFromNotes(p *process, notes []*note, machineType elf.Machine) { t := note.Desc.(*linuxPrStatusARM) lastThreadARM = &linuxARMThread{linutil.ARMRegisters{Regs: &t.Reg}, t} p.Threads[int(t.Pid)] = &thread{lastThreadARM, p, proc.CommonThread{}} - if p.currentThread == nil { - p.currentThread = p.Threads[int(t.Pid)] + if currentThread == nil { + currentThread = p.Threads[int(t.Pid)] } } case _NT_FPREGSET: @@ -85,64 +88,82 @@ func linuxThreadsFromNotes(p *process, notes []*note, machineType elf.Machine) { case _NT_X86_XSTATE: if machineType == _EM_X86_64 { if lastThreadAMD != nil { - lastThreadAMD.regs.Fpregs = note.Desc.(*linutil.AMD64Xstate).Decode() + lastThreadAMD.regs.Fpregs = note.Desc.(*amd64util.AMD64Xstate).Decode() } } case elf.NT_PRPSINFO: p.pid = int(note.Desc.(*linuxPrPsInfo).Pid) } } + return currentThread } -// readLinuxCore reads a core file from corePath corresponding to the executable at -// exePath. For details on the Linux ELF core format, see: +// readLinuxOrPlatformIndependentCore reads a core file from corePath +// corresponding to the executable at exePath. For details on the Linux ELF +// core format, see: // http://www.gabriel.urdhr.fr/2015/05/29/core-file/, // http://uhlo.blogspot.fr/2012/05/brief-look-into-core-dumps.html, // elf_core_dump in http://lxr.free-electrons.com/source/fs/binfmt_elf.c, // and, if absolutely desperate, readelf.c from the binutils source. -func readLinuxCore(corePath, exePath string) (*process, error) { +func readLinuxOrPlatformIndependentCore(corePath, exePath string) (*process, proc.Thread, error) { coreFile, err := elf.Open(corePath) if err != nil { if _, isfmterr := err.(*elf.FormatError); isfmterr && (strings.Contains(err.Error(), elfErrorBadMagicNumber) || strings.Contains(err.Error(), " at offset 0x0: too short")) { // Go >=1.11 and <1.11 produce different errors when reading a non-elf file. - return nil, ErrUnrecognizedFormat + return nil, nil, ErrUnrecognizedFormat } - return nil, err - } - exe, err := os.Open(exePath) - if err != nil { - return nil, err - } - exeELF, err := elf.NewFile(exe) - if err != nil { - return nil, err + return nil, nil, err } if coreFile.Type != elf.ET_CORE { - return nil, fmt.Errorf("%v is not a core file", coreFile) + return nil, nil, fmt.Errorf("%v is not a core file", coreFile) } - if exeELF.Type != elf.ET_EXEC && exeELF.Type != elf.ET_DYN { - return nil, fmt.Errorf("%v is not an exe file", exeELF) + + machineType := coreFile.Machine + notes, platformIndependentDelveCore, err := readNotes(coreFile, machineType) + if err != nil { + return nil, nil, err } - machineType := exeELF.Machine - notes, err := readNotes(coreFile, machineType) + exe, err := os.Open(exePath) if err != nil { - return nil, err + return nil, nil, err } + exeELF, err := elf.NewFile(exe) + if err != nil { + if !platformIndependentDelveCore { + return nil, nil, err + } + } else { + if exeELF.Machine != machineType { + return nil, nil, fmt.Errorf("architecture mismatch between core file (%#x) and executable file (%#x)", machineType, exeELF.Machine) + } + if exeELF.Type != elf.ET_EXEC && exeELF.Type != elf.ET_DYN { + return nil, nil, fmt.Errorf("%v is not an exe file", exeELF) + } + } + memory := buildMemory(coreFile, exeELF, exe, notes) // TODO support 386 var bi *proc.BinaryInfo - switch machineType { - case _EM_X86_64: - bi = proc.NewBinaryInfo("linux", "amd64") - case _EM_AARCH64: - bi = proc.NewBinaryInfo("linux", "arm64") - case _EM_ARM: - bi = proc.NewBinaryInfo("linux", "arm") - default: - return nil, fmt.Errorf("unsupported machine type") + if platformIndependentDelveCore { + goos, goarch, err := platformFromNotes(notes) + if err != nil { + return nil, nil, err + } + bi = proc.NewBinaryInfo(goos, goarch) + } else { + switch machineType { + case _EM_X86_64: + bi = proc.NewBinaryInfo("linux", "amd64") + case _EM_AARCH64: + bi = proc.NewBinaryInfo("linux", "arm64") + case _EM_ARM: + bi = proc.NewBinaryInfo("linux", "arm") + default: + return nil, nil, fmt.Errorf("unsupported machine type") + } } entryPoint := findEntryPoint(notes, bi.Arch.PtrSize()) @@ -155,8 +176,13 @@ func readLinuxCore(corePath, exePath string) (*process, error) { breakpoints: proc.NewBreakpointMap(), } - linuxThreadsFromNotes(p, notes, machineType) - return p, nil + if platformIndependentDelveCore { + currentThread, err := threadsFromDelveNotes(p, notes) + return p, currentThread, err + } + + currentThread := linuxThreadsFromNotes(p, notes, machineType) + return p, currentThread, nil } type linuxAMD64Thread struct { @@ -221,7 +247,7 @@ type note struct { } // readNotes reads all the notes from the notes prog in core. -func readNotes(core *elf.File, machineType elf.Machine) ([]*note, error) { +func readNotes(core *elf.File, machineType elf.Machine) ([]*note, bool, error) { var notesProg *elf.Prog for _, prog := range core.Progs { if prog.Type == elf.PT_NOTE { @@ -231,6 +257,9 @@ func readNotes(core *elf.File, machineType elf.Machine) ([]*note, error) { } r := notesProg.Open() + hasDelveThread := false + hasDelveHeader := false + hasElfPrStatus := false notes := []*note{} for { note, err := readNote(r, machineType) @@ -238,12 +267,20 @@ func readNotes(core *elf.File, machineType elf.Machine) ([]*note, error) { break } if err != nil { - return nil, err + return nil, false, err + } + switch note.Type { + case elfwriter.DelveHeaderNoteType: + hasDelveHeader = true + case elfwriter.DelveThreadNodeType: + hasDelveThread = true + case elf.NT_PRSTATUS: + hasElfPrStatus = true } notes = append(notes, note) } - return notes, nil + return notes, hasDelveThread && hasDelveHeader && !hasElfPrStatus, nil } // readNote reads a single note from r, decoding the descriptor if possible. @@ -310,13 +347,13 @@ func readNote(r io.ReadSeeker, machineType elf.Machine) (*note, error) { note.Desc = data case _NT_X86_XSTATE: if machineType == _EM_X86_64 { - var fpregs linutil.AMD64Xstate - if err := linutil.AMD64XstateRead(desc, true, &fpregs); err != nil { + var fpregs amd64util.AMD64Xstate + if err := amd64util.AMD64XstateRead(desc, true, &fpregs); err != nil { return nil, err } note.Desc = &fpregs } - case _NT_AUXV: + case _NT_AUXV, elfwriter.DelveHeaderNoteType, elfwriter.DelveThreadNodeType: note.Desc = desc case _NT_FPREGSET: if machineType == _EM_AARCH64 { @@ -366,9 +403,9 @@ func buildMemory(core, exeELF *elf.File, exe io.ReaderAt, notes []*note) proc.Me for _, entry := range fileNote.entries { r := &offsetReaderAt{ reader: exe, - offset: uintptr(entry.Start - (entry.FileOfs * fileNote.PageSize)), + offset: entry.Start - (entry.FileOfs * fileNote.PageSize), } - memory.Add(r, uintptr(entry.Start), uintptr(entry.End-entry.Start)) + memory.Add(r, entry.Start, entry.End-entry.Start) } } @@ -377,6 +414,9 @@ func buildMemory(core, exeELF *elf.File, exe io.ReaderAt, notes []*note) proc.Me // Load memory segments from exe and then from the core file, // allowing the corefile to overwrite previously loaded segments for _, elfFile := range []*elf.File{exeELF, core} { + if elfFile == nil { + continue + } for _, prog := range elfFile.Progs { if prog.Type == elf.PT_LOAD { if prog.Filesz == 0 { @@ -384,9 +424,9 @@ func buildMemory(core, exeELF *elf.File, exe io.ReaderAt, notes []*note) proc.Me } r := &offsetReaderAt{ reader: prog.ReaderAt, - offset: uintptr(prog.Vaddr), + offset: prog.Vaddr, } - memory.Add(r, uintptr(prog.Vaddr), uintptr(prog.Filesz)) + memory.Add(r, prog.Vaddr, prog.Filesz) } } } diff --git a/pkg/proc/core/minidump/fileflags_string.go b/pkg/proc/core/minidump/fileflags_string.go index b69969e431..2c67cce6e7 100644 --- a/pkg/proc/core/minidump/fileflags_string.go +++ b/pkg/proc/core/minidump/fileflags_string.go @@ -59,7 +59,7 @@ var ( func (i Arch) String() string { switch { - case 0 <= i && i <= 10: + case i <= 10: return _Arch_name_0[_Arch_index_0[i]:_Arch_index_0[i+1]] case i == 12: return _Arch_name_1 diff --git a/pkg/proc/core/minidump/minidump.go b/pkg/proc/core/minidump/minidump.go index b3446741ca..c9d5852ecf 100644 --- a/pkg/proc/core/minidump/minidump.go +++ b/pkg/proc/core/minidump/minidump.go @@ -7,7 +7,7 @@ package minidump // ProcDump utility. // // The file format is described on MSDN starting at: -// https://docs.microsoft.com/en-us/windows/desktop/api/minidumpapiset/ns-minidumpapiset-_minidump_header +// https://docs.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_header // which is the structure found at offset 0 on a minidump file. // // Further information on the format can be found reading @@ -120,7 +120,7 @@ type Minidump struct { } // Stream represents one (uninterpreted) stream in a minidump file. -// See: https://docs.microsoft.com/en-us/windows/desktop/api/minidumpapiset/ns-minidumpapiset-_minidump_directory +// See: https://docs.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_directory type Stream struct { Type StreamType Offset int @@ -128,7 +128,7 @@ type Stream struct { } // Thread represents an entry in the ThreadList stream. -// See: https://docs.microsoft.com/en-us/windows/desktop/api/minidumpapiset/ns-minidumpapiset-_minidump_thread +// See: https://docs.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_thread type Thread struct { ID uint32 SuspendCount uint32 @@ -139,7 +139,7 @@ type Thread struct { } // Module represents an entry in the ModuleList stream. -// See: https://docs.microsoft.com/en-us/windows/desktop/api/minidumpapiset/ns-minidumpapiset-_minidump_module +// See: https://docs.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_module type Module struct { BaseOfImage uint64 SizeOfImage uint32 @@ -155,8 +155,8 @@ type Module struct { MiscRecord []byte } -// VSFixedFileInfo: Visual Studio Fixed File Info. -// See: https://docs.microsoft.com/en-us/windows/desktop/api/verrsrc/ns-verrsrc-tagvs_fixedfileinfo +// VSFixedFileInfo Visual Studio Fixed File Info. +// See: https://docs.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo type VSFixedFileInfo struct { Signature uint32 StructVersion uint32 @@ -182,7 +182,7 @@ type MemoryRange struct { } // ReadMemory reads len(buf) bytes of memory starting at addr into buf from this memory region. -func (m *MemoryRange) ReadMemory(buf []byte, addr uintptr) (int, error) { +func (m *MemoryRange) ReadMemory(buf []byte, addr uint64) (int, error) { if len(buf) == 0 { return 0, nil } @@ -194,7 +194,7 @@ func (m *MemoryRange) ReadMemory(buf []byte, addr uintptr) (int, error) { } // MemoryInfo reprents an entry in the MemoryInfoList stream. -// See: https://docs.microsoft.com/en-us/windows/desktop/api/minidumpapiset/ns-minidumpapiset-_minidump_memory_info +// See: https://docs.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_memory_info_list type MemoryInfo struct { Addr uint64 Size uint64 @@ -596,8 +596,8 @@ func readModuleList(mdmp *Minidump, buf *minidumpBuf) { // readMemory64List reads a _MINIDUMP_MEMORY64_LIST structure, containing // the description of the process memory. -// See: https://docs.microsoft.com/en-us/windows/desktop/api/minidumpapiset/ns-minidumpapiset-_minidump_memory64_list -// And: https://docs.microsoft.com/en-us/windows/desktop/api/minidumpapiset/ns-minidumpapiset-_minidump_memory_descriptor +// See: https://docs.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_memory64_list +// And: https://docs.microsoft.com/en-us/windows/win32/api/minidumpapiset/ns-minidumpapiset-minidump_memory_descriptor func readMemory64List(mdmp *Minidump, buf *minidumpBuf, logfn func(fmt string, args ...interface{})) { rangesNum := buf.u64() baseOff := int(buf.u64()) diff --git a/pkg/proc/core/windows_amd64_minidump.go b/pkg/proc/core/windows_amd64_minidump.go index 31879e49a1..aeadd11aab 100644 --- a/pkg/proc/core/windows_amd64_minidump.go +++ b/pkg/proc/core/windows_amd64_minidump.go @@ -7,7 +7,7 @@ import ( "github.com/go-delve/delve/pkg/proc/winutil" ) -func readAMD64Minidump(minidumpPath, exePath string) (*process, error) { +func readAMD64Minidump(minidumpPath, exePath string) (*process, proc.Thread, error) { var logfn func(string, ...interface{}) if logflags.Minidump() { logfn = logflags.MinidumpLogger().Infof @@ -16,16 +16,16 @@ func readAMD64Minidump(minidumpPath, exePath string) (*process, error) { mdmp, err := minidump.Open(minidumpPath, logfn) if err != nil { if _, isNotAMinidump := err.(minidump.ErrNotAMinidump); isNotAMinidump { - return nil, ErrUnrecognizedFormat + return nil, nil, ErrUnrecognizedFormat } - return nil, err + return nil, nil, err } memory := &splicedMemory{} for i := range mdmp.MemoryRanges { m := &mdmp.MemoryRanges[i] - memory.Add(m, uintptr(m.Addr), uintptr(len(m.Data))) + memory.Add(m, m.Addr, uint64(len(m.Data))) } entryPoint := uint64(0) @@ -45,11 +45,12 @@ func readAMD64Minidump(minidumpPath, exePath string) (*process, error) { for i := range mdmp.Threads { th := &mdmp.Threads[i] p.Threads[int(th.ID)] = &thread{&windowsAMD64Thread{th}, p, proc.CommonThread{}} - if p.currentThread == nil { - p.currentThread = p.Threads[int(th.ID)] - } } - return p, nil + var currentThread proc.Thread + if len(mdmp.Threads) > 0 { + currentThread = p.Threads[int(mdmp.Threads[0].ID)] + } + return p, currentThread, nil } type windowsAMD64Thread struct { diff --git a/pkg/proc/disasm.go b/pkg/proc/disasm.go index 06f4b1ae94..161f81b75c 100644 --- a/pkg/proc/disasm.go +++ b/pkg/proc/disasm.go @@ -1,6 +1,10 @@ package proc -import "fmt" +import ( + "fmt" + + "github.com/go-delve/delve/pkg/dwarf/op" +) // AsmInstruction represents one assembly instruction. type AsmInstruction struct { @@ -56,7 +60,7 @@ type AssemblyFlavour int const ( // GNUFlavour will display GNU assembly syntax. - GNUFlavour = AssemblyFlavour(iota) + GNUFlavour AssemblyFlavour = iota // IntelFlavour will display Intel assembly syntax. IntelFlavour // GoFlavour will display Go assembly syntax. @@ -71,7 +75,7 @@ type opcodeSeq []uint64 // If sameline is set firstPCAfterPrologueDisassembly will always return an // address associated with the same line as fn.Entry func firstPCAfterPrologueDisassembly(p Process, fn *Function, sameline bool) (uint64, error) { - var mem MemoryReadWriter = p.CurrentThread() + mem := p.Memory() breakpoints := p.Breakpoints() bi := p.BinInfo() text, err := disassemble(mem, nil, breakpoints, bi, fn.Entry, fn.End, false) @@ -83,7 +87,7 @@ func firstPCAfterPrologueDisassembly(p Process, fn *Function, sameline bool) (ui return fn.Entry, nil } - for _, prologue := range p.BinInfo().Arch.Prologues() { + for _, prologue := range p.BinInfo().Arch.prologues { if len(prologue) >= len(text) { continue } @@ -124,8 +128,13 @@ func Disassemble(mem MemoryReadWriter, regs Registers, breakpoints *BreakpointMa } func disassemble(memrw MemoryReadWriter, regs Registers, breakpoints *BreakpointMap, bi *BinaryInfo, startAddr, endAddr uint64, singleInstr bool) ([]AsmInstruction, error) { + var dregs *op.DwarfRegisters + if regs != nil { + dregs = bi.Arch.RegistersToDwarfRegisters(0, regs) + } + mem := make([]byte, int(endAddr-startAddr)) - _, err := memrw.ReadMemory(mem, uintptr(startAddr)) + _, err := memrw.ReadMemory(mem, startAddr) if err != nil { return nil, err } @@ -153,7 +162,7 @@ func disassemble(memrw MemoryReadWriter, regs Registers, breakpoints *Breakpoint inst.Breakpoint = atbp inst.AtPC = (regs != nil) && (curpc == pc) - bi.Arch.asmDecode(&inst, mem, regs, memrw, bi) + bi.Arch.asmDecode(&inst, mem, dregs, memrw, bi) r = append(r, inst) diff --git a/pkg/proc/dump.go b/pkg/proc/dump.go new file mode 100644 index 0000000000..3989dc00ff --- /dev/null +++ b/pkg/proc/dump.go @@ -0,0 +1,420 @@ +package proc + +import ( + "bytes" + "debug/elf" + "encoding/binary" + "errors" + "fmt" + "runtime" + "sync" + + "github.com/go-delve/delve/pkg/elfwriter" + "github.com/go-delve/delve/pkg/version" +) + +var ( + ErrMemoryMapNotSupported = errors.New("MemoryMap not supported") +) + +// DumpState represents the current state of a core dump in progress. +type DumpState struct { + Mutex sync.Mutex + + Dumping bool + AllDone bool + Canceled bool + DoneChan chan struct{} + + ThreadsDone, ThreadsTotal int + MemDone, MemTotal uint64 + + Err error +} + +// DumpFlags is used to configure (*Target).Dump +type DumpFlags uint16 + +const ( + DumpPlatformIndependent DumpFlags = 1 << iota // always use platfrom-independent notes format +) + +// MemoryMapEntry represent a memory mapping in the target process. +type MemoryMapEntry struct { + Addr uint64 + Size uint64 + + Read, Write, Exec bool + + Filename string + Offset uint64 +} + +func (state *DumpState) setErr(err error) { + if err == nil { + return + } + state.Mutex.Lock() + if state.Err == nil { + state.Err = err + } + state.Mutex.Unlock() +} + +func (state *DumpState) setThreadsTotal(n int) { + state.Mutex.Lock() + state.ThreadsTotal = n + state.ThreadsDone = 0 + state.Mutex.Unlock() +} + +func (state *DumpState) threadDone() { + state.Mutex.Lock() + state.ThreadsDone++ + state.Mutex.Unlock() +} + +func (state *DumpState) setMemTotal(n uint64) { + state.Mutex.Lock() + state.MemTotal = n + state.Mutex.Unlock() +} + +func (state *DumpState) memDone(delta uint64) { + state.Mutex.Lock() + state.MemDone += delta + state.Mutex.Unlock() +} + +func (state *DumpState) isCanceled() bool { + state.Mutex.Lock() + defer state.Mutex.Unlock() + return state.Canceled +} + +// Dump writes a core dump to out. State is updated as the core dump is written. +func (t *Target) Dump(out elfwriter.WriteCloserSeeker, flags DumpFlags, state *DumpState) { + defer func() { + state.Mutex.Lock() + if ierr := recover(); ierr != nil { + state.Err = newInternalError(ierr, 2) + } + err := out.Close() + if state.Err == nil && err != nil { + state.Err = fmt.Errorf("error writing output file: %v", err) + } + state.Dumping = false + state.Mutex.Unlock() + if state.DoneChan != nil { + close(state.DoneChan) + } + }() + + bi := t.BinInfo() + + var fhdr elf.FileHeader + fhdr.Class = elf.ELFCLASS64 + fhdr.Data = elf.ELFDATA2LSB + fhdr.Version = elf.EV_CURRENT + + switch bi.GOOS { + case "linux": + fhdr.OSABI = elf.ELFOSABI_LINUX + case "freebsd": + fhdr.OSABI = elf.ELFOSABI_FREEBSD + default: + // There is no OSABI value for windows or macOS because nobody generates ELF core dumps on those systems. + fhdr.OSABI = 0xff + } + + fhdr.Type = elf.ET_CORE + + switch bi.Arch.Name { + case "amd64": + fhdr.Machine = elf.EM_X86_64 + case "386": + fhdr.Machine = elf.EM_386 + case "arm64": + fhdr.Machine = elf.EM_AARCH64 + default: + panic("not implemented") + } + + fhdr.Entry = 0 + + w := elfwriter.New(out, &fhdr) + + notes := []elfwriter.Note{} + + entryPoint, err := t.EntryPoint() + if err != nil { + state.setErr(err) + return + } + + notes = append(notes, elfwriter.Note{ + Type: elfwriter.DelveHeaderNoteType, + Name: "Delve Header", + Data: []byte(fmt.Sprintf("%s/%s\n%s\n%s%d\n%s%#x\n", bi.GOOS, bi.Arch.Name, version.DelveVersion.String(), elfwriter.DelveHeaderTargetPidPrefix, t.pid, elfwriter.DelveHeaderEntryPointPrefix, entryPoint)), + }) + + threads := t.ThreadList() + state.setThreadsTotal(len(threads)) + + var threadsDone bool + + if flags&DumpPlatformIndependent == 0 { + threadsDone, notes, err = t.proc.DumpProcessNotes(notes, state.threadDone) + if err != nil { + state.setErr(err) + return + } + } + + if !threadsDone { + for _, th := range threads { + if w.Err != nil { + state.setErr(fmt.Errorf("error writing to output file: %v", w.Err)) + return + } + if state.isCanceled() { + return + } + notes = t.dumpThreadNotes(notes, state, th) + state.threadDone() + } + } + + memmap, err := t.proc.MemoryMap() + if err != nil { + state.setErr(err) + return + } + + memmapFilter := make([]MemoryMapEntry, 0, len(memmap)) + memtot := uint64(0) + for i := range memmap { + mme := &memmap[i] + if t.shouldDumpMemory(mme) { + memmapFilter = append(memmapFilter, *mme) + memtot += mme.Size + } + } + + state.setMemTotal(memtot) + + for i := range memmapFilter { + mme := &memmapFilter[i] + if w.Err != nil { + state.setErr(fmt.Errorf("error writing to output file: %v", w.Err)) + return + } + if state.isCanceled() { + return + } + t.dumpMemory(state, w, mme) + } + + notesProg := w.WriteNotes(notes) + w.Progs = append(w.Progs, notesProg) + w.WriteProgramHeaders() + if w.Err != nil { + state.setErr(fmt.Errorf("error writing to output file: %v", w.Err)) + } + state.Mutex.Lock() + state.AllDone = true + state.Mutex.Unlock() +} + +// dumpThreadNotes appends notes describing a thread (thread id and its +// registers) using a platform-independent format. +func (t *Target) dumpThreadNotes(notes []elfwriter.Note, state *DumpState, th Thread) []elfwriter.Note { + // If the backend doesn't provide a way to dump a thread we use a custom format for the note: + // - thread_id (8 bytes) + // - pc value (8 bytes) + // - sp value (8 bytes) + // - bp value (8 bytes) + // - tls value (8 bytes) + // - has_gaddr (1 byte) + // - gaddr value (8 bytes) + // - num_registers (4 bytes) + // Followed by a list of num_register, each as follows: + // - register_name_len (2 bytes) + // - register_name (register_name_len bytes) + // - register_data_len (2 bytes) + // - register_data (regiter_data_len bytes) + + buf := new(bytes.Buffer) + _ = binary.Write(buf, binary.LittleEndian, uint64(th.ThreadID())) + + regs, err := th.Registers() + if err != nil { + state.setErr(err) + return notes + } + + for _, specialReg := range []uint64{regs.PC(), regs.SP(), regs.BP(), regs.TLS()} { + binary.Write(buf, binary.LittleEndian, specialReg) + } + + gaddr, hasGaddr := regs.GAddr() + binary.Write(buf, binary.LittleEndian, hasGaddr) + binary.Write(buf, binary.LittleEndian, gaddr) + + regsv, err := regs.Slice(true) + if err != nil { + state.setErr(err) + return notes + } + + binary.Write(buf, binary.LittleEndian, uint32(len(regsv))) + + for _, reg := range regsv { + binary.Write(buf, binary.LittleEndian, uint16(len(reg.Name))) + buf.Write([]byte(reg.Name)) + if reg.Reg.Bytes != nil { + binary.Write(buf, binary.LittleEndian, uint16(len(reg.Reg.Bytes))) + buf.Write(reg.Reg.Bytes) + } else { + binary.Write(buf, binary.LittleEndian, uint16(8)) + binary.Write(buf, binary.LittleEndian, reg.Reg.Uint64Val) + } + } + + return append(notes, elfwriter.Note{ + Type: elfwriter.DelveThreadNodeType, + Name: "", + Data: buf.Bytes(), + }) +} + +func (t *Target) dumpMemory(state *DumpState, w *elfwriter.Writer, mme *MemoryMapEntry) { + var flags elf.ProgFlag + if mme.Read { + flags |= elf.PF_R + } + if mme.Write { + flags |= elf.PF_W + } + if mme.Exec { + flags |= elf.PF_X + } + + w.Progs = append(w.Progs, &elf.ProgHeader{ + Type: elf.PT_LOAD, + Flags: flags, + Off: uint64(w.Here()), + Vaddr: mme.Addr, + Paddr: 0, + Filesz: mme.Size, + Memsz: mme.Size, + Align: 0, + }) + + buf := make([]byte, 1024*1024) + addr := mme.Addr + sz := mme.Size + mem := t.Memory() + + for sz > 0 { + if w.Err != nil { + state.setErr(fmt.Errorf("error writing to output file: %v", w.Err)) + return + } + if state.isCanceled() { + return + } + chunk := buf + if uint64(len(chunk)) > sz { + chunk = chunk[:sz] + } + n, err := mem.ReadMemory(chunk, addr) + for i := n; i < len(chunk); i++ { + chunk[i] = 0 + } + // Errors and short reads are ignored, the most likely reason is that + // (*ProcessInternal).MemoryMap gave us a bad mapping that can't be read + // and the behavior that's maximally useful to the user is to generate an + // incomplete dump. + w.Write(chunk) + addr += uint64(len(chunk)) + sz -= uint64(len(chunk)) + if err == nil { + state.memDone(uint64(len(chunk))) + } + } +} + +func (t *Target) shouldDumpMemory(mme *MemoryMapEntry) bool { + if !mme.Read { + return false + } + exeimg := t.BinInfo().Images[0] + if mme.Write || mme.Filename == "" || mme.Filename != exeimg.Path { + return true + } + isgo := false + for _, cu := range exeimg.compileUnits { + if cu.isgo { + isgo = true + break + } + } + if !isgo { + return true + } + + exe, err := elf.Open(exeimg.Path) + if err != nil { + return true + } + + if exe.Type != elf.ET_EXEC { + return true + } + + for _, prog := range exe.Progs { + if prog.Type == elf.PT_LOAD && (prog.Flags&elf.PF_W == 0) && (prog.Flags&elf.PF_R != 0) && (prog.Vaddr == mme.Addr) && (prog.Memsz == mme.Size) && (prog.Off == mme.Offset) { + return false + } + } + return true +} + +type internalError struct { + Err interface{} + Stack []internalErrorFrame +} + +type internalErrorFrame struct { + Pc uintptr + Func string + File string + Line int +} + +func newInternalError(ierr interface{}, skip int) *internalError { + r := &internalError{ierr, nil} + for i := skip; ; i++ { + pc, file, line, ok := runtime.Caller(i) + if !ok { + break + } + fname := "" + fn := runtime.FuncForPC(pc) + if fn != nil { + fname = fn.Name() + } + r.Stack = append(r.Stack, internalErrorFrame{pc, fname, file, line}) + } + return r +} + +func (err *internalError) Error() string { + var out bytes.Buffer + fmt.Fprintf(&out, "Internal debugger error: %v\n", err.Err) + for _, frame := range err.Stack { + fmt.Fprintf(&out, "%s (%#x)\n\t%s:%d\n", frame.Func, frame.Pc, frame.File, frame.Line) + } + return out.String() +} diff --git a/pkg/proc/dwarf_export_test.go b/pkg/proc/dwarf_export_test.go index de8f505ace..b6d22c0879 100644 --- a/pkg/proc/dwarf_export_test.go +++ b/pkg/proc/dwarf_export_test.go @@ -1,6 +1,25 @@ package proc +import "github.com/go-delve/delve/pkg/dwarf/op" + // PackageVars returns bi.packageVars (for tests) func (bi *BinaryInfo) PackageVars() []packageVar { return bi.packageVars } + +func NewCompositeMemory(p *Target, pieces []op.Piece, base uint64) (*compositeMemory, error) { + regs, err := p.CurrentThread().Registers() + if err != nil { + return nil, err + } + + arch := p.BinInfo().Arch + dwarfregs := arch.RegistersToDwarfRegisters(0, regs) + dwarfregs.ChangeFunc = p.CurrentThread().SetReg + + mem, err := newCompositeMemory(p.Memory(), arch, *dwarfregs, pieces) + if mem != nil { + mem.base = base + } + return mem, err +} diff --git a/pkg/proc/dwarf_expr_test.go b/pkg/proc/dwarf_expr_test.go index 2410ecc5f0..439bb578fd 100644 --- a/pkg/proc/dwarf_expr_test.go +++ b/pkg/proc/dwarf_expr_test.go @@ -64,7 +64,7 @@ func newFakeMemory(base uint64, contents ...interface{}) *fakeMemory { return mem } -func (mem *fakeMemory) ReadMemory(data []byte, addr uintptr) (int, error) { +func (mem *fakeMemory) ReadMemory(data []byte, addr uint64) (int, error) { if uint64(addr) < mem.base { return 0, fmt.Errorf("read out of bounds %d %#x", len(data), addr) } @@ -77,8 +77,17 @@ func (mem *fakeMemory) ReadMemory(data []byte, addr uintptr) (int, error) { return len(data), nil } -func (mem *fakeMemory) WriteMemory(uintptr, []byte) (int, error) { - return 0, fmt.Errorf("not implemented") +func (mem *fakeMemory) WriteMemory(addr uint64, data []byte) (int, error) { + if uint64(addr) < mem.base { + return 0, fmt.Errorf("write out of bounds %d %#x", len(data), addr) + } + start := uint64(addr) - mem.base + end := uint64(len(data)) + start + if end > uint64(len(mem.data)) { + panic(fmt.Errorf("write out of bounds %d %#x", len(data), addr)) + } + copy(mem.data[start:end], data) + return len(data), nil } func uintExprCheck(t *testing.T, scope *proc.EvalScope, expr string, tgt uint64) { @@ -93,16 +102,17 @@ func uintExprCheck(t *testing.T, scope *proc.EvalScope, expr string, tgt uint64) } } -func dwarfExprCheck(t *testing.T, mem proc.MemoryReadWriter, regs op.DwarfRegisters, bi *proc.BinaryInfo, testCases map[string]uint16, fn *proc.Function) *proc.EvalScope { - scope := &proc.EvalScope{Location: proc.Location{PC: 0x40100, Fn: fn}, Regs: regs, Mem: mem, BinInfo: bi} +func fakeScope(mem proc.MemoryReadWriter, regs *op.DwarfRegisters, bi *proc.BinaryInfo, fn *proc.Function) *proc.EvalScope { + return &proc.EvalScope{Location: proc.Location{PC: 0x40100, Fn: fn}, Regs: *regs, Mem: mem, BinInfo: bi} +} + +func dwarfExprCheck(t *testing.T, scope *proc.EvalScope, testCases map[string]uint16) { for name, value := range testCases { uintExprCheck(t, scope, name, uint64(value)) } - - return scope } -func dwarfRegisters(bi *proc.BinaryInfo, regs *linutil.AMD64Registers) op.DwarfRegisters { +func dwarfRegisters(bi *proc.BinaryInfo, regs *linutil.AMD64Registers) *op.DwarfRegisters { a := proc.AMD64Arch("linux") so := bi.PCToImage(regs.PC()) dwarfRegs := a.RegistersToDwarfRegisters(so.StaticBase, regs) @@ -137,14 +147,16 @@ func TestDwarfExprRegisters(t *testing.T) { regs.Regs.Rax = uint64(testCases["a"]) regs.Regs.Rdx = uint64(testCases["c"]) - dwarfExprCheck(t, mem, dwarfRegisters(bi, ®s), bi, testCases, mainfn) + dwarfExprCheck(t, fakeScope(mem, dwarfRegisters(bi, ®s), bi, mainfn), testCases) } func TestDwarfExprComposite(t *testing.T) { testCases := map[string]uint16{ - "pair.k": 0x8765, - "pair.v": 0x5678, - "n": 42, + "pair.k": 0x8765, + "pair.v": 0x5678, + "n": 42, + "pair2.k": 0x8765, + "pair2.v": 0, } const stringVal = "this is a string" @@ -178,6 +190,9 @@ func TestDwarfExprComposite(t *testing.T) { op.DW_OP_reg1, op.DW_OP_piece, uint(8), op.DW_OP_reg0, op.DW_OP_piece, uint(8))) dwb.AddVariable("n", intoff, dwarfbuilder.LocationBlock(op.DW_OP_reg3)) + dwb.AddVariable("pair2", pairoff, dwarfbuilder.LocationBlock( + op.DW_OP_reg2, op.DW_OP_piece, uint(2), + op.DW_OP_piece, uint(2))) dwb.TagClose() bi, _ := fakeBinaryInfo(t, dwb) @@ -192,7 +207,17 @@ func TestDwarfExprComposite(t *testing.T) { regs.Regs.Rcx = uint64(testCases["pair.k"]) regs.Regs.Rbx = uint64(testCases["n"]) - scope := dwarfExprCheck(t, mem, dwarfRegisters(bi, ®s), bi, testCases, mainfn) + dwarfRegs := dwarfRegisters(bi, ®s) + var changeCalls []string + dwarfRegs.ChangeFunc = func(regNum uint64, reg *op.DwarfRegister) error { + t.Logf("SetReg(%d, %x)", regNum, reg.Bytes) + changeCalls = append(changeCalls, fmt.Sprintf("%d - %x", regNum, reg.Bytes)) + return nil + } + + scope := fakeScope(mem, dwarfRegs, bi, mainfn) + + dwarfExprCheck(t, scope, testCases) thevar, err := scope.EvalExpression("s", normalLoadConfig) assertNoError(err, t, fmt.Sprintf("EvalExpression(%s)", "s")) @@ -203,6 +228,29 @@ func TestDwarfExprComposite(t *testing.T) { t.Errorf("expected value %q got %q", stringVal, v) } } + + // Test writes to composite memory + + assertNoError(scope.SetVariable("n", "47"), t, "SetVariable(n, 47)") + assertNoError(scope.SetVariable("pair.k", "12"), t, "SetVariable(pair.k, 12)") + assertNoError(scope.SetVariable("pair.v", "13"), t, "SetVariable(pair.v, 13)") + + for i := range changeCalls { + t.Logf("%q\n", changeCalls[i]) + } + + if len(changeCalls) != 2 { + t.Errorf("wrong number of calls to SetReg") + } + if changeCalls[0] != "3 - 2f00000000000000" { + t.Errorf("wrong call to SetReg (Rbx)") + } + if changeCalls[1] != "2 - 0c00000000000000" { + t.Errorf("wrong call to SetReg (Rcx)") + } + if mem.data[0x10] != 13 || mem.data[0x11] != 0x00 { + t.Errorf("memory was not written %v", mem.data[:2]) + } } func TestDwarfExprLoclist(t *testing.T) { @@ -228,7 +276,7 @@ func TestDwarfExprLoclist(t *testing.T) { const PC = 0x40100 regs := linutil.AMD64Registers{Regs: &linutil.AMD64PtraceRegs{Rip: PC}} - scope := &proc.EvalScope{Location: proc.Location{PC: PC, Fn: mainfn}, Regs: dwarfRegisters(bi, ®s), Mem: mem, BinInfo: bi} + scope := &proc.EvalScope{Location: proc.Location{PC: PC, Fn: mainfn}, Regs: *dwarfRegisters(bi, ®s), Mem: mem, BinInfo: bi} uintExprCheck(t, scope, "a", before) scope.PC = 0x40800 @@ -278,9 +326,6 @@ func TestIssue1419(t *testing.T) { } func TestLocationCovers(t *testing.T) { - const before = 0x1234 - const after = 0x4321 - dwb := dwarfbuilder.New() uint16off := dwb.AddBaseType("uint16", dwarfbuilder.DW_ATE_unsigned, 2) @@ -353,3 +398,43 @@ func TestNestedCompileUnts(t *testing.T) { t.Errorf("expected 2 variables, got %d", n) } } + +func TestAbstractOriginDefinedAfterUse(t *testing.T) { + // Tests that an abstract origin entry can appear after its uses. + dwb := dwarfbuilder.New() + dwb.AddCompileUnit("main", 0x0) + + // Concrete implementation + dwb.TagOpen(dwarf.TagSubprogram, "") + originRef1 := dwb.Attr(dwarf.AttrAbstractOrigin, dwarf.Offset(0)) + dwb.Attr(dwarf.AttrLowpc, dwarfbuilder.Address(0x40100)) + dwb.Attr(dwarf.AttrHighpc, dwarfbuilder.Address(0x41000)) + dwb.TagClose() + + // Inlined call + dwb.AddSubprogram("callingFn", 0x41100, 0x42000) + dwb.TagOpen(dwarf.TagInlinedSubroutine, "") + originRef2 := dwb.Attr(dwarf.AttrAbstractOrigin, dwarf.Offset(0)) + dwb.Attr(dwarf.AttrLowpc, dwarfbuilder.Address(0x41150)) + dwb.Attr(dwarf.AttrHighpc, dwarfbuilder.Address(0x41155)) + dwb.Attr(dwarf.AttrCallFile, uint8(1)) + dwb.Attr(dwarf.AttrCallLine, uint8(1)) + dwb.TagClose() + dwb.TagClose() + + // Abstract origin + abstractOriginOff := dwb.TagOpen(dwarf.TagSubprogram, "inlinedFn") + dwb.Attr(dwarf.AttrInline, uint8(1)) + dwb.TagClose() + + dwb.TagClose() + + dwb.PatchOffset(originRef1, abstractOriginOff) + dwb.PatchOffset(originRef2, abstractOriginOff) + + bi, _ := fakeBinaryInfo(t, dwb) + fn := bi.PCToFunc(0x40100) + if fn == nil { + t.Fatalf("could not find concrete instance of inlined function") + } +} diff --git a/pkg/proc/eval.go b/pkg/proc/eval.go index 74221b956b..29218c8eb0 100644 --- a/pkg/proc/eval.go +++ b/pkg/proc/eval.go @@ -3,7 +3,6 @@ package proc import ( "bytes" "debug/dwarf" - "encoding/binary" "errors" "fmt" "go/ast" @@ -21,10 +20,13 @@ import ( "github.com/go-delve/delve/pkg/dwarf/op" "github.com/go-delve/delve/pkg/dwarf/reader" "github.com/go-delve/delve/pkg/goversion" + "github.com/go-delve/delve/pkg/logflags" ) var errOperationOnSpecialFloat = errors.New("operations on non-finite floats not implemented") +const goDictionaryName = ".dict" + // EvalScope is the scope for variable evaluation. Contains the thread, // current location (PC), and canonical frame address. type EvalScope struct { @@ -33,11 +35,10 @@ type EvalScope struct { Mem MemoryReadWriter // Target's memory g *G BinInfo *BinaryInfo + target *Target frameOffset int64 - aordr *dwarf.Reader // extra reader to load DW_AT_abstract_origin entries, do not initialize - // When the following pointer is not nil this EvalScope was created // by CallFunction and the expression evaluation is executing on a // different goroutine from the debugger's main goroutine. @@ -51,8 +52,23 @@ type EvalScope struct { // The goroutine executing the expression evaluation shall signal that the // evaluation is complete by closing the continueRequest channel. callCtx *callContext + + dictAddr uint64 // dictionary address for instantiated generic functions } +type localsFlags uint8 + +const ( + // If localsTrustArgOrder is set function arguments that don't have an + // address will have one assigned by looking at their position in the argument + // list. + localsTrustArgOrder localsFlags = 1 << iota + + // If localsNoDeclLineCheck the declaration line isn't checked at + // all to determine if the variable is in scope. + localsNoDeclLineCheck +) + // ConvertEvalScope returns a new EvalScope in the context of the // specified goroutine ID and stack frame. // If deferCall is > 0 the eval scope will be relative to the specified deferred call. @@ -65,23 +81,18 @@ func ConvertEvalScope(dbp *Target, gid, frame, deferCall int) (*EvalScope, error if err != nil { return nil, err } - if g == nil { - return ThreadScope(ct) - } - - var thread MemoryReadWriter - if g.Thread == nil { - thread = ct - } else { - thread = g.Thread - } var opts StacktraceOptions if deferCall > 0 { opts = StacktraceReadDefers } - locs, err := g.Stacktrace(frame+1, opts) + var locs []Stackframe + if g != nil { + locs, err = g.Stacktrace(frame+1, opts) + } else { + locs, err = ThreadStacktrace(ct, frame+1) + } if err != nil { return nil, err } @@ -100,10 +111,10 @@ func ConvertEvalScope(dbp *Target, gid, frame, deferCall int) (*EvalScope, error return nil, d.Unreadable } - return d.EvalScope(ct) + return d.EvalScope(dbp, ct) } - return FrameToScope(dbp.BinInfo(), thread, g, locs[frame:]...), nil + return FrameToScope(dbp, dbp.Memory(), g, locs[frame:]...), nil } // FrameToScope returns a new EvalScope for frames[0]. @@ -111,7 +122,7 @@ func ConvertEvalScope(dbp *Target, gid, frame, deferCall int) (*EvalScope, error // frames[0].Regs.SP() and frames[1].Regs.CFA will be cached. // Otherwise all memory between frames[0].Regs.SP() and frames[0].Regs.CFA // will be cached. -func FrameToScope(bi *BinaryInfo, thread MemoryReadWriter, g *G, frames ...Stackframe) *EvalScope { +func FrameToScope(t *Target, thread MemoryReadWriter, g *G, frames ...Stackframe) *EvalScope { // Creates a cacheMem that will preload the entire stack frame the first // time any local variable is read. // Remember that the stack grows downward in memory. @@ -123,16 +134,16 @@ func FrameToScope(bi *BinaryInfo, thread MemoryReadWriter, g *G, frames ...Stack maxaddr = uint64(frames[0].Regs.CFA) } if maxaddr > minaddr && maxaddr-minaddr < maxFramePrefetchSize { - thread = cacheMemory(thread, uintptr(minaddr), int(maxaddr-minaddr)) + thread = cacheMemory(thread, minaddr, int(maxaddr-minaddr)) } - s := &EvalScope{Location: frames[0].Call, Regs: frames[0].Regs, Mem: thread, g: g, BinInfo: bi, frameOffset: frames[0].FrameOffset()} + s := &EvalScope{Location: frames[0].Call, Regs: frames[0].Regs, Mem: thread, g: g, BinInfo: t.BinInfo(), target: t, frameOffset: frames[0].FrameOffset()} s.PC = frames[0].lastpc return s } // ThreadScope returns an EvalScope for the given thread. -func ThreadScope(thread Thread) (*EvalScope, error) { +func ThreadScope(t *Target, thread Thread) (*EvalScope, error) { locations, err := ThreadStacktrace(thread, 1) if err != nil { return nil, err @@ -140,11 +151,11 @@ func ThreadScope(thread Thread) (*EvalScope, error) { if len(locations) < 1 { return nil, errors.New("could not decode first frame") } - return FrameToScope(thread.BinInfo(), thread, nil, locations...), nil + return FrameToScope(t, thread.ProcessMemory(), nil, locations...), nil } // GoroutineScope returns an EvalScope for the goroutine running on the given thread. -func GoroutineScope(thread Thread) (*EvalScope, error) { +func GoroutineScope(t *Target, thread Thread) (*EvalScope, error) { locations, err := ThreadStacktrace(thread, 1) if err != nil { return nil, err @@ -156,7 +167,7 @@ func GoroutineScope(thread Thread) (*EvalScope, error) { if err != nil { return nil, err } - return FrameToScope(thread.BinInfo(), thread, g, locations...), nil + return FrameToScope(t, thread.ProcessMemory(), g, locations...), nil } // EvalExpression returns the value of the given expression. @@ -202,13 +213,13 @@ func isAssignment(err error) (int, bool) { return 0, false } -// Locals fetches all variables of a specific type in the current function scope. -func (scope *EvalScope) Locals() ([]*Variable, error) { +// Locals returns all variables in 'scope'. +func (scope *EvalScope) Locals(flags localsFlags) ([]*Variable, error) { if scope.Fn == nil { return nil, errors.New("unable to find function context") } - trustArgOrder := scope.BinInfo.Producer() != "" && goversion.ProducerAfterOrEqual(scope.BinInfo.Producer(), 1, 12) + trustArgOrder := (flags&localsTrustArgOrder != 0) && scope.BinInfo.Producer() != "" && goversion.ProducerAfterOrEqual(scope.BinInfo.Producer(), 1, 12) && scope.Fn != nil && (scope.PC == scope.Fn.Entry) dwarfTree, err := scope.image().getDwarfTree(scope.Fn.offset) if err != nil { @@ -216,15 +227,43 @@ func (scope *EvalScope) Locals() ([]*Variable, error) { } variablesFlags := reader.VariablesOnlyVisible + if flags&localsNoDeclLineCheck != 0 { + variablesFlags = reader.VariablesNoDeclLineCheck + } if scope.BinInfo.Producer() != "" && goversion.ProducerAfterOrEqual(scope.BinInfo.Producer(), 1, 15) { variablesFlags |= reader.VariablesTrustDeclLine } varEntries := reader.Variables(dwarfTree, scope.PC, scope.Line, variablesFlags) + + // look for dictionary entry + if scope.dictAddr == 0 { + for _, entry := range varEntries { + name, _ := entry.Val(dwarf.AttrName).(string) + if name == goDictionaryName { + dictVar, err := extractVarInfoFromEntry(scope.target, scope.BinInfo, scope.image(), scope.Regs, scope.Mem, entry.Tree, 0) + if err != nil { + logflags.DebuggerLogger().Errorf("could not load %s variable: %v", name, err) + } else if dictVar.Unreadable != nil { + logflags.DebuggerLogger().Errorf("could not load %s variable: %v", name, dictVar.Unreadable) + } else { + scope.dictAddr, err = readUintRaw(dictVar.mem, dictVar.Addr, int64(scope.BinInfo.Arch.PtrSize())) + if err != nil { + logflags.DebuggerLogger().Errorf("could not load %s variable: %v", name, err) + } + } + break + } + } + } + vars := make([]*Variable, 0, len(varEntries)) depths := make([]int, 0, len(varEntries)) for _, entry := range varEntries { - val, err := extractVarInfoFromEntry(scope.BinInfo, scope.image(), scope.Regs, scope.Mem, entry.Tree) + if name, _ := entry.Val(dwarf.AttrName).(string); name == goDictionaryName { + continue + } + val, err := extractVarInfoFromEntry(scope.target, scope.BinInfo, scope.image(), scope.Regs, scope.Mem, entry.Tree, scope.dictAddr) if err != nil { // skip variables that we can't parse yet continue @@ -232,9 +271,9 @@ func (scope *EvalScope) Locals() ([]*Variable, error) { if trustArgOrder && ((val.Unreadable != nil && val.Addr == 0) || val.Flags&VariableFakeAddress != 0) && entry.Tag == dwarf.TagFormalParameter { addr := afterLastArgAddr(vars) if addr == 0 { - addr = uintptr(scope.Regs.CFA) + addr = uint64(scope.Regs.CFA) } - addr = uintptr(alignAddr(int64(addr), val.DwarfType.Align())) + addr = uint64(alignAddr(int64(addr), val.DwarfType.Align())) val = newVariable(val.Name, addr, val.DwarfType, scope.BinInfo, scope.Mem) } vars = append(vars, val) @@ -288,11 +327,11 @@ func (scope *EvalScope) Locals() ([]*Variable, error) { return vars, nil } -func afterLastArgAddr(vars []*Variable) uintptr { +func afterLastArgAddr(vars []*Variable) uint64 { for i := len(vars) - 1; i >= 0; i-- { v := vars[i] if (v.Flags&VariableArgument != 0) || (v.Flags&VariableReturnArgument != 0) { - return v.Addr + uintptr(v.DwarfType.Size()) + return v.Addr + uint64(v.DwarfType.Size()) } } return 0 @@ -323,6 +362,7 @@ func (scope *EvalScope) setValue(dstv, srcv *Variable, srcExpr string) error { } if srcv.Unreadable != nil { + //lint:ignore ST1005 backwards compatibility return fmt.Errorf("Expression \"%s\" is unreadable: %v", srcExpr, srcv.Unreadable) } @@ -343,6 +383,13 @@ func (scope *EvalScope) setValue(dstv, srcv *Variable, srcExpr string) error { real, _ := constant.Float64Val(constant.Real(srcv.Value)) imag, _ := constant.Float64Val(constant.Imag(srcv.Value)) return dstv.writeComplex(real, imag, dstv.RealType.Size()) + case reflect.Func: + if dstv.RealType.Size() == 0 { + if dstv.Name != "" { + return fmt.Errorf("can not assign to %s", dstv.Name) + } + return errors.New("can not assign to function expression") + } } // nilling nillable variables @@ -376,11 +423,6 @@ func (scope *EvalScope) setValue(dstv, srcv *Variable, srcExpr string) error { return fmt.Errorf("can not set variables of type %s (not implemented)", dstv.Kind.String()) } -// EvalVariable returns the value of the given expression (backwards compatibility). -func (scope *EvalScope) EvalVariable(name string, cfg LoadConfig) (*Variable, error) { - return scope.EvalExpression(name, cfg) -} - // SetVariable sets the value of the named variable func (scope *EvalScope) SetVariable(name, value string) error { t, err := parser.ParseExpr(name) @@ -394,10 +436,12 @@ func (scope *EvalScope) SetVariable(name, value string) error { } if xv.Addr == 0 { + //lint:ignore ST1005 backwards compatibility return fmt.Errorf("Can not assign to \"%s\"", name) } if xv.Unreadable != nil { + //lint:ignore ST1005 backwards compatibility return fmt.Errorf("Expression \"%s\" is unreadable: %v", name, xv.Unreadable) } @@ -416,7 +460,7 @@ func (scope *EvalScope) SetVariable(name, value string) error { // LocalVariables returns all local variables from the current function scope. func (scope *EvalScope) LocalVariables(cfg LoadConfig) ([]*Variable, error) { - vars, err := scope.Locals() + vars, err := scope.Locals(0) if err != nil { return nil, err } @@ -430,7 +474,7 @@ func (scope *EvalScope) LocalVariables(cfg LoadConfig) ([]*Variable, error) { // FunctionArguments returns the name, value, and type of all current function arguments. func (scope *EvalScope) FunctionArguments(cfg LoadConfig) ([]*Variable, error) { - vars, err := scope.Locals() + vars, err := scope.Locals(0) if err != nil { return nil, err } @@ -477,7 +521,7 @@ func (scope *EvalScope) PackageVariables(cfg LoadConfig) ([]*Variable, error) { } // Ignore errors trying to extract values - val, err := extractVarInfoFromEntry(scope.BinInfo, pkgvar.cu.image, regsReplaceStaticBase(scope.Regs, pkgvar.cu.image), scope.Mem, godwarf.EntryToTree(entry)) + val, err := extractVarInfoFromEntry(scope.target, scope.BinInfo, pkgvar.cu.image, regsReplaceStaticBase(scope.Regs, pkgvar.cu.image), scope.Mem, godwarf.EntryToTree(entry), 0) if val != nil && val.Kind == reflect.Invalid { continue } @@ -514,15 +558,15 @@ func (scope *EvalScope) findGlobalInternal(name string) (*Variable, error) { if err != nil { return nil, err } - return extractVarInfoFromEntry(scope.BinInfo, pkgvar.cu.image, regsReplaceStaticBase(scope.Regs, pkgvar.cu.image), scope.Mem, godwarf.EntryToTree(entry)) + return extractVarInfoFromEntry(scope.target, scope.BinInfo, pkgvar.cu.image, regsReplaceStaticBase(scope.Regs, pkgvar.cu.image), scope.Mem, godwarf.EntryToTree(entry), 0) } } for _, fn := range scope.BinInfo.Functions { if fn.Name == name || strings.HasSuffix(fn.Name, "/"+name) { //TODO(aarzilli): convert function entry into a function type? - r := newVariable(fn.Name, uintptr(fn.Entry), &godwarf.FuncType{}, scope.BinInfo, scope.Mem) + r := newVariable(fn.Name, fn.Entry, &godwarf.FuncType{}, scope.BinInfo, scope.Mem) r.Value = constant.MakeString(fn.Name) - r.Base = uintptr(fn.Entry) + r.Base = fn.Entry r.loaded = true if fn.Entry == 0 { r.Unreadable = fmt.Errorf("function %s is inlined", fn.Name) @@ -560,14 +604,6 @@ func (scope *EvalScope) image() *Image { return scope.BinInfo.funcToImage(scope.Fn) } -// globalFor returns a global scope for 'image' with the register values of 'scope'. -func (scope *EvalScope) globalFor(image *Image) *EvalScope { - r := *scope - r.Regs.StaticBase = image.StaticBase - r.Fn = &Function{cu: &compileUnit{image: image}} - return &r -} - // DwarfReader returns the DwarfReader containing the // Dwarf information for the target process. func (scope *EvalScope) DwarfReader() *reader.Reader { @@ -626,7 +662,7 @@ func (scope *EvalScope) evalToplevelTypeCast(t ast.Expr, cfg LoadConfig) (*Varia return nil, converr } for i, ch := range []byte(constant.StringVal(argv.Value)) { - e := newVariable("", argv.Addr+uintptr(i), targetType.(*godwarf.SliceType).ElemType, scope.BinInfo, argv.mem) + e := newVariable("", argv.Addr+uint64(i), targetType.(*godwarf.SliceType).ElemType, scope.BinInfo, argv.mem) e.loaded = true e.Value = constant.MakeInt64(int64(ch)) v.Children = append(v.Children, *e) @@ -640,7 +676,7 @@ func (scope *EvalScope) evalToplevelTypeCast(t ast.Expr, cfg LoadConfig) (*Varia return nil, converr } for i, ch := range constant.StringVal(argv.Value) { - e := newVariable("", argv.Addr+uintptr(i), targetType.(*godwarf.SliceType).ElemType, scope.BinInfo, argv.mem) + e := newVariable("", argv.Addr+uint64(i), targetType.(*godwarf.SliceType).ElemType, scope.BinInfo, argv.mem) e.loaded = true e.Value = constant.MakeInt64(int64(ch)) v.Children = append(v.Children, *e) @@ -711,7 +747,7 @@ func (scope *EvalScope) evalAST(t ast.Expr) (*Variable, error) { case *ast.CallExpr: if len(node.Args) == 1 { v, err := scope.evalTypeCast(node) - if err == nil || err != reader.TypeNotFoundErr { + if err == nil || err != reader.ErrTypeNotFound { return v, err } } @@ -733,7 +769,7 @@ func (scope *EvalScope) evalAST(t ast.Expr) (*Variable, error) { if err != nil { return nil, fmt.Errorf("blah: %v", err) } - gvar := newVariable("curg", fakeAddress, typ, scope.BinInfo, scope.Mem) + gvar := newVariable("curg", fakeAddressUnresolv, typ, scope.BinInfo, scope.Mem) gvar.loaded = true gvar.Flags = VariableFakeAddress gvar.Children = append(gvar.Children, *newConstant(constant.MakeInt64(0), scope.Mem)) @@ -854,7 +890,14 @@ func (scope *EvalScope) evalTypeCast(node *ast.CallExpr) (*Variable, error) { n, _ := constant.Int64Val(argv.Value) - v.Children = []Variable{*(newVariable("", uintptr(n), ttyp.Type, scope.BinInfo, scope.Mem))} + mem := scope.Mem + if scope.target != nil { + if mem2 := scope.target.findFakeMemory(uint64(n)); mem2 != nil { + mem = mem2 + } + } + + v.Children = []Variable{*(newVariable("", uint64(n), ttyp.Type, scope.BinInfo, mem))} v.Children[0].OnlyAddr = true return v, nil @@ -917,17 +960,14 @@ func (scope *EvalScope) evalTypeCast(node *ast.CallExpr) (*Variable, error) { } func convertInt(n uint64, signed bool, size int64) uint64 { - buf := make([]byte, 64/8) - binary.BigEndian.PutUint64(buf, n) - m := 64/8 - int(size) - s := byte(0) - if signed && (buf[m]&0x80 > 0) { - s = 0xff - } - for i := 0; i < m; i++ { - buf[i] = s + bits := uint64(size) * 8 + mask := uint64((1 << bits) - 1) + r := n & mask + if signed && (r>>(bits-1)) != 0 { + // sign extension + r |= ^uint64(0) &^ mask } - return uint64(binary.BigEndian.Uint64(buf)) + return r } func (scope *EvalScope) evalBuiltinCall(node *ast.CallExpr) (*Variable, error) { @@ -1137,7 +1177,7 @@ func (scope *EvalScope) evalIdent(node *ast.Ident) (*Variable, error) { return nilVariable, nil } - vars, err := scope.Locals() + vars, err := scope.Locals(0) if err != nil { return nil, err } @@ -1154,6 +1194,36 @@ func (scope *EvalScope) evalIdent(node *ast.Ident) (*Variable, error) { return v, nil } } + + // not a local variable, nor a global variable, try a CPU register + if s := validRegisterName(node.Name); s != "" { + if regnum, ok := scope.BinInfo.Arch.RegisterNameToDwarf(s); ok { + if reg := scope.Regs.Reg(uint64(regnum)); reg != nil { + reg.FillBytes() + + var typ godwarf.Type + if len(reg.Bytes) <= 8 { + typ = &godwarf.UintType{BasicType: godwarf.BasicType{CommonType: godwarf.CommonType{ByteSize: 8, Name: "uint64"}, BitSize: 64, BitOffset: 0}} + } else { + typ, err = scope.BinInfo.findType("string") + if err != nil { + return nil, err + } + } + + v := newVariable(node.Name, 0, typ, scope.BinInfo, scope.Mem) + if v.Kind == reflect.String { + v.Len = int64(len(reg.Bytes) * 2) + v.Base = fakeAddressUnresolv + } + v.Addr = fakeAddressUnresolv + v.Flags = VariableCPURegister + v.reg = reg + return v, nil + } + } + } + return nil, fmt.Errorf("could not find symbol value for %s", node.Name) } @@ -1172,6 +1242,10 @@ func (scope *EvalScope) evalStructSelector(node *ast.SelectorExpr) (*Variable, e if xv.Addr == 0 && xv.Name == "" && xv.DwarfType == nil && xv.RealType == nil { return nil, fmt.Errorf("%s (type %s) is not a struct", xv.Value, xv.TypeString()) } + // Special type conversions for CPU register variables (REGNAME.int8, etc) + if xv.Flags&VariableCPURegister != 0 && !xv.loaded { + return xv.registerVariableTypeConv(node.Sel.Name) + } rv, err := xv.findMethod(node.Sel.Name) if err != nil { @@ -1614,8 +1688,15 @@ func (scope *EvalScope) evalBinary(node *ast.BinaryExpr) (*Variable, error) { r := xv.newVariable("", 0, typ, scope.Mem) r.Value = rc - if r.Kind == reflect.String { + switch r.Kind { + case reflect.String: r.Len = xv.Len + yv.Len + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + n, _ := constant.Int64Val(r.Value) + r.Value = constant.MakeInt64(int64(convertInt(uint64(n), true, typ.Size()))) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + n, _ := constant.Uint64Val(r.Value) + r.Value = constant.MakeUint64(convertInt(n, false, typ.Size())) } return r, nil } @@ -1881,11 +1962,14 @@ func (v *Variable) sliceAccess(idx int) (*Variable, error) { if wrong { return nil, fmt.Errorf("index out of bounds") } + if v.loaded { + return &v.Children[idx], nil + } mem := v.mem if v.Kind != reflect.Array { mem = DereferenceMemory(mem) } - return v.newVariable("", v.Base+uintptr(int64(idx)*v.stride), v.fieldType, mem), nil + return v.newVariable("", v.Base+uint64(int64(idx)*v.stride), v.fieldType, mem), nil } func (v *Variable) mapAccess(idx *Variable) (*Variable, error) { @@ -1922,6 +2006,31 @@ func (v *Variable) mapAccess(idx *Variable) (*Variable, error) { return nil, fmt.Errorf("key not found") } +// LoadResliced returns a new array, slice or map that starts at index start and contains +// up to cfg.MaxArrayValues children. +func (v *Variable) LoadResliced(start int, cfg LoadConfig) (newV *Variable, err error) { + switch v.Kind { + case reflect.Array, reflect.Slice: + low, high := int64(start), int64(start+cfg.MaxArrayValues) + if high > v.Len { + high = v.Len + } + newV, err = v.reslice(low, high) + if err != nil { + return nil, err + } + case reflect.Map: + newV = v.clone() + newV.Children = nil + newV.loaded = false + newV.mapSkip = start + default: + return nil, fmt.Errorf("variable to reslice is not an array, slice, or map") + } + newV.loadValue(cfg) + return newV, nil +} + func (v *Variable) reslice(low int64, high int64) (*Variable, error) { wrong := false cptrNeedsFakeSlice := false @@ -1938,7 +2047,7 @@ func (v *Variable) reslice(low int64, high int64) (*Variable, error) { return nil, fmt.Errorf("index out of bounds") } - base := v.Base + uintptr(int64(low)*v.stride) + base := v.Base + uint64(int64(low)*v.stride) len := high - low if high-low < 0 { @@ -1961,6 +2070,8 @@ func (v *Variable) reslice(low int64, high int64) (*Variable, error) { r.Base = base r.stride = v.stride r.fieldType = v.fieldType + r.Flags = v.Flags + r.reg = v.reg return r, nil } @@ -1975,73 +2086,81 @@ func (v *Variable) findMethod(mname string) (*Variable, error) { return v.Children[0].findMethod(mname) } - typ := v.DwarfType - ptyp, isptr := typ.(*godwarf.PtrType) - if isptr { - typ = ptyp.Type - } + queue := []*Variable{v} + seen := map[string]struct{}{} - typePath := typ.Common().Name - dot := strings.LastIndex(typePath, ".") - if dot < 0 { - // probably just a C type - return nil, nil - } - - pkg := typePath[:dot] - receiver := typePath[dot+1:] - - if fn, ok := v.bi.LookupFunc[fmt.Sprintf("%s.%s.%s", pkg, receiver, mname)]; ok { - r, err := functionToVariable(fn, v.bi, v.mem) - if err != nil { - return nil, err + for len(queue) > 0 { + v := queue[0] + queue = append(queue[:0], queue[1:]...) + if _, isseen := seen[v.RealType.String()]; isseen { + continue } + seen[v.RealType.String()] = struct{}{} + + typ := v.DwarfType + ptyp, isptr := typ.(*godwarf.PtrType) if isptr { - r.Children = append(r.Children, *(v.maybeDereference())) - } else { - r.Children = append(r.Children, *v) + typ = ptyp.Type } - return r, nil - } - if fn, ok := v.bi.LookupFunc[fmt.Sprintf("%s.(*%s).%s", pkg, receiver, mname)]; ok { - r, err := functionToVariable(fn, v.bi, v.mem) - if err != nil { - return nil, err + typePath := typ.Common().Name + dot := strings.LastIndex(typePath, ".") + if dot < 0 { + // probably just a C type + continue } - if isptr { - r.Children = append(r.Children, *v) - } else { - r.Children = append(r.Children, *(v.pointerToVariable())) + + pkg := typePath[:dot] + receiver := typePath[dot+1:] + + //TODO(aarzilli): support generic functions? + + if fn, ok := v.bi.LookupFunc[fmt.Sprintf("%s.%s.%s", pkg, receiver, mname)]; ok { + r, err := functionToVariable(fn, v.bi, v.mem) + if err != nil { + return nil, err + } + if isptr { + r.Children = append(r.Children, *(v.maybeDereference())) + } else { + r.Children = append(r.Children, *v) + } + return r, nil } - return r, nil - } - return v.tryFindMethodInEmbeddedFields(mname) -} -func (v *Variable) tryFindMethodInEmbeddedFields(mname string) (*Variable, error) { - structVar := v.maybeDereference() - structVar.Name = v.Name - if structVar.Unreadable != nil { - return structVar, nil - } - switch t := structVar.RealType.(type) { - case *godwarf.StructType: - for _, field := range t.Field { - if field.Embedded { - // Recursively check for promoted fields on the embedded field - embeddedVar, err := structVar.toField(field) - if err != nil { - return nil, err - } - if embeddedMethod, err := embeddedVar.findMethod(mname); err != nil { - return nil, err - } else if embeddedMethod != nil { - return embeddedMethod, nil + if fn, ok := v.bi.LookupFunc[fmt.Sprintf("%s.(*%s).%s", pkg, receiver, mname)]; ok { + r, err := functionToVariable(fn, v.bi, v.mem) + if err != nil { + return nil, err + } + if isptr { + r.Children = append(r.Children, *v) + } else { + r.Children = append(r.Children, *(v.pointerToVariable())) + } + return r, nil + } + + // queue embedded fields for search + structVar := v.maybeDereference() + structVar.Name = v.Name + if structVar.Unreadable != nil { + return structVar, nil + } + switch t := structVar.RealType.(type) { + case *godwarf.StructType: + for _, field := range t.Field { + if field.Embedded { + embeddedVar, err := structVar.toField(field) + if err != nil { + return nil, err + } + queue = append(queue, embeddedVar) } } } } + return nil, nil } @@ -2053,7 +2172,7 @@ func functionToVariable(fn *Function, bi *BinaryInfo, mem MemoryReadWriter) (*Va v := newVariable(fn.Name, 0, typ, bi, mem) v.Value = constant.MakeString(fn.Name) v.loaded = true - v.Base = uintptr(fn.Entry) + v.Base = fn.Entry return v, nil } @@ -2160,3 +2279,15 @@ func (fn *Function) fakeType(bi *BinaryInfo, removeReceiver bool) (*godwarf.Func // If we start using them they should be filled here. }, nil } + +func validRegisterName(s string) string { + for len(s) > 0 && s[0] == '_' { + s = s[1:] + } + for i := range s { + if (s[i] < '0' || s[i] > '9') && (s[i] < 'A' || s[i] > 'Z') { + return "" + } + } + return s +} diff --git a/pkg/proc/fbsdutil/regs.go b/pkg/proc/fbsdutil/regs.go index 94c1303094..4b9cd80bfb 100644 --- a/pkg/proc/fbsdutil/regs.go +++ b/pkg/proc/fbsdutil/regs.go @@ -1,10 +1,8 @@ package fbsdutil import ( - "golang.org/x/arch/x86/x86asm" - "github.com/go-delve/delve/pkg/proc" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/go-delve/delve/pkg/proc/amd64util" ) // AMD64Registers implements the proc.Registers interface for the native/freebsd @@ -12,7 +10,7 @@ import ( type AMD64Registers struct { Regs *AMD64PtraceRegs Fpregs []proc.Register - Fpregset *AMD64Xstate + Fpregset *amd64util.AMD64Xstate Fsbase uint64 loadFpRegs func(*AMD64Registers) error @@ -154,164 +152,6 @@ func (r *AMD64Registers) GAddr() (uint64, bool) { return 0, false } -// Get returns the value of the n-th register (in x86asm order). -func (r *AMD64Registers) Get(n int) (uint64, error) { - reg := x86asm.Reg(n) - const ( - mask8 = 0x000000ff - mask16 = 0x0000ffff - mask32 = 0xffffffff - ) - - switch reg { - // 8-bit - case x86asm.AL: - return uint64(r.Regs.Rax) & mask8, nil - case x86asm.CL: - return uint64(r.Regs.Rcx) & mask8, nil - case x86asm.DL: - return uint64(r.Regs.Rdx) & mask8, nil - case x86asm.BL: - return uint64(r.Regs.Rbx) & mask8, nil - case x86asm.AH: - return (uint64(r.Regs.Rax) >> 8) & mask8, nil - case x86asm.CH: - return (uint64(r.Regs.Rcx) >> 8) & mask8, nil - case x86asm.DH: - return (uint64(r.Regs.Rdx) >> 8) & mask8, nil - case x86asm.BH: - return (uint64(r.Regs.Rbx) >> 8) & mask8, nil - case x86asm.SPB: - return uint64(r.Regs.Rsp) & mask8, nil - case x86asm.BPB: - return uint64(r.Regs.Rbp) & mask8, nil - case x86asm.SIB: - return uint64(r.Regs.Rsi) & mask8, nil - case x86asm.DIB: - return uint64(r.Regs.Rdi) & mask8, nil - case x86asm.R8B: - return uint64(r.Regs.R8) & mask8, nil - case x86asm.R9B: - return uint64(r.Regs.R9) & mask8, nil - case x86asm.R10B: - return uint64(r.Regs.R10) & mask8, nil - case x86asm.R11B: - return uint64(r.Regs.R11) & mask8, nil - case x86asm.R12B: - return uint64(r.Regs.R12) & mask8, nil - case x86asm.R13B: - return uint64(r.Regs.R13) & mask8, nil - case x86asm.R14B: - return uint64(r.Regs.R14) & mask8, nil - case x86asm.R15B: - return uint64(r.Regs.R15) & mask8, nil - - // 16-bit - case x86asm.AX: - return uint64(r.Regs.Rax) & mask16, nil - case x86asm.CX: - return uint64(r.Regs.Rcx) & mask16, nil - case x86asm.DX: - return uint64(r.Regs.Rdx) & mask16, nil - case x86asm.BX: - return uint64(r.Regs.Rbx) & mask16, nil - case x86asm.SP: - return uint64(r.Regs.Rsp) & mask16, nil - case x86asm.BP: - return uint64(r.Regs.Rbp) & mask16, nil - case x86asm.SI: - return uint64(r.Regs.Rsi) & mask16, nil - case x86asm.DI: - return uint64(r.Regs.Rdi) & mask16, nil - case x86asm.R8W: - return uint64(r.Regs.R8) & mask16, nil - case x86asm.R9W: - return uint64(r.Regs.R9) & mask16, nil - case x86asm.R10W: - return uint64(r.Regs.R10) & mask16, nil - case x86asm.R11W: - return uint64(r.Regs.R11) & mask16, nil - case x86asm.R12W: - return uint64(r.Regs.R12) & mask16, nil - case x86asm.R13W: - return uint64(r.Regs.R13) & mask16, nil - case x86asm.R14W: - return uint64(r.Regs.R14) & mask16, nil - case x86asm.R15W: - return uint64(r.Regs.R15) & mask16, nil - - // 32-bit - case x86asm.EAX: - return uint64(r.Regs.Rax) & mask32, nil - case x86asm.ECX: - return uint64(r.Regs.Rcx) & mask32, nil - case x86asm.EDX: - return uint64(r.Regs.Rdx) & mask32, nil - case x86asm.EBX: - return uint64(r.Regs.Rbx) & mask32, nil - case x86asm.ESP: - return uint64(r.Regs.Rsp) & mask32, nil - case x86asm.EBP: - return uint64(r.Regs.Rbp) & mask32, nil - case x86asm.ESI: - return uint64(r.Regs.Rsi) & mask32, nil - case x86asm.EDI: - return uint64(r.Regs.Rdi) & mask32, nil - case x86asm.R8L: - return uint64(r.Regs.R8) & mask32, nil - case x86asm.R9L: - return uint64(r.Regs.R9) & mask32, nil - case x86asm.R10L: - return uint64(r.Regs.R10) & mask32, nil - case x86asm.R11L: - return uint64(r.Regs.R11) & mask32, nil - case x86asm.R12L: - return uint64(r.Regs.R12) & mask32, nil - case x86asm.R13L: - return uint64(r.Regs.R13) & mask32, nil - case x86asm.R14L: - return uint64(r.Regs.R14) & mask32, nil - case x86asm.R15L: - return uint64(r.Regs.R15) & mask32, nil - - // 64-bit - case x86asm.RAX: - return uint64(r.Regs.Rax), nil - case x86asm.RCX: - return uint64(r.Regs.Rcx), nil - case x86asm.RDX: - return uint64(r.Regs.Rdx), nil - case x86asm.RBX: - return uint64(r.Regs.Rbx), nil - case x86asm.RSP: - return uint64(r.Regs.Rsp), nil - case x86asm.RBP: - return uint64(r.Regs.Rbp), nil - case x86asm.RSI: - return uint64(r.Regs.Rsi), nil - case x86asm.RDI: - return uint64(r.Regs.Rdi), nil - case x86asm.R8: - return uint64(r.Regs.R8), nil - case x86asm.R9: - return uint64(r.Regs.R9), nil - case x86asm.R10: - return uint64(r.Regs.R10), nil - case x86asm.R11: - return uint64(r.Regs.R11), nil - case x86asm.R12: - return uint64(r.Regs.R12), nil - case x86asm.R13: - return uint64(r.Regs.R13), nil - case x86asm.R14: - return uint64(r.Regs.R14), nil - case x86asm.R15: - return uint64(r.Regs.R15), nil - } - - return 0, proc.ErrUnknownRegister -} - // Copy returns a copy of these registers that is guaranteed not to change. func (r *AMD64Registers) Copy() (proc.Registers, error) { if r.loadFpRegs != nil { @@ -323,7 +163,7 @@ func (r *AMD64Registers) Copy() (proc.Registers, error) { } var rr AMD64Registers rr.Regs = &AMD64PtraceRegs{} - rr.Fpregset = &AMD64Xstate{} + rr.Fpregset = &amd64util.AMD64Xstate{} *(rr.Regs) = *(r.Regs) if r.Fpregset != nil { *(rr.Fpregset) = *(r.Fpregset) @@ -334,13 +174,3 @@ func (r *AMD64Registers) Copy() (proc.Registers, error) { } return &rr, nil } - -type AMD64Xstate linutil.AMD64Xstate - -func AMD64XstateRead(xstateargs []byte, readLegacy bool, regset *AMD64Xstate) error { - return linutil.AMD64XstateRead(xstateargs, readLegacy, (*linutil.AMD64Xstate)(regset)) -} - -func (xsave *AMD64Xstate) Decode() (regs []proc.Register) { - return (*linutil.AMD64Xstate).Decode((*linutil.AMD64Xstate)(xsave)) -} diff --git a/pkg/proc/fbsdutil/regs_test.go b/pkg/proc/fbsdutil/regs_test.go deleted file mode 100644 index 19aa7641bf..0000000000 --- a/pkg/proc/fbsdutil/regs_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package fbsdutil - -import ( - "testing" - - "golang.org/x/arch/x86/x86asm" -) - -func TestAMD64Get(t *testing.T) { - val := int64(0x7fffffffdeadbeef) - regs := AMD64Registers{ - Regs: &AMD64PtraceRegs{ - Rax: val, - }, - } - // Test AL, low 8 bits of RAX - al, err := regs.Get(int(x86asm.AL)) - if err != nil { - t.Fatal(err) - } - if al != 0xef { - t.Fatalf("expected %#v, got %#v\n", 0xef, al) - } - - // Test AH, high 8 bits of RAX - ah, err := regs.Get(int(x86asm.AH)) - if err != nil { - t.Fatal(err) - } - if ah != 0xBE { - t.Fatalf("expected %#v, got %#v\n", 0xbe, ah) - } - - // Test AX, lower 16 bits of RAX - ax, err := regs.Get(int(x86asm.AX)) - if err != nil { - t.Fatal(err) - } - if ax != 0xBEEF { - t.Fatalf("expected %#v, got %#v\n", 0xbeef, ax) - } - - // Test EAX, lower 32 bits of RAX - eax, err := regs.Get(int(x86asm.EAX)) - if err != nil { - t.Fatal(err) - } - if eax != 0xDEADBEEF { - t.Fatalf("expected %#v, got %#v\n", uint64(0xdeadbeef), eax) - } - - // Test RAX, full 64 bits of register - rax, err := regs.Get(int(x86asm.RAX)) - if err != nil { - t.Fatal(err) - } - if rax != uint64(val) { - t.Fatalf("expected %#v, got %#v\n", val, rax) - } -} diff --git a/pkg/proc/fncall.go b/pkg/proc/fncall.go index 374549d1e3..a512462594 100644 --- a/pkg/proc/fncall.go +++ b/pkg/proc/fncall.go @@ -16,9 +16,9 @@ import ( "github.com/go-delve/delve/pkg/dwarf/godwarf" "github.com/go-delve/delve/pkg/dwarf/op" "github.com/go-delve/delve/pkg/dwarf/reader" + "github.com/go-delve/delve/pkg/dwarf/regnum" "github.com/go-delve/delve/pkg/goversion" "github.com/go-delve/delve/pkg/logflags" - "golang.org/x/arch/x86/x86asm" ) // This file implements the function call injection introduced in go1.11. @@ -42,21 +42,23 @@ import ( const ( debugCallFunctionNamePrefix1 = "debugCall" debugCallFunctionNamePrefix2 = "runtime.debugCall" - debugCallFunctionName = "runtime.debugCallV1" + maxDebugCallVersion = 2 maxArgFrameSize = 65535 + + // maxRegArgBytes is extra padding for ABI1 call injections, equivalent to + // the maximum space occupied by register arguments. + maxRegArgBytes = 9*8 + 15*8 // TODO: Make this generic for other platforms. ) var ( errFuncCallUnsupported = errors.New("function calls not supported by this version of Go") errFuncCallUnsupportedBackend = errors.New("backend does not support function calls") errFuncCallInProgress = errors.New("cannot call function while another function call is already in progress") - errNotACallExpr = errors.New("not a function call") errNoGoroutine = errors.New("no goroutine selected") errGoroutineNotRunning = errors.New("selected goroutine not running") errNotEnoughStack = errors.New("not enough stack space") errTooManyArguments = errors.New("too many arguments") errNotEnoughArguments = errors.New("not enough arguments") - errNoAddrUnsupported = errors.New("arguments to a function call must have an address") errNotAGoFunction = errors.New("not a Go function") errFuncCallNotAllowed = errors.New("function calls not allowed without using 'call'") errFuncCallNotAllowedStrAlloc = errors.New("literal string can not be allocated because function calls are not allowed without using 'call'") @@ -130,6 +132,7 @@ type callInjection struct { continueCompleted chan<- *G continueRequest <-chan continueRequest startThreadID int + endCallInjection func() } func (callCtx *callContext) doContinue() *G { @@ -165,12 +168,12 @@ func EvalExpressionWithCalls(t *Target, g *G, expr string, retLoadCfg LoadConfig return errFuncCallInProgress } - dbgcallfn := bi.LookupFunc[debugCallFunctionName] + dbgcallfn, _ := debugCallFunction(bi) if dbgcallfn == nil { return errFuncCallUnsupported } - scope, err := GoroutineScope(g.Thread) + scope, err := GoroutineScope(t, g.Thread) if err != nil { return err } @@ -186,10 +189,16 @@ func EvalExpressionWithCalls(t *Target, g *G, expr string, retLoadCfg LoadConfig continueCompleted: continueCompleted, } + endCallInjection, err := t.proc.StartCallInjection() + if err != nil { + return err + } + t.fncallForG[g.ID] = &callInjection{ continueCompleted: continueCompleted, continueRequest: continueRequest, startThreadID: 0, + endCallInjection: endCallInjection, } go scope.EvalExpression(expr, retLoadCfg) @@ -204,6 +213,7 @@ func EvalExpressionWithCalls(t *Target, g *G, expr string, retLoadCfg LoadConfig func finishEvalExpressionWithCalls(t *Target, g *G, contReq continueRequest, ok bool) error { fncallLog("stashing return values for %d in thread=%d", g.ID, g.Thread.ThreadID()) + g.Thread.Common().CallReturn = true var err error if !ok { err = errors.New("internal error EvalExpressionWithCalls didn't return anything") @@ -227,7 +237,13 @@ func finishEvalExpressionWithCalls(t *Target, g *G, contReq continueRequest, ok } close(t.fncallForG[g.ID].continueCompleted) - delete(t.fncallForG, g.ID) + callinj := t.fncallForG[g.ID] + for goid := range t.fncallForG { + if t.fncallForG[goid] == callinj { + delete(t.fncallForG, goid) + } + } + callinj.endCallInjection() return err } @@ -273,7 +289,7 @@ func evalFunctionCall(scope *EvalScope, node *ast.CallExpr) (*Variable, error) { return nil, errFuncCallUnsupportedBackend } - dbgcallfn := bi.LookupFunc[debugCallFunctionName] + dbgcallfn, dbgcallversion := debugCallFunction(bi) if dbgcallfn == nil { return nil, errFuncCallUnsupported } @@ -290,8 +306,11 @@ func evalFunctionCall(scope *EvalScope, node *ast.CallExpr) (*Variable, error) { if regs.SP()-256 <= stacklo { return nil, errNotEnoughStack } - _, err = regs.Get(int(x86asm.RAX)) - if err != nil { + protocolReg, ok := debugCallProtocolReg(dbgcallversion) + if !ok { + return nil, errFuncCallUnsupported + } + if bi.Arch.RegistersToDwarfRegisters(0, regs).Reg(protocolReg) == nil { return nil, errFuncCallUnsupportedBackend } @@ -309,12 +328,13 @@ func evalFunctionCall(scope *EvalScope, node *ast.CallExpr) (*Variable, error) { return nil, err } // write the desired argument frame size at SP-(2*pointer_size) (the extra pointer is the saved PC) - if err := writePointer(bi, thread, regs.SP()-3*uint64(bi.Arch.PtrSize()), uint64(fncall.argFrameSize)); err != nil { + if err := writePointer(bi, scope.Mem, regs.SP()-3*uint64(bi.Arch.PtrSize()), uint64(fncall.argFrameSize)); err != nil { return nil, err } fncallLog("function call initiated %v frame size %d goroutine %d (thread %d)", fncall.fn, fncall.argFrameSize, scope.g.ID, thread.ThreadID()) + thread.Breakpoint().Clear() // since we moved address in PC the thread is no longer stopped at a breakpoint, leaving the breakpoint set will confuse Continue p.fncallForG[scope.g.ID].startThreadID = thread.ThreadID() spoff := int64(scope.Regs.Uint64Val(scope.Regs.SPRegNum)) - int64(scope.g.stack.hi) @@ -348,7 +368,7 @@ func evalFunctionCall(scope *EvalScope, node *ast.CallExpr) (*Variable, error) { scope.Regs.FrameBase = fboff + int64(scope.g.stack.hi) scope.Regs.CFA = scope.frameOffset + int64(scope.g.stack.hi) - finished := funcCallStep(scope, &fncall, g.Thread) + finished := funcCallStep(scope, &fncall, g.Thread, protocolReg, dbgcallfn.Name) if finished { break } @@ -387,7 +407,7 @@ type fncallPanicErr struct { } func (err fncallPanicErr) Error() string { - return fmt.Sprintf("panic calling a function") + return "panic calling a function" } func fncallLog(fmtstr string, args ...interface{}) { @@ -407,7 +427,7 @@ func writePointer(bi *BinaryInfo, mem MemoryReadWriter, addr, val uint64) error default: panic(fmt.Errorf("unsupported pointer size %d", len(ptrbuf))) } - _, err := mem.WriteMemory(uintptr(addr), ptrbuf) + _, err := mem.WriteMemory(addr, ptrbuf) return err } @@ -419,13 +439,13 @@ func callOP(bi *BinaryInfo, thread Thread, regs Registers, callAddr uint64) erro sp := regs.SP() // push PC on the stack sp -= uint64(bi.Arch.PtrSize()) - if err := thread.SetSP(sp); err != nil { + if err := setSP(thread, sp); err != nil { return err } - if err := writePointer(bi, thread, sp, regs.PC()); err != nil { + if err := writePointer(bi, thread.ProcessMemory(), sp, regs.PC()); err != nil { return err } - return thread.SetPC(callAddr) + return setPC(thread, callAddr) } // funcCallEvalFuncExpr evaluates expr.Fun and returns the function that we're trying to call. @@ -499,22 +519,23 @@ func funcCallEvalFuncExpr(scope *EvalScope, fncall *functionCallState, allowCall } type funcCallArg struct { - name string - typ godwarf.Type - off int64 - isret bool + name string + typ godwarf.Type + off int64 + dwarfEntry *godwarf.Tree // non-nil if Go 1.17+ + isret bool } // funcCallEvalArgs evaluates the arguments of the function call, copying -// the into the argument frame starting at argFrameAddr. -func funcCallEvalArgs(scope *EvalScope, fncall *functionCallState, argFrameAddr uint64) error { +// them into the argument frame starting at argFrameAddr. +func funcCallEvalArgs(scope *EvalScope, fncall *functionCallState, formalScope *EvalScope) error { if scope.g == nil { // this should never happen return errNoGoroutine } if fncall.receiver != nil { - err := funcCallCopyOneArg(scope, fncall, fncall.receiver, &fncall.formalArgs[0], argFrameAddr) + err := funcCallCopyOneArg(scope, fncall, fncall.receiver, &fncall.formalArgs[0], formalScope) if err != nil { return err } @@ -530,7 +551,7 @@ func funcCallEvalArgs(scope *EvalScope, fncall *functionCallState, argFrameAddr } actualArg.Name = exprToString(fncall.expr.Args[i]) - err = funcCallCopyOneArg(scope, fncall, actualArg, formalArg, argFrameAddr) + err = funcCallCopyOneArg(scope, fncall, actualArg, formalArg, formalScope) if err != nil { return err } @@ -539,7 +560,7 @@ func funcCallEvalArgs(scope *EvalScope, fncall *functionCallState, argFrameAddr return nil } -func funcCallCopyOneArg(scope *EvalScope, fncall *functionCallState, actualArg *Variable, formalArg *funcCallArg, argFrameAddr uint64) error { +func funcCallCopyOneArg(scope *EvalScope, fncall *functionCallState, actualArg *Variable, formalArg *funcCallArg, formalScope *EvalScope) error { if scope.callCtx.checkEscape { //TODO(aarzilli): only apply the escapeCheck to leaking parameters. if err := escapeCheck(actualArg, formalArg.name, scope.g.stack); err != nil { @@ -555,7 +576,16 @@ func funcCallCopyOneArg(scope *EvalScope, fncall *functionCallState, actualArg * //TODO(aarzilli): autmoatic wrapping in interfaces for cases not handled // by convertToEface. - formalArgVar := newVariable(formalArg.name, uintptr(formalArg.off+int64(argFrameAddr)), formalArg.typ, scope.BinInfo, scope.Mem) + var formalArgVar *Variable + if formalArg.dwarfEntry != nil { + var err error + formalArgVar, err = extractVarInfoFromEntry(scope.target, formalScope.BinInfo, formalScope.image(), formalScope.Regs, formalScope.Mem, formalArg.dwarfEntry, 0) + if err != nil { + return err + } + } else { + formalArgVar = newVariable(formalArg.name, uint64(formalArg.off+int64(formalScope.Regs.CFA)), formalArg.typ, scope.BinInfo, scope.Mem) + } if err := scope.setValue(formalArgVar, actualArg, actualArg.Name); err != nil { return err } @@ -564,16 +594,26 @@ func funcCallCopyOneArg(scope *EvalScope, fncall *functionCallState, actualArg * } func funcCallArgs(fn *Function, bi *BinaryInfo, includeRet bool) (argFrameSize int64, formalArgs []funcCallArg, err error) { - const CFA = 0x1000 - dwarfTree, err := fn.cu.image.getDwarfTree(fn.offset) if err != nil { return 0, nil, fmt.Errorf("DWARF read error: %v", err) } - varEntries := reader.Variables(dwarfTree, fn.Entry, int(^uint(0)>>1), reader.VariablesSkipInlinedSubroutines) + producer := bi.Producer() + trustArgOrder := producer != "" && goversion.ProducerAfterOrEqual(bi.Producer(), 1, 12) - trustArgOrder := bi.Producer() != "" && goversion.ProducerAfterOrEqual(bi.Producer(), 1, 12) + if bi.regabi && fn.cu.optimized && fn.Name != "runtime.mallocgc" { + // Debug info for function arguments on optimized functions is currently + // too incomplete to attempt injecting calls to arbitrary optimized + // functions. + // Prior to regabi we could do this because the ABI was simple enough to + // manually encode it in Delve. + // Runtime.mallocgc is an exception, we specifically patch it's DIE to be + // correct for call injection purposes. + return 0, nil, fmt.Errorf("can not call optimized function %s when regabi is in use", fn.Name) + } + + varEntries := reader.Variables(dwarfTree, fn.Entry, int(^uint(0)>>1), reader.VariablesSkipInlinedSubroutines) // typechecks arguments, calculates argument frame size for _, entry := range varEntries { @@ -585,44 +625,37 @@ func funcCallArgs(fn *Function, bi *BinaryInfo, includeRet bool) (argFrameSize i return 0, nil, err } typ = resolveTypedef(typ) - var off int64 - locprog, _, err := bi.locationExpr(entry, dwarf.AttrLocation, fn.Entry) - if err != nil { - err = fmt.Errorf("could not get argument location of %s: %v", argname, err) + var formalArg *funcCallArg + if bi.regabi { + formalArg, err = funcCallArgRegABI(fn, bi, entry, argname, typ, &argFrameSize) } else { - var pieces []op.Piece - off, pieces, err = op.ExecuteStackProgram(op.DwarfRegisters{CFA: CFA, FrameBase: CFA}, locprog, bi.Arch.PtrSize()) - if err != nil { - err = fmt.Errorf("unsupported location expression for argument %s: %v", argname, err) - } - if pieces != nil { - err = fmt.Errorf("unsupported location expression for argument %s (uses DW_OP_piece)", argname) - } - off -= CFA + formalArg, err = funcCallArgOldABI(fn, bi, entry, argname, typ, trustArgOrder, &argFrameSize) } if err != nil { - if !trustArgOrder { - return 0, nil, err - } - - // With Go version 1.12 or later we can trust that the arguments appear - // in the same order as declared, which means we can calculate their - // address automatically. - // With this we can call optimized functions (which sometimes do not have - // an argument address, due to a compiler bug) as well as runtime - // functions (which are always optimized). - off = argFrameSize - off = alignAddr(off, typ.Align()) + return 0, nil, err } - - if e := off + typ.Size(); e > argFrameSize { - argFrameSize = e + if !formalArg.isret || includeRet { + formalArgs = append(formalArgs, *formalArg) } + } - if isret, _ := entry.Val(dwarf.AttrVarParam).(bool); !isret || includeRet { - formalArgs = append(formalArgs, funcCallArg{name: argname, typ: typ, off: off, isret: isret}) - } + if bi.regabi { + // The argument frame size is computed conservatively, assuming that + // there's space for each argument on the stack even if its passed in + // registers. Unfortunately this isn't quite enough because the register + // assignment algorithm Go uses can result in an amount of additional + // space used due to alignment requirements, bounded by the number of argument registers. + // Because we currently don't have an easy way to obtain the frame size, + // let's be even more conservative. + // A safe lower-bound on the size of the argument frame includes space for + // each argument plus the total bytes of register arguments. + // This is derived from worst-case alignment padding of up to + // (pointer-word-bytes - 1) per argument passed in registers. + // See: https://github.com/go-delve/delve/pull/2451#discussion_r665761531 + // TODO: Make this generic for other platforms. + argFrameSize = alignAddr(argFrameSize, 8) + argFrameSize += maxRegArgBytes } sort.Slice(formalArgs, func(i, j int) bool { @@ -632,6 +665,56 @@ func funcCallArgs(fn *Function, bi *BinaryInfo, includeRet bool) (argFrameSize i return argFrameSize, formalArgs, nil } +func funcCallArgOldABI(fn *Function, bi *BinaryInfo, entry reader.Variable, argname string, typ godwarf.Type, trustArgOrder bool, pargFrameSize *int64) (*funcCallArg, error) { + const CFA = 0x1000 + var off int64 + + locprog, _, err := bi.locationExpr(entry, dwarf.AttrLocation, fn.Entry) + if err != nil { + err = fmt.Errorf("could not get argument location of %s: %v", argname, err) + } else { + var pieces []op.Piece + off, pieces, err = op.ExecuteStackProgram(op.DwarfRegisters{CFA: CFA, FrameBase: CFA}, locprog, bi.Arch.PtrSize(), nil) + if err != nil { + err = fmt.Errorf("unsupported location expression for argument %s: %v", argname, err) + } + if pieces != nil { + err = fmt.Errorf("unsupported location expression for argument %s (uses DW_OP_piece)", argname) + } + off -= CFA + } + if err != nil { + if !trustArgOrder { + return nil, err + } + + // With Go version 1.12 or later we can trust that the arguments appear + // in the same order as declared, which means we can calculate their + // address automatically. + // With this we can call optimized functions (which sometimes do not have + // an argument address, due to a compiler bug) as well as runtime + // functions (which are always optimized). + off = *pargFrameSize + off = alignAddr(off, typ.Align()) + } + + if e := off + typ.Size(); e > *pargFrameSize { + *pargFrameSize = e + } + + isret, _ := entry.Val(dwarf.AttrVarParam).(bool) + return &funcCallArg{name: argname, typ: typ, off: off, isret: isret}, nil +} + +func funcCallArgRegABI(fn *Function, bi *BinaryInfo, entry reader.Variable, argname string, typ godwarf.Type, pargFrameSize *int64) (*funcCallArg, error) { + // Conservatively calculate the full stack argument space for ABI0. + *pargFrameSize = alignAddr(*pargFrameSize, typ.Align()) + *pargFrameSize += typ.Size() + + isret, _ := entry.Val(dwarf.AttrVarParam).(bool) + return &funcCallArg{name: argname, typ: typ, dwarfEntry: entry.Tree, isret: isret}, nil +} + // alignAddr rounds up addr to a multiple of align. Align must be a power of 2. func alignAddr(addr, align int64) int64 { return (addr + int64(align-1)) &^ int64(align-1) @@ -671,7 +754,7 @@ func escapeCheck(v *Variable, name string, stack stack) error { } } case reflect.Func: - if err := escapeCheckPointer(uintptr(v.funcvalAddr()), name, stack); err != nil { + if err := escapeCheckPointer(v.funcvalAddr(), name, stack); err != nil { return err } } @@ -679,7 +762,7 @@ func escapeCheck(v *Variable, name string, stack stack) error { return nil } -func escapeCheckPointer(addr uintptr, name string, stack stack) error { +func escapeCheckPointer(addr uint64, name string, stack stack) error { if uint64(addr) >= stack.lo && uint64(addr) < stack.hi { return fmt.Errorf("stack object passed to escaping pointer: %s", name) } @@ -687,15 +770,15 @@ func escapeCheckPointer(addr uintptr, name string, stack stack) error { } const ( - debugCallAXPrecheckFailed = 8 - debugCallAXCompleteCall = 0 - debugCallAXReadReturn = 1 - debugCallAXReadPanic = 2 - debugCallAXRestoreRegisters = 16 + debugCallRegPrecheckFailed = 8 + debugCallRegCompleteCall = 0 + debugCallRegReadReturn = 1 + debugCallRegReadPanic = 2 + debugCallRegRestoreRegisters = 16 ) // funcCallStep executes one step of the function call injection protocol. -func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread) bool { +func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread, protocolReg uint64, debugCallName string) bool { p := callScope.callCtx.p bi := p.BinInfo() @@ -705,7 +788,7 @@ func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread return true } - rax, _ := regs.Get(int(x86asm.RAX)) + regval := bi.Arch.RegistersToDwarfRegisters(0, regs).Uint64Val(protocolReg) if logflags.FnCall() { loc, _ := thread.Location() @@ -717,13 +800,13 @@ func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread fnname = loc.Fn.Name } } - fncallLog("function call interrupt gid=%d (original) thread=%d rax=%#x (PC=%#x in %s)", callScope.g.ID, thread.ThreadID(), rax, pc, fnname) + fncallLog("function call interrupt gid=%d (original) thread=%d regval=%#x (PC=%#x in %s)", callScope.g.ID, thread.ThreadID(), regval, pc, fnname) } - switch rax { - case debugCallAXPrecheckFailed: + switch regval { + case debugCallRegPrecheckFailed: // get error from top of the stack and return it to user - errvar, err := readTopstackVariable(thread, regs, "string", loadFullValue) + errvar, err := readTopstackVariable(p, thread, regs, "string", loadFullValue) if err != nil { fncall.err = fmt.Errorf("could not get precheck error reason: %v", err) break @@ -731,7 +814,7 @@ func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread errvar.Name = "err" fncall.err = fmt.Errorf("%v", constant.StringVal(errvar.Value)) - case debugCallAXCompleteCall: + case debugCallRegCompleteCall: p.fncallForG[callScope.g.ID].startThreadID = 0 // evaluate arguments of the target function, copy them into its argument frame and call the function if fncall.fn == nil || fncall.receiver != nil || fncall.closureAddr != 0 { @@ -759,46 +842,53 @@ func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread if fncall.closureAddr != 0 { // When calling a function pointer we must set the DX register to the // address of the function pointer itself. - thread.SetDX(fncall.closureAddr) + setClosureReg(thread, fncall.closureAddr) } cfa := regs.SP() oldpc := regs.PC() callOP(bi, thread, regs, fncall.fn.Entry) + formalScope, err := GoroutineScope(callScope.target, thread) + if formalScope != nil && formalScope.Regs.CFA != int64(cfa) { + // This should never happen, checking just to avoid hard to figure out disasters. + err = fmt.Errorf("mismatch in CFA %#x (calculated) %#x (expected)", formalScope.Regs.CFA, int64(cfa)) + } + if err == nil { + err = funcCallEvalArgs(callScope, fncall, formalScope) + } - err := funcCallEvalArgs(callScope, fncall, cfa) if err != nil { // rolling back the call, note: this works because we called regs.Copy() above - thread.SetSP(cfa) - thread.SetPC(oldpc) + setSP(thread, cfa) + setPC(thread, oldpc) fncall.err = err fncall.lateCallFailure = true break } - case debugCallAXRestoreRegisters: + case debugCallRegRestoreRegisters: // runtime requests that we restore the registers (all except pc and sp), // this is also the last step of the function call protocol. pc, sp := regs.PC(), regs.SP() if err := thread.RestoreRegisters(fncall.savedRegs); err != nil { fncall.err = fmt.Errorf("could not restore registers: %v", err) } - if err := thread.SetPC(pc); err != nil { + if err := setPC(thread, pc); err != nil { fncall.err = fmt.Errorf("could not restore PC: %v", err) } - if err := thread.SetSP(sp); err != nil { + if err := setSP(thread, sp); err != nil { fncall.err = fmt.Errorf("could not restore SP: %v", err) } - if err := stepInstructionOut(p, thread, debugCallFunctionName, debugCallFunctionName); err != nil { - fncall.err = fmt.Errorf("could not step out of %s: %v", debugCallFunctionName, err) + if err := stepInstructionOut(p, thread, debugCallName, debugCallName); err != nil { + fncall.err = fmt.Errorf("could not step out of %s: %v", debugCallName, err) } return true - case debugCallAXReadReturn: + case debugCallRegReadReturn: // read return arguments from stack if fncall.panicvar != nil || fncall.lateCallFailure { break } - retScope, err := ThreadScope(thread) + retScope, err := ThreadScope(p, thread) if err != nil { fncall.err = fmt.Errorf("could not get return values: %v", err) break @@ -806,8 +896,13 @@ func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread // pretend we are still inside the function we called fakeFunctionEntryScope(retScope, fncall.fn, int64(regs.SP()), regs.SP()-uint64(bi.Arch.PtrSize())) + var flags localsFlags + flags |= localsNoDeclLineCheck // if the function we are calling is an autogenerated stub then declaration lines have no meaning + if !bi.regabi { + flags |= localsTrustArgOrder + } - fncall.retvars, err = retScope.Locals() + fncall.retvars, err = retScope.Locals(flags) if err != nil { fncall.err = fmt.Errorf("could not get return values: %v", err) break @@ -828,9 +923,9 @@ func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread callScope.callCtx.stacks = append(callScope.callCtx.stacks, threadg.stack) } - case debugCallAXReadPanic: + case debugCallRegReadPanic: // read panic value from stack - fncall.panicvar, err = readTopstackVariable(thread, regs, "interface {}", callScope.callCtx.retLoadCfg) + fncall.panicvar, err = readTopstackVariable(p, thread, regs, "interface {}", callScope.callCtx.retLoadCfg) if err != nil { fncall.err = fmt.Errorf("could not get panic: %v", err) break @@ -838,17 +933,17 @@ func funcCallStep(callScope *EvalScope, fncall *functionCallState, thread Thread fncall.panicvar.Name = "~panic" default: - // Got an unknown AX value, this is probably bad but the safest thing + // Got an unknown protocol register value, this is probably bad but the safest thing // possible is to ignore it and hope it didn't matter. - fncallLog("unknown value of AX %#x", rax) + fncallLog("unknown value of protocol register %#x", regval) } return false } -func readTopstackVariable(thread Thread, regs Registers, typename string, loadCfg LoadConfig) (*Variable, error) { +func readTopstackVariable(t *Target, thread Thread, regs Registers, typename string, loadCfg LoadConfig) (*Variable, error) { bi := thread.BinInfo() - scope, err := ThreadScope(thread) + scope, err := ThreadScope(t, thread) if err != nil { return nil, err } @@ -856,7 +951,7 @@ func readTopstackVariable(thread Thread, regs Registers, typename string, loadCf if err != nil { return nil, err } - v := newVariable("", uintptr(regs.SP()), typ, scope.BinInfo, scope.Mem) + v := newVariable("", regs.SP(), typ, scope.BinInfo, scope.Mem) v.loadValue(loadCfg) if v.Unreadable != nil { return nil, v.Unreadable @@ -877,23 +972,17 @@ func fakeFunctionEntryScope(scope *EvalScope, fn *Function, cfa int64, sp uint64 scope.Regs.CFA = cfa scope.Regs.Reg(scope.Regs.SPRegNum).Uint64Val = sp + scope.Regs.Reg(scope.Regs.PCRegNum).Uint64Val = fn.Entry fn.cu.image.dwarfReader.Seek(fn.offset) e, err := fn.cu.image.dwarfReader.Next() if err != nil { return err } - scope.Regs.FrameBase, _, _, _ = scope.BinInfo.Location(e, dwarf.AttrFrameBase, scope.PC, scope.Regs) + scope.Regs.FrameBase, _, _, _ = scope.BinInfo.Location(e, dwarf.AttrFrameBase, scope.PC, scope.Regs, nil) return nil } -func (fncall *functionCallState) returnValues() []*Variable { - if fncall.panicvar != nil { - return []*Variable{fncall.panicvar} - } - return fncall.retvars -} - // allocString allocates spaces for the contents of v if it needs to be allocated func allocString(scope *EvalScope, v *Variable) error { if v.Base != 0 || v.Len == 0 { @@ -932,7 +1021,7 @@ func allocString(scope *EvalScope, v *Variable) error { if len(mallocv.Children) != 1 { return errors.New("internal error, could not interpret return value of mallocgc call") } - v.Base = uintptr(mallocv.Children[0].Addr) + v.Base = mallocv.Children[0].Addr _, err = scope.Mem.WriteMemory(v.Base, []byte(constant.StringVal(v.Value))) return err } @@ -944,6 +1033,10 @@ func isCallInjectionStop(t *Target, thread Thread, loc *Location) bool { if !strings.HasPrefix(loc.Fn.Name, debugCallFunctionNamePrefix1) && !strings.HasPrefix(loc.Fn.Name, debugCallFunctionNamePrefix2) { return false } + if loc.PC == loc.Fn.Entry { + // call injection just started, did not make any progress before being interrupted by a concurrent breakpoint. + return false + } text, err := disassembleCurrentInstruction(t, thread, -1) if err != nil || len(text) <= 0 { return false @@ -1019,3 +1112,83 @@ func findCallInjectionStateForThread(t *Target, thread Thread) (*G, *callInjecti return nil, nil, notfound() } + +// debugCallFunction searches for the debug call function in the binary and +// uses this search to detect the debug call version. +// Returns the debug call function and its version as an integer (the lowest +// valid version is 1) or nil and zero. +func debugCallFunction(bi *BinaryInfo) (*Function, int) { + for version := maxDebugCallVersion; version >= 1; version-- { + name := debugCallFunctionNamePrefix2 + "V" + strconv.Itoa(version) + fn, ok := bi.LookupFunc[name] + if ok && fn != nil { + return fn, version + } + } + return nil, 0 +} + +// debugCallProtocolReg returns the register ID (as defined in pkg/dwarf/regnum) +// of the register used in the debug call protocol, given the debug call version. +// Also returns a bool indicating whether the version is supported. +func debugCallProtocolReg(version int) (uint64, bool) { + // TODO(aarzilli): make this generic when call injection is supported on other architectures. + var protocolReg uint64 + switch version { + case 1: + protocolReg = regnum.AMD64_Rax + case 2: + protocolReg = regnum.AMD64_R12 + default: + return 0, false + } + return protocolReg, true +} + +type fakeEntry map[dwarf.Attr]interface{} + +func (e fakeEntry) Val(attr dwarf.Attr) interface{} { + return e[attr] +} + +func regabiMallocgcWorkaround(bi *BinaryInfo) ([]*godwarf.Tree, error) { + var err1 error + + t := func(name string) godwarf.Type { + if err1 != nil { + return nil + } + typ, err := bi.findType(name) + if err != nil { + err1 = err + return nil + } + return typ + } + + m := func(name string, typ godwarf.Type, reg int, isret bool) *godwarf.Tree { + if err1 != nil { + return nil + } + var e fakeEntry = map[dwarf.Attr]interface{}{ + dwarf.AttrName: name, + dwarf.AttrType: typ.Common().Offset, + dwarf.AttrLocation: []byte{byte(op.DW_OP_reg0) + byte(reg)}, + dwarf.AttrVarParam: isret, + } + + return &godwarf.Tree{ + Entry: e, + Tag: dwarf.TagFormalParameter, + } + } + + r := []*godwarf.Tree{ + m("size", t("uintptr"), regnum.AMD64_Rax, false), + m("typ", t("*runtime._type"), regnum.AMD64_Rbx, false), + m("needzero", t("bool"), regnum.AMD64_Rcx, false), + m("~r1", t("unsafe.Pointer"), regnum.AMD64_Rax, true), + } + + return r, err1 +} diff --git a/pkg/proc/gdbserial/gdbserver.go b/pkg/proc/gdbserial/gdbserver.go index 2ff9bedc07..5c07e6dbc9 100644 --- a/pkg/proc/gdbserial/gdbserver.go +++ b/pkg/proc/gdbserial/gdbserver.go @@ -11,7 +11,7 @@ // The protocol is specified at: // https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html // with additional documentation for lldb specific extensions described at: -// https://github.com/llvm-mirror/lldb/blob/master/docs/lldb-gdb-remote.txt +// https://github.com/llvm/llvm-project/blob/main/lldb/docs/lldb-gdb-remote.txt // // Terminology: // * inferior: the program we are trying to debug @@ -70,16 +70,20 @@ import ( "net" "os" "os/exec" + "path/filepath" "runtime" "strconv" "strings" + "sync" "time" - "golang.org/x/arch/x86/x86asm" - + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/elfwriter" "github.com/go-delve/delve/pkg/logflags" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/go-delve/delve/pkg/proc/macutil" isatty "github.com/mattn/go-isatty" ) @@ -89,49 +93,85 @@ const ( maxTransmitAttempts = 3 // number of retransmission attempts on failed checksum initialInputBufferSize = 2048 // size of the input buffer for gdbConn + + debugServerEnvVar = "DELVE_DEBUGSERVER_PATH" // use this environment variable to override the path to debugserver used by Launch/Attach ) const heartbeatInterval = 10 * time.Second +// Relative to $(xcode-select --print-path)/../ +// xcode-select typically returns the path to the Developer directory, which is a sibling to SharedFrameworks. +var debugserverXcodeRelativeExecutablePath = "SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver" + var debugserverExecutablePaths = []string{ "debugserver", "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver", - "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver", + // Function returns the active developer directory provided by xcode-select to compute a debugserver path. + func() string { + if _, err := exec.LookPath("xcode-select"); err != nil { + return "" + } + + stdout, err := exec.Command("xcode-select", "--print-path").Output() + if err != nil { + return "" + } + + xcodePath := strings.TrimSpace(string(stdout)) + if xcodePath == "" { + return "" + } + + // xcode-select prints the path to the active Developer directory, which is typically a sibling to SharedFrameworks. + return filepath.Join(xcodePath, "..", debugserverXcodeRelativeExecutablePath) + }(), } // ErrDirChange is returned when trying to change execution direction // while there are still internal breakpoints set. var ErrDirChange = errors.New("direction change with internal breakpoints") +// ErrStartCallInjectionBackwards is returned when trying to start a call +// injection while the recording is being run backwards. +var ErrStartCallInjectionBackwards = errors.New("can not start a call injection while running backwards") + +var checkCanUnmaskSignalsOnce sync.Once +var canUnmaskSignalsCached bool + // gdbProcess implements proc.Process using a connection to a debugger stub // that understands Gdb Remote Serial Protocol. type gdbProcess struct { - bi *proc.BinaryInfo - conn gdbConn + bi *proc.BinaryInfo + regnames *gdbRegnames + conn gdbConn threads map[int]*gdbThread currentThread *gdbThread exited, detached bool + almostExited bool // true if 'rr' has sent its synthetic SIGKILL ctrlC bool // ctrl-c was sent to stop inferior manualStopRequested bool breakpoints proc.BreakpointMap - gcmdok bool // true if the stub supports g and G commands + gcmdok bool // true if the stub supports g and (maybe) G commands + _Gcmdok bool // true if the stub supports G command threadStopInfo bool // true if the stub supports qThreadStopInfo tracedir string // if attached to rr the path to the trace directory loadGInstrAddr uint64 // address of the g loading instruction, zero if we couldn't allocate it + breakpointKind int // breakpoint kind to pass to 'z' and 'Z' when creating software breakpoints + process *os.Process waitChan chan *os.ProcessState onDetach func() // called after a successful detach } -var _ proc.ProcessInternal = &gdbProcess{} +var _ proc.RecordingManipulationInternal = &gdbProcess{} // gdbThread represents an operating system thread. type gdbThread struct { @@ -140,8 +180,9 @@ type gdbThread struct { regs gdbRegisters CurrentBreakpoint proc.BreakpointState p *gdbProcess - sig uint8 // signal received by thread after last stop - setbp bool // thread was stopped because of a breakpoint + sig uint8 // signal received by thread after last stop + setbp bool // thread was stopped because of a breakpoint + watchAddr uint64 // if > 0 this is the watchpoint address common proc.CommonThread } @@ -163,11 +204,20 @@ type gdbRegisters struct { gaddr uint64 hasgaddr bool buf []byte + arch *proc.Arch + regnames *gdbRegnames } type gdbRegister struct { value []byte regnum int + + ignoreOnWrite bool +} + +// gdbRegname records names of important CPU registers +type gdbRegnames struct { + PC, SP, BP, CX, FsBase string } // newProcess creates a new Process instance. @@ -182,15 +232,42 @@ func newProcess(process *os.Process) *gdbProcess { inbuf: make([]byte, 0, initialInputBufferSize), direction: proc.Forward, log: logger, + goarch: runtime.GOARCH, + goos: runtime.GOOS, }, threads: make(map[int]*gdbThread), bi: proc.NewBinaryInfo(runtime.GOOS, runtime.GOARCH), + regnames: new(gdbRegnames), breakpoints: proc.NewBreakpointMap(), gcmdok: true, threadStopInfo: true, process: process, } + switch p.bi.Arch.Name { + default: + fallthrough + case "amd64": + p.breakpointKind = 1 + case "arm64": + p.breakpointKind = 4 + } + + p.regnames.PC = registerName(p.bi.Arch, p.bi.Arch.PCRegNum) + p.regnames.SP = registerName(p.bi.Arch, p.bi.Arch.SPRegNum) + p.regnames.BP = registerName(p.bi.Arch, p.bi.Arch.BPRegNum) + + switch p.bi.Arch.Name { + case "arm64": + p.regnames.BP = "fp" + p.regnames.CX = "x0" + case "amd64": + p.regnames.CX = "rcx" + p.regnames.FsBase = "fs_base" + default: + panic("not implemented") + } + if process != nil { p.waitChan = make(chan *os.ProcessState) go func() { @@ -249,22 +326,25 @@ func (p *gdbProcess) Dial(addr string, path string, pid int, debugInfoDirs []str func (p *gdbProcess) Connect(conn net.Conn, path string, pid int, debugInfoDirs []string, stopReason proc.StopReason) (*proc.Target, error) { p.conn.conn = conn p.conn.pid = pid - err := p.conn.handshake() + err := p.conn.handshake(p.regnames) if err != nil { conn.Close() return nil, err } - if verbuf, err := p.conn.exec([]byte("$qGDBServerVersion"), "init"); err == nil { - for _, v := range strings.Split(string(verbuf), ";") { - if strings.HasPrefix(v, "version:") { - if v[len("version:"):] == "902" { - // Workaround for https://bugs.llvm.org/show_bug.cgi?id=36968, 'g' command crashes a version of debugserver on some systems (?) - p.gcmdok = false - break - } - } - } + if p.conn.isDebugserver { + // There are multiple problems with the 'g'/'G' commands on debugserver. + // On version 902 it used to crash the server completely (https://bugs.llvm.org/show_bug.cgi?id=36968), + // on arm64 it results in E74 being returned (https://bugs.llvm.org/show_bug.cgi?id=50169) + // and on systems where AVX-512 is used it returns the floating point + // registers scrambled and sometimes causes the mask registers to be + // zeroed out (https://github.com/go-delve/delve/pull/2498). + // All of these bugs stem from the fact that the main consumer of + // debugserver, lldb, never uses 'g' or 'G' which would make Delve the + // sole tester of those codepaths. + // Therefore we disable it here. The associated code is kept around to be + // used with Mozilla RR. + p.gcmdok = false } tgt, err := p.initialize(path, debugInfoDirs, stopReason) @@ -272,23 +352,37 @@ func (p *gdbProcess) Connect(conn net.Conn, path string, pid int, debugInfoDirs return nil, err } - // None of the stubs we support returns the value of fs_base or gs_base - // along with the registers, therefore we have to resort to executing a MOV - // instruction on the inferior to find out where the G struct of a given - // thread is located. - // Here we try to allocate some memory on the inferior which we will use to - // store the MOV instruction. - // If the stub doesn't support memory allocation reloadRegisters will - // overwrite some existing memory to store the MOV. - if addr, err := p.conn.allocMemory(256); err == nil { - if _, err := p.conn.writeMemory(uintptr(addr), p.loadGInstr()); err == nil { - p.loadGInstrAddr = addr + if p.bi.Arch.Name != "arm64" { + // None of the stubs we support returns the value of fs_base or gs_base + // along with the registers, therefore we have to resort to executing a MOV + // instruction on the inferior to find out where the G struct of a given + // thread is located. + // Here we try to allocate some memory on the inferior which we will use to + // store the MOV instruction. + // If the stub doesn't support memory allocation reloadRegisters will + // overwrite some existing memory to store the MOV. + if addr, err := p.conn.allocMemory(256); err == nil { + if _, err := p.conn.writeMemory(addr, p.loadGInstr()); err == nil { + p.loadGInstrAddr = addr + } } } return tgt, nil } +func (p *gdbProcess) SupportsBPF() bool { + return false +} + +func (dbp *gdbProcess) GetBufferedTracepoints() []ebpf.RawUProbeParams { + return nil +} + +func (dbp *gdbProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error { + panic("not implemented") +} + // unusedPort returns an unused tcp port // This is a hack and subject to a race condition with other running // programs, but most (all?) OS will cycle through all ephemeral ports @@ -307,7 +401,13 @@ func unusedPort() string { // getDebugServerAbsolutePath returns a string of the absolute path to the debugserver binary IFF it is // found in the system path ($PATH), the Xcode bundle or the standalone CLT location. func getDebugServerAbsolutePath() string { + if path := os.Getenv(debugServerEnvVar); path != "" { + return path + } for _, debugServerPath := range debugserverExecutablePaths { + if debugServerPath == "" { + continue + } if _, err := exec.LookPath(debugServerPath); err == nil { return debugServerPath } @@ -315,6 +415,14 @@ func getDebugServerAbsolutePath() string { return "" } +func canUnmaskSignals(debugServerExecutable string) bool { + checkCanUnmaskSignalsOnce.Do(func() { + buf, _ := exec.Command(debugServerExecutable, "--unmask-signals").CombinedOutput() + canUnmaskSignalsCached = !strings.Contains(string(buf), "unrecognized option") + }) + return canUnmaskSignalsCached +} + // commandLogger is a wrapper around the exec.Command() function to log the arguments prior to // starting the process func commandLogger(binary string, arguments ...string) *exec.Cmd { @@ -342,25 +450,23 @@ func getLdEnvVars() []string { // LLDBLaunch starts an instance of lldb-server and connects to it, asking // it to launch the specified target program with the specified arguments // (cmd) on the specified directory wd. -func LLDBLaunch(cmd []string, wd string, foreground bool, debugInfoDirs []string, tty string, redirects [3]string) (*proc.Target, error) { +func LLDBLaunch(cmd []string, wd string, flags proc.LaunchFlags, debugInfoDirs []string, tty string, redirects [3]string) (*proc.Target, error) { if runtime.GOOS == "windows" { return nil, ErrUnsupportedOS } - - if foreground { - // Disable foregrounding if we can't open /dev/tty or debugserver will - // crash. See issue #1215. - if !isatty.IsTerminal(os.Stdin.Fd()) { - foreground = false - } + if err := macutil.CheckRosetta(); err != nil { + return nil, err } + foreground := flags&proc.LaunchForeground != 0 + var ( isDebugserver bool listener net.Listener port string process *exec.Cmd err error + hasRedirects bool ) if debugserverExecutable := getDebugServerAbsolutePath(); debugserverExecutable != "" { @@ -380,18 +486,15 @@ func LLDBLaunch(cmd []string, wd string, foreground bool, debugInfoDirs []string for i := range redirects { if redirects[i] != "" { found[i] = true + hasRedirects = true args = append(args, fmt.Sprintf("--%s-path", names[i]), redirects[i]) } } - if foreground { - if !found[0] && !found[1] && !found[2] { - args = append(args, "--stdio-path", "/dev/tty") - } else { - for i := range found { - if !found[i] { - args = append(args, fmt.Sprintf("--%s-path", names[i]), "/dev/tty") - } + if foreground || hasRedirects { + for i := range found { + if !found[i] { + args = append(args, fmt.Sprintf("--%s-path", names[i]), "/dev/"+names[i]) } } } @@ -400,6 +503,12 @@ func LLDBLaunch(cmd []string, wd string, foreground bool, debugInfoDirs []string if logflags.LLDBServerOutput() { args = append(args, "-g", "-l", "stdout") } + if flags&proc.LaunchDisableASLR != 0 { + args = append(args, "-D") + } + if canUnmaskSignals(debugserverExecutable) { + args = append(args, "--unmask-signals") + } args = append(args, "-F", "-R", fmt.Sprintf("127.0.0.1:%d", listener.Addr().(*net.TCPAddr).Port), "--") args = append(args, cmd...) @@ -418,19 +527,23 @@ func LLDBLaunch(cmd []string, wd string, foreground bool, debugInfoDirs []string process = commandLogger("lldb-server", args...) } - if logflags.LLDBServerOutput() || logflags.GdbWire() || foreground { + if logflags.LLDBServerOutput() || logflags.GdbWire() || foreground || hasRedirects { process.Stdout = os.Stdout process.Stderr = os.Stderr } - if foreground { - foregroundSignalsIgnore() + if foreground || hasRedirects { + if isatty.IsTerminal(os.Stdin.Fd()) { + foregroundSignalsIgnore() + } process.Stdin = os.Stdin } if wd != "" { process.Dir = wd } - process.SysProcAttr = sysProcAttr(foreground) + if isatty.IsTerminal(os.Stdin.Fd()) { + process.SysProcAttr = sysProcAttr(foreground) + } if runtime.GOOS == "darwin" { process.Env = proc.DisableAsyncPreemptEnv() @@ -461,6 +574,9 @@ func LLDBAttach(pid int, path string, debugInfoDirs []string) (*proc.Target, err if runtime.GOOS == "windows" { return nil, ErrUnsupportedOS } + if err := macutil.CheckRosetta(); err != nil { + return nil, err + } var ( isDebugserver bool @@ -475,7 +591,11 @@ func LLDBAttach(pid int, path string, debugInfoDirs []string) (*proc.Target, err if err != nil { return nil, err } - process = commandLogger(debugserverExecutable, "-R", fmt.Sprintf("127.0.0.1:%d", listener.Addr().(*net.TCPAddr).Port), "--attach="+strconv.Itoa(pid)) + args := []string{"-R", fmt.Sprintf("127.0.0.1:%d", listener.Addr().(*net.TCPAddr).Port), "--attach=" + strconv.Itoa(pid)} + if canUnmaskSignals(debugserverExecutable) { + args = append(args, "--unmask-signals") + } + process = commandLogger(debugserverExecutable, args...) } else { if _, err = exec.LookPath("lldb-server"); err != nil { return nil, &ErrBackendUnavailable{} @@ -508,12 +628,27 @@ func LLDBAttach(pid int, path string, debugInfoDirs []string) (*proc.Target, err // debugging PIEs. func (p *gdbProcess) EntryPoint() (uint64, error) { var entryPoint uint64 - if auxv, err := p.conn.readAuxv(); err == nil { + if p.bi.GOOS == "darwin" && p.bi.Arch.Name == "arm64" { + // There is no auxv on darwin, however, we can get the location of the mach-o + // header from the debugserver by going through the loaded libraries, which includes + // the exe itself + images, _ := p.conn.getLoadedDynamicLibraries() + for _, image := range images { + if image.MachHeader.FileType == macho.TypeExec { + // This is a bit hacky. This is technically not the entrypoint, + // but rather we use the variable to points at the mach-o header, + // so we can get the offset in bininfo + entryPoint = image.LoadAddress + break + } + } + } else if auxv, err := p.conn.readAuxv(); err == nil { // If we can't read the auxiliary vector it just means it's not supported // by the OS or by the stub. If we are debugging a PIE and the entry point // is needed proc.LoadBinaryInfo will complain about it. entryPoint = linutil.EntryPointFromAuxv(auxv, p.BinInfo().Arch.PtrSize()) } + return entryPoint, nil } @@ -571,11 +706,12 @@ func (p *gdbProcess) initialize(path string, debugInfoDirs []string, stopReason return nil, err } } - tgt, err := proc.NewTarget(p, proc.NewTargetConfig{ + tgt, err := proc.NewTarget(p, p.conn.pid, p.currentThread, proc.NewTargetConfig{ Path: path, DebugInfoDirs: debugInfoDirs, DisableAsyncPreempt: runtime.GOOS == "darwin", - StopReason: stopReason}) + StopReason: stopReason, + CanDump: runtime.GOOS == "darwin"}) if err != nil { p.conn.conn.Close() return nil, err @@ -618,7 +754,10 @@ func (p *gdbProcess) Valid() (bool, error) { return false, proc.ErrProcessDetached } if p.exited { - return false, &proc.ErrProcessExited{Pid: p.Pid()} + return false, proc.ErrProcessExited{Pid: p.Pid()} + } + if p.almostExited && p.conn.direction == proc.Forward { + return false, proc.ErrProcessExited{Pid: p.Pid()} } return true, nil } @@ -644,15 +783,9 @@ func (p *gdbProcess) ThreadList() []proc.Thread { return r } -// CurrentThread returns the current active -// selected thread. -func (p *gdbProcess) CurrentThread() proc.Thread { - return p.currentThread -} - -// SetCurrentThread is used internally by proc.Target to change the current thread. -func (p *gdbProcess) SetCurrentThread(th proc.Thread) { - p.currentThread = th.(*gdbThread) +// Memory returns the process memory. +func (p *gdbProcess) Memory() proc.MemoryReadWriter { + return p } const ( @@ -662,6 +795,10 @@ const ( childSignal = 0x11 stopSignal = 0x13 + _SIGILL = 0x4 + _SIGFPE = 0x8 + _SIGKILL = 0x9 + debugServerTargetExcBadAccess = 0x91 debugServerTargetExcBadInstruction = 0x92 debugServerTargetExcArithmetic = 0x93 @@ -674,7 +811,13 @@ const ( // a breakpoint is hit or signal is received. func (p *gdbProcess) ContinueOnce() (proc.Thread, proc.StopReason, error) { if p.exited { - return nil, proc.StopExited, &proc.ErrProcessExited{Pid: p.conn.pid} + return nil, proc.StopExited, proc.ErrProcessExited{Pid: p.conn.pid} + } + if p.almostExited { + if p.conn.direction == proc.Forward { + return nil, proc.StopExited, proc.ErrProcessExited{Pid: p.conn.pid} + } + p.almostExited = false } if p.conn.direction == proc.Forward { @@ -701,15 +844,15 @@ func (p *gdbProcess) ContinueOnce() (proc.Thread, proc.StopReason, error) { var atstart bool continueLoop: for { - var err error - var sig uint8 tu.Reset() - threadID, sig, err = p.conn.resume(p.threads, &tu) + sp, err := p.conn.resume(p.threads, &tu) + threadID = sp.threadID if err != nil { if _, exited := err.(proc.ErrProcessExited); exited { p.exited = true + return nil, proc.StopExited, err } - return nil, proc.StopExited, err + return nil, proc.StopUnknown, err } // For stubs that support qThreadStopInfo updateThreadList will @@ -720,11 +863,16 @@ continueLoop: if trapthread != nil && !p.threadStopInfo { // For stubs that do not support qThreadStopInfo we manually set the // reason the thread returned by resume() stopped. - trapthread.sig = sig + trapthread.sig = sp.sig + trapthread.watchAddr = sp.watchAddr } - var shouldStop bool - trapthread, atstart, shouldStop = p.handleThreadSignals(trapthread) + var shouldStop, shouldExitErr bool + trapthread, atstart, shouldStop, shouldExitErr = p.handleThreadSignals(trapthread) + if shouldExitErr { + p.almostExited = true + return nil, proc.StopExited, proc.ErrProcessExited{Pid: p.conn.pid} + } if shouldStop { break continueLoop } @@ -751,25 +899,12 @@ continueLoop: return nil, stopReason, fmt.Errorf("could not find thread %s", threadID) } - var err error - switch trapthread.sig { - case 0x91: - err = errors.New("bad access") - case 0x92: - err = errors.New("bad instruction") - case 0x93: - err = errors.New("arithmetic exception") - case 0x94: - err = errors.New("emulation exception") - case 0x95: - err = errors.New("software exception") - case 0x96: - err = errors.New("breakpoint exception") - } + err := machTargetExcToError(trapthread.sig) if err != nil { // the signals that are reported here can not be propagated back to the target process. trapthread.sig = 0 } + p.currentThread = trapthread return trapthread, stopReason, err } @@ -787,7 +922,7 @@ func (p *gdbProcess) findThreadByStrID(threadID string) *gdbThread { // and returns true if we should stop execution in response to one of the // signals and return control to the user. // Adjusts trapthread to a thread that we actually want to stop at. -func (p *gdbProcess) handleThreadSignals(trapthread *gdbThread) (trapthreadOut *gdbThread, atstart bool, shouldStop bool) { +func (p *gdbProcess) handleThreadSignals(trapthread *gdbThread) (trapthreadOut *gdbThread, atstart, shouldStop, shouldExitErr bool) { var trapthreadCandidate *gdbThread for _, th := range p.threads { @@ -812,6 +947,16 @@ func (p *gdbProcess) handleThreadSignals(trapthread *gdbThread) (trapthreadOut * case stopSignal: // stop isStopSignal = true + case _SIGKILL: + if p.tracedir != "" { + // RR will send a synthetic SIGKILL packet right before the program + // exits, even if the program exited normally. + // Treat this signal as if the process had exited because right after + // this it is still possible to set breakpoints and rewind the process. + shouldExitErr = true + isStopSignal = true + } + // The following are fake BSD-style signals sent by debugserver // Unfortunately debugserver can not convert them into signals for the // process so we must stop here. @@ -856,7 +1001,7 @@ func (p *gdbProcess) handleThreadSignals(trapthread *gdbThread) (trapthreadOut * shouldStop = true } - return trapthread, atstart, shouldStop + return trapthread, atstart, shouldStop, shouldExitErr } // RequestManualStop will attempt to stop the process @@ -932,12 +1077,13 @@ func (p *gdbProcess) Detach(kill bool) error { } // Restart will restart the process from the given position. -func (p *gdbProcess) Restart(pos string) error { +func (p *gdbProcess) Restart(pos string) (proc.Thread, error) { if p.tracedir == "" { - return proc.ErrNotRecorded + return nil, proc.ErrNotRecorded } p.exited = false + p.almostExited = false for _, th := range p.threads { th.clearBreakpointState() @@ -947,28 +1093,28 @@ func (p *gdbProcess) Restart(pos string) error { err := p.conn.restart(pos) if err != nil { - return err + return nil, err } // for some reason we have to send a vCont;c after a vRun to make rr behave // properly, because that's what gdb does. - _, _, err = p.conn.resume(nil, nil) + _, err = p.conn.resume(nil, nil) if err != nil { - return err + return nil, err } err = p.updateThreadList(&threadUpdater{p: p}) if err != nil { - return err + return nil, err } p.clearThreadSignals() p.clearThreadRegisters() - for addr := range p.breakpoints.M { - p.conn.setBreakpoint(addr) + for _, bp := range p.breakpoints.M { + p.WriteBreakpoint(bp) } - return p.setCurrentBreakpoints() + return p.currentThread, p.setCurrentBreakpoints() } // When executes the 'when' command for the Mozilla RR backend. @@ -1075,13 +1221,46 @@ func (p *gdbProcess) ChangeDirection(dir proc.Direction) error { if p.conn.direction == dir { return nil } - if p.Breakpoints().HasInternalBreakpoints() { + if p.Breakpoints().HasSteppingBreakpoints() { return ErrDirChange } p.conn.direction = dir return nil } +// StartCallInjection notifies the backend that we are about to inject a function call. +func (p *gdbProcess) StartCallInjection() (func(), error) { + if p.tracedir == "" { + return func() {}, nil + } + if p.conn.conn == nil { + return nil, proc.ErrProcessExited{Pid: p.conn.pid} + } + if p.conn.direction != proc.Forward { + return nil, ErrStartCallInjectionBackwards + } + + // Normally it's impossible to inject function calls in a recorded target + // because the sequence of instructions that the target will execute is + // predetermined. + // RR however allows this in a "diversion". When a diversion is started rr + // takes the current state of the process and runs it forward as a normal + // process, not following the recording. + // The gdb serial protocol does not have a way to start a diversion and gdb + // (the main frontend of rr) does not know how to do it. Instead a + // diversion is started by reading siginfo, because that's the first + // request gdb does when starting a function call injection. + + _, err := p.conn.qXfer("siginfo", "", true) + if err != nil { + return nil, err + } + + return func() { + _ = p.conn.qXferWrite("siginfo", "") // rr always returns an error for qXfer:siginfo:write... even though it works + }, nil +} + // GetDirection returns the current direction of execution. func (p *gdbProcess) GetDirection() proc.Direction { return p.conn.direction @@ -1101,18 +1280,33 @@ func (p *gdbProcess) FindBreakpoint(pc uint64) (*proc.Breakpoint, bool) { return nil, false } -func (p *gdbProcess) WriteBreakpoint(addr uint64) (string, int, *proc.Function, []byte, error) { - f, l, fn := p.bi.PCToLine(uint64(addr)) - - if err := p.conn.setBreakpoint(addr); err != nil { - return "", 0, nil, nil, err +func watchTypeToBreakpointType(wtype proc.WatchType) breakpointType { + switch { + case wtype.Read() && wtype.Write(): + return accessWatchpoint + case wtype.Write(): + return writeWatchpoint + case wtype.Read(): + return readWatchpoint + default: + return swBreakpoint } +} - return f, l, fn, nil, nil +func (p *gdbProcess) WriteBreakpoint(bp *proc.Breakpoint) error { + kind := p.breakpointKind + if bp.WatchType != 0 { + kind = bp.WatchType.Size() + } + return p.conn.setBreakpoint(bp.Addr, watchTypeToBreakpointType(bp.WatchType), kind) } func (p *gdbProcess) EraseBreakpoint(bp *proc.Breakpoint) error { - return p.conn.clearBreakpoint(bp.Addr) + kind := p.breakpointKind + if bp.WatchType != 0 { + kind = bp.WatchType.Size() + } + return p.conn.clearBreakpoint(bp.Addr, watchTypeToBreakpointType(bp.WatchType), kind) } type threadUpdater struct { @@ -1204,7 +1398,7 @@ func (p *gdbProcess) updateThreadList(tu *threadUpdater) error { for _, th := range p.threads { if p.threadStopInfo { - sig, reason, err := p.conn.threadStopInfo(th.strID) + sp, err := p.conn.threadStopInfo(th.strID) if err != nil { if isProtocolErrorUnsupported(err) { p.threadStopInfo = false @@ -1212,10 +1406,12 @@ func (p *gdbProcess) updateThreadList(tu *threadUpdater) error { } return err } - th.setbp = (reason == "breakpoint" || (reason == "" && sig == breakpointSignal)) - th.sig = sig + th.setbp = (sp.reason == "breakpoint" || (sp.reason == "" && sp.sig == breakpointSignal) || (sp.watchAddr > 0)) + th.sig = sp.sig + th.watchAddr = sp.watchAddr } else { th.sig = 0 + th.watchAddr = 0 } } @@ -1260,8 +1456,8 @@ func (p *gdbProcess) setCurrentBreakpoints() error { } // ReadMemory will read into 'data' memory at the address provided. -func (t *gdbThread) ReadMemory(data []byte, addr uintptr) (n int, err error) { - err = t.p.conn.readMemory(data, addr) +func (p *gdbProcess) ReadMemory(data []byte, addr uint64) (n int, err error) { + err = p.conn.readMemory(data, addr) if err != nil { return 0, err } @@ -1269,8 +1465,12 @@ func (t *gdbThread) ReadMemory(data []byte, addr uintptr) (n int, err error) { } // WriteMemory will write into the memory at 'addr' the data provided. -func (t *gdbThread) WriteMemory(addr uintptr, data []byte) (written int, err error) { - return t.p.conn.writeMemory(addr, data) +func (p *gdbProcess) WriteMemory(addr uint64, data []byte) (written int, err error) { + return p.conn.writeMemory(addr, data) +} + +func (t *gdbThread) ProcessMemory() proc.MemoryReadWriter { + return t.p } // Location returns the current location of this thread. @@ -1279,7 +1479,7 @@ func (t *gdbThread) Location() (*proc.Location, error) { if err != nil { return nil, err } - if pcreg, ok := regs.(*gdbRegisters).regs[regnamePC]; !ok { + if pcreg, ok := regs.(*gdbRegisters).regs[regs.(*gdbRegisters).regnames.PC]; !ok { t.p.conn.log.Errorf("thread %d could not find RIP register", t.ID) } else if len(pcreg.value) < t.p.bi.Arch.PtrSize() { t.p.conn.log.Errorf("thread %d bad length for RIP register: %d", t.ID, len(pcreg.value)) @@ -1328,17 +1528,17 @@ func (t *gdbThread) Common() *proc.CommonThread { // StepInstruction will step exactly 1 CPU instruction. func (t *gdbThread) StepInstruction() error { pc := t.regs.PC() - if _, atbp := t.p.breakpoints.M[pc]; atbp { - err := t.p.conn.clearBreakpoint(pc) + if bp, atbp := t.p.breakpoints.M[pc]; atbp && bp.WatchType == 0 { + err := t.p.conn.clearBreakpoint(pc, swBreakpoint, t.p.breakpointKind) if err != nil { return err } - defer t.p.conn.setBreakpoint(pc) + defer t.p.conn.setBreakpoint(pc, swBreakpoint, t.p.breakpointKind) } // Reset thread registers so the next call to // Thread.Registers will not be cached. t.regs.regs = nil - return t.p.conn.step(t.strID, &threadUpdater{p: t.p}, false) + return t.p.conn.step(t, &threadUpdater{p: t.p}, false) } // Blocked returns true if the thread is blocked in runtime or kernel code. @@ -1388,7 +1588,40 @@ func (p *gdbProcess) loadGInstr() []byte { return buf.Bytes() } -func (regs *gdbRegisters) init(regsInfo []gdbRegisterInfo) { +func (p *gdbProcess) MemoryMap() ([]proc.MemoryMapEntry, error) { + r := []proc.MemoryMapEntry{} + addr := uint64(0) + for addr != ^uint64(0) { + mri, err := p.conn.memoryRegionInfo(addr) + if err != nil { + return nil, err + } + if addr+mri.size <= addr { + return nil, errors.New("qMemoryRegionInfo response wrapped around the address space or stuck") + } + if mri.permissions != "" { + var mme proc.MemoryMapEntry + + mme.Addr = addr + mme.Size = mri.size + mme.Read = strings.Contains(mri.permissions, "r") + mme.Write = strings.Contains(mri.permissions, "w") + mme.Exec = strings.Contains(mri.permissions, "x") + + r = append(r, mme) + } + addr += mri.size + } + return r, nil +} + +func (p *gdbProcess) DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (threadsDone bool, out []elfwriter.Note, err error) { + return false, notes, nil +} + +func (regs *gdbRegisters) init(regsInfo []gdbRegisterInfo, arch *proc.Arch, regnames *gdbRegnames) { + regs.arch = arch + regs.regnames = regnames regs.regs = make(map[string]gdbRegister) regs.regsInfo = regsInfo @@ -1400,22 +1633,27 @@ func (regs *gdbRegisters) init(regsInfo []gdbRegisterInfo) { } regs.buf = make([]byte, regsz) for _, reginfo := range regsInfo { - regs.regs[reginfo.Name] = gdbRegister{regnum: reginfo.Regnum, value: regs.buf[reginfo.Offset : reginfo.Offset+reginfo.Bitsize/8]} + regs.regs[reginfo.Name] = regs.gdbRegisterNew(®info) } } +func (regs *gdbRegisters) gdbRegisterNew(reginfo *gdbRegisterInfo) gdbRegister { + return gdbRegister{regnum: reginfo.Regnum, value: regs.buf[reginfo.Offset : reginfo.Offset+reginfo.Bitsize/8], ignoreOnWrite: reginfo.ignoreOnWrite} +} + // reloadRegisters loads the current value of the thread's registers. // It will also load the address of the thread's G. // Loading the address of G can be done in one of two ways reloadGAlloc, if // the stub can allocate memory, or reloadGAtPC, if the stub can't. func (t *gdbThread) reloadRegisters() error { if t.regs.regs == nil { - t.regs.init(t.p.conn.regsInfo) + t.regs.init(t.p.conn.regsInfo, t.p.bi.Arch, t.p.regnames) } if t.p.gcmdok { if err := t.p.conn.readRegisters(t.strID, t.regs.buf); err != nil { - if isProtocolErrorUnsupported(err) { + gdberr, isProt := err.(*GdbProtocolError) + if isProtocolErrorUnsupported(err) || (t.p.conn.isDebugserver && isProt && gdberr.code == "E74") { t.p.gcmdok = false } else { return err @@ -1430,9 +1668,8 @@ func (t *gdbThread) reloadRegisters() error { } } - switch t.p.bi.GOOS { - case "linux": - if reg, hasFsBase := t.regs.regs[regnameFsBase]; hasFsBase { + if t.p.bi.GOOS == "linux" { + if reg, hasFsBase := t.regs.regs[t.p.regnames.FsBase]; hasFsBase { t.regs.gaddr = 0 t.regs.tls = binary.LittleEndian.Uint64(reg.value) t.regs.hasgaddr = false @@ -1440,10 +1677,21 @@ func (t *gdbThread) reloadRegisters() error { } } - if t.p.loadGInstrAddr > 0 { - return t.reloadGAlloc() + if t.p.bi.Arch.Name == "arm64" { + // no need to play around with the GInstr on ARM64 because + // the G addr is stored in a register + + t.regs.gaddr = t.regs.byName("x28") + t.regs.hasgaddr = true + t.regs.tls = 0 + } else { + if t.p.loadGInstrAddr > 0 { + return t.reloadGAlloc() + } + return t.reloadGAtPC() } - return t.reloadGAtPC() + + return nil } func (t *gdbThread) writeSomeRegisters(regNames ...string) error { @@ -1459,10 +1707,19 @@ func (t *gdbThread) writeSomeRegisters(regNames ...string) error { } func (t *gdbThread) writeRegisters() error { - if t.p.gcmdok { - return t.p.conn.writeRegisters(t.strID, t.regs.buf) + if t.p.gcmdok && t.p._Gcmdok { + err := t.p.conn.writeRegisters(t.strID, t.regs.buf) + if isProtocolErrorUnsupported(err) { + t.p._Gcmdok = false + } else { + return err + } + } for _, r := range t.regs.regs { + if r.ignoreOnWrite { + continue + } if err := t.p.conn.writeRegister(t.strID, r.regnum, r.value); err != nil { return err } @@ -1506,43 +1763,46 @@ func (t *gdbThread) reloadGAtPC() error { // around by clearing and re-setting the breakpoint in a specific sequence // with the memory writes. // Additionally all breakpoints in [pc, pc+len(movinstr)] need to be removed - for addr := range t.p.breakpoints.M { + for addr, bp := range t.p.breakpoints.M { + if bp.WatchType != 0 { + continue + } if addr >= pc && addr <= pc+uint64(len(movinstr)) { - err := t.p.conn.clearBreakpoint(addr) + err := t.p.conn.clearBreakpoint(addr, swBreakpoint, t.p.breakpointKind) if err != nil { return err } - defer t.p.conn.setBreakpoint(addr) + defer t.p.conn.setBreakpoint(addr, swBreakpoint, t.p.breakpointKind) } } savedcode := make([]byte, len(movinstr)) - _, err := t.ReadMemory(savedcode, uintptr(pc)) + _, err := t.p.ReadMemory(savedcode, pc) if err != nil { return err } - _, err = t.WriteMemory(uintptr(pc), movinstr) + _, err = t.p.WriteMemory(pc, movinstr) if err != nil { return err } defer func() { - _, err0 := t.WriteMemory(uintptr(pc), savedcode) + _, err0 := t.p.WriteMemory(pc, savedcode) if err == nil { err = err0 } t.regs.setPC(pc) t.regs.setCX(cx) - err1 := t.writeSomeRegisters(regnamePC, regnameCX) + err1 := t.writeSomeRegisters(t.p.regnames.PC, t.p.regnames.CX) if err == nil { err = err1 } }() - err = t.p.conn.step(t.strID, nil, true) + err = t.p.conn.step(t, nil, true) if err != nil { - if err == threadBlockedError { + if err == errThreadBlocked { t.regs.tls = 0 t.regs.gaddr = 0 t.regs.hasgaddr = true @@ -1551,7 +1811,7 @@ func (t *gdbThread) reloadGAtPC() error { return err } - if err := t.readSomeRegisters(regnamePC, regnameCX); err != nil { + if err := t.readSomeRegisters(t.p.regnames.PC, t.p.regnames.CX); err != nil { return err } @@ -1578,7 +1838,7 @@ func (t *gdbThread) reloadGAlloc() error { pc := t.regs.PC() t.regs.setPC(t.p.loadGInstrAddr) - if err := t.writeSomeRegisters(regnamePC); err != nil { + if err := t.writeSomeRegisters(t.p.regnames.PC); err != nil { return err } @@ -1587,15 +1847,15 @@ func (t *gdbThread) reloadGAlloc() error { defer func() { t.regs.setPC(pc) t.regs.setCX(cx) - err1 := t.writeSomeRegisters(regnamePC, regnameCX) + err1 := t.writeSomeRegisters(t.p.regnames.PC, t.p.regnames.CX) if err == nil { err = err1 } }() - err = t.p.conn.step(t.strID, nil, true) + err = t.p.conn.step(t, nil, true) if err != nil { - if err == threadBlockedError { + if err == errThreadBlocked { t.regs.tls = 0 t.regs.gaddr = 0 t.regs.hasgaddr = true @@ -1604,7 +1864,7 @@ func (t *gdbThread) reloadGAlloc() error { return err } - if err := t.readSomeRegisters(regnameCX); err != nil { + if err := t.readSomeRegisters(t.p.regnames.CX); err != nil { return err } @@ -1624,6 +1884,13 @@ func (t *gdbThread) SetCurrentBreakpoint(adjustPC bool) error { // adjustPC is ignored, it is the stub's responsibiility to set the PC // address correctly after hitting a breakpoint. t.clearBreakpointState() + if t.watchAddr > 0 { + t.CurrentBreakpoint.Breakpoint = t.p.Breakpoints().M[t.watchAddr] + if t.CurrentBreakpoint.Breakpoint == nil { + return fmt.Errorf("could not find watchpoint at address %#x", t.watchAddr) + } + return nil + } regs, err := t.Registers() if err != nil { return err @@ -1631,50 +1898,37 @@ func (t *gdbThread) SetCurrentBreakpoint(adjustPC bool) error { pc := regs.PC() if bp, ok := t.p.FindBreakpoint(pc); ok { if t.regs.PC() != bp.Addr { - if err := t.SetPC(bp.Addr); err != nil { + if err := t.setPC(bp.Addr); err != nil { return err } } - t.CurrentBreakpoint = bp.CheckCondition(t) - if t.CurrentBreakpoint.Breakpoint != nil && t.CurrentBreakpoint.Active { - if g, err := proc.GetG(t); err == nil { - t.CurrentBreakpoint.HitCount[g.ID]++ - } - t.CurrentBreakpoint.TotalHitCount++ - } + t.CurrentBreakpoint.Breakpoint = bp } return nil } func (regs *gdbRegisters) PC() uint64 { - return binary.LittleEndian.Uint64(regs.regs[regnamePC].value) + return binary.LittleEndian.Uint64(regs.regs[regs.regnames.PC].value) } func (regs *gdbRegisters) setPC(value uint64) { - binary.LittleEndian.PutUint64(regs.regs[regnamePC].value, value) + binary.LittleEndian.PutUint64(regs.regs[regs.regnames.PC].value, value) } func (regs *gdbRegisters) SP() uint64 { - return binary.LittleEndian.Uint64(regs.regs[regnameSP].value) -} -func (regs *gdbRegisters) setSP(value uint64) { - binary.LittleEndian.PutUint64(regs.regs[regnameSP].value, value) -} - -func (regs *gdbRegisters) setDX(value uint64) { - binary.LittleEndian.PutUint64(regs.regs[regnameDX].value, value) + return binary.LittleEndian.Uint64(regs.regs[regs.regnames.SP].value) } func (regs *gdbRegisters) BP() uint64 { - return binary.LittleEndian.Uint64(regs.regs[regnameBP].value) + return binary.LittleEndian.Uint64(regs.regs[regs.regnames.BP].value) } func (regs *gdbRegisters) CX() uint64 { - return binary.LittleEndian.Uint64(regs.regs[regnameCX].value) + return binary.LittleEndian.Uint64(regs.regs[regs.regnames.CX].value) } func (regs *gdbRegisters) setCX(value uint64) { - binary.LittleEndian.PutUint64(regs.regs[regnameCX].value, value) + binary.LittleEndian.PutUint64(regs.regs[regs.regnames.CX].value, value) } func (regs *gdbRegisters) TLS() uint64 { @@ -1693,198 +1947,57 @@ func (regs *gdbRegisters) byName(name string) uint64 { return binary.LittleEndian.Uint64(reg.value) } -func (regs *gdbRegisters) Get(n int) (uint64, error) { - reg := x86asm.Reg(n) - const ( - mask8 = 0x000f - mask16 = 0x00ff - mask32 = 0xffff - ) - - switch reg { - // 8-bit - case x86asm.AL: - return regs.byName("rax") & mask8, nil - case x86asm.CL: - return regs.byName("rcx") & mask8, nil - case x86asm.DL: - return regs.byName("rdx") & mask8, nil - case x86asm.BL: - return regs.byName("rbx") & mask8, nil - case x86asm.AH: - return (regs.byName("rax") >> 8) & mask8, nil - case x86asm.CH: - return (regs.byName("rcx") >> 8) & mask8, nil - case x86asm.DH: - return (regs.byName("rdx") >> 8) & mask8, nil - case x86asm.BH: - return (regs.byName("rbx") >> 8) & mask8, nil - case x86asm.SPB: - return regs.byName("rsp") & mask8, nil - case x86asm.BPB: - return regs.byName("rbp") & mask8, nil - case x86asm.SIB: - return regs.byName("rsi") & mask8, nil - case x86asm.DIB: - return regs.byName("rdi") & mask8, nil - case x86asm.R8B: - return regs.byName("r8") & mask8, nil - case x86asm.R9B: - return regs.byName("r9") & mask8, nil - case x86asm.R10B: - return regs.byName("r10") & mask8, nil - case x86asm.R11B: - return regs.byName("r11") & mask8, nil - case x86asm.R12B: - return regs.byName("r12") & mask8, nil - case x86asm.R13B: - return regs.byName("r13") & mask8, nil - case x86asm.R14B: - return regs.byName("r14") & mask8, nil - case x86asm.R15B: - return regs.byName("r15") & mask8, nil - - // 16-bit - case x86asm.AX: - return regs.byName("rax") & mask16, nil - case x86asm.CX: - return regs.byName("rcx") & mask16, nil - case x86asm.DX: - return regs.byName("rdx") & mask16, nil - case x86asm.BX: - return regs.byName("rbx") & mask16, nil - case x86asm.SP: - return regs.byName("rsp") & mask16, nil - case x86asm.BP: - return regs.byName("rbp") & mask16, nil - case x86asm.SI: - return regs.byName("rsi") & mask16, nil - case x86asm.DI: - return regs.byName("rdi") & mask16, nil - case x86asm.R8W: - return regs.byName("r8") & mask16, nil - case x86asm.R9W: - return regs.byName("r9") & mask16, nil - case x86asm.R10W: - return regs.byName("r10") & mask16, nil - case x86asm.R11W: - return regs.byName("r11") & mask16, nil - case x86asm.R12W: - return regs.byName("r12") & mask16, nil - case x86asm.R13W: - return regs.byName("r13") & mask16, nil - case x86asm.R14W: - return regs.byName("r14") & mask16, nil - case x86asm.R15W: - return regs.byName("r15") & mask16, nil - - // 32-bit - case x86asm.EAX: - return regs.byName("rax") & mask32, nil - case x86asm.ECX: - return regs.byName("rcx") & mask32, nil - case x86asm.EDX: - return regs.byName("rdx") & mask32, nil - case x86asm.EBX: - return regs.byName("rbx") & mask32, nil - case x86asm.ESP: - return regs.byName("rsp") & mask32, nil - case x86asm.EBP: - return regs.byName("rbp") & mask32, nil - case x86asm.ESI: - return regs.byName("rsi") & mask32, nil - case x86asm.EDI: - return regs.byName("rdi") & mask32, nil - case x86asm.R8L: - return regs.byName("r8") & mask32, nil - case x86asm.R9L: - return regs.byName("r9") & mask32, nil - case x86asm.R10L: - return regs.byName("r10") & mask32, nil - case x86asm.R11L: - return regs.byName("r11") & mask32, nil - case x86asm.R12L: - return regs.byName("r12") & mask32, nil - case x86asm.R13L: - return regs.byName("r13") & mask32, nil - case x86asm.R14L: - return regs.byName("r14") & mask32, nil - case x86asm.R15L: - return regs.byName("r15") & mask32, nil - - // 64-bit - case x86asm.RAX: - return regs.byName("rax"), nil - case x86asm.RCX: - return regs.byName("rcx"), nil - case x86asm.RDX: - return regs.byName("rdx"), nil - case x86asm.RBX: - return regs.byName("rbx"), nil - case x86asm.RSP: - return regs.byName("rsp"), nil - case x86asm.RBP: - return regs.byName("rbp"), nil - case x86asm.RSI: - return regs.byName("rsi"), nil - case x86asm.RDI: - return regs.byName("rdi"), nil - case x86asm.R8: - return regs.byName("r8"), nil - case x86asm.R9: - return regs.byName("r9"), nil - case x86asm.R10: - return regs.byName("r10"), nil - case x86asm.R11: - return regs.byName("r11"), nil - case x86asm.R12: - return regs.byName("r12"), nil - case x86asm.R13: - return regs.byName("r13"), nil - case x86asm.R14: - return regs.byName("r14"), nil - case x86asm.R15: - return regs.byName("r15"), nil - } - - return 0, proc.ErrUnknownRegister -} - func (r *gdbRegisters) FloatLoadError() error { return nil } // SetPC will set the value of the PC register to the given value. -func (t *gdbThread) SetPC(pc uint64) error { +func (t *gdbThread) setPC(pc uint64) error { _, _ = t.Registers() // Registes must be loaded first t.regs.setPC(pc) if t.p.gcmdok { return t.p.conn.writeRegisters(t.strID, t.regs.buf) } - reg := t.regs.regs[regnamePC] + reg := t.regs.regs[t.regs.regnames.PC] return t.p.conn.writeRegister(t.strID, reg.regnum, reg.value) } -// SetSP will set the value of the SP register to the given value. -func (t *gdbThread) SetSP(sp uint64) error { - _, _ = t.Registers() // Registes must be loaded first - t.regs.setSP(sp) - if t.p.gcmdok { - return t.p.conn.writeRegisters(t.strID, t.regs.buf) +// SetReg will change the value of a list of registers +func (t *gdbThread) SetReg(regNum uint64, reg *op.DwarfRegister) error { + regName := registerName(t.p.bi.Arch, regNum) + _, _ = t.Registers() // Registers must be loaded first + gdbreg, ok := t.regs.regs[regName] + if !ok && strings.HasPrefix(regName, "xmm") { + // XMMn and YMMn are the same amd64 register (in different sizes), if we + // don't find XMMn try YMMn or ZMMn instead. + gdbreg, ok = t.regs.regs["y"+regName[1:]] + if !ok { + gdbreg, ok = t.regs.regs["z"+regName[1:]] + } } - reg := t.regs.regs[regnameSP] - return t.p.conn.writeRegister(t.strID, reg.regnum, reg.value) -} - -// SetDX will set the value of the DX register to the given value. -func (t *gdbThread) SetDX(dx uint64) error { - _, _ = t.Registers() // Registes must be loaded first - t.regs.setDX(dx) - if t.p.gcmdok { - return t.p.conn.writeRegisters(t.strID, t.regs.buf) + if !ok { + return fmt.Errorf("could not set register %s: not found", regName) } - reg := t.regs.regs[regnameDX] - return t.p.conn.writeRegister(t.strID, reg.regnum, reg.value) + reg.FillBytes() + if len(reg.Bytes) != len(gdbreg.value) { + return fmt.Errorf("could not set register %s: wrong size, expected %d got %d", regName, len(gdbreg.value), len(reg.Bytes)) + } + copy(gdbreg.value, reg.Bytes) + err := t.p.conn.writeRegister(t.strID, gdbreg.regnum, gdbreg.value) + if err != nil { + return err + } + if t.p.conn.workaroundReg != nil && len(gdbreg.value) > 16 { + // This is a workaround for a bug in debugserver where register writes (P + // packet) on AVX-2 and AVX-512 registers are ignored unless they are + // followed by a write to an AVX register. + // See: + // Issue #2767 + // https://bugs.llvm.org/show_bug.cgi?id=52362 + reg := t.regs.gdbRegisterNew(t.p.conn.workaroundReg) + return t.p.conn.writeRegister(t.strID, reg.regnum, reg.value) + } + return nil } func (regs *gdbRegisters) Slice(floatingPoint bool) ([]proc.Register, error) { @@ -1933,8 +2046,16 @@ func (regs *gdbRegisters) Slice(floatingPoint bool) ([]proc.Register, error) { value := regs.regs[reginfo.Name].value xmmName := "x" + reginfo.Name[1:] - r = proc.AppendBytesRegister(r, strings.ToUpper(xmmName), value[:16]) - r = proc.AppendBytesRegister(r, strings.ToUpper(reginfo.Name), value[16:]) + r = proc.AppendBytesRegister(r, strings.ToUpper(xmmName), value) + + case reginfo.Bitsize == 512: + if !strings.HasPrefix(strings.ToLower(reginfo.Name), "zmm") || !floatingPoint { + continue + } + + value := regs.regs[reginfo.Name].value + xmmName := "x" + reginfo.Name[1:] + r = proc.AppendBytesRegister(r, strings.ToUpper(xmmName), value) } } return r, nil @@ -1942,7 +2063,30 @@ func (regs *gdbRegisters) Slice(floatingPoint bool) ([]proc.Register, error) { func (regs *gdbRegisters) Copy() (proc.Registers, error) { savedRegs := &gdbRegisters{} - savedRegs.init(regs.regsInfo) + savedRegs.init(regs.regsInfo, regs.arch, regs.regnames) copy(savedRegs.buf, regs.buf) return savedRegs, nil } + +func registerName(arch *proc.Arch, regNum uint64) string { + regName, _, _ := arch.DwarfRegisterToString(int(regNum), nil) + return strings.ToLower(regName) +} + +func machTargetExcToError(sig uint8) error { + switch sig { + case 0x91: + return errors.New("bad access") + case 0x92: + return errors.New("bad instruction") + case 0x93: + return errors.New("arithmetic exception") + case 0x94: + return errors.New("emulation exception") + case 0x95: + return errors.New("software exception") + case 0x96: + return errors.New("breakpoint exception") + } + return nil +} diff --git a/pkg/proc/gdbserial/gdbserver_conn.go b/pkg/proc/gdbserial/gdbserver_conn.go index 1186893dfd..c571940d10 100644 --- a/pkg/proc/gdbserial/gdbserver_conn.go +++ b/pkg/proc/gdbserial/gdbserver_conn.go @@ -37,6 +37,8 @@ type gdbConn struct { packetSize int // maximum packet size supported by stub regsInfo []gdbRegisterInfo // list of registers + workaroundReg *gdbRegisterInfo // used to work-around a register setting bug in debugserver, see use in gdbserver.go + pid int // cache process id ack bool // when ack is true acknowledgment packets are enabled @@ -44,20 +46,15 @@ type gdbConn struct { maxTransmitAttempts int // maximum number of transmit or receive attempts when bad checksums are read threadSuffixSupported bool // thread suffix supported by stub isDebugserver bool // true if the stub is debugserver + xcmdok bool // x command can be used to transfer memory + goarch string + goos string + + useXcmd bool // forces writeMemory to use the 'X' command log *logrus.Entry } -const ( - regnamePC = "rip" - regnameCX = "rcx" - regnameSP = "rsp" - regnameDX = "rdx" - regnameBP = "rbp" - regnameFsBase = "fs_base" - regnameGsBase = "gs_base" -) - var ErrTooManyAttempts = errors.New("too many transmit attempts") // GdbProtocolError is an error response (Exx) of Gdb Remote Serial Protocol @@ -103,7 +100,7 @@ const ( qSupportedMultiprocess = "$qSupported:multiprocess+;swbreak+;hwbreak+;no-resumed+;xmlRegisters=i386" ) -func (conn *gdbConn) handshake() error { +func (conn *gdbConn) handshake(regnames *gdbRegnames) error { conn.ack = true conn.packetSize = 256 conn.rdr = bufio.NewReader(conn.conn) @@ -149,15 +146,29 @@ func (conn *gdbConn) handshake() error { // Attempt to figure out the name of the processor register. // We either need qXfer:features:read (gdbserver/rr) or qRegisterInfo (lldb) - if err := conn.readRegisterInfo(); err != nil { + regFound := map[string]bool{ + regnames.PC: false, + regnames.SP: false, + regnames.BP: false, + regnames.CX: false, + } + if err := conn.readRegisterInfo(regFound); err != nil { if isProtocolErrorUnsupported(err) { - if err := conn.readTargetXml(); err != nil { + if err := conn.readTargetXml(regFound); err != nil { return err } } else { return err } } + for n := range regFound { + if n == "" { + continue + } + if !regFound[n] { + return fmt.Errorf("could not find %s register", n) + } + } // We either need: // * QListThreadsInStopReply + qThreadStopInfo (i.e. lldb-server/debugserver), @@ -173,6 +184,10 @@ func (conn *gdbConn) handshake() error { } } + if resp, err := conn.exec([]byte("$x0,0"), "init"); err == nil && string(resp) == "OK" { + conn.xcmdok = true + } + return nil } @@ -229,19 +244,28 @@ type gdbRegisterInfo struct { Offset int Regnum int `xml:"regnum,attr"` Group string `xml:"group,attr"` + + ignoreOnWrite bool +} + +func setRegFound(regFound map[string]bool, name string) { + for n := range regFound { + if name == n { + regFound[n] = true + } + } } // readTargetXml reads target.xml file from stub using qXfer:features:read, // then parses it requesting any additional files. // The schema of target.xml is described by: // https://github.com/bminor/binutils-gdb/blob/61baf725eca99af2569262d10aca03dcde2698f6/gdb/features/gdb-target.dtd -func (conn *gdbConn) readTargetXml() (err error) { +func (conn *gdbConn) readTargetXml(regFound map[string]bool) (err error) { conn.regsInfo, err = conn.readAnnex("target.xml") if err != nil { return err } var offset int - var pcFound, cxFound, spFound bool regnum := 0 for i := range conn.regsInfo { if conn.regsInfo[i].Regnum == 0 { @@ -251,33 +275,18 @@ func (conn *gdbConn) readTargetXml() (err error) { } conn.regsInfo[i].Offset = offset offset += conn.regsInfo[i].Bitsize / 8 - switch conn.regsInfo[i].Name { - case regnamePC: - pcFound = true - case regnameCX: - cxFound = true - case regnameSP: - spFound = true - } + + setRegFound(regFound, conn.regsInfo[i].Name) regnum++ } - if !pcFound { - return errors.New("could not find RIP register") - } - if !spFound { - return errors.New("could not find RSP register") - } - if !cxFound { - return errors.New("could not find RCX register") - } + return nil } // readRegisterInfo uses qRegisterInfo to read register information (used // when qXfer:feature:read is not supported). -func (conn *gdbConn) readRegisterInfo() (err error) { +func (conn *gdbConn) readRegisterInfo(regFound map[string]bool) (err error) { regnum := 0 - var pcFound, cxFound, spFound bool for { conn.outbuf.Reset() fmt.Fprintf(&conn.outbuf, "$qRegisterInfo%x", regnum) @@ -293,6 +302,7 @@ func (conn *gdbConn) readRegisterInfo() (err error) { var offset int var bitsize int var contained bool + var ignoreOnWrite bool resp := string(respbytes) for { @@ -316,6 +326,11 @@ func (conn *gdbConn) readRegisterInfo() (err error) { bitsize, _ = strconv.Atoi(value) case "container-regs": contained = true + case "set": + if value == "Exception State Registers" { + // debugserver doesn't like it if we try to write these + ignoreOnWrite = true + } } } @@ -326,34 +341,20 @@ func (conn *gdbConn) readRegisterInfo() (err error) { } if contained { + if regname == "xmm0" { + conn.workaroundReg = &gdbRegisterInfo{Regnum: regnum, Name: regname, Bitsize: bitsize, Offset: offset, ignoreOnWrite: ignoreOnWrite} + } regnum++ continue } - switch regname { - case regnamePC: - pcFound = true - case regnameCX: - cxFound = true - case regnameSP: - spFound = true - } + setRegFound(regFound, regname) - conn.regsInfo = append(conn.regsInfo, gdbRegisterInfo{Regnum: regnum, Name: regname, Bitsize: bitsize, Offset: offset}) + conn.regsInfo = append(conn.regsInfo, gdbRegisterInfo{Regnum: regnum, Name: regname, Bitsize: bitsize, Offset: offset, ignoreOnWrite: ignoreOnWrite}) regnum++ } - if !pcFound { - return errors.New("could not find RIP register") - } - if !spFound { - return errors.New("could not find RSP register") - } - if !cxFound { - return errors.New("could not find RCX register") - } - return nil } @@ -412,18 +413,39 @@ func (conn *gdbConn) qXfer(kind, annex string, binary bool) ([]byte, error) { return out, nil } -// setBreakpoint executes a 'Z' (insert breakpoint) command of type '0' and kind '1' -func (conn *gdbConn) setBreakpoint(addr uint64) error { +// qXferWrite executes a 'qXfer' write with the specified kind and annex. +func (conn *gdbConn) qXferWrite(kind, annex string) error { conn.outbuf.Reset() - fmt.Fprintf(&conn.outbuf, "$Z0,%x,1", addr) + fmt.Fprintf(&conn.outbuf, "$qXfer:%s:write:%s:0:", kind, annex) + //TODO(aarzilli): if we ever actually need to write something with qXfer, + //this will need to be implemented properly. At the moment it is only used + //for a fake write to the siginfo kind, to end a diversion in 'rr'. + _, err := conn.exec(conn.outbuf.Bytes(), "qXfer") + return err +} + +type breakpointType uint8 + +const ( + swBreakpoint breakpointType = 0 + hwBreakpoint breakpointType = 1 + writeWatchpoint breakpointType = 2 + readWatchpoint breakpointType = 3 + accessWatchpoint breakpointType = 4 +) + +// setBreakpoint executes a 'Z' (insert breakpoint) command of type '0' and kind '1' or '4' +func (conn *gdbConn) setBreakpoint(addr uint64, typ breakpointType, kind int) error { + conn.outbuf.Reset() + fmt.Fprintf(&conn.outbuf, "$Z%d,%x,%d", typ, addr, kind) _, err := conn.exec(conn.outbuf.Bytes(), "set breakpoint") return err } -// clearBreakpoint executes a 'z' (remove breakpoint) command of type '0' and kind '1' -func (conn *gdbConn) clearBreakpoint(addr uint64) error { +// clearBreakpoint executes a 'z' (remove breakpoint) command of type '0' and kind '1' or '4' +func (conn *gdbConn) clearBreakpoint(addr uint64, typ breakpointType, kind int) error { conn.outbuf.Reset() - fmt.Fprintf(&conn.outbuf, "$z0,%x,1", addr) + fmt.Fprintf(&conn.outbuf, "$z%d,%x,%d", typ, addr, kind) _, err := conn.exec(conn.outbuf.Bytes(), "clear breakpoint") return err } @@ -545,7 +567,7 @@ func (conn *gdbConn) writeRegister(threadID string, regnum int, data []byte) err // resume each thread. If a thread has sig == 0 the 'c' action will be used, // otherwise the 'C' action will be used and the value of sig will be passed // to it. -func (conn *gdbConn) resume(threads map[int]*gdbThread, tu *threadUpdater) (string, uint8, error) { +func (conn *gdbConn) resume(threads map[int]*gdbThread, tu *threadUpdater) (stopPacket, error) { if conn.direction == proc.Forward { conn.outbuf.Reset() fmt.Fprintf(&conn.outbuf, "$vCont") @@ -557,7 +579,7 @@ func (conn *gdbConn) resume(threads map[int]*gdbThread, tu *threadUpdater) (stri fmt.Fprintf(&conn.outbuf, ";c") } else { if err := conn.selectThread('c', "p-1.-1", "resume"); err != nil { - return "", 0, err + return stopPacket{}, err } conn.outbuf.Reset() fmt.Fprint(&conn.outbuf, "$bc") @@ -565,7 +587,7 @@ func (conn *gdbConn) resume(threads map[int]*gdbThread, tu *threadUpdater) (stri conn.manualStopMutex.Lock() if err := conn.send(conn.outbuf.Bytes()); err != nil { conn.manualStopMutex.Unlock() - return "", 0, err + return stopPacket{}, err } conn.running = true conn.manualStopMutex.Unlock() @@ -582,7 +604,8 @@ func (conn *gdbConn) resume(threads map[int]*gdbThread, tu *threadUpdater) (stri } // step executes a 'vCont' command on the specified thread with 's' action. -func (conn *gdbConn) step(threadID string, tu *threadUpdater, ignoreFaultSignal bool) error { +func (conn *gdbConn) step(th *gdbThread, tu *threadUpdater, ignoreFaultSignal bool) error { + threadID := th.strID if conn.direction != proc.Forward { if err := conn.selectThread('c', threadID, "step"); err != nil { return err @@ -592,9 +615,20 @@ func (conn *gdbConn) step(threadID string, tu *threadUpdater, ignoreFaultSignal if err := conn.send(conn.outbuf.Bytes()); err != nil { return err } - _, _, err := conn.waitForvContStop("singlestep", threadID, tu) + _, err := conn.waitForvContStop("singlestep", threadID, tu) return err } + + var _SIGBUS uint8 + switch conn.goos { + case "linux": + _SIGBUS = 0x7 + case "darwin": + _SIGBUS = 0xa + default: + panic(fmt.Errorf("unknown GOOS %s", conn.goos)) + } + var sig uint8 = 0 for { conn.outbuf.Reset() @@ -609,8 +643,8 @@ func (conn *gdbConn) step(threadID string, tu *threadUpdater, ignoreFaultSignal if tu != nil { tu.Reset() } - var err error - _, sig, err = conn.waitForvContStop("singlestep", threadID, tu) + sp, err := conn.waitForvContStop("singlestep", threadID, tu) + sig = sp.sig if err != nil { return err } @@ -619,6 +653,8 @@ func (conn *gdbConn) step(threadID string, tu *threadUpdater, ignoreFaultSignal if ignoreFaultSignal { // we attempting to read the TLS, a fault here should be ignored return nil } + case _SIGILL, _SIGBUS, _SIGFPE: + // propagate these signals to inferior immediately case interruptSignal, breakpointSignal, stopSignal: return nil case childSignal: // stop on debugserver but SIGCHLD on lldb-server/linux @@ -626,15 +662,21 @@ func (conn *gdbConn) step(threadID string, tu *threadUpdater, ignoreFaultSignal return nil } case debugServerTargetExcBadAccess, debugServerTargetExcBadInstruction, debugServerTargetExcArithmetic, debugServerTargetExcEmulation, debugServerTargetExcSoftware, debugServerTargetExcBreakpoint: - return nil + if ignoreFaultSignal { + return nil + } + return machTargetExcToError(sig) + default: + // delay propagation of any other signal to until after the stepping is done + th.sig = sig + sig = 0 } - // any other signal is propagated to the inferior } } -var threadBlockedError = errors.New("thread blocked") +var errThreadBlocked = errors.New("thread blocked") -func (conn *gdbConn) waitForvContStop(context string, threadID string, tu *threadUpdater) (string, uint8, error) { +func (conn *gdbConn) waitForvContStop(context, threadID string, tu *threadUpdater) (stopPacket, error) { count := 0 failed := false for { @@ -655,24 +697,36 @@ func (conn *gdbConn) waitForvContStop(context string, threadID string, tu *threa } count++ } else if failed { - return "", 0, threadBlockedError + return stopPacket{}, errThreadBlocked } else if err != nil { - return "", 0, err + return stopPacket{}, err } else { repeat, sp, err := conn.parseStopPacket(resp, threadID, tu) if !repeat { - return sp.threadID, sp.sig, err + return sp, err } } } } type stopPacket struct { - threadID string - sig uint8 - reason string + threadID string + sig uint8 + reason string + watchAddr uint64 } +// Mach exception codes used to decode metype/medata keys in stop packets (necessary to support watchpoints with debugserver). +// See: +// https://opensource.apple.com/source/xnu/xnu-4570.1.46/osfmk/mach/exception_types.h.auto.html +// https://opensource.apple.com/source/xnu/xnu-4570.1.46/osfmk/mach/i386/exception.h.auto.html +// https://opensource.apple.com/source/xnu/xnu-4570.1.46/osfmk/mach/arm/exception.h.auto.html +const ( + _EXC_BREAKPOINT = 6 // mach exception type for hardware breakpoints + _EXC_I386_SGL = 1 // mach exception code for single step on x86, for some reason this is also used for watchpoints + _EXC_ARM_DA_DEBUG = 0x102 // mach exception code for debug fault on arm/arm64 +) + // executes 'vCont' (continue/step) command func (conn *gdbConn) parseStopPacket(resp []byte, threadID string, tu *threadUpdater) (repeat bool, sp stopPacket, err error) { switch resp[0] { @@ -691,6 +745,9 @@ func (conn *gdbConn) parseStopPacket(resp []byte, threadID string, tu *threadUpd conn.log.Debugf("full stop packet: %s", string(resp)) } + var metype int + var medata = make([]uint64, 0, 10) + buf := resp[3:] for buf != nil { colon := bytes.Index(buf, []byte{':'}) @@ -720,6 +777,32 @@ func (conn *gdbConn) parseStopPacket(resp []byte, threadID string, tu *threadUpd } case "reason": sp.reason = string(value) + case "watch", "awatch", "rwatch": + sp.watchAddr, err = strconv.ParseUint(string(value), 16, 64) + if err != nil { + return false, stopPacket{}, fmt.Errorf("malformed stop packet: %s (wrong watch address)", string(resp)) + } + case "metype": + // mach exception type (debugserver extension) + metype, _ = strconv.Atoi(string(value)) + case "medata": + // mach exception data (debugserver extension) + d, _ := strconv.ParseUint(string(value), 16, 64) + medata = append(medata, d) + } + } + + // Debugserver does not report watchpoint stops in the standard way preferring + // instead the semi-undocumented metype/medata keys. + // These values also have different meanings depending on the CPU architecture. + switch conn.goarch { + case "amd64": + if metype == _EXC_BREAKPOINT && len(medata) >= 2 && medata[0] == _EXC_I386_SGL { + sp.watchAddr = medata[1] // this should be zero if this is really a single step stop and non-zero for watchpoints + } + case "arm64": + if metype == _EXC_BREAKPOINT && len(medata) >= 2 && medata[0] == _EXC_ARM_DA_DEBUG { + sp.watchAddr = medata[1] } } @@ -879,8 +962,15 @@ func (conn *gdbConn) appendThreadSelector(threadID string) { fmt.Fprintf(&conn.outbuf, ";thread:%s;", threadID) } +func (conn *gdbConn) readMemory(data []byte, addr uint64) error { + if conn.xcmdok && len(data) > conn.packetSize { + return conn.readMemoryBinary(data, addr) + } + return conn.readMemoryHex(data, addr) +} + // executes 'm' (read memory) command -func (conn *gdbConn) readMemory(data []byte, addr uintptr) error { +func (conn *gdbConn) readMemoryHex(data []byte, addr uint64) error { size := len(data) data = data[:0] @@ -894,7 +984,7 @@ func (conn *gdbConn) readMemory(data []byte, addr uintptr) error { } size = size - sz - fmt.Fprintf(&conn.outbuf, "$m%x,%x", addr+uintptr(len(data)), sz) + fmt.Fprintf(&conn.outbuf, "$m%x,%x", addr+uint64(len(data)), sz) resp, err := conn.exec(conn.outbuf.Bytes(), "memory read") if err != nil { return err @@ -908,14 +998,45 @@ func (conn *gdbConn) readMemory(data []byte, addr uintptr) error { return nil } +// executes 'x' (binary read memory) command +func (conn *gdbConn) readMemoryBinary(data []byte, addr uint64) error { + size := len(data) + data = data[:0] + + for len(data) < size { + conn.outbuf.Reset() + + sz := size - len(data) + + fmt.Fprintf(&conn.outbuf, "$x%x,%x", addr+uint64(len(data)), sz) + if err := conn.send(conn.outbuf.Bytes()); err != nil { + return err + } + resp, err := conn.recv(conn.outbuf.Bytes(), "binary memory read", true) + if err != nil { + return err + } + data = append(data, resp...) + } + return nil +} + func writeAsciiBytes(w io.Writer, data []byte) { for _, b := range data { fmt.Fprintf(w, "%02x", b) } } +// writeMemory writes memory using either 'M' or 'X' +func (conn *gdbConn) writeMemory(addr uint64, data []byte) (written int, err error) { + if conn.useXcmd { + return conn.writeMemoryBinary(addr, data) + } + return conn.writeMemoryHex(addr, data) +} + // executes 'M' (write memory) command -func (conn *gdbConn) writeMemory(addr uintptr, data []byte) (written int, err error) { +func (conn *gdbConn) writeMemoryHex(addr uint64, data []byte) (written int, err error) { if len(data) == 0 { // LLDB can't parse requests for 0-length writes and hangs if we emit them return 0, nil @@ -933,6 +1054,27 @@ func (conn *gdbConn) writeMemory(addr uintptr, data []byte) (written int, err er return len(data), nil } +func (conn *gdbConn) writeMemoryBinary(addr uint64, data []byte) (written int, err error) { + conn.outbuf.Reset() + fmt.Fprintf(&conn.outbuf, "$X%x,%x:", addr, len(data)) + + for _, b := range data { + switch b { + case '#', '$', '}': + conn.outbuf.WriteByte('}') + conn.outbuf.WriteByte(b ^ escapeXor) + default: + conn.outbuf.WriteByte(b) + } + } + + _, err = conn.exec(conn.outbuf.Bytes(), "memory write") + if err != nil { + return 0, err + } + return len(data), nil +} + func (conn *gdbConn) allocMemory(sz uint64) (uint64, error) { conn.outbuf.Reset() fmt.Fprintf(&conn.outbuf, "$_M%x,rwx", sz) @@ -945,18 +1087,18 @@ func (conn *gdbConn) allocMemory(sz uint64) (uint64, error) { // threadStopInfo executes a 'qThreadStopInfo' and returns the reason the // thread stopped. -func (conn *gdbConn) threadStopInfo(threadID string) (sig uint8, reason string, err error) { +func (conn *gdbConn) threadStopInfo(threadID string) (sp stopPacket, err error) { conn.outbuf.Reset() fmt.Fprintf(&conn.outbuf, "$qThreadStopInfo%s", threadID) resp, err := conn.exec(conn.outbuf.Bytes(), "thread stop info") if err != nil { - return 0, "", err + return stopPacket{}, err } - _, sp, err := conn.parseStopPacket(resp, "", nil) + _, sp, err = conn.parseStopPacket(resp, "", nil) if err != nil { - return 0, "", err + return stopPacket{}, err } - return sp.sig, sp.reason, nil + return sp, nil } // restart executes a 'vRun' command. @@ -999,8 +1141,9 @@ type imageList struct { } type imageDescription struct { - Pathname string `json:"pathname"` - MachHeader machHeader `json:"mach_header"` + LoadAddress uint64 `json:"load_address"` + Pathname string `json:"pathname"` + MachHeader machHeader `json:"mach_header"` } type machHeader struct { @@ -1023,6 +1166,87 @@ func (conn *gdbConn) getLoadedDynamicLibraries() ([]imageDescription, error) { return images.Images, err } +type memoryRegionInfo struct { + start uint64 + size uint64 + permissions string + name string +} + +func decodeHexString(in []byte) (string, bool) { + out := make([]byte, 0, len(in)/2) + for i := 0; i < len(in); i += 2 { + v, err := strconv.ParseUint(string(in[i:i+2]), 16, 8) + if err != nil { + return "", false + } + out = append(out, byte(v)) + } + return string(out), true +} + +func (conn *gdbConn) memoryRegionInfo(addr uint64) (*memoryRegionInfo, error) { + conn.outbuf.Reset() + fmt.Fprintf(&conn.outbuf, "$qMemoryRegionInfo:%x", addr) + resp, err := conn.exec(conn.outbuf.Bytes(), "qMemoryRegionInfo") + if err != nil { + return nil, err + } + + mri := &memoryRegionInfo{} + + buf := resp + for len(buf) > 0 { + colon := bytes.Index(buf, []byte{':'}) + if colon < 0 { + break + } + key := buf[:colon] + buf = buf[colon+1:] + + semicolon := bytes.Index(buf, []byte{';'}) + var value []byte + if semicolon < 0 { + value = buf + buf = nil + } else { + value = buf[:semicolon] + buf = buf[semicolon+1:] + } + + switch string(key) { + case "start": + start, err := strconv.ParseUint(string(value), 16, 64) + if err != nil { + return nil, fmt.Errorf("malformed qMemoryRegionInfo response packet (start): %v in %s", err, string(resp)) + } + mri.start = start + case "size": + size, err := strconv.ParseUint(string(value), 16, 64) + if err != nil { + return nil, fmt.Errorf("malformed qMemoryRegionInfo response packet (size): %v in %s", err, string(resp)) + } + mri.size = size + case "permissions": + mri.permissions = string(value) + case "name": + namestr, ok := decodeHexString(value) + if !ok { + return nil, fmt.Errorf("malformed qMemoryRegionInfo response packet (name): %s", string(resp)) + } + mri.name = namestr + case "error": + errstr, ok := decodeHexString(value) + if !ok { + return nil, fmt.Errorf("malformed qMemoryRegionInfo response packet (error): %s", string(resp)) + } + return nil, fmt.Errorf("qMemoryRegionInfo error: %s", errstr) + } + } + + return mri, nil +} + // exec executes a message to the stub and reads a response. // The details of the wire protocol are described here: // https://sourceware.org/gdb/onlinedocs/gdb/Overview.html#Overview @@ -1084,14 +1308,14 @@ func (conn *gdbConn) recv(cmd []byte, context string, binary bool) (resp []byte, } // read checksum - _, err = conn.rdr.Read(conn.inbuf[:2]) + _, err = io.ReadFull(conn.rdr, conn.inbuf[:2]) if err != nil { return nil, err } if logflags.GdbWire() { out := resp partial := false - if idx := bytes.Index(out, []byte{'\n'}); idx >= 0 { + if idx := bytes.Index(out, []byte{'\n'}); idx >= 0 && !binary { out = resp[:idx] partial = true } @@ -1100,9 +1324,17 @@ func (conn *gdbConn) recv(cmd []byte, context string, binary bool) (resp []byte, partial = true } if !partial { - conn.log.Debugf("-> %s%s", string(resp), string(conn.inbuf[:2])) + if binary { + conn.log.Debugf("-> %q%s", string(resp), string(conn.inbuf[:2])) + } else { + conn.log.Debugf("-> %s%s", string(resp), string(conn.inbuf[:2])) + } } else { - conn.log.Debugf("-> %s...", string(out)) + if binary { + conn.log.Debugf("-> %q...", string(out)) + } else { + conn.log.Debugf("-> %s...", string(out)) + } } } @@ -1136,7 +1368,7 @@ func (conn *gdbConn) recv(cmd []byte, context string, binary bool) (resp []byte, conn.inbuf, resp = wiredecode(resp, conn.inbuf) } - if len(resp) == 0 || resp[0] == 'E' { + if len(resp) == 0 || (resp[0] == 'E' && !binary) || (resp[0] == 'E' && len(resp) == 3) { cmdstr := "" if cmd != nil { cmdstr = string(cmd) @@ -1259,7 +1491,10 @@ func checksumok(packet, checksumBuf []byte) bool { if err != nil { return false } - return sum == uint8(tgt) + + tgt8 := uint8(tgt) + + return sum == tgt8 } func checksum(packet []byte) (sum uint8) { diff --git a/pkg/proc/gdbserial/gdbserver_unix.go b/pkg/proc/gdbserial/gdbserver_unix.go index 5943718a16..c5151bf442 100644 --- a/pkg/proc/gdbserial/gdbserver_unix.go +++ b/pkg/proc/gdbserial/gdbserver_unix.go @@ -1,3 +1,4 @@ +//go:build linux || darwin || freebsd // +build linux darwin freebsd package gdbserial diff --git a/pkg/proc/gdbserial/rr.go b/pkg/proc/gdbserial/rr.go index 8a47aa00f6..f377fa49f3 100644 --- a/pkg/proc/gdbserial/rr.go +++ b/pkg/proc/gdbserial/rr.go @@ -22,7 +22,7 @@ import ( // stop function which will prematurely terminate the recording of the // program. func RecordAsync(cmd []string, wd string, quiet bool, redirects [3]string) (run func() (string, error), stop func() error, err error) { - if err := checkRRAvailabe(); err != nil { + if err := checkRRAvailable(); err != nil { return nil, nil, err } @@ -126,7 +126,7 @@ func Record(cmd []string, wd string, quiet bool, redirects [3]string) (tracedir // Replay starts an instance of rr in replay mode, with the specified trace // directory, and connects to it. func Replay(tracedir string, quiet, deleteOnDetach bool, debugInfoDirs []string) (*proc.Target, error) { - if err := checkRRAvailabe(); err != nil { + if err := checkRRAvailable(); err != nil { return nil, err } @@ -154,6 +154,7 @@ func Replay(tracedir string, quiet, deleteOnDetach bool, debugInfoDirs []string) p := newProcess(rrcmd.Process) p.tracedir = tracedir + p.conn.useXcmd = true // 'rr' does not support the 'M' command which is what we would usually use to write memory, this is only important during function calls, in any other situation writing memory will fail anyway. if deleteOnDetach { p.onDetach = func() { safeRemoveAll(p.tracedir) @@ -178,7 +179,7 @@ func (err ErrPerfEventParanoid) Error() string { return fmt.Sprintf("rr needs /proc/sys/kernel/perf_event_paranoid <= 1, but it is %d", err.actual) } -func checkRRAvailabe() error { +func checkRRAvailable() error { if _, err := exec.LookPath("rr"); err != nil { return &ErrBackendUnavailable{} } @@ -207,8 +208,10 @@ const ( targetCmd = "target extended-remote " ) -func rrStderrParser(stderr io.Reader, initch chan<- rrInit, quiet bool) { +func rrStderrParser(stderr io.ReadCloser, initch chan<- rrInit, quiet bool) { rd := bufio.NewReader(stderr) + defer stderr.Close() + for { line, err := rd.ReadString('\n') if err != nil { diff --git a/pkg/proc/gdbserial/rr_test.go b/pkg/proc/gdbserial/rr_test.go index 3382d40d37..66dc44bfea 100644 --- a/pkg/proc/gdbserial/rr_test.go +++ b/pkg/proc/gdbserial/rr_test.go @@ -164,18 +164,18 @@ func TestReverseBreakpointCounts(t *testing.T) { } } - t.Logf("TotalHitCount: %d", bp.TotalHitCount) - if bp.TotalHitCount != 200 { - t.Fatalf("Wrong TotalHitCount for the breakpoint (%d)", bp.TotalHitCount) + t.Logf("TotalHitCount: %d", bp.UserBreaklet().TotalHitCount) + if bp.UserBreaklet().TotalHitCount != 200 { + t.Fatalf("Wrong TotalHitCount for the breakpoint (%d)", bp.UserBreaklet().TotalHitCount) } - if len(bp.HitCount) != 2 { - t.Fatalf("Wrong number of goroutines for breakpoint (%d)", len(bp.HitCount)) + if len(bp.UserBreaklet().HitCount) != 2 { + t.Fatalf("Wrong number of goroutines for breakpoint (%d)", len(bp.UserBreaklet().HitCount)) } - for _, v := range bp.HitCount { + for _, v := range bp.UserBreaklet().HitCount { if v != 100 { - t.Fatalf("Wrong HitCount for breakpoint (%v)", bp.HitCount) + t.Fatalf("Wrong HitCount for breakpoint (%v)", bp.UserBreaklet().HitCount) } } }) @@ -251,7 +251,7 @@ func TestCheckpoints(t *testing.T) { // Delete breakpoint, move back to checkpoint then next twice and check // output of 'when' again - _, err = p.ClearBreakpoint(bp.Addr) + err = p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint") p.Restart(fmt.Sprintf("c%d", cpid)) g, _ = proc.FindGoroutine(p, 1) @@ -283,7 +283,7 @@ func TestIssue1376(t *testing.T) { withTestRecording("continuetestprog", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFunctionBreakpoint(p, t, "main.main") assertNoError(p.Continue(), t, "Continue (forward)") - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint") assertNoError(p.ChangeDirection(proc.Backward), t, "Switching to backward direction") assertNoError(p.Continue(), t, "Continue (backward)") diff --git a/pkg/proc/goroutine_cache.go b/pkg/proc/goroutine_cache.go index e81f4d2b2b..3e34fad999 100644 --- a/pkg/proc/goroutine_cache.go +++ b/pkg/proc/goroutine_cache.go @@ -27,12 +27,12 @@ func (gcache *goroutineCache) getRuntimeAllg(bi *BinaryInfo, mem MemoryReadWrite if gcache.allglenAddr == 0 || gcache.allgentryAddr == 0 { return 0, 0, ErrNoRuntimeAllG } - allglen, err := readUintRaw(mem, uintptr(gcache.allglenAddr), int64(bi.Arch.PtrSize())) + allglen, err := readUintRaw(mem, gcache.allglenAddr, int64(bi.Arch.PtrSize())) if err != nil { return 0, 0, err } - - allgptr, err := readUintRaw(mem, uintptr(gcache.allgentryAddr), int64(bi.Arch.PtrSize())) + + allgptr, err := readUintRaw(mem, gcache.allgentryAddr, int64(bi.Arch.PtrSize())) if err != nil { return 0, 0, err } diff --git a/pkg/proc/i386_arch.go b/pkg/proc/i386_arch.go index 62960f424f..6e0d485cf8 100644 --- a/pkg/proc/i386_arch.go +++ b/pkg/proc/i386_arch.go @@ -3,15 +3,11 @@ package proc import ( "encoding/binary" "fmt" - "github.com/go-delve/delve/pkg/dwarf/frame" - "github.com/go-delve/delve/pkg/dwarf/op" "strings" -) -const ( - i386DwarfIPRegNum uint64 = 8 - i386DwarfSPRegNum uint64 = 4 - i386DwarfBPRegNum uint64 = 5 + "github.com/go-delve/delve/pkg/dwarf/frame" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" ) var i386BreakInstruction = []byte{0xCC} @@ -24,6 +20,7 @@ func I386Arch(goos string) *Arch { ptrSize: 4, maxInstructionLength: 15, breakpointInstruction: i386BreakInstruction, + altBreakpointInstruction: []byte{0xcd, 0x03}, breakInstrMovesPC: true, derefTLS: false, prologues: prologuesI386, @@ -35,6 +32,10 @@ func I386Arch(goos string) *Arch { DwarfRegisterToString: i386DwarfRegisterToString, inhibitStepInto: i386InhibitStepInto, asmDecode: i386AsmDecode, + PCRegNum: regnum.I386_Eip, + SPRegNum: regnum.I386_Esp, + asmRegisters: i386AsmRegisters, + RegisterNameToDwarf: nameToDwarfFunc(regnum.I386NameToDwarf), } } @@ -64,24 +65,24 @@ func i386FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *BinaryI // here). return &frame.FrameContext{ - RetAddrReg: i386DwarfIPRegNum, + RetAddrReg: regnum.I386_Eip, Regs: map[uint64]frame.DWRule{ - i386DwarfIPRegNum: frame.DWRule{ + regnum.I386_Eip: frame.DWRule{ Rule: frame.RuleOffset, Offset: int64(-i.PtrSize()), }, - i386DwarfBPRegNum: frame.DWRule{ + regnum.I386_Ebp: frame.DWRule{ Rule: frame.RuleOffset, Offset: int64(-2 * i.PtrSize()), }, - i386DwarfSPRegNum: frame.DWRule{ + regnum.I386_Esp: frame.DWRule{ Rule: frame.RuleValOffset, Offset: 0, }, }, CFA: frame.DWRule{ Rule: frame.RuleCFA, - Reg: i386DwarfBPRegNum, + Reg: regnum.I386_Ebp, Offset: int64(2 * i.PtrSize()), }, } @@ -102,10 +103,10 @@ func i386FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *BinaryI // so that we can use it to unwind the stack even when we encounter frames // without descriptor entries. // If there isn't i rule already we emit one. - if fctxt.Regs[i386DwarfBPRegNum].Rule == frame.RuleUndefined { - fctxt.Regs[i386DwarfBPRegNum] = frame.DWRule{ + if fctxt.Regs[regnum.I386_Ebp].Rule == frame.RuleUndefined { + fctxt.Regs[regnum.I386_Ebp] = frame.DWRule{ Rule: frame.RuleFramePointer, - Reg: i386DwarfBPRegNum, + Reg: regnum.I386_Ebp, Offset: 0, } } @@ -116,6 +117,10 @@ func i386FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *BinaryI // SwitchStack will use the current frame to determine if it's time to func i386SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { if it.frame.Current.Fn == nil { + if it.systemstack && it.g != nil && it.top { + it.switchToGoroutineStack() + return true + } return false } switch it.frame.Current.Fn.Name { @@ -147,7 +152,7 @@ func i386SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { return true default: - if it.systemstack && it.top && it.g != nil && strings.HasPrefix(it.frame.Current.Fn.Name, "runtime.") && it.frame.Current.Fn.Name != "runtime.fatalthrow" { + if it.systemstack && it.top && it.g != nil && strings.HasPrefix(it.frame.Current.Fn.Name, "runtime.") && it.frame.Current.Fn.Name != "runtime.throw" && it.frame.Current.Fn.Name != "runtime.fatalthrow" { // The runtime switches to the system stack in multiple places. // This usually happens through a call to runtime.systemstack but there // are functions that switch to the system stack manually (for example @@ -156,7 +161,7 @@ func i386SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool { // calls we switch directly to the goroutine stack if we detect that the // function at the top of the stack is a runtime function. // - // The function "runtime.fatalthrow" is deliberately excluded from this + // The function "runtime.throw" is deliberately excluded from this // because it can end up in the stack during a cgo call and switching to // the goroutine stack will exclude all the C functions from the stack // trace. @@ -185,94 +190,28 @@ func i386RegSize(regnum uint64) int { return 4 } -// The mapping between hardware registers and DWARF registers is specified -// in the System V ABI Intel386 Architecture Processor Supplement page 25, -// table 2.14 -// https://www.uclibc.org/docs/psABI-i386.pdf - -var i386DwarfToName = map[int]string{ - 0: "Eax", - 1: "Ecx", - 2: "Edx", - 3: "Ebx", - 4: "Esp", - 5: "Ebp", - 6: "Esi", - 7: "Edi", - 8: "Eip", - 9: "Eflags", - 11: "ST(0)", - 12: "ST(1)", - 13: "ST(2)", - 14: "ST(3)", - 15: "ST(4)", - 16: "ST(5)", - 17: "ST(6)", - 18: "ST(7)", - 21: "XMM0", - 22: "XMM1", - 23: "XMM2", - 24: "XMM3", - 25: "XMM4", - 26: "XMM5", - 27: "XMM6", - 28: "XMM7", - 40: "Es", - 41: "Cs", - 42: "Ss", - 43: "Ds", - 44: "Fs", - 45: "Gs", -} - -var i386NameToDwarf = func() map[string]int { - r := make(map[string]int) - for regNum, regName := range i386DwarfToName { - r[strings.ToLower(regName)] = regNum - } - r["eflags"] = 9 - r["st0"] = 11 - r["st1"] = 12 - r["st2"] = 13 - r["st3"] = 14 - r["st4"] = 15 - r["st5"] = 16 - r["st6"] = 17 - r["st7"] = 18 - return r -}() +func i386RegistersToDwarfRegisters(staticBase uint64, regs Registers) *op.DwarfRegisters { + dregs := initDwarfRegistersFromSlice(regnum.I386MaxRegNum(), regs, regnum.I386NameToDwarf) + dr := op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, regnum.I386_Eip, regnum.I386_Esp, regnum.I386_Ebp, 0) + dr.SetLoadMoreCallback(loadMoreDwarfRegistersFromSliceFunc(dr, regs, regnum.I386NameToDwarf)) -func maxI386DwarfRegister() int { - max := int(i386DwarfIPRegNum) - for i := range i386DwarfToName { - if i > max { - max = i - } - } - return max -} - -func i386RegistersToDwarfRegisters(staticBase uint64, regs Registers) op.DwarfRegisters { - dregs := initDwarfRegistersFromSlice(maxI386DwarfRegister(), regs, i386NameToDwarf) - dr := op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, i386DwarfIPRegNum, i386DwarfSPRegNum, i386DwarfBPRegNum, 0) - dr.SetLoadMoreCallback(loadMoreDwarfRegistersFromSliceFunc(dr, regs, i386NameToDwarf)) - - return *dr + return dr } func i386AddrAndStackRegsToDwarfRegisters(staticBase, pc, sp, bp, lr uint64) op.DwarfRegisters { - dregs := make([]*op.DwarfRegister, i386DwarfIPRegNum+1) - dregs[i386DwarfIPRegNum] = op.DwarfRegisterFromUint64(pc) - dregs[i386DwarfSPRegNum] = op.DwarfRegisterFromUint64(sp) - dregs[i386DwarfBPRegNum] = op.DwarfRegisterFromUint64(bp) + dregs := make([]*op.DwarfRegister, regnum.I386_Eip+1) + dregs[regnum.I386_Eip] = op.DwarfRegisterFromUint64(pc) + dregs[regnum.I386_Esp] = op.DwarfRegisterFromUint64(sp) + dregs[regnum.I386_Ebp] = op.DwarfRegisterFromUint64(bp) - return *op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, i386DwarfIPRegNum, i386DwarfSPRegNum, i386DwarfBPRegNum, 0) + return *op.NewDwarfRegisters(staticBase, dregs, binary.LittleEndian, regnum.I386_Eip, regnum.I386_Esp, regnum.I386_Ebp, 0) } func i386DwarfRegisterToString(j int, reg *op.DwarfRegister) (name string, floatingPoint bool, repr string) { - name, ok := i386DwarfToName[j] - if !ok { - name = fmt.Sprintf("unknown%d", j) + name = regnum.I386ToName(j) + + if reg == nil { + return name, false, "" } switch n := strings.ToLower(name); n { diff --git a/pkg/proc/i386_disasm.go b/pkg/proc/i386_disasm.go index 6803375de4..b176227841 100644 --- a/pkg/proc/i386_disasm.go +++ b/pkg/proc/i386_disasm.go @@ -5,10 +5,13 @@ package proc import ( + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" + "golang.org/x/arch/x86/x86asm" ) -func i386AsmDecode(asmInst *AsmInstruction, mem []byte, regs Registers, memrw MemoryReadWriter, bi *BinaryInfo) error { +func i386AsmDecode(asmInst *AsmInstruction, mem []byte, regs *op.DwarfRegisters, memrw MemoryReadWriter, bi *BinaryInfo) error { return x86AsmDecode(asmInst, mem, regs, memrw, bi, 32) } @@ -37,3 +40,39 @@ func init() { } } } + +var i386AsmRegisters = map[int]asmRegister{ + // 8-bit + int(x86asm.AL): asmRegister{regnum.I386_Eax, 0, mask8}, + int(x86asm.CL): asmRegister{regnum.I386_Ecx, 0, mask8}, + int(x86asm.DL): asmRegister{regnum.I386_Edx, 0, mask8}, + int(x86asm.BL): asmRegister{regnum.I386_Ebx, 0, mask8}, + int(x86asm.AH): asmRegister{regnum.I386_Eax, 8, mask8}, + int(x86asm.CH): asmRegister{regnum.I386_Ecx, 8, mask8}, + int(x86asm.DH): asmRegister{regnum.I386_Edx, 8, mask8}, + int(x86asm.BH): asmRegister{regnum.I386_Ebx, 8, mask8}, + int(x86asm.SPB): asmRegister{regnum.I386_Esp, 0, mask8}, + int(x86asm.BPB): asmRegister{regnum.I386_Ebp, 0, mask8}, + int(x86asm.SIB): asmRegister{regnum.I386_Esi, 0, mask8}, + int(x86asm.DIB): asmRegister{regnum.I386_Edi, 0, mask8}, + + // 16-bit + int(x86asm.AX): asmRegister{regnum.I386_Eax, 0, mask16}, + int(x86asm.CX): asmRegister{regnum.I386_Ecx, 0, mask16}, + int(x86asm.DX): asmRegister{regnum.I386_Edx, 0, mask16}, + int(x86asm.BX): asmRegister{regnum.I386_Ebx, 0, mask16}, + int(x86asm.SP): asmRegister{regnum.I386_Esp, 0, mask16}, + int(x86asm.BP): asmRegister{regnum.I386_Ebp, 0, mask16}, + int(x86asm.SI): asmRegister{regnum.I386_Esi, 0, mask16}, + int(x86asm.DI): asmRegister{regnum.I386_Edi, 0, mask16}, + + // 32-bit + int(x86asm.EAX): asmRegister{regnum.I386_Eax, 0, mask32}, + int(x86asm.ECX): asmRegister{regnum.I386_Ecx, 0, mask32}, + int(x86asm.EDX): asmRegister{regnum.I386_Edx, 0, mask32}, + int(x86asm.EBX): asmRegister{regnum.I386_Ebx, 0, mask32}, + int(x86asm.ESP): asmRegister{regnum.I386_Esp, 0, mask32}, + int(x86asm.EBP): asmRegister{regnum.I386_Ebp, 0, mask32}, + int(x86asm.ESI): asmRegister{regnum.I386_Esi, 0, mask32}, + int(x86asm.EDI): asmRegister{regnum.I386_Edi, 0, mask32}, +} diff --git a/pkg/proc/interface.go b/pkg/proc/interface.go index cd1ad0c812..e403e1c660 100644 --- a/pkg/proc/interface.go +++ b/pkg/proc/interface.go @@ -1,5 +1,10 @@ package proc +import ( + "github.com/go-delve/delve/pkg/elfwriter" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" +) + // Process represents the target of the debugger. This // target could be a system process, core file, etc. // @@ -8,30 +13,55 @@ package proc // There is one exception to this rule: it is safe to call RequestManualStop // concurrently with ContinueOnce. type Process interface { - Info - ProcessManipulation - RecordingManipulation + // ResumeNotify specifies a channel that will be closed the next time + // ContinueOnce finishes resuming the target. + ResumeNotify(chan<- struct{}) + BinInfo() *BinaryInfo + EntryPoint() (uint64, error) + + // RequestManualStop attempts to stop all the process' threads. + RequestManualStop() error + // CheckAndClearManualStopRequest returns true the first time it's called + // after a call to RequestManualStop. + CheckAndClearManualStopRequest() bool + + FindThread(threadID int) (Thread, bool) + ThreadList() []Thread Breakpoints() *BreakpointMap + + // Memory returns a memory read/writer for this process's memory. + Memory() MemoryReadWriter } -// ProcessInternal holds a set of methods that are not meant to be called by -// anyone except for an instance of `proc.Target`. These methods are not -// safe to use by themselves and should never be called directly outside of -// the `proc` package. -// This is temporary and in support of an ongoing refactor. +// ProcessInternal holds a set of methods that need to be implemented by a +// Delve backend. Methods in the Process interface are safe to be called by +// clients of the 'proc' library, while all other methods are only called +// directly within 'proc'. type ProcessInternal interface { - SetCurrentThread(Thread) - // Restart restarts the recording from the specified position, or from the - // last checkpoint if pos == "". - // If pos starts with 'c' it's a checkpoint ID, otherwise it's an event - // number. - Restart(pos string) error + Process + // Valid returns true if this Process can be used. When it returns false it + // also returns an error describing why the Process is invalid (either + // ErrProcessExited or ErrProcessDetached). + Valid() (bool, error) Detach(bool) error ContinueOnce() (trapthread Thread, stopReason StopReason, err error) - WriteBreakpoint(addr uint64) (file string, line int, fn *Function, originalData []byte, err error) + WriteBreakpoint(*Breakpoint) error EraseBreakpoint(*Breakpoint) error + + SupportsBPF() bool + SetUProbe(string, int64, []ebpf.UProbeArgMap) error + GetBufferedTracepoints() []ebpf.RawUProbeParams + + // DumpProcessNotes returns ELF core notes describing the process and its threads. + // Implementing this method is optional. + DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (bool, []elfwriter.Note, error) + // MemoryMap returns the memory map of the target process. This method must be implemented if CanDump is true. + MemoryMap() ([]MemoryMapEntry, error) + + // StartCallInjection notifies the backend that we are about to inject a function call. + StartCallInjection() (func(), error) } // RecordingManipulation is an interface for manipulating process recordings. @@ -53,6 +83,19 @@ type RecordingManipulation interface { ClearCheckpoint(id int) error } +// RecordingManipulationInternal is an interface that a Delve backend can +// implement if it is a recording. +type RecordingManipulationInternal interface { + RecordingManipulation + + // Restart restarts the recording from the specified position, or from the + // last checkpoint if pos == "". + // If pos starts with 'c' it's a checkpoint ID, otherwise it's an event + // number. + // Returns the new current thread after the restart has completed. + Restart(pos string) (Thread, error) +} + // Direction is the direction of execution for the target process. type Direction int8 @@ -69,35 +112,3 @@ type Checkpoint struct { When string Where string } - -// Info is an interface that provides general information on the target. -type Info interface { - Pid() int - // ResumeNotify specifies a channel that will be closed the next time - // ContinueOnce finishes resuming the target. - ResumeNotify(chan<- struct{}) - // Valid returns true if this Process can be used. When it returns false it - // also returns an error describing why the Process is invalid (either - // ErrProcessExited or ErrProcessDetached). - Valid() (bool, error) - BinInfo() *BinaryInfo - EntryPoint() (uint64, error) - - ThreadInfo -} - -// ThreadInfo is an interface for getting information on active threads -// in the process. -type ThreadInfo interface { - FindThread(threadID int) (Thread, bool) - ThreadList() []Thread - CurrentThread() Thread -} - -// ProcessManipulation is an interface for changing the execution state of a process. -type ProcessManipulation interface { - RequestManualStop() error - // CheckAndClearManualStopRequest returns true the first time it's called - // after a call to RequestManualStop. - CheckAndClearManualStopRequest() bool -} diff --git a/pkg/proc/internal/ebpf/bpf/dummy.go b/pkg/proc/internal/ebpf/bpf/dummy.go new file mode 100644 index 0000000000..4983aacb50 --- /dev/null +++ b/pkg/proc/internal/ebpf/bpf/dummy.go @@ -0,0 +1,4 @@ +//go:build dummy +// +build dummy + +package ebpf diff --git a/pkg/proc/internal/ebpf/bpf/include/dummy.go b/pkg/proc/internal/ebpf/bpf/include/dummy.go new file mode 100644 index 0000000000..4983aacb50 --- /dev/null +++ b/pkg/proc/internal/ebpf/bpf/include/dummy.go @@ -0,0 +1,4 @@ +//go:build dummy +// +build dummy + +package ebpf diff --git a/pkg/proc/internal/ebpf/bpf/include/function_vals.bpf.h b/pkg/proc/internal/ebpf/bpf/include/function_vals.bpf.h new file mode 100644 index 0000000000..0df7b9b7c8 --- /dev/null +++ b/pkg/proc/internal/ebpf/bpf/include/function_vals.bpf.h @@ -0,0 +1,43 @@ +#include + +// function_parameter stores information about a single parameter to a function. +typedef struct function_parameter { + // Type of the parameter as defined by the reflect.Kind enum. + unsigned int kind; + // Size of the variable in bytes. + unsigned int size; + + // Offset from stack pointer. This should only be set from the Go side. + int offset; + + // If true, the parameter is passed in a register. + bool in_reg; + // The number of register pieces the parameter is passed in. + int n_pieces; + // If in_reg is true, this represents the registers that the parameter is passed in. + // This is an array because the number of registers may vary and the parameter may be + // passed in multiple registers. + int reg_nums[6]; + + // The following are filled in by the eBPF program. + size_t daddr; // Data address. + char val[0x30]; // Value of the parameter. + char deref_val[0x30]; // Dereference value of the parameter. +} function_parameter_t; + +// function_parameter_list holds info about the function parameters and +// stores information on up to 6 parameters. +typedef struct function_parameter_list { + unsigned int goid_offset; // Offset of the `goid` struct member. + long long g_addr_offset; // Offset of the Goroutine struct from the TLS segment. + int goroutine_id; + + unsigned int fn_addr; + bool is_ret; + + unsigned int n_parameters; // number of parameters. + function_parameter_t params[6]; // list of parameters. + + unsigned int n_ret_parameters; // number of return parameters. + function_parameter_t ret_params[6]; // list of return parameters. +} function_parameter_list_t; diff --git a/pkg/proc/internal/ebpf/bpf/include/trace.bpf.h b/pkg/proc/internal/ebpf/bpf/include/trace.bpf.h new file mode 100644 index 0000000000..971db59fa4 --- /dev/null +++ b/pkg/proc/internal/ebpf/bpf/include/trace.bpf.h @@ -0,0 +1,25 @@ +#include "vmlinux.h" +#include "function_vals.bpf.h" +#include +#include + +#define BPF_MAX_VAR_SIZ (1 << 29) + +// Ring buffer to handle communication of variable values back to userspace. +struct { + __uint(type, BPF_MAP_TYPE_RINGBUF); + __uint(max_entries, BPF_MAX_VAR_SIZ); +} events SEC(".maps"); + +struct { + __uint(type, BPF_MAP_TYPE_RINGBUF); + __uint(max_entries, BPF_MAX_VAR_SIZ); +} heap SEC(".maps"); + +// Map which uses instruction address as key and function parameter info as the value. +struct { + __uint(max_entries, 42); + __uint(type, BPF_MAP_TYPE_HASH); + __type(key, u64); + __type(value, function_parameter_list_t); +} arg_map SEC(".maps"); diff --git a/pkg/proc/internal/ebpf/bpf/include/vmlinux.h b/pkg/proc/internal/ebpf/bpf/include/vmlinux.h new file mode 100644 index 0000000000..79b8922e89 --- /dev/null +++ b/pkg/proc/internal/ebpf/bpf/include/vmlinux.h @@ -0,0 +1,124044 @@ +#ifndef __VMLINUX_H__ +#define __VMLINUX_H__ + +#ifndef BPF_NO_PRESERVE_ACCESS_INDEX +#pragma clang attribute push (__attribute__((preserve_access_index)), apply_to = record) +#endif + +typedef unsigned char __u8; + +typedef short int __s16; + +typedef short unsigned int __u16; + +typedef int __s32; + +typedef unsigned int __u32; + +typedef long long int __s64; + +typedef long long unsigned int __u64; + +typedef __u8 u8; + +typedef __s16 s16; + +typedef __u16 u16; + +typedef __s32 s32; + +typedef __u32 u32; + +typedef __s64 s64; + +typedef __u64 u64; + +enum { + false = 0, + true = 1, +}; + +typedef long int __kernel_long_t; + +typedef long unsigned int __kernel_ulong_t; + +typedef int __kernel_pid_t; + +typedef unsigned int __kernel_uid32_t; + +typedef unsigned int __kernel_gid32_t; + +typedef __kernel_ulong_t __kernel_size_t; + +typedef __kernel_long_t __kernel_ssize_t; + +typedef long long int __kernel_loff_t; + +typedef long long int __kernel_time64_t; + +typedef __kernel_long_t __kernel_clock_t; + +typedef int __kernel_timer_t; + +typedef int __kernel_clockid_t; + +typedef unsigned int __poll_t; + +typedef u32 __kernel_dev_t; + +typedef __kernel_dev_t dev_t; + +typedef short unsigned int umode_t; + +typedef __kernel_pid_t pid_t; + +typedef __kernel_clockid_t clockid_t; + +typedef _Bool bool; + +typedef __kernel_uid32_t uid_t; + +typedef __kernel_gid32_t gid_t; + +typedef __kernel_loff_t loff_t; + +typedef __kernel_size_t size_t; + +typedef __kernel_ssize_t ssize_t; + +typedef s32 int32_t; + +typedef u32 uint32_t; + +typedef u64 sector_t; + +typedef u64 blkcnt_t; + +typedef u64 dma_addr_t; + +typedef unsigned int gfp_t; + +typedef unsigned int fmode_t; + +typedef u64 phys_addr_t; + +typedef struct { + int counter; +} atomic_t; + +typedef struct { + s64 counter; +} atomic64_t; + +struct list_head { + struct list_head *next; + struct list_head *prev; +}; + +struct hlist_node; + +struct hlist_head { + struct hlist_node *first; +}; + +struct hlist_node { + struct hlist_node *next; + struct hlist_node **pprev; +}; + +struct callback_head { + struct callback_head *next; + void (*func)(struct callback_head *); +}; + +struct lock_class_key {}; + +struct fs_context; + +struct fs_parameter_spec; + +struct dentry; + +struct super_block; + +struct module; + +struct file_system_type { + const char *name; + int fs_flags; + int (*init_fs_context)(struct fs_context *); + const struct fs_parameter_spec *parameters; + struct dentry * (*mount)(struct file_system_type *, int, const char *, void *); + void (*kill_sb)(struct super_block *); + struct module *owner; + struct file_system_type *next; + struct hlist_head fs_supers; + struct lock_class_key s_lock_key; + struct lock_class_key s_umount_key; + struct lock_class_key s_vfs_rename_key; + struct lock_class_key s_writers_key[3]; + struct lock_class_key i_lock_key; + struct lock_class_key i_mutex_key; + struct lock_class_key i_mutex_dir_key; +}; + +struct qspinlock { + union { + atomic_t val; + struct { + u8 locked; + u8 pending; + }; + struct { + u16 locked_pending; + u16 tail; + }; + }; +}; + +typedef struct qspinlock arch_spinlock_t; + +struct qrwlock { + union { + atomic_t cnts; + struct { + u8 wlocked; + u8 __lstate[3]; + }; + }; + arch_spinlock_t wait_lock; +}; + +typedef struct qrwlock arch_rwlock_t; + +struct raw_spinlock { + arch_spinlock_t raw_lock; +}; + +typedef struct raw_spinlock raw_spinlock_t; + +struct spinlock { + union { + struct raw_spinlock rlock; + }; +}; + +typedef struct spinlock spinlock_t; + +typedef struct { + arch_rwlock_t raw_lock; +} rwlock_t; + +struct ratelimit_state { + raw_spinlock_t lock; + int interval; + int burst; + int printed; + int missed; + long unsigned int begin; + long unsigned int flags; +}; + +typedef void *fl_owner_t; + +struct file; + +struct kiocb; + +struct iov_iter; + +struct dir_context; + +struct poll_table_struct; + +struct vm_area_struct; + +struct inode; + +struct file_lock; + +struct page; + +struct pipe_inode_info; + +struct seq_file; + +struct file_operations { + struct module *owner; + loff_t (*llseek)(struct file *, loff_t, int); + ssize_t (*read)(struct file *, char *, size_t, loff_t *); + ssize_t (*write)(struct file *, const char *, size_t, loff_t *); + ssize_t (*read_iter)(struct kiocb *, struct iov_iter *); + ssize_t (*write_iter)(struct kiocb *, struct iov_iter *); + int (*iopoll)(struct kiocb *, bool); + int (*iterate)(struct file *, struct dir_context *); + int (*iterate_shared)(struct file *, struct dir_context *); + __poll_t (*poll)(struct file *, struct poll_table_struct *); + long int (*unlocked_ioctl)(struct file *, unsigned int, long unsigned int); + long int (*compat_ioctl)(struct file *, unsigned int, long unsigned int); + int (*mmap)(struct file *, struct vm_area_struct *); + long unsigned int mmap_supported_flags; + int (*open)(struct inode *, struct file *); + int (*flush)(struct file *, fl_owner_t); + int (*release)(struct inode *, struct file *); + int (*fsync)(struct file *, loff_t, loff_t, int); + int (*fasync)(int, struct file *, int); + int (*lock)(struct file *, int, struct file_lock *); + ssize_t (*sendpage)(struct file *, struct page *, int, size_t, loff_t *, int); + long unsigned int (*get_unmapped_area)(struct file *, long unsigned int, long unsigned int, long unsigned int, long unsigned int); + int (*check_flags)(int); + int (*flock)(struct file *, int, struct file_lock *); + ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); + ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); + int (*setlease)(struct file *, long int, struct file_lock **, void **); + long int (*fallocate)(struct file *, int, loff_t, loff_t); + void (*show_fdinfo)(struct seq_file *, struct file *); + ssize_t (*copy_file_range)(struct file *, loff_t, struct file *, loff_t, size_t, unsigned int); + loff_t (*remap_file_range)(struct file *, loff_t, struct file *, loff_t, loff_t, unsigned int); + int (*fadvise)(struct file *, loff_t, loff_t, int); +}; + +typedef __s64 time64_t; + +struct __kernel_timespec { + __kernel_time64_t tv_sec; + long long int tv_nsec; +}; + +struct timespec64 { + time64_t tv_sec; + long int tv_nsec; +}; + +enum timespec_type { + TT_NONE = 0, + TT_NATIVE = 1, + TT_COMPAT = 2, +}; + +typedef s32 old_time32_t; + +struct old_timespec32 { + old_time32_t tv_sec; + s32 tv_nsec; +}; + +struct pollfd; + +struct restart_block { + long int (*fn)(struct restart_block *); + union { + struct { + u32 *uaddr; + u32 val; + u32 flags; + u32 bitset; + u64 time; + u32 *uaddr2; + } futex; + struct { + clockid_t clockid; + enum timespec_type type; + union { + struct __kernel_timespec *rmtp; + struct old_timespec32 *compat_rmtp; + }; + u64 expires; + } nanosleep; + struct { + struct pollfd *ufds; + int nfds; + int has_timeout; + long unsigned int tv_sec; + long unsigned int tv_nsec; + } poll; + }; +}; + +struct thread_info { + long unsigned int flags; + long unsigned int syscall_work; + u32 status; +}; + +struct refcount_struct { + atomic_t refs; +}; + +typedef struct refcount_struct refcount_t; + +struct llist_node { + struct llist_node *next; +}; + +struct __call_single_node { + struct llist_node llist; + union { + unsigned int u_flags; + atomic_t a_flags; + }; + u16 src; + u16 dst; +}; + +struct load_weight { + long unsigned int weight; + u32 inv_weight; +}; + +struct rb_node { + long unsigned int __rb_parent_color; + struct rb_node *rb_right; + struct rb_node *rb_left; +}; + +struct sched_statistics { + u64 wait_start; + u64 wait_max; + u64 wait_count; + u64 wait_sum; + u64 iowait_count; + u64 iowait_sum; + u64 sleep_start; + u64 sleep_max; + s64 sum_sleep_runtime; + u64 block_start; + u64 block_max; + u64 exec_max; + u64 slice_max; + u64 nr_migrations_cold; + u64 nr_failed_migrations_affine; + u64 nr_failed_migrations_running; + u64 nr_failed_migrations_hot; + u64 nr_forced_migrations; + u64 nr_wakeups; + u64 nr_wakeups_sync; + u64 nr_wakeups_migrate; + u64 nr_wakeups_local; + u64 nr_wakeups_remote; + u64 nr_wakeups_affine; + u64 nr_wakeups_affine_attempts; + u64 nr_wakeups_passive; + u64 nr_wakeups_idle; +}; + +struct util_est { + unsigned int enqueued; + unsigned int ewma; +}; + +struct sched_avg { + u64 last_update_time; + u64 load_sum; + u64 runnable_sum; + u32 util_sum; + u32 period_contrib; + long unsigned int load_avg; + long unsigned int runnable_avg; + long unsigned int util_avg; + struct util_est util_est; +}; + +struct cfs_rq; + +struct sched_entity { + struct load_weight load; + struct rb_node run_node; + struct list_head group_node; + unsigned int on_rq; + u64 exec_start; + u64 sum_exec_runtime; + u64 vruntime; + u64 prev_sum_exec_runtime; + u64 nr_migrations; + struct sched_statistics statistics; + int depth; + struct sched_entity *parent; + struct cfs_rq *cfs_rq; + struct cfs_rq *my_q; + long unsigned int runnable_weight; + long: 64; + long: 64; + long: 64; + struct sched_avg avg; +}; + +struct sched_rt_entity { + struct list_head run_list; + long unsigned int timeout; + long unsigned int watchdog_stamp; + unsigned int time_slice; + short unsigned int on_rq; + short unsigned int on_list; + struct sched_rt_entity *back; +}; + +typedef s64 ktime_t; + +struct timerqueue_node { + struct rb_node node; + ktime_t expires; +}; + +enum hrtimer_restart { + HRTIMER_NORESTART = 0, + HRTIMER_RESTART = 1, +}; + +struct hrtimer_clock_base; + +struct hrtimer { + struct timerqueue_node node; + ktime_t _softexpires; + enum hrtimer_restart (*function)(struct hrtimer *); + struct hrtimer_clock_base *base; + u8 state; + u8 is_rel; + u8 is_soft; + u8 is_hard; +}; + +struct sched_dl_entity { + struct rb_node rb_node; + u64 dl_runtime; + u64 dl_deadline; + u64 dl_period; + u64 dl_bw; + u64 dl_density; + s64 runtime; + u64 deadline; + unsigned int flags; + unsigned int dl_throttled: 1; + unsigned int dl_yielded: 1; + unsigned int dl_non_contending: 1; + unsigned int dl_overrun: 1; + struct hrtimer dl_timer; + struct hrtimer inactive_timer; + struct sched_dl_entity *pi_se; +}; + +struct cpumask { + long unsigned int bits[128]; +}; + +typedef struct cpumask cpumask_t; + +union rcu_special { + struct { + u8 blocked; + u8 need_qs; + u8 exp_hint; + u8 need_mb; + } b; + u32 s; +}; + +struct sched_info { + long unsigned int pcount; + long long unsigned int run_delay; + long long unsigned int last_arrival; + long long unsigned int last_queued; +}; + +struct plist_node { + int prio; + struct list_head prio_list; + struct list_head node_list; +}; + +struct vmacache { + u64 seqnum; + struct vm_area_struct *vmas[4]; +}; + +struct task_rss_stat { + int events; + int count[4]; +}; + +struct prev_cputime { + u64 utime; + u64 stime; + raw_spinlock_t lock; +}; + +struct seqcount { + unsigned int sequence; +}; + +typedef struct seqcount seqcount_t; + +enum vtime_state { + VTIME_INACTIVE = 0, + VTIME_IDLE = 1, + VTIME_SYS = 2, + VTIME_USER = 3, + VTIME_GUEST = 4, +}; + +struct vtime { + seqcount_t seqcount; + long long unsigned int starttime; + enum vtime_state state; + unsigned int cpu; + u64 utime; + u64 stime; + u64 gtime; +}; + +struct rb_root { + struct rb_node *rb_node; +}; + +struct rb_root_cached { + struct rb_root rb_root; + struct rb_node *rb_leftmost; +}; + +struct timerqueue_head { + struct rb_root_cached rb_root; +}; + +struct posix_cputimer_base { + u64 nextevt; + struct timerqueue_head tqhead; +}; + +struct posix_cputimers { + struct posix_cputimer_base bases[3]; + unsigned int timers_active; + unsigned int expiry_active; +}; + +struct posix_cputimers_work { + struct callback_head work; + unsigned int scheduled; +}; + +struct sem_undo_list; + +struct sysv_sem { + struct sem_undo_list *undo_list; +}; + +struct sysv_shm { + struct list_head shm_clist; +}; + +typedef struct { + long unsigned int sig[1]; +} sigset_t; + +struct sigpending { + struct list_head list; + sigset_t signal; +}; + +typedef struct { + uid_t val; +} kuid_t; + +struct seccomp_filter; + +struct seccomp { + int mode; + atomic_t filter_count; + struct seccomp_filter *filter; +}; + +struct syscall_user_dispatch { + char *selector; + long unsigned int offset; + long unsigned int len; + bool on_dispatch; +}; + +struct wake_q_node { + struct wake_q_node *next; +}; + +struct task_io_accounting { + u64 rchar; + u64 wchar; + u64 syscr; + u64 syscw; + u64 read_bytes; + u64 write_bytes; + u64 cancelled_write_bytes; +}; + +typedef struct { + long unsigned int bits[16]; +} nodemask_t; + +struct seqcount_spinlock { + seqcount_t seqcount; +}; + +typedef struct seqcount_spinlock seqcount_spinlock_t; + +typedef atomic64_t atomic_long_t; + +struct optimistic_spin_queue { + atomic_t tail; +}; + +struct mutex { + atomic_long_t owner; + spinlock_t wait_lock; + struct optimistic_spin_queue osq; + struct list_head wait_list; +}; + +struct arch_tlbflush_unmap_batch { + struct cpumask cpumask; +}; + +struct tlbflush_unmap_batch { + struct arch_tlbflush_unmap_batch arch; + bool flush_required; + bool writable; +}; + +struct page_frag { + struct page *page; + __u32 offset; + __u32 size; +}; + +struct latency_record { + long unsigned int backtrace[12]; + unsigned int count; + long unsigned int time; + long unsigned int max; +}; + +struct kmap_ctrl {}; + +struct llist_head { + struct llist_node *first; +}; + +struct desc_struct { + u16 limit0; + u16 base0; + u16 base1: 8; + u16 type: 4; + u16 s: 1; + u16 dpl: 2; + u16 p: 1; + u16 limit1: 4; + u16 avl: 1; + u16 l: 1; + u16 d: 1; + u16 g: 1; + u16 base2: 8; +}; + +struct fregs_state { + u32 cwd; + u32 swd; + u32 twd; + u32 fip; + u32 fcs; + u32 foo; + u32 fos; + u32 st_space[20]; + u32 status; +}; + +struct fxregs_state { + u16 cwd; + u16 swd; + u16 twd; + u16 fop; + union { + struct { + u64 rip; + u64 rdp; + }; + struct { + u32 fip; + u32 fcs; + u32 foo; + u32 fos; + }; + }; + u32 mxcsr; + u32 mxcsr_mask; + u32 st_space[32]; + u32 xmm_space[64]; + u32 padding[12]; + union { + u32 padding1[12]; + u32 sw_reserved[12]; + }; +}; + +struct math_emu_info; + +struct swregs_state { + u32 cwd; + u32 swd; + u32 twd; + u32 fip; + u32 fcs; + u32 foo; + u32 fos; + u32 st_space[20]; + u8 ftop; + u8 changed; + u8 lookahead; + u8 no_update; + u8 rm; + u8 alimit; + struct math_emu_info *info; + u32 entry_eip; +}; + +struct xstate_header { + u64 xfeatures; + u64 xcomp_bv; + u64 reserved[6]; +}; + +struct xregs_state { + struct fxregs_state i387; + struct xstate_header header; + u8 extended_state_area[0]; +}; + +union fpregs_state { + struct fregs_state fsave; + struct fxregs_state fxsave; + struct swregs_state soft; + struct xregs_state xsave; + u8 __padding[4096]; +}; + +struct fpu { + unsigned int last_cpu; + long unsigned int avx512_timestamp; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + union fpregs_state state; +}; + +struct perf_event; + +struct io_bitmap; + +struct thread_struct { + struct desc_struct tls_array[3]; + long unsigned int sp; + short unsigned int es; + short unsigned int ds; + short unsigned int fsindex; + short unsigned int gsindex; + long unsigned int fsbase; + long unsigned int gsbase; + struct perf_event *ptrace_bps[4]; + long unsigned int virtual_dr6; + long unsigned int ptrace_dr7; + long unsigned int cr2; + long unsigned int trap_nr; + long unsigned int error_code; + struct io_bitmap *io_bitmap; + long unsigned int iopl_emul; + unsigned int sig_on_uaccess_err: 1; + long: 63; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct fpu fpu; +}; + +struct sched_class; + +struct task_group; + +struct mm_struct; + +struct pid; + +struct completion; + +struct cred; + +struct key; + +struct nameidata; + +struct fs_struct; + +struct files_struct; + +struct io_uring_task; + +struct nsproxy; + +struct signal_struct; + +struct sighand_struct; + +struct audit_context; + +struct rt_mutex_waiter; + +struct bio_list; + +struct blk_plug; + +struct reclaim_state; + +struct backing_dev_info; + +struct io_context; + +struct capture_control; + +struct kernel_siginfo; + +typedef struct kernel_siginfo kernel_siginfo_t; + +struct css_set; + +struct robust_list_head; + +struct compat_robust_list_head; + +struct futex_pi_state; + +struct perf_event_context; + +struct mempolicy; + +struct numa_group; + +struct rseq; + +struct task_delay_info; + +struct ftrace_ret_stack; + +struct mem_cgroup; + +struct request_queue; + +struct uprobe_task; + +struct vm_struct; + +struct task_struct { + struct thread_info thread_info; + volatile long int state; + void *stack; + refcount_t usage; + unsigned int flags; + unsigned int ptrace; + int on_cpu; + struct __call_single_node wake_entry; + unsigned int cpu; + unsigned int wakee_flips; + long unsigned int wakee_flip_decay_ts; + struct task_struct *last_wakee; + int recent_used_cpu; + int wake_cpu; + int on_rq; + int prio; + int static_prio; + int normal_prio; + unsigned int rt_priority; + const struct sched_class *sched_class; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct sched_entity se; + struct sched_rt_entity rt; + struct task_group *sched_task_group; + struct sched_dl_entity dl; + struct hlist_head preempt_notifiers; + unsigned int btrace_seq; + unsigned int policy; + int nr_cpus_allowed; + const cpumask_t *cpus_ptr; + cpumask_t cpus_mask; + void *migration_pending; + short unsigned int migration_disabled; + short unsigned int migration_flags; + long unsigned int rcu_tasks_nvcsw; + u8 rcu_tasks_holdout; + u8 rcu_tasks_idx; + int rcu_tasks_idle_cpu; + struct list_head rcu_tasks_holdout_list; + int trc_reader_nesting; + int trc_ipi_to_cpu; + union rcu_special trc_reader_special; + bool trc_reader_checked; + struct list_head trc_holdout_list; + struct sched_info sched_info; + struct list_head tasks; + struct plist_node pushable_tasks; + struct rb_node pushable_dl_tasks; + struct mm_struct *mm; + struct mm_struct *active_mm; + struct vmacache vmacache; + struct task_rss_stat rss_stat; + int exit_state; + int exit_code; + int exit_signal; + int pdeath_signal; + long unsigned int jobctl; + unsigned int personality; + unsigned int sched_reset_on_fork: 1; + unsigned int sched_contributes_to_load: 1; + unsigned int sched_migrated: 1; + unsigned int sched_psi_wake_requeue: 1; + int: 28; + unsigned int sched_remote_wakeup: 1; + unsigned int in_execve: 1; + unsigned int in_iowait: 1; + unsigned int restore_sigmask: 1; + unsigned int in_user_fault: 1; + unsigned int no_cgroup_migration: 1; + unsigned int frozen: 1; + unsigned int use_memdelay: 1; + unsigned int in_memstall: 1; + long unsigned int atomic_flags; + struct restart_block restart_block; + pid_t pid; + pid_t tgid; + long unsigned int stack_canary; + struct task_struct *real_parent; + struct task_struct *parent; + struct list_head children; + struct list_head sibling; + struct task_struct *group_leader; + struct list_head ptraced; + struct list_head ptrace_entry; + struct pid *thread_pid; + struct hlist_node pid_links[4]; + struct list_head thread_group; + struct list_head thread_node; + struct completion *vfork_done; + int *set_child_tid; + int *clear_child_tid; + u64 utime; + u64 stime; + u64 gtime; + struct prev_cputime prev_cputime; + struct vtime vtime; + atomic_t tick_dep_mask; + long unsigned int nvcsw; + long unsigned int nivcsw; + u64 start_time; + u64 start_boottime; + long unsigned int min_flt; + long unsigned int maj_flt; + struct posix_cputimers posix_cputimers; + struct posix_cputimers_work posix_cputimers_work; + const struct cred *ptracer_cred; + const struct cred *real_cred; + const struct cred *cred; + struct key *cached_requested_key; + char comm[16]; + struct nameidata *nameidata; + struct sysv_sem sysvsem; + struct sysv_shm sysvshm; + struct fs_struct *fs; + struct files_struct *files; + struct io_uring_task *io_uring; + struct nsproxy *nsproxy; + struct signal_struct *signal; + struct sighand_struct *sighand; + sigset_t blocked; + sigset_t real_blocked; + sigset_t saved_sigmask; + struct sigpending pending; + long unsigned int sas_ss_sp; + size_t sas_ss_size; + unsigned int sas_ss_flags; + struct callback_head *task_works; + struct audit_context *audit_context; + kuid_t loginuid; + unsigned int sessionid; + struct seccomp seccomp; + struct syscall_user_dispatch syscall_dispatch; + u64 parent_exec_id; + u64 self_exec_id; + spinlock_t alloc_lock; + raw_spinlock_t pi_lock; + struct wake_q_node wake_q; + struct rb_root_cached pi_waiters; + struct task_struct *pi_top_task; + struct rt_mutex_waiter *pi_blocked_on; + void *journal_info; + struct bio_list *bio_list; + struct blk_plug *plug; + struct reclaim_state *reclaim_state; + struct backing_dev_info *backing_dev_info; + struct io_context *io_context; + struct capture_control *capture_control; + long unsigned int ptrace_message; + kernel_siginfo_t *last_siginfo; + struct task_io_accounting ioac; + unsigned int psi_flags; + u64 acct_rss_mem1; + u64 acct_vm_mem1; + u64 acct_timexpd; + nodemask_t mems_allowed; + seqcount_spinlock_t mems_allowed_seq; + int cpuset_mem_spread_rotor; + int cpuset_slab_spread_rotor; + struct css_set *cgroups; + struct list_head cg_list; + u32 closid; + u32 rmid; + struct robust_list_head *robust_list; + struct compat_robust_list_head *compat_robust_list; + struct list_head pi_state_list; + struct futex_pi_state *pi_state_cache; + struct mutex futex_exit_mutex; + unsigned int futex_state; + struct perf_event_context *perf_event_ctxp[2]; + struct mutex perf_event_mutex; + struct list_head perf_event_list; + struct mempolicy *mempolicy; + short int il_prev; + short int pref_node_fork; + int numa_scan_seq; + unsigned int numa_scan_period; + unsigned int numa_scan_period_max; + int numa_preferred_nid; + long unsigned int numa_migrate_retry; + u64 node_stamp; + u64 last_task_numa_placement; + u64 last_sum_exec_runtime; + struct callback_head numa_work; + struct numa_group *numa_group; + long unsigned int *numa_faults; + long unsigned int total_numa_faults; + long unsigned int numa_faults_locality[3]; + long unsigned int numa_pages_migrated; + struct rseq *rseq; + u32 rseq_sig; + long unsigned int rseq_event_mask; + struct tlbflush_unmap_batch tlb_ubc; + union { + refcount_t rcu_users; + struct callback_head rcu; + }; + struct pipe_inode_info *splice_pipe; + struct page_frag task_frag; + struct task_delay_info *delays; + int nr_dirtied; + int nr_dirtied_pause; + long unsigned int dirty_paused_when; + int latency_record_count; + struct latency_record latency_record[32]; + u64 timer_slack_ns; + u64 default_timer_slack_ns; + int curr_ret_stack; + int curr_ret_depth; + struct ftrace_ret_stack *ret_stack; + long long unsigned int ftrace_timestamp; + atomic_t trace_overrun; + atomic_t tracing_graph_pause; + long unsigned int trace; + long unsigned int trace_recursion; + struct mem_cgroup *memcg_in_oom; + gfp_t memcg_oom_gfp_mask; + int memcg_oom_order; + unsigned int memcg_nr_pages_over_high; + struct mem_cgroup *active_memcg; + struct request_queue *throttle_queue; + struct uprobe_task *utask; + unsigned int sequential_io; + unsigned int sequential_io_avg; + struct kmap_ctrl kmap_ctrl; + int pagefault_disabled; + struct task_struct *oom_reaper_list; + struct vm_struct *stack_vm_area; + refcount_t stack_refcount; + int patch_state; + void *security; + void *mce_vaddr; + __u64 mce_kflags; + u64 mce_addr; + __u64 mce_ripv: 1; + __u64 mce_whole_page: 1; + __u64 __mce_reserved: 62; + struct callback_head mce_kill_me; + struct llist_head kretprobe_instances; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct thread_struct thread; +}; + +struct screen_info { + __u8 orig_x; + __u8 orig_y; + __u16 ext_mem_k; + __u16 orig_video_page; + __u8 orig_video_mode; + __u8 orig_video_cols; + __u8 flags; + __u8 unused2; + __u16 orig_video_ega_bx; + __u16 unused3; + __u8 orig_video_lines; + __u8 orig_video_isVGA; + __u16 orig_video_points; + __u16 lfb_width; + __u16 lfb_height; + __u16 lfb_depth; + __u32 lfb_base; + __u32 lfb_size; + __u16 cl_magic; + __u16 cl_offset; + __u16 lfb_linelength; + __u8 red_size; + __u8 red_pos; + __u8 green_size; + __u8 green_pos; + __u8 blue_size; + __u8 blue_pos; + __u8 rsvd_size; + __u8 rsvd_pos; + __u16 vesapm_seg; + __u16 vesapm_off; + __u16 pages; + __u16 vesa_attributes; + __u32 capabilities; + __u32 ext_lfb_base; + __u8 _reserved[2]; +} __attribute__((packed)); + +struct apm_bios_info { + __u16 version; + __u16 cseg; + __u32 offset; + __u16 cseg_16; + __u16 dseg; + __u16 flags; + __u16 cseg_len; + __u16 cseg_16_len; + __u16 dseg_len; +}; + +struct edd_device_params { + __u16 length; + __u16 info_flags; + __u32 num_default_cylinders; + __u32 num_default_heads; + __u32 sectors_per_track; + __u64 number_of_sectors; + __u16 bytes_per_sector; + __u32 dpte_ptr; + __u16 key; + __u8 device_path_info_length; + __u8 reserved2; + __u16 reserved3; + __u8 host_bus_type[4]; + __u8 interface_type[8]; + union { + struct { + __u16 base_address; + __u16 reserved1; + __u32 reserved2; + } isa; + struct { + __u8 bus; + __u8 slot; + __u8 function; + __u8 channel; + __u32 reserved; + } pci; + struct { + __u64 reserved; + } ibnd; + struct { + __u64 reserved; + } xprs; + struct { + __u64 reserved; + } htpt; + struct { + __u64 reserved; + } unknown; + } interface_path; + union { + struct { + __u8 device; + __u8 reserved1; + __u16 reserved2; + __u32 reserved3; + __u64 reserved4; + } ata; + struct { + __u8 device; + __u8 lun; + __u8 reserved1; + __u8 reserved2; + __u32 reserved3; + __u64 reserved4; + } atapi; + struct { + __u16 id; + __u64 lun; + __u16 reserved1; + __u32 reserved2; + } __attribute__((packed)) scsi; + struct { + __u64 serial_number; + __u64 reserved; + } usb; + struct { + __u64 eui; + __u64 reserved; + } i1394; + struct { + __u64 wwid; + __u64 lun; + } fibre; + struct { + __u64 identity_tag; + __u64 reserved; + } i2o; + struct { + __u32 array_number; + __u32 reserved1; + __u64 reserved2; + } raid; + struct { + __u8 device; + __u8 reserved1; + __u16 reserved2; + __u32 reserved3; + __u64 reserved4; + } sata; + struct { + __u64 reserved1; + __u64 reserved2; + } unknown; + } device_path; + __u8 reserved4; + __u8 checksum; +} __attribute__((packed)); + +struct edd_info { + __u8 device; + __u8 version; + __u16 interface_support; + __u16 legacy_max_cylinder; + __u8 legacy_max_head; + __u8 legacy_sectors_per_track; + struct edd_device_params params; +} __attribute__((packed)); + +struct ist_info { + __u32 signature; + __u32 command; + __u32 event; + __u32 perf_level; +}; + +struct edid_info { + unsigned char dummy[128]; +}; + +struct setup_header { + __u8 setup_sects; + __u16 root_flags; + __u32 syssize; + __u16 ram_size; + __u16 vid_mode; + __u16 root_dev; + __u16 boot_flag; + __u16 jump; + __u32 header; + __u16 version; + __u32 realmode_swtch; + __u16 start_sys_seg; + __u16 kernel_version; + __u8 type_of_loader; + __u8 loadflags; + __u16 setup_move_size; + __u32 code32_start; + __u32 ramdisk_image; + __u32 ramdisk_size; + __u32 bootsect_kludge; + __u16 heap_end_ptr; + __u8 ext_loader_ver; + __u8 ext_loader_type; + __u32 cmd_line_ptr; + __u32 initrd_addr_max; + __u32 kernel_alignment; + __u8 relocatable_kernel; + __u8 min_alignment; + __u16 xloadflags; + __u32 cmdline_size; + __u32 hardware_subarch; + __u64 hardware_subarch_data; + __u32 payload_offset; + __u32 payload_length; + __u64 setup_data; + __u64 pref_address; + __u32 init_size; + __u32 handover_offset; + __u32 kernel_info_offset; +} __attribute__((packed)); + +struct sys_desc_table { + __u16 length; + __u8 table[14]; +}; + +struct olpc_ofw_header { + __u32 ofw_magic; + __u32 ofw_version; + __u32 cif_handler; + __u32 irq_desc_table; +}; + +struct efi_info { + __u32 efi_loader_signature; + __u32 efi_systab; + __u32 efi_memdesc_size; + __u32 efi_memdesc_version; + __u32 efi_memmap; + __u32 efi_memmap_size; + __u32 efi_systab_hi; + __u32 efi_memmap_hi; +}; + +struct boot_e820_entry { + __u64 addr; + __u64 size; + __u32 type; +} __attribute__((packed)); + +struct boot_params { + struct screen_info screen_info; + struct apm_bios_info apm_bios_info; + __u8 _pad2[4]; + __u64 tboot_addr; + struct ist_info ist_info; + __u64 acpi_rsdp_addr; + __u8 _pad3[8]; + __u8 hd0_info[16]; + __u8 hd1_info[16]; + struct sys_desc_table sys_desc_table; + struct olpc_ofw_header olpc_ofw_header; + __u32 ext_ramdisk_image; + __u32 ext_ramdisk_size; + __u32 ext_cmd_line_ptr; + __u8 _pad4[116]; + struct edid_info edid_info; + struct efi_info efi_info; + __u32 alt_mem_k; + __u32 scratch; + __u8 e820_entries; + __u8 eddbuf_entries; + __u8 edd_mbr_sig_buf_entries; + __u8 kbd_status; + __u8 secure_boot; + __u8 _pad5[2]; + __u8 sentinel; + __u8 _pad6[1]; + struct setup_header hdr; + __u8 _pad7[36]; + __u32 edd_mbr_sig_buffer[16]; + struct boot_e820_entry e820_table[128]; + __u8 _pad8[48]; + struct edd_info eddbuf[6]; + __u8 _pad9[276]; +} __attribute__((packed)); + +enum x86_hardware_subarch { + X86_SUBARCH_PC = 0, + X86_SUBARCH_LGUEST = 1, + X86_SUBARCH_XEN = 2, + X86_SUBARCH_INTEL_MID = 3, + X86_SUBARCH_CE4100 = 4, + X86_NR_SUBARCHS = 5, +}; + +struct range { + u64 start; + u64 end; +}; + +struct pt_regs { + long unsigned int r15; + long unsigned int r14; + long unsigned int r13; + long unsigned int r12; + long unsigned int bp; + long unsigned int bx; + long unsigned int r11; + long unsigned int r10; + long unsigned int r9; + long unsigned int r8; + long unsigned int ax; + long unsigned int cx; + long unsigned int dx; + long unsigned int si; + long unsigned int di; + long unsigned int orig_ax; + long unsigned int ip; + long unsigned int cs; + long unsigned int flags; + long unsigned int sp; + long unsigned int ss; +}; + +enum { + GATE_INTERRUPT = 14, + GATE_TRAP = 15, + GATE_CALL = 12, + GATE_TASK = 5, +}; + +struct idt_bits { + u16 ist: 3; + u16 zero: 5; + u16 type: 5; + u16 dpl: 2; + u16 p: 1; +}; + +struct idt_data { + unsigned int vector; + unsigned int segment; + struct idt_bits bits; + const void *addr; +}; + +struct gate_struct { + u16 offset_low; + u16 segment; + struct idt_bits bits; + u16 offset_middle; + u32 offset_high; + u32 reserved; +}; + +typedef struct gate_struct gate_desc; + +struct desc_ptr { + short unsigned int size; + long unsigned int address; +} __attribute__((packed)); + +typedef long unsigned int pteval_t; + +typedef long unsigned int pmdval_t; + +typedef long unsigned int pudval_t; + +typedef long unsigned int p4dval_t; + +typedef long unsigned int pgdval_t; + +typedef long unsigned int pgprotval_t; + +typedef struct { + pteval_t pte; +} pte_t; + +struct pgprot { + pgprotval_t pgprot; +}; + +typedef struct pgprot pgprot_t; + +typedef struct { + pgdval_t pgd; +} pgd_t; + +typedef struct { + p4dval_t p4d; +} p4d_t; + +typedef struct { + pudval_t pud; +} pud_t; + +typedef struct { + pmdval_t pmd; +} pmd_t; + +typedef struct page *pgtable_t; + +struct address_space; + +struct kmem_cache; + +struct dev_pagemap; + +struct page { + long unsigned int flags; + union { + struct { + struct list_head lru; + struct address_space *mapping; + long unsigned int index; + long unsigned int private; + }; + struct { + dma_addr_t dma_addr; + }; + struct { + union { + struct list_head slab_list; + struct { + struct page *next; + int pages; + int pobjects; + }; + }; + struct kmem_cache *slab_cache; + void *freelist; + union { + void *s_mem; + long unsigned int counters; + struct { + unsigned int inuse: 16; + unsigned int objects: 15; + unsigned int frozen: 1; + }; + }; + }; + struct { + long unsigned int compound_head; + unsigned char compound_dtor; + unsigned char compound_order; + atomic_t compound_mapcount; + unsigned int compound_nr; + }; + struct { + long unsigned int _compound_pad_1; + atomic_t hpage_pinned_refcount; + struct list_head deferred_list; + }; + struct { + long unsigned int _pt_pad_1; + pgtable_t pmd_huge_pte; + long unsigned int _pt_pad_2; + union { + struct mm_struct *pt_mm; + atomic_t pt_frag_refcount; + }; + spinlock_t ptl; + }; + struct { + struct dev_pagemap *pgmap; + void *zone_device_data; + }; + struct callback_head callback_head; + }; + union { + atomic_t _mapcount; + unsigned int page_type; + unsigned int active; + int units; + }; + atomic_t _refcount; + long unsigned int memcg_data; +}; + +struct paravirt_callee_save { + void *func; +}; + +struct pv_init_ops { + unsigned int (*patch)(u8, void *, long unsigned int, unsigned int); +}; + +struct pv_lazy_ops { + void (*enter)(); + void (*leave)(); + void (*flush)(); +}; + +struct pv_time_ops { + long long unsigned int (*sched_clock)(); + long long unsigned int (*steal_clock)(int); +}; + +struct pv_cpu_ops { + void (*io_delay)(); + long unsigned int (*get_debugreg)(int); + void (*set_debugreg)(int, long unsigned int); + long unsigned int (*read_cr0)(); + void (*write_cr0)(long unsigned int); + void (*write_cr4)(long unsigned int); + void (*load_tr_desc)(); + void (*load_gdt)(const struct desc_ptr *); + void (*load_idt)(const struct desc_ptr *); + void (*set_ldt)(const void *, unsigned int); + long unsigned int (*store_tr)(); + void (*load_tls)(struct thread_struct *, unsigned int); + void (*load_gs_index)(unsigned int); + void (*write_ldt_entry)(struct desc_struct *, int, const void *); + void (*write_gdt_entry)(struct desc_struct *, int, const void *, int); + void (*write_idt_entry)(gate_desc *, int, const gate_desc *); + void (*alloc_ldt)(struct desc_struct *, unsigned int); + void (*free_ldt)(struct desc_struct *, unsigned int); + void (*load_sp0)(long unsigned int); + void (*invalidate_io_bitmap)(); + void (*update_io_bitmap)(); + void (*wbinvd)(); + void (*cpuid)(unsigned int *, unsigned int *, unsigned int *, unsigned int *); + u64 (*read_msr)(unsigned int); + void (*write_msr)(unsigned int, unsigned int, unsigned int); + u64 (*read_msr_safe)(unsigned int, int *); + int (*write_msr_safe)(unsigned int, unsigned int, unsigned int); + u64 (*read_pmc)(int); + void (*usergs_sysret64)(); + void (*iret)(); + void (*swapgs)(); + void (*start_context_switch)(struct task_struct *); + void (*end_context_switch)(struct task_struct *); +}; + +struct pv_irq_ops { + struct paravirt_callee_save save_fl; + struct paravirt_callee_save restore_fl; + struct paravirt_callee_save irq_disable; + struct paravirt_callee_save irq_enable; + void (*safe_halt)(); + void (*halt)(); +}; + +struct flush_tlb_info; + +struct mmu_gather; + +struct pv_mmu_ops { + void (*flush_tlb_user)(); + void (*flush_tlb_kernel)(); + void (*flush_tlb_one_user)(long unsigned int); + void (*flush_tlb_others)(const struct cpumask *, const struct flush_tlb_info *); + void (*tlb_remove_table)(struct mmu_gather *, void *); + void (*exit_mmap)(struct mm_struct *); + struct paravirt_callee_save read_cr2; + void (*write_cr2)(long unsigned int); + long unsigned int (*read_cr3)(); + void (*write_cr3)(long unsigned int); + void (*activate_mm)(struct mm_struct *, struct mm_struct *); + void (*dup_mmap)(struct mm_struct *, struct mm_struct *); + int (*pgd_alloc)(struct mm_struct *); + void (*pgd_free)(struct mm_struct *, pgd_t *); + void (*alloc_pte)(struct mm_struct *, long unsigned int); + void (*alloc_pmd)(struct mm_struct *, long unsigned int); + void (*alloc_pud)(struct mm_struct *, long unsigned int); + void (*alloc_p4d)(struct mm_struct *, long unsigned int); + void (*release_pte)(long unsigned int); + void (*release_pmd)(long unsigned int); + void (*release_pud)(long unsigned int); + void (*release_p4d)(long unsigned int); + void (*set_pte)(pte_t *, pte_t); + void (*set_pmd)(pmd_t *, pmd_t); + pte_t (*ptep_modify_prot_start)(struct vm_area_struct *, long unsigned int, pte_t *); + void (*ptep_modify_prot_commit)(struct vm_area_struct *, long unsigned int, pte_t *, pte_t); + struct paravirt_callee_save pte_val; + struct paravirt_callee_save make_pte; + struct paravirt_callee_save pgd_val; + struct paravirt_callee_save make_pgd; + void (*set_pud)(pud_t *, pud_t); + struct paravirt_callee_save pmd_val; + struct paravirt_callee_save make_pmd; + struct paravirt_callee_save pud_val; + struct paravirt_callee_save make_pud; + void (*set_p4d)(p4d_t *, p4d_t); + struct paravirt_callee_save p4d_val; + struct paravirt_callee_save make_p4d; + void (*set_pgd)(pgd_t *, pgd_t); + struct pv_lazy_ops lazy_mode; + void (*set_fixmap)(unsigned int, phys_addr_t, pgprot_t); +}; + +struct flush_tlb_info { + struct mm_struct *mm; + long unsigned int start; + long unsigned int end; + u64 new_tlb_gen; + unsigned int stride_shift; + bool freed_tables; +}; + +struct rw_semaphore { + atomic_long_t count; + atomic_long_t owner; + struct optimistic_spin_queue osq; + raw_spinlock_t wait_lock; + struct list_head wait_list; +}; + +struct mm_rss_stat { + atomic_long_t count[4]; +}; + +struct ldt_struct; + +struct vdso_image; + +typedef struct { + u64 ctx_id; + atomic64_t tlb_gen; + struct rw_semaphore ldt_usr_sem; + struct ldt_struct *ldt; + short unsigned int flags; + struct mutex lock; + void *vdso; + const struct vdso_image *vdso_image; + atomic_t perf_rdpmc_allowed; + u16 pkey_allocation_map; + s16 execute_only_pkey; +} mm_context_t; + +struct xol_area; + +struct uprobes_state { + struct xol_area *xol_area; +}; + +struct work_struct; + +typedef void (*work_func_t)(struct work_struct *); + +struct work_struct { + atomic_long_t data; + struct list_head entry; + work_func_t func; +}; + +struct linux_binfmt; + +struct core_state; + +struct kioctx_table; + +struct user_namespace; + +struct mmu_notifier_subscriptions; + +struct mm_struct { + struct { + struct vm_area_struct *mmap; + struct rb_root mm_rb; + u64 vmacache_seqnum; + long unsigned int (*get_unmapped_area)(struct file *, long unsigned int, long unsigned int, long unsigned int, long unsigned int); + long unsigned int mmap_base; + long unsigned int mmap_legacy_base; + long unsigned int mmap_compat_base; + long unsigned int mmap_compat_legacy_base; + long unsigned int task_size; + long unsigned int highest_vm_end; + pgd_t *pgd; + atomic_t membarrier_state; + atomic_t mm_users; + atomic_t mm_count; + atomic_t has_pinned; + seqcount_t write_protect_seq; + atomic_long_t pgtables_bytes; + int map_count; + spinlock_t page_table_lock; + struct rw_semaphore mmap_lock; + struct list_head mmlist; + long unsigned int hiwater_rss; + long unsigned int hiwater_vm; + long unsigned int total_vm; + long unsigned int locked_vm; + atomic64_t pinned_vm; + long unsigned int data_vm; + long unsigned int exec_vm; + long unsigned int stack_vm; + long unsigned int def_flags; + spinlock_t arg_lock; + long unsigned int start_code; + long unsigned int end_code; + long unsigned int start_data; + long unsigned int end_data; + long unsigned int start_brk; + long unsigned int brk; + long unsigned int start_stack; + long unsigned int arg_start; + long unsigned int arg_end; + long unsigned int env_start; + long unsigned int env_end; + long unsigned int saved_auxv[46]; + struct mm_rss_stat rss_stat; + struct linux_binfmt *binfmt; + mm_context_t context; + long unsigned int flags; + struct core_state *core_state; + spinlock_t ioctx_lock; + struct kioctx_table *ioctx_table; + struct task_struct *owner; + struct user_namespace *user_ns; + struct file *exe_file; + struct mmu_notifier_subscriptions *notifier_subscriptions; + long unsigned int numa_next_scan; + long unsigned int numa_scan_offset; + int numa_scan_seq; + atomic_t tlb_flush_pending; + bool tlb_flush_batched; + struct uprobes_state uprobes_state; + atomic_long_t hugetlb_usage; + struct work_struct async_put_work; + u32 pasid; + }; + long unsigned int cpu_bitmap[0]; +}; + +struct userfaultfd_ctx; + +struct vm_userfaultfd_ctx { + struct userfaultfd_ctx *ctx; +}; + +struct anon_vma; + +struct vm_operations_struct; + +struct vm_area_struct { + long unsigned int vm_start; + long unsigned int vm_end; + struct vm_area_struct *vm_next; + struct vm_area_struct *vm_prev; + struct rb_node vm_rb; + long unsigned int rb_subtree_gap; + struct mm_struct *vm_mm; + pgprot_t vm_page_prot; + long unsigned int vm_flags; + struct { + struct rb_node rb; + long unsigned int rb_subtree_last; + } shared; + struct list_head anon_vma_chain; + struct anon_vma *anon_vma; + const struct vm_operations_struct *vm_ops; + long unsigned int vm_pgoff; + struct file *vm_file; + void *vm_private_data; + atomic_long_t swap_readahead_info; + struct mempolicy *vm_policy; + struct vm_userfaultfd_ctx vm_userfaultfd_ctx; +}; + +struct pv_lock_ops { + void (*queued_spin_lock_slowpath)(struct qspinlock *, u32); + struct paravirt_callee_save queued_spin_unlock; + void (*wait)(u8 *, u8); + void (*kick)(int); + struct paravirt_callee_save vcpu_is_preempted; +}; + +struct paravirt_patch_template { + struct pv_init_ops init; + struct pv_time_ops time; + struct pv_cpu_ops cpu; + struct pv_irq_ops irq; + struct pv_mmu_ops mmu; + struct pv_lock_ops lock; +}; + +struct math_emu_info { + long int ___orig_eip; + struct pt_regs *regs; +}; + +enum { + UNAME26 = 131072, + ADDR_NO_RANDOMIZE = 262144, + FDPIC_FUNCPTRS = 524288, + MMAP_PAGE_ZERO = 1048576, + ADDR_COMPAT_LAYOUT = 2097152, + READ_IMPLIES_EXEC = 4194304, + ADDR_LIMIT_32BIT = 8388608, + SHORT_INODE = 16777216, + WHOLE_SECONDS = 33554432, + STICKY_TIMEOUTS = 67108864, + ADDR_LIMIT_3GB = 134217728, +}; + +enum tlb_infos { + ENTRIES = 0, + NR_INFO = 1, +}; + +enum pcpu_fc { + PCPU_FC_AUTO = 0, + PCPU_FC_EMBED = 1, + PCPU_FC_PAGE = 2, + PCPU_FC_NR = 3, +}; + +struct vm_struct { + struct vm_struct *next; + void *addr; + long unsigned int size; + long unsigned int flags; + struct page **pages; + unsigned int nr_pages; + phys_addr_t phys_addr; + const void *caller; +}; + +struct wait_queue_head { + spinlock_t lock; + struct list_head head; +}; + +typedef struct wait_queue_head wait_queue_head_t; + +struct seqcount_raw_spinlock { + seqcount_t seqcount; +}; + +typedef struct seqcount_raw_spinlock seqcount_raw_spinlock_t; + +typedef struct { + seqcount_spinlock_t seqcount; + spinlock_t lock; +} seqlock_t; + +enum node_states { + N_POSSIBLE = 0, + N_ONLINE = 1, + N_NORMAL_MEMORY = 2, + N_HIGH_MEMORY = 2, + N_MEMORY = 3, + N_CPU = 4, + N_GENERIC_INITIATOR = 5, + NR_NODE_STATES = 6, +}; + +enum { + MM_FILEPAGES = 0, + MM_ANONPAGES = 1, + MM_SWAPENTS = 2, + MM_SHMEMPAGES = 3, + NR_MM_COUNTERS = 4, +}; + +struct swait_queue_head { + raw_spinlock_t lock; + struct list_head task_list; +}; + +struct completion { + unsigned int done; + struct swait_queue_head wait; +}; + +struct arch_uprobe_task { + long unsigned int saved_scratch_register; + unsigned int saved_trap_nr; + unsigned int saved_tf; +}; + +enum uprobe_task_state { + UTASK_RUNNING = 0, + UTASK_SSTEP = 1, + UTASK_SSTEP_ACK = 2, + UTASK_SSTEP_TRAPPED = 3, +}; + +struct uprobe; + +struct return_instance; + +struct uprobe_task { + enum uprobe_task_state state; + union { + struct { + struct arch_uprobe_task autask; + long unsigned int vaddr; + }; + struct { + struct callback_head dup_xol_work; + long unsigned int dup_xol_addr; + }; + }; + struct uprobe *active_uprobe; + long unsigned int xol_vaddr; + struct return_instance *return_instances; + unsigned int depth; +}; + +struct return_instance { + struct uprobe *uprobe; + long unsigned int func; + long unsigned int stack; + long unsigned int orig_ret_vaddr; + bool chained; + struct return_instance *next; +}; + +struct vdso_image { + void *data; + long unsigned int size; + long unsigned int alt; + long unsigned int alt_len; + long unsigned int extable_base; + long unsigned int extable_len; + const void *extable; + long int sym_vvar_start; + long int sym_vvar_page; + long int sym_pvclock_page; + long int sym_hvclock_page; + long int sym_timens_page; + long int sym_VDSO32_NOTE_MASK; + long int sym___kernel_sigreturn; + long int sym___kernel_rt_sigreturn; + long int sym___kernel_vsyscall; + long int sym_int80_landing_pad; + long int sym_vdso32_sigreturn_landing_pad; + long int sym_vdso32_rt_sigreturn_landing_pad; +}; + +struct xarray { + spinlock_t xa_lock; + gfp_t xa_flags; + void *xa_head; +}; + +typedef u32 errseq_t; + +struct address_space_operations; + +struct address_space { + struct inode *host; + struct xarray i_pages; + gfp_t gfp_mask; + atomic_t i_mmap_writable; + struct rb_root_cached i_mmap; + struct rw_semaphore i_mmap_rwsem; + long unsigned int nrpages; + long unsigned int nrexceptional; + long unsigned int writeback_index; + const struct address_space_operations *a_ops; + long unsigned int flags; + errseq_t wb_err; + spinlock_t private_lock; + struct list_head private_list; + void *private_data; +}; + +struct vmem_altmap { + const long unsigned int base_pfn; + const long unsigned int end_pfn; + const long unsigned int reserve; + long unsigned int free; + long unsigned int align; + long unsigned int alloc; +}; + +struct percpu_ref_data; + +struct percpu_ref { + long unsigned int percpu_count_ptr; + struct percpu_ref_data *data; +}; + +enum memory_type { + MEMORY_DEVICE_PRIVATE = 1, + MEMORY_DEVICE_FS_DAX = 2, + MEMORY_DEVICE_GENERIC = 3, + MEMORY_DEVICE_PCI_P2PDMA = 4, +}; + +struct dev_pagemap_ops; + +struct dev_pagemap { + struct vmem_altmap altmap; + struct percpu_ref *ref; + struct percpu_ref internal_ref; + struct completion done; + enum memory_type type; + unsigned int flags; + const struct dev_pagemap_ops *ops; + void *owner; + int nr_range; + union { + struct range range; + struct range ranges[0]; + }; +}; + +struct vfsmount; + +struct path { + struct vfsmount *mnt; + struct dentry *dentry; +}; + +enum rw_hint { + WRITE_LIFE_NOT_SET = 0, + WRITE_LIFE_NONE = 1, + WRITE_LIFE_SHORT = 2, + WRITE_LIFE_MEDIUM = 3, + WRITE_LIFE_LONG = 4, + WRITE_LIFE_EXTREME = 5, +}; + +enum pid_type { + PIDTYPE_PID = 0, + PIDTYPE_TGID = 1, + PIDTYPE_PGID = 2, + PIDTYPE_SID = 3, + PIDTYPE_MAX = 4, +}; + +struct fown_struct { + rwlock_t lock; + struct pid *pid; + enum pid_type pid_type; + kuid_t uid; + kuid_t euid; + int signum; +}; + +struct file_ra_state { + long unsigned int start; + unsigned int size; + unsigned int async_size; + unsigned int ra_pages; + unsigned int mmap_miss; + loff_t prev_pos; +}; + +struct file { + union { + struct llist_node fu_llist; + struct callback_head fu_rcuhead; + } f_u; + struct path f_path; + struct inode *f_inode; + const struct file_operations *f_op; + spinlock_t f_lock; + enum rw_hint f_write_hint; + atomic_long_t f_count; + unsigned int f_flags; + fmode_t f_mode; + struct mutex f_pos_lock; + loff_t f_pos; + struct fown_struct f_owner; + const struct cred *f_cred; + struct file_ra_state f_ra; + u64 f_version; + void *f_security; + void *private_data; + struct hlist_head *f_ep; + struct address_space *f_mapping; + errseq_t f_wb_err; + errseq_t f_sb_err; +}; + +typedef unsigned int vm_fault_t; + +enum page_entry_size { + PE_SIZE_PTE = 0, + PE_SIZE_PMD = 1, + PE_SIZE_PUD = 2, +}; + +struct vm_fault; + +struct vm_operations_struct { + void (*open)(struct vm_area_struct *); + void (*close)(struct vm_area_struct *); + int (*may_split)(struct vm_area_struct *, long unsigned int); + int (*mremap)(struct vm_area_struct *, long unsigned int); + int (*mprotect)(struct vm_area_struct *, long unsigned int, long unsigned int, long unsigned int); + vm_fault_t (*fault)(struct vm_fault *); + vm_fault_t (*huge_fault)(struct vm_fault *, enum page_entry_size); + void (*map_pages)(struct vm_fault *, long unsigned int, long unsigned int); + long unsigned int (*pagesize)(struct vm_area_struct *); + vm_fault_t (*page_mkwrite)(struct vm_fault *); + vm_fault_t (*pfn_mkwrite)(struct vm_fault *); + int (*access)(struct vm_area_struct *, long unsigned int, void *, int, int); + const char * (*name)(struct vm_area_struct *); + int (*set_policy)(struct vm_area_struct *, struct mempolicy *); + struct mempolicy * (*get_policy)(struct vm_area_struct *, long unsigned int); + struct page * (*find_special_page)(struct vm_area_struct *, long unsigned int); +}; + +struct core_thread { + struct task_struct *task; + struct core_thread *next; +}; + +struct core_state { + atomic_t nr_threads; + struct core_thread dumper; + struct completion startup; +}; + +struct vm_fault { + struct vm_area_struct *vma; + unsigned int flags; + gfp_t gfp_mask; + long unsigned int pgoff; + long unsigned int address; + pmd_t *pmd; + pud_t *pud; + pte_t orig_pte; + struct page *cow_page; + struct page *page; + pte_t *pte; + spinlock_t *ptl; + pgtable_t prealloc_pte; +}; + +enum migratetype { + MIGRATE_UNMOVABLE = 0, + MIGRATE_MOVABLE = 1, + MIGRATE_RECLAIMABLE = 2, + MIGRATE_PCPTYPES = 3, + MIGRATE_HIGHATOMIC = 3, + MIGRATE_CMA = 4, + MIGRATE_ISOLATE = 5, + MIGRATE_TYPES = 6, +}; + +enum numa_stat_item { + NUMA_HIT = 0, + NUMA_MISS = 1, + NUMA_FOREIGN = 2, + NUMA_INTERLEAVE_HIT = 3, + NUMA_LOCAL = 4, + NUMA_OTHER = 5, + NR_VM_NUMA_STAT_ITEMS = 6, +}; + +enum zone_stat_item { + NR_FREE_PAGES = 0, + NR_ZONE_LRU_BASE = 1, + NR_ZONE_INACTIVE_ANON = 1, + NR_ZONE_ACTIVE_ANON = 2, + NR_ZONE_INACTIVE_FILE = 3, + NR_ZONE_ACTIVE_FILE = 4, + NR_ZONE_UNEVICTABLE = 5, + NR_ZONE_WRITE_PENDING = 6, + NR_MLOCK = 7, + NR_BOUNCE = 8, + NR_ZSPAGES = 9, + NR_FREE_CMA_PAGES = 10, + NR_VM_ZONE_STAT_ITEMS = 11, +}; + +enum node_stat_item { + NR_LRU_BASE = 0, + NR_INACTIVE_ANON = 0, + NR_ACTIVE_ANON = 1, + NR_INACTIVE_FILE = 2, + NR_ACTIVE_FILE = 3, + NR_UNEVICTABLE = 4, + NR_SLAB_RECLAIMABLE_B = 5, + NR_SLAB_UNRECLAIMABLE_B = 6, + NR_ISOLATED_ANON = 7, + NR_ISOLATED_FILE = 8, + WORKINGSET_NODES = 9, + WORKINGSET_REFAULT_BASE = 10, + WORKINGSET_REFAULT_ANON = 10, + WORKINGSET_REFAULT_FILE = 11, + WORKINGSET_ACTIVATE_BASE = 12, + WORKINGSET_ACTIVATE_ANON = 12, + WORKINGSET_ACTIVATE_FILE = 13, + WORKINGSET_RESTORE_BASE = 14, + WORKINGSET_RESTORE_ANON = 14, + WORKINGSET_RESTORE_FILE = 15, + WORKINGSET_NODERECLAIM = 16, + NR_ANON_MAPPED = 17, + NR_FILE_MAPPED = 18, + NR_FILE_PAGES = 19, + NR_FILE_DIRTY = 20, + NR_WRITEBACK = 21, + NR_WRITEBACK_TEMP = 22, + NR_SHMEM = 23, + NR_SHMEM_THPS = 24, + NR_SHMEM_PMDMAPPED = 25, + NR_FILE_THPS = 26, + NR_FILE_PMDMAPPED = 27, + NR_ANON_THPS = 28, + NR_VMSCAN_WRITE = 29, + NR_VMSCAN_IMMEDIATE = 30, + NR_DIRTIED = 31, + NR_WRITTEN = 32, + NR_KERNEL_MISC_RECLAIMABLE = 33, + NR_FOLL_PIN_ACQUIRED = 34, + NR_FOLL_PIN_RELEASED = 35, + NR_KERNEL_STACK_KB = 36, + NR_PAGETABLE = 37, + NR_VM_NODE_STAT_ITEMS = 38, +}; + +enum lru_list { + LRU_INACTIVE_ANON = 0, + LRU_ACTIVE_ANON = 1, + LRU_INACTIVE_FILE = 2, + LRU_ACTIVE_FILE = 3, + LRU_UNEVICTABLE = 4, + NR_LRU_LISTS = 5, +}; + +typedef unsigned int isolate_mode_t; + +enum zone_watermarks { + WMARK_MIN = 0, + WMARK_LOW = 1, + WMARK_HIGH = 2, + NR_WMARK = 3, +}; + +enum { + ZONELIST_FALLBACK = 0, + ZONELIST_NOFALLBACK = 1, + MAX_ZONELISTS = 2, +}; + +typedef void percpu_ref_func_t(struct percpu_ref *); + +struct percpu_ref_data { + atomic_long_t count; + percpu_ref_func_t *release; + percpu_ref_func_t *confirm_switch; + bool force_atomic: 1; + bool allow_reinit: 1; + struct callback_head rcu; + struct percpu_ref *ref; +}; + +struct shrink_control { + gfp_t gfp_mask; + int nid; + long unsigned int nr_to_scan; + long unsigned int nr_scanned; + struct mem_cgroup *memcg; +}; + +struct shrinker { + long unsigned int (*count_objects)(struct shrinker *, struct shrink_control *); + long unsigned int (*scan_objects)(struct shrinker *, struct shrink_control *); + long int batch; + int seeks; + unsigned int flags; + struct list_head list; + int id; + atomic_long_t *nr_deferred; +}; + +struct rlimit { + __kernel_ulong_t rlim_cur; + __kernel_ulong_t rlim_max; +}; + +struct dev_pagemap_ops { + void (*page_free)(struct page *); + void (*kill)(struct dev_pagemap *); + void (*cleanup)(struct dev_pagemap *); + vm_fault_t (*migrate_to_ram)(struct vm_fault *); +}; + +struct pid_namespace; + +struct upid { + int nr; + struct pid_namespace *ns; +}; + +struct pid { + refcount_t count; + unsigned int level; + spinlock_t lock; + struct hlist_head tasks[4]; + struct hlist_head inodes; + wait_queue_head_t wait_pidfd; + struct callback_head rcu; + struct upid numbers[1]; +}; + +typedef struct { + gid_t val; +} kgid_t; + +struct hrtimer_cpu_base; + +struct hrtimer_clock_base { + struct hrtimer_cpu_base *cpu_base; + unsigned int index; + clockid_t clockid; + seqcount_raw_spinlock_t seq; + struct hrtimer *running; + struct timerqueue_head active; + ktime_t (*get_time)(); + ktime_t offset; +}; + +struct hrtimer_cpu_base { + raw_spinlock_t lock; + unsigned int cpu; + unsigned int active_bases; + unsigned int clock_was_set_seq; + unsigned int hres_active: 1; + unsigned int in_hrtirq: 1; + unsigned int hang_detected: 1; + unsigned int softirq_activated: 1; + unsigned int nr_events; + short unsigned int nr_retries; + short unsigned int nr_hangs; + unsigned int max_hang_time; + ktime_t expires_next; + struct hrtimer *next_timer; + ktime_t softirq_expires_next; + struct hrtimer *softirq_next_timer; + struct hrtimer_clock_base clock_base[8]; +}; + +enum hrtimer_base_type { + HRTIMER_BASE_MONOTONIC = 0, + HRTIMER_BASE_REALTIME = 1, + HRTIMER_BASE_BOOTTIME = 2, + HRTIMER_BASE_TAI = 3, + HRTIMER_BASE_MONOTONIC_SOFT = 4, + HRTIMER_BASE_REALTIME_SOFT = 5, + HRTIMER_BASE_BOOTTIME_SOFT = 6, + HRTIMER_BASE_TAI_SOFT = 7, + HRTIMER_MAX_CLOCK_BASES = 8, +}; + +typedef void __signalfn_t(int); + +typedef __signalfn_t *__sighandler_t; + +typedef void __restorefn_t(); + +typedef __restorefn_t *__sigrestore_t; + +union sigval { + int sival_int; + void *sival_ptr; +}; + +typedef union sigval sigval_t; + +union __sifields { + struct { + __kernel_pid_t _pid; + __kernel_uid32_t _uid; + } _kill; + struct { + __kernel_timer_t _tid; + int _overrun; + sigval_t _sigval; + int _sys_private; + } _timer; + struct { + __kernel_pid_t _pid; + __kernel_uid32_t _uid; + sigval_t _sigval; + } _rt; + struct { + __kernel_pid_t _pid; + __kernel_uid32_t _uid; + int _status; + __kernel_clock_t _utime; + __kernel_clock_t _stime; + } _sigchld; + struct { + void *_addr; + union { + short int _addr_lsb; + struct { + char _dummy_bnd[8]; + void *_lower; + void *_upper; + } _addr_bnd; + struct { + char _dummy_pkey[8]; + __u32 _pkey; + } _addr_pkey; + }; + } _sigfault; + struct { + long int _band; + int _fd; + } _sigpoll; + struct { + void *_call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; +}; + +struct kernel_siginfo { + struct { + int si_signo; + int si_errno; + int si_code; + union __sifields _sifields; + }; +}; + +struct user_struct { + refcount_t __count; + atomic_t processes; + atomic_t sigpending; + atomic_t fanotify_listeners; + atomic_long_t epoll_watches; + long unsigned int mq_bytes; + long unsigned int locked_shm; + long unsigned int unix_inflight; + atomic_long_t pipe_bufs; + struct hlist_node uidhash_node; + kuid_t uid; + atomic_long_t locked_vm; + atomic_t nr_watches; + struct ratelimit_state ratelimit; +}; + +struct sigaction { + __sighandler_t sa_handler; + long unsigned int sa_flags; + __sigrestore_t sa_restorer; + sigset_t sa_mask; +}; + +struct k_sigaction { + struct sigaction sa; +}; + +struct cpu_itimer { + u64 expires; + u64 incr; +}; + +struct task_cputime_atomic { + atomic64_t utime; + atomic64_t stime; + atomic64_t sum_exec_runtime; +}; + +struct thread_group_cputimer { + struct task_cputime_atomic cputime_atomic; +}; + +struct pacct_struct { + int ac_flag; + long int ac_exitcode; + long unsigned int ac_mem; + u64 ac_utime; + u64 ac_stime; + long unsigned int ac_minflt; + long unsigned int ac_majflt; +}; + +struct tty_struct; + +struct autogroup; + +struct taskstats; + +struct tty_audit_buf; + +struct signal_struct { + refcount_t sigcnt; + atomic_t live; + int nr_threads; + struct list_head thread_head; + wait_queue_head_t wait_chldexit; + struct task_struct *curr_target; + struct sigpending shared_pending; + struct hlist_head multiprocess; + int group_exit_code; + int notify_count; + struct task_struct *group_exit_task; + int group_stop_count; + unsigned int flags; + unsigned int is_child_subreaper: 1; + unsigned int has_child_subreaper: 1; + int posix_timer_id; + struct list_head posix_timers; + struct hrtimer real_timer; + ktime_t it_real_incr; + struct cpu_itimer it[2]; + struct thread_group_cputimer cputimer; + struct posix_cputimers posix_cputimers; + struct pid *pids[4]; + atomic_t tick_dep_mask; + struct pid *tty_old_pgrp; + int leader; + struct tty_struct *tty; + struct autogroup *autogroup; + seqlock_t stats_lock; + u64 utime; + u64 stime; + u64 cutime; + u64 cstime; + u64 gtime; + u64 cgtime; + struct prev_cputime prev_cputime; + long unsigned int nvcsw; + long unsigned int nivcsw; + long unsigned int cnvcsw; + long unsigned int cnivcsw; + long unsigned int min_flt; + long unsigned int maj_flt; + long unsigned int cmin_flt; + long unsigned int cmaj_flt; + long unsigned int inblock; + long unsigned int oublock; + long unsigned int cinblock; + long unsigned int coublock; + long unsigned int maxrss; + long unsigned int cmaxrss; + struct task_io_accounting ioac; + long long unsigned int sum_sched_runtime; + struct rlimit rlim[16]; + struct pacct_struct pacct; + struct taskstats *stats; + unsigned int audit_tty; + struct tty_audit_buf *tty_audit_buf; + bool oom_flag_origin; + short int oom_score_adj; + short int oom_score_adj_min; + struct mm_struct *oom_mm; + struct mutex cred_guard_mutex; + struct rw_semaphore exec_update_lock; +}; + +enum rseq_cs_flags_bit { + RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT_BIT = 0, + RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL_BIT = 1, + RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT = 2, +}; + +struct rseq { + __u32 cpu_id_start; + __u32 cpu_id; + union { + __u64 ptr64; + __u64 ptr; + } rseq_cs; + __u32 flags; + long: 32; + long: 64; +}; + +enum perf_event_task_context { + perf_invalid_context = 4294967295, + perf_hw_context = 0, + perf_sw_context = 1, + perf_nr_task_contexts = 2, +}; + +struct rq; + +struct rq_flags; + +struct sched_class { + void (*enqueue_task)(struct rq *, struct task_struct *, int); + void (*dequeue_task)(struct rq *, struct task_struct *, int); + void (*yield_task)(struct rq *); + bool (*yield_to_task)(struct rq *, struct task_struct *); + void (*check_preempt_curr)(struct rq *, struct task_struct *, int); + struct task_struct * (*pick_next_task)(struct rq *); + void (*put_prev_task)(struct rq *, struct task_struct *); + void (*set_next_task)(struct rq *, struct task_struct *, bool); + int (*balance)(struct rq *, struct task_struct *, struct rq_flags *); + int (*select_task_rq)(struct task_struct *, int, int); + void (*migrate_task_rq)(struct task_struct *, int); + void (*task_woken)(struct rq *, struct task_struct *); + void (*set_cpus_allowed)(struct task_struct *, const struct cpumask *, u32); + void (*rq_online)(struct rq *); + void (*rq_offline)(struct rq *); + struct rq * (*find_lock_rq)(struct task_struct *, struct rq *); + void (*task_tick)(struct rq *, struct task_struct *, int); + void (*task_fork)(struct task_struct *); + void (*task_dead)(struct task_struct *); + void (*switched_from)(struct rq *, struct task_struct *); + void (*switched_to)(struct rq *, struct task_struct *); + void (*prio_changed)(struct rq *, struct task_struct *, int); + unsigned int (*get_rr_interval)(struct rq *, struct task_struct *); + void (*update_curr)(struct rq *); + void (*task_change_group)(struct task_struct *, int); +}; + +struct kernel_cap_struct { + __u32 cap[2]; +}; + +typedef struct kernel_cap_struct kernel_cap_t; + +struct group_info; + +struct cred { + atomic_t usage; + kuid_t uid; + kgid_t gid; + kuid_t suid; + kgid_t sgid; + kuid_t euid; + kgid_t egid; + kuid_t fsuid; + kgid_t fsgid; + unsigned int securebits; + kernel_cap_t cap_inheritable; + kernel_cap_t cap_permitted; + kernel_cap_t cap_effective; + kernel_cap_t cap_bset; + kernel_cap_t cap_ambient; + unsigned char jit_keyring; + struct key *session_keyring; + struct key *process_keyring; + struct key *thread_keyring; + struct key *request_key_auth; + void *security; + struct user_struct *user; + struct user_namespace *user_ns; + struct group_info *group_info; + union { + int non_rcu; + struct callback_head rcu; + }; +}; + +typedef int32_t key_serial_t; + +typedef uint32_t key_perm_t; + +struct key_type; + +struct key_tag; + +struct keyring_index_key { + long unsigned int hash; + union { + struct { + u16 desc_len; + char desc[6]; + }; + long unsigned int x; + }; + struct key_type *type; + struct key_tag *domain_tag; + const char *description; +}; + +union key_payload { + void *rcu_data0; + void *data[4]; +}; + +struct assoc_array_ptr; + +struct assoc_array { + struct assoc_array_ptr *root; + long unsigned int nr_leaves_on_tree; +}; + +struct watch_list; + +struct key_user; + +struct key_restriction; + +struct key { + refcount_t usage; + key_serial_t serial; + union { + struct list_head graveyard_link; + struct rb_node serial_node; + }; + struct watch_list *watchers; + struct rw_semaphore sem; + struct key_user *user; + void *security; + union { + time64_t expiry; + time64_t revoked_at; + }; + time64_t last_used_at; + kuid_t uid; + kgid_t gid; + key_perm_t perm; + short unsigned int quotalen; + short unsigned int datalen; + short int state; + long unsigned int flags; + union { + struct keyring_index_key index_key; + struct { + long unsigned int hash; + long unsigned int len_desc; + struct key_type *type; + struct key_tag *domain_tag; + char *description; + }; + }; + union { + union key_payload payload; + struct { + struct list_head name_link; + struct assoc_array keys; + }; + }; + struct key_restriction *restrict_link; +}; + +struct sighand_struct { + spinlock_t siglock; + refcount_t count; + wait_queue_head_t signalfd_wqh; + struct k_sigaction action[64]; +}; + +struct io_cq; + +struct io_context { + atomic_long_t refcount; + atomic_t active_ref; + atomic_t nr_tasks; + spinlock_t lock; + short unsigned int ioprio; + struct xarray icq_tree; + struct io_cq *icq_hint; + struct hlist_head icq_list; + struct work_struct release_work; +}; + +enum rseq_event_mask_bits { + RSEQ_EVENT_PREEMPT_BIT = 0, + RSEQ_EVENT_SIGNAL_BIT = 1, + RSEQ_EVENT_MIGRATE_BIT = 2, +}; + +enum fixed_addresses { + VSYSCALL_PAGE = 511, + FIX_DBGP_BASE = 512, + FIX_EARLYCON_MEM_BASE = 513, + FIX_OHCI1394_BASE = 514, + FIX_APIC_BASE = 515, + FIX_IO_APIC_BASE_0 = 516, + FIX_IO_APIC_BASE_END = 643, + FIX_PARAVIRT_BOOTMAP = 644, + FIX_APEI_GHES_IRQ = 645, + FIX_APEI_GHES_NMI = 646, + __end_of_permanent_fixed_addresses = 647, + FIX_BTMAP_END = 1024, + FIX_BTMAP_BEGIN = 1535, + FIX_TBOOT_BASE = 1536, + __end_of_fixed_addresses = 1537, +}; + +struct hlist_bl_node; + +struct hlist_bl_head { + struct hlist_bl_node *first; +}; + +struct hlist_bl_node { + struct hlist_bl_node *next; + struct hlist_bl_node **pprev; +}; + +struct lockref { + union { + __u64 lock_count; + struct { + spinlock_t lock; + int count; + }; + }; +}; + +struct qstr { + union { + struct { + u32 hash; + u32 len; + }; + u64 hash_len; + }; + const unsigned char *name; +}; + +struct dentry_operations; + +struct dentry { + unsigned int d_flags; + seqcount_spinlock_t d_seq; + struct hlist_bl_node d_hash; + struct dentry *d_parent; + struct qstr d_name; + struct inode *d_inode; + unsigned char d_iname[32]; + struct lockref d_lockref; + const struct dentry_operations *d_op; + struct super_block *d_sb; + long unsigned int d_time; + void *d_fsdata; + union { + struct list_head d_lru; + wait_queue_head_t *d_wait; + }; + struct list_head d_child; + struct list_head d_subdirs; + union { + struct hlist_node d_alias; + struct hlist_bl_node d_in_lookup_hash; + struct callback_head d_rcu; + } d_u; +}; + +struct posix_acl; + +struct inode_operations; + +struct bdi_writeback; + +struct file_lock_context; + +struct cdev; + +struct fsnotify_mark_connector; + +struct fscrypt_info; + +struct fsverity_info; + +struct inode { + umode_t i_mode; + short unsigned int i_opflags; + kuid_t i_uid; + kgid_t i_gid; + unsigned int i_flags; + struct posix_acl *i_acl; + struct posix_acl *i_default_acl; + const struct inode_operations *i_op; + struct super_block *i_sb; + struct address_space *i_mapping; + void *i_security; + long unsigned int i_ino; + union { + const unsigned int i_nlink; + unsigned int __i_nlink; + }; + dev_t i_rdev; + loff_t i_size; + struct timespec64 i_atime; + struct timespec64 i_mtime; + struct timespec64 i_ctime; + spinlock_t i_lock; + short unsigned int i_bytes; + u8 i_blkbits; + u8 i_write_hint; + blkcnt_t i_blocks; + long unsigned int i_state; + struct rw_semaphore i_rwsem; + long unsigned int dirtied_when; + long unsigned int dirtied_time_when; + struct hlist_node i_hash; + struct list_head i_io_list; + struct bdi_writeback *i_wb; + int i_wb_frn_winner; + u16 i_wb_frn_avg_time; + u16 i_wb_frn_history; + struct list_head i_lru; + struct list_head i_sb_list; + struct list_head i_wb_list; + union { + struct hlist_head i_dentry; + struct callback_head i_rcu; + }; + atomic64_t i_version; + atomic64_t i_sequence; + atomic_t i_count; + atomic_t i_dio_count; + atomic_t i_writecount; + atomic_t i_readcount; + union { + const struct file_operations *i_fop; + void (*free_inode)(struct inode *); + }; + struct file_lock_context *i_flctx; + struct address_space i_data; + struct list_head i_devices; + union { + struct pipe_inode_info *i_pipe; + struct cdev *i_cdev; + char *i_link; + unsigned int i_dir_seq; + }; + __u32 i_generation; + __u32 i_fsnotify_mask; + struct fsnotify_mark_connector *i_fsnotify_marks; + struct fscrypt_info *i_crypt_info; + struct fsverity_info *i_verity_info; + void *i_private; +}; + +struct dentry_operations { + int (*d_revalidate)(struct dentry *, unsigned int); + int (*d_weak_revalidate)(struct dentry *, unsigned int); + int (*d_hash)(const struct dentry *, struct qstr *); + int (*d_compare)(const struct dentry *, unsigned int, const char *, const struct qstr *); + int (*d_delete)(const struct dentry *); + int (*d_init)(struct dentry *); + void (*d_release)(struct dentry *); + void (*d_prune)(struct dentry *); + void (*d_iput)(struct dentry *, struct inode *); + char * (*d_dname)(struct dentry *, char *, int); + struct vfsmount * (*d_automount)(struct path *); + int (*d_manage)(const struct path *, bool); + struct dentry * (*d_real)(struct dentry *, const struct inode *); + long: 64; + long: 64; + long: 64; +}; + +struct mtd_info; + +typedef long long int qsize_t; + +struct quota_format_type; + +struct mem_dqinfo { + struct quota_format_type *dqi_format; + int dqi_fmt_id; + struct list_head dqi_dirty_list; + long unsigned int dqi_flags; + unsigned int dqi_bgrace; + unsigned int dqi_igrace; + qsize_t dqi_max_spc_limit; + qsize_t dqi_max_ino_limit; + void *dqi_priv; +}; + +struct quota_format_ops; + +struct quota_info { + unsigned int flags; + struct rw_semaphore dqio_sem; + struct inode *files[3]; + struct mem_dqinfo info[3]; + const struct quota_format_ops *ops[3]; +}; + +struct rcu_sync { + int gp_state; + int gp_count; + wait_queue_head_t gp_wait; + struct callback_head cb_head; +}; + +struct rcuwait { + struct task_struct *task; +}; + +struct percpu_rw_semaphore { + struct rcu_sync rss; + unsigned int *read_count; + struct rcuwait writer; + wait_queue_head_t waiters; + atomic_t block; +}; + +struct sb_writers { + int frozen; + wait_queue_head_t wait_unfrozen; + struct percpu_rw_semaphore rw_sem[3]; +}; + +typedef struct { + __u8 b[16]; +} uuid_t; + +struct list_lru_node; + +struct list_lru { + struct list_lru_node *node; + struct list_head list; + int shrinker_id; + bool memcg_aware; +}; + +struct super_operations; + +struct dquot_operations; + +struct quotactl_ops; + +struct export_operations; + +struct xattr_handler; + +struct fscrypt_operations; + +struct fsverity_operations; + +struct unicode_map; + +struct block_device; + +struct workqueue_struct; + +struct super_block { + struct list_head s_list; + dev_t s_dev; + unsigned char s_blocksize_bits; + long unsigned int s_blocksize; + loff_t s_maxbytes; + struct file_system_type *s_type; + const struct super_operations *s_op; + const struct dquot_operations *dq_op; + const struct quotactl_ops *s_qcop; + const struct export_operations *s_export_op; + long unsigned int s_flags; + long unsigned int s_iflags; + long unsigned int s_magic; + struct dentry *s_root; + struct rw_semaphore s_umount; + int s_count; + atomic_t s_active; + void *s_security; + const struct xattr_handler **s_xattr; + const struct fscrypt_operations *s_cop; + struct key *s_master_keys; + const struct fsverity_operations *s_vop; + struct unicode_map *s_encoding; + __u16 s_encoding_flags; + struct hlist_bl_head s_roots; + struct list_head s_mounts; + struct block_device *s_bdev; + struct backing_dev_info *s_bdi; + struct mtd_info *s_mtd; + struct hlist_node s_instances; + unsigned int s_quota_types; + struct quota_info s_dquot; + struct sb_writers s_writers; + void *s_fs_info; + u32 s_time_gran; + time64_t s_time_min; + time64_t s_time_max; + __u32 s_fsnotify_mask; + struct fsnotify_mark_connector *s_fsnotify_marks; + char s_id[32]; + uuid_t s_uuid; + unsigned int s_max_links; + fmode_t s_mode; + struct mutex s_vfs_rename_mutex; + const char *s_subtype; + const struct dentry_operations *s_d_op; + int cleancache_poolid; + struct shrinker s_shrink; + atomic_long_t s_remove_count; + atomic_long_t s_fsnotify_inode_refs; + int s_readonly_remount; + errseq_t s_wb_err; + struct workqueue_struct *s_dio_done_wq; + struct hlist_head s_pins; + struct user_namespace *s_user_ns; + struct list_lru s_dentry_lru; + struct list_lru s_inode_lru; + struct callback_head rcu; + struct work_struct destroy_work; + struct mutex s_sync_lock; + int s_stack_depth; + int: 32; + spinlock_t s_inode_list_lock; + struct list_head s_inodes; + spinlock_t s_inode_wblist_lock; + struct list_head s_inodes_wb; + long: 64; + long: 64; +}; + +struct kstat { + u32 result_mask; + umode_t mode; + unsigned int nlink; + uint32_t blksize; + u64 attributes; + u64 attributes_mask; + u64 ino; + dev_t dev; + dev_t rdev; + kuid_t uid; + kgid_t gid; + loff_t size; + struct timespec64 atime; + struct timespec64 mtime; + struct timespec64 ctime; + struct timespec64 btime; + u64 blocks; + u64 mnt_id; +}; + +struct list_lru_one { + struct list_head list; + long int nr_items; +}; + +struct list_lru_memcg { + struct callback_head rcu; + struct list_lru_one *lru[0]; +}; + +struct list_lru_node { + spinlock_t lock; + struct list_lru_one lru; + struct list_lru_memcg *memcg_lrus; + long int nr_items; + long: 64; + long: 64; +}; + +enum migrate_mode { + MIGRATE_ASYNC = 0, + MIGRATE_SYNC_LIGHT = 1, + MIGRATE_SYNC = 2, + MIGRATE_SYNC_NO_COPY = 3, +}; + +struct key_tag { + struct callback_head rcu; + refcount_t usage; + bool removed; +}; + +typedef int (*request_key_actor_t)(struct key *, void *); + +struct key_preparsed_payload; + +struct key_match_data; + +struct kernel_pkey_params; + +struct kernel_pkey_query; + +struct key_type { + const char *name; + size_t def_datalen; + unsigned int flags; + int (*vet_description)(const char *); + int (*preparse)(struct key_preparsed_payload *); + void (*free_preparse)(struct key_preparsed_payload *); + int (*instantiate)(struct key *, struct key_preparsed_payload *); + int (*update)(struct key *, struct key_preparsed_payload *); + int (*match_preparse)(struct key_match_data *); + void (*match_free)(struct key_match_data *); + void (*revoke)(struct key *); + void (*destroy)(struct key *); + void (*describe)(const struct key *, struct seq_file *); + long int (*read)(const struct key *, char *, size_t); + request_key_actor_t request_key; + struct key_restriction * (*lookup_restriction)(const char *); + int (*asym_query)(const struct kernel_pkey_params *, struct kernel_pkey_query *); + int (*asym_eds_op)(struct kernel_pkey_params *, const void *, void *); + int (*asym_verify_signature)(struct kernel_pkey_params *, const void *, const void *); + struct list_head link; + struct lock_class_key lock_class; +}; + +typedef int (*key_restrict_link_func_t)(struct key *, const struct key_type *, const union key_payload *, struct key *); + +struct key_restriction { + key_restrict_link_func_t check; + struct key *key; + struct key_type *keytype; +}; + +struct group_info { + atomic_t usage; + int ngroups; + kgid_t gid[0]; +}; + +struct delayed_call { + void (*fn)(void *); + void *arg; +}; + +struct io_cq { + struct request_queue *q; + struct io_context *ioc; + union { + struct list_head q_node; + struct kmem_cache *__rcu_icq_cache; + }; + union { + struct hlist_node ioc_node; + struct callback_head __rcu_head; + }; + unsigned int flags; +}; + +struct wait_page_queue; + +struct kiocb { + struct file *ki_filp; + loff_t ki_pos; + void (*ki_complete)(struct kiocb *, long int, long int); + void *private; + int ki_flags; + u16 ki_hint; + u16 ki_ioprio; + union { + unsigned int ki_cookie; + struct wait_page_queue *ki_waitq; + }; +}; + +struct iattr { + unsigned int ia_valid; + umode_t ia_mode; + kuid_t ia_uid; + kgid_t ia_gid; + loff_t ia_size; + struct timespec64 ia_atime; + struct timespec64 ia_mtime; + struct timespec64 ia_ctime; + struct file *ia_file; +}; + +typedef __kernel_uid32_t projid_t; + +typedef struct { + projid_t val; +} kprojid_t; + +enum quota_type { + USRQUOTA = 0, + GRPQUOTA = 1, + PRJQUOTA = 2, +}; + +struct kqid { + union { + kuid_t uid; + kgid_t gid; + kprojid_t projid; + }; + enum quota_type type; +}; + +struct mem_dqblk { + qsize_t dqb_bhardlimit; + qsize_t dqb_bsoftlimit; + qsize_t dqb_curspace; + qsize_t dqb_rsvspace; + qsize_t dqb_ihardlimit; + qsize_t dqb_isoftlimit; + qsize_t dqb_curinodes; + time64_t dqb_btime; + time64_t dqb_itime; +}; + +struct dquot { + struct hlist_node dq_hash; + struct list_head dq_inuse; + struct list_head dq_free; + struct list_head dq_dirty; + struct mutex dq_lock; + spinlock_t dq_dqb_lock; + atomic_t dq_count; + struct super_block *dq_sb; + struct kqid dq_id; + loff_t dq_off; + long unsigned int dq_flags; + struct mem_dqblk dq_dqb; +}; + +enum { + DQF_ROOT_SQUASH_B = 0, + DQF_SYS_FILE_B = 16, + DQF_PRIVATE = 17, +}; + +struct quota_format_type { + int qf_fmt_id; + const struct quota_format_ops *qf_ops; + struct module *qf_owner; + struct quota_format_type *qf_next; +}; + +enum { + DQST_LOOKUPS = 0, + DQST_DROPS = 1, + DQST_READS = 2, + DQST_WRITES = 3, + DQST_CACHE_HITS = 4, + DQST_ALLOC_DQUOTS = 5, + DQST_FREE_DQUOTS = 6, + DQST_SYNCS = 7, + _DQST_DQSTAT_LAST = 8, +}; + +struct quota_format_ops { + int (*check_quota_file)(struct super_block *, int); + int (*read_file_info)(struct super_block *, int); + int (*write_file_info)(struct super_block *, int); + int (*free_file_info)(struct super_block *, int); + int (*read_dqblk)(struct dquot *); + int (*commit_dqblk)(struct dquot *); + int (*release_dqblk)(struct dquot *); + int (*get_next_id)(struct super_block *, struct kqid *); +}; + +struct dquot_operations { + int (*write_dquot)(struct dquot *); + struct dquot * (*alloc_dquot)(struct super_block *, int); + void (*destroy_dquot)(struct dquot *); + int (*acquire_dquot)(struct dquot *); + int (*release_dquot)(struct dquot *); + int (*mark_dirty)(struct dquot *); + int (*write_info)(struct super_block *, int); + qsize_t * (*get_reserved_space)(struct inode *); + int (*get_projid)(struct inode *, kprojid_t *); + int (*get_inode_usage)(struct inode *, qsize_t *); + int (*get_next_id)(struct super_block *, struct kqid *); +}; + +struct qc_dqblk { + int d_fieldmask; + u64 d_spc_hardlimit; + u64 d_spc_softlimit; + u64 d_ino_hardlimit; + u64 d_ino_softlimit; + u64 d_space; + u64 d_ino_count; + s64 d_ino_timer; + s64 d_spc_timer; + int d_ino_warns; + int d_spc_warns; + u64 d_rt_spc_hardlimit; + u64 d_rt_spc_softlimit; + u64 d_rt_space; + s64 d_rt_spc_timer; + int d_rt_spc_warns; +}; + +struct qc_type_state { + unsigned int flags; + unsigned int spc_timelimit; + unsigned int ino_timelimit; + unsigned int rt_spc_timelimit; + unsigned int spc_warnlimit; + unsigned int ino_warnlimit; + unsigned int rt_spc_warnlimit; + long long unsigned int ino; + blkcnt_t blocks; + blkcnt_t nextents; +}; + +struct qc_state { + unsigned int s_incoredqs; + struct qc_type_state s_state[3]; +}; + +struct qc_info { + int i_fieldmask; + unsigned int i_flags; + unsigned int i_spc_timelimit; + unsigned int i_ino_timelimit; + unsigned int i_rt_spc_timelimit; + unsigned int i_spc_warnlimit; + unsigned int i_ino_warnlimit; + unsigned int i_rt_spc_warnlimit; +}; + +struct quotactl_ops { + int (*quota_on)(struct super_block *, int, int, const struct path *); + int (*quota_off)(struct super_block *, int); + int (*quota_enable)(struct super_block *, unsigned int); + int (*quota_disable)(struct super_block *, unsigned int); + int (*quota_sync)(struct super_block *, int); + int (*set_info)(struct super_block *, int, struct qc_info *); + int (*get_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); + int (*get_nextdqblk)(struct super_block *, struct kqid *, struct qc_dqblk *); + int (*set_dqblk)(struct super_block *, struct kqid, struct qc_dqblk *); + int (*get_state)(struct super_block *, struct qc_state *); + int (*rm_xquota)(struct super_block *, unsigned int); +}; + +struct writeback_control; + +struct readahead_control; + +struct swap_info_struct; + +struct address_space_operations { + int (*writepage)(struct page *, struct writeback_control *); + int (*readpage)(struct file *, struct page *); + int (*writepages)(struct address_space *, struct writeback_control *); + int (*set_page_dirty)(struct page *); + int (*readpages)(struct file *, struct address_space *, struct list_head *, unsigned int); + void (*readahead)(struct readahead_control *); + int (*write_begin)(struct file *, struct address_space *, loff_t, unsigned int, unsigned int, struct page **, void **); + int (*write_end)(struct file *, struct address_space *, loff_t, unsigned int, unsigned int, struct page *, void *); + sector_t (*bmap)(struct address_space *, sector_t); + void (*invalidatepage)(struct page *, unsigned int, unsigned int); + int (*releasepage)(struct page *, gfp_t); + void (*freepage)(struct page *); + ssize_t (*direct_IO)(struct kiocb *, struct iov_iter *); + int (*migratepage)(struct address_space *, struct page *, struct page *, enum migrate_mode); + bool (*isolate_page)(struct page *, isolate_mode_t); + void (*putback_page)(struct page *); + int (*launder_page)(struct page *); + int (*is_partially_uptodate)(struct page *, long unsigned int, long unsigned int); + void (*is_dirty_writeback)(struct page *, bool *, bool *); + int (*error_remove_page)(struct address_space *, struct page *); + int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *); + void (*swap_deactivate)(struct file *); +}; + +struct fiemap_extent_info; + +struct inode_operations { + struct dentry * (*lookup)(struct inode *, struct dentry *, unsigned int); + const char * (*get_link)(struct dentry *, struct inode *, struct delayed_call *); + int (*permission)(struct inode *, int); + struct posix_acl * (*get_acl)(struct inode *, int); + int (*readlink)(struct dentry *, char *, int); + int (*create)(struct inode *, struct dentry *, umode_t, bool); + int (*link)(struct dentry *, struct inode *, struct dentry *); + int (*unlink)(struct inode *, struct dentry *); + int (*symlink)(struct inode *, struct dentry *, const char *); + int (*mkdir)(struct inode *, struct dentry *, umode_t); + int (*rmdir)(struct inode *, struct dentry *); + int (*mknod)(struct inode *, struct dentry *, umode_t, dev_t); + int (*rename)(struct inode *, struct dentry *, struct inode *, struct dentry *, unsigned int); + int (*setattr)(struct dentry *, struct iattr *); + int (*getattr)(const struct path *, struct kstat *, u32, unsigned int); + ssize_t (*listxattr)(struct dentry *, char *, size_t); + int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64, u64); + int (*update_time)(struct inode *, struct timespec64 *, int); + int (*atomic_open)(struct inode *, struct dentry *, struct file *, unsigned int, umode_t); + int (*tmpfile)(struct inode *, struct dentry *, umode_t); + int (*set_acl)(struct inode *, struct posix_acl *, int); + long: 64; + long: 64; + long: 64; +}; + +struct file_lock_context { + spinlock_t flc_lock; + struct list_head flc_flock; + struct list_head flc_posix; + struct list_head flc_lease; +}; + +struct file_lock_operations { + void (*fl_copy_lock)(struct file_lock *, struct file_lock *); + void (*fl_release_private)(struct file_lock *); +}; + +struct nlm_lockowner; + +struct nfs_lock_info { + u32 state; + struct nlm_lockowner *owner; + struct list_head list; +}; + +struct nfs4_lock_state; + +struct nfs4_lock_info { + struct nfs4_lock_state *owner; +}; + +struct fasync_struct; + +struct lock_manager_operations; + +struct file_lock { + struct file_lock *fl_blocker; + struct list_head fl_list; + struct hlist_node fl_link; + struct list_head fl_blocked_requests; + struct list_head fl_blocked_member; + fl_owner_t fl_owner; + unsigned int fl_flags; + unsigned char fl_type; + unsigned int fl_pid; + int fl_link_cpu; + wait_queue_head_t fl_wait; + struct file *fl_file; + loff_t fl_start; + loff_t fl_end; + struct fasync_struct *fl_fasync; + long unsigned int fl_break_time; + long unsigned int fl_downgrade_time; + const struct file_lock_operations *fl_ops; + const struct lock_manager_operations *fl_lmops; + union { + struct nfs_lock_info nfs_fl; + struct nfs4_lock_info nfs4_fl; + struct { + struct list_head link; + int state; + unsigned int debug_id; + } afs; + } fl_u; +}; + +struct lock_manager_operations { + fl_owner_t (*lm_get_owner)(fl_owner_t); + void (*lm_put_owner)(fl_owner_t); + void (*lm_notify)(struct file_lock *); + int (*lm_grant)(struct file_lock *, int); + bool (*lm_break)(struct file_lock *); + int (*lm_change)(struct file_lock *, int, struct list_head *); + void (*lm_setup)(struct file_lock *, void **); + bool (*lm_breaker_owns_lease)(struct file_lock *); +}; + +struct fasync_struct { + rwlock_t fa_lock; + int magic; + int fa_fd; + struct fasync_struct *fa_next; + struct file *fa_file; + struct callback_head fa_rcu; +}; + +enum { + SB_UNFROZEN = 0, + SB_FREEZE_WRITE = 1, + SB_FREEZE_PAGEFAULT = 2, + SB_FREEZE_FS = 3, + SB_FREEZE_COMPLETE = 4, +}; + +struct kstatfs; + +struct super_operations { + struct inode * (*alloc_inode)(struct super_block *); + void (*destroy_inode)(struct inode *); + void (*free_inode)(struct inode *); + void (*dirty_inode)(struct inode *, int); + int (*write_inode)(struct inode *, struct writeback_control *); + int (*drop_inode)(struct inode *); + void (*evict_inode)(struct inode *); + void (*put_super)(struct super_block *); + int (*sync_fs)(struct super_block *, int); + int (*freeze_super)(struct super_block *); + int (*freeze_fs)(struct super_block *); + int (*thaw_super)(struct super_block *); + int (*unfreeze_fs)(struct super_block *); + int (*statfs)(struct dentry *, struct kstatfs *); + int (*remount_fs)(struct super_block *, int *, char *); + void (*umount_begin)(struct super_block *); + int (*show_options)(struct seq_file *, struct dentry *); + int (*show_devname)(struct seq_file *, struct dentry *); + int (*show_path)(struct seq_file *, struct dentry *); + int (*show_stats)(struct seq_file *, struct dentry *); + ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); + ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); + struct dquot ** (*get_dquots)(struct inode *); + int (*bdev_try_to_free_page)(struct super_block *, struct page *, gfp_t); + long int (*nr_cached_objects)(struct super_block *, struct shrink_control *); + long int (*free_cached_objects)(struct super_block *, struct shrink_control *); +}; + +struct fid; + +struct iomap; + +struct export_operations { + int (*encode_fh)(struct inode *, __u32 *, int *, struct inode *); + struct dentry * (*fh_to_dentry)(struct super_block *, struct fid *, int, int); + struct dentry * (*fh_to_parent)(struct super_block *, struct fid *, int, int); + int (*get_name)(struct dentry *, char *, struct dentry *); + struct dentry * (*get_parent)(struct dentry *); + int (*commit_metadata)(struct inode *); + int (*get_uuid)(struct super_block *, u8 *, u32 *, u64 *); + int (*map_blocks)(struct inode *, loff_t, u64, struct iomap *, bool, u32 *); + int (*commit_blocks)(struct inode *, struct iomap *, int, struct iattr *); + long unsigned int flags; +}; + +struct xattr_handler { + const char *name; + const char *prefix; + int flags; + bool (*list)(struct dentry *); + int (*get)(const struct xattr_handler *, struct dentry *, struct inode *, const char *, void *, size_t); + int (*set)(const struct xattr_handler *, struct dentry *, struct inode *, const char *, const void *, size_t, int); +}; + +union fscrypt_policy; + +struct fscrypt_operations { + unsigned int flags; + const char *key_prefix; + int (*get_context)(struct inode *, void *, size_t); + int (*set_context)(struct inode *, const void *, size_t, void *); + const union fscrypt_policy * (*get_dummy_policy)(struct super_block *); + bool (*empty_dir)(struct inode *); + unsigned int max_namelen; + bool (*has_stable_inodes)(struct super_block *); + void (*get_ino_and_lblk_bits)(struct super_block *, int *, int *); + int (*get_num_devices)(struct super_block *); + void (*get_devices)(struct super_block *, struct request_queue **); +}; + +struct fsverity_operations { + int (*begin_enable_verity)(struct file *); + int (*end_enable_verity)(struct file *, const void *, size_t, u64); + int (*get_verity_descriptor)(struct inode *, void *, size_t); + struct page * (*read_merkle_tree_page)(struct inode *, long unsigned int, long unsigned int); + int (*write_merkle_tree_block)(struct inode *, const void *, u64, int); +}; + +typedef int (*filldir_t)(struct dir_context *, const char *, int, loff_t, u64, unsigned int); + +struct dir_context { + filldir_t actor; + loff_t pos; +}; + +struct p_log; + +struct fs_parameter; + +struct fs_parse_result; + +typedef int fs_param_type(struct p_log *, const struct fs_parameter_spec *, struct fs_parameter *, struct fs_parse_result *); + +struct fs_parameter_spec { + const char *name; + fs_param_type *type; + u8 opt; + short unsigned int flags; + const void *data; +}; + +enum compound_dtor_id { + NULL_COMPOUND_DTOR = 0, + COMPOUND_PAGE_DTOR = 1, + HUGETLB_PAGE_DTOR = 2, + TRANSHUGE_PAGE_DTOR = 3, + NR_COMPOUND_DTORS = 4, +}; + +enum vm_event_item { + PGPGIN = 0, + PGPGOUT = 1, + PSWPIN = 2, + PSWPOUT = 3, + PGALLOC_DMA = 4, + PGALLOC_DMA32 = 5, + PGALLOC_NORMAL = 6, + PGALLOC_MOVABLE = 7, + ALLOCSTALL_DMA = 8, + ALLOCSTALL_DMA32 = 9, + ALLOCSTALL_NORMAL = 10, + ALLOCSTALL_MOVABLE = 11, + PGSCAN_SKIP_DMA = 12, + PGSCAN_SKIP_DMA32 = 13, + PGSCAN_SKIP_NORMAL = 14, + PGSCAN_SKIP_MOVABLE = 15, + PGFREE = 16, + PGACTIVATE = 17, + PGDEACTIVATE = 18, + PGLAZYFREE = 19, + PGFAULT = 20, + PGMAJFAULT = 21, + PGLAZYFREED = 22, + PGREFILL = 23, + PGREUSE = 24, + PGSTEAL_KSWAPD = 25, + PGSTEAL_DIRECT = 26, + PGSCAN_KSWAPD = 27, + PGSCAN_DIRECT = 28, + PGSCAN_DIRECT_THROTTLE = 29, + PGSCAN_ANON = 30, + PGSCAN_FILE = 31, + PGSTEAL_ANON = 32, + PGSTEAL_FILE = 33, + PGSCAN_ZONE_RECLAIM_FAILED = 34, + PGINODESTEAL = 35, + SLABS_SCANNED = 36, + KSWAPD_INODESTEAL = 37, + KSWAPD_LOW_WMARK_HIT_QUICKLY = 38, + KSWAPD_HIGH_WMARK_HIT_QUICKLY = 39, + PAGEOUTRUN = 40, + PGROTATED = 41, + DROP_PAGECACHE = 42, + DROP_SLAB = 43, + OOM_KILL = 44, + NUMA_PTE_UPDATES = 45, + NUMA_HUGE_PTE_UPDATES = 46, + NUMA_HINT_FAULTS = 47, + NUMA_HINT_FAULTS_LOCAL = 48, + NUMA_PAGE_MIGRATE = 49, + PGMIGRATE_SUCCESS = 50, + PGMIGRATE_FAIL = 51, + THP_MIGRATION_SUCCESS = 52, + THP_MIGRATION_FAIL = 53, + THP_MIGRATION_SPLIT = 54, + COMPACTMIGRATE_SCANNED = 55, + COMPACTFREE_SCANNED = 56, + COMPACTISOLATED = 57, + COMPACTSTALL = 58, + COMPACTFAIL = 59, + COMPACTSUCCESS = 60, + KCOMPACTD_WAKE = 61, + KCOMPACTD_MIGRATE_SCANNED = 62, + KCOMPACTD_FREE_SCANNED = 63, + HTLB_BUDDY_PGALLOC = 64, + HTLB_BUDDY_PGALLOC_FAIL = 65, + UNEVICTABLE_PGCULLED = 66, + UNEVICTABLE_PGSCANNED = 67, + UNEVICTABLE_PGRESCUED = 68, + UNEVICTABLE_PGMLOCKED = 69, + UNEVICTABLE_PGMUNLOCKED = 70, + UNEVICTABLE_PGCLEARED = 71, + UNEVICTABLE_PGSTRANDED = 72, + THP_FAULT_ALLOC = 73, + THP_FAULT_FALLBACK = 74, + THP_FAULT_FALLBACK_CHARGE = 75, + THP_COLLAPSE_ALLOC = 76, + THP_COLLAPSE_ALLOC_FAILED = 77, + THP_FILE_ALLOC = 78, + THP_FILE_FALLBACK = 79, + THP_FILE_FALLBACK_CHARGE = 80, + THP_FILE_MAPPED = 81, + THP_SPLIT_PAGE = 82, + THP_SPLIT_PAGE_FAILED = 83, + THP_DEFERRED_SPLIT_PAGE = 84, + THP_SPLIT_PMD = 85, + THP_SPLIT_PUD = 86, + THP_ZERO_PAGE_ALLOC = 87, + THP_ZERO_PAGE_ALLOC_FAILED = 88, + THP_SWPOUT = 89, + THP_SWPOUT_FALLBACK = 90, + BALLOON_INFLATE = 91, + BALLOON_DEFLATE = 92, + BALLOON_MIGRATE = 93, + SWAP_RA = 94, + SWAP_RA_HIT = 95, + NR_VM_EVENT_ITEMS = 96, +}; + +struct tlb_context { + u64 ctx_id; + u64 tlb_gen; +}; + +struct tlb_state { + struct mm_struct *loaded_mm; + union { + struct mm_struct *last_user_mm; + long unsigned int last_user_mm_ibpb; + }; + u16 loaded_mm_asid; + u16 next_asid; + bool is_lazy; + bool invalidate_other; + short unsigned int user_pcid_flush_mask; + long unsigned int cr4; + struct tlb_context ctxs[6]; +}; + +struct boot_params_to_save { + unsigned int start; + unsigned int len; +}; + +enum cpu_idle_type { + CPU_IDLE = 0, + CPU_NOT_IDLE = 1, + CPU_NEWLY_IDLE = 2, + CPU_MAX_IDLE_TYPES = 3, +}; + +enum { + __SD_BALANCE_NEWIDLE = 0, + __SD_BALANCE_EXEC = 1, + __SD_BALANCE_FORK = 2, + __SD_BALANCE_WAKE = 3, + __SD_WAKE_AFFINE = 4, + __SD_ASYM_CPUCAPACITY = 5, + __SD_SHARE_CPUCAPACITY = 6, + __SD_SHARE_PKG_RESOURCES = 7, + __SD_SERIALIZE = 8, + __SD_ASYM_PACKING = 9, + __SD_PREFER_SIBLING = 10, + __SD_OVERLAP = 11, + __SD_NUMA = 12, + __SD_FLAG_CNT = 13, +}; + +struct x86_legacy_devices { + int pnpbios; +}; + +enum x86_legacy_i8042_state { + X86_LEGACY_I8042_PLATFORM_ABSENT = 0, + X86_LEGACY_I8042_FIRMWARE_ABSENT = 1, + X86_LEGACY_I8042_EXPECTED_PRESENT = 2, +}; + +struct x86_legacy_features { + enum x86_legacy_i8042_state i8042; + int rtc; + int warm_reset; + int no_vga; + int reserve_bios_regions; + struct x86_legacy_devices devices; +}; + +struct ghcb; + +struct x86_hyper_runtime { + void (*pin_vcpu)(int); + void (*sev_es_hcall_prepare)(struct ghcb *, struct pt_regs *); + bool (*sev_es_hcall_finish)(struct ghcb *, struct pt_regs *); +}; + +struct x86_platform_ops { + long unsigned int (*calibrate_cpu)(); + long unsigned int (*calibrate_tsc)(); + void (*get_wallclock)(struct timespec64 *); + int (*set_wallclock)(const struct timespec64 *); + void (*iommu_shutdown)(); + bool (*is_untracked_pat_range)(u64, u64); + void (*nmi_init)(); + unsigned char (*get_nmi_reason)(); + void (*save_sched_clock_state)(); + void (*restore_sched_clock_state)(); + void (*apic_post_init)(); + struct x86_legacy_features legacy; + void (*set_legacy_features)(); + struct x86_hyper_runtime hyper; +}; + +typedef signed char __s8; + +typedef __s8 s8; + +typedef __u32 __le32; + +typedef long unsigned int irq_hw_number_t; + +struct kernel_symbol { + int value_offset; + int name_offset; + int namespace_offset; +}; + +typedef int (*initcall_t)(); + +typedef int initcall_entry_t; + +struct obs_kernel_param { + const char *str; + int (*setup_func)(char *); + int early; +}; + +struct lockdep_map {}; + +struct jump_entry { + s32 code; + s32 target; + long int key; +}; + +struct static_key_mod; + +struct static_key { + atomic_t enabled; + union { + long unsigned int type; + struct jump_entry *entries; + struct static_key_mod *next; + }; +}; + +struct static_key_true { + struct static_key key; +}; + +struct static_key_false { + struct static_key key; +}; + +struct _ddebug { + const char *modname; + const char *function; + const char *filename; + const char *format; + unsigned int lineno: 18; + unsigned int flags: 8; + union { + struct static_key_true dd_key_true; + struct static_key_false dd_key_false; + } key; +}; + +enum system_states { + SYSTEM_BOOTING = 0, + SYSTEM_SCHEDULING = 1, + SYSTEM_RUNNING = 2, + SYSTEM_HALT = 3, + SYSTEM_POWER_OFF = 4, + SYSTEM_RESTART = 5, + SYSTEM_SUSPEND = 6, +}; + +struct orc_entry { + s16 sp_offset; + s16 bp_offset; + unsigned int sp_reg: 4; + unsigned int bp_reg: 4; + unsigned int type: 2; + unsigned int end: 1; +} __attribute__((packed)); + +struct bug_entry { + int bug_addr_disp; + int file_disp; + short unsigned int line; + short unsigned int flags; +}; + +typedef struct cpumask *cpumask_var_t; + +struct tracepoint_func { + void *func; + void *data; + int prio; +}; + +struct static_call_key; + +struct tracepoint { + const char *name; + struct static_key key; + struct static_call_key *static_call_key; + void *static_call_tramp; + void *iterator; + int (*regfunc)(); + void (*unregfunc)(); + struct tracepoint_func *funcs; +}; + +struct static_call_mod; + +struct static_call_site; + +struct static_call_key { + void *func; + union { + long unsigned int type; + struct static_call_mod *mods; + struct static_call_site *sites; + }; +}; + +typedef const int tracepoint_ptr_t; + +struct bpf_raw_event_map { + struct tracepoint *tp; + void *bpf_func; + u32 num_args; + u32 writable_size; + long: 64; +}; + +struct seq_operations { + void * (*start)(struct seq_file *, loff_t *); + void (*stop)(struct seq_file *, void *); + void * (*next)(struct seq_file *, void *, loff_t *); + int (*show)(struct seq_file *, void *); +}; + +struct fixed_percpu_data { + char gs_base[40]; + long unsigned int stack_canary; +}; + +enum perf_event_state { + PERF_EVENT_STATE_DEAD = 4294967292, + PERF_EVENT_STATE_EXIT = 4294967293, + PERF_EVENT_STATE_ERROR = 4294967294, + PERF_EVENT_STATE_OFF = 4294967295, + PERF_EVENT_STATE_INACTIVE = 0, + PERF_EVENT_STATE_ACTIVE = 1, +}; + +typedef struct { + atomic_long_t a; +} local_t; + +typedef struct { + local_t a; +} local64_t; + +struct perf_event_attr { + __u32 type; + __u32 size; + __u64 config; + union { + __u64 sample_period; + __u64 sample_freq; + }; + __u64 sample_type; + __u64 read_format; + __u64 disabled: 1; + __u64 inherit: 1; + __u64 pinned: 1; + __u64 exclusive: 1; + __u64 exclude_user: 1; + __u64 exclude_kernel: 1; + __u64 exclude_hv: 1; + __u64 exclude_idle: 1; + __u64 mmap: 1; + __u64 comm: 1; + __u64 freq: 1; + __u64 inherit_stat: 1; + __u64 enable_on_exec: 1; + __u64 task: 1; + __u64 watermark: 1; + __u64 precise_ip: 2; + __u64 mmap_data: 1; + __u64 sample_id_all: 1; + __u64 exclude_host: 1; + __u64 exclude_guest: 1; + __u64 exclude_callchain_kernel: 1; + __u64 exclude_callchain_user: 1; + __u64 mmap2: 1; + __u64 comm_exec: 1; + __u64 use_clockid: 1; + __u64 context_switch: 1; + __u64 write_backward: 1; + __u64 namespaces: 1; + __u64 ksymbol: 1; + __u64 bpf_event: 1; + __u64 aux_output: 1; + __u64 cgroup: 1; + __u64 text_poke: 1; + __u64 __reserved_1: 30; + union { + __u32 wakeup_events; + __u32 wakeup_watermark; + }; + __u32 bp_type; + union { + __u64 bp_addr; + __u64 kprobe_func; + __u64 uprobe_path; + __u64 config1; + }; + union { + __u64 bp_len; + __u64 kprobe_addr; + __u64 probe_offset; + __u64 config2; + }; + __u64 branch_sample_type; + __u64 sample_regs_user; + __u32 sample_stack_user; + __s32 clockid; + __u64 sample_regs_intr; + __u32 aux_watermark; + __u16 sample_max_stack; + __u16 __reserved_2; + __u32 aux_sample_size; + __u32 __reserved_3; +}; + +struct hw_perf_event_extra { + u64 config; + unsigned int reg; + int alloc; + int idx; +}; + +struct arch_hw_breakpoint { + long unsigned int address; + long unsigned int mask; + u8 len; + u8 type; +}; + +struct hw_perf_event { + union { + struct { + u64 config; + u64 last_tag; + long unsigned int config_base; + long unsigned int event_base; + int event_base_rdpmc; + int idx; + int last_cpu; + int flags; + struct hw_perf_event_extra extra_reg; + struct hw_perf_event_extra branch_reg; + }; + struct { + struct hrtimer hrtimer; + }; + struct { + struct list_head tp_list; + }; + struct { + u64 pwr_acc; + u64 ptsc; + }; + struct { + struct arch_hw_breakpoint info; + struct list_head bp_list; + }; + struct { + u8 iommu_bank; + u8 iommu_cntr; + u16 padding; + u64 conf; + u64 conf1; + }; + }; + struct task_struct *target; + void *addr_filters; + long unsigned int addr_filters_gen; + int state; + local64_t prev_count; + u64 sample_period; + union { + struct { + u64 last_period; + local64_t period_left; + }; + struct { + u64 saved_metric; + u64 saved_slots; + }; + }; + u64 interrupts_seq; + u64 interrupts; + u64 freq_time_stamp; + u64 freq_count_stamp; +}; + +struct irq_work { + struct __call_single_node node; + void (*func)(struct irq_work *); +}; + +struct perf_addr_filters_head { + struct list_head list; + raw_spinlock_t lock; + unsigned int nr_file_filters; +}; + +struct perf_sample_data; + +typedef void (*perf_overflow_handler_t)(struct perf_event *, struct perf_sample_data *, struct pt_regs *); + +struct ftrace_ops; + +struct ftrace_regs; + +typedef void (*ftrace_func_t)(long unsigned int, long unsigned int, struct ftrace_ops *, struct ftrace_regs *); + +struct ftrace_hash; + +struct ftrace_ops_hash { + struct ftrace_hash *notrace_hash; + struct ftrace_hash *filter_hash; + struct mutex regex_lock; +}; + +struct ftrace_ops { + ftrace_func_t func; + struct ftrace_ops *next; + long unsigned int flags; + void *private; + ftrace_func_t saved_func; + struct ftrace_ops_hash local_hash; + struct ftrace_ops_hash *func_hash; + struct ftrace_ops_hash old_hash; + long unsigned int trampoline; + long unsigned int trampoline_size; + struct list_head list; +}; + +struct pmu; + +struct perf_buffer; + +struct perf_addr_filter_range; + +struct bpf_prog; + +struct trace_event_call; + +struct event_filter; + +struct perf_cgroup; + +struct perf_event { + struct list_head event_entry; + struct list_head sibling_list; + struct list_head active_list; + struct rb_node group_node; + u64 group_index; + struct list_head migrate_entry; + struct hlist_node hlist_entry; + struct list_head active_entry; + int nr_siblings; + int event_caps; + int group_caps; + struct perf_event *group_leader; + struct pmu *pmu; + void *pmu_private; + enum perf_event_state state; + unsigned int attach_state; + local64_t count; + atomic64_t child_count; + u64 total_time_enabled; + u64 total_time_running; + u64 tstamp; + u64 shadow_ctx_time; + struct perf_event_attr attr; + u16 header_size; + u16 id_header_size; + u16 read_size; + struct hw_perf_event hw; + struct perf_event_context *ctx; + atomic_long_t refcount; + atomic64_t child_total_time_enabled; + atomic64_t child_total_time_running; + struct mutex child_mutex; + struct list_head child_list; + struct perf_event *parent; + int oncpu; + int cpu; + struct list_head owner_entry; + struct task_struct *owner; + struct mutex mmap_mutex; + atomic_t mmap_count; + struct perf_buffer *rb; + struct list_head rb_entry; + long unsigned int rcu_batches; + int rcu_pending; + wait_queue_head_t waitq; + struct fasync_struct *fasync; + int pending_wakeup; + int pending_kill; + int pending_disable; + struct irq_work pending; + atomic_t event_limit; + struct perf_addr_filters_head addr_filters; + struct perf_addr_filter_range *addr_filter_ranges; + long unsigned int addr_filters_gen; + struct perf_event *aux_event; + void (*destroy)(struct perf_event *); + struct callback_head callback_head; + struct pid_namespace *ns; + u64 id; + u64 (*clock)(); + perf_overflow_handler_t overflow_handler; + void *overflow_handler_context; + perf_overflow_handler_t orig_overflow_handler; + struct bpf_prog *prog; + struct trace_event_call *tp_event; + struct event_filter *filter; + struct ftrace_ops ftrace_ops; + struct perf_cgroup *cgrp; + void *security; + struct list_head sb_list; +}; + +struct uid_gid_extent { + u32 first; + u32 lower_first; + u32 count; +}; + +struct uid_gid_map { + u32 nr_extents; + union { + struct uid_gid_extent extent[5]; + struct { + struct uid_gid_extent *forward; + struct uid_gid_extent *reverse; + }; + }; +}; + +struct proc_ns_operations; + +struct ns_common { + atomic_long_t stashed; + const struct proc_ns_operations *ops; + unsigned int inum; + refcount_t count; +}; + +struct ctl_table; + +struct ctl_table_root; + +struct ctl_table_set; + +struct ctl_dir; + +struct ctl_node; + +struct ctl_table_header { + union { + struct { + struct ctl_table *ctl_table; + int used; + int count; + int nreg; + }; + struct callback_head rcu; + }; + struct completion *unregistering; + struct ctl_table *ctl_table_arg; + struct ctl_table_root *root; + struct ctl_table_set *set; + struct ctl_dir *parent; + struct ctl_node *node; + struct hlist_head inodes; +}; + +struct ctl_dir { + struct ctl_table_header header; + struct rb_root root; +}; + +struct ctl_table_set { + int (*is_seen)(struct ctl_table_set *); + struct ctl_dir dir; +}; + +struct ucounts; + +struct user_namespace { + struct uid_gid_map uid_map; + struct uid_gid_map gid_map; + struct uid_gid_map projid_map; + struct user_namespace *parent; + int level; + kuid_t owner; + kgid_t group; + struct ns_common ns; + long unsigned int flags; + struct list_head keyring_name_list; + struct key *user_keyring_register; + struct rw_semaphore keyring_sem; + struct key *persistent_keyring_register; + struct work_struct work; + struct ctl_table_set set; + struct ctl_table_header *sysctls; + struct ucounts *ucounts; + int ucount_max[10]; +}; + +struct pollfd { + int fd; + short int events; + short int revents; +}; + +typedef void (*smp_call_func_t)(void *); + +struct __call_single_data { + struct __call_single_node node; + smp_call_func_t func; + void *info; +}; + +struct smp_ops { + void (*smp_prepare_boot_cpu)(); + void (*smp_prepare_cpus)(unsigned int); + void (*smp_cpus_done)(unsigned int); + void (*stop_other_cpus)(int); + void (*crash_stop_other_cpus)(); + void (*smp_send_reschedule)(int); + int (*cpu_up)(unsigned int, struct task_struct *); + int (*cpu_disable)(); + void (*cpu_die)(unsigned int); + void (*play_dead)(); + void (*send_call_func_ipi)(const struct cpumask *); + void (*send_call_func_single_ipi)(int); +}; + +struct wait_queue_entry; + +typedef int (*wait_queue_func_t)(struct wait_queue_entry *, unsigned int, int, void *); + +struct wait_queue_entry { + unsigned int flags; + void *private; + wait_queue_func_t func; + struct list_head entry; +}; + +typedef struct wait_queue_entry wait_queue_entry_t; + +struct timer_list { + struct hlist_node entry; + long unsigned int expires; + void (*function)(struct timer_list *); + u32 flags; +}; + +struct delayed_work { + struct work_struct work; + struct timer_list timer; + struct workqueue_struct *wq; + int cpu; +}; + +struct rcu_work { + struct work_struct work; + struct callback_head rcu; + struct workqueue_struct *wq; +}; + +struct rcu_segcblist { + struct callback_head *head; + struct callback_head **tails[4]; + long unsigned int gp_seq[4]; + atomic_long_t len; + u8 enabled; + u8 offloaded; +}; + +struct srcu_node; + +struct srcu_struct; + +struct srcu_data { + long unsigned int srcu_lock_count[2]; + long unsigned int srcu_unlock_count[2]; + long: 64; + long: 64; + long: 64; + long: 64; + spinlock_t lock; + struct rcu_segcblist srcu_cblist; + long unsigned int srcu_gp_seq_needed; + long unsigned int srcu_gp_seq_needed_exp; + bool srcu_cblist_invoking; + struct timer_list delay_work; + struct work_struct work; + struct callback_head srcu_barrier_head; + struct srcu_node *mynode; + long unsigned int grpmask; + int cpu; + struct srcu_struct *ssp; + long: 64; + long: 64; +}; + +struct srcu_node { + spinlock_t lock; + long unsigned int srcu_have_cbs[4]; + long unsigned int srcu_data_have_cbs[4]; + long unsigned int srcu_gp_seq_needed_exp; + struct srcu_node *srcu_parent; + int grplo; + int grphi; +}; + +struct srcu_struct { + struct srcu_node node[521]; + struct srcu_node *level[4]; + struct mutex srcu_cb_mutex; + spinlock_t lock; + struct mutex srcu_gp_mutex; + unsigned int srcu_idx; + long unsigned int srcu_gp_seq; + long unsigned int srcu_gp_seq_needed; + long unsigned int srcu_gp_seq_needed_exp; + long unsigned int srcu_last_gp_end; + struct srcu_data *sda; + long unsigned int srcu_barrier_seq; + struct mutex srcu_barrier_mutex; + struct completion srcu_barrier_completion; + atomic_t srcu_barrier_cpu_cnt; + struct delayed_work work; +}; + +struct anon_vma { + struct anon_vma *root; + struct rw_semaphore rwsem; + atomic_t refcount; + unsigned int degree; + struct anon_vma *parent; + struct rb_root_cached rb_root; +}; + +struct mempolicy { + atomic_t refcnt; + short unsigned int mode; + short unsigned int flags; + union { + short int preferred_node; + nodemask_t nodes; + } v; + union { + nodemask_t cpuset_mems_allowed; + nodemask_t user_nodemask; + } w; +}; + +struct linux_binprm; + +struct coredump_params; + +struct linux_binfmt { + struct list_head lh; + struct module *module; + int (*load_binary)(struct linux_binprm *); + int (*load_shlib)(struct file *); + int (*core_dump)(struct coredump_params *); + long unsigned int min_coredump; +}; + +struct free_area { + struct list_head free_list[6]; + long unsigned int nr_free; +}; + +struct zone_padding { + char x[0]; +}; + +struct pglist_data; + +struct lruvec { + struct list_head lists[5]; + spinlock_t lru_lock; + long unsigned int anon_cost; + long unsigned int file_cost; + atomic_long_t nonresident_age; + long unsigned int refaults[2]; + long unsigned int flags; + struct pglist_data *pgdat; +}; + +struct per_cpu_pageset; + +struct zone { + long unsigned int _watermark[3]; + long unsigned int watermark_boost; + long unsigned int nr_reserved_highatomic; + long int lowmem_reserve[5]; + int node; + struct pglist_data *zone_pgdat; + struct per_cpu_pageset *pageset; + int pageset_high; + int pageset_batch; + long unsigned int zone_start_pfn; + atomic_long_t managed_pages; + long unsigned int spanned_pages; + long unsigned int present_pages; + const char *name; + long unsigned int nr_isolate_pageblock; + seqlock_t span_seqlock; + int initialized; + long: 32; + long: 64; + long: 64; + struct zone_padding _pad1_; + struct free_area free_area[11]; + long unsigned int flags; + spinlock_t lock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct zone_padding _pad2_; + long unsigned int percpu_drift_mark; + long unsigned int compact_cached_free_pfn; + long unsigned int compact_cached_migrate_pfn[2]; + long unsigned int compact_init_migrate_pfn; + long unsigned int compact_init_free_pfn; + unsigned int compact_considered; + unsigned int compact_defer_shift; + int compact_order_failed; + bool compact_blockskip_flush; + bool contiguous; + short: 16; + struct zone_padding _pad3_; + atomic_long_t vm_stat[11]; + atomic_long_t vm_numa_stat[6]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct zoneref { + struct zone *zone; + int zone_idx; +}; + +struct zonelist { + struct zoneref _zonerefs[5121]; +}; + +enum zone_type { + ZONE_DMA = 0, + ZONE_DMA32 = 1, + ZONE_NORMAL = 2, + ZONE_MOVABLE = 3, + ZONE_DEVICE = 4, + __MAX_NR_ZONES = 5, +}; + +struct deferred_split { + spinlock_t split_queue_lock; + struct list_head split_queue; + long unsigned int split_queue_len; +}; + +struct per_cpu_nodestat; + +struct pglist_data { + struct zone node_zones[5]; + struct zonelist node_zonelists[2]; + int nr_zones; + spinlock_t node_size_lock; + long unsigned int node_start_pfn; + long unsigned int node_present_pages; + long unsigned int node_spanned_pages; + int node_id; + wait_queue_head_t kswapd_wait; + wait_queue_head_t pfmemalloc_wait; + struct task_struct *kswapd; + int kswapd_order; + enum zone_type kswapd_highest_zoneidx; + int kswapd_failures; + int kcompactd_max_order; + enum zone_type kcompactd_highest_zoneidx; + wait_queue_head_t kcompactd_wait; + struct task_struct *kcompactd; + long unsigned int totalreserve_pages; + long unsigned int min_unmapped_pages; + long unsigned int min_slab_pages; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct zone_padding _pad1_; + struct deferred_split deferred_split_queue; + struct lruvec __lruvec; + long unsigned int flags; + long: 64; + struct zone_padding _pad2_; + struct per_cpu_nodestat *per_cpu_nodestats; + atomic_long_t vm_stat[38]; + long: 64; +}; + +struct per_cpu_pages { + int count; + int high; + int batch; + struct list_head lists[3]; +}; + +struct per_cpu_pageset { + struct per_cpu_pages pcp; + s8 expire; + u16 vm_numa_stat_diff[6]; + s8 stat_threshold; + s8 vm_stat_diff[11]; +}; + +struct per_cpu_nodestat { + s8 stat_threshold; + s8 vm_node_stat_diff[38]; +}; + +typedef struct pglist_data pg_data_t; + +enum irq_domain_bus_token { + DOMAIN_BUS_ANY = 0, + DOMAIN_BUS_WIRED = 1, + DOMAIN_BUS_GENERIC_MSI = 2, + DOMAIN_BUS_PCI_MSI = 3, + DOMAIN_BUS_PLATFORM_MSI = 4, + DOMAIN_BUS_NEXUS = 5, + DOMAIN_BUS_IPI = 6, + DOMAIN_BUS_FSL_MC_MSI = 7, + DOMAIN_BUS_TI_SCI_INTA_MSI = 8, + DOMAIN_BUS_WAKEUP = 9, + DOMAIN_BUS_VMD_MSI = 10, +}; + +struct irq_domain_ops; + +struct fwnode_handle; + +struct irq_domain_chip_generic; + +struct irq_domain { + struct list_head link; + const char *name; + const struct irq_domain_ops *ops; + void *host_data; + unsigned int flags; + unsigned int mapcount; + struct fwnode_handle *fwnode; + enum irq_domain_bus_token bus_token; + struct irq_domain_chip_generic *gc; + struct irq_domain *parent; + irq_hw_number_t hwirq_max; + unsigned int revmap_direct_max_irq; + unsigned int revmap_size; + struct xarray revmap_tree; + struct mutex revmap_tree_mutex; + unsigned int linear_revmap[0]; +}; + +typedef int proc_handler(struct ctl_table *, int, void *, size_t *, loff_t *); + +struct ctl_table_poll; + +struct ctl_table { + const char *procname; + void *data; + int maxlen; + umode_t mode; + struct ctl_table *child; + proc_handler *proc_handler; + struct ctl_table_poll *poll; + void *extra1; + void *extra2; +}; + +struct ctl_table_poll { + atomic_t event; + wait_queue_head_t wait; +}; + +struct ctl_node { + struct rb_node node; + struct ctl_table_header *header; +}; + +struct ctl_table_root { + struct ctl_table_set default_set; + struct ctl_table_set * (*lookup)(struct ctl_table_root *); + void (*set_ownership)(struct ctl_table_header *, struct ctl_table *, kuid_t *, kgid_t *); + int (*permissions)(struct ctl_table_header *, struct ctl_table *); +}; + +enum umh_disable_depth { + UMH_ENABLED = 0, + UMH_FREEZING = 1, + UMH_DISABLED = 2, +}; + +typedef __u64 Elf64_Addr; + +typedef __u16 Elf64_Half; + +typedef __u64 Elf64_Off; + +typedef __u32 Elf64_Word; + +typedef __u64 Elf64_Xword; + +struct elf64_sym { + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Half st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; +}; + +typedef struct elf64_sym Elf64_Sym; + +struct elf64_hdr { + unsigned char e_ident[16]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +}; + +typedef struct elf64_hdr Elf64_Ehdr; + +struct elf64_shdr { + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +}; + +typedef struct elf64_shdr Elf64_Shdr; + +struct idr { + struct xarray idr_rt; + unsigned int idr_base; + unsigned int idr_next; +}; + +struct kernfs_root; + +struct kernfs_elem_dir { + long unsigned int subdirs; + struct rb_root children; + struct kernfs_root *root; +}; + +struct kernfs_node; + +struct kernfs_syscall_ops; + +struct kernfs_root { + struct kernfs_node *kn; + unsigned int flags; + struct idr ino_idr; + u32 last_id_lowbits; + u32 id_highbits; + struct kernfs_syscall_ops *syscall_ops; + struct list_head supers; + wait_queue_head_t deactivate_waitq; +}; + +struct kernfs_elem_symlink { + struct kernfs_node *target_kn; +}; + +struct kernfs_ops; + +struct kernfs_open_node; + +struct kernfs_elem_attr { + const struct kernfs_ops *ops; + struct kernfs_open_node *open; + loff_t size; + struct kernfs_node *notify_next; +}; + +struct kernfs_iattrs; + +struct kernfs_node { + atomic_t count; + atomic_t active; + struct kernfs_node *parent; + const char *name; + struct rb_node rb; + const void *ns; + unsigned int hash; + union { + struct kernfs_elem_dir dir; + struct kernfs_elem_symlink symlink; + struct kernfs_elem_attr attr; + }; + void *priv; + u64 id; + short unsigned int flags; + umode_t mode; + struct kernfs_iattrs *iattr; +}; + +struct kernfs_open_file; + +struct kernfs_ops { + int (*open)(struct kernfs_open_file *); + void (*release)(struct kernfs_open_file *); + int (*seq_show)(struct seq_file *, void *); + void * (*seq_start)(struct seq_file *, loff_t *); + void * (*seq_next)(struct seq_file *, void *, loff_t *); + void (*seq_stop)(struct seq_file *, void *); + ssize_t (*read)(struct kernfs_open_file *, char *, size_t, loff_t); + size_t atomic_write_len; + bool prealloc; + ssize_t (*write)(struct kernfs_open_file *, char *, size_t, loff_t); + __poll_t (*poll)(struct kernfs_open_file *, struct poll_table_struct *); + int (*mmap)(struct kernfs_open_file *, struct vm_area_struct *); +}; + +struct kernfs_syscall_ops { + int (*show_options)(struct seq_file *, struct kernfs_root *); + int (*mkdir)(struct kernfs_node *, const char *, umode_t); + int (*rmdir)(struct kernfs_node *); + int (*rename)(struct kernfs_node *, struct kernfs_node *, const char *); + int (*show_path)(struct seq_file *, struct kernfs_node *, struct kernfs_root *); +}; + +struct seq_file { + char *buf; + size_t size; + size_t from; + size_t count; + size_t pad_until; + loff_t index; + loff_t read_pos; + struct mutex lock; + const struct seq_operations *op; + int poll_event; + const struct file *file; + void *private; +}; + +struct kernfs_open_file { + struct kernfs_node *kn; + struct file *file; + struct seq_file *seq_file; + void *priv; + struct mutex mutex; + struct mutex prealloc_mutex; + int event; + struct list_head list; + char *prealloc_buf; + size_t atomic_write_len; + bool mmapped: 1; + bool released: 1; + const struct vm_operations_struct *vm_ops; +}; + +typedef void (*poll_queue_proc)(struct file *, wait_queue_head_t *, struct poll_table_struct *); + +struct poll_table_struct { + poll_queue_proc _qproc; + __poll_t _key; +}; + +enum kobj_ns_type { + KOBJ_NS_TYPE_NONE = 0, + KOBJ_NS_TYPE_NET = 1, + KOBJ_NS_TYPES = 2, +}; + +struct sock; + +struct kobj_ns_type_operations { + enum kobj_ns_type type; + bool (*current_may_mount)(); + void * (*grab_current_ns)(); + const void * (*netlink_ns)(struct sock *); + const void * (*initial_ns)(); + void (*drop_ns)(void *); +}; + +struct attribute { + const char *name; + umode_t mode; +}; + +struct kobject; + +struct bin_attribute; + +struct attribute_group { + const char *name; + umode_t (*is_visible)(struct kobject *, struct attribute *, int); + umode_t (*is_bin_visible)(struct kobject *, struct bin_attribute *, int); + struct attribute **attrs; + struct bin_attribute **bin_attrs; +}; + +struct kref { + refcount_t refcount; +}; + +struct kset; + +struct kobj_type; + +struct kobject { + const char *name; + struct list_head entry; + struct kobject *parent; + struct kset *kset; + struct kobj_type *ktype; + struct kernfs_node *sd; + struct kref kref; + unsigned int state_initialized: 1; + unsigned int state_in_sysfs: 1; + unsigned int state_add_uevent_sent: 1; + unsigned int state_remove_uevent_sent: 1; + unsigned int uevent_suppress: 1; +}; + +struct bin_attribute { + struct attribute attr; + size_t size; + void *private; + ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t, size_t); + ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *, char *, loff_t, size_t); + int (*mmap)(struct file *, struct kobject *, struct bin_attribute *, struct vm_area_struct *); +}; + +struct sysfs_ops { + ssize_t (*show)(struct kobject *, struct attribute *, char *); + ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); +}; + +struct kset_uevent_ops; + +struct kset { + struct list_head list; + spinlock_t list_lock; + struct kobject kobj; + const struct kset_uevent_ops *uevent_ops; +}; + +struct kobj_type { + void (*release)(struct kobject *); + const struct sysfs_ops *sysfs_ops; + struct attribute **default_attrs; + const struct attribute_group **default_groups; + const struct kobj_ns_type_operations * (*child_ns_type)(struct kobject *); + const void * (*namespace)(struct kobject *); + void (*get_ownership)(struct kobject *, kuid_t *, kgid_t *); +}; + +struct kobj_uevent_env { + char *argv[3]; + char *envp[64]; + int envp_idx; + char buf[2048]; + int buflen; +}; + +struct kset_uevent_ops { + int (* const filter)(struct kset *, struct kobject *); + const char * (* const name)(struct kset *, struct kobject *); + int (* const uevent)(struct kset *, struct kobject *, struct kobj_uevent_env *); +}; + +struct kernel_param; + +struct kernel_param_ops { + unsigned int flags; + int (*set)(const char *, const struct kernel_param *); + int (*get)(char *, const struct kernel_param *); + void (*free)(void *); +}; + +struct kparam_string; + +struct kparam_array; + +struct kernel_param { + const char *name; + struct module *mod; + const struct kernel_param_ops *ops; + const u16 perm; + s8 level; + u8 flags; + union { + void *arg; + const struct kparam_string *str; + const struct kparam_array *arr; + }; +}; + +struct kparam_string { + unsigned int maxlen; + char *string; +}; + +struct kparam_array { + unsigned int max; + unsigned int elemsize; + unsigned int *num; + const struct kernel_param_ops *ops; + void *elem; +}; + +enum module_state { + MODULE_STATE_LIVE = 0, + MODULE_STATE_COMING = 1, + MODULE_STATE_GOING = 2, + MODULE_STATE_UNFORMED = 3, +}; + +struct module_param_attrs; + +struct module_kobject { + struct kobject kobj; + struct module *mod; + struct kobject *drivers_dir; + struct module_param_attrs *mp; + struct completion *kobj_completion; +}; + +struct latch_tree_node { + struct rb_node node[2]; +}; + +struct mod_tree_node { + struct module *mod; + struct latch_tree_node node; +}; + +struct module_layout { + void *base; + unsigned int size; + unsigned int text_size; + unsigned int ro_size; + unsigned int ro_after_init_size; + struct mod_tree_node mtn; +}; + +struct mod_arch_specific { + unsigned int num_orcs; + int *orc_unwind_ip; + struct orc_entry *orc_unwind; +}; + +struct mod_kallsyms { + Elf64_Sym *symtab; + unsigned int num_symtab; + char *strtab; + char *typetab; +}; + +struct module_attribute; + +struct exception_table_entry; + +struct module_sect_attrs; + +struct module_notes_attrs; + +struct trace_eval_map; + +struct klp_modinfo; + +struct error_injection_entry; + +struct module { + enum module_state state; + struct list_head list; + char name[56]; + struct module_kobject mkobj; + struct module_attribute *modinfo_attrs; + const char *version; + const char *srcversion; + struct kobject *holders_dir; + const struct kernel_symbol *syms; + const s32 *crcs; + unsigned int num_syms; + struct mutex param_lock; + struct kernel_param *kp; + unsigned int num_kp; + unsigned int num_gpl_syms; + const struct kernel_symbol *gpl_syms; + const s32 *gpl_crcs; + bool using_gplonly_symbols; + const struct kernel_symbol *unused_syms; + const s32 *unused_crcs; + unsigned int num_unused_syms; + unsigned int num_unused_gpl_syms; + const struct kernel_symbol *unused_gpl_syms; + const s32 *unused_gpl_crcs; + bool sig_ok; + bool async_probe_requested; + const struct kernel_symbol *gpl_future_syms; + const s32 *gpl_future_crcs; + unsigned int num_gpl_future_syms; + unsigned int num_exentries; + struct exception_table_entry *extable; + int (*init)(); + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct module_layout core_layout; + struct module_layout init_layout; + struct mod_arch_specific arch; + long unsigned int taints; + unsigned int num_bugs; + struct list_head bug_list; + struct bug_entry *bug_table; + struct mod_kallsyms *kallsyms; + struct mod_kallsyms core_kallsyms; + struct module_sect_attrs *sect_attrs; + struct module_notes_attrs *notes_attrs; + char *args; + void *percpu; + unsigned int percpu_size; + void *noinstr_text_start; + unsigned int noinstr_text_size; + unsigned int num_tracepoints; + tracepoint_ptr_t *tracepoints_ptrs; + unsigned int num_srcu_structs; + struct srcu_struct **srcu_struct_ptrs; + unsigned int num_bpf_raw_events; + struct bpf_raw_event_map *bpf_raw_events; + unsigned int btf_data_size; + void *btf_data; + struct jump_entry *jump_entries; + unsigned int num_jump_entries; + unsigned int num_trace_bprintk_fmt; + const char **trace_bprintk_fmt_start; + struct trace_event_call **trace_events; + unsigned int num_trace_events; + struct trace_eval_map **trace_evals; + unsigned int num_trace_evals; + unsigned int num_ftrace_callsites; + long unsigned int *ftrace_callsites; + void *kprobes_text_start; + unsigned int kprobes_text_size; + long unsigned int *kprobe_blacklist; + unsigned int num_kprobe_blacklist; + int num_static_call_sites; + struct static_call_site *static_call_sites; + bool klp; + bool klp_alive; + struct klp_modinfo *klp_info; + struct list_head source_list; + struct list_head target_list; + void (*exit)(); + atomic_t refcnt; + struct error_injection_entry *ei_funcs; + unsigned int num_ei_funcs; + long: 32; + long: 64; + long: 64; +}; + +struct error_injection_entry { + long unsigned int addr; + int etype; +}; + +struct static_call_site { + s32 addr; + s32 key; +}; + +struct module_attribute { + struct attribute attr; + ssize_t (*show)(struct module_attribute *, struct module_kobject *, char *); + ssize_t (*store)(struct module_attribute *, struct module_kobject *, const char *, size_t); + void (*setup)(struct module *, const char *); + int (*test)(struct module *); + void (*free)(struct module *); +}; + +struct klp_modinfo { + Elf64_Ehdr hdr; + Elf64_Shdr *sechdrs; + char *secstrings; + unsigned int symndx; +}; + +struct exception_table_entry { + int insn; + int fixup; + int handler; +}; + +struct trace_event_functions; + +struct trace_event { + struct hlist_node node; + struct list_head list; + int type; + struct trace_event_functions *funcs; +}; + +struct trace_event_class; + +struct bpf_prog_array; + +struct trace_event_call { + struct list_head list; + struct trace_event_class *class; + union { + char *name; + struct tracepoint *tp; + }; + struct trace_event event; + char *print_fmt; + struct event_filter *filter; + void *mod; + void *data; + int flags; + int perf_refcount; + struct hlist_head *perf_events; + struct bpf_prog_array *prog_array; + int (*perf_perm)(struct trace_event_call *, struct perf_event *); +}; + +struct trace_eval_map { + const char *system; + const char *eval_string; + long unsigned int eval_value; +}; + +struct cgroup; + +struct cgroup_subsys; + +struct cgroup_subsys_state { + struct cgroup *cgroup; + struct cgroup_subsys *ss; + struct percpu_ref refcnt; + struct list_head sibling; + struct list_head children; + struct list_head rstat_css_node; + int id; + unsigned int flags; + u64 serial_nr; + atomic_t online_cnt; + struct work_struct destroy_work; + struct rcu_work destroy_rwork; + struct cgroup_subsys_state *parent; +}; + +struct mem_cgroup_id { + int id; + refcount_t ref; +}; + +struct page_counter { + atomic_long_t usage; + long unsigned int min; + long unsigned int low; + long unsigned int high; + long unsigned int max; + struct page_counter *parent; + long unsigned int emin; + atomic_long_t min_usage; + atomic_long_t children_min_usage; + long unsigned int elow; + atomic_long_t low_usage; + atomic_long_t children_low_usage; + long unsigned int watermark; + long unsigned int failcnt; +}; + +struct vmpressure { + long unsigned int scanned; + long unsigned int reclaimed; + long unsigned int tree_scanned; + long unsigned int tree_reclaimed; + spinlock_t sr_lock; + struct list_head events; + struct mutex events_lock; + struct work_struct work; +}; + +struct cgroup_file { + struct kernfs_node *kn; + long unsigned int notified_at; + struct timer_list notify_timer; +}; + +struct mem_cgroup_threshold_ary; + +struct mem_cgroup_thresholds { + struct mem_cgroup_threshold_ary *primary; + struct mem_cgroup_threshold_ary *spare; +}; + +struct memcg_padding { + char x[0]; +}; + +enum memcg_kmem_state { + KMEM_NONE = 0, + KMEM_ALLOCATED = 1, + KMEM_ONLINE = 2, +}; + +struct percpu_counter { + raw_spinlock_t lock; + s64 count; + struct list_head list; + s32 *counters; +}; + +struct fprop_global { + struct percpu_counter events; + unsigned int period; + seqcount_t sequence; +}; + +struct wb_domain { + spinlock_t lock; + struct fprop_global completions; + struct timer_list period_timer; + long unsigned int period_time; + long unsigned int dirty_limit_tstamp; + long unsigned int dirty_limit; +}; + +struct wb_completion { + atomic_t cnt; + wait_queue_head_t *waitq; +}; + +struct memcg_cgwb_frn { + u64 bdi_id; + int memcg_id; + u64 at; + struct wb_completion done; +}; + +struct obj_cgroup; + +struct memcg_vmstats_percpu; + +struct mem_cgroup_per_node; + +struct mem_cgroup { + struct cgroup_subsys_state css; + struct mem_cgroup_id id; + struct page_counter memory; + union { + struct page_counter swap; + struct page_counter memsw; + }; + struct page_counter kmem; + struct page_counter tcpmem; + struct work_struct high_work; + long unsigned int soft_limit; + struct vmpressure vmpressure; + bool oom_group; + bool oom_lock; + int under_oom; + int swappiness; + int oom_kill_disable; + struct cgroup_file events_file; + struct cgroup_file events_local_file; + struct cgroup_file swap_events_file; + struct mutex thresholds_lock; + struct mem_cgroup_thresholds thresholds; + struct mem_cgroup_thresholds memsw_thresholds; + struct list_head oom_notify; + long unsigned int move_charge_at_immigrate; + spinlock_t move_lock; + long unsigned int move_lock_flags; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct memcg_padding _pad1_; + atomic_long_t vmstats[41]; + atomic_long_t vmevents[96]; + atomic_long_t memory_events[8]; + atomic_long_t memory_events_local[8]; + long unsigned int socket_pressure; + bool tcpmem_active; + int tcpmem_pressure; + int kmemcg_id; + enum memcg_kmem_state kmem_state; + struct obj_cgroup *objcg; + struct list_head objcg_list; + long: 64; + struct memcg_padding _pad2_; + atomic_t moving_account; + struct task_struct *move_lock_task; + struct memcg_vmstats_percpu *vmstats_local; + struct memcg_vmstats_percpu *vmstats_percpu; + struct list_head cgwb_list; + struct wb_domain cgwb_domain; + struct memcg_cgwb_frn cgwb_frn[4]; + struct list_head event_list; + spinlock_t event_list_lock; + struct deferred_split deferred_split_queue; + struct mem_cgroup_per_node *nodeinfo[0]; +}; + +struct fs_pin; + +struct pid_namespace { + struct idr idr; + struct callback_head rcu; + unsigned int pid_allocated; + struct task_struct *child_reaper; + struct kmem_cache *pid_cachep; + unsigned int level; + struct pid_namespace *parent; + struct fs_pin *bacct; + struct user_namespace *user_ns; + struct ucounts *ucounts; + int reboot; + struct ns_common ns; +}; + +struct task_cputime { + u64 stime; + u64 utime; + long long unsigned int sum_exec_runtime; +}; + +struct uts_namespace; + +struct ipc_namespace; + +struct mnt_namespace; + +struct net; + +struct time_namespace; + +struct cgroup_namespace; + +struct nsproxy { + atomic_t count; + struct uts_namespace *uts_ns; + struct ipc_namespace *ipc_ns; + struct mnt_namespace *mnt_ns; + struct pid_namespace *pid_ns_for_children; + struct net *net_ns; + struct time_namespace *time_ns; + struct time_namespace *time_ns_for_children; + struct cgroup_namespace *cgroup_ns; +}; + +struct bio; + +struct bio_list { + struct bio *head; + struct bio *tail; +}; + +struct blk_plug { + struct list_head mq_list; + struct list_head cb_list; + short unsigned int rq_count; + bool multiple_queues; + bool nowait; +}; + +struct reclaim_state { + long unsigned int reclaimed_slab; +}; + +struct fprop_local_percpu { + struct percpu_counter events; + unsigned int period; + raw_spinlock_t lock; +}; + +enum wb_reason { + WB_REASON_BACKGROUND = 0, + WB_REASON_VMSCAN = 1, + WB_REASON_SYNC = 2, + WB_REASON_PERIODIC = 3, + WB_REASON_LAPTOP_TIMER = 4, + WB_REASON_FS_FREE_SPACE = 5, + WB_REASON_FORKER_THREAD = 6, + WB_REASON_FOREIGN_FLUSH = 7, + WB_REASON_MAX = 8, +}; + +struct bdi_writeback { + struct backing_dev_info *bdi; + long unsigned int state; + long unsigned int last_old_flush; + struct list_head b_dirty; + struct list_head b_io; + struct list_head b_more_io; + struct list_head b_dirty_time; + spinlock_t list_lock; + struct percpu_counter stat[4]; + long unsigned int congested; + long unsigned int bw_time_stamp; + long unsigned int dirtied_stamp; + long unsigned int written_stamp; + long unsigned int write_bandwidth; + long unsigned int avg_write_bandwidth; + long unsigned int dirty_ratelimit; + long unsigned int balanced_dirty_ratelimit; + struct fprop_local_percpu completions; + int dirty_exceeded; + enum wb_reason start_all_reason; + spinlock_t work_lock; + struct list_head work_list; + struct delayed_work dwork; + long unsigned int dirty_sleep; + struct list_head bdi_node; + struct percpu_ref refcnt; + struct fprop_local_percpu memcg_completions; + struct cgroup_subsys_state *memcg_css; + struct cgroup_subsys_state *blkcg_css; + struct list_head memcg_node; + struct list_head blkcg_node; + union { + struct work_struct release_work; + struct callback_head rcu; + }; +}; + +struct device; + +struct backing_dev_info { + u64 id; + struct rb_node rb_node; + struct list_head bdi_list; + long unsigned int ra_pages; + long unsigned int io_pages; + struct kref refcnt; + unsigned int capabilities; + unsigned int min_ratio; + unsigned int max_ratio; + unsigned int max_prop_frac; + atomic_long_t tot_write_bandwidth; + struct bdi_writeback wb; + struct list_head wb_list; + struct xarray cgwb_tree; + struct mutex cgwb_release_mutex; + struct rw_semaphore wb_switch_rwsem; + wait_queue_head_t wb_waitq; + struct device *dev; + char dev_name[64]; + struct device *owner; + struct timer_list laptop_mode_wb_timer; + struct dentry *debug_dir; +}; + +struct css_set { + struct cgroup_subsys_state *subsys[12]; + refcount_t refcount; + struct css_set *dom_cset; + struct cgroup *dfl_cgrp; + int nr_tasks; + struct list_head tasks; + struct list_head mg_tasks; + struct list_head dying_tasks; + struct list_head task_iters; + struct list_head e_cset_node[12]; + struct list_head threaded_csets; + struct list_head threaded_csets_node; + struct hlist_node hlist; + struct list_head cgrp_links; + struct list_head mg_preload_node; + struct list_head mg_node; + struct cgroup *mg_src_cgrp; + struct cgroup *mg_dst_cgrp; + struct css_set *mg_dst_cset; + bool dead; + struct callback_head callback_head; +}; + +typedef u32 compat_uptr_t; + +struct compat_robust_list { + compat_uptr_t next; +}; + +typedef s32 compat_long_t; + +struct compat_robust_list_head { + struct compat_robust_list list; + compat_long_t futex_offset; + compat_uptr_t list_op_pending; +}; + +struct perf_event_groups { + struct rb_root tree; + u64 index; +}; + +struct perf_event_context { + struct pmu *pmu; + raw_spinlock_t lock; + struct mutex mutex; + struct list_head active_ctx_list; + struct perf_event_groups pinned_groups; + struct perf_event_groups flexible_groups; + struct list_head event_list; + struct list_head pinned_active; + struct list_head flexible_active; + int nr_events; + int nr_active; + int is_active; + int nr_stat; + int nr_freq; + int rotate_disable; + int rotate_necessary; + refcount_t refcount; + struct task_struct *task; + u64 time; + u64 timestamp; + struct perf_event_context *parent_ctx; + u64 parent_gen; + u64 generation; + int pin_count; + int nr_cgroups; + void *task_ctx_data; + struct callback_head callback_head; +}; + +struct task_delay_info { + raw_spinlock_t lock; + unsigned int flags; + u64 blkio_start; + u64 blkio_delay; + u64 swapin_delay; + u32 blkio_count; + u32 swapin_count; + u64 freepages_start; + u64 freepages_delay; + u64 thrashing_start; + u64 thrashing_delay; + u32 freepages_count; + u32 thrashing_count; +}; + +struct ftrace_ret_stack { + long unsigned int ret; + long unsigned int func; + long long unsigned int calltime; + long long unsigned int subtime; + long unsigned int *retp; +}; + +struct blk_integrity_profile; + +struct blk_integrity { + const struct blk_integrity_profile *profile; + unsigned char flags; + unsigned char tuple_size; + unsigned char interval_exp; + unsigned char tag_size; +}; + +enum rpm_status { + RPM_ACTIVE = 0, + RPM_RESUMING = 1, + RPM_SUSPENDED = 2, + RPM_SUSPENDING = 3, +}; + +struct blk_rq_stat { + u64 mean; + u64 min; + u64 max; + u32 nr_samples; + u64 batch; +}; + +enum blk_zoned_model { + BLK_ZONED_NONE = 0, + BLK_ZONED_HA = 1, + BLK_ZONED_HM = 2, +}; + +struct queue_limits { + long unsigned int bounce_pfn; + long unsigned int seg_boundary_mask; + long unsigned int virt_boundary_mask; + unsigned int max_hw_sectors; + unsigned int max_dev_sectors; + unsigned int chunk_sectors; + unsigned int max_sectors; + unsigned int max_segment_size; + unsigned int physical_block_size; + unsigned int logical_block_size; + unsigned int alignment_offset; + unsigned int io_min; + unsigned int io_opt; + unsigned int max_discard_sectors; + unsigned int max_hw_discard_sectors; + unsigned int max_write_same_sectors; + unsigned int max_write_zeroes_sectors; + unsigned int max_zone_append_sectors; + unsigned int discard_granularity; + unsigned int discard_alignment; + short unsigned int max_segments; + short unsigned int max_integrity_segments; + short unsigned int max_discard_segments; + unsigned char misaligned; + unsigned char discard_misaligned; + unsigned char raid_partial_stripes_expensive; + enum blk_zoned_model zoned; +}; + +struct bsg_ops; + +struct bsg_class_device { + struct device *class_dev; + int minor; + struct request_queue *queue; + const struct bsg_ops *ops; +}; + +typedef void *mempool_alloc_t(gfp_t, void *); + +typedef void mempool_free_t(void *, void *); + +struct mempool_s { + spinlock_t lock; + int min_nr; + int curr_nr; + void **elements; + void *pool_data; + mempool_alloc_t *alloc; + mempool_free_t *free; + wait_queue_head_t wait; +}; + +typedef struct mempool_s mempool_t; + +struct bio_set { + struct kmem_cache *bio_slab; + unsigned int front_pad; + mempool_t bio_pool; + mempool_t bvec_pool; + mempool_t bio_integrity_pool; + mempool_t bvec_integrity_pool; + spinlock_t rescue_lock; + struct bio_list rescue_list; + struct work_struct rescue_work; + struct workqueue_struct *rescue_workqueue; +}; + +struct request; + +struct elevator_queue; + +struct blk_queue_stats; + +struct rq_qos; + +struct blk_mq_ops; + +struct blk_mq_ctx; + +struct blk_mq_hw_ctx; + +struct blk_keyslot_manager; + +struct blk_stat_callback; + +struct blkcg_gq; + +struct blk_trace; + +struct blk_flush_queue; + +struct throtl_data; + +struct blk_mq_tag_set; + +struct request_queue { + struct request *last_merge; + struct elevator_queue *elevator; + struct percpu_ref q_usage_counter; + struct blk_queue_stats *stats; + struct rq_qos *rq_qos; + const struct blk_mq_ops *mq_ops; + struct blk_mq_ctx *queue_ctx; + unsigned int queue_depth; + struct blk_mq_hw_ctx **queue_hw_ctx; + unsigned int nr_hw_queues; + struct backing_dev_info *backing_dev_info; + void *queuedata; + long unsigned int queue_flags; + atomic_t pm_only; + int id; + gfp_t bounce_gfp; + spinlock_t queue_lock; + struct kobject kobj; + struct kobject *mq_kobj; + struct blk_integrity integrity; + struct device *dev; + enum rpm_status rpm_status; + unsigned int nr_pending; + long unsigned int nr_requests; + unsigned int dma_pad_mask; + unsigned int dma_alignment; + struct blk_keyslot_manager *ksm; + unsigned int rq_timeout; + int poll_nsec; + struct blk_stat_callback *poll_cb; + struct blk_rq_stat poll_stat[16]; + struct timer_list timeout; + struct work_struct timeout_work; + atomic_t nr_active_requests_shared_sbitmap; + struct list_head icq_list; + long unsigned int blkcg_pols[1]; + struct blkcg_gq *root_blkg; + struct list_head blkg_list; + struct queue_limits limits; + unsigned int required_elevator_features; + unsigned int nr_zones; + long unsigned int *conv_zones_bitmap; + long unsigned int *seq_zones_wlock; + unsigned int max_open_zones; + unsigned int max_active_zones; + unsigned int sg_timeout; + unsigned int sg_reserved_size; + int node; + struct mutex debugfs_mutex; + struct blk_trace *blk_trace; + struct blk_flush_queue *fq; + struct list_head requeue_list; + spinlock_t requeue_lock; + struct delayed_work requeue_work; + struct mutex sysfs_lock; + struct mutex sysfs_dir_lock; + struct list_head unused_hctx_list; + spinlock_t unused_hctx_lock; + int mq_freeze_depth; + struct bsg_class_device bsg_dev; + struct throtl_data *td; + struct callback_head callback_head; + wait_queue_head_t mq_freeze_wq; + struct mutex mq_freeze_lock; + struct blk_mq_tag_set *tag_set; + struct list_head tag_set_list; + struct bio_set bio_split; + struct dentry *debugfs_dir; + struct dentry *sched_debugfs_dir; + struct dentry *rqos_debugfs_dir; + bool mq_sysfs_init_done; + size_t cmd_size; + u64 write_hints[5]; +}; + +struct cgroup_base_stat { + struct task_cputime cputime; +}; + +struct psi_group_cpu; + +struct psi_group { + struct mutex avgs_lock; + struct psi_group_cpu *pcpu; + u64 avg_total[5]; + u64 avg_last_update; + u64 avg_next_update; + struct delayed_work avgs_work; + u64 total[10]; + long unsigned int avg[15]; + struct task_struct *poll_task; + struct timer_list poll_timer; + wait_queue_head_t poll_wait; + atomic_t poll_wakeup; + struct mutex trigger_lock; + struct list_head triggers; + u32 nr_triggers[5]; + u32 poll_states; + u64 poll_min_period; + u64 polling_total[5]; + u64 polling_next_update; + u64 polling_until; +}; + +struct cgroup_bpf { + struct bpf_prog_array *effective[38]; + struct list_head progs[38]; + u32 flags[38]; + struct list_head storages; + struct bpf_prog_array *inactive; + struct percpu_ref refcnt; + struct work_struct release_work; +}; + +struct cgroup_freezer_state { + bool freeze; + int e_freeze; + int nr_frozen_descendants; + int nr_frozen_tasks; +}; + +struct cgroup_root; + +struct cgroup_rstat_cpu; + +struct cgroup { + struct cgroup_subsys_state self; + long unsigned int flags; + int level; + int max_depth; + int nr_descendants; + int nr_dying_descendants; + int max_descendants; + int nr_populated_csets; + int nr_populated_domain_children; + int nr_populated_threaded_children; + int nr_threaded_children; + struct kernfs_node *kn; + struct cgroup_file procs_file; + struct cgroup_file events_file; + u16 subtree_control; + u16 subtree_ss_mask; + u16 old_subtree_control; + u16 old_subtree_ss_mask; + struct cgroup_subsys_state *subsys[12]; + struct cgroup_root *root; + struct list_head cset_links; + struct list_head e_csets[12]; + struct cgroup *dom_cgrp; + struct cgroup *old_dom_cgrp; + struct cgroup_rstat_cpu *rstat_cpu; + struct list_head rstat_css_list; + struct cgroup_base_stat last_bstat; + struct cgroup_base_stat bstat; + struct prev_cputime prev_cputime; + struct list_head pidlists; + struct mutex pidlist_mutex; + wait_queue_head_t offline_waitq; + struct work_struct release_agent_work; + struct psi_group psi; + struct cgroup_bpf bpf; + atomic_t congestion_count; + struct cgroup_freezer_state freezer; + u64 ancestor_ids[0]; +}; + +struct taskstats { + __u16 version; + __u32 ac_exitcode; + __u8 ac_flag; + __u8 ac_nice; + __u64 cpu_count; + __u64 cpu_delay_total; + __u64 blkio_count; + __u64 blkio_delay_total; + __u64 swapin_count; + __u64 swapin_delay_total; + __u64 cpu_run_real_total; + __u64 cpu_run_virtual_total; + char ac_comm[32]; + __u8 ac_sched; + __u8 ac_pad[3]; + int: 32; + __u32 ac_uid; + __u32 ac_gid; + __u32 ac_pid; + __u32 ac_ppid; + __u32 ac_btime; + __u64 ac_etime; + __u64 ac_utime; + __u64 ac_stime; + __u64 ac_minflt; + __u64 ac_majflt; + __u64 coremem; + __u64 virtmem; + __u64 hiwater_rss; + __u64 hiwater_vm; + __u64 read_char; + __u64 write_char; + __u64 read_syscalls; + __u64 write_syscalls; + __u64 read_bytes; + __u64 write_bytes; + __u64 cancelled_write_bytes; + __u64 nvcsw; + __u64 nivcsw; + __u64 ac_utimescaled; + __u64 ac_stimescaled; + __u64 cpu_scaled_run_real_total; + __u64 freepages_count; + __u64 freepages_delay_total; + __u64 thrashing_count; + __u64 thrashing_delay_total; + __u64 ac_btime64; +}; + +typedef struct { + __u8 b[16]; +} guid_t; + +struct wait_page_queue { + struct page *page; + int bit_nr; + wait_queue_entry_t wait; +}; + +enum writeback_sync_modes { + WB_SYNC_NONE = 0, + WB_SYNC_ALL = 1, +}; + +struct writeback_control { + long int nr_to_write; + long int pages_skipped; + loff_t range_start; + loff_t range_end; + enum writeback_sync_modes sync_mode; + unsigned int for_kupdate: 1; + unsigned int for_background: 1; + unsigned int tagged_writepages: 1; + unsigned int for_reclaim: 1; + unsigned int range_cyclic: 1; + unsigned int for_sync: 1; + unsigned int no_cgroup_owner: 1; + unsigned int punt_to_cgroup: 1; + struct bdi_writeback *wb; + struct inode *inode; + int wb_id; + int wb_lcand_id; + int wb_tcand_id; + size_t wb_bytes; + size_t wb_lcand_bytes; + size_t wb_tcand_bytes; +}; + +struct readahead_control { + struct file *file; + struct address_space *mapping; + long unsigned int _index; + unsigned int _nr_pages; + unsigned int _batch_count; +}; + +struct iovec; + +struct kvec; + +struct bio_vec; + +struct iov_iter { + unsigned int type; + size_t iov_offset; + size_t count; + union { + const struct iovec *iov; + const struct kvec *kvec; + const struct bio_vec *bvec; + struct pipe_inode_info *pipe; + }; + union { + long unsigned int nr_segs; + struct { + unsigned int head; + unsigned int start_head; + }; + }; +}; + +struct swap_cluster_info { + spinlock_t lock; + unsigned int data: 24; + unsigned int flags: 8; +}; + +struct swap_cluster_list { + struct swap_cluster_info head; + struct swap_cluster_info tail; +}; + +struct percpu_cluster; + +struct swap_info_struct { + long unsigned int flags; + short int prio; + struct plist_node list; + signed char type; + unsigned int max; + unsigned char *swap_map; + struct swap_cluster_info *cluster_info; + struct swap_cluster_list free_clusters; + unsigned int lowest_bit; + unsigned int highest_bit; + unsigned int pages; + unsigned int inuse_pages; + unsigned int cluster_next; + unsigned int cluster_nr; + unsigned int *cluster_next_cpu; + struct percpu_cluster *percpu_cluster; + struct rb_root swap_extent_root; + struct block_device *bdev; + struct file *swap_file; + unsigned int old_block_size; + long unsigned int *frontswap_map; + atomic_t frontswap_pages; + spinlock_t lock; + spinlock_t cont_lock; + struct work_struct discard_work; + struct swap_cluster_list discard_clusters; + struct plist_node avail_lists[0]; +}; + +struct cdev { + struct kobject kobj; + struct module *owner; + const struct file_operations *ops; + struct list_head list; + dev_t dev; + unsigned int count; +}; + +enum dl_dev_state { + DL_DEV_NO_DRIVER = 0, + DL_DEV_PROBING = 1, + DL_DEV_DRIVER_BOUND = 2, + DL_DEV_UNBINDING = 3, +}; + +struct dev_links_info { + struct list_head suppliers; + struct list_head consumers; + struct list_head defer_sync; + enum dl_dev_state status; +}; + +struct pm_message { + int event; +}; + +typedef struct pm_message pm_message_t; + +enum rpm_request { + RPM_REQ_NONE = 0, + RPM_REQ_IDLE = 1, + RPM_REQ_SUSPEND = 2, + RPM_REQ_AUTOSUSPEND = 3, + RPM_REQ_RESUME = 4, +}; + +struct wakeup_source; + +struct wake_irq; + +struct pm_subsys_data; + +struct dev_pm_qos; + +struct dev_pm_info { + pm_message_t power_state; + unsigned int can_wakeup: 1; + unsigned int async_suspend: 1; + bool in_dpm_list: 1; + bool is_prepared: 1; + bool is_suspended: 1; + bool is_noirq_suspended: 1; + bool is_late_suspended: 1; + bool no_pm: 1; + bool early_init: 1; + bool direct_complete: 1; + u32 driver_flags; + spinlock_t lock; + struct list_head entry; + struct completion completion; + struct wakeup_source *wakeup; + bool wakeup_path: 1; + bool syscore: 1; + bool no_pm_callbacks: 1; + unsigned int must_resume: 1; + unsigned int may_skip_resume: 1; + struct hrtimer suspend_timer; + u64 timer_expires; + struct work_struct work; + wait_queue_head_t wait_queue; + struct wake_irq *wakeirq; + atomic_t usage_count; + atomic_t child_count; + unsigned int disable_depth: 3; + unsigned int idle_notification: 1; + unsigned int request_pending: 1; + unsigned int deferred_resume: 1; + unsigned int runtime_auto: 1; + bool ignore_children: 1; + unsigned int no_callbacks: 1; + unsigned int irq_safe: 1; + unsigned int use_autosuspend: 1; + unsigned int timer_autosuspends: 1; + unsigned int memalloc_noio: 1; + unsigned int links_count; + enum rpm_request request; + enum rpm_status runtime_status; + int runtime_error; + int autosuspend_delay; + u64 last_busy; + u64 active_time; + u64 suspended_time; + u64 accounting_timestamp; + struct pm_subsys_data *subsys_data; + void (*set_latency_tolerance)(struct device *, s32); + struct dev_pm_qos *qos; +}; + +struct dev_archdata {}; + +struct device_private; + +struct device_type; + +struct bus_type; + +struct device_driver; + +struct dev_pm_domain; + +struct em_perf_domain; + +struct dev_pin_info; + +struct dma_map_ops; + +struct bus_dma_region; + +struct device_dma_parameters; + +struct cma; + +struct device_node; + +struct class; + +struct iommu_group; + +struct dev_iommu; + +struct device { + struct kobject kobj; + struct device *parent; + struct device_private *p; + const char *init_name; + const struct device_type *type; + struct bus_type *bus; + struct device_driver *driver; + void *platform_data; + void *driver_data; + struct mutex mutex; + struct dev_links_info links; + struct dev_pm_info power; + struct dev_pm_domain *pm_domain; + struct em_perf_domain *em_pd; + struct irq_domain *msi_domain; + struct dev_pin_info *pins; + struct list_head msi_list; + const struct dma_map_ops *dma_ops; + u64 *dma_mask; + u64 coherent_dma_mask; + u64 bus_dma_limit; + const struct bus_dma_region *dma_range_map; + struct device_dma_parameters *dma_parms; + struct list_head dma_pools; + struct cma *cma_area; + struct dev_archdata archdata; + struct device_node *of_node; + struct fwnode_handle *fwnode; + int numa_node; + dev_t devt; + u32 id; + spinlock_t devres_lock; + struct list_head devres_head; + struct class *class; + const struct attribute_group **groups; + void (*release)(struct device *); + struct iommu_group *iommu_group; + struct dev_iommu *iommu; + bool offline_disabled: 1; + bool offline: 1; + bool of_node_reused: 1; + bool state_synced: 1; +}; + +struct disk_stats; + +struct gendisk; + +struct partition_meta_info; + +struct block_device { + sector_t bd_start_sect; + struct disk_stats *bd_stats; + long unsigned int bd_stamp; + bool bd_read_only; + dev_t bd_dev; + int bd_openers; + struct inode *bd_inode; + struct super_block *bd_super; + struct mutex bd_mutex; + void *bd_claiming; + struct device bd_device; + void *bd_holder; + int bd_holders; + bool bd_write_holder; + struct list_head bd_holder_disks; + struct kobject *bd_holder_dir; + u8 bd_partno; + unsigned int bd_part_count; + spinlock_t bd_size_lock; + struct gendisk *bd_disk; + struct backing_dev_info *bd_bdi; + int bd_fsfreeze_count; + struct mutex bd_fsfreeze_mutex; + struct super_block *bd_fsfreeze_sb; + struct partition_meta_info *bd_meta_info; +}; + +struct fc_log; + +struct p_log { + const char *prefix; + struct fc_log *log; +}; + +enum fs_context_purpose { + FS_CONTEXT_FOR_MOUNT = 0, + FS_CONTEXT_FOR_SUBMOUNT = 1, + FS_CONTEXT_FOR_RECONFIGURE = 2, +}; + +enum fs_context_phase { + FS_CONTEXT_CREATE_PARAMS = 0, + FS_CONTEXT_CREATING = 1, + FS_CONTEXT_AWAITING_MOUNT = 2, + FS_CONTEXT_AWAITING_RECONF = 3, + FS_CONTEXT_RECONF_PARAMS = 4, + FS_CONTEXT_RECONFIGURING = 5, + FS_CONTEXT_FAILED = 6, +}; + +struct fs_context_operations; + +struct fs_context { + const struct fs_context_operations *ops; + struct mutex uapi_mutex; + struct file_system_type *fs_type; + void *fs_private; + void *sget_key; + struct dentry *root; + struct user_namespace *user_ns; + struct net *net_ns; + const struct cred *cred; + struct p_log log; + const char *source; + void *security; + void *s_fs_info; + unsigned int sb_flags; + unsigned int sb_flags_mask; + unsigned int s_iflags; + unsigned int lsm_flags; + enum fs_context_purpose purpose: 8; + enum fs_context_phase phase: 8; + bool need_free: 1; + bool global: 1; + bool oldapi: 1; +}; + +struct audit_names; + +struct filename { + const char *name; + const char *uptr; + int refcnt; + struct audit_names *aname; + const char iname[0]; +}; + +typedef u8 blk_status_t; + +struct bvec_iter { + sector_t bi_sector; + unsigned int bi_size; + unsigned int bi_idx; + unsigned int bi_bvec_done; +}; + +typedef void bio_end_io_t(struct bio *); + +struct bio_issue { + u64 value; +}; + +struct bio_vec { + struct page *bv_page; + unsigned int bv_len; + unsigned int bv_offset; +}; + +struct bio_crypt_ctx; + +struct bio_integrity_payload; + +struct bio { + struct bio *bi_next; + struct gendisk *bi_disk; + unsigned int bi_opf; + short unsigned int bi_flags; + short unsigned int bi_ioprio; + short unsigned int bi_write_hint; + blk_status_t bi_status; + u8 bi_partno; + atomic_t __bi_remaining; + struct bvec_iter bi_iter; + bio_end_io_t *bi_end_io; + void *bi_private; + struct blkcg_gq *bi_blkg; + struct bio_issue bi_issue; + u64 bi_iocost_cost; + struct bio_crypt_ctx *bi_crypt_context; + union { + struct bio_integrity_payload *bi_integrity; + }; + short unsigned int bi_vcnt; + short unsigned int bi_max_vecs; + atomic_t __bi_cnt; + struct bio_vec *bi_io_vec; + struct bio_set *bi_pool; + struct bio_vec bi_inline_vecs[0]; +}; + +struct linux_binprm { + struct vm_area_struct *vma; + long unsigned int vma_pages; + struct mm_struct *mm; + long unsigned int p; + long unsigned int argmin; + unsigned int have_execfd: 1; + unsigned int execfd_creds: 1; + unsigned int secureexec: 1; + unsigned int point_of_no_return: 1; + struct file *executable; + struct file *interpreter; + struct file *file; + struct cred *cred; + int unsafe; + unsigned int per_clear; + int argc; + int envc; + const char *filename; + const char *interp; + const char *fdpath; + unsigned int interp_flags; + int execfd; + long unsigned int loader; + long unsigned int exec; + struct rlimit rlim_stack; + char buf[256]; +}; + +struct coredump_params { + const kernel_siginfo_t *siginfo; + struct pt_regs *regs; + struct file *file; + long unsigned int limit; + long unsigned int mm_flags; + loff_t written; + loff_t pos; +}; + +struct em_perf_state { + long unsigned int frequency; + long unsigned int power; + long unsigned int cost; +}; + +struct em_perf_domain { + struct em_perf_state *table; + int nr_perf_states; + int milliwatts; + long unsigned int cpus[0]; +}; + +struct dev_pm_ops { + int (*prepare)(struct device *); + void (*complete)(struct device *); + int (*suspend)(struct device *); + int (*resume)(struct device *); + int (*freeze)(struct device *); + int (*thaw)(struct device *); + int (*poweroff)(struct device *); + int (*restore)(struct device *); + int (*suspend_late)(struct device *); + int (*resume_early)(struct device *); + int (*freeze_late)(struct device *); + int (*thaw_early)(struct device *); + int (*poweroff_late)(struct device *); + int (*restore_early)(struct device *); + int (*suspend_noirq)(struct device *); + int (*resume_noirq)(struct device *); + int (*freeze_noirq)(struct device *); + int (*thaw_noirq)(struct device *); + int (*poweroff_noirq)(struct device *); + int (*restore_noirq)(struct device *); + int (*runtime_suspend)(struct device *); + int (*runtime_resume)(struct device *); + int (*runtime_idle)(struct device *); +}; + +struct pm_domain_data; + +struct pm_subsys_data { + spinlock_t lock; + unsigned int refcount; + struct list_head clock_list; + struct pm_domain_data *domain_data; +}; + +struct wakeup_source { + const char *name; + int id; + struct list_head entry; + spinlock_t lock; + struct wake_irq *wakeirq; + struct timer_list timer; + long unsigned int timer_expires; + ktime_t total_time; + ktime_t max_time; + ktime_t last_time; + ktime_t start_prevent_time; + ktime_t prevent_sleep_time; + long unsigned int event_count; + long unsigned int active_count; + long unsigned int relax_count; + long unsigned int expire_count; + long unsigned int wakeup_count; + struct device *dev; + bool active: 1; + bool autosleep_enabled: 1; +}; + +struct dev_pm_domain { + struct dev_pm_ops ops; + int (*start)(struct device *); + void (*detach)(struct device *, bool); + int (*activate)(struct device *); + void (*sync)(struct device *); + void (*dismiss)(struct device *); +}; + +struct iommu_ops; + +struct subsys_private; + +struct bus_type { + const char *name; + const char *dev_name; + struct device *dev_root; + const struct attribute_group **bus_groups; + const struct attribute_group **dev_groups; + const struct attribute_group **drv_groups; + int (*match)(struct device *, struct device_driver *); + int (*uevent)(struct device *, struct kobj_uevent_env *); + int (*probe)(struct device *); + void (*sync_state)(struct device *); + int (*remove)(struct device *); + void (*shutdown)(struct device *); + int (*online)(struct device *); + int (*offline)(struct device *); + int (*suspend)(struct device *, pm_message_t); + int (*resume)(struct device *); + int (*num_vf)(struct device *); + int (*dma_configure)(struct device *); + const struct dev_pm_ops *pm; + const struct iommu_ops *iommu_ops; + struct subsys_private *p; + struct lock_class_key lock_key; + bool need_parent_lock; +}; + +enum probe_type { + PROBE_DEFAULT_STRATEGY = 0, + PROBE_PREFER_ASYNCHRONOUS = 1, + PROBE_FORCE_SYNCHRONOUS = 2, +}; + +struct of_device_id; + +struct acpi_device_id; + +struct driver_private; + +struct device_driver { + const char *name; + struct bus_type *bus; + struct module *owner; + const char *mod_name; + bool suppress_bind_attrs; + enum probe_type probe_type; + const struct of_device_id *of_match_table; + const struct acpi_device_id *acpi_match_table; + int (*probe)(struct device *); + void (*sync_state)(struct device *); + int (*remove)(struct device *); + void (*shutdown)(struct device *); + int (*suspend)(struct device *, pm_message_t); + int (*resume)(struct device *); + const struct attribute_group **groups; + const struct attribute_group **dev_groups; + const struct dev_pm_ops *pm; + void (*coredump)(struct device *); + struct driver_private *p; +}; + +enum iommu_cap { + IOMMU_CAP_CACHE_COHERENCY = 0, + IOMMU_CAP_INTR_REMAP = 1, + IOMMU_CAP_NOEXEC = 2, +}; + +enum iommu_attr { + DOMAIN_ATTR_GEOMETRY = 0, + DOMAIN_ATTR_PAGING = 1, + DOMAIN_ATTR_WINDOWS = 2, + DOMAIN_ATTR_FSL_PAMU_STASH = 3, + DOMAIN_ATTR_FSL_PAMU_ENABLE = 4, + DOMAIN_ATTR_FSL_PAMUV1 = 5, + DOMAIN_ATTR_NESTING = 6, + DOMAIN_ATTR_DMA_USE_FLUSH_QUEUE = 7, + DOMAIN_ATTR_IO_PGTABLE_CFG = 8, + DOMAIN_ATTR_MAX = 9, +}; + +enum iommu_dev_features { + IOMMU_DEV_FEAT_AUX = 0, + IOMMU_DEV_FEAT_SVA = 1, +}; + +struct iommu_domain; + +struct iommu_iotlb_gather; + +struct iommu_device; + +struct iommu_resv_region; + +struct of_phandle_args; + +struct iommu_sva; + +struct iommu_fault_event; + +struct iommu_page_response; + +struct iommu_cache_invalidate_info; + +struct iommu_gpasid_bind_data; + +struct iommu_ops { + bool (*capable)(enum iommu_cap); + struct iommu_domain * (*domain_alloc)(unsigned int); + void (*domain_free)(struct iommu_domain *); + int (*attach_dev)(struct iommu_domain *, struct device *); + void (*detach_dev)(struct iommu_domain *, struct device *); + int (*map)(struct iommu_domain *, long unsigned int, phys_addr_t, size_t, int, gfp_t); + size_t (*unmap)(struct iommu_domain *, long unsigned int, size_t, struct iommu_iotlb_gather *); + void (*flush_iotlb_all)(struct iommu_domain *); + void (*iotlb_sync_map)(struct iommu_domain *); + void (*iotlb_sync)(struct iommu_domain *, struct iommu_iotlb_gather *); + phys_addr_t (*iova_to_phys)(struct iommu_domain *, dma_addr_t); + struct iommu_device * (*probe_device)(struct device *); + void (*release_device)(struct device *); + void (*probe_finalize)(struct device *); + struct iommu_group * (*device_group)(struct device *); + int (*domain_get_attr)(struct iommu_domain *, enum iommu_attr, void *); + int (*domain_set_attr)(struct iommu_domain *, enum iommu_attr, void *); + void (*get_resv_regions)(struct device *, struct list_head *); + void (*put_resv_regions)(struct device *, struct list_head *); + void (*apply_resv_region)(struct device *, struct iommu_domain *, struct iommu_resv_region *); + int (*domain_window_enable)(struct iommu_domain *, u32, phys_addr_t, u64, int); + void (*domain_window_disable)(struct iommu_domain *, u32); + int (*of_xlate)(struct device *, struct of_phandle_args *); + bool (*is_attach_deferred)(struct iommu_domain *, struct device *); + bool (*dev_has_feat)(struct device *, enum iommu_dev_features); + bool (*dev_feat_enabled)(struct device *, enum iommu_dev_features); + int (*dev_enable_feat)(struct device *, enum iommu_dev_features); + int (*dev_disable_feat)(struct device *, enum iommu_dev_features); + int (*aux_attach_dev)(struct iommu_domain *, struct device *); + void (*aux_detach_dev)(struct iommu_domain *, struct device *); + int (*aux_get_pasid)(struct iommu_domain *, struct device *); + struct iommu_sva * (*sva_bind)(struct device *, struct mm_struct *, void *); + void (*sva_unbind)(struct iommu_sva *); + u32 (*sva_get_pasid)(struct iommu_sva *); + int (*page_response)(struct device *, struct iommu_fault_event *, struct iommu_page_response *); + int (*cache_invalidate)(struct iommu_domain *, struct device *, struct iommu_cache_invalidate_info *); + int (*sva_bind_gpasid)(struct iommu_domain *, struct device *, struct iommu_gpasid_bind_data *); + int (*sva_unbind_gpasid)(struct device *, u32); + int (*def_domain_type)(struct device *); + long unsigned int pgsize_bitmap; + struct module *owner; +}; + +struct device_type { + const char *name; + const struct attribute_group **groups; + int (*uevent)(struct device *, struct kobj_uevent_env *); + char * (*devnode)(struct device *, umode_t *, kuid_t *, kgid_t *); + void (*release)(struct device *); + const struct dev_pm_ops *pm; +}; + +struct class { + const char *name; + struct module *owner; + const struct attribute_group **class_groups; + const struct attribute_group **dev_groups; + struct kobject *dev_kobj; + int (*dev_uevent)(struct device *, struct kobj_uevent_env *); + char * (*devnode)(struct device *, umode_t *); + void (*class_release)(struct class *); + void (*dev_release)(struct device *); + int (*shutdown_pre)(struct device *); + const struct kobj_ns_type_operations *ns_type; + const void * (*namespace)(struct device *); + void (*get_ownership)(struct device *, kuid_t *, kgid_t *); + const struct dev_pm_ops *pm; + struct subsys_private *p; +}; + +struct of_device_id { + char name[32]; + char type[32]; + char compatible[128]; + const void *data; +}; + +typedef long unsigned int kernel_ulong_t; + +struct acpi_device_id { + __u8 id[9]; + kernel_ulong_t driver_data; + __u32 cls; + __u32 cls_msk; +}; + +struct device_dma_parameters { + unsigned int max_segment_size; + long unsigned int segment_boundary_mask; +}; + +enum dma_data_direction { + DMA_BIDIRECTIONAL = 0, + DMA_TO_DEVICE = 1, + DMA_FROM_DEVICE = 2, + DMA_NONE = 3, +}; + +struct sg_table; + +struct scatterlist; + +struct dma_map_ops { + void * (*alloc)(struct device *, size_t, dma_addr_t *, gfp_t, long unsigned int); + void (*free)(struct device *, size_t, void *, dma_addr_t, long unsigned int); + struct page * (*alloc_pages)(struct device *, size_t, dma_addr_t *, enum dma_data_direction, gfp_t); + void (*free_pages)(struct device *, size_t, struct page *, dma_addr_t, enum dma_data_direction); + void * (*alloc_noncoherent)(struct device *, size_t, dma_addr_t *, enum dma_data_direction, gfp_t); + void (*free_noncoherent)(struct device *, size_t, void *, dma_addr_t, enum dma_data_direction); + int (*mmap)(struct device *, struct vm_area_struct *, void *, dma_addr_t, size_t, long unsigned int); + int (*get_sgtable)(struct device *, struct sg_table *, void *, dma_addr_t, size_t, long unsigned int); + dma_addr_t (*map_page)(struct device *, struct page *, long unsigned int, size_t, enum dma_data_direction, long unsigned int); + void (*unmap_page)(struct device *, dma_addr_t, size_t, enum dma_data_direction, long unsigned int); + int (*map_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction, long unsigned int); + void (*unmap_sg)(struct device *, struct scatterlist *, int, enum dma_data_direction, long unsigned int); + dma_addr_t (*map_resource)(struct device *, phys_addr_t, size_t, enum dma_data_direction, long unsigned int); + void (*unmap_resource)(struct device *, dma_addr_t, size_t, enum dma_data_direction, long unsigned int); + void (*sync_single_for_cpu)(struct device *, dma_addr_t, size_t, enum dma_data_direction); + void (*sync_single_for_device)(struct device *, dma_addr_t, size_t, enum dma_data_direction); + void (*sync_sg_for_cpu)(struct device *, struct scatterlist *, int, enum dma_data_direction); + void (*sync_sg_for_device)(struct device *, struct scatterlist *, int, enum dma_data_direction); + void (*cache_sync)(struct device *, void *, size_t, enum dma_data_direction); + int (*dma_supported)(struct device *, u64); + u64 (*get_required_mask)(struct device *); + size_t (*max_mapping_size)(struct device *); + long unsigned int (*get_merge_boundary)(struct device *); +}; + +struct bus_dma_region { + phys_addr_t cpu_start; + dma_addr_t dma_start; + u64 size; + u64 offset; +}; + +typedef u32 phandle; + +struct fwnode_operations; + +struct fwnode_handle { + struct fwnode_handle *secondary; + const struct fwnode_operations *ops; + struct device *dev; + struct list_head suppliers; + struct list_head consumers; + u8 flags; +}; + +struct property; + +struct device_node { + const char *name; + phandle phandle; + const char *full_name; + struct fwnode_handle fwnode; + struct property *properties; + struct property *deadprops; + struct device_node *parent; + struct device_node *child; + struct device_node *sibling; + long unsigned int _flags; + void *data; +}; + +enum cpuhp_state { + CPUHP_INVALID = 4294967295, + CPUHP_OFFLINE = 0, + CPUHP_CREATE_THREADS = 1, + CPUHP_PERF_PREPARE = 2, + CPUHP_PERF_X86_PREPARE = 3, + CPUHP_PERF_X86_AMD_UNCORE_PREP = 4, + CPUHP_PERF_POWER = 5, + CPUHP_PERF_SUPERH = 6, + CPUHP_X86_HPET_DEAD = 7, + CPUHP_X86_APB_DEAD = 8, + CPUHP_X86_MCE_DEAD = 9, + CPUHP_VIRT_NET_DEAD = 10, + CPUHP_SLUB_DEAD = 11, + CPUHP_DEBUG_OBJ_DEAD = 12, + CPUHP_MM_WRITEBACK_DEAD = 13, + CPUHP_MM_VMSTAT_DEAD = 14, + CPUHP_SOFTIRQ_DEAD = 15, + CPUHP_NET_MVNETA_DEAD = 16, + CPUHP_CPUIDLE_DEAD = 17, + CPUHP_ARM64_FPSIMD_DEAD = 18, + CPUHP_ARM_OMAP_WAKE_DEAD = 19, + CPUHP_IRQ_POLL_DEAD = 20, + CPUHP_BLOCK_SOFTIRQ_DEAD = 21, + CPUHP_ACPI_CPUDRV_DEAD = 22, + CPUHP_S390_PFAULT_DEAD = 23, + CPUHP_BLK_MQ_DEAD = 24, + CPUHP_FS_BUFF_DEAD = 25, + CPUHP_PRINTK_DEAD = 26, + CPUHP_MM_MEMCQ_DEAD = 27, + CPUHP_PERCPU_CNT_DEAD = 28, + CPUHP_RADIX_DEAD = 29, + CPUHP_PAGE_ALLOC_DEAD = 30, + CPUHP_NET_DEV_DEAD = 31, + CPUHP_PCI_XGENE_DEAD = 32, + CPUHP_IOMMU_INTEL_DEAD = 33, + CPUHP_LUSTRE_CFS_DEAD = 34, + CPUHP_AP_ARM_CACHE_B15_RAC_DEAD = 35, + CPUHP_PADATA_DEAD = 36, + CPUHP_WORKQUEUE_PREP = 37, + CPUHP_POWER_NUMA_PREPARE = 38, + CPUHP_HRTIMERS_PREPARE = 39, + CPUHP_PROFILE_PREPARE = 40, + CPUHP_X2APIC_PREPARE = 41, + CPUHP_SMPCFD_PREPARE = 42, + CPUHP_RELAY_PREPARE = 43, + CPUHP_SLAB_PREPARE = 44, + CPUHP_MD_RAID5_PREPARE = 45, + CPUHP_RCUTREE_PREP = 46, + CPUHP_CPUIDLE_COUPLED_PREPARE = 47, + CPUHP_POWERPC_PMAC_PREPARE = 48, + CPUHP_POWERPC_MMU_CTX_PREPARE = 49, + CPUHP_XEN_PREPARE = 50, + CPUHP_XEN_EVTCHN_PREPARE = 51, + CPUHP_ARM_SHMOBILE_SCU_PREPARE = 52, + CPUHP_SH_SH3X_PREPARE = 53, + CPUHP_NET_FLOW_PREPARE = 54, + CPUHP_TOPOLOGY_PREPARE = 55, + CPUHP_NET_IUCV_PREPARE = 56, + CPUHP_ARM_BL_PREPARE = 57, + CPUHP_TRACE_RB_PREPARE = 58, + CPUHP_MM_ZS_PREPARE = 59, + CPUHP_MM_ZSWP_MEM_PREPARE = 60, + CPUHP_MM_ZSWP_POOL_PREPARE = 61, + CPUHP_KVM_PPC_BOOK3S_PREPARE = 62, + CPUHP_ZCOMP_PREPARE = 63, + CPUHP_TIMERS_PREPARE = 64, + CPUHP_MIPS_SOC_PREPARE = 65, + CPUHP_BP_PREPARE_DYN = 66, + CPUHP_BP_PREPARE_DYN_END = 86, + CPUHP_BRINGUP_CPU = 87, + CPUHP_AP_IDLE_DEAD = 88, + CPUHP_AP_OFFLINE = 89, + CPUHP_AP_SCHED_STARTING = 90, + CPUHP_AP_RCUTREE_DYING = 91, + CPUHP_AP_CPU_PM_STARTING = 92, + CPUHP_AP_IRQ_GIC_STARTING = 93, + CPUHP_AP_IRQ_HIP04_STARTING = 94, + CPUHP_AP_IRQ_ARMADA_XP_STARTING = 95, + CPUHP_AP_IRQ_BCM2836_STARTING = 96, + CPUHP_AP_IRQ_MIPS_GIC_STARTING = 97, + CPUHP_AP_IRQ_RISCV_STARTING = 98, + CPUHP_AP_IRQ_SIFIVE_PLIC_STARTING = 99, + CPUHP_AP_ARM_MVEBU_COHERENCY = 100, + CPUHP_AP_MICROCODE_LOADER = 101, + CPUHP_AP_PERF_X86_AMD_UNCORE_STARTING = 102, + CPUHP_AP_PERF_X86_STARTING = 103, + CPUHP_AP_PERF_X86_AMD_IBS_STARTING = 104, + CPUHP_AP_PERF_X86_CQM_STARTING = 105, + CPUHP_AP_PERF_X86_CSTATE_STARTING = 106, + CPUHP_AP_PERF_XTENSA_STARTING = 107, + CPUHP_AP_MIPS_OP_LOONGSON3_STARTING = 108, + CPUHP_AP_ARM_SDEI_STARTING = 109, + CPUHP_AP_ARM_VFP_STARTING = 110, + CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING = 111, + CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING = 112, + CPUHP_AP_PERF_ARM_ACPI_STARTING = 113, + CPUHP_AP_PERF_ARM_STARTING = 114, + CPUHP_AP_ARM_L2X0_STARTING = 115, + CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING = 116, + CPUHP_AP_ARM_ARCH_TIMER_STARTING = 117, + CPUHP_AP_ARM_GLOBAL_TIMER_STARTING = 118, + CPUHP_AP_JCORE_TIMER_STARTING = 119, + CPUHP_AP_ARM_TWD_STARTING = 120, + CPUHP_AP_QCOM_TIMER_STARTING = 121, + CPUHP_AP_TEGRA_TIMER_STARTING = 122, + CPUHP_AP_ARMADA_TIMER_STARTING = 123, + CPUHP_AP_MARCO_TIMER_STARTING = 124, + CPUHP_AP_MIPS_GIC_TIMER_STARTING = 125, + CPUHP_AP_ARC_TIMER_STARTING = 126, + CPUHP_AP_RISCV_TIMER_STARTING = 127, + CPUHP_AP_CLINT_TIMER_STARTING = 128, + CPUHP_AP_CSKY_TIMER_STARTING = 129, + CPUHP_AP_HYPERV_TIMER_STARTING = 130, + CPUHP_AP_KVM_STARTING = 131, + CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING = 132, + CPUHP_AP_KVM_ARM_VGIC_STARTING = 133, + CPUHP_AP_KVM_ARM_TIMER_STARTING = 134, + CPUHP_AP_DUMMY_TIMER_STARTING = 135, + CPUHP_AP_ARM_XEN_STARTING = 136, + CPUHP_AP_ARM_CORESIGHT_STARTING = 137, + CPUHP_AP_ARM_CORESIGHT_CTI_STARTING = 138, + CPUHP_AP_ARM64_ISNDEP_STARTING = 139, + CPUHP_AP_SMPCFD_DYING = 140, + CPUHP_AP_X86_TBOOT_DYING = 141, + CPUHP_AP_ARM_CACHE_B15_RAC_DYING = 142, + CPUHP_AP_ONLINE = 143, + CPUHP_TEARDOWN_CPU = 144, + CPUHP_AP_ONLINE_IDLE = 145, + CPUHP_AP_SCHED_WAIT_EMPTY = 146, + CPUHP_AP_SMPBOOT_THREADS = 147, + CPUHP_AP_X86_VDSO_VMA_ONLINE = 148, + CPUHP_AP_IRQ_AFFINITY_ONLINE = 149, + CPUHP_AP_BLK_MQ_ONLINE = 150, + CPUHP_AP_ARM_MVEBU_SYNC_CLOCKS = 151, + CPUHP_AP_X86_INTEL_EPB_ONLINE = 152, + CPUHP_AP_PERF_ONLINE = 153, + CPUHP_AP_PERF_X86_ONLINE = 154, + CPUHP_AP_PERF_X86_UNCORE_ONLINE = 155, + CPUHP_AP_PERF_X86_AMD_UNCORE_ONLINE = 156, + CPUHP_AP_PERF_X86_AMD_POWER_ONLINE = 157, + CPUHP_AP_PERF_X86_RAPL_ONLINE = 158, + CPUHP_AP_PERF_X86_CQM_ONLINE = 159, + CPUHP_AP_PERF_X86_CSTATE_ONLINE = 160, + CPUHP_AP_PERF_S390_CF_ONLINE = 161, + CPUHP_AP_PERF_S390_SF_ONLINE = 162, + CPUHP_AP_PERF_ARM_CCI_ONLINE = 163, + CPUHP_AP_PERF_ARM_CCN_ONLINE = 164, + CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE = 165, + CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE = 166, + CPUHP_AP_PERF_ARM_HISI_L3_ONLINE = 167, + CPUHP_AP_PERF_ARM_L2X0_ONLINE = 168, + CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE = 169, + CPUHP_AP_PERF_ARM_QCOM_L3_ONLINE = 170, + CPUHP_AP_PERF_ARM_APM_XGENE_ONLINE = 171, + CPUHP_AP_PERF_ARM_CAVIUM_TX2_UNCORE_ONLINE = 172, + CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE = 173, + CPUHP_AP_PERF_POWERPC_CORE_IMC_ONLINE = 174, + CPUHP_AP_PERF_POWERPC_THREAD_IMC_ONLINE = 175, + CPUHP_AP_PERF_POWERPC_TRACE_IMC_ONLINE = 176, + CPUHP_AP_PERF_POWERPC_HV_24x7_ONLINE = 177, + CPUHP_AP_PERF_POWERPC_HV_GPCI_ONLINE = 178, + CPUHP_AP_WATCHDOG_ONLINE = 179, + CPUHP_AP_WORKQUEUE_ONLINE = 180, + CPUHP_AP_RCUTREE_ONLINE = 181, + CPUHP_AP_BASE_CACHEINFO_ONLINE = 182, + CPUHP_AP_ONLINE_DYN = 183, + CPUHP_AP_ONLINE_DYN_END = 213, + CPUHP_AP_X86_HPET_ONLINE = 214, + CPUHP_AP_X86_KVM_CLK_ONLINE = 215, + CPUHP_AP_ACTIVE = 216, + CPUHP_ONLINE = 217, +}; + +struct static_call_mod { + struct static_call_mod *next; + struct module *mod; + struct static_call_site *sites; +}; + +struct ring_buffer_event { + u32 type_len: 5; + u32 time_delta: 27; + u32 array[0]; +}; + +struct seq_buf { + char *buffer; + size_t size; + size_t len; + loff_t readpos; +}; + +struct trace_seq { + char buffer[4096]; + struct seq_buf seq; + int full; +}; + +enum perf_sw_ids { + PERF_COUNT_SW_CPU_CLOCK = 0, + PERF_COUNT_SW_TASK_CLOCK = 1, + PERF_COUNT_SW_PAGE_FAULTS = 2, + PERF_COUNT_SW_CONTEXT_SWITCHES = 3, + PERF_COUNT_SW_CPU_MIGRATIONS = 4, + PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, + PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, + PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, + PERF_COUNT_SW_EMULATION_FAULTS = 8, + PERF_COUNT_SW_DUMMY = 9, + PERF_COUNT_SW_BPF_OUTPUT = 10, + PERF_COUNT_SW_MAX = 11, +}; + +union perf_mem_data_src { + __u64 val; + struct { + __u64 mem_op: 5; + __u64 mem_lvl: 14; + __u64 mem_snoop: 5; + __u64 mem_lock: 2; + __u64 mem_dtlb: 7; + __u64 mem_lvl_num: 4; + __u64 mem_remote: 1; + __u64 mem_snoopx: 2; + __u64 mem_rsvd: 24; + }; +}; + +struct perf_branch_entry { + __u64 from; + __u64 to; + __u64 mispred: 1; + __u64 predicted: 1; + __u64 in_tx: 1; + __u64 abort: 1; + __u64 cycles: 16; + __u64 type: 4; + __u64 reserved: 40; +}; + +struct new_utsname { + char sysname[65]; + char nodename[65]; + char release[65]; + char version[65]; + char machine[65]; + char domainname[65]; +}; + +struct uts_namespace { + struct new_utsname name; + struct user_namespace *user_ns; + struct ucounts *ucounts; + struct ns_common ns; +}; + +struct cgroup_namespace { + struct ns_common ns; + struct user_namespace *user_ns; + struct ucounts *ucounts; + struct css_set *root_cset; +}; + +struct nsset { + unsigned int flags; + struct nsproxy *nsproxy; + struct fs_struct *fs; + const struct cred *cred; +}; + +struct proc_ns_operations { + const char *name; + const char *real_ns_name; + int type; + struct ns_common * (*get)(struct task_struct *); + void (*put)(struct ns_common *); + int (*install)(struct nsset *, struct ns_common *); + struct user_namespace * (*owner)(struct ns_common *); + struct ns_common * (*get_parent)(struct ns_common *); +}; + +struct ucounts { + struct hlist_node node; + struct user_namespace *ns; + kuid_t uid; + int count; + atomic_t ucount[10]; +}; + +struct perf_cpu_context; + +struct perf_output_handle; + +struct pmu { + struct list_head entry; + struct module *module; + struct device *dev; + const struct attribute_group **attr_groups; + const struct attribute_group **attr_update; + const char *name; + int type; + int capabilities; + int *pmu_disable_count; + struct perf_cpu_context *pmu_cpu_context; + atomic_t exclusive_cnt; + int task_ctx_nr; + int hrtimer_interval_ms; + unsigned int nr_addr_filters; + void (*pmu_enable)(struct pmu *); + void (*pmu_disable)(struct pmu *); + int (*event_init)(struct perf_event *); + void (*event_mapped)(struct perf_event *, struct mm_struct *); + void (*event_unmapped)(struct perf_event *, struct mm_struct *); + int (*add)(struct perf_event *, int); + void (*del)(struct perf_event *, int); + void (*start)(struct perf_event *, int); + void (*stop)(struct perf_event *, int); + void (*read)(struct perf_event *); + void (*start_txn)(struct pmu *, unsigned int); + int (*commit_txn)(struct pmu *); + void (*cancel_txn)(struct pmu *); + int (*event_idx)(struct perf_event *); + void (*sched_task)(struct perf_event_context *, bool); + struct kmem_cache *task_ctx_cache; + void (*swap_task_ctx)(struct perf_event_context *, struct perf_event_context *); + void * (*setup_aux)(struct perf_event *, void **, int, bool); + void (*free_aux)(void *); + long int (*snapshot_aux)(struct perf_event *, struct perf_output_handle *, long unsigned int); + int (*addr_filters_validate)(struct list_head *); + void (*addr_filters_sync)(struct perf_event *); + int (*aux_output_match)(struct perf_event *); + int (*filter_match)(struct perf_event *); + int (*check_period)(struct perf_event *, u64); +}; + +struct ftrace_regs { + struct pt_regs regs; +}; + +struct iovec { + void *iov_base; + __kernel_size_t iov_len; +}; + +struct kvec { + void *iov_base; + size_t iov_len; +}; + +struct perf_regs { + __u64 abi; + struct pt_regs *regs; +}; + +struct u64_stats_sync {}; + +struct bpf_cgroup_storage_key { + __u64 cgroup_inode_id; + __u32 attach_type; +}; + +enum kmalloc_cache_type { + KMALLOC_NORMAL = 0, + KMALLOC_RECLAIM = 1, + KMALLOC_DMA = 2, + NR_KMALLOC_TYPES = 3, +}; + +struct bpf_cgroup_storage; + +struct bpf_prog_array_item { + struct bpf_prog *prog; + struct bpf_cgroup_storage *cgroup_storage[2]; +}; + +struct bpf_storage_buffer; + +struct bpf_cgroup_storage_map; + +struct bpf_cgroup_storage { + union { + struct bpf_storage_buffer *buf; + void *percpu_buf; + }; + struct bpf_cgroup_storage_map *map; + struct bpf_cgroup_storage_key key; + struct list_head list_map; + struct list_head list_cg; + struct rb_node node; + struct callback_head rcu; +}; + +struct bpf_prog_array { + struct callback_head rcu; + struct bpf_prog_array_item items[0]; +}; + +struct bpf_storage_buffer { + struct callback_head rcu; + char data[0]; +}; + +struct psi_group_cpu { + seqcount_t seq; + unsigned int tasks[4]; + u32 state_mask; + u32 times[6]; + u64 state_start; + long: 64; + u32 times_prev[12]; + long: 64; + long: 64; +}; + +struct cgroup_taskset; + +struct cftype; + +struct cgroup_subsys { + struct cgroup_subsys_state * (*css_alloc)(struct cgroup_subsys_state *); + int (*css_online)(struct cgroup_subsys_state *); + void (*css_offline)(struct cgroup_subsys_state *); + void (*css_released)(struct cgroup_subsys_state *); + void (*css_free)(struct cgroup_subsys_state *); + void (*css_reset)(struct cgroup_subsys_state *); + void (*css_rstat_flush)(struct cgroup_subsys_state *, int); + int (*css_extra_stat_show)(struct seq_file *, struct cgroup_subsys_state *); + int (*can_attach)(struct cgroup_taskset *); + void (*cancel_attach)(struct cgroup_taskset *); + void (*attach)(struct cgroup_taskset *); + void (*post_attach)(); + int (*can_fork)(struct task_struct *, struct css_set *); + void (*cancel_fork)(struct task_struct *, struct css_set *); + void (*fork)(struct task_struct *); + void (*exit)(struct task_struct *); + void (*release)(struct task_struct *); + void (*bind)(struct cgroup_subsys_state *); + bool early_init: 1; + bool implicit_on_dfl: 1; + bool threaded: 1; + int id; + const char *name; + const char *legacy_name; + struct cgroup_root *root; + struct idr css_idr; + struct list_head cfts; + struct cftype *dfl_cftypes; + struct cftype *legacy_cftypes; + unsigned int depends_on; +}; + +struct cgroup_rstat_cpu { + struct u64_stats_sync bsync; + struct cgroup_base_stat bstat; + struct cgroup_base_stat last_bstat; + struct cgroup *updated_children; + struct cgroup *updated_next; +}; + +struct cgroup_root { + struct kernfs_root *kf_root; + unsigned int subsys_mask; + int hierarchy_id; + struct cgroup cgrp; + u64 cgrp_ancestor_id_storage; + atomic_t nr_cgrps; + struct list_head root_list; + unsigned int flags; + char release_agent_path[4096]; + char name[64]; +}; + +struct cftype { + char name[64]; + long unsigned int private; + size_t max_write_len; + unsigned int flags; + unsigned int file_offset; + struct cgroup_subsys *ss; + struct list_head node; + struct kernfs_ops *kf_ops; + int (*open)(struct kernfs_open_file *); + void (*release)(struct kernfs_open_file *); + u64 (*read_u64)(struct cgroup_subsys_state *, struct cftype *); + s64 (*read_s64)(struct cgroup_subsys_state *, struct cftype *); + int (*seq_show)(struct seq_file *, void *); + void * (*seq_start)(struct seq_file *, loff_t *); + void * (*seq_next)(struct seq_file *, void *, loff_t *); + void (*seq_stop)(struct seq_file *, void *); + int (*write_u64)(struct cgroup_subsys_state *, struct cftype *, u64); + int (*write_s64)(struct cgroup_subsys_state *, struct cftype *, s64); + ssize_t (*write)(struct kernfs_open_file *, char *, size_t, loff_t); + __poll_t (*poll)(struct kernfs_open_file *, struct poll_table_struct *); +}; + +struct perf_callchain_entry { + __u64 nr; + __u64 ip[0]; +}; + +typedef long unsigned int (*perf_copy_f)(void *, const void *, long unsigned int, long unsigned int); + +struct perf_raw_frag { + union { + struct perf_raw_frag *next; + long unsigned int pad; + }; + perf_copy_f copy; + void *data; + u32 size; +} __attribute__((packed)); + +struct perf_raw_record { + struct perf_raw_frag frag; + u32 size; +}; + +struct perf_branch_stack { + __u64 nr; + __u64 hw_idx; + struct perf_branch_entry entries[0]; +}; + +struct perf_cpu_context { + struct perf_event_context ctx; + struct perf_event_context *task_ctx; + int active_oncpu; + int exclusive; + raw_spinlock_t hrtimer_lock; + struct hrtimer hrtimer; + ktime_t hrtimer_interval; + unsigned int hrtimer_active; + struct perf_cgroup *cgrp; + struct list_head cgrp_cpuctx_entry; + struct list_head sched_cb_entry; + int sched_cb_usage; + int online; + int heap_size; + struct perf_event **heap; + struct perf_event *heap_default[2]; +}; + +struct perf_output_handle { + struct perf_event *event; + struct perf_buffer *rb; + long unsigned int wakeup; + long unsigned int size; + u64 aux_flags; + union { + void *addr; + long unsigned int head; + }; + int page; +}; + +struct perf_addr_filter_range { + long unsigned int start; + long unsigned int size; +}; + +struct perf_sample_data { + u64 addr; + struct perf_raw_record *raw; + struct perf_branch_stack *br_stack; + u64 period; + u64 weight; + u64 txn; + union perf_mem_data_src data_src; + u64 type; + u64 ip; + struct { + u32 pid; + u32 tid; + } tid_entry; + u64 time; + u64 id; + u64 stream_id; + struct { + u32 cpu; + u32 reserved; + } cpu_entry; + struct perf_callchain_entry *callchain; + u64 aux_size; + struct perf_regs regs_user; + struct perf_regs regs_intr; + u64 stack_user_size; + u64 phys_addr; + u64 cgroup; + u64 data_page_size; + u64 code_page_size; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct perf_cgroup_info; + +struct perf_cgroup { + struct cgroup_subsys_state css; + struct perf_cgroup_info *info; +}; + +struct perf_cgroup_info { + u64 time; + u64 timestamp; +}; + +struct trace_entry { + short unsigned int type; + unsigned char flags; + unsigned char preempt_count; + int pid; +}; + +struct trace_array; + +struct tracer; + +struct array_buffer; + +struct ring_buffer_iter; + +struct trace_iterator { + struct trace_array *tr; + struct tracer *trace; + struct array_buffer *array_buffer; + void *private; + int cpu_file; + struct mutex mutex; + struct ring_buffer_iter **buffer_iter; + long unsigned int iter_flags; + void *temp; + unsigned int temp_size; + struct trace_seq tmp_seq; + cpumask_var_t started; + bool snapshot; + struct trace_seq seq; + struct trace_entry *ent; + long unsigned int lost_events; + int leftover; + int ent_size; + int cpu; + u64 ts; + loff_t pos; + long int idx; +}; + +enum print_line_t { + TRACE_TYPE_PARTIAL_LINE = 0, + TRACE_TYPE_HANDLED = 1, + TRACE_TYPE_UNHANDLED = 2, + TRACE_TYPE_NO_CONSUME = 3, +}; + +typedef enum print_line_t (*trace_print_func)(struct trace_iterator *, int, struct trace_event *); + +struct trace_event_functions { + trace_print_func trace; + trace_print_func raw; + trace_print_func hex; + trace_print_func binary; +}; + +enum trace_reg { + TRACE_REG_REGISTER = 0, + TRACE_REG_UNREGISTER = 1, + TRACE_REG_PERF_REGISTER = 2, + TRACE_REG_PERF_UNREGISTER = 3, + TRACE_REG_PERF_OPEN = 4, + TRACE_REG_PERF_CLOSE = 5, + TRACE_REG_PERF_ADD = 6, + TRACE_REG_PERF_DEL = 7, +}; + +struct trace_event_fields { + const char *type; + union { + struct { + const char *name; + const int size; + const int align; + const int is_signed; + const int filter_type; + }; + int (*define_fields)(struct trace_event_call *); + }; +}; + +struct trace_event_class { + const char *system; + void *probe; + void *perf_probe; + int (*reg)(struct trace_event_call *, enum trace_reg, void *); + struct trace_event_fields *fields_array; + struct list_head * (*get_fields)(struct trace_event_call *); + struct list_head fields; + int (*raw_init)(struct trace_event_call *); +}; + +struct trace_buffer; + +struct trace_event_file; + +struct trace_event_buffer { + struct trace_buffer *buffer; + struct ring_buffer_event *event; + struct trace_event_file *trace_file; + void *entry; + long unsigned int flags; + int pc; + struct pt_regs *regs; +}; + +struct trace_subsystem_dir; + +struct trace_event_file { + struct list_head list; + struct trace_event_call *event_call; + struct event_filter *filter; + struct dentry *dir; + struct trace_array *tr; + struct trace_subsystem_dir *system; + struct list_head triggers; + long unsigned int flags; + atomic_t sm_ref; + atomic_t tm_ref; +}; + +enum { + TRACE_EVENT_FL_FILTERED_BIT = 0, + TRACE_EVENT_FL_CAP_ANY_BIT = 1, + TRACE_EVENT_FL_NO_SET_FILTER_BIT = 2, + TRACE_EVENT_FL_IGNORE_ENABLE_BIT = 3, + TRACE_EVENT_FL_TRACEPOINT_BIT = 4, + TRACE_EVENT_FL_KPROBE_BIT = 5, + TRACE_EVENT_FL_UPROBE_BIT = 6, +}; + +enum { + TRACE_EVENT_FL_FILTERED = 1, + TRACE_EVENT_FL_CAP_ANY = 2, + TRACE_EVENT_FL_NO_SET_FILTER = 4, + TRACE_EVENT_FL_IGNORE_ENABLE = 8, + TRACE_EVENT_FL_TRACEPOINT = 16, + TRACE_EVENT_FL_KPROBE = 32, + TRACE_EVENT_FL_UPROBE = 64, +}; + +enum { + EVENT_FILE_FL_ENABLED_BIT = 0, + EVENT_FILE_FL_RECORDED_CMD_BIT = 1, + EVENT_FILE_FL_RECORDED_TGID_BIT = 2, + EVENT_FILE_FL_FILTERED_BIT = 3, + EVENT_FILE_FL_NO_SET_FILTER_BIT = 4, + EVENT_FILE_FL_SOFT_MODE_BIT = 5, + EVENT_FILE_FL_SOFT_DISABLED_BIT = 6, + EVENT_FILE_FL_TRIGGER_MODE_BIT = 7, + EVENT_FILE_FL_TRIGGER_COND_BIT = 8, + EVENT_FILE_FL_PID_FILTER_BIT = 9, + EVENT_FILE_FL_WAS_ENABLED_BIT = 10, +}; + +enum { + EVENT_FILE_FL_ENABLED = 1, + EVENT_FILE_FL_RECORDED_CMD = 2, + EVENT_FILE_FL_RECORDED_TGID = 4, + EVENT_FILE_FL_FILTERED = 8, + EVENT_FILE_FL_NO_SET_FILTER = 16, + EVENT_FILE_FL_SOFT_MODE = 32, + EVENT_FILE_FL_SOFT_DISABLED = 64, + EVENT_FILE_FL_TRIGGER_MODE = 128, + EVENT_FILE_FL_TRIGGER_COND = 256, + EVENT_FILE_FL_PID_FILTER = 512, + EVENT_FILE_FL_WAS_ENABLED = 1024, +}; + +enum event_trigger_type { + ETT_NONE = 0, + ETT_TRACE_ONOFF = 1, + ETT_SNAPSHOT = 2, + ETT_STACKTRACE = 4, + ETT_EVENT_ENABLE = 8, + ETT_EVENT_HIST = 16, + ETT_HIST_ENABLE = 32, +}; + +enum { + FILTER_OTHER = 0, + FILTER_STATIC_STRING = 1, + FILTER_DYN_STRING = 2, + FILTER_PTR_STRING = 3, + FILTER_TRACE_FN = 4, + FILTER_COMM = 5, + FILTER_CPU = 6, +}; + +struct fwnode_reference_args; + +struct fwnode_endpoint; + +struct fwnode_operations { + struct fwnode_handle * (*get)(struct fwnode_handle *); + void (*put)(struct fwnode_handle *); + bool (*device_is_available)(const struct fwnode_handle *); + const void * (*device_get_match_data)(const struct fwnode_handle *, const struct device *); + bool (*property_present)(const struct fwnode_handle *, const char *); + int (*property_read_int_array)(const struct fwnode_handle *, const char *, unsigned int, void *, size_t); + int (*property_read_string_array)(const struct fwnode_handle *, const char *, const char **, size_t); + const char * (*get_name)(const struct fwnode_handle *); + const char * (*get_name_prefix)(const struct fwnode_handle *); + struct fwnode_handle * (*get_parent)(const struct fwnode_handle *); + struct fwnode_handle * (*get_next_child_node)(const struct fwnode_handle *, struct fwnode_handle *); + struct fwnode_handle * (*get_named_child_node)(const struct fwnode_handle *, const char *); + int (*get_reference_args)(const struct fwnode_handle *, const char *, const char *, unsigned int, unsigned int, struct fwnode_reference_args *); + struct fwnode_handle * (*graph_get_next_endpoint)(const struct fwnode_handle *, struct fwnode_handle *); + struct fwnode_handle * (*graph_get_remote_endpoint)(const struct fwnode_handle *); + struct fwnode_handle * (*graph_get_port_parent)(struct fwnode_handle *); + int (*graph_parse_endpoint)(const struct fwnode_handle *, struct fwnode_endpoint *); + int (*add_links)(struct fwnode_handle *); +}; + +struct fwnode_endpoint { + unsigned int port; + unsigned int id; + const struct fwnode_handle *local_fwnode; +}; + +struct fwnode_reference_args { + struct fwnode_handle *fwnode; + unsigned int nargs; + u64 args[8]; +}; + +struct property { + char *name; + int length; + void *value; + struct property *next; +}; + +struct irq_fwspec { + struct fwnode_handle *fwnode; + int param_count; + u32 param[16]; +}; + +struct irq_data; + +struct irq_domain_ops { + int (*match)(struct irq_domain *, struct device_node *, enum irq_domain_bus_token); + int (*select)(struct irq_domain *, struct irq_fwspec *, enum irq_domain_bus_token); + int (*map)(struct irq_domain *, unsigned int, irq_hw_number_t); + void (*unmap)(struct irq_domain *, unsigned int); + int (*xlate)(struct irq_domain *, struct device_node *, const u32 *, unsigned int, long unsigned int *, unsigned int *); + int (*alloc)(struct irq_domain *, unsigned int, unsigned int, void *); + void (*free)(struct irq_domain *, unsigned int, unsigned int); + int (*activate)(struct irq_domain *, struct irq_data *, bool); + void (*deactivate)(struct irq_domain *, struct irq_data *); + int (*translate)(struct irq_domain *, struct irq_fwspec *, long unsigned int *, unsigned int *); +}; + +struct xbc_node { + u16 next; + u16 child; + u16 parent; + u16 data; +}; + +enum wb_stat_item { + WB_RECLAIMABLE = 0, + WB_WRITEBACK = 1, + WB_DIRTIED = 2, + WB_WRITTEN = 3, + NR_WB_STAT_ITEMS = 4, +}; + +struct disk_part_tbl; + +struct block_device_operations; + +struct timer_rand_state; + +struct disk_events; + +struct cdrom_device_info; + +struct badblocks; + +struct gendisk { + int major; + int first_minor; + int minors; + char disk_name[32]; + short unsigned int events; + short unsigned int event_flags; + struct disk_part_tbl *part_tbl; + struct block_device *part0; + const struct block_device_operations *fops; + struct request_queue *queue; + void *private_data; + int flags; + long unsigned int state; + struct kobject *slave_dir; + struct timer_rand_state *random; + atomic_t sync_io; + struct disk_events *ev; + struct kobject integrity_kobj; + struct cdrom_device_info *cdi; + int node_id; + struct badblocks *bb; + struct lockdep_map lockdep_map; +}; + +struct partition_meta_info { + char uuid[37]; + u8 volname[64]; +}; + +struct bio_integrity_payload { + struct bio *bip_bio; + struct bvec_iter bip_iter; + short unsigned int bip_slab; + short unsigned int bip_vcnt; + short unsigned int bip_max_vcnt; + short unsigned int bip_flags; + struct bvec_iter bio_iter; + struct work_struct bip_work; + struct bio_vec *bip_vec; + struct bio_vec bip_inline_vecs[0]; +}; + +struct blkg_iostat { + u64 bytes[3]; + u64 ios[3]; +}; + +struct blkg_iostat_set { + struct u64_stats_sync sync; + struct blkg_iostat cur; + struct blkg_iostat last; +}; + +struct blkcg; + +struct blkg_policy_data; + +struct blkcg_gq { + struct request_queue *q; + struct list_head q_node; + struct hlist_node blkcg_node; + struct blkcg *blkcg; + struct blkcg_gq *parent; + struct percpu_ref refcnt; + bool online; + struct blkg_iostat_set *iostat_cpu; + struct blkg_iostat_set iostat; + struct blkg_policy_data *pd[5]; + spinlock_t async_bio_lock; + struct bio_list async_bios; + struct work_struct async_bio_work; + atomic_t use_delay; + atomic64_t delay_nsec; + atomic64_t delay_start; + u64 last_delay; + int last_use; + struct callback_head callback_head; +}; + +typedef unsigned int blk_qc_t; + +struct disk_part_tbl { + struct callback_head callback_head; + int len; + struct block_device *last_lookup; + struct block_device *part[0]; +}; + +struct blk_integrity_iter; + +typedef blk_status_t integrity_processing_fn(struct blk_integrity_iter *); + +typedef void integrity_prepare_fn(struct request *); + +typedef void integrity_complete_fn(struct request *, unsigned int); + +struct blk_integrity_profile { + integrity_processing_fn *generate_fn; + integrity_processing_fn *verify_fn; + integrity_prepare_fn *prepare_fn; + integrity_complete_fn *complete_fn; + const char *name; +}; + +struct blk_zone; + +typedef int (*report_zones_cb)(struct blk_zone *, unsigned int, void *); + +struct hd_geometry; + +struct pr_ops; + +struct block_device_operations { + blk_qc_t (*submit_bio)(struct bio *); + int (*open)(struct block_device *, fmode_t); + void (*release)(struct gendisk *, fmode_t); + int (*rw_page)(struct block_device *, sector_t, struct page *, unsigned int); + int (*ioctl)(struct block_device *, fmode_t, unsigned int, long unsigned int); + int (*compat_ioctl)(struct block_device *, fmode_t, unsigned int, long unsigned int); + unsigned int (*check_events)(struct gendisk *, unsigned int); + void (*unlock_native_capacity)(struct gendisk *); + int (*revalidate_disk)(struct gendisk *); + int (*getgeo)(struct block_device *, struct hd_geometry *); + int (*set_read_only)(struct block_device *, bool); + void (*swap_slot_free_notify)(struct block_device *, long unsigned int); + int (*report_zones)(struct gendisk *, sector_t, unsigned int, report_zones_cb, void *); + char * (*devnode)(struct gendisk *, umode_t *); + struct module *owner; + const struct pr_ops *pr_ops; +}; + +struct sg_io_v4 { + __s32 guard; + __u32 protocol; + __u32 subprotocol; + __u32 request_len; + __u64 request; + __u64 request_tag; + __u32 request_attr; + __u32 request_priority; + __u32 request_extra; + __u32 max_response_len; + __u64 response; + __u32 dout_iovec_count; + __u32 dout_xfer_len; + __u32 din_iovec_count; + __u32 din_xfer_len; + __u64 dout_xferp; + __u64 din_xferp; + __u32 timeout; + __u32 flags; + __u64 usr_ptr; + __u32 spare_in; + __u32 driver_status; + __u32 transport_status; + __u32 device_status; + __u32 retry_delay; + __u32 info; + __u32 duration; + __u32 response_len; + __s32 din_resid; + __s32 dout_resid; + __u64 generated_tag; + __u32 spare_out; + __u32 padding; +}; + +struct bsg_ops { + int (*check_proto)(struct sg_io_v4 *); + int (*fill_hdr)(struct request *, struct sg_io_v4 *, fmode_t); + int (*complete_rq)(struct request *, struct sg_io_v4 *); + void (*free_rq)(struct request *); +}; + +typedef __u32 req_flags_t; + +typedef void rq_end_io_fn(struct request *, blk_status_t); + +enum mq_rq_state { + MQ_RQ_IDLE = 0, + MQ_RQ_IN_FLIGHT = 1, + MQ_RQ_COMPLETE = 2, +}; + +struct blk_ksm_keyslot; + +struct request { + struct request_queue *q; + struct blk_mq_ctx *mq_ctx; + struct blk_mq_hw_ctx *mq_hctx; + unsigned int cmd_flags; + req_flags_t rq_flags; + int tag; + int internal_tag; + unsigned int __data_len; + sector_t __sector; + struct bio *bio; + struct bio *biotail; + struct list_head queuelist; + union { + struct hlist_node hash; + struct list_head ipi_list; + }; + union { + struct rb_node rb_node; + struct bio_vec special_vec; + void *completion_data; + int error_count; + }; + union { + struct { + struct io_cq *icq; + void *priv[2]; + } elv; + struct { + unsigned int seq; + struct list_head list; + rq_end_io_fn *saved_end_io; + } flush; + }; + struct gendisk *rq_disk; + struct block_device *part; + u64 alloc_time_ns; + u64 start_time_ns; + u64 io_start_time_ns; + short unsigned int wbt_flags; + short unsigned int stats_sectors; + short unsigned int nr_phys_segments; + short unsigned int nr_integrity_segments; + struct bio_crypt_ctx *crypt_ctx; + struct blk_ksm_keyslot *crypt_keyslot; + short unsigned int write_hint; + short unsigned int ioprio; + enum mq_rq_state state; + refcount_t ref; + unsigned int timeout; + long unsigned int deadline; + union { + struct __call_single_data csd; + u64 fifo_time; + }; + rq_end_io_fn *end_io; + void *end_io_data; +}; + +struct blk_zone { + __u64 start; + __u64 len; + __u64 wp; + __u8 type; + __u8 cond; + __u8 non_seq; + __u8 reset; + __u8 resv[4]; + __u64 capacity; + __u8 reserved[24]; +}; + +enum elv_merge { + ELEVATOR_NO_MERGE = 0, + ELEVATOR_FRONT_MERGE = 1, + ELEVATOR_BACK_MERGE = 2, + ELEVATOR_DISCARD_MERGE = 3, +}; + +struct elevator_type; + +struct blk_mq_alloc_data; + +struct elevator_mq_ops { + int (*init_sched)(struct request_queue *, struct elevator_type *); + void (*exit_sched)(struct elevator_queue *); + int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int); + void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int); + void (*depth_updated)(struct blk_mq_hw_ctx *); + bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); + bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *, unsigned int); + int (*request_merge)(struct request_queue *, struct request **, struct bio *); + void (*request_merged)(struct request_queue *, struct request *, enum elv_merge); + void (*requests_merged)(struct request_queue *, struct request *, struct request *); + void (*limit_depth)(unsigned int, struct blk_mq_alloc_data *); + void (*prepare_request)(struct request *); + void (*finish_request)(struct request *); + void (*insert_requests)(struct blk_mq_hw_ctx *, struct list_head *, bool); + struct request * (*dispatch_request)(struct blk_mq_hw_ctx *); + bool (*has_work)(struct blk_mq_hw_ctx *); + void (*completed_request)(struct request *, u64); + void (*requeue_request)(struct request *); + struct request * (*former_request)(struct request_queue *, struct request *); + struct request * (*next_request)(struct request_queue *, struct request *); + void (*init_icq)(struct io_cq *); + void (*exit_icq)(struct io_cq *); +}; + +struct elv_fs_entry; + +struct blk_mq_debugfs_attr; + +struct elevator_type { + struct kmem_cache *icq_cache; + struct elevator_mq_ops ops; + size_t icq_size; + size_t icq_align; + struct elv_fs_entry *elevator_attrs; + const char *elevator_name; + const char *elevator_alias; + const unsigned int elevator_features; + struct module *elevator_owner; + const struct blk_mq_debugfs_attr *queue_debugfs_attrs; + const struct blk_mq_debugfs_attr *hctx_debugfs_attrs; + char icq_cache_name[22]; + struct list_head list; +}; + +struct elevator_queue { + struct elevator_type *type; + void *elevator_data; + struct kobject kobj; + struct mutex sysfs_lock; + unsigned int registered: 1; + struct hlist_head hash[64]; +}; + +struct elv_fs_entry { + struct attribute attr; + ssize_t (*show)(struct elevator_queue *, char *); + ssize_t (*store)(struct elevator_queue *, const char *, size_t); +}; + +struct blk_mq_debugfs_attr { + const char *name; + umode_t mode; + int (*show)(void *, struct seq_file *); + ssize_t (*write)(void *, const char *, size_t, loff_t *); + const struct seq_operations *seq_ops; +}; + +enum blk_eh_timer_return { + BLK_EH_DONE = 0, + BLK_EH_RESET_TIMER = 1, +}; + +struct blk_mq_queue_data; + +struct blk_mq_ops { + blk_status_t (*queue_rq)(struct blk_mq_hw_ctx *, const struct blk_mq_queue_data *); + void (*commit_rqs)(struct blk_mq_hw_ctx *); + bool (*get_budget)(struct request_queue *); + void (*put_budget)(struct request_queue *); + enum blk_eh_timer_return (*timeout)(struct request *, bool); + int (*poll)(struct blk_mq_hw_ctx *); + void (*complete)(struct request *); + int (*init_hctx)(struct blk_mq_hw_ctx *, void *, unsigned int); + void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int); + int (*init_request)(struct blk_mq_tag_set *, struct request *, unsigned int, unsigned int); + void (*exit_request)(struct blk_mq_tag_set *, struct request *, unsigned int); + void (*initialize_rq_fn)(struct request *); + void (*cleanup_rq)(struct request *); + bool (*busy)(struct request_queue *); + int (*map_queues)(struct blk_mq_tag_set *); + void (*show_rq)(struct seq_file *, struct request *); +}; + +struct blk_integrity_iter { + void *prot_buf; + void *data_buf; + sector_t seed; + unsigned int data_size; + short unsigned int interval; + const char *disk_name; +}; + +enum pr_type { + PR_WRITE_EXCLUSIVE = 1, + PR_EXCLUSIVE_ACCESS = 2, + PR_WRITE_EXCLUSIVE_REG_ONLY = 3, + PR_EXCLUSIVE_ACCESS_REG_ONLY = 4, + PR_WRITE_EXCLUSIVE_ALL_REGS = 5, + PR_EXCLUSIVE_ACCESS_ALL_REGS = 6, +}; + +struct pr_ops { + int (*pr_register)(struct block_device *, u64, u64, u32); + int (*pr_reserve)(struct block_device *, u64, enum pr_type, u32); + int (*pr_release)(struct block_device *, u64, enum pr_type); + int (*pr_preempt)(struct block_device *, u64, u64, enum pr_type, bool); + int (*pr_clear)(struct block_device *, u64); +}; + +enum blkg_iostat_type { + BLKG_IOSTAT_READ = 0, + BLKG_IOSTAT_WRITE = 1, + BLKG_IOSTAT_DISCARD = 2, + BLKG_IOSTAT_NR = 3, +}; + +struct blkcg_policy_data; + +struct blkcg { + struct cgroup_subsys_state css; + spinlock_t lock; + refcount_t online_pin; + struct xarray blkg_tree; + struct blkcg_gq *blkg_hint; + struct hlist_head blkg_list; + struct blkcg_policy_data *cpd[5]; + struct list_head all_blkcgs_node; + struct list_head cgwb_list; +}; + +struct blkcg_policy_data { + struct blkcg *blkcg; + int plid; +}; + +struct blkg_policy_data { + struct blkcg_gq *blkg; + int plid; +}; + +typedef long unsigned int efi_status_t; + +typedef u8 efi_bool_t; + +typedef u16 efi_char16_t; + +typedef guid_t efi_guid_t; + +typedef struct { + u64 signature; + u32 revision; + u32 headersize; + u32 crc32; + u32 reserved; +} efi_table_hdr_t; + +typedef struct { + u32 type; + u32 pad; + u64 phys_addr; + u64 virt_addr; + u64 num_pages; + u64 attribute; +} efi_memory_desc_t; + +typedef struct { + efi_guid_t guid; + u32 headersize; + u32 flags; + u32 imagesize; +} efi_capsule_header_t; + +typedef struct { + u16 year; + u8 month; + u8 day; + u8 hour; + u8 minute; + u8 second; + u8 pad1; + u32 nanosecond; + s16 timezone; + u8 daylight; + u8 pad2; +} efi_time_t; + +typedef struct { + u32 resolution; + u32 accuracy; + u8 sets_to_zero; +} efi_time_cap_t; + +typedef struct { + efi_table_hdr_t hdr; + u32 get_time; + u32 set_time; + u32 get_wakeup_time; + u32 set_wakeup_time; + u32 set_virtual_address_map; + u32 convert_pointer; + u32 get_variable; + u32 get_next_variable; + u32 set_variable; + u32 get_next_high_mono_count; + u32 reset_system; + u32 update_capsule; + u32 query_capsule_caps; + u32 query_variable_info; +} efi_runtime_services_32_t; + +typedef efi_status_t efi_get_time_t(efi_time_t *, efi_time_cap_t *); + +typedef efi_status_t efi_set_time_t(efi_time_t *); + +typedef efi_status_t efi_get_wakeup_time_t(efi_bool_t *, efi_bool_t *, efi_time_t *); + +typedef efi_status_t efi_set_wakeup_time_t(efi_bool_t, efi_time_t *); + +typedef efi_status_t efi_get_variable_t(efi_char16_t *, efi_guid_t *, u32 *, long unsigned int *, void *); + +typedef efi_status_t efi_get_next_variable_t(long unsigned int *, efi_char16_t *, efi_guid_t *); + +typedef efi_status_t efi_set_variable_t(efi_char16_t *, efi_guid_t *, u32, long unsigned int, void *); + +typedef efi_status_t efi_get_next_high_mono_count_t(u32 *); + +typedef void efi_reset_system_t(int, efi_status_t, long unsigned int, efi_char16_t *); + +typedef efi_status_t efi_query_variable_info_t(u32, u64 *, u64 *, u64 *); + +typedef efi_status_t efi_update_capsule_t(efi_capsule_header_t **, long unsigned int, long unsigned int); + +typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **, long unsigned int, u64 *, int *); + +typedef union { + struct { + efi_table_hdr_t hdr; + efi_status_t (*get_time)(efi_time_t *, efi_time_cap_t *); + efi_status_t (*set_time)(efi_time_t *); + efi_status_t (*get_wakeup_time)(efi_bool_t *, efi_bool_t *, efi_time_t *); + efi_status_t (*set_wakeup_time)(efi_bool_t, efi_time_t *); + efi_status_t (*set_virtual_address_map)(long unsigned int, long unsigned int, u32, efi_memory_desc_t *); + void *convert_pointer; + efi_status_t (*get_variable)(efi_char16_t *, efi_guid_t *, u32 *, long unsigned int *, void *); + efi_status_t (*get_next_variable)(long unsigned int *, efi_char16_t *, efi_guid_t *); + efi_status_t (*set_variable)(efi_char16_t *, efi_guid_t *, u32, long unsigned int, void *); + efi_status_t (*get_next_high_mono_count)(u32 *); + void (*reset_system)(int, efi_status_t, long unsigned int, efi_char16_t *); + efi_status_t (*update_capsule)(efi_capsule_header_t **, long unsigned int, long unsigned int); + efi_status_t (*query_capsule_caps)(efi_capsule_header_t **, long unsigned int, u64 *, int *); + efi_status_t (*query_variable_info)(u32, u64 *, u64 *, u64 *); + }; + efi_runtime_services_32_t mixed_mode; +} efi_runtime_services_t; + +struct efi_memory_map { + phys_addr_t phys_map; + void *map; + void *map_end; + int nr_map; + long unsigned int desc_version; + long unsigned int desc_size; + long unsigned int flags; +}; + +struct efi { + const efi_runtime_services_t *runtime; + unsigned int runtime_version; + unsigned int runtime_supported_mask; + long unsigned int acpi; + long unsigned int acpi20; + long unsigned int smbios; + long unsigned int smbios3; + long unsigned int esrt; + long unsigned int tpm_log; + long unsigned int tpm_final_log; + long unsigned int mokvar_table; + efi_get_time_t *get_time; + efi_set_time_t *set_time; + efi_get_wakeup_time_t *get_wakeup_time; + efi_set_wakeup_time_t *set_wakeup_time; + efi_get_variable_t *get_variable; + efi_get_next_variable_t *get_next_variable; + efi_set_variable_t *set_variable; + efi_set_variable_t *set_variable_nonblocking; + efi_query_variable_info_t *query_variable_info; + efi_query_variable_info_t *query_variable_info_nonblocking; + efi_update_capsule_t *update_capsule; + efi_query_capsule_caps_t *query_capsule_caps; + efi_get_next_high_mono_count_t *get_next_high_mono_count; + efi_reset_system_t *reset_system; + struct efi_memory_map memmap; + long unsigned int flags; +}; + +enum memcg_stat_item { + MEMCG_SWAP = 38, + MEMCG_SOCK = 39, + MEMCG_PERCPU_B = 40, + MEMCG_NR_STAT = 41, +}; + +enum memcg_memory_event { + MEMCG_LOW = 0, + MEMCG_HIGH = 1, + MEMCG_MAX = 2, + MEMCG_OOM = 3, + MEMCG_OOM_KILL = 4, + MEMCG_SWAP_HIGH = 5, + MEMCG_SWAP_MAX = 6, + MEMCG_SWAP_FAIL = 7, + MEMCG_NR_MEMORY_EVENTS = 8, +}; + +enum mem_cgroup_events_target { + MEM_CGROUP_TARGET_THRESH = 0, + MEM_CGROUP_TARGET_SOFTLIMIT = 1, + MEM_CGROUP_NTARGETS = 2, +}; + +struct memcg_vmstats_percpu { + long int stat[41]; + long unsigned int events[96]; + long unsigned int nr_page_events; + long unsigned int targets[2]; +}; + +struct mem_cgroup_reclaim_iter { + struct mem_cgroup *position; + unsigned int generation; +}; + +struct lruvec_stat { + long int count[38]; +}; + +struct memcg_shrinker_map { + struct callback_head rcu; + long unsigned int map[0]; +}; + +struct mem_cgroup_per_node { + struct lruvec lruvec; + struct lruvec_stat *lruvec_stat_local; + struct lruvec_stat *lruvec_stat_cpu; + atomic_long_t lruvec_stat[38]; + long unsigned int lru_zone_size[25]; + struct mem_cgroup_reclaim_iter iter; + struct memcg_shrinker_map *shrinker_map; + struct rb_node tree_node; + long unsigned int usage_in_excess; + bool on_tree; + struct mem_cgroup *memcg; +}; + +struct eventfd_ctx; + +struct mem_cgroup_threshold { + struct eventfd_ctx *eventfd; + long unsigned int threshold; +}; + +struct mem_cgroup_threshold_ary { + int current_threshold; + unsigned int size; + struct mem_cgroup_threshold entries[0]; +}; + +struct obj_cgroup { + struct percpu_ref refcnt; + struct mem_cgroup *memcg; + atomic_t nr_charged_bytes; + union { + struct list_head list; + struct callback_head rcu; + }; +}; + +struct percpu_cluster { + struct swap_cluster_info index; + unsigned int next; +}; + +enum fs_value_type { + fs_value_is_undefined = 0, + fs_value_is_flag = 1, + fs_value_is_string = 2, + fs_value_is_blob = 3, + fs_value_is_filename = 4, + fs_value_is_file = 5, +}; + +struct fs_parameter { + const char *key; + enum fs_value_type type: 8; + union { + char *string; + void *blob; + struct filename *name; + struct file *file; + }; + size_t size; + int dirfd; +}; + +struct fc_log { + refcount_t usage; + u8 head; + u8 tail; + u8 need_free; + struct module *owner; + char *buffer[8]; +}; + +struct fs_context_operations { + void (*free)(struct fs_context *); + int (*dup)(struct fs_context *, struct fs_context *); + int (*parse_param)(struct fs_context *, struct fs_parameter *); + int (*parse_monolithic)(struct fs_context *, void *); + int (*get_tree)(struct fs_context *); + int (*reconfigure)(struct fs_context *); +}; + +struct fs_parse_result { + bool negated; + union { + bool boolean; + int int_32; + unsigned int uint_32; + u64 uint_64; + }; +}; + +struct trace_event_raw_initcall_level { + struct trace_entry ent; + u32 __data_loc_level; + char __data[0]; +}; + +struct trace_event_raw_initcall_start { + struct trace_entry ent; + initcall_t func; + char __data[0]; +}; + +struct trace_event_raw_initcall_finish { + struct trace_entry ent; + initcall_t func; + int ret; + char __data[0]; +}; + +struct trace_event_data_offsets_initcall_level { + u32 level; +}; + +struct trace_event_data_offsets_initcall_start {}; + +struct trace_event_data_offsets_initcall_finish {}; + +typedef void (*btf_trace_initcall_level)(void *, const char *); + +typedef void (*btf_trace_initcall_start)(void *, initcall_t); + +typedef void (*btf_trace_initcall_finish)(void *, initcall_t, int); + +struct blacklist_entry { + struct list_head next; + char *buf; +}; + +typedef __u32 Elf32_Word; + +struct elf32_note { + Elf32_Word n_namesz; + Elf32_Word n_descsz; + Elf32_Word n_type; +}; + +enum { + PROC_ROOT_INO = 1, + PROC_IPC_INIT_INO = 4026531839, + PROC_UTS_INIT_INO = 4026531838, + PROC_USER_INIT_INO = 4026531837, + PROC_PID_INIT_INO = 4026531836, + PROC_CGROUP_INIT_INO = 4026531835, + PROC_TIME_INIT_INO = 4026531834, +}; + +typedef __u16 __le16; + +typedef __u16 __be16; + +typedef __u32 __be32; + +typedef __u64 __be64; + +typedef __u32 __wsum; + +typedef unsigned int slab_flags_t; + +struct notifier_block; + +typedef int (*notifier_fn_t)(struct notifier_block *, long unsigned int, void *); + +struct notifier_block { + notifier_fn_t notifier_call; + struct notifier_block *next; + int priority; +}; + +struct blocking_notifier_head { + struct rw_semaphore rwsem; + struct notifier_block *head; +}; + +struct raw_notifier_head { + struct notifier_block *head; +}; + +typedef __u64 __addrpair; + +typedef __u32 __portpair; + +typedef struct { + struct net *net; +} possible_net_t; + +struct in6_addr { + union { + __u8 u6_addr8[16]; + __be16 u6_addr16[8]; + __be32 u6_addr32[4]; + } in6_u; +}; + +struct hlist_nulls_node { + struct hlist_nulls_node *next; + struct hlist_nulls_node **pprev; +}; + +struct proto; + +struct inet_timewait_death_row; + +struct sock_common { + union { + __addrpair skc_addrpair; + struct { + __be32 skc_daddr; + __be32 skc_rcv_saddr; + }; + }; + union { + unsigned int skc_hash; + __u16 skc_u16hashes[2]; + }; + union { + __portpair skc_portpair; + struct { + __be16 skc_dport; + __u16 skc_num; + }; + }; + short unsigned int skc_family; + volatile unsigned char skc_state; + unsigned char skc_reuse: 4; + unsigned char skc_reuseport: 1; + unsigned char skc_ipv6only: 1; + unsigned char skc_net_refcnt: 1; + int skc_bound_dev_if; + union { + struct hlist_node skc_bind_node; + struct hlist_node skc_portaddr_node; + }; + struct proto *skc_prot; + possible_net_t skc_net; + struct in6_addr skc_v6_daddr; + struct in6_addr skc_v6_rcv_saddr; + atomic64_t skc_cookie; + union { + long unsigned int skc_flags; + struct sock *skc_listener; + struct inet_timewait_death_row *skc_tw_dr; + }; + int skc_dontcopy_begin[0]; + union { + struct hlist_node skc_node; + struct hlist_nulls_node skc_nulls_node; + }; + short unsigned int skc_tx_queue_mapping; + short unsigned int skc_rx_queue_mapping; + union { + int skc_incoming_cpu; + u32 skc_rcv_wnd; + u32 skc_tw_rcv_nxt; + }; + refcount_t skc_refcnt; + int skc_dontcopy_end[0]; + union { + u32 skc_rxhash; + u32 skc_window_clamp; + u32 skc_tw_snd_nxt; + }; +}; + +typedef struct { + spinlock_t slock; + int owned; + wait_queue_head_t wq; +} socket_lock_t; + +struct sk_buff; + +struct sk_buff_head { + struct sk_buff *next; + struct sk_buff *prev; + __u32 qlen; + spinlock_t lock; +}; + +typedef u64 netdev_features_t; + +struct sock_cgroup_data { + union { + struct { + u8 is_data: 1; + u8 no_refcnt: 1; + u8 unused: 6; + u8 padding; + u16 prioidx; + u32 classid; + }; + u64 val; + }; +}; + +struct sk_filter; + +struct socket_wq; + +struct xfrm_policy; + +struct dst_entry; + +struct socket; + +struct net_device; + +struct sock_reuseport; + +struct bpf_local_storage; + +struct sock { + struct sock_common __sk_common; + socket_lock_t sk_lock; + atomic_t sk_drops; + int sk_rcvlowat; + struct sk_buff_head sk_error_queue; + struct sk_buff *sk_rx_skb_cache; + struct sk_buff_head sk_receive_queue; + struct { + atomic_t rmem_alloc; + int len; + struct sk_buff *head; + struct sk_buff *tail; + } sk_backlog; + int sk_forward_alloc; + unsigned int sk_ll_usec; + unsigned int sk_napi_id; + int sk_rcvbuf; + struct sk_filter *sk_filter; + union { + struct socket_wq *sk_wq; + struct socket_wq *sk_wq_raw; + }; + struct xfrm_policy *sk_policy[2]; + struct dst_entry *sk_rx_dst; + struct dst_entry *sk_dst_cache; + atomic_t sk_omem_alloc; + int sk_sndbuf; + int sk_wmem_queued; + refcount_t sk_wmem_alloc; + long unsigned int sk_tsq_flags; + union { + struct sk_buff *sk_send_head; + struct rb_root tcp_rtx_queue; + }; + struct sk_buff *sk_tx_skb_cache; + struct sk_buff_head sk_write_queue; + __s32 sk_peek_off; + int sk_write_pending; + __u32 sk_dst_pending_confirm; + u32 sk_pacing_status; + long int sk_sndtimeo; + struct timer_list sk_timer; + __u32 sk_priority; + __u32 sk_mark; + long unsigned int sk_pacing_rate; + long unsigned int sk_max_pacing_rate; + struct page_frag sk_frag; + netdev_features_t sk_route_caps; + netdev_features_t sk_route_nocaps; + netdev_features_t sk_route_forced_caps; + int sk_gso_type; + unsigned int sk_gso_max_size; + gfp_t sk_allocation; + __u32 sk_txhash; + u8 sk_padding: 1; + u8 sk_kern_sock: 1; + u8 sk_no_check_tx: 1; + u8 sk_no_check_rx: 1; + u8 sk_userlocks: 4; + u8 sk_pacing_shift; + u16 sk_type; + u16 sk_protocol; + u16 sk_gso_max_segs; + long unsigned int sk_lingertime; + struct proto *sk_prot_creator; + rwlock_t sk_callback_lock; + int sk_err; + int sk_err_soft; + u32 sk_ack_backlog; + u32 sk_max_ack_backlog; + kuid_t sk_uid; + u8 sk_prefer_busy_poll; + u16 sk_busy_poll_budget; + struct pid *sk_peer_pid; + const struct cred *sk_peer_cred; + long int sk_rcvtimeo; + ktime_t sk_stamp; + u16 sk_tsflags; + u8 sk_shutdown; + u32 sk_tskey; + atomic_t sk_zckey; + u8 sk_clockid; + u8 sk_txtime_deadline_mode: 1; + u8 sk_txtime_report_errors: 1; + u8 sk_txtime_unused: 6; + struct socket *sk_socket; + void *sk_user_data; + void *sk_security; + struct sock_cgroup_data sk_cgrp_data; + struct mem_cgroup *sk_memcg; + void (*sk_state_change)(struct sock *); + void (*sk_data_ready)(struct sock *); + void (*sk_write_space)(struct sock *); + void (*sk_error_report)(struct sock *); + int (*sk_backlog_rcv)(struct sock *, struct sk_buff *); + struct sk_buff * (*sk_validate_xmit_skb)(struct sock *, struct net_device *, struct sk_buff *); + void (*sk_destruct)(struct sock *); + struct sock_reuseport *sk_reuseport_cb; + struct bpf_local_storage *sk_bpf_storage; + struct callback_head sk_rcu; +}; + +struct rhash_head { + struct rhash_head *next; +}; + +struct rhashtable; + +struct rhashtable_compare_arg { + struct rhashtable *ht; + const void *key; +}; + +typedef u32 (*rht_hashfn_t)(const void *, u32, u32); + +typedef u32 (*rht_obj_hashfn_t)(const void *, u32, u32); + +typedef int (*rht_obj_cmpfn_t)(struct rhashtable_compare_arg *, const void *); + +struct rhashtable_params { + u16 nelem_hint; + u16 key_len; + u16 key_offset; + u16 head_offset; + unsigned int max_size; + u16 min_size; + bool automatic_shrinking; + rht_hashfn_t hashfn; + rht_obj_hashfn_t obj_hashfn; + rht_obj_cmpfn_t obj_cmpfn; +}; + +struct bucket_table; + +struct rhashtable { + struct bucket_table *tbl; + unsigned int key_len; + unsigned int max_elems; + struct rhashtable_params p; + bool rhlist; + struct work_struct run_work; + struct mutex mutex; + spinlock_t lock; + atomic_t nelems; +}; + +struct fs_struct { + int users; + spinlock_t lock; + seqcount_spinlock_t seq; + int umask; + int in_exec; + struct path root; + struct path pwd; +}; + +struct pipe_buffer; + +struct watch_queue; + +struct pipe_inode_info { + struct mutex mutex; + wait_queue_head_t rd_wait; + wait_queue_head_t wr_wait; + unsigned int head; + unsigned int tail; + unsigned int max_usage; + unsigned int ring_size; + bool note_loss; + unsigned int nr_accounted; + unsigned int readers; + unsigned int writers; + unsigned int files; + unsigned int r_counter; + unsigned int w_counter; + struct page *tmp_page; + struct fasync_struct *fasync_readers; + struct fasync_struct *fasync_writers; + struct pipe_buffer *bufs; + struct user_struct *user; + struct watch_queue *watch_queue; +}; + +typedef short unsigned int __kernel_sa_family_t; + +typedef __kernel_sa_family_t sa_family_t; + +struct sockaddr { + sa_family_t sa_family; + char sa_data[14]; +}; + +struct msghdr { + void *msg_name; + int msg_namelen; + struct iov_iter msg_iter; + union { + void *msg_control; + void *msg_control_user; + }; + bool msg_control_is_user: 1; + __kernel_size_t msg_controllen; + unsigned int msg_flags; + struct kiocb *msg_iocb; +}; + +typedef struct { + unsigned int clock_rate; + unsigned int clock_type; + short unsigned int loopback; +} sync_serial_settings; + +typedef struct { + unsigned int clock_rate; + unsigned int clock_type; + short unsigned int loopback; + unsigned int slot_map; +} te1_settings; + +typedef struct { + short unsigned int encoding; + short unsigned int parity; +} raw_hdlc_proto; + +typedef struct { + unsigned int t391; + unsigned int t392; + unsigned int n391; + unsigned int n392; + unsigned int n393; + short unsigned int lmi; + short unsigned int dce; +} fr_proto; + +typedef struct { + unsigned int dlci; +} fr_proto_pvc; + +typedef struct { + unsigned int dlci; + char master[16]; +} fr_proto_pvc_info; + +typedef struct { + unsigned int interval; + unsigned int timeout; +} cisco_proto; + +typedef struct { + short unsigned int dce; + unsigned int modulo; + unsigned int window; + unsigned int t1; + unsigned int t2; + unsigned int n2; +} x25_hdlc_proto; + +struct ifmap { + long unsigned int mem_start; + long unsigned int mem_end; + short unsigned int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; +}; + +struct if_settings { + unsigned int type; + unsigned int size; + union { + raw_hdlc_proto *raw_hdlc; + cisco_proto *cisco; + fr_proto *fr; + fr_proto_pvc *fr_pvc; + fr_proto_pvc_info *fr_pvc_info; + x25_hdlc_proto *x25; + sync_serial_settings *sync; + te1_settings *te1; + } ifs_ifsu; +}; + +struct ifreq { + union { + char ifrn_name[16]; + } ifr_ifrn; + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + int ifru_ivalue; + int ifru_mtu; + struct ifmap ifru_map; + char ifru_slave[16]; + char ifru_newname[16]; + void *ifru_data; + struct if_settings ifru_settings; + } ifr_ifru; +}; + +struct vfsmount { + struct dentry *mnt_root; + struct super_block *mnt_sb; + int mnt_flags; +}; + +struct ld_semaphore { + atomic_long_t count; + raw_spinlock_t wait_lock; + unsigned int wait_readers; + struct list_head read_wait; + struct list_head write_wait; +}; + +typedef unsigned int tcflag_t; + +typedef unsigned char cc_t; + +typedef unsigned int speed_t; + +struct ktermios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + cc_t c_line; + cc_t c_cc[19]; + speed_t c_ispeed; + speed_t c_ospeed; +}; + +struct winsize { + short unsigned int ws_row; + short unsigned int ws_col; + short unsigned int ws_xpixel; + short unsigned int ws_ypixel; +}; + +struct tty_driver; + +struct tty_operations; + +struct tty_ldisc; + +struct tty_port; + +struct tty_struct { + int magic; + struct kref kref; + struct device *dev; + struct tty_driver *driver; + const struct tty_operations *ops; + int index; + struct ld_semaphore ldisc_sem; + struct tty_ldisc *ldisc; + struct mutex atomic_write_lock; + struct mutex legacy_mutex; + struct mutex throttle_mutex; + struct rw_semaphore termios_rwsem; + struct mutex winsize_mutex; + spinlock_t ctrl_lock; + spinlock_t flow_lock; + struct ktermios termios; + struct ktermios termios_locked; + char name[64]; + struct pid *pgrp; + struct pid *session; + long unsigned int flags; + int count; + struct winsize winsize; + long unsigned int stopped: 1; + long unsigned int flow_stopped: 1; + int: 30; + long unsigned int unused: 62; + int hw_stopped; + long unsigned int ctrl_status: 8; + long unsigned int packet: 1; + int: 23; + long unsigned int unused_ctrl: 55; + unsigned int receive_room; + int flow_change; + struct tty_struct *link; + struct fasync_struct *fasync; + wait_queue_head_t write_wait; + wait_queue_head_t read_wait; + struct work_struct hangup_work; + void *disc_data; + void *driver_data; + spinlock_t files_lock; + struct list_head tty_files; + int closing; + unsigned char *write_buf; + int write_cnt; + struct work_struct SAK_work; + struct tty_port *port; +}; + +typedef struct { + size_t written; + size_t count; + union { + char *buf; + void *data; + } arg; + int error; +} read_descriptor_t; + +struct posix_acl_entry { + short int e_tag; + short unsigned int e_perm; + union { + kuid_t e_uid; + kgid_t e_gid; + }; +}; + +struct posix_acl { + refcount_t a_refcount; + struct callback_head a_rcu; + unsigned int a_count; + struct posix_acl_entry a_entries[0]; +}; + +struct serial_icounter_struct; + +struct serial_struct; + +struct tty_operations { + struct tty_struct * (*lookup)(struct tty_driver *, struct file *, int); + int (*install)(struct tty_driver *, struct tty_struct *); + void (*remove)(struct tty_driver *, struct tty_struct *); + int (*open)(struct tty_struct *, struct file *); + void (*close)(struct tty_struct *, struct file *); + void (*shutdown)(struct tty_struct *); + void (*cleanup)(struct tty_struct *); + int (*write)(struct tty_struct *, const unsigned char *, int); + int (*put_char)(struct tty_struct *, unsigned char); + void (*flush_chars)(struct tty_struct *); + int (*write_room)(struct tty_struct *); + int (*chars_in_buffer)(struct tty_struct *); + int (*ioctl)(struct tty_struct *, unsigned int, long unsigned int); + long int (*compat_ioctl)(struct tty_struct *, unsigned int, long unsigned int); + void (*set_termios)(struct tty_struct *, struct ktermios *); + void (*throttle)(struct tty_struct *); + void (*unthrottle)(struct tty_struct *); + void (*stop)(struct tty_struct *); + void (*start)(struct tty_struct *); + void (*hangup)(struct tty_struct *); + int (*break_ctl)(struct tty_struct *, int); + void (*flush_buffer)(struct tty_struct *); + void (*set_ldisc)(struct tty_struct *); + void (*wait_until_sent)(struct tty_struct *, int); + void (*send_xchar)(struct tty_struct *, char); + int (*tiocmget)(struct tty_struct *); + int (*tiocmset)(struct tty_struct *, unsigned int, unsigned int); + int (*resize)(struct tty_struct *, struct winsize *); + int (*get_icount)(struct tty_struct *, struct serial_icounter_struct *); + int (*get_serial)(struct tty_struct *, struct serial_struct *); + int (*set_serial)(struct tty_struct *, struct serial_struct *); + void (*show_fdinfo)(struct tty_struct *, struct seq_file *); + int (*poll_init)(struct tty_driver *, int, char *); + int (*poll_get_char)(struct tty_driver *, int); + void (*poll_put_char)(struct tty_driver *, int, char); + int (*proc_show)(struct seq_file *, void *); +}; + +struct proc_dir_entry; + +struct tty_driver { + int magic; + struct kref kref; + struct cdev **cdevs; + struct module *owner; + const char *driver_name; + const char *name; + int name_base; + int major; + int minor_start; + unsigned int num; + short int type; + short int subtype; + struct ktermios init_termios; + long unsigned int flags; + struct proc_dir_entry *proc_entry; + struct tty_driver *other; + struct tty_struct **ttys; + struct tty_port **ports; + struct ktermios **termios; + void *driver_state; + const struct tty_operations *ops; + struct list_head tty_drivers; +}; + +struct tty_buffer { + union { + struct tty_buffer *next; + struct llist_node free; + }; + int used; + int size; + int commit; + int read; + int flags; + long unsigned int data[0]; +}; + +struct tty_bufhead { + struct tty_buffer *head; + struct work_struct work; + struct mutex lock; + atomic_t priority; + struct tty_buffer sentinel; + struct llist_head free; + atomic_t mem_used; + int mem_limit; + struct tty_buffer *tail; +}; + +struct tty_port_operations; + +struct tty_port_client_operations; + +struct tty_port { + struct tty_bufhead buf; + struct tty_struct *tty; + struct tty_struct *itty; + const struct tty_port_operations *ops; + const struct tty_port_client_operations *client_ops; + spinlock_t lock; + int blocked_open; + int count; + wait_queue_head_t open_wait; + wait_queue_head_t delta_msr_wait; + long unsigned int flags; + long unsigned int iflags; + unsigned char console: 1; + unsigned char low_latency: 1; + struct mutex mutex; + struct mutex buf_mutex; + unsigned char *xmit_buf; + unsigned int close_delay; + unsigned int closing_wait; + int drain_delay; + struct kref kref; + void *client_data; +}; + +struct tty_ldisc_ops { + int magic; + char *name; + int num; + int flags; + int (*open)(struct tty_struct *); + void (*close)(struct tty_struct *); + void (*flush_buffer)(struct tty_struct *); + ssize_t (*read)(struct tty_struct *, struct file *, unsigned char *, size_t, void **, long unsigned int); + ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t); + int (*ioctl)(struct tty_struct *, struct file *, unsigned int, long unsigned int); + int (*compat_ioctl)(struct tty_struct *, struct file *, unsigned int, long unsigned int); + void (*set_termios)(struct tty_struct *, struct ktermios *); + __poll_t (*poll)(struct tty_struct *, struct file *, struct poll_table_struct *); + int (*hangup)(struct tty_struct *); + void (*receive_buf)(struct tty_struct *, const unsigned char *, char *, int); + void (*write_wakeup)(struct tty_struct *); + void (*dcd_change)(struct tty_struct *, unsigned int); + int (*receive_buf2)(struct tty_struct *, const unsigned char *, char *, int); + struct module *owner; + int refcount; +}; + +struct tty_ldisc { + struct tty_ldisc_ops *ops; + struct tty_struct *tty; +}; + +struct tty_port_operations { + int (*carrier_raised)(struct tty_port *); + void (*dtr_rts)(struct tty_port *, int); + void (*shutdown)(struct tty_port *); + int (*activate)(struct tty_port *, struct tty_struct *); + void (*destruct)(struct tty_port *); +}; + +struct tty_port_client_operations { + int (*receive_buf)(struct tty_port *, const unsigned char *, const unsigned char *, size_t); + void (*write_wakeup)(struct tty_port *); +}; + +struct prot_inuse; + +struct netns_core { + struct ctl_table_header *sysctl_hdr; + int sysctl_somaxconn; + int *sock_inuse; + struct prot_inuse *prot_inuse; +}; + +struct tcp_mib; + +struct ipstats_mib; + +struct linux_mib; + +struct udp_mib; + +struct icmp_mib; + +struct icmpmsg_mib; + +struct icmpv6_mib; + +struct icmpv6msg_mib; + +struct linux_xfrm_mib; + +struct linux_tls_mib; + +struct mptcp_mib; + +struct netns_mib { + struct tcp_mib *tcp_statistics; + struct ipstats_mib *ip_statistics; + struct linux_mib *net_statistics; + struct udp_mib *udp_statistics; + struct udp_mib *udplite_statistics; + struct icmp_mib *icmp_statistics; + struct icmpmsg_mib *icmpmsg_statistics; + struct proc_dir_entry *proc_net_devsnmp6; + struct udp_mib *udp_stats_in6; + struct udp_mib *udplite_stats_in6; + struct ipstats_mib *ipv6_statistics; + struct icmpv6_mib *icmpv6_statistics; + struct icmpv6msg_mib *icmpv6msg_statistics; + struct linux_xfrm_mib *xfrm_statistics; + struct linux_tls_mib *tls_statistics; + struct mptcp_mib *mptcp_statistics; +}; + +struct netns_packet { + struct mutex sklist_lock; + struct hlist_head sklist; +}; + +struct netns_unix { + int sysctl_max_dgram_qlen; + struct ctl_table_header *ctl; +}; + +struct netns_nexthop { + struct rb_root rb_root; + struct hlist_head *devhash; + unsigned int seq; + u32 last_id_allocated; + struct blocking_notifier_head notifier_chain; +}; + +struct local_ports { + seqlock_t lock; + int range[2]; + bool warned; +}; + +struct inet_hashinfo; + +struct inet_timewait_death_row { + atomic_t tw_count; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct inet_hashinfo *hashinfo; + int sysctl_max_tw_buckets; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct ping_group_range { + seqlock_t lock; + kgid_t range[2]; +}; + +typedef struct { + u64 key[2]; +} siphash_key_t; + +struct ipv4_devconf; + +struct ip_ra_chain; + +struct fib_rules_ops; + +struct fib_table; + +struct inet_peer_base; + +struct fqdir; + +struct xt_table; + +struct tcp_congestion_ops; + +struct tcp_fastopen_context; + +struct fib_notifier_ops; + +struct netns_ipv4 { + struct ctl_table_header *forw_hdr; + struct ctl_table_header *frags_hdr; + struct ctl_table_header *ipv4_hdr; + struct ctl_table_header *route_hdr; + struct ctl_table_header *xfrm4_hdr; + struct ipv4_devconf *devconf_all; + struct ipv4_devconf *devconf_dflt; + struct ip_ra_chain *ra_chain; + struct mutex ra_mutex; + struct fib_rules_ops *rules_ops; + bool fib_has_custom_rules; + unsigned int fib_rules_require_fldissect; + struct fib_table *fib_main; + struct fib_table *fib_default; + bool fib_has_custom_local_routes; + int fib_num_tclassid_users; + struct hlist_head *fib_table_hash; + bool fib_offload_disabled; + struct sock *fibnl; + struct sock **icmp_sk; + struct sock *mc_autojoin_sk; + struct inet_peer_base *peers; + struct sock **tcp_sk; + struct fqdir *fqdir; + struct xt_table *iptable_filter; + struct xt_table *iptable_mangle; + struct xt_table *iptable_raw; + struct xt_table *arptable_filter; + struct xt_table *iptable_security; + struct xt_table *nat_table; + int sysctl_icmp_echo_ignore_all; + int sysctl_icmp_echo_ignore_broadcasts; + int sysctl_icmp_ignore_bogus_error_responses; + int sysctl_icmp_ratelimit; + int sysctl_icmp_ratemask; + int sysctl_icmp_errors_use_inbound_ifaddr; + struct local_ports ip_local_ports; + int sysctl_tcp_ecn; + int sysctl_tcp_ecn_fallback; + int sysctl_ip_default_ttl; + int sysctl_ip_no_pmtu_disc; + int sysctl_ip_fwd_use_pmtu; + int sysctl_ip_fwd_update_priority; + int sysctl_ip_nonlocal_bind; + int sysctl_ip_autobind_reuse; + int sysctl_ip_dynaddr; + int sysctl_ip_early_demux; + int sysctl_raw_l3mdev_accept; + int sysctl_tcp_early_demux; + int sysctl_udp_early_demux; + int sysctl_nexthop_compat_mode; + int sysctl_fwmark_reflect; + int sysctl_tcp_fwmark_accept; + int sysctl_tcp_l3mdev_accept; + int sysctl_tcp_mtu_probing; + int sysctl_tcp_mtu_probe_floor; + int sysctl_tcp_base_mss; + int sysctl_tcp_min_snd_mss; + int sysctl_tcp_probe_threshold; + u32 sysctl_tcp_probe_interval; + int sysctl_tcp_keepalive_time; + int sysctl_tcp_keepalive_probes; + int sysctl_tcp_keepalive_intvl; + int sysctl_tcp_syn_retries; + int sysctl_tcp_synack_retries; + int sysctl_tcp_syncookies; + int sysctl_tcp_reordering; + int sysctl_tcp_retries1; + int sysctl_tcp_retries2; + int sysctl_tcp_orphan_retries; + int sysctl_tcp_fin_timeout; + unsigned int sysctl_tcp_notsent_lowat; + int sysctl_tcp_tw_reuse; + int sysctl_tcp_sack; + int sysctl_tcp_window_scaling; + int sysctl_tcp_timestamps; + int sysctl_tcp_early_retrans; + int sysctl_tcp_recovery; + int sysctl_tcp_thin_linear_timeouts; + int sysctl_tcp_slow_start_after_idle; + int sysctl_tcp_retrans_collapse; + int sysctl_tcp_stdurg; + int sysctl_tcp_rfc1337; + int sysctl_tcp_abort_on_overflow; + int sysctl_tcp_fack; + int sysctl_tcp_max_reordering; + int sysctl_tcp_dsack; + int sysctl_tcp_app_win; + int sysctl_tcp_adv_win_scale; + int sysctl_tcp_frto; + int sysctl_tcp_nometrics_save; + int sysctl_tcp_no_ssthresh_metrics_save; + int sysctl_tcp_moderate_rcvbuf; + int sysctl_tcp_tso_win_divisor; + int sysctl_tcp_workaround_signed_windows; + int sysctl_tcp_limit_output_bytes; + int sysctl_tcp_challenge_ack_limit; + int sysctl_tcp_min_tso_segs; + int sysctl_tcp_min_rtt_wlen; + int sysctl_tcp_autocorking; + int sysctl_tcp_invalid_ratelimit; + int sysctl_tcp_pacing_ss_ratio; + int sysctl_tcp_pacing_ca_ratio; + int sysctl_tcp_wmem[3]; + int sysctl_tcp_rmem[3]; + int sysctl_tcp_comp_sack_nr; + long unsigned int sysctl_tcp_comp_sack_delay_ns; + long unsigned int sysctl_tcp_comp_sack_slack_ns; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct inet_timewait_death_row tcp_death_row; + int sysctl_max_syn_backlog; + int sysctl_tcp_fastopen; + const struct tcp_congestion_ops *tcp_congestion_control; + struct tcp_fastopen_context *tcp_fastopen_ctx; + spinlock_t tcp_fastopen_ctx_lock; + unsigned int sysctl_tcp_fastopen_blackhole_timeout; + atomic_t tfo_active_disable_times; + long unsigned int tfo_active_disable_stamp; + int sysctl_tcp_reflect_tos; + int sysctl_udp_wmem_min; + int sysctl_udp_rmem_min; + int sysctl_udp_l3mdev_accept; + int sysctl_igmp_max_memberships; + int sysctl_igmp_max_msf; + int sysctl_igmp_llm_reports; + int sysctl_igmp_qrv; + struct ping_group_range ping_group_range; + atomic_t dev_addr_genid; + long unsigned int *sysctl_local_reserved_ports; + int sysctl_ip_prot_sock; + struct list_head mr_tables; + struct fib_rules_ops *mr_rules_ops; + int sysctl_fib_multipath_use_neigh; + int sysctl_fib_multipath_hash_policy; + struct fib_notifier_ops *notifier_ops; + unsigned int fib_seq; + struct fib_notifier_ops *ipmr_notifier_ops; + unsigned int ipmr_seq; + atomic_t rt_genid; + siphash_key_t ip_id_key; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct netns_sysctl_ipv6 { + struct ctl_table_header *hdr; + struct ctl_table_header *route_hdr; + struct ctl_table_header *icmp_hdr; + struct ctl_table_header *frags_hdr; + struct ctl_table_header *xfrm6_hdr; + int bindv6only; + int flush_delay; + int ip6_rt_max_size; + int ip6_rt_gc_min_interval; + int ip6_rt_gc_timeout; + int ip6_rt_gc_interval; + int ip6_rt_gc_elasticity; + int ip6_rt_mtu_expires; + int ip6_rt_min_advmss; + int multipath_hash_policy; + int flowlabel_consistency; + int auto_flowlabels; + int icmpv6_time; + int icmpv6_echo_ignore_all; + int icmpv6_echo_ignore_multicast; + int icmpv6_echo_ignore_anycast; + long unsigned int icmpv6_ratemask[4]; + long unsigned int *icmpv6_ratemask_ptr; + int anycast_src_echo_reply; + int ip_nonlocal_bind; + int fwmark_reflect; + int idgen_retries; + int idgen_delay; + int flowlabel_state_ranges; + int flowlabel_reflect; + int max_dst_opts_cnt; + int max_hbh_opts_cnt; + int max_dst_opts_len; + int max_hbh_opts_len; + int seg6_flowlabel; + bool skip_notify_on_dev_down; +}; + +struct neighbour; + +struct dst_ops { + short unsigned int family; + unsigned int gc_thresh; + int (*gc)(struct dst_ops *); + struct dst_entry * (*check)(struct dst_entry *, __u32); + unsigned int (*default_advmss)(const struct dst_entry *); + unsigned int (*mtu)(const struct dst_entry *); + u32 * (*cow_metrics)(struct dst_entry *, long unsigned int); + void (*destroy)(struct dst_entry *); + void (*ifdown)(struct dst_entry *, struct net_device *, int); + struct dst_entry * (*negative_advice)(struct dst_entry *); + void (*link_failure)(struct sk_buff *); + void (*update_pmtu)(struct dst_entry *, struct sock *, struct sk_buff *, u32, bool); + void (*redirect)(struct dst_entry *, struct sock *, struct sk_buff *); + int (*local_out)(struct net *, struct sock *, struct sk_buff *); + struct neighbour * (*neigh_lookup)(const struct dst_entry *, struct sk_buff *, const void *); + void (*confirm_neigh)(const struct dst_entry *, const void *); + struct kmem_cache *kmem_cachep; + struct percpu_counter pcpuc_entries; + long: 64; + long: 64; + long: 64; +}; + +struct ipv6_devconf; + +struct fib6_info; + +struct rt6_info; + +struct rt6_statistics; + +struct fib6_table; + +struct seg6_pernet_data; + +struct netns_ipv6 { + struct netns_sysctl_ipv6 sysctl; + struct ipv6_devconf *devconf_all; + struct ipv6_devconf *devconf_dflt; + struct inet_peer_base *peers; + struct fqdir *fqdir; + struct xt_table *ip6table_filter; + struct xt_table *ip6table_mangle; + struct xt_table *ip6table_raw; + struct xt_table *ip6table_security; + struct xt_table *ip6table_nat; + struct fib6_info *fib6_null_entry; + struct rt6_info *ip6_null_entry; + struct rt6_statistics *rt6_stats; + struct timer_list ip6_fib_timer; + struct hlist_head *fib_table_hash; + struct fib6_table *fib6_main_tbl; + struct list_head fib6_walkers; + long: 64; + long: 64; + struct dst_ops ip6_dst_ops; + rwlock_t fib6_walker_lock; + spinlock_t fib6_gc_lock; + unsigned int ip6_rt_gc_expire; + long unsigned int ip6_rt_last_gc; + unsigned int fib6_rules_require_fldissect; + bool fib6_has_custom_rules; + unsigned int fib6_routes_require_src; + struct rt6_info *ip6_prohibit_entry; + struct rt6_info *ip6_blk_hole_entry; + struct fib6_table *fib6_local_tbl; + struct fib_rules_ops *fib6_rules_ops; + struct sock **icmp_sk; + struct sock *ndisc_sk; + struct sock *tcp_sk; + struct sock *igmp_sk; + struct sock *mc_autojoin_sk; + struct list_head mr6_tables; + struct fib_rules_ops *mr6_rules_ops; + atomic_t dev_addr_genid; + atomic_t fib6_sernum; + struct seg6_pernet_data *seg6_data; + struct fib_notifier_ops *notifier_ops; + struct fib_notifier_ops *ip6mr_notifier_ops; + unsigned int ipmr_seq; + struct { + struct hlist_head head; + spinlock_t lock; + u32 seq; + } ip6addrlbl_table; +}; + +struct netns_sysctl_lowpan { + struct ctl_table_header *frags_hdr; +}; + +struct netns_ieee802154_lowpan { + struct netns_sysctl_lowpan sysctl; + struct fqdir *fqdir; +}; + +struct sctp_mib; + +struct netns_sctp { + struct sctp_mib *sctp_statistics; + struct proc_dir_entry *proc_net_sctp; + struct ctl_table_header *sysctl_header; + struct sock *ctl_sock; + struct sock *udp4_sock; + struct sock *udp6_sock; + int udp_port; + int encap_port; + struct list_head local_addr_list; + struct list_head addr_waitq; + struct timer_list addr_wq_timer; + struct list_head auto_asconf_splist; + spinlock_t addr_wq_lock; + spinlock_t local_addr_lock; + unsigned int rto_initial; + unsigned int rto_min; + unsigned int rto_max; + int rto_alpha; + int rto_beta; + int max_burst; + int cookie_preserve_enable; + char *sctp_hmac_alg; + unsigned int valid_cookie_life; + unsigned int sack_timeout; + unsigned int hb_interval; + int max_retrans_association; + int max_retrans_path; + int max_retrans_init; + int pf_retrans; + int ps_retrans; + int pf_enable; + int pf_expose; + int sndbuf_policy; + int rcvbuf_policy; + int default_auto_asconf; + int addip_enable; + int addip_noauth; + int prsctp_enable; + int reconf_enable; + int auth_enable; + int intl_enable; + int ecn_enable; + int scope_policy; + int rwnd_upd_shift; + long unsigned int max_autoclose; +}; + +struct nf_queue_handler; + +struct nf_logger; + +struct nf_hook_entries; + +struct netns_nf { + struct proc_dir_entry *proc_netfilter; + const struct nf_queue_handler *queue_handler; + const struct nf_logger *nf_loggers[13]; + struct ctl_table_header *nf_log_dir_header; + struct nf_hook_entries *hooks_ipv4[5]; + struct nf_hook_entries *hooks_ipv6[5]; + struct nf_hook_entries *hooks_arp[3]; + struct nf_hook_entries *hooks_bridge[5]; + bool defrag_ipv4; + bool defrag_ipv6; +}; + +struct ebt_table; + +struct netns_xt { + struct list_head tables[13]; + bool notrack_deprecated_warning; + bool clusterip_deprecated_warning; + struct ebt_table *broute_table; + struct ebt_table *frame_filter; + struct ebt_table *frame_nat; +}; + +struct nf_generic_net { + unsigned int timeout; +}; + +struct nf_tcp_net { + unsigned int timeouts[14]; + int tcp_loose; + int tcp_be_liberal; + int tcp_max_retrans; +}; + +struct nf_udp_net { + unsigned int timeouts[2]; +}; + +struct nf_icmp_net { + unsigned int timeout; +}; + +struct nf_dccp_net { + int dccp_loose; + unsigned int dccp_timeout[10]; +}; + +struct nf_sctp_net { + unsigned int timeouts[10]; +}; + +struct nf_gre_net { + struct list_head keymap_list; + unsigned int timeouts[2]; +}; + +struct nf_ip_net { + struct nf_generic_net generic; + struct nf_tcp_net tcp; + struct nf_udp_net udp; + struct nf_icmp_net icmp; + struct nf_icmp_net icmpv6; + struct nf_dccp_net dccp; + struct nf_sctp_net sctp; + struct nf_gre_net gre; +}; + +struct ct_pcpu; + +struct ip_conntrack_stat; + +struct nf_ct_event_notifier; + +struct nf_exp_event_notifier; + +struct netns_ct { + atomic_t count; + unsigned int expect_count; + struct delayed_work ecache_dwork; + bool ecache_dwork_pending; + bool auto_assign_helper_warned; + struct ctl_table_header *sysctl_header; + unsigned int sysctl_log_invalid; + int sysctl_events; + int sysctl_acct; + int sysctl_auto_assign_helper; + int sysctl_tstamp; + int sysctl_checksum; + struct ct_pcpu *pcpu_lists; + struct ip_conntrack_stat *stat; + struct nf_ct_event_notifier *nf_conntrack_event_cb; + struct nf_exp_event_notifier *nf_expect_event_cb; + struct nf_ip_net nf_ct_proto; + unsigned int labels_used; +}; + +struct netns_nftables { + struct list_head tables; + struct list_head commit_list; + struct list_head module_list; + struct list_head notify_list; + struct mutex commit_mutex; + unsigned int base_seq; + u8 gencursor; + u8 validate_state; +}; + +struct netns_nf_frag { + struct fqdir *fqdir; +}; + +struct netns_bpf { + struct bpf_prog_array *run_array[2]; + struct bpf_prog *progs[2]; + struct list_head links[2]; +}; + +struct xfrm_policy_hash { + struct hlist_head *table; + unsigned int hmask; + u8 dbits4; + u8 sbits4; + u8 dbits6; + u8 sbits6; +}; + +struct xfrm_policy_hthresh { + struct work_struct work; + seqlock_t lock; + u8 lbits4; + u8 rbits4; + u8 lbits6; + u8 rbits6; +}; + +struct netns_xfrm { + struct list_head state_all; + struct hlist_head *state_bydst; + struct hlist_head *state_bysrc; + struct hlist_head *state_byspi; + unsigned int state_hmask; + unsigned int state_num; + struct work_struct state_hash_work; + struct list_head policy_all; + struct hlist_head *policy_byidx; + unsigned int policy_idx_hmask; + struct hlist_head policy_inexact[3]; + struct xfrm_policy_hash policy_bydst[3]; + unsigned int policy_count[6]; + struct work_struct policy_hash_work; + struct xfrm_policy_hthresh policy_hthresh; + struct list_head inexact_bins; + struct sock *nlsk; + struct sock *nlsk_stash; + u32 sysctl_aevent_etime; + u32 sysctl_aevent_rseqth; + int sysctl_larval_drop; + u32 sysctl_acq_expires; + struct ctl_table_header *sysctl_hdr; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct dst_ops xfrm4_dst_ops; + struct dst_ops xfrm6_dst_ops; + spinlock_t xfrm_state_lock; + seqcount_t xfrm_state_hash_generation; + spinlock_t xfrm_policy_lock; + struct mutex xfrm_cfg_mutex; + long: 64; + long: 64; +}; + +struct netns_ipvs; + +struct mpls_route; + +struct netns_mpls { + int ip_ttl_propagate; + int default_ttl; + size_t platform_labels; + struct mpls_route **platform_label; + struct ctl_table_header *ctl; +}; + +struct can_dev_rcv_lists; + +struct can_pkg_stats; + +struct can_rcv_lists_stats; + +struct netns_can { + struct proc_dir_entry *proc_dir; + struct proc_dir_entry *pde_stats; + struct proc_dir_entry *pde_reset_stats; + struct proc_dir_entry *pde_rcvlist_all; + struct proc_dir_entry *pde_rcvlist_fil; + struct proc_dir_entry *pde_rcvlist_inv; + struct proc_dir_entry *pde_rcvlist_sff; + struct proc_dir_entry *pde_rcvlist_eff; + struct proc_dir_entry *pde_rcvlist_err; + struct proc_dir_entry *bcmproc_dir; + struct can_dev_rcv_lists *rx_alldev_list; + spinlock_t rcvlists_lock; + struct timer_list stattimer; + struct can_pkg_stats *pkg_stats; + struct can_rcv_lists_stats *rcv_lists_stats; + struct hlist_head cgw_list; +}; + +struct netns_xdp { + struct mutex lock; + struct hlist_head list; +}; + +struct uevent_sock; + +struct net_generic; + +struct net { + refcount_t passive; + spinlock_t rules_mod_lock; + unsigned int dev_unreg_count; + unsigned int dev_base_seq; + int ifindex; + spinlock_t nsid_lock; + atomic_t fnhe_genid; + struct list_head list; + struct list_head exit_list; + struct llist_node cleanup_list; + struct key_tag *key_domain; + struct user_namespace *user_ns; + struct ucounts *ucounts; + struct idr netns_ids; + struct ns_common ns; + struct list_head dev_base_head; + struct proc_dir_entry *proc_net; + struct proc_dir_entry *proc_net_stat; + struct ctl_table_set sysctls; + struct sock *rtnl; + struct sock *genl_sock; + struct uevent_sock *uevent_sock; + struct hlist_head *dev_name_head; + struct hlist_head *dev_index_head; + struct raw_notifier_head netdev_chain; + u32 hash_mix; + struct net_device *loopback_dev; + struct list_head rules_ops; + struct netns_core core; + struct netns_mib mib; + struct netns_packet packet; + struct netns_unix unx; + struct netns_nexthop nexthop; + struct netns_ipv4 ipv4; + struct netns_ipv6 ipv6; + struct netns_ieee802154_lowpan ieee802154_lowpan; + struct netns_sctp sctp; + struct netns_nf nf; + struct netns_xt xt; + struct netns_ct ct; + struct netns_nftables nft; + struct netns_nf_frag nf_frag; + struct ctl_table_header *nf_frag_frags_hdr; + struct sock *nfnl; + struct sock *nfnl_stash; + struct sk_buff_head wext_nlevents; + struct net_generic *gen; + struct netns_bpf bpf; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct netns_xfrm xfrm; + atomic64_t net_cookie; + struct netns_ipvs *ipvs; + struct netns_mpls mpls; + struct netns_can can; + struct netns_xdp xdp; + struct sock *crypto_nlsk; + struct sock *diag_nlsk; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +typedef struct { + local64_t v; +} u64_stats_t; + +struct bpf_insn { + __u8 code; + __u8 dst_reg: 4; + __u8 src_reg: 4; + __s16 off; + __s32 imm; +}; + +enum bpf_map_type { + BPF_MAP_TYPE_UNSPEC = 0, + BPF_MAP_TYPE_HASH = 1, + BPF_MAP_TYPE_ARRAY = 2, + BPF_MAP_TYPE_PROG_ARRAY = 3, + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 4, + BPF_MAP_TYPE_PERCPU_HASH = 5, + BPF_MAP_TYPE_PERCPU_ARRAY = 6, + BPF_MAP_TYPE_STACK_TRACE = 7, + BPF_MAP_TYPE_CGROUP_ARRAY = 8, + BPF_MAP_TYPE_LRU_HASH = 9, + BPF_MAP_TYPE_LRU_PERCPU_HASH = 10, + BPF_MAP_TYPE_LPM_TRIE = 11, + BPF_MAP_TYPE_ARRAY_OF_MAPS = 12, + BPF_MAP_TYPE_HASH_OF_MAPS = 13, + BPF_MAP_TYPE_DEVMAP = 14, + BPF_MAP_TYPE_SOCKMAP = 15, + BPF_MAP_TYPE_CPUMAP = 16, + BPF_MAP_TYPE_XSKMAP = 17, + BPF_MAP_TYPE_SOCKHASH = 18, + BPF_MAP_TYPE_CGROUP_STORAGE = 19, + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 20, + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 21, + BPF_MAP_TYPE_QUEUE = 22, + BPF_MAP_TYPE_STACK = 23, + BPF_MAP_TYPE_SK_STORAGE = 24, + BPF_MAP_TYPE_DEVMAP_HASH = 25, + BPF_MAP_TYPE_STRUCT_OPS = 26, + BPF_MAP_TYPE_RINGBUF = 27, + BPF_MAP_TYPE_INODE_STORAGE = 28, + BPF_MAP_TYPE_TASK_STORAGE = 29, +}; + +enum bpf_prog_type { + BPF_PROG_TYPE_UNSPEC = 0, + BPF_PROG_TYPE_SOCKET_FILTER = 1, + BPF_PROG_TYPE_KPROBE = 2, + BPF_PROG_TYPE_SCHED_CLS = 3, + BPF_PROG_TYPE_SCHED_ACT = 4, + BPF_PROG_TYPE_TRACEPOINT = 5, + BPF_PROG_TYPE_XDP = 6, + BPF_PROG_TYPE_PERF_EVENT = 7, + BPF_PROG_TYPE_CGROUP_SKB = 8, + BPF_PROG_TYPE_CGROUP_SOCK = 9, + BPF_PROG_TYPE_LWT_IN = 10, + BPF_PROG_TYPE_LWT_OUT = 11, + BPF_PROG_TYPE_LWT_XMIT = 12, + BPF_PROG_TYPE_SOCK_OPS = 13, + BPF_PROG_TYPE_SK_SKB = 14, + BPF_PROG_TYPE_CGROUP_DEVICE = 15, + BPF_PROG_TYPE_SK_MSG = 16, + BPF_PROG_TYPE_RAW_TRACEPOINT = 17, + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 18, + BPF_PROG_TYPE_LWT_SEG6LOCAL = 19, + BPF_PROG_TYPE_LIRC_MODE2 = 20, + BPF_PROG_TYPE_SK_REUSEPORT = 21, + BPF_PROG_TYPE_FLOW_DISSECTOR = 22, + BPF_PROG_TYPE_CGROUP_SYSCTL = 23, + BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE = 24, + BPF_PROG_TYPE_CGROUP_SOCKOPT = 25, + BPF_PROG_TYPE_TRACING = 26, + BPF_PROG_TYPE_STRUCT_OPS = 27, + BPF_PROG_TYPE_EXT = 28, + BPF_PROG_TYPE_LSM = 29, + BPF_PROG_TYPE_SK_LOOKUP = 30, +}; + +enum bpf_attach_type { + BPF_CGROUP_INET_INGRESS = 0, + BPF_CGROUP_INET_EGRESS = 1, + BPF_CGROUP_INET_SOCK_CREATE = 2, + BPF_CGROUP_SOCK_OPS = 3, + BPF_SK_SKB_STREAM_PARSER = 4, + BPF_SK_SKB_STREAM_VERDICT = 5, + BPF_CGROUP_DEVICE = 6, + BPF_SK_MSG_VERDICT = 7, + BPF_CGROUP_INET4_BIND = 8, + BPF_CGROUP_INET6_BIND = 9, + BPF_CGROUP_INET4_CONNECT = 10, + BPF_CGROUP_INET6_CONNECT = 11, + BPF_CGROUP_INET4_POST_BIND = 12, + BPF_CGROUP_INET6_POST_BIND = 13, + BPF_CGROUP_UDP4_SENDMSG = 14, + BPF_CGROUP_UDP6_SENDMSG = 15, + BPF_LIRC_MODE2 = 16, + BPF_FLOW_DISSECTOR = 17, + BPF_CGROUP_SYSCTL = 18, + BPF_CGROUP_UDP4_RECVMSG = 19, + BPF_CGROUP_UDP6_RECVMSG = 20, + BPF_CGROUP_GETSOCKOPT = 21, + BPF_CGROUP_SETSOCKOPT = 22, + BPF_TRACE_RAW_TP = 23, + BPF_TRACE_FENTRY = 24, + BPF_TRACE_FEXIT = 25, + BPF_MODIFY_RETURN = 26, + BPF_LSM_MAC = 27, + BPF_TRACE_ITER = 28, + BPF_CGROUP_INET4_GETPEERNAME = 29, + BPF_CGROUP_INET6_GETPEERNAME = 30, + BPF_CGROUP_INET4_GETSOCKNAME = 31, + BPF_CGROUP_INET6_GETSOCKNAME = 32, + BPF_XDP_DEVMAP = 33, + BPF_CGROUP_INET_SOCK_RELEASE = 34, + BPF_XDP_CPUMAP = 35, + BPF_SK_LOOKUP = 36, + BPF_XDP = 37, + __MAX_BPF_ATTACH_TYPE = 38, +}; + +union bpf_attr { + struct { + __u32 map_type; + __u32 key_size; + __u32 value_size; + __u32 max_entries; + __u32 map_flags; + __u32 inner_map_fd; + __u32 numa_node; + char map_name[16]; + __u32 map_ifindex; + __u32 btf_fd; + __u32 btf_key_type_id; + __u32 btf_value_type_id; + __u32 btf_vmlinux_value_type_id; + }; + struct { + __u32 map_fd; + __u64 key; + union { + __u64 value; + __u64 next_key; + }; + __u64 flags; + }; + struct { + __u64 in_batch; + __u64 out_batch; + __u64 keys; + __u64 values; + __u32 count; + __u32 map_fd; + __u64 elem_flags; + __u64 flags; + } batch; + struct { + __u32 prog_type; + __u32 insn_cnt; + __u64 insns; + __u64 license; + __u32 log_level; + __u32 log_size; + __u64 log_buf; + __u32 kern_version; + __u32 prog_flags; + char prog_name[16]; + __u32 prog_ifindex; + __u32 expected_attach_type; + __u32 prog_btf_fd; + __u32 func_info_rec_size; + __u64 func_info; + __u32 func_info_cnt; + __u32 line_info_rec_size; + __u64 line_info; + __u32 line_info_cnt; + __u32 attach_btf_id; + union { + __u32 attach_prog_fd; + __u32 attach_btf_obj_fd; + }; + }; + struct { + __u64 pathname; + __u32 bpf_fd; + __u32 file_flags; + }; + struct { + __u32 target_fd; + __u32 attach_bpf_fd; + __u32 attach_type; + __u32 attach_flags; + __u32 replace_bpf_fd; + }; + struct { + __u32 prog_fd; + __u32 retval; + __u32 data_size_in; + __u32 data_size_out; + __u64 data_in; + __u64 data_out; + __u32 repeat; + __u32 duration; + __u32 ctx_size_in; + __u32 ctx_size_out; + __u64 ctx_in; + __u64 ctx_out; + __u32 flags; + __u32 cpu; + } test; + struct { + union { + __u32 start_id; + __u32 prog_id; + __u32 map_id; + __u32 btf_id; + __u32 link_id; + }; + __u32 next_id; + __u32 open_flags; + }; + struct { + __u32 bpf_fd; + __u32 info_len; + __u64 info; + } info; + struct { + __u32 target_fd; + __u32 attach_type; + __u32 query_flags; + __u32 attach_flags; + __u64 prog_ids; + __u32 prog_cnt; + } query; + struct { + __u64 name; + __u32 prog_fd; + } raw_tracepoint; + struct { + __u64 btf; + __u64 btf_log_buf; + __u32 btf_size; + __u32 btf_log_size; + __u32 btf_log_level; + }; + struct { + __u32 pid; + __u32 fd; + __u32 flags; + __u32 buf_len; + __u64 buf; + __u32 prog_id; + __u32 fd_type; + __u64 probe_offset; + __u64 probe_addr; + } task_fd_query; + struct { + __u32 prog_fd; + union { + __u32 target_fd; + __u32 target_ifindex; + }; + __u32 attach_type; + __u32 flags; + union { + __u32 target_btf_id; + struct { + __u64 iter_info; + __u32 iter_info_len; + }; + }; + } link_create; + struct { + __u32 link_fd; + __u32 new_prog_fd; + __u32 flags; + __u32 old_prog_fd; + } link_update; + struct { + __u32 link_fd; + } link_detach; + struct { + __u32 type; + } enable_stats; + struct { + __u32 link_fd; + __u32 flags; + } iter_create; + struct { + __u32 prog_fd; + __u32 map_fd; + __u32 flags; + } prog_bind_map; +}; + +struct bpf_func_info { + __u32 insn_off; + __u32 type_id; +}; + +struct bpf_line_info { + __u32 insn_off; + __u32 file_name_off; + __u32 line_off; + __u32 line_col; +}; + +struct bpf_iter_aux_info; + +typedef int (*bpf_iter_init_seq_priv_t)(void *, struct bpf_iter_aux_info *); + +struct bpf_map; + +struct bpf_iter_aux_info { + struct bpf_map *map; +}; + +typedef void (*bpf_iter_fini_seq_priv_t)(void *); + +struct bpf_iter_seq_info { + const struct seq_operations *seq_ops; + bpf_iter_init_seq_priv_t init_seq_private; + bpf_iter_fini_seq_priv_t fini_seq_private; + u32 seq_priv_size; +}; + +struct btf; + +struct btf_type; + +struct bpf_prog_aux; + +struct bpf_local_storage_map; + +struct bpf_map_ops { + int (*map_alloc_check)(union bpf_attr *); + struct bpf_map * (*map_alloc)(union bpf_attr *); + void (*map_release)(struct bpf_map *, struct file *); + void (*map_free)(struct bpf_map *); + int (*map_get_next_key)(struct bpf_map *, void *, void *); + void (*map_release_uref)(struct bpf_map *); + void * (*map_lookup_elem_sys_only)(struct bpf_map *, void *); + int (*map_lookup_batch)(struct bpf_map *, const union bpf_attr *, union bpf_attr *); + int (*map_lookup_and_delete_batch)(struct bpf_map *, const union bpf_attr *, union bpf_attr *); + int (*map_update_batch)(struct bpf_map *, const union bpf_attr *, union bpf_attr *); + int (*map_delete_batch)(struct bpf_map *, const union bpf_attr *, union bpf_attr *); + void * (*map_lookup_elem)(struct bpf_map *, void *); + int (*map_update_elem)(struct bpf_map *, void *, void *, u64); + int (*map_delete_elem)(struct bpf_map *, void *); + int (*map_push_elem)(struct bpf_map *, void *, u64); + int (*map_pop_elem)(struct bpf_map *, void *); + int (*map_peek_elem)(struct bpf_map *, void *); + void * (*map_fd_get_ptr)(struct bpf_map *, struct file *, int); + void (*map_fd_put_ptr)(void *); + int (*map_gen_lookup)(struct bpf_map *, struct bpf_insn *); + u32 (*map_fd_sys_lookup_elem)(void *); + void (*map_seq_show_elem)(struct bpf_map *, void *, struct seq_file *); + int (*map_check_btf)(const struct bpf_map *, const struct btf *, const struct btf_type *, const struct btf_type *); + int (*map_poke_track)(struct bpf_map *, struct bpf_prog_aux *); + void (*map_poke_untrack)(struct bpf_map *, struct bpf_prog_aux *); + void (*map_poke_run)(struct bpf_map *, u32, struct bpf_prog *, struct bpf_prog *); + int (*map_direct_value_addr)(const struct bpf_map *, u64 *, u32); + int (*map_direct_value_meta)(const struct bpf_map *, u64, u32 *); + int (*map_mmap)(struct bpf_map *, struct vm_area_struct *); + __poll_t (*map_poll)(struct bpf_map *, struct file *, struct poll_table_struct *); + int (*map_local_storage_charge)(struct bpf_local_storage_map *, void *, u32); + void (*map_local_storage_uncharge)(struct bpf_local_storage_map *, void *, u32); + struct bpf_local_storage ** (*map_owner_storage_ptr)(void *); + bool (*map_meta_equal)(const struct bpf_map *, const struct bpf_map *); + const char * const map_btf_name; + int *map_btf_id; + const struct bpf_iter_seq_info *iter_seq_info; +}; + +struct bpf_map { + const struct bpf_map_ops *ops; + struct bpf_map *inner_map_meta; + void *security; + enum bpf_map_type map_type; + u32 key_size; + u32 value_size; + u32 max_entries; + u32 map_flags; + int spin_lock_off; + u32 id; + int numa_node; + u32 btf_key_type_id; + u32 btf_value_type_id; + struct btf *btf; + struct mem_cgroup *memcg; + char name[16]; + u32 btf_vmlinux_value_type_id; + bool bypass_spec_v1; + bool frozen; + long: 16; + long: 64; + long: 64; + long: 64; + atomic64_t refcnt; + atomic64_t usercnt; + struct work_struct work; + struct mutex freeze_mutex; + u64 writecnt; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct btf_header { + __u16 magic; + __u8 version; + __u8 flags; + __u32 hdr_len; + __u32 type_off; + __u32 type_len; + __u32 str_off; + __u32 str_len; +}; + +struct btf { + void *data; + struct btf_type **types; + u32 *resolved_ids; + u32 *resolved_sizes; + const char *strings; + void *nohdr_data; + struct btf_header hdr; + u32 nr_types; + u32 types_size; + u32 data_size; + refcount_t refcnt; + u32 id; + struct callback_head rcu; + struct btf *base_btf; + u32 start_id; + u32 start_str_off; + char name[56]; + bool kernel_btf; +}; + +struct btf_type { + __u32 name_off; + __u32 info; + union { + __u32 size; + __u32 type; + }; +}; + +struct bpf_ksym { + long unsigned int start; + long unsigned int end; + char name[128]; + struct list_head lnode; + struct latch_tree_node tnode; + bool prog; +}; + +struct bpf_ctx_arg_aux; + +struct bpf_trampoline; + +struct bpf_jit_poke_descriptor; + +struct bpf_prog_ops; + +struct bpf_prog_offload; + +struct bpf_func_info_aux; + +struct bpf_prog_stats; + +struct bpf_prog_aux { + atomic64_t refcnt; + u32 used_map_cnt; + u32 max_ctx_offset; + u32 max_pkt_offset; + u32 max_tp_access; + u32 stack_depth; + u32 id; + u32 func_cnt; + u32 func_idx; + u32 attach_btf_id; + u32 ctx_arg_info_size; + u32 max_rdonly_access; + u32 max_rdwr_access; + struct btf *attach_btf; + const struct bpf_ctx_arg_aux *ctx_arg_info; + struct mutex dst_mutex; + struct bpf_prog *dst_prog; + struct bpf_trampoline *dst_trampoline; + enum bpf_prog_type saved_dst_prog_type; + enum bpf_attach_type saved_dst_attach_type; + bool verifier_zext; + bool offload_requested; + bool attach_btf_trace; + bool func_proto_unreliable; + bool sleepable; + bool tail_call_reachable; + struct hlist_node tramp_hlist; + const struct btf_type *attach_func_proto; + const char *attach_func_name; + struct bpf_prog **func; + void *jit_data; + struct bpf_jit_poke_descriptor *poke_tab; + u32 size_poke_tab; + struct bpf_ksym ksym; + const struct bpf_prog_ops *ops; + struct bpf_map **used_maps; + struct mutex used_maps_mutex; + struct bpf_prog *prog; + struct user_struct *user; + u64 load_time; + struct bpf_map *cgroup_storage[2]; + char name[16]; + void *security; + struct bpf_prog_offload *offload; + struct btf *btf; + struct bpf_func_info *func_info; + struct bpf_func_info_aux *func_info_aux; + struct bpf_line_info *linfo; + void **jited_linfo; + u32 func_info_cnt; + u32 nr_linfo; + u32 linfo_idx; + u32 num_exentries; + struct exception_table_entry *extable; + struct bpf_prog_stats *stats; + union { + struct work_struct work; + struct callback_head rcu; + }; +}; + +struct sock_filter { + __u16 code; + __u8 jt; + __u8 jf; + __u32 k; +}; + +struct sock_fprog_kern; + +struct bpf_prog { + u16 pages; + u16 jited: 1; + u16 jit_requested: 1; + u16 gpl_compatible: 1; + u16 cb_access: 1; + u16 dst_needed: 1; + u16 blinded: 1; + u16 is_func: 1; + u16 kprobe_override: 1; + u16 has_callchain_buf: 1; + u16 enforce_expected_attach_type: 1; + u16 call_get_stack: 1; + enum bpf_prog_type type; + enum bpf_attach_type expected_attach_type; + u32 len; + u32 jited_len; + u8 tag[8]; + struct bpf_prog_aux *aux; + struct sock_fprog_kern *orig_prog; + unsigned int (*bpf_func)(const void *, const struct bpf_insn *); + struct sock_filter insns[0]; + struct bpf_insn insnsi[0]; +}; + +struct bpf_offloaded_map; + +struct bpf_map_dev_ops { + int (*map_get_next_key)(struct bpf_offloaded_map *, void *, void *); + int (*map_lookup_elem)(struct bpf_offloaded_map *, void *, void *); + int (*map_update_elem)(struct bpf_offloaded_map *, void *, void *, u64); + int (*map_delete_elem)(struct bpf_offloaded_map *, void *); +}; + +struct bpf_offloaded_map { + struct bpf_map map; + struct net_device *netdev; + const struct bpf_map_dev_ops *dev_ops; + void *dev_priv; + struct list_head offloads; + long: 64; + long: 64; + long: 64; +}; + +struct net_device_stats { + long unsigned int rx_packets; + long unsigned int tx_packets; + long unsigned int rx_bytes; + long unsigned int tx_bytes; + long unsigned int rx_errors; + long unsigned int tx_errors; + long unsigned int rx_dropped; + long unsigned int tx_dropped; + long unsigned int multicast; + long unsigned int collisions; + long unsigned int rx_length_errors; + long unsigned int rx_over_errors; + long unsigned int rx_crc_errors; + long unsigned int rx_frame_errors; + long unsigned int rx_fifo_errors; + long unsigned int rx_missed_errors; + long unsigned int tx_aborted_errors; + long unsigned int tx_carrier_errors; + long unsigned int tx_fifo_errors; + long unsigned int tx_heartbeat_errors; + long unsigned int tx_window_errors; + long unsigned int rx_compressed; + long unsigned int tx_compressed; +}; + +struct netdev_hw_addr_list { + struct list_head list; + int count; +}; + +struct tipc_bearer; + +struct mpls_dev; + +enum rx_handler_result { + RX_HANDLER_CONSUMED = 0, + RX_HANDLER_ANOTHER = 1, + RX_HANDLER_EXACT = 2, + RX_HANDLER_PASS = 3, +}; + +typedef enum rx_handler_result rx_handler_result_t; + +typedef rx_handler_result_t rx_handler_func_t(struct sk_buff **); + +enum netdev_ml_priv_type { + ML_PRIV_NONE = 0, + ML_PRIV_CAN = 1, +}; + +struct pcpu_dstats; + +struct garp_port; + +struct mrp_port; + +struct netdev_tc_txq { + u16 count; + u16 offset; +}; + +struct macsec_ops; + +struct udp_tunnel_nic; + +struct bpf_xdp_link; + +struct bpf_xdp_entity { + struct bpf_prog *prog; + struct bpf_xdp_link *link; +}; + +struct netdev_name_node; + +struct dev_ifalias; + +struct iw_handler_def; + +struct iw_public_data; + +struct net_device_ops; + +struct ethtool_ops; + +struct l3mdev_ops; + +struct ndisc_ops; + +struct xfrmdev_ops; + +struct tlsdev_ops; + +struct header_ops; + +struct vlan_info; + +struct dsa_port; + +struct in_device; + +struct inet6_dev; + +struct wireless_dev; + +struct wpan_dev; + +struct netdev_rx_queue; + +struct mini_Qdisc; + +struct netdev_queue; + +struct cpu_rmap; + +struct Qdisc; + +struct xdp_dev_bulk_queue; + +struct xps_dev_maps; + +struct netpoll_info; + +struct pcpu_lstats; + +struct pcpu_sw_netstats; + +struct rtnl_link_ops; + +struct dcbnl_rtnl_ops; + +struct netprio_map; + +struct phy_device; + +struct sfp_bus; + +struct udp_tunnel_nic_info; + +struct net_device { + char name[16]; + struct netdev_name_node *name_node; + struct dev_ifalias *ifalias; + long unsigned int mem_end; + long unsigned int mem_start; + long unsigned int base_addr; + int irq; + long unsigned int state; + struct list_head dev_list; + struct list_head napi_list; + struct list_head unreg_list; + struct list_head close_list; + struct list_head ptype_all; + struct list_head ptype_specific; + struct { + struct list_head upper; + struct list_head lower; + } adj_list; + netdev_features_t features; + netdev_features_t hw_features; + netdev_features_t wanted_features; + netdev_features_t vlan_features; + netdev_features_t hw_enc_features; + netdev_features_t mpls_features; + netdev_features_t gso_partial_features; + int ifindex; + int group; + struct net_device_stats stats; + atomic_long_t rx_dropped; + atomic_long_t tx_dropped; + atomic_long_t rx_nohandler; + atomic_t carrier_up_count; + atomic_t carrier_down_count; + const struct iw_handler_def *wireless_handlers; + struct iw_public_data *wireless_data; + const struct net_device_ops *netdev_ops; + const struct ethtool_ops *ethtool_ops; + const struct l3mdev_ops *l3mdev_ops; + const struct ndisc_ops *ndisc_ops; + const struct xfrmdev_ops *xfrmdev_ops; + const struct tlsdev_ops *tlsdev_ops; + const struct header_ops *header_ops; + unsigned int flags; + unsigned int priv_flags; + short unsigned int gflags; + short unsigned int padded; + unsigned char operstate; + unsigned char link_mode; + unsigned char if_port; + unsigned char dma; + unsigned int mtu; + unsigned int min_mtu; + unsigned int max_mtu; + short unsigned int type; + short unsigned int hard_header_len; + unsigned char min_header_len; + unsigned char name_assign_type; + short unsigned int needed_headroom; + short unsigned int needed_tailroom; + unsigned char perm_addr[32]; + unsigned char addr_assign_type; + unsigned char addr_len; + unsigned char upper_level; + unsigned char lower_level; + short unsigned int neigh_priv_len; + short unsigned int dev_id; + short unsigned int dev_port; + spinlock_t addr_list_lock; + struct netdev_hw_addr_list uc; + struct netdev_hw_addr_list mc; + struct netdev_hw_addr_list dev_addrs; + struct kset *queues_kset; + unsigned int promiscuity; + unsigned int allmulti; + bool uc_promisc; + struct vlan_info *vlan_info; + struct dsa_port *dsa_ptr; + struct tipc_bearer *tipc_ptr; + void *atalk_ptr; + struct in_device *ip_ptr; + struct inet6_dev *ip6_ptr; + void *ax25_ptr; + struct wireless_dev *ieee80211_ptr; + struct wpan_dev *ieee802154_ptr; + struct mpls_dev *mpls_ptr; + unsigned char *dev_addr; + struct netdev_rx_queue *_rx; + unsigned int num_rx_queues; + unsigned int real_num_rx_queues; + struct bpf_prog *xdp_prog; + long unsigned int gro_flush_timeout; + int napi_defer_hard_irqs; + rx_handler_func_t *rx_handler; + void *rx_handler_data; + struct mini_Qdisc *miniq_ingress; + struct netdev_queue *ingress_queue; + struct nf_hook_entries *nf_hooks_ingress; + unsigned char broadcast[32]; + struct cpu_rmap *rx_cpu_rmap; + struct hlist_node index_hlist; + struct netdev_queue *_tx; + unsigned int num_tx_queues; + unsigned int real_num_tx_queues; + struct Qdisc *qdisc; + unsigned int tx_queue_len; + spinlock_t tx_global_lock; + struct xdp_dev_bulk_queue *xdp_bulkq; + struct xps_dev_maps *xps_cpus_map; + struct xps_dev_maps *xps_rxqs_map; + struct mini_Qdisc *miniq_egress; + struct hlist_head qdisc_hash[16]; + struct timer_list watchdog_timer; + int watchdog_timeo; + u32 proto_down_reason; + struct list_head todo_list; + int *pcpu_refcnt; + struct list_head link_watch_list; + enum { + NETREG_UNINITIALIZED = 0, + NETREG_REGISTERED = 1, + NETREG_UNREGISTERING = 2, + NETREG_UNREGISTERED = 3, + NETREG_RELEASED = 4, + NETREG_DUMMY = 5, + } reg_state: 8; + bool dismantle; + enum { + RTNL_LINK_INITIALIZED = 0, + RTNL_LINK_INITIALIZING = 1, + } rtnl_link_state: 16; + bool needs_free_netdev; + void (*priv_destructor)(struct net_device *); + struct netpoll_info *npinfo; + possible_net_t nd_net; + void *ml_priv; + enum netdev_ml_priv_type ml_priv_type; + union { + struct pcpu_lstats *lstats; + struct pcpu_sw_netstats *tstats; + struct pcpu_dstats *dstats; + }; + struct garp_port *garp_port; + struct mrp_port *mrp_port; + struct device dev; + const struct attribute_group *sysfs_groups[4]; + const struct attribute_group *sysfs_rx_queue_group; + const struct rtnl_link_ops *rtnl_link_ops; + unsigned int gso_max_size; + u16 gso_max_segs; + const struct dcbnl_rtnl_ops *dcbnl_ops; + s16 num_tc; + struct netdev_tc_txq tc_to_txq[16]; + u8 prio_tc_map[16]; + unsigned int fcoe_ddp_xid; + struct netprio_map *priomap; + struct phy_device *phydev; + struct sfp_bus *sfp_bus; + struct lock_class_key *qdisc_tx_busylock; + struct lock_class_key *qdisc_running_key; + bool proto_down; + unsigned int wol_enabled: 1; + struct list_head net_notifier_list; + const struct macsec_ops *macsec_ops; + const struct udp_tunnel_nic_info *udp_tunnel_nic_info; + struct udp_tunnel_nic *udp_tunnel_nic; + struct bpf_xdp_entity xdp_state[3]; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum bpf_reg_type { + NOT_INIT = 0, + SCALAR_VALUE = 1, + PTR_TO_CTX = 2, + CONST_PTR_TO_MAP = 3, + PTR_TO_MAP_VALUE = 4, + PTR_TO_MAP_VALUE_OR_NULL = 5, + PTR_TO_STACK = 6, + PTR_TO_PACKET_META = 7, + PTR_TO_PACKET = 8, + PTR_TO_PACKET_END = 9, + PTR_TO_FLOW_KEYS = 10, + PTR_TO_SOCKET = 11, + PTR_TO_SOCKET_OR_NULL = 12, + PTR_TO_SOCK_COMMON = 13, + PTR_TO_SOCK_COMMON_OR_NULL = 14, + PTR_TO_TCP_SOCK = 15, + PTR_TO_TCP_SOCK_OR_NULL = 16, + PTR_TO_TP_BUFFER = 17, + PTR_TO_XDP_SOCK = 18, + PTR_TO_BTF_ID = 19, + PTR_TO_BTF_ID_OR_NULL = 20, + PTR_TO_MEM = 21, + PTR_TO_MEM_OR_NULL = 22, + PTR_TO_RDONLY_BUF = 23, + PTR_TO_RDONLY_BUF_OR_NULL = 24, + PTR_TO_RDWR_BUF = 25, + PTR_TO_RDWR_BUF_OR_NULL = 26, + PTR_TO_PERCPU_BTF_ID = 27, +}; + +struct bpf_prog_ops { + int (*test_run)(struct bpf_prog *, const union bpf_attr *, union bpf_attr *); +}; + +struct bpf_offload_dev; + +struct bpf_prog_offload { + struct bpf_prog *prog; + struct net_device *netdev; + struct bpf_offload_dev *offdev; + void *dev_priv; + struct list_head offloads; + bool dev_state; + bool opt_failed; + void *jited_image; + u32 jited_len; +}; + +struct bpf_prog_stats { + u64 cnt; + u64 nsecs; + struct u64_stats_sync syncp; +}; + +struct btf_func_model { + u8 ret_size; + u8 nr_args; + u8 arg_size[12]; +}; + +struct bpf_tramp_image { + void *image; + struct bpf_ksym ksym; + struct percpu_ref pcref; + void *ip_after_call; + void *ip_epilogue; + union { + struct callback_head rcu; + struct work_struct work; + }; +}; + +struct bpf_trampoline { + struct hlist_node hlist; + struct mutex mutex; + refcount_t refcnt; + u64 key; + struct { + struct btf_func_model model; + void *addr; + bool ftrace_managed; + } func; + struct bpf_prog *extension_prog; + struct hlist_head progs_hlist[3]; + int progs_cnt[3]; + struct bpf_tramp_image *cur_image; + u64 selector; + struct module *mod; +}; + +struct bpf_func_info_aux { + u16 linkage; + bool unreliable; +}; + +struct bpf_jit_poke_descriptor { + void *tailcall_target; + void *tailcall_bypass; + void *bypass_addr; + union { + struct { + struct bpf_map *map; + u32 key; + } tail_call; + }; + bool tailcall_target_stable; + u8 adj_off; + u16 reason; + u32 insn_idx; +}; + +struct bpf_ctx_arg_aux { + u32 offset; + enum bpf_reg_type reg_type; + u32 btf_id; +}; + +typedef unsigned int sk_buff_data_t; + +struct skb_ext; + +struct sk_buff { + union { + struct { + struct sk_buff *next; + struct sk_buff *prev; + union { + struct net_device *dev; + long unsigned int dev_scratch; + }; + }; + struct rb_node rbnode; + struct list_head list; + }; + union { + struct sock *sk; + int ip_defrag_offset; + }; + union { + ktime_t tstamp; + u64 skb_mstamp_ns; + }; + char cb[48]; + union { + struct { + long unsigned int _skb_refdst; + void (*destructor)(struct sk_buff *); + }; + struct list_head tcp_tsorted_anchor; + }; + long unsigned int _nfct; + unsigned int len; + unsigned int data_len; + __u16 mac_len; + __u16 hdr_len; + __u16 queue_mapping; + __u8 __cloned_offset[0]; + __u8 cloned: 1; + __u8 nohdr: 1; + __u8 fclone: 2; + __u8 peeked: 1; + __u8 head_frag: 1; + __u8 pfmemalloc: 1; + __u8 active_extensions; + __u32 headers_start[0]; + __u8 __pkt_type_offset[0]; + __u8 pkt_type: 3; + __u8 ignore_df: 1; + __u8 nf_trace: 1; + __u8 ip_summed: 2; + __u8 ooo_okay: 1; + __u8 l4_hash: 1; + __u8 sw_hash: 1; + __u8 wifi_acked_valid: 1; + __u8 wifi_acked: 1; + __u8 no_fcs: 1; + __u8 encapsulation: 1; + __u8 encap_hdr_csum: 1; + __u8 csum_valid: 1; + __u8 __pkt_vlan_present_offset[0]; + __u8 vlan_present: 1; + __u8 csum_complete_sw: 1; + __u8 csum_level: 2; + __u8 csum_not_inet: 1; + __u8 dst_pending_confirm: 1; + __u8 ndisc_nodetype: 2; + __u8 ipvs_property: 1; + __u8 inner_protocol_type: 1; + __u8 remcsum_offload: 1; + __u8 offload_fwd_mark: 1; + __u8 offload_l3_fwd_mark: 1; + __u8 tc_skip_classify: 1; + __u8 tc_at_ingress: 1; + __u8 redirected: 1; + __u8 from_ingress: 1; + __u8 decrypted: 1; + __u16 tc_index; + union { + __wsum csum; + struct { + __u16 csum_start; + __u16 csum_offset; + }; + }; + __u32 priority; + int skb_iif; + __u32 hash; + __be16 vlan_proto; + __u16 vlan_tci; + union { + unsigned int napi_id; + unsigned int sender_cpu; + }; + __u32 secmark; + union { + __u32 mark; + __u32 reserved_tailroom; + }; + union { + __be16 inner_protocol; + __u8 inner_ipproto; + }; + __u16 inner_transport_header; + __u16 inner_network_header; + __u16 inner_mac_header; + __be16 protocol; + __u16 transport_header; + __u16 network_header; + __u16 mac_header; + __u32 headers_end[0]; + sk_buff_data_t tail; + sk_buff_data_t end; + unsigned char *head; + unsigned char *data; + unsigned int truesize; + refcount_t users; + struct skb_ext *extensions; +}; + +struct scatterlist { + long unsigned int page_link; + unsigned int offset; + unsigned int length; + dma_addr_t dma_address; + unsigned int dma_length; +}; + +enum { + Root_NFS = 255, + Root_CIFS = 254, + Root_RAM0 = 1048576, + Root_RAM1 = 1048577, + Root_FD0 = 2097152, + Root_HDA1 = 3145729, + Root_HDA2 = 3145730, + Root_SDA1 = 8388609, + Root_SDA2 = 8388610, + Root_HDC1 = 23068673, + Root_SR0 = 11534336, +}; + +struct flowi_tunnel { + __be64 tun_id; +}; + +struct flowi_common { + int flowic_oif; + int flowic_iif; + __u32 flowic_mark; + __u8 flowic_tos; + __u8 flowic_scope; + __u8 flowic_proto; + __u8 flowic_flags; + __u32 flowic_secid; + kuid_t flowic_uid; + struct flowi_tunnel flowic_tun_key; + __u32 flowic_multipath_hash; +}; + +union flowi_uli { + struct { + __be16 dport; + __be16 sport; + } ports; + struct { + __u8 type; + __u8 code; + } icmpt; + struct { + __le16 dport; + __le16 sport; + } dnports; + __be32 spi; + __be32 gre_key; + struct { + __u8 type; + } mht; +}; + +struct flowi4 { + struct flowi_common __fl_common; + __be32 saddr; + __be32 daddr; + union flowi_uli uli; +}; + +struct flowi6 { + struct flowi_common __fl_common; + struct in6_addr daddr; + struct in6_addr saddr; + __be32 flowlabel; + union flowi_uli uli; + __u32 mp_hash; +}; + +struct flowidn { + struct flowi_common __fl_common; + __le16 daddr; + __le16 saddr; + union flowi_uli uli; +}; + +struct flowi { + union { + struct flowi_common __fl_common; + struct flowi4 ip4; + struct flowi6 ip6; + struct flowidn dn; + } u; +}; + +struct ipstats_mib { + u64 mibs[37]; + struct u64_stats_sync syncp; +}; + +struct icmp_mib { + long unsigned int mibs[28]; +}; + +struct icmpmsg_mib { + atomic_long_t mibs[512]; +}; + +struct icmpv6_mib { + long unsigned int mibs[6]; +}; + +struct icmpv6_mib_device { + atomic_long_t mibs[6]; +}; + +struct icmpv6msg_mib { + atomic_long_t mibs[512]; +}; + +struct icmpv6msg_mib_device { + atomic_long_t mibs[512]; +}; + +struct tcp_mib { + long unsigned int mibs[16]; +}; + +struct udp_mib { + long unsigned int mibs[10]; +}; + +struct linux_mib { + long unsigned int mibs[124]; +}; + +struct linux_xfrm_mib { + long unsigned int mibs[29]; +}; + +struct linux_tls_mib { + long unsigned int mibs[11]; +}; + +struct inet_frags; + +struct fqdir { + long int high_thresh; + long int low_thresh; + int timeout; + int max_dist; + struct inet_frags *f; + struct net *net; + bool dead; + long: 56; + long: 64; + long: 64; + struct rhashtable rhashtable; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + atomic_long_t mem; + struct work_struct destroy_work; + struct llist_node free_list; + long: 64; + long: 64; +}; + +struct inet_frag_queue; + +struct inet_frags { + unsigned int qsize; + void (*constructor)(struct inet_frag_queue *, const void *); + void (*destructor)(struct inet_frag_queue *); + void (*frag_expire)(struct timer_list *); + struct kmem_cache *frags_cachep; + const char *frags_cache_name; + struct rhashtable_params rhash_params; + refcount_t refcnt; + struct completion completion; +}; + +struct frag_v4_compare_key { + __be32 saddr; + __be32 daddr; + u32 user; + u32 vif; + __be16 id; + u16 protocol; +}; + +struct frag_v6_compare_key { + struct in6_addr saddr; + struct in6_addr daddr; + u32 user; + __be32 id; + u32 iif; +}; + +struct inet_frag_queue { + struct rhash_head node; + union { + struct frag_v4_compare_key v4; + struct frag_v6_compare_key v6; + } key; + struct timer_list timer; + spinlock_t lock; + refcount_t refcnt; + struct rb_root rb_fragments; + struct sk_buff *fragments_tail; + struct sk_buff *last_run_head; + ktime_t stamp; + int len; + int meat; + __u8 flags; + u16 max_size; + struct fqdir *fqdir; + struct callback_head rcu; +}; + +struct fib_rule; + +struct fib_lookup_arg; + +struct fib_rule_hdr; + +struct nlattr; + +struct netlink_ext_ack; + +struct nla_policy; + +struct fib_rules_ops { + int family; + struct list_head list; + int rule_size; + int addr_size; + int unresolved_rules; + int nr_goto_rules; + unsigned int fib_rules_seq; + int (*action)(struct fib_rule *, struct flowi *, int, struct fib_lookup_arg *); + bool (*suppress)(struct fib_rule *, struct fib_lookup_arg *); + int (*match)(struct fib_rule *, struct flowi *, int); + int (*configure)(struct fib_rule *, struct sk_buff *, struct fib_rule_hdr *, struct nlattr **, struct netlink_ext_ack *); + int (*delete)(struct fib_rule *); + int (*compare)(struct fib_rule *, struct fib_rule_hdr *, struct nlattr **); + int (*fill)(struct fib_rule *, struct sk_buff *, struct fib_rule_hdr *); + size_t (*nlmsg_payload)(struct fib_rule *); + void (*flush_cache)(struct fib_rules_ops *); + int nlgroup; + const struct nla_policy *policy; + struct list_head rules_list; + struct module *owner; + struct net *fro_net; + struct callback_head rcu; +}; + +enum tcp_ca_event { + CA_EVENT_TX_START = 0, + CA_EVENT_CWND_RESTART = 1, + CA_EVENT_COMPLETE_CWR = 2, + CA_EVENT_LOSS = 3, + CA_EVENT_ECN_NO_CE = 4, + CA_EVENT_ECN_IS_CE = 5, +}; + +struct ack_sample; + +struct rate_sample; + +union tcp_cc_info; + +struct tcp_congestion_ops { + struct list_head list; + u32 key; + u32 flags; + void (*init)(struct sock *); + void (*release)(struct sock *); + u32 (*ssthresh)(struct sock *); + void (*cong_avoid)(struct sock *, u32, u32); + void (*set_state)(struct sock *, u8); + void (*cwnd_event)(struct sock *, enum tcp_ca_event); + void (*in_ack_event)(struct sock *, u32); + u32 (*undo_cwnd)(struct sock *); + void (*pkts_acked)(struct sock *, const struct ack_sample *); + u32 (*min_tso_segs)(struct sock *); + u32 (*sndbuf_expand)(struct sock *); + void (*cong_control)(struct sock *, const struct rate_sample *); + size_t (*get_info)(struct sock *, u32, int *, union tcp_cc_info *); + char name[16]; + struct module *owner; +}; + +struct fib_notifier_ops { + int family; + struct list_head list; + unsigned int (*fib_seq_read)(struct net *); + int (*fib_dump)(struct net *, struct notifier_block *, struct netlink_ext_ack *); + struct module *owner; + struct callback_head rcu; +}; + +struct xfrm_state; + +struct lwtunnel_state; + +struct dst_entry { + struct net_device *dev; + struct dst_ops *ops; + long unsigned int _metrics; + long unsigned int expires; + struct xfrm_state *xfrm; + int (*input)(struct sk_buff *); + int (*output)(struct net *, struct sock *, struct sk_buff *); + short unsigned int flags; + short int obsolete; + short unsigned int header_len; + short unsigned int trailer_len; + atomic_t __refcnt; + int __use; + long unsigned int lastuse; + struct lwtunnel_state *lwtstate; + struct callback_head callback_head; + short int error; + short int __pad; + __u32 tclassid; +}; + +struct hh_cache { + unsigned int hh_len; + seqlock_t hh_lock; + long unsigned int hh_data[16]; +}; + +struct neigh_table; + +struct neigh_parms; + +struct neigh_ops; + +struct neighbour { + struct neighbour *next; + struct neigh_table *tbl; + struct neigh_parms *parms; + long unsigned int confirmed; + long unsigned int updated; + rwlock_t lock; + refcount_t refcnt; + unsigned int arp_queue_len_bytes; + struct sk_buff_head arp_queue; + struct timer_list timer; + long unsigned int used; + atomic_t probes; + __u8 flags; + __u8 nud_state; + __u8 type; + __u8 dead; + u8 protocol; + seqlock_t ha_lock; + int: 32; + unsigned char ha[32]; + struct hh_cache hh; + int (*output)(struct neighbour *, struct sk_buff *); + const struct neigh_ops *ops; + struct list_head gc_list; + struct callback_head rcu; + struct net_device *dev; + u8 primary_key[0]; +}; + +struct ipv6_stable_secret { + bool initialized; + struct in6_addr secret; +}; + +struct ipv6_devconf { + __s32 forwarding; + __s32 hop_limit; + __s32 mtu6; + __s32 accept_ra; + __s32 accept_redirects; + __s32 autoconf; + __s32 dad_transmits; + __s32 rtr_solicits; + __s32 rtr_solicit_interval; + __s32 rtr_solicit_max_interval; + __s32 rtr_solicit_delay; + __s32 force_mld_version; + __s32 mldv1_unsolicited_report_interval; + __s32 mldv2_unsolicited_report_interval; + __s32 use_tempaddr; + __s32 temp_valid_lft; + __s32 temp_prefered_lft; + __s32 regen_max_retry; + __s32 max_desync_factor; + __s32 max_addresses; + __s32 accept_ra_defrtr; + __s32 accept_ra_min_hop_limit; + __s32 accept_ra_pinfo; + __s32 ignore_routes_with_linkdown; + __s32 accept_ra_rtr_pref; + __s32 rtr_probe_interval; + __s32 accept_ra_rt_info_min_plen; + __s32 accept_ra_rt_info_max_plen; + __s32 proxy_ndp; + __s32 accept_source_route; + __s32 accept_ra_from_local; + __s32 optimistic_dad; + __s32 use_optimistic; + __s32 mc_forwarding; + __s32 disable_ipv6; + __s32 drop_unicast_in_l2_multicast; + __s32 accept_dad; + __s32 force_tllao; + __s32 ndisc_notify; + __s32 suppress_frag_ndisc; + __s32 accept_ra_mtu; + __s32 drop_unsolicited_na; + struct ipv6_stable_secret stable_secret; + __s32 use_oif_addrs_only; + __s32 keep_addr_on_down; + __s32 seg6_enabled; + __s32 seg6_require_hmac; + __u32 enhanced_dad; + __u32 addr_gen_mode; + __s32 disable_policy; + __s32 ndisc_tclass; + __s32 rpl_seg_enabled; + struct ctl_table_header *sysctl_header; +}; + +struct nf_queue_entry; + +struct nf_queue_handler { + int (*outfn)(struct nf_queue_entry *, unsigned int); + void (*nf_hook_drop)(struct net *); +}; + +enum nf_log_type { + NF_LOG_TYPE_LOG = 0, + NF_LOG_TYPE_ULOG = 1, + NF_LOG_TYPE_MAX = 2, +}; + +typedef u8 u_int8_t; + +struct nf_loginfo; + +typedef void nf_logfn(struct net *, u_int8_t, unsigned int, const struct sk_buff *, const struct net_device *, const struct net_device *, const struct nf_loginfo *, const char *); + +struct nf_logger { + char *name; + enum nf_log_type type; + nf_logfn *logfn; + struct module *me; +}; + +struct hlist_nulls_head { + struct hlist_nulls_node *first; +}; + +struct ip_conntrack_stat { + unsigned int found; + unsigned int invalid; + unsigned int insert; + unsigned int insert_failed; + unsigned int clash_resolve; + unsigned int drop; + unsigned int early_drop; + unsigned int error; + unsigned int expect_new; + unsigned int expect_create; + unsigned int expect_delete; + unsigned int search_restart; +}; + +struct ct_pcpu { + spinlock_t lock; + struct hlist_nulls_head unconfirmed; + struct hlist_nulls_head dying; +}; + +typedef struct { + union { + void *kernel; + void *user; + }; + bool is_kernel: 1; +} sockptr_t; + +typedef enum { + SS_FREE = 0, + SS_UNCONNECTED = 1, + SS_CONNECTING = 2, + SS_CONNECTED = 3, + SS_DISCONNECTING = 4, +} socket_state; + +struct socket_wq { + wait_queue_head_t wait; + struct fasync_struct *fasync_list; + long unsigned int flags; + struct callback_head rcu; + long: 64; +}; + +struct proto_ops; + +struct socket { + socket_state state; + short int type; + long unsigned int flags; + struct file *file; + struct sock *sk; + const struct proto_ops *ops; + long: 64; + long: 64; + long: 64; + struct socket_wq wq; +}; + +typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, unsigned int, size_t); + +struct proto_ops { + int family; + unsigned int flags; + struct module *owner; + int (*release)(struct socket *); + int (*bind)(struct socket *, struct sockaddr *, int); + int (*connect)(struct socket *, struct sockaddr *, int, int); + int (*socketpair)(struct socket *, struct socket *); + int (*accept)(struct socket *, struct socket *, int, bool); + int (*getname)(struct socket *, struct sockaddr *, int); + __poll_t (*poll)(struct file *, struct socket *, struct poll_table_struct *); + int (*ioctl)(struct socket *, unsigned int, long unsigned int); + int (*compat_ioctl)(struct socket *, unsigned int, long unsigned int); + int (*gettstamp)(struct socket *, void *, bool, bool); + int (*listen)(struct socket *, int); + int (*shutdown)(struct socket *, int); + int (*setsockopt)(struct socket *, int, int, sockptr_t, unsigned int); + int (*getsockopt)(struct socket *, int, int, char *, int *); + void (*show_fdinfo)(struct seq_file *, struct socket *); + int (*sendmsg)(struct socket *, struct msghdr *, size_t); + int (*recvmsg)(struct socket *, struct msghdr *, size_t, int); + int (*mmap)(struct file *, struct socket *, struct vm_area_struct *); + ssize_t (*sendpage)(struct socket *, struct page *, int, size_t, int); + ssize_t (*splice_read)(struct socket *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); + int (*set_peek_off)(struct sock *, int); + int (*peek_len)(struct socket *); + int (*read_sock)(struct sock *, read_descriptor_t *, sk_read_actor_t); + int (*sendpage_locked)(struct sock *, struct page *, int, size_t, int); + int (*sendmsg_locked)(struct sock *, struct msghdr *, size_t); + int (*set_rcvlowat)(struct sock *, int); +}; + +struct pipe_buf_operations; + +struct pipe_buffer { + struct page *page; + unsigned int offset; + unsigned int len; + const struct pipe_buf_operations *ops; + unsigned int flags; + long unsigned int private; +}; + +struct pipe_buf_operations { + int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *); + void (*release)(struct pipe_inode_info *, struct pipe_buffer *); + bool (*try_steal)(struct pipe_inode_info *, struct pipe_buffer *); + bool (*get)(struct pipe_inode_info *, struct pipe_buffer *); +}; + +struct skb_ext { + refcount_t refcnt; + u8 offset[4]; + u8 chunks; + long: 56; + char data[0]; +}; + +struct dql { + unsigned int num_queued; + unsigned int adj_limit; + unsigned int last_obj_cnt; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + unsigned int limit; + unsigned int num_completed; + unsigned int prev_ovlimit; + unsigned int prev_num_queued; + unsigned int prev_last_obj_cnt; + unsigned int lowest_slack; + long unsigned int slack_start_time; + unsigned int max_limit; + unsigned int min_limit; + unsigned int slack_hold_time; + long: 32; + long: 64; + long: 64; +}; + +struct ieee_ets { + __u8 willing; + __u8 ets_cap; + __u8 cbs; + __u8 tc_tx_bw[8]; + __u8 tc_rx_bw[8]; + __u8 tc_tsa[8]; + __u8 prio_tc[8]; + __u8 tc_reco_bw[8]; + __u8 tc_reco_tsa[8]; + __u8 reco_prio_tc[8]; +}; + +struct ieee_maxrate { + __u64 tc_maxrate[8]; +}; + +struct ieee_qcn { + __u8 rpg_enable[8]; + __u32 rppp_max_rps[8]; + __u32 rpg_time_reset[8]; + __u32 rpg_byte_reset[8]; + __u32 rpg_threshold[8]; + __u32 rpg_max_rate[8]; + __u32 rpg_ai_rate[8]; + __u32 rpg_hai_rate[8]; + __u32 rpg_gd[8]; + __u32 rpg_min_dec_fac[8]; + __u32 rpg_min_rate[8]; + __u32 cndd_state_machine[8]; +}; + +struct ieee_qcn_stats { + __u64 rppp_rp_centiseconds[8]; + __u32 rppp_created_rps[8]; +}; + +struct ieee_pfc { + __u8 pfc_cap; + __u8 pfc_en; + __u8 mbc; + __u16 delay; + __u64 requests[8]; + __u64 indications[8]; +}; + +struct dcbnl_buffer { + __u8 prio2buffer[8]; + __u32 buffer_size[8]; + __u32 total_size; +}; + +struct cee_pg { + __u8 willing; + __u8 error; + __u8 pg_en; + __u8 tcs_supported; + __u8 pg_bw[8]; + __u8 prio_pg[8]; +}; + +struct cee_pfc { + __u8 willing; + __u8 error; + __u8 pfc_en; + __u8 tcs_supported; +}; + +struct dcb_app { + __u8 selector; + __u8 priority; + __u16 protocol; +}; + +struct dcb_peer_app_info { + __u8 willing; + __u8 error; +}; + +struct dcbnl_rtnl_ops { + int (*ieee_getets)(struct net_device *, struct ieee_ets *); + int (*ieee_setets)(struct net_device *, struct ieee_ets *); + int (*ieee_getmaxrate)(struct net_device *, struct ieee_maxrate *); + int (*ieee_setmaxrate)(struct net_device *, struct ieee_maxrate *); + int (*ieee_getqcn)(struct net_device *, struct ieee_qcn *); + int (*ieee_setqcn)(struct net_device *, struct ieee_qcn *); + int (*ieee_getqcnstats)(struct net_device *, struct ieee_qcn_stats *); + int (*ieee_getpfc)(struct net_device *, struct ieee_pfc *); + int (*ieee_setpfc)(struct net_device *, struct ieee_pfc *); + int (*ieee_getapp)(struct net_device *, struct dcb_app *); + int (*ieee_setapp)(struct net_device *, struct dcb_app *); + int (*ieee_delapp)(struct net_device *, struct dcb_app *); + int (*ieee_peer_getets)(struct net_device *, struct ieee_ets *); + int (*ieee_peer_getpfc)(struct net_device *, struct ieee_pfc *); + u8 (*getstate)(struct net_device *); + u8 (*setstate)(struct net_device *, u8); + void (*getpermhwaddr)(struct net_device *, u8 *); + void (*setpgtccfgtx)(struct net_device *, int, u8, u8, u8, u8); + void (*setpgbwgcfgtx)(struct net_device *, int, u8); + void (*setpgtccfgrx)(struct net_device *, int, u8, u8, u8, u8); + void (*setpgbwgcfgrx)(struct net_device *, int, u8); + void (*getpgtccfgtx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *); + void (*getpgbwgcfgtx)(struct net_device *, int, u8 *); + void (*getpgtccfgrx)(struct net_device *, int, u8 *, u8 *, u8 *, u8 *); + void (*getpgbwgcfgrx)(struct net_device *, int, u8 *); + void (*setpfccfg)(struct net_device *, int, u8); + void (*getpfccfg)(struct net_device *, int, u8 *); + u8 (*setall)(struct net_device *); + u8 (*getcap)(struct net_device *, int, u8 *); + int (*getnumtcs)(struct net_device *, int, u8 *); + int (*setnumtcs)(struct net_device *, int, u8); + u8 (*getpfcstate)(struct net_device *); + void (*setpfcstate)(struct net_device *, u8); + void (*getbcncfg)(struct net_device *, int, u32 *); + void (*setbcncfg)(struct net_device *, int, u32); + void (*getbcnrp)(struct net_device *, int, u8 *); + void (*setbcnrp)(struct net_device *, int, u8); + int (*setapp)(struct net_device *, u8, u16, u8); + int (*getapp)(struct net_device *, u8, u16); + u8 (*getfeatcfg)(struct net_device *, int, u8 *); + u8 (*setfeatcfg)(struct net_device *, int, u8); + u8 (*getdcbx)(struct net_device *); + u8 (*setdcbx)(struct net_device *, u8); + int (*peer_getappinfo)(struct net_device *, struct dcb_peer_app_info *, u16 *); + int (*peer_getapptable)(struct net_device *, struct dcb_app *); + int (*cee_peer_getpg)(struct net_device *, struct cee_pg *); + int (*cee_peer_getpfc)(struct net_device *, struct cee_pfc *); + int (*dcbnl_getbuffer)(struct net_device *, struct dcbnl_buffer *); + int (*dcbnl_setbuffer)(struct net_device *, struct dcbnl_buffer *); +}; + +struct netprio_map { + struct callback_head rcu; + u32 priomap_len; + u32 priomap[0]; +}; + +struct xdp_mem_info { + u32 type; + u32 id; +}; + +struct xdp_rxq_info { + struct net_device *dev; + u32 queue_index; + u32 reg_state; + struct xdp_mem_info mem; + unsigned int napi_id; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct xdp_frame { + void *data; + u16 len; + u16 headroom; + u32 metasize: 8; + u32 frame_sz: 24; + struct xdp_mem_info mem; + struct net_device *dev_rx; +}; + +struct nlmsghdr { + __u32 nlmsg_len; + __u16 nlmsg_type; + __u16 nlmsg_flags; + __u32 nlmsg_seq; + __u32 nlmsg_pid; +}; + +struct nlattr { + __u16 nla_len; + __u16 nla_type; +}; + +struct netlink_ext_ack { + const char *_msg; + const struct nlattr *bad_attr; + const struct nla_policy *policy; + u8 cookie[20]; + u8 cookie_len; +}; + +struct netlink_range_validation; + +struct netlink_range_validation_signed; + +struct nla_policy { + u8 type; + u8 validation_type; + u16 len; + union { + const u32 bitfield32_valid; + const u32 mask; + const char *reject_message; + const struct nla_policy *nested_policy; + struct netlink_range_validation *range; + struct netlink_range_validation_signed *range_signed; + struct { + s16 min; + s16 max; + }; + int (*validate)(const struct nlattr *, struct netlink_ext_ack *); + u16 strict_start_type; + }; +}; + +struct netlink_callback { + struct sk_buff *skb; + const struct nlmsghdr *nlh; + int (*dump)(struct sk_buff *, struct netlink_callback *); + int (*done)(struct netlink_callback *); + void *data; + struct module *module; + struct netlink_ext_ack *extack; + u16 family; + u16 answer_flags; + u32 min_dump_alloc; + unsigned int prev_seq; + unsigned int seq; + bool strict_check; + union { + u8 ctx[48]; + long int args[6]; + }; +}; + +struct ndmsg { + __u8 ndm_family; + __u8 ndm_pad1; + __u16 ndm_pad2; + __s32 ndm_ifindex; + __u16 ndm_state; + __u8 ndm_flags; + __u8 ndm_type; +}; + +struct rtnl_link_stats64 { + __u64 rx_packets; + __u64 tx_packets; + __u64 rx_bytes; + __u64 tx_bytes; + __u64 rx_errors; + __u64 tx_errors; + __u64 rx_dropped; + __u64 tx_dropped; + __u64 multicast; + __u64 collisions; + __u64 rx_length_errors; + __u64 rx_over_errors; + __u64 rx_crc_errors; + __u64 rx_frame_errors; + __u64 rx_fifo_errors; + __u64 rx_missed_errors; + __u64 tx_aborted_errors; + __u64 tx_carrier_errors; + __u64 tx_fifo_errors; + __u64 tx_heartbeat_errors; + __u64 tx_window_errors; + __u64 rx_compressed; + __u64 tx_compressed; + __u64 rx_nohandler; +}; + +struct ifla_vf_guid { + __u32 vf; + __u64 guid; +}; + +struct ifla_vf_stats { + __u64 rx_packets; + __u64 tx_packets; + __u64 rx_bytes; + __u64 tx_bytes; + __u64 broadcast; + __u64 multicast; + __u64 rx_dropped; + __u64 tx_dropped; +}; + +struct ifla_vf_info { + __u32 vf; + __u8 mac[32]; + __u32 vlan; + __u32 qos; + __u32 spoofchk; + __u32 linkstate; + __u32 min_tx_rate; + __u32 max_tx_rate; + __u32 rss_query_en; + __u32 trusted; + __be16 vlan_proto; +}; + +struct tc_stats { + __u64 bytes; + __u32 packets; + __u32 drops; + __u32 overlimits; + __u32 bps; + __u32 pps; + __u32 qlen; + __u32 backlog; +}; + +struct tc_sizespec { + unsigned char cell_log; + unsigned char size_log; + short int cell_align; + int overhead; + unsigned int linklayer; + unsigned int mpu; + unsigned int mtu; + unsigned int tsize; +}; + +enum netdev_tx { + __NETDEV_TX_MIN = 2147483648, + NETDEV_TX_OK = 0, + NETDEV_TX_BUSY = 16, +}; + +typedef enum netdev_tx netdev_tx_t; + +struct header_ops { + int (*create)(struct sk_buff *, struct net_device *, short unsigned int, const void *, const void *, unsigned int); + int (*parse)(const struct sk_buff *, unsigned char *); + int (*cache)(const struct neighbour *, struct hh_cache *, __be16); + void (*cache_update)(struct hh_cache *, const struct net_device *, const unsigned char *); + bool (*validate)(const char *, unsigned int); + __be16 (*parse_protocol)(const struct sk_buff *); +}; + +struct xsk_buff_pool; + +struct netdev_queue { + struct net_device *dev; + struct Qdisc *qdisc; + struct Qdisc *qdisc_sleeping; + struct kobject kobj; + int numa_node; + long unsigned int tx_maxrate; + long unsigned int trans_timeout; + struct net_device *sb_dev; + struct xsk_buff_pool *pool; + spinlock_t _xmit_lock; + int xmit_lock_owner; + long unsigned int trans_start; + long unsigned int state; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct dql dql; +}; + +struct qdisc_skb_head { + struct sk_buff *head; + struct sk_buff *tail; + __u32 qlen; + spinlock_t lock; +}; + +struct gnet_stats_basic_packed { + __u64 bytes; + __u64 packets; +}; + +struct gnet_stats_queue { + __u32 qlen; + __u32 backlog; + __u32 drops; + __u32 requeues; + __u32 overlimits; +}; + +struct Qdisc_ops; + +struct qdisc_size_table; + +struct net_rate_estimator; + +struct gnet_stats_basic_cpu; + +struct Qdisc { + int (*enqueue)(struct sk_buff *, struct Qdisc *, struct sk_buff **); + struct sk_buff * (*dequeue)(struct Qdisc *); + unsigned int flags; + u32 limit; + const struct Qdisc_ops *ops; + struct qdisc_size_table *stab; + struct hlist_node hash; + u32 handle; + u32 parent; + struct netdev_queue *dev_queue; + struct net_rate_estimator *rate_est; + struct gnet_stats_basic_cpu *cpu_bstats; + struct gnet_stats_queue *cpu_qstats; + int pad; + refcount_t refcnt; + long: 64; + long: 64; + long: 64; + struct sk_buff_head gso_skb; + struct qdisc_skb_head q; + struct gnet_stats_basic_packed bstats; + seqcount_t running; + struct gnet_stats_queue qstats; + long unsigned int state; + struct Qdisc *next_sched; + struct sk_buff_head skb_bad_txq; + spinlock_t busylock; + spinlock_t seqlock; + bool empty; + struct callback_head rcu; + long: 64; + long: 64; + long: 64; + long: 64; + long int privdata[0]; +}; + +struct rps_map { + unsigned int len; + struct callback_head rcu; + u16 cpus[0]; +}; + +struct rps_dev_flow { + u16 cpu; + u16 filter; + unsigned int last_qtail; +}; + +struct rps_dev_flow_table { + unsigned int mask; + struct callback_head rcu; + struct rps_dev_flow flows[0]; +}; + +struct netdev_rx_queue { + struct rps_map *rps_map; + struct rps_dev_flow_table *rps_flow_table; + struct kobject kobj; + struct net_device *dev; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct xdp_rxq_info xdp_rxq; + struct xsk_buff_pool *pool; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct xps_map { + unsigned int len; + unsigned int alloc_len; + struct callback_head rcu; + u16 queues[0]; +}; + +struct xps_dev_maps { + struct callback_head rcu; + struct xps_map *attr_map[0]; +}; + +struct netdev_fcoe_hbainfo { + char manufacturer[64]; + char serial_number[64]; + char hardware_version[64]; + char driver_version[64]; + char optionrom_version[64]; + char firmware_version[64]; + char model[256]; + char model_description[256]; +}; + +struct netdev_phys_item_id { + unsigned char id[32]; + unsigned char id_len; +}; + +enum tc_setup_type { + TC_SETUP_QDISC_MQPRIO = 0, + TC_SETUP_CLSU32 = 1, + TC_SETUP_CLSFLOWER = 2, + TC_SETUP_CLSMATCHALL = 3, + TC_SETUP_CLSBPF = 4, + TC_SETUP_BLOCK = 5, + TC_SETUP_QDISC_CBS = 6, + TC_SETUP_QDISC_RED = 7, + TC_SETUP_QDISC_PRIO = 8, + TC_SETUP_QDISC_MQ = 9, + TC_SETUP_QDISC_ETF = 10, + TC_SETUP_ROOT_QDISC = 11, + TC_SETUP_QDISC_GRED = 12, + TC_SETUP_QDISC_TAPRIO = 13, + TC_SETUP_FT = 14, + TC_SETUP_QDISC_ETS = 15, + TC_SETUP_QDISC_TBF = 16, + TC_SETUP_QDISC_FIFO = 17, +}; + +enum bpf_netdev_command { + XDP_SETUP_PROG = 0, + XDP_SETUP_PROG_HW = 1, + BPF_OFFLOAD_MAP_ALLOC = 2, + BPF_OFFLOAD_MAP_FREE = 3, + XDP_SETUP_XSK_POOL = 4, +}; + +struct netdev_bpf { + enum bpf_netdev_command command; + union { + struct { + u32 flags; + struct bpf_prog *prog; + struct netlink_ext_ack *extack; + }; + struct { + struct bpf_offloaded_map *offmap; + }; + struct { + struct xsk_buff_pool *pool; + u16 queue_id; + } xsk; + }; +}; + +struct xfrmdev_ops { + int (*xdo_dev_state_add)(struct xfrm_state *); + void (*xdo_dev_state_delete)(struct xfrm_state *); + void (*xdo_dev_state_free)(struct xfrm_state *); + bool (*xdo_dev_offload_ok)(struct sk_buff *, struct xfrm_state *); + void (*xdo_dev_state_advance_esn)(struct xfrm_state *); +}; + +struct dev_ifalias { + struct callback_head rcuhead; + char ifalias[0]; +}; + +struct netdev_name_node { + struct hlist_node hlist; + struct list_head list; + struct net_device *dev; + const char *name; +}; + +struct udp_tunnel_info; + +struct devlink_port; + +struct ip_tunnel_parm; + +struct net_device_ops { + int (*ndo_init)(struct net_device *); + void (*ndo_uninit)(struct net_device *); + int (*ndo_open)(struct net_device *); + int (*ndo_stop)(struct net_device *); + netdev_tx_t (*ndo_start_xmit)(struct sk_buff *, struct net_device *); + netdev_features_t (*ndo_features_check)(struct sk_buff *, struct net_device *, netdev_features_t); + u16 (*ndo_select_queue)(struct net_device *, struct sk_buff *, struct net_device *); + void (*ndo_change_rx_flags)(struct net_device *, int); + void (*ndo_set_rx_mode)(struct net_device *); + int (*ndo_set_mac_address)(struct net_device *, void *); + int (*ndo_validate_addr)(struct net_device *); + int (*ndo_do_ioctl)(struct net_device *, struct ifreq *, int); + int (*ndo_set_config)(struct net_device *, struct ifmap *); + int (*ndo_change_mtu)(struct net_device *, int); + int (*ndo_neigh_setup)(struct net_device *, struct neigh_parms *); + void (*ndo_tx_timeout)(struct net_device *, unsigned int); + void (*ndo_get_stats64)(struct net_device *, struct rtnl_link_stats64 *); + bool (*ndo_has_offload_stats)(const struct net_device *, int); + int (*ndo_get_offload_stats)(int, const struct net_device *, void *); + struct net_device_stats * (*ndo_get_stats)(struct net_device *); + int (*ndo_vlan_rx_add_vid)(struct net_device *, __be16, u16); + int (*ndo_vlan_rx_kill_vid)(struct net_device *, __be16, u16); + void (*ndo_poll_controller)(struct net_device *); + int (*ndo_netpoll_setup)(struct net_device *, struct netpoll_info *); + void (*ndo_netpoll_cleanup)(struct net_device *); + int (*ndo_set_vf_mac)(struct net_device *, int, u8 *); + int (*ndo_set_vf_vlan)(struct net_device *, int, u16, u8, __be16); + int (*ndo_set_vf_rate)(struct net_device *, int, int, int); + int (*ndo_set_vf_spoofchk)(struct net_device *, int, bool); + int (*ndo_set_vf_trust)(struct net_device *, int, bool); + int (*ndo_get_vf_config)(struct net_device *, int, struct ifla_vf_info *); + int (*ndo_set_vf_link_state)(struct net_device *, int, int); + int (*ndo_get_vf_stats)(struct net_device *, int, struct ifla_vf_stats *); + int (*ndo_set_vf_port)(struct net_device *, int, struct nlattr **); + int (*ndo_get_vf_port)(struct net_device *, int, struct sk_buff *); + int (*ndo_get_vf_guid)(struct net_device *, int, struct ifla_vf_guid *, struct ifla_vf_guid *); + int (*ndo_set_vf_guid)(struct net_device *, int, u64, int); + int (*ndo_set_vf_rss_query_en)(struct net_device *, int, bool); + int (*ndo_setup_tc)(struct net_device *, enum tc_setup_type, void *); + int (*ndo_fcoe_enable)(struct net_device *); + int (*ndo_fcoe_disable)(struct net_device *); + int (*ndo_fcoe_ddp_setup)(struct net_device *, u16, struct scatterlist *, unsigned int); + int (*ndo_fcoe_ddp_done)(struct net_device *, u16); + int (*ndo_fcoe_ddp_target)(struct net_device *, u16, struct scatterlist *, unsigned int); + int (*ndo_fcoe_get_hbainfo)(struct net_device *, struct netdev_fcoe_hbainfo *); + int (*ndo_fcoe_get_wwn)(struct net_device *, u64 *, int); + int (*ndo_rx_flow_steer)(struct net_device *, const struct sk_buff *, u16, u32); + int (*ndo_add_slave)(struct net_device *, struct net_device *, struct netlink_ext_ack *); + int (*ndo_del_slave)(struct net_device *, struct net_device *); + struct net_device * (*ndo_get_xmit_slave)(struct net_device *, struct sk_buff *, bool); + netdev_features_t (*ndo_fix_features)(struct net_device *, netdev_features_t); + int (*ndo_set_features)(struct net_device *, netdev_features_t); + int (*ndo_neigh_construct)(struct net_device *, struct neighbour *); + void (*ndo_neigh_destroy)(struct net_device *, struct neighbour *); + int (*ndo_fdb_add)(struct ndmsg *, struct nlattr **, struct net_device *, const unsigned char *, u16, u16, struct netlink_ext_ack *); + int (*ndo_fdb_del)(struct ndmsg *, struct nlattr **, struct net_device *, const unsigned char *, u16); + int (*ndo_fdb_dump)(struct sk_buff *, struct netlink_callback *, struct net_device *, struct net_device *, int *); + int (*ndo_fdb_get)(struct sk_buff *, struct nlattr **, struct net_device *, const unsigned char *, u16, u32, u32, struct netlink_ext_ack *); + int (*ndo_bridge_setlink)(struct net_device *, struct nlmsghdr *, u16, struct netlink_ext_ack *); + int (*ndo_bridge_getlink)(struct sk_buff *, u32, u32, struct net_device *, u32, int); + int (*ndo_bridge_dellink)(struct net_device *, struct nlmsghdr *, u16); + int (*ndo_change_carrier)(struct net_device *, bool); + int (*ndo_get_phys_port_id)(struct net_device *, struct netdev_phys_item_id *); + int (*ndo_get_port_parent_id)(struct net_device *, struct netdev_phys_item_id *); + int (*ndo_get_phys_port_name)(struct net_device *, char *, size_t); + void (*ndo_udp_tunnel_add)(struct net_device *, struct udp_tunnel_info *); + void (*ndo_udp_tunnel_del)(struct net_device *, struct udp_tunnel_info *); + void * (*ndo_dfwd_add_station)(struct net_device *, struct net_device *); + void (*ndo_dfwd_del_station)(struct net_device *, void *); + int (*ndo_set_tx_maxrate)(struct net_device *, int, u32); + int (*ndo_get_iflink)(const struct net_device *); + int (*ndo_change_proto_down)(struct net_device *, bool); + int (*ndo_fill_metadata_dst)(struct net_device *, struct sk_buff *); + void (*ndo_set_rx_headroom)(struct net_device *, int); + int (*ndo_bpf)(struct net_device *, struct netdev_bpf *); + int (*ndo_xdp_xmit)(struct net_device *, int, struct xdp_frame **, u32); + int (*ndo_xsk_wakeup)(struct net_device *, u32, u32); + struct devlink_port * (*ndo_get_devlink_port)(struct net_device *); + int (*ndo_tunnel_ctl)(struct net_device *, struct ip_tunnel_parm *, int); + struct net_device * (*ndo_get_peer_dev)(struct net_device *); +}; + +struct neigh_parms { + possible_net_t net; + struct net_device *dev; + struct list_head list; + int (*neigh_setup)(struct neighbour *); + struct neigh_table *tbl; + void *sysctl_table; + int dead; + refcount_t refcnt; + struct callback_head callback_head; + int reachable_time; + int data[13]; + long unsigned int data_state[1]; +}; + +struct pcpu_lstats { + u64_stats_t packets; + u64_stats_t bytes; + struct u64_stats_sync syncp; +}; + +struct pcpu_sw_netstats { + u64 rx_packets; + u64 rx_bytes; + u64 tx_packets; + u64 tx_bytes; + struct u64_stats_sync syncp; +}; + +struct iw_request_info; + +union iwreq_data; + +typedef int (*iw_handler)(struct net_device *, struct iw_request_info *, union iwreq_data *, char *); + +struct iw_priv_args; + +struct iw_statistics; + +struct iw_handler_def { + const iw_handler *standard; + __u16 num_standard; + __u16 num_private; + __u16 num_private_args; + const iw_handler *private; + const struct iw_priv_args *private_args; + struct iw_statistics * (*get_wireless_stats)(struct net_device *); +}; + +enum ethtool_phys_id_state { + ETHTOOL_ID_INACTIVE = 0, + ETHTOOL_ID_ACTIVE = 1, + ETHTOOL_ID_ON = 2, + ETHTOOL_ID_OFF = 3, +}; + +struct ethtool_drvinfo; + +struct ethtool_regs; + +struct ethtool_wolinfo; + +struct ethtool_link_ext_state_info; + +struct ethtool_eeprom; + +struct ethtool_coalesce; + +struct ethtool_ringparam; + +struct ethtool_pause_stats; + +struct ethtool_pauseparam; + +struct ethtool_test; + +struct ethtool_stats; + +struct ethtool_rxnfc; + +struct ethtool_flash; + +struct ethtool_channels; + +struct ethtool_dump; + +struct ethtool_ts_info; + +struct ethtool_modinfo; + +struct ethtool_eee; + +struct ethtool_tunable; + +struct ethtool_link_ksettings; + +struct ethtool_fecparam; + +struct ethtool_ops { + u32 supported_coalesce_params; + void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *); + int (*get_regs_len)(struct net_device *); + void (*get_regs)(struct net_device *, struct ethtool_regs *, void *); + void (*get_wol)(struct net_device *, struct ethtool_wolinfo *); + int (*set_wol)(struct net_device *, struct ethtool_wolinfo *); + u32 (*get_msglevel)(struct net_device *); + void (*set_msglevel)(struct net_device *, u32); + int (*nway_reset)(struct net_device *); + u32 (*get_link)(struct net_device *); + int (*get_link_ext_state)(struct net_device *, struct ethtool_link_ext_state_info *); + int (*get_eeprom_len)(struct net_device *); + int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); + int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); + int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *); + int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *); + void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *); + int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *); + void (*get_pause_stats)(struct net_device *, struct ethtool_pause_stats *); + void (*get_pauseparam)(struct net_device *, struct ethtool_pauseparam *); + int (*set_pauseparam)(struct net_device *, struct ethtool_pauseparam *); + void (*self_test)(struct net_device *, struct ethtool_test *, u64 *); + void (*get_strings)(struct net_device *, u32, u8 *); + int (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state); + void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *); + int (*begin)(struct net_device *); + void (*complete)(struct net_device *); + u32 (*get_priv_flags)(struct net_device *); + int (*set_priv_flags)(struct net_device *, u32); + int (*get_sset_count)(struct net_device *, int); + int (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, u32 *); + int (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *); + int (*flash_device)(struct net_device *, struct ethtool_flash *); + int (*reset)(struct net_device *, u32 *); + u32 (*get_rxfh_key_size)(struct net_device *); + u32 (*get_rxfh_indir_size)(struct net_device *); + int (*get_rxfh)(struct net_device *, u32 *, u8 *, u8 *); + int (*set_rxfh)(struct net_device *, const u32 *, const u8 *, const u8); + int (*get_rxfh_context)(struct net_device *, u32 *, u8 *, u8 *, u32); + int (*set_rxfh_context)(struct net_device *, const u32 *, const u8 *, const u8, u32 *, bool); + void (*get_channels)(struct net_device *, struct ethtool_channels *); + int (*set_channels)(struct net_device *, struct ethtool_channels *); + int (*get_dump_flag)(struct net_device *, struct ethtool_dump *); + int (*get_dump_data)(struct net_device *, struct ethtool_dump *, void *); + int (*set_dump)(struct net_device *, struct ethtool_dump *); + int (*get_ts_info)(struct net_device *, struct ethtool_ts_info *); + int (*get_module_info)(struct net_device *, struct ethtool_modinfo *); + int (*get_module_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *); + int (*get_eee)(struct net_device *, struct ethtool_eee *); + int (*set_eee)(struct net_device *, struct ethtool_eee *); + int (*get_tunable)(struct net_device *, const struct ethtool_tunable *, void *); + int (*set_tunable)(struct net_device *, const struct ethtool_tunable *, const void *); + int (*get_per_queue_coalesce)(struct net_device *, u32, struct ethtool_coalesce *); + int (*set_per_queue_coalesce)(struct net_device *, u32, struct ethtool_coalesce *); + int (*get_link_ksettings)(struct net_device *, struct ethtool_link_ksettings *); + int (*set_link_ksettings)(struct net_device *, const struct ethtool_link_ksettings *); + int (*get_fecparam)(struct net_device *, struct ethtool_fecparam *); + int (*set_fecparam)(struct net_device *, struct ethtool_fecparam *); + void (*get_ethtool_phy_stats)(struct net_device *, struct ethtool_stats *, u64 *); + int (*get_phy_tunable)(struct net_device *, const struct ethtool_tunable *, void *); + int (*set_phy_tunable)(struct net_device *, const struct ethtool_tunable *, const void *); +}; + +struct l3mdev_ops { + u32 (*l3mdev_fib_table)(const struct net_device *); + struct sk_buff * (*l3mdev_l3_rcv)(struct net_device *, struct sk_buff *, u16); + struct sk_buff * (*l3mdev_l3_out)(struct net_device *, struct sock *, struct sk_buff *, u16); + struct dst_entry * (*l3mdev_link_scope_lookup)(const struct net_device *, struct flowi6 *); +}; + +struct nd_opt_hdr; + +struct ndisc_options; + +struct prefix_info; + +struct ndisc_ops { + int (*is_useropt)(u8); + int (*parse_options)(const struct net_device *, struct nd_opt_hdr *, struct ndisc_options *); + void (*update)(const struct net_device *, struct neighbour *, u32, u8, const struct ndisc_options *); + int (*opt_addr_space)(const struct net_device *, u8, struct neighbour *, u8 *, u8 **); + void (*fill_addr_option)(const struct net_device *, struct sk_buff *, u8, const u8 *); + void (*prefix_rcv_add_addr)(struct net *, struct net_device *, const struct prefix_info *, struct inet6_dev *, struct in6_addr *, int, u32, bool, bool, __u32, u32, bool); +}; + +enum tls_offload_ctx_dir { + TLS_OFFLOAD_CTX_DIR_RX = 0, + TLS_OFFLOAD_CTX_DIR_TX = 1, +}; + +struct tls_crypto_info; + +struct tls_context; + +struct tlsdev_ops { + int (*tls_dev_add)(struct net_device *, struct sock *, enum tls_offload_ctx_dir, struct tls_crypto_info *, u32); + void (*tls_dev_del)(struct net_device *, struct tls_context *, enum tls_offload_ctx_dir); + int (*tls_dev_resync)(struct net_device *, struct sock *, u32, u8 *, enum tls_offload_ctx_dir); +}; + +struct ipv6_devstat { + struct proc_dir_entry *proc_dir_entry; + struct ipstats_mib *ipv6; + struct icmpv6_mib_device *icmpv6dev; + struct icmpv6msg_mib_device *icmpv6msgdev; +}; + +struct ifmcaddr6; + +struct ifacaddr6; + +struct inet6_dev { + struct net_device *dev; + struct list_head addr_list; + struct ifmcaddr6 *mc_list; + struct ifmcaddr6 *mc_tomb; + spinlock_t mc_lock; + unsigned char mc_qrv; + unsigned char mc_gq_running; + unsigned char mc_ifc_count; + unsigned char mc_dad_count; + long unsigned int mc_v1_seen; + long unsigned int mc_qi; + long unsigned int mc_qri; + long unsigned int mc_maxdelay; + struct timer_list mc_gq_timer; + struct timer_list mc_ifc_timer; + struct timer_list mc_dad_timer; + struct ifacaddr6 *ac_list; + rwlock_t lock; + refcount_t refcnt; + __u32 if_flags; + int dead; + u32 desync_factor; + struct list_head tempaddr_list; + struct in6_addr token; + struct neigh_parms *nd_parms; + struct ipv6_devconf cnf; + struct ipv6_devstat stats; + struct timer_list rs_timer; + __s32 rs_interval; + __u8 rs_probes; + long unsigned int tstamp; + struct callback_head rcu; +}; + +struct tcf_proto; + +struct tcf_block; + +struct mini_Qdisc { + struct tcf_proto *filter_list; + struct tcf_block *block; + struct gnet_stats_basic_cpu *cpu_bstats; + struct gnet_stats_queue *cpu_qstats; + struct callback_head rcu; +}; + +struct rtnl_link_ops { + struct list_head list; + const char *kind; + size_t priv_size; + void (*setup)(struct net_device *); + bool netns_refund; + unsigned int maxtype; + const struct nla_policy *policy; + int (*validate)(struct nlattr **, struct nlattr **, struct netlink_ext_ack *); + int (*newlink)(struct net *, struct net_device *, struct nlattr **, struct nlattr **, struct netlink_ext_ack *); + int (*changelink)(struct net_device *, struct nlattr **, struct nlattr **, struct netlink_ext_ack *); + void (*dellink)(struct net_device *, struct list_head *); + size_t (*get_size)(const struct net_device *); + int (*fill_info)(struct sk_buff *, const struct net_device *); + size_t (*get_xstats_size)(const struct net_device *); + int (*fill_xstats)(struct sk_buff *, const struct net_device *); + unsigned int (*get_num_tx_queues)(); + unsigned int (*get_num_rx_queues)(); + unsigned int slave_maxtype; + const struct nla_policy *slave_policy; + int (*slave_changelink)(struct net_device *, struct net_device *, struct nlattr **, struct nlattr **, struct netlink_ext_ack *); + size_t (*get_slave_size)(const struct net_device *, const struct net_device *); + int (*fill_slave_info)(struct sk_buff *, const struct net_device *, const struct net_device *); + struct net * (*get_link_net)(const struct net_device *); + size_t (*get_linkxstats_size)(const struct net_device *, int); + int (*fill_linkxstats)(struct sk_buff *, const struct net_device *, int *, int); +}; + +struct udp_tunnel_nic_table_info { + unsigned int n_entries; + unsigned int tunnel_types; +}; + +struct udp_tunnel_nic_shared; + +struct udp_tunnel_nic_info { + int (*set_port)(struct net_device *, unsigned int, unsigned int, struct udp_tunnel_info *); + int (*unset_port)(struct net_device *, unsigned int, unsigned int, struct udp_tunnel_info *); + int (*sync_table)(struct net_device *, unsigned int); + struct udp_tunnel_nic_shared *shared; + unsigned int flags; + struct udp_tunnel_nic_table_info tables[4]; +}; + +enum { + RTAX_UNSPEC = 0, + RTAX_LOCK = 1, + RTAX_MTU = 2, + RTAX_WINDOW = 3, + RTAX_RTT = 4, + RTAX_RTTVAR = 5, + RTAX_SSTHRESH = 6, + RTAX_CWND = 7, + RTAX_ADVMSS = 8, + RTAX_REORDERING = 9, + RTAX_HOPLIMIT = 10, + RTAX_INITCWND = 11, + RTAX_FEATURES = 12, + RTAX_RTO_MIN = 13, + RTAX_INITRWND = 14, + RTAX_QUICKACK = 15, + RTAX_CC_ALGO = 16, + RTAX_FASTOPEN_NO_COOKIE = 17, + __RTAX_MAX = 18, +}; + +struct tcmsg { + unsigned char tcm_family; + unsigned char tcm__pad1; + short unsigned int tcm__pad2; + int tcm_ifindex; + __u32 tcm_handle; + __u32 tcm_parent; + __u32 tcm_info; +}; + +struct gnet_stats_basic_cpu { + struct gnet_stats_basic_packed bstats; + struct u64_stats_sync syncp; +}; + +struct gnet_dump { + spinlock_t *lock; + struct sk_buff *skb; + struct nlattr *tail; + int compat_tc_stats; + int compat_xstats; + int padattr; + void *xstats; + int xstats_len; + struct tc_stats tc_stats; +}; + +struct netlink_range_validation { + u64 min; + u64 max; +}; + +struct netlink_range_validation_signed { + s64 min; + s64 max; +}; + +enum flow_action_hw_stats_bit { + FLOW_ACTION_HW_STATS_IMMEDIATE_BIT = 0, + FLOW_ACTION_HW_STATS_DELAYED_BIT = 1, + FLOW_ACTION_HW_STATS_DISABLED_BIT = 2, + FLOW_ACTION_HW_STATS_NUM_BITS = 3, +}; + +struct flow_block { + struct list_head cb_list; +}; + +typedef int flow_setup_cb_t(enum tc_setup_type, void *, void *); + +struct qdisc_size_table { + struct callback_head rcu; + struct list_head list; + struct tc_sizespec szopts; + int refcnt; + u16 data[0]; +}; + +struct Qdisc_class_ops; + +struct Qdisc_ops { + struct Qdisc_ops *next; + const struct Qdisc_class_ops *cl_ops; + char id[16]; + int priv_size; + unsigned int static_flags; + int (*enqueue)(struct sk_buff *, struct Qdisc *, struct sk_buff **); + struct sk_buff * (*dequeue)(struct Qdisc *); + struct sk_buff * (*peek)(struct Qdisc *); + int (*init)(struct Qdisc *, struct nlattr *, struct netlink_ext_ack *); + void (*reset)(struct Qdisc *); + void (*destroy)(struct Qdisc *); + int (*change)(struct Qdisc *, struct nlattr *, struct netlink_ext_ack *); + void (*attach)(struct Qdisc *); + int (*change_tx_queue_len)(struct Qdisc *, unsigned int); + int (*dump)(struct Qdisc *, struct sk_buff *); + int (*dump_stats)(struct Qdisc *, struct gnet_dump *); + void (*ingress_block_set)(struct Qdisc *, u32); + void (*egress_block_set)(struct Qdisc *, u32); + u32 (*ingress_block_get)(struct Qdisc *); + u32 (*egress_block_get)(struct Qdisc *); + struct module *owner; +}; + +struct qdisc_walker; + +struct Qdisc_class_ops { + unsigned int flags; + struct netdev_queue * (*select_queue)(struct Qdisc *, struct tcmsg *); + int (*graft)(struct Qdisc *, long unsigned int, struct Qdisc *, struct Qdisc **, struct netlink_ext_ack *); + struct Qdisc * (*leaf)(struct Qdisc *, long unsigned int); + void (*qlen_notify)(struct Qdisc *, long unsigned int); + long unsigned int (*find)(struct Qdisc *, u32); + int (*change)(struct Qdisc *, u32, u32, struct nlattr **, long unsigned int *, struct netlink_ext_ack *); + int (*delete)(struct Qdisc *, long unsigned int); + void (*walk)(struct Qdisc *, struct qdisc_walker *); + struct tcf_block * (*tcf_block)(struct Qdisc *, long unsigned int, struct netlink_ext_ack *); + long unsigned int (*bind_tcf)(struct Qdisc *, long unsigned int, u32); + void (*unbind_tcf)(struct Qdisc *, long unsigned int); + int (*dump)(struct Qdisc *, long unsigned int, struct sk_buff *, struct tcmsg *); + int (*dump_stats)(struct Qdisc *, long unsigned int, struct gnet_dump *); +}; + +struct tcf_chain; + +struct tcf_block { + struct mutex lock; + struct list_head chain_list; + u32 index; + u32 classid; + refcount_t refcnt; + struct net *net; + struct Qdisc *q; + struct rw_semaphore cb_lock; + struct flow_block flow_block; + struct list_head owner_list; + bool keep_dst; + atomic_t offloadcnt; + unsigned int nooffloaddevcnt; + unsigned int lockeddevcnt; + struct { + struct tcf_chain *chain; + struct list_head filter_chain_list; + } chain0; + struct callback_head rcu; + struct hlist_head proto_destroy_ht[128]; + struct mutex proto_destroy_lock; +}; + +struct tcf_result; + +struct tcf_proto_ops; + +struct tcf_proto { + struct tcf_proto *next; + void *root; + int (*classify)(struct sk_buff *, const struct tcf_proto *, struct tcf_result *); + __be16 protocol; + u32 prio; + void *data; + const struct tcf_proto_ops *ops; + struct tcf_chain *chain; + spinlock_t lock; + bool deleting; + refcount_t refcnt; + struct callback_head rcu; + struct hlist_node destroy_ht_node; +}; + +struct tcf_result { + union { + struct { + long unsigned int class; + u32 classid; + }; + const struct tcf_proto *goto_tp; + struct { + bool ingress; + struct gnet_stats_queue *qstats; + }; + }; +}; + +struct tcf_walker; + +struct tcf_proto_ops { + struct list_head head; + char kind[16]; + int (*classify)(struct sk_buff *, const struct tcf_proto *, struct tcf_result *); + int (*init)(struct tcf_proto *); + void (*destroy)(struct tcf_proto *, bool, struct netlink_ext_ack *); + void * (*get)(struct tcf_proto *, u32); + void (*put)(struct tcf_proto *, void *); + int (*change)(struct net *, struct sk_buff *, struct tcf_proto *, long unsigned int, u32, struct nlattr **, void **, bool, bool, struct netlink_ext_ack *); + int (*delete)(struct tcf_proto *, void *, bool *, bool, struct netlink_ext_ack *); + bool (*delete_empty)(struct tcf_proto *); + void (*walk)(struct tcf_proto *, struct tcf_walker *, bool); + int (*reoffload)(struct tcf_proto *, bool, flow_setup_cb_t *, void *, struct netlink_ext_ack *); + void (*hw_add)(struct tcf_proto *, void *); + void (*hw_del)(struct tcf_proto *, void *); + void (*bind_class)(void *, u32, long unsigned int, void *, long unsigned int); + void * (*tmplt_create)(struct net *, struct tcf_chain *, struct nlattr **, struct netlink_ext_ack *); + void (*tmplt_destroy)(void *); + int (*dump)(struct net *, struct tcf_proto *, void *, struct sk_buff *, struct tcmsg *, bool); + int (*terse_dump)(struct net *, struct tcf_proto *, void *, struct sk_buff *, struct tcmsg *, bool); + int (*tmplt_dump)(struct sk_buff *, struct net *, void *); + struct module *owner; + int flags; +}; + +struct tcf_chain { + struct mutex filter_chain_lock; + struct tcf_proto *filter_chain; + struct list_head list; + struct tcf_block *block; + u32 index; + unsigned int refcnt; + unsigned int action_refcnt; + bool explicitly_created; + bool flushing; + const struct tcf_proto_ops *tmplt_ops; + void *tmplt_priv; + struct callback_head rcu; +}; + +struct sock_fprog_kern { + u16 len; + struct sock_filter *filter; +}; + +struct sk_filter { + refcount_t refcnt; + struct callback_head rcu; + struct bpf_prog *prog; +}; + +enum { + NEIGH_VAR_MCAST_PROBES = 0, + NEIGH_VAR_UCAST_PROBES = 1, + NEIGH_VAR_APP_PROBES = 2, + NEIGH_VAR_MCAST_REPROBES = 3, + NEIGH_VAR_RETRANS_TIME = 4, + NEIGH_VAR_BASE_REACHABLE_TIME = 5, + NEIGH_VAR_DELAY_PROBE_TIME = 6, + NEIGH_VAR_GC_STALETIME = 7, + NEIGH_VAR_QUEUE_LEN_BYTES = 8, + NEIGH_VAR_PROXY_QLEN = 9, + NEIGH_VAR_ANYCAST_DELAY = 10, + NEIGH_VAR_PROXY_DELAY = 11, + NEIGH_VAR_LOCKTIME = 12, + NEIGH_VAR_QUEUE_LEN = 13, + NEIGH_VAR_RETRANS_TIME_MS = 14, + NEIGH_VAR_BASE_REACHABLE_TIME_MS = 15, + NEIGH_VAR_GC_INTERVAL = 16, + NEIGH_VAR_GC_THRESH1 = 17, + NEIGH_VAR_GC_THRESH2 = 18, + NEIGH_VAR_GC_THRESH3 = 19, + NEIGH_VAR_MAX = 20, +}; + +struct pneigh_entry; + +struct neigh_statistics; + +struct neigh_hash_table; + +struct neigh_table { + int family; + unsigned int entry_size; + unsigned int key_len; + __be16 protocol; + __u32 (*hash)(const void *, const struct net_device *, __u32 *); + bool (*key_eq)(const struct neighbour *, const void *); + int (*constructor)(struct neighbour *); + int (*pconstructor)(struct pneigh_entry *); + void (*pdestructor)(struct pneigh_entry *); + void (*proxy_redo)(struct sk_buff *); + int (*is_multicast)(const void *); + bool (*allow_add)(const struct net_device *, struct netlink_ext_ack *); + char *id; + struct neigh_parms parms; + struct list_head parms_list; + int gc_interval; + int gc_thresh1; + int gc_thresh2; + int gc_thresh3; + long unsigned int last_flush; + struct delayed_work gc_work; + struct timer_list proxy_timer; + struct sk_buff_head proxy_queue; + atomic_t entries; + atomic_t gc_entries; + struct list_head gc_list; + rwlock_t lock; + long unsigned int last_rand; + struct neigh_statistics *stats; + struct neigh_hash_table *nht; + struct pneigh_entry **phash_buckets; +}; + +struct neigh_statistics { + long unsigned int allocs; + long unsigned int destroys; + long unsigned int hash_grows; + long unsigned int res_failed; + long unsigned int lookups; + long unsigned int hits; + long unsigned int rcv_probes_mcast; + long unsigned int rcv_probes_ucast; + long unsigned int periodic_gc_runs; + long unsigned int forced_gc_runs; + long unsigned int unres_discards; + long unsigned int table_fulls; +}; + +struct neigh_ops { + int family; + void (*solicit)(struct neighbour *, struct sk_buff *); + void (*error_report)(struct neighbour *, struct sk_buff *); + int (*output)(struct neighbour *, struct sk_buff *); + int (*connected_output)(struct neighbour *, struct sk_buff *); +}; + +struct pneigh_entry { + struct pneigh_entry *next; + possible_net_t net; + struct net_device *dev; + u8 flags; + u8 protocol; + u8 key[0]; +}; + +struct neigh_hash_table { + struct neighbour **hash_buckets; + unsigned int hash_shift; + __u32 hash_rnd[4]; + struct callback_head rcu; +}; + +enum { + TCP_ESTABLISHED = 1, + TCP_SYN_SENT = 2, + TCP_SYN_RECV = 3, + TCP_FIN_WAIT1 = 4, + TCP_FIN_WAIT2 = 5, + TCP_TIME_WAIT = 6, + TCP_CLOSE = 7, + TCP_CLOSE_WAIT = 8, + TCP_LAST_ACK = 9, + TCP_LISTEN = 10, + TCP_CLOSING = 11, + TCP_NEW_SYN_RECV = 12, + TCP_MAX_STATES = 13, +}; + +struct fib_rule_hdr { + __u8 family; + __u8 dst_len; + __u8 src_len; + __u8 tos; + __u8 table; + __u8 res1; + __u8 res2; + __u8 action; + __u32 flags; +}; + +struct fib_rule_port_range { + __u16 start; + __u16 end; +}; + +struct fib_kuid_range { + kuid_t start; + kuid_t end; +}; + +struct fib_rule { + struct list_head list; + int iifindex; + int oifindex; + u32 mark; + u32 mark_mask; + u32 flags; + u32 table; + u8 action; + u8 l3mdev; + u8 proto; + u8 ip_proto; + u32 target; + __be64 tun_id; + struct fib_rule *ctarget; + struct net *fr_net; + refcount_t refcnt; + u32 pref; + int suppress_ifgroup; + int suppress_prefixlen; + char iifname[16]; + char oifname[16]; + struct fib_kuid_range uid_range; + struct fib_rule_port_range sport_range; + struct fib_rule_port_range dport_range; + struct callback_head rcu; +}; + +struct fib_lookup_arg { + void *lookup_ptr; + const void *lookup_data; + void *result; + struct fib_rule *rule; + u32 table; + int flags; +}; + +struct smc_hashinfo; + +struct request_sock_ops; + +struct timewait_sock_ops; + +struct udp_table; + +struct raw_hashinfo; + +struct proto { + void (*close)(struct sock *, long int); + int (*pre_connect)(struct sock *, struct sockaddr *, int); + int (*connect)(struct sock *, struct sockaddr *, int); + int (*disconnect)(struct sock *, int); + struct sock * (*accept)(struct sock *, int, int *, bool); + int (*ioctl)(struct sock *, int, long unsigned int); + int (*init)(struct sock *); + void (*destroy)(struct sock *); + void (*shutdown)(struct sock *, int); + int (*setsockopt)(struct sock *, int, int, sockptr_t, unsigned int); + int (*getsockopt)(struct sock *, int, int, char *, int *); + void (*keepalive)(struct sock *, int); + int (*compat_ioctl)(struct sock *, unsigned int, long unsigned int); + int (*sendmsg)(struct sock *, struct msghdr *, size_t); + int (*recvmsg)(struct sock *, struct msghdr *, size_t, int, int, int *); + int (*sendpage)(struct sock *, struct page *, int, size_t, int); + int (*bind)(struct sock *, struct sockaddr *, int); + int (*bind_add)(struct sock *, struct sockaddr *, int); + int (*backlog_rcv)(struct sock *, struct sk_buff *); + void (*release_cb)(struct sock *); + int (*hash)(struct sock *); + void (*unhash)(struct sock *); + void (*rehash)(struct sock *); + int (*get_port)(struct sock *, short unsigned int); + unsigned int inuse_idx; + bool (*stream_memory_free)(const struct sock *, int); + bool (*stream_memory_read)(const struct sock *); + void (*enter_memory_pressure)(struct sock *); + void (*leave_memory_pressure)(struct sock *); + atomic_long_t *memory_allocated; + struct percpu_counter *sockets_allocated; + long unsigned int *memory_pressure; + long int *sysctl_mem; + int *sysctl_wmem; + int *sysctl_rmem; + u32 sysctl_wmem_offset; + u32 sysctl_rmem_offset; + int max_header; + bool no_autobind; + struct kmem_cache *slab; + unsigned int obj_size; + slab_flags_t slab_flags; + unsigned int useroffset; + unsigned int usersize; + struct percpu_counter *orphan_count; + struct request_sock_ops *rsk_prot; + struct timewait_sock_ops *twsk_prot; + union { + struct inet_hashinfo *hashinfo; + struct udp_table *udp_table; + struct raw_hashinfo *raw_hash; + struct smc_hashinfo *smc_hash; + } h; + struct module *owner; + char name[32]; + struct list_head node; + int (*diag_destroy)(struct sock *, int); +}; + +struct request_sock; + +struct request_sock_ops { + int family; + unsigned int obj_size; + struct kmem_cache *slab; + char *slab_name; + int (*rtx_syn_ack)(const struct sock *, struct request_sock *); + void (*send_ack)(const struct sock *, struct sk_buff *, struct request_sock *); + void (*send_reset)(const struct sock *, struct sk_buff *); + void (*destructor)(struct request_sock *); + void (*syn_ack_timeout)(const struct request_sock *); +}; + +struct timewait_sock_ops { + struct kmem_cache *twsk_slab; + char *twsk_slab_name; + unsigned int twsk_obj_size; + int (*twsk_unique)(struct sock *, struct sock *, void *); + void (*twsk_destructor)(struct sock *); +}; + +struct saved_syn; + +struct request_sock { + struct sock_common __req_common; + struct request_sock *dl_next; + u16 mss; + u8 num_retrans; + u8 syncookie: 1; + u8 num_timeout: 7; + u32 ts_recent; + struct timer_list rsk_timer; + const struct request_sock_ops *rsk_ops; + struct sock *sk; + struct saved_syn *saved_syn; + u32 secid; + u32 peer_secid; +}; + +struct saved_syn { + u32 mac_hdrlen; + u32 network_hdrlen; + u32 tcp_hdrlen; + u8 data[0]; +}; + +enum tsq_enum { + TSQ_THROTTLED = 0, + TSQ_QUEUED = 1, + TCP_TSQ_DEFERRED = 2, + TCP_WRITE_TIMER_DEFERRED = 3, + TCP_DELACK_TIMER_DEFERRED = 4, + TCP_MTU_REDUCED_DEFERRED = 5, +}; + +struct ip6_sf_list { + struct ip6_sf_list *sf_next; + struct in6_addr sf_addr; + long unsigned int sf_count[2]; + unsigned char sf_gsresp; + unsigned char sf_oldin; + unsigned char sf_crcount; +}; + +struct ifmcaddr6 { + struct in6_addr mca_addr; + struct inet6_dev *idev; + struct ifmcaddr6 *next; + struct ip6_sf_list *mca_sources; + struct ip6_sf_list *mca_tomb; + unsigned int mca_sfmode; + unsigned char mca_crcount; + long unsigned int mca_sfcount[2]; + struct timer_list mca_timer; + unsigned int mca_flags; + int mca_users; + refcount_t mca_refcnt; + spinlock_t mca_lock; + long unsigned int mca_cstamp; + long unsigned int mca_tstamp; +}; + +struct ifacaddr6 { + struct in6_addr aca_addr; + struct fib6_info *aca_rt; + struct ifacaddr6 *aca_next; + struct hlist_node aca_addr_lst; + int aca_users; + refcount_t aca_refcnt; + long unsigned int aca_cstamp; + long unsigned int aca_tstamp; + struct callback_head rcu; +}; + +enum { + __ND_OPT_PREFIX_INFO_END = 0, + ND_OPT_SOURCE_LL_ADDR = 1, + ND_OPT_TARGET_LL_ADDR = 2, + ND_OPT_PREFIX_INFO = 3, + ND_OPT_REDIRECT_HDR = 4, + ND_OPT_MTU = 5, + ND_OPT_NONCE = 14, + __ND_OPT_ARRAY_MAX = 15, + ND_OPT_ROUTE_INFO = 24, + ND_OPT_RDNSS = 25, + ND_OPT_DNSSL = 31, + ND_OPT_6CO = 34, + ND_OPT_CAPTIVE_PORTAL = 37, + ND_OPT_PREF64 = 38, + __ND_OPT_MAX = 39, +}; + +struct nd_opt_hdr { + __u8 nd_opt_type; + __u8 nd_opt_len; +}; + +struct ndisc_options { + struct nd_opt_hdr *nd_opt_array[15]; + struct nd_opt_hdr *nd_opts_ri; + struct nd_opt_hdr *nd_opts_ri_end; + struct nd_opt_hdr *nd_useropts; + struct nd_opt_hdr *nd_useropts_end; + struct nd_opt_hdr *nd_802154_opt_array[3]; +}; + +struct prefix_info { + __u8 type; + __u8 length; + __u8 prefix_len; + __u8 reserved: 6; + __u8 autoconf: 1; + __u8 onlink: 1; + __be32 valid; + __be32 prefered; + __be32 reserved2; + struct in6_addr prefix; +}; + +enum nfs_opnum4 { + OP_ACCESS = 3, + OP_CLOSE = 4, + OP_COMMIT = 5, + OP_CREATE = 6, + OP_DELEGPURGE = 7, + OP_DELEGRETURN = 8, + OP_GETATTR = 9, + OP_GETFH = 10, + OP_LINK = 11, + OP_LOCK = 12, + OP_LOCKT = 13, + OP_LOCKU = 14, + OP_LOOKUP = 15, + OP_LOOKUPP = 16, + OP_NVERIFY = 17, + OP_OPEN = 18, + OP_OPENATTR = 19, + OP_OPEN_CONFIRM = 20, + OP_OPEN_DOWNGRADE = 21, + OP_PUTFH = 22, + OP_PUTPUBFH = 23, + OP_PUTROOTFH = 24, + OP_READ = 25, + OP_READDIR = 26, + OP_READLINK = 27, + OP_REMOVE = 28, + OP_RENAME = 29, + OP_RENEW = 30, + OP_RESTOREFH = 31, + OP_SAVEFH = 32, + OP_SECINFO = 33, + OP_SETATTR = 34, + OP_SETCLIENTID = 35, + OP_SETCLIENTID_CONFIRM = 36, + OP_VERIFY = 37, + OP_WRITE = 38, + OP_RELEASE_LOCKOWNER = 39, + OP_BACKCHANNEL_CTL = 40, + OP_BIND_CONN_TO_SESSION = 41, + OP_EXCHANGE_ID = 42, + OP_CREATE_SESSION = 43, + OP_DESTROY_SESSION = 44, + OP_FREE_STATEID = 45, + OP_GET_DIR_DELEGATION = 46, + OP_GETDEVICEINFO = 47, + OP_GETDEVICELIST = 48, + OP_LAYOUTCOMMIT = 49, + OP_LAYOUTGET = 50, + OP_LAYOUTRETURN = 51, + OP_SECINFO_NO_NAME = 52, + OP_SEQUENCE = 53, + OP_SET_SSV = 54, + OP_TEST_STATEID = 55, + OP_WANT_DELEGATION = 56, + OP_DESTROY_CLIENTID = 57, + OP_RECLAIM_COMPLETE = 58, + OP_ALLOCATE = 59, + OP_COPY = 60, + OP_COPY_NOTIFY = 61, + OP_DEALLOCATE = 62, + OP_IO_ADVISE = 63, + OP_LAYOUTERROR = 64, + OP_LAYOUTSTATS = 65, + OP_OFFLOAD_CANCEL = 66, + OP_OFFLOAD_STATUS = 67, + OP_READ_PLUS = 68, + OP_SEEK = 69, + OP_WRITE_SAME = 70, + OP_CLONE = 71, + OP_GETXATTR = 72, + OP_SETXATTR = 73, + OP_LISTXATTRS = 74, + OP_REMOVEXATTR = 75, + OP_ILLEGAL = 10044, +}; + +enum perf_branch_sample_type_shift { + PERF_SAMPLE_BRANCH_USER_SHIFT = 0, + PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 1, + PERF_SAMPLE_BRANCH_HV_SHIFT = 2, + PERF_SAMPLE_BRANCH_ANY_SHIFT = 3, + PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 4, + PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 5, + PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 6, + PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 7, + PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 8, + PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 9, + PERF_SAMPLE_BRANCH_COND_SHIFT = 10, + PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 11, + PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT = 12, + PERF_SAMPLE_BRANCH_CALL_SHIFT = 13, + PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 14, + PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 15, + PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 16, + PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 17, + PERF_SAMPLE_BRANCH_MAX_SHIFT = 18, +}; + +enum exception_stack_ordering { + ESTACK_DF = 0, + ESTACK_NMI = 1, + ESTACK_DB = 2, + ESTACK_MCE = 3, + ESTACK_VC = 4, + ESTACK_VC2 = 5, + N_EXCEPTION_STACKS = 6, +}; + +enum { + TSK_TRACE_FL_TRACE_BIT = 0, + TSK_TRACE_FL_GRAPH_BIT = 1, +}; + +struct uuidcmp { + const char *uuid; + int len; +}; + +struct subprocess_info { + struct work_struct work; + struct completion *complete; + const char *path; + char **argv; + char **envp; + int wait; + int retval; + int (*init)(struct subprocess_info *, struct cred *); + void (*cleanup)(struct subprocess_info *); + void *data; +}; + +typedef phys_addr_t resource_size_t; + +struct resource { + resource_size_t start; + resource_size_t end; + const char *name; + long unsigned int flags; + long unsigned int desc; + struct resource *parent; + struct resource *sibling; + struct resource *child; +}; + +struct hash { + int ino; + int minor; + int major; + umode_t mode; + struct hash *next; + char name[4098]; +}; + +struct dir_entry { + struct list_head list; + char *name; + time64_t mtime; +}; + +enum state { + Start = 0, + Collect = 1, + GotHeader = 2, + SkipIt = 3, + GotName = 4, + CopyFile = 5, + GotSymlink = 6, + Reset = 7, +}; + +typedef int (*decompress_fn)(unsigned char *, long int, long int (*)(void *, long unsigned int), long int (*)(void *, long unsigned int), unsigned char *, long int *, void (*)(char *)); + +enum { + HI_SOFTIRQ = 0, + TIMER_SOFTIRQ = 1, + NET_TX_SOFTIRQ = 2, + NET_RX_SOFTIRQ = 3, + BLOCK_SOFTIRQ = 4, + IRQ_POLL_SOFTIRQ = 5, + TASKLET_SOFTIRQ = 6, + SCHED_SOFTIRQ = 7, + HRTIMER_SOFTIRQ = 8, + RCU_SOFTIRQ = 9, + NR_SOFTIRQS = 10, +}; + +enum ucount_type { + UCOUNT_USER_NAMESPACES = 0, + UCOUNT_PID_NAMESPACES = 1, + UCOUNT_UTS_NAMESPACES = 2, + UCOUNT_IPC_NAMESPACES = 3, + UCOUNT_NET_NAMESPACES = 4, + UCOUNT_MNT_NAMESPACES = 5, + UCOUNT_CGROUP_NAMESPACES = 6, + UCOUNT_TIME_NAMESPACES = 7, + UCOUNT_INOTIFY_INSTANCES = 8, + UCOUNT_INOTIFY_WATCHES = 9, + UCOUNT_COUNTS = 10, +}; + +enum flow_dissector_key_id { + FLOW_DISSECTOR_KEY_CONTROL = 0, + FLOW_DISSECTOR_KEY_BASIC = 1, + FLOW_DISSECTOR_KEY_IPV4_ADDRS = 2, + FLOW_DISSECTOR_KEY_IPV6_ADDRS = 3, + FLOW_DISSECTOR_KEY_PORTS = 4, + FLOW_DISSECTOR_KEY_PORTS_RANGE = 5, + FLOW_DISSECTOR_KEY_ICMP = 6, + FLOW_DISSECTOR_KEY_ETH_ADDRS = 7, + FLOW_DISSECTOR_KEY_TIPC = 8, + FLOW_DISSECTOR_KEY_ARP = 9, + FLOW_DISSECTOR_KEY_VLAN = 10, + FLOW_DISSECTOR_KEY_FLOW_LABEL = 11, + FLOW_DISSECTOR_KEY_GRE_KEYID = 12, + FLOW_DISSECTOR_KEY_MPLS_ENTROPY = 13, + FLOW_DISSECTOR_KEY_ENC_KEYID = 14, + FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS = 15, + FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS = 16, + FLOW_DISSECTOR_KEY_ENC_CONTROL = 17, + FLOW_DISSECTOR_KEY_ENC_PORTS = 18, + FLOW_DISSECTOR_KEY_MPLS = 19, + FLOW_DISSECTOR_KEY_TCP = 20, + FLOW_DISSECTOR_KEY_IP = 21, + FLOW_DISSECTOR_KEY_CVLAN = 22, + FLOW_DISSECTOR_KEY_ENC_IP = 23, + FLOW_DISSECTOR_KEY_ENC_OPTS = 24, + FLOW_DISSECTOR_KEY_META = 25, + FLOW_DISSECTOR_KEY_CT = 26, + FLOW_DISSECTOR_KEY_HASH = 27, + FLOW_DISSECTOR_KEY_MAX = 28, +}; + +enum { + IPSTATS_MIB_NUM = 0, + IPSTATS_MIB_INPKTS = 1, + IPSTATS_MIB_INOCTETS = 2, + IPSTATS_MIB_INDELIVERS = 3, + IPSTATS_MIB_OUTFORWDATAGRAMS = 4, + IPSTATS_MIB_OUTPKTS = 5, + IPSTATS_MIB_OUTOCTETS = 6, + IPSTATS_MIB_INHDRERRORS = 7, + IPSTATS_MIB_INTOOBIGERRORS = 8, + IPSTATS_MIB_INNOROUTES = 9, + IPSTATS_MIB_INADDRERRORS = 10, + IPSTATS_MIB_INUNKNOWNPROTOS = 11, + IPSTATS_MIB_INTRUNCATEDPKTS = 12, + IPSTATS_MIB_INDISCARDS = 13, + IPSTATS_MIB_OUTDISCARDS = 14, + IPSTATS_MIB_OUTNOROUTES = 15, + IPSTATS_MIB_REASMTIMEOUT = 16, + IPSTATS_MIB_REASMREQDS = 17, + IPSTATS_MIB_REASMOKS = 18, + IPSTATS_MIB_REASMFAILS = 19, + IPSTATS_MIB_FRAGOKS = 20, + IPSTATS_MIB_FRAGFAILS = 21, + IPSTATS_MIB_FRAGCREATES = 22, + IPSTATS_MIB_INMCASTPKTS = 23, + IPSTATS_MIB_OUTMCASTPKTS = 24, + IPSTATS_MIB_INBCASTPKTS = 25, + IPSTATS_MIB_OUTBCASTPKTS = 26, + IPSTATS_MIB_INMCASTOCTETS = 27, + IPSTATS_MIB_OUTMCASTOCTETS = 28, + IPSTATS_MIB_INBCASTOCTETS = 29, + IPSTATS_MIB_OUTBCASTOCTETS = 30, + IPSTATS_MIB_CSUMERRORS = 31, + IPSTATS_MIB_NOECTPKTS = 32, + IPSTATS_MIB_ECT1PKTS = 33, + IPSTATS_MIB_ECT0PKTS = 34, + IPSTATS_MIB_CEPKTS = 35, + IPSTATS_MIB_REASM_OVERLAPS = 36, + __IPSTATS_MIB_MAX = 37, +}; + +enum { + ICMP_MIB_NUM = 0, + ICMP_MIB_INMSGS = 1, + ICMP_MIB_INERRORS = 2, + ICMP_MIB_INDESTUNREACHS = 3, + ICMP_MIB_INTIMEEXCDS = 4, + ICMP_MIB_INPARMPROBS = 5, + ICMP_MIB_INSRCQUENCHS = 6, + ICMP_MIB_INREDIRECTS = 7, + ICMP_MIB_INECHOS = 8, + ICMP_MIB_INECHOREPS = 9, + ICMP_MIB_INTIMESTAMPS = 10, + ICMP_MIB_INTIMESTAMPREPS = 11, + ICMP_MIB_INADDRMASKS = 12, + ICMP_MIB_INADDRMASKREPS = 13, + ICMP_MIB_OUTMSGS = 14, + ICMP_MIB_OUTERRORS = 15, + ICMP_MIB_OUTDESTUNREACHS = 16, + ICMP_MIB_OUTTIMEEXCDS = 17, + ICMP_MIB_OUTPARMPROBS = 18, + ICMP_MIB_OUTSRCQUENCHS = 19, + ICMP_MIB_OUTREDIRECTS = 20, + ICMP_MIB_OUTECHOS = 21, + ICMP_MIB_OUTECHOREPS = 22, + ICMP_MIB_OUTTIMESTAMPS = 23, + ICMP_MIB_OUTTIMESTAMPREPS = 24, + ICMP_MIB_OUTADDRMASKS = 25, + ICMP_MIB_OUTADDRMASKREPS = 26, + ICMP_MIB_CSUMERRORS = 27, + __ICMP_MIB_MAX = 28, +}; + +enum { + ICMP6_MIB_NUM = 0, + ICMP6_MIB_INMSGS = 1, + ICMP6_MIB_INERRORS = 2, + ICMP6_MIB_OUTMSGS = 3, + ICMP6_MIB_OUTERRORS = 4, + ICMP6_MIB_CSUMERRORS = 5, + __ICMP6_MIB_MAX = 6, +}; + +enum { + TCP_MIB_NUM = 0, + TCP_MIB_RTOALGORITHM = 1, + TCP_MIB_RTOMIN = 2, + TCP_MIB_RTOMAX = 3, + TCP_MIB_MAXCONN = 4, + TCP_MIB_ACTIVEOPENS = 5, + TCP_MIB_PASSIVEOPENS = 6, + TCP_MIB_ATTEMPTFAILS = 7, + TCP_MIB_ESTABRESETS = 8, + TCP_MIB_CURRESTAB = 9, + TCP_MIB_INSEGS = 10, + TCP_MIB_OUTSEGS = 11, + TCP_MIB_RETRANSSEGS = 12, + TCP_MIB_INERRS = 13, + TCP_MIB_OUTRSTS = 14, + TCP_MIB_CSUMERRORS = 15, + __TCP_MIB_MAX = 16, +}; + +enum { + UDP_MIB_NUM = 0, + UDP_MIB_INDATAGRAMS = 1, + UDP_MIB_NOPORTS = 2, + UDP_MIB_INERRORS = 3, + UDP_MIB_OUTDATAGRAMS = 4, + UDP_MIB_RCVBUFERRORS = 5, + UDP_MIB_SNDBUFERRORS = 6, + UDP_MIB_CSUMERRORS = 7, + UDP_MIB_IGNOREDMULTI = 8, + UDP_MIB_MEMERRORS = 9, + __UDP_MIB_MAX = 10, +}; + +enum { + LINUX_MIB_NUM = 0, + LINUX_MIB_SYNCOOKIESSENT = 1, + LINUX_MIB_SYNCOOKIESRECV = 2, + LINUX_MIB_SYNCOOKIESFAILED = 3, + LINUX_MIB_EMBRYONICRSTS = 4, + LINUX_MIB_PRUNECALLED = 5, + LINUX_MIB_RCVPRUNED = 6, + LINUX_MIB_OFOPRUNED = 7, + LINUX_MIB_OUTOFWINDOWICMPS = 8, + LINUX_MIB_LOCKDROPPEDICMPS = 9, + LINUX_MIB_ARPFILTER = 10, + LINUX_MIB_TIMEWAITED = 11, + LINUX_MIB_TIMEWAITRECYCLED = 12, + LINUX_MIB_TIMEWAITKILLED = 13, + LINUX_MIB_PAWSACTIVEREJECTED = 14, + LINUX_MIB_PAWSESTABREJECTED = 15, + LINUX_MIB_DELAYEDACKS = 16, + LINUX_MIB_DELAYEDACKLOCKED = 17, + LINUX_MIB_DELAYEDACKLOST = 18, + LINUX_MIB_LISTENOVERFLOWS = 19, + LINUX_MIB_LISTENDROPS = 20, + LINUX_MIB_TCPHPHITS = 21, + LINUX_MIB_TCPPUREACKS = 22, + LINUX_MIB_TCPHPACKS = 23, + LINUX_MIB_TCPRENORECOVERY = 24, + LINUX_MIB_TCPSACKRECOVERY = 25, + LINUX_MIB_TCPSACKRENEGING = 26, + LINUX_MIB_TCPSACKREORDER = 27, + LINUX_MIB_TCPRENOREORDER = 28, + LINUX_MIB_TCPTSREORDER = 29, + LINUX_MIB_TCPFULLUNDO = 30, + LINUX_MIB_TCPPARTIALUNDO = 31, + LINUX_MIB_TCPDSACKUNDO = 32, + LINUX_MIB_TCPLOSSUNDO = 33, + LINUX_MIB_TCPLOSTRETRANSMIT = 34, + LINUX_MIB_TCPRENOFAILURES = 35, + LINUX_MIB_TCPSACKFAILURES = 36, + LINUX_MIB_TCPLOSSFAILURES = 37, + LINUX_MIB_TCPFASTRETRANS = 38, + LINUX_MIB_TCPSLOWSTARTRETRANS = 39, + LINUX_MIB_TCPTIMEOUTS = 40, + LINUX_MIB_TCPLOSSPROBES = 41, + LINUX_MIB_TCPLOSSPROBERECOVERY = 42, + LINUX_MIB_TCPRENORECOVERYFAIL = 43, + LINUX_MIB_TCPSACKRECOVERYFAIL = 44, + LINUX_MIB_TCPRCVCOLLAPSED = 45, + LINUX_MIB_TCPDSACKOLDSENT = 46, + LINUX_MIB_TCPDSACKOFOSENT = 47, + LINUX_MIB_TCPDSACKRECV = 48, + LINUX_MIB_TCPDSACKOFORECV = 49, + LINUX_MIB_TCPABORTONDATA = 50, + LINUX_MIB_TCPABORTONCLOSE = 51, + LINUX_MIB_TCPABORTONMEMORY = 52, + LINUX_MIB_TCPABORTONTIMEOUT = 53, + LINUX_MIB_TCPABORTONLINGER = 54, + LINUX_MIB_TCPABORTFAILED = 55, + LINUX_MIB_TCPMEMORYPRESSURES = 56, + LINUX_MIB_TCPMEMORYPRESSURESCHRONO = 57, + LINUX_MIB_TCPSACKDISCARD = 58, + LINUX_MIB_TCPDSACKIGNOREDOLD = 59, + LINUX_MIB_TCPDSACKIGNOREDNOUNDO = 60, + LINUX_MIB_TCPSPURIOUSRTOS = 61, + LINUX_MIB_TCPMD5NOTFOUND = 62, + LINUX_MIB_TCPMD5UNEXPECTED = 63, + LINUX_MIB_TCPMD5FAILURE = 64, + LINUX_MIB_SACKSHIFTED = 65, + LINUX_MIB_SACKMERGED = 66, + LINUX_MIB_SACKSHIFTFALLBACK = 67, + LINUX_MIB_TCPBACKLOGDROP = 68, + LINUX_MIB_PFMEMALLOCDROP = 69, + LINUX_MIB_TCPMINTTLDROP = 70, + LINUX_MIB_TCPDEFERACCEPTDROP = 71, + LINUX_MIB_IPRPFILTER = 72, + LINUX_MIB_TCPTIMEWAITOVERFLOW = 73, + LINUX_MIB_TCPREQQFULLDOCOOKIES = 74, + LINUX_MIB_TCPREQQFULLDROP = 75, + LINUX_MIB_TCPRETRANSFAIL = 76, + LINUX_MIB_TCPRCVCOALESCE = 77, + LINUX_MIB_TCPBACKLOGCOALESCE = 78, + LINUX_MIB_TCPOFOQUEUE = 79, + LINUX_MIB_TCPOFODROP = 80, + LINUX_MIB_TCPOFOMERGE = 81, + LINUX_MIB_TCPCHALLENGEACK = 82, + LINUX_MIB_TCPSYNCHALLENGE = 83, + LINUX_MIB_TCPFASTOPENACTIVE = 84, + LINUX_MIB_TCPFASTOPENACTIVEFAIL = 85, + LINUX_MIB_TCPFASTOPENPASSIVE = 86, + LINUX_MIB_TCPFASTOPENPASSIVEFAIL = 87, + LINUX_MIB_TCPFASTOPENLISTENOVERFLOW = 88, + LINUX_MIB_TCPFASTOPENCOOKIEREQD = 89, + LINUX_MIB_TCPFASTOPENBLACKHOLE = 90, + LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES = 91, + LINUX_MIB_BUSYPOLLRXPACKETS = 92, + LINUX_MIB_TCPAUTOCORKING = 93, + LINUX_MIB_TCPFROMZEROWINDOWADV = 94, + LINUX_MIB_TCPTOZEROWINDOWADV = 95, + LINUX_MIB_TCPWANTZEROWINDOWADV = 96, + LINUX_MIB_TCPSYNRETRANS = 97, + LINUX_MIB_TCPORIGDATASENT = 98, + LINUX_MIB_TCPHYSTARTTRAINDETECT = 99, + LINUX_MIB_TCPHYSTARTTRAINCWND = 100, + LINUX_MIB_TCPHYSTARTDELAYDETECT = 101, + LINUX_MIB_TCPHYSTARTDELAYCWND = 102, + LINUX_MIB_TCPACKSKIPPEDSYNRECV = 103, + LINUX_MIB_TCPACKSKIPPEDPAWS = 104, + LINUX_MIB_TCPACKSKIPPEDSEQ = 105, + LINUX_MIB_TCPACKSKIPPEDFINWAIT2 = 106, + LINUX_MIB_TCPACKSKIPPEDTIMEWAIT = 107, + LINUX_MIB_TCPACKSKIPPEDCHALLENGE = 108, + LINUX_MIB_TCPWINPROBE = 109, + LINUX_MIB_TCPKEEPALIVE = 110, + LINUX_MIB_TCPMTUPFAIL = 111, + LINUX_MIB_TCPMTUPSUCCESS = 112, + LINUX_MIB_TCPDELIVERED = 113, + LINUX_MIB_TCPDELIVEREDCE = 114, + LINUX_MIB_TCPACKCOMPRESSED = 115, + LINUX_MIB_TCPZEROWINDOWDROP = 116, + LINUX_MIB_TCPRCVQDROP = 117, + LINUX_MIB_TCPWQUEUETOOBIG = 118, + LINUX_MIB_TCPFASTOPENPASSIVEALTKEY = 119, + LINUX_MIB_TCPTIMEOUTREHASH = 120, + LINUX_MIB_TCPDUPLICATEDATAREHASH = 121, + LINUX_MIB_TCPDSACKRECVSEGS = 122, + LINUX_MIB_TCPDSACKIGNOREDDUBIOUS = 123, + __LINUX_MIB_MAX = 124, +}; + +enum { + LINUX_MIB_XFRMNUM = 0, + LINUX_MIB_XFRMINERROR = 1, + LINUX_MIB_XFRMINBUFFERERROR = 2, + LINUX_MIB_XFRMINHDRERROR = 3, + LINUX_MIB_XFRMINNOSTATES = 4, + LINUX_MIB_XFRMINSTATEPROTOERROR = 5, + LINUX_MIB_XFRMINSTATEMODEERROR = 6, + LINUX_MIB_XFRMINSTATESEQERROR = 7, + LINUX_MIB_XFRMINSTATEEXPIRED = 8, + LINUX_MIB_XFRMINSTATEMISMATCH = 9, + LINUX_MIB_XFRMINSTATEINVALID = 10, + LINUX_MIB_XFRMINTMPLMISMATCH = 11, + LINUX_MIB_XFRMINNOPOLS = 12, + LINUX_MIB_XFRMINPOLBLOCK = 13, + LINUX_MIB_XFRMINPOLERROR = 14, + LINUX_MIB_XFRMOUTERROR = 15, + LINUX_MIB_XFRMOUTBUNDLEGENERROR = 16, + LINUX_MIB_XFRMOUTBUNDLECHECKERROR = 17, + LINUX_MIB_XFRMOUTNOSTATES = 18, + LINUX_MIB_XFRMOUTSTATEPROTOERROR = 19, + LINUX_MIB_XFRMOUTSTATEMODEERROR = 20, + LINUX_MIB_XFRMOUTSTATESEQERROR = 21, + LINUX_MIB_XFRMOUTSTATEEXPIRED = 22, + LINUX_MIB_XFRMOUTPOLBLOCK = 23, + LINUX_MIB_XFRMOUTPOLDEAD = 24, + LINUX_MIB_XFRMOUTPOLERROR = 25, + LINUX_MIB_XFRMFWDHDRERROR = 26, + LINUX_MIB_XFRMOUTSTATEINVALID = 27, + LINUX_MIB_XFRMACQUIREERROR = 28, + __LINUX_MIB_XFRMMAX = 29, +}; + +enum { + LINUX_MIB_TLSNUM = 0, + LINUX_MIB_TLSCURRTXSW = 1, + LINUX_MIB_TLSCURRRXSW = 2, + LINUX_MIB_TLSCURRTXDEVICE = 3, + LINUX_MIB_TLSCURRRXDEVICE = 4, + LINUX_MIB_TLSTXSW = 5, + LINUX_MIB_TLSRXSW = 6, + LINUX_MIB_TLSTXDEVICE = 7, + LINUX_MIB_TLSRXDEVICE = 8, + LINUX_MIB_TLSDECRYPTERROR = 9, + LINUX_MIB_TLSRXDEVICERESYNC = 10, + __LINUX_MIB_TLSMAX = 11, +}; + +enum nf_inet_hooks { + NF_INET_PRE_ROUTING = 0, + NF_INET_LOCAL_IN = 1, + NF_INET_FORWARD = 2, + NF_INET_LOCAL_OUT = 3, + NF_INET_POST_ROUTING = 4, + NF_INET_NUMHOOKS = 5, + NF_INET_INGRESS = 5, +}; + +enum { + NFPROTO_UNSPEC = 0, + NFPROTO_INET = 1, + NFPROTO_IPV4 = 2, + NFPROTO_ARP = 3, + NFPROTO_NETDEV = 5, + NFPROTO_BRIDGE = 7, + NFPROTO_IPV6 = 10, + NFPROTO_DECNET = 12, + NFPROTO_NUMPROTO = 13, +}; + +enum tcp_conntrack { + TCP_CONNTRACK_NONE = 0, + TCP_CONNTRACK_SYN_SENT = 1, + TCP_CONNTRACK_SYN_RECV = 2, + TCP_CONNTRACK_ESTABLISHED = 3, + TCP_CONNTRACK_FIN_WAIT = 4, + TCP_CONNTRACK_CLOSE_WAIT = 5, + TCP_CONNTRACK_LAST_ACK = 6, + TCP_CONNTRACK_TIME_WAIT = 7, + TCP_CONNTRACK_CLOSE = 8, + TCP_CONNTRACK_LISTEN = 9, + TCP_CONNTRACK_MAX = 10, + TCP_CONNTRACK_IGNORE = 11, + TCP_CONNTRACK_RETRANS = 12, + TCP_CONNTRACK_UNACK = 13, + TCP_CONNTRACK_TIMEOUT_MAX = 14, +}; + +enum ct_dccp_states { + CT_DCCP_NONE = 0, + CT_DCCP_REQUEST = 1, + CT_DCCP_RESPOND = 2, + CT_DCCP_PARTOPEN = 3, + CT_DCCP_OPEN = 4, + CT_DCCP_CLOSEREQ = 5, + CT_DCCP_CLOSING = 6, + CT_DCCP_TIMEWAIT = 7, + CT_DCCP_IGNORE = 8, + CT_DCCP_INVALID = 9, + __CT_DCCP_MAX = 10, +}; + +enum ip_conntrack_dir { + IP_CT_DIR_ORIGINAL = 0, + IP_CT_DIR_REPLY = 1, + IP_CT_DIR_MAX = 2, +}; + +enum sctp_conntrack { + SCTP_CONNTRACK_NONE = 0, + SCTP_CONNTRACK_CLOSED = 1, + SCTP_CONNTRACK_COOKIE_WAIT = 2, + SCTP_CONNTRACK_COOKIE_ECHOED = 3, + SCTP_CONNTRACK_ESTABLISHED = 4, + SCTP_CONNTRACK_SHUTDOWN_SENT = 5, + SCTP_CONNTRACK_SHUTDOWN_RECD = 6, + SCTP_CONNTRACK_SHUTDOWN_ACK_SENT = 7, + SCTP_CONNTRACK_HEARTBEAT_SENT = 8, + SCTP_CONNTRACK_HEARTBEAT_ACKED = 9, + SCTP_CONNTRACK_MAX = 10, +}; + +enum udp_conntrack { + UDP_CT_UNREPLIED = 0, + UDP_CT_REPLIED = 1, + UDP_CT_MAX = 2, +}; + +enum gre_conntrack { + GRE_CT_UNREPLIED = 0, + GRE_CT_REPLIED = 1, + GRE_CT_MAX = 2, +}; + +enum { + XFRM_POLICY_IN = 0, + XFRM_POLICY_OUT = 1, + XFRM_POLICY_FWD = 2, + XFRM_POLICY_MASK = 3, + XFRM_POLICY_MAX = 3, +}; + +enum netns_bpf_attach_type { + NETNS_BPF_INVALID = 4294967295, + NETNS_BPF_FLOW_DISSECTOR = 0, + NETNS_BPF_SK_LOOKUP = 1, + MAX_NETNS_BPF_ATTACH_TYPE = 2, +}; + +enum skb_ext_id { + SKB_EXT_BRIDGE_NF = 0, + SKB_EXT_SEC_PATH = 1, + TC_SKB_EXT = 2, + SKB_EXT_MPTCP = 3, + SKB_EXT_NUM = 4, +}; + +enum audit_ntp_type { + AUDIT_NTP_OFFSET = 0, + AUDIT_NTP_FREQ = 1, + AUDIT_NTP_STATUS = 2, + AUDIT_NTP_TAI = 3, + AUDIT_NTP_TICK = 4, + AUDIT_NTP_ADJUST = 5, + AUDIT_NTP_NVALS = 6, +}; + +typedef long int (*sys_call_ptr_t)(const struct pt_regs *); + +struct irq_stack { + char stack[16384]; +}; + +struct io_bitmap { + u64 sequence; + refcount_t refcnt; + unsigned int max; + long unsigned int bitmap[1024]; +}; + +enum irqreturn { + IRQ_NONE = 0, + IRQ_HANDLED = 1, + IRQ_WAKE_THREAD = 2, +}; + +typedef enum irqreturn irqreturn_t; + +typedef struct { + u16 __softirq_pending; + u8 kvm_cpu_l1tf_flush_l1d; + unsigned int __nmi_count; + unsigned int apic_timer_irqs; + unsigned int irq_spurious_count; + unsigned int icr_read_retry_count; + unsigned int kvm_posted_intr_ipis; + unsigned int kvm_posted_intr_wakeup_ipis; + unsigned int kvm_posted_intr_nested_ipis; + unsigned int x86_platform_ipis; + unsigned int apic_perf_irqs; + unsigned int apic_irq_work_irqs; + unsigned int irq_resched_count; + unsigned int irq_call_count; + unsigned int irq_tlb_count; + unsigned int irq_thermal_count; + unsigned int irq_threshold_count; + unsigned int irq_deferred_error_count; + unsigned int irq_hv_callback_count; + unsigned int irq_hv_reenlightenment_count; + unsigned int hyperv_stimer0_count; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +} irq_cpustat_t; + +typedef irqreturn_t (*irq_handler_t)(int, void *); + +struct irqaction { + irq_handler_t handler; + void *dev_id; + void *percpu_dev_id; + struct irqaction *next; + irq_handler_t thread_fn; + struct task_struct *thread; + struct irqaction *secondary; + unsigned int irq; + unsigned int flags; + long unsigned int thread_flags; + long unsigned int thread_mask; + const char *name; + struct proc_dir_entry *dir; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct irq_affinity_notify { + unsigned int irq; + struct kref kref; + struct work_struct work; + void (*notify)(struct irq_affinity_notify *, const cpumask_t *); + void (*release)(struct kref *); +}; + +struct irq_affinity_desc { + struct cpumask mask; + unsigned int is_managed: 1; +}; + +enum irqchip_irq_state { + IRQCHIP_STATE_PENDING = 0, + IRQCHIP_STATE_ACTIVE = 1, + IRQCHIP_STATE_MASKED = 2, + IRQCHIP_STATE_LINE_LEVEL = 3, +}; + +enum { + EI_ETYPE_NONE = 0, + EI_ETYPE_NULL = 1, + EI_ETYPE_ERRNO = 2, + EI_ETYPE_ERRNO_NULL = 3, + EI_ETYPE_TRUE = 4, +}; + +struct syscall_metadata { + const char *name; + int syscall_nr; + int nb_args; + const char **types; + const char **args; + struct list_head enter_fields; + struct trace_event_call *enter_event; + struct trace_event_call *exit_event; +}; + +struct irqentry_state { + union { + bool exit_rcu; + bool lockdep; + }; +}; + +typedef struct irqentry_state irqentry_state_t; + +struct irq_desc; + +typedef void (*irq_flow_handler_t)(struct irq_desc *); + +struct msi_desc; + +struct irq_common_data { + unsigned int state_use_accessors; + unsigned int node; + void *handler_data; + struct msi_desc *msi_desc; + cpumask_var_t affinity; + cpumask_var_t effective_affinity; +}; + +struct irq_chip; + +struct irq_data { + u32 mask; + unsigned int irq; + long unsigned int hwirq; + struct irq_common_data *common; + struct irq_chip *chip; + struct irq_domain *domain; + struct irq_data *parent_data; + void *chip_data; +}; + +struct irq_desc { + struct irq_common_data irq_common_data; + struct irq_data irq_data; + unsigned int *kstat_irqs; + irq_flow_handler_t handle_irq; + struct irqaction *action; + unsigned int status_use_accessors; + unsigned int core_internal_state__do_not_mess_with_it; + unsigned int depth; + unsigned int wake_depth; + unsigned int tot_count; + unsigned int irq_count; + long unsigned int last_unhandled; + unsigned int irqs_unhandled; + atomic_t threads_handled; + int threads_handled_last; + raw_spinlock_t lock; + struct cpumask *percpu_enabled; + const struct cpumask *percpu_affinity; + const struct cpumask *affinity_hint; + struct irq_affinity_notify *affinity_notify; + cpumask_var_t pending_mask; + long unsigned int threads_oneshot; + atomic_t threads_active; + wait_queue_head_t wait_for_threads; + unsigned int nr_actions; + unsigned int no_suspend_depth; + unsigned int cond_suspend_depth; + unsigned int force_resume_depth; + struct proc_dir_entry *dir; + struct callback_head rcu; + struct kobject kobj; + struct mutex request_mutex; + int parent_irq; + struct module *owner; + const char *name; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct x86_msi_addr_lo { + union { + struct { + u32 reserved_0: 2; + u32 dest_mode_logical: 1; + u32 redirect_hint: 1; + u32 reserved_1: 1; + u32 virt_destid_8_14: 7; + u32 destid_0_7: 8; + u32 base_address: 12; + }; + struct { + u32 dmar_reserved_0: 2; + u32 dmar_index_15: 1; + u32 dmar_subhandle_valid: 1; + u32 dmar_format: 1; + u32 dmar_index_0_14: 15; + u32 dmar_base_address: 12; + }; + }; +}; + +typedef struct x86_msi_addr_lo arch_msi_msg_addr_lo_t; + +struct x86_msi_addr_hi { + u32 reserved: 8; + u32 destid_8_31: 24; +}; + +typedef struct x86_msi_addr_hi arch_msi_msg_addr_hi_t; + +struct x86_msi_data { + u32 vector: 8; + u32 delivery_mode: 3; + u32 dest_mode_logical: 1; + u32 reserved: 2; + u32 active_low: 1; + u32 is_level: 1; + u32 dmar_subhandle; +} __attribute__((packed)); + +typedef struct x86_msi_data arch_msi_msg_data_t; + +struct msi_msg { + union { + u32 address_lo; + arch_msi_msg_addr_lo_t arch_addr_lo; + }; + union { + u32 address_hi; + arch_msi_msg_addr_hi_t arch_addr_hi; + }; + union { + u32 data; + arch_msi_msg_data_t arch_data; + }; +}; + +struct platform_msi_priv_data; + +struct platform_msi_desc { + struct platform_msi_priv_data *msi_priv_data; + u16 msi_index; +}; + +struct fsl_mc_msi_desc { + u16 msi_index; +}; + +struct ti_sci_inta_msi_desc { + u16 dev_index; +}; + +struct msi_desc { + struct list_head list; + unsigned int irq; + unsigned int nvec_used; + struct device *dev; + struct msi_msg msg; + struct irq_affinity_desc *affinity; + const void *iommu_cookie; + void (*write_msi_msg)(struct msi_desc *, void *); + void *write_msi_msg_data; + union { + struct { + u32 masked; + struct { + u8 is_msix: 1; + u8 multiple: 3; + u8 multi_cap: 3; + u8 maskbit: 1; + u8 is_64: 1; + u8 is_virtual: 1; + u16 entry_nr; + unsigned int default_irq; + } msi_attrib; + union { + u8 mask_pos; + void *mask_base; + }; + }; + struct platform_msi_desc platform; + struct fsl_mc_msi_desc fsl_mc; + struct ti_sci_inta_msi_desc inta; + }; +}; + +struct irq_chip { + struct device *parent_device; + const char *name; + unsigned int (*irq_startup)(struct irq_data *); + void (*irq_shutdown)(struct irq_data *); + void (*irq_enable)(struct irq_data *); + void (*irq_disable)(struct irq_data *); + void (*irq_ack)(struct irq_data *); + void (*irq_mask)(struct irq_data *); + void (*irq_mask_ack)(struct irq_data *); + void (*irq_unmask)(struct irq_data *); + void (*irq_eoi)(struct irq_data *); + int (*irq_set_affinity)(struct irq_data *, const struct cpumask *, bool); + int (*irq_retrigger)(struct irq_data *); + int (*irq_set_type)(struct irq_data *, unsigned int); + int (*irq_set_wake)(struct irq_data *, unsigned int); + void (*irq_bus_lock)(struct irq_data *); + void (*irq_bus_sync_unlock)(struct irq_data *); + void (*irq_cpu_online)(struct irq_data *); + void (*irq_cpu_offline)(struct irq_data *); + void (*irq_suspend)(struct irq_data *); + void (*irq_resume)(struct irq_data *); + void (*irq_pm_shutdown)(struct irq_data *); + void (*irq_calc_mask)(struct irq_data *); + void (*irq_print_chip)(struct irq_data *, struct seq_file *); + int (*irq_request_resources)(struct irq_data *); + void (*irq_release_resources)(struct irq_data *); + void (*irq_compose_msi_msg)(struct irq_data *, struct msi_msg *); + void (*irq_write_msi_msg)(struct irq_data *, struct msi_msg *); + int (*irq_get_irqchip_state)(struct irq_data *, enum irqchip_irq_state, bool *); + int (*irq_set_irqchip_state)(struct irq_data *, enum irqchip_irq_state, bool); + int (*irq_set_vcpu_affinity)(struct irq_data *, void *); + void (*ipi_send_single)(struct irq_data *, unsigned int); + void (*ipi_send_mask)(struct irq_data *, const struct cpumask *); + int (*irq_nmi_setup)(struct irq_data *); + void (*irq_nmi_teardown)(struct irq_data *); + long unsigned int flags; +}; + +struct irq_chip_regs { + long unsigned int enable; + long unsigned int disable; + long unsigned int mask; + long unsigned int ack; + long unsigned int eoi; + long unsigned int type; + long unsigned int polarity; +}; + +struct irq_chip_type { + struct irq_chip chip; + struct irq_chip_regs regs; + irq_flow_handler_t handler; + u32 type; + u32 mask_cache_priv; + u32 *mask_cache; +}; + +struct irq_chip_generic { + raw_spinlock_t lock; + void *reg_base; + u32 (*reg_readl)(void *); + void (*reg_writel)(u32, void *); + void (*suspend)(struct irq_chip_generic *); + void (*resume)(struct irq_chip_generic *); + unsigned int irq_base; + unsigned int irq_cnt; + u32 mask_cache; + u32 type_cache; + u32 polarity_cache; + u32 wake_enabled; + u32 wake_active; + unsigned int num_ct; + void *private; + long unsigned int installed; + long unsigned int unused; + struct irq_domain *domain; + struct list_head list; + struct irq_chip_type chip_types[0]; +}; + +enum irq_gc_flags { + IRQ_GC_INIT_MASK_CACHE = 1, + IRQ_GC_INIT_NESTED_LOCK = 2, + IRQ_GC_MASK_CACHE_PER_TYPE = 4, + IRQ_GC_NO_MASK = 8, + IRQ_GC_BE_IO = 16, +}; + +struct irq_domain_chip_generic { + unsigned int irqs_per_chip; + unsigned int num_chips; + unsigned int irq_flags_to_clear; + unsigned int irq_flags_to_set; + enum irq_gc_flags gc_flags; + struct irq_chip_generic *gc[0]; +}; + +struct alt_instr { + s32 instr_offset; + s32 repl_offset; + u16 cpuid; + u8 instrlen; + u8 replacementlen; + u8 padlen; +} __attribute__((packed)); + +struct cpuinfo_x86 { + __u8 x86; + __u8 x86_vendor; + __u8 x86_model; + __u8 x86_stepping; + int x86_tlbsize; + __u32 vmx_capability[3]; + __u8 x86_virt_bits; + __u8 x86_phys_bits; + __u8 x86_coreid_bits; + __u8 cu_id; + __u32 extended_cpuid_level; + int cpuid_level; + union { + __u32 x86_capability[20]; + long unsigned int x86_capability_alignment; + }; + char x86_vendor_id[16]; + char x86_model_id[64]; + unsigned int x86_cache_size; + int x86_cache_alignment; + int x86_cache_max_rmid; + int x86_cache_occ_scale; + int x86_cache_mbm_width_offset; + int x86_power; + long unsigned int loops_per_jiffy; + u16 x86_max_cores; + u16 apicid; + u16 initial_apicid; + u16 x86_clflush_size; + u16 booted_cores; + u16 phys_proc_id; + u16 logical_proc_id; + u16 cpu_core_id; + u16 cpu_die_id; + u16 logical_die_id; + u16 cpu_index; + u32 microcode; + u8 x86_cache_bits; + unsigned int initialized: 1; +}; + +struct timens_offset { + s64 sec; + u64 nsec; +}; + +enum vm_fault_reason { + VM_FAULT_OOM = 1, + VM_FAULT_SIGBUS = 2, + VM_FAULT_MAJOR = 4, + VM_FAULT_WRITE = 8, + VM_FAULT_HWPOISON = 16, + VM_FAULT_HWPOISON_LARGE = 32, + VM_FAULT_SIGSEGV = 64, + VM_FAULT_NOPAGE = 256, + VM_FAULT_LOCKED = 512, + VM_FAULT_RETRY = 1024, + VM_FAULT_FALLBACK = 2048, + VM_FAULT_DONE_COW = 4096, + VM_FAULT_NEEDDSYNC = 8192, + VM_FAULT_HINDEX_MASK = 983040, +}; + +struct vm_special_mapping { + const char *name; + struct page **pages; + vm_fault_t (*fault)(const struct vm_special_mapping *, struct vm_area_struct *, struct vm_fault *); + int (*mremap)(const struct vm_special_mapping *, struct vm_area_struct *); +}; + +struct timens_offsets { + struct timespec64 monotonic; + struct timespec64 boottime; +}; + +struct time_namespace { + struct user_namespace *user_ns; + struct ucounts *ucounts; + struct ns_common ns; + struct timens_offsets offsets; + struct page *vvar_page; + bool frozen_offsets; +}; + +struct pvclock_vcpu_time_info { + u32 version; + u32 pad0; + u64 tsc_timestamp; + u64 system_time; + u32 tsc_to_system_mul; + s8 tsc_shift; + u8 flags; + u8 pad[2]; +}; + +struct pvclock_vsyscall_time_info { + struct pvclock_vcpu_time_info pvti; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum vdso_clock_mode { + VDSO_CLOCKMODE_NONE = 0, + VDSO_CLOCKMODE_TSC = 1, + VDSO_CLOCKMODE_PVCLOCK = 2, + VDSO_CLOCKMODE_HVCLOCK = 3, + VDSO_CLOCKMODE_MAX = 4, + VDSO_CLOCKMODE_TIMENS = 2147483647, +}; + +struct arch_vdso_data {}; + +struct vdso_timestamp { + u64 sec; + u64 nsec; +}; + +struct vdso_data { + u32 seq; + s32 clock_mode; + u64 cycle_last; + u64 mask; + u32 mult; + u32 shift; + union { + struct vdso_timestamp basetime[12]; + struct timens_offset offset[12]; + }; + s32 tz_minuteswest; + s32 tz_dsttime; + u32 hrtimer_res; + u32 __unused; + struct arch_vdso_data arch_data; +}; + +struct ms_hyperv_tsc_page { + volatile u32 tsc_sequence; + u32 reserved1; + volatile u64 tsc_scale; + volatile s64 tsc_offset; +}; + +enum { + TASKSTATS_CMD_UNSPEC = 0, + TASKSTATS_CMD_GET = 1, + TASKSTATS_CMD_NEW = 2, + __TASKSTATS_CMD_MAX = 3, +}; + +enum cpu_usage_stat { + CPUTIME_USER = 0, + CPUTIME_NICE = 1, + CPUTIME_SYSTEM = 2, + CPUTIME_SOFTIRQ = 3, + CPUTIME_IRQ = 4, + CPUTIME_IDLE = 5, + CPUTIME_IOWAIT = 6, + CPUTIME_STEAL = 7, + CPUTIME_GUEST = 8, + CPUTIME_GUEST_NICE = 9, + NR_STATS = 10, +}; + +enum bpf_cgroup_storage_type { + BPF_CGROUP_STORAGE_SHARED = 0, + BPF_CGROUP_STORAGE_PERCPU = 1, + __BPF_CGROUP_STORAGE_MAX = 2, +}; + +enum bpf_tramp_prog_type { + BPF_TRAMP_FENTRY = 0, + BPF_TRAMP_FEXIT = 1, + BPF_TRAMP_MODIFY_RETURN = 2, + BPF_TRAMP_MAX = 3, + BPF_TRAMP_REPLACE = 4, +}; + +enum psi_task_count { + NR_IOWAIT = 0, + NR_MEMSTALL = 1, + NR_RUNNING = 2, + NR_ONCPU = 3, + NR_PSI_TASK_COUNTS = 4, +}; + +enum psi_states { + PSI_IO_SOME = 0, + PSI_IO_FULL = 1, + PSI_MEM_SOME = 2, + PSI_MEM_FULL = 3, + PSI_CPU_SOME = 4, + PSI_NONIDLE = 5, + NR_PSI_STATES = 6, +}; + +enum psi_aggregators { + PSI_AVGS = 0, + PSI_POLL = 1, + NR_PSI_AGGREGATORS = 2, +}; + +enum cgroup_subsys_id { + cpuset_cgrp_id = 0, + cpu_cgrp_id = 1, + cpuacct_cgrp_id = 2, + io_cgrp_id = 3, + memory_cgrp_id = 4, + devices_cgrp_id = 5, + freezer_cgrp_id = 6, + net_cls_cgrp_id = 7, + perf_event_cgrp_id = 8, + net_prio_cgrp_id = 9, + hugetlb_cgrp_id = 10, + pids_cgrp_id = 11, + CGROUP_SUBSYS_COUNT = 12, +}; + +struct vdso_exception_table_entry { + int insn; + int fixup; +}; + +enum syscall_work_bit { + SYSCALL_WORK_BIT_SECCOMP = 0, + SYSCALL_WORK_BIT_SYSCALL_TRACEPOINT = 1, + SYSCALL_WORK_BIT_SYSCALL_TRACE = 2, + SYSCALL_WORK_BIT_SYSCALL_EMU = 3, + SYSCALL_WORK_BIT_SYSCALL_AUDIT = 4, + SYSCALL_WORK_BIT_SYSCALL_USER_DISPATCH = 5, + SYSCALL_WORK_BIT_SYSCALL_EXIT_TRAP = 6, +}; + +struct seccomp_data { + int nr; + __u32 arch; + __u64 instruction_pointer; + __u64 args[6]; +}; + +enum x86_pf_error_code { + X86_PF_PROT = 1, + X86_PF_WRITE = 2, + X86_PF_USER = 4, + X86_PF_RSVD = 8, + X86_PF_INSTR = 16, + X86_PF_PK = 32, + X86_PF_SGX = 32768, +}; + +struct trace_event_raw_emulate_vsyscall { + struct trace_entry ent; + int nr; + char __data[0]; +}; + +struct trace_event_data_offsets_emulate_vsyscall {}; + +typedef void (*btf_trace_emulate_vsyscall)(void *, int); + +enum { + EMULATE = 0, + XONLY = 1, + NONE = 2, +}; + +enum perf_type_id { + PERF_TYPE_HARDWARE = 0, + PERF_TYPE_SOFTWARE = 1, + PERF_TYPE_TRACEPOINT = 2, + PERF_TYPE_HW_CACHE = 3, + PERF_TYPE_RAW = 4, + PERF_TYPE_BREAKPOINT = 5, + PERF_TYPE_MAX = 6, +}; + +enum perf_hw_id { + PERF_COUNT_HW_CPU_CYCLES = 0, + PERF_COUNT_HW_INSTRUCTIONS = 1, + PERF_COUNT_HW_CACHE_REFERENCES = 2, + PERF_COUNT_HW_CACHE_MISSES = 3, + PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, + PERF_COUNT_HW_BRANCH_MISSES = 5, + PERF_COUNT_HW_BUS_CYCLES = 6, + PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7, + PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, + PERF_COUNT_HW_REF_CPU_CYCLES = 9, + PERF_COUNT_HW_MAX = 10, +}; + +enum perf_hw_cache_id { + PERF_COUNT_HW_CACHE_L1D = 0, + PERF_COUNT_HW_CACHE_L1I = 1, + PERF_COUNT_HW_CACHE_LL = 2, + PERF_COUNT_HW_CACHE_DTLB = 3, + PERF_COUNT_HW_CACHE_ITLB = 4, + PERF_COUNT_HW_CACHE_BPU = 5, + PERF_COUNT_HW_CACHE_NODE = 6, + PERF_COUNT_HW_CACHE_MAX = 7, +}; + +enum perf_hw_cache_op_id { + PERF_COUNT_HW_CACHE_OP_READ = 0, + PERF_COUNT_HW_CACHE_OP_WRITE = 1, + PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, + PERF_COUNT_HW_CACHE_OP_MAX = 3, +}; + +enum perf_hw_cache_op_result_id { + PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, + PERF_COUNT_HW_CACHE_RESULT_MISS = 1, + PERF_COUNT_HW_CACHE_RESULT_MAX = 2, +}; + +enum perf_event_sample_format { + PERF_SAMPLE_IP = 1, + PERF_SAMPLE_TID = 2, + PERF_SAMPLE_TIME = 4, + PERF_SAMPLE_ADDR = 8, + PERF_SAMPLE_READ = 16, + PERF_SAMPLE_CALLCHAIN = 32, + PERF_SAMPLE_ID = 64, + PERF_SAMPLE_CPU = 128, + PERF_SAMPLE_PERIOD = 256, + PERF_SAMPLE_STREAM_ID = 512, + PERF_SAMPLE_RAW = 1024, + PERF_SAMPLE_BRANCH_STACK = 2048, + PERF_SAMPLE_REGS_USER = 4096, + PERF_SAMPLE_STACK_USER = 8192, + PERF_SAMPLE_WEIGHT = 16384, + PERF_SAMPLE_DATA_SRC = 32768, + PERF_SAMPLE_IDENTIFIER = 65536, + PERF_SAMPLE_TRANSACTION = 131072, + PERF_SAMPLE_REGS_INTR = 262144, + PERF_SAMPLE_PHYS_ADDR = 524288, + PERF_SAMPLE_AUX = 1048576, + PERF_SAMPLE_CGROUP = 2097152, + PERF_SAMPLE_DATA_PAGE_SIZE = 4194304, + PERF_SAMPLE_CODE_PAGE_SIZE = 8388608, + PERF_SAMPLE_MAX = 16777216, + __PERF_SAMPLE_CALLCHAIN_EARLY = 0, +}; + +enum perf_branch_sample_type { + PERF_SAMPLE_BRANCH_USER = 1, + PERF_SAMPLE_BRANCH_KERNEL = 2, + PERF_SAMPLE_BRANCH_HV = 4, + PERF_SAMPLE_BRANCH_ANY = 8, + PERF_SAMPLE_BRANCH_ANY_CALL = 16, + PERF_SAMPLE_BRANCH_ANY_RETURN = 32, + PERF_SAMPLE_BRANCH_IND_CALL = 64, + PERF_SAMPLE_BRANCH_ABORT_TX = 128, + PERF_SAMPLE_BRANCH_IN_TX = 256, + PERF_SAMPLE_BRANCH_NO_TX = 512, + PERF_SAMPLE_BRANCH_COND = 1024, + PERF_SAMPLE_BRANCH_CALL_STACK = 2048, + PERF_SAMPLE_BRANCH_IND_JUMP = 4096, + PERF_SAMPLE_BRANCH_CALL = 8192, + PERF_SAMPLE_BRANCH_NO_FLAGS = 16384, + PERF_SAMPLE_BRANCH_NO_CYCLES = 32768, + PERF_SAMPLE_BRANCH_TYPE_SAVE = 65536, + PERF_SAMPLE_BRANCH_HW_INDEX = 131072, + PERF_SAMPLE_BRANCH_MAX = 262144, +}; + +struct perf_event_mmap_page { + __u32 version; + __u32 compat_version; + __u32 lock; + __u32 index; + __s64 offset; + __u64 time_enabled; + __u64 time_running; + union { + __u64 capabilities; + struct { + __u64 cap_bit0: 1; + __u64 cap_bit0_is_deprecated: 1; + __u64 cap_user_rdpmc: 1; + __u64 cap_user_time: 1; + __u64 cap_user_time_zero: 1; + __u64 cap_user_time_short: 1; + __u64 cap_____res: 58; + }; + }; + __u16 pmc_width; + __u16 time_shift; + __u32 time_mult; + __u64 time_offset; + __u64 time_zero; + __u32 size; + __u32 __reserved_1; + __u64 time_cycles; + __u64 time_mask; + __u8 __reserved[928]; + __u64 data_head; + __u64 data_tail; + __u64 data_offset; + __u64 data_size; + __u64 aux_head; + __u64 aux_tail; + __u64 aux_offset; + __u64 aux_size; +}; + +struct pv_info { + u16 extra_user_64bit_cs; + const char *name; +}; + +struct ldt_struct { + struct desc_struct *entries; + unsigned int nr_entries; + int slot; +}; + +enum apic_delivery_modes { + APIC_DELIVERY_MODE_FIXED = 0, + APIC_DELIVERY_MODE_LOWESTPRIO = 1, + APIC_DELIVERY_MODE_SMI = 2, + APIC_DELIVERY_MODE_NMI = 4, + APIC_DELIVERY_MODE_INIT = 5, + APIC_DELIVERY_MODE_EXTINT = 7, +}; + +struct physid_mask { + long unsigned int mask[512]; +}; + +typedef struct physid_mask physid_mask_t; + +struct x86_pmu_capability { + int version; + int num_counters_gp; + int num_counters_fixed; + int bit_width_gp; + int bit_width_fixed; + unsigned int events_mask; + int events_mask_len; +}; + +struct debug_store { + u64 bts_buffer_base; + u64 bts_index; + u64 bts_absolute_maximum; + u64 bts_interrupt_threshold; + u64 pebs_buffer_base; + u64 pebs_index; + u64 pebs_absolute_maximum; + u64 pebs_interrupt_threshold; + u64 pebs_event_reset[12]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum stack_type { + STACK_TYPE_UNKNOWN = 0, + STACK_TYPE_TASK = 1, + STACK_TYPE_IRQ = 2, + STACK_TYPE_SOFTIRQ = 3, + STACK_TYPE_ENTRY = 4, + STACK_TYPE_EXCEPTION = 5, + STACK_TYPE_EXCEPTION_LAST = 10, +}; + +struct stack_info { + enum stack_type type; + long unsigned int *begin; + long unsigned int *end; + long unsigned int *next_sp; +}; + +struct stack_frame { + struct stack_frame *next_frame; + long unsigned int return_address; +}; + +struct stack_frame_ia32 { + u32 next_frame; + u32 return_address; +}; + +struct perf_guest_switch_msr { + unsigned int msr; + u64 host; + u64 guest; +}; + +struct perf_guest_info_callbacks { + int (*is_in_guest)(); + int (*is_user_mode)(); + long unsigned int (*get_guest_ip)(); + void (*handle_intel_pt_intr)(); +}; + +struct device_attribute { + struct attribute attr; + ssize_t (*show)(struct device *, struct device_attribute *, char *); + ssize_t (*store)(struct device *, struct device_attribute *, const char *, size_t); +}; + +enum perf_event_x86_regs { + PERF_REG_X86_AX = 0, + PERF_REG_X86_BX = 1, + PERF_REG_X86_CX = 2, + PERF_REG_X86_DX = 3, + PERF_REG_X86_SI = 4, + PERF_REG_X86_DI = 5, + PERF_REG_X86_BP = 6, + PERF_REG_X86_SP = 7, + PERF_REG_X86_IP = 8, + PERF_REG_X86_FLAGS = 9, + PERF_REG_X86_CS = 10, + PERF_REG_X86_SS = 11, + PERF_REG_X86_DS = 12, + PERF_REG_X86_ES = 13, + PERF_REG_X86_FS = 14, + PERF_REG_X86_GS = 15, + PERF_REG_X86_R8 = 16, + PERF_REG_X86_R9 = 17, + PERF_REG_X86_R10 = 18, + PERF_REG_X86_R11 = 19, + PERF_REG_X86_R12 = 20, + PERF_REG_X86_R13 = 21, + PERF_REG_X86_R14 = 22, + PERF_REG_X86_R15 = 23, + PERF_REG_X86_32_MAX = 16, + PERF_REG_X86_64_MAX = 24, + PERF_REG_X86_XMM0 = 32, + PERF_REG_X86_XMM1 = 34, + PERF_REG_X86_XMM2 = 36, + PERF_REG_X86_XMM3 = 38, + PERF_REG_X86_XMM4 = 40, + PERF_REG_X86_XMM5 = 42, + PERF_REG_X86_XMM6 = 44, + PERF_REG_X86_XMM7 = 46, + PERF_REG_X86_XMM8 = 48, + PERF_REG_X86_XMM9 = 50, + PERF_REG_X86_XMM10 = 52, + PERF_REG_X86_XMM11 = 54, + PERF_REG_X86_XMM12 = 56, + PERF_REG_X86_XMM13 = 58, + PERF_REG_X86_XMM14 = 60, + PERF_REG_X86_XMM15 = 62, + PERF_REG_X86_XMM_MAX = 64, +}; + +struct perf_callchain_entry_ctx { + struct perf_callchain_entry *entry; + u32 max_stack; + u32 nr; + short int contexts; + bool contexts_maxed; +}; + +struct perf_pmu_events_attr { + struct device_attribute attr; + u64 id; + const char *event_str; +}; + +struct perf_pmu_events_ht_attr { + struct device_attribute attr; + u64 id; + const char *event_str_ht; + const char *event_str_noht; +}; + +struct apic { + void (*eoi_write)(u32, u32); + void (*native_eoi_write)(u32, u32); + void (*write)(u32, u32); + u32 (*read)(u32); + void (*wait_icr_idle)(); + u32 (*safe_wait_icr_idle)(); + void (*send_IPI)(int, int); + void (*send_IPI_mask)(const struct cpumask *, int); + void (*send_IPI_mask_allbutself)(const struct cpumask *, int); + void (*send_IPI_allbutself)(int); + void (*send_IPI_all)(int); + void (*send_IPI_self)(int); + u32 disable_esr; + enum apic_delivery_modes delivery_mode; + bool dest_mode_logical; + u32 (*calc_dest_apicid)(unsigned int); + u64 (*icr_read)(); + void (*icr_write)(u32, u32); + int (*probe)(); + int (*acpi_madt_oem_check)(char *, char *); + int (*apic_id_valid)(u32); + int (*apic_id_registered)(); + bool (*check_apicid_used)(physid_mask_t *, int); + void (*init_apic_ldr)(); + void (*ioapic_phys_id_map)(physid_mask_t *, physid_mask_t *); + void (*setup_apic_routing)(); + int (*cpu_present_to_apicid)(int); + void (*apicid_to_cpu_present)(int, physid_mask_t *); + int (*check_phys_apicid_present)(int); + int (*phys_pkg_id)(int, int); + u32 (*get_apic_id)(long unsigned int); + u32 (*set_apic_id)(unsigned int); + int (*wakeup_secondary_cpu)(int, long unsigned int); + void (*inquire_remote_apic)(int); + char *name; +}; + +enum { + NMI_LOCAL = 0, + NMI_UNKNOWN = 1, + NMI_SERR = 2, + NMI_IO_CHECK = 3, + NMI_MAX = 4, +}; + +typedef int (*nmi_handler_t)(unsigned int, struct pt_regs *); + +struct nmiaction { + struct list_head list; + nmi_handler_t handler; + u64 max_duration; + long unsigned int flags; + const char *name; +}; + +struct gdt_page { + struct desc_struct gdt[16]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct cyc2ns_data { + u32 cyc2ns_mul; + u32 cyc2ns_shift; + u64 cyc2ns_offset; +}; + +struct unwind_state { + struct stack_info stack_info; + long unsigned int stack_mask; + struct task_struct *task; + int graph_idx; + bool error; + bool signal; + bool full_regs; + long unsigned int sp; + long unsigned int bp; + long unsigned int ip; + struct pt_regs *regs; + struct pt_regs *prev_regs; +}; + +enum extra_reg_type { + EXTRA_REG_NONE = 4294967295, + EXTRA_REG_RSP_0 = 0, + EXTRA_REG_RSP_1 = 1, + EXTRA_REG_LBR = 2, + EXTRA_REG_LDLAT = 3, + EXTRA_REG_FE = 4, + EXTRA_REG_MAX = 5, +}; + +struct event_constraint { + union { + long unsigned int idxmsk[1]; + u64 idxmsk64; + }; + u64 code; + u64 cmask; + int weight; + int overlap; + int flags; + unsigned int size; +}; + +struct amd_nb { + int nb_id; + int refcnt; + struct perf_event *owners[64]; + struct event_constraint event_constraints[64]; +}; + +struct er_account { + raw_spinlock_t lock; + u64 config; + u64 reg; + atomic_t ref; +}; + +struct intel_shared_regs { + struct er_account regs[5]; + int refcnt; + unsigned int core_id; +}; + +enum intel_excl_state_type { + INTEL_EXCL_UNUSED = 0, + INTEL_EXCL_SHARED = 1, + INTEL_EXCL_EXCLUSIVE = 2, +}; + +struct intel_excl_states { + enum intel_excl_state_type state[64]; + bool sched_started; +}; + +struct intel_excl_cntrs { + raw_spinlock_t lock; + struct intel_excl_states states[2]; + union { + u16 has_exclusive[2]; + u32 exclusive_present; + }; + int refcnt; + unsigned int core_id; +}; + +enum { + X86_PERF_KFREE_SHARED = 0, + X86_PERF_KFREE_EXCL = 1, + X86_PERF_KFREE_MAX = 2, +}; + +struct cpu_hw_events { + struct perf_event *events[64]; + long unsigned int active_mask[1]; + long unsigned int running[1]; + int enabled; + int n_events; + int n_added; + int n_txn; + int n_txn_pair; + int n_txn_metric; + int assign[64]; + u64 tags[64]; + struct perf_event *event_list[64]; + struct event_constraint *event_constraint[64]; + int n_excl; + unsigned int txn_flags; + int is_fake; + struct debug_store *ds; + void *ds_pebs_vaddr; + void *ds_bts_vaddr; + u64 pebs_enabled; + int n_pebs; + int n_large_pebs; + int n_pebs_via_pt; + int pebs_output; + u64 pebs_data_cfg; + u64 active_pebs_data_cfg; + int pebs_record_size; + int lbr_users; + int lbr_pebs_users; + struct perf_branch_stack lbr_stack; + struct perf_branch_entry lbr_entries[32]; + union { + struct er_account *lbr_sel; + struct er_account *lbr_ctl; + }; + u64 br_sel; + void *last_task_ctx; + int last_log_id; + int lbr_select; + void *lbr_xsave; + u64 intel_ctrl_guest_mask; + u64 intel_ctrl_host_mask; + struct perf_guest_switch_msr guest_switch_msrs[64]; + u64 intel_cp_status; + struct intel_shared_regs *shared_regs; + struct event_constraint *constraint_list; + struct intel_excl_cntrs *excl_cntrs; + int excl_thread_id; + u64 tfa_shadow; + int n_metric; + struct amd_nb *amd_nb; + u64 perf_ctr_virt_mask; + int n_pair; + void *kfree_on_online[2]; +}; + +struct extra_reg { + unsigned int event; + unsigned int msr; + u64 config_mask; + u64 valid_mask; + int idx; + bool extra_msr_access; +}; + +union perf_capabilities { + struct { + u64 lbr_format: 6; + u64 pebs_trap: 1; + u64 pebs_arch_reg: 1; + u64 pebs_format: 4; + u64 smm_freeze: 1; + u64 full_width_write: 1; + u64 pebs_baseline: 1; + u64 perf_metrics: 1; + u64 pebs_output_pt_available: 1; + u64 anythread_deprecated: 1; + }; + u64 capabilities; +}; + +struct x86_pmu_quirk { + struct x86_pmu_quirk *next; + void (*func)(); +}; + +enum { + x86_lbr_exclusive_lbr = 0, + x86_lbr_exclusive_bts = 1, + x86_lbr_exclusive_pt = 2, + x86_lbr_exclusive_max = 3, +}; + +struct x86_pmu { + const char *name; + int version; + int (*handle_irq)(struct pt_regs *); + void (*disable_all)(); + void (*enable_all)(int); + void (*enable)(struct perf_event *); + void (*disable)(struct perf_event *); + void (*add)(struct perf_event *); + void (*del)(struct perf_event *); + void (*read)(struct perf_event *); + int (*hw_config)(struct perf_event *); + int (*schedule_events)(struct cpu_hw_events *, int, int *); + unsigned int eventsel; + unsigned int perfctr; + int (*addr_offset)(int, bool); + int (*rdpmc_index)(int); + u64 (*event_map)(int); + int max_events; + int num_counters; + int num_counters_fixed; + int cntval_bits; + u64 cntval_mask; + union { + long unsigned int events_maskl; + long unsigned int events_mask[1]; + }; + int events_mask_len; + int apic; + u64 max_period; + struct event_constraint * (*get_event_constraints)(struct cpu_hw_events *, int, struct perf_event *); + void (*put_event_constraints)(struct cpu_hw_events *, struct perf_event *); + void (*start_scheduling)(struct cpu_hw_events *); + void (*commit_scheduling)(struct cpu_hw_events *, int, int); + void (*stop_scheduling)(struct cpu_hw_events *); + struct event_constraint *event_constraints; + struct x86_pmu_quirk *quirks; + int perfctr_second_write; + u64 (*limit_period)(struct perf_event *, u64); + unsigned int late_ack: 1; + unsigned int enabled_ack: 1; + unsigned int counter_freezing: 1; + int attr_rdpmc_broken; + int attr_rdpmc; + struct attribute **format_attrs; + ssize_t (*events_sysfs_show)(char *, u64); + const struct attribute_group **attr_update; + long unsigned int attr_freeze_on_smi; + int (*cpu_prepare)(int); + void (*cpu_starting)(int); + void (*cpu_dying)(int); + void (*cpu_dead)(int); + void (*check_microcode)(); + void (*sched_task)(struct perf_event_context *, bool); + u64 intel_ctrl; + union perf_capabilities intel_cap; + unsigned int bts: 1; + unsigned int bts_active: 1; + unsigned int pebs: 1; + unsigned int pebs_active: 1; + unsigned int pebs_broken: 1; + unsigned int pebs_prec_dist: 1; + unsigned int pebs_no_tlb: 1; + unsigned int pebs_no_isolation: 1; + int pebs_record_size; + int pebs_buffer_size; + int max_pebs_events; + void (*drain_pebs)(struct pt_regs *, struct perf_sample_data *); + struct event_constraint *pebs_constraints; + void (*pebs_aliases)(struct perf_event *); + long unsigned int large_pebs_flags; + u64 rtm_abort_event; + unsigned int lbr_tos; + unsigned int lbr_from; + unsigned int lbr_to; + unsigned int lbr_info; + unsigned int lbr_nr; + union { + u64 lbr_sel_mask; + u64 lbr_ctl_mask; + }; + union { + const int *lbr_sel_map; + int *lbr_ctl_map; + }; + bool lbr_double_abort; + bool lbr_pt_coexist; + unsigned int lbr_depth_mask: 8; + unsigned int lbr_deep_c_reset: 1; + unsigned int lbr_lip: 1; + unsigned int lbr_cpl: 1; + unsigned int lbr_filter: 1; + unsigned int lbr_call_stack: 1; + unsigned int lbr_mispred: 1; + unsigned int lbr_timed_lbr: 1; + unsigned int lbr_br_type: 1; + void (*lbr_reset)(); + void (*lbr_read)(struct cpu_hw_events *); + void (*lbr_save)(void *); + void (*lbr_restore)(void *); + atomic_t lbr_exclusive[3]; + u64 (*update_topdown_event)(struct perf_event *); + int (*set_topdown_event_period)(struct perf_event *); + void (*swap_task_ctx)(struct perf_event_context *, struct perf_event_context *); + unsigned int amd_nb_constraints: 1; + u64 perf_ctr_pair_en; + struct extra_reg *extra_regs; + unsigned int flags; + struct perf_guest_switch_msr * (*guest_get_msrs)(int *); + int (*check_period)(struct perf_event *, u64); + int (*aux_output_match)(struct perf_event *); +}; + +struct sched_state { + int weight; + int event; + int counter; + int unassigned; + int nr_gp; + u64 used; +}; + +struct perf_sched { + int max_weight; + int max_events; + int max_gp; + int saved_states; + struct event_constraint **constraints; + struct sched_state state; + struct sched_state saved[2]; +}; + +struct perf_msr { + u64 msr; + struct attribute_group *grp; + bool (*test)(int, void *); + bool no_check; +}; + +struct kobj_attribute { + struct attribute attr; + ssize_t (*show)(struct kobject *, struct kobj_attribute *, char *); + ssize_t (*store)(struct kobject *, struct kobj_attribute *, const char *, size_t); +}; + +struct amd_uncore { + int id; + int refcnt; + int cpu; + int num_counters; + int rdpmc_base; + u32 msr_base; + cpumask_t *active_mask; + struct pmu *pmu; + struct perf_event *events[6]; + struct hlist_node node; +}; + +typedef int pci_power_t; + +typedef unsigned int pci_channel_state_t; + +typedef short unsigned int pci_dev_flags_t; + +struct pci_bus; + +struct pci_slot; + +struct aer_stats; + +struct rcec_ea; + +struct pci_driver; + +struct pcie_link_state; + +struct pci_vpd; + +struct pci_sriov; + +struct pci_p2pdma; + +struct pci_dev { + struct list_head bus_list; + struct pci_bus *bus; + struct pci_bus *subordinate; + void *sysdata; + struct proc_dir_entry *procent; + struct pci_slot *slot; + unsigned int devfn; + short unsigned int vendor; + short unsigned int device; + short unsigned int subsystem_vendor; + short unsigned int subsystem_device; + unsigned int class; + u8 revision; + u8 hdr_type; + u16 aer_cap; + struct aer_stats *aer_stats; + struct rcec_ea *rcec_ea; + struct pci_dev *rcec; + u8 pcie_cap; + u8 msi_cap; + u8 msix_cap; + u8 pcie_mpss: 3; + u8 rom_base_reg; + u8 pin; + u16 pcie_flags_reg; + long unsigned int *dma_alias_mask; + struct pci_driver *driver; + u64 dma_mask; + struct device_dma_parameters dma_parms; + pci_power_t current_state; + unsigned int imm_ready: 1; + u8 pm_cap; + unsigned int pme_support: 5; + unsigned int pme_poll: 1; + unsigned int d1_support: 1; + unsigned int d2_support: 1; + unsigned int no_d1d2: 1; + unsigned int no_d3cold: 1; + unsigned int bridge_d3: 1; + unsigned int d3cold_allowed: 1; + unsigned int mmio_always_on: 1; + unsigned int wakeup_prepared: 1; + unsigned int runtime_d3cold: 1; + unsigned int skip_bus_pm: 1; + unsigned int ignore_hotplug: 1; + unsigned int hotplug_user_indicators: 1; + unsigned int clear_retrain_link: 1; + unsigned int d3hot_delay; + unsigned int d3cold_delay; + struct pcie_link_state *link_state; + unsigned int ltr_path: 1; + u16 l1ss; + unsigned int eetlp_prefix_path: 1; + pci_channel_state_t error_state; + struct device dev; + int cfg_size; + unsigned int irq; + struct resource resource[17]; + bool match_driver; + unsigned int transparent: 1; + unsigned int io_window: 1; + unsigned int pref_window: 1; + unsigned int pref_64_window: 1; + unsigned int multifunction: 1; + unsigned int is_busmaster: 1; + unsigned int no_msi: 1; + unsigned int no_64bit_msi: 1; + unsigned int block_cfg_access: 1; + unsigned int broken_parity_status: 1; + unsigned int irq_reroute_variant: 2; + unsigned int msi_enabled: 1; + unsigned int msix_enabled: 1; + unsigned int ari_enabled: 1; + unsigned int ats_enabled: 1; + unsigned int pasid_enabled: 1; + unsigned int pri_enabled: 1; + unsigned int is_managed: 1; + unsigned int needs_freset: 1; + unsigned int state_saved: 1; + unsigned int is_physfn: 1; + unsigned int is_virtfn: 1; + unsigned int reset_fn: 1; + unsigned int is_hotplug_bridge: 1; + unsigned int shpc_managed: 1; + unsigned int is_thunderbolt: 1; + unsigned int untrusted: 1; + unsigned int external_facing: 1; + unsigned int broken_intx_masking: 1; + unsigned int io_window_1k: 1; + unsigned int irq_managed: 1; + unsigned int non_compliant_bars: 1; + unsigned int is_probed: 1; + unsigned int link_active_reporting: 1; + unsigned int no_vf_scan: 1; + unsigned int no_command_memory: 1; + pci_dev_flags_t dev_flags; + atomic_t enable_cnt; + u32 saved_config_space[16]; + struct hlist_head saved_cap_space; + struct bin_attribute *rom_attr; + int rom_attr_enabled; + struct bin_attribute *res_attr[17]; + struct bin_attribute *res_attr_wc[17]; + unsigned int broken_cmd_compl: 1; + unsigned int ptm_root: 1; + unsigned int ptm_enabled: 1; + u8 ptm_granularity; + const struct attribute_group **msi_irq_groups; + struct pci_vpd *vpd; + u16 dpc_cap; + unsigned int dpc_rp_extensions: 1; + u8 dpc_rp_log_size; + union { + struct pci_sriov *sriov; + struct pci_dev *physfn; + }; + u16 ats_cap; + u8 ats_stu; + u16 pri_cap; + u32 pri_reqs_alloc; + unsigned int pasid_required: 1; + u16 pasid_cap; + u16 pasid_features; + struct pci_p2pdma *p2pdma; + u16 acs_cap; + phys_addr_t rom; + size_t romlen; + char *driver_override; + long unsigned int priv_flags; +}; + +struct pci_device_id { + __u32 vendor; + __u32 device; + __u32 subvendor; + __u32 subdevice; + __u32 class; + __u32 class_mask; + kernel_ulong_t driver_data; +}; + +struct hotplug_slot; + +struct pci_slot { + struct pci_bus *bus; + struct list_head list; + struct hotplug_slot *hotplug; + unsigned char number; + struct kobject kobj; +}; + +typedef short unsigned int pci_bus_flags_t; + +struct pci_ops; + +struct msi_controller; + +struct pci_bus { + struct list_head node; + struct pci_bus *parent; + struct list_head children; + struct list_head devices; + struct pci_dev *self; + struct list_head slots; + struct resource *resource[4]; + struct list_head resources; + struct resource busn_res; + struct pci_ops *ops; + struct msi_controller *msi; + void *sysdata; + struct proc_dir_entry *procdir; + unsigned char number; + unsigned char primary; + unsigned char max_bus_speed; + unsigned char cur_bus_speed; + char name[48]; + short unsigned int bridge_ctl; + pci_bus_flags_t bus_flags; + struct device *bridge; + struct device dev; + struct bin_attribute *legacy_io; + struct bin_attribute *legacy_mem; + unsigned int is_added: 1; +}; + +enum { + PCI_STD_RESOURCES = 0, + PCI_STD_RESOURCE_END = 5, + PCI_ROM_RESOURCE = 6, + PCI_IOV_RESOURCES = 7, + PCI_IOV_RESOURCE_END = 12, + PCI_BRIDGE_RESOURCES = 13, + PCI_BRIDGE_RESOURCE_END = 16, + PCI_NUM_RESOURCES = 17, + DEVICE_COUNT_RESOURCE = 17, +}; + +typedef unsigned int pcie_reset_state_t; + +struct pci_dynids { + spinlock_t lock; + struct list_head list; +}; + +struct pci_error_handlers; + +struct pci_driver { + struct list_head node; + const char *name; + const struct pci_device_id *id_table; + int (*probe)(struct pci_dev *, const struct pci_device_id *); + void (*remove)(struct pci_dev *); + int (*suspend)(struct pci_dev *, pm_message_t); + int (*resume)(struct pci_dev *); + void (*shutdown)(struct pci_dev *); + int (*sriov_configure)(struct pci_dev *, int); + const struct pci_error_handlers *err_handler; + const struct attribute_group **groups; + struct device_driver driver; + struct pci_dynids dynids; +}; + +struct pci_ops { + int (*add_bus)(struct pci_bus *); + void (*remove_bus)(struct pci_bus *); + void * (*map_bus)(struct pci_bus *, unsigned int, int); + int (*read)(struct pci_bus *, unsigned int, int, int, u32 *); + int (*write)(struct pci_bus *, unsigned int, int, int, u32); +}; + +typedef unsigned int pci_ers_result_t; + +struct pci_error_handlers { + pci_ers_result_t (*error_detected)(struct pci_dev *, pci_channel_state_t); + pci_ers_result_t (*mmio_enabled)(struct pci_dev *); + pci_ers_result_t (*slot_reset)(struct pci_dev *); + void (*reset_prepare)(struct pci_dev *); + void (*reset_done)(struct pci_dev *); + void (*resume)(struct pci_dev *); +}; + +struct syscore_ops { + struct list_head node; + int (*suspend)(); + void (*resume)(); + void (*shutdown)(); +}; + +enum ibs_states { + IBS_ENABLED = 0, + IBS_STARTED = 1, + IBS_STOPPING = 2, + IBS_STOPPED = 3, + IBS_MAX_STATES = 4, +}; + +struct cpu_perf_ibs { + struct perf_event *event; + long unsigned int state[1]; +}; + +struct perf_ibs { + struct pmu pmu; + unsigned int msr; + u64 config_mask; + u64 cnt_mask; + u64 enable_mask; + u64 valid_mask; + u64 max_period; + long unsigned int offset_mask[1]; + int offset_max; + unsigned int fetch_count_reset_broken: 1; + struct cpu_perf_ibs *pcpu; + struct attribute **format_attrs; + struct attribute_group format_group; + const struct attribute_group *attr_groups[2]; + u64 (*get_count)(u64); +}; + +struct perf_ibs_data { + u32 size; + union { + u32 data[0]; + u32 caps; + }; + u64 regs[8]; +}; + +struct amd_iommu; + +struct perf_amd_iommu { + struct list_head list; + struct pmu pmu; + struct amd_iommu *iommu; + char name[16]; + u8 max_banks; + u8 max_counters; + u64 cntr_assign_mask; + raw_spinlock_t lock; +}; + +struct amd_iommu_event_desc { + struct kobj_attribute attr; + const char *event; +}; + +enum perf_msr_id { + PERF_MSR_TSC = 0, + PERF_MSR_APERF = 1, + PERF_MSR_MPERF = 2, + PERF_MSR_PPERF = 3, + PERF_MSR_SMI = 4, + PERF_MSR_PTSC = 5, + PERF_MSR_IRPERF = 6, + PERF_MSR_THERM = 7, + PERF_MSR_EVENT_MAX = 8, +}; + +struct x86_cpu_desc { + u8 x86_family; + u8 x86_vendor; + u8 x86_model; + u8 x86_stepping; + u32 x86_microcode_rev; +}; + +union cpuid10_eax { + struct { + unsigned int version_id: 8; + unsigned int num_counters: 8; + unsigned int bit_width: 8; + unsigned int mask_length: 8; + } split; + unsigned int full; +}; + +union cpuid10_ebx { + struct { + unsigned int no_unhalted_core_cycles: 1; + unsigned int no_instructions_retired: 1; + unsigned int no_unhalted_reference_cycles: 1; + unsigned int no_llc_reference: 1; + unsigned int no_llc_misses: 1; + unsigned int no_branch_instruction_retired: 1; + unsigned int no_branch_misses_retired: 1; + } split; + unsigned int full; +}; + +union cpuid10_edx { + struct { + unsigned int num_counters_fixed: 5; + unsigned int bit_width_fixed: 8; + unsigned int reserved1: 2; + unsigned int anythread_deprecated: 1; + unsigned int reserved2: 16; + } split; + unsigned int full; +}; + +enum { + LBR_FORMAT_32 = 0, + LBR_FORMAT_LIP = 1, + LBR_FORMAT_EIP = 2, + LBR_FORMAT_EIP_FLAGS = 3, + LBR_FORMAT_EIP_FLAGS2 = 4, + LBR_FORMAT_INFO = 5, + LBR_FORMAT_TIME = 6, + LBR_FORMAT_MAX_KNOWN = 6, +}; + +union x86_pmu_config { + struct { + u64 event: 8; + u64 umask: 8; + u64 usr: 1; + u64 os: 1; + u64 edge: 1; + u64 pc: 1; + u64 interrupt: 1; + u64 __reserved1: 1; + u64 en: 1; + u64 inv: 1; + u64 cmask: 8; + u64 event2: 4; + u64 __reserved2: 4; + u64 go: 1; + u64 ho: 1; + } bits; + u64 value; +}; + +enum pageflags { + PG_locked = 0, + PG_referenced = 1, + PG_uptodate = 2, + PG_dirty = 3, + PG_lru = 4, + PG_active = 5, + PG_workingset = 6, + PG_waiters = 7, + PG_error = 8, + PG_slab = 9, + PG_owner_priv_1 = 10, + PG_arch_1 = 11, + PG_reserved = 12, + PG_private = 13, + PG_private_2 = 14, + PG_writeback = 15, + PG_head = 16, + PG_mappedtodisk = 17, + PG_reclaim = 18, + PG_swapbacked = 19, + PG_unevictable = 20, + PG_mlocked = 21, + PG_uncached = 22, + PG_hwpoison = 23, + PG_arch_2 = 24, + __NR_PAGEFLAGS = 25, + PG_checked = 10, + PG_swapcache = 10, + PG_fscache = 14, + PG_pinned = 10, + PG_savepinned = 3, + PG_foreign = 10, + PG_xen_remapped = 10, + PG_slob_free = 13, + PG_double_map = 6, + PG_isolated = 18, + PG_reported = 2, +}; + +struct bts_ctx { + struct perf_output_handle handle; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct debug_store ds_back; + int state; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum { + BTS_STATE_STOPPED = 0, + BTS_STATE_INACTIVE = 1, + BTS_STATE_ACTIVE = 2, +}; + +struct bts_phys { + struct page *page; + long unsigned int size; + long unsigned int offset; + long unsigned int displacement; +}; + +struct bts_buffer { + size_t real_size; + unsigned int nr_pages; + unsigned int nr_bufs; + unsigned int cur_buf; + bool snapshot; + local_t data_size; + local_t head; + long unsigned int end; + void **data_pages; + struct bts_phys buf[0]; +}; + +struct lbr_entry { + u64 from; + u64 to; + u64 info; +}; + +struct x86_hw_tss { + u32 reserved1; + u64 sp0; + u64 sp1; + u64 sp2; + u64 reserved2; + u64 ist[7]; + u32 reserved3; + u32 reserved4; + u16 reserved5; + u16 io_bitmap_base; +} __attribute__((packed)); + +struct entry_stack { + char stack[4096]; +}; + +struct entry_stack_page { + struct entry_stack stack; +}; + +struct x86_io_bitmap { + u64 prev_sequence; + unsigned int prev_max; + long unsigned int bitmap[1025]; + long unsigned int mapall[1025]; +}; + +struct tss_struct { + struct x86_hw_tss x86_tss; + struct x86_io_bitmap io_bitmap; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct debug_store_buffers { + char bts_buffer[65536]; + char pebs_buffer[65536]; +}; + +struct cea_exception_stacks { + char DF_stack_guard[4096]; + char DF_stack[4096]; + char NMI_stack_guard[4096]; + char NMI_stack[4096]; + char DB_stack_guard[4096]; + char DB_stack[4096]; + char MCE_stack_guard[4096]; + char MCE_stack[4096]; + char VC_stack_guard[4096]; + char VC_stack[4096]; + char VC2_stack_guard[4096]; + char VC2_stack[4096]; + char IST_top_guard[4096]; +}; + +struct cpu_entry_area { + char gdt[4096]; + struct entry_stack_page entry_stack_page; + struct tss_struct tss; + struct cea_exception_stacks estacks; + struct debug_store cpu_debug_store; + struct debug_store_buffers cpu_debug_buffers; +}; + +struct pebs_basic { + u64 format_size; + u64 ip; + u64 applicable_counters; + u64 tsc; +}; + +struct pebs_meminfo { + u64 address; + u64 aux; + u64 latency; + u64 tsx_tuning; +}; + +struct pebs_gprs { + u64 flags; + u64 ip; + u64 ax; + u64 cx; + u64 dx; + u64 bx; + u64 sp; + u64 bp; + u64 si; + u64 di; + u64 r8; + u64 r9; + u64 r10; + u64 r11; + u64 r12; + u64 r13; + u64 r14; + u64 r15; +}; + +struct pebs_xmm { + u64 xmm[32]; +}; + +struct x86_perf_regs { + struct pt_regs regs; + u64 *xmm_regs; +}; + +typedef unsigned int insn_attr_t; + +typedef unsigned char insn_byte_t; + +typedef int insn_value_t; + +struct insn_field { + union { + insn_value_t value; + insn_byte_t bytes[4]; + }; + unsigned char got; + unsigned char nbytes; +}; + +struct insn { + struct insn_field prefixes; + struct insn_field rex_prefix; + struct insn_field vex_prefix; + struct insn_field opcode; + struct insn_field modrm; + struct insn_field sib; + struct insn_field displacement; + union { + struct insn_field immediate; + struct insn_field moffset1; + struct insn_field immediate1; + }; + union { + struct insn_field moffset2; + struct insn_field immediate2; + }; + int emulate_prefix_size; + insn_attr_t attr; + unsigned char opnd_bytes; + unsigned char addr_bytes; + unsigned char length; + unsigned char x86_64; + const insn_byte_t *kaddr; + const insn_byte_t *end_kaddr; + const insn_byte_t *next_byte; +}; + +enum { + PERF_TXN_ELISION = 1, + PERF_TXN_TRANSACTION = 2, + PERF_TXN_SYNC = 4, + PERF_TXN_ASYNC = 8, + PERF_TXN_RETRY = 16, + PERF_TXN_CONFLICT = 32, + PERF_TXN_CAPACITY_WRITE = 64, + PERF_TXN_CAPACITY_READ = 128, + PERF_TXN_MAX = 256, + PERF_TXN_ABORT_MASK = 0, + PERF_TXN_ABORT_SHIFT = 32, +}; + +struct perf_event_header { + __u32 type; + __u16 misc; + __u16 size; +}; + +union intel_x86_pebs_dse { + u64 val; + struct { + unsigned int ld_dse: 4; + unsigned int ld_stlb_miss: 1; + unsigned int ld_locked: 1; + unsigned int ld_reserved: 26; + }; + struct { + unsigned int st_l1d_hit: 1; + unsigned int st_reserved1: 3; + unsigned int st_stlb_miss: 1; + unsigned int st_locked: 1; + unsigned int st_reserved2: 26; + }; +}; + +struct pebs_record_core { + u64 flags; + u64 ip; + u64 ax; + u64 bx; + u64 cx; + u64 dx; + u64 si; + u64 di; + u64 bp; + u64 sp; + u64 r8; + u64 r9; + u64 r10; + u64 r11; + u64 r12; + u64 r13; + u64 r14; + u64 r15; +}; + +struct pebs_record_nhm { + u64 flags; + u64 ip; + u64 ax; + u64 bx; + u64 cx; + u64 dx; + u64 si; + u64 di; + u64 bp; + u64 sp; + u64 r8; + u64 r9; + u64 r10; + u64 r11; + u64 r12; + u64 r13; + u64 r14; + u64 r15; + u64 status; + u64 dla; + u64 dse; + u64 lat; +}; + +union hsw_tsx_tuning { + struct { + u32 cycles_last_block: 32; + u32 hle_abort: 1; + u32 rtm_abort: 1; + u32 instruction_abort: 1; + u32 non_instruction_abort: 1; + u32 retry: 1; + u32 data_conflict: 1; + u32 capacity_writes: 1; + u32 capacity_reads: 1; + }; + u64 value; +}; + +struct pebs_record_skl { + u64 flags; + u64 ip; + u64 ax; + u64 bx; + u64 cx; + u64 dx; + u64 si; + u64 di; + u64 bp; + u64 sp; + u64 r8; + u64 r9; + u64 r10; + u64 r11; + u64 r12; + u64 r13; + u64 r14; + u64 r15; + u64 status; + u64 dla; + u64 dse; + u64 lat; + u64 real_ip; + u64 tsx_tuning; + u64 tsc; +}; + +struct bts_record { + u64 from; + u64 to; + u64 flags; +}; + +enum { + PERF_BR_UNKNOWN = 0, + PERF_BR_COND = 1, + PERF_BR_UNCOND = 2, + PERF_BR_IND = 3, + PERF_BR_CALL = 4, + PERF_BR_IND_CALL = 5, + PERF_BR_RET = 6, + PERF_BR_SYSCALL = 7, + PERF_BR_SYSRET = 8, + PERF_BR_COND_CALL = 9, + PERF_BR_COND_RET = 10, + PERF_BR_MAX = 11, +}; + +enum xfeature { + XFEATURE_FP = 0, + XFEATURE_SSE = 1, + XFEATURE_YMM = 2, + XFEATURE_BNDREGS = 3, + XFEATURE_BNDCSR = 4, + XFEATURE_OPMASK = 5, + XFEATURE_ZMM_Hi256 = 6, + XFEATURE_Hi16_ZMM = 7, + XFEATURE_PT_UNIMPLEMENTED_SO_FAR = 8, + XFEATURE_PKRU = 9, + XFEATURE_PASID = 10, + XFEATURE_RSRVD_COMP_11 = 11, + XFEATURE_RSRVD_COMP_12 = 12, + XFEATURE_RSRVD_COMP_13 = 13, + XFEATURE_RSRVD_COMP_14 = 14, + XFEATURE_LBR = 15, + XFEATURE_MAX = 16, +}; + +struct arch_lbr_state { + u64 lbr_ctl; + u64 lbr_depth; + u64 ler_from; + u64 ler_to; + u64 ler_info; + struct lbr_entry entries[0]; +}; + +union cpuid28_eax { + struct { + unsigned int lbr_depth_mask: 8; + unsigned int reserved: 22; + unsigned int lbr_deep_c_reset: 1; + unsigned int lbr_lip: 1; + } split; + unsigned int full; +}; + +union cpuid28_ebx { + struct { + unsigned int lbr_cpl: 1; + unsigned int lbr_filter: 1; + unsigned int lbr_call_stack: 1; + } split; + unsigned int full; +}; + +union cpuid28_ecx { + struct { + unsigned int lbr_mispred: 1; + unsigned int lbr_timed_lbr: 1; + unsigned int lbr_br_type: 1; + } split; + unsigned int full; +}; + +struct x86_pmu_lbr { + unsigned int nr; + unsigned int from; + unsigned int to; + unsigned int info; +}; + +struct x86_perf_task_context_opt { + int lbr_callstack_users; + int lbr_stack_state; + int log_id; +}; + +struct x86_perf_task_context { + u64 lbr_sel; + int tos; + int valid_lbrs; + struct x86_perf_task_context_opt opt; + struct lbr_entry lbr[32]; +}; + +struct x86_perf_task_context_arch_lbr { + struct x86_perf_task_context_opt opt; + struct lbr_entry entries[0]; +}; + +struct x86_perf_task_context_arch_lbr_xsave { + struct x86_perf_task_context_opt opt; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + union { + struct xregs_state xsave; + struct { + struct fxregs_state i387; + struct xstate_header header; + struct arch_lbr_state lbr; + long: 64; + long: 64; + long: 64; + }; + }; +}; + +enum { + X86_BR_NONE = 0, + X86_BR_USER = 1, + X86_BR_KERNEL = 2, + X86_BR_CALL = 4, + X86_BR_RET = 8, + X86_BR_SYSCALL = 16, + X86_BR_SYSRET = 32, + X86_BR_INT = 64, + X86_BR_IRET = 128, + X86_BR_JCC = 256, + X86_BR_JMP = 512, + X86_BR_IRQ = 1024, + X86_BR_IND_CALL = 2048, + X86_BR_ABORT = 4096, + X86_BR_IN_TX = 8192, + X86_BR_NO_TX = 16384, + X86_BR_ZERO_CALL = 32768, + X86_BR_CALL_STACK = 65536, + X86_BR_IND_JMP = 131072, + X86_BR_TYPE_SAVE = 262144, +}; + +enum { + LBR_NONE = 0, + LBR_VALID = 1, +}; + +enum { + ARCH_LBR_BR_TYPE_JCC = 0, + ARCH_LBR_BR_TYPE_NEAR_IND_JMP = 1, + ARCH_LBR_BR_TYPE_NEAR_REL_JMP = 2, + ARCH_LBR_BR_TYPE_NEAR_IND_CALL = 3, + ARCH_LBR_BR_TYPE_NEAR_REL_CALL = 4, + ARCH_LBR_BR_TYPE_NEAR_RET = 5, + ARCH_LBR_BR_TYPE_KNOWN_MAX = 5, + ARCH_LBR_BR_TYPE_MAP_MAX = 16, +}; + +enum P4_EVENTS { + P4_EVENT_TC_DELIVER_MODE = 0, + P4_EVENT_BPU_FETCH_REQUEST = 1, + P4_EVENT_ITLB_REFERENCE = 2, + P4_EVENT_MEMORY_CANCEL = 3, + P4_EVENT_MEMORY_COMPLETE = 4, + P4_EVENT_LOAD_PORT_REPLAY = 5, + P4_EVENT_STORE_PORT_REPLAY = 6, + P4_EVENT_MOB_LOAD_REPLAY = 7, + P4_EVENT_PAGE_WALK_TYPE = 8, + P4_EVENT_BSQ_CACHE_REFERENCE = 9, + P4_EVENT_IOQ_ALLOCATION = 10, + P4_EVENT_IOQ_ACTIVE_ENTRIES = 11, + P4_EVENT_FSB_DATA_ACTIVITY = 12, + P4_EVENT_BSQ_ALLOCATION = 13, + P4_EVENT_BSQ_ACTIVE_ENTRIES = 14, + P4_EVENT_SSE_INPUT_ASSIST = 15, + P4_EVENT_PACKED_SP_UOP = 16, + P4_EVENT_PACKED_DP_UOP = 17, + P4_EVENT_SCALAR_SP_UOP = 18, + P4_EVENT_SCALAR_DP_UOP = 19, + P4_EVENT_64BIT_MMX_UOP = 20, + P4_EVENT_128BIT_MMX_UOP = 21, + P4_EVENT_X87_FP_UOP = 22, + P4_EVENT_TC_MISC = 23, + P4_EVENT_GLOBAL_POWER_EVENTS = 24, + P4_EVENT_TC_MS_XFER = 25, + P4_EVENT_UOP_QUEUE_WRITES = 26, + P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE = 27, + P4_EVENT_RETIRED_BRANCH_TYPE = 28, + P4_EVENT_RESOURCE_STALL = 29, + P4_EVENT_WC_BUFFER = 30, + P4_EVENT_B2B_CYCLES = 31, + P4_EVENT_BNR = 32, + P4_EVENT_SNOOP = 33, + P4_EVENT_RESPONSE = 34, + P4_EVENT_FRONT_END_EVENT = 35, + P4_EVENT_EXECUTION_EVENT = 36, + P4_EVENT_REPLAY_EVENT = 37, + P4_EVENT_INSTR_RETIRED = 38, + P4_EVENT_UOPS_RETIRED = 39, + P4_EVENT_UOP_TYPE = 40, + P4_EVENT_BRANCH_RETIRED = 41, + P4_EVENT_MISPRED_BRANCH_RETIRED = 42, + P4_EVENT_X87_ASSIST = 43, + P4_EVENT_MACHINE_CLEAR = 44, + P4_EVENT_INSTR_COMPLETED = 45, +}; + +enum P4_EVENT_OPCODES { + P4_EVENT_TC_DELIVER_MODE_OPCODE = 257, + P4_EVENT_BPU_FETCH_REQUEST_OPCODE = 768, + P4_EVENT_ITLB_REFERENCE_OPCODE = 6147, + P4_EVENT_MEMORY_CANCEL_OPCODE = 517, + P4_EVENT_MEMORY_COMPLETE_OPCODE = 2050, + P4_EVENT_LOAD_PORT_REPLAY_OPCODE = 1026, + P4_EVENT_STORE_PORT_REPLAY_OPCODE = 1282, + P4_EVENT_MOB_LOAD_REPLAY_OPCODE = 770, + P4_EVENT_PAGE_WALK_TYPE_OPCODE = 260, + P4_EVENT_BSQ_CACHE_REFERENCE_OPCODE = 3079, + P4_EVENT_IOQ_ALLOCATION_OPCODE = 774, + P4_EVENT_IOQ_ACTIVE_ENTRIES_OPCODE = 6662, + P4_EVENT_FSB_DATA_ACTIVITY_OPCODE = 5894, + P4_EVENT_BSQ_ALLOCATION_OPCODE = 1287, + P4_EVENT_BSQ_ACTIVE_ENTRIES_OPCODE = 1543, + P4_EVENT_SSE_INPUT_ASSIST_OPCODE = 13313, + P4_EVENT_PACKED_SP_UOP_OPCODE = 2049, + P4_EVENT_PACKED_DP_UOP_OPCODE = 3073, + P4_EVENT_SCALAR_SP_UOP_OPCODE = 2561, + P4_EVENT_SCALAR_DP_UOP_OPCODE = 3585, + P4_EVENT_64BIT_MMX_UOP_OPCODE = 513, + P4_EVENT_128BIT_MMX_UOP_OPCODE = 6657, + P4_EVENT_X87_FP_UOP_OPCODE = 1025, + P4_EVENT_TC_MISC_OPCODE = 1537, + P4_EVENT_GLOBAL_POWER_EVENTS_OPCODE = 4870, + P4_EVENT_TC_MS_XFER_OPCODE = 1280, + P4_EVENT_UOP_QUEUE_WRITES_OPCODE = 2304, + P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE_OPCODE = 1282, + P4_EVENT_RETIRED_BRANCH_TYPE_OPCODE = 1026, + P4_EVENT_RESOURCE_STALL_OPCODE = 257, + P4_EVENT_WC_BUFFER_OPCODE = 1285, + P4_EVENT_B2B_CYCLES_OPCODE = 5635, + P4_EVENT_BNR_OPCODE = 2051, + P4_EVENT_SNOOP_OPCODE = 1539, + P4_EVENT_RESPONSE_OPCODE = 1027, + P4_EVENT_FRONT_END_EVENT_OPCODE = 2053, + P4_EVENT_EXECUTION_EVENT_OPCODE = 3077, + P4_EVENT_REPLAY_EVENT_OPCODE = 2309, + P4_EVENT_INSTR_RETIRED_OPCODE = 516, + P4_EVENT_UOPS_RETIRED_OPCODE = 260, + P4_EVENT_UOP_TYPE_OPCODE = 514, + P4_EVENT_BRANCH_RETIRED_OPCODE = 1541, + P4_EVENT_MISPRED_BRANCH_RETIRED_OPCODE = 772, + P4_EVENT_X87_ASSIST_OPCODE = 773, + P4_EVENT_MACHINE_CLEAR_OPCODE = 517, + P4_EVENT_INSTR_COMPLETED_OPCODE = 1796, +}; + +enum P4_ESCR_EMASKS { + P4_EVENT_TC_DELIVER_MODE__DD = 512, + P4_EVENT_TC_DELIVER_MODE__DB = 1024, + P4_EVENT_TC_DELIVER_MODE__DI = 2048, + P4_EVENT_TC_DELIVER_MODE__BD = 4096, + P4_EVENT_TC_DELIVER_MODE__BB = 8192, + P4_EVENT_TC_DELIVER_MODE__BI = 16384, + P4_EVENT_TC_DELIVER_MODE__ID = 32768, + P4_EVENT_BPU_FETCH_REQUEST__TCMISS = 512, + P4_EVENT_ITLB_REFERENCE__HIT = 512, + P4_EVENT_ITLB_REFERENCE__MISS = 1024, + P4_EVENT_ITLB_REFERENCE__HIT_UK = 2048, + P4_EVENT_MEMORY_CANCEL__ST_RB_FULL = 2048, + P4_EVENT_MEMORY_CANCEL__64K_CONF = 4096, + P4_EVENT_MEMORY_COMPLETE__LSC = 512, + P4_EVENT_MEMORY_COMPLETE__SSC = 1024, + P4_EVENT_LOAD_PORT_REPLAY__SPLIT_LD = 1024, + P4_EVENT_STORE_PORT_REPLAY__SPLIT_ST = 1024, + P4_EVENT_MOB_LOAD_REPLAY__NO_STA = 1024, + P4_EVENT_MOB_LOAD_REPLAY__NO_STD = 4096, + P4_EVENT_MOB_LOAD_REPLAY__PARTIAL_DATA = 8192, + P4_EVENT_MOB_LOAD_REPLAY__UNALGN_ADDR = 16384, + P4_EVENT_PAGE_WALK_TYPE__DTMISS = 512, + P4_EVENT_PAGE_WALK_TYPE__ITMISS = 1024, + P4_EVENT_BSQ_CACHE_REFERENCE__RD_2ndL_HITS = 512, + P4_EVENT_BSQ_CACHE_REFERENCE__RD_2ndL_HITE = 1024, + P4_EVENT_BSQ_CACHE_REFERENCE__RD_2ndL_HITM = 2048, + P4_EVENT_BSQ_CACHE_REFERENCE__RD_3rdL_HITS = 4096, + P4_EVENT_BSQ_CACHE_REFERENCE__RD_3rdL_HITE = 8192, + P4_EVENT_BSQ_CACHE_REFERENCE__RD_3rdL_HITM = 16384, + P4_EVENT_BSQ_CACHE_REFERENCE__RD_2ndL_MISS = 131072, + P4_EVENT_BSQ_CACHE_REFERENCE__RD_3rdL_MISS = 262144, + P4_EVENT_BSQ_CACHE_REFERENCE__WR_2ndL_MISS = 524288, + P4_EVENT_IOQ_ALLOCATION__DEFAULT = 512, + P4_EVENT_IOQ_ALLOCATION__ALL_READ = 16384, + P4_EVENT_IOQ_ALLOCATION__ALL_WRITE = 32768, + P4_EVENT_IOQ_ALLOCATION__MEM_UC = 65536, + P4_EVENT_IOQ_ALLOCATION__MEM_WC = 131072, + P4_EVENT_IOQ_ALLOCATION__MEM_WT = 262144, + P4_EVENT_IOQ_ALLOCATION__MEM_WP = 524288, + P4_EVENT_IOQ_ALLOCATION__MEM_WB = 1048576, + P4_EVENT_IOQ_ALLOCATION__OWN = 4194304, + P4_EVENT_IOQ_ALLOCATION__OTHER = 8388608, + P4_EVENT_IOQ_ALLOCATION__PREFETCH = 16777216, + P4_EVENT_IOQ_ACTIVE_ENTRIES__DEFAULT = 512, + P4_EVENT_IOQ_ACTIVE_ENTRIES__ALL_READ = 16384, + P4_EVENT_IOQ_ACTIVE_ENTRIES__ALL_WRITE = 32768, + P4_EVENT_IOQ_ACTIVE_ENTRIES__MEM_UC = 65536, + P4_EVENT_IOQ_ACTIVE_ENTRIES__MEM_WC = 131072, + P4_EVENT_IOQ_ACTIVE_ENTRIES__MEM_WT = 262144, + P4_EVENT_IOQ_ACTIVE_ENTRIES__MEM_WP = 524288, + P4_EVENT_IOQ_ACTIVE_ENTRIES__MEM_WB = 1048576, + P4_EVENT_IOQ_ACTIVE_ENTRIES__OWN = 4194304, + P4_EVENT_IOQ_ACTIVE_ENTRIES__OTHER = 8388608, + P4_EVENT_IOQ_ACTIVE_ENTRIES__PREFETCH = 16777216, + P4_EVENT_FSB_DATA_ACTIVITY__DRDY_DRV = 512, + P4_EVENT_FSB_DATA_ACTIVITY__DRDY_OWN = 1024, + P4_EVENT_FSB_DATA_ACTIVITY__DRDY_OTHER = 2048, + P4_EVENT_FSB_DATA_ACTIVITY__DBSY_DRV = 4096, + P4_EVENT_FSB_DATA_ACTIVITY__DBSY_OWN = 8192, + P4_EVENT_FSB_DATA_ACTIVITY__DBSY_OTHER = 16384, + P4_EVENT_BSQ_ALLOCATION__REQ_TYPE0 = 512, + P4_EVENT_BSQ_ALLOCATION__REQ_TYPE1 = 1024, + P4_EVENT_BSQ_ALLOCATION__REQ_LEN0 = 2048, + P4_EVENT_BSQ_ALLOCATION__REQ_LEN1 = 4096, + P4_EVENT_BSQ_ALLOCATION__REQ_IO_TYPE = 16384, + P4_EVENT_BSQ_ALLOCATION__REQ_LOCK_TYPE = 32768, + P4_EVENT_BSQ_ALLOCATION__REQ_CACHE_TYPE = 65536, + P4_EVENT_BSQ_ALLOCATION__REQ_SPLIT_TYPE = 131072, + P4_EVENT_BSQ_ALLOCATION__REQ_DEM_TYPE = 262144, + P4_EVENT_BSQ_ALLOCATION__REQ_ORD_TYPE = 524288, + P4_EVENT_BSQ_ALLOCATION__MEM_TYPE0 = 1048576, + P4_EVENT_BSQ_ALLOCATION__MEM_TYPE1 = 2097152, + P4_EVENT_BSQ_ALLOCATION__MEM_TYPE2 = 4194304, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_TYPE0 = 512, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_TYPE1 = 1024, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_LEN0 = 2048, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_LEN1 = 4096, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_IO_TYPE = 16384, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_LOCK_TYPE = 32768, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_CACHE_TYPE = 65536, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_SPLIT_TYPE = 131072, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_DEM_TYPE = 262144, + P4_EVENT_BSQ_ACTIVE_ENTRIES__REQ_ORD_TYPE = 524288, + P4_EVENT_BSQ_ACTIVE_ENTRIES__MEM_TYPE0 = 1048576, + P4_EVENT_BSQ_ACTIVE_ENTRIES__MEM_TYPE1 = 2097152, + P4_EVENT_BSQ_ACTIVE_ENTRIES__MEM_TYPE2 = 4194304, + P4_EVENT_SSE_INPUT_ASSIST__ALL = 16777216, + P4_EVENT_PACKED_SP_UOP__ALL = 16777216, + P4_EVENT_PACKED_DP_UOP__ALL = 16777216, + P4_EVENT_SCALAR_SP_UOP__ALL = 16777216, + P4_EVENT_SCALAR_DP_UOP__ALL = 16777216, + P4_EVENT_64BIT_MMX_UOP__ALL = 16777216, + P4_EVENT_128BIT_MMX_UOP__ALL = 16777216, + P4_EVENT_X87_FP_UOP__ALL = 16777216, + P4_EVENT_TC_MISC__FLUSH = 8192, + P4_EVENT_GLOBAL_POWER_EVENTS__RUNNING = 512, + P4_EVENT_TC_MS_XFER__CISC = 512, + P4_EVENT_UOP_QUEUE_WRITES__FROM_TC_BUILD = 512, + P4_EVENT_UOP_QUEUE_WRITES__FROM_TC_DELIVER = 1024, + P4_EVENT_UOP_QUEUE_WRITES__FROM_ROM = 2048, + P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE__CONDITIONAL = 1024, + P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE__CALL = 2048, + P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE__RETURN = 4096, + P4_EVENT_RETIRED_MISPRED_BRANCH_TYPE__INDIRECT = 8192, + P4_EVENT_RETIRED_BRANCH_TYPE__CONDITIONAL = 1024, + P4_EVENT_RETIRED_BRANCH_TYPE__CALL = 2048, + P4_EVENT_RETIRED_BRANCH_TYPE__RETURN = 4096, + P4_EVENT_RETIRED_BRANCH_TYPE__INDIRECT = 8192, + P4_EVENT_RESOURCE_STALL__SBFULL = 16384, + P4_EVENT_WC_BUFFER__WCB_EVICTS = 512, + P4_EVENT_WC_BUFFER__WCB_FULL_EVICTS = 1024, + P4_EVENT_FRONT_END_EVENT__NBOGUS = 512, + P4_EVENT_FRONT_END_EVENT__BOGUS = 1024, + P4_EVENT_EXECUTION_EVENT__NBOGUS0 = 512, + P4_EVENT_EXECUTION_EVENT__NBOGUS1 = 1024, + P4_EVENT_EXECUTION_EVENT__NBOGUS2 = 2048, + P4_EVENT_EXECUTION_EVENT__NBOGUS3 = 4096, + P4_EVENT_EXECUTION_EVENT__BOGUS0 = 8192, + P4_EVENT_EXECUTION_EVENT__BOGUS1 = 16384, + P4_EVENT_EXECUTION_EVENT__BOGUS2 = 32768, + P4_EVENT_EXECUTION_EVENT__BOGUS3 = 65536, + P4_EVENT_REPLAY_EVENT__NBOGUS = 512, + P4_EVENT_REPLAY_EVENT__BOGUS = 1024, + P4_EVENT_INSTR_RETIRED__NBOGUSNTAG = 512, + P4_EVENT_INSTR_RETIRED__NBOGUSTAG = 1024, + P4_EVENT_INSTR_RETIRED__BOGUSNTAG = 2048, + P4_EVENT_INSTR_RETIRED__BOGUSTAG = 4096, + P4_EVENT_UOPS_RETIRED__NBOGUS = 512, + P4_EVENT_UOPS_RETIRED__BOGUS = 1024, + P4_EVENT_UOP_TYPE__TAGLOADS = 1024, + P4_EVENT_UOP_TYPE__TAGSTORES = 2048, + P4_EVENT_BRANCH_RETIRED__MMNP = 512, + P4_EVENT_BRANCH_RETIRED__MMNM = 1024, + P4_EVENT_BRANCH_RETIRED__MMTP = 2048, + P4_EVENT_BRANCH_RETIRED__MMTM = 4096, + P4_EVENT_MISPRED_BRANCH_RETIRED__NBOGUS = 512, + P4_EVENT_X87_ASSIST__FPSU = 512, + P4_EVENT_X87_ASSIST__FPSO = 1024, + P4_EVENT_X87_ASSIST__POAO = 2048, + P4_EVENT_X87_ASSIST__POAU = 4096, + P4_EVENT_X87_ASSIST__PREA = 8192, + P4_EVENT_MACHINE_CLEAR__CLEAR = 512, + P4_EVENT_MACHINE_CLEAR__MOCLEAR = 1024, + P4_EVENT_MACHINE_CLEAR__SMCLEAR = 2048, + P4_EVENT_INSTR_COMPLETED__NBOGUS = 512, + P4_EVENT_INSTR_COMPLETED__BOGUS = 1024, +}; + +enum P4_PEBS_METRIC { + P4_PEBS_METRIC__none = 0, + P4_PEBS_METRIC__1stl_cache_load_miss_retired = 1, + P4_PEBS_METRIC__2ndl_cache_load_miss_retired = 2, + P4_PEBS_METRIC__dtlb_load_miss_retired = 3, + P4_PEBS_METRIC__dtlb_store_miss_retired = 4, + P4_PEBS_METRIC__dtlb_all_miss_retired = 5, + P4_PEBS_METRIC__tagged_mispred_branch = 6, + P4_PEBS_METRIC__mob_load_replay_retired = 7, + P4_PEBS_METRIC__split_load_retired = 8, + P4_PEBS_METRIC__split_store_retired = 9, + P4_PEBS_METRIC__max = 10, +}; + +struct p4_event_bind { + unsigned int opcode; + unsigned int escr_msr[2]; + unsigned int escr_emask; + unsigned int shared; + char cntr[6]; +}; + +struct p4_pebs_bind { + unsigned int metric_pebs; + unsigned int metric_vert; +}; + +struct p4_event_alias { + u64 original; + u64 alternative; +}; + +enum cpuid_regs_idx { + CPUID_EAX = 0, + CPUID_EBX = 1, + CPUID_ECX = 2, + CPUID_EDX = 3, +}; + +struct dev_ext_attribute { + struct device_attribute attr; + void *var; +}; + +enum pt_capabilities { + PT_CAP_max_subleaf = 0, + PT_CAP_cr3_filtering = 1, + PT_CAP_psb_cyc = 2, + PT_CAP_ip_filtering = 3, + PT_CAP_mtc = 4, + PT_CAP_ptwrite = 5, + PT_CAP_power_event_trace = 6, + PT_CAP_topa_output = 7, + PT_CAP_topa_multiple_entries = 8, + PT_CAP_single_range_output = 9, + PT_CAP_output_subsys = 10, + PT_CAP_payloads_lip = 11, + PT_CAP_num_address_ranges = 12, + PT_CAP_mtc_periods = 13, + PT_CAP_cycle_thresholds = 14, + PT_CAP_psb_periods = 15, +}; + +enum perf_addr_filter_action_t { + PERF_ADDR_FILTER_ACTION_STOP = 0, + PERF_ADDR_FILTER_ACTION_START = 1, + PERF_ADDR_FILTER_ACTION_FILTER = 2, +}; + +struct perf_addr_filter { + struct list_head entry; + struct path path; + long unsigned int offset; + long unsigned int size; + enum perf_addr_filter_action_t action; +}; + +struct topa_entry { + u64 end: 1; + u64 rsvd0: 1; + u64 intr: 1; + u64 rsvd1: 1; + u64 stop: 1; + u64 rsvd2: 1; + u64 size: 4; + u64 rsvd3: 2; + u64 base: 36; + u64 rsvd4: 16; +}; + +struct pt_pmu { + struct pmu pmu; + u32 caps[8]; + bool vmx; + bool branch_en_always_on; + long unsigned int max_nonturbo_ratio; + unsigned int tsc_art_num; + unsigned int tsc_art_den; +}; + +struct topa; + +struct pt_buffer { + struct list_head tables; + struct topa *first; + struct topa *last; + struct topa *cur; + unsigned int cur_idx; + size_t output_off; + long unsigned int nr_pages; + local_t data_size; + local64_t head; + bool snapshot; + bool single; + long int stop_pos; + long int intr_pos; + struct topa_entry *stop_te; + struct topa_entry *intr_te; + void **data_pages; +}; + +struct topa { + struct list_head list; + u64 offset; + size_t size; + int last; + unsigned int z_count; +}; + +struct pt_filter { + long unsigned int msr_a; + long unsigned int msr_b; + long unsigned int config; +}; + +struct pt_filters { + struct pt_filter filter[4]; + unsigned int nr_filters; +}; + +struct pt { + struct perf_output_handle handle; + struct pt_filters filters; + int handle_nmi; + int vmx_on; + u64 output_base; + u64 output_mask; +}; + +struct pt_cap_desc { + const char *name; + u32 leaf; + u8 reg; + u32 mask; +}; + +struct pt_address_range { + long unsigned int msr_a; + long unsigned int msr_b; + unsigned int reg_off; +}; + +struct topa_page { + struct topa_entry table[507]; + struct topa topa; +}; + +typedef s8 int8_t; + +typedef u8 uint8_t; + +typedef u64 uint64_t; + +struct atomic_notifier_head { + spinlock_t lock; + struct notifier_block *head; +}; + +enum xen_domain_type { + XEN_NATIVE = 0, + XEN_PV_DOMAIN = 1, + XEN_HVM_DOMAIN = 2, +}; + +typedef long unsigned int xen_pfn_t; + +typedef long unsigned int xen_ulong_t; + +struct arch_shared_info { + long unsigned int max_pfn; + xen_pfn_t pfn_to_mfn_frame_list_list; + long unsigned int nmi_reason; + long unsigned int p2m_cr3; + long unsigned int p2m_vaddr; + long unsigned int p2m_generation; +}; + +struct arch_vcpu_info { + long unsigned int cr2; + long unsigned int pad; +}; + +struct pvclock_wall_clock { + u32 version; + u32 sec; + u32 nsec; +}; + +struct vcpu_info { + uint8_t evtchn_upcall_pending; + uint8_t evtchn_upcall_mask; + xen_ulong_t evtchn_pending_sel; + struct arch_vcpu_info arch; + struct pvclock_vcpu_time_info time; +}; + +struct shared_info { + struct vcpu_info vcpu_info[32]; + xen_ulong_t evtchn_pending[64]; + xen_ulong_t evtchn_mask[64]; + struct pvclock_wall_clock wc; + struct arch_shared_info arch; +}; + +struct start_info { + char magic[32]; + long unsigned int nr_pages; + long unsigned int shared_info; + uint32_t flags; + xen_pfn_t store_mfn; + uint32_t store_evtchn; + union { + struct { + xen_pfn_t mfn; + uint32_t evtchn; + } domU; + struct { + uint32_t info_off; + uint32_t info_size; + } dom0; + } console; + long unsigned int pt_base; + long unsigned int nr_pt_frames; + long unsigned int mfn_list; + long unsigned int mod_start; + long unsigned int mod_len; + int8_t cmd_line[1024]; + long unsigned int first_p2m_pfn; + long unsigned int nr_p2m_frames; +}; + +struct sched_shutdown { + unsigned int reason; +}; + +struct sched_pin_override { + int32_t pcpu; +}; + +struct vcpu_register_vcpu_info { + uint64_t mfn; + uint32_t offset; + uint32_t rsvd; +}; + +struct xmaddr { + phys_addr_t maddr; +}; + +typedef struct xmaddr xmaddr_t; + +struct xpaddr { + phys_addr_t paddr; +}; + +typedef struct xpaddr xpaddr_t; + +typedef s16 int16_t; + +typedef u16 uint16_t; + +struct clocksource { + u64 (*read)(struct clocksource *); + u64 mask; + u32 mult; + u32 shift; + u64 max_idle_ns; + u32 maxadj; + u64 max_cycles; + const char *name; + struct list_head list; + int rating; + enum vdso_clock_mode vdso_clock_mode; + long unsigned int flags; + int (*enable)(struct clocksource *); + void (*disable)(struct clocksource *); + void (*suspend)(struct clocksource *); + void (*resume)(struct clocksource *); + void (*mark_unstable)(struct clocksource *); + void (*tick_stable)(struct clocksource *); + struct list_head wd_list; + u64 cs_last; + u64 wd_last; + struct module *owner; +}; + +struct x86_init_mpparse { + void (*setup_ioapic_ids)(); + void (*find_smp_config)(); + void (*get_smp_config)(unsigned int); +}; + +struct x86_init_resources { + void (*probe_roms)(); + void (*reserve_resources)(); + char * (*memory_setup)(); +}; + +struct x86_init_irqs { + void (*pre_vector_init)(); + void (*intr_init)(); + void (*intr_mode_select)(); + void (*intr_mode_init)(); + struct irq_domain * (*create_pci_msi_domain)(); +}; + +struct x86_init_oem { + void (*arch_setup)(); + void (*banner)(); +}; + +struct x86_init_paging { + void (*pagetable_init)(); +}; + +struct x86_init_timers { + void (*setup_percpu_clockev)(); + void (*timer_init)(); + void (*wallclock_init)(); +}; + +struct x86_init_iommu { + int (*iommu_init)(); +}; + +struct x86_init_pci { + int (*arch_init)(); + int (*init)(); + void (*init_irq)(); + void (*fixup_irqs)(); +}; + +struct x86_hyper_init { + void (*init_platform)(); + void (*guest_late_init)(); + bool (*x2apic_available)(); + bool (*msi_ext_dest_id)(); + void (*init_mem_mapping)(); + void (*init_after_bootmem)(); +}; + +struct x86_init_acpi { + void (*set_root_pointer)(u64); + u64 (*get_root_pointer)(); + void (*reduced_hw_early_init)(); +}; + +struct x86_init_ops { + struct x86_init_resources resources; + struct x86_init_mpparse mpparse; + struct x86_init_irqs irqs; + struct x86_init_oem oem; + struct x86_init_paging paging; + struct x86_init_timers timers; + struct x86_init_iommu iommu; + struct x86_init_pci pci; + struct x86_hyper_init hyper; + struct x86_init_acpi acpi; +}; + +struct x86_cpuinit_ops { + void (*setup_percpu_clockev)(); + void (*early_percpu_clock_init)(); + void (*fixup_cpu_id)(struct cpuinfo_x86 *, int); +}; + +enum clock_event_state { + CLOCK_EVT_STATE_DETACHED = 0, + CLOCK_EVT_STATE_SHUTDOWN = 1, + CLOCK_EVT_STATE_PERIODIC = 2, + CLOCK_EVT_STATE_ONESHOT = 3, + CLOCK_EVT_STATE_ONESHOT_STOPPED = 4, +}; + +struct clock_event_device { + void (*event_handler)(struct clock_event_device *); + int (*set_next_event)(long unsigned int, struct clock_event_device *); + int (*set_next_ktime)(ktime_t, struct clock_event_device *); + ktime_t next_event; + u64 max_delta_ns; + u64 min_delta_ns; + u32 mult; + u32 shift; + enum clock_event_state state_use_accessors; + unsigned int features; + long unsigned int retries; + int (*set_state_periodic)(struct clock_event_device *); + int (*set_state_oneshot)(struct clock_event_device *); + int (*set_state_oneshot_stopped)(struct clock_event_device *); + int (*set_state_shutdown)(struct clock_event_device *); + int (*tick_resume)(struct clock_event_device *); + void (*broadcast)(const struct cpumask *); + void (*suspend)(struct clock_event_device *); + void (*resume)(struct clock_event_device *); + long unsigned int min_delta_ticks; + long unsigned int max_delta_ticks; + const char *name; + int rating; + int irq; + int bound_on; + const struct cpumask *cpumask; + struct list_head list; + struct module *owner; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct tk_read_base { + struct clocksource *clock; + u64 mask; + u64 cycle_last; + u32 mult; + u32 shift; + u64 xtime_nsec; + ktime_t base; + u64 base_real; +}; + +struct timekeeper { + struct tk_read_base tkr_mono; + struct tk_read_base tkr_raw; + u64 xtime_sec; + long unsigned int ktime_sec; + struct timespec64 wall_to_monotonic; + ktime_t offs_real; + ktime_t offs_boot; + ktime_t offs_tai; + s32 tai_offset; + unsigned int clock_was_set_seq; + u8 cs_was_changed_seq; + ktime_t next_leap_ktime; + u64 raw_sec; + struct timespec64 monotonic_to_boot; + u64 cycle_interval; + u64 xtime_interval; + s64 xtime_remainder; + u64 raw_interval; + u64 ntp_tick; + s64 ntp_error; + u32 ntp_error_shift; + u32 ntp_err_mult; + u32 skip_second_overflow; +}; + +typedef unsigned char *__guest_handle_uchar; + +typedef char *__guest_handle_char; + +typedef void *__guest_handle_void; + +typedef uint64_t *__guest_handle_uint64_t; + +typedef uint32_t *__guest_handle_uint32_t; + +struct vcpu_time_info { + uint32_t version; + uint32_t pad0; + uint64_t tsc_timestamp; + uint64_t system_time; + uint32_t tsc_to_system_mul; + int8_t tsc_shift; + int8_t pad1[3]; +}; + +struct xenpf_settime32 { + uint32_t secs; + uint32_t nsecs; + uint64_t system_time; +}; + +struct xenpf_settime64 { + uint64_t secs; + uint32_t nsecs; + uint32_t mbz; + uint64_t system_time; +}; + +struct xenpf_add_memtype { + xen_pfn_t mfn; + uint64_t nr_mfns; + uint32_t type; + uint32_t handle; + uint32_t reg; +}; + +struct xenpf_del_memtype { + uint32_t handle; + uint32_t reg; +}; + +struct xenpf_read_memtype { + uint32_t reg; + xen_pfn_t mfn; + uint64_t nr_mfns; + uint32_t type; +}; + +struct xenpf_microcode_update { + __guest_handle_void data; + uint32_t length; +}; + +struct xenpf_platform_quirk { + uint32_t quirk_id; +}; + +struct xenpf_efi_time { + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t min; + uint8_t sec; + uint32_t ns; + int16_t tz; + uint8_t daylight; +}; + +struct xenpf_efi_guid { + uint32_t data1; + uint16_t data2; + uint16_t data3; + uint8_t data4[8]; +}; + +struct xenpf_efi_runtime_call { + uint32_t function; + uint32_t misc; + xen_ulong_t status; + union { + struct { + struct xenpf_efi_time time; + uint32_t resolution; + uint32_t accuracy; + } get_time; + struct xenpf_efi_time set_time; + struct xenpf_efi_time get_wakeup_time; + struct xenpf_efi_time set_wakeup_time; + struct { + __guest_handle_void name; + xen_ulong_t size; + __guest_handle_void data; + struct xenpf_efi_guid vendor_guid; + } get_variable; + struct { + __guest_handle_void name; + xen_ulong_t size; + __guest_handle_void data; + struct xenpf_efi_guid vendor_guid; + } set_variable; + struct { + xen_ulong_t size; + __guest_handle_void name; + struct xenpf_efi_guid vendor_guid; + } get_next_variable_name; + struct { + uint32_t attr; + uint64_t max_store_size; + uint64_t remain_store_size; + uint64_t max_size; + } query_variable_info; + struct { + __guest_handle_void capsule_header_array; + xen_ulong_t capsule_count; + uint64_t max_capsule_size; + uint32_t reset_type; + } query_capsule_capabilities; + struct { + __guest_handle_void capsule_header_array; + xen_ulong_t capsule_count; + uint64_t sg_list; + } update_capsule; + } u; +}; + +union xenpf_efi_info { + uint32_t version; + struct { + uint64_t addr; + uint32_t nent; + } cfg; + struct { + uint32_t revision; + uint32_t bufsz; + __guest_handle_void name; + } vendor; + struct { + uint64_t addr; + uint64_t size; + uint64_t attr; + uint32_t type; + } mem; +}; + +struct xenpf_firmware_info { + uint32_t type; + uint32_t index; + union { + struct { + uint8_t device; + uint8_t version; + uint16_t interface_support; + uint16_t legacy_max_cylinder; + uint8_t legacy_max_head; + uint8_t legacy_sectors_per_track; + __guest_handle_void edd_params; + } disk_info; + struct { + uint8_t device; + uint32_t mbr_signature; + } disk_mbr_signature; + struct { + uint8_t capabilities; + uint8_t edid_transfer_time; + __guest_handle_uchar edid; + } vbeddc_info; + union xenpf_efi_info efi_info; + uint8_t kbd_shift_flags; + } u; +}; + +struct xenpf_enter_acpi_sleep { + uint16_t val_a; + uint16_t val_b; + uint32_t sleep_state; + uint32_t flags; +}; + +struct xenpf_change_freq { + uint32_t flags; + uint32_t cpu; + uint64_t freq; +}; + +struct xenpf_getidletime { + __guest_handle_uchar cpumap_bitmap; + uint32_t cpumap_nr_cpus; + __guest_handle_uint64_t idletime; + uint64_t now; +}; + +struct xen_power_register { + uint32_t space_id; + uint32_t bit_width; + uint32_t bit_offset; + uint32_t access_size; + uint64_t address; +}; + +struct xen_processor_csd { + uint32_t domain; + uint32_t coord_type; + uint32_t num; +}; + +typedef struct xen_processor_csd *__guest_handle_xen_processor_csd; + +struct xen_processor_cx { + struct xen_power_register reg; + uint8_t type; + uint32_t latency; + uint32_t power; + uint32_t dpcnt; + __guest_handle_xen_processor_csd dp; +}; + +typedef struct xen_processor_cx *__guest_handle_xen_processor_cx; + +struct xen_processor_flags { + uint32_t bm_control: 1; + uint32_t bm_check: 1; + uint32_t has_cst: 1; + uint32_t power_setup_done: 1; + uint32_t bm_rld_set: 1; +}; + +struct xen_processor_power { + uint32_t count; + struct xen_processor_flags flags; + __guest_handle_xen_processor_cx states; +}; + +struct xen_pct_register { + uint8_t descriptor; + uint16_t length; + uint8_t space_id; + uint8_t bit_width; + uint8_t bit_offset; + uint8_t reserved; + uint64_t address; +}; + +struct xen_processor_px { + uint64_t core_frequency; + uint64_t power; + uint64_t transition_latency; + uint64_t bus_master_latency; + uint64_t control; + uint64_t status; +}; + +typedef struct xen_processor_px *__guest_handle_xen_processor_px; + +struct xen_psd_package { + uint64_t num_entries; + uint64_t revision; + uint64_t domain; + uint64_t coord_type; + uint64_t num_processors; +}; + +struct xen_processor_performance { + uint32_t flags; + uint32_t platform_limit; + struct xen_pct_register control_register; + struct xen_pct_register status_register; + uint32_t state_count; + __guest_handle_xen_processor_px states; + struct xen_psd_package domain_info; + uint32_t shared_type; +}; + +struct xenpf_set_processor_pminfo { + uint32_t id; + uint32_t type; + union { + struct xen_processor_power power; + struct xen_processor_performance perf; + __guest_handle_uint32_t pdc; + }; +}; + +struct xenpf_pcpuinfo { + uint32_t xen_cpuid; + uint32_t max_present; + uint32_t flags; + uint32_t apic_id; + uint32_t acpi_id; +}; + +struct xenpf_cpu_ol { + uint32_t cpuid; +}; + +struct xenpf_cpu_hotadd { + uint32_t apic_id; + uint32_t acpi_id; + uint32_t pxm; +}; + +struct xenpf_mem_hotadd { + uint64_t spfn; + uint64_t epfn; + uint32_t pxm; + uint32_t flags; +}; + +struct xenpf_core_parking { + uint32_t type; + uint32_t idle_nums; +}; + +struct xenpf_symdata { + uint32_t namelen; + uint32_t symnum; + __guest_handle_char name; + uint64_t address; + char type; +}; + +struct xen_platform_op { + uint32_t cmd; + uint32_t interface_version; + union { + struct xenpf_settime32 settime32; + struct xenpf_settime64 settime64; + struct xenpf_add_memtype add_memtype; + struct xenpf_del_memtype del_memtype; + struct xenpf_read_memtype read_memtype; + struct xenpf_microcode_update microcode; + struct xenpf_platform_quirk platform_quirk; + struct xenpf_efi_runtime_call efi_runtime_call; + struct xenpf_firmware_info firmware_info; + struct xenpf_enter_acpi_sleep enter_acpi_sleep; + struct xenpf_change_freq change_freq; + struct xenpf_getidletime getidletime; + struct xenpf_set_processor_pminfo set_pminfo; + struct xenpf_pcpuinfo pcpu_info; + struct xenpf_cpu_ol cpu_ol; + struct xenpf_cpu_hotadd cpu_add; + struct xenpf_mem_hotadd mem_add; + struct xenpf_core_parking core_parking; + struct xenpf_symdata symdata; + uint8_t pad[128]; + } u; +}; + +struct vcpu_set_singleshot_timer { + uint64_t timeout_abs_ns; + uint32_t flags; +}; + +typedef struct vcpu_time_info *__guest_handle_vcpu_time_info; + +struct vcpu_register_time_memory_area { + union { + __guest_handle_vcpu_time_info h; + struct pvclock_vcpu_time_info *v; + uint64_t p; + } addr; +}; + +struct xen_clock_event_device { + struct clock_event_device evt; + char name[16]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +typedef int (*pte_fn_t)(pte_t *, long unsigned int, void *); + +typedef uint16_t grant_status_t; + +struct grant_frames { + xen_pfn_t *pfn; + unsigned int count; + void *vaddr; +}; + +struct gnttab_vm_area { + struct vm_struct *area; + pte_t **ptes; + int idx; +}; + +enum acpi_irq_model_id { + ACPI_IRQ_MODEL_PIC = 0, + ACPI_IRQ_MODEL_IOAPIC = 1, + ACPI_IRQ_MODEL_IOSAPIC = 2, + ACPI_IRQ_MODEL_PLATFORM = 3, + ACPI_IRQ_MODEL_GIC = 4, + ACPI_IRQ_MODEL_COUNT = 5, +}; + +typedef uint16_t domid_t; + +struct xen_add_to_physmap { + domid_t domid; + uint16_t size; + unsigned int space; + xen_ulong_t idx; + xen_pfn_t gpfn; +}; + +struct machine_ops { + void (*restart)(char *); + void (*halt)(); + void (*power_off)(); + void (*shutdown)(); + void (*crash_shutdown)(struct pt_regs *); + void (*emergency_restart)(); +}; + +enum x86_hypervisor_type { + X86_HYPER_NATIVE = 0, + X86_HYPER_VMWARE = 1, + X86_HYPER_MS_HYPERV = 2, + X86_HYPER_XEN_PV = 3, + X86_HYPER_XEN_HVM = 4, + X86_HYPER_KVM = 5, + X86_HYPER_JAILHOUSE = 6, + X86_HYPER_ACRN = 7, +}; + +struct hypervisor_x86 { + const char *name; + uint32_t (*detect)(); + enum x86_hypervisor_type type; + struct x86_hyper_init init; + struct x86_hyper_runtime runtime; + bool ignore_nopv; +}; + +enum e820_type { + E820_TYPE_RAM = 1, + E820_TYPE_RESERVED = 2, + E820_TYPE_ACPI = 3, + E820_TYPE_NVS = 4, + E820_TYPE_UNUSABLE = 5, + E820_TYPE_PMEM = 7, + E820_TYPE_PRAM = 12, + E820_TYPE_SOFT_RESERVED = 4026531839, + E820_TYPE_RESERVED_KERN = 128, +}; + +struct xen_hvm_pagetable_dying { + domid_t domid; + __u64 gpa; +}; + +enum hvmmem_type_t { + HVMMEM_ram_rw = 0, + HVMMEM_ram_ro = 1, + HVMMEM_mmio_dm = 2, +}; + +struct xen_hvm_get_mem_type { + domid_t domid; + uint16_t mem_type; + uint16_t pad[2]; + uint64_t pfn; +}; + +struct e820_entry { + u64 addr; + u64 size; + enum e820_type type; +} __attribute__((packed)); + +struct e820_table { + __u32 nr_entries; + struct e820_entry entries[3200]; +} __attribute__((packed)); + +typedef xen_pfn_t *__guest_handle_xen_pfn_t; + +typedef long unsigned int xen_callback_t; + +struct mmu_update { + uint64_t ptr; + uint64_t val; +}; + +struct xen_memory_region { + long unsigned int start_pfn; + long unsigned int n_pfns; +}; + +struct callback_register { + uint16_t type; + uint16_t flags; + xen_callback_t address; +}; + +struct xen_memory_reservation { + __guest_handle_xen_pfn_t extent_start; + xen_ulong_t nr_extents; + unsigned int extent_order; + unsigned int address_bits; + domid_t domid; +}; + +struct xen_memory_map { + unsigned int nr_entries; + __guest_handle_void buffer; +}; + +struct x86_apic_ops { + unsigned int (*io_apic_read)(unsigned int, unsigned int); + void (*restore)(); +}; + +struct physdev_apic { + long unsigned int apic_physbase; + uint32_t reg; + uint32_t value; +}; + +typedef long unsigned int uintptr_t; + +struct xen_pmu_amd_ctxt { + uint32_t counters; + uint32_t ctrls; + uint64_t regs[0]; +}; + +struct xen_pmu_cntr_pair { + uint64_t counter; + uint64_t control; +}; + +struct xen_pmu_intel_ctxt { + uint32_t fixed_counters; + uint32_t arch_counters; + uint64_t global_ctrl; + uint64_t global_ovf_ctrl; + uint64_t global_status; + uint64_t fixed_ctrl; + uint64_t ds_area; + uint64_t pebs_enable; + uint64_t debugctl; + uint64_t regs[0]; +}; + +struct xen_pmu_regs { + uint64_t ip; + uint64_t sp; + uint64_t flags; + uint16_t cs; + uint16_t ss; + uint8_t cpl; + uint8_t pad[3]; +}; + +struct xen_pmu_arch { + union { + struct xen_pmu_regs regs; + uint8_t pad[64]; + } r; + uint64_t pmu_flags; + union { + uint32_t lapic_lvtpc; + uint64_t pad; + } l; + union { + struct xen_pmu_amd_ctxt amd; + struct xen_pmu_intel_ctxt intel; + uint8_t pad[128]; + } c; +}; + +struct xen_pmu_params { + struct { + uint32_t maj; + uint32_t min; + } version; + uint64_t val; + uint32_t vcpu; + uint32_t pad; +}; + +struct xen_pmu_data { + uint32_t vcpu_id; + uint32_t pcpu_id; + domid_t domain_id; + uint8_t pad[6]; + struct xen_pmu_arch pmu; +}; + +struct xenpmu { + struct xen_pmu_data *xenpmu_data; + uint8_t flags; +}; + +enum pg_level { + PG_LEVEL_NONE = 0, + PG_LEVEL_4K = 1, + PG_LEVEL_2M = 2, + PG_LEVEL_1G = 3, + PG_LEVEL_512G = 4, + PG_LEVEL_NUM = 5, +}; + +typedef uint32_t grant_ref_t; + +typedef uint32_t grant_handle_t; + +struct gnttab_map_grant_ref { + uint64_t host_addr; + uint32_t flags; + grant_ref_t ref; + domid_t dom; + int16_t status; + grant_handle_t handle; + uint64_t dev_bus_addr; +}; + +struct gnttab_unmap_grant_ref { + uint64_t host_addr; + uint64_t dev_bus_addr; + grant_handle_t handle; + int16_t status; +}; + +enum { + DESC_TSS = 9, + DESC_LDT = 2, + DESCTYPE_S = 16, +}; + +enum paravirt_lazy_mode { + PARAVIRT_LAZY_NONE = 0, + PARAVIRT_LAZY_MMU = 1, + PARAVIRT_LAZY_CPU = 2, +}; + +struct plist_head { + struct list_head node_list; +}; + +enum pm_qos_type { + PM_QOS_UNITIALIZED = 0, + PM_QOS_MAX = 1, + PM_QOS_MIN = 2, +}; + +struct pm_qos_constraints { + struct plist_head list; + s32 target_value; + s32 default_value; + s32 no_constraint_value; + enum pm_qos_type type; + struct blocking_notifier_head *notifiers; +}; + +struct freq_constraints { + struct pm_qos_constraints min_freq; + struct blocking_notifier_head min_freq_notifiers; + struct pm_qos_constraints max_freq; + struct blocking_notifier_head max_freq_notifiers; +}; + +struct pm_qos_flags { + struct list_head list; + s32 effective_flags; +}; + +struct dev_pm_qos_request; + +struct dev_pm_qos { + struct pm_qos_constraints resume_latency; + struct pm_qos_constraints latency_tolerance; + struct freq_constraints freq; + struct pm_qos_flags flags; + struct dev_pm_qos_request *resume_latency_req; + struct dev_pm_qos_request *latency_tolerance_req; + struct dev_pm_qos_request *flags_req; +}; + +typedef long int xen_long_t; + +struct trap_info { + uint8_t vector; + uint8_t flags; + uint16_t cs; + long unsigned int address; +}; + +struct mmuext_op { + unsigned int cmd; + union { + xen_pfn_t mfn; + long unsigned int linear_addr; + } arg1; + union { + unsigned int nr_ents; + void *vcpumask; + xen_pfn_t src_mfn; + } arg2; +}; + +struct multicall_entry { + xen_ulong_t op; + xen_long_t result; + xen_ulong_t args[6]; +}; + +struct dom0_vga_console_info { + uint8_t video_type; + union { + struct { + uint16_t font_height; + uint16_t cursor_x; + uint16_t cursor_y; + uint16_t rows; + uint16_t columns; + } text_mode_3; + struct { + uint16_t width; + uint16_t height; + uint16_t bytes_per_line; + uint16_t bits_per_pixel; + uint32_t lfb_base; + uint32_t lfb_size; + uint8_t red_pos; + uint8_t red_size; + uint8_t green_pos; + uint8_t green_size; + uint8_t blue_pos; + uint8_t blue_size; + uint8_t rsvd_pos; + uint8_t rsvd_size; + uint32_t gbl_caps; + uint16_t mode_attrs; + } vesa_lfb; + } u; +}; + +struct physdev_set_iopl { + uint32_t iopl; +}; + +struct physdev_set_iobitmap { + uint8_t *bitmap; + uint32_t nr_ports; +}; + +struct xen_extraversion { + char extraversion[16]; +}; + +typedef u32 acpi_status; + +struct pm_qos_flags_request { + struct list_head node; + s32 flags; +}; + +enum freq_qos_req_type { + FREQ_QOS_MIN = 1, + FREQ_QOS_MAX = 2, +}; + +struct freq_qos_request { + enum freq_qos_req_type type; + struct plist_node pnode; + struct freq_constraints *qos; +}; + +enum dev_pm_qos_req_type { + DEV_PM_QOS_RESUME_LATENCY = 1, + DEV_PM_QOS_LATENCY_TOLERANCE = 2, + DEV_PM_QOS_MIN_FREQUENCY = 3, + DEV_PM_QOS_MAX_FREQUENCY = 4, + DEV_PM_QOS_FLAGS = 5, +}; + +struct dev_pm_qos_request { + enum dev_pm_qos_req_type type; + union { + struct plist_node pnode; + struct pm_qos_flags_request flr; + struct freq_qos_request freq; + } data; + struct device *dev; +}; + +struct multicall_space { + struct multicall_entry *mc; + void *args; +}; + +struct tls_descs { + struct desc_struct desc[3]; +}; + +struct trap_array_entry { + void (*orig)(); + void (*xen)(); + bool ist_okay; +}; + +struct mmu_gather_batch { + struct mmu_gather_batch *next; + unsigned int nr; + unsigned int max; + struct page *pages[0]; +}; + +struct mmu_table_batch; + +struct mmu_gather { + struct mm_struct *mm; + struct mmu_table_batch *batch; + long unsigned int start; + long unsigned int end; + unsigned int fullmm: 1; + unsigned int need_flush_all: 1; + unsigned int freed_tables: 1; + unsigned int cleared_ptes: 1; + unsigned int cleared_pmds: 1; + unsigned int cleared_puds: 1; + unsigned int cleared_p4ds: 1; + unsigned int vma_exec: 1; + unsigned int vma_huge: 1; + unsigned int batch_count; + struct mmu_gather_batch *active; + struct mmu_gather_batch local; + struct page *__pages[8]; +}; + +struct mmu_table_batch { + struct callback_head rcu; + unsigned int nr; + void *tables[0]; +}; + +struct xen_memory_exchange { + struct xen_memory_reservation in; + struct xen_memory_reservation out; + xen_ulong_t nr_exchanged; +}; + +struct xen_machphys_mapping { + xen_ulong_t v_start; + xen_ulong_t v_end; + xen_ulong_t max_mfn; +}; + +enum pt_level { + PT_PGD = 0, + PT_P4D = 1, + PT_PUD = 2, + PT_PMD = 3, + PT_PTE = 4, +}; + +struct remap_data { + xen_pfn_t *pfn; + bool contiguous; + bool no_translate; + pgprot_t prot; + struct mmu_update *mmu_update; +}; + +enum xen_mc_flush_reason { + XEN_MC_FL_NONE = 0, + XEN_MC_FL_BATCH = 1, + XEN_MC_FL_ARGS = 2, + XEN_MC_FL_CALLBACK = 3, +}; + +enum xen_mc_extend_args { + XEN_MC_XE_OK = 0, + XEN_MC_XE_BAD_OP = 1, + XEN_MC_XE_NO_SPACE = 2, +}; + +typedef void (*xen_mc_callback_fn_t)(void *); + +struct callback { + void (*fn)(void *); + void *data; +}; + +struct mc_buffer { + unsigned int mcidx; + unsigned int argidx; + unsigned int cbidx; + struct multicall_entry entries[32]; + unsigned char args[512]; + struct callback callbacks[32]; +}; + +struct hvm_start_info { + uint32_t magic; + uint32_t version; + uint32_t flags; + uint32_t nr_modules; + uint64_t modlist_paddr; + uint64_t cmdline_paddr; + uint64_t rsdp_paddr; + uint64_t memmap_paddr; + uint32_t memmap_entries; + uint32_t reserved; +}; + +struct trace_event_raw_xen_mc__batch { + struct trace_entry ent; + enum paravirt_lazy_mode mode; + char __data[0]; +}; + +struct trace_event_raw_xen_mc_entry { + struct trace_entry ent; + unsigned int op; + unsigned int nargs; + long unsigned int args[6]; + char __data[0]; +}; + +struct trace_event_raw_xen_mc_entry_alloc { + struct trace_entry ent; + size_t args; + char __data[0]; +}; + +struct trace_event_raw_xen_mc_callback { + struct trace_entry ent; + xen_mc_callback_fn_t fn; + void *data; + char __data[0]; +}; + +struct trace_event_raw_xen_mc_flush_reason { + struct trace_entry ent; + enum xen_mc_flush_reason reason; + char __data[0]; +}; + +struct trace_event_raw_xen_mc_flush { + struct trace_entry ent; + unsigned int mcidx; + unsigned int argidx; + unsigned int cbidx; + char __data[0]; +}; + +struct trace_event_raw_xen_mc_extend_args { + struct trace_entry ent; + unsigned int op; + size_t args; + enum xen_mc_extend_args res; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu__set_pte { + struct trace_entry ent; + pte_t *ptep; + pteval_t pteval; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_set_pmd { + struct trace_entry ent; + pmd_t *pmdp; + pmdval_t pmdval; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_set_pud { + struct trace_entry ent; + pud_t *pudp; + pudval_t pudval; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_set_p4d { + struct trace_entry ent; + p4d_t *p4dp; + p4d_t *user_p4dp; + p4dval_t p4dval; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_ptep_modify_prot { + struct trace_entry ent; + struct mm_struct *mm; + long unsigned int addr; + pte_t *ptep; + pteval_t pteval; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_alloc_ptpage { + struct trace_entry ent; + struct mm_struct *mm; + long unsigned int pfn; + unsigned int level; + bool pinned; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_release_ptpage { + struct trace_entry ent; + long unsigned int pfn; + unsigned int level; + bool pinned; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_pgd { + struct trace_entry ent; + struct mm_struct *mm; + pgd_t *pgd; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_flush_tlb_one_user { + struct trace_entry ent; + long unsigned int addr; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_flush_tlb_others { + struct trace_entry ent; + unsigned int ncpus; + struct mm_struct *mm; + long unsigned int addr; + long unsigned int end; + char __data[0]; +}; + +struct trace_event_raw_xen_mmu_write_cr3 { + struct trace_entry ent; + bool kernel; + long unsigned int cr3; + char __data[0]; +}; + +struct trace_event_raw_xen_cpu_write_ldt_entry { + struct trace_entry ent; + struct desc_struct *dt; + int entrynum; + u64 desc; + char __data[0]; +}; + +struct trace_event_raw_xen_cpu_write_idt_entry { + struct trace_entry ent; + gate_desc *dt; + int entrynum; + char __data[0]; +}; + +struct trace_event_raw_xen_cpu_load_idt { + struct trace_entry ent; + long unsigned int addr; + char __data[0]; +}; + +struct trace_event_raw_xen_cpu_write_gdt_entry { + struct trace_entry ent; + u64 desc; + struct desc_struct *dt; + int entrynum; + int type; + char __data[0]; +}; + +struct trace_event_raw_xen_cpu_set_ldt { + struct trace_entry ent; + const void *addr; + unsigned int entries; + char __data[0]; +}; + +struct trace_event_data_offsets_xen_mc__batch {}; + +struct trace_event_data_offsets_xen_mc_entry {}; + +struct trace_event_data_offsets_xen_mc_entry_alloc {}; + +struct trace_event_data_offsets_xen_mc_callback {}; + +struct trace_event_data_offsets_xen_mc_flush_reason {}; + +struct trace_event_data_offsets_xen_mc_flush {}; + +struct trace_event_data_offsets_xen_mc_extend_args {}; + +struct trace_event_data_offsets_xen_mmu__set_pte {}; + +struct trace_event_data_offsets_xen_mmu_set_pmd {}; + +struct trace_event_data_offsets_xen_mmu_set_pud {}; + +struct trace_event_data_offsets_xen_mmu_set_p4d {}; + +struct trace_event_data_offsets_xen_mmu_ptep_modify_prot {}; + +struct trace_event_data_offsets_xen_mmu_alloc_ptpage {}; + +struct trace_event_data_offsets_xen_mmu_release_ptpage {}; + +struct trace_event_data_offsets_xen_mmu_pgd {}; + +struct trace_event_data_offsets_xen_mmu_flush_tlb_one_user {}; + +struct trace_event_data_offsets_xen_mmu_flush_tlb_others {}; + +struct trace_event_data_offsets_xen_mmu_write_cr3 {}; + +struct trace_event_data_offsets_xen_cpu_write_ldt_entry {}; + +struct trace_event_data_offsets_xen_cpu_write_idt_entry {}; + +struct trace_event_data_offsets_xen_cpu_load_idt {}; + +struct trace_event_data_offsets_xen_cpu_write_gdt_entry {}; + +struct trace_event_data_offsets_xen_cpu_set_ldt {}; + +typedef void (*btf_trace_xen_mc_batch)(void *, enum paravirt_lazy_mode); + +typedef void (*btf_trace_xen_mc_issue)(void *, enum paravirt_lazy_mode); + +typedef void (*btf_trace_xen_mc_entry)(void *, struct multicall_entry *, unsigned int); + +typedef void (*btf_trace_xen_mc_entry_alloc)(void *, size_t); + +typedef void (*btf_trace_xen_mc_callback)(void *, xen_mc_callback_fn_t, void *); + +typedef void (*btf_trace_xen_mc_flush_reason)(void *, enum xen_mc_flush_reason); + +typedef void (*btf_trace_xen_mc_flush)(void *, unsigned int, unsigned int, unsigned int); + +typedef void (*btf_trace_xen_mc_extend_args)(void *, long unsigned int, size_t, enum xen_mc_extend_args); + +typedef void (*btf_trace_xen_mmu_set_pte)(void *, pte_t *, pte_t); + +typedef void (*btf_trace_xen_mmu_set_pmd)(void *, pmd_t *, pmd_t); + +typedef void (*btf_trace_xen_mmu_set_pud)(void *, pud_t *, pud_t); + +typedef void (*btf_trace_xen_mmu_set_p4d)(void *, p4d_t *, p4d_t *, p4d_t); + +typedef void (*btf_trace_xen_mmu_ptep_modify_prot_start)(void *, struct mm_struct *, long unsigned int, pte_t *, pte_t); + +typedef void (*btf_trace_xen_mmu_ptep_modify_prot_commit)(void *, struct mm_struct *, long unsigned int, pte_t *, pte_t); + +typedef void (*btf_trace_xen_mmu_alloc_ptpage)(void *, struct mm_struct *, long unsigned int, unsigned int, bool); + +typedef void (*btf_trace_xen_mmu_release_ptpage)(void *, long unsigned int, unsigned int, bool); + +typedef void (*btf_trace_xen_mmu_pgd_pin)(void *, struct mm_struct *, pgd_t *); + +typedef void (*btf_trace_xen_mmu_pgd_unpin)(void *, struct mm_struct *, pgd_t *); + +typedef void (*btf_trace_xen_mmu_flush_tlb_one_user)(void *, long unsigned int); + +typedef void (*btf_trace_xen_mmu_flush_tlb_others)(void *, const struct cpumask *, struct mm_struct *, long unsigned int, long unsigned int); + +typedef void (*btf_trace_xen_mmu_write_cr3)(void *, bool, long unsigned int); + +typedef void (*btf_trace_xen_cpu_write_ldt_entry)(void *, struct desc_struct *, int, u64); + +typedef void (*btf_trace_xen_cpu_write_idt_entry)(void *, gate_desc *, int, const gate_desc *); + +typedef void (*btf_trace_xen_cpu_load_idt)(void *, const struct desc_ptr *); + +typedef void (*btf_trace_xen_cpu_write_gdt_entry)(void *, struct desc_struct *, int, const void *, int); + +typedef void (*btf_trace_xen_cpu_set_ldt)(void *, const void *, unsigned int); + +enum ipi_vector { + XEN_RESCHEDULE_VECTOR = 0, + XEN_CALL_FUNCTION_VECTOR = 1, + XEN_CALL_FUNCTION_SINGLE_VECTOR = 2, + XEN_SPIN_UNLOCK_VECTOR = 3, + XEN_IRQ_WORK_VECTOR = 4, + XEN_NMI_VECTOR = 5, + XEN_NR_IPIS = 6, +}; + +struct xen_common_irq { + int irq; + char *name; +}; + +struct cpu_user_regs { + uint64_t r15; + uint64_t r14; + uint64_t r13; + uint64_t r12; + union { + uint64_t rbp; + uint64_t ebp; + uint32_t _ebp; + }; + union { + uint64_t rbx; + uint64_t ebx; + uint32_t _ebx; + }; + uint64_t r11; + uint64_t r10; + uint64_t r9; + uint64_t r8; + union { + uint64_t rax; + uint64_t eax; + uint32_t _eax; + }; + union { + uint64_t rcx; + uint64_t ecx; + uint32_t _ecx; + }; + union { + uint64_t rdx; + uint64_t edx; + uint32_t _edx; + }; + union { + uint64_t rsi; + uint64_t esi; + uint32_t _esi; + }; + union { + uint64_t rdi; + uint64_t edi; + uint32_t _edi; + }; + uint32_t error_code; + uint32_t entry_vector; + union { + uint64_t rip; + uint64_t eip; + uint32_t _eip; + }; + uint16_t cs; + uint16_t _pad0[1]; + uint8_t saved_upcall_mask; + uint8_t _pad1[3]; + union { + uint64_t rflags; + uint64_t eflags; + uint32_t _eflags; + }; + union { + uint64_t rsp; + uint64_t esp; + uint32_t _esp; + }; + uint16_t ss; + uint16_t _pad2[3]; + uint16_t es; + uint16_t _pad3[3]; + uint16_t ds; + uint16_t _pad4[3]; + uint16_t fs; + uint16_t _pad5[3]; + uint16_t gs; + uint16_t _pad6[3]; +}; + +struct vcpu_guest_context { + struct { + char x[512]; + } fpu_ctxt; + long unsigned int flags; + struct cpu_user_regs user_regs; + struct trap_info trap_ctxt[256]; + long unsigned int ldt_base; + long unsigned int ldt_ents; + long unsigned int gdt_frames[16]; + long unsigned int gdt_ents; + long unsigned int kernel_ss; + long unsigned int kernel_sp; + long unsigned int ctrlreg[8]; + long unsigned int debugreg[8]; + long unsigned int event_callback_eip; + long unsigned int failsafe_callback_eip; + long unsigned int syscall_callback_eip; + long unsigned int vm_assist; + uint64_t fs_base; + uint64_t gs_base_kernel; + uint64_t gs_base_user; +}; + +struct sg_table { + struct scatterlist *sgl; + unsigned int nents; + unsigned int orig_nents; +}; + +enum swiotlb_force { + SWIOTLB_NORMAL = 0, + SWIOTLB_FORCE = 1, + SWIOTLB_NO_FORCE = 2, +}; + +struct iommu_table_entry { + initcall_t detect; + initcall_t depend; + void (*early_init)(); + void (*late_init)(); + int flags; +}; + +union efi_boot_services; + +typedef union efi_boot_services efi_boot_services_t; + +typedef struct { + efi_table_hdr_t hdr; + u32 fw_vendor; + u32 fw_revision; + u32 con_in_handle; + u32 con_in; + u32 con_out_handle; + u32 con_out; + u32 stderr_handle; + u32 stderr; + u32 runtime; + u32 boottime; + u32 nr_tables; + u32 tables; +} efi_system_table_32_t; + +union efi_simple_text_input_protocol; + +typedef union efi_simple_text_input_protocol efi_simple_text_input_protocol_t; + +union efi_simple_text_output_protocol; + +typedef union efi_simple_text_output_protocol efi_simple_text_output_protocol_t; + +typedef union { + struct { + efi_table_hdr_t hdr; + long unsigned int fw_vendor; + u32 fw_revision; + long unsigned int con_in_handle; + efi_simple_text_input_protocol_t *con_in; + long unsigned int con_out_handle; + efi_simple_text_output_protocol_t *con_out; + long unsigned int stderr_handle; + long unsigned int stderr; + efi_runtime_services_t *runtime; + efi_boot_services_t *boottime; + long unsigned int nr_tables; + long unsigned int tables; + }; + efi_system_table_32_t mixed_mode; +} efi_system_table_t; + +enum efi_secureboot_mode { + efi_secureboot_mode_unset = 0, + efi_secureboot_mode_unknown = 1, + efi_secureboot_mode_disabled = 2, + efi_secureboot_mode_enabled = 3, +}; + +struct hvm_modlist_entry { + uint64_t paddr; + uint64_t size; + uint64_t cmdline_paddr; + uint64_t reserved; +}; + +struct hvm_memmap_table_entry { + uint64_t addr; + uint64_t size; + uint32_t type; + uint32_t reserved; +}; + +enum { + WORK_STRUCT_PENDING_BIT = 0, + WORK_STRUCT_DELAYED_BIT = 1, + WORK_STRUCT_PWQ_BIT = 2, + WORK_STRUCT_LINKED_BIT = 3, + WORK_STRUCT_COLOR_SHIFT = 4, + WORK_STRUCT_COLOR_BITS = 4, + WORK_STRUCT_PENDING = 1, + WORK_STRUCT_DELAYED = 2, + WORK_STRUCT_PWQ = 4, + WORK_STRUCT_LINKED = 8, + WORK_STRUCT_STATIC = 0, + WORK_NR_COLORS = 15, + WORK_NO_COLOR = 15, + WORK_CPU_UNBOUND = 8192, + WORK_STRUCT_FLAG_BITS = 8, + WORK_OFFQ_FLAG_BASE = 4, + __WORK_OFFQ_CANCELING = 4, + WORK_OFFQ_CANCELING = 16, + WORK_OFFQ_FLAG_BITS = 1, + WORK_OFFQ_POOL_SHIFT = 5, + WORK_OFFQ_LEFT = 59, + WORK_OFFQ_POOL_BITS = 31, + WORK_OFFQ_POOL_NONE = 2147483647, + WORK_STRUCT_FLAG_MASK = 255, + WORK_STRUCT_WQ_DATA_MASK = 4294967040, + WORK_STRUCT_NO_POOL = 4294967264, + WORK_BUSY_PENDING = 1, + WORK_BUSY_RUNNING = 2, + WORKER_DESC_LEN = 24, +}; + +union hv_x64_msr_hypercall_contents { + u64 as_uint64; + struct { + u64 enable: 1; + u64 reserved: 11; + u64 guest_physical_address: 52; + }; +}; + +struct hv_reenlightenment_control { + __u64 vector: 8; + __u64 reserved1: 8; + __u64 enabled: 1; + __u64 reserved2: 15; + __u64 target_vp: 32; +}; + +struct hv_tsc_emulation_control { + __u64 enabled: 1; + __u64 reserved: 63; +}; + +struct hv_tsc_emulation_status { + __u64 inprogress: 1; + __u64 reserved: 63; +}; + +struct hv_nested_enlightenments_control { + struct { + __u32 directhypercall: 1; + __u32 reserved: 31; + } features; + struct { + __u32 reserved; + } hypercallControls; +}; + +struct hv_vp_assist_page { + __u32 apic_assist; + __u32 reserved1; + __u64 vtl_control[3]; + struct hv_nested_enlightenments_control nested_control; + __u8 enlighten_vmentry; + __u8 reserved2[7]; + __u64 current_nested_vmcs; +}; + +struct ms_hyperv_info { + u32 features; + u32 misc_features; + u32 hints; + u32 nested_features; + u32 max_vp_index; + u32 max_lp_index; +}; + +enum HV_GENERIC_SET_FORMAT { + HV_GENERIC_SET_SPARSE_4K = 0, + HV_GENERIC_SET_ALL = 1, +}; + +struct hv_vpset { + u64 format; + u64 valid_bank_mask; + u64 bank_contents[0]; +}; + +struct hv_tlb_flush { + u64 address_space; + u64 flags; + u64 processor_mask; + u64 gva_list[0]; +}; + +struct hv_tlb_flush_ex { + u64 address_space; + u64 flags; + struct hv_vpset hv_vp_set; + u64 gva_list[0]; +}; + +struct trace_event_raw_hyperv_mmu_flush_tlb_others { + struct trace_entry ent; + unsigned int ncpus; + struct mm_struct *mm; + long unsigned int addr; + long unsigned int end; + char __data[0]; +}; + +struct trace_event_raw_hyperv_nested_flush_guest_mapping { + struct trace_entry ent; + u64 as; + int ret; + char __data[0]; +}; + +struct trace_event_raw_hyperv_nested_flush_guest_mapping_range { + struct trace_entry ent; + u64 as; + int ret; + char __data[0]; +}; + +struct trace_event_raw_hyperv_send_ipi_mask { + struct trace_entry ent; + unsigned int ncpus; + int vector; + char __data[0]; +}; + +struct trace_event_raw_hyperv_send_ipi_one { + struct trace_entry ent; + int cpu; + int vector; + char __data[0]; +}; + +struct trace_event_data_offsets_hyperv_mmu_flush_tlb_others {}; + +struct trace_event_data_offsets_hyperv_nested_flush_guest_mapping {}; + +struct trace_event_data_offsets_hyperv_nested_flush_guest_mapping_range {}; + +struct trace_event_data_offsets_hyperv_send_ipi_mask {}; + +struct trace_event_data_offsets_hyperv_send_ipi_one {}; + +typedef void (*btf_trace_hyperv_mmu_flush_tlb_others)(void *, const struct cpumask *, const struct flush_tlb_info *); + +typedef void (*btf_trace_hyperv_nested_flush_guest_mapping)(void *, u64, int); + +typedef void (*btf_trace_hyperv_nested_flush_guest_mapping_range)(void *, u64, int); + +typedef void (*btf_trace_hyperv_send_ipi_mask)(void *, const struct cpumask *, int); + +typedef void (*btf_trace_hyperv_send_ipi_one)(void *, int, int); + +struct hv_guest_mapping_flush { + u64 address_space; + u64 flags; +}; + +union hv_gpa_page_range { + u64 address_space; + struct { + u64 additional_pages: 11; + u64 largepage: 1; + u64 basepfn: 52; + } page; +}; + +struct hv_guest_mapping_flush_list { + u64 address_space; + u64 flags; + union hv_gpa_page_range gpa_list[510]; +}; + +typedef int (*hyperv_fill_flush_list_func)(struct hv_guest_mapping_flush_list *, void *); + +struct hv_send_ipi { + u32 vector; + u32 reserved; + u64 cpu_mask; +}; + +struct hv_send_ipi_ex { + u32 vector; + u32 reserved; + struct hv_vpset vp_set; +}; + +struct real_mode_header { + u32 text_start; + u32 ro_end; + u32 trampoline_start; + u32 trampoline_header; + u32 sev_es_trampoline_start; + u32 trampoline_pgd; + u32 wakeup_start; + u32 wakeup_header; + u32 machine_real_restart_asm; + u32 machine_real_restart_seg; +}; + +struct trampoline_header { + u64 start; + u64 efer; + u32 cr4; + u32 flags; +}; + +struct pkru_state { + u32 pkru; + u32 pad; +}; + +enum show_regs_mode { + SHOW_REGS_SHORT = 0, + SHOW_REGS_USER = 1, + SHOW_REGS_ALL = 2, +}; + +struct resctrl_pqr_state { + u32 cur_rmid; + u32 cur_closid; + u32 default_rmid; + u32 default_closid; +}; + +enum which_selector { + FS = 0, + GS = 1, +}; + +struct sigcontext_64 { + __u64 r8; + __u64 r9; + __u64 r10; + __u64 r11; + __u64 r12; + __u64 r13; + __u64 r14; + __u64 r15; + __u64 di; + __u64 si; + __u64 bp; + __u64 bx; + __u64 dx; + __u64 ax; + __u64 cx; + __u64 sp; + __u64 ip; + __u64 flags; + __u16 cs; + __u16 gs; + __u16 fs; + __u16 ss; + __u64 err; + __u64 trapno; + __u64 oldmask; + __u64 cr2; + __u64 fpstate; + __u64 reserved1[8]; +}; + +struct sigaltstack { + void *ss_sp; + int ss_flags; + size_t ss_size; +}; + +typedef struct sigaltstack stack_t; + +struct siginfo { + union { + struct { + int si_signo; + int si_errno; + int si_code; + union __sifields _sifields; + }; + int _si_pad[32]; + }; +}; + +typedef struct siginfo siginfo_t; + +struct ksignal { + struct k_sigaction ka; + kernel_siginfo_t info; + int sig; +}; + +struct __large_struct { + long unsigned int buf[100]; +}; + +typedef u32 compat_sigset_word; + +typedef struct { + compat_sigset_word sig[2]; +} compat_sigset_t; + +struct ucontext { + long unsigned int uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + struct sigcontext_64 uc_mcontext; + sigset_t uc_sigmask; +}; + +struct kernel_vm86_regs { + struct pt_regs pt; + short unsigned int es; + short unsigned int __esh; + short unsigned int ds; + short unsigned int __dsh; + short unsigned int fs; + short unsigned int __fsh; + short unsigned int gs; + short unsigned int __gsh; +}; + +struct rt_sigframe { + char *pretcode; + struct ucontext uc; + struct siginfo info; +}; + +typedef s32 compat_clock_t; + +typedef s32 compat_pid_t; + +typedef s32 compat_timer_t; + +typedef s32 compat_int_t; + +typedef u32 __compat_uid32_t; + +union compat_sigval { + compat_int_t sival_int; + compat_uptr_t sival_ptr; +}; + +typedef union compat_sigval compat_sigval_t; + +struct compat_siginfo { + int si_signo; + int si_errno; + int si_code; + union { + int _pad[29]; + struct { + compat_pid_t _pid; + __compat_uid32_t _uid; + } _kill; + struct { + compat_timer_t _tid; + int _overrun; + compat_sigval_t _sigval; + } _timer; + struct { + compat_pid_t _pid; + __compat_uid32_t _uid; + compat_sigval_t _sigval; + } _rt; + struct { + compat_pid_t _pid; + __compat_uid32_t _uid; + int _status; + compat_clock_t _utime; + compat_clock_t _stime; + } _sigchld; + struct { + compat_uptr_t _addr; + union { + short int _addr_lsb; + struct { + char _dummy_bnd[4]; + compat_uptr_t _lower; + compat_uptr_t _upper; + } _addr_bnd; + struct { + char _dummy_pkey[4]; + u32 _pkey; + } _addr_pkey; + }; + } _sigfault; + struct { + compat_long_t _band; + int _fd; + } _sigpoll; + struct { + compat_uptr_t _call_addr; + int _syscall; + unsigned int _arch; + } _sigsys; + } _sifields; +}; + +typedef struct compat_siginfo compat_siginfo_t; + +enum bug_trap_type { + BUG_TRAP_TYPE_NONE = 0, + BUG_TRAP_TYPE_WARN = 1, + BUG_TRAP_TYPE_BUG = 2, +}; + +typedef u8 kprobe_opcode_t; + +struct arch_specific_insn { + kprobe_opcode_t *insn; + bool boostable; + bool if_modifier; + int tp_len; +}; + +struct kprobe; + +typedef int (*kprobe_pre_handler_t)(struct kprobe *, struct pt_regs *); + +typedef void (*kprobe_post_handler_t)(struct kprobe *, struct pt_regs *, long unsigned int); + +typedef int (*kprobe_fault_handler_t)(struct kprobe *, struct pt_regs *, int); + +struct kprobe { + struct hlist_node hlist; + struct list_head list; + long unsigned int nmissed; + kprobe_opcode_t *addr; + const char *symbol_name; + unsigned int offset; + kprobe_pre_handler_t pre_handler; + kprobe_post_handler_t post_handler; + kprobe_fault_handler_t fault_handler; + kprobe_opcode_t opcode; + struct arch_specific_insn ainsn; + u32 flags; +}; + +enum die_val { + DIE_OOPS = 1, + DIE_INT3 = 2, + DIE_DEBUG = 3, + DIE_PANIC = 4, + DIE_NMI = 5, + DIE_DIE = 6, + DIE_KERNELDEBUG = 7, + DIE_TRAP = 8, + DIE_GPF = 9, + DIE_CALL = 10, + DIE_PAGE_FAULT = 11, + DIE_NMIUNKNOWN = 12, +}; + +enum kernel_gp_hint { + GP_NO_HINT = 0, + GP_NON_CANONICAL = 1, + GP_CANONICAL = 2, +}; + +struct bad_iret_stack { + void *error_entry_ret; + struct pt_regs regs; +}; + +typedef struct irq_desc *vector_irq_t[256]; + +struct trace_event_raw_x86_irq_vector { + struct trace_entry ent; + int vector; + char __data[0]; +}; + +struct trace_event_raw_vector_config { + struct trace_entry ent; + unsigned int irq; + unsigned int vector; + unsigned int cpu; + unsigned int apicdest; + char __data[0]; +}; + +struct trace_event_raw_vector_mod { + struct trace_entry ent; + unsigned int irq; + unsigned int vector; + unsigned int cpu; + unsigned int prev_vector; + unsigned int prev_cpu; + char __data[0]; +}; + +struct trace_event_raw_vector_reserve { + struct trace_entry ent; + unsigned int irq; + int ret; + char __data[0]; +}; + +struct trace_event_raw_vector_alloc { + struct trace_entry ent; + unsigned int irq; + unsigned int vector; + bool reserved; + int ret; + char __data[0]; +}; + +struct trace_event_raw_vector_alloc_managed { + struct trace_entry ent; + unsigned int irq; + unsigned int vector; + int ret; + char __data[0]; +}; + +struct trace_event_raw_vector_activate { + struct trace_entry ent; + unsigned int irq; + bool is_managed; + bool can_reserve; + bool reserve; + char __data[0]; +}; + +struct trace_event_raw_vector_teardown { + struct trace_entry ent; + unsigned int irq; + bool is_managed; + bool has_reserved; + char __data[0]; +}; + +struct trace_event_raw_vector_setup { + struct trace_entry ent; + unsigned int irq; + bool is_legacy; + int ret; + char __data[0]; +}; + +struct trace_event_raw_vector_free_moved { + struct trace_entry ent; + unsigned int irq; + unsigned int cpu; + unsigned int vector; + bool is_managed; + char __data[0]; +}; + +struct trace_event_data_offsets_x86_irq_vector {}; + +struct trace_event_data_offsets_vector_config {}; + +struct trace_event_data_offsets_vector_mod {}; + +struct trace_event_data_offsets_vector_reserve {}; + +struct trace_event_data_offsets_vector_alloc {}; + +struct trace_event_data_offsets_vector_alloc_managed {}; + +struct trace_event_data_offsets_vector_activate {}; + +struct trace_event_data_offsets_vector_teardown {}; + +struct trace_event_data_offsets_vector_setup {}; + +struct trace_event_data_offsets_vector_free_moved {}; + +typedef void (*btf_trace_local_timer_entry)(void *, int); + +typedef void (*btf_trace_local_timer_exit)(void *, int); + +typedef void (*btf_trace_spurious_apic_entry)(void *, int); + +typedef void (*btf_trace_spurious_apic_exit)(void *, int); + +typedef void (*btf_trace_error_apic_entry)(void *, int); + +typedef void (*btf_trace_error_apic_exit)(void *, int); + +typedef void (*btf_trace_x86_platform_ipi_entry)(void *, int); + +typedef void (*btf_trace_x86_platform_ipi_exit)(void *, int); + +typedef void (*btf_trace_irq_work_entry)(void *, int); + +typedef void (*btf_trace_irq_work_exit)(void *, int); + +typedef void (*btf_trace_reschedule_entry)(void *, int); + +typedef void (*btf_trace_reschedule_exit)(void *, int); + +typedef void (*btf_trace_call_function_entry)(void *, int); + +typedef void (*btf_trace_call_function_exit)(void *, int); + +typedef void (*btf_trace_call_function_single_entry)(void *, int); + +typedef void (*btf_trace_call_function_single_exit)(void *, int); + +typedef void (*btf_trace_threshold_apic_entry)(void *, int); + +typedef void (*btf_trace_threshold_apic_exit)(void *, int); + +typedef void (*btf_trace_deferred_error_apic_entry)(void *, int); + +typedef void (*btf_trace_deferred_error_apic_exit)(void *, int); + +typedef void (*btf_trace_thermal_apic_entry)(void *, int); + +typedef void (*btf_trace_thermal_apic_exit)(void *, int); + +typedef void (*btf_trace_vector_config)(void *, unsigned int, unsigned int, unsigned int, unsigned int); + +typedef void (*btf_trace_vector_update)(void *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); + +typedef void (*btf_trace_vector_clear)(void *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); + +typedef void (*btf_trace_vector_reserve_managed)(void *, unsigned int, int); + +typedef void (*btf_trace_vector_reserve)(void *, unsigned int, int); + +typedef void (*btf_trace_vector_alloc)(void *, unsigned int, unsigned int, bool, int); + +typedef void (*btf_trace_vector_alloc_managed)(void *, unsigned int, unsigned int, int); + +typedef void (*btf_trace_vector_activate)(void *, unsigned int, bool, bool, bool); + +typedef void (*btf_trace_vector_deactivate)(void *, unsigned int, bool, bool, bool); + +typedef void (*btf_trace_vector_teardown)(void *, unsigned int, bool, bool); + +typedef void (*btf_trace_vector_setup)(void *, unsigned int, bool, int); + +typedef void (*btf_trace_vector_free_moved)(void *, unsigned int, unsigned int, unsigned int, bool); + +struct estack_pages { + u32 offs; + u16 size; + u16 type; +}; + +enum refcount_saturation_type { + REFCOUNT_ADD_NOT_ZERO_OVF = 0, + REFCOUNT_ADD_OVF = 1, + REFCOUNT_ADD_UAF = 2, + REFCOUNT_SUB_UAF = 3, + REFCOUNT_DEC_LEAK = 4, +}; + +enum lockdown_reason { + LOCKDOWN_NONE = 0, + LOCKDOWN_MODULE_SIGNATURE = 1, + LOCKDOWN_DEV_MEM = 2, + LOCKDOWN_EFI_TEST = 3, + LOCKDOWN_KEXEC = 4, + LOCKDOWN_HIBERNATION = 5, + LOCKDOWN_PCI_ACCESS = 6, + LOCKDOWN_IOPORT = 7, + LOCKDOWN_MSR = 8, + LOCKDOWN_ACPI_TABLES = 9, + LOCKDOWN_PCMCIA_CIS = 10, + LOCKDOWN_TIOCSSERIAL = 11, + LOCKDOWN_MODULE_PARAMETERS = 12, + LOCKDOWN_MMIOTRACE = 13, + LOCKDOWN_DEBUGFS = 14, + LOCKDOWN_XMON_WR = 15, + LOCKDOWN_INTEGRITY_MAX = 16, + LOCKDOWN_KCORE = 17, + LOCKDOWN_KPROBES = 18, + LOCKDOWN_BPF_READ = 19, + LOCKDOWN_PERF = 20, + LOCKDOWN_TRACEFS = 21, + LOCKDOWN_XMON_RW = 22, + LOCKDOWN_XFRM_SECRET = 23, + LOCKDOWN_CONFIDENTIALITY_MAX = 24, +}; + +enum lockdep_ok { + LOCKDEP_STILL_OK = 0, + LOCKDEP_NOW_UNRELIABLE = 1, +}; + +struct trace_event_raw_nmi_handler { + struct trace_entry ent; + void *handler; + s64 delta_ns; + int handled; + char __data[0]; +}; + +struct trace_event_data_offsets_nmi_handler {}; + +typedef void (*btf_trace_nmi_handler)(void *, void *, s64, int); + +struct nmi_desc { + raw_spinlock_t lock; + struct list_head head; +}; + +struct nmi_stats { + unsigned int normal; + unsigned int unknown; + unsigned int external; + unsigned int swallow; +}; + +enum nmi_states { + NMI_NOT_RUNNING = 0, + NMI_EXECUTING = 1, + NMI_LATCHED = 2, +}; + +struct user_desc { + unsigned int entry_number; + unsigned int base_addr; + unsigned int limit; + unsigned int seg_32bit: 1; + unsigned int contents: 2; + unsigned int read_exec_only: 1; + unsigned int limit_in_pages: 1; + unsigned int seg_not_present: 1; + unsigned int useable: 1; + unsigned int lm: 1; +}; + +enum con_scroll { + SM_UP = 0, + SM_DOWN = 1, +}; + +enum vc_intensity { + VCI_HALF_BRIGHT = 0, + VCI_NORMAL = 1, + VCI_BOLD = 2, + VCI_MASK = 3, +}; + +struct vc_data; + +struct console_font; + +struct consw { + struct module *owner; + const char * (*con_startup)(); + void (*con_init)(struct vc_data *, int); + void (*con_deinit)(struct vc_data *); + void (*con_clear)(struct vc_data *, int, int, int, int); + void (*con_putc)(struct vc_data *, int, int, int); + void (*con_putcs)(struct vc_data *, const short unsigned int *, int, int, int); + void (*con_cursor)(struct vc_data *, int); + bool (*con_scroll)(struct vc_data *, unsigned int, unsigned int, enum con_scroll, unsigned int); + int (*con_switch)(struct vc_data *); + int (*con_blank)(struct vc_data *, int, int); + int (*con_font_set)(struct vc_data *, struct console_font *, unsigned int); + int (*con_font_get)(struct vc_data *, struct console_font *); + int (*con_font_default)(struct vc_data *, struct console_font *, char *); + int (*con_resize)(struct vc_data *, unsigned int, unsigned int, unsigned int); + void (*con_set_palette)(struct vc_data *, const unsigned char *); + void (*con_scrolldelta)(struct vc_data *, int); + int (*con_set_origin)(struct vc_data *); + void (*con_save_screen)(struct vc_data *); + u8 (*con_build_attr)(struct vc_data *, u8, enum vc_intensity, bool, bool, bool, bool); + void (*con_invert_region)(struct vc_data *, u16 *, int); + u16 * (*con_screen_pos)(const struct vc_data *, int); + long unsigned int (*con_getxy)(struct vc_data *, long unsigned int, int *, int *); + void (*con_flush_scrollback)(struct vc_data *); + int (*con_debug_enter)(struct vc_data *); + int (*con_debug_leave)(struct vc_data *); +}; + +struct vc_state { + unsigned int x; + unsigned int y; + unsigned char color; + unsigned char Gx_charset[2]; + unsigned int charset: 1; + enum vc_intensity intensity; + bool italic; + bool underline; + bool blink; + bool reverse; +}; + +struct console_font { + unsigned int width; + unsigned int height; + unsigned int charcount; + unsigned char *data; +}; + +struct vt_mode { + char mode; + char waitv; + short int relsig; + short int acqsig; + short int frsig; +}; + +struct uni_pagedir; + +struct uni_screen; + +struct vc_data { + struct tty_port port; + struct vc_state state; + struct vc_state saved_state; + short unsigned int vc_num; + unsigned int vc_cols; + unsigned int vc_rows; + unsigned int vc_size_row; + unsigned int vc_scan_lines; + long unsigned int vc_origin; + long unsigned int vc_scr_end; + long unsigned int vc_visible_origin; + unsigned int vc_top; + unsigned int vc_bottom; + const struct consw *vc_sw; + short unsigned int *vc_screenbuf; + unsigned int vc_screenbuf_size; + unsigned char vc_mode; + unsigned char vc_attr; + unsigned char vc_def_color; + unsigned char vc_ulcolor; + unsigned char vc_itcolor; + unsigned char vc_halfcolor; + unsigned int vc_cursor_type; + short unsigned int vc_complement_mask; + short unsigned int vc_s_complement_mask; + long unsigned int vc_pos; + short unsigned int vc_hi_font_mask; + struct console_font vc_font; + short unsigned int vc_video_erase_char; + unsigned int vc_state; + unsigned int vc_npar; + unsigned int vc_par[16]; + struct vt_mode vt_mode; + struct pid *vt_pid; + int vt_newvt; + wait_queue_head_t paste_wait; + unsigned int vc_disp_ctrl: 1; + unsigned int vc_toggle_meta: 1; + unsigned int vc_decscnm: 1; + unsigned int vc_decom: 1; + unsigned int vc_decawm: 1; + unsigned int vc_deccm: 1; + unsigned int vc_decim: 1; + unsigned int vc_priv: 3; + unsigned int vc_need_wrap: 1; + unsigned int vc_can_do_color: 1; + unsigned int vc_report_mouse: 2; + unsigned char vc_utf: 1; + unsigned char vc_utf_count; + int vc_utf_char; + long unsigned int vc_tab_stop[4]; + unsigned char vc_palette[48]; + short unsigned int *vc_translate; + unsigned int vc_resize_user; + unsigned int vc_bell_pitch; + unsigned int vc_bell_duration; + short unsigned int vc_cur_blink_ms; + struct vc_data **vc_display_fg; + struct uni_pagedir *vc_uni_pagedir; + struct uni_pagedir **vc_uni_pagedir_loc; + struct uni_screen *vc_uni_screen; +}; + +struct edd { + unsigned int mbr_signature[16]; + struct edd_info edd_info[6]; + unsigned char mbr_signature_nr; + unsigned char edd_info_nr; +}; + +struct setup_data { + __u64 next; + __u32 type; + __u32 len; + __u8 data[0]; +}; + +struct setup_indirect { + __u32 type; + __u32 reserved; + __u64 len; + __u64 addr; +}; + +enum memblock_flags { + MEMBLOCK_NONE = 0, + MEMBLOCK_HOTPLUG = 1, + MEMBLOCK_MIRROR = 2, + MEMBLOCK_NOMAP = 4, +}; + +struct memblock_region { + phys_addr_t base; + phys_addr_t size; + enum memblock_flags flags; + int nid; +}; + +struct memblock_type { + long unsigned int cnt; + long unsigned int max; + phys_addr_t total_size; + struct memblock_region *regions; + char *name; +}; + +struct memblock { + bool bottom_up; + phys_addr_t current_limit; + struct memblock_type memory; + struct memblock_type reserved; +}; + +struct x86_msi_ops { + void (*restore_msi_irqs)(struct pci_dev *); +}; + +struct msi_controller { + struct module *owner; + struct device *dev; + struct device_node *of_node; + struct list_head list; + int (*setup_irq)(struct msi_controller *, struct pci_dev *, struct msi_desc *); + int (*setup_irqs)(struct msi_controller *, struct pci_dev *, int, int); + void (*teardown_irq)(struct msi_controller *, unsigned int); +}; + +struct legacy_pic { + int nr_legacy_irqs; + struct irq_chip *chip; + void (*mask)(unsigned int); + void (*unmask)(unsigned int); + void (*mask_all)(); + void (*restore_mask)(); + void (*init)(int); + int (*probe)(); + int (*irq_pending)(unsigned int); + void (*make_irq)(unsigned int); +}; + +enum jump_label_type { + JUMP_LABEL_NOP = 0, + JUMP_LABEL_JMP = 1, +}; + +union text_poke_insn { + u8 text[5]; + struct { + u8 opcode; + s32 disp; + } __attribute__((packed)); +}; + +enum { + JL_STATE_START = 0, + JL_STATE_NO_UPDATE = 1, + JL_STATE_UPDATE = 2, +}; + +typedef short unsigned int __kernel_old_uid_t; + +typedef short unsigned int __kernel_old_gid_t; + +typedef struct { + int val[2]; +} __kernel_fsid_t; + +typedef __kernel_old_uid_t old_uid_t; + +typedef __kernel_old_gid_t old_gid_t; + +struct kernel_clone_args { + u64 flags; + int *pidfd; + int *child_tid; + int *parent_tid; + int exit_signal; + long unsigned int stack; + long unsigned int stack_size; + long unsigned int tls; + pid_t *set_tid; + size_t set_tid_size; + int cgroup; + struct cgroup *cgrp; + struct css_set *cset; +}; + +struct kstatfs { + long int f_type; + long int f_bsize; + u64 f_blocks; + u64 f_bfree; + u64 f_bavail; + u64 f_files; + u64 f_ffree; + __kernel_fsid_t f_fsid; + long int f_namelen; + long int f_frsize; + long int f_flags; + long int f_spare[4]; +}; + +struct stat64 { + long long unsigned int st_dev; + unsigned char __pad0[4]; + unsigned int __st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + long long unsigned int st_rdev; + unsigned char __pad3[4]; + long long int st_size; + unsigned int st_blksize; + long long int st_blocks; + unsigned int st_atime; + unsigned int st_atime_nsec; + unsigned int st_mtime; + unsigned int st_mtime_nsec; + unsigned int st_ctime; + unsigned int st_ctime_nsec; + long long unsigned int st_ino; +} __attribute__((packed)); + +struct mmap_arg_struct32 { + unsigned int addr; + unsigned int len; + unsigned int prot; + unsigned int flags; + unsigned int fd; + unsigned int offset; +}; + +struct vm_unmapped_area_info { + long unsigned int flags; + long unsigned int length; + long unsigned int low_limit; + long unsigned int high_limit; + long unsigned int align_mask; + long unsigned int align_offset; +}; + +enum align_flags { + ALIGN_VA_32 = 1, + ALIGN_VA_64 = 2, +}; + +struct va_alignment { + int flags; + long unsigned int mask; + long unsigned int bits; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum { + MEMREMAP_WB = 1, + MEMREMAP_WT = 2, + MEMREMAP_WC = 4, + MEMREMAP_ENC = 8, + MEMREMAP_DEC = 16, +}; + +typedef void (*swap_func_t)(void *, void *, int); + +typedef int (*cmp_func_t)(const void *, const void *); + +enum { + IORES_DESC_NONE = 0, + IORES_DESC_CRASH_KERNEL = 1, + IORES_DESC_ACPI_TABLES = 2, + IORES_DESC_ACPI_NV_STORAGE = 3, + IORES_DESC_PERSISTENT_MEMORY = 4, + IORES_DESC_PERSISTENT_MEMORY_LEGACY = 5, + IORES_DESC_DEVICE_PRIVATE_MEMORY = 6, + IORES_DESC_RESERVED = 7, + IORES_DESC_SOFT_RESERVED = 8, +}; + +struct change_member { + struct e820_entry *entry; + long long unsigned int addr; +}; + +struct iommu_fault_param; + +struct iommu_fwspec; + +struct dev_iommu { + struct mutex lock; + struct iommu_fault_param *fault_param; + struct iommu_fwspec *fwspec; + struct iommu_device *iommu_dev; + void *priv; +}; + +struct of_phandle_args { + struct device_node *np; + int args_count; + uint32_t args[16]; +}; + +struct iommu_fault_unrecoverable { + __u32 reason; + __u32 flags; + __u32 pasid; + __u32 perm; + __u64 addr; + __u64 fetch_addr; +}; + +struct iommu_fault_page_request { + __u32 flags; + __u32 pasid; + __u32 grpid; + __u32 perm; + __u64 addr; + __u64 private_data[2]; +}; + +struct iommu_fault { + __u32 type; + __u32 padding; + union { + struct iommu_fault_unrecoverable event; + struct iommu_fault_page_request prm; + __u8 padding2[56]; + }; +}; + +struct iommu_page_response { + __u32 argsz; + __u32 version; + __u32 flags; + __u32 pasid; + __u32 grpid; + __u32 code; +}; + +struct iommu_inv_addr_info { + __u32 flags; + __u32 archid; + __u64 pasid; + __u64 addr; + __u64 granule_size; + __u64 nb_granules; +}; + +struct iommu_inv_pasid_info { + __u32 flags; + __u32 archid; + __u64 pasid; +}; + +struct iommu_cache_invalidate_info { + __u32 argsz; + __u32 version; + __u8 cache; + __u8 granularity; + __u8 padding[6]; + union { + struct iommu_inv_pasid_info pasid_info; + struct iommu_inv_addr_info addr_info; + } granu; +}; + +struct iommu_gpasid_bind_data_vtd { + __u64 flags; + __u32 pat; + __u32 emt; +}; + +struct iommu_gpasid_bind_data { + __u32 argsz; + __u32 version; + __u32 format; + __u32 addr_width; + __u64 flags; + __u64 gpgd; + __u64 hpasid; + __u64 gpasid; + __u8 padding[8]; + union { + struct iommu_gpasid_bind_data_vtd vtd; + } vendor; +}; + +typedef int (*iommu_fault_handler_t)(struct iommu_domain *, struct device *, long unsigned int, int, void *); + +struct iommu_domain_geometry { + dma_addr_t aperture_start; + dma_addr_t aperture_end; + bool force_aperture; +}; + +struct iommu_domain { + unsigned int type; + const struct iommu_ops *ops; + long unsigned int pgsize_bitmap; + iommu_fault_handler_t handler; + void *handler_token; + struct iommu_domain_geometry geometry; + void *iova_cookie; +}; + +typedef int (*iommu_dev_fault_handler_t)(struct iommu_fault *, void *); + +enum iommu_resv_type { + IOMMU_RESV_DIRECT = 0, + IOMMU_RESV_DIRECT_RELAXABLE = 1, + IOMMU_RESV_RESERVED = 2, + IOMMU_RESV_MSI = 3, + IOMMU_RESV_SW_MSI = 4, +}; + +struct iommu_resv_region { + struct list_head list; + phys_addr_t start; + size_t length; + int prot; + enum iommu_resv_type type; +}; + +struct iommu_iotlb_gather { + long unsigned int start; + long unsigned int end; + size_t pgsize; + struct page *freelist; +}; + +struct iommu_device { + struct list_head list; + const struct iommu_ops *ops; + struct fwnode_handle *fwnode; + struct device *dev; +}; + +struct iommu_sva { + struct device *dev; +}; + +struct iommu_fault_event { + struct iommu_fault fault; + struct list_head list; +}; + +struct iommu_fault_param { + iommu_dev_fault_handler_t handler; + void *data; + struct list_head faults; + struct mutex lock; +}; + +struct iommu_fwspec { + const struct iommu_ops *ops; + struct fwnode_handle *iommu_fwnode; + u32 flags; + u32 num_pasid_bits; + unsigned int num_ids; + u32 ids[0]; +}; + +enum dmi_field { + DMI_NONE = 0, + DMI_BIOS_VENDOR = 1, + DMI_BIOS_VERSION = 2, + DMI_BIOS_DATE = 3, + DMI_BIOS_RELEASE = 4, + DMI_EC_FIRMWARE_RELEASE = 5, + DMI_SYS_VENDOR = 6, + DMI_PRODUCT_NAME = 7, + DMI_PRODUCT_VERSION = 8, + DMI_PRODUCT_SERIAL = 9, + DMI_PRODUCT_UUID = 10, + DMI_PRODUCT_SKU = 11, + DMI_PRODUCT_FAMILY = 12, + DMI_BOARD_VENDOR = 13, + DMI_BOARD_NAME = 14, + DMI_BOARD_VERSION = 15, + DMI_BOARD_SERIAL = 16, + DMI_BOARD_ASSET_TAG = 17, + DMI_CHASSIS_VENDOR = 18, + DMI_CHASSIS_TYPE = 19, + DMI_CHASSIS_VERSION = 20, + DMI_CHASSIS_SERIAL = 21, + DMI_CHASSIS_ASSET_TAG = 22, + DMI_STRING_MAX = 23, + DMI_OEM_STRING = 24, +}; + +struct acpi_device; + +struct pci_sysdata { + int domain; + int node; + struct acpi_device *companion; + void *iommu; + void *fwnode; + struct pci_dev *vmd_dev; +}; + +enum { + NONE_FORCE_HPET_RESUME = 0, + OLD_ICH_FORCE_HPET_RESUME = 1, + ICH_FORCE_HPET_RESUME = 2, + VT8237_FORCE_HPET_RESUME = 3, + NVIDIA_FORCE_HPET_RESUME = 4, + ATI_FORCE_HPET_RESUME = 5, +}; + +enum meminit_context { + MEMINIT_EARLY = 0, + MEMINIT_HOTPLUG = 1, +}; + +struct cpu { + int node_id; + int hotpluggable; + struct device dev; +}; + +struct x86_cpu { + struct cpu cpu; +}; + +struct debugfs_blob_wrapper { + void *data; + long unsigned int size; +}; + +struct setup_data_node { + u64 paddr; + u32 type; + u32 len; +}; + +struct paravirt_patch_site { + u8 *instr; + u8 type; + u8 len; +}; + +struct die_args { + struct pt_regs *regs; + const char *str; + long int err; + int trapnr; + int signr; +}; + +struct smp_alt_module { + struct module *mod; + char *name; + const s32 *locks; + const s32 *locks_end; + u8 *text; + u8 *text_end; + struct list_head next; +}; + +typedef struct { + struct mm_struct *mm; +} temp_mm_state_t; + +struct text_poke_loc { + s32 rel_addr; + s32 rel32; + u8 opcode; + const u8 text[5]; + u8 old; +}; + +struct bp_patching_desc { + struct text_poke_loc *vec; + int nr_entries; + atomic_t refs; +}; + +enum { + HW_BREAKPOINT_LEN_1 = 1, + HW_BREAKPOINT_LEN_2 = 2, + HW_BREAKPOINT_LEN_3 = 3, + HW_BREAKPOINT_LEN_4 = 4, + HW_BREAKPOINT_LEN_5 = 5, + HW_BREAKPOINT_LEN_6 = 6, + HW_BREAKPOINT_LEN_7 = 7, + HW_BREAKPOINT_LEN_8 = 8, +}; + +enum { + HW_BREAKPOINT_EMPTY = 0, + HW_BREAKPOINT_R = 1, + HW_BREAKPOINT_W = 2, + HW_BREAKPOINT_RW = 3, + HW_BREAKPOINT_X = 4, + HW_BREAKPOINT_INVALID = 7, +}; + +typedef unsigned int u_int; + +typedef long long unsigned int cycles_t; + +struct system_counterval_t { + u64 cycles; + struct clocksource *cs; +}; + +typedef struct { + seqcount_t seqcount; +} seqcount_latch_t; + +enum cpufreq_table_sorting { + CPUFREQ_TABLE_UNSORTED = 0, + CPUFREQ_TABLE_SORTED_ASCENDING = 1, + CPUFREQ_TABLE_SORTED_DESCENDING = 2, +}; + +struct cpufreq_cpuinfo { + unsigned int max_freq; + unsigned int min_freq; + unsigned int transition_latency; +}; + +struct clk; + +struct cpufreq_governor; + +struct cpufreq_frequency_table; + +struct cpufreq_stats; + +struct thermal_cooling_device; + +struct cpufreq_policy { + cpumask_var_t cpus; + cpumask_var_t related_cpus; + cpumask_var_t real_cpus; + unsigned int shared_type; + unsigned int cpu; + struct clk *clk; + struct cpufreq_cpuinfo cpuinfo; + unsigned int min; + unsigned int max; + unsigned int cur; + unsigned int suspend_freq; + unsigned int policy; + unsigned int last_policy; + struct cpufreq_governor *governor; + void *governor_data; + char last_governor[16]; + struct work_struct update; + struct freq_constraints constraints; + struct freq_qos_request *min_freq_req; + struct freq_qos_request *max_freq_req; + struct cpufreq_frequency_table *freq_table; + enum cpufreq_table_sorting freq_table_sorted; + struct list_head policy_list; + struct kobject kobj; + struct completion kobj_unregister; + struct rw_semaphore rwsem; + bool fast_switch_possible; + bool fast_switch_enabled; + bool strict_target; + unsigned int transition_delay_us; + bool dvfs_possible_from_any_cpu; + unsigned int cached_target_freq; + unsigned int cached_resolved_idx; + bool transition_ongoing; + spinlock_t transition_lock; + wait_queue_head_t transition_wait; + struct task_struct *transition_task; + struct cpufreq_stats *stats; + void *driver_data; + struct thermal_cooling_device *cdev; + struct notifier_block nb_min; + struct notifier_block nb_max; +}; + +struct cpufreq_governor { + char name[16]; + int (*init)(struct cpufreq_policy *); + void (*exit)(struct cpufreq_policy *); + int (*start)(struct cpufreq_policy *); + void (*stop)(struct cpufreq_policy *); + void (*limits)(struct cpufreq_policy *); + ssize_t (*show_setspeed)(struct cpufreq_policy *, char *); + int (*store_setspeed)(struct cpufreq_policy *, unsigned int); + struct list_head governor_list; + struct module *owner; + u8 flags; +}; + +struct cpufreq_frequency_table { + unsigned int flags; + unsigned int driver_data; + unsigned int frequency; +}; + +struct cpufreq_freqs { + struct cpufreq_policy *policy; + unsigned int old; + unsigned int new; + u8 flags; +}; + +struct cyc2ns { + struct cyc2ns_data data[2]; + seqcount_latch_t seq; +}; + +struct x86_cpu_id { + __u16 vendor; + __u16 family; + __u16 model; + __u16 steppings; + __u16 feature; + kernel_ulong_t driver_data; +}; + +struct muldiv { + u32 multiplier; + u32 divider; +}; + +struct freq_desc { + bool use_msr_plat; + struct muldiv muldiv[16]; + u32 freqs[16]; + u32 mask; +}; + +struct dmi_strmatch { + unsigned char slot: 7; + unsigned char exact_match: 1; + char substr[79]; +}; + +struct dmi_system_id { + int (*callback)(const struct dmi_system_id *); + const char *ident; + struct dmi_strmatch matches[4]; + void *driver_data; +}; + +struct pdev_archdata {}; + +struct platform_device_id; + +struct mfd_cell; + +struct platform_device { + const char *name; + int id; + bool id_auto; + struct device dev; + u64 platform_dma_mask; + struct device_dma_parameters dma_parms; + u32 num_resources; + struct resource *resource; + const struct platform_device_id *id_entry; + char *driver_override; + struct mfd_cell *mfd_cell; + struct pdev_archdata archdata; +}; + +struct platform_device_id { + char name[20]; + kernel_ulong_t driver_data; +}; + +struct rtc_time { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; +}; + +struct pnp_device_id { + __u8 id[8]; + kernel_ulong_t driver_data; +}; + +struct pnp_card_device_id { + __u8 id[8]; + kernel_ulong_t driver_data; + struct { + __u8 id[8]; + } devs[8]; +}; + +struct acpi_table_header { + char signature[4]; + u32 length; + u8 revision; + u8 checksum; + char oem_id[6]; + char oem_table_id[8]; + u32 oem_revision; + char asl_compiler_id[4]; + u32 asl_compiler_revision; +}; + +struct acpi_generic_address { + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_width; + u64 address; +} __attribute__((packed)); + +struct acpi_table_fadt { + struct acpi_table_header header; + u32 facs; + u32 dsdt; + u8 model; + u8 preferred_profile; + u16 sci_interrupt; + u32 smi_command; + u8 acpi_enable; + u8 acpi_disable; + u8 s4_bios_request; + u8 pstate_control; + u32 pm1a_event_block; + u32 pm1b_event_block; + u32 pm1a_control_block; + u32 pm1b_control_block; + u32 pm2_control_block; + u32 pm_timer_block; + u32 gpe0_block; + u32 gpe1_block; + u8 pm1_event_length; + u8 pm1_control_length; + u8 pm2_control_length; + u8 pm_timer_length; + u8 gpe0_block_length; + u8 gpe1_block_length; + u8 gpe1_base; + u8 cst_control; + u16 c2_latency; + u16 c3_latency; + u16 flush_size; + u16 flush_stride; + u8 duty_offset; + u8 duty_width; + u8 day_alarm; + u8 month_alarm; + u8 century; + u16 boot_flags; + u8 reserved; + u32 flags; + struct acpi_generic_address reset_register; + u8 reset_value; + u16 arm_boot_flags; + u8 minor_revision; + u64 Xfacs; + u64 Xdsdt; + struct acpi_generic_address xpm1a_event_block; + struct acpi_generic_address xpm1b_event_block; + struct acpi_generic_address xpm1a_control_block; + struct acpi_generic_address xpm1b_control_block; + struct acpi_generic_address xpm2_control_block; + struct acpi_generic_address xpm_timer_block; + struct acpi_generic_address xgpe0_block; + struct acpi_generic_address xgpe1_block; + struct acpi_generic_address sleep_control; + struct acpi_generic_address sleep_status; + u64 hypervisor_id; +} __attribute__((packed)); + +struct pnp_protocol; + +struct pnp_id; + +struct pnp_card { + struct device dev; + unsigned char number; + struct list_head global_list; + struct list_head protocol_list; + struct list_head devices; + struct pnp_protocol *protocol; + struct pnp_id *id; + char name[50]; + unsigned char pnpver; + unsigned char productver; + unsigned int serial; + unsigned char checksum; + struct proc_dir_entry *procdir; +}; + +struct pnp_dev; + +struct pnp_protocol { + struct list_head protocol_list; + char *name; + int (*get)(struct pnp_dev *); + int (*set)(struct pnp_dev *); + int (*disable)(struct pnp_dev *); + bool (*can_wakeup)(struct pnp_dev *); + int (*suspend)(struct pnp_dev *, pm_message_t); + int (*resume)(struct pnp_dev *); + unsigned char number; + struct device dev; + struct list_head cards; + struct list_head devices; +}; + +struct pnp_id { + char id[8]; + struct pnp_id *next; +}; + +struct pnp_card_driver; + +struct pnp_card_link { + struct pnp_card *card; + struct pnp_card_driver *driver; + void *driver_data; + pm_message_t pm_state; +}; + +struct pnp_driver { + const char *name; + const struct pnp_device_id *id_table; + unsigned int flags; + int (*probe)(struct pnp_dev *, const struct pnp_device_id *); + void (*remove)(struct pnp_dev *); + void (*shutdown)(struct pnp_dev *); + int (*suspend)(struct pnp_dev *, pm_message_t); + int (*resume)(struct pnp_dev *); + struct device_driver driver; +}; + +struct pnp_card_driver { + struct list_head global_list; + char *name; + const struct pnp_card_device_id *id_table; + unsigned int flags; + int (*probe)(struct pnp_card_link *, const struct pnp_card_device_id *); + void (*remove)(struct pnp_card_link *); + int (*suspend)(struct pnp_card_link *, pm_message_t); + int (*resume)(struct pnp_card_link *); + struct pnp_driver link; +}; + +struct pnp_dev { + struct device dev; + u64 dma_mask; + unsigned int number; + int status; + struct list_head global_list; + struct list_head protocol_list; + struct list_head card_list; + struct list_head rdev_list; + struct pnp_protocol *protocol; + struct pnp_card *card; + struct pnp_driver *driver; + struct pnp_card_link *card_link; + struct pnp_id *id; + int active; + int capabilities; + unsigned int num_dependent_sets; + struct list_head resources; + struct list_head options; + char name[50]; + int flags; + struct proc_dir_entry *procent; + void *data; +}; + +enum insn_type { + CALL = 0, + NOP = 1, + JMP = 2, + RET = 3, +}; + +struct ldttss_desc { + u16 limit0; + u16 base0; + u16 base1: 8; + u16 type: 5; + u16 dpl: 2; + u16 p: 1; + u16 limit1: 4; + u16 zero0: 3; + u16 g: 1; + u16 base2: 8; + u32 base3; + u32 zero1; +}; + +typedef struct ldttss_desc tss_desc; + +enum idle_boot_override { + IDLE_NO_OVERRIDE = 0, + IDLE_HALT = 1, + IDLE_NOMWAIT = 2, + IDLE_POLL = 3, +}; + +enum tick_broadcast_mode { + TICK_BROADCAST_OFF = 0, + TICK_BROADCAST_ON = 1, + TICK_BROADCAST_FORCE = 2, +}; + +enum tick_broadcast_state { + TICK_BROADCAST_EXIT = 0, + TICK_BROADCAST_ENTER = 1, +}; + +struct inactive_task_frame { + long unsigned int r15; + long unsigned int r14; + long unsigned int r13; + long unsigned int r12; + long unsigned int bx; + long unsigned int bp; + long unsigned int ret_addr; +}; + +struct fork_frame { + struct inactive_task_frame frame; + struct pt_regs regs; +}; + +struct ssb_state { + struct ssb_state *shared_state; + raw_spinlock_t lock; + unsigned int disable_state; + long unsigned int local_state; +}; + +struct trace_event_raw_x86_fpu { + struct trace_entry ent; + struct fpu *fpu; + bool load_fpu; + u64 xfeatures; + u64 xcomp_bv; + char __data[0]; +}; + +struct trace_event_data_offsets_x86_fpu {}; + +typedef void (*btf_trace_x86_fpu_before_save)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_after_save)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_before_restore)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_after_restore)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_regs_activated)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_regs_deactivated)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_init_state)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_dropped)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_copy_src)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_copy_dst)(void *, struct fpu *); + +typedef void (*btf_trace_x86_fpu_xstate_check_failed)(void *, struct fpu *); + +struct _fpreg { + __u16 significand[4]; + __u16 exponent; +}; + +struct _fpxreg { + __u16 significand[4]; + __u16 exponent; + __u16 padding[3]; +}; + +struct user_i387_ia32_struct { + u32 cwd; + u32 swd; + u32 twd; + u32 fip; + u32 fcs; + u32 foo; + u32 fos; + u32 st_space[20]; +}; + +struct membuf { + void *p; + size_t left; +}; + +struct user_regset; + +typedef int user_regset_active_fn(struct task_struct *, const struct user_regset *); + +typedef int user_regset_get2_fn(struct task_struct *, const struct user_regset *, struct membuf); + +typedef int user_regset_set_fn(struct task_struct *, const struct user_regset *, unsigned int, unsigned int, const void *, const void *); + +typedef int user_regset_writeback_fn(struct task_struct *, const struct user_regset *, int); + +struct user_regset { + user_regset_get2_fn *regset_get; + user_regset_set_fn *set; + user_regset_active_fn *active; + user_regset_writeback_fn *writeback; + unsigned int n; + unsigned int size; + unsigned int align; + unsigned int bias; + unsigned int core_note_type; +}; + +struct _fpx_sw_bytes { + __u32 magic1; + __u32 extended_size; + __u64 xfeatures; + __u32 xstate_size; + __u32 padding[7]; +}; + +struct _xmmreg { + __u32 element[4]; +}; + +struct _fpstate_32 { + __u32 cw; + __u32 sw; + __u32 tag; + __u32 ipoff; + __u32 cssel; + __u32 dataoff; + __u32 datasel; + struct _fpreg _st[8]; + __u16 status; + __u16 magic; + __u32 _fxsr_env[6]; + __u32 mxcsr; + __u32 reserved; + struct _fpxreg _fxsr_st[8]; + struct _xmmreg _xmm[8]; + union { + __u32 padding1[44]; + __u32 padding[44]; + }; + union { + __u32 padding2[12]; + struct _fpx_sw_bytes sw_reserved; + }; +}; + +struct ia32_pasid_state { + u64 pasid; +}; + +typedef u32 compat_ulong_t; + +struct user_regset_view { + const char *name; + const struct user_regset *regsets; + unsigned int n; + u32 e_flags; + u16 e_machine; + u8 ei_osabi; +}; + +enum x86_regset { + REGSET_GENERAL = 0, + REGSET_FP = 1, + REGSET_XFP = 2, + REGSET_IOPERM64 = 2, + REGSET_XSTATE = 3, + REGSET_TLS = 4, + REGSET_IOPERM32 = 5, +}; + +struct pt_regs_offset { + const char *name; + int offset; +}; + +enum { + TB_SHUTDOWN_REBOOT = 0, + TB_SHUTDOWN_S5 = 1, + TB_SHUTDOWN_S4 = 2, + TB_SHUTDOWN_S3 = 3, + TB_SHUTDOWN_HALT = 4, + TB_SHUTDOWN_WFS = 5, +}; + +struct tboot_mac_region { + u64 start; + u32 size; +} __attribute__((packed)); + +struct tboot_acpi_generic_address { + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_width; + u64 address; +} __attribute__((packed)); + +struct tboot_acpi_sleep_info { + struct tboot_acpi_generic_address pm1a_cnt_blk; + struct tboot_acpi_generic_address pm1b_cnt_blk; + struct tboot_acpi_generic_address pm1a_evt_blk; + struct tboot_acpi_generic_address pm1b_evt_blk; + u16 pm1a_cnt_val; + u16 pm1b_cnt_val; + u64 wakeup_vector; + u32 vector_width; + u64 kernel_s3_resume_vector; +} __attribute__((packed)); + +struct tboot { + u8 uuid[16]; + u32 version; + u32 log_addr; + u32 shutdown_entry; + u32 shutdown_type; + struct tboot_acpi_sleep_info acpi_sinfo; + u32 tboot_base; + u32 tboot_size; + u8 num_mac_regions; + struct tboot_mac_region mac_regions[32]; + u8 s3_key[64]; + u8 reserved_align[3]; + u32 num_in_wfs; +} __attribute__((packed)); + +struct sha1_hash { + u8 hash[20]; +}; + +struct sinit_mle_data { + u32 version; + struct sha1_hash bios_acm_id; + u32 edx_senter_flags; + u64 mseg_valid; + struct sha1_hash sinit_hash; + struct sha1_hash mle_hash; + struct sha1_hash stm_hash; + struct sha1_hash lcp_policy_hash; + u32 lcp_policy_control; + u32 rlp_wakeup_addr; + u32 reserved; + u32 num_mdrs; + u32 mdrs_off; + u32 num_vtd_dmars; + u32 vtd_dmars_off; +} __attribute__((packed)); + +typedef bool (*stack_trace_consume_fn)(void *, long unsigned int); + +struct stack_frame_user { + const void *next_fp; + long unsigned int ret_addr; +}; + +enum cache_type { + CACHE_TYPE_NOCACHE = 0, + CACHE_TYPE_INST = 1, + CACHE_TYPE_DATA = 2, + CACHE_TYPE_SEPARATE = 3, + CACHE_TYPE_UNIFIED = 4, +}; + +struct cacheinfo { + unsigned int id; + enum cache_type type; + unsigned int level; + unsigned int coherency_line_size; + unsigned int number_of_sets; + unsigned int ways_of_associativity; + unsigned int physical_line_partition; + unsigned int size; + cpumask_t shared_cpu_map; + unsigned int attributes; + void *fw_token; + bool disable_sysfs; + void *priv; +}; + +struct cpu_cacheinfo { + struct cacheinfo *info_list; + unsigned int num_levels; + unsigned int num_leaves; + bool cpu_map_populated; +}; + +struct amd_l3_cache { + unsigned int indices; + u8 subcaches[4]; +}; + +struct threshold_block { + unsigned int block; + unsigned int bank; + unsigned int cpu; + u32 address; + u16 interrupt_enable; + bool interrupt_capable; + u16 threshold_limit; + struct kobject kobj; + struct list_head miscj; +}; + +struct threshold_bank { + struct kobject *kobj; + struct threshold_block *blocks; + refcount_t cpus; + unsigned int shared; +}; + +struct amd_northbridge { + struct pci_dev *root; + struct pci_dev *misc; + struct pci_dev *link; + struct amd_l3_cache l3_cache; + struct threshold_bank *bank4; +}; + +struct _cache_table { + unsigned char descriptor; + char cache_type; + short int size; +}; + +enum _cache_type { + CTYPE_NULL = 0, + CTYPE_DATA = 1, + CTYPE_INST = 2, + CTYPE_UNIFIED = 3, +}; + +union _cpuid4_leaf_eax { + struct { + enum _cache_type type: 5; + unsigned int level: 3; + unsigned int is_self_initializing: 1; + unsigned int is_fully_associative: 1; + unsigned int reserved: 4; + unsigned int num_threads_sharing: 12; + unsigned int num_cores_on_die: 6; + } split; + u32 full; +}; + +union _cpuid4_leaf_ebx { + struct { + unsigned int coherency_line_size: 12; + unsigned int physical_line_partition: 10; + unsigned int ways_of_associativity: 10; + } split; + u32 full; +}; + +union _cpuid4_leaf_ecx { + struct { + unsigned int number_of_sets: 32; + } split; + u32 full; +}; + +struct _cpuid4_info_regs { + union _cpuid4_leaf_eax eax; + union _cpuid4_leaf_ebx ebx; + union _cpuid4_leaf_ecx ecx; + unsigned int id; + long unsigned int size; + struct amd_northbridge *nb; +}; + +union l1_cache { + struct { + unsigned int line_size: 8; + unsigned int lines_per_tag: 8; + unsigned int assoc: 8; + unsigned int size_in_kb: 8; + }; + unsigned int val; +}; + +union l2_cache { + struct { + unsigned int line_size: 8; + unsigned int lines_per_tag: 4; + unsigned int assoc: 4; + unsigned int size_in_kb: 16; + }; + unsigned int val; +}; + +union l3_cache { + struct { + unsigned int line_size: 8; + unsigned int lines_per_tag: 4; + unsigned int assoc: 4; + unsigned int res: 2; + unsigned int size_encoded: 14; + }; + unsigned int val; +}; + +struct cpuid_bit { + u16 feature; + u8 reg; + u8 bit; + u32 level; + u32 sub_leaf; +}; + +enum cpuid_leafs { + CPUID_1_EDX = 0, + CPUID_8000_0001_EDX = 1, + CPUID_8086_0001_EDX = 2, + CPUID_LNX_1 = 3, + CPUID_1_ECX = 4, + CPUID_C000_0001_EDX = 5, + CPUID_8000_0001_ECX = 6, + CPUID_LNX_2 = 7, + CPUID_LNX_3 = 8, + CPUID_7_0_EBX = 9, + CPUID_D_1_EAX = 10, + CPUID_LNX_4 = 11, + CPUID_7_1_EAX = 12, + CPUID_8000_0008_EBX = 13, + CPUID_6_EAX = 14, + CPUID_8000_000A_EDX = 15, + CPUID_7_ECX = 16, + CPUID_8000_0007_EBX = 17, + CPUID_7_EDX = 18, +}; + +enum kgdb_bptype { + BP_BREAKPOINT = 0, + BP_HARDWARE_BREAKPOINT = 1, + BP_WRITE_WATCHPOINT = 2, + BP_READ_WATCHPOINT = 3, + BP_ACCESS_WATCHPOINT = 4, + BP_POKE_BREAKPOINT = 5, +}; + +struct kgdb_arch { + unsigned char gdb_bpt_instr[1]; + long unsigned int flags; + int (*set_breakpoint)(long unsigned int, char *); + int (*remove_breakpoint)(long unsigned int, char *); + int (*set_hw_breakpoint)(long unsigned int, int, enum kgdb_bptype); + int (*remove_hw_breakpoint)(long unsigned int, int, enum kgdb_bptype); + void (*disable_hw_break)(struct pt_regs *); + void (*remove_all_hw_break)(); + void (*correct_hw_break)(); + void (*enable_nmi)(bool); +}; + +struct cpu_dev { + const char *c_vendor; + const char *c_ident[2]; + void (*c_early_init)(struct cpuinfo_x86 *); + void (*c_bsp_init)(struct cpuinfo_x86 *); + void (*c_init)(struct cpuinfo_x86 *); + void (*c_identify)(struct cpuinfo_x86 *); + void (*c_detect_tlb)(struct cpuinfo_x86 *); + int c_x86_vendor; +}; + +struct cpuid_dependent_feature { + u32 feature; + u32 level; +}; + +enum spectre_v2_mitigation { + SPECTRE_V2_NONE = 0, + SPECTRE_V2_RETPOLINE_GENERIC = 1, + SPECTRE_V2_RETPOLINE_AMD = 2, + SPECTRE_V2_IBRS_ENHANCED = 3, +}; + +enum spectre_v2_user_mitigation { + SPECTRE_V2_USER_NONE = 0, + SPECTRE_V2_USER_STRICT = 1, + SPECTRE_V2_USER_STRICT_PREFERRED = 2, + SPECTRE_V2_USER_PRCTL = 3, + SPECTRE_V2_USER_SECCOMP = 4, +}; + +enum ssb_mitigation { + SPEC_STORE_BYPASS_NONE = 0, + SPEC_STORE_BYPASS_DISABLE = 1, + SPEC_STORE_BYPASS_PRCTL = 2, + SPEC_STORE_BYPASS_SECCOMP = 3, +}; + +enum l1tf_mitigations { + L1TF_MITIGATION_OFF = 0, + L1TF_MITIGATION_FLUSH_NOWARN = 1, + L1TF_MITIGATION_FLUSH = 2, + L1TF_MITIGATION_FLUSH_NOSMT = 3, + L1TF_MITIGATION_FULL = 4, + L1TF_MITIGATION_FULL_FORCE = 5, +}; + +enum mds_mitigations { + MDS_MITIGATION_OFF = 0, + MDS_MITIGATION_FULL = 1, + MDS_MITIGATION_VMWERV = 2, +}; + +enum cpuhp_smt_control { + CPU_SMT_ENABLED = 0, + CPU_SMT_DISABLED = 1, + CPU_SMT_FORCE_DISABLED = 2, + CPU_SMT_NOT_SUPPORTED = 3, + CPU_SMT_NOT_IMPLEMENTED = 4, +}; + +enum vmx_l1d_flush_state { + VMENTER_L1D_FLUSH_AUTO = 0, + VMENTER_L1D_FLUSH_NEVER = 1, + VMENTER_L1D_FLUSH_COND = 2, + VMENTER_L1D_FLUSH_ALWAYS = 3, + VMENTER_L1D_FLUSH_EPT_DISABLED = 4, + VMENTER_L1D_FLUSH_NOT_REQUIRED = 5, +}; + +enum taa_mitigations { + TAA_MITIGATION_OFF = 0, + TAA_MITIGATION_UCODE_NEEDED = 1, + TAA_MITIGATION_VERW = 2, + TAA_MITIGATION_TSX_DISABLED = 3, +}; + +enum srbds_mitigations { + SRBDS_MITIGATION_OFF = 0, + SRBDS_MITIGATION_UCODE_NEEDED = 1, + SRBDS_MITIGATION_FULL = 2, + SRBDS_MITIGATION_TSX_OFF = 3, + SRBDS_MITIGATION_HYPERVISOR = 4, +}; + +enum spectre_v1_mitigation { + SPECTRE_V1_MITIGATION_NONE = 0, + SPECTRE_V1_MITIGATION_AUTO = 1, +}; + +enum spectre_v2_mitigation_cmd { + SPECTRE_V2_CMD_NONE = 0, + SPECTRE_V2_CMD_AUTO = 1, + SPECTRE_V2_CMD_FORCE = 2, + SPECTRE_V2_CMD_RETPOLINE = 3, + SPECTRE_V2_CMD_RETPOLINE_GENERIC = 4, + SPECTRE_V2_CMD_RETPOLINE_AMD = 5, +}; + +enum spectre_v2_user_cmd { + SPECTRE_V2_USER_CMD_NONE = 0, + SPECTRE_V2_USER_CMD_AUTO = 1, + SPECTRE_V2_USER_CMD_FORCE = 2, + SPECTRE_V2_USER_CMD_PRCTL = 3, + SPECTRE_V2_USER_CMD_PRCTL_IBPB = 4, + SPECTRE_V2_USER_CMD_SECCOMP = 5, + SPECTRE_V2_USER_CMD_SECCOMP_IBPB = 6, +}; + +enum ssb_mitigation_cmd { + SPEC_STORE_BYPASS_CMD_NONE = 0, + SPEC_STORE_BYPASS_CMD_AUTO = 1, + SPEC_STORE_BYPASS_CMD_ON = 2, + SPEC_STORE_BYPASS_CMD_PRCTL = 3, + SPEC_STORE_BYPASS_CMD_SECCOMP = 4, +}; + +enum hk_flags { + HK_FLAG_TIMER = 1, + HK_FLAG_RCU = 2, + HK_FLAG_MISC = 4, + HK_FLAG_SCHED = 8, + HK_FLAG_TICK = 16, + HK_FLAG_DOMAIN = 32, + HK_FLAG_WQ = 64, + HK_FLAG_MANAGED_IRQ = 128, + HK_FLAG_KTHREAD = 256, +}; + +struct aperfmperf_sample { + unsigned int khz; + atomic_t scfpending; + ktime_t time; + u64 aperf; + u64 mperf; +}; + +struct cpuid_dep { + unsigned int feature; + unsigned int depends; +}; + +enum vmx_feature_leafs { + MISC_FEATURES = 0, + PRIMARY_CTLS = 1, + SECONDARY_CTLS = 2, + NR_VMX_FEATURE_WORDS = 3, +}; + +struct _tlb_table { + unsigned char descriptor; + char tlb_type; + unsigned int entries; + char info[128]; +}; + +enum tsx_ctrl_states { + TSX_CTRL_ENABLE = 0, + TSX_CTRL_DISABLE = 1, + TSX_CTRL_NOT_SUPPORTED = 2, +}; + +enum split_lock_detect_state { + sld_off = 0, + sld_warn = 1, + sld_fatal = 2, +}; + +struct sku_microcode { + u8 model; + u8 stepping; + u32 microcode; +}; + +struct cpuid_regs { + u32 eax; + u32 ebx; + u32 ecx; + u32 edx; +}; + +enum pconfig_target { + INVALID_TARGET = 0, + MKTME_TARGET = 1, + PCONFIG_TARGET_NR = 2, +}; + +enum { + PCONFIG_CPUID_SUBLEAF_INVALID = 0, + PCONFIG_CPUID_SUBLEAF_TARGETID = 1, +}; + +enum task_work_notify_mode { + TWA_NONE = 0, + TWA_RESUME = 1, + TWA_SIGNAL = 2, +}; + +enum mf_flags { + MF_COUNT_INCREASED = 1, + MF_ACTION_REQUIRED = 2, + MF_MUST_KILL = 4, + MF_SOFT_OFFLINE = 8, +}; + +struct mce { + __u64 status; + __u64 misc; + __u64 addr; + __u64 mcgstatus; + __u64 ip; + __u64 tsc; + __u64 time; + __u8 cpuvendor; + __u8 inject_flags; + __u8 severity; + __u8 pad; + __u32 cpuid; + __u8 cs; + __u8 bank; + __u8 cpu; + __u8 finished; + __u32 extcpu; + __u32 socketid; + __u32 apicid; + __u64 mcgcap; + __u64 synd; + __u64 ipid; + __u64 ppin; + __u32 microcode; + __u64 kflags; +}; + +enum mce_notifier_prios { + MCE_PRIO_LOWEST = 0, + MCE_PRIO_MCELOG = 1, + MCE_PRIO_EDAC = 2, + MCE_PRIO_NFIT = 3, + MCE_PRIO_EXTLOG = 4, + MCE_PRIO_UC = 5, + MCE_PRIO_EARLY = 6, + MCE_PRIO_CEC = 7, + MCE_PRIO_HIGHEST = 7, +}; + +typedef long unsigned int mce_banks_t[1]; + +enum mcp_flags { + MCP_TIMESTAMP = 1, + MCP_UC = 2, + MCP_DONTLOG = 4, +}; + +enum severity_level { + MCE_NO_SEVERITY = 0, + MCE_DEFERRED_SEVERITY = 1, + MCE_UCNA_SEVERITY = 1, + MCE_KEEP_SEVERITY = 2, + MCE_SOME_SEVERITY = 3, + MCE_AO_SEVERITY = 4, + MCE_UC_SEVERITY = 5, + MCE_AR_SEVERITY = 6, + MCE_PANIC_SEVERITY = 7, +}; + +struct mce_evt_llist { + struct llist_node llnode; + struct mce mce; +}; + +struct mca_config { + bool dont_log_ce; + bool cmci_disabled; + bool ignore_ce; + bool print_all; + __u64 lmce_disabled: 1; + __u64 disabled: 1; + __u64 ser: 1; + __u64 recovery: 1; + __u64 bios_cmci_threshold: 1; + int: 27; + __u64 __reserved: 59; + s8 bootlog; + int tolerant; + int monarch_timeout; + int panic_timeout; + u32 rip_msr; +}; + +struct mce_vendor_flags { + __u64 overflow_recov: 1; + __u64 succor: 1; + __u64 smca: 1; + __u64 amd_threshold: 1; + __u64 __reserved_0: 60; +}; + +struct mca_msr_regs { + u32 (*ctl)(int); + u32 (*status)(int); + u32 (*addr)(int); + u32 (*misc)(int); +}; + +struct trace_event_raw_mce_record { + struct trace_entry ent; + u64 mcgcap; + u64 mcgstatus; + u64 status; + u64 addr; + u64 misc; + u64 synd; + u64 ipid; + u64 ip; + u64 tsc; + u64 walltime; + u32 cpu; + u32 cpuid; + u32 apicid; + u32 socketid; + u8 cs; + u8 bank; + u8 cpuvendor; + char __data[0]; +}; + +struct trace_event_data_offsets_mce_record {}; + +typedef void (*btf_trace_mce_record)(void *, struct mce *); + +struct mce_bank { + u64 ctl; + bool init; +}; + +struct mce_bank_dev { + struct device_attribute attr; + char attrname[16]; + u8 bank; +}; + +enum handler_type { + EX_HANDLER_NONE = 0, + EX_HANDLER_FAULT = 1, + EX_HANDLER_UACCESS = 2, + EX_HANDLER_OTHER = 3, +}; + +enum context { + IN_KERNEL = 1, + IN_USER = 2, + IN_KERNEL_RECOV = 3, +}; + +enum ser { + SER_REQUIRED = 1, + NO_SER = 2, +}; + +enum exception { + EXCP_CONTEXT = 1, + NO_EXCP = 2, +}; + +struct severity { + u64 mask; + u64 result; + unsigned char sev; + unsigned char mcgmask; + unsigned char mcgres; + unsigned char ser; + unsigned char context; + unsigned char excp; + unsigned char covered; + unsigned char cpu_model; + unsigned char cpu_minstepping; + unsigned char bank_lo; + unsigned char bank_hi; + char *msg; +}; + +struct gen_pool; + +typedef long unsigned int (*genpool_algo_t)(long unsigned int *, long unsigned int, long unsigned int, unsigned int, void *, struct gen_pool *, long unsigned int); + +struct gen_pool { + spinlock_t lock; + struct list_head chunks; + int min_alloc_order; + genpool_algo_t algo; + void *data; + const char *name; +}; + +enum { + CMCI_STORM_NONE = 0, + CMCI_STORM_ACTIVE = 1, + CMCI_STORM_SUBSIDED = 2, +}; + +enum kobject_action { + KOBJ_ADD = 0, + KOBJ_REMOVE = 1, + KOBJ_CHANGE = 2, + KOBJ_MOVE = 3, + KOBJ_ONLINE = 4, + KOBJ_OFFLINE = 5, + KOBJ_BIND = 6, + KOBJ_UNBIND = 7, +}; + +enum smca_bank_types { + SMCA_LS = 0, + SMCA_LS_V2 = 1, + SMCA_IF = 2, + SMCA_L2_CACHE = 3, + SMCA_DE = 4, + SMCA_RESERVED = 5, + SMCA_EX = 6, + SMCA_FP = 7, + SMCA_L3_CACHE = 8, + SMCA_CS = 9, + SMCA_CS_V2 = 10, + SMCA_PIE = 11, + SMCA_UMC = 12, + SMCA_PB = 13, + SMCA_PSP = 14, + SMCA_PSP_V2 = 15, + SMCA_SMU = 16, + SMCA_SMU_V2 = 17, + SMCA_MP5 = 18, + SMCA_NBIO = 19, + SMCA_PCIE = 20, + N_SMCA_BANK_TYPES = 21, +}; + +struct smca_hwid { + unsigned int bank_type; + u32 hwid_mcatype; + u8 count; +}; + +struct smca_bank { + struct smca_hwid *hwid; + u32 id; + u8 sysfs_id; +}; + +struct smca_bank_name { + const char *name; + const char *long_name; +}; + +struct thresh_restart { + struct threshold_block *b; + int reset; + int set_lvt_off; + int lvt_off; + u16 old_limit; +}; + +struct threshold_attr { + struct attribute attr; + ssize_t (*show)(struct threshold_block *, char *); + ssize_t (*store)(struct threshold_block *, const char *, size_t); +}; + +struct _thermal_state { + u64 next_check; + u64 last_interrupt_time; + struct delayed_work therm_work; + long unsigned int count; + long unsigned int last_count; + long unsigned int max_time_ms; + long unsigned int total_time_ms; + bool rate_control_active; + bool new_event; + u8 level; + u8 sample_index; + u8 sample_count; + u8 average; + u8 baseline_temp; + u8 temp_samples[3]; +}; + +struct thermal_state { + struct _thermal_state core_throttle; + struct _thermal_state core_power_limit; + struct _thermal_state package_throttle; + struct _thermal_state package_power_limit; + struct _thermal_state core_thresh0; + struct _thermal_state core_thresh1; + struct _thermal_state pkg_thresh0; + struct _thermal_state pkg_thresh1; +}; + +enum { + CPER_SEV_RECOVERABLE = 0, + CPER_SEV_FATAL = 1, + CPER_SEV_CORRECTED = 2, + CPER_SEV_INFORMATIONAL = 3, +}; + +struct cper_record_header { + char signature[4]; + u16 revision; + u32 signature_end; + u16 section_count; + u32 error_severity; + u32 validation_bits; + u32 record_length; + u64 timestamp; + guid_t platform_id; + guid_t partition_id; + guid_t creator_id; + guid_t notification_type; + u64 record_id; + u32 flags; + u64 persistence_information; + u8 reserved[12]; +} __attribute__((packed)); + +struct cper_section_descriptor { + u32 section_offset; + u32 section_length; + u16 revision; + u8 validation_bits; + u8 reserved; + u32 flags; + guid_t section_type; + guid_t fru_id; + u32 section_severity; + u8 fru_text[20]; +}; + +struct cper_ia_proc_ctx { + u16 reg_ctx_type; + u16 reg_arr_size; + u32 msr_addr; + u64 mm_reg_addr; +}; + +struct cper_sec_mem_err { + u64 validation_bits; + u64 error_status; + u64 physical_addr; + u64 physical_addr_mask; + u16 node; + u16 card; + u16 module; + u16 bank; + u16 device; + u16 row; + u16 column; + u16 bit_pos; + u64 requestor_id; + u64 responder_id; + u64 target_id; + u8 error_type; + u8 extended; + u16 rank; + u16 mem_array_handle; + u16 mem_dev_handle; +}; + +enum { + GHES_SEV_NO = 0, + GHES_SEV_CORRECTED = 1, + GHES_SEV_RECOVERABLE = 2, + GHES_SEV_PANIC = 3, +}; + +struct cper_mce_record { + struct cper_record_header hdr; + struct cper_section_descriptor sec_hdr; + struct mce mce; +}; + +struct miscdevice { + int minor; + const char *name; + const struct file_operations *fops; + struct list_head list; + struct device *parent; + struct device *this_device; + const struct attribute_group **groups; + const char *nodename; + umode_t mode; +}; + +typedef struct poll_table_struct poll_table; + +struct mce_log_buffer { + char signature[12]; + unsigned int len; + unsigned int next; + unsigned int flags; + unsigned int recordlen; + struct mce entry[0]; +}; + +typedef int (*cpu_stop_fn_t)(void *); + +typedef __u8 mtrr_type; + +struct mtrr_ops { + u32 vendor; + u32 use_intel_if; + void (*set)(unsigned int, long unsigned int, long unsigned int, mtrr_type); + void (*set_all)(); + void (*get)(unsigned int, long unsigned int *, long unsigned int *, mtrr_type *); + int (*get_free_region)(long unsigned int, long unsigned int, int); + int (*validate_add_page)(long unsigned int, long unsigned int, unsigned int); + int (*have_wrcomb)(); +}; + +struct set_mtrr_data { + long unsigned int smp_base; + long unsigned int smp_size; + unsigned int smp_reg; + mtrr_type smp_type; +}; + +struct mtrr_value { + mtrr_type ltype; + long unsigned int lbase; + long unsigned int lsize; +}; + +struct proc_ops { + unsigned int proc_flags; + int (*proc_open)(struct inode *, struct file *); + ssize_t (*proc_read)(struct file *, char *, size_t, loff_t *); + ssize_t (*proc_read_iter)(struct kiocb *, struct iov_iter *); + ssize_t (*proc_write)(struct file *, const char *, size_t, loff_t *); + loff_t (*proc_lseek)(struct file *, loff_t, int); + int (*proc_release)(struct inode *, struct file *); + __poll_t (*proc_poll)(struct file *, struct poll_table_struct *); + long int (*proc_ioctl)(struct file *, unsigned int, long unsigned int); + long int (*proc_compat_ioctl)(struct file *, unsigned int, long unsigned int); + int (*proc_mmap)(struct file *, struct vm_area_struct *); + long unsigned int (*proc_get_unmapped_area)(struct file *, long unsigned int, long unsigned int, long unsigned int, long unsigned int); +}; + +struct mtrr_sentry { + __u64 base; + __u32 size; + __u32 type; +}; + +struct mtrr_gentry { + __u64 base; + __u32 size; + __u32 regnum; + __u32 type; + __u32 _pad; +}; + +typedef u32 compat_uint_t; + +struct mtrr_sentry32 { + compat_ulong_t base; + compat_uint_t size; + compat_uint_t type; +}; + +struct mtrr_gentry32 { + compat_ulong_t regnum; + compat_uint_t base; + compat_uint_t size; + compat_uint_t type; +}; + +struct mtrr_var_range { + __u32 base_lo; + __u32 base_hi; + __u32 mask_lo; + __u32 mask_hi; +}; + +struct mtrr_state_type { + struct mtrr_var_range var_ranges[256]; + mtrr_type fixed_ranges[88]; + unsigned char enabled; + unsigned char have_fixed; + mtrr_type def_type; +}; + +struct fixed_range_block { + int base_msr; + int ranges; +}; + +struct var_mtrr_range_state { + long unsigned int base_pfn; + long unsigned int size_pfn; + mtrr_type type; +}; + +struct var_mtrr_state { + long unsigned int range_startk; + long unsigned int range_sizek; + long unsigned int chunk_sizek; + long unsigned int gran_sizek; + unsigned int reg; +}; + +struct mtrr_cleanup_result { + long unsigned int gran_sizek; + long unsigned int chunk_sizek; + long unsigned int lose_cover_sizek; + unsigned int num_reg; + int bad; +}; + +struct subsys_interface { + const char *name; + struct bus_type *subsys; + struct list_head node; + int (*add_dev)(struct device *, struct subsys_interface *); + void (*remove_dev)(struct device *, struct subsys_interface *); +}; + +struct property_entry; + +struct platform_device_info { + struct device *parent; + struct fwnode_handle *fwnode; + bool of_node_reused; + const char *name; + int id; + const struct resource *res; + unsigned int num_res; + const void *data; + size_t size_data; + u64 dma_mask; + const struct property_entry *properties; +}; + +enum dev_prop_type { + DEV_PROP_U8 = 0, + DEV_PROP_U16 = 1, + DEV_PROP_U32 = 2, + DEV_PROP_U64 = 3, + DEV_PROP_STRING = 4, + DEV_PROP_REF = 5, +}; + +struct property_entry { + const char *name; + size_t length; + bool is_inline; + enum dev_prop_type type; + union { + const void *pointer; + union { + u8 u8_data[8]; + u16 u16_data[4]; + u32 u32_data[2]; + u64 u64_data[1]; + const char *str[1]; + } value; + }; +}; + +struct builtin_fw { + char *name; + void *data; + long unsigned int size; +}; + +struct cpio_data { + void *data; + size_t size; + char name[18]; +}; + +struct cpu_signature { + unsigned int sig; + unsigned int pf; + unsigned int rev; +}; + +enum ucode_state { + UCODE_OK = 0, + UCODE_NEW = 1, + UCODE_UPDATED = 2, + UCODE_NFOUND = 3, + UCODE_ERROR = 4, +}; + +struct microcode_ops { + enum ucode_state (*request_microcode_user)(int, const void *, size_t); + enum ucode_state (*request_microcode_fw)(int, struct device *, bool); + void (*microcode_fini_cpu)(int); + enum ucode_state (*apply_microcode)(int); + int (*collect_cpu_info)(int, struct cpu_signature *); +}; + +struct ucode_cpu_info { + struct cpu_signature cpu_sig; + int valid; + void *mc; +}; + +struct cpu_info_ctx { + struct cpu_signature *cpu_sig; + int err; +}; + +struct firmware { + size_t size; + const u8 *data; + void *priv; +}; + +struct ucode_patch { + struct list_head plist; + void *data; + u32 patch_id; + u16 equiv_cpu; +}; + +struct microcode_header_intel { + unsigned int hdrver; + unsigned int rev; + unsigned int date; + unsigned int sig; + unsigned int cksum; + unsigned int ldrver; + unsigned int pf; + unsigned int datasize; + unsigned int totalsize; + unsigned int reserved[3]; +}; + +struct microcode_intel { + struct microcode_header_intel hdr; + unsigned int bits[0]; +}; + +struct extended_signature { + unsigned int sig; + unsigned int pf; + unsigned int cksum; +}; + +struct extended_sigtable { + unsigned int count; + unsigned int cksum; + unsigned int reserved[3]; + struct extended_signature sigs[0]; +}; + +struct equiv_cpu_entry { + u32 installed_cpu; + u32 fixed_errata_mask; + u32 fixed_errata_compare; + u16 equiv_cpu; + u16 res; +}; + +struct microcode_header_amd { + u32 data_code; + u32 patch_id; + u16 mc_patch_data_id; + u8 mc_patch_data_len; + u8 init_flag; + u32 mc_patch_data_checksum; + u32 nb_dev_id; + u32 sb_dev_id; + u16 processor_rev_id; + u8 nb_rev_id; + u8 sb_rev_id; + u8 bios_api_rev; + u8 reserved1[3]; + u32 match_reg[8]; +}; + +struct microcode_amd { + struct microcode_header_amd hdr; + unsigned int mpb[0]; +}; + +struct equiv_cpu_table { + unsigned int num_entries; + struct equiv_cpu_entry *entry; +}; + +struct cont_desc { + struct microcode_amd *mc; + u32 cpuid_1_eax; + u32 psize; + u8 *data; + size_t size; +}; + +typedef void (*exitcall_t)(); + +enum rdt_group_type { + RDTCTRL_GROUP = 0, + RDTMON_GROUP = 1, + RDT_NUM_GROUP = 2, +}; + +struct rdtgroup; + +struct mongroup { + struct kernfs_node *mon_data_kn; + struct rdtgroup *parent; + struct list_head crdtgrp_list; + u32 rmid; +}; + +enum rdtgrp_mode { + RDT_MODE_SHAREABLE = 0, + RDT_MODE_EXCLUSIVE = 1, + RDT_MODE_PSEUDO_LOCKSETUP = 2, + RDT_MODE_PSEUDO_LOCKED = 3, + RDT_NUM_MODES = 4, +}; + +struct pseudo_lock_region; + +struct rdtgroup { + struct kernfs_node *kn; + struct list_head rdtgroup_list; + u32 closid; + struct cpumask cpu_mask; + int flags; + atomic_t waitcount; + enum rdt_group_type type; + struct mongroup mon; + enum rdtgrp_mode mode; + struct pseudo_lock_region *plr; +}; + +struct rdt_cache { + unsigned int cbm_len; + unsigned int min_cbm_bits; + unsigned int cbm_idx_mult; + unsigned int cbm_idx_offset; + unsigned int shareable_bits; + bool arch_has_sparse_bitmaps; + bool arch_has_empty_bitmaps; + bool arch_has_per_cpu_cfg; +}; + +enum membw_throttle_mode { + THREAD_THROTTLE_UNDEFINED = 0, + THREAD_THROTTLE_MAX = 1, + THREAD_THROTTLE_PER_THREAD = 2, +}; + +struct rdt_membw { + u32 min_bw; + u32 bw_gran; + u32 delay_linear; + bool arch_needs_linear; + enum membw_throttle_mode throttle_mode; + bool mba_sc; + u32 *mb_map; +}; + +struct rdt_domain; + +struct msr_param; + +struct rdt_parse_data; + +struct rdt_resource { + int rid; + bool alloc_enabled; + bool mon_enabled; + bool alloc_capable; + bool mon_capable; + char *name; + int num_closid; + int cache_level; + u32 default_ctrl; + unsigned int msr_base; + void (*msr_update)(struct rdt_domain *, struct msr_param *, struct rdt_resource *); + int data_width; + struct list_head domains; + struct rdt_cache cache; + struct rdt_membw membw; + const char *format_str; + int (*parse_ctrlval)(struct rdt_parse_data *, struct rdt_resource *, struct rdt_domain *); + struct list_head evt_list; + int num_rmid; + unsigned int mon_scale; + unsigned int mbm_width; + long unsigned int fflags; +}; + +struct mbm_state; + +struct rdt_domain { + struct list_head list; + int id; + struct cpumask cpu_mask; + long unsigned int *rmid_busy_llc; + struct mbm_state *mbm_total; + struct mbm_state *mbm_local; + struct delayed_work mbm_over; + struct delayed_work cqm_limbo; + int mbm_work_cpu; + int cqm_work_cpu; + u32 *ctrl_val; + u32 *mbps_val; + u32 new_ctrl; + bool have_new_ctrl; + struct pseudo_lock_region *plr; +}; + +struct pseudo_lock_region { + struct rdt_resource *r; + struct rdt_domain *d; + u32 cbm; + wait_queue_head_t lock_thread_wq; + int thread_done; + int cpu; + unsigned int line_size; + unsigned int size; + void *kmem; + unsigned int minor; + struct dentry *debugfs_dir; + struct list_head pm_reqs; +}; + +struct mbm_state { + u64 chunks; + u64 prev_msr; + u64 prev_bw_msr; + u32 prev_bw; + u32 delta_bw; + bool delta_comp; +}; + +struct msr_param { + struct rdt_resource *res; + int low; + int high; +}; + +struct rdt_parse_data { + struct rdtgroup *rdtgrp; + char *buf; +}; + +enum { + RDT_RESOURCE_L3 = 0, + RDT_RESOURCE_L3DATA = 1, + RDT_RESOURCE_L3CODE = 2, + RDT_RESOURCE_L2 = 3, + RDT_RESOURCE_L2DATA = 4, + RDT_RESOURCE_L2CODE = 5, + RDT_RESOURCE_MBA = 6, + RDT_NUM_RESOURCES = 7, +}; + +union cpuid_0x10_1_eax { + struct { + unsigned int cbm_len: 5; + } split; + unsigned int full; +}; + +union cpuid_0x10_3_eax { + struct { + unsigned int max_delay: 12; + } split; + unsigned int full; +}; + +union cpuid_0x10_x_edx { + struct { + unsigned int cos_max: 16; + } split; + unsigned int full; +}; + +enum { + RDT_FLAG_CMT = 0, + RDT_FLAG_MBM_TOTAL = 1, + RDT_FLAG_MBM_LOCAL = 2, + RDT_FLAG_L3_CAT = 3, + RDT_FLAG_L3_CDP = 4, + RDT_FLAG_L2_CAT = 5, + RDT_FLAG_L2_CDP = 6, + RDT_FLAG_MBA = 7, +}; + +struct rdt_options { + char *name; + int flag; + bool force_off; + bool force_on; +}; + +typedef unsigned int uint; + +struct __va_list_tag { + unsigned int gp_offset; + unsigned int fp_offset; + void *overflow_arg_area; + void *reg_save_area; +}; + +typedef __builtin_va_list __gnuc_va_list; + +typedef __gnuc_va_list va_list; + +enum kernfs_node_type { + KERNFS_DIR = 1, + KERNFS_FILE = 2, + KERNFS_LINK = 4, +}; + +enum kernfs_root_flag { + KERNFS_ROOT_CREATE_DEACTIVATED = 1, + KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK = 2, + KERNFS_ROOT_SUPPORT_EXPORTOP = 4, + KERNFS_ROOT_SUPPORT_USER_XATTR = 8, +}; + +struct kernfs_fs_context { + struct kernfs_root *root; + void *ns_tag; + long unsigned int magic; + bool new_sb_created; +}; + +struct rdt_fs_context { + struct kernfs_fs_context kfc; + bool enable_cdpl2; + bool enable_cdpl3; + bool enable_mba_mbps; +}; + +struct mon_evt { + u32 evtid; + char *name; + struct list_head list; +}; + +union mon_data_bits { + void *priv; + struct { + unsigned int rid: 10; + unsigned int evtid: 8; + unsigned int domid: 14; + } u; +}; + +struct rmid_read { + struct rdtgroup *rgrp; + struct rdt_resource *r; + struct rdt_domain *d; + int evtid; + bool first; + u64 val; +}; + +struct rftype { + char *name; + umode_t mode; + const struct kernfs_ops *kf_ops; + long unsigned int flags; + long unsigned int fflags; + int (*seq_show)(struct kernfs_open_file *, struct seq_file *, void *); + ssize_t (*write)(struct kernfs_open_file *, char *, size_t, loff_t); +}; + +enum rdt_param { + Opt_cdp = 0, + Opt_cdpl2 = 1, + Opt_mba_mbps = 2, + nr__rdt_params = 3, +}; + +struct rmid_entry { + u32 rmid; + int busy; + struct list_head list; +}; + +struct mbm_correction_factor_table { + u32 rmidthreshold; + u64 cf; +}; + +struct trace_event_raw_pseudo_lock_mem_latency { + struct trace_entry ent; + u32 latency; + char __data[0]; +}; + +struct trace_event_raw_pseudo_lock_l2 { + struct trace_entry ent; + u64 l2_hits; + u64 l2_miss; + char __data[0]; +}; + +struct trace_event_raw_pseudo_lock_l3 { + struct trace_entry ent; + u64 l3_hits; + u64 l3_miss; + char __data[0]; +}; + +struct trace_event_data_offsets_pseudo_lock_mem_latency {}; + +struct trace_event_data_offsets_pseudo_lock_l2 {}; + +struct trace_event_data_offsets_pseudo_lock_l3 {}; + +typedef void (*btf_trace_pseudo_lock_mem_latency)(void *, u32); + +typedef void (*btf_trace_pseudo_lock_l2)(void *, u64, u64); + +typedef void (*btf_trace_pseudo_lock_l3)(void *, u64, u64); + +struct pseudo_lock_pm_req { + struct list_head list; + struct dev_pm_qos_request req; +}; + +struct residency_counts { + u64 miss_before; + u64 hits_before; + u64 miss_after; + u64 hits_after; +}; + +enum mmu_notifier_event { + MMU_NOTIFY_UNMAP = 0, + MMU_NOTIFY_CLEAR = 1, + MMU_NOTIFY_PROTECTION_VMA = 2, + MMU_NOTIFY_PROTECTION_PAGE = 3, + MMU_NOTIFY_SOFT_DIRTY = 4, + MMU_NOTIFY_RELEASE = 5, + MMU_NOTIFY_MIGRATE = 6, +}; + +struct mmu_notifier; + +struct mmu_notifier_range; + +struct mmu_notifier_ops { + void (*release)(struct mmu_notifier *, struct mm_struct *); + int (*clear_flush_young)(struct mmu_notifier *, struct mm_struct *, long unsigned int, long unsigned int); + int (*clear_young)(struct mmu_notifier *, struct mm_struct *, long unsigned int, long unsigned int); + int (*test_young)(struct mmu_notifier *, struct mm_struct *, long unsigned int); + void (*change_pte)(struct mmu_notifier *, struct mm_struct *, long unsigned int, pte_t); + int (*invalidate_range_start)(struct mmu_notifier *, const struct mmu_notifier_range *); + void (*invalidate_range_end)(struct mmu_notifier *, const struct mmu_notifier_range *); + void (*invalidate_range)(struct mmu_notifier *, struct mm_struct *, long unsigned int, long unsigned int); + struct mmu_notifier * (*alloc_notifier)(struct mm_struct *); + void (*free_notifier)(struct mmu_notifier *); +}; + +struct mmu_notifier { + struct hlist_node hlist; + const struct mmu_notifier_ops *ops; + struct mm_struct *mm; + struct callback_head rcu; + unsigned int users; +}; + +struct mmu_notifier_range { + struct vm_area_struct *vma; + struct mm_struct *mm; + long unsigned int start; + long unsigned int end; + unsigned int flags; + enum mmu_notifier_event event; + void *migrate_pgmap_owner; +}; + +enum sgx_page_type { + SGX_PAGE_TYPE_SECS = 0, + SGX_PAGE_TYPE_TCS = 1, + SGX_PAGE_TYPE_REG = 2, + SGX_PAGE_TYPE_VA = 3, + SGX_PAGE_TYPE_TRIM = 4, +}; + +struct sgx_encl_page; + +struct sgx_epc_page { + unsigned int section; + unsigned int flags; + struct sgx_encl_page *owner; + struct list_head list; +}; + +struct sgx_encl; + +struct sgx_va_page; + +struct sgx_encl_page { + long unsigned int desc; + long unsigned int vm_max_prot_bits; + struct sgx_epc_page *epc_page; + struct sgx_encl *encl; + struct sgx_va_page *va_page; +}; + +struct sgx_encl { + long unsigned int base; + long unsigned int size; + long unsigned int flags; + unsigned int page_cnt; + unsigned int secs_child_cnt; + struct mutex lock; + struct xarray page_array; + struct sgx_encl_page secs; + long unsigned int attributes; + long unsigned int attributes_mask; + cpumask_t cpumask; + struct file *backing; + struct kref refcount; + struct list_head va_pages; + long unsigned int mm_list_version; + struct list_head mm_list; + spinlock_t mm_lock; + struct srcu_struct srcu; +}; + +struct sgx_va_page { + struct sgx_epc_page *epc_page; + long unsigned int slots[8]; + struct list_head list; +}; + +struct sgx_encl_mm { + struct sgx_encl *encl; + struct mm_struct *mm; + struct list_head list; + struct mmu_notifier mmu_notifier; +}; + +typedef unsigned int xa_mark_t; + +struct xa_node { + unsigned char shift; + unsigned char offset; + unsigned char count; + unsigned char nr_values; + struct xa_node *parent; + struct xarray *array; + union { + struct list_head private_list; + struct callback_head callback_head; + }; + void *slots[64]; + union { + long unsigned int tags[3]; + long unsigned int marks[3]; + }; +}; + +typedef void (*xa_update_node_t)(struct xa_node *); + +struct xa_state { + struct xarray *xa; + long unsigned int xa_index; + unsigned char xa_shift; + unsigned char xa_sibs; + unsigned char xa_offset; + unsigned char xa_pad; + struct xa_node *xa_node; + struct xa_node *xa_alloc; + xa_update_node_t xa_update; +}; + +enum { + XA_CHECK_SCHED = 4096, +}; + +struct sgx_pageinfo { + u64 addr; + u64 contents; + u64 metadata; + u64 secs; +}; + +struct sgx_epc_section { + long unsigned int phys_addr; + void *virt_addr; + struct sgx_epc_page *pages; + spinlock_t lock; + struct list_head page_list; + long unsigned int free_cnt; + struct list_head init_laundry_list; +}; + +enum sgx_encl_flags { + SGX_ENCL_IOCTL = 1, + SGX_ENCL_DEBUG = 2, + SGX_ENCL_CREATED = 4, + SGX_ENCL_INITIALIZED = 8, +}; + +struct sgx_backing { + long unsigned int page_index; + struct page *contents; + struct page *pcmd; + long unsigned int pcmd_offset; +}; + +enum sgx_encls_function { + ECREATE = 0, + EADD = 1, + EINIT = 2, + EREMOVE = 3, + EDGBRD = 4, + EDGBWR = 5, + EEXTEND = 6, + ELDU = 8, + EBLOCK = 9, + EPA = 10, + EWB = 11, + ETRACK = 12, +}; + +struct crypto_alg; + +struct crypto_tfm { + u32 crt_flags; + int node; + void (*exit)(struct crypto_tfm *); + struct crypto_alg *__crt_alg; + void *__crt_ctx[0]; +}; + +struct cipher_alg { + unsigned int cia_min_keysize; + unsigned int cia_max_keysize; + int (*cia_setkey)(struct crypto_tfm *, const u8 *, unsigned int); + void (*cia_encrypt)(struct crypto_tfm *, u8 *, const u8 *); + void (*cia_decrypt)(struct crypto_tfm *, u8 *, const u8 *); +}; + +struct compress_alg { + int (*coa_compress)(struct crypto_tfm *, const u8 *, unsigned int, u8 *, unsigned int *); + int (*coa_decompress)(struct crypto_tfm *, const u8 *, unsigned int, u8 *, unsigned int *); +}; + +struct crypto_istat_aead { + atomic64_t encrypt_cnt; + atomic64_t encrypt_tlen; + atomic64_t decrypt_cnt; + atomic64_t decrypt_tlen; + atomic64_t err_cnt; +}; + +struct crypto_istat_akcipher { + atomic64_t encrypt_cnt; + atomic64_t encrypt_tlen; + atomic64_t decrypt_cnt; + atomic64_t decrypt_tlen; + atomic64_t verify_cnt; + atomic64_t sign_cnt; + atomic64_t err_cnt; +}; + +struct crypto_istat_cipher { + atomic64_t encrypt_cnt; + atomic64_t encrypt_tlen; + atomic64_t decrypt_cnt; + atomic64_t decrypt_tlen; + atomic64_t err_cnt; +}; + +struct crypto_istat_compress { + atomic64_t compress_cnt; + atomic64_t compress_tlen; + atomic64_t decompress_cnt; + atomic64_t decompress_tlen; + atomic64_t err_cnt; +}; + +struct crypto_istat_hash { + atomic64_t hash_cnt; + atomic64_t hash_tlen; + atomic64_t err_cnt; +}; + +struct crypto_istat_kpp { + atomic64_t setsecret_cnt; + atomic64_t generate_public_key_cnt; + atomic64_t compute_shared_secret_cnt; + atomic64_t err_cnt; +}; + +struct crypto_istat_rng { + atomic64_t generate_cnt; + atomic64_t generate_tlen; + atomic64_t seed_cnt; + atomic64_t err_cnt; +}; + +struct crypto_type; + +struct crypto_alg { + struct list_head cra_list; + struct list_head cra_users; + u32 cra_flags; + unsigned int cra_blocksize; + unsigned int cra_ctxsize; + unsigned int cra_alignmask; + int cra_priority; + refcount_t cra_refcnt; + char cra_name[128]; + char cra_driver_name[128]; + const struct crypto_type *cra_type; + union { + struct cipher_alg cipher; + struct compress_alg compress; + } cra_u; + int (*cra_init)(struct crypto_tfm *); + void (*cra_exit)(struct crypto_tfm *); + void (*cra_destroy)(struct crypto_alg *); + struct module *cra_module; + union { + struct crypto_istat_aead aead; + struct crypto_istat_akcipher akcipher; + struct crypto_istat_cipher cipher; + struct crypto_istat_compress compress; + struct crypto_istat_hash hash; + struct crypto_istat_rng rng; + struct crypto_istat_kpp kpp; + } stats; +}; + +struct crypto_instance; + +struct crypto_type { + unsigned int (*ctxsize)(struct crypto_alg *, u32, u32); + unsigned int (*extsize)(struct crypto_alg *); + int (*init)(struct crypto_tfm *, u32, u32); + int (*init_tfm)(struct crypto_tfm *); + void (*show)(struct seq_file *, struct crypto_alg *); + int (*report)(struct sk_buff *, struct crypto_alg *); + void (*free)(struct crypto_instance *); + unsigned int type; + unsigned int maskclear; + unsigned int maskset; + unsigned int tfmsize; +}; + +struct crypto_shash; + +struct shash_desc { + struct crypto_shash *tfm; + void *__ctx[0]; +}; + +struct crypto_shash { + unsigned int descsize; + struct crypto_tfm base; +}; + +enum sgx_page_flags { + SGX_PAGE_MEASURE = 1, +}; + +struct sgx_enclave_create { + __u64 src; +}; + +struct sgx_enclave_add_pages { + __u64 src; + __u64 offset; + __u64 length; + __u64 secinfo; + __u64 flags; + __u64 count; +}; + +struct sgx_enclave_init { + __u64 sigstruct; +}; + +struct sgx_enclave_provision { + __u64 fd; +}; + +enum sgx_return_code { + SGX_NOT_TRACKED = 11, + SGX_INVALID_EINITTOKEN = 16, + SGX_UNMASKED_EVENT = 128, +}; + +enum sgx_attribute { + SGX_ATTR_INIT = 1, + SGX_ATTR_DEBUG = 2, + SGX_ATTR_MODE64BIT = 4, + SGX_ATTR_PROVISIONKEY = 16, + SGX_ATTR_EINITTOKENKEY = 32, + SGX_ATTR_KSS = 128, +}; + +struct sgx_secs { + u64 size; + u64 base; + u32 ssa_frame_size; + u32 miscselect; + u8 reserved1[24]; + u64 attributes; + u64 xfrm; + u32 mrenclave[8]; + u8 reserved2[32]; + u32 mrsigner[8]; + u8 reserved3[32]; + u32 config_id[16]; + u16 isv_prod_id; + u16 isv_svn; + u16 config_svn; + u8 reserved4[3834]; +}; + +enum sgx_secinfo_flags { + SGX_SECINFO_R = 1, + SGX_SECINFO_W = 2, + SGX_SECINFO_X = 4, + SGX_SECINFO_SECS = 0, + SGX_SECINFO_TCS = 256, + SGX_SECINFO_REG = 512, + SGX_SECINFO_VA = 768, + SGX_SECINFO_TRIM = 1024, +}; + +struct sgx_secinfo { + u64 flags; + u8 reserved[56]; +}; + +struct sgx_sigstruct_header { + u64 header1[2]; + u32 vendor; + u32 date; + u64 header2[2]; + u32 swdefined; + u8 reserved1[84]; +}; + +struct sgx_sigstruct_body { + u32 miscselect; + u32 misc_mask; + u8 reserved2[20]; + u64 attributes; + u64 xfrm; + u64 attributes_mask; + u64 xfrm_mask; + u8 mrenclave[32]; + u8 reserved3[32]; + u16 isvprodid; + u16 isvsvn; +} __attribute__((packed)); + +struct sgx_sigstruct { + struct sgx_sigstruct_header header; + u8 modulus[384]; + u32 exponent; + u8 signature[384]; + struct sgx_sigstruct_body body; + u8 reserved4[12]; + u8 q1[384]; + u8 q2[384]; +} __attribute__((packed)); + +struct vmcb_seg { + u16 selector; + u16 attrib; + u32 limit; + u64 base; +}; + +struct vmcb_save_area { + struct vmcb_seg es; + struct vmcb_seg cs; + struct vmcb_seg ss; + struct vmcb_seg ds; + struct vmcb_seg fs; + struct vmcb_seg gs; + struct vmcb_seg gdtr; + struct vmcb_seg ldtr; + struct vmcb_seg idtr; + struct vmcb_seg tr; + u8 reserved_1[43]; + u8 cpl; + u8 reserved_2[4]; + u64 efer; + u8 reserved_3[104]; + u64 xss; + u64 cr4; + u64 cr3; + u64 cr0; + u64 dr7; + u64 dr6; + u64 rflags; + u64 rip; + u8 reserved_4[88]; + u64 rsp; + u8 reserved_5[24]; + u64 rax; + u64 star; + u64 lstar; + u64 cstar; + u64 sfmask; + u64 kernel_gs_base; + u64 sysenter_cs; + u64 sysenter_esp; + u64 sysenter_eip; + u64 cr2; + u8 reserved_6[32]; + u64 g_pat; + u64 dbgctl; + u64 br_from; + u64 br_to; + u64 last_excp_from; + u64 last_excp_to; + u8 reserved_7[80]; + u32 pkru; + u8 reserved_7a[20]; + u64 reserved_8; + u64 rcx; + u64 rdx; + u64 rbx; + u64 reserved_9; + u64 rbp; + u64 rsi; + u64 rdi; + u64 r8; + u64 r9; + u64 r10; + u64 r11; + u64 r12; + u64 r13; + u64 r14; + u64 r15; + u8 reserved_10[16]; + u64 sw_exit_code; + u64 sw_exit_info_1; + u64 sw_exit_info_2; + u64 sw_scratch; + u8 reserved_11[56]; + u64 xcr0; + u8 valid_bitmap[16]; + u64 x87_state_gpa; +}; + +struct ghcb { + struct vmcb_save_area save; + u8 reserved_save[1016]; + u8 shared_buffer[2032]; + u8 reserved_1[10]; + u16 protocol_version; + u32 ghcb_usage; +}; + +enum intercept_words { + INTERCEPT_CR = 0, + INTERCEPT_DR = 1, + INTERCEPT_EXCEPTION = 2, + INTERCEPT_WORD3 = 3, + INTERCEPT_WORD4 = 4, + INTERCEPT_WORD5 = 5, + MAX_INTERCEPT = 6, +}; + +struct vmware_steal_time { + union { + uint64_t clock; + struct { + uint32_t clock_low; + uint32_t clock_high; + }; + }; + uint64_t reserved[7]; +}; + +struct mpc_intsrc { + unsigned char type; + unsigned char irqtype; + short unsigned int irqflag; + unsigned char srcbus; + unsigned char srcbusirq; + unsigned char dstapic; + unsigned char dstirq; +}; + +enum mp_irq_source_types { + mp_INT = 0, + mp_NMI = 1, + mp_SMI = 2, + mp_ExtINT = 3, +}; + +typedef u64 acpi_io_address; + +typedef u64 acpi_physical_address; + +typedef char *acpi_string; + +typedef void *acpi_handle; + +typedef u32 acpi_object_type; + +typedef u8 acpi_adr_space_type; + +union acpi_object { + acpi_object_type type; + struct { + acpi_object_type type; + u64 value; + } integer; + struct { + acpi_object_type type; + u32 length; + char *pointer; + } string; + struct { + acpi_object_type type; + u32 length; + u8 *pointer; + } buffer; + struct { + acpi_object_type type; + u32 count; + union acpi_object *elements; + } package; + struct { + acpi_object_type type; + acpi_object_type actual_type; + acpi_handle handle; + } reference; + struct { + acpi_object_type type; + u32 proc_id; + acpi_io_address pblk_address; + u32 pblk_length; + } processor; + struct { + acpi_object_type type; + u32 system_level; + u32 resource_order; + } power_resource; +}; + +struct acpi_object_list { + u32 count; + union acpi_object *pointer; +}; + +struct acpi_subtable_header { + u8 type; + u8 length; +}; + +struct acpi_table_boot { + struct acpi_table_header header; + u8 cmos_index; + u8 reserved[3]; +}; + +struct acpi_hmat_structure { + u16 type; + u16 reserved; + u32 length; +}; + +struct acpi_table_hpet { + struct acpi_table_header header; + u32 id; + struct acpi_generic_address address; + u8 sequence; + u16 minimum_tick; + u8 flags; +} __attribute__((packed)); + +struct acpi_table_madt { + struct acpi_table_header header; + u32 address; + u32 flags; +}; + +enum acpi_madt_type { + ACPI_MADT_TYPE_LOCAL_APIC = 0, + ACPI_MADT_TYPE_IO_APIC = 1, + ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2, + ACPI_MADT_TYPE_NMI_SOURCE = 3, + ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4, + ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5, + ACPI_MADT_TYPE_IO_SAPIC = 6, + ACPI_MADT_TYPE_LOCAL_SAPIC = 7, + ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8, + ACPI_MADT_TYPE_LOCAL_X2APIC = 9, + ACPI_MADT_TYPE_LOCAL_X2APIC_NMI = 10, + ACPI_MADT_TYPE_GENERIC_INTERRUPT = 11, + ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR = 12, + ACPI_MADT_TYPE_GENERIC_MSI_FRAME = 13, + ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR = 14, + ACPI_MADT_TYPE_GENERIC_TRANSLATOR = 15, + ACPI_MADT_TYPE_RESERVED = 16, +}; + +struct acpi_madt_local_apic { + struct acpi_subtable_header header; + u8 processor_id; + u8 id; + u32 lapic_flags; +}; + +struct acpi_madt_io_apic { + struct acpi_subtable_header header; + u8 id; + u8 reserved; + u32 address; + u32 global_irq_base; +}; + +struct acpi_madt_interrupt_override { + struct acpi_subtable_header header; + u8 bus; + u8 source_irq; + u32 global_irq; + u16 inti_flags; +} __attribute__((packed)); + +struct acpi_madt_nmi_source { + struct acpi_subtable_header header; + u16 inti_flags; + u32 global_irq; +}; + +struct acpi_madt_local_apic_nmi { + struct acpi_subtable_header header; + u8 processor_id; + u16 inti_flags; + u8 lint; +} __attribute__((packed)); + +struct acpi_madt_local_apic_override { + struct acpi_subtable_header header; + u16 reserved; + u64 address; +} __attribute__((packed)); + +struct acpi_madt_local_sapic { + struct acpi_subtable_header header; + u8 processor_id; + u8 id; + u8 eid; + u8 reserved[3]; + u32 lapic_flags; + u32 uid; + char uid_string[1]; +} __attribute__((packed)); + +struct acpi_madt_local_x2apic { + struct acpi_subtable_header header; + u16 reserved; + u32 local_apic_id; + u32 lapic_flags; + u32 uid; +}; + +struct acpi_madt_local_x2apic_nmi { + struct acpi_subtable_header header; + u16 inti_flags; + u32 uid; + u8 lint; + u8 reserved[3]; +}; + +union acpi_subtable_headers { + struct acpi_subtable_header common; + struct acpi_hmat_structure hmat; +}; + +typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *); + +typedef int (*acpi_tbl_entry_handler)(union acpi_subtable_headers *, const long unsigned int); + +struct acpi_subtable_proc { + int id; + acpi_tbl_entry_handler handler; + int count; +}; + +typedef u32 phys_cpuid_t; + +enum irq_alloc_type { + X86_IRQ_ALLOC_TYPE_IOAPIC = 1, + X86_IRQ_ALLOC_TYPE_HPET = 2, + X86_IRQ_ALLOC_TYPE_PCI_MSI = 3, + X86_IRQ_ALLOC_TYPE_PCI_MSIX = 4, + X86_IRQ_ALLOC_TYPE_DMAR = 5, + X86_IRQ_ALLOC_TYPE_AMDVI = 6, + X86_IRQ_ALLOC_TYPE_UV = 7, +}; + +struct ioapic_alloc_info { + int pin; + int node; + u32 is_level: 1; + u32 active_low: 1; + u32 valid: 1; +}; + +struct uv_alloc_info { + int limit; + int blade; + long unsigned int offset; + char *name; +}; + +struct irq_alloc_info { + enum irq_alloc_type type; + u32 flags; + u32 devid; + irq_hw_number_t hwirq; + const struct cpumask *mask; + struct msi_desc *desc; + void *data; + union { + struct ioapic_alloc_info ioapic; + struct uv_alloc_info uv; + }; +}; + +struct serial_icounter_struct { + int cts; + int dsr; + int rng; + int dcd; + int rx; + int tx; + int frame; + int overrun; + int parity; + int brk; + int buf_overrun; + int reserved[9]; +}; + +struct serial_struct { + int type; + int line; + unsigned int port; + int irq; + int flags; + int xmit_fifo_size; + int custom_divisor; + int baud_base; + short unsigned int close_delay; + char io_type; + char reserved_char[1]; + int hub6; + short unsigned int closing_wait; + short unsigned int closing_wait2; + unsigned char *iomem_base; + short unsigned int iomem_reg_shift; + unsigned int port_high; + long unsigned int iomap_base; +}; + +enum ioapic_domain_type { + IOAPIC_DOMAIN_INVALID = 0, + IOAPIC_DOMAIN_LEGACY = 1, + IOAPIC_DOMAIN_STRICT = 2, + IOAPIC_DOMAIN_DYNAMIC = 3, +}; + +struct ioapic_domain_cfg { + enum ioapic_domain_type type; + const struct irq_domain_ops *ops; + struct device_node *dev; +}; + +struct wakeup_header { + u16 video_mode; + u32 pmode_entry; + u16 pmode_cs; + u32 pmode_cr0; + u32 pmode_cr3; + u32 pmode_cr4; + u32 pmode_efer_low; + u32 pmode_efer_high; + u64 pmode_gdt; + u32 pmode_misc_en_low; + u32 pmode_misc_en_high; + u32 pmode_behavior; + u32 realmode_flags; + u32 real_magic; + u32 signature; +} __attribute__((packed)); + +struct acpi_hest_header { + u16 type; + u16 source_id; +}; + +struct acpi_hest_ia_error_bank { + u8 bank_number; + u8 clear_status_on_init; + u8 status_format; + u8 reserved; + u32 control_register; + u64 control_data; + u32 status_register; + u32 address_register; + u32 misc_register; +} __attribute__((packed)); + +struct acpi_hest_notify { + u8 type; + u8 length; + u16 config_write_enable; + u32 poll_interval; + u32 vector; + u32 polling_threshold_value; + u32 polling_threshold_window; + u32 error_threshold_value; + u32 error_threshold_window; +}; + +struct acpi_hest_ia_corrected { + struct acpi_hest_header header; + u16 reserved1; + u8 flags; + u8 enabled; + u32 records_to_preallocate; + u32 max_sections_per_record; + struct acpi_hest_notify notify; + u8 num_hardware_banks; + u8 reserved2[3]; +}; + +struct cpc_reg { + u8 descriptor; + u16 length; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_width; + u64 address; +} __attribute__((packed)); + +struct acpi_power_register { + u8 descriptor; + u16 length; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_size; + u64 address; +} __attribute__((packed)); + +struct acpi_processor_cx { + u8 valid; + u8 type; + u32 address; + u8 entry_method; + u8 index; + u32 latency; + u8 bm_sts_skip; + char desc[32]; +}; + +struct acpi_processor_flags { + u8 power: 1; + u8 performance: 1; + u8 throttling: 1; + u8 limit: 1; + u8 bm_control: 1; + u8 bm_check: 1; + u8 has_cst: 1; + u8 has_lpi: 1; + u8 power_setup_done: 1; + u8 bm_rld_set: 1; + u8 need_hotplug_init: 1; +}; + +struct cstate_entry { + struct { + unsigned int eax; + unsigned int ecx; + } states[8]; +}; + +enum reboot_mode { + REBOOT_UNDEFINED = 4294967295, + REBOOT_COLD = 0, + REBOOT_WARM = 1, + REBOOT_HARD = 2, + REBOOT_SOFT = 3, + REBOOT_GPIO = 4, +}; + +enum reboot_type { + BOOT_TRIPLE = 116, + BOOT_KBD = 107, + BOOT_BIOS = 98, + BOOT_ACPI = 97, + BOOT_EFI = 101, + BOOT_CF9_FORCE = 112, + BOOT_CF9_SAFE = 113, +}; + +typedef void (*nmi_shootdown_cb)(int, struct pt_regs *); + +enum allow_write_msrs { + MSR_WRITES_ON = 0, + MSR_WRITES_OFF = 1, + MSR_WRITES_DEFAULT = 2, +}; + +typedef struct __call_single_data call_single_data_t; + +struct cpuid_regs_done { + struct cpuid_regs regs; + struct completion done; +}; + +struct intel_early_ops { + resource_size_t (*stolen_size)(int, int, int); + resource_size_t (*stolen_base)(int, int, int, resource_size_t); +}; + +struct chipset { + u32 vendor; + u32 device; + u32 class; + u32 class_mask; + u32 flags; + void (*f)(int, int, int); +}; + +enum { + SD_BALANCE_NEWIDLE = 1, + SD_BALANCE_EXEC = 2, + SD_BALANCE_FORK = 4, + SD_BALANCE_WAKE = 8, + SD_WAKE_AFFINE = 16, + SD_ASYM_CPUCAPACITY = 32, + SD_SHARE_CPUCAPACITY = 64, + SD_SHARE_PKG_RESOURCES = 128, + SD_SERIALIZE = 256, + SD_ASYM_PACKING = 512, + SD_PREFER_SIBLING = 1024, + SD_OVERLAP = 2048, + SD_NUMA = 4096, +}; + +struct sched_domain_shared { + atomic_t ref; + atomic_t nr_busy_cpus; + int has_idle_cores; +}; + +struct sched_group; + +struct sched_domain { + struct sched_domain *parent; + struct sched_domain *child; + struct sched_group *groups; + long unsigned int min_interval; + long unsigned int max_interval; + unsigned int busy_factor; + unsigned int imbalance_pct; + unsigned int cache_nice_tries; + int nohz_idle; + int flags; + int level; + long unsigned int last_balance; + unsigned int balance_interval; + unsigned int nr_balance_failed; + u64 max_newidle_lb_cost; + long unsigned int next_decay_max_lb_cost; + u64 avg_scan_cost; + unsigned int lb_count[3]; + unsigned int lb_failed[3]; + unsigned int lb_balanced[3]; + unsigned int lb_imbalance[3]; + unsigned int lb_gained[3]; + unsigned int lb_hot_gained[3]; + unsigned int lb_nobusyg[3]; + unsigned int lb_nobusyq[3]; + unsigned int alb_count; + unsigned int alb_failed; + unsigned int alb_pushed; + unsigned int sbe_count; + unsigned int sbe_balanced; + unsigned int sbe_pushed; + unsigned int sbf_count; + unsigned int sbf_balanced; + unsigned int sbf_pushed; + unsigned int ttwu_wake_remote; + unsigned int ttwu_move_affine; + unsigned int ttwu_move_balance; + char *name; + union { + void *private; + struct callback_head rcu; + }; + struct sched_domain_shared *shared; + unsigned int span_weight; + long unsigned int span[0]; +}; + +typedef const struct cpumask * (*sched_domain_mask_f)(int); + +typedef int (*sched_domain_flags_f)(); + +struct sched_group_capacity; + +struct sd_data { + struct sched_domain **sd; + struct sched_domain_shared **sds; + struct sched_group **sg; + struct sched_group_capacity **sgc; +}; + +struct sched_domain_topology_level { + sched_domain_mask_f mask; + sched_domain_flags_f sd_flags; + int flags; + int numa_level; + struct sd_data data; + char *name; +}; + +enum apic_intr_mode_id { + APIC_PIC = 0, + APIC_VIRTUAL_WIRE = 1, + APIC_VIRTUAL_WIRE_NO_CONFIG = 2, + APIC_SYMMETRIC_IO = 3, + APIC_SYMMETRIC_IO_NO_ROUTING = 4, +}; + +struct cppc_perf_caps { + u32 guaranteed_perf; + u32 highest_perf; + u32 nominal_perf; + u32 lowest_perf; + u32 lowest_nonlinear_perf; + u32 lowest_freq; + u32 nominal_freq; +}; + +struct tsc_adjust { + s64 bootval; + s64 adjusted; + long unsigned int nextcheck; + bool warned; +}; + +typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int, size_t, size_t); + +typedef void (*pcpu_fc_free_fn_t)(void *, size_t); + +typedef void (*pcpu_fc_populate_pte_fn_t)(long unsigned int); + +typedef int pcpu_fc_cpu_distance_fn_t(unsigned int, unsigned int); + +enum { + DUMP_PREFIX_NONE = 0, + DUMP_PREFIX_ADDRESS = 1, + DUMP_PREFIX_OFFSET = 2, +}; + +struct mpf_intel { + char signature[4]; + unsigned int physptr; + unsigned char length; + unsigned char specification; + unsigned char checksum; + unsigned char feature1; + unsigned char feature2; + unsigned char feature3; + unsigned char feature4; + unsigned char feature5; +}; + +struct mpc_table { + char signature[4]; + short unsigned int length; + char spec; + char checksum; + char oem[8]; + char productid[12]; + unsigned int oemptr; + short unsigned int oemsize; + short unsigned int oemcount; + unsigned int lapic; + unsigned int reserved; +}; + +struct mpc_cpu { + unsigned char type; + unsigned char apicid; + unsigned char apicver; + unsigned char cpuflag; + unsigned int cpufeature; + unsigned int featureflag; + unsigned int reserved[2]; +}; + +struct mpc_bus { + unsigned char type; + unsigned char busid; + unsigned char bustype[6]; +}; + +struct mpc_ioapic { + unsigned char type; + unsigned char apicid; + unsigned char apicver; + unsigned char flags; + unsigned int apicaddr; +}; + +struct mpc_lintsrc { + unsigned char type; + unsigned char irqtype; + short unsigned int irqflag; + unsigned char srcbusid; + unsigned char srcbusirq; + unsigned char destapic; + unsigned char destapiclint; +}; + +enum page_cache_mode { + _PAGE_CACHE_MODE_WB = 0, + _PAGE_CACHE_MODE_WC = 1, + _PAGE_CACHE_MODE_UC_MINUS = 2, + _PAGE_CACHE_MODE_UC = 3, + _PAGE_CACHE_MODE_WT = 4, + _PAGE_CACHE_MODE_WP = 5, + _PAGE_CACHE_MODE_NUM = 8, +}; + +struct irq_cfg { + unsigned int dest_apicid; + unsigned int vector; +}; + +enum { + IRQ_REMAP_XAPIC_MODE = 0, + IRQ_REMAP_X2APIC_MODE = 1, +}; + +union apic_ir { + long unsigned int map[4]; + u32 regs[8]; +}; + +enum { + X2APIC_OFF = 0, + X2APIC_ON = 1, + X2APIC_DISABLED = 2, +}; + +enum { + IRQ_SET_MASK_OK = 0, + IRQ_SET_MASK_OK_NOCOPY = 1, + IRQ_SET_MASK_OK_DONE = 2, +}; + +enum { + IRQD_TRIGGER_MASK = 15, + IRQD_SETAFFINITY_PENDING = 256, + IRQD_ACTIVATED = 512, + IRQD_NO_BALANCING = 1024, + IRQD_PER_CPU = 2048, + IRQD_AFFINITY_SET = 4096, + IRQD_LEVEL = 8192, + IRQD_WAKEUP_STATE = 16384, + IRQD_MOVE_PCNTXT = 32768, + IRQD_IRQ_DISABLED = 65536, + IRQD_IRQ_MASKED = 131072, + IRQD_IRQ_INPROGRESS = 262144, + IRQD_WAKEUP_ARMED = 524288, + IRQD_FORWARDED_TO_VCPU = 1048576, + IRQD_AFFINITY_MANAGED = 2097152, + IRQD_IRQ_STARTED = 4194304, + IRQD_MANAGED_SHUTDOWN = 8388608, + IRQD_SINGLE_TARGET = 16777216, + IRQD_DEFAULT_TRIGGER_SET = 33554432, + IRQD_CAN_RESERVE = 67108864, + IRQD_MSI_NOMASK_QUIRK = 134217728, + IRQD_HANDLE_ENFORCE_IRQCTX = 268435456, + IRQD_AFFINITY_ON_ACTIVATE = 536870912, + IRQD_IRQ_ENABLED_ON_SUSPEND = 1073741824, +}; + +enum { + IRQCHIP_FWNODE_REAL = 0, + IRQCHIP_FWNODE_NAMED = 1, + IRQCHIP_FWNODE_NAMED_ID = 2, +}; + +enum { + X86_IRQ_ALLOC_CONTIGUOUS_VECTORS = 1, + X86_IRQ_ALLOC_LEGACY = 2, +}; + +struct apic_chip_data { + struct irq_cfg hw_irq_cfg; + unsigned int vector; + unsigned int prev_vector; + unsigned int cpu; + unsigned int prev_cpu; + unsigned int irq; + struct hlist_node clist; + unsigned int move_in_progress: 1; + unsigned int is_managed: 1; + unsigned int can_reserve: 1; + unsigned int has_reserved: 1; +}; + +struct irq_matrix; + +enum { + IRQ_TYPE_NONE = 0, + IRQ_TYPE_EDGE_RISING = 1, + IRQ_TYPE_EDGE_FALLING = 2, + IRQ_TYPE_EDGE_BOTH = 3, + IRQ_TYPE_LEVEL_HIGH = 4, + IRQ_TYPE_LEVEL_LOW = 8, + IRQ_TYPE_LEVEL_MASK = 12, + IRQ_TYPE_SENSE_MASK = 15, + IRQ_TYPE_DEFAULT = 15, + IRQ_TYPE_PROBE = 16, + IRQ_LEVEL = 256, + IRQ_PER_CPU = 512, + IRQ_NOPROBE = 1024, + IRQ_NOREQUEST = 2048, + IRQ_NOAUTOEN = 4096, + IRQ_NO_BALANCING = 8192, + IRQ_MOVE_PCNTXT = 16384, + IRQ_NESTED_THREAD = 32768, + IRQ_NOTHREAD = 65536, + IRQ_PER_CPU_DEVID = 131072, + IRQ_IS_POLLED = 262144, + IRQ_DISABLE_UNLAZY = 524288, + IRQ_HIDDEN = 1048576, +}; + +enum { + IRQCHIP_SET_TYPE_MASKED = 1, + IRQCHIP_EOI_IF_HANDLED = 2, + IRQCHIP_MASK_ON_SUSPEND = 4, + IRQCHIP_ONOFFLINE_ENABLED = 8, + IRQCHIP_SKIP_SET_WAKE = 16, + IRQCHIP_ONESHOT_SAFE = 32, + IRQCHIP_EOI_THREADED = 64, + IRQCHIP_SUPPORTS_LEVEL_MSI = 128, + IRQCHIP_SUPPORTS_NMI = 256, + IRQCHIP_ENABLE_WAKEUP_ON_SUSPEND = 512, +}; + +struct clock_event_device___2; + +union IO_APIC_reg_00 { + u32 raw; + struct { + u32 __reserved_2: 14; + u32 LTS: 1; + u32 delivery_type: 1; + u32 __reserved_1: 8; + u32 ID: 8; + } bits; +}; + +union IO_APIC_reg_01 { + u32 raw; + struct { + u32 version: 8; + u32 __reserved_2: 7; + u32 PRQ: 1; + u32 entries: 8; + u32 __reserved_1: 8; + } bits; +}; + +union IO_APIC_reg_02 { + u32 raw; + struct { + u32 __reserved_2: 24; + u32 arbitration: 4; + u32 __reserved_1: 4; + } bits; +}; + +union IO_APIC_reg_03 { + u32 raw; + struct { + u32 boot_DT: 1; + u32 __reserved_1: 31; + } bits; +}; + +struct IO_APIC_route_entry { + union { + struct { + u64 vector: 8; + u64 delivery_mode: 3; + u64 dest_mode_logical: 1; + u64 delivery_status: 1; + u64 active_low: 1; + u64 irr: 1; + u64 is_level: 1; + u64 masked: 1; + u64 reserved_0: 15; + u64 reserved_1: 17; + u64 virt_destid_8_14: 7; + u64 destid_0_7: 8; + }; + struct { + u64 ir_shared_0: 8; + u64 ir_zero: 3; + u64 ir_index_15: 1; + u64 ir_shared_1: 5; + u64 ir_reserved_0: 31; + u64 ir_format: 1; + u64 ir_index_0_14: 15; + }; + struct { + u64 w1: 32; + u64 w2: 32; + }; + }; +}; + +struct irq_pin_list { + struct list_head list; + int apic; + int pin; +}; + +struct mp_chip_data { + struct list_head irq_2_pin; + struct IO_APIC_route_entry entry; + bool is_level; + bool active_low; + bool isa_irq; + u32 count; +}; + +struct mp_ioapic_gsi { + u32 gsi_base; + u32 gsi_end; +}; + +struct ioapic { + int nr_registers; + struct IO_APIC_route_entry *saved_registers; + struct mpc_ioapic mp_config; + struct mp_ioapic_gsi gsi_config; + struct ioapic_domain_cfg irqdomain_cfg; + struct irq_domain *irqdomain; + struct resource *iomem_res; +}; + +struct io_apic { + unsigned int index; + unsigned int unused[3]; + unsigned int data; + unsigned int unused2[11]; + unsigned int eoi; +}; + +enum { + IRQ_DOMAIN_FLAG_HIERARCHY = 1, + IRQ_DOMAIN_NAME_ALLOCATED = 2, + IRQ_DOMAIN_FLAG_IPI_PER_CPU = 4, + IRQ_DOMAIN_FLAG_IPI_SINGLE = 8, + IRQ_DOMAIN_FLAG_MSI = 16, + IRQ_DOMAIN_FLAG_MSI_REMAP = 32, + IRQ_DOMAIN_MSI_NOMASK_QUIRK = 64, + IRQ_DOMAIN_FLAG_NONCORE = 65536, +}; + +typedef struct irq_alloc_info msi_alloc_info_t; + +struct msi_domain_info; + +struct msi_domain_ops { + irq_hw_number_t (*get_hwirq)(struct msi_domain_info *, msi_alloc_info_t *); + int (*msi_init)(struct irq_domain *, struct msi_domain_info *, unsigned int, irq_hw_number_t, msi_alloc_info_t *); + void (*msi_free)(struct irq_domain *, struct msi_domain_info *, unsigned int); + int (*msi_check)(struct irq_domain *, struct msi_domain_info *, struct device *); + int (*msi_prepare)(struct irq_domain *, struct device *, int, msi_alloc_info_t *); + void (*msi_finish)(msi_alloc_info_t *, int); + void (*set_desc)(msi_alloc_info_t *, struct msi_desc *); + int (*handle_error)(struct irq_domain *, struct msi_desc *, int); + int (*domain_alloc_irqs)(struct irq_domain *, struct device *, int); + void (*domain_free_irqs)(struct irq_domain *, struct device *); +}; + +struct msi_domain_info { + u32 flags; + struct msi_domain_ops *ops; + struct irq_chip *chip; + void *chip_data; + irq_flow_handler_t handler; + void *handler_data; + const char *handler_name; + void *data; +}; + +enum { + MSI_FLAG_USE_DEF_DOM_OPS = 1, + MSI_FLAG_USE_DEF_CHIP_OPS = 2, + MSI_FLAG_MULTI_PCI_MSI = 4, + MSI_FLAG_PCI_MSIX = 8, + MSI_FLAG_ACTIVATE_EARLY = 16, + MSI_FLAG_MUST_REACTIVATE = 32, + MSI_FLAG_LEVEL_CAPABLE = 64, +}; + +typedef int (*arch_set_vga_state_t)(struct pci_dev *, bool, unsigned int, u32); + +struct acpi_device_status { + u32 present: 1; + u32 enabled: 1; + u32 show_in_ui: 1; + u32 functional: 1; + u32 battery_present: 1; + u32 reserved: 27; +}; + +struct acpi_device_flags { + u32 dynamic_status: 1; + u32 removable: 1; + u32 ejectable: 1; + u32 power_manageable: 1; + u32 match_driver: 1; + u32 initialized: 1; + u32 visited: 1; + u32 hotplug_notify: 1; + u32 is_dock_station: 1; + u32 of_compatible_ok: 1; + u32 coherent_dma: 1; + u32 cca_seen: 1; + u32 enumeration_by_parent: 1; + u32 reserved: 19; +}; + +typedef char acpi_bus_id[8]; + +struct acpi_pnp_type { + u32 hardware_id: 1; + u32 bus_address: 1; + u32 platform_id: 1; + u32 reserved: 29; +}; + +typedef u64 acpi_bus_address; + +typedef char acpi_device_name[40]; + +typedef char acpi_device_class[20]; + +struct acpi_device_pnp { + acpi_bus_id bus_id; + int instance_no; + struct acpi_pnp_type type; + acpi_bus_address bus_address; + char *unique_id; + struct list_head ids; + acpi_device_name device_name; + acpi_device_class device_class; + union acpi_object *str_obj; +}; + +struct acpi_device_power_flags { + u32 explicit_get: 1; + u32 power_resources: 1; + u32 inrush_current: 1; + u32 power_removed: 1; + u32 ignore_parent: 1; + u32 dsw_present: 1; + u32 reserved: 26; +}; + +struct acpi_device_power_state { + struct { + u8 valid: 1; + u8 explicit_set: 1; + u8 reserved: 6; + } flags; + int power; + int latency; + struct list_head resources; +}; + +struct acpi_device_power { + int state; + struct acpi_device_power_flags flags; + struct acpi_device_power_state states[5]; +}; + +struct acpi_device_wakeup_flags { + u8 valid: 1; + u8 notifier_present: 1; +}; + +struct acpi_device_wakeup_context { + void (*func)(struct acpi_device_wakeup_context *); + struct device *dev; +}; + +struct acpi_device_wakeup { + acpi_handle gpe_device; + u64 gpe_number; + u64 sleep_state; + struct list_head resources; + struct acpi_device_wakeup_flags flags; + struct acpi_device_wakeup_context context; + struct wakeup_source *ws; + int prepare_count; + int enable_count; +}; + +struct acpi_device_perf_flags { + u8 reserved: 8; +}; + +struct acpi_device_perf_state; + +struct acpi_device_perf { + int state; + struct acpi_device_perf_flags flags; + int state_count; + struct acpi_device_perf_state *states; +}; + +struct acpi_device_dir { + struct proc_dir_entry *entry; +}; + +struct acpi_device_data { + const union acpi_object *pointer; + struct list_head properties; + const union acpi_object *of_compatible; + struct list_head subnodes; +}; + +struct acpi_scan_handler; + +struct acpi_hotplug_context; + +struct acpi_driver; + +struct acpi_gpio_mapping; + +struct acpi_device { + int device_type; + acpi_handle handle; + struct fwnode_handle fwnode; + struct acpi_device *parent; + struct list_head children; + struct list_head node; + struct list_head wakeup_list; + struct list_head del_list; + struct acpi_device_status status; + struct acpi_device_flags flags; + struct acpi_device_pnp pnp; + struct acpi_device_power power; + struct acpi_device_wakeup wakeup; + struct acpi_device_perf performance; + struct acpi_device_dir dir; + struct acpi_device_data data; + struct acpi_scan_handler *handler; + struct acpi_hotplug_context *hp; + struct acpi_driver *driver; + const struct acpi_gpio_mapping *driver_gpios; + void *driver_data; + struct device dev; + unsigned int physical_node_count; + unsigned int dep_unmet; + struct list_head physical_node_list; + struct mutex physical_node_lock; + void (*remove)(struct acpi_device *); +}; + +struct acpi_hotplug_profile { + struct kobject kobj; + int (*scan_dependent)(struct acpi_device *); + void (*notify_online)(struct acpi_device *); + bool enabled: 1; + bool demand_offline: 1; +}; + +struct acpi_scan_handler { + const struct acpi_device_id *ids; + struct list_head list_node; + bool (*match)(const char *, const struct acpi_device_id **); + int (*attach)(struct acpi_device *, const struct acpi_device_id *); + void (*detach)(struct acpi_device *); + void (*bind)(struct device *); + void (*unbind)(struct device *); + struct acpi_hotplug_profile hotplug; +}; + +struct acpi_hotplug_context { + struct acpi_device *self; + int (*notify)(struct acpi_device *, u32); + void (*uevent)(struct acpi_device *, u32); + void (*fixup)(struct acpi_device *); +}; + +typedef int (*acpi_op_add)(struct acpi_device *); + +typedef int (*acpi_op_remove)(struct acpi_device *); + +typedef void (*acpi_op_notify)(struct acpi_device *, u32); + +struct acpi_device_ops { + acpi_op_add add; + acpi_op_remove remove; + acpi_op_notify notify; +}; + +struct acpi_driver { + char name[80]; + char class[80]; + const struct acpi_device_id *ids; + unsigned int flags; + struct acpi_device_ops ops; + struct device_driver drv; + struct module *owner; +}; + +struct acpi_device_perf_state { + struct { + u8 valid: 1; + u8 reserved: 7; + } flags; + u8 power; + u8 performance; + int latency; +}; + +struct acpi_gpio_params; + +struct acpi_gpio_mapping { + const char *name; + const struct acpi_gpio_params *data; + unsigned int size; + unsigned int quirks; +}; + +struct acpi_gpio_params { + unsigned int crs_entry_index; + unsigned int line_index; + bool active_low; +}; + +struct uvyh_gr0_gam_gr_config_s { + long unsigned int rsvd_0_9: 10; + long unsigned int subspace: 1; + long unsigned int rsvd_11_63: 53; +}; + +struct uv5h_gr0_gam_gr_config_s { + long unsigned int rsvd_0_9: 10; + long unsigned int subspace: 1; + long unsigned int rsvd_11_63: 53; +}; + +struct uv4h_gr0_gam_gr_config_s { + long unsigned int rsvd_0_9: 10; + long unsigned int subspace: 1; + long unsigned int rsvd_11_63: 53; +}; + +struct uv3h_gr0_gam_gr_config_s { + long unsigned int m_skt: 6; + long unsigned int undef_6_9: 4; + long unsigned int subspace: 1; + long unsigned int reserved: 53; +}; + +struct uv2h_gr0_gam_gr_config_s { + long unsigned int n_gr: 4; + long unsigned int reserved: 60; +}; + +union uvyh_gr0_gam_gr_config_u { + long unsigned int v; + struct uvyh_gr0_gam_gr_config_s sy; + struct uv5h_gr0_gam_gr_config_s s5; + struct uv4h_gr0_gam_gr_config_s s4; + struct uv3h_gr0_gam_gr_config_s s3; + struct uv2h_gr0_gam_gr_config_s s2; +}; + +struct uvh_node_id_s { + long unsigned int force1: 1; + long unsigned int manufacturer: 11; + long unsigned int part_number: 16; + long unsigned int revision: 4; + long unsigned int rsvd_32_63: 32; +}; + +struct uvxh_node_id_s { + long unsigned int force1: 1; + long unsigned int manufacturer: 11; + long unsigned int part_number: 16; + long unsigned int revision: 4; + long unsigned int node_id: 15; + long unsigned int rsvd_47_49: 3; + long unsigned int nodes_per_bit: 7; + long unsigned int ni_port: 5; + long unsigned int rsvd_62_63: 2; +}; + +struct uvyh_node_id_s { + long unsigned int force1: 1; + long unsigned int manufacturer: 11; + long unsigned int part_number: 16; + long unsigned int revision: 4; + long unsigned int node_id: 7; + long unsigned int rsvd_39_56: 18; + long unsigned int ni_port: 6; + long unsigned int rsvd_63: 1; +}; + +struct uv5h_node_id_s { + long unsigned int force1: 1; + long unsigned int manufacturer: 11; + long unsigned int part_number: 16; + long unsigned int revision: 4; + long unsigned int node_id: 7; + long unsigned int rsvd_39_56: 18; + long unsigned int ni_port: 6; + long unsigned int rsvd_63: 1; +}; + +struct uv4h_node_id_s { + long unsigned int force1: 1; + long unsigned int manufacturer: 11; + long unsigned int part_number: 16; + long unsigned int revision: 4; + long unsigned int node_id: 15; + long unsigned int rsvd_47: 1; + long unsigned int router_select: 1; + long unsigned int rsvd_49: 1; + long unsigned int nodes_per_bit: 7; + long unsigned int ni_port: 5; + long unsigned int rsvd_62_63: 2; +}; + +struct uv3h_node_id_s { + long unsigned int force1: 1; + long unsigned int manufacturer: 11; + long unsigned int part_number: 16; + long unsigned int revision: 4; + long unsigned int node_id: 15; + long unsigned int rsvd_47: 1; + long unsigned int router_select: 1; + long unsigned int rsvd_49: 1; + long unsigned int nodes_per_bit: 7; + long unsigned int ni_port: 5; + long unsigned int rsvd_62_63: 2; +}; + +struct uv2h_node_id_s { + long unsigned int force1: 1; + long unsigned int manufacturer: 11; + long unsigned int part_number: 16; + long unsigned int revision: 4; + long unsigned int node_id: 15; + long unsigned int rsvd_47_49: 3; + long unsigned int nodes_per_bit: 7; + long unsigned int ni_port: 5; + long unsigned int rsvd_62_63: 2; +}; + +union uvh_node_id_u { + long unsigned int v; + struct uvh_node_id_s s; + struct uvxh_node_id_s sx; + struct uvyh_node_id_s sy; + struct uv5h_node_id_s s5; + struct uv4h_node_id_s s4; + struct uv3h_node_id_s s3; + struct uv2h_node_id_s s2; +}; + +struct uvh_rh10_gam_addr_map_config_s { + long unsigned int undef_0_5: 6; + long unsigned int n_skt: 3; + long unsigned int undef_9_11: 3; + long unsigned int ls_enable: 1; + long unsigned int undef_13_15: 3; + long unsigned int mk_tme_keyid_bits: 4; + long unsigned int rsvd_20_63: 44; +}; + +struct uvyh_rh10_gam_addr_map_config_s { + long unsigned int undef_0_5: 6; + long unsigned int n_skt: 3; + long unsigned int undef_9_11: 3; + long unsigned int ls_enable: 1; + long unsigned int undef_13_15: 3; + long unsigned int mk_tme_keyid_bits: 4; + long unsigned int rsvd_20_63: 44; +}; + +struct uv5h_rh10_gam_addr_map_config_s { + long unsigned int undef_0_5: 6; + long unsigned int n_skt: 3; + long unsigned int undef_9_11: 3; + long unsigned int ls_enable: 1; + long unsigned int undef_13_15: 3; + long unsigned int mk_tme_keyid_bits: 4; +}; + +union uvh_rh10_gam_addr_map_config_u { + long unsigned int v; + struct uvh_rh10_gam_addr_map_config_s s; + struct uvyh_rh10_gam_addr_map_config_s sy; + struct uv5h_rh10_gam_addr_map_config_s s5; +}; + +struct uvh_rh10_gam_mmioh_overlay_config0_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 26; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int undef_62: 1; + long unsigned int enable: 1; +}; + +struct uvyh_rh10_gam_mmioh_overlay_config0_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 26; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int undef_62: 1; + long unsigned int enable: 1; +}; + +struct uv5h_rh10_gam_mmioh_overlay_config0_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 26; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int undef_62: 1; + long unsigned int enable: 1; +}; + +union uvh_rh10_gam_mmioh_overlay_config0_u { + long unsigned int v; + struct uvh_rh10_gam_mmioh_overlay_config0_s s; + struct uvyh_rh10_gam_mmioh_overlay_config0_s sy; + struct uv5h_rh10_gam_mmioh_overlay_config0_s s5; +}; + +struct uvh_rh10_gam_mmioh_overlay_config1_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 26; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int undef_62: 1; + long unsigned int enable: 1; +}; + +struct uvyh_rh10_gam_mmioh_overlay_config1_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 26; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int undef_62: 1; + long unsigned int enable: 1; +}; + +struct uv5h_rh10_gam_mmioh_overlay_config1_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 26; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int undef_62: 1; + long unsigned int enable: 1; +}; + +union uvh_rh10_gam_mmioh_overlay_config1_u { + long unsigned int v; + struct uvh_rh10_gam_mmioh_overlay_config1_s s; + struct uvyh_rh10_gam_mmioh_overlay_config1_s sy; + struct uv5h_rh10_gam_mmioh_overlay_config1_s s5; +}; + +struct uvh_rh10_gam_mmr_overlay_config_s { + long unsigned int undef_0_24: 25; + long unsigned int base: 27; + long unsigned int undef_52_62: 11; + long unsigned int enable: 1; +}; + +struct uvyh_rh10_gam_mmr_overlay_config_s { + long unsigned int undef_0_24: 25; + long unsigned int base: 27; + long unsigned int undef_52_62: 11; + long unsigned int enable: 1; +}; + +struct uv5h_rh10_gam_mmr_overlay_config_s { + long unsigned int undef_0_24: 25; + long unsigned int base: 27; + long unsigned int undef_52_62: 11; + long unsigned int enable: 1; +}; + +union uvh_rh10_gam_mmr_overlay_config_u { + long unsigned int v; + struct uvh_rh10_gam_mmr_overlay_config_s s; + struct uvyh_rh10_gam_mmr_overlay_config_s sy; + struct uv5h_rh10_gam_mmr_overlay_config_s s5; +}; + +struct uvh_rh_gam_addr_map_config_s { + long unsigned int rsvd_0_5: 6; + long unsigned int n_skt: 4; + long unsigned int rsvd_10_63: 54; +}; + +struct uvxh_rh_gam_addr_map_config_s { + long unsigned int rsvd_0_5: 6; + long unsigned int n_skt: 4; + long unsigned int rsvd_10_63: 54; +}; + +struct uv4h_rh_gam_addr_map_config_s { + long unsigned int rsvd_0_5: 6; + long unsigned int n_skt: 4; + long unsigned int rsvd_10_63: 54; +}; + +struct uv3h_rh_gam_addr_map_config_s { + long unsigned int m_skt: 6; + long unsigned int n_skt: 4; + long unsigned int rsvd_10_63: 54; +}; + +struct uv2h_rh_gam_addr_map_config_s { + long unsigned int m_skt: 6; + long unsigned int n_skt: 4; + long unsigned int rsvd_10_63: 54; +}; + +union uvh_rh_gam_addr_map_config_u { + long unsigned int v; + struct uvh_rh_gam_addr_map_config_s s; + struct uvxh_rh_gam_addr_map_config_s sx; + struct uv4h_rh_gam_addr_map_config_s s4; + struct uv3h_rh_gam_addr_map_config_s s3; + struct uv2h_rh_gam_addr_map_config_s s2; +}; + +struct uvh_rh_gam_alias_2_overlay_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int base: 8; + long unsigned int rsvd_32_47: 16; + long unsigned int m_alias: 5; + long unsigned int rsvd_53_62: 10; + long unsigned int enable: 1; +}; + +struct uvxh_rh_gam_alias_2_overlay_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int base: 8; + long unsigned int rsvd_32_47: 16; + long unsigned int m_alias: 5; + long unsigned int rsvd_53_62: 10; + long unsigned int enable: 1; +}; + +struct uv4h_rh_gam_alias_2_overlay_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int base: 8; + long unsigned int rsvd_32_47: 16; + long unsigned int m_alias: 5; + long unsigned int rsvd_53_62: 10; + long unsigned int enable: 1; +}; + +struct uv3h_rh_gam_alias_2_overlay_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int base: 8; + long unsigned int rsvd_32_47: 16; + long unsigned int m_alias: 5; + long unsigned int rsvd_53_62: 10; + long unsigned int enable: 1; +}; + +struct uv2h_rh_gam_alias_2_overlay_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int base: 8; + long unsigned int rsvd_32_47: 16; + long unsigned int m_alias: 5; + long unsigned int rsvd_53_62: 10; + long unsigned int enable: 1; +}; + +union uvh_rh_gam_alias_2_overlay_config_u { + long unsigned int v; + struct uvh_rh_gam_alias_2_overlay_config_s s; + struct uvxh_rh_gam_alias_2_overlay_config_s sx; + struct uv4h_rh_gam_alias_2_overlay_config_s s4; + struct uv3h_rh_gam_alias_2_overlay_config_s s3; + struct uv2h_rh_gam_alias_2_overlay_config_s s2; +}; + +struct uvh_rh_gam_alias_2_redirect_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int dest_base: 22; + long unsigned int rsvd_46_63: 18; +}; + +struct uvxh_rh_gam_alias_2_redirect_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int dest_base: 22; + long unsigned int rsvd_46_63: 18; +}; + +struct uv4h_rh_gam_alias_2_redirect_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int dest_base: 22; + long unsigned int rsvd_46_63: 18; +}; + +struct uv3h_rh_gam_alias_2_redirect_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int dest_base: 22; + long unsigned int rsvd_46_63: 18; +}; + +struct uv2h_rh_gam_alias_2_redirect_config_s { + long unsigned int rsvd_0_23: 24; + long unsigned int dest_base: 22; + long unsigned int rsvd_46_63: 18; +}; + +union uvh_rh_gam_alias_2_redirect_config_u { + long unsigned int v; + struct uvh_rh_gam_alias_2_redirect_config_s s; + struct uvxh_rh_gam_alias_2_redirect_config_s sx; + struct uv4h_rh_gam_alias_2_redirect_config_s s4; + struct uv3h_rh_gam_alias_2_redirect_config_s s3; + struct uv2h_rh_gam_alias_2_redirect_config_s s2; +}; + +struct uvh_rh_gam_gru_overlay_config_s { + long unsigned int rsvd_0_45: 46; + long unsigned int rsvd_46_51: 6; + long unsigned int n_gru: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uvxh_rh_gam_gru_overlay_config_s { + long unsigned int rsvd_0_45: 46; + long unsigned int rsvd_46_51: 6; + long unsigned int n_gru: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uv4ah_rh_gam_gru_overlay_config_s { + long unsigned int rsvd_0_24: 25; + long unsigned int undef_25: 1; + long unsigned int base: 26; + long unsigned int n_gru: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uv4h_rh_gam_gru_overlay_config_s { + long unsigned int rsvd_0_24: 25; + long unsigned int undef_25: 1; + long unsigned int base: 20; + long unsigned int rsvd_46_51: 6; + long unsigned int n_gru: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uv3h_rh_gam_gru_overlay_config_s { + long unsigned int rsvd_0_27: 28; + long unsigned int base: 18; + long unsigned int rsvd_46_51: 6; + long unsigned int n_gru: 4; + long unsigned int rsvd_56_61: 6; + long unsigned int mode: 1; + long unsigned int enable: 1; +}; + +struct uv2h_rh_gam_gru_overlay_config_s { + long unsigned int rsvd_0_27: 28; + long unsigned int base: 18; + long unsigned int rsvd_46_51: 6; + long unsigned int n_gru: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +union uvh_rh_gam_gru_overlay_config_u { + long unsigned int v; + struct uvh_rh_gam_gru_overlay_config_s s; + struct uvxh_rh_gam_gru_overlay_config_s sx; + struct uv4ah_rh_gam_gru_overlay_config_s s4a; + struct uv4h_rh_gam_gru_overlay_config_s s4; + struct uv3h_rh_gam_gru_overlay_config_s s3; + struct uv2h_rh_gam_gru_overlay_config_s s2; +}; + +struct uvh_rh_gam_mmioh_overlay_config_s { + long unsigned int rsvd_0_26: 27; + long unsigned int base: 19; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uvxh_rh_gam_mmioh_overlay_config_s { + long unsigned int rsvd_0_26: 27; + long unsigned int base: 19; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uv2h_rh_gam_mmioh_overlay_config_s { + long unsigned int rsvd_0_26: 27; + long unsigned int base: 19; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +union uvh_rh_gam_mmioh_overlay_config_u { + long unsigned int v; + struct uvh_rh_gam_mmioh_overlay_config_s s; + struct uvxh_rh_gam_mmioh_overlay_config_s sx; + struct uv2h_rh_gam_mmioh_overlay_config_s s2; +}; + +struct uvh_rh_gam_mmioh_overlay_config0_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uvxh_rh_gam_mmioh_overlay_config0_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uv4ah_rh_gam_mmioh_overlay_config0_mmr_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 26; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int undef_62: 1; + long unsigned int enable: 1; +}; + +struct uv4h_rh_gam_mmioh_overlay_config0_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uv3h_rh_gam_mmioh_overlay_config0_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +union uvh_rh_gam_mmioh_overlay_config0_u { + long unsigned int v; + struct uvh_rh_gam_mmioh_overlay_config0_s s; + struct uvxh_rh_gam_mmioh_overlay_config0_s sx; + struct uv4ah_rh_gam_mmioh_overlay_config0_mmr_s s4a; + struct uv4h_rh_gam_mmioh_overlay_config0_s s4; + struct uv3h_rh_gam_mmioh_overlay_config0_s s3; +}; + +struct uvh_rh_gam_mmioh_overlay_config1_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uvxh_rh_gam_mmioh_overlay_config1_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uv4ah_rh_gam_mmioh_overlay_config1_mmr_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 26; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int undef_62: 1; + long unsigned int enable: 1; +}; + +struct uv4h_rh_gam_mmioh_overlay_config1_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +struct uv3h_rh_gam_mmioh_overlay_config1_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int m_io: 6; + long unsigned int n_io: 4; + long unsigned int rsvd_56_62: 7; + long unsigned int enable: 1; +}; + +union uvh_rh_gam_mmioh_overlay_config1_u { + long unsigned int v; + struct uvh_rh_gam_mmioh_overlay_config1_s s; + struct uvxh_rh_gam_mmioh_overlay_config1_s sx; + struct uv4ah_rh_gam_mmioh_overlay_config1_mmr_s s4a; + struct uv4h_rh_gam_mmioh_overlay_config1_s s4; + struct uv3h_rh_gam_mmioh_overlay_config1_s s3; +}; + +struct uvh_rh_gam_mmr_overlay_config_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int rsvd_46_62: 17; + long unsigned int enable: 1; +}; + +struct uvxh_rh_gam_mmr_overlay_config_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int rsvd_46_62: 17; + long unsigned int enable: 1; +}; + +struct uv4h_rh_gam_mmr_overlay_config_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int rsvd_46_62: 17; + long unsigned int enable: 1; +}; + +struct uv3h_rh_gam_mmr_overlay_config_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int rsvd_46_62: 17; + long unsigned int enable: 1; +}; + +struct uv2h_rh_gam_mmr_overlay_config_s { + long unsigned int rsvd_0_25: 26; + long unsigned int base: 20; + long unsigned int rsvd_46_62: 17; + long unsigned int enable: 1; +}; + +union uvh_rh_gam_mmr_overlay_config_u { + long unsigned int v; + struct uvh_rh_gam_mmr_overlay_config_s s; + struct uvxh_rh_gam_mmr_overlay_config_s sx; + struct uv4h_rh_gam_mmr_overlay_config_s s4; + struct uv3h_rh_gam_mmr_overlay_config_s s3; + struct uv2h_rh_gam_mmr_overlay_config_s s2; +}; + +enum uv_system_type { + UV_NONE = 0, + UV_LEGACY_APIC = 1, + UV_X2APIC = 2, +}; + +enum { + BIOS_STATUS_MORE_PASSES = 1, + BIOS_STATUS_SUCCESS = 0, + BIOS_STATUS_UNIMPLEMENTED = 4294967258, + BIOS_STATUS_EINVAL = 4294967274, + BIOS_STATUS_UNAVAIL = 4294967280, + BIOS_STATUS_ABORT = 4294967292, +}; + +struct uv_gam_parameters { + u64 mmr_base; + u64 gru_base; + u8 mmr_shift; + u8 gru_shift; + u8 gpa_shift; + u8 unused1; +}; + +struct uv_gam_range_entry { + char type; + char unused1; + u16 nasid; + u16 sockid; + u16 pnode; + u32 unused2; + u32 limit; +}; + +struct uv_arch_type_entry { + char archtype[8]; +}; + +struct uv_systab { + char signature[4]; + u32 revision; + u64 function; + u32 size; + struct { + u32 type: 8; + u32 offset: 24; + } entry[1]; +}; + +enum { + BIOS_FREQ_BASE_PLATFORM = 0, + BIOS_FREQ_BASE_INTERVAL_TIMER = 1, + BIOS_FREQ_BASE_REALTIME_CLOCK = 2, +}; + +struct uv_gam_range_s { + u32 limit; + u16 nasid; + s8 base; + u8 reserved; +}; + +struct uv_hub_info_s { + unsigned int hub_type; + unsigned char hub_revision; + long unsigned int global_mmr_base; + long unsigned int global_mmr_shift; + long unsigned int gpa_mask; + short unsigned int *socket_to_node; + short unsigned int *socket_to_pnode; + short unsigned int *pnode_to_socket; + struct uv_gam_range_s *gr_table; + short unsigned int min_socket; + short unsigned int min_pnode; + unsigned char m_val; + unsigned char n_val; + unsigned char gr_table_len; + unsigned char apic_pnode_shift; + unsigned char gpa_shift; + unsigned char nasid_shift; + unsigned char m_shift; + unsigned char n_lshift; + unsigned int gnode_extra; + long unsigned int gnode_upper; + long unsigned int lowmem_remap_top; + long unsigned int lowmem_remap_base; + long unsigned int global_gru_base; + long unsigned int global_gru_shift; + short unsigned int pnode; + short unsigned int pnode_mask; + short unsigned int coherency_domain_number; + short unsigned int numa_blade_id; + short unsigned int nr_possible_cpus; + short unsigned int nr_online_cpus; + short int memory_nid; +}; + +struct uv_cpu_info_s { + void *p_uv_hub_info; + unsigned char blade_cpu_id; + void *reserved; +}; + +struct uvh_apicid_s { + long unsigned int local_apic_mask: 24; + long unsigned int local_apic_shift: 5; + long unsigned int unused1: 3; + long unsigned int pnode_mask: 24; + long unsigned int pnode_shift: 5; + long unsigned int unused2: 3; +}; + +union uvh_apicid { + long unsigned int v; + struct uvh_apicid_s s; +}; + +enum map_type { + map_wb = 0, + map_uc = 1, +}; + +enum mmioh_arch { + UV2_MMIOH = 4294967295, + UVY_MMIOH0 = 0, + UVY_MMIOH1 = 1, + UVX_MMIOH0 = 2, + UVX_MMIOH1 = 3, +}; + +struct mn { + unsigned char m_val; + unsigned char n_val; + unsigned char m_shift; + unsigned char n_lshift; +}; + +struct cluster_mask { + unsigned int clusterid; + int node; + struct cpumask mask; +}; + +struct dyn_arch_ftrace {}; + +enum { + FTRACE_OPS_FL_ENABLED = 1, + FTRACE_OPS_FL_DYNAMIC = 2, + FTRACE_OPS_FL_SAVE_REGS = 4, + FTRACE_OPS_FL_SAVE_REGS_IF_SUPPORTED = 8, + FTRACE_OPS_FL_RECURSION = 16, + FTRACE_OPS_FL_STUB = 32, + FTRACE_OPS_FL_INITIALIZED = 64, + FTRACE_OPS_FL_DELETED = 128, + FTRACE_OPS_FL_ADDING = 256, + FTRACE_OPS_FL_REMOVING = 512, + FTRACE_OPS_FL_MODIFYING = 1024, + FTRACE_OPS_FL_ALLOC_TRAMP = 2048, + FTRACE_OPS_FL_IPMODIFY = 4096, + FTRACE_OPS_FL_PID = 8192, + FTRACE_OPS_FL_RCU = 16384, + FTRACE_OPS_FL_TRACE_ARRAY = 32768, + FTRACE_OPS_FL_PERMANENT = 65536, + FTRACE_OPS_FL_DIRECT = 131072, +}; + +enum { + FTRACE_FL_ENABLED = 2147483648, + FTRACE_FL_REGS = 1073741824, + FTRACE_FL_REGS_EN = 536870912, + FTRACE_FL_TRAMP = 268435456, + FTRACE_FL_TRAMP_EN = 134217728, + FTRACE_FL_IPMODIFY = 67108864, + FTRACE_FL_DISABLED = 33554432, + FTRACE_FL_DIRECT = 16777216, + FTRACE_FL_DIRECT_EN = 8388608, +}; + +struct dyn_ftrace { + long unsigned int ip; + long unsigned int flags; + struct dyn_arch_ftrace arch; +}; + +enum { + FTRACE_UPDATE_IGNORE = 0, + FTRACE_UPDATE_MAKE_CALL = 1, + FTRACE_UPDATE_MODIFY_CALL = 2, + FTRACE_UPDATE_MAKE_NOP = 3, +}; + +union ftrace_op_code_union { + char code[7]; + struct { + char op[3]; + int offset; + } __attribute__((packed)); +}; + +struct ftrace_rec_iter; + +typedef __s64 Elf64_Sxword; + +struct elf64_rela { + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; +}; + +typedef struct elf64_rela Elf64_Rela; + +struct kimage_arch { + p4d_t *p4d; + pud_t *pud; + pmd_t *pmd; + pte_t *pte; + void *elf_headers; + long unsigned int elf_headers_sz; + long unsigned int elf_load_addr; +}; + +typedef long unsigned int kimage_entry_t; + +struct kexec_segment { + union { + void *buf; + void *kbuf; + }; + size_t bufsz; + long unsigned int mem; + size_t memsz; +}; + +struct purgatory_info { + const Elf64_Ehdr *ehdr; + Elf64_Shdr *sechdrs; + void *purgatory_buf; +}; + +typedef int kexec_probe_t(const char *, long unsigned int); + +struct kimage; + +typedef void *kexec_load_t(struct kimage *, char *, long unsigned int, char *, long unsigned int, char *, long unsigned int); + +struct kexec_file_ops; + +struct kimage { + kimage_entry_t head; + kimage_entry_t *entry; + kimage_entry_t *last_entry; + long unsigned int start; + struct page *control_code_page; + struct page *swap_page; + void *vmcoreinfo_data_copy; + long unsigned int nr_segments; + struct kexec_segment segment[16]; + struct list_head control_pages; + struct list_head dest_pages; + struct list_head unusable_pages; + long unsigned int control_page; + unsigned int type: 1; + unsigned int preserve_context: 1; + unsigned int file_mode: 1; + struct kimage_arch arch; + void *kernel_buf; + long unsigned int kernel_buf_len; + void *initrd_buf; + long unsigned int initrd_buf_len; + char *cmdline_buf; + long unsigned int cmdline_buf_len; + const struct kexec_file_ops *fops; + void *image_loader_data; + struct purgatory_info purgatory_info; +}; + +typedef int kexec_cleanup_t(void *); + +typedef int kexec_verify_sig_t(const char *, long unsigned int); + +struct kexec_file_ops { + kexec_probe_t *probe; + kexec_load_t *load; + kexec_cleanup_t *cleanup; + kexec_verify_sig_t *verify_sig; +}; + +struct x86_mapping_info { + void * (*alloc_pgt_page)(void *); + void *context; + long unsigned int page_flag; + long unsigned int offset; + bool direct_gbpages; + long unsigned int kernpg_flag; +}; + +struct init_pgtable_data { + struct x86_mapping_info *info; + pgd_t *level4p; +}; + +typedef void crash_vmclear_fn(); + +struct kexec_buf { + struct kimage *image; + void *buffer; + long unsigned int bufsz; + long unsigned int mem; + long unsigned int memsz; + long unsigned int buf_align; + long unsigned int buf_min; + long unsigned int buf_max; + bool top_down; +}; + +struct crash_mem_range { + u64 start; + u64 end; +}; + +struct crash_mem { + unsigned int max_nr_ranges; + unsigned int nr_ranges; + struct crash_mem_range ranges[0]; +}; + +struct crash_memmap_data { + struct boot_params *params; + unsigned int type; +}; + +struct kexec_entry64_regs { + uint64_t rax; + uint64_t rcx; + uint64_t rdx; + uint64_t rbx; + uint64_t rsp; + uint64_t rbp; + uint64_t rsi; + uint64_t rdi; + uint64_t r8; + uint64_t r9; + uint64_t r10; + uint64_t r11; + uint64_t r12; + uint64_t r13; + uint64_t r14; + uint64_t r15; + uint64_t rip; +}; + +enum key_being_used_for { + VERIFYING_MODULE_SIGNATURE = 0, + VERIFYING_FIRMWARE_SIGNATURE = 1, + VERIFYING_KEXEC_PE_SIGNATURE = 2, + VERIFYING_KEY_SIGNATURE = 3, + VERIFYING_KEY_SELF_SIGNATURE = 4, + VERIFYING_UNSPECIFIED_SIGNATURE = 5, + NR__KEY_BEING_USED_FOR = 6, +}; + +struct efi_setup_data { + u64 fw_vendor; + u64 __unused; + u64 tables; + u64 smbios; + u64 reserved[8]; +}; + +struct bzimage64_data { + void *bootparams_buf; +}; + +struct freelist_node { + atomic_t refs; + struct freelist_node *next; +}; + +struct freelist_head { + struct freelist_node *head; +}; + +struct prev_kprobe { + struct kprobe *kp; + long unsigned int status; + long unsigned int old_flags; + long unsigned int saved_flags; +}; + +struct kprobe_ctlblk { + long unsigned int kprobe_status; + long unsigned int kprobe_old_flags; + long unsigned int kprobe_saved_flags; + struct prev_kprobe prev_kprobe; +}; + +struct kretprobe_instance; + +typedef int (*kretprobe_handler_t)(struct kretprobe_instance *, struct pt_regs *); + +struct kretprobe_holder; + +struct kretprobe_instance { + union { + struct freelist_node freelist; + struct callback_head rcu; + }; + struct llist_node llist; + struct kretprobe_holder *rph; + kprobe_opcode_t *ret_addr; + void *fp; + char data[0]; +}; + +struct kretprobe; + +struct kretprobe_holder { + struct kretprobe *rp; + refcount_t ref; +}; + +struct kretprobe { + struct kprobe kp; + kretprobe_handler_t handler; + kretprobe_handler_t entry_handler; + int maxactive; + int nmissed; + size_t data_size; + struct freelist_head freelist; + struct kretprobe_holder *rph; +}; + +struct kretprobe_blackpoint { + const char *name; + void *addr; +}; + +struct kprobe_insn_cache { + struct mutex mutex; + void * (*alloc)(); + void (*free)(void *); + const char *sym; + struct list_head pages; + size_t insn_size; + int nr_garbage; +}; + +struct __arch_relative_insn { + u8 op; + s32 raddr; +} __attribute__((packed)); + +struct arch_optimized_insn { + kprobe_opcode_t copied_insn[4]; + kprobe_opcode_t *insn; + size_t size; +}; + +struct optimized_kprobe { + struct kprobe kp; + struct list_head list; + struct arch_optimized_insn optinsn; +}; + +enum { + TRACE_FTRACE_BIT = 0, + TRACE_FTRACE_NMI_BIT = 1, + TRACE_FTRACE_IRQ_BIT = 2, + TRACE_FTRACE_SIRQ_BIT = 3, + TRACE_INTERNAL_BIT = 4, + TRACE_INTERNAL_NMI_BIT = 5, + TRACE_INTERNAL_IRQ_BIT = 6, + TRACE_INTERNAL_SIRQ_BIT = 7, + TRACE_BRANCH_BIT = 8, + TRACE_IRQ_BIT = 9, + TRACE_GRAPH_BIT = 10, + TRACE_GRAPH_DEPTH_START_BIT = 11, + TRACE_GRAPH_DEPTH_END_BIT = 12, + TRACE_GRAPH_NOTRACE_BIT = 13, + TRACE_TRANSITION_BIT = 14, + TRACE_RECORD_RECURSION_BIT = 15, +}; + +enum { + TRACE_CTX_NMI = 0, + TRACE_CTX_IRQ = 1, + TRACE_CTX_SOFTIRQ = 2, + TRACE_CTX_NORMAL = 3, +}; + +enum regnames { + GDB_AX = 0, + GDB_BX = 1, + GDB_CX = 2, + GDB_DX = 3, + GDB_SI = 4, + GDB_DI = 5, + GDB_BP = 6, + GDB_SP = 7, + GDB_R8 = 8, + GDB_R9 = 9, + GDB_R10 = 10, + GDB_R11 = 11, + GDB_R12 = 12, + GDB_R13 = 13, + GDB_R14 = 14, + GDB_R15 = 15, + GDB_PC = 16, + GDB_PS = 17, + GDB_CS = 18, + GDB_SS = 19, + GDB_DS = 20, + GDB_ES = 21, + GDB_FS = 22, + GDB_GS = 23, +}; + +enum kgdb_bpstate { + BP_UNDEFINED = 0, + BP_REMOVED = 1, + BP_SET = 2, + BP_ACTIVE = 3, +}; + +struct kgdb_bkpt { + long unsigned int bpt_addr; + unsigned char saved_instr[1]; + enum kgdb_bptype type; + enum kgdb_bpstate state; +}; + +struct dbg_reg_def_t { + char *name; + int size; + int offset; +}; + +struct hw_breakpoint { + unsigned int enabled; + long unsigned int addr; + int len; + int type; + struct perf_event **pev; +}; + +struct console { + char name[16]; + void (*write)(struct console *, const char *, unsigned int); + int (*read)(struct console *, char *, unsigned int); + struct tty_driver * (*device)(struct console *, int *); + void (*unblank)(); + int (*setup)(struct console *, char *); + int (*exit)(struct console *); + int (*match)(struct console *, char *, int, char *); + short int flags; + short int index; + int cflag; + void *data; + struct console *next; +}; + +struct hpet_data { + long unsigned int hd_phys_address; + void *hd_address; + short unsigned int hd_nirqs; + unsigned int hd_state; + unsigned int hd_irq[32]; +}; + +typedef irqreturn_t (*rtc_irq_handler)(int, void *); + +enum hpet_mode { + HPET_MODE_UNUSED = 0, + HPET_MODE_LEGACY = 1, + HPET_MODE_CLOCKEVT = 2, + HPET_MODE_DEVICE = 3, +}; + +struct hpet_channel { + struct clock_event_device evt; + unsigned int num; + unsigned int cpu; + unsigned int irq; + unsigned int in_use; + enum hpet_mode mode; + unsigned int boot_cfg; + char name[10]; + long: 48; + long: 64; + long: 64; + long: 64; +}; + +struct hpet_base { + unsigned int nr_channels; + unsigned int nr_clockevents; + unsigned int boot_cfg; + struct hpet_channel *channels; +}; + +union hpet_lock { + struct { + arch_spinlock_t lock; + u32 value; + }; + u64 lockval; +}; + +struct amd_nb_bus_dev_range { + u8 bus; + u8 dev_base; + u8 dev_limit; +}; + +struct amd_northbridge_info { + u16 num; + u64 flags; + struct amd_northbridge *nb; +}; + +struct swait_queue { + struct task_struct *task; + struct list_head task_list; +}; + +struct kvm_steal_time { + __u64 steal; + __u32 version; + __u32 flags; + __u8 preempted; + __u8 u8_pad[3]; + __u32 pad[11]; +}; + +struct kvm_vcpu_pv_apf_data { + __u32 flags; + __u32 token; + __u8 pad[56]; + __u32 enabled; +}; + +struct kvm_task_sleep_node { + struct hlist_node link; + struct swait_queue_head wq; + u32 token; + int cpu; +}; + +struct kvm_task_sleep_head { + raw_spinlock_t lock; + struct hlist_head list; +}; + +typedef struct ldttss_desc ldt_desc; + +struct branch { + unsigned char opcode; + u32 delta; +} __attribute__((packed)); + +struct patch_xxl { + const unsigned char irq_irq_disable[1]; + const unsigned char irq_irq_enable[1]; + const unsigned char irq_save_fl[2]; + const unsigned char mmu_read_cr2[3]; + const unsigned char mmu_read_cr3[3]; + const unsigned char mmu_write_cr3[3]; + const unsigned char irq_restore_fl[2]; + const unsigned char cpu_wbinvd[2]; + const unsigned char cpu_usergs_sysret64[6]; + const unsigned char cpu_swapgs[3]; + const unsigned char mov64[3]; +}; + +struct patch_lock { + unsigned char queued_spin_unlock[3]; + unsigned char vcpu_is_preempted[2]; +}; + +typedef long unsigned int ulong; + +struct scan_area { + u64 addr; + u64 size; +}; + +struct uprobe_xol_ops; + +struct arch_uprobe { + union { + u8 insn[16]; + u8 ixol[16]; + }; + const struct uprobe_xol_ops *ops; + union { + struct { + s32 offs; + u8 ilen; + u8 opc1; + } branch; + struct { + u8 fixups; + u8 ilen; + } defparam; + struct { + u8 reg_offset; + u8 ilen; + } push; + }; +}; + +struct uprobe_xol_ops { + bool (*emulate)(struct arch_uprobe *, struct pt_regs *); + int (*pre_xol)(struct arch_uprobe *, struct pt_regs *); + int (*post_xol)(struct arch_uprobe *, struct pt_regs *); + void (*abort)(struct arch_uprobe *, struct pt_regs *); +}; + +enum rp_check { + RP_CHECK_CALL = 0, + RP_CHECK_CHAIN_CALL = 1, + RP_CHECK_RET = 2, +}; + +struct simplefb_platform_data { + u32 width; + u32 height; + u32 stride; + const char *format; +}; + +enum { + M_I17 = 0, + M_I20 = 1, + M_I20_SR = 2, + M_I24 = 3, + M_I24_8_1 = 4, + M_I24_10_1 = 5, + M_I27_11_1 = 6, + M_MINI = 7, + M_MINI_3_1 = 8, + M_MINI_4_1 = 9, + M_MB = 10, + M_MB_2 = 11, + M_MB_3 = 12, + M_MB_5_1 = 13, + M_MB_6_1 = 14, + M_MB_7_1 = 15, + M_MB_SR = 16, + M_MBA = 17, + M_MBA_3 = 18, + M_MBP = 19, + M_MBP_2 = 20, + M_MBP_2_2 = 21, + M_MBP_SR = 22, + M_MBP_4 = 23, + M_MBP_5_1 = 24, + M_MBP_5_2 = 25, + M_MBP_5_3 = 26, + M_MBP_6_1 = 27, + M_MBP_6_2 = 28, + M_MBP_7_1 = 29, + M_MBP_8_2 = 30, + M_UNKNOWN = 31, +}; + +struct efifb_dmi_info { + char *optname; + long unsigned int base; + int stride; + int width; + int height; + int flags; +}; + +enum { + OVERRIDE_NONE = 0, + OVERRIDE_BASE = 1, + OVERRIDE_STRIDE = 2, + OVERRIDE_HEIGHT = 4, + OVERRIDE_WIDTH = 8, +}; + +enum perf_sample_regs_abi { + PERF_SAMPLE_REGS_ABI_NONE = 0, + PERF_SAMPLE_REGS_ABI_32 = 1, + PERF_SAMPLE_REGS_ABI_64 = 2, +}; + +struct va_format { + const char *fmt; + va_list *va; +}; + +enum es_result { + ES_OK = 0, + ES_UNSUPPORTED = 1, + ES_VMM_ERROR = 2, + ES_DECODE_FAILED = 3, + ES_EXCEPTION = 4, + ES_RETRY = 5, +}; + +struct es_fault_info { + long unsigned int vector; + long unsigned int error_code; + long unsigned int cr2; +}; + +struct es_em_ctxt { + struct pt_regs *regs; + struct insn insn; + struct es_fault_info fi; +}; + +struct sev_es_runtime_data { + struct ghcb ghcb_page; + char ist_stack[4096]; + char fallback_stack[4096]; + struct ghcb backup_ghcb; + bool ghcb_active; + bool backup_ghcb_active; + long unsigned int dr7; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct ghcb_state { + struct ghcb *ghcb; +}; + +struct pci_hostbridge_probe { + u32 bus; + u32 slot; + u32 vendor; + u32 device; +}; + +struct trace_print_flags { + long unsigned int mask; + const char *name; +}; + +enum tlb_flush_reason { + TLB_FLUSH_ON_TASK_SWITCH = 0, + TLB_REMOTE_SHOOTDOWN = 1, + TLB_LOCAL_SHOOTDOWN = 2, + TLB_LOCAL_MM_SHOOTDOWN = 3, + TLB_REMOTE_SEND_IPI = 4, + NR_TLB_FLUSH_REASONS = 5, +}; + +enum { + REGION_INTERSECTS = 0, + REGION_DISJOINT = 1, + REGION_MIXED = 2, +}; + +struct trace_event_raw_tlb_flush { + struct trace_entry ent; + int reason; + long unsigned int pages; + char __data[0]; +}; + +struct trace_event_data_offsets_tlb_flush {}; + +typedef void (*btf_trace_tlb_flush)(void *, int, long unsigned int); + +struct map_range { + long unsigned int start; + long unsigned int end; + unsigned int page_size_mask; +}; + +enum { + MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE = 12, + SECTION_INFO = 12, + MIX_SECTION_INFO = 13, + NODE_INFO = 14, + MEMORY_HOTPLUG_MAX_BOOTMEM_TYPE = 14, +}; + +struct mhp_params { + struct vmem_altmap *altmap; + pgprot_t pgprot; +}; + +struct mem_section_usage { + long unsigned int subsection_map[1]; + long unsigned int pageblock_flags[0]; +}; + +struct mem_section { + long unsigned int section_mem_map; + struct mem_section_usage *usage; +}; + +enum kcore_type { + KCORE_TEXT = 0, + KCORE_VMALLOC = 1, + KCORE_RAM = 2, + KCORE_VMEMMAP = 3, + KCORE_USER = 4, + KCORE_OTHER = 5, + KCORE_REMAP = 6, +}; + +struct kcore_list { + struct list_head list; + long unsigned int addr; + long unsigned int vaddr; + size_t size; + int type; +}; + +struct hstate { + int next_nid_to_alloc; + int next_nid_to_free; + unsigned int order; + long unsigned int mask; + long unsigned int max_huge_pages; + long unsigned int nr_huge_pages; + long unsigned int free_huge_pages; + long unsigned int resv_huge_pages; + long unsigned int surplus_huge_pages; + long unsigned int nr_overcommit_huge_pages; + struct list_head hugepage_activelist; + struct list_head hugepage_freelists[1024]; + unsigned int nr_huge_pages_node[1024]; + unsigned int free_huge_pages_node[1024]; + unsigned int surplus_huge_pages_node[1024]; + struct cftype cgroup_files_dfl[7]; + struct cftype cgroup_files_legacy[9]; + char name[32]; +}; + +struct trace_event_raw_x86_exceptions { + struct trace_entry ent; + long unsigned int address; + long unsigned int ip; + long unsigned int error_code; + char __data[0]; +}; + +struct trace_event_data_offsets_x86_exceptions {}; + +typedef void (*btf_trace_page_fault_user)(void *, long unsigned int, struct pt_regs *, long unsigned int); + +typedef void (*btf_trace_page_fault_kernel)(void *, long unsigned int, struct pt_regs *, long unsigned int); + +enum { + IORES_MAP_SYSTEM_RAM = 1, + IORES_MAP_ENCRYPTED = 2, +}; + +struct ioremap_desc { + unsigned int flags; +}; + +typedef bool (*ex_handler_t)(const struct exception_table_entry *, struct pt_regs *, int, long unsigned int, long unsigned int); + +struct hugepage_subpool { + spinlock_t lock; + long int count; + long int max_hpages; + long int used_hpages; + struct hstate *hstate; + long int min_hpages; + long int rsv_hpages; +}; + +struct hugetlbfs_sb_info { + long int max_inodes; + long int free_inodes; + spinlock_t stat_lock; + struct hstate *hstate; + struct hugepage_subpool *spool; + kuid_t uid; + kgid_t gid; + umode_t mode; +}; + +typedef bool (*smp_cond_func_t)(int, void *); + +struct exception_stacks { + char DF_stack_guard[0]; + char DF_stack[4096]; + char NMI_stack_guard[0]; + char NMI_stack[4096]; + char DB_stack_guard[0]; + char DB_stack[4096]; + char MCE_stack_guard[0]; + char MCE_stack[4096]; + char VC_stack_guard[0]; + char VC_stack[0]; + char VC2_stack_guard[0]; + char VC2_stack[0]; + char IST_top_guard[0]; +}; + +struct cpa_data { + long unsigned int *vaddr; + pgd_t *pgd; + pgprot_t mask_set; + pgprot_t mask_clr; + long unsigned int numpages; + long unsigned int curpage; + long unsigned int pfn; + unsigned int flags; + unsigned int force_split: 1; + unsigned int force_static_prot: 1; + unsigned int force_flush_all: 1; + struct page **pages; +}; + +enum cpa_warn { + CPA_CONFLICT = 0, + CPA_PROTECT = 1, + CPA_DETECT = 2, +}; + +typedef struct { + u64 val; +} pfn_t; + +struct memtype { + u64 start; + u64 end; + u64 subtree_max_end; + enum page_cache_mode type; + struct rb_node rb; +}; + +enum { + PAT_UC = 0, + PAT_WC = 1, + PAT_WT = 4, + PAT_WP = 5, + PAT_WB = 6, + PAT_UC_MINUS = 7, +}; + +struct pagerange_state { + long unsigned int cur_pfn; + int ram; + int not_ram; +}; + +struct rb_augment_callbacks { + void (*propagate)(struct rb_node *, struct rb_node *); + void (*copy)(struct rb_node *, struct rb_node *); + void (*rotate)(struct rb_node *, struct rb_node *); +}; + +enum { + MEMTYPE_EXACT_MATCH = 0, + MEMTYPE_END_MATCH = 1, +}; + +struct ptdump_range { + long unsigned int start; + long unsigned int end; +}; + +struct ptdump_state { + void (*note_page)(struct ptdump_state *, long unsigned int, int, u64); + void (*effective_prot)(struct ptdump_state *, int, u64); + const struct ptdump_range *range; +}; + +struct addr_marker; + +struct pg_state { + struct ptdump_state ptdump; + int level; + pgprotval_t current_prot; + pgprotval_t effective_prot; + pgprotval_t prot_levels[5]; + long unsigned int start_address; + const struct addr_marker *marker; + long unsigned int lines; + bool to_dmesg; + bool check_wx; + long unsigned int wx_pages; + struct seq_file *seq; +}; + +struct addr_marker { + long unsigned int start_address; + const char *name; + long unsigned int max_lines; +}; + +enum address_markers_idx { + USER_SPACE_NR = 0, + KERNEL_SPACE_NR = 1, + LDT_NR = 2, + LOW_KERNEL_NR = 3, + VMALLOC_START_NR = 4, + VMEMMAP_START_NR = 5, + CPU_ENTRY_AREA_NR = 6, + ESPFIX_START_NR = 7, + EFI_END_NR = 8, + HIGH_KERNEL_NR = 9, + MODULES_VADDR_NR = 10, + MODULES_END_NR = 11, + FIXADDR_START_NR = 12, + END_OF_SPACE_NR = 13, +}; + +typedef void (*rcu_callback_t)(struct callback_head *); + +struct kmmio_probe; + +typedef void (*kmmio_pre_handler_t)(struct kmmio_probe *, struct pt_regs *, long unsigned int); + +typedef void (*kmmio_post_handler_t)(struct kmmio_probe *, long unsigned int, struct pt_regs *); + +struct kmmio_probe { + struct list_head list; + long unsigned int addr; + long unsigned int len; + kmmio_pre_handler_t pre_handler; + kmmio_post_handler_t post_handler; + void *private; +}; + +struct kmmio_fault_page { + struct list_head list; + struct kmmio_fault_page *release_next; + long unsigned int addr; + pteval_t old_presence; + bool armed; + int count; + bool scheduled_for_release; +}; + +struct kmmio_delayed_release { + struct callback_head rcu; + struct kmmio_fault_page *release_list; +}; + +struct kmmio_context { + struct kmmio_fault_page *fpage; + struct kmmio_probe *probe; + long unsigned int saved_flags; + long unsigned int addr; + int active; +}; + +enum reason_type { + NOT_ME = 0, + NOTHING = 1, + REG_READ = 2, + REG_WRITE = 3, + IMM_WRITE = 4, + OTHERS = 5, +}; + +struct prefix_bits { + unsigned int shorted: 1; + unsigned int enlarged: 1; + unsigned int rexr: 1; + unsigned int rex: 1; +}; + +enum { + arg_AL = 0, + arg_CL = 1, + arg_DL = 2, + arg_BL = 3, + arg_AH = 4, + arg_CH = 5, + arg_DH = 6, + arg_BH = 7, + arg_AX = 0, + arg_CX = 1, + arg_DX = 2, + arg_BX = 3, + arg_SP = 4, + arg_BP = 5, + arg_SI = 6, + arg_DI = 7, + arg_R8 = 8, + arg_R9 = 9, + arg_R10 = 10, + arg_R11 = 11, + arg_R12 = 12, + arg_R13 = 13, + arg_R14 = 14, + arg_R15 = 15, +}; + +enum mm_io_opcode { + MMIO_READ = 1, + MMIO_WRITE = 2, + MMIO_PROBE = 3, + MMIO_UNPROBE = 4, + MMIO_UNKNOWN_OP = 5, +}; + +struct mmiotrace_rw { + resource_size_t phys; + long unsigned int value; + long unsigned int pc; + int map_id; + unsigned char opcode; + unsigned char width; +}; + +struct mmiotrace_map { + resource_size_t phys; + long unsigned int virt; + long unsigned int len; + int map_id; + unsigned char opcode; +}; + +struct trap_reason { + long unsigned int addr; + long unsigned int ip; + enum reason_type type; + int active_traces; +}; + +struct remap_trace { + struct list_head list; + struct kmmio_probe probe; + resource_size_t phys; + long unsigned int id; +}; + +struct numa_memblk { + u64 start; + u64 end; + int nid; +}; + +struct numa_meminfo { + int nr_blks; + struct numa_memblk blk[2048]; +}; + +struct acpi_srat_cpu_affinity { + struct acpi_subtable_header header; + u8 proximity_domain_lo; + u8 apic_id; + u32 flags; + u8 local_sapic_eid; + u8 proximity_domain_hi[3]; + u32 clock_domain; +}; + +struct acpi_srat_x2apic_cpu_affinity { + struct acpi_subtable_header header; + u16 reserved; + u32 proximity_domain; + u32 apic_id; + u32 flags; + u32 clock_domain; + u32 reserved2; +}; + +struct rnd_state { + __u32 s1; + __u32 s2; + __u32 s3; + __u32 s4; +}; + +struct kaslr_memory_region { + long unsigned int *base; + long unsigned int size_tb; +}; + +enum pti_mode { + PTI_AUTO = 0, + PTI_FORCE_OFF = 1, + PTI_FORCE_ON = 2, +}; + +enum pti_clone_level { + PTI_CLONE_PMD = 0, + PTI_CLONE_PTE = 1, +}; + +struct sme_populate_pgd_data { + void *pgtable_area; + pgd_t *pgd; + pmdval_t pmd_flags; + pteval_t pte_flags; + long unsigned int paddr; + long unsigned int vaddr; + long unsigned int vaddr_end; +}; + +typedef __u64 __le64; + +typedef struct { + u64 a; + u64 b; +} u128; + +typedef struct { + __be64 a; + __be64 b; +} be128; + +typedef struct { + __le64 b; + __le64 a; +} le128; + +struct crypto_async_request; + +typedef void (*crypto_completion_t)(struct crypto_async_request *, int); + +struct crypto_async_request { + struct list_head list; + crypto_completion_t complete; + void *data; + struct crypto_tfm *tfm; + u32 flags; +}; + +struct crypto_template; + +struct crypto_spawn; + +struct crypto_instance { + struct crypto_alg alg; + struct crypto_template *tmpl; + union { + struct hlist_node list; + struct crypto_spawn *spawns; + }; + void *__ctx[0]; +}; + +struct crypto_spawn { + struct list_head list; + struct crypto_alg *alg; + union { + struct crypto_instance *inst; + struct crypto_spawn *next; + }; + const struct crypto_type *frontend; + u32 mask; + bool dead; + bool registered; +}; + +struct rtattr; + +struct crypto_template { + struct list_head list; + struct hlist_head instances; + struct module *module; + int (*create)(struct crypto_template *, struct rtattr **); + char name[128]; +}; + +struct scatter_walk { + struct scatterlist *sg; + unsigned int offset; +}; + +struct skcipher_request { + unsigned int cryptlen; + u8 *iv; + struct scatterlist *src; + struct scatterlist *dst; + struct crypto_async_request base; + void *__ctx[0]; +}; + +struct crypto_skcipher { + unsigned int reqsize; + struct crypto_tfm base; +}; + +struct skcipher_walk { + union { + struct { + struct page *page; + long unsigned int offset; + } phys; + struct { + u8 *page; + void *addr; + } virt; + } src; + union { + struct { + struct page *page; + long unsigned int offset; + } phys; + struct { + u8 *page; + void *addr; + } virt; + } dst; + struct scatter_walk in; + unsigned int nbytes; + struct scatter_walk out; + unsigned int total; + struct list_head buffers; + u8 *page; + u8 *buffer; + u8 *oiv; + void *iv; + unsigned int ivsize; + int flags; + unsigned int blocksize; + unsigned int stride; + unsigned int alignmask; +}; + +typedef void (*common_glue_func_t)(const void *, u8 *, const u8 *); + +typedef void (*common_glue_cbc_func_t)(const void *, u8 *, const u8 *); + +typedef void (*common_glue_ctr_func_t)(const void *, u8 *, const u8 *, le128 *); + +typedef void (*common_glue_xts_func_t)(const void *, u8 *, const u8 *, le128 *); + +struct common_glue_func_entry { + unsigned int num_blocks; + union { + common_glue_func_t ecb; + common_glue_cbc_func_t cbc; + common_glue_ctr_func_t ctr; + common_glue_xts_func_t xts; + } fn_u; +}; + +struct common_glue_ctx { + unsigned int num_funcs; + int fpu_blocks_limit; + struct common_glue_func_entry funcs[0]; +}; + +struct crypto_aes_ctx { + u32 key_enc[60]; + u32 key_dec[60]; + u32 key_length; +}; + +struct skcipher_alg { + int (*setkey)(struct crypto_skcipher *, const u8 *, unsigned int); + int (*encrypt)(struct skcipher_request *); + int (*decrypt)(struct skcipher_request *); + int (*init)(struct crypto_skcipher *); + void (*exit)(struct crypto_skcipher *); + unsigned int min_keysize; + unsigned int max_keysize; + unsigned int ivsize; + unsigned int chunksize; + unsigned int walksize; + struct crypto_alg base; +}; + +struct aead_request { + struct crypto_async_request base; + unsigned int assoclen; + unsigned int cryptlen; + u8 *iv; + struct scatterlist *src; + struct scatterlist *dst; + void *__ctx[0]; +}; + +struct crypto_aead; + +struct aead_alg { + int (*setkey)(struct crypto_aead *, const u8 *, unsigned int); + int (*setauthsize)(struct crypto_aead *, unsigned int); + int (*encrypt)(struct aead_request *); + int (*decrypt)(struct aead_request *); + int (*init)(struct crypto_aead *); + void (*exit)(struct crypto_aead *); + unsigned int ivsize; + unsigned int maxauthsize; + unsigned int chunksize; + struct crypto_alg base; +}; + +struct crypto_aead { + unsigned int authsize; + unsigned int reqsize; + struct crypto_tfm base; +}; + +struct aesni_rfc4106_gcm_ctx { + u8 hash_subkey[16]; + struct crypto_aes_ctx aes_key_expanded; + u8 nonce[4]; + long: 64; +}; + +struct generic_gcmaes_ctx { + u8 hash_subkey[16]; + struct crypto_aes_ctx aes_key_expanded; + long: 32; + long: 64; +}; + +struct aesni_xts_ctx { + u8 raw_tweak_ctx[484]; + long: 32; + long: 64; + u8 raw_crypt_ctx[484]; + long: 32; + long: 64; +}; + +struct gcm_context_data { + u8 aad_hash[16]; + u64 aad_length; + u64 in_length; + u8 partial_block_enc_key[16]; + u8 orig_IV[16]; + u8 current_counter[16]; + u64 partial_block_len; + u64 unused; + u8 hash_keys[256]; +}; + +struct aesni_gcm_tfm_s { + void (*init)(void *, struct gcm_context_data *, u8 *, u8 *, const u8 *, long unsigned int); + void (*enc_update)(void *, struct gcm_context_data *, u8 *, const u8 *, long unsigned int); + void (*dec_update)(void *, struct gcm_context_data *, u8 *, const u8 *, long unsigned int); + void (*finalize)(void *, struct gcm_context_data *, u8 *, long unsigned int); +}; + +struct simd_skcipher_alg; + +struct simd_aead_alg; + +struct sigcontext_32 { + __u16 gs; + __u16 __gsh; + __u16 fs; + __u16 __fsh; + __u16 es; + __u16 __esh; + __u16 ds; + __u16 __dsh; + __u32 di; + __u32 si; + __u32 bp; + __u32 sp; + __u32 bx; + __u32 dx; + __u32 cx; + __u32 ax; + __u32 trapno; + __u32 err; + __u32 ip; + __u16 cs; + __u16 __csh; + __u32 flags; + __u32 sp_at_signal; + __u16 ss; + __u16 __ssh; + __u32 fpstate; + __u32 oldmask; + __u32 cr2; +}; + +typedef u32 compat_size_t; + +struct compat_sigaltstack { + compat_uptr_t ss_sp; + int ss_flags; + compat_size_t ss_size; +}; + +typedef struct compat_sigaltstack compat_stack_t; + +struct ucontext_ia32 { + unsigned int uc_flags; + unsigned int uc_link; + compat_stack_t uc_stack; + struct sigcontext_32 uc_mcontext; + compat_sigset_t uc_sigmask; +}; + +struct sigframe_ia32 { + u32 pretcode; + int sig; + struct sigcontext_32 sc; + struct _fpstate_32 fpstate_unused; + unsigned int extramask[1]; + char retcode[8]; +}; + +struct rt_sigframe_ia32 { + u32 pretcode; + int sig; + u32 pinfo; + u32 puc; + compat_siginfo_t info; + struct ucontext_ia32 uc; + char retcode[8]; +}; + +typedef struct { + efi_guid_t guid; + u64 table; +} efi_config_table_64_t; + +struct efi_memory_map_data { + phys_addr_t phys_map; + long unsigned int size; + long unsigned int desc_version; + long unsigned int desc_size; + long unsigned int flags; +}; + +struct efi_mem_range { + struct range range; + u64 attribute; +}; + +enum efi_rts_ids { + EFI_NONE = 0, + EFI_GET_TIME = 1, + EFI_SET_TIME = 2, + EFI_GET_WAKEUP_TIME = 3, + EFI_SET_WAKEUP_TIME = 4, + EFI_GET_VARIABLE = 5, + EFI_GET_NEXT_VARIABLE = 6, + EFI_SET_VARIABLE = 7, + EFI_QUERY_VARIABLE_INFO = 8, + EFI_GET_NEXT_HIGH_MONO_COUNT = 9, + EFI_RESET_SYSTEM = 10, + EFI_UPDATE_CAPSULE = 11, + EFI_QUERY_CAPSULE_CAPS = 12, +}; + +struct efi_runtime_work { + void *arg1; + void *arg2; + void *arg3; + void *arg4; + void *arg5; + efi_status_t status; + struct work_struct work; + enum efi_rts_ids efi_rts_id; + struct completion efi_rts_comp; +}; + +struct efi_scratch { + u64 phys_stack; + struct mm_struct *prev_mm; +}; + +typedef struct { + efi_guid_t guid; + u32 table; +} efi_config_table_32_t; + +typedef union { + struct { + efi_guid_t guid; + void *table; + }; + efi_config_table_32_t mixed_mode; +} efi_config_table_t; + +typedef struct { + efi_guid_t guid; + long unsigned int *ptr; + const char name[16]; +} efi_config_table_type_t; + +typedef struct { + efi_table_hdr_t hdr; + u64 fw_vendor; + u32 fw_revision; + u32 __pad1; + u64 con_in_handle; + u64 con_in; + u64 con_out_handle; + u64 con_out; + u64 stderr_handle; + u64 stderr; + u64 runtime; + u64 boottime; + u32 nr_tables; + u32 __pad2; + u64 tables; +} efi_system_table_64_t; + +typedef struct { + u32 version; + u32 length; + u64 memory_protection_attribute; +} efi_properties_table_t; + +typedef int (*efi_memattr_perm_setter)(struct mm_struct *, efi_memory_desc_t *); + +typedef u16 ucs2_char_t; + +struct pm_qos_request { + struct plist_node node; + struct pm_qos_constraints *qos; +}; + +struct semaphore { + raw_spinlock_t lock; + unsigned int count; + struct list_head wait_list; +}; + +enum uv_bios_cmd { + UV_BIOS_COMMON = 0, + UV_BIOS_GET_SN_INFO = 1, + UV_BIOS_FREQ_BASE = 2, + UV_BIOS_WATCHLIST_ALLOC = 3, + UV_BIOS_WATCHLIST_FREE = 4, + UV_BIOS_MEMPROTECT = 5, + UV_BIOS_GET_PARTITION_ADDR = 6, + UV_BIOS_SET_LEGACY_VGA_TARGET = 7, +}; + +union partition_info_u { + u64 val; + struct { + u64 hub_version: 8; + u64 partition_id: 16; + u64 coherence_id: 16; + u64 region_size: 24; + }; +}; + +enum uv_memprotect { + UV_MEMPROT_RESTRICT_ACCESS = 0, + UV_MEMPROT_ALLOW_AMO = 1, + UV_MEMPROT_ALLOW_RW = 2, +}; + +struct uv_IO_APIC_route_entry { + __u64 vector: 8; + __u64 delivery_mode: 3; + __u64 dest_mode: 1; + __u64 delivery_status: 1; + __u64 polarity: 1; + __u64 __reserved_1: 1; + __u64 trigger: 1; + __u64 mask: 1; + __u64 __reserved_2: 15; + __u64 dest: 32; +}; + +enum { + UV_AFFINITY_ALL = 0, + UV_AFFINITY_NODE = 1, + UV_AFFINITY_CPU = 2, +}; + +struct uv_irq_2_mmr_pnode { + long unsigned int offset; + int pnode; +}; + +struct uv_rtc_timer_head { + spinlock_t lock; + int next_cpu; + int ncpus; + struct { + int lcpu; + u64 expires; + } cpu[0]; +}; + +struct uv_hub_nmi_s { + raw_spinlock_t nmi_lock; + atomic_t in_nmi; + atomic_t cpu_owner; + atomic_t read_mmr_count; + atomic_t nmi_count; + long unsigned int nmi_value; + bool hub_present; + bool pch_owner; +}; + +struct uv_cpu_nmi_s { + struct uv_hub_nmi_s *hub; + int state; + int pinging; + int queries; + int pings; +}; + +struct nmi_action { + char *action; + char *desc; +}; + +typedef char action_t[16]; + +struct init_nmi { + unsigned int offset; + unsigned int mask; + unsigned int data; +}; + +enum { + BPF_REG_0 = 0, + BPF_REG_1 = 1, + BPF_REG_2 = 2, + BPF_REG_3 = 3, + BPF_REG_4 = 4, + BPF_REG_5 = 5, + BPF_REG_6 = 6, + BPF_REG_7 = 7, + BPF_REG_8 = 8, + BPF_REG_9 = 9, + BPF_REG_10 = 10, + __MAX_BPF_REG = 11, +}; + +struct bpf_tramp_progs { + struct bpf_prog *progs[40]; + int nr_progs; +}; + +enum bpf_jit_poke_reason { + BPF_POKE_REASON_TAIL_CALL = 0, +}; + +struct bpf_array_aux { + enum bpf_prog_type type; + bool jited; + struct list_head poke_progs; + struct bpf_map *map; + struct mutex poke_mutex; + struct work_struct work; +}; + +struct bpf_array { + struct bpf_map map; + u32 elem_size; + u32 index_mask; + struct bpf_array_aux *aux; + union { + char value[0]; + void *ptrs[0]; + void *pptrs[0]; + }; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum bpf_text_poke_type { + BPF_MOD_CALL = 0, + BPF_MOD_JUMP = 1, +}; + +struct bpf_binary_header { + u32 pages; + int: 32; + u8 image[0]; +}; + +typedef void (*bpf_jit_fill_hole_t)(void *, unsigned int); + +struct jit_context { + int cleanup_addr; +}; + +struct x64_jit_data { + struct bpf_binary_header *header; + int *addrs; + u8 *image; + int proglen; + struct jit_context ctx; +}; + +enum tk_offsets { + TK_OFFS_REAL = 0, + TK_OFFS_BOOT = 1, + TK_OFFS_TAI = 2, + TK_OFFS_MAX = 3, +}; + +typedef long unsigned int vm_flags_t; + +struct clone_args { + __u64 flags; + __u64 pidfd; + __u64 child_tid; + __u64 parent_tid; + __u64 exit_signal; + __u64 stack; + __u64 stack_size; + __u64 tls; + __u64 set_tid; + __u64 set_tid_size; + __u64 cgroup; +}; + +enum hrtimer_mode { + HRTIMER_MODE_ABS = 0, + HRTIMER_MODE_REL = 1, + HRTIMER_MODE_PINNED = 2, + HRTIMER_MODE_SOFT = 4, + HRTIMER_MODE_HARD = 8, + HRTIMER_MODE_ABS_PINNED = 2, + HRTIMER_MODE_REL_PINNED = 3, + HRTIMER_MODE_ABS_SOFT = 4, + HRTIMER_MODE_REL_SOFT = 5, + HRTIMER_MODE_ABS_PINNED_SOFT = 6, + HRTIMER_MODE_REL_PINNED_SOFT = 7, + HRTIMER_MODE_ABS_HARD = 8, + HRTIMER_MODE_REL_HARD = 9, + HRTIMER_MODE_ABS_PINNED_HARD = 10, + HRTIMER_MODE_REL_PINNED_HARD = 11, +}; + +struct fdtable { + unsigned int max_fds; + struct file **fd; + long unsigned int *close_on_exec; + long unsigned int *open_fds; + long unsigned int *full_fds_bits; + struct callback_head rcu; +}; + +struct files_struct { + atomic_t count; + bool resize_in_progress; + wait_queue_head_t resize_wait; + struct fdtable *fdt; + struct fdtable fdtab; + long: 64; + long: 64; + long: 64; + long: 64; + spinlock_t file_lock; + unsigned int next_fd; + long unsigned int close_on_exec_init[1]; + long unsigned int open_fds_init[1]; + long unsigned int full_fds_bits_init[1]; + struct file *fd_array[64]; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct io_identity { + struct files_struct *files; + struct mm_struct *mm; + struct cgroup_subsys_state *blkcg_css; + const struct cred *creds; + struct nsproxy *nsproxy; + struct fs_struct *fs; + long unsigned int fsize; + kuid_t loginuid; + unsigned int sessionid; + refcount_t count; +}; + +struct io_uring_task { + struct xarray xa; + struct wait_queue_head wait; + struct file *last; + struct percpu_counter inflight; + struct io_identity __identity; + struct io_identity *identity; + atomic_t in_idle; + bool sqpoll; +}; + +struct robust_list { + struct robust_list *next; +}; + +struct robust_list_head { + struct robust_list list; + long int futex_offset; + struct robust_list *list_op_pending; +}; + +struct multiprocess_signals { + sigset_t signal; + struct hlist_node node; +}; + +typedef int (*proc_visitor)(struct task_struct *, void *); + +enum { + IOPRIO_CLASS_NONE = 0, + IOPRIO_CLASS_RT = 1, + IOPRIO_CLASS_BE = 2, + IOPRIO_CLASS_IDLE = 3, +}; + +enum { + FUTEX_STATE_OK = 0, + FUTEX_STATE_EXITING = 1, + FUTEX_STATE_DEAD = 2, +}; + +enum proc_hidepid { + HIDEPID_OFF = 0, + HIDEPID_NO_ACCESS = 1, + HIDEPID_INVISIBLE = 2, + HIDEPID_NOT_PTRACEABLE = 4, +}; + +enum proc_pidonly { + PROC_PIDONLY_OFF = 0, + PROC_PIDONLY_ON = 1, +}; + +struct proc_fs_info { + struct pid_namespace *pid_ns; + struct dentry *proc_self; + struct dentry *proc_thread_self; + kgid_t pid_gid; + enum proc_hidepid hide_pid; + enum proc_pidonly pidonly; +}; + +struct trace_event_raw_task_newtask { + struct trace_entry ent; + pid_t pid; + char comm[16]; + long unsigned int clone_flags; + short int oom_score_adj; + char __data[0]; +}; + +struct trace_event_raw_task_rename { + struct trace_entry ent; + pid_t pid; + char oldcomm[16]; + char newcomm[16]; + short int oom_score_adj; + char __data[0]; +}; + +struct trace_event_data_offsets_task_newtask {}; + +struct trace_event_data_offsets_task_rename {}; + +typedef void (*btf_trace_task_newtask)(void *, struct task_struct *, long unsigned int); + +typedef void (*btf_trace_task_rename)(void *, struct task_struct *, const char *); + +struct taint_flag { + char c_true; + char c_false; + bool module; +}; + +enum ftrace_dump_mode { + DUMP_NONE = 0, + DUMP_ALL = 1, + DUMP_ORIG = 2, +}; + +enum kmsg_dump_reason { + KMSG_DUMP_UNDEF = 0, + KMSG_DUMP_PANIC = 1, + KMSG_DUMP_OOPS = 2, + KMSG_DUMP_EMERG = 3, + KMSG_DUMP_SHUTDOWN = 4, + KMSG_DUMP_MAX = 5, +}; + +enum con_flush_mode { + CONSOLE_FLUSH_PENDING = 0, + CONSOLE_REPLAY_ALL = 1, +}; + +struct warn_args { + const char *fmt; + va_list args; +}; + +struct smp_hotplug_thread { + struct task_struct **store; + struct list_head list; + int (*thread_should_run)(unsigned int); + void (*thread_fn)(unsigned int); + void (*create)(unsigned int); + void (*setup)(unsigned int); + void (*cleanup)(unsigned int, bool); + void (*park)(unsigned int); + void (*unpark)(unsigned int); + bool selfparking; + const char *thread_comm; +}; + +struct trace_event_raw_cpuhp_enter { + struct trace_entry ent; + unsigned int cpu; + int target; + int idx; + void *fun; + char __data[0]; +}; + +struct trace_event_raw_cpuhp_multi_enter { + struct trace_entry ent; + unsigned int cpu; + int target; + int idx; + void *fun; + char __data[0]; +}; + +struct trace_event_raw_cpuhp_exit { + struct trace_entry ent; + unsigned int cpu; + int state; + int idx; + int ret; + char __data[0]; +}; + +struct trace_event_data_offsets_cpuhp_enter {}; + +struct trace_event_data_offsets_cpuhp_multi_enter {}; + +struct trace_event_data_offsets_cpuhp_exit {}; + +typedef void (*btf_trace_cpuhp_enter)(void *, unsigned int, int, int, int (*)(unsigned int)); + +typedef void (*btf_trace_cpuhp_multi_enter)(void *, unsigned int, int, int, int (*)(unsigned int, struct hlist_node *), struct hlist_node *); + +typedef void (*btf_trace_cpuhp_exit)(void *, unsigned int, int, int, int); + +struct cpuhp_cpu_state { + enum cpuhp_state state; + enum cpuhp_state target; + enum cpuhp_state fail; + struct task_struct *thread; + bool should_run; + bool rollback; + bool single; + bool bringup; + struct hlist_node *node; + struct hlist_node *last; + enum cpuhp_state cb_state; + int result; + struct completion done_up; + struct completion done_down; +}; + +struct cpuhp_step { + const char *name; + union { + int (*single)(unsigned int); + int (*multi)(unsigned int, struct hlist_node *); + } startup; + union { + int (*single)(unsigned int); + int (*multi)(unsigned int, struct hlist_node *); + } teardown; + struct hlist_head list; + bool cant_stop; + bool multi_instance; +}; + +enum cpu_mitigations { + CPU_MITIGATIONS_OFF = 0, + CPU_MITIGATIONS_AUTO = 1, + CPU_MITIGATIONS_AUTO_NOSMT = 2, +}; + +struct __kernel_old_timeval { + __kernel_long_t tv_sec; + __kernel_long_t tv_usec; +}; + +struct old_timeval32 { + old_time32_t tv_sec; + s32 tv_usec; +}; + +struct rusage { + struct __kernel_old_timeval ru_utime; + struct __kernel_old_timeval ru_stime; + __kernel_long_t ru_maxrss; + __kernel_long_t ru_ixrss; + __kernel_long_t ru_idrss; + __kernel_long_t ru_isrss; + __kernel_long_t ru_minflt; + __kernel_long_t ru_majflt; + __kernel_long_t ru_nswap; + __kernel_long_t ru_inblock; + __kernel_long_t ru_oublock; + __kernel_long_t ru_msgsnd; + __kernel_long_t ru_msgrcv; + __kernel_long_t ru_nsignals; + __kernel_long_t ru_nvcsw; + __kernel_long_t ru_nivcsw; +}; + +typedef struct {} mm_segment_t; + +struct compat_rusage { + struct old_timeval32 ru_utime; + struct old_timeval32 ru_stime; + compat_long_t ru_maxrss; + compat_long_t ru_ixrss; + compat_long_t ru_idrss; + compat_long_t ru_isrss; + compat_long_t ru_minflt; + compat_long_t ru_majflt; + compat_long_t ru_nswap; + compat_long_t ru_inblock; + compat_long_t ru_oublock; + compat_long_t ru_msgsnd; + compat_long_t ru_msgrcv; + compat_long_t ru_nsignals; + compat_long_t ru_nvcsw; + compat_long_t ru_nivcsw; +}; + +struct waitid_info { + pid_t pid; + uid_t uid; + int status; + int cause; +}; + +struct wait_opts { + enum pid_type wo_type; + int wo_flags; + struct pid *wo_pid; + struct waitid_info *wo_info; + int wo_stat; + struct rusage *wo_rusage; + wait_queue_entry_t child_wait; + int notask_error; +}; + +struct softirq_action { + void (*action)(struct softirq_action *); +}; + +struct tasklet_struct { + struct tasklet_struct *next; + long unsigned int state; + atomic_t count; + bool use_callback; + union { + void (*func)(long unsigned int); + void (*callback)(struct tasklet_struct *); + }; + long unsigned int data; +}; + +enum { + TASKLET_STATE_SCHED = 0, + TASKLET_STATE_RUN = 1, +}; + +struct kernel_stat { + long unsigned int irqs_sum; + unsigned int softirqs[10]; +}; + +struct trace_event_raw_irq_handler_entry { + struct trace_entry ent; + int irq; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_irq_handler_exit { + struct trace_entry ent; + int irq; + int ret; + char __data[0]; +}; + +struct trace_event_raw_softirq { + struct trace_entry ent; + unsigned int vec; + char __data[0]; +}; + +struct trace_event_data_offsets_irq_handler_entry { + u32 name; +}; + +struct trace_event_data_offsets_irq_handler_exit {}; + +struct trace_event_data_offsets_softirq {}; + +typedef void (*btf_trace_irq_handler_entry)(void *, int, struct irqaction *); + +typedef void (*btf_trace_irq_handler_exit)(void *, int, struct irqaction *, int); + +typedef void (*btf_trace_softirq_entry)(void *, unsigned int); + +typedef void (*btf_trace_softirq_exit)(void *, unsigned int); + +typedef void (*btf_trace_softirq_raise)(void *, unsigned int); + +struct tasklet_head { + struct tasklet_struct *head; + struct tasklet_struct **tail; +}; + +typedef void (*dr_release_t)(struct device *, void *); + +typedef int (*dr_match_t)(struct device *, void *, void *); + +struct resource_entry { + struct list_head node; + struct resource *res; + resource_size_t offset; + struct resource __res; +}; + +struct resource_constraint { + resource_size_t min; + resource_size_t max; + resource_size_t align; + resource_size_t (*alignf)(void *, const struct resource *, resource_size_t, resource_size_t); + void *alignf_data; +}; + +enum { + MAX_IORES_LEVEL = 5, +}; + +struct region_devres { + struct resource *parent; + resource_size_t start; + resource_size_t n; +}; + +typedef __kernel_clock_t clock_t; + +struct dentry_stat_t { + long int nr_dentry; + long int nr_unused; + long int age_limit; + long int want_pages; + long int nr_negative; + long int dummy; +}; + +struct files_stat_struct { + long unsigned int nr_files; + long unsigned int nr_free_files; + long unsigned int max_files; +}; + +struct inodes_stat_t { + long int nr_inodes; + long int nr_unused; + long int dummy[5]; +}; + +enum sched_tunable_scaling { + SCHED_TUNABLESCALING_NONE = 0, + SCHED_TUNABLESCALING_LOG = 1, + SCHED_TUNABLESCALING_LINEAR = 2, + SCHED_TUNABLESCALING_END = 3, +}; + +enum sysctl_writes_mode { + SYSCTL_WRITES_LEGACY = 4294967295, + SYSCTL_WRITES_WARN = 0, + SYSCTL_WRITES_STRICT = 1, +}; + +struct do_proc_dointvec_minmax_conv_param { + int *min; + int *max; +}; + +struct do_proc_douintvec_minmax_conv_param { + unsigned int *min; + unsigned int *max; +}; + +struct __user_cap_header_struct { + __u32 version; + int pid; +}; + +typedef struct __user_cap_header_struct *cap_user_header_t; + +struct __user_cap_data_struct { + __u32 effective; + __u32 permitted; + __u32 inheritable; +}; + +typedef struct __user_cap_data_struct *cap_user_data_t; + +struct sigqueue { + struct list_head list; + int flags; + kernel_siginfo_t info; + struct user_struct *user; +}; + +struct wait_bit_key { + void *flags; + int bit_nr; + long unsigned int timeout; +}; + +typedef int wait_bit_action_f(struct wait_bit_key *, int); + +struct ptrace_peeksiginfo_args { + __u64 off; + __u32 flags; + __s32 nr; +}; + +struct ptrace_syscall_info { + __u8 op; + __u8 pad[3]; + __u32 arch; + __u64 instruction_pointer; + __u64 stack_pointer; + union { + struct { + __u64 nr; + __u64 args[6]; + } entry; + struct { + __s64 rval; + __u8 is_error; + } exit; + struct { + __u64 nr; + __u64 args[6]; + __u32 ret_data; + } seccomp; + }; +}; + +struct compat_iovec { + compat_uptr_t iov_base; + compat_size_t iov_len; +}; + +typedef long unsigned int old_sigset_t; + +enum siginfo_layout { + SIL_KILL = 0, + SIL_TIMER = 1, + SIL_POLL = 2, + SIL_FAULT = 3, + SIL_FAULT_MCEERR = 4, + SIL_FAULT_BNDERR = 5, + SIL_FAULT_PKUERR = 6, + SIL_CHLD = 7, + SIL_RT = 8, + SIL_SYS = 9, +}; + +struct fd { + struct file *file; + unsigned int flags; +}; + +typedef u32 compat_old_sigset_t; + +struct compat_sigaction { + compat_uptr_t sa_handler; + compat_ulong_t sa_flags; + compat_uptr_t sa_restorer; + compat_sigset_t sa_mask; +}; + +struct compat_old_sigaction { + compat_uptr_t sa_handler; + compat_old_sigset_t sa_mask; + compat_ulong_t sa_flags; + compat_uptr_t sa_restorer; +}; + +enum { + TRACE_SIGNAL_DELIVERED = 0, + TRACE_SIGNAL_IGNORED = 1, + TRACE_SIGNAL_ALREADY_PENDING = 2, + TRACE_SIGNAL_OVERFLOW_FAIL = 3, + TRACE_SIGNAL_LOSE_INFO = 4, +}; + +struct trace_event_raw_signal_generate { + struct trace_entry ent; + int sig; + int errno; + int code; + char comm[16]; + pid_t pid; + int group; + int result; + char __data[0]; +}; + +struct trace_event_raw_signal_deliver { + struct trace_entry ent; + int sig; + int errno; + int code; + long unsigned int sa_handler; + long unsigned int sa_flags; + char __data[0]; +}; + +struct trace_event_data_offsets_signal_generate {}; + +struct trace_event_data_offsets_signal_deliver {}; + +typedef void (*btf_trace_signal_generate)(void *, int, struct kernel_siginfo *, struct task_struct *, int, int); + +typedef void (*btf_trace_signal_deliver)(void *, int, struct kernel_siginfo *, struct k_sigaction *); + +struct sysinfo { + __kernel_long_t uptime; + __kernel_ulong_t loads[3]; + __kernel_ulong_t totalram; + __kernel_ulong_t freeram; + __kernel_ulong_t sharedram; + __kernel_ulong_t bufferram; + __kernel_ulong_t totalswap; + __kernel_ulong_t freeswap; + __u16 procs; + __u16 pad; + __kernel_ulong_t totalhigh; + __kernel_ulong_t freehigh; + __u32 mem_unit; + char _f[0]; +}; + +enum { + PER_LINUX = 0, + PER_LINUX_32BIT = 8388608, + PER_LINUX_FDPIC = 524288, + PER_SVR4 = 68157441, + PER_SVR3 = 83886082, + PER_SCOSVR3 = 117440515, + PER_OSR5 = 100663299, + PER_WYSEV386 = 83886084, + PER_ISCR4 = 67108869, + PER_BSD = 6, + PER_SUNOS = 67108870, + PER_XENIX = 83886087, + PER_LINUX32 = 8, + PER_LINUX32_3GB = 134217736, + PER_IRIX32 = 67108873, + PER_IRIXN32 = 67108874, + PER_IRIX64 = 67108875, + PER_RISCOS = 12, + PER_SOLARIS = 67108877, + PER_UW7 = 68157454, + PER_OSF4 = 15, + PER_HPUX = 16, + PER_MASK = 255, +}; + +struct rlimit64 { + __u64 rlim_cur; + __u64 rlim_max; +}; + +struct oldold_utsname { + char sysname[9]; + char nodename[9]; + char release[9]; + char version[9]; + char machine[9]; +}; + +struct old_utsname { + char sysname[65]; + char nodename[65]; + char release[65]; + char version[65]; + char machine[65]; +}; + +enum uts_proc { + UTS_PROC_OSTYPE = 0, + UTS_PROC_OSRELEASE = 1, + UTS_PROC_VERSION = 2, + UTS_PROC_HOSTNAME = 3, + UTS_PROC_DOMAINNAME = 4, +}; + +struct prctl_mm_map { + __u64 start_code; + __u64 end_code; + __u64 start_data; + __u64 end_data; + __u64 start_brk; + __u64 brk; + __u64 start_stack; + __u64 arg_start; + __u64 arg_end; + __u64 env_start; + __u64 env_end; + __u64 *auxv; + __u32 auxv_size; + __u32 exe_fd; +}; + +struct compat_tms { + compat_clock_t tms_utime; + compat_clock_t tms_stime; + compat_clock_t tms_cutime; + compat_clock_t tms_cstime; +}; + +struct compat_rlimit { + compat_ulong_t rlim_cur; + compat_ulong_t rlim_max; +}; + +struct tms { + __kernel_clock_t tms_utime; + __kernel_clock_t tms_stime; + __kernel_clock_t tms_cutime; + __kernel_clock_t tms_cstime; +}; + +struct getcpu_cache { + long unsigned int blob[16]; +}; + +struct compat_sysinfo { + s32 uptime; + u32 loads[3]; + u32 totalram; + u32 freeram; + u32 sharedram; + u32 bufferram; + u32 totalswap; + u32 freeswap; + u16 procs; + u16 pad; + u32 totalhigh; + u32 freehigh; + u32 mem_unit; + char _f[8]; +}; + +struct wq_flusher; + +struct worker; + +struct workqueue_attrs; + +struct pool_workqueue; + +struct wq_device; + +struct workqueue_struct { + struct list_head pwqs; + struct list_head list; + struct mutex mutex; + int work_color; + int flush_color; + atomic_t nr_pwqs_to_flush; + struct wq_flusher *first_flusher; + struct list_head flusher_queue; + struct list_head flusher_overflow; + struct list_head maydays; + struct worker *rescuer; + int nr_drainers; + int saved_max_active; + struct workqueue_attrs *unbound_attrs; + struct pool_workqueue *dfl_pwq; + struct wq_device *wq_dev; + char name[24]; + struct callback_head rcu; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + unsigned int flags; + struct pool_workqueue *cpu_pwqs; + struct pool_workqueue *numa_pwq_tbl[0]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct workqueue_attrs { + int nice; + cpumask_var_t cpumask; + bool no_numa; +}; + +struct execute_work { + struct work_struct work; +}; + +enum { + WQ_UNBOUND = 2, + WQ_FREEZABLE = 4, + WQ_MEM_RECLAIM = 8, + WQ_HIGHPRI = 16, + WQ_CPU_INTENSIVE = 32, + WQ_SYSFS = 64, + WQ_POWER_EFFICIENT = 128, + __WQ_DRAINING = 65536, + __WQ_ORDERED = 131072, + __WQ_LEGACY = 262144, + __WQ_ORDERED_EXPLICIT = 524288, + WQ_MAX_ACTIVE = 512, + WQ_MAX_UNBOUND_PER_CPU = 4, + WQ_DFL_ACTIVE = 256, +}; + +enum xa_lock_type { + XA_LOCK_IRQ = 1, + XA_LOCK_BH = 2, +}; + +struct ida { + struct xarray xa; +}; + +struct __una_u32 { + u32 x; +}; + +struct worker_pool; + +struct worker { + union { + struct list_head entry; + struct hlist_node hentry; + }; + struct work_struct *current_work; + work_func_t current_func; + struct pool_workqueue *current_pwq; + struct list_head scheduled; + struct task_struct *task; + struct worker_pool *pool; + struct list_head node; + long unsigned int last_active; + unsigned int flags; + int id; + int sleeping; + char desc[24]; + struct workqueue_struct *rescue_wq; + work_func_t last_func; +}; + +struct pool_workqueue { + struct worker_pool *pool; + struct workqueue_struct *wq; + int work_color; + int flush_color; + int refcnt; + int nr_in_flight[15]; + int nr_active; + int max_active; + struct list_head delayed_works; + struct list_head pwqs_node; + struct list_head mayday_node; + struct work_struct unbound_release_work; + struct callback_head rcu; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct worker_pool { + raw_spinlock_t lock; + int cpu; + int node; + int id; + unsigned int flags; + long unsigned int watchdog_ts; + struct list_head worklist; + int nr_workers; + int nr_idle; + struct list_head idle_list; + struct timer_list idle_timer; + struct timer_list mayday_timer; + struct hlist_head busy_hash[64]; + struct worker *manager; + struct list_head workers; + struct completion *detach_completion; + struct ida worker_ida; + struct workqueue_attrs *attrs; + struct hlist_node hash_node; + int refcnt; + long: 32; + long: 64; + long: 64; + long: 64; + atomic_t nr_running; + struct callback_head rcu; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum { + POOL_MANAGER_ACTIVE = 1, + POOL_DISASSOCIATED = 4, + WORKER_DIE = 2, + WORKER_IDLE = 4, + WORKER_PREP = 8, + WORKER_CPU_INTENSIVE = 64, + WORKER_UNBOUND = 128, + WORKER_REBOUND = 256, + WORKER_NOT_RUNNING = 456, + NR_STD_WORKER_POOLS = 2, + UNBOUND_POOL_HASH_ORDER = 6, + BUSY_WORKER_HASH_ORDER = 6, + MAX_IDLE_WORKERS_RATIO = 4, + IDLE_WORKER_TIMEOUT = 300000, + MAYDAY_INITIAL_TIMEOUT = 10, + MAYDAY_INTERVAL = 100, + CREATE_COOLDOWN = 1000, + RESCUER_NICE_LEVEL = 4294967276, + HIGHPRI_NICE_LEVEL = 4294967276, + WQ_NAME_LEN = 24, +}; + +struct wq_flusher { + struct list_head list; + int flush_color; + struct completion done; +}; + +struct wq_device { + struct workqueue_struct *wq; + struct device dev; +}; + +struct trace_event_raw_workqueue_queue_work { + struct trace_entry ent; + void *work; + void *function; + void *workqueue; + unsigned int req_cpu; + unsigned int cpu; + char __data[0]; +}; + +struct trace_event_raw_workqueue_activate_work { + struct trace_entry ent; + void *work; + char __data[0]; +}; + +struct trace_event_raw_workqueue_execute_start { + struct trace_entry ent; + void *work; + void *function; + char __data[0]; +}; + +struct trace_event_raw_workqueue_execute_end { + struct trace_entry ent; + void *work; + void *function; + char __data[0]; +}; + +struct trace_event_data_offsets_workqueue_queue_work {}; + +struct trace_event_data_offsets_workqueue_activate_work {}; + +struct trace_event_data_offsets_workqueue_execute_start {}; + +struct trace_event_data_offsets_workqueue_execute_end {}; + +typedef void (*btf_trace_workqueue_queue_work)(void *, unsigned int, struct pool_workqueue *, struct work_struct *); + +typedef void (*btf_trace_workqueue_activate_work)(void *, struct work_struct *); + +typedef void (*btf_trace_workqueue_execute_start)(void *, struct work_struct *); + +typedef void (*btf_trace_workqueue_execute_end)(void *, struct work_struct *, work_func_t); + +struct wq_barrier { + struct work_struct work; + struct completion done; + struct task_struct *task; +}; + +struct cwt_wait { + wait_queue_entry_t wait; + struct work_struct *work; +}; + +struct apply_wqattrs_ctx { + struct workqueue_struct *wq; + struct workqueue_attrs *attrs; + struct list_head list; + struct pool_workqueue *dfl_pwq; + struct pool_workqueue *pwq_tbl[0]; +}; + +struct work_for_cpu { + struct work_struct work; + long int (*fn)(void *); + void *arg; + long int ret; +}; + +typedef struct {} local_lock_t; + +struct radix_tree_preload { + local_lock_t lock; + unsigned int nr; + struct xa_node *nodes; +}; + +typedef void (*task_work_func_t)(struct callback_head *); + +enum { + KERNEL_PARAM_OPS_FL_NOARG = 1, +}; + +enum { + KERNEL_PARAM_FL_UNSAFE = 1, + KERNEL_PARAM_FL_HWPARAM = 2, +}; + +struct param_attribute { + struct module_attribute mattr; + const struct kernel_param *param; +}; + +struct module_param_attrs { + unsigned int num; + struct attribute_group grp; + struct param_attribute attrs[0]; +}; + +struct module_version_attribute { + struct module_attribute mattr; + const char *module_name; + const char *version; +}; + +struct kmalloced_param { + struct list_head list; + char val[0]; +}; + +struct sched_param { + int sched_priority; +}; + +enum { + __PERCPU_REF_ATOMIC = 1, + __PERCPU_REF_DEAD = 2, + __PERCPU_REF_ATOMIC_DEAD = 3, + __PERCPU_REF_FLAG_BITS = 2, +}; + +struct kthread_work; + +typedef void (*kthread_work_func_t)(struct kthread_work *); + +struct kthread_worker; + +struct kthread_work { + struct list_head node; + kthread_work_func_t func; + struct kthread_worker *worker; + int canceling; +}; + +enum { + KTW_FREEZABLE = 1, +}; + +struct kthread_worker { + unsigned int flags; + raw_spinlock_t lock; + struct list_head work_list; + struct list_head delayed_work_list; + struct task_struct *task; + struct kthread_work *current_work; +}; + +struct kthread_delayed_work { + struct kthread_work work; + struct timer_list timer; +}; + +enum { + CSS_NO_REF = 1, + CSS_ONLINE = 2, + CSS_RELEASED = 4, + CSS_VISIBLE = 8, + CSS_DYING = 16, +}; + +struct kthread_create_info { + int (*threadfn)(void *); + void *data; + int node; + struct task_struct *result; + struct completion *done; + struct list_head list; +}; + +struct kthread { + long unsigned int flags; + unsigned int cpu; + int (*threadfn)(void *); + void *data; + mm_segment_t oldfs; + struct completion parked; + struct completion exited; + struct cgroup_subsys_state *blkcg_css; +}; + +enum KTHREAD_BITS { + KTHREAD_IS_PER_CPU = 0, + KTHREAD_SHOULD_STOP = 1, + KTHREAD_SHOULD_PARK = 2, +}; + +struct kthread_flush_work { + struct kthread_work work; + struct completion done; +}; + +struct pt_regs___2; + +struct ipc_ids { + int in_use; + short unsigned int seq; + struct rw_semaphore rwsem; + struct idr ipcs_idr; + int max_idx; + int last_idx; + int next_id; + struct rhashtable key_ht; +}; + +struct ipc_namespace { + struct ipc_ids ids[3]; + int sem_ctls[4]; + int used_sems; + unsigned int msg_ctlmax; + unsigned int msg_ctlmnb; + unsigned int msg_ctlmni; + atomic_t msg_bytes; + atomic_t msg_hdrs; + size_t shm_ctlmax; + size_t shm_ctlall; + long unsigned int shm_tot; + int shm_ctlmni; + int shm_rmid_forced; + struct notifier_block ipcns_nb; + struct vfsmount *mq_mnt; + unsigned int mq_queues_count; + unsigned int mq_queues_max; + unsigned int mq_msg_max; + unsigned int mq_msgsize_max; + unsigned int mq_msg_default; + unsigned int mq_msgsize_default; + struct user_namespace *user_ns; + struct ucounts *ucounts; + struct llist_node mnt_llist; + struct ns_common ns; +}; + +struct srcu_notifier_head { + struct mutex mutex; + struct srcu_struct srcu; + struct notifier_block *head; +}; + +enum what { + PROC_EVENT_NONE = 0, + PROC_EVENT_FORK = 1, + PROC_EVENT_EXEC = 2, + PROC_EVENT_UID = 4, + PROC_EVENT_GID = 64, + PROC_EVENT_SID = 128, + PROC_EVENT_PTRACE = 256, + PROC_EVENT_COMM = 512, + PROC_EVENT_COREDUMP = 1073741824, + PROC_EVENT_EXIT = 2147483648, +}; + +typedef u64 async_cookie_t; + +typedef void (*async_func_t)(void *, async_cookie_t); + +struct async_domain { + struct list_head pending; + unsigned int registered: 1; +}; + +struct async_entry { + struct list_head domain_list; + struct list_head global_list; + struct work_struct work; + async_cookie_t cookie; + async_func_t func; + void *data; + struct async_domain *domain; +}; + +struct smpboot_thread_data { + unsigned int cpu; + unsigned int status; + struct smp_hotplug_thread *ht; +}; + +enum { + HP_THREAD_NONE = 0, + HP_THREAD_ACTIVE = 1, + HP_THREAD_PARKED = 2, +}; + +struct umd_info { + const char *driver_name; + struct file *pipe_to_umh; + struct file *pipe_from_umh; + struct path wd; + struct pid *tgid; +}; + +struct pin_cookie {}; + +struct preempt_notifier; + +struct preempt_ops { + void (*sched_in)(struct preempt_notifier *, int); + void (*sched_out)(struct preempt_notifier *, struct task_struct *); +}; + +struct preempt_notifier { + struct hlist_node link; + struct preempt_ops *ops; +}; + +enum { + CSD_FLAG_LOCK = 1, + IRQ_WORK_PENDING = 1, + IRQ_WORK_BUSY = 2, + IRQ_WORK_LAZY = 4, + IRQ_WORK_HARD_IRQ = 8, + IRQ_WORK_CLAIMED = 3, + CSD_TYPE_ASYNC = 0, + CSD_TYPE_SYNC = 16, + CSD_TYPE_IRQ_WORK = 32, + CSD_TYPE_TTWU = 48, + CSD_FLAG_TYPE_MASK = 240, +}; + +struct dl_bw { + raw_spinlock_t lock; + u64 bw; + u64 total_bw; +}; + +struct cpudl_item; + +struct cpudl { + raw_spinlock_t lock; + int size; + cpumask_var_t free_cpus; + struct cpudl_item *elements; +}; + +struct cpupri_vec { + atomic_t count; + cpumask_var_t mask; +}; + +struct cpupri { + struct cpupri_vec pri_to_cpu[101]; + int *cpu_to_pri; +}; + +struct perf_domain; + +struct root_domain { + atomic_t refcount; + atomic_t rto_count; + struct callback_head rcu; + cpumask_var_t span; + cpumask_var_t online; + int overload; + int overutilized; + cpumask_var_t dlo_mask; + atomic_t dlo_count; + struct dl_bw dl_bw; + struct cpudl cpudl; + u64 visit_gen; + struct irq_work rto_push_work; + raw_spinlock_t rto_lock; + int rto_loop; + int rto_cpu; + atomic_t rto_loop_next; + atomic_t rto_loop_start; + cpumask_var_t rto_mask; + struct cpupri cpupri; + long unsigned int max_cpu_capacity; + struct perf_domain *pd; +}; + +struct cfs_rq { + struct load_weight load; + unsigned int nr_running; + unsigned int h_nr_running; + unsigned int idle_h_nr_running; + u64 exec_clock; + u64 min_vruntime; + struct rb_root_cached tasks_timeline; + struct sched_entity *curr; + struct sched_entity *next; + struct sched_entity *last; + struct sched_entity *skip; + unsigned int nr_spread_over; + long: 32; + long: 64; + long: 64; + long: 64; + struct sched_avg avg; + struct { + raw_spinlock_t lock; + int nr; + long unsigned int load_avg; + long unsigned int util_avg; + long unsigned int runnable_avg; + long: 64; + long: 64; + long: 64; + long: 64; + } removed; + long unsigned int tg_load_avg_contrib; + long int propagate; + long int prop_runnable_sum; + long unsigned int h_load; + u64 last_h_load_update; + struct sched_entity *h_load_next; + struct rq *rq; + int on_list; + struct list_head leaf_cfs_rq_list; + struct task_group *tg; + int runtime_enabled; + s64 runtime_remaining; + u64 throttled_clock; + u64 throttled_clock_task; + u64 throttled_clock_task_time; + int throttled; + int throttle_count; + struct list_head throttled_list; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct cfs_bandwidth { + raw_spinlock_t lock; + ktime_t period; + u64 quota; + u64 runtime; + s64 hierarchical_quota; + u8 idle; + u8 period_active; + u8 slack_started; + struct hrtimer period_timer; + struct hrtimer slack_timer; + struct list_head throttled_cfs_rq; + int nr_periods; + int nr_throttled; + u64 throttled_time; +}; + +struct task_group { + struct cgroup_subsys_state css; + struct sched_entity **se; + struct cfs_rq **cfs_rq; + long unsigned int shares; + long: 64; + long: 64; + long: 64; + long: 64; + atomic_long_t load_avg; + struct callback_head rcu; + struct list_head list; + struct task_group *parent; + struct list_head siblings; + struct list_head children; + struct autogroup *autogroup; + struct cfs_bandwidth cfs_bandwidth; + long: 64; + long: 64; + long: 64; +}; + +struct sched_domain_attr { + int relax_domain_level; +}; + +struct sched_group { + struct sched_group *next; + atomic_t ref; + unsigned int group_weight; + struct sched_group_capacity *sgc; + int asym_prefer_cpu; + long unsigned int cpumask[0]; +}; + +struct sched_group_capacity { + atomic_t ref; + long unsigned int capacity; + long unsigned int min_capacity; + long unsigned int max_capacity; + long unsigned int next_update; + int imbalance; + int id; + long unsigned int cpumask[0]; +}; + +struct wait_bit_queue_entry { + struct wait_bit_key key; + struct wait_queue_entry wq_entry; +}; + +struct autogroup { + struct kref kref; + struct task_group *tg; + struct rw_semaphore lock; + long unsigned int id; + int nice; +}; + +enum ctx_state { + CONTEXT_DISABLED = 4294967295, + CONTEXT_KERNEL = 0, + CONTEXT_USER = 1, + CONTEXT_GUEST = 2, +}; + +struct context_tracking { + bool active; + int recursion; + enum ctx_state state; +}; + +struct kernel_cpustat { + u64 cpustat[10]; +}; + +enum { + MEMBARRIER_STATE_PRIVATE_EXPEDITED_READY = 1, + MEMBARRIER_STATE_PRIVATE_EXPEDITED = 2, + MEMBARRIER_STATE_GLOBAL_EXPEDITED_READY = 4, + MEMBARRIER_STATE_GLOBAL_EXPEDITED = 8, + MEMBARRIER_STATE_PRIVATE_EXPEDITED_SYNC_CORE_READY = 16, + MEMBARRIER_STATE_PRIVATE_EXPEDITED_SYNC_CORE = 32, + MEMBARRIER_STATE_PRIVATE_EXPEDITED_RSEQ_READY = 64, + MEMBARRIER_STATE_PRIVATE_EXPEDITED_RSEQ = 128, +}; + +enum { + CFTYPE_ONLY_ON_ROOT = 1, + CFTYPE_NOT_ON_ROOT = 2, + CFTYPE_NS_DELEGATABLE = 4, + CFTYPE_NO_PREFIX = 8, + CFTYPE_WORLD_WRITABLE = 16, + CFTYPE_DEBUG = 32, + __CFTYPE_ONLY_ON_DFL = 65536, + __CFTYPE_NOT_ON_DFL = 131072, +}; + +struct trace_event_raw_sched_kthread_stop { + struct trace_entry ent; + char comm[16]; + pid_t pid; + char __data[0]; +}; + +struct trace_event_raw_sched_kthread_stop_ret { + struct trace_entry ent; + int ret; + char __data[0]; +}; + +struct trace_event_raw_sched_kthread_work_queue_work { + struct trace_entry ent; + void *work; + void *function; + void *worker; + char __data[0]; +}; + +struct trace_event_raw_sched_kthread_work_execute_start { + struct trace_entry ent; + void *work; + void *function; + char __data[0]; +}; + +struct trace_event_raw_sched_kthread_work_execute_end { + struct trace_entry ent; + void *work; + void *function; + char __data[0]; +}; + +struct trace_event_raw_sched_wakeup_template { + struct trace_entry ent; + char comm[16]; + pid_t pid; + int prio; + int success; + int target_cpu; + char __data[0]; +}; + +struct trace_event_raw_sched_switch { + struct trace_entry ent; + char prev_comm[16]; + pid_t prev_pid; + int prev_prio; + long int prev_state; + char next_comm[16]; + pid_t next_pid; + int next_prio; + char __data[0]; +}; + +struct trace_event_raw_sched_migrate_task { + struct trace_entry ent; + char comm[16]; + pid_t pid; + int prio; + int orig_cpu; + int dest_cpu; + char __data[0]; +}; + +struct trace_event_raw_sched_process_template { + struct trace_entry ent; + char comm[16]; + pid_t pid; + int prio; + char __data[0]; +}; + +struct trace_event_raw_sched_process_wait { + struct trace_entry ent; + char comm[16]; + pid_t pid; + int prio; + char __data[0]; +}; + +struct trace_event_raw_sched_process_fork { + struct trace_entry ent; + char parent_comm[16]; + pid_t parent_pid; + char child_comm[16]; + pid_t child_pid; + char __data[0]; +}; + +struct trace_event_raw_sched_process_exec { + struct trace_entry ent; + u32 __data_loc_filename; + pid_t pid; + pid_t old_pid; + char __data[0]; +}; + +struct trace_event_raw_sched_stat_template { + struct trace_entry ent; + char comm[16]; + pid_t pid; + u64 delay; + char __data[0]; +}; + +struct trace_event_raw_sched_stat_runtime { + struct trace_entry ent; + char comm[16]; + pid_t pid; + u64 runtime; + u64 vruntime; + char __data[0]; +}; + +struct trace_event_raw_sched_pi_setprio { + struct trace_entry ent; + char comm[16]; + pid_t pid; + int oldprio; + int newprio; + char __data[0]; +}; + +struct trace_event_raw_sched_move_numa { + struct trace_entry ent; + pid_t pid; + pid_t tgid; + pid_t ngid; + int src_cpu; + int src_nid; + int dst_cpu; + int dst_nid; + char __data[0]; +}; + +struct trace_event_raw_sched_numa_pair_template { + struct trace_entry ent; + pid_t src_pid; + pid_t src_tgid; + pid_t src_ngid; + int src_cpu; + int src_nid; + pid_t dst_pid; + pid_t dst_tgid; + pid_t dst_ngid; + int dst_cpu; + int dst_nid; + char __data[0]; +}; + +struct trace_event_raw_sched_wake_idle_without_ipi { + struct trace_entry ent; + int cpu; + char __data[0]; +}; + +struct trace_event_data_offsets_sched_kthread_stop {}; + +struct trace_event_data_offsets_sched_kthread_stop_ret {}; + +struct trace_event_data_offsets_sched_kthread_work_queue_work {}; + +struct trace_event_data_offsets_sched_kthread_work_execute_start {}; + +struct trace_event_data_offsets_sched_kthread_work_execute_end {}; + +struct trace_event_data_offsets_sched_wakeup_template {}; + +struct trace_event_data_offsets_sched_switch {}; + +struct trace_event_data_offsets_sched_migrate_task {}; + +struct trace_event_data_offsets_sched_process_template {}; + +struct trace_event_data_offsets_sched_process_wait {}; + +struct trace_event_data_offsets_sched_process_fork {}; + +struct trace_event_data_offsets_sched_process_exec { + u32 filename; +}; + +struct trace_event_data_offsets_sched_stat_template {}; + +struct trace_event_data_offsets_sched_stat_runtime {}; + +struct trace_event_data_offsets_sched_pi_setprio {}; + +struct trace_event_data_offsets_sched_move_numa {}; + +struct trace_event_data_offsets_sched_numa_pair_template {}; + +struct trace_event_data_offsets_sched_wake_idle_without_ipi {}; + +typedef void (*btf_trace_sched_kthread_stop)(void *, struct task_struct *); + +typedef void (*btf_trace_sched_kthread_stop_ret)(void *, int); + +typedef void (*btf_trace_sched_kthread_work_queue_work)(void *, struct kthread_worker *, struct kthread_work *); + +typedef void (*btf_trace_sched_kthread_work_execute_start)(void *, struct kthread_work *); + +typedef void (*btf_trace_sched_kthread_work_execute_end)(void *, struct kthread_work *, kthread_work_func_t); + +typedef void (*btf_trace_sched_waking)(void *, struct task_struct *); + +typedef void (*btf_trace_sched_wakeup)(void *, struct task_struct *); + +typedef void (*btf_trace_sched_wakeup_new)(void *, struct task_struct *); + +typedef void (*btf_trace_sched_switch)(void *, bool, struct task_struct *, struct task_struct *); + +typedef void (*btf_trace_sched_migrate_task)(void *, struct task_struct *, int); + +typedef void (*btf_trace_sched_process_free)(void *, struct task_struct *); + +typedef void (*btf_trace_sched_process_exit)(void *, struct task_struct *); + +typedef void (*btf_trace_sched_wait_task)(void *, struct task_struct *); + +typedef void (*btf_trace_sched_process_wait)(void *, struct pid *); + +typedef void (*btf_trace_sched_process_fork)(void *, struct task_struct *, struct task_struct *); + +typedef void (*btf_trace_sched_process_exec)(void *, struct task_struct *, pid_t, struct linux_binprm *); + +typedef void (*btf_trace_sched_stat_wait)(void *, struct task_struct *, u64); + +typedef void (*btf_trace_sched_stat_sleep)(void *, struct task_struct *, u64); + +typedef void (*btf_trace_sched_stat_iowait)(void *, struct task_struct *, u64); + +typedef void (*btf_trace_sched_stat_blocked)(void *, struct task_struct *, u64); + +typedef void (*btf_trace_sched_stat_runtime)(void *, struct task_struct *, u64, u64); + +typedef void (*btf_trace_sched_pi_setprio)(void *, struct task_struct *, struct task_struct *); + +typedef void (*btf_trace_sched_move_numa)(void *, struct task_struct *, int, int); + +typedef void (*btf_trace_sched_stick_numa)(void *, struct task_struct *, int, struct task_struct *, int); + +typedef void (*btf_trace_sched_swap_numa)(void *, struct task_struct *, int, struct task_struct *, int); + +typedef void (*btf_trace_sched_wake_idle_without_ipi)(void *, int); + +struct wake_q_head { + struct wake_q_node *first; + struct wake_q_node **lastp; +}; + +struct sched_attr { + __u32 size; + __u32 sched_policy; + __u64 sched_flags; + __s32 sched_nice; + __u32 sched_priority; + __u64 sched_runtime; + __u64 sched_deadline; + __u64 sched_period; + __u32 sched_util_min; + __u32 sched_util_max; +}; + +struct cpuidle_state_usage { + long long unsigned int disable; + long long unsigned int usage; + u64 time_ns; + long long unsigned int above; + long long unsigned int below; + long long unsigned int rejected; + long long unsigned int s2idle_usage; + long long unsigned int s2idle_time; +}; + +struct cpuidle_device; + +struct cpuidle_driver; + +struct cpuidle_state { + char name[16]; + char desc[32]; + u64 exit_latency_ns; + u64 target_residency_ns; + unsigned int flags; + unsigned int exit_latency; + int power_usage; + unsigned int target_residency; + int (*enter)(struct cpuidle_device *, struct cpuidle_driver *, int); + int (*enter_dead)(struct cpuidle_device *, int); + int (*enter_s2idle)(struct cpuidle_device *, struct cpuidle_driver *, int); +}; + +struct cpuidle_driver_kobj; + +struct cpuidle_state_kobj; + +struct cpuidle_device_kobj; + +struct cpuidle_device { + unsigned int registered: 1; + unsigned int enabled: 1; + unsigned int poll_time_limit: 1; + unsigned int cpu; + ktime_t next_hrtimer; + int last_state_idx; + u64 last_residency_ns; + u64 poll_limit_ns; + u64 forced_idle_latency_limit_ns; + struct cpuidle_state_usage states_usage[10]; + struct cpuidle_state_kobj *kobjs[10]; + struct cpuidle_driver_kobj *kobj_driver; + struct cpuidle_device_kobj *kobj_dev; + struct list_head device_list; +}; + +struct cpuidle_driver { + const char *name; + struct module *owner; + unsigned int bctimer: 1; + struct cpuidle_state states[10]; + int state_count; + int safe_state_index; + struct cpumask *cpumask; + const char *governor; +}; + +struct cpu_stop_done; + +struct cpu_stop_work { + struct list_head list; + cpu_stop_fn_t fn; + long unsigned int caller; + void *arg; + struct cpu_stop_done *done; +}; + +struct cpudl_item { + u64 dl; + int cpu; + int idx; +}; + +struct rt_prio_array { + long unsigned int bitmap[2]; + struct list_head queue[100]; +}; + +struct rt_bandwidth { + raw_spinlock_t rt_runtime_lock; + ktime_t rt_period; + u64 rt_runtime; + struct hrtimer rt_period_timer; + unsigned int rt_period_active; +}; + +struct dl_bandwidth { + raw_spinlock_t dl_runtime_lock; + u64 dl_runtime; + u64 dl_period; +}; + +typedef int (*tg_visitor)(struct task_group *, void *); + +struct rt_rq { + struct rt_prio_array active; + unsigned int rt_nr_running; + unsigned int rr_nr_running; + struct { + int curr; + int next; + } highest_prio; + long unsigned int rt_nr_migratory; + long unsigned int rt_nr_total; + int overloaded; + struct plist_head pushable_tasks; + int rt_queued; + int rt_throttled; + u64 rt_time; + u64 rt_runtime; + raw_spinlock_t rt_runtime_lock; +}; + +struct dl_rq { + struct rb_root_cached root; + long unsigned int dl_nr_running; + struct { + u64 curr; + u64 next; + } earliest_dl; + long unsigned int dl_nr_migratory; + int overloaded; + struct rb_root_cached pushable_dl_tasks_root; + u64 running_bw; + u64 this_bw; + u64 extra_bw; + u64 bw_ratio; +}; + +struct rq { + raw_spinlock_t lock; + unsigned int nr_running; + unsigned int nr_numa_running; + unsigned int nr_preferred_running; + unsigned int numa_migrate_on; + long unsigned int last_blocked_load_update_tick; + unsigned int has_blocked_load; + long: 32; + long: 64; + long: 64; + long: 64; + call_single_data_t nohz_csd; + unsigned int nohz_tick_stopped; + atomic_t nohz_flags; + unsigned int ttwu_pending; + u64 nr_switches; + long: 64; + struct cfs_rq cfs; + struct rt_rq rt; + struct dl_rq dl; + struct list_head leaf_cfs_rq_list; + struct list_head *tmp_alone_branch; + long unsigned int nr_uninterruptible; + struct task_struct *curr; + struct task_struct *idle; + struct task_struct *stop; + long unsigned int next_balance; + struct mm_struct *prev_mm; + unsigned int clock_update_flags; + u64 clock; + long: 64; + long: 64; + long: 64; + u64 clock_task; + u64 clock_pelt; + long unsigned int lost_idle_time; + atomic_t nr_iowait; + int membarrier_state; + struct root_domain *rd; + struct sched_domain *sd; + long unsigned int cpu_capacity; + long unsigned int cpu_capacity_orig; + struct callback_head *balance_callback; + unsigned char balance_push; + unsigned char nohz_idle_balance; + unsigned char idle_balance; + long unsigned int misfit_task_load; + int active_balance; + int push_cpu; + struct cpu_stop_work active_balance_work; + int cpu; + int online; + struct list_head cfs_tasks; + long: 64; + long: 64; + long: 64; + struct sched_avg avg_rt; + struct sched_avg avg_dl; + struct sched_avg avg_irq; + u64 idle_stamp; + u64 avg_idle; + u64 max_idle_balance_cost; + struct rcuwait hotplug_wait; + u64 prev_irq_time; + u64 prev_steal_time; + u64 prev_steal_time_rq; + long unsigned int calc_load_update; + long int calc_load_active; + long: 64; + long: 64; + long: 64; + call_single_data_t hrtick_csd; + struct hrtimer hrtick_timer; + ktime_t hrtick_time; + struct sched_info rq_sched_info; + long long unsigned int rq_cpu_time; + unsigned int yld_count; + unsigned int sched_count; + unsigned int sched_goidle; + unsigned int ttwu_count; + unsigned int ttwu_local; + struct cpuidle_state *idle_state; + unsigned int nr_pinned; + unsigned int push_busy; + struct cpu_stop_work push_work; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct perf_domain { + struct em_perf_domain *em_pd; + struct perf_domain *next; + struct callback_head rcu; +}; + +struct rq_flags { + long unsigned int flags; + struct pin_cookie cookie; + unsigned int clock_update_flags; +}; + +enum { + __SCHED_FEAT_GENTLE_FAIR_SLEEPERS = 0, + __SCHED_FEAT_START_DEBIT = 1, + __SCHED_FEAT_NEXT_BUDDY = 2, + __SCHED_FEAT_LAST_BUDDY = 3, + __SCHED_FEAT_CACHE_HOT_BUDDY = 4, + __SCHED_FEAT_WAKEUP_PREEMPTION = 5, + __SCHED_FEAT_HRTICK = 6, + __SCHED_FEAT_DOUBLE_TICK = 7, + __SCHED_FEAT_NONTASK_CAPACITY = 8, + __SCHED_FEAT_TTWU_QUEUE = 9, + __SCHED_FEAT_SIS_AVG_CPU = 10, + __SCHED_FEAT_SIS_PROP = 11, + __SCHED_FEAT_WARN_DOUBLE_CLOCK = 12, + __SCHED_FEAT_RT_PUSH_IPI = 13, + __SCHED_FEAT_RT_RUNTIME_SHARE = 14, + __SCHED_FEAT_LB_MIN = 15, + __SCHED_FEAT_ATTACH_AGE_LOAD = 16, + __SCHED_FEAT_WA_IDLE = 17, + __SCHED_FEAT_WA_WEIGHT = 18, + __SCHED_FEAT_WA_BIAS = 19, + __SCHED_FEAT_UTIL_EST = 20, + __SCHED_FEAT_UTIL_EST_FASTUP = 21, + __SCHED_FEAT_NR = 22, +}; + +struct irqtime { + u64 total; + u64 tick_delta; + u64 irq_start_time; + struct u64_stats_sync sync; +}; + +struct set_affinity_pending; + +struct migration_arg { + struct task_struct *task; + int dest_cpu; + struct set_affinity_pending *pending; +}; + +struct set_affinity_pending { + refcount_t refs; + unsigned int stop_pending; + struct completion done; + struct cpu_stop_work stop_work; + struct migration_arg arg; +}; + +struct migration_swap_arg { + struct task_struct *src_task; + struct task_struct *dst_task; + int src_cpu; + int dst_cpu; +}; + +struct tick_work { + int cpu; + atomic_t state; + struct delayed_work work; +}; + +struct cfs_schedulable_data { + struct task_group *tg; + u64 period; + u64 quota; +}; + +enum { + cpuset = 0, + possible = 1, + fail = 2, +}; + +enum tick_dep_bits { + TICK_DEP_BIT_POSIX_TIMER = 0, + TICK_DEP_BIT_PERF_EVENTS = 1, + TICK_DEP_BIT_SCHED = 2, + TICK_DEP_BIT_CLOCK_UNSTABLE = 3, + TICK_DEP_BIT_RCU = 4, + TICK_DEP_BIT_RCU_EXP = 5, +}; + +struct sched_clock_data { + u64 tick_raw; + u64 tick_gtod; + u64 clock; +}; + +enum s2idle_states { + S2IDLE_STATE_NONE = 0, + S2IDLE_STATE_ENTER = 1, + S2IDLE_STATE_WAKE = 2, +}; + +struct idle_timer { + struct hrtimer timer; + int done; +}; + +struct numa_group { + refcount_t refcount; + spinlock_t lock; + int nr_tasks; + pid_t gid; + int active_nodes; + struct callback_head rcu; + long unsigned int total_faults; + long unsigned int max_faults_cpu; + long unsigned int *faults_cpu; + long unsigned int faults[0]; +}; + +struct update_util_data { + void (*func)(struct update_util_data *, u64, unsigned int); +}; + +enum numa_topology_type { + NUMA_DIRECT = 0, + NUMA_GLUELESS_MESH = 1, + NUMA_BACKPLANE = 2, +}; + +enum numa_faults_stats { + NUMA_MEM = 0, + NUMA_CPU = 1, + NUMA_MEMBUF = 2, + NUMA_CPUBUF = 3, +}; + +enum schedutil_type { + FREQUENCY_UTIL = 0, + ENERGY_UTIL = 1, +}; + +enum numa_type { + node_has_spare = 0, + node_fully_busy = 1, + node_overloaded = 2, +}; + +struct numa_stats { + long unsigned int load; + long unsigned int runnable; + long unsigned int util; + long unsigned int compute_capacity; + unsigned int nr_running; + unsigned int weight; + enum numa_type node_type; + int idle_cpu; +}; + +struct task_numa_env { + struct task_struct *p; + int src_cpu; + int src_nid; + int dst_cpu; + int dst_nid; + struct numa_stats src_stats; + struct numa_stats dst_stats; + int imbalance_pct; + int dist; + struct task_struct *best_task; + long int best_imp; + int best_cpu; +}; + +enum fbq_type { + regular = 0, + remote = 1, + all = 2, +}; + +enum group_type { + group_has_spare = 0, + group_fully_busy = 1, + group_misfit_task = 2, + group_asym_packing = 3, + group_imbalanced = 4, + group_overloaded = 5, +}; + +enum migration_type { + migrate_load = 0, + migrate_util = 1, + migrate_task = 2, + migrate_misfit = 3, +}; + +struct lb_env { + struct sched_domain *sd; + struct rq *src_rq; + int src_cpu; + int dst_cpu; + struct rq *dst_rq; + struct cpumask *dst_grpmask; + int new_dst_cpu; + enum cpu_idle_type idle; + long int imbalance; + struct cpumask *cpus; + unsigned int flags; + unsigned int loop; + unsigned int loop_break; + unsigned int loop_max; + enum fbq_type fbq_type; + enum migration_type migration_type; + struct list_head tasks; +}; + +struct sg_lb_stats { + long unsigned int avg_load; + long unsigned int group_load; + long unsigned int group_capacity; + long unsigned int group_util; + long unsigned int group_runnable; + unsigned int sum_nr_running; + unsigned int sum_h_nr_running; + unsigned int idle_cpus; + unsigned int group_weight; + enum group_type group_type; + unsigned int group_asym_packing; + long unsigned int group_misfit_task_load; + unsigned int nr_numa_running; + unsigned int nr_preferred_running; +}; + +struct sd_lb_stats { + struct sched_group *busiest; + struct sched_group *local; + long unsigned int total_load; + long unsigned int total_capacity; + long unsigned int avg_load; + unsigned int prefer_sibling; + struct sg_lb_stats busiest_stat; + struct sg_lb_stats local_stat; +}; + +typedef struct rt_rq *rt_rq_iter_t; + +struct sd_flag_debug { + unsigned int meta_flags; + char *name; +}; + +struct s_data { + struct sched_domain **sd; + struct root_domain *rd; +}; + +enum s_alloc { + sa_rootdomain = 0, + sa_sd = 1, + sa_sd_storage = 2, + sa_none = 3, +}; + +enum cpuacct_stat_index { + CPUACCT_STAT_USER = 0, + CPUACCT_STAT_SYSTEM = 1, + CPUACCT_STAT_NSTATS = 2, +}; + +struct cpuacct_usage { + u64 usages[2]; +}; + +struct cpuacct { + struct cgroup_subsys_state css; + struct cpuacct_usage *cpuusage; + struct kernel_cpustat *cpustat; +}; + +struct gov_attr_set { + struct kobject kobj; + struct list_head policy_list; + struct mutex update_lock; + int usage_count; +}; + +struct governor_attr { + struct attribute attr; + ssize_t (*show)(struct gov_attr_set *, char *); + ssize_t (*store)(struct gov_attr_set *, const char *, size_t); +}; + +struct sugov_tunables { + struct gov_attr_set attr_set; + unsigned int rate_limit_us; +}; + +struct sugov_policy { + struct cpufreq_policy *policy; + struct sugov_tunables *tunables; + struct list_head tunables_hook; + raw_spinlock_t update_lock; + u64 last_freq_update_time; + s64 freq_update_delay_ns; + unsigned int next_freq; + unsigned int cached_raw_freq; + struct irq_work irq_work; + struct kthread_work work; + struct mutex work_lock; + struct kthread_worker worker; + struct task_struct *thread; + bool work_in_progress; + bool limits_changed; + bool need_freq_update; +}; + +struct sugov_cpu { + struct update_util_data update_util; + struct sugov_policy *sg_policy; + unsigned int cpu; + bool iowait_boost_pending; + unsigned int iowait_boost; + u64 last_update; + long unsigned int util; + long unsigned int bw_dl; + long unsigned int max; + long unsigned int saved_idle_calls; +}; + +enum { + MEMBARRIER_FLAG_SYNC_CORE = 1, + MEMBARRIER_FLAG_RSEQ = 2, +}; + +enum membarrier_cmd { + MEMBARRIER_CMD_QUERY = 0, + MEMBARRIER_CMD_GLOBAL = 1, + MEMBARRIER_CMD_GLOBAL_EXPEDITED = 2, + MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = 4, + MEMBARRIER_CMD_PRIVATE_EXPEDITED = 8, + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = 16, + MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = 32, + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = 64, + MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ = 128, + MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ = 256, + MEMBARRIER_CMD_SHARED = 1, +}; + +enum membarrier_cmd_flag { + MEMBARRIER_CMD_FLAG_CPU = 1, +}; + +enum psi_res { + PSI_IO = 0, + PSI_MEM = 1, + PSI_CPU = 2, + NR_PSI_RESOURCES = 3, +}; + +struct psi_window { + u64 size; + u64 start_time; + u64 start_value; + u64 prev_growth; +}; + +struct psi_trigger { + enum psi_states state; + u64 threshold; + struct list_head node; + struct psi_group *group; + wait_queue_head_t event_wait; + int event; + struct psi_window win; + u64 last_event_time; + struct kref refcount; +}; + +struct ww_acquire_ctx; + +struct ww_mutex { + struct mutex base; + struct ww_acquire_ctx *ctx; +}; + +struct ww_acquire_ctx { + struct task_struct *task; + long unsigned int stamp; + unsigned int acquired; + short unsigned int wounded; + short unsigned int is_wait_die; +}; + +struct mutex_waiter { + struct list_head list; + struct task_struct *task; + struct ww_acquire_ctx *ww_ctx; +}; + +enum mutex_trylock_recursive_enum { + MUTEX_TRYLOCK_FAILED = 0, + MUTEX_TRYLOCK_SUCCESS = 1, + MUTEX_TRYLOCK_RECURSIVE = 2, +}; + +struct semaphore_waiter { + struct list_head list; + struct task_struct *task; + bool up; +}; + +enum rwsem_waiter_type { + RWSEM_WAITING_FOR_WRITE = 0, + RWSEM_WAITING_FOR_READ = 1, +}; + +struct rwsem_waiter { + struct list_head list; + struct task_struct *task; + enum rwsem_waiter_type type; + long unsigned int timeout; +}; + +enum rwsem_wake_type { + RWSEM_WAKE_ANY = 0, + RWSEM_WAKE_READERS = 1, + RWSEM_WAKE_READ_OWNED = 2, +}; + +enum writer_wait_state { + WRITER_NOT_FIRST = 0, + WRITER_FIRST = 1, + WRITER_HANDOFF = 2, +}; + +enum owner_state { + OWNER_NULL = 1, + OWNER_WRITER = 2, + OWNER_READER = 4, + OWNER_NONSPINNABLE = 8, +}; + +struct optimistic_spin_node { + struct optimistic_spin_node *next; + struct optimistic_spin_node *prev; + int locked; + int cpu; +}; + +struct mcs_spinlock { + struct mcs_spinlock *next; + int locked; + int count; +}; + +struct qnode { + struct mcs_spinlock mcs; + long int reserved[2]; +}; + +enum vcpu_state { + vcpu_running = 0, + vcpu_halted = 1, + vcpu_hashed = 2, +}; + +struct pv_node { + struct mcs_spinlock mcs; + int cpu; + u8 state; +}; + +struct pv_hash_entry { + struct qspinlock *lock; + struct pv_node *node; +}; + +struct hrtimer_sleeper { + struct hrtimer timer; + struct task_struct *task; +}; + +struct rt_mutex; + +struct rt_mutex_waiter { + struct rb_node tree_entry; + struct rb_node pi_tree_entry; + struct task_struct *task; + struct rt_mutex *lock; + int prio; + u64 deadline; +}; + +struct rt_mutex { + raw_spinlock_t wait_lock; + struct rb_root_cached waiters; + struct task_struct *owner; +}; + +enum rtmutex_chainwalk { + RT_MUTEX_MIN_CHAINWALK = 0, + RT_MUTEX_FULL_CHAINWALK = 1, +}; + +enum pm_qos_req_action { + PM_QOS_ADD_REQ = 0, + PM_QOS_UPDATE_REQ = 1, + PM_QOS_REMOVE_REQ = 2, +}; + +typedef int suspend_state_t; + +enum suspend_stat_step { + SUSPEND_FREEZE = 1, + SUSPEND_PREPARE = 2, + SUSPEND_SUSPEND = 3, + SUSPEND_SUSPEND_LATE = 4, + SUSPEND_SUSPEND_NOIRQ = 5, + SUSPEND_RESUME_NOIRQ = 6, + SUSPEND_RESUME_EARLY = 7, + SUSPEND_RESUME = 8, +}; + +struct suspend_stats { + int success; + int fail; + int failed_freeze; + int failed_prepare; + int failed_suspend; + int failed_suspend_late; + int failed_suspend_noirq; + int failed_resume; + int failed_resume_early; + int failed_resume_noirq; + int last_failed_dev; + char failed_devs[80]; + int last_failed_errno; + int errno[2]; + int last_failed_step; + enum suspend_stat_step failed_steps[2]; +}; + +enum { + TEST_NONE = 0, + TEST_CORE = 1, + TEST_CPUS = 2, + TEST_PLATFORM = 3, + TEST_DEVICES = 4, + TEST_FREEZER = 5, + __TEST_AFTER_LAST = 6, +}; + +struct pm_vt_switch { + struct list_head head; + struct device *dev; + bool required; +}; + +struct platform_suspend_ops { + int (*valid)(suspend_state_t); + int (*begin)(suspend_state_t); + int (*prepare)(); + int (*prepare_late)(); + int (*enter)(suspend_state_t); + void (*wake)(); + void (*finish)(); + bool (*suspend_again)(); + void (*end)(); + void (*recover)(); +}; + +struct platform_s2idle_ops { + int (*begin)(); + int (*prepare)(); + int (*prepare_late)(); + bool (*wake)(); + void (*restore_early)(); + void (*restore)(); + void (*end)(); +}; + +typedef __u64 timeu64_t; + +struct rtc_wkalrm { + unsigned char enabled; + unsigned char pending; + struct rtc_time time; +}; + +struct rtc_class_ops { + int (*ioctl)(struct device *, unsigned int, long unsigned int); + int (*read_time)(struct device *, struct rtc_time *); + int (*set_time)(struct device *, struct rtc_time *); + int (*read_alarm)(struct device *, struct rtc_wkalrm *); + int (*set_alarm)(struct device *, struct rtc_wkalrm *); + int (*proc)(struct device *, struct seq_file *); + int (*alarm_irq_enable)(struct device *, unsigned int); + int (*read_offset)(struct device *, long int *); + int (*set_offset)(struct device *, long int); +}; + +struct rtc_device; + +struct rtc_timer { + struct timerqueue_node node; + ktime_t period; + void (*func)(struct rtc_device *); + struct rtc_device *rtc; + int enabled; +}; + +struct rtc_device { + struct device dev; + struct module *owner; + int id; + const struct rtc_class_ops *ops; + struct mutex ops_lock; + struct cdev char_dev; + long unsigned int flags; + long unsigned int irq_data; + spinlock_t irq_lock; + wait_queue_head_t irq_queue; + struct fasync_struct *async_queue; + int irq_freq; + int max_user_freq; + struct timerqueue_head timerqueue; + struct rtc_timer aie_timer; + struct rtc_timer uie_rtctimer; + struct hrtimer pie_timer; + int pie_enabled; + struct work_struct irqwork; + int uie_unsupported; + long unsigned int set_offset_nsec; + time64_t range_min; + timeu64_t range_max; + time64_t start_secs; + time64_t offset_secs; + bool set_start_time; +}; + +struct platform_hibernation_ops { + int (*begin)(pm_message_t); + void (*end)(); + int (*pre_snapshot)(); + void (*finish)(); + int (*prepare)(); + int (*enter)(); + void (*leave)(); + int (*pre_restore)(); + void (*restore_cleanup)(); + void (*recover)(); +}; + +enum { + HIBERNATION_INVALID = 0, + HIBERNATION_PLATFORM = 1, + HIBERNATION_SHUTDOWN = 2, + HIBERNATION_REBOOT = 3, + HIBERNATION_SUSPEND = 4, + HIBERNATION_TEST_RESUME = 5, + __HIBERNATION_AFTER_LAST = 6, +}; + +struct pbe { + void *address; + void *orig_address; + struct pbe *next; +}; + +struct swsusp_info { + struct new_utsname uts; + u32 version_code; + long unsigned int num_physpages; + int cpus; + long unsigned int image_pages; + long unsigned int pages; + long unsigned int size; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct snapshot_handle { + unsigned int cur; + void *buffer; + int sync_read; +}; + +struct linked_page { + struct linked_page *next; + char data[4088]; +}; + +struct chain_allocator { + struct linked_page *chain; + unsigned int used_space; + gfp_t gfp_mask; + int safe_needed; +}; + +struct rtree_node { + struct list_head list; + long unsigned int *data; +}; + +struct mem_zone_bm_rtree { + struct list_head list; + struct list_head nodes; + struct list_head leaves; + long unsigned int start_pfn; + long unsigned int end_pfn; + struct rtree_node *rtree; + int levels; + unsigned int blocks; +}; + +struct bm_position { + struct mem_zone_bm_rtree *zone; + struct rtree_node *node; + long unsigned int node_pfn; + int node_bit; +}; + +struct memory_bitmap { + struct list_head zones; + struct linked_page *p_list; + struct bm_position cur; +}; + +struct mem_extent { + struct list_head hook; + long unsigned int start; + long unsigned int end; +}; + +struct nosave_region { + struct list_head list; + long unsigned int start_pfn; + long unsigned int end_pfn; +}; + +typedef struct { + long unsigned int val; +} swp_entry_t; + +enum { + BIO_NO_PAGE_REF = 0, + BIO_CLONED = 1, + BIO_BOUNCED = 2, + BIO_WORKINGSET = 3, + BIO_QUIET = 4, + BIO_CHAIN = 5, + BIO_REFFED = 6, + BIO_THROTTLED = 7, + BIO_TRACE_COMPLETION = 8, + BIO_CGROUP_ACCT = 9, + BIO_TRACKED = 10, + BIO_FLAG_LAST = 11, +}; + +enum req_opf { + REQ_OP_READ = 0, + REQ_OP_WRITE = 1, + REQ_OP_FLUSH = 2, + REQ_OP_DISCARD = 3, + REQ_OP_SECURE_ERASE = 5, + REQ_OP_WRITE_SAME = 7, + REQ_OP_WRITE_ZEROES = 9, + REQ_OP_ZONE_OPEN = 10, + REQ_OP_ZONE_CLOSE = 11, + REQ_OP_ZONE_FINISH = 12, + REQ_OP_ZONE_APPEND = 13, + REQ_OP_ZONE_RESET = 15, + REQ_OP_ZONE_RESET_ALL = 17, + REQ_OP_SCSI_IN = 32, + REQ_OP_SCSI_OUT = 33, + REQ_OP_DRV_IN = 34, + REQ_OP_DRV_OUT = 35, + REQ_OP_LAST = 36, +}; + +enum req_flag_bits { + __REQ_FAILFAST_DEV = 8, + __REQ_FAILFAST_TRANSPORT = 9, + __REQ_FAILFAST_DRIVER = 10, + __REQ_SYNC = 11, + __REQ_META = 12, + __REQ_PRIO = 13, + __REQ_NOMERGE = 14, + __REQ_IDLE = 15, + __REQ_INTEGRITY = 16, + __REQ_FUA = 17, + __REQ_PREFLUSH = 18, + __REQ_RAHEAD = 19, + __REQ_BACKGROUND = 20, + __REQ_NOWAIT = 21, + __REQ_CGROUP_PUNT = 22, + __REQ_NOUNMAP = 23, + __REQ_HIPRI = 24, + __REQ_DRV = 25, + __REQ_SWAP = 26, + __REQ_NR_BITS = 27, +}; + +struct swap_map_page { + sector_t entries[511]; + sector_t next_swap; +}; + +struct swap_map_page_list { + struct swap_map_page *map; + struct swap_map_page_list *next; +}; + +struct swap_map_handle { + struct swap_map_page *cur; + struct swap_map_page_list *maps; + sector_t cur_swap; + sector_t first_sector; + unsigned int k; + long unsigned int reqd_free_pages; + u32 crc32; +}; + +struct swsusp_header { + char reserved[4060]; + u32 crc32; + sector_t image; + unsigned int flags; + char orig_sig[10]; + char sig[10]; +}; + +struct swsusp_extent { + struct rb_node node; + long unsigned int start; + long unsigned int end; +}; + +struct hib_bio_batch { + atomic_t count; + wait_queue_head_t wait; + blk_status_t error; + struct blk_plug plug; +}; + +struct crc_data { + struct task_struct *thr; + atomic_t ready; + atomic_t stop; + unsigned int run_threads; + wait_queue_head_t go; + wait_queue_head_t done; + u32 *crc32; + size_t *unc_len[3]; + unsigned char *unc[3]; +}; + +struct cmp_data { + struct task_struct *thr; + atomic_t ready; + atomic_t stop; + int ret; + wait_queue_head_t go; + wait_queue_head_t done; + size_t unc_len; + size_t cmp_len; + unsigned char unc[131072]; + unsigned char cmp[143360]; + unsigned char wrk[16384]; +}; + +struct dec_data { + struct task_struct *thr; + atomic_t ready; + atomic_t stop; + int ret; + wait_queue_head_t go; + wait_queue_head_t done; + size_t unc_len; + size_t cmp_len; + unsigned char unc[131072]; + unsigned char cmp[143360]; +}; + +typedef s64 compat_loff_t; + +struct resume_swap_area { + __kernel_loff_t offset; + __u32 dev; +} __attribute__((packed)); + +struct snapshot_data { + struct snapshot_handle handle; + int swap; + int mode; + bool frozen; + bool ready; + bool platform_support; + bool free_bitmaps; + dev_t dev; +}; + +struct compat_resume_swap_area { + compat_loff_t offset; + u32 dev; +} __attribute__((packed)); + +struct sysrq_key_op { + void (* const handler)(int); + const char * const help_msg; + const char * const action_msg; + const int enable_mask; +}; + +struct em_data_callback { + int (*active_power)(long unsigned int *, long unsigned int *, struct device *); +}; + +struct dev_printk_info { + char subsystem[16]; + char device[48]; +}; + +struct kmsg_dumper { + struct list_head list; + void (*dump)(struct kmsg_dumper *, enum kmsg_dump_reason); + enum kmsg_dump_reason max_reason; + bool active; + bool registered; + u32 cur_idx; + u32 next_idx; + u64 cur_seq; + u64 next_seq; +}; + +struct trace_event_raw_console { + struct trace_entry ent; + u32 __data_loc_msg; + char __data[0]; +}; + +struct trace_event_data_offsets_console { + u32 msg; +}; + +typedef void (*btf_trace_console)(void *, const char *, size_t); + +struct printk_info { + u64 seq; + u64 ts_nsec; + u16 text_len; + u8 facility; + u8 flags: 5; + u8 level: 3; + u32 caller_id; + struct dev_printk_info dev_info; +}; + +struct printk_record { + struct printk_info *info; + char *text_buf; + unsigned int text_buf_size; +}; + +struct prb_data_blk_lpos { + long unsigned int begin; + long unsigned int next; +}; + +struct prb_desc { + atomic_long_t state_var; + struct prb_data_blk_lpos text_blk_lpos; +}; + +struct prb_data_ring { + unsigned int size_bits; + char *data; + atomic_long_t head_lpos; + atomic_long_t tail_lpos; +}; + +struct prb_desc_ring { + unsigned int count_bits; + struct prb_desc *descs; + struct printk_info *infos; + atomic_long_t head_id; + atomic_long_t tail_id; +}; + +struct printk_ringbuffer { + struct prb_desc_ring desc_ring; + struct prb_data_ring text_data_ring; + atomic_long_t fail; +}; + +struct prb_reserved_entry { + struct printk_ringbuffer *rb; + long unsigned int irqflags; + long unsigned int id; + unsigned int text_space; +}; + +enum desc_state { + desc_miss = 4294967295, + desc_reserved = 0, + desc_committed = 1, + desc_finalized = 2, + desc_reusable = 3, +}; + +struct console_cmdline { + char name[16]; + int index; + bool user_specified; + char *options; + char *brl_options; +}; + +enum devkmsg_log_bits { + __DEVKMSG_LOG_BIT_ON = 0, + __DEVKMSG_LOG_BIT_OFF = 1, + __DEVKMSG_LOG_BIT_LOCK = 2, +}; + +enum devkmsg_log_masks { + DEVKMSG_LOG_MASK_ON = 1, + DEVKMSG_LOG_MASK_OFF = 2, + DEVKMSG_LOG_MASK_LOCK = 4, +}; + +enum con_msg_format_flags { + MSG_FORMAT_DEFAULT = 0, + MSG_FORMAT_SYSLOG = 1, +}; + +enum log_flags { + LOG_NEWLINE = 2, + LOG_CONT = 8, +}; + +struct devkmsg_user { + u64 seq; + struct ratelimit_state rs; + struct mutex lock; + char buf[8192]; + struct printk_info info; + char text_buf[8192]; + struct printk_record record; +}; + +struct printk_safe_seq_buf { + atomic_t len; + atomic_t message_lost; + struct irq_work work; + unsigned char buffer[4064]; +}; + +struct dev_printk_info___2; + +struct prb_data_block { + long unsigned int id; + char data[0]; +}; + +enum { + IRQS_AUTODETECT = 1, + IRQS_SPURIOUS_DISABLED = 2, + IRQS_POLL_INPROGRESS = 8, + IRQS_ONESHOT = 32, + IRQS_REPLAY = 64, + IRQS_WAITING = 128, + IRQS_PENDING = 512, + IRQS_SUSPENDED = 2048, + IRQS_TIMINGS = 4096, + IRQS_NMI = 8192, +}; + +enum { + _IRQ_DEFAULT_INIT_FLAGS = 0, + _IRQ_PER_CPU = 512, + _IRQ_LEVEL = 256, + _IRQ_NOPROBE = 1024, + _IRQ_NOREQUEST = 2048, + _IRQ_NOTHREAD = 65536, + _IRQ_NOAUTOEN = 4096, + _IRQ_MOVE_PCNTXT = 16384, + _IRQ_NO_BALANCING = 8192, + _IRQ_NESTED_THREAD = 32768, + _IRQ_PER_CPU_DEVID = 131072, + _IRQ_IS_POLLED = 262144, + _IRQ_DISABLE_UNLAZY = 524288, + _IRQ_HIDDEN = 1048576, + _IRQF_MODIFY_MASK = 2096911, +}; + +enum { + IRQTF_RUNTHREAD = 0, + IRQTF_WARNED = 1, + IRQTF_AFFINITY = 2, + IRQTF_FORCED_THREAD = 3, +}; + +enum { + IRQC_IS_HARDIRQ = 0, + IRQC_IS_NESTED = 1, +}; + +enum { + IRQ_STARTUP_NORMAL = 0, + IRQ_STARTUP_MANAGED = 1, + IRQ_STARTUP_ABORT = 2, +}; + +struct irq_devres { + unsigned int irq; + void *dev_id; +}; + +struct irq_desc_devres { + unsigned int from; + unsigned int cnt; +}; + +struct irqchip_fwid { + struct fwnode_handle fwnode; + unsigned int type; + char *name; + phys_addr_t *pa; +}; + +enum { + AFFINITY = 0, + AFFINITY_LIST = 1, + EFFECTIVE = 2, + EFFECTIVE_LIST = 3, +}; + +struct irq_affinity { + unsigned int pre_vectors; + unsigned int post_vectors; + unsigned int nr_sets; + unsigned int set_size[4]; + void (*calc_sets)(struct irq_affinity *, unsigned int); + void *priv; +}; + +struct node_vectors { + unsigned int id; + union { + unsigned int nvectors; + unsigned int ncpus; + }; +}; + +struct cpumap { + unsigned int available; + unsigned int allocated; + unsigned int managed; + unsigned int managed_allocated; + bool initialized; + bool online; + long unsigned int alloc_map[4]; + long unsigned int managed_map[4]; +}; + +struct irq_matrix___2 { + unsigned int matrix_bits; + unsigned int alloc_start; + unsigned int alloc_end; + unsigned int alloc_size; + unsigned int global_available; + unsigned int global_reserved; + unsigned int systembits_inalloc; + unsigned int total_allocated; + unsigned int online_maps; + struct cpumap *maps; + long unsigned int scratch_map[4]; + long unsigned int system_map[4]; +}; + +struct trace_event_raw_irq_matrix_global { + struct trace_entry ent; + unsigned int online_maps; + unsigned int global_available; + unsigned int global_reserved; + unsigned int total_allocated; + char __data[0]; +}; + +struct trace_event_raw_irq_matrix_global_update { + struct trace_entry ent; + int bit; + unsigned int online_maps; + unsigned int global_available; + unsigned int global_reserved; + unsigned int total_allocated; + char __data[0]; +}; + +struct trace_event_raw_irq_matrix_cpu { + struct trace_entry ent; + int bit; + unsigned int cpu; + bool online; + unsigned int available; + unsigned int allocated; + unsigned int managed; + unsigned int online_maps; + unsigned int global_available; + unsigned int global_reserved; + unsigned int total_allocated; + char __data[0]; +}; + +struct trace_event_data_offsets_irq_matrix_global {}; + +struct trace_event_data_offsets_irq_matrix_global_update {}; + +struct trace_event_data_offsets_irq_matrix_cpu {}; + +typedef void (*btf_trace_irq_matrix_online)(void *, struct irq_matrix___2 *); + +typedef void (*btf_trace_irq_matrix_offline)(void *, struct irq_matrix___2 *); + +typedef void (*btf_trace_irq_matrix_reserve)(void *, struct irq_matrix___2 *); + +typedef void (*btf_trace_irq_matrix_remove_reserved)(void *, struct irq_matrix___2 *); + +typedef void (*btf_trace_irq_matrix_assign_system)(void *, int, struct irq_matrix___2 *); + +typedef void (*btf_trace_irq_matrix_alloc_reserved)(void *, int, unsigned int, struct irq_matrix___2 *, struct cpumap *); + +typedef void (*btf_trace_irq_matrix_reserve_managed)(void *, int, unsigned int, struct irq_matrix___2 *, struct cpumap *); + +typedef void (*btf_trace_irq_matrix_remove_managed)(void *, int, unsigned int, struct irq_matrix___2 *, struct cpumap *); + +typedef void (*btf_trace_irq_matrix_alloc_managed)(void *, int, unsigned int, struct irq_matrix___2 *, struct cpumap *); + +typedef void (*btf_trace_irq_matrix_assign)(void *, int, unsigned int, struct irq_matrix___2 *, struct cpumap *); + +typedef void (*btf_trace_irq_matrix_alloc)(void *, int, unsigned int, struct irq_matrix___2 *, struct cpumap *); + +typedef void (*btf_trace_irq_matrix_free)(void *, int, unsigned int, struct irq_matrix___2 *, struct cpumap *); + +typedef void (*call_rcu_func_t)(struct callback_head *, rcu_callback_t); + +struct rcu_synchronize { + struct callback_head head; + struct completion completion; +}; + +struct trace_event_raw_rcu_utilization { + struct trace_entry ent; + const char *s; + char __data[0]; +}; + +struct trace_event_data_offsets_rcu_utilization {}; + +typedef void (*btf_trace_rcu_utilization)(void *, const char *); + +struct rcu_tasks; + +typedef void (*rcu_tasks_gp_func_t)(struct rcu_tasks *); + +typedef void (*pregp_func_t)(); + +typedef void (*pertask_func_t)(struct task_struct *, struct list_head *); + +typedef void (*postscan_func_t)(struct list_head *); + +typedef void (*holdouts_func_t)(struct list_head *, bool, bool *); + +typedef void (*postgp_func_t)(struct rcu_tasks *); + +struct rcu_tasks { + struct callback_head *cbs_head; + struct callback_head **cbs_tail; + struct wait_queue_head cbs_wq; + raw_spinlock_t cbs_lock; + int gp_state; + int gp_sleep; + int init_fract; + long unsigned int gp_jiffies; + long unsigned int gp_start; + long unsigned int n_gps; + long unsigned int n_ipis; + long unsigned int n_ipis_fails; + struct task_struct *kthread_ptr; + rcu_tasks_gp_func_t gp_func; + pregp_func_t pregp_func; + pertask_func_t pertask_func; + postscan_func_t postscan_func; + holdouts_func_t holdouts_func; + postgp_func_t postgp_func; + call_rcu_func_t call_func; + char *name; + char *kname; +}; + +enum { + GP_IDLE = 0, + GP_ENTER = 1, + GP_PASSED = 2, + GP_EXIT = 3, + GP_REPLAY = 4, +}; + +struct rcu_cblist { + struct callback_head *head; + struct callback_head **tail; + long int len; +}; + +enum rcutorture_type { + RCU_FLAVOR = 0, + RCU_TASKS_FLAVOR = 1, + RCU_TASKS_RUDE_FLAVOR = 2, + RCU_TASKS_TRACING_FLAVOR = 3, + RCU_TRIVIAL_FLAVOR = 4, + SRCU_FLAVOR = 5, + INVALID_RCU_FLAVOR = 6, +}; + +struct rcu_exp_work { + long unsigned int rew_s; + struct work_struct rew_work; +}; + +struct rcu_node { + raw_spinlock_t lock; + long unsigned int gp_seq; + long unsigned int gp_seq_needed; + long unsigned int completedqs; + long unsigned int qsmask; + long unsigned int rcu_gp_init_mask; + long unsigned int qsmaskinit; + long unsigned int qsmaskinitnext; + long unsigned int ofl_seq; + long unsigned int expmask; + long unsigned int expmaskinit; + long unsigned int expmaskinitnext; + long unsigned int cbovldmask; + long unsigned int ffmask; + long unsigned int grpmask; + int grplo; + int grphi; + u8 grpnum; + u8 level; + bool wait_blkd_tasks; + struct rcu_node *parent; + struct list_head blkd_tasks; + struct list_head *gp_tasks; + struct list_head *exp_tasks; + struct list_head *boost_tasks; + struct rt_mutex boost_mtx; + long unsigned int boost_time; + struct task_struct *boost_kthread_task; + unsigned int boost_kthread_status; + struct swait_queue_head nocb_gp_wq[2]; + long: 64; + long: 64; + long: 64; + long: 64; + raw_spinlock_t fqslock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + spinlock_t exp_lock; + long unsigned int exp_seq_rq; + wait_queue_head_t exp_wq[4]; + struct rcu_exp_work rew; + bool exp_need_flush; + long: 56; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +union rcu_noqs { + struct { + u8 norm; + u8 exp; + } b; + u16 s; +}; + +struct rcu_data { + long unsigned int gp_seq; + long unsigned int gp_seq_needed; + union rcu_noqs cpu_no_qs; + bool core_needs_qs; + bool beenonline; + bool gpwrap; + bool exp_deferred_qs; + bool cpu_started; + struct rcu_node *mynode; + long unsigned int grpmask; + long unsigned int ticks_this_gp; + struct irq_work defer_qs_iw; + bool defer_qs_iw_pending; + struct work_struct strict_work; + struct rcu_segcblist cblist; + long int qlen_last_fqs_check; + long unsigned int n_cbs_invoked; + long unsigned int n_force_qs_snap; + long int blimit; + int dynticks_snap; + long int dynticks_nesting; + long int dynticks_nmi_nesting; + atomic_t dynticks; + bool rcu_need_heavy_qs; + bool rcu_urgent_qs; + bool rcu_forced_tick; + bool rcu_forced_tick_exp; + struct callback_head barrier_head; + int exp_dynticks_snap; + struct swait_queue_head nocb_cb_wq; + struct task_struct *nocb_gp_kthread; + raw_spinlock_t nocb_lock; + atomic_t nocb_lock_contended; + int nocb_defer_wakeup; + struct timer_list nocb_timer; + long unsigned int nocb_gp_adv_time; + raw_spinlock_t nocb_bypass_lock; + struct rcu_cblist nocb_bypass; + long unsigned int nocb_bypass_first; + long unsigned int nocb_nobypass_last; + int nocb_nobypass_count; + long: 32; + long: 64; + raw_spinlock_t nocb_gp_lock; + struct timer_list nocb_bypass_timer; + u8 nocb_gp_sleep; + u8 nocb_gp_bypass; + u8 nocb_gp_gp; + long unsigned int nocb_gp_seq; + long unsigned int nocb_gp_loops; + struct swait_queue_head nocb_gp_wq; + bool nocb_cb_sleep; + struct task_struct *nocb_cb_kthread; + struct rcu_data *nocb_next_cb_rdp; + long: 64; + struct rcu_data *nocb_gp_rdp; + struct task_struct *rcu_cpu_kthread_task; + unsigned int rcu_cpu_kthread_status; + char rcu_cpu_has_work; + unsigned int softirq_snap; + struct irq_work rcu_iw; + bool rcu_iw_pending; + long unsigned int rcu_iw_gp_seq; + long unsigned int rcu_ofl_gp_seq; + short int rcu_ofl_gp_flags; + long unsigned int rcu_onl_gp_seq; + short int rcu_onl_gp_flags; + long unsigned int last_fqs_resched; + int cpu; + long: 32; + long: 64; +}; + +struct rcu_state { + struct rcu_node node[521]; + struct rcu_node *level[4]; + int ncpus; + int n_online_cpus; + long: 64; + long: 64; + long: 64; + u8 boost; + long unsigned int gp_seq; + long unsigned int gp_max; + struct task_struct *gp_kthread; + struct swait_queue_head gp_wq; + short int gp_flags; + short int gp_state; + long unsigned int gp_wake_time; + long unsigned int gp_wake_seq; + struct mutex barrier_mutex; + atomic_t barrier_cpu_count; + struct completion barrier_completion; + long unsigned int barrier_sequence; + struct mutex exp_mutex; + struct mutex exp_wake_mutex; + long unsigned int expedited_sequence; + atomic_t expedited_need_qs; + struct swait_queue_head expedited_wq; + int ncpus_snap; + u8 cbovld; + u8 cbovldnext; + long unsigned int jiffies_force_qs; + long unsigned int jiffies_kick_kthreads; + long unsigned int n_force_qs; + long unsigned int gp_start; + long unsigned int gp_end; + long unsigned int gp_activity; + long unsigned int gp_req_activity; + long unsigned int jiffies_stall; + long unsigned int jiffies_resched; + long unsigned int n_force_qs_gpstart; + const char *name; + char abbr; + long: 56; + long: 64; + long: 64; + raw_spinlock_t ofl_lock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct kvfree_rcu_bulk_data { + long unsigned int nr_records; + struct kvfree_rcu_bulk_data *next; + void *records[0]; +}; + +struct kfree_rcu_cpu; + +struct kfree_rcu_cpu_work { + struct rcu_work rcu_work; + struct callback_head *head_free; + struct kvfree_rcu_bulk_data *bkvhead_free[2]; + struct kfree_rcu_cpu *krcp; +}; + +struct kfree_rcu_cpu { + struct callback_head *head; + struct kvfree_rcu_bulk_data *bkvhead[2]; + struct kfree_rcu_cpu_work krw_arr[2]; + raw_spinlock_t lock; + struct delayed_work monitor_work; + bool monitor_todo; + bool initialized; + int count; + struct work_struct page_cache_work; + atomic_t work_in_progress; + struct hrtimer hrtimer; + struct llist_head bkvcache; + int nr_bkv_objs; +}; + +struct klp_func { + const char *old_name; + void *new_func; + long unsigned int old_sympos; + void *old_func; + struct kobject kobj; + struct list_head node; + struct list_head stack_node; + long unsigned int old_size; + long unsigned int new_size; + bool nop; + bool patched; + bool transition; +}; + +struct klp_object; + +struct klp_callbacks { + int (*pre_patch)(struct klp_object *); + void (*post_patch)(struct klp_object *); + void (*pre_unpatch)(struct klp_object *); + void (*post_unpatch)(struct klp_object *); + bool post_unpatch_enabled; +}; + +struct klp_object { + const char *name; + struct klp_func *funcs; + struct klp_callbacks callbacks; + struct kobject kobj; + struct list_head func_list; + struct list_head node; + struct module *mod; + bool dynamic; + bool patched; +}; + +struct klp_state { + long unsigned int id; + unsigned int version; + void *data; +}; + +struct klp_patch { + struct module *mod; + struct klp_object *objs; + struct klp_state *states; + bool replace; + struct list_head list; + struct kobject kobj; + struct list_head obj_list; + bool enabled; + bool forced; + struct work_struct free_work; + struct completion finish; +}; + +struct klp_find_arg { + const char *objname; + const char *name; + long unsigned int addr; + long unsigned int count; + long unsigned int pos; +}; + +struct klp_ops { + struct list_head node; + struct list_head func_stack; + struct ftrace_ops fops; +}; + +typedef int (*klp_shadow_ctor_t)(void *, void *, void *); + +typedef void (*klp_shadow_dtor_t)(void *, void *); + +struct klp_shadow { + struct hlist_node node; + struct callback_head callback_head; + void *obj; + long unsigned int id; + char data[0]; +}; + +enum dma_sync_target { + SYNC_FOR_CPU = 0, + SYNC_FOR_DEVICE = 1, +}; + +struct dma_devres { + size_t size; + void *vaddr; + dma_addr_t dma_handle; + long unsigned int attrs; +}; + +struct cma { + long unsigned int base_pfn; + long unsigned int count; + long unsigned int *bitmap; + unsigned int order_per_bit; + struct mutex lock; + char name[64]; +}; + +struct trace_event_raw_swiotlb_bounced { + struct trace_entry ent; + u32 __data_loc_dev_name; + u64 dma_mask; + dma_addr_t dev_addr; + size_t size; + enum swiotlb_force swiotlb_force; + char __data[0]; +}; + +struct trace_event_data_offsets_swiotlb_bounced { + u32 dev_name; +}; + +typedef void (*btf_trace_swiotlb_bounced)(void *, struct device *, dma_addr_t, size_t, enum swiotlb_force); + +struct trace_event_raw_sys_enter { + struct trace_entry ent; + long int id; + long unsigned int args[6]; + char __data[0]; +}; + +struct trace_event_raw_sys_exit { + struct trace_entry ent; + long int id; + long int ret; + char __data[0]; +}; + +struct trace_event_data_offsets_sys_enter {}; + +struct trace_event_data_offsets_sys_exit {}; + +typedef void (*btf_trace_sys_enter)(void *, struct pt_regs *, long int); + +typedef void (*btf_trace_sys_exit)(void *, struct pt_regs *, long int); + +struct kvm_regs { + __u64 rax; + __u64 rbx; + __u64 rcx; + __u64 rdx; + __u64 rsi; + __u64 rdi; + __u64 rsp; + __u64 rbp; + __u64 r8; + __u64 r9; + __u64 r10; + __u64 r11; + __u64 r12; + __u64 r13; + __u64 r14; + __u64 r15; + __u64 rip; + __u64 rflags; +}; + +struct kvm_segment { + __u64 base; + __u32 limit; + __u16 selector; + __u8 type; + __u8 present; + __u8 dpl; + __u8 db; + __u8 s; + __u8 l; + __u8 g; + __u8 avl; + __u8 unusable; + __u8 padding; +}; + +struct kvm_dtable { + __u64 base; + __u16 limit; + __u16 padding[3]; +}; + +struct kvm_sregs { + struct kvm_segment cs; + struct kvm_segment ds; + struct kvm_segment es; + struct kvm_segment fs; + struct kvm_segment gs; + struct kvm_segment ss; + struct kvm_segment tr; + struct kvm_segment ldt; + struct kvm_dtable gdt; + struct kvm_dtable idt; + __u64 cr0; + __u64 cr2; + __u64 cr3; + __u64 cr4; + __u64 cr8; + __u64 efer; + __u64 apic_base; + __u64 interrupt_bitmap[4]; +}; + +struct kvm_cpuid_entry2 { + __u32 function; + __u32 index; + __u32 flags; + __u32 eax; + __u32 ebx; + __u32 ecx; + __u32 edx; + __u32 padding[3]; +}; + +struct kvm_debug_exit_arch { + __u32 exception; + __u32 pad; + __u64 pc; + __u64 dr6; + __u64 dr7; +}; + +struct kvm_vcpu_events { + struct { + __u8 injected; + __u8 nr; + __u8 has_error_code; + __u8 pending; + __u32 error_code; + } exception; + struct { + __u8 injected; + __u8 nr; + __u8 soft; + __u8 shadow; + } interrupt; + struct { + __u8 injected; + __u8 pending; + __u8 masked; + __u8 pad; + } nmi; + __u32 sipi_vector; + __u32 flags; + struct { + __u8 smm; + __u8 pending; + __u8 smm_inside_nmi; + __u8 latched_init; + } smi; + __u8 reserved[27]; + __u8 exception_has_payload; + __u64 exception_payload; +}; + +struct kvm_sync_regs { + struct kvm_regs regs; + struct kvm_sregs sregs; + struct kvm_vcpu_events events; +}; + +struct kvm_pmu_event_filter { + __u32 action; + __u32 nevents; + __u32 fixed_counter_bitmap; + __u32 flags; + __u32 pad[4]; + __u64 events[0]; +}; + +struct kvm_hyperv_exit { + __u32 type; + __u32 pad1; + union { + struct { + __u32 msr; + __u32 pad2; + __u64 control; + __u64 evt_page; + __u64 msg_page; + } synic; + struct { + __u64 input; + __u64 result; + __u64 params[2]; + } hcall; + struct { + __u32 msr; + __u32 pad2; + __u64 control; + __u64 status; + __u64 send_page; + __u64 recv_page; + __u64 pending_page; + } syndbg; + } u; +}; + +struct kvm_run { + __u8 request_interrupt_window; + __u8 immediate_exit; + __u8 padding1[6]; + __u32 exit_reason; + __u8 ready_for_interrupt_injection; + __u8 if_flag; + __u16 flags; + __u64 cr8; + __u64 apic_base; + union { + struct { + __u64 hardware_exit_reason; + } hw; + struct { + __u64 hardware_entry_failure_reason; + __u32 cpu; + } fail_entry; + struct { + __u32 exception; + __u32 error_code; + } ex; + struct { + __u8 direction; + __u8 size; + __u16 port; + __u32 count; + __u64 data_offset; + } io; + struct { + struct kvm_debug_exit_arch arch; + } debug; + struct { + __u64 phys_addr; + __u8 data[8]; + __u32 len; + __u8 is_write; + } mmio; + struct { + __u64 nr; + __u64 args[6]; + __u64 ret; + __u32 longmode; + __u32 pad; + } hypercall; + struct { + __u64 rip; + __u32 is_write; + __u32 pad; + } tpr_access; + struct { + __u8 icptcode; + __u16 ipa; + __u32 ipb; + } s390_sieic; + __u64 s390_reset_flags; + struct { + __u64 trans_exc_code; + __u32 pgm_code; + } s390_ucontrol; + struct { + __u32 dcrn; + __u32 data; + __u8 is_write; + } dcr; + struct { + __u32 suberror; + __u32 ndata; + __u64 data[16]; + } internal; + struct { + __u64 gprs[32]; + } osi; + struct { + __u64 nr; + __u64 ret; + __u64 args[9]; + } papr_hcall; + struct { + __u16 subchannel_id; + __u16 subchannel_nr; + __u32 io_int_parm; + __u32 io_int_word; + __u32 ipb; + __u8 dequeued; + } s390_tsch; + struct { + __u32 epr; + } epr; + struct { + __u32 type; + __u64 flags; + } system_event; + struct { + __u64 addr; + __u8 ar; + __u8 reserved; + __u8 fc; + __u8 sel1; + __u16 sel2; + } s390_stsi; + struct { + __u8 vector; + } eoi; + struct kvm_hyperv_exit hyperv; + struct { + __u64 esr_iss; + __u64 fault_ipa; + } arm_nisv; + struct { + __u8 error; + __u8 pad[7]; + __u32 reason; + __u32 index; + __u64 data; + } msr; + char padding[256]; + }; + __u64 kvm_valid_regs; + __u64 kvm_dirty_regs; + union { + struct kvm_sync_regs regs; + char padding[2048]; + } s; +}; + +struct kvm_coalesced_mmio { + __u64 phys_addr; + __u32 len; + union { + __u32 pad; + __u32 pio; + }; + __u8 data[8]; +}; + +struct kvm_coalesced_mmio_ring { + __u32 first; + __u32 last; + struct kvm_coalesced_mmio coalesced_mmio[0]; +}; + +struct kvm_xen_hvm_config { + __u32 flags; + __u32 msr; + __u64 blob_addr_32; + __u64 blob_addr_64; + __u8 blob_size_32; + __u8 blob_size_64; + __u8 pad2[30]; +}; + +struct kvm_dirty_gfn { + __u32 flags; + __u32 slot; + __u64 offset; +}; + +typedef long unsigned int gva_t; + +typedef u64 gpa_t; + +typedef u64 gfn_t; + +typedef u64 hpa_t; + +typedef u64 hfn_t; + +typedef hfn_t kvm_pfn_t; + +struct kvm_memory_slot; + +struct gfn_to_hva_cache { + u64 generation; + gpa_t gpa; + long unsigned int hva; + long unsigned int len; + struct kvm_memory_slot *memslot; +}; + +struct kvm_rmap_head; + +struct kvm_lpage_info; + +struct kvm_arch_memory_slot { + struct kvm_rmap_head *rmap[3]; + struct kvm_lpage_info *lpage_info[2]; + short unsigned int *gfn_track[1]; +}; + +struct kvm_memory_slot { + gfn_t base_gfn; + long unsigned int npages; + long unsigned int *dirty_bitmap; + struct kvm_arch_memory_slot arch; + long unsigned int userspace_addr; + u32 flags; + short int id; + u16 as_id; +}; + +struct gfn_to_pfn_cache { + u64 generation; + gfn_t gfn; + kvm_pfn_t pfn; + bool dirty; +}; + +struct kvm_mmu_memory_cache { + int nobjs; + gfp_t gfp_zero; + struct kmem_cache *kmem_cache; + void *objects[40]; +}; + +struct hv_partition_assist_pg { + u32 tlb_lock_count; +}; + +union hv_message_flags { + __u8 asu8; + struct { + __u8 msg_pending: 1; + __u8 reserved: 7; + }; +}; + +union hv_port_id { + __u32 asu32; + struct { + __u32 id: 24; + __u32 reserved: 8; + } u; +}; + +struct hv_message_header { + __u32 message_type; + __u8 payload_size; + union hv_message_flags message_flags; + __u8 reserved[2]; + union { + __u64 sender; + union hv_port_id port; + }; +}; + +struct hv_message { + struct hv_message_header header; + union { + __u64 payload[30]; + } u; +}; + +union hv_stimer_config { + u64 as_uint64; + struct { + u64 enable: 1; + u64 periodic: 1; + u64 lazy: 1; + u64 auto_enable: 1; + u64 apic_vector: 8; + u64 direct_mode: 1; + u64 reserved_z0: 3; + u64 sintx: 4; + u64 reserved_z1: 44; + }; +}; + +enum kvm_page_track_mode { + KVM_PAGE_TRACK_WRITE = 0, + KVM_PAGE_TRACK_MAX = 1, +}; + +struct kvm_page_track_notifier_head { + struct srcu_struct track_srcu; + struct hlist_head track_notifier_list; +}; + +struct kvm_vcpu; + +struct kvm; + +struct kvm_page_track_notifier_node { + struct hlist_node node; + void (*track_write)(struct kvm_vcpu *, gpa_t, const u8 *, int, struct kvm_page_track_notifier_node *); + void (*track_flush_slot)(struct kvm *, struct kvm_memory_slot *, struct kvm_page_track_notifier_node *); +}; + +struct kvm_vcpu_stat { + u64 pf_fixed; + u64 pf_guest; + u64 tlb_flush; + u64 invlpg; + u64 exits; + u64 io_exits; + u64 mmio_exits; + u64 signal_exits; + u64 irq_window_exits; + u64 nmi_window_exits; + u64 l1d_flush; + u64 halt_exits; + u64 halt_successful_poll; + u64 halt_attempted_poll; + u64 halt_poll_invalid; + u64 halt_wakeup; + u64 request_irq_exits; + u64 irq_exits; + u64 host_state_reload; + u64 fpu_reload; + u64 insn_emulation; + u64 insn_emulation_fail; + u64 hypercalls; + u64 irq_injections; + u64 nmi_injections; + u64 req_event; + u64 halt_poll_success_ns; + u64 halt_poll_fail_ns; +}; + +struct kvm_mmio_fragment { + gpa_t gpa; + void *data; + unsigned int len; +}; + +struct kvm_lapic; + +struct x86_exception; + +struct kvm_mmu_page; + +union kvm_mmu_page_role { + u32 word; + struct { + unsigned int level: 4; + unsigned int gpte_is_8_bytes: 1; + unsigned int quadrant: 2; + unsigned int direct: 1; + unsigned int access: 3; + unsigned int invalid: 1; + unsigned int nxe: 1; + unsigned int cr0_wp: 1; + unsigned int smep_andnot_wp: 1; + unsigned int smap_andnot_wp: 1; + unsigned int ad_disabled: 1; + unsigned int guest_mode: 1; + char: 6; + unsigned int smm: 8; + }; +}; + +union kvm_mmu_extended_role { + u32 word; + struct { + unsigned int valid: 1; + unsigned int execonly: 1; + unsigned int cr0_pg: 1; + unsigned int cr4_pae: 1; + unsigned int cr4_pse: 1; + unsigned int cr4_pke: 1; + unsigned int cr4_smap: 1; + unsigned int cr4_smep: 1; + unsigned int maxphyaddr: 6; + }; +}; + +union kvm_mmu_role { + u64 as_u64; + struct { + union kvm_mmu_page_role base; + union kvm_mmu_extended_role ext; + }; +}; + +struct kvm_mmu_root_info { + gpa_t pgd; + hpa_t hpa; +}; + +struct rsvd_bits_validate { + u64 rsvd_bits_mask[10]; + u64 bad_mt_xwr; +}; + +struct kvm_mmu { + long unsigned int (*get_guest_pgd)(struct kvm_vcpu *); + u64 (*get_pdptr)(struct kvm_vcpu *, int); + int (*page_fault)(struct kvm_vcpu *, gpa_t, u32, bool); + void (*inject_page_fault)(struct kvm_vcpu *, struct x86_exception *); + gpa_t (*gva_to_gpa)(struct kvm_vcpu *, gpa_t, u32, struct x86_exception *); + gpa_t (*translate_gpa)(struct kvm_vcpu *, gpa_t, u32, struct x86_exception *); + int (*sync_page)(struct kvm_vcpu *, struct kvm_mmu_page *); + void (*invlpg)(struct kvm_vcpu *, gva_t, hpa_t); + void (*update_pte)(struct kvm_vcpu *, struct kvm_mmu_page *, u64 *, const void *); + hpa_t root_hpa; + gpa_t root_pgd; + union kvm_mmu_role mmu_role; + u8 root_level; + u8 shadow_root_level; + u8 ept_ad; + bool direct_map; + struct kvm_mmu_root_info prev_roots[3]; + u8 permissions[16]; + u32 pkru_mask; + u64 *pae_root; + u64 *lm_root; + struct rsvd_bits_validate shadow_zero_check; + struct rsvd_bits_validate guest_rsvd_check; + u8 last_nonleaf_level; + bool nx; + u64 pdptrs[4]; +}; + +struct kvm_pio_request { + long unsigned int linear_rip; + long unsigned int count; + int in; + int port; + int size; +}; + +struct kvm_queued_exception { + bool pending; + bool injected; + bool has_error_code; + u8 nr; + u32 error_code; + long unsigned int payload; + bool has_payload; + u8 nested_apf; +}; + +struct kvm_queued_interrupt { + bool injected; + bool soft; + u8 nr; +}; + +struct x86_emulate_ctxt; + +struct kvm_mtrr_range { + u64 base; + u64 mask; + struct list_head node; +}; + +struct kvm_mtrr { + struct kvm_mtrr_range var_ranges[8]; + mtrr_type fixed_ranges[88]; + u64 deftype; + struct list_head head; +}; + +enum pmc_type { + KVM_PMC_GP = 0, + KVM_PMC_FIXED = 1, +}; + +struct kvm_pmc { + enum pmc_type type; + u8 idx; + u64 counter; + u64 eventsel; + struct perf_event *perf_event; + struct kvm_vcpu *vcpu; + u64 current_config; +}; + +struct kvm_pmu { + unsigned int nr_arch_gp_counters; + unsigned int nr_arch_fixed_counters; + unsigned int available_event_types; + u64 fixed_ctr_ctrl; + u64 global_ctrl; + u64 global_status; + u64 global_ovf_ctrl; + u64 counter_bitmask[2]; + u64 global_ctrl_mask; + u64 global_ovf_ctrl_mask; + u64 reserved_bits; + u8 version; + struct kvm_pmc gp_counters[32]; + struct kvm_pmc fixed_counters[4]; + struct irq_work irq_work; + long unsigned int reprogram_pmi[1]; + long unsigned int all_valid_pmc_idx[1]; + long unsigned int pmc_in_use[1]; + bool need_cleanup; + u8 event_count; +}; + +struct kvm_vcpu_hv_synic { + u64 version; + u64 control; + u64 msg_page; + u64 evt_page; + atomic64_t sint[16]; + atomic_t sint_to_gsi[16]; + long unsigned int auto_eoi_bitmap[4]; + long unsigned int vec_bitmap[4]; + bool active; + bool dont_zero_synic_pages; +}; + +struct kvm_vcpu_hv_stimer { + struct hrtimer timer; + int index; + union hv_stimer_config config; + u64 count; + u64 exp_time; + struct hv_message msg; + bool msg_pending; +}; + +struct kvm_vcpu_hv { + u32 vp_index; + u64 hv_vapic; + s64 runtime_offset; + struct kvm_vcpu_hv_synic synic; + struct kvm_hyperv_exit exit; + struct kvm_vcpu_hv_stimer stimer[4]; + long unsigned int stimer_pending_bitmap[1]; + cpumask_t tlb_flush; +}; + +struct kvm_vcpu_arch { + long unsigned int regs[17]; + u32 regs_avail; + u32 regs_dirty; + long unsigned int cr0; + long unsigned int cr0_guest_owned_bits; + long unsigned int cr2; + long unsigned int cr3; + long unsigned int cr4; + long unsigned int cr4_guest_owned_bits; + long unsigned int cr4_guest_rsvd_bits; + long unsigned int cr8; + u32 host_pkru; + u32 pkru; + u32 hflags; + u64 efer; + u64 apic_base; + struct kvm_lapic *apic; + bool apicv_active; + bool load_eoi_exitmap_pending; + long unsigned int ioapic_handled_vectors[4]; + long unsigned int apic_attention; + int32_t apic_arb_prio; + int mp_state; + u64 ia32_misc_enable_msr; + u64 smbase; + u64 smi_count; + bool tpr_access_reporting; + bool xsaves_enabled; + u64 ia32_xss; + u64 microcode_version; + u64 arch_capabilities; + u64 perf_capabilities; + struct kvm_mmu *mmu; + struct kvm_mmu root_mmu; + struct kvm_mmu guest_mmu; + struct kvm_mmu nested_mmu; + struct kvm_mmu *walk_mmu; + struct kvm_mmu_memory_cache mmu_pte_list_desc_cache; + struct kvm_mmu_memory_cache mmu_shadow_page_cache; + struct kvm_mmu_memory_cache mmu_gfn_array_cache; + struct kvm_mmu_memory_cache mmu_page_header_cache; + struct fpu *user_fpu; + struct fpu *guest_fpu; + u64 xcr0; + u64 guest_supported_xcr0; + struct kvm_pio_request pio; + void *pio_data; + void *guest_ins_data; + u8 event_exit_inst_len; + struct kvm_queued_exception exception; + struct kvm_queued_interrupt interrupt; + int halt_request; + int cpuid_nent; + struct kvm_cpuid_entry2 *cpuid_entries; + long unsigned int cr3_lm_rsvd_bits; + int maxphyaddr; + int max_tdp_level; + struct x86_emulate_ctxt *emulate_ctxt; + bool emulate_regs_need_sync_to_vcpu; + bool emulate_regs_need_sync_from_vcpu; + int (*complete_userspace_io)(struct kvm_vcpu *); + gpa_t time; + struct pvclock_vcpu_time_info hv_clock; + unsigned int hw_tsc_khz; + struct gfn_to_hva_cache pv_time; + bool pv_time_enabled; + bool pvclock_set_guest_stopped_request; + struct { + u8 preempted; + u64 msr_val; + u64 last_steal; + struct gfn_to_pfn_cache cache; + } st; + u64 l1_tsc_offset; + u64 tsc_offset; + u64 last_guest_tsc; + u64 last_host_tsc; + u64 tsc_offset_adjustment; + u64 this_tsc_nsec; + u64 this_tsc_write; + u64 this_tsc_generation; + bool tsc_catchup; + bool tsc_always_catchup; + s8 virtual_tsc_shift; + u32 virtual_tsc_mult; + u32 virtual_tsc_khz; + s64 ia32_tsc_adjust_msr; + u64 msr_ia32_power_ctl; + u64 tsc_scaling_ratio; + atomic_t nmi_queued; + unsigned int nmi_pending; + bool nmi_injected; + bool smi_pending; + struct kvm_mtrr mtrr_state; + u64 pat; + unsigned int switch_db_regs; + long unsigned int db[4]; + long unsigned int dr6; + long unsigned int dr7; + long unsigned int eff_db[4]; + long unsigned int guest_debug_dr7; + u64 msr_platform_info; + u64 msr_misc_features_enables; + u64 mcg_cap; + u64 mcg_status; + u64 mcg_ctl; + u64 mcg_ext_ctl; + u64 *mce_banks; + u64 mmio_gva; + unsigned int mmio_access; + gfn_t mmio_gfn; + u64 mmio_gen; + struct kvm_pmu pmu; + long unsigned int singlestep_rip; + struct kvm_vcpu_hv hyperv; + cpumask_var_t wbinvd_dirty_mask; + long unsigned int last_retry_eip; + long unsigned int last_retry_addr; + struct { + bool halted; + gfn_t gfns[64]; + struct gfn_to_hva_cache data; + u64 msr_en_val; + u64 msr_int_val; + u16 vec; + u32 id; + bool send_user_only; + u32 host_apf_flags; + long unsigned int nested_apf_token; + bool delivery_as_pf_vmexit; + bool pageready_pending; + } apf; + struct { + u64 length; + u64 status; + } osvw; + struct { + u64 msr_val; + struct gfn_to_hva_cache data; + } pv_eoi; + u64 msr_kvm_poll_control; + bool write_fault_to_shadow_pgtable; + long unsigned int exit_qualification; + struct { + bool pv_unhalted; + } pv; + int pending_ioapic_eoi; + int pending_external_vector; + bool preempted_in_kernel; + bool l1tf_flush_l1d; + unsigned int last_vmentry_cpu; + u64 msr_hwcr; + struct { + u32 features; + bool enforce; + } pv_cpuid; + bool guest_state_protected; +}; + +struct kvm_dirty_ring { + u32 dirty_index; + u32 reset_index; + u32 size; + u32 soft_limit; + struct kvm_dirty_gfn *dirty_gfns; + int index; +}; + +struct kvm_vcpu { + struct kvm *kvm; + struct preempt_notifier preempt_notifier; + int cpu; + int vcpu_id; + int vcpu_idx; + int srcu_idx; + int mode; + u64 requests; + long unsigned int guest_debug; + int pre_pcpu; + struct list_head blocked_vcpu_list; + struct mutex mutex; + struct kvm_run *run; + struct rcuwait wait; + struct pid *pid; + int sigset_active; + sigset_t sigset; + struct kvm_vcpu_stat stat; + unsigned int halt_poll_ns; + bool valid_wakeup; + int mmio_needed; + int mmio_read_completed; + int mmio_is_write; + int mmio_cur_fragment; + int mmio_nr_fragments; + struct kvm_mmio_fragment mmio_fragments[2]; + struct { + u32 queued; + struct list_head queue; + struct list_head done; + spinlock_t lock; + } async_pf; + struct { + bool in_spin_loop; + bool dy_eligible; + } spin_loop; + bool preempted; + bool ready; + struct kvm_vcpu_arch arch; + struct kvm_dirty_ring dirty_ring; +}; + +struct kvm_vm_stat { + ulong mmu_shadow_zapped; + ulong mmu_pte_write; + ulong mmu_pte_updated; + ulong mmu_pde_zapped; + ulong mmu_flooded; + ulong mmu_recycled; + ulong mmu_cache_miss; + ulong mmu_unsync; + ulong remote_tlb_flush; + ulong lpages; + ulong nx_lpage_splits; + ulong max_mmu_page_hash_collisions; +}; + +struct kvm_pic; + +struct kvm_ioapic; + +struct kvm_pit; + +struct kvm_hv_syndbg { + struct { + u64 control; + u64 status; + u64 send_page; + u64 recv_page; + u64 pending_page; + } control; + u64 options; +}; + +struct kvm_hv { + struct mutex hv_lock; + u64 hv_guest_os_id; + u64 hv_hypercall; + u64 hv_tsc_page; + u64 hv_crash_param[5]; + u64 hv_crash_ctl; + struct ms_hyperv_tsc_page tsc_ref; + struct idr conn_to_evt; + u64 hv_reenlightenment_control; + u64 hv_tsc_emulation_control; + u64 hv_tsc_emulation_status; + atomic_t num_mismatched_vp_indexes; + struct hv_partition_assist_pg *hv_pa_pg; + struct kvm_hv_syndbg hv_syndbg; +}; + +enum kvm_irqchip_mode { + KVM_IRQCHIP_NONE = 0, + KVM_IRQCHIP_KERNEL = 1, + KVM_IRQCHIP_SPLIT = 2, +}; + +struct kvm_apic_map; + +struct kvm_x86_msr_filter; + +struct kvm_arch { + long unsigned int n_used_mmu_pages; + long unsigned int n_requested_mmu_pages; + long unsigned int n_max_mmu_pages; + unsigned int indirect_shadow_pages; + u8 mmu_valid_gen; + struct hlist_head mmu_page_hash[4096]; + struct list_head active_mmu_pages; + struct list_head zapped_obsolete_pages; + struct list_head lpage_disallowed_mmu_pages; + struct kvm_page_track_notifier_node mmu_sp_tracker; + struct kvm_page_track_notifier_head track_notifier_head; + struct list_head assigned_dev_head; + struct iommu_domain *iommu_domain; + bool iommu_noncoherent; + atomic_t noncoherent_dma_count; + atomic_t assigned_device_count; + struct kvm_pic *vpic; + struct kvm_ioapic *vioapic; + struct kvm_pit *vpit; + atomic_t vapics_in_nmi_mode; + struct mutex apic_map_lock; + struct kvm_apic_map *apic_map; + atomic_t apic_map_dirty; + bool apic_access_page_done; + long unsigned int apicv_inhibit_reasons; + gpa_t wall_clock; + bool mwait_in_guest; + bool hlt_in_guest; + bool pause_in_guest; + bool cstate_in_guest; + long unsigned int irq_sources_bitmap; + s64 kvmclock_offset; + raw_spinlock_t tsc_write_lock; + u64 last_tsc_nsec; + u64 last_tsc_write; + u32 last_tsc_khz; + u64 cur_tsc_nsec; + u64 cur_tsc_write; + u64 cur_tsc_offset; + u64 cur_tsc_generation; + int nr_vcpus_matched_tsc; + spinlock_t pvclock_gtod_sync_lock; + bool use_master_clock; + u64 master_kernel_ns; + u64 master_cycle_now; + struct delayed_work kvmclock_update_work; + struct delayed_work kvmclock_sync_work; + struct kvm_xen_hvm_config xen_hvm_config; + struct hlist_head mask_notifier_list; + struct kvm_hv hyperv; + int audit_point; + bool backwards_tsc_observed; + bool boot_vcpu_runs_old_kvmclock; + u32 bsp_vcpu_id; + u64 disabled_quirks; + enum kvm_irqchip_mode irqchip_mode; + u8 nr_reserved_ioapic_pins; + bool disabled_lapic_found; + bool x2apic_format; + bool x2apic_broadcast_quirk_disabled; + bool guest_can_read_msr_platform_info; + bool exception_payload_enabled; + bool bus_lock_detection_enabled; + u32 user_space_msr_mask; + struct kvm_x86_msr_filter *msr_filter; + struct kvm_pmu_event_filter *pmu_event_filter; + struct task_struct *nx_lpage_recovery_thread; + bool tdp_mmu_enabled; + struct list_head tdp_mmu_roots; + struct list_head tdp_mmu_pages; +}; + +struct kvm_memslots; + +struct kvm_io_bus; + +struct kvm_irq_routing_table; + +struct kvm_stat_data; + +struct kvm { + spinlock_t mmu_lock; + struct mutex slots_lock; + struct mm_struct *mm; + struct kvm_memslots *memslots[2]; + struct kvm_vcpu *vcpus[288]; + atomic_t online_vcpus; + int created_vcpus; + int last_boosted_vcpu; + struct list_head vm_list; + struct mutex lock; + struct kvm_io_bus *buses[4]; + struct { + spinlock_t lock; + struct list_head items; + struct list_head resampler_list; + struct mutex resampler_lock; + } irqfds; + struct list_head ioeventfds; + struct kvm_vm_stat stat; + struct kvm_arch arch; + refcount_t users_count; + struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; + spinlock_t ring_lock; + struct list_head coalesced_zones; + struct mutex irq_lock; + struct kvm_irq_routing_table *irq_routing; + struct hlist_head irq_ack_notifier_list; + struct mmu_notifier mmu_notifier; + long unsigned int mmu_notifier_seq; + long int mmu_notifier_count; + long int tlbs_dirty; + struct list_head devices; + u64 manual_dirty_log_protect; + struct dentry *debugfs_dentry; + struct kvm_stat_data **debugfs_stat_data; + struct srcu_struct srcu; + struct srcu_struct irq_srcu; + pid_t userspace_pid; + unsigned int max_halt_poll_ns; + u32 dirty_ring_size; +}; + +enum kvm_reg { + VCPU_REGS_RAX = 0, + VCPU_REGS_RCX = 1, + VCPU_REGS_RDX = 2, + VCPU_REGS_RBX = 3, + VCPU_REGS_RSP = 4, + VCPU_REGS_RBP = 5, + VCPU_REGS_RSI = 6, + VCPU_REGS_RDI = 7, + VCPU_REGS_R8 = 8, + VCPU_REGS_R9 = 9, + VCPU_REGS_R10 = 10, + VCPU_REGS_R11 = 11, + VCPU_REGS_R12 = 12, + VCPU_REGS_R13 = 13, + VCPU_REGS_R14 = 14, + VCPU_REGS_R15 = 15, + VCPU_REGS_RIP = 16, + NR_VCPU_REGS = 17, + VCPU_EXREG_PDPTR = 17, + VCPU_EXREG_CR0 = 18, + VCPU_EXREG_CR3 = 19, + VCPU_EXREG_CR4 = 20, + VCPU_EXREG_RFLAGS = 21, + VCPU_EXREG_SEGMENTS = 22, + VCPU_EXREG_EXIT_INFO_1 = 23, + VCPU_EXREG_EXIT_INFO_2 = 24, +}; + +struct kvm_rmap_head { + long unsigned int val; +}; + +struct kvm_lpage_info { + int disallow_lpage; +}; + +struct kvm_apic_map { + struct callback_head rcu; + u8 mode; + u32 max_apic_id; + union { + struct kvm_lapic *xapic_flat_map[8]; + struct kvm_lapic *xapic_cluster_map[64]; + }; + struct kvm_lapic *phys_map[0]; +}; + +struct msr_bitmap_range { + u32 flags; + u32 nmsrs; + u32 base; + long unsigned int *bitmap; +}; + +struct kvm_x86_msr_filter { + u8 count; + bool default_allow: 1; + struct msr_bitmap_range ranges[16]; +}; + +struct kvm_io_device; + +struct kvm_io_range { + gpa_t addr; + int len; + struct kvm_io_device *dev; +}; + +struct kvm_io_bus { + int dev_count; + int ioeventfd_count; + struct kvm_io_range range[0]; +}; + +enum kvm_bus { + KVM_MMIO_BUS = 0, + KVM_PIO_BUS = 1, + KVM_VIRTIO_CCW_NOTIFY_BUS = 2, + KVM_FAST_MMIO_BUS = 3, + KVM_NR_BUSES = 4, +}; + +struct kvm_irq_routing_table { + int chip[72]; + u32 nr_rt_entries; + struct hlist_head map[0]; +}; + +struct kvm_memslots { + u64 generation; + short int id_to_index[512]; + atomic_t lru_slot; + int used_slots; + struct kvm_memory_slot memslots[0]; +}; + +struct kvm_stats_debugfs_item; + +struct kvm_stat_data { + struct kvm *kvm; + struct kvm_stats_debugfs_item *dbgfs_item; +}; + +enum kvm_stat_kind { + KVM_STAT_VM = 0, + KVM_STAT_VCPU = 1, +}; + +struct kvm_stats_debugfs_item { + const char *name; + int offset; + enum kvm_stat_kind kind; + int mode; +}; + +enum kcmp_type { + KCMP_FILE = 0, + KCMP_VM = 1, + KCMP_FILES = 2, + KCMP_FS = 3, + KCMP_SIGHAND = 4, + KCMP_IO = 5, + KCMP_SYSVSEM = 6, + KCMP_EPOLL_TFD = 7, + KCMP_TYPES = 8, +}; + +struct kcmp_epoll_slot { + __u32 efd; + __u32 tfd; + __u32 toff; +}; + +enum profile_type { + PROFILE_TASK_EXIT = 0, + PROFILE_MUNMAP = 1, +}; + +struct profile_hit { + u32 pc; + u32 hits; +}; + +struct stacktrace_cookie { + long unsigned int *store; + unsigned int size; + unsigned int skip; + unsigned int len; +}; + +typedef __kernel_long_t __kernel_suseconds_t; + +typedef __kernel_long_t __kernel_old_time_t; + +typedef __kernel_suseconds_t suseconds_t; + +struct __kernel_itimerspec { + struct __kernel_timespec it_interval; + struct __kernel_timespec it_value; +}; + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +struct itimerspec64 { + struct timespec64 it_interval; + struct timespec64 it_value; +}; + +struct old_itimerspec32 { + struct old_timespec32 it_interval; + struct old_timespec32 it_value; +}; + +struct old_timex32 { + u32 modes; + s32 offset; + s32 freq; + s32 maxerror; + s32 esterror; + s32 status; + s32 constant; + s32 precision; + s32 tolerance; + struct old_timeval32 time; + s32 tick; + s32 ppsfreq; + s32 jitter; + s32 shift; + s32 stabil; + s32 jitcnt; + s32 calcnt; + s32 errcnt; + s32 stbcnt; + s32 tai; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct __kernel_timex_timeval { + __kernel_time64_t tv_sec; + long long int tv_usec; +}; + +struct __kernel_timex { + unsigned int modes; + long long int offset; + long long int freq; + long long int maxerror; + long long int esterror; + int status; + long long int constant; + long long int precision; + long long int tolerance; + struct __kernel_timex_timeval time; + long long int tick; + long long int ppsfreq; + long long int jitter; + int shift; + long long int stabil; + long long int jitcnt; + long long int calcnt; + long long int errcnt; + long long int stbcnt; + int tai; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct trace_event_raw_timer_class { + struct trace_entry ent; + void *timer; + char __data[0]; +}; + +struct trace_event_raw_timer_start { + struct trace_entry ent; + void *timer; + void *function; + long unsigned int expires; + long unsigned int now; + unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_timer_expire_entry { + struct trace_entry ent; + void *timer; + long unsigned int now; + void *function; + long unsigned int baseclk; + char __data[0]; +}; + +struct trace_event_raw_hrtimer_init { + struct trace_entry ent; + void *hrtimer; + clockid_t clockid; + enum hrtimer_mode mode; + char __data[0]; +}; + +struct trace_event_raw_hrtimer_start { + struct trace_entry ent; + void *hrtimer; + void *function; + s64 expires; + s64 softexpires; + enum hrtimer_mode mode; + char __data[0]; +}; + +struct trace_event_raw_hrtimer_expire_entry { + struct trace_entry ent; + void *hrtimer; + s64 now; + void *function; + char __data[0]; +}; + +struct trace_event_raw_hrtimer_class { + struct trace_entry ent; + void *hrtimer; + char __data[0]; +}; + +struct trace_event_raw_itimer_state { + struct trace_entry ent; + int which; + long long unsigned int expires; + long int value_sec; + long int value_nsec; + long int interval_sec; + long int interval_nsec; + char __data[0]; +}; + +struct trace_event_raw_itimer_expire { + struct trace_entry ent; + int which; + pid_t pid; + long long unsigned int now; + char __data[0]; +}; + +struct trace_event_raw_tick_stop { + struct trace_entry ent; + int success; + int dependency; + char __data[0]; +}; + +struct trace_event_data_offsets_timer_class {}; + +struct trace_event_data_offsets_timer_start {}; + +struct trace_event_data_offsets_timer_expire_entry {}; + +struct trace_event_data_offsets_hrtimer_init {}; + +struct trace_event_data_offsets_hrtimer_start {}; + +struct trace_event_data_offsets_hrtimer_expire_entry {}; + +struct trace_event_data_offsets_hrtimer_class {}; + +struct trace_event_data_offsets_itimer_state {}; + +struct trace_event_data_offsets_itimer_expire {}; + +struct trace_event_data_offsets_tick_stop {}; + +typedef void (*btf_trace_timer_init)(void *, struct timer_list *); + +typedef void (*btf_trace_timer_start)(void *, struct timer_list *, long unsigned int, unsigned int); + +typedef void (*btf_trace_timer_expire_entry)(void *, struct timer_list *, long unsigned int); + +typedef void (*btf_trace_timer_expire_exit)(void *, struct timer_list *); + +typedef void (*btf_trace_timer_cancel)(void *, struct timer_list *); + +typedef void (*btf_trace_hrtimer_init)(void *, struct hrtimer *, clockid_t, enum hrtimer_mode); + +typedef void (*btf_trace_hrtimer_start)(void *, struct hrtimer *, enum hrtimer_mode); + +typedef void (*btf_trace_hrtimer_expire_entry)(void *, struct hrtimer *, ktime_t *); + +typedef void (*btf_trace_hrtimer_expire_exit)(void *, struct hrtimer *); + +typedef void (*btf_trace_hrtimer_cancel)(void *, struct hrtimer *); + +typedef void (*btf_trace_itimer_state)(void *, int, const struct itimerspec64 * const, long long unsigned int); + +typedef void (*btf_trace_itimer_expire)(void *, int, struct pid *, long long unsigned int); + +typedef void (*btf_trace_tick_stop)(void *, int, int); + +struct timer_base { + raw_spinlock_t lock; + struct timer_list *running_timer; + long unsigned int clk; + long unsigned int next_expiry; + unsigned int cpu; + bool next_expiry_recalc; + bool is_idle; + long unsigned int pending_map[9]; + struct hlist_head vectors[576]; + long: 64; + long: 64; +}; + +struct process_timer { + struct timer_list timer; + struct task_struct *task; +}; + +enum tick_device_mode { + TICKDEV_MODE_PERIODIC = 0, + TICKDEV_MODE_ONESHOT = 1, +}; + +struct tick_device { + struct clock_event_device *evtdev; + enum tick_device_mode mode; +}; + +struct ktime_timestamps { + u64 mono; + u64 boot; + u64 real; +}; + +struct system_time_snapshot { + u64 cycles; + ktime_t real; + ktime_t raw; + unsigned int clock_was_set_seq; + u8 cs_was_changed_seq; +}; + +struct system_device_crosststamp { + ktime_t device; + ktime_t sys_realtime; + ktime_t sys_monoraw; +}; + +struct audit_ntp_val { + long long int oldval; + long long int newval; +}; + +struct audit_ntp_data { + struct audit_ntp_val vals[6]; +}; + +enum timekeeping_adv_mode { + TK_ADV_TICK = 0, + TK_ADV_FREQ = 1, +}; + +struct tk_fast { + seqcount_latch_t seq; + struct tk_read_base base[2]; +}; + +typedef s64 int64_t; + +enum tick_nohz_mode { + NOHZ_MODE_INACTIVE = 0, + NOHZ_MODE_LOWRES = 1, + NOHZ_MODE_HIGHRES = 2, +}; + +struct tick_sched { + struct hrtimer sched_timer; + long unsigned int check_clocks; + enum tick_nohz_mode nohz_mode; + unsigned int inidle: 1; + unsigned int tick_stopped: 1; + unsigned int idle_active: 1; + unsigned int do_timer_last: 1; + unsigned int got_idle_tick: 1; + ktime_t last_tick; + ktime_t next_tick; + long unsigned int idle_jiffies; + long unsigned int idle_calls; + long unsigned int idle_sleeps; + ktime_t idle_entrytime; + ktime_t idle_waketime; + ktime_t idle_exittime; + ktime_t idle_sleeptime; + ktime_t iowait_sleeptime; + long unsigned int last_jiffies; + u64 timer_expires; + u64 timer_expires_base; + u64 next_timer; + ktime_t idle_expires; + atomic_t tick_dep_mask; +}; + +struct timer_list_iter { + int cpu; + bool second_pass; + u64 now; +}; + +struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + long int tm_year; + int tm_wday; + int tm_yday; +}; + +struct cyclecounter { + u64 (*read)(const struct cyclecounter *); + u64 mask; + u32 mult; + u32 shift; +}; + +struct timecounter { + const struct cyclecounter *cc; + u64 cycle_last; + u64 nsec; + u64 mask; + u64 frac; +}; + +typedef __kernel_timer_t timer_t; + +enum alarmtimer_type { + ALARM_REALTIME = 0, + ALARM_BOOTTIME = 1, + ALARM_NUMTYPE = 2, + ALARM_REALTIME_FREEZER = 3, + ALARM_BOOTTIME_FREEZER = 4, +}; + +enum alarmtimer_restart { + ALARMTIMER_NORESTART = 0, + ALARMTIMER_RESTART = 1, +}; + +struct alarm { + struct timerqueue_node node; + struct hrtimer timer; + enum alarmtimer_restart (*function)(struct alarm *, ktime_t); + enum alarmtimer_type type; + int state; + void *data; +}; + +struct cpu_timer { + struct timerqueue_node node; + struct timerqueue_head *head; + struct pid *pid; + struct list_head elist; + int firing; +}; + +struct k_clock; + +struct k_itimer { + struct list_head list; + struct hlist_node t_hash; + spinlock_t it_lock; + const struct k_clock *kclock; + clockid_t it_clock; + timer_t it_id; + int it_active; + s64 it_overrun; + s64 it_overrun_last; + int it_requeue_pending; + int it_sigev_notify; + ktime_t it_interval; + struct signal_struct *it_signal; + union { + struct pid *it_pid; + struct task_struct *it_process; + }; + struct sigqueue *sigq; + union { + struct { + struct hrtimer timer; + } real; + struct cpu_timer cpu; + struct { + struct alarm alarmtimer; + } alarm; + } it; + struct callback_head rcu; +}; + +struct k_clock { + int (*clock_getres)(const clockid_t, struct timespec64 *); + int (*clock_set)(const clockid_t, const struct timespec64 *); + int (*clock_get_timespec)(const clockid_t, struct timespec64 *); + ktime_t (*clock_get_ktime)(const clockid_t); + int (*clock_adj)(const clockid_t, struct __kernel_timex *); + int (*timer_create)(struct k_itimer *); + int (*nsleep)(const clockid_t, int, const struct timespec64 *); + int (*timer_set)(struct k_itimer *, int, struct itimerspec64 *, struct itimerspec64 *); + int (*timer_del)(struct k_itimer *); + void (*timer_get)(struct k_itimer *, struct itimerspec64 *); + void (*timer_rearm)(struct k_itimer *); + s64 (*timer_forward)(struct k_itimer *, ktime_t); + ktime_t (*timer_remaining)(struct k_itimer *, ktime_t); + int (*timer_try_to_cancel)(struct k_itimer *); + void (*timer_arm)(struct k_itimer *, ktime_t, bool, bool); + void (*timer_wait_running)(struct k_itimer *); +}; + +struct class_interface { + struct list_head node; + struct class *class; + int (*add_dev)(struct device *, struct class_interface *); + void (*remove_dev)(struct device *, struct class_interface *); +}; + +struct platform_driver { + int (*probe)(struct platform_device *); + int (*remove)(struct platform_device *); + void (*shutdown)(struct platform_device *); + int (*suspend)(struct platform_device *, pm_message_t); + int (*resume)(struct platform_device *); + struct device_driver driver; + const struct platform_device_id *id_table; + bool prevent_deferred_probe; +}; + +struct trace_event_raw_alarmtimer_suspend { + struct trace_entry ent; + s64 expires; + unsigned char alarm_type; + char __data[0]; +}; + +struct trace_event_raw_alarm_class { + struct trace_entry ent; + void *alarm; + unsigned char alarm_type; + s64 expires; + s64 now; + char __data[0]; +}; + +struct trace_event_data_offsets_alarmtimer_suspend {}; + +struct trace_event_data_offsets_alarm_class {}; + +typedef void (*btf_trace_alarmtimer_suspend)(void *, ktime_t, int); + +typedef void (*btf_trace_alarmtimer_fired)(void *, struct alarm *, ktime_t); + +typedef void (*btf_trace_alarmtimer_start)(void *, struct alarm *, ktime_t); + +typedef void (*btf_trace_alarmtimer_cancel)(void *, struct alarm *, ktime_t); + +struct alarm_base { + spinlock_t lock; + struct timerqueue_head timerqueue; + ktime_t (*get_ktime)(); + void (*get_timespec)(struct timespec64 *); + clockid_t base_clockid; +}; + +struct sigevent { + sigval_t sigev_value; + int sigev_signo; + int sigev_notify; + union { + int _pad[12]; + int _tid; + struct { + void (*_function)(sigval_t); + void *_attribute; + } _sigev_thread; + } _sigev_un; +}; + +typedef struct sigevent sigevent_t; + +struct compat_sigevent { + compat_sigval_t sigev_value; + compat_int_t sigev_signo; + compat_int_t sigev_notify; + union { + compat_int_t _pad[13]; + compat_int_t _tid; + struct { + compat_uptr_t _function; + compat_uptr_t _attribute; + } _sigev_thread; + } _sigev_un; +}; + +struct posix_clock; + +struct posix_clock_operations { + struct module *owner; + int (*clock_adjtime)(struct posix_clock *, struct __kernel_timex *); + int (*clock_gettime)(struct posix_clock *, struct timespec64 *); + int (*clock_getres)(struct posix_clock *, struct timespec64 *); + int (*clock_settime)(struct posix_clock *, const struct timespec64 *); + long int (*ioctl)(struct posix_clock *, unsigned int, long unsigned int); + int (*open)(struct posix_clock *, fmode_t); + __poll_t (*poll)(struct posix_clock *, struct file *, poll_table *); + int (*release)(struct posix_clock *); + ssize_t (*read)(struct posix_clock *, uint, char *, size_t); +}; + +struct posix_clock { + struct posix_clock_operations ops; + struct cdev cdev; + struct device *dev; + struct rw_semaphore rwsem; + bool zombie; +}; + +struct posix_clock_desc { + struct file *fp; + struct posix_clock *clk; +}; + +struct __kernel_old_itimerval { + struct __kernel_old_timeval it_interval; + struct __kernel_old_timeval it_value; +}; + +struct old_itimerval32 { + struct old_timeval32 it_interval; + struct old_timeval32 it_value; +}; + +struct ce_unbind { + struct clock_event_device *ce; + int res; +}; + +struct proc_timens_offset { + int clockid; + struct timespec64 val; +}; + +union futex_key { + struct { + u64 i_seq; + long unsigned int pgoff; + unsigned int offset; + } shared; + struct { + union { + struct mm_struct *mm; + u64 __tmp; + }; + long unsigned int address; + unsigned int offset; + } private; + struct { + u64 ptr; + long unsigned int word; + unsigned int offset; + } both; +}; + +struct futex_pi_state { + struct list_head list; + struct rt_mutex pi_mutex; + struct task_struct *owner; + refcount_t refcount; + union futex_key key; +}; + +struct futex_q { + struct plist_node list; + struct task_struct *task; + spinlock_t *lock_ptr; + union futex_key key; + struct futex_pi_state *pi_state; + struct rt_mutex_waiter *rt_waiter; + union futex_key *requeue_pi_key; + u32 bitset; +}; + +struct futex_hash_bucket { + atomic_t waiters; + spinlock_t lock; + struct plist_head chain; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum futex_access { + FUTEX_READ = 0, + FUTEX_WRITE = 1, +}; + +struct dma_chan { + int lock; + const char *device_id; +}; + +struct call_function_data { + call_single_data_t *csd; + cpumask_var_t cpumask; + cpumask_var_t cpumask_ipi; +}; + +struct smp_call_on_cpu_struct { + struct work_struct work; + struct completion done; + int (*func)(void *); + void *data; + int ret; + int cpu; +}; + +struct latch_tree_root { + seqcount_latch_t seq; + struct rb_root tree[2]; +}; + +struct latch_tree_ops { + bool (*less)(struct latch_tree_node *, struct latch_tree_node *); + int (*comp)(void *, struct latch_tree_node *); +}; + +struct module_use { + struct list_head source_list; + struct list_head target_list; + struct module *source; + struct module *target; +}; + +struct module_sect_attr { + struct bin_attribute battr; + long unsigned int address; +}; + +struct module_sect_attrs { + struct attribute_group grp; + unsigned int nsections; + struct module_sect_attr attrs[0]; +}; + +struct module_notes_attrs { + struct kobject *dir; + unsigned int notes; + struct bin_attribute attrs[0]; +}; + +enum mod_license { + NOT_GPL_ONLY = 0, + GPL_ONLY = 1, + WILL_BE_GPL_ONLY = 2, +}; + +struct symsearch { + const struct kernel_symbol *start; + const struct kernel_symbol *stop; + const s32 *crcs; + enum mod_license license; + bool unused; +}; + +enum kernel_read_file_id { + READING_UNKNOWN = 0, + READING_FIRMWARE = 1, + READING_MODULE = 2, + READING_KEXEC_IMAGE = 3, + READING_KEXEC_INITRAMFS = 4, + READING_POLICY = 5, + READING_X509_CERTIFICATE = 6, + READING_MAX_ID = 7, +}; + +enum kernel_load_data_id { + LOADING_UNKNOWN = 0, + LOADING_FIRMWARE = 1, + LOADING_MODULE = 2, + LOADING_KEXEC_IMAGE = 3, + LOADING_KEXEC_INITRAMFS = 4, + LOADING_POLICY = 5, + LOADING_X509_CERTIFICATE = 6, + LOADING_MAX_ID = 7, +}; + +enum { + PROC_ENTRY_PERMANENT = 1, +}; + +struct load_info { + const char *name; + struct module *mod; + Elf64_Ehdr *hdr; + long unsigned int len; + Elf64_Shdr *sechdrs; + char *secstrings; + char *strtab; + long unsigned int symoffs; + long unsigned int stroffs; + long unsigned int init_typeoffs; + long unsigned int core_typeoffs; + struct _ddebug *debug; + unsigned int num_debug; + bool sig_ok; + long unsigned int mod_kallsyms_init_off; + struct { + unsigned int sym; + unsigned int str; + unsigned int mod; + unsigned int vers; + unsigned int info; + unsigned int pcpu; + } index; +}; + +struct trace_event_raw_module_load { + struct trace_entry ent; + unsigned int taints; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_module_free { + struct trace_entry ent; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_module_refcnt { + struct trace_entry ent; + long unsigned int ip; + int refcnt; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_module_request { + struct trace_entry ent; + long unsigned int ip; + bool wait; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_data_offsets_module_load { + u32 name; +}; + +struct trace_event_data_offsets_module_free { + u32 name; +}; + +struct trace_event_data_offsets_module_refcnt { + u32 name; +}; + +struct trace_event_data_offsets_module_request { + u32 name; +}; + +typedef void (*btf_trace_module_load)(void *, struct module *); + +typedef void (*btf_trace_module_free)(void *, struct module *); + +typedef void (*btf_trace_module_get)(void *, struct module *, long unsigned int); + +typedef void (*btf_trace_module_put)(void *, struct module *, long unsigned int); + +typedef void (*btf_trace_module_request)(void *, char *, bool, long unsigned int); + +struct mod_tree_root { + struct latch_tree_root root; + long unsigned int addr_min; + long unsigned int addr_max; +}; + +struct find_symbol_arg { + const char *name; + bool gplok; + bool warn; + struct module *owner; + const s32 *crc; + const struct kernel_symbol *sym; + enum mod_license license; +}; + +struct mod_initfree { + struct llist_node node; + void *module_init; +}; + +struct module_signature { + u8 algo; + u8 hash; + u8 id_type; + u8 signer_len; + u8 key_id_len; + u8 __pad[3]; + __be32 sig_len; +}; + +enum pkey_id_type { + PKEY_ID_PGP = 0, + PKEY_ID_X509 = 1, + PKEY_ID_PKCS7 = 2, +}; + +struct kallsym_iter { + loff_t pos; + loff_t pos_arch_end; + loff_t pos_mod_end; + loff_t pos_ftrace_mod_end; + loff_t pos_bpf_end; + long unsigned int value; + unsigned int nameoff; + char type; + char name[128]; + char module_name[56]; + int exported; + int show_value; +}; + +typedef __u16 comp_t; + +struct acct_v3 { + char ac_flag; + char ac_version; + __u16 ac_tty; + __u32 ac_exitcode; + __u32 ac_uid; + __u32 ac_gid; + __u32 ac_pid; + __u32 ac_ppid; + __u32 ac_btime; + __u32 ac_etime; + comp_t ac_utime; + comp_t ac_stime; + comp_t ac_mem; + comp_t ac_io; + comp_t ac_rw; + comp_t ac_minflt; + comp_t ac_majflt; + comp_t ac_swaps; + char ac_comm[16]; +}; + +typedef struct acct_v3 acct_t; + +struct fs_pin { + wait_queue_head_t wait; + int done; + struct hlist_node s_list; + struct hlist_node m_list; + void (*kill)(struct fs_pin *); +}; + +struct bsd_acct_struct { + struct fs_pin pin; + atomic_long_t count; + struct callback_head rcu; + struct mutex lock; + int active; + long unsigned int needcheck; + struct file *file; + struct pid_namespace *ns; + struct work_struct work; + struct completion done; +}; + +struct elf64_note { + Elf64_Word n_namesz; + Elf64_Word n_descsz; + Elf64_Word n_type; +}; + +struct elf_note_section { + struct elf64_note n_hdr; + u8 n_data[0]; +}; + +typedef long unsigned int elf_greg_t; + +typedef elf_greg_t elf_gregset_t[27]; + +struct elf_siginfo { + int si_signo; + int si_code; + int si_errno; +}; + +struct elf_prstatus { + struct elf_siginfo pr_info; + short int pr_cursig; + long unsigned int pr_sigpend; + long unsigned int pr_sighold; + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + struct __kernel_old_timeval pr_utime; + struct __kernel_old_timeval pr_stime; + struct __kernel_old_timeval pr_cutime; + struct __kernel_old_timeval pr_cstime; + elf_gregset_t pr_reg; + int pr_fpvalid; +}; + +typedef u32 note_buf_t[92]; + +struct compat_kexec_segment { + compat_uptr_t buf; + compat_size_t bufsz; + compat_ulong_t mem; + compat_size_t memsz; +}; + +struct elf64_phdr { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +}; + +typedef struct elf64_phdr Elf64_Phdr; + +struct shash_alg { + int (*init)(struct shash_desc *); + int (*update)(struct shash_desc *, const u8 *, unsigned int); + int (*final)(struct shash_desc *, u8 *); + int (*finup)(struct shash_desc *, const u8 *, unsigned int, u8 *); + int (*digest)(struct shash_desc *, const u8 *, unsigned int, u8 *); + int (*export)(struct shash_desc *, void *); + int (*import)(struct shash_desc *, const void *); + int (*setkey)(struct crypto_shash *, const u8 *, unsigned int); + int (*init_tfm)(struct crypto_shash *); + void (*exit_tfm)(struct crypto_shash *); + unsigned int descsize; + int: 32; + unsigned int digestsize; + unsigned int statesize; + struct crypto_alg base; +}; + +struct kexec_sha_region { + long unsigned int start; + long unsigned int len; +}; + +enum migrate_reason { + MR_COMPACTION = 0, + MR_MEMORY_FAILURE = 1, + MR_MEMORY_HOTPLUG = 2, + MR_SYSCALL = 3, + MR_MEMPOLICY_MBIND = 4, + MR_NUMA_MISPLACED = 5, + MR_CONTIG_RANGE = 6, + MR_TYPES = 7, +}; + +typedef __kernel_ulong_t __kernel_ino_t; + +typedef __kernel_ino_t ino_t; + +enum bpf_link_type { + BPF_LINK_TYPE_UNSPEC = 0, + BPF_LINK_TYPE_RAW_TRACEPOINT = 1, + BPF_LINK_TYPE_TRACING = 2, + BPF_LINK_TYPE_CGROUP = 3, + BPF_LINK_TYPE_ITER = 4, + BPF_LINK_TYPE_NETNS = 5, + BPF_LINK_TYPE_XDP = 6, + MAX_BPF_LINK_TYPE = 7, +}; + +struct bpf_link_info { + __u32 type; + __u32 id; + __u32 prog_id; + union { + struct { + __u64 tp_name; + __u32 tp_name_len; + } raw_tracepoint; + struct { + __u32 attach_type; + } tracing; + struct { + __u64 cgroup_id; + __u32 attach_type; + } cgroup; + struct { + __u64 target_name; + __u32 target_name_len; + union { + struct { + __u32 map_id; + } map; + }; + } iter; + struct { + __u32 netns_ino; + __u32 attach_type; + } netns; + struct { + __u32 ifindex; + } xdp; + }; +}; + +struct bpf_link_ops; + +struct bpf_link { + atomic64_t refcnt; + u32 id; + enum bpf_link_type type; + const struct bpf_link_ops *ops; + struct bpf_prog *prog; + struct work_struct work; +}; + +struct bpf_link_ops { + void (*release)(struct bpf_link *); + void (*dealloc)(struct bpf_link *); + int (*detach)(struct bpf_link *); + int (*update_prog)(struct bpf_link *, struct bpf_prog *, struct bpf_prog *); + void (*show_fdinfo)(const struct bpf_link *, struct seq_file *); + int (*fill_link_info)(const struct bpf_link *, struct bpf_link_info *); +}; + +struct bpf_cgroup_link { + struct bpf_link link; + struct cgroup *cgroup; + enum bpf_attach_type type; +}; + +enum { + CGRP_NOTIFY_ON_RELEASE = 0, + CGRP_CPUSET_CLONE_CHILDREN = 1, + CGRP_FREEZE = 2, + CGRP_FROZEN = 3, +}; + +enum { + CGRP_ROOT_NOPREFIX = 2, + CGRP_ROOT_XATTR = 4, + CGRP_ROOT_NS_DELEGATE = 8, + CGRP_ROOT_CPUSET_V2_MODE = 16, + CGRP_ROOT_MEMORY_LOCAL_EVENTS = 32, + CGRP_ROOT_MEMORY_RECURSIVE_PROT = 64, +}; + +struct cgroup_taskset { + struct list_head src_csets; + struct list_head dst_csets; + int nr_tasks; + int ssid; + struct list_head *csets; + struct css_set *cur_cset; + struct task_struct *cur_task; +}; + +struct css_task_iter { + struct cgroup_subsys *ss; + unsigned int flags; + struct list_head *cset_pos; + struct list_head *cset_head; + struct list_head *tcset_pos; + struct list_head *tcset_head; + struct list_head *task_pos; + struct list_head *cur_tasks_head; + struct css_set *cur_cset; + struct css_set *cur_dcset; + struct task_struct *cur_task; + struct list_head iters_node; +}; + +struct cgroup_fs_context { + struct kernfs_fs_context kfc; + struct cgroup_root *root; + struct cgroup_namespace *ns; + unsigned int flags; + bool cpuset_clone_children; + bool none; + bool all_ss; + u16 subsys_mask; + char *name; + char *release_agent; +}; + +struct cgrp_cset_link { + struct cgroup *cgrp; + struct css_set *cset; + struct list_head cset_link; + struct list_head cgrp_link; +}; + +struct cgroup_mgctx { + struct list_head preloaded_src_csets; + struct list_head preloaded_dst_csets; + struct cgroup_taskset tset; + u16 ss_mask; +}; + +struct trace_event_raw_cgroup_root { + struct trace_entry ent; + int root; + u16 ss_mask; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_cgroup { + struct trace_entry ent; + int root; + int id; + int level; + u32 __data_loc_path; + char __data[0]; +}; + +struct trace_event_raw_cgroup_migrate { + struct trace_entry ent; + int dst_root; + int dst_id; + int dst_level; + int pid; + u32 __data_loc_dst_path; + u32 __data_loc_comm; + char __data[0]; +}; + +struct trace_event_raw_cgroup_event { + struct trace_entry ent; + int root; + int id; + int level; + u32 __data_loc_path; + int val; + char __data[0]; +}; + +struct trace_event_data_offsets_cgroup_root { + u32 name; +}; + +struct trace_event_data_offsets_cgroup { + u32 path; +}; + +struct trace_event_data_offsets_cgroup_migrate { + u32 dst_path; + u32 comm; +}; + +struct trace_event_data_offsets_cgroup_event { + u32 path; +}; + +typedef void (*btf_trace_cgroup_setup_root)(void *, struct cgroup_root *); + +typedef void (*btf_trace_cgroup_destroy_root)(void *, struct cgroup_root *); + +typedef void (*btf_trace_cgroup_remount)(void *, struct cgroup_root *); + +typedef void (*btf_trace_cgroup_mkdir)(void *, struct cgroup *, const char *); + +typedef void (*btf_trace_cgroup_rmdir)(void *, struct cgroup *, const char *); + +typedef void (*btf_trace_cgroup_release)(void *, struct cgroup *, const char *); + +typedef void (*btf_trace_cgroup_rename)(void *, struct cgroup *, const char *); + +typedef void (*btf_trace_cgroup_freeze)(void *, struct cgroup *, const char *); + +typedef void (*btf_trace_cgroup_unfreeze)(void *, struct cgroup *, const char *); + +typedef void (*btf_trace_cgroup_attach_task)(void *, struct cgroup *, const char *, struct task_struct *, bool); + +typedef void (*btf_trace_cgroup_transfer_tasks)(void *, struct cgroup *, const char *, struct task_struct *, bool); + +typedef void (*btf_trace_cgroup_notify_populated)(void *, struct cgroup *, const char *, int); + +typedef void (*btf_trace_cgroup_notify_frozen)(void *, struct cgroup *, const char *, int); + +enum cgroup2_param { + Opt_nsdelegate = 0, + Opt_memory_localevents = 1, + Opt_memory_recursiveprot = 2, + nr__cgroup2_params = 3, +}; + +struct cgroupstats { + __u64 nr_sleeping; + __u64 nr_running; + __u64 nr_stopped; + __u64 nr_uninterruptible; + __u64 nr_io_wait; +}; + +enum cgroup_filetype { + CGROUP_FILE_PROCS = 0, + CGROUP_FILE_TASKS = 1, +}; + +struct cgroup_pidlist { + struct { + enum cgroup_filetype type; + struct pid_namespace *ns; + } key; + pid_t *list; + int length; + struct list_head links; + struct cgroup *owner; + struct delayed_work destroy_dwork; +}; + +enum cgroup1_param { + Opt_all = 0, + Opt_clone_children = 1, + Opt_cpuset_v2_mode = 2, + Opt_name = 3, + Opt_none = 4, + Opt_noprefix = 5, + Opt_release_agent = 6, + Opt_xattr = 7, +}; + +enum freezer_state_flags { + CGROUP_FREEZER_ONLINE = 1, + CGROUP_FREEZING_SELF = 2, + CGROUP_FREEZING_PARENT = 4, + CGROUP_FROZEN = 8, + CGROUP_FREEZING = 6, +}; + +struct freezer { + struct cgroup_subsys_state css; + unsigned int state; +}; + +struct pids_cgroup { + struct cgroup_subsys_state css; + atomic64_t counter; + atomic64_t limit; + struct cgroup_file events_file; + atomic64_t events_limit; +}; + +struct root_domain___2; + +struct fmeter { + int cnt; + int val; + time64_t time; + spinlock_t lock; +}; + +struct cpuset { + struct cgroup_subsys_state css; + long unsigned int flags; + cpumask_var_t cpus_allowed; + nodemask_t mems_allowed; + cpumask_var_t effective_cpus; + nodemask_t effective_mems; + cpumask_var_t subparts_cpus; + nodemask_t old_mems_allowed; + struct fmeter fmeter; + int attach_in_progress; + int pn; + int relax_domain_level; + int nr_subparts_cpus; + int partition_root_state; + int use_parent_ecpus; + int child_ecpus_count; +}; + +struct tmpmasks { + cpumask_var_t addmask; + cpumask_var_t delmask; + cpumask_var_t new_cpus; +}; + +typedef enum { + CS_ONLINE = 0, + CS_CPU_EXCLUSIVE = 1, + CS_MEM_EXCLUSIVE = 2, + CS_MEM_HARDWALL = 3, + CS_MEMORY_MIGRATE = 4, + CS_SCHED_LOAD_BALANCE = 5, + CS_SPREAD_PAGE = 6, + CS_SPREAD_SLAB = 7, +} cpuset_flagbits_t; + +enum subparts_cmd { + partcmd_enable = 0, + partcmd_disable = 1, + partcmd_update = 2, +}; + +struct cpuset_migrate_mm_work { + struct work_struct work; + struct mm_struct *mm; + nodemask_t from; + nodemask_t to; +}; + +typedef enum { + FILE_MEMORY_MIGRATE = 0, + FILE_CPULIST = 1, + FILE_MEMLIST = 2, + FILE_EFFECTIVE_CPULIST = 3, + FILE_EFFECTIVE_MEMLIST = 4, + FILE_SUBPARTS_CPULIST = 5, + FILE_CPU_EXCLUSIVE = 6, + FILE_MEM_EXCLUSIVE = 7, + FILE_MEM_HARDWALL = 8, + FILE_SCHED_LOAD_BALANCE = 9, + FILE_PARTITION_ROOT = 10, + FILE_SCHED_RELAX_DOMAIN_LEVEL = 11, + FILE_MEMORY_PRESSURE_ENABLED = 12, + FILE_MEMORY_PRESSURE = 13, + FILE_SPREAD_PAGE = 14, + FILE_SPREAD_SLAB = 15, +} cpuset_filetype_t; + +struct kernel_pkey_query { + __u32 supported_ops; + __u32 key_size; + __u16 max_data_size; + __u16 max_sig_size; + __u16 max_enc_size; + __u16 max_dec_size; +}; + +enum kernel_pkey_operation { + kernel_pkey_encrypt = 0, + kernel_pkey_decrypt = 1, + kernel_pkey_sign = 2, + kernel_pkey_verify = 3, +}; + +struct kernel_pkey_params { + struct key *key; + const char *encoding; + const char *hash_algo; + char *info; + __u32 in_len; + union { + __u32 out_len; + __u32 in2_len; + }; + enum kernel_pkey_operation op: 8; +}; + +struct key_preparsed_payload { + const char *orig_description; + char *description; + union key_payload payload; + const void *data; + size_t datalen; + size_t quotalen; + time64_t expiry; +}; + +struct key_match_data { + bool (*cmp)(const struct key *, const struct key_match_data *); + const void *raw_data; + void *preparsed; + unsigned int lookup_type; +}; + +struct idmap_key { + bool map_up; + u32 id; + u32 count; +}; + +struct ctl_path { + const char *procname; +}; + +struct cpu_stop_done { + atomic_t nr_todo; + int ret; + struct completion completion; +}; + +struct cpu_stopper { + struct task_struct *thread; + raw_spinlock_t lock; + bool enabled; + struct list_head works; + struct cpu_stop_work stop_work; + long unsigned int caller; + cpu_stop_fn_t fn; +}; + +enum multi_stop_state { + MULTI_STOP_NONE = 0, + MULTI_STOP_PREPARE = 1, + MULTI_STOP_DISABLE_IRQ = 2, + MULTI_STOP_RUN = 3, + MULTI_STOP_EXIT = 4, +}; + +struct multi_stop_data { + cpu_stop_fn_t fn; + void *data; + unsigned int num_threads; + const struct cpumask *active_cpus; + enum multi_stop_state state; + atomic_t thread_ack; +}; + +typedef int __kernel_mqd_t; + +typedef __kernel_mqd_t mqd_t; + +enum audit_state { + AUDIT_DISABLED = 0, + AUDIT_BUILD_CONTEXT = 1, + AUDIT_RECORD_CONTEXT = 2, +}; + +struct audit_cap_data { + kernel_cap_t permitted; + kernel_cap_t inheritable; + union { + unsigned int fE; + kernel_cap_t effective; + }; + kernel_cap_t ambient; + kuid_t rootid; +}; + +struct audit_names { + struct list_head list; + struct filename *name; + int name_len; + bool hidden; + long unsigned int ino; + dev_t dev; + umode_t mode; + kuid_t uid; + kgid_t gid; + dev_t rdev; + u32 osid; + struct audit_cap_data fcap; + unsigned int fcap_ver; + unsigned char type; + bool should_free; +}; + +struct mq_attr { + __kernel_long_t mq_flags; + __kernel_long_t mq_maxmsg; + __kernel_long_t mq_msgsize; + __kernel_long_t mq_curmsgs; + __kernel_long_t __reserved[4]; +}; + +struct audit_proctitle { + int len; + char *value; +}; + +struct audit_aux_data; + +struct __kernel_sockaddr_storage; + +struct audit_tree_refs; + +struct audit_context { + int dummy; + int in_syscall; + enum audit_state state; + enum audit_state current_state; + unsigned int serial; + int major; + struct timespec64 ctime; + long unsigned int argv[4]; + long int return_code; + u64 prio; + int return_valid; + struct audit_names preallocated_names[5]; + int name_count; + struct list_head names_list; + char *filterkey; + struct path pwd; + struct audit_aux_data *aux; + struct audit_aux_data *aux_pids; + struct __kernel_sockaddr_storage *sockaddr; + size_t sockaddr_len; + pid_t pid; + pid_t ppid; + kuid_t uid; + kuid_t euid; + kuid_t suid; + kuid_t fsuid; + kgid_t gid; + kgid_t egid; + kgid_t sgid; + kgid_t fsgid; + long unsigned int personality; + int arch; + pid_t target_pid; + kuid_t target_auid; + kuid_t target_uid; + unsigned int target_sessionid; + u32 target_sid; + char target_comm[16]; + struct audit_tree_refs *trees; + struct audit_tree_refs *first_trees; + struct list_head killed_trees; + int tree_count; + int type; + union { + struct { + int nargs; + long int args[6]; + } socketcall; + struct { + kuid_t uid; + kgid_t gid; + umode_t mode; + u32 osid; + int has_perm; + uid_t perm_uid; + gid_t perm_gid; + umode_t perm_mode; + long unsigned int qbytes; + } ipc; + struct { + mqd_t mqdes; + struct mq_attr mqstat; + } mq_getsetattr; + struct { + mqd_t mqdes; + int sigev_signo; + } mq_notify; + struct { + mqd_t mqdes; + size_t msg_len; + unsigned int msg_prio; + struct timespec64 abs_timeout; + } mq_sendrecv; + struct { + int oflag; + umode_t mode; + struct mq_attr attr; + } mq_open; + struct { + pid_t pid; + struct audit_cap_data cap; + } capset; + struct { + int fd; + int flags; + } mmap; + struct { + int argc; + } execve; + struct { + char *name; + } module; + }; + int fds[2]; + struct audit_proctitle proctitle; +}; + +struct __kernel_sockaddr_storage { + union { + struct { + __kernel_sa_family_t ss_family; + char __data[126]; + }; + void *__align; + }; +}; + +enum audit_nlgrps { + AUDIT_NLGRP_NONE = 0, + AUDIT_NLGRP_READLOG = 1, + __AUDIT_NLGRP_MAX = 2, +}; + +struct audit_status { + __u32 mask; + __u32 enabled; + __u32 failure; + __u32 pid; + __u32 rate_limit; + __u32 backlog_limit; + __u32 lost; + __u32 backlog; + union { + __u32 version; + __u32 feature_bitmap; + }; + __u32 backlog_wait_time; + __u32 backlog_wait_time_actual; +}; + +struct audit_features { + __u32 vers; + __u32 mask; + __u32 features; + __u32 lock; +}; + +struct audit_tty_status { + __u32 enabled; + __u32 log_passwd; +}; + +struct audit_sig_info { + uid_t uid; + pid_t pid; + char ctx[0]; +}; + +struct net_generic { + union { + struct { + unsigned int len; + struct callback_head rcu; + } s; + void *ptr[0]; + }; +}; + +struct pernet_operations { + struct list_head list; + int (*init)(struct net *); + void (*pre_exit)(struct net *); + void (*exit)(struct net *); + void (*exit_batch)(struct list_head *); + unsigned int *id; + size_t size; +}; + +struct scm_creds { + u32 pid; + kuid_t uid; + kgid_t gid; +}; + +struct netlink_skb_parms { + struct scm_creds creds; + __u32 portid; + __u32 dst_group; + __u32 flags; + struct sock *sk; + bool nsid_is_set; + int nsid; +}; + +struct netlink_kernel_cfg { + unsigned int groups; + unsigned int flags; + void (*input)(struct sk_buff *); + struct mutex *cb_mutex; + int (*bind)(struct net *, int); + void (*unbind)(struct net *, int); + bool (*compare)(struct net *, struct sock *); +}; + +struct audit_netlink_list { + __u32 portid; + struct net *net; + struct sk_buff_head q; +}; + +struct audit_net { + struct sock *sk; +}; + +struct auditd_connection { + struct pid *pid; + u32 portid; + struct net *net; + struct callback_head rcu; +}; + +struct audit_ctl_mutex { + struct mutex lock; + void *owner; +}; + +struct audit_buffer { + struct sk_buff *skb; + struct audit_context *ctx; + gfp_t gfp_mask; +}; + +struct audit_reply { + __u32 portid; + struct net *net; + struct sk_buff *skb; +}; + +enum { + Audit_equal = 0, + Audit_not_equal = 1, + Audit_bitmask = 2, + Audit_bittest = 3, + Audit_lt = 4, + Audit_gt = 5, + Audit_le = 6, + Audit_ge = 7, + Audit_bad = 8, +}; + +struct audit_rule_data { + __u32 flags; + __u32 action; + __u32 field_count; + __u32 mask[64]; + __u32 fields[64]; + __u32 values[64]; + __u32 fieldflags[64]; + __u32 buflen; + char buf[0]; +}; + +struct audit_field; + +struct audit_watch; + +struct audit_tree; + +struct audit_fsnotify_mark; + +struct audit_krule { + u32 pflags; + u32 flags; + u32 listnr; + u32 action; + u32 mask[64]; + u32 buflen; + u32 field_count; + char *filterkey; + struct audit_field *fields; + struct audit_field *arch_f; + struct audit_field *inode_f; + struct audit_watch *watch; + struct audit_tree *tree; + struct audit_fsnotify_mark *exe; + struct list_head rlist; + struct list_head list; + u64 prio; +}; + +struct audit_field { + u32 type; + union { + u32 val; + kuid_t uid; + kgid_t gid; + struct { + char *lsm_str; + void *lsm_rule; + }; + }; + u32 op; +}; + +struct audit_entry { + struct list_head list; + struct callback_head rcu; + struct audit_krule rule; +}; + +struct audit_buffer___2; + +typedef int __kernel_key_t; + +typedef __kernel_key_t key_t; + +struct cpu_vfs_cap_data { + __u32 magic_etc; + kernel_cap_t permitted; + kernel_cap_t inheritable; + kuid_t rootid; +}; + +struct kern_ipc_perm { + spinlock_t lock; + bool deleted; + int id; + key_t key; + kuid_t uid; + kgid_t gid; + kuid_t cuid; + kgid_t cgid; + umode_t mode; + long unsigned int seq; + void *security; + struct rhash_head khtnode; + struct callback_head rcu; + refcount_t refcount; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +typedef struct fsnotify_mark_connector *fsnotify_connp_t; + +struct fsnotify_mark_connector { + spinlock_t lock; + short unsigned int type; + short unsigned int flags; + __kernel_fsid_t fsid; + union { + fsnotify_connp_t *obj; + struct fsnotify_mark_connector *destroy_next; + }; + struct hlist_head list; +}; + +enum audit_nfcfgop { + AUDIT_XT_OP_REGISTER = 0, + AUDIT_XT_OP_REPLACE = 1, + AUDIT_XT_OP_UNREGISTER = 2, + AUDIT_NFT_OP_TABLE_REGISTER = 3, + AUDIT_NFT_OP_TABLE_UNREGISTER = 4, + AUDIT_NFT_OP_CHAIN_REGISTER = 5, + AUDIT_NFT_OP_CHAIN_UNREGISTER = 6, + AUDIT_NFT_OP_RULE_REGISTER = 7, + AUDIT_NFT_OP_RULE_UNREGISTER = 8, + AUDIT_NFT_OP_SET_REGISTER = 9, + AUDIT_NFT_OP_SET_UNREGISTER = 10, + AUDIT_NFT_OP_SETELEM_REGISTER = 11, + AUDIT_NFT_OP_SETELEM_UNREGISTER = 12, + AUDIT_NFT_OP_GEN_REGISTER = 13, + AUDIT_NFT_OP_OBJ_REGISTER = 14, + AUDIT_NFT_OP_OBJ_UNREGISTER = 15, + AUDIT_NFT_OP_OBJ_RESET = 16, + AUDIT_NFT_OP_FLOWTABLE_REGISTER = 17, + AUDIT_NFT_OP_FLOWTABLE_UNREGISTER = 18, + AUDIT_NFT_OP_INVALID = 19, +}; + +enum fsnotify_obj_type { + FSNOTIFY_OBJ_TYPE_INODE = 0, + FSNOTIFY_OBJ_TYPE_PARENT = 1, + FSNOTIFY_OBJ_TYPE_VFSMOUNT = 2, + FSNOTIFY_OBJ_TYPE_SB = 3, + FSNOTIFY_OBJ_TYPE_COUNT = 4, + FSNOTIFY_OBJ_TYPE_DETACHED = 4, +}; + +struct audit_aux_data { + struct audit_aux_data *next; + int type; +}; + +struct audit_chunk; + +struct audit_tree_refs { + struct audit_tree_refs *next; + struct audit_chunk *c[31]; +}; + +struct audit_aux_data_pids { + struct audit_aux_data d; + pid_t target_pid[16]; + kuid_t target_auid[16]; + kuid_t target_uid[16]; + unsigned int target_sessionid[16]; + u32 target_sid[16]; + char target_comm[256]; + int pid_count; +}; + +struct audit_aux_data_bprm_fcaps { + struct audit_aux_data d; + struct audit_cap_data fcap; + unsigned int fcap_ver; + struct audit_cap_data old_pcap; + struct audit_cap_data new_pcap; +}; + +struct audit_nfcfgop_tab { + enum audit_nfcfgop op; + const char *s; +}; + +struct audit_parent; + +struct audit_watch { + refcount_t count; + dev_t dev; + char *path; + long unsigned int ino; + struct audit_parent *parent; + struct list_head wlist; + struct list_head rules; +}; + +struct fsnotify_group; + +struct fsnotify_iter_info; + +struct fsnotify_mark; + +struct fsnotify_event; + +struct fsnotify_ops { + int (*handle_event)(struct fsnotify_group *, u32, const void *, int, struct inode *, const struct qstr *, u32, struct fsnotify_iter_info *); + int (*handle_inode_event)(struct fsnotify_mark *, u32, struct inode *, struct inode *, const struct qstr *, u32); + void (*free_group_priv)(struct fsnotify_group *); + void (*freeing_mark)(struct fsnotify_mark *, struct fsnotify_group *); + void (*free_event)(struct fsnotify_event *); + void (*free_mark)(struct fsnotify_mark *); +}; + +struct inotify_group_private_data { + spinlock_t idr_lock; + struct idr idr; + struct ucounts *ucounts; +}; + +struct fanotify_group_private_data { + struct list_head access_list; + wait_queue_head_t access_waitq; + int flags; + int f_flags; + unsigned int max_marks; + struct user_struct *user; +}; + +struct fsnotify_group { + const struct fsnotify_ops *ops; + refcount_t refcnt; + spinlock_t notification_lock; + struct list_head notification_list; + wait_queue_head_t notification_waitq; + unsigned int q_len; + unsigned int max_events; + unsigned int priority; + bool shutdown; + struct mutex mark_mutex; + atomic_t num_marks; + atomic_t user_waits; + struct list_head marks_list; + struct fasync_struct *fsn_fa; + struct fsnotify_event *overflow_event; + struct mem_cgroup *memcg; + union { + void *private; + struct inotify_group_private_data inotify_data; + struct fanotify_group_private_data fanotify_data; + }; +}; + +struct fsnotify_iter_info { + struct fsnotify_mark *marks[4]; + unsigned int report_mask; + int srcu_idx; +}; + +struct fsnotify_mark { + __u32 mask; + refcount_t refcnt; + struct fsnotify_group *group; + struct list_head g_list; + spinlock_t lock; + struct hlist_node obj_list; + struct fsnotify_mark_connector *connector; + __u32 ignored_mask; + unsigned int flags; +}; + +struct fsnotify_event { + struct list_head list; + long unsigned int objectid; +}; + +struct audit_parent { + struct list_head watches; + struct fsnotify_mark mark; +}; + +struct audit_fsnotify_mark { + dev_t dev; + long unsigned int ino; + char *path; + struct fsnotify_mark mark; + struct audit_krule *rule; +}; + +struct audit_chunk___2; + +struct audit_tree { + refcount_t count; + int goner; + struct audit_chunk___2 *root; + struct list_head chunks; + struct list_head rules; + struct list_head list; + struct list_head same_root; + struct callback_head head; + char pathname[0]; +}; + +struct node { + struct list_head list; + struct audit_tree *owner; + unsigned int index; +}; + +struct audit_chunk___2 { + struct list_head hash; + long unsigned int key; + struct fsnotify_mark *mark; + struct list_head trees; + int count; + atomic_long_t refs; + struct callback_head head; + struct node owners[0]; +}; + +struct audit_tree_mark { + struct fsnotify_mark mark; + struct audit_chunk___2 *chunk; +}; + +enum { + HASH_SIZE = 128, +}; + +struct kprobe_blacklist_entry { + struct list_head list; + long unsigned int start_addr; + long unsigned int end_addr; +}; + +enum perf_record_ksymbol_type { + PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0, + PERF_RECORD_KSYMBOL_TYPE_BPF = 1, + PERF_RECORD_KSYMBOL_TYPE_OOL = 2, + PERF_RECORD_KSYMBOL_TYPE_MAX = 3, +}; + +struct kprobe_insn_page { + struct list_head list; + kprobe_opcode_t *insns; + struct kprobe_insn_cache *cache; + int nused; + int ngarbage; + char slot_used[0]; +}; + +enum kprobe_slot_state { + SLOT_CLEAN = 0, + SLOT_DIRTY = 1, + SLOT_USED = 2, +}; + +struct kgdb_io { + const char *name; + int (*read_char)(); + void (*write_char)(u8); + void (*flush)(); + int (*init)(); + void (*deinit)(); + void (*pre_exception)(); + void (*post_exception)(); + struct console *cons; +}; + +enum { + KDB_NOT_INITIALIZED = 0, + KDB_INIT_EARLY = 1, + KDB_INIT_FULL = 2, +}; + +struct kgdb_state { + int ex_vector; + int signo; + int err_code; + int cpu; + int pass_exception; + long unsigned int thr_query; + long unsigned int threadid; + long int kgdb_usethreadid; + struct pt_regs *linux_regs; + atomic_t *send_ready; +}; + +struct debuggerinfo_struct { + void *debuggerinfo; + struct task_struct *task; + int exception_state; + int ret_state; + int irq_depth; + int enter_kgdb; + bool rounding_up; +}; + +struct seccomp_notif_sizes { + __u16 seccomp_notif; + __u16 seccomp_notif_resp; + __u16 seccomp_data; +}; + +struct seccomp_notif { + __u64 id; + __u32 pid; + __u32 flags; + struct seccomp_data data; +}; + +struct seccomp_notif_resp { + __u64 id; + __s64 val; + __s32 error; + __u32 flags; +}; + +struct seccomp_notif_addfd { + __u64 id; + __u32 flags; + __u32 srcfd; + __u32 newfd; + __u32 newfd_flags; +}; + +struct action_cache { + long unsigned int allow_native[7]; + long unsigned int allow_compat[7]; +}; + +struct notification; + +struct seccomp_filter { + refcount_t refs; + refcount_t users; + bool log; + struct action_cache cache; + struct seccomp_filter *prev; + struct bpf_prog *prog; + struct notification *notif; + struct mutex notify_lock; + wait_queue_head_t wqh; +}; + +struct seccomp_metadata { + __u64 filter_off; + __u64 flags; +}; + +struct sock_fprog { + short unsigned int len; + struct sock_filter *filter; +}; + +struct compat_sock_fprog { + u16 len; + compat_uptr_t filter; +}; + +typedef int (*bpf_aux_classic_check_t)(struct sock_filter *, unsigned int); + +enum notify_state { + SECCOMP_NOTIFY_INIT = 0, + SECCOMP_NOTIFY_SENT = 1, + SECCOMP_NOTIFY_REPLIED = 2, +}; + +struct seccomp_knotif { + struct task_struct *task; + u64 id; + const struct seccomp_data *data; + enum notify_state state; + int error; + long int val; + u32 flags; + struct completion ready; + struct list_head list; + struct list_head addfd; +}; + +struct seccomp_kaddfd { + struct file *file; + int fd; + unsigned int flags; + int ret; + struct completion completion; + struct list_head list; +}; + +struct notification { + struct semaphore request; + u64 next_id; + struct list_head notifications; +}; + +struct seccomp_log_name { + u32 log; + const char *name; +}; + +struct rchan; + +struct rchan_buf { + void *start; + void *data; + size_t offset; + size_t subbufs_produced; + size_t subbufs_consumed; + struct rchan *chan; + wait_queue_head_t read_wait; + struct irq_work wakeup_work; + struct dentry *dentry; + struct kref kref; + struct page **page_array; + unsigned int page_count; + unsigned int finalized; + size_t *padding; + size_t prev_padding; + size_t bytes_consumed; + size_t early_bytes; + unsigned int cpu; + long: 32; + long: 64; + long: 64; + long: 64; +}; + +struct rchan_callbacks; + +struct rchan { + u32 version; + size_t subbuf_size; + size_t n_subbufs; + size_t alloc_size; + const struct rchan_callbacks *cb; + struct kref kref; + void *private_data; + size_t last_toobig; + struct rchan_buf **buf; + int is_global; + struct list_head list; + struct dentry *parent; + int has_base_filename; + char base_filename[255]; +}; + +struct rchan_callbacks { + int (*subbuf_start)(struct rchan_buf *, void *, void *, size_t); + struct dentry * (*create_buf_file)(const char *, struct dentry *, umode_t, struct rchan_buf *, int *); + int (*remove_buf_file)(struct dentry *); +}; + +struct partial_page { + unsigned int offset; + unsigned int len; + long unsigned int private; +}; + +struct splice_pipe_desc { + struct page **pages; + struct partial_page *partial; + int nr_pages; + unsigned int nr_pages_max; + const struct pipe_buf_operations *ops; + void (*spd_release)(struct splice_pipe_desc *, unsigned int); +}; + +struct rchan_percpu_buf_dispatcher { + struct rchan_buf *buf; + struct dentry *dentry; +}; + +enum { + TASKSTATS_TYPE_UNSPEC = 0, + TASKSTATS_TYPE_PID = 1, + TASKSTATS_TYPE_TGID = 2, + TASKSTATS_TYPE_STATS = 3, + TASKSTATS_TYPE_AGGR_PID = 4, + TASKSTATS_TYPE_AGGR_TGID = 5, + TASKSTATS_TYPE_NULL = 6, + __TASKSTATS_TYPE_MAX = 7, +}; + +enum { + TASKSTATS_CMD_ATTR_UNSPEC = 0, + TASKSTATS_CMD_ATTR_PID = 1, + TASKSTATS_CMD_ATTR_TGID = 2, + TASKSTATS_CMD_ATTR_REGISTER_CPUMASK = 3, + TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK = 4, + __TASKSTATS_CMD_ATTR_MAX = 5, +}; + +enum { + CGROUPSTATS_CMD_UNSPEC = 3, + CGROUPSTATS_CMD_GET = 4, + CGROUPSTATS_CMD_NEW = 5, + __CGROUPSTATS_CMD_MAX = 6, +}; + +enum { + CGROUPSTATS_TYPE_UNSPEC = 0, + CGROUPSTATS_TYPE_CGROUP_STATS = 1, + __CGROUPSTATS_TYPE_MAX = 2, +}; + +enum { + CGROUPSTATS_CMD_ATTR_UNSPEC = 0, + CGROUPSTATS_CMD_ATTR_FD = 1, + __CGROUPSTATS_CMD_ATTR_MAX = 2, +}; + +struct genlmsghdr { + __u8 cmd; + __u8 version; + __u16 reserved; +}; + +enum { + NLA_UNSPEC = 0, + NLA_U8 = 1, + NLA_U16 = 2, + NLA_U32 = 3, + NLA_U64 = 4, + NLA_STRING = 5, + NLA_FLAG = 6, + NLA_MSECS = 7, + NLA_NESTED = 8, + NLA_NESTED_ARRAY = 9, + NLA_NUL_STRING = 10, + NLA_BINARY = 11, + NLA_S8 = 12, + NLA_S16 = 13, + NLA_S32 = 14, + NLA_S64 = 15, + NLA_BITFIELD32 = 16, + NLA_REJECT = 17, + __NLA_TYPE_MAX = 18, +}; + +struct genl_multicast_group { + char name[16]; +}; + +struct genl_ops; + +struct genl_info; + +struct genl_small_ops; + +struct genl_family { + int id; + unsigned int hdrsize; + char name[16]; + unsigned int version; + unsigned int maxattr; + unsigned int mcgrp_offset; + u8 netnsok: 1; + u8 parallel_ops: 1; + u8 n_ops; + u8 n_small_ops; + u8 n_mcgrps; + const struct nla_policy *policy; + int (*pre_doit)(const struct genl_ops *, struct sk_buff *, struct genl_info *); + void (*post_doit)(const struct genl_ops *, struct sk_buff *, struct genl_info *); + const struct genl_ops *ops; + const struct genl_small_ops *small_ops; + const struct genl_multicast_group *mcgrps; + struct module *module; +}; + +struct genl_ops { + int (*doit)(struct sk_buff *, struct genl_info *); + int (*start)(struct netlink_callback *); + int (*dumpit)(struct sk_buff *, struct netlink_callback *); + int (*done)(struct netlink_callback *); + const struct nla_policy *policy; + unsigned int maxattr; + u8 cmd; + u8 internal_flags; + u8 flags; + u8 validate; +}; + +struct genl_info { + u32 snd_seq; + u32 snd_portid; + struct nlmsghdr *nlhdr; + struct genlmsghdr *genlhdr; + void *userhdr; + struct nlattr **attrs; + possible_net_t _net; + void *user_ptr[2]; + struct netlink_ext_ack *extack; +}; + +struct genl_small_ops { + int (*doit)(struct sk_buff *, struct genl_info *); + int (*dumpit)(struct sk_buff *, struct netlink_callback *); + u8 cmd; + u8 internal_flags; + u8 flags; + u8 validate; +}; + +enum genl_validate_flags { + GENL_DONT_VALIDATE_STRICT = 1, + GENL_DONT_VALIDATE_DUMP = 2, + GENL_DONT_VALIDATE_DUMP_STRICT = 4, +}; + +struct listener { + struct list_head list; + pid_t pid; + char valid; +}; + +struct listener_list { + struct rw_semaphore sem; + struct list_head list; +}; + +enum actions { + REGISTER = 0, + DEREGISTER = 1, + CPU_DONT_CARE = 2, +}; + +struct tp_module { + struct list_head list; + struct module *mod; +}; + +struct tp_probes { + struct callback_head rcu; + struct tracepoint_func probes[0]; +}; + +struct ftrace_hash { + long unsigned int size_bits; + struct hlist_head *buckets; + long unsigned int count; + long unsigned int flags; + struct callback_head rcu; +}; + +struct ftrace_func_entry { + struct hlist_node hlist; + long unsigned int ip; + long unsigned int direct; +}; + +enum ftrace_bug_type { + FTRACE_BUG_UNKNOWN = 0, + FTRACE_BUG_INIT = 1, + FTRACE_BUG_NOP = 2, + FTRACE_BUG_CALL = 3, + FTRACE_BUG_UPDATE = 4, +}; + +enum { + FTRACE_UPDATE_CALLS = 1, + FTRACE_DISABLE_CALLS = 2, + FTRACE_UPDATE_TRACE_FUNC = 4, + FTRACE_START_FUNC_RET = 8, + FTRACE_STOP_FUNC_RET = 16, + FTRACE_MAY_SLEEP = 32, +}; + +enum { + FTRACE_ITER_FILTER = 1, + FTRACE_ITER_NOTRACE = 2, + FTRACE_ITER_PRINTALL = 4, + FTRACE_ITER_DO_PROBES = 8, + FTRACE_ITER_PROBE = 16, + FTRACE_ITER_MOD = 32, + FTRACE_ITER_ENABLED = 64, +}; + +struct ftrace_graph_ent { + long unsigned int func; + int depth; +} __attribute__((packed)); + +struct ftrace_graph_ret { + long unsigned int func; + int depth; + unsigned int overrun; + long long unsigned int calltime; + long long unsigned int rettime; +}; + +typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); + +typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); + +struct fgraph_ops { + trace_func_graph_ent_t entryfunc; + trace_func_graph_ret_t retfunc; +}; + +struct prog_entry; + +struct event_filter { + struct prog_entry *prog; + char *filter_string; +}; + +struct trace_array_cpu; + +struct array_buffer { + struct trace_array *tr; + struct trace_buffer *buffer; + struct trace_array_cpu *data; + u64 time_start; + int cpu; +}; + +struct trace_pid_list; + +struct trace_options; + +struct cond_snapshot; + +struct trace_array { + struct list_head list; + char *name; + struct array_buffer array_buffer; + struct array_buffer max_buffer; + bool allocated_snapshot; + long unsigned int max_latency; + struct dentry *d_max_latency; + struct work_struct fsnotify_work; + struct irq_work fsnotify_irqwork; + struct trace_pid_list *filtered_pids; + struct trace_pid_list *filtered_no_pids; + arch_spinlock_t max_lock; + int buffer_disabled; + int sys_refcount_enter; + int sys_refcount_exit; + struct trace_event_file *enter_syscall_files[442]; + struct trace_event_file *exit_syscall_files[442]; + int stop_count; + int clock_id; + int nr_topts; + bool clear_trace; + int buffer_percent; + unsigned int n_err_log_entries; + struct tracer *current_trace; + unsigned int trace_flags; + unsigned char trace_flags_index[32]; + unsigned int flags; + raw_spinlock_t start_lock; + struct list_head err_log; + struct dentry *dir; + struct dentry *options; + struct dentry *percpu_dir; + struct dentry *event_dir; + struct trace_options *topts; + struct list_head systems; + struct list_head events; + struct trace_event_file *trace_marker_file; + cpumask_var_t tracing_cpumask; + int ref; + int trace_ref; + struct ftrace_ops *ops; + struct trace_pid_list *function_pids; + struct trace_pid_list *function_no_pids; + struct list_head func_probes; + struct list_head mod_trace; + struct list_head mod_notrace; + int function_enabled; + int time_stamp_abs_ref; + struct list_head hist_vars; + struct cond_snapshot *cond_snapshot; +}; + +struct tracer_flags; + +struct tracer { + const char *name; + int (*init)(struct trace_array *); + void (*reset)(struct trace_array *); + void (*start)(struct trace_array *); + void (*stop)(struct trace_array *); + int (*update_thresh)(struct trace_array *); + void (*open)(struct trace_iterator *); + void (*pipe_open)(struct trace_iterator *); + void (*close)(struct trace_iterator *); + void (*pipe_close)(struct trace_iterator *); + ssize_t (*read)(struct trace_iterator *, struct file *, char *, size_t, loff_t *); + ssize_t (*splice_read)(struct trace_iterator *, struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); + void (*print_header)(struct seq_file *); + enum print_line_t (*print_line)(struct trace_iterator *); + int (*set_flag)(struct trace_array *, u32, u32, int); + int (*flag_changed)(struct trace_array *, u32, int); + struct tracer *next; + struct tracer_flags *flags; + int enabled; + bool print_max; + bool allow_instances; + bool use_max_tr; + bool noboot; +}; + +struct event_subsystem; + +struct trace_subsystem_dir { + struct list_head list; + struct event_subsystem *subsystem; + struct trace_array *tr; + struct dentry *entry; + int ref_count; + int nr_events; +}; + +struct trace_array_cpu { + atomic_t disabled; + void *buffer_page; + long unsigned int entries; + long unsigned int saved_latency; + long unsigned int critical_start; + long unsigned int critical_end; + long unsigned int critical_sequence; + long unsigned int nice; + long unsigned int policy; + long unsigned int rt_priority; + long unsigned int skipped_entries; + u64 preempt_timestamp; + pid_t pid; + kuid_t uid; + char comm[16]; + int ftrace_ignore_pid; + bool ignore_pid; +}; + +struct trace_option_dentry; + +struct trace_options { + struct tracer *tracer; + struct trace_option_dentry *topts; +}; + +struct tracer_opt; + +struct trace_option_dentry { + struct tracer_opt *opt; + struct tracer_flags *flags; + struct trace_array *tr; + struct dentry *entry; +}; + +struct trace_pid_list { + int pid_max; + long unsigned int *pids; +}; + +enum { + TRACE_PIDS = 1, + TRACE_NO_PIDS = 2, +}; + +typedef bool (*cond_update_fn_t)(struct trace_array *, void *); + +struct cond_snapshot { + void *cond_data; + cond_update_fn_t update; +}; + +enum { + TRACE_ARRAY_FL_GLOBAL = 1, +}; + +struct tracer_opt { + const char *name; + u32 bit; +}; + +struct tracer_flags { + u32 val; + struct tracer_opt *opts; + struct tracer *trace; +}; + +struct ftrace_mod_load { + struct list_head list; + char *func; + char *module; + int enable; +}; + +enum { + FTRACE_HASH_FL_MOD = 1, +}; + +struct ftrace_func_command { + struct list_head list; + char *name; + int (*func)(struct trace_array *, struct ftrace_hash *, char *, char *, char *, int); +}; + +struct ftrace_probe_ops { + void (*func)(long unsigned int, long unsigned int, struct trace_array *, struct ftrace_probe_ops *, void *); + int (*init)(struct ftrace_probe_ops *, struct trace_array *, long unsigned int, void *, void **); + void (*free)(struct ftrace_probe_ops *, struct trace_array *, long unsigned int, void *); + int (*print)(struct seq_file *, long unsigned int, struct ftrace_probe_ops *, void *); +}; + +typedef int (*ftrace_mapper_func)(void *); + +struct trace_parser { + bool cont; + char *buffer; + unsigned int idx; + unsigned int size; +}; + +enum trace_iterator_bits { + TRACE_ITER_PRINT_PARENT_BIT = 0, + TRACE_ITER_SYM_OFFSET_BIT = 1, + TRACE_ITER_SYM_ADDR_BIT = 2, + TRACE_ITER_VERBOSE_BIT = 3, + TRACE_ITER_RAW_BIT = 4, + TRACE_ITER_HEX_BIT = 5, + TRACE_ITER_BIN_BIT = 6, + TRACE_ITER_BLOCK_BIT = 7, + TRACE_ITER_PRINTK_BIT = 8, + TRACE_ITER_ANNOTATE_BIT = 9, + TRACE_ITER_USERSTACKTRACE_BIT = 10, + TRACE_ITER_SYM_USEROBJ_BIT = 11, + TRACE_ITER_PRINTK_MSGONLY_BIT = 12, + TRACE_ITER_CONTEXT_INFO_BIT = 13, + TRACE_ITER_LATENCY_FMT_BIT = 14, + TRACE_ITER_RECORD_CMD_BIT = 15, + TRACE_ITER_RECORD_TGID_BIT = 16, + TRACE_ITER_OVERWRITE_BIT = 17, + TRACE_ITER_STOP_ON_FREE_BIT = 18, + TRACE_ITER_IRQ_INFO_BIT = 19, + TRACE_ITER_MARKERS_BIT = 20, + TRACE_ITER_EVENT_FORK_BIT = 21, + TRACE_ITER_PAUSE_ON_TRACE_BIT = 22, + TRACE_ITER_FUNCTION_BIT = 23, + TRACE_ITER_FUNC_FORK_BIT = 24, + TRACE_ITER_DISPLAY_GRAPH_BIT = 25, + TRACE_ITER_STACKTRACE_BIT = 26, + TRACE_ITER_LAST_BIT = 27, +}; + +struct event_subsystem { + struct list_head list; + const char *name; + struct event_filter *filter; + int ref_count; +}; + +enum regex_type { + MATCH_FULL = 0, + MATCH_FRONT_ONLY = 1, + MATCH_MIDDLE_ONLY = 2, + MATCH_END_ONLY = 3, + MATCH_GLOB = 4, + MATCH_INDEX = 5, +}; + +struct tracer_stat { + const char *name; + void * (*stat_start)(struct tracer_stat *); + void * (*stat_next)(void *, int); + cmp_func_t stat_cmp; + int (*stat_show)(struct seq_file *, void *); + void (*stat_release)(void *); + int (*stat_headers)(struct seq_file *); +}; + +enum { + FTRACE_MODIFY_ENABLE_FL = 1, + FTRACE_MODIFY_MAY_SLEEP_FL = 2, +}; + +struct ftrace_profile { + struct hlist_node node; + long unsigned int ip; + long unsigned int counter; + long long unsigned int time; + long long unsigned int time_squared; +}; + +struct ftrace_profile_page { + struct ftrace_profile_page *next; + long unsigned int index; + struct ftrace_profile records[0]; +}; + +struct ftrace_profile_stat { + atomic_t disabled; + struct hlist_head *hash; + struct ftrace_profile_page *pages; + struct ftrace_profile_page *start; + struct tracer_stat stat; +}; + +struct ftrace_func_probe { + struct ftrace_probe_ops *probe_ops; + struct ftrace_ops ops; + struct trace_array *tr; + struct list_head list; + void *data; + int ref; +}; + +struct ftrace_page { + struct ftrace_page *next; + struct dyn_ftrace *records; + int index; + int size; +}; + +struct ftrace_rec_iter___2 { + struct ftrace_page *pg; + int index; +}; + +struct ftrace_iterator { + loff_t pos; + loff_t func_pos; + loff_t mod_pos; + struct ftrace_page *pg; + struct dyn_ftrace *func; + struct ftrace_func_probe *probe; + struct ftrace_func_entry *probe_entry; + struct trace_parser parser; + struct ftrace_hash *hash; + struct ftrace_ops *ops; + struct trace_array *tr; + struct list_head *mod_list; + int pidx; + int idx; + unsigned int flags; +}; + +struct ftrace_glob { + char *search; + unsigned int len; + int type; +}; + +struct ftrace_func_map { + struct ftrace_func_entry entry; + void *data; +}; + +struct ftrace_func_mapper { + struct ftrace_hash hash; +}; + +struct ftrace_direct_func { + struct list_head next; + long unsigned int addr; + int count; +}; + +enum graph_filter_type { + GRAPH_FILTER_NOTRACE = 0, + GRAPH_FILTER_FUNCTION = 1, +}; + +struct ftrace_graph_data { + struct ftrace_hash *hash; + struct ftrace_func_entry *entry; + int idx; + enum graph_filter_type type; + struct ftrace_hash *new_hash; + const struct seq_operations *seq_ops; + struct trace_parser parser; +}; + +struct ftrace_mod_func { + struct list_head list; + char *name; + long unsigned int ip; + unsigned int size; +}; + +struct ftrace_mod_map { + struct callback_head rcu; + struct list_head list; + struct module *mod; + long unsigned int start_addr; + long unsigned int end_addr; + struct list_head funcs; + unsigned int num_funcs; +}; + +struct ftrace_init_func { + struct list_head list; + long unsigned int ip; +}; + +enum ring_buffer_type { + RINGBUF_TYPE_DATA_TYPE_LEN_MAX = 28, + RINGBUF_TYPE_PADDING = 29, + RINGBUF_TYPE_TIME_EXTEND = 30, + RINGBUF_TYPE_TIME_STAMP = 31, +}; + +enum ring_buffer_flags { + RB_FL_OVERWRITE = 1, +}; + +struct ring_buffer_per_cpu; + +struct buffer_page; + +struct ring_buffer_iter { + struct ring_buffer_per_cpu *cpu_buffer; + long unsigned int head; + long unsigned int next_event; + struct buffer_page *head_page; + struct buffer_page *cache_reader_page; + long unsigned int cache_read; + u64 read_stamp; + u64 page_stamp; + struct ring_buffer_event *event; + int missed_events; +}; + +struct rb_irq_work { + struct irq_work work; + wait_queue_head_t waiters; + wait_queue_head_t full_waiters; + bool waiters_pending; + bool full_waiters_pending; + bool wakeup_full; +}; + +struct trace_buffer___2 { + unsigned int flags; + int cpus; + atomic_t record_disabled; + cpumask_var_t cpumask; + struct lock_class_key *reader_lock_key; + struct mutex mutex; + struct ring_buffer_per_cpu **buffers; + struct hlist_node node; + u64 (*clock)(); + struct rb_irq_work irq_work; + bool time_stamp_abs; +}; + +enum { + RB_LEN_TIME_EXTEND = 8, + RB_LEN_TIME_STAMP = 8, +}; + +struct buffer_data_page { + u64 time_stamp; + local_t commit; + unsigned char data[0]; +}; + +struct buffer_page { + struct list_head list; + local_t write; + unsigned int read; + local_t entries; + long unsigned int real_end; + struct buffer_data_page *page; +}; + +struct rb_event_info { + u64 ts; + u64 delta; + u64 before; + u64 after; + long unsigned int length; + struct buffer_page *tail_page; + int add_timestamp; +}; + +enum { + RB_ADD_STAMP_NONE = 0, + RB_ADD_STAMP_EXTEND = 2, + RB_ADD_STAMP_ABSOLUTE = 4, + RB_ADD_STAMP_FORCE = 8, +}; + +enum { + RB_CTX_TRANSITION = 0, + RB_CTX_NMI = 1, + RB_CTX_IRQ = 2, + RB_CTX_SOFTIRQ = 3, + RB_CTX_NORMAL = 4, + RB_CTX_MAX = 5, +}; + +struct rb_time_struct { + local64_t time; +}; + +typedef struct rb_time_struct rb_time_t; + +struct ring_buffer_per_cpu { + int cpu; + atomic_t record_disabled; + atomic_t resize_disabled; + struct trace_buffer___2 *buffer; + raw_spinlock_t reader_lock; + arch_spinlock_t lock; + struct lock_class_key lock_key; + struct buffer_data_page *free_page; + long unsigned int nr_pages; + unsigned int current_context; + struct list_head *pages; + struct buffer_page *head_page; + struct buffer_page *tail_page; + struct buffer_page *commit_page; + struct buffer_page *reader_page; + long unsigned int lost_events; + long unsigned int last_overrun; + long unsigned int nest; + local_t entries_bytes; + local_t entries; + local_t overrun; + local_t commit_overrun; + local_t dropped_events; + local_t committing; + local_t commits; + local_t pages_touched; + local_t pages_read; + long int last_pages_touch; + size_t shortest_full; + long unsigned int read; + long unsigned int read_bytes; + rb_time_t write_stamp; + rb_time_t before_stamp; + u64 read_stamp; + long int nr_pages_to_update; + struct list_head new_pages; + struct work_struct update_pages_work; + struct completion update_done; + struct rb_irq_work irq_work; +}; + +typedef struct vfsmount * (*debugfs_automount_t)(struct dentry *, void *); + +struct trace_export { + struct trace_export *next; + void (*write)(struct trace_export *, const void *, unsigned int); + int flags; +}; + +enum fsnotify_data_type { + FSNOTIFY_EVENT_NONE = 0, + FSNOTIFY_EVENT_PATH = 1, + FSNOTIFY_EVENT_INODE = 2, +}; + +enum trace_iter_flags { + TRACE_FILE_LAT_FMT = 1, + TRACE_FILE_ANNOTATE = 2, + TRACE_FILE_TIME_IN_NS = 4, +}; + +enum trace_type { + __TRACE_FIRST_TYPE = 0, + TRACE_FN = 1, + TRACE_CTX = 2, + TRACE_WAKE = 3, + TRACE_STACK = 4, + TRACE_PRINT = 5, + TRACE_BPRINT = 6, + TRACE_MMIO_RW = 7, + TRACE_MMIO_MAP = 8, + TRACE_BRANCH = 9, + TRACE_GRAPH_RET = 10, + TRACE_GRAPH_ENT = 11, + TRACE_USER_STACK = 12, + TRACE_BLK = 13, + TRACE_BPUTS = 14, + TRACE_HWLAT = 15, + TRACE_RAW_DATA = 16, + __TRACE_LAST_TYPE = 17, +}; + +struct ftrace_entry { + struct trace_entry ent; + long unsigned int ip; + long unsigned int parent_ip; +}; + +struct stack_entry { + struct trace_entry ent; + int size; + long unsigned int caller[8]; +}; + +struct userstack_entry { + struct trace_entry ent; + unsigned int tgid; + long unsigned int caller[8]; +}; + +struct bprint_entry { + struct trace_entry ent; + long unsigned int ip; + const char *fmt; + u32 buf[0]; +}; + +struct print_entry { + struct trace_entry ent; + long unsigned int ip; + char buf[0]; +}; + +struct raw_data_entry { + struct trace_entry ent; + unsigned int id; + char buf[0]; +}; + +struct bputs_entry { + struct trace_entry ent; + long unsigned int ip; + const char *str; +}; + +enum trace_flag_type { + TRACE_FLAG_IRQS_OFF = 1, + TRACE_FLAG_IRQS_NOSUPPORT = 2, + TRACE_FLAG_NEED_RESCHED = 4, + TRACE_FLAG_HARDIRQ = 8, + TRACE_FLAG_SOFTIRQ = 16, + TRACE_FLAG_PREEMPT_RESCHED = 32, + TRACE_FLAG_NMI = 64, +}; + +enum trace_iterator_flags { + TRACE_ITER_PRINT_PARENT = 1, + TRACE_ITER_SYM_OFFSET = 2, + TRACE_ITER_SYM_ADDR = 4, + TRACE_ITER_VERBOSE = 8, + TRACE_ITER_RAW = 16, + TRACE_ITER_HEX = 32, + TRACE_ITER_BIN = 64, + TRACE_ITER_BLOCK = 128, + TRACE_ITER_PRINTK = 256, + TRACE_ITER_ANNOTATE = 512, + TRACE_ITER_USERSTACKTRACE = 1024, + TRACE_ITER_SYM_USEROBJ = 2048, + TRACE_ITER_PRINTK_MSGONLY = 4096, + TRACE_ITER_CONTEXT_INFO = 8192, + TRACE_ITER_LATENCY_FMT = 16384, + TRACE_ITER_RECORD_CMD = 32768, + TRACE_ITER_RECORD_TGID = 65536, + TRACE_ITER_OVERWRITE = 131072, + TRACE_ITER_STOP_ON_FREE = 262144, + TRACE_ITER_IRQ_INFO = 524288, + TRACE_ITER_MARKERS = 1048576, + TRACE_ITER_EVENT_FORK = 2097152, + TRACE_ITER_PAUSE_ON_TRACE = 4194304, + TRACE_ITER_FUNCTION = 8388608, + TRACE_ITER_FUNC_FORK = 16777216, + TRACE_ITER_DISPLAY_GRAPH = 33554432, + TRACE_ITER_STACKTRACE = 67108864, +}; + +struct trace_eval_map_head { + struct module *mod; + long unsigned int length; +}; + +union trace_eval_map_item; + +struct trace_eval_map_tail { + union trace_eval_map_item *next; + const char *end; +}; + +union trace_eval_map_item { + struct trace_eval_map map; + struct trace_eval_map_head head; + struct trace_eval_map_tail tail; +}; + +struct saved_cmdlines_buffer { + unsigned int map_pid_to_cmdline[32769]; + unsigned int *map_cmdline_to_pid; + unsigned int cmdline_num; + int cmdline_idx; + char *saved_cmdlines; +}; + +struct ftrace_stack { + long unsigned int calls[1024]; +}; + +struct ftrace_stacks { + struct ftrace_stack stacks[4]; +}; + +struct trace_buffer_struct { + int nesting; + char buffer[4096]; +}; + +struct ftrace_buffer_info { + struct trace_iterator iter; + void *spare; + unsigned int spare_cpu; + unsigned int read; +}; + +struct err_info { + const char **errs; + u8 type; + u8 pos; + u64 ts; +}; + +struct tracing_log_err { + struct list_head list; + struct err_info info; + char loc[128]; + char cmd[256]; +}; + +struct buffer_ref { + struct trace_buffer *buffer; + void *page; + int cpu; + refcount_t refcount; +}; + +struct ftrace_func_mapper___2; + +struct ctx_switch_entry { + struct trace_entry ent; + unsigned int prev_pid; + unsigned int next_pid; + unsigned int next_cpu; + unsigned char prev_prio; + unsigned char prev_state; + unsigned char next_prio; + unsigned char next_state; +}; + +struct hwlat_entry { + struct trace_entry ent; + u64 duration; + u64 outer_duration; + u64 nmi_total_ts; + struct timespec64 timestamp; + unsigned int nmi_count; + unsigned int seqnum; + unsigned int count; +}; + +struct trace_mark { + long long unsigned int val; + char sym; +}; + +struct stat_node { + struct rb_node node; + void *stat; +}; + +struct stat_session { + struct list_head session_list; + struct tracer_stat *ts; + struct rb_root stat_root; + struct mutex stat_mutex; + struct dentry *file; +}; + +struct trace_bprintk_fmt { + struct list_head list; + const char *fmt; +}; + +typedef int (*tracing_map_cmp_fn_t)(void *, void *); + +struct tracing_map_field { + tracing_map_cmp_fn_t cmp_fn; + union { + atomic64_t sum; + unsigned int offset; + }; +}; + +struct tracing_map; + +struct tracing_map_elt { + struct tracing_map *map; + struct tracing_map_field *fields; + atomic64_t *vars; + bool *var_set; + void *key; + void *private_data; +}; + +struct tracing_map_sort_key { + unsigned int field_idx; + bool descending; +}; + +struct tracing_map_array; + +struct tracing_map_ops; + +struct tracing_map { + unsigned int key_size; + unsigned int map_bits; + unsigned int map_size; + unsigned int max_elts; + atomic_t next_elt; + struct tracing_map_array *elts; + struct tracing_map_array *map; + const struct tracing_map_ops *ops; + void *private_data; + struct tracing_map_field fields[6]; + unsigned int n_fields; + int key_idx[3]; + unsigned int n_keys; + struct tracing_map_sort_key sort_key; + unsigned int n_vars; + atomic64_t hits; + atomic64_t drops; +}; + +struct tracing_map_entry { + u32 key; + struct tracing_map_elt *val; +}; + +struct tracing_map_sort_entry { + void *key; + struct tracing_map_elt *elt; + bool elt_copied; + bool dup; +}; + +struct tracing_map_array { + unsigned int entries_per_page; + unsigned int entry_size_shift; + unsigned int entry_shift; + unsigned int entry_mask; + unsigned int n_pages; + void **pages; +}; + +struct tracing_map_ops { + int (*elt_alloc)(struct tracing_map_elt *); + void (*elt_free)(struct tracing_map_elt *); + void (*elt_clear)(struct tracing_map_elt *); + void (*elt_init)(struct tracing_map_elt *); +}; + +enum { + TRACE_FUNC_OPT_STACK = 1, +}; + +struct hwlat_sample { + u64 seqnum; + u64 duration; + u64 outer_duration; + u64 nmi_total_ts; + struct timespec64 timestamp; + int nmi_count; + int count; +}; + +struct hwlat_data { + struct mutex lock; + u64 count; + u64 sample_window; + u64 sample_width; +}; + +enum { + TRACE_NOP_OPT_ACCEPT = 1, + TRACE_NOP_OPT_REFUSE = 2, +}; + +struct trace_mmiotrace_rw { + struct trace_entry ent; + struct mmiotrace_rw rw; +}; + +struct trace_mmiotrace_map { + struct trace_entry ent; + struct mmiotrace_map map; +}; + +struct header_iter { + struct pci_dev *dev; +}; + +struct ftrace_graph_ent_entry { + struct trace_entry ent; + struct ftrace_graph_ent graph_ent; +} __attribute__((packed)); + +struct ftrace_graph_ret_entry { + struct trace_entry ent; + struct ftrace_graph_ret ret; +}; + +struct fgraph_cpu_data { + pid_t last_pid; + int depth; + int depth_irq; + int ignore; + long unsigned int enter_funcs[50]; +}; + +struct fgraph_data { + struct fgraph_cpu_data *cpu_data; + struct ftrace_graph_ent_entry ent; + struct ftrace_graph_ret_entry ret; + int failed; + int cpu; + int: 32; +} __attribute__((packed)); + +enum { + FLAGS_FILL_FULL = 268435456, + FLAGS_FILL_START = 536870912, + FLAGS_FILL_END = 805306368, +}; + +struct disk_stats { + u64 nsecs[4]; + long unsigned int sectors[4]; + long unsigned int ios[4]; + long unsigned int merges[4]; + long unsigned int io_ticks; + local_t in_flight[2]; +}; + +struct blk_crypto_key; + +struct bio_crypt_ctx { + const struct blk_crypto_key *bc_key; + u64 bc_dun[4]; +}; + +typedef __u32 blk_mq_req_flags_t; + +struct blk_mq_ctxs; + +struct blk_mq_ctx { + struct { + spinlock_t lock; + struct list_head rq_lists[3]; + long: 64; + }; + unsigned int cpu; + short unsigned int index_hw[3]; + struct blk_mq_hw_ctx *hctxs[3]; + long unsigned int rq_dispatched[2]; + long unsigned int rq_merged; + long unsigned int rq_completed[2]; + struct request_queue *queue; + struct blk_mq_ctxs *ctxs; + struct kobject kobj; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct sbitmap_word; + +struct sbitmap { + unsigned int depth; + unsigned int shift; + unsigned int map_nr; + struct sbitmap_word *map; +}; + +struct blk_mq_tags; + +struct blk_mq_hw_ctx { + struct { + spinlock_t lock; + struct list_head dispatch; + long unsigned int state; + long: 64; + long: 64; + long: 64; + long: 64; + }; + struct delayed_work run_work; + cpumask_var_t cpumask; + int next_cpu; + int next_cpu_batch; + long unsigned int flags; + void *sched_data; + struct request_queue *queue; + struct blk_flush_queue *fq; + void *driver_data; + struct sbitmap ctx_map; + struct blk_mq_ctx *dispatch_from; + unsigned int dispatch_busy; + short unsigned int type; + short unsigned int nr_ctx; + struct blk_mq_ctx **ctxs; + spinlock_t dispatch_wait_lock; + wait_queue_entry_t dispatch_wait; + atomic_t wait_index; + struct blk_mq_tags *tags; + struct blk_mq_tags *sched_tags; + long unsigned int queued; + long unsigned int run; + long unsigned int dispatched[7]; + unsigned int numa_node; + unsigned int queue_num; + atomic_t nr_active; + atomic_t elevator_queued; + struct hlist_node cpuhp_online; + struct hlist_node cpuhp_dead; + struct kobject kobj; + long unsigned int poll_considered; + long unsigned int poll_invoked; + long unsigned int poll_success; + struct dentry *debugfs_dir; + struct dentry *sched_debugfs_dir; + struct list_head hctx_list; + struct srcu_struct srcu[0]; + long: 64; +}; + +struct blk_mq_alloc_data { + struct request_queue *q; + blk_mq_req_flags_t flags; + unsigned int shallow_depth; + unsigned int cmd_flags; + struct blk_mq_ctx *ctx; + struct blk_mq_hw_ctx *hctx; +}; + +struct blk_stat_callback { + struct list_head list; + struct timer_list timer; + struct blk_rq_stat *cpu_stat; + int (*bucket_fn)(const struct request *); + unsigned int buckets; + struct blk_rq_stat *stat; + void (*timer_fn)(struct blk_stat_callback *); + void *data; + struct callback_head rcu; +}; + +struct blk_trace { + int trace_state; + struct rchan *rchan; + long unsigned int *sequence; + unsigned char *msg_data; + u16 act_mask; + u64 start_lba; + u64 end_lba; + u32 pid; + u32 dev; + struct dentry *dir; + struct dentry *dropped_file; + struct dentry *msg_file; + struct list_head running_list; + atomic_t dropped; +}; + +struct blk_flush_queue { + unsigned int flush_pending_idx: 1; + unsigned int flush_running_idx: 1; + blk_status_t rq_status; + long unsigned int flush_pending_since; + struct list_head flush_queue[2]; + struct list_head flush_data_in_flight; + struct request *flush_rq; + spinlock_t mq_flush_lock; +}; + +struct blk_mq_queue_map { + unsigned int *mq_map; + unsigned int nr_queues; + unsigned int queue_offset; +}; + +struct sbq_wait_state; + +struct sbitmap_queue { + struct sbitmap sb; + unsigned int *alloc_hint; + unsigned int wake_batch; + atomic_t wake_index; + struct sbq_wait_state *ws; + atomic_t ws_active; + bool round_robin; + unsigned int min_shallow_depth; +}; + +struct blk_mq_tag_set { + struct blk_mq_queue_map map[3]; + unsigned int nr_maps; + const struct blk_mq_ops *ops; + unsigned int nr_hw_queues; + unsigned int queue_depth; + unsigned int reserved_tags; + unsigned int cmd_size; + int numa_node; + unsigned int timeout; + unsigned int flags; + void *driver_data; + atomic_t active_queues_shared_sbitmap; + struct sbitmap_queue __bitmap_tags; + struct sbitmap_queue __breserved_tags; + struct blk_mq_tags **tags; + struct mutex tag_list_lock; + struct list_head tag_list; +}; + +typedef u64 compat_u64; + +enum blktrace_cat { + BLK_TC_READ = 1, + BLK_TC_WRITE = 2, + BLK_TC_FLUSH = 4, + BLK_TC_SYNC = 8, + BLK_TC_SYNCIO = 8, + BLK_TC_QUEUE = 16, + BLK_TC_REQUEUE = 32, + BLK_TC_ISSUE = 64, + BLK_TC_COMPLETE = 128, + BLK_TC_FS = 256, + BLK_TC_PC = 512, + BLK_TC_NOTIFY = 1024, + BLK_TC_AHEAD = 2048, + BLK_TC_META = 4096, + BLK_TC_DISCARD = 8192, + BLK_TC_DRV_DATA = 16384, + BLK_TC_FUA = 32768, + BLK_TC_END = 32768, +}; + +enum blktrace_act { + __BLK_TA_QUEUE = 1, + __BLK_TA_BACKMERGE = 2, + __BLK_TA_FRONTMERGE = 3, + __BLK_TA_GETRQ = 4, + __BLK_TA_SLEEPRQ = 5, + __BLK_TA_REQUEUE = 6, + __BLK_TA_ISSUE = 7, + __BLK_TA_COMPLETE = 8, + __BLK_TA_PLUG = 9, + __BLK_TA_UNPLUG_IO = 10, + __BLK_TA_UNPLUG_TIMER = 11, + __BLK_TA_INSERT = 12, + __BLK_TA_SPLIT = 13, + __BLK_TA_BOUNCE = 14, + __BLK_TA_REMAP = 15, + __BLK_TA_ABORT = 16, + __BLK_TA_DRV_DATA = 17, + __BLK_TA_CGROUP = 256, +}; + +enum blktrace_notify { + __BLK_TN_PROCESS = 0, + __BLK_TN_TIMESTAMP = 1, + __BLK_TN_MESSAGE = 2, + __BLK_TN_CGROUP = 256, +}; + +struct blk_io_trace { + __u32 magic; + __u32 sequence; + __u64 time; + __u64 sector; + __u32 bytes; + __u32 action; + __u32 pid; + __u32 device; + __u32 cpu; + __u16 error; + __u16 pdu_len; +}; + +struct blk_io_trace_remap { + __be32 device_from; + __be32 device_to; + __be64 sector_from; +}; + +enum { + Blktrace_setup = 1, + Blktrace_running = 2, + Blktrace_stopped = 3, +}; + +struct blk_user_trace_setup { + char name[32]; + __u16 act_mask; + __u32 buf_size; + __u32 buf_nr; + __u64 start_lba; + __u64 end_lba; + __u32 pid; +}; + +struct compat_blk_user_trace_setup { + char name[32]; + u16 act_mask; + short: 16; + u32 buf_size; + u32 buf_nr; + compat_u64 start_lba; + compat_u64 end_lba; + u32 pid; +} __attribute__((packed)); + +struct sbitmap_word { + long unsigned int depth; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long unsigned int word; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long unsigned int cleared; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct sbq_wait_state { + atomic_t wait_cnt; + wait_queue_head_t wait; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct blk_mq_tags { + unsigned int nr_tags; + unsigned int nr_reserved_tags; + atomic_t active_queues; + struct sbitmap_queue *bitmap_tags; + struct sbitmap_queue *breserved_tags; + struct sbitmap_queue __bitmap_tags; + struct sbitmap_queue __breserved_tags; + struct request **rqs; + struct request **static_rqs; + struct list_head page_list; +}; + +struct blk_mq_queue_data { + struct request *rq; + bool last; +}; + +enum blk_crypto_mode_num { + BLK_ENCRYPTION_MODE_INVALID = 0, + BLK_ENCRYPTION_MODE_AES_256_XTS = 1, + BLK_ENCRYPTION_MODE_AES_128_CBC_ESSIV = 2, + BLK_ENCRYPTION_MODE_ADIANTUM = 3, + BLK_ENCRYPTION_MODE_MAX = 4, +}; + +struct blk_crypto_config { + enum blk_crypto_mode_num crypto_mode; + unsigned int data_unit_size; + unsigned int dun_bytes; +}; + +struct blk_crypto_key { + struct blk_crypto_config crypto_cfg; + unsigned int data_unit_size_bits; + unsigned int size; + u8 raw[64]; +}; + +struct blk_mq_ctxs { + struct kobject kobj; + struct blk_mq_ctx *queue_ctx; +}; + +typedef void blk_log_action_t(struct trace_iterator *, const char *, bool); + +struct ftrace_event_field { + struct list_head link; + const char *name; + const char *type; + int filter_type; + int offset; + int size; + int is_signed; +}; + +enum { + FORMAT_HEADER = 1, + FORMAT_FIELD_SEPERATOR = 2, + FORMAT_PRINTFMT = 3, +}; + +struct event_probe_data { + struct trace_event_file *file; + long unsigned int count; + int ref; + bool enable; +}; + +struct syscall_trace_enter { + struct trace_entry ent; + int nr; + long unsigned int args[0]; +}; + +struct syscall_trace_exit { + struct trace_entry ent; + int nr; + long int ret; +}; + +struct syscall_tp_t { + long long unsigned int regs; + long unsigned int syscall_nr; + long unsigned int ret; +}; + +struct syscall_tp_t___2 { + long long unsigned int regs; + long unsigned int syscall_nr; + long unsigned int args[6]; +}; + +typedef long unsigned int perf_trace_t[256]; + +struct filter_pred; + +struct prog_entry { + int target; + int when_to_branch; + struct filter_pred *pred; +}; + +typedef int (*filter_pred_fn_t)(struct filter_pred *, void *); + +struct regex; + +typedef int (*regex_match_func)(char *, struct regex *, int); + +struct regex { + char pattern[256]; + int len; + int field_len; + regex_match_func match; +}; + +struct filter_pred { + filter_pred_fn_t fn; + u64 val; + struct regex regex; + short unsigned int *ops; + struct ftrace_event_field *field; + int offset; + int not; + int op; +}; + +enum filter_op_ids { + OP_GLOB = 0, + OP_NE = 1, + OP_EQ = 2, + OP_LE = 3, + OP_LT = 4, + OP_GE = 5, + OP_GT = 6, + OP_BAND = 7, + OP_MAX = 8, +}; + +enum { + FILT_ERR_NONE = 0, + FILT_ERR_INVALID_OP = 1, + FILT_ERR_TOO_MANY_OPEN = 2, + FILT_ERR_TOO_MANY_CLOSE = 3, + FILT_ERR_MISSING_QUOTE = 4, + FILT_ERR_OPERAND_TOO_LONG = 5, + FILT_ERR_EXPECT_STRING = 6, + FILT_ERR_EXPECT_DIGIT = 7, + FILT_ERR_ILLEGAL_FIELD_OP = 8, + FILT_ERR_FIELD_NOT_FOUND = 9, + FILT_ERR_ILLEGAL_INTVAL = 10, + FILT_ERR_BAD_SUBSYS_FILTER = 11, + FILT_ERR_TOO_MANY_PREDS = 12, + FILT_ERR_INVALID_FILTER = 13, + FILT_ERR_IP_FIELD_ONLY = 14, + FILT_ERR_INVALID_VALUE = 15, + FILT_ERR_ERRNO = 16, + FILT_ERR_NO_FILTER = 17, +}; + +struct filter_parse_error { + int lasterr; + int lasterr_pos; +}; + +typedef int (*parse_pred_fn)(const char *, void *, int, struct filter_parse_error *, struct filter_pred **); + +enum { + INVERT = 1, + PROCESS_AND = 2, + PROCESS_OR = 4, +}; + +enum { + TOO_MANY_CLOSE = 4294967295, + TOO_MANY_OPEN = 4294967294, + MISSING_QUOTE = 4294967293, +}; + +struct filter_list { + struct list_head list; + struct event_filter *filter; +}; + +struct function_filter_data { + struct ftrace_ops *ops; + int first_filter; + int first_notrace; +}; + +struct event_trigger_ops; + +struct event_command; + +struct event_trigger_data { + long unsigned int count; + int ref; + struct event_trigger_ops *ops; + struct event_command *cmd_ops; + struct event_filter *filter; + char *filter_str; + void *private_data; + bool paused; + bool paused_tmp; + struct list_head list; + char *name; + struct list_head named_list; + struct event_trigger_data *named_data; +}; + +struct event_trigger_ops { + void (*func)(struct event_trigger_data *, void *, struct ring_buffer_event *); + int (*init)(struct event_trigger_ops *, struct event_trigger_data *); + void (*free)(struct event_trigger_ops *, struct event_trigger_data *); + int (*print)(struct seq_file *, struct event_trigger_ops *, struct event_trigger_data *); +}; + +struct event_command { + struct list_head list; + char *name; + enum event_trigger_type trigger_type; + int flags; + int (*func)(struct event_command *, struct trace_event_file *, char *, char *, char *); + int (*reg)(char *, struct event_trigger_ops *, struct event_trigger_data *, struct trace_event_file *); + void (*unreg)(char *, struct event_trigger_ops *, struct event_trigger_data *, struct trace_event_file *); + void (*unreg_all)(struct trace_event_file *); + int (*set_filter)(char *, struct event_trigger_data *, struct trace_event_file *); + struct event_trigger_ops * (*get_trigger_ops)(char *, char *); +}; + +struct enable_trigger_data { + struct trace_event_file *file; + bool enable; + bool hist; +}; + +enum event_command_flags { + EVENT_CMD_FL_POST_TRIGGER = 1, + EVENT_CMD_FL_NEEDS_REC = 2, +}; + +enum dynevent_type { + DYNEVENT_TYPE_SYNTH = 1, + DYNEVENT_TYPE_KPROBE = 2, + DYNEVENT_TYPE_NONE = 3, +}; + +struct dynevent_cmd; + +typedef int (*dynevent_create_fn_t)(struct dynevent_cmd *); + +struct dynevent_cmd { + struct seq_buf seq; + const char *event_name; + unsigned int n_fields; + enum dynevent_type type; + dynevent_create_fn_t run_command; + void *private_data; +}; + +struct synth_field_desc { + const char *type; + const char *name; +}; + +struct synth_trace_event; + +struct synth_event; + +struct synth_event_trace_state { + struct trace_event_buffer fbuffer; + struct synth_trace_event *entry; + struct trace_buffer *buffer; + struct synth_event *event; + unsigned int cur_field; + unsigned int n_u64; + bool disabled; + bool add_next; + bool add_name; +}; + +struct synth_trace_event { + struct trace_entry ent; + u64 fields[0]; +}; + +struct dyn_event_operations; + +struct dyn_event { + struct list_head list; + struct dyn_event_operations *ops; +}; + +struct synth_field; + +struct synth_event { + struct dyn_event devent; + int ref; + char *name; + struct synth_field **fields; + unsigned int n_fields; + struct synth_field **dynamic_fields; + unsigned int n_dynamic_fields; + unsigned int n_u64; + struct trace_event_class class; + struct trace_event_call call; + struct tracepoint *tp; + struct module *mod; +}; + +struct dyn_event_operations { + struct list_head list; + int (*create)(int, const char **); + int (*show)(struct seq_file *, struct dyn_event *); + bool (*is_busy)(struct dyn_event *); + int (*free)(struct dyn_event *); + bool (*match)(const char *, const char *, int, const char **, struct dyn_event *); +}; + +typedef int (*dynevent_check_arg_fn_t)(void *); + +struct dynevent_arg { + const char *str; + char separator; +}; + +struct dynevent_arg_pair { + const char *lhs; + const char *rhs; + char operator; + char separator; +}; + +struct synth_field { + char *type; + char *name; + size_t size; + unsigned int offset; + bool is_signed; + bool is_string; + bool is_dynamic; + bool field_pos; +}; + +enum { + SYNTH_ERR_BAD_NAME = 0, + SYNTH_ERR_CMD_INCOMPLETE = 1, + SYNTH_ERR_EVENT_EXISTS = 2, + SYNTH_ERR_TOO_MANY_FIELDS = 3, + SYNTH_ERR_INCOMPLETE_TYPE = 4, + SYNTH_ERR_INVALID_TYPE = 5, + SYNTH_ERR_INVALID_FIELD = 6, + SYNTH_ERR_CMD_TOO_LONG = 7, +}; + +enum { + HIST_ERR_NONE = 0, + HIST_ERR_DUPLICATE_VAR = 1, + HIST_ERR_VAR_NOT_UNIQUE = 2, + HIST_ERR_TOO_MANY_VARS = 3, + HIST_ERR_MALFORMED_ASSIGNMENT = 4, + HIST_ERR_NAMED_MISMATCH = 5, + HIST_ERR_TRIGGER_EEXIST = 6, + HIST_ERR_TRIGGER_ENOENT_CLEAR = 7, + HIST_ERR_SET_CLOCK_FAIL = 8, + HIST_ERR_BAD_FIELD_MODIFIER = 9, + HIST_ERR_TOO_MANY_SUBEXPR = 10, + HIST_ERR_TIMESTAMP_MISMATCH = 11, + HIST_ERR_TOO_MANY_FIELD_VARS = 12, + HIST_ERR_EVENT_FILE_NOT_FOUND = 13, + HIST_ERR_HIST_NOT_FOUND = 14, + HIST_ERR_HIST_CREATE_FAIL = 15, + HIST_ERR_SYNTH_VAR_NOT_FOUND = 16, + HIST_ERR_SYNTH_EVENT_NOT_FOUND = 17, + HIST_ERR_SYNTH_TYPE_MISMATCH = 18, + HIST_ERR_SYNTH_COUNT_MISMATCH = 19, + HIST_ERR_FIELD_VAR_PARSE_FAIL = 20, + HIST_ERR_VAR_CREATE_FIND_FAIL = 21, + HIST_ERR_ONX_NOT_VAR = 22, + HIST_ERR_ONX_VAR_NOT_FOUND = 23, + HIST_ERR_ONX_VAR_CREATE_FAIL = 24, + HIST_ERR_FIELD_VAR_CREATE_FAIL = 25, + HIST_ERR_TOO_MANY_PARAMS = 26, + HIST_ERR_PARAM_NOT_FOUND = 27, + HIST_ERR_INVALID_PARAM = 28, + HIST_ERR_ACTION_NOT_FOUND = 29, + HIST_ERR_NO_SAVE_PARAMS = 30, + HIST_ERR_TOO_MANY_SAVE_ACTIONS = 31, + HIST_ERR_ACTION_MISMATCH = 32, + HIST_ERR_NO_CLOSING_PAREN = 33, + HIST_ERR_SUBSYS_NOT_FOUND = 34, + HIST_ERR_INVALID_SUBSYS_EVENT = 35, + HIST_ERR_INVALID_REF_KEY = 36, + HIST_ERR_VAR_NOT_FOUND = 37, + HIST_ERR_FIELD_NOT_FOUND = 38, + HIST_ERR_EMPTY_ASSIGNMENT = 39, + HIST_ERR_INVALID_SORT_MODIFIER = 40, + HIST_ERR_EMPTY_SORT_FIELD = 41, + HIST_ERR_TOO_MANY_SORT_FIELDS = 42, + HIST_ERR_INVALID_SORT_FIELD = 43, +}; + +struct hist_field; + +typedef u64 (*hist_field_fn_t)(struct hist_field *, struct tracing_map_elt *, struct ring_buffer_event *, void *); + +struct hist_trigger_data; + +struct hist_var { + char *name; + struct hist_trigger_data *hist_data; + unsigned int idx; +}; + +enum field_op_id { + FIELD_OP_NONE = 0, + FIELD_OP_PLUS = 1, + FIELD_OP_MINUS = 2, + FIELD_OP_UNARY_MINUS = 3, +}; + +struct hist_field { + struct ftrace_event_field *field; + long unsigned int flags; + hist_field_fn_t fn; + unsigned int ref; + unsigned int size; + unsigned int offset; + unsigned int is_signed; + const char *type; + struct hist_field *operands[2]; + struct hist_trigger_data *hist_data; + struct hist_var var; + enum field_op_id operator; + char *system; + char *event_name; + char *name; + unsigned int var_ref_idx; + bool read_once; + unsigned int var_str_idx; +}; + +struct hist_trigger_attrs; + +struct action_data; + +struct field_var; + +struct field_var_hist; + +struct hist_trigger_data { + struct hist_field *fields[22]; + unsigned int n_vals; + unsigned int n_keys; + unsigned int n_fields; + unsigned int n_vars; + unsigned int n_var_str; + unsigned int key_size; + struct tracing_map_sort_key sort_keys[2]; + unsigned int n_sort_keys; + struct trace_event_file *event_file; + struct hist_trigger_attrs *attrs; + struct tracing_map *map; + bool enable_timestamps; + bool remove; + struct hist_field *var_refs[16]; + unsigned int n_var_refs; + struct action_data *actions[8]; + unsigned int n_actions; + struct field_var *field_vars[32]; + unsigned int n_field_vars; + unsigned int n_field_var_str; + struct field_var_hist *field_var_hists[32]; + unsigned int n_field_var_hists; + struct field_var *save_vars[32]; + unsigned int n_save_vars; + unsigned int n_save_var_str; +}; + +enum hist_field_flags { + HIST_FIELD_FL_HITCOUNT = 1, + HIST_FIELD_FL_KEY = 2, + HIST_FIELD_FL_STRING = 4, + HIST_FIELD_FL_HEX = 8, + HIST_FIELD_FL_SYM = 16, + HIST_FIELD_FL_SYM_OFFSET = 32, + HIST_FIELD_FL_EXECNAME = 64, + HIST_FIELD_FL_SYSCALL = 128, + HIST_FIELD_FL_STACKTRACE = 256, + HIST_FIELD_FL_LOG2 = 512, + HIST_FIELD_FL_TIMESTAMP = 1024, + HIST_FIELD_FL_TIMESTAMP_USECS = 2048, + HIST_FIELD_FL_VAR = 4096, + HIST_FIELD_FL_EXPR = 8192, + HIST_FIELD_FL_VAR_REF = 16384, + HIST_FIELD_FL_CPU = 32768, + HIST_FIELD_FL_ALIAS = 65536, +}; + +struct var_defs { + unsigned int n_vars; + char *name[16]; + char *expr[16]; +}; + +struct hist_trigger_attrs { + char *keys_str; + char *vals_str; + char *sort_key_str; + char *name; + char *clock; + bool pause; + bool cont; + bool clear; + bool ts_in_usecs; + unsigned int map_bits; + char *assignment_str[16]; + unsigned int n_assignments; + char *action_str[8]; + unsigned int n_actions; + struct var_defs var_defs; +}; + +struct field_var { + struct hist_field *var; + struct hist_field *val; +}; + +struct field_var_hist { + struct hist_trigger_data *hist_data; + char *cmd; +}; + +enum handler_id { + HANDLER_ONMATCH = 1, + HANDLER_ONMAX = 2, + HANDLER_ONCHANGE = 3, +}; + +enum action_id { + ACTION_SAVE = 1, + ACTION_TRACE = 2, + ACTION_SNAPSHOT = 3, +}; + +typedef void (*action_fn_t)(struct hist_trigger_data *, struct tracing_map_elt *, void *, struct ring_buffer_event *, void *, struct action_data *, u64 *); + +typedef bool (*check_track_val_fn_t)(u64, u64); + +struct action_data { + enum handler_id handler; + enum action_id action; + char *action_name; + action_fn_t fn; + unsigned int n_params; + char *params[32]; + unsigned int var_ref_idx[16]; + struct synth_event *synth_event; + bool use_trace_keyword; + char *synth_event_name; + union { + struct { + char *event; + char *event_system; + } match_data; + struct { + char *var_str; + struct hist_field *var_ref; + struct hist_field *track_var; + check_track_val_fn_t check_val; + action_fn_t save_data; + } track_data; + }; +}; + +struct track_data { + u64 track_val; + bool updated; + unsigned int key_len; + void *key; + struct tracing_map_elt elt; + struct action_data *action_data; + struct hist_trigger_data *hist_data; +}; + +struct hist_elt_data { + char *comm; + u64 *var_ref_vals; + char *field_var_str[32]; +}; + +struct snapshot_context { + struct tracing_map_elt *elt; + void *key; +}; + +typedef void (*synth_probe_func_t)(void *, u64 *, unsigned int *); + +struct hist_var_data { + struct list_head list; + struct hist_trigger_data *hist_data; +}; + +enum bpf_func_id { + BPF_FUNC_unspec = 0, + BPF_FUNC_map_lookup_elem = 1, + BPF_FUNC_map_update_elem = 2, + BPF_FUNC_map_delete_elem = 3, + BPF_FUNC_probe_read = 4, + BPF_FUNC_ktime_get_ns = 5, + BPF_FUNC_trace_printk = 6, + BPF_FUNC_get_prandom_u32 = 7, + BPF_FUNC_get_smp_processor_id = 8, + BPF_FUNC_skb_store_bytes = 9, + BPF_FUNC_l3_csum_replace = 10, + BPF_FUNC_l4_csum_replace = 11, + BPF_FUNC_tail_call = 12, + BPF_FUNC_clone_redirect = 13, + BPF_FUNC_get_current_pid_tgid = 14, + BPF_FUNC_get_current_uid_gid = 15, + BPF_FUNC_get_current_comm = 16, + BPF_FUNC_get_cgroup_classid = 17, + BPF_FUNC_skb_vlan_push = 18, + BPF_FUNC_skb_vlan_pop = 19, + BPF_FUNC_skb_get_tunnel_key = 20, + BPF_FUNC_skb_set_tunnel_key = 21, + BPF_FUNC_perf_event_read = 22, + BPF_FUNC_redirect = 23, + BPF_FUNC_get_route_realm = 24, + BPF_FUNC_perf_event_output = 25, + BPF_FUNC_skb_load_bytes = 26, + BPF_FUNC_get_stackid = 27, + BPF_FUNC_csum_diff = 28, + BPF_FUNC_skb_get_tunnel_opt = 29, + BPF_FUNC_skb_set_tunnel_opt = 30, + BPF_FUNC_skb_change_proto = 31, + BPF_FUNC_skb_change_type = 32, + BPF_FUNC_skb_under_cgroup = 33, + BPF_FUNC_get_hash_recalc = 34, + BPF_FUNC_get_current_task = 35, + BPF_FUNC_probe_write_user = 36, + BPF_FUNC_current_task_under_cgroup = 37, + BPF_FUNC_skb_change_tail = 38, + BPF_FUNC_skb_pull_data = 39, + BPF_FUNC_csum_update = 40, + BPF_FUNC_set_hash_invalid = 41, + BPF_FUNC_get_numa_node_id = 42, + BPF_FUNC_skb_change_head = 43, + BPF_FUNC_xdp_adjust_head = 44, + BPF_FUNC_probe_read_str = 45, + BPF_FUNC_get_socket_cookie = 46, + BPF_FUNC_get_socket_uid = 47, + BPF_FUNC_set_hash = 48, + BPF_FUNC_setsockopt = 49, + BPF_FUNC_skb_adjust_room = 50, + BPF_FUNC_redirect_map = 51, + BPF_FUNC_sk_redirect_map = 52, + BPF_FUNC_sock_map_update = 53, + BPF_FUNC_xdp_adjust_meta = 54, + BPF_FUNC_perf_event_read_value = 55, + BPF_FUNC_perf_prog_read_value = 56, + BPF_FUNC_getsockopt = 57, + BPF_FUNC_override_return = 58, + BPF_FUNC_sock_ops_cb_flags_set = 59, + BPF_FUNC_msg_redirect_map = 60, + BPF_FUNC_msg_apply_bytes = 61, + BPF_FUNC_msg_cork_bytes = 62, + BPF_FUNC_msg_pull_data = 63, + BPF_FUNC_bind = 64, + BPF_FUNC_xdp_adjust_tail = 65, + BPF_FUNC_skb_get_xfrm_state = 66, + BPF_FUNC_get_stack = 67, + BPF_FUNC_skb_load_bytes_relative = 68, + BPF_FUNC_fib_lookup = 69, + BPF_FUNC_sock_hash_update = 70, + BPF_FUNC_msg_redirect_hash = 71, + BPF_FUNC_sk_redirect_hash = 72, + BPF_FUNC_lwt_push_encap = 73, + BPF_FUNC_lwt_seg6_store_bytes = 74, + BPF_FUNC_lwt_seg6_adjust_srh = 75, + BPF_FUNC_lwt_seg6_action = 76, + BPF_FUNC_rc_repeat = 77, + BPF_FUNC_rc_keydown = 78, + BPF_FUNC_skb_cgroup_id = 79, + BPF_FUNC_get_current_cgroup_id = 80, + BPF_FUNC_get_local_storage = 81, + BPF_FUNC_sk_select_reuseport = 82, + BPF_FUNC_skb_ancestor_cgroup_id = 83, + BPF_FUNC_sk_lookup_tcp = 84, + BPF_FUNC_sk_lookup_udp = 85, + BPF_FUNC_sk_release = 86, + BPF_FUNC_map_push_elem = 87, + BPF_FUNC_map_pop_elem = 88, + BPF_FUNC_map_peek_elem = 89, + BPF_FUNC_msg_push_data = 90, + BPF_FUNC_msg_pop_data = 91, + BPF_FUNC_rc_pointer_rel = 92, + BPF_FUNC_spin_lock = 93, + BPF_FUNC_spin_unlock = 94, + BPF_FUNC_sk_fullsock = 95, + BPF_FUNC_tcp_sock = 96, + BPF_FUNC_skb_ecn_set_ce = 97, + BPF_FUNC_get_listener_sock = 98, + BPF_FUNC_skc_lookup_tcp = 99, + BPF_FUNC_tcp_check_syncookie = 100, + BPF_FUNC_sysctl_get_name = 101, + BPF_FUNC_sysctl_get_current_value = 102, + BPF_FUNC_sysctl_get_new_value = 103, + BPF_FUNC_sysctl_set_new_value = 104, + BPF_FUNC_strtol = 105, + BPF_FUNC_strtoul = 106, + BPF_FUNC_sk_storage_get = 107, + BPF_FUNC_sk_storage_delete = 108, + BPF_FUNC_send_signal = 109, + BPF_FUNC_tcp_gen_syncookie = 110, + BPF_FUNC_skb_output = 111, + BPF_FUNC_probe_read_user = 112, + BPF_FUNC_probe_read_kernel = 113, + BPF_FUNC_probe_read_user_str = 114, + BPF_FUNC_probe_read_kernel_str = 115, + BPF_FUNC_tcp_send_ack = 116, + BPF_FUNC_send_signal_thread = 117, + BPF_FUNC_jiffies64 = 118, + BPF_FUNC_read_branch_records = 119, + BPF_FUNC_get_ns_current_pid_tgid = 120, + BPF_FUNC_xdp_output = 121, + BPF_FUNC_get_netns_cookie = 122, + BPF_FUNC_get_current_ancestor_cgroup_id = 123, + BPF_FUNC_sk_assign = 124, + BPF_FUNC_ktime_get_boot_ns = 125, + BPF_FUNC_seq_printf = 126, + BPF_FUNC_seq_write = 127, + BPF_FUNC_sk_cgroup_id = 128, + BPF_FUNC_sk_ancestor_cgroup_id = 129, + BPF_FUNC_ringbuf_output = 130, + BPF_FUNC_ringbuf_reserve = 131, + BPF_FUNC_ringbuf_submit = 132, + BPF_FUNC_ringbuf_discard = 133, + BPF_FUNC_ringbuf_query = 134, + BPF_FUNC_csum_level = 135, + BPF_FUNC_skc_to_tcp6_sock = 136, + BPF_FUNC_skc_to_tcp_sock = 137, + BPF_FUNC_skc_to_tcp_timewait_sock = 138, + BPF_FUNC_skc_to_tcp_request_sock = 139, + BPF_FUNC_skc_to_udp6_sock = 140, + BPF_FUNC_get_task_stack = 141, + BPF_FUNC_load_hdr_opt = 142, + BPF_FUNC_store_hdr_opt = 143, + BPF_FUNC_reserve_hdr_opt = 144, + BPF_FUNC_inode_storage_get = 145, + BPF_FUNC_inode_storage_delete = 146, + BPF_FUNC_d_path = 147, + BPF_FUNC_copy_from_user = 148, + BPF_FUNC_snprintf_btf = 149, + BPF_FUNC_seq_printf_btf = 150, + BPF_FUNC_skb_cgroup_classid = 151, + BPF_FUNC_redirect_neigh = 152, + BPF_FUNC_per_cpu_ptr = 153, + BPF_FUNC_this_cpu_ptr = 154, + BPF_FUNC_redirect_peer = 155, + BPF_FUNC_task_storage_get = 156, + BPF_FUNC_task_storage_delete = 157, + BPF_FUNC_get_current_task_btf = 158, + BPF_FUNC_bprm_opts_set = 159, + BPF_FUNC_ktime_get_coarse_ns = 160, + BPF_FUNC_ima_inode_hash = 161, + BPF_FUNC_sock_from_file = 162, + __BPF_FUNC_MAX_ID = 163, +}; + +enum { + BPF_F_INDEX_MASK = 4294967295, + BPF_F_CURRENT_CPU = 4294967295, + BPF_F_CTXLEN_MASK = 0, +}; + +enum { + BPF_F_GET_BRANCH_RECORDS_SIZE = 1, +}; + +struct bpf_perf_event_value { + __u64 counter; + __u64 enabled; + __u64 running; +}; + +struct bpf_raw_tracepoint_args { + __u64 args[0]; +}; + +enum bpf_task_fd_type { + BPF_FD_TYPE_RAW_TRACEPOINT = 0, + BPF_FD_TYPE_TRACEPOINT = 1, + BPF_FD_TYPE_KPROBE = 2, + BPF_FD_TYPE_KRETPROBE = 3, + BPF_FD_TYPE_UPROBE = 4, + BPF_FD_TYPE_URETPROBE = 5, +}; + +struct btf_ptr { + void *ptr; + __u32 type_id; + __u32 flags; +}; + +enum { + BTF_F_COMPACT = 1, + BTF_F_NONAME = 2, + BTF_F_PTR_RAW = 4, + BTF_F_ZERO = 8, +}; + +struct bpf_local_storage_map_bucket; + +struct bpf_local_storage_map { + struct bpf_map map; + struct bpf_local_storage_map_bucket *buckets; + u32 bucket_log; + u16 elem_size; + u16 cache_idx; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct bpf_local_storage_data; + +struct bpf_local_storage { + struct bpf_local_storage_data *cache[16]; + struct hlist_head list; + void *owner; + struct callback_head rcu; + raw_spinlock_t lock; +}; + +enum bpf_arg_type { + ARG_DONTCARE = 0, + ARG_CONST_MAP_PTR = 1, + ARG_PTR_TO_MAP_KEY = 2, + ARG_PTR_TO_MAP_VALUE = 3, + ARG_PTR_TO_UNINIT_MAP_VALUE = 4, + ARG_PTR_TO_MAP_VALUE_OR_NULL = 5, + ARG_PTR_TO_MEM = 6, + ARG_PTR_TO_MEM_OR_NULL = 7, + ARG_PTR_TO_UNINIT_MEM = 8, + ARG_CONST_SIZE = 9, + ARG_CONST_SIZE_OR_ZERO = 10, + ARG_PTR_TO_CTX = 11, + ARG_PTR_TO_CTX_OR_NULL = 12, + ARG_ANYTHING = 13, + ARG_PTR_TO_SPIN_LOCK = 14, + ARG_PTR_TO_SOCK_COMMON = 15, + ARG_PTR_TO_INT = 16, + ARG_PTR_TO_LONG = 17, + ARG_PTR_TO_SOCKET = 18, + ARG_PTR_TO_SOCKET_OR_NULL = 19, + ARG_PTR_TO_BTF_ID = 20, + ARG_PTR_TO_ALLOC_MEM = 21, + ARG_PTR_TO_ALLOC_MEM_OR_NULL = 22, + ARG_CONST_ALLOC_SIZE_OR_ZERO = 23, + ARG_PTR_TO_BTF_ID_SOCK_COMMON = 24, + ARG_PTR_TO_PERCPU_BTF_ID = 25, + __BPF_ARG_TYPE_MAX = 26, +}; + +enum bpf_return_type { + RET_INTEGER = 0, + RET_VOID = 1, + RET_PTR_TO_MAP_VALUE = 2, + RET_PTR_TO_MAP_VALUE_OR_NULL = 3, + RET_PTR_TO_SOCKET_OR_NULL = 4, + RET_PTR_TO_TCP_SOCK_OR_NULL = 5, + RET_PTR_TO_SOCK_COMMON_OR_NULL = 6, + RET_PTR_TO_ALLOC_MEM_OR_NULL = 7, + RET_PTR_TO_BTF_ID_OR_NULL = 8, + RET_PTR_TO_MEM_OR_BTF_ID_OR_NULL = 9, + RET_PTR_TO_MEM_OR_BTF_ID = 10, + RET_PTR_TO_BTF_ID = 11, +}; + +struct bpf_func_proto { + u64 (*func)(u64, u64, u64, u64, u64); + bool gpl_only; + bool pkt_access; + enum bpf_return_type ret_type; + union { + struct { + enum bpf_arg_type arg1_type; + enum bpf_arg_type arg2_type; + enum bpf_arg_type arg3_type; + enum bpf_arg_type arg4_type; + enum bpf_arg_type arg5_type; + }; + enum bpf_arg_type arg_type[5]; + }; + union { + struct { + u32 *arg1_btf_id; + u32 *arg2_btf_id; + u32 *arg3_btf_id; + u32 *arg4_btf_id; + u32 *arg5_btf_id; + }; + u32 *arg_btf_id[5]; + }; + int *ret_btf_id; + bool (*allowed)(const struct bpf_prog *); +}; + +enum bpf_access_type { + BPF_READ = 1, + BPF_WRITE = 2, +}; + +struct bpf_verifier_log; + +struct bpf_insn_access_aux { + enum bpf_reg_type reg_type; + union { + int ctx_field_size; + struct { + struct btf *btf; + u32 btf_id; + }; + }; + struct bpf_verifier_log *log; +}; + +struct bpf_verifier_ops { + const struct bpf_func_proto * (*get_func_proto)(enum bpf_func_id, const struct bpf_prog *); + bool (*is_valid_access)(int, int, enum bpf_access_type, const struct bpf_prog *, struct bpf_insn_access_aux *); + int (*gen_prologue)(struct bpf_insn *, bool, const struct bpf_prog *); + int (*gen_ld_abs)(const struct bpf_insn *, struct bpf_insn *); + u32 (*convert_ctx_access)(enum bpf_access_type, const struct bpf_insn *, struct bpf_insn *, struct bpf_prog *, u32 *); + int (*btf_struct_access)(struct bpf_verifier_log *, const struct btf *, const struct btf_type *, int, int, enum bpf_access_type, u32 *); +}; + +struct bpf_event_entry { + struct perf_event *event; + struct file *perf_file; + struct file *map_file; + struct callback_head rcu; +}; + +typedef long unsigned int (*bpf_ctx_copy_t)(void *, const void *, long unsigned int, long unsigned int); + +typedef struct pt_regs bpf_user_pt_regs_t; + +struct bpf_perf_event_data { + bpf_user_pt_regs_t regs; + __u64 sample_period; + __u64 addr; +}; + +struct perf_event_query_bpf { + __u32 ids_len; + __u32 prog_cnt; + __u32 ids[0]; +}; + +struct bpf_perf_event_data_kern { + bpf_user_pt_regs_t *regs; + struct perf_sample_data *data; + struct perf_event *event; +}; + +struct btf_id_set { + u32 cnt; + u32 ids[0]; +}; + +struct bpf_local_storage_map_bucket { + struct hlist_head list; + raw_spinlock_t lock; +}; + +struct bpf_local_storage_data { + struct bpf_local_storage_map *smap; + u8 data[0]; +}; + +struct trace_event_raw_bpf_trace_printk { + struct trace_entry ent; + u32 __data_loc_bpf_string; + char __data[0]; +}; + +struct trace_event_data_offsets_bpf_trace_printk { + u32 bpf_string; +}; + +typedef void (*btf_trace_bpf_trace_printk)(void *, const char *); + +struct bpf_trace_module { + struct module *module; + struct list_head list; +}; + +typedef u64 (*btf_bpf_probe_read_user)(void *, u32, const void *); + +typedef u64 (*btf_bpf_probe_read_user_str)(void *, u32, const void *); + +typedef u64 (*btf_bpf_probe_read_kernel)(void *, u32, const void *); + +typedef u64 (*btf_bpf_probe_read_kernel_str)(void *, u32, const void *); + +typedef u64 (*btf_bpf_probe_read_compat)(void *, u32, const void *); + +typedef u64 (*btf_bpf_probe_read_compat_str)(void *, u32, const void *); + +typedef u64 (*btf_bpf_probe_write_user)(void *, const void *, u32); + +typedef u64 (*btf_bpf_trace_printk)(char *, u32, u64, u64, u64); + +struct bpf_seq_printf_buf { + char buf[768]; +}; + +typedef u64 (*btf_bpf_seq_printf)(struct seq_file *, char *, u32, const void *, u32); + +typedef u64 (*btf_bpf_seq_write)(struct seq_file *, const void *, u32); + +typedef u64 (*btf_bpf_seq_printf_btf)(struct seq_file *, struct btf_ptr *, u32, u64); + +typedef u64 (*btf_bpf_perf_event_read)(struct bpf_map *, u64); + +typedef u64 (*btf_bpf_perf_event_read_value)(struct bpf_map *, u64, struct bpf_perf_event_value *, u32); + +struct bpf_trace_sample_data { + struct perf_sample_data sds[3]; +}; + +typedef u64 (*btf_bpf_perf_event_output)(struct pt_regs *, struct bpf_map *, u64, void *, u64); + +struct bpf_nested_pt_regs { + struct pt_regs regs[3]; +}; + +typedef u64 (*btf_bpf_get_current_task)(); + +typedef u64 (*btf_bpf_get_current_task_btf)(); + +typedef u64 (*btf_bpf_current_task_under_cgroup)(struct bpf_map *, u32); + +struct send_signal_irq_work { + struct irq_work irq_work; + struct task_struct *task; + u32 sig; + enum pid_type type; +}; + +typedef u64 (*btf_bpf_send_signal)(u32); + +typedef u64 (*btf_bpf_send_signal_thread)(u32); + +typedef u64 (*btf_bpf_d_path)(struct path *, char *, u32); + +typedef u64 (*btf_bpf_snprintf_btf)(char *, u32, struct btf_ptr *, u32, u64); + +typedef u64 (*btf_bpf_perf_event_output_tp)(void *, struct bpf_map *, u64, void *, u64); + +typedef u64 (*btf_bpf_get_stackid_tp)(void *, struct bpf_map *, u64); + +typedef u64 (*btf_bpf_get_stack_tp)(void *, void *, u32, u64); + +typedef u64 (*btf_bpf_perf_prog_read_value)(struct bpf_perf_event_data_kern *, struct bpf_perf_event_value *, u32); + +typedef u64 (*btf_bpf_read_branch_records)(struct bpf_perf_event_data_kern *, void *, u32, u64); + +struct bpf_raw_tp_regs { + struct pt_regs regs[3]; +}; + +typedef u64 (*btf_bpf_perf_event_output_raw_tp)(struct bpf_raw_tracepoint_args *, struct bpf_map *, u64, void *, u64); + +typedef u64 (*btf_bpf_get_stackid_raw_tp)(struct bpf_raw_tracepoint_args *, struct bpf_map *, u64); + +typedef u64 (*btf_bpf_get_stack_raw_tp)(struct bpf_raw_tracepoint_args *, void *, u32, u64); + +struct kprobe_trace_entry_head { + struct trace_entry ent; + long unsigned int ip; +}; + +struct kretprobe_trace_entry_head { + struct trace_entry ent; + long unsigned int func; + long unsigned int ret_ip; +}; + +typedef int (*print_type_func_t)(struct trace_seq *, void *, void *); + +enum fetch_op { + FETCH_OP_NOP = 0, + FETCH_OP_REG = 1, + FETCH_OP_STACK = 2, + FETCH_OP_STACKP = 3, + FETCH_OP_RETVAL = 4, + FETCH_OP_IMM = 5, + FETCH_OP_COMM = 6, + FETCH_OP_ARG = 7, + FETCH_OP_FOFFS = 8, + FETCH_OP_DATA = 9, + FETCH_OP_DEREF = 10, + FETCH_OP_UDEREF = 11, + FETCH_OP_ST_RAW = 12, + FETCH_OP_ST_MEM = 13, + FETCH_OP_ST_UMEM = 14, + FETCH_OP_ST_STRING = 15, + FETCH_OP_ST_USTRING = 16, + FETCH_OP_MOD_BF = 17, + FETCH_OP_LP_ARRAY = 18, + FETCH_OP_END = 19, + FETCH_NOP_SYMBOL = 20, +}; + +struct fetch_insn { + enum fetch_op op; + union { + unsigned int param; + struct { + unsigned int size; + int offset; + }; + struct { + unsigned char basesize; + unsigned char lshift; + unsigned char rshift; + }; + long unsigned int immediate; + void *data; + }; +}; + +struct fetch_type { + const char *name; + size_t size; + int is_signed; + print_type_func_t print; + const char *fmt; + const char *fmttype; +}; + +struct probe_arg { + struct fetch_insn *code; + bool dynamic; + unsigned int offset; + unsigned int count; + const char *name; + const char *comm; + char *fmt; + const struct fetch_type *type; +}; + +struct trace_uprobe_filter { + rwlock_t rwlock; + int nr_systemwide; + struct list_head perf_events; +}; + +struct trace_probe_event { + unsigned int flags; + struct trace_event_class class; + struct trace_event_call call; + struct list_head files; + struct list_head probes; + struct trace_uprobe_filter filter[0]; +}; + +struct trace_probe { + struct list_head list; + struct trace_probe_event *event; + ssize_t size; + unsigned int nr_args; + struct probe_arg args[0]; +}; + +struct event_file_link { + struct trace_event_file *file; + struct list_head list; +}; + +enum { + TP_ERR_FILE_NOT_FOUND = 0, + TP_ERR_NO_REGULAR_FILE = 1, + TP_ERR_BAD_REFCNT = 2, + TP_ERR_REFCNT_OPEN_BRACE = 3, + TP_ERR_BAD_REFCNT_SUFFIX = 4, + TP_ERR_BAD_UPROBE_OFFS = 5, + TP_ERR_MAXACT_NO_KPROBE = 6, + TP_ERR_BAD_MAXACT = 7, + TP_ERR_MAXACT_TOO_BIG = 8, + TP_ERR_BAD_PROBE_ADDR = 9, + TP_ERR_BAD_RETPROBE = 10, + TP_ERR_BAD_ADDR_SUFFIX = 11, + TP_ERR_NO_GROUP_NAME = 12, + TP_ERR_GROUP_TOO_LONG = 13, + TP_ERR_BAD_GROUP_NAME = 14, + TP_ERR_NO_EVENT_NAME = 15, + TP_ERR_EVENT_TOO_LONG = 16, + TP_ERR_BAD_EVENT_NAME = 17, + TP_ERR_RETVAL_ON_PROBE = 18, + TP_ERR_BAD_STACK_NUM = 19, + TP_ERR_BAD_ARG_NUM = 20, + TP_ERR_BAD_VAR = 21, + TP_ERR_BAD_REG_NAME = 22, + TP_ERR_BAD_MEM_ADDR = 23, + TP_ERR_BAD_IMM = 24, + TP_ERR_IMMSTR_NO_CLOSE = 25, + TP_ERR_FILE_ON_KPROBE = 26, + TP_ERR_BAD_FILE_OFFS = 27, + TP_ERR_SYM_ON_UPROBE = 28, + TP_ERR_TOO_MANY_OPS = 29, + TP_ERR_DEREF_NEED_BRACE = 30, + TP_ERR_BAD_DEREF_OFFS = 31, + TP_ERR_DEREF_OPEN_BRACE = 32, + TP_ERR_COMM_CANT_DEREF = 33, + TP_ERR_BAD_FETCH_ARG = 34, + TP_ERR_ARRAY_NO_CLOSE = 35, + TP_ERR_BAD_ARRAY_SUFFIX = 36, + TP_ERR_BAD_ARRAY_NUM = 37, + TP_ERR_ARRAY_TOO_BIG = 38, + TP_ERR_BAD_TYPE = 39, + TP_ERR_BAD_STRING = 40, + TP_ERR_BAD_BITFIELD = 41, + TP_ERR_ARG_NAME_TOO_LONG = 42, + TP_ERR_NO_ARG_NAME = 43, + TP_ERR_BAD_ARG_NAME = 44, + TP_ERR_USED_ARG_NAME = 45, + TP_ERR_ARG_TOO_LONG = 46, + TP_ERR_NO_ARG_BODY = 47, + TP_ERR_BAD_INSN_BNDRY = 48, + TP_ERR_FAIL_REG_PROBE = 49, + TP_ERR_DIFF_PROBE_TYPE = 50, + TP_ERR_DIFF_ARG_TYPE = 51, + TP_ERR_SAME_PROBE = 52, +}; + +struct trace_kprobe { + struct dyn_event devent; + struct kretprobe rp; + long unsigned int *nhit; + const char *symbol; + struct trace_probe tp; +}; + +struct trace_event_raw_cpu { + struct trace_entry ent; + u32 state; + u32 cpu_id; + char __data[0]; +}; + +struct trace_event_raw_powernv_throttle { + struct trace_entry ent; + int chip_id; + u32 __data_loc_reason; + int pmax; + char __data[0]; +}; + +struct trace_event_raw_pstate_sample { + struct trace_entry ent; + u32 core_busy; + u32 scaled_busy; + u32 from; + u32 to; + u64 mperf; + u64 aperf; + u64 tsc; + u32 freq; + u32 io_boost; + char __data[0]; +}; + +struct trace_event_raw_cpu_frequency_limits { + struct trace_entry ent; + u32 min_freq; + u32 max_freq; + u32 cpu_id; + char __data[0]; +}; + +struct trace_event_raw_device_pm_callback_start { + struct trace_entry ent; + u32 __data_loc_device; + u32 __data_loc_driver; + u32 __data_loc_parent; + u32 __data_loc_pm_ops; + int event; + char __data[0]; +}; + +struct trace_event_raw_device_pm_callback_end { + struct trace_entry ent; + u32 __data_loc_device; + u32 __data_loc_driver; + int error; + char __data[0]; +}; + +struct trace_event_raw_suspend_resume { + struct trace_entry ent; + const char *action; + int val; + bool start; + char __data[0]; +}; + +struct trace_event_raw_wakeup_source { + struct trace_entry ent; + u32 __data_loc_name; + u64 state; + char __data[0]; +}; + +struct trace_event_raw_clock { + struct trace_entry ent; + u32 __data_loc_name; + u64 state; + u64 cpu_id; + char __data[0]; +}; + +struct trace_event_raw_power_domain { + struct trace_entry ent; + u32 __data_loc_name; + u64 state; + u64 cpu_id; + char __data[0]; +}; + +struct trace_event_raw_cpu_latency_qos_request { + struct trace_entry ent; + s32 value; + char __data[0]; +}; + +struct trace_event_raw_pm_qos_update { + struct trace_entry ent; + enum pm_qos_req_action action; + int prev_value; + int curr_value; + char __data[0]; +}; + +struct trace_event_raw_dev_pm_qos_request { + struct trace_entry ent; + u32 __data_loc_name; + enum dev_pm_qos_req_type type; + s32 new_value; + char __data[0]; +}; + +struct trace_event_data_offsets_cpu {}; + +struct trace_event_data_offsets_powernv_throttle { + u32 reason; +}; + +struct trace_event_data_offsets_pstate_sample {}; + +struct trace_event_data_offsets_cpu_frequency_limits {}; + +struct trace_event_data_offsets_device_pm_callback_start { + u32 device; + u32 driver; + u32 parent; + u32 pm_ops; +}; + +struct trace_event_data_offsets_device_pm_callback_end { + u32 device; + u32 driver; +}; + +struct trace_event_data_offsets_suspend_resume {}; + +struct trace_event_data_offsets_wakeup_source { + u32 name; +}; + +struct trace_event_data_offsets_clock { + u32 name; +}; + +struct trace_event_data_offsets_power_domain { + u32 name; +}; + +struct trace_event_data_offsets_cpu_latency_qos_request {}; + +struct trace_event_data_offsets_pm_qos_update {}; + +struct trace_event_data_offsets_dev_pm_qos_request { + u32 name; +}; + +typedef void (*btf_trace_cpu_idle)(void *, unsigned int, unsigned int); + +typedef void (*btf_trace_powernv_throttle)(void *, int, const char *, int); + +typedef void (*btf_trace_pstate_sample)(void *, u32, u32, u32, u32, u64, u64, u64, u32, u32); + +typedef void (*btf_trace_cpu_frequency)(void *, unsigned int, unsigned int); + +typedef void (*btf_trace_cpu_frequency_limits)(void *, struct cpufreq_policy *); + +typedef void (*btf_trace_device_pm_callback_start)(void *, struct device *, const char *, int); + +typedef void (*btf_trace_device_pm_callback_end)(void *, struct device *, int); + +typedef void (*btf_trace_suspend_resume)(void *, const char *, int, bool); + +typedef void (*btf_trace_wakeup_source_activate)(void *, const char *, unsigned int); + +typedef void (*btf_trace_wakeup_source_deactivate)(void *, const char *, unsigned int); + +typedef void (*btf_trace_clock_enable)(void *, const char *, unsigned int, unsigned int); + +typedef void (*btf_trace_clock_disable)(void *, const char *, unsigned int, unsigned int); + +typedef void (*btf_trace_clock_set_rate)(void *, const char *, unsigned int, unsigned int); + +typedef void (*btf_trace_power_domain_target)(void *, const char *, unsigned int, unsigned int); + +typedef void (*btf_trace_pm_qos_add_request)(void *, s32); + +typedef void (*btf_trace_pm_qos_update_request)(void *, s32); + +typedef void (*btf_trace_pm_qos_remove_request)(void *, s32); + +typedef void (*btf_trace_pm_qos_update_target)(void *, enum pm_qos_req_action, int, int); + +typedef void (*btf_trace_pm_qos_update_flags)(void *, enum pm_qos_req_action, int, int); + +typedef void (*btf_trace_dev_pm_qos_add_request)(void *, const char *, enum dev_pm_qos_req_type, s32); + +typedef void (*btf_trace_dev_pm_qos_update_request)(void *, const char *, enum dev_pm_qos_req_type, s32); + +typedef void (*btf_trace_dev_pm_qos_remove_request)(void *, const char *, enum dev_pm_qos_req_type, s32); + +struct trace_event_raw_rpm_internal { + struct trace_entry ent; + u32 __data_loc_name; + int flags; + int usage_count; + int disable_depth; + int runtime_auto; + int request_pending; + int irq_safe; + int child_count; + char __data[0]; +}; + +struct trace_event_raw_rpm_return_int { + struct trace_entry ent; + u32 __data_loc_name; + long unsigned int ip; + int ret; + char __data[0]; +}; + +struct trace_event_data_offsets_rpm_internal { + u32 name; +}; + +struct trace_event_data_offsets_rpm_return_int { + u32 name; +}; + +typedef void (*btf_trace_rpm_suspend)(void *, struct device *, int); + +typedef void (*btf_trace_rpm_resume)(void *, struct device *, int); + +typedef void (*btf_trace_rpm_idle)(void *, struct device *, int); + +typedef void (*btf_trace_rpm_usage)(void *, struct device *, int); + +typedef void (*btf_trace_rpm_return_int)(void *, struct device *, long unsigned int, int); + +struct trace_probe_log { + const char *subsystem; + const char **argv; + int argc; + int index; +}; + +enum uprobe_filter_ctx { + UPROBE_FILTER_REGISTER = 0, + UPROBE_FILTER_UNREGISTER = 1, + UPROBE_FILTER_MMAP = 2, +}; + +struct uprobe_consumer { + int (*handler)(struct uprobe_consumer *, struct pt_regs *); + int (*ret_handler)(struct uprobe_consumer *, long unsigned int, struct pt_regs *); + bool (*filter)(struct uprobe_consumer *, enum uprobe_filter_ctx, struct mm_struct *); + struct uprobe_consumer *next; +}; + +struct uprobe_trace_entry_head { + struct trace_entry ent; + long unsigned int vaddr[0]; +}; + +struct trace_uprobe { + struct dyn_event devent; + struct uprobe_consumer consumer; + struct path path; + struct inode *inode; + char *filename; + long unsigned int offset; + long unsigned int ref_ctr_offset; + long unsigned int nhit; + struct trace_probe tp; +}; + +struct uprobe_dispatch_data { + struct trace_uprobe *tu; + long unsigned int bp_addr; +}; + +struct uprobe_cpu_buffer { + struct mutex mutex; + void *buf; +}; + +typedef bool (*filter_func_t)(struct uprobe_consumer *, enum uprobe_filter_ctx, struct mm_struct *); + +struct rhash_lock_head; + +struct bucket_table { + unsigned int size; + unsigned int nest; + u32 hash_rnd; + struct list_head walkers; + struct callback_head rcu; + struct bucket_table *future_tbl; + struct lockdep_map dep_map; + long: 64; + struct rhash_lock_head *buckets[0]; +}; + +enum xdp_action { + XDP_ABORTED = 0, + XDP_DROP = 1, + XDP_PASS = 2, + XDP_TX = 3, + XDP_REDIRECT = 4, +}; + +enum xdp_mem_type { + MEM_TYPE_PAGE_SHARED = 0, + MEM_TYPE_PAGE_ORDER0 = 1, + MEM_TYPE_PAGE_POOL = 2, + MEM_TYPE_XSK_BUFF_POOL = 3, + MEM_TYPE_MAX = 4, +}; + +struct xdp_cpumap_stats { + unsigned int redirect; + unsigned int pass; + unsigned int drop; +}; + +struct bpf_prog_dummy { + struct bpf_prog prog; +}; + +typedef u64 (*btf_bpf_user_rnd_u32)(); + +typedef u64 (*btf_bpf_get_raw_cpu_id)(); + +struct _bpf_dtab_netdev { + struct net_device *dev; +}; + +struct rhash_lock_head {}; + +struct zero_copy_allocator; + +struct page_pool; + +struct xdp_mem_allocator { + struct xdp_mem_info mem; + union { + void *allocator; + struct page_pool *page_pool; + struct zero_copy_allocator *zc_alloc; + }; + struct rhash_head node; + struct callback_head rcu; +}; + +struct trace_event_raw_xdp_exception { + struct trace_entry ent; + int prog_id; + u32 act; + int ifindex; + char __data[0]; +}; + +struct trace_event_raw_xdp_bulk_tx { + struct trace_entry ent; + int ifindex; + u32 act; + int drops; + int sent; + int err; + char __data[0]; +}; + +struct trace_event_raw_xdp_redirect_template { + struct trace_entry ent; + int prog_id; + u32 act; + int ifindex; + int err; + int to_ifindex; + u32 map_id; + int map_index; + char __data[0]; +}; + +struct trace_event_raw_xdp_cpumap_kthread { + struct trace_entry ent; + int map_id; + u32 act; + int cpu; + unsigned int drops; + unsigned int processed; + int sched; + unsigned int xdp_pass; + unsigned int xdp_drop; + unsigned int xdp_redirect; + char __data[0]; +}; + +struct trace_event_raw_xdp_cpumap_enqueue { + struct trace_entry ent; + int map_id; + u32 act; + int cpu; + unsigned int drops; + unsigned int processed; + int to_cpu; + char __data[0]; +}; + +struct trace_event_raw_xdp_devmap_xmit { + struct trace_entry ent; + int from_ifindex; + u32 act; + int to_ifindex; + int drops; + int sent; + int err; + char __data[0]; +}; + +struct trace_event_raw_mem_disconnect { + struct trace_entry ent; + const struct xdp_mem_allocator *xa; + u32 mem_id; + u32 mem_type; + const void *allocator; + char __data[0]; +}; + +struct trace_event_raw_mem_connect { + struct trace_entry ent; + const struct xdp_mem_allocator *xa; + u32 mem_id; + u32 mem_type; + const void *allocator; + const struct xdp_rxq_info *rxq; + int ifindex; + char __data[0]; +}; + +struct trace_event_raw_mem_return_failed { + struct trace_entry ent; + const struct page *page; + u32 mem_id; + u32 mem_type; + char __data[0]; +}; + +struct trace_event_data_offsets_xdp_exception {}; + +struct trace_event_data_offsets_xdp_bulk_tx {}; + +struct trace_event_data_offsets_xdp_redirect_template {}; + +struct trace_event_data_offsets_xdp_cpumap_kthread {}; + +struct trace_event_data_offsets_xdp_cpumap_enqueue {}; + +struct trace_event_data_offsets_xdp_devmap_xmit {}; + +struct trace_event_data_offsets_mem_disconnect {}; + +struct trace_event_data_offsets_mem_connect {}; + +struct trace_event_data_offsets_mem_return_failed {}; + +typedef void (*btf_trace_xdp_exception)(void *, const struct net_device *, const struct bpf_prog *, u32); + +typedef void (*btf_trace_xdp_bulk_tx)(void *, const struct net_device *, int, int, int); + +typedef void (*btf_trace_xdp_redirect)(void *, const struct net_device *, const struct bpf_prog *, const void *, int, const struct bpf_map *, u32); + +typedef void (*btf_trace_xdp_redirect_err)(void *, const struct net_device *, const struct bpf_prog *, const void *, int, const struct bpf_map *, u32); + +typedef void (*btf_trace_xdp_redirect_map)(void *, const struct net_device *, const struct bpf_prog *, const void *, int, const struct bpf_map *, u32); + +typedef void (*btf_trace_xdp_redirect_map_err)(void *, const struct net_device *, const struct bpf_prog *, const void *, int, const struct bpf_map *, u32); + +typedef void (*btf_trace_xdp_cpumap_kthread)(void *, int, unsigned int, unsigned int, int, struct xdp_cpumap_stats *); + +typedef void (*btf_trace_xdp_cpumap_enqueue)(void *, int, unsigned int, unsigned int, int); + +typedef void (*btf_trace_xdp_devmap_xmit)(void *, const struct net_device *, const struct net_device *, int, int, int); + +typedef void (*btf_trace_mem_disconnect)(void *, const struct xdp_mem_allocator *); + +typedef void (*btf_trace_mem_connect)(void *, const struct xdp_mem_allocator *, const struct xdp_rxq_info *); + +typedef void (*btf_trace_mem_return_failed)(void *, const struct xdp_mem_info *, const struct page *); + +enum bpf_cmd { + BPF_MAP_CREATE = 0, + BPF_MAP_LOOKUP_ELEM = 1, + BPF_MAP_UPDATE_ELEM = 2, + BPF_MAP_DELETE_ELEM = 3, + BPF_MAP_GET_NEXT_KEY = 4, + BPF_PROG_LOAD = 5, + BPF_OBJ_PIN = 6, + BPF_OBJ_GET = 7, + BPF_PROG_ATTACH = 8, + BPF_PROG_DETACH = 9, + BPF_PROG_TEST_RUN = 10, + BPF_PROG_GET_NEXT_ID = 11, + BPF_MAP_GET_NEXT_ID = 12, + BPF_PROG_GET_FD_BY_ID = 13, + BPF_MAP_GET_FD_BY_ID = 14, + BPF_OBJ_GET_INFO_BY_FD = 15, + BPF_PROG_QUERY = 16, + BPF_RAW_TRACEPOINT_OPEN = 17, + BPF_BTF_LOAD = 18, + BPF_BTF_GET_FD_BY_ID = 19, + BPF_TASK_FD_QUERY = 20, + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 21, + BPF_MAP_FREEZE = 22, + BPF_BTF_GET_NEXT_ID = 23, + BPF_MAP_LOOKUP_BATCH = 24, + BPF_MAP_LOOKUP_AND_DELETE_BATCH = 25, + BPF_MAP_UPDATE_BATCH = 26, + BPF_MAP_DELETE_BATCH = 27, + BPF_LINK_CREATE = 28, + BPF_LINK_UPDATE = 29, + BPF_LINK_GET_FD_BY_ID = 30, + BPF_LINK_GET_NEXT_ID = 31, + BPF_ENABLE_STATS = 32, + BPF_ITER_CREATE = 33, + BPF_LINK_DETACH = 34, + BPF_PROG_BIND_MAP = 35, +}; + +enum { + BPF_ANY = 0, + BPF_NOEXIST = 1, + BPF_EXIST = 2, + BPF_F_LOCK = 4, +}; + +enum { + BPF_F_NO_PREALLOC = 1, + BPF_F_NO_COMMON_LRU = 2, + BPF_F_NUMA_NODE = 4, + BPF_F_RDONLY = 8, + BPF_F_WRONLY = 16, + BPF_F_STACK_BUILD_ID = 32, + BPF_F_ZERO_SEED = 64, + BPF_F_RDONLY_PROG = 128, + BPF_F_WRONLY_PROG = 256, + BPF_F_CLONE = 512, + BPF_F_MMAPABLE = 1024, + BPF_F_PRESERVE_ELEMS = 2048, + BPF_F_INNER_MAP = 4096, +}; + +enum bpf_stats_type { + BPF_STATS_RUN_TIME = 0, +}; + +struct bpf_prog_info { + __u32 type; + __u32 id; + __u8 tag[8]; + __u32 jited_prog_len; + __u32 xlated_prog_len; + __u64 jited_prog_insns; + __u64 xlated_prog_insns; + __u64 load_time; + __u32 created_by_uid; + __u32 nr_map_ids; + __u64 map_ids; + char name[16]; + __u32 ifindex; + __u32 gpl_compatible: 1; + __u64 netns_dev; + __u64 netns_ino; + __u32 nr_jited_ksyms; + __u32 nr_jited_func_lens; + __u64 jited_ksyms; + __u64 jited_func_lens; + __u32 btf_id; + __u32 func_info_rec_size; + __u64 func_info; + __u32 nr_func_info; + __u32 nr_line_info; + __u64 line_info; + __u64 jited_line_info; + __u32 nr_jited_line_info; + __u32 line_info_rec_size; + __u32 jited_line_info_rec_size; + __u32 nr_prog_tags; + __u64 prog_tags; + __u64 run_time_ns; + __u64 run_cnt; +}; + +struct bpf_map_info { + __u32 type; + __u32 id; + __u32 key_size; + __u32 value_size; + __u32 max_entries; + __u32 map_flags; + char name[16]; + __u32 ifindex; + __u32 btf_vmlinux_value_type_id; + __u64 netns_dev; + __u64 netns_ino; + __u32 btf_id; + __u32 btf_key_type_id; + __u32 btf_value_type_id; +}; + +struct bpf_btf_info { + __u64 btf; + __u32 btf_size; + __u32 id; + __u64 name; + __u32 name_len; + __u32 kernel_btf; +}; + +struct bpf_spin_lock { + __u32 val; +}; + +struct bpf_verifier_log { + u32 level; + char kbuf[1024]; + char *ubuf; + u32 len_used; + u32 len_total; +}; + +struct bpf_attach_target_info { + struct btf_func_model fmodel; + long int tgt_addr; + const char *tgt_name; + const struct btf_type *tgt_type; +}; + +struct bpf_link_primer { + struct bpf_link *link; + struct file *file; + int fd; + u32 id; +}; + +enum perf_bpf_event_type { + PERF_BPF_EVENT_UNKNOWN = 0, + PERF_BPF_EVENT_PROG_LOAD = 1, + PERF_BPF_EVENT_PROG_UNLOAD = 2, + PERF_BPF_EVENT_MAX = 3, +}; + +enum bpf_audit { + BPF_AUDIT_LOAD = 0, + BPF_AUDIT_UNLOAD = 1, + BPF_AUDIT_MAX = 2, +}; + +struct bpf_tracing_link { + struct bpf_link link; + enum bpf_attach_type attach_type; + struct bpf_trampoline *trampoline; + struct bpf_prog *tgt_prog; +}; + +struct bpf_raw_tp_link { + struct bpf_link link; + struct bpf_raw_event_map *btp; +}; + +struct btf_member { + __u32 name_off; + __u32 type; + __u32 offset; +}; + +enum btf_func_linkage { + BTF_FUNC_STATIC = 0, + BTF_FUNC_GLOBAL = 1, + BTF_FUNC_EXTERN = 2, +}; + +struct btf_var_secinfo { + __u32 type; + __u32 offset; + __u32 size; +}; + +enum sk_action { + SK_DROP = 0, + SK_PASS = 1, +}; + +struct bpf_subprog_info { + u32 start; + u32 linfo_idx; + u16 stack_depth; + bool has_tail_call; + bool tail_call_reachable; + bool has_ld_abs; +}; + +struct bpf_verifier_stack_elem; + +struct bpf_verifier_state; + +struct bpf_verifier_state_list; + +struct bpf_insn_aux_data; + +struct bpf_verifier_env { + u32 insn_idx; + u32 prev_insn_idx; + struct bpf_prog *prog; + const struct bpf_verifier_ops *ops; + struct bpf_verifier_stack_elem *head; + int stack_size; + bool strict_alignment; + bool test_state_freq; + struct bpf_verifier_state *cur_state; + struct bpf_verifier_state_list **explored_states; + struct bpf_verifier_state_list *free_list; + struct bpf_map *used_maps[64]; + u32 used_map_cnt; + u32 id_gen; + bool allow_ptr_leaks; + bool allow_uninit_stack; + bool allow_ptr_to_map_access; + bool bpf_capable; + bool bypass_spec_v1; + bool bypass_spec_v4; + bool seen_direct_write; + struct bpf_insn_aux_data *insn_aux_data; + const struct bpf_line_info *prev_linfo; + struct bpf_verifier_log log; + struct bpf_subprog_info subprog_info[257]; + struct { + int *insn_state; + int *insn_stack; + int cur_stack; + } cfg; + u32 pass_cnt; + u32 subprog_cnt; + u32 prev_insn_processed; + u32 insn_processed; + u32 prev_jmps_processed; + u32 jmps_processed; + u64 verification_time; + u32 max_states_per_insn; + u32 total_states; + u32 peak_states; + u32 longest_mark_read_walk; +}; + +struct bpf_struct_ops { + const struct bpf_verifier_ops *verifier_ops; + int (*init)(struct btf *); + int (*check_member)(const struct btf_type *, const struct btf_member *); + int (*init_member)(const struct btf_type *, const struct btf_member *, void *, const void *); + int (*reg)(void *); + void (*unreg)(void *); + const struct btf_type *type; + const struct btf_type *value_type; + const char *name; + struct btf_func_model func_models[64]; + u32 type_id; + u32 value_id; +}; + +typedef u32 (*bpf_convert_ctx_access_t)(enum bpf_access_type, const struct bpf_insn *, struct bpf_insn *, struct bpf_prog *, u32 *); + +struct tnum { + u64 value; + u64 mask; +}; + +enum bpf_reg_liveness { + REG_LIVE_NONE = 0, + REG_LIVE_READ32 = 1, + REG_LIVE_READ64 = 2, + REG_LIVE_READ = 3, + REG_LIVE_WRITTEN = 4, + REG_LIVE_DONE = 8, +}; + +struct bpf_reg_state { + enum bpf_reg_type type; + s32 off; + union { + int range; + struct bpf_map *map_ptr; + struct { + struct btf *btf; + u32 btf_id; + }; + u32 mem_size; + struct { + long unsigned int raw1; + long unsigned int raw2; + } raw; + }; + u32 id; + u32 ref_obj_id; + struct tnum var_off; + s64 smin_value; + s64 smax_value; + u64 umin_value; + u64 umax_value; + s32 s32_min_value; + s32 s32_max_value; + u32 u32_min_value; + u32 u32_max_value; + struct bpf_reg_state *parent; + u32 frameno; + s32 subreg_def; + enum bpf_reg_liveness live; + bool precise; +}; + +enum bpf_stack_slot_type { + STACK_INVALID = 0, + STACK_SPILL = 1, + STACK_MISC = 2, + STACK_ZERO = 3, +}; + +struct bpf_stack_state { + struct bpf_reg_state spilled_ptr; + u8 slot_type[8]; +}; + +struct bpf_reference_state { + int id; + int insn_idx; +}; + +struct bpf_func_state { + struct bpf_reg_state regs[11]; + int callsite; + u32 frameno; + u32 subprogno; + int acquired_refs; + struct bpf_reference_state *refs; + int allocated_stack; + struct bpf_stack_state *stack; +}; + +struct bpf_idx_pair { + u32 prev_idx; + u32 idx; +}; + +struct bpf_verifier_state { + struct bpf_func_state *frame[8]; + struct bpf_verifier_state *parent; + u32 branches; + u32 insn_idx; + u32 curframe; + u32 active_spin_lock; + bool speculative; + u32 first_insn_idx; + u32 last_insn_idx; + struct bpf_idx_pair *jmp_history; + u32 jmp_history_cnt; +}; + +struct bpf_verifier_state_list { + struct bpf_verifier_state state; + struct bpf_verifier_state_list *next; + int miss_cnt; + int hit_cnt; +}; + +struct bpf_insn_aux_data { + union { + enum bpf_reg_type ptr_type; + long unsigned int map_ptr_state; + s32 call_imm; + u32 alu_limit; + struct { + u32 map_index; + u32 map_off; + }; + struct { + enum bpf_reg_type reg_type; + union { + struct { + struct btf *btf; + u32 btf_id; + }; + u32 mem_size; + }; + } btf_var; + }; + u64 map_key_state; + int ctx_field_size; + int sanitize_stack_off; + u32 seen; + bool zext_dst; + u8 alu_state; + unsigned int orig_idx; + bool prune_point; +}; + +struct bpf_verifier_stack_elem { + struct bpf_verifier_state st; + int insn_idx; + int prev_insn_idx; + struct bpf_verifier_stack_elem *next; + u32 log_pos; +}; + +enum { + BTF_SOCK_TYPE_INET = 0, + BTF_SOCK_TYPE_INET_CONN = 1, + BTF_SOCK_TYPE_INET_REQ = 2, + BTF_SOCK_TYPE_INET_TW = 3, + BTF_SOCK_TYPE_REQ = 4, + BTF_SOCK_TYPE_SOCK = 5, + BTF_SOCK_TYPE_SOCK_COMMON = 6, + BTF_SOCK_TYPE_TCP = 7, + BTF_SOCK_TYPE_TCP_REQ = 8, + BTF_SOCK_TYPE_TCP_TW = 9, + BTF_SOCK_TYPE_TCP6 = 10, + BTF_SOCK_TYPE_UDP = 11, + BTF_SOCK_TYPE_UDP6 = 12, + MAX_BTF_SOCK_TYPE = 13, +}; + +typedef void (*bpf_insn_print_t)(void *, const char *, ...); + +typedef const char * (*bpf_insn_revmap_call_t)(void *, const struct bpf_insn *); + +typedef const char * (*bpf_insn_print_imm_t)(void *, const struct bpf_insn *, __u64); + +struct bpf_insn_cbs { + bpf_insn_print_t cb_print; + bpf_insn_revmap_call_t cb_call; + bpf_insn_print_imm_t cb_imm; + void *private_data; +}; + +struct bpf_call_arg_meta { + struct bpf_map *map_ptr; + bool raw_mode; + bool pkt_access; + int regno; + int access_size; + int mem_size; + u64 msize_max_value; + int ref_obj_id; + int func_id; + struct btf *btf; + u32 btf_id; + struct btf *ret_btf; + u32 ret_btf_id; +}; + +enum reg_arg_type { + SRC_OP = 0, + DST_OP = 1, + DST_OP_NO_MARK = 2, +}; + +enum stack_access_src { + ACCESS_DIRECT = 1, + ACCESS_HELPER = 2, +}; + +struct bpf_reg_types { + const enum bpf_reg_type types[10]; + u32 *btf_id; +}; + +enum { + AT_PKT_END = 4294967295, + BEYOND_PKT_END = 4294967294, +}; + +enum { + REASON_BOUNDS = 4294967295, + REASON_TYPE = 4294967294, + REASON_PATHS = 4294967293, + REASON_LIMIT = 4294967292, + REASON_STACK = 4294967291, +}; + +enum { + DISCOVERED = 16, + EXPLORED = 32, + FALLTHROUGH = 1, + BRANCH = 2, +}; + +enum { + DONE_EXPLORING = 0, + KEEP_EXPLORING = 1, +}; + +struct idpair { + u32 old; + u32 cur; +}; + +struct tree_descr { + const char *name; + const struct file_operations *ops; + int mode; +}; + +struct bpf_preload_info { + char link_name[16]; + int link_id; +}; + +struct bpf_preload_ops { + struct umd_info info; + int (*preload)(struct bpf_preload_info *); + int (*finish)(); + struct module *owner; +}; + +enum bpf_type { + BPF_TYPE_UNSPEC = 0, + BPF_TYPE_PROG = 1, + BPF_TYPE_MAP = 2, + BPF_TYPE_LINK = 3, +}; + +struct map_iter { + void *key; + bool done; +}; + +enum { + OPT_MODE = 0, +}; + +struct bpf_mount_opts { + umode_t mode; +}; + +struct bpf_pidns_info { + __u32 pid; + __u32 tgid; +}; + +typedef u64 (*btf_bpf_map_lookup_elem)(struct bpf_map *, void *); + +typedef u64 (*btf_bpf_map_update_elem)(struct bpf_map *, void *, void *, u64); + +typedef u64 (*btf_bpf_map_delete_elem)(struct bpf_map *, void *); + +typedef u64 (*btf_bpf_map_push_elem)(struct bpf_map *, void *, u64); + +typedef u64 (*btf_bpf_map_pop_elem)(struct bpf_map *, void *); + +typedef u64 (*btf_bpf_map_peek_elem)(struct bpf_map *, void *); + +typedef u64 (*btf_bpf_get_smp_processor_id)(); + +typedef u64 (*btf_bpf_get_numa_node_id)(); + +typedef u64 (*btf_bpf_ktime_get_ns)(); + +typedef u64 (*btf_bpf_ktime_get_boot_ns)(); + +typedef u64 (*btf_bpf_ktime_get_coarse_ns)(); + +typedef u64 (*btf_bpf_get_current_pid_tgid)(); + +typedef u64 (*btf_bpf_get_current_uid_gid)(); + +typedef u64 (*btf_bpf_get_current_comm)(char *, u32); + +typedef u64 (*btf_bpf_spin_lock)(struct bpf_spin_lock *); + +typedef u64 (*btf_bpf_spin_unlock)(struct bpf_spin_lock *); + +typedef u64 (*btf_bpf_jiffies64)(); + +typedef u64 (*btf_bpf_get_current_cgroup_id)(); + +typedef u64 (*btf_bpf_get_current_ancestor_cgroup_id)(int); + +typedef u64 (*btf_bpf_get_local_storage)(struct bpf_map *, u64); + +typedef u64 (*btf_bpf_strtol)(const char *, size_t, u64, long int *); + +typedef u64 (*btf_bpf_strtoul)(const char *, size_t, u64, long unsigned int *); + +typedef u64 (*btf_bpf_get_ns_current_pid_tgid)(u64, u64, struct bpf_pidns_info *, u32); + +typedef u64 (*btf_bpf_event_output_data)(void *, struct bpf_map *, u64, void *, u64); + +typedef u64 (*btf_bpf_copy_from_user)(void *, u32, const void *); + +typedef u64 (*btf_bpf_per_cpu_ptr)(const void *, u32); + +typedef u64 (*btf_bpf_this_cpu_ptr)(const void *); + +union bpf_iter_link_info { + struct { + __u32 map_fd; + } map; +}; + +typedef int (*bpf_iter_attach_target_t)(struct bpf_prog *, union bpf_iter_link_info *, struct bpf_iter_aux_info *); + +typedef void (*bpf_iter_detach_target_t)(struct bpf_iter_aux_info *); + +typedef void (*bpf_iter_show_fdinfo_t)(const struct bpf_iter_aux_info *, struct seq_file *); + +typedef int (*bpf_iter_fill_link_info_t)(const struct bpf_iter_aux_info *, struct bpf_link_info *); + +enum bpf_iter_feature { + BPF_ITER_RESCHED = 1, +}; + +struct bpf_iter_reg { + const char *target; + bpf_iter_attach_target_t attach_target; + bpf_iter_detach_target_t detach_target; + bpf_iter_show_fdinfo_t show_fdinfo; + bpf_iter_fill_link_info_t fill_link_info; + u32 ctx_arg_info_size; + u32 feature; + struct bpf_ctx_arg_aux ctx_arg_info[2]; + const struct bpf_iter_seq_info *seq_info; +}; + +struct bpf_iter_meta { + union { + struct seq_file *seq; + }; + u64 session_id; + u64 seq_num; +}; + +struct bpf_iter_target_info { + struct list_head list; + const struct bpf_iter_reg *reg_info; + u32 btf_id; +}; + +struct bpf_iter_link { + struct bpf_link link; + struct bpf_iter_aux_info aux; + struct bpf_iter_target_info *tinfo; +}; + +struct bpf_iter_priv_data { + struct bpf_iter_target_info *tinfo; + const struct bpf_iter_seq_info *seq_info; + struct bpf_prog *prog; + u64 session_id; + u64 seq_num; + bool done_stop; + long: 56; + u8 target_private[0]; +}; + +struct bpf_iter_seq_map_info { + u32 map_id; +}; + +struct bpf_iter__bpf_map { + union { + struct bpf_iter_meta *meta; + }; + union { + struct bpf_map *map; + }; +}; + +struct bpf_iter_seq_task_common { + struct pid_namespace *ns; +}; + +struct bpf_iter_seq_task_info { + struct bpf_iter_seq_task_common common; + u32 tid; +}; + +struct bpf_iter__task { + union { + struct bpf_iter_meta *meta; + }; + union { + struct task_struct *task; + }; +}; + +struct bpf_iter_seq_task_file_info { + struct bpf_iter_seq_task_common common; + struct task_struct *task; + u32 tid; + u32 fd; +}; + +struct bpf_iter__task_file { + union { + struct bpf_iter_meta *meta; + }; + union { + struct task_struct *task; + }; + u32 fd; + union { + struct file *file; + }; +}; + +struct bpf_iter_seq_prog_info { + u32 prog_id; +}; + +struct bpf_iter__bpf_prog { + union { + struct bpf_iter_meta *meta; + }; + union { + struct bpf_prog *prog; + }; +}; + +struct bpf_iter__bpf_map_elem { + union { + struct bpf_iter_meta *meta; + }; + union { + struct bpf_map *map; + }; + union { + void *key; + }; + union { + void *value; + }; +}; + +struct pcpu_freelist_node; + +struct pcpu_freelist_head { + struct pcpu_freelist_node *first; + raw_spinlock_t lock; +}; + +struct pcpu_freelist_node { + struct pcpu_freelist_node *next; +}; + +struct pcpu_freelist { + struct pcpu_freelist_head *freelist; + struct pcpu_freelist_head extralist; +}; + +struct bpf_lru_node { + struct list_head list; + u16 cpu; + u8 type; + u8 ref; +}; + +struct bpf_lru_list { + struct list_head lists[3]; + unsigned int counts[2]; + struct list_head *next_inactive_rotation; + raw_spinlock_t lock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct bpf_lru_locallist { + struct list_head lists[2]; + u16 next_steal; + raw_spinlock_t lock; +}; + +struct bpf_common_lru { + struct bpf_lru_list lru_list; + struct bpf_lru_locallist *local_list; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +typedef bool (*del_from_htab_func)(void *, struct bpf_lru_node *); + +struct bpf_lru { + union { + struct bpf_common_lru common_lru; + struct bpf_lru_list *percpu_lru; + }; + del_from_htab_func del_from_htab; + void *del_arg; + unsigned int hash_offset; + unsigned int nr_scans; + bool percpu; + long: 56; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct bucket { + struct hlist_nulls_head head; + union { + raw_spinlock_t raw_lock; + spinlock_t lock; + }; +}; + +struct htab_elem; + +struct bpf_htab { + struct bpf_map map; + struct bucket *buckets; + void *elems; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + union { + struct pcpu_freelist freelist; + struct bpf_lru lru; + }; + struct htab_elem **extra_elems; + atomic_t count; + u32 n_buckets; + u32 elem_size; + u32 hashrnd; + struct lock_class_key lockdep_key; + int *map_locked[8]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct htab_elem { + union { + struct hlist_nulls_node hash_node; + struct { + void *padding; + union { + struct bpf_htab *htab; + struct pcpu_freelist_node fnode; + struct htab_elem *batch_flink; + }; + }; + }; + union { + struct callback_head rcu; + struct bpf_lru_node lru_node; + }; + u32 hash; + int: 32; + char key[0]; +}; + +struct bpf_iter_seq_hash_map_info { + struct bpf_map *map; + struct bpf_htab *htab; + void *percpu_value_buf; + u32 bucket_id; + u32 skip_elems; +}; + +struct bpf_iter_seq_array_map_info { + struct bpf_map *map; + void *percpu_value_buf; + u32 index; +}; + +struct prog_poke_elem { + struct list_head list; + struct bpf_prog_aux *aux; +}; + +enum bpf_lru_list_type { + BPF_LRU_LIST_T_ACTIVE = 0, + BPF_LRU_LIST_T_INACTIVE = 1, + BPF_LRU_LIST_T_FREE = 2, + BPF_LRU_LOCAL_LIST_T_FREE = 3, + BPF_LRU_LOCAL_LIST_T_PENDING = 4, +}; + +struct bpf_lpm_trie_key { + __u32 prefixlen; + __u8 data[0]; +}; + +struct lpm_trie_node { + struct callback_head rcu; + struct lpm_trie_node *child[2]; + u32 prefixlen; + u32 flags; + u8 data[0]; +}; + +struct lpm_trie { + struct bpf_map map; + struct lpm_trie_node *root; + size_t n_entries; + size_t max_prefixlen; + size_t data_size; + spinlock_t lock; + long: 32; + long: 64; + long: 64; + long: 64; +}; + +struct bpf_cgroup_storage_map { + struct bpf_map map; + spinlock_t lock; + struct rb_root root; + struct list_head list; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct bpf_queue_stack { + struct bpf_map map; + raw_spinlock_t lock; + u32 head; + u32 tail; + u32 size; + char elements[0]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum { + BPF_RB_NO_WAKEUP = 1, + BPF_RB_FORCE_WAKEUP = 2, +}; + +enum { + BPF_RB_AVAIL_DATA = 0, + BPF_RB_RING_SIZE = 1, + BPF_RB_CONS_POS = 2, + BPF_RB_PROD_POS = 3, +}; + +enum { + BPF_RINGBUF_BUSY_BIT = 2147483648, + BPF_RINGBUF_DISCARD_BIT = 1073741824, + BPF_RINGBUF_HDR_SZ = 8, +}; + +struct bpf_ringbuf { + wait_queue_head_t waitq; + struct irq_work work; + u64 mask; + struct page **pages; + int nr_pages; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + spinlock_t spinlock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long unsigned int consumer_pos; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long unsigned int producer_pos; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + char data[0]; +}; + +struct bpf_ringbuf_map { + struct bpf_map map; + struct bpf_ringbuf *rb; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct bpf_ringbuf_hdr { + u32 len; + u32 pg_off; +}; + +typedef u64 (*btf_bpf_ringbuf_reserve)(struct bpf_map *, u64, u64); + +typedef u64 (*btf_bpf_ringbuf_submit)(void *, u64); + +typedef u64 (*btf_bpf_ringbuf_discard)(void *, u64); + +typedef u64 (*btf_bpf_ringbuf_output)(struct bpf_map *, void *, u64, u64); + +typedef u64 (*btf_bpf_ringbuf_query)(struct bpf_map *, u64); + +enum { + BPF_LOCAL_STORAGE_GET_F_CREATE = 1, + BPF_SK_STORAGE_GET_F_CREATE = 1, +}; + +struct bpf_local_storage_elem { + struct hlist_node map_node; + struct hlist_node snode; + struct bpf_local_storage *local_storage; + struct callback_head rcu; + long: 64; + struct bpf_local_storage_data sdata; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct bpf_local_storage_cache { + spinlock_t idx_lock; + u64 idx_usage_counts[16]; +}; + +struct lsm_blob_sizes { + int lbs_cred; + int lbs_file; + int lbs_inode; + int lbs_ipc; + int lbs_msg_msg; + int lbs_task; +}; + +struct bpf_storage_blob { + struct bpf_local_storage *storage; +}; + +typedef u64 (*btf_bpf_inode_storage_get)(struct bpf_map *, struct inode *, void *, u64); + +typedef u64 (*btf_bpf_inode_storage_delete)(struct bpf_map *, struct inode *); + +typedef u64 (*btf_bpf_task_storage_get)(struct bpf_map *, struct task_struct *, void *, u64); + +typedef u64 (*btf_bpf_task_storage_delete)(struct bpf_map *, struct task_struct *); + +struct btf_enum { + __u32 name_off; + __s32 val; +}; + +struct btf_array { + __u32 type; + __u32 index_type; + __u32 nelems; +}; + +struct btf_param { + __u32 name_off; + __u32 type; +}; + +enum { + BTF_VAR_STATIC = 0, + BTF_VAR_GLOBAL_ALLOCATED = 1, + BTF_VAR_GLOBAL_EXTERN = 2, +}; + +struct btf_var { + __u32 linkage; +}; + +struct bpf_flow_keys { + __u16 nhoff; + __u16 thoff; + __u16 addr_proto; + __u8 is_frag; + __u8 is_first_frag; + __u8 is_encap; + __u8 ip_proto; + __be16 n_proto; + __be16 sport; + __be16 dport; + union { + struct { + __be32 ipv4_src; + __be32 ipv4_dst; + }; + struct { + __u32 ipv6_src[4]; + __u32 ipv6_dst[4]; + }; + }; + __u32 flags; + __be32 flow_label; +}; + +struct bpf_sock { + __u32 bound_dev_if; + __u32 family; + __u32 type; + __u32 protocol; + __u32 mark; + __u32 priority; + __u32 src_ip4; + __u32 src_ip6[4]; + __u32 src_port; + __u32 dst_port; + __u32 dst_ip4; + __u32 dst_ip6[4]; + __u32 state; + __s32 rx_queue_mapping; +}; + +struct __sk_buff { + __u32 len; + __u32 pkt_type; + __u32 mark; + __u32 queue_mapping; + __u32 protocol; + __u32 vlan_present; + __u32 vlan_tci; + __u32 vlan_proto; + __u32 priority; + __u32 ingress_ifindex; + __u32 ifindex; + __u32 tc_index; + __u32 cb[5]; + __u32 hash; + __u32 tc_classid; + __u32 data; + __u32 data_end; + __u32 napi_id; + __u32 family; + __u32 remote_ip4; + __u32 local_ip4; + __u32 remote_ip6[4]; + __u32 local_ip6[4]; + __u32 remote_port; + __u32 local_port; + __u32 data_meta; + union { + struct bpf_flow_keys *flow_keys; + }; + __u64 tstamp; + __u32 wire_len; + __u32 gso_segs; + union { + struct bpf_sock *sk; + }; + __u32 gso_size; +}; + +struct xdp_md { + __u32 data; + __u32 data_end; + __u32 data_meta; + __u32 ingress_ifindex; + __u32 rx_queue_index; + __u32 egress_ifindex; +}; + +struct sk_msg_md { + union { + void *data; + }; + union { + void *data_end; + }; + __u32 family; + __u32 remote_ip4; + __u32 local_ip4; + __u32 remote_ip6[4]; + __u32 local_ip6[4]; + __u32 remote_port; + __u32 local_port; + __u32 size; + union { + struct bpf_sock *sk; + }; +}; + +struct sk_reuseport_md { + union { + void *data; + }; + union { + void *data_end; + }; + __u32 len; + __u32 eth_protocol; + __u32 ip_protocol; + __u32 bind_inany; + __u32 hash; +}; + +struct bpf_sock_addr { + __u32 user_family; + __u32 user_ip4; + __u32 user_ip6[4]; + __u32 user_port; + __u32 family; + __u32 type; + __u32 protocol; + __u32 msg_src_ip4; + __u32 msg_src_ip6[4]; + union { + struct bpf_sock *sk; + }; +}; + +struct bpf_sock_ops { + __u32 op; + union { + __u32 args[4]; + __u32 reply; + __u32 replylong[4]; + }; + __u32 family; + __u32 remote_ip4; + __u32 local_ip4; + __u32 remote_ip6[4]; + __u32 local_ip6[4]; + __u32 remote_port; + __u32 local_port; + __u32 is_fullsock; + __u32 snd_cwnd; + __u32 srtt_us; + __u32 bpf_sock_ops_cb_flags; + __u32 state; + __u32 rtt_min; + __u32 snd_ssthresh; + __u32 rcv_nxt; + __u32 snd_nxt; + __u32 snd_una; + __u32 mss_cache; + __u32 ecn_flags; + __u32 rate_delivered; + __u32 rate_interval_us; + __u32 packets_out; + __u32 retrans_out; + __u32 total_retrans; + __u32 segs_in; + __u32 data_segs_in; + __u32 segs_out; + __u32 data_segs_out; + __u32 lost_out; + __u32 sacked_out; + __u32 sk_txhash; + __u64 bytes_received; + __u64 bytes_acked; + union { + struct bpf_sock *sk; + }; + union { + void *skb_data; + }; + union { + void *skb_data_end; + }; + __u32 skb_len; + __u32 skb_tcp_flags; +}; + +struct bpf_cgroup_dev_ctx { + __u32 access_type; + __u32 major; + __u32 minor; +}; + +struct bpf_sysctl { + __u32 write; + __u32 file_pos; +}; + +struct bpf_sockopt { + union { + struct bpf_sock *sk; + }; + union { + void *optval; + }; + union { + void *optval_end; + }; + __s32 level; + __s32 optname; + __s32 optlen; + __s32 retval; +}; + +struct bpf_sk_lookup { + union { + struct bpf_sock *sk; + }; + __u32 family; + __u32 protocol; + __u32 remote_ip4; + __u32 remote_ip6[4]; + __u32 remote_port; + __u32 local_ip4; + __u32 local_ip6[4]; + __u32 local_port; +}; + +struct sk_reuseport_kern { + struct sk_buff *skb; + struct sock *sk; + struct sock *selected_sk; + void *data_end; + u32 hash; + u32 reuseport_id; + bool bind_inany; +}; + +struct bpf_flow_dissector { + struct bpf_flow_keys *flow_keys; + const struct sk_buff *skb; + void *data; + void *data_end; +}; + +struct inet_listen_hashbucket { + spinlock_t lock; + unsigned int count; + union { + struct hlist_head head; + struct hlist_nulls_head nulls_head; + }; +}; + +struct inet_ehash_bucket; + +struct inet_bind_hashbucket; + +struct inet_hashinfo { + struct inet_ehash_bucket *ehash; + spinlock_t *ehash_locks; + unsigned int ehash_mask; + unsigned int ehash_locks_mask; + struct kmem_cache *bind_bucket_cachep; + struct inet_bind_hashbucket *bhash; + unsigned int bhash_size; + unsigned int lhash2_mask; + struct inet_listen_hashbucket *lhash2; + long: 64; + struct inet_listen_hashbucket listening_hash[32]; +}; + +struct ip_ra_chain { + struct ip_ra_chain *next; + struct sock *sk; + union { + void (*destructor)(struct sock *); + struct sock *saved_sk; + }; + struct callback_head rcu; +}; + +struct fib_table { + struct hlist_node tb_hlist; + u32 tb_id; + int tb_num_default; + struct callback_head rcu; + long unsigned int *tb_data; + long unsigned int __data[0]; +}; + +struct inet_peer_base { + struct rb_root rb_root; + seqlock_t lock; + int total; +}; + +struct tcp_fastopen_context { + siphash_key_t key[2]; + int num; + struct callback_head rcu; +}; + +struct xdp_txq_info { + struct net_device *dev; +}; + +struct xdp_buff { + void *data; + void *data_end; + void *data_meta; + void *data_hard_start; + struct xdp_rxq_info *rxq; + struct xdp_txq_info *txq; + u32 frame_sz; +}; + +struct bpf_sock_addr_kern { + struct sock *sk; + struct sockaddr *uaddr; + u64 tmp_reg; + void *t_ctx; +}; + +struct bpf_sock_ops_kern { + struct sock *sk; + union { + u32 args[4]; + u32 reply; + u32 replylong[4]; + }; + struct sk_buff *syn_skb; + struct sk_buff *skb; + void *skb_data_end; + u8 op; + u8 is_fullsock; + u8 remaining_opt_len; + u64 temp; +}; + +struct bpf_sysctl_kern { + struct ctl_table_header *head; + struct ctl_table *table; + void *cur_val; + size_t cur_len; + void *new_val; + size_t new_len; + int new_updated; + int write; + loff_t *ppos; + u64 tmp_reg; +}; + +struct bpf_sockopt_kern { + struct sock *sk; + u8 *optval; + u8 *optval_end; + s32 level; + s32 optname; + s32 optlen; + s32 retval; +}; + +struct bpf_sk_lookup_kern { + u16 family; + u16 protocol; + __be16 sport; + u16 dport; + struct { + __be32 saddr; + __be32 daddr; + } v4; + struct { + const struct in6_addr *saddr; + const struct in6_addr *daddr; + } v6; + struct sock *selected_sk; + bool no_reuseport; +}; + +struct sock_reuseport { + struct callback_head rcu; + u16 max_socks; + u16 num_socks; + unsigned int synq_overflow_ts; + unsigned int reuseport_id; + unsigned int bind_inany: 1; + unsigned int has_conns: 1; + struct bpf_prog *prog; + struct sock *socks[0]; +}; + +struct inet_ehash_bucket { + struct hlist_nulls_head chain; +}; + +struct inet_bind_hashbucket { + spinlock_t lock; + struct hlist_head chain; +}; + +struct ack_sample { + u32 pkts_acked; + s32 rtt_us; + u32 in_flight; +}; + +struct rate_sample { + u64 prior_mstamp; + u32 prior_delivered; + s32 delivered; + long int interval_us; + u32 snd_interval_us; + u32 rcv_interval_us; + long int rtt_us; + int losses; + u32 acked_sacked; + u32 prior_in_flight; + bool is_app_limited; + bool is_retrans; + bool is_ack_delayed; +}; + +struct sk_msg_sg { + u32 start; + u32 curr; + u32 end; + u32 size; + u32 copybreak; + long unsigned int copy; + struct scatterlist data[19]; +}; + +struct sk_msg { + struct sk_msg_sg sg; + void *data; + void *data_end; + u32 apply_bytes; + u32 cork_bytes; + u32 flags; + struct sk_buff *skb; + struct sock *sk_redir; + struct sock *sk; + struct list_head list; +}; + +enum verifier_phase { + CHECK_META = 0, + CHECK_TYPE = 1, +}; + +struct resolve_vertex { + const struct btf_type *t; + u32 type_id; + u16 next_member; +}; + +enum visit_state { + NOT_VISITED = 0, + VISITED = 1, + RESOLVED = 2, +}; + +enum resolve_mode { + RESOLVE_TBD = 0, + RESOLVE_PTR = 1, + RESOLVE_STRUCT_OR_ARRAY = 2, +}; + +struct btf_sec_info { + u32 off; + u32 len; +}; + +struct btf_verifier_env { + struct btf *btf; + u8 *visit_states; + struct resolve_vertex stack[32]; + struct bpf_verifier_log log; + u32 log_type_id; + u32 top_stack; + enum verifier_phase phase; + enum resolve_mode resolve_mode; +}; + +struct btf_show { + u64 flags; + void *target; + void (*showfn)(struct btf_show *, const char *, struct __va_list_tag *); + const struct btf *btf; + struct { + u8 depth; + u8 depth_to_show; + u8 depth_check; + u8 array_member: 1; + u8 array_terminated: 1; + u16 array_encoding; + u32 type_id; + int status; + const struct btf_type *type; + const struct btf_member *member; + char name[80]; + } state; + struct { + u32 size; + void *head; + void *data; + u8 safe[32]; + } obj; +}; + +struct btf_kind_operations { + s32 (*check_meta)(struct btf_verifier_env *, const struct btf_type *, u32); + int (*resolve)(struct btf_verifier_env *, const struct resolve_vertex *); + int (*check_member)(struct btf_verifier_env *, const struct btf_type *, const struct btf_member *, const struct btf_type *); + int (*check_kflag_member)(struct btf_verifier_env *, const struct btf_type *, const struct btf_member *, const struct btf_type *); + void (*log_details)(struct btf_verifier_env *, const struct btf_type *); + void (*show)(const struct btf *, const struct btf_type *, u32, void *, u8, struct btf_show *); +}; + +struct bpf_ctx_convert { + struct __sk_buff BPF_PROG_TYPE_SOCKET_FILTER_prog; + struct sk_buff BPF_PROG_TYPE_SOCKET_FILTER_kern; + struct __sk_buff BPF_PROG_TYPE_SCHED_CLS_prog; + struct sk_buff BPF_PROG_TYPE_SCHED_CLS_kern; + struct __sk_buff BPF_PROG_TYPE_SCHED_ACT_prog; + struct sk_buff BPF_PROG_TYPE_SCHED_ACT_kern; + struct xdp_md BPF_PROG_TYPE_XDP_prog; + struct xdp_buff BPF_PROG_TYPE_XDP_kern; + struct __sk_buff BPF_PROG_TYPE_CGROUP_SKB_prog; + struct sk_buff BPF_PROG_TYPE_CGROUP_SKB_kern; + struct bpf_sock BPF_PROG_TYPE_CGROUP_SOCK_prog; + struct sock BPF_PROG_TYPE_CGROUP_SOCK_kern; + struct bpf_sock_addr BPF_PROG_TYPE_CGROUP_SOCK_ADDR_prog; + struct bpf_sock_addr_kern BPF_PROG_TYPE_CGROUP_SOCK_ADDR_kern; + struct __sk_buff BPF_PROG_TYPE_LWT_IN_prog; + struct sk_buff BPF_PROG_TYPE_LWT_IN_kern; + struct __sk_buff BPF_PROG_TYPE_LWT_OUT_prog; + struct sk_buff BPF_PROG_TYPE_LWT_OUT_kern; + struct __sk_buff BPF_PROG_TYPE_LWT_XMIT_prog; + struct sk_buff BPF_PROG_TYPE_LWT_XMIT_kern; + struct __sk_buff BPF_PROG_TYPE_LWT_SEG6LOCAL_prog; + struct sk_buff BPF_PROG_TYPE_LWT_SEG6LOCAL_kern; + struct bpf_sock_ops BPF_PROG_TYPE_SOCK_OPS_prog; + struct bpf_sock_ops_kern BPF_PROG_TYPE_SOCK_OPS_kern; + struct __sk_buff BPF_PROG_TYPE_SK_SKB_prog; + struct sk_buff BPF_PROG_TYPE_SK_SKB_kern; + struct sk_msg_md BPF_PROG_TYPE_SK_MSG_prog; + struct sk_msg BPF_PROG_TYPE_SK_MSG_kern; + struct __sk_buff BPF_PROG_TYPE_FLOW_DISSECTOR_prog; + struct bpf_flow_dissector BPF_PROG_TYPE_FLOW_DISSECTOR_kern; + bpf_user_pt_regs_t BPF_PROG_TYPE_KPROBE_prog; + struct pt_regs BPF_PROG_TYPE_KPROBE_kern; + __u64 BPF_PROG_TYPE_TRACEPOINT_prog; + u64 BPF_PROG_TYPE_TRACEPOINT_kern; + struct bpf_perf_event_data BPF_PROG_TYPE_PERF_EVENT_prog; + struct bpf_perf_event_data_kern BPF_PROG_TYPE_PERF_EVENT_kern; + struct bpf_raw_tracepoint_args BPF_PROG_TYPE_RAW_TRACEPOINT_prog; + u64 BPF_PROG_TYPE_RAW_TRACEPOINT_kern; + struct bpf_raw_tracepoint_args BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE_prog; + u64 BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE_kern; + void *BPF_PROG_TYPE_TRACING_prog; + void *BPF_PROG_TYPE_TRACING_kern; + struct bpf_cgroup_dev_ctx BPF_PROG_TYPE_CGROUP_DEVICE_prog; + struct bpf_cgroup_dev_ctx BPF_PROG_TYPE_CGROUP_DEVICE_kern; + struct bpf_sysctl BPF_PROG_TYPE_CGROUP_SYSCTL_prog; + struct bpf_sysctl_kern BPF_PROG_TYPE_CGROUP_SYSCTL_kern; + struct bpf_sockopt BPF_PROG_TYPE_CGROUP_SOCKOPT_prog; + struct bpf_sockopt_kern BPF_PROG_TYPE_CGROUP_SOCKOPT_kern; + __u32 BPF_PROG_TYPE_LIRC_MODE2_prog; + u32 BPF_PROG_TYPE_LIRC_MODE2_kern; + struct sk_reuseport_md BPF_PROG_TYPE_SK_REUSEPORT_prog; + struct sk_reuseport_kern BPF_PROG_TYPE_SK_REUSEPORT_kern; + struct bpf_sk_lookup BPF_PROG_TYPE_SK_LOOKUP_prog; + struct bpf_sk_lookup_kern BPF_PROG_TYPE_SK_LOOKUP_kern; + void *BPF_PROG_TYPE_STRUCT_OPS_prog; + void *BPF_PROG_TYPE_STRUCT_OPS_kern; + void *BPF_PROG_TYPE_EXT_prog; + void *BPF_PROG_TYPE_EXT_kern; + void *BPF_PROG_TYPE_LSM_prog; + void *BPF_PROG_TYPE_LSM_kern; +}; + +enum { + __ctx_convertBPF_PROG_TYPE_SOCKET_FILTER = 0, + __ctx_convertBPF_PROG_TYPE_SCHED_CLS = 1, + __ctx_convertBPF_PROG_TYPE_SCHED_ACT = 2, + __ctx_convertBPF_PROG_TYPE_XDP = 3, + __ctx_convertBPF_PROG_TYPE_CGROUP_SKB = 4, + __ctx_convertBPF_PROG_TYPE_CGROUP_SOCK = 5, + __ctx_convertBPF_PROG_TYPE_CGROUP_SOCK_ADDR = 6, + __ctx_convertBPF_PROG_TYPE_LWT_IN = 7, + __ctx_convertBPF_PROG_TYPE_LWT_OUT = 8, + __ctx_convertBPF_PROG_TYPE_LWT_XMIT = 9, + __ctx_convertBPF_PROG_TYPE_LWT_SEG6LOCAL = 10, + __ctx_convertBPF_PROG_TYPE_SOCK_OPS = 11, + __ctx_convertBPF_PROG_TYPE_SK_SKB = 12, + __ctx_convertBPF_PROG_TYPE_SK_MSG = 13, + __ctx_convertBPF_PROG_TYPE_FLOW_DISSECTOR = 14, + __ctx_convertBPF_PROG_TYPE_KPROBE = 15, + __ctx_convertBPF_PROG_TYPE_TRACEPOINT = 16, + __ctx_convertBPF_PROG_TYPE_PERF_EVENT = 17, + __ctx_convertBPF_PROG_TYPE_RAW_TRACEPOINT = 18, + __ctx_convertBPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE = 19, + __ctx_convertBPF_PROG_TYPE_TRACING = 20, + __ctx_convertBPF_PROG_TYPE_CGROUP_DEVICE = 21, + __ctx_convertBPF_PROG_TYPE_CGROUP_SYSCTL = 22, + __ctx_convertBPF_PROG_TYPE_CGROUP_SOCKOPT = 23, + __ctx_convertBPF_PROG_TYPE_LIRC_MODE2 = 24, + __ctx_convertBPF_PROG_TYPE_SK_REUSEPORT = 25, + __ctx_convertBPF_PROG_TYPE_SK_LOOKUP = 26, + __ctx_convertBPF_PROG_TYPE_STRUCT_OPS = 27, + __ctx_convertBPF_PROG_TYPE_EXT = 28, + __ctx_convertBPF_PROG_TYPE_LSM = 29, + __ctx_convert_unused = 30, +}; + +enum bpf_struct_walk_result { + WALK_SCALAR = 0, + WALK_PTR = 1, + WALK_STRUCT = 2, +}; + +struct btf_show_snprintf { + struct btf_show show; + int len_left; + int len; +}; + +struct btf_module { + struct list_head list; + struct module *module; + struct btf *btf; + struct bin_attribute *sysfs_attr; +}; + +struct bpf_dispatcher_prog { + struct bpf_prog *prog; + refcount_t users; +}; + +struct bpf_dispatcher { + struct mutex mutex; + void *func; + struct bpf_dispatcher_prog progs[48]; + int num_progs; + void *image; + u32 image_off; + struct bpf_ksym ksym; +}; + +struct bpf_devmap_val { + __u32 ifindex; + union { + int fd; + __u32 id; + } bpf_prog; +}; + +enum net_device_flags { + IFF_UP = 1, + IFF_BROADCAST = 2, + IFF_DEBUG = 4, + IFF_LOOPBACK = 8, + IFF_POINTOPOINT = 16, + IFF_NOTRAILERS = 32, + IFF_RUNNING = 64, + IFF_NOARP = 128, + IFF_PROMISC = 256, + IFF_ALLMULTI = 512, + IFF_MASTER = 1024, + IFF_SLAVE = 2048, + IFF_MULTICAST = 4096, + IFF_PORTSEL = 8192, + IFF_AUTOMEDIA = 16384, + IFF_DYNAMIC = 32768, + IFF_LOWER_UP = 65536, + IFF_DORMANT = 131072, + IFF_ECHO = 262144, +}; + +struct xdp_dev_bulk_queue { + struct xdp_frame *q[16]; + struct list_head flush_node; + struct net_device *dev; + struct net_device *dev_rx; + unsigned int count; +}; + +enum netdev_cmd { + NETDEV_UP = 1, + NETDEV_DOWN = 2, + NETDEV_REBOOT = 3, + NETDEV_CHANGE = 4, + NETDEV_REGISTER = 5, + NETDEV_UNREGISTER = 6, + NETDEV_CHANGEMTU = 7, + NETDEV_CHANGEADDR = 8, + NETDEV_PRE_CHANGEADDR = 9, + NETDEV_GOING_DOWN = 10, + NETDEV_CHANGENAME = 11, + NETDEV_FEAT_CHANGE = 12, + NETDEV_BONDING_FAILOVER = 13, + NETDEV_PRE_UP = 14, + NETDEV_PRE_TYPE_CHANGE = 15, + NETDEV_POST_TYPE_CHANGE = 16, + NETDEV_POST_INIT = 17, + NETDEV_RELEASE = 18, + NETDEV_NOTIFY_PEERS = 19, + NETDEV_JOIN = 20, + NETDEV_CHANGEUPPER = 21, + NETDEV_RESEND_IGMP = 22, + NETDEV_PRECHANGEMTU = 23, + NETDEV_CHANGEINFODATA = 24, + NETDEV_BONDING_INFO = 25, + NETDEV_PRECHANGEUPPER = 26, + NETDEV_CHANGELOWERSTATE = 27, + NETDEV_UDP_TUNNEL_PUSH_INFO = 28, + NETDEV_UDP_TUNNEL_DROP_INFO = 29, + NETDEV_CHANGE_TX_QUEUE_LEN = 30, + NETDEV_CVLAN_FILTER_PUSH_INFO = 31, + NETDEV_CVLAN_FILTER_DROP_INFO = 32, + NETDEV_SVLAN_FILTER_PUSH_INFO = 33, + NETDEV_SVLAN_FILTER_DROP_INFO = 34, +}; + +struct netdev_notifier_info { + struct net_device *dev; + struct netlink_ext_ack *extack; +}; + +struct bpf_dtab; + +struct bpf_dtab_netdev { + struct net_device *dev; + struct hlist_node index_hlist; + struct bpf_dtab *dtab; + struct bpf_prog *xdp_prog; + struct callback_head rcu; + unsigned int idx; + struct bpf_devmap_val val; +}; + +struct bpf_dtab { + struct bpf_map map; + struct bpf_dtab_netdev **netdev_map; + struct list_head list; + struct hlist_head *dev_index_head; + spinlock_t index_lock; + unsigned int items; + u32 n_buckets; + long: 32; + long: 64; + long: 64; +}; + +struct bpf_cpumap_val { + __u32 qsize; + union { + int fd; + __u32 id; + } bpf_prog; +}; + +typedef struct bio_vec skb_frag_t; + +struct skb_shared_hwtstamps { + ktime_t hwtstamp; +}; + +struct skb_shared_info { + __u8 __unused; + __u8 meta_len; + __u8 nr_frags; + __u8 tx_flags; + short unsigned int gso_size; + short unsigned int gso_segs; + struct sk_buff *frag_list; + struct skb_shared_hwtstamps hwtstamps; + unsigned int gso_type; + u32 tskey; + atomic_t dataref; + void *destructor_arg; + skb_frag_t frags[17]; +}; + +struct bpf_nh_params { + u32 nh_family; + union { + u32 ipv4_nh; + struct in6_addr ipv6_nh; + }; +}; + +struct bpf_redirect_info { + u32 flags; + u32 tgt_index; + void *tgt_value; + struct bpf_map *map; + u32 kern_flags; + struct bpf_nh_params nh; +}; + +struct ptr_ring { + int producer; + spinlock_t producer_lock; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + int consumer_head; + int consumer_tail; + spinlock_t consumer_lock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + int size; + int batch; + void **queue; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct bpf_cpu_map_entry; + +struct xdp_bulk_queue { + void *q[8]; + struct list_head flush_node; + struct bpf_cpu_map_entry *obj; + unsigned int count; +}; + +struct bpf_cpu_map; + +struct bpf_cpu_map_entry { + u32 cpu; + int map_id; + struct xdp_bulk_queue *bulkq; + struct bpf_cpu_map *cmap; + struct ptr_ring *queue; + struct task_struct *kthread; + struct bpf_cpumap_val value; + struct bpf_prog *prog; + atomic_t refcnt; + struct callback_head rcu; + struct work_struct kthread_stop_wq; +}; + +struct bpf_cpu_map { + struct bpf_map map; + struct bpf_cpu_map_entry **cpu_map; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct rhlist_head { + struct rhash_head rhead; + struct rhlist_head *next; +}; + +struct bpf_prog_offload_ops { + int (*insn_hook)(struct bpf_verifier_env *, int, int); + int (*finalize)(struct bpf_verifier_env *); + int (*replace_insn)(struct bpf_verifier_env *, u32, struct bpf_insn *); + int (*remove_insns)(struct bpf_verifier_env *, u32, u32); + int (*prepare)(struct bpf_prog *); + int (*translate)(struct bpf_prog *); + void (*destroy)(struct bpf_prog *); +}; + +struct bpf_offload_dev { + const struct bpf_prog_offload_ops *ops; + struct list_head netdevs; + void *priv; +}; + +typedef struct ns_common *ns_get_path_helper_t(void *); + +struct bpf_offload_netdev { + struct rhash_head l; + struct net_device *netdev; + struct bpf_offload_dev *offdev; + struct list_head progs; + struct list_head maps; + struct list_head offdev_netdevs; +}; + +struct ns_get_path_bpf_prog_args { + struct bpf_prog *prog; + struct bpf_prog_info *info; +}; + +struct ns_get_path_bpf_map_args { + struct bpf_offloaded_map *offmap; + struct bpf_map_info *info; +}; + +struct bpf_netns_link { + struct bpf_link link; + enum bpf_attach_type type; + enum netns_bpf_attach_type netns_type; + struct net *net; + struct list_head node; +}; + +enum bpf_stack_build_id_status { + BPF_STACK_BUILD_ID_EMPTY = 0, + BPF_STACK_BUILD_ID_VALID = 1, + BPF_STACK_BUILD_ID_IP = 2, +}; + +struct bpf_stack_build_id { + __s32 status; + unsigned char build_id[20]; + union { + __u64 offset; + __u64 ip; + }; +}; + +enum { + BPF_F_SKIP_FIELD_MASK = 255, + BPF_F_USER_STACK = 256, + BPF_F_FAST_STACK_CMP = 512, + BPF_F_REUSE_STACKID = 1024, + BPF_F_USER_BUILD_ID = 2048, +}; + +typedef __u32 Elf32_Addr; + +typedef __u16 Elf32_Half; + +typedef __u32 Elf32_Off; + +struct elf32_hdr { + unsigned char e_ident[16]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +}; + +typedef struct elf32_hdr Elf32_Ehdr; + +struct elf32_phdr { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +}; + +typedef struct elf32_phdr Elf32_Phdr; + +typedef struct elf32_note Elf32_Nhdr; + +enum perf_callchain_context { + PERF_CONTEXT_HV = 4294967264, + PERF_CONTEXT_KERNEL = 4294967168, + PERF_CONTEXT_USER = 4294966784, + PERF_CONTEXT_GUEST = 4294965248, + PERF_CONTEXT_GUEST_KERNEL = 4294965120, + PERF_CONTEXT_GUEST_USER = 4294964736, + PERF_CONTEXT_MAX = 4294963201, +}; + +struct stack_map_bucket { + struct pcpu_freelist_node fnode; + u32 hash; + u32 nr; + u64 data[0]; +}; + +struct bpf_stack_map { + struct bpf_map map; + void *elems; + struct pcpu_freelist freelist; + u32 n_buckets; + struct stack_map_bucket *buckets[0]; + long: 64; + long: 64; + long: 64; +}; + +struct stack_map_irq_work { + struct irq_work irq_work; + struct mm_struct *mm; +}; + +typedef u64 (*btf_bpf_get_stackid)(struct pt_regs *, struct bpf_map *, u64); + +typedef u64 (*btf_bpf_get_stackid_pe)(struct bpf_perf_event_data_kern *, struct bpf_map *, u64); + +typedef u64 (*btf_bpf_get_stack)(struct pt_regs *, void *, u32, u64); + +typedef u64 (*btf_bpf_get_task_stack)(struct task_struct *, void *, u32, u64); + +typedef u64 (*btf_bpf_get_stack_pe)(struct bpf_perf_event_data_kern *, void *, u32, u64); + +enum { + BPF_F_SYSCTL_BASE_NAME = 1, +}; + +struct bpf_prog_list { + struct list_head node; + struct bpf_prog *prog; + struct bpf_cgroup_link *link; + struct bpf_cgroup_storage *storage[2]; +}; + +struct qdisc_skb_cb { + struct { + unsigned int pkt_len; + u16 slave_dev_queue_mapping; + u16 tc_classid; + }; + unsigned char data[20]; + u16 mru; +}; + +struct bpf_skb_data_end { + struct qdisc_skb_cb qdisc_cb; + void *data_meta; + void *data_end; +}; + +enum { + TCPF_ESTABLISHED = 2, + TCPF_SYN_SENT = 4, + TCPF_SYN_RECV = 8, + TCPF_FIN_WAIT1 = 16, + TCPF_FIN_WAIT2 = 32, + TCPF_TIME_WAIT = 64, + TCPF_CLOSE = 128, + TCPF_CLOSE_WAIT = 256, + TCPF_LAST_ACK = 512, + TCPF_LISTEN = 1024, + TCPF_CLOSING = 2048, + TCPF_NEW_SYN_RECV = 4096, +}; + +typedef u64 (*btf_bpf_sysctl_get_name)(struct bpf_sysctl_kern *, char *, size_t, u64); + +typedef u64 (*btf_bpf_sysctl_get_current_value)(struct bpf_sysctl_kern *, char *, size_t); + +typedef u64 (*btf_bpf_sysctl_get_new_value)(struct bpf_sysctl_kern *, char *, size_t); + +typedef u64 (*btf_bpf_sysctl_set_new_value)(struct bpf_sysctl_kern *, const char *, size_t); + +enum sock_type { + SOCK_STREAM = 1, + SOCK_DGRAM = 2, + SOCK_RAW = 3, + SOCK_RDM = 4, + SOCK_SEQPACKET = 5, + SOCK_DCCP = 6, + SOCK_PACKET = 10, +}; + +enum { + IPPROTO_IP = 0, + IPPROTO_ICMP = 1, + IPPROTO_IGMP = 2, + IPPROTO_IPIP = 4, + IPPROTO_TCP = 6, + IPPROTO_EGP = 8, + IPPROTO_PUP = 12, + IPPROTO_UDP = 17, + IPPROTO_IDP = 22, + IPPROTO_TP = 29, + IPPROTO_DCCP = 33, + IPPROTO_IPV6 = 41, + IPPROTO_RSVP = 46, + IPPROTO_GRE = 47, + IPPROTO_ESP = 50, + IPPROTO_AH = 51, + IPPROTO_MTP = 92, + IPPROTO_BEETPH = 94, + IPPROTO_ENCAP = 98, + IPPROTO_PIM = 103, + IPPROTO_COMP = 108, + IPPROTO_SCTP = 132, + IPPROTO_UDPLITE = 136, + IPPROTO_MPLS = 137, + IPPROTO_ETHERNET = 143, + IPPROTO_RAW = 255, + IPPROTO_MPTCP = 262, + IPPROTO_MAX = 263, +}; + +enum sock_flags { + SOCK_DEAD = 0, + SOCK_DONE = 1, + SOCK_URGINLINE = 2, + SOCK_KEEPOPEN = 3, + SOCK_LINGER = 4, + SOCK_DESTROY = 5, + SOCK_BROADCAST = 6, + SOCK_TIMESTAMP = 7, + SOCK_ZAPPED = 8, + SOCK_USE_WRITE_QUEUE = 9, + SOCK_DBG = 10, + SOCK_RCVTSTAMP = 11, + SOCK_RCVTSTAMPNS = 12, + SOCK_LOCALROUTE = 13, + SOCK_MEMALLOC = 14, + SOCK_TIMESTAMPING_RX_SOFTWARE = 15, + SOCK_FASYNC = 16, + SOCK_RXQ_OVFL = 17, + SOCK_ZEROCOPY = 18, + SOCK_WIFI_STATUS = 19, + SOCK_NOFCS = 20, + SOCK_FILTER_LOCKED = 21, + SOCK_SELECT_ERR_QUEUE = 22, + SOCK_RCU_FREE = 23, + SOCK_TXTIME = 24, + SOCK_XDP = 25, + SOCK_TSTAMP_NEW = 26, +}; + +struct reuseport_array { + struct bpf_map map; + struct sock *ptrs[0]; +}; + +enum bpf_struct_ops_state { + BPF_STRUCT_OPS_STATE_INIT = 0, + BPF_STRUCT_OPS_STATE_INUSE = 1, + BPF_STRUCT_OPS_STATE_TOBEFREE = 2, +}; + +struct bpf_struct_ops_value { + refcount_t refcnt; + enum bpf_struct_ops_state state; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + char data[0]; +}; + +struct bpf_struct_ops_map { + struct bpf_map map; + const struct bpf_struct_ops *st_ops; + struct mutex lock; + struct bpf_prog **progs; + void *image; + struct bpf_struct_ops_value *uvalue; + struct bpf_struct_ops_value kvalue; +}; + +struct bpf_struct_ops_tcp_congestion_ops { + refcount_t refcnt; + enum bpf_struct_ops_state state; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct tcp_congestion_ops data; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct sembuf { + short unsigned int sem_num; + short int sem_op; + short int sem_flg; +}; + +enum key_need_perm { + KEY_NEED_UNSPECIFIED = 0, + KEY_NEED_VIEW = 1, + KEY_NEED_READ = 2, + KEY_NEED_WRITE = 3, + KEY_NEED_SEARCH = 4, + KEY_NEED_LINK = 5, + KEY_NEED_SETATTR = 6, + KEY_NEED_UNLINK = 7, + KEY_SYSADMIN_OVERRIDE = 8, + KEY_AUTHTOKEN_OVERRIDE = 9, + KEY_DEFER_PERM_CHECK = 10, +}; + +struct __key_reference_with_attributes; + +typedef struct __key_reference_with_attributes *key_ref_t; + +struct xfrm_sec_ctx { + __u8 ctx_doi; + __u8 ctx_alg; + __u16 ctx_len; + __u32 ctx_sid; + char ctx_str[0]; +}; + +struct xfrm_user_sec_ctx { + __u16 len; + __u16 exttype; + __u8 ctx_alg; + __u8 ctx_doi; + __u16 ctx_len; +}; + +enum { + BPF_F_BPRM_SECUREEXEC = 1, +}; + +struct watch_notification; + +typedef u64 (*btf_bpf_bprm_opts_set)(struct linux_binprm *, u64); + +typedef u64 (*btf_bpf_ima_inode_hash)(struct inode *, void *, u32); + +struct static_call_tramp_key { + s32 tramp; + s32 key; +}; + +enum perf_event_read_format { + PERF_FORMAT_TOTAL_TIME_ENABLED = 1, + PERF_FORMAT_TOTAL_TIME_RUNNING = 2, + PERF_FORMAT_ID = 4, + PERF_FORMAT_GROUP = 8, + PERF_FORMAT_MAX = 16, +}; + +enum perf_event_ioc_flags { + PERF_IOC_FLAG_GROUP = 1, +}; + +struct perf_ns_link_info { + __u64 dev; + __u64 ino; +}; + +enum { + NET_NS_INDEX = 0, + UTS_NS_INDEX = 1, + IPC_NS_INDEX = 2, + PID_NS_INDEX = 3, + USER_NS_INDEX = 4, + MNT_NS_INDEX = 5, + CGROUP_NS_INDEX = 6, + NR_NAMESPACES = 7, +}; + +enum perf_event_type { + PERF_RECORD_MMAP = 1, + PERF_RECORD_LOST = 2, + PERF_RECORD_COMM = 3, + PERF_RECORD_EXIT = 4, + PERF_RECORD_THROTTLE = 5, + PERF_RECORD_UNTHROTTLE = 6, + PERF_RECORD_FORK = 7, + PERF_RECORD_READ = 8, + PERF_RECORD_SAMPLE = 9, + PERF_RECORD_MMAP2 = 10, + PERF_RECORD_AUX = 11, + PERF_RECORD_ITRACE_START = 12, + PERF_RECORD_LOST_SAMPLES = 13, + PERF_RECORD_SWITCH = 14, + PERF_RECORD_SWITCH_CPU_WIDE = 15, + PERF_RECORD_NAMESPACES = 16, + PERF_RECORD_KSYMBOL = 17, + PERF_RECORD_BPF_EVENT = 18, + PERF_RECORD_CGROUP = 19, + PERF_RECORD_TEXT_POKE = 20, + PERF_RECORD_MAX = 21, +}; + +struct swevent_hlist { + struct hlist_head heads[256]; + struct callback_head callback_head; +}; + +struct pmu_event_list { + raw_spinlock_t lock; + struct list_head list; +}; + +struct perf_buffer { + refcount_t refcount; + struct callback_head callback_head; + int nr_pages; + int overwrite; + int paused; + atomic_t poll; + local_t head; + unsigned int nest; + local_t events; + local_t wakeup; + local_t lost; + long int watermark; + long int aux_watermark; + spinlock_t event_lock; + struct list_head event_list; + atomic_t mmap_count; + long unsigned int mmap_locked; + struct user_struct *mmap_user; + long int aux_head; + unsigned int aux_nest; + long int aux_wakeup; + long unsigned int aux_pgoff; + int aux_nr_pages; + int aux_overwrite; + atomic_t aux_mmap_count; + long unsigned int aux_mmap_locked; + void (*free_aux)(void *); + refcount_t aux_refcount; + int aux_in_sampling; + void **aux_pages; + void *aux_priv; + struct perf_event_mmap_page *user_page; + void *data_pages[0]; +}; + +struct match_token { + int token; + const char *pattern; +}; + +enum { + MAX_OPT_ARGS = 3, +}; + +typedef struct { + char *from; + char *to; +} substring_t; + +struct min_heap { + void *data; + int nr; + int size; +}; + +struct min_heap_callbacks { + int elem_size; + bool (*less)(const void *, const void *); + void (*swp)(void *, void *); +}; + +typedef int (*remote_function_f)(void *); + +struct remote_function_call { + struct task_struct *p; + remote_function_f func; + void *info; + int ret; +}; + +typedef void (*event_f)(struct perf_event *, struct perf_cpu_context *, struct perf_event_context *, void *); + +struct event_function_struct { + struct perf_event *event; + event_f func; + void *data; +}; + +enum event_type_t { + EVENT_FLEXIBLE = 1, + EVENT_PINNED = 2, + EVENT_TIME = 4, + EVENT_CPU = 8, + EVENT_ALL = 3, +}; + +struct stop_event_data { + struct perf_event *event; + unsigned int restart; +}; + +struct perf_read_data { + struct perf_event *event; + bool group; + int ret; +}; + +struct perf_read_event { + struct perf_event_header header; + u32 pid; + u32 tid; +}; + +typedef void perf_iterate_f(struct perf_event *, void *); + +struct remote_output { + struct perf_buffer *rb; + int err; +}; + +struct perf_task_event { + struct task_struct *task; + struct perf_event_context *task_ctx; + struct { + struct perf_event_header header; + u32 pid; + u32 ppid; + u32 tid; + u32 ptid; + u64 time; + } event_id; +}; + +struct perf_comm_event { + struct task_struct *task; + char *comm; + int comm_size; + struct { + struct perf_event_header header; + u32 pid; + u32 tid; + } event_id; +}; + +struct perf_namespaces_event { + struct task_struct *task; + struct { + struct perf_event_header header; + u32 pid; + u32 tid; + u64 nr_namespaces; + struct perf_ns_link_info link_info[7]; + } event_id; +}; + +struct perf_cgroup_event { + char *path; + int path_size; + struct { + struct perf_event_header header; + u64 id; + char path[0]; + } event_id; +}; + +struct perf_mmap_event { + struct vm_area_struct *vma; + const char *file_name; + int file_size; + int maj; + int min; + u64 ino; + u64 ino_generation; + u32 prot; + u32 flags; + struct { + struct perf_event_header header; + u32 pid; + u32 tid; + u64 start; + u64 len; + u64 pgoff; + } event_id; +}; + +struct perf_switch_event { + struct task_struct *task; + struct task_struct *next_prev; + struct { + struct perf_event_header header; + u32 next_prev_pid; + u32 next_prev_tid; + } event_id; +}; + +struct perf_ksymbol_event { + const char *name; + int name_len; + struct { + struct perf_event_header header; + u64 addr; + u32 len; + u16 ksym_type; + u16 flags; + } event_id; +}; + +struct perf_bpf_event { + struct bpf_prog *prog; + struct { + struct perf_event_header header; + u16 type; + u16 flags; + u32 id; + u8 tag[8]; + } event_id; +}; + +struct perf_text_poke_event { + const void *old_bytes; + const void *new_bytes; + size_t pad; + u16 old_len; + u16 new_len; + struct { + struct perf_event_header header; + u64 addr; + } event_id; +}; + +struct swevent_htable { + struct swevent_hlist *swevent_hlist; + struct mutex hlist_mutex; + int hlist_refcount; + int recursion[4]; +}; + +enum perf_probe_config { + PERF_PROBE_CONFIG_IS_RETPROBE = 1, + PERF_UPROBE_REF_CTR_OFFSET_BITS = 32, + PERF_UPROBE_REF_CTR_OFFSET_SHIFT = 32, +}; + +enum { + IF_ACT_NONE = 4294967295, + IF_ACT_FILTER = 0, + IF_ACT_START = 1, + IF_ACT_STOP = 2, + IF_SRC_FILE = 3, + IF_SRC_KERNEL = 4, + IF_SRC_FILEADDR = 5, + IF_SRC_KERNELADDR = 6, +}; + +enum { + IF_STATE_ACTION = 0, + IF_STATE_SOURCE = 1, + IF_STATE_END = 2, +}; + +struct perf_aux_event { + struct perf_event_header header; + u32 pid; + u32 tid; +}; + +struct perf_aux_event___2 { + struct perf_event_header header; + u64 offset; + u64 size; + u64 flags; +}; + +struct callchain_cpus_entries { + struct callback_head callback_head; + struct perf_callchain_entry *cpu_entries[0]; +}; + +enum bp_type_idx { + TYPE_INST = 0, + TYPE_DATA = 0, + TYPE_MAX = 1, +}; + +struct bp_cpuinfo { + unsigned int cpu_pinned; + unsigned int *tsk_pinned; + unsigned int flexible; +}; + +struct bp_busy_slots { + unsigned int pinned; + unsigned int flexible; +}; + +typedef u8 uprobe_opcode_t; + +struct uprobe { + struct rb_node rb_node; + refcount_t ref; + struct rw_semaphore register_rwsem; + struct rw_semaphore consumer_rwsem; + struct list_head pending_list; + struct uprobe_consumer *consumers; + struct inode *inode; + loff_t offset; + loff_t ref_ctr_offset; + long unsigned int flags; + struct arch_uprobe arch; +}; + +struct xol_area { + wait_queue_head_t wq; + atomic_t slot_count; + long unsigned int *bitmap; + struct vm_special_mapping xol_mapping; + struct page *pages[2]; + long unsigned int vaddr; +}; + +struct compact_control; + +struct capture_control { + struct compact_control *cc; + struct page *page; +}; + +typedef int filler_t(void *, struct page *); + +struct page_vma_mapped_walk { + struct page *page; + struct vm_area_struct *vma; + long unsigned int address; + pmd_t *pmd; + pte_t *pte; + spinlock_t *ptl; + unsigned int flags; +}; + +struct compact_control { + struct list_head freepages; + struct list_head migratepages; + unsigned int nr_freepages; + unsigned int nr_migratepages; + long unsigned int free_pfn; + long unsigned int migrate_pfn; + long unsigned int fast_start_pfn; + struct zone *zone; + long unsigned int total_migrate_scanned; + long unsigned int total_free_scanned; + short unsigned int fast_search_fail; + short int search_order; + const gfp_t gfp_mask; + int order; + int migratetype; + const unsigned int alloc_flags; + const int highest_zoneidx; + enum migrate_mode mode; + bool ignore_skip_hint; + bool no_set_skip_hint; + bool ignore_block_suitable; + bool direct_compaction; + bool proactive_compaction; + bool whole_zone; + bool contended; + bool rescan; + bool alloc_contig; +}; + +struct delayed_uprobe { + struct list_head list; + struct uprobe *uprobe; + struct mm_struct *mm; +}; + +struct map_info { + struct map_info *next; + struct mm_struct *mm; + long unsigned int vaddr; +}; + +struct user_return_notifier { + void (*on_user_return)(struct user_return_notifier *); + struct hlist_node link; +}; + +struct parallel_data; + +struct padata_priv { + struct list_head list; + struct parallel_data *pd; + int cb_cpu; + unsigned int seq_nr; + int info; + void (*parallel)(struct padata_priv *); + void (*serial)(struct padata_priv *); +}; + +struct padata_cpumask { + cpumask_var_t pcpu; + cpumask_var_t cbcpu; +}; + +struct padata_shell; + +struct padata_list; + +struct padata_serial_queue; + +struct parallel_data { + struct padata_shell *ps; + struct padata_list *reorder_list; + struct padata_serial_queue *squeue; + atomic_t refcnt; + unsigned int seq_nr; + unsigned int processed; + int cpu; + struct padata_cpumask cpumask; + struct work_struct reorder_work; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + spinlock_t lock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct padata_list { + struct list_head list; + spinlock_t lock; +}; + +struct padata_serial_queue { + struct padata_list serial; + struct work_struct work; + struct parallel_data *pd; +}; + +struct padata_instance; + +struct padata_shell { + struct padata_instance *pinst; + struct parallel_data *pd; + struct parallel_data *opd; + struct list_head list; +}; + +struct padata_instance { + struct hlist_node cpu_online_node; + struct hlist_node cpu_dead_node; + struct workqueue_struct *parallel_wq; + struct workqueue_struct *serial_wq; + struct list_head pslist; + struct padata_cpumask cpumask; + struct kobject kobj; + struct mutex lock; + u8 flags; +}; + +struct padata_mt_job { + void (*thread_fn)(long unsigned int, long unsigned int, void *); + void *fn_arg; + long unsigned int start; + long unsigned int size; + long unsigned int align; + long unsigned int min_chunk; + int max_threads; +}; + +struct padata_work { + struct work_struct pw_work; + struct list_head pw_list; + void *pw_data; +}; + +struct padata_mt_job_state { + spinlock_t lock; + struct completion completion; + struct padata_mt_job *job; + int nworks; + int nworks_fini; + long unsigned int chunk_size; +}; + +struct padata_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct padata_instance *, struct attribute *, char *); + ssize_t (*store)(struct padata_instance *, struct attribute *, const char *, size_t); +}; + +struct static_key_mod { + struct static_key_mod *next; + struct jump_entry *entries; + struct module *mod; +}; + +struct static_key_deferred { + struct static_key key; + long unsigned int timeout; + struct delayed_work work; +}; + +struct trace_event_raw_context_tracking_user { + struct trace_entry ent; + int dummy; + char __data[0]; +}; + +struct trace_event_data_offsets_context_tracking_user {}; + +typedef void (*btf_trace_user_enter)(void *, int); + +typedef void (*btf_trace_user_exit)(void *, int); + +enum rseq_cpu_id_state { + RSEQ_CPU_ID_UNINITIALIZED = 4294967295, + RSEQ_CPU_ID_REGISTRATION_FAILED = 4294967294, +}; + +enum rseq_flags { + RSEQ_FLAG_UNREGISTER = 1, +}; + +enum rseq_cs_flags { + RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT = 1, + RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL = 2, + RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE = 4, +}; + +struct rseq_cs { + __u32 version; + __u32 flags; + __u64 start_ip; + __u64 post_commit_offset; + __u64 abort_ip; +}; + +struct trace_event_raw_rseq_update { + struct trace_entry ent; + s32 cpu_id; + char __data[0]; +}; + +struct trace_event_raw_rseq_ip_fixup { + struct trace_entry ent; + long unsigned int regs_ip; + long unsigned int start_ip; + long unsigned int post_commit_offset; + long unsigned int abort_ip; + char __data[0]; +}; + +struct trace_event_data_offsets_rseq_update {}; + +struct trace_event_data_offsets_rseq_ip_fixup {}; + +typedef void (*btf_trace_rseq_update)(void *, struct task_struct *); + +typedef void (*btf_trace_rseq_ip_fixup)(void *, long unsigned int, long unsigned int, long unsigned int, long unsigned int); + +struct watch; + +struct watch_list { + struct callback_head rcu; + struct hlist_head watchers; + void (*release_watch)(struct watch *); + spinlock_t lock; +}; + +enum watch_notification_type { + WATCH_TYPE_META = 0, + WATCH_TYPE_KEY_NOTIFY = 1, + WATCH_TYPE__NR = 2, +}; + +enum watch_meta_notification_subtype { + WATCH_META_REMOVAL_NOTIFICATION = 0, + WATCH_META_LOSS_NOTIFICATION = 1, +}; + +struct watch_notification___2 { + __u32 type: 24; + __u32 subtype: 8; + __u32 info; +}; + +struct watch_notification_type_filter { + __u32 type; + __u32 info_filter; + __u32 info_mask; + __u32 subtype_filter[8]; +}; + +struct watch_notification_filter { + __u32 nr_filters; + __u32 __reserved; + struct watch_notification_type_filter filters[0]; +}; + +struct watch_notification_removal { + struct watch_notification___2 watch; + __u64 id; +}; + +struct watch_type_filter { + enum watch_notification_type type; + __u32 subtype_filter[1]; + __u32 info_filter; + __u32 info_mask; +}; + +struct watch_filter { + union { + struct callback_head rcu; + long unsigned int type_filter[2]; + }; + u32 nr_filters; + struct watch_type_filter filters[0]; +}; + +struct watch_queue { + struct callback_head rcu; + struct watch_filter *filter; + struct pipe_inode_info *pipe; + struct hlist_head watches; + struct page **notes; + long unsigned int *notes_bitmap; + struct kref usage; + spinlock_t lock; + unsigned int nr_notes; + unsigned int nr_pages; + bool defunct; +}; + +struct watch { + union { + struct callback_head rcu; + u32 info_id; + }; + struct watch_queue *queue; + struct hlist_node queue_node; + struct watch_list *watch_list; + struct hlist_node list_node; + const struct cred *cred; + void *private; + u64 id; + struct kref usage; +}; + +struct pkcs7_message; + +typedef int __kernel_rwf_t; + +enum positive_aop_returns { + AOP_WRITEPAGE_ACTIVATE = 524288, + AOP_TRUNCATED_PAGE = 524289, +}; + +struct vm_event_state { + long unsigned int event[96]; +}; + +enum mapping_flags { + AS_EIO = 0, + AS_ENOSPC = 1, + AS_MM_ALL_LOCKS = 2, + AS_UNEVICTABLE = 3, + AS_EXITING = 4, + AS_NO_WRITEBACK_TAGS = 5, + AS_THP_SUPPORT = 6, +}; + +struct wait_page_key { + struct page *page; + int bit_nr; + int page_match; +}; + +enum iter_type { + ITER_IOVEC = 4, + ITER_KVEC = 8, + ITER_BVEC = 16, + ITER_PIPE = 32, + ITER_DISCARD = 64, +}; + +struct pagevec { + unsigned char nr; + bool percpu_pvec_drained; + struct page *pages[15]; +}; + +struct fid { + union { + struct { + u32 ino; + u32 gen; + u32 parent_ino; + u32 parent_gen; + } i32; + struct { + u32 block; + u16 partref; + u16 parent_partref; + u32 generation; + u32 parent_block; + u32 parent_generation; + } udf; + __u32 raw[0]; + }; +}; + +struct trace_event_raw_mm_filemap_op_page_cache { + struct trace_entry ent; + long unsigned int pfn; + long unsigned int i_ino; + long unsigned int index; + dev_t s_dev; + char __data[0]; +}; + +struct trace_event_raw_filemap_set_wb_err { + struct trace_entry ent; + long unsigned int i_ino; + dev_t s_dev; + errseq_t errseq; + char __data[0]; +}; + +struct trace_event_raw_file_check_and_advance_wb_err { + struct trace_entry ent; + struct file *file; + long unsigned int i_ino; + dev_t s_dev; + errseq_t old; + errseq_t new; + char __data[0]; +}; + +struct trace_event_data_offsets_mm_filemap_op_page_cache {}; + +struct trace_event_data_offsets_filemap_set_wb_err {}; + +struct trace_event_data_offsets_file_check_and_advance_wb_err {}; + +typedef void (*btf_trace_mm_filemap_delete_from_page_cache)(void *, struct page *); + +typedef void (*btf_trace_mm_filemap_add_to_page_cache)(void *, struct page *); + +typedef void (*btf_trace_filemap_set_wb_err)(void *, struct address_space *, errseq_t); + +typedef void (*btf_trace_file_check_and_advance_wb_err)(void *, struct file *, errseq_t); + +enum behavior { + EXCLUSIVE = 0, + SHARED = 1, + DROP = 2, +}; + +struct reciprocal_value { + u32 m; + u8 sh1; + u8 sh2; +}; + +struct kmem_cache_order_objects { + unsigned int x; +}; + +struct kmem_cache_cpu; + +struct kmem_cache_node; + +struct kmem_cache { + struct kmem_cache_cpu *cpu_slab; + slab_flags_t flags; + long unsigned int min_partial; + unsigned int size; + unsigned int object_size; + struct reciprocal_value reciprocal_size; + unsigned int offset; + unsigned int cpu_partial; + struct kmem_cache_order_objects oo; + struct kmem_cache_order_objects max; + struct kmem_cache_order_objects min; + gfp_t allocflags; + int refcount; + void (*ctor)(void *); + unsigned int inuse; + unsigned int align; + unsigned int red_left_pad; + const char *name; + struct list_head list; + struct kobject kobj; + long unsigned int random; + unsigned int remote_node_defrag_ratio; + unsigned int *random_seq; + unsigned int useroffset; + unsigned int usersize; + struct kmem_cache_node *node[1024]; +}; + +struct kmem_cache_cpu { + void **freelist; + long unsigned int tid; + struct page *page; + struct page *partial; +}; + +struct kmem_cache_node { + spinlock_t list_lock; + long unsigned int nr_partial; + struct list_head partial; + atomic_long_t nr_slabs; + atomic_long_t total_objects; + struct list_head full; +}; + +struct zap_details { + struct address_space *check_mapping; + long unsigned int first_index; + long unsigned int last_index; +}; + +enum oom_constraint { + CONSTRAINT_NONE = 0, + CONSTRAINT_CPUSET = 1, + CONSTRAINT_MEMORY_POLICY = 2, + CONSTRAINT_MEMCG = 3, +}; + +struct oom_control { + struct zonelist *zonelist; + nodemask_t *nodemask; + struct mem_cgroup *memcg; + const gfp_t gfp_mask; + const int order; + long unsigned int totalpages; + struct task_struct *chosen; + long int chosen_points; + enum oom_constraint constraint; +}; + +enum compact_priority { + COMPACT_PRIO_SYNC_FULL = 0, + MIN_COMPACT_PRIORITY = 0, + COMPACT_PRIO_SYNC_LIGHT = 1, + MIN_COMPACT_COSTLY_PRIORITY = 1, + DEF_COMPACT_PRIORITY = 1, + COMPACT_PRIO_ASYNC = 2, + INIT_COMPACT_PRIORITY = 2, +}; + +enum compact_result { + COMPACT_NOT_SUITABLE_ZONE = 0, + COMPACT_SKIPPED = 1, + COMPACT_DEFERRED = 2, + COMPACT_NO_SUITABLE_PAGE = 3, + COMPACT_CONTINUE = 4, + COMPACT_COMPLETE = 5, + COMPACT_PARTIAL_SKIPPED = 6, + COMPACT_CONTENDED = 7, + COMPACT_SUCCESS = 8, +}; + +struct trace_event_raw_oom_score_adj_update { + struct trace_entry ent; + pid_t pid; + char comm[16]; + short int oom_score_adj; + char __data[0]; +}; + +struct trace_event_raw_reclaim_retry_zone { + struct trace_entry ent; + int node; + int zone_idx; + int order; + long unsigned int reclaimable; + long unsigned int available; + long unsigned int min_wmark; + int no_progress_loops; + bool wmark_check; + char __data[0]; +}; + +struct trace_event_raw_mark_victim { + struct trace_entry ent; + int pid; + char __data[0]; +}; + +struct trace_event_raw_wake_reaper { + struct trace_entry ent; + int pid; + char __data[0]; +}; + +struct trace_event_raw_start_task_reaping { + struct trace_entry ent; + int pid; + char __data[0]; +}; + +struct trace_event_raw_finish_task_reaping { + struct trace_entry ent; + int pid; + char __data[0]; +}; + +struct trace_event_raw_skip_task_reaping { + struct trace_entry ent; + int pid; + char __data[0]; +}; + +struct trace_event_raw_compact_retry { + struct trace_entry ent; + int order; + int priority; + int result; + int retries; + int max_retries; + bool ret; + char __data[0]; +}; + +struct trace_event_data_offsets_oom_score_adj_update {}; + +struct trace_event_data_offsets_reclaim_retry_zone {}; + +struct trace_event_data_offsets_mark_victim {}; + +struct trace_event_data_offsets_wake_reaper {}; + +struct trace_event_data_offsets_start_task_reaping {}; + +struct trace_event_data_offsets_finish_task_reaping {}; + +struct trace_event_data_offsets_skip_task_reaping {}; + +struct trace_event_data_offsets_compact_retry {}; + +typedef void (*btf_trace_oom_score_adj_update)(void *, struct task_struct *); + +typedef void (*btf_trace_reclaim_retry_zone)(void *, struct zoneref *, int, long unsigned int, long unsigned int, long unsigned int, int, bool); + +typedef void (*btf_trace_mark_victim)(void *, int); + +typedef void (*btf_trace_wake_reaper)(void *, int); + +typedef void (*btf_trace_start_task_reaping)(void *, int); + +typedef void (*btf_trace_finish_task_reaping)(void *, int); + +typedef void (*btf_trace_skip_task_reaping)(void *, int); + +typedef void (*btf_trace_compact_retry)(void *, int, enum compact_priority, enum compact_result, int, int, bool); + +enum wb_congested_state { + WB_async_congested = 0, + WB_sync_congested = 1, +}; + +enum wb_state { + WB_registered = 0, + WB_writeback_running = 1, + WB_has_dirty_io = 2, + WB_start_all = 3, +}; + +enum { + BLK_RW_ASYNC = 0, + BLK_RW_SYNC = 1, +}; + +struct wb_lock_cookie { + bool locked; + long unsigned int flags; +}; + +typedef int (*writepage_t)(struct page *, struct writeback_control *, void *); + +enum page_memcg_data_flags { + MEMCG_DATA_OBJCGS = 1, + MEMCG_DATA_KMEM = 2, + __NR_MEMCG_DATA_FLAGS = 4, +}; + +struct dirty_throttle_control { + struct wb_domain *dom; + struct dirty_throttle_control *gdtc; + struct bdi_writeback *wb; + struct fprop_local_percpu *wb_completions; + long unsigned int avail; + long unsigned int dirty; + long unsigned int thresh; + long unsigned int bg_thresh; + long unsigned int wb_dirty; + long unsigned int wb_thresh; + long unsigned int wb_bg_thresh; + long unsigned int pos_ratio; +}; + +typedef void compound_page_dtor(struct page *); + +struct trace_event_raw_mm_lru_insertion { + struct trace_entry ent; + struct page *page; + long unsigned int pfn; + int lru; + long unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_mm_lru_activate { + struct trace_entry ent; + struct page *page; + long unsigned int pfn; + char __data[0]; +}; + +struct trace_event_data_offsets_mm_lru_insertion {}; + +struct trace_event_data_offsets_mm_lru_activate {}; + +typedef void (*btf_trace_mm_lru_insertion)(void *, struct page *, int); + +typedef void (*btf_trace_mm_lru_activate)(void *, struct page *); + +struct lru_rotate { + local_lock_t lock; + struct pagevec pvec; +}; + +struct lru_pvecs { + local_lock_t lock; + struct pagevec lru_add; + struct pagevec lru_deactivate_file; + struct pagevec lru_deactivate; + struct pagevec lru_lazyfree; + struct pagevec activate_page; +}; + +enum lruvec_flags { + LRUVEC_CONGESTED = 0, +}; + +enum pgdat_flags { + PGDAT_DIRTY = 0, + PGDAT_WRITEBACK = 1, + PGDAT_RECLAIM_LOCKED = 2, +}; + +struct reclaim_stat { + unsigned int nr_dirty; + unsigned int nr_unqueued_dirty; + unsigned int nr_congested; + unsigned int nr_writeback; + unsigned int nr_immediate; + unsigned int nr_pageout; + unsigned int nr_activate[2]; + unsigned int nr_ref_keep; + unsigned int nr_unmap_fail; + unsigned int nr_lazyfree_fail; +}; + +struct mem_cgroup_reclaim_cookie { + pg_data_t *pgdat; + unsigned int generation; +}; + +enum ttu_flags { + TTU_MIGRATION = 1, + TTU_MUNLOCK = 2, + TTU_SPLIT_HUGE_PMD = 4, + TTU_IGNORE_MLOCK = 8, + TTU_IGNORE_HWPOISON = 32, + TTU_BATCH_FLUSH = 64, + TTU_RMAP_LOCKED = 128, + TTU_SPLIT_FREEZE = 256, +}; + +struct trace_event_raw_mm_vmscan_kswapd_sleep { + struct trace_entry ent; + int nid; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_kswapd_wake { + struct trace_entry ent; + int nid; + int zid; + int order; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_wakeup_kswapd { + struct trace_entry ent; + int nid; + int zid; + int order; + gfp_t gfp_flags; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_direct_reclaim_begin_template { + struct trace_entry ent; + int order; + gfp_t gfp_flags; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_direct_reclaim_end_template { + struct trace_entry ent; + long unsigned int nr_reclaimed; + char __data[0]; +}; + +struct trace_event_raw_mm_shrink_slab_start { + struct trace_entry ent; + struct shrinker *shr; + void *shrink; + int nid; + long int nr_objects_to_shrink; + gfp_t gfp_flags; + long unsigned int cache_items; + long long unsigned int delta; + long unsigned int total_scan; + int priority; + char __data[0]; +}; + +struct trace_event_raw_mm_shrink_slab_end { + struct trace_entry ent; + struct shrinker *shr; + int nid; + void *shrink; + long int unused_scan; + long int new_scan; + int retval; + long int total_scan; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_lru_isolate { + struct trace_entry ent; + int highest_zoneidx; + int order; + long unsigned int nr_requested; + long unsigned int nr_scanned; + long unsigned int nr_skipped; + long unsigned int nr_taken; + isolate_mode_t isolate_mode; + int lru; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_writepage { + struct trace_entry ent; + long unsigned int pfn; + int reclaim_flags; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_lru_shrink_inactive { + struct trace_entry ent; + int nid; + long unsigned int nr_scanned; + long unsigned int nr_reclaimed; + long unsigned int nr_dirty; + long unsigned int nr_writeback; + long unsigned int nr_congested; + long unsigned int nr_immediate; + unsigned int nr_activate0; + unsigned int nr_activate1; + long unsigned int nr_ref_keep; + long unsigned int nr_unmap_fail; + int priority; + int reclaim_flags; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_lru_shrink_active { + struct trace_entry ent; + int nid; + long unsigned int nr_taken; + long unsigned int nr_active; + long unsigned int nr_deactivated; + long unsigned int nr_referenced; + int priority; + int reclaim_flags; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_inactive_list_is_low { + struct trace_entry ent; + int nid; + int reclaim_idx; + long unsigned int total_inactive; + long unsigned int inactive; + long unsigned int total_active; + long unsigned int active; + long unsigned int ratio; + int reclaim_flags; + char __data[0]; +}; + +struct trace_event_raw_mm_vmscan_node_reclaim_begin { + struct trace_entry ent; + int nid; + int order; + gfp_t gfp_flags; + char __data[0]; +}; + +struct trace_event_data_offsets_mm_vmscan_kswapd_sleep {}; + +struct trace_event_data_offsets_mm_vmscan_kswapd_wake {}; + +struct trace_event_data_offsets_mm_vmscan_wakeup_kswapd {}; + +struct trace_event_data_offsets_mm_vmscan_direct_reclaim_begin_template {}; + +struct trace_event_data_offsets_mm_vmscan_direct_reclaim_end_template {}; + +struct trace_event_data_offsets_mm_shrink_slab_start {}; + +struct trace_event_data_offsets_mm_shrink_slab_end {}; + +struct trace_event_data_offsets_mm_vmscan_lru_isolate {}; + +struct trace_event_data_offsets_mm_vmscan_writepage {}; + +struct trace_event_data_offsets_mm_vmscan_lru_shrink_inactive {}; + +struct trace_event_data_offsets_mm_vmscan_lru_shrink_active {}; + +struct trace_event_data_offsets_mm_vmscan_inactive_list_is_low {}; + +struct trace_event_data_offsets_mm_vmscan_node_reclaim_begin {}; + +typedef void (*btf_trace_mm_vmscan_kswapd_sleep)(void *, int); + +typedef void (*btf_trace_mm_vmscan_kswapd_wake)(void *, int, int, int); + +typedef void (*btf_trace_mm_vmscan_wakeup_kswapd)(void *, int, int, int, gfp_t); + +typedef void (*btf_trace_mm_vmscan_direct_reclaim_begin)(void *, int, gfp_t); + +typedef void (*btf_trace_mm_vmscan_memcg_reclaim_begin)(void *, int, gfp_t); + +typedef void (*btf_trace_mm_vmscan_memcg_softlimit_reclaim_begin)(void *, int, gfp_t); + +typedef void (*btf_trace_mm_vmscan_direct_reclaim_end)(void *, long unsigned int); + +typedef void (*btf_trace_mm_vmscan_memcg_reclaim_end)(void *, long unsigned int); + +typedef void (*btf_trace_mm_vmscan_memcg_softlimit_reclaim_end)(void *, long unsigned int); + +typedef void (*btf_trace_mm_shrink_slab_start)(void *, struct shrinker *, struct shrink_control *, long int, long unsigned int, long long unsigned int, long unsigned int, int); + +typedef void (*btf_trace_mm_shrink_slab_end)(void *, struct shrinker *, int, int, long int, long int, long int); + +typedef void (*btf_trace_mm_vmscan_lru_isolate)(void *, int, int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, isolate_mode_t, int); + +typedef void (*btf_trace_mm_vmscan_writepage)(void *, struct page *); + +typedef void (*btf_trace_mm_vmscan_lru_shrink_inactive)(void *, int, long unsigned int, long unsigned int, struct reclaim_stat *, int, int); + +typedef void (*btf_trace_mm_vmscan_lru_shrink_active)(void *, int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, int, int); + +typedef void (*btf_trace_mm_vmscan_inactive_list_is_low)(void *, int, int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, int); + +typedef void (*btf_trace_mm_vmscan_node_reclaim_begin)(void *, int, int, gfp_t); + +typedef void (*btf_trace_mm_vmscan_node_reclaim_end)(void *, long unsigned int); + +struct scan_control { + long unsigned int nr_to_reclaim; + nodemask_t *nodemask; + struct mem_cgroup *target_mem_cgroup; + long unsigned int anon_cost; + long unsigned int file_cost; + unsigned int may_deactivate: 2; + unsigned int force_deactivate: 1; + unsigned int skipped_deactivate: 1; + unsigned int may_writepage: 1; + unsigned int may_unmap: 1; + unsigned int may_swap: 1; + unsigned int memcg_low_reclaim: 1; + unsigned int memcg_low_skipped: 1; + unsigned int hibernation_mode: 1; + unsigned int compaction_ready: 1; + unsigned int cache_trim_mode: 1; + unsigned int file_is_tiny: 1; + s8 order; + s8 priority; + s8 reclaim_idx; + gfp_t gfp_mask; + long unsigned int nr_scanned; + long unsigned int nr_reclaimed; + struct { + unsigned int dirty; + unsigned int unqueued_dirty; + unsigned int congested; + unsigned int writeback; + unsigned int immediate; + unsigned int file_taken; + unsigned int taken; + } nr; + struct reclaim_state reclaim_state; +}; + +typedef enum { + PAGE_KEEP = 0, + PAGE_ACTIVATE = 1, + PAGE_SUCCESS = 2, + PAGE_CLEAN = 3, +} pageout_t; + +enum page_references { + PAGEREF_RECLAIM = 0, + PAGEREF_RECLAIM_CLEAN = 1, + PAGEREF_KEEP = 2, + PAGEREF_ACTIVATE = 3, +}; + +enum scan_balance { + SCAN_EQUAL = 0, + SCAN_FRACT = 1, + SCAN_ANON = 2, + SCAN_FILE = 3, +}; + +enum transparent_hugepage_flag { + TRANSPARENT_HUGEPAGE_FLAG = 0, + TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG = 1, + TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG = 2, + TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG = 3, + TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG = 4, + TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG = 5, + TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG = 6, + TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG = 7, + TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG = 8, +}; + +struct xattr; + +typedef int (*initxattrs)(struct inode *, const struct xattr *, void *); + +struct xattr { + const char *name; + void *value; + size_t value_len; +}; + +struct constant_table { + const char *name; + int value; +}; + +enum { + MPOL_DEFAULT = 0, + MPOL_PREFERRED = 1, + MPOL_BIND = 2, + MPOL_INTERLEAVE = 3, + MPOL_LOCAL = 4, + MPOL_MAX = 5, +}; + +struct shared_policy { + struct rb_root root; + rwlock_t lock; +}; + +struct simple_xattrs { + struct list_head head; + spinlock_t lock; +}; + +struct simple_xattr { + struct list_head list; + char *name; + size_t size; + char value[0]; +}; + +struct shmem_inode_info { + spinlock_t lock; + unsigned int seals; + long unsigned int flags; + long unsigned int alloced; + long unsigned int swapped; + struct list_head shrinklist; + struct list_head swaplist; + struct shared_policy policy; + struct simple_xattrs xattrs; + atomic_t stop_eviction; + struct inode vfs_inode; +}; + +struct shmem_sb_info { + long unsigned int max_blocks; + struct percpu_counter used_blocks; + long unsigned int max_inodes; + long unsigned int free_inodes; + spinlock_t stat_lock; + umode_t mode; + unsigned char huge; + kuid_t uid; + kgid_t gid; + bool full_inums; + ino_t next_ino; + ino_t *ino_batch; + struct mempolicy *mpol; + spinlock_t shrinklist_lock; + struct list_head shrinklist; + long unsigned int shrinklist_len; +}; + +enum sgp_type { + SGP_READ = 0, + SGP_CACHE = 1, + SGP_NOHUGE = 2, + SGP_HUGE = 3, + SGP_WRITE = 4, + SGP_FALLOC = 5, +}; + +enum fid_type { + FILEID_ROOT = 0, + FILEID_INO32_GEN = 1, + FILEID_INO32_GEN_PARENT = 2, + FILEID_BTRFS_WITHOUT_PARENT = 77, + FILEID_BTRFS_WITH_PARENT = 78, + FILEID_BTRFS_WITH_PARENT_ROOT = 79, + FILEID_UDF_WITHOUT_PARENT = 81, + FILEID_UDF_WITH_PARENT = 82, + FILEID_NILFS_WITHOUT_PARENT = 97, + FILEID_NILFS_WITH_PARENT = 98, + FILEID_FAT_WITHOUT_PARENT = 113, + FILEID_FAT_WITH_PARENT = 114, + FILEID_LUSTRE = 151, + FILEID_KERNFS = 254, + FILEID_INVALID = 255, +}; + +struct shmem_falloc { + wait_queue_head_t *waitq; + long unsigned int start; + long unsigned int next; + long unsigned int nr_falloced; + long unsigned int nr_unswapped; +}; + +struct shmem_options { + long long unsigned int blocks; + long long unsigned int inodes; + struct mempolicy *mpol; + kuid_t uid; + kgid_t gid; + umode_t mode; + bool full_inums; + int huge; + int seen; +}; + +enum shmem_param { + Opt_gid = 0, + Opt_huge = 1, + Opt_mode = 2, + Opt_mpol = 3, + Opt_nr_blocks = 4, + Opt_nr_inodes = 5, + Opt_size = 6, + Opt_uid = 7, + Opt_inode32 = 8, + Opt_inode64 = 9, +}; + +enum writeback_stat_item { + NR_DIRTY_THRESHOLD = 0, + NR_DIRTY_BG_THRESHOLD = 1, + NR_VM_WRITEBACK_STAT_ITEMS = 2, +}; + +struct contig_page_info { + long unsigned int free_pages; + long unsigned int free_blocks_total; + long unsigned int free_blocks_suitable; +}; + +struct radix_tree_iter { + long unsigned int index; + long unsigned int next_index; + long unsigned int tags; + struct xa_node *node; +}; + +enum { + RADIX_TREE_ITER_TAG_MASK = 15, + RADIX_TREE_ITER_TAGGED = 16, + RADIX_TREE_ITER_CONTIG = 32, +}; + +enum mminit_level { + MMINIT_WARNING = 0, + MMINIT_VERIFY = 1, + MMINIT_TRACE = 2, +}; + +struct pcpu_group_info { + int nr_units; + long unsigned int base_offset; + unsigned int *cpu_map; +}; + +struct pcpu_alloc_info { + size_t static_size; + size_t reserved_size; + size_t dyn_size; + size_t unit_size; + size_t atom_size; + size_t alloc_size; + size_t __ai_size; + int nr_groups; + struct pcpu_group_info groups[0]; +}; + +struct trace_event_raw_percpu_alloc_percpu { + struct trace_entry ent; + bool reserved; + bool is_atomic; + size_t size; + size_t align; + void *base_addr; + int off; + void *ptr; + char __data[0]; +}; + +struct trace_event_raw_percpu_free_percpu { + struct trace_entry ent; + void *base_addr; + int off; + void *ptr; + char __data[0]; +}; + +struct trace_event_raw_percpu_alloc_percpu_fail { + struct trace_entry ent; + bool reserved; + bool is_atomic; + size_t size; + size_t align; + char __data[0]; +}; + +struct trace_event_raw_percpu_create_chunk { + struct trace_entry ent; + void *base_addr; + char __data[0]; +}; + +struct trace_event_raw_percpu_destroy_chunk { + struct trace_entry ent; + void *base_addr; + char __data[0]; +}; + +struct trace_event_data_offsets_percpu_alloc_percpu {}; + +struct trace_event_data_offsets_percpu_free_percpu {}; + +struct trace_event_data_offsets_percpu_alloc_percpu_fail {}; + +struct trace_event_data_offsets_percpu_create_chunk {}; + +struct trace_event_data_offsets_percpu_destroy_chunk {}; + +typedef void (*btf_trace_percpu_alloc_percpu)(void *, bool, bool, size_t, size_t, void *, int, void *); + +typedef void (*btf_trace_percpu_free_percpu)(void *, void *, int, void *); + +typedef void (*btf_trace_percpu_alloc_percpu_fail)(void *, bool, bool, size_t, size_t); + +typedef void (*btf_trace_percpu_create_chunk)(void *, void *); + +typedef void (*btf_trace_percpu_destroy_chunk)(void *, void *); + +enum pcpu_chunk_type { + PCPU_CHUNK_ROOT = 0, + PCPU_CHUNK_MEMCG = 1, + PCPU_NR_CHUNK_TYPES = 2, + PCPU_FAIL_ALLOC = 2, +}; + +struct pcpu_block_md { + int scan_hint; + int scan_hint_start; + int contig_hint; + int contig_hint_start; + int left_free; + int right_free; + int first_free; + int nr_bits; +}; + +struct pcpu_chunk { + struct list_head list; + int free_bytes; + struct pcpu_block_md chunk_md; + void *base_addr; + long unsigned int *alloc_map; + long unsigned int *bound_map; + struct pcpu_block_md *md_blocks; + void *data; + bool immutable; + int start_offset; + int end_offset; + struct obj_cgroup **obj_cgroups; + int nr_pages; + int nr_populated; + int nr_empty_pop_pages; + long unsigned int populated[0]; +}; + +struct trace_event_raw_kmem_alloc { + struct trace_entry ent; + long unsigned int call_site; + const void *ptr; + size_t bytes_req; + size_t bytes_alloc; + gfp_t gfp_flags; + char __data[0]; +}; + +struct trace_event_raw_kmem_alloc_node { + struct trace_entry ent; + long unsigned int call_site; + const void *ptr; + size_t bytes_req; + size_t bytes_alloc; + gfp_t gfp_flags; + int node; + char __data[0]; +}; + +struct trace_event_raw_kmem_free { + struct trace_entry ent; + long unsigned int call_site; + const void *ptr; + char __data[0]; +}; + +struct trace_event_raw_mm_page_free { + struct trace_entry ent; + long unsigned int pfn; + unsigned int order; + char __data[0]; +}; + +struct trace_event_raw_mm_page_free_batched { + struct trace_entry ent; + long unsigned int pfn; + char __data[0]; +}; + +struct trace_event_raw_mm_page_alloc { + struct trace_entry ent; + long unsigned int pfn; + unsigned int order; + gfp_t gfp_flags; + int migratetype; + char __data[0]; +}; + +struct trace_event_raw_mm_page { + struct trace_entry ent; + long unsigned int pfn; + unsigned int order; + int migratetype; + char __data[0]; +}; + +struct trace_event_raw_mm_page_pcpu_drain { + struct trace_entry ent; + long unsigned int pfn; + unsigned int order; + int migratetype; + char __data[0]; +}; + +struct trace_event_raw_mm_page_alloc_extfrag { + struct trace_entry ent; + long unsigned int pfn; + int alloc_order; + int fallback_order; + int alloc_migratetype; + int fallback_migratetype; + int change_ownership; + char __data[0]; +}; + +struct trace_event_raw_rss_stat { + struct trace_entry ent; + unsigned int mm_id; + unsigned int curr; + int member; + long int size; + char __data[0]; +}; + +struct trace_event_data_offsets_kmem_alloc {}; + +struct trace_event_data_offsets_kmem_alloc_node {}; + +struct trace_event_data_offsets_kmem_free {}; + +struct trace_event_data_offsets_mm_page_free {}; + +struct trace_event_data_offsets_mm_page_free_batched {}; + +struct trace_event_data_offsets_mm_page_alloc {}; + +struct trace_event_data_offsets_mm_page {}; + +struct trace_event_data_offsets_mm_page_pcpu_drain {}; + +struct trace_event_data_offsets_mm_page_alloc_extfrag {}; + +struct trace_event_data_offsets_rss_stat {}; + +typedef void (*btf_trace_kmalloc)(void *, long unsigned int, const void *, size_t, size_t, gfp_t); + +typedef void (*btf_trace_kmem_cache_alloc)(void *, long unsigned int, const void *, size_t, size_t, gfp_t); + +typedef void (*btf_trace_kmalloc_node)(void *, long unsigned int, const void *, size_t, size_t, gfp_t, int); + +typedef void (*btf_trace_kmem_cache_alloc_node)(void *, long unsigned int, const void *, size_t, size_t, gfp_t, int); + +typedef void (*btf_trace_kfree)(void *, long unsigned int, const void *); + +typedef void (*btf_trace_kmem_cache_free)(void *, long unsigned int, const void *); + +typedef void (*btf_trace_mm_page_free)(void *, struct page *, unsigned int); + +typedef void (*btf_trace_mm_page_free_batched)(void *, struct page *); + +typedef void (*btf_trace_mm_page_alloc)(void *, struct page *, unsigned int, gfp_t, int); + +typedef void (*btf_trace_mm_page_alloc_zone_locked)(void *, struct page *, unsigned int, int); + +typedef void (*btf_trace_mm_page_pcpu_drain)(void *, struct page *, unsigned int, int); + +typedef void (*btf_trace_mm_page_alloc_extfrag)(void *, struct page *, int, int, int, int); + +typedef void (*btf_trace_rss_stat)(void *, struct mm_struct *, int, long int); + +enum slab_state { + DOWN = 0, + PARTIAL = 1, + PARTIAL_NODE = 2, + UP = 3, + FULL = 4, +}; + +struct kmalloc_info_struct { + const char *name[3]; + unsigned int size; +}; + +struct slabinfo { + long unsigned int active_objs; + long unsigned int num_objs; + long unsigned int active_slabs; + long unsigned int num_slabs; + long unsigned int shared_avail; + unsigned int limit; + unsigned int batchcount; + unsigned int shared; + unsigned int objects_per_slab; + unsigned int cache_order; +}; + +enum pageblock_bits { + PB_migrate = 0, + PB_migrate_end = 2, + PB_migrate_skip = 3, + NR_PAGEBLOCK_BITS = 4, +}; + +struct node___2 { + struct device dev; + struct list_head access_list; + struct work_struct node_work; + struct list_head cache_attrs; + struct device *cache_dev; +}; + +typedef struct page *new_page_t(struct page *, long unsigned int); + +typedef void free_page_t(struct page *, long unsigned int); + +struct alloc_context { + struct zonelist *zonelist; + nodemask_t *nodemask; + struct zoneref *preferred_zoneref; + int migratetype; + enum zone_type highest_zoneidx; + bool spread_dirty_pages; +}; + +struct trace_event_raw_mm_compaction_isolate_template { + struct trace_entry ent; + long unsigned int start_pfn; + long unsigned int end_pfn; + long unsigned int nr_scanned; + long unsigned int nr_taken; + char __data[0]; +}; + +struct trace_event_raw_mm_compaction_migratepages { + struct trace_entry ent; + long unsigned int nr_migrated; + long unsigned int nr_failed; + char __data[0]; +}; + +struct trace_event_raw_mm_compaction_begin { + struct trace_entry ent; + long unsigned int zone_start; + long unsigned int migrate_pfn; + long unsigned int free_pfn; + long unsigned int zone_end; + bool sync; + char __data[0]; +}; + +struct trace_event_raw_mm_compaction_end { + struct trace_entry ent; + long unsigned int zone_start; + long unsigned int migrate_pfn; + long unsigned int free_pfn; + long unsigned int zone_end; + bool sync; + int status; + char __data[0]; +}; + +struct trace_event_raw_mm_compaction_try_to_compact_pages { + struct trace_entry ent; + int order; + gfp_t gfp_mask; + int prio; + char __data[0]; +}; + +struct trace_event_raw_mm_compaction_suitable_template { + struct trace_entry ent; + int nid; + enum zone_type idx; + int order; + int ret; + char __data[0]; +}; + +struct trace_event_raw_mm_compaction_defer_template { + struct trace_entry ent; + int nid; + enum zone_type idx; + int order; + unsigned int considered; + unsigned int defer_shift; + int order_failed; + char __data[0]; +}; + +struct trace_event_raw_mm_compaction_kcompactd_sleep { + struct trace_entry ent; + int nid; + char __data[0]; +}; + +struct trace_event_raw_kcompactd_wake_template { + struct trace_entry ent; + int nid; + int order; + enum zone_type highest_zoneidx; + char __data[0]; +}; + +struct trace_event_data_offsets_mm_compaction_isolate_template {}; + +struct trace_event_data_offsets_mm_compaction_migratepages {}; + +struct trace_event_data_offsets_mm_compaction_begin {}; + +struct trace_event_data_offsets_mm_compaction_end {}; + +struct trace_event_data_offsets_mm_compaction_try_to_compact_pages {}; + +struct trace_event_data_offsets_mm_compaction_suitable_template {}; + +struct trace_event_data_offsets_mm_compaction_defer_template {}; + +struct trace_event_data_offsets_mm_compaction_kcompactd_sleep {}; + +struct trace_event_data_offsets_kcompactd_wake_template {}; + +typedef void (*btf_trace_mm_compaction_isolate_migratepages)(void *, long unsigned int, long unsigned int, long unsigned int, long unsigned int); + +typedef void (*btf_trace_mm_compaction_isolate_freepages)(void *, long unsigned int, long unsigned int, long unsigned int, long unsigned int); + +typedef void (*btf_trace_mm_compaction_migratepages)(void *, long unsigned int, int, struct list_head *); + +typedef void (*btf_trace_mm_compaction_begin)(void *, long unsigned int, long unsigned int, long unsigned int, long unsigned int, bool); + +typedef void (*btf_trace_mm_compaction_end)(void *, long unsigned int, long unsigned int, long unsigned int, long unsigned int, bool, int); + +typedef void (*btf_trace_mm_compaction_try_to_compact_pages)(void *, int, gfp_t, int); + +typedef void (*btf_trace_mm_compaction_finished)(void *, struct zone *, int, int); + +typedef void (*btf_trace_mm_compaction_suitable)(void *, struct zone *, int, int); + +typedef void (*btf_trace_mm_compaction_deferred)(void *, struct zone *, int); + +typedef void (*btf_trace_mm_compaction_defer_compaction)(void *, struct zone *, int); + +typedef void (*btf_trace_mm_compaction_defer_reset)(void *, struct zone *, int); + +typedef void (*btf_trace_mm_compaction_kcompactd_sleep)(void *, int); + +typedef void (*btf_trace_mm_compaction_wakeup_kcompactd)(void *, int, int, enum zone_type); + +typedef void (*btf_trace_mm_compaction_kcompactd_wake)(void *, int, int, enum zone_type); + +typedef enum { + ISOLATE_ABORT = 0, + ISOLATE_NONE = 1, + ISOLATE_SUCCESS = 2, +} isolate_migrate_t; + +struct anon_vma_chain { + struct vm_area_struct *vma; + struct anon_vma *anon_vma; + struct list_head same_vma; + struct rb_node rb; + long unsigned int rb_subtree_last; +}; + +enum lru_status { + LRU_REMOVED = 0, + LRU_REMOVED_RETRY = 1, + LRU_ROTATE = 2, + LRU_SKIP = 3, + LRU_RETRY = 4, +}; + +typedef enum lru_status (*list_lru_walk_cb)(struct list_head *, struct list_lru_one *, spinlock_t *, void *); + +typedef struct { + long unsigned int pd; +} hugepd_t; + +struct migration_target_control { + int nid; + nodemask_t *nmask; + gfp_t gfp_mask; +}; + +struct follow_page_context { + struct dev_pagemap *pgmap; + unsigned int page_mask; +}; + +struct trace_event_raw_mmap_lock_start_locking { + struct trace_entry ent; + struct mm_struct *mm; + u32 __data_loc_memcg_path; + bool write; + char __data[0]; +}; + +struct trace_event_raw_mmap_lock_acquire_returned { + struct trace_entry ent; + struct mm_struct *mm; + u32 __data_loc_memcg_path; + bool write; + bool success; + char __data[0]; +}; + +struct trace_event_raw_mmap_lock_released { + struct trace_entry ent; + struct mm_struct *mm; + u32 __data_loc_memcg_path; + bool write; + char __data[0]; +}; + +struct trace_event_data_offsets_mmap_lock_start_locking { + u32 memcg_path; +}; + +struct trace_event_data_offsets_mmap_lock_acquire_returned { + u32 memcg_path; +}; + +struct trace_event_data_offsets_mmap_lock_released { + u32 memcg_path; +}; + +typedef void (*btf_trace_mmap_lock_start_locking)(void *, struct mm_struct *, const char *, bool); + +typedef void (*btf_trace_mmap_lock_acquire_returned)(void *, struct mm_struct *, const char *, bool, bool); + +typedef void (*btf_trace_mmap_lock_released)(void *, struct mm_struct *, const char *, bool); + +typedef unsigned int pgtbl_mod_mask; + +enum { + SWP_USED = 1, + SWP_WRITEOK = 2, + SWP_DISCARDABLE = 4, + SWP_DISCARDING = 8, + SWP_SOLIDSTATE = 16, + SWP_CONTINUED = 32, + SWP_BLKDEV = 64, + SWP_ACTIVATED = 128, + SWP_FS_OPS = 256, + SWP_AREA_DISCARD = 512, + SWP_PAGE_DISCARD = 1024, + SWP_STABLE_WRITES = 2048, + SWP_SYNCHRONOUS_IO = 4096, + SWP_VALID = 8192, + SWP_SCANNING = 16384, +}; + +struct copy_subpage_arg { + struct page *dst; + struct page *src; + struct vm_area_struct *vma; +}; + +struct mm_walk; + +struct mm_walk_ops { + int (*pgd_entry)(pgd_t *, long unsigned int, long unsigned int, struct mm_walk *); + int (*p4d_entry)(p4d_t *, long unsigned int, long unsigned int, struct mm_walk *); + int (*pud_entry)(pud_t *, long unsigned int, long unsigned int, struct mm_walk *); + int (*pmd_entry)(pmd_t *, long unsigned int, long unsigned int, struct mm_walk *); + int (*pte_entry)(pte_t *, long unsigned int, long unsigned int, struct mm_walk *); + int (*pte_hole)(long unsigned int, long unsigned int, int, struct mm_walk *); + int (*hugetlb_entry)(pte_t *, long unsigned int, long unsigned int, long unsigned int, struct mm_walk *); + int (*test_walk)(long unsigned int, long unsigned int, struct mm_walk *); + int (*pre_vma)(long unsigned int, long unsigned int, struct mm_walk *); + void (*post_vma)(struct mm_walk *); +}; + +enum page_walk_action { + ACTION_SUBTREE = 0, + ACTION_CONTINUE = 1, + ACTION_AGAIN = 2, +}; + +struct mm_walk { + const struct mm_walk_ops *ops; + struct mm_struct *mm; + pgd_t *pgd; + struct vm_area_struct *vma; + enum page_walk_action action; + bool no_vma; + void *private; +}; + +enum { + HUGETLB_SHMFS_INODE = 1, + HUGETLB_ANONHUGE_INODE = 2, +}; + +struct trace_event_raw_vm_unmapped_area { + struct trace_entry ent; + long unsigned int addr; + long unsigned int total_vm; + long unsigned int flags; + long unsigned int length; + long unsigned int low_limit; + long unsigned int high_limit; + long unsigned int align_mask; + long unsigned int align_offset; + char __data[0]; +}; + +struct trace_event_data_offsets_vm_unmapped_area {}; + +typedef void (*btf_trace_vm_unmapped_area)(void *, long unsigned int, struct vm_unmapped_area_info *); + +enum pgt_entry { + NORMAL_PMD = 0, + HPAGE_PMD = 1, + NORMAL_PUD = 2, +}; + +struct rmap_walk_control { + void *arg; + bool (*rmap_one)(struct page *, struct vm_area_struct *, long unsigned int, void *); + int (*done)(struct page *); + struct anon_vma * (*anon_lock)(struct page *); + bool (*invalid_vma)(struct vm_area_struct *, void *); +}; + +struct page_referenced_arg { + int mapcount; + int referenced; + long unsigned int vm_flags; + struct mem_cgroup *memcg; +}; + +struct vmap_area { + long unsigned int va_start; + long unsigned int va_end; + struct rb_node rb_node; + struct list_head list; + union { + long unsigned int subtree_max_size; + struct vm_struct *vm; + }; +}; + +struct vfree_deferred { + struct llist_head list; + struct work_struct wq; +}; + +enum fit_type { + NOTHING_FIT = 0, + FL_FIT_TYPE = 1, + LE_FIT_TYPE = 2, + RE_FIT_TYPE = 3, + NE_FIT_TYPE = 4, +}; + +struct vmap_block_queue { + spinlock_t lock; + struct list_head free; +}; + +struct vmap_block { + spinlock_t lock; + struct vmap_area *va; + long unsigned int free; + long unsigned int dirty; + long unsigned int dirty_min; + long unsigned int dirty_max; + struct list_head free_list; + struct callback_head callback_head; + struct list_head purge; +}; + +struct vmap_pfn_data { + long unsigned int *pfns; + pgprot_t prot; + unsigned int idx; +}; + +struct page_frag_cache { + void *va; + __u16 offset; + __u16 size; + unsigned int pagecnt_bias; + bool pfmemalloc; +}; + +enum zone_flags { + ZONE_BOOSTED_WATERMARK = 0, +}; + +typedef int fpi_t; + +struct pcpu_drain { + struct zone *zone; + struct work_struct work; +}; + +struct mminit_pfnnid_cache { + long unsigned int last_start; + long unsigned int last_end; + int last_nid; +}; + +struct madvise_walk_private { + struct mmu_gather *tlb; + bool pageout; +}; + +struct vma_swap_readahead { + short unsigned int win; + short unsigned int offset; + short unsigned int nr_pte; + pte_t *ptes; +}; + +union swap_header { + struct { + char reserved[4086]; + char magic[10]; + } magic; + struct { + char bootbits[1024]; + __u32 version; + __u32 last_page; + __u32 nr_badpages; + unsigned char sws_uuid[16]; + unsigned char sws_volume[16]; + __u32 padding[117]; + __u32 badpages[1]; + } info; +}; + +struct swap_extent { + struct rb_node rb_node; + long unsigned int start_page; + long unsigned int nr_pages; + sector_t start_block; +}; + +struct swap_slots_cache { + bool lock_initialized; + struct mutex alloc_lock; + swp_entry_t *slots; + int nr; + int cur; + spinlock_t free_lock; + swp_entry_t *slots_ret; + int n_ret; +}; + +struct frontswap_ops { + void (*init)(unsigned int); + int (*store)(unsigned int, long unsigned int, struct page *); + int (*load)(unsigned int, long unsigned int, struct page *); + void (*invalidate_page)(unsigned int, long unsigned int); + void (*invalidate_area)(unsigned int); + struct frontswap_ops *next; +}; + +struct crypto_wait { + struct completion completion; + int err; +}; + +struct zpool; + +struct zpool_ops { + int (*evict)(struct zpool *, long unsigned int); +}; + +enum zpool_mapmode { + ZPOOL_MM_RW = 0, + ZPOOL_MM_RO = 1, + ZPOOL_MM_WO = 2, + ZPOOL_MM_DEFAULT = 0, +}; + +struct acomp_req { + struct crypto_async_request base; + struct scatterlist *src; + struct scatterlist *dst; + unsigned int slen; + unsigned int dlen; + u32 flags; + void *__ctx[0]; +}; + +struct crypto_acomp { + int (*compress)(struct acomp_req *); + int (*decompress)(struct acomp_req *); + void (*dst_free)(struct scatterlist *); + unsigned int reqsize; + struct crypto_tfm base; +}; + +struct crypto_acomp_ctx { + struct crypto_acomp *acomp; + struct acomp_req *req; + struct crypto_wait wait; + u8 *dstmem; + struct mutex *mutex; +}; + +struct zswap_pool { + struct zpool *zpool; + struct crypto_acomp_ctx *acomp_ctx; + struct kref kref; + struct list_head list; + struct work_struct release_work; + struct work_struct shrink_work; + struct hlist_node node; + char tfm_name[128]; +}; + +struct zswap_entry { + struct rb_node rbnode; + long unsigned int offset; + int refcount; + unsigned int length; + struct zswap_pool *pool; + union { + long unsigned int handle; + long unsigned int value; + }; +}; + +struct zswap_header { + swp_entry_t swpentry; +}; + +struct zswap_tree { + struct rb_root rbroot; + spinlock_t lock; +}; + +enum zswap_get_swap_ret { + ZSWAP_SWAPCACHE_NEW = 0, + ZSWAP_SWAPCACHE_EXIST = 1, + ZSWAP_SWAPCACHE_FAIL = 2, +}; + +struct dma_pool { + struct list_head page_list; + spinlock_t lock; + size_t size; + struct device *dev; + size_t allocation; + size_t boundary; + char name[32]; + struct list_head pools; +}; + +struct dma_page { + struct list_head page_list; + void *vaddr; + dma_addr_t dma; + unsigned int in_use; + unsigned int offset; +}; + +enum string_size_units { + STRING_UNITS_10 = 0, + STRING_UNITS_2 = 1, +}; + +typedef void (*node_registration_func_t)(struct node___2 *); + +struct resv_map { + struct kref refs; + spinlock_t lock; + struct list_head regions; + long int adds_in_progress; + struct list_head region_cache; + long int region_cache_count; + struct page_counter *reservation_counter; + long unsigned int pages_per_hpage; + struct cgroup_subsys_state *css; +}; + +struct file_region { + struct list_head link; + long int from; + long int to; + struct page_counter *reservation_counter; + struct cgroup_subsys_state *css; +}; + +struct huge_bootmem_page { + struct list_head list; + struct hstate *hstate; +}; + +enum hugetlb_memory_event { + HUGETLB_MAX = 0, + HUGETLB_NR_MEMORY_EVENTS = 1, +}; + +struct hugetlb_cgroup { + struct cgroup_subsys_state css; + struct page_counter hugepage[2]; + struct page_counter rsvd_hugepage[2]; + atomic_long_t events[2]; + atomic_long_t events_local[2]; + struct cgroup_file events_file[2]; + struct cgroup_file events_local_file[2]; +}; + +enum vma_resv_mode { + VMA_NEEDS_RESV = 0, + VMA_COMMIT_RESV = 1, + VMA_END_RESV = 2, + VMA_ADD_RESV = 3, +}; + +struct node_hstate { + struct kobject *hugepages_kobj; + struct kobject *hstate_kobjs[2]; +}; + +struct nodemask_scratch { + nodemask_t mask1; + nodemask_t mask2; +}; + +struct sp_node { + struct rb_node nd; + long unsigned int start; + long unsigned int end; + struct mempolicy *policy; +}; + +struct mempolicy_operations { + int (*create)(struct mempolicy *, const nodemask_t *); + void (*rebind)(struct mempolicy *, const nodemask_t *); +}; + +struct queue_pages { + struct list_head *pagelist; + long unsigned int flags; + nodemask_t *nmask; + long unsigned int start; + long unsigned int end; + struct vm_area_struct *first; +}; + +struct mmu_notifier_subscriptions { + struct hlist_head list; + bool has_itree; + spinlock_t lock; + long unsigned int invalidate_seq; + long unsigned int active_invalidate_ranges; + struct rb_root_cached itree; + wait_queue_head_t wq; + struct hlist_head deferred_list; +}; + +struct interval_tree_node { + struct rb_node rb; + long unsigned int start; + long unsigned int last; + long unsigned int __subtree_last; +}; + +struct mmu_interval_notifier; + +struct mmu_interval_notifier_ops { + bool (*invalidate)(struct mmu_interval_notifier *, const struct mmu_notifier_range *, long unsigned int); +}; + +struct mmu_interval_notifier { + struct interval_tree_node interval_tree; + const struct mmu_interval_notifier_ops *ops; + struct mm_struct *mm; + struct hlist_node deferred_item; + long unsigned int invalidate_seq; +}; + +struct memory_notify { + long unsigned int start_pfn; + long unsigned int nr_pages; + int status_change_nid_normal; + int status_change_nid_high; + int status_change_nid; +}; + +struct rmap_item; + +struct mm_slot { + struct hlist_node link; + struct list_head mm_list; + struct rmap_item *rmap_list; + struct mm_struct *mm; +}; + +struct stable_node; + +struct rmap_item { + struct rmap_item *rmap_list; + union { + struct anon_vma *anon_vma; + int nid; + }; + struct mm_struct *mm; + long unsigned int address; + unsigned int oldchecksum; + union { + struct rb_node node; + struct { + struct stable_node *head; + struct hlist_node hlist; + }; + }; +}; + +struct ksm_scan { + struct mm_slot *mm_slot; + long unsigned int address; + struct rmap_item **rmap_list; + long unsigned int seqnr; +}; + +struct stable_node { + union { + struct rb_node node; + struct { + struct list_head *head; + struct { + struct hlist_node hlist_dup; + struct list_head list; + }; + }; + }; + struct hlist_head hlist; + union { + long unsigned int kpfn; + long unsigned int chain_prune_time; + }; + int rmap_hlist_len; + int nid; +}; + +enum get_ksm_page_flags { + GET_KSM_PAGE_NOLOCK = 0, + GET_KSM_PAGE_LOCK = 1, + GET_KSM_PAGE_TRYLOCK = 2, +}; + +enum stat_item { + ALLOC_FASTPATH = 0, + ALLOC_SLOWPATH = 1, + FREE_FASTPATH = 2, + FREE_SLOWPATH = 3, + FREE_FROZEN = 4, + FREE_ADD_PARTIAL = 5, + FREE_REMOVE_PARTIAL = 6, + ALLOC_FROM_PARTIAL = 7, + ALLOC_SLAB = 8, + ALLOC_REFILL = 9, + ALLOC_NODE_MISMATCH = 10, + FREE_SLAB = 11, + CPUSLAB_FLUSH = 12, + DEACTIVATE_FULL = 13, + DEACTIVATE_EMPTY = 14, + DEACTIVATE_TO_HEAD = 15, + DEACTIVATE_TO_TAIL = 16, + DEACTIVATE_REMOTE_FREES = 17, + DEACTIVATE_BYPASS = 18, + ORDER_FALLBACK = 19, + CMPXCHG_DOUBLE_CPU_FAIL = 20, + CMPXCHG_DOUBLE_FAIL = 21, + CPU_PARTIAL_ALLOC = 22, + CPU_PARTIAL_FREE = 23, + CPU_PARTIAL_NODE = 24, + CPU_PARTIAL_DRAIN = 25, + NR_SLUB_STAT_ITEMS = 26, +}; + +struct track { + long unsigned int addr; + long unsigned int addrs[16]; + int cpu; + int pid; + long unsigned int when; +}; + +enum track_item { + TRACK_ALLOC = 0, + TRACK_FREE = 1, +}; + +struct detached_freelist { + struct page *page; + void *tail; + void *freelist; + int cnt; + struct kmem_cache *s; +}; + +struct location { + long unsigned int count; + long unsigned int addr; + long long int sum_time; + long int min_time; + long int max_time; + long int min_pid; + long int max_pid; + long unsigned int cpus[128]; + nodemask_t nodes; +}; + +struct loc_track { + long unsigned int max; + long unsigned int count; + struct location *loc; +}; + +enum slab_stat_type { + SL_ALL = 0, + SL_PARTIAL = 1, + SL_CPU = 2, + SL_OBJECTS = 3, + SL_TOTAL = 4, +}; + +struct slab_attribute { + struct attribute attr; + ssize_t (*show)(struct kmem_cache *, char *); + ssize_t (*store)(struct kmem_cache *, const char *, size_t); +}; + +struct saved_alias { + struct kmem_cache *s; + const char *name; + struct saved_alias *next; +}; + +enum slab_modes { + M_NONE = 0, + M_PARTIAL = 1, + M_FULL = 2, + M_FREE = 3, +}; + +enum { + MMOP_OFFLINE = 0, + MMOP_ONLINE = 1, + MMOP_ONLINE_KERNEL = 2, + MMOP_ONLINE_MOVABLE = 3, +}; + +typedef int mhp_t; + +typedef void (*online_page_callback_t)(struct page *, unsigned int); + +struct memory_block { + long unsigned int start_section_nr; + long unsigned int state; + int online_type; + int nid; + struct device dev; +}; + +typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *); + +struct buffer_head; + +typedef void bh_end_io_t(struct buffer_head *, int); + +struct buffer_head { + long unsigned int b_state; + struct buffer_head *b_this_page; + struct page *b_page; + sector_t b_blocknr; + size_t b_size; + char *b_data; + struct block_device *b_bdev; + bh_end_io_t *b_end_io; + void *b_private; + struct list_head b_assoc_buffers; + struct address_space *b_assoc_map; + atomic_t b_count; + spinlock_t b_uptodate_lock; +}; + +enum migrate_vma_direction { + MIGRATE_VMA_SELECT_SYSTEM = 1, + MIGRATE_VMA_SELECT_DEVICE_PRIVATE = 2, +}; + +struct migrate_vma { + struct vm_area_struct *vma; + long unsigned int *dst; + long unsigned int *src; + long unsigned int cpages; + long unsigned int npages; + long unsigned int start; + long unsigned int end; + void *pgmap_owner; + long unsigned int flags; +}; + +enum bh_state_bits { + BH_Uptodate = 0, + BH_Dirty = 1, + BH_Lock = 2, + BH_Req = 3, + BH_Mapped = 4, + BH_New = 5, + BH_Async_Read = 6, + BH_Async_Write = 7, + BH_Delay = 8, + BH_Boundary = 9, + BH_Write_EIO = 10, + BH_Unwritten = 11, + BH_Quiet = 12, + BH_Meta = 13, + BH_Prio = 14, + BH_Defer_Completion = 15, + BH_PrivateStart = 16, +}; + +struct trace_event_raw_mm_migrate_pages { + struct trace_entry ent; + long unsigned int succeeded; + long unsigned int failed; + long unsigned int thp_succeeded; + long unsigned int thp_failed; + long unsigned int thp_split; + enum migrate_mode mode; + int reason; + char __data[0]; +}; + +struct trace_event_data_offsets_mm_migrate_pages {}; + +typedef void (*btf_trace_mm_migrate_pages)(void *, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, enum migrate_mode, int); + +enum scan_result { + SCAN_FAIL = 0, + SCAN_SUCCEED = 1, + SCAN_PMD_NULL = 2, + SCAN_EXCEED_NONE_PTE = 3, + SCAN_EXCEED_SWAP_PTE = 4, + SCAN_EXCEED_SHARED_PTE = 5, + SCAN_PTE_NON_PRESENT = 6, + SCAN_PTE_UFFD_WP = 7, + SCAN_PAGE_RO = 8, + SCAN_LACK_REFERENCED_PAGE = 9, + SCAN_PAGE_NULL = 10, + SCAN_SCAN_ABORT = 11, + SCAN_PAGE_COUNT = 12, + SCAN_PAGE_LRU = 13, + SCAN_PAGE_LOCK = 14, + SCAN_PAGE_ANON = 15, + SCAN_PAGE_COMPOUND = 16, + SCAN_ANY_PROCESS = 17, + SCAN_VMA_NULL = 18, + SCAN_VMA_CHECK = 19, + SCAN_ADDRESS_RANGE = 20, + SCAN_SWAP_CACHE_PAGE = 21, + SCAN_DEL_PAGE_LRU = 22, + SCAN_ALLOC_HUGE_PAGE_FAIL = 23, + SCAN_CGROUP_CHARGE_FAIL = 24, + SCAN_TRUNCATED = 25, + SCAN_PAGE_HAS_PRIVATE = 26, +}; + +struct trace_event_raw_mm_khugepaged_scan_pmd { + struct trace_entry ent; + struct mm_struct *mm; + long unsigned int pfn; + bool writable; + int referenced; + int none_or_zero; + int status; + int unmapped; + char __data[0]; +}; + +struct trace_event_raw_mm_collapse_huge_page { + struct trace_entry ent; + struct mm_struct *mm; + int isolated; + int status; + char __data[0]; +}; + +struct trace_event_raw_mm_collapse_huge_page_isolate { + struct trace_entry ent; + long unsigned int pfn; + int none_or_zero; + int referenced; + bool writable; + int status; + char __data[0]; +}; + +struct trace_event_raw_mm_collapse_huge_page_swapin { + struct trace_entry ent; + struct mm_struct *mm; + int swapped_in; + int referenced; + int ret; + char __data[0]; +}; + +struct trace_event_data_offsets_mm_khugepaged_scan_pmd {}; + +struct trace_event_data_offsets_mm_collapse_huge_page {}; + +struct trace_event_data_offsets_mm_collapse_huge_page_isolate {}; + +struct trace_event_data_offsets_mm_collapse_huge_page_swapin {}; + +typedef void (*btf_trace_mm_khugepaged_scan_pmd)(void *, struct mm_struct *, struct page *, bool, int, int, int, int); + +typedef void (*btf_trace_mm_collapse_huge_page)(void *, struct mm_struct *, int, int); + +typedef void (*btf_trace_mm_collapse_huge_page_isolate)(void *, struct page *, int, int, bool, int); + +typedef void (*btf_trace_mm_collapse_huge_page_swapin)(void *, struct mm_struct *, int, int, int); + +struct mm_slot___2 { + struct hlist_node hash; + struct list_head mm_node; + struct mm_struct *mm; + int nr_pte_mapped_thp; + long unsigned int pte_mapped_thp[8]; +}; + +struct khugepaged_scan { + struct list_head mm_head; + struct mm_slot___2 *mm_slot; + long unsigned int address; +}; + +struct mem_cgroup_tree_per_node { + struct rb_root rb_root; + struct rb_node *rb_rightmost; + spinlock_t lock; +}; + +struct mem_cgroup_tree { + struct mem_cgroup_tree_per_node *rb_tree_per_node[1024]; +}; + +struct mem_cgroup_eventfd_list { + struct list_head list; + struct eventfd_ctx *eventfd; +}; + +struct mem_cgroup_event { + struct mem_cgroup *memcg; + struct eventfd_ctx *eventfd; + struct list_head list; + int (*register_event)(struct mem_cgroup *, struct eventfd_ctx *, const char *); + void (*unregister_event)(struct mem_cgroup *, struct eventfd_ctx *); + poll_table pt; + wait_queue_head_t *wqh; + wait_queue_entry_t wait; + struct work_struct remove; +}; + +struct move_charge_struct { + spinlock_t lock; + struct mm_struct *mm; + struct mem_cgroup *from; + struct mem_cgroup *to; + long unsigned int flags; + long unsigned int precharge; + long unsigned int moved_charge; + long unsigned int moved_swap; + struct task_struct *moving_task; + wait_queue_head_t waitq; +}; + +enum res_type { + _MEM = 0, + _MEMSWAP = 1, + _OOM_TYPE = 2, + _KMEM = 3, + _TCP = 4, +}; + +struct memory_stat { + const char *name; + unsigned int ratio; + unsigned int idx; +}; + +struct oom_wait_info { + struct mem_cgroup *memcg; + wait_queue_entry_t wait; +}; + +enum oom_status { + OOM_SUCCESS = 0, + OOM_FAILED = 1, + OOM_ASYNC = 2, + OOM_SKIPPED = 3, +}; + +struct memcg_stock_pcp { + struct mem_cgroup *cached; + unsigned int nr_pages; + struct obj_cgroup *cached_objcg; + unsigned int nr_bytes; + struct work_struct work; + long unsigned int flags; +}; + +enum { + RES_USAGE = 0, + RES_LIMIT = 1, + RES_MAX_USAGE = 2, + RES_FAILCNT = 3, + RES_SOFT_LIMIT = 4, +}; + +union mc_target { + struct page *page; + swp_entry_t ent; +}; + +enum mc_target_type { + MC_TARGET_NONE = 0, + MC_TARGET_PAGE = 1, + MC_TARGET_SWAP = 2, + MC_TARGET_DEVICE = 3, +}; + +struct uncharge_gather { + struct mem_cgroup *memcg; + long unsigned int nr_pages; + long unsigned int pgpgout; + long unsigned int nr_kmem; + struct page *dummy_page; +}; + +struct numa_stat { + const char *name; + unsigned int lru_mask; +}; + +enum vmpressure_levels { + VMPRESSURE_LOW = 0, + VMPRESSURE_MEDIUM = 1, + VMPRESSURE_CRITICAL = 2, + VMPRESSURE_NUM_LEVELS = 3, +}; + +enum vmpressure_modes { + VMPRESSURE_NO_PASSTHROUGH = 0, + VMPRESSURE_HIERARCHY = 1, + VMPRESSURE_LOCAL = 2, + VMPRESSURE_NUM_MODES = 3, +}; + +struct vmpressure_event { + struct eventfd_ctx *efd; + enum vmpressure_levels level; + enum vmpressure_modes mode; + struct list_head node; +}; + +struct swap_cgroup_ctrl { + struct page **map; + long unsigned int length; + spinlock_t lock; +}; + +struct swap_cgroup { + short unsigned int id; +}; + +enum { + RES_USAGE___2 = 0, + RES_RSVD_USAGE = 1, + RES_LIMIT___2 = 2, + RES_RSVD_LIMIT = 3, + RES_MAX_USAGE___2 = 4, + RES_RSVD_MAX_USAGE = 5, + RES_FAILCNT___2 = 6, + RES_RSVD_FAILCNT = 7, +}; + +enum mf_result { + MF_IGNORED = 0, + MF_FAILED = 1, + MF_DELAYED = 2, + MF_RECOVERED = 3, +}; + +enum mf_action_page_type { + MF_MSG_KERNEL = 0, + MF_MSG_KERNEL_HIGH_ORDER = 1, + MF_MSG_SLAB = 2, + MF_MSG_DIFFERENT_COMPOUND = 3, + MF_MSG_POISONED_HUGE = 4, + MF_MSG_HUGE = 5, + MF_MSG_FREE_HUGE = 6, + MF_MSG_NON_PMD_HUGE = 7, + MF_MSG_UNMAP_FAILED = 8, + MF_MSG_DIRTY_SWAPCACHE = 9, + MF_MSG_CLEAN_SWAPCACHE = 10, + MF_MSG_DIRTY_MLOCKED_LRU = 11, + MF_MSG_CLEAN_MLOCKED_LRU = 12, + MF_MSG_DIRTY_UNEVICTABLE_LRU = 13, + MF_MSG_CLEAN_UNEVICTABLE_LRU = 14, + MF_MSG_DIRTY_LRU = 15, + MF_MSG_CLEAN_LRU = 16, + MF_MSG_TRUNCATED_LRU = 17, + MF_MSG_BUDDY = 18, + MF_MSG_BUDDY_2ND = 19, + MF_MSG_DAX = 20, + MF_MSG_UNSPLIT_THP = 21, + MF_MSG_UNKNOWN = 22, +}; + +typedef long unsigned int dax_entry_t; + +struct __kfifo { + unsigned int in; + unsigned int out; + unsigned int mask; + unsigned int esize; + void *data; +}; + +struct to_kill { + struct list_head nd; + struct task_struct *tsk; + long unsigned int addr; + short int size_shift; +}; + +struct page_state { + long unsigned int mask; + long unsigned int res; + enum mf_action_page_type type; + int (*action)(struct page *, long unsigned int); +}; + +struct memory_failure_entry { + long unsigned int pfn; + int flags; +}; + +struct memory_failure_cpu { + struct { + union { + struct __kfifo kfifo; + struct memory_failure_entry *type; + const struct memory_failure_entry *const_type; + char (*rectype)[0]; + struct memory_failure_entry *ptr; + const struct memory_failure_entry *ptr_const; + }; + struct memory_failure_entry buf[16]; + } fifo; + spinlock_t lock; + struct work_struct work; +}; + +struct cleancache_filekey { + union { + ino_t ino; + __u32 fh[6]; + u32 key[6]; + } u; +}; + +struct cleancache_ops { + int (*init_fs)(size_t); + int (*init_shared_fs)(uuid_t *, size_t); + int (*get_page)(int, struct cleancache_filekey, long unsigned int, struct page *); + void (*put_page)(int, struct cleancache_filekey, long unsigned int, struct page *); + void (*invalidate_page)(int, struct cleancache_filekey, long unsigned int); + void (*invalidate_inode)(int, struct cleancache_filekey); + void (*invalidate_fs)(int); +}; + +struct trace_event_raw_test_pages_isolated { + struct trace_entry ent; + long unsigned int start_pfn; + long unsigned int end_pfn; + long unsigned int fin_pfn; + char __data[0]; +}; + +struct trace_event_data_offsets_test_pages_isolated {}; + +typedef void (*btf_trace_test_pages_isolated)(void *, long unsigned int, long unsigned int, long unsigned int); + +struct zpool_driver; + +struct zpool { + struct zpool_driver *driver; + void *pool; + const struct zpool_ops *ops; + bool evictable; + struct list_head list; +}; + +struct zpool_driver { + char *type; + struct module *owner; + atomic_t refcount; + struct list_head list; + void * (*create)(const char *, gfp_t, const struct zpool_ops *, struct zpool *); + void (*destroy)(void *); + bool malloc_support_movable; + int (*malloc)(void *, size_t, gfp_t, long unsigned int *); + void (*free)(void *, long unsigned int); + int (*shrink)(void *, unsigned int, unsigned int *); + void * (*map)(void *, long unsigned int, enum zpool_mapmode); + void (*unmap)(void *, long unsigned int); + u64 (*total_size)(void *); +}; + +struct zbud_pool; + +struct zbud_ops { + int (*evict)(struct zbud_pool *, long unsigned int); +}; + +struct zbud_pool { + spinlock_t lock; + struct list_head unbuddied[63]; + struct list_head buddied; + struct list_head lru; + u64 pages_nr; + const struct zbud_ops *ops; + struct zpool *zpool; + const struct zpool_ops *zpool_ops; +}; + +struct zbud_header { + struct list_head buddy; + struct list_head lru; + unsigned int first_chunks; + unsigned int last_chunks; + bool under_reclaim; +}; + +enum buddy { + FIRST = 0, + LAST = 1, +}; + +enum zs_mapmode { + ZS_MM_RW = 0, + ZS_MM_RO = 1, + ZS_MM_WO = 2, +}; + +struct zs_pool_stats { + atomic_long_t pages_compacted; +}; + +struct pseudo_fs_context { + const struct super_operations *ops; + const struct xattr_handler **xattr; + const struct dentry_operations *dops; + long unsigned int magic; +}; + +enum fullness_group { + ZS_EMPTY = 0, + ZS_ALMOST_EMPTY = 1, + ZS_ALMOST_FULL = 2, + ZS_FULL = 3, + NR_ZS_FULLNESS = 4, +}; + +enum zs_stat_type { + CLASS_EMPTY = 0, + CLASS_ALMOST_EMPTY = 1, + CLASS_ALMOST_FULL = 2, + CLASS_FULL = 3, + OBJ_ALLOCATED = 4, + OBJ_USED = 5, + NR_ZS_STAT_TYPE = 6, +}; + +struct zs_size_stat { + long unsigned int objs[6]; +}; + +struct size_class { + spinlock_t lock; + struct list_head fullness_list[4]; + int size; + int objs_per_zspage; + int pages_per_zspage; + unsigned int index; + struct zs_size_stat stats; +}; + +struct link_free { + union { + long unsigned int next; + long unsigned int handle; + }; +}; + +struct zs_pool { + const char *name; + struct size_class *size_class[255]; + struct kmem_cache *handle_cachep; + struct kmem_cache *zspage_cachep; + atomic_long_t pages_allocated; + struct zs_pool_stats stats; + struct shrinker shrinker; + struct inode *inode; + struct work_struct free_work; + struct wait_queue_head migration_wait; + atomic_long_t isolated_pages; + bool destroying; +}; + +struct zspage { + struct { + unsigned int fullness: 2; + unsigned int class: 9; + unsigned int isolated: 3; + unsigned int magic: 8; + }; + unsigned int inuse; + unsigned int freeobj; + struct page *first_page; + struct list_head list; + rwlock_t lock; +}; + +struct mapping_area { + char *vm_buf; + char *vm_addr; + enum zs_mapmode vm_mm; +}; + +struct zs_compact_control { + struct page *s_page; + struct page *d_page; + int obj_idx; +}; + +struct z3fold_pool; + +struct z3fold_ops { + int (*evict)(struct z3fold_pool *, long unsigned int); +}; + +struct z3fold_pool { + const char *name; + spinlock_t lock; + spinlock_t stale_lock; + struct list_head *unbuddied; + struct list_head lru; + struct list_head stale; + atomic64_t pages_nr; + struct kmem_cache *c_handle; + const struct z3fold_ops *ops; + struct zpool *zpool; + const struct zpool_ops *zpool_ops; + struct workqueue_struct *compact_wq; + struct workqueue_struct *release_wq; + struct work_struct work; + struct inode *inode; +}; + +enum buddy___2 { + HEADLESS = 0, + FIRST___2 = 1, + MIDDLE = 2, + LAST___2 = 3, + BUDDIES_MAX = 3, +}; + +struct z3fold_buddy_slots { + long unsigned int slot[4]; + long unsigned int pool; + rwlock_t lock; +}; + +struct z3fold_header { + struct list_head buddy; + spinlock_t page_lock; + struct kref refcount; + struct work_struct work; + struct z3fold_buddy_slots *slots; + struct z3fold_pool *pool; + short int cpu; + short unsigned int first_chunks; + short unsigned int middle_chunks; + short unsigned int last_chunks; + short unsigned int start_middle; + short unsigned int first_num: 2; + short unsigned int mapped_count: 2; + short unsigned int foreign_handles: 2; +}; + +enum z3fold_page_flags { + PAGE_HEADLESS = 0, + MIDDLE_CHUNK_MAPPED = 1, + NEEDS_COMPACTING = 2, + PAGE_STALE = 3, + PAGE_CLAIMED = 4, +}; + +enum z3fold_handle_flags { + HANDLES_NOFREE = 0, +}; + +struct trace_event_raw_cma_alloc { + struct trace_entry ent; + long unsigned int pfn; + const struct page *page; + unsigned int count; + unsigned int align; + char __data[0]; +}; + +struct trace_event_raw_cma_release { + struct trace_entry ent; + long unsigned int pfn; + const struct page *page; + unsigned int count; + char __data[0]; +}; + +struct trace_event_data_offsets_cma_alloc {}; + +struct trace_event_data_offsets_cma_release {}; + +typedef void (*btf_trace_cma_alloc)(void *, long unsigned int, const struct page *, unsigned int, unsigned int); + +typedef void (*btf_trace_cma_release)(void *, long unsigned int, const struct page *, unsigned int); + +struct balloon_dev_info { + long unsigned int isolated_pages; + spinlock_t pages_lock; + struct list_head pages; + int (*migratepage)(struct balloon_dev_info *, struct page *, struct page *, enum migrate_mode); + struct inode *inode; +}; + +struct frame_vector { + unsigned int nr_allocated; + unsigned int nr_frames; + bool got_ref; + bool is_pfns; + void *ptrs[0]; +}; + +enum { + BAD_STACK = 4294967295, + NOT_STACK = 0, + GOOD_FRAME = 1, + GOOD_STACK = 2, +}; + +enum hmm_pfn_flags { + HMM_PFN_VALID = 0, + HMM_PFN_WRITE = 0, + HMM_PFN_ERROR = 0, + HMM_PFN_ORDER_SHIFT = 56, + HMM_PFN_REQ_FAULT = 0, + HMM_PFN_REQ_WRITE = 0, + HMM_PFN_FLAGS = 0, +}; + +struct hmm_range { + struct mmu_interval_notifier *notifier; + long unsigned int notifier_seq; + long unsigned int start; + long unsigned int end; + long unsigned int *hmm_pfns; + long unsigned int default_flags; + long unsigned int pfn_flags_mask; + void *dev_private_owner; +}; + +struct hmm_vma_walk { + struct hmm_range *range; + long unsigned int last; +}; + +enum { + HMM_NEED_FAULT = 1, + HMM_NEED_WRITE_FAULT = 2, + HMM_NEED_ALL_BITS = 3, +}; + +struct hugetlbfs_inode_info { + struct shared_policy policy; + struct inode vfs_inode; + unsigned int seals; +}; + +struct wp_walk { + struct mmu_notifier_range range; + long unsigned int tlbflush_start; + long unsigned int tlbflush_end; + long unsigned int total; +}; + +struct clean_walk { + struct wp_walk base; + long unsigned int bitmap_pgoff; + long unsigned int *bitmap; + long unsigned int start; + long unsigned int end; +}; + +struct page_reporting_dev_info { + int (*report)(struct page_reporting_dev_info *, struct scatterlist *, unsigned int); + struct delayed_work work; + atomic_t state; +}; + +enum { + PAGE_REPORTING_IDLE = 0, + PAGE_REPORTING_REQUESTED = 1, + PAGE_REPORTING_ACTIVE = 2, +}; + +struct open_how { + __u64 flags; + __u64 mode; + __u64 resolve; +}; + +typedef s32 compat_off_t; + +struct open_flags { + int open_flag; + umode_t mode; + int acc_mode; + int intent; + int lookup_flags; +}; + +typedef __kernel_long_t __kernel_off_t; + +typedef __kernel_off_t off_t; + +typedef __kernel_rwf_t rwf_t; + +struct fscrypt_policy_v1 { + __u8 version; + __u8 contents_encryption_mode; + __u8 filenames_encryption_mode; + __u8 flags; + __u8 master_key_descriptor[8]; +}; + +struct fscrypt_policy_v2 { + __u8 version; + __u8 contents_encryption_mode; + __u8 filenames_encryption_mode; + __u8 flags; + __u8 __reserved[4]; + __u8 master_key_identifier[16]; +}; + +union fscrypt_policy { + u8 version; + struct fscrypt_policy_v1 v1; + struct fscrypt_policy_v2 v2; +}; + +enum vfs_get_super_keying { + vfs_get_single_super = 0, + vfs_get_single_reconf_super = 1, + vfs_get_keyed_super = 2, + vfs_get_independent_super = 3, +}; + +typedef struct kobject *kobj_probe_t(dev_t, int *, void *); + +struct kobj_map; + +struct char_device_struct { + struct char_device_struct *next; + unsigned int major; + unsigned int baseminor; + int minorct; + char name[64]; + struct cdev *cdev; +}; + +struct stat { + __kernel_ulong_t st_dev; + __kernel_ulong_t st_ino; + __kernel_ulong_t st_nlink; + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad0; + __kernel_ulong_t st_rdev; + __kernel_long_t st_size; + __kernel_long_t st_blksize; + __kernel_long_t st_blocks; + __kernel_ulong_t st_atime; + __kernel_ulong_t st_atime_nsec; + __kernel_ulong_t st_mtime; + __kernel_ulong_t st_mtime_nsec; + __kernel_ulong_t st_ctime; + __kernel_ulong_t st_ctime_nsec; + __kernel_long_t __unused[3]; +}; + +struct __old_kernel_stat { + short unsigned int st_dev; + short unsigned int st_ino; + short unsigned int st_mode; + short unsigned int st_nlink; + short unsigned int st_uid; + short unsigned int st_gid; + short unsigned int st_rdev; + unsigned int st_size; + unsigned int st_atime; + unsigned int st_mtime; + unsigned int st_ctime; +}; + +struct statx_timestamp { + __s64 tv_sec; + __u32 tv_nsec; + __s32 __reserved; +}; + +struct statx { + __u32 stx_mask; + __u32 stx_blksize; + __u64 stx_attributes; + __u32 stx_nlink; + __u32 stx_uid; + __u32 stx_gid; + __u16 stx_mode; + __u16 __spare0[1]; + __u64 stx_ino; + __u64 stx_size; + __u64 stx_blocks; + __u64 stx_attributes_mask; + struct statx_timestamp stx_atime; + struct statx_timestamp stx_btime; + struct statx_timestamp stx_ctime; + struct statx_timestamp stx_mtime; + __u32 stx_rdev_major; + __u32 stx_rdev_minor; + __u32 stx_dev_major; + __u32 stx_dev_minor; + __u64 stx_mnt_id; + __u64 __spare2; + __u64 __spare3[12]; +}; + +struct mount; + +struct mnt_namespace { + struct ns_common ns; + struct mount *root; + struct list_head list; + spinlock_t ns_lock; + struct user_namespace *user_ns; + struct ucounts *ucounts; + u64 seq; + wait_queue_head_t poll; + u64 event; + unsigned int mounts; + unsigned int pending_mounts; +}; + +typedef u32 compat_ino_t; + +typedef u16 __compat_uid_t; + +typedef u16 __compat_gid_t; + +typedef u16 compat_mode_t; + +typedef u16 compat_dev_t; + +typedef u16 compat_nlink_t; + +struct compat_stat { + compat_dev_t st_dev; + u16 __pad1; + compat_ino_t st_ino; + compat_mode_t st_mode; + compat_nlink_t st_nlink; + __compat_uid_t st_uid; + __compat_gid_t st_gid; + compat_dev_t st_rdev; + u16 __pad2; + u32 st_size; + u32 st_blksize; + u32 st_blocks; + u32 st_atime; + u32 st_atime_nsec; + u32 st_mtime; + u32 st_mtime_nsec; + u32 st_ctime; + u32 st_ctime_nsec; + u32 __unused4; + u32 __unused5; +}; + +struct mnt_pcp; + +struct mountpoint; + +struct mount { + struct hlist_node mnt_hash; + struct mount *mnt_parent; + struct dentry *mnt_mountpoint; + struct vfsmount mnt; + union { + struct callback_head mnt_rcu; + struct llist_node mnt_llist; + }; + struct mnt_pcp *mnt_pcp; + struct list_head mnt_mounts; + struct list_head mnt_child; + struct list_head mnt_instance; + const char *mnt_devname; + struct list_head mnt_list; + struct list_head mnt_expire; + struct list_head mnt_share; + struct list_head mnt_slave_list; + struct list_head mnt_slave; + struct mount *mnt_master; + struct mnt_namespace *mnt_ns; + struct mountpoint *mnt_mp; + union { + struct hlist_node mnt_mp_list; + struct hlist_node mnt_umount; + }; + struct list_head mnt_umounting; + struct fsnotify_mark_connector *mnt_fsnotify_marks; + __u32 mnt_fsnotify_mask; + int mnt_id; + int mnt_group_id; + int mnt_expiry_mark; + struct hlist_head mnt_pins; + struct hlist_head mnt_stuck_children; +}; + +struct mnt_pcp { + int mnt_count; + int mnt_writers; +}; + +struct mountpoint { + struct hlist_node m_hash; + struct dentry *m_dentry; + struct hlist_head m_list; + int m_count; +}; + +typedef short unsigned int ushort; + +struct user_arg_ptr { + bool is_compat; + union { + const char * const *native; + const compat_uptr_t *compat; + } ptr; +}; + +enum inode_i_mutex_lock_class { + I_MUTEX_NORMAL = 0, + I_MUTEX_PARENT = 1, + I_MUTEX_CHILD = 2, + I_MUTEX_XATTR = 3, + I_MUTEX_NONDIR2 = 4, + I_MUTEX_PARENT2 = 5, +}; + +struct name_snapshot { + struct qstr name; + unsigned char inline_name[32]; +}; + +struct saved { + struct path link; + struct delayed_call done; + const char *name; + unsigned int seq; +}; + +struct nameidata { + struct path path; + struct qstr last; + struct path root; + struct inode *inode; + unsigned int flags; + unsigned int seq; + unsigned int m_seq; + unsigned int r_seq; + int last_type; + unsigned int depth; + int total_link_count; + struct saved *stack; + struct saved internal[2]; + struct filename *name; + struct nameidata *saved; + unsigned int root_seq; + int dfd; + kuid_t dir_uid; + umode_t dir_mode; +}; + +enum { + LAST_NORM = 0, + LAST_ROOT = 1, + LAST_DOT = 2, + LAST_DOTDOT = 3, +}; + +enum { + WALK_TRAILING = 1, + WALK_MORE = 2, + WALK_NOFOLLOW = 4, +}; + +struct word_at_a_time { + const long unsigned int one_bits; + const long unsigned int high_bits; +}; + +struct f_owner_ex { + int type; + __kernel_pid_t pid; +}; + +struct flock { + short int l_type; + short int l_whence; + __kernel_off_t l_start; + __kernel_off_t l_len; + __kernel_pid_t l_pid; +}; + +struct compat_flock { + short int l_type; + short int l_whence; + compat_off_t l_start; + compat_off_t l_len; + compat_pid_t l_pid; +}; + +struct compat_flock64 { + short int l_type; + short int l_whence; + compat_loff_t l_start; + compat_loff_t l_len; + compat_pid_t l_pid; +} __attribute__((packed)); + +struct file_clone_range { + __s64 src_fd; + __u64 src_offset; + __u64 src_length; + __u64 dest_offset; +}; + +struct file_dedupe_range_info { + __s64 dest_fd; + __u64 dest_offset; + __u64 bytes_deduped; + __s32 status; + __u32 reserved; +}; + +struct file_dedupe_range { + __u64 src_offset; + __u64 src_length; + __u16 dest_count; + __u16 reserved1; + __u32 reserved2; + struct file_dedupe_range_info info[0]; +}; + +typedef int get_block_t(struct inode *, sector_t, struct buffer_head *, int); + +struct fiemap_extent; + +struct fiemap_extent_info { + unsigned int fi_flags; + unsigned int fi_extents_mapped; + unsigned int fi_extents_max; + struct fiemap_extent *fi_extents_start; +}; + +struct space_resv { + __s16 l_type; + __s16 l_whence; + __s64 l_start; + __s64 l_len; + __s32 l_sysid; + __u32 l_pid; + __s32 l_pad[4]; +}; + +struct space_resv_32 { + __s16 l_type; + __s16 l_whence; + __s64 l_start; + __s64 l_len; + __s32 l_sysid; + __u32 l_pid; + __s32 l_pad[4]; +} __attribute__((packed)); + +struct fiemap_extent { + __u64 fe_logical; + __u64 fe_physical; + __u64 fe_length; + __u64 fe_reserved64[2]; + __u32 fe_flags; + __u32 fe_reserved[3]; +}; + +struct fiemap { + __u64 fm_start; + __u64 fm_length; + __u32 fm_flags; + __u32 fm_mapped_extents; + __u32 fm_extent_count; + __u32 fm_reserved; + struct fiemap_extent fm_extents[0]; +}; + +struct linux_dirent64 { + u64 d_ino; + s64 d_off; + short unsigned int d_reclen; + unsigned char d_type; + char d_name[0]; +}; + +struct old_linux_dirent { + long unsigned int d_ino; + long unsigned int d_offset; + short unsigned int d_namlen; + char d_name[1]; +}; + +struct readdir_callback { + struct dir_context ctx; + struct old_linux_dirent *dirent; + int result; +}; + +struct linux_dirent { + long unsigned int d_ino; + long unsigned int d_off; + short unsigned int d_reclen; + char d_name[1]; +}; + +struct getdents_callback { + struct dir_context ctx; + struct linux_dirent *current_dir; + int prev_reclen; + int count; + int error; +}; + +struct getdents_callback64 { + struct dir_context ctx; + struct linux_dirent64 *current_dir; + int prev_reclen; + int count; + int error; +}; + +struct compat_old_linux_dirent { + compat_ulong_t d_ino; + compat_ulong_t d_offset; + short unsigned int d_namlen; + char d_name[1]; +}; + +struct compat_readdir_callback { + struct dir_context ctx; + struct compat_old_linux_dirent *dirent; + int result; +}; + +struct compat_linux_dirent { + compat_ulong_t d_ino; + compat_ulong_t d_off; + short unsigned int d_reclen; + char d_name[1]; +}; + +struct compat_getdents_callback { + struct dir_context ctx; + struct compat_linux_dirent *current_dir; + int prev_reclen; + int count; + int error; +}; + +typedef struct { + long unsigned int fds_bits[16]; +} __kernel_fd_set; + +typedef __kernel_fd_set fd_set; + +struct poll_table_entry { + struct file *filp; + __poll_t key; + wait_queue_entry_t wait; + wait_queue_head_t *wait_address; +}; + +struct poll_table_page; + +struct poll_wqueues { + poll_table pt; + struct poll_table_page *table; + struct task_struct *polling_task; + int triggered; + int error; + int inline_index; + struct poll_table_entry inline_entries[9]; +}; + +struct poll_table_page { + struct poll_table_page *next; + struct poll_table_entry *entry; + struct poll_table_entry entries[0]; +}; + +enum poll_time_type { + PT_TIMEVAL = 0, + PT_OLD_TIMEVAL = 1, + PT_TIMESPEC = 2, + PT_OLD_TIMESPEC = 3, +}; + +typedef struct { + long unsigned int *in; + long unsigned int *out; + long unsigned int *ex; + long unsigned int *res_in; + long unsigned int *res_out; + long unsigned int *res_ex; +} fd_set_bits; + +struct sigset_argpack { + sigset_t *p; + size_t size; +}; + +struct poll_list { + struct poll_list *next; + int len; + struct pollfd entries[0]; +}; + +struct compat_sel_arg_struct { + compat_ulong_t n; + compat_uptr_t inp; + compat_uptr_t outp; + compat_uptr_t exp; + compat_uptr_t tvp; +}; + +struct compat_sigset_argpack { + compat_uptr_t p; + compat_size_t size; +}; + +enum dentry_d_lock_class { + DENTRY_D_LOCK_NORMAL = 0, + DENTRY_D_LOCK_NESTED = 1, +}; + +struct external_name { + union { + atomic_t count; + struct callback_head head; + } u; + unsigned char name[0]; +}; + +enum d_walk_ret { + D_WALK_CONTINUE = 0, + D_WALK_QUIT = 1, + D_WALK_NORETRY = 2, + D_WALK_SKIP = 3, +}; + +struct check_mount { + struct vfsmount *mnt; + unsigned int mounted; +}; + +struct select_data { + struct dentry *start; + union { + long int found; + struct dentry *victim; + }; + struct list_head dispose; +}; + +struct fsxattr { + __u32 fsx_xflags; + __u32 fsx_extsize; + __u32 fsx_nextents; + __u32 fsx_projid; + __u32 fsx_cowextsize; + unsigned char fsx_pad[8]; +}; + +enum file_time_flags { + S_ATIME = 1, + S_MTIME = 2, + S_CTIME = 4, + S_VERSION = 8, +}; + +struct proc_mounts { + struct mnt_namespace *ns; + struct path root; + int (*show)(struct seq_file *, struct vfsmount *); + struct mount cursor; +}; + +enum umount_tree_flags { + UMOUNT_SYNC = 1, + UMOUNT_PROPAGATE = 2, + UMOUNT_CONNECTED = 4, +}; + +struct unicode_map { + const char *charset; + int version; +}; + +struct simple_transaction_argresp { + ssize_t size; + char data[0]; +}; + +struct simple_attr { + int (*get)(void *, u64 *); + int (*set)(void *, u64); + char get_buf[24]; + char set_buf[24]; + void *data; + const char *fmt; + struct mutex mutex; +}; + +struct wb_writeback_work { + long int nr_pages; + struct super_block *sb; + enum writeback_sync_modes sync_mode; + unsigned int tagged_writepages: 1; + unsigned int for_kupdate: 1; + unsigned int range_cyclic: 1; + unsigned int for_background: 1; + unsigned int for_sync: 1; + unsigned int auto_free: 1; + enum wb_reason reason; + struct list_head list; + struct wb_completion *done; +}; + +struct trace_event_raw_writeback_page_template { + struct trace_entry ent; + char name[32]; + ino_t ino; + long unsigned int index; + char __data[0]; +}; + +struct trace_event_raw_writeback_dirty_inode_template { + struct trace_entry ent; + char name[32]; + ino_t ino; + long unsigned int state; + long unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_inode_foreign_history { + struct trace_entry ent; + char name[32]; + ino_t ino; + ino_t cgroup_ino; + unsigned int history; + char __data[0]; +}; + +struct trace_event_raw_inode_switch_wbs { + struct trace_entry ent; + char name[32]; + ino_t ino; + ino_t old_cgroup_ino; + ino_t new_cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_track_foreign_dirty { + struct trace_entry ent; + char name[32]; + u64 bdi_id; + ino_t ino; + unsigned int memcg_id; + ino_t cgroup_ino; + ino_t page_cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_flush_foreign { + struct trace_entry ent; + char name[32]; + ino_t cgroup_ino; + unsigned int frn_bdi_id; + unsigned int frn_memcg_id; + char __data[0]; +}; + +struct trace_event_raw_writeback_write_inode_template { + struct trace_entry ent; + char name[32]; + ino_t ino; + int sync_mode; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_writeback_work_class { + struct trace_entry ent; + char name[32]; + long int nr_pages; + dev_t sb_dev; + int sync_mode; + int for_kupdate; + int range_cyclic; + int for_background; + int reason; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_writeback_pages_written { + struct trace_entry ent; + long int pages; + char __data[0]; +}; + +struct trace_event_raw_writeback_class { + struct trace_entry ent; + char name[32]; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_writeback_bdi_register { + struct trace_entry ent; + char name[32]; + char __data[0]; +}; + +struct trace_event_raw_wbc_class { + struct trace_entry ent; + char name[32]; + long int nr_to_write; + long int pages_skipped; + int sync_mode; + int for_kupdate; + int for_background; + int for_reclaim; + int range_cyclic; + long int range_start; + long int range_end; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_writeback_queue_io { + struct trace_entry ent; + char name[32]; + long unsigned int older; + long int age; + int moved; + int reason; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_global_dirty_state { + struct trace_entry ent; + long unsigned int nr_dirty; + long unsigned int nr_writeback; + long unsigned int background_thresh; + long unsigned int dirty_thresh; + long unsigned int dirty_limit; + long unsigned int nr_dirtied; + long unsigned int nr_written; + char __data[0]; +}; + +struct trace_event_raw_bdi_dirty_ratelimit { + struct trace_entry ent; + char bdi[32]; + long unsigned int write_bw; + long unsigned int avg_write_bw; + long unsigned int dirty_rate; + long unsigned int dirty_ratelimit; + long unsigned int task_ratelimit; + long unsigned int balanced_dirty_ratelimit; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_balance_dirty_pages { + struct trace_entry ent; + char bdi[32]; + long unsigned int limit; + long unsigned int setpoint; + long unsigned int dirty; + long unsigned int bdi_setpoint; + long unsigned int bdi_dirty; + long unsigned int dirty_ratelimit; + long unsigned int task_ratelimit; + unsigned int dirtied; + unsigned int dirtied_pause; + long unsigned int paused; + long int pause; + long unsigned int period; + long int think; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_writeback_sb_inodes_requeue { + struct trace_entry ent; + char name[32]; + ino_t ino; + long unsigned int state; + long unsigned int dirtied_when; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_writeback_congest_waited_template { + struct trace_entry ent; + unsigned int usec_timeout; + unsigned int usec_delayed; + char __data[0]; +}; + +struct trace_event_raw_writeback_single_inode_template { + struct trace_entry ent; + char name[32]; + ino_t ino; + long unsigned int state; + long unsigned int dirtied_when; + long unsigned int writeback_index; + long int nr_to_write; + long unsigned int wrote; + ino_t cgroup_ino; + char __data[0]; +}; + +struct trace_event_raw_writeback_inode_template { + struct trace_entry ent; + dev_t dev; + ino_t ino; + long unsigned int state; + __u16 mode; + long unsigned int dirtied_when; + char __data[0]; +}; + +struct trace_event_data_offsets_writeback_page_template {}; + +struct trace_event_data_offsets_writeback_dirty_inode_template {}; + +struct trace_event_data_offsets_inode_foreign_history {}; + +struct trace_event_data_offsets_inode_switch_wbs {}; + +struct trace_event_data_offsets_track_foreign_dirty {}; + +struct trace_event_data_offsets_flush_foreign {}; + +struct trace_event_data_offsets_writeback_write_inode_template {}; + +struct trace_event_data_offsets_writeback_work_class {}; + +struct trace_event_data_offsets_writeback_pages_written {}; + +struct trace_event_data_offsets_writeback_class {}; + +struct trace_event_data_offsets_writeback_bdi_register {}; + +struct trace_event_data_offsets_wbc_class {}; + +struct trace_event_data_offsets_writeback_queue_io {}; + +struct trace_event_data_offsets_global_dirty_state {}; + +struct trace_event_data_offsets_bdi_dirty_ratelimit {}; + +struct trace_event_data_offsets_balance_dirty_pages {}; + +struct trace_event_data_offsets_writeback_sb_inodes_requeue {}; + +struct trace_event_data_offsets_writeback_congest_waited_template {}; + +struct trace_event_data_offsets_writeback_single_inode_template {}; + +struct trace_event_data_offsets_writeback_inode_template {}; + +typedef void (*btf_trace_writeback_dirty_page)(void *, struct page *, struct address_space *); + +typedef void (*btf_trace_wait_on_page_writeback)(void *, struct page *, struct address_space *); + +typedef void (*btf_trace_writeback_mark_inode_dirty)(void *, struct inode *, int); + +typedef void (*btf_trace_writeback_dirty_inode_start)(void *, struct inode *, int); + +typedef void (*btf_trace_writeback_dirty_inode)(void *, struct inode *, int); + +typedef void (*btf_trace_inode_foreign_history)(void *, struct inode *, struct writeback_control *, unsigned int); + +typedef void (*btf_trace_inode_switch_wbs)(void *, struct inode *, struct bdi_writeback *, struct bdi_writeback *); + +typedef void (*btf_trace_track_foreign_dirty)(void *, struct page *, struct bdi_writeback *); + +typedef void (*btf_trace_flush_foreign)(void *, struct bdi_writeback *, unsigned int, unsigned int); + +typedef void (*btf_trace_writeback_write_inode_start)(void *, struct inode *, struct writeback_control *); + +typedef void (*btf_trace_writeback_write_inode)(void *, struct inode *, struct writeback_control *); + +typedef void (*btf_trace_writeback_queue)(void *, struct bdi_writeback *, struct wb_writeback_work *); + +typedef void (*btf_trace_writeback_exec)(void *, struct bdi_writeback *, struct wb_writeback_work *); + +typedef void (*btf_trace_writeback_start)(void *, struct bdi_writeback *, struct wb_writeback_work *); + +typedef void (*btf_trace_writeback_written)(void *, struct bdi_writeback *, struct wb_writeback_work *); + +typedef void (*btf_trace_writeback_wait)(void *, struct bdi_writeback *, struct wb_writeback_work *); + +typedef void (*btf_trace_writeback_pages_written)(void *, long int); + +typedef void (*btf_trace_writeback_wake_background)(void *, struct bdi_writeback *); + +typedef void (*btf_trace_writeback_bdi_register)(void *, struct backing_dev_info *); + +typedef void (*btf_trace_wbc_writepage)(void *, struct writeback_control *, struct backing_dev_info *); + +typedef void (*btf_trace_writeback_queue_io)(void *, struct bdi_writeback *, struct wb_writeback_work *, long unsigned int, int); + +typedef void (*btf_trace_global_dirty_state)(void *, long unsigned int, long unsigned int); + +typedef void (*btf_trace_bdi_dirty_ratelimit)(void *, struct bdi_writeback *, long unsigned int, long unsigned int); + +typedef void (*btf_trace_balance_dirty_pages)(void *, struct bdi_writeback *, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long unsigned int, long int, long unsigned int); + +typedef void (*btf_trace_writeback_sb_inodes_requeue)(void *, struct inode *); + +typedef void (*btf_trace_writeback_congestion_wait)(void *, unsigned int, unsigned int); + +typedef void (*btf_trace_writeback_wait_iff_congested)(void *, unsigned int, unsigned int); + +typedef void (*btf_trace_writeback_single_inode_start)(void *, struct inode *, struct writeback_control *, long unsigned int); + +typedef void (*btf_trace_writeback_single_inode)(void *, struct inode *, struct writeback_control *, long unsigned int); + +typedef void (*btf_trace_writeback_lazytime)(void *, struct inode *); + +typedef void (*btf_trace_writeback_lazytime_iput)(void *, struct inode *); + +typedef void (*btf_trace_writeback_dirty_inode_enqueue)(void *, struct inode *); + +typedef void (*btf_trace_sb_mark_inode_writeback)(void *, struct inode *); + +typedef void (*btf_trace_sb_clear_inode_writeback)(void *, struct inode *); + +struct inode_switch_wbs_context { + struct inode *inode; + struct bdi_writeback *new_wb; + struct callback_head callback_head; + struct work_struct work; +}; + +struct splice_desc { + size_t total_len; + unsigned int len; + unsigned int flags; + union { + void *userptr; + struct file *file; + void *data; + } u; + loff_t pos; + loff_t *opos; + size_t num_spliced; + bool need_wakeup; +}; + +typedef int splice_actor(struct pipe_inode_info *, struct pipe_buffer *, struct splice_desc *); + +typedef int splice_direct_actor(struct pipe_inode_info *, struct splice_desc *); + +struct old_utimbuf32 { + old_time32_t actime; + old_time32_t modtime; +}; + +struct utimbuf { + __kernel_old_time_t actime; + __kernel_old_time_t modtime; +}; + +typedef int __kernel_daddr_t; + +struct ustat { + __kernel_daddr_t f_tfree; + __kernel_ino_t f_tinode; + char f_fname[6]; + char f_fpack[6]; +}; + +typedef s32 compat_daddr_t; + +typedef __kernel_fsid_t compat_fsid_t; + +struct compat_statfs { + int f_type; + int f_bsize; + int f_blocks; + int f_bfree; + int f_bavail; + int f_files; + int f_ffree; + compat_fsid_t f_fsid; + int f_namelen; + int f_frsize; + int f_flags; + int f_spare[4]; +}; + +struct compat_ustat { + compat_daddr_t f_tfree; + compat_ino_t f_tinode; + char f_fname[6]; + char f_fpack[6]; +}; + +struct statfs { + __kernel_long_t f_type; + __kernel_long_t f_bsize; + __kernel_long_t f_blocks; + __kernel_long_t f_bfree; + __kernel_long_t f_bavail; + __kernel_long_t f_files; + __kernel_long_t f_ffree; + __kernel_fsid_t f_fsid; + __kernel_long_t f_namelen; + __kernel_long_t f_frsize; + __kernel_long_t f_flags; + __kernel_long_t f_spare[4]; +}; + +struct statfs64 { + __kernel_long_t f_type; + __kernel_long_t f_bsize; + __u64 f_blocks; + __u64 f_bfree; + __u64 f_bavail; + __u64 f_files; + __u64 f_ffree; + __kernel_fsid_t f_fsid; + __kernel_long_t f_namelen; + __kernel_long_t f_frsize; + __kernel_long_t f_flags; + __kernel_long_t f_spare[4]; +}; + +struct compat_statfs64 { + __u32 f_type; + __u32 f_bsize; + __u64 f_blocks; + __u64 f_bfree; + __u64 f_bavail; + __u64 f_files; + __u64 f_ffree; + __kernel_fsid_t f_fsid; + __u32 f_namelen; + __u32 f_frsize; + __u32 f_flags; + __u32 f_spare[4]; +} __attribute__((packed)); + +struct ns_get_path_task_args { + const struct proc_ns_operations *ns_ops; + struct task_struct *task; +}; + +enum legacy_fs_param { + LEGACY_FS_UNSET_PARAMS = 0, + LEGACY_FS_MONOLITHIC_PARAMS = 1, + LEGACY_FS_INDIVIDUAL_PARAMS = 2, +}; + +struct legacy_fs_context { + char *legacy_data; + size_t data_size; + enum legacy_fs_param param_type; +}; + +enum fsconfig_command { + FSCONFIG_SET_FLAG = 0, + FSCONFIG_SET_STRING = 1, + FSCONFIG_SET_BINARY = 2, + FSCONFIG_SET_PATH = 3, + FSCONFIG_SET_PATH_EMPTY = 4, + FSCONFIG_SET_FD = 5, + FSCONFIG_CMD_CREATE = 6, + FSCONFIG_CMD_RECONFIGURE = 7, +}; + +struct dax_device; + +struct iomap_page_ops; + +struct iomap { + u64 addr; + loff_t offset; + u64 length; + u16 type; + u16 flags; + struct block_device *bdev; + struct dax_device *dax_dev; + void *inline_data; + void *private; + const struct iomap_page_ops *page_ops; +}; + +struct iomap_page_ops { + int (*page_prepare)(struct inode *, loff_t, unsigned int, struct iomap *); + void (*page_done)(struct inode *, loff_t, unsigned int, struct page *, struct iomap *); +}; + +struct decrypt_bh_ctx { + struct work_struct work; + struct buffer_head *bh; +}; + +struct bh_lru { + struct buffer_head *bhs[16]; +}; + +struct bh_accounting { + int nr; + int ratelimit; +}; + +enum stat_group { + STAT_READ = 0, + STAT_WRITE = 1, + STAT_DISCARD = 2, + STAT_FLUSH = 3, + NR_STAT_GROUPS = 4, +}; + +enum { + DISK_EVENT_MEDIA_CHANGE = 1, + DISK_EVENT_EJECT_REQUEST = 2, +}; + +enum { + BIOSET_NEED_BVECS = 1, + BIOSET_NEED_RESCUER = 2, +}; + +struct bdev_inode { + struct block_device bdev; + struct inode vfs_inode; +}; + +struct blkdev_dio { + union { + struct kiocb *iocb; + struct task_struct *waiter; + }; + size_t size; + atomic_t ref; + bool multi_bio: 1; + bool should_dirty: 1; + bool is_sync: 1; + struct bio bio; +}; + +struct bd_holder_disk { + struct list_head list; + struct gendisk *disk; + int refcnt; +}; + +typedef int dio_iodone_t(struct kiocb *, loff_t, ssize_t, void *); + +typedef void dio_submit_t(struct bio *, struct inode *, loff_t); + +enum { + DIO_LOCKING = 1, + DIO_SKIP_HOLES = 2, +}; + +struct dio_submit { + struct bio *bio; + unsigned int blkbits; + unsigned int blkfactor; + unsigned int start_zero_done; + int pages_in_io; + sector_t block_in_file; + unsigned int blocks_available; + int reap_counter; + sector_t final_block_in_request; + int boundary; + get_block_t *get_block; + dio_submit_t *submit_io; + loff_t logical_offset_in_bio; + sector_t final_block_in_bio; + sector_t next_block_for_io; + struct page *cur_page; + unsigned int cur_page_offset; + unsigned int cur_page_len; + sector_t cur_page_block; + loff_t cur_page_fs_offset; + struct iov_iter *iter; + unsigned int head; + unsigned int tail; + size_t from; + size_t to; +}; + +struct dio { + int flags; + int op; + int op_flags; + blk_qc_t bio_cookie; + struct gendisk *bio_disk; + struct inode *inode; + loff_t i_size; + dio_iodone_t *end_io; + void *private; + spinlock_t bio_lock; + int page_errors; + int is_async; + bool defer_completion; + bool should_dirty; + int io_error; + long unsigned int refcount; + struct bio *bio_list; + struct task_struct *waiter; + struct kiocb *iocb; + ssize_t result; + union { + struct page *pages[64]; + struct work_struct complete_work; + }; + long: 64; +}; + +struct bvec_iter_all { + struct bio_vec bv; + int idx; + unsigned int done; +}; + +struct mpage_readpage_args { + struct bio *bio; + struct page *page; + unsigned int nr_pages; + bool is_readahead; + sector_t last_block_in_bio; + struct buffer_head map_bh; + long unsigned int first_logical_block; + get_block_t *get_block; +}; + +struct mpage_data { + struct bio *bio; + sector_t last_block_in_bio; + get_block_t *get_block; + unsigned int use_writepage; +}; + +typedef u32 nlink_t; + +typedef int (*proc_write_t)(struct file *, char *, size_t); + +struct proc_dir_entry { + atomic_t in_use; + refcount_t refcnt; + struct list_head pde_openers; + spinlock_t pde_unload_lock; + struct completion *pde_unload_completion; + const struct inode_operations *proc_iops; + union { + const struct proc_ops *proc_ops; + const struct file_operations *proc_dir_ops; + }; + const struct dentry_operations *proc_dops; + union { + const struct seq_operations *seq_ops; + int (*single_show)(struct seq_file *, void *); + }; + proc_write_t write; + void *data; + unsigned int state_size; + unsigned int low_ino; + nlink_t nlink; + kuid_t uid; + kgid_t gid; + loff_t size; + struct proc_dir_entry *parent; + struct rb_root subdir; + struct rb_node subdir_node; + char *name; + umode_t mode; + u8 flags; + u8 namelen; + char inline_name[0]; +}; + +union proc_op { + int (*proc_get_link)(struct dentry *, struct path *); + int (*proc_show)(struct seq_file *, struct pid_namespace *, struct pid *, struct task_struct *); + const char *lsm; +}; + +struct proc_inode { + struct pid *pid; + unsigned int fd; + union proc_op op; + struct proc_dir_entry *pde; + struct ctl_table_header *sysctl; + struct ctl_table *sysctl_entry; + struct hlist_node sibling_inodes; + const struct proc_ns_operations *ns_ops; + struct inode vfs_inode; +}; + +struct proc_fs_opts { + int flag; + const char *str; +}; + +struct file_handle { + __u32 handle_bytes; + int handle_type; + unsigned char f_handle[0]; +}; + +struct inotify_inode_mark { + struct fsnotify_mark fsn_mark; + int wd; +}; + +struct dnotify_struct { + struct dnotify_struct *dn_next; + __u32 dn_mask; + int dn_fd; + struct file *dn_filp; + fl_owner_t dn_owner; +}; + +struct dnotify_mark { + struct fsnotify_mark fsn_mark; + struct dnotify_struct *dn; +}; + +struct inotify_event_info { + struct fsnotify_event fse; + u32 mask; + int wd; + u32 sync_cookie; + int name_len; + char name[0]; +}; + +struct inotify_event { + __s32 wd; + __u32 mask; + __u32 cookie; + __u32 len; + char name[0]; +}; + +enum { + FAN_EVENT_INIT = 0, + FAN_EVENT_REPORTED = 1, + FAN_EVENT_ANSWERED = 2, + FAN_EVENT_CANCELED = 3, +}; + +struct fanotify_fh { + u8 type; + u8 len; + u8 flags; + u8 pad; + unsigned char buf[0]; +}; + +struct fanotify_info { + u8 dir_fh_totlen; + u8 file_fh_totlen; + u8 name_len; + u8 pad; + unsigned char buf[0]; +}; + +enum fanotify_event_type { + FANOTIFY_EVENT_TYPE_FID = 0, + FANOTIFY_EVENT_TYPE_FID_NAME = 1, + FANOTIFY_EVENT_TYPE_PATH = 2, + FANOTIFY_EVENT_TYPE_PATH_PERM = 3, + FANOTIFY_EVENT_TYPE_OVERFLOW = 4, +}; + +struct fanotify_event { + struct fsnotify_event fse; + u32 mask; + enum fanotify_event_type type; + struct pid *pid; +}; + +struct fanotify_fid_event { + struct fanotify_event fae; + __kernel_fsid_t fsid; + struct fanotify_fh object_fh; + unsigned char _inline_fh_buf[12]; +}; + +struct fanotify_name_event { + struct fanotify_event fae; + __kernel_fsid_t fsid; + struct fanotify_info info; +}; + +struct fanotify_path_event { + struct fanotify_event fae; + struct path path; +}; + +struct fanotify_perm_event { + struct fanotify_event fae; + struct path path; + short unsigned int response; + short unsigned int state; + int fd; +}; + +struct fanotify_event_metadata { + __u32 event_len; + __u8 vers; + __u8 reserved; + __u16 metadata_len; + __u64 mask; + __s32 fd; + __s32 pid; +}; + +struct fanotify_event_info_header { + __u8 info_type; + __u8 pad; + __u16 len; +}; + +struct fanotify_event_info_fid { + struct fanotify_event_info_header hdr; + __kernel_fsid_t fsid; + unsigned char handle[0]; +}; + +struct fanotify_response { + __s32 fd; + __u32 response; +}; + +struct epoll_event { + __poll_t events; + __u64 data; +} __attribute__((packed)); + +struct epoll_filefd { + struct file *file; + int fd; +} __attribute__((packed)); + +struct epitem; + +struct eppoll_entry { + struct eppoll_entry *next; + struct epitem *base; + wait_queue_entry_t wait; + wait_queue_head_t *whead; +}; + +struct eventpoll; + +struct epitem { + union { + struct rb_node rbn; + struct callback_head rcu; + }; + struct list_head rdllink; + struct epitem *next; + struct epoll_filefd ffd; + struct eppoll_entry *pwqlist; + struct eventpoll *ep; + struct hlist_node fllink; + struct wakeup_source *ws; + struct epoll_event event; +}; + +struct eventpoll { + struct mutex mtx; + wait_queue_head_t wq; + wait_queue_head_t poll_wait; + struct list_head rdllist; + rwlock_t lock; + struct rb_root_cached rbr; + struct epitem *ovflist; + struct wakeup_source *ws; + struct user_struct *user; + struct file *file; + u64 gen; + struct hlist_head refs; + unsigned int napi_id; +}; + +struct ep_pqueue { + poll_table pt; + struct epitem *epi; +}; + +struct epitems_head { + struct hlist_head epitems; + struct epitems_head *next; +}; + +struct signalfd_siginfo { + __u32 ssi_signo; + __s32 ssi_errno; + __s32 ssi_code; + __u32 ssi_pid; + __u32 ssi_uid; + __s32 ssi_fd; + __u32 ssi_tid; + __u32 ssi_band; + __u32 ssi_overrun; + __u32 ssi_trapno; + __s32 ssi_status; + __s32 ssi_int; + __u64 ssi_ptr; + __u64 ssi_utime; + __u64 ssi_stime; + __u64 ssi_addr; + __u16 ssi_addr_lsb; + __u16 __pad2; + __s32 ssi_syscall; + __u64 ssi_call_addr; + __u32 ssi_arch; + __u8 __pad[28]; +}; + +struct signalfd_ctx { + sigset_t sigmask; +}; + +struct timerfd_ctx { + union { + struct hrtimer tmr; + struct alarm alarm; + } t; + ktime_t tintv; + ktime_t moffs; + wait_queue_head_t wqh; + u64 ticks; + int clockid; + short unsigned int expired; + short unsigned int settime_flags; + struct callback_head rcu; + struct list_head clist; + spinlock_t cancel_lock; + bool might_cancel; +}; + +struct eventfd_ctx___2 { + struct kref kref; + wait_queue_head_t wqh; + __u64 count; + unsigned int flags; + int id; +}; + +enum userfaultfd_state { + UFFD_STATE_WAIT_API = 0, + UFFD_STATE_RUNNING = 1, +}; + +struct userfaultfd_ctx { + wait_queue_head_t fault_pending_wqh; + wait_queue_head_t fault_wqh; + wait_queue_head_t fd_wqh; + wait_queue_head_t event_wqh; + seqcount_spinlock_t refile_seq; + refcount_t refcount; + unsigned int flags; + unsigned int features; + enum userfaultfd_state state; + bool released; + bool mmap_changing; + struct mm_struct *mm; +}; + +struct uffd_msg { + __u8 event; + __u8 reserved1; + __u16 reserved2; + __u32 reserved3; + union { + struct { + __u64 flags; + __u64 address; + union { + __u32 ptid; + } feat; + } pagefault; + struct { + __u32 ufd; + } fork; + struct { + __u64 from; + __u64 to; + __u64 len; + } remap; + struct { + __u64 start; + __u64 end; + } remove; + struct { + __u64 reserved1; + __u64 reserved2; + __u64 reserved3; + } reserved; + } arg; +}; + +struct uffdio_api { + __u64 api; + __u64 features; + __u64 ioctls; +}; + +struct uffdio_range { + __u64 start; + __u64 len; +}; + +struct uffdio_register { + struct uffdio_range range; + __u64 mode; + __u64 ioctls; +}; + +struct uffdio_copy { + __u64 dst; + __u64 src; + __u64 len; + __u64 mode; + __s64 copy; +}; + +struct uffdio_zeropage { + struct uffdio_range range; + __u64 mode; + __s64 zeropage; +}; + +struct uffdio_writeprotect { + struct uffdio_range range; + __u64 mode; +}; + +struct userfaultfd_fork_ctx { + struct userfaultfd_ctx *orig; + struct userfaultfd_ctx *new; + struct list_head list; +}; + +struct userfaultfd_unmap_ctx { + struct userfaultfd_ctx *ctx; + long unsigned int start; + long unsigned int end; + struct list_head list; +}; + +struct userfaultfd_wait_queue { + struct uffd_msg msg; + wait_queue_entry_t wq; + struct userfaultfd_ctx *ctx; + bool waken; +}; + +struct userfaultfd_wake_range { + long unsigned int start; + long unsigned int len; +}; + +struct kioctx; + +struct kioctx_table { + struct callback_head rcu; + unsigned int nr; + struct kioctx *table[0]; +}; + +typedef __kernel_ulong_t aio_context_t; + +enum { + IOCB_CMD_PREAD = 0, + IOCB_CMD_PWRITE = 1, + IOCB_CMD_FSYNC = 2, + IOCB_CMD_FDSYNC = 3, + IOCB_CMD_POLL = 5, + IOCB_CMD_NOOP = 6, + IOCB_CMD_PREADV = 7, + IOCB_CMD_PWRITEV = 8, +}; + +struct io_event { + __u64 data; + __u64 obj; + __s64 res; + __s64 res2; +}; + +struct iocb { + __u64 aio_data; + __u32 aio_key; + __kernel_rwf_t aio_rw_flags; + __u16 aio_lio_opcode; + __s16 aio_reqprio; + __u32 aio_fildes; + __u64 aio_buf; + __u64 aio_nbytes; + __s64 aio_offset; + __u64 aio_reserved2; + __u32 aio_flags; + __u32 aio_resfd; +}; + +typedef u32 compat_aio_context_t; + +typedef int kiocb_cancel_fn(struct kiocb *); + +struct aio_ring { + unsigned int id; + unsigned int nr; + unsigned int head; + unsigned int tail; + unsigned int magic; + unsigned int compat_features; + unsigned int incompat_features; + unsigned int header_length; + struct io_event io_events[0]; +}; + +struct kioctx_cpu; + +struct ctx_rq_wait; + +struct kioctx { + struct percpu_ref users; + atomic_t dead; + struct percpu_ref reqs; + long unsigned int user_id; + struct kioctx_cpu *cpu; + unsigned int req_batch; + unsigned int max_reqs; + unsigned int nr_events; + long unsigned int mmap_base; + long unsigned int mmap_size; + struct page **ring_pages; + long int nr_pages; + struct rcu_work free_rwork; + struct ctx_rq_wait *rq_wait; + long: 64; + long: 64; + long: 64; + struct { + atomic_t reqs_available; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + }; + struct { + spinlock_t ctx_lock; + struct list_head active_reqs; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + }; + struct { + struct mutex ring_lock; + wait_queue_head_t wait; + long: 64; + }; + struct { + unsigned int tail; + unsigned int completed_events; + spinlock_t completion_lock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + }; + struct page *internal_pages[8]; + struct file *aio_ring_file; + unsigned int id; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct kioctx_cpu { + unsigned int reqs_available; +}; + +struct ctx_rq_wait { + struct completion comp; + atomic_t count; +}; + +struct fsync_iocb { + struct file *file; + struct work_struct work; + bool datasync; + struct cred *creds; +}; + +struct poll_iocb { + struct file *file; + struct wait_queue_head *head; + __poll_t events; + bool done; + bool cancelled; + struct wait_queue_entry wait; + struct work_struct work; +}; + +struct aio_kiocb { + union { + struct file *ki_filp; + struct kiocb rw; + struct fsync_iocb fsync; + struct poll_iocb poll; + }; + struct kioctx *ki_ctx; + kiocb_cancel_fn *ki_cancel; + struct io_event ki_res; + struct list_head ki_list; + refcount_t ki_refcnt; + struct eventfd_ctx *ki_eventfd; +}; + +struct aio_poll_table { + struct poll_table_struct pt; + struct aio_kiocb *iocb; + int error; +}; + +struct __aio_sigset { + const sigset_t *sigmask; + size_t sigsetsize; +}; + +struct __compat_aio_sigset { + compat_uptr_t sigmask; + compat_size_t sigsetsize; +}; + +enum { + PERCPU_REF_INIT_ATOMIC = 1, + PERCPU_REF_INIT_DEAD = 2, + PERCPU_REF_ALLOW_REINIT = 4, +}; + +struct user_msghdr { + void *msg_name; + int msg_namelen; + struct iovec *msg_iov; + __kernel_size_t msg_iovlen; + void *msg_control; + __kernel_size_t msg_controllen; + unsigned int msg_flags; +}; + +typedef s32 compat_ssize_t; + +struct compat_msghdr { + compat_uptr_t msg_name; + compat_int_t msg_namelen; + compat_uptr_t msg_iov; + compat_size_t msg_iovlen; + compat_uptr_t msg_control; + compat_size_t msg_controllen; + compat_uint_t msg_flags; +}; + +struct scm_fp_list { + short int count; + short int max; + struct user_struct *user; + struct file *fp[253]; +}; + +struct unix_skb_parms { + struct pid *pid; + kuid_t uid; + kgid_t gid; + struct scm_fp_list *fp; + u32 secid; + u32 consumed; +}; + +struct trace_event_raw_io_uring_create { + struct trace_entry ent; + int fd; + void *ctx; + u32 sq_entries; + u32 cq_entries; + u32 flags; + char __data[0]; +}; + +struct trace_event_raw_io_uring_register { + struct trace_entry ent; + void *ctx; + unsigned int opcode; + unsigned int nr_files; + unsigned int nr_bufs; + bool eventfd; + long int ret; + char __data[0]; +}; + +struct trace_event_raw_io_uring_file_get { + struct trace_entry ent; + void *ctx; + int fd; + char __data[0]; +}; + +struct io_wq_work; + +struct trace_event_raw_io_uring_queue_async_work { + struct trace_entry ent; + void *ctx; + int rw; + void *req; + struct io_wq_work *work; + unsigned int flags; + char __data[0]; +}; + +struct io_wq_work_node { + struct io_wq_work_node *next; +}; + +struct io_wq_work { + struct io_wq_work_node list; + struct io_identity *identity; + unsigned int flags; +}; + +struct trace_event_raw_io_uring_defer { + struct trace_entry ent; + void *ctx; + void *req; + long long unsigned int data; + char __data[0]; +}; + +struct trace_event_raw_io_uring_link { + struct trace_entry ent; + void *ctx; + void *req; + void *target_req; + char __data[0]; +}; + +struct trace_event_raw_io_uring_cqring_wait { + struct trace_entry ent; + void *ctx; + int min_events; + char __data[0]; +}; + +struct trace_event_raw_io_uring_fail_link { + struct trace_entry ent; + void *req; + void *link; + char __data[0]; +}; + +struct trace_event_raw_io_uring_complete { + struct trace_entry ent; + void *ctx; + u64 user_data; + long int res; + char __data[0]; +}; + +struct trace_event_raw_io_uring_submit_sqe { + struct trace_entry ent; + void *ctx; + u8 opcode; + u64 user_data; + bool force_nonblock; + bool sq_thread; + char __data[0]; +}; + +struct trace_event_raw_io_uring_poll_arm { + struct trace_entry ent; + void *ctx; + u8 opcode; + u64 user_data; + int mask; + int events; + char __data[0]; +}; + +struct trace_event_raw_io_uring_poll_wake { + struct trace_entry ent; + void *ctx; + u8 opcode; + u64 user_data; + int mask; + char __data[0]; +}; + +struct trace_event_raw_io_uring_task_add { + struct trace_entry ent; + void *ctx; + u8 opcode; + u64 user_data; + int mask; + char __data[0]; +}; + +struct trace_event_raw_io_uring_task_run { + struct trace_entry ent; + void *ctx; + u8 opcode; + u64 user_data; + char __data[0]; +}; + +struct trace_event_data_offsets_io_uring_create {}; + +struct trace_event_data_offsets_io_uring_register {}; + +struct trace_event_data_offsets_io_uring_file_get {}; + +struct trace_event_data_offsets_io_uring_queue_async_work {}; + +struct trace_event_data_offsets_io_uring_defer {}; + +struct trace_event_data_offsets_io_uring_link {}; + +struct trace_event_data_offsets_io_uring_cqring_wait {}; + +struct trace_event_data_offsets_io_uring_fail_link {}; + +struct trace_event_data_offsets_io_uring_complete {}; + +struct trace_event_data_offsets_io_uring_submit_sqe {}; + +struct trace_event_data_offsets_io_uring_poll_arm {}; + +struct trace_event_data_offsets_io_uring_poll_wake {}; + +struct trace_event_data_offsets_io_uring_task_add {}; + +struct trace_event_data_offsets_io_uring_task_run {}; + +typedef void (*btf_trace_io_uring_create)(void *, int, void *, u32, u32, u32); + +typedef void (*btf_trace_io_uring_register)(void *, void *, unsigned int, unsigned int, unsigned int, bool, long int); + +typedef void (*btf_trace_io_uring_file_get)(void *, void *, int); + +typedef void (*btf_trace_io_uring_queue_async_work)(void *, void *, int, void *, struct io_wq_work *, unsigned int); + +typedef void (*btf_trace_io_uring_defer)(void *, void *, void *, long long unsigned int); + +typedef void (*btf_trace_io_uring_link)(void *, void *, void *, void *); + +typedef void (*btf_trace_io_uring_cqring_wait)(void *, void *, int); + +typedef void (*btf_trace_io_uring_fail_link)(void *, void *, void *); + +typedef void (*btf_trace_io_uring_complete)(void *, void *, u64, long int); + +typedef void (*btf_trace_io_uring_submit_sqe)(void *, void *, u8, u64, bool, bool); + +typedef void (*btf_trace_io_uring_poll_arm)(void *, void *, u8, u64, int, int); + +typedef void (*btf_trace_io_uring_poll_wake)(void *, void *, u8, u64, int); + +typedef void (*btf_trace_io_uring_task_add)(void *, void *, u8, u64, int); + +typedef void (*btf_trace_io_uring_task_run)(void *, void *, u8, u64); + +struct io_uring_sqe { + __u8 opcode; + __u8 flags; + __u16 ioprio; + __s32 fd; + union { + __u64 off; + __u64 addr2; + }; + union { + __u64 addr; + __u64 splice_off_in; + }; + __u32 len; + union { + __kernel_rwf_t rw_flags; + __u32 fsync_flags; + __u16 poll_events; + __u32 poll32_events; + __u32 sync_range_flags; + __u32 msg_flags; + __u32 timeout_flags; + __u32 accept_flags; + __u32 cancel_flags; + __u32 open_flags; + __u32 statx_flags; + __u32 fadvise_advice; + __u32 splice_flags; + __u32 rename_flags; + __u32 unlink_flags; + }; + __u64 user_data; + union { + struct { + union { + __u16 buf_index; + __u16 buf_group; + }; + __u16 personality; + __s32 splice_fd_in; + }; + __u64 __pad2[3]; + }; +}; + +enum { + IOSQE_FIXED_FILE_BIT = 0, + IOSQE_IO_DRAIN_BIT = 1, + IOSQE_IO_LINK_BIT = 2, + IOSQE_IO_HARDLINK_BIT = 3, + IOSQE_ASYNC_BIT = 4, + IOSQE_BUFFER_SELECT_BIT = 5, +}; + +enum { + IORING_OP_NOP = 0, + IORING_OP_READV = 1, + IORING_OP_WRITEV = 2, + IORING_OP_FSYNC = 3, + IORING_OP_READ_FIXED = 4, + IORING_OP_WRITE_FIXED = 5, + IORING_OP_POLL_ADD = 6, + IORING_OP_POLL_REMOVE = 7, + IORING_OP_SYNC_FILE_RANGE = 8, + IORING_OP_SENDMSG = 9, + IORING_OP_RECVMSG = 10, + IORING_OP_TIMEOUT = 11, + IORING_OP_TIMEOUT_REMOVE = 12, + IORING_OP_ACCEPT = 13, + IORING_OP_ASYNC_CANCEL = 14, + IORING_OP_LINK_TIMEOUT = 15, + IORING_OP_CONNECT = 16, + IORING_OP_FALLOCATE = 17, + IORING_OP_OPENAT = 18, + IORING_OP_CLOSE = 19, + IORING_OP_FILES_UPDATE = 20, + IORING_OP_STATX = 21, + IORING_OP_READ = 22, + IORING_OP_WRITE = 23, + IORING_OP_FADVISE = 24, + IORING_OP_MADVISE = 25, + IORING_OP_SEND = 26, + IORING_OP_RECV = 27, + IORING_OP_OPENAT2 = 28, + IORING_OP_EPOLL_CTL = 29, + IORING_OP_SPLICE = 30, + IORING_OP_PROVIDE_BUFFERS = 31, + IORING_OP_REMOVE_BUFFERS = 32, + IORING_OP_TEE = 33, + IORING_OP_SHUTDOWN = 34, + IORING_OP_RENAMEAT = 35, + IORING_OP_UNLINKAT = 36, + IORING_OP_LAST = 37, +}; + +struct io_uring_cqe { + __u64 user_data; + __s32 res; + __u32 flags; +}; + +enum { + IORING_CQE_BUFFER_SHIFT = 16, +}; + +struct io_sqring_offsets { + __u32 head; + __u32 tail; + __u32 ring_mask; + __u32 ring_entries; + __u32 flags; + __u32 dropped; + __u32 array; + __u32 resv1; + __u64 resv2; +}; + +struct io_cqring_offsets { + __u32 head; + __u32 tail; + __u32 ring_mask; + __u32 ring_entries; + __u32 overflow; + __u32 cqes; + __u32 flags; + __u32 resv1; + __u64 resv2; +}; + +struct io_uring_params { + __u32 sq_entries; + __u32 cq_entries; + __u32 flags; + __u32 sq_thread_cpu; + __u32 sq_thread_idle; + __u32 features; + __u32 wq_fd; + __u32 resv[3]; + struct io_sqring_offsets sq_off; + struct io_cqring_offsets cq_off; +}; + +enum { + IORING_REGISTER_BUFFERS = 0, + IORING_UNREGISTER_BUFFERS = 1, + IORING_REGISTER_FILES = 2, + IORING_UNREGISTER_FILES = 3, + IORING_REGISTER_EVENTFD = 4, + IORING_UNREGISTER_EVENTFD = 5, + IORING_REGISTER_FILES_UPDATE = 6, + IORING_REGISTER_EVENTFD_ASYNC = 7, + IORING_REGISTER_PROBE = 8, + IORING_REGISTER_PERSONALITY = 9, + IORING_UNREGISTER_PERSONALITY = 10, + IORING_REGISTER_RESTRICTIONS = 11, + IORING_REGISTER_ENABLE_RINGS = 12, + IORING_REGISTER_LAST = 13, +}; + +struct io_uring_files_update { + __u32 offset; + __u32 resv; + __u64 fds; +}; + +struct io_uring_probe_op { + __u8 op; + __u8 resv; + __u16 flags; + __u32 resv2; +}; + +struct io_uring_probe { + __u8 last_op; + __u8 ops_len; + __u16 resv; + __u32 resv2[3]; + struct io_uring_probe_op ops[0]; +}; + +struct io_uring_restriction { + __u16 opcode; + union { + __u8 register_op; + __u8 sqe_op; + __u8 sqe_flags; + }; + __u8 resv; + __u32 resv2[3]; +}; + +enum { + IORING_RESTRICTION_REGISTER_OP = 0, + IORING_RESTRICTION_SQE_OP = 1, + IORING_RESTRICTION_SQE_FLAGS_ALLOWED = 2, + IORING_RESTRICTION_SQE_FLAGS_REQUIRED = 3, + IORING_RESTRICTION_LAST = 4, +}; + +struct io_uring_getevents_arg { + __u64 sigmask; + __u32 sigmask_sz; + __u32 pad; + __u64 ts; +}; + +enum { + IO_WQ_WORK_CANCEL = 1, + IO_WQ_WORK_HASHED = 2, + IO_WQ_WORK_UNBOUND = 4, + IO_WQ_WORK_CONCURRENT = 16, + IO_WQ_WORK_FILES = 32, + IO_WQ_WORK_FS = 64, + IO_WQ_WORK_MM = 128, + IO_WQ_WORK_CREDS = 256, + IO_WQ_WORK_BLKCG = 512, + IO_WQ_WORK_FSIZE = 1024, + IO_WQ_HASH_SHIFT = 24, +}; + +enum io_wq_cancel { + IO_WQ_CANCEL_OK = 0, + IO_WQ_CANCEL_RUNNING = 1, + IO_WQ_CANCEL_NOTFOUND = 2, +}; + +typedef struct io_wq_work *free_work_fn(struct io_wq_work *); + +typedef void io_wq_work_fn(struct io_wq_work *); + +struct io_wq_data { + struct user_struct *user; + io_wq_work_fn *do_work; + free_work_fn *free_work; +}; + +typedef bool work_cancel_fn(struct io_wq_work *, void *); + +struct io_uring { + u32 head; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + u32 tail; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct io_rings { + struct io_uring sq; + struct io_uring cq; + u32 sq_ring_mask; + u32 cq_ring_mask; + u32 sq_ring_entries; + u32 cq_ring_entries; + u32 sq_dropped; + u32 sq_flags; + u32 cq_flags; + u32 cq_overflow; + long: 64; + long: 64; + long: 64; + long: 64; + struct io_uring_cqe cqes[0]; +}; + +struct io_mapped_ubuf { + u64 ubuf; + size_t len; + struct bio_vec *bvec; + unsigned int nr_bvecs; + long unsigned int acct_pages; +}; + +struct fixed_file_table { + struct file **files; +}; + +struct fixed_file_data; + +struct fixed_file_ref_node { + struct percpu_ref refs; + struct list_head node; + struct list_head file_list; + struct fixed_file_data *file_data; + struct llist_node llist; + bool done; +}; + +struct io_ring_ctx; + +struct fixed_file_data { + struct fixed_file_table *table; + struct io_ring_ctx *ctx; + struct fixed_file_ref_node *node; + struct percpu_ref refs; + struct completion done; + struct list_head ref_list; + spinlock_t lock; +}; + +struct io_wq; + +struct io_restriction { + long unsigned int register_op[1]; + long unsigned int sqe_op[1]; + u8 sqe_flags_allowed; + u8 sqe_flags_required; + bool registered; +}; + +struct io_sq_data; + +struct io_kiocb; + +struct io_ring_ctx { + struct { + struct percpu_ref refs; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + }; + struct { + unsigned int flags; + unsigned int compat: 1; + unsigned int limit_mem: 1; + unsigned int cq_overflow_flushed: 1; + unsigned int drain_next: 1; + unsigned int eventfd_async: 1; + unsigned int restricted: 1; + unsigned int sqo_dead: 1; + u32 *sq_array; + unsigned int cached_sq_head; + unsigned int sq_entries; + unsigned int sq_mask; + unsigned int sq_thread_idle; + unsigned int cached_sq_dropped; + unsigned int cached_cq_overflow; + long unsigned int sq_check_overflow; + struct list_head defer_list; + struct list_head timeout_list; + struct list_head cq_overflow_list; + struct io_uring_sqe *sq_sqes; + long: 64; + long: 64; + long: 64; + }; + struct io_rings *rings; + struct io_wq *io_wq; + struct task_struct *sqo_task; + struct mm_struct *mm_account; + struct cgroup_subsys_state *sqo_blkcg_css; + struct io_sq_data *sq_data; + struct wait_queue_head sqo_sq_wait; + struct list_head sqd_list; + struct fixed_file_data *file_data; + unsigned int nr_user_files; + unsigned int nr_user_bufs; + struct io_mapped_ubuf *user_bufs; + struct user_struct *user; + const struct cred *creds; + kuid_t loginuid; + unsigned int sessionid; + struct completion ref_comp; + struct completion sq_thread_comp; + struct io_kiocb *fallback_req; + struct socket *ring_sock; + struct idr io_buffer_idr; + struct idr personality_idr; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct { + unsigned int cached_cq_tail; + unsigned int cq_entries; + unsigned int cq_mask; + atomic_t cq_timeouts; + unsigned int cq_last_tm_flush; + long unsigned int cq_check_overflow; + struct wait_queue_head cq_wait; + struct fasync_struct *cq_fasync; + struct eventfd_ctx *cq_ev_fd; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + }; + struct { + struct mutex uring_lock; + wait_queue_head_t wait; + long: 64; + }; + struct { + spinlock_t completion_lock; + struct list_head iopoll_list; + struct hlist_head *cancel_hash; + unsigned int cancel_hash_bits; + bool poll_multi_file; + spinlock_t inflight_lock; + struct list_head inflight_list; + }; + struct delayed_work file_put_work; + struct llist_head file_put_llist; + struct work_struct exit_work; + struct io_restriction restrictions; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct io_buffer { + struct list_head list; + __u64 addr; + __s32 len; + __u16 bid; +}; + +struct io_sq_data { + refcount_t refs; + struct mutex lock; + struct list_head ctx_list; + struct list_head ctx_new_list; + struct mutex ctx_lock; + struct task_struct *thread; + struct wait_queue_head wait; + unsigned int sq_thread_idle; +}; + +struct io_rw { + struct kiocb kiocb; + u64 addr; + u64 len; +}; + +struct io_poll_iocb { + struct file *file; + struct wait_queue_head *head; + __poll_t events; + bool done; + bool canceled; + struct wait_queue_entry wait; +}; + +struct io_poll_remove { + struct file *file; + u64 addr; +}; + +struct io_accept { + struct file *file; + struct sockaddr *addr; + int *addr_len; + int flags; + long unsigned int nofile; +}; + +struct io_sync { + struct file *file; + loff_t len; + loff_t off; + int flags; + int mode; +}; + +struct io_cancel { + struct file *file; + u64 addr; +}; + +struct io_timeout { + struct file *file; + u32 off; + u32 target_seq; + struct list_head list; + struct io_kiocb *head; +}; + +struct io_timeout_rem { + struct file *file; + u64 addr; + struct timespec64 ts; + u32 flags; +}; + +struct io_connect { + struct file *file; + struct sockaddr *addr; + int addr_len; +}; + +struct io_sr_msg { + struct file *file; + union { + struct user_msghdr *umsg; + void *buf; + }; + int msg_flags; + int bgid; + size_t len; + struct io_buffer *kbuf; +}; + +struct io_open { + struct file *file; + int dfd; + bool ignore_nonblock; + struct filename *filename; + struct open_how how; + long unsigned int nofile; +}; + +struct io_close { + struct file *file; + int fd; +}; + +struct io_files_update { + struct file *file; + u64 arg; + u32 nr_args; + u32 offset; +}; + +struct io_fadvise { + struct file *file; + u64 offset; + u32 len; + u32 advice; +}; + +struct io_madvise { + struct file *file; + u64 addr; + u32 len; + u32 advice; +}; + +struct io_epoll { + struct file *file; + int epfd; + int op; + int fd; + struct epoll_event event; +} __attribute__((packed)); + +struct io_splice { + struct file *file_out; + struct file *file_in; + loff_t off_out; + loff_t off_in; + u64 len; + unsigned int flags; +}; + +struct io_provide_buf { + struct file *file; + __u64 addr; + __s32 len; + __u32 bgid; + __u16 nbufs; + __u16 bid; +}; + +struct io_statx { + struct file *file; + int dfd; + unsigned int mask; + unsigned int flags; + const char *filename; + struct statx *buffer; +}; + +struct io_shutdown { + struct file *file; + int how; +}; + +struct io_rename { + struct file *file; + int old_dfd; + int new_dfd; + struct filename *oldpath; + struct filename *newpath; + int flags; +}; + +struct io_unlink { + struct file *file; + int dfd; + int flags; + struct filename *filename; +}; + +struct io_completion { + struct file *file; + struct list_head list; + int cflags; +}; + +struct async_poll; + +struct io_kiocb { + union { + struct file *file; + struct io_rw rw; + struct io_poll_iocb poll; + struct io_poll_remove poll_remove; + struct io_accept accept; + struct io_sync sync; + struct io_cancel cancel; + struct io_timeout timeout; + struct io_timeout_rem timeout_rem; + struct io_connect connect; + struct io_sr_msg sr_msg; + struct io_open open; + struct io_close close; + struct io_files_update files_update; + struct io_fadvise fadvise; + struct io_madvise madvise; + struct io_epoll epoll; + struct io_splice splice; + struct io_provide_buf pbuf; + struct io_statx statx; + struct io_shutdown shutdown; + struct io_rename rename; + struct io_unlink unlink; + struct io_completion compl; + }; + void *async_data; + u8 opcode; + u8 iopoll_completed; + u16 buf_index; + u32 result; + struct io_ring_ctx *ctx; + unsigned int flags; + refcount_t refs; + struct task_struct *task; + u64 user_data; + struct io_kiocb *link; + struct percpu_ref *fixed_file_refs; + struct list_head inflight_entry; + struct callback_head task_work; + struct hlist_node hash_node; + struct async_poll *apoll; + struct io_wq_work work; +}; + +struct io_timeout_data { + struct io_kiocb *req; + struct hrtimer timer; + struct timespec64 ts; + enum hrtimer_mode mode; +}; + +struct io_async_connect { + struct __kernel_sockaddr_storage address; +}; + +struct io_async_msghdr { + struct iovec fast_iov[8]; + struct iovec *iov; + struct sockaddr *uaddr; + struct msghdr msg; + struct __kernel_sockaddr_storage addr; +}; + +struct io_async_rw { + struct iovec fast_iov[8]; + const struct iovec *free_iovec; + struct iov_iter iter; + size_t bytes_done; + struct wait_page_queue wpq; +}; + +enum { + REQ_F_FIXED_FILE_BIT = 0, + REQ_F_IO_DRAIN_BIT = 1, + REQ_F_LINK_BIT = 2, + REQ_F_HARDLINK_BIT = 3, + REQ_F_FORCE_ASYNC_BIT = 4, + REQ_F_BUFFER_SELECT_BIT = 5, + REQ_F_FAIL_LINK_BIT = 6, + REQ_F_INFLIGHT_BIT = 7, + REQ_F_CUR_POS_BIT = 8, + REQ_F_NOWAIT_BIT = 9, + REQ_F_LINK_TIMEOUT_BIT = 10, + REQ_F_ISREG_BIT = 11, + REQ_F_NEED_CLEANUP_BIT = 12, + REQ_F_POLLED_BIT = 13, + REQ_F_BUFFER_SELECTED_BIT = 14, + REQ_F_NO_FILE_TABLE_BIT = 15, + REQ_F_WORK_INITIALIZED_BIT = 16, + REQ_F_LTIMEOUT_ACTIVE_BIT = 17, + __REQ_F_LAST_BIT = 18, +}; + +enum { + REQ_F_FIXED_FILE = 1, + REQ_F_IO_DRAIN = 2, + REQ_F_LINK = 4, + REQ_F_HARDLINK = 8, + REQ_F_FORCE_ASYNC = 16, + REQ_F_BUFFER_SELECT = 32, + REQ_F_FAIL_LINK = 64, + REQ_F_INFLIGHT = 128, + REQ_F_CUR_POS = 256, + REQ_F_NOWAIT = 512, + REQ_F_LINK_TIMEOUT = 1024, + REQ_F_ISREG = 2048, + REQ_F_NEED_CLEANUP = 4096, + REQ_F_POLLED = 8192, + REQ_F_BUFFER_SELECTED = 16384, + REQ_F_NO_FILE_TABLE = 32768, + REQ_F_WORK_INITIALIZED = 65536, + REQ_F_LTIMEOUT_ACTIVE = 131072, +}; + +struct async_poll { + struct io_poll_iocb poll; + struct io_poll_iocb *double_poll; +}; + +struct io_defer_entry { + struct list_head list; + struct io_kiocb *req; + u32 seq; +}; + +struct io_comp_state { + unsigned int nr; + struct list_head list; + struct io_ring_ctx *ctx; +}; + +struct io_submit_state { + struct blk_plug plug; + void *reqs[8]; + unsigned int free_reqs; + bool plug_started; + struct io_comp_state comp; + struct file *file; + unsigned int fd; + unsigned int file_refs; + unsigned int ios_left; +}; + +struct io_op_def { + unsigned int needs_file: 1; + unsigned int needs_file_no_error: 1; + unsigned int hash_reg_file: 1; + unsigned int unbound_nonreg_file: 1; + unsigned int not_supported: 1; + unsigned int pollin: 1; + unsigned int pollout: 1; + unsigned int buffer_select: 1; + unsigned int needs_async_data: 1; + unsigned int plug: 1; + short unsigned int async_size; + unsigned int work_flags; +}; + +enum io_mem_account { + ACCT_LOCKED = 0, + ACCT_PINNED = 1, +}; + +struct req_batch { + void *reqs[8]; + int to_free; + struct task_struct *task; + int task_refs; +}; + +struct io_poll_table { + struct poll_table_struct pt; + struct io_kiocb *req; + int error; +}; + +struct io_submit_link { + struct io_kiocb *head; + struct io_kiocb *last; +}; + +struct io_wait_queue { + struct wait_queue_entry wq; + struct io_ring_ctx *ctx; + unsigned int to_wait; + unsigned int nr_timeouts; +}; + +struct io_file_put { + struct list_head list; + struct file *file; +}; + +struct io_task_cancel { + struct task_struct *task; + struct files_struct *files; +}; + +struct io_wq_work_list { + struct io_wq_work_node *first; + struct io_wq_work_node *last; +}; + +enum { + IO_WORKER_F_UP = 1, + IO_WORKER_F_RUNNING = 2, + IO_WORKER_F_FREE = 4, + IO_WORKER_F_FIXED = 8, + IO_WORKER_F_BOUND = 16, +}; + +enum { + IO_WQ_BIT_EXIT = 0, + IO_WQ_BIT_ERROR = 1, +}; + +enum { + IO_WQE_FLAG_STALLED = 1, +}; + +struct io_wqe; + +struct io_worker { + refcount_t ref; + unsigned int flags; + struct hlist_nulls_node nulls_node; + struct list_head all_list; + struct task_struct *task; + struct io_wqe *wqe; + struct io_wq_work *cur_work; + spinlock_t lock; + struct callback_head rcu; + struct mm_struct *mm; + struct cgroup_subsys_state *blkcg_css; + const struct cred *cur_creds; + const struct cred *saved_creds; + struct files_struct *restore_files; + struct nsproxy *restore_nsproxy; + struct fs_struct *restore_fs; +}; + +struct io_wqe_acct { + unsigned int nr_workers; + unsigned int max_workers; + atomic_t nr_running; +}; + +struct io_wq___2; + +struct io_wqe { + struct { + raw_spinlock_t lock; + struct io_wq_work_list work_list; + long unsigned int hash_map; + unsigned int flags; + long: 32; + long: 64; + long: 64; + long: 64; + }; + int node; + struct io_wqe_acct acct[2]; + struct hlist_nulls_head free_list; + struct list_head all_list; + struct io_wq___2 *wq; + struct io_wq_work *hash_tail[64]; +}; + +enum { + IO_WQ_ACCT_BOUND = 0, + IO_WQ_ACCT_UNBOUND = 1, +}; + +struct io_wq___2 { + struct io_wqe **wqes; + long unsigned int state; + free_work_fn *free_work; + io_wq_work_fn *do_work; + struct task_struct *manager; + struct user_struct *user; + refcount_t refs; + struct completion done; + struct hlist_node cpuhp_node; + refcount_t use_refs; +}; + +struct io_cb_cancel_data { + work_cancel_fn *fn; + void *data; + int nr_running; + int nr_pending; + bool cancel_all; +}; + +struct iomap_ops { + int (*iomap_begin)(struct inode *, loff_t, loff_t, unsigned int, struct iomap *, struct iomap *); + int (*iomap_end)(struct inode *, loff_t, loff_t, ssize_t, unsigned int, struct iomap *); +}; + +typedef loff_t (*iomap_actor_t)(struct inode *, loff_t, loff_t, void *, struct iomap *, struct iomap *); + +struct trace_event_raw_dax_pmd_fault_class { + struct trace_entry ent; + long unsigned int ino; + long unsigned int vm_start; + long unsigned int vm_end; + long unsigned int vm_flags; + long unsigned int address; + long unsigned int pgoff; + long unsigned int max_pgoff; + dev_t dev; + unsigned int flags; + int result; + char __data[0]; +}; + +struct trace_event_raw_dax_pmd_load_hole_class { + struct trace_entry ent; + long unsigned int ino; + long unsigned int vm_flags; + long unsigned int address; + struct page *zero_page; + void *radix_entry; + dev_t dev; + char __data[0]; +}; + +struct trace_event_raw_dax_pmd_insert_mapping_class { + struct trace_entry ent; + long unsigned int ino; + long unsigned int vm_flags; + long unsigned int address; + long int length; + u64 pfn_val; + void *radix_entry; + dev_t dev; + int write; + char __data[0]; +}; + +struct trace_event_raw_dax_pte_fault_class { + struct trace_entry ent; + long unsigned int ino; + long unsigned int vm_flags; + long unsigned int address; + long unsigned int pgoff; + dev_t dev; + unsigned int flags; + int result; + char __data[0]; +}; + +struct trace_event_raw_dax_insert_mapping { + struct trace_entry ent; + long unsigned int ino; + long unsigned int vm_flags; + long unsigned int address; + void *radix_entry; + dev_t dev; + int write; + char __data[0]; +}; + +struct trace_event_raw_dax_writeback_range_class { + struct trace_entry ent; + long unsigned int ino; + long unsigned int start_index; + long unsigned int end_index; + dev_t dev; + char __data[0]; +}; + +struct trace_event_raw_dax_writeback_one { + struct trace_entry ent; + long unsigned int ino; + long unsigned int pgoff; + long unsigned int pglen; + dev_t dev; + char __data[0]; +}; + +struct trace_event_data_offsets_dax_pmd_fault_class {}; + +struct trace_event_data_offsets_dax_pmd_load_hole_class {}; + +struct trace_event_data_offsets_dax_pmd_insert_mapping_class {}; + +struct trace_event_data_offsets_dax_pte_fault_class {}; + +struct trace_event_data_offsets_dax_insert_mapping {}; + +struct trace_event_data_offsets_dax_writeback_range_class {}; + +struct trace_event_data_offsets_dax_writeback_one {}; + +typedef void (*btf_trace_dax_pmd_fault)(void *, struct inode *, struct vm_fault *, long unsigned int, int); + +typedef void (*btf_trace_dax_pmd_fault_done)(void *, struct inode *, struct vm_fault *, long unsigned int, int); + +typedef void (*btf_trace_dax_pmd_load_hole)(void *, struct inode *, struct vm_fault *, struct page *, void *); + +typedef void (*btf_trace_dax_pmd_load_hole_fallback)(void *, struct inode *, struct vm_fault *, struct page *, void *); + +typedef void (*btf_trace_dax_pmd_insert_mapping)(void *, struct inode *, struct vm_fault *, long int, pfn_t, void *); + +typedef void (*btf_trace_dax_pte_fault)(void *, struct inode *, struct vm_fault *, int); + +typedef void (*btf_trace_dax_pte_fault_done)(void *, struct inode *, struct vm_fault *, int); + +typedef void (*btf_trace_dax_load_hole)(void *, struct inode *, struct vm_fault *, int); + +typedef void (*btf_trace_dax_insert_pfn_mkwrite_no_entry)(void *, struct inode *, struct vm_fault *, int); + +typedef void (*btf_trace_dax_insert_pfn_mkwrite)(void *, struct inode *, struct vm_fault *, int); + +typedef void (*btf_trace_dax_insert_mapping)(void *, struct inode *, struct vm_fault *, void *); + +typedef void (*btf_trace_dax_writeback_range)(void *, struct inode *, long unsigned int, long unsigned int); + +typedef void (*btf_trace_dax_writeback_range_done)(void *, struct inode *, long unsigned int, long unsigned int); + +typedef void (*btf_trace_dax_writeback_one)(void *, struct inode *, long unsigned int, long unsigned int); + +struct exceptional_entry_key { + struct xarray *xa; + long unsigned int entry_start; +}; + +struct wait_exceptional_entry_queue { + wait_queue_entry_t wait; + struct exceptional_entry_key key; +}; + +struct fscrypt_blk_crypto_key; + +struct fscrypt_prepared_key { + struct crypto_skcipher *tfm; + struct fscrypt_blk_crypto_key *blk_key; +}; + +struct fscrypt_mode; + +struct fscrypt_direct_key; + +struct fscrypt_info { + struct fscrypt_prepared_key ci_enc_key; + bool ci_owns_key; + bool ci_inlinecrypt; + struct fscrypt_mode *ci_mode; + struct inode *ci_inode; + struct key *ci_master_key; + struct list_head ci_master_key_link; + struct fscrypt_direct_key *ci_direct_key; + siphash_key_t ci_dirhash_key; + bool ci_dirhash_key_initialized; + union fscrypt_policy ci_policy; + u8 ci_nonce[16]; + u32 ci_hashed_ino; +}; + +struct fscrypt_mode { + const char *friendly_name; + const char *cipher_str; + int keysize; + int ivsize; + int logged_impl_name; + enum blk_crypto_mode_num blk_crypto_mode; +}; + +typedef enum { + FS_DECRYPT = 0, + FS_ENCRYPT = 1, +} fscrypt_direction_t; + +union fscrypt_iv { + struct { + __le64 lblk_num; + u8 nonce[16]; + }; + u8 raw[32]; + __le64 dun[4]; +}; + +struct fscrypt_str { + unsigned char *name; + u32 len; +}; + +struct fscrypt_name { + const struct qstr *usr_fname; + struct fscrypt_str disk_name; + u32 hash; + u32 minor_hash; + struct fscrypt_str crypto_buf; + bool is_nokey_name; +}; + +struct fscrypt_nokey_name { + u32 dirhash[2]; + u8 bytes[149]; + u8 sha256[32]; +}; + +struct fscrypt_hkdf { + struct crypto_shash *hmac_tfm; +}; + +struct fscrypt_key_specifier { + __u32 type; + __u32 __reserved; + union { + __u8 __reserved[32]; + __u8 descriptor[8]; + __u8 identifier[16]; + } u; +}; + +struct fscrypt_symlink_data { + __le16 len; + char encrypted_path[1]; +} __attribute__((packed)); + +struct fscrypt_master_key_secret { + struct fscrypt_hkdf hkdf; + u32 size; + u8 raw[64]; +}; + +struct fscrypt_master_key { + struct fscrypt_master_key_secret mk_secret; + struct fscrypt_key_specifier mk_spec; + struct key *mk_users; + refcount_t mk_refcount; + struct list_head mk_decrypted_inodes; + spinlock_t mk_decrypted_inodes_lock; + struct fscrypt_prepared_key mk_direct_keys[10]; + struct fscrypt_prepared_key mk_iv_ino_lblk_64_keys[10]; + struct fscrypt_prepared_key mk_iv_ino_lblk_32_keys[10]; + siphash_key_t mk_ino_hash_key; + bool mk_ino_hash_key_initialized; +}; + +enum key_state { + KEY_IS_UNINSTANTIATED = 0, + KEY_IS_POSITIVE = 1, +}; + +struct fscrypt_provisioning_key_payload { + __u32 type; + __u32 __reserved; + __u8 raw[0]; +}; + +struct fscrypt_add_key_arg { + struct fscrypt_key_specifier key_spec; + __u32 raw_size; + __u32 key_id; + __u32 __reserved[8]; + __u8 raw[0]; +}; + +struct fscrypt_remove_key_arg { + struct fscrypt_key_specifier key_spec; + __u32 removal_status_flags; + __u32 __reserved[5]; +}; + +struct fscrypt_get_key_status_arg { + struct fscrypt_key_specifier key_spec; + __u32 __reserved[6]; + __u32 status; + __u32 status_flags; + __u32 user_count; + __u32 __out_reserved[13]; +}; + +struct fscrypt_context_v1 { + u8 version; + u8 contents_encryption_mode; + u8 filenames_encryption_mode; + u8 flags; + u8 master_key_descriptor[8]; + u8 nonce[16]; +}; + +struct fscrypt_context_v2 { + u8 version; + u8 contents_encryption_mode; + u8 filenames_encryption_mode; + u8 flags; + u8 __reserved[4]; + u8 master_key_identifier[16]; + u8 nonce[16]; +}; + +union fscrypt_context { + u8 version; + struct fscrypt_context_v1 v1; + struct fscrypt_context_v2 v2; +}; + +struct user_key_payload { + struct callback_head rcu; + short unsigned int datalen; + long: 48; + char data[0]; +}; + +struct fscrypt_key { + __u32 mode; + __u8 raw[64]; + __u32 size; +}; + +struct fscrypt_direct_key { + struct hlist_node dk_node; + refcount_t dk_refcount; + const struct fscrypt_mode *dk_mode; + struct fscrypt_prepared_key dk_key; + u8 dk_descriptor[8]; + u8 dk_raw[64]; +}; + +struct fscrypt_get_policy_ex_arg { + __u64 policy_size; + union { + __u8 version; + struct fscrypt_policy_v1 v1; + struct fscrypt_policy_v2 v2; + } policy; +}; + +struct fscrypt_dummy_policy { + const union fscrypt_policy *policy; +}; + +struct fscrypt_blk_crypto_key { + struct blk_crypto_key base; + int num_devs; + struct request_queue *devs[0]; +}; + +struct fsverity_hash_alg; + +struct merkle_tree_params { + struct fsverity_hash_alg *hash_alg; + const u8 *hashstate; + unsigned int digest_size; + unsigned int block_size; + unsigned int hashes_per_block; + unsigned int log_blocksize; + unsigned int log_arity; + unsigned int num_levels; + u64 tree_size; + long unsigned int level0_blocks; + u64 level_start[8]; +}; + +struct fsverity_info { + struct merkle_tree_params tree_params; + u8 root_hash[64]; + u8 file_digest[64]; + const struct inode *inode; +}; + +struct fsverity_enable_arg { + __u32 version; + __u32 hash_algorithm; + __u32 block_size; + __u32 salt_size; + __u64 salt_ptr; + __u32 sig_size; + __u32 __reserved1; + __u64 sig_ptr; + __u64 __reserved2[11]; +}; + +struct fsverity_descriptor { + __u8 version; + __u8 hash_algorithm; + __u8 log_blocksize; + __u8 salt_size; + __le32 sig_size; + __le64 data_size; + __u8 root_hash[64]; + __u8 salt[32]; + __u8 __reserved[144]; + __u8 signature[0]; +}; + +struct crypto_ahash; + +struct fsverity_hash_alg { + struct crypto_ahash *tfm; + const char *name; + unsigned int digest_size; + unsigned int block_size; + mempool_t req_pool; +}; + +struct ahash_request; + +struct crypto_ahash { + int (*init)(struct ahash_request *); + int (*update)(struct ahash_request *); + int (*final)(struct ahash_request *); + int (*finup)(struct ahash_request *); + int (*digest)(struct ahash_request *); + int (*export)(struct ahash_request *, void *); + int (*import)(struct ahash_request *, const void *); + int (*setkey)(struct crypto_ahash *, const u8 *, unsigned int); + unsigned int reqsize; + struct crypto_tfm base; +}; + +struct ahash_request { + struct crypto_async_request base; + unsigned int nbytes; + struct scatterlist *src; + u8 *result; + void *priv; + void *__ctx[0]; +}; + +struct hash_alg_common { + unsigned int digestsize; + unsigned int statesize; + struct crypto_alg base; +}; + +struct fsverity_digest { + __u16 digest_algorithm; + __u16 digest_size; + __u8 digest[0]; +}; + +struct flock64 { + short int l_type; + short int l_whence; + __kernel_loff_t l_start; + __kernel_loff_t l_len; + __kernel_pid_t l_pid; +}; + +struct trace_event_raw_locks_get_lock_context { + struct trace_entry ent; + long unsigned int i_ino; + dev_t s_dev; + unsigned char type; + struct file_lock_context *ctx; + char __data[0]; +}; + +struct trace_event_raw_filelock_lock { + struct trace_entry ent; + struct file_lock *fl; + long unsigned int i_ino; + dev_t s_dev; + struct file_lock *fl_blocker; + fl_owner_t fl_owner; + unsigned int fl_pid; + unsigned int fl_flags; + unsigned char fl_type; + loff_t fl_start; + loff_t fl_end; + int ret; + char __data[0]; +}; + +struct trace_event_raw_filelock_lease { + struct trace_entry ent; + struct file_lock *fl; + long unsigned int i_ino; + dev_t s_dev; + struct file_lock *fl_blocker; + fl_owner_t fl_owner; + unsigned int fl_flags; + unsigned char fl_type; + long unsigned int fl_break_time; + long unsigned int fl_downgrade_time; + char __data[0]; +}; + +struct trace_event_raw_generic_add_lease { + struct trace_entry ent; + long unsigned int i_ino; + int wcount; + int rcount; + int icount; + dev_t s_dev; + fl_owner_t fl_owner; + unsigned int fl_flags; + unsigned char fl_type; + char __data[0]; +}; + +struct trace_event_raw_leases_conflict { + struct trace_entry ent; + void *lease; + void *breaker; + unsigned int l_fl_flags; + unsigned int b_fl_flags; + unsigned char l_fl_type; + unsigned char b_fl_type; + bool conflict; + char __data[0]; +}; + +struct trace_event_data_offsets_locks_get_lock_context {}; + +struct trace_event_data_offsets_filelock_lock {}; + +struct trace_event_data_offsets_filelock_lease {}; + +struct trace_event_data_offsets_generic_add_lease {}; + +struct trace_event_data_offsets_leases_conflict {}; + +typedef void (*btf_trace_locks_get_lock_context)(void *, struct inode *, int, struct file_lock_context *); + +typedef void (*btf_trace_posix_lock_inode)(void *, struct inode *, struct file_lock *, int); + +typedef void (*btf_trace_fcntl_setlk)(void *, struct inode *, struct file_lock *, int); + +typedef void (*btf_trace_locks_remove_posix)(void *, struct inode *, struct file_lock *, int); + +typedef void (*btf_trace_flock_lock_inode)(void *, struct inode *, struct file_lock *, int); + +typedef void (*btf_trace_break_lease_noblock)(void *, struct inode *, struct file_lock *); + +typedef void (*btf_trace_break_lease_block)(void *, struct inode *, struct file_lock *); + +typedef void (*btf_trace_break_lease_unblock)(void *, struct inode *, struct file_lock *); + +typedef void (*btf_trace_generic_delete_lease)(void *, struct inode *, struct file_lock *); + +typedef void (*btf_trace_time_out_leases)(void *, struct inode *, struct file_lock *); + +typedef void (*btf_trace_generic_add_lease)(void *, struct inode *, struct file_lock *); + +typedef void (*btf_trace_leases_conflict)(void *, bool, struct file_lock *, struct file_lock *); + +struct file_lock_list_struct { + spinlock_t lock; + struct hlist_head hlist; +}; + +struct locks_iterator { + int li_cpu; + loff_t li_pos; +}; + +typedef unsigned int __kernel_uid_t; + +typedef unsigned int __kernel_gid_t; + +struct elf_prpsinfo { + char pr_state; + char pr_sname; + char pr_zomb; + char pr_nice; + long unsigned int pr_flag; + __kernel_uid_t pr_uid; + __kernel_gid_t pr_gid; + pid_t pr_pid; + pid_t pr_ppid; + pid_t pr_pgrp; + pid_t pr_sid; + char pr_fname[16]; + char pr_psargs[80]; +}; + +struct core_vma_metadata { + long unsigned int start; + long unsigned int end; + long unsigned int flags; + long unsigned int dump_size; +}; + +struct arch_elf_state {}; + +struct memelfnote { + const char *name; + int type; + unsigned int datasz; + void *data; +}; + +struct elf_thread_core_info { + struct elf_thread_core_info *next; + struct task_struct *task; + struct elf_prstatus prstatus; + struct memelfnote notes[0]; +}; + +struct elf_note_info { + struct elf_thread_core_info *thread; + struct memelfnote psinfo; + struct memelfnote signote; + struct memelfnote auxv; + struct memelfnote files; + siginfo_t csigdata; + size_t size; + int thread_notes; +}; + +struct user_regs_struct { + long unsigned int r15; + long unsigned int r14; + long unsigned int r13; + long unsigned int r12; + long unsigned int bp; + long unsigned int bx; + long unsigned int r11; + long unsigned int r10; + long unsigned int r9; + long unsigned int r8; + long unsigned int ax; + long unsigned int cx; + long unsigned int dx; + long unsigned int si; + long unsigned int di; + long unsigned int orig_ax; + long unsigned int ip; + long unsigned int cs; + long unsigned int flags; + long unsigned int sp; + long unsigned int ss; + long unsigned int fs_base; + long unsigned int gs_base; + long unsigned int ds; + long unsigned int es; + long unsigned int fs; + long unsigned int gs; +}; + +struct elf32_shdr { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +}; + +typedef struct user_regs_struct compat_elf_gregset_t; + +struct compat_elf_siginfo { + compat_int_t si_signo; + compat_int_t si_code; + compat_int_t si_errno; +}; + +struct compat_elf_prstatus { + struct compat_elf_siginfo pr_info; + short int pr_cursig; + compat_ulong_t pr_sigpend; + compat_ulong_t pr_sighold; + compat_pid_t pr_pid; + compat_pid_t pr_ppid; + compat_pid_t pr_pgrp; + compat_pid_t pr_sid; + struct old_timeval32 pr_utime; + struct old_timeval32 pr_stime; + struct old_timeval32 pr_cutime; + struct old_timeval32 pr_cstime; + compat_elf_gregset_t pr_reg; + compat_int_t pr_fpvalid; +}; + +struct compat_elf_prpsinfo { + char pr_state; + char pr_sname; + char pr_zomb; + char pr_nice; + compat_ulong_t pr_flag; + __compat_uid_t pr_uid; + __compat_gid_t pr_gid; + compat_pid_t pr_pid; + compat_pid_t pr_ppid; + compat_pid_t pr_pgrp; + compat_pid_t pr_sid; + char pr_fname[16]; + char pr_psargs[80]; +}; + +struct elf_thread_core_info___2 { + struct elf_thread_core_info___2 *next; + struct task_struct *task; + struct compat_elf_prstatus prstatus; + struct memelfnote notes[0]; +}; + +struct elf_note_info___2 { + struct elf_thread_core_info___2 *thread; + struct memelfnote psinfo; + struct memelfnote signote; + struct memelfnote auxv; + struct memelfnote files; + compat_siginfo_t csigdata; + size_t size; + int thread_notes; +}; + +struct mb_cache_entry { + struct list_head e_list; + struct hlist_bl_node e_hash_list; + atomic_t e_refcnt; + u32 e_key; + u32 e_referenced: 1; + u32 e_reusable: 1; + u64 e_value; +}; + +struct mb_cache { + struct hlist_bl_head *c_hash; + int c_bucket_bits; + long unsigned int c_max_entries; + spinlock_t c_list_lock; + struct list_head c_list; + long unsigned int c_entry_count; + struct shrinker c_shrink; + struct work_struct c_shrink_work; +}; + +struct posix_acl_xattr_entry { + __le16 e_tag; + __le16 e_perm; + __le32 e_id; +}; + +struct posix_acl_xattr_header { + __le32 a_version; +}; + +struct core_name { + char *corename; + int used; + int size; +}; + +struct trace_event_raw_iomap_readpage_class { + struct trace_entry ent; + dev_t dev; + u64 ino; + int nr_pages; + char __data[0]; +}; + +struct trace_event_raw_iomap_range_class { + struct trace_entry ent; + dev_t dev; + u64 ino; + loff_t size; + long unsigned int offset; + unsigned int length; + char __data[0]; +}; + +struct trace_event_raw_iomap_class { + struct trace_entry ent; + dev_t dev; + u64 ino; + u64 addr; + loff_t offset; + u64 length; + u16 type; + u16 flags; + dev_t bdev; + char __data[0]; +}; + +struct trace_event_raw_iomap_apply { + struct trace_entry ent; + dev_t dev; + u64 ino; + loff_t pos; + loff_t length; + unsigned int flags; + const void *ops; + void *actor; + long unsigned int caller; + char __data[0]; +}; + +struct trace_event_data_offsets_iomap_readpage_class {}; + +struct trace_event_data_offsets_iomap_range_class {}; + +struct trace_event_data_offsets_iomap_class {}; + +struct trace_event_data_offsets_iomap_apply {}; + +typedef void (*btf_trace_iomap_readpage)(void *, struct inode *, int); + +typedef void (*btf_trace_iomap_readahead)(void *, struct inode *, int); + +typedef void (*btf_trace_iomap_writepage)(void *, struct inode *, long unsigned int, unsigned int); + +typedef void (*btf_trace_iomap_releasepage)(void *, struct inode *, long unsigned int, unsigned int); + +typedef void (*btf_trace_iomap_invalidatepage)(void *, struct inode *, long unsigned int, unsigned int); + +typedef void (*btf_trace_iomap_dio_invalidate_fail)(void *, struct inode *, long unsigned int, unsigned int); + +typedef void (*btf_trace_iomap_apply_dstmap)(void *, struct inode *, struct iomap *); + +typedef void (*btf_trace_iomap_apply_srcmap)(void *, struct inode *, struct iomap *); + +typedef void (*btf_trace_iomap_apply)(void *, struct inode *, loff_t, loff_t, unsigned int, const void *, void *, long unsigned int); + +struct iomap_ioend { + struct list_head io_list; + u16 io_type; + u16 io_flags; + struct inode *io_inode; + size_t io_size; + loff_t io_offset; + void *io_private; + struct bio *io_bio; + struct bio io_inline_bio; +}; + +struct iomap_writepage_ctx; + +struct iomap_writeback_ops { + int (*map_blocks)(struct iomap_writepage_ctx *, struct inode *, loff_t); + int (*prepare_ioend)(struct iomap_ioend *, int); + void (*discard_page)(struct page *, loff_t); +}; + +struct iomap_writepage_ctx { + struct iomap iomap; + struct iomap_ioend *ioend; + const struct iomap_writeback_ops *ops; +}; + +struct iomap_page { + atomic_t read_bytes_pending; + atomic_t write_bytes_pending; + spinlock_t uptodate_lock; + long unsigned int uptodate[0]; +}; + +struct iomap_readpage_ctx { + struct page *cur_page; + bool cur_page_in_bio; + struct bio *bio; + struct readahead_control *rac; +}; + +enum { + IOMAP_WRITE_F_UNSHARE = 1, +}; + +struct iomap_dio_ops { + int (*end_io)(struct kiocb *, ssize_t, int, unsigned int); + blk_qc_t (*submit_io)(struct inode *, struct iomap *, struct bio *, loff_t); +}; + +struct iomap_dio { + struct kiocb *iocb; + const struct iomap_dio_ops *dops; + loff_t i_size; + loff_t size; + atomic_t ref; + unsigned int flags; + int error; + bool wait_for_completion; + union { + struct { + struct iov_iter *iter; + struct task_struct *waiter; + struct request_queue *last_queue; + blk_qc_t cookie; + } submit; + struct { + struct work_struct work; + } aio; + }; +}; + +struct fiemap_ctx { + struct fiemap_extent_info *fi; + struct iomap prev; +}; + +struct iomap_swapfile_info { + struct iomap iomap; + struct swap_info_struct *sis; + uint64_t lowest_ppage; + uint64_t highest_ppage; + long unsigned int nr_pages; + int nr_extents; +}; + +enum { + QIF_BLIMITS_B = 0, + QIF_SPACE_B = 1, + QIF_ILIMITS_B = 2, + QIF_INODES_B = 3, + QIF_BTIME_B = 4, + QIF_ITIME_B = 5, +}; + +typedef __kernel_uid32_t qid_t; + +enum { + DQF_INFO_DIRTY_B = 17, +}; + +struct dqstats { + long unsigned int stat[8]; + struct percpu_counter counter[8]; +}; + +enum { + _DQUOT_USAGE_ENABLED = 0, + _DQUOT_LIMITS_ENABLED = 1, + _DQUOT_SUSPENDED = 2, + _DQUOT_STATE_FLAGS = 3, +}; + +struct quota_module_name { + int qm_fmt_id; + char *qm_mod_name; +}; + +struct dquot_warn { + struct super_block *w_sb; + struct kqid w_dq_id; + short int w_type; +}; + +struct qtree_fmt_operations { + void (*mem2disk_dqblk)(void *, struct dquot *); + void (*disk2mem_dqblk)(struct dquot *, void *); + int (*is_id)(void *, struct dquot *); +}; + +struct qtree_mem_dqinfo { + struct super_block *dqi_sb; + int dqi_type; + unsigned int dqi_blocks; + unsigned int dqi_free_blk; + unsigned int dqi_free_entry; + unsigned int dqi_blocksize_bits; + unsigned int dqi_entry_size; + unsigned int dqi_usable_bs; + unsigned int dqi_qtree_depth; + const struct qtree_fmt_operations *dqi_ops; +}; + +struct v2_disk_dqheader { + __le32 dqh_magic; + __le32 dqh_version; +}; + +struct v2r0_disk_dqblk { + __le32 dqb_id; + __le32 dqb_ihardlimit; + __le32 dqb_isoftlimit; + __le32 dqb_curinodes; + __le32 dqb_bhardlimit; + __le32 dqb_bsoftlimit; + __le64 dqb_curspace; + __le64 dqb_btime; + __le64 dqb_itime; +}; + +struct v2r1_disk_dqblk { + __le32 dqb_id; + __le32 dqb_pad; + __le64 dqb_ihardlimit; + __le64 dqb_isoftlimit; + __le64 dqb_curinodes; + __le64 dqb_bhardlimit; + __le64 dqb_bsoftlimit; + __le64 dqb_curspace; + __le64 dqb_btime; + __le64 dqb_itime; +}; + +struct v2_disk_dqinfo { + __le32 dqi_bgrace; + __le32 dqi_igrace; + __le32 dqi_flags; + __le32 dqi_blocks; + __le32 dqi_free_blk; + __le32 dqi_free_entry; +}; + +struct qt_disk_dqdbheader { + __le32 dqdh_next_free; + __le32 dqdh_prev_free; + __le16 dqdh_entries; + __le16 dqdh_pad1; + __le32 dqdh_pad2; +}; + +struct fs_disk_quota { + __s8 d_version; + __s8 d_flags; + __u16 d_fieldmask; + __u32 d_id; + __u64 d_blk_hardlimit; + __u64 d_blk_softlimit; + __u64 d_ino_hardlimit; + __u64 d_ino_softlimit; + __u64 d_bcount; + __u64 d_icount; + __s32 d_itimer; + __s32 d_btimer; + __u16 d_iwarns; + __u16 d_bwarns; + __s8 d_itimer_hi; + __s8 d_btimer_hi; + __s8 d_rtbtimer_hi; + __s8 d_padding2; + __u64 d_rtb_hardlimit; + __u64 d_rtb_softlimit; + __u64 d_rtbcount; + __s32 d_rtbtimer; + __u16 d_rtbwarns; + __s16 d_padding3; + char d_padding4[8]; +}; + +struct fs_qfilestat { + __u64 qfs_ino; + __u64 qfs_nblks; + __u32 qfs_nextents; +}; + +typedef struct fs_qfilestat fs_qfilestat_t; + +struct fs_quota_stat { + __s8 qs_version; + __u16 qs_flags; + __s8 qs_pad; + fs_qfilestat_t qs_uquota; + fs_qfilestat_t qs_gquota; + __u32 qs_incoredqs; + __s32 qs_btimelimit; + __s32 qs_itimelimit; + __s32 qs_rtbtimelimit; + __u16 qs_bwarnlimit; + __u16 qs_iwarnlimit; +}; + +struct fs_qfilestatv { + __u64 qfs_ino; + __u64 qfs_nblks; + __u32 qfs_nextents; + __u32 qfs_pad; +}; + +struct fs_quota_statv { + __s8 qs_version; + __u8 qs_pad1; + __u16 qs_flags; + __u32 qs_incoredqs; + struct fs_qfilestatv qs_uquota; + struct fs_qfilestatv qs_gquota; + struct fs_qfilestatv qs_pquota; + __s32 qs_btimelimit; + __s32 qs_itimelimit; + __s32 qs_rtbtimelimit; + __u16 qs_bwarnlimit; + __u16 qs_iwarnlimit; + __u64 qs_pad2[8]; +}; + +struct if_dqblk { + __u64 dqb_bhardlimit; + __u64 dqb_bsoftlimit; + __u64 dqb_curspace; + __u64 dqb_ihardlimit; + __u64 dqb_isoftlimit; + __u64 dqb_curinodes; + __u64 dqb_btime; + __u64 dqb_itime; + __u32 dqb_valid; +}; + +struct if_nextdqblk { + __u64 dqb_bhardlimit; + __u64 dqb_bsoftlimit; + __u64 dqb_curspace; + __u64 dqb_ihardlimit; + __u64 dqb_isoftlimit; + __u64 dqb_curinodes; + __u64 dqb_btime; + __u64 dqb_itime; + __u32 dqb_valid; + __u32 dqb_id; +}; + +struct if_dqinfo { + __u64 dqi_bgrace; + __u64 dqi_igrace; + __u32 dqi_flags; + __u32 dqi_valid; +}; + +struct compat_if_dqblk { + compat_u64 dqb_bhardlimit; + compat_u64 dqb_bsoftlimit; + compat_u64 dqb_curspace; + compat_u64 dqb_ihardlimit; + compat_u64 dqb_isoftlimit; + compat_u64 dqb_curinodes; + compat_u64 dqb_btime; + compat_u64 dqb_itime; + compat_uint_t dqb_valid; +} __attribute__((packed)); + +struct compat_fs_qfilestat { + compat_u64 dqb_bhardlimit; + compat_u64 qfs_nblks; + compat_uint_t qfs_nextents; +} __attribute__((packed)); + +struct compat_fs_quota_stat { + __s8 qs_version; + char: 8; + __u16 qs_flags; + __s8 qs_pad; + int: 24; + struct compat_fs_qfilestat qs_uquota; + struct compat_fs_qfilestat qs_gquota; + compat_uint_t qs_incoredqs; + compat_int_t qs_btimelimit; + compat_int_t qs_itimelimit; + compat_int_t qs_rtbtimelimit; + __u16 qs_bwarnlimit; + __u16 qs_iwarnlimit; +} __attribute__((packed)); + +enum { + QUOTA_NL_C_UNSPEC = 0, + QUOTA_NL_C_WARNING = 1, + __QUOTA_NL_C_MAX = 2, +}; + +enum { + QUOTA_NL_A_UNSPEC = 0, + QUOTA_NL_A_QTYPE = 1, + QUOTA_NL_A_EXCESS_ID = 2, + QUOTA_NL_A_WARNING = 3, + QUOTA_NL_A_DEV_MAJOR = 4, + QUOTA_NL_A_DEV_MINOR = 5, + QUOTA_NL_A_CAUSED_ID = 6, + QUOTA_NL_A_PAD = 7, + __QUOTA_NL_A_MAX = 8, +}; + +struct proc_maps_private { + struct inode *inode; + struct task_struct *task; + struct mm_struct *mm; + struct vm_area_struct *tail_vma; + struct mempolicy *task_mempolicy; +}; + +struct mem_size_stats { + long unsigned int resident; + long unsigned int shared_clean; + long unsigned int shared_dirty; + long unsigned int private_clean; + long unsigned int private_dirty; + long unsigned int referenced; + long unsigned int anonymous; + long unsigned int lazyfree; + long unsigned int anonymous_thp; + long unsigned int shmem_thp; + long unsigned int file_thp; + long unsigned int swap; + long unsigned int shared_hugetlb; + long unsigned int private_hugetlb; + u64 pss; + u64 pss_anon; + u64 pss_file; + u64 pss_shmem; + u64 pss_locked; + u64 swap_pss; + bool check_shmem_swap; +}; + +enum clear_refs_types { + CLEAR_REFS_ALL = 1, + CLEAR_REFS_ANON = 2, + CLEAR_REFS_MAPPED = 3, + CLEAR_REFS_SOFT_DIRTY = 4, + CLEAR_REFS_MM_HIWATER_RSS = 5, + CLEAR_REFS_LAST = 6, +}; + +struct clear_refs_private { + enum clear_refs_types type; +}; + +typedef struct { + u64 pme; +} pagemap_entry_t; + +struct pagemapread { + int pos; + int len; + pagemap_entry_t *buffer; + bool show_pfn; +}; + +struct numa_maps { + long unsigned int pages; + long unsigned int anon; + long unsigned int active; + long unsigned int writeback; + long unsigned int mapcount_max; + long unsigned int dirty; + long unsigned int swapcache; + long unsigned int node[1024]; +}; + +struct numa_maps_private { + struct proc_maps_private proc_maps; + struct numa_maps md; +}; + +struct pde_opener { + struct list_head lh; + struct file *file; + bool closing; + struct completion *c; +}; + +enum { + BIAS = 2147483648, +}; + +struct proc_fs_context { + struct pid_namespace *pid_ns; + unsigned int mask; + enum proc_hidepid hidepid; + int gid; + enum proc_pidonly pidonly; +}; + +enum proc_param { + Opt_gid___2 = 0, + Opt_hidepid = 1, + Opt_subset = 2, +}; + +struct genradix_root; + +struct __genradix { + struct genradix_root *root; +}; + +struct syscall_info { + __u64 sp; + struct seccomp_data data; +}; + +typedef struct dentry *instantiate_t(struct dentry *, struct task_struct *, const void *); + +struct pid_entry { + const char *name; + unsigned int len; + umode_t mode; + const struct inode_operations *iop; + const struct file_operations *fop; + union proc_op op; +}; + +struct limit_names { + const char *name; + const char *unit; +}; + +struct map_files_info { + long unsigned int start; + long unsigned int end; + fmode_t mode; +}; + +struct timers_private { + struct pid *pid; + struct task_struct *task; + struct sighand_struct *sighand; + struct pid_namespace *ns; + long unsigned int flags; +}; + +struct tgid_iter { + unsigned int tgid; + struct task_struct *task; +}; + +struct fd_data { + fmode_t mode; + unsigned int fd; +}; + +struct sysctl_alias { + const char *kernel_param; + const char *sysctl_param; +}; + +struct seq_net_private { + struct net *net; +}; + +struct bpf_iter_aux_info___2; + +struct vmcore { + struct list_head list; + long long unsigned int paddr; + long long unsigned int size; + loff_t offset; +}; + +struct vmcoredd_node { + struct list_head list; + void *buf; + unsigned int size; +}; + +typedef struct elf64_note Elf64_Nhdr; + +struct vmcoredd_header { + __u32 n_namesz; + __u32 n_descsz; + __u32 n_type; + __u8 name[8]; + __u8 dump_name[44]; +}; + +struct vmcoredd_data { + char dump_name[44]; + unsigned int size; + int (*vmcoredd_callback)(struct vmcoredd_data *, void *); +}; + +struct kernfs_iattrs { + kuid_t ia_uid; + kgid_t ia_gid; + struct timespec64 ia_atime; + struct timespec64 ia_mtime; + struct timespec64 ia_ctime; + struct simple_xattrs xattrs; + atomic_t nr_user_xattrs; + atomic_t user_xattr_size; +}; + +struct kernfs_super_info { + struct super_block *sb; + struct kernfs_root *root; + const void *ns; + struct list_head node; +}; + +enum kernfs_node_flag { + KERNFS_ACTIVATED = 16, + KERNFS_NS = 32, + KERNFS_HAS_SEQ_SHOW = 64, + KERNFS_HAS_MMAP = 128, + KERNFS_LOCKDEP = 256, + KERNFS_SUICIDAL = 1024, + KERNFS_SUICIDED = 2048, + KERNFS_EMPTY_DIR = 4096, + KERNFS_HAS_RELEASE = 8192, +}; + +struct kernfs_open_node { + atomic_t refcnt; + atomic_t event; + wait_queue_head_t poll; + struct list_head files; +}; + +struct config_group; + +struct config_item_type; + +struct config_item { + char *ci_name; + char ci_namebuf[20]; + struct kref ci_kref; + struct list_head ci_entry; + struct config_item *ci_parent; + struct config_group *ci_group; + const struct config_item_type *ci_type; + struct dentry *ci_dentry; +}; + +struct configfs_subsystem; + +struct config_group { + struct config_item cg_item; + struct list_head cg_children; + struct configfs_subsystem *cg_subsys; + struct list_head default_groups; + struct list_head group_entry; +}; + +struct configfs_item_operations; + +struct configfs_group_operations; + +struct configfs_attribute; + +struct configfs_bin_attribute; + +struct config_item_type { + struct module *ct_owner; + struct configfs_item_operations *ct_item_ops; + struct configfs_group_operations *ct_group_ops; + struct configfs_attribute **ct_attrs; + struct configfs_bin_attribute **ct_bin_attrs; +}; + +struct configfs_item_operations { + void (*release)(struct config_item *); + int (*allow_link)(struct config_item *, struct config_item *); + void (*drop_link)(struct config_item *, struct config_item *); +}; + +struct configfs_group_operations { + struct config_item * (*make_item)(struct config_group *, const char *); + struct config_group * (*make_group)(struct config_group *, const char *); + int (*commit_item)(struct config_item *); + void (*disconnect_notify)(struct config_group *, struct config_item *); + void (*drop_item)(struct config_group *, struct config_item *); +}; + +struct configfs_attribute { + const char *ca_name; + struct module *ca_owner; + umode_t ca_mode; + ssize_t (*show)(struct config_item *, char *); + ssize_t (*store)(struct config_item *, const char *, size_t); +}; + +struct configfs_bin_attribute { + struct configfs_attribute cb_attr; + void *cb_private; + size_t cb_max_size; + ssize_t (*read)(struct config_item *, void *, size_t); + ssize_t (*write)(struct config_item *, const void *, size_t); +}; + +struct configfs_subsystem { + struct config_group su_group; + struct mutex su_mutex; +}; + +struct configfs_fragment { + atomic_t frag_count; + struct rw_semaphore frag_sem; + bool frag_dead; +}; + +struct configfs_dirent { + atomic_t s_count; + int s_dependent_count; + struct list_head s_sibling; + struct list_head s_children; + int s_links; + void *s_element; + int s_type; + umode_t s_mode; + struct dentry *s_dentry; + struct iattr *s_iattr; + struct configfs_fragment *s_frag; +}; + +struct configfs_buffer { + size_t count; + loff_t pos; + char *page; + struct configfs_item_operations *ops; + struct mutex mutex; + int needs_read_fill; + bool read_in_progress; + bool write_in_progress; + char *bin_buffer; + int bin_buffer_size; + int cb_max_size; + struct config_item *item; + struct module *owner; + union { + struct configfs_attribute *attr; + struct configfs_bin_attribute *bin_attr; + }; +}; + +struct pts_mount_opts { + int setuid; + int setgid; + kuid_t uid; + kgid_t gid; + umode_t mode; + umode_t ptmxmode; + int reserve; + int max; +}; + +enum { + Opt_uid___2 = 0, + Opt_gid___3 = 1, + Opt_mode___2 = 2, + Opt_ptmxmode = 3, + Opt_newinstance = 4, + Opt_max = 5, + Opt_err = 6, +}; + +struct pts_fs_info { + struct ida allocated_ptys; + struct pts_mount_opts mount_opts; + struct super_block *sb; + struct dentry *ptmx_dentry; +}; + +struct dcookie_struct { + struct path path; + struct list_head hash_list; +}; + +struct dcookie_user { + struct list_head next; +}; + +typedef unsigned int tid_t; + +struct transaction_chp_stats_s { + long unsigned int cs_chp_time; + __u32 cs_forced_to_close; + __u32 cs_written; + __u32 cs_dropped; +}; + +struct journal_s; + +typedef struct journal_s journal_t; + +struct journal_head; + +struct transaction_s; + +typedef struct transaction_s transaction_t; + +struct transaction_s { + journal_t *t_journal; + tid_t t_tid; + enum { + T_RUNNING = 0, + T_LOCKED = 1, + T_SWITCH = 2, + T_FLUSH = 3, + T_COMMIT = 4, + T_COMMIT_DFLUSH = 5, + T_COMMIT_JFLUSH = 6, + T_COMMIT_CALLBACK = 7, + T_FINISHED = 8, + } t_state; + long unsigned int t_log_start; + int t_nr_buffers; + struct journal_head *t_reserved_list; + struct journal_head *t_buffers; + struct journal_head *t_forget; + struct journal_head *t_checkpoint_list; + struct journal_head *t_checkpoint_io_list; + struct journal_head *t_shadow_list; + struct list_head t_inode_list; + spinlock_t t_handle_lock; + long unsigned int t_max_wait; + long unsigned int t_start; + long unsigned int t_requested; + struct transaction_chp_stats_s t_chp_stats; + atomic_t t_updates; + atomic_t t_outstanding_credits; + atomic_t t_outstanding_revokes; + atomic_t t_handle_count; + transaction_t *t_cpnext; + transaction_t *t_cpprev; + long unsigned int t_expires; + ktime_t t_start_time; + unsigned int t_synchronous_commit: 1; + int t_need_data_flush; + struct list_head t_private_list; +}; + +struct jbd2_buffer_trigger_type; + +struct journal_head { + struct buffer_head *b_bh; + spinlock_t b_state_lock; + int b_jcount; + unsigned int b_jlist; + unsigned int b_modified; + char *b_frozen_data; + char *b_committed_data; + transaction_t *b_transaction; + transaction_t *b_next_transaction; + struct journal_head *b_tnext; + struct journal_head *b_tprev; + transaction_t *b_cp_transaction; + struct journal_head *b_cpnext; + struct journal_head *b_cpprev; + struct jbd2_buffer_trigger_type *b_triggers; + struct jbd2_buffer_trigger_type *b_frozen_triggers; +}; + +struct jbd2_buffer_trigger_type { + void (*t_frozen)(struct jbd2_buffer_trigger_type *, struct buffer_head *, void *, size_t); + void (*t_abort)(struct jbd2_buffer_trigger_type *, struct buffer_head *); +}; + +struct jbd2_journal_handle; + +typedef struct jbd2_journal_handle handle_t; + +struct jbd2_journal_handle { + union { + transaction_t *h_transaction; + journal_t *h_journal; + }; + handle_t *h_rsv_handle; + int h_total_credits; + int h_revoke_credits; + int h_revoke_credits_requested; + int h_ref; + int h_err; + unsigned int h_sync: 1; + unsigned int h_jdata: 1; + unsigned int h_reserved: 1; + unsigned int h_aborted: 1; + unsigned int h_type: 8; + unsigned int h_line_no: 16; + long unsigned int h_start_jiffies; + unsigned int h_requested_credits; + unsigned int saved_alloc_context; +}; + +struct transaction_run_stats_s { + long unsigned int rs_wait; + long unsigned int rs_request_delay; + long unsigned int rs_running; + long unsigned int rs_locked; + long unsigned int rs_flushing; + long unsigned int rs_logging; + __u32 rs_handle_count; + __u32 rs_blocks; + __u32 rs_blocks_logged; +}; + +struct transaction_stats_s { + long unsigned int ts_tid; + long unsigned int ts_requested; + struct transaction_run_stats_s run; +}; + +enum passtype { + PASS_SCAN = 0, + PASS_REVOKE = 1, + PASS_REPLAY = 2, +}; + +struct journal_superblock_s; + +typedef struct journal_superblock_s journal_superblock_t; + +struct jbd2_revoke_table_s; + +struct jbd2_inode; + +struct journal_s { + long unsigned int j_flags; + int j_errno; + struct mutex j_abort_mutex; + struct buffer_head *j_sb_buffer; + journal_superblock_t *j_superblock; + int j_format_version; + rwlock_t j_state_lock; + int j_barrier_count; + struct mutex j_barrier; + transaction_t *j_running_transaction; + transaction_t *j_committing_transaction; + transaction_t *j_checkpoint_transactions; + wait_queue_head_t j_wait_transaction_locked; + wait_queue_head_t j_wait_done_commit; + wait_queue_head_t j_wait_commit; + wait_queue_head_t j_wait_updates; + wait_queue_head_t j_wait_reserved; + wait_queue_head_t j_fc_wait; + struct mutex j_checkpoint_mutex; + struct buffer_head *j_chkpt_bhs[64]; + long unsigned int j_head; + long unsigned int j_tail; + long unsigned int j_free; + long unsigned int j_first; + long unsigned int j_last; + long unsigned int j_fc_first; + long unsigned int j_fc_off; + long unsigned int j_fc_last; + struct block_device *j_dev; + int j_blocksize; + long long unsigned int j_blk_offset; + char j_devname[56]; + struct block_device *j_fs_dev; + unsigned int j_total_len; + atomic_t j_reserved_credits; + spinlock_t j_list_lock; + struct inode *j_inode; + tid_t j_tail_sequence; + tid_t j_transaction_sequence; + tid_t j_commit_sequence; + tid_t j_commit_request; + __u8 j_uuid[16]; + struct task_struct *j_task; + int j_max_transaction_buffers; + int j_revoke_records_per_block; + long unsigned int j_commit_interval; + struct timer_list j_commit_timer; + spinlock_t j_revoke_lock; + struct jbd2_revoke_table_s *j_revoke; + struct jbd2_revoke_table_s *j_revoke_table[2]; + struct buffer_head **j_wbuf; + struct buffer_head **j_fc_wbuf; + int j_wbufsize; + int j_fc_wbufsize; + pid_t j_last_sync_writer; + u64 j_average_commit_time; + u32 j_min_batch_time; + u32 j_max_batch_time; + void (*j_commit_callback)(journal_t *, transaction_t *); + int (*j_submit_inode_data_buffers)(struct jbd2_inode *); + int (*j_finish_inode_data_buffers)(struct jbd2_inode *); + spinlock_t j_history_lock; + struct proc_dir_entry *j_proc_entry; + struct transaction_stats_s j_stats; + unsigned int j_failed_commit; + void *j_private; + struct crypto_shash *j_chksum_driver; + __u32 j_csum_seed; + void (*j_fc_cleanup_callback)(struct journal_s *, int); + int (*j_fc_replay_callback)(struct journal_s *, struct buffer_head *, enum passtype, int, tid_t); +}; + +struct journal_header_s { + __be32 h_magic; + __be32 h_blocktype; + __be32 h_sequence; +}; + +typedef struct journal_header_s journal_header_t; + +struct journal_superblock_s { + journal_header_t s_header; + __be32 s_blocksize; + __be32 s_maxlen; + __be32 s_first; + __be32 s_sequence; + __be32 s_start; + __be32 s_errno; + __be32 s_feature_compat; + __be32 s_feature_incompat; + __be32 s_feature_ro_compat; + __u8 s_uuid[16]; + __be32 s_nr_users; + __be32 s_dynsuper; + __be32 s_max_transaction; + __be32 s_max_trans_data; + __u8 s_checksum_type; + __u8 s_padding2[3]; + __be32 s_num_fc_blks; + __u32 s_padding[41]; + __be32 s_checksum; + __u8 s_users[768]; +}; + +enum jbd_state_bits { + BH_JBD = 16, + BH_JWrite = 17, + BH_Freed = 18, + BH_Revoked = 19, + BH_RevokeValid = 20, + BH_JBDDirty = 21, + BH_JournalHead = 22, + BH_Shadow = 23, + BH_Verified = 24, + BH_JBDPrivateStart = 25, +}; + +struct jbd2_inode { + transaction_t *i_transaction; + transaction_t *i_next_transaction; + struct list_head i_list; + struct inode *i_vfs_inode; + long unsigned int i_flags; + loff_t i_dirty_start; + loff_t i_dirty_end; +}; + +struct bgl_lock { + spinlock_t lock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct blockgroup_lock { + struct bgl_lock locks[128]; +}; + +typedef int ext4_grpblk_t; + +typedef long long unsigned int ext4_fsblk_t; + +typedef __u32 ext4_lblk_t; + +typedef unsigned int ext4_group_t; + +struct ext4_allocation_request { + struct inode *inode; + unsigned int len; + ext4_lblk_t logical; + ext4_lblk_t lleft; + ext4_lblk_t lright; + ext4_fsblk_t goal; + ext4_fsblk_t pleft; + ext4_fsblk_t pright; + unsigned int flags; +}; + +struct ext4_system_blocks { + struct rb_root root; + struct callback_head rcu; +}; + +struct ext4_group_desc { + __le32 bg_block_bitmap_lo; + __le32 bg_inode_bitmap_lo; + __le32 bg_inode_table_lo; + __le16 bg_free_blocks_count_lo; + __le16 bg_free_inodes_count_lo; + __le16 bg_used_dirs_count_lo; + __le16 bg_flags; + __le32 bg_exclude_bitmap_lo; + __le16 bg_block_bitmap_csum_lo; + __le16 bg_inode_bitmap_csum_lo; + __le16 bg_itable_unused_lo; + __le16 bg_checksum; + __le32 bg_block_bitmap_hi; + __le32 bg_inode_bitmap_hi; + __le32 bg_inode_table_hi; + __le16 bg_free_blocks_count_hi; + __le16 bg_free_inodes_count_hi; + __le16 bg_used_dirs_count_hi; + __le16 bg_itable_unused_hi; + __le32 bg_exclude_bitmap_hi; + __le16 bg_block_bitmap_csum_hi; + __le16 bg_inode_bitmap_csum_hi; + __u32 bg_reserved; +}; + +struct flex_groups { + atomic64_t free_clusters; + atomic_t free_inodes; + atomic_t used_dirs; +}; + +struct extent_status { + struct rb_node rb_node; + ext4_lblk_t es_lblk; + ext4_lblk_t es_len; + ext4_fsblk_t es_pblk; +}; + +struct ext4_es_tree { + struct rb_root root; + struct extent_status *cache_es; +}; + +struct ext4_es_stats { + long unsigned int es_stats_shrunk; + struct percpu_counter es_stats_cache_hits; + struct percpu_counter es_stats_cache_misses; + u64 es_stats_scan_time; + u64 es_stats_max_scan_time; + struct percpu_counter es_stats_all_cnt; + struct percpu_counter es_stats_shk_cnt; +}; + +struct ext4_pending_tree { + struct rb_root root; +}; + +struct ext4_fc_stats { + unsigned int fc_ineligible_reason_count[10]; + long unsigned int fc_num_commits; + long unsigned int fc_ineligible_commits; + long unsigned int fc_numblks; +}; + +struct ext4_fc_alloc_region { + ext4_lblk_t lblk; + ext4_fsblk_t pblk; + int ino; + int len; +}; + +struct ext4_fc_replay_state { + int fc_replay_num_tags; + int fc_replay_expected_off; + int fc_current_pass; + int fc_cur_tag; + int fc_crc; + struct ext4_fc_alloc_region *fc_regions; + int fc_regions_size; + int fc_regions_used; + int fc_regions_valid; + int *fc_modified_inodes; + int fc_modified_inodes_used; + int fc_modified_inodes_size; +}; + +struct ext4_inode_info { + __le32 i_data[15]; + __u32 i_dtime; + ext4_fsblk_t i_file_acl; + ext4_group_t i_block_group; + ext4_lblk_t i_dir_start_lookup; + long unsigned int i_flags; + struct rw_semaphore xattr_sem; + struct list_head i_orphan; + struct list_head i_fc_list; + ext4_lblk_t i_fc_lblk_start; + ext4_lblk_t i_fc_lblk_len; + atomic_t i_fc_updates; + wait_queue_head_t i_fc_wait; + struct mutex i_fc_lock; + loff_t i_disksize; + struct rw_semaphore i_data_sem; + struct rw_semaphore i_mmap_sem; + struct inode vfs_inode; + struct jbd2_inode *jinode; + spinlock_t i_raw_lock; + struct timespec64 i_crtime; + atomic_t i_prealloc_active; + struct list_head i_prealloc_list; + spinlock_t i_prealloc_lock; + struct ext4_es_tree i_es_tree; + rwlock_t i_es_lock; + struct list_head i_es_list; + unsigned int i_es_all_nr; + unsigned int i_es_shk_nr; + ext4_lblk_t i_es_shrink_lblk; + ext4_group_t i_last_alloc_group; + unsigned int i_reserved_data_blocks; + struct ext4_pending_tree i_pending_tree; + __u16 i_extra_isize; + u16 i_inline_off; + u16 i_inline_size; + qsize_t i_reserved_quota; + spinlock_t i_completed_io_lock; + struct list_head i_rsv_conversion_list; + struct work_struct i_rsv_conversion_work; + atomic_t i_unwritten; + spinlock_t i_block_reservation_lock; + tid_t i_sync_tid; + tid_t i_datasync_tid; + struct dquot *i_dquot[3]; + __u32 i_csum_seed; + kprojid_t i_projid; +}; + +struct ext4_super_block { + __le32 s_inodes_count; + __le32 s_blocks_count_lo; + __le32 s_r_blocks_count_lo; + __le32 s_free_blocks_count_lo; + __le32 s_free_inodes_count; + __le32 s_first_data_block; + __le32 s_log_block_size; + __le32 s_log_cluster_size; + __le32 s_blocks_per_group; + __le32 s_clusters_per_group; + __le32 s_inodes_per_group; + __le32 s_mtime; + __le32 s_wtime; + __le16 s_mnt_count; + __le16 s_max_mnt_count; + __le16 s_magic; + __le16 s_state; + __le16 s_errors; + __le16 s_minor_rev_level; + __le32 s_lastcheck; + __le32 s_checkinterval; + __le32 s_creator_os; + __le32 s_rev_level; + __le16 s_def_resuid; + __le16 s_def_resgid; + __le32 s_first_ino; + __le16 s_inode_size; + __le16 s_block_group_nr; + __le32 s_feature_compat; + __le32 s_feature_incompat; + __le32 s_feature_ro_compat; + __u8 s_uuid[16]; + char s_volume_name[16]; + char s_last_mounted[64]; + __le32 s_algorithm_usage_bitmap; + __u8 s_prealloc_blocks; + __u8 s_prealloc_dir_blocks; + __le16 s_reserved_gdt_blocks; + __u8 s_journal_uuid[16]; + __le32 s_journal_inum; + __le32 s_journal_dev; + __le32 s_last_orphan; + __le32 s_hash_seed[4]; + __u8 s_def_hash_version; + __u8 s_jnl_backup_type; + __le16 s_desc_size; + __le32 s_default_mount_opts; + __le32 s_first_meta_bg; + __le32 s_mkfs_time; + __le32 s_jnl_blocks[17]; + __le32 s_blocks_count_hi; + __le32 s_r_blocks_count_hi; + __le32 s_free_blocks_count_hi; + __le16 s_min_extra_isize; + __le16 s_want_extra_isize; + __le32 s_flags; + __le16 s_raid_stride; + __le16 s_mmp_update_interval; + __le64 s_mmp_block; + __le32 s_raid_stripe_width; + __u8 s_log_groups_per_flex; + __u8 s_checksum_type; + __u8 s_encryption_level; + __u8 s_reserved_pad; + __le64 s_kbytes_written; + __le32 s_snapshot_inum; + __le32 s_snapshot_id; + __le64 s_snapshot_r_blocks_count; + __le32 s_snapshot_list; + __le32 s_error_count; + __le32 s_first_error_time; + __le32 s_first_error_ino; + __le64 s_first_error_block; + __u8 s_first_error_func[32]; + __le32 s_first_error_line; + __le32 s_last_error_time; + __le32 s_last_error_ino; + __le32 s_last_error_line; + __le64 s_last_error_block; + __u8 s_last_error_func[32]; + __u8 s_mount_opts[64]; + __le32 s_usr_quota_inum; + __le32 s_grp_quota_inum; + __le32 s_overhead_clusters; + __le32 s_backup_bgs[2]; + __u8 s_encrypt_algos[4]; + __u8 s_encrypt_pw_salt[16]; + __le32 s_lpf_ino; + __le32 s_prj_quota_inum; + __le32 s_checksum_seed; + __u8 s_wtime_hi; + __u8 s_mtime_hi; + __u8 s_mkfs_time_hi; + __u8 s_lastcheck_hi; + __u8 s_first_error_time_hi; + __u8 s_last_error_time_hi; + __u8 s_first_error_errcode; + __u8 s_last_error_errcode; + __le16 s_encoding; + __le16 s_encoding_flags; + __le32 s_reserved[95]; + __le32 s_checksum; +}; + +struct mb_cache___2; + +struct ext4_group_info; + +struct ext4_locality_group; + +struct ext4_li_request; + +struct ext4_sb_info { + long unsigned int s_desc_size; + long unsigned int s_inodes_per_block; + long unsigned int s_blocks_per_group; + long unsigned int s_clusters_per_group; + long unsigned int s_inodes_per_group; + long unsigned int s_itb_per_group; + long unsigned int s_gdb_count; + long unsigned int s_desc_per_block; + ext4_group_t s_groups_count; + ext4_group_t s_blockfile_groups; + long unsigned int s_overhead; + unsigned int s_cluster_ratio; + unsigned int s_cluster_bits; + loff_t s_bitmap_maxbytes; + struct buffer_head *s_sbh; + struct ext4_super_block *s_es; + struct buffer_head **s_group_desc; + unsigned int s_mount_opt; + unsigned int s_mount_opt2; + long unsigned int s_mount_flags; + unsigned int s_def_mount_opt; + ext4_fsblk_t s_sb_block; + atomic64_t s_resv_clusters; + kuid_t s_resuid; + kgid_t s_resgid; + short unsigned int s_mount_state; + short unsigned int s_pad; + int s_addr_per_block_bits; + int s_desc_per_block_bits; + int s_inode_size; + int s_first_ino; + unsigned int s_inode_readahead_blks; + unsigned int s_inode_goal; + u32 s_hash_seed[4]; + int s_def_hash_version; + int s_hash_unsigned; + struct percpu_counter s_freeclusters_counter; + struct percpu_counter s_freeinodes_counter; + struct percpu_counter s_dirs_counter; + struct percpu_counter s_dirtyclusters_counter; + struct percpu_counter s_sra_exceeded_retry_limit; + struct blockgroup_lock *s_blockgroup_lock; + struct proc_dir_entry *s_proc; + struct kobject s_kobj; + struct completion s_kobj_unregister; + struct super_block *s_sb; + struct journal_s *s_journal; + struct list_head s_orphan; + struct mutex s_orphan_lock; + long unsigned int s_ext4_flags; + long unsigned int s_commit_interval; + u32 s_max_batch_time; + u32 s_min_batch_time; + struct block_device *s_journal_bdev; + char *s_qf_names[3]; + int s_jquota_fmt; + unsigned int s_want_extra_isize; + struct ext4_system_blocks *s_system_blks; + struct ext4_group_info ***s_group_info; + struct inode *s_buddy_cache; + spinlock_t s_md_lock; + short unsigned int *s_mb_offsets; + unsigned int *s_mb_maxs; + unsigned int s_group_info_size; + unsigned int s_mb_free_pending; + struct list_head s_freed_data_list; + long unsigned int s_stripe; + unsigned int s_mb_stream_request; + unsigned int s_mb_max_to_scan; + unsigned int s_mb_min_to_scan; + unsigned int s_mb_stats; + unsigned int s_mb_order2_reqs; + unsigned int s_mb_group_prealloc; + unsigned int s_mb_max_inode_prealloc; + unsigned int s_max_dir_size_kb; + long unsigned int s_mb_last_group; + long unsigned int s_mb_last_start; + unsigned int s_mb_prefetch; + unsigned int s_mb_prefetch_limit; + atomic_t s_bal_reqs; + atomic_t s_bal_success; + atomic_t s_bal_allocated; + atomic_t s_bal_ex_scanned; + atomic_t s_bal_goals; + atomic_t s_bal_breaks; + atomic_t s_bal_2orders; + spinlock_t s_bal_lock; + long unsigned int s_mb_buddies_generated; + long long unsigned int s_mb_generation_time; + atomic_t s_mb_lost_chunks; + atomic_t s_mb_preallocated; + atomic_t s_mb_discarded; + atomic_t s_lock_busy; + struct ext4_locality_group *s_locality_groups; + long unsigned int s_sectors_written_start; + u64 s_kbytes_written; + unsigned int s_extent_max_zeroout_kb; + unsigned int s_log_groups_per_flex; + struct flex_groups **s_flex_groups; + ext4_group_t s_flex_groups_allocated; + struct workqueue_struct *rsv_conversion_wq; + struct timer_list s_err_report; + struct ext4_li_request *s_li_request; + unsigned int s_li_wait_mult; + struct task_struct *s_mmp_tsk; + atomic_t s_last_trim_minblks; + struct crypto_shash *s_chksum_driver; + __u32 s_csum_seed; + struct shrinker s_es_shrinker; + struct list_head s_es_list; + long int s_es_nr_inode; + struct ext4_es_stats s_es_stats; + struct mb_cache___2 *s_ea_block_cache; + struct mb_cache___2 *s_ea_inode_cache; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + spinlock_t s_es_lock; + struct ratelimit_state s_err_ratelimit_state; + struct ratelimit_state s_warning_ratelimit_state; + struct ratelimit_state s_msg_ratelimit_state; + atomic_t s_warning_count; + atomic_t s_msg_count; + struct fscrypt_dummy_policy s_dummy_enc_policy; + struct percpu_rw_semaphore s_writepages_rwsem; + struct dax_device *s_daxdev; + errseq_t s_bdev_wb_err; + spinlock_t s_bdev_wb_lock; + spinlock_t s_error_lock; + int s_add_error_count; + int s_first_error_code; + __u32 s_first_error_line; + __u32 s_first_error_ino; + __u64 s_first_error_block; + const char *s_first_error_func; + time64_t s_first_error_time; + int s_last_error_code; + __u32 s_last_error_line; + __u32 s_last_error_ino; + __u64 s_last_error_block; + const char *s_last_error_func; + time64_t s_last_error_time; + struct work_struct s_error_work; + atomic_t s_fc_subtid; + atomic_t s_fc_ineligible_updates; + struct list_head s_fc_q[2]; + struct list_head s_fc_dentry_q[2]; + unsigned int s_fc_bytes; + spinlock_t s_fc_lock; + struct buffer_head *s_fc_bh; + struct ext4_fc_stats s_fc_stats; + u64 s_fc_avg_commit_time; + struct ext4_fc_replay_state s_fc_replay_state; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct ext4_group_info { + long unsigned int bb_state; + struct rb_root bb_free_root; + ext4_grpblk_t bb_first_free; + ext4_grpblk_t bb_free; + ext4_grpblk_t bb_fragments; + ext4_grpblk_t bb_largest_free_order; + struct list_head bb_prealloc_list; + struct rw_semaphore alloc_sem; + ext4_grpblk_t bb_counters[0]; +}; + +struct ext4_locality_group { + struct mutex lg_mutex; + struct list_head lg_prealloc_list[10]; + spinlock_t lg_prealloc_lock; +}; + +enum ext4_li_mode { + EXT4_LI_MODE_PREFETCH_BBITMAP = 0, + EXT4_LI_MODE_ITABLE = 1, +}; + +struct ext4_li_request { + struct super_block *lr_super; + enum ext4_li_mode lr_mode; + ext4_group_t lr_first_not_zeroed; + ext4_group_t lr_next_group; + struct list_head lr_request; + long unsigned int lr_next_sched; + long unsigned int lr_timeout; +}; + +struct ext4_map_blocks { + ext4_fsblk_t m_pblk; + ext4_lblk_t m_lblk; + unsigned int m_len; + unsigned int m_flags; +}; + +typedef enum { + EXT4_IGET_NORMAL = 0, + EXT4_IGET_SPECIAL = 1, + EXT4_IGET_HANDLE = 2, +} ext4_iget_flags; + +struct ext4_system_zone { + struct rb_node node; + ext4_fsblk_t start_blk; + unsigned int count; + u32 ino; +}; + +enum { + EXT4_INODE_SECRM = 0, + EXT4_INODE_UNRM = 1, + EXT4_INODE_COMPR = 2, + EXT4_INODE_SYNC = 3, + EXT4_INODE_IMMUTABLE = 4, + EXT4_INODE_APPEND = 5, + EXT4_INODE_NODUMP = 6, + EXT4_INODE_NOATIME = 7, + EXT4_INODE_DIRTY = 8, + EXT4_INODE_COMPRBLK = 9, + EXT4_INODE_NOCOMPR = 10, + EXT4_INODE_ENCRYPT = 11, + EXT4_INODE_INDEX = 12, + EXT4_INODE_IMAGIC = 13, + EXT4_INODE_JOURNAL_DATA = 14, + EXT4_INODE_NOTAIL = 15, + EXT4_INODE_DIRSYNC = 16, + EXT4_INODE_TOPDIR = 17, + EXT4_INODE_HUGE_FILE = 18, + EXT4_INODE_EXTENTS = 19, + EXT4_INODE_VERITY = 20, + EXT4_INODE_EA_INODE = 21, + EXT4_INODE_DAX = 25, + EXT4_INODE_INLINE_DATA = 28, + EXT4_INODE_PROJINHERIT = 29, + EXT4_INODE_CASEFOLD = 30, + EXT4_INODE_RESERVED = 31, +}; + +enum { + EXT4_FC_REASON_OK = 0, + EXT4_FC_REASON_INELIGIBLE = 1, + EXT4_FC_REASON_ALREADY_COMMITTED = 2, + EXT4_FC_REASON_FC_START_FAILED = 3, + EXT4_FC_REASON_FC_FAILED = 4, + EXT4_FC_REASON_XATTR = 0, + EXT4_FC_REASON_CROSS_RENAME = 1, + EXT4_FC_REASON_JOURNAL_FLAG_CHANGE = 2, + EXT4_FC_REASON_NOMEM = 3, + EXT4_FC_REASON_SWAP_BOOT = 4, + EXT4_FC_REASON_RESIZE = 5, + EXT4_FC_REASON_RENAME_DIR = 6, + EXT4_FC_REASON_FALLOC_RANGE = 7, + EXT4_FC_REASON_INODE_JOURNAL_DATA = 8, + EXT4_FC_COMMIT_FAILED = 9, + EXT4_FC_REASON_MAX = 10, +}; + +struct ext4_dir_entry_2 { + __le32 inode; + __le16 rec_len; + __u8 name_len; + __u8 file_type; + char name[255]; +}; + +struct fname; + +struct dir_private_info { + struct rb_root root; + struct rb_node *curr_node; + struct fname *extra_fname; + loff_t last_pos; + __u32 curr_hash; + __u32 curr_minor_hash; + __u32 next_hash; +}; + +struct fname { + __u32 hash; + __u32 minor_hash; + struct rb_node rb_hash; + struct fname *next; + __u32 inode; + __u8 name_len; + __u8 file_type; + char name[0]; +}; + +enum SHIFT_DIRECTION { + SHIFT_LEFT = 0, + SHIFT_RIGHT = 1, +}; + +struct ext4_io_end_vec { + struct list_head list; + loff_t offset; + ssize_t size; +}; + +struct ext4_io_end { + struct list_head list; + handle_t *handle; + struct inode *inode; + struct bio *bio; + unsigned int flag; + atomic_t count; + struct list_head list_vec; +}; + +typedef struct ext4_io_end ext4_io_end_t; + +enum { + ES_WRITTEN_B = 0, + ES_UNWRITTEN_B = 1, + ES_DELAYED_B = 2, + ES_HOLE_B = 3, + ES_REFERENCED_B = 4, + ES_FLAGS = 5, +}; + +enum { + EXT4_STATE_JDATA = 0, + EXT4_STATE_NEW = 1, + EXT4_STATE_XATTR = 2, + EXT4_STATE_NO_EXPAND = 3, + EXT4_STATE_DA_ALLOC_CLOSE = 4, + EXT4_STATE_EXT_MIGRATE = 5, + EXT4_STATE_NEWENTRY = 6, + EXT4_STATE_MAY_INLINE_DATA = 7, + EXT4_STATE_EXT_PRECACHED = 8, + EXT4_STATE_LUSTRE_EA_INODE = 9, + EXT4_STATE_VERITY_IN_PROGRESS = 10, + EXT4_STATE_FC_COMMITTING = 11, +}; + +struct ext4_iloc { + struct buffer_head *bh; + long unsigned int offset; + ext4_group_t block_group; +}; + +struct ext4_extent_tail { + __le32 et_checksum; +}; + +struct ext4_extent { + __le32 ee_block; + __le16 ee_len; + __le16 ee_start_hi; + __le32 ee_start_lo; +}; + +struct ext4_extent_idx { + __le32 ei_block; + __le32 ei_leaf_lo; + __le16 ei_leaf_hi; + __u16 ei_unused; +}; + +struct ext4_extent_header { + __le16 eh_magic; + __le16 eh_entries; + __le16 eh_max; + __le16 eh_depth; + __le32 eh_generation; +}; + +struct ext4_ext_path { + ext4_fsblk_t p_block; + __u16 p_depth; + __u16 p_maxdepth; + struct ext4_extent *p_ext; + struct ext4_extent_idx *p_idx; + struct ext4_extent_header *p_hdr; + struct buffer_head *p_bh; +}; + +struct partial_cluster { + ext4_fsblk_t pclu; + ext4_lblk_t lblk; + enum { + initial = 0, + tofree = 1, + nofree = 2, + } state; +}; + +struct pending_reservation { + struct rb_node rb_node; + ext4_lblk_t lclu; +}; + +struct rsvd_count { + int ndelonly; + bool first_do_lblk_found; + ext4_lblk_t first_do_lblk; + ext4_lblk_t last_do_lblk; + struct extent_status *left_es; + bool partial; + ext4_lblk_t lclu; +}; + +enum { + EXT4_MF_MNTDIR_SAMPLED = 0, + EXT4_MF_FS_ABORTED = 1, + EXT4_MF_FC_INELIGIBLE = 2, + EXT4_MF_FC_COMMITTING = 3, +}; + +struct fsmap { + __u32 fmr_device; + __u32 fmr_flags; + __u64 fmr_physical; + __u64 fmr_owner; + __u64 fmr_offset; + __u64 fmr_length; + __u64 fmr_reserved[3]; +}; + +struct ext4_fsmap { + struct list_head fmr_list; + dev_t fmr_device; + uint32_t fmr_flags; + uint64_t fmr_physical; + uint64_t fmr_owner; + uint64_t fmr_length; +}; + +struct ext4_fsmap_head { + uint32_t fmh_iflags; + uint32_t fmh_oflags; + unsigned int fmh_count; + unsigned int fmh_entries; + struct ext4_fsmap fmh_keys[2]; +}; + +typedef int (*ext4_fsmap_format_t)(struct ext4_fsmap *, void *); + +typedef int (*ext4_mballoc_query_range_fn)(struct super_block *, ext4_group_t, ext4_grpblk_t, ext4_grpblk_t, void *); + +struct ext4_getfsmap_info { + struct ext4_fsmap_head *gfi_head; + ext4_fsmap_format_t gfi_formatter; + void *gfi_format_arg; + ext4_fsblk_t gfi_next_fsblk; + u32 gfi_dev; + ext4_group_t gfi_agno; + struct ext4_fsmap gfi_low; + struct ext4_fsmap gfi_high; + struct ext4_fsmap gfi_lastfree; + struct list_head gfi_meta_list; + bool gfi_last; +}; + +struct ext4_getfsmap_dev { + int (*gfd_fn)(struct super_block *, struct ext4_fsmap *, struct ext4_getfsmap_info *); + u32 gfd_dev; +}; + +struct dx_hash_info { + u32 hash; + u32 minor_hash; + int hash_version; + u32 *seed; +}; + +typedef unsigned int __kernel_mode_t; + +typedef __kernel_mode_t mode_t; + +struct ext4_inode { + __le16 i_mode; + __le16 i_uid; + __le32 i_size_lo; + __le32 i_atime; + __le32 i_ctime; + __le32 i_mtime; + __le32 i_dtime; + __le16 i_gid; + __le16 i_links_count; + __le32 i_blocks_lo; + __le32 i_flags; + union { + struct { + __le32 l_i_version; + } linux1; + struct { + __u32 h_i_translator; + } hurd1; + struct { + __u32 m_i_reserved1; + } masix1; + } osd1; + __le32 i_block[15]; + __le32 i_generation; + __le32 i_file_acl_lo; + __le32 i_size_high; + __le32 i_obso_faddr; + union { + struct { + __le16 l_i_blocks_high; + __le16 l_i_file_acl_high; + __le16 l_i_uid_high; + __le16 l_i_gid_high; + __le16 l_i_checksum_lo; + __le16 l_i_reserved; + } linux2; + struct { + __le16 h_i_reserved1; + __u16 h_i_mode_high; + __u16 h_i_uid_high; + __u16 h_i_gid_high; + __u32 h_i_author; + } hurd2; + struct { + __le16 h_i_reserved1; + __le16 m_i_file_acl_high; + __u32 m_i_reserved2[2]; + } masix2; + } osd2; + __le16 i_extra_isize; + __le16 i_checksum_hi; + __le32 i_ctime_extra; + __le32 i_mtime_extra; + __le32 i_atime_extra; + __le32 i_crtime; + __le32 i_crtime_extra; + __le32 i_version_hi; + __le32 i_projid; +}; + +struct orlov_stats { + __u64 free_clusters; + __u32 free_inodes; + __u32 used_dirs; +}; + +typedef struct { + __le32 *p; + __le32 key; + struct buffer_head *bh; +} Indirect; + +struct ext4_filename { + const struct qstr *usr_fname; + struct fscrypt_str disk_name; + struct dx_hash_info hinfo; + struct fscrypt_str crypto_buf; + struct fscrypt_str cf_name; +}; + +struct ext4_xattr_ibody_header { + __le32 h_magic; +}; + +struct ext4_xattr_entry { + __u8 e_name_len; + __u8 e_name_index; + __le16 e_value_offs; + __le32 e_value_inum; + __le32 e_value_size; + __le32 e_hash; + char e_name[0]; +}; + +struct ext4_xattr_info { + const char *name; + const void *value; + size_t value_len; + int name_index; + int in_inode; +}; + +struct ext4_xattr_search { + struct ext4_xattr_entry *first; + void *base; + void *end; + struct ext4_xattr_entry *here; + int not_found; +}; + +struct ext4_xattr_ibody_find { + struct ext4_xattr_search s; + struct ext4_iloc iloc; +}; + +typedef short unsigned int __kernel_uid16_t; + +typedef short unsigned int __kernel_gid16_t; + +typedef __kernel_uid16_t uid16_t; + +typedef __kernel_gid16_t gid16_t; + +struct ext4_io_submit { + struct writeback_control *io_wbc; + struct bio *io_bio; + ext4_io_end_t *io_end; + sector_t io_next_block; +}; + +struct ext4_xattr_inode_array { + unsigned int count; + struct inode *inodes[0]; +}; + +struct mpage_da_data { + struct inode *inode; + struct writeback_control *wbc; + long unsigned int first_page; + long unsigned int next_page; + long unsigned int last_page; + struct ext4_map_blocks map; + struct ext4_io_submit io_submit; + unsigned int do_map: 1; + unsigned int scanned_until_end: 1; +}; + +struct fstrim_range { + __u64 start; + __u64 len; + __u64 minlen; +}; + +struct ext4_new_group_input { + __u32 group; + __u64 block_bitmap; + __u64 inode_bitmap; + __u64 inode_table; + __u32 blocks_count; + __u16 reserved_blocks; + __u16 unused; +}; + +struct compat_ext4_new_group_input { + u32 group; + compat_u64 block_bitmap; + compat_u64 inode_bitmap; + compat_u64 inode_table; + u32 blocks_count; + u16 reserved_blocks; + u16 unused; +} __attribute__((packed)); + +struct ext4_new_group_data { + __u32 group; + __u64 block_bitmap; + __u64 inode_bitmap; + __u64 inode_table; + __u32 blocks_count; + __u16 reserved_blocks; + __u16 mdata_blocks; + __u32 free_clusters_count; +}; + +struct move_extent { + __u32 reserved; + __u32 donor_fd; + __u64 orig_start; + __u64 donor_start; + __u64 len; + __u64 moved_len; +}; + +struct fsmap_head { + __u32 fmh_iflags; + __u32 fmh_oflags; + __u32 fmh_count; + __u32 fmh_entries; + __u64 fmh_reserved[6]; + struct fsmap fmh_keys[2]; + struct fsmap fmh_recs[0]; +}; + +struct getfsmap_info { + struct super_block *gi_sb; + struct fsmap_head *gi_data; + unsigned int gi_idx; + __u32 gi_last_flags; +}; + +enum blk_default_limits { + BLK_MAX_SEGMENTS = 128, + BLK_SAFE_MAX_SECTORS = 255, + BLK_DEF_MAX_SECTORS = 2560, + BLK_MAX_SEGMENT_SIZE = 65536, + BLK_SEG_BOUNDARY_MASK = 4294967295, +}; + +struct ext4_free_data { + struct list_head efd_list; + struct rb_node efd_node; + ext4_group_t efd_group; + ext4_grpblk_t efd_start_cluster; + ext4_grpblk_t efd_count; + tid_t efd_tid; +}; + +struct ext4_prealloc_space { + struct list_head pa_inode_list; + struct list_head pa_group_list; + union { + struct list_head pa_tmp_list; + struct callback_head pa_rcu; + } u; + spinlock_t pa_lock; + atomic_t pa_count; + unsigned int pa_deleted; + ext4_fsblk_t pa_pstart; + ext4_lblk_t pa_lstart; + ext4_grpblk_t pa_len; + ext4_grpblk_t pa_free; + short unsigned int pa_type; + spinlock_t *pa_obj_lock; + struct inode *pa_inode; +}; + +enum { + MB_INODE_PA = 0, + MB_GROUP_PA = 1, +}; + +struct ext4_free_extent { + ext4_lblk_t fe_logical; + ext4_grpblk_t fe_start; + ext4_group_t fe_group; + ext4_grpblk_t fe_len; +}; + +struct ext4_allocation_context { + struct inode *ac_inode; + struct super_block *ac_sb; + struct ext4_free_extent ac_o_ex; + struct ext4_free_extent ac_g_ex; + struct ext4_free_extent ac_b_ex; + struct ext4_free_extent ac_f_ex; + __u16 ac_groups_scanned; + __u16 ac_found; + __u16 ac_tail; + __u16 ac_buddy; + __u16 ac_flags; + __u8 ac_status; + __u8 ac_criteria; + __u8 ac_2order; + __u8 ac_op; + struct page *ac_bitmap_page; + struct page *ac_buddy_page; + struct ext4_prealloc_space *ac_pa; + struct ext4_locality_group *ac_lg; +}; + +struct ext4_buddy { + struct page *bd_buddy_page; + void *bd_buddy; + struct page *bd_bitmap_page; + void *bd_bitmap; + struct ext4_group_info *bd_info; + struct super_block *bd_sb; + __u16 bd_blkbits; + ext4_group_t bd_group; +}; + +struct sg { + struct ext4_group_info info; + ext4_grpblk_t counters[18]; +}; + +struct migrate_struct { + ext4_lblk_t first_block; + ext4_lblk_t last_block; + ext4_lblk_t curr_block; + ext4_fsblk_t first_pblock; + ext4_fsblk_t last_pblock; +}; + +struct mmp_struct { + __le32 mmp_magic; + __le32 mmp_seq; + __le64 mmp_time; + char mmp_nodename[64]; + char mmp_bdevname[32]; + __le16 mmp_check_interval; + __le16 mmp_pad1; + __le32 mmp_pad2[226]; + __le32 mmp_checksum; +}; + +struct mmpd_data { + struct buffer_head *bh; + struct super_block *sb; +}; + +struct ext4_dir_entry { + __le32 inode; + __le16 rec_len; + __le16 name_len; + char name[255]; +}; + +struct ext4_dir_entry_tail { + __le32 det_reserved_zero1; + __le16 det_rec_len; + __u8 det_reserved_zero2; + __u8 det_reserved_ft; + __le32 det_checksum; +}; + +typedef enum { + EITHER = 0, + INDEX = 1, + DIRENT = 2, + DIRENT_HTREE = 3, +} dirblock_type_t; + +struct fake_dirent { + __le32 inode; + __le16 rec_len; + u8 name_len; + u8 file_type; +}; + +struct dx_countlimit { + __le16 limit; + __le16 count; +}; + +struct dx_entry { + __le32 hash; + __le32 block; +}; + +struct dx_root_info { + __le32 reserved_zero; + u8 hash_version; + u8 info_length; + u8 indirect_levels; + u8 unused_flags; +}; + +struct dx_root { + struct fake_dirent dot; + char dot_name[4]; + struct fake_dirent dotdot; + char dotdot_name[4]; + struct dx_root_info info; + struct dx_entry entries[0]; +}; + +struct dx_node { + struct fake_dirent fake; + struct dx_entry entries[0]; +}; + +struct dx_frame { + struct buffer_head *bh; + struct dx_entry *entries; + struct dx_entry *at; +}; + +struct dx_map_entry { + u32 hash; + u16 offs; + u16 size; +}; + +struct dx_tail { + u32 dt_reserved; + __le32 dt_checksum; +}; + +struct ext4_renament { + struct inode *dir; + struct dentry *dentry; + struct inode *inode; + bool is_dir; + int dir_nlink_delta; + struct buffer_head *bh; + struct ext4_dir_entry_2 *de; + int inlined; + struct buffer_head *dir_bh; + struct ext4_dir_entry_2 *parent_de; + int dir_inlined; +}; + +enum bio_post_read_step { + STEP_INITIAL = 0, + STEP_DECRYPT = 1, + STEP_VERITY = 2, + STEP_MAX = 3, +}; + +struct bio_post_read_ctx { + struct bio *bio; + struct work_struct work; + unsigned int cur_step; + unsigned int enabled_steps; +}; + +enum { + BLOCK_BITMAP = 0, + INODE_BITMAP = 1, + INODE_TABLE = 2, + GROUP_TABLE_COUNT = 3, +}; + +struct ext4_rcu_ptr { + struct callback_head rcu; + void *ptr; +}; + +struct ext4_new_flex_group_data { + struct ext4_new_group_data *groups; + __u16 *bg_flags; + ext4_group_t count; +}; + +enum { + I_DATA_SEM_NORMAL = 0, + I_DATA_SEM_OTHER = 1, + I_DATA_SEM_QUOTA = 2, +}; + +struct ext4_lazy_init { + long unsigned int li_state; + struct list_head li_request_list; + struct mutex li_list_mtx; +}; + +struct ext4_journal_cb_entry { + struct list_head jce_list; + void (*jce_func)(struct super_block *, struct ext4_journal_cb_entry *, int); +}; + +struct trace_event_raw_ext4_other_inode_update_time { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ino_t orig_ino; + uid_t uid; + gid_t gid; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_free_inode { + struct trace_entry ent; + dev_t dev; + ino_t ino; + uid_t uid; + gid_t gid; + __u64 blocks; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_request_inode { + struct trace_entry ent; + dev_t dev; + ino_t dir; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_allocate_inode { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ino_t dir; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_evict_inode { + struct trace_entry ent; + dev_t dev; + ino_t ino; + int nlink; + char __data[0]; +}; + +struct trace_event_raw_ext4_drop_inode { + struct trace_entry ent; + dev_t dev; + ino_t ino; + int drop; + char __data[0]; +}; + +struct trace_event_raw_ext4_nfs_commit_metadata { + struct trace_entry ent; + dev_t dev; + ino_t ino; + char __data[0]; +}; + +struct trace_event_raw_ext4_mark_inode_dirty { + struct trace_entry ent; + dev_t dev; + ino_t ino; + long unsigned int ip; + char __data[0]; +}; + +struct trace_event_raw_ext4_begin_ordered_truncate { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t new_size; + char __data[0]; +}; + +struct trace_event_raw_ext4__write_begin { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t pos; + unsigned int len; + unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_ext4__write_end { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t pos; + unsigned int len; + unsigned int copied; + char __data[0]; +}; + +struct trace_event_raw_ext4_writepages { + struct trace_entry ent; + dev_t dev; + ino_t ino; + long int nr_to_write; + long int pages_skipped; + loff_t range_start; + loff_t range_end; + long unsigned int writeback_index; + int sync_mode; + char for_kupdate; + char range_cyclic; + char __data[0]; +}; + +struct trace_event_raw_ext4_da_write_pages { + struct trace_entry ent; + dev_t dev; + ino_t ino; + long unsigned int first_page; + long int nr_to_write; + int sync_mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_da_write_pages_extent { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 lblk; + __u32 len; + __u32 flags; + char __data[0]; +}; + +struct trace_event_raw_ext4_writepages_result { + struct trace_entry ent; + dev_t dev; + ino_t ino; + int ret; + int pages_written; + long int pages_skipped; + long unsigned int writeback_index; + int sync_mode; + char __data[0]; +}; + +struct trace_event_raw_ext4__page_op { + struct trace_entry ent; + dev_t dev; + ino_t ino; + long unsigned int index; + char __data[0]; +}; + +struct trace_event_raw_ext4_invalidatepage_op { + struct trace_entry ent; + dev_t dev; + ino_t ino; + long unsigned int index; + unsigned int offset; + unsigned int length; + char __data[0]; +}; + +struct trace_event_raw_ext4_discard_blocks { + struct trace_entry ent; + dev_t dev; + __u64 blk; + __u64 count; + char __data[0]; +}; + +struct trace_event_raw_ext4__mb_new_pa { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 pa_pstart; + __u64 pa_lstart; + __u32 pa_len; + char __data[0]; +}; + +struct trace_event_raw_ext4_mb_release_inode_pa { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 block; + __u32 count; + char __data[0]; +}; + +struct trace_event_raw_ext4_mb_release_group_pa { + struct trace_entry ent; + dev_t dev; + __u64 pa_pstart; + __u32 pa_len; + char __data[0]; +}; + +struct trace_event_raw_ext4_discard_preallocations { + struct trace_entry ent; + dev_t dev; + ino_t ino; + unsigned int len; + unsigned int needed; + char __data[0]; +}; + +struct trace_event_raw_ext4_mb_discard_preallocations { + struct trace_entry ent; + dev_t dev; + int needed; + char __data[0]; +}; + +struct trace_event_raw_ext4_request_blocks { + struct trace_entry ent; + dev_t dev; + ino_t ino; + unsigned int len; + __u32 logical; + __u32 lleft; + __u32 lright; + __u64 goal; + __u64 pleft; + __u64 pright; + unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_ext4_allocate_blocks { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 block; + unsigned int len; + __u32 logical; + __u32 lleft; + __u32 lright; + __u64 goal; + __u64 pleft; + __u64 pright; + unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_ext4_free_blocks { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 block; + long unsigned int count; + int flags; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_sync_file_enter { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ino_t parent; + int datasync; + char __data[0]; +}; + +struct trace_event_raw_ext4_sync_file_exit { + struct trace_entry ent; + dev_t dev; + ino_t ino; + int ret; + char __data[0]; +}; + +struct trace_event_raw_ext4_sync_fs { + struct trace_entry ent; + dev_t dev; + int wait; + char __data[0]; +}; + +struct trace_event_raw_ext4_alloc_da_blocks { + struct trace_entry ent; + dev_t dev; + ino_t ino; + unsigned int data_blocks; + char __data[0]; +}; + +struct trace_event_raw_ext4_mballoc_alloc { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u32 orig_logical; + int orig_start; + __u32 orig_group; + int orig_len; + __u32 goal_logical; + int goal_start; + __u32 goal_group; + int goal_len; + __u32 result_logical; + int result_start; + __u32 result_group; + int result_len; + __u16 found; + __u16 groups; + __u16 buddy; + __u16 flags; + __u16 tail; + __u8 cr; + char __data[0]; +}; + +struct trace_event_raw_ext4_mballoc_prealloc { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u32 orig_logical; + int orig_start; + __u32 orig_group; + int orig_len; + __u32 result_logical; + int result_start; + __u32 result_group; + int result_len; + char __data[0]; +}; + +struct trace_event_raw_ext4__mballoc { + struct trace_entry ent; + dev_t dev; + ino_t ino; + int result_start; + __u32 result_group; + int result_len; + char __data[0]; +}; + +struct trace_event_raw_ext4_forget { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 block; + int is_metadata; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_da_update_reserve_space { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 i_blocks; + int used_blocks; + int reserved_data_blocks; + int quota_claim; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_da_reserve_space { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 i_blocks; + int reserved_data_blocks; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_da_release_space { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 i_blocks; + int freed_blocks; + int reserved_data_blocks; + __u16 mode; + char __data[0]; +}; + +struct trace_event_raw_ext4__bitmap_load { + struct trace_entry ent; + dev_t dev; + __u32 group; + char __data[0]; +}; + +struct trace_event_raw_ext4_read_block_bitmap_load { + struct trace_entry ent; + dev_t dev; + __u32 group; + bool prefetch; + char __data[0]; +}; + +struct trace_event_raw_ext4_direct_IO_enter { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t pos; + long unsigned int len; + int rw; + char __data[0]; +}; + +struct trace_event_raw_ext4_direct_IO_exit { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t pos; + long unsigned int len; + int rw; + int ret; + char __data[0]; +}; + +struct trace_event_raw_ext4__fallocate_mode { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t offset; + loff_t len; + int mode; + char __data[0]; +}; + +struct trace_event_raw_ext4_fallocate_exit { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t pos; + unsigned int blocks; + int ret; + char __data[0]; +}; + +struct trace_event_raw_ext4_unlink_enter { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ino_t parent; + loff_t size; + char __data[0]; +}; + +struct trace_event_raw_ext4_unlink_exit { + struct trace_entry ent; + dev_t dev; + ino_t ino; + int ret; + char __data[0]; +}; + +struct trace_event_raw_ext4__truncate { + struct trace_entry ent; + dev_t dev; + ino_t ino; + __u64 blocks; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_convert_to_initialized_enter { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t m_lblk; + unsigned int m_len; + ext4_lblk_t u_lblk; + unsigned int u_len; + ext4_fsblk_t u_pblk; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_convert_to_initialized_fastpath { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t m_lblk; + unsigned int m_len; + ext4_lblk_t u_lblk; + unsigned int u_len; + ext4_fsblk_t u_pblk; + ext4_lblk_t i_lblk; + unsigned int i_len; + ext4_fsblk_t i_pblk; + char __data[0]; +}; + +struct trace_event_raw_ext4__map_blocks_enter { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + unsigned int len; + unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_ext4__map_blocks_exit { + struct trace_entry ent; + dev_t dev; + ino_t ino; + unsigned int flags; + ext4_fsblk_t pblk; + ext4_lblk_t lblk; + unsigned int len; + unsigned int mflags; + int ret; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_load_extent { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_fsblk_t pblk; + ext4_lblk_t lblk; + char __data[0]; +}; + +struct trace_event_raw_ext4_load_inode { + struct trace_entry ent; + dev_t dev; + ino_t ino; + char __data[0]; +}; + +struct trace_event_raw_ext4_journal_start { + struct trace_entry ent; + dev_t dev; + long unsigned int ip; + int blocks; + int rsv_blocks; + int revoke_creds; + char __data[0]; +}; + +struct trace_event_raw_ext4_journal_start_reserved { + struct trace_entry ent; + dev_t dev; + long unsigned int ip; + int blocks; + char __data[0]; +}; + +struct trace_event_raw_ext4__trim { + struct trace_entry ent; + int dev_major; + int dev_minor; + __u32 group; + int start; + int len; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_handle_unwritten_extents { + struct trace_entry ent; + dev_t dev; + ino_t ino; + int flags; + ext4_lblk_t lblk; + ext4_fsblk_t pblk; + unsigned int len; + unsigned int allocated; + ext4_fsblk_t newblk; + char __data[0]; +}; + +struct trace_event_raw_ext4_get_implied_cluster_alloc_exit { + struct trace_entry ent; + dev_t dev; + unsigned int flags; + ext4_lblk_t lblk; + ext4_fsblk_t pblk; + unsigned int len; + int ret; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_put_in_cache { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + unsigned int len; + ext4_fsblk_t start; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_in_cache { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + int ret; + char __data[0]; +}; + +struct trace_event_raw_ext4_find_delalloc_range { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t from; + ext4_lblk_t to; + int reverse; + int found; + ext4_lblk_t found_blk; + char __data[0]; +}; + +struct trace_event_raw_ext4_get_reserved_cluster_alloc { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + unsigned int len; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_show_extent { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_fsblk_t pblk; + ext4_lblk_t lblk; + short unsigned int len; + char __data[0]; +}; + +struct trace_event_raw_ext4_remove_blocks { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t from; + ext4_lblk_t to; + ext4_fsblk_t ee_pblk; + ext4_lblk_t ee_lblk; + short unsigned int ee_len; + ext4_fsblk_t pc_pclu; + ext4_lblk_t pc_lblk; + int pc_state; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_rm_leaf { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t start; + ext4_lblk_t ee_lblk; + ext4_fsblk_t ee_pblk; + short int ee_len; + ext4_fsblk_t pc_pclu; + ext4_lblk_t pc_lblk; + int pc_state; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_rm_idx { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_fsblk_t pblk; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_remove_space { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t start; + ext4_lblk_t end; + int depth; + char __data[0]; +}; + +struct trace_event_raw_ext4_ext_remove_space_done { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t start; + ext4_lblk_t end; + int depth; + ext4_fsblk_t pc_pclu; + ext4_lblk_t pc_lblk; + int pc_state; + short unsigned int eh_entries; + char __data[0]; +}; + +struct trace_event_raw_ext4__es_extent { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + ext4_lblk_t len; + ext4_fsblk_t pblk; + char status; + char __data[0]; +}; + +struct trace_event_raw_ext4_es_remove_extent { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t lblk; + loff_t len; + char __data[0]; +}; + +struct trace_event_raw_ext4_es_find_extent_range_enter { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + char __data[0]; +}; + +struct trace_event_raw_ext4_es_find_extent_range_exit { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + ext4_lblk_t len; + ext4_fsblk_t pblk; + char status; + char __data[0]; +}; + +struct trace_event_raw_ext4_es_lookup_extent_enter { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + char __data[0]; +}; + +struct trace_event_raw_ext4_es_lookup_extent_exit { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + ext4_lblk_t len; + ext4_fsblk_t pblk; + char status; + int found; + char __data[0]; +}; + +struct trace_event_raw_ext4__es_shrink_enter { + struct trace_entry ent; + dev_t dev; + int nr_to_scan; + int cache_cnt; + char __data[0]; +}; + +struct trace_event_raw_ext4_es_shrink_scan_exit { + struct trace_entry ent; + dev_t dev; + int nr_shrunk; + int cache_cnt; + char __data[0]; +}; + +struct trace_event_raw_ext4_collapse_range { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t offset; + loff_t len; + char __data[0]; +}; + +struct trace_event_raw_ext4_insert_range { + struct trace_entry ent; + dev_t dev; + ino_t ino; + loff_t offset; + loff_t len; + char __data[0]; +}; + +struct trace_event_raw_ext4_es_shrink { + struct trace_entry ent; + dev_t dev; + int nr_shrunk; + long long unsigned int scan_time; + int nr_skipped; + int retried; + char __data[0]; +}; + +struct trace_event_raw_ext4_es_insert_delayed_block { + struct trace_entry ent; + dev_t dev; + ino_t ino; + ext4_lblk_t lblk; + ext4_lblk_t len; + ext4_fsblk_t pblk; + char status; + bool allocated; + char __data[0]; +}; + +struct trace_event_raw_ext4_fsmap_class { + struct trace_entry ent; + dev_t dev; + dev_t keydev; + u32 agno; + u64 bno; + u64 len; + u64 owner; + char __data[0]; +}; + +struct trace_event_raw_ext4_getfsmap_class { + struct trace_entry ent; + dev_t dev; + dev_t keydev; + u64 block; + u64 len; + u64 owner; + u64 flags; + char __data[0]; +}; + +struct trace_event_raw_ext4_shutdown { + struct trace_entry ent; + dev_t dev; + unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_ext4_error { + struct trace_entry ent; + dev_t dev; + const char *function; + unsigned int line; + char __data[0]; +}; + +struct trace_event_raw_ext4_prefetch_bitmaps { + struct trace_entry ent; + dev_t dev; + __u32 group; + __u32 next; + __u32 ios; + char __data[0]; +}; + +struct trace_event_raw_ext4_lazy_itable_init { + struct trace_entry ent; + dev_t dev; + __u32 group; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_replay_scan { + struct trace_entry ent; + dev_t dev; + int error; + int off; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_replay { + struct trace_entry ent; + dev_t dev; + int tag; + int ino; + int priv1; + int priv2; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_commit_start { + struct trace_entry ent; + dev_t dev; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_commit_stop { + struct trace_entry ent; + dev_t dev; + int nblks; + int reason; + int num_fc; + int num_fc_ineligible; + int nblks_agg; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_stats { + struct trace_entry ent; + dev_t dev; + struct ext4_sb_info *sbi; + int count; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_track_create { + struct trace_entry ent; + dev_t dev; + int ino; + int error; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_track_link { + struct trace_entry ent; + dev_t dev; + int ino; + int error; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_track_unlink { + struct trace_entry ent; + dev_t dev; + int ino; + int error; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_track_inode { + struct trace_entry ent; + dev_t dev; + int ino; + int error; + char __data[0]; +}; + +struct trace_event_raw_ext4_fc_track_range { + struct trace_entry ent; + dev_t dev; + int ino; + long int start; + long int end; + int error; + char __data[0]; +}; + +struct trace_event_data_offsets_ext4_other_inode_update_time {}; + +struct trace_event_data_offsets_ext4_free_inode {}; + +struct trace_event_data_offsets_ext4_request_inode {}; + +struct trace_event_data_offsets_ext4_allocate_inode {}; + +struct trace_event_data_offsets_ext4_evict_inode {}; + +struct trace_event_data_offsets_ext4_drop_inode {}; + +struct trace_event_data_offsets_ext4_nfs_commit_metadata {}; + +struct trace_event_data_offsets_ext4_mark_inode_dirty {}; + +struct trace_event_data_offsets_ext4_begin_ordered_truncate {}; + +struct trace_event_data_offsets_ext4__write_begin {}; + +struct trace_event_data_offsets_ext4__write_end {}; + +struct trace_event_data_offsets_ext4_writepages {}; + +struct trace_event_data_offsets_ext4_da_write_pages {}; + +struct trace_event_data_offsets_ext4_da_write_pages_extent {}; + +struct trace_event_data_offsets_ext4_writepages_result {}; + +struct trace_event_data_offsets_ext4__page_op {}; + +struct trace_event_data_offsets_ext4_invalidatepage_op {}; + +struct trace_event_data_offsets_ext4_discard_blocks {}; + +struct trace_event_data_offsets_ext4__mb_new_pa {}; + +struct trace_event_data_offsets_ext4_mb_release_inode_pa {}; + +struct trace_event_data_offsets_ext4_mb_release_group_pa {}; + +struct trace_event_data_offsets_ext4_discard_preallocations {}; + +struct trace_event_data_offsets_ext4_mb_discard_preallocations {}; + +struct trace_event_data_offsets_ext4_request_blocks {}; + +struct trace_event_data_offsets_ext4_allocate_blocks {}; + +struct trace_event_data_offsets_ext4_free_blocks {}; + +struct trace_event_data_offsets_ext4_sync_file_enter {}; + +struct trace_event_data_offsets_ext4_sync_file_exit {}; + +struct trace_event_data_offsets_ext4_sync_fs {}; + +struct trace_event_data_offsets_ext4_alloc_da_blocks {}; + +struct trace_event_data_offsets_ext4_mballoc_alloc {}; + +struct trace_event_data_offsets_ext4_mballoc_prealloc {}; + +struct trace_event_data_offsets_ext4__mballoc {}; + +struct trace_event_data_offsets_ext4_forget {}; + +struct trace_event_data_offsets_ext4_da_update_reserve_space {}; + +struct trace_event_data_offsets_ext4_da_reserve_space {}; + +struct trace_event_data_offsets_ext4_da_release_space {}; + +struct trace_event_data_offsets_ext4__bitmap_load {}; + +struct trace_event_data_offsets_ext4_read_block_bitmap_load {}; + +struct trace_event_data_offsets_ext4_direct_IO_enter {}; + +struct trace_event_data_offsets_ext4_direct_IO_exit {}; + +struct trace_event_data_offsets_ext4__fallocate_mode {}; + +struct trace_event_data_offsets_ext4_fallocate_exit {}; + +struct trace_event_data_offsets_ext4_unlink_enter {}; + +struct trace_event_data_offsets_ext4_unlink_exit {}; + +struct trace_event_data_offsets_ext4__truncate {}; + +struct trace_event_data_offsets_ext4_ext_convert_to_initialized_enter {}; + +struct trace_event_data_offsets_ext4_ext_convert_to_initialized_fastpath {}; + +struct trace_event_data_offsets_ext4__map_blocks_enter {}; + +struct trace_event_data_offsets_ext4__map_blocks_exit {}; + +struct trace_event_data_offsets_ext4_ext_load_extent {}; + +struct trace_event_data_offsets_ext4_load_inode {}; + +struct trace_event_data_offsets_ext4_journal_start {}; + +struct trace_event_data_offsets_ext4_journal_start_reserved {}; + +struct trace_event_data_offsets_ext4__trim {}; + +struct trace_event_data_offsets_ext4_ext_handle_unwritten_extents {}; + +struct trace_event_data_offsets_ext4_get_implied_cluster_alloc_exit {}; + +struct trace_event_data_offsets_ext4_ext_put_in_cache {}; + +struct trace_event_data_offsets_ext4_ext_in_cache {}; + +struct trace_event_data_offsets_ext4_find_delalloc_range {}; + +struct trace_event_data_offsets_ext4_get_reserved_cluster_alloc {}; + +struct trace_event_data_offsets_ext4_ext_show_extent {}; + +struct trace_event_data_offsets_ext4_remove_blocks {}; + +struct trace_event_data_offsets_ext4_ext_rm_leaf {}; + +struct trace_event_data_offsets_ext4_ext_rm_idx {}; + +struct trace_event_data_offsets_ext4_ext_remove_space {}; + +struct trace_event_data_offsets_ext4_ext_remove_space_done {}; + +struct trace_event_data_offsets_ext4__es_extent {}; + +struct trace_event_data_offsets_ext4_es_remove_extent {}; + +struct trace_event_data_offsets_ext4_es_find_extent_range_enter {}; + +struct trace_event_data_offsets_ext4_es_find_extent_range_exit {}; + +struct trace_event_data_offsets_ext4_es_lookup_extent_enter {}; + +struct trace_event_data_offsets_ext4_es_lookup_extent_exit {}; + +struct trace_event_data_offsets_ext4__es_shrink_enter {}; + +struct trace_event_data_offsets_ext4_es_shrink_scan_exit {}; + +struct trace_event_data_offsets_ext4_collapse_range {}; + +struct trace_event_data_offsets_ext4_insert_range {}; + +struct trace_event_data_offsets_ext4_es_shrink {}; + +struct trace_event_data_offsets_ext4_es_insert_delayed_block {}; + +struct trace_event_data_offsets_ext4_fsmap_class {}; + +struct trace_event_data_offsets_ext4_getfsmap_class {}; + +struct trace_event_data_offsets_ext4_shutdown {}; + +struct trace_event_data_offsets_ext4_error {}; + +struct trace_event_data_offsets_ext4_prefetch_bitmaps {}; + +struct trace_event_data_offsets_ext4_lazy_itable_init {}; + +struct trace_event_data_offsets_ext4_fc_replay_scan {}; + +struct trace_event_data_offsets_ext4_fc_replay {}; + +struct trace_event_data_offsets_ext4_fc_commit_start {}; + +struct trace_event_data_offsets_ext4_fc_commit_stop {}; + +struct trace_event_data_offsets_ext4_fc_stats {}; + +struct trace_event_data_offsets_ext4_fc_track_create {}; + +struct trace_event_data_offsets_ext4_fc_track_link {}; + +struct trace_event_data_offsets_ext4_fc_track_unlink {}; + +struct trace_event_data_offsets_ext4_fc_track_inode {}; + +struct trace_event_data_offsets_ext4_fc_track_range {}; + +typedef void (*btf_trace_ext4_other_inode_update_time)(void *, struct inode *, ino_t); + +typedef void (*btf_trace_ext4_free_inode)(void *, struct inode *); + +typedef void (*btf_trace_ext4_request_inode)(void *, struct inode *, int); + +typedef void (*btf_trace_ext4_allocate_inode)(void *, struct inode *, struct inode *, int); + +typedef void (*btf_trace_ext4_evict_inode)(void *, struct inode *); + +typedef void (*btf_trace_ext4_drop_inode)(void *, struct inode *, int); + +typedef void (*btf_trace_ext4_nfs_commit_metadata)(void *, struct inode *); + +typedef void (*btf_trace_ext4_mark_inode_dirty)(void *, struct inode *, long unsigned int); + +typedef void (*btf_trace_ext4_begin_ordered_truncate)(void *, struct inode *, loff_t); + +typedef void (*btf_trace_ext4_write_begin)(void *, struct inode *, loff_t, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_da_write_begin)(void *, struct inode *, loff_t, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_write_end)(void *, struct inode *, loff_t, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_journalled_write_end)(void *, struct inode *, loff_t, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_da_write_end)(void *, struct inode *, loff_t, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_writepages)(void *, struct inode *, struct writeback_control *); + +typedef void (*btf_trace_ext4_da_write_pages)(void *, struct inode *, long unsigned int, struct writeback_control *); + +typedef void (*btf_trace_ext4_da_write_pages_extent)(void *, struct inode *, struct ext4_map_blocks *); + +typedef void (*btf_trace_ext4_writepages_result)(void *, struct inode *, struct writeback_control *, int, int); + +typedef void (*btf_trace_ext4_writepage)(void *, struct page *); + +typedef void (*btf_trace_ext4_readpage)(void *, struct page *); + +typedef void (*btf_trace_ext4_releasepage)(void *, struct page *); + +typedef void (*btf_trace_ext4_invalidatepage)(void *, struct page *, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_journalled_invalidatepage)(void *, struct page *, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_discard_blocks)(void *, struct super_block *, long long unsigned int, long long unsigned int); + +typedef void (*btf_trace_ext4_mb_new_inode_pa)(void *, struct ext4_allocation_context *, struct ext4_prealloc_space *); + +typedef void (*btf_trace_ext4_mb_new_group_pa)(void *, struct ext4_allocation_context *, struct ext4_prealloc_space *); + +typedef void (*btf_trace_ext4_mb_release_inode_pa)(void *, struct ext4_prealloc_space *, long long unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_mb_release_group_pa)(void *, struct super_block *, struct ext4_prealloc_space *); + +typedef void (*btf_trace_ext4_discard_preallocations)(void *, struct inode *, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_mb_discard_preallocations)(void *, struct super_block *, int); + +typedef void (*btf_trace_ext4_request_blocks)(void *, struct ext4_allocation_request *); + +typedef void (*btf_trace_ext4_allocate_blocks)(void *, struct ext4_allocation_request *, long long unsigned int); + +typedef void (*btf_trace_ext4_free_blocks)(void *, struct inode *, __u64, long unsigned int, int); + +typedef void (*btf_trace_ext4_sync_file_enter)(void *, struct file *, int); + +typedef void (*btf_trace_ext4_sync_file_exit)(void *, struct inode *, int); + +typedef void (*btf_trace_ext4_sync_fs)(void *, struct super_block *, int); + +typedef void (*btf_trace_ext4_alloc_da_blocks)(void *, struct inode *); + +typedef void (*btf_trace_ext4_mballoc_alloc)(void *, struct ext4_allocation_context *); + +typedef void (*btf_trace_ext4_mballoc_prealloc)(void *, struct ext4_allocation_context *); + +typedef void (*btf_trace_ext4_mballoc_discard)(void *, struct super_block *, struct inode *, ext4_group_t, ext4_grpblk_t, ext4_grpblk_t); + +typedef void (*btf_trace_ext4_mballoc_free)(void *, struct super_block *, struct inode *, ext4_group_t, ext4_grpblk_t, ext4_grpblk_t); + +typedef void (*btf_trace_ext4_forget)(void *, struct inode *, int, __u64); + +typedef void (*btf_trace_ext4_da_update_reserve_space)(void *, struct inode *, int, int); + +typedef void (*btf_trace_ext4_da_reserve_space)(void *, struct inode *); + +typedef void (*btf_trace_ext4_da_release_space)(void *, struct inode *, int); + +typedef void (*btf_trace_ext4_mb_bitmap_load)(void *, struct super_block *, long unsigned int); + +typedef void (*btf_trace_ext4_mb_buddy_bitmap_load)(void *, struct super_block *, long unsigned int); + +typedef void (*btf_trace_ext4_load_inode_bitmap)(void *, struct super_block *, long unsigned int); + +typedef void (*btf_trace_ext4_read_block_bitmap_load)(void *, struct super_block *, long unsigned int, bool); + +typedef void (*btf_trace_ext4_direct_IO_enter)(void *, struct inode *, loff_t, long unsigned int, int); + +typedef void (*btf_trace_ext4_direct_IO_exit)(void *, struct inode *, loff_t, long unsigned int, int, int); + +typedef void (*btf_trace_ext4_fallocate_enter)(void *, struct inode *, loff_t, loff_t, int); + +typedef void (*btf_trace_ext4_punch_hole)(void *, struct inode *, loff_t, loff_t, int); + +typedef void (*btf_trace_ext4_zero_range)(void *, struct inode *, loff_t, loff_t, int); + +typedef void (*btf_trace_ext4_fallocate_exit)(void *, struct inode *, loff_t, unsigned int, int); + +typedef void (*btf_trace_ext4_unlink_enter)(void *, struct inode *, struct dentry *); + +typedef void (*btf_trace_ext4_unlink_exit)(void *, struct dentry *, int); + +typedef void (*btf_trace_ext4_truncate_enter)(void *, struct inode *); + +typedef void (*btf_trace_ext4_truncate_exit)(void *, struct inode *); + +typedef void (*btf_trace_ext4_ext_convert_to_initialized_enter)(void *, struct inode *, struct ext4_map_blocks *, struct ext4_extent *); + +typedef void (*btf_trace_ext4_ext_convert_to_initialized_fastpath)(void *, struct inode *, struct ext4_map_blocks *, struct ext4_extent *, struct ext4_extent *); + +typedef void (*btf_trace_ext4_ext_map_blocks_enter)(void *, struct inode *, ext4_lblk_t, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_ind_map_blocks_enter)(void *, struct inode *, ext4_lblk_t, unsigned int, unsigned int); + +typedef void (*btf_trace_ext4_ext_map_blocks_exit)(void *, struct inode *, unsigned int, struct ext4_map_blocks *, int); + +typedef void (*btf_trace_ext4_ind_map_blocks_exit)(void *, struct inode *, unsigned int, struct ext4_map_blocks *, int); + +typedef void (*btf_trace_ext4_ext_load_extent)(void *, struct inode *, ext4_lblk_t, ext4_fsblk_t); + +typedef void (*btf_trace_ext4_load_inode)(void *, struct super_block *, long unsigned int); + +typedef void (*btf_trace_ext4_journal_start)(void *, struct super_block *, int, int, int, long unsigned int); + +typedef void (*btf_trace_ext4_journal_start_reserved)(void *, struct super_block *, int, long unsigned int); + +typedef void (*btf_trace_ext4_trim_extent)(void *, struct super_block *, ext4_group_t, ext4_grpblk_t, ext4_grpblk_t); + +typedef void (*btf_trace_ext4_trim_all_free)(void *, struct super_block *, ext4_group_t, ext4_grpblk_t, ext4_grpblk_t); + +typedef void (*btf_trace_ext4_ext_handle_unwritten_extents)(void *, struct inode *, struct ext4_map_blocks *, int, unsigned int, ext4_fsblk_t); + +typedef void (*btf_trace_ext4_get_implied_cluster_alloc_exit)(void *, struct super_block *, struct ext4_map_blocks *, int); + +typedef void (*btf_trace_ext4_ext_put_in_cache)(void *, struct inode *, ext4_lblk_t, unsigned int, ext4_fsblk_t); + +typedef void (*btf_trace_ext4_ext_in_cache)(void *, struct inode *, ext4_lblk_t, int); + +typedef void (*btf_trace_ext4_find_delalloc_range)(void *, struct inode *, ext4_lblk_t, ext4_lblk_t, int, int, ext4_lblk_t); + +typedef void (*btf_trace_ext4_get_reserved_cluster_alloc)(void *, struct inode *, ext4_lblk_t, unsigned int); + +typedef void (*btf_trace_ext4_ext_show_extent)(void *, struct inode *, ext4_lblk_t, ext4_fsblk_t, short unsigned int); + +typedef void (*btf_trace_ext4_remove_blocks)(void *, struct inode *, struct ext4_extent *, ext4_lblk_t, ext4_fsblk_t, struct partial_cluster *); + +typedef void (*btf_trace_ext4_ext_rm_leaf)(void *, struct inode *, ext4_lblk_t, struct ext4_extent *, struct partial_cluster *); + +typedef void (*btf_trace_ext4_ext_rm_idx)(void *, struct inode *, ext4_fsblk_t); + +typedef void (*btf_trace_ext4_ext_remove_space)(void *, struct inode *, ext4_lblk_t, ext4_lblk_t, int); + +typedef void (*btf_trace_ext4_ext_remove_space_done)(void *, struct inode *, ext4_lblk_t, ext4_lblk_t, int, struct partial_cluster *, __le16); + +typedef void (*btf_trace_ext4_es_insert_extent)(void *, struct inode *, struct extent_status *); + +typedef void (*btf_trace_ext4_es_cache_extent)(void *, struct inode *, struct extent_status *); + +typedef void (*btf_trace_ext4_es_remove_extent)(void *, struct inode *, ext4_lblk_t, ext4_lblk_t); + +typedef void (*btf_trace_ext4_es_find_extent_range_enter)(void *, struct inode *, ext4_lblk_t); + +typedef void (*btf_trace_ext4_es_find_extent_range_exit)(void *, struct inode *, struct extent_status *); + +typedef void (*btf_trace_ext4_es_lookup_extent_enter)(void *, struct inode *, ext4_lblk_t); + +typedef void (*btf_trace_ext4_es_lookup_extent_exit)(void *, struct inode *, struct extent_status *, int); + +typedef void (*btf_trace_ext4_es_shrink_count)(void *, struct super_block *, int, int); + +typedef void (*btf_trace_ext4_es_shrink_scan_enter)(void *, struct super_block *, int, int); + +typedef void (*btf_trace_ext4_es_shrink_scan_exit)(void *, struct super_block *, int, int); + +typedef void (*btf_trace_ext4_collapse_range)(void *, struct inode *, loff_t, loff_t); + +typedef void (*btf_trace_ext4_insert_range)(void *, struct inode *, loff_t, loff_t); + +typedef void (*btf_trace_ext4_es_shrink)(void *, struct super_block *, int, u64, int, int); + +typedef void (*btf_trace_ext4_es_insert_delayed_block)(void *, struct inode *, struct extent_status *, bool); + +typedef void (*btf_trace_ext4_fsmap_low_key)(void *, struct super_block *, u32, u32, u64, u64, u64); + +typedef void (*btf_trace_ext4_fsmap_high_key)(void *, struct super_block *, u32, u32, u64, u64, u64); + +typedef void (*btf_trace_ext4_fsmap_mapping)(void *, struct super_block *, u32, u32, u64, u64, u64); + +typedef void (*btf_trace_ext4_getfsmap_low_key)(void *, struct super_block *, struct ext4_fsmap *); + +typedef void (*btf_trace_ext4_getfsmap_high_key)(void *, struct super_block *, struct ext4_fsmap *); + +typedef void (*btf_trace_ext4_getfsmap_mapping)(void *, struct super_block *, struct ext4_fsmap *); + +typedef void (*btf_trace_ext4_shutdown)(void *, struct super_block *, long unsigned int); + +typedef void (*btf_trace_ext4_error)(void *, struct super_block *, const char *, unsigned int); + +typedef void (*btf_trace_ext4_prefetch_bitmaps)(void *, struct super_block *, ext4_group_t, ext4_group_t, unsigned int); + +typedef void (*btf_trace_ext4_lazy_itable_init)(void *, struct super_block *, ext4_group_t); + +typedef void (*btf_trace_ext4_fc_replay_scan)(void *, struct super_block *, int, int); + +typedef void (*btf_trace_ext4_fc_replay)(void *, struct super_block *, int, int, int, int); + +typedef void (*btf_trace_ext4_fc_commit_start)(void *, struct super_block *); + +typedef void (*btf_trace_ext4_fc_commit_stop)(void *, struct super_block *, int, int); + +typedef void (*btf_trace_ext4_fc_stats)(void *, struct super_block *); + +typedef void (*btf_trace_ext4_fc_track_create)(void *, struct inode *, struct dentry *, int); + +typedef void (*btf_trace_ext4_fc_track_link)(void *, struct inode *, struct dentry *, int); + +typedef void (*btf_trace_ext4_fc_track_unlink)(void *, struct inode *, struct dentry *, int); + +typedef void (*btf_trace_ext4_fc_track_inode)(void *, struct inode *, int); + +typedef void (*btf_trace_ext4_fc_track_range)(void *, struct inode *, long int, long int, int); + +struct ext4_err_translation { + int code; + int errno; +}; + +enum { + Opt_bsd_df = 0, + Opt_minix_df = 1, + Opt_grpid = 2, + Opt_nogrpid = 3, + Opt_resgid = 4, + Opt_resuid = 5, + Opt_sb = 6, + Opt_err_cont = 7, + Opt_err_panic = 8, + Opt_err_ro = 9, + Opt_nouid32 = 10, + Opt_debug = 11, + Opt_removed = 12, + Opt_user_xattr = 13, + Opt_nouser_xattr = 14, + Opt_acl = 15, + Opt_noacl = 16, + Opt_auto_da_alloc = 17, + Opt_noauto_da_alloc = 18, + Opt_noload = 19, + Opt_commit = 20, + Opt_min_batch_time = 21, + Opt_max_batch_time = 22, + Opt_journal_dev = 23, + Opt_journal_path = 24, + Opt_journal_checksum = 25, + Opt_journal_async_commit = 26, + Opt_abort = 27, + Opt_data_journal = 28, + Opt_data_ordered = 29, + Opt_data_writeback = 30, + Opt_data_err_abort = 31, + Opt_data_err_ignore = 32, + Opt_test_dummy_encryption = 33, + Opt_inlinecrypt = 34, + Opt_usrjquota = 35, + Opt_grpjquota = 36, + Opt_offusrjquota = 37, + Opt_offgrpjquota = 38, + Opt_jqfmt_vfsold = 39, + Opt_jqfmt_vfsv0 = 40, + Opt_jqfmt_vfsv1 = 41, + Opt_quota = 42, + Opt_noquota = 43, + Opt_barrier = 44, + Opt_nobarrier = 45, + Opt_err___2 = 46, + Opt_usrquota = 47, + Opt_grpquota = 48, + Opt_prjquota = 49, + Opt_i_version = 50, + Opt_dax = 51, + Opt_dax_always = 52, + Opt_dax_inode = 53, + Opt_dax_never = 54, + Opt_stripe = 55, + Opt_delalloc = 56, + Opt_nodelalloc = 57, + Opt_warn_on_error = 58, + Opt_nowarn_on_error = 59, + Opt_mblk_io_submit = 60, + Opt_lazytime = 61, + Opt_nolazytime = 62, + Opt_debug_want_extra_isize = 63, + Opt_nomblk_io_submit = 64, + Opt_block_validity = 65, + Opt_noblock_validity = 66, + Opt_inode_readahead_blks = 67, + Opt_journal_ioprio = 68, + Opt_dioread_nolock = 69, + Opt_dioread_lock = 70, + Opt_discard = 71, + Opt_nodiscard = 72, + Opt_init_itable = 73, + Opt_noinit_itable = 74, + Opt_max_dir_size_kb = 75, + Opt_nojournal_checksum = 76, + Opt_nombcache = 77, + Opt_prefetch_block_bitmaps = 78, +}; + +struct mount_opts { + int token; + int mount_opt; + int flags; +}; + +struct ext4_sb_encodings { + __u16 magic; + char *name; + char *version; +}; + +struct ext4_mount_options { + long unsigned int s_mount_opt; + long unsigned int s_mount_opt2; + kuid_t s_resuid; + kgid_t s_resgid; + long unsigned int s_commit_interval; + u32 s_min_batch_time; + u32 s_max_batch_time; + int s_jquota_fmt; + char *s_qf_names[3]; +}; + +enum { + attr_noop = 0, + attr_delayed_allocation_blocks = 1, + attr_session_write_kbytes = 2, + attr_lifetime_write_kbytes = 3, + attr_reserved_clusters = 4, + attr_sra_exceeded_retry_limit = 5, + attr_inode_readahead = 6, + attr_trigger_test_error = 7, + attr_first_error_time = 8, + attr_last_error_time = 9, + attr_feature = 10, + attr_pointer_ui = 11, + attr_pointer_ul = 12, + attr_pointer_u64 = 13, + attr_pointer_u8 = 14, + attr_pointer_string = 15, + attr_pointer_atomic = 16, + attr_journal_task = 17, +}; + +enum { + ptr_explicit = 0, + ptr_ext4_sb_info_offset = 1, + ptr_ext4_super_block_offset = 2, +}; + +struct ext4_attr { + struct attribute attr; + short int attr_id; + short int attr_ptr; + short unsigned int attr_size; + union { + int offset; + void *explicit_ptr; + } u; +}; + +struct ext4_xattr_header { + __le32 h_magic; + __le32 h_refcount; + __le32 h_blocks; + __le32 h_hash; + __le32 h_checksum; + __u32 h_reserved[3]; +}; + +struct ext4_xattr_block_find { + struct ext4_xattr_search s; + struct buffer_head *bh; +}; + +struct ext4_fc_tl { + __le16 fc_tag; + __le16 fc_len; +}; + +struct ext4_fc_head { + __le32 fc_features; + __le32 fc_tid; +}; + +struct ext4_fc_add_range { + __le32 fc_ino; + __u8 fc_ex[12]; +}; + +struct ext4_fc_del_range { + __le32 fc_ino; + __le32 fc_lblk; + __le32 fc_len; +}; + +struct ext4_fc_dentry_info { + __le32 fc_parent_ino; + __le32 fc_ino; + __u8 fc_dname[0]; +}; + +struct ext4_fc_inode { + __le32 fc_ino; + __u8 fc_raw_inode[0]; +}; + +struct ext4_fc_tail { + __le32 fc_tid; + __le32 fc_crc; +}; + +struct ext4_fc_dentry_update { + int fcd_op; + int fcd_parent; + int fcd_ino; + struct qstr fcd_name; + unsigned char fcd_iname[32]; + struct list_head fcd_list; +}; + +struct __track_dentry_update_args { + struct dentry *dentry; + int op; +}; + +struct __track_range_args { + ext4_lblk_t start; + ext4_lblk_t end; +}; + +struct dentry_info_args { + int parent_ino; + int dname_len; + int ino; + int inode_len; + char *dname; +}; + +typedef struct { + __le16 e_tag; + __le16 e_perm; + __le32 e_id; +} ext4_acl_entry; + +typedef struct { + __le32 a_version; +} ext4_acl_header; + +struct commit_header { + __be32 h_magic; + __be32 h_blocktype; + __be32 h_sequence; + unsigned char h_chksum_type; + unsigned char h_chksum_size; + unsigned char h_padding[2]; + __be32 h_chksum[8]; + __be64 h_commit_sec; + __be32 h_commit_nsec; +}; + +struct journal_block_tag3_s { + __be32 t_blocknr; + __be32 t_flags; + __be32 t_blocknr_high; + __be32 t_checksum; +}; + +typedef struct journal_block_tag3_s journal_block_tag3_t; + +struct journal_block_tag_s { + __be32 t_blocknr; + __be16 t_checksum; + __be16 t_flags; + __be32 t_blocknr_high; +}; + +typedef struct journal_block_tag_s journal_block_tag_t; + +struct jbd2_journal_block_tail { + __be32 t_checksum; +}; + +struct jbd2_journal_revoke_header_s { + journal_header_t r_header; + __be32 r_count; +}; + +typedef struct jbd2_journal_revoke_header_s jbd2_journal_revoke_header_t; + +struct recovery_info { + tid_t start_transaction; + tid_t end_transaction; + int nr_replays; + int nr_revokes; + int nr_revoke_hits; +}; + +struct jbd2_revoke_table_s { + int hash_size; + int hash_shift; + struct list_head *hash_table; +}; + +struct jbd2_revoke_record_s { + struct list_head hash; + tid_t sequence; + long long unsigned int blocknr; +}; + +struct trace_event_raw_jbd2_checkpoint { + struct trace_entry ent; + dev_t dev; + int result; + char __data[0]; +}; + +struct trace_event_raw_jbd2_commit { + struct trace_entry ent; + dev_t dev; + char sync_commit; + int transaction; + char __data[0]; +}; + +struct trace_event_raw_jbd2_end_commit { + struct trace_entry ent; + dev_t dev; + char sync_commit; + int transaction; + int head; + char __data[0]; +}; + +struct trace_event_raw_jbd2_submit_inode_data { + struct trace_entry ent; + dev_t dev; + ino_t ino; + char __data[0]; +}; + +struct trace_event_raw_jbd2_handle_start_class { + struct trace_entry ent; + dev_t dev; + long unsigned int tid; + unsigned int type; + unsigned int line_no; + int requested_blocks; + char __data[0]; +}; + +struct trace_event_raw_jbd2_handle_extend { + struct trace_entry ent; + dev_t dev; + long unsigned int tid; + unsigned int type; + unsigned int line_no; + int buffer_credits; + int requested_blocks; + char __data[0]; +}; + +struct trace_event_raw_jbd2_handle_stats { + struct trace_entry ent; + dev_t dev; + long unsigned int tid; + unsigned int type; + unsigned int line_no; + int interval; + int sync; + int requested_blocks; + int dirtied_blocks; + char __data[0]; +}; + +struct trace_event_raw_jbd2_run_stats { + struct trace_entry ent; + dev_t dev; + long unsigned int tid; + long unsigned int wait; + long unsigned int request_delay; + long unsigned int running; + long unsigned int locked; + long unsigned int flushing; + long unsigned int logging; + __u32 handle_count; + __u32 blocks; + __u32 blocks_logged; + char __data[0]; +}; + +struct trace_event_raw_jbd2_checkpoint_stats { + struct trace_entry ent; + dev_t dev; + long unsigned int tid; + long unsigned int chp_time; + __u32 forced_to_close; + __u32 written; + __u32 dropped; + char __data[0]; +}; + +struct trace_event_raw_jbd2_update_log_tail { + struct trace_entry ent; + dev_t dev; + tid_t tail_sequence; + tid_t first_tid; + long unsigned int block_nr; + long unsigned int freed; + char __data[0]; +}; + +struct trace_event_raw_jbd2_write_superblock { + struct trace_entry ent; + dev_t dev; + int write_op; + char __data[0]; +}; + +struct trace_event_raw_jbd2_lock_buffer_stall { + struct trace_entry ent; + dev_t dev; + long unsigned int stall_ms; + char __data[0]; +}; + +struct trace_event_data_offsets_jbd2_checkpoint {}; + +struct trace_event_data_offsets_jbd2_commit {}; + +struct trace_event_data_offsets_jbd2_end_commit {}; + +struct trace_event_data_offsets_jbd2_submit_inode_data {}; + +struct trace_event_data_offsets_jbd2_handle_start_class {}; + +struct trace_event_data_offsets_jbd2_handle_extend {}; + +struct trace_event_data_offsets_jbd2_handle_stats {}; + +struct trace_event_data_offsets_jbd2_run_stats {}; + +struct trace_event_data_offsets_jbd2_checkpoint_stats {}; + +struct trace_event_data_offsets_jbd2_update_log_tail {}; + +struct trace_event_data_offsets_jbd2_write_superblock {}; + +struct trace_event_data_offsets_jbd2_lock_buffer_stall {}; + +typedef void (*btf_trace_jbd2_checkpoint)(void *, journal_t *, int); + +typedef void (*btf_trace_jbd2_start_commit)(void *, journal_t *, transaction_t *); + +typedef void (*btf_trace_jbd2_commit_locking)(void *, journal_t *, transaction_t *); + +typedef void (*btf_trace_jbd2_commit_flushing)(void *, journal_t *, transaction_t *); + +typedef void (*btf_trace_jbd2_commit_logging)(void *, journal_t *, transaction_t *); + +typedef void (*btf_trace_jbd2_drop_transaction)(void *, journal_t *, transaction_t *); + +typedef void (*btf_trace_jbd2_end_commit)(void *, journal_t *, transaction_t *); + +typedef void (*btf_trace_jbd2_submit_inode_data)(void *, struct inode *); + +typedef void (*btf_trace_jbd2_handle_start)(void *, dev_t, long unsigned int, unsigned int, unsigned int, int); + +typedef void (*btf_trace_jbd2_handle_restart)(void *, dev_t, long unsigned int, unsigned int, unsigned int, int); + +typedef void (*btf_trace_jbd2_handle_extend)(void *, dev_t, long unsigned int, unsigned int, unsigned int, int, int); + +typedef void (*btf_trace_jbd2_handle_stats)(void *, dev_t, long unsigned int, unsigned int, unsigned int, int, int, int, int); + +typedef void (*btf_trace_jbd2_run_stats)(void *, dev_t, long unsigned int, struct transaction_run_stats_s *); + +typedef void (*btf_trace_jbd2_checkpoint_stats)(void *, dev_t, long unsigned int, struct transaction_chp_stats_s *); + +typedef void (*btf_trace_jbd2_update_log_tail)(void *, journal_t *, tid_t, long unsigned int, long unsigned int); + +typedef void (*btf_trace_jbd2_write_superblock)(void *, journal_t *, int); + +typedef void (*btf_trace_jbd2_lock_buffer_stall)(void *, dev_t, long unsigned int); + +struct jbd2_stats_proc_session { + journal_t *journal; + struct transaction_stats_s *stats; + int start; + int max; +}; + +struct ramfs_mount_opts { + umode_t mode; +}; + +struct ramfs_fs_info { + struct ramfs_mount_opts mount_opts; +}; + +enum ramfs_param { + Opt_mode___3 = 0, +}; + +enum hugetlbfs_size_type { + NO_SIZE = 0, + SIZE_STD = 1, + SIZE_PERCENT = 2, +}; + +struct hugetlbfs_fs_context { + struct hstate *hstate; + long long unsigned int max_size_opt; + long long unsigned int min_size_opt; + long int max_hpages; + long int nr_inodes; + long int min_hpages; + enum hugetlbfs_size_type max_val_type; + enum hugetlbfs_size_type min_val_type; + kuid_t uid; + kgid_t gid; + umode_t mode; +}; + +enum hugetlb_param { + Opt_gid___4 = 0, + Opt_min_size = 1, + Opt_mode___4 = 2, + Opt_nr_inodes___2 = 3, + Opt_pagesize = 4, + Opt_size___2 = 5, + Opt_uid___3 = 6, +}; + +struct getdents_callback___2 { + struct dir_context ctx; + char *name; + u64 ino; + int found; + int sequence; +}; + +typedef u16 wchar_t; + +typedef u32 unicode_t; + +struct nls_table { + const char *charset; + const char *alias; + int (*uni2char)(wchar_t, unsigned char *, int); + int (*char2uni)(const unsigned char *, int, wchar_t *); + const unsigned char *charset2lower; + const unsigned char *charset2upper; + struct module *owner; + struct nls_table *next; +}; + +enum utf16_endian { + UTF16_HOST_ENDIAN = 0, + UTF16_LITTLE_ENDIAN = 1, + UTF16_BIG_ENDIAN = 2, +}; + +struct utf8_table { + int cmask; + int cval; + int shift; + long int lmask; + long int lval; +}; + +struct utf8data; + +struct utf8cursor { + const struct utf8data *data; + const char *s; + const char *p; + const char *ss; + const char *sp; + unsigned int len; + unsigned int slen; + short int ccc; + short int nccc; + unsigned char hangul[12]; +}; + +struct utf8data { + unsigned int maxage; + unsigned int offset; +}; + +typedef const unsigned char utf8trie_t; + +typedef const unsigned char utf8leaf_t; + +typedef unsigned int autofs_wqt_t; + +struct autofs_sb_info; + +struct autofs_info { + struct dentry *dentry; + struct inode *inode; + int flags; + struct completion expire_complete; + struct list_head active; + struct list_head expiring; + struct autofs_sb_info *sbi; + long unsigned int last_used; + int count; + kuid_t uid; + kgid_t gid; + struct callback_head rcu; +}; + +struct autofs_wait_queue; + +struct autofs_sb_info { + u32 magic; + int pipefd; + struct file *pipe; + struct pid *oz_pgrp; + int version; + int sub_version; + int min_proto; + int max_proto; + unsigned int flags; + long unsigned int exp_timeout; + unsigned int type; + struct super_block *sb; + struct mutex wq_mutex; + struct mutex pipe_mutex; + spinlock_t fs_lock; + struct autofs_wait_queue *queues; + spinlock_t lookup_lock; + struct list_head active_list; + struct list_head expiring_list; + struct callback_head rcu; +}; + +struct autofs_wait_queue { + wait_queue_head_t queue; + struct autofs_wait_queue *next; + autofs_wqt_t wait_queue_token; + struct qstr name; + u32 dev; + u64 ino; + kuid_t uid; + kgid_t gid; + pid_t pid; + pid_t tgid; + int status; + unsigned int wait_ctr; +}; + +enum { + Opt_err___3 = 0, + Opt_fd = 1, + Opt_uid___4 = 2, + Opt_gid___5 = 3, + Opt_pgrp = 4, + Opt_minproto = 5, + Opt_maxproto = 6, + Opt_indirect = 7, + Opt_direct = 8, + Opt_offset = 9, + Opt_strictexpire = 10, + Opt_ignore = 11, +}; + +struct autofs_packet_hdr { + int proto_version; + int type; +}; + +struct autofs_packet_expire { + struct autofs_packet_hdr hdr; + int len; + char name[256]; +}; + +enum { + AUTOFS_IOC_READY_CMD = 96, + AUTOFS_IOC_FAIL_CMD = 97, + AUTOFS_IOC_CATATONIC_CMD = 98, + AUTOFS_IOC_PROTOVER_CMD = 99, + AUTOFS_IOC_SETTIMEOUT_CMD = 100, + AUTOFS_IOC_EXPIRE_CMD = 101, +}; + +enum autofs_notify { + NFY_NONE = 0, + NFY_MOUNT = 1, + NFY_EXPIRE = 2, +}; + +enum { + AUTOFS_IOC_EXPIRE_MULTI_CMD = 102, + AUTOFS_IOC_PROTOSUBVER_CMD = 103, + AUTOFS_IOC_ASKUMOUNT_CMD = 112, +}; + +struct autofs_packet_missing { + struct autofs_packet_hdr hdr; + autofs_wqt_t wait_queue_token; + int len; + char name[256]; +}; + +struct autofs_packet_expire_multi { + struct autofs_packet_hdr hdr; + autofs_wqt_t wait_queue_token; + int len; + char name[256]; +}; + +union autofs_packet_union { + struct autofs_packet_hdr hdr; + struct autofs_packet_missing missing; + struct autofs_packet_expire expire; + struct autofs_packet_expire_multi expire_multi; +}; + +struct autofs_v5_packet { + struct autofs_packet_hdr hdr; + autofs_wqt_t wait_queue_token; + __u32 dev; + __u64 ino; + __u32 uid; + __u32 gid; + __u32 pid; + __u32 tgid; + __u32 len; + char name[256]; +}; + +typedef struct autofs_v5_packet autofs_packet_missing_indirect_t; + +typedef struct autofs_v5_packet autofs_packet_expire_indirect_t; + +typedef struct autofs_v5_packet autofs_packet_missing_direct_t; + +typedef struct autofs_v5_packet autofs_packet_expire_direct_t; + +union autofs_v5_packet_union { + struct autofs_packet_hdr hdr; + struct autofs_v5_packet v5_packet; + autofs_packet_missing_indirect_t missing_indirect; + autofs_packet_expire_indirect_t expire_indirect; + autofs_packet_missing_direct_t missing_direct; + autofs_packet_expire_direct_t expire_direct; +}; + +struct args_protover { + __u32 version; +}; + +struct args_protosubver { + __u32 sub_version; +}; + +struct args_openmount { + __u32 devid; +}; + +struct args_ready { + __u32 token; +}; + +struct args_fail { + __u32 token; + __s32 status; +}; + +struct args_setpipefd { + __s32 pipefd; +}; + +struct args_timeout { + __u64 timeout; +}; + +struct args_requester { + __u32 uid; + __u32 gid; +}; + +struct args_expire { + __u32 how; +}; + +struct args_askumount { + __u32 may_umount; +}; + +struct args_in { + __u32 type; +}; + +struct args_out { + __u32 devid; + __u32 magic; +}; + +struct args_ismountpoint { + union { + struct args_in in; + struct args_out out; + }; +}; + +struct autofs_dev_ioctl { + __u32 ver_major; + __u32 ver_minor; + __u32 size; + __s32 ioctlfd; + union { + struct args_protover protover; + struct args_protosubver protosubver; + struct args_openmount openmount; + struct args_ready ready; + struct args_fail fail; + struct args_setpipefd setpipefd; + struct args_timeout timeout; + struct args_requester requester; + struct args_expire expire; + struct args_askumount askumount; + struct args_ismountpoint ismountpoint; + }; + char path[0]; +}; + +enum { + AUTOFS_DEV_IOCTL_VERSION_CMD = 113, + AUTOFS_DEV_IOCTL_PROTOVER_CMD = 114, + AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD = 115, + AUTOFS_DEV_IOCTL_OPENMOUNT_CMD = 116, + AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD = 117, + AUTOFS_DEV_IOCTL_READY_CMD = 118, + AUTOFS_DEV_IOCTL_FAIL_CMD = 119, + AUTOFS_DEV_IOCTL_SETPIPEFD_CMD = 120, + AUTOFS_DEV_IOCTL_CATATONIC_CMD = 121, + AUTOFS_DEV_IOCTL_TIMEOUT_CMD = 122, + AUTOFS_DEV_IOCTL_REQUESTER_CMD = 123, + AUTOFS_DEV_IOCTL_EXPIRE_CMD = 124, + AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD = 125, + AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD = 126, +}; + +typedef int (*ioctl_fn)(struct file *, struct autofs_sb_info *, struct autofs_dev_ioctl *); + +struct debugfs_fsdata { + const struct file_operations *real_fops; + refcount_t active_users; + struct completion active_users_drained; +}; + +struct debugfs_mount_opts { + kuid_t uid; + kgid_t gid; + umode_t mode; +}; + +enum { + Opt_uid___5 = 0, + Opt_gid___6 = 1, + Opt_mode___5 = 2, + Opt_err___4 = 3, +}; + +struct debugfs_fs_info { + struct debugfs_mount_opts mount_opts; +}; + +struct debugfs_reg32 { + char *name; + long unsigned int offset; +}; + +struct debugfs_regset32 { + const struct debugfs_reg32 *regs; + int nregs; + void *base; + struct device *dev; +}; + +struct debugfs_u32_array { + u32 *array; + u32 n_elements; +}; + +struct debugfs_devm_entry { + int (*read)(struct seq_file *, void *); + struct device *dev; +}; + +struct tracefs_dir_ops { + int (*mkdir)(const char *); + int (*rmdir)(const char *); +}; + +struct tracefs_mount_opts { + kuid_t uid; + kgid_t gid; + umode_t mode; +}; + +struct tracefs_fs_info { + struct tracefs_mount_opts mount_opts; +}; + +struct btrfs_ioctl_vol_args { + __s64 fd; + char name[4088]; +}; + +struct btrfs_scrub_progress { + __u64 data_extents_scrubbed; + __u64 tree_extents_scrubbed; + __u64 data_bytes_scrubbed; + __u64 tree_bytes_scrubbed; + __u64 read_errors; + __u64 csum_errors; + __u64 verify_errors; + __u64 no_csum; + __u64 csum_discards; + __u64 super_errors; + __u64 malloc_errors; + __u64 uncorrectable_errors; + __u64 corrected_errors; + __u64 last_physical; + __u64 unverified_errors; +}; + +struct btrfs_balance_args { + __u64 profiles; + union { + __u64 usage; + struct { + __u32 usage_min; + __u32 usage_max; + }; + }; + __u64 devid; + __u64 pstart; + __u64 pend; + __u64 vstart; + __u64 vend; + __u64 target; + __u64 flags; + union { + __u64 limit; + struct { + __u32 limit_min; + __u32 limit_max; + }; + }; + __u32 stripes_min; + __u32 stripes_max; + __u64 unused[6]; +}; + +struct btrfs_balance_progress { + __u64 expected; + __u64 considered; + __u64 completed; +}; + +enum btrfs_dev_stat_values { + BTRFS_DEV_STAT_WRITE_ERRS = 0, + BTRFS_DEV_STAT_READ_ERRS = 1, + BTRFS_DEV_STAT_FLUSH_ERRS = 2, + BTRFS_DEV_STAT_CORRUPTION_ERRS = 3, + BTRFS_DEV_STAT_GENERATION_ERRS = 4, + BTRFS_DEV_STAT_VALUES_MAX = 5, +}; + +struct btrfs_disk_key { + __le64 objectid; + __u8 type; + __le64 offset; +} __attribute__((packed)); + +struct btrfs_key { + __u64 objectid; + __u8 type; + __u64 offset; +} __attribute__((packed)); + +struct btrfs_dev_item { + __le64 devid; + __le64 total_bytes; + __le64 bytes_used; + __le32 io_align; + __le32 io_width; + __le32 sector_size; + __le64 type; + __le64 generation; + __le64 start_offset; + __le32 dev_group; + __u8 seek_speed; + __u8 bandwidth; + __u8 uuid[16]; + __u8 fsid[16]; +} __attribute__((packed)); + +struct btrfs_inode_ref { + __le64 index; + __le16 name_len; +} __attribute__((packed)); + +struct btrfs_timespec { + __le64 sec; + __le32 nsec; +} __attribute__((packed)); + +struct btrfs_inode_item { + __le64 generation; + __le64 transid; + __le64 size; + __le64 nbytes; + __le64 block_group; + __le32 nlink; + __le32 uid; + __le32 gid; + __le32 mode; + __le64 rdev; + __le64 flags; + __le64 sequence; + __le64 reserved[4]; + struct btrfs_timespec atime; + struct btrfs_timespec ctime; + struct btrfs_timespec mtime; + struct btrfs_timespec otime; +} __attribute__((packed)); + +struct btrfs_dir_item { + struct btrfs_disk_key location; + __le64 transid; + __le16 data_len; + __le16 name_len; + __u8 type; +} __attribute__((packed)); + +struct btrfs_root_item { + struct btrfs_inode_item inode; + __le64 generation; + __le64 root_dirid; + __le64 bytenr; + __le64 byte_limit; + __le64 bytes_used; + __le64 last_snapshot; + __le64 flags; + __le32 refs; + struct btrfs_disk_key drop_progress; + __u8 drop_level; + __u8 level; + __le64 generation_v2; + __u8 uuid[16]; + __u8 parent_uuid[16]; + __u8 received_uuid[16]; + __le64 ctransid; + __le64 otransid; + __le64 stransid; + __le64 rtransid; + struct btrfs_timespec ctime; + struct btrfs_timespec otime; + struct btrfs_timespec stime; + struct btrfs_timespec rtime; + __le64 reserved[8]; +} __attribute__((packed)); + +struct btrfs_root_ref { + __le64 dirid; + __le64 sequence; + __le16 name_len; +} __attribute__((packed)); + +enum { + BTRFS_FILE_EXTENT_INLINE = 0, + BTRFS_FILE_EXTENT_REG = 1, + BTRFS_FILE_EXTENT_PREALLOC = 2, + BTRFS_NR_FILE_EXTENT_TYPES = 3, +}; + +struct btrfs_file_extent_item { + __le64 generation; + __le64 ram_bytes; + __u8 compression; + __u8 encryption; + __le16 other_encoding; + __u8 type; + __le64 disk_bytenr; + __le64 disk_num_bytes; + __le64 offset; + __le64 num_bytes; +} __attribute__((packed)); + +enum btrfs_raid_types { + BTRFS_RAID_RAID10 = 0, + BTRFS_RAID_RAID1 = 1, + BTRFS_RAID_DUP = 2, + BTRFS_RAID_RAID0 = 3, + BTRFS_RAID_SINGLE = 4, + BTRFS_RAID_RAID5 = 5, + BTRFS_RAID_RAID6 = 6, + BTRFS_RAID_RAID1C3 = 7, + BTRFS_RAID_RAID1C4 = 8, + BTRFS_NR_RAID_TYPES = 9, +}; + +enum { + IO_TREE_FS_PINNED_EXTENTS = 0, + IO_TREE_FS_EXCLUDED_EXTENTS = 1, + IO_TREE_BTREE_INODE_IO = 2, + IO_TREE_INODE_IO = 3, + IO_TREE_INODE_IO_FAILURE = 4, + IO_TREE_RELOC_BLOCKS = 5, + IO_TREE_TRANS_DIRTY_PAGES = 6, + IO_TREE_ROOT_DIRTY_LOG_PAGES = 7, + IO_TREE_INODE_FILE_EXTENT = 8, + IO_TREE_LOG_CSUM_RANGE = 9, + IO_TREE_SELFTEST = 10, + IO_TREE_DEVICE_ALLOC_STATE = 11, +}; + +struct btrfs_fs_info; + +struct extent_io_tree { + struct rb_root state; + struct btrfs_fs_info *fs_info; + void *private_data; + u64 dirty_bytes; + bool track_uptodate; + u8 owner; + spinlock_t lock; +}; + +struct extent_map_tree { + struct rb_root_cached map; + struct list_head modified_extents; + rwlock_t lock; +}; + +struct btrfs_space_info; + +struct btrfs_block_rsv { + u64 size; + u64 reserved; + struct btrfs_space_info *space_info; + spinlock_t lock; + short unsigned int full; + short unsigned int type; + short unsigned int failfast; + u64 qgroup_rsv_size; + u64 qgroup_rsv_reserved; +}; + +struct btrfs_block_group; + +struct btrfs_free_cluster { + spinlock_t lock; + spinlock_t refill_lock; + struct rb_root root; + u64 max_size; + u64 window_start; + bool fragmented; + struct btrfs_block_group *block_group; + struct list_head block_group_list; +}; + +struct btrfs_discard_ctl { + struct workqueue_struct *discard_workers; + struct delayed_work work; + spinlock_t lock; + struct btrfs_block_group *block_group; + struct list_head discard_list[3]; + u64 prev_discard; + u64 prev_discard_time; + atomic_t discardable_extents; + atomic64_t discardable_bytes; + u64 max_discard_size; + u64 delay_ms; + u32 iops_limit; + u32 kbps_limit; + u64 discard_extent_bytes; + u64 discard_bitmap_bytes; + atomic64_t discard_bytes_saved; +}; + +struct btrfs_work; + +typedef void (*btrfs_func_t)(struct btrfs_work *); + +struct __btrfs_workqueue; + +struct btrfs_work { + btrfs_func_t func; + btrfs_func_t ordered_func; + btrfs_func_t ordered_free; + struct work_struct normal_work; + struct list_head ordered_list; + struct __btrfs_workqueue *wq; + long unsigned int flags; +}; + +struct btrfs_device; + +struct btrfs_dev_replace { + u64 replace_state; + time64_t time_started; + time64_t time_stopped; + atomic64_t num_write_errors; + atomic64_t num_uncorrectable_read_errors; + u64 cursor_left; + u64 committed_cursor_left; + u64 cursor_left_last_write_of_item; + u64 cursor_right; + u64 cont_reading_from_srcdev_mode; + int is_valid; + int item_needs_writeback; + struct btrfs_device *srcdev; + struct btrfs_device *tgtdev; + struct mutex lock_finishing_cancel_unmount; + struct rw_semaphore rwsem; + struct btrfs_scrub_progress scrub_progress; + struct percpu_counter bio_counter; + wait_queue_head_t replace_wait; +}; + +struct btrfs_root; + +struct btrfs_transaction; + +struct btrfs_super_block; + +struct btrfs_stripe_hash_table; + +struct btrfs_workqueue; + +struct btrfs_fs_devices; + +struct reloc_control; + +struct btrfs_balance_control; + +struct ulist; + +struct btrfs_delayed_root; + +struct btrfs_fs_info { + u8 chunk_tree_uuid[16]; + long unsigned int flags; + struct btrfs_root *extent_root; + struct btrfs_root *tree_root; + struct btrfs_root *chunk_root; + struct btrfs_root *dev_root; + struct btrfs_root *fs_root; + struct btrfs_root *csum_root; + struct btrfs_root *quota_root; + struct btrfs_root *uuid_root; + struct btrfs_root *free_space_root; + struct btrfs_root *data_reloc_root; + struct btrfs_root *log_root_tree; + spinlock_t fs_roots_radix_lock; + struct xarray fs_roots_radix; + spinlock_t block_group_cache_lock; + u64 first_logical_byte; + struct rb_root block_group_cache_tree; + atomic64_t free_chunk_space; + struct extent_io_tree excluded_extents; + struct extent_map_tree mapping_tree; + struct btrfs_block_rsv global_block_rsv; + struct btrfs_block_rsv trans_block_rsv; + struct btrfs_block_rsv chunk_block_rsv; + struct btrfs_block_rsv delayed_block_rsv; + struct btrfs_block_rsv delayed_refs_rsv; + struct btrfs_block_rsv empty_block_rsv; + u64 generation; + u64 last_trans_committed; + u64 avg_delayed_ref_runtime; + u64 last_trans_log_full_commit; + long unsigned int mount_opt; + long unsigned int pending_changes; + long unsigned int compress_type: 4; + unsigned int compress_level; + u32 commit_interval; + u64 max_inline; + struct btrfs_transaction *running_transaction; + wait_queue_head_t transaction_throttle; + wait_queue_head_t transaction_wait; + wait_queue_head_t transaction_blocked_wait; + wait_queue_head_t async_submit_wait; + spinlock_t super_lock; + struct btrfs_super_block *super_copy; + struct btrfs_super_block *super_for_commit; + struct super_block *sb; + struct inode *btree_inode; + struct mutex tree_log_mutex; + struct mutex transaction_kthread_mutex; + struct mutex cleaner_mutex; + struct mutex chunk_mutex; + struct mutex ro_block_group_mutex; + struct btrfs_stripe_hash_table *stripe_hash_table; + struct mutex ordered_operations_mutex; + struct rw_semaphore commit_root_sem; + struct rw_semaphore cleanup_work_sem; + struct rw_semaphore subvol_sem; + spinlock_t trans_lock; + struct mutex reloc_mutex; + struct list_head trans_list; + struct list_head dead_roots; + struct list_head caching_block_groups; + spinlock_t delayed_iput_lock; + struct list_head delayed_iputs; + atomic_t nr_delayed_iputs; + wait_queue_head_t delayed_iputs_wait; + atomic64_t tree_mod_seq; + rwlock_t tree_mod_log_lock; + struct rb_root tree_mod_log; + struct list_head tree_mod_seq_list; + atomic_t async_delalloc_pages; + spinlock_t ordered_root_lock; + struct list_head ordered_roots; + struct mutex delalloc_root_mutex; + spinlock_t delalloc_root_lock; + struct list_head delalloc_roots; + struct btrfs_workqueue *workers; + struct btrfs_workqueue *delalloc_workers; + struct btrfs_workqueue *flush_workers; + struct btrfs_workqueue *endio_workers; + struct btrfs_workqueue *endio_meta_workers; + struct btrfs_workqueue *endio_raid56_workers; + struct btrfs_workqueue *rmw_workers; + struct btrfs_workqueue *endio_meta_write_workers; + struct btrfs_workqueue *endio_write_workers; + struct btrfs_workqueue *endio_freespace_worker; + struct btrfs_workqueue *caching_workers; + struct btrfs_workqueue *readahead_workers; + struct btrfs_workqueue *fixup_workers; + struct btrfs_workqueue *delayed_workers; + struct task_struct *transaction_kthread; + struct task_struct *cleaner_kthread; + u32 thread_pool_size; + struct kobject *space_info_kobj; + struct kobject *qgroups_kobj; + u64 total_pinned; + struct percpu_counter dirty_metadata_bytes; + struct percpu_counter delalloc_bytes; + struct percpu_counter dio_bytes; + s32 dirty_metadata_batch; + s32 delalloc_batch; + struct list_head dirty_cowonly_roots; + struct btrfs_fs_devices *fs_devices; + struct list_head space_info; + struct btrfs_space_info *data_sinfo; + struct reloc_control *reloc_ctl; + struct btrfs_free_cluster data_alloc_cluster; + struct btrfs_free_cluster meta_alloc_cluster; + spinlock_t defrag_inodes_lock; + struct rb_root defrag_inodes; + atomic_t defrag_running; + seqlock_t profiles_lock; + u64 avail_data_alloc_bits; + u64 avail_metadata_alloc_bits; + u64 avail_system_alloc_bits; + spinlock_t balance_lock; + struct mutex balance_mutex; + atomic_t balance_pause_req; + atomic_t balance_cancel_req; + struct btrfs_balance_control *balance_ctl; + wait_queue_head_t balance_wait_q; + u32 data_chunk_allocations; + u32 metadata_ratio; + void *bdev_holder; + struct mutex scrub_lock; + atomic_t scrubs_running; + atomic_t scrub_pause_req; + atomic_t scrubs_paused; + atomic_t scrub_cancel_req; + wait_queue_head_t scrub_pause_wait; + refcount_t scrub_workers_refcnt; + struct btrfs_workqueue *scrub_workers; + struct btrfs_workqueue *scrub_wr_completion_workers; + struct btrfs_workqueue *scrub_parity_workers; + struct btrfs_discard_ctl discard_ctl; + u64 qgroup_flags; + struct rb_root qgroup_tree; + spinlock_t qgroup_lock; + struct ulist *qgroup_ulist; + struct mutex qgroup_ioctl_lock; + struct list_head dirty_qgroups; + u64 qgroup_seq; + struct mutex qgroup_rescan_lock; + struct btrfs_key qgroup_rescan_progress; + struct btrfs_workqueue *qgroup_rescan_workers; + struct completion qgroup_rescan_completion; + struct btrfs_work qgroup_rescan_work; + bool qgroup_rescan_running; + long unsigned int fs_state; + struct btrfs_delayed_root *delayed_root; + spinlock_t reada_lock; + struct xarray reada_tree; + atomic_t reada_works_cnt; + spinlock_t buffer_lock; + struct xarray buffer_radix; + int backup_root_index; + struct btrfs_dev_replace dev_replace; + struct semaphore uuid_tree_rescan_sem; + struct work_struct async_reclaim_work; + struct work_struct async_data_reclaim_work; + spinlock_t unused_bgs_lock; + struct list_head unused_bgs; + struct mutex unused_bg_unpin_mutex; + struct mutex delete_unused_bgs_mutex; + u32 nodesize; + u32 sectorsize; + u32 sectorsize_bits; + u32 csum_size; + u32 csums_per_leaf; + u32 stripesize; + spinlock_t swapfile_pins_lock; + struct rb_root swapfile_pins; + struct crypto_shash *csum_shash; + int send_in_progress; + long unsigned int exclusive_operation; + union { + u64 zone_size; + u64 zoned; + }; + u64 max_zone_append_size; +}; + +struct io_failure_record; + +struct extent_state { + u64 start; + u64 end; + struct rb_node rb_node; + wait_queue_head_t wq; + refcount_t refs; + u32 state; + struct io_failure_record *failrec; +}; + +struct io_failure_record { + struct page *page; + u64 start; + u64 len; + u64 logical; + long unsigned int bio_flags; + int this_mirror; + int failed_mirror; + int in_validation; +}; + +struct ulist { + long unsigned int nnodes; + struct list_head nodes; + struct rb_root root; +}; + +struct extent_buffer { + u64 start; + long unsigned int len; + long unsigned int bflags; + struct btrfs_fs_info *fs_info; + spinlock_t refs_lock; + atomic_t refs; + atomic_t io_pages; + int read_mirror; + struct callback_head callback_head; + pid_t lock_owner; + s8 log_index; + struct rw_semaphore lock; + struct page *pages[16]; +}; + +struct map_lookup; + +struct extent_map { + struct rb_node rb_node; + u64 start; + u64 len; + u64 mod_start; + u64 mod_len; + u64 orig_start; + u64 orig_block_len; + u64 ram_bytes; + u64 block_start; + u64 block_len; + u64 generation; + long unsigned int flags; + struct map_lookup *map_lookup; + refcount_t refs; + unsigned int compress_type; + struct list_head list; +}; + +struct btrfs_ordered_inode_tree { + spinlock_t lock; + struct rb_root tree; + struct rb_node *last; +}; + +struct btrfs_delayed_node; + +struct btrfs_inode { + struct btrfs_root *root; + struct btrfs_key location; + spinlock_t lock; + struct extent_map_tree extent_tree; + struct extent_io_tree io_tree; + struct extent_io_tree io_failure_tree; + struct extent_io_tree file_extent_tree; + struct mutex log_mutex; + struct btrfs_ordered_inode_tree ordered_tree; + struct list_head delalloc_inodes; + struct rb_node rb_node; + long unsigned int runtime_flags; + atomic_t sync_writers; + u64 generation; + u64 last_trans; + u64 logged_trans; + int last_sub_trans; + int last_log_commit; + u64 delalloc_bytes; + u64 new_delalloc_bytes; + u64 defrag_bytes; + u64 disk_i_size; + u64 index_cnt; + u64 dir_index; + u64 last_unlink_trans; + u64 last_reflink_trans; + u64 csum_bytes; + u32 flags; + unsigned int outstanding_extents; + struct btrfs_block_rsv block_rsv; + unsigned int prop_compress; + unsigned int defrag_compress; + struct btrfs_delayed_node *delayed_node; + struct timespec64 i_otime; + struct list_head delayed_iput; + struct inode vfs_inode; +}; + +enum { + EXTENT_FLAG_PINNED = 0, + EXTENT_FLAG_COMPRESSED = 1, + EXTENT_FLAG_PREALLOC = 2, + EXTENT_FLAG_LOGGING = 3, + EXTENT_FLAG_FILLING = 4, + EXTENT_FLAG_FS_MAPPING = 5, +}; + +struct btrfs_bio_stripe { + struct btrfs_device *dev; + u64 physical; + u64 length; +}; + +struct map_lookup { + u64 type; + int io_align; + int io_width; + u64 stripe_len; + int num_stripes; + int sub_stripes; + int verified_stripes; + struct btrfs_bio_stripe stripes[0]; +}; + +struct __btrfs_workqueue { + struct workqueue_struct *normal_wq; + struct btrfs_fs_info *fs_info; + struct list_head ordered_list; + spinlock_t list_lock; + atomic_t pending; + int limit_active; + int current_active; + int thresh; + unsigned int count; + spinlock_t thres_lock; +}; + +struct btrfs_space_info { + spinlock_t lock; + u64 total_bytes; + u64 bytes_used; + u64 bytes_pinned; + u64 bytes_reserved; + u64 bytes_may_use; + u64 bytes_readonly; + u64 max_extent_size; + unsigned int full: 1; + unsigned int chunk_alloc: 1; + unsigned int flush: 1; + unsigned int force_alloc; + u64 disk_used; + u64 disk_total; + u64 flags; + struct percpu_counter total_bytes_pinned; + struct list_head list; + struct list_head ro_bgs; + struct list_head priority_tickets; + struct list_head tickets; + u64 reclaim_size; + u64 tickets_id; + struct rw_semaphore groups_sem; + struct list_head block_groups[9]; + struct kobject kobj; + struct kobject *block_group_kobjs[9]; +}; + +enum btrfs_lock_nesting { + BTRFS_NESTING_NORMAL = 0, + BTRFS_NESTING_COW = 1, + BTRFS_NESTING_LEFT = 2, + BTRFS_NESTING_RIGHT = 3, + BTRFS_NESTING_LEFT_COW = 4, + BTRFS_NESTING_RIGHT_COW = 5, + BTRFS_NESTING_SPLIT = 6, + BTRFS_NESTING_NEW_ROOT = 7, + BTRFS_NESTING_MAX = 8, +}; + +struct btrfs_drew_lock { + atomic_t readers; + struct percpu_counter writers; + wait_queue_head_t pending_writers; + wait_queue_head_t pending_readers; +}; + +enum { + BTRFS_FS_STATE_ERROR = 0, + BTRFS_FS_STATE_REMOUNTING = 1, + BTRFS_FS_STATE_RO = 2, + BTRFS_FS_STATE_TRANS_ABORTED = 3, + BTRFS_FS_STATE_DEV_REPLACING = 4, + BTRFS_FS_STATE_DUMMY_FS_INFO = 5, +}; + +struct btrfs_header { + u8 csum[32]; + u8 fsid[16]; + __le64 bytenr; + __le64 flags; + u8 chunk_tree_uuid[16]; + __le64 generation; + __le64 owner; + __le32 nritems; + u8 level; +} __attribute__((packed)); + +struct btrfs_root_backup { + __le64 tree_root; + __le64 tree_root_gen; + __le64 chunk_root; + __le64 chunk_root_gen; + __le64 extent_root; + __le64 extent_root_gen; + __le64 fs_root; + __le64 fs_root_gen; + __le64 dev_root; + __le64 dev_root_gen; + __le64 csum_root; + __le64 csum_root_gen; + __le64 total_bytes; + __le64 bytes_used; + __le64 num_devices; + __le64 unused_64[4]; + u8 tree_root_level; + u8 chunk_root_level; + u8 extent_root_level; + u8 fs_root_level; + u8 dev_root_level; + u8 csum_root_level; + u8 unused_8[10]; +}; + +struct btrfs_super_block { + u8 csum[32]; + u8 fsid[16]; + __le64 bytenr; + __le64 flags; + __le64 magic; + __le64 generation; + __le64 root; + __le64 chunk_root; + __le64 log_root; + __le64 log_root_transid; + __le64 total_bytes; + __le64 bytes_used; + __le64 root_dir_objectid; + __le64 num_devices; + __le32 sectorsize; + __le32 nodesize; + __le32 __unused_leafsize; + __le32 stripesize; + __le32 sys_chunk_array_size; + __le64 chunk_root_generation; + __le64 compat_flags; + __le64 compat_ro_flags; + __le64 incompat_flags; + __le16 csum_type; + u8 root_level; + u8 chunk_root_level; + u8 log_root_level; + struct btrfs_dev_item dev_item; + char label[256]; + __le64 cache_generation; + __le64 uuid_tree_generation; + u8 metadata_uuid[16]; + __le64 reserved[28]; + u8 sys_chunk_array[2048]; + struct btrfs_root_backup super_roots[4]; +} __attribute__((packed)); + +struct btrfs_item { + struct btrfs_disk_key key; + __le32 offset; + __le32 size; +} __attribute__((packed)); + +struct btrfs_path { + struct extent_buffer *nodes[8]; + int slots[8]; + u8 locks[8]; + u8 reada; + u8 lowest_level; + unsigned int search_for_split: 1; + unsigned int keep_locks: 1; + unsigned int skip_locking: 1; + unsigned int search_commit_root: 1; + unsigned int need_commit_sem: 1; + unsigned int skip_release_on_error: 1; + unsigned int search_for_extension: 1; +}; + +struct rcu_string; + +struct btrfs_zoned_device_info; + +struct scrub_ctx; + +struct reada_zone; + +struct btrfs_device { + struct list_head dev_list; + struct list_head dev_alloc_list; + struct list_head post_commit_list; + struct btrfs_fs_devices *fs_devices; + struct btrfs_fs_info *fs_info; + struct rcu_string *name; + u64 generation; + struct block_device *bdev; + struct btrfs_zoned_device_info *zone_info; + fmode_t mode; + long unsigned int dev_state; + blk_status_t last_flush_error; + u64 devid; + u64 total_bytes; + u64 disk_total_bytes; + u64 bytes_used; + u32 io_align; + u32 io_width; + u64 type; + u32 sector_size; + u8 uuid[16]; + u64 commit_total_bytes; + u64 commit_bytes_used; + struct bio *flush_bio; + struct completion flush_wait; + struct scrub_ctx *scrub_ctx; + atomic_t reada_in_flight; + u64 reada_next; + struct reada_zone *reada_curr_zone; + struct xarray reada_zones; + struct xarray reada_extents; + int dev_stats_valid; + atomic_t dev_stats_ccnt; + atomic_t dev_stat_values[5]; + struct extent_io_tree alloc_state; + struct completion kobj_unregister; + struct kobject devid_kobj; +}; + +enum btrfs_discard_state { + BTRFS_DISCARD_EXTENTS = 0, + BTRFS_DISCARD_BITMAPS = 1, + BTRFS_DISCARD_RESET_CURSOR = 2, +}; + +struct btrfs_io_ctl { + void *cur; + void *orig; + struct page *page; + struct page **pages; + struct btrfs_fs_info *fs_info; + struct inode *inode; + long unsigned int size; + int index; + int num_pages; + int entries; + int bitmaps; +}; + +struct btrfs_full_stripe_locks_tree { + struct rb_root root; + struct mutex lock; +}; + +struct btrfs_caching_control; + +struct btrfs_free_space_ctl; + +struct btrfs_block_group { + struct btrfs_fs_info *fs_info; + struct inode *inode; + spinlock_t lock; + u64 start; + u64 length; + u64 pinned; + u64 reserved; + u64 used; + u64 delalloc_bytes; + u64 bytes_super; + u64 flags; + u64 cache_generation; + u32 bitmap_high_thresh; + u32 bitmap_low_thresh; + struct rw_semaphore data_rwsem; + long unsigned int full_stripe_len; + unsigned int ro; + unsigned int iref: 1; + unsigned int has_caching_ctl: 1; + unsigned int removed: 1; + int disk_cache_state; + int cached; + struct btrfs_caching_control *caching_ctl; + u64 last_byte_to_unpin; + struct btrfs_space_info *space_info; + struct btrfs_free_space_ctl *free_space_ctl; + struct rb_node cache_node; + struct list_head list; + refcount_t refs; + struct list_head cluster_list; + struct list_head bg_list; + struct list_head ro_list; + atomic_t frozen; + struct list_head discard_list; + int discard_index; + u64 discard_eligible_time; + u64 discard_cursor; + enum btrfs_discard_state discard_state; + struct list_head dirty_list; + struct list_head io_list; + struct btrfs_io_ctl io_ctl; + atomic_t reservations; + atomic_t nocow_writers; + struct mutex free_space_lock; + int needs_free_space; + int swap_extents; + struct btrfs_full_stripe_locks_tree full_stripe_locks_root; +}; + +enum { + BTRFS_FS_BARRIER = 0, + BTRFS_FS_CLOSING_START = 1, + BTRFS_FS_CLOSING_DONE = 2, + BTRFS_FS_LOG_RECOVERING = 3, + BTRFS_FS_OPEN = 4, + BTRFS_FS_QUOTA_ENABLED = 5, + BTRFS_FS_UPDATE_UUID_TREE_GEN = 6, + BTRFS_FS_CREATING_FREE_SPACE_TREE = 7, + BTRFS_FS_BTREE_ERR = 8, + BTRFS_FS_LOG1_ERR = 9, + BTRFS_FS_LOG2_ERR = 10, + BTRFS_FS_QUOTA_OVERRIDE = 11, + BTRFS_FS_FROZEN = 12, + BTRFS_FS_BALANCE_RUNNING = 13, + BTRFS_FS_CLEANER_RUNNING = 14, + BTRFS_FS_CSUM_IMPL_FAST = 15, + BTRFS_FS_DISCARD_RUNNING = 16, + BTRFS_FS_CLEANUP_SPACE_CACHE_V1 = 17, + BTRFS_FS_FREE_SPACE_TREE_UNTRUSTED = 18, +}; + +struct btrfs_qgroup_swapped_blocks { + spinlock_t lock; + bool swapped; + struct rb_root blocks[8]; +}; + +struct btrfs_root { + struct extent_buffer *node; + struct extent_buffer *commit_root; + struct btrfs_root *log_root; + struct btrfs_root *reloc_root; + long unsigned int state; + struct btrfs_root_item root_item; + struct btrfs_key root_key; + struct btrfs_fs_info *fs_info; + struct extent_io_tree dirty_log_pages; + struct mutex objectid_mutex; + spinlock_t accounting_lock; + int: 32; + struct btrfs_block_rsv *block_rsv; + struct mutex log_mutex; + wait_queue_head_t log_writer_wait; + wait_queue_head_t log_commit_wait[2]; + struct list_head log_ctxs[2]; + atomic_t log_writers; + atomic_t log_commit[2]; + atomic_t log_batch; + int log_transid; + int log_transid_committed; + int last_log_commit; + pid_t log_start_pid; + u64 last_trans; + u32 type; + int: 32; + u64 highest_objectid; + struct btrfs_key defrag_progress; + struct btrfs_key defrag_max; + long: 48; + struct list_head dirty_list; + struct list_head root_list; + spinlock_t log_extents_lock[2]; + struct list_head logged_list[2]; + int orphan_cleanup_state; + spinlock_t inode_lock; + struct rb_root inode_tree; + struct xarray delayed_nodes_tree; + dev_t anon_dev; + spinlock_t root_item_lock; + refcount_t refs; + int: 32; + struct mutex delalloc_mutex; + spinlock_t delalloc_lock; + int: 32; + struct list_head delalloc_inodes; + struct list_head delalloc_root; + u64 nr_delalloc_inodes; + struct mutex ordered_extent_mutex; + spinlock_t ordered_extent_lock; + int: 32; + struct list_head ordered_extents; + struct list_head ordered_root; + u64 nr_ordered_extents; + struct list_head reloc_dirty_list; + int send_in_progress; + int dedupe_in_progress; + struct btrfs_drew_lock snapshot_lock; + atomic_t snapshot_force_cow; + spinlock_t qgroup_meta_rsv_lock; + u64 qgroup_meta_rsv_pertrans; + u64 qgroup_meta_rsv_prealloc; + wait_queue_head_t qgroup_flush_wait; + atomic_t nr_swapfiles; + int: 32; + struct btrfs_qgroup_swapped_blocks swapped_blocks; + struct extent_io_tree log_csum_range; +} __attribute__((packed)); + +enum btrfs_trans_state { + TRANS_STATE_RUNNING = 0, + TRANS_STATE_COMMIT_START = 1, + TRANS_STATE_COMMIT_DOING = 2, + TRANS_STATE_UNBLOCKED = 3, + TRANS_STATE_COMPLETED = 4, + TRANS_STATE_MAX = 5, +}; + +struct btrfs_delayed_ref_root { + struct rb_root_cached href_root; + struct rb_root dirty_extent_root; + spinlock_t lock; + atomic_t num_entries; + long unsigned int num_heads; + long unsigned int num_heads_ready; + u64 pending_csums; + int flushing; + u64 run_delayed_start; + u64 qgroup_to_skip; +}; + +struct btrfs_transaction { + u64 transid; + atomic_t num_extwriters; + atomic_t num_writers; + refcount_t use_count; + long unsigned int flags; + enum btrfs_trans_state state; + int aborted; + struct list_head list; + struct extent_io_tree dirty_pages; + time64_t start_time; + wait_queue_head_t writer_wait; + wait_queue_head_t commit_wait; + struct list_head pending_snapshots; + struct list_head dev_update_list; + struct list_head switch_commits; + struct list_head dirty_bgs; + struct list_head io_bgs; + struct list_head dropped_roots; + struct extent_io_tree pinned_extents; + struct mutex cache_write_mutex; + spinlock_t dirty_bgs_lock; + struct list_head deleted_bgs; + spinlock_t dropped_roots_lock; + struct btrfs_delayed_ref_root delayed_refs; + struct btrfs_fs_info *fs_info; + atomic_t pending_ordered; + wait_queue_head_t pending_wait; +}; + +enum btrfs_chunk_allocation_policy { + BTRFS_CHUNK_ALLOC_REGULAR = 0, +}; + +enum btrfs_read_policy { + BTRFS_READ_POLICY_PID = 0, + BTRFS_NR_READ_POLICY = 1, +}; + +struct btrfs_fs_devices { + u8 fsid[16]; + u8 metadata_uuid[16]; + bool fsid_change; + struct list_head fs_list; + u64 num_devices; + u64 open_devices; + u64 rw_devices; + u64 missing_devices; + u64 total_rw_bytes; + u64 total_devices; + u64 latest_generation; + struct block_device *latest_bdev; + struct mutex device_list_mutex; + struct list_head devices; + struct list_head alloc_list; + struct list_head seed_list; + bool seeding; + int opened; + bool rotating; + struct btrfs_fs_info *fs_info; + struct kobject fsid_kobj; + struct kobject *devices_kobj; + struct kobject *devinfo_kobj; + struct completion kobj_unregister; + enum btrfs_chunk_allocation_policy chunk_alloc_policy; + enum btrfs_read_policy read_policy; +}; + +struct btrfs_balance_control { + struct btrfs_balance_args data; + struct btrfs_balance_args meta; + struct btrfs_balance_args sys; + u64 flags; + struct btrfs_balance_progress stat; +}; + +struct btrfs_delayed_root { + spinlock_t lock; + struct list_head node_list; + struct list_head prepare_list; + atomic_t items; + atomic_t items_seq; + int nodes; + wait_queue_head_t wait; +}; + +enum btrfs_reserve_flush_enum { + BTRFS_RESERVE_NO_FLUSH = 0, + BTRFS_RESERVE_FLUSH_LIMIT = 1, + BTRFS_RESERVE_FLUSH_EVICT = 2, + BTRFS_RESERVE_FLUSH_DATA = 3, + BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE = 4, + BTRFS_RESERVE_FLUSH_ALL = 5, + BTRFS_RESERVE_FLUSH_ALL_STEAL = 6, +}; + +enum btrfs_flush_state { + FLUSH_DELAYED_ITEMS_NR = 1, + FLUSH_DELAYED_ITEMS = 2, + FLUSH_DELAYED_REFS_NR = 3, + FLUSH_DELAYED_REFS = 4, + FLUSH_DELALLOC = 5, + FLUSH_DELALLOC_WAIT = 6, + ALLOC_CHUNK = 7, + ALLOC_CHUNK_FORCE = 8, + RUN_DELAYED_IPUTS = 9, + COMMIT_TRANS = 10, +}; + +struct btrfs_delayed_node { + u64 inode_id; + u64 bytes_reserved; + struct btrfs_root *root; + struct list_head n_list; + struct list_head p_list; + struct rb_root_cached ins_root; + struct rb_root_cached del_root; + struct mutex mutex; + struct btrfs_inode_item inode_item; + refcount_t refs; + u64 index_cnt; + long unsigned int flags; + int count; +}; + +enum { + BTRFS_ORDERED_IO_DONE = 0, + BTRFS_ORDERED_COMPLETE = 1, + BTRFS_ORDERED_NOCOW = 2, + BTRFS_ORDERED_COMPRESSED = 3, + BTRFS_ORDERED_PREALLOC = 4, + BTRFS_ORDERED_DIRECT = 5, + BTRFS_ORDERED_IOERR = 6, + BTRFS_ORDERED_TRUNCATED = 7, + BTRFS_ORDERED_REGULAR = 8, + BTRFS_ORDERED_LOGGED = 9, + BTRFS_ORDERED_LOGGED_CSUM = 10, + BTRFS_ORDERED_PENDING = 11, +}; + +struct btrfs_ordered_extent { + u64 file_offset; + u64 disk_bytenr; + u64 num_bytes; + u64 disk_num_bytes; + u64 bytes_left; + u64 outstanding_isize; + u64 truncated_len; + long unsigned int flags; + int compress_type; + int qgroup_rsv; + refcount_t refs; + struct inode *inode; + struct list_head list; + struct list_head log_list; + wait_queue_head_t wait; + struct rb_node rb_node; + struct list_head root_extent_list; + struct btrfs_work work; + struct completion completion; + struct btrfs_work flush_work; + struct list_head work_list; +}; + +struct btrfs_delayed_ref_node { + struct rb_node ref_node; + struct list_head add_list; + u64 bytenr; + u64 num_bytes; + u64 seq; + refcount_t refs; + int ref_mod; + unsigned int action: 8; + unsigned int type: 8; + unsigned int is_head: 1; + unsigned int in_tree: 1; +}; + +struct btrfs_delayed_extent_op { + struct btrfs_disk_key key; + u8 level; + bool update_key; + bool update_flags; + bool is_data; + u64 flags_to_set; +}; + +struct btrfs_delayed_ref_head { + u64 bytenr; + u64 num_bytes; + refcount_t refs; + struct mutex mutex; + spinlock_t lock; + struct rb_root_cached ref_tree; + struct list_head ref_add_list; + struct rb_node href_node; + struct btrfs_delayed_extent_op *extent_op; + int total_ref_mod; + int ref_mod; + unsigned int must_insert_reserved: 1; + unsigned int is_data: 1; + unsigned int is_system: 1; + unsigned int processing: 1; +}; + +struct btrfs_delayed_tree_ref { + struct btrfs_delayed_ref_node node; + u64 root; + u64 parent; + int level; +}; + +struct btrfs_delayed_data_ref { + struct btrfs_delayed_ref_node node; + u64 root; + u64 parent; + u64 objectid; + u64 offset; +}; + +struct btrfs_trans_handle { + u64 transid; + u64 bytes_reserved; + u64 chunk_bytes_reserved; + long unsigned int delayed_ref_updates; + struct btrfs_transaction *transaction; + struct btrfs_block_rsv *block_rsv; + struct btrfs_block_rsv *orig_rsv; + refcount_t use_count; + unsigned int type; + short int aborted; + bool adding_csums; + bool allocating_chunk; + bool can_flush_pending_bgs; + bool reloc_reserved; + bool dirty; + struct btrfs_root *root; + struct btrfs_fs_info *fs_info; + struct list_head new_bgs; +}; + +struct rcu_string { + struct callback_head rcu; + char str[0]; +}; + +struct btrfs_zoned_device_info { + u64 zone_size; + u8 zone_size_shift; + u64 max_zone_append_size; + u32 nr_zones; + long unsigned int *seq_zones; + long unsigned int *empty_zones; + struct blk_zone sb_zones[6]; +}; + +struct btrfs_device_info { + struct btrfs_device *dev; + u64 dev_offset; + u64 max_avail; + u64 total_avail; +}; + +struct btrfs_raid_attr { + u8 sub_stripes; + u8 dev_stripes; + u8 devs_max; + u8 devs_min; + u8 tolerated_failures; + u8 devs_increment; + u8 ncopies; + u8 nparity; + u8 mindev_error; + const char raid_name[8]; + u64 bg_flag; +}; + +enum btrfs_compression_type { + BTRFS_COMPRESS_NONE = 0, + BTRFS_COMPRESS_ZLIB = 1, + BTRFS_COMPRESS_LZO = 2, + BTRFS_COMPRESS_ZSTD = 3, + BTRFS_NR_COMPRESS_TYPES = 4, +}; + +enum btrfs_trim_state { + BTRFS_TRIM_STATE_UNTRIMMED = 0, + BTRFS_TRIM_STATE_TRIMMED = 1, + BTRFS_TRIM_STATE_TRIMMING = 2, +}; + +struct btrfs_free_space { + struct rb_node offset_index; + u64 offset; + u64 bytes; + u64 max_extent_size; + long unsigned int *bitmap; + struct list_head list; + enum btrfs_trim_state trim_state; + s32 bitmap_extents; +}; + +struct btrfs_free_space_op; + +struct btrfs_free_space_ctl { + spinlock_t tree_lock; + struct rb_root free_space_offset; + u64 free_space; + int extents_thresh; + int free_extents; + int total_bitmaps; + int unit; + u64 start; + s32 discardable_extents[2]; + s64 discardable_bytes[2]; + const struct btrfs_free_space_op *op; + void *private; + struct mutex cache_writeout_mutex; + struct list_head trimming_ranges; +}; + +struct btrfs_free_space_op { + bool (*use_bitmap)(struct btrfs_free_space_ctl *, struct btrfs_free_space *); +}; + +struct extent_inode_elem; + +struct prelim_ref { + struct rb_node rbnode; + u64 root_id; + struct btrfs_key key_for_search; + int level; + int count; + struct extent_inode_elem *inode_list; + u64 parent; + u64 wanted_disk_byte; +}; + +struct btrfs_caching_control { + struct list_head list; + struct mutex mutex; + wait_queue_head_t wait; + struct btrfs_work work; + struct btrfs_block_group *block_group; + u64 progress; + refcount_t count; +}; + +struct btrfs_qgroup_extent_record { + struct rb_node node; + u64 bytenr; + u64 num_bytes; + u32 data_rsv; + u64 data_rsv_refroot; + struct ulist *old_roots; +}; + +enum btrfs_qgroup_rsv_type { + BTRFS_QGROUP_RSV_DATA = 0, + BTRFS_QGROUP_RSV_META_PERTRANS = 1, + BTRFS_QGROUP_RSV_META_PREALLOC = 2, + BTRFS_QGROUP_RSV_LAST = 3, +}; + +struct btrfs_qgroup_rsv { + u64 values[3]; +}; + +struct btrfs_qgroup { + u64 qgroupid; + u64 rfer; + u64 rfer_cmpr; + u64 excl; + u64 excl_cmpr; + u64 lim_flags; + u64 max_rfer; + u64 max_excl; + u64 rsv_rfer; + u64 rsv_excl; + struct btrfs_qgroup_rsv rsv; + struct list_head groups; + struct list_head members; + struct list_head dirty; + struct rb_node node; + u64 old_refcnt; + u64 new_refcnt; + struct kobject kobj; +}; + +struct trace_event_raw_btrfs_transaction_commit { + struct trace_entry ent; + u8 fsid[16]; + u64 generation; + u64 root_objectid; + char __data[0]; +}; + +struct trace_event_raw_btrfs__inode { + struct trace_entry ent; + u8 fsid[16]; + u64 ino; + u64 blocks; + u64 disk_i_size; + u64 generation; + u64 last_trans; + u64 logged_trans; + u64 root_objectid; + char __data[0]; +}; + +struct trace_event_raw_btrfs_get_extent { + struct trace_entry ent; + u8 fsid[16]; + u64 root_objectid; + u64 ino; + u64 start; + u64 len; + u64 orig_start; + u64 block_start; + u64 block_len; + long unsigned int flags; + int refs; + unsigned int compress_type; + char __data[0]; +}; + +struct trace_event_raw_btrfs_handle_em_exist { + struct trace_entry ent; + u8 fsid[16]; + u64 e_start; + u64 e_len; + u64 map_start; + u64 map_len; + u64 start; + u64 len; + char __data[0]; +}; + +struct trace_event_raw_btrfs__file_extent_item_regular { + struct trace_entry ent; + u8 fsid[16]; + u64 root_obj; + u64 ino; + loff_t isize; + u64 disk_isize; + u64 num_bytes; + u64 ram_bytes; + u64 disk_bytenr; + u64 disk_num_bytes; + u64 extent_offset; + u8 extent_type; + u8 compression; + u64 extent_start; + u64 extent_end; + char __data[0]; +}; + +struct trace_event_raw_btrfs__file_extent_item_inline { + struct trace_entry ent; + u8 fsid[16]; + u64 root_obj; + u64 ino; + loff_t isize; + u64 disk_isize; + u8 extent_type; + u8 compression; + u64 extent_start; + u64 extent_end; + char __data[0]; +}; + +struct trace_event_raw_btrfs__ordered_extent { + struct trace_entry ent; + u8 fsid[16]; + u64 ino; + u64 file_offset; + u64 start; + u64 len; + u64 disk_len; + u64 bytes_left; + long unsigned int flags; + int compress_type; + int refs; + u64 root_objectid; + u64 truncated_len; + char __data[0]; +}; + +struct trace_event_raw_btrfs__writepage { + struct trace_entry ent; + u8 fsid[16]; + u64 ino; + long unsigned int index; + long int nr_to_write; + long int pages_skipped; + loff_t range_start; + loff_t range_end; + char for_kupdate; + char for_reclaim; + char range_cyclic; + long unsigned int writeback_index; + u64 root_objectid; + char __data[0]; +}; + +struct trace_event_raw_btrfs_writepage_end_io_hook { + struct trace_entry ent; + u8 fsid[16]; + u64 ino; + long unsigned int index; + u64 start; + u64 end; + int uptodate; + u64 root_objectid; + char __data[0]; +}; + +struct trace_event_raw_btrfs_sync_file { + struct trace_entry ent; + u8 fsid[16]; + u64 ino; + u64 parent; + int datasync; + u64 root_objectid; + char __data[0]; +}; + +struct trace_event_raw_btrfs_sync_fs { + struct trace_entry ent; + u8 fsid[16]; + int wait; + char __data[0]; +}; + +struct trace_event_raw_btrfs_add_block_group { + struct trace_entry ent; + u8 fsid[16]; + u64 offset; + u64 size; + u64 flags; + u64 bytes_used; + u64 bytes_super; + int create; + char __data[0]; +}; + +struct trace_event_raw_btrfs_delayed_tree_ref { + struct trace_entry ent; + u8 fsid[16]; + u64 bytenr; + u64 num_bytes; + int action; + u64 parent; + u64 ref_root; + int level; + int type; + u64 seq; + char __data[0]; +}; + +struct trace_event_raw_btrfs_delayed_data_ref { + struct trace_entry ent; + u8 fsid[16]; + u64 bytenr; + u64 num_bytes; + int action; + u64 parent; + u64 ref_root; + u64 owner; + u64 offset; + int type; + u64 seq; + char __data[0]; +}; + +struct trace_event_raw_btrfs_delayed_ref_head { + struct trace_entry ent; + u8 fsid[16]; + u64 bytenr; + u64 num_bytes; + int action; + int is_data; + char __data[0]; +}; + +struct trace_event_raw_btrfs__chunk { + struct trace_entry ent; + u8 fsid[16]; + int num_stripes; + u64 type; + int sub_stripes; + u64 offset; + u64 size; + u64 root_objectid; + char __data[0]; +}; + +struct trace_event_raw_btrfs_cow_block { + struct trace_entry ent; + u8 fsid[16]; + u64 root_objectid; + u64 buf_start; + int refs; + u64 cow_start; + int buf_level; + int cow_level; + char __data[0]; +}; + +struct trace_event_raw_btrfs_space_reservation { + struct trace_entry ent; + u8 fsid[16]; + u32 __data_loc_type; + u64 val; + u64 bytes; + int reserve; + char __data[0]; +}; + +struct trace_event_raw_btrfs_trigger_flush { + struct trace_entry ent; + u8 fsid[16]; + u64 flags; + u64 bytes; + int flush; + u32 __data_loc_reason; + char __data[0]; +}; + +struct trace_event_raw_btrfs_flush_space { + struct trace_entry ent; + u8 fsid[16]; + u64 flags; + u64 num_bytes; + int state; + int ret; + char __data[0]; +}; + +struct trace_event_raw_btrfs__reserved_extent { + struct trace_entry ent; + u8 fsid[16]; + u64 start; + u64 len; + char __data[0]; +}; + +struct trace_event_raw_find_free_extent { + struct trace_entry ent; + u8 fsid[16]; + u64 root_objectid; + u64 num_bytes; + u64 empty_size; + u64 data; + char __data[0]; +}; + +struct trace_event_raw_btrfs__reserve_extent { + struct trace_entry ent; + u8 fsid[16]; + u64 bg_objectid; + u64 flags; + u64 start; + u64 len; + char __data[0]; +}; + +struct trace_event_raw_btrfs_find_cluster { + struct trace_entry ent; + u8 fsid[16]; + u64 bg_objectid; + u64 flags; + u64 start; + u64 bytes; + u64 empty_size; + u64 min_bytes; + char __data[0]; +}; + +struct trace_event_raw_btrfs_failed_cluster_setup { + struct trace_entry ent; + u8 fsid[16]; + u64 bg_objectid; + char __data[0]; +}; + +struct trace_event_raw_btrfs_setup_cluster { + struct trace_entry ent; + u8 fsid[16]; + u64 bg_objectid; + u64 flags; + u64 start; + u64 max_size; + u64 size; + int bitmap; + char __data[0]; +}; + +struct trace_event_raw_alloc_extent_state { + struct trace_entry ent; + const struct extent_state *state; + gfp_t mask; + const void *ip; + char __data[0]; +}; + +struct trace_event_raw_free_extent_state { + struct trace_entry ent; + const struct extent_state *state; + const void *ip; + char __data[0]; +}; + +struct trace_event_raw_btrfs__work { + struct trace_entry ent; + u8 fsid[16]; + const void *work; + const void *wq; + const void *func; + const void *ordered_func; + const void *ordered_free; + const void *normal_work; + char __data[0]; +}; + +struct trace_event_raw_btrfs__work__done { + struct trace_entry ent; + u8 fsid[16]; + const void *wtag; + char __data[0]; +}; + +struct trace_event_raw_btrfs__workqueue { + struct trace_entry ent; + u8 fsid[16]; + const void *wq; + u32 __data_loc_name; + int high; + char __data[0]; +}; + +struct trace_event_raw_btrfs__workqueue_done { + struct trace_entry ent; + u8 fsid[16]; + const void *wq; + char __data[0]; +}; + +struct trace_event_raw_btrfs__qgroup_rsv_data { + struct trace_entry ent; + u8 fsid[16]; + u64 rootid; + u64 ino; + u64 start; + u64 len; + u64 reserved; + int op; + char __data[0]; +}; + +struct trace_event_raw_btrfs_qgroup_extent { + struct trace_entry ent; + u8 fsid[16]; + u64 bytenr; + u64 num_bytes; + char __data[0]; +}; + +struct trace_event_raw_qgroup_num_dirty_extents { + struct trace_entry ent; + u8 fsid[16]; + u64 transid; + u64 num_dirty_extents; + char __data[0]; +}; + +struct trace_event_raw_btrfs_qgroup_account_extent { + struct trace_entry ent; + u8 fsid[16]; + u64 transid; + u64 bytenr; + u64 num_bytes; + u64 nr_old_roots; + u64 nr_new_roots; + char __data[0]; +}; + +struct trace_event_raw_qgroup_update_counters { + struct trace_entry ent; + u8 fsid[16]; + u64 qgid; + u64 old_rfer; + u64 old_excl; + u64 cur_old_count; + u64 cur_new_count; + char __data[0]; +}; + +struct trace_event_raw_qgroup_update_reserve { + struct trace_entry ent; + u8 fsid[16]; + u64 qgid; + u64 cur_reserved; + s64 diff; + int type; + char __data[0]; +}; + +struct trace_event_raw_qgroup_meta_reserve { + struct trace_entry ent; + u8 fsid[16]; + u64 refroot; + s64 diff; + int type; + char __data[0]; +}; + +struct trace_event_raw_qgroup_meta_convert { + struct trace_entry ent; + u8 fsid[16]; + u64 refroot; + s64 diff; + char __data[0]; +}; + +struct trace_event_raw_qgroup_meta_free_all_pertrans { + struct trace_entry ent; + u8 fsid[16]; + u64 refroot; + s64 diff; + int type; + char __data[0]; +}; + +struct trace_event_raw_btrfs__prelim_ref { + struct trace_entry ent; + u8 fsid[16]; + u64 root_id; + u64 objectid; + u8 type; + u64 offset; + int level; + int old_count; + u64 parent; + u64 bytenr; + int mod_count; + u64 tree_size; + char __data[0]; +}; + +struct trace_event_raw_btrfs_inode_mod_outstanding_extents { + struct trace_entry ent; + u8 fsid[16]; + u64 root_objectid; + u64 ino; + int mod; + char __data[0]; +}; + +struct trace_event_raw_btrfs__block_group { + struct trace_entry ent; + u8 fsid[16]; + u64 bytenr; + u64 len; + u64 used; + u64 flags; + char __data[0]; +}; + +struct trace_event_raw_btrfs_set_extent_bit { + struct trace_entry ent; + u8 fsid[16]; + unsigned int owner; + u64 ino; + u64 rootid; + u64 start; + u64 len; + unsigned int set_bits; + char __data[0]; +}; + +struct trace_event_raw_btrfs_clear_extent_bit { + struct trace_entry ent; + u8 fsid[16]; + unsigned int owner; + u64 ino; + u64 rootid; + u64 start; + u64 len; + unsigned int clear_bits; + char __data[0]; +}; + +struct trace_event_raw_btrfs_convert_extent_bit { + struct trace_entry ent; + u8 fsid[16]; + unsigned int owner; + u64 ino; + u64 rootid; + u64 start; + u64 len; + unsigned int set_bits; + unsigned int clear_bits; + char __data[0]; +}; + +struct trace_event_raw_btrfs_sleep_tree_lock { + struct trace_entry ent; + u8 fsid[16]; + u64 block; + u64 generation; + u64 start_ns; + u64 end_ns; + u64 diff_ns; + u64 owner; + int is_log_tree; + char __data[0]; +}; + +struct trace_event_raw_btrfs_locking_events { + struct trace_entry ent; + u8 fsid[16]; + u64 block; + u64 generation; + u64 owner; + int is_log_tree; + char __data[0]; +}; + +struct trace_event_raw_btrfs__space_info_update { + struct trace_entry ent; + u8 fsid[16]; + u64 type; + u64 old; + s64 diff; + char __data[0]; +}; + +struct trace_event_data_offsets_btrfs_transaction_commit {}; + +struct trace_event_data_offsets_btrfs__inode {}; + +struct trace_event_data_offsets_btrfs_get_extent {}; + +struct trace_event_data_offsets_btrfs_handle_em_exist {}; + +struct trace_event_data_offsets_btrfs__file_extent_item_regular {}; + +struct trace_event_data_offsets_btrfs__file_extent_item_inline {}; + +struct trace_event_data_offsets_btrfs__ordered_extent {}; + +struct trace_event_data_offsets_btrfs__writepage {}; + +struct trace_event_data_offsets_btrfs_writepage_end_io_hook {}; + +struct trace_event_data_offsets_btrfs_sync_file {}; + +struct trace_event_data_offsets_btrfs_sync_fs {}; + +struct trace_event_data_offsets_btrfs_add_block_group {}; + +struct trace_event_data_offsets_btrfs_delayed_tree_ref {}; + +struct trace_event_data_offsets_btrfs_delayed_data_ref {}; + +struct trace_event_data_offsets_btrfs_delayed_ref_head {}; + +struct trace_event_data_offsets_btrfs__chunk {}; + +struct trace_event_data_offsets_btrfs_cow_block {}; + +struct trace_event_data_offsets_btrfs_space_reservation { + u32 type; +}; + +struct trace_event_data_offsets_btrfs_trigger_flush { + u32 reason; +}; + +struct trace_event_data_offsets_btrfs_flush_space {}; + +struct trace_event_data_offsets_btrfs__reserved_extent {}; + +struct trace_event_data_offsets_find_free_extent {}; + +struct trace_event_data_offsets_btrfs__reserve_extent {}; + +struct trace_event_data_offsets_btrfs_find_cluster {}; + +struct trace_event_data_offsets_btrfs_failed_cluster_setup {}; + +struct trace_event_data_offsets_btrfs_setup_cluster {}; + +struct trace_event_data_offsets_alloc_extent_state {}; + +struct trace_event_data_offsets_free_extent_state {}; + +struct trace_event_data_offsets_btrfs__work {}; + +struct trace_event_data_offsets_btrfs__work__done {}; + +struct trace_event_data_offsets_btrfs__workqueue { + u32 name; +}; + +struct trace_event_data_offsets_btrfs__workqueue_done {}; + +struct trace_event_data_offsets_btrfs__qgroup_rsv_data {}; + +struct trace_event_data_offsets_btrfs_qgroup_extent {}; + +struct trace_event_data_offsets_qgroup_num_dirty_extents {}; + +struct trace_event_data_offsets_btrfs_qgroup_account_extent {}; + +struct trace_event_data_offsets_qgroup_update_counters {}; + +struct trace_event_data_offsets_qgroup_update_reserve {}; + +struct trace_event_data_offsets_qgroup_meta_reserve {}; + +struct trace_event_data_offsets_qgroup_meta_convert {}; + +struct trace_event_data_offsets_qgroup_meta_free_all_pertrans {}; + +struct trace_event_data_offsets_btrfs__prelim_ref {}; + +struct trace_event_data_offsets_btrfs_inode_mod_outstanding_extents {}; + +struct trace_event_data_offsets_btrfs__block_group {}; + +struct trace_event_data_offsets_btrfs_set_extent_bit {}; + +struct trace_event_data_offsets_btrfs_clear_extent_bit {}; + +struct trace_event_data_offsets_btrfs_convert_extent_bit {}; + +struct trace_event_data_offsets_btrfs_sleep_tree_lock {}; + +struct trace_event_data_offsets_btrfs_locking_events {}; + +struct trace_event_data_offsets_btrfs__space_info_update {}; + +typedef void (*btf_trace_btrfs_transaction_commit)(void *, const struct btrfs_root *); + +typedef void (*btf_trace_btrfs_inode_new)(void *, const struct inode *); + +typedef void (*btf_trace_btrfs_inode_request)(void *, const struct inode *); + +typedef void (*btf_trace_btrfs_inode_evict)(void *, const struct inode *); + +typedef void (*btf_trace_btrfs_get_extent)(void *, const struct btrfs_root *, const struct btrfs_inode *, const struct extent_map *); + +typedef void (*btf_trace_btrfs_handle_em_exist)(void *, const struct btrfs_fs_info *, const struct extent_map *, const struct extent_map *, u64, u64); + +typedef void (*btf_trace_btrfs_get_extent_show_fi_regular)(void *, const struct btrfs_inode *, const struct extent_buffer *, const struct btrfs_file_extent_item *, u64); + +typedef void (*btf_trace_btrfs_truncate_show_fi_regular)(void *, const struct btrfs_inode *, const struct extent_buffer *, const struct btrfs_file_extent_item *, u64); + +typedef void (*btf_trace_btrfs_get_extent_show_fi_inline)(void *, const struct btrfs_inode *, const struct extent_buffer *, const struct btrfs_file_extent_item *, int, u64); + +typedef void (*btf_trace_btrfs_truncate_show_fi_inline)(void *, const struct btrfs_inode *, const struct extent_buffer *, const struct btrfs_file_extent_item *, int, u64); + +typedef void (*btf_trace_btrfs_ordered_extent_add)(void *, const struct btrfs_inode *, const struct btrfs_ordered_extent *); + +typedef void (*btf_trace_btrfs_ordered_extent_remove)(void *, const struct btrfs_inode *, const struct btrfs_ordered_extent *); + +typedef void (*btf_trace_btrfs_ordered_extent_start)(void *, const struct btrfs_inode *, const struct btrfs_ordered_extent *); + +typedef void (*btf_trace_btrfs_ordered_extent_put)(void *, const struct btrfs_inode *, const struct btrfs_ordered_extent *); + +typedef void (*btf_trace___extent_writepage)(void *, const struct page *, const struct inode *, const struct writeback_control *); + +typedef void (*btf_trace_btrfs_writepage_end_io_hook)(void *, const struct page *, u64, u64, int); + +typedef void (*btf_trace_btrfs_sync_file)(void *, const struct file *, int); + +typedef void (*btf_trace_btrfs_sync_fs)(void *, const struct btrfs_fs_info *, int); + +typedef void (*btf_trace_btrfs_add_block_group)(void *, const struct btrfs_fs_info *, const struct btrfs_block_group *, int); + +typedef void (*btf_trace_add_delayed_tree_ref)(void *, const struct btrfs_fs_info *, const struct btrfs_delayed_ref_node *, const struct btrfs_delayed_tree_ref *, int); + +typedef void (*btf_trace_run_delayed_tree_ref)(void *, const struct btrfs_fs_info *, const struct btrfs_delayed_ref_node *, const struct btrfs_delayed_tree_ref *, int); + +typedef void (*btf_trace_add_delayed_data_ref)(void *, const struct btrfs_fs_info *, const struct btrfs_delayed_ref_node *, const struct btrfs_delayed_data_ref *, int); + +typedef void (*btf_trace_run_delayed_data_ref)(void *, const struct btrfs_fs_info *, const struct btrfs_delayed_ref_node *, const struct btrfs_delayed_data_ref *, int); + +typedef void (*btf_trace_add_delayed_ref_head)(void *, const struct btrfs_fs_info *, const struct btrfs_delayed_ref_head *, int); + +typedef void (*btf_trace_run_delayed_ref_head)(void *, const struct btrfs_fs_info *, const struct btrfs_delayed_ref_head *, int); + +typedef void (*btf_trace_btrfs_chunk_alloc)(void *, const struct btrfs_fs_info *, const struct map_lookup *, u64, u64); + +typedef void (*btf_trace_btrfs_chunk_free)(void *, const struct btrfs_fs_info *, const struct map_lookup *, u64, u64); + +typedef void (*btf_trace_btrfs_cow_block)(void *, const struct btrfs_root *, const struct extent_buffer *, const struct extent_buffer *); + +typedef void (*btf_trace_btrfs_space_reservation)(void *, const struct btrfs_fs_info *, const char *, u64, u64, int); + +typedef void (*btf_trace_btrfs_trigger_flush)(void *, const struct btrfs_fs_info *, u64, u64, int, const char *); + +typedef void (*btf_trace_btrfs_flush_space)(void *, const struct btrfs_fs_info *, u64, u64, int, int); + +typedef void (*btf_trace_btrfs_reserved_extent_alloc)(void *, const struct btrfs_fs_info *, u64, u64); + +typedef void (*btf_trace_btrfs_reserved_extent_free)(void *, const struct btrfs_fs_info *, u64, u64); + +typedef void (*btf_trace_find_free_extent)(void *, const struct btrfs_root *, u64, u64, u64); + +typedef void (*btf_trace_btrfs_reserve_extent)(void *, const struct btrfs_block_group *, u64, u64); + +typedef void (*btf_trace_btrfs_reserve_extent_cluster)(void *, const struct btrfs_block_group *, u64, u64); + +typedef void (*btf_trace_btrfs_find_cluster)(void *, const struct btrfs_block_group *, u64, u64, u64, u64); + +typedef void (*btf_trace_btrfs_failed_cluster_setup)(void *, const struct btrfs_block_group *); + +typedef void (*btf_trace_btrfs_setup_cluster)(void *, const struct btrfs_block_group *, const struct btrfs_free_cluster *, u64, int); + +typedef void (*btf_trace_alloc_extent_state)(void *, const struct extent_state *, gfp_t, long unsigned int); + +typedef void (*btf_trace_free_extent_state)(void *, const struct extent_state *, long unsigned int); + +typedef void (*btf_trace_btrfs_work_queued)(void *, const struct btrfs_work *); + +typedef void (*btf_trace_btrfs_work_sched)(void *, const struct btrfs_work *); + +typedef void (*btf_trace_btrfs_all_work_done)(void *, const struct btrfs_fs_info *, const void *); + +typedef void (*btf_trace_btrfs_ordered_sched)(void *, const struct btrfs_work *); + +typedef void (*btf_trace_btrfs_workqueue_alloc)(void *, const struct __btrfs_workqueue *, const char *, int); + +typedef void (*btf_trace_btrfs_workqueue_destroy)(void *, const struct __btrfs_workqueue *); + +typedef void (*btf_trace_btrfs_qgroup_reserve_data)(void *, const struct inode *, u64, u64, u64, int); + +typedef void (*btf_trace_btrfs_qgroup_release_data)(void *, const struct inode *, u64, u64, u64, int); + +typedef void (*btf_trace_btrfs_qgroup_account_extents)(void *, const struct btrfs_fs_info *, const struct btrfs_qgroup_extent_record *); + +typedef void (*btf_trace_btrfs_qgroup_trace_extent)(void *, const struct btrfs_fs_info *, const struct btrfs_qgroup_extent_record *); + +typedef void (*btf_trace_qgroup_num_dirty_extents)(void *, const struct btrfs_fs_info *, u64, u64); + +typedef void (*btf_trace_btrfs_qgroup_account_extent)(void *, const struct btrfs_fs_info *, u64, u64, u64, u64, u64); + +typedef void (*btf_trace_qgroup_update_counters)(void *, const struct btrfs_fs_info *, const struct btrfs_qgroup *, u64, u64); + +typedef void (*btf_trace_qgroup_update_reserve)(void *, struct btrfs_fs_info *, struct btrfs_qgroup *, s64, int); + +typedef void (*btf_trace_qgroup_meta_reserve)(void *, struct btrfs_root *, s64, int); + +typedef void (*btf_trace_qgroup_meta_convert)(void *, struct btrfs_root *, s64); + +typedef void (*btf_trace_qgroup_meta_free_all_pertrans)(void *, struct btrfs_root *); + +typedef void (*btf_trace_btrfs_prelim_ref_merge)(void *, const struct btrfs_fs_info *, const struct prelim_ref *, const struct prelim_ref *, u64); + +typedef void (*btf_trace_btrfs_prelim_ref_insert)(void *, const struct btrfs_fs_info *, const struct prelim_ref *, const struct prelim_ref *, u64); + +typedef void (*btf_trace_btrfs_inode_mod_outstanding_extents)(void *, const struct btrfs_root *, u64, int); + +typedef void (*btf_trace_btrfs_remove_block_group)(void *, const struct btrfs_block_group *); + +typedef void (*btf_trace_btrfs_add_unused_block_group)(void *, const struct btrfs_block_group *); + +typedef void (*btf_trace_btrfs_skip_unused_block_group)(void *, const struct btrfs_block_group *); + +typedef void (*btf_trace_btrfs_set_extent_bit)(void *, const struct extent_io_tree *, u64, u64, unsigned int); + +typedef void (*btf_trace_btrfs_clear_extent_bit)(void *, const struct extent_io_tree *, u64, u64, unsigned int); + +typedef void (*btf_trace_btrfs_convert_extent_bit)(void *, const struct extent_io_tree *, u64, u64, unsigned int, unsigned int); + +typedef void (*btf_trace_btrfs_tree_read_lock)(void *, const struct extent_buffer *, u64); + +typedef void (*btf_trace_btrfs_tree_lock)(void *, const struct extent_buffer *, u64); + +typedef void (*btf_trace_btrfs_tree_unlock)(void *, const struct extent_buffer *); + +typedef void (*btf_trace_btrfs_tree_read_unlock)(void *, const struct extent_buffer *); + +typedef void (*btf_trace_btrfs_tree_read_unlock_blocking)(void *, const struct extent_buffer *); + +typedef void (*btf_trace_btrfs_set_lock_blocking_read)(void *, const struct extent_buffer *); + +typedef void (*btf_trace_btrfs_set_lock_blocking_write)(void *, const struct extent_buffer *); + +typedef void (*btf_trace_btrfs_try_tree_read_lock)(void *, const struct extent_buffer *); + +typedef void (*btf_trace_btrfs_try_tree_write_lock)(void *, const struct extent_buffer *); + +typedef void (*btf_trace_btrfs_tree_read_lock_atomic)(void *, const struct extent_buffer *); + +typedef void (*btf_trace_update_bytes_may_use)(void *, const struct btrfs_fs_info *, const struct btrfs_space_info *, u64, s64); + +typedef void (*btf_trace_update_bytes_pinned)(void *, const struct btrfs_fs_info *, const struct btrfs_space_info *, u64, s64); + +enum { + Opt_acl___2 = 0, + Opt_noacl___2 = 1, + Opt_clear_cache = 2, + Opt_commit_interval = 3, + Opt_compress = 4, + Opt_compress_force = 5, + Opt_compress_force_type = 6, + Opt_compress_type = 7, + Opt_degraded = 8, + Opt_device = 9, + Opt_fatal_errors = 10, + Opt_flushoncommit = 11, + Opt_noflushoncommit = 12, + Opt_max_inline = 13, + Opt_barrier___2 = 14, + Opt_nobarrier___2 = 15, + Opt_datacow = 16, + Opt_nodatacow = 17, + Opt_datasum = 18, + Opt_nodatasum = 19, + Opt_defrag = 20, + Opt_nodefrag = 21, + Opt_discard___2 = 22, + Opt_nodiscard___2 = 23, + Opt_discard_mode = 24, + Opt_norecovery = 25, + Opt_ratio = 26, + Opt_rescan_uuid_tree = 27, + Opt_skip_balance = 28, + Opt_space_cache = 29, + Opt_no_space_cache = 30, + Opt_space_cache_version = 31, + Opt_ssd = 32, + Opt_nossd = 33, + Opt_ssd_spread = 34, + Opt_nossd_spread = 35, + Opt_subvol = 36, + Opt_subvol_empty = 37, + Opt_subvolid = 38, + Opt_thread_pool = 39, + Opt_treelog = 40, + Opt_notreelog = 41, + Opt_user_subvol_rm_allowed = 42, + Opt_rescue = 43, + Opt_usebackuproot = 44, + Opt_nologreplay = 45, + Opt_ignorebadroots = 46, + Opt_ignoredatacsums = 47, + Opt_rescue_all = 48, + Opt_recovery = 49, + Opt_inode_cache = 50, + Opt_noinode_cache = 51, + Opt_check_integrity = 52, + Opt_check_integrity_including_extent_data = 53, + Opt_check_integrity_print_mask = 54, + Opt_enospc_debug = 55, + Opt_noenospc_debug = 56, + Opt_err___5 = 57, +}; + +enum btrfs_csum_type { + BTRFS_CSUM_TYPE_CRC32 = 0, + BTRFS_CSUM_TYPE_XXHASH = 1, + BTRFS_CSUM_TYPE_SHA256 = 2, + BTRFS_CSUM_TYPE_BLAKE2 = 3, +}; + +enum { + EXTENT_BUFFER_UPTODATE = 0, + EXTENT_BUFFER_DIRTY = 1, + EXTENT_BUFFER_CORRUPT = 2, + EXTENT_BUFFER_READAHEAD = 3, + EXTENT_BUFFER_TREE_REF = 4, + EXTENT_BUFFER_STALE = 5, + EXTENT_BUFFER_WRITEBACK = 6, + EXTENT_BUFFER_READ_ERR = 7, + EXTENT_BUFFER_UNMAPPED = 8, + EXTENT_BUFFER_IN_TREE = 9, + EXTENT_BUFFER_WRITE_ERR = 10, +}; + +struct btrfs_key_ptr { + struct btrfs_disk_key key; + __le64 blockptr; + __le64 generation; +} __attribute__((packed)); + +enum { + READA_NONE = 0, + READA_BACK = 1, + READA_FORWARD = 2, +}; + +struct seq_list { + struct list_head list; + u64 seq; +}; + +enum { + BTRFS_ROOT_IN_TRANS_SETUP = 0, + BTRFS_ROOT_SHAREABLE = 1, + BTRFS_ROOT_TRACK_DIRTY = 2, + BTRFS_ROOT_IN_RADIX = 3, + BTRFS_ROOT_ORPHAN_ITEM_INSERTED = 4, + BTRFS_ROOT_DEFRAG_RUNNING = 5, + BTRFS_ROOT_FORCE_COW = 6, + BTRFS_ROOT_MULTI_LOG_TASKS = 7, + BTRFS_ROOT_DIRTY = 8, + BTRFS_ROOT_DELETING = 9, + BTRFS_ROOT_DEAD_RELOC_TREE = 10, + BTRFS_ROOT_DEAD_TREE = 11, + BTRFS_ROOT_HAS_LOG_TREE = 12, + BTRFS_ROOT_QGROUP_FLUSHING = 13, +}; + +struct btrfs_map_token { + struct extent_buffer *eb; + char *kaddr; + long unsigned int offset; +}; + +struct btrfs_csums { + u16 size; + const char name[10]; + const char driver[12]; +}; + +enum mod_log_op { + MOD_LOG_KEY_REPLACE = 0, + MOD_LOG_KEY_ADD = 1, + MOD_LOG_KEY_REMOVE = 2, + MOD_LOG_KEY_REMOVE_WHILE_FREEING = 3, + MOD_LOG_KEY_REMOVE_WHILE_MOVING = 4, + MOD_LOG_MOVE_KEYS = 5, + MOD_LOG_ROOT_REPLACE = 6, +}; + +struct tree_mod_root { + u64 logical; + u8 level; +}; + +struct tree_mod_elem { + struct rb_node node; + u64 logical; + u64 seq; + enum mod_log_op op; + int slot; + u64 generation; + struct btrfs_disk_key key; + u64 blockptr; + struct { + int dst_slot; + int nr_items; + } move; + struct tree_mod_root old_root; +}; + +struct btrfs_extent_item { + __le64 refs; + __le64 generation; + __le64 flags; +}; + +struct btrfs_tree_block_info { + struct btrfs_disk_key key; + __u8 level; +} __attribute__((packed)); + +struct btrfs_extent_data_ref { + __le64 root; + __le64 objectid; + __le64 offset; + __le32 count; +} __attribute__((packed)); + +struct btrfs_shared_data_ref { + __le32 count; +}; + +struct btrfs_extent_inline_ref { + __u8 type; + __le64 offset; +} __attribute__((packed)); + +struct extent_changeset { + unsigned int bytes_changed; + struct ulist range_changed; +}; + +enum btrfs_caching_type { + BTRFS_CACHE_NO = 0, + BTRFS_CACHE_STARTED = 1, + BTRFS_CACHE_FAST = 2, + BTRFS_CACHE_FINISHED = 3, + BTRFS_CACHE_ERROR = 4, +}; + +enum btrfs_inline_ref_type { + BTRFS_REF_TYPE_INVALID = 0, + BTRFS_REF_TYPE_BLOCK = 1, + BTRFS_REF_TYPE_DATA = 2, + BTRFS_REF_TYPE_ANY = 3, +}; + +enum btrfs_ref_type { + BTRFS_REF_NOT_SET = 0, + BTRFS_REF_DATA = 1, + BTRFS_REF_METADATA = 2, + BTRFS_REF_LAST = 3, +}; + +struct btrfs_data_ref { + u64 ref_root; + u64 ino; + u64 offset; +}; + +struct btrfs_tree_ref { + int level; + u64 root; +}; + +struct btrfs_ref { + enum btrfs_ref_type type; + int action; + bool skip_qgroup; + u64 real_root; + u64 bytenr; + u64 len; + u64 parent; + union { + struct btrfs_data_ref data_ref; + struct btrfs_tree_ref tree_ref; + }; +}; + +struct btrfs_bio { + refcount_t refs; + atomic_t stripes_pending; + struct btrfs_fs_info *fs_info; + u64 map_type; + bio_end_io_t *end_io; + struct bio *orig_bio; + void *private; + atomic_t error; + int max_errors; + int num_stripes; + int mirror_num; + int num_tgtdevs; + int *tgtdev_map; + u64 *raid_map; + struct btrfs_bio_stripe stripes[0]; +}; + +enum btrfs_map_op { + BTRFS_MAP_READ = 0, + BTRFS_MAP_WRITE = 1, + BTRFS_MAP_DISCARD = 2, + BTRFS_MAP_GET_READ_MIRRORS = 3, +}; + +enum btrfs_chunk_alloc_enum { + CHUNK_ALLOC_NO_FORCE = 0, + CHUNK_ALLOC_LIMITED = 1, + CHUNK_ALLOC_FORCE = 2, +}; + +enum btrfs_loop_type { + LOOP_CACHING_NOWAIT = 0, + LOOP_CACHING_WAIT = 1, + LOOP_ALLOC_CHUNK = 2, + LOOP_NO_EMPTY_SIZE = 3, +}; + +enum btrfs_extent_allocation_policy { + BTRFS_EXTENT_ALLOC_CLUSTERED = 0, +}; + +struct find_free_extent_ctl { + u64 num_bytes; + u64 empty_size; + u64 flags; + int delalloc; + u64 search_start; + u64 empty_cluster; + struct btrfs_free_cluster *last_ptr; + bool use_cluster; + bool have_caching_bg; + bool orig_have_caching_bg; + int index; + int loop; + bool retry_clustered; + bool retry_unclustered; + int cached; + u64 max_extent_size; + u64 total_free_space; + u64 found_offset; + u64 hint_byte; + enum btrfs_extent_allocation_policy policy; +}; + +struct walk_control { + u64 refs[8]; + u64 flags[8]; + struct btrfs_key update_progress; + struct btrfs_key drop_progress; + short: 16; + int drop_level; + int stage; + int level; + int shared_level; + int update_ref; + int keep_locks; + int reada_slot; + int reada_count; + int restarted; +} __attribute__((packed)); + +struct btrfs_stripe { + __le64 devid; + __le64 offset; + __u8 dev_uuid[16]; +}; + +struct btrfs_chunk { + __le64 length; + __le64 owner; + __le64 stripe_len; + __le64 type; + __le32 io_align; + __le32 io_width; + __le32 sector_size; + __le16 num_stripes; + __le16 sub_stripes; + struct btrfs_stripe stripe; +}; + +struct btrfs_dev_extent { + __le64 chunk_tree; + __le64 chunk_objectid; + __le64 chunk_offset; + __le64 length; + __u8 chunk_tree_uuid[16]; +}; + +struct btrfs_block_group_item { + __le64 used; + __le64 chunk_objectid; + __le64 flags; +}; + +struct root_name_map { + u64 id; + char name[16]; +}; + +struct btrfs_csum_item { + __u8 csum; +}; + +struct btrfs_ordered_sum { + u64 bytenr; + int len; + struct list_head list; + u8 sums[0]; +}; + +struct btrfs_io_bio { + unsigned int mirror_num; + struct btrfs_device *device; + u64 logical; + u8 *csum; + u8 csum_inline[64]; + struct bvec_iter iter; + struct bio bio; +}; + +struct btrfs_inode_extref { + __le64 parent_objectid; + __le64 index; + __le16 name_len; + __u8 name[0]; +} __attribute__((packed)); + +typedef blk_status_t extent_submit_bio_start_t(struct inode *, struct bio *, u64); + +enum { + BTRFS_BLOCK_RSV_GLOBAL = 0, + BTRFS_BLOCK_RSV_DELALLOC = 1, + BTRFS_BLOCK_RSV_TRANS = 2, + BTRFS_BLOCK_RSV_CHUNK = 3, + BTRFS_BLOCK_RSV_DELOPS = 4, + BTRFS_BLOCK_RSV_DELREFS = 5, + BTRFS_BLOCK_RSV_EMPTY = 6, + BTRFS_BLOCK_RSV_TEMP = 7, +}; + +enum btrfs_wq_endio_type { + BTRFS_WQ_ENDIO_DATA = 0, + BTRFS_WQ_ENDIO_METADATA = 1, + BTRFS_WQ_ENDIO_FREE_SPACE = 2, + BTRFS_WQ_ENDIO_RAID56 = 3, +}; + +enum { + BTRFS_INODE_FLUSH_ON_CLOSE = 0, + BTRFS_INODE_DUMMY = 1, + BTRFS_INODE_IN_DEFRAG = 2, + BTRFS_INODE_HAS_ASYNC_EXTENT = 3, + BTRFS_INODE_NEEDS_FULL_SYNC = 4, + BTRFS_INODE_COPY_EVERYTHING = 5, + BTRFS_INODE_IN_DELALLOC_LIST = 6, + BTRFS_INODE_HAS_PROPS = 7, + BTRFS_INODE_SNAPSHOT_FLUSH = 8, + BTRFS_INODE_NO_XATTRS = 9, + BTRFS_INODE_NO_DELALLOC_FLUSH = 10, +}; + +enum btrfs_disk_cache_state { + BTRFS_DC_WRITTEN = 0, + BTRFS_DC_ERROR = 1, + BTRFS_DC_CLEAR = 2, + BTRFS_DC_SETUP = 3, +}; + +struct btrfs_end_io_wq { + struct bio *bio; + bio_end_io_t *end_io; + void *private; + struct btrfs_fs_info *info; + blk_status_t status; + enum btrfs_wq_endio_type metadata; + struct btrfs_work work; +}; + +struct async_submit_bio { + struct inode *inode; + struct bio *bio; + extent_submit_bio_start_t *submit_bio_start; + int mirror_num; + u64 dio_file_offset; + struct btrfs_work work; + blk_status_t status; +}; + +struct btrfs_qgroup_limit { + __u64 flags; + __u64 max_rfer; + __u64 max_excl; + __u64 rsv_rfer; + __u64 rsv_excl; +}; + +struct btrfs_qgroup_inherit { + __u64 flags; + __u64 num_qgroups; + __u64 num_ref_copies; + __u64 num_excl_copies; + struct btrfs_qgroup_limit lim; + __u64 qgroups[0]; +}; + +struct btrfs_pending_snapshot { + struct dentry *dentry; + struct inode *dir; + struct btrfs_root *root; + struct btrfs_root_item *root_item; + struct btrfs_root *snap; + struct btrfs_qgroup_inherit *inherit; + struct btrfs_path *path; + struct btrfs_block_rsv block_rsv; + int error; + dev_t anon_dev; + bool readonly; + struct list_head list; +}; + +struct btrfs_async_commit { + struct btrfs_trans_handle *newtrans; + struct work_struct work; +}; + +typedef blk_status_t submit_bio_hook_t(struct inode *, struct bio *, int, long unsigned int); + +enum btrfs_orphan_cleanup_state { + ORPHAN_CLEANUP_STARTED = 1, + ORPHAN_CLEANUP_DONE = 2, +}; + +struct btrfs_swapfile_pin { + struct rb_node node; + void *ptr; + struct inode *inode; + bool is_block_group; + int bg_extent_count; +}; + +enum btrfs_exclusive_operation { + BTRFS_EXCLOP_NONE = 0, + BTRFS_EXCLOP_BALANCE = 1, + BTRFS_EXCLOP_DEV_ADD = 2, + BTRFS_EXCLOP_DEV_REMOVE = 3, + BTRFS_EXCLOP_DEV_REPLACE = 4, + BTRFS_EXCLOP_RESIZE = 5, + BTRFS_EXCLOP_SWAP_ACTIVATE = 6, +}; + +struct btrfs_replace_extent_info { + u64 disk_offset; + u64 disk_len; + u64 data_offset; + u64 data_len; + u64 file_offset; + char *extent_buf; + bool is_new_extent; + int qgroup_reserved; + int insertions; +}; + +struct btrfs_drop_extents_args { + struct btrfs_path *path; + u64 start; + u64 end; + bool drop_cache; + bool replace_extent; + u32 extent_item_size; + u64 drop_end; + u64 bytes_found; + bool extent_inserted; +}; + +struct btrfs_file_private { + void *filldir_buf; +}; + +struct btrfs_dio_private { + struct inode *inode; + u64 logical_offset; + u64 disk_bytenr; + u64 bytes; + refcount_t refs; + struct bio *dio_bio; + u8 csums[0]; +}; + +struct btrfs_io_geometry { + u64 len; + u64 offset; + u64 stripe_len; + u64 stripe_nr; + u64 stripe_offset; + u64 raid56_stripe_offset; +}; + +struct btrfs_iget_args { + u64 ino; + struct btrfs_root *root; +}; + +struct btrfs_dio_data { + u64 reserve; + loff_t length; + ssize_t submitted; + struct extent_changeset *data_reserved; +}; + +struct async_extent { + u64 start; + u64 ram_size; + u64 compressed_size; + struct page **pages; + long unsigned int nr_pages; + int compress_type; + struct list_head list; +}; + +struct async_chunk { + struct inode *inode; + struct page *locked_page; + u64 start; + u64 end; + unsigned int write_flags; + struct list_head extents; + struct cgroup_subsys_state *blkcg_css; + struct btrfs_work work; + atomic_t *pending; +}; + +struct async_cow { + atomic_t num_chunks; + struct async_chunk chunks[0]; +}; + +struct btrfs_writepage_fixup { + struct page *page; + struct inode *inode; + struct btrfs_work work; +}; + +struct dir_entry___2 { + u64 ino; + u64 offset; + unsigned int type; + int name_len; +}; + +struct btrfs_delalloc_work { + struct inode *inode; + struct completion completion; + struct list_head list; + struct btrfs_work work; +}; + +struct btrfs_swap_info { + u64 start; + u64 block_start; + u64 block_len; + u64 lowest_ppage; + u64 highest_ppage; + long unsigned int nr_pages; + int nr_extents; +}; + +struct btrfs_ioctl_defrag_range_args { + __u64 start; + __u64 len; + __u64 flags; + __u32 extent_thresh; + __u32 compress_type; + __u32 unused[4]; +}; + +struct btrfs_log_ctx { + int log_ret; + int log_transid; + bool log_new_dentries; + bool logging_new_name; + struct inode *inode; + struct list_head list; + struct list_head ordered_extents; +}; + +struct inode_defrag { + struct rb_node rb_node; + u64 ino; + u64 transid; + u64 root; + u64 last_offset; + int cycled; +}; + +struct falloc_range { + struct list_head list; + u64 start; + u64 len; +}; + +enum { + RANGE_BOUNDARY_WRITTEN_EXTENT = 0, + RANGE_BOUNDARY_PREALLOC_EXTENT = 1, + RANGE_BOUNDARY_HOLE = 2, +}; + +struct iomap_dio___2; + +enum btrfs_feature_set { + FEAT_COMPAT = 0, + FEAT_COMPAT_RO = 1, + FEAT_INCOMPAT = 2, + FEAT_MAX = 3, +}; + +struct btrfs_feature_attr { + struct kobj_attribute kobj_attr; + enum btrfs_feature_set feature_set; + u64 feature_bit; +}; + +struct raid_kobject { + u64 flags; + struct kobject kobj; +}; + +struct tree_entry { + u64 start; + u64 end; + struct rb_node rb_node; +}; + +struct extent_page_data { + struct bio *bio; + unsigned int extent_locked: 1; + unsigned int sync_io: 1; +}; + +struct processed_extent { + struct btrfs_inode *inode; + u64 start; + u64 end; + bool uptodate; +}; + +struct fiemap_cache { + u64 offset; + u64 phys; + u64 len; + u32 flags; + bool cached; +}; + +struct btrfs_trans_handle___2; + +struct btrfs_ioctl_balance_args { + __u64 flags; + __u64 state; + struct btrfs_balance_args data; + struct btrfs_balance_args meta; + struct btrfs_balance_args sys; + struct btrfs_balance_progress stat; + __u64 unused[72]; +}; + +struct btrfs_ioctl_get_dev_stats { + __u64 devid; + __u64 nr_items; + __u64 flags; + __u64 values[5]; + __u64 unused[121]; +}; + +enum btrfs_err_code { + BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET = 1, + BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET = 2, + BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET = 3, + BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET = 4, + BTRFS_ERROR_DEV_TGT_REPLACE = 5, + BTRFS_ERROR_DEV_MISSING_NOT_FOUND = 6, + BTRFS_ERROR_DEV_ONLY_WRITABLE = 7, + BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS = 8, + BTRFS_ERROR_DEV_RAID1C3_MIN_NOT_MET = 9, + BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET = 10, +}; + +struct btrfs_disk_balance_args { + __le64 profiles; + union { + __le64 usage; + struct { + __le32 usage_min; + __le32 usage_max; + }; + }; + __le64 devid; + __le64 pstart; + __le64 pend; + __le64 vstart; + __le64 vend; + __le64 target; + __le64 flags; + union { + __le64 limit; + struct { + __le32 limit_min; + __le32 limit_max; + }; + }; + __le32 stripes_min; + __le32 stripes_max; + __le64 unused[6]; +}; + +struct btrfs_balance_item { + __le64 flags; + struct btrfs_disk_balance_args data; + struct btrfs_disk_balance_args meta; + struct btrfs_disk_balance_args sys; + __le64 unused[4]; +}; + +struct btrfs_dev_stats_item { + __le64 values[5]; +}; + +struct alloc_chunk_ctl { + u64 start; + u64 type; + int num_stripes; + int sub_stripes; + int dev_stripes; + int devs_max; + int devs_min; + int devs_increment; + int ncopies; + int nparity; + u64 max_stripe_size; + u64 max_chunk_size; + u64 dev_extent_min; + u64 stripe_size; + u64 chunk_size; + int ndevs; +}; + +struct btrfs_workqueue { + struct __btrfs_workqueue *normal; + struct __btrfs_workqueue *high; +}; + +enum { + WORK_DONE_BIT = 0, + WORK_ORDER_DONE_BIT = 1, + WORK_HIGH_PRIO_BIT = 2, +}; + +struct btrfs_ioctl_qgroup_limit_args { + __u64 qgroupid; + struct btrfs_qgroup_limit lim; +}; + +struct btrfs_ioctl_vol_args_v2 { + __s64 fd; + __u64 transid; + __u64 flags; + union { + struct { + __u64 size; + struct btrfs_qgroup_inherit *qgroup_inherit; + }; + __u64 unused[4]; + }; + union { + char name[4040]; + __u64 devid; + __u64 subvolid; + }; +}; + +struct btrfs_ioctl_scrub_args { + __u64 devid; + __u64 start; + __u64 end; + __u64 flags; + struct btrfs_scrub_progress progress; + __u64 unused[109]; +}; + +struct btrfs_ioctl_dev_replace_start_params { + __u64 srcdevid; + __u64 cont_reading_from_srcdev_mode; + __u8 srcdev_name[1025]; + __u8 tgtdev_name[1025]; +}; + +struct btrfs_ioctl_dev_replace_status_params { + __u64 replace_state; + __u64 progress_1000; + __u64 time_started; + __u64 time_stopped; + __u64 num_write_errors; + __u64 num_uncorrectable_read_errors; +}; + +struct btrfs_ioctl_dev_replace_args { + __u64 cmd; + __u64 result; + union { + struct btrfs_ioctl_dev_replace_start_params start; + struct btrfs_ioctl_dev_replace_status_params status; + }; + __u64 spare[64]; +}; + +struct btrfs_ioctl_dev_info_args { + __u64 devid; + __u8 uuid[16]; + __u64 bytes_used; + __u64 total_bytes; + __u64 unused[379]; + __u8 path[1024]; +}; + +struct btrfs_ioctl_fs_info_args { + __u64 max_id; + __u64 num_devices; + __u8 fsid[16]; + __u32 nodesize; + __u32 sectorsize; + __u32 clone_alignment; + __u16 csum_type; + __u16 csum_size; + __u64 flags; + __u64 generation; + __u8 metadata_uuid[16]; + __u8 reserved[944]; +}; + +struct btrfs_ioctl_feature_flags { + __u64 compat_flags; + __u64 compat_ro_flags; + __u64 incompat_flags; +}; + +struct btrfs_ioctl_ino_lookup_args { + __u64 treeid; + __u64 objectid; + char name[4080]; +}; + +struct btrfs_ioctl_ino_lookup_user_args { + __u64 dirid; + __u64 treeid; + char name[256]; + char path[3824]; +}; + +struct btrfs_ioctl_search_key { + __u64 tree_id; + __u64 min_objectid; + __u64 max_objectid; + __u64 min_offset; + __u64 max_offset; + __u64 min_transid; + __u64 max_transid; + __u32 min_type; + __u32 max_type; + __u32 nr_items; + __u32 unused; + __u64 unused1; + __u64 unused2; + __u64 unused3; + __u64 unused4; +}; + +struct btrfs_ioctl_search_header { + __u64 transid; + __u64 objectid; + __u64 offset; + __u32 type; + __u32 len; +}; + +struct btrfs_ioctl_search_args { + struct btrfs_ioctl_search_key key; + char buf[3992]; +}; + +struct btrfs_ioctl_search_args_v2 { + struct btrfs_ioctl_search_key key; + __u64 buf_size; + __u64 buf[0]; +}; + +struct btrfs_ioctl_space_info { + __u64 flags; + __u64 total_bytes; + __u64 used_bytes; +}; + +struct btrfs_ioctl_space_args { + __u64 space_slots; + __u64 total_spaces; + struct btrfs_ioctl_space_info spaces[0]; +}; + +struct btrfs_data_container { + __u32 bytes_left; + __u32 bytes_missing; + __u32 elem_cnt; + __u32 elem_missed; + __u64 val[0]; +}; + +struct btrfs_ioctl_ino_path_args { + __u64 inum; + __u64 size; + __u64 reserved[4]; + __u64 fspath; +}; + +struct btrfs_ioctl_logical_ino_args { + __u64 logical; + __u64 size; + __u64 reserved[3]; + __u64 flags; + __u64 inodes; +}; + +struct btrfs_ioctl_quota_ctl_args { + __u64 cmd; + __u64 status; +}; + +struct btrfs_ioctl_quota_rescan_args { + __u64 flags; + __u64 progress; + __u64 reserved[6]; +}; + +struct btrfs_ioctl_qgroup_assign_args { + __u64 assign; + __u64 src; + __u64 dst; +}; + +struct btrfs_ioctl_qgroup_create_args { + __u64 create; + __u64 qgroupid; +}; + +struct btrfs_ioctl_timespec { + __u64 sec; + __u32 nsec; +}; + +struct btrfs_ioctl_received_subvol_args { + char uuid[16]; + __u64 stransid; + __u64 rtransid; + struct btrfs_ioctl_timespec stime; + struct btrfs_ioctl_timespec rtime; + __u64 flags; + __u64 reserved[16]; +}; + +struct btrfs_ioctl_send_args { + __s64 send_fd; + __u64 clone_sources_count; + __u64 *clone_sources; + __u64 parent_root; + __u64 flags; + __u64 reserved[4]; +}; + +struct btrfs_ioctl_get_subvol_info_args { + __u64 treeid; + char name[256]; + __u64 parent_id; + __u64 dirid; + __u64 generation; + __u64 flags; + __u8 uuid[16]; + __u8 parent_uuid[16]; + __u8 received_uuid[16]; + __u64 ctransid; + __u64 otransid; + __u64 stransid; + __u64 rtransid; + struct btrfs_ioctl_timespec ctime; + struct btrfs_ioctl_timespec otime; + struct btrfs_ioctl_timespec stime; + struct btrfs_ioctl_timespec rtime; + __u64 reserved[8]; +}; + +struct btrfs_ioctl_get_subvol_rootref_args { + __u64 min_treeid; + struct { + __u64 treeid; + __u64 dirid; + } rootref[255]; + __u8 num_items; + __u8 align[7]; +}; + +struct inode_fs_paths { + struct btrfs_path *btrfs_path; + struct btrfs_root *fs_root; + struct btrfs_data_container *fspath; +}; + +typedef int iterate_extent_inodes_t(u64, u64, u64, void *); + +struct btrfs_ioctl_timespec_32 { + __u64 sec; + __u32 nsec; +} __attribute__((packed)); + +struct btrfs_ioctl_received_subvol_args_32 { + char uuid[16]; + __u64 stransid; + __u64 rtransid; + struct btrfs_ioctl_timespec_32 stime; + struct btrfs_ioctl_timespec_32 rtime; + __u64 flags; + __u64 reserved[16]; +} __attribute__((packed)); + +struct btrfs_ioctl_send_args_32 { + __s64 send_fd; + __u64 clone_sources_count; + compat_uptr_t clone_sources; + __u64 parent_root; + __u64 flags; + __u64 reserved[4]; +} __attribute__((packed)); + +struct btrfs_fid { + u64 objectid; + u64 root_objectid; + u32 gen; + u64 parent_objectid; + u32 parent_gen; + u64 parent_root_objectid; +} __attribute__((packed)); + +struct btrfs_dir_log_item { + __le64 end; +}; + +enum { + LOG_INODE_ALL = 0, + LOG_INODE_EXISTS = 1, + LOG_OTHER_INODE = 2, + LOG_OTHER_INODE_ALL = 3, +}; + +enum { + LOG_WALK_PIN_ONLY = 0, + LOG_WALK_REPLAY_INODES = 1, + LOG_WALK_REPLAY_DIR_INDEX = 2, + LOG_WALK_REPLAY_ALL = 3, +}; + +struct walk_control___2 { + int free; + int write; + int wait; + int pin; + int stage; + bool ignore_cur_inode; + struct btrfs_root *replay_dest; + struct btrfs_trans_handle *trans; + int (*process_func)(struct btrfs_root *, struct extent_buffer *, struct walk_control___2 *, u64, int); +}; + +struct btrfs_ino_list { + u64 ino; + u64 parent; + struct list_head list; +}; + +struct btrfs_dir_list { + u64 ino; + struct list_head list; +}; + +struct btrfs_free_space_entry { + __le64 offset; + __le64 bytes; + __u8 type; +} __attribute__((packed)); + +struct btrfs_free_space_header { + struct btrfs_disk_key location; + __le64 generation; + __le64 num_entries; + __le64 num_bitmaps; +} __attribute__((packed)); + +struct btrfs_trim_range { + u64 start; + u64 bytes; + struct list_head list; +}; + +typedef unsigned char Byte; + +typedef long unsigned int uLong; + +struct internal_state; + +struct z_stream_s { + const Byte *next_in; + uLong avail_in; + uLong total_in; + Byte *next_out; + uLong avail_out; + uLong total_out; + char *msg; + struct internal_state *state; + void *workspace; + int data_type; + uLong adler; + uLong reserved; +}; + +struct internal_state { + int dummy; +}; + +typedef struct z_stream_s z_stream; + +typedef z_stream *z_streamp; + +struct compressed_bio { + refcount_t pending_bios; + struct page **compressed_pages; + struct inode *inode; + u64 start; + long unsigned int len; + long unsigned int compressed_len; + int compress_type; + long unsigned int nr_pages; + int errors; + int mirror_num; + struct bio *orig_bio; + u8 sums[0]; +}; + +struct workspace_manager { + struct list_head idle_ws; + spinlock_t ws_lock; + int free_ws; + atomic_t total_ws; + wait_queue_head_t ws_wait; +}; + +struct btrfs_compress_op { + struct workspace_manager *workspace_manager; + unsigned int max_level; + unsigned int default_level; +}; + +struct workspace { + z_stream strm; + char *buf; + unsigned int buf_size; + struct list_head list; + int level; +}; + +struct workspace___2 { + void *mem; + void *buf; + void *cbuf; + struct list_head list; +}; + +typedef enum { + ZSTD_error_no_error = 0, + ZSTD_error_GENERIC = 1, + ZSTD_error_prefix_unknown = 2, + ZSTD_error_version_unsupported = 3, + ZSTD_error_parameter_unknown = 4, + ZSTD_error_frameParameter_unsupported = 5, + ZSTD_error_frameParameter_unsupportedBy32bits = 6, + ZSTD_error_frameParameter_windowTooLarge = 7, + ZSTD_error_compressionParameter_unsupported = 8, + ZSTD_error_init_missing = 9, + ZSTD_error_memory_allocation = 10, + ZSTD_error_stage_wrong = 11, + ZSTD_error_dstSize_tooSmall = 12, + ZSTD_error_srcSize_wrong = 13, + ZSTD_error_corruption_detected = 14, + ZSTD_error_checksum_wrong = 15, + ZSTD_error_tableLog_tooLarge = 16, + ZSTD_error_maxSymbolValue_tooLarge = 17, + ZSTD_error_maxSymbolValue_tooSmall = 18, + ZSTD_error_dictionary_corrupted = 19, + ZSTD_error_dictionary_wrong = 20, + ZSTD_error_dictionaryCreation_failed = 21, + ZSTD_error_maxCode = 22, +} ZSTD_ErrorCode; + +typedef enum { + ZSTD_fast = 0, + ZSTD_dfast = 1, + ZSTD_greedy = 2, + ZSTD_lazy = 3, + ZSTD_lazy2 = 4, + ZSTD_btlazy2 = 5, + ZSTD_btopt = 6, + ZSTD_btopt2 = 7, +} ZSTD_strategy; + +typedef struct { + unsigned int windowLog; + unsigned int chainLog; + unsigned int hashLog; + unsigned int searchLog; + unsigned int searchLength; + unsigned int targetLength; + ZSTD_strategy strategy; +} ZSTD_compressionParameters; + +typedef struct { + unsigned int contentSizeFlag; + unsigned int checksumFlag; + unsigned int noDictIDFlag; +} ZSTD_frameParameters; + +typedef struct { + ZSTD_compressionParameters cParams; + ZSTD_frameParameters fParams; +} ZSTD_parameters; + +struct ZSTD_inBuffer_s { + const void *src; + size_t size; + size_t pos; +}; + +typedef struct ZSTD_inBuffer_s ZSTD_inBuffer; + +struct ZSTD_outBuffer_s { + void *dst; + size_t size; + size_t pos; +}; + +typedef struct ZSTD_outBuffer_s ZSTD_outBuffer; + +struct ZSTD_CStream_s; + +typedef struct ZSTD_CStream_s ZSTD_CStream; + +struct ZSTD_DStream_s; + +typedef struct ZSTD_DStream_s ZSTD_DStream; + +struct workspace___3 { + void *mem; + size_t size; + char *buf; + unsigned int level; + unsigned int req_level; + long unsigned int last_used; + struct list_head list; + struct list_head lru_list; + ZSTD_inBuffer in_buf; + ZSTD_outBuffer out_buf; +}; + +struct zstd_workspace_manager { + const struct btrfs_compress_op *ops; + spinlock_t lock; + struct list_head lru_list; + struct list_head idle_ws[15]; + long unsigned int active_map; + wait_queue_head_t wait; + struct timer_list timer; +}; + +struct bucket_item { + u32 count; +}; + +struct heuristic_ws { + u8 *sample; + u32 sample_size; + struct bucket_item *bucket; + struct bucket_item *bucket_b; + struct list_head list; +}; + +struct ulist_iterator { + struct list_head *cur_list; +}; + +struct ulist_node { + u64 val; + u64 aux; + struct list_head list; + struct rb_node rb_node; +}; + +struct btrfs_backref_node; + +struct btrfs_backref_cache { + struct rb_root rb_root; + struct btrfs_backref_node *path[8]; + struct list_head pending[8]; + struct list_head leaves; + struct list_head changed; + struct list_head detached; + u64 last_trans; + int nr_nodes; + int nr_edges; + struct list_head pending_edge; + struct list_head useless_node; + struct btrfs_fs_info *fs_info; + unsigned int is_reloc; +}; + +struct file_extent_cluster { + u64 start; + u64 end; + u64 boundary[128]; + unsigned int nr; +}; + +struct mapping_tree { + struct rb_root rb_root; + spinlock_t lock; +}; + +struct reloc_control { + struct btrfs_block_group *block_group; + struct btrfs_root *extent_root; + struct inode *data_inode; + struct btrfs_block_rsv *block_rsv; + struct btrfs_backref_cache backref_cache; + struct file_extent_cluster cluster; + struct extent_io_tree processed_blocks; + struct mapping_tree reloc_root_tree; + struct list_head reloc_roots; + struct list_head dirty_subvol_roots; + u64 merging_rsv_size; + u64 nodes_relocated; + u64 reserved_bytes; + u64 search_start; + u64 extents_found; + unsigned int stage: 8; + unsigned int create_reloc_tree: 1; + unsigned int merge_reloc_tree: 1; + unsigned int found_file_extent: 1; +}; + +struct btrfs_backref_iter { + u64 bytenr; + struct btrfs_path *path; + struct btrfs_fs_info *fs_info; + struct btrfs_key cur_key; + u32 item_ptr; + u32 cur_ptr; + u32 end_ptr; +}; + +struct btrfs_backref_node { + struct { + struct rb_node rb_node; + u64 bytenr; + }; + u64 new_bytenr; + u64 owner; + struct list_head list; + struct list_head upper; + struct list_head lower; + struct btrfs_root *root; + struct extent_buffer *eb; + unsigned int level: 8; + unsigned int cowonly: 1; + unsigned int lowest: 1; + unsigned int locked: 1; + unsigned int processed: 1; + unsigned int checked: 1; + unsigned int pending: 1; + unsigned int detached: 1; + unsigned int is_reloc_root: 1; +}; + +struct btrfs_backref_edge { + struct list_head list[2]; + struct btrfs_backref_node *node[2]; +}; + +struct rb_simple_node { + struct rb_node rb_node; + u64 bytenr; +}; + +struct mapping_node { + struct { + struct rb_node rb_node; + u64 bytenr; + }; + void *data; +}; + +struct tree_block { + struct { + struct rb_node rb_node; + u64 bytenr; + }; + struct btrfs_key key; + unsigned int level: 8; + unsigned int key_ready: 1; +}; + +struct btrfs_delayed_item { + struct rb_node rb_node; + struct btrfs_key key; + struct list_head tree_list; + struct list_head readdir_list; + u64 bytes_reserved; + struct btrfs_delayed_node *delayed_node; + refcount_t refs; + int ins_or_del; + u32 data_len; + char data[0]; +}; + +struct btrfs_async_delayed_work { + struct btrfs_delayed_root *delayed_root; + int nr; + struct btrfs_work work; +}; + +struct reada_control { + struct btrfs_fs_info *fs_info; + struct btrfs_key key_start; + struct btrfs_key key_end; + short: 16; + atomic_t elems; + struct kref refcnt; + int: 32; + wait_queue_head_t wait; +} __attribute__((packed)); + +struct scrub_bio; + +struct scrub_ctx { + struct scrub_bio *bios[64]; + struct btrfs_fs_info *fs_info; + int first_free; + int curr; + atomic_t bios_in_flight; + atomic_t workers_pending; + spinlock_t list_lock; + wait_queue_head_t list_wait; + struct list_head csum_list; + atomic_t cancel_req; + int readonly; + int pages_per_rd_bio; + int is_dev_replace; + struct scrub_bio *wr_curr_bio; + struct mutex wr_lock; + int pages_per_wr_bio; + struct btrfs_device *wr_tgtdev; + bool flush_all_writes; + struct btrfs_scrub_progress stat; + spinlock_t stat_lock; + refcount_t refs; +}; + +struct scrub_recover { + refcount_t refs; + struct btrfs_bio *bbio; + u64 map_length; +}; + +struct scrub_block; + +struct scrub_page { + struct scrub_block *sblock; + struct page *page; + struct btrfs_device *dev; + struct list_head list; + u64 flags; + u64 generation; + u64 logical; + u64 physical; + u64 physical_for_dev_replace; + atomic_t refs; + u8 mirror_num; + int have_csum: 1; + int io_error: 1; + u8 csum[32]; + struct scrub_recover *recover; +}; + +struct scrub_parity; + +struct scrub_block { + struct scrub_page *pagev[16]; + int page_count; + atomic_t outstanding_pages; + refcount_t refs; + struct scrub_ctx *sctx; + struct scrub_parity *sparity; + struct { + unsigned int header_error: 1; + unsigned int checksum_error: 1; + unsigned int no_io_error_seen: 1; + unsigned int generation_error: 1; + unsigned int data_corrected: 1; + }; + struct btrfs_work work; +}; + +struct scrub_bio { + int index; + struct scrub_ctx *sctx; + struct btrfs_device *dev; + struct bio *bio; + blk_status_t status; + u64 logical; + u64 physical; + struct scrub_page *pagev[32]; + int page_count; + int next_free; + struct btrfs_work work; +}; + +struct scrub_parity { + struct scrub_ctx *sctx; + struct btrfs_device *scrub_dev; + u64 logic_start; + u64 logic_end; + int nsectors; + u32 stripe_len; + refcount_t refs; + struct list_head spages; + struct btrfs_work work; + long unsigned int *dbitmap; + long unsigned int *ebitmap; + long unsigned int bitmap[0]; +}; + +struct scrub_warning { + struct btrfs_path *path; + u64 extent_item_size; + const char *errstr; + u64 physical; + u64 logical; + struct btrfs_device *dev; +}; + +struct full_stripe_lock { + struct rb_node node; + u64 logical; + u64 refs; + struct mutex mutex; +}; + +struct btrfs_raid_bio; + +struct reada_zone { + u64 start; + u64 end; + u64 elems; + struct list_head list; + spinlock_t lock; + int locked; + struct btrfs_device *device; + struct btrfs_device *devs[5]; + int ndevs; + struct kref refcnt; +}; + +struct reada_extctl { + struct list_head list; + struct reada_control *rc; + u64 generation; +}; + +struct reada_extent { + u64 logical; + u64 owner_root; + struct btrfs_key top; + struct list_head extctl; + int refcnt; + spinlock_t lock; + struct reada_zone *zones[5]; + int nzones; + int scheduled; + int level; +}; + +struct reada_machine_work { + struct btrfs_work work; + struct btrfs_fs_info *fs_info; +}; + +struct extent_inode_elem { + u64 inum; + u64 offset; + struct extent_inode_elem *next; +}; + +struct preftree { + struct rb_root_cached root; + unsigned int count; +}; + +struct preftrees { + struct preftree direct; + struct preftree indirect; + struct preftree indirect_missing_keys; +}; + +struct share_check { + u64 root_objectid; + u64 inum; + int share_count; +}; + +typedef int iterate_irefs_t(u64, u32, long unsigned int, struct extent_buffer *, void *); + +struct btrfs_qgroup_status_item { + __le64 version; + __le64 generation; + __le64 flags; + __le64 rescan; +}; + +struct btrfs_qgroup_info_item { + __le64 generation; + __le64 rfer; + __le64 rfer_cmpr; + __le64 excl; + __le64 excl_cmpr; +}; + +struct btrfs_qgroup_limit_item { + __le64 flags; + __le64 max_rfer; + __le64 max_excl; + __le64 rsv_rfer; + __le64 rsv_excl; +}; + +struct btrfs_qgroup_swapped_block { + struct rb_node node; + int level; + bool trace_leaf; + u64 subvol_bytenr; + u64 subvol_generation; + u64 reloc_bytenr; + u64 reloc_generation; + u64 last_snapshot; + struct btrfs_key first_key; +}; + +struct btrfs_qgroup_list { + struct list_head next_group; + struct list_head next_member; + struct btrfs_qgroup *group; + struct btrfs_qgroup *member; +}; + +struct btrfs_stream_header { + char magic[13]; + __le32 version; +} __attribute__((packed)); + +struct btrfs_cmd_header { + __le32 len; + __le16 cmd; + __le32 crc; +} __attribute__((packed)); + +struct btrfs_tlv_header { + __le16 tlv_type; + __le16 tlv_len; +}; + +enum btrfs_send_cmd { + BTRFS_SEND_C_UNSPEC = 0, + BTRFS_SEND_C_SUBVOL = 1, + BTRFS_SEND_C_SNAPSHOT = 2, + BTRFS_SEND_C_MKFILE = 3, + BTRFS_SEND_C_MKDIR = 4, + BTRFS_SEND_C_MKNOD = 5, + BTRFS_SEND_C_MKFIFO = 6, + BTRFS_SEND_C_MKSOCK = 7, + BTRFS_SEND_C_SYMLINK = 8, + BTRFS_SEND_C_RENAME = 9, + BTRFS_SEND_C_LINK = 10, + BTRFS_SEND_C_UNLINK = 11, + BTRFS_SEND_C_RMDIR = 12, + BTRFS_SEND_C_SET_XATTR = 13, + BTRFS_SEND_C_REMOVE_XATTR = 14, + BTRFS_SEND_C_WRITE = 15, + BTRFS_SEND_C_CLONE = 16, + BTRFS_SEND_C_TRUNCATE = 17, + BTRFS_SEND_C_CHMOD = 18, + BTRFS_SEND_C_CHOWN = 19, + BTRFS_SEND_C_UTIMES = 20, + BTRFS_SEND_C_END = 21, + BTRFS_SEND_C_UPDATE_EXTENT = 22, + __BTRFS_SEND_C_MAX = 23, +}; + +enum { + BTRFS_SEND_A_UNSPEC = 0, + BTRFS_SEND_A_UUID = 1, + BTRFS_SEND_A_CTRANSID = 2, + BTRFS_SEND_A_INO = 3, + BTRFS_SEND_A_SIZE = 4, + BTRFS_SEND_A_MODE = 5, + BTRFS_SEND_A_UID = 6, + BTRFS_SEND_A_GID = 7, + BTRFS_SEND_A_RDEV = 8, + BTRFS_SEND_A_CTIME = 9, + BTRFS_SEND_A_MTIME = 10, + BTRFS_SEND_A_ATIME = 11, + BTRFS_SEND_A_OTIME = 12, + BTRFS_SEND_A_XATTR_NAME = 13, + BTRFS_SEND_A_XATTR_DATA = 14, + BTRFS_SEND_A_PATH = 15, + BTRFS_SEND_A_PATH_TO = 16, + BTRFS_SEND_A_PATH_LINK = 17, + BTRFS_SEND_A_FILE_OFFSET = 18, + BTRFS_SEND_A_DATA = 19, + BTRFS_SEND_A_CLONE_UUID = 20, + BTRFS_SEND_A_CLONE_CTRANSID = 21, + BTRFS_SEND_A_CLONE_PATH = 22, + BTRFS_SEND_A_CLONE_OFFSET = 23, + BTRFS_SEND_A_CLONE_LEN = 24, + __BTRFS_SEND_A_MAX = 25, +}; + +struct fs_path { + union { + struct { + char *start; + char *end; + char *buf; + short unsigned int buf_len: 15; + short unsigned int reversed: 1; + char inline_buf[0]; + }; + char pad[256]; + }; +}; + +struct clone_root { + struct btrfs_root *root; + u64 ino; + u64 offset; + u64 found_refs; +}; + +struct send_ctx { + struct file *send_filp; + loff_t send_off; + char *send_buf; + u32 send_size; + u32 send_max_size; + u64 total_send_size; + u64 cmd_send_size[23]; + u64 flags; + struct btrfs_root *send_root; + struct btrfs_root *parent_root; + struct clone_root *clone_roots; + int clone_roots_cnt; + struct btrfs_path *left_path; + struct btrfs_path *right_path; + struct btrfs_key *cmp_key; + u64 cur_ino; + u64 cur_inode_gen; + int cur_inode_new; + int cur_inode_new_gen; + int cur_inode_deleted; + u64 cur_inode_size; + u64 cur_inode_mode; + u64 cur_inode_rdev; + u64 cur_inode_last_extent; + u64 cur_inode_next_write_offset; + bool ignore_cur_inode; + u64 send_progress; + struct list_head new_refs; + struct list_head deleted_refs; + struct xarray name_cache; + struct list_head name_cache_list; + int name_cache_size; + struct file_ra_state ra; + struct rb_root pending_dir_moves; + struct rb_root waiting_dir_moves; + struct rb_root orphan_dirs; +}; + +struct pending_dir_move { + struct rb_node node; + struct list_head list; + u64 parent_ino; + u64 ino; + u64 gen; + struct list_head update_refs; +}; + +struct waiting_dir_move { + struct rb_node node; + u64 ino; + u64 rmdir_ino; + u64 rmdir_gen; + bool orphanized; +}; + +struct orphan_dir_info { + struct rb_node node; + u64 ino; + u64 gen; + u64 last_dir_index_offset; +}; + +struct name_cache_entry { + struct list_head list; + struct list_head radix_list; + u64 ino; + u64 gen; + u64 parent_ino; + u64 parent_gen; + int ret; + int need_later_update; + int name_len; + char name[0]; +}; + +enum btrfs_compare_tree_result { + BTRFS_COMPARE_TREE_NEW = 0, + BTRFS_COMPARE_TREE_DELETED = 1, + BTRFS_COMPARE_TREE_CHANGED = 2, + BTRFS_COMPARE_TREE_SAME = 3, +}; + +typedef int (*iterate_inode_ref_t)(int, u64, int, struct fs_path *, void *); + +typedef int (*iterate_dir_item_t)(int, struct btrfs_key *, const char *, int, const char *, int, u8, void *); + +struct backref_ctx { + struct send_ctx *sctx; + u64 found; + u64 cur_objectid; + u64 cur_offset; + u64 extent_len; + u64 data_offset; + int found_itself; +}; + +enum inode_state { + inode_state_no_change = 0, + inode_state_will_create = 1, + inode_state_did_create = 2, + inode_state_will_delete = 3, + inode_state_did_delete = 4, +}; + +struct recorded_ref { + struct list_head list; + char *name; + struct fs_path *full_path; + u64 dir; + u64 dir_gen; + int name_len; +}; + +struct find_ref_ctx { + u64 dir; + u64 dir_gen; + struct btrfs_root *root; + struct fs_path *name; + int found_idx; +}; + +struct find_xattr_ctx { + const char *name; + int name_len; + int found_idx; + char *found_data; + int found_data_len; +}; + +struct parent_paths_ctx { + struct list_head *refs; + struct send_ctx *sctx; +}; + +struct btrfs_dev_replace_item { + __le64 src_devid; + __le64 cursor_left; + __le64 cursor_right; + __le64 cont_reading_from_srcdev_mode; + __le64 replace_state; + __le64 time_started; + __le64 time_stopped; + __le64 num_write_errors; + __le64 num_uncorrectable_read_errors; +}; + +struct blk_plug_cb; + +typedef void (*blk_plug_cb_fn)(struct blk_plug_cb *, bool); + +struct blk_plug_cb { + struct list_head list; + blk_plug_cb_fn callback; + void *data; +}; + +struct raid6_calls { + void (*gen_syndrome)(int, size_t, void **); + void (*xor_syndrome)(int, int, int, size_t, void **); + int (*valid)(); + const char *name; + int prefer; +}; + +struct btrfs_stripe_hash { + struct list_head hash_list; + spinlock_t lock; +}; + +struct btrfs_stripe_hash_table { + struct list_head stripe_cache; + spinlock_t cache_lock; + int cache_size; + struct btrfs_stripe_hash table[0]; +}; + +enum btrfs_rbio_ops { + BTRFS_RBIO_WRITE = 0, + BTRFS_RBIO_READ_REBUILD = 1, + BTRFS_RBIO_PARITY_SCRUB = 2, + BTRFS_RBIO_REBUILD_MISSING = 3, +}; + +struct btrfs_raid_bio___2 { + struct btrfs_fs_info *fs_info; + struct btrfs_bio *bbio; + struct list_head hash_list; + struct list_head stripe_cache; + struct btrfs_work work; + struct bio_list bio_list; + spinlock_t bio_list_lock; + struct list_head plug_list; + long unsigned int flags; + int stripe_len; + int nr_data; + int real_stripes; + int stripe_npages; + enum btrfs_rbio_ops operation; + int faila; + int failb; + int scrubp; + int nr_pages; + int bio_list_bytes; + int generic_bio_cnt; + refcount_t refs; + atomic_t stripes_pending; + atomic_t error; + struct page **stripe_pages; + struct page **bio_pages; + long unsigned int *dbitmap; + void **finish_pointers; + long unsigned int *finish_pbitmap; +}; + +struct btrfs_plug_cb { + struct blk_plug_cb cb; + struct btrfs_fs_info *info; + struct list_head rbio_list; + struct btrfs_work work; +}; + +struct prop_handler { + struct hlist_node node; + const char *xattr_name; + int (*validate)(const char *, size_t); + int (*apply)(struct inode *, const char *, size_t); + const char * (*extract)(struct inode *); + int inheritable; +}; + +struct btrfs_free_space_info { + __le32 extent_count; + __le32 flags; +}; + +struct reserve_ticket { + u64 bytes; + int error; + bool steal; + struct list_head list; + wait_queue_head_t wait; +}; + +enum blk_zone_type { + BLK_ZONE_TYPE_CONVENTIONAL = 1, + BLK_ZONE_TYPE_SEQWRITE_REQ = 2, + BLK_ZONE_TYPE_SEQWRITE_PREF = 3, +}; + +enum blk_zone_cond { + BLK_ZONE_COND_NOT_WP = 0, + BLK_ZONE_COND_EMPTY = 1, + BLK_ZONE_COND_IMP_OPEN = 2, + BLK_ZONE_COND_EXP_OPEN = 3, + BLK_ZONE_COND_CLOSED = 4, + BLK_ZONE_COND_READONLY = 13, + BLK_ZONE_COND_FULL = 14, + BLK_ZONE_COND_OFFLINE = 15, +}; + +enum pstore_type_id { + PSTORE_TYPE_DMESG = 0, + PSTORE_TYPE_MCE = 1, + PSTORE_TYPE_CONSOLE = 2, + PSTORE_TYPE_FTRACE = 3, + PSTORE_TYPE_PPC_RTAS = 4, + PSTORE_TYPE_PPC_OF = 5, + PSTORE_TYPE_PPC_COMMON = 6, + PSTORE_TYPE_PMSG = 7, + PSTORE_TYPE_PPC_OPAL = 8, + PSTORE_TYPE_MAX = 9, +}; + +struct pstore_info; + +struct pstore_record { + struct pstore_info *psi; + enum pstore_type_id type; + u64 id; + struct timespec64 time; + char *buf; + ssize_t size; + ssize_t ecc_notice_size; + int count; + enum kmsg_dump_reason reason; + unsigned int part; + bool compressed; +}; + +struct pstore_info { + struct module *owner; + const char *name; + struct semaphore buf_lock; + char *buf; + size_t bufsize; + struct mutex read_mutex; + int flags; + int max_reason; + void *data; + int (*open)(struct pstore_info *); + int (*close)(struct pstore_info *); + ssize_t (*read)(struct pstore_record *); + int (*write)(struct pstore_record *); + int (*write_user)(struct pstore_record *, const char *); + int (*erase)(struct pstore_record *); +}; + +struct pstore_ftrace_record { + long unsigned int ip; + long unsigned int parent_ip; + u64 ts; +}; + +struct pstore_private { + struct list_head list; + struct dentry *dentry; + struct pstore_record *record; + size_t total_size; +}; + +struct pstore_ftrace_seq_data { + const void *ptr; + size_t off; + size_t size; +}; + +enum { + Opt_kmsg_bytes = 0, + Opt_err___6 = 1, +}; + +struct crypto_comp { + struct crypto_tfm base; +}; + +struct pstore_zbackend { + int (*zbufsize)(size_t); + const char *name; +}; + +struct efi_variable { + efi_char16_t VariableName[512]; + efi_guid_t VendorGuid; + long unsigned int DataSize; + __u8 Data[1024]; + efi_status_t Status; + __u32 Attributes; +} __attribute__((packed)); + +struct efivar_entry { + struct efi_variable var; + struct list_head list; + struct kobject kobj; + bool scanning; + bool deleting; +}; + +struct ipc64_perm { + __kernel_key_t key; + __kernel_uid32_t uid; + __kernel_gid32_t gid; + __kernel_uid32_t cuid; + __kernel_gid32_t cgid; + __kernel_mode_t mode; + unsigned char __pad1[0]; + short unsigned int seq; + short unsigned int __pad2; + __kernel_ulong_t __unused1; + __kernel_ulong_t __unused2; +}; + +typedef s32 compat_key_t; + +typedef u32 __compat_gid32_t; + +struct compat_ipc64_perm { + compat_key_t key; + __compat_uid32_t uid; + __compat_gid32_t gid; + __compat_uid32_t cuid; + __compat_gid32_t cgid; + short unsigned int mode; + short unsigned int __pad1; + short unsigned int seq; + short unsigned int __pad2; + compat_ulong_t unused1; + compat_ulong_t unused2; +}; + +struct compat_ipc_perm { + key_t key; + __compat_uid_t uid; + __compat_gid_t gid; + __compat_uid_t cuid; + __compat_gid_t cgid; + compat_mode_t mode; + short unsigned int seq; +}; + +struct ipc_perm { + __kernel_key_t key; + __kernel_uid_t uid; + __kernel_gid_t gid; + __kernel_uid_t cuid; + __kernel_gid_t cgid; + __kernel_mode_t mode; + short unsigned int seq; +}; + +struct ipc_params { + key_t key; + int flg; + union { + size_t size; + int nsems; + } u; +}; + +struct ipc_ops { + int (*getnew)(struct ipc_namespace *, struct ipc_params *); + int (*associate)(struct kern_ipc_perm *, int); + int (*more_checks)(struct kern_ipc_perm *, struct ipc_params *); +}; + +struct ipc_proc_iface { + const char *path; + const char *header; + int ids; + int (*show)(struct seq_file *, void *); +}; + +struct ipc_proc_iter { + struct ipc_namespace *ns; + struct pid_namespace *pid_ns; + struct ipc_proc_iface *iface; +}; + +struct msg_msgseg; + +struct msg_msg { + struct list_head m_list; + long int m_type; + size_t m_ts; + struct msg_msgseg *next; + void *security; +}; + +struct msg_msgseg { + struct msg_msgseg *next; +}; + +typedef int __kernel_ipc_pid_t; + +struct msgbuf { + __kernel_long_t mtype; + char mtext[1]; +}; + +struct msg; + +struct msqid_ds { + struct ipc_perm msg_perm; + struct msg *msg_first; + struct msg *msg_last; + __kernel_old_time_t msg_stime; + __kernel_old_time_t msg_rtime; + __kernel_old_time_t msg_ctime; + long unsigned int msg_lcbytes; + long unsigned int msg_lqbytes; + short unsigned int msg_cbytes; + short unsigned int msg_qnum; + short unsigned int msg_qbytes; + __kernel_ipc_pid_t msg_lspid; + __kernel_ipc_pid_t msg_lrpid; +}; + +struct msqid64_ds { + struct ipc64_perm msg_perm; + long int msg_stime; + long int msg_rtime; + long int msg_ctime; + long unsigned int msg_cbytes; + long unsigned int msg_qnum; + long unsigned int msg_qbytes; + __kernel_pid_t msg_lspid; + __kernel_pid_t msg_lrpid; + long unsigned int __unused4; + long unsigned int __unused5; +}; + +struct msginfo { + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + short unsigned int msgseg; +}; + +typedef u16 compat_ipc_pid_t; + +struct compat_msqid64_ds { + struct compat_ipc64_perm msg_perm; + compat_ulong_t msg_stime; + compat_ulong_t msg_stime_high; + compat_ulong_t msg_rtime; + compat_ulong_t msg_rtime_high; + compat_ulong_t msg_ctime; + compat_ulong_t msg_ctime_high; + compat_ulong_t msg_cbytes; + compat_ulong_t msg_qnum; + compat_ulong_t msg_qbytes; + compat_pid_t msg_lspid; + compat_pid_t msg_lrpid; + compat_ulong_t __unused4; + compat_ulong_t __unused5; +}; + +struct msg_queue { + struct kern_ipc_perm q_perm; + time64_t q_stime; + time64_t q_rtime; + time64_t q_ctime; + long unsigned int q_cbytes; + long unsigned int q_qnum; + long unsigned int q_qbytes; + struct pid *q_lspid; + struct pid *q_lrpid; + struct list_head q_messages; + struct list_head q_receivers; + struct list_head q_senders; + long: 64; + long: 64; +}; + +struct msg_receiver { + struct list_head r_list; + struct task_struct *r_tsk; + int r_mode; + long int r_msgtype; + long int r_maxsize; + struct msg_msg *r_msg; +}; + +struct msg_sender { + struct list_head list; + struct task_struct *tsk; + size_t msgsz; +}; + +struct compat_msqid_ds { + struct compat_ipc_perm msg_perm; + compat_uptr_t msg_first; + compat_uptr_t msg_last; + old_time32_t msg_stime; + old_time32_t msg_rtime; + old_time32_t msg_ctime; + compat_ulong_t msg_lcbytes; + compat_ulong_t msg_lqbytes; + short unsigned int msg_cbytes; + short unsigned int msg_qnum; + short unsigned int msg_qbytes; + compat_ipc_pid_t msg_lspid; + compat_ipc_pid_t msg_lrpid; +}; + +struct compat_msgbuf { + compat_long_t mtype; + char mtext[1]; +}; + +struct sem; + +struct sem_queue; + +struct sem_undo; + +struct semid_ds { + struct ipc_perm sem_perm; + __kernel_old_time_t sem_otime; + __kernel_old_time_t sem_ctime; + struct sem *sem_base; + struct sem_queue *sem_pending; + struct sem_queue **sem_pending_last; + struct sem_undo *undo; + short unsigned int sem_nsems; +}; + +struct sem { + int semval; + struct pid *sempid; + spinlock_t lock; + struct list_head pending_alter; + struct list_head pending_const; + time64_t sem_otime; +}; + +struct sem_queue { + struct list_head list; + struct task_struct *sleeper; + struct sem_undo *undo; + struct pid *pid; + int status; + struct sembuf *sops; + struct sembuf *blocking; + int nsops; + bool alter; + bool dupsop; +}; + +struct sem_undo { + struct list_head list_proc; + struct callback_head rcu; + struct sem_undo_list *ulp; + struct list_head list_id; + int semid; + short int *semadj; +}; + +struct semid64_ds { + struct ipc64_perm sem_perm; + __kernel_long_t sem_otime; + __kernel_ulong_t __unused1; + __kernel_long_t sem_ctime; + __kernel_ulong_t __unused2; + __kernel_ulong_t sem_nsems; + __kernel_ulong_t __unused3; + __kernel_ulong_t __unused4; +}; + +struct seminfo { + int semmap; + int semmni; + int semmns; + int semmnu; + int semmsl; + int semopm; + int semume; + int semusz; + int semvmx; + int semaem; +}; + +struct sem_undo_list { + refcount_t refcnt; + spinlock_t lock; + struct list_head list_proc; +}; + +struct compat_semid64_ds { + struct compat_ipc64_perm sem_perm; + compat_ulong_t sem_otime; + compat_ulong_t sem_otime_high; + compat_ulong_t sem_ctime; + compat_ulong_t sem_ctime_high; + compat_ulong_t sem_nsems; + compat_ulong_t __unused3; + compat_ulong_t __unused4; +}; + +struct sem_array { + struct kern_ipc_perm sem_perm; + time64_t sem_ctime; + struct list_head pending_alter; + struct list_head pending_const; + struct list_head list_id; + int sem_nsems; + int complex_count; + unsigned int use_global_lock; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct sem sems[0]; +}; + +struct compat_semid_ds { + struct compat_ipc_perm sem_perm; + old_time32_t sem_otime; + old_time32_t sem_ctime; + compat_uptr_t sem_base; + compat_uptr_t sem_pending; + compat_uptr_t sem_pending_last; + compat_uptr_t undo; + short unsigned int sem_nsems; +}; + +struct shmid_ds { + struct ipc_perm shm_perm; + int shm_segsz; + __kernel_old_time_t shm_atime; + __kernel_old_time_t shm_dtime; + __kernel_old_time_t shm_ctime; + __kernel_ipc_pid_t shm_cpid; + __kernel_ipc_pid_t shm_lpid; + short unsigned int shm_nattch; + short unsigned int shm_unused; + void *shm_unused2; + void *shm_unused3; +}; + +struct shmid64_ds { + struct ipc64_perm shm_perm; + size_t shm_segsz; + long int shm_atime; + long int shm_dtime; + long int shm_ctime; + __kernel_pid_t shm_cpid; + __kernel_pid_t shm_lpid; + long unsigned int shm_nattch; + long unsigned int __unused4; + long unsigned int __unused5; +}; + +struct shminfo64 { + long unsigned int shmmax; + long unsigned int shmmin; + long unsigned int shmmni; + long unsigned int shmseg; + long unsigned int shmall; + long unsigned int __unused1; + long unsigned int __unused2; + long unsigned int __unused3; + long unsigned int __unused4; +}; + +struct shminfo { + int shmmax; + int shmmin; + int shmmni; + int shmseg; + int shmall; +}; + +struct shm_info { + int used_ids; + __kernel_ulong_t shm_tot; + __kernel_ulong_t shm_rss; + __kernel_ulong_t shm_swp; + __kernel_ulong_t swap_attempts; + __kernel_ulong_t swap_successes; +}; + +struct compat_shmid64_ds { + struct compat_ipc64_perm shm_perm; + compat_size_t shm_segsz; + compat_ulong_t shm_atime; + compat_ulong_t shm_atime_high; + compat_ulong_t shm_dtime; + compat_ulong_t shm_dtime_high; + compat_ulong_t shm_ctime; + compat_ulong_t shm_ctime_high; + compat_pid_t shm_cpid; + compat_pid_t shm_lpid; + compat_ulong_t shm_nattch; + compat_ulong_t __unused4; + compat_ulong_t __unused5; +}; + +struct shmid_kernel { + struct kern_ipc_perm shm_perm; + struct file *shm_file; + long unsigned int shm_nattch; + long unsigned int shm_segsz; + time64_t shm_atim; + time64_t shm_dtim; + time64_t shm_ctim; + struct pid *shm_cprid; + struct pid *shm_lprid; + struct user_struct *mlock_user; + struct task_struct *shm_creator; + struct list_head shm_clist; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct shm_file_data { + int id; + struct ipc_namespace *ns; + struct file *file; + const struct vm_operations_struct *vm_ops; +}; + +struct compat_shmid_ds { + struct compat_ipc_perm shm_perm; + int shm_segsz; + old_time32_t shm_atime; + old_time32_t shm_dtime; + old_time32_t shm_ctime; + compat_ipc_pid_t shm_cpid; + compat_ipc_pid_t shm_lpid; + short unsigned int shm_nattch; + short unsigned int shm_unused; + compat_uptr_t shm_unused2; + compat_uptr_t shm_unused3; +}; + +struct compat_shminfo64 { + compat_ulong_t shmmax; + compat_ulong_t shmmin; + compat_ulong_t shmmni; + compat_ulong_t shmseg; + compat_ulong_t shmall; + compat_ulong_t __unused1; + compat_ulong_t __unused2; + compat_ulong_t __unused3; + compat_ulong_t __unused4; +}; + +struct compat_shm_info { + compat_int_t used_ids; + compat_ulong_t shm_tot; + compat_ulong_t shm_rss; + compat_ulong_t shm_swp; + compat_ulong_t swap_attempts; + compat_ulong_t swap_successes; +}; + +struct compat_ipc_kludge { + compat_uptr_t msgp; + compat_long_t msgtyp; +}; + +struct mqueue_fs_context { + struct ipc_namespace *ipc_ns; +}; + +struct posix_msg_tree_node { + struct rb_node rb_node; + struct list_head msg_list; + int priority; +}; + +struct ext_wait_queue { + struct task_struct *task; + struct list_head list; + struct msg_msg *msg; + int state; +}; + +struct mqueue_inode_info { + spinlock_t lock; + struct inode vfs_inode; + wait_queue_head_t wait_q; + struct rb_root msg_tree; + struct rb_node *msg_tree_rightmost; + struct posix_msg_tree_node *node_cache; + struct mq_attr attr; + struct sigevent notify; + struct pid *notify_owner; + u32 notify_self_exec_id; + struct user_namespace *notify_user_ns; + struct user_struct *user; + struct sock *notify_sock; + struct sk_buff *notify_cookie; + struct ext_wait_queue e_wait_q[2]; + long unsigned int qsize; +}; + +struct compat_mq_attr { + compat_long_t mq_flags; + compat_long_t mq_maxmsg; + compat_long_t mq_msgsize; + compat_long_t mq_curmsgs; + compat_long_t __reserved[4]; +}; + +struct key_user { + struct rb_node node; + struct mutex cons_lock; + spinlock_t lock; + refcount_t usage; + atomic_t nkeys; + atomic_t nikeys; + kuid_t uid; + int qnkeys; + int qnbytes; +}; + +enum key_notification_subtype { + NOTIFY_KEY_INSTANTIATED = 0, + NOTIFY_KEY_UPDATED = 1, + NOTIFY_KEY_LINKED = 2, + NOTIFY_KEY_UNLINKED = 3, + NOTIFY_KEY_CLEARED = 4, + NOTIFY_KEY_REVOKED = 5, + NOTIFY_KEY_INVALIDATED = 6, + NOTIFY_KEY_SETATTR = 7, +}; + +struct key_notification { + struct watch_notification___2 watch; + __u32 key_id; + __u32 aux; +}; + +struct assoc_array_edit; + +struct assoc_array_ops { + long unsigned int (*get_key_chunk)(const void *, int); + long unsigned int (*get_object_key_chunk)(const void *, int); + bool (*compare_object)(const void *, const void *); + int (*diff_objects)(const void *, const void *); + void (*free_object)(void *); +}; + +struct assoc_array_node { + struct assoc_array_ptr *back_pointer; + u8 parent_slot; + struct assoc_array_ptr *slots[16]; + long unsigned int nr_leaves_on_branch; +}; + +struct assoc_array_shortcut { + struct assoc_array_ptr *back_pointer; + int parent_slot; + int skip_to_level; + struct assoc_array_ptr *next_node; + long unsigned int index_key[0]; +}; + +struct assoc_array_edit___2 { + struct callback_head rcu; + struct assoc_array *array; + const struct assoc_array_ops *ops; + const struct assoc_array_ops *ops_for_excised_subtree; + struct assoc_array_ptr *leaf; + struct assoc_array_ptr **leaf_p; + struct assoc_array_ptr *dead_leaf; + struct assoc_array_ptr *new_meta[3]; + struct assoc_array_ptr *excised_meta[1]; + struct assoc_array_ptr *excised_subtree; + struct assoc_array_ptr **set_backpointers[16]; + struct assoc_array_ptr *set_backpointers_to; + struct assoc_array_node *adjust_count_on; + long int adjust_count_by; + struct { + struct assoc_array_ptr **ptr; + struct assoc_array_ptr *to; + } set[2]; + struct { + u8 *p; + u8 to; + } set_parent_slot[1]; + u8 segment_cache[17]; +}; + +struct keyring_search_context { + struct keyring_index_key index_key; + const struct cred *cred; + struct key_match_data match_data; + unsigned int flags; + int (*iterator)(const void *, void *); + int skipped_ret; + bool possessed; + key_ref_t result; + time64_t now; +}; + +struct keyring_read_iterator_context { + size_t buflen; + size_t count; + key_serial_t *buffer; +}; + +struct keyctl_dh_params { + union { + __s32 private; + __s32 priv; + }; + __s32 prime; + __s32 base; +}; + +struct keyctl_kdf_params { + char *hashname; + char *otherinfo; + __u32 otherinfolen; + __u32 __spare[8]; +}; + +struct keyctl_pkey_query { + __u32 supported_ops; + __u32 key_size; + __u16 max_data_size; + __u16 max_sig_size; + __u16 max_enc_size; + __u16 max_dec_size; + __u32 __spare[10]; +}; + +struct keyctl_pkey_params { + __s32 key_id; + __u32 in_len; + union { + __u32 out_len; + __u32 in2_len; + }; + __u32 __spare[7]; +}; + +struct request_key_auth { + struct callback_head rcu; + struct key *target_key; + struct key *dest_keyring; + const struct cred *cred; + void *callout_info; + size_t callout_len; + pid_t pid; + char op[8]; +}; + +struct compat_keyctl_kdf_params { + compat_uptr_t hashname; + compat_uptr_t otherinfo; + __u32 otherinfolen; + __u32 __spare[8]; +}; + +struct kpp_request { + struct crypto_async_request base; + struct scatterlist *src; + struct scatterlist *dst; + unsigned int src_len; + unsigned int dst_len; + void *__ctx[0]; +}; + +struct crypto_kpp { + struct crypto_tfm base; +}; + +struct kpp_alg { + int (*set_secret)(struct crypto_kpp *, const void *, unsigned int); + int (*generate_public_key)(struct kpp_request *); + int (*compute_shared_secret)(struct kpp_request *); + unsigned int (*max_size)(struct crypto_kpp *); + int (*init)(struct crypto_kpp *); + void (*exit)(struct crypto_kpp *); + unsigned int reqsize; + struct crypto_alg base; +}; + +struct dh { + void *key; + void *p; + void *q; + void *g; + unsigned int key_size; + unsigned int p_size; + unsigned int q_size; + unsigned int g_size; +}; + +struct dh_completion { + struct completion completion; + int err; +}; + +struct kdf_sdesc { + struct shash_desc shash; + char ctx[0]; +}; + +enum { + Opt_err___7 = 0, + Opt_enc = 1, + Opt_hash = 2, +}; + +enum hash_algo { + HASH_ALGO_MD4 = 0, + HASH_ALGO_MD5 = 1, + HASH_ALGO_SHA1 = 2, + HASH_ALGO_RIPE_MD_160 = 3, + HASH_ALGO_SHA256 = 4, + HASH_ALGO_SHA384 = 5, + HASH_ALGO_SHA512 = 6, + HASH_ALGO_SHA224 = 7, + HASH_ALGO_RIPE_MD_128 = 8, + HASH_ALGO_RIPE_MD_256 = 9, + HASH_ALGO_RIPE_MD_320 = 10, + HASH_ALGO_WP_256 = 11, + HASH_ALGO_WP_384 = 12, + HASH_ALGO_WP_512 = 13, + HASH_ALGO_TGR_128 = 14, + HASH_ALGO_TGR_160 = 15, + HASH_ALGO_TGR_192 = 16, + HASH_ALGO_SM3_256 = 17, + HASH_ALGO_STREEBOG_256 = 18, + HASH_ALGO_STREEBOG_512 = 19, + HASH_ALGO__LAST = 20, +}; + +enum tpm_duration { + TPM_SHORT = 0, + TPM_MEDIUM = 1, + TPM_LONG = 2, + TPM_LONG_LONG = 3, + TPM_UNDEFINED = 4, + TPM_NUM_DURATIONS = 4, +}; + +struct encrypted_key_payload { + struct callback_head rcu; + char *format; + char *master_desc; + char *datalen; + u8 *iv; + u8 *encrypted_data; + short unsigned int datablob_len; + short unsigned int decrypted_datalen; + short unsigned int payload_datalen; + short unsigned int encrypted_key_format; + u8 *decrypted_data; + u8 payload_data[0]; +}; + +struct ecryptfs_session_key { + u32 flags; + u32 encrypted_key_size; + u32 decrypted_key_size; + u8 encrypted_key[512]; + u8 decrypted_key[64]; +}; + +struct ecryptfs_password { + u32 password_bytes; + s32 hash_algo; + u32 hash_iterations; + u32 session_key_encryption_key_bytes; + u32 flags; + u8 session_key_encryption_key[64]; + u8 signature[17]; + u8 salt[8]; +}; + +struct ecryptfs_private_key { + u32 key_size; + u32 data_len; + u8 signature[17]; + char pki_type[17]; + u8 data[0]; +}; + +struct ecryptfs_auth_tok { + u16 version; + u16 token_type; + u32 flags; + struct ecryptfs_session_key session_key; + u8 reserved[32]; + union { + struct ecryptfs_password password; + struct ecryptfs_private_key private_key; + } token; +}; + +enum { + Opt_new = 0, + Opt_load = 1, + Opt_update = 2, + Opt_err___8 = 3, +}; + +enum { + Opt_default = 0, + Opt_ecryptfs = 1, + Opt_enc32 = 2, + Opt_error = 3, +}; + +enum derived_key_type { + ENC_KEY = 0, + AUTH_KEY = 1, +}; + +enum ecryptfs_token_types { + ECRYPTFS_PASSWORD = 0, + ECRYPTFS_PRIVATE_KEY = 1, +}; + +struct vfs_cap_data { + __le32 magic_etc; + struct { + __le32 permitted; + __le32 inheritable; + } data[2]; +}; + +struct vfs_ns_cap_data { + __le32 magic_etc; + struct { + __le32 permitted; + __le32 inheritable; + } data[2]; + __le32 rootid; +}; + +struct sctp_endpoint; + +union security_list_options { + int (*binder_set_context_mgr)(struct task_struct *); + int (*binder_transaction)(struct task_struct *, struct task_struct *); + int (*binder_transfer_binder)(struct task_struct *, struct task_struct *); + int (*binder_transfer_file)(struct task_struct *, struct task_struct *, struct file *); + int (*ptrace_access_check)(struct task_struct *, unsigned int); + int (*ptrace_traceme)(struct task_struct *); + int (*capget)(struct task_struct *, kernel_cap_t *, kernel_cap_t *, kernel_cap_t *); + int (*capset)(struct cred *, const struct cred *, const kernel_cap_t *, const kernel_cap_t *, const kernel_cap_t *); + int (*capable)(const struct cred *, struct user_namespace *, int, unsigned int); + int (*quotactl)(int, int, int, struct super_block *); + int (*quota_on)(struct dentry *); + int (*syslog)(int); + int (*settime)(const struct timespec64 *, const struct timezone *); + int (*vm_enough_memory)(struct mm_struct *, long int); + int (*bprm_creds_for_exec)(struct linux_binprm *); + int (*bprm_creds_from_file)(struct linux_binprm *, struct file *); + int (*bprm_check_security)(struct linux_binprm *); + void (*bprm_committing_creds)(struct linux_binprm *); + void (*bprm_committed_creds)(struct linux_binprm *); + int (*fs_context_dup)(struct fs_context *, struct fs_context *); + int (*fs_context_parse_param)(struct fs_context *, struct fs_parameter *); + int (*sb_alloc_security)(struct super_block *); + void (*sb_free_security)(struct super_block *); + void (*sb_free_mnt_opts)(void *); + int (*sb_eat_lsm_opts)(char *, void **); + int (*sb_remount)(struct super_block *, void *); + int (*sb_kern_mount)(struct super_block *); + int (*sb_show_options)(struct seq_file *, struct super_block *); + int (*sb_statfs)(struct dentry *); + int (*sb_mount)(const char *, const struct path *, const char *, long unsigned int, void *); + int (*sb_umount)(struct vfsmount *, int); + int (*sb_pivotroot)(const struct path *, const struct path *); + int (*sb_set_mnt_opts)(struct super_block *, void *, long unsigned int, long unsigned int *); + int (*sb_clone_mnt_opts)(const struct super_block *, struct super_block *, long unsigned int, long unsigned int *); + int (*sb_add_mnt_opt)(const char *, const char *, int, void **); + int (*move_mount)(const struct path *, const struct path *); + int (*dentry_init_security)(struct dentry *, int, const struct qstr *, void **, u32 *); + int (*dentry_create_files_as)(struct dentry *, int, struct qstr *, const struct cred *, struct cred *); + int (*path_notify)(const struct path *, u64, unsigned int); + int (*inode_alloc_security)(struct inode *); + void (*inode_free_security)(struct inode *); + int (*inode_init_security)(struct inode *, struct inode *, const struct qstr *, const char **, void **, size_t *); + int (*inode_create)(struct inode *, struct dentry *, umode_t); + int (*inode_link)(struct dentry *, struct inode *, struct dentry *); + int (*inode_unlink)(struct inode *, struct dentry *); + int (*inode_symlink)(struct inode *, struct dentry *, const char *); + int (*inode_mkdir)(struct inode *, struct dentry *, umode_t); + int (*inode_rmdir)(struct inode *, struct dentry *); + int (*inode_mknod)(struct inode *, struct dentry *, umode_t, dev_t); + int (*inode_rename)(struct inode *, struct dentry *, struct inode *, struct dentry *); + int (*inode_readlink)(struct dentry *); + int (*inode_follow_link)(struct dentry *, struct inode *, bool); + int (*inode_permission)(struct inode *, int); + int (*inode_setattr)(struct dentry *, struct iattr *); + int (*inode_getattr)(const struct path *); + int (*inode_setxattr)(struct dentry *, const char *, const void *, size_t, int); + void (*inode_post_setxattr)(struct dentry *, const char *, const void *, size_t, int); + int (*inode_getxattr)(struct dentry *, const char *); + int (*inode_listxattr)(struct dentry *); + int (*inode_removexattr)(struct dentry *, const char *); + int (*inode_need_killpriv)(struct dentry *); + int (*inode_killpriv)(struct dentry *); + int (*inode_getsecurity)(struct inode *, const char *, void **, bool); + int (*inode_setsecurity)(struct inode *, const char *, const void *, size_t, int); + int (*inode_listsecurity)(struct inode *, char *, size_t); + void (*inode_getsecid)(struct inode *, u32 *); + int (*inode_copy_up)(struct dentry *, struct cred **); + int (*inode_copy_up_xattr)(const char *); + int (*kernfs_init_security)(struct kernfs_node *, struct kernfs_node *); + int (*file_permission)(struct file *, int); + int (*file_alloc_security)(struct file *); + void (*file_free_security)(struct file *); + int (*file_ioctl)(struct file *, unsigned int, long unsigned int); + int (*mmap_addr)(long unsigned int); + int (*mmap_file)(struct file *, long unsigned int, long unsigned int, long unsigned int); + int (*file_mprotect)(struct vm_area_struct *, long unsigned int, long unsigned int); + int (*file_lock)(struct file *, unsigned int); + int (*file_fcntl)(struct file *, unsigned int, long unsigned int); + void (*file_set_fowner)(struct file *); + int (*file_send_sigiotask)(struct task_struct *, struct fown_struct *, int); + int (*file_receive)(struct file *); + int (*file_open)(struct file *); + int (*task_alloc)(struct task_struct *, long unsigned int); + void (*task_free)(struct task_struct *); + int (*cred_alloc_blank)(struct cred *, gfp_t); + void (*cred_free)(struct cred *); + int (*cred_prepare)(struct cred *, const struct cred *, gfp_t); + void (*cred_transfer)(struct cred *, const struct cred *); + void (*cred_getsecid)(const struct cred *, u32 *); + int (*kernel_act_as)(struct cred *, u32); + int (*kernel_create_files_as)(struct cred *, struct inode *); + int (*kernel_module_request)(char *); + int (*kernel_load_data)(enum kernel_load_data_id, bool); + int (*kernel_post_load_data)(char *, loff_t, enum kernel_load_data_id, char *); + int (*kernel_read_file)(struct file *, enum kernel_read_file_id, bool); + int (*kernel_post_read_file)(struct file *, char *, loff_t, enum kernel_read_file_id); + int (*task_fix_setuid)(struct cred *, const struct cred *, int); + int (*task_fix_setgid)(struct cred *, const struct cred *, int); + int (*task_setpgid)(struct task_struct *, pid_t); + int (*task_getpgid)(struct task_struct *); + int (*task_getsid)(struct task_struct *); + void (*task_getsecid)(struct task_struct *, u32 *); + int (*task_setnice)(struct task_struct *, int); + int (*task_setioprio)(struct task_struct *, int); + int (*task_getioprio)(struct task_struct *); + int (*task_prlimit)(const struct cred *, const struct cred *, unsigned int); + int (*task_setrlimit)(struct task_struct *, unsigned int, struct rlimit *); + int (*task_setscheduler)(struct task_struct *); + int (*task_getscheduler)(struct task_struct *); + int (*task_movememory)(struct task_struct *); + int (*task_kill)(struct task_struct *, struct kernel_siginfo *, int, const struct cred *); + int (*task_prctl)(int, long unsigned int, long unsigned int, long unsigned int, long unsigned int); + void (*task_to_inode)(struct task_struct *, struct inode *); + int (*ipc_permission)(struct kern_ipc_perm *, short int); + void (*ipc_getsecid)(struct kern_ipc_perm *, u32 *); + int (*msg_msg_alloc_security)(struct msg_msg *); + void (*msg_msg_free_security)(struct msg_msg *); + int (*msg_queue_alloc_security)(struct kern_ipc_perm *); + void (*msg_queue_free_security)(struct kern_ipc_perm *); + int (*msg_queue_associate)(struct kern_ipc_perm *, int); + int (*msg_queue_msgctl)(struct kern_ipc_perm *, int); + int (*msg_queue_msgsnd)(struct kern_ipc_perm *, struct msg_msg *, int); + int (*msg_queue_msgrcv)(struct kern_ipc_perm *, struct msg_msg *, struct task_struct *, long int, int); + int (*shm_alloc_security)(struct kern_ipc_perm *); + void (*shm_free_security)(struct kern_ipc_perm *); + int (*shm_associate)(struct kern_ipc_perm *, int); + int (*shm_shmctl)(struct kern_ipc_perm *, int); + int (*shm_shmat)(struct kern_ipc_perm *, char *, int); + int (*sem_alloc_security)(struct kern_ipc_perm *); + void (*sem_free_security)(struct kern_ipc_perm *); + int (*sem_associate)(struct kern_ipc_perm *, int); + int (*sem_semctl)(struct kern_ipc_perm *, int); + int (*sem_semop)(struct kern_ipc_perm *, struct sembuf *, unsigned int, int); + int (*netlink_send)(struct sock *, struct sk_buff *); + void (*d_instantiate)(struct dentry *, struct inode *); + int (*getprocattr)(struct task_struct *, char *, char **); + int (*setprocattr)(const char *, void *, size_t); + int (*ismaclabel)(const char *); + int (*secid_to_secctx)(u32, char **, u32 *); + int (*secctx_to_secid)(const char *, u32, u32 *); + void (*release_secctx)(char *, u32); + void (*inode_invalidate_secctx)(struct inode *); + int (*inode_notifysecctx)(struct inode *, void *, u32); + int (*inode_setsecctx)(struct dentry *, void *, u32); + int (*inode_getsecctx)(struct inode *, void **, u32 *); + int (*post_notification)(const struct cred *, const struct cred *, struct watch_notification *); + int (*watch_key)(struct key *); + int (*unix_stream_connect)(struct sock *, struct sock *, struct sock *); + int (*unix_may_send)(struct socket *, struct socket *); + int (*socket_create)(int, int, int, int); + int (*socket_post_create)(struct socket *, int, int, int, int); + int (*socket_socketpair)(struct socket *, struct socket *); + int (*socket_bind)(struct socket *, struct sockaddr *, int); + int (*socket_connect)(struct socket *, struct sockaddr *, int); + int (*socket_listen)(struct socket *, int); + int (*socket_accept)(struct socket *, struct socket *); + int (*socket_sendmsg)(struct socket *, struct msghdr *, int); + int (*socket_recvmsg)(struct socket *, struct msghdr *, int, int); + int (*socket_getsockname)(struct socket *); + int (*socket_getpeername)(struct socket *); + int (*socket_getsockopt)(struct socket *, int, int); + int (*socket_setsockopt)(struct socket *, int, int); + int (*socket_shutdown)(struct socket *, int); + int (*socket_sock_rcv_skb)(struct sock *, struct sk_buff *); + int (*socket_getpeersec_stream)(struct socket *, char *, int *, unsigned int); + int (*socket_getpeersec_dgram)(struct socket *, struct sk_buff *, u32 *); + int (*sk_alloc_security)(struct sock *, int, gfp_t); + void (*sk_free_security)(struct sock *); + void (*sk_clone_security)(const struct sock *, struct sock *); + void (*sk_getsecid)(struct sock *, u32 *); + void (*sock_graft)(struct sock *, struct socket *); + int (*inet_conn_request)(const struct sock *, struct sk_buff *, struct request_sock *); + void (*inet_csk_clone)(struct sock *, const struct request_sock *); + void (*inet_conn_established)(struct sock *, struct sk_buff *); + int (*secmark_relabel_packet)(u32); + void (*secmark_refcount_inc)(); + void (*secmark_refcount_dec)(); + void (*req_classify_flow)(const struct request_sock *, struct flowi_common *); + int (*tun_dev_alloc_security)(void **); + void (*tun_dev_free_security)(void *); + int (*tun_dev_create)(); + int (*tun_dev_attach_queue)(void *); + int (*tun_dev_attach)(struct sock *, void *); + int (*tun_dev_open)(void *); + int (*sctp_assoc_request)(struct sctp_endpoint *, struct sk_buff *); + int (*sctp_bind_connect)(struct sock *, int, struct sockaddr *, int); + void (*sctp_sk_clone)(struct sctp_endpoint *, struct sock *, struct sock *); + int (*ib_pkey_access)(void *, u64, u16); + int (*ib_endport_manage_subnet)(void *, const char *, u8); + int (*ib_alloc_security)(void **); + void (*ib_free_security)(void *); + int (*xfrm_policy_alloc_security)(struct xfrm_sec_ctx **, struct xfrm_user_sec_ctx *, gfp_t); + int (*xfrm_policy_clone_security)(struct xfrm_sec_ctx *, struct xfrm_sec_ctx **); + void (*xfrm_policy_free_security)(struct xfrm_sec_ctx *); + int (*xfrm_policy_delete_security)(struct xfrm_sec_ctx *); + int (*xfrm_state_alloc)(struct xfrm_state *, struct xfrm_user_sec_ctx *); + int (*xfrm_state_alloc_acquire)(struct xfrm_state *, struct xfrm_sec_ctx *, u32); + void (*xfrm_state_free_security)(struct xfrm_state *); + int (*xfrm_state_delete_security)(struct xfrm_state *); + int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *, u32, u8); + int (*xfrm_state_pol_flow_match)(struct xfrm_state *, struct xfrm_policy *, const struct flowi_common *); + int (*xfrm_decode_session)(struct sk_buff *, u32 *, int); + int (*key_alloc)(struct key *, const struct cred *, long unsigned int); + void (*key_free)(struct key *); + int (*key_permission)(key_ref_t, const struct cred *, enum key_need_perm); + int (*key_getsecurity)(struct key *, char **); + int (*audit_rule_init)(u32, u32, char *, void **); + int (*audit_rule_known)(struct audit_krule *); + int (*audit_rule_match)(u32, u32, u32, void *); + void (*audit_rule_free)(void *); + int (*bpf)(int, union bpf_attr *, unsigned int); + int (*bpf_map)(struct bpf_map *, fmode_t); + int (*bpf_prog)(struct bpf_prog *); + int (*bpf_map_alloc_security)(struct bpf_map *); + void (*bpf_map_free_security)(struct bpf_map *); + int (*bpf_prog_alloc_security)(struct bpf_prog_aux *); + void (*bpf_prog_free_security)(struct bpf_prog_aux *); + int (*locked_down)(enum lockdown_reason); + int (*lock_kernel_down)(const char *, enum lockdown_reason); + int (*perf_event_open)(struct perf_event_attr *, int); + int (*perf_event_alloc)(struct perf_event *); + void (*perf_event_free)(struct perf_event *); + int (*perf_event_read)(struct perf_event *); + int (*perf_event_write)(struct perf_event *); +}; + +struct security_hook_heads { + struct hlist_head binder_set_context_mgr; + struct hlist_head binder_transaction; + struct hlist_head binder_transfer_binder; + struct hlist_head binder_transfer_file; + struct hlist_head ptrace_access_check; + struct hlist_head ptrace_traceme; + struct hlist_head capget; + struct hlist_head capset; + struct hlist_head capable; + struct hlist_head quotactl; + struct hlist_head quota_on; + struct hlist_head syslog; + struct hlist_head settime; + struct hlist_head vm_enough_memory; + struct hlist_head bprm_creds_for_exec; + struct hlist_head bprm_creds_from_file; + struct hlist_head bprm_check_security; + struct hlist_head bprm_committing_creds; + struct hlist_head bprm_committed_creds; + struct hlist_head fs_context_dup; + struct hlist_head fs_context_parse_param; + struct hlist_head sb_alloc_security; + struct hlist_head sb_free_security; + struct hlist_head sb_free_mnt_opts; + struct hlist_head sb_eat_lsm_opts; + struct hlist_head sb_remount; + struct hlist_head sb_kern_mount; + struct hlist_head sb_show_options; + struct hlist_head sb_statfs; + struct hlist_head sb_mount; + struct hlist_head sb_umount; + struct hlist_head sb_pivotroot; + struct hlist_head sb_set_mnt_opts; + struct hlist_head sb_clone_mnt_opts; + struct hlist_head sb_add_mnt_opt; + struct hlist_head move_mount; + struct hlist_head dentry_init_security; + struct hlist_head dentry_create_files_as; + struct hlist_head path_notify; + struct hlist_head inode_alloc_security; + struct hlist_head inode_free_security; + struct hlist_head inode_init_security; + struct hlist_head inode_create; + struct hlist_head inode_link; + struct hlist_head inode_unlink; + struct hlist_head inode_symlink; + struct hlist_head inode_mkdir; + struct hlist_head inode_rmdir; + struct hlist_head inode_mknod; + struct hlist_head inode_rename; + struct hlist_head inode_readlink; + struct hlist_head inode_follow_link; + struct hlist_head inode_permission; + struct hlist_head inode_setattr; + struct hlist_head inode_getattr; + struct hlist_head inode_setxattr; + struct hlist_head inode_post_setxattr; + struct hlist_head inode_getxattr; + struct hlist_head inode_listxattr; + struct hlist_head inode_removexattr; + struct hlist_head inode_need_killpriv; + struct hlist_head inode_killpriv; + struct hlist_head inode_getsecurity; + struct hlist_head inode_setsecurity; + struct hlist_head inode_listsecurity; + struct hlist_head inode_getsecid; + struct hlist_head inode_copy_up; + struct hlist_head inode_copy_up_xattr; + struct hlist_head kernfs_init_security; + struct hlist_head file_permission; + struct hlist_head file_alloc_security; + struct hlist_head file_free_security; + struct hlist_head file_ioctl; + struct hlist_head mmap_addr; + struct hlist_head mmap_file; + struct hlist_head file_mprotect; + struct hlist_head file_lock; + struct hlist_head file_fcntl; + struct hlist_head file_set_fowner; + struct hlist_head file_send_sigiotask; + struct hlist_head file_receive; + struct hlist_head file_open; + struct hlist_head task_alloc; + struct hlist_head task_free; + struct hlist_head cred_alloc_blank; + struct hlist_head cred_free; + struct hlist_head cred_prepare; + struct hlist_head cred_transfer; + struct hlist_head cred_getsecid; + struct hlist_head kernel_act_as; + struct hlist_head kernel_create_files_as; + struct hlist_head kernel_module_request; + struct hlist_head kernel_load_data; + struct hlist_head kernel_post_load_data; + struct hlist_head kernel_read_file; + struct hlist_head kernel_post_read_file; + struct hlist_head task_fix_setuid; + struct hlist_head task_fix_setgid; + struct hlist_head task_setpgid; + struct hlist_head task_getpgid; + struct hlist_head task_getsid; + struct hlist_head task_getsecid; + struct hlist_head task_setnice; + struct hlist_head task_setioprio; + struct hlist_head task_getioprio; + struct hlist_head task_prlimit; + struct hlist_head task_setrlimit; + struct hlist_head task_setscheduler; + struct hlist_head task_getscheduler; + struct hlist_head task_movememory; + struct hlist_head task_kill; + struct hlist_head task_prctl; + struct hlist_head task_to_inode; + struct hlist_head ipc_permission; + struct hlist_head ipc_getsecid; + struct hlist_head msg_msg_alloc_security; + struct hlist_head msg_msg_free_security; + struct hlist_head msg_queue_alloc_security; + struct hlist_head msg_queue_free_security; + struct hlist_head msg_queue_associate; + struct hlist_head msg_queue_msgctl; + struct hlist_head msg_queue_msgsnd; + struct hlist_head msg_queue_msgrcv; + struct hlist_head shm_alloc_security; + struct hlist_head shm_free_security; + struct hlist_head shm_associate; + struct hlist_head shm_shmctl; + struct hlist_head shm_shmat; + struct hlist_head sem_alloc_security; + struct hlist_head sem_free_security; + struct hlist_head sem_associate; + struct hlist_head sem_semctl; + struct hlist_head sem_semop; + struct hlist_head netlink_send; + struct hlist_head d_instantiate; + struct hlist_head getprocattr; + struct hlist_head setprocattr; + struct hlist_head ismaclabel; + struct hlist_head secid_to_secctx; + struct hlist_head secctx_to_secid; + struct hlist_head release_secctx; + struct hlist_head inode_invalidate_secctx; + struct hlist_head inode_notifysecctx; + struct hlist_head inode_setsecctx; + struct hlist_head inode_getsecctx; + struct hlist_head post_notification; + struct hlist_head watch_key; + struct hlist_head unix_stream_connect; + struct hlist_head unix_may_send; + struct hlist_head socket_create; + struct hlist_head socket_post_create; + struct hlist_head socket_socketpair; + struct hlist_head socket_bind; + struct hlist_head socket_connect; + struct hlist_head socket_listen; + struct hlist_head socket_accept; + struct hlist_head socket_sendmsg; + struct hlist_head socket_recvmsg; + struct hlist_head socket_getsockname; + struct hlist_head socket_getpeername; + struct hlist_head socket_getsockopt; + struct hlist_head socket_setsockopt; + struct hlist_head socket_shutdown; + struct hlist_head socket_sock_rcv_skb; + struct hlist_head socket_getpeersec_stream; + struct hlist_head socket_getpeersec_dgram; + struct hlist_head sk_alloc_security; + struct hlist_head sk_free_security; + struct hlist_head sk_clone_security; + struct hlist_head sk_getsecid; + struct hlist_head sock_graft; + struct hlist_head inet_conn_request; + struct hlist_head inet_csk_clone; + struct hlist_head inet_conn_established; + struct hlist_head secmark_relabel_packet; + struct hlist_head secmark_refcount_inc; + struct hlist_head secmark_refcount_dec; + struct hlist_head req_classify_flow; + struct hlist_head tun_dev_alloc_security; + struct hlist_head tun_dev_free_security; + struct hlist_head tun_dev_create; + struct hlist_head tun_dev_attach_queue; + struct hlist_head tun_dev_attach; + struct hlist_head tun_dev_open; + struct hlist_head sctp_assoc_request; + struct hlist_head sctp_bind_connect; + struct hlist_head sctp_sk_clone; + struct hlist_head ib_pkey_access; + struct hlist_head ib_endport_manage_subnet; + struct hlist_head ib_alloc_security; + struct hlist_head ib_free_security; + struct hlist_head xfrm_policy_alloc_security; + struct hlist_head xfrm_policy_clone_security; + struct hlist_head xfrm_policy_free_security; + struct hlist_head xfrm_policy_delete_security; + struct hlist_head xfrm_state_alloc; + struct hlist_head xfrm_state_alloc_acquire; + struct hlist_head xfrm_state_free_security; + struct hlist_head xfrm_state_delete_security; + struct hlist_head xfrm_policy_lookup; + struct hlist_head xfrm_state_pol_flow_match; + struct hlist_head xfrm_decode_session; + struct hlist_head key_alloc; + struct hlist_head key_free; + struct hlist_head key_permission; + struct hlist_head key_getsecurity; + struct hlist_head audit_rule_init; + struct hlist_head audit_rule_known; + struct hlist_head audit_rule_match; + struct hlist_head audit_rule_free; + struct hlist_head bpf; + struct hlist_head bpf_map; + struct hlist_head bpf_prog; + struct hlist_head bpf_map_alloc_security; + struct hlist_head bpf_map_free_security; + struct hlist_head bpf_prog_alloc_security; + struct hlist_head bpf_prog_free_security; + struct hlist_head locked_down; + struct hlist_head lock_kernel_down; + struct hlist_head perf_event_open; + struct hlist_head perf_event_alloc; + struct hlist_head perf_event_free; + struct hlist_head perf_event_read; + struct hlist_head perf_event_write; +}; + +struct security_hook_list { + struct hlist_node list; + struct hlist_head *head; + union security_list_options hook; + char *lsm; +}; + +enum lsm_order { + LSM_ORDER_FIRST = 4294967295, + LSM_ORDER_MUTABLE = 0, +}; + +struct lsm_info { + const char *name; + enum lsm_order order; + long unsigned int flags; + int *enabled; + int (*init)(); + struct lsm_blob_sizes *blobs; +}; + +enum lsm_event { + LSM_POLICY_CHANGE = 0, +}; + +struct ethhdr { + unsigned char h_dest[6]; + unsigned char h_source[6]; + __be16 h_proto; +}; + +struct ethtool_drvinfo { + __u32 cmd; + char driver[32]; + char version[32]; + char fw_version[32]; + char bus_info[32]; + char erom_version[32]; + char reserved2[12]; + __u32 n_priv_flags; + __u32 n_stats; + __u32 testinfo_len; + __u32 eedump_len; + __u32 regdump_len; +}; + +struct ethtool_wolinfo { + __u32 cmd; + __u32 supported; + __u32 wolopts; + __u8 sopass[6]; +}; + +struct ethtool_tunable { + __u32 cmd; + __u32 id; + __u32 type_id; + __u32 len; + void *data[0]; +}; + +struct ethtool_regs { + __u32 cmd; + __u32 version; + __u32 len; + __u8 data[0]; +}; + +struct ethtool_eeprom { + __u32 cmd; + __u32 magic; + __u32 offset; + __u32 len; + __u8 data[0]; +}; + +struct ethtool_eee { + __u32 cmd; + __u32 supported; + __u32 advertised; + __u32 lp_advertised; + __u32 eee_active; + __u32 eee_enabled; + __u32 tx_lpi_enabled; + __u32 tx_lpi_timer; + __u32 reserved[2]; +}; + +struct ethtool_modinfo { + __u32 cmd; + __u32 type; + __u32 eeprom_len; + __u32 reserved[8]; +}; + +struct ethtool_coalesce { + __u32 cmd; + __u32 rx_coalesce_usecs; + __u32 rx_max_coalesced_frames; + __u32 rx_coalesce_usecs_irq; + __u32 rx_max_coalesced_frames_irq; + __u32 tx_coalesce_usecs; + __u32 tx_max_coalesced_frames; + __u32 tx_coalesce_usecs_irq; + __u32 tx_max_coalesced_frames_irq; + __u32 stats_block_coalesce_usecs; + __u32 use_adaptive_rx_coalesce; + __u32 use_adaptive_tx_coalesce; + __u32 pkt_rate_low; + __u32 rx_coalesce_usecs_low; + __u32 rx_max_coalesced_frames_low; + __u32 tx_coalesce_usecs_low; + __u32 tx_max_coalesced_frames_low; + __u32 pkt_rate_high; + __u32 rx_coalesce_usecs_high; + __u32 rx_max_coalesced_frames_high; + __u32 tx_coalesce_usecs_high; + __u32 tx_max_coalesced_frames_high; + __u32 rate_sample_interval; +}; + +struct ethtool_ringparam { + __u32 cmd; + __u32 rx_max_pending; + __u32 rx_mini_max_pending; + __u32 rx_jumbo_max_pending; + __u32 tx_max_pending; + __u32 rx_pending; + __u32 rx_mini_pending; + __u32 rx_jumbo_pending; + __u32 tx_pending; +}; + +struct ethtool_channels { + __u32 cmd; + __u32 max_rx; + __u32 max_tx; + __u32 max_other; + __u32 max_combined; + __u32 rx_count; + __u32 tx_count; + __u32 other_count; + __u32 combined_count; +}; + +struct ethtool_pauseparam { + __u32 cmd; + __u32 autoneg; + __u32 rx_pause; + __u32 tx_pause; +}; + +enum ethtool_link_ext_state { + ETHTOOL_LINK_EXT_STATE_AUTONEG = 0, + ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE = 1, + ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH = 2, + ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY = 3, + ETHTOOL_LINK_EXT_STATE_NO_CABLE = 4, + ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE = 5, + ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE = 6, + ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE = 7, + ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED = 8, + ETHTOOL_LINK_EXT_STATE_OVERHEAT = 9, +}; + +enum ethtool_link_ext_substate_autoneg { + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 1, + ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED = 2, + ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED = 3, + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE = 4, + ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE = 5, + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD = 6, +}; + +enum ethtool_link_ext_substate_link_training { + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 1, + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT = 2, + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY = 3, + ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT = 4, +}; + +enum ethtool_link_ext_substate_link_logical_mismatch { + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 1, + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK = 2, + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS = 3, + ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED = 4, + ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED = 5, +}; + +enum ethtool_link_ext_substate_bad_signal_integrity { + ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 1, + ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE = 2, +}; + +enum ethtool_link_ext_substate_cable_issue { + ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 1, + ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE = 2, +}; + +struct ethtool_test { + __u32 cmd; + __u32 flags; + __u32 reserved; + __u32 len; + __u64 data[0]; +}; + +struct ethtool_stats { + __u32 cmd; + __u32 n_stats; + __u64 data[0]; +}; + +struct ethtool_tcpip4_spec { + __be32 ip4src; + __be32 ip4dst; + __be16 psrc; + __be16 pdst; + __u8 tos; +}; + +struct ethtool_ah_espip4_spec { + __be32 ip4src; + __be32 ip4dst; + __be32 spi; + __u8 tos; +}; + +struct ethtool_usrip4_spec { + __be32 ip4src; + __be32 ip4dst; + __be32 l4_4_bytes; + __u8 tos; + __u8 ip_ver; + __u8 proto; +}; + +struct ethtool_tcpip6_spec { + __be32 ip6src[4]; + __be32 ip6dst[4]; + __be16 psrc; + __be16 pdst; + __u8 tclass; +}; + +struct ethtool_ah_espip6_spec { + __be32 ip6src[4]; + __be32 ip6dst[4]; + __be32 spi; + __u8 tclass; +}; + +struct ethtool_usrip6_spec { + __be32 ip6src[4]; + __be32 ip6dst[4]; + __be32 l4_4_bytes; + __u8 tclass; + __u8 l4_proto; +}; + +union ethtool_flow_union { + struct ethtool_tcpip4_spec tcp_ip4_spec; + struct ethtool_tcpip4_spec udp_ip4_spec; + struct ethtool_tcpip4_spec sctp_ip4_spec; + struct ethtool_ah_espip4_spec ah_ip4_spec; + struct ethtool_ah_espip4_spec esp_ip4_spec; + struct ethtool_usrip4_spec usr_ip4_spec; + struct ethtool_tcpip6_spec tcp_ip6_spec; + struct ethtool_tcpip6_spec udp_ip6_spec; + struct ethtool_tcpip6_spec sctp_ip6_spec; + struct ethtool_ah_espip6_spec ah_ip6_spec; + struct ethtool_ah_espip6_spec esp_ip6_spec; + struct ethtool_usrip6_spec usr_ip6_spec; + struct ethhdr ether_spec; + __u8 hdata[52]; +}; + +struct ethtool_flow_ext { + __u8 padding[2]; + unsigned char h_dest[6]; + __be16 vlan_etype; + __be16 vlan_tci; + __be32 data[2]; +}; + +struct ethtool_rx_flow_spec { + __u32 flow_type; + union ethtool_flow_union h_u; + struct ethtool_flow_ext h_ext; + union ethtool_flow_union m_u; + struct ethtool_flow_ext m_ext; + __u64 ring_cookie; + __u32 location; +}; + +struct ethtool_rxnfc { + __u32 cmd; + __u32 flow_type; + __u64 data; + struct ethtool_rx_flow_spec fs; + union { + __u32 rule_cnt; + __u32 rss_context; + }; + __u32 rule_locs[0]; +}; + +struct ethtool_flash { + __u32 cmd; + __u32 region; + char data[128]; +}; + +struct ethtool_dump { + __u32 cmd; + __u32 version; + __u32 flag; + __u32 len; + __u8 data[0]; +}; + +struct ethtool_ts_info { + __u32 cmd; + __u32 so_timestamping; + __s32 phc_index; + __u32 tx_types; + __u32 tx_reserved[3]; + __u32 rx_filters; + __u32 rx_reserved[3]; +}; + +struct ethtool_fecparam { + __u32 cmd; + __u32 active_fec; + __u32 fec; + __u32 reserved; +}; + +enum ethtool_link_mode_bit_indices { + ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0, + ETHTOOL_LINK_MODE_10baseT_Full_BIT = 1, + ETHTOOL_LINK_MODE_100baseT_Half_BIT = 2, + ETHTOOL_LINK_MODE_100baseT_Full_BIT = 3, + ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 4, + ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 5, + ETHTOOL_LINK_MODE_Autoneg_BIT = 6, + ETHTOOL_LINK_MODE_TP_BIT = 7, + ETHTOOL_LINK_MODE_AUI_BIT = 8, + ETHTOOL_LINK_MODE_MII_BIT = 9, + ETHTOOL_LINK_MODE_FIBRE_BIT = 10, + ETHTOOL_LINK_MODE_BNC_BIT = 11, + ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 12, + ETHTOOL_LINK_MODE_Pause_BIT = 13, + ETHTOOL_LINK_MODE_Asym_Pause_BIT = 14, + ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 15, + ETHTOOL_LINK_MODE_Backplane_BIT = 16, + ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 17, + ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 18, + ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 19, + ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 20, + ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 21, + ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 22, + ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 23, + ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 24, + ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 25, + ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 26, + ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 27, + ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 28, + ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 29, + ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 30, + ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 31, + ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 32, + ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 33, + ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 34, + ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 35, + ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 36, + ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 37, + ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 38, + ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 39, + ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 40, + ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 41, + ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 42, + ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 43, + ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 44, + ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 45, + ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 46, + ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 47, + ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 48, + ETHTOOL_LINK_MODE_FEC_NONE_BIT = 49, + ETHTOOL_LINK_MODE_FEC_RS_BIT = 50, + ETHTOOL_LINK_MODE_FEC_BASER_BIT = 51, + ETHTOOL_LINK_MODE_50000baseKR_Full_BIT = 52, + ETHTOOL_LINK_MODE_50000baseSR_Full_BIT = 53, + ETHTOOL_LINK_MODE_50000baseCR_Full_BIT = 54, + ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT = 55, + ETHTOOL_LINK_MODE_50000baseDR_Full_BIT = 56, + ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT = 57, + ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT = 58, + ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT = 59, + ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 60, + ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT = 61, + ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT = 62, + ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT = 63, + ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 64, + ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 65, + ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 66, + ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 67, + ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 68, + ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT = 69, + ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT = 70, + ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 71, + ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 72, + ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 73, + ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 74, + ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 75, + ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 76, + ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 77, + ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 78, + ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 79, + ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 80, + ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 81, + ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 82, + ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 83, + ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 84, + ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 85, + ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 86, + ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 87, + ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 88, + ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 89, + ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 90, + ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 91, + __ETHTOOL_LINK_MODE_MASK_NBITS = 92, +}; + +struct ethtool_link_settings { + __u32 cmd; + __u32 speed; + __u8 duplex; + __u8 port; + __u8 phy_address; + __u8 autoneg; + __u8 mdio_support; + __u8 eth_tp_mdix; + __u8 eth_tp_mdix_ctrl; + __s8 link_mode_masks_nwords; + __u8 transceiver; + __u8 master_slave_cfg; + __u8 master_slave_state; + __u8 reserved1[1]; + __u32 reserved[7]; + __u32 link_mode_masks[0]; +}; + +struct ethtool_link_ext_state_info { + enum ethtool_link_ext_state link_ext_state; + union { + enum ethtool_link_ext_substate_autoneg autoneg; + enum ethtool_link_ext_substate_link_training link_training; + enum ethtool_link_ext_substate_link_logical_mismatch link_logical_mismatch; + enum ethtool_link_ext_substate_bad_signal_integrity bad_signal_integrity; + enum ethtool_link_ext_substate_cable_issue cable_issue; + u8 __link_ext_substate; + }; +}; + +struct ethtool_link_ksettings { + struct ethtool_link_settings base; + struct { + long unsigned int supported[2]; + long unsigned int advertising[2]; + long unsigned int lp_advertising[2]; + } link_modes; +}; + +struct ethtool_pause_stats { + u64 tx_pause_frames; + u64 rx_pause_frames; +}; + +enum ib_uverbs_write_cmds { + IB_USER_VERBS_CMD_GET_CONTEXT = 0, + IB_USER_VERBS_CMD_QUERY_DEVICE = 1, + IB_USER_VERBS_CMD_QUERY_PORT = 2, + IB_USER_VERBS_CMD_ALLOC_PD = 3, + IB_USER_VERBS_CMD_DEALLOC_PD = 4, + IB_USER_VERBS_CMD_CREATE_AH = 5, + IB_USER_VERBS_CMD_MODIFY_AH = 6, + IB_USER_VERBS_CMD_QUERY_AH = 7, + IB_USER_VERBS_CMD_DESTROY_AH = 8, + IB_USER_VERBS_CMD_REG_MR = 9, + IB_USER_VERBS_CMD_REG_SMR = 10, + IB_USER_VERBS_CMD_REREG_MR = 11, + IB_USER_VERBS_CMD_QUERY_MR = 12, + IB_USER_VERBS_CMD_DEREG_MR = 13, + IB_USER_VERBS_CMD_ALLOC_MW = 14, + IB_USER_VERBS_CMD_BIND_MW = 15, + IB_USER_VERBS_CMD_DEALLOC_MW = 16, + IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL = 17, + IB_USER_VERBS_CMD_CREATE_CQ = 18, + IB_USER_VERBS_CMD_RESIZE_CQ = 19, + IB_USER_VERBS_CMD_DESTROY_CQ = 20, + IB_USER_VERBS_CMD_POLL_CQ = 21, + IB_USER_VERBS_CMD_PEEK_CQ = 22, + IB_USER_VERBS_CMD_REQ_NOTIFY_CQ = 23, + IB_USER_VERBS_CMD_CREATE_QP = 24, + IB_USER_VERBS_CMD_QUERY_QP = 25, + IB_USER_VERBS_CMD_MODIFY_QP = 26, + IB_USER_VERBS_CMD_DESTROY_QP = 27, + IB_USER_VERBS_CMD_POST_SEND = 28, + IB_USER_VERBS_CMD_POST_RECV = 29, + IB_USER_VERBS_CMD_ATTACH_MCAST = 30, + IB_USER_VERBS_CMD_DETACH_MCAST = 31, + IB_USER_VERBS_CMD_CREATE_SRQ = 32, + IB_USER_VERBS_CMD_MODIFY_SRQ = 33, + IB_USER_VERBS_CMD_QUERY_SRQ = 34, + IB_USER_VERBS_CMD_DESTROY_SRQ = 35, + IB_USER_VERBS_CMD_POST_SRQ_RECV = 36, + IB_USER_VERBS_CMD_OPEN_XRCD = 37, + IB_USER_VERBS_CMD_CLOSE_XRCD = 38, + IB_USER_VERBS_CMD_CREATE_XSRQ = 39, + IB_USER_VERBS_CMD_OPEN_QP = 40, +}; + +enum ib_uverbs_wc_opcode { + IB_UVERBS_WC_SEND = 0, + IB_UVERBS_WC_RDMA_WRITE = 1, + IB_UVERBS_WC_RDMA_READ = 2, + IB_UVERBS_WC_COMP_SWAP = 3, + IB_UVERBS_WC_FETCH_ADD = 4, + IB_UVERBS_WC_BIND_MW = 5, + IB_UVERBS_WC_LOCAL_INV = 6, + IB_UVERBS_WC_TSO = 7, +}; + +enum ib_uverbs_create_qp_mask { + IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1, +}; + +enum ib_uverbs_wr_opcode { + IB_UVERBS_WR_RDMA_WRITE = 0, + IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1, + IB_UVERBS_WR_SEND = 2, + IB_UVERBS_WR_SEND_WITH_IMM = 3, + IB_UVERBS_WR_RDMA_READ = 4, + IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5, + IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6, + IB_UVERBS_WR_LOCAL_INV = 7, + IB_UVERBS_WR_BIND_MW = 8, + IB_UVERBS_WR_SEND_WITH_INV = 9, + IB_UVERBS_WR_TSO = 10, + IB_UVERBS_WR_RDMA_READ_WITH_INV = 11, + IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, + IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, +}; + +enum ib_uverbs_access_flags { + IB_UVERBS_ACCESS_LOCAL_WRITE = 1, + IB_UVERBS_ACCESS_REMOTE_WRITE = 2, + IB_UVERBS_ACCESS_REMOTE_READ = 4, + IB_UVERBS_ACCESS_REMOTE_ATOMIC = 8, + IB_UVERBS_ACCESS_MW_BIND = 16, + IB_UVERBS_ACCESS_ZERO_BASED = 32, + IB_UVERBS_ACCESS_ON_DEMAND = 64, + IB_UVERBS_ACCESS_HUGETLB = 128, + IB_UVERBS_ACCESS_RELAXED_ORDERING = 1048576, + IB_UVERBS_ACCESS_OPTIONAL_RANGE = 1072693248, +}; + +enum ib_uverbs_srq_type { + IB_UVERBS_SRQT_BASIC = 0, + IB_UVERBS_SRQT_XRC = 1, + IB_UVERBS_SRQT_TM = 2, +}; + +enum ib_uverbs_wq_type { + IB_UVERBS_WQT_RQ = 0, +}; + +enum ib_uverbs_wq_flags { + IB_UVERBS_WQ_FLAGS_CVLAN_STRIPPING = 1, + IB_UVERBS_WQ_FLAGS_SCATTER_FCS = 2, + IB_UVERBS_WQ_FLAGS_DELAY_DROP = 4, + IB_UVERBS_WQ_FLAGS_PCI_WRITE_END_PADDING = 8, +}; + +enum ib_uverbs_qp_type { + IB_UVERBS_QPT_RC = 2, + IB_UVERBS_QPT_UC = 3, + IB_UVERBS_QPT_UD = 4, + IB_UVERBS_QPT_RAW_PACKET = 8, + IB_UVERBS_QPT_XRC_INI = 9, + IB_UVERBS_QPT_XRC_TGT = 10, + IB_UVERBS_QPT_DRIVER = 255, +}; + +enum ib_uverbs_qp_create_flags { + IB_UVERBS_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 2, + IB_UVERBS_QP_CREATE_SCATTER_FCS = 256, + IB_UVERBS_QP_CREATE_CVLAN_STRIPPING = 512, + IB_UVERBS_QP_CREATE_PCI_WRITE_END_PADDING = 2048, + IB_UVERBS_QP_CREATE_SQ_SIG_ALL = 4096, +}; + +enum ib_uverbs_gid_type { + IB_UVERBS_GID_TYPE_IB = 0, + IB_UVERBS_GID_TYPE_ROCE_V1 = 1, + IB_UVERBS_GID_TYPE_ROCE_V2 = 2, +}; + +enum ib_poll_context { + IB_POLL_SOFTIRQ = 0, + IB_POLL_WORKQUEUE = 1, + IB_POLL_UNBOUND_WORKQUEUE = 2, + IB_POLL_LAST_POOL_TYPE = 2, + IB_POLL_DIRECT = 3, +}; + +struct lsm_network_audit { + int netif; + const struct sock *sk; + u16 family; + __be16 dport; + __be16 sport; + union { + struct { + __be32 daddr; + __be32 saddr; + } v4; + struct { + struct in6_addr daddr; + struct in6_addr saddr; + } v6; + } fam; +}; + +struct lsm_ioctlop_audit { + struct path path; + u16 cmd; +}; + +struct lsm_ibpkey_audit { + u64 subnet_prefix; + u16 pkey; +}; + +struct lsm_ibendport_audit { + char dev_name[64]; + u8 port; +}; + +struct selinux_state; + +struct selinux_audit_data { + u32 ssid; + u32 tsid; + u16 tclass; + u32 requested; + u32 audited; + u32 denied; + int result; + struct selinux_state *state; +}; + +struct common_audit_data { + char type; + union { + struct path path; + struct dentry *dentry; + struct inode *inode; + struct lsm_network_audit *net; + int cap; + int ipc_id; + struct task_struct *tsk; + struct { + key_serial_t key; + char *key_desc; + } key_struct; + char *kmod_name; + struct lsm_ioctlop_audit *op; + struct file *file; + struct lsm_ibpkey_audit *ibpkey; + struct lsm_ibendport_audit *ibendport; + int reason; + } u; + union { + struct selinux_audit_data *selinux_audit_data; + }; +}; + +enum { + POLICYDB_CAPABILITY_NETPEER = 0, + POLICYDB_CAPABILITY_OPENPERM = 1, + POLICYDB_CAPABILITY_EXTSOCKCLASS = 2, + POLICYDB_CAPABILITY_ALWAYSNETWORK = 3, + POLICYDB_CAPABILITY_CGROUPSECLABEL = 4, + POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION = 5, + POLICYDB_CAPABILITY_GENFS_SECLABEL_SYMLINKS = 6, + __POLICYDB_CAPABILITY_MAX = 7, +}; + +struct selinux_avc; + +struct selinux_policy; + +struct selinux_state { + bool enforcing; + bool checkreqprot; + bool initialized; + bool policycap[7]; + struct page *status_page; + struct mutex status_lock; + struct selinux_avc *avc; + struct selinux_policy *policy; + struct mutex policy_mutex; +}; + +struct avc_cache { + struct hlist_head slots[512]; + spinlock_t slots_lock[512]; + atomic_t lru_hint; + atomic_t active_nodes; + u32 latest_notif; +}; + +struct selinux_avc { + unsigned int avc_cache_threshold; + struct avc_cache avc_cache; +}; + +struct av_decision { + u32 allowed; + u32 auditallow; + u32 auditdeny; + u32 seqno; + u32 flags; +}; + +struct extended_perms_data { + u32 p[8]; +}; + +struct extended_perms_decision { + u8 used; + u8 driver; + struct extended_perms_data *allowed; + struct extended_perms_data *auditallow; + struct extended_perms_data *dontaudit; +}; + +struct extended_perms { + u16 len; + struct extended_perms_data drivers; +}; + +struct avc_cache_stats { + unsigned int lookups; + unsigned int misses; + unsigned int allocations; + unsigned int reclaims; + unsigned int frees; +}; + +struct security_class_mapping { + const char *name; + const char *perms[33]; +}; + +struct trace_event_raw_selinux_audited { + struct trace_entry ent; + u32 requested; + u32 denied; + u32 audited; + int result; + u32 __data_loc_scontext; + u32 __data_loc_tcontext; + u32 __data_loc_tclass; + char __data[0]; +}; + +struct trace_event_data_offsets_selinux_audited { + u32 scontext; + u32 tcontext; + u32 tclass; +}; + +typedef void (*btf_trace_selinux_audited)(void *, struct selinux_audit_data *, char *, char *, const char *); + +struct avc_xperms_node; + +struct avc_entry { + u32 ssid; + u32 tsid; + u16 tclass; + struct av_decision avd; + struct avc_xperms_node *xp_node; +}; + +struct avc_xperms_node { + struct extended_perms xp; + struct list_head xpd_head; +}; + +struct avc_node { + struct avc_entry ae; + struct hlist_node list; + struct callback_head rhead; +}; + +struct avc_xperms_decision_node { + struct extended_perms_decision xpd; + struct list_head xpd_list; +}; + +struct avc_callback_node { + int (*callback)(u32); + u32 events; + struct avc_callback_node *next; +}; + +typedef __u16 __sum16; + +enum sctp_endpoint_type { + SCTP_EP_TYPE_SOCKET = 0, + SCTP_EP_TYPE_ASSOCIATION = 1, +}; + +struct sctp_chunk; + +struct sctp_inq { + struct list_head in_chunk_list; + struct sctp_chunk *in_progress; + struct work_struct immediate; +}; + +struct sctp_bind_addr { + __u16 port; + struct list_head address_list; +}; + +struct sctp_ep_common { + struct hlist_node node; + int hashent; + enum sctp_endpoint_type type; + refcount_t refcnt; + bool dead; + struct sock *sk; + struct net *net; + struct sctp_inq inqueue; + struct sctp_bind_addr bind_addr; +}; + +struct sctp_hmac_algo_param; + +struct sctp_chunks_param; + +struct sctp_endpoint { + struct sctp_ep_common base; + struct list_head asocs; + __u8 secret_key[32]; + __u8 *digest; + __u32 sndbuf_policy; + __u32 rcvbuf_policy; + struct crypto_shash **auth_hmacs; + struct sctp_hmac_algo_param *auth_hmacs_list; + struct sctp_chunks_param *auth_chunk_list; + struct list_head endpoint_shared_keys; + __u16 active_key_id; + __u8 ecn_enable: 1; + __u8 auth_enable: 1; + __u8 intl_enable: 1; + __u8 prsctp_enable: 1; + __u8 asconf_enable: 1; + __u8 reconf_enable: 1; + __u8 strreset_enable; + u32 secid; + u32 peer_secid; +}; + +struct sockaddr_in6 { + short unsigned int sin6_family; + __be16 sin6_port; + __be32 sin6_flowinfo; + struct in6_addr sin6_addr; + __u32 sin6_scope_id; +}; + +struct in_addr { + __be32 s_addr; +}; + +struct sockaddr_in { + __kernel_sa_family_t sin_family; + __be16 sin_port; + struct in_addr sin_addr; + unsigned char __pad[8]; +}; + +struct nf_hook_state; + +typedef unsigned int nf_hookfn(void *, struct sk_buff *, const struct nf_hook_state *); + +struct nf_hook_entry { + nf_hookfn *hook; + void *priv; +}; + +struct nf_hook_entries { + u16 num_hook_entries; + struct nf_hook_entry hooks[0]; +}; + +struct nf_hook_state { + unsigned int hook; + u_int8_t pf; + struct net_device *in; + struct net_device *out; + struct sock *sk; + struct net *net; + int (*okfn)(struct net *, struct sock *, struct sk_buff *); +}; + +struct nf_hook_ops { + nf_hookfn *hook; + struct net_device *dev; + void *priv; + u_int8_t pf; + unsigned int hooknum; + int priority; +}; + +enum nf_ip_hook_priorities { + NF_IP_PRI_FIRST = 2147483648, + NF_IP_PRI_RAW_BEFORE_DEFRAG = 4294966846, + NF_IP_PRI_CONNTRACK_DEFRAG = 4294966896, + NF_IP_PRI_RAW = 4294966996, + NF_IP_PRI_SELINUX_FIRST = 4294967071, + NF_IP_PRI_CONNTRACK = 4294967096, + NF_IP_PRI_MANGLE = 4294967146, + NF_IP_PRI_NAT_DST = 4294967196, + NF_IP_PRI_FILTER = 0, + NF_IP_PRI_SECURITY = 50, + NF_IP_PRI_NAT_SRC = 100, + NF_IP_PRI_SELINUX_LAST = 225, + NF_IP_PRI_CONNTRACK_HELPER = 300, + NF_IP_PRI_CONNTRACK_CONFIRM = 2147483647, + NF_IP_PRI_LAST = 2147483647, +}; + +enum nf_ip6_hook_priorities { + NF_IP6_PRI_FIRST = 2147483648, + NF_IP6_PRI_RAW_BEFORE_DEFRAG = 4294966846, + NF_IP6_PRI_CONNTRACK_DEFRAG = 4294966896, + NF_IP6_PRI_RAW = 4294966996, + NF_IP6_PRI_SELINUX_FIRST = 4294967071, + NF_IP6_PRI_CONNTRACK = 4294967096, + NF_IP6_PRI_MANGLE = 4294967146, + NF_IP6_PRI_NAT_DST = 4294967196, + NF_IP6_PRI_FILTER = 0, + NF_IP6_PRI_SECURITY = 50, + NF_IP6_PRI_NAT_SRC = 100, + NF_IP6_PRI_SELINUX_LAST = 225, + NF_IP6_PRI_CONNTRACK_HELPER = 300, + NF_IP6_PRI_LAST = 2147483647, +}; + +struct socket_alloc { + struct socket socket; + struct inode vfs_inode; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct ip_options { + __be32 faddr; + __be32 nexthop; + unsigned char optlen; + unsigned char srr; + unsigned char rr; + unsigned char ts; + unsigned char is_strictroute: 1; + unsigned char srr_is_hit: 1; + unsigned char is_changed: 1; + unsigned char rr_needaddr: 1; + unsigned char ts_needtime: 1; + unsigned char ts_needaddr: 1; + unsigned char router_alert; + unsigned char cipso; + unsigned char __pad2; + unsigned char __data[0]; +}; + +struct ip_options_rcu { + struct callback_head rcu; + struct ip_options opt; +}; + +struct ipv6_opt_hdr; + +struct ipv6_rt_hdr; + +struct ipv6_txoptions { + refcount_t refcnt; + int tot_len; + __u16 opt_flen; + __u16 opt_nflen; + struct ipv6_opt_hdr *hopopt; + struct ipv6_opt_hdr *dst0opt; + struct ipv6_rt_hdr *srcrt; + struct ipv6_opt_hdr *dst1opt; + struct callback_head rcu; +}; + +struct inet_cork { + unsigned int flags; + __be32 addr; + struct ip_options *opt; + unsigned int fragsize; + int length; + struct dst_entry *dst; + u8 tx_flags; + __u8 ttl; + __s16 tos; + char priority; + __u16 gso_size; + u64 transmit_time; + u32 mark; +}; + +struct inet_cork_full { + struct inet_cork base; + struct flowi fl; +}; + +struct ipv6_pinfo; + +struct ip_mc_socklist; + +struct inet_sock { + struct sock sk; + struct ipv6_pinfo *pinet6; + __be32 inet_saddr; + __s16 uc_ttl; + __u16 cmsg_flags; + __be16 inet_sport; + __u16 inet_id; + struct ip_options_rcu *inet_opt; + int rx_dst_ifindex; + __u8 tos; + __u8 min_ttl; + __u8 mc_ttl; + __u8 pmtudisc; + __u8 recverr: 1; + __u8 is_icsk: 1; + __u8 freebind: 1; + __u8 hdrincl: 1; + __u8 mc_loop: 1; + __u8 transparent: 1; + __u8 mc_all: 1; + __u8 nodefrag: 1; + __u8 bind_address_no_port: 1; + __u8 recverr_rfc4884: 1; + __u8 defer_connect: 1; + __u8 rcv_tos; + __u8 convert_csum; + int uc_index; + int mc_index; + __be32 mc_addr; + struct ip_mc_socklist *mc_list; + struct inet_cork_full cork; +}; + +struct in6_pktinfo { + struct in6_addr ipi6_addr; + int ipi6_ifindex; +}; + +struct inet6_cork { + struct ipv6_txoptions *opt; + u8 hop_limit; + u8 tclass; +}; + +struct ipv6_mc_socklist; + +struct ipv6_ac_socklist; + +struct ipv6_fl_socklist; + +struct ipv6_pinfo { + struct in6_addr saddr; + struct in6_pktinfo sticky_pktinfo; + const struct in6_addr *daddr_cache; + const struct in6_addr *saddr_cache; + __be32 flow_label; + __u32 frag_size; + __u16 __unused_1: 7; + __s16 hop_limit: 9; + __u16 mc_loop: 1; + __u16 __unused_2: 6; + __s16 mcast_hops: 9; + int ucast_oif; + int mcast_oif; + union { + struct { + __u16 srcrt: 1; + __u16 osrcrt: 1; + __u16 rxinfo: 1; + __u16 rxoinfo: 1; + __u16 rxhlim: 1; + __u16 rxohlim: 1; + __u16 hopopts: 1; + __u16 ohopopts: 1; + __u16 dstopts: 1; + __u16 odstopts: 1; + __u16 rxflow: 1; + __u16 rxtclass: 1; + __u16 rxpmtu: 1; + __u16 rxorigdstaddr: 1; + __u16 recvfragsize: 1; + } bits; + __u16 all; + } rxopt; + __u16 recverr: 1; + __u16 sndflow: 1; + __u16 repflow: 1; + __u16 pmtudisc: 3; + __u16 padding: 1; + __u16 srcprefs: 3; + __u16 dontfrag: 1; + __u16 autoflowlabel: 1; + __u16 autoflowlabel_set: 1; + __u16 mc_all: 1; + __u16 recverr_rfc4884: 1; + __u16 rtalert_isolate: 1; + __u8 min_hopcount; + __u8 tclass; + __be32 rcv_flowinfo; + __u32 dst_cookie; + __u32 rx_dst_cookie; + struct ipv6_mc_socklist *ipv6_mc_list; + struct ipv6_ac_socklist *ipv6_ac_list; + struct ipv6_fl_socklist *ipv6_fl_list; + struct ipv6_txoptions *opt; + struct sk_buff *pktoptions; + struct sk_buff *rxpmtu; + struct inet6_cork cork; +}; + +struct tcphdr { + __be16 source; + __be16 dest; + __be32 seq; + __be32 ack_seq; + __u16 res1: 4; + __u16 doff: 4; + __u16 fin: 1; + __u16 syn: 1; + __u16 rst: 1; + __u16 psh: 1; + __u16 ack: 1; + __u16 urg: 1; + __u16 ece: 1; + __u16 cwr: 1; + __be16 window; + __sum16 check; + __be16 urg_ptr; +}; + +struct iphdr { + __u8 ihl: 4; + __u8 version: 4; + __u8 tos; + __be16 tot_len; + __be16 id; + __be16 frag_off; + __u8 ttl; + __u8 protocol; + __sum16 check; + __be32 saddr; + __be32 daddr; +}; + +struct ipv6_rt_hdr { + __u8 nexthdr; + __u8 hdrlen; + __u8 type; + __u8 segments_left; +}; + +struct ipv6_opt_hdr { + __u8 nexthdr; + __u8 hdrlen; +}; + +struct ipv6hdr { + __u8 priority: 4; + __u8 version: 4; + __u8 flow_lbl[3]; + __be16 payload_len; + __u8 nexthdr; + __u8 hop_limit; + struct in6_addr saddr; + struct in6_addr daddr; +}; + +struct udphdr { + __be16 source; + __be16 dest; + __be16 len; + __sum16 check; +}; + +struct inet6_skb_parm { + int iif; + __be16 ra; + __u16 dst0; + __u16 srcrt; + __u16 dst1; + __u16 lastopt; + __u16 nhoff; + __u16 flags; + __u16 dsthao; + __u16 frag_max_size; +}; + +struct ip6_sf_socklist; + +struct ipv6_mc_socklist { + struct in6_addr addr; + int ifindex; + unsigned int sfmode; + struct ipv6_mc_socklist *next; + rwlock_t sflock; + struct ip6_sf_socklist *sflist; + struct callback_head rcu; +}; + +struct ipv6_ac_socklist { + struct in6_addr acl_addr; + int acl_ifindex; + struct ipv6_ac_socklist *acl_next; +}; + +struct ip6_flowlabel; + +struct ipv6_fl_socklist { + struct ipv6_fl_socklist *next; + struct ip6_flowlabel *fl; + struct callback_head rcu; +}; + +struct ip6_sf_socklist { + unsigned int sl_max; + unsigned int sl_count; + struct in6_addr sl_addr[0]; +}; + +struct ip6_flowlabel { + struct ip6_flowlabel *next; + __be32 label; + atomic_t users; + struct in6_addr dst; + struct ipv6_txoptions *opt; + long unsigned int linger; + struct callback_head rcu; + u8 share; + union { + struct pid *pid; + kuid_t uid; + } owner; + long unsigned int lastuse; + long unsigned int expires; + struct net *fl_net; +}; + +struct inet_skb_parm { + int iif; + struct ip_options opt; + u16 flags; + u16 frag_max_size; +}; + +struct tty_file_private { + struct tty_struct *tty; + struct file *file; + struct list_head list; +}; + +struct netlbl_lsm_cache { + refcount_t refcount; + void (*free)(const void *); + void *data; +}; + +struct netlbl_lsm_catmap { + u32 startbit; + u64 bitmap[4]; + struct netlbl_lsm_catmap *next; +}; + +struct netlbl_lsm_secattr { + u32 flags; + u32 type; + char *domain; + struct netlbl_lsm_cache *cache; + struct { + struct { + struct netlbl_lsm_catmap *cat; + u32 lvl; + } mls; + u32 secid; + } attr; +}; + +struct dccp_hdr { + __be16 dccph_sport; + __be16 dccph_dport; + __u8 dccph_doff; + __u8 dccph_cscov: 4; + __u8 dccph_ccval: 4; + __sum16 dccph_checksum; + __u8 dccph_x: 1; + __u8 dccph_type: 4; + __u8 dccph_reserved: 3; + __u8 dccph_seq2; + __be16 dccph_seq; +}; + +enum dccp_state { + DCCP_OPEN = 1, + DCCP_REQUESTING = 2, + DCCP_LISTEN = 10, + DCCP_RESPOND = 3, + DCCP_ACTIVE_CLOSEREQ = 4, + DCCP_PASSIVE_CLOSE = 8, + DCCP_CLOSING = 11, + DCCP_TIME_WAIT = 6, + DCCP_CLOSED = 7, + DCCP_NEW_SYN_RECV = 12, + DCCP_PARTOPEN = 13, + DCCP_PASSIVE_CLOSEREQ = 14, + DCCP_MAX_STATES = 15, +}; + +typedef __s32 sctp_assoc_t; + +enum sctp_msg_flags { + MSG_NOTIFICATION = 32768, +}; + +struct sctp_initmsg { + __u16 sinit_num_ostreams; + __u16 sinit_max_instreams; + __u16 sinit_max_attempts; + __u16 sinit_max_init_timeo; +}; + +struct sctp_sndrcvinfo { + __u16 sinfo_stream; + __u16 sinfo_ssn; + __u16 sinfo_flags; + __u32 sinfo_ppid; + __u32 sinfo_context; + __u32 sinfo_timetolive; + __u32 sinfo_tsn; + __u32 sinfo_cumtsn; + sctp_assoc_t sinfo_assoc_id; +}; + +struct sctp_rtoinfo { + sctp_assoc_t srto_assoc_id; + __u32 srto_initial; + __u32 srto_max; + __u32 srto_min; +}; + +struct sctp_assocparams { + sctp_assoc_t sasoc_assoc_id; + __u16 sasoc_asocmaxrxt; + __u16 sasoc_number_peer_destinations; + __u32 sasoc_peer_rwnd; + __u32 sasoc_local_rwnd; + __u32 sasoc_cookie_life; +}; + +struct sctp_paddrparams { + sctp_assoc_t spp_assoc_id; + struct __kernel_sockaddr_storage spp_address; + __u32 spp_hbinterval; + __u16 spp_pathmaxrxt; + __u32 spp_pathmtu; + __u32 spp_sackdelay; + __u32 spp_flags; + __u32 spp_ipv6_flowlabel; + __u8 spp_dscp; + char: 8; +} __attribute__((packed)); + +struct sctphdr { + __be16 source; + __be16 dest; + __be32 vtag; + __le32 checksum; +}; + +struct sctp_chunkhdr { + __u8 type; + __u8 flags; + __be16 length; +}; + +enum sctp_cid { + SCTP_CID_DATA = 0, + SCTP_CID_INIT = 1, + SCTP_CID_INIT_ACK = 2, + SCTP_CID_SACK = 3, + SCTP_CID_HEARTBEAT = 4, + SCTP_CID_HEARTBEAT_ACK = 5, + SCTP_CID_ABORT = 6, + SCTP_CID_SHUTDOWN = 7, + SCTP_CID_SHUTDOWN_ACK = 8, + SCTP_CID_ERROR = 9, + SCTP_CID_COOKIE_ECHO = 10, + SCTP_CID_COOKIE_ACK = 11, + SCTP_CID_ECN_ECNE = 12, + SCTP_CID_ECN_CWR = 13, + SCTP_CID_SHUTDOWN_COMPLETE = 14, + SCTP_CID_AUTH = 15, + SCTP_CID_I_DATA = 64, + SCTP_CID_FWD_TSN = 192, + SCTP_CID_ASCONF = 193, + SCTP_CID_I_FWD_TSN = 194, + SCTP_CID_ASCONF_ACK = 128, + SCTP_CID_RECONF = 130, +}; + +struct sctp_paramhdr { + __be16 type; + __be16 length; +}; + +enum sctp_param { + SCTP_PARAM_HEARTBEAT_INFO = 256, + SCTP_PARAM_IPV4_ADDRESS = 1280, + SCTP_PARAM_IPV6_ADDRESS = 1536, + SCTP_PARAM_STATE_COOKIE = 1792, + SCTP_PARAM_UNRECOGNIZED_PARAMETERS = 2048, + SCTP_PARAM_COOKIE_PRESERVATIVE = 2304, + SCTP_PARAM_HOST_NAME_ADDRESS = 2816, + SCTP_PARAM_SUPPORTED_ADDRESS_TYPES = 3072, + SCTP_PARAM_ECN_CAPABLE = 128, + SCTP_PARAM_RANDOM = 640, + SCTP_PARAM_CHUNKS = 896, + SCTP_PARAM_HMAC_ALGO = 1152, + SCTP_PARAM_SUPPORTED_EXT = 2176, + SCTP_PARAM_FWD_TSN_SUPPORT = 192, + SCTP_PARAM_ADD_IP = 448, + SCTP_PARAM_DEL_IP = 704, + SCTP_PARAM_ERR_CAUSE = 960, + SCTP_PARAM_SET_PRIMARY = 1216, + SCTP_PARAM_SUCCESS_REPORT = 1472, + SCTP_PARAM_ADAPTATION_LAYER_IND = 1728, + SCTP_PARAM_RESET_OUT_REQUEST = 3328, + SCTP_PARAM_RESET_IN_REQUEST = 3584, + SCTP_PARAM_RESET_TSN_REQUEST = 3840, + SCTP_PARAM_RESET_RESPONSE = 4096, + SCTP_PARAM_RESET_ADD_OUT_STREAMS = 4352, + SCTP_PARAM_RESET_ADD_IN_STREAMS = 4608, +}; + +struct sctp_datahdr { + __be32 tsn; + __be16 stream; + __be16 ssn; + __u32 ppid; + __u8 payload[0]; +}; + +struct sctp_idatahdr { + __be32 tsn; + __be16 stream; + __be16 reserved; + __be32 mid; + union { + __u32 ppid; + __be32 fsn; + }; + __u8 payload[0]; +}; + +struct sctp_inithdr { + __be32 init_tag; + __be32 a_rwnd; + __be16 num_outbound_streams; + __be16 num_inbound_streams; + __be32 initial_tsn; + __u8 params[0]; +}; + +struct sctp_init_chunk { + struct sctp_chunkhdr chunk_hdr; + struct sctp_inithdr init_hdr; +}; + +struct sctp_ipv4addr_param { + struct sctp_paramhdr param_hdr; + struct in_addr addr; +}; + +struct sctp_ipv6addr_param { + struct sctp_paramhdr param_hdr; + struct in6_addr addr; +}; + +struct sctp_cookie_preserve_param { + struct sctp_paramhdr param_hdr; + __be32 lifespan_increment; +}; + +struct sctp_hostname_param { + struct sctp_paramhdr param_hdr; + uint8_t hostname[0]; +}; + +struct sctp_supported_addrs_param { + struct sctp_paramhdr param_hdr; + __be16 types[0]; +}; + +struct sctp_adaptation_ind_param { + struct sctp_paramhdr param_hdr; + __be32 adaptation_ind; +}; + +struct sctp_supported_ext_param { + struct sctp_paramhdr param_hdr; + __u8 chunks[0]; +}; + +struct sctp_random_param { + struct sctp_paramhdr param_hdr; + __u8 random_val[0]; +}; + +struct sctp_chunks_param { + struct sctp_paramhdr param_hdr; + __u8 chunks[0]; +}; + +struct sctp_hmac_algo_param { + struct sctp_paramhdr param_hdr; + __be16 hmac_ids[0]; +}; + +struct sctp_cookie_param { + struct sctp_paramhdr p; + __u8 body[0]; +}; + +struct sctp_gap_ack_block { + __be16 start; + __be16 end; +}; + +union sctp_sack_variable { + struct sctp_gap_ack_block gab; + __be32 dup; +}; + +struct sctp_sackhdr { + __be32 cum_tsn_ack; + __be32 a_rwnd; + __be16 num_gap_ack_blocks; + __be16 num_dup_tsns; + union sctp_sack_variable variable[0]; +}; + +struct sctp_heartbeathdr { + struct sctp_paramhdr info; +}; + +struct sctp_shutdownhdr { + __be32 cum_tsn_ack; +}; + +struct sctp_errhdr { + __be16 cause; + __be16 length; + __u8 variable[0]; +}; + +struct sctp_ecnehdr { + __be32 lowest_tsn; +}; + +struct sctp_cwrhdr { + __be32 lowest_tsn; +}; + +struct sctp_fwdtsn_skip { + __be16 stream; + __be16 ssn; +}; + +struct sctp_fwdtsn_hdr { + __be32 new_cum_tsn; + struct sctp_fwdtsn_skip skip[0]; +}; + +struct sctp_ifwdtsn_skip { + __be16 stream; + __u8 reserved; + __u8 flags; + __be32 mid; +}; + +struct sctp_ifwdtsn_hdr { + __be32 new_cum_tsn; + struct sctp_ifwdtsn_skip skip[0]; +}; + +struct sctp_addip_param { + struct sctp_paramhdr param_hdr; + __be32 crr_id; +}; + +struct sctp_addiphdr { + __be32 serial; + __u8 params[0]; +}; + +struct sctp_authhdr { + __be16 shkey_id; + __be16 hmac_id; + __u8 hmac[0]; +}; + +union sctp_addr { + struct sockaddr_in v4; + struct sockaddr_in6 v6; + struct sockaddr sa; +}; + +struct sctp_cookie { + __u32 my_vtag; + __u32 peer_vtag; + __u32 my_ttag; + __u32 peer_ttag; + ktime_t expiration; + __u16 sinit_num_ostreams; + __u16 sinit_max_instreams; + __u32 initial_tsn; + union sctp_addr peer_addr; + __u16 my_port; + __u8 prsctp_capable; + __u8 padding; + __u32 adaptation_ind; + __u8 auth_random[36]; + __u8 auth_hmacs[10]; + __u8 auth_chunks[20]; + __u32 raw_addr_list_len; + struct sctp_init_chunk peer_init[0]; +}; + +struct sctp_tsnmap { + long unsigned int *tsn_map; + __u32 base_tsn; + __u32 cumulative_tsn_ack_point; + __u32 max_tsn_seen; + __u16 len; + __u16 pending_data; + __u16 num_dup_tsns; + __be32 dup_tsns[16]; +}; + +struct sctp_inithdr_host { + __u32 init_tag; + __u32 a_rwnd; + __u16 num_outbound_streams; + __u16 num_inbound_streams; + __u32 initial_tsn; +}; + +enum sctp_state { + SCTP_STATE_CLOSED = 0, + SCTP_STATE_COOKIE_WAIT = 1, + SCTP_STATE_COOKIE_ECHOED = 2, + SCTP_STATE_ESTABLISHED = 3, + SCTP_STATE_SHUTDOWN_PENDING = 4, + SCTP_STATE_SHUTDOWN_SENT = 5, + SCTP_STATE_SHUTDOWN_RECEIVED = 6, + SCTP_STATE_SHUTDOWN_ACK_SENT = 7, +}; + +struct sctp_stream_out_ext; + +struct sctp_stream_out { + union { + __u32 mid; + __u16 ssn; + }; + __u32 mid_uo; + struct sctp_stream_out_ext *ext; + __u8 state; +}; + +struct sctp_stream_in { + union { + __u32 mid; + __u16 ssn; + }; + __u32 mid_uo; + __u32 fsn; + __u32 fsn_uo; + char pd_mode; + char pd_mode_uo; +}; + +struct sctp_stream_interleave; + +struct sctp_stream { + struct { + struct __genradix tree; + struct sctp_stream_out type[0]; + } out; + struct { + struct __genradix tree; + struct sctp_stream_in type[0]; + } in; + __u16 outcnt; + __u16 incnt; + struct sctp_stream_out *out_curr; + union { + struct { + struct list_head prio_list; + }; + struct { + struct list_head rr_list; + struct sctp_stream_out_ext *rr_next; + }; + }; + struct sctp_stream_interleave *si; +}; + +struct sctp_sched_ops; + +struct sctp_association; + +struct sctp_outq { + struct sctp_association *asoc; + struct list_head out_chunk_list; + struct sctp_sched_ops *sched; + unsigned int out_qlen; + unsigned int error; + struct list_head control_chunk_list; + struct list_head sacked; + struct list_head retransmit; + struct list_head abandoned; + __u32 outstanding_bytes; + char fast_rtx; + char cork; +}; + +struct sctp_ulpq { + char pd_mode; + struct sctp_association *asoc; + struct sk_buff_head reasm; + struct sk_buff_head reasm_uo; + struct sk_buff_head lobby; +}; + +struct sctp_priv_assoc_stats { + struct __kernel_sockaddr_storage obs_rto_ipaddr; + __u64 max_obs_rto; + __u64 isacks; + __u64 osacks; + __u64 opackets; + __u64 ipackets; + __u64 rtxchunks; + __u64 outofseqtsns; + __u64 idupchunks; + __u64 gapcnt; + __u64 ouodchunks; + __u64 iuodchunks; + __u64 oodchunks; + __u64 iodchunks; + __u64 octrlchunks; + __u64 ictrlchunks; +}; + +struct sctp_transport; + +struct sctp_auth_bytes; + +struct sctp_shared_key; + +struct sctp_association { + struct sctp_ep_common base; + struct list_head asocs; + sctp_assoc_t assoc_id; + struct sctp_endpoint *ep; + struct sctp_cookie c; + struct { + struct list_head transport_addr_list; + __u32 rwnd; + __u16 transport_count; + __u16 port; + struct sctp_transport *primary_path; + union sctp_addr primary_addr; + struct sctp_transport *active_path; + struct sctp_transport *retran_path; + struct sctp_transport *last_sent_to; + struct sctp_transport *last_data_from; + struct sctp_tsnmap tsn_map; + __be16 addip_disabled_mask; + __u16 ecn_capable: 1; + __u16 ipv4_address: 1; + __u16 ipv6_address: 1; + __u16 hostname_address: 1; + __u16 asconf_capable: 1; + __u16 prsctp_capable: 1; + __u16 reconf_capable: 1; + __u16 intl_capable: 1; + __u16 auth_capable: 1; + __u16 sack_needed: 1; + __u16 sack_generation: 1; + __u16 zero_window_announced: 1; + __u32 sack_cnt; + __u32 adaptation_ind; + struct sctp_inithdr_host i; + void *cookie; + int cookie_len; + __u32 addip_serial; + struct sctp_random_param *peer_random; + struct sctp_chunks_param *peer_chunks; + struct sctp_hmac_algo_param *peer_hmacs; + } peer; + enum sctp_state state; + int overall_error_count; + ktime_t cookie_life; + long unsigned int rto_initial; + long unsigned int rto_max; + long unsigned int rto_min; + int max_burst; + int max_retrans; + __u16 pf_retrans; + __u16 ps_retrans; + __u16 max_init_attempts; + __u16 init_retries; + long unsigned int max_init_timeo; + long unsigned int hbinterval; + __be16 encap_port; + __u16 pathmaxrxt; + __u32 flowlabel; + __u8 dscp; + __u8 pmtu_pending; + __u32 pathmtu; + __u32 param_flags; + __u32 sackfreq; + long unsigned int sackdelay; + long unsigned int timeouts[11]; + struct timer_list timers[11]; + struct sctp_transport *shutdown_last_sent_to; + struct sctp_transport *init_last_sent_to; + int shutdown_retries; + __u32 next_tsn; + __u32 ctsn_ack_point; + __u32 adv_peer_ack_point; + __u32 highest_sacked; + __u32 fast_recovery_exit; + __u8 fast_recovery; + __u16 unack_data; + __u32 rtx_data_chunks; + __u32 rwnd; + __u32 a_rwnd; + __u32 rwnd_over; + __u32 rwnd_press; + int sndbuf_used; + atomic_t rmem_alloc; + wait_queue_head_t wait; + __u32 frag_point; + __u32 user_frag; + int init_err_counter; + int init_cycle; + __u16 default_stream; + __u16 default_flags; + __u32 default_ppid; + __u32 default_context; + __u32 default_timetolive; + __u32 default_rcv_context; + struct sctp_stream stream; + struct sctp_outq outqueue; + struct sctp_ulpq ulpq; + __u32 last_ecne_tsn; + __u32 last_cwr_tsn; + int numduptsns; + struct sctp_chunk *addip_last_asconf; + struct list_head asconf_ack_list; + struct list_head addip_chunk_list; + __u32 addip_serial; + int src_out_of_asoc_ok; + union sctp_addr *asconf_addr_del_pending; + struct sctp_transport *new_transport; + struct list_head endpoint_shared_keys; + struct sctp_auth_bytes *asoc_shared_key; + struct sctp_shared_key *shkey; + __u16 default_hmac_id; + __u16 active_key_id; + __u8 need_ecne: 1; + __u8 temp: 1; + __u8 pf_expose: 2; + __u8 force_delay: 1; + __u8 strreset_enable; + __u8 strreset_outstanding; + __u32 strreset_outseq; + __u32 strreset_inseq; + __u32 strreset_result[2]; + struct sctp_chunk *strreset_chunk; + struct sctp_priv_assoc_stats stats; + int sent_cnt_removable; + __u16 subscribe; + __u64 abandoned_unsent[3]; + __u64 abandoned_sent[3]; + struct callback_head rcu; +}; + +struct sctp_auth_bytes { + refcount_t refcnt; + __u32 len; + __u8 data[0]; +}; + +struct sctp_shared_key { + struct list_head key_list; + struct sctp_auth_bytes *key; + refcount_t refcnt; + __u16 key_id; + __u8 deactivated; +}; + +enum { + SCTP_MAX_STREAM = 65535, +}; + +enum sctp_event_timeout { + SCTP_EVENT_TIMEOUT_NONE = 0, + SCTP_EVENT_TIMEOUT_T1_COOKIE = 1, + SCTP_EVENT_TIMEOUT_T1_INIT = 2, + SCTP_EVENT_TIMEOUT_T2_SHUTDOWN = 3, + SCTP_EVENT_TIMEOUT_T3_RTX = 4, + SCTP_EVENT_TIMEOUT_T4_RTO = 5, + SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD = 6, + SCTP_EVENT_TIMEOUT_HEARTBEAT = 7, + SCTP_EVENT_TIMEOUT_RECONF = 8, + SCTP_EVENT_TIMEOUT_SACK = 9, + SCTP_EVENT_TIMEOUT_AUTOCLOSE = 10, +}; + +enum { + SCTP_MAX_DUP_TSNS = 16, +}; + +enum sctp_scope { + SCTP_SCOPE_GLOBAL = 0, + SCTP_SCOPE_PRIVATE = 1, + SCTP_SCOPE_LINK = 2, + SCTP_SCOPE_LOOPBACK = 3, + SCTP_SCOPE_UNUSABLE = 4, +}; + +enum { + SCTP_AUTH_HMAC_ID_RESERVED_0 = 0, + SCTP_AUTH_HMAC_ID_SHA1 = 1, + SCTP_AUTH_HMAC_ID_RESERVED_2 = 2, + SCTP_AUTH_HMAC_ID_SHA256 = 3, + __SCTP_AUTH_HMAC_MAX = 4, +}; + +struct sctp_ulpevent { + struct sctp_association *asoc; + struct sctp_chunk *chunk; + unsigned int rmem_len; + union { + __u32 mid; + __u16 ssn; + }; + union { + __u32 ppid; + __u32 fsn; + }; + __u32 tsn; + __u32 cumtsn; + __u16 stream; + __u16 flags; + __u16 msg_flags; +} __attribute__((packed)); + +union sctp_addr_param; + +union sctp_params { + void *v; + struct sctp_paramhdr *p; + struct sctp_cookie_preserve_param *life; + struct sctp_hostname_param *dns; + struct sctp_cookie_param *cookie; + struct sctp_supported_addrs_param *sat; + struct sctp_ipv4addr_param *v4; + struct sctp_ipv6addr_param *v6; + union sctp_addr_param *addr; + struct sctp_adaptation_ind_param *aind; + struct sctp_supported_ext_param *ext; + struct sctp_random_param *random; + struct sctp_chunks_param *chunks; + struct sctp_hmac_algo_param *hmac_algo; + struct sctp_addip_param *addip; +}; + +struct sctp_sender_hb_info; + +struct sctp_signed_cookie; + +struct sctp_datamsg; + +struct sctp_chunk { + struct list_head list; + refcount_t refcnt; + int sent_count; + union { + struct list_head transmitted_list; + struct list_head stream_list; + }; + struct list_head frag_list; + struct sk_buff *skb; + union { + struct sk_buff *head_skb; + struct sctp_shared_key *shkey; + }; + union sctp_params param_hdr; + union { + __u8 *v; + struct sctp_datahdr *data_hdr; + struct sctp_inithdr *init_hdr; + struct sctp_sackhdr *sack_hdr; + struct sctp_heartbeathdr *hb_hdr; + struct sctp_sender_hb_info *hbs_hdr; + struct sctp_shutdownhdr *shutdown_hdr; + struct sctp_signed_cookie *cookie_hdr; + struct sctp_ecnehdr *ecne_hdr; + struct sctp_cwrhdr *ecn_cwr_hdr; + struct sctp_errhdr *err_hdr; + struct sctp_addiphdr *addip_hdr; + struct sctp_fwdtsn_hdr *fwdtsn_hdr; + struct sctp_authhdr *auth_hdr; + struct sctp_idatahdr *idata_hdr; + struct sctp_ifwdtsn_hdr *ifwdtsn_hdr; + } subh; + __u8 *chunk_end; + struct sctp_chunkhdr *chunk_hdr; + struct sctphdr *sctp_hdr; + struct sctp_sndrcvinfo sinfo; + struct sctp_association *asoc; + struct sctp_ep_common *rcvr; + long unsigned int sent_at; + union sctp_addr source; + union sctp_addr dest; + struct sctp_datamsg *msg; + struct sctp_transport *transport; + struct sk_buff *auth_chunk; + __u16 rtt_in_progress: 1; + __u16 has_tsn: 1; + __u16 has_ssn: 1; + __u16 singleton: 1; + __u16 end_of_packet: 1; + __u16 ecn_ce_done: 1; + __u16 pdiscard: 1; + __u16 tsn_gap_acked: 1; + __u16 data_accepted: 1; + __u16 auth: 1; + __u16 has_asconf: 1; + __u16 tsn_missing_report: 2; + __u16 fast_retransmit: 2; +}; + +struct sctp_stream_interleave { + __u16 data_chunk_len; + __u16 ftsn_chunk_len; + struct sctp_chunk * (*make_datafrag)(const struct sctp_association *, const struct sctp_sndrcvinfo *, int, __u8, gfp_t); + void (*assign_number)(struct sctp_chunk *); + bool (*validate_data)(struct sctp_chunk *); + int (*ulpevent_data)(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); + int (*enqueue_event)(struct sctp_ulpq *, struct sctp_ulpevent *); + void (*renege_events)(struct sctp_ulpq *, struct sctp_chunk *, gfp_t); + void (*start_pd)(struct sctp_ulpq *, gfp_t); + void (*abort_pd)(struct sctp_ulpq *, gfp_t); + void (*generate_ftsn)(struct sctp_outq *, __u32); + bool (*validate_ftsn)(struct sctp_chunk *); + void (*report_ftsn)(struct sctp_ulpq *, __u32); + void (*handle_ftsn)(struct sctp_ulpq *, struct sctp_chunk *); +}; + +struct sctp_bind_bucket { + short unsigned int port; + signed char fastreuse; + signed char fastreuseport; + kuid_t fastuid; + struct hlist_node node; + struct hlist_head owner; + struct net *net; +}; + +enum sctp_socket_type { + SCTP_SOCKET_UDP = 0, + SCTP_SOCKET_UDP_HIGH_BANDWIDTH = 1, + SCTP_SOCKET_TCP = 2, +}; + +struct sctp_pf; + +struct sctp_sock { + struct inet_sock inet; + enum sctp_socket_type type; + struct sctp_pf *pf; + struct crypto_shash *hmac; + char *sctp_hmac_alg; + struct sctp_endpoint *ep; + struct sctp_bind_bucket *bind_hash; + __u16 default_stream; + __u32 default_ppid; + __u16 default_flags; + __u32 default_context; + __u32 default_timetolive; + __u32 default_rcv_context; + int max_burst; + __u32 hbinterval; + __be16 udp_port; + __be16 encap_port; + __u16 pathmaxrxt; + __u32 flowlabel; + __u8 dscp; + __u16 pf_retrans; + __u16 ps_retrans; + __u32 pathmtu; + __u32 sackdelay; + __u32 sackfreq; + __u32 param_flags; + __u32 default_ss; + struct sctp_rtoinfo rtoinfo; + struct sctp_paddrparams paddrparam; + struct sctp_assocparams assocparams; + __u16 subscribe; + struct sctp_initmsg initmsg; + int user_frag; + __u32 autoclose; + __u32 adaptation_ind; + __u32 pd_point; + __u16 nodelay: 1; + __u16 pf_expose: 2; + __u16 reuse: 1; + __u16 disable_fragments: 1; + __u16 v4mapped: 1; + __u16 frag_interleave: 1; + __u16 recvrcvinfo: 1; + __u16 recvnxtinfo: 1; + __u16 data_ready_signalled: 1; + atomic_t pd_mode; + struct sk_buff_head pd_lobby; + struct list_head auto_asconf_list; + int do_auto_asconf; +}; + +struct sctp_af; + +struct sctp_pf { + void (*event_msgname)(struct sctp_ulpevent *, char *, int *); + void (*skb_msgname)(struct sk_buff *, char *, int *); + int (*af_supported)(sa_family_t, struct sctp_sock *); + int (*cmp_addr)(const union sctp_addr *, const union sctp_addr *, struct sctp_sock *); + int (*bind_verify)(struct sctp_sock *, union sctp_addr *); + int (*send_verify)(struct sctp_sock *, union sctp_addr *); + int (*supported_addrs)(const struct sctp_sock *, __be16 *); + struct sock * (*create_accept_sk)(struct sock *, struct sctp_association *, bool); + int (*addr_to_user)(struct sctp_sock *, union sctp_addr *); + void (*to_sk_saddr)(union sctp_addr *, struct sock *); + void (*to_sk_daddr)(union sctp_addr *, struct sock *); + void (*copy_ip_options)(struct sock *, struct sock *); + struct sctp_af *af; +}; + +struct sctp_signed_cookie { + __u8 signature[32]; + __u32 __pad; + struct sctp_cookie c; +} __attribute__((packed)); + +union sctp_addr_param { + struct sctp_paramhdr p; + struct sctp_ipv4addr_param v4; + struct sctp_ipv6addr_param v6; +}; + +struct sctp_sender_hb_info { + struct sctp_paramhdr param_hdr; + union sctp_addr daddr; + long unsigned int sent_at; + __u64 hb_nonce; +}; + +struct sctp_af { + int (*sctp_xmit)(struct sk_buff *, struct sctp_transport *); + int (*setsockopt)(struct sock *, int, int, sockptr_t, unsigned int); + int (*getsockopt)(struct sock *, int, int, char *, int *); + void (*get_dst)(struct sctp_transport *, union sctp_addr *, struct flowi *, struct sock *); + void (*get_saddr)(struct sctp_sock *, struct sctp_transport *, struct flowi *); + void (*copy_addrlist)(struct list_head *, struct net_device *); + int (*cmp_addr)(const union sctp_addr *, const union sctp_addr *); + void (*addr_copy)(union sctp_addr *, union sctp_addr *); + void (*from_skb)(union sctp_addr *, struct sk_buff *, int); + void (*from_sk)(union sctp_addr *, struct sock *); + void (*from_addr_param)(union sctp_addr *, union sctp_addr_param *, __be16, int); + int (*to_addr_param)(const union sctp_addr *, union sctp_addr_param *); + int (*addr_valid)(union sctp_addr *, struct sctp_sock *, const struct sk_buff *); + enum sctp_scope (*scope)(union sctp_addr *); + void (*inaddr_any)(union sctp_addr *, __be16); + int (*is_any)(const union sctp_addr *); + int (*available)(union sctp_addr *, struct sctp_sock *); + int (*skb_iif)(const struct sk_buff *); + int (*is_ce)(const struct sk_buff *); + void (*seq_dump_addr)(struct seq_file *, union sctp_addr *); + void (*ecn_capable)(struct sock *); + __u16 net_header_len; + int sockaddr_len; + int (*ip_options_len)(struct sock *); + sa_family_t sa_family; + struct list_head list; +}; + +struct sctp_packet { + __u16 source_port; + __u16 destination_port; + __u32 vtag; + struct list_head chunk_list; + size_t overhead; + size_t size; + size_t max_size; + struct sctp_transport *transport; + struct sctp_chunk *auth; + u8 has_cookie_echo: 1; + u8 has_sack: 1; + u8 has_auth: 1; + u8 has_data: 1; + u8 ipfragok: 1; +}; + +struct sctp_transport { + struct list_head transports; + struct rhlist_head node; + refcount_t refcnt; + __u32 rto_pending: 1; + __u32 hb_sent: 1; + __u32 pmtu_pending: 1; + __u32 dst_pending_confirm: 1; + __u32 sack_generation: 1; + u32 dst_cookie; + struct flowi fl; + union sctp_addr ipaddr; + struct sctp_af *af_specific; + struct sctp_association *asoc; + long unsigned int rto; + __u32 rtt; + __u32 rttvar; + __u32 srtt; + __u32 cwnd; + __u32 ssthresh; + __u32 partial_bytes_acked; + __u32 flight_size; + __u32 burst_limited; + struct dst_entry *dst; + union sctp_addr saddr; + long unsigned int hbinterval; + long unsigned int sackdelay; + __u32 sackfreq; + atomic_t mtu_info; + ktime_t last_time_heard; + long unsigned int last_time_sent; + long unsigned int last_time_ecne_reduced; + __be16 encap_port; + __u16 pathmaxrxt; + __u32 flowlabel; + __u8 dscp; + __u16 pf_retrans; + __u16 ps_retrans; + __u32 pathmtu; + __u32 param_flags; + int init_sent_count; + int state; + short unsigned int error_count; + struct timer_list T3_rtx_timer; + struct timer_list hb_timer; + struct timer_list proto_unreach_timer; + struct timer_list reconf_timer; + struct list_head transmitted; + struct sctp_packet packet; + struct list_head send_ready; + struct { + __u32 next_tsn_at_change; + char changeover_active; + char cycling_changeover; + char cacc_saw_newack; + } cacc; + __u64 hb_nonce; + struct callback_head rcu; +}; + +struct sctp_datamsg { + struct list_head chunks; + refcount_t refcnt; + long unsigned int expires_at; + int send_error; + u8 send_failed: 1; + u8 can_delay: 1; + u8 abandoned: 1; +}; + +struct sctp_stream_priorities { + struct list_head prio_sched; + struct list_head active; + struct sctp_stream_out_ext *next; + __u16 prio; +}; + +struct sctp_stream_out_ext { + __u64 abandoned_unsent[3]; + __u64 abandoned_sent[3]; + struct list_head outq; + union { + struct { + struct list_head prio_list; + struct sctp_stream_priorities *prio_head; + }; + struct { + struct list_head rr_list; + }; + }; +}; + +struct task_security_struct { + u32 osid; + u32 sid; + u32 exec_sid; + u32 create_sid; + u32 keycreate_sid; + u32 sockcreate_sid; +}; + +enum label_initialized { + LABEL_INVALID = 0, + LABEL_INITIALIZED = 1, + LABEL_PENDING = 2, +}; + +struct inode_security_struct { + struct inode *inode; + struct list_head list; + u32 task_sid; + u32 sid; + u16 sclass; + unsigned char initialized; + spinlock_t lock; +}; + +struct file_security_struct { + u32 sid; + u32 fown_sid; + u32 isid; + u32 pseqno; +}; + +struct superblock_security_struct { + u32 sid; + u32 def_sid; + u32 mntpoint_sid; + short unsigned int behavior; + short unsigned int flags; + struct mutex lock; + struct list_head isec_head; + spinlock_t isec_lock; +}; + +struct msg_security_struct { + u32 sid; +}; + +struct ipc_security_struct { + u16 sclass; + u32 sid; +}; + +struct sk_security_struct { + enum { + NLBL_UNSET = 0, + NLBL_REQUIRE = 1, + NLBL_LABELED = 2, + NLBL_REQSKB = 3, + NLBL_CONNLABELED = 4, + } nlbl_state; + struct netlbl_lsm_secattr *nlbl_secattr; + u32 sid; + u32 peer_sid; + u16 sclass; + enum { + SCTP_ASSOC_UNSET = 0, + SCTP_ASSOC_SET = 1, + } sctp_assoc_state; +}; + +struct tun_security_struct { + u32 sid; +}; + +struct key_security_struct { + u32 sid; +}; + +struct ib_security_struct { + u32 sid; +}; + +struct bpf_security_struct { + u32 sid; +}; + +struct perf_event_security_struct { + u32 sid; +}; + +struct selinux_mnt_opts { + const char *fscontext; + const char *context; + const char *rootcontext; + const char *defcontext; +}; + +enum { + Opt_error___2 = 4294967295, + Opt_context = 0, + Opt_defcontext = 1, + Opt_fscontext = 2, + Opt_rootcontext = 3, + Opt_seclabel = 4, +}; + +struct selinux_policy_convert_data; + +struct selinux_load_state { + struct selinux_policy *policy; + struct selinux_policy_convert_data *convert_data; +}; + +enum sel_inos { + SEL_ROOT_INO = 2, + SEL_LOAD = 3, + SEL_ENFORCE = 4, + SEL_CONTEXT = 5, + SEL_ACCESS = 6, + SEL_CREATE = 7, + SEL_RELABEL = 8, + SEL_USER = 9, + SEL_POLICYVERS = 10, + SEL_COMMIT_BOOLS = 11, + SEL_MLS = 12, + SEL_DISABLE = 13, + SEL_MEMBER = 14, + SEL_CHECKREQPROT = 15, + SEL_COMPAT_NET = 16, + SEL_REJECT_UNKNOWN = 17, + SEL_DENY_UNKNOWN = 18, + SEL_STATUS = 19, + SEL_POLICY = 20, + SEL_VALIDATE_TRANS = 21, + SEL_INO_NEXT = 22, +}; + +struct selinux_fs_info { + struct dentry *bool_dir; + unsigned int bool_num; + char **bool_pending_names; + unsigned int *bool_pending_values; + struct dentry *class_dir; + long unsigned int last_class_ino; + bool policy_opened; + struct dentry *policycap_dir; + long unsigned int last_ino; + struct selinux_state *state; + struct super_block *sb; +}; + +struct policy_load_memory { + size_t len; + void *data; +}; + +enum { + SELNL_MSG_SETENFORCE = 16, + SELNL_MSG_POLICYLOAD = 17, + SELNL_MSG_MAX = 18, +}; + +enum selinux_nlgroups { + SELNLGRP_NONE = 0, + SELNLGRP_AVC = 1, + __SELNLGRP_MAX = 2, +}; + +struct selnl_msg_setenforce { + __s32 val; +}; + +struct selnl_msg_policyload { + __u32 seqno; +}; + +enum { + XFRM_MSG_BASE = 16, + XFRM_MSG_NEWSA = 16, + XFRM_MSG_DELSA = 17, + XFRM_MSG_GETSA = 18, + XFRM_MSG_NEWPOLICY = 19, + XFRM_MSG_DELPOLICY = 20, + XFRM_MSG_GETPOLICY = 21, + XFRM_MSG_ALLOCSPI = 22, + XFRM_MSG_ACQUIRE = 23, + XFRM_MSG_EXPIRE = 24, + XFRM_MSG_UPDPOLICY = 25, + XFRM_MSG_UPDSA = 26, + XFRM_MSG_POLEXPIRE = 27, + XFRM_MSG_FLUSHSA = 28, + XFRM_MSG_FLUSHPOLICY = 29, + XFRM_MSG_NEWAE = 30, + XFRM_MSG_GETAE = 31, + XFRM_MSG_REPORT = 32, + XFRM_MSG_MIGRATE = 33, + XFRM_MSG_NEWSADINFO = 34, + XFRM_MSG_GETSADINFO = 35, + XFRM_MSG_NEWSPDINFO = 36, + XFRM_MSG_GETSPDINFO = 37, + XFRM_MSG_MAPPING = 38, + __XFRM_MSG_MAX = 39, +}; + +enum { + RTM_BASE = 16, + RTM_NEWLINK = 16, + RTM_DELLINK = 17, + RTM_GETLINK = 18, + RTM_SETLINK = 19, + RTM_NEWADDR = 20, + RTM_DELADDR = 21, + RTM_GETADDR = 22, + RTM_NEWROUTE = 24, + RTM_DELROUTE = 25, + RTM_GETROUTE = 26, + RTM_NEWNEIGH = 28, + RTM_DELNEIGH = 29, + RTM_GETNEIGH = 30, + RTM_NEWRULE = 32, + RTM_DELRULE = 33, + RTM_GETRULE = 34, + RTM_NEWQDISC = 36, + RTM_DELQDISC = 37, + RTM_GETQDISC = 38, + RTM_NEWTCLASS = 40, + RTM_DELTCLASS = 41, + RTM_GETTCLASS = 42, + RTM_NEWTFILTER = 44, + RTM_DELTFILTER = 45, + RTM_GETTFILTER = 46, + RTM_NEWACTION = 48, + RTM_DELACTION = 49, + RTM_GETACTION = 50, + RTM_NEWPREFIX = 52, + RTM_GETMULTICAST = 58, + RTM_GETANYCAST = 62, + RTM_NEWNEIGHTBL = 64, + RTM_GETNEIGHTBL = 66, + RTM_SETNEIGHTBL = 67, + RTM_NEWNDUSEROPT = 68, + RTM_NEWADDRLABEL = 72, + RTM_DELADDRLABEL = 73, + RTM_GETADDRLABEL = 74, + RTM_GETDCB = 78, + RTM_SETDCB = 79, + RTM_NEWNETCONF = 80, + RTM_DELNETCONF = 81, + RTM_GETNETCONF = 82, + RTM_NEWMDB = 84, + RTM_DELMDB = 85, + RTM_GETMDB = 86, + RTM_NEWNSID = 88, + RTM_DELNSID = 89, + RTM_GETNSID = 90, + RTM_NEWSTATS = 92, + RTM_GETSTATS = 94, + RTM_NEWCACHEREPORT = 96, + RTM_NEWCHAIN = 100, + RTM_DELCHAIN = 101, + RTM_GETCHAIN = 102, + RTM_NEWNEXTHOP = 104, + RTM_DELNEXTHOP = 105, + RTM_GETNEXTHOP = 106, + RTM_NEWLINKPROP = 108, + RTM_DELLINKPROP = 109, + RTM_GETLINKPROP = 110, + RTM_NEWVLAN = 112, + RTM_DELVLAN = 113, + RTM_GETVLAN = 114, + __RTM_MAX = 115, +}; + +struct nlmsg_perm { + u16 nlmsg_type; + u32 perm; +}; + +struct netif_security_struct { + struct net *ns; + int ifindex; + u32 sid; +}; + +struct sel_netif { + struct list_head list; + struct netif_security_struct nsec; + struct callback_head callback_head; +}; + +struct netnode_security_struct { + union { + __be32 ipv4; + struct in6_addr ipv6; + } addr; + u32 sid; + u16 family; +}; + +struct sel_netnode_bkt { + unsigned int size; + struct list_head list; +}; + +struct sel_netnode { + struct netnode_security_struct nsec; + struct list_head list; + struct callback_head rcu; +}; + +struct netport_security_struct { + u32 sid; + u16 port; + u8 protocol; +}; + +struct sel_netport_bkt { + int size; + struct list_head list; +}; + +struct sel_netport { + struct netport_security_struct psec; + struct list_head list; + struct callback_head rcu; +}; + +struct selinux_kernel_status { + u32 version; + u32 sequence; + u32 enforcing; + u32 policyload; + u32 deny_unknown; +}; + +struct ebitmap_node { + struct ebitmap_node *next; + long unsigned int maps[6]; + u32 startbit; +}; + +struct ebitmap { + struct ebitmap_node *node; + u32 highbit; +}; + +struct policy_file { + char *data; + size_t len; +}; + +struct hashtab_node { + void *key; + void *datum; + struct hashtab_node *next; +}; + +struct hashtab { + struct hashtab_node **htable; + u32 size; + u32 nel; +}; + +struct hashtab_info { + u32 slots_used; + u32 max_chain_len; +}; + +struct hashtab_key_params { + u32 (*hash)(const void *); + int (*cmp)(const void *, const void *); +}; + +struct symtab { + struct hashtab table; + u32 nprim; +}; + +struct mls_level { + u32 sens; + struct ebitmap cat; +}; + +struct mls_range { + struct mls_level level[2]; +}; + +struct context___2 { + u32 user; + u32 role; + u32 type; + u32 len; + struct mls_range range; + char *str; +}; + +struct sidtab_str_cache; + +struct sidtab_entry { + u32 sid; + u32 hash; + struct context___2 context; + struct sidtab_str_cache *cache; + struct hlist_node list; +}; + +struct sidtab_str_cache { + struct callback_head rcu_member; + struct list_head lru_member; + struct sidtab_entry *parent; + u32 len; + char str[0]; +}; + +struct sidtab_node_inner; + +struct sidtab_node_leaf; + +union sidtab_entry_inner { + struct sidtab_node_inner *ptr_inner; + struct sidtab_node_leaf *ptr_leaf; +}; + +struct sidtab_node_inner { + union sidtab_entry_inner entries[512]; +}; + +struct sidtab_node_leaf { + struct sidtab_entry entries[39]; +}; + +struct sidtab_isid_entry { + int set; + struct sidtab_entry entry; +}; + +struct sidtab; + +struct sidtab_convert_params { + int (*func)(struct context___2 *, struct context___2 *, void *); + void *args; + struct sidtab *target; +}; + +struct sidtab { + union sidtab_entry_inner roots[4]; + u32 count; + struct sidtab_convert_params *convert; + bool frozen; + spinlock_t lock; + u32 cache_free_slots; + struct list_head cache_lru_list; + spinlock_t cache_lock; + struct sidtab_isid_entry isids[27]; + struct hlist_head context_to_sid[512]; +}; + +struct avtab_key { + u16 source_type; + u16 target_type; + u16 target_class; + u16 specified; +}; + +struct avtab_extended_perms { + u8 specified; + u8 driver; + struct extended_perms_data perms; +}; + +struct avtab_datum { + union { + u32 data; + struct avtab_extended_perms *xperms; + } u; +}; + +struct avtab_node { + struct avtab_key key; + struct avtab_datum datum; + struct avtab_node *next; +}; + +struct avtab { + struct avtab_node **htable; + u32 nel; + u32 nslot; + u32 mask; +}; + +struct type_set; + +struct constraint_expr { + u32 expr_type; + u32 attr; + u32 op; + struct ebitmap names; + struct type_set *type_names; + struct constraint_expr *next; +}; + +struct type_set { + struct ebitmap types; + struct ebitmap negset; + u32 flags; +}; + +struct constraint_node { + u32 permissions; + struct constraint_expr *expr; + struct constraint_node *next; +}; + +struct common_datum { + u32 value; + struct symtab permissions; +}; + +struct class_datum { + u32 value; + char *comkey; + struct common_datum *comdatum; + struct symtab permissions; + struct constraint_node *constraints; + struct constraint_node *validatetrans; + char default_user; + char default_role; + char default_type; + char default_range; +}; + +struct role_datum { + u32 value; + u32 bounds; + struct ebitmap dominates; + struct ebitmap types; +}; + +struct role_allow { + u32 role; + u32 new_role; + struct role_allow *next; +}; + +struct type_datum { + u32 value; + u32 bounds; + unsigned char primary; + unsigned char attribute; +}; + +struct user_datum { + u32 value; + u32 bounds; + struct ebitmap roles; + struct mls_range range; + struct mls_level dfltlevel; +}; + +struct cond_bool_datum { + __u32 value; + int state; +}; + +struct ocontext { + union { + char *name; + struct { + u8 protocol; + u16 low_port; + u16 high_port; + } port; + struct { + u32 addr; + u32 mask; + } node; + struct { + u32 addr[4]; + u32 mask[4]; + } node6; + struct { + u64 subnet_prefix; + u16 low_pkey; + u16 high_pkey; + } ibpkey; + struct { + char *dev_name; + u8 port; + } ibendport; + } u; + union { + u32 sclass; + u32 behavior; + } v; + struct context___2 context[2]; + u32 sid[2]; + struct ocontext *next; +}; + +struct genfs { + char *fstype; + struct ocontext *head; + struct genfs *next; +}; + +struct cond_node; + +struct policydb { + int mls_enabled; + struct symtab symtab[8]; + char **sym_val_to_name[8]; + struct class_datum **class_val_to_struct; + struct role_datum **role_val_to_struct; + struct user_datum **user_val_to_struct; + struct type_datum **type_val_to_struct; + struct avtab te_avtab; + struct hashtab role_tr; + struct ebitmap filename_trans_ttypes; + struct hashtab filename_trans; + u32 compat_filename_trans_count; + struct cond_bool_datum **bool_val_to_struct; + struct avtab te_cond_avtab; + struct cond_node *cond_list; + u32 cond_list_len; + struct role_allow *role_allow; + struct ocontext *ocontexts[9]; + struct genfs *genfs; + struct hashtab range_tr; + struct ebitmap *type_attr_map_array; + struct ebitmap policycaps; + struct ebitmap permissive_map; + size_t len; + unsigned int policyvers; + unsigned int reject_unknown: 1; + unsigned int allow_unknown: 1; + u16 process_class; + u32 process_trans_perms; +}; + +struct perm_datum { + u32 value; +}; + +struct role_trans_key { + u32 role; + u32 type; + u32 tclass; +}; + +struct role_trans_datum { + u32 new_role; +}; + +struct filename_trans_key { + u32 ttype; + u16 tclass; + const char *name; +}; + +struct filename_trans_datum { + struct ebitmap stypes; + u32 otype; + struct filename_trans_datum *next; +}; + +struct level_datum { + struct mls_level *level; + unsigned char isalias; +}; + +struct cat_datum { + u32 value; + unsigned char isalias; +}; + +struct range_trans { + u32 source_type; + u32 target_type; + u32 target_class; +}; + +struct cond_expr_node; + +struct cond_expr { + struct cond_expr_node *nodes; + u32 len; +}; + +struct cond_av_list { + struct avtab_node **nodes; + u32 len; +}; + +struct cond_node { + int cur_state; + struct cond_expr expr; + struct cond_av_list true_list; + struct cond_av_list false_list; +}; + +struct policy_data { + struct policydb *p; + void *fp; +}; + +struct cond_expr_node { + u32 expr_type; + u32 bool; +}; + +struct policydb_compat_info { + int version; + int sym_num; + int ocon_num; +}; + +struct selinux_mapping; + +struct selinux_map { + struct selinux_mapping *mapping; + u16 size; +}; + +struct selinux_policy { + struct sidtab *sidtab; + struct policydb policydb; + struct selinux_map map; + u32 latest_granting; +}; + +struct convert_context_args { + struct selinux_state *state; + struct policydb *oldp; + struct policydb *newp; +}; + +struct selinux_policy_convert_data { + struct convert_context_args args; + struct sidtab_convert_params sidtab_params; +}; + +struct selinux_mapping { + u16 value; + unsigned int num_perms; + u32 perms[32]; +}; + +struct selinux_audit_rule { + u32 au_seqno; + struct context___2 au_ctxt; +}; + +struct cond_insertf_data { + struct policydb *p; + struct avtab_node **dst; + struct cond_av_list *other; +}; + +struct rt6key { + struct in6_addr addr; + int plen; +}; + +struct rtable; + +struct fnhe_hash_bucket; + +struct fib_nh_common { + struct net_device *nhc_dev; + int nhc_oif; + unsigned char nhc_scope; + u8 nhc_family; + u8 nhc_gw_family; + unsigned char nhc_flags; + struct lwtunnel_state *nhc_lwtstate; + union { + __be32 ipv4; + struct in6_addr ipv6; + } nhc_gw; + int nhc_weight; + atomic_t nhc_upper_bound; + struct rtable **nhc_pcpu_rth_output; + struct rtable *nhc_rth_input; + struct fnhe_hash_bucket *nhc_exceptions; +}; + +struct rt6_exception_bucket; + +struct fib6_nh { + struct fib_nh_common nh_common; + long unsigned int last_probe; + struct rt6_info **rt6i_pcpu; + struct rt6_exception_bucket *rt6i_exception_bucket; +}; + +struct fib6_node; + +struct dst_metrics; + +struct nexthop; + +struct fib6_info { + struct fib6_table *fib6_table; + struct fib6_info *fib6_next; + struct fib6_node *fib6_node; + union { + struct list_head fib6_siblings; + struct list_head nh_list; + }; + unsigned int fib6_nsiblings; + refcount_t fib6_ref; + long unsigned int expires; + struct dst_metrics *fib6_metrics; + struct rt6key fib6_dst; + u32 fib6_flags; + struct rt6key fib6_src; + struct rt6key fib6_prefsrc; + u32 fib6_metric; + u8 fib6_protocol; + u8 fib6_type; + u8 should_flush: 1; + u8 dst_nocount: 1; + u8 dst_nopolicy: 1; + u8 fib6_destroying: 1; + u8 offload: 1; + u8 trap: 1; + u8 unused: 2; + struct callback_head rcu; + struct nexthop *nh; + struct fib6_nh fib6_nh[0]; +}; + +struct uncached_list; + +struct rt6_info { + struct dst_entry dst; + struct fib6_info *from; + int sernum; + struct rt6key rt6i_dst; + struct rt6key rt6i_src; + struct in6_addr rt6i_gateway; + struct inet6_dev *rt6i_idev; + u32 rt6i_flags; + struct list_head rt6i_uncached; + struct uncached_list *rt6i_uncached_list; + short unsigned int rt6i_nfheader_len; +}; + +struct rt6_statistics { + __u32 fib_nodes; + __u32 fib_route_nodes; + __u32 fib_rt_entries; + __u32 fib_rt_cache; + __u32 fib_discarded_routes; + atomic_t fib_rt_alloc; + atomic_t fib_rt_uncache; +}; + +struct fib6_node { + struct fib6_node *parent; + struct fib6_node *left; + struct fib6_node *right; + struct fib6_node *subtree; + struct fib6_info *leaf; + __u16 fn_bit; + __u16 fn_flags; + int fn_sernum; + struct fib6_info *rr_ptr; + struct callback_head rcu; +}; + +struct fib6_table { + struct hlist_node tb6_hlist; + u32 tb6_id; + spinlock_t tb6_lock; + struct fib6_node tb6_root; + struct inet_peer_base tb6_peers; + unsigned int flags; + unsigned int fib_seq; +}; + +typedef union { + __be32 a4; + __be32 a6[4]; + struct in6_addr in6; +} xfrm_address_t; + +struct xfrm_id { + xfrm_address_t daddr; + __be32 spi; + __u8 proto; +}; + +struct xfrm_selector { + xfrm_address_t daddr; + xfrm_address_t saddr; + __be16 dport; + __be16 dport_mask; + __be16 sport; + __be16 sport_mask; + __u16 family; + __u8 prefixlen_d; + __u8 prefixlen_s; + __u8 proto; + int ifindex; + __kernel_uid32_t user; +}; + +struct xfrm_lifetime_cfg { + __u64 soft_byte_limit; + __u64 hard_byte_limit; + __u64 soft_packet_limit; + __u64 hard_packet_limit; + __u64 soft_add_expires_seconds; + __u64 hard_add_expires_seconds; + __u64 soft_use_expires_seconds; + __u64 hard_use_expires_seconds; +}; + +struct xfrm_lifetime_cur { + __u64 bytes; + __u64 packets; + __u64 add_time; + __u64 use_time; +}; + +struct xfrm_replay_state { + __u32 oseq; + __u32 seq; + __u32 bitmap; +}; + +struct xfrm_replay_state_esn { + unsigned int bmp_len; + __u32 oseq; + __u32 seq; + __u32 oseq_hi; + __u32 seq_hi; + __u32 replay_window; + __u32 bmp[0]; +}; + +struct xfrm_algo { + char alg_name[64]; + unsigned int alg_key_len; + char alg_key[0]; +}; + +struct xfrm_algo_auth { + char alg_name[64]; + unsigned int alg_key_len; + unsigned int alg_trunc_len; + char alg_key[0]; +}; + +struct xfrm_algo_aead { + char alg_name[64]; + unsigned int alg_key_len; + unsigned int alg_icv_len; + char alg_key[0]; +}; + +struct xfrm_stats { + __u32 replay_window; + __u32 replay; + __u32 integrity_failed; +}; + +enum { + XFRM_POLICY_TYPE_MAIN = 0, + XFRM_POLICY_TYPE_SUB = 1, + XFRM_POLICY_TYPE_MAX = 2, + XFRM_POLICY_TYPE_ANY = 255, +}; + +struct xfrm_encap_tmpl { + __u16 encap_type; + __be16 encap_sport; + __be16 encap_dport; + xfrm_address_t encap_oa; +}; + +enum xfrm_attr_type_t { + XFRMA_UNSPEC = 0, + XFRMA_ALG_AUTH = 1, + XFRMA_ALG_CRYPT = 2, + XFRMA_ALG_COMP = 3, + XFRMA_ENCAP = 4, + XFRMA_TMPL = 5, + XFRMA_SA = 6, + XFRMA_POLICY = 7, + XFRMA_SEC_CTX = 8, + XFRMA_LTIME_VAL = 9, + XFRMA_REPLAY_VAL = 10, + XFRMA_REPLAY_THRESH = 11, + XFRMA_ETIMER_THRESH = 12, + XFRMA_SRCADDR = 13, + XFRMA_COADDR = 14, + XFRMA_LASTUSED = 15, + XFRMA_POLICY_TYPE = 16, + XFRMA_MIGRATE = 17, + XFRMA_ALG_AEAD = 18, + XFRMA_KMADDRESS = 19, + XFRMA_ALG_AUTH_TRUNC = 20, + XFRMA_MARK = 21, + XFRMA_TFCPAD = 22, + XFRMA_REPLAY_ESN_VAL = 23, + XFRMA_SA_EXTRA_FLAGS = 24, + XFRMA_PROTO = 25, + XFRMA_ADDRESS_FILTER = 26, + XFRMA_PAD = 27, + XFRMA_OFFLOAD_DEV = 28, + XFRMA_SET_MARK = 29, + XFRMA_SET_MARK_MASK = 30, + XFRMA_IF_ID = 31, + __XFRMA_MAX = 32, +}; + +struct xfrm_mark { + __u32 v; + __u32 m; +}; + +struct xfrm_address_filter { + xfrm_address_t saddr; + xfrm_address_t daddr; + __u16 family; + __u8 splen; + __u8 dplen; +}; + +struct xfrm_state_walk { + struct list_head all; + u8 state; + u8 dying; + u8 proto; + u32 seq; + struct xfrm_address_filter *filter; +}; + +struct xfrm_state_offload { + struct net_device *dev; + struct net_device *real_dev; + long unsigned int offload_handle; + unsigned int num_exthdrs; + u8 flags; +}; + +struct xfrm_mode { + u8 encap; + u8 family; + u8 flags; +}; + +struct xfrm_replay; + +struct xfrm_type; + +struct xfrm_type_offload; + +struct xfrm_state { + possible_net_t xs_net; + union { + struct hlist_node gclist; + struct hlist_node bydst; + }; + struct hlist_node bysrc; + struct hlist_node byspi; + refcount_t refcnt; + spinlock_t lock; + struct xfrm_id id; + struct xfrm_selector sel; + struct xfrm_mark mark; + u32 if_id; + u32 tfcpad; + u32 genid; + struct xfrm_state_walk km; + struct { + u32 reqid; + u8 mode; + u8 replay_window; + u8 aalgo; + u8 ealgo; + u8 calgo; + u8 flags; + u16 family; + xfrm_address_t saddr; + int header_len; + int trailer_len; + u32 extra_flags; + struct xfrm_mark smark; + } props; + struct xfrm_lifetime_cfg lft; + struct xfrm_algo_auth *aalg; + struct xfrm_algo *ealg; + struct xfrm_algo *calg; + struct xfrm_algo_aead *aead; + const char *geniv; + struct xfrm_encap_tmpl *encap; + struct sock *encap_sk; + xfrm_address_t *coaddr; + struct xfrm_state *tunnel; + atomic_t tunnel_users; + struct xfrm_replay_state replay; + struct xfrm_replay_state_esn *replay_esn; + struct xfrm_replay_state preplay; + struct xfrm_replay_state_esn *preplay_esn; + const struct xfrm_replay *repl; + u32 xflags; + u32 replay_maxage; + u32 replay_maxdiff; + struct timer_list rtimer; + struct xfrm_stats stats; + struct xfrm_lifetime_cur curlft; + struct hrtimer mtimer; + struct xfrm_state_offload xso; + long int saved_tmo; + time64_t lastused; + struct page_frag xfrag; + const struct xfrm_type *type; + struct xfrm_mode inner_mode; + struct xfrm_mode inner_mode_iaf; + struct xfrm_mode outer_mode; + const struct xfrm_type_offload *type_offload; + struct xfrm_sec_ctx *security; + void *data; +}; + +struct dst_metrics { + u32 metrics[17]; + refcount_t refcnt; +}; + +struct xfrm_policy_walk_entry { + struct list_head all; + u8 dead; +}; + +struct xfrm_policy_queue { + struct sk_buff_head hold_queue; + struct timer_list hold_timer; + long unsigned int timeout; +}; + +struct xfrm_tmpl { + struct xfrm_id id; + xfrm_address_t saddr; + short unsigned int encap_family; + u32 reqid; + u8 mode; + u8 share; + u8 optional; + u8 allalgs; + u32 aalgos; + u32 ealgos; + u32 calgos; +}; + +struct xfrm_policy { + possible_net_t xp_net; + struct hlist_node bydst; + struct hlist_node byidx; + rwlock_t lock; + refcount_t refcnt; + u32 pos; + struct timer_list timer; + atomic_t genid; + u32 priority; + u32 index; + u32 if_id; + struct xfrm_mark mark; + struct xfrm_selector selector; + struct xfrm_lifetime_cfg lft; + struct xfrm_lifetime_cur curlft; + struct xfrm_policy_walk_entry walk; + struct xfrm_policy_queue polq; + bool bydst_reinsert; + u8 type; + u8 action; + u8 flags; + u8 xfrm_nr; + u16 family; + struct xfrm_sec_ctx *security; + struct xfrm_tmpl xfrm_vec[6]; + struct hlist_node bydst_inexact_list; + struct callback_head rcu; +}; + +struct udp_hslot; + +struct udp_table { + struct udp_hslot *hash; + struct udp_hslot *hash2; + unsigned int mask; + unsigned int log; +}; + +struct fib_nh_exception { + struct fib_nh_exception *fnhe_next; + int fnhe_genid; + __be32 fnhe_daddr; + u32 fnhe_pmtu; + bool fnhe_mtu_locked; + __be32 fnhe_gw; + long unsigned int fnhe_expires; + struct rtable *fnhe_rth_input; + struct rtable *fnhe_rth_output; + long unsigned int fnhe_stamp; + struct callback_head rcu; +}; + +struct rtable { + struct dst_entry dst; + int rt_genid; + unsigned int rt_flags; + __u16 rt_type; + __u8 rt_is_input; + __u8 rt_uses_gateway; + int rt_iif; + u8 rt_gw_family; + union { + __be32 rt_gw4; + struct in6_addr rt_gw6; + }; + u32 rt_mtu_locked: 1; + u32 rt_pmtu: 31; + struct list_head rt_uncached; + struct uncached_list *rt_uncached_list; +}; + +struct fnhe_hash_bucket { + struct fib_nh_exception *chain; +}; + +struct rt6_exception_bucket { + struct hlist_head chain; + int depth; +}; + +struct xfrm_replay { + void (*advance)(struct xfrm_state *, __be32); + int (*check)(struct xfrm_state *, struct sk_buff *, __be32); + int (*recheck)(struct xfrm_state *, struct sk_buff *, __be32); + void (*notify)(struct xfrm_state *, int); + int (*overflow)(struct xfrm_state *, struct sk_buff *); +}; + +struct xfrm_type { + char *description; + struct module *owner; + u8 proto; + u8 flags; + int (*init_state)(struct xfrm_state *); + void (*destructor)(struct xfrm_state *); + int (*input)(struct xfrm_state *, struct sk_buff *); + int (*output)(struct xfrm_state *, struct sk_buff *); + int (*reject)(struct xfrm_state *, struct sk_buff *, const struct flowi *); + int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); +}; + +struct xfrm_type_offload { + char *description; + struct module *owner; + u8 proto; + void (*encap)(struct xfrm_state *, struct sk_buff *); + int (*input_tail)(struct xfrm_state *, struct sk_buff *); + int (*xmit)(struct xfrm_state *, struct sk_buff *, netdev_features_t); +}; + +struct xfrm_dst { + union { + struct dst_entry dst; + struct rtable rt; + struct rt6_info rt6; + } u; + struct dst_entry *route; + struct dst_entry *child; + struct dst_entry *path; + struct xfrm_policy *pols[2]; + int num_pols; + int num_xfrms; + u32 xfrm_genid; + u32 policy_genid; + u32 route_mtu_cached; + u32 child_mtu_cached; + u32 route_cookie; + u32 path_cookie; +}; + +struct xfrm_offload { + struct { + __u32 low; + __u32 hi; + } seq; + __u32 flags; + __u32 status; + __u8 proto; +}; + +struct sec_path { + int len; + int olen; + struct xfrm_state *xvec[6]; + struct xfrm_offload ovec[1]; +}; + +struct udp_hslot { + struct hlist_head head; + int count; + spinlock_t lock; +}; + +struct pkey_security_struct { + u64 subnet_prefix; + u16 pkey; + u32 sid; +}; + +struct sel_ib_pkey_bkt { + int size; + struct list_head list; +}; + +struct sel_ib_pkey { + struct pkey_security_struct psec; + struct list_head list; + struct callback_head rcu; +}; + +struct sockaddr_un { + __kernel_sa_family_t sun_family; + char sun_path[108]; +}; + +struct unix_address { + refcount_t refcnt; + int len; + unsigned int hash; + struct sockaddr_un name[0]; +}; + +struct scm_stat { + atomic_t nr_fds; +}; + +struct unix_sock { + struct sock sk; + struct unix_address *addr; + struct path path; + struct mutex iolock; + struct mutex bindlock; + struct sock *peer; + struct list_head link; + atomic_long_t inflight; + spinlock_t lock; + long unsigned int gc_flags; + struct socket_wq peer_wq; + wait_queue_entry_t peer_wake; + struct scm_stat scm_stat; + long: 32; + long: 64; + long: 64; +}; + +struct ptrace_relation { + struct task_struct *tracer; + struct task_struct *tracee; + bool invalid; + struct list_head node; + struct callback_head rcu; +}; + +struct access_report_info { + struct callback_head work; + const char *access; + struct task_struct *target; + struct task_struct *agent; +}; + +enum devcg_behavior { + DEVCG_DEFAULT_NONE = 0, + DEVCG_DEFAULT_ALLOW = 1, + DEVCG_DEFAULT_DENY = 2, +}; + +struct dev_exception_item { + u32 major; + u32 minor; + short int type; + short int access; + struct list_head list; + struct callback_head rcu; +}; + +struct dev_cgroup { + struct cgroup_subsys_state css; + struct list_head exceptions; + enum devcg_behavior behavior; +}; + +enum integrity_status { + INTEGRITY_PASS = 0, + INTEGRITY_PASS_IMMUTABLE = 1, + INTEGRITY_FAIL = 2, + INTEGRITY_NOLABEL = 3, + INTEGRITY_NOXATTRS = 4, + INTEGRITY_UNKNOWN = 5, +}; + +struct ima_digest_data { + u8 algo; + u8 length; + union { + struct { + u8 unused; + u8 type; + } sha1; + struct { + u8 type; + u8 algo; + } ng; + u8 data[2]; + } xattr; + u8 digest[0]; +}; + +struct integrity_iint_cache { + struct rb_node rb_node; + struct mutex mutex; + struct inode *inode; + u64 version; + long unsigned int flags; + long unsigned int measured_pcrs; + long unsigned int atomic_flags; + enum integrity_status ima_file_status: 4; + enum integrity_status ima_mmap_status: 4; + enum integrity_status ima_bprm_status: 4; + enum integrity_status ima_read_status: 4; + enum integrity_status ima_creds_status: 4; + enum integrity_status evm_status: 4; + struct ima_digest_data *ima_hash; +}; + +struct modsig; + +struct asymmetric_key_id; + +struct public_key_signature { + struct asymmetric_key_id *auth_ids[2]; + u8 *s; + u32 s_size; + u8 *digest; + u8 digest_size; + const char *pkey_algo; + const char *hash_algo; + const char *encoding; + const void *data; + unsigned int data_size; +}; + +struct asymmetric_key_id { + short unsigned int len; + unsigned char data[0]; +}; + +struct signature_v2_hdr { + uint8_t type; + uint8_t version; + uint8_t hash_algo; + __be32 keyid; + __be16 sig_size; + uint8_t sig[0]; +} __attribute__((packed)); + +typedef struct { + efi_guid_t signature_owner; + u8 signature_data[0]; +} efi_signature_data_t; + +typedef struct { + efi_guid_t signature_type; + u32 signature_list_size; + u32 signature_header_size; + u32 signature_size; + u8 signature_header[0]; +} efi_signature_list_t; + +typedef void (*efi_element_handler_t)(const char *, const void *, size_t); + +struct efi_mokvar_table_entry { + char name[256]; + u64 data_size; + u8 data[0]; +}; + +struct tpm_digest { + u16 alg_id; + u8 digest[64]; +}; + +struct evm_ima_xattr_data { + u8 type; + u8 data[0]; +}; + +enum ima_show_type { + IMA_SHOW_BINARY = 0, + IMA_SHOW_BINARY_NO_FIELD_LEN = 1, + IMA_SHOW_BINARY_OLD_STRING_FMT = 2, + IMA_SHOW_ASCII = 3, +}; + +struct ima_event_data { + struct integrity_iint_cache *iint; + struct file *file; + const unsigned char *filename; + struct evm_ima_xattr_data *xattr_value; + int xattr_len; + const struct modsig *modsig; + const char *violation; + const void *buf; + int buf_len; +}; + +struct ima_field_data { + u8 *data; + u32 len; +}; + +struct ima_template_field { + const char field_id[16]; + int (*field_init)(struct ima_event_data *, struct ima_field_data *); + void (*field_show)(struct seq_file *, enum ima_show_type, struct ima_field_data *); +}; + +struct ima_template_desc { + struct list_head list; + char *name; + char *fmt; + int num_fields; + const struct ima_template_field **fields; +}; + +struct ima_template_entry { + int pcr; + struct tpm_digest *digests; + struct ima_template_desc *template_desc; + u32 template_data_len; + struct ima_field_data template_data[0]; +}; + +struct ima_queue_entry { + struct hlist_node hnext; + struct list_head later; + struct ima_template_entry *entry; +}; + +struct ima_h_table { + atomic_long_t len; + atomic_long_t violations; + struct hlist_head queue[1024]; +}; + +enum ima_fs_flags { + IMA_FS_BUSY = 0, +}; + +struct hwrng { + const char *name; + int (*init)(struct hwrng *); + void (*cleanup)(struct hwrng *); + int (*data_present)(struct hwrng *, int); + int (*data_read)(struct hwrng *, u32 *); + int (*read)(struct hwrng *, void *, size_t, bool); + long unsigned int priv; + short unsigned int quality; + struct list_head list; + struct kref ref; + struct completion cleanup_done; +}; + +struct tpm_bank_info { + u16 alg_id; + u16 digest_size; + u16 crypto_id; +}; + +struct tpm_chip; + +struct tpm_class_ops { + unsigned int flags; + const u8 req_complete_mask; + const u8 req_complete_val; + bool (*req_canceled)(struct tpm_chip *, u8); + int (*recv)(struct tpm_chip *, u8 *, size_t); + int (*send)(struct tpm_chip *, u8 *, size_t); + void (*cancel)(struct tpm_chip *); + u8 (*status)(struct tpm_chip *); + void (*update_timeouts)(struct tpm_chip *, long unsigned int *); + void (*update_durations)(struct tpm_chip *, long unsigned int *); + int (*go_idle)(struct tpm_chip *); + int (*cmd_ready)(struct tpm_chip *); + int (*request_locality)(struct tpm_chip *, int); + int (*relinquish_locality)(struct tpm_chip *, int); + void (*clk_enable)(struct tpm_chip *, bool); +}; + +struct tpm_bios_log { + void *bios_event_log; + void *bios_event_log_end; +}; + +struct tpm_chip_seqops { + struct tpm_chip *chip; + const struct seq_operations *seqops; +}; + +struct tpm_space { + u32 context_tbl[3]; + u8 *context_buf; + u32 session_tbl[3]; + u8 *session_buf; + u32 buf_size; +}; + +struct tpm_chip { + struct device dev; + struct device devs; + struct cdev cdev; + struct cdev cdevs; + struct rw_semaphore ops_sem; + const struct tpm_class_ops *ops; + struct tpm_bios_log log; + struct tpm_chip_seqops bin_log_seqops; + struct tpm_chip_seqops ascii_log_seqops; + unsigned int flags; + int dev_num; + long unsigned int is_open; + char hwrng_name[64]; + struct hwrng hwrng; + struct mutex tpm_mutex; + long unsigned int timeout_a; + long unsigned int timeout_b; + long unsigned int timeout_c; + long unsigned int timeout_d; + bool timeout_adjusted; + long unsigned int duration[4]; + bool duration_adjusted; + struct dentry *bios_dir[3]; + const struct attribute_group *groups[3]; + unsigned int groups_cnt; + u32 nr_allocated_banks; + struct tpm_bank_info *allocated_banks; + acpi_handle acpi_dev_handle; + char ppi_version[4]; + struct tpm_space work_space; + u32 last_cc; + u32 nr_commands; + u32 *cc_attrs_tbl; + int locality; +}; + +enum evm_ima_xattr_type { + IMA_XATTR_DIGEST = 1, + EVM_XATTR_HMAC = 2, + EVM_IMA_XATTR_DIGSIG = 3, + IMA_XATTR_DIGEST_NG = 4, + EVM_XATTR_PORTABLE_DIGSIG = 5, + IMA_XATTR_LAST = 6, +}; + +enum ima_hooks { + NONE___2 = 0, + FILE_CHECK = 1, + MMAP_CHECK = 2, + BPRM_CHECK = 3, + CREDS_CHECK = 4, + POST_SETATTR = 5, + MODULE_CHECK = 6, + FIRMWARE_CHECK = 7, + KEXEC_KERNEL_CHECK = 8, + KEXEC_INITRAMFS_CHECK = 9, + POLICY_CHECK = 10, + KEXEC_CMDLINE = 11, + KEY_CHECK = 12, + MAX_CHECK = 13, +}; + +enum tpm_algorithms { + TPM_ALG_ERROR = 0, + TPM_ALG_SHA1 = 4, + TPM_ALG_KEYEDHASH = 8, + TPM_ALG_SHA256 = 11, + TPM_ALG_SHA384 = 12, + TPM_ALG_SHA512 = 13, + TPM_ALG_NULL = 16, + TPM_ALG_SM3_256 = 18, +}; + +enum tpm_pcrs { + TPM_PCR0 = 0, + TPM_PCR8 = 8, + TPM_PCR10 = 10, +}; + +struct ima_algo_desc { + struct crypto_shash *tfm; + enum hash_algo algo; +}; + +enum lsm_rule_types { + LSM_OBJ_USER = 0, + LSM_OBJ_ROLE = 1, + LSM_OBJ_TYPE = 2, + LSM_SUBJ_USER = 3, + LSM_SUBJ_ROLE = 4, + LSM_SUBJ_TYPE = 5, +}; + +enum policy_types { + ORIGINAL_TCB = 1, + DEFAULT_TCB = 2, +}; + +enum policy_rule_list { + IMA_DEFAULT_POLICY = 1, + IMA_CUSTOM_POLICY = 2, +}; + +struct ima_rule_opt_list { + size_t count; + char *items[0]; +}; + +struct ima_rule_entry { + struct list_head list; + int action; + unsigned int flags; + enum ima_hooks func; + int mask; + long unsigned int fsmagic; + uuid_t fsuuid; + kuid_t uid; + kuid_t fowner; + bool (*uid_op)(kuid_t, kuid_t); + bool (*fowner_op)(kuid_t, kuid_t); + int pcr; + struct { + void *rule; + char *args_p; + int type; + } lsm[6]; + char *fsname; + struct ima_rule_opt_list *keyrings; + struct ima_template_desc *template; +}; + +enum { + Opt_measure = 0, + Opt_dont_measure = 1, + Opt_appraise = 2, + Opt_dont_appraise = 3, + Opt_audit = 4, + Opt_hash___2 = 5, + Opt_dont_hash = 6, + Opt_obj_user = 7, + Opt_obj_role = 8, + Opt_obj_type = 9, + Opt_subj_user = 10, + Opt_subj_role = 11, + Opt_subj_type = 12, + Opt_func = 13, + Opt_mask = 14, + Opt_fsmagic = 15, + Opt_fsname = 16, + Opt_fsuuid = 17, + Opt_uid_eq = 18, + Opt_euid_eq = 19, + Opt_fowner_eq = 20, + Opt_uid_gt = 21, + Opt_euid_gt = 22, + Opt_fowner_gt = 23, + Opt_uid_lt = 24, + Opt_euid_lt = 25, + Opt_fowner_lt = 26, + Opt_appraise_type = 27, + Opt_appraise_flag = 28, + Opt_permit_directio = 29, + Opt_pcr = 30, + Opt_template = 31, + Opt_keyrings = 32, + Opt_err___9 = 33, +}; + +enum { + mask_exec = 0, + mask_write = 1, + mask_read = 2, + mask_append = 3, +}; + +struct ima_kexec_hdr { + u16 version; + u16 _reserved0; + u32 _reserved1; + u64 buffer_size; + u64 count; +}; + +enum header_fields { + HDR_PCR = 0, + HDR_DIGEST = 1, + HDR_TEMPLATE_NAME = 2, + HDR_TEMPLATE_DATA = 3, + HDR__LAST = 4, +}; + +enum data_formats { + DATA_FMT_DIGEST = 0, + DATA_FMT_DIGEST_WITH_ALGO = 1, + DATA_FMT_STRING = 2, + DATA_FMT_HEX = 3, +}; + +struct modsig___2 { + struct pkcs7_message *pkcs7_msg; + enum hash_algo hash_algo; + const u8 *digest; + u32 digest_size; + int raw_pkcs7_len; + u8 raw_pkcs7[0]; +}; + +struct ima_key_entry { + struct list_head list; + void *payload; + size_t payload_len; + char *keyring_name; +}; + +struct evm_xattr { + struct evm_ima_xattr_data data; + u8 digest[20]; +}; + +struct xattr_list { + struct list_head list; + char *name; +}; + +struct evm_digest { + struct ima_digest_data hdr; + char digest[64]; +}; + +struct h_misc { + long unsigned int ino; + __u32 generation; + uid_t uid; + gid_t gid; + umode_t mode; +}; + +enum { + CRYPTO_MSG_ALG_REQUEST = 0, + CRYPTO_MSG_ALG_REGISTER = 1, + CRYPTO_MSG_ALG_LOADED = 2, +}; + +struct crypto_larval { + struct crypto_alg alg; + struct crypto_alg *adult; + struct completion completion; + u32 mask; +}; + +struct crypto_cipher { + struct crypto_tfm base; +}; + +enum { + CRYPTOA_UNSPEC = 0, + CRYPTOA_ALG = 1, + CRYPTOA_TYPE = 2, + CRYPTOA_U32 = 3, + __CRYPTOA_MAX = 4, +}; + +struct crypto_attr_alg { + char name[128]; +}; + +struct crypto_attr_type { + u32 type; + u32 mask; +}; + +struct crypto_attr_u32 { + u32 num; +}; + +struct rtattr { + short unsigned int rta_len; + short unsigned int rta_type; +}; + +struct crypto_queue { + struct list_head list; + struct list_head *backlog; + unsigned int qlen; + unsigned int max_qlen; +}; + +enum { + NAPI_STATE_SCHED = 0, + NAPI_STATE_MISSED = 1, + NAPI_STATE_DISABLE = 2, + NAPI_STATE_NPSVC = 3, + NAPI_STATE_LISTED = 4, + NAPI_STATE_NO_BUSY_POLL = 5, + NAPI_STATE_IN_BUSY_POLL = 6, + NAPI_STATE_PREFER_BUSY_POLL = 7, +}; + +enum bpf_xdp_mode { + XDP_MODE_SKB = 0, + XDP_MODE_DRV = 1, + XDP_MODE_HW = 2, + __MAX_XDP_MODE = 3, +}; + +enum { + NETIF_MSG_DRV_BIT = 0, + NETIF_MSG_PROBE_BIT = 1, + NETIF_MSG_LINK_BIT = 2, + NETIF_MSG_TIMER_BIT = 3, + NETIF_MSG_IFDOWN_BIT = 4, + NETIF_MSG_IFUP_BIT = 5, + NETIF_MSG_RX_ERR_BIT = 6, + NETIF_MSG_TX_ERR_BIT = 7, + NETIF_MSG_TX_QUEUED_BIT = 8, + NETIF_MSG_INTR_BIT = 9, + NETIF_MSG_TX_DONE_BIT = 10, + NETIF_MSG_RX_STATUS_BIT = 11, + NETIF_MSG_PKTDATA_BIT = 12, + NETIF_MSG_HW_BIT = 13, + NETIF_MSG_WOL_BIT = 14, + NETIF_MSG_CLASS_COUNT = 15, +}; + +struct aead_instance { + void (*free)(struct aead_instance *); + union { + struct { + char head[64]; + struct crypto_instance base; + } s; + struct aead_alg alg; + }; +}; + +struct crypto_aead_spawn { + struct crypto_spawn base; +}; + +enum crypto_attr_type_t { + CRYPTOCFGA_UNSPEC = 0, + CRYPTOCFGA_PRIORITY_VAL = 1, + CRYPTOCFGA_REPORT_LARVAL = 2, + CRYPTOCFGA_REPORT_HASH = 3, + CRYPTOCFGA_REPORT_BLKCIPHER = 4, + CRYPTOCFGA_REPORT_AEAD = 5, + CRYPTOCFGA_REPORT_COMPRESS = 6, + CRYPTOCFGA_REPORT_RNG = 7, + CRYPTOCFGA_REPORT_CIPHER = 8, + CRYPTOCFGA_REPORT_AKCIPHER = 9, + CRYPTOCFGA_REPORT_KPP = 10, + CRYPTOCFGA_REPORT_ACOMP = 11, + CRYPTOCFGA_STAT_LARVAL = 12, + CRYPTOCFGA_STAT_HASH = 13, + CRYPTOCFGA_STAT_BLKCIPHER = 14, + CRYPTOCFGA_STAT_AEAD = 15, + CRYPTOCFGA_STAT_COMPRESS = 16, + CRYPTOCFGA_STAT_RNG = 17, + CRYPTOCFGA_STAT_CIPHER = 18, + CRYPTOCFGA_STAT_AKCIPHER = 19, + CRYPTOCFGA_STAT_KPP = 20, + CRYPTOCFGA_STAT_ACOMP = 21, + __CRYPTOCFGA_MAX = 22, +}; + +struct crypto_report_aead { + char type[64]; + char geniv[64]; + unsigned int blocksize; + unsigned int maxauthsize; + unsigned int ivsize; +}; + +struct crypto_sync_skcipher; + +struct aead_geniv_ctx { + spinlock_t lock; + struct crypto_aead *child; + struct crypto_sync_skcipher *sknull; + u8 salt[0]; +}; + +struct crypto_rng; + +struct rng_alg { + int (*generate)(struct crypto_rng *, const u8 *, unsigned int, u8 *, unsigned int); + int (*seed)(struct crypto_rng *, const u8 *, unsigned int); + void (*set_ent)(struct crypto_rng *, const u8 *, unsigned int); + unsigned int seedsize; + struct crypto_alg base; +}; + +struct crypto_rng { + struct crypto_tfm base; +}; + +struct crypto_cipher_spawn { + struct crypto_spawn base; +}; + +struct crypto_sync_skcipher { + struct crypto_skcipher base; +}; + +struct skcipher_instance { + void (*free)(struct skcipher_instance *); + union { + struct { + char head[64]; + struct crypto_instance base; + } s; + struct skcipher_alg alg; + }; +}; + +struct crypto_skcipher_spawn { + struct crypto_spawn base; +}; + +struct skcipher_ctx_simple { + struct crypto_cipher *cipher; +}; + +struct crypto_report_blkcipher { + char type[64]; + char geniv[64]; + unsigned int blocksize; + unsigned int min_keysize; + unsigned int max_keysize; + unsigned int ivsize; +}; + +enum { + SKCIPHER_WALK_PHYS = 1, + SKCIPHER_WALK_SLOW = 2, + SKCIPHER_WALK_COPY = 4, + SKCIPHER_WALK_DIFF = 8, + SKCIPHER_WALK_SLEEP = 16, +}; + +struct skcipher_walk_buffer { + struct list_head entry; + struct scatter_walk dst; + unsigned int len; + u8 *data; + u8 buffer[0]; +}; + +struct ahash_alg { + int (*init)(struct ahash_request *); + int (*update)(struct ahash_request *); + int (*final)(struct ahash_request *); + int (*finup)(struct ahash_request *); + int (*digest)(struct ahash_request *); + int (*export)(struct ahash_request *, void *); + int (*import)(struct ahash_request *, const void *); + int (*setkey)(struct crypto_ahash *, const u8 *, unsigned int); + int (*init_tfm)(struct crypto_ahash *); + void (*exit_tfm)(struct crypto_ahash *); + struct hash_alg_common halg; +}; + +struct crypto_hash_walk { + char *data; + unsigned int offset; + unsigned int alignmask; + struct page *pg; + unsigned int entrylen; + unsigned int total; + struct scatterlist *sg; + unsigned int flags; +}; + +struct ahash_instance { + void (*free)(struct ahash_instance *); + union { + struct { + char head[88]; + struct crypto_instance base; + } s; + struct ahash_alg alg; + }; +}; + +struct crypto_ahash_spawn { + struct crypto_spawn base; +}; + +struct crypto_report_hash { + char type[64]; + unsigned int blocksize; + unsigned int digestsize; +}; + +struct ahash_request_priv { + crypto_completion_t complete; + void *data; + u8 *result; + u32 flags; + void *ubuf[0]; +}; + +struct shash_instance { + void (*free)(struct shash_instance *); + union { + struct { + char head[96]; + struct crypto_instance base; + } s; + struct shash_alg alg; + }; +}; + +struct crypto_shash_spawn { + struct crypto_spawn base; +}; + +struct crypto_report_akcipher { + char type[64]; +}; + +struct akcipher_request { + struct crypto_async_request base; + struct scatterlist *src; + struct scatterlist *dst; + unsigned int src_len; + unsigned int dst_len; + void *__ctx[0]; +}; + +struct crypto_akcipher { + struct crypto_tfm base; +}; + +struct akcipher_alg { + int (*sign)(struct akcipher_request *); + int (*verify)(struct akcipher_request *); + int (*encrypt)(struct akcipher_request *); + int (*decrypt)(struct akcipher_request *); + int (*set_pub_key)(struct crypto_akcipher *, const void *, unsigned int); + int (*set_priv_key)(struct crypto_akcipher *, const void *, unsigned int); + unsigned int (*max_size)(struct crypto_akcipher *); + int (*init)(struct crypto_akcipher *); + void (*exit)(struct crypto_akcipher *); + unsigned int reqsize; + struct crypto_alg base; +}; + +struct akcipher_instance { + void (*free)(struct akcipher_instance *); + union { + struct { + char head[80]; + struct crypto_instance base; + } s; + struct akcipher_alg alg; + }; +}; + +struct crypto_akcipher_spawn { + struct crypto_spawn base; +}; + +struct crypto_report_kpp { + char type[64]; +}; + +typedef long unsigned int mpi_limb_t; + +struct gcry_mpi { + int alloced; + int nlimbs; + int nbits; + int sign; + unsigned int flags; + mpi_limb_t *d; +}; + +typedef struct gcry_mpi *MPI; + +struct dh_ctx { + MPI p; + MPI q; + MPI g; + MPI xa; +}; + +enum { + CRYPTO_KPP_SECRET_TYPE_UNKNOWN = 0, + CRYPTO_KPP_SECRET_TYPE_DH = 1, + CRYPTO_KPP_SECRET_TYPE_ECDH = 2, +}; + +struct kpp_secret { + short unsigned int type; + short unsigned int len; +}; + +enum asn1_class { + ASN1_UNIV = 0, + ASN1_APPL = 1, + ASN1_CONT = 2, + ASN1_PRIV = 3, +}; + +enum asn1_method { + ASN1_PRIM = 0, + ASN1_CONS = 1, +}; + +enum asn1_tag { + ASN1_EOC = 0, + ASN1_BOOL = 1, + ASN1_INT = 2, + ASN1_BTS = 3, + ASN1_OTS = 4, + ASN1_NULL = 5, + ASN1_OID = 6, + ASN1_ODE = 7, + ASN1_EXT = 8, + ASN1_REAL = 9, + ASN1_ENUM = 10, + ASN1_EPDV = 11, + ASN1_UTF8STR = 12, + ASN1_RELOID = 13, + ASN1_SEQ = 16, + ASN1_SET = 17, + ASN1_NUMSTR = 18, + ASN1_PRNSTR = 19, + ASN1_TEXSTR = 20, + ASN1_VIDSTR = 21, + ASN1_IA5STR = 22, + ASN1_UNITIM = 23, + ASN1_GENTIM = 24, + ASN1_GRASTR = 25, + ASN1_VISSTR = 26, + ASN1_GENSTR = 27, + ASN1_UNISTR = 28, + ASN1_CHRSTR = 29, + ASN1_BMPSTR = 30, + ASN1_LONG_TAG = 31, +}; + +typedef int (*asn1_action_t)(void *, size_t, unsigned char, const void *, size_t); + +struct asn1_decoder { + const unsigned char *machine; + size_t machlen; + const asn1_action_t *actions; +}; + +enum asn1_opcode { + ASN1_OP_MATCH = 0, + ASN1_OP_MATCH_OR_SKIP = 1, + ASN1_OP_MATCH_ACT = 2, + ASN1_OP_MATCH_ACT_OR_SKIP = 3, + ASN1_OP_MATCH_JUMP = 4, + ASN1_OP_MATCH_JUMP_OR_SKIP = 5, + ASN1_OP_MATCH_ANY = 8, + ASN1_OP_MATCH_ANY_OR_SKIP = 9, + ASN1_OP_MATCH_ANY_ACT = 10, + ASN1_OP_MATCH_ANY_ACT_OR_SKIP = 11, + ASN1_OP_COND_MATCH_OR_SKIP = 17, + ASN1_OP_COND_MATCH_ACT_OR_SKIP = 19, + ASN1_OP_COND_MATCH_JUMP_OR_SKIP = 21, + ASN1_OP_COND_MATCH_ANY = 24, + ASN1_OP_COND_MATCH_ANY_OR_SKIP = 25, + ASN1_OP_COND_MATCH_ANY_ACT = 26, + ASN1_OP_COND_MATCH_ANY_ACT_OR_SKIP = 27, + ASN1_OP_COND_FAIL = 28, + ASN1_OP_COMPLETE = 29, + ASN1_OP_ACT = 30, + ASN1_OP_MAYBE_ACT = 31, + ASN1_OP_END_SEQ = 32, + ASN1_OP_END_SET = 33, + ASN1_OP_END_SEQ_OF = 34, + ASN1_OP_END_SET_OF = 35, + ASN1_OP_END_SEQ_ACT = 36, + ASN1_OP_END_SET_ACT = 37, + ASN1_OP_END_SEQ_OF_ACT = 38, + ASN1_OP_END_SET_OF_ACT = 39, + ASN1_OP_RETURN = 40, + ASN1_OP__NR = 41, +}; + +enum rsapubkey_actions { + ACT_rsa_get_e = 0, + ACT_rsa_get_n = 1, + NR__rsapubkey_actions = 2, +}; + +enum rsaprivkey_actions { + ACT_rsa_get_d = 0, + ACT_rsa_get_dp = 1, + ACT_rsa_get_dq = 2, + ACT_rsa_get_e___2 = 3, + ACT_rsa_get_n___2 = 4, + ACT_rsa_get_p = 5, + ACT_rsa_get_q = 6, + ACT_rsa_get_qinv = 7, + NR__rsaprivkey_actions = 8, +}; + +struct rsa_key { + const u8 *n; + const u8 *e; + const u8 *d; + const u8 *p; + const u8 *q; + const u8 *dp; + const u8 *dq; + const u8 *qinv; + size_t n_sz; + size_t e_sz; + size_t d_sz; + size_t p_sz; + size_t q_sz; + size_t dp_sz; + size_t dq_sz; + size_t qinv_sz; +}; + +struct rsa_mpi_key { + MPI n; + MPI e; + MPI d; +}; + +struct asn1_decoder___2; + +struct rsa_asn1_template { + const char *name; + const u8 *data; + size_t size; +}; + +struct pkcs1pad_ctx { + struct crypto_akcipher *child; + unsigned int key_size; +}; + +struct pkcs1pad_inst_ctx { + struct crypto_akcipher_spawn spawn; + const struct rsa_asn1_template *digest_info; +}; + +struct pkcs1pad_request { + struct scatterlist in_sg[2]; + struct scatterlist out_sg[1]; + uint8_t *in_buf; + uint8_t *out_buf; + struct akcipher_request child_req; +}; + +struct crypto_report_acomp { + char type[64]; +}; + +struct acomp_alg { + int (*compress)(struct acomp_req *); + int (*decompress)(struct acomp_req *); + void (*dst_free)(struct scatterlist *); + int (*init)(struct crypto_acomp *); + void (*exit)(struct crypto_acomp *); + unsigned int reqsize; + struct crypto_alg base; +}; + +struct crypto_report_comp { + char type[64]; +}; + +struct crypto_scomp { + struct crypto_tfm base; +}; + +struct scomp_alg { + void * (*alloc_ctx)(struct crypto_scomp *); + void (*free_ctx)(struct crypto_scomp *, void *); + int (*compress)(struct crypto_scomp *, const u8 *, unsigned int, u8 *, unsigned int *, void *); + int (*decompress)(struct crypto_scomp *, const u8 *, unsigned int, u8 *, unsigned int *, void *); + struct crypto_alg base; +}; + +struct scomp_scratch { + spinlock_t lock; + void *src; + void *dst; +}; + +struct cryptomgr_param { + struct rtattr *tb[34]; + struct { + struct rtattr attr; + struct crypto_attr_type data; + } type; + union { + struct rtattr attr; + struct { + struct rtattr attr; + struct crypto_attr_alg data; + } alg; + struct { + struct rtattr attr; + struct crypto_attr_u32 data; + } nu32; + } attrs[32]; + char template[128]; + struct crypto_larval *larval; + u32 otype; + u32 omask; +}; + +struct crypto_test_param { + char driver[128]; + char alg[128]; + u32 type; +}; + +struct drbg_string { + const unsigned char *buf; + size_t len; + struct list_head list; +}; + +struct drbg_test_data { + struct drbg_string *testentropy; +}; + +enum OID { + OID_id_dsa_with_sha1 = 0, + OID_id_dsa = 1, + OID_id_ecdsa_with_sha1 = 2, + OID_id_ecPublicKey = 3, + OID_rsaEncryption = 4, + OID_md2WithRSAEncryption = 5, + OID_md3WithRSAEncryption = 6, + OID_md4WithRSAEncryption = 7, + OID_sha1WithRSAEncryption = 8, + OID_sha256WithRSAEncryption = 9, + OID_sha384WithRSAEncryption = 10, + OID_sha512WithRSAEncryption = 11, + OID_sha224WithRSAEncryption = 12, + OID_data = 13, + OID_signed_data = 14, + OID_email_address = 15, + OID_contentType = 16, + OID_messageDigest = 17, + OID_signingTime = 18, + OID_smimeCapabilites = 19, + OID_smimeAuthenticatedAttrs = 20, + OID_md2 = 21, + OID_md4 = 22, + OID_md5 = 23, + OID_msIndirectData = 24, + OID_msStatementType = 25, + OID_msSpOpusInfo = 26, + OID_msPeImageDataObjId = 27, + OID_msIndividualSPKeyPurpose = 28, + OID_msOutlookExpress = 29, + OID_certAuthInfoAccess = 30, + OID_sha1 = 31, + OID_sha256 = 32, + OID_sha384 = 33, + OID_sha512 = 34, + OID_sha224 = 35, + OID_commonName = 36, + OID_surname = 37, + OID_countryName = 38, + OID_locality = 39, + OID_stateOrProvinceName = 40, + OID_organizationName = 41, + OID_organizationUnitName = 42, + OID_title = 43, + OID_description = 44, + OID_name = 45, + OID_givenName = 46, + OID_initials = 47, + OID_generationalQualifier = 48, + OID_subjectKeyIdentifier = 49, + OID_keyUsage = 50, + OID_subjectAltName = 51, + OID_issuerAltName = 52, + OID_basicConstraints = 53, + OID_crlDistributionPoints = 54, + OID_certPolicies = 55, + OID_authorityKeyIdentifier = 56, + OID_extKeyUsage = 57, + OID_gostCPSignA = 58, + OID_gostCPSignB = 59, + OID_gostCPSignC = 60, + OID_gost2012PKey256 = 61, + OID_gost2012PKey512 = 62, + OID_gost2012Digest256 = 63, + OID_gost2012Digest512 = 64, + OID_gost2012Signature256 = 65, + OID_gost2012Signature512 = 66, + OID_gostTC26Sign256A = 67, + OID_gostTC26Sign256B = 68, + OID_gostTC26Sign256C = 69, + OID_gostTC26Sign256D = 70, + OID_gostTC26Sign512A = 71, + OID_gostTC26Sign512B = 72, + OID_gostTC26Sign512C = 73, + OID_sm2 = 74, + OID_sm3 = 75, + OID_SM2_with_SM3 = 76, + OID_sm3WithRSAEncryption = 77, + OID__NR = 78, +}; + +struct hash_testvec { + const char *key; + const char *plaintext; + const char *digest; + unsigned int psize; + short unsigned int ksize; + int setkey_error; + int digest_error; +}; + +struct cipher_testvec { + const char *key; + const char *iv; + const char *iv_out; + const char *ptext; + const char *ctext; + unsigned char wk; + short unsigned int klen; + unsigned int len; + bool fips_skip; + bool generates_iv; + int setkey_error; + int crypt_error; +}; + +struct aead_testvec { + const char *key; + const char *iv; + const char *ptext; + const char *assoc; + const char *ctext; + unsigned char novrfy; + unsigned char wk; + unsigned char klen; + unsigned int plen; + unsigned int clen; + unsigned int alen; + int setkey_error; + int setauthsize_error; + int crypt_error; +}; + +struct cprng_testvec { + const char *key; + const char *dt; + const char *v; + const char *result; + unsigned char klen; + short unsigned int dtlen; + short unsigned int vlen; + short unsigned int rlen; + short unsigned int loops; +}; + +struct drbg_testvec { + const unsigned char *entropy; + size_t entropylen; + const unsigned char *entpra; + const unsigned char *entprb; + size_t entprlen; + const unsigned char *addtla; + const unsigned char *addtlb; + size_t addtllen; + const unsigned char *pers; + size_t perslen; + const unsigned char *expected; + size_t expectedlen; +}; + +struct akcipher_testvec { + const unsigned char *key; + const unsigned char *params; + const unsigned char *m; + const unsigned char *c; + unsigned int key_len; + unsigned int param_len; + unsigned int m_size; + unsigned int c_size; + bool public_key_vec; + bool siggen_sigver_test; + enum OID algo; +}; + +struct kpp_testvec { + const unsigned char *secret; + const unsigned char *b_secret; + const unsigned char *b_public; + const unsigned char *expected_a_public; + const unsigned char *expected_ss; + short unsigned int secret_size; + short unsigned int b_secret_size; + short unsigned int b_public_size; + short unsigned int expected_a_public_size; + short unsigned int expected_ss_size; + bool genkey; +}; + +struct comp_testvec { + int inlen; + int outlen; + char input[512]; + char output[512]; +}; + +struct aead_test_suite { + const struct aead_testvec *vecs; + unsigned int count; + unsigned int einval_allowed: 1; + unsigned int aad_iv: 1; +}; + +struct cipher_test_suite { + const struct cipher_testvec *vecs; + unsigned int count; +}; + +struct comp_test_suite { + struct { + const struct comp_testvec *vecs; + unsigned int count; + } comp; + struct { + const struct comp_testvec *vecs; + unsigned int count; + } decomp; +}; + +struct hash_test_suite { + const struct hash_testvec *vecs; + unsigned int count; +}; + +struct cprng_test_suite { + const struct cprng_testvec *vecs; + unsigned int count; +}; + +struct drbg_test_suite { + const struct drbg_testvec *vecs; + unsigned int count; +}; + +struct akcipher_test_suite { + const struct akcipher_testvec *vecs; + unsigned int count; +}; + +struct kpp_test_suite { + const struct kpp_testvec *vecs; + unsigned int count; +}; + +struct alg_test_desc { + const char *alg; + const char *generic_driver; + int (*test)(const struct alg_test_desc *, const char *, u32, u32); + int fips_allowed; + union { + struct aead_test_suite aead; + struct cipher_test_suite cipher; + struct comp_test_suite comp; + struct hash_test_suite hash; + struct cprng_test_suite cprng; + struct drbg_test_suite drbg; + struct akcipher_test_suite akcipher; + struct kpp_test_suite kpp; + } suite; +}; + +enum flush_type { + FLUSH_TYPE_NONE = 0, + FLUSH_TYPE_FLUSH = 1, + FLUSH_TYPE_REIMPORT = 2, +}; + +enum finalization_type { + FINALIZATION_TYPE_FINAL = 0, + FINALIZATION_TYPE_FINUP = 1, + FINALIZATION_TYPE_DIGEST = 2, +}; + +struct test_sg_division { + unsigned int proportion_of_total; + unsigned int offset; + bool offset_relative_to_alignmask; + enum flush_type flush_type; + bool nosimd; +}; + +struct testvec_config { + const char *name; + bool inplace; + u32 req_flags; + struct test_sg_division src_divs[8]; + struct test_sg_division dst_divs[8]; + unsigned int iv_offset; + unsigned int key_offset; + bool iv_offset_relative_to_alignmask; + bool key_offset_relative_to_alignmask; + enum finalization_type finalization_type; + bool nosimd; +}; + +struct test_sglist { + char *bufs[8]; + struct scatterlist sgl[8]; + struct scatterlist sgl_saved[8]; + struct scatterlist *sgl_ptr; + unsigned int nents; +}; + +struct cipher_test_sglists { + struct test_sglist src; + struct test_sglist dst; +}; + +struct hmac_ctx { + struct crypto_shash *hash; +}; + +struct md5_state { + u32 hash[4]; + u32 block[16]; + u64 byte_count; +}; + +struct sha1_state { + u32 state[5]; + u64 count; + u8 buffer[64]; +}; + +typedef void sha1_block_fn(struct sha1_state *, const u8 *, int); + +struct sha256_state { + u32 state[8]; + u64 count; + u8 buf[64]; +}; + +struct sha512_state { + u64 state[8]; + u64 count[2]; + u8 buf[128]; +}; + +typedef void sha512_block_fn(struct sha512_state *, const u8 *, int); + +enum blake2b_constant { + BLAKE2B_BLOCKBYTES = 128, + BLAKE2B_KEYBYTES = 64, +}; + +struct blake2b_state { + u64 h[8]; + u64 t[2]; + u64 f[2]; + u8 buf[128]; + size_t buflen; +}; + +struct blake2b_tfm_ctx { + u8 key[64]; + unsigned int keylen; +}; + +struct gf128mul_4k { + be128 t[256]; +}; + +struct gf128mul_64k { + struct gf128mul_4k *t[16]; +}; + +struct crypto_cts_ctx { + struct crypto_skcipher *child; +}; + +struct crypto_cts_reqctx { + struct scatterlist sg[2]; + unsigned int offset; + struct skcipher_request subreq; +}; + +struct lrw_tfm_ctx { + struct crypto_skcipher *child; + struct gf128mul_64k *table; + be128 mulinc[128]; +}; + +struct lrw_request_ctx { + be128 t; + struct skcipher_request subreq; +}; + +struct xts_tfm_ctx { + struct crypto_skcipher *child; + struct crypto_cipher *tweak; +}; + +struct xts_instance_ctx { + struct crypto_skcipher_spawn spawn; + char name[128]; +}; + +struct xts_request_ctx { + le128 t; + struct scatterlist *tail; + struct scatterlist sg[2]; + struct skcipher_request subreq; +}; + +struct crypto_rfc3686_ctx { + struct crypto_skcipher *child; + u8 nonce[4]; +}; + +struct crypto_rfc3686_req_ctx { + u8 iv[16]; + struct skcipher_request subreq; +}; + +struct gcm_instance_ctx { + struct crypto_skcipher_spawn ctr; + struct crypto_ahash_spawn ghash; +}; + +struct crypto_gcm_ctx { + struct crypto_skcipher *ctr; + struct crypto_ahash *ghash; +}; + +struct crypto_rfc4106_ctx { + struct crypto_aead *child; + u8 nonce[4]; +}; + +struct crypto_rfc4106_req_ctx { + struct scatterlist src[3]; + struct scatterlist dst[3]; + struct aead_request subreq; +}; + +struct crypto_rfc4543_instance_ctx { + struct crypto_aead_spawn aead; +}; + +struct crypto_rfc4543_ctx { + struct crypto_aead *child; + struct crypto_sync_skcipher *null; + u8 nonce[4]; +}; + +struct crypto_rfc4543_req_ctx { + struct aead_request subreq; +}; + +struct crypto_gcm_ghash_ctx { + unsigned int cryptlen; + struct scatterlist *src; + int (*complete)(struct aead_request *, u32); +}; + +struct crypto_gcm_req_priv_ctx { + u8 iv[16]; + u8 auth_tag[16]; + u8 iauth_tag[16]; + struct scatterlist src[3]; + struct scatterlist dst[3]; + struct scatterlist sg; + struct crypto_gcm_ghash_ctx ghash_ctx; + union { + struct ahash_request ahreq; + struct skcipher_request skreq; + } u; +}; + +struct cryptd_skcipher { + struct crypto_skcipher base; +}; + +struct cryptd_ahash { + struct crypto_ahash base; +}; + +struct cryptd_aead { + struct crypto_aead base; +}; + +struct cryptd_cpu_queue { + struct crypto_queue queue; + struct work_struct work; +}; + +struct cryptd_queue { + struct cryptd_cpu_queue *cpu_queue; +}; + +struct cryptd_instance_ctx { + struct crypto_spawn spawn; + struct cryptd_queue *queue; +}; + +struct skcipherd_instance_ctx { + struct crypto_skcipher_spawn spawn; + struct cryptd_queue *queue; +}; + +struct hashd_instance_ctx { + struct crypto_shash_spawn spawn; + struct cryptd_queue *queue; +}; + +struct aead_instance_ctx { + struct crypto_aead_spawn aead_spawn; + struct cryptd_queue *queue; +}; + +struct cryptd_skcipher_ctx { + refcount_t refcnt; + struct crypto_sync_skcipher *child; +}; + +struct cryptd_skcipher_request_ctx { + crypto_completion_t complete; +}; + +struct cryptd_hash_ctx { + refcount_t refcnt; + struct crypto_shash *child; +}; + +struct cryptd_hash_request_ctx { + crypto_completion_t complete; + struct shash_desc desc; +}; + +struct cryptd_aead_ctx { + refcount_t refcnt; + struct crypto_aead *child; +}; + +struct cryptd_aead_request_ctx { + crypto_completion_t complete; +}; + +struct deflate_ctx { + struct z_stream_s comp_stream; + struct z_stream_s decomp_stream; +}; + +struct chksum_ctx { + u32 key; +}; + +struct chksum_desc_ctx { + u32 crc; +}; + +struct chksum_desc_ctx___2 { + __u16 crc; +}; + +struct lzo_ctx { + void *lzo_comp_mem; +}; + +struct lzorle_ctx { + void *lzorle_comp_mem; +}; + +struct xxh64_state { + uint64_t total_len; + uint64_t v1; + uint64_t v2; + uint64_t v3; + uint64_t v4; + uint64_t mem64[4]; + uint32_t memsize; +}; + +struct xxhash64_tfm_ctx { + u64 seed; +}; + +struct xxhash64_desc_ctx { + struct xxh64_state xxhstate; +}; + +struct crypto842_ctx { + void *wmem; +}; + +struct crypto_report_rng { + char type[64]; + unsigned int seedsize; +}; + +struct random_ready_callback { + struct list_head list; + void (*func)(struct random_ready_callback *); + struct module *owner; +}; + +typedef uint32_t drbg_flag_t; + +struct drbg_core { + drbg_flag_t flags; + __u8 statelen; + __u8 blocklen_bytes; + char cra_name[128]; + char backend_cra_name[128]; +}; + +struct drbg_state; + +struct drbg_state_ops { + int (*update)(struct drbg_state *, struct list_head *, int); + int (*generate)(struct drbg_state *, unsigned char *, unsigned int, struct list_head *); + int (*crypto_init)(struct drbg_state *); + int (*crypto_fini)(struct drbg_state *); +}; + +struct drbg_state { + struct mutex drbg_mutex; + unsigned char *V; + unsigned char *Vbuf; + unsigned char *C; + unsigned char *Cbuf; + size_t reseed_ctr; + size_t reseed_threshold; + unsigned char *scratchpad; + unsigned char *scratchpadbuf; + void *priv_data; + struct crypto_skcipher *ctr_handle; + struct skcipher_request *ctr_req; + __u8 *outscratchpadbuf; + __u8 *outscratchpad; + struct crypto_wait ctr_wait; + struct scatterlist sg_in; + struct scatterlist sg_out; + bool seeded; + bool pr; + bool fips_primed; + unsigned char *prev; + struct work_struct seed_work; + struct crypto_rng *jent; + const struct drbg_state_ops *d_ops; + const struct drbg_core *core; + struct drbg_string test_data; + struct random_ready_callback random_ready; +}; + +enum drbg_prefixes { + DRBG_PREFIX0 = 0, + DRBG_PREFIX1 = 1, + DRBG_PREFIX2 = 2, + DRBG_PREFIX3 = 3, +}; + +struct sdesc { + struct shash_desc shash; + char ctx[0]; +}; + +struct s { + __be32 conv; +}; + +struct rand_data { + __u64 data; + __u64 old_data; + __u64 prev_time; + __u64 last_delta; + __s64 last_delta2; + unsigned int osr; + unsigned char *mem; + unsigned int memlocation; + unsigned int memblocks; + unsigned int memblocksize; + unsigned int memaccessloops; + int rct_count; + unsigned int apt_observations; + unsigned int apt_count; + unsigned int apt_base; + unsigned int apt_base_set: 1; + unsigned int health_failure: 1; +}; + +struct rand_data___2; + +struct jitterentropy { + spinlock_t jent_lock; + struct rand_data___2 *entropy_collector; + unsigned int reset_cnt; +}; + +struct ghash_ctx { + struct gf128mul_4k *gf128; +}; + +struct ghash_desc_ctx { + u8 buffer[16]; + u32 bytes; +}; + +struct sockaddr_alg_new { + __u16 salg_family; + __u8 salg_type[14]; + __u32 salg_feat; + __u32 salg_mask; + __u8 salg_name[0]; +}; + +struct af_alg_iv { + __u32 ivlen; + __u8 iv[0]; +}; + +struct cmsghdr { + __kernel_size_t cmsg_len; + int cmsg_level; + int cmsg_type; +}; + +struct net_proto_family { + int family; + int (*create)(struct net *, struct socket *, int, int); + struct module *owner; +}; + +enum { + SOCK_WAKE_IO = 0, + SOCK_WAKE_WAITD = 1, + SOCK_WAKE_SPACE = 2, + SOCK_WAKE_URG = 3, +}; + +struct af_alg_type; + +struct alg_sock { + struct sock sk; + struct sock *parent; + atomic_t refcnt; + atomic_t nokey_refcnt; + const struct af_alg_type *type; + void *private; +}; + +struct af_alg_type { + void * (*bind)(const char *, u32, u32); + void (*release)(void *); + int (*setkey)(void *, const u8 *, unsigned int); + int (*setentropy)(void *, sockptr_t, unsigned int); + int (*accept)(void *, struct sock *); + int (*accept_nokey)(void *, struct sock *); + int (*setauthsize)(void *, unsigned int); + struct proto_ops *ops; + struct proto_ops *ops_nokey; + struct module *owner; + char name[14]; +}; + +struct af_alg_control { + struct af_alg_iv *iv; + int op; + unsigned int aead_assoclen; +}; + +struct af_alg_sgl { + struct scatterlist sg[17]; + struct page *pages[16]; + unsigned int npages; +}; + +struct af_alg_tsgl { + struct list_head list; + unsigned int cur; + struct scatterlist sg[0]; +}; + +struct af_alg_rsgl { + struct af_alg_sgl sgl; + struct list_head list; + size_t sg_num_bytes; +}; + +struct af_alg_async_req { + struct kiocb *iocb; + struct sock *sk; + struct af_alg_rsgl first_rsgl; + struct af_alg_rsgl *last_rsgl; + struct list_head rsgl_list; + struct scatterlist *tsgl; + unsigned int tsgl_entries; + unsigned int outlen; + unsigned int areqlen; + union { + struct aead_request aead_req; + struct skcipher_request skcipher_req; + } cra_u; +}; + +struct af_alg_ctx { + struct list_head tsgl_list; + void *iv; + size_t aead_assoclen; + struct crypto_wait wait; + size_t used; + atomic_t rcvused; + bool more; + bool merge; + bool enc; + bool init; + unsigned int len; +}; + +struct alg_type_list { + const struct af_alg_type *type; + struct list_head list; +}; + +struct hash_ctx { + struct af_alg_sgl sgl; + u8 *result; + struct crypto_wait wait; + unsigned int len; + bool more; + struct ahash_request req; +}; + +struct rng_ctx { + unsigned int len; + struct crypto_rng *drng; + u8 *addtl; + size_t addtl_len; +}; + +struct rng_parent_ctx { + struct crypto_rng *drng; + u8 *entropy; +}; + +struct aead_tfm { + struct crypto_aead *aead; + struct crypto_sync_skcipher *null_tfm; +}; + +struct xor_block_template { + struct xor_block_template *next; + const char *name; + int speed; + void (*do_2)(long unsigned int, long unsigned int *, long unsigned int *); + void (*do_3)(long unsigned int, long unsigned int *, long unsigned int *, long unsigned int *); + void (*do_4)(long unsigned int, long unsigned int *, long unsigned int *, long unsigned int *, long unsigned int *); + void (*do_5)(long unsigned int, long unsigned int *, long unsigned int *, long unsigned int *, long unsigned int *, long unsigned int *); +}; + +enum asymmetric_payload_bits { + asym_crypto = 0, + asym_subtype = 1, + asym_key_ids = 2, + asym_auth = 3, +}; + +struct asymmetric_key_ids { + void *id[2]; +}; + +struct asymmetric_key_subtype { + struct module *owner; + const char *name; + short unsigned int name_len; + void (*describe)(const struct key *, struct seq_file *); + void (*destroy)(void *, void *); + int (*query)(const struct kernel_pkey_params *, struct kernel_pkey_query *); + int (*eds_op)(struct kernel_pkey_params *, const void *, void *); + int (*verify_signature)(const struct key *, const struct public_key_signature *); +}; + +struct asymmetric_key_parser { + struct list_head link; + struct module *owner; + const char *name; + int (*parse)(struct key_preparsed_payload *); +}; + +struct public_key { + void *key; + u32 keylen; + enum OID algo; + void *params; + u32 paramlen; + bool key_is_private; + const char *id_type; + const char *pkey_algo; +}; + +enum x509_actions { + ACT_x509_extract_key_data = 0, + ACT_x509_extract_name_segment = 1, + ACT_x509_note_OID = 2, + ACT_x509_note_issuer = 3, + ACT_x509_note_not_after = 4, + ACT_x509_note_not_before = 5, + ACT_x509_note_params = 6, + ACT_x509_note_pkey_algo = 7, + ACT_x509_note_serial = 8, + ACT_x509_note_signature = 9, + ACT_x509_note_subject = 10, + ACT_x509_note_tbs_certificate = 11, + ACT_x509_process_extension = 12, + NR__x509_actions = 13, +}; + +enum x509_akid_actions { + ACT_x509_akid_note_kid = 0, + ACT_x509_akid_note_name = 1, + ACT_x509_akid_note_serial = 2, + ACT_x509_extract_name_segment___2 = 3, + ACT_x509_note_OID___2 = 4, + NR__x509_akid_actions = 5, +}; + +struct x509_certificate { + struct x509_certificate *next; + struct x509_certificate *signer; + struct public_key *pub; + struct public_key_signature *sig; + char *issuer; + char *subject; + struct asymmetric_key_id *id; + struct asymmetric_key_id *skid; + time64_t valid_from; + time64_t valid_to; + const void *tbs; + unsigned int tbs_size; + unsigned int raw_sig_size; + const void *raw_sig; + const void *raw_serial; + unsigned int raw_serial_size; + unsigned int raw_issuer_size; + const void *raw_issuer; + const void *raw_subject; + unsigned int raw_subject_size; + unsigned int raw_skid_size; + const void *raw_skid; + unsigned int index; + bool seen; + bool verified; + bool self_signed; + bool unsupported_key; + bool unsupported_sig; + bool blacklisted; +}; + +struct x509_parse_context { + struct x509_certificate *cert; + long unsigned int data; + const void *cert_start; + const void *key; + size_t key_size; + const void *params; + size_t params_size; + enum OID key_algo; + enum OID last_oid; + enum OID algo_oid; + unsigned char nr_mpi; + u8 o_size; + u8 cn_size; + u8 email_size; + u16 o_offset; + u16 cn_offset; + u16 email_offset; + unsigned int raw_akid_size; + const void *raw_akid; + const void *akid_raw_issuer; + unsigned int akid_raw_issuer_size; +}; + +enum pkcs7_actions { + ACT_pkcs7_check_content_type = 0, + ACT_pkcs7_extract_cert = 1, + ACT_pkcs7_note_OID = 2, + ACT_pkcs7_note_certificate_list = 3, + ACT_pkcs7_note_content = 4, + ACT_pkcs7_note_data = 5, + ACT_pkcs7_note_signed_info = 6, + ACT_pkcs7_note_signeddata_version = 7, + ACT_pkcs7_note_signerinfo_version = 8, + ACT_pkcs7_sig_note_authenticated_attr = 9, + ACT_pkcs7_sig_note_digest_algo = 10, + ACT_pkcs7_sig_note_issuer = 11, + ACT_pkcs7_sig_note_pkey_algo = 12, + ACT_pkcs7_sig_note_serial = 13, + ACT_pkcs7_sig_note_set_of_authattrs = 14, + ACT_pkcs7_sig_note_signature = 15, + ACT_pkcs7_sig_note_skid = 16, + NR__pkcs7_actions = 17, +}; + +struct pkcs7_signed_info { + struct pkcs7_signed_info *next; + struct x509_certificate *signer; + unsigned int index; + bool unsupported_crypto; + bool blacklisted; + const void *msgdigest; + unsigned int msgdigest_len; + unsigned int authattrs_len; + const void *authattrs; + long unsigned int aa_set; + time64_t signing_time; + struct public_key_signature *sig; +}; + +struct pkcs7_message___2 { + struct x509_certificate *certs; + struct x509_certificate *crl; + struct pkcs7_signed_info *signed_infos; + u8 version; + bool have_authattrs; + enum OID data_type; + size_t data_len; + size_t data_hdrlen; + const void *data; +}; + +struct pkcs7_parse_context { + struct pkcs7_message___2 *msg; + struct pkcs7_signed_info *sinfo; + struct pkcs7_signed_info **ppsinfo; + struct x509_certificate *certs; + struct x509_certificate **ppcerts; + long unsigned int data; + enum OID last_oid; + unsigned int x509_index; + unsigned int sinfo_index; + const void *raw_serial; + unsigned int raw_serial_size; + unsigned int raw_issuer_size; + const void *raw_issuer; + const void *raw_skid; + unsigned int raw_skid_size; + bool expect_skid; +}; + +struct mz_hdr { + uint16_t magic; + uint16_t lbsize; + uint16_t blocks; + uint16_t relocs; + uint16_t hdrsize; + uint16_t min_extra_pps; + uint16_t max_extra_pps; + uint16_t ss; + uint16_t sp; + uint16_t checksum; + uint16_t ip; + uint16_t cs; + uint16_t reloc_table_offset; + uint16_t overlay_num; + uint16_t reserved0[4]; + uint16_t oem_id; + uint16_t oem_info; + uint16_t reserved1[10]; + uint32_t peaddr; + char message[0]; +}; + +struct pe_hdr { + uint32_t magic; + uint16_t machine; + uint16_t sections; + uint32_t timestamp; + uint32_t symbol_table; + uint32_t symbols; + uint16_t opt_hdr_size; + uint16_t flags; +}; + +struct pe32_opt_hdr { + uint16_t magic; + uint8_t ld_major; + uint8_t ld_minor; + uint32_t text_size; + uint32_t data_size; + uint32_t bss_size; + uint32_t entry_point; + uint32_t code_base; + uint32_t data_base; + uint32_t image_base; + uint32_t section_align; + uint32_t file_align; + uint16_t os_major; + uint16_t os_minor; + uint16_t image_major; + uint16_t image_minor; + uint16_t subsys_major; + uint16_t subsys_minor; + uint32_t win32_version; + uint32_t image_size; + uint32_t header_size; + uint32_t csum; + uint16_t subsys; + uint16_t dll_flags; + uint32_t stack_size_req; + uint32_t stack_size; + uint32_t heap_size_req; + uint32_t heap_size; + uint32_t loader_flags; + uint32_t data_dirs; +}; + +struct pe32plus_opt_hdr { + uint16_t magic; + uint8_t ld_major; + uint8_t ld_minor; + uint32_t text_size; + uint32_t data_size; + uint32_t bss_size; + uint32_t entry_point; + uint32_t code_base; + uint64_t image_base; + uint32_t section_align; + uint32_t file_align; + uint16_t os_major; + uint16_t os_minor; + uint16_t image_major; + uint16_t image_minor; + uint16_t subsys_major; + uint16_t subsys_minor; + uint32_t win32_version; + uint32_t image_size; + uint32_t header_size; + uint32_t csum; + uint16_t subsys; + uint16_t dll_flags; + uint64_t stack_size_req; + uint64_t stack_size; + uint64_t heap_size_req; + uint64_t heap_size; + uint32_t loader_flags; + uint32_t data_dirs; +}; + +struct data_dirent { + uint32_t virtual_address; + uint32_t size; +}; + +struct data_directory { + struct data_dirent exports; + struct data_dirent imports; + struct data_dirent resources; + struct data_dirent exceptions; + struct data_dirent certs; + struct data_dirent base_relocations; + struct data_dirent debug; + struct data_dirent arch; + struct data_dirent global_ptr; + struct data_dirent tls; + struct data_dirent load_config; + struct data_dirent bound_imports; + struct data_dirent import_addrs; + struct data_dirent delay_imports; + struct data_dirent clr_runtime_hdr; + struct data_dirent reserved; +}; + +struct section_header { + char name[8]; + uint32_t virtual_size; + uint32_t virtual_address; + uint32_t raw_data_size; + uint32_t data_addr; + uint32_t relocs; + uint32_t line_numbers; + uint16_t num_relocs; + uint16_t num_lin_numbers; + uint32_t flags; +}; + +struct win_certificate { + uint32_t length; + uint16_t revision; + uint16_t cert_type; +}; + +struct pefile_context { + unsigned int header_size; + unsigned int image_checksum_offset; + unsigned int cert_dirent_offset; + unsigned int n_data_dirents; + unsigned int n_sections; + unsigned int certs_size; + unsigned int sig_offset; + unsigned int sig_len; + const struct section_header *secs; + const void *digest; + unsigned int digest_len; + const char *digest_algo; +}; + +enum mscode_actions { + ACT_mscode_note_content_type = 0, + ACT_mscode_note_digest = 1, + ACT_mscode_note_digest_algo = 2, + NR__mscode_actions = 3, +}; + +struct simd_skcipher_alg___2 { + const char *ialg_name; + struct skcipher_alg alg; +}; + +struct simd_skcipher_ctx { + struct cryptd_skcipher *cryptd_tfm; +}; + +struct simd_aead_alg___2 { + const char *ialg_name; + struct aead_alg alg; +}; + +struct simd_aead_ctx { + struct cryptd_aead *cryptd_tfm; +}; + +struct biovec_slab { + int nr_vecs; + char *name; + struct kmem_cache *slab; +}; + +enum rq_qos_id { + RQ_QOS_WBT = 0, + RQ_QOS_LATENCY = 1, + RQ_QOS_COST = 2, +}; + +struct rq_qos_ops; + +struct rq_qos { + struct rq_qos_ops *ops; + struct request_queue *q; + enum rq_qos_id id; + struct rq_qos *next; + struct dentry *debugfs_dir; +}; + +enum { + sysctl_hung_task_timeout_secs = 0, +}; + +enum hctx_type { + HCTX_TYPE_DEFAULT = 0, + HCTX_TYPE_READ = 1, + HCTX_TYPE_POLL = 2, + HCTX_MAX_TYPES = 3, +}; + +struct rq_qos_ops { + void (*throttle)(struct rq_qos *, struct bio *); + void (*track)(struct rq_qos *, struct request *, struct bio *); + void (*merge)(struct rq_qos *, struct request *, struct bio *); + void (*issue)(struct rq_qos *, struct request *); + void (*requeue)(struct rq_qos *, struct request *); + void (*done)(struct rq_qos *, struct request *); + void (*done_bio)(struct rq_qos *, struct bio *); + void (*cleanup)(struct rq_qos *, struct bio *); + void (*queue_depth_changed)(struct rq_qos *); + void (*exit)(struct rq_qos *); + const struct blk_mq_debugfs_attr *debugfs_attrs; +}; + +struct bio_slab { + struct kmem_cache *slab; + unsigned int slab_ref; + unsigned int slab_size; + char name[8]; +}; + +enum { + BLK_MQ_F_SHOULD_MERGE = 1, + BLK_MQ_F_TAG_QUEUE_SHARED = 2, + BLK_MQ_F_STACKING = 4, + BLK_MQ_F_TAG_HCTX_SHARED = 8, + BLK_MQ_F_BLOCKING = 32, + BLK_MQ_F_NO_SCHED = 64, + BLK_MQ_F_ALLOC_POLICY_START_BIT = 8, + BLK_MQ_F_ALLOC_POLICY_BITS = 1, + BLK_MQ_S_STOPPED = 0, + BLK_MQ_S_TAG_ACTIVE = 1, + BLK_MQ_S_SCHED_RESTART = 2, + BLK_MQ_S_INACTIVE = 3, + BLK_MQ_MAX_DEPTH = 10240, + BLK_MQ_CPU_WORK_BATCH = 8, +}; + +enum { + WBT_RWQ_BG = 0, + WBT_RWQ_KSWAPD = 1, + WBT_RWQ_DISCARD = 2, + WBT_NUM_RWQ = 3, +}; + +enum { + BLK_MQ_REQ_NOWAIT = 1, + BLK_MQ_REQ_RESERVED = 2, + BLK_MQ_REQ_PM = 4, +}; + +struct trace_event_raw_block_buffer { + struct trace_entry ent; + dev_t dev; + sector_t sector; + size_t size; + char __data[0]; +}; + +struct trace_event_raw_block_rq_requeue { + struct trace_entry ent; + dev_t dev; + sector_t sector; + unsigned int nr_sector; + char rwbs[8]; + u32 __data_loc_cmd; + char __data[0]; +}; + +struct trace_event_raw_block_rq_complete { + struct trace_entry ent; + dev_t dev; + sector_t sector; + unsigned int nr_sector; + int error; + char rwbs[8]; + u32 __data_loc_cmd; + char __data[0]; +}; + +struct trace_event_raw_block_rq { + struct trace_entry ent; + dev_t dev; + sector_t sector; + unsigned int nr_sector; + unsigned int bytes; + char rwbs[8]; + char comm[16]; + u32 __data_loc_cmd; + char __data[0]; +}; + +struct trace_event_raw_block_bio_complete { + struct trace_entry ent; + dev_t dev; + sector_t sector; + unsigned int nr_sector; + int error; + char rwbs[8]; + char __data[0]; +}; + +struct trace_event_raw_block_bio { + struct trace_entry ent; + dev_t dev; + sector_t sector; + unsigned int nr_sector; + char rwbs[8]; + char comm[16]; + char __data[0]; +}; + +struct trace_event_raw_block_plug { + struct trace_entry ent; + char comm[16]; + char __data[0]; +}; + +struct trace_event_raw_block_unplug { + struct trace_entry ent; + int nr_rq; + char comm[16]; + char __data[0]; +}; + +struct trace_event_raw_block_split { + struct trace_entry ent; + dev_t dev; + sector_t sector; + sector_t new_sector; + char rwbs[8]; + char comm[16]; + char __data[0]; +}; + +struct trace_event_raw_block_bio_remap { + struct trace_entry ent; + dev_t dev; + sector_t sector; + unsigned int nr_sector; + dev_t old_dev; + sector_t old_sector; + char rwbs[8]; + char __data[0]; +}; + +struct trace_event_raw_block_rq_remap { + struct trace_entry ent; + dev_t dev; + sector_t sector; + unsigned int nr_sector; + dev_t old_dev; + sector_t old_sector; + unsigned int nr_bios; + char rwbs[8]; + char __data[0]; +}; + +struct trace_event_data_offsets_block_buffer {}; + +struct trace_event_data_offsets_block_rq_requeue { + u32 cmd; +}; + +struct trace_event_data_offsets_block_rq_complete { + u32 cmd; +}; + +struct trace_event_data_offsets_block_rq { + u32 cmd; +}; + +struct trace_event_data_offsets_block_bio_complete {}; + +struct trace_event_data_offsets_block_bio {}; + +struct trace_event_data_offsets_block_plug {}; + +struct trace_event_data_offsets_block_unplug {}; + +struct trace_event_data_offsets_block_split {}; + +struct trace_event_data_offsets_block_bio_remap {}; + +struct trace_event_data_offsets_block_rq_remap {}; + +typedef void (*btf_trace_block_touch_buffer)(void *, struct buffer_head *); + +typedef void (*btf_trace_block_dirty_buffer)(void *, struct buffer_head *); + +typedef void (*btf_trace_block_rq_requeue)(void *, struct request *); + +typedef void (*btf_trace_block_rq_complete)(void *, struct request *, int, unsigned int); + +typedef void (*btf_trace_block_rq_insert)(void *, struct request *); + +typedef void (*btf_trace_block_rq_issue)(void *, struct request *); + +typedef void (*btf_trace_block_rq_merge)(void *, struct request *); + +typedef void (*btf_trace_block_bio_complete)(void *, struct request_queue *, struct bio *); + +typedef void (*btf_trace_block_bio_bounce)(void *, struct bio *); + +typedef void (*btf_trace_block_bio_backmerge)(void *, struct bio *); + +typedef void (*btf_trace_block_bio_frontmerge)(void *, struct bio *); + +typedef void (*btf_trace_block_bio_queue)(void *, struct bio *); + +typedef void (*btf_trace_block_getrq)(void *, struct bio *); + +typedef void (*btf_trace_block_plug)(void *, struct request_queue *); + +typedef void (*btf_trace_block_unplug)(void *, struct request_queue *, unsigned int, bool); + +typedef void (*btf_trace_block_split)(void *, struct bio *, unsigned int); + +typedef void (*btf_trace_block_bio_remap)(void *, struct bio *, dev_t, sector_t); + +typedef void (*btf_trace_block_rq_remap)(void *, struct request *, dev_t, sector_t); + +enum { + BLK_MQ_NO_TAG = 4294967295, + BLK_MQ_TAG_MIN = 1, + BLK_MQ_TAG_MAX = 4294967294, +}; + +struct queue_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct request_queue *, char *); + ssize_t (*store)(struct request_queue *, const char *, size_t); +}; + +enum { + REQ_FSEQ_PREFLUSH = 1, + REQ_FSEQ_DATA = 2, + REQ_FSEQ_POSTFLUSH = 4, + REQ_FSEQ_DONE = 8, + REQ_FSEQ_ACTIONS = 7, + FLUSH_PENDING_TIMEOUT = 5000, +}; + +enum { + ICQ_EXITED = 4, + ICQ_DESTROYED = 8, +}; + +struct rq_map_data { + struct page **pages; + int page_order; + int nr_entries; + long unsigned int offset; + int null_mapped; + int from_user; +}; + +struct bio_map_data { + bool is_our_pages: 1; + bool is_null_mapped: 1; + struct iov_iter iter; + struct iovec iov[0]; +}; + +struct req_iterator { + struct bvec_iter iter; + struct bio *bio; +}; + +enum bio_merge_status { + BIO_MERGE_OK = 0, + BIO_MERGE_NONE = 1, + BIO_MERGE_FAILED = 2, +}; + +typedef bool (*sb_for_each_fn)(struct sbitmap *, unsigned int, void *); + +typedef bool busy_iter_fn(struct blk_mq_hw_ctx *, struct request *, void *, bool); + +typedef bool busy_tag_iter_fn(struct request *, void *, bool); + +enum { + BLK_MQ_UNIQUE_TAG_BITS = 16, + BLK_MQ_UNIQUE_TAG_MASK = 65535, +}; + +struct mq_inflight { + struct block_device *part; + unsigned int inflight[2]; +}; + +struct flush_busy_ctx_data { + struct blk_mq_hw_ctx *hctx; + struct list_head *list; +}; + +struct dispatch_rq_data { + struct blk_mq_hw_ctx *hctx; + struct request *rq; +}; + +enum prep_dispatch { + PREP_DISPATCH_OK = 0, + PREP_DISPATCH_NO_TAG = 1, + PREP_DISPATCH_NO_BUDGET = 2, +}; + +struct rq_iter_data { + struct blk_mq_hw_ctx *hctx; + bool has_rq; +}; + +struct blk_mq_qe_pair { + struct list_head node; + struct request_queue *q; + struct elevator_type *type; +}; + +struct sbq_wait { + struct sbitmap_queue *sbq; + struct wait_queue_entry wait; +}; + +struct bt_iter_data { + struct blk_mq_hw_ctx *hctx; + busy_iter_fn *fn; + void *data; + bool reserved; +}; + +struct bt_tags_iter_data { + struct blk_mq_tags *tags; + busy_tag_iter_fn *fn; + void *data; + unsigned int flags; +}; + +struct blk_queue_stats { + struct list_head callbacks; + spinlock_t lock; + bool enable_accounting; +}; + +struct blk_mq_ctx_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct blk_mq_ctx *, char *); + ssize_t (*store)(struct blk_mq_ctx *, const char *, size_t); +}; + +struct blk_mq_hw_ctx_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct blk_mq_hw_ctx *, char *); + ssize_t (*store)(struct blk_mq_hw_ctx *, const char *, size_t); +}; + +typedef u32 compat_caddr_t; + +struct hd_geometry { + unsigned char heads; + unsigned char sectors; + short unsigned int cylinders; + long unsigned int start; +}; + +struct blkpg_ioctl_arg { + int op; + int flags; + int datalen; + void *data; +}; + +struct blkpg_partition { + long long int start; + long long int length; + int pno; + char devname[64]; + char volname[64]; +}; + +struct pr_reservation { + __u64 key; + __u32 type; + __u32 flags; +}; + +struct pr_registration { + __u64 old_key; + __u64 new_key; + __u32 flags; + __u32 __pad; +}; + +struct pr_preempt { + __u64 old_key; + __u64 new_key; + __u32 type; + __u32 flags; +}; + +struct pr_clear { + __u64 key; + __u32 flags; + __u32 __pad; +}; + +struct compat_blkpg_ioctl_arg { + compat_int_t op; + compat_int_t flags; + compat_int_t datalen; + compat_caddr_t data; +}; + +struct compat_hd_geometry { + unsigned char heads; + unsigned char sectors; + short unsigned int cylinders; + u32 start; +}; + +struct klist_node; + +struct klist { + spinlock_t k_lock; + struct list_head k_list; + void (*get)(struct klist_node *); + void (*put)(struct klist_node *); +}; + +struct klist_node { + void *n_klist; + struct list_head n_node; + struct kref n_ref; +}; + +struct klist_iter { + struct klist *i_klist; + struct klist_node *i_cur; +}; + +struct class_dev_iter { + struct klist_iter ki; + const struct device_type *type; +}; + +enum { + DISK_EVENT_FLAG_POLL = 1, + DISK_EVENT_FLAG_UEVENT = 2, +}; + +struct disk_events { + struct list_head node; + struct gendisk *disk; + spinlock_t lock; + struct mutex block_mutex; + int block; + unsigned int pending; + unsigned int clearing; + long int poll_msecs; + struct delayed_work dwork; +}; + +struct badblocks { + struct device *dev; + int count; + int unacked_exist; + int shift; + u64 *page; + int changed; + seqlock_t lock; + sector_t sector; + sector_t size; +}; + +struct disk_part_iter { + struct gendisk *disk; + struct block_device *part; + int idx; + unsigned int flags; +}; + +struct blk_major_name { + struct blk_major_name *next; + int major; + char name[16]; + void (*probe)(dev_t); +}; + +enum { + IOPRIO_WHO_PROCESS = 1, + IOPRIO_WHO_PGRP = 2, + IOPRIO_WHO_USER = 3, +}; + +struct parsed_partitions { + struct block_device *bdev; + char name[32]; + struct { + sector_t from; + sector_t size; + int flags; + bool has_info; + struct partition_meta_info info; + } *parts; + int next; + int limit; + bool access_beyond_eod; + char *pp_buf; +}; + +typedef struct { + struct page *v; +} Sector; + +struct RigidDiskBlock { + __u32 rdb_ID; + __be32 rdb_SummedLongs; + __s32 rdb_ChkSum; + __u32 rdb_HostID; + __be32 rdb_BlockBytes; + __u32 rdb_Flags; + __u32 rdb_BadBlockList; + __be32 rdb_PartitionList; + __u32 rdb_FileSysHeaderList; + __u32 rdb_DriveInit; + __u32 rdb_Reserved1[6]; + __u32 rdb_Cylinders; + __u32 rdb_Sectors; + __u32 rdb_Heads; + __u32 rdb_Interleave; + __u32 rdb_Park; + __u32 rdb_Reserved2[3]; + __u32 rdb_WritePreComp; + __u32 rdb_ReducedWrite; + __u32 rdb_StepRate; + __u32 rdb_Reserved3[5]; + __u32 rdb_RDBBlocksLo; + __u32 rdb_RDBBlocksHi; + __u32 rdb_LoCylinder; + __u32 rdb_HiCylinder; + __u32 rdb_CylBlocks; + __u32 rdb_AutoParkSeconds; + __u32 rdb_HighRDSKBlock; + __u32 rdb_Reserved4; + char rdb_DiskVendor[8]; + char rdb_DiskProduct[16]; + char rdb_DiskRevision[4]; + char rdb_ControllerVendor[8]; + char rdb_ControllerProduct[16]; + char rdb_ControllerRevision[4]; + __u32 rdb_Reserved5[10]; +}; + +struct PartitionBlock { + __be32 pb_ID; + __be32 pb_SummedLongs; + __s32 pb_ChkSum; + __u32 pb_HostID; + __be32 pb_Next; + __u32 pb_Flags; + __u32 pb_Reserved1[2]; + __u32 pb_DevFlags; + __u8 pb_DriveName[32]; + __u32 pb_Reserved2[15]; + __be32 pb_Environment[17]; + __u32 pb_EReserved[15]; +}; + +struct lvm_rec { + char lvm_id[4]; + char reserved4[16]; + __be32 lvmarea_len; + __be32 vgda_len; + __be32 vgda_psn[2]; + char reserved36[10]; + __be16 pp_size; + char reserved46[12]; + __be16 version; +}; + +struct vgda { + __be32 secs; + __be32 usec; + char reserved8[16]; + __be16 numlvs; + __be16 maxlvs; + __be16 pp_size; + __be16 numpvs; + __be16 total_vgdas; + __be16 vgda_size; +}; + +struct lvd { + __be16 lv_ix; + __be16 res2; + __be16 res4; + __be16 maxsize; + __be16 lv_state; + __be16 mirror; + __be16 mirror_policy; + __be16 num_lps; + __be16 res10[8]; +}; + +struct lvname { + char name[64]; +}; + +struct ppe { + __be16 lv_ix; + short unsigned int res2; + short unsigned int res4; + __be16 lp_ix; + short unsigned int res8[12]; +}; + +struct pvd { + char reserved0[16]; + __be16 pp_count; + char reserved18[2]; + __be32 psn_part1; + char reserved24[8]; + struct ppe ppe[1016]; +}; + +struct lv_info { + short unsigned int pps_per_lv; + short unsigned int pps_found; + unsigned char lv_is_contiguous; +}; + +struct mac_partition { + __be16 signature; + __be16 res1; + __be32 map_count; + __be32 start_block; + __be32 block_count; + char name[32]; + char type[32]; + __be32 data_start; + __be32 data_count; + __be32 status; + __be32 boot_start; + __be32 boot_size; + __be32 boot_load; + __be32 boot_load2; + __be32 boot_entry; + __be32 boot_entry2; + __be32 boot_cksum; + char processor[16]; +}; + +struct mac_driver_desc { + __be16 signature; + __be16 block_size; + __be32 block_count; +}; + +struct msdos_partition { + u8 boot_ind; + u8 head; + u8 sector; + u8 cyl; + u8 sys_ind; + u8 end_head; + u8 end_sector; + u8 end_cyl; + __le32 start_sect; + __le32 nr_sects; +}; + +struct frag { + struct list_head list; + u32 group; + u8 num; + u8 rec; + u8 map; + u8 data[0]; +}; + +struct privhead { + u16 ver_major; + u16 ver_minor; + u64 logical_disk_start; + u64 logical_disk_size; + u64 config_start; + u64 config_size; + uuid_t disk_id; +}; + +struct tocblock { + u8 bitmap1_name[16]; + u64 bitmap1_start; + u64 bitmap1_size; + u8 bitmap2_name[16]; + u64 bitmap2_start; + u64 bitmap2_size; +}; + +struct vmdb { + u16 ver_major; + u16 ver_minor; + u32 vblk_size; + u32 vblk_offset; + u32 last_vblk_seq; +}; + +struct vblk_comp { + u8 state[16]; + u64 parent_id; + u8 type; + u8 children; + u16 chunksize; +}; + +struct vblk_dgrp { + u8 disk_id[64]; +}; + +struct vblk_disk { + uuid_t disk_id; + u8 alt_name[128]; +}; + +struct vblk_part { + u64 start; + u64 size; + u64 volume_offset; + u64 parent_id; + u64 disk_id; + u8 partnum; +}; + +struct vblk_volu { + u8 volume_type[16]; + u8 volume_state[16]; + u8 guid[16]; + u8 drive_hint[4]; + u64 size; + u8 partition_type; +}; + +struct vblk { + u8 name[64]; + u64 obj_id; + u32 sequence; + u8 flags; + u8 type; + union { + struct vblk_comp comp; + struct vblk_dgrp dgrp; + struct vblk_disk disk; + struct vblk_part part; + struct vblk_volu volu; + } vblk; + struct list_head list; +}; + +struct ldmdb { + struct privhead ph; + struct tocblock toc; + struct vmdb vm; + struct list_head v_dgrp; + struct list_head v_disk; + struct list_head v_volu; + struct list_head v_comp; + struct list_head v_part; +}; + +struct fat_boot_sector { + __u8 ignored[3]; + __u8 system_id[8]; + __u8 sector_size[2]; + __u8 sec_per_clus; + __le16 reserved; + __u8 fats; + __u8 dir_entries[2]; + __u8 sectors[2]; + __u8 media; + __le16 fat_length; + __le16 secs_track; + __le16 heads; + __le32 hidden; + __le32 total_sect; + union { + struct { + __u8 drive_number; + __u8 state; + __u8 signature; + __u8 vol_id[4]; + __u8 vol_label[11]; + __u8 fs_type[8]; + } fat16; + struct { + __le32 length; + __le16 flags; + __u8 version[2]; + __le32 root_cluster; + __le16 info_sector; + __le16 backup_boot; + __le16 reserved2[6]; + __u8 drive_number; + __u8 state; + __u8 signature; + __u8 vol_id[4]; + __u8 vol_label[11]; + __u8 fs_type[8]; + } fat32; + }; +}; + +enum msdos_sys_ind { + DOS_EXTENDED_PARTITION = 5, + LINUX_EXTENDED_PARTITION = 133, + WIN98_EXTENDED_PARTITION = 15, + LINUX_DATA_PARTITION = 131, + LINUX_LVM_PARTITION = 142, + LINUX_RAID_PARTITION = 253, + SOLARIS_X86_PARTITION = 130, + NEW_SOLARIS_X86_PARTITION = 191, + DM6_AUX1PARTITION = 81, + DM6_AUX3PARTITION = 83, + DM6_PARTITION = 84, + EZD_PARTITION = 85, + FREEBSD_PARTITION = 165, + OPENBSD_PARTITION = 166, + NETBSD_PARTITION = 169, + BSDI_PARTITION = 183, + MINIX_PARTITION = 129, + UNIXWARE_PARTITION = 99, +}; + +struct solaris_x86_slice { + __le16 s_tag; + __le16 s_flag; + __le32 s_start; + __le32 s_size; +}; + +struct solaris_x86_vtoc { + unsigned int v_bootinfo[3]; + __le32 v_sanity; + __le32 v_version; + char v_volume[8]; + __le16 v_sectorsz; + __le16 v_nparts; + unsigned int v_reserved[10]; + struct solaris_x86_slice v_slice[16]; + unsigned int timestamp[16]; + char v_asciilabel[128]; +}; + +struct bsd_partition { + __le32 p_size; + __le32 p_offset; + __le32 p_fsize; + __u8 p_fstype; + __u8 p_frag; + __le16 p_cpg; +}; + +struct bsd_disklabel { + __le32 d_magic; + __s16 d_type; + __s16 d_subtype; + char d_typename[16]; + char d_packname[16]; + __u32 d_secsize; + __u32 d_nsectors; + __u32 d_ntracks; + __u32 d_ncylinders; + __u32 d_secpercyl; + __u32 d_secperunit; + __u16 d_sparespertrack; + __u16 d_sparespercyl; + __u32 d_acylinders; + __u16 d_rpm; + __u16 d_interleave; + __u16 d_trackskew; + __u16 d_cylskew; + __u32 d_headswitch; + __u32 d_trkseek; + __u32 d_flags; + __u32 d_drivedata[5]; + __u32 d_spare[5]; + __le32 d_magic2; + __le16 d_checksum; + __le16 d_npartitions; + __le32 d_bbsize; + __le32 d_sbsize; + struct bsd_partition d_partitions[16]; +}; + +struct unixware_slice { + __le16 s_label; + __le16 s_flags; + __le32 start_sect; + __le32 nr_sects; +}; + +struct unixware_vtoc { + __le32 v_magic; + __le32 v_version; + char v_name[8]; + __le16 v_nslices; + __le16 v_unknown1; + __le32 v_reserved[10]; + struct unixware_slice v_slice[16]; +}; + +struct unixware_disklabel { + __le32 d_type; + __le32 d_magic; + __le32 d_version; + char d_serial[12]; + __le32 d_ncylinders; + __le32 d_ntracks; + __le32 d_nsectors; + __le32 d_secsize; + __le32 d_part_start; + __le32 d_unknown1[12]; + __le32 d_alt_tbl; + __le32 d_alt_len; + __le32 d_phys_cyl; + __le32 d_phys_trk; + __le32 d_phys_sec; + __le32 d_phys_bytes; + __le32 d_unknown2; + __le32 d_unknown3; + __le32 d_pad[8]; + struct unixware_vtoc vtoc; +}; + +struct d_partition { + __le32 p_size; + __le32 p_offset; + __le32 p_fsize; + u8 p_fstype; + u8 p_frag; + __le16 p_cpg; +}; + +struct disklabel { + __le32 d_magic; + __le16 d_type; + __le16 d_subtype; + u8 d_typename[16]; + u8 d_packname[16]; + __le32 d_secsize; + __le32 d_nsectors; + __le32 d_ntracks; + __le32 d_ncylinders; + __le32 d_secpercyl; + __le32 d_secprtunit; + __le16 d_sparespertrack; + __le16 d_sparespercyl; + __le32 d_acylinders; + __le16 d_rpm; + __le16 d_interleave; + __le16 d_trackskew; + __le16 d_cylskew; + __le32 d_headswitch; + __le32 d_trkseek; + __le32 d_flags; + __le32 d_drivedata[5]; + __le32 d_spare[5]; + __le32 d_magic2; + __le16 d_checksum; + __le16 d_npartitions; + __le32 d_bbsize; + __le32 d_sbsize; + struct d_partition d_partitions[18]; +}; + +enum { + LINUX_RAID_PARTITION___2 = 253, +}; + +struct sgi_volume { + s8 name[8]; + __be32 block_num; + __be32 num_bytes; +}; + +struct sgi_partition { + __be32 num_blocks; + __be32 first_block; + __be32 type; +}; + +struct sgi_disklabel { + __be32 magic_mushroom; + __be16 root_part_num; + __be16 swap_part_num; + s8 boot_file[16]; + u8 _unused0[48]; + struct sgi_volume volume[15]; + struct sgi_partition partitions[16]; + __be32 csum; + __be32 _unused1; +}; + +enum { + SUN_WHOLE_DISK = 5, + LINUX_RAID_PARTITION___3 = 253, +}; + +struct sun_info { + __be16 id; + __be16 flags; +}; + +struct sun_vtoc { + __be32 version; + char volume[8]; + __be16 nparts; + struct sun_info infos[8]; + __be16 padding; + __be32 bootinfo[3]; + __be32 sanity; + __be32 reserved[10]; + __be32 timestamp[8]; +}; + +struct sun_partition { + __be32 start_cylinder; + __be32 num_sectors; +}; + +struct sun_disklabel { + unsigned char info[128]; + struct sun_vtoc vtoc; + __be32 write_reinstruct; + __be32 read_reinstruct; + unsigned char spare[148]; + __be16 rspeed; + __be16 pcylcount; + __be16 sparecyl; + __be16 obs1; + __be16 obs2; + __be16 ilfact; + __be16 ncyl; + __be16 nacyl; + __be16 ntrks; + __be16 nsect; + __be16 obs3; + __be16 obs4; + struct sun_partition partitions[8]; + __be16 magic; + __be16 csum; +}; + +struct _gpt_header { + __le64 signature; + __le32 revision; + __le32 header_size; + __le32 header_crc32; + __le32 reserved1; + __le64 my_lba; + __le64 alternate_lba; + __le64 first_usable_lba; + __le64 last_usable_lba; + efi_guid_t disk_guid; + __le64 partition_entry_lba; + __le32 num_partition_entries; + __le32 sizeof_partition_entry; + __le32 partition_entry_array_crc32; +} __attribute__((packed)); + +typedef struct _gpt_header gpt_header; + +struct _gpt_entry_attributes { + u64 required_to_function: 1; + u64 reserved: 47; + u64 type_guid_specific: 16; +}; + +typedef struct _gpt_entry_attributes gpt_entry_attributes; + +struct _gpt_entry { + efi_guid_t partition_type_guid; + efi_guid_t unique_partition_guid; + __le64 starting_lba; + __le64 ending_lba; + gpt_entry_attributes attributes; + __le16 partition_name[36]; +}; + +typedef struct _gpt_entry gpt_entry; + +struct _gpt_mbr_record { + u8 boot_indicator; + u8 start_head; + u8 start_sector; + u8 start_track; + u8 os_type; + u8 end_head; + u8 end_sector; + u8 end_track; + __le32 starting_lba; + __le32 size_in_lba; +}; + +typedef struct _gpt_mbr_record gpt_mbr_record; + +struct _legacy_mbr { + u8 boot_code[440]; + __le32 unique_mbr_signature; + __le16 unknown; + gpt_mbr_record partition_record[4]; + __le16 signature; +} __attribute__((packed)); + +typedef struct _legacy_mbr legacy_mbr; + +struct d_partition___2 { + __le32 p_res; + u8 p_fstype; + u8 p_res2[3]; + __le32 p_offset; + __le32 p_size; +}; + +struct disklabel___2 { + u8 d_reserved[270]; + struct d_partition___2 d_partitions[2]; + u8 d_blank[208]; + __le16 d_magic; +} __attribute__((packed)); + +struct rq_wait { + wait_queue_head_t wait; + atomic_t inflight; +}; + +struct rq_depth { + unsigned int max_depth; + int scale_step; + bool scaled_max; + unsigned int queue_depth; + unsigned int default_depth; +}; + +typedef bool acquire_inflight_cb_t(struct rq_wait *, void *); + +typedef void cleanup_cb_t(struct rq_wait *, void *); + +struct rq_qos_wait_data { + struct wait_queue_entry wq; + struct task_struct *task; + struct rq_wait *rqw; + acquire_inflight_cb_t *cb; + void *private_data; + bool got_token; +}; + +struct cdrom_device_ops; + +struct cdrom_device_info { + const struct cdrom_device_ops *ops; + struct list_head list; + struct gendisk *disk; + void *handle; + int mask; + int speed; + int capacity; + unsigned int options: 30; + unsigned int mc_flags: 2; + unsigned int vfs_events; + unsigned int ioctl_events; + int use_count; + char name[20]; + __u8 sanyo_slot: 2; + __u8 keeplocked: 1; + __u8 reserved: 5; + int cdda_method; + __u8 last_sense; + __u8 media_written; + short unsigned int mmc3_profile; + int for_data; + int (*exit)(struct cdrom_device_info *); + int mrw_mode_page; +}; + +struct scsi_sense_hdr { + u8 response_code; + u8 sense_key; + u8 asc; + u8 ascq; + u8 byte4; + u8 byte5; + u8 byte6; + u8 additional_length; +}; + +struct cdrom_msf0 { + __u8 minute; + __u8 second; + __u8 frame; +}; + +union cdrom_addr { + struct cdrom_msf0 msf; + int lba; +}; + +struct cdrom_multisession { + union cdrom_addr addr; + __u8 xa_flag; + __u8 addr_format; +}; + +struct cdrom_mcn { + __u8 medium_catalog_number[14]; +}; + +struct request_sense; + +struct cdrom_generic_command { + unsigned char cmd[12]; + unsigned char *buffer; + unsigned int buflen; + int stat; + struct request_sense *sense; + unsigned char data_direction; + int quiet; + int timeout; + union { + void *reserved[1]; + void *unused; + }; +}; + +struct request_sense { + __u8 error_code: 7; + __u8 valid: 1; + __u8 segment_number; + __u8 sense_key: 4; + __u8 reserved2: 1; + __u8 ili: 1; + __u8 reserved1: 2; + __u8 information[4]; + __u8 add_sense_len; + __u8 command_info[4]; + __u8 asc; + __u8 ascq; + __u8 fruc; + __u8 sks[3]; + __u8 asb[46]; +}; + +struct packet_command { + unsigned char cmd[12]; + unsigned char *buffer; + unsigned int buflen; + int stat; + struct scsi_sense_hdr *sshdr; + unsigned char data_direction; + int quiet; + int timeout; + void *reserved[1]; +}; + +struct cdrom_device_ops { + int (*open)(struct cdrom_device_info *, int); + void (*release)(struct cdrom_device_info *); + int (*drive_status)(struct cdrom_device_info *, int); + unsigned int (*check_events)(struct cdrom_device_info *, unsigned int, int); + int (*tray_move)(struct cdrom_device_info *, int); + int (*lock_door)(struct cdrom_device_info *, int); + int (*select_speed)(struct cdrom_device_info *, int); + int (*select_disc)(struct cdrom_device_info *, int); + int (*get_last_session)(struct cdrom_device_info *, struct cdrom_multisession *); + int (*get_mcn)(struct cdrom_device_info *, struct cdrom_mcn *); + int (*reset)(struct cdrom_device_info *); + int (*audio_ioctl)(struct cdrom_device_info *, unsigned int, void *); + const int capability; + int (*generic_packet)(struct cdrom_device_info *, struct packet_command *); +}; + +struct scsi_ioctl_command { + unsigned int inlen; + unsigned int outlen; + unsigned char data[0]; +}; + +enum scsi_device_event { + SDEV_EVT_MEDIA_CHANGE = 1, + SDEV_EVT_INQUIRY_CHANGE_REPORTED = 2, + SDEV_EVT_CAPACITY_CHANGE_REPORTED = 3, + SDEV_EVT_SOFT_THRESHOLD_REACHED_REPORTED = 4, + SDEV_EVT_MODE_PARAMETER_CHANGE_REPORTED = 5, + SDEV_EVT_LUN_CHANGE_REPORTED = 6, + SDEV_EVT_ALUA_STATE_CHANGE_REPORTED = 7, + SDEV_EVT_POWER_ON_RESET_OCCURRED = 8, + SDEV_EVT_FIRST = 1, + SDEV_EVT_LAST = 8, + SDEV_EVT_MAXBITS = 9, +}; + +struct scsi_request { + unsigned char __cmd[16]; + unsigned char *cmd; + short unsigned int cmd_len; + int result; + unsigned int sense_len; + unsigned int resid_len; + int retries; + void *sense; +}; + +struct sg_io_hdr { + int interface_id; + int dxfer_direction; + unsigned char cmd_len; + unsigned char mx_sb_len; + short unsigned int iovec_count; + unsigned int dxfer_len; + void *dxferp; + unsigned char *cmdp; + void *sbp; + unsigned int timeout; + unsigned int flags; + int pack_id; + void *usr_ptr; + unsigned char status; + unsigned char masked_status; + unsigned char msg_status; + unsigned char sb_len_wr; + short unsigned int host_status; + short unsigned int driver_status; + int resid; + unsigned int duration; + unsigned int info; +}; + +struct compat_sg_io_hdr { + compat_int_t interface_id; + compat_int_t dxfer_direction; + unsigned char cmd_len; + unsigned char mx_sb_len; + short unsigned int iovec_count; + compat_uint_t dxfer_len; + compat_uint_t dxferp; + compat_uptr_t cmdp; + compat_uptr_t sbp; + compat_uint_t timeout; + compat_uint_t flags; + compat_int_t pack_id; + compat_uptr_t usr_ptr; + unsigned char status; + unsigned char masked_status; + unsigned char msg_status; + unsigned char sb_len_wr; + short unsigned int host_status; + short unsigned int driver_status; + compat_int_t resid; + compat_uint_t duration; + compat_uint_t info; +}; + +struct blk_cmd_filter { + long unsigned int read_ok[4]; + long unsigned int write_ok[4]; +}; + +struct compat_cdrom_generic_command { + unsigned char cmd[12]; + compat_caddr_t buffer; + compat_uint_t buflen; + compat_int_t stat; + compat_caddr_t sense; + unsigned char data_direction; + unsigned char pad[3]; + compat_int_t quiet; + compat_int_t timeout; + compat_caddr_t unused; +}; + +enum { + OMAX_SB_LEN = 16, +}; + +struct bsg_device { + struct request_queue *queue; + spinlock_t lock; + struct hlist_node dev_list; + refcount_t ref_count; + char name[20]; + int max_queue; +}; + +struct bsg_job; + +typedef int bsg_job_fn(struct bsg_job *); + +struct bsg_buffer { + unsigned int payload_len; + int sg_cnt; + struct scatterlist *sg_list; +}; + +struct bsg_job { + struct device *dev; + struct kref kref; + unsigned int timeout; + void *request; + void *reply; + unsigned int request_len; + unsigned int reply_len; + struct bsg_buffer request_payload; + struct bsg_buffer reply_payload; + int result; + unsigned int reply_payload_rcv_len; + struct request *bidi_rq; + struct bio *bidi_bio; + void *dd_data; +}; + +typedef enum blk_eh_timer_return bsg_timeout_fn(struct request *); + +struct bsg_set { + struct blk_mq_tag_set tag_set; + bsg_job_fn *job_fn; + bsg_timeout_fn *timeout_fn; +}; + +typedef struct blkcg_policy_data *blkcg_pol_alloc_cpd_fn(gfp_t); + +typedef void blkcg_pol_init_cpd_fn(struct blkcg_policy_data *); + +typedef void blkcg_pol_free_cpd_fn(struct blkcg_policy_data *); + +typedef void blkcg_pol_bind_cpd_fn(struct blkcg_policy_data *); + +typedef struct blkg_policy_data *blkcg_pol_alloc_pd_fn(gfp_t, struct request_queue *, struct blkcg *); + +typedef void blkcg_pol_init_pd_fn(struct blkg_policy_data *); + +typedef void blkcg_pol_online_pd_fn(struct blkg_policy_data *); + +typedef void blkcg_pol_offline_pd_fn(struct blkg_policy_data *); + +typedef void blkcg_pol_free_pd_fn(struct blkg_policy_data *); + +typedef void blkcg_pol_reset_pd_stats_fn(struct blkg_policy_data *); + +typedef size_t blkcg_pol_stat_pd_fn(struct blkg_policy_data *, char *, size_t); + +struct blkcg_policy { + int plid; + struct cftype *dfl_cftypes; + struct cftype *legacy_cftypes; + blkcg_pol_alloc_cpd_fn *cpd_alloc_fn; + blkcg_pol_init_cpd_fn *cpd_init_fn; + blkcg_pol_free_cpd_fn *cpd_free_fn; + blkcg_pol_bind_cpd_fn *cpd_bind_fn; + blkcg_pol_alloc_pd_fn *pd_alloc_fn; + blkcg_pol_init_pd_fn *pd_init_fn; + blkcg_pol_online_pd_fn *pd_online_fn; + blkcg_pol_offline_pd_fn *pd_offline_fn; + blkcg_pol_free_pd_fn *pd_free_fn; + blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn; + blkcg_pol_stat_pd_fn *pd_stat_fn; +}; + +struct blkg_conf_ctx { + struct block_device *bdev; + struct blkcg_gq *blkg; + char *body; +}; + +enum blkg_rwstat_type { + BLKG_RWSTAT_READ = 0, + BLKG_RWSTAT_WRITE = 1, + BLKG_RWSTAT_SYNC = 2, + BLKG_RWSTAT_ASYNC = 3, + BLKG_RWSTAT_DISCARD = 4, + BLKG_RWSTAT_NR = 5, + BLKG_RWSTAT_TOTAL = 5, +}; + +struct blkg_rwstat { + struct percpu_counter cpu_cnt[5]; + atomic64_t aux_cnt[5]; +}; + +struct blkg_rwstat_sample { + u64 cnt[5]; +}; + +struct throtl_service_queue { + struct throtl_service_queue *parent_sq; + struct list_head queued[2]; + unsigned int nr_queued[2]; + struct rb_root_cached pending_tree; + unsigned int nr_pending; + long unsigned int first_pending_disptime; + struct timer_list pending_timer; +}; + +struct latency_bucket { + long unsigned int total_latency; + int samples; +}; + +struct avg_latency_bucket { + long unsigned int latency; + bool valid; +}; + +struct throtl_data { + struct throtl_service_queue service_queue; + struct request_queue *queue; + unsigned int nr_queued[2]; + unsigned int throtl_slice; + struct work_struct dispatch_work; + unsigned int limit_index; + bool limit_valid[2]; + long unsigned int low_upgrade_time; + long unsigned int low_downgrade_time; + unsigned int scale; + struct latency_bucket tmp_buckets[18]; + struct avg_latency_bucket avg_buckets[18]; + struct latency_bucket *latency_buckets[2]; + long unsigned int last_calculate_time; + long unsigned int filtered_latency; + bool track_bio_latency; +}; + +struct throtl_grp; + +struct throtl_qnode { + struct list_head node; + struct bio_list bios; + struct throtl_grp *tg; +}; + +struct throtl_grp { + struct blkg_policy_data pd; + struct rb_node rb_node; + struct throtl_data *td; + struct throtl_service_queue service_queue; + struct throtl_qnode qnode_on_self[2]; + struct throtl_qnode qnode_on_parent[2]; + long unsigned int disptime; + unsigned int flags; + bool has_rules[2]; + uint64_t bps[4]; + uint64_t bps_conf[4]; + unsigned int iops[4]; + unsigned int iops_conf[4]; + uint64_t bytes_disp[2]; + unsigned int io_disp[2]; + long unsigned int last_low_overflow_time[2]; + uint64_t last_bytes_disp[2]; + unsigned int last_io_disp[2]; + long unsigned int last_check_time; + long unsigned int latency_target; + long unsigned int latency_target_conf; + long unsigned int slice_start[2]; + long unsigned int slice_end[2]; + long unsigned int last_finish_time; + long unsigned int checked_last_finish_time; + long unsigned int avg_idletime; + long unsigned int idletime_threshold; + long unsigned int idletime_threshold_conf; + unsigned int bio_cnt; + unsigned int bad_bio_cnt; + long unsigned int bio_cnt_reset_time; + struct blkg_rwstat stat_bytes; + struct blkg_rwstat stat_ios; +}; + +enum tg_state_flags { + THROTL_TG_PENDING = 1, + THROTL_TG_WAS_EMPTY = 2, +}; + +enum { + LIMIT_LOW = 0, + LIMIT_MAX = 1, + LIMIT_CNT = 2, +}; + +struct blk_iolatency { + struct rq_qos rqos; + struct timer_list timer; + atomic_t enabled; +}; + +struct iolatency_grp; + +struct child_latency_info { + spinlock_t lock; + u64 last_scale_event; + u64 scale_lat; + u64 nr_samples; + struct iolatency_grp *scale_grp; + atomic_t scale_cookie; +}; + +struct percentile_stats { + u64 total; + u64 missed; +}; + +struct latency_stat { + union { + struct percentile_stats ps; + struct blk_rq_stat rqs; + }; +}; + +struct iolatency_grp { + struct blkg_policy_data pd; + struct latency_stat *stats; + struct latency_stat cur_stat; + struct blk_iolatency *blkiolat; + struct rq_depth rq_depth; + struct rq_wait rq_wait; + atomic64_t window_start; + atomic_t scale_cookie; + u64 min_lat_nsec; + u64 cur_win_nsec; + u64 lat_avg; + u64 nr_samples; + bool ssd; + struct child_latency_info child_lat; +}; + +enum { + MILLION = 1000000, + MIN_PERIOD = 1000, + MAX_PERIOD = 1000000, + MARGIN_MIN_PCT = 10, + MARGIN_LOW_PCT = 20, + MARGIN_TARGET_PCT = 50, + INUSE_ADJ_STEP_PCT = 25, + TIMER_SLACK_PCT = 1, + WEIGHT_ONE = 65536, + VTIME_PER_SEC_SHIFT = 37, + VTIME_PER_SEC = 0, + VTIME_PER_USEC = 137438, + VTIME_PER_NSEC = 137, + VRATE_MIN_PPM = 10000, + VRATE_MAX_PPM = 100000000, + VRATE_MIN = 1374, + VRATE_CLAMP_ADJ_PCT = 4, + RQ_WAIT_BUSY_PCT = 5, + UNBUSY_THR_PCT = 75, + MIN_DELAY_THR_PCT = 500, + MAX_DELAY_THR_PCT = 25000, + MIN_DELAY = 250, + MAX_DELAY = 250000, + DFGV_USAGE_PCT = 50, + DFGV_PERIOD = 100000, + MAX_LAGGING_PERIODS = 10, + AUTOP_CYCLE_NSEC = 1410065408, + IOC_PAGE_SHIFT = 12, + IOC_PAGE_SIZE = 4096, + IOC_SECT_TO_PAGE_SHIFT = 3, + LCOEF_RANDIO_PAGES = 4096, +}; + +enum ioc_running { + IOC_IDLE = 0, + IOC_RUNNING = 1, + IOC_STOP = 2, +}; + +enum { + QOS_ENABLE = 0, + QOS_CTRL = 1, + NR_QOS_CTRL_PARAMS = 2, +}; + +enum { + QOS_RPPM = 0, + QOS_RLAT = 1, + QOS_WPPM = 2, + QOS_WLAT = 3, + QOS_MIN = 4, + QOS_MAX = 5, + NR_QOS_PARAMS = 6, +}; + +enum { + COST_CTRL = 0, + COST_MODEL = 1, + NR_COST_CTRL_PARAMS = 2, +}; + +enum { + I_LCOEF_RBPS = 0, + I_LCOEF_RSEQIOPS = 1, + I_LCOEF_RRANDIOPS = 2, + I_LCOEF_WBPS = 3, + I_LCOEF_WSEQIOPS = 4, + I_LCOEF_WRANDIOPS = 5, + NR_I_LCOEFS = 6, +}; + +enum { + LCOEF_RPAGE = 0, + LCOEF_RSEQIO = 1, + LCOEF_RRANDIO = 2, + LCOEF_WPAGE = 3, + LCOEF_WSEQIO = 4, + LCOEF_WRANDIO = 5, + NR_LCOEFS = 6, +}; + +enum { + AUTOP_INVALID = 0, + AUTOP_HDD = 1, + AUTOP_SSD_QD1 = 2, + AUTOP_SSD_DFL = 3, + AUTOP_SSD_FAST = 4, +}; + +struct ioc_params { + u32 qos[6]; + u64 i_lcoefs[6]; + u64 lcoefs[6]; + u32 too_fast_vrate_pct; + u32 too_slow_vrate_pct; +}; + +struct ioc_margins { + s64 min; + s64 low; + s64 target; +}; + +struct ioc_missed { + local_t nr_met; + local_t nr_missed; + u32 last_met; + u32 last_missed; +}; + +struct ioc_pcpu_stat { + struct ioc_missed missed[2]; + local64_t rq_wait_ns; + u64 last_rq_wait_ns; +}; + +struct ioc { + struct rq_qos rqos; + bool enabled; + struct ioc_params params; + struct ioc_margins margins; + u32 period_us; + u32 timer_slack_ns; + u64 vrate_min; + u64 vrate_max; + spinlock_t lock; + struct timer_list timer; + struct list_head active_iocgs; + struct ioc_pcpu_stat *pcpu_stat; + enum ioc_running running; + atomic64_t vtime_rate; + u64 vtime_base_rate; + s64 vtime_err; + seqcount_spinlock_t period_seqcount; + u64 period_at; + u64 period_at_vtime; + atomic64_t cur_period; + int busy_level; + bool weights_updated; + atomic_t hweight_gen; + u64 dfgv_period_at; + u64 dfgv_period_rem; + u64 dfgv_usage_us_sum; + u64 autop_too_fast_at; + u64 autop_too_slow_at; + int autop_idx; + bool user_qos_params: 1; + bool user_cost_model: 1; +}; + +struct iocg_pcpu_stat { + local64_t abs_vusage; +}; + +struct iocg_stat { + u64 usage_us; + u64 wait_us; + u64 indebt_us; + u64 indelay_us; +}; + +struct ioc_gq { + struct blkg_policy_data pd; + struct ioc *ioc; + u32 cfg_weight; + u32 weight; + u32 active; + u32 inuse; + u32 last_inuse; + s64 saved_margin; + sector_t cursor; + atomic64_t vtime; + atomic64_t done_vtime; + u64 abs_vdebt; + u64 delay; + u64 delay_at; + atomic64_t active_period; + struct list_head active_list; + u64 child_active_sum; + u64 child_inuse_sum; + u64 child_adjusted_sum; + int hweight_gen; + u32 hweight_active; + u32 hweight_inuse; + u32 hweight_donating; + u32 hweight_after_donation; + struct list_head walk_list; + struct list_head surplus_list; + struct wait_queue_head waitq; + struct hrtimer waitq_timer; + u64 activated_at; + struct iocg_pcpu_stat *pcpu_stat; + struct iocg_stat local_stat; + struct iocg_stat desc_stat; + struct iocg_stat last_stat; + u64 last_stat_abs_vusage; + u64 usage_delta_us; + u64 wait_since; + u64 indebt_since; + u64 indelay_since; + int level; + struct ioc_gq *ancestors[0]; +}; + +struct ioc_cgrp { + struct blkcg_policy_data cpd; + unsigned int dfl_weight; +}; + +struct ioc_now { + u64 now_ns; + u64 now; + u64 vnow; + u64 vrate; +}; + +struct iocg_wait { + struct wait_queue_entry wait; + struct bio *bio; + u64 abs_cost; + bool committed; +}; + +struct iocg_wake_ctx { + struct ioc_gq *iocg; + u32 hw_inuse; + s64 vbudget; +}; + +struct trace_event_raw_iocost_iocg_state { + struct trace_entry ent; + u32 __data_loc_devname; + u32 __data_loc_cgroup; + u64 now; + u64 vnow; + u64 vrate; + u64 last_period; + u64 cur_period; + u64 vtime; + u32 weight; + u32 inuse; + u64 hweight_active; + u64 hweight_inuse; + char __data[0]; +}; + +struct trace_event_raw_iocg_inuse_update { + struct trace_entry ent; + u32 __data_loc_devname; + u32 __data_loc_cgroup; + u64 now; + u32 old_inuse; + u32 new_inuse; + u64 old_hweight_inuse; + u64 new_hweight_inuse; + char __data[0]; +}; + +struct trace_event_raw_iocost_ioc_vrate_adj { + struct trace_entry ent; + u32 __data_loc_devname; + u64 old_vrate; + u64 new_vrate; + int busy_level; + u32 read_missed_ppm; + u32 write_missed_ppm; + u32 rq_wait_pct; + int nr_lagging; + int nr_shortages; + char __data[0]; +}; + +struct trace_event_raw_iocost_iocg_forgive_debt { + struct trace_entry ent; + u32 __data_loc_devname; + u32 __data_loc_cgroup; + u64 now; + u64 vnow; + u32 usage_pct; + u64 old_debt; + u64 new_debt; + u64 old_delay; + u64 new_delay; + char __data[0]; +}; + +struct trace_event_data_offsets_iocost_iocg_state { + u32 devname; + u32 cgroup; +}; + +struct trace_event_data_offsets_iocg_inuse_update { + u32 devname; + u32 cgroup; +}; + +struct trace_event_data_offsets_iocost_ioc_vrate_adj { + u32 devname; +}; + +struct trace_event_data_offsets_iocost_iocg_forgive_debt { + u32 devname; + u32 cgroup; +}; + +typedef void (*btf_trace_iocost_iocg_activate)(void *, struct ioc_gq *, const char *, struct ioc_now *, u64, u64, u64); + +typedef void (*btf_trace_iocost_iocg_idle)(void *, struct ioc_gq *, const char *, struct ioc_now *, u64, u64, u64); + +typedef void (*btf_trace_iocost_inuse_shortage)(void *, struct ioc_gq *, const char *, struct ioc_now *, u32, u32, u64, u64); + +typedef void (*btf_trace_iocost_inuse_transfer)(void *, struct ioc_gq *, const char *, struct ioc_now *, u32, u32, u64, u64); + +typedef void (*btf_trace_iocost_inuse_adjust)(void *, struct ioc_gq *, const char *, struct ioc_now *, u32, u32, u64, u64); + +typedef void (*btf_trace_iocost_ioc_vrate_adj)(void *, struct ioc *, u64, u32 *, u32, int, int); + +typedef void (*btf_trace_iocost_iocg_forgive_debt)(void *, struct ioc_gq *, const char *, struct ioc_now *, u32, u64, u64, u64, u64); + +struct deadline_data { + struct rb_root sort_list[2]; + struct list_head fifo_list[2]; + struct request *next_rq[2]; + unsigned int batching; + unsigned int starved; + int fifo_expire[2]; + int fifo_batch; + int writes_starved; + int front_merges; + spinlock_t lock; + spinlock_t zone_lock; + struct list_head dispatch; +}; + +struct trace_event_raw_kyber_latency { + struct trace_entry ent; + dev_t dev; + char domain[16]; + char type[8]; + u8 percentile; + u8 numerator; + u8 denominator; + unsigned int samples; + char __data[0]; +}; + +struct trace_event_raw_kyber_adjust { + struct trace_entry ent; + dev_t dev; + char domain[16]; + unsigned int depth; + char __data[0]; +}; + +struct trace_event_raw_kyber_throttled { + struct trace_entry ent; + dev_t dev; + char domain[16]; + char __data[0]; +}; + +struct trace_event_data_offsets_kyber_latency {}; + +struct trace_event_data_offsets_kyber_adjust {}; + +struct trace_event_data_offsets_kyber_throttled {}; + +typedef void (*btf_trace_kyber_latency)(void *, struct request_queue *, const char *, const char *, unsigned int, unsigned int, unsigned int, unsigned int); + +typedef void (*btf_trace_kyber_adjust)(void *, struct request_queue *, const char *, unsigned int); + +typedef void (*btf_trace_kyber_throttled)(void *, struct request_queue *, const char *); + +enum { + KYBER_READ = 0, + KYBER_WRITE = 1, + KYBER_DISCARD = 2, + KYBER_OTHER = 3, + KYBER_NUM_DOMAINS = 4, +}; + +enum { + KYBER_ASYNC_PERCENT = 75, +}; + +enum { + KYBER_LATENCY_SHIFT = 2, + KYBER_GOOD_BUCKETS = 4, + KYBER_LATENCY_BUCKETS = 8, +}; + +enum { + KYBER_TOTAL_LATENCY = 0, + KYBER_IO_LATENCY = 1, +}; + +struct kyber_cpu_latency { + atomic_t buckets[48]; +}; + +struct kyber_ctx_queue { + spinlock_t lock; + struct list_head rq_list[4]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct kyber_queue_data { + struct request_queue *q; + struct sbitmap_queue domain_tokens[4]; + unsigned int async_depth; + struct kyber_cpu_latency *cpu_latency; + struct timer_list timer; + unsigned int latency_buckets[48]; + long unsigned int latency_timeout[3]; + int domain_p99[3]; + u64 latency_targets[3]; +}; + +struct kyber_hctx_data { + spinlock_t lock; + struct list_head rqs[4]; + unsigned int cur_domain; + unsigned int batching; + struct kyber_ctx_queue *kcqs; + struct sbitmap kcq_map[4]; + struct sbq_wait domain_wait[4]; + struct sbq_wait_state *domain_ws[4]; + atomic_t wait_index[4]; +}; + +struct flush_kcq_data { + struct kyber_hctx_data *khd; + unsigned int sched_domain; + struct list_head *list; +}; + +struct bfq_entity; + +struct bfq_service_tree { + struct rb_root active; + struct rb_root idle; + struct bfq_entity *first_idle; + struct bfq_entity *last_idle; + u64 vtime; + long unsigned int wsum; +}; + +struct bfq_sched_data; + +struct bfq_entity { + struct rb_node rb_node; + bool on_st_or_in_serv; + u64 start; + u64 finish; + struct rb_root *tree; + u64 min_start; + int service; + int budget; + int dev_weight; + int weight; + int new_weight; + int orig_weight; + struct bfq_entity *parent; + struct bfq_sched_data *my_sched_data; + struct bfq_sched_data *sched_data; + int prio_changed; + bool in_groups_with_pending_reqs; +}; + +struct bfq_sched_data { + struct bfq_entity *in_service_entity; + struct bfq_entity *next_in_service; + struct bfq_service_tree service_tree[3]; + long unsigned int bfq_class_idle_last_service; +}; + +struct bfq_weight_counter { + unsigned int weight; + unsigned int num_active; + struct rb_node weights_node; +}; + +struct bfq_ttime { + u64 last_end_request; + u64 ttime_total; + long unsigned int ttime_samples; + u64 ttime_mean; +}; + +struct bfq_data; + +struct bfq_io_cq; + +struct bfq_queue { + int ref; + struct bfq_data *bfqd; + short unsigned int ioprio; + short unsigned int ioprio_class; + short unsigned int new_ioprio; + short unsigned int new_ioprio_class; + u64 last_serv_time_ns; + unsigned int inject_limit; + long unsigned int decrease_time_jif; + struct bfq_queue *new_bfqq; + struct rb_node pos_node; + struct rb_root *pos_root; + struct rb_root sort_list; + struct request *next_rq; + int queued[2]; + int allocated; + int meta_pending; + struct list_head fifo; + struct bfq_entity entity; + struct bfq_weight_counter *weight_counter; + int max_budget; + long unsigned int budget_timeout; + int dispatched; + long unsigned int flags; + struct list_head bfqq_list; + struct bfq_ttime ttime; + u32 seek_history; + struct hlist_node burst_list_node; + sector_t last_request_pos; + unsigned int requests_within_timer; + pid_t pid; + struct bfq_io_cq *bic; + long unsigned int wr_cur_max_time; + long unsigned int soft_rt_next_start; + long unsigned int last_wr_start_finish; + unsigned int wr_coeff; + long unsigned int last_idle_bklogged; + long unsigned int service_from_backlogged; + long unsigned int service_from_wr; + long unsigned int wr_start_at_switch_to_srt; + long unsigned int split_time; + long unsigned int first_IO_time; + u32 max_service_rate; + struct bfq_queue *waker_bfqq; + struct hlist_node woken_list_node; + struct hlist_head woken_list; +}; + +struct bfq_group; + +struct bfq_data { + struct request_queue *queue; + struct list_head dispatch; + struct bfq_group *root_group; + struct rb_root_cached queue_weights_tree; + unsigned int num_groups_with_pending_reqs; + unsigned int busy_queues[3]; + int wr_busy_queues; + int queued; + int rq_in_driver; + bool nonrot_with_queueing; + int max_rq_in_driver; + int hw_tag_samples; + int hw_tag; + int budgets_assigned; + struct hrtimer idle_slice_timer; + struct bfq_queue *in_service_queue; + sector_t last_position; + sector_t in_serv_last_pos; + u64 last_completion; + struct bfq_queue *last_completed_rq_bfqq; + u64 last_empty_occupied_ns; + bool wait_dispatch; + struct request *waited_rq; + bool rqs_injected; + u64 first_dispatch; + u64 last_dispatch; + ktime_t last_budget_start; + ktime_t last_idling_start; + long unsigned int last_idling_start_jiffies; + int peak_rate_samples; + u32 sequential_samples; + u64 tot_sectors_dispatched; + u32 last_rq_max_size; + u64 delta_from_first; + u32 peak_rate; + int bfq_max_budget; + struct list_head active_list; + struct list_head idle_list; + u64 bfq_fifo_expire[2]; + unsigned int bfq_back_penalty; + unsigned int bfq_back_max; + u32 bfq_slice_idle; + int bfq_user_max_budget; + unsigned int bfq_timeout; + unsigned int bfq_requests_within_timer; + bool strict_guarantees; + long unsigned int last_ins_in_burst; + long unsigned int bfq_burst_interval; + int burst_size; + struct bfq_entity *burst_parent_entity; + long unsigned int bfq_large_burst_thresh; + bool large_burst; + struct hlist_head burst_list; + bool low_latency; + unsigned int bfq_wr_coeff; + unsigned int bfq_wr_max_time; + unsigned int bfq_wr_rt_max_time; + unsigned int bfq_wr_min_idle_time; + long unsigned int bfq_wr_min_inter_arr_async; + unsigned int bfq_wr_max_softrt_rate; + u64 rate_dur_prod; + struct bfq_queue oom_bfqq; + spinlock_t lock; + struct bfq_io_cq *bio_bic; + struct bfq_queue *bio_bfqq; + unsigned int word_depths[4]; +}; + +struct bfq_io_cq { + struct io_cq icq; + struct bfq_queue *bfqq[2]; + int ioprio; + uint64_t blkcg_serial_nr; + bool saved_has_short_ttime; + bool saved_IO_bound; + bool saved_in_large_burst; + bool was_in_burst_list; + unsigned int saved_weight; + long unsigned int saved_wr_coeff; + long unsigned int saved_last_wr_start_finish; + long unsigned int saved_wr_start_at_switch_to_srt; + unsigned int saved_wr_cur_max_time; + struct bfq_ttime saved_ttime; +}; + +struct bfqg_stats { + struct blkg_rwstat bytes; + struct blkg_rwstat ios; +}; + +struct bfq_group { + struct blkg_policy_data pd; + char blkg_path[128]; + int ref; + struct bfq_entity entity; + struct bfq_sched_data sched_data; + void *bfqd; + struct bfq_queue *async_bfqq[16]; + struct bfq_queue *async_idle_bfqq; + struct bfq_entity *my_entity; + int active_entities; + struct rb_root rq_pos_tree; + struct bfqg_stats stats; +}; + +enum bfqq_state_flags { + BFQQF_just_created = 0, + BFQQF_busy = 1, + BFQQF_wait_request = 2, + BFQQF_non_blocking_wait_rq = 3, + BFQQF_fifo_expire = 4, + BFQQF_has_short_ttime = 5, + BFQQF_sync = 6, + BFQQF_IO_bound = 7, + BFQQF_in_large_burst = 8, + BFQQF_softrt_update = 9, + BFQQF_coop = 10, + BFQQF_split_coop = 11, + BFQQF_has_waker = 12, +}; + +enum bfqq_expiration { + BFQQE_TOO_IDLE = 0, + BFQQE_BUDGET_TIMEOUT = 1, + BFQQE_BUDGET_EXHAUSTED = 2, + BFQQE_NO_MORE_REQUESTS = 3, + BFQQE_PREEMPTED = 4, +}; + +struct bfq_group_data { + struct blkcg_policy_data pd; + unsigned int weight; +}; + +enum bip_flags { + BIP_BLOCK_INTEGRITY = 1, + BIP_MAPPED_INTEGRITY = 2, + BIP_CTRL_NOCHECK = 4, + BIP_DISK_NOCHECK = 8, + BIP_IP_CHECKSUM = 16, +}; + +enum blk_integrity_flags { + BLK_INTEGRITY_VERIFY = 1, + BLK_INTEGRITY_GENERATE = 2, + BLK_INTEGRITY_DEVICE_CAPABLE = 4, + BLK_INTEGRITY_IP_CHECKSUM = 8, +}; + +struct integrity_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct blk_integrity *, char *); + ssize_t (*store)(struct blk_integrity *, const char *, size_t); +}; + +enum t10_dif_type { + T10_PI_TYPE0_PROTECTION = 0, + T10_PI_TYPE1_PROTECTION = 1, + T10_PI_TYPE2_PROTECTION = 2, + T10_PI_TYPE3_PROTECTION = 3, +}; + +struct t10_pi_tuple { + __be16 guard_tag; + __be16 app_tag; + __be32 ref_tag; +}; + +typedef __be16 csum_fn(void *, unsigned int); + +struct virtio_device_id { + __u32 device; + __u32 vendor; +}; + +struct virtio_device; + +struct virtqueue { + struct list_head list; + void (*callback)(struct virtqueue *); + const char *name; + struct virtio_device *vdev; + unsigned int index; + unsigned int num_free; + void *priv; +}; + +struct vringh_config_ops; + +struct virtio_config_ops; + +struct virtio_device { + int index; + bool failed; + bool config_enabled; + bool config_change_pending; + spinlock_t config_lock; + struct device dev; + struct virtio_device_id id; + const struct virtio_config_ops *config; + const struct vringh_config_ops *vringh_config; + struct list_head vqs; + u64 features; + void *priv; +}; + +typedef void vq_callback_t(struct virtqueue *); + +struct virtio_shm_region; + +struct virtio_config_ops { + void (*get)(struct virtio_device *, unsigned int, void *, unsigned int); + void (*set)(struct virtio_device *, unsigned int, const void *, unsigned int); + u32 (*generation)(struct virtio_device *); + u8 (*get_status)(struct virtio_device *); + void (*set_status)(struct virtio_device *, u8); + void (*reset)(struct virtio_device *); + int (*find_vqs)(struct virtio_device *, unsigned int, struct virtqueue **, vq_callback_t **, const char * const *, const bool *, struct irq_affinity *); + void (*del_vqs)(struct virtio_device *); + u64 (*get_features)(struct virtio_device *); + int (*finalize_features)(struct virtio_device *); + const char * (*bus_name)(struct virtio_device *); + int (*set_vq_affinity)(struct virtqueue *, const struct cpumask *); + const struct cpumask * (*get_vq_affinity)(struct virtio_device *, int); + bool (*get_shm_region)(struct virtio_device *, struct virtio_shm_region *, u8); +}; + +struct virtio_shm_region { + u64 addr; + u64 len; +}; + +struct irq_poll; + +typedef int irq_poll_fn(struct irq_poll *, int); + +struct irq_poll { + struct list_head list; + long unsigned int state; + int weight; + irq_poll_fn *poll; +}; + +struct dim_sample { + ktime_t time; + u32 pkt_ctr; + u32 byte_ctr; + u16 event_ctr; + u32 comp_ctr; +}; + +struct dim_stats { + int ppms; + int bpms; + int epms; + int cpms; + int cpe_ratio; +}; + +struct dim { + u8 state; + struct dim_stats prev_stats; + struct dim_sample start_sample; + struct dim_sample measuring_sample; + struct work_struct work; + void *priv; + u8 profile_ix; + u8 mode; + u8 tune_state; + u8 steps_right; + u8 steps_left; + u8 tired; +}; + +enum rdma_nl_counter_mode { + RDMA_COUNTER_MODE_NONE = 0, + RDMA_COUNTER_MODE_AUTO = 1, + RDMA_COUNTER_MODE_MANUAL = 2, + RDMA_COUNTER_MODE_MAX = 3, +}; + +enum rdma_nl_counter_mask { + RDMA_COUNTER_MASK_QP_TYPE = 1, + RDMA_COUNTER_MASK_PID = 2, +}; + +enum rdma_restrack_type { + RDMA_RESTRACK_PD = 0, + RDMA_RESTRACK_CQ = 1, + RDMA_RESTRACK_QP = 2, + RDMA_RESTRACK_CM_ID = 3, + RDMA_RESTRACK_MR = 4, + RDMA_RESTRACK_CTX = 5, + RDMA_RESTRACK_COUNTER = 6, + RDMA_RESTRACK_MAX = 7, +}; + +struct rdma_restrack_entry { + bool valid; + u8 no_track: 1; + struct kref kref; + struct completion comp; + struct task_struct *task; + const char *kern_name; + enum rdma_restrack_type type; + bool user; + u32 id; +}; + +struct rdma_link_ops { + struct list_head list; + const char *type; + int (*newlink)(const char *, struct net_device *); +}; + +struct auto_mode_param { + int qp_type; +}; + +struct rdma_counter_mode { + enum rdma_nl_counter_mode mode; + enum rdma_nl_counter_mask mask; + struct auto_mode_param param; +}; + +struct rdma_hw_stats; + +struct rdma_port_counter { + struct rdma_counter_mode mode; + struct rdma_hw_stats *hstats; + unsigned int num_counters; + struct mutex lock; +}; + +struct rdma_hw_stats { + struct mutex lock; + long unsigned int timestamp; + long unsigned int lifespan; + const char * const *names; + int num_counters; + u64 value[0]; +}; + +struct ib_device; + +struct rdma_counter { + struct rdma_restrack_entry res; + struct ib_device *device; + uint32_t id; + struct kref kref; + struct rdma_counter_mode mode; + struct mutex lock; + struct rdma_hw_stats *stats; + u8 port; +}; + +enum rdma_driver_id { + RDMA_DRIVER_UNKNOWN = 0, + RDMA_DRIVER_MLX5 = 1, + RDMA_DRIVER_MLX4 = 2, + RDMA_DRIVER_CXGB3 = 3, + RDMA_DRIVER_CXGB4 = 4, + RDMA_DRIVER_MTHCA = 5, + RDMA_DRIVER_BNXT_RE = 6, + RDMA_DRIVER_OCRDMA = 7, + RDMA_DRIVER_NES = 8, + RDMA_DRIVER_I40IW = 9, + RDMA_DRIVER_VMW_PVRDMA = 10, + RDMA_DRIVER_QEDR = 11, + RDMA_DRIVER_HNS = 12, + RDMA_DRIVER_USNIC = 13, + RDMA_DRIVER_RXE = 14, + RDMA_DRIVER_HFI1 = 15, + RDMA_DRIVER_QIB = 16, + RDMA_DRIVER_EFA = 17, + RDMA_DRIVER_SIW = 18, +}; + +enum ib_cq_notify_flags { + IB_CQ_SOLICITED = 1, + IB_CQ_NEXT_COMP = 2, + IB_CQ_SOLICITED_MASK = 3, + IB_CQ_REPORT_MISSED_EVENTS = 4, +}; + +struct ib_mad; + +enum rdma_link_layer { + IB_LINK_LAYER_UNSPECIFIED = 0, + IB_LINK_LAYER_INFINIBAND = 1, + IB_LINK_LAYER_ETHERNET = 2, +}; + +enum rdma_netdev_t { + RDMA_NETDEV_OPA_VNIC = 0, + RDMA_NETDEV_IPOIB = 1, +}; + +enum ib_srq_attr_mask { + IB_SRQ_MAX_WR = 1, + IB_SRQ_LIMIT = 2, +}; + +enum ib_mr_type { + IB_MR_TYPE_MEM_REG = 0, + IB_MR_TYPE_SG_GAPS = 1, + IB_MR_TYPE_DM = 2, + IB_MR_TYPE_USER = 3, + IB_MR_TYPE_DMA = 4, + IB_MR_TYPE_INTEGRITY = 5, +}; + +enum ib_uverbs_advise_mr_advice { + IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH = 0, + IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE = 1, + IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_NO_FAULT = 2, +}; + +struct uverbs_attr_bundle; + +struct rdma_cm_id; + +struct iw_cm_id; + +struct iw_cm_conn_param; + +struct ib_qp; + +struct ib_send_wr; + +struct ib_recv_wr; + +struct ib_cq; + +struct ib_wc; + +struct ib_srq; + +struct ib_grh; + +struct ib_device_attr; + +struct ib_udata; + +struct ib_device_modify; + +struct ib_port_attr; + +struct ib_port_modify; + +struct ib_port_immutable; + +struct rdma_netdev_alloc_params; + +union ib_gid; + +struct ib_gid_attr; + +struct ib_ucontext; + +struct rdma_user_mmap_entry; + +struct ib_pd; + +struct ib_ah; + +struct rdma_ah_init_attr; + +struct rdma_ah_attr; + +struct ib_srq_init_attr; + +struct ib_srq_attr; + +struct ib_qp_init_attr; + +struct ib_qp_attr; + +struct ib_cq_init_attr; + +struct ib_mr; + +struct ib_sge; + +struct ib_mr_status; + +struct ib_mw; + +struct ib_xrcd; + +struct ib_flow; + +struct ib_flow_attr; + +struct ib_flow_action; + +struct ib_flow_action_attrs_esp; + +struct ib_wq; + +struct ib_wq_init_attr; + +struct ib_wq_attr; + +struct ib_rwq_ind_table; + +struct ib_rwq_ind_table_init_attr; + +struct ib_dm; + +struct ib_dm_alloc_attr; + +struct ib_dm_mr_attr; + +struct ib_counters; + +struct ib_counters_read_attr; + +struct ib_device_ops { + struct module *owner; + enum rdma_driver_id driver_id; + u32 uverbs_abi_ver; + unsigned int uverbs_no_driver_id_binding: 1; + int (*post_send)(struct ib_qp *, const struct ib_send_wr *, const struct ib_send_wr **); + int (*post_recv)(struct ib_qp *, const struct ib_recv_wr *, const struct ib_recv_wr **); + void (*drain_rq)(struct ib_qp *); + void (*drain_sq)(struct ib_qp *); + int (*poll_cq)(struct ib_cq *, int, struct ib_wc *); + int (*peek_cq)(struct ib_cq *, int); + int (*req_notify_cq)(struct ib_cq *, enum ib_cq_notify_flags); + int (*req_ncomp_notif)(struct ib_cq *, int); + int (*post_srq_recv)(struct ib_srq *, const struct ib_recv_wr *, const struct ib_recv_wr **); + int (*process_mad)(struct ib_device *, int, u8, const struct ib_wc *, const struct ib_grh *, const struct ib_mad *, struct ib_mad *, size_t *, u16 *); + int (*query_device)(struct ib_device *, struct ib_device_attr *, struct ib_udata *); + int (*modify_device)(struct ib_device *, int, struct ib_device_modify *); + void (*get_dev_fw_str)(struct ib_device *, char *); + const struct cpumask * (*get_vector_affinity)(struct ib_device *, int); + int (*query_port)(struct ib_device *, u8, struct ib_port_attr *); + int (*modify_port)(struct ib_device *, u8, int, struct ib_port_modify *); + int (*get_port_immutable)(struct ib_device *, u8, struct ib_port_immutable *); + enum rdma_link_layer (*get_link_layer)(struct ib_device *, u8); + struct net_device * (*get_netdev)(struct ib_device *, u8); + struct net_device * (*alloc_rdma_netdev)(struct ib_device *, u8, enum rdma_netdev_t, const char *, unsigned char, void (*)(struct net_device *)); + int (*rdma_netdev_get_params)(struct ib_device *, u8, enum rdma_netdev_t, struct rdma_netdev_alloc_params *); + int (*query_gid)(struct ib_device *, u8, int, union ib_gid *); + int (*add_gid)(const struct ib_gid_attr *, void **); + int (*del_gid)(const struct ib_gid_attr *, void **); + int (*query_pkey)(struct ib_device *, u8, u16, u16 *); + int (*alloc_ucontext)(struct ib_ucontext *, struct ib_udata *); + void (*dealloc_ucontext)(struct ib_ucontext *); + int (*mmap)(struct ib_ucontext *, struct vm_area_struct *); + void (*mmap_free)(struct rdma_user_mmap_entry *); + void (*disassociate_ucontext)(struct ib_ucontext *); + int (*alloc_pd)(struct ib_pd *, struct ib_udata *); + int (*dealloc_pd)(struct ib_pd *, struct ib_udata *); + int (*create_ah)(struct ib_ah *, struct rdma_ah_init_attr *, struct ib_udata *); + int (*create_user_ah)(struct ib_ah *, struct rdma_ah_init_attr *, struct ib_udata *); + int (*modify_ah)(struct ib_ah *, struct rdma_ah_attr *); + int (*query_ah)(struct ib_ah *, struct rdma_ah_attr *); + int (*destroy_ah)(struct ib_ah *, u32); + int (*create_srq)(struct ib_srq *, struct ib_srq_init_attr *, struct ib_udata *); + int (*modify_srq)(struct ib_srq *, struct ib_srq_attr *, enum ib_srq_attr_mask, struct ib_udata *); + int (*query_srq)(struct ib_srq *, struct ib_srq_attr *); + int (*destroy_srq)(struct ib_srq *, struct ib_udata *); + struct ib_qp * (*create_qp)(struct ib_pd *, struct ib_qp_init_attr *, struct ib_udata *); + int (*modify_qp)(struct ib_qp *, struct ib_qp_attr *, int, struct ib_udata *); + int (*query_qp)(struct ib_qp *, struct ib_qp_attr *, int, struct ib_qp_init_attr *); + int (*destroy_qp)(struct ib_qp *, struct ib_udata *); + int (*create_cq)(struct ib_cq *, const struct ib_cq_init_attr *, struct ib_udata *); + int (*modify_cq)(struct ib_cq *, u16, u16); + int (*destroy_cq)(struct ib_cq *, struct ib_udata *); + int (*resize_cq)(struct ib_cq *, int, struct ib_udata *); + struct ib_mr * (*get_dma_mr)(struct ib_pd *, int); + struct ib_mr * (*reg_user_mr)(struct ib_pd *, u64, u64, u64, int, struct ib_udata *); + struct ib_mr * (*rereg_user_mr)(struct ib_mr *, int, u64, u64, u64, int, struct ib_pd *, struct ib_udata *); + int (*dereg_mr)(struct ib_mr *, struct ib_udata *); + struct ib_mr * (*alloc_mr)(struct ib_pd *, enum ib_mr_type, u32); + struct ib_mr * (*alloc_mr_integrity)(struct ib_pd *, u32, u32); + int (*advise_mr)(struct ib_pd *, enum ib_uverbs_advise_mr_advice, u32, struct ib_sge *, u32, struct uverbs_attr_bundle *); + int (*map_mr_sg)(struct ib_mr *, struct scatterlist *, int, unsigned int *); + int (*check_mr_status)(struct ib_mr *, u32, struct ib_mr_status *); + int (*alloc_mw)(struct ib_mw *, struct ib_udata *); + int (*dealloc_mw)(struct ib_mw *); + int (*attach_mcast)(struct ib_qp *, union ib_gid *, u16); + int (*detach_mcast)(struct ib_qp *, union ib_gid *, u16); + int (*alloc_xrcd)(struct ib_xrcd *, struct ib_udata *); + int (*dealloc_xrcd)(struct ib_xrcd *, struct ib_udata *); + struct ib_flow * (*create_flow)(struct ib_qp *, struct ib_flow_attr *, struct ib_udata *); + int (*destroy_flow)(struct ib_flow *); + struct ib_flow_action * (*create_flow_action_esp)(struct ib_device *, const struct ib_flow_action_attrs_esp *, struct uverbs_attr_bundle *); + int (*destroy_flow_action)(struct ib_flow_action *); + int (*modify_flow_action_esp)(struct ib_flow_action *, const struct ib_flow_action_attrs_esp *, struct uverbs_attr_bundle *); + int (*set_vf_link_state)(struct ib_device *, int, u8, int); + int (*get_vf_config)(struct ib_device *, int, u8, struct ifla_vf_info *); + int (*get_vf_stats)(struct ib_device *, int, u8, struct ifla_vf_stats *); + int (*get_vf_guid)(struct ib_device *, int, u8, struct ifla_vf_guid *, struct ifla_vf_guid *); + int (*set_vf_guid)(struct ib_device *, int, u8, u64, int); + struct ib_wq * (*create_wq)(struct ib_pd *, struct ib_wq_init_attr *, struct ib_udata *); + int (*destroy_wq)(struct ib_wq *, struct ib_udata *); + int (*modify_wq)(struct ib_wq *, struct ib_wq_attr *, u32, struct ib_udata *); + int (*create_rwq_ind_table)(struct ib_rwq_ind_table *, struct ib_rwq_ind_table_init_attr *, struct ib_udata *); + int (*destroy_rwq_ind_table)(struct ib_rwq_ind_table *); + struct ib_dm * (*alloc_dm)(struct ib_device *, struct ib_ucontext *, struct ib_dm_alloc_attr *, struct uverbs_attr_bundle *); + int (*dealloc_dm)(struct ib_dm *, struct uverbs_attr_bundle *); + struct ib_mr * (*reg_dm_mr)(struct ib_pd *, struct ib_dm *, struct ib_dm_mr_attr *, struct uverbs_attr_bundle *); + int (*create_counters)(struct ib_counters *, struct uverbs_attr_bundle *); + int (*destroy_counters)(struct ib_counters *); + int (*read_counters)(struct ib_counters *, struct ib_counters_read_attr *, struct uverbs_attr_bundle *); + int (*map_mr_sg_pi)(struct ib_mr *, struct scatterlist *, int, unsigned int *, struct scatterlist *, int, unsigned int *); + struct rdma_hw_stats * (*alloc_hw_stats)(struct ib_device *, u8); + int (*get_hw_stats)(struct ib_device *, struct rdma_hw_stats *, u8, int); + int (*init_port)(struct ib_device *, u8, struct kobject *); + int (*fill_res_mr_entry)(struct sk_buff *, struct ib_mr *); + int (*fill_res_mr_entry_raw)(struct sk_buff *, struct ib_mr *); + int (*fill_res_cq_entry)(struct sk_buff *, struct ib_cq *); + int (*fill_res_cq_entry_raw)(struct sk_buff *, struct ib_cq *); + int (*fill_res_qp_entry)(struct sk_buff *, struct ib_qp *); + int (*fill_res_qp_entry_raw)(struct sk_buff *, struct ib_qp *); + int (*fill_res_cm_id_entry)(struct sk_buff *, struct rdma_cm_id *); + int (*enable_driver)(struct ib_device *); + void (*dealloc_driver)(struct ib_device *); + void (*iw_add_ref)(struct ib_qp *); + void (*iw_rem_ref)(struct ib_qp *); + struct ib_qp * (*iw_get_qp)(struct ib_device *, int); + int (*iw_connect)(struct iw_cm_id *, struct iw_cm_conn_param *); + int (*iw_accept)(struct iw_cm_id *, struct iw_cm_conn_param *); + int (*iw_reject)(struct iw_cm_id *, const void *, u8); + int (*iw_create_listen)(struct iw_cm_id *, int); + int (*iw_destroy_listen)(struct iw_cm_id *); + int (*counter_bind_qp)(struct rdma_counter *, struct ib_qp *); + int (*counter_unbind_qp)(struct ib_qp *); + int (*counter_dealloc)(struct rdma_counter *); + struct rdma_hw_stats * (*counter_alloc_stats)(struct rdma_counter *); + int (*counter_update_stats)(struct rdma_counter *); + int (*fill_stat_mr_entry)(struct sk_buff *, struct ib_mr *); + int (*query_ucontext)(struct ib_ucontext *, struct uverbs_attr_bundle *); + size_t size_ib_ah; + size_t size_ib_counters; + size_t size_ib_cq; + size_t size_ib_mw; + size_t size_ib_pd; + size_t size_ib_rwq_ind_table; + size_t size_ib_srq; + size_t size_ib_ucontext; + size_t size_ib_xrcd; +}; + +struct ib_core_device { + struct device dev; + possible_net_t rdma_net; + struct kobject *ports_kobj; + struct list_head port_list; + struct ib_device *owner; +}; + +enum ib_atomic_cap { + IB_ATOMIC_NONE = 0, + IB_ATOMIC_HCA = 1, + IB_ATOMIC_GLOB = 2, +}; + +struct ib_odp_caps { + uint64_t general_caps; + struct { + uint32_t rc_odp_caps; + uint32_t uc_odp_caps; + uint32_t ud_odp_caps; + uint32_t xrc_odp_caps; + } per_transport_caps; +}; + +struct ib_rss_caps { + u32 supported_qpts; + u32 max_rwq_indirection_tables; + u32 max_rwq_indirection_table_size; +}; + +struct ib_tm_caps { + u32 max_rndv_hdr_size; + u32 max_num_tags; + u32 flags; + u32 max_ops; + u32 max_sge; +}; + +struct ib_cq_caps { + u16 max_cq_moderation_count; + u16 max_cq_moderation_period; +}; + +struct ib_device_attr { + u64 fw_ver; + __be64 sys_image_guid; + u64 max_mr_size; + u64 page_size_cap; + u32 vendor_id; + u32 vendor_part_id; + u32 hw_ver; + int max_qp; + int max_qp_wr; + u64 device_cap_flags; + int max_send_sge; + int max_recv_sge; + int max_sge_rd; + int max_cq; + int max_cqe; + int max_mr; + int max_pd; + int max_qp_rd_atom; + int max_ee_rd_atom; + int max_res_rd_atom; + int max_qp_init_rd_atom; + int max_ee_init_rd_atom; + enum ib_atomic_cap atomic_cap; + enum ib_atomic_cap masked_atomic_cap; + int max_ee; + int max_rdd; + int max_mw; + int max_raw_ipv6_qp; + int max_raw_ethy_qp; + int max_mcast_grp; + int max_mcast_qp_attach; + int max_total_mcast_qp_attach; + int max_ah; + int max_srq; + int max_srq_wr; + int max_srq_sge; + unsigned int max_fast_reg_page_list_len; + unsigned int max_pi_fast_reg_page_list_len; + u16 max_pkeys; + u8 local_ca_ack_delay; + int sig_prot_cap; + int sig_guard_cap; + struct ib_odp_caps odp_caps; + uint64_t timestamp_mask; + uint64_t hca_core_clock; + struct ib_rss_caps rss_caps; + u32 max_wq_type_rq; + u32 raw_packet_caps; + struct ib_tm_caps tm_caps; + struct ib_cq_caps cq_caps; + u64 max_dm_size; + u32 max_sgl_rd; +}; + +struct rdma_restrack_root; + +struct uapi_definition; + +struct ib_port_data; + +struct ib_device { + struct device *dma_device; + struct ib_device_ops ops; + char name[64]; + struct callback_head callback_head; + struct list_head event_handler_list; + struct rw_semaphore event_handler_rwsem; + spinlock_t qp_open_list_lock; + struct rw_semaphore client_data_rwsem; + struct xarray client_data; + struct mutex unregistration_lock; + rwlock_t cache_lock; + struct ib_port_data *port_data; + int num_comp_vectors; + union { + struct device dev; + struct ib_core_device coredev; + }; + const struct attribute_group *groups[3]; + u64 uverbs_cmd_mask; + char node_desc[64]; + __be64 node_guid; + u32 local_dma_lkey; + u16 is_switch: 1; + u16 kverbs_provider: 1; + u16 use_cq_dim: 1; + u8 node_type; + u8 phys_port_cnt; + struct ib_device_attr attrs; + struct attribute_group *hw_stats_ag; + struct rdma_hw_stats *hw_stats; + u32 index; + spinlock_t cq_pools_lock; + struct list_head cq_pools[3]; + struct rdma_restrack_root *res; + const struct uapi_definition *driver_def; + refcount_t refcount; + struct completion unreg_completion; + struct work_struct unregistration_work; + const struct rdma_link_ops *link_ops; + struct mutex compat_devs_mutex; + struct xarray compat_devs; + char iw_ifname[16]; + u32 iw_driver_flags; + u32 lag_flags; +}; + +enum ib_signature_type { + IB_SIG_TYPE_NONE = 0, + IB_SIG_TYPE_T10_DIF = 1, +}; + +enum ib_t10_dif_bg_type { + IB_T10DIF_CRC = 0, + IB_T10DIF_CSUM = 1, +}; + +struct ib_t10_dif_domain { + enum ib_t10_dif_bg_type bg_type; + u16 pi_interval; + u16 bg; + u16 app_tag; + u32 ref_tag; + bool ref_remap; + bool app_escape; + bool ref_escape; + u16 apptag_check_mask; +}; + +struct ib_sig_domain { + enum ib_signature_type sig_type; + union { + struct ib_t10_dif_domain dif; + } sig; +}; + +struct ib_sig_attrs { + u8 check_mask; + struct ib_sig_domain mem; + struct ib_sig_domain wire; + int meta_length; +}; + +enum ib_sig_err_type { + IB_SIG_BAD_GUARD = 0, + IB_SIG_BAD_REFTAG = 1, + IB_SIG_BAD_APPTAG = 2, +}; + +struct ib_sig_err { + enum ib_sig_err_type err_type; + u32 expected; + u32 actual; + u64 sig_err_offset; + u32 key; +}; + +enum ib_uverbs_flow_action_esp_keymat { + IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM = 0, +}; + +struct ib_uverbs_flow_action_esp_keymat_aes_gcm { + __u64 iv; + __u32 iv_algo; + __u32 salt; + __u32 icv_len; + __u32 key_len; + __u32 aes_key[8]; +}; + +enum ib_uverbs_flow_action_esp_replay { + IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE = 0, + IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP = 1, +}; + +struct ib_uverbs_flow_action_esp_replay_bmp { + __u32 size; +}; + +union ib_gid { + u8 raw[16]; + struct { + __be64 subnet_prefix; + __be64 interface_id; + } global; +}; + +enum ib_gid_type { + IB_GID_TYPE_IB = 0, + IB_GID_TYPE_ROCE = 1, + IB_GID_TYPE_ROCE_UDP_ENCAP = 2, + IB_GID_TYPE_SIZE = 3, +}; + +struct ib_gid_attr { + struct net_device *ndev; + struct ib_device *device; + union ib_gid gid; + enum ib_gid_type gid_type; + u16 index; + u8 port_num; +}; + +struct ib_cq_init_attr { + unsigned int cqe; + u32 comp_vector; + u32 flags; +}; + +struct ib_dm_mr_attr { + u64 length; + u64 offset; + u32 access_flags; +}; + +struct ib_dm_alloc_attr { + u64 length; + u32 alignment; + u32 flags; +}; + +enum ib_mtu { + IB_MTU_256 = 1, + IB_MTU_512 = 2, + IB_MTU_1024 = 3, + IB_MTU_2048 = 4, + IB_MTU_4096 = 5, +}; + +enum ib_port_state { + IB_PORT_NOP = 0, + IB_PORT_DOWN = 1, + IB_PORT_INIT = 2, + IB_PORT_ARMED = 3, + IB_PORT_ACTIVE = 4, + IB_PORT_ACTIVE_DEFER = 5, +}; + +struct ib_port_attr { + u64 subnet_prefix; + enum ib_port_state state; + enum ib_mtu max_mtu; + enum ib_mtu active_mtu; + u32 phys_mtu; + int gid_tbl_len; + unsigned int ip_gids: 1; + u32 port_cap_flags; + u32 max_msg_sz; + u32 bad_pkey_cntr; + u32 qkey_viol_cntr; + u16 pkey_tbl_len; + u32 sm_lid; + u32 lid; + u8 lmc; + u8 max_vl_num; + u8 sm_sl; + u8 subnet_timeout; + u8 init_type_reply; + u8 active_width; + u16 active_speed; + u8 phys_state; + u16 port_cap_flags2; +}; + +struct ib_device_modify { + u64 sys_image_guid; + char node_desc[64]; +}; + +struct ib_port_modify { + u32 set_port_cap_mask; + u32 clr_port_cap_mask; + u8 init_type; +}; + +enum ib_event_type { + IB_EVENT_CQ_ERR = 0, + IB_EVENT_QP_FATAL = 1, + IB_EVENT_QP_REQ_ERR = 2, + IB_EVENT_QP_ACCESS_ERR = 3, + IB_EVENT_COMM_EST = 4, + IB_EVENT_SQ_DRAINED = 5, + IB_EVENT_PATH_MIG = 6, + IB_EVENT_PATH_MIG_ERR = 7, + IB_EVENT_DEVICE_FATAL = 8, + IB_EVENT_PORT_ACTIVE = 9, + IB_EVENT_PORT_ERR = 10, + IB_EVENT_LID_CHANGE = 11, + IB_EVENT_PKEY_CHANGE = 12, + IB_EVENT_SM_CHANGE = 13, + IB_EVENT_SRQ_ERR = 14, + IB_EVENT_SRQ_LIMIT_REACHED = 15, + IB_EVENT_QP_LAST_WQE_REACHED = 16, + IB_EVENT_CLIENT_REREGISTER = 17, + IB_EVENT_GID_CHANGE = 18, + IB_EVENT_WQ_FATAL = 19, +}; + +struct ib_ucq_object; + +typedef void (*ib_comp_handler)(struct ib_cq *, void *); + +struct ib_event; + +struct ib_cq { + struct ib_device *device; + struct ib_ucq_object *uobject; + ib_comp_handler comp_handler; + void (*event_handler)(struct ib_event *, void *); + void *cq_context; + int cqe; + unsigned int cqe_used; + atomic_t usecnt; + enum ib_poll_context poll_ctx; + struct ib_wc *wc; + struct list_head pool_entry; + union { + struct irq_poll iop; + struct work_struct work; + }; + struct workqueue_struct *comp_wq; + struct dim *dim; + ktime_t timestamp; + u8 interrupt: 1; + u8 shared: 1; + unsigned int comp_vector; + struct rdma_restrack_entry res; +}; + +struct ib_uqp_object; + +enum ib_qp_type { + IB_QPT_SMI = 0, + IB_QPT_GSI = 1, + IB_QPT_RC = 2, + IB_QPT_UC = 3, + IB_QPT_UD = 4, + IB_QPT_RAW_IPV6 = 5, + IB_QPT_RAW_ETHERTYPE = 6, + IB_QPT_RAW_PACKET = 8, + IB_QPT_XRC_INI = 9, + IB_QPT_XRC_TGT = 10, + IB_QPT_MAX = 11, + IB_QPT_DRIVER = 255, + IB_QPT_RESERVED1 = 4096, + IB_QPT_RESERVED2 = 4097, + IB_QPT_RESERVED3 = 4098, + IB_QPT_RESERVED4 = 4099, + IB_QPT_RESERVED5 = 4100, + IB_QPT_RESERVED6 = 4101, + IB_QPT_RESERVED7 = 4102, + IB_QPT_RESERVED8 = 4103, + IB_QPT_RESERVED9 = 4104, + IB_QPT_RESERVED10 = 4105, +}; + +struct ib_qp_security; + +struct ib_qp { + struct ib_device *device; + struct ib_pd *pd; + struct ib_cq *send_cq; + struct ib_cq *recv_cq; + spinlock_t mr_lock; + int mrs_used; + struct list_head rdma_mrs; + struct list_head sig_mrs; + struct ib_srq *srq; + struct ib_xrcd *xrcd; + struct list_head xrcd_list; + atomic_t usecnt; + struct list_head open_list; + struct ib_qp *real_qp; + struct ib_uqp_object *uobject; + void (*event_handler)(struct ib_event *, void *); + void *qp_context; + const struct ib_gid_attr *av_sgid_attr; + const struct ib_gid_attr *alt_path_sgid_attr; + u32 qp_num; + u32 max_write_sge; + u32 max_read_sge; + enum ib_qp_type qp_type; + struct ib_rwq_ind_table *rwq_ind_tbl; + struct ib_qp_security *qp_sec; + u8 port; + bool integrity_en; + struct rdma_restrack_entry res; + struct rdma_counter *counter; +}; + +struct ib_usrq_object; + +enum ib_srq_type { + IB_SRQT_BASIC = 0, + IB_SRQT_XRC = 1, + IB_SRQT_TM = 2, +}; + +struct ib_srq { + struct ib_device *device; + struct ib_pd *pd; + struct ib_usrq_object *uobject; + void (*event_handler)(struct ib_event *, void *); + void *srq_context; + enum ib_srq_type srq_type; + atomic_t usecnt; + struct { + struct ib_cq *cq; + union { + struct { + struct ib_xrcd *xrcd; + u32 srq_num; + } xrc; + }; + } ext; +}; + +struct ib_uwq_object; + +enum ib_wq_state { + IB_WQS_RESET = 0, + IB_WQS_RDY = 1, + IB_WQS_ERR = 2, +}; + +enum ib_wq_type { + IB_WQT_RQ = 0, +}; + +struct ib_wq { + struct ib_device *device; + struct ib_uwq_object *uobject; + void *wq_context; + void (*event_handler)(struct ib_event *, void *); + struct ib_pd *pd; + struct ib_cq *cq; + u32 wq_num; + enum ib_wq_state state; + enum ib_wq_type wq_type; + atomic_t usecnt; +}; + +struct ib_event { + struct ib_device *device; + union { + struct ib_cq *cq; + struct ib_qp *qp; + struct ib_srq *srq; + struct ib_wq *wq; + u8 port_num; + } element; + enum ib_event_type event; +}; + +struct ib_global_route { + const struct ib_gid_attr *sgid_attr; + union ib_gid dgid; + u32 flow_label; + u8 sgid_index; + u8 hop_limit; + u8 traffic_class; +}; + +struct ib_grh { + __be32 version_tclass_flow; + __be16 paylen; + u8 next_hdr; + u8 hop_limit; + union ib_gid sgid; + union ib_gid dgid; +}; + +struct ib_mr_status { + u32 fail_status; + struct ib_sig_err sig_err; +}; + +struct rdma_ah_init_attr { + struct rdma_ah_attr *ah_attr; + u32 flags; + struct net_device *xmit_slave; +}; + +enum rdma_ah_attr_type { + RDMA_AH_ATTR_TYPE_UNDEFINED = 0, + RDMA_AH_ATTR_TYPE_IB = 1, + RDMA_AH_ATTR_TYPE_ROCE = 2, + RDMA_AH_ATTR_TYPE_OPA = 3, +}; + +struct ib_ah_attr { + u16 dlid; + u8 src_path_bits; +}; + +struct roce_ah_attr { + u8 dmac[6]; +}; + +struct opa_ah_attr { + u32 dlid; + u8 src_path_bits; + bool make_grd; +}; + +struct rdma_ah_attr { + struct ib_global_route grh; + u8 sl; + u8 static_rate; + u8 port_num; + u8 ah_flags; + enum rdma_ah_attr_type type; + union { + struct ib_ah_attr ib; + struct roce_ah_attr roce; + struct opa_ah_attr opa; + }; +}; + +enum ib_wc_status { + IB_WC_SUCCESS = 0, + IB_WC_LOC_LEN_ERR = 1, + IB_WC_LOC_QP_OP_ERR = 2, + IB_WC_LOC_EEC_OP_ERR = 3, + IB_WC_LOC_PROT_ERR = 4, + IB_WC_WR_FLUSH_ERR = 5, + IB_WC_MW_BIND_ERR = 6, + IB_WC_BAD_RESP_ERR = 7, + IB_WC_LOC_ACCESS_ERR = 8, + IB_WC_REM_INV_REQ_ERR = 9, + IB_WC_REM_ACCESS_ERR = 10, + IB_WC_REM_OP_ERR = 11, + IB_WC_RETRY_EXC_ERR = 12, + IB_WC_RNR_RETRY_EXC_ERR = 13, + IB_WC_LOC_RDD_VIOL_ERR = 14, + IB_WC_REM_INV_RD_REQ_ERR = 15, + IB_WC_REM_ABORT_ERR = 16, + IB_WC_INV_EECN_ERR = 17, + IB_WC_INV_EEC_STATE_ERR = 18, + IB_WC_FATAL_ERR = 19, + IB_WC_RESP_TIMEOUT_ERR = 20, + IB_WC_GENERAL_ERR = 21, +}; + +enum ib_wc_opcode { + IB_WC_SEND = 0, + IB_WC_RDMA_WRITE = 1, + IB_WC_RDMA_READ = 2, + IB_WC_COMP_SWAP = 3, + IB_WC_FETCH_ADD = 4, + IB_WC_BIND_MW = 5, + IB_WC_LOCAL_INV = 6, + IB_WC_LSO = 7, + IB_WC_REG_MR = 8, + IB_WC_MASKED_COMP_SWAP = 9, + IB_WC_MASKED_FETCH_ADD = 10, + IB_WC_RECV = 128, + IB_WC_RECV_RDMA_WITH_IMM = 129, +}; + +struct ib_cqe { + void (*done)(struct ib_cq *, struct ib_wc *); +}; + +struct ib_wc { + union { + u64 wr_id; + struct ib_cqe *wr_cqe; + }; + enum ib_wc_status status; + enum ib_wc_opcode opcode; + u32 vendor_err; + u32 byte_len; + struct ib_qp *qp; + union { + __be32 imm_data; + u32 invalidate_rkey; + } ex; + u32 src_qp; + u32 slid; + int wc_flags; + u16 pkey_index; + u8 sl; + u8 dlid_path_bits; + u8 port_num; + u8 smac[6]; + u16 vlan_id; + u8 network_hdr_type; +}; + +struct ib_srq_attr { + u32 max_wr; + u32 max_sge; + u32 srq_limit; +}; + +struct ib_xrcd { + struct ib_device *device; + atomic_t usecnt; + struct inode *inode; + struct rw_semaphore tgt_qps_rwsem; + struct xarray tgt_qps; +}; + +struct ib_srq_init_attr { + void (*event_handler)(struct ib_event *, void *); + void *srq_context; + struct ib_srq_attr attr; + enum ib_srq_type srq_type; + struct { + struct ib_cq *cq; + union { + struct { + struct ib_xrcd *xrcd; + } xrc; + struct { + u32 max_num_tags; + } tag_matching; + }; + } ext; +}; + +struct ib_qp_cap { + u32 max_send_wr; + u32 max_recv_wr; + u32 max_send_sge; + u32 max_recv_sge; + u32 max_inline_data; + u32 max_rdma_ctxs; +}; + +enum ib_sig_type { + IB_SIGNAL_ALL_WR = 0, + IB_SIGNAL_REQ_WR = 1, +}; + +struct ib_qp_init_attr { + void (*event_handler)(struct ib_event *, void *); + void *qp_context; + struct ib_cq *send_cq; + struct ib_cq *recv_cq; + struct ib_srq *srq; + struct ib_xrcd *xrcd; + struct ib_qp_cap cap; + enum ib_sig_type sq_sig_type; + enum ib_qp_type qp_type; + u32 create_flags; + u8 port_num; + struct ib_rwq_ind_table *rwq_ind_tbl; + u32 source_qpn; +}; + +struct ib_uobject; + +struct ib_rwq_ind_table { + struct ib_device *device; + struct ib_uobject *uobject; + atomic_t usecnt; + u32 ind_tbl_num; + u32 log_ind_tbl_size; + struct ib_wq **ind_tbl; +}; + +enum ib_qp_state { + IB_QPS_RESET = 0, + IB_QPS_INIT = 1, + IB_QPS_RTR = 2, + IB_QPS_RTS = 3, + IB_QPS_SQD = 4, + IB_QPS_SQE = 5, + IB_QPS_ERR = 6, +}; + +enum ib_mig_state { + IB_MIG_MIGRATED = 0, + IB_MIG_REARM = 1, + IB_MIG_ARMED = 2, +}; + +enum ib_mw_type { + IB_MW_TYPE_1 = 1, + IB_MW_TYPE_2 = 2, +}; + +struct ib_qp_attr { + enum ib_qp_state qp_state; + enum ib_qp_state cur_qp_state; + enum ib_mtu path_mtu; + enum ib_mig_state path_mig_state; + u32 qkey; + u32 rq_psn; + u32 sq_psn; + u32 dest_qp_num; + int qp_access_flags; + struct ib_qp_cap cap; + struct rdma_ah_attr ah_attr; + struct rdma_ah_attr alt_ah_attr; + u16 pkey_index; + u16 alt_pkey_index; + u8 en_sqd_async_notify; + u8 sq_draining; + u8 max_rd_atomic; + u8 max_dest_rd_atomic; + u8 min_rnr_timer; + u8 port_num; + u8 timeout; + u8 retry_cnt; + u8 rnr_retry; + u8 alt_port_num; + u8 alt_timeout; + u32 rate_limit; + struct net_device *xmit_slave; +}; + +enum ib_wr_opcode { + IB_WR_RDMA_WRITE = 0, + IB_WR_RDMA_WRITE_WITH_IMM = 1, + IB_WR_SEND = 2, + IB_WR_SEND_WITH_IMM = 3, + IB_WR_RDMA_READ = 4, + IB_WR_ATOMIC_CMP_AND_SWP = 5, + IB_WR_ATOMIC_FETCH_AND_ADD = 6, + IB_WR_BIND_MW = 8, + IB_WR_LSO = 10, + IB_WR_SEND_WITH_INV = 9, + IB_WR_RDMA_READ_WITH_INV = 11, + IB_WR_LOCAL_INV = 7, + IB_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, + IB_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, + IB_WR_REG_MR = 32, + IB_WR_REG_MR_INTEGRITY = 33, + IB_WR_RESERVED1 = 240, + IB_WR_RESERVED2 = 241, + IB_WR_RESERVED3 = 242, + IB_WR_RESERVED4 = 243, + IB_WR_RESERVED5 = 244, + IB_WR_RESERVED6 = 245, + IB_WR_RESERVED7 = 246, + IB_WR_RESERVED8 = 247, + IB_WR_RESERVED9 = 248, + IB_WR_RESERVED10 = 249, +}; + +struct ib_sge { + u64 addr; + u32 length; + u32 lkey; +}; + +struct ib_send_wr { + struct ib_send_wr *next; + union { + u64 wr_id; + struct ib_cqe *wr_cqe; + }; + struct ib_sge *sg_list; + int num_sge; + enum ib_wr_opcode opcode; + int send_flags; + union { + __be32 imm_data; + u32 invalidate_rkey; + } ex; +}; + +struct ib_ah { + struct ib_device *device; + struct ib_pd *pd; + struct ib_uobject *uobject; + const struct ib_gid_attr *sgid_attr; + enum rdma_ah_attr_type type; +}; + +struct ib_mr { + struct ib_device *device; + struct ib_pd *pd; + u32 lkey; + u32 rkey; + u64 iova; + u64 length; + unsigned int page_size; + enum ib_mr_type type; + bool need_inval; + union { + struct ib_uobject *uobject; + struct list_head qp_entry; + }; + struct ib_dm *dm; + struct ib_sig_attrs *sig_attrs; + struct rdma_restrack_entry res; +}; + +struct ib_recv_wr { + struct ib_recv_wr *next; + union { + u64 wr_id; + struct ib_cqe *wr_cqe; + }; + struct ib_sge *sg_list; + int num_sge; +}; + +struct ib_rdmacg_object {}; + +struct ib_uverbs_file; + +struct ib_ucontext { + struct ib_device *device; + struct ib_uverbs_file *ufile; + struct ib_rdmacg_object cg_obj; + struct rdma_restrack_entry res; + struct xarray mmap_xa; +}; + +struct uverbs_api_object; + +struct ib_uobject { + u64 user_handle; + struct ib_uverbs_file *ufile; + struct ib_ucontext *context; + void *object; + struct list_head list; + struct ib_rdmacg_object cg_obj; + int id; + struct kref ref; + atomic_t usecnt; + struct callback_head rcu; + const struct uverbs_api_object *uapi_object; +}; + +struct ib_udata { + const void *inbuf; + void *outbuf; + size_t inlen; + size_t outlen; +}; + +struct ib_pd { + u32 local_dma_lkey; + u32 flags; + struct ib_device *device; + struct ib_uobject *uobject; + atomic_t usecnt; + u32 unsafe_global_rkey; + struct ib_mr *__internal_mr; + struct rdma_restrack_entry res; +}; + +struct ib_wq_init_attr { + void *wq_context; + enum ib_wq_type wq_type; + u32 max_wr; + u32 max_sge; + struct ib_cq *cq; + void (*event_handler)(struct ib_event *, void *); + u32 create_flags; +}; + +struct ib_wq_attr { + enum ib_wq_state wq_state; + enum ib_wq_state curr_wq_state; + u32 flags; + u32 flags_mask; +}; + +struct ib_rwq_ind_table_init_attr { + u32 log_ind_tbl_size; + struct ib_wq **ind_tbl; +}; + +enum port_pkey_state { + IB_PORT_PKEY_NOT_VALID = 0, + IB_PORT_PKEY_VALID = 1, + IB_PORT_PKEY_LISTED = 2, +}; + +struct ib_port_pkey { + enum port_pkey_state state; + u16 pkey_index; + u8 port_num; + struct list_head qp_list; + struct list_head to_error_list; + struct ib_qp_security *sec; +}; + +struct ib_ports_pkeys; + +struct ib_qp_security { + struct ib_qp *qp; + struct ib_device *dev; + struct mutex mutex; + struct ib_ports_pkeys *ports_pkeys; + struct list_head shared_qp_list; + void *security; + bool destroying; + atomic_t error_list_count; + struct completion error_complete; + int error_comps_pending; +}; + +struct ib_ports_pkeys { + struct ib_port_pkey main; + struct ib_port_pkey alt; +}; + +struct ib_dm { + struct ib_device *device; + u32 length; + u32 flags; + struct ib_uobject *uobject; + atomic_t usecnt; +}; + +struct ib_mw { + struct ib_device *device; + struct ib_pd *pd; + struct ib_uobject *uobject; + u32 rkey; + enum ib_mw_type type; +}; + +enum ib_flow_attr_type { + IB_FLOW_ATTR_NORMAL = 0, + IB_FLOW_ATTR_ALL_DEFAULT = 1, + IB_FLOW_ATTR_MC_DEFAULT = 2, + IB_FLOW_ATTR_SNIFFER = 3, +}; + +enum ib_flow_spec_type { + IB_FLOW_SPEC_ETH = 32, + IB_FLOW_SPEC_IB = 34, + IB_FLOW_SPEC_IPV4 = 48, + IB_FLOW_SPEC_IPV6 = 49, + IB_FLOW_SPEC_ESP = 52, + IB_FLOW_SPEC_TCP = 64, + IB_FLOW_SPEC_UDP = 65, + IB_FLOW_SPEC_VXLAN_TUNNEL = 80, + IB_FLOW_SPEC_GRE = 81, + IB_FLOW_SPEC_MPLS = 96, + IB_FLOW_SPEC_INNER = 256, + IB_FLOW_SPEC_ACTION_TAG = 4096, + IB_FLOW_SPEC_ACTION_DROP = 4097, + IB_FLOW_SPEC_ACTION_HANDLE = 4098, + IB_FLOW_SPEC_ACTION_COUNT = 4099, +}; + +struct ib_flow_eth_filter { + u8 dst_mac[6]; + u8 src_mac[6]; + __be16 ether_type; + __be16 vlan_tag; + u8 real_sz[0]; +}; + +struct ib_flow_spec_eth { + u32 type; + u16 size; + struct ib_flow_eth_filter val; + struct ib_flow_eth_filter mask; +}; + +struct ib_flow_ib_filter { + __be16 dlid; + __u8 sl; + u8 real_sz[0]; +}; + +struct ib_flow_spec_ib { + u32 type; + u16 size; + struct ib_flow_ib_filter val; + struct ib_flow_ib_filter mask; +}; + +struct ib_flow_ipv4_filter { + __be32 src_ip; + __be32 dst_ip; + u8 proto; + u8 tos; + u8 ttl; + u8 flags; + u8 real_sz[0]; +}; + +struct ib_flow_spec_ipv4 { + u32 type; + u16 size; + struct ib_flow_ipv4_filter val; + struct ib_flow_ipv4_filter mask; +}; + +struct ib_flow_ipv6_filter { + u8 src_ip[16]; + u8 dst_ip[16]; + __be32 flow_label; + u8 next_hdr; + u8 traffic_class; + u8 hop_limit; + u8 real_sz[0]; +}; + +struct ib_flow_spec_ipv6 { + u32 type; + u16 size; + struct ib_flow_ipv6_filter val; + struct ib_flow_ipv6_filter mask; +}; + +struct ib_flow_tcp_udp_filter { + __be16 dst_port; + __be16 src_port; + u8 real_sz[0]; +}; + +struct ib_flow_spec_tcp_udp { + u32 type; + u16 size; + struct ib_flow_tcp_udp_filter val; + struct ib_flow_tcp_udp_filter mask; +}; + +struct ib_flow_tunnel_filter { + __be32 tunnel_id; + u8 real_sz[0]; +}; + +struct ib_flow_spec_tunnel { + u32 type; + u16 size; + struct ib_flow_tunnel_filter val; + struct ib_flow_tunnel_filter mask; +}; + +struct ib_flow_esp_filter { + __be32 spi; + __be32 seq; + u8 real_sz[0]; +}; + +struct ib_flow_spec_esp { + u32 type; + u16 size; + struct ib_flow_esp_filter val; + struct ib_flow_esp_filter mask; +}; + +struct ib_flow_gre_filter { + __be16 c_ks_res0_ver; + __be16 protocol; + __be32 key; + u8 real_sz[0]; +}; + +struct ib_flow_spec_gre { + u32 type; + u16 size; + struct ib_flow_gre_filter val; + struct ib_flow_gre_filter mask; +}; + +struct ib_flow_mpls_filter { + __be32 tag; + u8 real_sz[0]; +}; + +struct ib_flow_spec_mpls { + u32 type; + u16 size; + struct ib_flow_mpls_filter val; + struct ib_flow_mpls_filter mask; +}; + +struct ib_flow_spec_action_tag { + enum ib_flow_spec_type type; + u16 size; + u32 tag_id; +}; + +struct ib_flow_spec_action_drop { + enum ib_flow_spec_type type; + u16 size; +}; + +struct ib_flow_spec_action_handle { + enum ib_flow_spec_type type; + u16 size; + struct ib_flow_action *act; +}; + +enum ib_flow_action_type { + IB_FLOW_ACTION_UNSPECIFIED = 0, + IB_FLOW_ACTION_ESP = 1, +}; + +struct ib_flow_action { + struct ib_device *device; + struct ib_uobject *uobject; + enum ib_flow_action_type type; + atomic_t usecnt; +}; + +struct ib_flow_spec_action_count { + enum ib_flow_spec_type type; + u16 size; + struct ib_counters *counters; +}; + +struct ib_counters { + struct ib_device *device; + struct ib_uobject *uobject; + atomic_t usecnt; +}; + +union ib_flow_spec { + struct { + u32 type; + u16 size; + }; + struct ib_flow_spec_eth eth; + struct ib_flow_spec_ib ib; + struct ib_flow_spec_ipv4 ipv4; + struct ib_flow_spec_tcp_udp tcp_udp; + struct ib_flow_spec_ipv6 ipv6; + struct ib_flow_spec_tunnel tunnel; + struct ib_flow_spec_esp esp; + struct ib_flow_spec_gre gre; + struct ib_flow_spec_mpls mpls; + struct ib_flow_spec_action_tag flow_tag; + struct ib_flow_spec_action_drop drop; + struct ib_flow_spec_action_handle action; + struct ib_flow_spec_action_count flow_count; +}; + +struct ib_flow_attr { + enum ib_flow_attr_type type; + u16 size; + u16 priority; + u32 flags; + u8 num_of_specs; + u8 port; + union ib_flow_spec flows[0]; +}; + +struct ib_flow { + struct ib_qp *qp; + struct ib_device *device; + struct ib_uobject *uobject; +}; + +struct ib_flow_action_attrs_esp_keymats { + enum ib_uverbs_flow_action_esp_keymat protocol; + union { + struct ib_uverbs_flow_action_esp_keymat_aes_gcm aes_gcm; + } keymat; +}; + +struct ib_flow_action_attrs_esp_replays { + enum ib_uverbs_flow_action_esp_replay protocol; + union { + struct ib_uverbs_flow_action_esp_replay_bmp bmp; + } replay; +}; + +struct ib_flow_spec_list { + struct ib_flow_spec_list *next; + union ib_flow_spec spec; +}; + +struct ib_flow_action_attrs_esp { + struct ib_flow_action_attrs_esp_keymats *keymat; + struct ib_flow_action_attrs_esp_replays *replay; + struct ib_flow_spec_list *encap; + u32 esn; + u32 spi; + u32 seq; + u32 tfc_pad; + u64 flags; + u64 hard_limit_pkts; +}; + +struct ib_pkey_cache; + +struct ib_gid_table; + +struct ib_port_cache { + u64 subnet_prefix; + struct ib_pkey_cache *pkey; + struct ib_gid_table *gid; + u8 lmc; + enum ib_port_state port_state; +}; + +struct ib_port_immutable { + int pkey_tbl_len; + int gid_tbl_len; + u32 core_cap_flags; + u32 max_mad_size; +}; + +struct ib_port_data { + struct ib_device *ib_dev; + struct ib_port_immutable immutable; + spinlock_t pkey_list_lock; + struct list_head pkey_list; + struct ib_port_cache cache; + spinlock_t netdev_lock; + struct net_device *netdev; + struct hlist_node ndev_hash_link; + struct rdma_port_counter port_counter; + struct rdma_hw_stats *hw_stats; +}; + +struct rdma_netdev_alloc_params { + size_t sizeof_priv; + unsigned int txqs; + unsigned int rxqs; + void *param; + int (*initialize_rdma_netdev)(struct ib_device *, u8, struct net_device *, void *); +}; + +struct ib_counters_read_attr { + u64 *counters_buff; + u32 ncounters; + u32 flags; +}; + +struct rdma_user_mmap_entry { + struct kref ref; + struct ib_ucontext *ucontext; + long unsigned int start_pgoff; + size_t npages; + bool driver_removed; +}; + +enum blk_zone_report_flags { + BLK_ZONE_REP_CAPACITY = 1, +}; + +struct blk_zone_report { + __u64 sector; + __u32 nr_zones; + __u32 flags; + struct blk_zone zones[0]; +}; + +struct blk_zone_range { + __u64 sector; + __u64 nr_sectors; +}; + +struct zone_report_args { + struct blk_zone *zones; +}; + +struct blk_revalidate_zone_args { + struct gendisk *disk; + long unsigned int *conv_zones_bitmap; + long unsigned int *seq_zones_wlock; + unsigned int nr_zones; + sector_t zone_sectors; + sector_t sector; +}; + +enum wbt_flags { + WBT_TRACKED = 1, + WBT_READ = 2, + WBT_KSWAPD = 4, + WBT_DISCARD = 8, + WBT_NR_BITS = 4, +}; + +enum { + WBT_STATE_ON_DEFAULT = 1, + WBT_STATE_ON_MANUAL = 2, +}; + +struct rq_wb { + unsigned int wb_background; + unsigned int wb_normal; + short int enable_state; + unsigned int unknown_cnt; + u64 win_nsec; + u64 cur_win_nsec; + struct blk_stat_callback *cb; + u64 sync_issue; + void *sync_cookie; + unsigned int wc; + long unsigned int last_issue; + long unsigned int last_comp; + long unsigned int min_lat_nsec; + struct rq_qos rqos; + struct rq_wait rq_wait[3]; + struct rq_depth rq_depth; +}; + +struct trace_event_raw_wbt_stat { + struct trace_entry ent; + char name[32]; + s64 rmean; + u64 rmin; + u64 rmax; + s64 rnr_samples; + s64 rtime; + s64 wmean; + u64 wmin; + u64 wmax; + s64 wnr_samples; + s64 wtime; + char __data[0]; +}; + +struct trace_event_raw_wbt_lat { + struct trace_entry ent; + char name[32]; + long unsigned int lat; + char __data[0]; +}; + +struct trace_event_raw_wbt_step { + struct trace_entry ent; + char name[32]; + const char *msg; + int step; + long unsigned int window; + unsigned int bg; + unsigned int normal; + unsigned int max; + char __data[0]; +}; + +struct trace_event_raw_wbt_timer { + struct trace_entry ent; + char name[32]; + unsigned int status; + int step; + unsigned int inflight; + char __data[0]; +}; + +struct trace_event_data_offsets_wbt_stat {}; + +struct trace_event_data_offsets_wbt_lat {}; + +struct trace_event_data_offsets_wbt_step {}; + +struct trace_event_data_offsets_wbt_timer {}; + +typedef void (*btf_trace_wbt_stat)(void *, struct backing_dev_info *, struct blk_rq_stat *); + +typedef void (*btf_trace_wbt_lat)(void *, struct backing_dev_info *, long unsigned int); + +typedef void (*btf_trace_wbt_step)(void *, struct backing_dev_info *, const char *, int, long unsigned int, unsigned int, unsigned int, unsigned int); + +typedef void (*btf_trace_wbt_timer)(void *, struct backing_dev_info *, unsigned int, int, unsigned int); + +enum { + RWB_DEF_DEPTH = 16, + RWB_WINDOW_NSEC = 100000000, + RWB_MIN_WRITE_SAMPLES = 3, + RWB_UNKNOWN_BUMP = 5, +}; + +enum { + LAT_OK = 1, + LAT_UNKNOWN = 2, + LAT_UNKNOWN_WRITES = 3, + LAT_EXCEEDED = 4, +}; + +struct wbt_wait_data { + struct rq_wb *rwb; + enum wbt_flags wb_acct; + long unsigned int rw; +}; + +struct show_busy_params { + struct seq_file *m; + struct blk_mq_hw_ctx *hctx; +}; + +enum opal_mbr { + OPAL_MBR_ENABLE = 0, + OPAL_MBR_DISABLE = 1, +}; + +enum opal_mbr_done_flag { + OPAL_MBR_NOT_DONE = 0, + OPAL_MBR_DONE = 1, +}; + +enum opal_user { + OPAL_ADMIN1 = 0, + OPAL_USER1 = 1, + OPAL_USER2 = 2, + OPAL_USER3 = 3, + OPAL_USER4 = 4, + OPAL_USER5 = 5, + OPAL_USER6 = 6, + OPAL_USER7 = 7, + OPAL_USER8 = 8, + OPAL_USER9 = 9, +}; + +enum opal_lock_state { + OPAL_RO = 1, + OPAL_RW = 2, + OPAL_LK = 4, +}; + +struct opal_key { + __u8 lr; + __u8 key_len; + __u8 __align[6]; + __u8 key[256]; +}; + +struct opal_lr_act { + struct opal_key key; + __u32 sum; + __u8 num_lrs; + __u8 lr[9]; + __u8 align[2]; +}; + +struct opal_session_info { + __u32 sum; + __u32 who; + struct opal_key opal_key; +}; + +struct opal_user_lr_setup { + __u64 range_start; + __u64 range_length; + __u32 RLE; + __u32 WLE; + struct opal_session_info session; +}; + +struct opal_lock_unlock { + struct opal_session_info session; + __u32 l_state; + __u8 __align[4]; +}; + +struct opal_new_pw { + struct opal_session_info session; + struct opal_session_info new_user_pw; +}; + +struct opal_mbr_data { + struct opal_key key; + __u8 enable_disable; + __u8 __align[7]; +}; + +struct opal_mbr_done { + struct opal_key key; + __u8 done_flag; + __u8 __align[7]; +}; + +struct opal_shadow_mbr { + struct opal_key key; + const __u64 data; + __u64 offset; + __u64 size; +}; + +enum opal_table_ops { + OPAL_READ_TABLE = 0, + OPAL_WRITE_TABLE = 1, +}; + +struct opal_read_write_table { + struct opal_key key; + const __u64 data; + const __u8 table_uid[8]; + __u64 offset; + __u64 size; + __u64 flags; + __u64 priv; +}; + +typedef int sec_send_recv(void *, u16, u8, void *, size_t, bool); + +enum { + TCG_SECP_00 = 0, + TCG_SECP_01 = 1, +}; + +enum opal_response_token { + OPAL_DTA_TOKENID_BYTESTRING = 224, + OPAL_DTA_TOKENID_SINT = 225, + OPAL_DTA_TOKENID_UINT = 226, + OPAL_DTA_TOKENID_TOKEN = 227, + OPAL_DTA_TOKENID_INVALID = 0, +}; + +enum opal_uid { + OPAL_SMUID_UID = 0, + OPAL_THISSP_UID = 1, + OPAL_ADMINSP_UID = 2, + OPAL_LOCKINGSP_UID = 3, + OPAL_ENTERPRISE_LOCKINGSP_UID = 4, + OPAL_ANYBODY_UID = 5, + OPAL_SID_UID = 6, + OPAL_ADMIN1_UID = 7, + OPAL_USER1_UID = 8, + OPAL_USER2_UID = 9, + OPAL_PSID_UID = 10, + OPAL_ENTERPRISE_BANDMASTER0_UID = 11, + OPAL_ENTERPRISE_ERASEMASTER_UID = 12, + OPAL_TABLE_TABLE = 13, + OPAL_LOCKINGRANGE_GLOBAL = 14, + OPAL_LOCKINGRANGE_ACE_RDLOCKED = 15, + OPAL_LOCKINGRANGE_ACE_WRLOCKED = 16, + OPAL_MBRCONTROL = 17, + OPAL_MBR = 18, + OPAL_AUTHORITY_TABLE = 19, + OPAL_C_PIN_TABLE = 20, + OPAL_LOCKING_INFO_TABLE = 21, + OPAL_ENTERPRISE_LOCKING_INFO_TABLE = 22, + OPAL_DATASTORE = 23, + OPAL_C_PIN_MSID = 24, + OPAL_C_PIN_SID = 25, + OPAL_C_PIN_ADMIN1 = 26, + OPAL_HALF_UID_AUTHORITY_OBJ_REF = 27, + OPAL_HALF_UID_BOOLEAN_ACE = 28, + OPAL_UID_HEXFF = 29, +}; + +enum opal_method { + OPAL_PROPERTIES = 0, + OPAL_STARTSESSION = 1, + OPAL_REVERT = 2, + OPAL_ACTIVATE = 3, + OPAL_EGET = 4, + OPAL_ESET = 5, + OPAL_NEXT = 6, + OPAL_EAUTHENTICATE = 7, + OPAL_GETACL = 8, + OPAL_GENKEY = 9, + OPAL_REVERTSP = 10, + OPAL_GET = 11, + OPAL_SET = 12, + OPAL_AUTHENTICATE = 13, + OPAL_RANDOM = 14, + OPAL_ERASE = 15, +}; + +enum opal_token { + OPAL_TRUE = 1, + OPAL_FALSE = 0, + OPAL_BOOLEAN_EXPR = 3, + OPAL_TABLE = 0, + OPAL_STARTROW = 1, + OPAL_ENDROW = 2, + OPAL_STARTCOLUMN = 3, + OPAL_ENDCOLUMN = 4, + OPAL_VALUES = 1, + OPAL_TABLE_UID = 0, + OPAL_TABLE_NAME = 1, + OPAL_TABLE_COMMON = 2, + OPAL_TABLE_TEMPLATE = 3, + OPAL_TABLE_KIND = 4, + OPAL_TABLE_COLUMN = 5, + OPAL_TABLE_COLUMNS = 6, + OPAL_TABLE_ROWS = 7, + OPAL_TABLE_ROWS_FREE = 8, + OPAL_TABLE_ROW_BYTES = 9, + OPAL_TABLE_LASTID = 10, + OPAL_TABLE_MIN = 11, + OPAL_TABLE_MAX = 12, + OPAL_PIN = 3, + OPAL_RANGESTART = 3, + OPAL_RANGELENGTH = 4, + OPAL_READLOCKENABLED = 5, + OPAL_WRITELOCKENABLED = 6, + OPAL_READLOCKED = 7, + OPAL_WRITELOCKED = 8, + OPAL_ACTIVEKEY = 10, + OPAL_LIFECYCLE = 6, + OPAL_MAXRANGES = 4, + OPAL_MBRENABLE = 1, + OPAL_MBRDONE = 2, + OPAL_HOSTPROPERTIES = 0, + OPAL_STARTLIST = 240, + OPAL_ENDLIST = 241, + OPAL_STARTNAME = 242, + OPAL_ENDNAME = 243, + OPAL_CALL = 248, + OPAL_ENDOFDATA = 249, + OPAL_ENDOFSESSION = 250, + OPAL_STARTTRANSACTON = 251, + OPAL_ENDTRANSACTON = 252, + OPAL_EMPTYATOM = 255, + OPAL_WHERE = 0, +}; + +enum opal_parameter { + OPAL_SUM_SET_LIST = 393216, +}; + +struct opal_compacket { + __be32 reserved0; + u8 extendedComID[4]; + __be32 outstandingData; + __be32 minTransfer; + __be32 length; +}; + +struct opal_packet { + __be32 tsn; + __be32 hsn; + __be32 seq_number; + __be16 reserved0; + __be16 ack_type; + __be32 acknowledgment; + __be32 length; +}; + +struct opal_data_subpacket { + u8 reserved0[6]; + __be16 kind; + __be32 length; +}; + +struct opal_header { + struct opal_compacket cp; + struct opal_packet pkt; + struct opal_data_subpacket subpkt; +}; + +struct d0_header { + __be32 length; + __be32 revision; + __be32 reserved01; + __be32 reserved02; + u8 ignored[32]; +}; + +struct d0_tper_features { + u8 supported_features; + u8 reserved01[3]; + __be32 reserved02; + __be32 reserved03; +}; + +struct d0_locking_features { + u8 supported_features; + u8 reserved01[3]; + __be32 reserved02; + __be32 reserved03; +}; + +struct d0_geometry_features { + u8 header[4]; + u8 reserved01; + u8 reserved02[7]; + __be32 logical_block_size; + __be64 alignment_granularity; + __be64 lowest_aligned_lba; +}; + +struct d0_opal_v100 { + __be16 baseComID; + __be16 numComIDs; +}; + +struct d0_single_user_mode { + __be32 num_locking_objects; + u8 reserved01; + u8 reserved02; + __be16 reserved03; + __be32 reserved04; +}; + +struct d0_opal_v200 { + __be16 baseComID; + __be16 numComIDs; + u8 range_crossing; + u8 num_locking_admin_auth[2]; + u8 num_locking_user_auth[2]; + u8 initialPIN; + u8 revertedPIN; + u8 reserved01; + __be32 reserved02; +}; + +struct d0_features { + __be16 code; + u8 r_version; + u8 length; + u8 features[0]; +}; + +struct opal_dev; + +struct opal_step { + int (*fn)(struct opal_dev *, void *); + void *data; +}; + +enum opal_atom_width { + OPAL_WIDTH_TINY = 0, + OPAL_WIDTH_SHORT = 1, + OPAL_WIDTH_MEDIUM = 2, + OPAL_WIDTH_LONG = 3, + OPAL_WIDTH_TOKEN = 4, +}; + +struct opal_resp_tok { + const u8 *pos; + size_t len; + enum opal_response_token type; + enum opal_atom_width width; + union { + u64 u; + s64 s; + } stored; +}; + +struct parsed_resp { + int num; + struct opal_resp_tok toks[64]; +}; + +struct opal_dev { + bool supported; + bool mbr_enabled; + void *data; + sec_send_recv *send_recv; + struct mutex dev_lock; + u16 comid; + u32 hsn; + u32 tsn; + u64 align; + u64 lowest_lba; + size_t pos; + u8 cmd[2048]; + u8 resp[2048]; + struct parsed_resp parsed; + size_t prev_d_len; + void *prev_data; + struct list_head unlk_lst; +}; + +typedef int cont_fn(struct opal_dev *); + +struct opal_suspend_data { + struct opal_lock_unlock unlk; + u8 lr; + struct list_head node; +}; + +struct blk_ksm_keyslot { + atomic_t slot_refs; + struct list_head idle_slot_node; + struct hlist_node hash_node; + const struct blk_crypto_key *key; + struct blk_keyslot_manager *ksm; +}; + +struct blk_ksm_ll_ops { + int (*keyslot_program)(struct blk_keyslot_manager *, const struct blk_crypto_key *, unsigned int); + int (*keyslot_evict)(struct blk_keyslot_manager *, const struct blk_crypto_key *, unsigned int); +}; + +struct blk_keyslot_manager { + struct blk_ksm_ll_ops ksm_ll_ops; + unsigned int max_dun_bytes_supported; + unsigned int crypto_modes_supported[4]; + struct device *dev; + unsigned int num_slots; + struct rw_semaphore lock; + wait_queue_head_t idle_slots_wait_queue; + struct list_head idle_slots; + spinlock_t idle_slots_lock; + struct hlist_head *slot_hashtable; + unsigned int log_slot_ht_size; + struct blk_ksm_keyslot *slots; +}; + +struct blk_crypto_mode { + const char *cipher_str; + unsigned int keysize; + unsigned int ivsize; +}; + +typedef int (*cmp_r_func_t)(const void *, const void *, const void *); + +struct siprand_state { + long unsigned int v0; + long unsigned int v1; + long unsigned int v2; + long unsigned int v3; +}; + +typedef __kernel_long_t __kernel_ptrdiff_t; + +typedef __kernel_ptrdiff_t ptrdiff_t; + +struct region { + unsigned int start; + unsigned int off; + unsigned int group_len; + unsigned int end; +}; + +enum { + REG_OP_ISFREE = 0, + REG_OP_ALLOC = 1, + REG_OP_RELEASE = 2, +}; + +typedef struct scatterlist *sg_alloc_fn(unsigned int, gfp_t); + +typedef void sg_free_fn(struct scatterlist *, unsigned int); + +struct sg_page_iter { + struct scatterlist *sg; + unsigned int sg_pgoffset; + unsigned int __nents; + int __pg_advance; +}; + +struct sg_dma_page_iter { + struct sg_page_iter base; +}; + +struct sg_mapping_iter { + struct page *page; + void *addr; + size_t length; + size_t consumed; + struct sg_page_iter piter; + unsigned int __offset; + unsigned int __remaining; + unsigned int __flags; +}; + +typedef int (*cmp_func)(void *, const struct list_head *, const struct list_head *); + +struct csum_state { + __wsum csum; + size_t off; +}; + +struct rhltable { + struct rhashtable ht; +}; + +struct rhashtable_walker { + struct list_head list; + struct bucket_table *tbl; +}; + +struct rhashtable_iter { + struct rhashtable *ht; + struct rhash_head *p; + struct rhlist_head *list; + struct rhashtable_walker walker; + unsigned int slot; + unsigned int skip; + bool end_of_table; +}; + +union nested_table { + union nested_table *table; + struct rhash_lock_head *bucket; +}; + +struct once_work { + struct work_struct work; + struct static_key_true *key; +}; + +struct genradix_iter { + size_t offset; + size_t pos; +}; + +struct genradix_node { + union { + struct genradix_node *children[512]; + u8 data[4096]; + }; +}; + +struct test_fail { + const char *str; + unsigned int base; +}; + +struct test_s8 { + const char *str; + unsigned int base; + s8 expected_res; +}; + +struct test_u8 { + const char *str; + unsigned int base; + u8 expected_res; +}; + +struct test_s16 { + const char *str; + unsigned int base; + s16 expected_res; +}; + +struct test_u16 { + const char *str; + unsigned int base; + u16 expected_res; +}; + +struct test_s32 { + const char *str; + unsigned int base; + s32 expected_res; +}; + +struct test_u32 { + const char *str; + unsigned int base; + u32 expected_res; +}; + +struct test_s64 { + const char *str; + unsigned int base; + s64 expected_res; +}; + +struct test_u64 { + const char *str; + unsigned int base; + u64 expected_res; +}; + +struct test_ll { + const char *str; + unsigned int base; + long long int expected_res; +}; + +struct test_ull { + const char *str; + unsigned int base; + long long unsigned int expected_res; +}; + +struct reciprocal_value_adv { + u32 m; + u8 sh; + u8 exp; + bool is_wide_m; +}; + +enum devm_ioremap_type { + DEVM_IOREMAP = 0, + DEVM_IOREMAP_UC = 1, + DEVM_IOREMAP_WC = 2, +}; + +struct pcim_iomap_devres { + void *table[6]; +}; + +struct btree_head { + long unsigned int *node; + mempool_t *mempool; + int height; +}; + +struct btree_geo { + int keylen; + int no_pairs; + int no_longs; +}; + +typedef void (*visitor128_t)(void *, long unsigned int, u64, u64, size_t); + +typedef void (*visitorl_t)(void *, long unsigned int, long unsigned int, size_t); + +typedef void (*visitor32_t)(void *, long unsigned int, u32, size_t); + +typedef void (*visitor64_t)(void *, long unsigned int, u64, size_t); + +enum assoc_array_walk_status { + assoc_array_walk_tree_empty = 0, + assoc_array_walk_found_terminal_node = 1, + assoc_array_walk_found_wrong_shortcut = 2, +}; + +struct assoc_array_walk_result { + struct { + struct assoc_array_node *node; + int level; + int slot; + } terminal_node; + struct { + struct assoc_array_shortcut *shortcut; + int level; + int sc_level; + long unsigned int sc_segments; + long unsigned int dissimilarity; + } wrong_shortcut; +}; + +struct assoc_array_delete_collapse_context { + struct assoc_array_node *node; + const void *skip_leaf; + int slot; +}; + +struct linear_range { + unsigned int min; + unsigned int min_sel; + unsigned int max_sel; + unsigned int step; +}; + +enum packing_op { + PACK = 0, + UNPACK = 1, +}; + +struct xxh32_state { + uint32_t total_len_32; + uint32_t large_len; + uint32_t v1; + uint32_t v2; + uint32_t v3; + uint32_t v4; + uint32_t mem32[4]; + uint32_t memsize; +}; + +struct gen_pool_chunk { + struct list_head next_chunk; + atomic_long_t avail; + phys_addr_t phys_addr; + void *owner; + long unsigned int start_addr; + long unsigned int end_addr; + long unsigned int bits[0]; +}; + +struct genpool_data_align { + int align; +}; + +struct genpool_data_fixed { + long unsigned int offset; +}; + +struct sw842_hlist_node8 { + struct hlist_node node; + u64 data; + u8 index; +}; + +struct sw842_hlist_node4 { + struct hlist_node node; + u32 data; + u16 index; +}; + +struct sw842_hlist_node2 { + struct hlist_node node; + u16 data; + u8 index; +}; + +struct sw842_param { + u8 *in; + u8 *instart; + u64 ilen; + u8 *out; + u64 olen; + u8 bit; + u64 data8[1]; + u32 data4[2]; + u16 data2[4]; + int index8[1]; + int index4[2]; + int index2[4]; + struct hlist_head htable8[1024]; + struct hlist_head htable4[2048]; + struct hlist_head htable2[1024]; + struct sw842_hlist_node8 node8[256]; + struct sw842_hlist_node4 node4[512]; + struct sw842_hlist_node2 node2[256]; +}; + +struct sw842_param___2 { + u8 *in; + u8 bit; + u64 ilen; + u8 *out; + u8 *ostart; + u64 olen; +}; + +typedef struct { + unsigned char op; + unsigned char bits; + short unsigned int val; +} code; + +typedef enum { + HEAD = 0, + FLAGS = 1, + TIME = 2, + OS = 3, + EXLEN = 4, + EXTRA = 5, + NAME = 6, + COMMENT = 7, + HCRC = 8, + DICTID = 9, + DICT = 10, + TYPE = 11, + TYPEDO = 12, + STORED = 13, + COPY = 14, + TABLE = 15, + LENLENS = 16, + CODELENS = 17, + LEN = 18, + LENEXT = 19, + DIST = 20, + DISTEXT = 21, + MATCH = 22, + LIT = 23, + CHECK = 24, + LENGTH = 25, + DONE = 26, + BAD = 27, + MEM = 28, + SYNC = 29, +} inflate_mode; + +struct inflate_state { + inflate_mode mode; + int last; + int wrap; + int havedict; + int flags; + unsigned int dmax; + long unsigned int check; + long unsigned int total; + unsigned int wbits; + unsigned int wsize; + unsigned int whave; + unsigned int write; + unsigned char *window; + long unsigned int hold; + unsigned int bits; + unsigned int length; + unsigned int offset; + unsigned int extra; + const code *lencode; + const code *distcode; + unsigned int lenbits; + unsigned int distbits; + unsigned int ncode; + unsigned int nlen; + unsigned int ndist; + unsigned int have; + code *next; + short unsigned int lens[320]; + short unsigned int work[288]; + code codes[2048]; +}; + +union uu { + short unsigned int us; + unsigned char b[2]; +}; + +typedef unsigned int uInt; + +typedef enum { + CODES = 0, + LENS = 1, + DISTS = 2, +} codetype; + +struct inflate_workspace { + struct inflate_state inflate_state; + unsigned char working_window[32768]; +}; + +typedef unsigned char uch; + +typedef short unsigned int ush; + +typedef long unsigned int ulg; + +struct ct_data_s { + union { + ush freq; + ush code; + } fc; + union { + ush dad; + ush len; + } dl; +}; + +typedef struct ct_data_s ct_data; + +struct static_tree_desc_s { + const ct_data *static_tree; + const int *extra_bits; + int extra_base; + int elems; + int max_length; +}; + +typedef struct static_tree_desc_s static_tree_desc; + +struct tree_desc_s { + ct_data *dyn_tree; + int max_code; + static_tree_desc *stat_desc; +}; + +typedef ush Pos; + +typedef unsigned int IPos; + +struct deflate_state { + z_streamp strm; + int status; + Byte *pending_buf; + ulg pending_buf_size; + Byte *pending_out; + int pending; + int noheader; + Byte data_type; + Byte method; + int last_flush; + uInt w_size; + uInt w_bits; + uInt w_mask; + Byte *window; + ulg window_size; + Pos *prev; + Pos *head; + uInt ins_h; + uInt hash_size; + uInt hash_bits; + uInt hash_mask; + uInt hash_shift; + long int block_start; + uInt match_length; + IPos prev_match; + int match_available; + uInt strstart; + uInt match_start; + uInt lookahead; + uInt prev_length; + uInt max_chain_length; + uInt max_lazy_match; + int level; + int strategy; + uInt good_match; + int nice_match; + struct ct_data_s dyn_ltree[573]; + struct ct_data_s dyn_dtree[61]; + struct ct_data_s bl_tree[39]; + struct tree_desc_s l_desc; + struct tree_desc_s d_desc; + struct tree_desc_s bl_desc; + ush bl_count[16]; + int heap[573]; + int heap_len; + int heap_max; + uch depth[573]; + uch *l_buf; + uInt lit_bufsize; + uInt last_lit; + ush *d_buf; + ulg opt_len; + ulg static_len; + ulg compressed_len; + uInt matches; + int last_eob_len; + ush bi_buf; + int bi_valid; +}; + +typedef struct deflate_state deflate_state; + +typedef enum { + need_more = 0, + block_done = 1, + finish_started = 2, + finish_done = 3, +} block_state; + +typedef block_state (*compress_func)(deflate_state *, int); + +struct deflate_workspace { + deflate_state deflate_memory; + Byte *window_memory; + Pos *prev_memory; + Pos *head_memory; + char *overlay_memory; +}; + +typedef struct deflate_workspace deflate_workspace; + +struct config_s { + ush good_length; + ush max_lazy; + ush nice_length; + ush max_chain; + compress_func func; +}; + +typedef struct config_s config; + +typedef struct tree_desc_s tree_desc; + +typedef struct { + uint32_t hashTable[4096]; + uint32_t currentOffset; + uint32_t initCheck; + const uint8_t *dictionary; + uint8_t *bufferStart; + uint32_t dictSize; +} LZ4_stream_t_internal; + +typedef union { + long long unsigned int table[2052]; + LZ4_stream_t_internal internal_donotuse; +} LZ4_stream_t; + +typedef uint8_t BYTE; + +typedef uint16_t U16; + +typedef uint32_t U32; + +typedef uint64_t U64; + +typedef uintptr_t uptrval; + +typedef enum { + noLimit = 0, + limitedOutput = 1, +} limitedOutput_directive; + +typedef enum { + byPtr = 0, + byU32 = 1, + byU16 = 2, +} tableType_t; + +typedef enum { + noDict = 0, + withPrefix64k = 1, + usingExtDict = 2, +} dict_directive; + +typedef enum { + noDictIssue = 0, + dictSmall = 1, +} dictIssue_directive; + +typedef struct { + const uint8_t *externalDict; + size_t extDictSize; + const uint8_t *prefixEnd; + size_t prefixSize; +} LZ4_streamDecode_t_internal; + +typedef union { + long long unsigned int table[4]; + LZ4_streamDecode_t_internal internal_donotuse; +} LZ4_streamDecode_t; + +typedef enum { + endOnOutputSize = 0, + endOnInputSize = 1, +} endCondition_directive; + +typedef enum { + decode_full_block = 0, + partial_decode = 1, +} earlyEnd_directive; + +typedef struct { + size_t bitContainer; + int bitPos; + char *startPtr; + char *ptr; + char *endPtr; +} BIT_CStream_t; + +typedef unsigned int FSE_CTable; + +typedef struct { + ptrdiff_t value; + const void *stateTable; + const void *symbolTT; + unsigned int stateLog; +} FSE_CState_t; + +typedef struct { + int deltaFindState; + U32 deltaNbBits; +} FSE_symbolCompressionTransform; + +typedef int16_t S16; + +struct HUF_CElt_s { + U16 val; + BYTE nbBits; +}; + +typedef struct HUF_CElt_s HUF_CElt; + +typedef enum { + HUF_repeat_none = 0, + HUF_repeat_check = 1, + HUF_repeat_valid = 2, +} HUF_repeat; + +struct nodeElt_s { + U32 count; + U16 parent; + BYTE byte; + BYTE nbBits; +}; + +typedef struct nodeElt_s nodeElt; + +typedef struct { + U32 base; + U32 curr; +} rankPos; + +typedef enum { + ZSTDcs_created = 0, + ZSTDcs_init = 1, + ZSTDcs_ongoing = 2, + ZSTDcs_ending = 3, +} ZSTD_compressionStage_e; + +typedef void * (*ZSTD_allocFunction)(void *, size_t); + +typedef void (*ZSTD_freeFunction)(void *, void *); + +typedef struct { + ZSTD_allocFunction customAlloc; + ZSTD_freeFunction customFree; + void *opaque; +} ZSTD_customMem; + +typedef struct { + U32 price; + U32 off; + U32 mlen; + U32 litlen; + U32 rep[3]; +} ZSTD_optimal_t; + +typedef struct { + U32 off; + U32 len; +} ZSTD_match_t; + +struct seqDef_s; + +typedef struct seqDef_s seqDef; + +typedef struct { + seqDef *sequencesStart; + seqDef *sequences; + BYTE *litStart; + BYTE *lit; + BYTE *llCode; + BYTE *mlCode; + BYTE *ofCode; + U32 longLengthID; + U32 longLengthPos; + ZSTD_optimal_t *priceTable; + ZSTD_match_t *matchTable; + U32 *matchLengthFreq; + U32 *litLengthFreq; + U32 *litFreq; + U32 *offCodeFreq; + U32 matchLengthSum; + U32 matchSum; + U32 litLengthSum; + U32 litSum; + U32 offCodeSum; + U32 log2matchLengthSum; + U32 log2matchSum; + U32 log2litLengthSum; + U32 log2litSum; + U32 log2offCodeSum; + U32 factor; + U32 staticPrices; + U32 cachedPrice; + U32 cachedLitLength; + const BYTE *cachedLiterals; +} seqStore_t; + +struct HUF_CElt_s___2; + +typedef struct HUF_CElt_s___2 HUF_CElt___2; + +struct ZSTD_CCtx_s { + const BYTE *nextSrc; + const BYTE *base; + const BYTE *dictBase; + U32 dictLimit; + U32 lowLimit; + U32 nextToUpdate; + U32 nextToUpdate3; + U32 hashLog3; + U32 loadedDictEnd; + U32 forceWindow; + U32 forceRawDict; + ZSTD_compressionStage_e stage; + U32 rep[3]; + U32 repToConfirm[3]; + U32 dictID; + ZSTD_parameters params; + void *workSpace; + size_t workSpaceSize; + size_t blockSize; + U64 frameContentSize; + struct xxh64_state xxhState; + ZSTD_customMem customMem; + seqStore_t seqStore; + U32 *hashTable; + U32 *hashTable3; + U32 *chainTable; + HUF_CElt___2 *hufTable; + U32 flagStaticTables; + HUF_repeat flagStaticHufTable; + FSE_CTable offcodeCTable[187]; + FSE_CTable matchlengthCTable[363]; + FSE_CTable litlengthCTable[329]; + unsigned int tmpCounters[1536]; +}; + +typedef struct ZSTD_CCtx_s ZSTD_CCtx; + +struct ZSTD_CDict_s { + void *dictBuffer; + const void *dictContent; + size_t dictContentSize; + ZSTD_CCtx *refContext; +}; + +typedef struct ZSTD_CDict_s ZSTD_CDict; + +typedef enum { + zcss_init = 0, + zcss_load = 1, + zcss_flush = 2, + zcss_final = 3, +} ZSTD_cStreamStage; + +struct ZSTD_CStream_s___2 { + ZSTD_CCtx *cctx; + ZSTD_CDict *cdictLocal; + const ZSTD_CDict *cdict; + char *inBuff; + size_t inBuffSize; + size_t inToCompress; + size_t inBuffPos; + size_t inBuffTarget; + size_t blockSize; + char *outBuff; + size_t outBuffSize; + size_t outBuffContentSize; + size_t outBuffFlushedSize; + ZSTD_cStreamStage stage; + U32 checksum; + U32 frameEnded; + U64 pledgedSrcSize; + U64 inputProcessed; + ZSTD_parameters params; + ZSTD_customMem customMem; +}; + +typedef struct ZSTD_CStream_s___2 ZSTD_CStream___2; + +typedef int32_t S32; + +typedef enum { + set_basic = 0, + set_rle = 1, + set_compressed = 2, + set_repeat = 3, +} symbolEncodingType_e; + +struct seqDef_s { + U32 offset; + U16 litLength; + U16 matchLength; +}; + +typedef enum { + ZSTDcrp_continue = 0, + ZSTDcrp_noMemset = 1, + ZSTDcrp_fullReset = 2, +} ZSTD_compResetPolicy_e; + +typedef void (*ZSTD_blockCompressor)(ZSTD_CCtx *, const void *, size_t); + +typedef enum { + zsf_gather = 0, + zsf_flush = 1, + zsf_end = 2, +} ZSTD_flush_e; + +typedef size_t (*searchMax_f)(ZSTD_CCtx *, const BYTE *, const BYTE *, size_t *, U32, U32); + +typedef struct { + size_t bitContainer; + unsigned int bitsConsumed; + const char *ptr; + const char *start; +} BIT_DStream_t; + +typedef enum { + BIT_DStream_unfinished = 0, + BIT_DStream_endOfBuffer = 1, + BIT_DStream_completed = 2, + BIT_DStream_overflow = 3, +} BIT_DStream_status; + +typedef unsigned int FSE_DTable; + +typedef struct { + size_t state; + const void *table; +} FSE_DState_t; + +typedef struct { + U16 tableLog; + U16 fastMode; +} FSE_DTableHeader; + +typedef struct { + short unsigned int newState; + unsigned char symbol; + unsigned char nbBits; +} FSE_decode_t; + +typedef struct { + void *ptr; + const void *end; +} ZSTD_stack; + +typedef U32 HUF_DTable; + +typedef struct { + BYTE maxTableLog; + BYTE tableType; + BYTE tableLog; + BYTE reserved; +} DTableDesc; + +typedef struct { + BYTE byte; + BYTE nbBits; +} HUF_DEltX2; + +typedef struct { + U16 sequence; + BYTE nbBits; + BYTE length; +} HUF_DEltX4; + +typedef struct { + BYTE symbol; + BYTE weight; +} sortedSymbol_t; + +typedef U32 rankValCol_t[13]; + +typedef struct { + U32 tableTime; + U32 decode256Time; +} algo_time_t; + +typedef struct { + FSE_DTable LLTable[513]; + FSE_DTable OFTable[257]; + FSE_DTable MLTable[513]; + HUF_DTable hufTable[4097]; + U64 workspace[384]; + U32 rep[3]; +} ZSTD_entropyTables_t; + +typedef struct { + long long unsigned int frameContentSize; + unsigned int windowSize; + unsigned int dictID; + unsigned int checksumFlag; +} ZSTD_frameParams; + +typedef enum { + bt_raw = 0, + bt_rle = 1, + bt_compressed = 2, + bt_reserved = 3, +} blockType_e; + +typedef enum { + ZSTDds_getFrameHeaderSize = 0, + ZSTDds_decodeFrameHeader = 1, + ZSTDds_decodeBlockHeader = 2, + ZSTDds_decompressBlock = 3, + ZSTDds_decompressLastBlock = 4, + ZSTDds_checkChecksum = 5, + ZSTDds_decodeSkippableHeader = 6, + ZSTDds_skipFrame = 7, +} ZSTD_dStage; + +struct ZSTD_DCtx_s { + const FSE_DTable *LLTptr; + const FSE_DTable *MLTptr; + const FSE_DTable *OFTptr; + const HUF_DTable *HUFptr; + ZSTD_entropyTables_t entropy; + const void *previousDstEnd; + const void *base; + const void *vBase; + const void *dictEnd; + size_t expected; + ZSTD_frameParams fParams; + blockType_e bType; + ZSTD_dStage stage; + U32 litEntropy; + U32 fseEntropy; + struct xxh64_state xxhState; + size_t headerSize; + U32 dictID; + const BYTE *litPtr; + ZSTD_customMem customMem; + size_t litSize; + size_t rleSize; + BYTE litBuffer[131080]; + BYTE headerBuffer[18]; +}; + +typedef struct ZSTD_DCtx_s ZSTD_DCtx; + +struct ZSTD_DDict_s { + void *dictBuffer; + const void *dictContent; + size_t dictSize; + ZSTD_entropyTables_t entropy; + U32 dictID; + U32 entropyPresent; + ZSTD_customMem cMem; +}; + +typedef struct ZSTD_DDict_s ZSTD_DDict; + +typedef enum { + zdss_init = 0, + zdss_loadHeader = 1, + zdss_read = 2, + zdss_load = 3, + zdss_flush = 4, +} ZSTD_dStreamStage; + +struct ZSTD_DStream_s___2 { + ZSTD_DCtx *dctx; + ZSTD_DDict *ddictLocal; + const ZSTD_DDict *ddict; + ZSTD_frameParams fParams; + ZSTD_dStreamStage stage; + char *inBuff; + size_t inBuffSize; + size_t inPos; + size_t maxWindowSize; + char *outBuff; + size_t outBuffSize; + size_t outStart; + size_t outEnd; + size_t blockSize; + BYTE headerBuffer[18]; + size_t lhSize; + ZSTD_customMem customMem; + void *legacyContext; + U32 previousLegacyVersion; + U32 legacyVersion; + U32 hostageByte; +}; + +typedef struct ZSTD_DStream_s___2 ZSTD_DStream___2; + +typedef enum { + ZSTDnit_frameHeader = 0, + ZSTDnit_blockHeader = 1, + ZSTDnit_block = 2, + ZSTDnit_lastBlock = 3, + ZSTDnit_checksum = 4, + ZSTDnit_skippableFrame = 5, +} ZSTD_nextInputType_e; + +typedef uintptr_t uPtrDiff; + +typedef struct { + blockType_e blockType; + U32 lastBlock; + U32 origSize; +} blockProperties_t; + +typedef union { + FSE_decode_t realData; + U32 alignedBy4; +} FSE_decode_t4; + +typedef struct { + size_t litLength; + size_t matchLength; + size_t offset; + const BYTE *match; +} seq_t; + +typedef struct { + BIT_DStream_t DStream; + FSE_DState_t stateLL; + FSE_DState_t stateOffb; + FSE_DState_t stateML; + size_t prevOffset[3]; + const BYTE *base; + size_t pos; + uPtrDiff gotoDict; +} seqState_t; + +enum xz_mode { + XZ_SINGLE = 0, + XZ_PREALLOC = 1, + XZ_DYNALLOC = 2, +}; + +enum xz_ret { + XZ_OK = 0, + XZ_STREAM_END = 1, + XZ_UNSUPPORTED_CHECK = 2, + XZ_MEM_ERROR = 3, + XZ_MEMLIMIT_ERROR = 4, + XZ_FORMAT_ERROR = 5, + XZ_OPTIONS_ERROR = 6, + XZ_DATA_ERROR = 7, + XZ_BUF_ERROR = 8, +}; + +struct xz_buf { + const uint8_t *in; + size_t in_pos; + size_t in_size; + uint8_t *out; + size_t out_pos; + size_t out_size; +}; + +struct xz_dec; + +typedef uint64_t vli_type; + +enum xz_check { + XZ_CHECK_NONE = 0, + XZ_CHECK_CRC32 = 1, + XZ_CHECK_CRC64 = 4, + XZ_CHECK_SHA256 = 10, +}; + +struct xz_dec_hash { + vli_type unpadded; + vli_type uncompressed; + uint32_t crc32; +}; + +struct xz_dec_lzma2; + +struct xz_dec_bcj; + +struct xz_dec___2 { + enum { + SEQ_STREAM_HEADER = 0, + SEQ_BLOCK_START = 1, + SEQ_BLOCK_HEADER = 2, + SEQ_BLOCK_UNCOMPRESS = 3, + SEQ_BLOCK_PADDING = 4, + SEQ_BLOCK_CHECK = 5, + SEQ_INDEX = 6, + SEQ_INDEX_PADDING = 7, + SEQ_INDEX_CRC32 = 8, + SEQ_STREAM_FOOTER = 9, + } sequence; + uint32_t pos; + vli_type vli; + size_t in_start; + size_t out_start; + uint32_t crc32; + enum xz_check check_type; + enum xz_mode mode; + bool allow_buf_error; + struct { + vli_type compressed; + vli_type uncompressed; + uint32_t size; + } block_header; + struct { + vli_type compressed; + vli_type uncompressed; + vli_type count; + struct xz_dec_hash hash; + } block; + struct { + enum { + SEQ_INDEX_COUNT = 0, + SEQ_INDEX_UNPADDED = 1, + SEQ_INDEX_UNCOMPRESSED = 2, + } sequence; + vli_type size; + vli_type count; + struct xz_dec_hash hash; + } index; + struct { + size_t pos; + size_t size; + uint8_t buf[1024]; + } temp; + struct xz_dec_lzma2 *lzma2; + struct xz_dec_bcj *bcj; + bool bcj_active; +}; + +enum lzma_state { + STATE_LIT_LIT = 0, + STATE_MATCH_LIT_LIT = 1, + STATE_REP_LIT_LIT = 2, + STATE_SHORTREP_LIT_LIT = 3, + STATE_MATCH_LIT = 4, + STATE_REP_LIT = 5, + STATE_SHORTREP_LIT = 6, + STATE_LIT_MATCH = 7, + STATE_LIT_LONGREP = 8, + STATE_LIT_SHORTREP = 9, + STATE_NONLIT_MATCH = 10, + STATE_NONLIT_REP = 11, +}; + +struct dictionary { + uint8_t *buf; + size_t start; + size_t pos; + size_t full; + size_t limit; + size_t end; + uint32_t size; + uint32_t size_max; + uint32_t allocated; + enum xz_mode mode; +}; + +struct rc_dec { + uint32_t range; + uint32_t code; + uint32_t init_bytes_left; + const uint8_t *in; + size_t in_pos; + size_t in_limit; +}; + +struct lzma_len_dec { + uint16_t choice; + uint16_t choice2; + uint16_t low[128]; + uint16_t mid[128]; + uint16_t high[256]; +}; + +struct lzma_dec { + uint32_t rep0; + uint32_t rep1; + uint32_t rep2; + uint32_t rep3; + enum lzma_state state; + uint32_t len; + uint32_t lc; + uint32_t literal_pos_mask; + uint32_t pos_mask; + uint16_t is_match[192]; + uint16_t is_rep[12]; + uint16_t is_rep0[12]; + uint16_t is_rep1[12]; + uint16_t is_rep2[12]; + uint16_t is_rep0_long[192]; + uint16_t dist_slot[256]; + uint16_t dist_special[114]; + uint16_t dist_align[16]; + struct lzma_len_dec match_len_dec; + struct lzma_len_dec rep_len_dec; + uint16_t literal[12288]; +}; + +enum lzma2_seq { + SEQ_CONTROL = 0, + SEQ_UNCOMPRESSED_1 = 1, + SEQ_UNCOMPRESSED_2 = 2, + SEQ_COMPRESSED_0 = 3, + SEQ_COMPRESSED_1 = 4, + SEQ_PROPERTIES = 5, + SEQ_LZMA_PREPARE = 6, + SEQ_LZMA_RUN = 7, + SEQ_COPY = 8, +}; + +struct lzma2_dec { + enum lzma2_seq sequence; + enum lzma2_seq next_sequence; + uint32_t uncompressed; + uint32_t compressed; + bool need_dict_reset; + bool need_props; +}; + +struct xz_dec_lzma2___2 { + struct rc_dec rc; + struct dictionary dict; + struct lzma2_dec lzma2; + struct lzma_dec lzma; + struct { + uint32_t size; + uint8_t buf[63]; + } temp; +}; + +struct xz_dec_bcj___2 { + enum { + BCJ_X86 = 4, + BCJ_POWERPC = 5, + BCJ_IA64 = 6, + BCJ_ARM = 7, + BCJ_ARMTHUMB = 8, + BCJ_SPARC = 9, + } type; + enum xz_ret ret; + bool single_call; + uint32_t pos; + uint32_t x86_prev_mask; + uint8_t *out; + size_t out_pos; + size_t out_size; + struct { + size_t filtered; + size_t size; + uint8_t buf[16]; + } temp; +}; + +struct raid6_recov_calls { + void (*data2)(int, size_t, int, int, void **); + void (*datap)(int, size_t, int, void **); + int (*valid)(); + const char *name; + int priority; +}; + +typedef u64 unative_t; + +struct raid6_sse_constants { + u64 x1d[2]; +}; + +struct raid6_avx2_constants { + u64 x1d[4]; +}; + +struct raid6_avx512_constants { + u64 x1d[8]; +}; + +struct ts_state { + unsigned int offset; + char cb[48]; +}; + +struct ts_config; + +struct ts_ops { + const char *name; + struct ts_config * (*init)(const void *, unsigned int, gfp_t, int); + unsigned int (*find)(struct ts_config *, struct ts_state *); + void (*destroy)(struct ts_config *); + void * (*get_pattern)(struct ts_config *); + unsigned int (*get_pattern_len)(struct ts_config *); + struct module *owner; + struct list_head list; +}; + +struct ts_config { + struct ts_ops *ops; + int flags; + unsigned int (*get_next_block)(unsigned int, const u8 **, struct ts_config *, struct ts_state *); + void (*finish)(struct ts_config *, struct ts_state *); +}; + +struct ts_linear_state { + unsigned int len; + const void *data; +}; + +struct ei_entry { + struct list_head list; + long unsigned int start_addr; + long unsigned int end_addr; + int etype; + void *priv; +}; + +struct ddebug_table { + struct list_head link; + const char *mod_name; + unsigned int num_ddebugs; + struct _ddebug *ddebugs; +}; + +struct ddebug_query { + const char *filename; + const char *module; + const char *function; + const char *format; + unsigned int first_lineno; + unsigned int last_lineno; +}; + +struct ddebug_iter { + struct ddebug_table *table; + unsigned int idx; +}; + +struct flag_settings { + unsigned int flags; + unsigned int mask; +}; + +struct flagsbuf { + char buf[7]; +}; + +struct nla_bitfield32 { + __u32 value; + __u32 selector; +}; + +enum nla_policy_validation { + NLA_VALIDATE_NONE = 0, + NLA_VALIDATE_RANGE = 1, + NLA_VALIDATE_RANGE_WARN_TOO_LONG = 2, + NLA_VALIDATE_MIN = 3, + NLA_VALIDATE_MAX = 4, + NLA_VALIDATE_MASK = 5, + NLA_VALIDATE_RANGE_PTR = 6, + NLA_VALIDATE_FUNCTION = 7, +}; + +enum netlink_validation { + NL_VALIDATE_LIBERAL = 0, + NL_VALIDATE_TRAILING = 1, + NL_VALIDATE_MAXTYPE = 2, + NL_VALIDATE_UNSPEC = 4, + NL_VALIDATE_STRICT_ATTRS = 8, + NL_VALIDATE_NESTED = 16, +}; + +struct cpu_rmap { + struct kref refcount; + u16 size; + u16 used; + void **obj; + struct { + u16 index; + u16 dist; + } near[0]; +}; + +struct irq_glue { + struct irq_affinity_notify notify; + struct cpu_rmap *rmap; + u16 index; +}; + +typedef mpi_limb_t *mpi_ptr_t; + +typedef int mpi_size_t; + +typedef mpi_limb_t UWtype; + +typedef unsigned int UHWtype; + +enum gcry_mpi_constants { + MPI_C_ZERO = 0, + MPI_C_ONE = 1, + MPI_C_TWO = 2, + MPI_C_THREE = 3, + MPI_C_FOUR = 4, + MPI_C_EIGHT = 5, +}; + +struct barrett_ctx_s; + +typedef struct barrett_ctx_s *mpi_barrett_t; + +struct gcry_mpi_point { + MPI x; + MPI y; + MPI z; +}; + +typedef struct gcry_mpi_point *MPI_POINT; + +enum gcry_mpi_ec_models { + MPI_EC_WEIERSTRASS = 0, + MPI_EC_MONTGOMERY = 1, + MPI_EC_EDWARDS = 2, +}; + +enum ecc_dialects { + ECC_DIALECT_STANDARD = 0, + ECC_DIALECT_ED25519 = 1, + ECC_DIALECT_SAFECURVE = 2, +}; + +struct mpi_ec_ctx { + enum gcry_mpi_ec_models model; + enum ecc_dialects dialect; + int flags; + unsigned int nbits; + MPI p; + MPI a; + MPI b; + MPI_POINT G; + MPI n; + unsigned int h; + MPI_POINT Q; + MPI d; + const char *name; + struct { + struct { + unsigned int a_is_pminus3: 1; + unsigned int two_inv_p: 1; + } valid; + int a_is_pminus3; + MPI two_inv_p; + mpi_barrett_t p_barrett; + MPI scratch[11]; + } t; + void (*addm)(MPI, MPI, MPI, struct mpi_ec_ctx *); + void (*subm)(MPI, MPI, MPI, struct mpi_ec_ctx *); + void (*mulm)(MPI, MPI, MPI, struct mpi_ec_ctx *); + void (*pow2)(MPI, const MPI, struct mpi_ec_ctx *); + void (*mul2)(MPI, MPI, struct mpi_ec_ctx *); +}; + +struct field_table { + const char *p; + void (*addm)(MPI, MPI, MPI, struct mpi_ec_ctx *); + void (*subm)(MPI, MPI, MPI, struct mpi_ec_ctx *); + void (*mulm)(MPI, MPI, MPI, struct mpi_ec_ctx *); + void (*mul2)(MPI, MPI, struct mpi_ec_ctx *); + void (*pow2)(MPI, const MPI, struct mpi_ec_ctx *); +}; + +enum gcry_mpi_format { + GCRYMPI_FMT_NONE = 0, + GCRYMPI_FMT_STD = 1, + GCRYMPI_FMT_PGP = 2, + GCRYMPI_FMT_SSH = 3, + GCRYMPI_FMT_HEX = 4, + GCRYMPI_FMT_USG = 5, + GCRYMPI_FMT_OPAQUE = 8, +}; + +struct barrett_ctx_s___2; + +typedef struct barrett_ctx_s___2 *mpi_barrett_t___2; + +struct barrett_ctx_s___2 { + MPI m; + int m_copied; + int k; + MPI y; + MPI r1; + MPI r2; + MPI r3; +}; + +struct karatsuba_ctx { + struct karatsuba_ctx *next; + mpi_ptr_t tspace; + mpi_size_t tspace_size; + mpi_ptr_t tp; + mpi_size_t tp_size; +}; + +typedef long int mpi_limb_signed_t; + +enum dim_tune_state { + DIM_PARKING_ON_TOP = 0, + DIM_PARKING_TIRED = 1, + DIM_GOING_RIGHT = 2, + DIM_GOING_LEFT = 3, +}; + +struct dim_cq_moder { + u16 usec; + u16 pkts; + u16 comps; + u8 cq_period_mode; +}; + +enum dim_cq_period_mode { + DIM_CQ_PERIOD_MODE_START_FROM_EQE = 0, + DIM_CQ_PERIOD_MODE_START_FROM_CQE = 1, + DIM_CQ_PERIOD_NUM_MODES = 2, +}; + +enum dim_state { + DIM_START_MEASURE = 0, + DIM_MEASURE_IN_PROGRESS = 1, + DIM_APPLY_NEW_PROFILE = 2, +}; + +enum dim_stats_state { + DIM_STATS_WORSE = 0, + DIM_STATS_SAME = 1, + DIM_STATS_BETTER = 2, +}; + +enum dim_step_result { + DIM_STEPPED = 0, + DIM_TOO_TIRED = 1, + DIM_ON_EDGE = 2, +}; + +enum pubkey_algo { + PUBKEY_ALGO_RSA = 0, + PUBKEY_ALGO_MAX = 1, +}; + +struct pubkey_hdr { + uint8_t version; + uint32_t timestamp; + uint8_t algo; + uint8_t nmpi; + char mpi[0]; +} __attribute__((packed)); + +struct signature_hdr { + uint8_t version; + uint32_t timestamp; + uint8_t algo; + uint8_t hash; + uint8_t keyid[8]; + uint8_t nmpi; + char mpi[0]; +} __attribute__((packed)); + +struct sg_pool { + size_t size; + char *name; + struct kmem_cache *slab; + mempool_t *pool; +}; + +enum { + IRQ_POLL_F_SCHED = 0, + IRQ_POLL_F_DISABLE = 1, +}; + +struct font_desc { + int idx; + const char *name; + unsigned int width; + unsigned int height; + unsigned int charcount; + const void *data; + int pref; +}; + +struct font_data { + unsigned int extra[4]; + const unsigned char data[0]; +}; + +struct pldmfw_record { + struct list_head entry; + struct list_head descs; + const u8 *version_string; + u8 version_type; + u8 version_len; + u16 package_data_len; + u32 device_update_flags; + const u8 *package_data; + long unsigned int *component_bitmap; + u16 component_bitmap_len; +}; + +struct pldmfw_desc_tlv { + struct list_head entry; + const u8 *data; + u16 type; + u16 size; +}; + +struct pldmfw_component { + struct list_head entry; + u16 classification; + u16 identifier; + u16 options; + u16 activation_method; + u32 comparison_stamp; + u32 component_size; + const u8 *component_data; + const u8 *version_string; + u8 version_type; + u8 version_len; + u8 index; +}; + +struct pldmfw_ops; + +struct pldmfw { + const struct pldmfw_ops *ops; + struct device *dev; +}; + +struct pldmfw_ops { + bool (*match_record)(struct pldmfw *, struct pldmfw_record *); + int (*send_package_data)(struct pldmfw *, const u8 *, u16); + int (*send_component_table)(struct pldmfw *, struct pldmfw_component *, u8); + int (*flash_component)(struct pldmfw *, struct pldmfw_component *); + int (*finalize_update)(struct pldmfw *); +}; + +struct __pldm_timestamp { + u8 b[13]; +}; + +struct __pldm_header { + uuid_t id; + u8 revision; + __le16 size; + struct __pldm_timestamp release_date; + __le16 component_bitmap_len; + u8 version_type; + u8 version_len; + u8 version_string[0]; +} __attribute__((packed)); + +struct __pldmfw_record_info { + __le16 record_len; + u8 descriptor_count; + __le32 device_update_flags; + u8 version_type; + u8 version_len; + __le16 package_data_len; + u8 variable_record_data[0]; +} __attribute__((packed)); + +struct __pldmfw_desc_tlv { + __le16 type; + __le16 size; + u8 data[0]; +}; + +struct __pldmfw_record_area { + u8 record_count; + u8 records[0]; +}; + +struct __pldmfw_component_info { + __le16 classification; + __le16 identifier; + __le32 comparison_stamp; + __le16 options; + __le16 activation_method; + __le32 location_offset; + __le32 size; + u8 version_type; + u8 version_len; + u8 version_string[0]; +} __attribute__((packed)); + +struct __pldmfw_component_area { + __le16 component_image_count; + u8 components[0]; +}; + +struct pldmfw_priv { + struct pldmfw *context; + const struct firmware *fw; + size_t offset; + struct list_head records; + struct list_head components; + const struct __pldm_header *header; + u16 total_header_size; + u16 component_bitmap_len; + u16 bitmap_size; + u16 component_count; + const u8 *component_start; + const u8 *record_start; + u8 record_count; + u32 header_crc; + struct pldmfw_record *matching_record; +}; + +struct pldm_pci_record_id { + int vendor; + int device; + int subsystem_vendor; + int subsystem_device; +}; + +struct msr { + union { + struct { + u32 l; + u32 h; + }; + u64 q; + }; +}; + +struct msr_info { + u32 msr_no; + struct msr reg; + struct msr *msrs; + int err; +}; + +struct msr_regs_info { + u32 *regs; + int err; +}; + +struct msr_info_completion { + struct msr_info msr; + struct completion done; +}; + +struct trace_event_raw_msr_trace_class { + struct trace_entry ent; + unsigned int msr; + u64 val; + int failed; + char __data[0]; +}; + +struct trace_event_data_offsets_msr_trace_class {}; + +typedef void (*btf_trace_read_msr)(void *, unsigned int, u64, int); + +typedef void (*btf_trace_write_msr)(void *, unsigned int, u64, int); + +typedef void (*btf_trace_rdpmc)(void *, unsigned int, u64, int); + +struct warn_args___2; + +struct compress_format { + unsigned char magic[2]; + const char *name; + decompress_fn decompressor; +}; + +struct group_data { + int limit[21]; + int base[20]; + int permute[258]; + int minLen; + int maxLen; +}; + +struct bunzip_data { + int writeCopies; + int writePos; + int writeRunCountdown; + int writeCount; + int writeCurrent; + long int (*fill)(void *, long unsigned int); + long int inbufCount; + long int inbufPos; + unsigned char *inbuf; + unsigned int inbufBitCount; + unsigned int inbufBits; + unsigned int crc32Table[256]; + unsigned int headerCRC; + unsigned int totalCRC; + unsigned int writeCRC; + unsigned int *dbuf; + unsigned int dbufSize; + unsigned char selectors[32768]; + struct group_data groups[6]; + int io_error; + int byteCount[256]; + unsigned char symToByte[256]; + unsigned char mtfSymbol[256]; +}; + +struct rc { + long int (*fill)(void *, long unsigned int); + uint8_t *ptr; + uint8_t *buffer; + uint8_t *buffer_end; + long int buffer_size; + uint32_t code; + uint32_t range; + uint32_t bound; + void (*error)(char *); +}; + +struct lzma_header { + uint8_t pos; + uint32_t dict_size; + uint64_t dst_size; +} __attribute__((packed)); + +struct writer { + uint8_t *buffer; + uint8_t previous_byte; + size_t buffer_pos; + int bufsize; + size_t global_pos; + long int (*flush)(void *, long unsigned int); + struct lzma_header *header; +}; + +struct cstate { + int state; + uint32_t rep0; + uint32_t rep1; + uint32_t rep2; + uint32_t rep3; +}; + +struct ZSTD_DCtx_s___2; + +typedef struct ZSTD_DCtx_s___2 ZSTD_DCtx___2; + +enum cpio_fields { + C_MAGIC = 0, + C_INO = 1, + C_MODE = 2, + C_UID = 3, + C_GID = 4, + C_NLINK = 5, + C_MTIME = 6, + C_FILESIZE = 7, + C_MAJ = 8, + C_MIN = 9, + C_RMAJ = 10, + C_RMIN = 11, + C_NAMESIZE = 12, + C_CHKSUM = 13, + C_NFIELDS = 14, +}; + +struct fprop_local_single { + long unsigned int events; + unsigned int period; + raw_spinlock_t lock; +}; + +struct ida_bitmap { + long unsigned int bitmap[16]; +}; + +struct klist_waiter { + struct list_head list; + struct klist_node *node; + struct task_struct *process; + int woken; +}; + +struct uevent_sock { + struct list_head list; + struct sock *sk; +}; + +enum { + LOGIC_PIO_INDIRECT = 0, + LOGIC_PIO_CPU_MMIO = 1, +}; + +struct logic_pio_host_ops; + +struct logic_pio_hwaddr { + struct list_head list; + struct fwnode_handle *fwnode; + resource_size_t hw_start; + resource_size_t io_start; + resource_size_t size; + long unsigned int flags; + void *hostdata; + const struct logic_pio_host_ops *ops; +}; + +struct logic_pio_host_ops { + u32 (*in)(void *, long unsigned int, size_t); + void (*out)(void *, long unsigned int, u32, size_t); + u32 (*ins)(void *, long unsigned int, void *, size_t, unsigned int); + void (*outs)(void *, long unsigned int, const void *, size_t, unsigned int); +}; + +typedef struct { + long unsigned int key[2]; +} hsiphash_key_t; + +struct clk_core; + +struct clk { + struct clk_core *core; + struct device *dev; + const char *dev_id; + const char *con_id; + long unsigned int min_rate; + long unsigned int max_rate; + unsigned int exclusive_count; + struct hlist_node clks_node; +}; + +enum format_type { + FORMAT_TYPE_NONE = 0, + FORMAT_TYPE_WIDTH = 1, + FORMAT_TYPE_PRECISION = 2, + FORMAT_TYPE_CHAR = 3, + FORMAT_TYPE_STR = 4, + FORMAT_TYPE_PTR = 5, + FORMAT_TYPE_PERCENT_CHAR = 6, + FORMAT_TYPE_INVALID = 7, + FORMAT_TYPE_LONG_LONG = 8, + FORMAT_TYPE_ULONG = 9, + FORMAT_TYPE_LONG = 10, + FORMAT_TYPE_UBYTE = 11, + FORMAT_TYPE_BYTE = 12, + FORMAT_TYPE_USHORT = 13, + FORMAT_TYPE_SHORT = 14, + FORMAT_TYPE_UINT = 15, + FORMAT_TYPE_INT = 16, + FORMAT_TYPE_SIZE_T = 17, + FORMAT_TYPE_PTRDIFF = 18, +}; + +struct printf_spec { + unsigned int type: 8; + int field_width: 24; + unsigned int flags: 8; + unsigned int base: 8; + int precision: 16; +}; + +struct minmax_sample { + u32 t; + u32 v; +}; + +struct minmax { + struct minmax_sample s[3]; +}; + +struct xa_limit { + u32 max; + u32 min; +}; + +enum { + st_wordstart = 0, + st_wordcmp = 1, + st_wordskip = 2, + st_bufcpy = 3, +}; + +enum { + st_wordstart___2 = 0, + st_wordcmp___2 = 1, + st_wordskip___2 = 2, +}; + +struct in6_addr___2; + +enum reg_type { + REG_TYPE_RM = 0, + REG_TYPE_REG = 1, + REG_TYPE_INDEX = 2, + REG_TYPE_BASE = 3, +}; + +enum device_link_state { + DL_STATE_NONE = 4294967295, + DL_STATE_DORMANT = 0, + DL_STATE_AVAILABLE = 1, + DL_STATE_CONSUMER_PROBE = 2, + DL_STATE_ACTIVE = 3, + DL_STATE_SUPPLIER_UNBIND = 4, +}; + +struct device_link { + struct device *supplier; + struct list_head s_node; + struct device *consumer; + struct list_head c_node; + struct device link_dev; + enum device_link_state status; + u32 flags; + refcount_t rpm_active; + struct kref kref; + struct callback_head callback_head; + bool supplier_preactivated; +}; + +struct phy_configure_opts_dp { + unsigned int link_rate; + unsigned int lanes; + unsigned int voltage[4]; + unsigned int pre[4]; + u8 ssc: 1; + u8 set_rate: 1; + u8 set_lanes: 1; + u8 set_voltages: 1; +}; + +struct phy_configure_opts_mipi_dphy { + unsigned int clk_miss; + unsigned int clk_post; + unsigned int clk_pre; + unsigned int clk_prepare; + unsigned int clk_settle; + unsigned int clk_term_en; + unsigned int clk_trail; + unsigned int clk_zero; + unsigned int d_term_en; + unsigned int eot; + unsigned int hs_exit; + unsigned int hs_prepare; + unsigned int hs_settle; + unsigned int hs_skip; + unsigned int hs_trail; + unsigned int hs_zero; + unsigned int init; + unsigned int lpx; + unsigned int ta_get; + unsigned int ta_go; + unsigned int ta_sure; + unsigned int wakeup; + long unsigned int hs_clk_rate; + long unsigned int lp_clk_rate; + unsigned char lanes; +}; + +enum phy_mode { + PHY_MODE_INVALID = 0, + PHY_MODE_USB_HOST = 1, + PHY_MODE_USB_HOST_LS = 2, + PHY_MODE_USB_HOST_FS = 3, + PHY_MODE_USB_HOST_HS = 4, + PHY_MODE_USB_HOST_SS = 5, + PHY_MODE_USB_DEVICE = 6, + PHY_MODE_USB_DEVICE_LS = 7, + PHY_MODE_USB_DEVICE_FS = 8, + PHY_MODE_USB_DEVICE_HS = 9, + PHY_MODE_USB_DEVICE_SS = 10, + PHY_MODE_USB_OTG = 11, + PHY_MODE_UFS_HS_A = 12, + PHY_MODE_UFS_HS_B = 13, + PHY_MODE_PCIE = 14, + PHY_MODE_ETHERNET = 15, + PHY_MODE_MIPI_DPHY = 16, + PHY_MODE_SATA = 17, + PHY_MODE_LVDS = 18, + PHY_MODE_DP = 19, +}; + +union phy_configure_opts { + struct phy_configure_opts_mipi_dphy mipi_dphy; + struct phy_configure_opts_dp dp; +}; + +struct phy; + +struct phy_ops { + int (*init)(struct phy *); + int (*exit)(struct phy *); + int (*power_on)(struct phy *); + int (*power_off)(struct phy *); + int (*set_mode)(struct phy *, enum phy_mode, int); + int (*configure)(struct phy *, union phy_configure_opts *); + int (*validate)(struct phy *, enum phy_mode, int, union phy_configure_opts *); + int (*reset)(struct phy *); + int (*calibrate)(struct phy *); + void (*release)(struct phy *); + struct module *owner; +}; + +struct phy_attrs { + u32 bus_width; + u32 max_link_rate; + enum phy_mode mode; +}; + +struct regulator; + +struct phy { + struct device dev; + int id; + const struct phy_ops *ops; + struct mutex mutex; + int init_count; + int power_count; + struct phy_attrs attrs; + struct regulator *pwr; +}; + +struct phy_provider { + struct device *dev; + struct device_node *children; + struct module *owner; + struct list_head list; + struct phy * (*of_xlate)(struct device *, struct of_phandle_args *); +}; + +struct phy_lookup { + struct list_head node; + const char *dev_id; + const char *con_id; + struct phy *phy; +}; + +struct pinctrl; + +struct pinctrl_state; + +struct dev_pin_info { + struct pinctrl *p; + struct pinctrl_state *default_state; + struct pinctrl_state *init_state; + struct pinctrl_state *sleep_state; + struct pinctrl_state *idle_state; +}; + +struct pinctrl { + struct list_head node; + struct device *dev; + struct list_head states; + struct pinctrl_state *state; + struct list_head dt_maps; + struct kref users; +}; + +struct pinctrl_state { + struct list_head node; + const char *name; + struct list_head settings; +}; + +struct pinctrl_pin_desc { + unsigned int number; + const char *name; + void *drv_data; +}; + +struct gpio_chip; + +struct pinctrl_gpio_range { + struct list_head node; + const char *name; + unsigned int id; + unsigned int base; + unsigned int pin_base; + unsigned int npins; + const unsigned int *pins; + struct gpio_chip *gc; +}; + +struct gpio_irq_chip { + struct irq_chip *chip; + struct irq_domain *domain; + const struct irq_domain_ops *domain_ops; + struct fwnode_handle *fwnode; + struct irq_domain *parent_domain; + int (*child_to_parent_hwirq)(struct gpio_chip *, unsigned int, unsigned int, unsigned int *, unsigned int *); + void * (*populate_parent_alloc_arg)(struct gpio_chip *, unsigned int, unsigned int); + unsigned int (*child_offset_to_irq)(struct gpio_chip *, unsigned int); + struct irq_domain_ops child_irq_domain_ops; + irq_flow_handler_t handler; + unsigned int default_type; + struct lock_class_key *lock_key; + struct lock_class_key *request_key; + irq_flow_handler_t parent_handler; + void *parent_handler_data; + unsigned int num_parents; + unsigned int *parents; + unsigned int *map; + bool threaded; + int (*init_hw)(struct gpio_chip *); + void (*init_valid_mask)(struct gpio_chip *, long unsigned int *, unsigned int); + long unsigned int *valid_mask; + unsigned int first; + void (*irq_enable)(struct irq_data *); + void (*irq_disable)(struct irq_data *); + void (*irq_unmask)(struct irq_data *); + void (*irq_mask)(struct irq_data *); +}; + +struct gpio_device; + +struct gpio_chip { + const char *label; + struct gpio_device *gpiodev; + struct device *parent; + struct module *owner; + int (*request)(struct gpio_chip *, unsigned int); + void (*free)(struct gpio_chip *, unsigned int); + int (*get_direction)(struct gpio_chip *, unsigned int); + int (*direction_input)(struct gpio_chip *, unsigned int); + int (*direction_output)(struct gpio_chip *, unsigned int, int); + int (*get)(struct gpio_chip *, unsigned int); + int (*get_multiple)(struct gpio_chip *, long unsigned int *, long unsigned int *); + void (*set)(struct gpio_chip *, unsigned int, int); + void (*set_multiple)(struct gpio_chip *, long unsigned int *, long unsigned int *); + int (*set_config)(struct gpio_chip *, unsigned int, long unsigned int); + int (*to_irq)(struct gpio_chip *, unsigned int); + void (*dbg_show)(struct seq_file *, struct gpio_chip *); + int (*init_valid_mask)(struct gpio_chip *, long unsigned int *, unsigned int); + int (*add_pin_ranges)(struct gpio_chip *); + int base; + u16 ngpio; + const char * const *names; + bool can_sleep; + long unsigned int (*read_reg)(void *); + void (*write_reg)(void *, long unsigned int); + bool be_bits; + void *reg_dat; + void *reg_set; + void *reg_clr; + void *reg_dir_out; + void *reg_dir_in; + bool bgpio_dir_unreadable; + int bgpio_bits; + spinlock_t bgpio_lock; + long unsigned int bgpio_data; + long unsigned int bgpio_dir; + struct gpio_irq_chip irq; + long unsigned int *valid_mask; +}; + +struct pinctrl_dev; + +struct pinctrl_map; + +struct pinctrl_ops { + int (*get_groups_count)(struct pinctrl_dev *); + const char * (*get_group_name)(struct pinctrl_dev *, unsigned int); + int (*get_group_pins)(struct pinctrl_dev *, unsigned int, const unsigned int **, unsigned int *); + void (*pin_dbg_show)(struct pinctrl_dev *, struct seq_file *, unsigned int); + int (*dt_node_to_map)(struct pinctrl_dev *, struct device_node *, struct pinctrl_map **, unsigned int *); + void (*dt_free_map)(struct pinctrl_dev *, struct pinctrl_map *, unsigned int); +}; + +struct pinctrl_desc; + +struct pinctrl_dev { + struct list_head node; + struct pinctrl_desc *desc; + struct xarray pin_desc_tree; + struct list_head gpio_ranges; + struct device *dev; + struct module *owner; + void *driver_data; + struct pinctrl *p; + struct pinctrl_state *hog_default; + struct pinctrl_state *hog_sleep; + struct mutex mutex; + struct dentry *device_root; +}; + +enum pinctrl_map_type { + PIN_MAP_TYPE_INVALID = 0, + PIN_MAP_TYPE_DUMMY_STATE = 1, + PIN_MAP_TYPE_MUX_GROUP = 2, + PIN_MAP_TYPE_CONFIGS_PIN = 3, + PIN_MAP_TYPE_CONFIGS_GROUP = 4, +}; + +struct pinctrl_map_mux { + const char *group; + const char *function; +}; + +struct pinctrl_map_configs { + const char *group_or_pin; + long unsigned int *configs; + unsigned int num_configs; +}; + +struct pinctrl_map { + const char *dev_name; + const char *name; + enum pinctrl_map_type type; + const char *ctrl_dev_name; + union { + struct pinctrl_map_mux mux; + struct pinctrl_map_configs configs; + } data; +}; + +struct pinmux_ops; + +struct pinconf_ops; + +struct pinconf_generic_params; + +struct pin_config_item; + +struct pinctrl_desc { + const char *name; + const struct pinctrl_pin_desc *pins; + unsigned int npins; + const struct pinctrl_ops *pctlops; + const struct pinmux_ops *pmxops; + const struct pinconf_ops *confops; + struct module *owner; + unsigned int num_custom_params; + const struct pinconf_generic_params *custom_params; + const struct pin_config_item *custom_conf_items; + bool link_consumers; +}; + +struct pinmux_ops { + int (*request)(struct pinctrl_dev *, unsigned int); + int (*free)(struct pinctrl_dev *, unsigned int); + int (*get_functions_count)(struct pinctrl_dev *); + const char * (*get_function_name)(struct pinctrl_dev *, unsigned int); + int (*get_function_groups)(struct pinctrl_dev *, unsigned int, const char * const **, unsigned int *); + int (*set_mux)(struct pinctrl_dev *, unsigned int, unsigned int); + int (*gpio_request_enable)(struct pinctrl_dev *, struct pinctrl_gpio_range *, unsigned int); + void (*gpio_disable_free)(struct pinctrl_dev *, struct pinctrl_gpio_range *, unsigned int); + int (*gpio_set_direction)(struct pinctrl_dev *, struct pinctrl_gpio_range *, unsigned int, bool); + bool strict; +}; + +struct pinconf_ops { + bool is_generic; + int (*pin_config_get)(struct pinctrl_dev *, unsigned int, long unsigned int *); + int (*pin_config_set)(struct pinctrl_dev *, unsigned int, long unsigned int *, unsigned int); + int (*pin_config_group_get)(struct pinctrl_dev *, unsigned int, long unsigned int *); + int (*pin_config_group_set)(struct pinctrl_dev *, unsigned int, long unsigned int *, unsigned int); + void (*pin_config_dbg_show)(struct pinctrl_dev *, struct seq_file *, unsigned int); + void (*pin_config_group_dbg_show)(struct pinctrl_dev *, struct seq_file *, unsigned int); + void (*pin_config_config_dbg_show)(struct pinctrl_dev *, struct seq_file *, long unsigned int); +}; + +enum pin_config_param { + PIN_CONFIG_BIAS_BUS_HOLD = 0, + PIN_CONFIG_BIAS_DISABLE = 1, + PIN_CONFIG_BIAS_HIGH_IMPEDANCE = 2, + PIN_CONFIG_BIAS_PULL_DOWN = 3, + PIN_CONFIG_BIAS_PULL_PIN_DEFAULT = 4, + PIN_CONFIG_BIAS_PULL_UP = 5, + PIN_CONFIG_DRIVE_OPEN_DRAIN = 6, + PIN_CONFIG_DRIVE_OPEN_SOURCE = 7, + PIN_CONFIG_DRIVE_PUSH_PULL = 8, + PIN_CONFIG_DRIVE_STRENGTH = 9, + PIN_CONFIG_DRIVE_STRENGTH_UA = 10, + PIN_CONFIG_INPUT_DEBOUNCE = 11, + PIN_CONFIG_INPUT_ENABLE = 12, + PIN_CONFIG_INPUT_SCHMITT = 13, + PIN_CONFIG_INPUT_SCHMITT_ENABLE = 14, + PIN_CONFIG_LOW_POWER_MODE = 15, + PIN_CONFIG_OUTPUT_ENABLE = 16, + PIN_CONFIG_OUTPUT = 17, + PIN_CONFIG_POWER_SOURCE = 18, + PIN_CONFIG_SLEEP_HARDWARE_STATE = 19, + PIN_CONFIG_SLEW_RATE = 20, + PIN_CONFIG_SKEW_DELAY = 21, + PIN_CONFIG_PERSIST_STATE = 22, + PIN_CONFIG_END = 127, + PIN_CONFIG_MAX = 255, +}; + +struct pinconf_generic_params { + const char * const property; + enum pin_config_param param; + u32 default_value; +}; + +struct pin_config_item { + const enum pin_config_param param; + const char * const display; + const char * const format; + bool has_arg; +}; + +struct gpio_desc; + +struct gpio_device { + int id; + struct device dev; + struct cdev chrdev; + struct device *mockdev; + struct module *owner; + struct gpio_chip *chip; + struct gpio_desc *descs; + int base; + u16 ngpio; + const char *label; + void *data; + struct list_head list; + struct blocking_notifier_head notifier; + struct list_head pin_ranges; +}; + +struct gpio_desc { + struct gpio_device *gdev; + long unsigned int flags; + const char *label; + const char *name; + unsigned int debounce_period_us; +}; + +struct pinctrl_setting_mux { + unsigned int group; + unsigned int func; +}; + +struct pinctrl_setting_configs { + unsigned int group_or_pin; + long unsigned int *configs; + unsigned int num_configs; +}; + +struct pinctrl_setting { + struct list_head node; + enum pinctrl_map_type type; + struct pinctrl_dev *pctldev; + const char *dev_name; + union { + struct pinctrl_setting_mux mux; + struct pinctrl_setting_configs configs; + } data; +}; + +struct pin_desc { + struct pinctrl_dev *pctldev; + const char *name; + bool dynamic_name; + void *drv_data; + unsigned int mux_usecount; + const char *mux_owner; + const struct pinctrl_setting_mux *mux_setting; + const char *gpio_owner; +}; + +struct pinctrl_maps { + struct list_head node; + const struct pinctrl_map *maps; + unsigned int num_maps; +}; + +struct pctldev; + +struct intel_pingroup { + const char *name; + const unsigned int *pins; + size_t npins; + short unsigned int mode; + const unsigned int *modes; +}; + +struct intel_function { + const char *name; + const char * const *groups; + size_t ngroups; +}; + +struct intel_padgroup { + unsigned int reg_num; + unsigned int base; + unsigned int size; + int gpio_base; + unsigned int padown_num; +}; + +struct intel_community { + unsigned int barno; + unsigned int padown_offset; + unsigned int padcfglock_offset; + unsigned int hostown_offset; + unsigned int is_offset; + unsigned int ie_offset; + unsigned int features; + unsigned int pin_base; + size_t npins; + unsigned int gpp_size; + unsigned int gpp_num_padown_regs; + const struct intel_padgroup *gpps; + size_t ngpps; + const unsigned int *pad_map; + short unsigned int nirqs; + short unsigned int acpi_space_id; + void *regs; + void *pad_regs; +}; + +struct intel_pinctrl_soc_data { + const char *uid; + const struct pinctrl_pin_desc *pins; + size_t npins; + const struct intel_pingroup *groups; + size_t ngroups; + const struct intel_function *functions; + size_t nfunctions; + const struct intel_community *communities; + size_t ncommunities; +}; + +struct intel_community_context; + +struct intel_pad_context; + +struct intel_pinctrl_context { + struct intel_pad_context *pads; + struct intel_community_context *communities; +}; + +struct intel_pad_context { + u32 conf0; + u32 val; +}; + +struct intel_pinctrl { + struct device *dev; + raw_spinlock_t lock; + struct pinctrl_desc pctldesc; + struct pinctrl_dev *pctldev; + struct gpio_chip chip; + struct irq_chip irqchip; + const struct intel_pinctrl_soc_data *soc; + struct intel_community *communities; + size_t ncommunities; + struct intel_pinctrl_context context; + int irq; +}; + +typedef acpi_status (*acpi_adr_space_handler)(u32, acpi_physical_address, u32, u64 *, void *, void *); + +typedef acpi_status (*acpi_adr_space_setup)(acpi_handle, u32, void *, void **); + +struct intel_pad_context___2; + +struct intel_community_context___2; + +struct intel_pinctrl_context___2 { + struct intel_pad_context___2 *pads; + struct intel_community_context___2 *communities; +}; + +struct intel_pad_context___2 { + u32 padctrl0; + u32 padctrl1; +}; + +struct intel_community_context___2 { + unsigned int intr_lines[16]; + u32 saved_intmask; +}; + +struct intel_pinctrl___2 { + struct device *dev; + raw_spinlock_t lock; + struct pinctrl_desc pctldesc; + struct pinctrl_dev *pctldev; + struct gpio_chip chip; + struct irq_chip irqchip; + const struct intel_pinctrl_soc_data *soc; + struct intel_community *communities; + size_t ncommunities; + struct intel_pinctrl_context___2 context; + int irq; +}; + +enum { + INTEL_GPIO_BASE_ZERO = 4294967294, + INTEL_GPIO_BASE_NOMAP = 4294967295, + INTEL_GPIO_BASE_MATCH = 0, +}; + +struct intel_pad_context___3; + +struct intel_community_context___3; + +struct intel_pinctrl_context___3 { + struct intel_pad_context___3 *pads; + struct intel_community_context___3 *communities; +}; + +struct intel_pad_context___3 { + u32 padcfg0; + u32 padcfg1; + u32 padcfg2; +}; + +struct intel_community_context___3 { + u32 *intmask; + u32 *hostown; +}; + +struct intel_pinctrl___3 { + struct device *dev; + raw_spinlock_t lock; + struct pinctrl_desc pctldesc; + struct pinctrl_dev *pctldev; + struct gpio_chip chip; + struct irq_chip irqchip; + const struct intel_pinctrl_soc_data *soc; + struct intel_community *communities; + size_t ncommunities; + struct intel_pinctrl_context___3 context; + int irq; +}; + +enum { + PAD_UNLOCKED = 0, + PAD_LOCKED = 1, + PAD_LOCKED_TX = 2, + PAD_LOCKED_FULL = 3, +}; + +struct gpio_pin_range { + struct list_head node; + struct pinctrl_dev *pctldev; + struct pinctrl_gpio_range range; +}; + +struct gpio_array; + +struct gpio_descs { + struct gpio_array *info; + unsigned int ndescs; + struct gpio_desc *desc[0]; +}; + +struct gpio_array { + struct gpio_desc **desc; + unsigned int size; + struct gpio_chip *chip; + long unsigned int *get_mask; + long unsigned int *set_mask; + long unsigned int invert_mask[0]; +}; + +enum gpiod_flags { + GPIOD_ASIS = 0, + GPIOD_IN = 1, + GPIOD_OUT_LOW = 3, + GPIOD_OUT_HIGH = 7, + GPIOD_OUT_LOW_OPEN_DRAIN = 11, + GPIOD_OUT_HIGH_OPEN_DRAIN = 15, +}; + +enum gpio_lookup_flags { + GPIO_ACTIVE_HIGH = 0, + GPIO_ACTIVE_LOW = 1, + GPIO_OPEN_DRAIN = 2, + GPIO_OPEN_SOURCE = 4, + GPIO_PERSISTENT = 0, + GPIO_TRANSITORY = 8, + GPIO_PULL_UP = 16, + GPIO_PULL_DOWN = 32, + GPIO_LOOKUP_FLAGS_DEFAULT = 0, +}; + +struct gpiod_lookup { + const char *key; + u16 chip_hwnum; + const char *con_id; + unsigned int idx; + long unsigned int flags; +}; + +struct gpiod_lookup_table { + struct list_head list; + const char *dev_id; + struct gpiod_lookup table[0]; +}; + +struct gpiod_hog { + struct list_head list; + const char *chip_label; + u16 chip_hwnum; + const char *line_name; + long unsigned int lflags; + int dflags; +}; + +enum { + GPIOLINE_CHANGED_REQUESTED = 1, + GPIOLINE_CHANGED_RELEASED = 2, + GPIOLINE_CHANGED_CONFIG = 3, +}; + +struct acpi_gpio_info { + struct acpi_device *adev; + enum gpiod_flags flags; + bool gpioint; + int pin_config; + int polarity; + int triggering; + unsigned int debounce; + unsigned int quirks; +}; + +struct trace_event_raw_gpio_direction { + struct trace_entry ent; + unsigned int gpio; + int in; + int err; + char __data[0]; +}; + +struct trace_event_raw_gpio_value { + struct trace_entry ent; + unsigned int gpio; + int get; + int value; + char __data[0]; +}; + +struct trace_event_data_offsets_gpio_direction {}; + +struct trace_event_data_offsets_gpio_value {}; + +typedef void (*btf_trace_gpio_direction)(void *, unsigned int, int, int); + +typedef void (*btf_trace_gpio_value)(void *, unsigned int, int, int); + +struct devres; + +struct gpio { + unsigned int gpio; + long unsigned int flags; + const char *label; +}; + +struct gpiochip_info { + char name[32]; + char label[32]; + __u32 lines; +}; + +enum gpio_v2_line_flag { + GPIO_V2_LINE_FLAG_USED = 1, + GPIO_V2_LINE_FLAG_ACTIVE_LOW = 2, + GPIO_V2_LINE_FLAG_INPUT = 4, + GPIO_V2_LINE_FLAG_OUTPUT = 8, + GPIO_V2_LINE_FLAG_EDGE_RISING = 16, + GPIO_V2_LINE_FLAG_EDGE_FALLING = 32, + GPIO_V2_LINE_FLAG_OPEN_DRAIN = 64, + GPIO_V2_LINE_FLAG_OPEN_SOURCE = 128, + GPIO_V2_LINE_FLAG_BIAS_PULL_UP = 256, + GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = 512, + GPIO_V2_LINE_FLAG_BIAS_DISABLED = 1024, + GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = 2048, +}; + +struct gpio_v2_line_values { + __u64 bits; + __u64 mask; +}; + +enum gpio_v2_line_attr_id { + GPIO_V2_LINE_ATTR_ID_FLAGS = 1, + GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES = 2, + GPIO_V2_LINE_ATTR_ID_DEBOUNCE = 3, +}; + +struct gpio_v2_line_attribute { + __u32 id; + __u32 padding; + union { + __u64 flags; + __u64 values; + __u32 debounce_period_us; + }; +}; + +struct gpio_v2_line_config_attribute { + struct gpio_v2_line_attribute attr; + __u64 mask; +}; + +struct gpio_v2_line_config { + __u64 flags; + __u32 num_attrs; + __u32 padding[5]; + struct gpio_v2_line_config_attribute attrs[10]; +}; + +struct gpio_v2_line_request { + __u32 offsets[64]; + char consumer[32]; + struct gpio_v2_line_config config; + __u32 num_lines; + __u32 event_buffer_size; + __u32 padding[5]; + __s32 fd; +}; + +struct gpio_v2_line_info { + char name[32]; + char consumer[32]; + __u32 offset; + __u32 num_attrs; + __u64 flags; + struct gpio_v2_line_attribute attrs[10]; + __u32 padding[4]; +}; + +enum gpio_v2_line_changed_type { + GPIO_V2_LINE_CHANGED_REQUESTED = 1, + GPIO_V2_LINE_CHANGED_RELEASED = 2, + GPIO_V2_LINE_CHANGED_CONFIG = 3, +}; + +struct gpio_v2_line_info_changed { + struct gpio_v2_line_info info; + __u64 timestamp_ns; + __u32 event_type; + __u32 padding[5]; +}; + +enum gpio_v2_line_event_id { + GPIO_V2_LINE_EVENT_RISING_EDGE = 1, + GPIO_V2_LINE_EVENT_FALLING_EDGE = 2, +}; + +struct gpio_v2_line_event { + __u64 timestamp_ns; + __u32 id; + __u32 offset; + __u32 seqno; + __u32 line_seqno; + __u32 padding[6]; +}; + +struct gpioline_info { + __u32 line_offset; + __u32 flags; + char name[32]; + char consumer[32]; +}; + +struct gpioline_info_changed { + struct gpioline_info info; + __u64 timestamp; + __u32 event_type; + __u32 padding[5]; +}; + +struct gpiohandle_request { + __u32 lineoffsets[64]; + __u32 flags; + __u8 default_values[64]; + char consumer_label[32]; + __u32 lines; + int fd; +}; + +struct gpiohandle_config { + __u32 flags; + __u8 default_values[64]; + __u32 padding[4]; +}; + +struct gpiohandle_data { + __u8 values[64]; +}; + +struct gpioevent_request { + __u32 lineoffset; + __u32 handleflags; + __u32 eventflags; + char consumer_label[32]; + int fd; +}; + +struct gpioevent_data { + __u64 timestamp; + __u32 id; +}; + +struct linehandle_state { + struct gpio_device *gdev; + const char *label; + struct gpio_desc *descs[64]; + u32 num_descs; +}; + +struct linereq; + +struct line { + struct gpio_desc *desc; + struct linereq *req; + unsigned int irq; + u64 eflags; + u64 timestamp_ns; + u32 req_seqno; + u32 line_seqno; + struct delayed_work work; + unsigned int sw_debounced; + unsigned int level; +}; + +struct linereq { + struct gpio_device *gdev; + const char *label; + u32 num_lines; + wait_queue_head_t wait; + u32 event_buffer_size; + struct { + union { + struct __kfifo kfifo; + struct gpio_v2_line_event *type; + const struct gpio_v2_line_event *const_type; + char (*rectype)[0]; + struct gpio_v2_line_event *ptr; + const struct gpio_v2_line_event *ptr_const; + }; + struct gpio_v2_line_event buf[0]; + } events; + atomic_t seqno; + struct mutex config_mutex; + struct line lines[0]; +}; + +struct lineevent_state { + struct gpio_device *gdev; + const char *label; + struct gpio_desc *desc; + u32 eflags; + int irq; + wait_queue_head_t wait; + struct { + union { + struct __kfifo kfifo; + struct gpioevent_data *type; + const struct gpioevent_data *const_type; + char (*rectype)[0]; + struct gpioevent_data *ptr; + const struct gpioevent_data *ptr_const; + }; + struct gpioevent_data buf[16]; + } events; + u64 timestamp; +}; + +struct gpio_chardev_data { + struct gpio_device *gdev; + wait_queue_head_t wait; + struct { + union { + struct __kfifo kfifo; + struct gpio_v2_line_info_changed *type; + const struct gpio_v2_line_info_changed *const_type; + char (*rectype)[0]; + struct gpio_v2_line_info_changed *ptr; + const struct gpio_v2_line_info_changed *ptr_const; + }; + struct gpio_v2_line_info_changed buf[32]; + } events; + struct notifier_block lineinfo_changed_nb; + long unsigned int *watched_lines; + atomic_t watch_abi_version; +}; + +typedef u64 acpi_size; + +struct acpi_buffer { + acpi_size length; + void *pointer; +}; + +typedef void (*acpi_object_handler)(acpi_handle, void *); + +struct acpi_connection_info { + u8 *connection; + u16 length; + u8 access_length; +}; + +struct acpi_resource_irq { + u8 descriptor_length; + u8 triggering; + u8 polarity; + u8 shareable; + u8 wake_capable; + u8 interrupt_count; + u8 interrupts[1]; +}; + +struct acpi_resource_dma { + u8 type; + u8 bus_master; + u8 transfer; + u8 channel_count; + u8 channels[1]; +}; + +struct acpi_resource_start_dependent { + u8 descriptor_length; + u8 compatibility_priority; + u8 performance_robustness; +}; + +struct acpi_resource_io { + u8 io_decode; + u8 alignment; + u8 address_length; + u16 minimum; + u16 maximum; +} __attribute__((packed)); + +struct acpi_resource_fixed_io { + u16 address; + u8 address_length; +} __attribute__((packed)); + +struct acpi_resource_fixed_dma { + u16 request_lines; + u16 channels; + u8 width; +} __attribute__((packed)); + +struct acpi_resource_vendor { + u16 byte_length; + u8 byte_data[1]; +} __attribute__((packed)); + +struct acpi_resource_vendor_typed { + u16 byte_length; + u8 uuid_subtype; + u8 uuid[16]; + u8 byte_data[1]; +}; + +struct acpi_resource_end_tag { + u8 checksum; +}; + +struct acpi_resource_memory24 { + u8 write_protect; + u16 minimum; + u16 maximum; + u16 alignment; + u16 address_length; +} __attribute__((packed)); + +struct acpi_resource_memory32 { + u8 write_protect; + u32 minimum; + u32 maximum; + u32 alignment; + u32 address_length; +} __attribute__((packed)); + +struct acpi_resource_fixed_memory32 { + u8 write_protect; + u32 address; + u32 address_length; +} __attribute__((packed)); + +struct acpi_memory_attribute { + u8 write_protect; + u8 caching; + u8 range_type; + u8 translation; +}; + +struct acpi_io_attribute { + u8 range_type; + u8 translation; + u8 translation_type; + u8 reserved1; +}; + +union acpi_resource_attribute { + struct acpi_memory_attribute mem; + struct acpi_io_attribute io; + u8 type_specific; +}; + +struct acpi_resource_label { + u16 string_length; + char *string_ptr; +} __attribute__((packed)); + +struct acpi_resource_source { + u8 index; + u16 string_length; + char *string_ptr; +} __attribute__((packed)); + +struct acpi_address16_attribute { + u16 granularity; + u16 minimum; + u16 maximum; + u16 translation_offset; + u16 address_length; +}; + +struct acpi_address32_attribute { + u32 granularity; + u32 minimum; + u32 maximum; + u32 translation_offset; + u32 address_length; +}; + +struct acpi_address64_attribute { + u64 granularity; + u64 minimum; + u64 maximum; + u64 translation_offset; + u64 address_length; +}; + +struct acpi_resource_address { + u8 resource_type; + u8 producer_consumer; + u8 decode; + u8 min_address_fixed; + u8 max_address_fixed; + union acpi_resource_attribute info; +}; + +struct acpi_resource_address16 { + u8 resource_type; + u8 producer_consumer; + u8 decode; + u8 min_address_fixed; + u8 max_address_fixed; + union acpi_resource_attribute info; + struct acpi_address16_attribute address; + struct acpi_resource_source resource_source; +} __attribute__((packed)); + +struct acpi_resource_address32 { + u8 resource_type; + u8 producer_consumer; + u8 decode; + u8 min_address_fixed; + u8 max_address_fixed; + union acpi_resource_attribute info; + struct acpi_address32_attribute address; + struct acpi_resource_source resource_source; +} __attribute__((packed)); + +struct acpi_resource_address64 { + u8 resource_type; + u8 producer_consumer; + u8 decode; + u8 min_address_fixed; + u8 max_address_fixed; + union acpi_resource_attribute info; + struct acpi_address64_attribute address; + struct acpi_resource_source resource_source; +} __attribute__((packed)); + +struct acpi_resource_extended_address64 { + u8 resource_type; + u8 producer_consumer; + u8 decode; + u8 min_address_fixed; + u8 max_address_fixed; + union acpi_resource_attribute info; + u8 revision_ID; + struct acpi_address64_attribute address; + u64 type_specific; +} __attribute__((packed)); + +struct acpi_resource_extended_irq { + u8 producer_consumer; + u8 triggering; + u8 polarity; + u8 shareable; + u8 wake_capable; + u8 interrupt_count; + struct acpi_resource_source resource_source; + u32 interrupts[1]; +} __attribute__((packed)); + +struct acpi_resource_generic_register { + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_size; + u64 address; +} __attribute__((packed)); + +struct acpi_resource_gpio { + u8 revision_id; + u8 connection_type; + u8 producer_consumer; + u8 pin_config; + u8 shareable; + u8 wake_capable; + u8 io_restriction; + u8 triggering; + u8 polarity; + u16 drive_strength; + u16 debounce_timeout; + u16 pin_table_length; + u16 vendor_length; + struct acpi_resource_source resource_source; + u16 *pin_table; + u8 *vendor_data; +} __attribute__((packed)); + +struct acpi_resource_common_serialbus { + u8 revision_id; + u8 type; + u8 producer_consumer; + u8 slave_mode; + u8 connection_sharing; + u8 type_revision_id; + u16 type_data_length; + u16 vendor_length; + struct acpi_resource_source resource_source; + u8 *vendor_data; +} __attribute__((packed)); + +struct acpi_resource_i2c_serialbus { + u8 revision_id; + u8 type; + u8 producer_consumer; + u8 slave_mode; + u8 connection_sharing; + u8 type_revision_id; + u16 type_data_length; + u16 vendor_length; + struct acpi_resource_source resource_source; + u8 *vendor_data; + u8 access_mode; + u16 slave_address; + u32 connection_speed; +} __attribute__((packed)); + +struct acpi_resource_spi_serialbus { + u8 revision_id; + u8 type; + u8 producer_consumer; + u8 slave_mode; + u8 connection_sharing; + u8 type_revision_id; + u16 type_data_length; + u16 vendor_length; + struct acpi_resource_source resource_source; + u8 *vendor_data; + u8 wire_mode; + u8 device_polarity; + u8 data_bit_length; + u8 clock_phase; + u8 clock_polarity; + u16 device_selection; + u32 connection_speed; +} __attribute__((packed)); + +struct acpi_resource_uart_serialbus { + u8 revision_id; + u8 type; + u8 producer_consumer; + u8 slave_mode; + u8 connection_sharing; + u8 type_revision_id; + u16 type_data_length; + u16 vendor_length; + struct acpi_resource_source resource_source; + u8 *vendor_data; + u8 endian; + u8 data_bits; + u8 stop_bits; + u8 flow_control; + u8 parity; + u8 lines_enabled; + u16 rx_fifo_size; + u16 tx_fifo_size; + u32 default_baud_rate; +} __attribute__((packed)); + +struct acpi_resource_pin_function { + u8 revision_id; + u8 pin_config; + u8 shareable; + u16 function_number; + u16 pin_table_length; + u16 vendor_length; + struct acpi_resource_source resource_source; + u16 *pin_table; + u8 *vendor_data; +} __attribute__((packed)); + +struct acpi_resource_pin_config { + u8 revision_id; + u8 producer_consumer; + u8 shareable; + u8 pin_config_type; + u32 pin_config_value; + u16 pin_table_length; + u16 vendor_length; + struct acpi_resource_source resource_source; + u16 *pin_table; + u8 *vendor_data; +} __attribute__((packed)); + +struct acpi_resource_pin_group { + u8 revision_id; + u8 producer_consumer; + u16 pin_table_length; + u16 vendor_length; + u16 *pin_table; + struct acpi_resource_label resource_label; + u8 *vendor_data; +} __attribute__((packed)); + +struct acpi_resource_pin_group_function { + u8 revision_id; + u8 producer_consumer; + u8 shareable; + u16 function_number; + u16 vendor_length; + struct acpi_resource_source resource_source; + struct acpi_resource_label resource_source_label; + u8 *vendor_data; +} __attribute__((packed)); + +struct acpi_resource_pin_group_config { + u8 revision_id; + u8 producer_consumer; + u8 shareable; + u8 pin_config_type; + u32 pin_config_value; + u16 vendor_length; + struct acpi_resource_source resource_source; + struct acpi_resource_label resource_source_label; + u8 *vendor_data; +} __attribute__((packed)); + +union acpi_resource_data { + struct acpi_resource_irq irq; + struct acpi_resource_dma dma; + struct acpi_resource_start_dependent start_dpf; + struct acpi_resource_io io; + struct acpi_resource_fixed_io fixed_io; + struct acpi_resource_fixed_dma fixed_dma; + struct acpi_resource_vendor vendor; + struct acpi_resource_vendor_typed vendor_typed; + struct acpi_resource_end_tag end_tag; + struct acpi_resource_memory24 memory24; + struct acpi_resource_memory32 memory32; + struct acpi_resource_fixed_memory32 fixed_memory32; + struct acpi_resource_address16 address16; + struct acpi_resource_address32 address32; + struct acpi_resource_address64 address64; + struct acpi_resource_extended_address64 ext_address64; + struct acpi_resource_extended_irq extended_irq; + struct acpi_resource_generic_register generic_reg; + struct acpi_resource_gpio gpio; + struct acpi_resource_i2c_serialbus i2c_serial_bus; + struct acpi_resource_spi_serialbus spi_serial_bus; + struct acpi_resource_uart_serialbus uart_serial_bus; + struct acpi_resource_common_serialbus common_serial_bus; + struct acpi_resource_pin_function pin_function; + struct acpi_resource_pin_config pin_config; + struct acpi_resource_pin_group pin_group; + struct acpi_resource_pin_group_function pin_group_function; + struct acpi_resource_pin_group_config pin_group_config; + struct acpi_resource_address address; +}; + +struct acpi_resource { + u32 type; + u32 length; + union acpi_resource_data data; +} __attribute__((packed)); + +typedef acpi_status (*acpi_walk_resource_callback)(struct acpi_resource *, void *); + +struct acpi_gpiolib_dmi_quirk { + bool no_edge_events_on_boot; + char *ignore_wake; +}; + +struct acpi_gpio_event { + struct list_head node; + acpi_handle handle; + irq_handler_t handler; + unsigned int pin; + unsigned int irq; + long unsigned int irqflags; + bool irq_is_wake; + bool irq_requested; + struct gpio_desc *desc; +}; + +struct acpi_gpio_connection { + struct list_head node; + unsigned int pin; + struct gpio_desc *desc; +}; + +struct acpi_gpio_chip { + struct acpi_connection_info conn_info; + struct list_head conns; + struct mutex conn_lock; + struct gpio_chip *chip; + struct list_head events; + struct list_head deferred_req_irqs_list_entry; +}; + +struct acpi_gpio_lookup { + struct acpi_gpio_info info; + int index; + u16 pin_index; + bool active_low; + struct gpio_desc *desc; + int n; +}; + +struct regmap; + +struct regmap_irq_chip_data; + +struct intel_scu_ipc_dev; + +struct intel_soc_pmic { + int irq; + struct regmap *regmap; + struct regmap_irq_chip_data *irq_chip_data; + struct regmap_irq_chip_data *irq_chip_data_pwrbtn; + struct regmap_irq_chip_data *irq_chip_data_tmu; + struct regmap_irq_chip_data *irq_chip_data_bcu; + struct regmap_irq_chip_data *irq_chip_data_adc; + struct regmap_irq_chip_data *irq_chip_data_chgr; + struct regmap_irq_chip_data *irq_chip_data_crit; + struct device *dev; + struct intel_scu_ipc_dev *scu; +}; + +enum ctrl_register { + CTRL_IN = 0, + CTRL_OUT = 1, +}; + +struct crystalcove_gpio { + struct mutex buslock; + struct gpio_chip chip; + struct regmap *regmap; + int update; + int intcnt_value; + bool set_irq_mask; +}; + +struct intel_msic_gpio_pdata { + unsigned int gpio_base; +}; + +enum intel_msic_block { + INTEL_MSIC_BLOCK_TOUCH = 0, + INTEL_MSIC_BLOCK_ADC = 1, + INTEL_MSIC_BLOCK_BATTERY = 2, + INTEL_MSIC_BLOCK_GPIO = 3, + INTEL_MSIC_BLOCK_AUDIO = 4, + INTEL_MSIC_BLOCK_HDMI = 5, + INTEL_MSIC_BLOCK_THERMAL = 6, + INTEL_MSIC_BLOCK_POWER_BTN = 7, + INTEL_MSIC_BLOCK_OCD = 8, + INTEL_MSIC_BLOCK_LAST = 9, +}; + +struct msic_gpio { + struct platform_device *pdev; + struct mutex buslock; + struct gpio_chip chip; + int irq; + unsigned int irq_base; + long unsigned int trig_change_mask; + unsigned int trig_type; +}; + +struct intel_msic; + +struct tps68470_gpio_data { + struct regmap *tps68470_regmap; + struct gpio_chip gc; +}; + +enum pwm_polarity { + PWM_POLARITY_NORMAL = 0, + PWM_POLARITY_INVERSED = 1, +}; + +struct pwm_args { + u64 period; + enum pwm_polarity polarity; +}; + +enum { + PWMF_REQUESTED = 1, + PWMF_EXPORTED = 2, +}; + +struct pwm_state { + u64 period; + u64 duty_cycle; + enum pwm_polarity polarity; + bool enabled; +}; + +struct pwm_chip; + +struct pwm_device { + const char *label; + long unsigned int flags; + unsigned int hwpwm; + unsigned int pwm; + struct pwm_chip *chip; + void *chip_data; + struct pwm_args args; + struct pwm_state state; + struct pwm_state last; +}; + +struct pwm_ops; + +struct pwm_chip { + struct device *dev; + const struct pwm_ops *ops; + int base; + unsigned int npwm; + struct pwm_device * (*of_xlate)(struct pwm_chip *, const struct of_phandle_args *); + unsigned int of_pwm_n_cells; + struct list_head list; + struct pwm_device *pwms; +}; + +struct pwm_capture; + +struct pwm_ops { + int (*request)(struct pwm_chip *, struct pwm_device *); + void (*free)(struct pwm_chip *, struct pwm_device *); + int (*capture)(struct pwm_chip *, struct pwm_device *, struct pwm_capture *, long unsigned int); + int (*apply)(struct pwm_chip *, struct pwm_device *, const struct pwm_state *); + void (*get_state)(struct pwm_chip *, struct pwm_device *, struct pwm_state *); + struct module *owner; + int (*config)(struct pwm_chip *, struct pwm_device *, int, int); + int (*set_polarity)(struct pwm_chip *, struct pwm_device *, enum pwm_polarity); + int (*enable)(struct pwm_chip *, struct pwm_device *); + void (*disable)(struct pwm_chip *, struct pwm_device *); +}; + +struct pwm_capture { + unsigned int period; + unsigned int duty_cycle; +}; + +struct pwm_lookup { + struct list_head list; + const char *provider; + unsigned int index; + const char *dev_id; + const char *con_id; + unsigned int period; + enum pwm_polarity polarity; + const char *module; +}; + +struct trace_event_raw_pwm { + struct trace_entry ent; + struct pwm_device *pwm; + u64 period; + u64 duty_cycle; + enum pwm_polarity polarity; + bool enabled; + char __data[0]; +}; + +struct trace_event_data_offsets_pwm {}; + +typedef void (*btf_trace_pwm_apply)(void *, struct pwm_device *, const struct pwm_state *); + +typedef void (*btf_trace_pwm_get)(void *, struct pwm_device *, const struct pwm_state *); + +struct pwm_export { + struct device child; + struct pwm_device *pwm; + struct mutex lock; + struct pwm_state suspend; +}; + +struct crystalcove_pwm { + struct pwm_chip chip; + struct regmap *regmap; +}; + +enum { + pci_channel_io_normal = 1, + pci_channel_io_frozen = 2, + pci_channel_io_perm_failure = 3, +}; + +struct pci_sriov { + int pos; + int nres; + u32 cap; + u16 ctrl; + u16 total_VFs; + u16 initial_VFs; + u16 num_VFs; + u16 offset; + u16 stride; + u16 vf_device; + u32 pgsz; + u8 link; + u8 max_VF_buses; + u16 driver_max_VFs; + struct pci_dev *dev; + struct pci_dev *self; + u32 class; + u8 hdr_type; + u16 subsystem_vendor; + u16 subsystem_device; + resource_size_t barsz[6]; + bool drivers_autoprobe; +}; + +struct rcec_ea { + u8 nextbusn; + u8 lastbusn; + u32 bitmap; +}; + +struct pci_bus_resource { + struct list_head list; + struct resource *res; + unsigned int flags; +}; + +typedef u64 pci_bus_addr_t; + +struct pci_bus_region { + pci_bus_addr_t start; + pci_bus_addr_t end; +}; + +enum pci_fixup_pass { + pci_fixup_early = 0, + pci_fixup_header = 1, + pci_fixup_final = 2, + pci_fixup_enable = 3, + pci_fixup_resume = 4, + pci_fixup_suspend = 5, + pci_fixup_resume_early = 6, + pci_fixup_suspend_late = 7, +}; + +struct hotplug_slot_ops; + +struct hotplug_slot { + const struct hotplug_slot_ops *ops; + struct list_head slot_list; + struct pci_slot *pci_slot; + struct module *owner; + const char *mod_name; +}; + +enum pci_dev_flags { + PCI_DEV_FLAGS_MSI_INTX_DISABLE_BUG = 1, + PCI_DEV_FLAGS_NO_D3 = 2, + PCI_DEV_FLAGS_ASSIGNED = 4, + PCI_DEV_FLAGS_ACS_ENABLED_QUIRK = 8, + PCI_DEV_FLAG_PCIE_BRIDGE_ALIAS = 32, + PCI_DEV_FLAGS_NO_BUS_RESET = 64, + PCI_DEV_FLAGS_NO_PM_RESET = 128, + PCI_DEV_FLAGS_VPD_REF_F0 = 256, + PCI_DEV_FLAGS_BRIDGE_XLATE_ROOT = 512, + PCI_DEV_FLAGS_NO_FLR_RESET = 1024, + PCI_DEV_FLAGS_NO_RELAXED_ORDERING = 2048, +}; + +enum pci_bus_flags { + PCI_BUS_FLAGS_NO_MSI = 1, + PCI_BUS_FLAGS_NO_MMRBC = 2, + PCI_BUS_FLAGS_NO_AERSID = 4, + PCI_BUS_FLAGS_NO_EXTCFG = 8, +}; + +enum pci_bus_speed { + PCI_SPEED_33MHz = 0, + PCI_SPEED_66MHz = 1, + PCI_SPEED_66MHz_PCIX = 2, + PCI_SPEED_100MHz_PCIX = 3, + PCI_SPEED_133MHz_PCIX = 4, + PCI_SPEED_66MHz_PCIX_ECC = 5, + PCI_SPEED_100MHz_PCIX_ECC = 6, + PCI_SPEED_133MHz_PCIX_ECC = 7, + PCI_SPEED_66MHz_PCIX_266 = 9, + PCI_SPEED_100MHz_PCIX_266 = 10, + PCI_SPEED_133MHz_PCIX_266 = 11, + AGP_UNKNOWN = 12, + AGP_1X = 13, + AGP_2X = 14, + AGP_4X = 15, + AGP_8X = 16, + PCI_SPEED_66MHz_PCIX_533 = 17, + PCI_SPEED_100MHz_PCIX_533 = 18, + PCI_SPEED_133MHz_PCIX_533 = 19, + PCIE_SPEED_2_5GT = 20, + PCIE_SPEED_5_0GT = 21, + PCIE_SPEED_8_0GT = 22, + PCIE_SPEED_16_0GT = 23, + PCIE_SPEED_32_0GT = 24, + PCIE_SPEED_64_0GT = 25, + PCI_SPEED_UNKNOWN = 255, +}; + +struct pci_host_bridge { + struct device dev; + struct pci_bus *bus; + struct pci_ops *ops; + struct pci_ops *child_ops; + void *sysdata; + int busnr; + struct list_head windows; + struct list_head dma_ranges; + u8 (*swizzle_irq)(struct pci_dev *, u8 *); + int (*map_irq)(const struct pci_dev *, u8, u8); + void (*release_fn)(struct pci_host_bridge *); + void *release_data; + struct msi_controller *msi; + unsigned int ignore_reset_delay: 1; + unsigned int no_ext_tags: 1; + unsigned int native_aer: 1; + unsigned int native_pcie_hotplug: 1; + unsigned int native_shpc_hotplug: 1; + unsigned int native_pme: 1; + unsigned int native_ltr: 1; + unsigned int native_dpc: 1; + unsigned int preserve_config: 1; + unsigned int size_windows: 1; + resource_size_t (*align_resource)(struct pci_dev *, const struct resource *, resource_size_t, resource_size_t, resource_size_t); + long: 64; + long: 64; + long: 64; + long: 64; + long unsigned int private[0]; +}; + +enum { + PCI_REASSIGN_ALL_RSRC = 1, + PCI_REASSIGN_ALL_BUS = 2, + PCI_PROBE_ONLY = 4, + PCI_CAN_SKIP_ISA_ALIGN = 8, + PCI_ENABLE_PROC_DOMAINS = 16, + PCI_COMPAT_DOMAIN_0 = 32, + PCI_SCAN_ALL_PCIE_DEVS = 64, +}; + +enum pcie_bus_config_types { + PCIE_BUS_TUNE_OFF = 0, + PCIE_BUS_DEFAULT = 1, + PCIE_BUS_SAFE = 2, + PCIE_BUS_PERFORMANCE = 3, + PCIE_BUS_PEER2PEER = 4, +}; + +struct hotplug_slot_ops { + int (*enable_slot)(struct hotplug_slot *); + int (*disable_slot)(struct hotplug_slot *); + int (*set_attention_status)(struct hotplug_slot *, u8); + int (*hardware_test)(struct hotplug_slot *, u32); + int (*get_power_status)(struct hotplug_slot *, u8 *); + int (*get_attention_status)(struct hotplug_slot *, u8 *); + int (*get_latch_status)(struct hotplug_slot *, u8 *); + int (*get_adapter_status)(struct hotplug_slot *, u8 *); + int (*reset_slot)(struct hotplug_slot *, int); +}; + +enum pci_bar_type { + pci_bar_unknown = 0, + pci_bar_io = 1, + pci_bar_mem32 = 2, + pci_bar_mem64 = 3, +}; + +struct pci_domain_busn_res { + struct list_head list; + struct resource res; + int domain_nr; +}; + +struct bus_attribute { + struct attribute attr; + ssize_t (*show)(struct bus_type *, char *); + ssize_t (*store)(struct bus_type *, const char *, size_t); +}; + +enum pcie_reset_state { + pcie_deassert_reset = 1, + pcie_warm_reset = 2, + pcie_hot_reset = 3, +}; + +enum pcie_link_width { + PCIE_LNK_WIDTH_RESRV = 0, + PCIE_LNK_X1 = 1, + PCIE_LNK_X2 = 2, + PCIE_LNK_X4 = 4, + PCIE_LNK_X8 = 8, + PCIE_LNK_X12 = 12, + PCIE_LNK_X16 = 16, + PCIE_LNK_X32 = 32, + PCIE_LNK_WIDTH_UNKNOWN = 255, +}; + +struct pci_cap_saved_data { + u16 cap_nr; + bool cap_extended; + unsigned int size; + u32 data[0]; +}; + +struct pci_cap_saved_state { + struct hlist_node next; + struct pci_cap_saved_data cap; +}; + +struct pci_platform_pm_ops { + bool (*bridge_d3)(struct pci_dev *); + bool (*is_manageable)(struct pci_dev *); + int (*set_state)(struct pci_dev *, pci_power_t); + pci_power_t (*get_state)(struct pci_dev *); + void (*refresh_state)(struct pci_dev *); + pci_power_t (*choose_state)(struct pci_dev *); + int (*set_wakeup)(struct pci_dev *, bool); + bool (*need_resume)(struct pci_dev *); +}; + +struct pci_pme_device { + struct list_head list; + struct pci_dev *dev; +}; + +struct pci_saved_state { + u32 config_space[16]; + struct pci_cap_saved_data cap[0]; +}; + +struct pci_devres { + unsigned int enabled: 1; + unsigned int pinned: 1; + unsigned int orig_intx: 1; + unsigned int restore_intx: 1; + unsigned int mwi: 1; + u32 region_mask; +}; + +struct driver_attribute { + struct attribute attr; + ssize_t (*show)(struct device_driver *, char *); + ssize_t (*store)(struct device_driver *, const char *, size_t); +}; + +enum pci_ers_result { + PCI_ERS_RESULT_NONE = 1, + PCI_ERS_RESULT_CAN_RECOVER = 2, + PCI_ERS_RESULT_NEED_RESET = 3, + PCI_ERS_RESULT_DISCONNECT = 4, + PCI_ERS_RESULT_RECOVERED = 5, + PCI_ERS_RESULT_NO_AER_DRIVER = 6, +}; + +enum dev_dma_attr { + DEV_DMA_NOT_SUPPORTED = 0, + DEV_DMA_NON_COHERENT = 1, + DEV_DMA_COHERENT = 2, +}; + +struct pcie_device { + int irq; + struct pci_dev *port; + u32 service; + void *priv_data; + struct device device; +}; + +struct pcie_port_service_driver { + const char *name; + int (*probe)(struct pcie_device *); + void (*remove)(struct pcie_device *); + int (*suspend)(struct pcie_device *); + int (*resume_noirq)(struct pcie_device *); + int (*resume)(struct pcie_device *); + int (*runtime_suspend)(struct pcie_device *); + int (*runtime_resume)(struct pcie_device *); + void (*error_resume)(struct pci_dev *); + int port_type; + u32 service; + struct device_driver driver; +}; + +struct pci_dynid { + struct list_head node; + struct pci_device_id id; +}; + +struct drv_dev_and_id { + struct pci_driver *drv; + struct pci_dev *dev; + const struct pci_device_id *id; +}; + +enum pci_mmap_state { + pci_mmap_io = 0, + pci_mmap_mem = 1, +}; + +enum pci_mmap_api { + PCI_MMAP_SYSFS = 0, + PCI_MMAP_PROCFS = 1, +}; + +struct pci_vpd_ops; + +struct pci_vpd { + const struct pci_vpd_ops *ops; + struct bin_attribute *attr; + struct mutex lock; + unsigned int len; + u16 flag; + u8 cap; + unsigned int busy: 1; + unsigned int valid: 1; +}; + +struct pci_vpd_ops { + ssize_t (*read)(struct pci_dev *, loff_t, size_t, void *); + ssize_t (*write)(struct pci_dev *, loff_t, size_t, const void *); + int (*set_size)(struct pci_dev *, size_t); +}; + +struct pci_dev_resource { + struct list_head list; + struct resource *res; + struct pci_dev *dev; + resource_size_t start; + resource_size_t end; + resource_size_t add_size; + resource_size_t min_align; + long unsigned int flags; +}; + +enum release_type { + leaf_only = 0, + whole_subtree = 1, +}; + +enum enable_type { + undefined = 4294967295, + user_disabled = 0, + auto_disabled = 1, + user_enabled = 2, + auto_enabled = 3, +}; + +struct msix_entry { + u32 vector; + u16 entry; +}; + +struct portdrv_service_data { + struct pcie_port_service_driver *drv; + struct device *dev; + u32 service; +}; + +typedef int (*pcie_pm_callback_t)(struct pcie_device *); + +struct walk_rcec_data { + struct pci_dev *rcec; + int (*user_callback)(struct pci_dev *, void *); + void *user_data; +}; + +struct aspm_latency { + u32 l0s; + u32 l1; +}; + +struct pcie_link_state { + struct pci_dev *pdev; + struct pci_dev *downstream; + struct pcie_link_state *root; + struct pcie_link_state *parent; + struct list_head sibling; + u32 aspm_support: 7; + u32 aspm_enabled: 7; + u32 aspm_capable: 7; + u32 aspm_default: 7; + char: 4; + u32 aspm_disable: 7; + u32 clkpm_capable: 1; + u32 clkpm_enabled: 1; + u32 clkpm_default: 1; + u32 clkpm_disable: 1; + struct aspm_latency latency_up; + struct aspm_latency latency_dw; + struct aspm_latency acceptable[8]; +}; + +struct aer_stats { + u64 dev_cor_errs[16]; + u64 dev_fatal_errs[27]; + u64 dev_nonfatal_errs[27]; + u64 dev_total_cor_errs; + u64 dev_total_fatal_errs; + u64 dev_total_nonfatal_errs; + u64 rootport_total_cor_errs; + u64 rootport_total_fatal_errs; + u64 rootport_total_nonfatal_errs; +}; + +struct aer_header_log_regs { + unsigned int dw0; + unsigned int dw1; + unsigned int dw2; + unsigned int dw3; +}; + +struct aer_capability_regs { + u32 header; + u32 uncor_status; + u32 uncor_mask; + u32 uncor_severity; + u32 cor_status; + u32 cor_mask; + u32 cap_control; + struct aer_header_log_regs header_log; + u32 root_command; + u32 root_status; + u16 cor_err_source; + u16 uncor_err_source; +}; + +struct aer_err_info { + struct pci_dev *dev[5]; + int error_dev_num; + unsigned int id: 16; + unsigned int severity: 2; + unsigned int __pad1: 5; + unsigned int multi_error_valid: 1; + unsigned int first_error: 5; + unsigned int __pad2: 2; + unsigned int tlp_header_valid: 1; + unsigned int status; + unsigned int mask; + struct aer_header_log_regs tlp; +}; + +struct aer_err_source { + unsigned int status; + unsigned int id; +}; + +struct aer_rpc { + struct pci_dev *rpd; + struct { + union { + struct __kfifo kfifo; + struct aer_err_source *type; + const struct aer_err_source *const_type; + char (*rectype)[0]; + struct aer_err_source *ptr; + const struct aer_err_source *ptr_const; + }; + struct aer_err_source buf[128]; + } aer_fifo; +}; + +struct aer_recover_entry { + u8 bus; + u8 devfn; + u16 domain; + int severity; + struct aer_capability_regs *regs; +}; + +struct pcie_pme_service_data { + spinlock_t lock; + struct pcie_device *srv; + struct work_struct work; + bool noirq; +}; + +typedef void (*acpi_notify_handler)(acpi_handle, u32, void *); + +struct pci_filp_private { + enum pci_mmap_state mmap_state; + int write_combine; +}; + +struct pci_slot_attribute { + struct attribute attr; + ssize_t (*show)(struct pci_slot *, char *); + ssize_t (*store)(struct pci_slot *, const char *, size_t); +}; + +struct acpi_bus_type { + struct list_head list; + const char *name; + bool (*match)(struct device *); + struct acpi_device * (*find_companion)(struct device *); + void (*setup)(struct device *); + void (*cleanup)(struct device *); +}; + +struct acpi_pci_root { + struct acpi_device *device; + struct pci_bus *bus; + u16 segment; + struct resource secondary; + u32 osc_support_set; + u32 osc_control_set; + phys_addr_t mcfg_addr; +}; + +enum pm_qos_flags_status { + PM_QOS_FLAGS_UNDEFINED = 4294967295, + PM_QOS_FLAGS_NONE = 0, + PM_QOS_FLAGS_SOME = 1, + PM_QOS_FLAGS_ALL = 2, +}; + +struct hpx_type0 { + u32 revision; + u8 cache_line_size; + u8 latency_timer; + u8 enable_serr; + u8 enable_perr; +}; + +struct hpx_type1 { + u32 revision; + u8 max_mem_read; + u8 avg_max_split; + u16 tot_max_split; +}; + +struct hpx_type2 { + u32 revision; + u32 unc_err_mask_and; + u32 unc_err_mask_or; + u32 unc_err_sever_and; + u32 unc_err_sever_or; + u32 cor_err_mask_and; + u32 cor_err_mask_or; + u32 adv_err_cap_and; + u32 adv_err_cap_or; + u16 pci_exp_devctl_and; + u16 pci_exp_devctl_or; + u16 pci_exp_lnkctl_and; + u16 pci_exp_lnkctl_or; + u32 sec_unc_err_sever_and; + u32 sec_unc_err_sever_or; + u32 sec_unc_err_mask_and; + u32 sec_unc_err_mask_or; +}; + +struct hpx_type3 { + u16 device_type; + u16 function_type; + u16 config_space_location; + u16 pci_exp_cap_id; + u16 pci_exp_cap_ver; + u16 pci_exp_vendor_id; + u16 dvsec_id; + u16 dvsec_rev; + u16 match_offset; + u32 match_mask_and; + u32 match_value; + u16 reg_offset; + u32 reg_mask_and; + u32 reg_mask_or; +}; + +enum hpx_type3_dev_type { + HPX_TYPE_ENDPOINT = 1, + HPX_TYPE_LEG_END = 2, + HPX_TYPE_RC_END = 4, + HPX_TYPE_RC_EC = 8, + HPX_TYPE_ROOT_PORT = 16, + HPX_TYPE_UPSTREAM = 32, + HPX_TYPE_DOWNSTREAM = 64, + HPX_TYPE_PCI_BRIDGE = 128, + HPX_TYPE_PCIE_BRIDGE = 256, +}; + +enum hpx_type3_fn_type { + HPX_FN_NORMAL = 1, + HPX_FN_SRIOV_PHYS = 2, + HPX_FN_SRIOV_VIRT = 4, +}; + +enum hpx_type3_cfg_loc { + HPX_CFG_PCICFG = 0, + HPX_CFG_PCIE_CAP = 1, + HPX_CFG_PCIE_CAP_EXT = 2, + HPX_CFG_VEND_CAP = 3, + HPX_CFG_DVSEC = 4, + HPX_CFG_MAX = 5, +}; + +enum pci_irq_reroute_variant { + INTEL_IRQ_REROUTE_VARIANT = 1, + MAX_IRQ_REROUTE_VARIANTS = 3, +}; + +struct pci_fixup { + u16 vendor; + u16 device; + u32 class; + unsigned int class_shift; + int hook_offset; +}; + +enum { + NVME_REG_CAP = 0, + NVME_REG_VS = 8, + NVME_REG_INTMS = 12, + NVME_REG_INTMC = 16, + NVME_REG_CC = 20, + NVME_REG_CSTS = 28, + NVME_REG_NSSR = 32, + NVME_REG_AQA = 36, + NVME_REG_ASQ = 40, + NVME_REG_ACQ = 48, + NVME_REG_CMBLOC = 56, + NVME_REG_CMBSZ = 60, + NVME_REG_BPINFO = 64, + NVME_REG_BPRSEL = 68, + NVME_REG_BPMBL = 72, + NVME_REG_CMBMSC = 80, + NVME_REG_PMRCAP = 3584, + NVME_REG_PMRCTL = 3588, + NVME_REG_PMRSTS = 3592, + NVME_REG_PMREBS = 3596, + NVME_REG_PMRSWTP = 3600, + NVME_REG_DBS = 4096, +}; + +enum { + NVME_CC_ENABLE = 1, + NVME_CC_EN_SHIFT = 0, + NVME_CC_CSS_SHIFT = 4, + NVME_CC_MPS_SHIFT = 7, + NVME_CC_AMS_SHIFT = 11, + NVME_CC_SHN_SHIFT = 14, + NVME_CC_IOSQES_SHIFT = 16, + NVME_CC_IOCQES_SHIFT = 20, + NVME_CC_CSS_NVM = 0, + NVME_CC_CSS_CSI = 96, + NVME_CC_CSS_MASK = 112, + NVME_CC_AMS_RR = 0, + NVME_CC_AMS_WRRU = 2048, + NVME_CC_AMS_VS = 14336, + NVME_CC_SHN_NONE = 0, + NVME_CC_SHN_NORMAL = 16384, + NVME_CC_SHN_ABRUPT = 32768, + NVME_CC_SHN_MASK = 49152, + NVME_CC_IOSQES = 393216, + NVME_CC_IOCQES = 4194304, + NVME_CAP_CSS_NVM = 1, + NVME_CAP_CSS_CSI = 64, + NVME_CSTS_RDY = 1, + NVME_CSTS_CFS = 2, + NVME_CSTS_NSSRO = 16, + NVME_CSTS_PP = 32, + NVME_CSTS_SHST_NORMAL = 0, + NVME_CSTS_SHST_OCCUR = 4, + NVME_CSTS_SHST_CMPLT = 8, + NVME_CSTS_SHST_MASK = 12, + NVME_CMBMSC_CRE = 1, + NVME_CMBMSC_CMSE = 2, +}; + +enum { + NVME_AEN_BIT_NS_ATTR = 8, + NVME_AEN_BIT_FW_ACT = 9, + NVME_AEN_BIT_ANA_CHANGE = 11, + NVME_AEN_BIT_DISC_CHANGE = 31, +}; + +enum { + SWITCHTEC_GAS_MRPC_OFFSET = 0, + SWITCHTEC_GAS_TOP_CFG_OFFSET = 4096, + SWITCHTEC_GAS_SW_EVENT_OFFSET = 6144, + SWITCHTEC_GAS_SYS_INFO_OFFSET = 8192, + SWITCHTEC_GAS_FLASH_INFO_OFFSET = 8704, + SWITCHTEC_GAS_PART_CFG_OFFSET = 16384, + SWITCHTEC_GAS_NTB_OFFSET = 65536, + SWITCHTEC_GAS_PFF_CSR_OFFSET = 1261568, +}; + +enum { + SWITCHTEC_NTB_REG_INFO_OFFSET = 0, + SWITCHTEC_NTB_REG_CTRL_OFFSET = 16384, + SWITCHTEC_NTB_REG_DBMSG_OFFSET = 409600, +}; + +struct nt_partition_info { + u32 xlink_enabled; + u32 target_part_low; + u32 target_part_high; + u32 reserved; +}; + +struct ntb_info_regs { + u8 partition_count; + u8 partition_id; + u16 reserved1; + u64 ep_map; + u16 requester_id; + u16 reserved2; + u32 reserved3[4]; + struct nt_partition_info ntp_info[48]; +} __attribute__((packed)); + +struct ntb_ctrl_regs { + u32 partition_status; + u32 partition_op; + u32 partition_ctrl; + u32 bar_setup; + u32 bar_error; + u16 lut_table_entries; + u16 lut_table_offset; + u32 lut_error; + u16 req_id_table_size; + u16 req_id_table_offset; + u32 req_id_error; + u32 reserved1[7]; + struct { + u32 ctl; + u32 win_size; + u64 xlate_addr; + } bar_entry[6]; + struct { + u32 win_size; + u32 reserved[3]; + } bar_ext_entry[6]; + u32 reserved2[192]; + u32 req_id_table[512]; + u32 reserved3[256]; + u64 lut_entry[512]; +}; + +struct pci_dev_reset_methods { + u16 vendor; + u16 device; + int (*reset)(struct pci_dev *, int); +}; + +struct pci_dev_acs_enabled { + u16 vendor; + u16 device; + int (*acs_enabled)(struct pci_dev *, u16); +}; + +struct pci_dev_acs_ops { + u16 vendor; + u16 device; + int (*enable_acs)(struct pci_dev *); + int (*disable_acs_redir)(struct pci_dev *); +}; + +typedef acpi_status (*acpi_walk_callback)(acpi_handle, u32, void *, void **); + +struct controller { + struct pcie_device *pcie; + u32 slot_cap; + unsigned int inband_presence_disabled: 1; + u16 slot_ctrl; + struct mutex ctrl_lock; + long unsigned int cmd_started; + unsigned int cmd_busy: 1; + wait_queue_head_t queue; + atomic_t pending_events; + unsigned int notification_enabled: 1; + unsigned int power_fault_detected; + struct task_struct *poll_thread; + u8 state; + struct mutex state_lock; + struct delayed_work button_work; + struct hotplug_slot hotplug_slot; + struct rw_semaphore reset_lock; + unsigned int ist_running; + int request_result; + wait_queue_head_t requester; +}; + +struct controller___2; + +struct hpc_ops; + +struct slot { + u8 bus; + u8 device; + u16 status; + u32 number; + u8 is_a_board; + u8 state; + u8 attention_save; + u8 presence_save; + u8 latch_save; + u8 pwr_save; + struct controller___2 *ctrl; + const struct hpc_ops *hpc_ops; + struct hotplug_slot hotplug_slot; + struct list_head slot_list; + struct delayed_work work; + struct mutex lock; + struct workqueue_struct *wq; + u8 hp_slot; +}; + +struct controller___2 { + struct mutex crit_sect; + struct mutex cmd_lock; + int num_slots; + int slot_num_inc; + struct pci_dev *pci_dev; + struct list_head slot_list; + const struct hpc_ops *hpc_ops; + wait_queue_head_t queue; + u8 slot_device_offset; + u32 pcix_misc2_reg; + u32 first_slot; + u32 cap_offset; + long unsigned int mmio_base; + long unsigned int mmio_size; + void *creg; + struct timer_list poll_timer; +}; + +struct hpc_ops { + int (*power_on_slot)(struct slot *); + int (*slot_enable)(struct slot *); + int (*slot_disable)(struct slot *); + int (*set_bus_speed_mode)(struct slot *, enum pci_bus_speed); + int (*get_power_status)(struct slot *, u8 *); + int (*get_attention_status)(struct slot *, u8 *); + int (*set_attention_status)(struct slot *, u8); + int (*get_latch_status)(struct slot *, u8 *); + int (*get_adapter_status)(struct slot *, u8 *); + int (*get_adapter_speed)(struct slot *, enum pci_bus_speed *); + int (*get_mode1_ECC_cap)(struct slot *, u8 *); + int (*get_prog_int)(struct slot *, u8 *); + int (*query_power_fault)(struct slot *); + void (*green_led_on)(struct slot *); + void (*green_led_off)(struct slot *); + void (*green_led_blink)(struct slot *); + void (*release_ctlr)(struct controller___2 *); + int (*check_cmd_status)(struct controller___2 *); +}; + +struct event_info { + u32 event_type; + struct slot *p_slot; + struct work_struct work; +}; + +struct pushbutton_work_info { + struct slot *p_slot; + struct work_struct work; +}; + +enum ctrl_offsets { + BASE_OFFSET = 0, + SLOT_AVAIL1 = 4, + SLOT_AVAIL2 = 8, + SLOT_CONFIG = 12, + SEC_BUS_CONFIG = 16, + MSI_CTRL = 18, + PROG_INTERFACE = 19, + CMD = 20, + CMD_STATUS = 22, + INTR_LOC = 24, + SERR_LOC = 28, + SERR_INTR_ENABLE = 32, + SLOT1 = 36, +}; + +struct acpiphp_slot; + +struct slot___2 { + struct hotplug_slot hotplug_slot; + struct acpiphp_slot *acpi_slot; + unsigned int sun; +}; + +struct acpiphp_slot { + struct list_head node; + struct pci_bus *bus; + struct list_head funcs; + struct slot___2 *slot; + u8 device; + u32 flags; +}; + +struct acpiphp_attention_info { + int (*set_attn)(struct hotplug_slot *, u8); + int (*get_attn)(struct hotplug_slot *, u8 *); + struct module *owner; +}; + +struct acpiphp_context; + +struct acpiphp_bridge { + struct list_head list; + struct list_head slots; + struct kref ref; + struct acpiphp_context *context; + int nr_slots; + struct pci_bus *pci_bus; + struct pci_dev *pci_dev; + bool is_going_away; +}; + +struct acpiphp_func { + struct acpiphp_bridge *parent; + struct acpiphp_slot *slot; + struct list_head sibling; + u8 function; + u32 flags; +}; + +struct acpiphp_context { + struct acpi_hotplug_context hp; + struct acpiphp_func func; + struct acpiphp_bridge *bridge; + unsigned int refcount; +}; + +struct acpiphp_root_context { + struct acpi_hotplug_context hp; + struct acpiphp_bridge *root_bridge; +}; + +enum dmi_device_type { + DMI_DEV_TYPE_ANY = 0, + DMI_DEV_TYPE_OTHER = 1, + DMI_DEV_TYPE_UNKNOWN = 2, + DMI_DEV_TYPE_VIDEO = 3, + DMI_DEV_TYPE_SCSI = 4, + DMI_DEV_TYPE_ETHERNET = 5, + DMI_DEV_TYPE_TOKENRING = 6, + DMI_DEV_TYPE_SOUND = 7, + DMI_DEV_TYPE_PATA = 8, + DMI_DEV_TYPE_SATA = 9, + DMI_DEV_TYPE_SAS = 10, + DMI_DEV_TYPE_IPMI = 4294967295, + DMI_DEV_TYPE_OEM_STRING = 4294967294, + DMI_DEV_TYPE_DEV_ONBOARD = 4294967293, + DMI_DEV_TYPE_DEV_SLOT = 4294967292, +}; + +struct dmi_device { + struct list_head list; + int type; + const char *name; + void *device_data; +}; + +struct dmi_dev_onboard { + struct dmi_device dev; + int instance; + int segment; + int bus; + int devfn; +}; + +enum smbios_attr_enum { + SMBIOS_ATTR_NONE = 0, + SMBIOS_ATTR_LABEL_SHOW = 1, + SMBIOS_ATTR_INSTANCE_SHOW = 2, +}; + +enum acpi_attr_enum { + ACPI_ATTR_LABEL_SHOW = 0, + ACPI_ATTR_INDEX_SHOW = 1, +}; + +struct pci_p2pdma { + struct gen_pool *pool; + bool p2pmem_published; + struct xarray map_types; +}; + +enum pci_p2pdma_map_type { + PCI_P2PDMA_MAP_UNKNOWN = 0, + PCI_P2PDMA_MAP_NOT_SUPPORTED = 1, + PCI_P2PDMA_MAP_BUS_ADDR = 2, + PCI_P2PDMA_MAP_THRU_HOST_BRIDGE = 3, +}; + +struct pci_p2pdma_pagemap { + struct dev_pagemap pgmap; + struct pci_dev *provider; + u64 bus_offset; +}; + +struct pci_p2pdma_whitelist_entry { + short unsigned int vendor; + short unsigned int device; + enum { + REQ_SAME_HOST_BRIDGE = 1, + } flags; +}; + +enum hdmi_infoframe_type { + HDMI_INFOFRAME_TYPE_VENDOR = 129, + HDMI_INFOFRAME_TYPE_AVI = 130, + HDMI_INFOFRAME_TYPE_SPD = 131, + HDMI_INFOFRAME_TYPE_AUDIO = 132, + HDMI_INFOFRAME_TYPE_DRM = 135, +}; + +struct hdmi_any_infoframe { + enum hdmi_infoframe_type type; + unsigned char version; + unsigned char length; +}; + +enum hdmi_colorspace { + HDMI_COLORSPACE_RGB = 0, + HDMI_COLORSPACE_YUV422 = 1, + HDMI_COLORSPACE_YUV444 = 2, + HDMI_COLORSPACE_YUV420 = 3, + HDMI_COLORSPACE_RESERVED4 = 4, + HDMI_COLORSPACE_RESERVED5 = 5, + HDMI_COLORSPACE_RESERVED6 = 6, + HDMI_COLORSPACE_IDO_DEFINED = 7, +}; + +enum hdmi_scan_mode { + HDMI_SCAN_MODE_NONE = 0, + HDMI_SCAN_MODE_OVERSCAN = 1, + HDMI_SCAN_MODE_UNDERSCAN = 2, + HDMI_SCAN_MODE_RESERVED = 3, +}; + +enum hdmi_colorimetry { + HDMI_COLORIMETRY_NONE = 0, + HDMI_COLORIMETRY_ITU_601 = 1, + HDMI_COLORIMETRY_ITU_709 = 2, + HDMI_COLORIMETRY_EXTENDED = 3, +}; + +enum hdmi_picture_aspect { + HDMI_PICTURE_ASPECT_NONE = 0, + HDMI_PICTURE_ASPECT_4_3 = 1, + HDMI_PICTURE_ASPECT_16_9 = 2, + HDMI_PICTURE_ASPECT_64_27 = 3, + HDMI_PICTURE_ASPECT_256_135 = 4, + HDMI_PICTURE_ASPECT_RESERVED = 5, +}; + +enum hdmi_active_aspect { + HDMI_ACTIVE_ASPECT_16_9_TOP = 2, + HDMI_ACTIVE_ASPECT_14_9_TOP = 3, + HDMI_ACTIVE_ASPECT_16_9_CENTER = 4, + HDMI_ACTIVE_ASPECT_PICTURE = 8, + HDMI_ACTIVE_ASPECT_4_3 = 9, + HDMI_ACTIVE_ASPECT_16_9 = 10, + HDMI_ACTIVE_ASPECT_14_9 = 11, + HDMI_ACTIVE_ASPECT_4_3_SP_14_9 = 13, + HDMI_ACTIVE_ASPECT_16_9_SP_14_9 = 14, + HDMI_ACTIVE_ASPECT_16_9_SP_4_3 = 15, +}; + +enum hdmi_extended_colorimetry { + HDMI_EXTENDED_COLORIMETRY_XV_YCC_601 = 0, + HDMI_EXTENDED_COLORIMETRY_XV_YCC_709 = 1, + HDMI_EXTENDED_COLORIMETRY_S_YCC_601 = 2, + HDMI_EXTENDED_COLORIMETRY_OPYCC_601 = 3, + HDMI_EXTENDED_COLORIMETRY_OPRGB = 4, + HDMI_EXTENDED_COLORIMETRY_BT2020_CONST_LUM = 5, + HDMI_EXTENDED_COLORIMETRY_BT2020 = 6, + HDMI_EXTENDED_COLORIMETRY_RESERVED = 7, +}; + +enum hdmi_quantization_range { + HDMI_QUANTIZATION_RANGE_DEFAULT = 0, + HDMI_QUANTIZATION_RANGE_LIMITED = 1, + HDMI_QUANTIZATION_RANGE_FULL = 2, + HDMI_QUANTIZATION_RANGE_RESERVED = 3, +}; + +enum hdmi_nups { + HDMI_NUPS_UNKNOWN = 0, + HDMI_NUPS_HORIZONTAL = 1, + HDMI_NUPS_VERTICAL = 2, + HDMI_NUPS_BOTH = 3, +}; + +enum hdmi_ycc_quantization_range { + HDMI_YCC_QUANTIZATION_RANGE_LIMITED = 0, + HDMI_YCC_QUANTIZATION_RANGE_FULL = 1, +}; + +enum hdmi_content_type { + HDMI_CONTENT_TYPE_GRAPHICS = 0, + HDMI_CONTENT_TYPE_PHOTO = 1, + HDMI_CONTENT_TYPE_CINEMA = 2, + HDMI_CONTENT_TYPE_GAME = 3, +}; + +enum hdmi_metadata_type { + HDMI_STATIC_METADATA_TYPE1 = 1, +}; + +enum hdmi_eotf { + HDMI_EOTF_TRADITIONAL_GAMMA_SDR = 0, + HDMI_EOTF_TRADITIONAL_GAMMA_HDR = 1, + HDMI_EOTF_SMPTE_ST2084 = 2, + HDMI_EOTF_BT_2100_HLG = 3, +}; + +struct hdmi_avi_infoframe { + enum hdmi_infoframe_type type; + unsigned char version; + unsigned char length; + enum hdmi_colorspace colorspace; + enum hdmi_scan_mode scan_mode; + enum hdmi_colorimetry colorimetry; + enum hdmi_picture_aspect picture_aspect; + enum hdmi_active_aspect active_aspect; + bool itc; + enum hdmi_extended_colorimetry extended_colorimetry; + enum hdmi_quantization_range quantization_range; + enum hdmi_nups nups; + unsigned char video_code; + enum hdmi_ycc_quantization_range ycc_quantization_range; + enum hdmi_content_type content_type; + unsigned char pixel_repeat; + short unsigned int top_bar; + short unsigned int bottom_bar; + short unsigned int left_bar; + short unsigned int right_bar; +}; + +struct hdmi_drm_infoframe { + enum hdmi_infoframe_type type; + unsigned char version; + unsigned char length; + enum hdmi_eotf eotf; + enum hdmi_metadata_type metadata_type; + struct { + u16 x; + u16 y; + } display_primaries[3]; + struct { + u16 x; + u16 y; + } white_point; + u16 max_display_mastering_luminance; + u16 min_display_mastering_luminance; + u16 max_cll; + u16 max_fall; +}; + +enum hdmi_spd_sdi { + HDMI_SPD_SDI_UNKNOWN = 0, + HDMI_SPD_SDI_DSTB = 1, + HDMI_SPD_SDI_DVDP = 2, + HDMI_SPD_SDI_DVHS = 3, + HDMI_SPD_SDI_HDDVR = 4, + HDMI_SPD_SDI_DVC = 5, + HDMI_SPD_SDI_DSC = 6, + HDMI_SPD_SDI_VCD = 7, + HDMI_SPD_SDI_GAME = 8, + HDMI_SPD_SDI_PC = 9, + HDMI_SPD_SDI_BD = 10, + HDMI_SPD_SDI_SACD = 11, + HDMI_SPD_SDI_HDDVD = 12, + HDMI_SPD_SDI_PMP = 13, +}; + +struct hdmi_spd_infoframe { + enum hdmi_infoframe_type type; + unsigned char version; + unsigned char length; + char vendor[8]; + char product[16]; + enum hdmi_spd_sdi sdi; +}; + +enum hdmi_audio_coding_type { + HDMI_AUDIO_CODING_TYPE_STREAM = 0, + HDMI_AUDIO_CODING_TYPE_PCM = 1, + HDMI_AUDIO_CODING_TYPE_AC3 = 2, + HDMI_AUDIO_CODING_TYPE_MPEG1 = 3, + HDMI_AUDIO_CODING_TYPE_MP3 = 4, + HDMI_AUDIO_CODING_TYPE_MPEG2 = 5, + HDMI_AUDIO_CODING_TYPE_AAC_LC = 6, + HDMI_AUDIO_CODING_TYPE_DTS = 7, + HDMI_AUDIO_CODING_TYPE_ATRAC = 8, + HDMI_AUDIO_CODING_TYPE_DSD = 9, + HDMI_AUDIO_CODING_TYPE_EAC3 = 10, + HDMI_AUDIO_CODING_TYPE_DTS_HD = 11, + HDMI_AUDIO_CODING_TYPE_MLP = 12, + HDMI_AUDIO_CODING_TYPE_DST = 13, + HDMI_AUDIO_CODING_TYPE_WMA_PRO = 14, + HDMI_AUDIO_CODING_TYPE_CXT = 15, +}; + +enum hdmi_audio_sample_size { + HDMI_AUDIO_SAMPLE_SIZE_STREAM = 0, + HDMI_AUDIO_SAMPLE_SIZE_16 = 1, + HDMI_AUDIO_SAMPLE_SIZE_20 = 2, + HDMI_AUDIO_SAMPLE_SIZE_24 = 3, +}; + +enum hdmi_audio_sample_frequency { + HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM = 0, + HDMI_AUDIO_SAMPLE_FREQUENCY_32000 = 1, + HDMI_AUDIO_SAMPLE_FREQUENCY_44100 = 2, + HDMI_AUDIO_SAMPLE_FREQUENCY_48000 = 3, + HDMI_AUDIO_SAMPLE_FREQUENCY_88200 = 4, + HDMI_AUDIO_SAMPLE_FREQUENCY_96000 = 5, + HDMI_AUDIO_SAMPLE_FREQUENCY_176400 = 6, + HDMI_AUDIO_SAMPLE_FREQUENCY_192000 = 7, +}; + +enum hdmi_audio_coding_type_ext { + HDMI_AUDIO_CODING_TYPE_EXT_CT = 0, + HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC = 1, + HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2 = 2, + HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND = 3, + HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC = 4, + HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC_V2 = 5, + HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_AAC_LC = 6, + HDMI_AUDIO_CODING_TYPE_EXT_DRA = 7, + HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_HE_AAC_SURROUND = 8, + HDMI_AUDIO_CODING_TYPE_EXT_MPEG4_AAC_LC_SURROUND = 10, +}; + +struct hdmi_audio_infoframe { + enum hdmi_infoframe_type type; + unsigned char version; + unsigned char length; + unsigned char channels; + enum hdmi_audio_coding_type coding_type; + enum hdmi_audio_sample_size sample_size; + enum hdmi_audio_sample_frequency sample_frequency; + enum hdmi_audio_coding_type_ext coding_type_ext; + unsigned char channel_allocation; + unsigned char level_shift_value; + bool downmix_inhibit; +}; + +enum hdmi_3d_structure { + HDMI_3D_STRUCTURE_INVALID = 4294967295, + HDMI_3D_STRUCTURE_FRAME_PACKING = 0, + HDMI_3D_STRUCTURE_FIELD_ALTERNATIVE = 1, + HDMI_3D_STRUCTURE_LINE_ALTERNATIVE = 2, + HDMI_3D_STRUCTURE_SIDE_BY_SIDE_FULL = 3, + HDMI_3D_STRUCTURE_L_DEPTH = 4, + HDMI_3D_STRUCTURE_L_DEPTH_GFX_GFX_DEPTH = 5, + HDMI_3D_STRUCTURE_TOP_AND_BOTTOM = 6, + HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF = 8, +}; + +struct hdmi_vendor_infoframe { + enum hdmi_infoframe_type type; + unsigned char version; + unsigned char length; + unsigned int oui; + u8 vic; + enum hdmi_3d_structure s3d_struct; + unsigned int s3d_ext_data; +}; + +union hdmi_vendor_any_infoframe { + struct { + enum hdmi_infoframe_type type; + unsigned char version; + unsigned char length; + unsigned int oui; + } any; + struct hdmi_vendor_infoframe hdmi; +}; + +union hdmi_infoframe { + struct hdmi_any_infoframe any; + struct hdmi_avi_infoframe avi; + struct hdmi_spd_infoframe spd; + union hdmi_vendor_any_infoframe vendor; + struct hdmi_audio_infoframe audio; + struct hdmi_drm_infoframe drm; +}; + +struct vc { + struct vc_data *d; + struct work_struct SAK_work; +}; + +struct vgastate { + void *vgabase; + long unsigned int membase; + __u32 memsize; + __u32 flags; + __u32 depth; + __u32 num_attr; + __u32 num_crtc; + __u32 num_gfx; + __u32 num_seq; + void *vidstate; +}; + +struct linux_logo { + int type; + unsigned int width; + unsigned int height; + unsigned int clutsize; + const unsigned char *clut; + const unsigned char *data; +}; + +struct fb_fix_screeninfo { + char id[16]; + long unsigned int smem_start; + __u32 smem_len; + __u32 type; + __u32 type_aux; + __u32 visual; + __u16 xpanstep; + __u16 ypanstep; + __u16 ywrapstep; + __u32 line_length; + long unsigned int mmio_start; + __u32 mmio_len; + __u32 accel; + __u16 capabilities; + __u16 reserved[2]; +}; + +struct fb_bitfield { + __u32 offset; + __u32 length; + __u32 msb_right; +}; + +struct fb_var_screeninfo { + __u32 xres; + __u32 yres; + __u32 xres_virtual; + __u32 yres_virtual; + __u32 xoffset; + __u32 yoffset; + __u32 bits_per_pixel; + __u32 grayscale; + struct fb_bitfield red; + struct fb_bitfield green; + struct fb_bitfield blue; + struct fb_bitfield transp; + __u32 nonstd; + __u32 activate; + __u32 height; + __u32 width; + __u32 accel_flags; + __u32 pixclock; + __u32 left_margin; + __u32 right_margin; + __u32 upper_margin; + __u32 lower_margin; + __u32 hsync_len; + __u32 vsync_len; + __u32 sync; + __u32 vmode; + __u32 rotate; + __u32 colorspace; + __u32 reserved[4]; +}; + +struct fb_cmap { + __u32 start; + __u32 len; + __u16 *red; + __u16 *green; + __u16 *blue; + __u16 *transp; +}; + +enum { + FB_BLANK_UNBLANK = 0, + FB_BLANK_NORMAL = 1, + FB_BLANK_VSYNC_SUSPEND = 2, + FB_BLANK_HSYNC_SUSPEND = 3, + FB_BLANK_POWERDOWN = 4, +}; + +struct fb_copyarea { + __u32 dx; + __u32 dy; + __u32 width; + __u32 height; + __u32 sx; + __u32 sy; +}; + +struct fb_fillrect { + __u32 dx; + __u32 dy; + __u32 width; + __u32 height; + __u32 color; + __u32 rop; +}; + +struct fb_image { + __u32 dx; + __u32 dy; + __u32 width; + __u32 height; + __u32 fg_color; + __u32 bg_color; + __u8 depth; + const char *data; + struct fb_cmap cmap; +}; + +struct fbcurpos { + __u16 x; + __u16 y; +}; + +struct fb_cursor { + __u16 set; + __u16 enable; + __u16 rop; + const char *mask; + struct fbcurpos hot; + struct fb_image image; +}; + +struct fb_chroma { + __u32 redx; + __u32 greenx; + __u32 bluex; + __u32 whitex; + __u32 redy; + __u32 greeny; + __u32 bluey; + __u32 whitey; +}; + +struct fb_videomode; + +struct fb_monspecs { + struct fb_chroma chroma; + struct fb_videomode *modedb; + __u8 manufacturer[4]; + __u8 monitor[14]; + __u8 serial_no[14]; + __u8 ascii[14]; + __u32 modedb_len; + __u32 model; + __u32 serial; + __u32 year; + __u32 week; + __u32 hfmin; + __u32 hfmax; + __u32 dclkmin; + __u32 dclkmax; + __u16 input; + __u16 dpms; + __u16 signal; + __u16 vfmin; + __u16 vfmax; + __u16 gamma; + __u16 gtf: 1; + __u16 misc; + __u8 version; + __u8 revision; + __u8 max_x; + __u8 max_y; +}; + +struct fb_videomode { + const char *name; + u32 refresh; + u32 xres; + u32 yres; + u32 pixclock; + u32 left_margin; + u32 right_margin; + u32 upper_margin; + u32 lower_margin; + u32 hsync_len; + u32 vsync_len; + u32 sync; + u32 vmode; + u32 flag; +}; + +struct fb_info; + +struct fb_event { + struct fb_info *info; + void *data; +}; + +struct fb_pixmap { + u8 *addr; + u32 size; + u32 offset; + u32 buf_align; + u32 scan_align; + u32 access_align; + u32 flags; + u32 blit_x; + u32 blit_y; + void (*writeio)(struct fb_info *, void *, void *, unsigned int); + void (*readio)(struct fb_info *, void *, void *, unsigned int); +}; + +struct fb_deferred_io; + +struct fb_ops; + +struct fb_tile_ops; + +struct apertures_struct; + +struct fb_info { + atomic_t count; + int node; + int flags; + int fbcon_rotate_hint; + struct mutex lock; + struct mutex mm_lock; + struct fb_var_screeninfo var; + struct fb_fix_screeninfo fix; + struct fb_monspecs monspecs; + struct work_struct queue; + struct fb_pixmap pixmap; + struct fb_pixmap sprite; + struct fb_cmap cmap; + struct list_head modelist; + struct fb_videomode *mode; + struct delayed_work deferred_work; + struct fb_deferred_io *fbdefio; + const struct fb_ops *fbops; + struct device *device; + struct device *dev; + int class_flag; + struct fb_tile_ops *tileops; + union { + char *screen_base; + char *screen_buffer; + }; + long unsigned int screen_size; + void *pseudo_palette; + u32 state; + void *fbcon_par; + void *par; + struct apertures_struct *apertures; + bool skip_vt_switch; +}; + +struct fb_blit_caps { + u32 x; + u32 y; + u32 len; + u32 flags; +}; + +struct fb_deferred_io { + long unsigned int delay; + struct mutex lock; + struct list_head pagelist; + void (*first_io)(struct fb_info *); + void (*deferred_io)(struct fb_info *, struct list_head *); +}; + +struct fb_ops { + struct module *owner; + int (*fb_open)(struct fb_info *, int); + int (*fb_release)(struct fb_info *, int); + ssize_t (*fb_read)(struct fb_info *, char *, size_t, loff_t *); + ssize_t (*fb_write)(struct fb_info *, const char *, size_t, loff_t *); + int (*fb_check_var)(struct fb_var_screeninfo *, struct fb_info *); + int (*fb_set_par)(struct fb_info *); + int (*fb_setcolreg)(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, struct fb_info *); + int (*fb_setcmap)(struct fb_cmap *, struct fb_info *); + int (*fb_blank)(int, struct fb_info *); + int (*fb_pan_display)(struct fb_var_screeninfo *, struct fb_info *); + void (*fb_fillrect)(struct fb_info *, const struct fb_fillrect *); + void (*fb_copyarea)(struct fb_info *, const struct fb_copyarea *); + void (*fb_imageblit)(struct fb_info *, const struct fb_image *); + int (*fb_cursor)(struct fb_info *, struct fb_cursor *); + int (*fb_sync)(struct fb_info *); + int (*fb_ioctl)(struct fb_info *, unsigned int, long unsigned int); + int (*fb_compat_ioctl)(struct fb_info *, unsigned int, long unsigned int); + int (*fb_mmap)(struct fb_info *, struct vm_area_struct *); + void (*fb_get_caps)(struct fb_info *, struct fb_blit_caps *, struct fb_var_screeninfo *); + void (*fb_destroy)(struct fb_info *); + int (*fb_debug_enter)(struct fb_info *); + int (*fb_debug_leave)(struct fb_info *); +}; + +struct fb_tilemap { + __u32 width; + __u32 height; + __u32 depth; + __u32 length; + const __u8 *data; +}; + +struct fb_tilerect { + __u32 sx; + __u32 sy; + __u32 width; + __u32 height; + __u32 index; + __u32 fg; + __u32 bg; + __u32 rop; +}; + +struct fb_tilearea { + __u32 sx; + __u32 sy; + __u32 dx; + __u32 dy; + __u32 width; + __u32 height; +}; + +struct fb_tileblit { + __u32 sx; + __u32 sy; + __u32 width; + __u32 height; + __u32 fg; + __u32 bg; + __u32 length; + __u32 *indices; +}; + +struct fb_tilecursor { + __u32 sx; + __u32 sy; + __u32 mode; + __u32 shape; + __u32 fg; + __u32 bg; +}; + +struct fb_tile_ops { + void (*fb_settile)(struct fb_info *, struct fb_tilemap *); + void (*fb_tilecopy)(struct fb_info *, struct fb_tilearea *); + void (*fb_tilefill)(struct fb_info *, struct fb_tilerect *); + void (*fb_tileblit)(struct fb_info *, struct fb_tileblit *); + void (*fb_tilecursor)(struct fb_info *, struct fb_tilecursor *); + int (*fb_get_tilemax)(struct fb_info *); +}; + +struct aperture { + resource_size_t base; + resource_size_t size; +}; + +struct apertures_struct { + unsigned int count; + struct aperture ranges[0]; +}; + +enum backlight_update_reason { + BACKLIGHT_UPDATE_HOTKEY = 0, + BACKLIGHT_UPDATE_SYSFS = 1, +}; + +enum backlight_type { + BACKLIGHT_RAW = 1, + BACKLIGHT_PLATFORM = 2, + BACKLIGHT_FIRMWARE = 3, + BACKLIGHT_TYPE_MAX = 4, +}; + +enum backlight_notification { + BACKLIGHT_REGISTERED = 0, + BACKLIGHT_UNREGISTERED = 1, +}; + +enum backlight_scale { + BACKLIGHT_SCALE_UNKNOWN = 0, + BACKLIGHT_SCALE_LINEAR = 1, + BACKLIGHT_SCALE_NON_LINEAR = 2, +}; + +struct backlight_device; + +struct backlight_ops { + unsigned int options; + int (*update_status)(struct backlight_device *); + int (*get_brightness)(struct backlight_device *); + int (*check_fb)(struct backlight_device *, struct fb_info *); +}; + +struct backlight_properties { + int brightness; + int max_brightness; + int power; + int fb_blank; + enum backlight_type type; + unsigned int state; + enum backlight_scale scale; +}; + +struct backlight_device { + struct backlight_properties props; + struct mutex update_lock; + struct mutex ops_lock; + const struct backlight_ops *ops; + struct notifier_block fb_notif; + struct list_head entry; + struct device dev; + bool fb_bl_on[32]; + int use_count; +}; + +struct fb_cmap_user { + __u32 start; + __u32 len; + __u16 *red; + __u16 *green; + __u16 *blue; + __u16 *transp; +}; + +struct fb_modelist { + struct list_head list; + struct fb_videomode mode; +}; + +struct logo_data { + int depth; + int needs_directpalette; + int needs_truepalette; + int needs_cmapreset; + const struct linux_logo *logo; +}; + +struct fb_fix_screeninfo32 { + char id[16]; + compat_caddr_t smem_start; + u32 smem_len; + u32 type; + u32 type_aux; + u32 visual; + u16 xpanstep; + u16 ypanstep; + u16 ywrapstep; + u32 line_length; + compat_caddr_t mmio_start; + u32 mmio_len; + u32 accel; + u16 reserved[3]; +}; + +struct fb_cmap32 { + u32 start; + u32 len; + compat_caddr_t red; + compat_caddr_t green; + compat_caddr_t blue; + compat_caddr_t transp; +}; + +struct fb_cvt_data { + u32 xres; + u32 yres; + u32 refresh; + u32 f_refresh; + u32 pixclock; + u32 hperiod; + u32 hblank; + u32 hfreq; + u32 htotal; + u32 vtotal; + u32 vsync; + u32 hsync; + u32 h_front_porch; + u32 h_back_porch; + u32 v_front_porch; + u32 v_back_porch; + u32 h_margin; + u32 v_margin; + u32 interlace; + u32 aspect_ratio; + u32 active_pixels; + u32 flags; + u32 status; +}; + +typedef unsigned char u_char; + +typedef short unsigned int u_short; + +struct fb_con2fbmap { + __u32 console; + __u32 framebuffer; +}; + +struct fbcon_display { + const u_char *fontdata; + int userfont; + u_short scrollmode; + u_short inverse; + short int yscroll; + int vrows; + int cursor_shape; + int con_rotate; + u32 xres_virtual; + u32 yres_virtual; + u32 height; + u32 width; + u32 bits_per_pixel; + u32 grayscale; + u32 nonstd; + u32 accel_flags; + u32 rotate; + struct fb_bitfield red; + struct fb_bitfield green; + struct fb_bitfield blue; + struct fb_bitfield transp; + const struct fb_videomode *mode; +}; + +struct fbcon_ops { + void (*bmove)(struct vc_data *, struct fb_info *, int, int, int, int, int, int); + void (*clear)(struct vc_data *, struct fb_info *, int, int, int, int); + void (*putcs)(struct vc_data *, struct fb_info *, const short unsigned int *, int, int, int, int, int); + void (*clear_margins)(struct vc_data *, struct fb_info *, int, int); + void (*cursor)(struct vc_data *, struct fb_info *, int, int, int); + int (*update_start)(struct fb_info *); + int (*rotate_font)(struct fb_info *, struct vc_data *); + struct fb_var_screeninfo var; + struct timer_list cursor_timer; + struct fb_cursor cursor_state; + struct fbcon_display *p; + struct fb_info *info; + int currcon; + int cur_blink_jiffies; + int cursor_flash; + int cursor_reset; + int blank_state; + int graphics; + int save_graphics; + int flags; + int rotate; + int cur_rotate; + char *cursor_data; + u8 *fontbuffer; + u8 *fontdata; + u8 *cursor_src; + u32 cursor_size; + u32 fd_size; +}; + +enum { + FBCON_LOGO_CANSHOW = 4294967295, + FBCON_LOGO_DRAW = 4294967294, + FBCON_LOGO_DONTSHOW = 4294967293, +}; + +typedef uint32_t evtchn_port_t; + +struct xenfb_update { + uint8_t type; + int32_t x; + int32_t y; + int32_t width; + int32_t height; +}; + +struct xenfb_resize { + uint8_t type; + int32_t width; + int32_t height; + int32_t stride; + int32_t depth; + int32_t offset; +}; + +union xenfb_out_event { + uint8_t type; + struct xenfb_update update; + struct xenfb_resize resize; + char pad[40]; +}; + +struct xenfb_page { + uint32_t in_cons; + uint32_t in_prod; + uint32_t out_cons; + uint32_t out_prod; + int32_t width; + int32_t height; + uint32_t line_length; + uint32_t mem_length; + uint8_t depth; + long unsigned int pd[256]; +}; + +enum xenbus_state { + XenbusStateUnknown = 0, + XenbusStateInitialising = 1, + XenbusStateInitWait = 2, + XenbusStateInitialised = 3, + XenbusStateConnected = 4, + XenbusStateClosing = 5, + XenbusStateClosed = 6, + XenbusStateReconfiguring = 7, + XenbusStateReconfigured = 8, +}; + +struct xsd_errors { + int errnum; + const char *errstring; +}; + +struct xenbus_watch { + struct list_head list; + const char *node; + unsigned int nr_pending; + bool (*will_handle)(struct xenbus_watch *, const char *, const char *); + void (*callback)(struct xenbus_watch *, const char *, const char *); +}; + +struct xenbus_device { + const char *devicetype; + const char *nodename; + const char *otherend; + int otherend_id; + struct xenbus_watch otherend_watch; + struct device dev; + enum xenbus_state state; + struct completion down; + struct work_struct work; + struct semaphore reclaim_sem; +}; + +struct xenbus_device_id { + char devicetype[32]; +}; + +struct xenbus_driver { + const char *name; + const struct xenbus_device_id *ids; + bool allow_rebind; + int (*probe)(struct xenbus_device *, const struct xenbus_device_id *); + void (*otherend_changed)(struct xenbus_device *, enum xenbus_state); + int (*remove)(struct xenbus_device *); + int (*suspend)(struct xenbus_device *); + int (*resume)(struct xenbus_device *); + int (*uevent)(struct xenbus_device *, struct kobj_uevent_env *); + struct device_driver driver; + int (*read_otherend_details)(struct xenbus_device *); + int (*is_ready)(struct xenbus_device *); + void (*reclaim_memory)(struct xenbus_device *); +}; + +struct xenbus_transaction { + u32 id; +}; + +struct xenfb_info { + unsigned char *fb; + struct fb_info *fb_info; + int x1; + int y1; + int x2; + int y2; + spinlock_t dirty_lock; + int nr_pages; + int irq; + struct xenfb_page *page; + long unsigned int *gfns; + int update_wanted; + int feature_resize; + struct xenfb_resize resize; + int resize_dpy; + spinlock_t resize_lock; + struct xenbus_device *xbdev; +}; + +enum { + KPARAM_MEM = 0, + KPARAM_WIDTH = 1, + KPARAM_HEIGHT = 2, + KPARAM_CNT = 3, +}; + +struct vesafb_par { + u32 pseudo_palette[256]; + int wc_cookie; + struct resource *region; +}; + +struct acpi_table_bgrt { + struct acpi_table_header header; + u16 version; + u8 status; + u8 image_type; + u64 image_address; + u32 image_offset_x; + u32 image_offset_y; +}; + +enum drm_panel_orientation { + DRM_MODE_PANEL_ORIENTATION_UNKNOWN = 4294967295, + DRM_MODE_PANEL_ORIENTATION_NORMAL = 0, + DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP = 1, + DRM_MODE_PANEL_ORIENTATION_LEFT_UP = 2, + DRM_MODE_PANEL_ORIENTATION_RIGHT_UP = 3, +}; + +struct bmp_file_header { + u16 id; + u32 file_size; + u32 reserved; + u32 bitmap_offset; +} __attribute__((packed)); + +struct bmp_dib_header { + u32 dib_header_size; + s32 width; + s32 height; + u16 planes; + u16 bpp; + u32 compression; + u32 bitmap_size; + u32 horz_resolution; + u32 vert_resolution; + u32 colors_used; + u32 colors_important; +}; + +struct thermal_cooling_device_ops; + +struct thermal_cooling_device { + int id; + char type[20]; + struct device device; + struct device_node *np; + void *devdata; + void *stats; + const struct thermal_cooling_device_ops *ops; + bool updated; + struct mutex lock; + struct list_head thermal_instances; + struct list_head node; +}; + +struct idle_cpu { + struct cpuidle_state *state_table; + long unsigned int auto_demotion_disable_flags; + bool byt_auto_demotion_disable_flag; + bool disable_promotion_to_c1e; + bool use_acpi; +}; + +struct thermal_cooling_device_ops { + int (*get_max_state)(struct thermal_cooling_device *, long unsigned int *); + int (*get_cur_state)(struct thermal_cooling_device *, long unsigned int *); + int (*set_cur_state)(struct thermal_cooling_device *, long unsigned int); + int (*get_requested_power)(struct thermal_cooling_device *, u32 *); + int (*state2power)(struct thermal_cooling_device *, long unsigned int, u32 *); + int (*power2state)(struct thermal_cooling_device *, u32, long unsigned int *); +}; + +struct acpi_lpi_state { + u32 min_residency; + u32 wake_latency; + u32 flags; + u32 arch_flags; + u32 res_cnt_freq; + u32 enable_parent_state; + u64 address; + u8 index; + u8 entry_method; + char desc[32]; +}; + +struct acpi_processor_power { + int count; + union { + struct acpi_processor_cx states[8]; + struct acpi_lpi_state lpi_states[8]; + }; + int timer_broadcast_on_state; +}; + +struct acpi_psd_package { + u64 num_entries; + u64 revision; + u64 domain; + u64 coord_type; + u64 num_processors; +}; + +struct acpi_pct_register { + u8 descriptor; + u16 length; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 reserved; + u64 address; +} __attribute__((packed)); + +struct acpi_processor_px { + u64 core_frequency; + u64 power; + u64 transition_latency; + u64 bus_master_latency; + u64 control; + u64 status; +}; + +struct acpi_processor_performance { + unsigned int state; + unsigned int platform_limit; + struct acpi_pct_register control_register; + struct acpi_pct_register status_register; + short: 16; + unsigned int state_count; + int: 32; + struct acpi_processor_px *states; + struct acpi_psd_package domain_info; + cpumask_var_t shared_cpu_map; + unsigned int shared_type; + int: 32; +} __attribute__((packed)); + +struct acpi_tsd_package { + u64 num_entries; + u64 revision; + u64 domain; + u64 coord_type; + u64 num_processors; +}; + +struct acpi_processor_tx_tss { + u64 freqpercentage; + u64 power; + u64 transition_latency; + u64 control; + u64 status; +}; + +struct acpi_processor_tx { + u16 power; + u16 performance; +}; + +struct acpi_processor; + +struct acpi_processor_throttling { + unsigned int state; + unsigned int platform_limit; + struct acpi_pct_register control_register; + struct acpi_pct_register status_register; + short: 16; + unsigned int state_count; + int: 32; + struct acpi_processor_tx_tss *states_tss; + struct acpi_tsd_package domain_info; + cpumask_var_t shared_cpu_map; + int (*acpi_processor_get_throttling)(struct acpi_processor *); + int (*acpi_processor_set_throttling)(struct acpi_processor *, int, bool); + u32 address; + u8 duty_offset; + u8 duty_width; + u8 tsd_valid_flag; + char: 8; + unsigned int shared_type; + struct acpi_processor_tx states[16]; + int: 32; +} __attribute__((packed)); + +struct acpi_processor_lx { + int px; + int tx; +}; + +struct acpi_processor_limit { + struct acpi_processor_lx state; + struct acpi_processor_lx thermal; + struct acpi_processor_lx user; +}; + +struct acpi_processor { + acpi_handle handle; + u32 acpi_id; + phys_cpuid_t phys_id; + u32 id; + u32 pblk; + int performance_platform_limit; + int throttling_platform_limit; + struct acpi_processor_flags flags; + struct acpi_processor_power power; + struct acpi_processor_performance *performance; + struct acpi_processor_throttling throttling; + struct acpi_processor_limit limit; + struct thermal_cooling_device *cdev; + struct device *dev; + struct freq_qos_request perflib_req; + struct freq_qos_request thermal_req; +}; + +enum ipmi_addr_src { + SI_INVALID = 0, + SI_HOTMOD = 1, + SI_HARDCODED = 2, + SI_SPMI = 3, + SI_ACPI = 4, + SI_SMBIOS = 5, + SI_PCI = 6, + SI_DEVICETREE = 7, + SI_PLATFORM = 8, + SI_LAST = 9, +}; + +struct dmi_header { + u8 type; + u8 length; + u16 handle; +}; + +enum si_type { + SI_TYPE_INVALID = 0, + SI_KCS = 1, + SI_SMIC = 2, + SI_BT = 3, +}; + +enum ipmi_addr_space { + IPMI_IO_ADDR_SPACE = 0, + IPMI_MEM_ADDR_SPACE = 1, +}; + +enum ipmi_plat_interface_type { + IPMI_PLAT_IF_SI = 0, + IPMI_PLAT_IF_SSIF = 1, +}; + +struct ipmi_plat_data { + enum ipmi_plat_interface_type iftype; + unsigned int type; + unsigned int space; + long unsigned int addr; + unsigned int regspacing; + unsigned int regsize; + unsigned int regshift; + unsigned int irq; + unsigned int slave_addr; + enum ipmi_addr_src addr_source; +}; + +struct ipmi_dmi_info { + enum si_type si_type; + unsigned int space; + long unsigned int addr; + u8 slave_addr; + struct ipmi_dmi_info *next; +}; + +typedef u16 acpi_owner_id; + +union acpi_name_union { + u32 integer; + char ascii[4]; +}; + +struct acpi_table_desc { + acpi_physical_address address; + struct acpi_table_header *pointer; + u32 length; + union acpi_name_union signature; + acpi_owner_id owner_id; + u8 flags; + u16 validation_count; +}; + +struct acpi_madt_io_sapic { + struct acpi_subtable_header header; + u8 id; + u8 reserved; + u32 global_irq_base; + u64 address; +}; + +struct acpi_madt_interrupt_source { + struct acpi_subtable_header header; + u16 inti_flags; + u8 type; + u8 id; + u8 eid; + u8 io_sapic_vector; + u32 global_irq; + u32 flags; +}; + +struct acpi_madt_generic_interrupt { + struct acpi_subtable_header header; + u16 reserved; + u32 cpu_interface_number; + u32 uid; + u32 flags; + u32 parking_version; + u32 performance_interrupt; + u64 parked_address; + u64 base_address; + u64 gicv_base_address; + u64 gich_base_address; + u32 vgic_interrupt; + u64 gicr_base_address; + u64 arm_mpidr; + u8 efficiency_class; + u8 reserved2[1]; + u16 spe_interrupt; +} __attribute__((packed)); + +struct acpi_madt_generic_distributor { + struct acpi_subtable_header header; + u16 reserved; + u32 gic_id; + u64 base_address; + u32 global_irq_base; + u8 version; + u8 reserved2[3]; +}; + +enum acpi_subtable_type { + ACPI_SUBTABLE_COMMON = 0, + ACPI_SUBTABLE_HMAT = 1, +}; + +struct acpi_subtable_entry { + union acpi_subtable_headers *hdr; + enum acpi_subtable_type type; +}; + +enum acpi_predicate { + all_versions = 0, + less_than_or_equal = 1, + equal = 2, + greater_than_or_equal = 3, +}; + +struct acpi_platform_list { + char oem_id[7]; + char oem_table_id[9]; + u32 oem_revision; + char *table; + enum acpi_predicate pred; + char *reason; + u32 data; +}; + +typedef u32 (*acpi_interface_handler)(acpi_string, u32); + +struct acpi_osi_entry { + char string[64]; + bool enable; +}; + +struct acpi_osi_config { + u8 default_disabling; + unsigned int linux_enable: 1; + unsigned int linux_dmi: 1; + unsigned int linux_cmdline: 1; + unsigned int darwin_enable: 1; + unsigned int darwin_dmi: 1; + unsigned int darwin_cmdline: 1; +}; + +struct acpi_predefined_names { + const char *name; + u8 type; + char *val; +}; + +typedef u32 (*acpi_osd_handler)(void *); + +typedef void (*acpi_osd_exec_callback)(void *); + +typedef u32 (*acpi_gpe_handler)(acpi_handle, u32, void *); + +struct acpi_pci_id { + u16 segment; + u16 bus; + u16 device; + u16 function; +}; + +struct acpi_mem_mapping { + acpi_physical_address physical_address; + u8 *logical_address; + acpi_size length; + struct acpi_mem_mapping *next_mm; +}; + +struct acpi_mem_space_context { + u32 length; + acpi_physical_address address; + struct acpi_mem_mapping *cur_mm; + struct acpi_mem_mapping *first_mm; +}; + +typedef enum { + OSL_GLOBAL_LOCK_HANDLER = 0, + OSL_NOTIFY_HANDLER = 1, + OSL_GPE_HANDLER = 2, + OSL_DEBUGGER_MAIN_THREAD = 3, + OSL_DEBUGGER_EXEC_THREAD = 4, + OSL_EC_POLL_HANDLER = 5, + OSL_EC_BURST_HANDLER = 6, +} acpi_execute_type; + +union acpi_operand_object; + +struct acpi_namespace_node { + union acpi_operand_object *object; + u8 descriptor_type; + u8 type; + u16 flags; + union acpi_name_union name; + struct acpi_namespace_node *parent; + struct acpi_namespace_node *child; + struct acpi_namespace_node *peer; + acpi_owner_id owner_id; +}; + +struct acpi_object_common { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; +}; + +struct acpi_object_integer { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 fill[3]; + u64 value; +}; + +struct acpi_object_string { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + char *pointer; + u32 length; +}; + +struct acpi_object_buffer { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 *pointer; + u32 length; + u32 aml_length; + u8 *aml_start; + struct acpi_namespace_node *node; +}; + +struct acpi_object_package { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + struct acpi_namespace_node *node; + union acpi_operand_object **elements; + u8 *aml_start; + u32 aml_length; + u32 count; +}; + +struct acpi_object_event { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + void *os_semaphore; +}; + +struct acpi_walk_state; + +typedef acpi_status (*acpi_internal_method)(struct acpi_walk_state *); + +struct acpi_object_method { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 info_flags; + u8 param_count; + u8 sync_level; + union acpi_operand_object *mutex; + union acpi_operand_object *node; + u8 *aml_start; + union { + acpi_internal_method implementation; + union acpi_operand_object *handler; + } dispatch; + u32 aml_length; + acpi_owner_id owner_id; + u8 thread_count; +}; + +struct acpi_thread_state; + +struct acpi_object_mutex { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 sync_level; + u16 acquisition_depth; + void *os_mutex; + u64 thread_id; + struct acpi_thread_state *owner_thread; + union acpi_operand_object *prev; + union acpi_operand_object *next; + struct acpi_namespace_node *node; + u8 original_sync_level; +}; + +struct acpi_object_region { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 space_id; + struct acpi_namespace_node *node; + union acpi_operand_object *handler; + union acpi_operand_object *next; + acpi_physical_address address; + u32 length; +}; + +struct acpi_object_notify_common { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + union acpi_operand_object *notify_list[2]; + union acpi_operand_object *handler; +}; + +struct acpi_gpe_block_info; + +struct acpi_object_device { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + union acpi_operand_object *notify_list[2]; + union acpi_operand_object *handler; + struct acpi_gpe_block_info *gpe_block; +}; + +struct acpi_object_power_resource { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + union acpi_operand_object *notify_list[2]; + union acpi_operand_object *handler; + u32 system_level; + u32 resource_order; +}; + +struct acpi_object_processor { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 proc_id; + u8 length; + union acpi_operand_object *notify_list[2]; + union acpi_operand_object *handler; + acpi_io_address address; +}; + +struct acpi_object_thermal_zone { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + union acpi_operand_object *notify_list[2]; + union acpi_operand_object *handler; +}; + +struct acpi_object_field_common { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 field_flags; + u8 attribute; + u8 access_byte_width; + struct acpi_namespace_node *node; + u32 bit_length; + u32 base_byte_offset; + u32 value; + u8 start_field_bit_offset; + u8 access_length; + union acpi_operand_object *region_obj; +}; + +struct acpi_object_region_field { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 field_flags; + u8 attribute; + u8 access_byte_width; + struct acpi_namespace_node *node; + u32 bit_length; + u32 base_byte_offset; + u32 value; + u8 start_field_bit_offset; + u8 access_length; + u16 resource_length; + union acpi_operand_object *region_obj; + u8 *resource_buffer; + u16 pin_number_index; + u8 *internal_pcc_buffer; +}; + +struct acpi_object_buffer_field { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 field_flags; + u8 attribute; + u8 access_byte_width; + struct acpi_namespace_node *node; + u32 bit_length; + u32 base_byte_offset; + u32 value; + u8 start_field_bit_offset; + u8 access_length; + u8 is_create_field; + union acpi_operand_object *buffer_obj; +}; + +struct acpi_object_bank_field { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 field_flags; + u8 attribute; + u8 access_byte_width; + struct acpi_namespace_node *node; + u32 bit_length; + u32 base_byte_offset; + u32 value; + u8 start_field_bit_offset; + u8 access_length; + union acpi_operand_object *region_obj; + union acpi_operand_object *bank_obj; +}; + +struct acpi_object_index_field { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 field_flags; + u8 attribute; + u8 access_byte_width; + struct acpi_namespace_node *node; + u32 bit_length; + u32 base_byte_offset; + u32 value; + u8 start_field_bit_offset; + u8 access_length; + union acpi_operand_object *index_obj; + union acpi_operand_object *data_obj; +}; + +struct acpi_object_notify_handler { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + struct acpi_namespace_node *node; + u32 handler_type; + acpi_notify_handler handler; + void *context; + union acpi_operand_object *next[2]; +}; + +struct acpi_object_addr_handler { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 space_id; + u8 handler_flags; + acpi_adr_space_handler handler; + struct acpi_namespace_node *node; + void *context; + void *context_mutex; + acpi_adr_space_setup setup; + union acpi_operand_object *region_list; + union acpi_operand_object *next; +}; + +struct acpi_object_reference { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + u8 class; + u8 target_type; + u8 resolved; + void *object; + struct acpi_namespace_node *node; + union acpi_operand_object **where; + u8 *index_pointer; + u8 *aml; + u32 value; +}; + +struct acpi_object_extra { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + struct acpi_namespace_node *method_REG; + struct acpi_namespace_node *scope_node; + void *region_context; + u8 *aml_start; + u32 aml_length; +}; + +struct acpi_object_data { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + acpi_object_handler handler; + void *pointer; +}; + +struct acpi_object_cache_list { + union acpi_operand_object *next_object; + u8 descriptor_type; + u8 type; + u16 reference_count; + u8 flags; + union acpi_operand_object *next; +}; + +union acpi_operand_object { + struct acpi_object_common common; + struct acpi_object_integer integer; + struct acpi_object_string string; + struct acpi_object_buffer buffer; + struct acpi_object_package package; + struct acpi_object_event event; + struct acpi_object_method method; + struct acpi_object_mutex mutex; + struct acpi_object_region region; + struct acpi_object_notify_common common_notify; + struct acpi_object_device device; + struct acpi_object_power_resource power_resource; + struct acpi_object_processor processor; + struct acpi_object_thermal_zone thermal_zone; + struct acpi_object_field_common common_field; + struct acpi_object_region_field field; + struct acpi_object_buffer_field buffer_field; + struct acpi_object_bank_field bank_field; + struct acpi_object_index_field index_field; + struct acpi_object_notify_handler notify; + struct acpi_object_addr_handler address_space; + struct acpi_object_reference reference; + struct acpi_object_extra extra; + struct acpi_object_data data; + struct acpi_object_cache_list cache; + struct acpi_namespace_node node; +}; + +union acpi_parse_object; + +union acpi_generic_state; + +struct acpi_parse_state { + u8 *aml_start; + u8 *aml; + u8 *aml_end; + u8 *pkg_start; + u8 *pkg_end; + union acpi_parse_object *start_op; + struct acpi_namespace_node *start_node; + union acpi_generic_state *scope; + union acpi_parse_object *start_scope; + u32 aml_size; +}; + +typedef acpi_status (*acpi_parse_downwards)(struct acpi_walk_state *, union acpi_parse_object **); + +typedef acpi_status (*acpi_parse_upwards)(struct acpi_walk_state *); + +struct acpi_opcode_info; + +struct acpi_walk_state { + struct acpi_walk_state *next; + u8 descriptor_type; + u8 walk_type; + u16 opcode; + u8 next_op_info; + u8 num_operands; + u8 operand_index; + acpi_owner_id owner_id; + u8 last_predicate; + u8 current_result; + u8 return_used; + u8 scope_depth; + u8 pass_number; + u8 namespace_override; + u8 result_size; + u8 result_count; + u8 *aml; + u32 arg_types; + u32 method_breakpoint; + u32 user_breakpoint; + u32 parse_flags; + struct acpi_parse_state parser_state; + u32 prev_arg_types; + u32 arg_count; + u16 method_nesting_depth; + u8 method_is_nested; + struct acpi_namespace_node arguments[7]; + struct acpi_namespace_node local_variables[8]; + union acpi_operand_object *operands[9]; + union acpi_operand_object **params; + u8 *aml_last_while; + union acpi_operand_object **caller_return_desc; + union acpi_generic_state *control_state; + struct acpi_namespace_node *deferred_node; + union acpi_operand_object *implicit_return_obj; + struct acpi_namespace_node *method_call_node; + union acpi_parse_object *method_call_op; + union acpi_operand_object *method_desc; + struct acpi_namespace_node *method_node; + char *method_pathname; + union acpi_parse_object *op; + const struct acpi_opcode_info *op_info; + union acpi_parse_object *origin; + union acpi_operand_object *result_obj; + union acpi_generic_state *results; + union acpi_operand_object *return_desc; + union acpi_generic_state *scope_info; + union acpi_parse_object *prev_op; + union acpi_parse_object *next_op; + struct acpi_thread_state *thread; + acpi_parse_downwards descending_callback; + acpi_parse_upwards ascending_callback; +}; + +struct acpi_gpe_handler_info { + acpi_gpe_handler address; + void *context; + struct acpi_namespace_node *method_node; + u8 original_flags; + u8 originally_enabled; +}; + +struct acpi_gpe_notify_info { + struct acpi_namespace_node *device_node; + struct acpi_gpe_notify_info *next; +}; + +union acpi_gpe_dispatch_info { + struct acpi_namespace_node *method_node; + struct acpi_gpe_handler_info *handler; + struct acpi_gpe_notify_info *notify_list; +}; + +struct acpi_gpe_register_info; + +struct acpi_gpe_event_info { + union acpi_gpe_dispatch_info dispatch; + struct acpi_gpe_register_info *register_info; + u8 flags; + u8 gpe_number; + u8 runtime_count; + u8 disable_for_dispatch; +}; + +struct acpi_gpe_address { + u8 space_id; + u64 address; +}; + +struct acpi_gpe_register_info { + struct acpi_gpe_address status_address; + struct acpi_gpe_address enable_address; + u16 base_gpe_number; + u8 enable_for_wake; + u8 enable_for_run; + u8 mask_for_run; + u8 enable_mask; +}; + +struct acpi_gpe_xrupt_info; + +struct acpi_gpe_block_info { + struct acpi_namespace_node *node; + struct acpi_gpe_block_info *previous; + struct acpi_gpe_block_info *next; + struct acpi_gpe_xrupt_info *xrupt_block; + struct acpi_gpe_register_info *register_info; + struct acpi_gpe_event_info *event_info; + u64 address; + u32 register_count; + u16 gpe_count; + u16 block_base_number; + u8 space_id; + u8 initialized; +}; + +struct acpi_gpe_xrupt_info { + struct acpi_gpe_xrupt_info *previous; + struct acpi_gpe_xrupt_info *next; + struct acpi_gpe_block_info *gpe_block_list_head; + u32 interrupt_number; +}; + +struct acpi_common_state { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; +}; + +struct acpi_update_state { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; + union acpi_operand_object *object; +}; + +struct acpi_pkg_state { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; + u32 index; + union acpi_operand_object *source_object; + union acpi_operand_object *dest_object; + struct acpi_walk_state *walk_state; + void *this_target_obj; + u32 num_packages; +}; + +struct acpi_control_state { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; + u16 opcode; + union acpi_parse_object *predicate_op; + u8 *aml_predicate_start; + u8 *package_end; + u64 loop_timeout; +}; + +union acpi_parse_value { + u64 integer; + u32 size; + char *string; + u8 *buffer; + char *name; + union acpi_parse_object *arg; +}; + +struct acpi_parse_obj_common { + union acpi_parse_object *parent; + u8 descriptor_type; + u8 flags; + u16 aml_opcode; + u8 *aml; + union acpi_parse_object *next; + struct acpi_namespace_node *node; + union acpi_parse_value value; + u8 arg_list_length; +}; + +struct acpi_parse_obj_named { + union acpi_parse_object *parent; + u8 descriptor_type; + u8 flags; + u16 aml_opcode; + u8 *aml; + union acpi_parse_object *next; + struct acpi_namespace_node *node; + union acpi_parse_value value; + u8 arg_list_length; + char *path; + u8 *data; + u32 length; + u32 name; +}; + +struct acpi_parse_obj_asl { + union acpi_parse_object *parent; + u8 descriptor_type; + u8 flags; + u16 aml_opcode; + u8 *aml; + union acpi_parse_object *next; + struct acpi_namespace_node *node; + union acpi_parse_value value; + u8 arg_list_length; + union acpi_parse_object *child; + union acpi_parse_object *parent_method; + char *filename; + u8 file_changed; + char *parent_filename; + char *external_name; + char *namepath; + char name_seg[4]; + u32 extra_value; + u32 column; + u32 line_number; + u32 logical_line_number; + u32 logical_byte_offset; + u32 end_line; + u32 end_logical_line; + u32 acpi_btype; + u32 aml_length; + u32 aml_subtree_length; + u32 final_aml_length; + u32 final_aml_offset; + u32 compile_flags; + u16 parse_opcode; + u8 aml_opcode_length; + u8 aml_pkg_len_bytes; + u8 extra; + char parse_op_name[20]; +}; + +union acpi_parse_object { + struct acpi_parse_obj_common common; + struct acpi_parse_obj_named named; + struct acpi_parse_obj_asl asl; +}; + +struct acpi_scope_state { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; + struct acpi_namespace_node *node; +}; + +struct acpi_pscope_state { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; + u32 arg_count; + union acpi_parse_object *op; + u8 *arg_end; + u8 *pkg_end; + u32 arg_list; +}; + +struct acpi_thread_state { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; + u8 current_sync_level; + struct acpi_walk_state *walk_state_list; + union acpi_operand_object *acquired_mutex_list; + u64 thread_id; +}; + +struct acpi_result_values { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; + union acpi_operand_object *obj_desc[8]; +}; + +struct acpi_global_notify_handler { + acpi_notify_handler handler; + void *context; +}; + +struct acpi_notify_info { + void *next; + u8 descriptor_type; + u8 flags; + u16 value; + u16 state; + u8 handler_list_id; + struct acpi_namespace_node *node; + union acpi_operand_object *handler_list_head; + struct acpi_global_notify_handler *global; +}; + +union acpi_generic_state { + struct acpi_common_state common; + struct acpi_control_state control; + struct acpi_update_state update; + struct acpi_scope_state scope; + struct acpi_pscope_state parse_scope; + struct acpi_pkg_state pkg; + struct acpi_thread_state thread; + struct acpi_result_values results; + struct acpi_notify_info notify; +}; + +struct acpi_opcode_info { + u32 parse_args; + u32 runtime_args; + u16 flags; + u8 object_type; + u8 class; + u8 type; +}; + +struct acpi_os_dpc { + acpi_osd_exec_callback function; + void *context; + struct work_struct work; +}; + +struct acpi_ioremap { + struct list_head list; + void *virt; + acpi_physical_address phys; + acpi_size size; + union { + long unsigned int refcount; + struct rcu_work rwork; + } track; +}; + +struct acpi_hp_work { + struct work_struct work; + struct acpi_device *adev; + u32 src; +}; + +struct acpi_pld_info { + u8 revision; + u8 ignore_color; + u8 red; + u8 green; + u8 blue; + u16 width; + u16 height; + u8 user_visible; + u8 dock; + u8 lid; + u8 panel; + u8 vertical_position; + u8 horizontal_position; + u8 shape; + u8 group_orientation; + u8 group_token; + u8 group_position; + u8 bay; + u8 ejectable; + u8 ospm_eject_required; + u8 cabinet_number; + u8 card_cage_number; + u8 reference; + u8 rotation; + u8 order; + u8 reserved; + u16 vertical_offset; + u16 horizontal_offset; +}; + +struct acpi_handle_list { + u32 count; + acpi_handle handles[10]; +}; + +struct acpi_device_bus_id { + const char *bus_id; + struct ida instance_ida; + struct list_head node; +}; + +struct acpi_dev_match_info { + struct acpi_device_id hid[2]; + const char *uid; + s64 hrv; +}; + +struct nvs_region { + __u64 phys_start; + __u64 size; + struct list_head node; +}; + +struct nvs_page { + long unsigned int phys_start; + unsigned int size; + void *kaddr; + void *data; + bool unmap; + struct list_head node; +}; + +struct acpi_wakeup_handler { + struct list_head list_node; + bool (*wakeup)(void *); + void *context; +}; + +typedef u32 acpi_event_status; + +struct acpi_table_facs { + char signature[4]; + u32 length; + u32 hardware_signature; + u32 firmware_waking_vector; + u32 global_lock; + u32 flags; + u64 xfirmware_waking_vector; + u8 version; + u8 reserved[3]; + u32 ospm_flags; + u8 reserved1[24]; +}; + +struct acpi_hardware_id { + struct list_head list; + const char *id; +}; + +struct acpi_data_node { + const char *name; + acpi_handle handle; + struct fwnode_handle fwnode; + struct fwnode_handle *parent; + struct acpi_device_data data; + struct list_head sibling; + struct kobject kobj; + struct completion kobj_done; +}; + +struct acpi_data_node_attr { + struct attribute attr; + ssize_t (*show)(struct acpi_data_node *, char *); + ssize_t (*store)(struct acpi_data_node *, const char *, size_t); +}; + +struct pm_domain_data { + struct list_head list_node; + struct device *dev; +}; + +struct acpi_device_physical_node { + unsigned int node_id; + struct list_head node; + struct device *dev; + bool put_online: 1; +}; + +typedef u32 (*acpi_event_handler)(void *); + +typedef acpi_status (*acpi_table_handler)(u32, void *, void *); + +enum acpi_bus_device_type { + ACPI_BUS_TYPE_DEVICE = 0, + ACPI_BUS_TYPE_POWER = 1, + ACPI_BUS_TYPE_PROCESSOR = 2, + ACPI_BUS_TYPE_THERMAL = 3, + ACPI_BUS_TYPE_POWER_BUTTON = 4, + ACPI_BUS_TYPE_SLEEP_BUTTON = 5, + ACPI_BUS_TYPE_ECDT_EC = 6, + ACPI_BUS_DEVICE_TYPE_COUNT = 7, +}; + +struct acpi_osc_context { + char *uuid_str; + int rev; + struct acpi_buffer cap; + struct acpi_buffer ret; +}; + +struct acpi_pnp_device_id { + u32 length; + char *string; +}; + +struct acpi_pnp_device_id_list { + u32 count; + u32 list_size; + struct acpi_pnp_device_id ids[0]; +}; + +struct acpi_device_info { + u32 info_size; + u32 name; + acpi_object_type type; + u8 param_count; + u16 valid; + u8 flags; + u8 highest_dstates[4]; + u8 lowest_dstates[5]; + u64 address; + struct acpi_pnp_device_id hardware_id; + struct acpi_pnp_device_id unique_id; + struct acpi_pnp_device_id class_code; + struct acpi_pnp_device_id_list compatible_id_list; +}; + +struct acpi_table_spcr { + struct acpi_table_header header; + u8 interface_type; + u8 reserved[3]; + struct acpi_generic_address serial_port; + u8 interrupt_type; + u8 pc_interrupt; + u32 interrupt; + u8 baud_rate; + u8 parity; + u8 stop_bits; + u8 flow_control; + u8 terminal_type; + u8 reserved1; + u16 pci_device_id; + u16 pci_vendor_id; + u8 pci_bus; + u8 pci_device; + u8 pci_function; + u32 pci_flags; + u8 pci_segment; + u32 reserved2; +} __attribute__((packed)); + +struct acpi_table_stao { + struct acpi_table_header header; + u8 ignore_uart; +} __attribute__((packed)); + +enum acpi_reconfig_event { + ACPI_RECONFIG_DEVICE_ADD = 0, + ACPI_RECONFIG_DEVICE_REMOVE = 1, +}; + +struct acpi_probe_entry; + +typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *, struct acpi_probe_entry *); + +struct acpi_probe_entry { + __u8 id[5]; + __u8 type; + acpi_probe_entry_validate_subtbl subtable_valid; + union { + acpi_tbl_table_handler probe_table; + acpi_tbl_entry_handler probe_subtbl; + }; + kernel_ulong_t driver_data; +}; + +struct acpi_dep_data { + struct list_head node; + acpi_handle supplier; + acpi_handle consumer; +}; + +struct acpi_table_events_work { + struct work_struct work; + void *table; + u32 event; +}; + +struct platform_device___2; + +struct resource_win { + struct resource res; + resource_size_t offset; +}; + +struct res_proc_context { + struct list_head *list; + int (*preproc)(struct acpi_resource *, void *); + void *preproc_data; + int count; + int error; +}; + +struct acpi_processor_errata { + u8 smp; + struct { + u8 throttle: 1; + u8 fdma: 1; + u8 reserved: 6; + u32 bmisx; + } piix4; +}; + +struct acpi_table_ecdt { + struct acpi_table_header header; + struct acpi_generic_address control; + struct acpi_generic_address data; + u32 uid; + u8 gpe; + u8 id[1]; +} __attribute__((packed)); + +struct transaction; + +struct acpi_ec { + acpi_handle handle; + int gpe; + int irq; + long unsigned int command_addr; + long unsigned int data_addr; + bool global_lock; + long unsigned int flags; + long unsigned int reference_count; + struct mutex mutex; + wait_queue_head_t wait; + struct list_head list; + struct transaction *curr; + spinlock_t lock; + struct work_struct work; + long unsigned int timestamp; + long unsigned int nr_pending_queries; + bool busy_polling; + unsigned int polling_guard; +}; + +struct transaction { + const u8 *wdata; + u8 *rdata; + short unsigned int irq_count; + u8 command; + u8 wi; + u8 ri; + u8 wlen; + u8 rlen; + u8 flags; +}; + +typedef int (*acpi_ec_query_func)(void *); + +enum ec_command { + ACPI_EC_COMMAND_READ = 128, + ACPI_EC_COMMAND_WRITE = 129, + ACPI_EC_BURST_ENABLE = 130, + ACPI_EC_BURST_DISABLE = 131, + ACPI_EC_COMMAND_QUERY = 132, +}; + +enum { + EC_FLAGS_QUERY_ENABLED = 0, + EC_FLAGS_QUERY_PENDING = 1, + EC_FLAGS_QUERY_GUARDING = 2, + EC_FLAGS_EVENT_HANDLER_INSTALLED = 3, + EC_FLAGS_EC_HANDLER_INSTALLED = 4, + EC_FLAGS_QUERY_METHODS_INSTALLED = 5, + EC_FLAGS_STARTED = 6, + EC_FLAGS_STOPPED = 7, + EC_FLAGS_EVENTS_MASKED = 8, +}; + +struct acpi_ec_query_handler { + struct list_head node; + acpi_ec_query_func func; + acpi_handle handle; + void *data; + u8 query_bit; + struct kref kref; +}; + +struct acpi_ec_query { + struct transaction transaction; + struct work_struct work; + struct acpi_ec_query_handler *handler; +}; + +struct dock_station { + acpi_handle handle; + long unsigned int last_dock_time; + u32 flags; + struct list_head dependent_devices; + struct list_head sibling; + struct platform_device *dock_device; +}; + +struct dock_dependent_device { + struct list_head list; + struct acpi_device *adev; +}; + +enum dock_callback_type { + DOCK_CALL_HANDLER = 0, + DOCK_CALL_FIXUP = 1, + DOCK_CALL_UEVENT = 2, +}; + +struct acpi_pci_root_ops; + +struct acpi_pci_root_info { + struct acpi_pci_root *root; + struct acpi_device *bridge; + struct acpi_pci_root_ops *ops; + struct list_head resources; + char name[16]; +}; + +struct acpi_pci_root_ops { + struct pci_ops *pci_ops; + int (*init_info)(struct acpi_pci_root_info *); + void (*release_info)(struct acpi_pci_root_info *); + int (*prepare_resources)(struct acpi_pci_root_info *); +}; + +struct pci_osc_bit_struct { + u32 bit; + char *desc; +}; + +struct acpi_handle_node { + struct list_head node; + acpi_handle handle; +}; + +struct acpi_pci_link_irq { + u32 active; + u8 triggering; + u8 polarity; + u8 resource_type; + u8 possible_count; + u32 possible[16]; + u8 initialized: 1; + u8 reserved: 7; +}; + +struct acpi_pci_link { + struct list_head list; + struct acpi_device *device; + struct acpi_pci_link_irq irq; + int refcnt; +}; + +struct acpi_pci_routing_table { + u32 length; + u32 pin; + u64 address; + u32 source_index; + char source[4]; +}; + +struct acpi_prt_entry { + struct acpi_pci_id id; + u8 pin; + acpi_handle link; + u32 index; +}; + +struct prt_quirk { + const struct dmi_system_id *system; + unsigned int segment; + unsigned int bus; + unsigned int device; + unsigned char pin; + const char *source; + const char *actual_source; +}; + +struct lpss_clk_data { + const char *name; + struct clk *clk; +}; + +struct lpss_private_data; + +struct lpss_device_desc { + unsigned int flags; + const char *clk_con_id; + unsigned int prv_offset; + size_t prv_size_override; + struct property_entry *properties; + void (*setup)(struct lpss_private_data *); + bool resume_from_noirq; +}; + +struct lpss_private_data { + struct acpi_device *adev; + void *mmio_base; + resource_size_t mmio_size; + unsigned int fixed_clk_rate; + struct clk *clk; + const struct lpss_device_desc *dev_desc; + u32 prv_reg_ctx[9]; +}; + +struct lpss_device_links { + const char *supplier_hid; + const char *supplier_uid; + const char *consumer_hid; + const char *consumer_uid; + u32 flags; + const struct dmi_system_id *dep_missing_ids; +}; + +struct hid_uid { + const char *hid; + const char *uid; +}; + +struct fch_clk_data { + void *base; + u32 is_rv; +}; + +struct apd_private_data; + +struct apd_device_desc { + unsigned int fixed_clk_rate; + struct property_entry *properties; + int (*setup)(struct apd_private_data *); +}; + +struct apd_private_data { + struct clk *clk; + struct acpi_device *adev; + const struct apd_device_desc *dev_desc; +}; + +struct acpi_power_dependent_device { + struct device *dev; + struct list_head node; +}; + +struct acpi_power_resource { + struct acpi_device device; + struct list_head list_node; + char *name; + u32 system_level; + u32 order; + unsigned int ref_count; + bool wakeup_enabled; + struct mutex resource_lock; + struct list_head dependents; +}; + +struct acpi_power_resource_entry { + struct list_head node; + struct acpi_power_resource *resource; +}; + +struct acpi_bus_event { + struct list_head node; + acpi_device_class device_class; + acpi_bus_id bus_id; + u32 type; + u32 data; +}; + +struct acpi_genl_event { + acpi_device_class device_class; + char bus_id[15]; + u32 type; + u32 data; +}; + +enum { + ACPI_GENL_ATTR_UNSPEC = 0, + ACPI_GENL_ATTR_EVENT = 1, + __ACPI_GENL_ATTR_MAX = 2, +}; + +enum { + ACPI_GENL_CMD_UNSPEC = 0, + ACPI_GENL_CMD_EVENT = 1, + __ACPI_GENL_CMD_MAX = 2, +}; + +struct acpi_ged_device { + struct device *dev; + struct list_head event_list; +}; + +struct acpi_ged_event { + struct list_head node; + struct device *dev; + unsigned int gsi; + unsigned int irq; + acpi_handle handle; +}; + +typedef void (*acpi_gbl_event_handler)(u32, acpi_handle, u32, void *); + +struct acpi_table_bert { + struct acpi_table_header header; + u32 region_length; + u64 address; +}; + +struct acpi_table_attr { + struct bin_attribute attr; + char name[4]; + int instance; + char filename[8]; + struct list_head node; +}; + +struct acpi_data_attr { + struct bin_attribute attr; + u64 addr; +}; + +struct acpi_data_obj { + char *name; + int (*fn)(void *, struct acpi_data_attr *); +}; + +struct event_counter { + u32 count; + u32 flags; +}; + +struct acpi_device_properties { + const guid_t *guid; + const union acpi_object *properties; + struct list_head list; +}; + +struct always_present_id { + struct acpi_device_id hid[2]; + struct x86_cpu_id cpu_ids[2]; + struct dmi_system_id dmi_ids[2]; + const char *uid; +}; + +struct lpi_device_info { + char *name; + int enabled; + union acpi_object *package; +}; + +struct lpi_device_constraint { + int uid; + int min_dstate; + int function_states; +}; + +struct lpi_constraints { + acpi_handle handle; + int min_dstate; +}; + +struct lpi_device_constraint_amd { + char *name; + int enabled; + int function_states; + int min_dstate; +}; + +struct acpi_lpat { + int temp; + int raw; +}; + +struct acpi_lpat_conversion_table { + struct acpi_lpat *lpat; + int lpat_count; +}; + +struct acpi_table_lpit { + struct acpi_table_header header; +}; + +struct acpi_lpit_header { + u32 type; + u32 length; + u16 unique_id; + u16 reserved; + u32 flags; +}; + +struct acpi_lpit_native { + struct acpi_lpit_header header; + struct acpi_generic_address entry_trigger; + u32 residency; + u32 latency; + struct acpi_generic_address residency_counter; + u64 counter_frequency; +} __attribute__((packed)); + +struct lpit_residency_info { + struct acpi_generic_address gaddr; + u64 frequency; + void *iomem_addr; +}; + +struct acpi_table_wdat { + struct acpi_table_header header; + u32 header_length; + u16 pci_segment; + u8 pci_bus; + u8 pci_device; + u8 pci_function; + u8 reserved[3]; + u32 timer_period; + u32 max_count; + u32 min_count; + u8 flags; + u8 reserved2[3]; + u32 entries; +}; + +struct acpi_wdat_entry { + u8 action; + u8 instruction; + u16 reserved; + struct acpi_generic_address register_region; + u32 value; + u32 mask; +} __attribute__((packed)); + +struct acpi_name_info { + char name[4]; + u16 argument_list; + u8 expected_btypes; +} __attribute__((packed)); + +struct acpi_package_info { + u8 type; + u8 object_type1; + u8 count1; + u8 object_type2; + u8 count2; + u16 reserved; +} __attribute__((packed)); + +struct acpi_package_info2 { + u8 type; + u8 count; + u8 object_type[4]; + u8 reserved; +}; + +struct acpi_package_info3 { + u8 type; + u8 count; + u8 object_type[2]; + u8 tail_object_type; + u16 reserved; +} __attribute__((packed)); + +struct acpi_package_info4 { + u8 type; + u8 object_type1; + u8 count1; + u8 sub_object_types; + u8 pkg_count; + u16 reserved; +} __attribute__((packed)); + +union acpi_predefined_info { + struct acpi_name_info info; + struct acpi_package_info ret_info; + struct acpi_package_info2 ret_info2; + struct acpi_package_info3 ret_info3; + struct acpi_package_info4 ret_info4; +}; + +struct acpi_evaluate_info { + struct acpi_namespace_node *prefix_node; + const char *relative_pathname; + union acpi_operand_object **parameters; + struct acpi_namespace_node *node; + union acpi_operand_object *obj_desc; + char *full_pathname; + const union acpi_predefined_info *predefined; + union acpi_operand_object *return_object; + union acpi_operand_object *parent_package; + u32 return_flags; + u32 return_btype; + u16 param_count; + u16 node_flags; + u8 pass_number; + u8 return_object_type; + u8 flags; +}; + +enum { + ACPI_REFCLASS_LOCAL = 0, + ACPI_REFCLASS_ARG = 1, + ACPI_REFCLASS_REFOF = 2, + ACPI_REFCLASS_INDEX = 3, + ACPI_REFCLASS_TABLE = 4, + ACPI_REFCLASS_NAME = 5, + ACPI_REFCLASS_DEBUG = 6, + ACPI_REFCLASS_MAX = 6, +}; + +struct acpi_common_descriptor { + void *common_pointer; + u8 descriptor_type; +}; + +union acpi_descriptor { + struct acpi_common_descriptor common; + union acpi_operand_object object; + struct acpi_namespace_node node; + union acpi_parse_object op; +}; + +typedef enum { + ACPI_IMODE_LOAD_PASS1 = 1, + ACPI_IMODE_LOAD_PASS2 = 2, + ACPI_IMODE_EXECUTE = 3, +} acpi_interpreter_mode; + +struct acpi_create_field_info { + struct acpi_namespace_node *region_node; + struct acpi_namespace_node *field_node; + struct acpi_namespace_node *register_node; + struct acpi_namespace_node *data_register_node; + struct acpi_namespace_node *connection_node; + u8 *resource_buffer; + u32 bank_value; + u32 field_bit_position; + u32 field_bit_length; + u16 resource_length; + u16 pin_number_index; + u8 field_flags; + u8 attribute; + u8 field_type; + u8 access_length; +}; + +struct acpi_init_walk_info { + u32 table_index; + u32 object_count; + u32 method_count; + u32 serial_method_count; + u32 non_serial_method_count; + u32 serialized_method_count; + u32 device_count; + u32 op_region_count; + u32 field_count; + u32 buffer_count; + u32 package_count; + u32 op_region_init; + u32 field_init; + u32 buffer_init; + u32 package_init; + acpi_owner_id owner_id; +}; + +typedef u32 acpi_name; + +typedef acpi_status (*acpi_exception_handler)(acpi_status, acpi_name, u16, u32, void *); + +enum { + AML_FIELD_ACCESS_ANY = 0, + AML_FIELD_ACCESS_BYTE = 1, + AML_FIELD_ACCESS_WORD = 2, + AML_FIELD_ACCESS_DWORD = 3, + AML_FIELD_ACCESS_QWORD = 4, + AML_FIELD_ACCESS_BUFFER = 5, +}; + +typedef acpi_status (*acpi_execute_op)(struct acpi_walk_state *); + +struct acpi_fixed_event_handler { + acpi_event_handler handler; + void *context; +}; + +struct acpi_fixed_event_info { + u8 status_register_id; + u8 enable_register_id; + u16 status_bit_mask; + u16 enable_bit_mask; +}; + +typedef u32 acpi_mutex_handle; + +struct acpi_gpe_walk_info { + struct acpi_namespace_node *gpe_device; + struct acpi_gpe_block_info *gpe_block; + u16 count; + acpi_owner_id owner_id; + u8 execute_by_owner_id; +}; + +struct acpi_gpe_device_info { + u32 index; + u32 next_block_base_index; + acpi_status status; + struct acpi_namespace_node *gpe_device; +}; + +typedef acpi_status (*acpi_gpe_callback)(struct acpi_gpe_xrupt_info *, struct acpi_gpe_block_info *, void *); + +struct acpi_reg_walk_info { + u32 function; + u32 reg_run_count; + acpi_adr_space_type space_id; +}; + +typedef u32 (*acpi_sci_handler)(void *); + +struct acpi_sci_handler_info { + struct acpi_sci_handler_info *next; + acpi_sci_handler address; + void *context; +}; + +enum { + AML_FIELD_UPDATE_PRESERVE = 0, + AML_FIELD_UPDATE_WRITE_AS_ONES = 32, + AML_FIELD_UPDATE_WRITE_AS_ZEROS = 64, +}; + +struct acpi_signal_fatal_info { + u32 type; + u32 code; + u32 argument; +}; + +enum { + MATCH_MTR = 0, + MATCH_MEQ = 1, + MATCH_MLE = 2, + MATCH_MLT = 3, + MATCH_MGE = 4, + MATCH_MGT = 5, +}; + +enum { + AML_FIELD_ATTRIB_QUICK = 2, + AML_FIELD_ATTRIB_SEND_RECEIVE = 4, + AML_FIELD_ATTRIB_BYTE = 6, + AML_FIELD_ATTRIB_WORD = 8, + AML_FIELD_ATTRIB_BLOCK = 10, + AML_FIELD_ATTRIB_BYTES = 11, + AML_FIELD_ATTRIB_PROCESS_CALL = 12, + AML_FIELD_ATTRIB_BLOCK_PROCESS_CALL = 13, + AML_FIELD_ATTRIB_RAW_BYTES = 14, + AML_FIELD_ATTRIB_RAW_PROCESS_BYTES = 15, +}; + +typedef enum { + ACPI_TRACE_AML_METHOD = 0, + ACPI_TRACE_AML_OPCODE = 1, + ACPI_TRACE_AML_REGION = 2, +} acpi_trace_event_type; + +struct acpi_gpe_block_status_context { + struct acpi_gpe_register_info *gpe_skip_register_info; + u8 gpe_skip_mask; + u8 retval; +}; + +struct acpi_bit_register_info { + u8 parent_register; + u8 bit_position; + u16 access_bit_mask; +}; + +struct acpi_port_info { + char *name; + u16 start; + u16 end; + u8 osi_dependency; +}; + +struct acpi_pci_device { + acpi_handle device; + struct acpi_pci_device *next; +}; + +typedef acpi_status (*acpi_init_handler)(acpi_handle, u32); + +struct acpi_device_walk_info { + struct acpi_table_desc *table_desc; + struct acpi_evaluate_info *evaluate_info; + u32 device_count; + u32 num_STA; + u32 num_INI; +}; + +typedef acpi_status (*acpi_pkg_callback)(u8, union acpi_operand_object *, union acpi_generic_state *, void *); + +struct acpi_table_list { + struct acpi_table_desc *tables; + u32 current_table_count; + u32 max_table_count; + u8 flags; +}; + +enum acpi_return_package_types { + ACPI_PTYPE1_FIXED = 1, + ACPI_PTYPE1_VAR = 2, + ACPI_PTYPE1_OPTION = 3, + ACPI_PTYPE2 = 4, + ACPI_PTYPE2_COUNT = 5, + ACPI_PTYPE2_PKG_COUNT = 6, + ACPI_PTYPE2_FIXED = 7, + ACPI_PTYPE2_MIN = 8, + ACPI_PTYPE2_REV_FIXED = 9, + ACPI_PTYPE2_FIX_VAR = 10, + ACPI_PTYPE2_VAR_VAR = 11, + ACPI_PTYPE2_UUID_PAIR = 12, + ACPI_PTYPE_CUSTOM = 13, +}; + +typedef acpi_status (*acpi_object_converter)(struct acpi_namespace_node *, union acpi_operand_object *, union acpi_operand_object **); + +struct acpi_simple_repair_info { + char name[4]; + u32 unexpected_btypes; + u32 package_index; + acpi_object_converter object_converter; +}; + +typedef acpi_status (*acpi_repair_function)(struct acpi_evaluate_info *, union acpi_operand_object **); + +struct acpi_repair_info { + char name[4]; + acpi_repair_function repair_function; +}; + +struct acpi_namestring_info { + const char *external_name; + const char *next_external_char; + char *internal_name; + u32 length; + u32 num_segments; + u32 num_carats; + u8 fully_qualified; +}; + +struct acpi_rw_lock { + void *writer_mutex; + void *reader_mutex; + u32 num_readers; +}; + +struct acpi_get_devices_info { + acpi_walk_callback user_function; + void *context; + const char *hid; +}; + +struct aml_resource_small_header { + u8 descriptor_type; +}; + +struct aml_resource_irq { + u8 descriptor_type; + u16 irq_mask; + u8 flags; +} __attribute__((packed)); + +struct aml_resource_dma { + u8 descriptor_type; + u8 dma_channel_mask; + u8 flags; +}; + +struct aml_resource_start_dependent { + u8 descriptor_type; + u8 flags; +}; + +struct aml_resource_end_dependent { + u8 descriptor_type; +}; + +struct aml_resource_io { + u8 descriptor_type; + u8 flags; + u16 minimum; + u16 maximum; + u8 alignment; + u8 address_length; +}; + +struct aml_resource_fixed_io { + u8 descriptor_type; + u16 address; + u8 address_length; +} __attribute__((packed)); + +struct aml_resource_vendor_small { + u8 descriptor_type; +}; + +struct aml_resource_end_tag { + u8 descriptor_type; + u8 checksum; +}; + +struct aml_resource_fixed_dma { + u8 descriptor_type; + u16 request_lines; + u16 channels; + u8 width; +} __attribute__((packed)); + +struct aml_resource_large_header { + u8 descriptor_type; + u16 resource_length; +} __attribute__((packed)); + +struct aml_resource_memory24 { + u8 descriptor_type; + u16 resource_length; + u8 flags; + u16 minimum; + u16 maximum; + u16 alignment; + u16 address_length; +} __attribute__((packed)); + +struct aml_resource_vendor_large { + u8 descriptor_type; + u16 resource_length; +} __attribute__((packed)); + +struct aml_resource_memory32 { + u8 descriptor_type; + u16 resource_length; + u8 flags; + u32 minimum; + u32 maximum; + u32 alignment; + u32 address_length; +} __attribute__((packed)); + +struct aml_resource_fixed_memory32 { + u8 descriptor_type; + u16 resource_length; + u8 flags; + u32 address; + u32 address_length; +} __attribute__((packed)); + +struct aml_resource_address { + u8 descriptor_type; + u16 resource_length; + u8 resource_type; + u8 flags; + u8 specific_flags; +} __attribute__((packed)); + +struct aml_resource_extended_address64 { + u8 descriptor_type; + u16 resource_length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u8 revision_ID; + u8 reserved; + u64 granularity; + u64 minimum; + u64 maximum; + u64 translation_offset; + u64 address_length; + u64 type_specific; +} __attribute__((packed)); + +struct aml_resource_address64 { + u8 descriptor_type; + u16 resource_length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u64 granularity; + u64 minimum; + u64 maximum; + u64 translation_offset; + u64 address_length; +} __attribute__((packed)); + +struct aml_resource_address32 { + u8 descriptor_type; + u16 resource_length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u32 granularity; + u32 minimum; + u32 maximum; + u32 translation_offset; + u32 address_length; +} __attribute__((packed)); + +struct aml_resource_address16 { + u8 descriptor_type; + u16 resource_length; + u8 resource_type; + u8 flags; + u8 specific_flags; + u16 granularity; + u16 minimum; + u16 maximum; + u16 translation_offset; + u16 address_length; +} __attribute__((packed)); + +struct aml_resource_extended_irq { + u8 descriptor_type; + u16 resource_length; + u8 flags; + u8 interrupt_count; + u32 interrupts[1]; +} __attribute__((packed)); + +struct aml_resource_generic_register { + u8 descriptor_type; + u16 resource_length; + u8 address_space_id; + u8 bit_width; + u8 bit_offset; + u8 access_size; + u64 address; +} __attribute__((packed)); + +struct aml_resource_gpio { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u8 connection_type; + u16 flags; + u16 int_flags; + u8 pin_config; + u16 drive_strength; + u16 debounce_timeout; + u16 pin_table_offset; + u8 res_source_index; + u16 res_source_offset; + u16 vendor_offset; + u16 vendor_length; +} __attribute__((packed)); + +struct aml_resource_common_serialbus { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u8 res_source_index; + u8 type; + u8 flags; + u16 type_specific_flags; + u8 type_revision_id; + u16 type_data_length; +} __attribute__((packed)); + +struct aml_resource_i2c_serialbus { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u8 res_source_index; + u8 type; + u8 flags; + u16 type_specific_flags; + u8 type_revision_id; + u16 type_data_length; + u32 connection_speed; + u16 slave_address; +} __attribute__((packed)); + +struct aml_resource_spi_serialbus { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u8 res_source_index; + u8 type; + u8 flags; + u16 type_specific_flags; + u8 type_revision_id; + u16 type_data_length; + u32 connection_speed; + u8 data_bit_length; + u8 clock_phase; + u8 clock_polarity; + u16 device_selection; +} __attribute__((packed)); + +struct aml_resource_uart_serialbus { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u8 res_source_index; + u8 type; + u8 flags; + u16 type_specific_flags; + u8 type_revision_id; + u16 type_data_length; + u32 default_baud_rate; + u16 rx_fifo_size; + u16 tx_fifo_size; + u8 parity; + u8 lines_enabled; +} __attribute__((packed)); + +struct aml_resource_pin_function { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u16 flags; + u8 pin_config; + u16 function_number; + u16 pin_table_offset; + u8 res_source_index; + u16 res_source_offset; + u16 vendor_offset; + u16 vendor_length; +} __attribute__((packed)); + +struct aml_resource_pin_config { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u16 flags; + u8 pin_config_type; + u32 pin_config_value; + u16 pin_table_offset; + u8 res_source_index; + u16 res_source_offset; + u16 vendor_offset; + u16 vendor_length; +} __attribute__((packed)); + +struct aml_resource_pin_group { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u16 flags; + u16 pin_table_offset; + u16 label_offset; + u16 vendor_offset; + u16 vendor_length; +} __attribute__((packed)); + +struct aml_resource_pin_group_function { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u16 flags; + u16 function_number; + u8 res_source_index; + u16 res_source_offset; + u16 res_source_label_offset; + u16 vendor_offset; + u16 vendor_length; +} __attribute__((packed)); + +struct aml_resource_pin_group_config { + u8 descriptor_type; + u16 resource_length; + u8 revision_id; + u16 flags; + u8 pin_config_type; + u32 pin_config_value; + u8 res_source_index; + u16 res_source_offset; + u16 res_source_label_offset; + u16 vendor_offset; + u16 vendor_length; +} __attribute__((packed)); + +union aml_resource { + u8 descriptor_type; + struct aml_resource_small_header small_header; + struct aml_resource_large_header large_header; + struct aml_resource_irq irq; + struct aml_resource_dma dma; + struct aml_resource_start_dependent start_dpf; + struct aml_resource_end_dependent end_dpf; + struct aml_resource_io io; + struct aml_resource_fixed_io fixed_io; + struct aml_resource_fixed_dma fixed_dma; + struct aml_resource_vendor_small vendor_small; + struct aml_resource_end_tag end_tag; + struct aml_resource_memory24 memory24; + struct aml_resource_generic_register generic_reg; + struct aml_resource_vendor_large vendor_large; + struct aml_resource_memory32 memory32; + struct aml_resource_fixed_memory32 fixed_memory32; + struct aml_resource_address16 address16; + struct aml_resource_address32 address32; + struct aml_resource_address64 address64; + struct aml_resource_extended_address64 ext_address64; + struct aml_resource_extended_irq extended_irq; + struct aml_resource_gpio gpio; + struct aml_resource_i2c_serialbus i2c_serial_bus; + struct aml_resource_spi_serialbus spi_serial_bus; + struct aml_resource_uart_serialbus uart_serial_bus; + struct aml_resource_common_serialbus common_serial_bus; + struct aml_resource_pin_function pin_function; + struct aml_resource_pin_config pin_config; + struct aml_resource_pin_group pin_group; + struct aml_resource_pin_group_function pin_group_function; + struct aml_resource_pin_group_config pin_group_config; + struct aml_resource_address address; + u32 dword_item; + u16 word_item; + u8 byte_item; +}; + +struct acpi_rsconvert_info { + u8 opcode; + u8 resource_offset; + u8 aml_offset; + u8 value; +}; + +enum { + ACPI_RSC_INITGET = 0, + ACPI_RSC_INITSET = 1, + ACPI_RSC_FLAGINIT = 2, + ACPI_RSC_1BITFLAG = 3, + ACPI_RSC_2BITFLAG = 4, + ACPI_RSC_3BITFLAG = 5, + ACPI_RSC_ADDRESS = 6, + ACPI_RSC_BITMASK = 7, + ACPI_RSC_BITMASK16 = 8, + ACPI_RSC_COUNT = 9, + ACPI_RSC_COUNT16 = 10, + ACPI_RSC_COUNT_GPIO_PIN = 11, + ACPI_RSC_COUNT_GPIO_RES = 12, + ACPI_RSC_COUNT_GPIO_VEN = 13, + ACPI_RSC_COUNT_SERIAL_RES = 14, + ACPI_RSC_COUNT_SERIAL_VEN = 15, + ACPI_RSC_DATA8 = 16, + ACPI_RSC_EXIT_EQ = 17, + ACPI_RSC_EXIT_LE = 18, + ACPI_RSC_EXIT_NE = 19, + ACPI_RSC_LENGTH = 20, + ACPI_RSC_MOVE_GPIO_PIN = 21, + ACPI_RSC_MOVE_GPIO_RES = 22, + ACPI_RSC_MOVE_SERIAL_RES = 23, + ACPI_RSC_MOVE_SERIAL_VEN = 24, + ACPI_RSC_MOVE8 = 25, + ACPI_RSC_MOVE16 = 26, + ACPI_RSC_MOVE32 = 27, + ACPI_RSC_MOVE64 = 28, + ACPI_RSC_SET8 = 29, + ACPI_RSC_SOURCE = 30, + ACPI_RSC_SOURCEX = 31, +}; + +typedef u16 acpi_rs_length; + +typedef acpi_status (*acpi_walk_aml_callback)(u8 *, u32, u32, u8, void **); + +typedef u32 acpi_rsdesc_size; + +struct acpi_vendor_uuid { + u8 subtype; + u8 data[16]; +}; + +struct acpi_vendor_walk_info { + struct acpi_vendor_uuid *uuid; + struct acpi_buffer *buffer; + acpi_status status; +}; + +struct acpi_fadt_info { + const char *name; + u16 address64; + u16 address32; + u16 length; + u8 default_length; + u8 flags; +}; + +struct acpi_fadt_pm_info { + struct acpi_generic_address *target; + u16 source; + u8 register_num; +}; + +struct acpi_table_rsdp { + char signature[8]; + u8 checksum; + char oem_id[6]; + u8 revision; + u32 rsdt_physical_address; + u32 length; + u64 xsdt_physical_address; + u8 extended_checksum; + u8 reserved[3]; +} __attribute__((packed)); + +struct acpi_address_range { + struct acpi_address_range *next; + struct acpi_namespace_node *region_node; + acpi_physical_address start_address; + acpi_physical_address end_address; +}; + +struct acpi_pkg_info { + u8 *free_space; + acpi_size length; + u32 object_space; + u32 num_packages; +}; + +struct acpi_exception_info { + char *name; +}; + +struct acpi_mutex_info { + void *mutex; + u32 use_count; + u64 thread_id; +}; + +struct acpi_comment_node { + char *comment; + struct acpi_comment_node *next; +}; + +struct acpi_interface_info { + char *name; + struct acpi_interface_info *next; + u8 flags; + u8 value; +}; + +enum led_brightness { + LED_OFF = 0, + LED_ON = 1, + LED_HALF = 127, + LED_FULL = 255, +}; + +struct led_hw_trigger_type { + int dummy; +}; + +struct led_pattern; + +struct led_trigger; + +struct led_classdev { + const char *name; + enum led_brightness brightness; + enum led_brightness max_brightness; + int flags; + long unsigned int work_flags; + void (*brightness_set)(struct led_classdev *, enum led_brightness); + int (*brightness_set_blocking)(struct led_classdev *, enum led_brightness); + enum led_brightness (*brightness_get)(struct led_classdev *); + int (*blink_set)(struct led_classdev *, long unsigned int *, long unsigned int *); + int (*pattern_set)(struct led_classdev *, struct led_pattern *, u32, int); + int (*pattern_clear)(struct led_classdev *); + struct device *dev; + const struct attribute_group **groups; + struct list_head node; + const char *default_trigger; + long unsigned int blink_delay_on; + long unsigned int blink_delay_off; + struct timer_list blink_timer; + int blink_brightness; + int new_blink_brightness; + void (*flash_resume)(struct led_classdev *); + struct work_struct set_brightness_work; + int delayed_set_value; + struct rw_semaphore trigger_lock; + struct led_trigger *trigger; + struct list_head trig_list; + void *trigger_data; + bool activated; + struct led_hw_trigger_type *trigger_type; + int brightness_hw_changed; + struct kernfs_node *brightness_hw_changed_kn; + struct mutex led_access; +}; + +struct led_pattern { + u32 delta_t; + int brightness; +}; + +struct led_trigger { + const char *name; + int (*activate)(struct led_classdev *); + void (*deactivate)(struct led_classdev *); + struct led_hw_trigger_type *trigger_type; + rwlock_t leddev_list_lock; + struct list_head led_cdevs; + struct list_head next_trig; + const struct attribute_group **groups; +}; + +enum power_supply_property { + POWER_SUPPLY_PROP_STATUS = 0, + POWER_SUPPLY_PROP_CHARGE_TYPE = 1, + POWER_SUPPLY_PROP_HEALTH = 2, + POWER_SUPPLY_PROP_PRESENT = 3, + POWER_SUPPLY_PROP_ONLINE = 4, + POWER_SUPPLY_PROP_AUTHENTIC = 5, + POWER_SUPPLY_PROP_TECHNOLOGY = 6, + POWER_SUPPLY_PROP_CYCLE_COUNT = 7, + POWER_SUPPLY_PROP_VOLTAGE_MAX = 8, + POWER_SUPPLY_PROP_VOLTAGE_MIN = 9, + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN = 10, + POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN = 11, + POWER_SUPPLY_PROP_VOLTAGE_NOW = 12, + POWER_SUPPLY_PROP_VOLTAGE_AVG = 13, + POWER_SUPPLY_PROP_VOLTAGE_OCV = 14, + POWER_SUPPLY_PROP_VOLTAGE_BOOT = 15, + POWER_SUPPLY_PROP_CURRENT_MAX = 16, + POWER_SUPPLY_PROP_CURRENT_NOW = 17, + POWER_SUPPLY_PROP_CURRENT_AVG = 18, + POWER_SUPPLY_PROP_CURRENT_BOOT = 19, + POWER_SUPPLY_PROP_POWER_NOW = 20, + POWER_SUPPLY_PROP_POWER_AVG = 21, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN = 22, + POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN = 23, + POWER_SUPPLY_PROP_CHARGE_FULL = 24, + POWER_SUPPLY_PROP_CHARGE_EMPTY = 25, + POWER_SUPPLY_PROP_CHARGE_NOW = 26, + POWER_SUPPLY_PROP_CHARGE_AVG = 27, + POWER_SUPPLY_PROP_CHARGE_COUNTER = 28, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT = 29, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX = 30, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE = 31, + POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX = 32, + POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT = 33, + POWER_SUPPLY_PROP_CHARGE_CONTROL_LIMIT_MAX = 34, + POWER_SUPPLY_PROP_CHARGE_CONTROL_START_THRESHOLD = 35, + POWER_SUPPLY_PROP_CHARGE_CONTROL_END_THRESHOLD = 36, + POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT = 37, + POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT = 38, + POWER_SUPPLY_PROP_INPUT_POWER_LIMIT = 39, + POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN = 40, + POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN = 41, + POWER_SUPPLY_PROP_ENERGY_FULL = 42, + POWER_SUPPLY_PROP_ENERGY_EMPTY = 43, + POWER_SUPPLY_PROP_ENERGY_NOW = 44, + POWER_SUPPLY_PROP_ENERGY_AVG = 45, + POWER_SUPPLY_PROP_CAPACITY = 46, + POWER_SUPPLY_PROP_CAPACITY_ALERT_MIN = 47, + POWER_SUPPLY_PROP_CAPACITY_ALERT_MAX = 48, + POWER_SUPPLY_PROP_CAPACITY_ERROR_MARGIN = 49, + POWER_SUPPLY_PROP_CAPACITY_LEVEL = 50, + POWER_SUPPLY_PROP_TEMP = 51, + POWER_SUPPLY_PROP_TEMP_MAX = 52, + POWER_SUPPLY_PROP_TEMP_MIN = 53, + POWER_SUPPLY_PROP_TEMP_ALERT_MIN = 54, + POWER_SUPPLY_PROP_TEMP_ALERT_MAX = 55, + POWER_SUPPLY_PROP_TEMP_AMBIENT = 56, + POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MIN = 57, + POWER_SUPPLY_PROP_TEMP_AMBIENT_ALERT_MAX = 58, + POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW = 59, + POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG = 60, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW = 61, + POWER_SUPPLY_PROP_TIME_TO_FULL_AVG = 62, + POWER_SUPPLY_PROP_TYPE = 63, + POWER_SUPPLY_PROP_USB_TYPE = 64, + POWER_SUPPLY_PROP_SCOPE = 65, + POWER_SUPPLY_PROP_PRECHARGE_CURRENT = 66, + POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT = 67, + POWER_SUPPLY_PROP_CALIBRATE = 68, + POWER_SUPPLY_PROP_MANUFACTURE_YEAR = 69, + POWER_SUPPLY_PROP_MANUFACTURE_MONTH = 70, + POWER_SUPPLY_PROP_MANUFACTURE_DAY = 71, + POWER_SUPPLY_PROP_MODEL_NAME = 72, + POWER_SUPPLY_PROP_MANUFACTURER = 73, + POWER_SUPPLY_PROP_SERIAL_NUMBER = 74, +}; + +enum power_supply_type { + POWER_SUPPLY_TYPE_UNKNOWN = 0, + POWER_SUPPLY_TYPE_BATTERY = 1, + POWER_SUPPLY_TYPE_UPS = 2, + POWER_SUPPLY_TYPE_MAINS = 3, + POWER_SUPPLY_TYPE_USB = 4, + POWER_SUPPLY_TYPE_USB_DCP = 5, + POWER_SUPPLY_TYPE_USB_CDP = 6, + POWER_SUPPLY_TYPE_USB_ACA = 7, + POWER_SUPPLY_TYPE_USB_TYPE_C = 8, + POWER_SUPPLY_TYPE_USB_PD = 9, + POWER_SUPPLY_TYPE_USB_PD_DRP = 10, + POWER_SUPPLY_TYPE_APPLE_BRICK_ID = 11, + POWER_SUPPLY_TYPE_WIRELESS = 12, +}; + +enum power_supply_usb_type { + POWER_SUPPLY_USB_TYPE_UNKNOWN = 0, + POWER_SUPPLY_USB_TYPE_SDP = 1, + POWER_SUPPLY_USB_TYPE_DCP = 2, + POWER_SUPPLY_USB_TYPE_CDP = 3, + POWER_SUPPLY_USB_TYPE_ACA = 4, + POWER_SUPPLY_USB_TYPE_C = 5, + POWER_SUPPLY_USB_TYPE_PD = 6, + POWER_SUPPLY_USB_TYPE_PD_DRP = 7, + POWER_SUPPLY_USB_TYPE_PD_PPS = 8, + POWER_SUPPLY_USB_TYPE_APPLE_BRICK_ID = 9, +}; + +union power_supply_propval { + int intval; + const char *strval; +}; + +struct power_supply_config { + struct device_node *of_node; + struct fwnode_handle *fwnode; + void *drv_data; + const struct attribute_group **attr_grp; + char **supplied_to; + size_t num_supplicants; +}; + +struct power_supply; + +struct power_supply_desc { + const char *name; + enum power_supply_type type; + const enum power_supply_usb_type *usb_types; + size_t num_usb_types; + const enum power_supply_property *properties; + size_t num_properties; + int (*get_property)(struct power_supply *, enum power_supply_property, union power_supply_propval *); + int (*set_property)(struct power_supply *, enum power_supply_property, const union power_supply_propval *); + int (*property_is_writeable)(struct power_supply *, enum power_supply_property); + void (*external_power_changed)(struct power_supply *); + void (*set_charged)(struct power_supply *); + bool no_thermal; + int use_for_apm; +}; + +struct thermal_zone_device; + +struct power_supply { + const struct power_supply_desc *desc; + char **supplied_to; + size_t num_supplicants; + char **supplied_from; + size_t num_supplies; + struct device_node *of_node; + void *drv_data; + struct device dev; + struct work_struct changed_work; + struct delayed_work deferred_register_work; + spinlock_t changed_lock; + bool changed; + bool initialized; + bool removing; + atomic_t use_cnt; + struct thermal_zone_device *tzd; + struct thermal_cooling_device *tcd; + struct led_trigger *charging_full_trig; + char *charging_full_trig_name; + struct led_trigger *charging_trig; + char *charging_trig_name; + struct led_trigger *full_trig; + char *full_trig_name; + struct led_trigger *online_trig; + char *online_trig_name; + struct led_trigger *charging_blink_full_solid_trig; + char *charging_blink_full_solid_trig_name; +}; + +struct acpi_ac_bl { + const char *hid; + int hrv; +}; + +struct acpi_ac { + struct power_supply *charger; + struct power_supply_desc charger_desc; + struct acpi_device *device; + long long unsigned int state; + struct notifier_block battery_nb; +}; + +struct input_id { + __u16 bustype; + __u16 vendor; + __u16 product; + __u16 version; +}; + +struct input_absinfo { + __s32 value; + __s32 minimum; + __s32 maximum; + __s32 fuzz; + __s32 flat; + __s32 resolution; +}; + +struct input_keymap_entry { + __u8 flags; + __u8 len; + __u16 index; + __u32 keycode; + __u8 scancode[32]; +}; + +struct ff_replay { + __u16 length; + __u16 delay; +}; + +struct ff_trigger { + __u16 button; + __u16 interval; +}; + +struct ff_envelope { + __u16 attack_length; + __u16 attack_level; + __u16 fade_length; + __u16 fade_level; +}; + +struct ff_constant_effect { + __s16 level; + struct ff_envelope envelope; +}; + +struct ff_ramp_effect { + __s16 start_level; + __s16 end_level; + struct ff_envelope envelope; +}; + +struct ff_condition_effect { + __u16 right_saturation; + __u16 left_saturation; + __s16 right_coeff; + __s16 left_coeff; + __u16 deadband; + __s16 center; +}; + +struct ff_periodic_effect { + __u16 waveform; + __u16 period; + __s16 magnitude; + __s16 offset; + __u16 phase; + struct ff_envelope envelope; + __u32 custom_len; + __s16 *custom_data; +}; + +struct ff_rumble_effect { + __u16 strong_magnitude; + __u16 weak_magnitude; +}; + +struct ff_effect { + __u16 type; + __s16 id; + __u16 direction; + struct ff_trigger trigger; + struct ff_replay replay; + union { + struct ff_constant_effect constant; + struct ff_ramp_effect ramp; + struct ff_periodic_effect periodic; + struct ff_condition_effect condition[2]; + struct ff_rumble_effect rumble; + } u; +}; + +struct input_device_id { + kernel_ulong_t flags; + __u16 bustype; + __u16 vendor; + __u16 product; + __u16 version; + kernel_ulong_t evbit[1]; + kernel_ulong_t keybit[12]; + kernel_ulong_t relbit[1]; + kernel_ulong_t absbit[1]; + kernel_ulong_t mscbit[1]; + kernel_ulong_t ledbit[1]; + kernel_ulong_t sndbit[1]; + kernel_ulong_t ffbit[2]; + kernel_ulong_t swbit[1]; + kernel_ulong_t propbit[1]; + kernel_ulong_t driver_info; +}; + +struct input_value { + __u16 type; + __u16 code; + __s32 value; +}; + +enum input_clock_type { + INPUT_CLK_REAL = 0, + INPUT_CLK_MONO = 1, + INPUT_CLK_BOOT = 2, + INPUT_CLK_MAX = 3, +}; + +struct ff_device; + +struct input_dev_poller; + +struct input_mt; + +struct input_handle; + +struct input_dev { + const char *name; + const char *phys; + const char *uniq; + struct input_id id; + long unsigned int propbit[1]; + long unsigned int evbit[1]; + long unsigned int keybit[12]; + long unsigned int relbit[1]; + long unsigned int absbit[1]; + long unsigned int mscbit[1]; + long unsigned int ledbit[1]; + long unsigned int sndbit[1]; + long unsigned int ffbit[2]; + long unsigned int swbit[1]; + unsigned int hint_events_per_packet; + unsigned int keycodemax; + unsigned int keycodesize; + void *keycode; + int (*setkeycode)(struct input_dev *, const struct input_keymap_entry *, unsigned int *); + int (*getkeycode)(struct input_dev *, struct input_keymap_entry *); + struct ff_device *ff; + struct input_dev_poller *poller; + unsigned int repeat_key; + struct timer_list timer; + int rep[2]; + struct input_mt *mt; + struct input_absinfo *absinfo; + long unsigned int key[12]; + long unsigned int led[1]; + long unsigned int snd[1]; + long unsigned int sw[1]; + int (*open)(struct input_dev *); + void (*close)(struct input_dev *); + int (*flush)(struct input_dev *, struct file *); + int (*event)(struct input_dev *, unsigned int, unsigned int, int); + struct input_handle *grab; + spinlock_t event_lock; + struct mutex mutex; + unsigned int users; + bool going_away; + struct device dev; + struct list_head h_list; + struct list_head node; + unsigned int num_vals; + unsigned int max_vals; + struct input_value *vals; + bool devres_managed; + ktime_t timestamp[3]; + bool inhibited; +}; + +struct ff_device { + int (*upload)(struct input_dev *, struct ff_effect *, struct ff_effect *); + int (*erase)(struct input_dev *, int); + int (*playback)(struct input_dev *, int, int); + void (*set_gain)(struct input_dev *, u16); + void (*set_autocenter)(struct input_dev *, u16); + void (*destroy)(struct ff_device *); + void *private; + long unsigned int ffbit[2]; + struct mutex mutex; + int max_effects; + struct ff_effect *effects; + struct file *effect_owners[0]; +}; + +struct input_handler; + +struct input_handle { + void *private; + int open; + const char *name; + struct input_dev *dev; + struct input_handler *handler; + struct list_head d_node; + struct list_head h_node; +}; + +struct input_handler { + void *private; + void (*event)(struct input_handle *, unsigned int, unsigned int, int); + void (*events)(struct input_handle *, const struct input_value *, unsigned int); + bool (*filter)(struct input_handle *, unsigned int, unsigned int, int); + bool (*match)(struct input_handler *, struct input_dev *); + int (*connect)(struct input_handler *, struct input_dev *, const struct input_device_id *); + void (*disconnect)(struct input_handle *); + void (*start)(struct input_handle *); + bool legacy_minors; + int minor; + const char *name; + const struct input_device_id *id_table; + struct list_head h_list; + struct list_head node; +}; + +enum { + ACPI_BUTTON_LID_INIT_IGNORE = 0, + ACPI_BUTTON_LID_INIT_OPEN = 1, + ACPI_BUTTON_LID_INIT_METHOD = 2, + ACPI_BUTTON_LID_INIT_DISABLED = 3, +}; + +struct acpi_button { + unsigned int type; + struct input_dev *input; + char phys[32]; + long unsigned int pushed; + int last_state; + ktime_t last_time; + bool suspended; + bool lid_state_initialized; +}; + +struct acpi_fan_fps { + u64 control; + u64 trip_point; + u64 speed; + u64 noise_level; + u64 power; + char name[20]; + struct device_attribute dev_attr; +}; + +struct acpi_fan_fif { + u64 revision; + u64 fine_grain_ctrl; + u64 step_size; + u64 low_speed_notification; +}; + +struct acpi_fan { + bool acpi4; + struct acpi_fan_fif fif; + struct acpi_fan_fps *fps; + int fps_count; + struct thermal_cooling_device *cdev; +}; + +struct acpi_pci_slot { + struct pci_slot *pci_slot; + struct list_head list; +}; + +struct acpi_lpi_states_array { + unsigned int size; + unsigned int composite_states_size; + struct acpi_lpi_state *entries; + struct acpi_lpi_state *composite_states[8]; +}; + +struct throttling_tstate { + unsigned int cpu; + int target_state; +}; + +struct acpi_processor_throttling_arg { + struct acpi_processor *pr; + int target_state; + bool force; +}; + +struct container_dev { + struct device dev; + int (*offline)(struct container_dev *); +}; + +enum thermal_device_mode { + THERMAL_DEVICE_DISABLED = 0, + THERMAL_DEVICE_ENABLED = 1, +}; + +enum thermal_trip_type { + THERMAL_TRIP_ACTIVE = 0, + THERMAL_TRIP_PASSIVE = 1, + THERMAL_TRIP_HOT = 2, + THERMAL_TRIP_CRITICAL = 3, +}; + +enum thermal_trend { + THERMAL_TREND_STABLE = 0, + THERMAL_TREND_RAISING = 1, + THERMAL_TREND_DROPPING = 2, + THERMAL_TREND_RAISE_FULL = 3, + THERMAL_TREND_DROP_FULL = 4, +}; + +enum thermal_notify_event { + THERMAL_EVENT_UNSPECIFIED = 0, + THERMAL_EVENT_TEMP_SAMPLE = 1, + THERMAL_TRIP_VIOLATED = 2, + THERMAL_TRIP_CHANGED = 3, + THERMAL_DEVICE_DOWN = 4, + THERMAL_DEVICE_UP = 5, + THERMAL_DEVICE_POWER_CAPABILITY_CHANGED = 6, + THERMAL_TABLE_CHANGED = 7, + THERMAL_EVENT_KEEP_ALIVE = 8, +}; + +struct thermal_zone_device_ops { + int (*bind)(struct thermal_zone_device *, struct thermal_cooling_device *); + int (*unbind)(struct thermal_zone_device *, struct thermal_cooling_device *); + int (*get_temp)(struct thermal_zone_device *, int *); + int (*set_trips)(struct thermal_zone_device *, int, int); + int (*change_mode)(struct thermal_zone_device *, enum thermal_device_mode); + int (*get_trip_type)(struct thermal_zone_device *, int, enum thermal_trip_type *); + int (*get_trip_temp)(struct thermal_zone_device *, int, int *); + int (*set_trip_temp)(struct thermal_zone_device *, int, int); + int (*get_trip_hyst)(struct thermal_zone_device *, int, int *); + int (*set_trip_hyst)(struct thermal_zone_device *, int, int); + int (*get_crit_temp)(struct thermal_zone_device *, int *); + int (*set_emul_temp)(struct thermal_zone_device *, int); + int (*get_trend)(struct thermal_zone_device *, int, enum thermal_trend *); + int (*notify)(struct thermal_zone_device *, int, enum thermal_trip_type); + void (*hot)(struct thermal_zone_device *); + void (*critical)(struct thermal_zone_device *); +}; + +struct thermal_attr; + +struct thermal_zone_params; + +struct thermal_governor; + +struct thermal_zone_device { + int id; + char type[20]; + struct device device; + struct attribute_group trips_attribute_group; + struct thermal_attr *trip_temp_attrs; + struct thermal_attr *trip_type_attrs; + struct thermal_attr *trip_hyst_attrs; + enum thermal_device_mode mode; + void *devdata; + int trips; + long unsigned int trips_disabled; + int passive_delay; + int polling_delay; + int temperature; + int last_temperature; + int emul_temperature; + int passive; + int prev_low_trip; + int prev_high_trip; + unsigned int forced_passive; + atomic_t need_update; + struct thermal_zone_device_ops *ops; + struct thermal_zone_params *tzp; + struct thermal_governor *governor; + void *governor_data; + struct list_head thermal_instances; + struct ida ida; + struct mutex lock; + struct list_head node; + struct delayed_work poll_queue; + enum thermal_notify_event notify_event; +}; + +struct thermal_bind_params; + +struct thermal_zone_params { + char governor_name[20]; + bool no_hwmon; + int num_tbps; + struct thermal_bind_params *tbp; + u32 sustainable_power; + s32 k_po; + s32 k_pu; + s32 k_i; + s32 k_d; + s32 integral_cutoff; + int slope; + int offset; +}; + +struct thermal_governor { + char name[20]; + int (*bind_to_tz)(struct thermal_zone_device *); + void (*unbind_from_tz)(struct thermal_zone_device *); + int (*throttle)(struct thermal_zone_device *, int); + struct list_head governor_list; +}; + +struct thermal_bind_params { + struct thermal_cooling_device *cdev; + int weight; + int trip_mask; + long unsigned int *binding_limits; + int (*match)(struct thermal_zone_device *, struct thermal_cooling_device *); +}; + +struct acpi_thermal_state { + u8 critical: 1; + u8 hot: 1; + u8 passive: 1; + u8 active: 1; + u8 reserved: 4; + int active_index; +}; + +struct acpi_thermal_state_flags { + u8 valid: 1; + u8 enabled: 1; + u8 reserved: 6; +}; + +struct acpi_thermal_critical { + struct acpi_thermal_state_flags flags; + long unsigned int temperature; +}; + +struct acpi_thermal_hot { + struct acpi_thermal_state_flags flags; + long unsigned int temperature; +}; + +struct acpi_thermal_passive { + struct acpi_thermal_state_flags flags; + long unsigned int temperature; + long unsigned int tc1; + long unsigned int tc2; + long unsigned int tsp; + struct acpi_handle_list devices; +}; + +struct acpi_thermal_active { + struct acpi_thermal_state_flags flags; + long unsigned int temperature; + struct acpi_handle_list devices; +}; + +struct acpi_thermal_trips { + struct acpi_thermal_critical critical; + struct acpi_thermal_hot hot; + struct acpi_thermal_passive passive; + struct acpi_thermal_active active[10]; +}; + +struct acpi_thermal_flags { + u8 cooling_mode: 1; + u8 devices: 1; + u8 reserved: 6; +}; + +struct acpi_thermal { + struct acpi_device *device; + acpi_bus_id name; + long unsigned int temperature; + long unsigned int last_temperature; + long unsigned int polling_frequency; + volatile u8 zombie; + struct acpi_thermal_flags flags; + struct acpi_thermal_state state; + struct acpi_thermal_trips trips; + struct acpi_handle_list devices; + struct thermal_zone_device *thermal_zone; + int kelvin_offset; + struct work_struct thermal_check_work; + struct mutex thermal_check_lock; + refcount_t thermal_check_count; +}; + +struct acpi_table_slit { + struct acpi_table_header header; + u64 locality_count; + u8 entry[1]; +} __attribute__((packed)); + +struct acpi_table_srat { + struct acpi_table_header header; + u32 table_revision; + u64 reserved; +}; + +enum acpi_srat_type { + ACPI_SRAT_TYPE_CPU_AFFINITY = 0, + ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, + ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, + ACPI_SRAT_TYPE_GICC_AFFINITY = 3, + ACPI_SRAT_TYPE_GIC_ITS_AFFINITY = 4, + ACPI_SRAT_TYPE_GENERIC_AFFINITY = 5, + ACPI_SRAT_TYPE_RESERVED = 6, +}; + +struct acpi_srat_mem_affinity { + struct acpi_subtable_header header; + u32 proximity_domain; + u16 reserved; + u64 base_address; + u64 length; + u32 reserved1; + u32 flags; + u64 reserved2; +} __attribute__((packed)); + +struct acpi_srat_gicc_affinity { + struct acpi_subtable_header header; + u32 proximity_domain; + u32 acpi_processor_uid; + u32 flags; + u32 clock_domain; +} __attribute__((packed)); + +struct acpi_srat_generic_affinity { + struct acpi_subtable_header header; + u8 reserved; + u8 device_handle_type; + u32 proximity_domain; + u8 device_handle[16]; + u32 flags; + u32 reserved1; +}; + +enum acpi_hmat_type { + ACPI_HMAT_TYPE_PROXIMITY = 0, + ACPI_HMAT_TYPE_LOCALITY = 1, + ACPI_HMAT_TYPE_CACHE = 2, + ACPI_HMAT_TYPE_RESERVED = 3, +}; + +struct acpi_hmat_proximity_domain { + struct acpi_hmat_structure header; + u16 flags; + u16 reserved1; + u32 processor_PD; + u32 memory_PD; + u32 reserved2; + u64 reserved3; + u64 reserved4; +}; + +struct acpi_hmat_locality { + struct acpi_hmat_structure header; + u8 flags; + u8 data_type; + u16 reserved1; + u32 number_of_initiator_Pds; + u32 number_of_target_Pds; + u32 reserved2; + u64 entry_base_unit; +}; + +struct acpi_hmat_cache { + struct acpi_hmat_structure header; + u32 memory_PD; + u32 reserved1; + u64 cache_size; + u32 cache_attributes; + u16 reserved2; + u16 number_of_SMBIOShandles; +}; + +struct node_hmem_attrs { + unsigned int read_bandwidth; + unsigned int write_bandwidth; + unsigned int read_latency; + unsigned int write_latency; +}; + +enum cache_indexing { + NODE_CACHE_DIRECT_MAP = 0, + NODE_CACHE_INDEXED = 1, + NODE_CACHE_OTHER = 2, +}; + +enum cache_write_policy { + NODE_CACHE_WRITE_BACK = 0, + NODE_CACHE_WRITE_THROUGH = 1, + NODE_CACHE_WRITE_OTHER = 2, +}; + +struct node_cache_attrs { + enum cache_indexing indexing; + enum cache_write_policy write_policy; + u64 size; + u16 line_size; + u8 level; +}; + +enum locality_types { + WRITE_LATENCY = 0, + READ_LATENCY = 1, + WRITE_BANDWIDTH = 2, + READ_BANDWIDTH = 3, +}; + +struct memory_locality { + struct list_head node; + struct acpi_hmat_locality *hmat_loc; +}; + +struct target_cache { + struct list_head node; + struct node_cache_attrs cache_attrs; +}; + +struct memory_target { + struct list_head node; + unsigned int memory_pxm; + unsigned int processor_pxm; + struct resource memregions; + struct node_hmem_attrs hmem_attrs[2]; + struct list_head caches; + struct node_cache_attrs cache_attrs; + bool registered; +}; + +struct memory_initiator { + struct list_head node; + unsigned int processor_pxm; + bool has_cpu; +}; + +struct acpi_memory_info { + struct list_head list; + u64 start_addr; + u64 length; + short unsigned int caching; + short unsigned int write_protect; + unsigned int enabled: 1; +}; + +struct acpi_memory_device { + struct acpi_device *device; + struct list_head res_list; +}; + +struct acpi_pci_ioapic { + acpi_handle root_handle; + acpi_handle handle; + u32 gsi_base; + struct resource res; + struct pci_dev *pdev; + struct list_head list; +}; + +enum dmi_entry_type { + DMI_ENTRY_BIOS = 0, + DMI_ENTRY_SYSTEM = 1, + DMI_ENTRY_BASEBOARD = 2, + DMI_ENTRY_CHASSIS = 3, + DMI_ENTRY_PROCESSOR = 4, + DMI_ENTRY_MEM_CONTROLLER = 5, + DMI_ENTRY_MEM_MODULE = 6, + DMI_ENTRY_CACHE = 7, + DMI_ENTRY_PORT_CONNECTOR = 8, + DMI_ENTRY_SYSTEM_SLOT = 9, + DMI_ENTRY_ONBOARD_DEVICE = 10, + DMI_ENTRY_OEMSTRINGS = 11, + DMI_ENTRY_SYSCONF = 12, + DMI_ENTRY_BIOS_LANG = 13, + DMI_ENTRY_GROUP_ASSOC = 14, + DMI_ENTRY_SYSTEM_EVENT_LOG = 15, + DMI_ENTRY_PHYS_MEM_ARRAY = 16, + DMI_ENTRY_MEM_DEVICE = 17, + DMI_ENTRY_32_MEM_ERROR = 18, + DMI_ENTRY_MEM_ARRAY_MAPPED_ADDR = 19, + DMI_ENTRY_MEM_DEV_MAPPED_ADDR = 20, + DMI_ENTRY_BUILTIN_POINTING_DEV = 21, + DMI_ENTRY_PORTABLE_BATTERY = 22, + DMI_ENTRY_SYSTEM_RESET = 23, + DMI_ENTRY_HW_SECURITY = 24, + DMI_ENTRY_SYSTEM_POWER_CONTROLS = 25, + DMI_ENTRY_VOLTAGE_PROBE = 26, + DMI_ENTRY_COOLING_DEV = 27, + DMI_ENTRY_TEMP_PROBE = 28, + DMI_ENTRY_ELECTRICAL_CURRENT_PROBE = 29, + DMI_ENTRY_OOB_REMOTE_ACCESS = 30, + DMI_ENTRY_BIS_ENTRY = 31, + DMI_ENTRY_SYSTEM_BOOT = 32, + DMI_ENTRY_MGMT_DEV = 33, + DMI_ENTRY_MGMT_DEV_COMPONENT = 34, + DMI_ENTRY_MGMT_DEV_THRES = 35, + DMI_ENTRY_MEM_CHANNEL = 36, + DMI_ENTRY_IPMI_DEV = 37, + DMI_ENTRY_SYS_POWER_SUPPLY = 38, + DMI_ENTRY_ADDITIONAL = 39, + DMI_ENTRY_ONBOARD_DEV_EXT = 40, + DMI_ENTRY_MGMT_CONTROLLER_HOST = 41, + DMI_ENTRY_INACTIVE = 126, + DMI_ENTRY_END_OF_TABLE = 127, +}; + +enum { + POWER_SUPPLY_STATUS_UNKNOWN = 0, + POWER_SUPPLY_STATUS_CHARGING = 1, + POWER_SUPPLY_STATUS_DISCHARGING = 2, + POWER_SUPPLY_STATUS_NOT_CHARGING = 3, + POWER_SUPPLY_STATUS_FULL = 4, +}; + +enum { + POWER_SUPPLY_TECHNOLOGY_UNKNOWN = 0, + POWER_SUPPLY_TECHNOLOGY_NiMH = 1, + POWER_SUPPLY_TECHNOLOGY_LION = 2, + POWER_SUPPLY_TECHNOLOGY_LIPO = 3, + POWER_SUPPLY_TECHNOLOGY_LiFe = 4, + POWER_SUPPLY_TECHNOLOGY_NiCd = 5, + POWER_SUPPLY_TECHNOLOGY_LiMn = 6, +}; + +enum { + POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN = 0, + POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL = 1, + POWER_SUPPLY_CAPACITY_LEVEL_LOW = 2, + POWER_SUPPLY_CAPACITY_LEVEL_NORMAL = 3, + POWER_SUPPLY_CAPACITY_LEVEL_HIGH = 4, + POWER_SUPPLY_CAPACITY_LEVEL_FULL = 5, +}; + +struct acpi_battery_hook { + const char *name; + int (*add_battery)(struct power_supply *); + int (*remove_battery)(struct power_supply *); + struct list_head list; +}; + +enum { + ACPI_BATTERY_ALARM_PRESENT = 0, + ACPI_BATTERY_XINFO_PRESENT = 1, + ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY = 2, + ACPI_BATTERY_QUIRK_THINKPAD_MAH = 3, + ACPI_BATTERY_QUIRK_DEGRADED_FULL_CHARGE = 4, +}; + +struct acpi_battery { + struct mutex lock; + struct mutex sysfs_lock; + struct power_supply *bat; + struct power_supply_desc bat_desc; + struct acpi_device *device; + struct notifier_block pm_nb; + struct list_head list; + long unsigned int update_time; + int revision; + int rate_now; + int capacity_now; + int voltage_now; + int design_capacity; + int full_charge_capacity; + int technology; + int design_voltage; + int design_capacity_warning; + int design_capacity_low; + int cycle_count; + int measurement_accuracy; + int max_sampling_time; + int min_sampling_time; + int max_averaging_interval; + int min_averaging_interval; + int capacity_granularity_1; + int capacity_granularity_2; + int alarm; + char model_number[32]; + char serial_number[32]; + char type[32]; + char oem_info[32]; + int state; + int power_unit; + long unsigned int flags; +}; + +struct acpi_offsets { + size_t offset; + u8 mode; +}; + +struct acpi_pcct_hw_reduced { + struct acpi_subtable_header header; + u32 platform_interrupt; + u8 flags; + u8 reserved; + u64 base_address; + u64 length; + struct acpi_generic_address doorbell_register; + u64 preserve_mask; + u64 write_mask; + u32 latency; + u32 max_access_rate; + u16 min_turnaround_time; +} __attribute__((packed)); + +struct acpi_pcct_shared_memory { + u32 signature; + u16 command; + u16 status; +}; + +struct mbox_chan; + +struct mbox_chan_ops { + int (*send_data)(struct mbox_chan *, void *); + int (*flush)(struct mbox_chan *, long unsigned int); + int (*startup)(struct mbox_chan *); + void (*shutdown)(struct mbox_chan *); + bool (*last_tx_done)(struct mbox_chan *); + bool (*peek_data)(struct mbox_chan *); +}; + +struct mbox_controller; + +struct mbox_client; + +struct mbox_chan { + struct mbox_controller *mbox; + unsigned int txdone_method; + struct mbox_client *cl; + struct completion tx_complete; + void *active_req; + unsigned int msg_count; + unsigned int msg_free; + void *msg_data[20]; + spinlock_t lock; + void *con_priv; +}; + +struct mbox_controller { + struct device *dev; + const struct mbox_chan_ops *ops; + struct mbox_chan *chans; + int num_chans; + bool txdone_irq; + bool txdone_poll; + unsigned int txpoll_period; + struct mbox_chan * (*of_xlate)(struct mbox_controller *, const struct of_phandle_args *); + struct hrtimer poll_hrt; + struct list_head node; +}; + +struct mbox_client { + struct device *dev; + bool tx_block; + long unsigned int tx_tout; + bool knows_txdone; + void (*rx_callback)(struct mbox_client *, void *); + void (*tx_prepare)(struct mbox_client *, void *); + void (*tx_done)(struct mbox_client *, void *, int); +}; + +struct cpc_register_resource { + acpi_object_type type; + u64 *sys_mem_vaddr; + union { + struct cpc_reg reg; + u64 int_value; + } cpc_entry; +}; + +struct cpc_desc { + int num_entries; + int version; + int cpu_id; + int write_cmd_status; + int write_cmd_id; + struct cpc_register_resource cpc_regs[21]; + struct acpi_psd_package domain_info; + struct kobject kobj; +}; + +enum cppc_regs { + HIGHEST_PERF = 0, + NOMINAL_PERF = 1, + LOW_NON_LINEAR_PERF = 2, + LOWEST_PERF = 3, + GUARANTEED_PERF = 4, + DESIRED_PERF = 5, + MIN_PERF = 6, + MAX_PERF = 7, + PERF_REDUC_TOLERANCE = 8, + TIME_WINDOW = 9, + CTR_WRAP_TIME = 10, + REFERENCE_CTR = 11, + DELIVERED_CTR = 12, + PERF_LIMITED = 13, + ENABLE = 14, + AUTO_SEL_ENABLE = 15, + AUTO_ACT_WINDOW = 16, + ENERGY_PERF = 17, + REFERENCE_PERF = 18, + LOWEST_FREQ = 19, + NOMINAL_FREQ = 20, +}; + +struct cppc_perf_ctrls { + u32 max_perf; + u32 min_perf; + u32 desired_perf; +}; + +struct cppc_perf_fb_ctrs { + u64 reference; + u64 delivered; + u64 reference_perf; + u64 wraparound_time; +}; + +struct cppc_cpudata { + struct list_head node; + struct cppc_perf_caps perf_caps; + struct cppc_perf_ctrls perf_ctrls; + struct cppc_perf_fb_ctrs perf_fb_ctrs; + unsigned int shared_type; + cpumask_var_t shared_cpu_map; +}; + +struct cppc_pcc_data { + struct mbox_chan *pcc_channel; + void *pcc_comm_addr; + bool pcc_channel_acquired; + unsigned int deadline_us; + unsigned int pcc_mpar; + unsigned int pcc_mrtt; + unsigned int pcc_nominal; + bool pending_pcc_write_cmd; + bool platform_owns_pcc; + unsigned int pcc_write_cnt; + struct rw_semaphore pcc_lock; + wait_queue_head_t pcc_write_wait_q; + ktime_t last_cmd_cmpl_time; + ktime_t last_mpar_reset; + int mpar_count; + int refcount; +}; + +struct cppc_attr { + struct attribute attr; + ssize_t (*show)(struct kobject *, struct attribute *, char *); + ssize_t (*store)(struct kobject *, struct attribute *, const char *, ssize_t); +}; + +struct acpi_whea_header { + u8 action; + u8 instruction; + u8 flags; + u8 reserved; + struct acpi_generic_address register_region; + u64 value; + u64 mask; +} __attribute__((packed)); + +struct apei_exec_context; + +typedef int (*apei_exec_ins_func_t)(struct apei_exec_context *, struct acpi_whea_header *); + +struct apei_exec_ins_type; + +struct apei_exec_context { + u32 ip; + u64 value; + u64 var1; + u64 var2; + u64 src_base; + u64 dst_base; + struct apei_exec_ins_type *ins_table; + u32 instructions; + struct acpi_whea_header *action_table; + u32 entries; +}; + +struct apei_exec_ins_type { + u32 flags; + apei_exec_ins_func_t run; +}; + +struct apei_resources { + struct list_head iomem; + struct list_head ioport; +}; + +typedef int (*apei_exec_entry_func_t)(struct apei_exec_context *, struct acpi_whea_header *, void *); + +struct apei_res { + struct list_head list; + long unsigned int start; + long unsigned int end; +}; + +struct acpi_table_hest { + struct acpi_table_header header; + u32 error_source_count; +}; + +enum acpi_hest_types { + ACPI_HEST_TYPE_IA32_CHECK = 0, + ACPI_HEST_TYPE_IA32_CORRECTED_CHECK = 1, + ACPI_HEST_TYPE_IA32_NMI = 2, + ACPI_HEST_TYPE_NOT_USED3 = 3, + ACPI_HEST_TYPE_NOT_USED4 = 4, + ACPI_HEST_TYPE_NOT_USED5 = 5, + ACPI_HEST_TYPE_AER_ROOT_PORT = 6, + ACPI_HEST_TYPE_AER_ENDPOINT = 7, + ACPI_HEST_TYPE_AER_BRIDGE = 8, + ACPI_HEST_TYPE_GENERIC_ERROR = 9, + ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10, + ACPI_HEST_TYPE_IA32_DEFERRED_CHECK = 11, + ACPI_HEST_TYPE_RESERVED = 12, +}; + +struct acpi_hest_ia_machine_check { + struct acpi_hest_header header; + u16 reserved1; + u8 flags; + u8 enabled; + u32 records_to_preallocate; + u32 max_sections_per_record; + u64 global_capability_data; + u64 global_control_data; + u8 num_hardware_banks; + u8 reserved3[7]; +}; + +struct acpi_hest_generic { + struct acpi_hest_header header; + u16 related_source_id; + u8 reserved; + u8 enabled; + u32 records_to_preallocate; + u32 max_sections_per_record; + u32 max_raw_data_length; + struct acpi_generic_address error_status_address; + struct acpi_hest_notify notify; + u32 error_block_length; +} __attribute__((packed)); + +struct acpi_hest_ia_deferred_check { + struct acpi_hest_header header; + u16 reserved1; + u8 flags; + u8 enabled; + u32 records_to_preallocate; + u32 max_sections_per_record; + struct acpi_hest_notify notify; + u8 num_hardware_banks; + u8 reserved2[3]; +}; + +enum hest_status { + HEST_ENABLED = 0, + HEST_DISABLED = 1, + HEST_NOT_FOUND = 2, +}; + +typedef int (*apei_hest_func_t)(struct acpi_hest_header *, void *); + +struct ghes_arr { + struct platform_device **ghes_devs; + unsigned int count; +}; + +struct acpi_table_erst { + struct acpi_table_header header; + u32 header_length; + u32 reserved; + u32 entries; +}; + +enum acpi_erst_actions { + ACPI_ERST_BEGIN_WRITE = 0, + ACPI_ERST_BEGIN_READ = 1, + ACPI_ERST_BEGIN_CLEAR = 2, + ACPI_ERST_END = 3, + ACPI_ERST_SET_RECORD_OFFSET = 4, + ACPI_ERST_EXECUTE_OPERATION = 5, + ACPI_ERST_CHECK_BUSY_STATUS = 6, + ACPI_ERST_GET_COMMAND_STATUS = 7, + ACPI_ERST_GET_RECORD_ID = 8, + ACPI_ERST_SET_RECORD_ID = 9, + ACPI_ERST_GET_RECORD_COUNT = 10, + ACPI_ERST_BEGIN_DUMMY_WRIITE = 11, + ACPI_ERST_NOT_USED = 12, + ACPI_ERST_GET_ERROR_RANGE = 13, + ACPI_ERST_GET_ERROR_LENGTH = 14, + ACPI_ERST_GET_ERROR_ATTRIBUTES = 15, + ACPI_ERST_EXECUTE_TIMINGS = 16, + ACPI_ERST_ACTION_RESERVED = 17, +}; + +enum acpi_erst_instructions { + ACPI_ERST_READ_REGISTER = 0, + ACPI_ERST_READ_REGISTER_VALUE = 1, + ACPI_ERST_WRITE_REGISTER = 2, + ACPI_ERST_WRITE_REGISTER_VALUE = 3, + ACPI_ERST_NOOP = 4, + ACPI_ERST_LOAD_VAR1 = 5, + ACPI_ERST_LOAD_VAR2 = 6, + ACPI_ERST_STORE_VAR1 = 7, + ACPI_ERST_ADD = 8, + ACPI_ERST_SUBTRACT = 9, + ACPI_ERST_ADD_VALUE = 10, + ACPI_ERST_SUBTRACT_VALUE = 11, + ACPI_ERST_STALL = 12, + ACPI_ERST_STALL_WHILE_TRUE = 13, + ACPI_ERST_SKIP_NEXT_IF_TRUE = 14, + ACPI_ERST_GOTO = 15, + ACPI_ERST_SET_SRC_ADDRESS_BASE = 16, + ACPI_ERST_SET_DST_ADDRESS_BASE = 17, + ACPI_ERST_MOVE_DATA = 18, + ACPI_ERST_INSTRUCTION_RESERVED = 19, +}; + +struct erst_erange { + u64 base; + u64 size; + void *vaddr; + u32 attr; +}; + +struct erst_record_id_cache { + struct mutex lock; + u64 *entries; + int len; + int size; + int refcount; +}; + +struct cper_pstore_record { + struct cper_record_header hdr; + struct cper_section_descriptor sec_hdr; + char data[0]; +}; + +struct acpi_bert_region { + u32 block_status; + u32 raw_data_offset; + u32 raw_data_length; + u32 data_length; + u32 error_severity; +}; + +struct acpi_hest_generic_status { + u32 block_status; + u32 raw_data_offset; + u32 raw_data_length; + u32 data_length; + u32 error_severity; +}; + +enum acpi_hest_notify_types { + ACPI_HEST_NOTIFY_POLLED = 0, + ACPI_HEST_NOTIFY_EXTERNAL = 1, + ACPI_HEST_NOTIFY_LOCAL = 2, + ACPI_HEST_NOTIFY_SCI = 3, + ACPI_HEST_NOTIFY_NMI = 4, + ACPI_HEST_NOTIFY_CMCI = 5, + ACPI_HEST_NOTIFY_MCE = 6, + ACPI_HEST_NOTIFY_GPIO = 7, + ACPI_HEST_NOTIFY_SEA = 8, + ACPI_HEST_NOTIFY_SEI = 9, + ACPI_HEST_NOTIFY_GSIV = 10, + ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED = 11, + ACPI_HEST_NOTIFY_RESERVED = 12, +}; + +struct acpi_hest_generic_v2 { + struct acpi_hest_header header; + u16 related_source_id; + u8 reserved; + u8 enabled; + u32 records_to_preallocate; + u32 max_sections_per_record; + u32 max_raw_data_length; + struct acpi_generic_address error_status_address; + struct acpi_hest_notify notify; + u32 error_block_length; + struct acpi_generic_address read_ack_register; + u64 read_ack_preserve; + u64 read_ack_write; +} __attribute__((packed)); + +struct acpi_hest_generic_data { + u8 section_type[16]; + u32 error_severity; + u16 revision; + u8 validation_bits; + u8 flags; + u32 error_data_length; + u8 fru_id[16]; + u8 fru_text[20]; +}; + +struct acpi_hest_generic_data_v300 { + u8 section_type[16]; + u32 error_severity; + u16 revision; + u8 validation_bits; + u8 flags; + u32 error_data_length; + u8 fru_id[16]; + u8 fru_text[20]; + u64 time_stamp; +}; + +struct cper_sec_proc_arm { + u32 validation_bits; + u16 err_info_num; + u16 context_info_num; + u32 section_length; + u8 affinity_level; + u8 reserved[3]; + u64 mpidr; + u64 midr; + u32 running_state; + u32 psci_state; +}; + +struct cper_sec_pcie { + u64 validation_bits; + u32 port_type; + struct { + u8 minor; + u8 major; + u8 reserved[2]; + } version; + u16 command; + u16 status; + u32 reserved; + struct { + u16 vendor_id; + u16 device_id; + u8 class_code[3]; + u8 function; + u8 device; + u16 segment; + u8 bus; + u8 secondary_bus; + u16 slot; + u8 reserved; + } __attribute__((packed)) device_id; + struct { + u32 lower; + u32 upper; + } serial_number; + struct { + u16 secondary_status; + u16 control; + } bridge; + u8 capability[60]; + u8 aer_info[96]; +}; + +struct ghes { + union { + struct acpi_hest_generic *generic; + struct acpi_hest_generic_v2 *generic_v2; + }; + struct acpi_hest_generic_status *estatus; + long unsigned int flags; + union { + struct list_head list; + struct timer_list timer; + unsigned int irq; + }; +}; + +struct ghes_estatus_node { + struct llist_node llnode; + struct acpi_hest_generic *generic; + struct ghes *ghes; + int task_work_cpu; + struct callback_head task_work; +}; + +struct ghes_estatus_cache { + u32 estatus_len; + atomic_t count; + struct acpi_hest_generic *generic; + long long unsigned int time_in; + struct callback_head rcu; +}; + +struct ghes_vendor_record_entry { + struct work_struct work; + int error_severity; + char vendor_record[0]; +}; + +struct pmic_table { + int address; + int reg; + int bit; +}; + +struct intel_pmic_opregion_data { + int (*get_power)(struct regmap *, int, int, u64 *); + int (*update_power)(struct regmap *, int, int, bool); + int (*get_raw_temp)(struct regmap *, int); + int (*update_aux)(struct regmap *, int, int); + int (*get_policy)(struct regmap *, int, int, u64 *); + int (*update_policy)(struct regmap *, int, int, int); + int (*exec_mipi_pmic_seq_element)(struct regmap *, u16, u32, u32, u32); + struct pmic_table *power_table; + int power_table_count; + struct pmic_table *thermal_table; + int thermal_table_count; + int pmic_i2c_address; +}; + +struct intel_pmic_regs_handler_ctx { + unsigned int val; + u16 addr; +}; + +struct intel_pmic_opregion { + struct mutex lock; + struct acpi_lpat_conversion_table *lpat_table; + struct regmap *regmap; + struct intel_pmic_opregion_data *data; + struct intel_pmic_regs_handler_ctx ctx; +}; + +enum regcache_type { + REGCACHE_NONE = 0, + REGCACHE_RBTREE = 1, + REGCACHE_COMPRESSED = 2, + REGCACHE_FLAT = 3, +}; + +struct reg_default { + unsigned int reg; + unsigned int def; +}; + +enum regmap_endian { + REGMAP_ENDIAN_DEFAULT = 0, + REGMAP_ENDIAN_BIG = 1, + REGMAP_ENDIAN_LITTLE = 2, + REGMAP_ENDIAN_NATIVE = 3, +}; + +struct regmap_range { + unsigned int range_min; + unsigned int range_max; +}; + +struct regmap_access_table { + const struct regmap_range *yes_ranges; + unsigned int n_yes_ranges; + const struct regmap_range *no_ranges; + unsigned int n_no_ranges; +}; + +typedef void (*regmap_lock)(void *); + +typedef void (*regmap_unlock)(void *); + +struct regmap_range_cfg; + +struct regmap_config { + const char *name; + int reg_bits; + int reg_stride; + int pad_bits; + int val_bits; + bool (*writeable_reg)(struct device *, unsigned int); + bool (*readable_reg)(struct device *, unsigned int); + bool (*volatile_reg)(struct device *, unsigned int); + bool (*precious_reg)(struct device *, unsigned int); + bool (*writeable_noinc_reg)(struct device *, unsigned int); + bool (*readable_noinc_reg)(struct device *, unsigned int); + bool disable_locking; + regmap_lock lock; + regmap_unlock unlock; + void *lock_arg; + int (*reg_read)(void *, unsigned int, unsigned int *); + int (*reg_write)(void *, unsigned int, unsigned int); + bool fast_io; + unsigned int max_register; + const struct regmap_access_table *wr_table; + const struct regmap_access_table *rd_table; + const struct regmap_access_table *volatile_table; + const struct regmap_access_table *precious_table; + const struct regmap_access_table *wr_noinc_table; + const struct regmap_access_table *rd_noinc_table; + const struct reg_default *reg_defaults; + unsigned int num_reg_defaults; + enum regcache_type cache_type; + const void *reg_defaults_raw; + unsigned int num_reg_defaults_raw; + long unsigned int read_flag_mask; + long unsigned int write_flag_mask; + bool zero_flag_mask; + bool use_single_read; + bool use_single_write; + bool use_relaxed_mmio; + bool can_multi_write; + enum regmap_endian reg_format_endian; + enum regmap_endian val_format_endian; + const struct regmap_range_cfg *ranges; + unsigned int num_ranges; + bool use_hwlock; + unsigned int hwlock_id; + unsigned int hwlock_mode; + bool can_sleep; +}; + +struct regmap_range_cfg { + const char *name; + unsigned int range_min; + unsigned int range_max; + unsigned int selector_reg; + unsigned int selector_mask; + int selector_shift; + unsigned int window_start; + unsigned int window_len; +}; + +struct regmap_irq_type { + unsigned int type_reg_offset; + unsigned int type_reg_mask; + unsigned int type_rising_val; + unsigned int type_falling_val; + unsigned int type_level_low_val; + unsigned int type_level_high_val; + unsigned int types_supported; +}; + +struct regmap_irq { + unsigned int reg_offset; + unsigned int mask; + struct regmap_irq_type type; +}; + +struct regmap_irq_sub_irq_map { + unsigned int num_regs; + unsigned int *offset; +}; + +struct regmap_irq_chip { + const char *name; + unsigned int main_status; + unsigned int num_main_status_bits; + struct regmap_irq_sub_irq_map *sub_reg_offsets; + int num_main_regs; + unsigned int status_base; + unsigned int mask_base; + unsigned int unmask_base; + unsigned int ack_base; + unsigned int wake_base; + unsigned int type_base; + unsigned int irq_reg_stride; + bool mask_writeonly: 1; + bool init_ack_masked: 1; + bool mask_invert: 1; + bool use_ack: 1; + bool ack_invert: 1; + bool clear_ack: 1; + bool wake_invert: 1; + bool runtime_pm: 1; + bool type_invert: 1; + bool type_in_mask: 1; + bool clear_on_unmask: 1; + int num_regs; + const struct regmap_irq *irqs; + int num_irqs; + int num_type_reg; + unsigned int type_reg_stride; + int (*handle_pre_irq)(void *); + int (*handle_post_irq)(void *); + void *irq_drv_data; +}; + +struct axp20x_dev { + struct device *dev; + int irq; + long unsigned int irq_flags; + struct regmap *regmap; + struct regmap_irq_chip_data *regmap_irqc; + long int variant; + int nr_cells; + const struct mfd_cell *cells; + const struct regmap_config *regmap_cfg; + const struct regmap_irq_chip *regmap_irq_chip; +}; + +struct mfd_cell_acpi_match; + +struct mfd_cell { + const char *name; + int id; + int level; + int (*enable)(struct platform_device *); + int (*disable)(struct platform_device *); + int (*suspend)(struct platform_device *); + int (*resume)(struct platform_device *); + void *platform_data; + size_t pdata_size; + const struct property_entry *properties; + const char *of_compatible; + const u64 of_reg; + bool use_of_reg; + const struct mfd_cell_acpi_match *acpi_match; + int num_resources; + const struct resource *resources; + bool ignore_resource_conflicts; + bool pm_runtime_no_callbacks; + const char * const *parent_supplies; + int num_parent_supplies; +}; + +struct pnp_resource { + struct list_head list; + struct resource res; +}; + +struct pnp_port { + resource_size_t min; + resource_size_t max; + resource_size_t align; + resource_size_t size; + unsigned char flags; +}; + +typedef struct { + long unsigned int bits[4]; +} pnp_irq_mask_t; + +struct pnp_irq { + pnp_irq_mask_t map; + unsigned char flags; +}; + +struct pnp_dma { + unsigned char map; + unsigned char flags; +}; + +struct pnp_mem { + resource_size_t min; + resource_size_t max; + resource_size_t align; + resource_size_t size; + unsigned char flags; +}; + +struct pnp_option { + struct list_head list; + unsigned int flags; + long unsigned int type; + union { + struct pnp_port port; + struct pnp_irq irq; + struct pnp_dma dma; + struct pnp_mem mem; + } u; +}; + +struct pnp_info_buffer { + char *buffer; + char *curr; + long unsigned int size; + long unsigned int len; + int stop; + int error; +}; + +typedef struct pnp_info_buffer pnp_info_buffer_t; + +struct pnp_fixup { + char id[7]; + void (*quirk_function)(struct pnp_dev *); +}; + +struct acpipnp_parse_option_s { + struct pnp_dev *dev; + unsigned int option_flags; +}; + +struct clk_bulk_data { + const char *id; + struct clk *clk; +}; + +struct clk_bulk_devres { + struct clk_bulk_data *clks; + int num_clks; +}; + +struct clk_hw; + +struct clk_lookup { + struct list_head node; + const char *dev_id; + const char *con_id; + struct clk *clk; + struct clk_hw *clk_hw; +}; + +struct clk_init_data; + +struct clk_hw { + struct clk_core *core; + struct clk *clk; + const struct clk_init_data *init; +}; + +struct clk_rate_request { + long unsigned int rate; + long unsigned int min_rate; + long unsigned int max_rate; + long unsigned int best_parent_rate; + struct clk_hw *best_parent_hw; +}; + +struct clk_duty { + unsigned int num; + unsigned int den; +}; + +struct clk_ops { + int (*prepare)(struct clk_hw *); + void (*unprepare)(struct clk_hw *); + int (*is_prepared)(struct clk_hw *); + void (*unprepare_unused)(struct clk_hw *); + int (*enable)(struct clk_hw *); + void (*disable)(struct clk_hw *); + int (*is_enabled)(struct clk_hw *); + void (*disable_unused)(struct clk_hw *); + int (*save_context)(struct clk_hw *); + void (*restore_context)(struct clk_hw *); + long unsigned int (*recalc_rate)(struct clk_hw *, long unsigned int); + long int (*round_rate)(struct clk_hw *, long unsigned int, long unsigned int *); + int (*determine_rate)(struct clk_hw *, struct clk_rate_request *); + int (*set_parent)(struct clk_hw *, u8); + u8 (*get_parent)(struct clk_hw *); + int (*set_rate)(struct clk_hw *, long unsigned int, long unsigned int); + int (*set_rate_and_parent)(struct clk_hw *, long unsigned int, long unsigned int, u8); + long unsigned int (*recalc_accuracy)(struct clk_hw *, long unsigned int); + int (*get_phase)(struct clk_hw *); + int (*set_phase)(struct clk_hw *, int); + int (*get_duty_cycle)(struct clk_hw *, struct clk_duty *); + int (*set_duty_cycle)(struct clk_hw *, struct clk_duty *); + int (*init)(struct clk_hw *); + void (*terminate)(struct clk_hw *); + void (*debug_init)(struct clk_hw *, struct dentry *); +}; + +struct clk_parent_data { + const struct clk_hw *hw; + const char *fw_name; + const char *name; + int index; +}; + +struct clk_init_data { + const char *name; + const struct clk_ops *ops; + const char * const *parent_names; + const struct clk_parent_data *parent_data; + const struct clk_hw **parent_hws; + u8 num_parents; + long unsigned int flags; +}; + +struct clk_lookup_alloc { + struct clk_lookup cl; + char dev_id[20]; + char con_id[16]; +}; + +struct clk_notifier { + struct clk *clk; + struct srcu_notifier_head notifier_head; + struct list_head node; +}; + +struct clk_notifier_data { + struct clk *clk; + long unsigned int old_rate; + long unsigned int new_rate; +}; + +struct clk_parent_map; + +struct clk_core { + const char *name; + const struct clk_ops *ops; + struct clk_hw *hw; + struct module *owner; + struct device *dev; + struct device_node *of_node; + struct clk_core *parent; + struct clk_parent_map *parents; + u8 num_parents; + u8 new_parent_index; + long unsigned int rate; + long unsigned int req_rate; + long unsigned int new_rate; + struct clk_core *new_parent; + struct clk_core *new_child; + long unsigned int flags; + bool orphan; + bool rpm_enabled; + unsigned int enable_count; + unsigned int prepare_count; + unsigned int protect_count; + long unsigned int min_rate; + long unsigned int max_rate; + long unsigned int accuracy; + int phase; + struct clk_duty duty; + struct hlist_head children; + struct hlist_node child_node; + struct hlist_head clks; + unsigned int notifier_count; + struct dentry *dentry; + struct hlist_node debug_node; + struct kref ref; +}; + +struct clk_parent_map { + const struct clk_hw *hw; + struct clk_core *core; + const char *fw_name; + const char *name; + int index; +}; + +struct trace_event_raw_clk { + struct trace_entry ent; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_clk_rate { + struct trace_entry ent; + u32 __data_loc_name; + long unsigned int rate; + char __data[0]; +}; + +struct trace_event_raw_clk_rate_range { + struct trace_entry ent; + u32 __data_loc_name; + long unsigned int min; + long unsigned int max; + char __data[0]; +}; + +struct trace_event_raw_clk_parent { + struct trace_entry ent; + u32 __data_loc_name; + u32 __data_loc_pname; + char __data[0]; +}; + +struct trace_event_raw_clk_phase { + struct trace_entry ent; + u32 __data_loc_name; + int phase; + char __data[0]; +}; + +struct trace_event_raw_clk_duty_cycle { + struct trace_entry ent; + u32 __data_loc_name; + unsigned int num; + unsigned int den; + char __data[0]; +}; + +struct trace_event_data_offsets_clk { + u32 name; +}; + +struct trace_event_data_offsets_clk_rate { + u32 name; +}; + +struct trace_event_data_offsets_clk_rate_range { + u32 name; +}; + +struct trace_event_data_offsets_clk_parent { + u32 name; + u32 pname; +}; + +struct trace_event_data_offsets_clk_phase { + u32 name; +}; + +struct trace_event_data_offsets_clk_duty_cycle { + u32 name; +}; + +typedef void (*btf_trace_clk_enable)(void *, struct clk_core *); + +typedef void (*btf_trace_clk_enable_complete)(void *, struct clk_core *); + +typedef void (*btf_trace_clk_disable)(void *, struct clk_core *); + +typedef void (*btf_trace_clk_disable_complete)(void *, struct clk_core *); + +typedef void (*btf_trace_clk_prepare)(void *, struct clk_core *); + +typedef void (*btf_trace_clk_prepare_complete)(void *, struct clk_core *); + +typedef void (*btf_trace_clk_unprepare)(void *, struct clk_core *); + +typedef void (*btf_trace_clk_unprepare_complete)(void *, struct clk_core *); + +typedef void (*btf_trace_clk_set_rate)(void *, struct clk_core *, long unsigned int); + +typedef void (*btf_trace_clk_set_rate_complete)(void *, struct clk_core *, long unsigned int); + +typedef void (*btf_trace_clk_set_min_rate)(void *, struct clk_core *, long unsigned int); + +typedef void (*btf_trace_clk_set_max_rate)(void *, struct clk_core *, long unsigned int); + +typedef void (*btf_trace_clk_set_rate_range)(void *, struct clk_core *, long unsigned int, long unsigned int); + +typedef void (*btf_trace_clk_set_parent)(void *, struct clk_core *, struct clk_core *); + +typedef void (*btf_trace_clk_set_parent_complete)(void *, struct clk_core *, struct clk_core *); + +typedef void (*btf_trace_clk_set_phase)(void *, struct clk_core *, int); + +typedef void (*btf_trace_clk_set_phase_complete)(void *, struct clk_core *, int); + +typedef void (*btf_trace_clk_set_duty_cycle)(void *, struct clk_core *, struct clk_duty *); + +typedef void (*btf_trace_clk_set_duty_cycle_complete)(void *, struct clk_core *, struct clk_duty *); + +struct clk_notifier_devres { + struct clk *clk; + struct notifier_block *nb; +}; + +struct clk_div_table { + unsigned int val; + unsigned int div; +}; + +struct clk_divider { + struct clk_hw hw; + void *reg; + u8 shift; + u8 width; + u8 flags; + const struct clk_div_table *table; + spinlock_t *lock; +}; + +struct clk_fixed_factor { + struct clk_hw hw; + unsigned int mult; + unsigned int div; +}; + +struct clk_fixed_rate { + struct clk_hw hw; + long unsigned int fixed_rate; + long unsigned int fixed_accuracy; + long unsigned int flags; +}; + +struct clk_gate { + struct clk_hw hw; + void *reg; + u8 bit_idx; + u8 flags; + spinlock_t *lock; +}; + +struct clk_multiplier { + struct clk_hw hw; + void *reg; + u8 shift; + u8 width; + u8 flags; + spinlock_t *lock; +}; + +struct clk_mux { + struct clk_hw hw; + void *reg; + u32 *table; + u32 mask; + u8 shift; + u8 flags; + spinlock_t *lock; +}; + +struct clk_composite { + struct clk_hw hw; + struct clk_ops ops; + struct clk_hw *mux_hw; + struct clk_hw *rate_hw; + struct clk_hw *gate_hw; + const struct clk_ops *mux_ops; + const struct clk_ops *rate_ops; + const struct clk_ops *gate_ops; +}; + +struct clk_fractional_divider { + struct clk_hw hw; + void *reg; + u8 mshift; + u8 mwidth; + u32 mmask; + u8 nshift; + u8 nwidth; + u32 nmask; + u8 flags; + void (*approximation)(struct clk_hw *, long unsigned int, long unsigned int *, long unsigned int *, long unsigned int *); + spinlock_t *lock; +}; + +struct gpio_desc___2; + +struct clk_gpio { + struct clk_hw hw; + struct gpio_desc___2 *gpiod; +}; + +struct pmc_clk { + const char *name; + long unsigned int freq; + const char *parent_name; +}; + +struct pmc_clk_data { + void *base; + const struct pmc_clk *clks; + bool critical; +}; + +struct clk_plt_fixed { + struct clk_hw *clk; + struct clk_lookup *lookup; +}; + +struct clk_plt { + struct clk_hw hw; + void *reg; + struct clk_lookup *lookup; + spinlock_t lock; +}; + +struct clk_plt_data { + struct clk_plt_fixed **parents; + u8 nparents; + struct clk_plt *clks[6]; + struct clk_lookup *mclk_lookup; + struct clk_lookup *ether_clk_lookup; +}; + +typedef s32 dma_cookie_t; + +enum dma_status { + DMA_COMPLETE = 0, + DMA_IN_PROGRESS = 1, + DMA_PAUSED = 2, + DMA_ERROR = 3, + DMA_OUT_OF_ORDER = 4, +}; + +enum dma_transaction_type { + DMA_MEMCPY = 0, + DMA_XOR = 1, + DMA_PQ = 2, + DMA_XOR_VAL = 3, + DMA_PQ_VAL = 4, + DMA_MEMSET = 5, + DMA_MEMSET_SG = 6, + DMA_INTERRUPT = 7, + DMA_PRIVATE = 8, + DMA_ASYNC_TX = 9, + DMA_SLAVE = 10, + DMA_CYCLIC = 11, + DMA_INTERLEAVE = 12, + DMA_COMPLETION_NO_ORDER = 13, + DMA_REPEAT = 14, + DMA_LOAD_EOT = 15, + DMA_TX_TYPE_END = 16, +}; + +enum dma_transfer_direction { + DMA_MEM_TO_MEM = 0, + DMA_MEM_TO_DEV = 1, + DMA_DEV_TO_MEM = 2, + DMA_DEV_TO_DEV = 3, + DMA_TRANS_NONE = 4, +}; + +struct data_chunk { + size_t size; + size_t icg; + size_t dst_icg; + size_t src_icg; +}; + +struct dma_interleaved_template { + dma_addr_t src_start; + dma_addr_t dst_start; + enum dma_transfer_direction dir; + bool src_inc; + bool dst_inc; + bool src_sgl; + bool dst_sgl; + size_t numf; + size_t frame_size; + struct data_chunk sgl[0]; +}; + +enum dma_ctrl_flags { + DMA_PREP_INTERRUPT = 1, + DMA_CTRL_ACK = 2, + DMA_PREP_PQ_DISABLE_P = 4, + DMA_PREP_PQ_DISABLE_Q = 8, + DMA_PREP_CONTINUE = 16, + DMA_PREP_FENCE = 32, + DMA_CTRL_REUSE = 64, + DMA_PREP_CMD = 128, + DMA_PREP_REPEAT = 256, + DMA_PREP_LOAD_EOT = 512, +}; + +enum sum_check_bits { + SUM_CHECK_P = 0, + SUM_CHECK_Q = 1, +}; + +enum sum_check_flags { + SUM_CHECK_P_RESULT = 1, + SUM_CHECK_Q_RESULT = 2, +}; + +typedef struct { + long unsigned int bits[1]; +} dma_cap_mask_t; + +enum dma_desc_metadata_mode { + DESC_METADATA_NONE = 0, + DESC_METADATA_CLIENT = 1, + DESC_METADATA_ENGINE = 2, +}; + +struct dma_chan_percpu { + long unsigned int memcpy_count; + long unsigned int bytes_transferred; +}; + +struct dma_router { + struct device *dev; + void (*route_free)(struct device *, void *); +}; + +struct dma_device; + +struct dma_chan_dev; + +struct dma_chan___2 { + struct dma_device *device; + struct device *slave; + dma_cookie_t cookie; + dma_cookie_t completed_cookie; + int chan_id; + struct dma_chan_dev *dev; + const char *name; + char *dbg_client_name; + struct list_head device_node; + struct dma_chan_percpu *local; + int client_count; + int table_count; + struct dma_router *router; + void *route_data; + void *private; +}; + +typedef bool (*dma_filter_fn)(struct dma_chan___2 *, void *); + +struct dma_slave_map; + +struct dma_filter { + dma_filter_fn fn; + int mapcnt; + const struct dma_slave_map *map; +}; + +enum dmaengine_alignment { + DMAENGINE_ALIGN_1_BYTE = 0, + DMAENGINE_ALIGN_2_BYTES = 1, + DMAENGINE_ALIGN_4_BYTES = 2, + DMAENGINE_ALIGN_8_BYTES = 3, + DMAENGINE_ALIGN_16_BYTES = 4, + DMAENGINE_ALIGN_32_BYTES = 5, + DMAENGINE_ALIGN_64_BYTES = 6, +}; + +enum dma_residue_granularity { + DMA_RESIDUE_GRANULARITY_DESCRIPTOR = 0, + DMA_RESIDUE_GRANULARITY_SEGMENT = 1, + DMA_RESIDUE_GRANULARITY_BURST = 2, +}; + +struct dma_async_tx_descriptor; + +struct dma_slave_caps; + +struct dma_slave_config; + +struct dma_tx_state; + +struct dma_device { + struct kref ref; + unsigned int chancnt; + unsigned int privatecnt; + struct list_head channels; + struct list_head global_node; + struct dma_filter filter; + dma_cap_mask_t cap_mask; + enum dma_desc_metadata_mode desc_metadata_modes; + short unsigned int max_xor; + short unsigned int max_pq; + enum dmaengine_alignment copy_align; + enum dmaengine_alignment xor_align; + enum dmaengine_alignment pq_align; + enum dmaengine_alignment fill_align; + int dev_id; + struct device *dev; + struct module *owner; + struct ida chan_ida; + struct mutex chan_mutex; + u32 src_addr_widths; + u32 dst_addr_widths; + u32 directions; + u32 min_burst; + u32 max_burst; + u32 max_sg_burst; + bool descriptor_reuse; + enum dma_residue_granularity residue_granularity; + int (*device_alloc_chan_resources)(struct dma_chan___2 *); + int (*device_router_config)(struct dma_chan___2 *); + void (*device_free_chan_resources)(struct dma_chan___2 *); + struct dma_async_tx_descriptor * (*device_prep_dma_memcpy)(struct dma_chan___2 *, dma_addr_t, dma_addr_t, size_t, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_dma_xor)(struct dma_chan___2 *, dma_addr_t, dma_addr_t *, unsigned int, size_t, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_dma_xor_val)(struct dma_chan___2 *, dma_addr_t *, unsigned int, size_t, enum sum_check_flags *, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_dma_pq)(struct dma_chan___2 *, dma_addr_t *, dma_addr_t *, unsigned int, const unsigned char *, size_t, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_dma_pq_val)(struct dma_chan___2 *, dma_addr_t *, dma_addr_t *, unsigned int, const unsigned char *, size_t, enum sum_check_flags *, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_dma_memset)(struct dma_chan___2 *, dma_addr_t, int, size_t, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_dma_memset_sg)(struct dma_chan___2 *, struct scatterlist *, unsigned int, int, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_dma_interrupt)(struct dma_chan___2 *, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_slave_sg)(struct dma_chan___2 *, struct scatterlist *, unsigned int, enum dma_transfer_direction, long unsigned int, void *); + struct dma_async_tx_descriptor * (*device_prep_dma_cyclic)(struct dma_chan___2 *, dma_addr_t, size_t, size_t, enum dma_transfer_direction, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_interleaved_dma)(struct dma_chan___2 *, struct dma_interleaved_template *, long unsigned int); + struct dma_async_tx_descriptor * (*device_prep_dma_imm_data)(struct dma_chan___2 *, dma_addr_t, u64, long unsigned int); + void (*device_caps)(struct dma_chan___2 *, struct dma_slave_caps *); + int (*device_config)(struct dma_chan___2 *, struct dma_slave_config *); + int (*device_pause)(struct dma_chan___2 *); + int (*device_resume)(struct dma_chan___2 *); + int (*device_terminate_all)(struct dma_chan___2 *); + void (*device_synchronize)(struct dma_chan___2 *); + enum dma_status (*device_tx_status)(struct dma_chan___2 *, dma_cookie_t, struct dma_tx_state *); + void (*device_issue_pending)(struct dma_chan___2 *); + void (*device_release)(struct dma_device *); + void (*dbg_summary_show)(struct seq_file *, struct dma_device *); + struct dentry *dbg_dev_root; +}; + +struct dma_chan_dev { + struct dma_chan___2 *chan; + struct device device; + int dev_id; + bool chan_dma_dev; +}; + +enum dma_slave_buswidth { + DMA_SLAVE_BUSWIDTH_UNDEFINED = 0, + DMA_SLAVE_BUSWIDTH_1_BYTE = 1, + DMA_SLAVE_BUSWIDTH_2_BYTES = 2, + DMA_SLAVE_BUSWIDTH_3_BYTES = 3, + DMA_SLAVE_BUSWIDTH_4_BYTES = 4, + DMA_SLAVE_BUSWIDTH_8_BYTES = 8, + DMA_SLAVE_BUSWIDTH_16_BYTES = 16, + DMA_SLAVE_BUSWIDTH_32_BYTES = 32, + DMA_SLAVE_BUSWIDTH_64_BYTES = 64, +}; + +struct dma_slave_config { + enum dma_transfer_direction direction; + phys_addr_t src_addr; + phys_addr_t dst_addr; + enum dma_slave_buswidth src_addr_width; + enum dma_slave_buswidth dst_addr_width; + u32 src_maxburst; + u32 dst_maxburst; + u32 src_port_window_size; + u32 dst_port_window_size; + bool device_fc; + unsigned int slave_id; + void *peripheral_config; + size_t peripheral_size; +}; + +struct dma_slave_caps { + u32 src_addr_widths; + u32 dst_addr_widths; + u32 directions; + u32 min_burst; + u32 max_burst; + u32 max_sg_burst; + bool cmd_pause; + bool cmd_resume; + bool cmd_terminate; + enum dma_residue_granularity residue_granularity; + bool descriptor_reuse; +}; + +typedef void (*dma_async_tx_callback)(void *); + +enum dmaengine_tx_result { + DMA_TRANS_NOERROR = 0, + DMA_TRANS_READ_FAILED = 1, + DMA_TRANS_WRITE_FAILED = 2, + DMA_TRANS_ABORTED = 3, +}; + +struct dmaengine_result { + enum dmaengine_tx_result result; + u32 residue; +}; + +typedef void (*dma_async_tx_callback_result)(void *, const struct dmaengine_result *); + +struct dmaengine_unmap_data { + u16 map_cnt; + u8 to_cnt; + u8 from_cnt; + u8 bidi_cnt; + struct device *dev; + struct kref kref; + size_t len; + dma_addr_t addr[0]; +}; + +struct dma_descriptor_metadata_ops { + int (*attach)(struct dma_async_tx_descriptor *, void *, size_t); + void * (*get_ptr)(struct dma_async_tx_descriptor *, size_t *, size_t *); + int (*set_len)(struct dma_async_tx_descriptor *, size_t); +}; + +struct dma_async_tx_descriptor { + dma_cookie_t cookie; + enum dma_ctrl_flags flags; + dma_addr_t phys; + struct dma_chan___2 *chan; + dma_cookie_t (*tx_submit)(struct dma_async_tx_descriptor *); + int (*desc_free)(struct dma_async_tx_descriptor *); + dma_async_tx_callback callback; + dma_async_tx_callback_result callback_result; + void *callback_param; + struct dmaengine_unmap_data *unmap; + enum dma_desc_metadata_mode desc_metadata_mode; + struct dma_descriptor_metadata_ops *metadata_ops; +}; + +struct dma_tx_state { + dma_cookie_t last; + dma_cookie_t used; + u32 residue; + u32 in_flight_bytes; +}; + +struct dma_slave_map { + const char *devname; + const char *slave; + void *param; +}; + +struct dma_chan_tbl_ent { + struct dma_chan___2 *chan; +}; + +struct dmaengine_unmap_pool { + struct kmem_cache *cache; + const char *name; + mempool_t *pool; + size_t size; +}; + +struct dmaengine_desc_callback { + dma_async_tx_callback callback; + dma_async_tx_callback_result callback_result; + void *callback_param; +}; + +struct virt_dma_desc { + struct dma_async_tx_descriptor tx; + struct dmaengine_result tx_result; + struct list_head node; +}; + +struct virt_dma_chan { + struct dma_chan___2 chan; + struct tasklet_struct task; + void (*desc_free)(struct virt_dma_desc *); + spinlock_t lock; + struct list_head desc_allocated; + struct list_head desc_submitted; + struct list_head desc_issued; + struct list_head desc_completed; + struct list_head desc_terminated; + struct virt_dma_desc *cyclic; +}; + +struct acpi_table_csrt { + struct acpi_table_header header; +}; + +struct acpi_csrt_group { + u32 length; + u32 vendor_id; + u32 subvendor_id; + u16 device_id; + u16 subdevice_id; + u16 revision; + u16 reserved; + u32 shared_info_length; +}; + +struct acpi_csrt_shared_info { + u16 major_version; + u16 minor_version; + u32 mmio_base_low; + u32 mmio_base_high; + u32 gsi_interrupt; + u8 interrupt_polarity; + u8 interrupt_mode; + u8 num_channels; + u8 dma_address_width; + u16 base_request_line; + u16 num_handshake_signals; + u32 max_block_size; +}; + +struct acpi_dma_spec { + int chan_id; + int slave_id; + struct device *dev; +}; + +struct acpi_dma { + struct list_head dma_controllers; + struct device *dev; + struct dma_chan___2 * (*acpi_dma_xlate)(struct acpi_dma_spec *, struct acpi_dma *); + void *data; + short unsigned int base_request_line; + short unsigned int end_request_line; +}; + +struct acpi_dma_filter_info { + dma_cap_mask_t dma_cap; + dma_filter_fn filter_fn; +}; + +struct acpi_dma_parser_data { + struct acpi_dma_spec dma_spec; + size_t index; + size_t n; +}; + +struct dw_dma_slave { + struct device *dma_dev; + u8 src_id; + u8 dst_id; + u8 m_master; + u8 p_master; + u8 channels; + bool hs_polarity; +}; + +struct dw_dma_platform_data { + unsigned int nr_channels; + unsigned char chan_allocation_order; + unsigned char chan_priority; + unsigned int block_size; + unsigned char nr_masters; + unsigned char data_width[4]; + unsigned char multi_block[8]; + u32 max_burst[8]; + unsigned char protctl; +}; + +struct dw_dma; + +struct dw_dma_chip { + struct device *dev; + int id; + int irq; + void *regs; + struct clk *clk; + struct dw_dma *dw; + const struct dw_dma_platform_data *pdata; +}; + +struct dma_pool___2; + +struct dw_dma_chan; + +struct dw_dma { + struct dma_device dma; + char name[20]; + void *regs; + struct dma_pool___2 *desc_pool; + struct tasklet_struct tasklet; + struct dw_dma_chan *chan; + u8 all_chan_mask; + u8 in_use; + void (*initialize_chan)(struct dw_dma_chan *); + void (*suspend_chan)(struct dw_dma_chan *, bool); + void (*resume_chan)(struct dw_dma_chan *, bool); + u32 (*prepare_ctllo)(struct dw_dma_chan *); + void (*encode_maxburst)(struct dw_dma_chan *, u32 *); + u32 (*bytes2block)(struct dw_dma_chan *, size_t, unsigned int, size_t *); + size_t (*block2bytes)(struct dw_dma_chan *, u32, u32); + void (*set_device_name)(struct dw_dma *, int); + void (*disable)(struct dw_dma *); + void (*enable)(struct dw_dma *); + struct dw_dma_platform_data *pdata; +}; + +enum dw_dma_fc { + DW_DMA_FC_D_M2M = 0, + DW_DMA_FC_D_M2P = 1, + DW_DMA_FC_D_P2M = 2, + DW_DMA_FC_D_P2P = 3, + DW_DMA_FC_P_P2M = 4, + DW_DMA_FC_SP_P2P = 5, + DW_DMA_FC_P_M2P = 6, + DW_DMA_FC_DP_P2P = 7, +}; + +struct dw_dma_chan_regs { + u32 SAR; + u32 __pad_SAR; + u32 DAR; + u32 __pad_DAR; + u32 LLP; + u32 __pad_LLP; + u32 CTL_LO; + u32 CTL_HI; + u32 SSTAT; + u32 __pad_SSTAT; + u32 DSTAT; + u32 __pad_DSTAT; + u32 SSTATAR; + u32 __pad_SSTATAR; + u32 DSTATAR; + u32 __pad_DSTATAR; + u32 CFG_LO; + u32 CFG_HI; + u32 SGR; + u32 __pad_SGR; + u32 DSR; + u32 __pad_DSR; +}; + +struct dw_dma_irq_regs { + u32 XFER; + u32 __pad_XFER; + u32 BLOCK; + u32 __pad_BLOCK; + u32 SRC_TRAN; + u32 __pad_SRC_TRAN; + u32 DST_TRAN; + u32 __pad_DST_TRAN; + u32 ERROR; + u32 __pad_ERROR; +}; + +struct dw_dma_regs { + struct dw_dma_chan_regs CHAN[8]; + struct dw_dma_irq_regs RAW; + struct dw_dma_irq_regs STATUS; + struct dw_dma_irq_regs MASK; + struct dw_dma_irq_regs CLEAR; + u32 STATUS_INT; + u32 __pad_STATUS_INT; + u32 REQ_SRC; + u32 __pad_REQ_SRC; + u32 REQ_DST; + u32 __pad_REQ_DST; + u32 SGL_REQ_SRC; + u32 __pad_SGL_REQ_SRC; + u32 SGL_REQ_DST; + u32 __pad_SGL_REQ_DST; + u32 LAST_SRC; + u32 __pad_LAST_SRC; + u32 LAST_DST; + u32 __pad_LAST_DST; + u32 CFG; + u32 __pad_CFG; + u32 CH_EN; + u32 __pad_CH_EN; + u32 ID; + u32 __pad_ID; + u32 TEST; + u32 __pad_TEST; + u32 CLASS_PRIORITY0; + u32 __pad_CLASS_PRIORITY0; + u32 CLASS_PRIORITY1; + u32 __pad_CLASS_PRIORITY1; + u32 __reserved; + u32 DWC_PARAMS[8]; + u32 MULTI_BLK_TYPE; + u32 MAX_BLK_SIZE; + u32 DW_PARAMS; + u32 COMP_TYPE; + u32 COMP_VERSION; + u32 FIFO_PARTITION0; + u32 __pad_FIFO_PARTITION0; + u32 FIFO_PARTITION1; + u32 __pad_FIFO_PARTITION1; + u32 SAI_ERR; + u32 __pad_SAI_ERR; + u32 GLOBAL_CFG; + u32 __pad_GLOBAL_CFG; +}; + +enum dw_dmac_flags { + DW_DMA_IS_CYCLIC = 0, + DW_DMA_IS_SOFT_LLP = 1, + DW_DMA_IS_PAUSED = 2, + DW_DMA_IS_INITIALIZED = 3, +}; + +struct dw_dma_chan { + struct dma_chan___2 chan; + void *ch_regs; + u8 mask; + u8 priority; + enum dma_transfer_direction direction; + struct list_head *tx_node_active; + spinlock_t lock; + long unsigned int flags; + struct list_head active_list; + struct list_head queue; + unsigned int descs_allocated; + unsigned int block_size; + bool nollp; + u32 max_burst; + struct dw_dma_slave dws; + struct dma_slave_config dma_sconfig; +}; + +struct dw_lli { + __le32 sar; + __le32 dar; + __le32 llp; + __le32 ctllo; + __le32 ctlhi; + __le32 sstat; + __le32 dstat; +}; + +struct dw_desc { + struct dw_lli lli; + struct list_head desc_node; + struct list_head tx_list; + struct dma_async_tx_descriptor txd; + size_t len; + size_t total_len; + u32 residue; +}; + +struct dw_dma_chip_pdata { + const struct dw_dma_platform_data *pdata; + int (*probe)(struct dw_dma_chip *); + int (*remove)(struct dw_dma_chip *); + struct dw_dma_chip *chip; +}; + +struct hsu_dma; + +struct hsu_dma_chip { + struct device *dev; + int irq; + void *regs; + unsigned int length; + unsigned int offset; + struct hsu_dma *hsu; +}; + +struct hsu_dma_chan; + +struct hsu_dma { + struct dma_device dma; + struct hsu_dma_chan *chan; + short unsigned int nr_channels; +}; + +struct hsu_dma_sg { + dma_addr_t addr; + unsigned int len; +}; + +struct hsu_dma_desc { + struct virt_dma_desc vdesc; + enum dma_transfer_direction direction; + struct hsu_dma_sg *sg; + unsigned int nents; + size_t length; + unsigned int active; + enum dma_status status; +}; + +struct hsu_dma_chan { + struct virt_dma_chan vchan; + void *reg; + enum dma_transfer_direction direction; + struct dma_slave_config config; + struct hsu_dma_desc *desc; +}; + +struct virtio_driver { + struct device_driver driver; + const struct virtio_device_id *id_table; + const unsigned int *feature_table; + unsigned int feature_table_size; + const unsigned int *feature_table_legacy; + unsigned int feature_table_size_legacy; + int (*validate)(struct virtio_device *); + int (*probe)(struct virtio_device *); + void (*scan)(struct virtio_device *); + void (*remove)(struct virtio_device *); + void (*config_changed)(struct virtio_device *); + int (*freeze)(struct virtio_device *); + int (*restore)(struct virtio_device *); +}; + +typedef __u16 __virtio16; + +typedef __u32 __virtio32; + +typedef __u64 __virtio64; + +struct vring_desc { + __virtio64 addr; + __virtio32 len; + __virtio16 flags; + __virtio16 next; +}; + +struct vring_avail { + __virtio16 flags; + __virtio16 idx; + __virtio16 ring[0]; +}; + +struct vring_used_elem { + __virtio32 id; + __virtio32 len; +}; + +typedef struct vring_used_elem vring_used_elem_t; + +struct vring_used { + __virtio16 flags; + __virtio16 idx; + vring_used_elem_t ring[0]; +}; + +typedef struct vring_desc vring_desc_t; + +typedef struct vring_avail vring_avail_t; + +typedef struct vring_used vring_used_t; + +struct vring { + unsigned int num; + vring_desc_t *desc; + vring_avail_t *avail; + vring_used_t *used; +}; + +struct vring_packed_desc_event { + __le16 off_wrap; + __le16 flags; +}; + +struct vring_packed_desc { + __le64 addr; + __le32 len; + __le16 id; + __le16 flags; +}; + +struct vring_desc_state_split { + void *data; + struct vring_desc *indir_desc; +}; + +struct vring_desc_state_packed { + void *data; + struct vring_packed_desc *indir_desc; + u16 num; + u16 next; + u16 last; +}; + +struct vring_desc_extra_packed { + dma_addr_t addr; + u32 len; + u16 flags; +}; + +struct vring_virtqueue { + struct virtqueue vq; + bool packed_ring; + bool use_dma_api; + bool weak_barriers; + bool broken; + bool indirect; + bool event; + unsigned int free_head; + unsigned int num_added; + u16 last_used_idx; + union { + struct { + struct vring vring; + u16 avail_flags_shadow; + u16 avail_idx_shadow; + struct vring_desc_state_split *desc_state; + dma_addr_t queue_dma_addr; + size_t queue_size_in_bytes; + } split; + struct { + struct { + unsigned int num; + struct vring_packed_desc *desc; + struct vring_packed_desc_event *driver; + struct vring_packed_desc_event *device; + } vring; + bool avail_wrap_counter; + bool used_wrap_counter; + u16 avail_used_flags; + u16 next_avail_idx; + u16 event_flags_shadow; + struct vring_desc_state_packed *desc_state; + struct vring_desc_extra_packed *desc_extra; + dma_addr_t ring_dma_addr; + dma_addr_t driver_event_dma_addr; + dma_addr_t device_event_dma_addr; + size_t ring_size_in_bytes; + size_t event_size_in_bytes; + } packed; + }; + bool (*notify)(struct virtqueue *); + bool we_own_ring; +}; + +struct virtio_pci_common_cfg { + __le32 device_feature_select; + __le32 device_feature; + __le32 guest_feature_select; + __le32 guest_feature; + __le16 msix_config; + __le16 num_queues; + __u8 device_status; + __u8 config_generation; + __le16 queue_select; + __le16 queue_size; + __le16 queue_msix_vector; + __le16 queue_enable; + __le16 queue_notify_off; + __le32 queue_desc_lo; + __le32 queue_desc_hi; + __le32 queue_avail_lo; + __le32 queue_avail_hi; + __le32 queue_used_lo; + __le32 queue_used_hi; +}; + +struct virtio_pci_vq_info { + struct virtqueue *vq; + struct list_head node; + unsigned int msix_vector; +}; + +struct virtio_pci_device { + struct virtio_device vdev; + struct pci_dev *pci_dev; + u8 *isr; + struct virtio_pci_common_cfg *common; + void *device; + void *notify_base; + size_t notify_len; + size_t device_len; + int notify_map_cap; + u32 notify_offset_multiplier; + int modern_bars; + void *ioaddr; + spinlock_t lock; + struct list_head virtqueues; + struct virtio_pci_vq_info **vqs; + int msix_enabled; + int intx_enabled; + cpumask_var_t *msix_affinity_masks; + char (*msix_names)[256]; + unsigned int msix_vectors; + unsigned int msix_used_vectors; + bool per_vq_vectors; + struct virtqueue * (*setup_vq)(struct virtio_pci_device *, struct virtio_pci_vq_info *, unsigned int, void (*)(struct virtqueue *), const char *, bool, u16); + void (*del_vq)(struct virtio_pci_vq_info *); + u16 (*config_vector)(struct virtio_pci_device *, u16); +}; + +enum { + VP_MSIX_CONFIG_VECTOR = 0, + VP_MSIX_VQ_VECTOR = 1, +}; + +struct grant_entry_v1 { + uint16_t flags; + domid_t domid; + uint32_t frame; +}; + +struct grant_entry_header { + uint16_t flags; + domid_t domid; +}; + +union grant_entry_v2 { + struct grant_entry_header hdr; + struct { + struct grant_entry_header hdr; + uint32_t pad0; + uint64_t frame; + } full_page; + struct { + struct grant_entry_header hdr; + uint16_t page_off; + uint16_t length; + uint64_t frame; + } sub_page; + struct { + struct grant_entry_header hdr; + domid_t trans_domid; + uint16_t pad0; + grant_ref_t gref; + } transitive; + uint32_t __spacer[4]; +}; + +struct gnttab_setup_table { + domid_t dom; + uint32_t nr_frames; + int16_t status; + __guest_handle_xen_pfn_t frame_list; +}; + +struct gnttab_copy { + struct { + union { + grant_ref_t ref; + xen_pfn_t gmfn; + } u; + domid_t domid; + uint16_t offset; + } source; + struct { + union { + grant_ref_t ref; + xen_pfn_t gmfn; + } u; + domid_t domid; + uint16_t offset; + } dest; + uint16_t len; + uint16_t flags; + int16_t status; +}; + +struct gnttab_query_size { + domid_t dom; + uint32_t nr_frames; + uint32_t max_nr_frames; + int16_t status; +}; + +struct gnttab_set_version { + uint32_t version; +}; + +struct gnttab_get_status_frames { + uint32_t nr_frames; + domid_t dom; + int16_t status; + __guest_handle_uint64_t frame_list; +}; + +struct gnttab_free_callback { + struct gnttab_free_callback *next; + void (*fn)(void *); + void *arg; + u16 count; +}; + +struct gntab_unmap_queue_data; + +typedef void (*gnttab_unmap_refs_done)(int, struct gntab_unmap_queue_data *); + +struct gntab_unmap_queue_data { + struct delayed_work gnttab_work; + void *data; + gnttab_unmap_refs_done done; + struct gnttab_unmap_grant_ref *unmap_ops; + struct gnttab_unmap_grant_ref *kunmap_ops; + struct page **pages; + unsigned int count; + unsigned int age; +}; + +struct gnttab_page_cache { + spinlock_t lock; + struct page *pages; + unsigned int num_pages; +}; + +struct xen_page_foreign { + domid_t domid; + grant_ref_t gref; +}; + +typedef void (*xen_grant_fn_t)(long unsigned int, unsigned int, unsigned int, void *); + +struct gnttab_ops { + unsigned int version; + unsigned int grefs_per_grant_frame; + int (*map_frames)(xen_pfn_t *, unsigned int); + void (*unmap_frames)(); + void (*update_entry)(grant_ref_t, domid_t, long unsigned int, unsigned int); + int (*end_foreign_access_ref)(grant_ref_t, int); + long unsigned int (*end_foreign_transfer_ref)(grant_ref_t); + int (*query_foreign_access)(grant_ref_t); +}; + +struct unmap_refs_callback_data { + struct completion completion; + int result; +}; + +struct deferred_entry { + struct list_head list; + grant_ref_t ref; + bool ro; + uint16_t warn_delay; + struct page *page; +}; + +struct xen_feature_info { + unsigned int submap_idx; + uint32_t submap; +}; + +struct balloon_stats { + long unsigned int current_pages; + long unsigned int target_pages; + long unsigned int target_unpopulated; + long unsigned int balloon_low; + long unsigned int balloon_high; + long unsigned int total_pages; + long unsigned int schedule_delay; + long unsigned int max_schedule_delay; + long unsigned int retry_count; + long unsigned int max_retry_count; +}; + +enum bp_state { + BP_DONE = 0, + BP_WAIT = 1, + BP_EAGAIN = 2, + BP_ECANCELED = 3, +}; + +enum shutdown_state { + SHUTDOWN_INVALID = 4294967295, + SHUTDOWN_POWEROFF = 0, + SHUTDOWN_SUSPEND = 2, + SHUTDOWN_HALT = 4, +}; + +struct suspend_info { + int cancelled; +}; + +struct shutdown_handler { + const char command[11]; + bool flag; + void (*cb)(); +}; + +struct vcpu_runstate_info { + int state; + uint64_t state_entry_time; + uint64_t time[4]; +}; + +typedef struct vcpu_runstate_info *__guest_handle_vcpu_runstate_info; + +struct vcpu_register_runstate_memory_area { + union { + __guest_handle_vcpu_runstate_info h; + struct vcpu_runstate_info *v; + uint64_t p; + } addr; +}; + +typedef evtchn_port_t *__guest_handle_evtchn_port_t; + +struct evtchn_bind_interdomain { + domid_t remote_dom; + evtchn_port_t remote_port; + evtchn_port_t local_port; +}; + +struct evtchn_bind_virq { + uint32_t virq; + uint32_t vcpu; + evtchn_port_t port; +}; + +struct evtchn_bind_pirq { + uint32_t pirq; + uint32_t flags; + evtchn_port_t port; +}; + +struct evtchn_bind_ipi { + uint32_t vcpu; + evtchn_port_t port; +}; + +struct evtchn_close { + evtchn_port_t port; +}; + +struct evtchn_send { + evtchn_port_t port; +}; + +struct evtchn_status { + domid_t dom; + evtchn_port_t port; + uint32_t status; + uint32_t vcpu; + union { + struct { + domid_t dom; + } unbound; + struct { + domid_t dom; + evtchn_port_t port; + } interdomain; + uint32_t pirq; + uint32_t virq; + } u; +}; + +struct evtchn_bind_vcpu { + evtchn_port_t port; + uint32_t vcpu; +}; + +struct evtchn_set_priority { + evtchn_port_t port; + uint32_t priority; +}; + +struct sched_poll { + __guest_handle_evtchn_port_t ports; + unsigned int nr_ports; + uint64_t timeout; +}; + +struct physdev_eoi { + uint32_t irq; +}; + +struct physdev_pirq_eoi_gmfn { + xen_ulong_t gmfn; +}; + +struct physdev_irq_status_query { + uint32_t irq; + uint32_t flags; +}; + +struct physdev_irq { + uint32_t irq; + uint32_t vector; +}; + +struct physdev_map_pirq { + domid_t domid; + int type; + int index; + int pirq; + int bus; + int devfn; + int entry_nr; + uint64_t table_base; +}; + +struct physdev_unmap_pirq { + domid_t domid; + int pirq; +}; + +struct physdev_get_free_pirq { + int type; + uint32_t pirq; +}; + +struct evtchn_loop_ctrl; + +struct evtchn_ops { + unsigned int (*max_channels)(); + unsigned int (*nr_channels)(); + int (*setup)(evtchn_port_t); + void (*remove)(evtchn_port_t, unsigned int); + void (*bind_to_cpu)(evtchn_port_t, unsigned int, unsigned int); + void (*clear_pending)(evtchn_port_t); + void (*set_pending)(evtchn_port_t); + bool (*is_pending)(evtchn_port_t); + void (*mask)(evtchn_port_t); + void (*unmask)(evtchn_port_t); + void (*handle_events)(unsigned int, struct evtchn_loop_ctrl *); + void (*resume)(); + int (*percpu_init)(unsigned int); + int (*percpu_deinit)(unsigned int); +}; + +struct evtchn_loop_ctrl { + ktime_t timeout; + unsigned int count; + bool defer_eoi; +}; + +enum xen_irq_type { + IRQT_UNBOUND = 0, + IRQT_PIRQ = 1, + IRQT_VIRQ = 2, + IRQT_IPI = 3, + IRQT_EVTCHN = 4, +}; + +struct irq_info { + struct list_head list; + struct list_head eoi_list; + short int refcnt; + u8 spurious_cnt; + u8 is_accounted; + short int type; + u8 mask_reason; + u8 is_active; + unsigned int irq; + evtchn_port_t evtchn; + short unsigned int cpu; + short unsigned int eoi_cpu; + unsigned int irq_epoch; + u64 eoi_time; + raw_spinlock_t lock; + union { + short unsigned int virq; + enum ipi_vector ipi; + struct { + short unsigned int pirq; + short unsigned int gsi; + unsigned char vector; + unsigned char flags; + uint16_t domid; + } pirq; + } u; +}; + +struct lateeoi_work { + struct delayed_work delayed; + spinlock_t eoi_list_lock; + struct list_head eoi_list; +}; + +struct evtchn_unmask { + evtchn_port_t port; +}; + +struct evtchn_init_control { + uint64_t control_gfn; + uint32_t offset; + uint32_t vcpu; + uint8_t link_bits; + uint8_t _pad[7]; +}; + +struct evtchn_expand_array { + uint64_t array_gfn; +}; + +typedef uint32_t event_word_t; + +struct evtchn_fifo_control_block { + uint32_t ready; + uint32_t _rsvd; + event_word_t head[16]; +}; + +struct evtchn_fifo_queue { + uint32_t head[16]; +}; + +struct evtchn_alloc_unbound { + domid_t dom; + domid_t remote_dom; + evtchn_port_t port; +}; + +struct xenbus_map_node { + struct list_head next; + union { + struct { + struct vm_struct *area; + } pv; + struct { + struct page *pages[16]; + long unsigned int addrs[16]; + void *addr; + } hvm; + }; + grant_handle_t handles[16]; + unsigned int nr_handles; +}; + +struct map_ring_valloc { + struct xenbus_map_node *node; + long unsigned int addrs[16]; + phys_addr_t phys_addrs[16]; + struct gnttab_map_grant_ref map[16]; + struct gnttab_unmap_grant_ref unmap[16]; + unsigned int idx; +}; + +struct xenbus_ring_ops { + int (*map)(struct xenbus_device *, struct map_ring_valloc *, grant_ref_t *, unsigned int, void **); + int (*unmap)(struct xenbus_device *, void *); +}; + +struct unmap_ring_hvm { + unsigned int idx; + long unsigned int addrs[16]; +}; + +enum xsd_sockmsg_type { + XS_DEBUG = 0, + XS_DIRECTORY = 1, + XS_READ = 2, + XS_GET_PERMS = 3, + XS_WATCH = 4, + XS_UNWATCH = 5, + XS_TRANSACTION_START = 6, + XS_TRANSACTION_END = 7, + XS_INTRODUCE = 8, + XS_RELEASE = 9, + XS_GET_DOMAIN_PATH = 10, + XS_WRITE = 11, + XS_MKDIR = 12, + XS_RM = 13, + XS_SET_PERMS = 14, + XS_WATCH_EVENT = 15, + XS_ERROR = 16, + XS_IS_DOMAIN_INTRODUCED = 17, + XS_RESUME = 18, + XS_SET_TARGET = 19, + XS_RESTRICT = 20, + XS_RESET_WATCHES = 21, +}; + +struct xsd_sockmsg { + uint32_t type; + uint32_t req_id; + uint32_t tx_id; + uint32_t len; +}; + +typedef uint32_t XENSTORE_RING_IDX; + +struct xenstore_domain_interface { + char req[1024]; + char rsp[1024]; + XENSTORE_RING_IDX req_cons; + XENSTORE_RING_IDX req_prod; + XENSTORE_RING_IDX rsp_cons; + XENSTORE_RING_IDX rsp_prod; +}; + +struct xs_watch_event { + struct list_head list; + unsigned int len; + struct xenbus_watch *handle; + const char *path; + const char *token; + char body[0]; +}; + +enum xb_req_state { + xb_req_state_queued = 0, + xb_req_state_wait_reply = 1, + xb_req_state_got_reply = 2, + xb_req_state_aborted = 3, +}; + +struct xb_req_data { + struct list_head list; + wait_queue_head_t wq; + struct xsd_sockmsg msg; + uint32_t caller_req_id; + enum xsd_sockmsg_type type; + char *body; + const struct kvec *vec; + int num_vecs; + int err; + enum xb_req_state state; + bool user_req; + void (*cb)(struct xb_req_data *); + void *par; +}; + +enum xenstore_init { + XS_UNKNOWN = 0, + XS_PV = 1, + XS_HVM = 2, + XS_LOCAL = 3, +}; + +struct xen_hvm_param { + domid_t domid; + uint32_t index; + uint64_t value; +}; + +struct xen_bus_type { + char *root; + unsigned int levels; + int (*get_bus_id)(char *, const char *); + int (*probe)(struct xen_bus_type *, const char *, const char *); + bool (*otherend_will_handle)(struct xenbus_watch *, const char *, const char *); + void (*otherend_changed)(struct xenbus_watch *, const char *, const char *); + struct bus_type bus; +}; + +struct xb_find_info { + struct xenbus_device *dev; + const char *nodename; +}; + +struct xenbus_transaction_holder { + struct list_head list; + struct xenbus_transaction handle; + unsigned int generation_id; +}; + +struct read_buffer { + struct list_head list; + unsigned int cons; + unsigned int len; + char msg[0]; +}; + +struct xenbus_file_priv { + struct mutex msgbuffer_mutex; + struct list_head transactions; + struct list_head watches; + unsigned int len; + union { + struct xsd_sockmsg msg; + char buffer[4096]; + } u; + struct mutex reply_mutex; + struct list_head read_buffers; + wait_queue_head_t read_waitq; + struct kref kref; + struct work_struct wq; +}; + +struct watch_adapter { + struct list_head list; + struct xenbus_watch watch; + struct xenbus_file_priv *dev_data; + char *token; +}; + +struct physdev_manage_pci { + uint8_t bus; + uint8_t devfn; +}; + +struct physdev_manage_pci_ext { + uint8_t bus; + uint8_t devfn; + unsigned int is_extfn; + unsigned int is_virtfn; + struct { + uint8_t bus; + uint8_t devfn; + } physfn; +}; + +struct physdev_pci_mmcfg_reserved { + uint64_t address; + uint16_t segment; + uint8_t start_bus; + uint8_t end_bus; + uint32_t flags; +}; + +struct physdev_pci_device_add { + uint16_t seg; + uint8_t bus; + uint8_t devfn; + uint32_t flags; + struct { + uint8_t bus; + uint8_t devfn; + } physfn; + uint32_t optarr[0]; +}; + +struct physdev_pci_device { + uint16_t seg; + uint8_t bus; + uint8_t devfn; +}; + +struct pci_mmcfg_region { + struct list_head list; + struct resource res; + u64 address; + char *virt; + u16 segment; + u8 start_bus; + u8 end_bus; + char name[30]; +}; + +struct usb_device_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __le16 bcdUSB; + __u8 bDeviceClass; + __u8 bDeviceSubClass; + __u8 bDeviceProtocol; + __u8 bMaxPacketSize0; + __le16 idVendor; + __le16 idProduct; + __le16 bcdDevice; + __u8 iManufacturer; + __u8 iProduct; + __u8 iSerialNumber; + __u8 bNumConfigurations; +}; + +struct usb_config_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __le16 wTotalLength; + __u8 bNumInterfaces; + __u8 bConfigurationValue; + __u8 iConfiguration; + __u8 bmAttributes; + __u8 bMaxPower; +} __attribute__((packed)); + +struct usb_interface_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bInterfaceNumber; + __u8 bAlternateSetting; + __u8 bNumEndpoints; + __u8 bInterfaceClass; + __u8 bInterfaceSubClass; + __u8 bInterfaceProtocol; + __u8 iInterface; +}; + +struct usb_endpoint_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bEndpointAddress; + __u8 bmAttributes; + __le16 wMaxPacketSize; + __u8 bInterval; + __u8 bRefresh; + __u8 bSynchAddress; +} __attribute__((packed)); + +struct usb_ssp_isoc_ep_comp_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __le16 wReseved; + __le32 dwBytesPerInterval; +}; + +struct usb_ss_ep_comp_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bMaxBurst; + __u8 bmAttributes; + __le16 wBytesPerInterval; +}; + +struct usb_interface_assoc_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bFirstInterface; + __u8 bInterfaceCount; + __u8 bFunctionClass; + __u8 bFunctionSubClass; + __u8 bFunctionProtocol; + __u8 iFunction; +}; + +struct usb_bos_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __le16 wTotalLength; + __u8 bNumDeviceCaps; +} __attribute__((packed)); + +struct usb_ext_cap_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; + __le32 bmAttributes; +} __attribute__((packed)); + +struct usb_ss_cap_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; + __u8 bmAttributes; + __le16 wSpeedSupported; + __u8 bFunctionalitySupport; + __u8 bU1devExitLat; + __le16 bU2DevExitLat; +}; + +struct usb_ss_container_id_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; + __u8 bReserved; + __u8 ContainerID[16]; +}; + +struct usb_ssp_cap_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; + __u8 bReserved; + __le32 bmAttributes; + __le16 wFunctionalitySupport; + __le16 wReserved; + __le32 bmSublinkSpeedAttr[1]; +}; + +struct usb_ptm_cap_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; +}; + +enum usb_device_speed { + USB_SPEED_UNKNOWN = 0, + USB_SPEED_LOW = 1, + USB_SPEED_FULL = 2, + USB_SPEED_HIGH = 3, + USB_SPEED_WIRELESS = 4, + USB_SPEED_SUPER = 5, + USB_SPEED_SUPER_PLUS = 6, +}; + +enum usb_device_state { + USB_STATE_NOTATTACHED = 0, + USB_STATE_ATTACHED = 1, + USB_STATE_POWERED = 2, + USB_STATE_RECONNECTING = 3, + USB_STATE_UNAUTHENTICATED = 4, + USB_STATE_DEFAULT = 5, + USB_STATE_ADDRESS = 6, + USB_STATE_CONFIGURED = 7, + USB_STATE_SUSPENDED = 8, +}; + +enum usb3_link_state { + USB3_LPM_U0 = 0, + USB3_LPM_U1 = 1, + USB3_LPM_U2 = 2, + USB3_LPM_U3 = 3, +}; + +struct ep_device; + +struct usb_host_endpoint { + struct usb_endpoint_descriptor desc; + struct usb_ss_ep_comp_descriptor ss_ep_comp; + struct usb_ssp_isoc_ep_comp_descriptor ssp_isoc_ep_comp; + char: 8; + struct list_head urb_list; + void *hcpriv; + struct ep_device *ep_dev; + unsigned char *extra; + int extralen; + int enabled; + int streams; + int: 32; +} __attribute__((packed)); + +struct usb_host_interface { + struct usb_interface_descriptor desc; + int extralen; + unsigned char *extra; + struct usb_host_endpoint *endpoint; + char *string; +}; + +enum usb_interface_condition { + USB_INTERFACE_UNBOUND = 0, + USB_INTERFACE_BINDING = 1, + USB_INTERFACE_BOUND = 2, + USB_INTERFACE_UNBINDING = 3, +}; + +struct usb_interface { + struct usb_host_interface *altsetting; + struct usb_host_interface *cur_altsetting; + unsigned int num_altsetting; + struct usb_interface_assoc_descriptor *intf_assoc; + int minor; + enum usb_interface_condition condition; + unsigned int sysfs_files_created: 1; + unsigned int ep_devs_created: 1; + unsigned int unregistering: 1; + unsigned int needs_remote_wakeup: 1; + unsigned int needs_altsetting0: 1; + unsigned int needs_binding: 1; + unsigned int resetting_device: 1; + unsigned int authorized: 1; + struct device dev; + struct device *usb_dev; + struct work_struct reset_ws; +}; + +struct usb_interface_cache { + unsigned int num_altsetting; + struct kref ref; + struct usb_host_interface altsetting[0]; +}; + +struct usb_host_config { + struct usb_config_descriptor desc; + char *string; + struct usb_interface_assoc_descriptor *intf_assoc[16]; + struct usb_interface *interface[32]; + struct usb_interface_cache *intf_cache[32]; + unsigned char *extra; + int extralen; +}; + +struct usb_host_bos { + struct usb_bos_descriptor *desc; + struct usb_ext_cap_descriptor *ext_cap; + struct usb_ss_cap_descriptor *ss_cap; + struct usb_ssp_cap_descriptor *ssp_cap; + struct usb_ss_container_id_descriptor *ss_id; + struct usb_ptm_cap_descriptor *ptm_cap; +}; + +struct usb_devmap { + long unsigned int devicemap[2]; +}; + +struct usb_device; + +struct mon_bus; + +struct usb_bus { + struct device *controller; + struct device *sysdev; + int busnum; + const char *bus_name; + u8 uses_pio_for_control; + u8 otg_port; + unsigned int is_b_host: 1; + unsigned int b_hnp_enable: 1; + unsigned int no_stop_on_short: 1; + unsigned int no_sg_constraint: 1; + unsigned int sg_tablesize; + int devnum_next; + struct mutex devnum_next_mutex; + struct usb_devmap devmap; + struct usb_device *root_hub; + struct usb_bus *hs_companion; + int bandwidth_allocated; + int bandwidth_int_reqs; + int bandwidth_isoc_reqs; + unsigned int resuming_ports; + struct mon_bus *mon_bus; + int monitored; +}; + +struct wusb_dev; + +enum usb_device_removable { + USB_DEVICE_REMOVABLE_UNKNOWN = 0, + USB_DEVICE_REMOVABLE = 1, + USB_DEVICE_FIXED = 2, +}; + +struct usb2_lpm_parameters { + unsigned int besl; + int timeout; +}; + +struct usb3_lpm_parameters { + unsigned int mel; + unsigned int pel; + unsigned int sel; + int timeout; +}; + +struct usb_tt; + +struct usb_device { + int devnum; + char devpath[16]; + u32 route; + enum usb_device_state state; + enum usb_device_speed speed; + unsigned int rx_lanes; + unsigned int tx_lanes; + struct usb_tt *tt; + int ttport; + unsigned int toggle[2]; + struct usb_device *parent; + struct usb_bus *bus; + struct usb_host_endpoint ep0; + struct device dev; + struct usb_device_descriptor descriptor; + struct usb_host_bos *bos; + struct usb_host_config *config; + struct usb_host_config *actconfig; + struct usb_host_endpoint *ep_in[16]; + struct usb_host_endpoint *ep_out[16]; + char **rawdescriptors; + short unsigned int bus_mA; + u8 portnum; + u8 level; + u8 devaddr; + unsigned int can_submit: 1; + unsigned int persist_enabled: 1; + unsigned int have_langid: 1; + unsigned int authorized: 1; + unsigned int authenticated: 1; + unsigned int wusb: 1; + unsigned int lpm_capable: 1; + unsigned int usb2_hw_lpm_capable: 1; + unsigned int usb2_hw_lpm_besl_capable: 1; + unsigned int usb2_hw_lpm_enabled: 1; + unsigned int usb2_hw_lpm_allowed: 1; + unsigned int usb3_lpm_u1_enabled: 1; + unsigned int usb3_lpm_u2_enabled: 1; + int string_langid; + char *product; + char *manufacturer; + char *serial; + struct list_head filelist; + int maxchild; + u32 quirks; + atomic_t urbnum; + long unsigned int active_duration; + long unsigned int connect_time; + unsigned int do_remote_wakeup: 1; + unsigned int reset_resume: 1; + unsigned int port_is_suspended: 1; + struct wusb_dev *wusb_dev; + int slot_id; + enum usb_device_removable removable; + struct usb2_lpm_parameters l1_params; + struct usb3_lpm_parameters u1_params; + struct usb3_lpm_parameters u2_params; + unsigned int lpm_disable_count; + u16 hub_delay; + unsigned int use_generic_driver: 1; +}; + +struct usb_tt { + struct usb_device *hub; + int multi; + unsigned int think_time; + void *hcpriv; + spinlock_t lock; + struct list_head clear_list; + struct work_struct clear_work; +}; + +struct usb_iso_packet_descriptor { + unsigned int offset; + unsigned int length; + unsigned int actual_length; + int status; +}; + +struct usb_anchor { + struct list_head urb_list; + wait_queue_head_t wait; + spinlock_t lock; + atomic_t suspend_wakeups; + unsigned int poisoned: 1; +}; + +struct urb; + +typedef void (*usb_complete_t)(struct urb *); + +struct urb { + struct kref kref; + int unlinked; + void *hcpriv; + atomic_t use_count; + atomic_t reject; + struct list_head urb_list; + struct list_head anchor_list; + struct usb_anchor *anchor; + struct usb_device *dev; + struct usb_host_endpoint *ep; + unsigned int pipe; + unsigned int stream_id; + int status; + unsigned int transfer_flags; + void *transfer_buffer; + dma_addr_t transfer_dma; + struct scatterlist *sg; + int num_mapped_sgs; + int num_sgs; + u32 transfer_buffer_length; + u32 actual_length; + unsigned char *setup_packet; + dma_addr_t setup_dma; + int start_frame; + int number_of_packets; + int interval; + int error_count; + void *context; + usb_complete_t complete; + struct usb_iso_packet_descriptor iso_frame_desc[0]; +}; + +struct giveback_urb_bh { + bool running; + spinlock_t lock; + struct list_head head; + struct tasklet_struct bh; + struct usb_host_endpoint *completing_ep; +}; + +enum usb_dev_authorize_policy { + USB_DEVICE_AUTHORIZE_NONE = 0, + USB_DEVICE_AUTHORIZE_ALL = 1, + USB_DEVICE_AUTHORIZE_INTERNAL = 2, +}; + +struct usb_phy_roothub; + +struct hc_driver; + +struct usb_phy; + +struct usb_hcd { + struct usb_bus self; + struct kref kref; + const char *product_desc; + int speed; + char irq_descr[24]; + struct timer_list rh_timer; + struct urb *status_urb; + struct work_struct wakeup_work; + struct work_struct died_work; + const struct hc_driver *driver; + struct usb_phy *usb_phy; + struct usb_phy_roothub *phy_roothub; + long unsigned int flags; + enum usb_dev_authorize_policy dev_policy; + unsigned int rh_registered: 1; + unsigned int rh_pollable: 1; + unsigned int msix_enabled: 1; + unsigned int msi_enabled: 1; + unsigned int skip_phy_initialization: 1; + unsigned int uses_new_polling: 1; + unsigned int wireless: 1; + unsigned int has_tt: 1; + unsigned int amd_resume_bug: 1; + unsigned int can_do_streams: 1; + unsigned int tpl_support: 1; + unsigned int cant_recv_wakeups: 1; + unsigned int irq; + void *regs; + resource_size_t rsrc_start; + resource_size_t rsrc_len; + unsigned int power_budget; + struct giveback_urb_bh high_prio_bh; + struct giveback_urb_bh low_prio_bh; + struct mutex *address0_mutex; + struct mutex *bandwidth_mutex; + struct usb_hcd *shared_hcd; + struct usb_hcd *primary_hcd; + struct dma_pool___2 *pool[4]; + int state; + struct gen_pool *localmem_pool; + long unsigned int hcd_priv[0]; +}; + +struct hc_driver { + const char *description; + const char *product_desc; + size_t hcd_priv_size; + irqreturn_t (*irq)(struct usb_hcd *); + int flags; + int (*reset)(struct usb_hcd *); + int (*start)(struct usb_hcd *); + int (*pci_suspend)(struct usb_hcd *, bool); + int (*pci_resume)(struct usb_hcd *, bool); + void (*stop)(struct usb_hcd *); + void (*shutdown)(struct usb_hcd *); + int (*get_frame_number)(struct usb_hcd *); + int (*urb_enqueue)(struct usb_hcd *, struct urb *, gfp_t); + int (*urb_dequeue)(struct usb_hcd *, struct urb *, int); + int (*map_urb_for_dma)(struct usb_hcd *, struct urb *, gfp_t); + void (*unmap_urb_for_dma)(struct usb_hcd *, struct urb *); + void (*endpoint_disable)(struct usb_hcd *, struct usb_host_endpoint *); + void (*endpoint_reset)(struct usb_hcd *, struct usb_host_endpoint *); + int (*hub_status_data)(struct usb_hcd *, char *); + int (*hub_control)(struct usb_hcd *, u16, u16, u16, char *, u16); + int (*bus_suspend)(struct usb_hcd *); + int (*bus_resume)(struct usb_hcd *); + int (*start_port_reset)(struct usb_hcd *, unsigned int); + long unsigned int (*get_resuming_ports)(struct usb_hcd *); + void (*relinquish_port)(struct usb_hcd *, int); + int (*port_handed_over)(struct usb_hcd *, int); + void (*clear_tt_buffer_complete)(struct usb_hcd *, struct usb_host_endpoint *); + int (*alloc_dev)(struct usb_hcd *, struct usb_device *); + void (*free_dev)(struct usb_hcd *, struct usb_device *); + int (*alloc_streams)(struct usb_hcd *, struct usb_device *, struct usb_host_endpoint **, unsigned int, unsigned int, gfp_t); + int (*free_streams)(struct usb_hcd *, struct usb_device *, struct usb_host_endpoint **, unsigned int, gfp_t); + int (*add_endpoint)(struct usb_hcd *, struct usb_device *, struct usb_host_endpoint *); + int (*drop_endpoint)(struct usb_hcd *, struct usb_device *, struct usb_host_endpoint *); + int (*check_bandwidth)(struct usb_hcd *, struct usb_device *); + void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *); + int (*address_device)(struct usb_hcd *, struct usb_device *); + int (*enable_device)(struct usb_hcd *, struct usb_device *); + int (*update_hub_device)(struct usb_hcd *, struct usb_device *, struct usb_tt *, gfp_t); + int (*reset_device)(struct usb_hcd *, struct usb_device *); + int (*update_device)(struct usb_hcd *, struct usb_device *); + int (*set_usb2_hw_lpm)(struct usb_hcd *, struct usb_device *, int); + int (*enable_usb3_lpm_timeout)(struct usb_hcd *, struct usb_device *, enum usb3_link_state); + int (*disable_usb3_lpm_timeout)(struct usb_hcd *, struct usb_device *, enum usb3_link_state); + int (*find_raw_port_number)(struct usb_hcd *, int); + int (*port_power)(struct usb_hcd *, int, bool); +}; + +struct physdev_dbgp_op { + uint8_t op; + uint8_t bus; + union { + struct physdev_pci_device pci; + } u; +}; + +struct pcpu { + struct list_head list; + struct device dev; + uint32_t cpu_id; + uint32_t flags; +}; + +typedef uint8_t xen_domain_handle_t[16]; + +struct xen_compile_info { + char compiler[64]; + char compile_by[16]; + char compile_domain[32]; + char compile_date[32]; +}; + +struct xen_platform_parameters { + xen_ulong_t virt_start; +}; + +struct xen_build_id { + uint32_t len; + unsigned char buf[0]; +}; + +struct hyp_sysfs_attr { + struct attribute attr; + ssize_t (*show)(struct hyp_sysfs_attr *, char *); + ssize_t (*store)(struct hyp_sysfs_attr *, const char *, size_t); + void *hyp_attr_data; +}; + +struct pmu_mode { + const char *name; + uint32_t mode; +}; + +enum xen_swiotlb_err { + XEN_SWIOTLB_UNKNOWN = 0, + XEN_SWIOTLB_ENOMEM = 1, + XEN_SWIOTLB_EFIXUP = 2, +}; + +typedef int *__guest_handle_int; + +typedef xen_ulong_t *__guest_handle_xen_ulong_t; + +struct xen_add_to_physmap_range { + domid_t domid; + uint16_t space; + uint16_t size; + domid_t foreign_domid; + __guest_handle_xen_ulong_t idxs; + __guest_handle_xen_pfn_t gpfns; + __guest_handle_int errs; +}; + +struct xen_remove_from_physmap { + domid_t domid; + xen_pfn_t gpfn; +}; + +typedef void (*xen_gfn_fn_t)(long unsigned int, void *); + +struct xen_remap_gfn_info; + +struct remap_data___2 { + xen_pfn_t *fgfn; + int nr_fgfn; + pgprot_t prot; + domid_t domid; + struct vm_area_struct *vma; + int index; + struct page **pages; + struct xen_remap_gfn_info *info; + int *err_ptr; + int mapped; + int h_errs[1]; + xen_ulong_t h_idxs[1]; + xen_pfn_t h_gpfns[1]; + int h_iter; +}; + +struct map_balloon_pages { + xen_pfn_t *pfns; + unsigned int idx; +}; + +struct remap_pfn { + struct mm_struct *mm; + struct page **pages; + pgprot_t prot; + long unsigned int i; +}; + +struct ww_class { + atomic_long_t stamp; + struct lock_class_key acquire_key; + struct lock_class_key mutex_key; + const char *acquire_name; + const char *mutex_name; + unsigned int is_wait_die; +}; + +struct regulator_state { + int uV; + int min_uV; + int max_uV; + unsigned int mode; + int enabled; + bool changeable; +}; + +struct regulation_constraints { + const char *name; + int min_uV; + int max_uV; + int uV_offset; + int min_uA; + int max_uA; + int ilim_uA; + int system_load; + u32 *max_spread; + int max_uV_step; + unsigned int valid_modes_mask; + unsigned int valid_ops_mask; + int input_uV; + struct regulator_state state_disk; + struct regulator_state state_mem; + struct regulator_state state_standby; + suspend_state_t initial_state; + unsigned int initial_mode; + unsigned int ramp_delay; + unsigned int settling_time; + unsigned int settling_time_up; + unsigned int settling_time_down; + unsigned int enable_time; + unsigned int active_discharge; + unsigned int always_on: 1; + unsigned int boot_on: 1; + unsigned int apply_uV: 1; + unsigned int ramp_disable: 1; + unsigned int soft_start: 1; + unsigned int pull_down: 1; + unsigned int over_current_protection: 1; +}; + +struct regulator_consumer_supply; + +struct regulator_init_data { + const char *supply_regulator; + struct regulation_constraints constraints; + int num_consumer_supplies; + struct regulator_consumer_supply *consumer_supplies; + int (*regulator_init)(void *); + void *driver_data; +}; + +enum regulator_type { + REGULATOR_VOLTAGE = 0, + REGULATOR_CURRENT = 1, +}; + +struct regulator_config; + +struct regulator_ops; + +struct regulator_desc { + const char *name; + const char *supply_name; + const char *of_match; + bool of_match_full_name; + const char *regulators_node; + int (*of_parse_cb)(struct device_node *, const struct regulator_desc *, struct regulator_config *); + int id; + unsigned int continuous_voltage_range: 1; + unsigned int n_voltages; + unsigned int n_current_limits; + const struct regulator_ops *ops; + int irq; + enum regulator_type type; + struct module *owner; + unsigned int min_uV; + unsigned int uV_step; + unsigned int linear_min_sel; + int fixed_uV; + unsigned int ramp_delay; + int min_dropout_uV; + const struct linear_range *linear_ranges; + const unsigned int *linear_range_selectors; + int n_linear_ranges; + const unsigned int *volt_table; + const unsigned int *curr_table; + unsigned int vsel_range_reg; + unsigned int vsel_range_mask; + unsigned int vsel_reg; + unsigned int vsel_mask; + unsigned int vsel_step; + unsigned int csel_reg; + unsigned int csel_mask; + unsigned int apply_reg; + unsigned int apply_bit; + unsigned int enable_reg; + unsigned int enable_mask; + unsigned int enable_val; + unsigned int disable_val; + bool enable_is_inverted; + unsigned int bypass_reg; + unsigned int bypass_mask; + unsigned int bypass_val_on; + unsigned int bypass_val_off; + unsigned int active_discharge_on; + unsigned int active_discharge_off; + unsigned int active_discharge_mask; + unsigned int active_discharge_reg; + unsigned int soft_start_reg; + unsigned int soft_start_mask; + unsigned int soft_start_val_on; + unsigned int pull_down_reg; + unsigned int pull_down_mask; + unsigned int pull_down_val_on; + unsigned int enable_time; + unsigned int off_on_delay; + unsigned int poll_enabled_time; + unsigned int (*of_map_mode)(unsigned int); +}; + +struct pre_voltage_change_data { + long unsigned int old_uV; + long unsigned int min_uV; + long unsigned int max_uV; +}; + +struct regulator_bulk_data { + const char *supply; + struct regulator *consumer; + int ret; +}; + +struct regulator_voltage { + int min_uV; + int max_uV; +}; + +struct regulator_dev; + +struct regulator { + struct device *dev; + struct list_head list; + unsigned int always_on: 1; + unsigned int bypass: 1; + unsigned int device_link: 1; + int uA_load; + unsigned int enable_count; + unsigned int deferred_disables; + struct regulator_voltage voltage[5]; + const char *supply_name; + struct device_attribute dev_attr; + struct regulator_dev *rdev; + struct dentry *debugfs; +}; + +struct regulator_coupler { + struct list_head list; + int (*attach_regulator)(struct regulator_coupler *, struct regulator_dev *); + int (*detach_regulator)(struct regulator_coupler *, struct regulator_dev *); + int (*balance_voltage)(struct regulator_coupler *, struct regulator_dev *, suspend_state_t); +}; + +struct coupling_desc { + struct regulator_dev **coupled_rdevs; + struct regulator_coupler *coupler; + int n_resolved; + int n_coupled; +}; + +struct regulator_enable_gpio; + +struct regulator_dev { + const struct regulator_desc *desc; + int exclusive; + u32 use_count; + u32 open_count; + u32 bypass_count; + struct list_head list; + struct list_head consumer_list; + struct coupling_desc coupling_desc; + struct blocking_notifier_head notifier; + struct ww_mutex mutex; + struct task_struct *mutex_owner; + int ref_cnt; + struct module *owner; + struct device dev; + struct regulation_constraints *constraints; + struct regulator *supply; + const char *supply_name; + struct regmap *regmap; + struct delayed_work disable_work; + void *reg_data; + struct dentry *debugfs; + struct regulator_enable_gpio *ena_pin; + unsigned int ena_gpio_state: 1; + unsigned int is_switch: 1; + long unsigned int last_off_jiffy; +}; + +enum regulator_status { + REGULATOR_STATUS_OFF = 0, + REGULATOR_STATUS_ON = 1, + REGULATOR_STATUS_ERROR = 2, + REGULATOR_STATUS_FAST = 3, + REGULATOR_STATUS_NORMAL = 4, + REGULATOR_STATUS_IDLE = 5, + REGULATOR_STATUS_STANDBY = 6, + REGULATOR_STATUS_BYPASS = 7, + REGULATOR_STATUS_UNDEFINED = 8, +}; + +struct regulator_ops { + int (*list_voltage)(struct regulator_dev *, unsigned int); + int (*set_voltage)(struct regulator_dev *, int, int, unsigned int *); + int (*map_voltage)(struct regulator_dev *, int, int); + int (*set_voltage_sel)(struct regulator_dev *, unsigned int); + int (*get_voltage)(struct regulator_dev *); + int (*get_voltage_sel)(struct regulator_dev *); + int (*set_current_limit)(struct regulator_dev *, int, int); + int (*get_current_limit)(struct regulator_dev *); + int (*set_input_current_limit)(struct regulator_dev *, int); + int (*set_over_current_protection)(struct regulator_dev *); + int (*set_active_discharge)(struct regulator_dev *, bool); + int (*enable)(struct regulator_dev *); + int (*disable)(struct regulator_dev *); + int (*is_enabled)(struct regulator_dev *); + int (*set_mode)(struct regulator_dev *, unsigned int); + unsigned int (*get_mode)(struct regulator_dev *); + int (*get_error_flags)(struct regulator_dev *, unsigned int *); + int (*enable_time)(struct regulator_dev *); + int (*set_ramp_delay)(struct regulator_dev *, int); + int (*set_voltage_time)(struct regulator_dev *, int, int); + int (*set_voltage_time_sel)(struct regulator_dev *, unsigned int, unsigned int); + int (*set_soft_start)(struct regulator_dev *); + int (*get_status)(struct regulator_dev *); + unsigned int (*get_optimum_mode)(struct regulator_dev *, int, int, int); + int (*set_load)(struct regulator_dev *, int); + int (*set_bypass)(struct regulator_dev *, bool); + int (*get_bypass)(struct regulator_dev *, bool *); + int (*set_suspend_voltage)(struct regulator_dev *, int); + int (*set_suspend_enable)(struct regulator_dev *); + int (*set_suspend_disable)(struct regulator_dev *); + int (*set_suspend_mode)(struct regulator_dev *, unsigned int); + int (*resume)(struct regulator_dev *); + int (*set_pull_down)(struct regulator_dev *); +}; + +struct regulator_config { + struct device *dev; + const struct regulator_init_data *init_data; + void *driver_data; + struct device_node *of_node; + struct regmap *regmap; + struct gpio_desc___2 *ena_gpiod; +}; + +struct regulator_enable_gpio { + struct list_head list; + struct gpio_desc___2 *gpiod; + u32 enable_count; + u32 request_count; +}; + +enum regulator_active_discharge { + REGULATOR_ACTIVE_DISCHARGE_DEFAULT = 0, + REGULATOR_ACTIVE_DISCHARGE_DISABLE = 1, + REGULATOR_ACTIVE_DISCHARGE_ENABLE = 2, +}; + +struct regulator_consumer_supply { + const char *dev_name; + const char *supply; +}; + +struct trace_event_raw_regulator_basic { + struct trace_entry ent; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_regulator_range { + struct trace_entry ent; + u32 __data_loc_name; + int min; + int max; + char __data[0]; +}; + +struct trace_event_raw_regulator_value { + struct trace_entry ent; + u32 __data_loc_name; + unsigned int val; + char __data[0]; +}; + +struct trace_event_data_offsets_regulator_basic { + u32 name; +}; + +struct trace_event_data_offsets_regulator_range { + u32 name; +}; + +struct trace_event_data_offsets_regulator_value { + u32 name; +}; + +typedef void (*btf_trace_regulator_enable)(void *, const char *); + +typedef void (*btf_trace_regulator_enable_delay)(void *, const char *); + +typedef void (*btf_trace_regulator_enable_complete)(void *, const char *); + +typedef void (*btf_trace_regulator_disable)(void *, const char *); + +typedef void (*btf_trace_regulator_disable_complete)(void *, const char *); + +typedef void (*btf_trace_regulator_bypass_enable)(void *, const char *); + +typedef void (*btf_trace_regulator_bypass_enable_complete)(void *, const char *); + +typedef void (*btf_trace_regulator_bypass_disable)(void *, const char *); + +typedef void (*btf_trace_regulator_bypass_disable_complete)(void *, const char *); + +typedef void (*btf_trace_regulator_set_voltage)(void *, const char *, int, int); + +typedef void (*btf_trace_regulator_set_voltage_complete)(void *, const char *, unsigned int); + +enum regulator_get_type { + NORMAL_GET = 0, + EXCLUSIVE_GET = 1, + OPTIONAL_GET = 2, + MAX_GET_TYPE = 3, +}; + +struct regulator_map { + struct list_head list; + const char *dev_name; + const char *supply; + struct regulator_dev *regulator; +}; + +struct regulator_supply_alias { + struct list_head list; + struct device *src_dev; + const char *src_supply; + struct device *alias_dev; + const char *alias_supply; +}; + +struct summary_data { + struct seq_file *s; + struct regulator_dev *parent; + int level; +}; + +struct summary_lock_data { + struct ww_acquire_ctx *ww_ctx; + struct regulator_dev **new_contended_rdev; + struct regulator_dev **old_contended_rdev; +}; + +struct fixed_voltage_config { + const char *supply_name; + const char *input_supply; + int microvolts; + unsigned int startup_delay; + unsigned int off_on_delay; + unsigned int enabled_at_boot: 1; + struct regulator_init_data *init_data; +}; + +struct fixed_regulator_data { + struct fixed_voltage_config cfg; + struct regulator_init_data init_data; + struct platform_device pdev; +}; + +struct regulator_bulk_devres { + struct regulator_bulk_data *consumers; + int num_consumers; +}; + +struct regulator_supply_alias_match { + struct device *dev; + const char *id; +}; + +struct regulator_notifier_match { + struct regulator *regulator; + struct notifier_block *nb; +}; + +struct reset_controller_dev; + +struct reset_control_ops { + int (*reset)(struct reset_controller_dev *, long unsigned int); + int (*assert)(struct reset_controller_dev *, long unsigned int); + int (*deassert)(struct reset_controller_dev *, long unsigned int); + int (*status)(struct reset_controller_dev *, long unsigned int); +}; + +struct reset_controller_dev { + const struct reset_control_ops *ops; + struct module *owner; + struct list_head list; + struct list_head reset_control_head; + struct device *dev; + struct device_node *of_node; + int of_reset_n_cells; + int (*of_xlate)(struct reset_controller_dev *, const struct of_phandle_args *); + unsigned int nr_resets; +}; + +struct reset_control_lookup { + struct list_head list; + const char *provider; + unsigned int index; + const char *dev_id; + const char *con_id; +}; + +struct reset_control { + struct reset_controller_dev *rcdev; + struct list_head list; + unsigned int id; + struct kref refcnt; + bool acquired; + bool shared; + bool array; + atomic_t deassert_count; + atomic_t triggered_count; +}; + +struct reset_control_array { + struct reset_control base; + unsigned int num_rstcs; + struct reset_control *rstc[0]; +}; + +struct serial_struct32 { + compat_int_t type; + compat_int_t line; + compat_uint_t port; + compat_int_t irq; + compat_int_t flags; + compat_int_t xmit_fifo_size; + compat_int_t custom_divisor; + compat_int_t baud_base; + short unsigned int close_delay; + char io_type; + char reserved_char; + compat_int_t hub6; + short unsigned int closing_wait; + short unsigned int closing_wait2; + compat_uint_t iomem_base; + short unsigned int iomem_reg_shift; + unsigned int port_high; + compat_int_t reserved; +}; + +struct n_tty_data { + size_t read_head; + size_t commit_head; + size_t canon_head; + size_t echo_head; + size_t echo_commit; + size_t echo_mark; + long unsigned int char_map[4]; + long unsigned int overrun_time; + int num_overrun; + bool no_room; + unsigned char lnext: 1; + unsigned char erasing: 1; + unsigned char raw: 1; + unsigned char real_raw: 1; + unsigned char icanon: 1; + unsigned char push: 1; + char read_buf[4096]; + long unsigned int read_flags[64]; + unsigned char echo_buf[4096]; + size_t read_tail; + size_t line_start; + unsigned int column; + unsigned int canon_column; + size_t echo_tail; + struct mutex atomic_read_lock; + struct mutex output_lock; +}; + +enum { + ERASE = 0, + WERASE = 1, + KILL = 2, +}; + +struct termios { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + cc_t c_line; + cc_t c_cc[19]; +}; + +struct termios2 { + tcflag_t c_iflag; + tcflag_t c_oflag; + tcflag_t c_cflag; + tcflag_t c_lflag; + cc_t c_line; + cc_t c_cc[19]; + speed_t c_ispeed; + speed_t c_ospeed; +}; + +struct termio { + short unsigned int c_iflag; + short unsigned int c_oflag; + short unsigned int c_cflag; + short unsigned int c_lflag; + unsigned char c_line; + unsigned char c_cc[8]; +}; + +struct ldsem_waiter { + struct list_head list; + struct task_struct *task; +}; + +struct pts_fs_info___2; + +struct tty_audit_buf { + struct mutex mutex; + dev_t dev; + unsigned int icanon: 1; + size_t valid; + unsigned char *data; +}; + +struct sysrq_state { + struct input_handle handle; + struct work_struct reinject_work; + long unsigned int key_down[12]; + unsigned int alt; + unsigned int alt_use; + unsigned int shift; + unsigned int shift_use; + bool active; + bool need_reinject; + bool reinjecting; + bool reset_canceled; + bool reset_requested; + long unsigned int reset_keybit[12]; + int reset_seq_len; + int reset_seq_cnt; + int reset_seq_version; + struct timer_list keyreset_timer; +}; + +struct consolefontdesc { + short unsigned int charcount; + short unsigned int charheight; + char *chardata; +}; + +struct unipair { + short unsigned int unicode; + short unsigned int fontpos; +}; + +struct unimapdesc { + short unsigned int entry_ct; + struct unipair *entries; +}; + +struct kbentry { + unsigned char kb_table; + unsigned char kb_index; + short unsigned int kb_value; +}; + +struct kbsentry { + unsigned char kb_func; + unsigned char kb_string[512]; +}; + +struct kbkeycode { + unsigned int scancode; + unsigned int keycode; +}; + +struct kbd_repeat { + int delay; + int period; +}; + +struct console_font_op { + unsigned int op; + unsigned int flags; + unsigned int width; + unsigned int height; + unsigned int charcount; + unsigned char *data; +}; + +struct vt_stat { + short unsigned int v_active; + short unsigned int v_signal; + short unsigned int v_state; +}; + +struct vt_sizes { + short unsigned int v_rows; + short unsigned int v_cols; + short unsigned int v_scrollsize; +}; + +struct vt_consize { + short unsigned int v_rows; + short unsigned int v_cols; + short unsigned int v_vlin; + short unsigned int v_clin; + short unsigned int v_vcol; + short unsigned int v_ccol; +}; + +struct vt_event { + unsigned int event; + unsigned int oldev; + unsigned int newev; + unsigned int pad[4]; +}; + +struct vt_setactivate { + unsigned int console; + struct vt_mode mode; +}; + +struct vt_spawn_console { + spinlock_t lock; + struct pid *pid; + int sig; +}; + +struct vt_event_wait { + struct list_head list; + struct vt_event event; + int done; +}; + +struct compat_consolefontdesc { + short unsigned int charcount; + short unsigned int charheight; + compat_caddr_t chardata; +}; + +struct compat_console_font_op { + compat_uint_t op; + compat_uint_t flags; + compat_uint_t width; + compat_uint_t height; + compat_uint_t charcount; + compat_caddr_t data; +}; + +struct compat_unimapdesc { + short unsigned int entry_ct; + compat_caddr_t entries; +}; + +struct vt_notifier_param { + struct vc_data *vc; + unsigned int c; +}; + +struct vcs_poll_data { + struct notifier_block notifier; + unsigned int cons_num; + int event; + wait_queue_head_t waitq; + struct fasync_struct *fasync; +}; + +struct tiocl_selection { + short unsigned int xs; + short unsigned int ys; + short unsigned int xe; + short unsigned int ye; + short unsigned int sel_mode; +}; + +struct vc_selection { + struct mutex lock; + struct vc_data *cons; + char *buffer; + unsigned int buf_len; + volatile int start; + int end; +}; + +struct kbdiacr { + unsigned char diacr; + unsigned char base; + unsigned char result; +}; + +struct kbdiacrs { + unsigned int kb_cnt; + struct kbdiacr kbdiacr[256]; +}; + +struct kbdiacruc { + unsigned int diacr; + unsigned int base; + unsigned int result; +}; + +struct kbdiacrsuc { + unsigned int kb_cnt; + struct kbdiacruc kbdiacruc[256]; +}; + +struct keyboard_notifier_param { + struct vc_data *vc; + int down; + int shift; + int ledstate; + unsigned int value; +}; + +struct kbd_struct { + unsigned char lockstate; + unsigned char slockstate; + unsigned char ledmode: 1; + unsigned char ledflagstate: 4; + char: 3; + unsigned char default_ledflagstate: 4; + unsigned char kbdmode: 3; + char: 1; + unsigned char modeflags: 5; +}; + +typedef void k_handler_fn(struct vc_data *, unsigned char, char); + +typedef void fn_handler_fn(struct vc_data *); + +struct getset_keycode_data { + struct input_keymap_entry ke; + int error; +}; + +struct kbd_led_trigger { + struct led_trigger trigger; + unsigned int mask; +}; + +struct uni_pagedir { + u16 **uni_pgdir[32]; + long unsigned int refcount; + long unsigned int sum; + unsigned char *inverse_translations[4]; + u16 *inverse_trans_unicode; +}; + +typedef uint32_t char32_t; + +struct uni_screen { + char32_t *lines[0]; +}; + +struct con_driver { + const struct consw *con; + const char *desc; + struct device *dev; + int node; + int first; + int last; + int flag; +}; + +enum { + blank_off = 0, + blank_normal_wait = 1, + blank_vesa_wait = 2, +}; + +enum { + EPecma = 0, + EPdec = 1, + EPeq = 2, + EPgt = 3, + EPlt = 4, +}; + +struct rgb { + u8 r; + u8 g; + u8 b; +}; + +enum { + ESnormal = 0, + ESesc = 1, + ESsquare = 2, + ESgetpars = 3, + ESfunckey = 4, + EShash = 5, + ESsetG0 = 6, + ESsetG1 = 7, + ESpercent = 8, + EScsiignore = 9, + ESnonstd = 10, + ESpalette = 11, + ESosc = 12, +}; + +struct interval { + uint32_t first; + uint32_t last; +}; + +struct vc_draw_region { + long unsigned int from; + long unsigned int to; + int x; +}; + +struct hv_ops; + +struct hvc_struct { + struct tty_port port; + spinlock_t lock; + int index; + int do_wakeup; + char *outbuf; + int outbuf_size; + int n_outbuf; + uint32_t vtermno; + const struct hv_ops *ops; + int irq_requested; + int data; + struct winsize ws; + struct work_struct tty_resize; + struct list_head next; + long unsigned int flags; +}; + +struct hv_ops { + int (*get_chars)(uint32_t, char *, int); + int (*put_chars)(uint32_t, const char *, int); + int (*flush)(uint32_t, bool); + int (*notifier_add)(struct hvc_struct *, int); + void (*notifier_del)(struct hvc_struct *, int); + void (*notifier_hangup)(struct hvc_struct *, int); + int (*tiocmget)(struct hvc_struct *); + int (*tiocmset)(struct hvc_struct *, unsigned int, unsigned int); + void (*dtr_rts)(struct hvc_struct *, int); +}; + +struct circ_buf { + char *buf; + int head; + int tail; +}; + +struct serial_rs485 { + __u32 flags; + __u32 delay_rts_before_send; + __u32 delay_rts_after_send; + __u32 padding[5]; +}; + +struct serial_iso7816 { + __u32 flags; + __u32 tg; + __u32 sc_fi; + __u32 sc_di; + __u32 clk; + __u32 reserved[5]; +}; + +struct uart_port; + +struct uart_ops { + unsigned int (*tx_empty)(struct uart_port *); + void (*set_mctrl)(struct uart_port *, unsigned int); + unsigned int (*get_mctrl)(struct uart_port *); + void (*stop_tx)(struct uart_port *); + void (*start_tx)(struct uart_port *); + void (*throttle)(struct uart_port *); + void (*unthrottle)(struct uart_port *); + void (*send_xchar)(struct uart_port *, char); + void (*stop_rx)(struct uart_port *); + void (*enable_ms)(struct uart_port *); + void (*break_ctl)(struct uart_port *, int); + int (*startup)(struct uart_port *); + void (*shutdown)(struct uart_port *); + void (*flush_buffer)(struct uart_port *); + void (*set_termios)(struct uart_port *, struct ktermios *, struct ktermios *); + void (*set_ldisc)(struct uart_port *, struct ktermios *); + void (*pm)(struct uart_port *, unsigned int, unsigned int); + const char * (*type)(struct uart_port *); + void (*release_port)(struct uart_port *); + int (*request_port)(struct uart_port *); + void (*config_port)(struct uart_port *, int); + int (*verify_port)(struct uart_port *, struct serial_struct *); + int (*ioctl)(struct uart_port *, unsigned int, long unsigned int); + int (*poll_init)(struct uart_port *); + void (*poll_put_char)(struct uart_port *, unsigned char); + int (*poll_get_char)(struct uart_port *); +}; + +struct uart_icount { + __u32 cts; + __u32 dsr; + __u32 rng; + __u32 dcd; + __u32 rx; + __u32 tx; + __u32 frame; + __u32 overrun; + __u32 parity; + __u32 brk; + __u32 buf_overrun; +}; + +typedef unsigned int upf_t; + +typedef unsigned int upstat_t; + +struct uart_state; + +struct uart_port { + spinlock_t lock; + long unsigned int iobase; + unsigned char *membase; + unsigned int (*serial_in)(struct uart_port *, int); + void (*serial_out)(struct uart_port *, int, int); + void (*set_termios)(struct uart_port *, struct ktermios *, struct ktermios *); + void (*set_ldisc)(struct uart_port *, struct ktermios *); + unsigned int (*get_mctrl)(struct uart_port *); + void (*set_mctrl)(struct uart_port *, unsigned int); + unsigned int (*get_divisor)(struct uart_port *, unsigned int, unsigned int *); + void (*set_divisor)(struct uart_port *, unsigned int, unsigned int, unsigned int); + int (*startup)(struct uart_port *); + void (*shutdown)(struct uart_port *); + void (*throttle)(struct uart_port *); + void (*unthrottle)(struct uart_port *); + int (*handle_irq)(struct uart_port *); + void (*pm)(struct uart_port *, unsigned int, unsigned int); + void (*handle_break)(struct uart_port *); + int (*rs485_config)(struct uart_port *, struct serial_rs485 *); + int (*iso7816_config)(struct uart_port *, struct serial_iso7816 *); + unsigned int irq; + long unsigned int irqflags; + unsigned int uartclk; + unsigned int fifosize; + unsigned char x_char; + unsigned char regshift; + unsigned char iotype; + unsigned char quirks; + unsigned int read_status_mask; + unsigned int ignore_status_mask; + struct uart_state *state; + struct uart_icount icount; + struct console *cons; + upf_t flags; + upstat_t status; + int hw_stopped; + unsigned int mctrl; + unsigned int timeout; + unsigned int type; + const struct uart_ops *ops; + unsigned int custom_divisor; + unsigned int line; + unsigned int minor; + resource_size_t mapbase; + resource_size_t mapsize; + struct device *dev; + long unsigned int sysrq; + unsigned int sysrq_ch; + unsigned char has_sysrq; + unsigned char sysrq_seq; + unsigned char hub6; + unsigned char suspended; + unsigned char console_reinit; + const char *name; + struct attribute_group *attr_group; + const struct attribute_group **tty_groups; + struct serial_rs485 rs485; + struct gpio_desc___2 *rs485_term_gpio; + struct serial_iso7816 iso7816; + void *private_data; +}; + +enum uart_pm_state { + UART_PM_STATE_ON = 0, + UART_PM_STATE_OFF = 3, + UART_PM_STATE_UNDEFINED = 4, +}; + +struct uart_state { + struct tty_port port; + enum uart_pm_state pm_state; + struct circ_buf xmit; + atomic_t refcount; + wait_queue_head_t remove_wait; + struct uart_port *uart_port; +}; + +struct earlycon_device { + struct console *con; + struct uart_port port; + char options[16]; + unsigned int baud; +}; + +struct earlycon_id { + char name[15]; + char name_term; + char compatible[128]; + int (*setup)(struct earlycon_device *, const char *); +}; + +typedef uint32_t XENCONS_RING_IDX; + +struct xencons_interface { + char in[1024]; + char out[2048]; + XENCONS_RING_IDX in_cons; + XENCONS_RING_IDX in_prod; + XENCONS_RING_IDX out_cons; + XENCONS_RING_IDX out_prod; +}; + +struct xencons_info { + struct list_head list; + struct xenbus_device *xbdev; + struct xencons_interface *intf; + unsigned int evtchn; + struct hvc_struct *hvc; + int irq; + int vtermno; + grant_ref_t gntref; +}; + +struct uart_driver { + struct module *owner; + const char *driver_name; + const char *dev_name; + int major; + int minor; + int nr; + struct console *cons; + struct uart_state *state; + struct tty_driver *tty_driver; +}; + +struct uart_match { + struct uart_port *port; + struct uart_driver *driver; +}; + +enum hwparam_type { + hwparam_ioport = 0, + hwparam_iomem = 1, + hwparam_ioport_or_iomem = 2, + hwparam_irq = 3, + hwparam_dma = 4, + hwparam_dma_addr = 5, + hwparam_other = 6, +}; + +struct plat_serial8250_port { + long unsigned int iobase; + void *membase; + resource_size_t mapbase; + unsigned int irq; + long unsigned int irqflags; + unsigned int uartclk; + void *private_data; + unsigned char regshift; + unsigned char iotype; + unsigned char hub6; + unsigned char has_sysrq; + upf_t flags; + unsigned int type; + unsigned int (*serial_in)(struct uart_port *, int); + void (*serial_out)(struct uart_port *, int, int); + void (*set_termios)(struct uart_port *, struct ktermios *, struct ktermios *); + void (*set_ldisc)(struct uart_port *, struct ktermios *); + unsigned int (*get_mctrl)(struct uart_port *); + int (*handle_irq)(struct uart_port *); + void (*pm)(struct uart_port *, unsigned int, unsigned int); + void (*handle_break)(struct uart_port *); +}; + +enum { + PLAT8250_DEV_LEGACY = 4294967295, + PLAT8250_DEV_PLATFORM = 0, + PLAT8250_DEV_PLATFORM1 = 1, + PLAT8250_DEV_PLATFORM2 = 2, + PLAT8250_DEV_FOURPORT = 3, + PLAT8250_DEV_ACCENT = 4, + PLAT8250_DEV_BOCA = 5, + PLAT8250_DEV_EXAR_ST16C554 = 6, + PLAT8250_DEV_HUB6 = 7, + PLAT8250_DEV_AU1X00 = 8, + PLAT8250_DEV_SM501 = 9, +}; + +struct uart_8250_port; + +struct uart_8250_ops { + int (*setup_irq)(struct uart_8250_port *); + void (*release_irq)(struct uart_8250_port *); +}; + +struct mctrl_gpios; + +struct uart_8250_dma; + +struct uart_8250_em485; + +struct uart_8250_port { + struct uart_port port; + struct timer_list timer; + struct list_head list; + u32 capabilities; + short unsigned int bugs; + bool fifo_bug; + unsigned int tx_loadsz; + unsigned char acr; + unsigned char fcr; + unsigned char ier; + unsigned char lcr; + unsigned char mcr; + unsigned char mcr_mask; + unsigned char mcr_force; + unsigned char cur_iotype; + unsigned int rpm_tx_active; + unsigned char canary; + unsigned char probe; + struct mctrl_gpios *gpios; + unsigned char lsr_saved_flags; + unsigned char msr_saved_flags; + struct uart_8250_dma *dma; + const struct uart_8250_ops *ops; + int (*dl_read)(struct uart_8250_port *); + void (*dl_write)(struct uart_8250_port *, int); + struct uart_8250_em485 *em485; + void (*rs485_start_tx)(struct uart_8250_port *); + void (*rs485_stop_tx)(struct uart_8250_port *); + struct delayed_work overrun_backoff; + u32 overrun_backoff_time_ms; +}; + +struct uart_8250_em485 { + struct hrtimer start_tx_timer; + struct hrtimer stop_tx_timer; + struct hrtimer *active_timer; + struct uart_8250_port *port; + unsigned int tx_stopped: 1; +}; + +struct uart_8250_dma { + int (*tx_dma)(struct uart_8250_port *); + int (*rx_dma)(struct uart_8250_port *); + dma_filter_fn fn; + void *rx_param; + void *tx_param; + struct dma_slave_config rxconf; + struct dma_slave_config txconf; + struct dma_chan___2 *rxchan; + struct dma_chan___2 *txchan; + phys_addr_t rx_dma_addr; + phys_addr_t tx_dma_addr; + dma_addr_t rx_addr; + dma_addr_t tx_addr; + dma_cookie_t rx_cookie; + dma_cookie_t tx_cookie; + void *rx_buf; + size_t rx_size; + size_t tx_size; + unsigned char tx_running; + unsigned char tx_err; + unsigned char rx_running; +}; + +struct old_serial_port { + unsigned int uart; + unsigned int baud_base; + unsigned int port; + unsigned int irq; + upf_t flags; + unsigned char io_type; + unsigned char *iomem_base; + short unsigned int iomem_reg_shift; +}; + +struct irq_info___2 { + struct hlist_node node; + int irq; + spinlock_t lock; + struct list_head *head; +}; + +struct serial8250_config { + const char *name; + short unsigned int fifo_size; + short unsigned int tx_loadsz; + unsigned char fcr; + unsigned char rxtrig_bytes[4]; + unsigned int flags; +}; + +struct dw8250_port_data { + int line; + struct uart_8250_dma dma; + u8 dlf_size; +}; + +struct pciserial_board { + unsigned int flags; + unsigned int num_ports; + unsigned int base_baud; + unsigned int uart_offset; + unsigned int reg_shift; + unsigned int first_offset; +}; + +struct serial_private; + +struct pci_serial_quirk { + u32 vendor; + u32 device; + u32 subvendor; + u32 subdevice; + int (*probe)(struct pci_dev *); + int (*init)(struct pci_dev *); + int (*setup)(struct serial_private *, const struct pciserial_board *, struct uart_8250_port *, int); + void (*exit)(struct pci_dev *); +}; + +struct serial_private { + struct pci_dev *dev; + unsigned int nr; + struct pci_serial_quirk *quirk; + const struct pciserial_board *board; + int line[0]; +}; + +struct f815xxa_data { + spinlock_t lock; + int idx; +}; + +struct timedia_struct { + int num; + const short unsigned int *ids; +}; + +struct quatech_feature { + u16 devid; + bool amcc; +}; + +enum pci_board_num_t { + pbn_default = 0, + pbn_b0_1_115200 = 1, + pbn_b0_2_115200 = 2, + pbn_b0_4_115200 = 3, + pbn_b0_5_115200 = 4, + pbn_b0_8_115200 = 5, + pbn_b0_1_921600 = 6, + pbn_b0_2_921600 = 7, + pbn_b0_4_921600 = 8, + pbn_b0_2_1130000 = 9, + pbn_b0_4_1152000 = 10, + pbn_b0_4_1250000 = 11, + pbn_b0_2_1843200 = 12, + pbn_b0_4_1843200 = 13, + pbn_b0_1_4000000 = 14, + pbn_b0_bt_1_115200 = 15, + pbn_b0_bt_2_115200 = 16, + pbn_b0_bt_4_115200 = 17, + pbn_b0_bt_8_115200 = 18, + pbn_b0_bt_1_460800 = 19, + pbn_b0_bt_2_460800 = 20, + pbn_b0_bt_4_460800 = 21, + pbn_b0_bt_1_921600 = 22, + pbn_b0_bt_2_921600 = 23, + pbn_b0_bt_4_921600 = 24, + pbn_b0_bt_8_921600 = 25, + pbn_b1_1_115200 = 26, + pbn_b1_2_115200 = 27, + pbn_b1_4_115200 = 28, + pbn_b1_8_115200 = 29, + pbn_b1_16_115200 = 30, + pbn_b1_1_921600 = 31, + pbn_b1_2_921600 = 32, + pbn_b1_4_921600 = 33, + pbn_b1_8_921600 = 34, + pbn_b1_2_1250000 = 35, + pbn_b1_bt_1_115200 = 36, + pbn_b1_bt_2_115200 = 37, + pbn_b1_bt_4_115200 = 38, + pbn_b1_bt_2_921600 = 39, + pbn_b1_1_1382400 = 40, + pbn_b1_2_1382400 = 41, + pbn_b1_4_1382400 = 42, + pbn_b1_8_1382400 = 43, + pbn_b2_1_115200 = 44, + pbn_b2_2_115200 = 45, + pbn_b2_4_115200 = 46, + pbn_b2_8_115200 = 47, + pbn_b2_1_460800 = 48, + pbn_b2_4_460800 = 49, + pbn_b2_8_460800 = 50, + pbn_b2_16_460800 = 51, + pbn_b2_1_921600 = 52, + pbn_b2_4_921600 = 53, + pbn_b2_8_921600 = 54, + pbn_b2_8_1152000 = 55, + pbn_b2_bt_1_115200 = 56, + pbn_b2_bt_2_115200 = 57, + pbn_b2_bt_4_115200 = 58, + pbn_b2_bt_2_921600 = 59, + pbn_b2_bt_4_921600 = 60, + pbn_b3_2_115200 = 61, + pbn_b3_4_115200 = 62, + pbn_b3_8_115200 = 63, + pbn_b4_bt_2_921600 = 64, + pbn_b4_bt_4_921600 = 65, + pbn_b4_bt_8_921600 = 66, + pbn_panacom = 67, + pbn_panacom2 = 68, + pbn_panacom4 = 69, + pbn_plx_romulus = 70, + pbn_endrun_2_4000000 = 71, + pbn_oxsemi = 72, + pbn_oxsemi_1_4000000 = 73, + pbn_oxsemi_2_4000000 = 74, + pbn_oxsemi_4_4000000 = 75, + pbn_oxsemi_8_4000000 = 76, + pbn_intel_i960 = 77, + pbn_sgi_ioc3 = 78, + pbn_computone_4 = 79, + pbn_computone_6 = 80, + pbn_computone_8 = 81, + pbn_sbsxrsio = 82, + pbn_pasemi_1682M = 83, + pbn_ni8430_2 = 84, + pbn_ni8430_4 = 85, + pbn_ni8430_8 = 86, + pbn_ni8430_16 = 87, + pbn_ADDIDATA_PCIe_1_3906250 = 88, + pbn_ADDIDATA_PCIe_2_3906250 = 89, + pbn_ADDIDATA_PCIe_4_3906250 = 90, + pbn_ADDIDATA_PCIe_8_3906250 = 91, + pbn_ce4100_1_115200 = 92, + pbn_omegapci = 93, + pbn_NETMOS9900_2s_115200 = 94, + pbn_brcm_trumanage = 95, + pbn_fintek_4 = 96, + pbn_fintek_8 = 97, + pbn_fintek_12 = 98, + pbn_fintek_F81504A = 99, + pbn_fintek_F81508A = 100, + pbn_fintek_F81512A = 101, + pbn_wch382_2 = 102, + pbn_wch384_4 = 103, + pbn_wch384_8 = 104, + pbn_pericom_PI7C9X7951 = 105, + pbn_pericom_PI7C9X7952 = 106, + pbn_pericom_PI7C9X7954 = 107, + pbn_pericom_PI7C9X7958 = 108, + pbn_sunix_pci_1s = 109, + pbn_sunix_pci_2s = 110, + pbn_sunix_pci_4s = 111, + pbn_sunix_pci_8s = 112, + pbn_sunix_pci_16s = 113, + pbn_moxa8250_2p = 114, + pbn_moxa8250_4p = 115, + pbn_moxa8250_8p = 116, +}; + +struct reset_control___2; + +struct dw8250_data { + struct dw8250_port_data data; + u8 usr_reg; + int msr_mask_on; + int msr_mask_off; + struct clk *clk; + struct clk *pclk; + struct notifier_block clk_notifier; + struct work_struct clk_work; + struct reset_control___2 *rst; + unsigned int skip_autocfg: 1; + unsigned int uart_16550_compatible: 1; +}; + +struct hsu_dma_slave { + struct device *dma_dev; + int chan_id; +}; + +struct mid8250; + +struct mid8250_board { + unsigned int flags; + long unsigned int freq; + unsigned int base_baud; + int (*setup)(struct mid8250 *, struct uart_port *); + void (*exit)(struct mid8250 *); +}; + +struct mid8250 { + int line; + int dma_index; + struct pci_dev *dma_dev; + struct uart_8250_dma dma; + struct mid8250_board *board; + struct hsu_dma_chip dma_chip; +}; + +struct gpio_array___2; + +enum mctrl_gpio_idx { + UART_GPIO_CTS = 0, + UART_GPIO_DSR = 1, + UART_GPIO_DCD = 2, + UART_GPIO_RNG = 3, + UART_GPIO_RI = 3, + UART_GPIO_RTS = 4, + UART_GPIO_DTR = 5, + UART_GPIO_MAX = 6, +}; + +struct mctrl_gpios___2 { + struct uart_port *port; + struct gpio_desc___2 *gpio[6]; + int irq[6]; + unsigned int mctrl_prev; + bool mctrl_on; +}; + +struct serdev_device; + +struct serdev_device_ops { + int (*receive_buf)(struct serdev_device *, const unsigned char *, size_t); + void (*write_wakeup)(struct serdev_device *); +}; + +struct serdev_controller; + +struct serdev_device { + struct device dev; + int nr; + struct serdev_controller *ctrl; + const struct serdev_device_ops *ops; + struct completion write_comp; + struct mutex write_lock; +}; + +struct serdev_controller_ops; + +struct serdev_controller { + struct device dev; + unsigned int nr; + struct serdev_device *serdev; + const struct serdev_controller_ops *ops; +}; + +struct serdev_device_driver { + struct device_driver driver; + int (*probe)(struct serdev_device *); + void (*remove)(struct serdev_device *); +}; + +enum serdev_parity { + SERDEV_PARITY_NONE = 0, + SERDEV_PARITY_EVEN = 1, + SERDEV_PARITY_ODD = 2, +}; + +struct serdev_controller_ops { + int (*write_buf)(struct serdev_controller *, const unsigned char *, size_t); + void (*write_flush)(struct serdev_controller *); + int (*write_room)(struct serdev_controller *); + int (*open)(struct serdev_controller *); + void (*close)(struct serdev_controller *); + void (*set_flow_control)(struct serdev_controller *, bool); + int (*set_parity)(struct serdev_controller *, enum serdev_parity); + unsigned int (*set_baudrate)(struct serdev_controller *, unsigned int); + void (*wait_until_sent)(struct serdev_controller *, long int); + int (*get_tiocm)(struct serdev_controller *); + int (*set_tiocm)(struct serdev_controller *, unsigned int, unsigned int); +}; + +struct acpi_serdev_lookup { + acpi_handle device_handle; + acpi_handle controller_handle; + int n; + int index; +}; + +struct serport { + struct tty_port *port; + struct tty_struct *tty; + struct tty_driver *tty_drv; + int tty_idx; + long unsigned int flags; +}; + +struct memdev { + const char *name; + umode_t mode; + const struct file_operations *fops; + fmode_t fmode; +}; + +struct timer_rand_state { + cycles_t last_time; + long int last_delta; + long int last_delta2; +}; + +struct trace_event_raw_add_device_randomness { + struct trace_entry ent; + int bytes; + long unsigned int IP; + char __data[0]; +}; + +struct trace_event_raw_random__mix_pool_bytes { + struct trace_entry ent; + const char *pool_name; + int bytes; + long unsigned int IP; + char __data[0]; +}; + +struct trace_event_raw_credit_entropy_bits { + struct trace_entry ent; + const char *pool_name; + int bits; + int entropy_count; + long unsigned int IP; + char __data[0]; +}; + +struct trace_event_raw_push_to_pool { + struct trace_entry ent; + const char *pool_name; + int pool_bits; + int input_bits; + char __data[0]; +}; + +struct trace_event_raw_debit_entropy { + struct trace_entry ent; + const char *pool_name; + int debit_bits; + char __data[0]; +}; + +struct trace_event_raw_add_input_randomness { + struct trace_entry ent; + int input_bits; + char __data[0]; +}; + +struct trace_event_raw_add_disk_randomness { + struct trace_entry ent; + dev_t dev; + int input_bits; + char __data[0]; +}; + +struct trace_event_raw_xfer_secondary_pool { + struct trace_entry ent; + const char *pool_name; + int xfer_bits; + int request_bits; + int pool_entropy; + int input_entropy; + char __data[0]; +}; + +struct trace_event_raw_random__get_random_bytes { + struct trace_entry ent; + int nbytes; + long unsigned int IP; + char __data[0]; +}; + +struct trace_event_raw_random__extract_entropy { + struct trace_entry ent; + const char *pool_name; + int nbytes; + int entropy_count; + long unsigned int IP; + char __data[0]; +}; + +struct trace_event_raw_random_read { + struct trace_entry ent; + int got_bits; + int need_bits; + int pool_left; + int input_left; + char __data[0]; +}; + +struct trace_event_raw_urandom_read { + struct trace_entry ent; + int got_bits; + int pool_left; + int input_left; + char __data[0]; +}; + +struct trace_event_raw_prandom_u32 { + struct trace_entry ent; + unsigned int ret; + char __data[0]; +}; + +struct trace_event_data_offsets_add_device_randomness {}; + +struct trace_event_data_offsets_random__mix_pool_bytes {}; + +struct trace_event_data_offsets_credit_entropy_bits {}; + +struct trace_event_data_offsets_push_to_pool {}; + +struct trace_event_data_offsets_debit_entropy {}; + +struct trace_event_data_offsets_add_input_randomness {}; + +struct trace_event_data_offsets_add_disk_randomness {}; + +struct trace_event_data_offsets_xfer_secondary_pool {}; + +struct trace_event_data_offsets_random__get_random_bytes {}; + +struct trace_event_data_offsets_random__extract_entropy {}; + +struct trace_event_data_offsets_random_read {}; + +struct trace_event_data_offsets_urandom_read {}; + +struct trace_event_data_offsets_prandom_u32 {}; + +typedef void (*btf_trace_add_device_randomness)(void *, int, long unsigned int); + +typedef void (*btf_trace_mix_pool_bytes)(void *, const char *, int, long unsigned int); + +typedef void (*btf_trace_mix_pool_bytes_nolock)(void *, const char *, int, long unsigned int); + +typedef void (*btf_trace_credit_entropy_bits)(void *, const char *, int, int, long unsigned int); + +typedef void (*btf_trace_push_to_pool)(void *, const char *, int, int); + +typedef void (*btf_trace_debit_entropy)(void *, const char *, int); + +typedef void (*btf_trace_add_input_randomness)(void *, int); + +typedef void (*btf_trace_add_disk_randomness)(void *, dev_t, int); + +typedef void (*btf_trace_xfer_secondary_pool)(void *, const char *, int, int, int, int); + +typedef void (*btf_trace_get_random_bytes)(void *, int, long unsigned int); + +typedef void (*btf_trace_get_random_bytes_arch)(void *, int, long unsigned int); + +typedef void (*btf_trace_extract_entropy)(void *, const char *, int, int, long unsigned int); + +typedef void (*btf_trace_extract_entropy_user)(void *, const char *, int, int, long unsigned int); + +typedef void (*btf_trace_random_read)(void *, int, int, int, int); + +typedef void (*btf_trace_urandom_read)(void *, int, int, int); + +typedef void (*btf_trace_prandom_u32)(void *, unsigned int); + +struct poolinfo { + int poolbitshift; + int poolwords; + int poolbytes; + int poolfracbits; + int tap1; + int tap2; + int tap3; + int tap4; + int tap5; +}; + +struct crng_state { + __u32 state[16]; + long unsigned int init_time; + spinlock_t lock; +}; + +struct entropy_store { + const struct poolinfo *poolinfo; + __u32 *pool; + const char *name; + spinlock_t lock; + short unsigned int add_ptr; + short unsigned int input_rotate; + int entropy_count; + unsigned int initialized: 1; + unsigned int last_data_init: 1; + __u8 last_data[10]; +}; + +struct fast_pool { + __u32 pool[4]; + long unsigned int last; + short unsigned int reg_idx; + unsigned char count; +}; + +struct batched_entropy { + union { + u64 entropy_u64[8]; + u32 entropy_u32[16]; + }; + unsigned int position; + spinlock_t batch_lock; +}; + +struct raw_config_request { + int raw_minor; + __u64 block_major; + __u64 block_minor; +}; + +struct raw_device_data { + dev_t binding; + struct block_device *bdev; + int inuse; +}; + +struct raw32_config_request { + compat_int_t raw_minor; + compat_u64 block_major; + compat_u64 block_minor; +} __attribute__((packed)); + +struct hpet_info { + long unsigned int hi_ireqfreq; + long unsigned int hi_flags; + short unsigned int hi_hpet; + short unsigned int hi_timer; +}; + +struct hpet_timer { + u64 hpet_config; + union { + u64 _hpet_hc64; + u32 _hpet_hc32; + long unsigned int _hpet_compare; + } _u1; + u64 hpet_fsb[2]; +}; + +struct hpet { + u64 hpet_cap; + u64 res0; + u64 hpet_config; + u64 res1; + u64 hpet_isr; + u64 res2[25]; + union { + u64 _hpet_mc64; + u32 _hpet_mc32; + long unsigned int _hpet_mc; + } _u0; + u64 res3; + struct hpet_timer hpet_timers[1]; +}; + +struct hpets; + +struct hpet_dev { + struct hpets *hd_hpets; + struct hpet *hd_hpet; + struct hpet_timer *hd_timer; + long unsigned int hd_ireqfreq; + long unsigned int hd_irqdata; + wait_queue_head_t hd_waitqueue; + struct fasync_struct *hd_async_queue; + unsigned int hd_flags; + unsigned int hd_irq; + unsigned int hd_hdwirq; + char hd_name[7]; +}; + +struct hpets { + struct hpets *hp_next; + struct hpet *hp_hpet; + long unsigned int hp_hpet_phys; + struct clocksource *hp_clocksource; + long long unsigned int hp_tick_freq; + long unsigned int hp_delta; + unsigned int hp_ntimer; + unsigned int hp_which; + struct hpet_dev hp_dev[0]; +}; + +struct compat_hpet_info { + compat_ulong_t hi_ireqfreq; + compat_ulong_t hi_flags; + short unsigned int hi_hpet; + short unsigned int hi_timer; +}; + +struct nvram_ops { + ssize_t (*get_size)(); + unsigned char (*read_byte)(int); + void (*write_byte)(unsigned char, int); + ssize_t (*read)(char *, size_t, loff_t *); + ssize_t (*write)(char *, size_t, loff_t *); + long int (*initialize)(); + long int (*set_checksum)(); +}; + +struct virtrng_info { + struct hwrng hwrng; + struct virtqueue *vq; + struct completion have_data; + char name[25]; + unsigned int data_avail; + int index; + bool busy; + bool hwrng_register_done; + bool hwrng_removed; +}; + +enum chipset_type { + NOT_SUPPORTED = 0, + SUPPORTED = 1, +}; + +struct agp_version { + u16 major; + u16 minor; +}; + +struct agp_bridge_data; + +struct agp_memory { + struct agp_memory *next; + struct agp_memory *prev; + struct agp_bridge_data *bridge; + struct page **pages; + size_t page_count; + int key; + int num_scratch_pages; + off_t pg_start; + u32 type; + u32 physical; + bool is_bound; + bool is_flushed; + struct list_head mapped_list; + struct scatterlist *sg_list; + int num_sg; +}; + +struct agp_bridge_driver; + +struct agp_bridge_data { + const struct agp_version *version; + const struct agp_bridge_driver *driver; + const struct vm_operations_struct *vm_ops; + void *previous_size; + void *current_size; + void *dev_private_data; + struct pci_dev *dev; + u32 *gatt_table; + u32 *gatt_table_real; + long unsigned int scratch_page; + struct page *scratch_page_page; + dma_addr_t scratch_page_dma; + long unsigned int gart_bus_addr; + long unsigned int gatt_bus_addr; + u32 mode; + enum chipset_type type; + long unsigned int *key_list; + atomic_t current_memory_agp; + atomic_t agp_in_use; + int max_memory_agp; + int aperture_size_idx; + int capndx; + int flags; + char major_version; + char minor_version; + struct list_head list; + u32 apbase_config; + struct list_head mapped_list; + spinlock_t mapped_lock; +}; + +enum aper_size_type { + U8_APER_SIZE = 0, + U16_APER_SIZE = 1, + U32_APER_SIZE = 2, + LVL2_APER_SIZE = 3, + FIXED_APER_SIZE = 4, +}; + +struct gatt_mask { + long unsigned int mask; + u32 type; +}; + +struct agp_bridge_driver { + struct module *owner; + const void *aperture_sizes; + int num_aperture_sizes; + enum aper_size_type size_type; + bool cant_use_aperture; + bool needs_scratch_page; + const struct gatt_mask *masks; + int (*fetch_size)(); + int (*configure)(); + void (*agp_enable)(struct agp_bridge_data *, u32); + void (*cleanup)(); + void (*tlb_flush)(struct agp_memory *); + long unsigned int (*mask_memory)(struct agp_bridge_data *, dma_addr_t, int); + void (*cache_flush)(); + int (*create_gatt_table)(struct agp_bridge_data *); + int (*free_gatt_table)(struct agp_bridge_data *); + int (*insert_memory)(struct agp_memory *, off_t, int); + int (*remove_memory)(struct agp_memory *, off_t, int); + struct agp_memory * (*alloc_by_type)(size_t, int); + void (*free_by_type)(struct agp_memory *); + struct page * (*agp_alloc_page)(struct agp_bridge_data *); + int (*agp_alloc_pages)(struct agp_bridge_data *, struct agp_memory *, size_t); + void (*agp_destroy_page)(struct page *, int); + void (*agp_destroy_pages)(struct agp_memory *); + int (*agp_type_to_mask_type)(struct agp_bridge_data *, int); +}; + +struct agp_kern_info { + struct agp_version version; + struct pci_dev *device; + enum chipset_type chipset; + long unsigned int mode; + long unsigned int aper_base; + size_t aper_size; + int max_memory; + int current_memory; + bool cant_use_aperture; + long unsigned int page_mask; + const struct vm_operations_struct *vm_ops; +}; + +struct aper_size_info_8 { + int size; + int num_entries; + int page_order; + u8 size_value; +}; + +struct aper_size_info_16 { + int size; + int num_entries; + int page_order; + u16 size_value; +}; + +struct aper_size_info_32 { + int size; + int num_entries; + int page_order; + u32 size_value; +}; + +struct aper_size_info_lvl2 { + int size; + int num_entries; + u32 size_value; +}; + +struct aper_size_info_fixed { + int size; + int num_entries; + int page_order; +}; + +struct agp_3_5_dev { + struct list_head list; + u8 capndx; + u32 maxbw; + struct pci_dev *dev; +}; + +struct isoch_data { + u32 maxbw; + u32 n; + u32 y; + u32 l; + u32 rq; + struct agp_3_5_dev *dev; +}; + +struct intel_agp_driver_description { + unsigned int chip_id; + char *name; + const struct agp_bridge_driver *driver; +}; + +struct intel_gtt_driver { + unsigned int gen: 8; + unsigned int is_g33: 1; + unsigned int is_pineview: 1; + unsigned int is_ironlake: 1; + unsigned int has_pgtbl_enable: 1; + unsigned int dma_mask_size: 8; + int (*setup)(); + void (*cleanup)(); + void (*write_entry)(dma_addr_t, unsigned int, unsigned int); + bool (*check_flags)(unsigned int); + void (*chipset_flush)(); +}; + +struct _intel_private { + const struct intel_gtt_driver *driver; + struct pci_dev *pcidev; + struct pci_dev *bridge_dev; + u8 *registers; + phys_addr_t gtt_phys_addr; + u32 PGETBL_save; + u32 *gtt; + bool clear_fake_agp; + int num_dcache_entries; + void *i9xx_flush_page; + char *i81x_gtt_table; + struct resource ifp_resource; + int resource_valid; + struct page *scratch_page; + phys_addr_t scratch_page_dma; + int refcount; + unsigned int needs_dmar: 1; + phys_addr_t gma_bus_addr; + resource_size_t stolen_size; + unsigned int gtt_total_entries; + unsigned int gtt_mappable_entries; +}; + +struct intel_gtt_driver_description { + unsigned int gmch_chip_id; + char *name; + const struct intel_gtt_driver *gtt_driver; +}; + +struct agp_device_ids { + short unsigned int device_id; + enum chipset_type chipset; + const char *chipset_name; + int (*chipset_setup)(struct pci_dev *); +}; + +enum tpm2_startup_types { + TPM2_SU_CLEAR = 0, + TPM2_SU_STATE = 1, +}; + +enum tpm_chip_flags { + TPM_CHIP_FLAG_TPM2 = 2, + TPM_CHIP_FLAG_IRQ = 4, + TPM_CHIP_FLAG_VIRTUAL = 8, + TPM_CHIP_FLAG_HAVE_TIMEOUTS = 16, + TPM_CHIP_FLAG_ALWAYS_POWERED = 32, + TPM_CHIP_FLAG_FIRMWARE_POWER_MANAGED = 64, +}; + +enum tpm2_structures { + TPM2_ST_NO_SESSIONS = 32769, + TPM2_ST_SESSIONS = 32770, +}; + +enum tpm2_return_codes { + TPM2_RC_SUCCESS = 0, + TPM2_RC_HASH = 131, + TPM2_RC_HANDLE = 139, + TPM2_RC_INITIALIZE = 256, + TPM2_RC_FAILURE = 257, + TPM2_RC_DISABLED = 288, + TPM2_RC_COMMAND_CODE = 323, + TPM2_RC_TESTING = 2314, + TPM2_RC_REFERENCE_H0 = 2320, + TPM2_RC_RETRY = 2338, +}; + +struct tpm_header { + __be16 tag; + __be32 length; + union { + __be32 ordinal; + __be32 return_code; + }; +} __attribute__((packed)); + +struct file_priv { + struct tpm_chip *chip; + struct tpm_space *space; + struct mutex buffer_mutex; + struct timer_list user_read_timer; + struct work_struct timeout_work; + struct work_struct async_work; + wait_queue_head_t async_wait; + ssize_t response_length; + bool response_read; + bool command_enqueued; + u8 data_buffer[4096]; +}; + +enum TPM_OPS_FLAGS { + TPM_OPS_AUTO_STARTUP = 1, +}; + +enum tpm2_timeouts { + TPM2_TIMEOUT_A = 750, + TPM2_TIMEOUT_B = 2000, + TPM2_TIMEOUT_C = 200, + TPM2_TIMEOUT_D = 30, + TPM2_DURATION_SHORT = 20, + TPM2_DURATION_MEDIUM = 750, + TPM2_DURATION_LONG = 2000, + TPM2_DURATION_LONG_LONG = 300000, + TPM2_DURATION_DEFAULT = 120000, +}; + +enum tpm2_command_codes { + TPM2_CC_FIRST = 287, + TPM2_CC_HIERARCHY_CONTROL = 289, + TPM2_CC_HIERARCHY_CHANGE_AUTH = 297, + TPM2_CC_CREATE_PRIMARY = 305, + TPM2_CC_SEQUENCE_COMPLETE = 318, + TPM2_CC_SELF_TEST = 323, + TPM2_CC_STARTUP = 324, + TPM2_CC_SHUTDOWN = 325, + TPM2_CC_NV_READ = 334, + TPM2_CC_CREATE = 339, + TPM2_CC_LOAD = 343, + TPM2_CC_SEQUENCE_UPDATE = 348, + TPM2_CC_UNSEAL = 350, + TPM2_CC_CONTEXT_LOAD = 353, + TPM2_CC_CONTEXT_SAVE = 354, + TPM2_CC_FLUSH_CONTEXT = 357, + TPM2_CC_VERIFY_SIGNATURE = 375, + TPM2_CC_GET_CAPABILITY = 378, + TPM2_CC_GET_RANDOM = 379, + TPM2_CC_PCR_READ = 382, + TPM2_CC_PCR_EXTEND = 386, + TPM2_CC_EVENT_SEQUENCE_COMPLETE = 389, + TPM2_CC_HASH_SEQUENCE_START = 390, + TPM2_CC_CREATE_LOADED = 401, + TPM2_CC_LAST = 403, +}; + +struct tpm_buf { + unsigned int flags; + u8 *data; +}; + +enum tpm_timeout { + TPM_TIMEOUT = 5, + TPM_TIMEOUT_RETRY = 100, + TPM_TIMEOUT_RANGE_US = 300, + TPM_TIMEOUT_POLL = 1, + TPM_TIMEOUT_USECS_MIN = 100, + TPM_TIMEOUT_USECS_MAX = 500, +}; + +enum tpm_buf_flags { + TPM_BUF_OVERFLOW = 1, +}; + +struct stclear_flags_t { + __be16 tag; + u8 deactivated; + u8 disableForceClear; + u8 physicalPresence; + u8 physicalPresenceLock; + u8 bGlobalLock; +} __attribute__((packed)); + +struct tpm1_version { + u8 major; + u8 minor; + u8 rev_major; + u8 rev_minor; +}; + +struct tpm1_version2 { + __be16 tag; + struct tpm1_version version; +}; + +struct timeout_t { + __be32 a; + __be32 b; + __be32 c; + __be32 d; +}; + +struct duration_t { + __be32 tpm_short; + __be32 tpm_medium; + __be32 tpm_long; +}; + +struct permanent_flags_t { + __be16 tag; + u8 disable; + u8 ownership; + u8 deactivated; + u8 readPubek; + u8 disableOwnerClear; + u8 allowMaintenance; + u8 physicalPresenceLifetimeLock; + u8 physicalPresenceHWEnable; + u8 physicalPresenceCMDEnable; + u8 CEKPUsed; + u8 TPMpost; + u8 TPMpostLock; + u8 FIPS; + u8 operator; + u8 enableRevokeEK; + u8 nvLocked; + u8 readSRKPub; + u8 tpmEstablished; + u8 maintenanceDone; + u8 disableFullDALogicInfo; +}; + +typedef union { + struct permanent_flags_t perm_flags; + struct stclear_flags_t stclear_flags; + __u8 owned; + __be32 num_pcrs; + struct tpm1_version version1; + struct tpm1_version2 version2; + __be32 manufacturer_id; + struct timeout_t timeout; + struct duration_t duration; +} cap_t; + +enum tpm_capabilities { + TPM_CAP_FLAG = 4, + TPM_CAP_PROP = 5, + TPM_CAP_VERSION_1_1 = 6, + TPM_CAP_VERSION_1_2 = 26, +}; + +enum tpm_sub_capabilities { + TPM_CAP_PROP_PCR = 257, + TPM_CAP_PROP_MANUFACTURER = 259, + TPM_CAP_FLAG_PERM = 264, + TPM_CAP_FLAG_VOL = 265, + TPM_CAP_PROP_OWNER = 273, + TPM_CAP_PROP_TIS_TIMEOUT = 277, + TPM_CAP_PROP_TIS_DURATION = 288, +}; + +struct tpm1_get_random_out { + __be32 rng_data_len; + u8 rng_data[128]; +}; + +enum tpm2_const { + TPM2_PLATFORM_PCR = 24, + TPM2_PCR_SELECT_MIN = 3, +}; + +enum tpm2_permanent_handles { + TPM2_RS_PW = 1073741833, +}; + +enum tpm2_capabilities { + TPM2_CAP_HANDLES = 1, + TPM2_CAP_COMMANDS = 2, + TPM2_CAP_PCRS = 5, + TPM2_CAP_TPM_PROPERTIES = 6, +}; + +enum tpm2_properties { + TPM_PT_TOTAL_COMMANDS = 297, +}; + +enum tpm2_cc_attrs { + TPM2_CC_ATTR_CHANDLES = 25, + TPM2_CC_ATTR_RHANDLE = 28, +}; + +struct tpm2_hash { + unsigned int crypto_id; + unsigned int tpm_id; +}; + +struct tpm2_pcr_read_out { + __be32 update_cnt; + __be32 pcr_selects_cnt; + __be16 hash_alg; + u8 pcr_select_size; + u8 pcr_select[3]; + __be32 digests_cnt; + __be16 digest_size; + u8 digest[0]; +} __attribute__((packed)); + +struct tpm2_null_auth_area { + __be32 handle; + __be16 nonce_size; + u8 attributes; + __be16 auth_size; +} __attribute__((packed)); + +struct tpm2_get_random_out { + __be16 size; + u8 buffer[128]; +}; + +struct tpm2_get_cap_out { + u8 more_data; + __be32 subcap_id; + __be32 property_cnt; + __be32 property_id; + __be32 value; +} __attribute__((packed)); + +struct tpm2_pcr_selection { + __be16 hash_alg; + u8 size_of_select; + u8 pcr_select[3]; +}; + +struct tpmrm_priv { + struct file_priv priv; + struct tpm_space space; +}; + +enum tpm2_handle_types { + TPM2_HT_HMAC_SESSION = 33554432, + TPM2_HT_POLICY_SESSION = 50331648, + TPM2_HT_TRANSIENT = 2147483648, +}; + +struct tpm2_context { + __be64 sequence; + __be32 saved_handle; + __be32 hierarchy; + __be16 blob_size; +} __attribute__((packed)); + +struct tpm2_cap_handles { + u8 more_data; + __be32 capability; + __be32 count; + __be32 handles[0]; +} __attribute__((packed)); + +struct tpm_readpubek_out { + u8 algorithm[4]; + u8 encscheme[2]; + u8 sigscheme[2]; + __be32 paramsize; + u8 parameters[12]; + __be32 keysize; + u8 modulus[256]; + u8 checksum[20]; +}; + +struct tcpa_event { + u32 pcr_index; + u32 event_type; + u8 pcr_value[20]; + u32 event_size; + u8 event_data[0]; +}; + +enum tcpa_event_types { + PREBOOT = 0, + POST_CODE = 1, + UNUSED = 2, + NO_ACTION = 3, + SEPARATOR = 4, + ACTION = 5, + EVENT_TAG = 6, + SCRTM_CONTENTS = 7, + SCRTM_VERSION = 8, + CPU_MICROCODE = 9, + PLATFORM_CONFIG_FLAGS = 10, + TABLE_OF_DEVICES = 11, + COMPACT_HASH = 12, + IPL = 13, + IPL_PARTITION_DATA = 14, + NONHOST_CODE = 15, + NONHOST_CONFIG = 16, + NONHOST_INFO = 17, +}; + +struct tcpa_pc_event { + u32 event_id; + u32 event_size; + u8 event_data[0]; +}; + +enum tcpa_pc_event_ids { + SMBIOS = 1, + BIS_CERT = 2, + POST_BIOS_ROM = 3, + ESCD = 4, + CMOS = 5, + NVRAM = 6, + OPTION_ROM_EXEC = 7, + OPTION_ROM_CONFIG = 8, + OPTION_ROM_MICROCODE = 10, + S_CRTM_VERSION = 11, + S_CRTM_CONTENTS = 12, + POST_CONTENTS = 13, + HOST_TABLE_OF_DEVICES = 14, +}; + +struct tcg_efi_specid_event_algs { + u16 alg_id; + u16 digest_size; +}; + +struct tcg_efi_specid_event_head { + u8 signature[16]; + u32 platform_class; + u8 spec_version_minor; + u8 spec_version_major; + u8 spec_errata; + u8 uintnsize; + u32 num_algs; + struct tcg_efi_specid_event_algs digest_sizes[0]; +}; + +struct tcg_pcr_event { + u32 pcr_idx; + u32 event_type; + u8 digest[20]; + u32 event_size; + u8 event[0]; +}; + +struct tcg_event_field { + u32 event_size; + u8 event[0]; +}; + +struct tcg_pcr_event2_head { + u32 pcr_idx; + u32 event_type; + u32 count; + struct tpm_digest digests[0]; +}; + +struct acpi_table_tpm2 { + struct acpi_table_header header; + u16 platform_class; + u16 reserved; + u64 control_address; + u32 start_method; +} __attribute__((packed)); + +struct acpi_tpm2_phy { + u8 start_method_specific[12]; + u32 log_area_minimum_length; + u64 log_area_start_address; +}; + +enum bios_platform_class { + BIOS_CLIENT = 0, + BIOS_SERVER = 1, +}; + +struct client_hdr { + u32 log_max_len; + u64 log_start_addr; +} __attribute__((packed)); + +struct server_hdr { + u16 reserved; + u64 log_max_len; + u64 log_start_addr; +} __attribute__((packed)); + +struct acpi_tcpa { + struct acpi_table_header hdr; + u16 platform_class; + union { + struct client_hdr client; + struct server_hdr server; + }; +} __attribute__((packed)); + +struct linux_efi_tpm_eventlog { + u32 size; + u32 final_events_preboot_size; + u8 version; + u8 log[0]; +}; + +struct efi_tcg2_final_events_table { + u64 version; + u64 nr_events; + u8 events[0]; +}; + +enum tis_access { + TPM_ACCESS_VALID = 128, + TPM_ACCESS_ACTIVE_LOCALITY = 32, + TPM_ACCESS_REQUEST_PENDING = 4, + TPM_ACCESS_REQUEST_USE = 2, +}; + +enum tis_status { + TPM_STS_VALID = 128, + TPM_STS_COMMAND_READY = 64, + TPM_STS_GO = 32, + TPM_STS_DATA_AVAIL = 16, + TPM_STS_DATA_EXPECT = 8, + TPM_STS_READ_ZERO = 35, +}; + +enum tis_int_flags { + TPM_GLOBAL_INT_ENABLE = 2147483648, + TPM_INTF_BURST_COUNT_STATIC = 256, + TPM_INTF_CMD_READY_INT = 128, + TPM_INTF_INT_EDGE_FALLING = 64, + TPM_INTF_INT_EDGE_RISING = 32, + TPM_INTF_INT_LEVEL_LOW = 16, + TPM_INTF_INT_LEVEL_HIGH = 8, + TPM_INTF_LOCALITY_CHANGE_INT = 4, + TPM_INTF_STS_VALID_INT = 2, + TPM_INTF_DATA_AVAIL_INT = 1, +}; + +enum tis_defaults { + TIS_MEM_LEN = 20480, + TIS_SHORT_TIMEOUT = 750, + TIS_LONG_TIMEOUT = 2000, +}; + +enum tpm_tis_flags { + TPM_TIS_ITPM_WORKAROUND = 1, +}; + +struct tpm_tis_phy_ops; + +struct tpm_tis_data { + u16 manufacturer_id; + int locality; + int irq; + bool irq_tested; + unsigned int flags; + void *ilb_base_addr; + u16 clkrun_enabled; + wait_queue_head_t int_queue; + wait_queue_head_t read_queue; + const struct tpm_tis_phy_ops *phy_ops; + short unsigned int rng_quality; +}; + +struct tpm_tis_phy_ops { + int (*read_bytes)(struct tpm_tis_data *, u32, u16, u8 *); + int (*write_bytes)(struct tpm_tis_data *, u32, u16, const u8 *); + int (*read16)(struct tpm_tis_data *, u32, u16 *); + int (*read32)(struct tpm_tis_data *, u32, u32 *); + int (*write32)(struct tpm_tis_data *, u32, u32); +}; + +struct tis_vendor_durations_override { + u32 did_vid; + struct tpm1_version version; + long unsigned int durations[3]; +}; + +struct tis_vendor_timeout_override { + u32 did_vid; + long unsigned int timeout_us[4]; +}; + +struct tpm_info { + struct resource res; + int irq; +}; + +struct tpm_tis_tcg_phy { + struct tpm_tis_data priv; + void *iobase; +}; + +enum crb_defaults { + CRB_ACPI_START_REVISION_ID = 1, + CRB_ACPI_START_INDEX = 1, +}; + +enum crb_loc_ctrl { + CRB_LOC_CTRL_REQUEST_ACCESS = 1, + CRB_LOC_CTRL_RELINQUISH = 2, +}; + +enum crb_loc_state { + CRB_LOC_STATE_LOC_ASSIGNED = 2, + CRB_LOC_STATE_TPM_REG_VALID_STS = 128, +}; + +enum crb_ctrl_req { + CRB_CTRL_REQ_CMD_READY = 1, + CRB_CTRL_REQ_GO_IDLE = 2, +}; + +enum crb_ctrl_sts { + CRB_CTRL_STS_ERROR = 1, + CRB_CTRL_STS_TPM_IDLE = 2, +}; + +enum crb_start { + CRB_START_INVOKE = 1, +}; + +enum crb_cancel { + CRB_CANCEL_INVOKE = 1, +}; + +struct crb_regs_head { + u32 loc_state; + u32 reserved1; + u32 loc_ctrl; + u32 loc_sts; + u8 reserved2[32]; + u64 intf_id; + u64 ctrl_ext; +}; + +struct crb_regs_tail { + u32 ctrl_req; + u32 ctrl_sts; + u32 ctrl_cancel; + u32 ctrl_start; + u32 ctrl_int_enable; + u32 ctrl_int_sts; + u32 ctrl_cmd_size; + u32 ctrl_cmd_pa_low; + u32 ctrl_cmd_pa_high; + u32 ctrl_rsp_size; + u64 ctrl_rsp_pa; +}; + +enum crb_status { + CRB_DRV_STS_COMPLETE = 1, +}; + +struct crb_priv { + u32 sm; + const char *hid; + struct crb_regs_head *regs_h; + struct crb_regs_tail *regs_t; + u8 *cmd; + u8 *rsp; + u32 cmd_size; + u32 smc_func_id; +}; + +struct tpm2_crb_smc { + u32 interrupt; + u8 interrupt_flags; + u8 op_flags; + u16 reserved2; + u32 smc_func_id; +}; + +struct vcpu_data; + +struct amd_iommu_pi_data { + u32 ga_tag; + u32 prev_ga_tag; + u64 base; + bool is_guest_mode; + struct vcpu_data *vcpu_data; + void *ir_data; +}; + +struct vcpu_data { + u64 pi_desc_addr; + u32 vector; +}; + +struct amd_iommu_device_info { + int max_pasids; + u32 flags; +}; + +struct irq_remap_table { + raw_spinlock_t lock; + unsigned int min_index; + u32 *table; +}; + +struct amd_iommu_fault { + u64 address; + u32 pasid; + u16 device_id; + u16 tag; + u16 flags; +}; + +struct protection_domain { + struct list_head dev_list; + struct iommu_domain domain; + spinlock_t lock; + u16 id; + atomic64_t pt_root; + int glx; + u64 *gcr3_tbl; + long unsigned int flags; + unsigned int dev_cnt; + unsigned int dev_iommu[32]; +}; + +struct domain_pgtable { + int mode; + u64 *root; +}; + +struct amd_irte_ops; + +struct amd_iommu___2 { + struct list_head list; + int index; + raw_spinlock_t lock; + struct pci_dev *dev; + struct pci_dev *root_pdev; + u64 mmio_phys; + u64 mmio_phys_end; + u8 *mmio_base; + u32 cap; + u8 acpi_flags; + u64 features; + bool is_iommu_v2; + u16 devid; + u16 cap_ptr; + u16 pci_seg; + u64 exclusion_start; + u64 exclusion_length; + u8 *cmd_buf; + u32 cmd_buf_head; + u32 cmd_buf_tail; + u8 *evt_buf; + u8 *ppr_log; + u8 *ga_log; + u8 *ga_log_tail; + bool int_enabled; + bool need_sync; + struct iommu_device iommu; + u32 stored_addr_lo; + u32 stored_addr_hi; + u32 stored_l1[108]; + u32 stored_l2[131]; + u8 max_banks; + u8 max_counters; + struct irq_domain *ir_domain; + struct irq_domain *msi_domain; + struct amd_irte_ops *irte_ops; + u32 flags; + volatile u64 *cmd_sem; + u64 cmd_sem_val; + struct irq_affinity_notify intcapxt_notify; +}; + +struct amd_irte_ops { + void (*prepare)(void *, u32, bool, u8, u32, int); + void (*activate)(void *, u16, u16); + void (*deactivate)(void *, u16, u16); + void (*set_affinity)(void *, u16, u16, u8, u32); + void * (*get)(struct irq_remap_table *, int); + void (*set_allocated)(struct irq_remap_table *, int); + bool (*is_allocated)(struct irq_remap_table *, int); + void (*clear_allocated)(struct irq_remap_table *, int); +}; + +struct acpihid_map_entry { + struct list_head list; + u8 uid[256]; + u8 hid[9]; + u16 devid; + u16 root_devid; + bool cmd_line; + struct iommu_group *group; +}; + +struct devid_map { + struct list_head list; + u8 id; + u16 devid; + bool cmd_line; +}; + +struct iommu_dev_data { + spinlock_t lock; + struct list_head list; + struct llist_node dev_data_list; + struct protection_domain *domain; + struct pci_dev *pdev; + u16 devid; + bool iommu_v2; + struct { + bool enabled; + int qdep; + } ats; + bool pri_tlp; + u32 errata; + bool use_vapic; + bool defer_attach; + struct ratelimit_state rs; +}; + +struct dev_table_entry { + u64 data[4]; +}; + +struct unity_map_entry { + struct list_head list; + u16 devid_start; + u16 devid_end; + u64 address_start; + u64 address_end; + int prot; +}; + +enum amd_iommu_intr_mode_type { + AMD_IOMMU_GUEST_IR_LEGACY = 0, + AMD_IOMMU_GUEST_IR_LEGACY_GA = 1, + AMD_IOMMU_GUEST_IR_VAPIC = 2, +}; + +union irte { + u32 val; + struct { + u32 valid: 1; + u32 no_fault: 1; + u32 int_type: 3; + u32 rq_eoi: 1; + u32 dm: 1; + u32 rsvd_1: 1; + u32 destination: 8; + u32 vector: 8; + u32 rsvd_2: 8; + } fields; +}; + +union irte_ga_lo { + u64 val; + struct { + u64 valid: 1; + u64 no_fault: 1; + u64 int_type: 3; + u64 rq_eoi: 1; + u64 dm: 1; + u64 guest_mode: 1; + u64 destination: 24; + u64 ga_tag: 32; + } fields_remap; + struct { + u64 valid: 1; + u64 no_fault: 1; + u64 ga_log_intr: 1; + u64 rsvd1: 3; + u64 is_run: 1; + u64 guest_mode: 1; + u64 destination: 24; + u64 ga_tag: 32; + } fields_vapic; +}; + +union irte_ga_hi { + u64 val; + struct { + u64 vector: 8; + u64 rsvd_1: 4; + u64 ga_root_ptr: 40; + u64 rsvd_2: 4; + u64 destination: 8; + } fields; +}; + +struct irte_ga { + union irte_ga_lo lo; + union irte_ga_hi hi; +}; + +struct irq_2_irte { + u16 devid; + u16 index; +}; + +struct amd_ir_data { + u32 cached_ga_tag; + struct irq_2_irte irq_2_irte; + struct msi_msg msi_entry; + void *entry; + void *ref; + struct irq_cfg *cfg; + int ga_vector; + int ga_root_ptr; + int ga_tag; +}; + +struct irq_remap_ops { + int capability; + int (*prepare)(); + int (*enable)(); + void (*disable)(); + int (*reenable)(int); + int (*enable_faulting)(); +}; + +struct iommu_cmd { + u32 data[4]; +}; + +enum irq_remap_cap { + IRQ_POSTING_CAP = 0, +}; + +struct ivhd_header { + u8 type; + u8 flags; + u16 length; + u16 devid; + u16 cap_ptr; + u64 mmio_phys; + u16 pci_seg; + u16 info; + u32 efr_attr; + u64 efr_reg; + u64 res; +}; + +struct ivhd_entry { + u8 type; + u16 devid; + u8 flags; + u32 ext; + u32 hidh; + u64 cid; + u8 uidf; + u8 uidl; + u8 uid; +} __attribute__((packed)); + +struct ivmd_header { + u8 type; + u8 flags; + u16 length; + u16 devid; + u16 aux; + u64 resv; + u64 range_start; + u64 range_length; +}; + +enum iommu_init_state { + IOMMU_START_STATE = 0, + IOMMU_IVRS_DETECTED = 1, + IOMMU_ACPI_FINISHED = 2, + IOMMU_ENABLED = 3, + IOMMU_PCI_INIT = 4, + IOMMU_INTERRUPTS_EN = 5, + IOMMU_DMA_OPS = 6, + IOMMU_INITIALIZED = 7, + IOMMU_NOT_FOUND = 8, + IOMMU_INIT_ERROR = 9, + IOMMU_CMDLINE_DISABLED = 10, +}; + +union intcapxt { + u64 capxt; + struct { + u64 reserved_0: 2; + u64 dest_mode_logical: 1; + u64 reserved_1: 5; + u64 destid_0_23: 24; + u64 vector: 8; + u64 reserved_2: 16; + u64 destid_24_31: 8; + }; +}; + +struct ivrs_quirk_entry { + u8 id; + u16 devid; +}; + +enum { + DELL_INSPIRON_7375 = 0, + DELL_LATITUDE_5495 = 1, + LENOVO_IDEAPAD_330S_15ARR = 2, +}; + +struct acpi_table_dmar { + struct acpi_table_header header; + u8 width; + u8 flags; + u8 reserved[10]; +}; + +struct acpi_dmar_header { + u16 type; + u16 length; +}; + +enum acpi_dmar_type { + ACPI_DMAR_TYPE_HARDWARE_UNIT = 0, + ACPI_DMAR_TYPE_RESERVED_MEMORY = 1, + ACPI_DMAR_TYPE_ROOT_ATS = 2, + ACPI_DMAR_TYPE_HARDWARE_AFFINITY = 3, + ACPI_DMAR_TYPE_NAMESPACE = 4, + ACPI_DMAR_TYPE_RESERVED = 5, +}; + +struct acpi_dmar_device_scope { + u8 entry_type; + u8 length; + u16 reserved; + u8 enumeration_id; + u8 bus; +}; + +enum acpi_dmar_scope_type { + ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, + ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, + ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, + ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, + ACPI_DMAR_SCOPE_TYPE_HPET = 4, + ACPI_DMAR_SCOPE_TYPE_NAMESPACE = 5, + ACPI_DMAR_SCOPE_TYPE_RESERVED = 6, +}; + +struct acpi_dmar_pci_path { + u8 device; + u8 function; +}; + +struct acpi_dmar_hardware_unit { + struct acpi_dmar_header header; + u8 flags; + u8 reserved; + u16 segment; + u64 address; +}; + +struct acpi_dmar_reserved_memory { + struct acpi_dmar_header header; + u16 reserved; + u16 segment; + u64 base_address; + u64 end_address; +}; + +struct acpi_dmar_atsr { + struct acpi_dmar_header header; + u8 flags; + u8 reserved; + u16 segment; +}; + +struct acpi_dmar_rhsa { + struct acpi_dmar_header header; + u32 reserved; + u64 base_address; + u32 proximity_domain; +} __attribute__((packed)); + +struct acpi_dmar_andd { + struct acpi_dmar_header header; + u8 reserved[3]; + u8 device_number; + char device_name[1]; +} __attribute__((packed)); + +struct dmar_dev_scope { + struct device *dev; + u8 bus; + u8 devfn; +}; + +struct intel_iommu; + +struct dmar_drhd_unit { + struct list_head list; + struct acpi_dmar_header *hdr; + u64 reg_base_addr; + struct dmar_dev_scope *devices; + int devices_cnt; + u16 segment; + u8 ignored: 1; + u8 include_all: 1; + u8 gfx_dedicated: 1; + struct intel_iommu *iommu; +}; + +struct iommu_flush { + void (*flush_context)(struct intel_iommu *, u16, u16, u8, u64); + void (*flush_iotlb)(struct intel_iommu *, u16, u64, unsigned int, u64); +}; + +typedef unsigned int ioasid_t; + +typedef ioasid_t (*ioasid_alloc_fn_t)(ioasid_t, ioasid_t, void *); + +typedef void (*ioasid_free_fn_t)(ioasid_t, void *); + +struct ioasid_allocator_ops { + ioasid_alloc_fn_t alloc; + ioasid_free_fn_t free; + struct list_head list; + void *pdata; +}; + +struct dmar_domain; + +struct root_entry; + +struct page_req_dsc; + +struct q_inval; + +struct ir_table; + +struct intel_iommu { + void *reg; + u64 reg_phys; + u64 reg_size; + u64 cap; + u64 ecap; + u64 vccap; + u32 gcmd; + raw_spinlock_t register_lock; + int seq_id; + int agaw; + int msagaw; + unsigned int irq; + unsigned int pr_irq; + u16 segment; + unsigned char name[13]; + long unsigned int *domain_ids; + struct dmar_domain ***domains; + spinlock_t lock; + struct root_entry *root_entry; + struct iommu_flush flush; + struct page_req_dsc *prq; + unsigned char prq_name[16]; + struct completion prq_complete; + struct ioasid_allocator_ops pasid_allocator; + struct q_inval *qi; + u32 *iommu_state; + struct ir_table *ir_table; + struct irq_domain *ir_domain; + struct irq_domain *ir_msi_domain; + struct iommu_device iommu; + int node; + u32 flags; + struct dmar_drhd_unit *drhd; +}; + +struct dmar_pci_path { + u8 bus; + u8 device; + u8 function; +}; + +struct dmar_pci_notify_info { + struct pci_dev *dev; + long unsigned int event; + int bus; + u16 seg; + u16 level; + struct dmar_pci_path path[0]; +}; + +struct irte___2 { + union { + struct { + __u64 present: 1; + __u64 fpd: 1; + __u64 __res0: 6; + __u64 avail: 4; + __u64 __res1: 3; + __u64 pst: 1; + __u64 vector: 8; + __u64 __res2: 40; + }; + struct { + __u64 r_present: 1; + __u64 r_fpd: 1; + __u64 dst_mode: 1; + __u64 redir_hint: 1; + __u64 trigger_mode: 1; + __u64 dlvry_mode: 3; + __u64 r_avail: 4; + __u64 r_res0: 4; + __u64 r_vector: 8; + __u64 r_res1: 8; + __u64 dest_id: 32; + }; + struct { + __u64 p_present: 1; + __u64 p_fpd: 1; + __u64 p_res0: 6; + __u64 p_avail: 4; + __u64 p_res1: 2; + __u64 p_urgent: 1; + __u64 p_pst: 1; + __u64 p_vector: 8; + __u64 p_res2: 14; + __u64 pda_l: 26; + }; + __u64 low; + }; + union { + struct { + __u64 sid: 16; + __u64 sq: 2; + __u64 svt: 2; + __u64 __res3: 44; + }; + struct { + __u64 p_sid: 16; + __u64 p_sq: 2; + __u64 p_svt: 2; + __u64 p_res3: 12; + __u64 pda_h: 32; + }; + __u64 high; + }; +}; + +struct iova { + struct rb_node node; + long unsigned int pfn_hi; + long unsigned int pfn_lo; +}; + +struct iova_magazine; + +struct iova_cpu_rcache; + +struct iova_rcache { + spinlock_t lock; + long unsigned int depot_size; + struct iova_magazine *depot[32]; + struct iova_cpu_rcache *cpu_rcaches; +}; + +struct iova_domain; + +typedef void (*iova_flush_cb)(struct iova_domain *); + +typedef void (*iova_entry_dtor)(long unsigned int); + +struct iova_fq; + +struct iova_domain { + spinlock_t iova_rbtree_lock; + struct rb_root rbroot; + struct rb_node *cached_node; + struct rb_node *cached32_node; + long unsigned int granule; + long unsigned int start_pfn; + long unsigned int dma_32bit_pfn; + long unsigned int max32_alloc_size; + struct iova_fq *fq; + atomic64_t fq_flush_start_cnt; + atomic64_t fq_flush_finish_cnt; + struct iova anchor; + struct iova_rcache rcaches[6]; + iova_flush_cb flush_cb; + iova_entry_dtor entry_dtor; + struct timer_list fq_timer; + atomic_t fq_timer_on; +}; + +struct iova_fq_entry { + long unsigned int iova_pfn; + long unsigned int pages; + long unsigned int data; + u64 counter; +}; + +struct iova_fq { + struct iova_fq_entry entries[256]; + unsigned int head; + unsigned int tail; + spinlock_t lock; +}; + +enum { + QI_FREE = 0, + QI_IN_USE = 1, + QI_DONE = 2, + QI_ABORT = 3, +}; + +struct qi_desc { + u64 qw0; + u64 qw1; + u64 qw2; + u64 qw3; +}; + +struct q_inval { + raw_spinlock_t q_lock; + void *desc; + int *desc_status; + int free_head; + int free_tail; + int free_cnt; +}; + +struct ir_table { + struct irte___2 *base; + long unsigned int *bitmap; +}; + +struct root_entry { + u64 lo; + u64 hi; +}; + +struct dma_pte; + +struct dmar_domain { + int nid; + unsigned int iommu_refcnt[128]; + u16 iommu_did[128]; + bool has_iotlb_device; + struct list_head devices; + struct list_head subdevices; + struct iova_domain iovad; + struct dma_pte *pgd; + int gaw; + int agaw; + int flags; + int iommu_coherency; + int iommu_snooping; + int iommu_count; + int iommu_superpage; + u64 max_addr; + u32 default_pasid; + struct iommu_domain domain; +}; + +struct dma_pte { + u64 val; +}; + +typedef int (*dmar_res_handler_t)(struct acpi_dmar_header *, void *); + +struct dmar_res_callback { + dmar_res_handler_t cb[5]; + void *arg[5]; + bool ignore_unhandled; + bool print_entry; +}; + +enum faulttype { + DMA_REMAP = 0, + INTR_REMAP = 1, + UNKNOWN = 2, +}; + +struct ioasid_set { + int dummy; +}; + +enum iommu_inv_granularity { + IOMMU_INV_GRANU_DOMAIN = 0, + IOMMU_INV_GRANU_PASID = 1, + IOMMU_INV_GRANU_ADDR = 2, + IOMMU_INV_GRANU_NR = 3, +}; + +enum { + SR_DMAR_FECTL_REG = 0, + SR_DMAR_FEDATA_REG = 1, + SR_DMAR_FEADDR_REG = 2, + SR_DMAR_FEUADDR_REG = 3, + MAX_SR_DMAR_REGS = 4, +}; + +struct context_entry { + u64 lo; + u64 hi; +}; + +struct subdev_domain_info { + struct list_head link_phys; + struct list_head link_domain; + struct device *pdev; + struct dmar_domain *domain; + int users; +}; + +struct pasid_table; + +struct device_domain_info { + struct list_head link; + struct list_head global; + struct list_head table; + struct list_head subdevices; + u32 segment; + u8 bus; + u8 devfn; + u16 pfsid; + u8 pasid_supported: 3; + u8 pasid_enabled: 1; + u8 pri_supported: 1; + u8 pri_enabled: 1; + u8 ats_supported: 1; + u8 ats_enabled: 1; + u8 auxd_enabled: 1; + u8 ats_qdep; + struct device *dev; + struct intel_iommu *iommu; + struct dmar_domain *domain; + struct pasid_table *pasid_table; +}; + +struct pasid_table { + void *table; + int order; + u32 max_pasid; + struct list_head dev; +}; + +struct dmar_rmrr_unit { + struct list_head list; + struct acpi_dmar_header *hdr; + u64 base_address; + u64 end_address; + struct dmar_dev_scope *devices; + int devices_cnt; +}; + +struct dmar_atsr_unit { + struct list_head list; + struct acpi_dmar_header *hdr; + struct dmar_dev_scope *devices; + int devices_cnt; + u8 include_all: 1; +}; + +struct domain_context_mapping_data { + struct dmar_domain *domain; + struct intel_iommu *iommu; + struct pasid_table *table; +}; + +struct pasid_dir_entry { + u64 val; +}; + +struct pasid_entry { + u64 val[8]; +}; + +struct pasid_table_opaque { + struct pasid_table **pasid_table; + int segment; + int bus; + int devfn; +}; + +struct trace_event_raw_dma_map { + struct trace_entry ent; + u32 __data_loc_dev_name; + dma_addr_t dev_addr; + phys_addr_t phys_addr; + size_t size; + char __data[0]; +}; + +struct trace_event_raw_dma_unmap { + struct trace_entry ent; + u32 __data_loc_dev_name; + dma_addr_t dev_addr; + size_t size; + char __data[0]; +}; + +struct trace_event_raw_dma_map_sg { + struct trace_entry ent; + u32 __data_loc_dev_name; + dma_addr_t dev_addr; + phys_addr_t phys_addr; + size_t size; + int index; + int total; + char __data[0]; +}; + +struct trace_event_data_offsets_dma_map { + u32 dev_name; +}; + +struct trace_event_data_offsets_dma_unmap { + u32 dev_name; +}; + +struct trace_event_data_offsets_dma_map_sg { + u32 dev_name; +}; + +typedef void (*btf_trace_map_single)(void *, struct device *, dma_addr_t, phys_addr_t, size_t); + +typedef void (*btf_trace_bounce_map_single)(void *, struct device *, dma_addr_t, phys_addr_t, size_t); + +typedef void (*btf_trace_unmap_single)(void *, struct device *, dma_addr_t, size_t); + +typedef void (*btf_trace_unmap_sg)(void *, struct device *, dma_addr_t, size_t); + +typedef void (*btf_trace_bounce_unmap_single)(void *, struct device *, dma_addr_t, size_t); + +typedef void (*btf_trace_map_sg)(void *, struct device *, int, int, struct scatterlist *); + +typedef void (*btf_trace_bounce_map_sg)(void *, struct device *, int, int, struct scatterlist *); + +enum iommu_fault_type { + IOMMU_FAULT_DMA_UNRECOV = 1, + IOMMU_FAULT_PAGE_REQ = 2, +}; + +struct page_req_dsc { + union { + struct { + u64 type: 8; + u64 pasid_present: 1; + u64 priv_data_present: 1; + u64 rsvd: 6; + u64 rid: 16; + u64 pasid: 20; + u64 exe_req: 1; + u64 pm_req: 1; + u64 rsvd2: 10; + }; + u64 qw_0; + }; + union { + struct { + u64 rd_req: 1; + u64 wr_req: 1; + u64 lpig: 1; + u64 prg_index: 9; + u64 addr: 52; + }; + u64 qw_1; + }; + u64 priv_data[2]; +}; + +struct svm_dev_ops; + +struct intel_svm_dev { + struct list_head list; + struct callback_head rcu; + struct device *dev; + struct intel_iommu *iommu; + struct svm_dev_ops *ops; + struct iommu_sva sva; + u32 pasid; + int users; + u16 did; + u16 dev_iotlb: 1; + u16 sid; + u16 qdep; +}; + +struct svm_dev_ops { + void (*fault_cb)(struct device *, u32, u64, void *, int, int); +}; + +struct intel_svm { + struct mmu_notifier notifier; + struct mm_struct *mm; + unsigned int flags; + u32 pasid; + int gpasid; + struct list_head devs; + struct list_head list; +}; + +enum irq_mode { + IRQ_REMAPPING = 0, + IRQ_POSTING = 1, +}; + +struct ioapic_scope { + struct intel_iommu *iommu; + unsigned int id; + unsigned int bus; + unsigned int devfn; +}; + +struct hpet_scope { + struct intel_iommu *iommu; + u8 id; + unsigned int bus; + unsigned int devfn; +}; + +struct irq_2_iommu { + struct intel_iommu *iommu; + u16 irte_index; + u16 sub_handle; + u8 irte_mask; + enum irq_mode mode; +}; + +struct intel_ir_data { + struct irq_2_iommu irq_2_iommu; + struct irte___2 irte_entry; + union { + struct msi_msg msi_entry; + }; +}; + +struct set_msi_sid_data { + struct pci_dev *pdev; + u16 alias; + int count; + int busmatch_count; +}; + +struct iommu_group { + struct kobject kobj; + struct kobject *devices_kobj; + struct list_head devices; + struct mutex mutex; + struct blocking_notifier_head notifier; + void *iommu_data; + void (*iommu_data_release)(void *); + char *name; + int id; + struct iommu_domain *default_domain; + struct iommu_domain *domain; + struct list_head entry; +}; + +struct fsl_mc_obj_desc { + char type[16]; + int id; + u16 vendor; + u16 ver_major; + u16 ver_minor; + u8 irq_count; + u8 region_count; + u32 state; + char label[16]; + u16 flags; +}; + +struct fsl_mc_io; + +struct fsl_mc_device_irq; + +struct fsl_mc_resource; + +struct fsl_mc_device { + struct device dev; + u64 dma_mask; + u16 flags; + u32 icid; + u16 mc_handle; + struct fsl_mc_io *mc_io; + struct fsl_mc_obj_desc obj_desc; + struct resource *regions; + struct fsl_mc_device_irq **irqs; + struct fsl_mc_resource *resource; + struct device_link *consumer_link; + char *driver_override; +}; + +enum fsl_mc_pool_type { + FSL_MC_POOL_DPMCP = 0, + FSL_MC_POOL_DPBP = 1, + FSL_MC_POOL_DPCON = 2, + FSL_MC_POOL_IRQ = 3, + FSL_MC_NUM_POOL_TYPES = 4, +}; + +struct fsl_mc_resource_pool; + +struct fsl_mc_resource { + enum fsl_mc_pool_type type; + s32 id; + void *data; + struct fsl_mc_resource_pool *parent_pool; + struct list_head node; +}; + +struct fsl_mc_device_irq { + struct msi_desc *msi_desc; + struct fsl_mc_device *mc_dev; + u8 dev_irq_index; + struct fsl_mc_resource resource; +}; + +struct fsl_mc_io { + struct device *dev; + u16 flags; + u32 portal_size; + phys_addr_t portal_phys_addr; + void *portal_virt_addr; + struct fsl_mc_device *dpmcp_dev; + union { + struct mutex mutex; + raw_spinlock_t spinlock; + }; +}; + +struct group_device { + struct list_head list; + struct device *dev; + char *name; +}; + +struct iommu_group_attribute { + struct attribute attr; + ssize_t (*show)(struct iommu_group *, char *); + ssize_t (*store)(struct iommu_group *, const char *, size_t); +}; + +struct group_for_pci_data { + struct pci_dev *pdev; + struct iommu_group *group; +}; + +struct __group_domain_type { + struct device *dev; + unsigned int type; +}; + +struct trace_event_raw_iommu_group_event { + struct trace_entry ent; + int gid; + u32 __data_loc_device; + char __data[0]; +}; + +struct trace_event_raw_iommu_device_event { + struct trace_entry ent; + u32 __data_loc_device; + char __data[0]; +}; + +struct trace_event_raw_map { + struct trace_entry ent; + u64 iova; + u64 paddr; + size_t size; + char __data[0]; +}; + +struct trace_event_raw_unmap { + struct trace_entry ent; + u64 iova; + size_t size; + size_t unmapped_size; + char __data[0]; +}; + +struct trace_event_raw_iommu_error { + struct trace_entry ent; + u32 __data_loc_device; + u32 __data_loc_driver; + u64 iova; + int flags; + char __data[0]; +}; + +struct trace_event_data_offsets_iommu_group_event { + u32 device; +}; + +struct trace_event_data_offsets_iommu_device_event { + u32 device; +}; + +struct trace_event_data_offsets_map {}; + +struct trace_event_data_offsets_unmap {}; + +struct trace_event_data_offsets_iommu_error { + u32 device; + u32 driver; +}; + +typedef void (*btf_trace_add_device_to_group)(void *, int, struct device *); + +typedef void (*btf_trace_remove_device_from_group)(void *, int, struct device *); + +typedef void (*btf_trace_attach_device_to_domain)(void *, struct device *); + +typedef void (*btf_trace_detach_device_from_domain)(void *, struct device *); + +typedef void (*btf_trace_map)(void *, long unsigned int, phys_addr_t, size_t); + +typedef void (*btf_trace_unmap)(void *, long unsigned int, size_t, size_t); + +typedef void (*btf_trace_io_page_fault)(void *, struct device *, long unsigned int, int); + +struct iommu_dma_msi_page { + struct list_head list; + dma_addr_t iova; + phys_addr_t phys; +}; + +enum iommu_dma_cookie_type { + IOMMU_DMA_IOVA_COOKIE = 0, + IOMMU_DMA_MSI_COOKIE = 1, +}; + +struct iommu_dma_cookie { + enum iommu_dma_cookie_type type; + union { + struct iova_domain iovad; + dma_addr_t msi_iova; + }; + struct list_head msi_page_list; + struct iommu_domain *fq_domain; +}; + +struct ioasid_data { + ioasid_t id; + struct ioasid_set *set; + void *private; + struct callback_head rcu; + refcount_t refs; +}; + +struct ioasid_allocator_data { + struct ioasid_allocator_ops *ops; + struct list_head list; + struct list_head slist; + long unsigned int flags; + struct xarray xa; + struct callback_head rcu; +}; + +struct iova_magazine { + long unsigned int size; + long unsigned int pfns[128]; +}; + +struct iova_cpu_rcache { + spinlock_t lock; + struct iova_magazine *loaded; + struct iova_magazine *prev; +}; + +struct mipi_dsi_msg { + u8 channel; + u8 type; + u16 flags; + size_t tx_len; + const void *tx_buf; + size_t rx_len; + void *rx_buf; +}; + +struct mipi_dsi_packet { + size_t size; + u8 header[4]; + size_t payload_length; + const u8 *payload; +}; + +struct mipi_dsi_host; + +struct mipi_dsi_device; + +struct mipi_dsi_host_ops { + int (*attach)(struct mipi_dsi_host *, struct mipi_dsi_device *); + int (*detach)(struct mipi_dsi_host *, struct mipi_dsi_device *); + ssize_t (*transfer)(struct mipi_dsi_host *, const struct mipi_dsi_msg *); +}; + +struct mipi_dsi_host { + struct device *dev; + const struct mipi_dsi_host_ops *ops; + struct list_head list; +}; + +enum mipi_dsi_pixel_format { + MIPI_DSI_FMT_RGB888 = 0, + MIPI_DSI_FMT_RGB666 = 1, + MIPI_DSI_FMT_RGB666_PACKED = 2, + MIPI_DSI_FMT_RGB565 = 3, +}; + +struct mipi_dsi_device { + struct mipi_dsi_host *host; + struct device dev; + char name[20]; + unsigned int channel; + unsigned int lanes; + enum mipi_dsi_pixel_format format; + long unsigned int mode_flags; + long unsigned int hs_rate; + long unsigned int lp_rate; +}; + +struct mipi_dsi_device_info { + char type[20]; + u32 channel; + struct device_node *node; +}; + +enum mipi_dsi_dcs_tear_mode { + MIPI_DSI_DCS_TEAR_MODE_VBLANK = 0, + MIPI_DSI_DCS_TEAR_MODE_VHBLANK = 1, +}; + +struct mipi_dsi_driver { + struct device_driver driver; + int (*probe)(struct mipi_dsi_device *); + int (*remove)(struct mipi_dsi_device *); + void (*shutdown)(struct mipi_dsi_device *); +}; + +struct drm_dsc_picture_parameter_set { + u8 dsc_version; + u8 pps_identifier; + u8 pps_reserved; + u8 pps_3; + u8 pps_4; + u8 bits_per_pixel_low; + __be16 pic_height; + __be16 pic_width; + __be16 slice_height; + __be16 slice_width; + __be16 chunk_size; + u8 initial_xmit_delay_high; + u8 initial_xmit_delay_low; + __be16 initial_dec_delay; + u8 pps20_reserved; + u8 initial_scale_value; + __be16 scale_increment_interval; + u8 scale_decrement_interval_high; + u8 scale_decrement_interval_low; + u8 pps26_reserved; + u8 first_line_bpg_offset; + __be16 nfl_bpg_offset; + __be16 slice_bpg_offset; + __be16 initial_offset; + __be16 final_offset; + u8 flatness_min_qp; + u8 flatness_max_qp; + __be16 rc_model_size; + u8 rc_edge_factor; + u8 rc_quant_incr_limit0; + u8 rc_quant_incr_limit1; + u8 rc_tgt_offset; + u8 rc_buf_thresh[14]; + __be16 rc_range_parameters[15]; + u8 native_422_420; + u8 second_line_bpg_offset; + __be16 nsl_bpg_offset; + __be16 second_line_offset_adj; + u32 pps_long_94_reserved; + u32 pps_long_98_reserved; + u32 pps_long_102_reserved; + u32 pps_long_106_reserved; + u32 pps_long_110_reserved; + u32 pps_long_114_reserved; + u32 pps_long_118_reserved; + u32 pps_long_122_reserved; + __be16 pps_short_126_reserved; +} __attribute__((packed)); + +enum { + MIPI_DSI_V_SYNC_START = 1, + MIPI_DSI_V_SYNC_END = 17, + MIPI_DSI_H_SYNC_START = 33, + MIPI_DSI_H_SYNC_END = 49, + MIPI_DSI_COMPRESSION_MODE = 7, + MIPI_DSI_END_OF_TRANSMISSION = 8, + MIPI_DSI_COLOR_MODE_OFF = 2, + MIPI_DSI_COLOR_MODE_ON = 18, + MIPI_DSI_SHUTDOWN_PERIPHERAL = 34, + MIPI_DSI_TURN_ON_PERIPHERAL = 50, + MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM = 3, + MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM = 19, + MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM = 35, + MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM = 4, + MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM = 20, + MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM = 36, + MIPI_DSI_DCS_SHORT_WRITE = 5, + MIPI_DSI_DCS_SHORT_WRITE_PARAM = 21, + MIPI_DSI_DCS_READ = 6, + MIPI_DSI_EXECUTE_QUEUE = 22, + MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE = 55, + MIPI_DSI_NULL_PACKET = 9, + MIPI_DSI_BLANKING_PACKET = 25, + MIPI_DSI_GENERIC_LONG_WRITE = 41, + MIPI_DSI_DCS_LONG_WRITE = 57, + MIPI_DSI_PICTURE_PARAMETER_SET = 10, + MIPI_DSI_COMPRESSED_PIXEL_STREAM = 11, + MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20 = 12, + MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24 = 28, + MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16 = 44, + MIPI_DSI_PACKED_PIXEL_STREAM_30 = 13, + MIPI_DSI_PACKED_PIXEL_STREAM_36 = 29, + MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12 = 61, + MIPI_DSI_PACKED_PIXEL_STREAM_16 = 14, + MIPI_DSI_PACKED_PIXEL_STREAM_18 = 30, + MIPI_DSI_PIXEL_STREAM_3BYTE_18 = 46, + MIPI_DSI_PACKED_PIXEL_STREAM_24 = 62, +}; + +enum { + MIPI_DCS_NOP = 0, + MIPI_DCS_SOFT_RESET = 1, + MIPI_DCS_GET_COMPRESSION_MODE = 3, + MIPI_DCS_GET_DISPLAY_ID = 4, + MIPI_DCS_GET_ERROR_COUNT_ON_DSI = 5, + MIPI_DCS_GET_RED_CHANNEL = 6, + MIPI_DCS_GET_GREEN_CHANNEL = 7, + MIPI_DCS_GET_BLUE_CHANNEL = 8, + MIPI_DCS_GET_DISPLAY_STATUS = 9, + MIPI_DCS_GET_POWER_MODE = 10, + MIPI_DCS_GET_ADDRESS_MODE = 11, + MIPI_DCS_GET_PIXEL_FORMAT = 12, + MIPI_DCS_GET_DISPLAY_MODE = 13, + MIPI_DCS_GET_SIGNAL_MODE = 14, + MIPI_DCS_GET_DIAGNOSTIC_RESULT = 15, + MIPI_DCS_ENTER_SLEEP_MODE = 16, + MIPI_DCS_EXIT_SLEEP_MODE = 17, + MIPI_DCS_ENTER_PARTIAL_MODE = 18, + MIPI_DCS_ENTER_NORMAL_MODE = 19, + MIPI_DCS_GET_IMAGE_CHECKSUM_RGB = 20, + MIPI_DCS_GET_IMAGE_CHECKSUM_CT = 21, + MIPI_DCS_EXIT_INVERT_MODE = 32, + MIPI_DCS_ENTER_INVERT_MODE = 33, + MIPI_DCS_SET_GAMMA_CURVE = 38, + MIPI_DCS_SET_DISPLAY_OFF = 40, + MIPI_DCS_SET_DISPLAY_ON = 41, + MIPI_DCS_SET_COLUMN_ADDRESS = 42, + MIPI_DCS_SET_PAGE_ADDRESS = 43, + MIPI_DCS_WRITE_MEMORY_START = 44, + MIPI_DCS_WRITE_LUT = 45, + MIPI_DCS_READ_MEMORY_START = 46, + MIPI_DCS_SET_PARTIAL_ROWS = 48, + MIPI_DCS_SET_PARTIAL_COLUMNS = 49, + MIPI_DCS_SET_SCROLL_AREA = 51, + MIPI_DCS_SET_TEAR_OFF = 52, + MIPI_DCS_SET_TEAR_ON = 53, + MIPI_DCS_SET_ADDRESS_MODE = 54, + MIPI_DCS_SET_SCROLL_START = 55, + MIPI_DCS_EXIT_IDLE_MODE = 56, + MIPI_DCS_ENTER_IDLE_MODE = 57, + MIPI_DCS_SET_PIXEL_FORMAT = 58, + MIPI_DCS_WRITE_MEMORY_CONTINUE = 60, + MIPI_DCS_SET_3D_CONTROL = 61, + MIPI_DCS_READ_MEMORY_CONTINUE = 62, + MIPI_DCS_GET_3D_CONTROL = 63, + MIPI_DCS_SET_VSYNC_TIMING = 64, + MIPI_DCS_SET_TEAR_SCANLINE = 68, + MIPI_DCS_GET_SCANLINE = 69, + MIPI_DCS_SET_DISPLAY_BRIGHTNESS = 81, + MIPI_DCS_GET_DISPLAY_BRIGHTNESS = 82, + MIPI_DCS_WRITE_CONTROL_DISPLAY = 83, + MIPI_DCS_GET_CONTROL_DISPLAY = 84, + MIPI_DCS_WRITE_POWER_SAVE = 85, + MIPI_DCS_GET_POWER_SAVE = 86, + MIPI_DCS_SET_CABC_MIN_BRIGHTNESS = 94, + MIPI_DCS_GET_CABC_MIN_BRIGHTNESS = 95, + MIPI_DCS_READ_DDB_START = 161, + MIPI_DCS_READ_PPS_START = 162, + MIPI_DCS_READ_DDB_CONTINUE = 168, + MIPI_DCS_READ_PPS_CONTINUE = 169, +}; + +struct drm_dmi_panel_orientation_data { + int width; + int height; + const char * const *bios_dates; + int orientation; +}; + +struct vga_device { + struct list_head list; + struct pci_dev *pdev; + unsigned int decodes; + unsigned int owns; + unsigned int locks; + unsigned int io_lock_cnt; + unsigned int mem_lock_cnt; + unsigned int io_norm_cnt; + unsigned int mem_norm_cnt; + bool bridge_has_one_vga; + void *cookie; + void (*irq_set_state)(void *, bool); + unsigned int (*set_vga_decode)(void *, bool); +}; + +struct vga_arb_user_card { + struct pci_dev *pdev; + unsigned int mem_cnt; + unsigned int io_cnt; +}; + +struct vga_arb_private { + struct list_head list; + struct pci_dev *target; + struct vga_arb_user_card cards[16]; + spinlock_t lock; +}; + +enum vga_switcheroo_handler_flags_t { + VGA_SWITCHEROO_CAN_SWITCH_DDC = 1, + VGA_SWITCHEROO_NEEDS_EDP_CONFIG = 2, +}; + +enum vga_switcheroo_state { + VGA_SWITCHEROO_OFF = 0, + VGA_SWITCHEROO_ON = 1, + VGA_SWITCHEROO_NOT_FOUND = 2, +}; + +enum vga_switcheroo_client_id { + VGA_SWITCHEROO_UNKNOWN_ID = 4096, + VGA_SWITCHEROO_IGD = 0, + VGA_SWITCHEROO_DIS = 1, + VGA_SWITCHEROO_MAX_CLIENTS = 2, +}; + +struct vga_switcheroo_handler { + int (*init)(); + int (*switchto)(enum vga_switcheroo_client_id); + int (*switch_ddc)(enum vga_switcheroo_client_id); + int (*power_state)(enum vga_switcheroo_client_id, enum vga_switcheroo_state); + enum vga_switcheroo_client_id (*get_client_id)(struct pci_dev *); +}; + +struct vga_switcheroo_client_ops { + void (*set_gpu_state)(struct pci_dev *, enum vga_switcheroo_state); + void (*reprobe)(struct pci_dev *); + bool (*can_switch)(struct pci_dev *); + void (*gpu_bound)(struct pci_dev *, enum vga_switcheroo_client_id); +}; + +struct vga_switcheroo_client { + struct pci_dev *pdev; + struct fb_info *fb_info; + enum vga_switcheroo_state pwr_state; + const struct vga_switcheroo_client_ops *ops; + enum vga_switcheroo_client_id id; + bool active; + bool driver_power_control; + struct list_head list; + struct pci_dev *vga_dev; +}; + +struct vgasr_priv { + bool active; + bool delayed_switch_active; + enum vga_switcheroo_client_id delayed_client_id; + struct dentry *debugfs_root; + int registered_clients; + struct list_head clients; + const struct vga_switcheroo_handler *handler; + enum vga_switcheroo_handler_flags_t handler_flags; + struct mutex mux_hw_lock; + int old_ddc_owner; +}; + +struct cb_id { + __u32 idx; + __u32 val; +}; + +struct cn_msg { + struct cb_id id; + __u32 seq; + __u32 ack; + __u16 len; + __u16 flags; + __u8 data[0]; +}; + +struct cn_queue_dev { + atomic_t refcnt; + unsigned char name[32]; + struct list_head queue_list; + spinlock_t queue_lock; + struct sock *nls; +}; + +struct cn_callback_id { + unsigned char name[32]; + struct cb_id id; +}; + +struct cn_callback_entry { + struct list_head callback_entry; + refcount_t refcnt; + struct cn_queue_dev *pdev; + struct cn_callback_id id; + void (*callback)(struct cn_msg *, struct netlink_skb_parms *); + u32 seq; + u32 group; +}; + +struct cn_dev { + struct cb_id id; + u32 seq; + u32 groups; + struct sock *nls; + struct cn_queue_dev *cbdev; +}; + +enum proc_cn_mcast_op { + PROC_CN_MCAST_LISTEN = 1, + PROC_CN_MCAST_IGNORE = 2, +}; + +struct fork_proc_event { + __kernel_pid_t parent_pid; + __kernel_pid_t parent_tgid; + __kernel_pid_t child_pid; + __kernel_pid_t child_tgid; +}; + +struct exec_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; +}; + +struct id_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; + union { + __u32 ruid; + __u32 rgid; + } r; + union { + __u32 euid; + __u32 egid; + } e; +}; + +struct sid_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; +}; + +struct ptrace_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; + __kernel_pid_t tracer_pid; + __kernel_pid_t tracer_tgid; +}; + +struct comm_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; + char comm[16]; +}; + +struct coredump_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; + __kernel_pid_t parent_pid; + __kernel_pid_t parent_tgid; +}; + +struct exit_proc_event { + __kernel_pid_t process_pid; + __kernel_pid_t process_tgid; + __u32 exit_code; + __u32 exit_signal; + __kernel_pid_t parent_pid; + __kernel_pid_t parent_tgid; +}; + +struct proc_event { + enum what what; + __u32 cpu; + __u64 timestamp_ns; + union { + struct { + __u32 err; + } ack; + struct fork_proc_event fork; + struct exec_proc_event exec; + struct id_proc_event id; + struct sid_proc_event sid; + struct ptrace_proc_event ptrace; + struct comm_proc_event comm; + struct coredump_proc_event coredump; + struct exit_proc_event exit; + } event_data; +}; + +struct local_event { + local_lock_t lock; + __u32 count; +}; + +struct component_ops { + int (*bind)(struct device *, struct device *, void *); + void (*unbind)(struct device *, struct device *, void *); +}; + +struct component_master_ops { + int (*bind)(struct device *); + void (*unbind)(struct device *); +}; + +struct component; + +struct component_match_array { + void *data; + int (*compare)(struct device *, void *); + int (*compare_typed)(struct device *, int, void *); + void (*release)(struct device *, void *); + struct component *component; + bool duplicate; +}; + +struct master; + +struct component { + struct list_head node; + struct master *master; + bool bound; + const struct component_ops *ops; + int subcomponent; + struct device *dev; +}; + +struct component_match { + size_t alloc; + size_t num; + struct component_match_array *compare; +}; + +struct master { + struct list_head node; + bool bound; + const struct component_master_ops *ops; + struct device *dev; + struct component_match *match; + struct dentry *dentry; +}; + +struct fwnode_link { + struct fwnode_handle *supplier; + struct list_head s_hook; + struct fwnode_handle *consumer; + struct list_head c_hook; +}; + +struct wake_irq { + struct device *dev; + unsigned int status; + int irq; + const char *name; +}; + +enum dpm_order { + DPM_ORDER_NONE = 0, + DPM_ORDER_DEV_AFTER_PARENT = 1, + DPM_ORDER_PARENT_BEFORE_DEV = 2, + DPM_ORDER_DEV_LAST = 3, +}; + +struct subsys_private { + struct kset subsys; + struct kset *devices_kset; + struct list_head interfaces; + struct mutex mutex; + struct kset *drivers_kset; + struct klist klist_devices; + struct klist klist_drivers; + struct blocking_notifier_head bus_notifier; + unsigned int drivers_autoprobe: 1; + struct bus_type *bus; + struct kset glue_dirs; + struct class *class; +}; + +struct driver_private { + struct kobject kobj; + struct klist klist_devices; + struct klist_node knode_bus; + struct module_kobject *mkobj; + struct device_driver *driver; +}; + +struct device_private { + struct klist klist_children; + struct klist_node knode_parent; + struct klist_node knode_driver; + struct klist_node knode_bus; + struct klist_node knode_class; + struct list_head deferred_probe; + struct device_driver *async_driver; + char *deferred_probe_reason; + struct device *device; + u8 dead: 1; +}; + +union device_attr_group_devres { + const struct attribute_group *group; + const struct attribute_group **groups; +}; + +struct class_dir { + struct kobject kobj; + struct class *class; +}; + +struct root_device { + struct device dev; + struct module *owner; +}; + +struct subsys_dev_iter { + struct klist_iter ki; + const struct device_type *type; +}; + +struct device_attach_data { + struct device *dev; + bool check_async; + bool want_async; + bool have_async; +}; + +struct class_attribute { + struct attribute attr; + ssize_t (*show)(struct class *, struct class_attribute *, char *); + ssize_t (*store)(struct class *, struct class_attribute *, const char *, size_t); +}; + +struct class_attribute_string { + struct class_attribute attr; + char *str; +}; + +struct class_compat { + struct kobject *kobj; +}; + +struct irq_affinity_devres { + unsigned int count; + unsigned int irq[0]; +}; + +struct platform_object { + struct platform_device pdev; + char name[0]; +}; + +struct cpu_attr { + struct device_attribute attr; + const struct cpumask * const map; +}; + +struct probe { + struct probe *next; + dev_t dev; + long unsigned int range; + struct module *owner; + kobj_probe_t *get; + int (*lock)(dev_t, void *); + void *data; +}; + +struct kobj_map___2 { + struct probe *probes[255]; + struct mutex *lock; +}; + +struct devres_node { + struct list_head entry; + dr_release_t release; + const char *name; + size_t size; +}; + +struct devres___2 { + struct devres_node node; + u8 data[0]; +}; + +struct devres_group { + struct devres_node node[2]; + void *id; + int color; +}; + +struct action_devres { + void *data; + void (*action)(void *); +}; + +struct pages_devres { + long unsigned int addr; + unsigned int order; +}; + +struct attribute_container { + struct list_head node; + struct klist containers; + struct class *class; + const struct attribute_group *grp; + struct device_attribute **attrs; + int (*match)(struct attribute_container *, struct device *); + long unsigned int flags; +}; + +struct internal_container { + struct klist_node node; + struct attribute_container *cont; + struct device classdev; +}; + +struct transport_container; + +struct transport_class { + struct class class; + int (*setup)(struct transport_container *, struct device *, struct device *); + int (*configure)(struct transport_container *, struct device *, struct device *); + int (*remove)(struct transport_container *, struct device *, struct device *); +}; + +struct transport_container { + struct attribute_container ac; + const struct attribute_group *statistics; +}; + +struct anon_transport_class { + struct transport_class tclass; + struct attribute_container container; +}; + +typedef void * (*devcon_match_fn_t)(struct fwnode_handle *, const char *, void *); + +struct mii_bus; + +struct mdio_device { + struct device dev; + struct mii_bus *bus; + char modalias[32]; + int (*bus_match)(struct device *, struct device_driver *); + void (*device_free)(struct mdio_device *); + void (*device_remove)(struct mdio_device *); + int addr; + int flags; + struct gpio_desc___2 *reset_gpio; + struct reset_control___2 *reset_ctrl; + unsigned int reset_assert_delay; + unsigned int reset_deassert_delay; +}; + +struct phy_c45_device_ids { + u32 devices_in_package; + u32 mmds_present; + u32 device_ids[32]; +}; + +enum phy_state { + PHY_DOWN = 0, + PHY_READY = 1, + PHY_HALTED = 2, + PHY_UP = 3, + PHY_RUNNING = 4, + PHY_NOLINK = 5, + PHY_CABLETEST = 6, +}; + +typedef enum { + PHY_INTERFACE_MODE_NA = 0, + PHY_INTERFACE_MODE_INTERNAL = 1, + PHY_INTERFACE_MODE_MII = 2, + PHY_INTERFACE_MODE_GMII = 3, + PHY_INTERFACE_MODE_SGMII = 4, + PHY_INTERFACE_MODE_TBI = 5, + PHY_INTERFACE_MODE_REVMII = 6, + PHY_INTERFACE_MODE_RMII = 7, + PHY_INTERFACE_MODE_RGMII = 8, + PHY_INTERFACE_MODE_RGMII_ID = 9, + PHY_INTERFACE_MODE_RGMII_RXID = 10, + PHY_INTERFACE_MODE_RGMII_TXID = 11, + PHY_INTERFACE_MODE_RTBI = 12, + PHY_INTERFACE_MODE_SMII = 13, + PHY_INTERFACE_MODE_XGMII = 14, + PHY_INTERFACE_MODE_XLGMII = 15, + PHY_INTERFACE_MODE_MOCA = 16, + PHY_INTERFACE_MODE_QSGMII = 17, + PHY_INTERFACE_MODE_TRGMII = 18, + PHY_INTERFACE_MODE_1000BASEX = 19, + PHY_INTERFACE_MODE_2500BASEX = 20, + PHY_INTERFACE_MODE_RXAUI = 21, + PHY_INTERFACE_MODE_XAUI = 22, + PHY_INTERFACE_MODE_10GBASER = 23, + PHY_INTERFACE_MODE_USXGMII = 24, + PHY_INTERFACE_MODE_10GKR = 25, + PHY_INTERFACE_MODE_MAX = 26, +} phy_interface_t; + +struct phylink; + +struct phy_driver; + +struct phy_led_trigger; + +struct phy_package_shared; + +struct mii_timestamper; + +struct phy_device { + struct mdio_device mdio; + struct phy_driver *drv; + u32 phy_id; + struct phy_c45_device_ids c45_ids; + unsigned int is_c45: 1; + unsigned int is_internal: 1; + unsigned int is_pseudo_fixed_link: 1; + unsigned int is_gigabit_capable: 1; + unsigned int has_fixups: 1; + unsigned int suspended: 1; + unsigned int suspended_by_mdio_bus: 1; + unsigned int sysfs_links: 1; + unsigned int loopback_enabled: 1; + unsigned int downshifted_rate: 1; + unsigned int autoneg: 1; + unsigned int link: 1; + unsigned int autoneg_complete: 1; + unsigned int interrupts: 1; + enum phy_state state; + u32 dev_flags; + phy_interface_t interface; + int speed; + int duplex; + int port; + int pause; + int asym_pause; + u8 master_slave_get; + u8 master_slave_set; + u8 master_slave_state; + long unsigned int supported[2]; + long unsigned int advertising[2]; + long unsigned int lp_advertising[2]; + long unsigned int adv_old[2]; + u32 eee_broken_modes; + struct phy_led_trigger *phy_led_triggers; + unsigned int phy_num_led_triggers; + struct phy_led_trigger *last_triggered; + struct phy_led_trigger *led_link_trigger; + int irq; + void *priv; + struct phy_package_shared *shared; + struct sk_buff *skb; + void *ehdr; + struct nlattr *nest; + struct delayed_work state_queue; + struct mutex lock; + bool sfp_bus_attached; + struct sfp_bus *sfp_bus; + struct phylink *phylink; + struct net_device *attached_dev; + struct mii_timestamper *mii_ts; + u8 mdix; + u8 mdix_ctrl; + void (*phy_link_change)(struct phy_device *, bool); + void (*adjust_link)(struct net_device *); + const struct macsec_ops *macsec_ops; +}; + +struct phy_tdr_config { + u32 first; + u32 last; + u32 step; + s8 pair; +}; + +struct mdio_bus_stats { + u64_stats_t transfers; + u64_stats_t errors; + u64_stats_t writes; + u64_stats_t reads; + struct u64_stats_sync syncp; +}; + +struct mii_bus { + struct module *owner; + const char *name; + char id[61]; + void *priv; + int (*read)(struct mii_bus *, int, int); + int (*write)(struct mii_bus *, int, int, u16); + int (*reset)(struct mii_bus *); + struct mdio_bus_stats stats[32]; + struct mutex mdio_lock; + struct device *parent; + enum { + MDIOBUS_ALLOCATED = 1, + MDIOBUS_REGISTERED = 2, + MDIOBUS_UNREGISTERED = 3, + MDIOBUS_RELEASED = 4, + } state; + struct device dev; + struct mdio_device *mdio_map[32]; + u32 phy_mask; + u32 phy_ignore_ta_mask; + int irq[32]; + int reset_delay_us; + int reset_post_delay_us; + struct gpio_desc___2 *reset_gpiod; + enum { + MDIOBUS_NO_CAP = 0, + MDIOBUS_C22 = 1, + MDIOBUS_C45 = 2, + MDIOBUS_C22_C45 = 3, + } probe_capabilities; + struct mutex shared_lock; + struct phy_package_shared *shared[32]; +}; + +struct mdio_driver_common { + struct device_driver driver; + int flags; +}; + +struct mii_timestamper { + bool (*rxtstamp)(struct mii_timestamper *, struct sk_buff *, int); + void (*txtstamp)(struct mii_timestamper *, struct sk_buff *, int); + int (*hwtstamp)(struct mii_timestamper *, struct ifreq *); + void (*link_state)(struct mii_timestamper *, struct phy_device *); + int (*ts_info)(struct mii_timestamper *, struct ethtool_ts_info *); + struct device *device; +}; + +struct phy_package_shared { + int addr; + refcount_t refcnt; + long unsigned int flags; + size_t priv_size; + void *priv; +}; + +struct phy_driver { + struct mdio_driver_common mdiodrv; + u32 phy_id; + char *name; + u32 phy_id_mask; + const long unsigned int * const features; + u32 flags; + const void *driver_data; + int (*soft_reset)(struct phy_device *); + int (*config_init)(struct phy_device *); + int (*probe)(struct phy_device *); + int (*get_features)(struct phy_device *); + int (*suspend)(struct phy_device *); + int (*resume)(struct phy_device *); + int (*config_aneg)(struct phy_device *); + int (*aneg_done)(struct phy_device *); + int (*read_status)(struct phy_device *); + int (*config_intr)(struct phy_device *); + irqreturn_t (*handle_interrupt)(struct phy_device *); + void (*remove)(struct phy_device *); + int (*match_phy_device)(struct phy_device *); + int (*set_wol)(struct phy_device *, struct ethtool_wolinfo *); + void (*get_wol)(struct phy_device *, struct ethtool_wolinfo *); + void (*link_change_notify)(struct phy_device *); + int (*read_mmd)(struct phy_device *, int, u16); + int (*write_mmd)(struct phy_device *, int, u16, u16); + int (*read_page)(struct phy_device *); + int (*write_page)(struct phy_device *, int); + int (*module_info)(struct phy_device *, struct ethtool_modinfo *); + int (*module_eeprom)(struct phy_device *, struct ethtool_eeprom *, u8 *); + int (*cable_test_start)(struct phy_device *); + int (*cable_test_tdr_start)(struct phy_device *, const struct phy_tdr_config *); + int (*cable_test_get_status)(struct phy_device *, bool *); + int (*get_sset_count)(struct phy_device *); + void (*get_strings)(struct phy_device *, u8 *); + void (*get_stats)(struct phy_device *, struct ethtool_stats *, u64 *); + int (*get_tunable)(struct phy_device *, struct ethtool_tunable *, void *); + int (*set_tunable)(struct phy_device *, struct ethtool_tunable *, const void *); + int (*set_loopback)(struct phy_device *, bool); + int (*get_sqi)(struct phy_device *); + int (*get_sqi_max)(struct phy_device *); +}; + +struct software_node; + +struct software_node_ref_args { + const struct software_node *node; + unsigned int nargs; + u64 args[8]; +}; + +struct software_node { + const char *name; + const struct software_node *parent; + const struct property_entry *properties; +}; + +struct swnode { + int id; + struct kobject kobj; + struct fwnode_handle fwnode; + const struct software_node *node; + struct ida child_ids; + struct list_head entry; + struct list_head children; + struct swnode *parent; + unsigned int allocated: 1; +}; + +struct auxiliary_device_id { + char name[32]; + kernel_ulong_t driver_data; +}; + +struct auxiliary_device { + struct device dev; + const char *name; + u32 id; +}; + +struct auxiliary_driver { + int (*probe)(struct auxiliary_device *, const struct auxiliary_device_id *); + void (*remove)(struct auxiliary_device *); + void (*shutdown)(struct auxiliary_device *); + int (*suspend)(struct auxiliary_device *, pm_message_t); + int (*resume)(struct auxiliary_device *); + const char *name; + struct device_driver driver; + const struct auxiliary_device_id *id_table; +}; + +struct req { + struct req *next; + struct completion done; + int err; + const char *name; + umode_t mode; + kuid_t uid; + kgid_t gid; + struct device *dev; +}; + +typedef int (*pm_callback_t)(struct device *); + +enum gpd_status { + GENPD_STATE_ON = 0, + GENPD_STATE_OFF = 1, +}; + +enum genpd_notication { + GENPD_NOTIFY_PRE_OFF = 0, + GENPD_NOTIFY_OFF = 1, + GENPD_NOTIFY_PRE_ON = 2, + GENPD_NOTIFY_ON = 3, +}; + +struct dev_power_governor { + bool (*power_down_ok)(struct dev_pm_domain *); + bool (*suspend_ok)(struct device *); +}; + +struct gpd_dev_ops { + int (*start)(struct device *); + int (*stop)(struct device *); +}; + +struct genpd_power_state { + s64 power_off_latency_ns; + s64 power_on_latency_ns; + s64 residency_ns; + u64 usage; + u64 rejected; + struct fwnode_handle *fwnode; + ktime_t idle_time; + void *data; +}; + +struct opp_table; + +struct dev_pm_opp; + +struct genpd_lock_ops; + +struct generic_pm_domain { + struct device dev; + struct dev_pm_domain domain; + struct list_head gpd_list_node; + struct list_head parent_links; + struct list_head child_links; + struct list_head dev_list; + struct dev_power_governor *gov; + struct work_struct power_off_work; + struct fwnode_handle *provider; + bool has_provider; + const char *name; + atomic_t sd_count; + enum gpd_status status; + unsigned int device_count; + unsigned int suspended_count; + unsigned int prepared_count; + unsigned int performance_state; + cpumask_var_t cpus; + int (*power_off)(struct generic_pm_domain *); + int (*power_on)(struct generic_pm_domain *); + struct raw_notifier_head power_notifiers; + struct opp_table *opp_table; + unsigned int (*opp_to_performance_state)(struct generic_pm_domain *, struct dev_pm_opp *); + int (*set_performance_state)(struct generic_pm_domain *, unsigned int); + struct gpd_dev_ops dev_ops; + s64 max_off_time_ns; + bool max_off_time_changed; + bool cached_power_down_ok; + bool cached_power_down_state_idx; + int (*attach_dev)(struct generic_pm_domain *, struct device *); + void (*detach_dev)(struct generic_pm_domain *, struct device *); + unsigned int flags; + struct genpd_power_state *states; + void (*free_states)(struct genpd_power_state *, unsigned int); + unsigned int state_count; + unsigned int state_idx; + ktime_t on_time; + ktime_t accounting_time; + const struct genpd_lock_ops *lock_ops; + union { + struct mutex mlock; + struct { + spinlock_t slock; + long unsigned int lock_flags; + }; + }; +}; + +struct genpd_lock_ops { + void (*lock)(struct generic_pm_domain *); + void (*lock_nested)(struct generic_pm_domain *, int); + int (*lock_interruptible)(struct generic_pm_domain *); + void (*unlock)(struct generic_pm_domain *); +}; + +struct gpd_link { + struct generic_pm_domain *parent; + struct list_head parent_node; + struct generic_pm_domain *child; + struct list_head child_node; + unsigned int performance_state; + unsigned int prev_performance_state; +}; + +struct gpd_timing_data { + s64 suspend_latency_ns; + s64 resume_latency_ns; + s64 effective_constraint_ns; + bool constraint_changed; + bool cached_suspend_ok; +}; + +struct generic_pm_domain_data { + struct pm_domain_data base; + struct gpd_timing_data td; + struct notifier_block nb; + struct notifier_block *power_nb; + int cpu; + unsigned int performance_state; + void *data; +}; + +struct pm_clk_notifier_block { + struct notifier_block nb; + struct dev_pm_domain *pm_domain; + char *con_ids[0]; +}; + +enum pce_status { + PCE_STATUS_NONE = 0, + PCE_STATUS_ACQUIRED = 1, + PCE_STATUS_ENABLED = 2, + PCE_STATUS_ERROR = 3, +}; + +struct pm_clock_entry { + struct list_head node; + char *con_id; + struct clk *clk; + enum pce_status status; +}; + +struct firmware_fallback_config { + unsigned int force_sysfs_fallback; + unsigned int ignore_sysfs_fallback; + int old_timeout; + int loading_timeout; +}; + +enum fw_opt { + FW_OPT_UEVENT = 1, + FW_OPT_NOWAIT = 2, + FW_OPT_USERHELPER = 4, + FW_OPT_NO_WARN = 8, + FW_OPT_NOCACHE = 16, + FW_OPT_NOFALLBACK_SYSFS = 32, + FW_OPT_FALLBACK_PLATFORM = 64, + FW_OPT_PARTIAL = 128, +}; + +enum fw_status { + FW_STATUS_UNKNOWN = 0, + FW_STATUS_LOADING = 1, + FW_STATUS_DONE = 2, + FW_STATUS_ABORTED = 3, +}; + +struct fw_state { + struct completion completion; + enum fw_status status; +}; + +struct firmware_cache; + +struct fw_priv { + struct kref ref; + struct list_head list; + struct firmware_cache *fwc; + struct fw_state fw_st; + void *data; + size_t size; + size_t allocated_size; + size_t offset; + u32 opt_flags; + bool is_paged_buf; + struct page **pages; + int nr_pages; + int page_array_size; + bool need_uevent; + struct list_head pending_list; + const char *fw_name; +}; + +struct firmware_cache { + spinlock_t lock; + struct list_head head; + int state; + spinlock_t name_lock; + struct list_head fw_names; + struct delayed_work work; + struct notifier_block pm_notify; +}; + +struct fw_cache_entry { + struct list_head list; + const char *name; +}; + +struct fw_name_devm { + long unsigned int magic; + const char *name; +}; + +struct firmware_work { + struct work_struct work; + struct module *module; + const char *name; + struct device *device; + void *context; + void (*cont)(const struct firmware *, void *); + u32 opt_flags; +}; + +struct fw_sysfs { + bool nowait; + struct device dev; + struct fw_priv *fw_priv; + struct firmware *fw; +}; + +struct node_access_nodes { + struct device dev; + struct list_head list_node; + unsigned int access; + struct node_hmem_attrs hmem_attrs; +}; + +struct node_cache_info { + struct device dev; + struct list_head node; + struct node_cache_attrs cache_attrs; +}; + +struct node_attr { + struct device_attribute attr; + enum node_states state; +}; + +struct for_each_memory_block_cb_data { + walk_memory_blocks_func_t func; + void *arg; +}; + +struct reg_sequence { + unsigned int reg; + unsigned int def; + unsigned int delay_us; +}; + +typedef int (*regmap_hw_write)(void *, const void *, size_t); + +typedef int (*regmap_hw_gather_write)(void *, const void *, size_t, const void *, size_t); + +struct regmap_async; + +typedef int (*regmap_hw_async_write)(void *, const void *, size_t, const void *, size_t, struct regmap_async *); + +struct regmap___2; + +struct regmap_async { + struct list_head list; + struct regmap___2 *map; + void *work_buf; +}; + +typedef int (*regmap_hw_read)(void *, const void *, size_t, void *, size_t); + +typedef int (*regmap_hw_reg_read)(void *, unsigned int, unsigned int *); + +typedef int (*regmap_hw_reg_write)(void *, unsigned int, unsigned int); + +typedef int (*regmap_hw_reg_update_bits)(void *, unsigned int, unsigned int, unsigned int); + +typedef struct regmap_async * (*regmap_hw_async_alloc)(); + +typedef void (*regmap_hw_free_context)(void *); + +struct regmap_bus { + bool fast_io; + regmap_hw_write write; + regmap_hw_gather_write gather_write; + regmap_hw_async_write async_write; + regmap_hw_reg_write reg_write; + regmap_hw_reg_update_bits reg_update_bits; + regmap_hw_read read; + regmap_hw_reg_read reg_read; + regmap_hw_free_context free_context; + regmap_hw_async_alloc async_alloc; + u8 read_flag_mask; + enum regmap_endian reg_format_endian_default; + enum regmap_endian val_format_endian_default; + size_t max_raw_read; + size_t max_raw_write; +}; + +struct reg_field { + unsigned int reg; + unsigned int lsb; + unsigned int msb; + unsigned int id_size; + unsigned int id_offset; +}; + +struct regmap_format { + size_t buf_size; + size_t reg_bytes; + size_t pad_bytes; + size_t val_bytes; + void (*format_write)(struct regmap___2 *, unsigned int, unsigned int); + void (*format_reg)(void *, unsigned int, unsigned int); + void (*format_val)(void *, unsigned int, unsigned int); + unsigned int (*parse_val)(const void *); + void (*parse_inplace)(void *); +}; + +struct hwspinlock; + +struct regcache_ops; + +struct regmap___2 { + union { + struct mutex mutex; + struct { + spinlock_t spinlock; + long unsigned int spinlock_flags; + }; + }; + regmap_lock lock; + regmap_unlock unlock; + void *lock_arg; + gfp_t alloc_flags; + struct device *dev; + void *work_buf; + struct regmap_format format; + const struct regmap_bus *bus; + void *bus_context; + const char *name; + bool async; + spinlock_t async_lock; + wait_queue_head_t async_waitq; + struct list_head async_list; + struct list_head async_free; + int async_ret; + bool debugfs_disable; + struct dentry *debugfs; + const char *debugfs_name; + unsigned int debugfs_reg_len; + unsigned int debugfs_val_len; + unsigned int debugfs_tot_len; + struct list_head debugfs_off_cache; + struct mutex cache_lock; + unsigned int max_register; + bool (*writeable_reg)(struct device *, unsigned int); + bool (*readable_reg)(struct device *, unsigned int); + bool (*volatile_reg)(struct device *, unsigned int); + bool (*precious_reg)(struct device *, unsigned int); + bool (*writeable_noinc_reg)(struct device *, unsigned int); + bool (*readable_noinc_reg)(struct device *, unsigned int); + const struct regmap_access_table *wr_table; + const struct regmap_access_table *rd_table; + const struct regmap_access_table *volatile_table; + const struct regmap_access_table *precious_table; + const struct regmap_access_table *wr_noinc_table; + const struct regmap_access_table *rd_noinc_table; + int (*reg_read)(void *, unsigned int, unsigned int *); + int (*reg_write)(void *, unsigned int, unsigned int); + int (*reg_update_bits)(void *, unsigned int, unsigned int, unsigned int); + bool defer_caching; + long unsigned int read_flag_mask; + long unsigned int write_flag_mask; + int reg_shift; + int reg_stride; + int reg_stride_order; + const struct regcache_ops *cache_ops; + enum regcache_type cache_type; + unsigned int cache_size_raw; + unsigned int cache_word_size; + unsigned int num_reg_defaults; + unsigned int num_reg_defaults_raw; + bool cache_only; + bool cache_bypass; + bool cache_free; + struct reg_default *reg_defaults; + const void *reg_defaults_raw; + void *cache; + bool cache_dirty; + bool no_sync_defaults; + struct reg_sequence *patch; + int patch_regs; + bool use_single_read; + bool use_single_write; + bool can_multi_write; + size_t max_raw_read; + size_t max_raw_write; + struct rb_root range_tree; + void *selector_work_buf; + struct hwspinlock *hwlock; + bool can_sleep; +}; + +struct regcache_ops { + const char *name; + enum regcache_type type; + int (*init)(struct regmap___2 *); + int (*exit)(struct regmap___2 *); + void (*debugfs_init)(struct regmap___2 *); + int (*read)(struct regmap___2 *, unsigned int, unsigned int *); + int (*write)(struct regmap___2 *, unsigned int, unsigned int); + int (*sync)(struct regmap___2 *, unsigned int, unsigned int); + int (*drop)(struct regmap___2 *, unsigned int, unsigned int); +}; + +struct regmap_range_node { + struct rb_node node; + const char *name; + struct regmap___2 *map; + unsigned int range_min; + unsigned int range_max; + unsigned int selector_reg; + unsigned int selector_mask; + int selector_shift; + unsigned int window_start; + unsigned int window_len; +}; + +struct regmap_field { + struct regmap___2 *regmap; + unsigned int mask; + unsigned int shift; + unsigned int reg; + unsigned int id_size; + unsigned int id_offset; +}; + +struct trace_event_raw_regmap_reg { + struct trace_entry ent; + u32 __data_loc_name; + unsigned int reg; + unsigned int val; + char __data[0]; +}; + +struct trace_event_raw_regmap_block { + struct trace_entry ent; + u32 __data_loc_name; + unsigned int reg; + int count; + char __data[0]; +}; + +struct trace_event_raw_regcache_sync { + struct trace_entry ent; + u32 __data_loc_name; + u32 __data_loc_status; + u32 __data_loc_type; + char __data[0]; +}; + +struct trace_event_raw_regmap_bool { + struct trace_entry ent; + u32 __data_loc_name; + int flag; + char __data[0]; +}; + +struct trace_event_raw_regmap_async { + struct trace_entry ent; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_regcache_drop_region { + struct trace_entry ent; + u32 __data_loc_name; + unsigned int from; + unsigned int to; + char __data[0]; +}; + +struct trace_event_data_offsets_regmap_reg { + u32 name; +}; + +struct trace_event_data_offsets_regmap_block { + u32 name; +}; + +struct trace_event_data_offsets_regcache_sync { + u32 name; + u32 status; + u32 type; +}; + +struct trace_event_data_offsets_regmap_bool { + u32 name; +}; + +struct trace_event_data_offsets_regmap_async { + u32 name; +}; + +struct trace_event_data_offsets_regcache_drop_region { + u32 name; +}; + +typedef void (*btf_trace_regmap_reg_write)(void *, struct regmap___2 *, unsigned int, unsigned int); + +typedef void (*btf_trace_regmap_reg_read)(void *, struct regmap___2 *, unsigned int, unsigned int); + +typedef void (*btf_trace_regmap_reg_read_cache)(void *, struct regmap___2 *, unsigned int, unsigned int); + +typedef void (*btf_trace_regmap_hw_read_start)(void *, struct regmap___2 *, unsigned int, int); + +typedef void (*btf_trace_regmap_hw_read_done)(void *, struct regmap___2 *, unsigned int, int); + +typedef void (*btf_trace_regmap_hw_write_start)(void *, struct regmap___2 *, unsigned int, int); + +typedef void (*btf_trace_regmap_hw_write_done)(void *, struct regmap___2 *, unsigned int, int); + +typedef void (*btf_trace_regcache_sync)(void *, struct regmap___2 *, const char *, const char *); + +typedef void (*btf_trace_regmap_cache_only)(void *, struct regmap___2 *, bool); + +typedef void (*btf_trace_regmap_cache_bypass)(void *, struct regmap___2 *, bool); + +typedef void (*btf_trace_regmap_async_write_start)(void *, struct regmap___2 *, unsigned int, int); + +typedef void (*btf_trace_regmap_async_io_complete)(void *, struct regmap___2 *); + +typedef void (*btf_trace_regmap_async_complete_start)(void *, struct regmap___2 *); + +typedef void (*btf_trace_regmap_async_complete_done)(void *, struct regmap___2 *); + +typedef void (*btf_trace_regcache_drop_region)(void *, struct regmap___2 *, unsigned int, unsigned int); + +struct regcache_rbtree_node { + void *block; + long int *cache_present; + unsigned int base_reg; + unsigned int blklen; + struct rb_node node; +}; + +struct regcache_rbtree_ctx { + struct rb_root root; + struct regcache_rbtree_node *cached_rbnode; +}; + +struct regmap_debugfs_off_cache { + struct list_head list; + off_t min; + off_t max; + unsigned int base_reg; + unsigned int max_reg; +}; + +struct regmap_debugfs_node { + struct regmap___2 *map; + struct list_head link; +}; + +struct i2c_msg { + __u16 addr; + __u16 flags; + __u16 len; + __u8 *buf; +}; + +union i2c_smbus_data { + __u8 byte; + __u16 word; + __u8 block[34]; +}; + +enum i2c_slave_event { + I2C_SLAVE_READ_REQUESTED = 0, + I2C_SLAVE_WRITE_REQUESTED = 1, + I2C_SLAVE_READ_PROCESSED = 2, + I2C_SLAVE_WRITE_RECEIVED = 3, + I2C_SLAVE_STOP = 4, +}; + +struct i2c_client; + +typedef int (*i2c_slave_cb_t)(struct i2c_client *, enum i2c_slave_event, u8 *); + +struct i2c_adapter; + +struct i2c_client { + short unsigned int flags; + short unsigned int addr; + char name[20]; + struct i2c_adapter *adapter; + struct device dev; + int init_irq; + int irq; + struct list_head detected; + i2c_slave_cb_t slave_cb; +}; + +struct i2c_algorithm; + +struct i2c_lock_operations; + +struct i2c_bus_recovery_info; + +struct i2c_adapter_quirks; + +struct i2c_adapter { + struct module *owner; + unsigned int class; + const struct i2c_algorithm *algo; + void *algo_data; + const struct i2c_lock_operations *lock_ops; + struct rt_mutex bus_lock; + struct rt_mutex mux_lock; + int timeout; + int retries; + struct device dev; + long unsigned int locked_flags; + int nr; + char name[48]; + struct completion dev_released; + struct mutex userspace_clients_lock; + struct list_head userspace_clients; + struct i2c_bus_recovery_info *bus_recovery_info; + const struct i2c_adapter_quirks *quirks; + struct irq_domain *host_notify_domain; +}; + +struct i2c_algorithm { + int (*master_xfer)(struct i2c_adapter *, struct i2c_msg *, int); + int (*master_xfer_atomic)(struct i2c_adapter *, struct i2c_msg *, int); + int (*smbus_xfer)(struct i2c_adapter *, u16, short unsigned int, char, u8, int, union i2c_smbus_data *); + int (*smbus_xfer_atomic)(struct i2c_adapter *, u16, short unsigned int, char, u8, int, union i2c_smbus_data *); + u32 (*functionality)(struct i2c_adapter *); + int (*reg_slave)(struct i2c_client *); + int (*unreg_slave)(struct i2c_client *); +}; + +struct i2c_lock_operations { + void (*lock_bus)(struct i2c_adapter *, unsigned int); + int (*trylock_bus)(struct i2c_adapter *, unsigned int); + void (*unlock_bus)(struct i2c_adapter *, unsigned int); +}; + +struct i2c_bus_recovery_info { + int (*recover_bus)(struct i2c_adapter *); + int (*get_scl)(struct i2c_adapter *); + void (*set_scl)(struct i2c_adapter *, int); + int (*get_sda)(struct i2c_adapter *); + void (*set_sda)(struct i2c_adapter *, int); + int (*get_bus_free)(struct i2c_adapter *); + void (*prepare_recovery)(struct i2c_adapter *); + void (*unprepare_recovery)(struct i2c_adapter *); + struct gpio_desc___2 *scl_gpiod; + struct gpio_desc___2 *sda_gpiod; + struct pinctrl *pinctrl; + struct pinctrl_state *pins_default; + struct pinctrl_state *pins_gpio; +}; + +struct i2c_adapter_quirks { + u64 flags; + int max_num_msgs; + u16 max_write_len; + u16 max_read_len; + u16 max_comb_1st_msg_len; + u16 max_comb_2nd_msg_len; +}; + +struct regmap_mmio_context { + void *regs; + unsigned int val_bytes; + bool relaxed_mmio; + bool attached_clk; + struct clk *clk; + void (*reg_write)(struct regmap_mmio_context *, unsigned int, unsigned int); + unsigned int (*reg_read)(struct regmap_mmio_context *, unsigned int); +}; + +struct regmap_irq_chip_data___2 { + struct mutex lock; + struct irq_chip irq_chip; + struct regmap___2 *map; + const struct regmap_irq_chip *chip; + int irq_base; + struct irq_domain *domain; + int irq; + int wake_count; + void *status_reg_buf; + unsigned int *main_status_buf; + unsigned int *status_buf; + unsigned int *mask_buf; + unsigned int *mask_buf_def; + unsigned int *wake_buf; + unsigned int *type_buf; + unsigned int *type_buf_def; + unsigned int irq_reg_stride; + unsigned int type_reg_stride; + bool clear_status: 1; +}; + +struct devcd_entry { + struct device devcd_dev; + void *data; + size_t datalen; + struct module *owner; + ssize_t (*read)(char *, loff_t, size_t, void *, size_t); + void (*free)(void *); + struct delayed_work del_wk; + struct device *failing_dev; +}; + +typedef void (*irq_write_msi_msg_t)(struct msi_desc *, struct msi_msg *); + +struct platform_msi_priv_data { + struct device *dev; + void *host_data; + msi_alloc_info_t arg; + irq_write_msi_msg_t write_msg; + int devid; +}; + +struct test_struct { + char *get; + char *put; + void (*get_handler)(char *); + int (*put_handler)(char *, char *); +}; + +struct test_state { + char *name; + struct test_struct *tst; + int idx; + int (*run_test)(int, int); + int (*validate_put)(char *); +}; + +struct i2c_device_id { + char name[20]; + kernel_ulong_t driver_data; +}; + +enum i2c_alert_protocol { + I2C_PROTOCOL_SMBUS_ALERT = 0, + I2C_PROTOCOL_SMBUS_HOST_NOTIFY = 1, +}; + +struct i2c_board_info; + +struct i2c_driver { + unsigned int class; + int (*probe)(struct i2c_client *, const struct i2c_device_id *); + int (*remove)(struct i2c_client *); + int (*probe_new)(struct i2c_client *); + void (*shutdown)(struct i2c_client *); + void (*alert)(struct i2c_client *, enum i2c_alert_protocol, unsigned int); + int (*command)(struct i2c_client *, unsigned int, void *); + struct device_driver driver; + const struct i2c_device_id *id_table; + int (*detect)(struct i2c_client *, struct i2c_board_info *); + const short unsigned int *address_list; + struct list_head clients; +}; + +struct i2c_board_info { + char type[20]; + short unsigned int flags; + short unsigned int addr; + const char *dev_name; + void *platform_data; + struct device_node *of_node; + struct fwnode_handle *fwnode; + const struct property_entry *properties; + const struct resource *resources; + unsigned int num_resources; + int irq; +}; + +struct mfd_cell_acpi_match { + const char *pnpid; + const long long unsigned int adr; +}; + +struct mfd_of_node_entry { + struct list_head list; + struct device *dev; + struct device_node *np; +}; + +enum axp20x_variants { + AXP152_ID = 0, + AXP202_ID = 1, + AXP209_ID = 2, + AXP221_ID = 3, + AXP223_ID = 4, + AXP288_ID = 5, + AXP803_ID = 6, + AXP806_ID = 7, + AXP809_ID = 8, + AXP813_ID = 9, + NR_AXP20X_VARIANTS = 10, +}; + +enum { + AXP152_IRQ_LDO0IN_CONNECT = 1, + AXP152_IRQ_LDO0IN_REMOVAL = 2, + AXP152_IRQ_ALDO0IN_CONNECT = 3, + AXP152_IRQ_ALDO0IN_REMOVAL = 4, + AXP152_IRQ_DCDC1_V_LOW = 5, + AXP152_IRQ_DCDC2_V_LOW = 6, + AXP152_IRQ_DCDC3_V_LOW = 7, + AXP152_IRQ_DCDC4_V_LOW = 8, + AXP152_IRQ_PEK_SHORT = 9, + AXP152_IRQ_PEK_LONG = 10, + AXP152_IRQ_TIMER = 11, + AXP152_IRQ_PEK_RIS_EDGE = 12, + AXP152_IRQ_PEK_FAL_EDGE = 13, + AXP152_IRQ_GPIO3_INPUT = 14, + AXP152_IRQ_GPIO2_INPUT = 15, + AXP152_IRQ_GPIO1_INPUT = 16, + AXP152_IRQ_GPIO0_INPUT = 17, +}; + +enum { + AXP20X_IRQ_ACIN_OVER_V = 1, + AXP20X_IRQ_ACIN_PLUGIN = 2, + AXP20X_IRQ_ACIN_REMOVAL = 3, + AXP20X_IRQ_VBUS_OVER_V = 4, + AXP20X_IRQ_VBUS_PLUGIN = 5, + AXP20X_IRQ_VBUS_REMOVAL = 6, + AXP20X_IRQ_VBUS_V_LOW = 7, + AXP20X_IRQ_BATT_PLUGIN = 8, + AXP20X_IRQ_BATT_REMOVAL = 9, + AXP20X_IRQ_BATT_ENT_ACT_MODE = 10, + AXP20X_IRQ_BATT_EXIT_ACT_MODE = 11, + AXP20X_IRQ_CHARG = 12, + AXP20X_IRQ_CHARG_DONE = 13, + AXP20X_IRQ_BATT_TEMP_HIGH = 14, + AXP20X_IRQ_BATT_TEMP_LOW = 15, + AXP20X_IRQ_DIE_TEMP_HIGH = 16, + AXP20X_IRQ_CHARG_I_LOW = 17, + AXP20X_IRQ_DCDC1_V_LONG = 18, + AXP20X_IRQ_DCDC2_V_LONG = 19, + AXP20X_IRQ_DCDC3_V_LONG = 20, + AXP20X_IRQ_PEK_SHORT = 22, + AXP20X_IRQ_PEK_LONG = 23, + AXP20X_IRQ_N_OE_PWR_ON = 24, + AXP20X_IRQ_N_OE_PWR_OFF = 25, + AXP20X_IRQ_VBUS_VALID = 26, + AXP20X_IRQ_VBUS_NOT_VALID = 27, + AXP20X_IRQ_VBUS_SESS_VALID = 28, + AXP20X_IRQ_VBUS_SESS_END = 29, + AXP20X_IRQ_LOW_PWR_LVL1 = 30, + AXP20X_IRQ_LOW_PWR_LVL2 = 31, + AXP20X_IRQ_TIMER = 32, + AXP20X_IRQ_PEK_RIS_EDGE = 33, + AXP20X_IRQ_PEK_FAL_EDGE = 34, + AXP20X_IRQ_GPIO3_INPUT = 35, + AXP20X_IRQ_GPIO2_INPUT = 36, + AXP20X_IRQ_GPIO1_INPUT = 37, + AXP20X_IRQ_GPIO0_INPUT = 38, +}; + +enum axp22x_irqs { + AXP22X_IRQ_ACIN_OVER_V = 1, + AXP22X_IRQ_ACIN_PLUGIN = 2, + AXP22X_IRQ_ACIN_REMOVAL = 3, + AXP22X_IRQ_VBUS_OVER_V = 4, + AXP22X_IRQ_VBUS_PLUGIN = 5, + AXP22X_IRQ_VBUS_REMOVAL = 6, + AXP22X_IRQ_VBUS_V_LOW = 7, + AXP22X_IRQ_BATT_PLUGIN = 8, + AXP22X_IRQ_BATT_REMOVAL = 9, + AXP22X_IRQ_BATT_ENT_ACT_MODE = 10, + AXP22X_IRQ_BATT_EXIT_ACT_MODE = 11, + AXP22X_IRQ_CHARG = 12, + AXP22X_IRQ_CHARG_DONE = 13, + AXP22X_IRQ_BATT_TEMP_HIGH = 14, + AXP22X_IRQ_BATT_TEMP_LOW = 15, + AXP22X_IRQ_DIE_TEMP_HIGH = 16, + AXP22X_IRQ_PEK_SHORT = 17, + AXP22X_IRQ_PEK_LONG = 18, + AXP22X_IRQ_LOW_PWR_LVL1 = 19, + AXP22X_IRQ_LOW_PWR_LVL2 = 20, + AXP22X_IRQ_TIMER = 21, + AXP22X_IRQ_PEK_RIS_EDGE = 22, + AXP22X_IRQ_PEK_FAL_EDGE = 23, + AXP22X_IRQ_GPIO1_INPUT = 24, + AXP22X_IRQ_GPIO0_INPUT = 25, +}; + +enum axp288_irqs { + AXP288_IRQ_VBUS_FALL = 2, + AXP288_IRQ_VBUS_RISE = 3, + AXP288_IRQ_OV = 4, + AXP288_IRQ_FALLING_ALT = 5, + AXP288_IRQ_RISING_ALT = 6, + AXP288_IRQ_OV_ALT = 7, + AXP288_IRQ_DONE = 10, + AXP288_IRQ_CHARGING = 11, + AXP288_IRQ_SAFE_QUIT = 12, + AXP288_IRQ_SAFE_ENTER = 13, + AXP288_IRQ_ABSENT = 14, + AXP288_IRQ_APPEND = 15, + AXP288_IRQ_QWBTU = 16, + AXP288_IRQ_WBTU = 17, + AXP288_IRQ_QWBTO = 18, + AXP288_IRQ_WBTO = 19, + AXP288_IRQ_QCBTU = 20, + AXP288_IRQ_CBTU = 21, + AXP288_IRQ_QCBTO = 22, + AXP288_IRQ_CBTO = 23, + AXP288_IRQ_WL2 = 24, + AXP288_IRQ_WL1 = 25, + AXP288_IRQ_GPADC = 26, + AXP288_IRQ_OT = 31, + AXP288_IRQ_GPIO0 = 32, + AXP288_IRQ_GPIO1 = 33, + AXP288_IRQ_POKO = 34, + AXP288_IRQ_POKL = 35, + AXP288_IRQ_POKS = 36, + AXP288_IRQ_POKN = 37, + AXP288_IRQ_POKP = 38, + AXP288_IRQ_TIMER = 39, + AXP288_IRQ_MV_CHNG = 40, + AXP288_IRQ_BC_USB_CHNG = 41, +}; + +enum axp803_irqs { + AXP803_IRQ_ACIN_OVER_V = 1, + AXP803_IRQ_ACIN_PLUGIN = 2, + AXP803_IRQ_ACIN_REMOVAL = 3, + AXP803_IRQ_VBUS_OVER_V = 4, + AXP803_IRQ_VBUS_PLUGIN = 5, + AXP803_IRQ_VBUS_REMOVAL = 6, + AXP803_IRQ_BATT_PLUGIN = 7, + AXP803_IRQ_BATT_REMOVAL = 8, + AXP803_IRQ_BATT_ENT_ACT_MODE = 9, + AXP803_IRQ_BATT_EXIT_ACT_MODE = 10, + AXP803_IRQ_CHARG = 11, + AXP803_IRQ_CHARG_DONE = 12, + AXP803_IRQ_BATT_CHG_TEMP_HIGH = 13, + AXP803_IRQ_BATT_CHG_TEMP_HIGH_END = 14, + AXP803_IRQ_BATT_CHG_TEMP_LOW = 15, + AXP803_IRQ_BATT_CHG_TEMP_LOW_END = 16, + AXP803_IRQ_BATT_ACT_TEMP_HIGH = 17, + AXP803_IRQ_BATT_ACT_TEMP_HIGH_END = 18, + AXP803_IRQ_BATT_ACT_TEMP_LOW = 19, + AXP803_IRQ_BATT_ACT_TEMP_LOW_END = 20, + AXP803_IRQ_DIE_TEMP_HIGH = 21, + AXP803_IRQ_GPADC = 22, + AXP803_IRQ_LOW_PWR_LVL1 = 23, + AXP803_IRQ_LOW_PWR_LVL2 = 24, + AXP803_IRQ_TIMER = 25, + AXP803_IRQ_PEK_RIS_EDGE = 26, + AXP803_IRQ_PEK_FAL_EDGE = 27, + AXP803_IRQ_PEK_SHORT = 28, + AXP803_IRQ_PEK_LONG = 29, + AXP803_IRQ_PEK_OVER_OFF = 30, + AXP803_IRQ_GPIO1_INPUT = 31, + AXP803_IRQ_GPIO0_INPUT = 32, + AXP803_IRQ_BC_USB_CHNG = 33, + AXP803_IRQ_MV_CHNG = 34, +}; + +enum axp806_irqs { + AXP806_IRQ_DIE_TEMP_HIGH_LV1 = 0, + AXP806_IRQ_DIE_TEMP_HIGH_LV2 = 1, + AXP806_IRQ_DCDCA_V_LOW = 2, + AXP806_IRQ_DCDCB_V_LOW = 3, + AXP806_IRQ_DCDCC_V_LOW = 4, + AXP806_IRQ_DCDCD_V_LOW = 5, + AXP806_IRQ_DCDCE_V_LOW = 6, + AXP806_IRQ_POK_LONG = 7, + AXP806_IRQ_POK_SHORT = 8, + AXP806_IRQ_WAKEUP = 9, + AXP806_IRQ_POK_FALL = 10, + AXP806_IRQ_POK_RISE = 11, +}; + +enum axp809_irqs { + AXP809_IRQ_ACIN_OVER_V = 1, + AXP809_IRQ_ACIN_PLUGIN = 2, + AXP809_IRQ_ACIN_REMOVAL = 3, + AXP809_IRQ_VBUS_OVER_V = 4, + AXP809_IRQ_VBUS_PLUGIN = 5, + AXP809_IRQ_VBUS_REMOVAL = 6, + AXP809_IRQ_VBUS_V_LOW = 7, + AXP809_IRQ_BATT_PLUGIN = 8, + AXP809_IRQ_BATT_REMOVAL = 9, + AXP809_IRQ_BATT_ENT_ACT_MODE = 10, + AXP809_IRQ_BATT_EXIT_ACT_MODE = 11, + AXP809_IRQ_CHARG = 12, + AXP809_IRQ_CHARG_DONE = 13, + AXP809_IRQ_BATT_CHG_TEMP_HIGH = 14, + AXP809_IRQ_BATT_CHG_TEMP_HIGH_END = 15, + AXP809_IRQ_BATT_CHG_TEMP_LOW = 16, + AXP809_IRQ_BATT_CHG_TEMP_LOW_END = 17, + AXP809_IRQ_BATT_ACT_TEMP_HIGH = 18, + AXP809_IRQ_BATT_ACT_TEMP_HIGH_END = 19, + AXP809_IRQ_BATT_ACT_TEMP_LOW = 20, + AXP809_IRQ_BATT_ACT_TEMP_LOW_END = 21, + AXP809_IRQ_DIE_TEMP_HIGH = 22, + AXP809_IRQ_LOW_PWR_LVL1 = 23, + AXP809_IRQ_LOW_PWR_LVL2 = 24, + AXP809_IRQ_TIMER = 25, + AXP809_IRQ_PEK_RIS_EDGE = 26, + AXP809_IRQ_PEK_FAL_EDGE = 27, + AXP809_IRQ_PEK_SHORT = 28, + AXP809_IRQ_PEK_LONG = 29, + AXP809_IRQ_PEK_OVER_OFF = 30, + AXP809_IRQ_GPIO1_INPUT = 31, + AXP809_IRQ_GPIO0_INPUT = 32, +}; + +struct intel_lpss_platform_info { + struct resource *mem; + int irq; + long unsigned int clk_rate; + const char *clk_con_id; + struct property_entry *properties; +}; + +enum intel_lpss_dev_type { + LPSS_DEV_I2C = 0, + LPSS_DEV_UART = 1, + LPSS_DEV_SPI = 2, +}; + +struct intel_lpss { + const struct intel_lpss_platform_info *info; + enum intel_lpss_dev_type type; + struct clk *clk; + struct clk_lookup *clock; + struct mfd_cell *cell; + struct device *dev; + void *priv; + u32 priv_ctx[64]; + int devid; + u32 caps; + u32 active_ltr; + u32 idle_ltr; + struct dentry *debugfs; +}; + +struct intel_msic_ocd_pdata { + unsigned int gpio; +}; + +struct intel_msic_platform_data { + int irq[9]; + struct intel_msic_gpio_pdata *gpio; + struct intel_msic_ocd_pdata *ocd; +}; + +struct intel_msic___2 { + struct platform_device *pdev; + unsigned int vendor; + unsigned int version; + void *irq_base; +}; + +struct syscon_platform_data { + const char *label; +}; + +struct syscon { + struct device_node *np; + struct regmap *regmap; + struct list_head list; +}; + +struct intel_soc_pmic_config { + long unsigned int irq_flags; + struct mfd_cell *cell_dev; + int n_cell_devs; + const struct regmap_config *regmap_config; + const struct regmap_irq_chip *irq_chip; +}; + +enum { + CHT_WC_PWRSRC_IRQ = 0, + CHT_WC_THRM_IRQ = 1, + CHT_WC_BCU_IRQ = 2, + CHT_WC_ADC_IRQ = 3, + CHT_WC_EXT_CHGR_IRQ = 4, + CHT_WC_GPIO_IRQ = 5, + CHT_WC_CRIT_IRQ = 7, +}; + +struct dax_operations { + long int (*direct_access)(struct dax_device *, long unsigned int, long int, void **, pfn_t *); + bool (*dax_supported)(struct dax_device *, struct block_device *, int, sector_t, sector_t); + size_t (*copy_from_iter)(struct dax_device *, long unsigned int, void *, size_t, struct iov_iter *); + size_t (*copy_to_iter)(struct dax_device *, long unsigned int, void *, size_t, struct iov_iter *); + int (*zero_page_range)(struct dax_device *, long unsigned int, size_t); +}; + +struct dax_device { + struct hlist_node list; + struct inode inode; + struct cdev cdev; + const char *host; + void *private; + long unsigned int flags; + const struct dax_operations *ops; +}; + +enum dax_device_flags { + DAXDEV_ALIVE = 0, + DAXDEV_WRITE_CACHE = 1, + DAXDEV_SYNC = 2, +}; + +struct dax_region { + int id; + int target_node; + struct kref kref; + struct device *dev; + unsigned int align; + struct ida ida; + struct resource res; + struct device *seed; + struct device *youngest; +}; + +struct dax_mapping { + struct device dev; + int range_id; + int id; +}; + +struct dev_dax_range { + long unsigned int pgoff; + struct range range; + struct dax_mapping *mapping; +}; + +struct dev_dax { + struct dax_region *region; + struct dax_device *dax_dev; + unsigned int align; + int target_node; + int id; + struct ida ida; + struct device dev; + struct dev_pagemap *pgmap; + int nr_range; + struct dev_dax_range *ranges; +}; + +enum dev_dax_subsys { + DEV_DAX_BUS = 0, + DEV_DAX_CLASS = 1, +}; + +struct dev_dax_data { + struct dax_region *dax_region; + struct dev_pagemap *pgmap; + enum dev_dax_subsys subsys; + resource_size_t size; + int id; +}; + +struct dax_device_driver { + struct device_driver drv; + struct list_head ids; + int match_always; + int (*probe)(struct dev_dax *); + int (*remove)(struct dev_dax *); +}; + +struct dax_id { + struct list_head list; + char dev_name[30]; +}; + +enum id_action { + ID_REMOVE = 0, + ID_ADD = 1, +}; + +struct memregion_info { + int target_node; +}; + +struct seqcount_ww_mutex { + seqcount_t seqcount; +}; + +typedef struct seqcount_ww_mutex seqcount_ww_mutex_t; + +struct dma_buf_map { + union { + void *vaddr_iomem; + void *vaddr; + }; + bool is_iomem; +}; + +struct dma_fence_ops; + +struct dma_fence { + spinlock_t *lock; + const struct dma_fence_ops *ops; + union { + struct list_head cb_list; + ktime_t timestamp; + struct callback_head rcu; + }; + u64 context; + u64 seqno; + long unsigned int flags; + struct kref refcount; + int error; +}; + +struct dma_fence_ops { + bool use_64bit_seqno; + const char * (*get_driver_name)(struct dma_fence *); + const char * (*get_timeline_name)(struct dma_fence *); + bool (*enable_signaling)(struct dma_fence *); + bool (*signaled)(struct dma_fence *); + long int (*wait)(struct dma_fence *, bool, long int); + void (*release)(struct dma_fence *); + void (*fence_value_str)(struct dma_fence *, char *, int); + void (*timeline_value_str)(struct dma_fence *, char *, int); +}; + +enum dma_fence_flag_bits { + DMA_FENCE_FLAG_SIGNALED_BIT = 0, + DMA_FENCE_FLAG_TIMESTAMP_BIT = 1, + DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT = 2, + DMA_FENCE_FLAG_USER_BITS = 3, +}; + +struct dma_fence_cb; + +typedef void (*dma_fence_func_t)(struct dma_fence *, struct dma_fence_cb *); + +struct dma_fence_cb { + struct list_head node; + dma_fence_func_t func; +}; + +struct dma_buf; + +struct dma_buf_attachment; + +struct dma_buf_ops { + bool cache_sgt_mapping; + int (*attach)(struct dma_buf *, struct dma_buf_attachment *); + void (*detach)(struct dma_buf *, struct dma_buf_attachment *); + int (*pin)(struct dma_buf_attachment *); + void (*unpin)(struct dma_buf_attachment *); + struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *, enum dma_data_direction); + void (*unmap_dma_buf)(struct dma_buf_attachment *, struct sg_table *, enum dma_data_direction); + void (*release)(struct dma_buf *); + int (*begin_cpu_access)(struct dma_buf *, enum dma_data_direction); + int (*end_cpu_access)(struct dma_buf *, enum dma_data_direction); + int (*mmap)(struct dma_buf *, struct vm_area_struct *); + int (*vmap)(struct dma_buf *, struct dma_buf_map *); + void (*vunmap)(struct dma_buf *, struct dma_buf_map *); +}; + +struct dma_buf_poll_cb_t { + struct dma_fence_cb cb; + wait_queue_head_t *poll; + __poll_t active; +}; + +struct dma_resv; + +struct dma_buf { + size_t size; + struct file *file; + struct list_head attachments; + const struct dma_buf_ops *ops; + struct mutex lock; + unsigned int vmapping_counter; + struct dma_buf_map vmap_ptr; + const char *exp_name; + const char *name; + spinlock_t name_lock; + struct module *owner; + struct list_head list_node; + void *priv; + struct dma_resv *resv; + wait_queue_head_t poll; + struct dma_buf_poll_cb_t cb_excl; + struct dma_buf_poll_cb_t cb_shared; +}; + +struct dma_buf_attach_ops; + +struct dma_buf_attachment { + struct dma_buf *dmabuf; + struct device *dev; + struct list_head node; + struct sg_table *sgt; + enum dma_data_direction dir; + bool peer2peer; + const struct dma_buf_attach_ops *importer_ops; + void *importer_priv; + void *priv; +}; + +struct dma_resv_list; + +struct dma_resv { + struct ww_mutex lock; + seqcount_ww_mutex_t seq; + struct dma_fence *fence_excl; + struct dma_resv_list *fence; +}; + +struct dma_buf_attach_ops { + bool allow_peer2peer; + void (*move_notify)(struct dma_buf_attachment *); +}; + +struct dma_buf_export_info { + const char *exp_name; + struct module *owner; + const struct dma_buf_ops *ops; + size_t size; + int flags; + struct dma_resv *resv; + void *priv; +}; + +struct dma_resv_list { + struct callback_head rcu; + u32 shared_count; + u32 shared_max; + struct dma_fence *shared[0]; +}; + +struct dma_buf_sync { + __u64 flags; +}; + +struct dma_buf_list { + struct list_head head; + struct mutex lock; +}; + +struct trace_event_raw_dma_fence { + struct trace_entry ent; + u32 __data_loc_driver; + u32 __data_loc_timeline; + unsigned int context; + unsigned int seqno; + char __data[0]; +}; + +struct trace_event_data_offsets_dma_fence { + u32 driver; + u32 timeline; +}; + +typedef void (*btf_trace_dma_fence_emit)(void *, struct dma_fence *); + +typedef void (*btf_trace_dma_fence_init)(void *, struct dma_fence *); + +typedef void (*btf_trace_dma_fence_destroy)(void *, struct dma_fence *); + +typedef void (*btf_trace_dma_fence_enable_signal)(void *, struct dma_fence *); + +typedef void (*btf_trace_dma_fence_signaled)(void *, struct dma_fence *); + +typedef void (*btf_trace_dma_fence_wait_start)(void *, struct dma_fence *); + +typedef void (*btf_trace_dma_fence_wait_end)(void *, struct dma_fence *); + +struct default_wait_cb { + struct dma_fence_cb base; + struct task_struct *task; +}; + +struct dma_fence_array; + +struct dma_fence_array_cb { + struct dma_fence_cb cb; + struct dma_fence_array *array; +}; + +struct dma_fence_array { + struct dma_fence base; + spinlock_t lock; + unsigned int num_fences; + atomic_t num_pending; + struct dma_fence **fences; + struct irq_work work; +}; + +struct dma_fence_chain { + struct dma_fence base; + spinlock_t lock; + struct dma_fence *prev; + u64 prev_seqno; + struct dma_fence *fence; + struct dma_fence_cb cb; + struct irq_work work; +}; + +enum seqno_fence_condition { + SEQNO_FENCE_WAIT_GEQUAL = 0, + SEQNO_FENCE_WAIT_NONZERO = 1, +}; + +struct seqno_fence { + struct dma_fence base; + const struct dma_fence_ops *ops; + struct dma_buf *sync_buf; + uint32_t seqno_ofs; + enum seqno_fence_condition condition; +}; + +struct dma_heap; + +struct dma_heap_ops { + int (*allocate)(struct dma_heap *, long unsigned int, long unsigned int, long unsigned int); +}; + +struct dma_heap { + const char *name; + const struct dma_heap_ops *ops; + void *priv; + dev_t heap_devt; + struct list_head list; + struct cdev heap_cdev; +}; + +struct dma_heap_export_info { + const char *name; + const struct dma_heap_ops *ops; + void *priv; +}; + +struct dma_heap_allocation_data { + __u64 len; + __u32 fd; + __u32 fd_flags; + __u64 heap_flags; +}; + +struct system_heap_buffer { + struct dma_heap *heap; + struct list_head attachments; + struct mutex lock; + long unsigned int len; + struct sg_table sg_table; + int vmap_cnt; + void *vaddr; +}; + +struct dma_heap_attachment { + struct device *dev; + struct sg_table *table; + struct list_head list; + bool mapped; +}; + +struct cma_heap { + struct dma_heap *heap; + struct cma *cma; +}; + +struct cma_heap_buffer { + struct cma_heap *heap; + struct list_head attachments; + struct mutex lock; + long unsigned int len; + struct page *cma_pages; + struct page **pages; + long unsigned int pagecount; + int vmap_cnt; + void *vaddr; +}; + +struct dma_heap_attachment___2 { + struct device *dev; + struct sg_table table; + struct list_head list; + bool mapped; +}; + +struct sync_file { + struct file *file; + char user_name[32]; + struct list_head sync_file_list; + wait_queue_head_t wq; + long unsigned int flags; + struct dma_fence *fence; + struct dma_fence_cb cb; +}; + +struct sync_merge_data { + char name[32]; + __s32 fd2; + __s32 fence; + __u32 flags; + __u32 pad; +}; + +struct sync_fence_info { + char obj_name[32]; + char driver_name[32]; + __s32 status; + __u32 flags; + __u64 timestamp_ns; +}; + +struct sync_file_info { + char name[32]; + __s32 status; + __u32 flags; + __u32 num_fences; + __u32 pad; + __u64 sync_fence_info; +}; + +struct udmabuf_create { + __u32 memfd; + __u32 flags; + __u64 offset; + __u64 size; +}; + +struct udmabuf_create_item { + __u32 memfd; + __u32 __pad; + __u64 offset; + __u64 size; +}; + +struct udmabuf_create_list { + __u32 flags; + __u32 count; + struct udmabuf_create_item list[0]; +}; + +struct udmabuf { + long unsigned int pagecount; + struct page **pages; + struct sg_table *sg; + struct miscdevice *device; +}; + +typedef __u64 blist_flags_t; + +enum scsi_device_state { + SDEV_CREATED = 1, + SDEV_RUNNING = 2, + SDEV_CANCEL = 3, + SDEV_DEL = 4, + SDEV_QUIESCE = 5, + SDEV_OFFLINE = 6, + SDEV_TRANSPORT_OFFLINE = 7, + SDEV_BLOCK = 8, + SDEV_CREATED_BLOCK = 9, +}; + +struct scsi_vpd { + struct callback_head rcu; + int len; + unsigned char data[0]; +}; + +struct Scsi_Host; + +struct scsi_target; + +struct scsi_device_handler; + +struct scsi_device { + struct Scsi_Host *host; + struct request_queue *request_queue; + struct list_head siblings; + struct list_head same_target_siblings; + atomic_t device_busy; + atomic_t device_blocked; + atomic_t restarts; + spinlock_t list_lock; + struct list_head starved_entry; + short unsigned int queue_depth; + short unsigned int max_queue_depth; + short unsigned int last_queue_full_depth; + short unsigned int last_queue_full_count; + long unsigned int last_queue_full_time; + long unsigned int queue_ramp_up_period; + long unsigned int last_queue_ramp_up; + unsigned int id; + unsigned int channel; + u64 lun; + unsigned int manufacturer; + unsigned int sector_size; + void *hostdata; + unsigned char type; + char scsi_level; + char inq_periph_qual; + struct mutex inquiry_mutex; + unsigned char inquiry_len; + unsigned char *inquiry; + const char *vendor; + const char *model; + const char *rev; + struct scsi_vpd *vpd_pg0; + struct scsi_vpd *vpd_pg83; + struct scsi_vpd *vpd_pg80; + struct scsi_vpd *vpd_pg89; + unsigned char current_tag; + struct scsi_target *sdev_target; + blist_flags_t sdev_bflags; + unsigned int eh_timeout; + unsigned int removable: 1; + unsigned int changed: 1; + unsigned int busy: 1; + unsigned int lockable: 1; + unsigned int locked: 1; + unsigned int borken: 1; + unsigned int disconnect: 1; + unsigned int soft_reset: 1; + unsigned int sdtr: 1; + unsigned int wdtr: 1; + unsigned int ppr: 1; + unsigned int tagged_supported: 1; + unsigned int simple_tags: 1; + unsigned int was_reset: 1; + unsigned int expecting_cc_ua: 1; + unsigned int use_10_for_rw: 1; + unsigned int use_10_for_ms: 1; + unsigned int set_dbd_for_ms: 1; + unsigned int no_report_opcodes: 1; + unsigned int no_write_same: 1; + unsigned int use_16_for_rw: 1; + unsigned int skip_ms_page_8: 1; + unsigned int skip_ms_page_3f: 1; + unsigned int skip_vpd_pages: 1; + unsigned int try_vpd_pages: 1; + unsigned int use_192_bytes_for_3f: 1; + unsigned int no_start_on_add: 1; + unsigned int allow_restart: 1; + unsigned int manage_start_stop: 1; + unsigned int start_stop_pwr_cond: 1; + unsigned int no_uld_attach: 1; + unsigned int select_no_atn: 1; + unsigned int fix_capacity: 1; + unsigned int guess_capacity: 1; + unsigned int retry_hwerror: 1; + unsigned int last_sector_bug: 1; + unsigned int no_read_disc_info: 1; + unsigned int no_read_capacity_16: 1; + unsigned int try_rc_10_first: 1; + unsigned int security_supported: 1; + unsigned int is_visible: 1; + unsigned int wce_default_on: 1; + unsigned int no_dif: 1; + unsigned int broken_fua: 1; + unsigned int lun_in_cdb: 1; + unsigned int unmap_limit_for_ws: 1; + unsigned int rpm_autosuspend: 1; + bool offline_already; + atomic_t disk_events_disable_depth; + long unsigned int supported_events[1]; + long unsigned int pending_events[1]; + struct list_head event_list; + struct work_struct event_work; + unsigned int max_device_blocked; + atomic_t iorequest_cnt; + atomic_t iodone_cnt; + atomic_t ioerr_cnt; + struct device sdev_gendev; + struct device sdev_dev; + struct execute_work ew; + struct work_struct requeue_work; + struct scsi_device_handler *handler; + void *handler_data; + size_t dma_drain_len; + void *dma_drain_buf; + unsigned char access_state; + struct mutex state_mutex; + enum scsi_device_state sdev_state; + struct task_struct *quiesced_by; + long unsigned int sdev_data[0]; +}; + +enum scsi_host_state { + SHOST_CREATED = 1, + SHOST_RUNNING = 2, + SHOST_CANCEL = 3, + SHOST_DEL = 4, + SHOST_RECOVERY = 5, + SHOST_CANCEL_RECOVERY = 6, + SHOST_DEL_RECOVERY = 7, +}; + +struct scsi_host_template; + +struct scsi_transport_template; + +struct Scsi_Host { + struct list_head __devices; + struct list_head __targets; + struct list_head starved_list; + spinlock_t default_lock; + spinlock_t *host_lock; + struct mutex scan_mutex; + struct list_head eh_cmd_q; + struct task_struct *ehandler; + struct completion *eh_action; + wait_queue_head_t host_wait; + struct scsi_host_template *hostt; + struct scsi_transport_template *transportt; + struct blk_mq_tag_set tag_set; + atomic_t host_blocked; + unsigned int host_failed; + unsigned int host_eh_scheduled; + unsigned int host_no; + int eh_deadline; + long unsigned int last_reset; + unsigned int max_channel; + unsigned int max_id; + u64 max_lun; + unsigned int unique_id; + short unsigned int max_cmd_len; + int this_id; + int can_queue; + short int cmd_per_lun; + short unsigned int sg_tablesize; + short unsigned int sg_prot_tablesize; + unsigned int max_sectors; + unsigned int max_segment_size; + long unsigned int dma_boundary; + long unsigned int virt_boundary_mask; + unsigned int nr_hw_queues; + unsigned int active_mode: 2; + unsigned int unchecked_isa_dma: 1; + unsigned int host_self_blocked: 1; + unsigned int reverse_ordering: 1; + unsigned int tmf_in_progress: 1; + unsigned int async_scan: 1; + unsigned int eh_noresume: 1; + unsigned int no_write_same: 1; + unsigned int host_tagset: 1; + unsigned int short_inquiry: 1; + unsigned int no_scsi2_lun_in_cdb: 1; + char work_q_name[20]; + struct workqueue_struct *work_q; + struct workqueue_struct *tmf_work_q; + unsigned int max_host_blocked; + unsigned int prot_capabilities; + unsigned char prot_guard_type; + long unsigned int base; + long unsigned int io_port; + unsigned char n_io_port; + unsigned char dma_channel; + unsigned int irq; + enum scsi_host_state shost_state; + struct device shost_gendev; + struct device shost_dev; + void *shost_data; + struct device *dma_dev; + long unsigned int hostdata[0]; +}; + +enum scsi_target_state { + STARGET_CREATED = 1, + STARGET_RUNNING = 2, + STARGET_REMOVE = 3, + STARGET_CREATED_REMOVE = 4, + STARGET_DEL = 5, +}; + +struct scsi_target { + struct scsi_device *starget_sdev_user; + struct list_head siblings; + struct list_head devices; + struct device dev; + struct kref reap_ref; + unsigned int channel; + unsigned int id; + unsigned int create: 1; + unsigned int single_lun: 1; + unsigned int pdt_1f_for_no_lun: 1; + unsigned int no_report_luns: 1; + unsigned int expecting_lun_change: 1; + atomic_t target_busy; + atomic_t target_blocked; + unsigned int can_queue; + unsigned int max_target_blocked; + char scsi_level; + enum scsi_target_state state; + void *hostdata; + long unsigned int starget_data[0]; +}; + +struct scsi_data_buffer { + struct sg_table table; + unsigned int length; +}; + +struct scsi_pointer { + char *ptr; + int this_residual; + struct scatterlist *buffer; + int buffers_residual; + dma_addr_t dma_handle; + volatile int Status; + volatile int Message; + volatile int have_data_in; + volatile int sent_command; + volatile int phase; +}; + +struct scsi_cmnd { + struct scsi_request req; + struct scsi_device *device; + struct list_head eh_entry; + struct delayed_work abort_work; + struct callback_head rcu; + int eh_eflags; + long unsigned int jiffies_at_alloc; + int retries; + int allowed; + unsigned char prot_op; + unsigned char prot_type; + unsigned char prot_flags; + short unsigned int cmd_len; + enum dma_data_direction sc_data_direction; + unsigned char *cmnd; + struct scsi_data_buffer sdb; + struct scsi_data_buffer *prot_sdb; + unsigned int underflow; + unsigned int transfersize; + struct request *request; + unsigned char *sense_buffer; + void (*scsi_done)(struct scsi_cmnd *); + struct scsi_pointer SCp; + unsigned char *host_scribble; + int result; + int flags; + long unsigned int state; + unsigned char tag; + unsigned int extra_len; +}; + +enum scsi_prot_operations { + SCSI_PROT_NORMAL = 0, + SCSI_PROT_READ_INSERT = 1, + SCSI_PROT_WRITE_STRIP = 2, + SCSI_PROT_READ_STRIP = 3, + SCSI_PROT_WRITE_INSERT = 4, + SCSI_PROT_READ_PASS = 5, + SCSI_PROT_WRITE_PASS = 6, +}; + +struct scsi_driver { + struct device_driver gendrv; + void (*rescan)(struct device *); + blk_status_t (*init_command)(struct scsi_cmnd *); + void (*uninit_command)(struct scsi_cmnd *); + int (*done)(struct scsi_cmnd *); + int (*eh_action)(struct scsi_cmnd *, int); + void (*eh_reset)(struct scsi_cmnd *); +}; + +struct scsi_host_cmd_pool; + +struct scsi_host_template { + struct module *module; + const char *name; + const char * (*info)(struct Scsi_Host *); + int (*ioctl)(struct scsi_device *, unsigned int, void *); + int (*compat_ioctl)(struct scsi_device *, unsigned int, void *); + int (*init_cmd_priv)(struct Scsi_Host *, struct scsi_cmnd *); + int (*exit_cmd_priv)(struct Scsi_Host *, struct scsi_cmnd *); + int (*queuecommand)(struct Scsi_Host *, struct scsi_cmnd *); + void (*commit_rqs)(struct Scsi_Host *, u16); + int (*eh_abort_handler)(struct scsi_cmnd *); + int (*eh_device_reset_handler)(struct scsi_cmnd *); + int (*eh_target_reset_handler)(struct scsi_cmnd *); + int (*eh_bus_reset_handler)(struct scsi_cmnd *); + int (*eh_host_reset_handler)(struct scsi_cmnd *); + int (*slave_alloc)(struct scsi_device *); + int (*slave_configure)(struct scsi_device *); + void (*slave_destroy)(struct scsi_device *); + int (*target_alloc)(struct scsi_target *); + void (*target_destroy)(struct scsi_target *); + int (*scan_finished)(struct Scsi_Host *, long unsigned int); + void (*scan_start)(struct Scsi_Host *); + int (*change_queue_depth)(struct scsi_device *, int); + int (*map_queues)(struct Scsi_Host *); + bool (*dma_need_drain)(struct request *); + int (*bios_param)(struct scsi_device *, struct block_device *, sector_t, int *); + void (*unlock_native_capacity)(struct scsi_device *); + int (*show_info)(struct seq_file *, struct Scsi_Host *); + int (*write_info)(struct Scsi_Host *, char *, int); + enum blk_eh_timer_return (*eh_timed_out)(struct scsi_cmnd *); + int (*host_reset)(struct Scsi_Host *, int); + const char *proc_name; + struct proc_dir_entry *proc_dir; + int can_queue; + int this_id; + short unsigned int sg_tablesize; + short unsigned int sg_prot_tablesize; + unsigned int max_sectors; + unsigned int max_segment_size; + long unsigned int dma_boundary; + long unsigned int virt_boundary_mask; + short int cmd_per_lun; + unsigned char present; + int tag_alloc_policy; + unsigned int track_queue_depth: 1; + unsigned int supported_mode: 2; + unsigned int unchecked_isa_dma: 1; + unsigned int emulated: 1; + unsigned int skip_settle_delay: 1; + unsigned int no_write_same: 1; + unsigned int host_tagset: 1; + unsigned int max_host_blocked; + struct device_attribute **shost_attrs; + struct device_attribute **sdev_attrs; + const struct attribute_group **sdev_groups; + u64 vendor_id; + unsigned int cmd_size; + struct scsi_host_cmd_pool *cmd_pool; + int rpm_autosuspend_delay; +}; + +struct trace_event_raw_scsi_dispatch_cmd_start { + struct trace_entry ent; + unsigned int host_no; + unsigned int channel; + unsigned int id; + unsigned int lun; + unsigned int opcode; + unsigned int cmd_len; + unsigned int data_sglen; + unsigned int prot_sglen; + unsigned char prot_op; + u32 __data_loc_cmnd; + char __data[0]; +}; + +struct trace_event_raw_scsi_dispatch_cmd_error { + struct trace_entry ent; + unsigned int host_no; + unsigned int channel; + unsigned int id; + unsigned int lun; + int rtn; + unsigned int opcode; + unsigned int cmd_len; + unsigned int data_sglen; + unsigned int prot_sglen; + unsigned char prot_op; + u32 __data_loc_cmnd; + char __data[0]; +}; + +struct trace_event_raw_scsi_cmd_done_timeout_template { + struct trace_entry ent; + unsigned int host_no; + unsigned int channel; + unsigned int id; + unsigned int lun; + int result; + unsigned int opcode; + unsigned int cmd_len; + unsigned int data_sglen; + unsigned int prot_sglen; + unsigned char prot_op; + u32 __data_loc_cmnd; + char __data[0]; +}; + +struct trace_event_raw_scsi_eh_wakeup { + struct trace_entry ent; + unsigned int host_no; + char __data[0]; +}; + +struct trace_event_data_offsets_scsi_dispatch_cmd_start { + u32 cmnd; +}; + +struct trace_event_data_offsets_scsi_dispatch_cmd_error { + u32 cmnd; +}; + +struct trace_event_data_offsets_scsi_cmd_done_timeout_template { + u32 cmnd; +}; + +struct trace_event_data_offsets_scsi_eh_wakeup {}; + +typedef void (*btf_trace_scsi_dispatch_cmd_start)(void *, struct scsi_cmnd *); + +typedef void (*btf_trace_scsi_dispatch_cmd_error)(void *, struct scsi_cmnd *, int); + +typedef void (*btf_trace_scsi_dispatch_cmd_done)(void *, struct scsi_cmnd *); + +typedef void (*btf_trace_scsi_dispatch_cmd_timeout)(void *, struct scsi_cmnd *); + +typedef void (*btf_trace_scsi_eh_wakeup)(void *, struct Scsi_Host *); + +struct scsi_transport_template { + struct transport_container host_attrs; + struct transport_container target_attrs; + struct transport_container device_attrs; + int (*user_scan)(struct Scsi_Host *, uint, uint, u64); + int device_size; + int device_private_offset; + int target_size; + int target_private_offset; + int host_size; + unsigned int create_work_queue: 1; + void (*eh_strategy_handler)(struct Scsi_Host *); +}; + +struct scsi_host_busy_iter_data { + bool (*fn)(struct scsi_cmnd *, void *, bool); + void *priv; +}; + +struct scsi_idlun { + __u32 dev_id; + __u32 host_unique_id; +}; + +typedef void (*activate_complete)(void *, int); + +struct scsi_device_handler { + struct list_head list; + struct module *module; + const char *name; + int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *); + int (*attach)(struct scsi_device *); + void (*detach)(struct scsi_device *); + int (*activate)(struct scsi_device *, activate_complete, void *); + blk_status_t (*prep_fn)(struct scsi_device *, struct request *); + int (*set_params)(struct scsi_device *, const char *); + void (*rescan)(struct scsi_device *); +}; + +struct scsi_eh_save { + int result; + unsigned int resid_len; + int eh_eflags; + enum dma_data_direction data_direction; + unsigned int underflow; + unsigned char cmd_len; + unsigned char prot_op; + unsigned char *cmnd; + struct scsi_data_buffer sdb; + unsigned char eh_cmnd[16]; + struct scatterlist sense_sgl; +}; + +struct scsi_varlen_cdb_hdr { + __u8 opcode; + __u8 control; + __u8 misc[5]; + __u8 additional_cdb_length; + __be16 service_action; +}; + +struct scsi_mode_data { + __u32 length; + __u16 block_descriptor_length; + __u8 medium_type; + __u8 device_specific; + __u8 header_length; + __u8 longlba: 1; +}; + +struct scsi_event { + enum scsi_device_event evt_type; + struct list_head node; +}; + +enum scsi_host_prot_capabilities { + SHOST_DIF_TYPE1_PROTECTION = 1, + SHOST_DIF_TYPE2_PROTECTION = 2, + SHOST_DIF_TYPE3_PROTECTION = 4, + SHOST_DIX_TYPE0_PROTECTION = 8, + SHOST_DIX_TYPE1_PROTECTION = 16, + SHOST_DIX_TYPE2_PROTECTION = 32, + SHOST_DIX_TYPE3_PROTECTION = 64, +}; + +enum { + ACTION_FAIL = 0, + ACTION_REPREP = 1, + ACTION_RETRY = 2, + ACTION_DELAYED_RETRY = 3, +}; + +struct value_name_pair; + +struct sa_name_list { + int opcode; + const struct value_name_pair *arr; + int arr_sz; +}; + +struct value_name_pair { + int value; + const char *name; +}; + +struct error_info { + short unsigned int code12; + short unsigned int size; +}; + +struct error_info2 { + unsigned char code1; + unsigned char code2_min; + unsigned char code2_max; + const char *str; + const char *fmt; +}; + +struct scsi_lun { + __u8 scsi_lun[8]; +}; + +enum scsi_timeouts { + SCSI_DEFAULT_EH_TIMEOUT = 10000, +}; + +enum scsi_scan_mode { + SCSI_SCAN_INITIAL = 0, + SCSI_SCAN_RESCAN = 1, + SCSI_SCAN_MANUAL = 2, +}; + +struct async_scan_data { + struct list_head list; + struct Scsi_Host *shost; + struct completion prev_finished; +}; + +enum scsi_devinfo_key { + SCSI_DEVINFO_GLOBAL = 0, + SCSI_DEVINFO_SPI = 1, +}; + +struct scsi_dev_info_list { + struct list_head dev_info_list; + char vendor[8]; + char model[16]; + blist_flags_t flags; + unsigned int compatible; +}; + +struct scsi_dev_info_list_table { + struct list_head node; + struct list_head scsi_dev_info_list; + const char *name; + int key; +}; + +struct double_list { + struct list_head *top; + struct list_head *bottom; +}; + +struct scsi_nl_hdr { + __u8 version; + __u8 transport; + __u16 magic; + __u16 msgtype; + __u16 msglen; +}; + +enum { + SCSI_DH_OK = 0, + SCSI_DH_DEV_FAILED = 1, + SCSI_DH_DEV_TEMP_BUSY = 2, + SCSI_DH_DEV_UNSUPP = 3, + SCSI_DH_DEVICE_MAX = 4, + SCSI_DH_NOTCONN = 5, + SCSI_DH_CONN_FAILURE = 6, + SCSI_DH_TRANSPORT_MAX = 7, + SCSI_DH_IO = 8, + SCSI_DH_INVALID_IO = 9, + SCSI_DH_RETRY = 10, + SCSI_DH_IMM_RETRY = 11, + SCSI_DH_TIMED_OUT = 12, + SCSI_DH_RES_TEMP_UNAVAIL = 13, + SCSI_DH_DEV_OFFLINED = 14, + SCSI_DH_NOMEM = 15, + SCSI_DH_NOSYS = 16, + SCSI_DH_DRIVER_MAX = 17, +}; + +struct scsi_dh_blist { + const char *vendor; + const char *model; + const char *driver; +}; + +enum scsi_prot_flags { + SCSI_PROT_TRANSFER_PI = 1, + SCSI_PROT_GUARD_CHECK = 2, + SCSI_PROT_REF_CHECK = 4, + SCSI_PROT_REF_INCREMENT = 8, + SCSI_PROT_IP_CHECKSUM = 16, +}; + +enum { + SD_EXT_CDB_SIZE = 32, + SD_MEMPOOL_SIZE = 2, +}; + +enum { + SD_DEF_XFER_BLOCKS = 65535, + SD_MAX_XFER_BLOCKS = 4294967295, + SD_MAX_WS10_BLOCKS = 65535, + SD_MAX_WS16_BLOCKS = 8388607, +}; + +enum { + SD_LBP_FULL = 0, + SD_LBP_UNMAP = 1, + SD_LBP_WS16 = 2, + SD_LBP_WS10 = 3, + SD_LBP_ZERO = 4, + SD_LBP_DISABLE = 5, +}; + +enum { + SD_ZERO_WRITE = 0, + SD_ZERO_WS = 1, + SD_ZERO_WS16_UNMAP = 2, + SD_ZERO_WS10_UNMAP = 3, +}; + +struct opal_dev___2; + +struct scsi_disk { + struct scsi_driver *driver; + struct scsi_device *device; + struct device dev; + struct gendisk *disk; + struct opal_dev___2 *opal_dev; + u32 nr_zones; + u32 rev_nr_zones; + u32 zone_blocks; + u32 rev_zone_blocks; + u32 zones_optimal_open; + u32 zones_optimal_nonseq; + u32 zones_max_open; + u32 *zones_wp_offset; + spinlock_t zones_wp_offset_lock; + u32 *rev_wp_offset; + struct mutex rev_mutex; + struct work_struct zone_wp_offset_work; + char *zone_wp_update_buf; + atomic_t openers; + sector_t capacity; + int max_retries; + u32 max_xfer_blocks; + u32 opt_xfer_blocks; + u32 max_ws_blocks; + u32 max_unmap_blocks; + u32 unmap_granularity; + u32 unmap_alignment; + u32 index; + unsigned int physical_block_size; + unsigned int max_medium_access_timeouts; + unsigned int medium_access_timed_out; + u8 media_present; + u8 write_prot; + u8 protection_type; + u8 provisioning_mode; + u8 zeroing_mode; + unsigned int ATO: 1; + unsigned int cache_override: 1; + unsigned int WCE: 1; + unsigned int RCD: 1; + unsigned int DPOFUA: 1; + unsigned int first_scan: 1; + unsigned int lbpme: 1; + unsigned int lbprz: 1; + unsigned int lbpu: 1; + unsigned int lbpws: 1; + unsigned int lbpws10: 1; + unsigned int lbpvpd: 1; + unsigned int ws10: 1; + unsigned int ws16: 1; + unsigned int rc_basis: 2; + unsigned int zoned: 2; + unsigned int urswrz: 1; + unsigned int security: 1; + unsigned int ignore_medium_access_errors: 1; +}; + +enum scsi_host_guard_type { + SHOST_DIX_GUARD_CRC = 1, + SHOST_DIX_GUARD_IP = 2, +}; + +enum zbc_zone_type { + ZBC_ZONE_TYPE_CONV = 1, + ZBC_ZONE_TYPE_SEQWRITE_REQ = 2, + ZBC_ZONE_TYPE_SEQWRITE_PREF = 3, +}; + +enum zbc_zone_cond { + ZBC_ZONE_COND_NO_WP = 0, + ZBC_ZONE_COND_EMPTY = 1, + ZBC_ZONE_COND_IMP_OPEN = 2, + ZBC_ZONE_COND_EXP_OPEN = 3, + ZBC_ZONE_COND_CLOSED = 4, + ZBC_ZONE_COND_READONLY = 13, + ZBC_ZONE_COND_FULL = 14, + ZBC_ZONE_COND_OFFLINE = 15, +}; + +enum { + mechtype_caddy = 0, + mechtype_tray = 1, + mechtype_popup = 2, + mechtype_individual_changer = 4, + mechtype_cartridge_changer = 5, +}; + +struct event_header { + __be16 data_len; + __u8 notification_class: 3; + __u8 reserved1: 4; + __u8 nea: 1; + __u8 supp_event_class; +}; + +struct media_event_desc { + __u8 media_event_code: 4; + __u8 reserved1: 4; + __u8 door_open: 1; + __u8 media_present: 1; + __u8 reserved2: 6; + __u8 start_slot; + __u8 end_slot; +}; + +struct scsi_cd { + struct scsi_driver *driver; + unsigned int capacity; + struct scsi_device *device; + unsigned int vendor; + long unsigned int ms_offset; + unsigned int writeable: 1; + unsigned int use: 1; + unsigned int xa_flag: 1; + unsigned int readcd_known: 1; + unsigned int readcd_cdda: 1; + unsigned int media_present: 1; + int tur_mismatch; + bool tur_changed: 1; + bool get_event_changed: 1; + bool ignore_get_event: 1; + struct cdrom_device_info cdi; + struct mutex lock; + struct kref kref; + struct gendisk *disk; +}; + +typedef struct scsi_cd Scsi_CD; + +struct cdrom_ti { + __u8 cdti_trk0; + __u8 cdti_ind0; + __u8 cdti_trk1; + __u8 cdti_ind1; +}; + +struct cdrom_tochdr { + __u8 cdth_trk0; + __u8 cdth_trk1; +}; + +struct cdrom_tocentry { + __u8 cdte_track; + __u8 cdte_adr: 4; + __u8 cdte_ctrl: 4; + __u8 cdte_format; + union cdrom_addr cdte_addr; + __u8 cdte_datamode; +}; + +struct ccs_modesel_head { + __u8 _r1; + __u8 medium; + __u8 _r2; + __u8 block_desc_length; + __u8 density; + __u8 number_blocks_hi; + __u8 number_blocks_med; + __u8 number_blocks_lo; + __u8 _r3; + __u8 block_length_hi; + __u8 block_length_med; + __u8 block_length_lo; +}; + +typedef struct sg_io_hdr sg_io_hdr_t; + +struct sg_scsi_id { + int host_no; + int channel; + int scsi_id; + int lun; + int scsi_type; + short int h_cmd_per_lun; + short int d_queue_depth; + int unused[2]; +}; + +typedef struct sg_scsi_id sg_scsi_id_t; + +struct sg_req_info { + char req_state; + char orphan; + char sg_io_owned; + char problem; + int pack_id; + void *usr_ptr; + unsigned int duration; + int unused; +}; + +typedef struct sg_req_info sg_req_info_t; + +struct sg_header { + int pack_len; + int reply_len; + int pack_id; + int result; + unsigned int twelve_byte: 1; + unsigned int target_status: 5; + unsigned int host_status: 8; + unsigned int driver_status: 8; + unsigned int other_flags: 10; + unsigned char sense_buffer[16]; +}; + +struct sg_scatter_hold { + short unsigned int k_use_sg; + unsigned int sglist_len; + unsigned int bufflen; + struct page **pages; + int page_order; + char dio_in_use; + unsigned char cmd_opcode; +}; + +typedef struct sg_scatter_hold Sg_scatter_hold; + +struct sg_fd; + +struct sg_request { + struct list_head entry; + struct sg_fd *parentfp; + Sg_scatter_hold data; + sg_io_hdr_t header; + unsigned char sense_b[96]; + char res_used; + char orphan; + char sg_io_owned; + char done; + struct request *rq; + struct bio *bio; + struct execute_work ew; +}; + +typedef struct sg_request Sg_request; + +struct sg_device; + +struct sg_fd { + struct list_head sfd_siblings; + struct sg_device *parentdp; + wait_queue_head_t read_wait; + rwlock_t rq_list_lock; + struct mutex f_mutex; + int timeout; + int timeout_user; + Sg_scatter_hold reserve; + struct list_head rq_list; + struct fasync_struct *async_qp; + Sg_request req_arr[16]; + char force_packid; + char cmd_q; + unsigned char next_cmd_len; + char keep_orphan; + char mmap_called; + char res_in_use; + struct kref f_ref; + struct execute_work ew; +}; + +struct sg_device { + struct scsi_device *device; + wait_queue_head_t open_wait; + struct mutex open_rel_lock; + int sg_tablesize; + u32 index; + struct list_head sfds; + rwlock_t sfd_lock; + atomic_t detaching; + bool exclude; + int open_cnt; + char sgdebug; + struct gendisk *disk; + struct cdev *cdev; + struct kref d_ref; +}; + +typedef struct sg_fd Sg_fd; + +typedef struct sg_device Sg_device; + +struct compat_sg_req_info { + char req_state; + char orphan; + char sg_io_owned; + char problem; + int pack_id; + compat_uptr_t usr_ptr; + unsigned int duration; + int unused; +}; + +struct sg_proc_deviter { + loff_t index; + size_t max; +}; + +enum { + ATA_MAX_DEVICES = 2, + ATA_MAX_PRD = 256, + ATA_SECT_SIZE = 512, + ATA_MAX_SECTORS_128 = 128, + ATA_MAX_SECTORS = 256, + ATA_MAX_SECTORS_1024 = 1024, + ATA_MAX_SECTORS_LBA48 = 65535, + ATA_MAX_SECTORS_TAPE = 65535, + ATA_MAX_TRIM_RNUM = 64, + ATA_ID_WORDS = 256, + ATA_ID_CONFIG = 0, + ATA_ID_CYLS = 1, + ATA_ID_HEADS = 3, + ATA_ID_SECTORS = 6, + ATA_ID_SERNO = 10, + ATA_ID_BUF_SIZE = 21, + ATA_ID_FW_REV = 23, + ATA_ID_PROD = 27, + ATA_ID_MAX_MULTSECT = 47, + ATA_ID_DWORD_IO = 48, + ATA_ID_TRUSTED = 48, + ATA_ID_CAPABILITY = 49, + ATA_ID_OLD_PIO_MODES = 51, + ATA_ID_OLD_DMA_MODES = 52, + ATA_ID_FIELD_VALID = 53, + ATA_ID_CUR_CYLS = 54, + ATA_ID_CUR_HEADS = 55, + ATA_ID_CUR_SECTORS = 56, + ATA_ID_MULTSECT = 59, + ATA_ID_LBA_CAPACITY = 60, + ATA_ID_SWDMA_MODES = 62, + ATA_ID_MWDMA_MODES = 63, + ATA_ID_PIO_MODES = 64, + ATA_ID_EIDE_DMA_MIN = 65, + ATA_ID_EIDE_DMA_TIME = 66, + ATA_ID_EIDE_PIO = 67, + ATA_ID_EIDE_PIO_IORDY = 68, + ATA_ID_ADDITIONAL_SUPP = 69, + ATA_ID_QUEUE_DEPTH = 75, + ATA_ID_SATA_CAPABILITY = 76, + ATA_ID_SATA_CAPABILITY_2 = 77, + ATA_ID_FEATURE_SUPP = 78, + ATA_ID_MAJOR_VER = 80, + ATA_ID_COMMAND_SET_1 = 82, + ATA_ID_COMMAND_SET_2 = 83, + ATA_ID_CFSSE = 84, + ATA_ID_CFS_ENABLE_1 = 85, + ATA_ID_CFS_ENABLE_2 = 86, + ATA_ID_CSF_DEFAULT = 87, + ATA_ID_UDMA_MODES = 88, + ATA_ID_HW_CONFIG = 93, + ATA_ID_SPG = 98, + ATA_ID_LBA_CAPACITY_2 = 100, + ATA_ID_SECTOR_SIZE = 106, + ATA_ID_WWN = 108, + ATA_ID_LOGICAL_SECTOR_SIZE = 117, + ATA_ID_COMMAND_SET_3 = 119, + ATA_ID_COMMAND_SET_4 = 120, + ATA_ID_LAST_LUN = 126, + ATA_ID_DLF = 128, + ATA_ID_CSFO = 129, + ATA_ID_CFA_POWER = 160, + ATA_ID_CFA_KEY_MGMT = 162, + ATA_ID_CFA_MODES = 163, + ATA_ID_DATA_SET_MGMT = 169, + ATA_ID_SCT_CMD_XPORT = 206, + ATA_ID_ROT_SPEED = 217, + ATA_ID_PIO4 = 2, + ATA_ID_SERNO_LEN = 20, + ATA_ID_FW_REV_LEN = 8, + ATA_ID_PROD_LEN = 40, + ATA_ID_WWN_LEN = 8, + ATA_PCI_CTL_OFS = 2, + ATA_PIO0 = 1, + ATA_PIO1 = 3, + ATA_PIO2 = 7, + ATA_PIO3 = 15, + ATA_PIO4 = 31, + ATA_PIO5 = 63, + ATA_PIO6 = 127, + ATA_PIO4_ONLY = 16, + ATA_SWDMA0 = 1, + ATA_SWDMA1 = 3, + ATA_SWDMA2 = 7, + ATA_SWDMA2_ONLY = 4, + ATA_MWDMA0 = 1, + ATA_MWDMA1 = 3, + ATA_MWDMA2 = 7, + ATA_MWDMA3 = 15, + ATA_MWDMA4 = 31, + ATA_MWDMA12_ONLY = 6, + ATA_MWDMA2_ONLY = 4, + ATA_UDMA0 = 1, + ATA_UDMA1 = 3, + ATA_UDMA2 = 7, + ATA_UDMA3 = 15, + ATA_UDMA4 = 31, + ATA_UDMA5 = 63, + ATA_UDMA6 = 127, + ATA_UDMA7 = 255, + ATA_UDMA24_ONLY = 20, + ATA_UDMA_MASK_40C = 7, + ATA_PRD_SZ = 8, + ATA_PRD_TBL_SZ = 2048, + ATA_PRD_EOT = 2147483648, + ATA_DMA_TABLE_OFS = 4, + ATA_DMA_STATUS = 2, + ATA_DMA_CMD = 0, + ATA_DMA_WR = 8, + ATA_DMA_START = 1, + ATA_DMA_INTR = 4, + ATA_DMA_ERR = 2, + ATA_DMA_ACTIVE = 1, + ATA_HOB = 128, + ATA_NIEN = 2, + ATA_LBA = 64, + ATA_DEV1 = 16, + ATA_DEVICE_OBS = 160, + ATA_DEVCTL_OBS = 8, + ATA_BUSY = 128, + ATA_DRDY = 64, + ATA_DF = 32, + ATA_DSC = 16, + ATA_DRQ = 8, + ATA_CORR = 4, + ATA_SENSE = 2, + ATA_ERR = 1, + ATA_SRST = 4, + ATA_ICRC = 128, + ATA_BBK = 128, + ATA_UNC = 64, + ATA_MC = 32, + ATA_IDNF = 16, + ATA_MCR = 8, + ATA_ABORTED = 4, + ATA_TRK0NF = 2, + ATA_AMNF = 1, + ATAPI_LFS = 240, + ATAPI_EOM = 2, + ATAPI_ILI = 1, + ATAPI_IO = 2, + ATAPI_COD = 1, + ATA_REG_DATA = 0, + ATA_REG_ERR = 1, + ATA_REG_NSECT = 2, + ATA_REG_LBAL = 3, + ATA_REG_LBAM = 4, + ATA_REG_LBAH = 5, + ATA_REG_DEVICE = 6, + ATA_REG_STATUS = 7, + ATA_REG_FEATURE = 1, + ATA_REG_CMD = 7, + ATA_REG_BYTEL = 4, + ATA_REG_BYTEH = 5, + ATA_REG_DEVSEL = 6, + ATA_REG_IRQ = 2, + ATA_CMD_DEV_RESET = 8, + ATA_CMD_CHK_POWER = 229, + ATA_CMD_STANDBY = 226, + ATA_CMD_IDLE = 227, + ATA_CMD_EDD = 144, + ATA_CMD_DOWNLOAD_MICRO = 146, + ATA_CMD_DOWNLOAD_MICRO_DMA = 147, + ATA_CMD_NOP = 0, + ATA_CMD_FLUSH = 231, + ATA_CMD_FLUSH_EXT = 234, + ATA_CMD_ID_ATA = 236, + ATA_CMD_ID_ATAPI = 161, + ATA_CMD_SERVICE = 162, + ATA_CMD_READ = 200, + ATA_CMD_READ_EXT = 37, + ATA_CMD_READ_QUEUED = 38, + ATA_CMD_READ_STREAM_EXT = 43, + ATA_CMD_READ_STREAM_DMA_EXT = 42, + ATA_CMD_WRITE = 202, + ATA_CMD_WRITE_EXT = 53, + ATA_CMD_WRITE_QUEUED = 54, + ATA_CMD_WRITE_STREAM_EXT = 59, + ATA_CMD_WRITE_STREAM_DMA_EXT = 58, + ATA_CMD_WRITE_FUA_EXT = 61, + ATA_CMD_WRITE_QUEUED_FUA_EXT = 62, + ATA_CMD_FPDMA_READ = 96, + ATA_CMD_FPDMA_WRITE = 97, + ATA_CMD_NCQ_NON_DATA = 99, + ATA_CMD_FPDMA_SEND = 100, + ATA_CMD_FPDMA_RECV = 101, + ATA_CMD_PIO_READ = 32, + ATA_CMD_PIO_READ_EXT = 36, + ATA_CMD_PIO_WRITE = 48, + ATA_CMD_PIO_WRITE_EXT = 52, + ATA_CMD_READ_MULTI = 196, + ATA_CMD_READ_MULTI_EXT = 41, + ATA_CMD_WRITE_MULTI = 197, + ATA_CMD_WRITE_MULTI_EXT = 57, + ATA_CMD_WRITE_MULTI_FUA_EXT = 206, + ATA_CMD_SET_FEATURES = 239, + ATA_CMD_SET_MULTI = 198, + ATA_CMD_PACKET = 160, + ATA_CMD_VERIFY = 64, + ATA_CMD_VERIFY_EXT = 66, + ATA_CMD_WRITE_UNCORR_EXT = 69, + ATA_CMD_STANDBYNOW1 = 224, + ATA_CMD_IDLEIMMEDIATE = 225, + ATA_CMD_SLEEP = 230, + ATA_CMD_INIT_DEV_PARAMS = 145, + ATA_CMD_READ_NATIVE_MAX = 248, + ATA_CMD_READ_NATIVE_MAX_EXT = 39, + ATA_CMD_SET_MAX = 249, + ATA_CMD_SET_MAX_EXT = 55, + ATA_CMD_READ_LOG_EXT = 47, + ATA_CMD_WRITE_LOG_EXT = 63, + ATA_CMD_READ_LOG_DMA_EXT = 71, + ATA_CMD_WRITE_LOG_DMA_EXT = 87, + ATA_CMD_TRUSTED_NONDATA = 91, + ATA_CMD_TRUSTED_RCV = 92, + ATA_CMD_TRUSTED_RCV_DMA = 93, + ATA_CMD_TRUSTED_SND = 94, + ATA_CMD_TRUSTED_SND_DMA = 95, + ATA_CMD_PMP_READ = 228, + ATA_CMD_PMP_READ_DMA = 233, + ATA_CMD_PMP_WRITE = 232, + ATA_CMD_PMP_WRITE_DMA = 235, + ATA_CMD_CONF_OVERLAY = 177, + ATA_CMD_SEC_SET_PASS = 241, + ATA_CMD_SEC_UNLOCK = 242, + ATA_CMD_SEC_ERASE_PREP = 243, + ATA_CMD_SEC_ERASE_UNIT = 244, + ATA_CMD_SEC_FREEZE_LOCK = 245, + ATA_CMD_SEC_DISABLE_PASS = 246, + ATA_CMD_CONFIG_STREAM = 81, + ATA_CMD_SMART = 176, + ATA_CMD_MEDIA_LOCK = 222, + ATA_CMD_MEDIA_UNLOCK = 223, + ATA_CMD_DSM = 6, + ATA_CMD_CHK_MED_CRD_TYP = 209, + ATA_CMD_CFA_REQ_EXT_ERR = 3, + ATA_CMD_CFA_WRITE_NE = 56, + ATA_CMD_CFA_TRANS_SECT = 135, + ATA_CMD_CFA_ERASE = 192, + ATA_CMD_CFA_WRITE_MULT_NE = 205, + ATA_CMD_REQ_SENSE_DATA = 11, + ATA_CMD_SANITIZE_DEVICE = 180, + ATA_CMD_ZAC_MGMT_IN = 74, + ATA_CMD_ZAC_MGMT_OUT = 159, + ATA_CMD_RESTORE = 16, + ATA_SUBCMD_FPDMA_RECV_RD_LOG_DMA_EXT = 1, + ATA_SUBCMD_FPDMA_RECV_ZAC_MGMT_IN = 2, + ATA_SUBCMD_FPDMA_SEND_DSM = 0, + ATA_SUBCMD_FPDMA_SEND_WR_LOG_DMA_EXT = 2, + ATA_SUBCMD_NCQ_NON_DATA_ABORT_QUEUE = 0, + ATA_SUBCMD_NCQ_NON_DATA_SET_FEATURES = 5, + ATA_SUBCMD_NCQ_NON_DATA_ZERO_EXT = 6, + ATA_SUBCMD_NCQ_NON_DATA_ZAC_MGMT_OUT = 7, + ATA_SUBCMD_ZAC_MGMT_IN_REPORT_ZONES = 0, + ATA_SUBCMD_ZAC_MGMT_OUT_CLOSE_ZONE = 1, + ATA_SUBCMD_ZAC_MGMT_OUT_FINISH_ZONE = 2, + ATA_SUBCMD_ZAC_MGMT_OUT_OPEN_ZONE = 3, + ATA_SUBCMD_ZAC_MGMT_OUT_RESET_WRITE_POINTER = 4, + ATA_LOG_DIRECTORY = 0, + ATA_LOG_SATA_NCQ = 16, + ATA_LOG_NCQ_NON_DATA = 18, + ATA_LOG_NCQ_SEND_RECV = 19, + ATA_LOG_IDENTIFY_DEVICE = 48, + ATA_LOG_SECURITY = 6, + ATA_LOG_SATA_SETTINGS = 8, + ATA_LOG_ZONED_INFORMATION = 9, + ATA_LOG_DEVSLP_OFFSET = 48, + ATA_LOG_DEVSLP_SIZE = 8, + ATA_LOG_DEVSLP_MDAT = 0, + ATA_LOG_DEVSLP_MDAT_MASK = 31, + ATA_LOG_DEVSLP_DETO = 1, + ATA_LOG_DEVSLP_VALID = 7, + ATA_LOG_DEVSLP_VALID_MASK = 128, + ATA_LOG_NCQ_PRIO_OFFSET = 9, + ATA_LOG_NCQ_SEND_RECV_SUBCMDS_OFFSET = 0, + ATA_LOG_NCQ_SEND_RECV_SUBCMDS_DSM = 1, + ATA_LOG_NCQ_SEND_RECV_DSM_OFFSET = 4, + ATA_LOG_NCQ_SEND_RECV_DSM_TRIM = 1, + ATA_LOG_NCQ_SEND_RECV_RD_LOG_OFFSET = 8, + ATA_LOG_NCQ_SEND_RECV_RD_LOG_SUPPORTED = 1, + ATA_LOG_NCQ_SEND_RECV_WR_LOG_OFFSET = 12, + ATA_LOG_NCQ_SEND_RECV_WR_LOG_SUPPORTED = 1, + ATA_LOG_NCQ_SEND_RECV_ZAC_MGMT_OFFSET = 16, + ATA_LOG_NCQ_SEND_RECV_ZAC_MGMT_OUT_SUPPORTED = 1, + ATA_LOG_NCQ_SEND_RECV_ZAC_MGMT_IN_SUPPORTED = 2, + ATA_LOG_NCQ_SEND_RECV_SIZE = 20, + ATA_LOG_NCQ_NON_DATA_SUBCMDS_OFFSET = 0, + ATA_LOG_NCQ_NON_DATA_ABORT_OFFSET = 0, + ATA_LOG_NCQ_NON_DATA_ABORT_NCQ = 1, + ATA_LOG_NCQ_NON_DATA_ABORT_ALL = 2, + ATA_LOG_NCQ_NON_DATA_ABORT_STREAMING = 4, + ATA_LOG_NCQ_NON_DATA_ABORT_NON_STREAMING = 8, + ATA_LOG_NCQ_NON_DATA_ABORT_SELECTED = 16, + ATA_LOG_NCQ_NON_DATA_ZAC_MGMT_OFFSET = 28, + ATA_LOG_NCQ_NON_DATA_ZAC_MGMT_OUT = 1, + ATA_LOG_NCQ_NON_DATA_SIZE = 64, + ATA_CMD_READ_LONG = 34, + ATA_CMD_READ_LONG_ONCE = 35, + ATA_CMD_WRITE_LONG = 50, + ATA_CMD_WRITE_LONG_ONCE = 51, + SETFEATURES_XFER = 3, + XFER_UDMA_7 = 71, + XFER_UDMA_6 = 70, + XFER_UDMA_5 = 69, + XFER_UDMA_4 = 68, + XFER_UDMA_3 = 67, + XFER_UDMA_2 = 66, + XFER_UDMA_1 = 65, + XFER_UDMA_0 = 64, + XFER_MW_DMA_4 = 36, + XFER_MW_DMA_3 = 35, + XFER_MW_DMA_2 = 34, + XFER_MW_DMA_1 = 33, + XFER_MW_DMA_0 = 32, + XFER_SW_DMA_2 = 18, + XFER_SW_DMA_1 = 17, + XFER_SW_DMA_0 = 16, + XFER_PIO_6 = 14, + XFER_PIO_5 = 13, + XFER_PIO_4 = 12, + XFER_PIO_3 = 11, + XFER_PIO_2 = 10, + XFER_PIO_1 = 9, + XFER_PIO_0 = 8, + XFER_PIO_SLOW = 0, + SETFEATURES_WC_ON = 2, + SETFEATURES_WC_OFF = 130, + SETFEATURES_RA_ON = 170, + SETFEATURES_RA_OFF = 85, + SETFEATURES_AAM_ON = 66, + SETFEATURES_AAM_OFF = 194, + SETFEATURES_SPINUP = 7, + SETFEATURES_SPINUP_TIMEOUT = 30000, + SETFEATURES_SATA_ENABLE = 16, + SETFEATURES_SATA_DISABLE = 144, + SATA_FPDMA_OFFSET = 1, + SATA_FPDMA_AA = 2, + SATA_DIPM = 3, + SATA_FPDMA_IN_ORDER = 4, + SATA_AN = 5, + SATA_SSP = 6, + SATA_DEVSLP = 9, + SETFEATURE_SENSE_DATA = 195, + ATA_SET_MAX_ADDR = 0, + ATA_SET_MAX_PASSWD = 1, + ATA_SET_MAX_LOCK = 2, + ATA_SET_MAX_UNLOCK = 3, + ATA_SET_MAX_FREEZE_LOCK = 4, + ATA_SET_MAX_PASSWD_DMA = 5, + ATA_SET_MAX_UNLOCK_DMA = 6, + ATA_DCO_RESTORE = 192, + ATA_DCO_FREEZE_LOCK = 193, + ATA_DCO_IDENTIFY = 194, + ATA_DCO_SET = 195, + ATA_SMART_ENABLE = 216, + ATA_SMART_READ_VALUES = 208, + ATA_SMART_READ_THRESHOLDS = 209, + ATA_DSM_TRIM = 1, + ATA_SMART_LBAM_PASS = 79, + ATA_SMART_LBAH_PASS = 194, + ATAPI_PKT_DMA = 1, + ATAPI_DMADIR = 4, + ATAPI_CDB_LEN = 16, + SATA_PMP_MAX_PORTS = 15, + SATA_PMP_CTRL_PORT = 15, + SATA_PMP_GSCR_DWORDS = 128, + SATA_PMP_GSCR_PROD_ID = 0, + SATA_PMP_GSCR_REV = 1, + SATA_PMP_GSCR_PORT_INFO = 2, + SATA_PMP_GSCR_ERROR = 32, + SATA_PMP_GSCR_ERROR_EN = 33, + SATA_PMP_GSCR_FEAT = 64, + SATA_PMP_GSCR_FEAT_EN = 96, + SATA_PMP_PSCR_STATUS = 0, + SATA_PMP_PSCR_ERROR = 1, + SATA_PMP_PSCR_CONTROL = 2, + SATA_PMP_FEAT_BIST = 1, + SATA_PMP_FEAT_PMREQ = 2, + SATA_PMP_FEAT_DYNSSC = 4, + SATA_PMP_FEAT_NOTIFY = 8, + ATA_CBL_NONE = 0, + ATA_CBL_PATA40 = 1, + ATA_CBL_PATA80 = 2, + ATA_CBL_PATA40_SHORT = 3, + ATA_CBL_PATA_UNK = 4, + ATA_CBL_PATA_IGN = 5, + ATA_CBL_SATA = 6, + SCR_STATUS = 0, + SCR_ERROR = 1, + SCR_CONTROL = 2, + SCR_ACTIVE = 3, + SCR_NOTIFICATION = 4, + SERR_DATA_RECOVERED = 1, + SERR_COMM_RECOVERED = 2, + SERR_DATA = 256, + SERR_PERSISTENT = 512, + SERR_PROTOCOL = 1024, + SERR_INTERNAL = 2048, + SERR_PHYRDY_CHG = 65536, + SERR_PHY_INT_ERR = 131072, + SERR_COMM_WAKE = 262144, + SERR_10B_8B_ERR = 524288, + SERR_DISPARITY = 1048576, + SERR_CRC = 2097152, + SERR_HANDSHAKE = 4194304, + SERR_LINK_SEQ_ERR = 8388608, + SERR_TRANS_ST_ERROR = 16777216, + SERR_UNRECOG_FIS = 33554432, + SERR_DEV_XCHG = 67108864, +}; + +enum ata_prot_flags { + ATA_PROT_FLAG_PIO = 1, + ATA_PROT_FLAG_DMA = 2, + ATA_PROT_FLAG_NCQ = 4, + ATA_PROT_FLAG_ATAPI = 8, + ATA_PROT_UNKNOWN = 255, + ATA_PROT_NODATA = 0, + ATA_PROT_PIO = 1, + ATA_PROT_DMA = 2, + ATA_PROT_NCQ_NODATA = 4, + ATA_PROT_NCQ = 6, + ATAPI_PROT_NODATA = 8, + ATAPI_PROT_PIO = 9, + ATAPI_PROT_DMA = 10, +}; + +struct ata_bmdma_prd { + __le32 addr; + __le32 flags_len; +}; + +enum { + ATA_MSG_DRV = 1, + ATA_MSG_INFO = 2, + ATA_MSG_PROBE = 4, + ATA_MSG_WARN = 8, + ATA_MSG_MALLOC = 16, + ATA_MSG_CTL = 32, + ATA_MSG_INTR = 64, + ATA_MSG_ERR = 128, +}; + +enum { + LIBATA_MAX_PRD = 128, + LIBATA_DUMB_MAX_PRD = 64, + ATA_DEF_QUEUE = 1, + ATA_MAX_QUEUE = 32, + ATA_TAG_INTERNAL = 32, + ATA_SHORT_PAUSE = 16, + ATAPI_MAX_DRAIN = 16384, + ATA_ALL_DEVICES = 3, + ATA_SHT_EMULATED = 1, + ATA_SHT_THIS_ID = 4294967295, + ATA_TFLAG_LBA48 = 1, + ATA_TFLAG_ISADDR = 2, + ATA_TFLAG_DEVICE = 4, + ATA_TFLAG_WRITE = 8, + ATA_TFLAG_LBA = 16, + ATA_TFLAG_FUA = 32, + ATA_TFLAG_POLLING = 64, + ATA_DFLAG_LBA = 1, + ATA_DFLAG_LBA48 = 2, + ATA_DFLAG_CDB_INTR = 4, + ATA_DFLAG_NCQ = 8, + ATA_DFLAG_FLUSH_EXT = 16, + ATA_DFLAG_ACPI_PENDING = 32, + ATA_DFLAG_ACPI_FAILED = 64, + ATA_DFLAG_AN = 128, + ATA_DFLAG_TRUSTED = 256, + ATA_DFLAG_DMADIR = 1024, + ATA_DFLAG_CFG_MASK = 4095, + ATA_DFLAG_PIO = 4096, + ATA_DFLAG_NCQ_OFF = 8192, + ATA_DFLAG_SLEEPING = 32768, + ATA_DFLAG_DUBIOUS_XFER = 65536, + ATA_DFLAG_NO_UNLOAD = 131072, + ATA_DFLAG_UNLOCK_HPA = 262144, + ATA_DFLAG_NCQ_SEND_RECV = 524288, + ATA_DFLAG_NCQ_PRIO = 1048576, + ATA_DFLAG_NCQ_PRIO_ENABLE = 2097152, + ATA_DFLAG_INIT_MASK = 16777215, + ATA_DFLAG_DETACH = 16777216, + ATA_DFLAG_DETACHED = 33554432, + ATA_DFLAG_DA = 67108864, + ATA_DFLAG_DEVSLP = 134217728, + ATA_DFLAG_ACPI_DISABLED = 268435456, + ATA_DFLAG_D_SENSE = 536870912, + ATA_DFLAG_ZAC = 1073741824, + ATA_DEV_UNKNOWN = 0, + ATA_DEV_ATA = 1, + ATA_DEV_ATA_UNSUP = 2, + ATA_DEV_ATAPI = 3, + ATA_DEV_ATAPI_UNSUP = 4, + ATA_DEV_PMP = 5, + ATA_DEV_PMP_UNSUP = 6, + ATA_DEV_SEMB = 7, + ATA_DEV_SEMB_UNSUP = 8, + ATA_DEV_ZAC = 9, + ATA_DEV_ZAC_UNSUP = 10, + ATA_DEV_NONE = 11, + ATA_LFLAG_NO_HRST = 2, + ATA_LFLAG_NO_SRST = 4, + ATA_LFLAG_ASSUME_ATA = 8, + ATA_LFLAG_ASSUME_SEMB = 16, + ATA_LFLAG_ASSUME_CLASS = 24, + ATA_LFLAG_NO_RETRY = 32, + ATA_LFLAG_DISABLED = 64, + ATA_LFLAG_SW_ACTIVITY = 128, + ATA_LFLAG_NO_LPM = 256, + ATA_LFLAG_RST_ONCE = 512, + ATA_LFLAG_CHANGED = 1024, + ATA_LFLAG_NO_DB_DELAY = 2048, + ATA_FLAG_SLAVE_POSS = 1, + ATA_FLAG_SATA = 2, + ATA_FLAG_NO_LPM = 4, + ATA_FLAG_NO_LOG_PAGE = 32, + ATA_FLAG_NO_ATAPI = 64, + ATA_FLAG_PIO_DMA = 128, + ATA_FLAG_PIO_LBA48 = 256, + ATA_FLAG_PIO_POLLING = 512, + ATA_FLAG_NCQ = 1024, + ATA_FLAG_NO_POWEROFF_SPINDOWN = 2048, + ATA_FLAG_NO_HIBERNATE_SPINDOWN = 4096, + ATA_FLAG_DEBUGMSG = 8192, + ATA_FLAG_FPDMA_AA = 16384, + ATA_FLAG_IGN_SIMPLEX = 32768, + ATA_FLAG_NO_IORDY = 65536, + ATA_FLAG_ACPI_SATA = 131072, + ATA_FLAG_AN = 262144, + ATA_FLAG_PMP = 524288, + ATA_FLAG_FPDMA_AUX = 1048576, + ATA_FLAG_EM = 2097152, + ATA_FLAG_SW_ACTIVITY = 4194304, + ATA_FLAG_NO_DIPM = 8388608, + ATA_FLAG_SAS_HOST = 16777216, + ATA_PFLAG_EH_PENDING = 1, + ATA_PFLAG_EH_IN_PROGRESS = 2, + ATA_PFLAG_FROZEN = 4, + ATA_PFLAG_RECOVERED = 8, + ATA_PFLAG_LOADING = 16, + ATA_PFLAG_SCSI_HOTPLUG = 64, + ATA_PFLAG_INITIALIZING = 128, + ATA_PFLAG_RESETTING = 256, + ATA_PFLAG_UNLOADING = 512, + ATA_PFLAG_UNLOADED = 1024, + ATA_PFLAG_SUSPENDED = 131072, + ATA_PFLAG_PM_PENDING = 262144, + ATA_PFLAG_INIT_GTM_VALID = 524288, + ATA_PFLAG_PIO32 = 1048576, + ATA_PFLAG_PIO32CHANGE = 2097152, + ATA_PFLAG_EXTERNAL = 4194304, + ATA_QCFLAG_ACTIVE = 1, + ATA_QCFLAG_DMAMAP = 2, + ATA_QCFLAG_IO = 8, + ATA_QCFLAG_RESULT_TF = 16, + ATA_QCFLAG_CLEAR_EXCL = 32, + ATA_QCFLAG_QUIET = 64, + ATA_QCFLAG_RETRY = 128, + ATA_QCFLAG_FAILED = 65536, + ATA_QCFLAG_SENSE_VALID = 131072, + ATA_QCFLAG_EH_SCHEDULED = 262144, + ATA_HOST_SIMPLEX = 1, + ATA_HOST_STARTED = 2, + ATA_HOST_PARALLEL_SCAN = 4, + ATA_HOST_IGNORE_ATA = 8, + ATA_TMOUT_BOOT = 30000, + ATA_TMOUT_BOOT_QUICK = 7000, + ATA_TMOUT_INTERNAL_QUICK = 5000, + ATA_TMOUT_MAX_PARK = 30000, + ATA_TMOUT_FF_WAIT_LONG = 2000, + ATA_TMOUT_FF_WAIT = 800, + ATA_WAIT_AFTER_RESET = 150, + ATA_TMOUT_PMP_SRST_WAIT = 5000, + ATA_TMOUT_SPURIOUS_PHY = 10000, + BUS_UNKNOWN = 0, + BUS_DMA = 1, + BUS_IDLE = 2, + BUS_NOINTR = 3, + BUS_NODATA = 4, + BUS_TIMER = 5, + BUS_PIO = 6, + BUS_EDD = 7, + BUS_IDENTIFY = 8, + BUS_PACKET = 9, + PORT_UNKNOWN = 0, + PORT_ENABLED = 1, + PORT_DISABLED = 2, + ATA_NR_PIO_MODES = 7, + ATA_NR_MWDMA_MODES = 5, + ATA_NR_UDMA_MODES = 8, + ATA_SHIFT_PIO = 0, + ATA_SHIFT_MWDMA = 7, + ATA_SHIFT_UDMA = 12, + ATA_SHIFT_PRIO = 6, + ATA_PRIO_HIGH = 2, + ATA_DMA_PAD_SZ = 4, + ATA_ERING_SIZE = 32, + ATA_DEFER_LINK = 1, + ATA_DEFER_PORT = 2, + ATA_EH_DESC_LEN = 80, + ATA_EH_REVALIDATE = 1, + ATA_EH_SOFTRESET = 2, + ATA_EH_HARDRESET = 4, + ATA_EH_RESET = 6, + ATA_EH_ENABLE_LINK = 8, + ATA_EH_PARK = 32, + ATA_EH_PERDEV_MASK = 33, + ATA_EH_ALL_ACTIONS = 15, + ATA_EHI_HOTPLUGGED = 1, + ATA_EHI_NO_AUTOPSY = 4, + ATA_EHI_QUIET = 8, + ATA_EHI_NO_RECOVERY = 16, + ATA_EHI_DID_SOFTRESET = 65536, + ATA_EHI_DID_HARDRESET = 131072, + ATA_EHI_PRINTINFO = 262144, + ATA_EHI_SETMODE = 524288, + ATA_EHI_POST_SETMODE = 1048576, + ATA_EHI_DID_RESET = 196608, + ATA_EHI_TO_SLAVE_MASK = 12, + ATA_EH_MAX_TRIES = 5, + ATA_LINK_RESUME_TRIES = 5, + ATA_PROBE_MAX_TRIES = 3, + ATA_EH_DEV_TRIES = 3, + ATA_EH_PMP_TRIES = 5, + ATA_EH_PMP_LINK_TRIES = 3, + SATA_PMP_RW_TIMEOUT = 3000, + ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 6, + ATA_HORKAGE_DIAGNOSTIC = 1, + ATA_HORKAGE_NODMA = 2, + ATA_HORKAGE_NONCQ = 4, + ATA_HORKAGE_MAX_SEC_128 = 8, + ATA_HORKAGE_BROKEN_HPA = 16, + ATA_HORKAGE_DISABLE = 32, + ATA_HORKAGE_HPA_SIZE = 64, + ATA_HORKAGE_IVB = 256, + ATA_HORKAGE_STUCK_ERR = 512, + ATA_HORKAGE_BRIDGE_OK = 1024, + ATA_HORKAGE_ATAPI_MOD16_DMA = 2048, + ATA_HORKAGE_FIRMWARE_WARN = 4096, + ATA_HORKAGE_1_5_GBPS = 8192, + ATA_HORKAGE_NOSETXFER = 16384, + ATA_HORKAGE_BROKEN_FPDMA_AA = 32768, + ATA_HORKAGE_DUMP_ID = 65536, + ATA_HORKAGE_MAX_SEC_LBA48 = 131072, + ATA_HORKAGE_ATAPI_DMADIR = 262144, + ATA_HORKAGE_NO_NCQ_TRIM = 524288, + ATA_HORKAGE_NOLPM = 1048576, + ATA_HORKAGE_WD_BROKEN_LPM = 2097152, + ATA_HORKAGE_ZERO_AFTER_TRIM = 4194304, + ATA_HORKAGE_NO_DMA_LOG = 8388608, + ATA_HORKAGE_NOTRIM = 16777216, + ATA_HORKAGE_MAX_SEC_1024 = 33554432, + ATA_HORKAGE_MAX_TRIM_128M = 67108864, + ATA_DMA_MASK_ATA = 1, + ATA_DMA_MASK_ATAPI = 2, + ATA_DMA_MASK_CFA = 4, + ATAPI_READ = 0, + ATAPI_WRITE = 1, + ATAPI_READ_CD = 2, + ATAPI_PASS_THRU = 3, + ATAPI_MISC = 4, + ATA_TIMING_SETUP = 1, + ATA_TIMING_ACT8B = 2, + ATA_TIMING_REC8B = 4, + ATA_TIMING_CYC8B = 8, + ATA_TIMING_8BIT = 14, + ATA_TIMING_ACTIVE = 16, + ATA_TIMING_RECOVER = 32, + ATA_TIMING_DMACK_HOLD = 64, + ATA_TIMING_CYCLE = 128, + ATA_TIMING_UDMA = 256, + ATA_TIMING_ALL = 511, + ATA_ACPI_FILTER_SETXFER = 1, + ATA_ACPI_FILTER_LOCK = 2, + ATA_ACPI_FILTER_DIPM = 4, + ATA_ACPI_FILTER_FPDMA_OFFSET = 8, + ATA_ACPI_FILTER_FPDMA_AA = 16, + ATA_ACPI_FILTER_DEFAULT = 7, +}; + +enum ata_xfer_mask { + ATA_MASK_PIO = 127, + ATA_MASK_MWDMA = 3968, + ATA_MASK_UDMA = 1044480, +}; + +enum ata_completion_errors { + AC_ERR_OK = 0, + AC_ERR_DEV = 1, + AC_ERR_HSM = 2, + AC_ERR_TIMEOUT = 4, + AC_ERR_MEDIA = 8, + AC_ERR_ATA_BUS = 16, + AC_ERR_HOST_BUS = 32, + AC_ERR_SYSTEM = 64, + AC_ERR_INVALID = 128, + AC_ERR_OTHER = 256, + AC_ERR_NODEV_HINT = 512, + AC_ERR_NCQ = 1024, +}; + +enum ata_lpm_policy { + ATA_LPM_UNKNOWN = 0, + ATA_LPM_MAX_POWER = 1, + ATA_LPM_MED_POWER = 2, + ATA_LPM_MED_POWER_WITH_DIPM = 3, + ATA_LPM_MIN_POWER_WITH_PARTIAL = 4, + ATA_LPM_MIN_POWER = 5, +}; + +struct ata_queued_cmd; + +typedef void (*ata_qc_cb_t)(struct ata_queued_cmd *); + +struct ata_taskfile { + long unsigned int flags; + u8 protocol; + u8 ctl; + u8 hob_feature; + u8 hob_nsect; + u8 hob_lbal; + u8 hob_lbam; + u8 hob_lbah; + u8 feature; + u8 nsect; + u8 lbal; + u8 lbam; + u8 lbah; + u8 device; + u8 command; + u32 auxiliary; +}; + +struct ata_port; + +struct ata_device; + +struct ata_queued_cmd { + struct ata_port *ap; + struct ata_device *dev; + struct scsi_cmnd *scsicmd; + void (*scsidone)(struct scsi_cmnd *); + struct ata_taskfile tf; + u8 cdb[16]; + long unsigned int flags; + unsigned int tag; + unsigned int hw_tag; + unsigned int n_elem; + unsigned int orig_n_elem; + int dma_dir; + unsigned int sect_size; + unsigned int nbytes; + unsigned int extrabytes; + unsigned int curbytes; + struct scatterlist sgent; + struct scatterlist *sg; + struct scatterlist *cursg; + unsigned int cursg_ofs; + unsigned int err_mask; + struct ata_taskfile result_tf; + ata_qc_cb_t complete_fn; + void *private_data; + void *lldd_task; +}; + +struct ata_link; + +typedef int (*ata_prereset_fn_t)(struct ata_link *, long unsigned int); + +struct ata_eh_info { + struct ata_device *dev; + u32 serror; + unsigned int err_mask; + unsigned int action; + unsigned int dev_action[2]; + unsigned int flags; + unsigned int probe_mask; + char desc[80]; + int desc_len; +}; + +struct ata_eh_context { + struct ata_eh_info i; + int tries[2]; + int cmd_timeout_idx[12]; + unsigned int classes[2]; + unsigned int did_probe_mask; + unsigned int unloaded_mask; + unsigned int saved_ncq_enabled; + u8 saved_xfer_mode[2]; + long unsigned int last_reset; +}; + +struct ata_ering_entry { + unsigned int eflags; + unsigned int err_mask; + u64 timestamp; +}; + +struct ata_ering { + int cursor; + struct ata_ering_entry ring[32]; +}; + +struct ata_device { + struct ata_link *link; + unsigned int devno; + unsigned int horkage; + long unsigned int flags; + struct scsi_device *sdev; + void *private_data; + union acpi_object *gtf_cache; + unsigned int gtf_filter; + struct device tdev; + u64 n_sectors; + u64 n_native_sectors; + unsigned int class; + long unsigned int unpark_deadline; + u8 pio_mode; + u8 dma_mode; + u8 xfer_mode; + unsigned int xfer_shift; + unsigned int multi_count; + unsigned int max_sectors; + unsigned int cdb_len; + long unsigned int pio_mask; + long unsigned int mwdma_mask; + long unsigned int udma_mask; + u16 cylinders; + u16 heads; + u16 sectors; + long: 16; + long: 64; + long: 64; + union { + u16 id[256]; + u32 gscr[128]; + }; + u8 devslp_timing[8]; + u8 ncq_send_recv_cmds[20]; + u8 ncq_non_data_cmds[64]; + u32 zac_zoned_cap; + u32 zac_zones_optimal_open; + u32 zac_zones_optimal_nonseq; + u32 zac_zones_max_open; + int spdn_cnt; + struct ata_ering ering; + long: 64; +}; + +struct ata_link { + struct ata_port *ap; + int pmp; + struct device tdev; + unsigned int active_tag; + u32 sactive; + unsigned int flags; + u32 saved_scontrol; + unsigned int hw_sata_spd_limit; + unsigned int sata_spd_limit; + unsigned int sata_spd; + enum ata_lpm_policy lpm_policy; + struct ata_eh_info eh_info; + struct ata_eh_context eh_context; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct ata_device device[2]; + long unsigned int last_lpm_change; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +typedef int (*ata_reset_fn_t)(struct ata_link *, unsigned int *, long unsigned int); + +typedef void (*ata_postreset_fn_t)(struct ata_link *, unsigned int *); + +enum sw_activity { + OFF = 0, + BLINK_ON = 1, + BLINK_OFF = 2, +}; + +struct ata_ioports { + void *cmd_addr; + void *data_addr; + void *error_addr; + void *feature_addr; + void *nsect_addr; + void *lbal_addr; + void *lbam_addr; + void *lbah_addr; + void *device_addr; + void *status_addr; + void *command_addr; + void *altstatus_addr; + void *ctl_addr; + void *bmdma_addr; + void *scr_addr; +}; + +struct ata_port_operations; + +struct ata_host { + spinlock_t lock; + struct device *dev; + void * const *iomap; + unsigned int n_ports; + unsigned int n_tags; + void *private_data; + struct ata_port_operations *ops; + long unsigned int flags; + struct kref kref; + struct mutex eh_mutex; + struct task_struct *eh_owner; + struct ata_port *simplex_claimed; + struct ata_port *ports[0]; +}; + +struct ata_port_operations { + int (*qc_defer)(struct ata_queued_cmd *); + int (*check_atapi_dma)(struct ata_queued_cmd *); + enum ata_completion_errors (*qc_prep)(struct ata_queued_cmd *); + unsigned int (*qc_issue)(struct ata_queued_cmd *); + bool (*qc_fill_rtf)(struct ata_queued_cmd *); + int (*cable_detect)(struct ata_port *); + long unsigned int (*mode_filter)(struct ata_device *, long unsigned int); + void (*set_piomode)(struct ata_port *, struct ata_device *); + void (*set_dmamode)(struct ata_port *, struct ata_device *); + int (*set_mode)(struct ata_link *, struct ata_device **); + unsigned int (*read_id)(struct ata_device *, struct ata_taskfile *, u16 *); + void (*dev_config)(struct ata_device *); + void (*freeze)(struct ata_port *); + void (*thaw)(struct ata_port *); + ata_prereset_fn_t prereset; + ata_reset_fn_t softreset; + ata_reset_fn_t hardreset; + ata_postreset_fn_t postreset; + ata_prereset_fn_t pmp_prereset; + ata_reset_fn_t pmp_softreset; + ata_reset_fn_t pmp_hardreset; + ata_postreset_fn_t pmp_postreset; + void (*error_handler)(struct ata_port *); + void (*lost_interrupt)(struct ata_port *); + void (*post_internal_cmd)(struct ata_queued_cmd *); + void (*sched_eh)(struct ata_port *); + void (*end_eh)(struct ata_port *); + int (*scr_read)(struct ata_link *, unsigned int, u32 *); + int (*scr_write)(struct ata_link *, unsigned int, u32); + void (*pmp_attach)(struct ata_port *); + void (*pmp_detach)(struct ata_port *); + int (*set_lpm)(struct ata_link *, enum ata_lpm_policy, unsigned int); + int (*port_suspend)(struct ata_port *, pm_message_t); + int (*port_resume)(struct ata_port *); + int (*port_start)(struct ata_port *); + void (*port_stop)(struct ata_port *); + void (*host_stop)(struct ata_host *); + void (*sff_dev_select)(struct ata_port *, unsigned int); + void (*sff_set_devctl)(struct ata_port *, u8); + u8 (*sff_check_status)(struct ata_port *); + u8 (*sff_check_altstatus)(struct ata_port *); + void (*sff_tf_load)(struct ata_port *, const struct ata_taskfile *); + void (*sff_tf_read)(struct ata_port *, struct ata_taskfile *); + void (*sff_exec_command)(struct ata_port *, const struct ata_taskfile *); + unsigned int (*sff_data_xfer)(struct ata_queued_cmd *, unsigned char *, unsigned int, int); + void (*sff_irq_on)(struct ata_port *); + bool (*sff_irq_check)(struct ata_port *); + void (*sff_irq_clear)(struct ata_port *); + void (*sff_drain_fifo)(struct ata_queued_cmd *); + void (*bmdma_setup)(struct ata_queued_cmd *); + void (*bmdma_start)(struct ata_queued_cmd *); + void (*bmdma_stop)(struct ata_queued_cmd *); + u8 (*bmdma_status)(struct ata_port *); + ssize_t (*em_show)(struct ata_port *, char *); + ssize_t (*em_store)(struct ata_port *, const char *, size_t); + ssize_t (*sw_activity_show)(struct ata_device *, char *); + ssize_t (*sw_activity_store)(struct ata_device *, enum sw_activity); + ssize_t (*transmit_led_message)(struct ata_port *, u32, ssize_t); + void (*phy_reset)(struct ata_port *); + void (*eng_timeout)(struct ata_port *); + const struct ata_port_operations *inherits; +}; + +struct ata_port_stats { + long unsigned int unhandled_irq; + long unsigned int idle_irq; + long unsigned int rw_reqbuf; +}; + +struct ata_acpi_drive { + u32 pio; + u32 dma; +}; + +struct ata_acpi_gtm { + struct ata_acpi_drive drive[2]; + u32 flags; +}; + +struct ata_port { + struct Scsi_Host *scsi_host; + struct ata_port_operations *ops; + spinlock_t *lock; + long unsigned int flags; + unsigned int pflags; + unsigned int print_id; + unsigned int local_port_no; + unsigned int port_no; + struct ata_ioports ioaddr; + u8 ctl; + u8 last_ctl; + struct ata_link *sff_pio_task_link; + struct delayed_work sff_pio_task; + struct ata_bmdma_prd *bmdma_prd; + dma_addr_t bmdma_prd_dma; + unsigned int pio_mask; + unsigned int mwdma_mask; + unsigned int udma_mask; + unsigned int cbl; + struct ata_queued_cmd qcmd[33]; + long unsigned int sas_tag_allocated; + u64 qc_active; + int nr_active_links; + unsigned int sas_last_tag; + long: 64; + struct ata_link link; + struct ata_link *slave_link; + int nr_pmp_links; + struct ata_link *pmp_link; + struct ata_link *excl_link; + struct ata_port_stats stats; + struct ata_host *host; + struct device *dev; + struct device tdev; + struct mutex scsi_scan_mutex; + struct delayed_work hotplug_task; + struct work_struct scsi_rescan_task; + unsigned int hsm_task_state; + u32 msg_enable; + struct list_head eh_done_q; + wait_queue_head_t eh_wait_q; + int eh_tries; + struct completion park_req_pending; + pm_message_t pm_mesg; + enum ata_lpm_policy target_lpm_policy; + struct timer_list fastdrain_timer; + long unsigned int fastdrain_cnt; + async_cookie_t cookie; + int em_message_type; + void *private_data; + struct ata_acpi_gtm __acpi_init_gtm; + int: 32; + u8 sector_buf[512]; +}; + +struct ata_port_info { + long unsigned int flags; + long unsigned int link_flags; + long unsigned int pio_mask; + long unsigned int mwdma_mask; + long unsigned int udma_mask; + struct ata_port_operations *port_ops; + void *private_data; +}; + +struct ata_timing { + short unsigned int mode; + short unsigned int setup; + short unsigned int act8b; + short unsigned int rec8b; + short unsigned int cyc8b; + short unsigned int active; + short unsigned int recover; + short unsigned int dmack_hold; + short unsigned int cycle; + short unsigned int udma; +}; + +struct pci_bits { + unsigned int reg; + unsigned int width; + long unsigned int mask; + long unsigned int val; +}; + +enum ata_link_iter_mode { + ATA_LITER_EDGE = 0, + ATA_LITER_HOST_FIRST = 1, + ATA_LITER_PMP_FIRST = 2, +}; + +enum ata_dev_iter_mode { + ATA_DITER_ENABLED = 0, + ATA_DITER_ENABLED_REVERSE = 1, + ATA_DITER_ALL = 2, + ATA_DITER_ALL_REVERSE = 3, +}; + +struct trace_event_raw_ata_qc_issue { + struct trace_entry ent; + unsigned int ata_port; + unsigned int ata_dev; + unsigned int tag; + unsigned char cmd; + unsigned char dev; + unsigned char lbal; + unsigned char lbam; + unsigned char lbah; + unsigned char nsect; + unsigned char feature; + unsigned char hob_lbal; + unsigned char hob_lbam; + unsigned char hob_lbah; + unsigned char hob_nsect; + unsigned char hob_feature; + unsigned char ctl; + unsigned char proto; + long unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_ata_qc_complete_template { + struct trace_entry ent; + unsigned int ata_port; + unsigned int ata_dev; + unsigned int tag; + unsigned char status; + unsigned char dev; + unsigned char lbal; + unsigned char lbam; + unsigned char lbah; + unsigned char nsect; + unsigned char error; + unsigned char hob_lbal; + unsigned char hob_lbam; + unsigned char hob_lbah; + unsigned char hob_nsect; + unsigned char hob_feature; + unsigned char ctl; + long unsigned int flags; + char __data[0]; +}; + +struct trace_event_raw_ata_eh_link_autopsy { + struct trace_entry ent; + unsigned int ata_port; + unsigned int ata_dev; + unsigned int eh_action; + unsigned int eh_err_mask; + char __data[0]; +}; + +struct trace_event_raw_ata_eh_link_autopsy_qc { + struct trace_entry ent; + unsigned int ata_port; + unsigned int ata_dev; + unsigned int tag; + unsigned int qc_flags; + unsigned int eh_err_mask; + char __data[0]; +}; + +struct trace_event_data_offsets_ata_qc_issue {}; + +struct trace_event_data_offsets_ata_qc_complete_template {}; + +struct trace_event_data_offsets_ata_eh_link_autopsy {}; + +struct trace_event_data_offsets_ata_eh_link_autopsy_qc {}; + +typedef void (*btf_trace_ata_qc_issue)(void *, struct ata_queued_cmd *); + +typedef void (*btf_trace_ata_qc_complete_internal)(void *, struct ata_queued_cmd *); + +typedef void (*btf_trace_ata_qc_complete_failed)(void *, struct ata_queued_cmd *); + +typedef void (*btf_trace_ata_qc_complete_done)(void *, struct ata_queued_cmd *); + +typedef void (*btf_trace_ata_eh_link_autopsy)(void *, struct ata_device *, unsigned int, unsigned int); + +typedef void (*btf_trace_ata_eh_link_autopsy_qc)(void *, struct ata_queued_cmd *); + +enum { + ATA_READID_POSTRESET = 1, + ATA_DNXFER_PIO = 0, + ATA_DNXFER_DMA = 1, + ATA_DNXFER_40C = 2, + ATA_DNXFER_FORCE_PIO = 3, + ATA_DNXFER_FORCE_PIO0 = 4, + ATA_DNXFER_QUIET = 2147483648, +}; + +struct ata_force_param { + const char *name; + u8 cbl; + u8 spd_limit; + long unsigned int xfer_mask; + unsigned int horkage_on; + unsigned int horkage_off; + u16 lflags; +}; + +struct ata_force_ent { + int port; + int device; + struct ata_force_param param; +}; + +struct ata_xfer_ent { + int shift; + int bits; + u8 base; +}; + +struct ata_blacklist_entry { + const char *model_num; + const char *model_rev; + long unsigned int horkage; +}; + +typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *); + +struct ata_scsi_args { + struct ata_device *dev; + u16 *id; + struct scsi_cmnd *cmd; +}; + +enum ata_lpm_hints { + ATA_LPM_EMPTY = 1, + ATA_LPM_HIPM = 2, + ATA_LPM_WAKE_ONLY = 4, +}; + +enum { + ATA_EH_SPDN_NCQ_OFF = 1, + ATA_EH_SPDN_SPEED_DOWN = 2, + ATA_EH_SPDN_FALLBACK_TO_PIO = 4, + ATA_EH_SPDN_KEEP_ERRORS = 8, + ATA_EFLAG_IS_IO = 1, + ATA_EFLAG_DUBIOUS_XFER = 2, + ATA_EFLAG_OLD_ER = 2147483648, + ATA_ECAT_NONE = 0, + ATA_ECAT_ATA_BUS = 1, + ATA_ECAT_TOUT_HSM = 2, + ATA_ECAT_UNK_DEV = 3, + ATA_ECAT_DUBIOUS_NONE = 4, + ATA_ECAT_DUBIOUS_ATA_BUS = 5, + ATA_ECAT_DUBIOUS_TOUT_HSM = 6, + ATA_ECAT_DUBIOUS_UNK_DEV = 7, + ATA_ECAT_NR = 8, + ATA_EH_CMD_DFL_TIMEOUT = 5000, + ATA_EH_RESET_COOL_DOWN = 5000, + ATA_EH_PRERESET_TIMEOUT = 10000, + ATA_EH_FASTDRAIN_INTERVAL = 3000, + ATA_EH_UA_TRIES = 5, + ATA_EH_PROBE_TRIAL_INTERVAL = 60000, + ATA_EH_PROBE_TRIALS = 2, +}; + +struct ata_eh_cmd_timeout_ent { + const u8 *commands; + const long unsigned int *timeouts; +}; + +struct speed_down_verdict_arg { + u64 since; + int xfer_ok; + int nr_errors[8]; +}; + +struct ata_internal { + struct scsi_transport_template t; + struct device_attribute private_port_attrs[3]; + struct device_attribute private_link_attrs[3]; + struct device_attribute private_dev_attrs[9]; + struct transport_container link_attr_cont; + struct transport_container dev_attr_cont; + struct device_attribute *link_attrs[4]; + struct device_attribute *port_attrs[4]; + struct device_attribute *dev_attrs[10]; +}; + +struct ata_show_ering_arg { + char *buf; + int written; +}; + +enum hsm_task_states { + HSM_ST_IDLE = 0, + HSM_ST_FIRST = 1, + HSM_ST = 2, + HSM_ST_LAST = 3, + HSM_ST_ERR = 4, +}; + +struct ata_acpi_gtf { + u8 tf[7]; +}; + +struct ata_acpi_hotplug_context { + struct acpi_hotplug_context hp; + union { + struct ata_port *ap; + struct ata_device *dev; + } data; +}; + +enum { + AHCI_MAX_PORTS = 32, + AHCI_MAX_CLKS = 5, + AHCI_MAX_SG = 168, + AHCI_DMA_BOUNDARY = 4294967295, + AHCI_MAX_CMDS = 32, + AHCI_CMD_SZ = 32, + AHCI_CMD_SLOT_SZ = 1024, + AHCI_RX_FIS_SZ = 256, + AHCI_CMD_TBL_CDB = 64, + AHCI_CMD_TBL_HDR_SZ = 128, + AHCI_CMD_TBL_SZ = 2816, + AHCI_CMD_TBL_AR_SZ = 90112, + AHCI_PORT_PRIV_DMA_SZ = 91392, + AHCI_PORT_PRIV_FBS_DMA_SZ = 95232, + AHCI_IRQ_ON_SG = 2147483648, + AHCI_CMD_ATAPI = 32, + AHCI_CMD_WRITE = 64, + AHCI_CMD_PREFETCH = 128, + AHCI_CMD_RESET = 256, + AHCI_CMD_CLR_BUSY = 1024, + RX_FIS_PIO_SETUP = 32, + RX_FIS_D2H_REG = 64, + RX_FIS_SDB = 88, + RX_FIS_UNK = 96, + HOST_CAP = 0, + HOST_CTL = 4, + HOST_IRQ_STAT = 8, + HOST_PORTS_IMPL = 12, + HOST_VERSION = 16, + HOST_EM_LOC = 28, + HOST_EM_CTL = 32, + HOST_CAP2 = 36, + HOST_RESET = 1, + HOST_IRQ_EN = 2, + HOST_MRSM = 4, + HOST_AHCI_EN = 2147483648, + HOST_CAP_SXS = 32, + HOST_CAP_EMS = 64, + HOST_CAP_CCC = 128, + HOST_CAP_PART = 8192, + HOST_CAP_SSC = 16384, + HOST_CAP_PIO_MULTI = 32768, + HOST_CAP_FBS = 65536, + HOST_CAP_PMP = 131072, + HOST_CAP_ONLY = 262144, + HOST_CAP_CLO = 16777216, + HOST_CAP_LED = 33554432, + HOST_CAP_ALPM = 67108864, + HOST_CAP_SSS = 134217728, + HOST_CAP_MPS = 268435456, + HOST_CAP_SNTF = 536870912, + HOST_CAP_NCQ = 1073741824, + HOST_CAP_64 = 2147483648, + HOST_CAP2_BOH = 1, + HOST_CAP2_NVMHCI = 2, + HOST_CAP2_APST = 4, + HOST_CAP2_SDS = 8, + HOST_CAP2_SADM = 16, + HOST_CAP2_DESO = 32, + PORT_LST_ADDR = 0, + PORT_LST_ADDR_HI = 4, + PORT_FIS_ADDR = 8, + PORT_FIS_ADDR_HI = 12, + PORT_IRQ_STAT = 16, + PORT_IRQ_MASK = 20, + PORT_CMD = 24, + PORT_TFDATA = 32, + PORT_SIG = 36, + PORT_CMD_ISSUE = 56, + PORT_SCR_STAT = 40, + PORT_SCR_CTL = 44, + PORT_SCR_ERR = 48, + PORT_SCR_ACT = 52, + PORT_SCR_NTF = 60, + PORT_FBS = 64, + PORT_DEVSLP = 68, + PORT_IRQ_COLD_PRES = 2147483648, + PORT_IRQ_TF_ERR = 1073741824, + PORT_IRQ_HBUS_ERR = 536870912, + PORT_IRQ_HBUS_DATA_ERR = 268435456, + PORT_IRQ_IF_ERR = 134217728, + PORT_IRQ_IF_NONFATAL = 67108864, + PORT_IRQ_OVERFLOW = 16777216, + PORT_IRQ_BAD_PMP = 8388608, + PORT_IRQ_PHYRDY = 4194304, + PORT_IRQ_DEV_ILCK = 128, + PORT_IRQ_CONNECT = 64, + PORT_IRQ_SG_DONE = 32, + PORT_IRQ_UNK_FIS = 16, + PORT_IRQ_SDB_FIS = 8, + PORT_IRQ_DMAS_FIS = 4, + PORT_IRQ_PIOS_FIS = 2, + PORT_IRQ_D2H_REG_FIS = 1, + PORT_IRQ_FREEZE = 683671632, + PORT_IRQ_ERROR = 2025848912, + DEF_PORT_IRQ = 2025848959, + PORT_CMD_ASP = 134217728, + PORT_CMD_ALPE = 67108864, + PORT_CMD_ATAPI = 16777216, + PORT_CMD_FBSCP = 4194304, + PORT_CMD_ESP = 2097152, + PORT_CMD_HPCP = 262144, + PORT_CMD_PMP = 131072, + PORT_CMD_LIST_ON = 32768, + PORT_CMD_FIS_ON = 16384, + PORT_CMD_FIS_RX = 16, + PORT_CMD_CLO = 8, + PORT_CMD_POWER_ON = 4, + PORT_CMD_SPIN_UP = 2, + PORT_CMD_START = 1, + PORT_CMD_ICC_MASK = 4026531840, + PORT_CMD_ICC_ACTIVE = 268435456, + PORT_CMD_ICC_PARTIAL = 536870912, + PORT_CMD_ICC_SLUMBER = 1610612736, + PORT_FBS_DWE_OFFSET = 16, + PORT_FBS_ADO_OFFSET = 12, + PORT_FBS_DEV_OFFSET = 8, + PORT_FBS_DEV_MASK = 3840, + PORT_FBS_SDE = 4, + PORT_FBS_DEC = 2, + PORT_FBS_EN = 1, + PORT_DEVSLP_DM_OFFSET = 25, + PORT_DEVSLP_DM_MASK = 503316480, + PORT_DEVSLP_DITO_OFFSET = 15, + PORT_DEVSLP_MDAT_OFFSET = 10, + PORT_DEVSLP_DETO_OFFSET = 2, + PORT_DEVSLP_DSP = 2, + PORT_DEVSLP_ADSE = 1, + AHCI_HFLAG_NO_NCQ = 1, + AHCI_HFLAG_IGN_IRQ_IF_ERR = 2, + AHCI_HFLAG_IGN_SERR_INTERNAL = 4, + AHCI_HFLAG_32BIT_ONLY = 8, + AHCI_HFLAG_MV_PATA = 16, + AHCI_HFLAG_NO_MSI = 32, + AHCI_HFLAG_NO_PMP = 64, + AHCI_HFLAG_SECT255 = 256, + AHCI_HFLAG_YES_NCQ = 512, + AHCI_HFLAG_NO_SUSPEND = 1024, + AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = 2048, + AHCI_HFLAG_NO_SNTF = 4096, + AHCI_HFLAG_NO_FPDMA_AA = 8192, + AHCI_HFLAG_YES_FBS = 16384, + AHCI_HFLAG_DELAY_ENGINE = 32768, + AHCI_HFLAG_NO_DEVSLP = 131072, + AHCI_HFLAG_NO_FBS = 262144, + AHCI_HFLAG_MULTI_MSI = 1048576, + AHCI_HFLAG_WAKE_BEFORE_STOP = 4194304, + AHCI_HFLAG_YES_ALPM = 8388608, + AHCI_HFLAG_NO_WRITE_TO_RO = 16777216, + AHCI_HFLAG_IS_MOBILE = 33554432, + AHCI_HFLAG_SUSPEND_PHYS = 67108864, + AHCI_HFLAG_IGN_NOTSUPP_POWER_ON = 134217728, + AHCI_FLAG_COMMON = 393346, + ICH_MAP = 144, + PCS_6 = 146, + PCS_7 = 148, + EM_MAX_SLOTS = 8, + EM_MAX_RETRY = 5, + EM_CTL_RST = 512, + EM_CTL_TM = 256, + EM_CTL_MR = 1, + EM_CTL_ALHD = 67108864, + EM_CTL_XMT = 33554432, + EM_CTL_SMB = 16777216, + EM_CTL_SGPIO = 524288, + EM_CTL_SES = 262144, + EM_CTL_SAFTE = 131072, + EM_CTL_LED = 65536, + EM_MSG_TYPE_LED = 1, + EM_MSG_TYPE_SAFTE = 2, + EM_MSG_TYPE_SES2 = 4, + EM_MSG_TYPE_SGPIO = 8, +}; + +struct ahci_cmd_hdr { + __le32 opts; + __le32 status; + __le32 tbl_addr; + __le32 tbl_addr_hi; + __le32 reserved[4]; +}; + +struct ahci_em_priv { + enum sw_activity blink_policy; + struct timer_list timer; + long unsigned int saved_activity; + long unsigned int activity; + long unsigned int led_state; + struct ata_link *link; +}; + +struct ahci_port_priv { + struct ata_link *active_link; + struct ahci_cmd_hdr *cmd_slot; + dma_addr_t cmd_slot_dma; + void *cmd_tbl; + dma_addr_t cmd_tbl_dma; + void *rx_fis; + dma_addr_t rx_fis_dma; + unsigned int ncq_saw_d2h: 1; + unsigned int ncq_saw_dmas: 1; + unsigned int ncq_saw_sdb: 1; + spinlock_t lock; + u32 intr_mask; + bool fbs_supported; + bool fbs_enabled; + int fbs_last_dev; + struct ahci_em_priv em_priv[8]; + char *irq_desc; +}; + +struct ahci_host_priv { + unsigned int flags; + u32 force_port_map; + u32 mask_port_map; + void *mmio; + u32 cap; + u32 cap2; + u32 version; + u32 port_map; + u32 saved_cap; + u32 saved_cap2; + u32 saved_port_map; + u32 em_loc; + u32 em_buf_sz; + u32 em_msg_type; + u32 remapped_nvme; + bool got_runtime_pm; + struct clk *clks[5]; + struct reset_control___2 *rsts; + struct regulator **target_pwrs; + struct regulator *ahci_regulator; + struct regulator *phy_regulator; + struct phy **phys; + unsigned int nports; + void *plat_data; + unsigned int irq; + void (*start_engine)(struct ata_port *); + int (*stop_engine)(struct ata_port *); + irqreturn_t (*irq_handler)(int, void *); + int (*get_irq_vector)(struct ata_host *, int); +}; + +enum { + AHCI_PCI_BAR_STA2X11 = 0, + AHCI_PCI_BAR_CAVIUM = 0, + AHCI_PCI_BAR_LOONGSON = 0, + AHCI_PCI_BAR_ENMOTUS = 2, + AHCI_PCI_BAR_CAVIUM_GEN5 = 4, + AHCI_PCI_BAR_STANDARD = 5, +}; + +enum board_ids { + board_ahci = 0, + board_ahci_ign_iferr = 1, + board_ahci_mobile = 2, + board_ahci_nomsi = 3, + board_ahci_noncq = 4, + board_ahci_nosntf = 5, + board_ahci_yes_fbs = 6, + board_ahci_al = 7, + board_ahci_avn = 8, + board_ahci_mcp65 = 9, + board_ahci_mcp77 = 10, + board_ahci_mcp89 = 11, + board_ahci_mv = 12, + board_ahci_sb600 = 13, + board_ahci_sb700 = 14, + board_ahci_vt8251 = 15, + board_ahci_pcs7 = 16, + board_ahci_mcp_linux = 9, + board_ahci_mcp67 = 9, + board_ahci_mcp73 = 9, + board_ahci_mcp79 = 10, +}; + +struct ahci_sg { + __le32 addr; + __le32 addr_hi; + __le32 reserved; + __le32 flags_size; +}; + +enum { + PIIX_IOCFG = 84, + ICH5_PMR = 144, + ICH5_PCS = 146, + PIIX_SIDPR_BAR = 5, + PIIX_SIDPR_LEN = 16, + PIIX_SIDPR_IDX = 0, + PIIX_SIDPR_DATA = 4, + PIIX_FLAG_CHECKINTR = 268435456, + PIIX_FLAG_SIDPR = 536870912, + PIIX_PATA_FLAGS = 1, + PIIX_SATA_FLAGS = 268435458, + PIIX_FLAG_PIO16 = 1073741824, + PIIX_80C_PRI = 48, + PIIX_80C_SEC = 192, + P0 = 0, + P1 = 1, + P2 = 2, + P3 = 3, + IDE = 4294967295, + NA = 4294967294, + RV = 4294967293, + PIIX_AHCI_DEVICE = 6, + PIIX_HOST_BROKEN_SUSPEND = 16777216, +}; + +enum piix_controller_ids { + piix_pata_mwdma = 0, + piix_pata_33 = 1, + ich_pata_33 = 2, + ich_pata_66 = 3, + ich_pata_100 = 4, + ich_pata_100_nomwdma1 = 5, + ich5_sata = 6, + ich6_sata = 7, + ich6m_sata = 8, + ich8_sata = 9, + ich8_2port_sata = 10, + ich8m_apple_sata = 11, + tolapai_sata = 12, + piix_pata_vmw = 13, + ich8_sata_snb = 14, + ich8_2port_sata_snb = 15, + ich8_2port_sata_byt = 16, +}; + +struct piix_map_db { + const u32 mask; + const u16 port_enable; + const int map[0]; +}; + +struct piix_host_priv { + const int *map; + u32 saved_iocfg; + void *sidpr; +}; + +struct ich_laptop { + u16 device; + u16 subvendor; + u16 subdevice; +}; + +struct spi_device_id { + char name[32]; + kernel_ulong_t driver_data; +}; + +struct ptp_system_timestamp { + struct timespec64 pre_ts; + struct timespec64 post_ts; +}; + +struct spi_statistics { + spinlock_t lock; + long unsigned int messages; + long unsigned int transfers; + long unsigned int errors; + long unsigned int timedout; + long unsigned int spi_sync; + long unsigned int spi_sync_immediate; + long unsigned int spi_async; + long long unsigned int bytes; + long long unsigned int bytes_rx; + long long unsigned int bytes_tx; + long unsigned int transfer_bytes_histo[17]; + long unsigned int transfers_split_maxsize; +}; + +struct spi_delay { + u16 value; + u8 unit; +}; + +struct spi_controller; + +struct spi_device { + struct device dev; + struct spi_controller *controller; + struct spi_controller *master; + u32 max_speed_hz; + u8 chip_select; + u8 bits_per_word; + bool rt; + u32 mode; + int irq; + void *controller_state; + void *controller_data; + char modalias[32]; + const char *driver_override; + int cs_gpio; + struct gpio_desc___2 *cs_gpiod; + struct spi_delay word_delay; + struct spi_statistics statistics; +}; + +struct spi_message; + +struct spi_transfer; + +struct spi_controller_mem_ops; + +struct spi_controller { + struct device dev; + struct list_head list; + s16 bus_num; + u16 num_chipselect; + u16 dma_alignment; + u32 mode_bits; + u32 buswidth_override_bits; + u32 bits_per_word_mask; + u32 min_speed_hz; + u32 max_speed_hz; + u16 flags; + bool slave; + size_t (*max_transfer_size)(struct spi_device *); + size_t (*max_message_size)(struct spi_device *); + struct mutex io_mutex; + spinlock_t bus_lock_spinlock; + struct mutex bus_lock_mutex; + bool bus_lock_flag; + int (*setup)(struct spi_device *); + int (*set_cs_timing)(struct spi_device *, struct spi_delay *, struct spi_delay *, struct spi_delay *); + int (*transfer)(struct spi_device *, struct spi_message *); + void (*cleanup)(struct spi_device *); + bool (*can_dma)(struct spi_controller *, struct spi_device *, struct spi_transfer *); + bool queued; + struct kthread_worker *kworker; + struct kthread_work pump_messages; + spinlock_t queue_lock; + struct list_head queue; + struct spi_message *cur_msg; + bool idling; + bool busy; + bool running; + bool rt; + bool auto_runtime_pm; + bool cur_msg_prepared; + bool cur_msg_mapped; + bool last_cs_enable; + bool last_cs_mode_high; + bool fallback; + struct completion xfer_completion; + size_t max_dma_len; + int (*prepare_transfer_hardware)(struct spi_controller *); + int (*transfer_one_message)(struct spi_controller *, struct spi_message *); + int (*unprepare_transfer_hardware)(struct spi_controller *); + int (*prepare_message)(struct spi_controller *, struct spi_message *); + int (*unprepare_message)(struct spi_controller *, struct spi_message *); + int (*slave_abort)(struct spi_controller *); + void (*set_cs)(struct spi_device *, bool); + int (*transfer_one)(struct spi_controller *, struct spi_device *, struct spi_transfer *); + void (*handle_err)(struct spi_controller *, struct spi_message *); + const struct spi_controller_mem_ops *mem_ops; + struct spi_delay cs_setup; + struct spi_delay cs_hold; + struct spi_delay cs_inactive; + int *cs_gpios; + struct gpio_desc___2 **cs_gpiods; + bool use_gpio_descriptors; + u8 unused_native_cs; + u8 max_native_cs; + struct spi_statistics statistics; + struct dma_chan___2 *dma_tx; + struct dma_chan___2 *dma_rx; + void *dummy_rx; + void *dummy_tx; + int (*fw_translate_cs)(struct spi_controller *, unsigned int); + bool ptp_sts_supported; + long unsigned int irq_flags; +}; + +struct spi_driver { + const struct spi_device_id *id_table; + int (*probe)(struct spi_device *); + int (*remove)(struct spi_device *); + void (*shutdown)(struct spi_device *); + struct device_driver driver; +}; + +struct spi_message { + struct list_head transfers; + struct spi_device *spi; + unsigned int is_dma_mapped: 1; + void (*complete)(void *); + void *context; + unsigned int frame_length; + unsigned int actual_length; + int status; + struct list_head queue; + void *state; + struct list_head resources; +}; + +struct spi_transfer { + const void *tx_buf; + void *rx_buf; + unsigned int len; + dma_addr_t tx_dma; + dma_addr_t rx_dma; + struct sg_table tx_sg; + struct sg_table rx_sg; + unsigned int cs_change: 1; + unsigned int tx_nbits: 3; + unsigned int rx_nbits: 3; + u8 bits_per_word; + u16 delay_usecs; + struct spi_delay delay; + struct spi_delay cs_change_delay; + struct spi_delay word_delay; + u32 speed_hz; + u32 effective_speed_hz; + unsigned int ptp_sts_word_pre; + unsigned int ptp_sts_word_post; + struct ptp_system_timestamp *ptp_sts; + bool timestamped; + struct list_head transfer_list; + u16 error; +}; + +struct spi_mem; + +struct spi_mem_op; + +struct spi_mem_dirmap_desc; + +struct spi_controller_mem_ops { + int (*adjust_op_size)(struct spi_mem *, struct spi_mem_op *); + bool (*supports_op)(struct spi_mem *, const struct spi_mem_op *); + int (*exec_op)(struct spi_mem *, const struct spi_mem_op *); + const char * (*get_name)(struct spi_mem *); + int (*dirmap_create)(struct spi_mem_dirmap_desc *); + void (*dirmap_destroy)(struct spi_mem_dirmap_desc *); + ssize_t (*dirmap_read)(struct spi_mem_dirmap_desc *, u64, size_t, void *); + ssize_t (*dirmap_write)(struct spi_mem_dirmap_desc *, u64, size_t, const void *); +}; + +typedef void (*spi_res_release_t)(struct spi_controller *, struct spi_message *, void *); + +struct spi_res { + struct list_head entry; + spi_res_release_t release; + long long unsigned int data[0]; +}; + +struct spi_replaced_transfers; + +typedef void (*spi_replaced_release_t)(struct spi_controller *, struct spi_message *, struct spi_replaced_transfers *); + +struct spi_replaced_transfers { + spi_replaced_release_t release; + void *extradata; + struct list_head replaced_transfers; + struct list_head *replaced_after; + size_t inserted; + struct spi_transfer inserted_transfers[0]; +}; + +struct spi_board_info { + char modalias[32]; + const void *platform_data; + const struct property_entry *properties; + void *controller_data; + int irq; + u32 max_speed_hz; + u16 bus_num; + u16 chip_select; + u32 mode; +}; + +enum spi_mem_data_dir { + SPI_MEM_NO_DATA = 0, + SPI_MEM_DATA_IN = 1, + SPI_MEM_DATA_OUT = 2, +}; + +struct spi_mem_op { + struct { + u8 nbytes; + u8 buswidth; + u8 dtr: 1; + u16 opcode; + } cmd; + struct { + u8 nbytes; + u8 buswidth; + u8 dtr: 1; + u64 val; + } addr; + struct { + u8 nbytes; + u8 buswidth; + u8 dtr: 1; + } dummy; + struct { + u8 buswidth; + u8 dtr: 1; + enum spi_mem_data_dir dir; + unsigned int nbytes; + union { + void *in; + const void *out; + } buf; + } data; +}; + +struct spi_mem_dirmap_info { + struct spi_mem_op op_tmpl; + u64 offset; + u64 length; +}; + +struct spi_mem_dirmap_desc { + struct spi_mem *mem; + struct spi_mem_dirmap_info info; + unsigned int nodirmap; + void *priv; +}; + +struct spi_mem { + struct spi_device *spi; + void *drvpriv; + const char *name; +}; + +struct trace_event_raw_spi_controller { + struct trace_entry ent; + int bus_num; + char __data[0]; +}; + +struct trace_event_raw_spi_message { + struct trace_entry ent; + int bus_num; + int chip_select; + struct spi_message *msg; + char __data[0]; +}; + +struct trace_event_raw_spi_message_done { + struct trace_entry ent; + int bus_num; + int chip_select; + struct spi_message *msg; + unsigned int frame; + unsigned int actual; + char __data[0]; +}; + +struct trace_event_raw_spi_transfer { + struct trace_entry ent; + int bus_num; + int chip_select; + struct spi_transfer *xfer; + int len; + u32 __data_loc_rx_buf; + u32 __data_loc_tx_buf; + char __data[0]; +}; + +struct trace_event_data_offsets_spi_controller {}; + +struct trace_event_data_offsets_spi_message {}; + +struct trace_event_data_offsets_spi_message_done {}; + +struct trace_event_data_offsets_spi_transfer { + u32 rx_buf; + u32 tx_buf; +}; + +typedef void (*btf_trace_spi_controller_idle)(void *, struct spi_controller *); + +typedef void (*btf_trace_spi_controller_busy)(void *, struct spi_controller *); + +typedef void (*btf_trace_spi_message_submit)(void *, struct spi_message *); + +typedef void (*btf_trace_spi_message_start)(void *, struct spi_message *); + +typedef void (*btf_trace_spi_message_done)(void *, struct spi_message *); + +typedef void (*btf_trace_spi_transfer_start)(void *, struct spi_message *, struct spi_transfer *); + +typedef void (*btf_trace_spi_transfer_stop)(void *, struct spi_message *, struct spi_transfer *); + +struct boardinfo { + struct list_head list; + struct spi_board_info board_info; +}; + +struct acpi_spi_lookup { + struct spi_controller *ctlr; + u32 max_speed_hz; + u32 mode; + int irq; + u8 bits_per_word; + u8 chip_select; +}; + +struct amd_spi { + void *io_remap_addr; + long unsigned int io_base_addr; + u32 rom_addr; + u8 chip_select; +}; + +struct devprobe2 { + struct net_device * (*probe)(int); + int status; +}; + +enum { + NETIF_F_SG_BIT = 0, + NETIF_F_IP_CSUM_BIT = 1, + __UNUSED_NETIF_F_1 = 2, + NETIF_F_HW_CSUM_BIT = 3, + NETIF_F_IPV6_CSUM_BIT = 4, + NETIF_F_HIGHDMA_BIT = 5, + NETIF_F_FRAGLIST_BIT = 6, + NETIF_F_HW_VLAN_CTAG_TX_BIT = 7, + NETIF_F_HW_VLAN_CTAG_RX_BIT = 8, + NETIF_F_HW_VLAN_CTAG_FILTER_BIT = 9, + NETIF_F_VLAN_CHALLENGED_BIT = 10, + NETIF_F_GSO_BIT = 11, + NETIF_F_LLTX_BIT = 12, + NETIF_F_NETNS_LOCAL_BIT = 13, + NETIF_F_GRO_BIT = 14, + NETIF_F_LRO_BIT = 15, + NETIF_F_GSO_SHIFT = 16, + NETIF_F_TSO_BIT = 16, + NETIF_F_GSO_ROBUST_BIT = 17, + NETIF_F_TSO_ECN_BIT = 18, + NETIF_F_TSO_MANGLEID_BIT = 19, + NETIF_F_TSO6_BIT = 20, + NETIF_F_FSO_BIT = 21, + NETIF_F_GSO_GRE_BIT = 22, + NETIF_F_GSO_GRE_CSUM_BIT = 23, + NETIF_F_GSO_IPXIP4_BIT = 24, + NETIF_F_GSO_IPXIP6_BIT = 25, + NETIF_F_GSO_UDP_TUNNEL_BIT = 26, + NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT = 27, + NETIF_F_GSO_PARTIAL_BIT = 28, + NETIF_F_GSO_TUNNEL_REMCSUM_BIT = 29, + NETIF_F_GSO_SCTP_BIT = 30, + NETIF_F_GSO_ESP_BIT = 31, + NETIF_F_GSO_UDP_BIT = 32, + NETIF_F_GSO_UDP_L4_BIT = 33, + NETIF_F_GSO_FRAGLIST_BIT = 34, + NETIF_F_GSO_LAST = 34, + NETIF_F_FCOE_CRC_BIT = 35, + NETIF_F_SCTP_CRC_BIT = 36, + NETIF_F_FCOE_MTU_BIT = 37, + NETIF_F_NTUPLE_BIT = 38, + NETIF_F_RXHASH_BIT = 39, + NETIF_F_RXCSUM_BIT = 40, + NETIF_F_NOCACHE_COPY_BIT = 41, + NETIF_F_LOOPBACK_BIT = 42, + NETIF_F_RXFCS_BIT = 43, + NETIF_F_RXALL_BIT = 44, + NETIF_F_HW_VLAN_STAG_TX_BIT = 45, + NETIF_F_HW_VLAN_STAG_RX_BIT = 46, + NETIF_F_HW_VLAN_STAG_FILTER_BIT = 47, + NETIF_F_HW_L2FW_DOFFLOAD_BIT = 48, + NETIF_F_HW_TC_BIT = 49, + NETIF_F_HW_ESP_BIT = 50, + NETIF_F_HW_ESP_TX_CSUM_BIT = 51, + NETIF_F_RX_UDP_TUNNEL_PORT_BIT = 52, + NETIF_F_HW_TLS_TX_BIT = 53, + NETIF_F_HW_TLS_RX_BIT = 54, + NETIF_F_GRO_HW_BIT = 55, + NETIF_F_HW_TLS_RECORD_BIT = 56, + NETIF_F_GRO_FRAGLIST_BIT = 57, + NETIF_F_HW_MACSEC_BIT = 58, + NETDEV_FEATURE_COUNT = 59, +}; + +enum { + SKBTX_HW_TSTAMP = 1, + SKBTX_SW_TSTAMP = 2, + SKBTX_IN_PROGRESS = 4, + SKBTX_DEV_ZEROCOPY = 8, + SKBTX_WIFI_STATUS = 16, + SKBTX_SHARED_FRAG = 32, + SKBTX_SCHED_TSTAMP = 64, +}; + +enum netdev_priv_flags { + IFF_802_1Q_VLAN = 1, + IFF_EBRIDGE = 2, + IFF_BONDING = 4, + IFF_ISATAP = 8, + IFF_WAN_HDLC = 16, + IFF_XMIT_DST_RELEASE = 32, + IFF_DONT_BRIDGE = 64, + IFF_DISABLE_NETPOLL = 128, + IFF_MACVLAN_PORT = 256, + IFF_BRIDGE_PORT = 512, + IFF_OVS_DATAPATH = 1024, + IFF_TX_SKB_SHARING = 2048, + IFF_UNICAST_FLT = 4096, + IFF_TEAM_PORT = 8192, + IFF_SUPP_NOFCS = 16384, + IFF_LIVE_ADDR_CHANGE = 32768, + IFF_MACVLAN = 65536, + IFF_XMIT_DST_RELEASE_PERM = 131072, + IFF_L3MDEV_MASTER = 262144, + IFF_NO_QUEUE = 524288, + IFF_OPENVSWITCH = 1048576, + IFF_L3MDEV_SLAVE = 2097152, + IFF_TEAM = 4194304, + IFF_RXFH_CONFIGURED = 8388608, + IFF_PHONY_HEADROOM = 16777216, + IFF_MACSEC = 33554432, + IFF_NO_RX_HANDLER = 67108864, + IFF_FAILOVER = 134217728, + IFF_FAILOVER_SLAVE = 268435456, + IFF_L3MDEV_RX_HANDLER = 536870912, + IFF_LIVE_RENAME_OK = 1073741824, +}; + +struct mdio_board_info { + const char *bus_id; + char modalias[32]; + int mdio_addr; + const void *platform_data; +}; + +struct mdio_board_entry { + struct list_head list; + struct mdio_board_info board_info; +}; + +struct mdiobus_devres { + struct mii_bus *mii; +}; + +enum netdev_state_t { + __LINK_STATE_START = 0, + __LINK_STATE_PRESENT = 1, + __LINK_STATE_NOCARRIER = 2, + __LINK_STATE_LINKWATCH_PENDING = 3, + __LINK_STATE_DORMANT = 4, + __LINK_STATE_TESTING = 5, +}; + +struct mii_ioctl_data { + __u16 phy_id; + __u16 reg_num; + __u16 val_in; + __u16 val_out; +}; + +enum { + ETHTOOL_MSG_KERNEL_NONE = 0, + ETHTOOL_MSG_STRSET_GET_REPLY = 1, + ETHTOOL_MSG_LINKINFO_GET_REPLY = 2, + ETHTOOL_MSG_LINKINFO_NTF = 3, + ETHTOOL_MSG_LINKMODES_GET_REPLY = 4, + ETHTOOL_MSG_LINKMODES_NTF = 5, + ETHTOOL_MSG_LINKSTATE_GET_REPLY = 6, + ETHTOOL_MSG_DEBUG_GET_REPLY = 7, + ETHTOOL_MSG_DEBUG_NTF = 8, + ETHTOOL_MSG_WOL_GET_REPLY = 9, + ETHTOOL_MSG_WOL_NTF = 10, + ETHTOOL_MSG_FEATURES_GET_REPLY = 11, + ETHTOOL_MSG_FEATURES_SET_REPLY = 12, + ETHTOOL_MSG_FEATURES_NTF = 13, + ETHTOOL_MSG_PRIVFLAGS_GET_REPLY = 14, + ETHTOOL_MSG_PRIVFLAGS_NTF = 15, + ETHTOOL_MSG_RINGS_GET_REPLY = 16, + ETHTOOL_MSG_RINGS_NTF = 17, + ETHTOOL_MSG_CHANNELS_GET_REPLY = 18, + ETHTOOL_MSG_CHANNELS_NTF = 19, + ETHTOOL_MSG_COALESCE_GET_REPLY = 20, + ETHTOOL_MSG_COALESCE_NTF = 21, + ETHTOOL_MSG_PAUSE_GET_REPLY = 22, + ETHTOOL_MSG_PAUSE_NTF = 23, + ETHTOOL_MSG_EEE_GET_REPLY = 24, + ETHTOOL_MSG_EEE_NTF = 25, + ETHTOOL_MSG_TSINFO_GET_REPLY = 26, + ETHTOOL_MSG_CABLE_TEST_NTF = 27, + ETHTOOL_MSG_CABLE_TEST_TDR_NTF = 28, + ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY = 29, + __ETHTOOL_MSG_KERNEL_CNT = 30, + ETHTOOL_MSG_KERNEL_MAX = 29, +}; + +struct phy_led_trigger { + struct led_trigger trigger; + char name[76]; + unsigned int speed; +}; + +struct phy_setting { + u32 speed; + u8 duplex; + u8 bit; +}; + +struct ethtool_phy_ops { + int (*get_sset_count)(struct phy_device *); + int (*get_strings)(struct phy_device *, u8 *); + int (*get_stats)(struct phy_device *, struct ethtool_stats *, u64 *); + int (*start_cable_test)(struct phy_device *, struct netlink_ext_ack *); + int (*start_cable_test_tdr)(struct phy_device *, struct netlink_ext_ack *, const struct phy_tdr_config *); +}; + +struct phy_fixup { + struct list_head list; + char bus_id[64]; + u32 phy_uid; + u32 phy_uid_mask; + int (*run)(struct phy_device *); +}; + +struct sfp_eeprom_base { + u8 phys_id; + u8 phys_ext_id; + u8 connector; + u8 if_1x_copper_passive: 1; + u8 if_1x_copper_active: 1; + u8 if_1x_lx: 1; + u8 if_1x_sx: 1; + u8 e10g_base_sr: 1; + u8 e10g_base_lr: 1; + u8 e10g_base_lrm: 1; + u8 e10g_base_er: 1; + u8 sonet_oc3_short_reach: 1; + u8 sonet_oc3_smf_intermediate_reach: 1; + u8 sonet_oc3_smf_long_reach: 1; + u8 unallocated_5_3: 1; + u8 sonet_oc12_short_reach: 1; + u8 sonet_oc12_smf_intermediate_reach: 1; + u8 sonet_oc12_smf_long_reach: 1; + u8 unallocated_5_7: 1; + u8 sonet_oc48_short_reach: 1; + u8 sonet_oc48_intermediate_reach: 1; + u8 sonet_oc48_long_reach: 1; + u8 sonet_reach_bit2: 1; + u8 sonet_reach_bit1: 1; + u8 sonet_oc192_short_reach: 1; + u8 escon_smf_1310_laser: 1; + u8 escon_mmf_1310_led: 1; + u8 e1000_base_sx: 1; + u8 e1000_base_lx: 1; + u8 e1000_base_cx: 1; + u8 e1000_base_t: 1; + u8 e100_base_lx: 1; + u8 e100_base_fx: 1; + u8 e_base_bx10: 1; + u8 e_base_px: 1; + u8 fc_tech_electrical_inter_enclosure: 1; + u8 fc_tech_lc: 1; + u8 fc_tech_sa: 1; + u8 fc_ll_m: 1; + u8 fc_ll_l: 1; + u8 fc_ll_i: 1; + u8 fc_ll_s: 1; + u8 fc_ll_v: 1; + u8 unallocated_8_0: 1; + u8 unallocated_8_1: 1; + u8 sfp_ct_passive: 1; + u8 sfp_ct_active: 1; + u8 fc_tech_ll: 1; + u8 fc_tech_sl: 1; + u8 fc_tech_sn: 1; + u8 fc_tech_electrical_intra_enclosure: 1; + u8 fc_media_sm: 1; + u8 unallocated_9_1: 1; + u8 fc_media_m5: 1; + u8 fc_media_m6: 1; + u8 fc_media_tv: 1; + u8 fc_media_mi: 1; + u8 fc_media_tp: 1; + u8 fc_media_tw: 1; + u8 fc_speed_100: 1; + u8 unallocated_10_1: 1; + u8 fc_speed_200: 1; + u8 fc_speed_3200: 1; + u8 fc_speed_400: 1; + u8 fc_speed_1600: 1; + u8 fc_speed_800: 1; + u8 fc_speed_1200: 1; + u8 encoding; + u8 br_nominal; + u8 rate_id; + u8 link_len[6]; + char vendor_name[16]; + u8 extended_cc; + char vendor_oui[3]; + char vendor_pn[16]; + char vendor_rev[4]; + union { + __be16 optical_wavelength; + __be16 cable_compliance; + struct { + u8 sff8431_app_e: 1; + u8 fc_pi_4_app_h: 1; + u8 reserved60_2: 6; + u8 reserved61: 8; + } passive; + struct { + u8 sff8431_app_e: 1; + u8 fc_pi_4_app_h: 1; + u8 sff8431_lim: 1; + u8 fc_pi_4_lim: 1; + u8 reserved60_4: 4; + u8 reserved61: 8; + } active; + }; + u8 reserved62; + u8 cc_base; +}; + +struct sfp_eeprom_ext { + __be16 options; + u8 br_max; + u8 br_min; + char vendor_sn[16]; + char datecode[8]; + u8 diagmon; + u8 enhopts; + u8 sff8472_compliance; + u8 cc_ext; +}; + +struct sfp_eeprom_id { + struct sfp_eeprom_base base; + struct sfp_eeprom_ext ext; +}; + +struct sfp_upstream_ops { + void (*attach)(void *, struct sfp_bus *); + void (*detach)(void *, struct sfp_bus *); + int (*module_insert)(void *, const struct sfp_eeprom_id *); + void (*module_remove)(void *); + int (*module_start)(void *); + void (*module_stop)(void *); + void (*link_down)(void *); + void (*link_up)(void *); + int (*connect_phy)(void *, struct phy_device *); + void (*disconnect_phy)(void *); +}; + +struct trace_event_raw_mdio_access { + struct trace_entry ent; + char busid[61]; + char read; + u8 addr; + u16 val; + unsigned int regnum; + char __data[0]; +}; + +struct trace_event_data_offsets_mdio_access {}; + +typedef void (*btf_trace_mdio_access)(void *, struct mii_bus *, char, u8, unsigned int, u16, int); + +struct mdio_bus_stat_attr { + int addr; + unsigned int field_offset; +}; + +struct mdio_driver { + struct mdio_driver_common mdiodrv; + int (*probe)(struct mdio_device *); + void (*remove)(struct mdio_device *); +}; + +struct fixed_phy_status { + int link; + int speed; + int duplex; + int pause; + int asym_pause; +}; + +struct swmii_regs { + u16 bmsr; + u16 lpa; + u16 lpagb; + u16 estat; +}; + +enum { + SWMII_SPEED_10 = 0, + SWMII_SPEED_100 = 1, + SWMII_SPEED_1000 = 2, + SWMII_DUPLEX_HALF = 0, + SWMII_DUPLEX_FULL = 1, +}; + +struct mii_timestamping_ctrl { + struct mii_timestamper * (*probe_channel)(struct device *, unsigned int); + void (*release_channel)(struct device *, struct mii_timestamper *); +}; + +struct mii_timestamping_desc { + struct list_head list; + struct mii_timestamping_ctrl *ctrl; + struct device *device; +}; + +struct sfp; + +struct sfp_socket_ops; + +struct sfp_quirk; + +struct sfp_bus { + struct kref kref; + struct list_head node; + struct fwnode_handle *fwnode; + const struct sfp_socket_ops *socket_ops; + struct device *sfp_dev; + struct sfp *sfp; + const struct sfp_quirk *sfp_quirk; + const struct sfp_upstream_ops *upstream_ops; + void *upstream; + struct phy_device *phydev; + bool registered; + bool started; +}; + +enum { + SFF8024_ID_UNK = 0, + SFF8024_ID_SFF_8472 = 2, + SFF8024_ID_SFP = 3, + SFF8024_ID_DWDM_SFP = 11, + SFF8024_ID_QSFP_8438 = 12, + SFF8024_ID_QSFP_8436_8636 = 13, + SFF8024_ID_QSFP28_8636 = 17, + SFF8024_ENCODING_UNSPEC = 0, + SFF8024_ENCODING_8B10B = 1, + SFF8024_ENCODING_4B5B = 2, + SFF8024_ENCODING_NRZ = 3, + SFF8024_ENCODING_8472_MANCHESTER = 4, + SFF8024_ENCODING_8472_SONET = 5, + SFF8024_ENCODING_8472_64B66B = 6, + SFF8024_ENCODING_8436_MANCHESTER = 6, + SFF8024_ENCODING_8436_SONET = 4, + SFF8024_ENCODING_8436_64B66B = 5, + SFF8024_ENCODING_256B257B = 7, + SFF8024_ENCODING_PAM4 = 8, + SFF8024_CONNECTOR_UNSPEC = 0, + SFF8024_CONNECTOR_SC = 1, + SFF8024_CONNECTOR_FIBERJACK = 6, + SFF8024_CONNECTOR_LC = 7, + SFF8024_CONNECTOR_MT_RJ = 8, + SFF8024_CONNECTOR_MU = 9, + SFF8024_CONNECTOR_SG = 10, + SFF8024_CONNECTOR_OPTICAL_PIGTAIL = 11, + SFF8024_CONNECTOR_MPO_1X12 = 12, + SFF8024_CONNECTOR_MPO_2X16 = 13, + SFF8024_CONNECTOR_HSSDC_II = 32, + SFF8024_CONNECTOR_COPPER_PIGTAIL = 33, + SFF8024_CONNECTOR_RJ45 = 34, + SFF8024_CONNECTOR_NOSEPARATE = 35, + SFF8024_CONNECTOR_MXC_2X16 = 36, + SFF8024_ECC_UNSPEC = 0, + SFF8024_ECC_100G_25GAUI_C2M_AOC = 1, + SFF8024_ECC_100GBASE_SR4_25GBASE_SR = 2, + SFF8024_ECC_100GBASE_LR4_25GBASE_LR = 3, + SFF8024_ECC_100GBASE_ER4_25GBASE_ER = 4, + SFF8024_ECC_100GBASE_SR10 = 5, + SFF8024_ECC_100GBASE_CR4 = 11, + SFF8024_ECC_25GBASE_CR_S = 12, + SFF8024_ECC_25GBASE_CR_N = 13, + SFF8024_ECC_10GBASE_T_SFI = 22, + SFF8024_ECC_10GBASE_T_SR = 28, + SFF8024_ECC_5GBASE_T = 29, + SFF8024_ECC_2_5GBASE_T = 30, +}; + +struct sfp_socket_ops { + void (*attach)(struct sfp *); + void (*detach)(struct sfp *); + void (*start)(struct sfp *); + void (*stop)(struct sfp *); + int (*module_info)(struct sfp *, struct ethtool_modinfo *); + int (*module_eeprom)(struct sfp *, struct ethtool_eeprom *, u8 *); +}; + +struct sfp_quirk { + const char *vendor; + const char *part; + void (*modes)(const struct sfp_eeprom_id *, long unsigned int *); +}; + +struct fixed_mdio_bus { + struct mii_bus *mii_bus; + struct list_head phys; +}; + +struct fixed_phy { + int addr; + struct phy_device *phydev; + struct fixed_phy_status status; + bool no_carrier; + int (*link_update)(struct net_device *, struct fixed_phy_status *); + struct list_head node; + struct gpio_desc___2 *link_gpiod; +}; + +struct mdio_device_id { + __u32 phy_id; + __u32 phy_id_mask; +}; + +struct flow_dissector { + unsigned int used_keys; + short unsigned int offset[28]; +}; + +struct flow_match { + struct flow_dissector *dissector; + void *mask; + void *key; +}; + +enum flow_action_id { + FLOW_ACTION_ACCEPT = 0, + FLOW_ACTION_DROP = 1, + FLOW_ACTION_TRAP = 2, + FLOW_ACTION_GOTO = 3, + FLOW_ACTION_REDIRECT = 4, + FLOW_ACTION_MIRRED = 5, + FLOW_ACTION_REDIRECT_INGRESS = 6, + FLOW_ACTION_MIRRED_INGRESS = 7, + FLOW_ACTION_VLAN_PUSH = 8, + FLOW_ACTION_VLAN_POP = 9, + FLOW_ACTION_VLAN_MANGLE = 10, + FLOW_ACTION_TUNNEL_ENCAP = 11, + FLOW_ACTION_TUNNEL_DECAP = 12, + FLOW_ACTION_MANGLE = 13, + FLOW_ACTION_ADD = 14, + FLOW_ACTION_CSUM = 15, + FLOW_ACTION_MARK = 16, + FLOW_ACTION_PTYPE = 17, + FLOW_ACTION_PRIORITY = 18, + FLOW_ACTION_WAKE = 19, + FLOW_ACTION_QUEUE = 20, + FLOW_ACTION_SAMPLE = 21, + FLOW_ACTION_POLICE = 22, + FLOW_ACTION_CT = 23, + FLOW_ACTION_CT_METADATA = 24, + FLOW_ACTION_MPLS_PUSH = 25, + FLOW_ACTION_MPLS_POP = 26, + FLOW_ACTION_MPLS_MANGLE = 27, + FLOW_ACTION_GATE = 28, + NUM_FLOW_ACTIONS = 29, +}; + +enum flow_action_hw_stats { + FLOW_ACTION_HW_STATS_IMMEDIATE = 1, + FLOW_ACTION_HW_STATS_DELAYED = 2, + FLOW_ACTION_HW_STATS_ANY = 3, + FLOW_ACTION_HW_STATS_DISABLED = 4, + FLOW_ACTION_HW_STATS_DONT_CARE = 7, +}; + +typedef void (*action_destr)(void *); + +enum flow_action_mangle_base { + FLOW_ACT_MANGLE_UNSPEC = 0, + FLOW_ACT_MANGLE_HDR_TYPE_ETH = 1, + FLOW_ACT_MANGLE_HDR_TYPE_IP4 = 2, + FLOW_ACT_MANGLE_HDR_TYPE_IP6 = 3, + FLOW_ACT_MANGLE_HDR_TYPE_TCP = 4, + FLOW_ACT_MANGLE_HDR_TYPE_UDP = 5, +}; + +struct nf_flowtable; + +struct ip_tunnel_info; + +struct psample_group; + +struct action_gate_entry; + +struct flow_action_cookie; + +struct flow_action_entry { + enum flow_action_id id; + enum flow_action_hw_stats hw_stats; + action_destr destructor; + void *destructor_priv; + union { + u32 chain_index; + struct net_device *dev; + struct { + u16 vid; + __be16 proto; + u8 prio; + } vlan; + struct { + enum flow_action_mangle_base htype; + u32 offset; + u32 mask; + u32 val; + } mangle; + struct ip_tunnel_info *tunnel; + u32 csum_flags; + u32 mark; + u16 ptype; + u32 priority; + struct { + u32 ctx; + u32 index; + u8 vf; + } queue; + struct { + struct psample_group *psample_group; + u32 rate; + u32 trunc_size; + bool truncate; + } sample; + struct { + u32 index; + u32 burst; + u64 rate_bytes_ps; + u32 mtu; + } police; + struct { + int action; + u16 zone; + struct nf_flowtable *flow_table; + } ct; + struct { + long unsigned int cookie; + u32 mark; + u32 labels[4]; + } ct_metadata; + struct { + u32 label; + __be16 proto; + u8 tc; + u8 bos; + u8 ttl; + } mpls_push; + struct { + __be16 proto; + } mpls_pop; + struct { + u32 label; + u8 tc; + u8 bos; + u8 ttl; + } mpls_mangle; + struct { + u32 index; + s32 prio; + u64 basetime; + u64 cycletime; + u64 cycletimeext; + u32 num_entries; + struct action_gate_entry *entries; + } gate; + }; + struct flow_action_cookie *cookie; +}; + +struct flow_action { + unsigned int num_entries; + struct flow_action_entry entries[0]; +}; + +struct flow_rule { + struct flow_match match; + struct flow_action action; +}; + +struct dsa_chip_data { + struct device *host_dev; + int sw_addr; + struct device *netdev[12]; + int eeprom_len; + struct device_node *of_node; + char *port_names[12]; + struct device_node *port_dn[12]; + s8 rtable[4]; +}; + +struct dsa_platform_data { + struct device *netdev; + struct net_device *of_netdev; + int nr_chips; + struct dsa_chip_data *chip; +}; + +struct phylink_link_state { + long unsigned int advertising[2]; + long unsigned int lp_advertising[2]; + phy_interface_t interface; + int speed; + int duplex; + int pause; + unsigned int link: 1; + unsigned int an_enabled: 1; + unsigned int an_complete: 1; +}; + +enum phylink_op_type { + PHYLINK_NETDEV = 0, + PHYLINK_DEV = 1, +}; + +struct phylink_config { + struct device *dev; + enum phylink_op_type type; + bool pcs_poll; + bool poll_fixed_state; + void (*get_fixed_state)(struct phylink_config *, struct phylink_link_state *); +}; + +enum devlink_port_type { + DEVLINK_PORT_TYPE_NOTSET = 0, + DEVLINK_PORT_TYPE_AUTO = 1, + DEVLINK_PORT_TYPE_ETH = 2, + DEVLINK_PORT_TYPE_IB = 3, +}; + +enum devlink_port_flavour { + DEVLINK_PORT_FLAVOUR_PHYSICAL = 0, + DEVLINK_PORT_FLAVOUR_CPU = 1, + DEVLINK_PORT_FLAVOUR_DSA = 2, + DEVLINK_PORT_FLAVOUR_PCI_PF = 3, + DEVLINK_PORT_FLAVOUR_PCI_VF = 4, + DEVLINK_PORT_FLAVOUR_VIRTUAL = 5, + DEVLINK_PORT_FLAVOUR_UNUSED = 6, +}; + +struct devlink_port_phys_attrs { + u32 port_number; + u32 split_subport_number; +}; + +struct devlink_port_pci_pf_attrs { + u32 controller; + u16 pf; + u8 external: 1; +}; + +struct devlink_port_pci_vf_attrs { + u32 controller; + u16 pf; + u16 vf; + u8 external: 1; +}; + +struct devlink_port_attrs { + u8 split: 1; + u8 splittable: 1; + u32 lanes; + enum devlink_port_flavour flavour; + struct netdev_phys_item_id switch_id; + union { + struct devlink_port_phys_attrs phys; + struct devlink_port_pci_pf_attrs pci_pf; + struct devlink_port_pci_vf_attrs pci_vf; + }; +}; + +struct devlink; + +struct devlink_port { + struct list_head list; + struct list_head param_list; + struct list_head region_list; + struct devlink *devlink; + unsigned int index; + bool registered; + spinlock_t type_lock; + enum devlink_port_type type; + enum devlink_port_type desired_type; + void *type_dev; + struct devlink_port_attrs attrs; + u8 attrs_set: 1; + u8 switch_port: 1; + struct delayed_work type_warn_dw; + struct list_head reporter_list; + struct mutex reporters_lock; +}; + +struct dsa_device_ops; + +struct dsa_switch_tree; + +struct packet_type; + +struct dsa_switch; + +struct dsa_netdevice_ops; + +struct dsa_port { + union { + struct net_device *master; + struct net_device *slave; + }; + const struct dsa_device_ops *tag_ops; + struct dsa_switch_tree *dst; + struct sk_buff * (*rcv)(struct sk_buff *, struct net_device *, struct packet_type *); + bool (*filter)(const struct sk_buff *, struct net_device *); + enum { + DSA_PORT_TYPE_UNUSED = 0, + DSA_PORT_TYPE_CPU = 1, + DSA_PORT_TYPE_DSA = 2, + DSA_PORT_TYPE_USER = 3, + } type; + struct dsa_switch *ds; + unsigned int index; + const char *name; + struct dsa_port *cpu_dp; + const char *mac; + struct device_node *dn; + unsigned int ageing_time; + bool vlan_filtering; + u8 stp_state; + struct net_device *bridge_dev; + struct devlink_port devlink_port; + bool devlink_port_setup; + struct phylink *pl; + struct phylink_config pl_config; + struct list_head list; + void *priv; + const struct ethtool_ops *orig_ethtool_ops; + const struct dsa_netdevice_ops *netdev_ops; + bool setup; +}; + +struct packet_type { + __be16 type; + bool ignore_outgoing; + struct net_device *dev; + int (*func)(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); + void (*list_func)(struct list_head *, struct packet_type *, struct net_device *); + bool (*id_match)(struct packet_type *, struct sock *); + void *af_packet_priv; + struct list_head list; +}; + +struct netdev_notifier_changeupper_info { + struct netdev_notifier_info info; + struct net_device *upper_dev; + bool master; + bool linking; + void *upper_info; +}; + +struct flow_action_cookie { + u32 cookie_len; + u8 cookie[0]; +}; + +struct flow_stats { + u64 pkts; + u64 bytes; + u64 drops; + u64 lastused; + enum flow_action_hw_stats used_hw_stats; + bool used_hw_stats_valid; +}; + +enum flow_cls_command { + FLOW_CLS_REPLACE = 0, + FLOW_CLS_DESTROY = 1, + FLOW_CLS_STATS = 2, + FLOW_CLS_TMPLT_CREATE = 3, + FLOW_CLS_TMPLT_DESTROY = 4, +}; + +struct flow_cls_common_offload { + u32 chain_index; + __be16 protocol; + u32 prio; + struct netlink_ext_ack *extack; +}; + +struct flow_cls_offload { + struct flow_cls_common_offload common; + enum flow_cls_command command; + long unsigned int cookie; + struct flow_rule *rule; + struct flow_stats stats; + u32 classid; +}; + +enum devlink_sb_pool_type { + DEVLINK_SB_POOL_TYPE_INGRESS = 0, + DEVLINK_SB_POOL_TYPE_EGRESS = 1, +}; + +enum devlink_sb_threshold_type { + DEVLINK_SB_THRESHOLD_TYPE_STATIC = 0, + DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC = 1, +}; + +enum devlink_eswitch_encap_mode { + DEVLINK_ESWITCH_ENCAP_MODE_NONE = 0, + DEVLINK_ESWITCH_ENCAP_MODE_BASIC = 1, +}; + +enum devlink_param_cmode { + DEVLINK_PARAM_CMODE_RUNTIME = 0, + DEVLINK_PARAM_CMODE_DRIVERINIT = 1, + DEVLINK_PARAM_CMODE_PERMANENT = 2, + __DEVLINK_PARAM_CMODE_MAX = 3, + DEVLINK_PARAM_CMODE_MAX = 2, +}; + +enum devlink_trap_action { + DEVLINK_TRAP_ACTION_DROP = 0, + DEVLINK_TRAP_ACTION_TRAP = 1, + DEVLINK_TRAP_ACTION_MIRROR = 2, +}; + +enum devlink_trap_type { + DEVLINK_TRAP_TYPE_DROP = 0, + DEVLINK_TRAP_TYPE_EXCEPTION = 1, + DEVLINK_TRAP_TYPE_CONTROL = 2, +}; + +enum devlink_reload_action { + DEVLINK_RELOAD_ACTION_UNSPEC = 0, + DEVLINK_RELOAD_ACTION_DRIVER_REINIT = 1, + DEVLINK_RELOAD_ACTION_FW_ACTIVATE = 2, + __DEVLINK_RELOAD_ACTION_MAX = 3, + DEVLINK_RELOAD_ACTION_MAX = 2, +}; + +enum devlink_reload_limit { + DEVLINK_RELOAD_LIMIT_UNSPEC = 0, + DEVLINK_RELOAD_LIMIT_NO_RESET = 1, + __DEVLINK_RELOAD_LIMIT_MAX = 2, + DEVLINK_RELOAD_LIMIT_MAX = 1, +}; + +enum devlink_dpipe_field_mapping_type { + DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0, + DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 1, +}; + +struct devlink_dev_stats { + u32 reload_stats[6]; + u32 remote_reload_stats[6]; +}; + +struct devlink_dpipe_headers; + +struct devlink_ops; + +struct devlink { + struct list_head list; + struct list_head port_list; + struct list_head sb_list; + struct list_head dpipe_table_list; + struct list_head resource_list; + struct list_head param_list; + struct list_head region_list; + struct list_head reporter_list; + struct mutex reporters_lock; + struct devlink_dpipe_headers *dpipe_headers; + struct list_head trap_list; + struct list_head trap_group_list; + struct list_head trap_policer_list; + const struct devlink_ops *ops; + struct xarray snapshot_ids; + struct devlink_dev_stats stats; + struct device *dev; + possible_net_t _net; + struct mutex lock; + u8 reload_failed: 1; + u8 reload_enabled: 1; + u8 registered: 1; + long: 61; + long: 64; + char priv[0]; +}; + +struct devlink_dpipe_header; + +struct devlink_dpipe_headers { + struct devlink_dpipe_header **headers; + unsigned int headers_count; +}; + +struct devlink_sb_pool_info; + +struct devlink_info_req; + +struct devlink_flash_update_params; + +struct devlink_trap; + +struct devlink_trap_group; + +struct devlink_trap_policer; + +struct devlink_ops { + u32 supported_flash_update_params; + long unsigned int reload_actions; + long unsigned int reload_limits; + int (*reload_down)(struct devlink *, bool, enum devlink_reload_action, enum devlink_reload_limit, struct netlink_ext_ack *); + int (*reload_up)(struct devlink *, enum devlink_reload_action, enum devlink_reload_limit, u32 *, struct netlink_ext_ack *); + int (*port_type_set)(struct devlink_port *, enum devlink_port_type); + int (*port_split)(struct devlink *, unsigned int, unsigned int, struct netlink_ext_ack *); + int (*port_unsplit)(struct devlink *, unsigned int, struct netlink_ext_ack *); + int (*sb_pool_get)(struct devlink *, unsigned int, u16, struct devlink_sb_pool_info *); + int (*sb_pool_set)(struct devlink *, unsigned int, u16, u32, enum devlink_sb_threshold_type, struct netlink_ext_ack *); + int (*sb_port_pool_get)(struct devlink_port *, unsigned int, u16, u32 *); + int (*sb_port_pool_set)(struct devlink_port *, unsigned int, u16, u32, struct netlink_ext_ack *); + int (*sb_tc_pool_bind_get)(struct devlink_port *, unsigned int, u16, enum devlink_sb_pool_type, u16 *, u32 *); + int (*sb_tc_pool_bind_set)(struct devlink_port *, unsigned int, u16, enum devlink_sb_pool_type, u16, u32, struct netlink_ext_ack *); + int (*sb_occ_snapshot)(struct devlink *, unsigned int); + int (*sb_occ_max_clear)(struct devlink *, unsigned int); + int (*sb_occ_port_pool_get)(struct devlink_port *, unsigned int, u16, u32 *, u32 *); + int (*sb_occ_tc_port_bind_get)(struct devlink_port *, unsigned int, u16, enum devlink_sb_pool_type, u32 *, u32 *); + int (*eswitch_mode_get)(struct devlink *, u16 *); + int (*eswitch_mode_set)(struct devlink *, u16, struct netlink_ext_ack *); + int (*eswitch_inline_mode_get)(struct devlink *, u8 *); + int (*eswitch_inline_mode_set)(struct devlink *, u8, struct netlink_ext_ack *); + int (*eswitch_encap_mode_get)(struct devlink *, enum devlink_eswitch_encap_mode *); + int (*eswitch_encap_mode_set)(struct devlink *, enum devlink_eswitch_encap_mode, struct netlink_ext_ack *); + int (*info_get)(struct devlink *, struct devlink_info_req *, struct netlink_ext_ack *); + int (*flash_update)(struct devlink *, struct devlink_flash_update_params *, struct netlink_ext_ack *); + int (*trap_init)(struct devlink *, const struct devlink_trap *, void *); + void (*trap_fini)(struct devlink *, const struct devlink_trap *, void *); + int (*trap_action_set)(struct devlink *, const struct devlink_trap *, enum devlink_trap_action, struct netlink_ext_ack *); + int (*trap_group_init)(struct devlink *, const struct devlink_trap_group *); + int (*trap_group_set)(struct devlink *, const struct devlink_trap_group *, const struct devlink_trap_policer *, struct netlink_ext_ack *); + int (*trap_group_action_set)(struct devlink *, const struct devlink_trap_group *, enum devlink_trap_action, struct netlink_ext_ack *); + int (*trap_policer_init)(struct devlink *, const struct devlink_trap_policer *); + void (*trap_policer_fini)(struct devlink *, const struct devlink_trap_policer *); + int (*trap_policer_set)(struct devlink *, const struct devlink_trap_policer *, u64, u64, struct netlink_ext_ack *); + int (*trap_policer_counter_get)(struct devlink *, const struct devlink_trap_policer *, u64 *); + int (*port_function_hw_addr_get)(struct devlink *, struct devlink_port *, u8 *, int *, struct netlink_ext_ack *); + int (*port_function_hw_addr_set)(struct devlink *, struct devlink_port *, const u8 *, int, struct netlink_ext_ack *); +}; + +struct devlink_sb_pool_info { + enum devlink_sb_pool_type pool_type; + u32 size; + enum devlink_sb_threshold_type threshold_type; + u32 cell_size; +}; + +struct devlink_dpipe_field { + const char *name; + unsigned int id; + unsigned int bitwidth; + enum devlink_dpipe_field_mapping_type mapping_type; +}; + +struct devlink_dpipe_header { + const char *name; + unsigned int id; + struct devlink_dpipe_field *fields; + unsigned int fields_count; + bool global; +}; + +union devlink_param_value { + u8 vu8; + u16 vu16; + u32 vu32; + char vstr[32]; + bool vbool; +}; + +struct devlink_param_gset_ctx { + union devlink_param_value val; + enum devlink_param_cmode cmode; +}; + +struct devlink_flash_update_params { + const struct firmware *fw; + const char *component; + u32 overwrite_mask; +}; + +struct devlink_trap_policer { + u32 id; + u64 init_rate; + u64 init_burst; + u64 max_rate; + u64 min_rate; + u64 max_burst; + u64 min_burst; +}; + +struct devlink_trap_group { + const char *name; + u16 id; + bool generic; + u32 init_policer_id; +}; + +struct devlink_trap { + enum devlink_trap_type type; + enum devlink_trap_action init_action; + bool generic; + u16 id; + const char *name; + u16 init_group_id; + u32 metadata_cap; +}; + +struct switchdev_trans { + bool ph_prepare; +}; + +enum switchdev_obj_id { + SWITCHDEV_OBJ_ID_UNDEFINED = 0, + SWITCHDEV_OBJ_ID_PORT_VLAN = 1, + SWITCHDEV_OBJ_ID_PORT_MDB = 2, + SWITCHDEV_OBJ_ID_HOST_MDB = 3, + SWITCHDEV_OBJ_ID_MRP = 4, + SWITCHDEV_OBJ_ID_RING_TEST_MRP = 5, + SWITCHDEV_OBJ_ID_RING_ROLE_MRP = 6, + SWITCHDEV_OBJ_ID_RING_STATE_MRP = 7, + SWITCHDEV_OBJ_ID_IN_TEST_MRP = 8, + SWITCHDEV_OBJ_ID_IN_ROLE_MRP = 9, + SWITCHDEV_OBJ_ID_IN_STATE_MRP = 10, +}; + +struct switchdev_obj { + struct net_device *orig_dev; + enum switchdev_obj_id id; + u32 flags; + void *complete_priv; + void (*complete)(struct net_device *, int, void *); +}; + +struct switchdev_obj_port_vlan { + struct switchdev_obj obj; + u16 flags; + u16 vid_begin; + u16 vid_end; +}; + +struct switchdev_obj_port_mdb { + struct switchdev_obj obj; + unsigned char addr[6]; + u16 vid; +}; + +enum dsa_tag_protocol { + DSA_TAG_PROTO_NONE = 0, + DSA_TAG_PROTO_BRCM = 1, + DSA_TAG_PROTO_BRCM_PREPEND = 2, + DSA_TAG_PROTO_DSA = 3, + DSA_TAG_PROTO_EDSA = 4, + DSA_TAG_PROTO_GSWIP = 5, + DSA_TAG_PROTO_KSZ9477 = 6, + DSA_TAG_PROTO_KSZ9893 = 7, + DSA_TAG_PROTO_LAN9303 = 8, + DSA_TAG_PROTO_MTK = 9, + DSA_TAG_PROTO_QCA = 10, + DSA_TAG_PROTO_TRAILER = 11, + DSA_TAG_PROTO_8021Q = 12, + DSA_TAG_PROTO_SJA1105 = 13, + DSA_TAG_PROTO_KSZ8795 = 14, + DSA_TAG_PROTO_OCELOT = 15, + DSA_TAG_PROTO_AR9331 = 16, + DSA_TAG_PROTO_RTL4_A = 17, + DSA_TAG_PROTO_HELLCREEK = 18, +}; + +struct dsa_device_ops { + struct sk_buff * (*xmit)(struct sk_buff *, struct net_device *); + struct sk_buff * (*rcv)(struct sk_buff *, struct net_device *, struct packet_type *); + void (*flow_dissect)(const struct sk_buff *, __be16 *, int *); + bool (*filter)(const struct sk_buff *, struct net_device *); + unsigned int overhead; + const char *name; + enum dsa_tag_protocol proto; + bool promisc_on_master; + bool tail_tag; +}; + +struct dsa_netdevice_ops { + int (*ndo_do_ioctl)(struct net_device *, struct ifreq *, int); +}; + +struct dsa_switch_tree { + struct list_head list; + struct raw_notifier_head nh; + unsigned int index; + struct kref refcount; + bool setup; + struct dsa_platform_data *pd; + struct list_head ports; + struct list_head rtable; +}; + +struct dsa_mall_mirror_tc_entry { + u8 to_local_port; + bool ingress; +}; + +struct dsa_mall_policer_tc_entry { + u32 burst; + u64 rate_bytes_per_sec; +}; + +struct dsa_switch_ops; + +struct dsa_switch { + bool setup; + struct device *dev; + struct dsa_switch_tree *dst; + unsigned int index; + struct notifier_block nb; + void *priv; + struct dsa_chip_data *cd; + const struct dsa_switch_ops *ops; + u32 phys_mii_mask; + struct mii_bus *slave_mii_bus; + unsigned int ageing_time_min; + unsigned int ageing_time_max; + struct devlink *devlink; + unsigned int num_tx_queues; + bool vlan_filtering_is_global; + bool configure_vlan_while_not_filtering; + bool untag_bridge_pvid; + bool vlan_filtering; + bool pcs_poll; + bool mtu_enforcement_ingress; + size_t num_ports; +}; + +struct fixed_phy_status___2; + +typedef int dsa_fdb_dump_cb_t(const unsigned char *, u16, bool, void *); + +struct dsa_switch_ops { + enum dsa_tag_protocol (*get_tag_protocol)(struct dsa_switch *, int, enum dsa_tag_protocol); + int (*setup)(struct dsa_switch *); + void (*teardown)(struct dsa_switch *); + u32 (*get_phy_flags)(struct dsa_switch *, int); + int (*phy_read)(struct dsa_switch *, int, int); + int (*phy_write)(struct dsa_switch *, int, int, u16); + void (*adjust_link)(struct dsa_switch *, int, struct phy_device *); + void (*fixed_link_update)(struct dsa_switch *, int, struct fixed_phy_status___2 *); + void (*phylink_validate)(struct dsa_switch *, int, long unsigned int *, struct phylink_link_state *); + int (*phylink_mac_link_state)(struct dsa_switch *, int, struct phylink_link_state *); + void (*phylink_mac_config)(struct dsa_switch *, int, unsigned int, const struct phylink_link_state *); + void (*phylink_mac_an_restart)(struct dsa_switch *, int); + void (*phylink_mac_link_down)(struct dsa_switch *, int, unsigned int, phy_interface_t); + void (*phylink_mac_link_up)(struct dsa_switch *, int, unsigned int, phy_interface_t, struct phy_device *, int, int, bool, bool); + void (*phylink_fixed_state)(struct dsa_switch *, int, struct phylink_link_state *); + void (*get_strings)(struct dsa_switch *, int, u32, uint8_t *); + void (*get_ethtool_stats)(struct dsa_switch *, int, uint64_t *); + int (*get_sset_count)(struct dsa_switch *, int, int); + void (*get_ethtool_phy_stats)(struct dsa_switch *, int, uint64_t *); + void (*get_wol)(struct dsa_switch *, int, struct ethtool_wolinfo *); + int (*set_wol)(struct dsa_switch *, int, struct ethtool_wolinfo *); + int (*get_ts_info)(struct dsa_switch *, int, struct ethtool_ts_info *); + int (*suspend)(struct dsa_switch *); + int (*resume)(struct dsa_switch *); + int (*port_enable)(struct dsa_switch *, int, struct phy_device *); + void (*port_disable)(struct dsa_switch *, int); + int (*set_mac_eee)(struct dsa_switch *, int, struct ethtool_eee *); + int (*get_mac_eee)(struct dsa_switch *, int, struct ethtool_eee *); + int (*get_eeprom_len)(struct dsa_switch *); + int (*get_eeprom)(struct dsa_switch *, struct ethtool_eeprom *, u8 *); + int (*set_eeprom)(struct dsa_switch *, struct ethtool_eeprom *, u8 *); + int (*get_regs_len)(struct dsa_switch *, int); + void (*get_regs)(struct dsa_switch *, int, struct ethtool_regs *, void *); + int (*port_prechangeupper)(struct dsa_switch *, int, struct netdev_notifier_changeupper_info *); + int (*set_ageing_time)(struct dsa_switch *, unsigned int); + int (*port_bridge_join)(struct dsa_switch *, int, struct net_device *); + void (*port_bridge_leave)(struct dsa_switch *, int, struct net_device *); + void (*port_stp_state_set)(struct dsa_switch *, int, u8); + void (*port_fast_age)(struct dsa_switch *, int); + int (*port_egress_floods)(struct dsa_switch *, int, bool, bool); + int (*port_vlan_filtering)(struct dsa_switch *, int, bool, struct switchdev_trans *); + int (*port_vlan_prepare)(struct dsa_switch *, int, const struct switchdev_obj_port_vlan *); + void (*port_vlan_add)(struct dsa_switch *, int, const struct switchdev_obj_port_vlan *); + int (*port_vlan_del)(struct dsa_switch *, int, const struct switchdev_obj_port_vlan *); + int (*port_fdb_add)(struct dsa_switch *, int, const unsigned char *, u16); + int (*port_fdb_del)(struct dsa_switch *, int, const unsigned char *, u16); + int (*port_fdb_dump)(struct dsa_switch *, int, dsa_fdb_dump_cb_t *, void *); + int (*port_mdb_prepare)(struct dsa_switch *, int, const struct switchdev_obj_port_mdb *); + void (*port_mdb_add)(struct dsa_switch *, int, const struct switchdev_obj_port_mdb *); + int (*port_mdb_del)(struct dsa_switch *, int, const struct switchdev_obj_port_mdb *); + int (*get_rxnfc)(struct dsa_switch *, int, struct ethtool_rxnfc *, u32 *); + int (*set_rxnfc)(struct dsa_switch *, int, struct ethtool_rxnfc *); + int (*cls_flower_add)(struct dsa_switch *, int, struct flow_cls_offload *, bool); + int (*cls_flower_del)(struct dsa_switch *, int, struct flow_cls_offload *, bool); + int (*cls_flower_stats)(struct dsa_switch *, int, struct flow_cls_offload *, bool); + int (*port_mirror_add)(struct dsa_switch *, int, struct dsa_mall_mirror_tc_entry *, bool); + void (*port_mirror_del)(struct dsa_switch *, int, struct dsa_mall_mirror_tc_entry *); + int (*port_policer_add)(struct dsa_switch *, int, struct dsa_mall_policer_tc_entry *); + void (*port_policer_del)(struct dsa_switch *, int); + int (*port_setup_tc)(struct dsa_switch *, int, enum tc_setup_type, void *); + int (*crosschip_bridge_join)(struct dsa_switch *, int, int, int, struct net_device *); + void (*crosschip_bridge_leave)(struct dsa_switch *, int, int, int, struct net_device *); + int (*port_hwtstamp_get)(struct dsa_switch *, int, struct ifreq *); + int (*port_hwtstamp_set)(struct dsa_switch *, int, struct ifreq *); + bool (*port_txtstamp)(struct dsa_switch *, int, struct sk_buff *, unsigned int); + bool (*port_rxtstamp)(struct dsa_switch *, int, struct sk_buff *, unsigned int); + int (*devlink_param_get)(struct dsa_switch *, u32, struct devlink_param_gset_ctx *); + int (*devlink_param_set)(struct dsa_switch *, u32, struct devlink_param_gset_ctx *); + int (*devlink_info_get)(struct dsa_switch *, struct devlink_info_req *, struct netlink_ext_ack *); + int (*port_change_mtu)(struct dsa_switch *, int, int); + int (*port_max_mtu)(struct dsa_switch *, int); +}; + +struct dsa_loop_pdata { + struct dsa_chip_data cd; + const char *name; + unsigned int enabled_ports; + const char *netdev; +}; + +struct wl1251_platform_data { + int power_gpio; + int irq; + bool use_eeprom; +}; + +struct ohci { + void *registers; +}; + +struct cdrom_msf { + __u8 cdmsf_min0; + __u8 cdmsf_sec0; + __u8 cdmsf_frame0; + __u8 cdmsf_min1; + __u8 cdmsf_sec1; + __u8 cdmsf_frame1; +}; + +struct cdrom_volctrl { + __u8 channel0; + __u8 channel1; + __u8 channel2; + __u8 channel3; +}; + +struct cdrom_subchnl { + __u8 cdsc_format; + __u8 cdsc_audiostatus; + __u8 cdsc_adr: 4; + __u8 cdsc_ctrl: 4; + __u8 cdsc_trk; + __u8 cdsc_ind; + union cdrom_addr cdsc_absaddr; + union cdrom_addr cdsc_reladdr; +}; + +struct cdrom_read_audio { + union cdrom_addr addr; + __u8 addr_format; + int nframes; + __u8 *buf; +}; + +struct cdrom_blk { + unsigned int from; + short unsigned int len; +}; + +struct dvd_layer { + __u8 book_version: 4; + __u8 book_type: 4; + __u8 min_rate: 4; + __u8 disc_size: 4; + __u8 layer_type: 4; + __u8 track_path: 1; + __u8 nlayers: 2; + char: 1; + __u8 track_density: 4; + __u8 linear_density: 4; + __u8 bca: 1; + __u32 start_sector; + __u32 end_sector; + __u32 end_sector_l0; +}; + +struct dvd_physical { + __u8 type; + __u8 layer_num; + struct dvd_layer layer[4]; +}; + +struct dvd_copyright { + __u8 type; + __u8 layer_num; + __u8 cpst; + __u8 rmi; +}; + +struct dvd_disckey { + __u8 type; + unsigned int agid: 2; + __u8 value[2048]; +}; + +struct dvd_bca { + __u8 type; + int len; + __u8 value[188]; +}; + +struct dvd_manufact { + __u8 type; + __u8 layer_num; + int len; + __u8 value[2048]; +}; + +typedef union { + __u8 type; + struct dvd_physical physical; + struct dvd_copyright copyright; + struct dvd_disckey disckey; + struct dvd_bca bca; + struct dvd_manufact manufact; +} dvd_struct; + +typedef __u8 dvd_key[5]; + +typedef __u8 dvd_challenge[10]; + +struct dvd_lu_send_agid { + __u8 type; + unsigned int agid: 2; +}; + +struct dvd_host_send_challenge { + __u8 type; + unsigned int agid: 2; + dvd_challenge chal; +}; + +struct dvd_send_key { + __u8 type; + unsigned int agid: 2; + dvd_key key; +}; + +struct dvd_lu_send_challenge { + __u8 type; + unsigned int agid: 2; + dvd_challenge chal; +}; + +struct dvd_lu_send_title_key { + __u8 type; + unsigned int agid: 2; + dvd_key title_key; + int lba; + unsigned int cpm: 1; + unsigned int cp_sec: 1; + unsigned int cgms: 2; +}; + +struct dvd_lu_send_asf { + __u8 type; + unsigned int agid: 2; + unsigned int asf: 1; +}; + +struct dvd_host_send_rpcstate { + __u8 type; + __u8 pdrc; +}; + +struct dvd_lu_send_rpcstate { + __u8 type: 2; + __u8 vra: 3; + __u8 ucca: 3; + __u8 region_mask; + __u8 rpc_scheme; +}; + +typedef union { + __u8 type; + struct dvd_lu_send_agid lsa; + struct dvd_host_send_challenge hsc; + struct dvd_send_key lsk; + struct dvd_lu_send_challenge lsc; + struct dvd_send_key hsk; + struct dvd_lu_send_title_key lstk; + struct dvd_lu_send_asf lsasf; + struct dvd_host_send_rpcstate hrpcs; + struct dvd_lu_send_rpcstate lrpcs; +} dvd_authinfo; + +struct mrw_feature_desc { + __be16 feature_code; + __u8 curr: 1; + __u8 persistent: 1; + __u8 feature_version: 4; + __u8 reserved1: 2; + __u8 add_len; + __u8 write: 1; + __u8 reserved2: 7; + __u8 reserved3; + __u8 reserved4; + __u8 reserved5; +}; + +struct rwrt_feature_desc { + __be16 feature_code; + __u8 curr: 1; + __u8 persistent: 1; + __u8 feature_version: 4; + __u8 reserved1: 2; + __u8 add_len; + __u32 last_lba; + __u32 block_size; + __u16 blocking; + __u8 page_present: 1; + __u8 reserved2: 7; + __u8 reserved3; +}; + +typedef struct { + __be16 disc_information_length; + __u8 disc_status: 2; + __u8 border_status: 2; + __u8 erasable: 1; + __u8 reserved1: 3; + __u8 n_first_track; + __u8 n_sessions_lsb; + __u8 first_track_lsb; + __u8 last_track_lsb; + __u8 mrw_status: 2; + __u8 dbit: 1; + __u8 reserved2: 2; + __u8 uru: 1; + __u8 dbc_v: 1; + __u8 did_v: 1; + __u8 disc_type; + __u8 n_sessions_msb; + __u8 first_track_msb; + __u8 last_track_msb; + __u32 disc_id; + __u32 lead_in; + __u32 lead_out; + __u8 disc_bar_code[8]; + __u8 reserved3; + __u8 n_opc; +} disc_information; + +typedef struct { + __be16 track_information_length; + __u8 track_lsb; + __u8 session_lsb; + __u8 reserved1; + __u8 track_mode: 4; + __u8 copy: 1; + __u8 damage: 1; + __u8 reserved2: 2; + __u8 data_mode: 4; + __u8 fp: 1; + __u8 packet: 1; + __u8 blank: 1; + __u8 rt: 1; + __u8 nwa_v: 1; + __u8 lra_v: 1; + __u8 reserved3: 6; + __be32 track_start; + __be32 next_writable; + __be32 free_blocks; + __be32 fixed_packet_size; + __be32 track_size; + __be32 last_rec_address; +} track_information; + +struct mode_page_header { + __be16 mode_data_length; + __u8 medium_type; + __u8 reserved1; + __u8 reserved2; + __u8 reserved3; + __be16 desc_length; +}; + +typedef struct { + int data; + int audio; + int cdi; + int xa; + long int error; +} tracktype; + +struct cdrom_mechstat_header { + __u8 curslot: 5; + __u8 changer_state: 2; + __u8 fault: 1; + __u8 reserved1: 4; + __u8 door_open: 1; + __u8 mech_state: 3; + __u8 curlba[3]; + __u8 nslots; + __u16 slot_tablelen; +}; + +struct cdrom_slot { + __u8 change: 1; + __u8 reserved1: 6; + __u8 disc_present: 1; + __u8 reserved2[3]; +}; + +struct cdrom_changer_info { + struct cdrom_mechstat_header hdr; + struct cdrom_slot slots[256]; +}; + +struct modesel_head { + __u8 reserved1; + __u8 medium; + __u8 reserved2; + __u8 block_desc_length; + __u8 density; + __u8 number_of_blocks_hi; + __u8 number_of_blocks_med; + __u8 number_of_blocks_lo; + __u8 reserved3; + __u8 block_length_hi; + __u8 block_length_med; + __u8 block_length_lo; +}; + +typedef struct { + __u16 report_key_length; + __u8 reserved1; + __u8 reserved2; + __u8 ucca: 3; + __u8 vra: 3; + __u8 type_code: 2; + __u8 region_mask; + __u8 rpc_scheme; + __u8 reserved3; +} rpc_state_t; + +struct cdrom_sysctl_settings { + char info[1000]; + int autoclose; + int autoeject; + int debug; + int lock; + int check; +}; + +enum cdrom_print_option { + CTL_NAME = 0, + CTL_SPEED = 1, + CTL_SLOTS = 2, + CTL_CAPABILITY = 3, +}; + +struct compat_cdrom_read_audio { + union cdrom_addr addr; + u8 addr_format; + compat_int_t nframes; + compat_caddr_t buf; +}; + +struct socket_state_t { + u_int flags; + u_int csc_mask; + u_char Vcc; + u_char Vpp; + u_char io_irq; +}; + +typedef struct socket_state_t socket_state_t; + +struct pccard_io_map { + u_char map; + u_char flags; + u_short speed; + phys_addr_t start; + phys_addr_t stop; +}; + +struct pccard_mem_map { + u_char map; + u_char flags; + u_short speed; + phys_addr_t static_start; + u_int card_start; + struct resource *res; +}; + +typedef struct pccard_mem_map pccard_mem_map; + +struct io_window_t { + u_int InUse; + u_int Config; + struct resource *res; +}; + +typedef struct io_window_t io_window_t; + +struct pcmcia_socket; + +struct pccard_operations { + int (*init)(struct pcmcia_socket *); + int (*suspend)(struct pcmcia_socket *); + int (*get_status)(struct pcmcia_socket *, u_int *); + int (*set_socket)(struct pcmcia_socket *, socket_state_t *); + int (*set_io_map)(struct pcmcia_socket *, struct pccard_io_map *); + int (*set_mem_map)(struct pcmcia_socket *, struct pccard_mem_map *); +}; + +struct pccard_resource_ops; + +struct pcmcia_callback; + +struct pcmcia_socket { + struct module *owner; + socket_state_t socket; + u_int state; + u_int suspended_state; + u_short functions; + u_short lock_count; + pccard_mem_map cis_mem; + void *cis_virt; + io_window_t io[2]; + pccard_mem_map win[4]; + struct list_head cis_cache; + size_t fake_cis_len; + u8 *fake_cis; + struct list_head socket_list; + struct completion socket_released; + unsigned int sock; + u_int features; + u_int irq_mask; + u_int map_size; + u_int io_offset; + u_int pci_irq; + struct pci_dev *cb_dev; + u8 resource_setup_done; + struct pccard_operations *ops; + struct pccard_resource_ops *resource_ops; + void *resource_data; + void (*zoom_video)(struct pcmcia_socket *, int); + int (*power_hook)(struct pcmcia_socket *, int); + void (*tune_bridge)(struct pcmcia_socket *, struct pci_bus *); + struct task_struct *thread; + struct completion thread_done; + unsigned int thread_events; + unsigned int sysfs_events; + struct mutex skt_mutex; + struct mutex ops_mutex; + spinlock_t thread_lock; + struct pcmcia_callback *callback; + struct list_head devices_list; + u8 device_count; + u8 pcmcia_pfc; + atomic_t present; + unsigned int pcmcia_irq; + struct device dev; + void *driver_data; + int resume_status; +}; + +struct pccard_resource_ops { + int (*validate_mem)(struct pcmcia_socket *); + int (*find_io)(struct pcmcia_socket *, unsigned int, unsigned int *, unsigned int, unsigned int, struct resource **); + struct resource * (*find_mem)(long unsigned int, long unsigned int, long unsigned int, int, struct pcmcia_socket *); + int (*init)(struct pcmcia_socket *); + void (*exit)(struct pcmcia_socket *); +}; + +struct pcmcia_callback { + struct module *owner; + int (*add)(struct pcmcia_socket *); + int (*remove)(struct pcmcia_socket *); + void (*requery)(struct pcmcia_socket *); + int (*validate)(struct pcmcia_socket *, unsigned int *); + int (*suspend)(struct pcmcia_socket *); + int (*early_resume)(struct pcmcia_socket *); + int (*resume)(struct pcmcia_socket *); +}; + +enum { + PCMCIA_IOPORT_0 = 0, + PCMCIA_IOPORT_1 = 1, + PCMCIA_IOMEM_0 = 2, + PCMCIA_IOMEM_1 = 3, + PCMCIA_IOMEM_2 = 4, + PCMCIA_IOMEM_3 = 5, + PCMCIA_NUM_RESOURCES = 6, +}; + +typedef unsigned char cisdata_t; + +struct cistpl_longlink_mfc_t { + u_char nfn; + struct { + u_char space; + u_int addr; + } fn[8]; +}; + +typedef struct cistpl_longlink_mfc_t cistpl_longlink_mfc_t; + +struct cistpl_vers_1_t { + u_char major; + u_char minor; + u_char ns; + u_char ofs[4]; + char str[254]; +}; + +typedef struct cistpl_vers_1_t cistpl_vers_1_t; + +struct cistpl_manfid_t { + u_short manf; + u_short card; +}; + +typedef struct cistpl_manfid_t cistpl_manfid_t; + +struct cistpl_funcid_t { + u_char func; + u_char sysinit; +}; + +typedef struct cistpl_funcid_t cistpl_funcid_t; + +struct cistpl_config_t { + u_char last_idx; + u_int base; + u_int rmask[4]; + u_char subtuples; +}; + +typedef struct cistpl_config_t cistpl_config_t; + +struct cistpl_device_geo_t { + u_char ngeo; + struct { + u_char buswidth; + u_int erase_block; + u_int read_block; + u_int write_block; + u_int partition; + u_int interleave; + } geo[4]; +}; + +typedef struct cistpl_device_geo_t cistpl_device_geo_t; + +struct pcmcia_device_id { + __u16 match_flags; + __u16 manf_id; + __u16 card_id; + __u8 func_id; + __u8 function; + __u8 device_no; + __u32 prod_id_hash[4]; + const char *prod_id[4]; + kernel_ulong_t driver_info; + char *cisfile; +}; + +struct pcmcia_dynids { + struct mutex lock; + struct list_head list; +}; + +struct pcmcia_device; + +struct pcmcia_driver { + const char *name; + int (*probe)(struct pcmcia_device *); + void (*remove)(struct pcmcia_device *); + int (*suspend)(struct pcmcia_device *); + int (*resume)(struct pcmcia_device *); + struct module *owner; + const struct pcmcia_device_id *id_table; + struct device_driver drv; + struct pcmcia_dynids dynids; +}; + +struct config_t; + +struct pcmcia_device { + struct pcmcia_socket *socket; + char *devname; + u8 device_no; + u8 func; + struct config_t *function_config; + struct list_head socket_device_list; + unsigned int irq; + struct resource *resource[6]; + resource_size_t card_addr; + unsigned int vpp; + unsigned int config_flags; + unsigned int config_base; + unsigned int config_index; + unsigned int config_regs; + unsigned int io_lines; + u16 suspended: 1; + u16 _irq: 1; + u16 _io: 1; + u16 _win: 4; + u16 _locked: 1; + u16 allow_func_id_match: 1; + u16 has_manf_id: 1; + u16 has_card_id: 1; + u16 has_func_id: 1; + u16 reserved: 4; + u8 func_id; + u16 manf_id; + u16 card_id; + char *prod_id[4]; + u64 dma_mask; + struct device dev; + void *priv; + unsigned int open; +}; + +struct config_t { + struct kref ref; + unsigned int state; + struct resource io[2]; + struct resource mem[4]; +}; + +typedef struct config_t config_t; + +struct pcmcia_dynid { + struct list_head node; + struct pcmcia_device_id id; +}; + +typedef long unsigned int u_long; + +typedef struct pccard_io_map pccard_io_map; + +struct cistpl_longlink_t { + u_int addr; +}; + +typedef struct cistpl_longlink_t cistpl_longlink_t; + +struct cistpl_checksum_t { + u_short addr; + u_short len; + u_char sum; +}; + +typedef struct cistpl_checksum_t cistpl_checksum_t; + +struct cistpl_altstr_t { + u_char ns; + u_char ofs[4]; + char str[254]; +}; + +typedef struct cistpl_altstr_t cistpl_altstr_t; + +struct cistpl_device_t { + u_char ndev; + struct { + u_char type; + u_char wp; + u_int speed; + u_int size; + } dev[4]; +}; + +typedef struct cistpl_device_t cistpl_device_t; + +struct cistpl_jedec_t { + u_char nid; + struct { + u_char mfr; + u_char info; + } id[4]; +}; + +typedef struct cistpl_jedec_t cistpl_jedec_t; + +struct cistpl_funce_t { + u_char type; + u_char data[0]; +}; + +typedef struct cistpl_funce_t cistpl_funce_t; + +struct cistpl_bar_t { + u_char attr; + u_int size; +}; + +typedef struct cistpl_bar_t cistpl_bar_t; + +struct cistpl_power_t { + u_char present; + u_char flags; + u_int param[7]; +}; + +typedef struct cistpl_power_t cistpl_power_t; + +struct cistpl_timing_t { + u_int wait; + u_int waitscale; + u_int ready; + u_int rdyscale; + u_int reserved; + u_int rsvscale; +}; + +typedef struct cistpl_timing_t cistpl_timing_t; + +struct cistpl_io_t { + u_char flags; + u_char nwin; + struct { + u_int base; + u_int len; + } win[16]; +}; + +typedef struct cistpl_io_t cistpl_io_t; + +struct cistpl_irq_t { + u_int IRQInfo1; + u_int IRQInfo2; +}; + +typedef struct cistpl_irq_t cistpl_irq_t; + +struct cistpl_mem_t { + u_char flags; + u_char nwin; + struct { + u_int len; + u_int card_addr; + u_int host_addr; + } win[8]; +}; + +typedef struct cistpl_mem_t cistpl_mem_t; + +struct cistpl_cftable_entry_t { + u_char index; + u_short flags; + u_char interface; + cistpl_power_t vcc; + cistpl_power_t vpp1; + cistpl_power_t vpp2; + cistpl_timing_t timing; + cistpl_io_t io; + cistpl_irq_t irq; + cistpl_mem_t mem; + u_char subtuples; +}; + +typedef struct cistpl_cftable_entry_t cistpl_cftable_entry_t; + +struct cistpl_cftable_entry_cb_t { + u_char index; + u_int flags; + cistpl_power_t vcc; + cistpl_power_t vpp1; + cistpl_power_t vpp2; + u_char io; + cistpl_irq_t irq; + u_char mem; + u_char subtuples; +}; + +typedef struct cistpl_cftable_entry_cb_t cistpl_cftable_entry_cb_t; + +struct cistpl_vers_2_t { + u_char vers; + u_char comply; + u_short dindex; + u_char vspec8; + u_char vspec9; + u_char nhdr; + u_char vendor; + u_char info; + char str[244]; +}; + +typedef struct cistpl_vers_2_t cistpl_vers_2_t; + +struct cistpl_org_t { + u_char data_org; + char desc[30]; +}; + +typedef struct cistpl_org_t cistpl_org_t; + +struct cistpl_format_t { + u_char type; + u_char edc; + u_int offset; + u_int length; +}; + +typedef struct cistpl_format_t cistpl_format_t; + +union cisparse_t { + cistpl_device_t device; + cistpl_checksum_t checksum; + cistpl_longlink_t longlink; + cistpl_longlink_mfc_t longlink_mfc; + cistpl_vers_1_t version_1; + cistpl_altstr_t altstr; + cistpl_jedec_t jedec; + cistpl_manfid_t manfid; + cistpl_funcid_t funcid; + cistpl_funce_t funce; + cistpl_bar_t bar; + cistpl_config_t config; + cistpl_cftable_entry_t cftable_entry; + cistpl_cftable_entry_cb_t cftable_entry_cb; + cistpl_device_geo_t device_geo; + cistpl_vers_2_t vers_2; + cistpl_org_t org; + cistpl_format_t format; +}; + +typedef union cisparse_t cisparse_t; + +struct tuple_t { + u_int Attributes; + cisdata_t DesiredTuple; + u_int Flags; + u_int LinkOffset; + u_int CISOffset; + cisdata_t TupleCode; + cisdata_t TupleLink; + cisdata_t TupleOffset; + cisdata_t TupleDataMax; + cisdata_t TupleDataLen; + cisdata_t *TupleData; +}; + +typedef struct tuple_t tuple_t; + +struct cis_cache_entry { + struct list_head node; + unsigned int addr; + unsigned int len; + unsigned int attr; + unsigned char cache[0]; +}; + +struct tuple_flags { + u_int link_space: 4; + u_int has_link: 1; + u_int mfc_fn: 3; + u_int space: 4; +}; + +struct pcmcia_cfg_mem { + struct pcmcia_device *p_dev; + int (*conf_check)(struct pcmcia_device *, void *); + void *priv_data; + cisparse_t parse; + cistpl_cftable_entry_t dflt; +}; + +struct pcmcia_loop_mem { + struct pcmcia_device *p_dev; + void *priv_data; + int (*loop_tuple)(struct pcmcia_device *, tuple_t *, void *); +}; + +struct pcmcia_loop_get { + size_t len; + cisdata_t **buf; +}; + +struct resource_map { + u_long base; + u_long num; + struct resource_map *next; +}; + +struct socket_data { + struct resource_map mem_db; + struct resource_map mem_db_valid; + struct resource_map io_db; +}; + +struct pcmcia_align_data { + long unsigned int mask; + long unsigned int offset; + struct resource_map *map; +}; + +enum usb_otg_state { + OTG_STATE_UNDEFINED = 0, + OTG_STATE_B_IDLE = 1, + OTG_STATE_B_SRP_INIT = 2, + OTG_STATE_B_PERIPHERAL = 3, + OTG_STATE_B_WAIT_ACON = 4, + OTG_STATE_B_HOST = 5, + OTG_STATE_A_IDLE = 6, + OTG_STATE_A_WAIT_VRISE = 7, + OTG_STATE_A_WAIT_BCON = 8, + OTG_STATE_A_HOST = 9, + OTG_STATE_A_SUSPEND = 10, + OTG_STATE_A_PERIPHERAL = 11, + OTG_STATE_A_WAIT_VFALL = 12, + OTG_STATE_A_VBUS_ERR = 13, +}; + +enum usb_dr_mode { + USB_DR_MODE_UNKNOWN = 0, + USB_DR_MODE_HOST = 1, + USB_DR_MODE_PERIPHERAL = 2, + USB_DR_MODE_OTG = 3, +}; + +enum usb_led_event { + USB_LED_EVENT_HOST = 0, + USB_LED_EVENT_GADGET = 1, +}; + +struct usb_device_id { + __u16 match_flags; + __u16 idVendor; + __u16 idProduct; + __u16 bcdDevice_lo; + __u16 bcdDevice_hi; + __u8 bDeviceClass; + __u8 bDeviceSubClass; + __u8 bDeviceProtocol; + __u8 bInterfaceClass; + __u8 bInterfaceSubClass; + __u8 bInterfaceProtocol; + __u8 bInterfaceNumber; + kernel_ulong_t driver_info; +}; + +struct usb_descriptor_header { + __u8 bLength; + __u8 bDescriptorType; +}; + +enum usb_port_connect_type { + USB_PORT_CONNECT_TYPE_UNKNOWN = 0, + USB_PORT_CONNECT_TYPE_HOT_PLUG = 1, + USB_PORT_CONNECT_TYPE_HARD_WIRED = 2, + USB_PORT_NOT_USED = 3, +}; + +struct usb_dynids { + spinlock_t lock; + struct list_head list; +}; + +struct usbdrv_wrap { + struct device_driver driver; + int for_devices; +}; + +struct usb_driver { + const char *name; + int (*probe)(struct usb_interface *, const struct usb_device_id *); + void (*disconnect)(struct usb_interface *); + int (*unlocked_ioctl)(struct usb_interface *, unsigned int, void *); + int (*suspend)(struct usb_interface *, pm_message_t); + int (*resume)(struct usb_interface *); + int (*reset_resume)(struct usb_interface *); + int (*pre_reset)(struct usb_interface *); + int (*post_reset)(struct usb_interface *); + const struct usb_device_id *id_table; + const struct attribute_group **dev_groups; + struct usb_dynids dynids; + struct usbdrv_wrap drvwrap; + unsigned int no_dynamic_id: 1; + unsigned int supports_autosuspend: 1; + unsigned int disable_hub_initiated_lpm: 1; + unsigned int soft_unbind: 1; +}; + +struct usb_device_driver { + const char *name; + bool (*match)(struct usb_device *); + int (*probe)(struct usb_device *); + void (*disconnect)(struct usb_device *); + int (*suspend)(struct usb_device *, pm_message_t); + int (*resume)(struct usb_device *, pm_message_t); + const struct attribute_group **dev_groups; + struct usbdrv_wrap drvwrap; + const struct usb_device_id *id_table; + unsigned int supports_autosuspend: 1; + unsigned int generic_subclass: 1; +}; + +enum usb_phy_type { + USB_PHY_TYPE_UNDEFINED = 0, + USB_PHY_TYPE_USB2 = 1, + USB_PHY_TYPE_USB3 = 2, +}; + +enum usb_phy_events { + USB_EVENT_NONE = 0, + USB_EVENT_VBUS = 1, + USB_EVENT_ID = 2, + USB_EVENT_CHARGER = 3, + USB_EVENT_ENUMERATED = 4, +}; + +struct extcon_dev; + +enum usb_charger_type { + UNKNOWN_TYPE = 0, + SDP_TYPE = 1, + DCP_TYPE = 2, + CDP_TYPE = 3, + ACA_TYPE = 4, +}; + +enum usb_charger_state { + USB_CHARGER_DEFAULT = 0, + USB_CHARGER_PRESENT = 1, + USB_CHARGER_ABSENT = 2, +}; + +struct usb_charger_current { + unsigned int sdp_min; + unsigned int sdp_max; + unsigned int dcp_min; + unsigned int dcp_max; + unsigned int cdp_min; + unsigned int cdp_max; + unsigned int aca_min; + unsigned int aca_max; +}; + +struct usb_otg; + +struct usb_phy_io_ops; + +struct usb_phy { + struct device *dev; + const char *label; + unsigned int flags; + enum usb_phy_type type; + enum usb_phy_events last_event; + struct usb_otg *otg; + struct device *io_dev; + struct usb_phy_io_ops *io_ops; + void *io_priv; + struct extcon_dev *edev; + struct extcon_dev *id_edev; + struct notifier_block vbus_nb; + struct notifier_block id_nb; + struct notifier_block type_nb; + enum usb_charger_type chg_type; + enum usb_charger_state chg_state; + struct usb_charger_current chg_cur; + struct work_struct chg_work; + struct atomic_notifier_head notifier; + u16 port_status; + u16 port_change; + struct list_head head; + int (*init)(struct usb_phy *); + void (*shutdown)(struct usb_phy *); + int (*set_vbus)(struct usb_phy *, int); + int (*set_power)(struct usb_phy *, unsigned int); + int (*set_suspend)(struct usb_phy *, int); + int (*set_wakeup)(struct usb_phy *, bool); + int (*notify_connect)(struct usb_phy *, enum usb_device_speed); + int (*notify_disconnect)(struct usb_phy *, enum usb_device_speed); + enum usb_charger_type (*charger_detect)(struct usb_phy *); +}; + +struct usb_port_status { + __le16 wPortStatus; + __le16 wPortChange; + __le32 dwExtPortStatus; +}; + +struct usb_hub_status { + __le16 wHubStatus; + __le16 wHubChange; +}; + +struct usb_hub_descriptor { + __u8 bDescLength; + __u8 bDescriptorType; + __u8 bNbrPorts; + __le16 wHubCharacteristics; + __u8 bPwrOn2PwrGood; + __u8 bHubContrCurrent; + union { + struct { + __u8 DeviceRemovable[4]; + __u8 PortPwrCtrlMask[4]; + } hs; + struct { + __u8 bHubHdrDecLat; + __le16 wHubDelay; + __le16 DeviceRemovable; + } __attribute__((packed)) ss; + } u; +} __attribute__((packed)); + +struct usb_phy_io_ops { + int (*read)(struct usb_phy *, u32); + int (*write)(struct usb_phy *, u32, u32); +}; + +struct usb_gadget; + +struct usb_otg { + u8 default_a; + struct phy *phy; + struct usb_phy *usb_phy; + struct usb_bus *host; + struct usb_gadget *gadget; + enum usb_otg_state state; + int (*set_host)(struct usb_otg *, struct usb_bus *); + int (*set_peripheral)(struct usb_otg *, struct usb_gadget *); + int (*set_vbus)(struct usb_otg *, bool); + int (*start_srp)(struct usb_otg *); + int (*start_hnp)(struct usb_otg *); +}; + +typedef u32 usb_port_location_t; + +struct usb_port; + +struct usb_hub { + struct device *intfdev; + struct usb_device *hdev; + struct kref kref; + struct urb *urb; + u8 (*buffer)[8]; + union { + struct usb_hub_status hub; + struct usb_port_status port; + } *status; + struct mutex status_mutex; + int error; + int nerrors; + long unsigned int event_bits[1]; + long unsigned int change_bits[1]; + long unsigned int removed_bits[1]; + long unsigned int wakeup_bits[1]; + long unsigned int power_bits[1]; + long unsigned int child_usage_bits[1]; + long unsigned int warm_reset_bits[1]; + struct usb_hub_descriptor *descriptor; + struct usb_tt tt; + unsigned int mA_per_port; + unsigned int wakeup_enabled_descendants; + unsigned int limited_power: 1; + unsigned int quiescing: 1; + unsigned int disconnected: 1; + unsigned int in_reset: 1; + unsigned int quirk_disable_autosuspend: 1; + unsigned int quirk_check_port_auto_suspend: 1; + unsigned int has_indicators: 1; + u8 indicator[31]; + struct delayed_work leds; + struct delayed_work init_work; + struct work_struct events; + spinlock_t irq_urb_lock; + struct timer_list irq_urb_retry; + struct usb_port **ports; +}; + +struct usb_dev_state; + +struct usb_port { + struct usb_device *child; + struct device dev; + struct usb_dev_state *port_owner; + struct usb_port *peer; + struct dev_pm_qos_request *req; + enum usb_port_connect_type connect_type; + usb_port_location_t location; + struct mutex status_lock; + u32 over_current_count; + u8 portnum; + u32 quirks; + unsigned int is_superspeed: 1; + unsigned int usb3_lpm_u1_permit: 1; + unsigned int usb3_lpm_u2_permit: 1; +}; + +struct find_interface_arg { + int minor; + struct device_driver *drv; +}; + +struct each_dev_arg { + void *data; + int (*fn)(struct usb_device *, void *); +}; + +struct usb_qualifier_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __le16 bcdUSB; + __u8 bDeviceClass; + __u8 bDeviceSubClass; + __u8 bDeviceProtocol; + __u8 bMaxPacketSize0; + __u8 bNumConfigurations; + __u8 bRESERVED; +}; + +struct usb_set_sel_req { + __u8 u1_sel; + __u8 u1_pel; + __le16 u2_sel; + __le16 u2_pel; +}; + +struct usbdevfs_hub_portinfo { + char nports; + char port[127]; +}; + +enum hub_led_mode { + INDICATOR_AUTO = 0, + INDICATOR_CYCLE = 1, + INDICATOR_GREEN_BLINK = 2, + INDICATOR_GREEN_BLINK_OFF = 3, + INDICATOR_AMBER_BLINK = 4, + INDICATOR_AMBER_BLINK_OFF = 5, + INDICATOR_ALT_BLINK = 6, + INDICATOR_ALT_BLINK_OFF = 7, +}; + +struct usb_tt_clear { + struct list_head clear_list; + unsigned int tt; + u16 devinfo; + struct usb_hcd *hcd; + struct usb_host_endpoint *ep; +}; + +enum hub_activation_type { + HUB_INIT = 0, + HUB_INIT2 = 1, + HUB_INIT3 = 2, + HUB_POST_RESET = 3, + HUB_RESUME = 4, + HUB_RESET_RESUME = 5, +}; + +enum hub_quiescing_type { + HUB_DISCONNECT = 0, + HUB_PRE_RESET = 1, + HUB_SUSPEND = 2, +}; + +struct usb_ctrlrequest { + __u8 bRequestType; + __u8 bRequest; + __le16 wValue; + __le16 wIndex; + __le16 wLength; +}; + +struct usb_mon_operations { + void (*urb_submit)(struct usb_bus *, struct urb *); + void (*urb_submit_error)(struct usb_bus *, struct urb *, int); + void (*urb_complete)(struct usb_bus *, struct urb *, int); +}; + +struct usb_sg_request { + int status; + size_t bytes; + spinlock_t lock; + struct usb_device *dev; + int pipe; + int entries; + struct urb **urbs; + int count; + struct completion complete; +}; + +struct usb_cdc_header_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __le16 bcdCDC; +} __attribute__((packed)); + +struct usb_cdc_call_mgmt_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __u8 bmCapabilities; + __u8 bDataInterface; +}; + +struct usb_cdc_acm_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __u8 bmCapabilities; +}; + +struct usb_cdc_union_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __u8 bMasterInterface0; + __u8 bSlaveInterface0; +}; + +struct usb_cdc_country_functional_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __u8 iCountryCodeRelDate; + __le16 wCountyCode0; +}; + +struct usb_cdc_network_terminal_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __u8 bEntityId; + __u8 iName; + __u8 bChannelIndex; + __u8 bPhysicalInterface; +}; + +struct usb_cdc_ether_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __u8 iMACAddress; + __le32 bmEthernetStatistics; + __le16 wMaxSegmentSize; + __le16 wNumberMCFilters; + __u8 bNumberPowerFilters; +} __attribute__((packed)); + +struct usb_cdc_dmm_desc { + __u8 bFunctionLength; + __u8 bDescriptorType; + __u8 bDescriptorSubtype; + __u16 bcdVersion; + __le16 wMaxCommand; +} __attribute__((packed)); + +struct usb_cdc_mdlm_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __le16 bcdVersion; + __u8 bGUID[16]; +} __attribute__((packed)); + +struct usb_cdc_mdlm_detail_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __u8 bGuidDescriptorType; + __u8 bDetailData[0]; +}; + +struct usb_cdc_obex_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __le16 bcdVersion; +} __attribute__((packed)); + +struct usb_cdc_ncm_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __le16 bcdNcmVersion; + __u8 bmNetworkCapabilities; +} __attribute__((packed)); + +struct usb_cdc_mbim_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __le16 bcdMBIMVersion; + __le16 wMaxControlMessage; + __u8 bNumberFilters; + __u8 bMaxFilterSize; + __le16 wMaxSegmentSize; + __u8 bmNetworkCapabilities; +} __attribute__((packed)); + +struct usb_cdc_mbim_extended_desc { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDescriptorSubType; + __le16 bcdMBIMExtendedVersion; + __u8 bMaxOutstandingCommandMessages; + __le16 wMTU; +} __attribute__((packed)); + +struct usb_cdc_parsed_header { + struct usb_cdc_union_desc *usb_cdc_union_desc; + struct usb_cdc_header_desc *usb_cdc_header_desc; + struct usb_cdc_call_mgmt_descriptor *usb_cdc_call_mgmt_descriptor; + struct usb_cdc_acm_descriptor *usb_cdc_acm_descriptor; + struct usb_cdc_country_functional_desc *usb_cdc_country_functional_desc; + struct usb_cdc_network_terminal_desc *usb_cdc_network_terminal_desc; + struct usb_cdc_ether_desc *usb_cdc_ether_desc; + struct usb_cdc_dmm_desc *usb_cdc_dmm_desc; + struct usb_cdc_mdlm_desc *usb_cdc_mdlm_desc; + struct usb_cdc_mdlm_detail_desc *usb_cdc_mdlm_detail_desc; + struct usb_cdc_obex_desc *usb_cdc_obex_desc; + struct usb_cdc_ncm_desc *usb_cdc_ncm_desc; + struct usb_cdc_mbim_desc *usb_cdc_mbim_desc; + struct usb_cdc_mbim_extended_desc *usb_cdc_mbim_extended_desc; + bool phonet_magic_present; +}; + +struct api_context { + struct completion done; + int status; +}; + +struct set_config_request { + struct usb_device *udev; + int config; + struct work_struct work; + struct list_head node; +}; + +struct usb_dynid { + struct list_head node; + struct usb_device_id id; +}; + +struct usb_dev_cap_header { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDevCapabilityType; +}; + +struct usb_class_driver { + char *name; + char * (*devnode)(struct device *, umode_t *); + const struct file_operations *fops; + int minor_base; +}; + +struct usb_class { + struct kref kref; + struct class *class; +}; + +struct ep_device { + struct usb_endpoint_descriptor *desc; + struct usb_device *udev; + struct device dev; +}; + +struct usbdevfs_ctrltransfer { + __u8 bRequestType; + __u8 bRequest; + __u16 wValue; + __u16 wIndex; + __u16 wLength; + __u32 timeout; + void *data; +}; + +struct usbdevfs_bulktransfer { + unsigned int ep; + unsigned int len; + unsigned int timeout; + void *data; +}; + +struct usbdevfs_setinterface { + unsigned int interface; + unsigned int altsetting; +}; + +struct usbdevfs_disconnectsignal { + unsigned int signr; + void *context; +}; + +struct usbdevfs_getdriver { + unsigned int interface; + char driver[256]; +}; + +struct usbdevfs_connectinfo { + unsigned int devnum; + unsigned char slow; +}; + +struct usbdevfs_conninfo_ex { + __u32 size; + __u32 busnum; + __u32 devnum; + __u32 speed; + __u8 num_ports; + __u8 ports[7]; +}; + +struct usbdevfs_iso_packet_desc { + unsigned int length; + unsigned int actual_length; + unsigned int status; +}; + +struct usbdevfs_urb { + unsigned char type; + unsigned char endpoint; + int status; + unsigned int flags; + void *buffer; + int buffer_length; + int actual_length; + int start_frame; + union { + int number_of_packets; + unsigned int stream_id; + }; + int error_count; + unsigned int signr; + void *usercontext; + struct usbdevfs_iso_packet_desc iso_frame_desc[0]; +}; + +struct usbdevfs_ioctl { + int ifno; + int ioctl_code; + void *data; +}; + +struct usbdevfs_disconnect_claim { + unsigned int interface; + unsigned int flags; + char driver[256]; +}; + +struct usbdevfs_streams { + unsigned int num_streams; + unsigned int num_eps; + unsigned char eps[0]; +}; + +struct usbdevfs_ctrltransfer32 { + u8 bRequestType; + u8 bRequest; + u16 wValue; + u16 wIndex; + u16 wLength; + u32 timeout; + compat_caddr_t data; +}; + +struct usbdevfs_bulktransfer32 { + compat_uint_t ep; + compat_uint_t len; + compat_uint_t timeout; + compat_caddr_t data; +}; + +struct usbdevfs_disconnectsignal32 { + compat_int_t signr; + compat_caddr_t context; +}; + +struct usbdevfs_urb32 { + unsigned char type; + unsigned char endpoint; + compat_int_t status; + compat_uint_t flags; + compat_caddr_t buffer; + compat_int_t buffer_length; + compat_int_t actual_length; + compat_int_t start_frame; + compat_int_t number_of_packets; + compat_int_t error_count; + compat_uint_t signr; + compat_caddr_t usercontext; + struct usbdevfs_iso_packet_desc iso_frame_desc[0]; +}; + +struct usbdevfs_ioctl32 { + s32 ifno; + s32 ioctl_code; + compat_caddr_t data; +}; + +struct usb_dev_state___2 { + struct list_head list; + struct usb_device *dev; + struct file *file; + spinlock_t lock; + struct list_head async_pending; + struct list_head async_completed; + struct list_head memory_list; + wait_queue_head_t wait; + wait_queue_head_t wait_for_resume; + unsigned int discsignr; + struct pid *disc_pid; + const struct cred *cred; + sigval_t disccontext; + long unsigned int ifclaimed; + u32 disabled_bulk_eps; + long unsigned int interface_allowed_mask; + int not_yet_resumed; + bool suspend_allowed; + bool privileges_dropped; +}; + +struct usb_memory { + struct list_head memlist; + int vma_use_count; + int urb_use_count; + u32 size; + void *mem; + dma_addr_t dma_handle; + long unsigned int vm_start; + struct usb_dev_state___2 *ps; +}; + +struct async { + struct list_head asynclist; + struct usb_dev_state___2 *ps; + struct pid *pid; + const struct cred *cred; + unsigned int signr; + unsigned int ifnum; + void *userbuffer; + void *userurb; + sigval_t userurb_sigval; + struct urb *urb; + struct usb_memory *usbm; + unsigned int mem_usage; + int status; + u8 bulk_addr; + u8 bulk_status; +}; + +enum snoop_when { + SUBMIT = 0, + COMPLETE = 1, +}; + +struct quirk_entry { + u16 vid; + u16 pid; + u32 flags; +}; + +struct class_info { + int class; + char *class_name; +}; + +struct usb_phy_roothub___2 { + struct phy *phy; + struct list_head list; +}; + +typedef void (*companion_fn)(struct pci_dev *, struct usb_hcd *, struct pci_dev *, struct usb_hcd *); + +struct phy_devm { + struct usb_phy *phy; + struct notifier_block *nb; +}; + +struct mon_bus { + struct list_head bus_link; + spinlock_t lock; + struct usb_bus *u_bus; + int text_inited; + int bin_inited; + struct dentry *dent_s; + struct dentry *dent_t; + struct dentry *dent_u; + struct device *classdev; + int nreaders; + struct list_head r_list; + struct kref ref; + unsigned int cnt_events; + unsigned int cnt_text_lost; +}; + +struct mon_reader { + struct list_head r_link; + struct mon_bus *m_bus; + void *r_data; + void (*rnf_submit)(void *, struct urb *); + void (*rnf_error)(void *, struct urb *, int); + void (*rnf_complete)(void *, struct urb *, int); +}; + +struct snap { + int slen; + char str[80]; +}; + +struct mon_iso_desc { + int status; + unsigned int offset; + unsigned int length; +}; + +struct mon_event_text { + struct list_head e_link; + int type; + long unsigned int id; + unsigned int tstamp; + int busnum; + char devnum; + char epnum; + char is_in; + char xfertype; + int length; + int status; + int interval; + int start_frame; + int error_count; + char setup_flag; + char data_flag; + int numdesc; + struct mon_iso_desc isodesc[5]; + unsigned char setup[8]; + unsigned char data[32]; +}; + +struct mon_reader_text { + struct kmem_cache *e_slab; + int nevents; + struct list_head e_list; + struct mon_reader r; + wait_queue_head_t wait; + int printf_size; + size_t printf_offset; + size_t printf_togo; + char *printf_buf; + struct mutex printf_lock; + char slab_name[30]; +}; + +struct mon_text_ptr { + int cnt; + int limit; + char *pbuf; +}; + +enum { + NAMESZ = 10, +}; + +struct iso_rec { + int error_count; + int numdesc; +}; + +struct mon_bin_hdr { + u64 id; + unsigned char type; + unsigned char xfer_type; + unsigned char epnum; + unsigned char devnum; + short unsigned int busnum; + char flag_setup; + char flag_data; + s64 ts_sec; + s32 ts_usec; + int status; + unsigned int len_urb; + unsigned int len_cap; + union { + unsigned char setup[8]; + struct iso_rec iso; + } s; + int interval; + int start_frame; + unsigned int xfer_flags; + unsigned int ndesc; +}; + +struct mon_bin_isodesc { + int iso_status; + unsigned int iso_off; + unsigned int iso_len; + u32 _pad; +}; + +struct mon_bin_stats { + u32 queued; + u32 dropped; +}; + +struct mon_bin_get { + struct mon_bin_hdr *hdr; + void *data; + size_t alloc; +}; + +struct mon_bin_mfetch { + u32 *offvec; + u32 nfetch; + u32 nflush; +}; + +struct mon_bin_get32 { + u32 hdr32; + u32 data32; + u32 alloc32; +}; + +struct mon_bin_mfetch32 { + u32 offvec32; + u32 nfetch32; + u32 nflush32; +}; + +struct mon_pgmap { + struct page *pg; + unsigned char *ptr; +}; + +struct mon_reader_bin { + spinlock_t b_lock; + unsigned int b_size; + unsigned int b_cnt; + unsigned int b_in; + unsigned int b_out; + unsigned int b_read; + struct mon_pgmap *b_vec; + wait_queue_head_t b_wait; + struct mutex fetch_lock; + int mmap_active; + struct mon_reader r; + unsigned int cnt_lost; +}; + +enum amd_chipset_gen { + NOT_AMD_CHIPSET = 0, + AMD_CHIPSET_SB600 = 1, + AMD_CHIPSET_SB700 = 2, + AMD_CHIPSET_SB800 = 3, + AMD_CHIPSET_HUDSON2 = 4, + AMD_CHIPSET_BOLTON = 5, + AMD_CHIPSET_YANGTZE = 6, + AMD_CHIPSET_TAISHAN = 7, + AMD_CHIPSET_UNKNOWN = 8, +}; + +struct amd_chipset_type { + enum amd_chipset_gen gen; + u8 rev; +}; + +struct amd_chipset_info { + struct pci_dev *nb_dev; + struct pci_dev *smbus_dev; + int nb_type; + struct amd_chipset_type sb_type; + int isoc_reqs; + int probe_count; + bool need_pll_quirk; +}; + +struct ehci_stats { + long unsigned int normal; + long unsigned int error; + long unsigned int iaa; + long unsigned int lost_iaa; + long unsigned int complete; + long unsigned int unlink; +}; + +struct ehci_per_sched { + struct usb_device *udev; + struct usb_host_endpoint *ep; + struct list_head ps_list; + u16 tt_usecs; + u16 cs_mask; + u16 period; + u16 phase; + u8 bw_phase; + u8 phase_uf; + u8 usecs; + u8 c_usecs; + u8 bw_uperiod; + u8 bw_period; +}; + +enum ehci_rh_state { + EHCI_RH_HALTED = 0, + EHCI_RH_SUSPENDED = 1, + EHCI_RH_RUNNING = 2, + EHCI_RH_STOPPING = 3, +}; + +enum ehci_hrtimer_event { + EHCI_HRTIMER_POLL_ASS = 0, + EHCI_HRTIMER_POLL_PSS = 1, + EHCI_HRTIMER_POLL_DEAD = 2, + EHCI_HRTIMER_UNLINK_INTR = 3, + EHCI_HRTIMER_FREE_ITDS = 4, + EHCI_HRTIMER_ACTIVE_UNLINK = 5, + EHCI_HRTIMER_START_UNLINK_INTR = 6, + EHCI_HRTIMER_ASYNC_UNLINKS = 7, + EHCI_HRTIMER_IAA_WATCHDOG = 8, + EHCI_HRTIMER_DISABLE_PERIODIC = 9, + EHCI_HRTIMER_DISABLE_ASYNC = 10, + EHCI_HRTIMER_IO_WATCHDOG = 11, + EHCI_HRTIMER_NUM_EVENTS = 12, +}; + +struct ehci_caps; + +struct ehci_regs; + +struct ehci_dbg_port; + +struct ehci_qh; + +union ehci_shadow; + +struct ehci_itd; + +struct ehci_sitd; + +struct ehci_hcd { + enum ehci_hrtimer_event next_hrtimer_event; + unsigned int enabled_hrtimer_events; + ktime_t hr_timeouts[12]; + struct hrtimer hrtimer; + int PSS_poll_count; + int ASS_poll_count; + int died_poll_count; + struct ehci_caps *caps; + struct ehci_regs *regs; + struct ehci_dbg_port *debug; + __u32 hcs_params; + spinlock_t lock; + enum ehci_rh_state rh_state; + bool scanning: 1; + bool need_rescan: 1; + bool intr_unlinking: 1; + bool iaa_in_progress: 1; + bool async_unlinking: 1; + bool shutdown: 1; + struct ehci_qh *qh_scan_next; + struct ehci_qh *async; + struct ehci_qh *dummy; + struct list_head async_unlink; + struct list_head async_idle; + unsigned int async_unlink_cycle; + unsigned int async_count; + __le32 old_current; + __le32 old_token; + unsigned int periodic_size; + __le32 *periodic; + dma_addr_t periodic_dma; + struct list_head intr_qh_list; + unsigned int i_thresh; + union ehci_shadow *pshadow; + struct list_head intr_unlink_wait; + struct list_head intr_unlink; + unsigned int intr_unlink_wait_cycle; + unsigned int intr_unlink_cycle; + unsigned int now_frame; + unsigned int last_iso_frame; + unsigned int intr_count; + unsigned int isoc_count; + unsigned int periodic_count; + unsigned int uframe_periodic_max; + struct list_head cached_itd_list; + struct ehci_itd *last_itd_to_free; + struct list_head cached_sitd_list; + struct ehci_sitd *last_sitd_to_free; + long unsigned int reset_done[15]; + long unsigned int bus_suspended; + long unsigned int companion_ports; + long unsigned int owned_ports; + long unsigned int port_c_suspend; + long unsigned int suspended_ports; + long unsigned int resuming_ports; + struct dma_pool___2 *qh_pool; + struct dma_pool___2 *qtd_pool; + struct dma_pool___2 *itd_pool; + struct dma_pool___2 *sitd_pool; + unsigned int random_frame; + long unsigned int next_statechange; + ktime_t last_periodic_enable; + u32 command; + unsigned int no_selective_suspend: 1; + unsigned int has_fsl_port_bug: 1; + unsigned int has_fsl_hs_errata: 1; + unsigned int has_fsl_susp_errata: 1; + unsigned int big_endian_mmio: 1; + unsigned int big_endian_desc: 1; + unsigned int big_endian_capbase: 1; + unsigned int has_amcc_usb23: 1; + unsigned int need_io_watchdog: 1; + unsigned int amd_pll_fix: 1; + unsigned int use_dummy_qh: 1; + unsigned int has_synopsys_hc_bug: 1; + unsigned int frame_index_bug: 1; + unsigned int need_oc_pp_cycle: 1; + unsigned int imx28_write_fix: 1; + __le32 *ohci_hcctrl_reg; + unsigned int has_hostpc: 1; + unsigned int has_tdi_phy_lpm: 1; + unsigned int has_ppcd: 1; + u8 sbrn; + struct ehci_stats stats; + struct dentry *debug_dir; + u8 bandwidth[64]; + u8 tt_budget[64]; + struct list_head tt_list; + long unsigned int priv[0]; +}; + +struct ehci_caps { + u32 hc_capbase; + u32 hcs_params; + u32 hcc_params; + u8 portroute[8]; +}; + +struct ehci_regs { + u32 command; + u32 status; + u32 intr_enable; + u32 frame_index; + u32 segment; + u32 frame_list; + u32 async_next; + u32 reserved1[2]; + u32 txfill_tuning; + u32 reserved2[6]; + u32 configured_flag; + u32 port_status[0]; + u32 reserved3[9]; + u32 usbmode; + u32 reserved4[6]; + u32 hostpc[0]; + u32 reserved5[17]; + u32 usbmode_ex; +}; + +struct ehci_dbg_port { + u32 control; + u32 pids; + u32 data03; + u32 data47; + u32 address; +}; + +struct ehci_fstn; + +union ehci_shadow { + struct ehci_qh *qh; + struct ehci_itd *itd; + struct ehci_sitd *sitd; + struct ehci_fstn *fstn; + __le32 *hw_next; + void *ptr; +}; + +struct ehci_qh_hw; + +struct ehci_qtd; + +struct ehci_qh { + struct ehci_qh_hw *hw; + dma_addr_t qh_dma; + union ehci_shadow qh_next; + struct list_head qtd_list; + struct list_head intr_node; + struct ehci_qtd *dummy; + struct list_head unlink_node; + struct ehci_per_sched ps; + unsigned int unlink_cycle; + u8 qh_state; + u8 xacterrs; + u8 unlink_reason; + u8 gap_uf; + unsigned int is_out: 1; + unsigned int clearing_tt: 1; + unsigned int dequeue_during_giveback: 1; + unsigned int should_be_inactive: 1; +}; + +struct ehci_iso_stream; + +struct ehci_itd { + __le32 hw_next; + __le32 hw_transaction[8]; + __le32 hw_bufp[7]; + __le32 hw_bufp_hi[7]; + dma_addr_t itd_dma; + union ehci_shadow itd_next; + struct urb *urb; + struct ehci_iso_stream *stream; + struct list_head itd_list; + unsigned int frame; + unsigned int pg; + unsigned int index[8]; + long: 64; +}; + +struct ehci_sitd { + __le32 hw_next; + __le32 hw_fullspeed_ep; + __le32 hw_uframe; + __le32 hw_results; + __le32 hw_buf[2]; + __le32 hw_backpointer; + __le32 hw_buf_hi[2]; + dma_addr_t sitd_dma; + union ehci_shadow sitd_next; + struct urb *urb; + struct ehci_iso_stream *stream; + struct list_head sitd_list; + unsigned int frame; + unsigned int index; +}; + +struct ehci_qtd { + __le32 hw_next; + __le32 hw_alt_next; + __le32 hw_token; + __le32 hw_buf[5]; + __le32 hw_buf_hi[5]; + dma_addr_t qtd_dma; + struct list_head qtd_list; + struct urb *urb; + size_t length; +}; + +struct ehci_fstn { + __le32 hw_next; + __le32 hw_prev; + dma_addr_t fstn_dma; + union ehci_shadow fstn_next; + long: 64; +}; + +struct ehci_qh_hw { + __le32 hw_next; + __le32 hw_info1; + __le32 hw_info2; + __le32 hw_current; + __le32 hw_qtd_next; + __le32 hw_alt_next; + __le32 hw_token; + __le32 hw_buf[5]; + __le32 hw_buf_hi[5]; + long: 32; + long: 64; + long: 64; + long: 64; +}; + +struct ehci_iso_packet { + u64 bufp; + __le32 transaction; + u8 cross; + u32 buf1; +}; + +struct ehci_iso_sched { + struct list_head td_list; + unsigned int span; + unsigned int first_packet; + struct ehci_iso_packet packet[0]; +}; + +struct ehci_iso_stream { + struct ehci_qh_hw *hw; + u8 bEndpointAddress; + u8 highspeed; + struct list_head td_list; + struct list_head free_list; + struct ehci_per_sched ps; + unsigned int next_uframe; + __le32 splits; + u16 uperiod; + u16 maxp; + unsigned int bandwidth; + __le32 buf0; + __le32 buf1; + __le32 buf2; + __le32 address; +}; + +struct ehci_tt { + u16 bandwidth[8]; + struct list_head tt_list; + struct list_head ps_list; + struct usb_tt *usb_tt; + int tt_port; +}; + +struct ehci_driver_overrides { + size_t extra_priv_size; + int (*reset)(struct usb_hcd *); + int (*port_power)(struct usb_hcd *, int, bool); +}; + +struct debug_buffer { + ssize_t (*fill_func)(struct debug_buffer *); + struct usb_bus *bus; + struct mutex mutex; + size_t count; + char *output_buf; + size_t alloc_size; +}; + +typedef __u32 __hc32; + +typedef __u16 __hc16; + +struct td; + +struct ed { + __hc32 hwINFO; + __hc32 hwTailP; + __hc32 hwHeadP; + __hc32 hwNextED; + dma_addr_t dma; + struct td *dummy; + struct ed *ed_next; + struct ed *ed_prev; + struct list_head td_list; + struct list_head in_use_list; + u8 state; + u8 type; + u8 branch; + u16 interval; + u16 load; + u16 last_iso; + u16 tick; + unsigned int takeback_wdh_cnt; + struct td *pending_td; + long: 64; +}; + +struct td { + __hc32 hwINFO; + __hc32 hwCBP; + __hc32 hwNextTD; + __hc32 hwBE; + __hc16 hwPSW[2]; + __u8 index; + struct ed *ed; + struct td *td_hash; + struct td *next_dl_td; + struct urb *urb; + dma_addr_t td_dma; + dma_addr_t data_dma; + struct list_head td_list; + long: 64; +}; + +struct ohci_hcca { + __hc32 int_table[32]; + __hc32 frame_no; + __hc32 done_head; + u8 reserved_for_hc[116]; + u8 what[4]; +}; + +struct ohci_roothub_regs { + __hc32 a; + __hc32 b; + __hc32 status; + __hc32 portstatus[15]; +}; + +struct ohci_regs { + __hc32 revision; + __hc32 control; + __hc32 cmdstatus; + __hc32 intrstatus; + __hc32 intrenable; + __hc32 intrdisable; + __hc32 hcca; + __hc32 ed_periodcurrent; + __hc32 ed_controlhead; + __hc32 ed_controlcurrent; + __hc32 ed_bulkhead; + __hc32 ed_bulkcurrent; + __hc32 donehead; + __hc32 fminterval; + __hc32 fmremaining; + __hc32 fmnumber; + __hc32 periodicstart; + __hc32 lsthresh; + struct ohci_roothub_regs roothub; + long: 64; + long: 64; +}; + +struct urb_priv { + struct ed *ed; + u16 length; + u16 td_cnt; + struct list_head pending; + struct td *td[0]; +}; + +typedef struct urb_priv urb_priv_t; + +enum ohci_rh_state { + OHCI_RH_HALTED = 0, + OHCI_RH_SUSPENDED = 1, + OHCI_RH_RUNNING = 2, +}; + +struct ohci_hcd { + spinlock_t lock; + struct ohci_regs *regs; + struct ohci_hcca *hcca; + dma_addr_t hcca_dma; + struct ed *ed_rm_list; + struct ed *ed_bulktail; + struct ed *ed_controltail; + struct ed *periodic[32]; + void (*start_hnp)(struct ohci_hcd *); + struct dma_pool___2 *td_cache; + struct dma_pool___2 *ed_cache; + struct td *td_hash[64]; + struct td *dl_start; + struct td *dl_end; + struct list_head pending; + struct list_head eds_in_use; + enum ohci_rh_state rh_state; + int num_ports; + int load[32]; + u32 hc_control; + long unsigned int next_statechange; + u32 fminterval; + unsigned int autostop: 1; + unsigned int working: 1; + unsigned int restart_work: 1; + long unsigned int flags; + unsigned int prev_frame_no; + unsigned int wdh_cnt; + unsigned int prev_wdh_cnt; + u32 prev_donehead; + struct timer_list io_watchdog; + struct work_struct nec_work; + struct dentry *debug_dir; + long unsigned int priv[0]; +}; + +struct ohci_driver_overrides { + const char *product_desc; + size_t extra_priv_size; + int (*reset)(struct usb_hcd *); +}; + +struct debug_buffer___2 { + ssize_t (*fill_func)(struct debug_buffer___2 *); + struct ohci_hcd *ohci; + struct mutex mutex; + size_t count; + char *page; +}; + +struct uhci_td; + +struct uhci_qh { + __le32 link; + __le32 element; + dma_addr_t dma_handle; + struct list_head node; + struct usb_host_endpoint *hep; + struct usb_device *udev; + struct list_head queue; + struct uhci_td *dummy_td; + struct uhci_td *post_td; + struct usb_iso_packet_descriptor *iso_packet_desc; + long unsigned int advance_jiffies; + unsigned int unlink_frame; + unsigned int period; + short int phase; + short int load; + unsigned int iso_frame; + int state; + int type; + int skel; + unsigned int initial_toggle: 1; + unsigned int needs_fixup: 1; + unsigned int is_stopped: 1; + unsigned int wait_expired: 1; + unsigned int bandwidth_reserved: 1; +}; + +struct uhci_td { + __le32 link; + __le32 status; + __le32 token; + __le32 buffer; + dma_addr_t dma_handle; + struct list_head list; + int frame; + struct list_head fl_list; +}; + +enum uhci_rh_state { + UHCI_RH_RESET = 0, + UHCI_RH_SUSPENDED = 1, + UHCI_RH_AUTO_STOPPED = 2, + UHCI_RH_RESUMING = 3, + UHCI_RH_SUSPENDING = 4, + UHCI_RH_RUNNING = 5, + UHCI_RH_RUNNING_NODEVS = 6, +}; + +struct uhci_hcd { + struct dentry *dentry; + long unsigned int io_addr; + void *regs; + struct dma_pool___2 *qh_pool; + struct dma_pool___2 *td_pool; + struct uhci_td *term_td; + struct uhci_qh *skelqh[11]; + struct uhci_qh *next_qh; + spinlock_t lock; + dma_addr_t frame_dma_handle; + __le32 *frame; + void **frame_cpu; + enum uhci_rh_state rh_state; + long unsigned int auto_stop_time; + unsigned int frame_number; + unsigned int is_stopped; + unsigned int last_iso_frame; + unsigned int cur_iso_frame; + unsigned int scan_in_progress: 1; + unsigned int need_rescan: 1; + unsigned int dead: 1; + unsigned int RD_enable: 1; + unsigned int is_initialized: 1; + unsigned int fsbr_is_on: 1; + unsigned int fsbr_is_wanted: 1; + unsigned int fsbr_expiring: 1; + struct timer_list fsbr_timer; + unsigned int oc_low: 1; + unsigned int wait_for_hp: 1; + unsigned int big_endian_mmio: 1; + unsigned int big_endian_desc: 1; + unsigned int is_aspeed: 1; + long unsigned int port_c_suspend; + long unsigned int resuming_ports; + long unsigned int ports_timeout; + struct list_head idle_qh_list; + int rh_numports; + wait_queue_head_t waitqh; + int num_waiting; + int total_load; + short int load[32]; + struct clk *clk; + void (*reset_hc)(struct uhci_hcd *); + int (*check_and_reset_hc)(struct uhci_hcd *); + void (*configure_hc)(struct uhci_hcd *); + int (*resume_detect_interrupts_are_broken)(struct uhci_hcd *); + int (*global_suspend_mode_is_broken)(struct uhci_hcd *); +}; + +struct urb_priv___2 { + struct list_head node; + struct urb *urb; + struct uhci_qh *qh; + struct list_head td_list; + unsigned int fsbr: 1; +}; + +struct uhci_debug { + int size; + char *data; +}; + +struct xhci_cap_regs { + __le32 hc_capbase; + __le32 hcs_params1; + __le32 hcs_params2; + __le32 hcs_params3; + __le32 hcc_params; + __le32 db_off; + __le32 run_regs_off; + __le32 hcc_params2; +}; + +struct xhci_op_regs { + __le32 command; + __le32 status; + __le32 page_size; + __le32 reserved1; + __le32 reserved2; + __le32 dev_notification; + __le64 cmd_ring; + __le32 reserved3[4]; + __le64 dcbaa_ptr; + __le32 config_reg; + __le32 reserved4[241]; + __le32 port_status_base; + __le32 port_power_base; + __le32 port_link_base; + __le32 reserved5; + __le32 reserved6[1016]; +}; + +struct xhci_intr_reg { + __le32 irq_pending; + __le32 irq_control; + __le32 erst_size; + __le32 rsvd; + __le64 erst_base; + __le64 erst_dequeue; +}; + +struct xhci_run_regs { + __le32 microframe_index; + __le32 rsvd[7]; + struct xhci_intr_reg ir_set[128]; +}; + +struct xhci_doorbell_array { + __le32 doorbell[256]; +}; + +struct xhci_container_ctx { + unsigned int type; + int size; + u8 *bytes; + dma_addr_t dma; +}; + +struct xhci_slot_ctx { + __le32 dev_info; + __le32 dev_info2; + __le32 tt_info; + __le32 dev_state; + __le32 reserved[4]; +}; + +struct xhci_ep_ctx { + __le32 ep_info; + __le32 ep_info2; + __le64 deq; + __le32 tx_info; + __le32 reserved[3]; +}; + +struct xhci_input_control_ctx { + __le32 drop_flags; + __le32 add_flags; + __le32 rsvd2[6]; +}; + +union xhci_trb; + +struct xhci_command { + struct xhci_container_ctx *in_ctx; + u32 status; + int slot_id; + struct completion *completion; + union xhci_trb *command_trb; + struct list_head cmd_list; +}; + +struct xhci_link_trb { + __le64 segment_ptr; + __le32 intr_target; + __le32 control; +}; + +struct xhci_transfer_event { + __le64 buffer; + __le32 transfer_len; + __le32 flags; +}; + +struct xhci_event_cmd { + __le64 cmd_trb; + __le32 status; + __le32 flags; +}; + +struct xhci_generic_trb { + __le32 field[4]; +}; + +union xhci_trb { + struct xhci_link_trb link; + struct xhci_transfer_event trans_event; + struct xhci_event_cmd event_cmd; + struct xhci_generic_trb generic; +}; + +struct xhci_stream_ctx { + __le64 stream_ring; + __le32 reserved[2]; +}; + +struct xhci_ring; + +struct xhci_stream_info { + struct xhci_ring **stream_rings; + unsigned int num_streams; + struct xhci_stream_ctx *stream_ctx_array; + unsigned int num_stream_ctxs; + dma_addr_t ctx_array_dma; + struct xarray trb_address_map; + struct xhci_command *free_streams_command; +}; + +enum xhci_ring_type { + TYPE_CTRL = 0, + TYPE_ISOC = 1, + TYPE_BULK = 2, + TYPE_INTR = 3, + TYPE_STREAM = 4, + TYPE_COMMAND = 5, + TYPE_EVENT = 6, +}; + +struct xhci_segment; + +struct xhci_ring { + struct xhci_segment *first_seg; + struct xhci_segment *last_seg; + union xhci_trb *enqueue; + struct xhci_segment *enq_seg; + union xhci_trb *dequeue; + struct xhci_segment *deq_seg; + struct list_head td_list; + u32 cycle_state; + unsigned int err_count; + unsigned int stream_id; + unsigned int num_segs; + unsigned int num_trbs_free; + unsigned int num_trbs_free_temp; + unsigned int bounce_buf_len; + enum xhci_ring_type type; + bool last_td_was_short; + struct xarray *trb_address_map; +}; + +struct xhci_bw_info { + unsigned int ep_interval; + unsigned int mult; + unsigned int num_packets; + unsigned int max_packet_size; + unsigned int max_esit_payload; + unsigned int type; +}; + +struct xhci_hcd; + +struct xhci_virt_ep { + struct xhci_ring *ring; + struct xhci_stream_info *stream_info; + struct xhci_ring *new_ring; + unsigned int ep_state; + struct list_head cancelled_td_list; + struct timer_list stop_cmd_timer; + struct xhci_hcd *xhci; + struct xhci_segment *queued_deq_seg; + union xhci_trb *queued_deq_ptr; + bool skip; + struct xhci_bw_info bw_info; + struct list_head bw_endpoint_list; + int next_frame_id; + bool use_extended_tbc; +}; + +struct xhci_erst_entry; + +struct xhci_erst { + struct xhci_erst_entry *entries; + unsigned int num_entries; + dma_addr_t erst_dma_addr; + unsigned int erst_size; +}; + +struct s3_save { + u32 command; + u32 dev_nt; + u64 dcbaa_ptr; + u32 config_reg; + u32 irq_pending; + u32 irq_control; + u32 erst_size; + u64 erst_base; + u64 erst_dequeue; +}; + +struct xhci_bus_state { + long unsigned int bus_suspended; + long unsigned int next_statechange; + u32 port_c_suspend; + u32 suspended_ports; + u32 port_remote_wakeup; + long unsigned int resume_done[31]; + long unsigned int resuming_ports; + long unsigned int rexit_ports; + struct completion rexit_done[31]; + struct completion u3exit_done[31]; +}; + +struct xhci_port; + +struct xhci_hub { + struct xhci_port **ports; + unsigned int num_ports; + struct usb_hcd *hcd; + struct xhci_bus_state bus_state; + u8 maj_rev; + u8 min_rev; +}; + +struct xhci_device_context_array; + +struct xhci_scratchpad; + +struct xhci_virt_device; + +struct xhci_root_port_bw_info; + +struct xhci_port_cap; + +struct xhci_hcd { + struct usb_hcd *main_hcd; + struct usb_hcd *shared_hcd; + struct xhci_cap_regs *cap_regs; + struct xhci_op_regs *op_regs; + struct xhci_run_regs *run_regs; + struct xhci_doorbell_array *dba; + struct xhci_intr_reg *ir_set; + __u32 hcs_params1; + __u32 hcs_params2; + __u32 hcs_params3; + __u32 hcc_params; + __u32 hcc_params2; + spinlock_t lock; + u8 sbrn; + u16 hci_version; + u8 max_slots; + u8 max_interrupters; + u8 max_ports; + u8 isoc_threshold; + u32 imod_interval; + int event_ring_max; + int page_size; + int page_shift; + int msix_count; + struct clk *clk; + struct clk *reg_clk; + struct reset_control___2 *reset; + struct xhci_device_context_array *dcbaa; + struct xhci_ring *cmd_ring; + unsigned int cmd_ring_state; + struct list_head cmd_list; + unsigned int cmd_ring_reserved_trbs; + struct delayed_work cmd_timer; + struct completion cmd_ring_stop_completion; + struct xhci_command *current_cmd; + struct xhci_ring *event_ring; + struct xhci_erst erst; + struct xhci_scratchpad *scratchpad; + struct list_head lpm_failed_devs; + struct mutex mutex; + struct xhci_command *lpm_command; + struct xhci_virt_device *devs[256]; + struct xhci_root_port_bw_info *rh_bw; + struct dma_pool___2 *device_pool; + struct dma_pool___2 *segment_pool; + struct dma_pool___2 *small_streams_pool; + struct dma_pool___2 *medium_streams_pool; + unsigned int xhc_state; + u32 command; + struct s3_save s3; + long long unsigned int quirks; + unsigned int num_active_eps; + unsigned int limit_active_eps; + struct xhci_port *hw_ports; + struct xhci_hub usb2_rhub; + struct xhci_hub usb3_rhub; + unsigned int hw_lpm_support: 1; + unsigned int broken_suspend: 1; + u32 *ext_caps; + unsigned int num_ext_caps; + struct xhci_port_cap *port_caps; + unsigned int num_port_caps; + struct timer_list comp_mode_recovery_timer; + u32 port_status_u0; + u16 test_mode; + struct dentry *debugfs_root; + struct dentry *debugfs_slots; + struct list_head regset_list; + void *dbc; + long unsigned int priv[0]; +}; + +struct xhci_segment { + union xhci_trb *trbs; + struct xhci_segment *next; + dma_addr_t dma; + dma_addr_t bounce_dma; + void *bounce_buf; + unsigned int bounce_offs; + unsigned int bounce_len; +}; + +enum xhci_overhead_type { + LS_OVERHEAD_TYPE = 0, + FS_OVERHEAD_TYPE = 1, + HS_OVERHEAD_TYPE = 2, +}; + +struct xhci_interval_bw { + unsigned int num_packets; + struct list_head endpoints; + unsigned int overhead[3]; +}; + +struct xhci_interval_bw_table { + unsigned int interval0_esit_payload; + struct xhci_interval_bw interval_bw[16]; + unsigned int bw_used; + unsigned int ss_bw_in; + unsigned int ss_bw_out; +}; + +struct xhci_tt_bw_info; + +struct xhci_virt_device { + struct usb_device *udev; + struct xhci_container_ctx *out_ctx; + struct xhci_container_ctx *in_ctx; + struct xhci_virt_ep eps[31]; + u8 fake_port; + u8 real_port; + struct xhci_interval_bw_table *bw_table; + struct xhci_tt_bw_info *tt_info; + long unsigned int flags; + u16 current_mel; + void *debugfs_private; +}; + +struct xhci_tt_bw_info { + struct list_head tt_list; + int slot_id; + int ttport; + struct xhci_interval_bw_table bw_table; + int active_eps; +}; + +struct xhci_root_port_bw_info { + struct list_head tts; + unsigned int num_active_tts; + struct xhci_interval_bw_table bw_table; +}; + +struct xhci_device_context_array { + __le64 dev_context_ptrs[256]; + dma_addr_t dma; +}; + +enum xhci_setup_dev { + SETUP_CONTEXT_ONLY = 0, + SETUP_CONTEXT_ADDRESS = 1, +}; + +struct xhci_td { + struct list_head td_list; + struct list_head cancelled_td_list; + struct urb *urb; + struct xhci_segment *start_seg; + union xhci_trb *first_trb; + union xhci_trb *last_trb; + struct xhci_segment *bounce_seg; + bool urb_length_set; +}; + +struct xhci_dequeue_state { + struct xhci_segment *new_deq_seg; + union xhci_trb *new_deq_ptr; + int new_cycle_state; + unsigned int stream_id; +}; + +struct xhci_erst_entry { + __le64 seg_addr; + __le32 seg_size; + __le32 rsvd; +}; + +struct xhci_scratchpad { + u64 *sp_array; + dma_addr_t sp_dma; + void **sp_buffers; +}; + +struct urb_priv___3 { + int num_tds; + int num_tds_done; + struct xhci_td td[0]; +}; + +struct xhci_port_cap { + u32 *psi; + u8 psi_count; + u8 psi_uid_count; + u8 maj_rev; + u8 min_rev; +}; + +struct xhci_port { + __le32 *addr; + int hw_portnum; + int hcd_portnum; + struct xhci_hub *rhub; + struct xhci_port_cap *port_cap; +}; + +struct xhci_driver_overrides { + size_t extra_priv_size; + int (*reset)(struct usb_hcd *); + int (*start)(struct usb_hcd *); + int (*check_bandwidth)(struct usb_hcd *, struct usb_device *); + void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *); +}; + +typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *); + +enum xhci_ep_reset_type { + EP_HARD_RESET = 0, + EP_SOFT_RESET = 1, +}; + +struct dbc_regs { + __le32 capability; + __le32 doorbell; + __le32 ersts; + __le32 __reserved_0; + __le64 erstba; + __le64 erdp; + __le32 control; + __le32 status; + __le32 portsc; + __le32 __reserved_1; + __le64 dccp; + __le32 devinfo1; + __le32 devinfo2; +}; + +struct dbc_str_descs { + char string0[64]; + char manufacturer[64]; + char product[64]; + char serial[64]; +}; + +enum dbc_state { + DS_DISABLED = 0, + DS_INITIALIZED = 1, + DS_ENABLED = 2, + DS_CONNECTED = 3, + DS_CONFIGURED = 4, + DS_STALLED = 5, +}; + +struct xhci_dbc; + +struct dbc_ep { + struct xhci_dbc *dbc; + struct list_head list_pending; + struct xhci_ring *ring; + unsigned int direction: 1; +}; + +struct dbc_driver; + +struct xhci_dbc { + spinlock_t lock; + struct device *dev; + struct xhci_hcd *xhci; + struct dbc_regs *regs; + struct xhci_ring *ring_evt; + struct xhci_ring *ring_in; + struct xhci_ring *ring_out; + struct xhci_erst erst; + struct xhci_container_ctx *ctx; + struct dbc_str_descs *string; + dma_addr_t string_dma; + size_t string_size; + enum dbc_state state; + struct delayed_work event_work; + unsigned int resume_required: 1; + struct dbc_ep eps[2]; + const struct dbc_driver *driver; + void *priv; +}; + +struct dbc_driver { + int (*configure)(struct xhci_dbc *); + void (*disconnect)(struct xhci_dbc *); +}; + +struct dbc_request { + void *buf; + unsigned int length; + dma_addr_t dma; + void (*complete)(struct xhci_dbc *, struct dbc_request *); + struct list_head list_pool; + int status; + unsigned int actual; + struct xhci_dbc *dbc; + struct list_head list_pending; + dma_addr_t trb_dma; + union xhci_trb *trb; + unsigned int direction: 1; +}; + +struct trace_event_raw_xhci_log_msg { + struct trace_entry ent; + u32 __data_loc_msg; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_ctx { + struct trace_entry ent; + int ctx_64; + unsigned int ctx_type; + dma_addr_t ctx_dma; + u8 *ctx_va; + unsigned int ctx_ep_num; + int slot_id; + u32 __data_loc_ctx_data; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_trb { + struct trace_entry ent; + u32 type; + u32 field0; + u32 field1; + u32 field2; + u32 field3; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_free_virt_dev { + struct trace_entry ent; + void *vdev; + long long unsigned int out_ctx; + long long unsigned int in_ctx; + u8 fake_port; + u8 real_port; + u16 current_mel; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_virt_dev { + struct trace_entry ent; + void *vdev; + long long unsigned int out_ctx; + long long unsigned int in_ctx; + int devnum; + int state; + int speed; + u8 portnum; + u8 level; + int slot_id; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_urb { + struct trace_entry ent; + void *urb; + unsigned int pipe; + unsigned int stream; + int status; + unsigned int flags; + int num_mapped_sgs; + int num_sgs; + int length; + int actual; + int epnum; + int dir_in; + int type; + int slot_id; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_ep_ctx { + struct trace_entry ent; + u32 info; + u32 info2; + u64 deq; + u32 tx_info; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_slot_ctx { + struct trace_entry ent; + u32 info; + u32 info2; + u32 tt_info; + u32 state; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_ctrl_ctx { + struct trace_entry ent; + u32 drop; + u32 add; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_ring { + struct trace_entry ent; + u32 type; + void *ring; + dma_addr_t enq; + dma_addr_t deq; + dma_addr_t enq_seg; + dma_addr_t deq_seg; + unsigned int num_segs; + unsigned int stream_id; + unsigned int cycle_state; + unsigned int num_trbs_free; + unsigned int bounce_buf_len; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_portsc { + struct trace_entry ent; + u32 portnum; + u32 portsc; + char __data[0]; +}; + +struct trace_event_raw_xhci_log_doorbell { + struct trace_entry ent; + u32 slot; + u32 doorbell; + char __data[0]; +}; + +struct trace_event_raw_xhci_dbc_log_request { + struct trace_entry ent; + struct dbc_request *req; + bool dir; + unsigned int actual; + unsigned int length; + int status; + char __data[0]; +}; + +struct trace_event_data_offsets_xhci_log_msg { + u32 msg; +}; + +struct trace_event_data_offsets_xhci_log_ctx { + u32 ctx_data; +}; + +struct trace_event_data_offsets_xhci_log_trb {}; + +struct trace_event_data_offsets_xhci_log_free_virt_dev {}; + +struct trace_event_data_offsets_xhci_log_virt_dev {}; + +struct trace_event_data_offsets_xhci_log_urb {}; + +struct trace_event_data_offsets_xhci_log_ep_ctx {}; + +struct trace_event_data_offsets_xhci_log_slot_ctx {}; + +struct trace_event_data_offsets_xhci_log_ctrl_ctx {}; + +struct trace_event_data_offsets_xhci_log_ring {}; + +struct trace_event_data_offsets_xhci_log_portsc {}; + +struct trace_event_data_offsets_xhci_log_doorbell {}; + +struct trace_event_data_offsets_xhci_dbc_log_request {}; + +typedef void (*btf_trace_xhci_dbg_address)(void *, struct va_format *); + +typedef void (*btf_trace_xhci_dbg_context_change)(void *, struct va_format *); + +typedef void (*btf_trace_xhci_dbg_quirks)(void *, struct va_format *); + +typedef void (*btf_trace_xhci_dbg_reset_ep)(void *, struct va_format *); + +typedef void (*btf_trace_xhci_dbg_cancel_urb)(void *, struct va_format *); + +typedef void (*btf_trace_xhci_dbg_init)(void *, struct va_format *); + +typedef void (*btf_trace_xhci_dbg_ring_expansion)(void *, struct va_format *); + +typedef void (*btf_trace_xhci_address_ctx)(void *, struct xhci_hcd *, struct xhci_container_ctx *, unsigned int); + +typedef void (*btf_trace_xhci_handle_event)(void *, struct xhci_ring *, struct xhci_generic_trb *); + +typedef void (*btf_trace_xhci_handle_command)(void *, struct xhci_ring *, struct xhci_generic_trb *); + +typedef void (*btf_trace_xhci_handle_transfer)(void *, struct xhci_ring *, struct xhci_generic_trb *); + +typedef void (*btf_trace_xhci_queue_trb)(void *, struct xhci_ring *, struct xhci_generic_trb *); + +typedef void (*btf_trace_xhci_dbc_handle_event)(void *, struct xhci_ring *, struct xhci_generic_trb *); + +typedef void (*btf_trace_xhci_dbc_handle_transfer)(void *, struct xhci_ring *, struct xhci_generic_trb *); + +typedef void (*btf_trace_xhci_dbc_gadget_ep_queue)(void *, struct xhci_ring *, struct xhci_generic_trb *); + +typedef void (*btf_trace_xhci_free_virt_device)(void *, struct xhci_virt_device *); + +typedef void (*btf_trace_xhci_alloc_virt_device)(void *, struct xhci_virt_device *); + +typedef void (*btf_trace_xhci_setup_device)(void *, struct xhci_virt_device *); + +typedef void (*btf_trace_xhci_setup_addressable_virt_device)(void *, struct xhci_virt_device *); + +typedef void (*btf_trace_xhci_stop_device)(void *, struct xhci_virt_device *); + +typedef void (*btf_trace_xhci_urb_enqueue)(void *, struct urb *); + +typedef void (*btf_trace_xhci_urb_giveback)(void *, struct urb *); + +typedef void (*btf_trace_xhci_urb_dequeue)(void *, struct urb *); + +typedef void (*btf_trace_xhci_handle_cmd_stop_ep)(void *, struct xhci_ep_ctx *); + +typedef void (*btf_trace_xhci_handle_cmd_set_deq_ep)(void *, struct xhci_ep_ctx *); + +typedef void (*btf_trace_xhci_handle_cmd_reset_ep)(void *, struct xhci_ep_ctx *); + +typedef void (*btf_trace_xhci_handle_cmd_config_ep)(void *, struct xhci_ep_ctx *); + +typedef void (*btf_trace_xhci_add_endpoint)(void *, struct xhci_ep_ctx *); + +typedef void (*btf_trace_xhci_alloc_dev)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_free_dev)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_handle_cmd_disable_slot)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_discover_or_reset_device)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_setup_device_slot)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_handle_cmd_addr_dev)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_handle_cmd_reset_dev)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_handle_cmd_set_deq)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_configure_endpoint)(void *, struct xhci_slot_ctx *); + +typedef void (*btf_trace_xhci_address_ctrl_ctx)(void *, struct xhci_input_control_ctx *); + +typedef void (*btf_trace_xhci_configure_endpoint_ctrl_ctx)(void *, struct xhci_input_control_ctx *); + +typedef void (*btf_trace_xhci_ring_alloc)(void *, struct xhci_ring *); + +typedef void (*btf_trace_xhci_ring_free)(void *, struct xhci_ring *); + +typedef void (*btf_trace_xhci_ring_expansion)(void *, struct xhci_ring *); + +typedef void (*btf_trace_xhci_inc_enq)(void *, struct xhci_ring *); + +typedef void (*btf_trace_xhci_inc_deq)(void *, struct xhci_ring *); + +typedef void (*btf_trace_xhci_handle_port_status)(void *, u32, u32); + +typedef void (*btf_trace_xhci_get_port_status)(void *, u32, u32); + +typedef void (*btf_trace_xhci_hub_status_data)(void *, u32, u32); + +typedef void (*btf_trace_xhci_ring_ep_doorbell)(void *, u32, u32); + +typedef void (*btf_trace_xhci_ring_host_doorbell)(void *, u32, u32); + +typedef void (*btf_trace_xhci_dbc_alloc_request)(void *, struct dbc_request *); + +typedef void (*btf_trace_xhci_dbc_free_request)(void *, struct dbc_request *); + +typedef void (*btf_trace_xhci_dbc_queue_request)(void *, struct dbc_request *); + +typedef void (*btf_trace_xhci_dbc_giveback_request)(void *, struct dbc_request *); + +struct usb_string_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __le16 wData[1]; +}; + +struct dbc_info_context { + __le64 string0; + __le64 manufacturer; + __le64 product; + __le64 serial; + __le32 length; + __le32 __reserved_0[7]; +}; + +enum evtreturn { + EVT_ERR = 4294967295, + EVT_DONE = 0, + EVT_GSER = 1, + EVT_DISC = 2, +}; + +struct kfifo { + union { + struct __kfifo kfifo; + unsigned char *type; + const unsigned char *const_type; + char (*rectype)[0]; + void *ptr; + const void *ptr_const; + }; + unsigned char buf[0]; +}; + +struct dbc_port { + struct tty_port port; + spinlock_t port_lock; + struct list_head read_pool; + struct list_head read_queue; + unsigned int n_read; + struct tasklet_struct push; + struct list_head write_pool; + struct kfifo write_fifo; + bool registered; +}; + +struct xhci_regset { + char name[32]; + struct debugfs_regset32 regset; + size_t nregs; + struct list_head list; +}; + +struct xhci_file_map { + const char *name; + int (*show)(struct seq_file *, void *); +}; + +struct xhci_ep_priv { + char name[32]; + struct dentry *root; + struct xhci_stream_info *stream_info; + struct xhci_ring *show_ring; + unsigned int stream_id; +}; + +struct xhci_slot_priv { + char name[32]; + struct dentry *root; + struct xhci_ep_priv *eps[31]; + struct xhci_virt_device *dev; +}; + +struct xhci_driver_data { + u64 quirks; + const char *firmware; +}; + +struct async_icount { + __u32 cts; + __u32 dsr; + __u32 rng; + __u32 dcd; + __u32 tx; + __u32 rx; + __u32 frame; + __u32 parity; + __u32 overrun; + __u32 brk; + __u32 buf_overrun; +}; + +struct usb_serial; + +struct usb_serial_port { + struct usb_serial *serial; + struct tty_port port; + spinlock_t lock; + u32 minor; + u8 port_number; + unsigned char *interrupt_in_buffer; + struct urb *interrupt_in_urb; + __u8 interrupt_in_endpointAddress; + unsigned char *interrupt_out_buffer; + int interrupt_out_size; + struct urb *interrupt_out_urb; + __u8 interrupt_out_endpointAddress; + unsigned char *bulk_in_buffer; + int bulk_in_size; + struct urb *read_urb; + __u8 bulk_in_endpointAddress; + unsigned char *bulk_in_buffers[2]; + struct urb *read_urbs[2]; + long unsigned int read_urbs_free; + unsigned char *bulk_out_buffer; + int bulk_out_size; + struct urb *write_urb; + struct kfifo write_fifo; + unsigned char *bulk_out_buffers[2]; + struct urb *write_urbs[2]; + long unsigned int write_urbs_free; + __u8 bulk_out_endpointAddress; + struct async_icount icount; + int tx_bytes; + long unsigned int flags; + struct work_struct work; + long unsigned int sysrq; + struct device dev; +}; + +struct usb_serial_driver; + +struct usb_serial { + struct usb_device *dev; + struct usb_serial_driver *type; + struct usb_interface *interface; + unsigned char disconnected: 1; + unsigned char suspending: 1; + unsigned char attached: 1; + unsigned char minors_reserved: 1; + unsigned char num_ports; + unsigned char num_port_pointers; + unsigned char num_interrupt_in; + unsigned char num_interrupt_out; + unsigned char num_bulk_in; + unsigned char num_bulk_out; + struct usb_serial_port *port[16]; + struct kref kref; + struct mutex disc_mutex; + void *private; +}; + +struct usb_serial_endpoints; + +struct usb_serial_driver { + const char *description; + const struct usb_device_id *id_table; + struct list_head driver_list; + struct device_driver driver; + struct usb_driver *usb_driver; + struct usb_dynids dynids; + unsigned char num_ports; + unsigned char num_bulk_in; + unsigned char num_bulk_out; + unsigned char num_interrupt_in; + unsigned char num_interrupt_out; + size_t bulk_in_size; + size_t bulk_out_size; + int (*probe)(struct usb_serial *, const struct usb_device_id *); + int (*attach)(struct usb_serial *); + int (*calc_num_ports)(struct usb_serial *, struct usb_serial_endpoints *); + void (*disconnect)(struct usb_serial *); + void (*release)(struct usb_serial *); + int (*port_probe)(struct usb_serial_port *); + int (*port_remove)(struct usb_serial_port *); + int (*suspend)(struct usb_serial *, pm_message_t); + int (*resume)(struct usb_serial *); + int (*reset_resume)(struct usb_serial *); + int (*open)(struct tty_struct *, struct usb_serial_port *); + void (*close)(struct usb_serial_port *); + int (*write)(struct tty_struct *, struct usb_serial_port *, const unsigned char *, int); + int (*write_room)(struct tty_struct *); + int (*ioctl)(struct tty_struct *, unsigned int, long unsigned int); + int (*get_serial)(struct tty_struct *, struct serial_struct *); + int (*set_serial)(struct tty_struct *, struct serial_struct *); + void (*set_termios)(struct tty_struct *, struct usb_serial_port *, struct ktermios *); + void (*break_ctl)(struct tty_struct *, int); + int (*chars_in_buffer)(struct tty_struct *); + void (*wait_until_sent)(struct tty_struct *, long int); + bool (*tx_empty)(struct usb_serial_port *); + void (*throttle)(struct tty_struct *); + void (*unthrottle)(struct tty_struct *); + int (*tiocmget)(struct tty_struct *); + int (*tiocmset)(struct tty_struct *, unsigned int, unsigned int); + int (*tiocmiwait)(struct tty_struct *, long unsigned int); + int (*get_icount)(struct tty_struct *, struct serial_icounter_struct *); + void (*dtr_rts)(struct usb_serial_port *, int); + int (*carrier_raised)(struct usb_serial_port *); + void (*init_termios)(struct tty_struct *); + void (*read_int_callback)(struct urb *); + void (*write_int_callback)(struct urb *); + void (*read_bulk_callback)(struct urb *); + void (*write_bulk_callback)(struct urb *); + void (*process_read_urb)(struct urb *); + int (*prepare_write_buffer)(struct usb_serial_port *, void *, size_t); +}; + +struct usb_serial_endpoints { + unsigned char num_bulk_in; + unsigned char num_bulk_out; + unsigned char num_interrupt_in; + unsigned char num_interrupt_out; + struct usb_endpoint_descriptor *bulk_in[16]; + struct usb_endpoint_descriptor *bulk_out[16]; + struct usb_endpoint_descriptor *interrupt_in[16]; + struct usb_endpoint_descriptor *interrupt_out[16]; +}; + +struct usbcons_info { + int magic; + int break_flag; + struct usb_serial_port *port; +}; + +struct usb_debug_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __u8 bDebugInEndpoint; + __u8 bDebugOutEndpoint; +}; + +struct ehci_dev { + u32 bus; + u32 slot; + u32 func; +}; + +typedef void (*set_debug_port_t)(int); + +struct usb_hcd___2; + +struct xdbc_regs { + __le32 capability; + __le32 doorbell; + __le32 ersts; + __le32 __reserved_0; + __le64 erstba; + __le64 erdp; + __le32 control; + __le32 status; + __le32 portsc; + __le32 __reserved_1; + __le64 dccp; + __le32 devinfo1; + __le32 devinfo2; +}; + +struct xdbc_trb { + __le32 field[4]; +}; + +struct xdbc_erst_entry { + __le64 seg_addr; + __le32 seg_size; + __le32 __reserved_0; +}; + +struct xdbc_info_context { + __le64 string0; + __le64 manufacturer; + __le64 product; + __le64 serial; + __le32 length; + __le32 __reserved_0[7]; +}; + +struct xdbc_ep_context { + __le32 ep_info1; + __le32 ep_info2; + __le64 deq; + __le32 tx_info; + __le32 __reserved_0[11]; +}; + +struct xdbc_context { + struct xdbc_info_context info; + struct xdbc_ep_context out; + struct xdbc_ep_context in; +}; + +struct xdbc_strings { + char string0[64]; + char manufacturer[64]; + char product[64]; + char serial[64]; +}; + +struct xdbc_segment { + struct xdbc_trb *trbs; + dma_addr_t dma; +}; + +struct xdbc_ring { + struct xdbc_segment *segment; + struct xdbc_trb *enqueue; + struct xdbc_trb *dequeue; + u32 cycle_state; +}; + +struct xdbc_state { + u16 vendor; + u16 device; + u32 bus; + u32 dev; + u32 func; + void *xhci_base; + u64 xhci_start; + size_t xhci_length; + int port_number; + struct xdbc_regs *xdbc_reg; + dma_addr_t table_dma; + void *table_base; + dma_addr_t erst_dma; + size_t erst_size; + void *erst_base; + struct xdbc_ring evt_ring; + struct xdbc_segment evt_seg; + dma_addr_t dbcc_dma; + size_t dbcc_size; + void *dbcc_base; + dma_addr_t string_dma; + size_t string_size; + void *string_base; + struct xdbc_ring out_ring; + struct xdbc_segment out_seg; + void *out_buf; + dma_addr_t out_dma; + struct xdbc_ring in_ring; + struct xdbc_segment in_seg; + void *in_buf; + dma_addr_t in_dma; + u32 flags; + raw_spinlock_t lock; +}; + +struct serio_device_id { + __u8 type; + __u8 extra; + __u8 id; + __u8 proto; +}; + +struct serio_driver; + +struct serio { + void *port_data; + char name[32]; + char phys[32]; + char firmware_id[128]; + bool manual_bind; + struct serio_device_id id; + spinlock_t lock; + int (*write)(struct serio *, unsigned char); + int (*open)(struct serio *); + void (*close)(struct serio *); + int (*start)(struct serio *); + void (*stop)(struct serio *); + struct serio *parent; + struct list_head child_node; + struct list_head children; + unsigned int depth; + struct serio_driver *drv; + struct mutex drv_mutex; + struct device dev; + struct list_head node; + struct mutex *ps2_cmd_mutex; +}; + +struct serio_driver { + const char *description; + const struct serio_device_id *id_table; + bool manual_bind; + void (*write_wakeup)(struct serio *); + irqreturn_t (*interrupt)(struct serio *, unsigned char, unsigned int); + int (*connect)(struct serio *, struct serio_driver *); + int (*reconnect)(struct serio *); + int (*fast_reconnect)(struct serio *); + void (*disconnect)(struct serio *); + void (*cleanup)(struct serio *); + struct device_driver driver; +}; + +enum serio_event_type { + SERIO_RESCAN_PORT = 0, + SERIO_RECONNECT_PORT = 1, + SERIO_RECONNECT_SUBTREE = 2, + SERIO_REGISTER_PORT = 3, + SERIO_ATTACH_DRIVER = 4, +}; + +struct serio_event { + enum serio_event_type type; + void *object; + struct module *owner; + struct list_head node; +}; + +enum i8042_controller_reset_mode { + I8042_RESET_NEVER = 0, + I8042_RESET_ALWAYS = 1, + I8042_RESET_ON_S2RAM = 2, +}; + +struct i8042_port { + struct serio *serio; + int irq; + bool exists; + bool driver_bound; + signed char mux; +}; + +struct serport___2 { + struct tty_struct *tty; + wait_queue_head_t wait; + struct serio *serio; + struct serio_device_id id; + spinlock_t lock; + long unsigned int flags; +}; + +struct ps2dev { + struct serio *serio; + struct mutex cmd_mutex; + wait_queue_head_t wait; + long unsigned int flags; + u8 cmdbuf[8]; + u8 cmdcnt; + u8 nak; +}; + +struct input_mt_slot { + int abs[14]; + unsigned int frame; + unsigned int key; +}; + +struct input_mt { + int trkid; + int num_slots; + int slot; + unsigned int flags; + unsigned int frame; + int *red; + struct input_mt_slot slots[0]; +}; + +union input_seq_state { + struct { + short unsigned int pos; + bool mutex_acquired; + }; + void *p; +}; + +struct input_devres { + struct input_dev *input; +}; + +struct input_event { + __kernel_ulong_t __sec; + __kernel_ulong_t __usec; + __u16 type; + __u16 code; + __s32 value; +}; + +struct input_event_compat { + compat_ulong_t sec; + compat_ulong_t usec; + __u16 type; + __u16 code; + __s32 value; +}; + +struct ff_periodic_effect_compat { + __u16 waveform; + __u16 period; + __s16 magnitude; + __s16 offset; + __u16 phase; + struct ff_envelope envelope; + __u32 custom_len; + compat_uptr_t custom_data; +}; + +struct ff_effect_compat { + __u16 type; + __s16 id; + __u16 direction; + struct ff_trigger trigger; + struct ff_replay replay; + union { + struct ff_constant_effect constant; + struct ff_ramp_effect ramp; + struct ff_periodic_effect_compat periodic; + struct ff_condition_effect condition[2]; + struct ff_rumble_effect rumble; + } u; +}; + +struct input_mt_pos { + s16 x; + s16 y; +}; + +struct input_dev_poller { + void (*poll)(struct input_dev *); + unsigned int poll_interval; + unsigned int poll_interval_max; + unsigned int poll_interval_min; + struct input_dev *input; + struct delayed_work work; +}; + +struct led_init_data { + struct fwnode_handle *fwnode; + const char *default_label; + const char *devicename; + bool devname_mandatory; +}; + +struct input_led { + struct led_classdev cdev; + struct input_handle *handle; + unsigned int code; +}; + +struct input_leds { + struct input_handle handle; + unsigned int num_leds; + struct input_led leds[0]; +}; + +struct mousedev_hw_data { + int dx; + int dy; + int dz; + int x; + int y; + int abs_event; + long unsigned int buttons; +}; + +struct mousedev { + int open; + struct input_handle handle; + wait_queue_head_t wait; + struct list_head client_list; + spinlock_t client_lock; + struct mutex mutex; + struct device dev; + struct cdev cdev; + bool exist; + struct list_head mixdev_node; + bool opened_by_mixdev; + struct mousedev_hw_data packet; + unsigned int pkt_count; + int old_x[4]; + int old_y[4]; + int frac_dx; + int frac_dy; + long unsigned int touch; + int (*open_device)(struct mousedev *); + void (*close_device)(struct mousedev *); +}; + +enum mousedev_emul { + MOUSEDEV_EMUL_PS2 = 0, + MOUSEDEV_EMUL_IMPS = 1, + MOUSEDEV_EMUL_EXPS = 2, +}; + +struct mousedev_motion { + int dx; + int dy; + int dz; + long unsigned int buttons; +}; + +struct mousedev_client { + struct fasync_struct *fasync; + struct mousedev *mousedev; + struct list_head node; + struct mousedev_motion packets[16]; + unsigned int head; + unsigned int tail; + spinlock_t packet_lock; + int pos_x; + int pos_y; + u8 ps2[6]; + unsigned char ready; + unsigned char buffer; + unsigned char bufsiz; + unsigned char imexseq; + unsigned char impsseq; + enum mousedev_emul mode; + long unsigned int last_buttons; +}; + +enum { + FRACTION_DENOM = 128, +}; + +struct input_mask { + __u32 type; + __u32 codes_size; + __u64 codes_ptr; +}; + +struct evdev_client; + +struct evdev { + int open; + struct input_handle handle; + struct evdev_client *grab; + struct list_head client_list; + spinlock_t client_lock; + struct mutex mutex; + struct device dev; + struct cdev cdev; + bool exist; +}; + +struct evdev_client { + unsigned int head; + unsigned int tail; + unsigned int packet_head; + spinlock_t buffer_lock; + wait_queue_head_t wait; + struct fasync_struct *fasync; + struct evdev *evdev; + struct list_head node; + enum input_clock_type clk_type; + bool revoked; + long unsigned int *evmasks[32]; + unsigned int bufsize; + struct input_event buffer[0]; +}; + +struct atkbd { + struct ps2dev ps2dev; + struct input_dev *dev; + char name[64]; + char phys[32]; + short unsigned int id; + short unsigned int keycode[512]; + long unsigned int force_release_mask[8]; + unsigned char set; + bool translated; + bool extra; + bool write; + bool softrepeat; + bool softraw; + bool scroll; + bool enabled; + unsigned char emul; + bool resend; + bool release; + long unsigned int xl_bit; + unsigned int last; + long unsigned int time; + long unsigned int err_count; + struct delayed_work event_work; + long unsigned int event_jiffies; + long unsigned int event_mask; + struct mutex mutex; + u32 function_row_physmap[24]; + int num_function_row_keys; +}; + +enum psmouse_state { + PSMOUSE_IGNORE = 0, + PSMOUSE_INITIALIZING = 1, + PSMOUSE_RESYNCING = 2, + PSMOUSE_CMD_MODE = 3, + PSMOUSE_ACTIVATED = 4, +}; + +typedef enum { + PSMOUSE_BAD_DATA = 0, + PSMOUSE_GOOD_DATA = 1, + PSMOUSE_FULL_PACKET = 2, +} psmouse_ret_t; + +enum psmouse_scale { + PSMOUSE_SCALE11 = 0, + PSMOUSE_SCALE21 = 1, +}; + +enum psmouse_type { + PSMOUSE_NONE = 0, + PSMOUSE_PS2 = 1, + PSMOUSE_PS2PP = 2, + PSMOUSE_THINKPS = 3, + PSMOUSE_GENPS = 4, + PSMOUSE_IMPS = 5, + PSMOUSE_IMEX = 6, + PSMOUSE_SYNAPTICS = 7, + PSMOUSE_ALPS = 8, + PSMOUSE_LIFEBOOK = 9, + PSMOUSE_TRACKPOINT = 10, + PSMOUSE_TOUCHKIT_PS2 = 11, + PSMOUSE_CORTRON = 12, + PSMOUSE_HGPK = 13, + PSMOUSE_ELANTECH = 14, + PSMOUSE_FSP = 15, + PSMOUSE_SYNAPTICS_RELATIVE = 16, + PSMOUSE_CYPRESS = 17, + PSMOUSE_FOCALTECH = 18, + PSMOUSE_VMMOUSE = 19, + PSMOUSE_BYD = 20, + PSMOUSE_SYNAPTICS_SMBUS = 21, + PSMOUSE_ELANTECH_SMBUS = 22, + PSMOUSE_AUTO = 23, +}; + +struct psmouse; + +struct psmouse_protocol { + enum psmouse_type type; + bool maxproto; + bool ignore_parity; + bool try_passthru; + bool smbus_companion; + const char *name; + const char *alias; + int (*detect)(struct psmouse *, bool); + int (*init)(struct psmouse *); +}; + +struct psmouse { + void *private; + struct input_dev *dev; + struct ps2dev ps2dev; + struct delayed_work resync_work; + const char *vendor; + const char *name; + const struct psmouse_protocol *protocol; + unsigned char packet[8]; + unsigned char badbyte; + unsigned char pktcnt; + unsigned char pktsize; + unsigned char oob_data_type; + unsigned char extra_buttons; + bool acks_disable_command; + unsigned int model; + long unsigned int last; + long unsigned int out_of_sync_cnt; + long unsigned int num_resyncs; + enum psmouse_state state; + char devname[64]; + char phys[32]; + unsigned int rate; + unsigned int resolution; + unsigned int resetafter; + unsigned int resync_time; + bool smartscroll; + psmouse_ret_t (*protocol_handler)(struct psmouse *); + void (*set_rate)(struct psmouse *, unsigned int); + void (*set_resolution)(struct psmouse *, unsigned int); + void (*set_scale)(struct psmouse *, enum psmouse_scale); + int (*reconnect)(struct psmouse *); + int (*fast_reconnect)(struct psmouse *); + void (*disconnect)(struct psmouse *); + void (*cleanup)(struct psmouse *); + int (*poll)(struct psmouse *); + void (*pt_activate)(struct psmouse *); + void (*pt_deactivate)(struct psmouse *); +}; + +struct psmouse_attribute { + struct device_attribute dattr; + void *data; + ssize_t (*show)(struct psmouse *, void *, char *); + ssize_t (*set)(struct psmouse *, void *, const char *, size_t); + bool protect; +}; + +struct rmi_2d_axis_alignment { + bool swap_axes; + bool flip_x; + bool flip_y; + u16 clip_x_low; + u16 clip_y_low; + u16 clip_x_high; + u16 clip_y_high; + u16 offset_x; + u16 offset_y; + u8 delta_x_threshold; + u8 delta_y_threshold; +}; + +enum rmi_sensor_type { + rmi_sensor_default = 0, + rmi_sensor_touchscreen = 1, + rmi_sensor_touchpad = 2, +}; + +struct rmi_2d_sensor_platform_data { + struct rmi_2d_axis_alignment axis_align; + enum rmi_sensor_type sensor_type; + int x_mm; + int y_mm; + int disable_report_mask; + u16 rezero_wait; + bool topbuttonpad; + bool kernel_tracking; + int dmax; + int dribble; + int palm_detect; +}; + +struct rmi_gpio_data { + bool buttonpad; + bool trackstick_buttons; + bool disable; +}; + +enum rmi_reg_state { + RMI_REG_STATE_DEFAULT = 0, + RMI_REG_STATE_OFF = 1, + RMI_REG_STATE_ON = 2, +}; + +struct rmi_f01_power_management { + enum rmi_reg_state nosleep; + u8 wakeup_threshold; + u8 doze_holdoff; + u8 doze_interval; +}; + +struct rmi_device_platform_data_spi { + u32 block_delay_us; + u32 split_read_block_delay_us; + u32 read_delay_us; + u32 write_delay_us; + u32 split_read_byte_delay_us; + u32 pre_delay_us; + u32 post_delay_us; + u8 bits_per_word; + u16 mode; + void *cs_assert_data; + int (*cs_assert)(const void *, const bool); +}; + +struct rmi_device_platform_data { + int reset_delay_ms; + int irq; + struct rmi_device_platform_data_spi spi_data; + struct rmi_2d_sensor_platform_data sensor_pdata; + struct rmi_f01_power_management power_management; + struct rmi_gpio_data gpio_data; +}; + +enum synaptics_pkt_type { + SYN_NEWABS = 0, + SYN_NEWABS_STRICT = 1, + SYN_NEWABS_RELAXED = 2, + SYN_OLDABS = 3, +}; + +struct synaptics_hw_state { + int x; + int y; + int z; + int w; + unsigned int left: 1; + unsigned int right: 1; + unsigned int middle: 1; + unsigned int up: 1; + unsigned int down: 1; + u8 ext_buttons; + s8 scroll; +}; + +struct synaptics_device_info { + u32 model_id; + u32 firmware_id; + u32 board_id; + u32 capabilities; + u32 ext_cap; + u32 ext_cap_0c; + u32 ext_cap_10; + u32 identity; + u32 x_res; + u32 y_res; + u32 x_max; + u32 y_max; + u32 x_min; + u32 y_min; +}; + +struct synaptics_data { + struct synaptics_device_info info; + enum synaptics_pkt_type pkt_type; + u8 mode; + int scroll; + bool absolute_mode; + bool disable_gesture; + struct serio *pt_port; + struct synaptics_hw_state agm; + unsigned int agm_count; + long unsigned int press_start; + bool press; + bool report_press; + bool is_forcepad; +}; + +struct min_max_quirk { + const char * const *pnp_ids; + struct { + u32 min; + u32 max; + } board_id; + u32 x_min; + u32 x_max; + u32 y_min; + u32 y_max; +}; + +enum { + SYNAPTICS_INTERTOUCH_NOT_SET = 4294967295, + SYNAPTICS_INTERTOUCH_OFF = 0, + SYNAPTICS_INTERTOUCH_ON = 1, +}; + +struct focaltech_finger_state { + bool active; + bool valid; + unsigned int x; + unsigned int y; +}; + +struct focaltech_hw_state { + struct focaltech_finger_state fingers[5]; + unsigned int width; + bool pressed; +}; + +struct focaltech_data { + unsigned int x_max; + unsigned int y_max; + struct focaltech_hw_state state; +}; + +enum SS4_PACKET_ID { + SS4_PACKET_ID_IDLE = 0, + SS4_PACKET_ID_ONE = 1, + SS4_PACKET_ID_TWO = 2, + SS4_PACKET_ID_MULTI = 3, + SS4_PACKET_ID_STICK = 4, +}; + +enum V7_PACKET_ID { + V7_PACKET_ID_IDLE = 0, + V7_PACKET_ID_TWO = 1, + V7_PACKET_ID_MULTI = 2, + V7_PACKET_ID_NEW = 3, + V7_PACKET_ID_UNKNOWN = 4, +}; + +struct alps_protocol_info { + u16 version; + u8 byte0; + u8 mask0; + unsigned int flags; +}; + +struct alps_model_info { + u8 signature[3]; + struct alps_protocol_info protocol_info; +}; + +struct alps_nibble_commands { + int command; + unsigned char data; +}; + +struct alps_bitmap_point { + int start_bit; + int num_bits; +}; + +struct alps_fields { + unsigned int x_map; + unsigned int y_map; + unsigned int fingers; + int pressure; + struct input_mt_pos st; + struct input_mt_pos mt[4]; + unsigned int first_mp: 1; + unsigned int is_mp: 1; + unsigned int left: 1; + unsigned int right: 1; + unsigned int middle: 1; + unsigned int ts_left: 1; + unsigned int ts_right: 1; + unsigned int ts_middle: 1; +}; + +struct alps_data { + struct psmouse *psmouse; + struct input_dev *dev2; + struct input_dev *dev3; + char phys2[32]; + char phys3[32]; + struct delayed_work dev3_register_work; + const struct alps_nibble_commands *nibble_commands; + int addr_command; + u16 proto_version; + u8 byte0; + u8 mask0; + u8 dev_id[3]; + u8 fw_ver[3]; + int flags; + int x_max; + int y_max; + int x_bits; + int y_bits; + unsigned int x_res; + unsigned int y_res; + int (*hw_init)(struct psmouse *); + void (*process_packet)(struct psmouse *); + int (*decode_fields)(struct alps_fields *, unsigned char *, struct psmouse *); + void (*set_abs_params)(struct alps_data *, struct input_dev *); + int prev_fin; + int multi_packet; + int second_touch; + unsigned char multi_data[6]; + struct alps_fields f; + u8 quirks; + struct timer_list timer; +}; + +struct byd_data { + struct timer_list timer; + struct psmouse *psmouse; + s32 abs_x; + s32 abs_y; + volatile long unsigned int last_touch_time; + bool btn_left; + bool btn_right; + bool touch; +}; + +struct finger_pos { + unsigned int x; + unsigned int y; +}; + +struct elantech_device_info { + unsigned char capabilities[3]; + unsigned char samples[3]; + unsigned char debug; + unsigned char hw_version; + unsigned char pattern; + unsigned int fw_version; + unsigned int ic_version; + unsigned int product_id; + unsigned int x_min; + unsigned int y_min; + unsigned int x_max; + unsigned int y_max; + unsigned int x_res; + unsigned int y_res; + unsigned int x_traces; + unsigned int y_traces; + unsigned int width; + unsigned int bus; + bool paritycheck; + bool jumpy_cursor; + bool reports_pressure; + bool crc_enabled; + bool set_hw_resolution; + bool has_trackpoint; + bool has_middle_button; + int (*send_cmd)(struct psmouse *, unsigned char, unsigned char *); +}; + +struct elantech_data { + struct input_dev *tp_dev; + char tp_phys[32]; + unsigned char reg_07; + unsigned char reg_10; + unsigned char reg_11; + unsigned char reg_20; + unsigned char reg_21; + unsigned char reg_22; + unsigned char reg_23; + unsigned char reg_24; + unsigned char reg_25; + unsigned char reg_26; + unsigned int single_finger_reports; + unsigned int y_max; + unsigned int width; + struct finger_pos mt[5]; + unsigned char parity[256]; + struct elantech_device_info info; + void (*original_set_rate)(struct psmouse *, unsigned int); +}; + +struct elantech_attr_data { + size_t field_offset; + unsigned char reg; +}; + +enum { + ELANTECH_SMBUS_NOT_SET = 4294967295, + ELANTECH_SMBUS_OFF = 0, + ELANTECH_SMBUS_ON = 1, +}; + +struct ps2pp_info { + u8 model; + u8 kind; + u16 features; +}; + +struct lifebook_data { + struct input_dev *dev2; + char phys[32]; +}; + +struct fsp_data { + unsigned char ver; + unsigned char rev; + unsigned int buttons; + unsigned int flags; + bool vscroll; + bool hscroll; + unsigned char last_reg; + unsigned char last_val; + unsigned int last_mt_fgr; +}; + +struct trackpoint_data { + u8 variant_id; + u8 firmware_id; + u8 sensitivity; + u8 speed; + u8 inertia; + u8 reach; + u8 draghys; + u8 mindrag; + u8 thresh; + u8 upthresh; + u8 ztime; + u8 jenks; + u8 drift_time; + bool press_to_select; + bool skipback; + bool ext_dev; +}; + +struct trackpoint_attr_data { + size_t field_offset; + u8 command; + u8 mask; + bool inverted; + u8 power_on_default; +}; + +struct cytp_contact { + int x; + int y; + int z; +}; + +struct cytp_report_data { + int contact_cnt; + struct cytp_contact contacts[2]; + unsigned int left: 1; + unsigned int right: 1; + unsigned int middle: 1; + unsigned int tap: 1; +}; + +struct cytp_data { + int fw_version; + int pkt_size; + int mode; + int tp_min_pressure; + int tp_max_pressure; + int tp_width; + int tp_high; + int tp_max_abs_x; + int tp_max_abs_y; + int tp_res_x; + int tp_res_y; + int tp_metrics_supported; +}; + +struct vmmouse_data { + struct input_dev *abs_dev; + char phys[32]; + char dev_name[128]; +}; + +struct psmouse_smbus_dev { + struct i2c_board_info board; + struct psmouse *psmouse; + struct i2c_client *client; + struct list_head node; + bool dead; + bool need_deactivate; +}; + +struct psmouse_smbus_removal_work { + struct work_struct work; + struct i2c_client *client; +}; + +struct touchscreen_properties { + unsigned int max_x; + unsigned int max_y; + bool invert_x; + bool invert_y; + bool swap_x_y; +}; + +struct trace_event_raw_rtc_time_alarm_class { + struct trace_entry ent; + time64_t secs; + int err; + char __data[0]; +}; + +struct trace_event_raw_rtc_irq_set_freq { + struct trace_entry ent; + int freq; + int err; + char __data[0]; +}; + +struct trace_event_raw_rtc_irq_set_state { + struct trace_entry ent; + int enabled; + int err; + char __data[0]; +}; + +struct trace_event_raw_rtc_alarm_irq_enable { + struct trace_entry ent; + unsigned int enabled; + int err; + char __data[0]; +}; + +struct trace_event_raw_rtc_offset_class { + struct trace_entry ent; + long int offset; + int err; + char __data[0]; +}; + +struct trace_event_raw_rtc_timer_class { + struct trace_entry ent; + struct rtc_timer *timer; + ktime_t expires; + ktime_t period; + char __data[0]; +}; + +struct trace_event_data_offsets_rtc_time_alarm_class {}; + +struct trace_event_data_offsets_rtc_irq_set_freq {}; + +struct trace_event_data_offsets_rtc_irq_set_state {}; + +struct trace_event_data_offsets_rtc_alarm_irq_enable {}; + +struct trace_event_data_offsets_rtc_offset_class {}; + +struct trace_event_data_offsets_rtc_timer_class {}; + +typedef void (*btf_trace_rtc_set_time)(void *, time64_t, int); + +typedef void (*btf_trace_rtc_read_time)(void *, time64_t, int); + +typedef void (*btf_trace_rtc_set_alarm)(void *, time64_t, int); + +typedef void (*btf_trace_rtc_read_alarm)(void *, time64_t, int); + +typedef void (*btf_trace_rtc_irq_set_freq)(void *, int, int); + +typedef void (*btf_trace_rtc_irq_set_state)(void *, int, int); + +typedef void (*btf_trace_rtc_alarm_irq_enable)(void *, unsigned int, int); + +typedef void (*btf_trace_rtc_set_offset)(void *, long int, int); + +typedef void (*btf_trace_rtc_read_offset)(void *, long int, int); + +typedef void (*btf_trace_rtc_timer_enqueue)(void *, struct rtc_timer *); + +typedef void (*btf_trace_rtc_timer_dequeue)(void *, struct rtc_timer *); + +typedef void (*btf_trace_rtc_timer_fired)(void *, struct rtc_timer *); + +enum { + none = 0, + day = 1, + month = 2, + year = 3, +}; + +struct nvmem_cell_info { + const char *name; + unsigned int offset; + unsigned int bytes; + unsigned int bit_offset; + unsigned int nbits; +}; + +typedef int (*nvmem_reg_read_t)(void *, unsigned int, void *, size_t); + +typedef int (*nvmem_reg_write_t)(void *, unsigned int, void *, size_t); + +enum nvmem_type { + NVMEM_TYPE_UNKNOWN = 0, + NVMEM_TYPE_EEPROM = 1, + NVMEM_TYPE_OTP = 2, + NVMEM_TYPE_BATTERY_BACKED = 3, +}; + +struct nvmem_keepout { + unsigned int start; + unsigned int end; + unsigned char value; +}; + +struct nvmem_config { + struct device *dev; + const char *name; + int id; + struct module *owner; + struct gpio_desc___2 *wp_gpio; + const struct nvmem_cell_info *cells; + int ncells; + const struct nvmem_keepout *keepout; + unsigned int nkeepout; + enum nvmem_type type; + bool read_only; + bool root_only; + bool no_of_node; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; + int size; + int word_size; + int stride; + void *priv; + bool compat; + struct device *base_dev; +}; + +struct nvmem_device; + +struct cmos_rtc_board_info { + void (*wake_on)(struct device *); + void (*wake_off)(struct device *); + u32 flags; + int address_space; + u8 rtc_day_alarm; + u8 rtc_mon_alarm; + u8 rtc_century; +}; + +struct cmos_rtc { + struct rtc_device *rtc; + struct device *dev; + int irq; + struct resource *iomem; + time64_t alarm_expires; + void (*wake_on)(struct device *); + void (*wake_off)(struct device *); + u8 enabled_wake; + u8 suspend_ctrl; + u8 day_alrm; + u8 mon_alrm; + u8 century; + struct rtc_wkalrm saved_wkalrm; +}; + +struct i2c_devinfo { + struct list_head list; + int busnum; + struct i2c_board_info board_info; +}; + +struct i2c_device_identity { + u16 manufacturer_id; + u16 part_id; + u8 die_revision; +}; + +struct i2c_timings { + u32 bus_freq_hz; + u32 scl_rise_ns; + u32 scl_fall_ns; + u32 scl_int_delay_ns; + u32 sda_fall_ns; + u32 sda_hold_ns; + u32 digital_filter_width_ns; + u32 analog_filter_cutoff_freq_hz; +}; + +struct trace_event_raw_i2c_write { + struct trace_entry ent; + int adapter_nr; + __u16 msg_nr; + __u16 addr; + __u16 flags; + __u16 len; + u32 __data_loc_buf; + char __data[0]; +}; + +struct trace_event_raw_i2c_read { + struct trace_entry ent; + int adapter_nr; + __u16 msg_nr; + __u16 addr; + __u16 flags; + __u16 len; + char __data[0]; +}; + +struct trace_event_raw_i2c_reply { + struct trace_entry ent; + int adapter_nr; + __u16 msg_nr; + __u16 addr; + __u16 flags; + __u16 len; + u32 __data_loc_buf; + char __data[0]; +}; + +struct trace_event_raw_i2c_result { + struct trace_entry ent; + int adapter_nr; + __u16 nr_msgs; + __s16 ret; + char __data[0]; +}; + +struct trace_event_data_offsets_i2c_write { + u32 buf; +}; + +struct trace_event_data_offsets_i2c_read {}; + +struct trace_event_data_offsets_i2c_reply { + u32 buf; +}; + +struct trace_event_data_offsets_i2c_result {}; + +typedef void (*btf_trace_i2c_write)(void *, const struct i2c_adapter *, const struct i2c_msg *, int); + +typedef void (*btf_trace_i2c_read)(void *, const struct i2c_adapter *, const struct i2c_msg *, int); + +typedef void (*btf_trace_i2c_reply)(void *, const struct i2c_adapter *, const struct i2c_msg *, int); + +typedef void (*btf_trace_i2c_result)(void *, const struct i2c_adapter *, int, int); + +struct i2c_dummy_devres { + struct i2c_client *client; +}; + +struct class_compat___2; + +struct i2c_cmd_arg { + unsigned int cmd; + void *arg; +}; + +struct i2c_smbus_alert_setup { + int irq; +}; + +struct trace_event_raw_smbus_write { + struct trace_entry ent; + int adapter_nr; + __u16 addr; + __u16 flags; + __u8 command; + __u8 len; + __u32 protocol; + __u8 buf[34]; + char __data[0]; +}; + +struct trace_event_raw_smbus_read { + struct trace_entry ent; + int adapter_nr; + __u16 flags; + __u16 addr; + __u8 command; + __u32 protocol; + __u8 buf[34]; + char __data[0]; +}; + +struct trace_event_raw_smbus_reply { + struct trace_entry ent; + int adapter_nr; + __u16 addr; + __u16 flags; + __u8 command; + __u8 len; + __u32 protocol; + __u8 buf[34]; + char __data[0]; +}; + +struct trace_event_raw_smbus_result { + struct trace_entry ent; + int adapter_nr; + __u16 addr; + __u16 flags; + __u8 read_write; + __u8 command; + __s16 res; + __u32 protocol; + char __data[0]; +}; + +struct trace_event_data_offsets_smbus_write {}; + +struct trace_event_data_offsets_smbus_read {}; + +struct trace_event_data_offsets_smbus_reply {}; + +struct trace_event_data_offsets_smbus_result {}; + +typedef void (*btf_trace_smbus_write)(void *, const struct i2c_adapter *, u16, short unsigned int, char, u8, int, const union i2c_smbus_data *); + +typedef void (*btf_trace_smbus_read)(void *, const struct i2c_adapter *, u16, short unsigned int, char, u8, int); + +typedef void (*btf_trace_smbus_reply)(void *, const struct i2c_adapter *, u16, short unsigned int, char, u8, int, const union i2c_smbus_data *, int); + +typedef void (*btf_trace_smbus_result)(void *, const struct i2c_adapter *, u16, short unsigned int, char, u8, int, int); + +struct i2c_acpi_handler_data { + struct acpi_connection_info info; + struct i2c_adapter *adapter; +}; + +struct gsb_buffer { + u8 status; + u8 len; + union { + u16 wdata; + u8 bdata; + u8 data[0]; + }; +}; + +struct i2c_acpi_lookup { + struct i2c_board_info *info; + acpi_handle adapter_handle; + acpi_handle device_handle; + acpi_handle search_handle; + int n; + int index; + u32 speed; + u32 min_speed; + u32 force_speed; +}; + +struct dw_i2c_dev { + struct device *dev; + struct regmap *map; + struct regmap *sysmap; + void *base; + void *ext; + struct completion cmd_complete; + struct clk *clk; + struct clk *pclk; + struct reset_control___2 *rst; + struct i2c_client *slave; + u32 (*get_clk_rate_khz)(struct dw_i2c_dev *); + int cmd_err; + struct i2c_msg *msgs; + int msgs_num; + int msg_write_idx; + u32 tx_buf_len; + u8 *tx_buf; + int msg_read_idx; + u32 rx_buf_len; + u8 *rx_buf; + int msg_err; + unsigned int status; + u32 abort_source; + int irq; + u32 flags; + struct i2c_adapter adapter; + u32 functionality; + u32 master_cfg; + u32 slave_cfg; + unsigned int tx_fifo_depth; + unsigned int rx_fifo_depth; + int rx_outstanding; + struct i2c_timings timings; + u32 sda_hold_time; + u16 ss_hcnt; + u16 ss_lcnt; + u16 fs_hcnt; + u16 fs_lcnt; + u16 fp_hcnt; + u16 fp_lcnt; + u16 hs_hcnt; + u16 hs_lcnt; + int (*acquire_lock)(); + void (*release_lock)(); + bool shared_with_punit; + void (*disable)(struct dw_i2c_dev *); + void (*disable_int)(struct dw_i2c_dev *); + int (*init)(struct dw_i2c_dev *); + int (*set_sda_hold_time)(struct dw_i2c_dev *); + int mode; + struct i2c_bus_recovery_info rinfo; + bool suspended; +}; + +struct dw_i2c_platform_data { + unsigned int i2c_scl_freq; +}; + +enum dw_pci_ctl_id_t { + medfield = 0, + merrifield = 1, + baytrail = 2, + cherrytrail = 3, + haswell = 4, + elkhartlake = 5, +}; + +struct dw_scl_sda_cfg { + u32 ss_hcnt; + u32 fs_hcnt; + u32 ss_lcnt; + u32 fs_lcnt; + u32 sda_hold; +}; + +struct dw_pci_controller { + u32 bus_num; + u32 flags; + struct dw_scl_sda_cfg *scl_sda_cfg; + int (*setup)(struct pci_dev *, struct dw_pci_controller *); + u32 (*get_clk_rate_khz)(struct dw_i2c_dev *); +}; + +struct lirc_scancode { + __u64 timestamp; + __u16 flags; + __u16 rc_proto; + __u32 keycode; + __u64 scancode; +}; + +enum rc_proto { + RC_PROTO_UNKNOWN = 0, + RC_PROTO_OTHER = 1, + RC_PROTO_RC5 = 2, + RC_PROTO_RC5X_20 = 3, + RC_PROTO_RC5_SZ = 4, + RC_PROTO_JVC = 5, + RC_PROTO_SONY12 = 6, + RC_PROTO_SONY15 = 7, + RC_PROTO_SONY20 = 8, + RC_PROTO_NEC = 9, + RC_PROTO_NECX = 10, + RC_PROTO_NEC32 = 11, + RC_PROTO_SANYO = 12, + RC_PROTO_MCIR2_KBD = 13, + RC_PROTO_MCIR2_MSE = 14, + RC_PROTO_RC6_0 = 15, + RC_PROTO_RC6_6A_20 = 16, + RC_PROTO_RC6_6A_24 = 17, + RC_PROTO_RC6_6A_32 = 18, + RC_PROTO_RC6_MCE = 19, + RC_PROTO_SHARP = 20, + RC_PROTO_XMP = 21, + RC_PROTO_CEC = 22, + RC_PROTO_IMON = 23, + RC_PROTO_RCMM12 = 24, + RC_PROTO_RCMM24 = 25, + RC_PROTO_RCMM32 = 26, + RC_PROTO_XBOX_DVD = 27, + RC_PROTO_MAX = 27, +}; + +struct rc_map_table { + u64 scancode; + u32 keycode; +}; + +struct rc_map { + struct rc_map_table *scan; + unsigned int size; + unsigned int len; + unsigned int alloc; + enum rc_proto rc_proto; + const char *name; + spinlock_t lock; +}; + +struct rc_map_list { + struct list_head list; + struct rc_map map; +}; + +enum rc_driver_type { + RC_DRIVER_SCANCODE = 0, + RC_DRIVER_IR_RAW = 1, + RC_DRIVER_IR_RAW_TX = 2, +}; + +struct rc_scancode_filter { + u32 data; + u32 mask; +}; + +enum rc_filter_type { + RC_FILTER_NORMAL = 0, + RC_FILTER_WAKEUP = 1, + RC_FILTER_MAX = 2, +}; + +struct ir_raw_event_ctrl; + +struct rc_dev { + struct device dev; + bool managed_alloc; + const struct attribute_group *sysfs_groups[5]; + const char *device_name; + const char *input_phys; + struct input_id input_id; + const char *driver_name; + const char *map_name; + struct rc_map rc_map; + struct mutex lock; + unsigned int minor; + struct ir_raw_event_ctrl *raw; + struct input_dev *input_dev; + enum rc_driver_type driver_type; + bool idle; + bool encode_wakeup; + u64 allowed_protocols; + u64 enabled_protocols; + u64 allowed_wakeup_protocols; + enum rc_proto wakeup_protocol; + struct rc_scancode_filter scancode_filter; + struct rc_scancode_filter scancode_wakeup_filter; + u32 scancode_mask; + u32 users; + void *priv; + spinlock_t keylock; + bool keypressed; + long unsigned int keyup_jiffies; + struct timer_list timer_keyup; + struct timer_list timer_repeat; + u32 last_keycode; + enum rc_proto last_protocol; + u64 last_scancode; + u8 last_toggle; + u32 timeout; + u32 min_timeout; + u32 max_timeout; + u32 rx_resolution; + u32 tx_resolution; + struct device lirc_dev; + struct cdev lirc_cdev; + ktime_t gap_start; + u64 gap_duration; + bool gap; + spinlock_t lirc_fh_lock; + struct list_head lirc_fh; + bool registered; + int (*change_protocol)(struct rc_dev *, u64 *); + int (*open)(struct rc_dev *); + void (*close)(struct rc_dev *); + int (*s_tx_mask)(struct rc_dev *, u32); + int (*s_tx_carrier)(struct rc_dev *, u32); + int (*s_tx_duty_cycle)(struct rc_dev *, u32); + int (*s_rx_carrier_range)(struct rc_dev *, u32, u32); + int (*tx_ir)(struct rc_dev *, unsigned int *, unsigned int); + void (*s_idle)(struct rc_dev *, bool); + int (*s_learning_mode)(struct rc_dev *, int); + int (*s_carrier_report)(struct rc_dev *, int); + int (*s_filter)(struct rc_dev *, struct rc_scancode_filter *); + int (*s_wakeup_filter)(struct rc_dev *, struct rc_scancode_filter *); + int (*s_timeout)(struct rc_dev *, unsigned int); +}; + +struct ir_raw_event { + union { + u32 duration; + u32 carrier; + }; + u8 duty_cycle; + unsigned int pulse: 1; + unsigned int reset: 1; + unsigned int timeout: 1; + unsigned int carrier_report: 1; +}; + +struct nec_dec { + int state; + unsigned int count; + u32 bits; + bool is_nec_x; + bool necx_repeat; +}; + +struct rc5_dec { + int state; + u32 bits; + unsigned int count; + bool is_rc5x; +}; + +struct rc6_dec { + int state; + u8 header; + u32 body; + bool toggle; + unsigned int count; + unsigned int wanted_bits; +}; + +struct sony_dec { + int state; + u32 bits; + unsigned int count; +}; + +struct jvc_dec { + int state; + u16 bits; + u16 old_bits; + unsigned int count; + bool first; + bool toggle; +}; + +struct sanyo_dec { + int state; + unsigned int count; + u64 bits; +}; + +struct sharp_dec { + int state; + unsigned int count; + u32 bits; + unsigned int pulse_len; +}; + +struct mce_kbd_dec { + spinlock_t keylock; + struct timer_list rx_timeout; + int state; + u8 header; + u32 body; + unsigned int count; + unsigned int wanted_bits; +}; + +struct xmp_dec { + int state; + unsigned int count; + u32 durations[16]; +}; + +struct imon_dec { + int state; + int count; + int last_chk; + unsigned int bits; + bool stick_keyboard; +}; + +struct rcmm_dec { + int state; + unsigned int count; + u32 bits; +}; + +struct ir_raw_event_ctrl { + struct list_head list; + struct task_struct *thread; + struct { + union { + struct __kfifo kfifo; + struct ir_raw_event *type; + const struct ir_raw_event *const_type; + char (*rectype)[0]; + struct ir_raw_event *ptr; + const struct ir_raw_event *ptr_const; + }; + struct ir_raw_event buf[512]; + } kfifo; + ktime_t last_event; + struct rc_dev *dev; + spinlock_t edge_spinlock; + struct timer_list edge_handle; + struct ir_raw_event prev_ev; + struct ir_raw_event this_ev; + u32 bpf_sample; + struct bpf_prog_array *progs; + struct nec_dec nec; + struct rc5_dec rc5; + struct rc6_dec rc6; + struct sony_dec sony; + struct jvc_dec jvc; + struct sanyo_dec sanyo; + struct sharp_dec sharp; + struct mce_kbd_dec mce_kbd; + struct xmp_dec xmp; + struct imon_dec imon; + struct rcmm_dec rcmm; +}; + +struct rc_filter_attribute { + struct device_attribute attr; + enum rc_filter_type type; + bool mask; +}; + +struct ir_raw_handler { + struct list_head list; + u64 protocols; + int (*decode)(struct rc_dev *, struct ir_raw_event); + int (*encode)(enum rc_proto, u32, struct ir_raw_event *, unsigned int); + u32 carrier; + u32 min_timeout; + int (*raw_register)(struct rc_dev *); + int (*raw_unregister)(struct rc_dev *); +}; + +struct ir_raw_timings_manchester { + unsigned int leader_pulse; + unsigned int leader_space; + unsigned int clock; + unsigned int invert: 1; + unsigned int trailer_space; +}; + +struct ir_raw_timings_pd { + unsigned int header_pulse; + unsigned int header_space; + unsigned int bit_pulse; + unsigned int bit_space[2]; + unsigned int trailer_pulse; + unsigned int trailer_space; + unsigned int msb_first: 1; +}; + +struct ir_raw_timings_pl { + unsigned int header_pulse; + unsigned int bit_space; + unsigned int bit_pulse[2]; + unsigned int trailer_space; + unsigned int msb_first: 1; +}; + +struct lirc_fh { + struct list_head list; + struct rc_dev *rc; + int carrier_low; + bool send_timeout_reports; + struct { + union { + struct __kfifo kfifo; + unsigned int *type; + const unsigned int *const_type; + char (*rectype)[0]; + unsigned int *ptr; + const unsigned int *ptr_const; + }; + unsigned int buf[0]; + } rawir; + struct { + union { + struct __kfifo kfifo; + struct lirc_scancode *type; + const struct lirc_scancode *const_type; + char (*rectype)[0]; + struct lirc_scancode *ptr; + const struct lirc_scancode *ptr_const; + }; + struct lirc_scancode buf[0]; + } scancodes; + wait_queue_head_t wait_poll; + u8 send_mode; + u8 rec_mode; +}; + +typedef u64 (*btf_bpf_rc_repeat)(u32 *); + +typedef u64 (*btf_bpf_rc_keydown)(u32 *, u32, u64, u32); + +typedef u64 (*btf_bpf_rc_pointer_rel)(u32 *, s32, s32); + +struct pps_ktime { + __s64 sec; + __s32 nsec; + __u32 flags; +}; + +struct pps_ktime_compat { + __s64 sec; + __s32 nsec; + __u32 flags; +}; + +struct pps_kinfo { + __u32 assert_sequence; + __u32 clear_sequence; + struct pps_ktime assert_tu; + struct pps_ktime clear_tu; + int current_mode; +}; + +struct pps_kinfo_compat { + __u32 assert_sequence; + __u32 clear_sequence; + struct pps_ktime_compat assert_tu; + struct pps_ktime_compat clear_tu; + int current_mode; +} __attribute__((packed)); + +struct pps_kparams { + int api_version; + int mode; + struct pps_ktime assert_off_tu; + struct pps_ktime clear_off_tu; +}; + +struct pps_fdata { + struct pps_kinfo info; + struct pps_ktime timeout; +}; + +struct pps_fdata_compat { + struct pps_kinfo_compat info; + struct pps_ktime_compat timeout; +} __attribute__((packed)); + +struct pps_bind_args { + int tsformat; + int edge; + int consumer; +}; + +struct pps_device; + +struct pps_source_info { + char name[32]; + char path[32]; + int mode; + void (*echo)(struct pps_device *, int, void *); + struct module *owner; + struct device *dev; +}; + +struct pps_device { + struct pps_source_info info; + struct pps_kparams params; + __u32 assert_sequence; + __u32 clear_sequence; + struct pps_ktime assert_tu; + struct pps_ktime clear_tu; + int current_mode; + unsigned int last_ev; + wait_queue_head_t queue; + unsigned int id; + const void *lookup_cookie; + struct cdev cdev; + struct device *dev; + struct fasync_struct *async_queue; + spinlock_t lock; +}; + +struct pps_event_time { + struct timespec64 ts_real; +}; + +struct ptp_clock_time { + __s64 sec; + __u32 nsec; + __u32 reserved; +}; + +struct ptp_extts_request { + unsigned int index; + unsigned int flags; + unsigned int rsv[2]; +}; + +struct ptp_perout_request { + union { + struct ptp_clock_time start; + struct ptp_clock_time phase; + }; + struct ptp_clock_time period; + unsigned int index; + unsigned int flags; + union { + struct ptp_clock_time on; + unsigned int rsv[4]; + }; +}; + +enum ptp_pin_function { + PTP_PF_NONE = 0, + PTP_PF_EXTTS = 1, + PTP_PF_PEROUT = 2, + PTP_PF_PHYSYNC = 3, +}; + +struct ptp_pin_desc { + char name[64]; + unsigned int index; + unsigned int func; + unsigned int chan; + unsigned int rsv[5]; +}; + +struct ptp_extts_event { + struct ptp_clock_time t; + unsigned int index; + unsigned int flags; + unsigned int rsv[2]; +}; + +struct ptp_clock_request { + enum { + PTP_CLK_REQ_EXTTS = 0, + PTP_CLK_REQ_PEROUT = 1, + PTP_CLK_REQ_PPS = 2, + } type; + union { + struct ptp_extts_request extts; + struct ptp_perout_request perout; + }; +}; + +struct ptp_clock_info { + struct module *owner; + char name[16]; + s32 max_adj; + int n_alarm; + int n_ext_ts; + int n_per_out; + int n_pins; + int pps; + struct ptp_pin_desc *pin_config; + int (*adjfine)(struct ptp_clock_info *, long int); + int (*adjfreq)(struct ptp_clock_info *, s32); + int (*adjphase)(struct ptp_clock_info *, s32); + int (*adjtime)(struct ptp_clock_info *, s64); + int (*gettime64)(struct ptp_clock_info *, struct timespec64 *); + int (*gettimex64)(struct ptp_clock_info *, struct timespec64 *, struct ptp_system_timestamp *); + int (*getcrosststamp)(struct ptp_clock_info *, struct system_device_crosststamp *); + int (*settime64)(struct ptp_clock_info *, const struct timespec64 *); + int (*enable)(struct ptp_clock_info *, struct ptp_clock_request *, int); + int (*verify)(struct ptp_clock_info *, unsigned int, enum ptp_pin_function, unsigned int); + long int (*do_aux_work)(struct ptp_clock_info *); +}; + +enum ptp_clock_events { + PTP_CLOCK_ALARM = 0, + PTP_CLOCK_EXTTS = 1, + PTP_CLOCK_PPS = 2, + PTP_CLOCK_PPSUSR = 3, +}; + +struct ptp_clock_event { + int type; + int index; + union { + u64 timestamp; + struct pps_event_time pps_times; + }; +}; + +struct timestamp_event_queue { + struct ptp_extts_event buf[128]; + int head; + int tail; + spinlock_t lock; +}; + +struct ptp_clock { + struct posix_clock clock; + struct device dev; + struct ptp_clock_info *info; + dev_t devid; + int index; + struct pps_device *pps_source; + long int dialed_frequency; + struct timestamp_event_queue tsevq; + struct mutex tsevq_mux; + struct mutex pincfg_mux; + wait_queue_head_t tsev_wq; + int defunct; + struct device_attribute *pin_dev_attr; + struct attribute **pin_attr; + struct attribute_group pin_attr_group; + const struct attribute_group *pin_attr_groups[2]; + struct kthread_worker *kworker; + struct kthread_delayed_work aux_work; +}; + +struct ptp_clock_caps { + int max_adj; + int n_alarm; + int n_ext_ts; + int n_per_out; + int pps; + int n_pins; + int cross_timestamping; + int adjust_phase; + int rsv[12]; +}; + +struct ptp_sys_offset { + unsigned int n_samples; + unsigned int rsv[3]; + struct ptp_clock_time ts[51]; +}; + +struct ptp_sys_offset_extended { + unsigned int n_samples; + unsigned int rsv[3]; + struct ptp_clock_time ts[75]; +}; + +struct ptp_sys_offset_precise { + struct ptp_clock_time device; + struct ptp_clock_time sys_realtime; + struct ptp_clock_time sys_monoraw; + unsigned int rsv[4]; +}; + +enum power_supply_notifier_events { + PSY_EVENT_PROP_CHANGED = 0, +}; + +struct power_supply_battery_ocv_table { + int ocv; + int capacity; +}; + +struct power_supply_resistance_temp_table { + int temp; + int resistance; +}; + +struct power_supply_battery_info { + int energy_full_design_uwh; + int charge_full_design_uah; + int voltage_min_design_uv; + int voltage_max_design_uv; + int tricklecharge_current_ua; + int precharge_current_ua; + int precharge_voltage_max_uv; + int charge_term_current_ua; + int charge_restart_voltage_uv; + int overvoltage_limit_uv; + int constant_charge_current_max_ua; + int constant_charge_voltage_max_uv; + int factory_internal_resistance_uohm; + int ocv_temp[20]; + int temp_ambient_alert_min; + int temp_ambient_alert_max; + int temp_alert_min; + int temp_alert_max; + int temp_min; + int temp_max; + struct power_supply_battery_ocv_table *ocv_table[20]; + int ocv_table_size[20]; + struct power_supply_resistance_temp_table *resist_table; + int resist_table_size; +}; + +struct psy_am_i_supplied_data { + struct power_supply *psy; + unsigned int count; +}; + +enum { + POWER_SUPPLY_CHARGE_TYPE_UNKNOWN = 0, + POWER_SUPPLY_CHARGE_TYPE_NONE = 1, + POWER_SUPPLY_CHARGE_TYPE_TRICKLE = 2, + POWER_SUPPLY_CHARGE_TYPE_FAST = 3, + POWER_SUPPLY_CHARGE_TYPE_STANDARD = 4, + POWER_SUPPLY_CHARGE_TYPE_ADAPTIVE = 5, + POWER_SUPPLY_CHARGE_TYPE_CUSTOM = 6, + POWER_SUPPLY_CHARGE_TYPE_LONGLIFE = 7, +}; + +enum { + POWER_SUPPLY_HEALTH_UNKNOWN = 0, + POWER_SUPPLY_HEALTH_GOOD = 1, + POWER_SUPPLY_HEALTH_OVERHEAT = 2, + POWER_SUPPLY_HEALTH_DEAD = 3, + POWER_SUPPLY_HEALTH_OVERVOLTAGE = 4, + POWER_SUPPLY_HEALTH_UNSPEC_FAILURE = 5, + POWER_SUPPLY_HEALTH_COLD = 6, + POWER_SUPPLY_HEALTH_WATCHDOG_TIMER_EXPIRE = 7, + POWER_SUPPLY_HEALTH_SAFETY_TIMER_EXPIRE = 8, + POWER_SUPPLY_HEALTH_OVERCURRENT = 9, + POWER_SUPPLY_HEALTH_CALIBRATION_REQUIRED = 10, + POWER_SUPPLY_HEALTH_WARM = 11, + POWER_SUPPLY_HEALTH_COOL = 12, + POWER_SUPPLY_HEALTH_HOT = 13, +}; + +enum { + POWER_SUPPLY_SCOPE_UNKNOWN = 0, + POWER_SUPPLY_SCOPE_SYSTEM = 1, + POWER_SUPPLY_SCOPE_DEVICE = 2, +}; + +struct power_supply_attr { + const char *prop_name; + char attr_name[31]; + struct device_attribute dev_attr; + const char * const *text_values; + int text_values_len; +}; + +enum hwmon_sensor_types { + hwmon_chip = 0, + hwmon_temp = 1, + hwmon_in = 2, + hwmon_curr = 3, + hwmon_power = 4, + hwmon_energy = 5, + hwmon_humidity = 6, + hwmon_fan = 7, + hwmon_pwm = 8, + hwmon_intrusion = 9, + hwmon_max = 10, +}; + +enum hwmon_temp_attributes { + hwmon_temp_enable = 0, + hwmon_temp_input = 1, + hwmon_temp_type = 2, + hwmon_temp_lcrit = 3, + hwmon_temp_lcrit_hyst = 4, + hwmon_temp_min = 5, + hwmon_temp_min_hyst = 6, + hwmon_temp_max = 7, + hwmon_temp_max_hyst = 8, + hwmon_temp_crit = 9, + hwmon_temp_crit_hyst = 10, + hwmon_temp_emergency = 11, + hwmon_temp_emergency_hyst = 12, + hwmon_temp_alarm = 13, + hwmon_temp_lcrit_alarm = 14, + hwmon_temp_min_alarm = 15, + hwmon_temp_max_alarm = 16, + hwmon_temp_crit_alarm = 17, + hwmon_temp_emergency_alarm = 18, + hwmon_temp_fault = 19, + hwmon_temp_offset = 20, + hwmon_temp_label = 21, + hwmon_temp_lowest = 22, + hwmon_temp_highest = 23, + hwmon_temp_reset_history = 24, + hwmon_temp_rated_min = 25, + hwmon_temp_rated_max = 26, +}; + +enum hwmon_in_attributes { + hwmon_in_enable = 0, + hwmon_in_input = 1, + hwmon_in_min = 2, + hwmon_in_max = 3, + hwmon_in_lcrit = 4, + hwmon_in_crit = 5, + hwmon_in_average = 6, + hwmon_in_lowest = 7, + hwmon_in_highest = 8, + hwmon_in_reset_history = 9, + hwmon_in_label = 10, + hwmon_in_alarm = 11, + hwmon_in_min_alarm = 12, + hwmon_in_max_alarm = 13, + hwmon_in_lcrit_alarm = 14, + hwmon_in_crit_alarm = 15, + hwmon_in_rated_min = 16, + hwmon_in_rated_max = 17, +}; + +enum hwmon_curr_attributes { + hwmon_curr_enable = 0, + hwmon_curr_input = 1, + hwmon_curr_min = 2, + hwmon_curr_max = 3, + hwmon_curr_lcrit = 4, + hwmon_curr_crit = 5, + hwmon_curr_average = 6, + hwmon_curr_lowest = 7, + hwmon_curr_highest = 8, + hwmon_curr_reset_history = 9, + hwmon_curr_label = 10, + hwmon_curr_alarm = 11, + hwmon_curr_min_alarm = 12, + hwmon_curr_max_alarm = 13, + hwmon_curr_lcrit_alarm = 14, + hwmon_curr_crit_alarm = 15, + hwmon_curr_rated_min = 16, + hwmon_curr_rated_max = 17, +}; + +struct hwmon_ops { + umode_t (*is_visible)(const void *, enum hwmon_sensor_types, u32, int); + int (*read)(struct device *, enum hwmon_sensor_types, u32, int, long int *); + int (*read_string)(struct device *, enum hwmon_sensor_types, u32, int, const char **); + int (*write)(struct device *, enum hwmon_sensor_types, u32, int, long int); +}; + +struct hwmon_channel_info { + enum hwmon_sensor_types type; + const u32 *config; +}; + +struct hwmon_chip_info { + const struct hwmon_ops *ops; + const struct hwmon_channel_info **info; +}; + +struct power_supply_hwmon { + struct power_supply *psy; + long unsigned int *props; +}; + +struct hwmon_type_attr_list { + const u32 *attrs; + size_t n_attrs; +}; + +enum hwmon_chip_attributes { + hwmon_chip_temp_reset_history = 0, + hwmon_chip_in_reset_history = 1, + hwmon_chip_curr_reset_history = 2, + hwmon_chip_power_reset_history = 3, + hwmon_chip_register_tz = 4, + hwmon_chip_update_interval = 5, + hwmon_chip_alarms = 6, + hwmon_chip_samples = 7, + hwmon_chip_curr_samples = 8, + hwmon_chip_in_samples = 9, + hwmon_chip_power_samples = 10, + hwmon_chip_temp_samples = 11, +}; + +enum hwmon_power_attributes { + hwmon_power_enable = 0, + hwmon_power_average = 1, + hwmon_power_average_interval = 2, + hwmon_power_average_interval_max = 3, + hwmon_power_average_interval_min = 4, + hwmon_power_average_highest = 5, + hwmon_power_average_lowest = 6, + hwmon_power_average_max = 7, + hwmon_power_average_min = 8, + hwmon_power_input = 9, + hwmon_power_input_highest = 10, + hwmon_power_input_lowest = 11, + hwmon_power_reset_history = 12, + hwmon_power_accuracy = 13, + hwmon_power_cap = 14, + hwmon_power_cap_hyst = 15, + hwmon_power_cap_max = 16, + hwmon_power_cap_min = 17, + hwmon_power_min = 18, + hwmon_power_max = 19, + hwmon_power_crit = 20, + hwmon_power_lcrit = 21, + hwmon_power_label = 22, + hwmon_power_alarm = 23, + hwmon_power_cap_alarm = 24, + hwmon_power_min_alarm = 25, + hwmon_power_max_alarm = 26, + hwmon_power_lcrit_alarm = 27, + hwmon_power_crit_alarm = 28, + hwmon_power_rated_min = 29, + hwmon_power_rated_max = 30, +}; + +enum hwmon_energy_attributes { + hwmon_energy_enable = 0, + hwmon_energy_input = 1, + hwmon_energy_label = 2, +}; + +enum hwmon_humidity_attributes { + hwmon_humidity_enable = 0, + hwmon_humidity_input = 1, + hwmon_humidity_label = 2, + hwmon_humidity_min = 3, + hwmon_humidity_min_hyst = 4, + hwmon_humidity_max = 5, + hwmon_humidity_max_hyst = 6, + hwmon_humidity_alarm = 7, + hwmon_humidity_fault = 8, + hwmon_humidity_rated_min = 9, + hwmon_humidity_rated_max = 10, +}; + +enum hwmon_fan_attributes { + hwmon_fan_enable = 0, + hwmon_fan_input = 1, + hwmon_fan_label = 2, + hwmon_fan_min = 3, + hwmon_fan_max = 4, + hwmon_fan_div = 5, + hwmon_fan_pulses = 6, + hwmon_fan_target = 7, + hwmon_fan_alarm = 8, + hwmon_fan_min_alarm = 9, + hwmon_fan_max_alarm = 10, + hwmon_fan_fault = 11, +}; + +enum hwmon_pwm_attributes { + hwmon_pwm_input = 0, + hwmon_pwm_enable = 1, + hwmon_pwm_mode = 2, + hwmon_pwm_freq = 3, +}; + +enum hwmon_intrusion_attributes { + hwmon_intrusion_alarm = 0, + hwmon_intrusion_beep = 1, +}; + +struct trace_event_raw_hwmon_attr_class { + struct trace_entry ent; + int index; + u32 __data_loc_attr_name; + long int val; + char __data[0]; +}; + +struct trace_event_raw_hwmon_attr_show_string { + struct trace_entry ent; + int index; + u32 __data_loc_attr_name; + u32 __data_loc_label; + char __data[0]; +}; + +struct trace_event_data_offsets_hwmon_attr_class { + u32 attr_name; +}; + +struct trace_event_data_offsets_hwmon_attr_show_string { + u32 attr_name; + u32 label; +}; + +typedef void (*btf_trace_hwmon_attr_show)(void *, int, const char *, long int); + +typedef void (*btf_trace_hwmon_attr_store)(void *, int, const char *, long int); + +typedef void (*btf_trace_hwmon_attr_show_string)(void *, int, const char *, const char *); + +struct hwmon_device { + const char *name; + struct device dev; + const struct hwmon_chip_info *chip; + struct list_head tzdata; + struct attribute_group group; + const struct attribute_group **groups; +}; + +struct hwmon_device_attribute { + struct device_attribute dev_attr; + const struct hwmon_ops *ops; + enum hwmon_sensor_types type; + u32 attr; + int index; + char name[32]; +}; + +struct thermal_attr { + struct device_attribute attr; + char name[20]; +}; + +struct trace_event_raw_thermal_temperature { + struct trace_entry ent; + u32 __data_loc_thermal_zone; + int id; + int temp_prev; + int temp; + char __data[0]; +}; + +struct trace_event_raw_cdev_update { + struct trace_entry ent; + u32 __data_loc_type; + long unsigned int target; + char __data[0]; +}; + +struct trace_event_raw_thermal_zone_trip { + struct trace_entry ent; + u32 __data_loc_thermal_zone; + int id; + int trip; + enum thermal_trip_type trip_type; + char __data[0]; +}; + +struct trace_event_data_offsets_thermal_temperature { + u32 thermal_zone; +}; + +struct trace_event_data_offsets_cdev_update { + u32 type; +}; + +struct trace_event_data_offsets_thermal_zone_trip { + u32 thermal_zone; +}; + +typedef void (*btf_trace_thermal_temperature)(void *, struct thermal_zone_device *); + +typedef void (*btf_trace_cdev_update)(void *, struct thermal_cooling_device *, long unsigned int); + +typedef void (*btf_trace_thermal_zone_trip)(void *, struct thermal_zone_device *, int, enum thermal_trip_type); + +struct thermal_instance { + int id; + char name[20]; + struct thermal_zone_device *tz; + struct thermal_cooling_device *cdev; + int trip; + bool initialized; + long unsigned int upper; + long unsigned int lower; + long unsigned int target; + char attr_name[20]; + struct device_attribute attr; + char weight_attr_name[20]; + struct device_attribute weight_attr; + struct list_head tz_node; + struct list_head cdev_node; + unsigned int weight; +}; + +struct cooling_dev_stats { + spinlock_t lock; + unsigned int total_trans; + long unsigned int state; + long unsigned int max_states; + ktime_t last_time; + ktime_t *time_in_state; + unsigned int *trans_table; +}; + +struct genl_dumpit_info { + const struct genl_family *family; + struct genl_ops op; + struct nlattr **attrs; +}; + +enum thermal_genl_attr { + THERMAL_GENL_ATTR_UNSPEC = 0, + THERMAL_GENL_ATTR_TZ = 1, + THERMAL_GENL_ATTR_TZ_ID = 2, + THERMAL_GENL_ATTR_TZ_TEMP = 3, + THERMAL_GENL_ATTR_TZ_TRIP = 4, + THERMAL_GENL_ATTR_TZ_TRIP_ID = 5, + THERMAL_GENL_ATTR_TZ_TRIP_TYPE = 6, + THERMAL_GENL_ATTR_TZ_TRIP_TEMP = 7, + THERMAL_GENL_ATTR_TZ_TRIP_HYST = 8, + THERMAL_GENL_ATTR_TZ_MODE = 9, + THERMAL_GENL_ATTR_TZ_NAME = 10, + THERMAL_GENL_ATTR_TZ_CDEV_WEIGHT = 11, + THERMAL_GENL_ATTR_TZ_GOV = 12, + THERMAL_GENL_ATTR_TZ_GOV_NAME = 13, + THERMAL_GENL_ATTR_CDEV = 14, + THERMAL_GENL_ATTR_CDEV_ID = 15, + THERMAL_GENL_ATTR_CDEV_CUR_STATE = 16, + THERMAL_GENL_ATTR_CDEV_MAX_STATE = 17, + THERMAL_GENL_ATTR_CDEV_NAME = 18, + THERMAL_GENL_ATTR_GOV_NAME = 19, + __THERMAL_GENL_ATTR_MAX = 20, +}; + +enum thermal_genl_sampling { + THERMAL_GENL_SAMPLING_TEMP = 0, + __THERMAL_GENL_SAMPLING_MAX = 1, +}; + +enum thermal_genl_event { + THERMAL_GENL_EVENT_UNSPEC = 0, + THERMAL_GENL_EVENT_TZ_CREATE = 1, + THERMAL_GENL_EVENT_TZ_DELETE = 2, + THERMAL_GENL_EVENT_TZ_DISABLE = 3, + THERMAL_GENL_EVENT_TZ_ENABLE = 4, + THERMAL_GENL_EVENT_TZ_TRIP_UP = 5, + THERMAL_GENL_EVENT_TZ_TRIP_DOWN = 6, + THERMAL_GENL_EVENT_TZ_TRIP_CHANGE = 7, + THERMAL_GENL_EVENT_TZ_TRIP_ADD = 8, + THERMAL_GENL_EVENT_TZ_TRIP_DELETE = 9, + THERMAL_GENL_EVENT_CDEV_ADD = 10, + THERMAL_GENL_EVENT_CDEV_DELETE = 11, + THERMAL_GENL_EVENT_CDEV_STATE_UPDATE = 12, + THERMAL_GENL_EVENT_TZ_GOV_CHANGE = 13, + __THERMAL_GENL_EVENT_MAX = 14, +}; + +enum thermal_genl_cmd { + THERMAL_GENL_CMD_UNSPEC = 0, + THERMAL_GENL_CMD_TZ_GET_ID = 1, + THERMAL_GENL_CMD_TZ_GET_TRIP = 2, + THERMAL_GENL_CMD_TZ_GET_TEMP = 3, + THERMAL_GENL_CMD_TZ_GET_GOV = 4, + THERMAL_GENL_CMD_TZ_GET_MODE = 5, + THERMAL_GENL_CMD_CDEV_GET = 6, + __THERMAL_GENL_CMD_MAX = 7, +}; + +struct param { + struct nlattr **attrs; + struct sk_buff *msg; + const char *name; + int tz_id; + int cdev_id; + int trip_id; + int trip_temp; + int trip_type; + int trip_hyst; + int temp; + int cdev_state; + int cdev_max_state; +}; + +typedef int (*cb_t)(struct param *); + +struct thermal_hwmon_device { + char type[20]; + struct device *device; + int count; + struct list_head tz_list; + struct list_head node; +}; + +struct thermal_hwmon_attr { + struct device_attribute attr; + char name[16]; +}; + +struct thermal_hwmon_temp { + struct list_head hwmon_node; + struct thermal_zone_device *tz; + struct thermal_hwmon_attr temp_input; + struct thermal_hwmon_attr temp_crit; +}; + +struct watchdog_info { + __u32 options; + __u32 firmware_version; + __u8 identity[32]; +}; + +struct watchdog_device; + +struct watchdog_ops { + struct module *owner; + int (*start)(struct watchdog_device *); + int (*stop)(struct watchdog_device *); + int (*ping)(struct watchdog_device *); + unsigned int (*status)(struct watchdog_device *); + int (*set_timeout)(struct watchdog_device *, unsigned int); + int (*set_pretimeout)(struct watchdog_device *, unsigned int); + unsigned int (*get_timeleft)(struct watchdog_device *); + int (*restart)(struct watchdog_device *, long unsigned int, void *); + long int (*ioctl)(struct watchdog_device *, unsigned int, long unsigned int); +}; + +struct watchdog_governor; + +struct watchdog_core_data; + +struct watchdog_device { + int id; + struct device *parent; + const struct attribute_group **groups; + const struct watchdog_info *info; + const struct watchdog_ops *ops; + const struct watchdog_governor *gov; + unsigned int bootstatus; + unsigned int timeout; + unsigned int pretimeout; + unsigned int min_timeout; + unsigned int max_timeout; + unsigned int min_hw_heartbeat_ms; + unsigned int max_hw_heartbeat_ms; + struct notifier_block reboot_nb; + struct notifier_block restart_nb; + void *driver_data; + struct watchdog_core_data *wd_data; + long unsigned int status; + struct list_head deferred; +}; + +struct watchdog_governor { + const char name[20]; + void (*pretimeout)(struct watchdog_device *); +}; + +struct watchdog_core_data { + struct device dev; + struct cdev cdev; + struct watchdog_device *wdd; + struct mutex lock; + ktime_t last_keepalive; + ktime_t last_hw_keepalive; + ktime_t open_deadline; + struct hrtimer timer; + struct kthread_work work; + long unsigned int status; +}; + +struct mdp_device_descriptor_s { + __u32 number; + __u32 major; + __u32 minor; + __u32 raid_disk; + __u32 state; + __u32 reserved[27]; +}; + +typedef struct mdp_device_descriptor_s mdp_disk_t; + +struct mdp_superblock_s { + __u32 md_magic; + __u32 major_version; + __u32 minor_version; + __u32 patch_version; + __u32 gvalid_words; + __u32 set_uuid0; + __u32 ctime; + __u32 level; + __u32 size; + __u32 nr_disks; + __u32 raid_disks; + __u32 md_minor; + __u32 not_persistent; + __u32 set_uuid1; + __u32 set_uuid2; + __u32 set_uuid3; + __u32 gstate_creserved[16]; + __u32 utime; + __u32 state; + __u32 active_disks; + __u32 working_disks; + __u32 failed_disks; + __u32 spare_disks; + __u32 sb_csum; + __u32 events_lo; + __u32 events_hi; + __u32 cp_events_lo; + __u32 cp_events_hi; + __u32 recovery_cp; + __u64 reshape_position; + __u32 new_level; + __u32 delta_disks; + __u32 new_layout; + __u32 new_chunk; + __u32 gstate_sreserved[14]; + __u32 layout; + __u32 chunk_size; + __u32 root_pv; + __u32 root_block; + __u32 pstate_reserved[60]; + mdp_disk_t disks[27]; + __u32 reserved[0]; + mdp_disk_t this_disk; +}; + +typedef struct mdp_superblock_s mdp_super_t; + +struct mdp_superblock_1 { + __le32 magic; + __le32 major_version; + __le32 feature_map; + __le32 pad0; + __u8 set_uuid[16]; + char set_name[32]; + __le64 ctime; + __le32 level; + __le32 layout; + __le64 size; + __le32 chunksize; + __le32 raid_disks; + union { + __le32 bitmap_offset; + struct { + __le16 offset; + __le16 size; + } ppl; + }; + __le32 new_level; + __le64 reshape_position; + __le32 delta_disks; + __le32 new_layout; + __le32 new_chunk; + __le32 new_offset; + __le64 data_offset; + __le64 data_size; + __le64 super_offset; + union { + __le64 recovery_offset; + __le64 journal_tail; + }; + __le32 dev_number; + __le32 cnt_corrected_read; + __u8 device_uuid[16]; + __u8 devflags; + __u8 bblog_shift; + __le16 bblog_size; + __le32 bblog_offset; + __le64 utime; + __le64 events; + __le64 resync_offset; + __le32 sb_csum; + __le32 max_dev; + __u8 pad3[32]; + __le16 dev_roles[0]; +}; + +struct mdu_version_s { + int major; + int minor; + int patchlevel; +}; + +typedef struct mdu_version_s mdu_version_t; + +struct mdu_array_info_s { + int major_version; + int minor_version; + int patch_version; + unsigned int ctime; + int level; + int size; + int nr_disks; + int raid_disks; + int md_minor; + int not_persistent; + unsigned int utime; + int state; + int active_disks; + int working_disks; + int failed_disks; + int spare_disks; + int layout; + int chunk_size; +}; + +typedef struct mdu_array_info_s mdu_array_info_t; + +struct mdu_disk_info_s { + int number; + int major; + int minor; + int raid_disk; + int state; +}; + +typedef struct mdu_disk_info_s mdu_disk_info_t; + +struct mdu_bitmap_file_s { + char pathname[4096]; +}; + +typedef struct mdu_bitmap_file_s mdu_bitmap_file_t; + +struct mddev; + +struct md_rdev; + +struct md_cluster_operations { + int (*join)(struct mddev *, int); + int (*leave)(struct mddev *); + int (*slot_number)(struct mddev *); + int (*resync_info_update)(struct mddev *, sector_t, sector_t); + void (*resync_info_get)(struct mddev *, sector_t *, sector_t *); + int (*metadata_update_start)(struct mddev *); + int (*metadata_update_finish)(struct mddev *); + void (*metadata_update_cancel)(struct mddev *); + int (*resync_start)(struct mddev *); + int (*resync_finish)(struct mddev *); + int (*area_resyncing)(struct mddev *, int, sector_t, sector_t); + int (*add_new_disk)(struct mddev *, struct md_rdev *); + void (*add_new_disk_cancel)(struct mddev *); + int (*new_disk_ack)(struct mddev *, bool); + int (*remove_disk)(struct mddev *, struct md_rdev *); + void (*load_bitmaps)(struct mddev *, int); + int (*gather_bitmaps)(struct md_rdev *); + int (*resize_bitmaps)(struct mddev *, sector_t, sector_t); + int (*lock_all_bitmaps)(struct mddev *); + void (*unlock_all_bitmaps)(struct mddev *); + void (*update_size)(struct mddev *, sector_t); +}; + +struct md_cluster_info; + +struct md_personality; + +struct md_thread; + +struct bitmap; + +struct mddev { + void *private; + struct md_personality *pers; + dev_t unit; + int md_minor; + struct list_head disks; + long unsigned int flags; + long unsigned int sb_flags; + int suspended; + atomic_t active_io; + int ro; + int sysfs_active; + struct gendisk *gendisk; + struct kobject kobj; + int hold_active; + int major_version; + int minor_version; + int patch_version; + int persistent; + int external; + char metadata_type[17]; + int chunk_sectors; + time64_t ctime; + time64_t utime; + int level; + int layout; + char clevel[16]; + int raid_disks; + int max_disks; + sector_t dev_sectors; + sector_t array_sectors; + int external_size; + __u64 events; + int can_decrease_events; + char uuid[16]; + sector_t reshape_position; + int delta_disks; + int new_level; + int new_layout; + int new_chunk_sectors; + int reshape_backwards; + struct md_thread *thread; + struct md_thread *sync_thread; + char *last_sync_action; + sector_t curr_resync; + sector_t curr_resync_completed; + long unsigned int resync_mark; + sector_t resync_mark_cnt; + sector_t curr_mark_cnt; + sector_t resync_max_sectors; + atomic64_t resync_mismatches; + sector_t suspend_lo; + sector_t suspend_hi; + int sync_speed_min; + int sync_speed_max; + int parallel_resync; + int ok_start_degraded; + long unsigned int recovery; + int recovery_disabled; + int in_sync; + struct mutex open_mutex; + struct mutex reconfig_mutex; + atomic_t active; + atomic_t openers; + int changed; + int degraded; + atomic_t recovery_active; + wait_queue_head_t recovery_wait; + sector_t recovery_cp; + sector_t resync_min; + sector_t resync_max; + struct kernfs_node *sysfs_state; + struct kernfs_node *sysfs_action; + struct kernfs_node *sysfs_completed; + struct kernfs_node *sysfs_degraded; + struct kernfs_node *sysfs_level; + struct work_struct del_work; + spinlock_t lock; + wait_queue_head_t sb_wait; + atomic_t pending_writes; + unsigned int safemode; + unsigned int safemode_delay; + struct timer_list safemode_timer; + struct percpu_ref writes_pending; + int sync_checkers; + struct request_queue *queue; + struct bitmap *bitmap; + struct { + struct file *file; + loff_t offset; + long unsigned int space; + loff_t default_offset; + long unsigned int default_space; + struct mutex mutex; + long unsigned int chunksize; + long unsigned int daemon_sleep; + long unsigned int max_write_behind; + int external; + int nodes; + char cluster_name[64]; + } bitmap_info; + atomic_t max_corr_read_errors; + struct list_head all_mddevs; + struct attribute_group *to_remove; + struct bio_set bio_set; + struct bio_set sync_set; + mempool_t md_io_pool; + struct bio *flush_bio; + atomic_t flush_pending; + ktime_t start_flush; + ktime_t prev_flush_start; + struct work_struct flush_work; + struct work_struct event_work; + mempool_t *serial_info_pool; + void (*sync_super)(struct mddev *, struct md_rdev *); + struct md_cluster_info *cluster_info; + unsigned int good_device_nr; + unsigned int noio_flag; + bool has_superblocks: 1; + bool fail_last_dev: 1; + bool serialize_policy: 1; +}; + +struct serial_in_rdev; + +struct md_rdev { + struct list_head same_set; + sector_t sectors; + struct mddev *mddev; + int last_events; + struct block_device *meta_bdev; + struct block_device *bdev; + struct page *sb_page; + struct page *bb_page; + int sb_loaded; + __u64 sb_events; + sector_t data_offset; + sector_t new_data_offset; + sector_t sb_start; + int sb_size; + int preferred_minor; + struct kobject kobj; + long unsigned int flags; + wait_queue_head_t blocked_wait; + int desc_nr; + int raid_disk; + int new_raid_disk; + int saved_raid_disk; + union { + sector_t recovery_offset; + sector_t journal_tail; + }; + atomic_t nr_pending; + atomic_t read_errors; + time64_t last_read_error; + atomic_t corrected_errors; + struct serial_in_rdev *serial; + struct work_struct del_work; + struct kernfs_node *sysfs_state; + struct kernfs_node *sysfs_unack_badblocks; + struct kernfs_node *sysfs_badblocks; + struct badblocks badblocks; + struct { + short int offset; + unsigned int size; + sector_t sector; + } ppl; +}; + +struct serial_in_rdev { + struct rb_root_cached serial_rb; + spinlock_t serial_lock; + wait_queue_head_t serial_io_wait; +}; + +enum flag_bits { + Faulty = 0, + In_sync = 1, + Bitmap_sync = 2, + WriteMostly = 3, + AutoDetected = 4, + Blocked = 5, + WriteErrorSeen = 6, + FaultRecorded = 7, + BlockedBadBlocks = 8, + WantReplacement = 9, + Replacement = 10, + Candidate = 11, + Journal = 12, + ClusterRemove = 13, + RemoveSynchronized = 14, + ExternalBbl = 15, + FailFast = 16, + LastDev = 17, + CollisionCheck = 18, +}; + +enum mddev_flags { + MD_ARRAY_FIRST_USE = 0, + MD_CLOSING = 1, + MD_JOURNAL_CLEAN = 2, + MD_HAS_JOURNAL = 3, + MD_CLUSTER_RESYNC_LOCKED = 4, + MD_FAILFAST_SUPPORTED = 5, + MD_HAS_PPL = 6, + MD_HAS_MULTIPLE_PPLS = 7, + MD_ALLOW_SB_UPDATE = 8, + MD_UPDATING_SB = 9, + MD_NOT_READY = 10, + MD_BROKEN = 11, +}; + +enum mddev_sb_flags { + MD_SB_CHANGE_DEVS = 0, + MD_SB_CHANGE_CLEAN = 1, + MD_SB_CHANGE_PENDING = 2, + MD_SB_NEED_REWRITE = 3, +}; + +struct md_personality { + char *name; + int level; + struct list_head list; + struct module *owner; + bool (*make_request)(struct mddev *, struct bio *); + int (*run)(struct mddev *); + int (*start)(struct mddev *); + void (*free)(struct mddev *, void *); + void (*status)(struct seq_file *, struct mddev *); + void (*error_handler)(struct mddev *, struct md_rdev *); + int (*hot_add_disk)(struct mddev *, struct md_rdev *); + int (*hot_remove_disk)(struct mddev *, struct md_rdev *); + int (*spare_active)(struct mddev *); + sector_t (*sync_request)(struct mddev *, sector_t, int *); + int (*resize)(struct mddev *, sector_t); + sector_t (*size)(struct mddev *, sector_t, int); + int (*check_reshape)(struct mddev *); + int (*start_reshape)(struct mddev *); + void (*finish_reshape)(struct mddev *); + void (*update_reshape_pos)(struct mddev *); + void (*quiesce)(struct mddev *, int); + void * (*takeover)(struct mddev *); + int (*change_consistency_policy)(struct mddev *, const char *); +}; + +struct md_thread { + void (*run)(struct md_thread *); + struct mddev *mddev; + wait_queue_head_t wqueue; + long unsigned int flags; + struct task_struct *tsk; + long unsigned int timeout; + void *private; +}; + +struct bitmap_page; + +struct bitmap_counts { + spinlock_t lock; + struct bitmap_page *bp; + long unsigned int pages; + long unsigned int missing_pages; + long unsigned int chunkshift; + long unsigned int chunks; +}; + +struct bitmap_storage { + struct file *file; + struct page *sb_page; + struct page **filemap; + long unsigned int *filemap_attr; + long unsigned int file_pages; + long unsigned int bytes; +}; + +struct bitmap { + struct bitmap_counts counts; + struct mddev *mddev; + __u64 events_cleared; + int need_sync; + struct bitmap_storage storage; + long unsigned int flags; + int allclean; + atomic_t behind_writes; + long unsigned int behind_writes_used; + long unsigned int daemon_lastrun; + long unsigned int last_end_sync; + atomic_t pending_writes; + wait_queue_head_t write_wait; + wait_queue_head_t overflow_wait; + wait_queue_head_t behind_wait; + struct kernfs_node *sysfs_can_clear; + int cluster_slot; +}; + +enum recovery_flags { + MD_RECOVERY_RUNNING = 0, + MD_RECOVERY_SYNC = 1, + MD_RECOVERY_RECOVER = 2, + MD_RECOVERY_INTR = 3, + MD_RECOVERY_DONE = 4, + MD_RECOVERY_NEEDED = 5, + MD_RECOVERY_REQUESTED = 6, + MD_RECOVERY_CHECK = 7, + MD_RECOVERY_RESHAPE = 8, + MD_RECOVERY_FROZEN = 9, + MD_RECOVERY_ERROR = 10, + MD_RECOVERY_WAIT = 11, + MD_RESYNCING_REMOTE = 12, +}; + +struct md_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct mddev *, char *); + ssize_t (*store)(struct mddev *, const char *, size_t); +}; + +struct bitmap_page { + char *map; + unsigned int hijacked: 1; + unsigned int pending: 1; + unsigned int count: 30; +}; + +struct md_io { + struct mddev *mddev; + bio_end_io_t *orig_bi_end_io; + void *orig_bi_private; + long unsigned int start_time; + struct block_device *part; +}; + +struct super_type { + char *name; + struct module *owner; + int (*load_super)(struct md_rdev *, struct md_rdev *, int); + int (*validate_super)(struct mddev *, struct md_rdev *); + void (*sync_super)(struct mddev *, struct md_rdev *); + long long unsigned int (*rdev_size_change)(struct md_rdev *, sector_t); + int (*allow_new_offset)(struct md_rdev *, long long unsigned int); +}; + +struct rdev_sysfs_entry { + struct attribute attr; + ssize_t (*show)(struct md_rdev *, char *); + ssize_t (*store)(struct md_rdev *, const char *, size_t); +}; + +enum array_state { + clear = 0, + inactive = 1, + suspended = 2, + readonly = 3, + read_auto = 4, + clean = 5, + active = 6, + write_pending = 7, + active_idle = 8, + broken = 9, + bad_word = 10, +}; + +struct detected_devices_node { + struct list_head list; + dev_t dev; +}; + +typedef __u16 bitmap_counter_t; + +enum bitmap_state { + BITMAP_STALE = 1, + BITMAP_WRITE_ERROR = 2, + BITMAP_HOSTENDIAN = 15, +}; + +struct bitmap_super_s { + __le32 magic; + __le32 version; + __u8 uuid[16]; + __le64 events; + __le64 events_cleared; + __le64 sync_size; + __le32 state; + __le32 chunksize; + __le32 daemon_sleep; + __le32 write_behind; + __le32 sectors_reserved; + __le32 nodes; + __u8 cluster_name[64]; + __u8 pad[120]; +}; + +typedef struct bitmap_super_s bitmap_super_t; + +enum bitmap_page_attr { + BITMAP_PAGE_DIRTY = 0, + BITMAP_PAGE_PENDING = 1, + BITMAP_PAGE_NEEDWRITE = 2, +}; + +struct md_setup_args { + int minor; + int partitioned; + int level; + int chunk; + char *device_names; +}; + +struct dm_ioctl { + __u32 version[3]; + __u32 data_size; + __u32 data_start; + __u32 target_count; + __s32 open_count; + __u32 flags; + __u32 event_nr; + __u32 padding; + __u64 dev; + char name[128]; + char uuid[129]; + char data[7]; +}; + +struct dm_target_spec { + __u64 sector_start; + __u64 length; + __s32 status; + __u32 next; + char target_type[16]; +}; + +struct dm_device { + struct dm_ioctl dmi; + struct dm_target_spec *table[256]; + char *target_args_array[256]; + struct list_head list; +}; + +typedef enum { + STATUSTYPE_INFO = 0, + STATUSTYPE_TABLE = 1, +} status_type_t; + +union map_info___2 { + void *ptr; +}; + +struct dm_target; + +typedef int (*dm_ctr_fn)(struct dm_target *, unsigned int, char **); + +struct dm_table; + +struct target_type; + +struct dm_target { + struct dm_table *table; + struct target_type *type; + sector_t begin; + sector_t len; + uint32_t max_io_len; + unsigned int num_flush_bios; + unsigned int num_discard_bios; + unsigned int num_secure_erase_bios; + unsigned int num_write_same_bios; + unsigned int num_write_zeroes_bios; + unsigned int per_io_data_size; + void *private; + char *error; + bool flush_supported: 1; + bool discards_supported: 1; + bool limit_swap_bios: 1; +}; + +typedef void (*dm_dtr_fn)(struct dm_target *); + +typedef int (*dm_map_fn)(struct dm_target *, struct bio *); + +typedef int (*dm_clone_and_map_request_fn)(struct dm_target *, struct request *, union map_info___2 *, struct request **); + +typedef void (*dm_release_clone_request_fn)(struct request *, union map_info___2 *); + +typedef int (*dm_endio_fn)(struct dm_target *, struct bio *, blk_status_t *); + +typedef int (*dm_request_endio_fn)(struct dm_target *, struct request *, blk_status_t, union map_info___2 *); + +typedef void (*dm_presuspend_fn)(struct dm_target *); + +typedef void (*dm_presuspend_undo_fn)(struct dm_target *); + +typedef void (*dm_postsuspend_fn)(struct dm_target *); + +typedef int (*dm_preresume_fn)(struct dm_target *); + +typedef void (*dm_resume_fn)(struct dm_target *); + +typedef void (*dm_status_fn)(struct dm_target *, status_type_t, unsigned int, char *, unsigned int); + +typedef int (*dm_message_fn)(struct dm_target *, unsigned int, char **, char *, unsigned int); + +typedef int (*dm_prepare_ioctl_fn)(struct dm_target *, struct block_device **); + +struct dm_report_zones_args; + +typedef int (*dm_report_zones_fn)(struct dm_target *, struct dm_report_zones_args *, unsigned int); + +struct dm_report_zones_args { + struct dm_target *tgt; + sector_t next_sector; + void *orig_data; + report_zones_cb orig_cb; + unsigned int zone_idx; + sector_t start; +}; + +struct dm_dev; + +typedef int (*iterate_devices_callout_fn)(struct dm_target *, struct dm_dev *, sector_t, sector_t, void *); + +struct dm_dev { + struct block_device *bdev; + struct dax_device *dax_dev; + fmode_t mode; + char name[16]; +}; + +typedef int (*dm_iterate_devices_fn)(struct dm_target *, iterate_devices_callout_fn, void *); + +typedef void (*dm_io_hints_fn)(struct dm_target *, struct queue_limits *); + +typedef int (*dm_busy_fn)(struct dm_target *); + +typedef long int (*dm_dax_direct_access_fn)(struct dm_target *, long unsigned int, long int, void **, pfn_t *); + +typedef size_t (*dm_dax_copy_iter_fn)(struct dm_target *, long unsigned int, void *, size_t, struct iov_iter *); + +typedef int (*dm_dax_zero_page_range_fn)(struct dm_target *, long unsigned int, size_t); + +struct target_type { + uint64_t features; + const char *name; + struct module *module; + unsigned int version[3]; + dm_ctr_fn ctr; + dm_dtr_fn dtr; + dm_map_fn map; + dm_clone_and_map_request_fn clone_and_map_rq; + dm_release_clone_request_fn release_clone_rq; + dm_endio_fn end_io; + dm_request_endio_fn rq_end_io; + dm_presuspend_fn presuspend; + dm_presuspend_undo_fn presuspend_undo; + dm_postsuspend_fn postsuspend; + dm_preresume_fn preresume; + dm_resume_fn resume; + dm_status_fn status; + dm_message_fn message; + dm_prepare_ioctl_fn prepare_ioctl; + dm_report_zones_fn report_zones; + dm_busy_fn busy; + dm_iterate_devices_fn iterate_devices; + dm_io_hints_fn io_hints; + dm_dax_direct_access_fn direct_access; + dm_dax_copy_iter_fn dax_copy_from_iter; + dm_dax_copy_iter_fn dax_copy_to_iter; + dm_dax_zero_page_range_fn dax_zero_page_range; + struct list_head list; +}; + +enum dm_uevent_type { + DM_UEVENT_PATH_FAILED = 0, + DM_UEVENT_PATH_REINSTATED = 1, +}; + +struct mapped_device; + +struct dm_uevent { + struct mapped_device *md; + enum kobject_action action; + struct kobj_uevent_env ku_env; + struct list_head elist; + char name[128]; + char uuid[129]; +}; + +enum dm_queue_mode { + DM_TYPE_NONE = 0, + DM_TYPE_BIO_BASED = 1, + DM_TYPE_REQUEST_BASED = 2, + DM_TYPE_DAX_BIO_BASED = 3, +}; + +struct mapped_device___2; + +struct dm_md_mempools; + +struct dm_table { + struct mapped_device___2 *md; + enum dm_queue_mode type; + unsigned int depth; + unsigned int counts[16]; + sector_t *index[16]; + unsigned int num_targets; + unsigned int num_allocated; + sector_t *highs; + struct dm_target *targets; + struct target_type *immutable_target_type; + bool integrity_supported: 1; + bool singleton: 1; + unsigned int integrity_added: 1; + fmode_t mode; + struct list_head devices; + void (*event_fn)(void *); + void *event_context; + struct dm_md_mempools *mempools; +}; + +struct dm_stats_last_position; + +struct dm_stats { + struct mutex mutex; + struct list_head list; + struct dm_stats_last_position *last; + sector_t last_sector; + unsigned int last_rw; +}; + +struct dm_stats_aux { + bool merged; + long long unsigned int duration_ns; +}; + +struct dm_kobject_holder { + struct kobject kobj; + struct completion completion; +}; + +struct mapped_device___2 { + struct mutex suspend_lock; + struct mutex table_devices_lock; + struct list_head table_devices; + void *map; + long unsigned int flags; + struct mutex type_lock; + enum dm_queue_mode type; + int numa_node_id; + struct request_queue *queue; + atomic_t holders; + atomic_t open_count; + struct dm_target *immutable_target; + struct target_type *immutable_target_type; + char name[16]; + struct gendisk *disk; + struct dax_device *dax_dev; + struct work_struct work; + wait_queue_head_t wait; + spinlock_t deferred_lock; + struct bio_list deferred; + void *interface_ptr; + wait_queue_head_t eventq; + atomic_t event_nr; + atomic_t uevent_seq; + struct list_head uevent_list; + spinlock_t uevent_lock; + unsigned int internal_suspend_count; + struct bio_set io_bs; + struct bio_set bs; + struct workqueue_struct *wq; + struct hd_geometry geometry; + struct dm_kobject_holder kobj_holder; + int swap_bios; + struct semaphore swap_bios_semaphore; + struct mutex swap_bios_lock; + struct dm_stats stats; + struct blk_mq_tag_set *tag_set; + bool init_tio_pdu: 1; + struct srcu_struct io_barrier; +}; + +struct dm_md_mempools { + struct bio_set bs; + struct bio_set io_bs; +}; + +struct dm_io; + +struct clone_info { + struct dm_table *map; + struct bio *bio; + struct dm_io *io; + sector_t sector; + unsigned int sector_count; +}; + +struct dm_target_io { + unsigned int magic; + struct dm_io *io; + struct dm_target *ti; + unsigned int target_bio_nr; + unsigned int *len_ptr; + bool inside_dm_io; + struct bio clone; +}; + +struct dm_io { + unsigned int magic; + struct mapped_device___2 *md; + blk_status_t status; + atomic_t io_count; + struct bio *orig_bio; + long unsigned int start_time; + spinlock_t endio_lock; + struct dm_stats_aux stats_aux; + struct dm_target_io tio; +}; + +struct table_device { + struct list_head list; + refcount_t count; + struct dm_dev dm_dev; +}; + +struct dm_pr { + u64 old_key; + u64 new_key; + u32 flags; + bool fail_early; +}; + +struct dm_arg_set { + unsigned int argc; + char **argv; +}; + +struct dm_arg { + unsigned int min; + unsigned int max; + char *error; +}; + +struct dm_dev_internal { + struct list_head list; + refcount_t count; + struct dm_dev *dm_dev; +}; + +enum suspend_mode { + PRESUSPEND = 0, + PRESUSPEND_UNDO = 1, + POSTSUSPEND = 2, +}; + +struct linear_c { + struct dm_dev *dev; + sector_t start; +}; + +struct stripe { + struct dm_dev *dev; + sector_t physical_start; + atomic_t error_count; +}; + +struct stripe_c { + uint32_t stripes; + int stripes_shift; + sector_t stripe_width; + uint32_t chunk_size; + int chunk_size_shift; + struct dm_target *ti; + struct work_struct trigger_event; + struct stripe stripe[0]; +}; + +struct dm_target_deps { + __u32 count; + __u32 padding; + __u64 dev[0]; +}; + +struct dm_name_list { + __u64 dev; + __u32 next; + char name[0]; +}; + +struct dm_target_versions { + __u32 next; + __u32 version[3]; + char name[0]; +}; + +struct dm_target_msg { + __u64 sector; + char message[0]; +}; + +enum { + DM_VERSION_CMD = 0, + DM_REMOVE_ALL_CMD = 1, + DM_LIST_DEVICES_CMD = 2, + DM_DEV_CREATE_CMD = 3, + DM_DEV_REMOVE_CMD = 4, + DM_DEV_RENAME_CMD = 5, + DM_DEV_SUSPEND_CMD = 6, + DM_DEV_STATUS_CMD = 7, + DM_DEV_WAIT_CMD = 8, + DM_TABLE_LOAD_CMD = 9, + DM_TABLE_CLEAR_CMD = 10, + DM_TABLE_DEPS_CMD = 11, + DM_TABLE_STATUS_CMD = 12, + DM_LIST_VERSIONS_CMD = 13, + DM_TARGET_MSG_CMD = 14, + DM_DEV_SET_GEOMETRY_CMD = 15, + DM_DEV_ARM_POLL_CMD = 16, + DM_GET_TARGET_VERSION_CMD = 17, +}; + +struct dm_file { + volatile unsigned int global_event_nr; +}; + +struct hash_cell { + struct list_head name_list; + struct list_head uuid_list; + char *name; + char *uuid; + struct mapped_device___2 *md; + struct dm_table *new_map; +}; + +struct vers_iter { + size_t param_size; + struct dm_target_versions *vers; + struct dm_target_versions *old_vers; + char *end; + uint32_t flags; +}; + +typedef int (*ioctl_fn___2)(struct file *, struct dm_ioctl *, size_t); + +struct dm_io_region { + struct block_device *bdev; + sector_t sector; + sector_t count; +}; + +struct page_list { + struct page_list *next; + struct page *page; +}; + +typedef void (*io_notify_fn)(long unsigned int, void *); + +enum dm_io_mem_type { + DM_IO_PAGE_LIST = 0, + DM_IO_BIO = 1, + DM_IO_VMA = 2, + DM_IO_KMEM = 3, +}; + +struct dm_io_memory { + enum dm_io_mem_type type; + unsigned int offset; + union { + struct page_list *pl; + struct bio *bio; + void *vma; + void *addr; + } ptr; +}; + +struct dm_io_notify { + io_notify_fn fn; + void *context; +}; + +struct dm_io_client; + +struct dm_io_request { + int bi_op; + int bi_op_flags; + struct dm_io_memory mem; + struct dm_io_notify notify; + struct dm_io_client *client; +}; + +struct dm_io_client { + mempool_t pool; + struct bio_set bios; +}; + +struct io { + long unsigned int error_bits; + atomic_t count; + struct dm_io_client *client; + io_notify_fn callback; + void *context; + void *vma_invalidate_address; + long unsigned int vma_invalidate_size; + long: 64; +}; + +struct dpages { + void (*get_page)(struct dpages *, struct page **, long unsigned int *, unsigned int *); + void (*next_page)(struct dpages *); + union { + unsigned int context_u; + struct bvec_iter context_bi; + }; + void *context_ptr; + void *vma_invalidate_address; + long unsigned int vma_invalidate_size; +}; + +struct sync_io { + long unsigned int error_bits; + struct completion wait; +}; + +struct dm_kcopyd_throttle { + unsigned int throttle; + unsigned int num_io_jobs; + unsigned int io_period; + unsigned int total_period; + unsigned int last_jiffies; +}; + +typedef void (*dm_kcopyd_notify_fn)(int, long unsigned int, void *); + +struct dm_kcopyd_client { + struct page_list *pages; + unsigned int nr_reserved_pages; + unsigned int nr_free_pages; + unsigned int sub_job_size; + struct dm_io_client *io_client; + wait_queue_head_t destroyq; + mempool_t job_pool; + struct workqueue_struct *kcopyd_wq; + struct work_struct kcopyd_work; + struct dm_kcopyd_throttle *throttle; + atomic_t nr_jobs; + spinlock_t job_lock; + struct list_head callback_jobs; + struct list_head complete_jobs; + struct list_head io_jobs; + struct list_head pages_jobs; +}; + +struct kcopyd_job { + struct dm_kcopyd_client *kc; + struct list_head list; + long unsigned int flags; + int read_err; + long unsigned int write_err; + int rw; + struct dm_io_region source; + unsigned int num_dests; + struct dm_io_region dests[8]; + struct page_list *pages; + dm_kcopyd_notify_fn fn; + void *context; + struct mutex lock; + atomic_t sub_jobs; + sector_t progress; + sector_t write_offset; + struct kcopyd_job *master_job; +}; + +struct dm_sysfs_attr { + struct attribute attr; + ssize_t (*show)(struct mapped_device___2 *, char *); + ssize_t (*store)(struct mapped_device___2 *, const char *, size_t); +}; + +struct dm_stats_last_position { + sector_t last_sector; + unsigned int last_rw; +}; + +struct dm_stat_percpu { + long long unsigned int sectors[2]; + long long unsigned int ios[2]; + long long unsigned int merges[2]; + long long unsigned int ticks[2]; + long long unsigned int io_ticks[2]; + long long unsigned int io_ticks_total; + long long unsigned int time_in_queue; + long long unsigned int *histogram; +}; + +struct dm_stat_shared { + atomic_t in_flight[2]; + long long unsigned int stamp; + struct dm_stat_percpu tmp; +}; + +struct dm_stat { + struct list_head list_entry; + int id; + unsigned int stat_flags; + size_t n_entries; + sector_t start; + sector_t end; + sector_t step; + unsigned int n_histogram_entries; + long long unsigned int *histogram_boundaries; + const char *program_id; + const char *aux_data; + struct callback_head callback_head; + size_t shared_alloc_size; + size_t percpu_alloc_size; + size_t histogram_alloc_size; + struct dm_stat_percpu *stat_percpu[8192]; + struct dm_stat_shared stat_shared[0]; +}; + +struct dm_rq_target_io; + +struct dm_rq_clone_bio_info { + struct bio *orig; + struct dm_rq_target_io *tio; + struct bio clone; +}; + +struct dm_rq_target_io { + struct mapped_device___2 *md; + struct dm_target *ti; + struct request *orig; + struct request *clone; + struct kthread_work work; + blk_status_t error; + union map_info___2 info; + struct dm_stats_aux stats_aux; + long unsigned int duration_jiffies; + unsigned int n_sectors; + unsigned int completed; +}; + +struct dm_buffer; + +struct dm_bufio_client { + struct mutex lock; + struct list_head lru[2]; + long unsigned int n_buffers[2]; + struct block_device *bdev; + unsigned int block_size; + s8 sectors_per_block_bits; + void (*alloc_callback)(struct dm_buffer *); + void (*write_callback)(struct dm_buffer *); + struct kmem_cache *slab_buffer; + struct kmem_cache *slab_cache; + struct dm_io_client *dm_io; + struct list_head reserved_buffers; + unsigned int need_reserved_buffers; + unsigned int minimum_buffers; + struct rb_root buffer_tree; + wait_queue_head_t free_buffer_wait; + sector_t start; + int async_write_error; + struct list_head client_list; + struct shrinker shrinker; + struct work_struct shrink_work; + atomic_long_t need_shrink; +}; + +struct dm_buffer { + struct rb_node node; + struct list_head lru_list; + struct list_head global_list; + sector_t block; + void *data; + unsigned char data_mode; + unsigned char list_mode; + blk_status_t read_error; + blk_status_t write_error; + unsigned int accessed; + unsigned int hold_count; + long unsigned int state; + long unsigned int last_accessed; + unsigned int dirty_start; + unsigned int dirty_end; + unsigned int write_start; + unsigned int write_end; + struct dm_bufio_client *c; + struct list_head write_list; + void (*end_io)(struct dm_buffer *, blk_status_t); +}; + +enum data_mode { + DATA_MODE_SLAB = 0, + DATA_MODE_GET_FREE_PAGES = 1, + DATA_MODE_VMALLOC = 2, + DATA_MODE_LIMIT = 3, +}; + +enum new_flag { + NF_FRESH = 0, + NF_READ = 1, + NF_GET = 2, + NF_PREFETCH = 3, +}; + +typedef sector_t chunk_t; + +struct dm_exception { + struct hlist_bl_node hash_list; + chunk_t old_chunk; + chunk_t new_chunk; +}; + +struct dm_exception_store; + +struct dm_exception_store_type { + const char *name; + struct module *module; + int (*ctr)(struct dm_exception_store *, char *); + void (*dtr)(struct dm_exception_store *); + int (*read_metadata)(struct dm_exception_store *, int (*)(void *, chunk_t, chunk_t), void *); + int (*prepare_exception)(struct dm_exception_store *, struct dm_exception *); + void (*commit_exception)(struct dm_exception_store *, struct dm_exception *, int, void (*)(void *, int), void *); + int (*prepare_merge)(struct dm_exception_store *, chunk_t *, chunk_t *); + int (*commit_merge)(struct dm_exception_store *, int); + void (*drop_snapshot)(struct dm_exception_store *); + unsigned int (*status)(struct dm_exception_store *, status_type_t, char *, unsigned int); + void (*usage)(struct dm_exception_store *, sector_t *, sector_t *, sector_t *); + struct list_head list; +}; + +struct dm_snapshot; + +struct dm_exception_store { + struct dm_exception_store_type *type; + struct dm_snapshot *snap; + unsigned int chunk_size; + unsigned int chunk_mask; + unsigned int chunk_shift; + void *context; + bool userspace_supports_overflow; +}; + +struct dm_exception_table { + uint32_t hash_mask; + unsigned int hash_shift; + struct hlist_bl_head *table; +}; + +struct dm_kcopyd_client___2; + +struct dm_snapshot { + struct rw_semaphore lock; + struct dm_dev *origin; + struct dm_dev *cow; + struct dm_target *ti; + struct list_head list; + int valid; + int snapshot_overflowed; + int active; + atomic_t pending_exceptions_count; + spinlock_t pe_allocation_lock; + sector_t exception_start_sequence; + sector_t exception_complete_sequence; + struct rb_root out_of_order_tree; + mempool_t pending_pool; + struct dm_exception_table pending; + struct dm_exception_table complete; + spinlock_t pe_lock; + spinlock_t tracked_chunk_lock; + struct hlist_head tracked_chunk_hash[16]; + struct dm_exception_store *store; + unsigned int in_progress; + struct wait_queue_head in_progress_wait; + struct dm_kcopyd_client___2 *kcopyd_client; + long unsigned int state_bits; + chunk_t first_merging_chunk; + int num_merging_chunks; + bool merge_failed: 1; + bool discard_zeroes_cow: 1; + bool discard_passdown_origin: 1; + struct bio_list bios_queued_during_merge; + struct bio flush_bio; +}; + +struct dm_snap_pending_exception { + struct dm_exception e; + struct bio_list origin_bios; + struct bio_list snapshot_bios; + struct dm_snapshot *snap; + int started; + int copy_error; + sector_t exception_sequence; + struct rb_node out_of_order_node; + struct bio *full_bio; + bio_end_io_t *full_bio_end_io; +}; + +struct dm_snap_tracked_chunk { + struct hlist_node node; + chunk_t chunk; +}; + +struct origin { + struct block_device *bdev; + struct list_head hash_list; + struct list_head snapshots; +}; + +struct dm_origin { + struct dm_dev *dev; + struct dm_target *ti; + unsigned int split_boundary; + struct list_head hash_list; +}; + +struct dm_exception_table_lock { + struct hlist_bl_head *complete_slot; + struct hlist_bl_head *pending_slot; +}; + +struct transient_c { + sector_t next_free; +}; + +struct disk_header { + __le32 magic; + __le32 valid; + __le32 version; + __le32 chunk_size; +}; + +struct disk_exception { + __le64 old_chunk; + __le64 new_chunk; +}; + +struct core_exception { + uint64_t old_chunk; + uint64_t new_chunk; +}; + +struct commit_callback { + void (*callback)(void *, int); + void *context; +}; + +struct pstore { + struct dm_exception_store *store; + int version; + int valid; + uint32_t exceptions_per_area; + void *area; + void *zero_area; + void *header_area; + chunk_t current_area; + chunk_t next_free; + uint32_t current_committed; + atomic_t pending_count; + uint32_t callback_count; + struct commit_callback *callbacks; + struct dm_io_client *io_client; + struct workqueue_struct *metadata_wq; +}; + +struct mdata_req { + struct dm_io_region *where; + struct dm_io_request *io_req; + struct work_struct work; + int result; +}; + +struct dm_bufio_client___2; + +struct dm_buffer___2; + +struct dm_bio_details { + struct gendisk *bi_disk; + u8 bi_partno; + int __bi_remaining; + long unsigned int bi_flags; + struct bvec_iter bi_iter; + bio_end_io_t *bi_end_io; + struct bio_integrity_payload *bi_integrity; +}; + +typedef sector_t region_t; + +struct dm_dirty_log_type; + +struct dm_dirty_log { + struct dm_dirty_log_type *type; + int (*flush_callback_fn)(struct dm_target *); + void *context; +}; + +struct dm_dirty_log_type { + const char *name; + struct module *module; + struct list_head list; + int (*ctr)(struct dm_dirty_log *, struct dm_target *, unsigned int, char **); + void (*dtr)(struct dm_dirty_log *); + int (*presuspend)(struct dm_dirty_log *); + int (*postsuspend)(struct dm_dirty_log *); + int (*resume)(struct dm_dirty_log *); + uint32_t (*get_region_size)(struct dm_dirty_log *); + int (*is_clean)(struct dm_dirty_log *, region_t); + int (*in_sync)(struct dm_dirty_log *, region_t, int); + int (*flush)(struct dm_dirty_log *); + void (*mark_region)(struct dm_dirty_log *, region_t); + void (*clear_region)(struct dm_dirty_log *, region_t); + int (*get_resync_work)(struct dm_dirty_log *, region_t *); + void (*set_region_sync)(struct dm_dirty_log *, region_t, int); + region_t (*get_sync_count)(struct dm_dirty_log *); + int (*status)(struct dm_dirty_log *, status_type_t, char *, unsigned int); + int (*is_remote_recovering)(struct dm_dirty_log *, region_t); +}; + +enum dm_rh_region_states { + DM_RH_CLEAN = 1, + DM_RH_DIRTY = 2, + DM_RH_NOSYNC = 4, + DM_RH_RECOVERING = 8, +}; + +enum dm_raid1_error { + DM_RAID1_WRITE_ERROR = 0, + DM_RAID1_FLUSH_ERROR = 1, + DM_RAID1_SYNC_ERROR = 2, + DM_RAID1_READ_ERROR = 3, +}; + +struct mirror_set; + +struct mirror { + struct mirror_set *ms; + atomic_t error_count; + long unsigned int error_type; + struct dm_dev *dev; + sector_t offset; +}; + +struct dm_region_hash; + +struct mirror_set { + struct dm_target *ti; + struct list_head list; + uint64_t features; + spinlock_t lock; + struct bio_list reads; + struct bio_list writes; + struct bio_list failures; + struct bio_list holds; + struct dm_region_hash *rh; + struct dm_kcopyd_client___2 *kcopyd_client; + struct dm_io_client *io_client; + region_t nr_regions; + int in_sync; + int log_failure; + int leg_failure; + atomic_t suspend; + atomic_t default_mirror; + struct workqueue_struct *kmirrord_wq; + struct work_struct kmirrord_work; + struct timer_list timer; + long unsigned int timer_pending; + struct work_struct trigger_event; + unsigned int nr_mirrors; + struct mirror mirror[0]; +}; + +struct dm_raid1_bio_record { + struct mirror *m; + struct dm_bio_details details; + region_t write_region; +}; + +struct dm_region; + +struct log_header_disk { + __le32 magic; + __le32 version; + __le64 nr_regions; +}; + +struct log_header_core { + uint32_t magic; + uint32_t version; + uint64_t nr_regions; +}; + +enum sync { + DEFAULTSYNC = 0, + NOSYNC = 1, + FORCESYNC = 2, +}; + +struct log_c { + struct dm_target *ti; + int touched_dirtied; + int touched_cleaned; + int flush_failed; + uint32_t region_size; + unsigned int region_count; + region_t sync_count; + unsigned int bitset_uint32_count; + uint32_t *clean_bits; + uint32_t *sync_bits; + uint32_t *recovering_bits; + int sync_search; + enum sync sync; + struct dm_io_request io_req; + int log_dev_failed; + int log_dev_flush_failed; + struct dm_dev *log_dev; + struct log_header_core header; + struct dm_io_region header_location; + struct log_header_disk *disk_header; +}; + +struct dm_region_hash___2 { + uint32_t region_size; + unsigned int region_shift; + struct dm_dirty_log *log; + rwlock_t hash_lock; + unsigned int mask; + unsigned int nr_buckets; + unsigned int prime; + unsigned int shift; + struct list_head *buckets; + int flush_failure; + unsigned int max_recovery; + spinlock_t region_lock; + atomic_t recovery_in_flight; + struct list_head clean_regions; + struct list_head quiesced_regions; + struct list_head recovered_regions; + struct list_head failed_recovered_regions; + struct semaphore recovery_count; + mempool_t region_pool; + void *context; + sector_t target_begin; + void (*dispatch_bios)(void *, struct bio_list *); + void (*wakeup_workers)(void *); + void (*wakeup_all_recovery_waiters)(void *); +}; + +struct dm_region___2 { + struct dm_region_hash___2 *rh; + region_t key; + int state; + struct list_head hash_list; + struct list_head list; + atomic_t pending; + struct bio_list delayed_bios; +}; + +enum dev_type { + DEV_UNKNOWN = 0, + DEV_X1 = 1, + DEV_X2 = 2, + DEV_X4 = 3, + DEV_X8 = 4, + DEV_X16 = 5, + DEV_X32 = 6, + DEV_X64 = 7, +}; + +enum hw_event_mc_err_type { + HW_EVENT_ERR_CORRECTED = 0, + HW_EVENT_ERR_UNCORRECTED = 1, + HW_EVENT_ERR_DEFERRED = 2, + HW_EVENT_ERR_FATAL = 3, + HW_EVENT_ERR_INFO = 4, +}; + +enum mem_type { + MEM_EMPTY = 0, + MEM_RESERVED = 1, + MEM_UNKNOWN = 2, + MEM_FPM = 3, + MEM_EDO = 4, + MEM_BEDO = 5, + MEM_SDR = 6, + MEM_RDR = 7, + MEM_DDR = 8, + MEM_RDDR = 9, + MEM_RMBS = 10, + MEM_DDR2 = 11, + MEM_FB_DDR2 = 12, + MEM_RDDR2 = 13, + MEM_XDR = 14, + MEM_DDR3 = 15, + MEM_RDDR3 = 16, + MEM_LRDDR3 = 17, + MEM_LPDDR3 = 18, + MEM_DDR4 = 19, + MEM_RDDR4 = 20, + MEM_LRDDR4 = 21, + MEM_LPDDR4 = 22, + MEM_DDR5 = 23, + MEM_NVDIMM = 24, + MEM_WIO2 = 25, +}; + +enum edac_type { + EDAC_UNKNOWN = 0, + EDAC_NONE = 1, + EDAC_RESERVED = 2, + EDAC_PARITY = 3, + EDAC_EC = 4, + EDAC_SECDED = 5, + EDAC_S2ECD2ED = 6, + EDAC_S4ECD4ED = 7, + EDAC_S8ECD8ED = 8, + EDAC_S16ECD16ED = 9, +}; + +enum scrub_type { + SCRUB_UNKNOWN = 0, + SCRUB_NONE = 1, + SCRUB_SW_PROG = 2, + SCRUB_SW_SRC = 3, + SCRUB_SW_PROG_SRC = 4, + SCRUB_SW_TUNABLE = 5, + SCRUB_HW_PROG = 6, + SCRUB_HW_SRC = 7, + SCRUB_HW_PROG_SRC = 8, + SCRUB_HW_TUNABLE = 9, +}; + +enum edac_mc_layer_type { + EDAC_MC_LAYER_BRANCH = 0, + EDAC_MC_LAYER_CHANNEL = 1, + EDAC_MC_LAYER_SLOT = 2, + EDAC_MC_LAYER_CHIP_SELECT = 3, + EDAC_MC_LAYER_ALL_MEM = 4, +}; + +struct edac_mc_layer { + enum edac_mc_layer_type type; + unsigned int size; + bool is_virt_csrow; +}; + +struct mem_ctl_info; + +struct dimm_info { + struct device dev; + char label[32]; + unsigned int location[3]; + struct mem_ctl_info *mci; + unsigned int idx; + u32 grain; + enum dev_type dtype; + enum mem_type mtype; + enum edac_type edac_mode; + u32 nr_pages; + unsigned int csrow; + unsigned int cschannel; + u16 smbios_handle; + u32 ce_count; + u32 ue_count; +}; + +struct mcidev_sysfs_attribute; + +struct edac_raw_error_desc { + char location[256]; + char label[296]; + long int grain; + u16 error_count; + enum hw_event_mc_err_type type; + int top_layer; + int mid_layer; + int low_layer; + long unsigned int page_frame_number; + long unsigned int offset_in_page; + long unsigned int syndrome; + const char *msg; + const char *other_detail; +}; + +struct csrow_info; + +struct mem_ctl_info { + struct device dev; + struct bus_type *bus; + struct list_head link; + struct module *owner; + long unsigned int mtype_cap; + long unsigned int edac_ctl_cap; + long unsigned int edac_cap; + long unsigned int scrub_cap; + enum scrub_type scrub_mode; + int (*set_sdram_scrub_rate)(struct mem_ctl_info *, u32); + int (*get_sdram_scrub_rate)(struct mem_ctl_info *); + void (*edac_check)(struct mem_ctl_info *); + long unsigned int (*ctl_page_to_phys)(struct mem_ctl_info *, long unsigned int); + int mc_idx; + struct csrow_info **csrows; + unsigned int nr_csrows; + unsigned int num_cschannel; + unsigned int n_layers; + struct edac_mc_layer *layers; + bool csbased; + unsigned int tot_dimms; + struct dimm_info **dimms; + struct device *pdev; + const char *mod_name; + const char *ctl_name; + const char *dev_name; + void *pvt_info; + long unsigned int start_time; + u32 ce_noinfo_count; + u32 ue_noinfo_count; + u32 ue_mc; + u32 ce_mc; + struct completion complete; + const struct mcidev_sysfs_attribute *mc_driver_sysfs_attributes; + struct delayed_work work; + struct edac_raw_error_desc error_desc; + int op_state; + struct dentry *debugfs; + u8 fake_inject_layer[3]; + bool fake_inject_ue; + u16 fake_inject_count; +}; + +struct rank_info { + int chan_idx; + struct csrow_info *csrow; + struct dimm_info *dimm; + u32 ce_count; +}; + +struct csrow_info { + struct device dev; + long unsigned int first_page; + long unsigned int last_page; + long unsigned int page_mask; + int csrow_idx; + u32 ue_count; + u32 ce_count; + struct mem_ctl_info *mci; + u32 nr_channels; + struct rank_info **channels; +}; + +struct edac_device_counter { + u32 ue_count; + u32 ce_count; +}; + +struct edac_device_ctl_info; + +struct edac_dev_sysfs_attribute { + struct attribute attr; + ssize_t (*show)(struct edac_device_ctl_info *, char *); + ssize_t (*store)(struct edac_device_ctl_info *, const char *, size_t); +}; + +struct edac_device_instance; + +struct edac_device_ctl_info { + struct list_head link; + struct module *owner; + int dev_idx; + int log_ue; + int log_ce; + int panic_on_ue; + unsigned int poll_msec; + long unsigned int delay; + struct edac_dev_sysfs_attribute *sysfs_attributes; + struct bus_type *edac_subsys; + int op_state; + struct delayed_work work; + void (*edac_check)(struct edac_device_ctl_info *); + struct device *dev; + const char *mod_name; + const char *ctl_name; + const char *dev_name; + void *pvt_info; + long unsigned int start_time; + struct completion removal_complete; + char name[32]; + u32 nr_instances; + struct edac_device_instance *instances; + struct edac_device_counter counters; + struct kobject kobj; +}; + +struct edac_device_block; + +struct edac_dev_sysfs_block_attribute { + struct attribute attr; + ssize_t (*show)(struct kobject *, struct attribute *, char *); + ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); + struct edac_device_block *block; + unsigned int value; +}; + +struct edac_device_block { + struct edac_device_instance *instance; + char name[32]; + struct edac_device_counter counters; + int nr_attribs; + struct edac_dev_sysfs_block_attribute *block_attributes; + struct kobject kobj; +}; + +struct edac_device_instance { + struct edac_device_ctl_info *ctl; + char name[35]; + struct edac_device_counter counters; + u32 nr_blocks; + struct edac_device_block *blocks; + struct kobject kobj; +}; + +struct dev_ch_attribute { + struct device_attribute attr; + unsigned int channel; +}; + +struct ctl_info_attribute { + struct attribute attr; + ssize_t (*show)(struct edac_device_ctl_info *, char *); + ssize_t (*store)(struct edac_device_ctl_info *, const char *, size_t); +}; + +struct instance_attribute { + struct attribute attr; + ssize_t (*show)(struct edac_device_instance *, char *); + ssize_t (*store)(struct edac_device_instance *, const char *, size_t); +}; + +struct edac_pci_counter { + atomic_t pe_count; + atomic_t npe_count; +}; + +struct edac_pci_ctl_info { + struct list_head link; + int pci_idx; + struct bus_type *edac_subsys; + int op_state; + struct delayed_work work; + void (*edac_check)(struct edac_pci_ctl_info *); + struct device *dev; + const char *mod_name; + const char *ctl_name; + const char *dev_name; + void *pvt_info; + long unsigned int start_time; + struct completion complete; + char name[32]; + struct edac_pci_counter counters; + struct kobject kobj; +}; + +struct edac_pci_gen_data { + int edac_idx; +}; + +struct instance_attribute___2 { + struct attribute attr; + ssize_t (*show)(struct edac_pci_ctl_info *, char *); + ssize_t (*store)(struct edac_pci_ctl_info *, const char *, size_t); +}; + +struct edac_pci_dev_attribute { + struct attribute attr; + void *value; + ssize_t (*show)(void *, char *); + ssize_t (*store)(void *, const char *, size_t); +}; + +typedef void (*pci_parity_check_fn_t)(struct pci_dev *); + +struct ghes_pvt { + struct mem_ctl_info *mci; + char other_detail[400]; + char msg[80]; +}; + +struct ghes_hw_desc { + int num_dimms; + struct dimm_info *dimms; +}; + +struct memdev_dmi_entry { + u8 type; + u8 length; + u16 handle; + u16 phys_mem_array_handle; + u16 mem_err_info_handle; + u16 total_width; + u16 data_width; + u16 size; + u8 form_factor; + u8 device_set; + u8 device_locator; + u8 bank_locator; + u8 memory_type; + u16 type_detail; + u16 speed; + u8 manufacturer; + u8 serial_number; + u8 asset_tag; + u8 part_number; + u8 attributes; + u32 extended_size; + u16 conf_mem_clk_speed; +} __attribute__((packed)); + +struct cpufreq_policy_data { + struct cpufreq_cpuinfo cpuinfo; + struct cpufreq_frequency_table *freq_table; + unsigned int cpu; + unsigned int min; + unsigned int max; +}; + +struct freq_attr { + struct attribute attr; + ssize_t (*show)(struct cpufreq_policy *, char *); + ssize_t (*store)(struct cpufreq_policy *, const char *, size_t); +}; + +struct cpufreq_driver { + char name[16]; + u16 flags; + void *driver_data; + int (*init)(struct cpufreq_policy *); + int (*verify)(struct cpufreq_policy_data *); + int (*setpolicy)(struct cpufreq_policy *); + int (*target)(struct cpufreq_policy *, unsigned int, unsigned int); + int (*target_index)(struct cpufreq_policy *, unsigned int); + unsigned int (*fast_switch)(struct cpufreq_policy *, unsigned int); + void (*adjust_perf)(unsigned int, long unsigned int, long unsigned int, long unsigned int); + unsigned int (*resolve_freq)(struct cpufreq_policy *, unsigned int); + unsigned int (*get_intermediate)(struct cpufreq_policy *, unsigned int); + int (*target_intermediate)(struct cpufreq_policy *, unsigned int); + unsigned int (*get)(unsigned int); + void (*update_limits)(unsigned int); + int (*bios_limit)(int, unsigned int *); + int (*online)(struct cpufreq_policy *); + int (*offline)(struct cpufreq_policy *); + int (*exit)(struct cpufreq_policy *); + void (*stop_cpu)(struct cpufreq_policy *); + int (*suspend)(struct cpufreq_policy *); + int (*resume)(struct cpufreq_policy *); + void (*ready)(struct cpufreq_policy *); + struct freq_attr **attr; + bool boost_enabled; + int (*set_boost)(struct cpufreq_policy *, int); +}; + +struct cpufreq_stats { + unsigned int total_trans; + long long unsigned int last_time; + unsigned int max_state; + unsigned int state_num; + unsigned int last_index; + u64 *time_in_state; + unsigned int *freq_table; + unsigned int *trans_table; + unsigned int reset_pending; + long long unsigned int reset_time; +}; + +enum { + OD_NORMAL_SAMPLE = 0, + OD_SUB_SAMPLE = 1, +}; + +struct dbs_data { + struct gov_attr_set attr_set; + void *tuners; + unsigned int ignore_nice_load; + unsigned int sampling_rate; + unsigned int sampling_down_factor; + unsigned int up_threshold; + unsigned int io_is_busy; +}; + +struct policy_dbs_info { + struct cpufreq_policy *policy; + struct mutex update_mutex; + u64 last_sample_time; + s64 sample_delay_ns; + atomic_t work_count; + struct irq_work irq_work; + struct work_struct work; + struct dbs_data *dbs_data; + struct list_head list; + unsigned int rate_mult; + unsigned int idle_periods; + bool is_shared; + bool work_in_progress; +}; + +struct dbs_governor { + struct cpufreq_governor gov; + struct kobj_type kobj_type; + struct dbs_data *gdbs_data; + unsigned int (*gov_dbs_update)(struct cpufreq_policy *); + struct policy_dbs_info * (*alloc)(); + void (*free)(struct policy_dbs_info *); + int (*init)(struct dbs_data *); + void (*exit)(struct dbs_data *); + void (*start)(struct cpufreq_policy *); +}; + +struct od_ops { + unsigned int (*powersave_bias_target)(struct cpufreq_policy *, unsigned int, unsigned int); +}; + +struct od_policy_dbs_info { + struct policy_dbs_info policy_dbs; + unsigned int freq_lo; + unsigned int freq_lo_delay_us; + unsigned int freq_hi_delay_us; + unsigned int sample_type: 1; +}; + +struct od_dbs_tuners { + unsigned int powersave_bias; +}; + +struct cs_policy_dbs_info { + struct policy_dbs_info policy_dbs; + unsigned int down_skip; + unsigned int requested_freq; +}; + +struct cs_dbs_tuners { + unsigned int down_threshold; + unsigned int freq_step; +}; + +struct cpu_dbs_info { + u64 prev_cpu_idle; + u64 prev_update_time; + u64 prev_cpu_nice; + unsigned int prev_load; + struct update_util_data update_util; + struct policy_dbs_info *policy_dbs; +}; + +enum acpi_preferred_pm_profiles { + PM_UNSPECIFIED = 0, + PM_DESKTOP = 1, + PM_MOBILE = 2, + PM_WORKSTATION = 3, + PM_ENTERPRISE_SERVER = 4, + PM_SOHO_SERVER = 5, + PM_APPLIANCE_PC = 6, + PM_PERFORMANCE_SERVER = 7, + PM_TABLET = 8, +}; + +struct sample { + int32_t core_avg_perf; + int32_t busy_scaled; + u64 aperf; + u64 mperf; + u64 tsc; + u64 time; +}; + +struct pstate_data { + int current_pstate; + int min_pstate; + int max_pstate; + int max_pstate_physical; + int scaling; + int turbo_pstate; + unsigned int max_freq; + unsigned int turbo_freq; +}; + +struct vid_data { + int min; + int max; + int turbo; + int32_t ratio; +}; + +struct global_params { + bool no_turbo; + bool turbo_disabled; + bool turbo_disabled_mf; + int max_perf_pct; + int min_perf_pct; +}; + +struct cpudata { + int cpu; + unsigned int policy; + struct update_util_data update_util; + bool update_util_set; + struct pstate_data pstate; + struct vid_data vid; + u64 last_update; + u64 last_sample_time; + u64 aperf_mperf_shift; + u64 prev_aperf; + u64 prev_mperf; + u64 prev_tsc; + u64 prev_cummulative_iowait; + struct sample sample; + int32_t min_perf_ratio; + int32_t max_perf_ratio; + struct acpi_processor_performance acpi_perf_data; + bool valid_pss_table; + unsigned int iowait_boost; + s16 epp_powersave; + s16 epp_policy; + s16 epp_default; + s16 epp_cached; + u64 hwp_req_cached; + u64 hwp_cap_cached; + u64 last_io_update; + unsigned int sched_flags; + u32 hwp_boost_min; + bool suspended; +}; + +struct pstate_funcs { + int (*get_max)(); + int (*get_max_physical)(); + int (*get_min)(); + int (*get_turbo)(); + int (*get_scaling)(); + int (*get_aperf_mperf_shift)(); + u64 (*get_val)(struct cpudata *, int); + void (*get_vid)(struct cpudata *); +}; + +enum { + PSS = 0, + PPC = 1, +}; + +struct cpuidle_governor { + char name[16]; + struct list_head governor_list; + unsigned int rating; + int (*enable)(struct cpuidle_driver *, struct cpuidle_device *); + void (*disable)(struct cpuidle_driver *, struct cpuidle_device *); + int (*select)(struct cpuidle_driver *, struct cpuidle_device *, bool *); + void (*reflect)(struct cpuidle_device *, int); +}; + +struct cpuidle_state_kobj { + struct cpuidle_state *state; + struct cpuidle_state_usage *state_usage; + struct completion kobj_unregister; + struct kobject kobj; + struct cpuidle_device *device; +}; + +struct cpuidle_device_kobj { + struct cpuidle_device *dev; + struct completion kobj_unregister; + struct kobject kobj; +}; + +struct cpuidle_attr { + struct attribute attr; + ssize_t (*show)(struct cpuidle_device *, char *); + ssize_t (*store)(struct cpuidle_device *, const char *, size_t); +}; + +struct cpuidle_state_attr { + struct attribute attr; + ssize_t (*show)(struct cpuidle_state *, struct cpuidle_state_usage *, char *); + ssize_t (*store)(struct cpuidle_state *, struct cpuidle_state_usage *, const char *, size_t); +}; + +struct menu_device { + int needs_update; + int tick_wakeup; + u64 next_timer_ns; + unsigned int bucket; + unsigned int correction_factor[12]; + unsigned int intervals[8]; + int interval_ptr; +}; + +struct pci_dev___2; + +struct sdhci_pci_data { + struct pci_dev___2 *pdev; + int slotno; + int rst_n_gpio; + int cd_gpio; + int (*setup)(struct sdhci_pci_data *); + void (*cleanup)(struct sdhci_pci_data *); +}; + +struct led_properties { + u32 color; + bool color_present; + const char *function; + u32 func_enum; + bool func_enum_present; + const char *label; +}; + +struct dmi_memdev_info { + const char *device; + const char *bank; + u64 size; + u16 handle; + u8 type; +}; + +struct dmi_sysfs_entry { + struct dmi_header dh; + struct kobject kobj; + int instance; + int position; + struct list_head list; + struct kobject *child; +}; + +struct dmi_sysfs_attribute { + struct attribute attr; + ssize_t (*show)(struct dmi_sysfs_entry *, char *); +}; + +struct dmi_sysfs_mapped_attribute { + struct attribute attr; + ssize_t (*show)(struct dmi_sysfs_entry *, const struct dmi_header *, char *); +}; + +typedef ssize_t (*dmi_callback)(struct dmi_sysfs_entry *, const struct dmi_header *, void *); + +struct find_dmi_data { + struct dmi_sysfs_entry *entry; + dmi_callback callback; + void *private; + int instance_countdown; + ssize_t ret; +}; + +struct dmi_read_state { + char *buf; + loff_t pos; + size_t count; +}; + +struct dmi_entry_attr_show_data { + struct attribute *attr; + char *buf; +}; + +struct dmi_system_event_log { + struct dmi_header header; + u16 area_length; + u16 header_start_offset; + u16 data_start_offset; + u8 access_method; + u8 status; + u32 change_token; + union { + struct { + u16 index_addr; + u16 data_addr; + } io; + u32 phys_addr32; + u16 gpnv_handle; + u32 access_method_address; + }; + u8 header_format; + u8 type_descriptors_supported_count; + u8 per_log_type_descriptor_length; + u8 supported_log_type_descriptos[0]; +} __attribute__((packed)); + +typedef u8 (*sel_io_reader)(const struct dmi_system_event_log *, loff_t); + +struct dmi_device_attribute { + struct device_attribute dev_attr; + int field; +}; + +struct mafield { + const char *prefix; + int field; +}; + +struct acpi_table_ibft { + struct acpi_table_header header; + u8 reserved[12]; +}; + +struct firmware_map_entry { + u64 start; + u64 end; + const char *type; + struct list_head list; + struct kobject kobj; +}; + +struct memmap_attribute { + struct attribute attr; + ssize_t (*show)(struct firmware_map_entry *, char *); +}; + +struct bmp_header { + u16 id; + u32 size; +} __attribute__((packed)); + +typedef efi_status_t efi_query_variable_store_t(u32, long unsigned int, bool); + +typedef struct { + u16 version; + u16 length; + u32 runtime_services_supported; +} efi_rt_properties_table_t; + +struct efivar_operations { + efi_get_variable_t *get_variable; + efi_get_next_variable_t *get_next_variable; + efi_set_variable_t *set_variable; + efi_set_variable_t *set_variable_nonblocking; + efi_query_variable_store_t *query_variable_store; +}; + +struct efivars { + struct kset *kset; + struct kobject *kobject; + const struct efivar_operations *ops; +}; + +struct linux_efi_random_seed { + u32 size; + u8 bits[0]; +}; + +struct linux_efi_memreserve { + int size; + atomic_t count; + phys_addr_t next; + struct { + phys_addr_t base; + phys_addr_t size; + } entry[0]; +}; + +struct efi_error_code { + efi_status_t status; + int errno; + const char *description; +}; + +struct efi_generic_dev_path { + u8 type; + u8 sub_type; + u16 length; +}; + +struct variable_validate { + efi_guid_t vendor; + char *name; + bool (*validate)(efi_char16_t *, int, u8 *, long unsigned int); +}; + +typedef struct { + u32 version; + u32 num_entries; + u32 desc_size; + u32 reserved; + efi_memory_desc_t entry[0]; +} efi_memory_attributes_table_t; + +struct efi_system_resource_entry_v1 { + efi_guid_t fw_class; + u32 fw_type; + u32 fw_version; + u32 lowest_supported_fw_version; + u32 capsule_flags; + u32 last_attempt_version; + u32 last_attempt_status; +}; + +struct efi_system_resource_table { + u32 fw_resource_count; + u32 fw_resource_count_max; + u64 fw_resource_version; + u8 entries[0]; +}; + +struct esre_entry { + union { + struct efi_system_resource_entry_v1 *esre1; + } esre; + struct kobject kobj; + struct list_head list; +}; + +struct esre_attribute { + struct attribute attr; + ssize_t (*show)(struct esre_entry *, char *); + ssize_t (*store)(struct esre_entry *, const char *, size_t); +}; + +struct cper_sec_proc_generic { + u64 validation_bits; + u8 proc_type; + u8 proc_isa; + u8 proc_error_type; + u8 operation; + u8 flags; + u8 level; + u16 reserved; + u64 cpu_version; + char cpu_brand[128]; + u64 proc_id; + u64 target_addr; + u64 requestor_id; + u64 responder_id; + u64 ip; +}; + +struct cper_sec_proc_ia { + u64 validation_bits; + u64 lapic_id; + u8 cpuid[48]; +}; + +struct cper_mem_err_compact { + u64 validation_bits; + u16 node; + u16 card; + u16 module; + u16 bank; + u16 device; + u16 row; + u16 column; + u16 bit_pos; + u64 requestor_id; + u64 responder_id; + u64 target_id; + u16 rank; + u16 mem_array_handle; + u16 mem_dev_handle; + u8 extended; +} __attribute__((packed)); + +struct cper_sec_fw_err_rec_ref { + u8 record_type; + u8 revision; + u8 reserved[6]; + u64 record_identifier; + guid_t record_identifier_guid; +}; + +struct efi_runtime_map_entry { + efi_memory_desc_t md; + struct kobject kobj; +}; + +struct map_attribute { + struct attribute attr; + ssize_t (*show)(struct efi_runtime_map_entry *, char *); +}; + +struct efi_acpi_dev_path { + struct efi_generic_dev_path header; + u32 hid; + u32 uid; +}; + +struct efi_pci_dev_path { + struct efi_generic_dev_path header; + u8 fn; + u8 dev; +}; + +struct efi_vendor_dev_path { + struct efi_generic_dev_path header; + efi_guid_t vendorguid; + u8 vendordata[0]; +}; + +struct efi_dev_path { + union { + struct efi_generic_dev_path header; + struct efi_acpi_dev_path acpi; + struct efi_pci_dev_path pci; + struct efi_vendor_dev_path vendor; + }; +}; + +struct acpi_hid_uid { + struct acpi_device_id hid[2]; + char uid[11]; +}; + +struct dev_header { + u32 len; + u32 prop_count; + struct efi_dev_path path[0]; +}; + +struct properties_header { + u32 len; + u32 version; + u32 dev_count; + struct dev_header dev_header[0]; +}; + +struct efi_embedded_fw { + struct list_head list; + const char *name; + const u8 *data; + size_t length; +}; + +struct efi_embedded_fw_desc { + const char *name; + u8 prefix[8]; + u32 length; + u8 sha256[32]; +}; + +struct efi_mokvar_sysfs_attr { + struct bin_attribute bin_attr; + struct list_head node; +}; + +struct cper_ia_err_info { + guid_t err_type; + u64 validation_bits; + u64 check_info; + u64 target_id; + u64 requestor_id; + u64 responder_id; + u64 ip; +}; + +enum err_types { + ERR_TYPE_CACHE = 0, + ERR_TYPE_TLB = 1, + ERR_TYPE_BUS = 2, + ERR_TYPE_MS = 3, + N_ERR_TYPES = 4, +}; + +struct hid_device_id { + __u16 bus; + __u16 group; + __u32 vendor; + __u32 product; + kernel_ulong_t driver_data; +}; + +struct hid_item { + unsigned int format; + __u8 size; + __u8 type; + __u8 tag; + union { + __u8 u8; + __s8 s8; + __u16 u16; + __s16 s16; + __u32 u32; + __s32 s32; + __u8 *longdata; + } data; +}; + +struct hid_global { + unsigned int usage_page; + __s32 logical_minimum; + __s32 logical_maximum; + __s32 physical_minimum; + __s32 physical_maximum; + __s32 unit_exponent; + unsigned int unit; + unsigned int report_id; + unsigned int report_size; + unsigned int report_count; +}; + +struct hid_local { + unsigned int usage[12288]; + u8 usage_size[12288]; + unsigned int collection_index[12288]; + unsigned int usage_index; + unsigned int usage_minimum; + unsigned int delimiter_depth; + unsigned int delimiter_branch; +}; + +struct hid_collection { + int parent_idx; + unsigned int type; + unsigned int usage; + unsigned int level; +}; + +struct hid_usage { + unsigned int hid; + unsigned int collection_index; + unsigned int usage_index; + __s8 resolution_multiplier; + __s8 wheel_factor; + __u16 code; + __u8 type; + __s8 hat_min; + __s8 hat_max; + __s8 hat_dir; + __s16 wheel_accumulated; +}; + +struct hid_report; + +struct hid_input; + +struct hid_field { + unsigned int physical; + unsigned int logical; + unsigned int application; + struct hid_usage *usage; + unsigned int maxusage; + unsigned int flags; + unsigned int report_offset; + unsigned int report_size; + unsigned int report_count; + unsigned int report_type; + __s32 *value; + __s32 logical_minimum; + __s32 logical_maximum; + __s32 physical_minimum; + __s32 physical_maximum; + __s32 unit_exponent; + unsigned int unit; + struct hid_report *report; + unsigned int index; + struct hid_input *hidinput; + __u16 dpad; +}; + +struct hid_device; + +struct hid_report { + struct list_head list; + struct list_head hidinput_list; + unsigned int id; + unsigned int type; + unsigned int application; + struct hid_field *field[256]; + unsigned int maxfield; + unsigned int size; + struct hid_device *device; +}; + +struct hid_input { + struct list_head list; + struct hid_report *report; + struct input_dev *input; + const char *name; + bool registered; + struct list_head reports; + unsigned int application; +}; + +enum hid_type { + HID_TYPE_OTHER = 0, + HID_TYPE_USBMOUSE = 1, + HID_TYPE_USBNONE = 2, +}; + +struct hid_report_enum { + unsigned int numbered; + struct list_head report_list; + struct hid_report *report_id_hash[256]; +}; + +enum hid_battery_status { + HID_BATTERY_UNKNOWN = 0, + HID_BATTERY_QUERIED = 1, + HID_BATTERY_REPORTED = 2, +}; + +struct hid_driver; + +struct hid_ll_driver; + +struct hid_device { + __u8 *dev_rdesc; + unsigned int dev_rsize; + __u8 *rdesc; + unsigned int rsize; + struct hid_collection *collection; + unsigned int collection_size; + unsigned int maxcollection; + unsigned int maxapplication; + __u16 bus; + __u16 group; + __u32 vendor; + __u32 product; + __u32 version; + enum hid_type type; + unsigned int country; + struct hid_report_enum report_enum[3]; + struct work_struct led_work; + struct semaphore driver_input_lock; + struct device dev; + struct hid_driver *driver; + struct hid_ll_driver *ll_driver; + struct mutex ll_open_lock; + unsigned int ll_open_count; + struct power_supply *battery; + __s32 battery_capacity; + __s32 battery_min; + __s32 battery_max; + __s32 battery_report_type; + __s32 battery_report_id; + enum hid_battery_status battery_status; + bool battery_avoid_query; + ktime_t battery_ratelimit_time; + long unsigned int status; + unsigned int claimed; + unsigned int quirks; + bool io_started; + struct list_head inputs; + void *hiddev; + void *hidraw; + char name[128]; + char phys[64]; + char uniq[64]; + void *driver_data; + int (*ff_init)(struct hid_device *); + int (*hiddev_connect)(struct hid_device *, unsigned int); + void (*hiddev_disconnect)(struct hid_device *); + void (*hiddev_hid_event)(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); + void (*hiddev_report_event)(struct hid_device *, struct hid_report *); + short unsigned int debug; + struct dentry *debug_dir; + struct dentry *debug_rdesc; + struct dentry *debug_events; + struct list_head debug_list; + spinlock_t debug_list_lock; + wait_queue_head_t debug_wait; +}; + +struct hid_report_id; + +struct hid_usage_id; + +struct hid_driver { + char *name; + const struct hid_device_id *id_table; + struct list_head dyn_list; + spinlock_t dyn_lock; + bool (*match)(struct hid_device *, bool); + int (*probe)(struct hid_device *, const struct hid_device_id *); + void (*remove)(struct hid_device *); + const struct hid_report_id *report_table; + int (*raw_event)(struct hid_device *, struct hid_report *, u8 *, int); + const struct hid_usage_id *usage_table; + int (*event)(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); + void (*report)(struct hid_device *, struct hid_report *); + __u8 * (*report_fixup)(struct hid_device *, __u8 *, unsigned int *); + int (*input_mapping)(struct hid_device *, struct hid_input *, struct hid_field *, struct hid_usage *, long unsigned int **, int *); + int (*input_mapped)(struct hid_device *, struct hid_input *, struct hid_field *, struct hid_usage *, long unsigned int **, int *); + int (*input_configured)(struct hid_device *, struct hid_input *); + void (*feature_mapping)(struct hid_device *, struct hid_field *, struct hid_usage *); + int (*suspend)(struct hid_device *, pm_message_t); + int (*resume)(struct hid_device *); + int (*reset_resume)(struct hid_device *); + struct device_driver driver; +}; + +struct hid_ll_driver { + int (*start)(struct hid_device *); + void (*stop)(struct hid_device *); + int (*open)(struct hid_device *); + void (*close)(struct hid_device *); + int (*power)(struct hid_device *, int); + int (*parse)(struct hid_device *); + void (*request)(struct hid_device *, struct hid_report *, int); + int (*wait)(struct hid_device *); + int (*raw_request)(struct hid_device *, unsigned char, __u8 *, size_t, unsigned char, int); + int (*output_report)(struct hid_device *, __u8 *, size_t); + int (*idle)(struct hid_device *, int, int, int); +}; + +struct hid_parser { + struct hid_global global; + struct hid_global global_stack[4]; + unsigned int global_stack_ptr; + struct hid_local local; + unsigned int *collection_stack; + unsigned int collection_stack_ptr; + unsigned int collection_stack_size; + struct hid_device *device; + unsigned int scan_flags; +}; + +struct hid_report_id { + __u32 report_type; +}; + +struct hid_usage_id { + __u32 usage_hid; + __u32 usage_type; + __u32 usage_code; +}; + +struct hiddev { + int minor; + int exist; + int open; + struct mutex existancelock; + wait_queue_head_t wait; + struct hid_device *hid; + struct list_head list; + spinlock_t list_lock; + bool initialized; +}; + +struct hidraw { + unsigned int minor; + int exist; + int open; + wait_queue_head_t wait; + struct hid_device *hid; + struct device *dev; + spinlock_t list_lock; + struct list_head list; +}; + +struct hid_dynid { + struct list_head list; + struct hid_device_id id; +}; + +typedef bool (*hid_usage_cmp_t)(struct hid_usage *, unsigned int, unsigned int); + +struct quirks_list_struct { + struct hid_device_id hid_bl_item; + struct list_head node; +}; + +struct hid_debug_list { + struct { + union { + struct __kfifo kfifo; + char *type; + const char *const_type; + char (*rectype)[0]; + char *ptr; + const char *ptr_const; + }; + char buf[0]; + } hid_debug_fifo; + struct fasync_struct *fasync; + struct hid_device *hdev; + struct list_head node; + struct mutex read_mutex; +}; + +struct hid_usage_entry { + unsigned int page; + unsigned int usage; + const char *description; +}; + +struct hidraw_devinfo { + __u32 bustype; + __s16 vendor; + __s16 product; +}; + +struct hidraw_report { + __u8 *value; + int len; +}; + +struct hidraw_list { + struct hidraw_report buffer[64]; + int head; + int tail; + struct fasync_struct *fasync; + struct hidraw *hidraw; + struct list_head node; + struct mutex read_mutex; +}; + +struct magicmouse_sc { + struct input_dev *input; + long unsigned int quirks; + int ntouches; + int scroll_accel; + long unsigned int scroll_jiffies; + struct { + short int x; + short int y; + short int scroll_x; + short int scroll_y; + u8 size; + } touches[16]; + int tracking_ids[16]; +}; + +struct ntrig_data { + __u16 x; + __u16 y; + __u16 w; + __u16 h; + __u16 id; + bool tipswitch; + bool confidence; + bool first_contact_touch; + bool reading_mt; + __u8 mt_footer[4]; + __u8 mt_foot_count; + __s8 act_state; + __s8 deactivate_slack; + __s8 activate_slack; + __u16 min_width; + __u16 min_height; + __u16 activation_width; + __u16 activation_height; + __u16 sensor_logical_width; + __u16 sensor_logical_height; + __u16 sensor_physical_width; + __u16 sensor_physical_height; +}; + +struct hid_control_fifo { + unsigned char dir; + struct hid_report *report; + char *raw_report; +}; + +struct hid_output_fifo { + struct hid_report *report; + char *raw_report; +}; + +struct hid_class_descriptor { + __u8 bDescriptorType; + __le16 wDescriptorLength; +} __attribute__((packed)); + +struct hid_descriptor { + __u8 bLength; + __u8 bDescriptorType; + __le16 bcdHID; + __u8 bCountryCode; + __u8 bNumDescriptors; + struct hid_class_descriptor desc[1]; +} __attribute__((packed)); + +struct usbhid_device { + struct hid_device *hid; + struct usb_interface *intf; + int ifnum; + unsigned int bufsize; + struct urb *urbin; + char *inbuf; + dma_addr_t inbuf_dma; + struct urb *urbctrl; + struct usb_ctrlrequest *cr; + struct hid_control_fifo ctrl[256]; + unsigned char ctrlhead; + unsigned char ctrltail; + char *ctrlbuf; + dma_addr_t ctrlbuf_dma; + long unsigned int last_ctrl; + struct urb *urbout; + struct hid_output_fifo out[256]; + unsigned char outhead; + unsigned char outtail; + char *outbuf; + dma_addr_t outbuf_dma; + long unsigned int last_out; + struct mutex mutex; + spinlock_t lock; + long unsigned int iofl; + struct timer_list io_retry; + long unsigned int stop_retry; + unsigned int retry_delay; + struct work_struct reset_work; + wait_queue_head_t wait; +}; + +struct hiddev_event { + unsigned int hid; + int value; +}; + +struct hiddev_devinfo { + __u32 bustype; + __u32 busnum; + __u32 devnum; + __u32 ifnum; + __s16 vendor; + __s16 product; + __s16 version; + __u32 num_applications; +}; + +struct hiddev_collection_info { + __u32 index; + __u32 type; + __u32 usage; + __u32 level; +}; + +struct hiddev_report_info { + __u32 report_type; + __u32 report_id; + __u32 num_fields; +}; + +struct hiddev_field_info { + __u32 report_type; + __u32 report_id; + __u32 field_index; + __u32 maxusage; + __u32 flags; + __u32 physical; + __u32 logical; + __u32 application; + __s32 logical_minimum; + __s32 logical_maximum; + __s32 physical_minimum; + __s32 physical_maximum; + __u32 unit_exponent; + __u32 unit; +}; + +struct hiddev_usage_ref { + __u32 report_type; + __u32 report_id; + __u32 field_index; + __u32 usage_index; + __u32 usage_code; + __s32 value; +}; + +struct hiddev_usage_ref_multi { + struct hiddev_usage_ref uref; + __u32 num_values; + __s32 values[1024]; +}; + +struct hiddev_list { + struct hiddev_usage_ref buffer[2048]; + int head; + int tail; + unsigned int flags; + struct fasync_struct *fasync; + struct hiddev *hiddev; + struct list_head node; + struct mutex thread_lock; +}; + +struct pidff_usage { + struct hid_field *field; + s32 *value; +}; + +struct pidff_device { + struct hid_device *hid; + struct hid_report *reports[13]; + struct pidff_usage set_effect[7]; + struct pidff_usage set_envelope[5]; + struct pidff_usage set_condition[8]; + struct pidff_usage set_periodic[5]; + struct pidff_usage set_constant[2]; + struct pidff_usage set_ramp[3]; + struct pidff_usage device_gain[1]; + struct pidff_usage block_load[2]; + struct pidff_usage pool[3]; + struct pidff_usage effect_operation[2]; + struct pidff_usage block_free[1]; + struct hid_field *create_new_effect_type; + struct hid_field *set_effect_type; + struct hid_field *effect_direction; + struct hid_field *device_control; + struct hid_field *block_load_status; + struct hid_field *effect_operation_status; + int control_id[2]; + int type_id[11]; + int status_id[2]; + int operation_id[2]; + int pid_id[64]; +}; + +struct ts_dmi_data { + struct efi_embedded_fw_desc embedded_fw; + const char *acpi_name; + const struct property_entry *properties; +}; + +enum ppfear_regs { + SPT_PMC_XRAM_PPFEAR0A = 1424, + SPT_PMC_XRAM_PPFEAR0B = 1425, + SPT_PMC_XRAM_PPFEAR0C = 1426, + SPT_PMC_XRAM_PPFEAR0D = 1427, + SPT_PMC_XRAM_PPFEAR1A = 1428, +}; + +struct pmc_bit_map { + const char *name; + u32 bit_mask; +}; + +struct pmc_reg_map { + const struct pmc_bit_map **pfear_sts; + const struct pmc_bit_map *mphy_sts; + const struct pmc_bit_map *pll_sts; + const struct pmc_bit_map **slps0_dbg_maps; + const struct pmc_bit_map *ltr_show_sts; + const struct pmc_bit_map *msr_sts; + const struct pmc_bit_map **lpm_sts; + const u32 slp_s0_offset; + const int slp_s0_res_counter_step; + const u32 ltr_ignore_offset; + const int regmap_length; + const u32 ppfear0_offset; + const int ppfear_buckets; + const u32 pm_cfg_offset; + const int pm_read_disable_bit; + const u32 slps0_dbg_offset; + const u32 ltr_ignore_max; + const u32 pm_vric1_offset; + const char **lpm_modes; + const u32 lpm_en_offset; + const u32 lpm_residency_offset; + const u32 lpm_status_offset; + const u32 lpm_live_status_offset; +}; + +struct pmc_dev { + u32 base_addr; + void *regbase; + const struct pmc_reg_map *map; + struct dentry *dbgfs_dir; + int pmc_xram_read_bit; + struct mutex lock; + bool check_counters; + u64 pc10_counter; + u64 s0ix_counter; +}; + +struct intel_scu_ipc_data { + struct resource mem; + int irq; +}; + +struct intel_scu_ipc_dev___2 { + struct device dev; + struct resource mem; + struct module *owner; + int irq; + void *ipc_base; + struct completion cmd_complete; +}; + +struct intel_scu_ipc_devres { + struct intel_scu_ipc_dev___2 *scu; +}; + +struct pmc_reg_map___2 { + const struct pmc_bit_map *d3_sts_0; + const struct pmc_bit_map *d3_sts_1; + const struct pmc_bit_map *func_dis; + const struct pmc_bit_map *func_dis_2; + const struct pmc_bit_map *pss; +}; + +struct pmc_data { + const struct pmc_reg_map___2 *map; + const struct pmc_clk *clks; +}; + +struct pmc_dev___2 { + u32 base_addr; + void *regmap; + const struct pmc_reg_map___2 *map; + struct dentry *dbgfs_dir; + bool init; +}; + +struct acpi_table_pcct { + struct acpi_table_header header; + u32 flags; + u64 reserved; +}; + +enum acpi_pcct_type { + ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, + ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, + ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, + ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3, + ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4, + ACPI_PCCT_TYPE_RESERVED = 5, +}; + +struct acpi_pcct_subspace { + struct acpi_subtable_header header; + u8 reserved[6]; + u64 base_address; + u64 length; + struct acpi_generic_address doorbell_register; + u64 preserve_mask; + u64 write_mask; + u32 latency; + u32 max_access_rate; + u16 min_turnaround_time; +} __attribute__((packed)); + +struct acpi_pcct_hw_reduced_type2 { + struct acpi_subtable_header header; + u32 platform_interrupt; + u8 flags; + u8 reserved; + u64 base_address; + u64 length; + struct acpi_generic_address doorbell_register; + u64 preserve_mask; + u64 write_mask; + u32 latency; + u32 max_access_rate; + u16 min_turnaround_time; + struct acpi_generic_address platform_ack_register; + u64 ack_preserve_mask; + u64 ack_write_mask; +} __attribute__((packed)); + +struct hwspinlock___2; + +struct hwspinlock_ops { + int (*trylock)(struct hwspinlock___2 *); + void (*unlock)(struct hwspinlock___2 *); + void (*relax)(struct hwspinlock___2 *); +}; + +struct hwspinlock_device; + +struct hwspinlock___2 { + struct hwspinlock_device *bank; + spinlock_t lock; + void *priv; +}; + +struct hwspinlock_device { + struct device *dev; + const struct hwspinlock_ops *ops; + int base_id; + int num_locks; + struct hwspinlock___2 lock[0]; +}; + +struct resource_table { + u32 ver; + u32 num; + u32 reserved[2]; + u32 offset[0]; +}; + +struct fw_rsc_hdr { + u32 type; + u8 data[0]; +}; + +enum fw_resource_type { + RSC_CARVEOUT = 0, + RSC_DEVMEM = 1, + RSC_TRACE = 2, + RSC_VDEV = 3, + RSC_LAST = 4, + RSC_VENDOR_START = 128, + RSC_VENDOR_END = 512, +}; + +struct fw_rsc_carveout { + u32 da; + u32 pa; + u32 len; + u32 flags; + u32 reserved; + u8 name[32]; +}; + +struct fw_rsc_devmem { + u32 da; + u32 pa; + u32 len; + u32 flags; + u32 reserved; + u8 name[32]; +}; + +struct fw_rsc_trace { + u32 da; + u32 len; + u32 reserved; + u8 name[32]; +}; + +struct fw_rsc_vdev_vring { + u32 da; + u32 align; + u32 num; + u32 notifyid; + u32 pa; +}; + +struct fw_rsc_vdev { + u32 id; + u32 notifyid; + u32 dfeatures; + u32 gfeatures; + u32 config_len; + u8 status; + u8 num_of_vrings; + u8 reserved[2]; + struct fw_rsc_vdev_vring vring[0]; +}; + +struct rproc; + +struct rproc_mem_entry { + void *va; + dma_addr_t dma; + size_t len; + u32 da; + void *priv; + char name[32]; + struct list_head node; + u32 rsc_offset; + u32 flags; + u32 of_resm_idx; + int (*alloc)(struct rproc *, struct rproc_mem_entry *); + int (*release)(struct rproc *, struct rproc_mem_entry *); +}; + +enum rproc_dump_mechanism { + RPROC_COREDUMP_DISABLED = 0, + RPROC_COREDUMP_ENABLED = 1, + RPROC_COREDUMP_INLINE = 2, +}; + +struct rproc_ops; + +struct rproc { + struct list_head node; + struct iommu_domain *domain; + const char *name; + const char *firmware; + void *priv; + struct rproc_ops *ops; + struct device dev; + atomic_t power; + unsigned int state; + enum rproc_dump_mechanism dump_conf; + struct mutex lock; + struct dentry *dbg_dir; + struct list_head traces; + int num_traces; + struct list_head carveouts; + struct list_head mappings; + u64 bootaddr; + struct list_head rvdevs; + struct list_head subdevs; + struct idr notifyids; + int index; + struct work_struct crash_handler; + unsigned int crash_cnt; + bool recovery_disabled; + int max_notifyid; + struct resource_table *table_ptr; + struct resource_table *cached_table; + size_t table_sz; + bool has_iommu; + bool auto_boot; + bool autonomous; + struct list_head dump_segments; + int nb_vdev; + u8 elf_class; + u16 elf_machine; + struct cdev cdev; + bool cdev_put_on_release; +}; + +enum rsc_handling_status { + RSC_HANDLED = 0, + RSC_IGNORED = 1, +}; + +struct rproc_ops { + int (*prepare)(struct rproc *); + int (*unprepare)(struct rproc *); + int (*start)(struct rproc *); + int (*stop)(struct rproc *); + int (*attach)(struct rproc *); + void (*kick)(struct rproc *, int); + void * (*da_to_va)(struct rproc *, u64, size_t); + int (*parse_fw)(struct rproc *, const struct firmware *); + int (*handle_rsc)(struct rproc *, u32, void *, int, int); + struct resource_table * (*find_loaded_rsc_table)(struct rproc *, const struct firmware *); + int (*load)(struct rproc *, const struct firmware *); + int (*sanity_check)(struct rproc *, const struct firmware *); + u64 (*get_boot_addr)(struct rproc *, const struct firmware *); + long unsigned int (*panic)(struct rproc *); + void (*coredump)(struct rproc *); +}; + +enum rproc_state { + RPROC_OFFLINE = 0, + RPROC_SUSPENDED = 1, + RPROC_RUNNING = 2, + RPROC_CRASHED = 3, + RPROC_DELETED = 4, + RPROC_DETACHED = 5, + RPROC_LAST = 6, +}; + +enum rproc_crash_type { + RPROC_MMUFAULT = 0, + RPROC_WATCHDOG = 1, + RPROC_FATAL_ERROR = 2, +}; + +struct rproc_subdev { + struct list_head node; + int (*prepare)(struct rproc_subdev *); + int (*start)(struct rproc_subdev *); + void (*stop)(struct rproc_subdev *, bool); + void (*unprepare)(struct rproc_subdev *); +}; + +struct rproc_vdev; + +struct rproc_vring { + void *va; + int len; + u32 da; + u32 align; + int notifyid; + struct rproc_vdev *rvdev; + struct virtqueue *vq; +}; + +struct rproc_vdev { + struct kref refcount; + struct rproc_subdev subdev; + struct device dev; + unsigned int id; + struct list_head node; + struct rproc *rproc; + struct rproc_vring vring[2]; + u32 rsc_offset; + u32 index; +}; + +struct rproc_debug_trace { + struct rproc *rproc; + struct dentry *tfile; + struct list_head node; + struct rproc_mem_entry trace_mem; +}; + +typedef int (*rproc_handle_resource_t)(struct rproc *, void *, int, int); + +struct rproc_dump_segment { + struct list_head node; + dma_addr_t da; + size_t size; + void *priv; + void (*dump)(struct rproc *, struct rproc_dump_segment *, void *, size_t, size_t); + loff_t offset; +}; + +struct rproc_coredump_state { + struct rproc *rproc; + void *header; + struct completion dump_done; +}; + +struct sdw_device_id { + __u16 mfg_id; + __u16 part_id; + __u8 sdw_version; + __u8 class_id; + kernel_ulong_t driver_data; +}; + +enum sdw_slave_status { + SDW_SLAVE_UNATTACHED = 0, + SDW_SLAVE_ATTACHED = 1, + SDW_SLAVE_ALERT = 2, + SDW_SLAVE_RESERVED = 3, +}; + +enum sdw_clk_stop_type { + SDW_CLK_PRE_PREPARE = 0, + SDW_CLK_POST_PREPARE = 1, + SDW_CLK_PRE_DEPREPARE = 2, + SDW_CLK_POST_DEPREPARE = 3, +}; + +enum sdw_command_response { + SDW_CMD_OK = 0, + SDW_CMD_IGNORED = 1, + SDW_CMD_FAIL = 2, + SDW_CMD_TIMEOUT = 3, + SDW_CMD_FAIL_OTHER = 4, +}; + +enum sdw_clk_stop_reset_behave { + SDW_CLK_STOP_KEEP_STATUS = 1, +}; + +enum sdw_p15_behave { + SDW_P15_READ_IGNORED = 0, + SDW_P15_CMD_OK = 1, +}; + +enum sdw_dpn_type { + SDW_DPN_FULL = 0, + SDW_DPN_SIMPLE = 1, + SDW_DPN_REDUCED = 2, +}; + +enum sdw_clk_stop_mode { + SDW_CLK_STOP_MODE0 = 0, + SDW_CLK_STOP_MODE1 = 1, +}; + +struct sdw_dp0_prop { + u32 max_word; + u32 min_word; + u32 num_words; + u32 *words; + bool BRA_flow_controlled; + bool simple_ch_prep_sm; + bool imp_def_interrupts; +}; + +struct sdw_dpn_audio_mode { + u32 bus_min_freq; + u32 bus_max_freq; + u32 bus_num_freq; + u32 *bus_freq; + u32 max_freq; + u32 min_freq; + u32 num_freq; + u32 *freq; + u32 prep_ch_behave; + u32 glitchless; +}; + +struct sdw_dpn_prop { + u32 num; + u32 max_word; + u32 min_word; + u32 num_words; + u32 *words; + enum sdw_dpn_type type; + u32 max_grouping; + bool simple_ch_prep_sm; + u32 ch_prep_timeout; + u32 imp_def_interrupts; + u32 max_ch; + u32 min_ch; + u32 num_channels; + u32 *channels; + u32 num_ch_combinations; + u32 *ch_combinations; + u32 modes; + u32 max_async_buffer; + bool block_pack_mode; + bool read_only_wordlength; + u32 port_encoding; + struct sdw_dpn_audio_mode *audio_modes; +}; + +struct sdw_slave_prop { + u32 mipi_revision; + bool wake_capable; + bool test_mode_capable; + bool clk_stop_mode1; + bool simple_clk_stop_capable; + u32 clk_stop_timeout; + u32 ch_prep_timeout; + enum sdw_clk_stop_reset_behave reset_behave; + bool high_PHY_capable; + bool paging_support; + bool bank_delay_support; + enum sdw_p15_behave p15_behave; + bool lane_control_support; + u32 master_count; + u32 source_ports; + u32 sink_ports; + struct sdw_dp0_prop *dp0_prop; + struct sdw_dpn_prop *src_dpn_prop; + struct sdw_dpn_prop *sink_dpn_prop; + u8 scp_int1_mask; + u32 quirks; + bool is_sdca; +}; + +struct sdw_master_prop { + u32 revision; + u32 clk_stop_modes; + u32 max_clk_freq; + u32 num_clk_gears; + u32 *clk_gears; + u32 num_clk_freq; + u32 *clk_freq; + u32 default_frame_rate; + u32 default_row; + u32 default_col; + bool dynamic_frame; + u32 err_threshold; + u32 mclk_freq; + bool hw_disabled; +}; + +struct sdw_slave_id { + __u16 mfg_id; + __u16 part_id; + __u8 class_id; + __u8 unique_id; + __u8 sdw_version: 4; +}; + +struct sdw_slave_intr_status { + bool sdca_cascade; + u8 control_port; + u8 port[15]; +}; + +enum sdw_reg_bank { + SDW_BANK0 = 0, + SDW_BANK1 = 1, +}; + +struct sdw_prepare_ch { + unsigned int num; + unsigned int ch_mask; + bool prepare; + unsigned int bank; +}; + +enum sdw_port_prep_ops { + SDW_OPS_PORT_PRE_PREP = 0, + SDW_OPS_PORT_PREP = 1, + SDW_OPS_PORT_POST_PREP = 2, +}; + +struct sdw_bus_params { + enum sdw_reg_bank curr_bank; + enum sdw_reg_bank next_bank; + unsigned int max_dr_freq; + unsigned int curr_dr_freq; + unsigned int bandwidth; + unsigned int col; + unsigned int row; + int s_data_mode; + int m_data_mode; +}; + +struct sdw_slave; + +struct sdw_slave_ops { + int (*read_prop)(struct sdw_slave *); + int (*interrupt_callback)(struct sdw_slave *, struct sdw_slave_intr_status *); + int (*update_status)(struct sdw_slave *, enum sdw_slave_status); + int (*bus_config)(struct sdw_slave *, struct sdw_bus_params *); + int (*port_prep)(struct sdw_slave *, struct sdw_prepare_ch *, enum sdw_port_prep_ops); + int (*get_clk_stop_mode)(struct sdw_slave *); + int (*clk_stop)(struct sdw_slave *, enum sdw_clk_stop_mode, enum sdw_clk_stop_type); +}; + +struct sdw_bus; + +struct sdw_slave { + struct sdw_slave_id id; + struct device dev; + enum sdw_slave_status status; + struct sdw_bus *bus; + const struct sdw_slave_ops *ops; + struct sdw_slave_prop prop; + struct dentry *debugfs; + struct list_head node; + struct completion port_ready[15]; + enum sdw_clk_stop_mode curr_clk_stop_mode; + u16 dev_num; + u16 dev_num_sticky; + bool probed; + struct completion probe_complete; + struct completion enumeration_complete; + struct completion initialization_complete; + u32 unattach_request; + bool first_interrupt_done; +}; + +struct sdw_msg; + +struct sdw_defer { + int length; + struct completion complete; + struct sdw_msg *msg; +}; + +struct sdw_master_device; + +struct sdw_master_ops; + +struct sdw_master_port_ops; + +struct sdw_bus { + struct device *dev; + struct sdw_master_device *md; + unsigned int link_id; + int id; + struct list_head slaves; + long unsigned int assigned[1]; + struct mutex bus_lock; + struct mutex msg_lock; + int (*compute_params)(struct sdw_bus *); + const struct sdw_master_ops *ops; + const struct sdw_master_port_ops *port_ops; + struct sdw_bus_params params; + struct sdw_master_prop prop; + struct list_head m_rt_list; + struct dentry *debugfs; + struct sdw_defer defer_msg; + unsigned int clk_stop_timeout; + u32 bank_switch_timeout; + bool multi_link; + int hw_sync_min_links; +}; + +struct sdw_master_device { + struct device dev; + struct sdw_bus *bus; +}; + +struct sdw_driver { + const char *name; + int (*probe)(struct sdw_slave *, const struct sdw_device_id *); + int (*remove)(struct sdw_slave *); + void (*shutdown)(struct sdw_slave *); + const struct sdw_device_id *id_table; + const struct sdw_slave_ops *ops; + struct device_driver driver; +}; + +struct sdw_port_params { + unsigned int num; + unsigned int bps; + unsigned int flow_mode; + unsigned int data_mode; +}; + +struct sdw_transport_params { + bool blk_grp_ctrl_valid; + unsigned int port_num; + unsigned int blk_grp_ctrl; + unsigned int sample_interval; + unsigned int offset1; + unsigned int offset2; + unsigned int hstart; + unsigned int hstop; + unsigned int blk_pkg_mode; + unsigned int lane_ctrl; +}; + +struct sdw_enable_ch { + unsigned int port_num; + unsigned int ch_mask; + bool enable; +}; + +struct sdw_master_port_ops { + int (*dpn_set_port_params)(struct sdw_bus *, struct sdw_port_params *, unsigned int); + int (*dpn_set_port_transport_params)(struct sdw_bus *, struct sdw_transport_params *, enum sdw_reg_bank); + int (*dpn_port_prep)(struct sdw_bus *, struct sdw_prepare_ch *); + int (*dpn_port_enable_ch)(struct sdw_bus *, struct sdw_enable_ch *, unsigned int); +}; + +struct sdw_msg { + u16 addr; + u16 len; + u8 dev_num; + u8 addr_page1; + u8 addr_page2; + u8 flags; + u8 *buf; + bool ssp_sync; + bool page; +}; + +struct sdw_master_ops { + int (*read_prop)(struct sdw_bus *); + enum sdw_command_response (*xfer_msg)(struct sdw_bus *, struct sdw_msg *); + enum sdw_command_response (*xfer_msg_defer)(struct sdw_bus *, struct sdw_msg *, struct sdw_defer *); + enum sdw_command_response (*reset_page_addr)(struct sdw_bus *, unsigned int); + int (*set_bus_conf)(struct sdw_bus *, struct sdw_bus_params *); + int (*pre_bank_switch)(struct sdw_bus *); + int (*post_bank_switch)(struct sdw_bus *); +}; + +enum sdw_port_data_mode { + SDW_PORT_DATA_MODE_NORMAL = 0, + SDW_PORT_DATA_MODE_PRBS = 1, + SDW_PORT_DATA_MODE_STATIC_0 = 2, + SDW_PORT_DATA_MODE_STATIC_1 = 3, +}; + +enum { + SDW_MSG_FLAG_READ = 0, + SDW_MSG_FLAG_WRITE = 1, +}; + +enum sdw_stream_type { + SDW_STREAM_PCM = 0, + SDW_STREAM_PDM = 1, +}; + +enum sdw_data_direction { + SDW_DATA_DIR_RX = 0, + SDW_DATA_DIR_TX = 1, +}; + +struct sdw_port_config { + unsigned int num; + unsigned int ch_mask; +}; + +struct sdw_stream_config { + unsigned int frame_rate; + unsigned int ch_count; + unsigned int bps; + enum sdw_data_direction direction; + enum sdw_stream_type type; +}; + +enum sdw_stream_state { + SDW_STREAM_ALLOCATED = 0, + SDW_STREAM_CONFIGURED = 1, + SDW_STREAM_PREPARED = 2, + SDW_STREAM_ENABLED = 3, + SDW_STREAM_DISABLED = 4, + SDW_STREAM_DEPREPARED = 5, + SDW_STREAM_RELEASED = 6, +}; + +struct sdw_stream_params { + unsigned int rate; + unsigned int ch_count; + unsigned int bps; +}; + +struct sdw_stream_runtime { + const char *name; + struct sdw_stream_params params; + enum sdw_stream_state state; + enum sdw_stream_type type; + struct list_head master_list; + int m_rt_count; +}; + +struct snd_shutdown_f_ops; + +struct snd_mixer_oss; + +struct snd_info_entry; + +struct snd_card { + int number; + char id[16]; + char driver[16]; + char shortname[32]; + char longname[80]; + char irq_descr[32]; + char mixername[80]; + char components[128]; + struct module *module; + void *private_data; + void (*private_free)(struct snd_card *); + struct list_head devices; + struct device ctl_dev; + unsigned int last_numid; + struct rw_semaphore controls_rwsem; + rwlock_t ctl_files_rwlock; + int controls_count; + int user_ctl_count; + struct list_head controls; + struct list_head ctl_files; + struct snd_info_entry *proc_root; + struct proc_dir_entry *proc_root_link; + struct list_head files_list; + struct snd_shutdown_f_ops *s_f_ops; + spinlock_t files_lock; + int shutdown; + struct completion *release_completion; + struct device *dev; + struct device card_dev; + const struct attribute_group *dev_groups[4]; + bool registered; + int sync_irq; + wait_queue_head_t remove_sleep; + size_t total_pcm_alloc_bytes; + struct mutex memory_mutex; + unsigned int power_state; + wait_queue_head_t power_sleep; + struct snd_mixer_oss *mixer_oss; + int mixer_oss_change_count; +}; + +struct snd_info_buffer; + +struct snd_info_entry_text { + void (*read)(struct snd_info_entry *, struct snd_info_buffer *); + void (*write)(struct snd_info_entry *, struct snd_info_buffer *); +}; + +struct snd_info_entry_ops; + +struct snd_info_entry { + const char *name; + umode_t mode; + long int size; + short unsigned int content; + union { + struct snd_info_entry_text text; + const struct snd_info_entry_ops *ops; + } c; + struct snd_info_entry *parent; + struct module *module; + void *private_data; + void (*private_free)(struct snd_info_entry *); + struct proc_dir_entry *p; + struct mutex access; + struct list_head children; + struct list_head list; +}; + +struct snd_aes_iec958 { + unsigned char status[24]; + unsigned char subcode[147]; + unsigned char pad; + unsigned char dig_subframe[4]; +}; + +typedef long unsigned int snd_pcm_uframes_t; + +typedef long int snd_pcm_sframes_t; + +enum { + SNDRV_PCM_STREAM_PLAYBACK = 0, + SNDRV_PCM_STREAM_CAPTURE = 1, + SNDRV_PCM_STREAM_LAST = 1, +}; + +typedef int snd_pcm_access_t; + +typedef int snd_pcm_format_t; + +typedef int snd_pcm_subformat_t; + +typedef int snd_pcm_state_t; + +union snd_pcm_sync_id { + unsigned char id[16]; + short unsigned int id16[8]; + unsigned int id32[4]; +}; + +struct snd_interval { + unsigned int min; + unsigned int max; + unsigned int openmin: 1; + unsigned int openmax: 1; + unsigned int integer: 1; + unsigned int empty: 1; +}; + +struct snd_mask { + __u32 bits[8]; +}; + +struct snd_pcm_hw_params { + unsigned int flags; + struct snd_mask masks[3]; + struct snd_mask mres[5]; + struct snd_interval intervals[12]; + struct snd_interval ires[9]; + unsigned int rmask; + unsigned int cmask; + unsigned int info; + unsigned int msbits; + unsigned int rate_num; + unsigned int rate_den; + snd_pcm_uframes_t fifo_size; + unsigned char reserved[64]; +}; + +typedef char __pad_before_uframe[0]; + +typedef char __pad_after_uframe[0]; + +struct snd_pcm_mmap_status { + snd_pcm_state_t state; + __u32 pad1; + __pad_before_uframe __pad1; + snd_pcm_uframes_t hw_ptr; + __pad_after_uframe __pad2; + struct __kernel_timespec tstamp; + snd_pcm_state_t suspended_state; + __u32 pad3; + struct __kernel_timespec audio_tstamp; +}; + +struct snd_pcm_mmap_control { + __pad_before_uframe __pad1; + snd_pcm_uframes_t appl_ptr; + __pad_before_uframe __pad2; + __pad_before_uframe __pad3; + snd_pcm_uframes_t avail_min; + __pad_after_uframe __pad4; +}; + +typedef int snd_ctl_elem_type_t; + +typedef int snd_ctl_elem_iface_t; + +struct snd_ctl_elem_id { + unsigned int numid; + snd_ctl_elem_iface_t iface; + unsigned int device; + unsigned int subdevice; + unsigned char name[44]; + unsigned int index; +}; + +struct snd_ctl_elem_info { + struct snd_ctl_elem_id id; + snd_ctl_elem_type_t type; + unsigned int access; + unsigned int count; + __kernel_pid_t owner; + union { + struct { + long int min; + long int max; + long int step; + } integer; + struct { + long long int min; + long long int max; + long long int step; + } integer64; + struct { + unsigned int items; + unsigned int item; + char name[64]; + __u64 names_ptr; + unsigned int names_length; + } enumerated; + unsigned char reserved[128]; + } value; + unsigned char reserved[64]; +}; + +struct snd_ctl_elem_value { + struct snd_ctl_elem_id id; + unsigned int indirect: 1; + union { + union { + long int value[128]; + long int *value_ptr; + } integer; + union { + long long int value[64]; + long long int *value_ptr; + } integer64; + union { + unsigned int item[128]; + unsigned int *item_ptr; + } enumerated; + union { + unsigned char data[512]; + unsigned char *data_ptr; + } bytes; + struct snd_aes_iec958 iec958; + } value; + unsigned char reserved[128]; +}; + +struct snd_dma_device { + int type; + struct device *dev; +}; + +struct snd_dma_buffer { + struct snd_dma_device dev; + unsigned char *area; + dma_addr_t addr; + size_t bytes; + void *private_data; +}; + +struct snd_pcm_oss_setup { + char *task_name; + unsigned int disable: 1; + unsigned int direct: 1; + unsigned int block: 1; + unsigned int nonblock: 1; + unsigned int partialfrag: 1; + unsigned int nosilence: 1; + unsigned int buggyptr: 1; + unsigned int periods; + unsigned int period_size; + struct snd_pcm_oss_setup *next; +}; + +struct snd_pcm_plugin; + +struct snd_pcm_oss_runtime { + unsigned int params: 1; + unsigned int prepare: 1; + unsigned int trigger: 1; + unsigned int sync_trigger: 1; + int rate; + int format; + unsigned int channels; + unsigned int fragshift; + unsigned int maxfrags; + unsigned int subdivision; + size_t period_bytes; + size_t period_frames; + size_t period_ptr; + unsigned int periods; + size_t buffer_bytes; + size_t bytes; + size_t mmap_bytes; + char *buffer; + size_t buffer_used; + struct mutex params_lock; + atomic_t rw_ref; + struct snd_pcm_plugin *plugin_first; + struct snd_pcm_plugin *plugin_last; + unsigned int prev_hw_ptr_period; +}; + +struct snd_timer; + +struct snd_pcm_group { + spinlock_t lock; + struct mutex mutex; + struct list_head substreams; + refcount_t refs; +}; + +struct snd_pcm_oss_substream { + unsigned int oss: 1; + struct snd_pcm_oss_setup setup; +}; + +struct snd_pcm; + +struct snd_pcm_str; + +struct snd_pcm_ops; + +struct snd_pcm_runtime; + +struct snd_pcm_substream { + struct snd_pcm *pcm; + struct snd_pcm_str *pstr; + void *private_data; + int number; + char name[32]; + int stream; + struct pm_qos_request latency_pm_qos_req; + size_t buffer_bytes_max; + struct snd_dma_buffer dma_buffer; + size_t dma_max; + const struct snd_pcm_ops *ops; + struct snd_pcm_runtime *runtime; + struct snd_timer *timer; + unsigned int timer_running: 1; + long int wait_time; + struct snd_pcm_substream *next; + struct list_head link_list; + struct snd_pcm_group self_group; + struct snd_pcm_group *group; + int ref_count; + atomic_t mmap_count; + unsigned int f_flags; + void (*pcm_release)(struct snd_pcm_substream *); + struct pid *pid; + struct snd_pcm_oss_substream oss; + struct snd_info_entry *proc_root; + unsigned int hw_opened: 1; + unsigned int managed_buffer_alloc: 1; +}; + +struct snd_pcm_oss_stream { + struct snd_pcm_oss_setup *setup_list; + struct mutex setup_mutex; + struct snd_info_entry *proc_entry; +}; + +struct snd_pcm_oss { + int reg; + unsigned int reg_mask; +}; + +struct snd_pcm_hardware { + unsigned int info; + u64 formats; + unsigned int rates; + unsigned int rate_min; + unsigned int rate_max; + unsigned int channels_min; + unsigned int channels_max; + size_t buffer_bytes_max; + size_t period_bytes_min; + size_t period_bytes_max; + unsigned int periods_min; + unsigned int periods_max; + size_t fifo_size; +}; + +struct snd_pcm_audio_tstamp_config; + +struct snd_pcm_audio_tstamp_report; + +struct snd_pcm_ops { + int (*open)(struct snd_pcm_substream *); + int (*close)(struct snd_pcm_substream *); + int (*ioctl)(struct snd_pcm_substream *, unsigned int, void *); + int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *); + int (*hw_free)(struct snd_pcm_substream *); + int (*prepare)(struct snd_pcm_substream *); + int (*trigger)(struct snd_pcm_substream *, int); + int (*sync_stop)(struct snd_pcm_substream *); + snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *); + int (*get_time_info)(struct snd_pcm_substream *, struct timespec64 *, struct timespec64 *, struct snd_pcm_audio_tstamp_config *, struct snd_pcm_audio_tstamp_report *); + int (*fill_silence)(struct snd_pcm_substream *, int, long unsigned int, long unsigned int); + int (*copy_user)(struct snd_pcm_substream *, int, long unsigned int, void *, long unsigned int); + int (*copy_kernel)(struct snd_pcm_substream *, int, long unsigned int, void *, long unsigned int); + struct page * (*page)(struct snd_pcm_substream *, long unsigned int); + int (*mmap)(struct snd_pcm_substream *, struct vm_area_struct *); + int (*ack)(struct snd_pcm_substream *); +}; + +struct snd_pcm_audio_tstamp_config { + u32 type_requested: 4; + u32 report_delay: 1; +}; + +struct snd_pcm_audio_tstamp_report { + u32 valid: 1; + u32 actual_type: 4; + u32 accuracy_report: 1; + u32 accuracy; +}; + +struct snd_pcm_hw_rule; + +typedef int (*snd_pcm_hw_rule_func_t)(struct snd_pcm_hw_params *, struct snd_pcm_hw_rule *); + +struct snd_pcm_hw_rule { + unsigned int cond; + int var; + int deps[5]; + snd_pcm_hw_rule_func_t func; + void *private; +}; + +struct snd_pcm_hw_constraints { + struct snd_mask masks[3]; + struct snd_interval intervals[12]; + unsigned int rules_num; + unsigned int rules_all; + struct snd_pcm_hw_rule *rules; +}; + +struct snd_pcm_runtime { + struct snd_pcm_substream *trigger_master; + struct timespec64 trigger_tstamp; + bool trigger_tstamp_latched; + int overrange; + snd_pcm_uframes_t avail_max; + snd_pcm_uframes_t hw_ptr_base; + snd_pcm_uframes_t hw_ptr_interrupt; + long unsigned int hw_ptr_jiffies; + long unsigned int hw_ptr_buffer_jiffies; + snd_pcm_sframes_t delay; + u64 hw_ptr_wrap; + snd_pcm_access_t access; + snd_pcm_format_t format; + snd_pcm_subformat_t subformat; + unsigned int rate; + unsigned int channels; + snd_pcm_uframes_t period_size; + unsigned int periods; + snd_pcm_uframes_t buffer_size; + snd_pcm_uframes_t min_align; + size_t byte_align; + unsigned int frame_bits; + unsigned int sample_bits; + unsigned int info; + unsigned int rate_num; + unsigned int rate_den; + unsigned int no_period_wakeup: 1; + int tstamp_mode; + unsigned int period_step; + snd_pcm_uframes_t start_threshold; + snd_pcm_uframes_t stop_threshold; + snd_pcm_uframes_t silence_threshold; + snd_pcm_uframes_t silence_size; + snd_pcm_uframes_t boundary; + snd_pcm_uframes_t silence_start; + snd_pcm_uframes_t silence_filled; + union snd_pcm_sync_id sync; + struct snd_pcm_mmap_status *status; + struct snd_pcm_mmap_control *control; + snd_pcm_uframes_t twake; + wait_queue_head_t sleep; + wait_queue_head_t tsleep; + struct fasync_struct *fasync; + bool stop_operating; + void *private_data; + void (*private_free)(struct snd_pcm_runtime *); + struct snd_pcm_hardware hw; + struct snd_pcm_hw_constraints hw_constraints; + unsigned int timer_resolution; + int tstamp_type; + unsigned char *dma_area; + dma_addr_t dma_addr; + size_t dma_bytes; + struct snd_dma_buffer *dma_buffer_p; + unsigned int buffer_changed: 1; + struct snd_pcm_audio_tstamp_config audio_tstamp_config; + struct snd_pcm_audio_tstamp_report audio_tstamp_report; + struct timespec64 driver_tstamp; + struct snd_pcm_oss_runtime oss; +}; + +struct snd_kcontrol; + +struct snd_pcm_str { + int stream; + struct snd_pcm *pcm; + unsigned int substream_count; + unsigned int substream_opened; + struct snd_pcm_substream *substream; + struct snd_pcm_oss_stream oss; + struct snd_info_entry *proc_root; + struct snd_kcontrol *chmap_kctl; + struct device dev; +}; + +struct snd_pcm { + struct snd_card *card; + struct list_head list; + int device; + unsigned int info_flags; + short unsigned int dev_class; + short unsigned int dev_subclass; + char id[64]; + char name[80]; + struct snd_pcm_str streams[2]; + struct mutex open_mutex; + wait_queue_head_t open_wait; + void *private_data; + void (*private_free)(struct snd_pcm *); + bool internal; + bool nonatomic; + bool no_device_suspend; + struct snd_pcm_oss oss; +}; + +typedef int snd_kcontrol_info_t(struct snd_kcontrol *, struct snd_ctl_elem_info *); + +typedef int snd_kcontrol_get_t(struct snd_kcontrol *, struct snd_ctl_elem_value *); + +typedef int snd_kcontrol_put_t(struct snd_kcontrol *, struct snd_ctl_elem_value *); + +typedef int snd_kcontrol_tlv_rw_t(struct snd_kcontrol *, int, unsigned int, unsigned int *); + +struct snd_ctl_file; + +struct snd_kcontrol_volatile { + struct snd_ctl_file *owner; + unsigned int access; +}; + +struct snd_kcontrol { + struct list_head list; + struct snd_ctl_elem_id id; + unsigned int count; + snd_kcontrol_info_t *info; + snd_kcontrol_get_t *get; + snd_kcontrol_put_t *put; + union { + snd_kcontrol_tlv_rw_t *c; + const unsigned int *p; + } tlv; + long unsigned int private_value; + void *private_data; + void (*private_free)(struct snd_kcontrol *); + struct snd_kcontrol_volatile vd[0]; +}; + +struct snd_enc_wma { + __u32 super_block_align; +}; + +struct snd_enc_vorbis { + __s32 quality; + __u32 managed; + __u32 max_bit_rate; + __u32 min_bit_rate; + __u32 downmix; +}; + +struct snd_enc_real { + __u32 quant_bits; + __u32 start_region; + __u32 num_regions; +}; + +struct snd_enc_flac { + __u32 num; + __u32 gain; +}; + +struct snd_enc_generic { + __u32 bw; + __s32 reserved[15]; +}; + +struct snd_dec_flac { + __u16 sample_size; + __u16 min_blk_size; + __u16 max_blk_size; + __u16 min_frame_size; + __u16 max_frame_size; + __u16 reserved; +}; + +struct snd_dec_wma { + __u32 encoder_option; + __u32 adv_encoder_option; + __u32 adv_encoder_option2; + __u32 reserved; +}; + +struct snd_dec_alac { + __u32 frame_length; + __u8 compatible_version; + __u8 pb; + __u8 mb; + __u8 kb; + __u32 max_run; + __u32 max_frame_bytes; +}; + +struct snd_dec_ape { + __u16 compatible_version; + __u16 compression_level; + __u32 format_flags; + __u32 blocks_per_frame; + __u32 final_frame_blocks; + __u32 total_frames; + __u32 seek_table_present; +}; + +union snd_codec_options { + struct snd_enc_wma wma; + struct snd_enc_vorbis vorbis; + struct snd_enc_real real; + struct snd_enc_flac flac; + struct snd_enc_generic generic; + struct snd_dec_flac flac_d; + struct snd_dec_wma wma_d; + struct snd_dec_alac alac_d; + struct snd_dec_ape ape_d; +}; + +struct snd_codec_desc { + __u32 max_ch; + __u32 sample_rates[32]; + __u32 num_sample_rates; + __u32 bit_rate[32]; + __u32 num_bitrates; + __u32 rate_control; + __u32 profiles; + __u32 modes; + __u32 formats; + __u32 min_buffer; + __u32 reserved[15]; +}; + +struct snd_codec { + __u32 id; + __u32 ch_in; + __u32 ch_out; + __u32 sample_rate; + __u32 bit_rate; + __u32 rate_control; + __u32 profile; + __u32 level; + __u32 ch_mode; + __u32 format; + __u32 align; + union snd_codec_options options; + __u32 reserved[3]; +}; + +struct snd_compressed_buffer { + __u32 fragment_size; + __u32 fragments; +}; + +struct snd_compr_params { + struct snd_compressed_buffer buffer; + struct snd_codec codec; + __u8 no_wake_mode; +}; + +struct snd_compr_tstamp { + __u32 byte_offset; + __u32 copied_total; + __u32 pcm_frames; + __u32 pcm_io_frames; + __u32 sampling_rate; +}; + +enum snd_compr_direction { + SND_COMPRESS_PLAYBACK = 0, + SND_COMPRESS_CAPTURE = 1, +}; + +struct snd_compr_caps { + __u32 num_codecs; + __u32 direction; + __u32 min_fragment_size; + __u32 max_fragment_size; + __u32 min_fragments; + __u32 max_fragments; + __u32 codecs[32]; + __u32 reserved[11]; +}; + +struct snd_compr_codec_caps { + __u32 codec; + __u32 num_descriptors; + struct snd_codec_desc descriptor[32]; +}; + +struct snd_compr_metadata { + __u32 key; + __u32 value[8]; +}; + +struct snd_compr_ops; + +struct snd_compr_runtime { + snd_pcm_state_t state; + struct snd_compr_ops *ops; + void *buffer; + u64 buffer_size; + u32 fragment_size; + u32 fragments; + u64 total_bytes_available; + u64 total_bytes_transferred; + wait_queue_head_t sleep; + void *private_data; + unsigned char *dma_area; + dma_addr_t dma_addr; + size_t dma_bytes; + struct snd_dma_buffer *dma_buffer_p; +}; + +struct snd_compr_stream; + +struct snd_compr_ops { + int (*open)(struct snd_compr_stream *); + int (*free)(struct snd_compr_stream *); + int (*set_params)(struct snd_compr_stream *, struct snd_compr_params *); + int (*get_params)(struct snd_compr_stream *, struct snd_codec *); + int (*set_metadata)(struct snd_compr_stream *, struct snd_compr_metadata *); + int (*get_metadata)(struct snd_compr_stream *, struct snd_compr_metadata *); + int (*trigger)(struct snd_compr_stream *, int); + int (*pointer)(struct snd_compr_stream *, struct snd_compr_tstamp *); + int (*copy)(struct snd_compr_stream *, char *, size_t); + int (*mmap)(struct snd_compr_stream *, struct vm_area_struct *); + int (*ack)(struct snd_compr_stream *, size_t); + int (*get_caps)(struct snd_compr_stream *, struct snd_compr_caps *); + int (*get_codec_caps)(struct snd_compr_stream *, struct snd_compr_codec_caps *); +}; + +struct snd_compr; + +struct snd_compr_stream { + const char *name; + struct snd_compr_ops *ops; + struct snd_compr_runtime *runtime; + struct snd_compr *device; + struct delayed_work error_work; + enum snd_compr_direction direction; + bool metadata_set; + bool next_track; + bool partial_drain; + bool pause_in_draining; + void *private_data; + struct snd_dma_buffer dma_buffer; +}; + +struct snd_compr { + const char *name; + struct device dev; + struct snd_compr_ops *ops; + void *private_data; + struct snd_card *card; + unsigned int direction; + struct mutex lock; + int device; + bool use_pause_in_draining; + char id[64]; + struct snd_info_entry *proc_root; + struct snd_info_entry *proc_info_entry; +}; + +struct snd_kcontrol_new { + snd_ctl_elem_iface_t iface; + unsigned int device; + unsigned int subdevice; + const char *name; + unsigned int index; + unsigned int access; + unsigned int count; + snd_kcontrol_info_t *info; + snd_kcontrol_get_t *get; + snd_kcontrol_put_t *put; + union { + snd_kcontrol_tlv_rw_t *c; + const unsigned int *p; + } tlv; + long unsigned int private_value; +}; + +struct snd_ctl_file { + struct list_head list; + struct snd_card *card; + struct pid *pid; + int preferred_subdevice[2]; + wait_queue_head_t change_sleep; + spinlock_t read_lock; + struct fasync_struct *fasync; + int subscribed; + struct list_head events; +}; + +enum { + SND_CTL_SUBDEV_PCM = 0, + SND_CTL_SUBDEV_RAWMIDI = 1, + SND_CTL_SUBDEV_ITEMS = 2, +}; + +struct snd_info_buffer { + char *buffer; + unsigned int curr; + unsigned int size; + unsigned int len; + int stop; + int error; +}; + +struct snd_info_entry_ops { + int (*open)(struct snd_info_entry *, short unsigned int, void **); + int (*release)(struct snd_info_entry *, short unsigned int, void *); + ssize_t (*read)(struct snd_info_entry *, void *, struct file *, char *, size_t, loff_t); + ssize_t (*write)(struct snd_info_entry *, void *, struct file *, const char *, size_t, loff_t); + loff_t (*llseek)(struct snd_info_entry *, void *, struct file *, loff_t, int); + __poll_t (*poll)(struct snd_info_entry *, void *, struct file *, poll_table *); + int (*ioctl)(struct snd_info_entry *, void *, struct file *, unsigned int, long unsigned int); + int (*mmap)(struct snd_info_entry *, void *, struct inode *, struct file *, struct vm_area_struct *); +}; + +struct snd_soc_tplg_hdr { + __le32 magic; + __le32 abi; + __le32 version; + __le32 type; + __le32 size; + __le32 vendor_type; + __le32 payload_size; + __le32 index; + __le32 count; +}; + +struct snd_soc_tplg_vendor_uuid_elem { + __le32 token; + char uuid[16]; +}; + +struct snd_soc_tplg_vendor_value_elem { + __le32 token; + __le32 value; +}; + +struct snd_soc_tplg_vendor_string_elem { + __le32 token; + char string[44]; +}; + +struct snd_soc_tplg_vendor_array { + __le32 size; + __le32 type; + __le32 num_elems; + union { + struct snd_soc_tplg_vendor_uuid_elem uuid[0]; + struct snd_soc_tplg_vendor_value_elem value[0]; + struct snd_soc_tplg_vendor_string_elem string[0]; + }; +}; + +struct snd_soc_tplg_private { + __le32 size; + union { + char data[0]; + struct snd_soc_tplg_vendor_array array[0]; + }; +}; + +struct snd_soc_tplg_tlv_dbscale { + __le32 min; + __le32 step; + __le32 mute; +}; + +struct snd_soc_tplg_ctl_tlv { + __le32 size; + __le32 type; + union { + __le32 data[32]; + struct snd_soc_tplg_tlv_dbscale scale; + }; +}; + +struct snd_soc_tplg_io_ops { + __le32 get; + __le32 put; + __le32 info; +}; + +struct snd_soc_tplg_ctl_hdr { + __le32 size; + __le32 type; + char name[44]; + __le32 access; + struct snd_soc_tplg_io_ops ops; + struct snd_soc_tplg_ctl_tlv tlv; +}; + +struct snd_soc_tplg_stream_caps { + __le32 size; + char name[44]; + __le64 formats; + __le32 rates; + __le32 rate_min; + __le32 rate_max; + __le32 channels_min; + __le32 channels_max; + __le32 periods_min; + __le32 periods_max; + __le32 period_size_min; + __le32 period_size_max; + __le32 buffer_size_min; + __le32 buffer_size_max; + __le32 sig_bits; +}; + +struct snd_soc_tplg_stream { + __le32 size; + char name[44]; + __le64 format; + __le32 rate; + __le32 period_bytes; + __le32 buffer_bytes; + __le32 channels; +}; + +struct snd_soc_tplg_hw_config { + __le32 size; + __le32 id; + __le32 fmt; + __u8 clock_gated; + __u8 invert_bclk; + __u8 invert_fsync; + __u8 bclk_provider; + __u8 fsync_provider; + __u8 mclk_direction; + __le16 reserved; + __le32 mclk_rate; + __le32 bclk_rate; + __le32 fsync_rate; + __le32 tdm_slots; + __le32 tdm_slot_width; + __le32 tx_slots; + __le32 rx_slots; + __le32 tx_channels; + __le32 tx_chanmap[8]; + __le32 rx_channels; + __le32 rx_chanmap[8]; +}; + +struct snd_soc_tplg_manifest { + __le32 size; + __le32 control_elems; + __le32 widget_elems; + __le32 graph_elems; + __le32 pcm_elems; + __le32 dai_link_elems; + __le32 dai_elems; + __le32 reserved[20]; + struct snd_soc_tplg_private priv; +}; + +struct snd_soc_tplg_dapm_widget { + __le32 size; + __le32 id; + char name[44]; + char sname[44]; + __le32 reg; + __le32 shift; + __le32 mask; + __le32 subseq; + __le32 invert; + __le32 ignore_suspend; + __le16 event_flags; + __le16 event_type; + __le32 num_kcontrols; + struct snd_soc_tplg_private priv; +}; + +struct snd_soc_tplg_pcm { + __le32 size; + char pcm_name[44]; + char dai_name[44]; + __le32 pcm_id; + __le32 dai_id; + __le32 playback; + __le32 capture; + __le32 compress; + struct snd_soc_tplg_stream stream[8]; + __le32 num_streams; + struct snd_soc_tplg_stream_caps caps[2]; + __le32 flag_mask; + __le32 flags; + struct snd_soc_tplg_private priv; +} __attribute__((packed)); + +struct snd_soc_tplg_link_config { + __le32 size; + __le32 id; + char name[44]; + char stream_name[44]; + struct snd_soc_tplg_stream stream[8]; + __le32 num_streams; + struct snd_soc_tplg_hw_config hw_config[8]; + __le32 num_hw_configs; + __le32 default_hw_config_id; + __le32 flag_mask; + __le32 flags; + struct snd_soc_tplg_private priv; +}; + +enum snd_soc_dobj_type { + SND_SOC_DOBJ_NONE = 0, + SND_SOC_DOBJ_MIXER = 1, + SND_SOC_DOBJ_BYTES = 2, + SND_SOC_DOBJ_ENUM = 3, + SND_SOC_DOBJ_GRAPH = 4, + SND_SOC_DOBJ_WIDGET = 5, + SND_SOC_DOBJ_DAI_LINK = 6, + SND_SOC_DOBJ_PCM = 7, + SND_SOC_DOBJ_CODEC_LINK = 8, + SND_SOC_DOBJ_BACKEND_LINK = 9, +}; + +struct snd_soc_dobj_control { + struct snd_kcontrol *kcontrol; + char **dtexts; + long unsigned int *dvalues; +}; + +struct snd_soc_dobj_widget { + unsigned int kcontrol_type; +}; + +struct snd_soc_tplg_ops; + +struct snd_soc_dobj { + enum snd_soc_dobj_type type; + unsigned int index; + struct list_head list; + struct snd_soc_tplg_ops *ops; + union { + struct snd_soc_dobj_control control; + struct snd_soc_dobj_widget widget; + }; + void *private; +}; + +struct snd_soc_component; + +struct snd_soc_dapm_route; + +struct snd_soc_dapm_widget; + +struct snd_soc_dai_driver; + +struct snd_soc_dai; + +struct snd_soc_dai_link; + +struct snd_soc_tplg_kcontrol_ops; + +struct snd_soc_tplg_bytes_ext_ops; + +struct snd_soc_tplg_ops { + int (*control_load)(struct snd_soc_component *, int, struct snd_kcontrol_new *, struct snd_soc_tplg_ctl_hdr *); + int (*control_unload)(struct snd_soc_component *, struct snd_soc_dobj *); + int (*dapm_route_load)(struct snd_soc_component *, int, struct snd_soc_dapm_route *); + int (*dapm_route_unload)(struct snd_soc_component *, struct snd_soc_dobj *); + int (*widget_load)(struct snd_soc_component *, int, struct snd_soc_dapm_widget *, struct snd_soc_tplg_dapm_widget *); + int (*widget_ready)(struct snd_soc_component *, int, struct snd_soc_dapm_widget *, struct snd_soc_tplg_dapm_widget *); + int (*widget_unload)(struct snd_soc_component *, struct snd_soc_dobj *); + int (*dai_load)(struct snd_soc_component *, int, struct snd_soc_dai_driver *, struct snd_soc_tplg_pcm *, struct snd_soc_dai *); + int (*dai_unload)(struct snd_soc_component *, struct snd_soc_dobj *); + int (*link_load)(struct snd_soc_component *, int, struct snd_soc_dai_link *, struct snd_soc_tplg_link_config *); + int (*link_unload)(struct snd_soc_component *, struct snd_soc_dobj *); + int (*vendor_load)(struct snd_soc_component *, int, struct snd_soc_tplg_hdr *); + int (*vendor_unload)(struct snd_soc_component *, struct snd_soc_tplg_hdr *); + void (*complete)(struct snd_soc_component *); + int (*manifest)(struct snd_soc_component *, int, struct snd_soc_tplg_manifest *); + const struct snd_soc_tplg_kcontrol_ops *io_ops; + int io_ops_count; + const struct snd_soc_tplg_bytes_ext_ops *bytes_ext_ops; + int bytes_ext_ops_count; +}; + +struct snd_soc_tplg_kcontrol_ops { + u32 id; + int (*get)(struct snd_kcontrol *, struct snd_ctl_elem_value *); + int (*put)(struct snd_kcontrol *, struct snd_ctl_elem_value *); + int (*info)(struct snd_kcontrol *, struct snd_ctl_elem_info *); +}; + +struct snd_soc_tplg_bytes_ext_ops { + u32 id; + int (*get)(struct snd_kcontrol *, unsigned int *, unsigned int); + int (*put)(struct snd_kcontrol *, const unsigned int *, unsigned int); +}; + +enum snd_soc_dapm_type { + snd_soc_dapm_input = 0, + snd_soc_dapm_output = 1, + snd_soc_dapm_mux = 2, + snd_soc_dapm_demux = 3, + snd_soc_dapm_mixer = 4, + snd_soc_dapm_mixer_named_ctl = 5, + snd_soc_dapm_pga = 6, + snd_soc_dapm_out_drv = 7, + snd_soc_dapm_adc = 8, + snd_soc_dapm_dac = 9, + snd_soc_dapm_micbias = 10, + snd_soc_dapm_mic = 11, + snd_soc_dapm_hp = 12, + snd_soc_dapm_spk = 13, + snd_soc_dapm_line = 14, + snd_soc_dapm_switch = 15, + snd_soc_dapm_vmid = 16, + snd_soc_dapm_pre = 17, + snd_soc_dapm_post = 18, + snd_soc_dapm_supply = 19, + snd_soc_dapm_pinctrl = 20, + snd_soc_dapm_regulator_supply = 21, + snd_soc_dapm_clock_supply = 22, + snd_soc_dapm_aif_in = 23, + snd_soc_dapm_aif_out = 24, + snd_soc_dapm_siggen = 25, + snd_soc_dapm_sink = 26, + snd_soc_dapm_dai_in = 27, + snd_soc_dapm_dai_out = 28, + snd_soc_dapm_dai_link = 29, + snd_soc_dapm_kcontrol = 30, + snd_soc_dapm_buffer = 31, + snd_soc_dapm_scheduler = 32, + snd_soc_dapm_effect = 33, + snd_soc_dapm_src = 34, + snd_soc_dapm_asrc = 35, + snd_soc_dapm_encoder = 36, + snd_soc_dapm_decoder = 37, + SND_SOC_DAPM_TYPE_COUNT = 38, +}; + +struct snd_soc_dapm_context; + +struct snd_soc_dapm_widget { + enum snd_soc_dapm_type id; + const char *name; + const char *sname; + struct list_head list; + struct snd_soc_dapm_context *dapm; + void *priv; + struct regulator *regulator; + struct pinctrl *pinctrl; + int reg; + unsigned char shift; + unsigned int mask; + unsigned int on_val; + unsigned int off_val; + unsigned char power: 1; + unsigned char active: 1; + unsigned char connected: 1; + unsigned char new: 1; + unsigned char force: 1; + unsigned char ignore_suspend: 1; + unsigned char new_power: 1; + unsigned char power_checked: 1; + unsigned char is_supply: 1; + unsigned char is_ep: 2; + int subseq; + int (*power_check)(struct snd_soc_dapm_widget *); + short unsigned int event_flags; + int (*event)(struct snd_soc_dapm_widget *, struct snd_kcontrol *, int); + int num_kcontrols; + const struct snd_kcontrol_new *kcontrol_news; + struct snd_kcontrol **kcontrols; + struct snd_soc_dobj dobj; + struct list_head edges[2]; + struct list_head work_list; + struct list_head power_list; + struct list_head dirty; + int endpoints[2]; + struct clk *clk; + int channel; +}; + +enum snd_soc_bias_level { + SND_SOC_BIAS_OFF = 0, + SND_SOC_BIAS_STANDBY = 1, + SND_SOC_BIAS_PREPARE = 2, + SND_SOC_BIAS_ON = 3, +}; + +struct snd_soc_dapm_wcache { + struct snd_soc_dapm_widget *widget; +}; + +struct snd_soc_card; + +struct snd_soc_dapm_context { + enum snd_soc_bias_level bias_level; + unsigned int idle_bias_off: 1; + unsigned int suspend_bias_off: 1; + struct device *dev; + struct snd_soc_component *component; + struct snd_soc_card *card; + enum snd_soc_bias_level target_bias_level; + struct list_head list; + struct snd_soc_dapm_wcache path_sink_cache; + struct snd_soc_dapm_wcache path_source_cache; + struct dentry *debugfs_dapm; +}; + +struct snd_soc_component_driver; + +struct snd_soc_component { + const char *name; + int id; + const char *name_prefix; + struct device *dev; + struct snd_soc_card *card; + unsigned int active; + unsigned int suspended: 1; + struct list_head list; + struct list_head card_aux_list; + struct list_head card_list; + const struct snd_soc_component_driver *driver; + struct list_head dai_list; + int num_dai; + struct regmap *regmap; + int val_bytes; + struct mutex io_mutex; + struct list_head dobj_list; + struct snd_soc_dapm_context dapm; + int (*init)(struct snd_soc_component *); + struct snd_pcm_substream *mark_module; + struct snd_pcm_substream *mark_open; + struct snd_pcm_substream *mark_hw_params; + struct snd_pcm_substream *mark_trigger; + struct snd_compr_stream *mark_compr_open; + void *mark_pm; + struct dentry *debugfs_root; + const char *debugfs_prefix; +}; + +struct snd_soc_dapm_route { + const char *sink; + const char *control; + const char *source; + int (*connected)(struct snd_soc_dapm_widget *, struct snd_soc_dapm_widget *); + struct snd_soc_dobj dobj; +}; + +struct snd_soc_pcm_stream { + const char *stream_name; + u64 formats; + unsigned int rates; + unsigned int rate_min; + unsigned int rate_max; + unsigned int channels_min; + unsigned int channels_max; + unsigned int sig_bits; +}; + +struct snd_soc_pcm_runtime; + +struct snd_soc_dai_ops; + +struct snd_soc_cdai_ops; + +struct snd_soc_dai_driver { + const char *name; + unsigned int id; + unsigned int base; + struct snd_soc_dobj dobj; + int (*probe)(struct snd_soc_dai *); + int (*remove)(struct snd_soc_dai *); + int (*compress_new)(struct snd_soc_pcm_runtime *, int); + int (*pcm_new)(struct snd_soc_pcm_runtime *, struct snd_soc_dai *); + const struct snd_soc_dai_ops *ops; + const struct snd_soc_cdai_ops *cops; + struct snd_soc_pcm_stream capture; + struct snd_soc_pcm_stream playback; + unsigned int symmetric_rates: 1; + unsigned int symmetric_channels: 1; + unsigned int symmetric_samplebits: 1; + int probe_order; + int remove_order; +}; + +struct snd_soc_dai { + const char *name; + int id; + struct device *dev; + struct snd_soc_dai_driver *driver; + unsigned int stream_active[2]; + struct snd_soc_dapm_widget *playback_widget; + struct snd_soc_dapm_widget *capture_widget; + void *playback_dma_data; + void *capture_dma_data; + unsigned int rate; + unsigned int channels; + unsigned int sample_bits; + struct snd_soc_component *component; + unsigned int tx_mask; + unsigned int rx_mask; + struct list_head list; + struct snd_pcm_substream *mark_startup; + struct snd_pcm_substream *mark_hw_params; + struct snd_pcm_substream *mark_trigger; + struct snd_compr_stream *mark_compr_startup; + unsigned int probed: 1; +}; + +enum snd_soc_dpcm_trigger { + SND_SOC_DPCM_TRIGGER_PRE = 0, + SND_SOC_DPCM_TRIGGER_POST = 1, + SND_SOC_DPCM_TRIGGER_BESPOKE = 2, +}; + +struct snd_soc_dai_link_component; + +struct snd_soc_ops; + +struct snd_soc_compr_ops; + +struct snd_soc_dai_link { + const char *name; + const char *stream_name; + struct snd_soc_dai_link_component *cpus; + unsigned int num_cpus; + struct snd_soc_dai_link_component *codecs; + unsigned int num_codecs; + struct snd_soc_dai_link_component *platforms; + unsigned int num_platforms; + int id; + const struct snd_soc_pcm_stream *params; + unsigned int num_params; + unsigned int dai_fmt; + enum snd_soc_dpcm_trigger trigger[2]; + int (*init)(struct snd_soc_pcm_runtime *); + void (*exit)(struct snd_soc_pcm_runtime *); + int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *, struct snd_pcm_hw_params *); + const struct snd_soc_ops *ops; + const struct snd_soc_compr_ops *compr_ops; + unsigned int nonatomic: 1; + unsigned int playback_only: 1; + unsigned int capture_only: 1; + unsigned int ignore_suspend: 1; + unsigned int symmetric_rates: 1; + unsigned int symmetric_channels: 1; + unsigned int symmetric_samplebits: 1; + unsigned int no_pcm: 1; + unsigned int dynamic: 1; + unsigned int dpcm_capture: 1; + unsigned int dpcm_playback: 1; + unsigned int dpcm_merged_format: 1; + unsigned int dpcm_merged_chan: 1; + unsigned int dpcm_merged_rate: 1; + unsigned int ignore_pmdown_time: 1; + unsigned int ignore: 1; + struct snd_soc_dobj dobj; +}; + +struct snd_soc_dapm_update { + struct snd_kcontrol *kcontrol; + int reg; + int mask; + int val; + int reg2; + int mask2; + int val2; + bool has_second_set; +}; + +enum snd_soc_pcm_subclass { + SND_SOC_PCM_CLASS_PCM = 0, + SND_SOC_PCM_CLASS_BE = 1, +}; + +struct snd_soc_dapm_stats { + int power_checks; + int path_checks; + int neighbour_checks; +}; + +struct snd_soc_codec_conf; + +struct snd_soc_aux_dev; + +struct snd_soc_card { + const char *name; + const char *long_name; + const char *driver_name; + const char *components; + char dmi_longname[80]; + char topology_shortname[32]; + struct device *dev; + struct snd_card *snd_card; + struct module *owner; + struct mutex mutex; + struct mutex dapm_mutex; + struct mutex pcm_mutex; + enum snd_soc_pcm_subclass pcm_subclass; + spinlock_t dpcm_lock; + int (*probe)(struct snd_soc_card *); + int (*late_probe)(struct snd_soc_card *); + int (*remove)(struct snd_soc_card *); + int (*suspend_pre)(struct snd_soc_card *); + int (*suspend_post)(struct snd_soc_card *); + int (*resume_pre)(struct snd_soc_card *); + int (*resume_post)(struct snd_soc_card *); + int (*set_bias_level)(struct snd_soc_card *, struct snd_soc_dapm_context *, enum snd_soc_bias_level); + int (*set_bias_level_post)(struct snd_soc_card *, struct snd_soc_dapm_context *, enum snd_soc_bias_level); + int (*add_dai_link)(struct snd_soc_card *, struct snd_soc_dai_link *); + void (*remove_dai_link)(struct snd_soc_card *, struct snd_soc_dai_link *); + long int pmdown_time; + struct snd_soc_dai_link *dai_link; + int num_links; + struct list_head rtd_list; + int num_rtd; + struct snd_soc_codec_conf *codec_conf; + int num_configs; + struct snd_soc_aux_dev *aux_dev; + int num_aux_devs; + struct list_head aux_comp_list; + const struct snd_kcontrol_new *controls; + int num_controls; + const struct snd_soc_dapm_widget *dapm_widgets; + int num_dapm_widgets; + const struct snd_soc_dapm_route *dapm_routes; + int num_dapm_routes; + const struct snd_soc_dapm_widget *of_dapm_widgets; + int num_of_dapm_widgets; + const struct snd_soc_dapm_route *of_dapm_routes; + int num_of_dapm_routes; + struct list_head component_dev_list; + struct list_head list; + struct list_head widgets; + struct list_head paths; + struct list_head dapm_list; + struct list_head dapm_dirty; + struct list_head dobj_list; + struct snd_soc_dapm_context dapm; + struct snd_soc_dapm_stats dapm_stats; + struct snd_soc_dapm_update *update; + struct dentry *debugfs_card_root; + struct work_struct deferred_resume_work; + u32 pop_time; + unsigned int instantiated: 1; + unsigned int topology_shortname_created: 1; + unsigned int fully_routed: 1; + unsigned int disable_route_checks: 1; + unsigned int probed: 1; + unsigned int component_chaining: 1; + void *drvdata; +}; + +enum snd_soc_dpcm_update { + SND_SOC_DPCM_UPDATE_NO = 0, + SND_SOC_DPCM_UPDATE_BE = 1, + SND_SOC_DPCM_UPDATE_FE = 2, +}; + +enum snd_soc_dpcm_state { + SND_SOC_DPCM_STATE_NEW = 0, + SND_SOC_DPCM_STATE_OPEN = 1, + SND_SOC_DPCM_STATE_HW_PARAMS = 2, + SND_SOC_DPCM_STATE_PREPARE = 3, + SND_SOC_DPCM_STATE_START = 4, + SND_SOC_DPCM_STATE_STOP = 5, + SND_SOC_DPCM_STATE_PAUSED = 6, + SND_SOC_DPCM_STATE_SUSPEND = 7, + SND_SOC_DPCM_STATE_HW_FREE = 8, + SND_SOC_DPCM_STATE_CLOSE = 9, +}; + +struct snd_soc_dpcm_runtime { + struct list_head be_clients; + struct list_head fe_clients; + int users; + struct snd_pcm_runtime *runtime; + struct snd_pcm_hw_params hw_params; + enum snd_soc_dpcm_update runtime_update; + enum snd_soc_dpcm_state state; + int trigger_pending; +}; + +struct snd_soc_pcm_runtime { + struct device *dev; + struct snd_soc_card *card; + struct snd_soc_dai_link *dai_link; + struct snd_pcm_ops ops; + unsigned int params_select; + struct snd_soc_dpcm_runtime dpcm[2]; + long int pmdown_time; + struct snd_pcm *pcm; + struct snd_compr *compr; + struct snd_soc_dai **dais; + unsigned int num_codecs; + unsigned int num_cpus; + struct snd_soc_dapm_widget *playback_widget; + struct snd_soc_dapm_widget *capture_widget; + struct delayed_work delayed_work; + void (*close_delayed_work_func)(struct snd_soc_pcm_runtime *); + struct dentry *debugfs_dpcm_root; + unsigned int num; + struct list_head list; + struct snd_pcm_substream *mark_startup; + struct snd_pcm_substream *mark_hw_params; + struct snd_pcm_substream *mark_trigger; + struct snd_compr_stream *mark_compr_startup; + unsigned int pop_wait: 1; + unsigned int fe_compr: 1; + int num_components; + struct snd_soc_component *components[0]; +}; + +struct snd_soc_ops { + int (*startup)(struct snd_pcm_substream *); + void (*shutdown)(struct snd_pcm_substream *); + int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *); + int (*hw_free)(struct snd_pcm_substream *); + int (*prepare)(struct snd_pcm_substream *); + int (*trigger)(struct snd_pcm_substream *, int); +}; + +struct snd_soc_compr_ops { + int (*startup)(struct snd_compr_stream *); + void (*shutdown)(struct snd_compr_stream *); + int (*set_params)(struct snd_compr_stream *); + int (*trigger)(struct snd_compr_stream *); +}; + +struct snd_soc_dai_link_component { + const char *name; + struct device_node *of_node; + const char *dai_name; +}; + +struct snd_soc_codec_conf { + struct snd_soc_dai_link_component dlc; + const char *name_prefix; +}; + +struct snd_soc_aux_dev { + struct snd_soc_dai_link_component dlc; + int (*init)(struct snd_soc_component *); +}; + +struct snd_soc_dai_ops { + int (*set_sysclk)(struct snd_soc_dai *, int, unsigned int, int); + int (*set_pll)(struct snd_soc_dai *, int, int, unsigned int, unsigned int); + int (*set_clkdiv)(struct snd_soc_dai *, int, int); + int (*set_bclk_ratio)(struct snd_soc_dai *, unsigned int); + int (*set_fmt)(struct snd_soc_dai *, unsigned int); + int (*xlate_tdm_slot_mask)(unsigned int, unsigned int *, unsigned int *); + int (*set_tdm_slot)(struct snd_soc_dai *, unsigned int, unsigned int, int, int); + int (*set_channel_map)(struct snd_soc_dai *, unsigned int, unsigned int *, unsigned int, unsigned int *); + int (*get_channel_map)(struct snd_soc_dai *, unsigned int *, unsigned int *, unsigned int *, unsigned int *); + int (*set_tristate)(struct snd_soc_dai *, int); + int (*set_sdw_stream)(struct snd_soc_dai *, void *, int); + void * (*get_sdw_stream)(struct snd_soc_dai *, int); + int (*mute_stream)(struct snd_soc_dai *, int, int); + int (*startup)(struct snd_pcm_substream *, struct snd_soc_dai *); + void (*shutdown)(struct snd_pcm_substream *, struct snd_soc_dai *); + int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *, struct snd_soc_dai *); + int (*hw_free)(struct snd_pcm_substream *, struct snd_soc_dai *); + int (*prepare)(struct snd_pcm_substream *, struct snd_soc_dai *); + int (*trigger)(struct snd_pcm_substream *, int, struct snd_soc_dai *); + int (*bespoke_trigger)(struct snd_pcm_substream *, int, struct snd_soc_dai *); + snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, struct snd_soc_dai *); + unsigned int no_capture_mute: 1; +}; + +struct snd_soc_cdai_ops { + int (*startup)(struct snd_compr_stream *, struct snd_soc_dai *); + int (*shutdown)(struct snd_compr_stream *, struct snd_soc_dai *); + int (*set_params)(struct snd_compr_stream *, struct snd_compr_params *, struct snd_soc_dai *); + int (*get_params)(struct snd_compr_stream *, struct snd_codec *, struct snd_soc_dai *); + int (*set_metadata)(struct snd_compr_stream *, struct snd_compr_metadata *, struct snd_soc_dai *); + int (*get_metadata)(struct snd_compr_stream *, struct snd_compr_metadata *, struct snd_soc_dai *); + int (*trigger)(struct snd_compr_stream *, int, struct snd_soc_dai *); + int (*pointer)(struct snd_compr_stream *, struct snd_compr_tstamp *, struct snd_soc_dai *); + int (*ack)(struct snd_compr_stream *, size_t, struct snd_soc_dai *); +}; + +struct snd_compress_ops { + int (*open)(struct snd_soc_component *, struct snd_compr_stream *); + int (*free)(struct snd_soc_component *, struct snd_compr_stream *); + int (*set_params)(struct snd_soc_component *, struct snd_compr_stream *, struct snd_compr_params *); + int (*get_params)(struct snd_soc_component *, struct snd_compr_stream *, struct snd_codec *); + int (*set_metadata)(struct snd_soc_component *, struct snd_compr_stream *, struct snd_compr_metadata *); + int (*get_metadata)(struct snd_soc_component *, struct snd_compr_stream *, struct snd_compr_metadata *); + int (*trigger)(struct snd_soc_component *, struct snd_compr_stream *, int); + int (*pointer)(struct snd_soc_component *, struct snd_compr_stream *, struct snd_compr_tstamp *); + int (*copy)(struct snd_soc_component *, struct snd_compr_stream *, char *, size_t); + int (*mmap)(struct snd_soc_component *, struct snd_compr_stream *, struct vm_area_struct *); + int (*ack)(struct snd_soc_component *, struct snd_compr_stream *, size_t); + int (*get_caps)(struct snd_soc_component *, struct snd_compr_stream *, struct snd_compr_caps *); + int (*get_codec_caps)(struct snd_soc_component *, struct snd_compr_stream *, struct snd_compr_codec_caps *); +}; + +struct snd_soc_jack; + +struct snd_soc_component_driver { + const char *name; + const struct snd_kcontrol_new *controls; + unsigned int num_controls; + const struct snd_soc_dapm_widget *dapm_widgets; + unsigned int num_dapm_widgets; + const struct snd_soc_dapm_route *dapm_routes; + unsigned int num_dapm_routes; + int (*probe)(struct snd_soc_component *); + void (*remove)(struct snd_soc_component *); + int (*suspend)(struct snd_soc_component *); + int (*resume)(struct snd_soc_component *); + unsigned int (*read)(struct snd_soc_component *, unsigned int); + int (*write)(struct snd_soc_component *, unsigned int, unsigned int); + int (*pcm_construct)(struct snd_soc_component *, struct snd_soc_pcm_runtime *); + void (*pcm_destruct)(struct snd_soc_component *, struct snd_pcm *); + int (*set_sysclk)(struct snd_soc_component *, int, int, unsigned int, int); + int (*set_pll)(struct snd_soc_component *, int, int, unsigned int, unsigned int); + int (*set_jack)(struct snd_soc_component *, struct snd_soc_jack *, void *); + int (*of_xlate_dai_name)(struct snd_soc_component *, struct of_phandle_args *, const char **); + int (*of_xlate_dai_id)(struct snd_soc_component *, struct device_node *); + void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type, int); + int (*stream_event)(struct snd_soc_component *, int); + int (*set_bias_level)(struct snd_soc_component *, enum snd_soc_bias_level); + int (*open)(struct snd_soc_component *, struct snd_pcm_substream *); + int (*close)(struct snd_soc_component *, struct snd_pcm_substream *); + int (*ioctl)(struct snd_soc_component *, struct snd_pcm_substream *, unsigned int, void *); + int (*hw_params)(struct snd_soc_component *, struct snd_pcm_substream *, struct snd_pcm_hw_params *); + int (*hw_free)(struct snd_soc_component *, struct snd_pcm_substream *); + int (*prepare)(struct snd_soc_component *, struct snd_pcm_substream *); + int (*trigger)(struct snd_soc_component *, struct snd_pcm_substream *, int); + int (*sync_stop)(struct snd_soc_component *, struct snd_pcm_substream *); + snd_pcm_uframes_t (*pointer)(struct snd_soc_component *, struct snd_pcm_substream *); + int (*get_time_info)(struct snd_soc_component *, struct snd_pcm_substream *, struct timespec64 *, struct timespec64 *, struct snd_pcm_audio_tstamp_config *, struct snd_pcm_audio_tstamp_report *); + int (*copy_user)(struct snd_soc_component *, struct snd_pcm_substream *, int, long unsigned int, void *, long unsigned int); + struct page * (*page)(struct snd_soc_component *, struct snd_pcm_substream *, long unsigned int); + int (*mmap)(struct snd_soc_component *, struct snd_pcm_substream *, struct vm_area_struct *); + const struct snd_compress_ops *compress_ops; + int probe_order; + int remove_order; + unsigned int module_get_upon_open: 1; + unsigned int idle_bias_on: 1; + unsigned int suspend_bias_off: 1; + unsigned int use_pmdown_time: 1; + unsigned int endianness: 1; + unsigned int non_legacy_dai_naming: 1; + const char *ignore_machine; + const char *topology_name_prefix; + int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *, struct snd_pcm_hw_params *); + bool use_dai_pcm_id; + int be_pcm_base; +}; + +struct snd_jack; + +struct snd_soc_jack { + struct mutex mutex; + struct snd_jack *jack; + struct snd_soc_card *card; + struct list_head pins; + int status; + struct blocking_notifier_head notifier; + struct list_head jack_zones; +}; + +struct sdw_port_runtime { + int num; + int ch_mask; + struct sdw_transport_params transport_params; + struct sdw_port_params port_params; + struct list_head port_node; +}; + +struct sdw_slave_runtime { + struct sdw_slave *slave; + enum sdw_data_direction direction; + unsigned int ch_count; + struct list_head m_rt_node; + struct list_head port_list; +}; + +struct sdw_master_runtime { + struct sdw_bus *bus; + struct sdw_stream_runtime *stream; + enum sdw_data_direction direction; + unsigned int ch_count; + struct list_head slave_rt_list; + struct list_head port_list; + struct list_head stream_node; + struct list_head bus_node; +}; + +struct dpn_attribute { + struct device_attribute dev_attr; + int N; + int dir; + const char *format_string; +}; + +union extcon_property_value { + int intval; +}; + +struct extcon_cable; + +struct extcon_dev___2 { + const char *name; + const unsigned int *supported_cable; + const u32 *mutually_exclusive; + struct device dev; + struct raw_notifier_head nh_all; + struct raw_notifier_head *nh; + struct list_head entry; + int max_supported; + spinlock_t lock; + u32 state; + struct device_type extcon_dev_type; + struct extcon_cable *cables; + struct attribute_group attr_g_muex; + struct attribute **attrs_muex; + struct device_attribute *d_attrs_muex; +}; + +struct extcon_cable { + struct extcon_dev___2 *edev; + int cable_index; + struct attribute_group attr_g; + struct device_attribute attr_name; + struct device_attribute attr_state; + struct attribute *attrs[3]; + union extcon_property_value usb_propval[3]; + union extcon_property_value chg_propval[1]; + union extcon_property_value jack_propval[1]; + union extcon_property_value disp_propval[2]; + long unsigned int usb_bits[1]; + long unsigned int chg_bits[1]; + long unsigned int jack_bits[1]; + long unsigned int disp_bits[1]; +}; + +struct __extcon_info { + unsigned int type; + unsigned int id; + const char *name; +}; + +struct extcon_dev_notifier_devres { + struct extcon_dev___2 *edev; + unsigned int id; + struct notifier_block *nb; +}; + +struct powercap_control_type; + +struct powercap_control_type_ops { + int (*set_enable)(struct powercap_control_type *, bool); + int (*get_enable)(struct powercap_control_type *, bool *); + int (*release)(struct powercap_control_type *); +}; + +struct powercap_control_type { + struct device dev; + struct idr idr; + int nr_zones; + const struct powercap_control_type_ops *ops; + struct mutex lock; + bool allocated; + struct list_head node; +}; + +struct powercap_zone; + +struct powercap_zone_ops { + int (*get_max_energy_range_uj)(struct powercap_zone *, u64 *); + int (*get_energy_uj)(struct powercap_zone *, u64 *); + int (*reset_energy_uj)(struct powercap_zone *); + int (*get_max_power_range_uw)(struct powercap_zone *, u64 *); + int (*get_power_uw)(struct powercap_zone *, u64 *); + int (*set_enable)(struct powercap_zone *, bool); + int (*get_enable)(struct powercap_zone *, bool *); + int (*release)(struct powercap_zone *); +}; + +struct powercap_zone_constraint; + +struct powercap_zone { + int id; + char *name; + void *control_type_inst; + const struct powercap_zone_ops *ops; + struct device dev; + int const_id_cnt; + struct idr idr; + struct idr *parent_idr; + void *private_data; + struct attribute **zone_dev_attrs; + int zone_attr_count; + struct attribute_group dev_zone_attr_group; + const struct attribute_group *dev_attr_groups[2]; + bool allocated; + struct powercap_zone_constraint *constraints; +}; + +struct powercap_zone_constraint_ops; + +struct powercap_zone_constraint { + int id; + struct powercap_zone *power_zone; + const struct powercap_zone_constraint_ops *ops; +}; + +struct powercap_zone_constraint_ops { + int (*set_power_limit_uw)(struct powercap_zone *, int, u64); + int (*get_power_limit_uw)(struct powercap_zone *, int, u64 *); + int (*set_time_window_us)(struct powercap_zone *, int, u64); + int (*get_time_window_us)(struct powercap_zone *, int, u64 *); + int (*get_max_power_uw)(struct powercap_zone *, int, u64 *); + int (*get_min_power_uw)(struct powercap_zone *, int, u64 *); + int (*get_max_time_window_us)(struct powercap_zone *, int, u64 *); + int (*get_min_time_window_us)(struct powercap_zone *, int, u64 *); + const char * (*get_name)(struct powercap_zone *, int); +}; + +struct powercap_constraint_attr { + struct device_attribute power_limit_attr; + struct device_attribute time_window_attr; + struct device_attribute max_power_attr; + struct device_attribute min_power_attr; + struct device_attribute max_time_window_attr; + struct device_attribute min_time_window_attr; + struct device_attribute name_attr; +}; + +struct trace_event_raw_mc_event { + struct trace_entry ent; + unsigned int error_type; + u32 __data_loc_msg; + u32 __data_loc_label; + u16 error_count; + u8 mc_index; + s8 top_layer; + s8 middle_layer; + s8 lower_layer; + long int address; + u8 grain_bits; + long int syndrome; + u32 __data_loc_driver_detail; + char __data[0]; +}; + +struct trace_event_raw_arm_event { + struct trace_entry ent; + u64 mpidr; + u64 midr; + u32 running_state; + u32 psci_state; + u8 affinity; + char __data[0]; +}; + +struct trace_event_raw_non_standard_event { + struct trace_entry ent; + char sec_type[16]; + char fru_id[16]; + u32 __data_loc_fru_text; + u8 sev; + u32 len; + u32 __data_loc_buf; + char __data[0]; +}; + +struct trace_event_raw_aer_event { + struct trace_entry ent; + u32 __data_loc_dev_name; + u32 status; + u8 severity; + u8 tlp_header_valid; + u32 tlp_header[4]; + char __data[0]; +}; + +struct trace_event_raw_memory_failure_event { + struct trace_entry ent; + long unsigned int pfn; + int type; + int result; + char __data[0]; +}; + +struct trace_event_data_offsets_mc_event { + u32 msg; + u32 label; + u32 driver_detail; +}; + +struct trace_event_data_offsets_arm_event {}; + +struct trace_event_data_offsets_non_standard_event { + u32 fru_text; + u32 buf; +}; + +struct trace_event_data_offsets_aer_event { + u32 dev_name; +}; + +struct trace_event_data_offsets_memory_failure_event {}; + +typedef void (*btf_trace_mc_event)(void *, const unsigned int, const char *, const char *, const int, const u8, const s8, const s8, const s8, long unsigned int, const u8, long unsigned int, const char *); + +typedef void (*btf_trace_arm_event)(void *, const struct cper_sec_proc_arm *); + +typedef void (*btf_trace_non_standard_event)(void *, const guid_t *, const guid_t *, const char *, const u8, const u8 *, const u32); + +typedef void (*btf_trace_aer_event)(void *, const char *, const u32, const u8, const u8, struct aer_header_log_regs *); + +typedef void (*btf_trace_memory_failure_event)(void *, long unsigned int, int, int); + +struct ce_array { + u64 *array; + unsigned int n; + unsigned int decay_count; + u64 pfns_poisoned; + u64 ces_entered; + u64 decays_done; + union { + struct { + __u32 disabled: 1; + __u32 __resv: 31; + }; + __u32 flags; + }; +}; + +struct nvmem_cell_lookup { + const char *nvmem_name; + const char *cell_name; + const char *dev_id; + const char *con_id; + struct list_head node; +}; + +enum { + NVMEM_ADD = 1, + NVMEM_REMOVE = 2, + NVMEM_CELL_ADD = 3, + NVMEM_CELL_REMOVE = 4, +}; + +struct nvmem_cell_table { + const char *nvmem_name; + const struct nvmem_cell_info *cells; + size_t ncells; + struct list_head node; +}; + +struct nvmem_device___2 { + struct module *owner; + struct device dev; + int stride; + int word_size; + int id; + struct kref refcnt; + size_t size; + bool read_only; + bool root_only; + int flags; + enum nvmem_type type; + struct bin_attribute eeprom; + struct device *base_dev; + struct list_head cells; + const struct nvmem_keepout *keepout; + unsigned int nkeepout; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; + struct gpio_desc___2 *wp_gpio; + void *priv; +}; + +struct nvmem_cell { + const char *name; + int offset; + int bytes; + int bit_offset; + int nbits; + struct device_node *np; + struct nvmem_device___2 *nvmem; + struct list_head node; +}; + +struct icc_node; + +struct icc_req { + struct hlist_node req_node; + struct icc_node *node; + struct device *dev; + bool enabled; + u32 tag; + u32 avg_bw; + u32 peak_bw; +}; + +struct icc_path { + const char *name; + size_t num_nodes; + struct icc_req reqs[0]; +}; + +struct icc_node_data { + struct icc_node *node; + u32 tag; +}; + +struct icc_provider; + +struct icc_node { + int id; + const char *name; + struct icc_node **links; + size_t num_links; + struct icc_provider *provider; + struct list_head node_list; + struct list_head search_list; + struct icc_node *reverse; + u8 is_traversed: 1; + struct hlist_head req_list; + u32 avg_bw; + u32 peak_bw; + u32 init_avg; + u32 init_peak; + void *data; +}; + +struct icc_onecell_data { + unsigned int num_nodes; + struct icc_node *nodes[0]; +}; + +struct icc_provider { + struct list_head provider_list; + struct list_head nodes; + int (*set)(struct icc_node *, struct icc_node *); + int (*aggregate)(struct icc_node *, u32, u32, u32, u32 *, u32 *); + void (*pre_aggregate)(struct icc_node *); + int (*get_bw)(struct icc_node *, u32 *, u32 *); + struct icc_node * (*xlate)(struct of_phandle_args *, void *); + struct icc_node_data * (*xlate_extended)(struct of_phandle_args *, void *); + struct device *dev; + int users; + bool inter_set; + void *data; +}; + +struct trace_event_raw_icc_set_bw { + struct trace_entry ent; + u32 __data_loc_path_name; + u32 __data_loc_dev; + u32 __data_loc_node_name; + u32 avg_bw; + u32 peak_bw; + u32 node_avg_bw; + u32 node_peak_bw; + char __data[0]; +}; + +struct trace_event_raw_icc_set_bw_end { + struct trace_entry ent; + u32 __data_loc_path_name; + u32 __data_loc_dev; + int ret; + char __data[0]; +}; + +struct trace_event_data_offsets_icc_set_bw { + u32 path_name; + u32 dev; + u32 node_name; +}; + +struct trace_event_data_offsets_icc_set_bw_end { + u32 path_name; + u32 dev; +}; + +typedef void (*btf_trace_icc_set_bw)(void *, struct icc_path *, struct icc_node *, int, u32, u32); + +typedef void (*btf_trace_icc_set_bw_end)(void *, struct icc_path *, int); + +struct icc_path___2; + +struct icc_bulk_data { + struct icc_path___2 *path; + const char *name; + u32 avg_bw; + u32 peak_bw; +}; + +struct net_device_devres { + struct net_device *ndev; +}; + +struct __kernel_old_timespec { + __kernel_old_time_t tv_sec; + long int tv_nsec; +}; + +struct __kernel_sock_timeval { + __s64 tv_sec; + __s64 tv_usec; +}; + +struct mmsghdr { + struct user_msghdr msg_hdr; + unsigned int msg_len; +}; + +struct scm_timestamping_internal { + struct timespec64 ts[3]; +}; + +struct ifconf { + int ifc_len; + union { + char *ifcu_buf; + struct ifreq *ifcu_req; + } ifc_ifcu; +}; + +struct compat_ifmap { + compat_ulong_t mem_start; + compat_ulong_t mem_end; + short unsigned int base_addr; + unsigned char irq; + unsigned char dma; + unsigned char port; +}; + +struct compat_if_settings { + unsigned int type; + unsigned int size; + compat_uptr_t ifs_ifsu; +}; + +struct compat_ifreq { + union { + char ifrn_name[16]; + } ifr_ifrn; + union { + struct sockaddr ifru_addr; + struct sockaddr ifru_dstaddr; + struct sockaddr ifru_broadaddr; + struct sockaddr ifru_netmask; + struct sockaddr ifru_hwaddr; + short int ifru_flags; + compat_int_t ifru_ivalue; + compat_int_t ifru_mtu; + struct compat_ifmap ifru_map; + char ifru_slave[16]; + char ifru_newname[16]; + compat_caddr_t ifru_data; + struct compat_if_settings ifru_settings; + } ifr_ifru; +}; + +struct compat_ifconf { + compat_int_t ifc_len; + compat_caddr_t ifcbuf; +}; + +enum sock_shutdown_cmd { + SHUT_RD = 0, + SHUT_WR = 1, + SHUT_RDWR = 2, +}; + +struct compat_ethtool_rx_flow_spec { + u32 flow_type; + union ethtool_flow_union h_u; + struct ethtool_flow_ext h_ext; + union ethtool_flow_union m_u; + struct ethtool_flow_ext m_ext; + compat_u64 ring_cookie; + u32 location; +} __attribute__((packed)); + +struct compat_ethtool_rxnfc { + u32 cmd; + u32 flow_type; + compat_u64 data; + struct compat_ethtool_rx_flow_spec fs; + u32 rule_cnt; + u32 rule_locs[0]; +} __attribute__((packed)); + +struct libipw_device; + +struct iw_spy_data; + +struct iw_public_data { + struct iw_spy_data *spy_data; + struct libipw_device *libipw; +}; + +struct iw_param { + __s32 value; + __u8 fixed; + __u8 disabled; + __u16 flags; +}; + +struct iw_point { + void *pointer; + __u16 length; + __u16 flags; +}; + +struct iw_freq { + __s32 m; + __s16 e; + __u8 i; + __u8 flags; +}; + +struct iw_quality { + __u8 qual; + __u8 level; + __u8 noise; + __u8 updated; +}; + +struct iw_discarded { + __u32 nwid; + __u32 code; + __u32 fragment; + __u32 retries; + __u32 misc; +}; + +struct iw_missed { + __u32 beacon; +}; + +struct iw_statistics { + __u16 status; + struct iw_quality qual; + struct iw_discarded discard; + struct iw_missed miss; +}; + +union iwreq_data { + char name[16]; + struct iw_point essid; + struct iw_param nwid; + struct iw_freq freq; + struct iw_param sens; + struct iw_param bitrate; + struct iw_param txpower; + struct iw_param rts; + struct iw_param frag; + __u32 mode; + struct iw_param retry; + struct iw_point encoding; + struct iw_param power; + struct iw_quality qual; + struct sockaddr ap_addr; + struct sockaddr addr; + struct iw_param param; + struct iw_point data; +}; + +struct iw_priv_args { + __u32 cmd; + __u16 set_args; + __u16 get_args; + char name[16]; +}; + +struct compat_mmsghdr { + struct compat_msghdr msg_hdr; + compat_uint_t msg_len; +}; + +struct iw_request_info { + __u16 cmd; + __u16 flags; +}; + +struct iw_spy_data { + int spy_number; + u_char spy_address[48]; + struct iw_quality spy_stat[8]; + struct iw_quality spy_thr_low; + struct iw_quality spy_thr_high; + u_char spy_thr_under[8]; +}; + +enum { + SOF_TIMESTAMPING_TX_HARDWARE = 1, + SOF_TIMESTAMPING_TX_SOFTWARE = 2, + SOF_TIMESTAMPING_RX_HARDWARE = 4, + SOF_TIMESTAMPING_RX_SOFTWARE = 8, + SOF_TIMESTAMPING_SOFTWARE = 16, + SOF_TIMESTAMPING_SYS_HARDWARE = 32, + SOF_TIMESTAMPING_RAW_HARDWARE = 64, + SOF_TIMESTAMPING_OPT_ID = 128, + SOF_TIMESTAMPING_TX_SCHED = 256, + SOF_TIMESTAMPING_TX_ACK = 512, + SOF_TIMESTAMPING_OPT_CMSG = 1024, + SOF_TIMESTAMPING_OPT_TSONLY = 2048, + SOF_TIMESTAMPING_OPT_STATS = 4096, + SOF_TIMESTAMPING_OPT_PKTINFO = 8192, + SOF_TIMESTAMPING_OPT_TX_SWHW = 16384, + SOF_TIMESTAMPING_LAST = 16384, + SOF_TIMESTAMPING_MASK = 32767, +}; + +struct scm_ts_pktinfo { + __u32 if_index; + __u32 pkt_length; + __u32 reserved[2]; +}; + +struct sock_skb_cb { + u32 dropcount; +}; + +struct sock_ee_data_rfc4884 { + __u16 len; + __u8 flags; + __u8 reserved; +}; + +struct sock_extended_err { + __u32 ee_errno; + __u8 ee_origin; + __u8 ee_type; + __u8 ee_code; + __u8 ee_pad; + __u32 ee_info; + union { + __u32 ee_data; + struct sock_ee_data_rfc4884 ee_rfc4884; + }; +}; + +struct sock_exterr_skb { + union { + struct inet_skb_parm h4; + struct inet6_skb_parm h6; + } header; + struct sock_extended_err ee; + u16 addr_offset; + __be16 port; + u8 opt_stats: 1; + u8 unused: 7; +}; + +struct used_address { + struct __kernel_sockaddr_storage name; + unsigned int name_len; +}; + +struct linger { + int l_onoff; + int l_linger; +}; + +struct ucred { + __u32 pid; + __u32 uid; + __u32 gid; +}; + +struct mmpin { + struct user_struct *user; + unsigned int num_pg; +}; + +struct ubuf_info { + void (*callback)(struct ubuf_info *, bool); + union { + struct { + long unsigned int desc; + void *ctx; + }; + struct { + u32 id; + u16 len; + u16 zerocopy: 1; + u32 bytelen; + }; + }; + refcount_t refcnt; + struct mmpin mmp; +}; + +enum { + SKB_GSO_TCPV4 = 1, + SKB_GSO_DODGY = 2, + SKB_GSO_TCP_ECN = 4, + SKB_GSO_TCP_FIXEDID = 8, + SKB_GSO_TCPV6 = 16, + SKB_GSO_FCOE = 32, + SKB_GSO_GRE = 64, + SKB_GSO_GRE_CSUM = 128, + SKB_GSO_IPXIP4 = 256, + SKB_GSO_IPXIP6 = 512, + SKB_GSO_UDP_TUNNEL = 1024, + SKB_GSO_UDP_TUNNEL_CSUM = 2048, + SKB_GSO_PARTIAL = 4096, + SKB_GSO_TUNNEL_REMCSUM = 8192, + SKB_GSO_SCTP = 16384, + SKB_GSO_ESP = 32768, + SKB_GSO_UDP = 65536, + SKB_GSO_UDP_L4 = 131072, + SKB_GSO_FRAGLIST = 262144, +}; + +struct prot_inuse { + int val[64]; +}; + +struct gro_list { + struct list_head list; + int count; +}; + +struct napi_struct { + struct list_head poll_list; + long unsigned int state; + int weight; + int defer_hard_irqs_count; + long unsigned int gro_bitmask; + int (*poll)(struct napi_struct *, int); + int poll_owner; + struct net_device *dev; + struct gro_list gro_hash[8]; + struct sk_buff *skb; + struct list_head rx_list; + int rx_count; + struct hrtimer timer; + struct list_head dev_list; + struct hlist_node napi_hash_node; + unsigned int napi_id; +}; + +struct sd_flow_limit { + u64 count; + unsigned int num_buckets; + unsigned int history_head; + u16 history[128]; + u8 buckets[0]; +}; + +struct softnet_data { + struct list_head poll_list; + struct sk_buff_head process_queue; + unsigned int processed; + unsigned int time_squeeze; + unsigned int received_rps; + struct softnet_data *rps_ipi_list; + struct sd_flow_limit *flow_limit; + struct Qdisc *output_queue; + struct Qdisc **output_queue_tailp; + struct sk_buff *completion_queue; + struct sk_buff_head xfrm_backlog; + struct { + u16 recursion; + u8 more; + } xmit; + int: 32; + unsigned int input_queue_head; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + call_single_data_t csd; + struct softnet_data *rps_ipi_next; + unsigned int cpu; + unsigned int input_queue_tail; + unsigned int dropped; + struct sk_buff_head input_pkt_queue; + struct napi_struct backlog; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +enum txtime_flags { + SOF_TXTIME_DEADLINE_MODE = 1, + SOF_TXTIME_REPORT_ERRORS = 2, + SOF_TXTIME_FLAGS_LAST = 2, + SOF_TXTIME_FLAGS_MASK = 3, +}; + +struct sock_txtime { + __kernel_clockid_t clockid; + __u32 flags; +}; + +enum sk_pacing { + SK_PACING_NONE = 0, + SK_PACING_NEEDED = 1, + SK_PACING_FQ = 2, +}; + +struct sockcm_cookie { + u64 transmit_time; + u32 mark; + u16 tsflags; +}; + +struct fastopen_queue { + struct request_sock *rskq_rst_head; + struct request_sock *rskq_rst_tail; + spinlock_t lock; + int qlen; + int max_qlen; + struct tcp_fastopen_context *ctx; +}; + +struct request_sock_queue { + spinlock_t rskq_lock; + u8 rskq_defer_accept; + u32 synflood_warned; + atomic_t qlen; + atomic_t young; + struct request_sock *rskq_accept_head; + struct request_sock *rskq_accept_tail; + struct fastopen_queue fastopenq; +}; + +struct inet_connection_sock_af_ops { + int (*queue_xmit)(struct sock *, struct sk_buff *, struct flowi *); + void (*send_check)(struct sock *, struct sk_buff *); + int (*rebuild_header)(struct sock *); + void (*sk_rx_dst_set)(struct sock *, const struct sk_buff *); + int (*conn_request)(struct sock *, struct sk_buff *); + struct sock * (*syn_recv_sock)(const struct sock *, struct sk_buff *, struct request_sock *, struct dst_entry *, struct request_sock *, bool *); + u16 net_header_len; + u16 net_frag_header_len; + u16 sockaddr_len; + int (*setsockopt)(struct sock *, int, int, sockptr_t, unsigned int); + int (*getsockopt)(struct sock *, int, int, char *, int *); + void (*addr2sockaddr)(struct sock *, struct sockaddr *); + void (*mtu_reduced)(struct sock *); +}; + +struct inet_bind_bucket; + +struct tcp_ulp_ops; + +struct inet_connection_sock { + struct inet_sock icsk_inet; + struct request_sock_queue icsk_accept_queue; + struct inet_bind_bucket *icsk_bind_hash; + long unsigned int icsk_timeout; + struct timer_list icsk_retransmit_timer; + struct timer_list icsk_delack_timer; + __u32 icsk_rto; + __u32 icsk_rto_min; + __u32 icsk_delack_max; + __u32 icsk_pmtu_cookie; + const struct tcp_congestion_ops *icsk_ca_ops; + const struct inet_connection_sock_af_ops *icsk_af_ops; + const struct tcp_ulp_ops *icsk_ulp_ops; + void *icsk_ulp_data; + void (*icsk_clean_acked)(struct sock *, u32); + struct hlist_node icsk_listen_portaddr_node; + unsigned int (*icsk_sync_mss)(struct sock *, u32); + __u8 icsk_ca_state: 5; + __u8 icsk_ca_initialized: 1; + __u8 icsk_ca_setsockopt: 1; + __u8 icsk_ca_dst_locked: 1; + __u8 icsk_retransmits; + __u8 icsk_pending; + __u8 icsk_backoff; + __u8 icsk_syn_retries; + __u8 icsk_probes_out; + __u16 icsk_ext_hdr_len; + struct { + __u8 pending; + __u8 quick; + __u8 pingpong; + __u8 retry; + __u32 ato; + long unsigned int timeout; + __u32 lrcvtime; + __u16 last_seg_size; + __u16 rcv_mss; + } icsk_ack; + struct { + int enabled; + int search_high; + int search_low; + int probe_size; + u32 probe_timestamp; + } icsk_mtup; + u32 icsk_probes_tstamp; + u32 icsk_user_timeout; + u64 icsk_ca_priv[13]; +}; + +struct inet_bind_bucket { + possible_net_t ib_net; + int l3mdev; + short unsigned int port; + signed char fastreuse; + signed char fastreuseport; + kuid_t fastuid; + struct in6_addr fast_v6_rcv_saddr; + __be32 fast_rcv_saddr; + short unsigned int fast_sk_family; + bool fast_ipv6_only; + struct hlist_node node; + struct hlist_head owners; +}; + +struct tcp_ulp_ops { + struct list_head list; + int (*init)(struct sock *); + void (*update)(struct sock *, struct proto *, void (*)(struct sock *)); + void (*release)(struct sock *); + int (*get_info)(const struct sock *, struct sk_buff *); + size_t (*get_info_size)(const struct sock *); + void (*clone)(const struct request_sock *, struct sock *, const gfp_t); + char name[16]; + struct module *owner; +}; + +struct tcp_fastopen_cookie { + __le64 val[2]; + s8 len; + bool exp; +}; + +struct tcp_sack_block { + u32 start_seq; + u32 end_seq; +}; + +struct tcp_options_received { + int ts_recent_stamp; + u32 ts_recent; + u32 rcv_tsval; + u32 rcv_tsecr; + u16 saw_tstamp: 1; + u16 tstamp_ok: 1; + u16 dsack: 1; + u16 wscale_ok: 1; + u16 sack_ok: 3; + u16 smc_ok: 1; + u16 snd_wscale: 4; + u16 rcv_wscale: 4; + u8 saw_unknown: 1; + u8 unused: 7; + u8 num_sacks; + u16 user_mss; + u16 mss_clamp; +}; + +struct tcp_rack { + u64 mstamp; + u32 rtt_us; + u32 end_seq; + u32 last_delivered; + u8 reo_wnd_steps; + u8 reo_wnd_persist: 5; + u8 dsack_seen: 1; + u8 advanced: 1; +}; + +struct tcp_sock_af_ops; + +struct tcp_md5sig_info; + +struct tcp_fastopen_request; + +struct tcp_sock { + struct inet_connection_sock inet_conn; + u16 tcp_header_len; + u16 gso_segs; + __be32 pred_flags; + u64 bytes_received; + u32 segs_in; + u32 data_segs_in; + u32 rcv_nxt; + u32 copied_seq; + u32 rcv_wup; + u32 snd_nxt; + u32 segs_out; + u32 data_segs_out; + u64 bytes_sent; + u64 bytes_acked; + u32 dsack_dups; + u32 snd_una; + u32 snd_sml; + u32 rcv_tstamp; + u32 lsndtime; + u32 last_oow_ack_time; + u32 compressed_ack_rcv_nxt; + u32 tsoffset; + struct list_head tsq_node; + struct list_head tsorted_sent_queue; + u32 snd_wl1; + u32 snd_wnd; + u32 max_window; + u32 mss_cache; + u32 window_clamp; + u32 rcv_ssthresh; + struct tcp_rack rack; + u16 advmss; + u8 compressed_ack; + u8 dup_ack_counter: 2; + u8 tlp_retrans: 1; + u8 unused: 5; + u32 chrono_start; + u32 chrono_stat[3]; + u8 chrono_type: 2; + u8 rate_app_limited: 1; + u8 fastopen_connect: 1; + u8 fastopen_no_cookie: 1; + u8 is_sack_reneg: 1; + u8 fastopen_client_fail: 2; + u8 nonagle: 4; + u8 thin_lto: 1; + u8 recvmsg_inq: 1; + u8 repair: 1; + u8 frto: 1; + u8 repair_queue; + u8 save_syn: 2; + u8 syn_data: 1; + u8 syn_fastopen: 1; + u8 syn_fastopen_exp: 1; + u8 syn_fastopen_ch: 1; + u8 syn_data_acked: 1; + u8 is_cwnd_limited: 1; + u32 tlp_high_seq; + u32 tcp_tx_delay; + u64 tcp_wstamp_ns; + u64 tcp_clock_cache; + u64 tcp_mstamp; + u32 srtt_us; + u32 mdev_us; + u32 mdev_max_us; + u32 rttvar_us; + u32 rtt_seq; + struct minmax rtt_min; + u32 packets_out; + u32 retrans_out; + u32 max_packets_out; + u32 max_packets_seq; + u16 urg_data; + u8 ecn_flags; + u8 keepalive_probes; + u32 reordering; + u32 reord_seen; + u32 snd_up; + struct tcp_options_received rx_opt; + u32 snd_ssthresh; + u32 snd_cwnd; + u32 snd_cwnd_cnt; + u32 snd_cwnd_clamp; + u32 snd_cwnd_used; + u32 snd_cwnd_stamp; + u32 prior_cwnd; + u32 prr_delivered; + u32 prr_out; + u32 delivered; + u32 delivered_ce; + u32 lost; + u32 app_limited; + u64 first_tx_mstamp; + u64 delivered_mstamp; + u32 rate_delivered; + u32 rate_interval_us; + u32 rcv_wnd; + u32 write_seq; + u32 notsent_lowat; + u32 pushed_seq; + u32 lost_out; + u32 sacked_out; + struct hrtimer pacing_timer; + struct hrtimer compressed_ack_timer; + struct sk_buff *lost_skb_hint; + struct sk_buff *retransmit_skb_hint; + struct rb_root out_of_order_queue; + struct sk_buff *ooo_last_skb; + struct tcp_sack_block duplicate_sack[1]; + struct tcp_sack_block selective_acks[4]; + struct tcp_sack_block recv_sack_cache[4]; + struct sk_buff *highest_sack; + int lost_cnt_hint; + u32 prior_ssthresh; + u32 high_seq; + u32 retrans_stamp; + u32 undo_marker; + int undo_retrans; + u64 bytes_retrans; + u32 total_retrans; + u32 urg_seq; + unsigned int keepalive_time; + unsigned int keepalive_intvl; + int linger2; + u8 bpf_sock_ops_cb_flags; + u16 timeout_rehash; + u32 rcv_ooopack; + u32 rcv_rtt_last_tsecr; + struct { + u32 rtt_us; + u32 seq; + u64 time; + } rcv_rtt_est; + struct { + u32 space; + u32 seq; + u64 time; + } rcvq_space; + struct { + u32 probe_seq_start; + u32 probe_seq_end; + } mtu_probe; + u32 mtu_info; + bool is_mptcp; + bool syn_smc; + const struct tcp_sock_af_ops *af_specific; + struct tcp_md5sig_info *md5sig_info; + struct tcp_fastopen_request *fastopen_req; + struct request_sock *fastopen_rsk; + struct saved_syn *saved_syn; +}; + +struct tcp_md5sig_key; + +struct tcp_sock_af_ops { + struct tcp_md5sig_key * (*md5_lookup)(const struct sock *, const struct sock *); + int (*calc_md5_hash)(char *, const struct tcp_md5sig_key *, const struct sock *, const struct sk_buff *); + int (*md5_parse)(struct sock *, int, sockptr_t, int); +}; + +struct tcp_md5sig_info { + struct hlist_head head; + struct callback_head rcu; +}; + +struct tcp_fastopen_request { + struct tcp_fastopen_cookie cookie; + struct msghdr *data; + size_t size; + int copied; + struct ubuf_info *uarg; +}; + +union tcp_md5_addr { + struct in_addr a4; + struct in6_addr a6; +}; + +struct tcp_md5sig_key { + struct hlist_node node; + u8 keylen; + u8 family; + u8 prefixlen; + union tcp_md5_addr addr; + int l3index; + u8 key[80]; + struct callback_head rcu; +}; + +struct net_protocol { + int (*early_demux)(struct sk_buff *); + int (*early_demux_handler)(struct sk_buff *); + int (*handler)(struct sk_buff *); + int (*err_handler)(struct sk_buff *, u32); + unsigned int no_policy: 1; + unsigned int netns_ok: 1; + unsigned int icmp_strict_tag_validation: 1; +}; + +struct cgroup_cls_state { + struct cgroup_subsys_state css; + u32 classid; +}; + +enum { + SK_MEMINFO_RMEM_ALLOC = 0, + SK_MEMINFO_RCVBUF = 1, + SK_MEMINFO_WMEM_ALLOC = 2, + SK_MEMINFO_SNDBUF = 3, + SK_MEMINFO_FWD_ALLOC = 4, + SK_MEMINFO_WMEM_QUEUED = 5, + SK_MEMINFO_OPTMEM = 6, + SK_MEMINFO_BACKLOG = 7, + SK_MEMINFO_DROPS = 8, + SK_MEMINFO_VARS = 9, +}; + +enum sknetlink_groups { + SKNLGRP_NONE = 0, + SKNLGRP_INET_TCP_DESTROY = 1, + SKNLGRP_INET_UDP_DESTROY = 2, + SKNLGRP_INET6_TCP_DESTROY = 3, + SKNLGRP_INET6_UDP_DESTROY = 4, + __SKNLGRP_MAX = 5, +}; + +struct inet_request_sock { + struct request_sock req; + u16 snd_wscale: 4; + u16 rcv_wscale: 4; + u16 tstamp_ok: 1; + u16 sack_ok: 1; + u16 wscale_ok: 1; + u16 ecn_ok: 1; + u16 acked: 1; + u16 no_srccheck: 1; + u16 smc_ok: 1; + u32 ir_mark; + union { + struct ip_options_rcu *ireq_opt; + struct { + struct ipv6_txoptions *ipv6_opt; + struct sk_buff *pktopts; + }; + }; +}; + +struct tcp_request_sock_ops; + +struct tcp_request_sock { + struct inet_request_sock req; + const struct tcp_request_sock_ops *af_specific; + u64 snt_synack; + bool tfo_listener; + bool is_mptcp; + bool drop_req; + u32 txhash; + u32 rcv_isn; + u32 snt_isn; + u32 ts_off; + u32 last_oow_ack_time; + u32 rcv_nxt; + u8 syn_tos; +}; + +enum tcp_synack_type { + TCP_SYNACK_NORMAL = 0, + TCP_SYNACK_FASTOPEN = 1, + TCP_SYNACK_COOKIE = 2, +}; + +struct tcp_request_sock_ops { + u16 mss_clamp; + struct tcp_md5sig_key * (*req_md5_lookup)(const struct sock *, const struct sock *); + int (*calc_md5_hash)(char *, const struct tcp_md5sig_key *, const struct sock *, const struct sk_buff *); + __u32 (*cookie_init_seq)(const struct sk_buff *, __u16 *); + struct dst_entry * (*route_req)(const struct sock *, struct sk_buff *, struct flowi *, struct request_sock *); + u32 (*init_seq)(const struct sk_buff *); + u32 (*init_ts_off)(const struct net *, const struct sk_buff *); + int (*send_synack)(const struct sock *, struct dst_entry *, struct flowi *, struct request_sock *, struct tcp_fastopen_cookie *, enum tcp_synack_type, struct sk_buff *); +}; + +struct nf_conntrack { + atomic_t use; +}; + +enum { + SKB_FCLONE_UNAVAILABLE = 0, + SKB_FCLONE_ORIG = 1, + SKB_FCLONE_CLONE = 2, +}; + +struct sk_buff_fclones { + struct sk_buff skb1; + struct sk_buff skb2; + refcount_t fclone_ref; +}; + +struct skb_seq_state { + __u32 lower_offset; + __u32 upper_offset; + __u32 frag_idx; + __u32 stepped_offset; + struct sk_buff *root_skb; + struct sk_buff *cur_skb; + __u8 *frag_data; + __u32 frag_off; +}; + +struct skb_checksum_ops { + __wsum (*update)(const void *, int, __wsum); + __wsum (*combine)(__wsum, __wsum, int, int); +}; + +struct skb_gso_cb { + union { + int mac_offset; + int data_offset; + }; + int encap_level; + __wsum csum; + __u16 csum_start; +}; + +struct napi_gro_cb { + void *frag0; + unsigned int frag0_len; + int data_offset; + u16 flush; + u16 flush_id; + u16 count; + u16 gro_remcsum_start; + long unsigned int age; + u16 proto; + u8 same_flow: 1; + u8 encap_mark: 1; + u8 csum_valid: 1; + u8 csum_cnt: 3; + u8 free: 2; + u8 is_ipv6: 1; + u8 is_fou: 1; + u8 is_atomic: 1; + u8 recursion_counter: 4; + u8 is_flist: 1; + __wsum csum; + struct sk_buff *last; +}; + +enum skb_free_reason { + SKB_REASON_CONSUMED = 0, + SKB_REASON_DROPPED = 1, +}; + +struct vlan_hdr { + __be16 h_vlan_TCI; + __be16 h_vlan_encapsulated_proto; +}; + +struct vlan_ethhdr { + unsigned char h_dest[6]; + unsigned char h_source[6]; + __be16 h_vlan_proto; + __be16 h_vlan_TCI; + __be16 h_vlan_encapsulated_proto; +}; + +struct qdisc_walker { + int stop; + int skip; + int count; + int (*fn)(struct Qdisc *, long unsigned int, struct qdisc_walker *); +}; + +struct ip_auth_hdr { + __u8 nexthdr; + __u8 hdrlen; + __be16 reserved; + __be32 spi; + __be32 seq_no; + __u8 auth_data[0]; +}; + +struct frag_hdr { + __u8 nexthdr; + __u8 reserved; + __be16 frag_off; + __be32 identification; +}; + +enum { + SCM_TSTAMP_SND = 0, + SCM_TSTAMP_SCHED = 1, + SCM_TSTAMP_ACK = 2, +}; + +struct mpls_shim_hdr { + __be32 label_stack_entry; +}; + +struct napi_alloc_cache { + struct page_frag_cache page; + unsigned int skb_count; + void *skb_cache[64]; +}; + +struct ahash_request___2; + +struct scm_cookie { + struct pid *pid; + struct scm_fp_list *fp; + struct scm_creds creds; + u32 secid; +}; + +struct scm_timestamping { + struct __kernel_old_timespec ts[3]; +}; + +struct scm_timestamping64 { + struct __kernel_timespec ts[3]; +}; + +enum { + TCA_STATS_UNSPEC = 0, + TCA_STATS_BASIC = 1, + TCA_STATS_RATE_EST = 2, + TCA_STATS_QUEUE = 3, + TCA_STATS_APP = 4, + TCA_STATS_RATE_EST64 = 5, + TCA_STATS_PAD = 6, + TCA_STATS_BASIC_HW = 7, + TCA_STATS_PKT64 = 8, + __TCA_STATS_MAX = 9, +}; + +struct gnet_stats_basic { + __u64 bytes; + __u32 packets; +}; + +struct gnet_stats_rate_est { + __u32 bps; + __u32 pps; +}; + +struct gnet_stats_rate_est64 { + __u64 bps; + __u64 pps; +}; + +struct gnet_estimator { + signed char interval; + unsigned char ewma_log; +}; + +struct net_rate_estimator { + struct gnet_stats_basic_packed *bstats; + spinlock_t *stats_lock; + seqcount_t *running; + struct gnet_stats_basic_cpu *cpu_bstats; + u8 ewma_log; + u8 intvl_log; + seqcount_t seq; + u64 last_packets; + u64 last_bytes; + u64 avpps; + u64 avbps; + long unsigned int next_jiffies; + struct timer_list timer; + struct callback_head rcu; +}; + +struct rtgenmsg { + unsigned char rtgen_family; +}; + +enum rtnetlink_groups { + RTNLGRP_NONE = 0, + RTNLGRP_LINK = 1, + RTNLGRP_NOTIFY = 2, + RTNLGRP_NEIGH = 3, + RTNLGRP_TC = 4, + RTNLGRP_IPV4_IFADDR = 5, + RTNLGRP_IPV4_MROUTE = 6, + RTNLGRP_IPV4_ROUTE = 7, + RTNLGRP_IPV4_RULE = 8, + RTNLGRP_IPV6_IFADDR = 9, + RTNLGRP_IPV6_MROUTE = 10, + RTNLGRP_IPV6_ROUTE = 11, + RTNLGRP_IPV6_IFINFO = 12, + RTNLGRP_DECnet_IFADDR = 13, + RTNLGRP_NOP2 = 14, + RTNLGRP_DECnet_ROUTE = 15, + RTNLGRP_DECnet_RULE = 16, + RTNLGRP_NOP4 = 17, + RTNLGRP_IPV6_PREFIX = 18, + RTNLGRP_IPV6_RULE = 19, + RTNLGRP_ND_USEROPT = 20, + RTNLGRP_PHONET_IFADDR = 21, + RTNLGRP_PHONET_ROUTE = 22, + RTNLGRP_DCB = 23, + RTNLGRP_IPV4_NETCONF = 24, + RTNLGRP_IPV6_NETCONF = 25, + RTNLGRP_MDB = 26, + RTNLGRP_MPLS_ROUTE = 27, + RTNLGRP_NSID = 28, + RTNLGRP_MPLS_NETCONF = 29, + RTNLGRP_IPV4_MROUTE_R = 30, + RTNLGRP_IPV6_MROUTE_R = 31, + RTNLGRP_NEXTHOP = 32, + RTNLGRP_BRVLAN = 33, + __RTNLGRP_MAX = 34, +}; + +enum { + NETNSA_NONE = 0, + NETNSA_NSID = 1, + NETNSA_PID = 2, + NETNSA_FD = 3, + NETNSA_TARGET_NSID = 4, + NETNSA_CURRENT_NSID = 5, + __NETNSA_MAX = 6, +}; + +struct pcpu_gen_cookie { + local_t nesting; + u64 last; +}; + +struct gen_cookie { + struct pcpu_gen_cookie *local; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + atomic64_t forward_last; + atomic64_t reverse_last; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, struct netlink_ext_ack *); + +typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); + +enum rtnl_link_flags { + RTNL_FLAG_DOIT_UNLOCKED = 1, +}; + +struct net_fill_args { + u32 portid; + u32 seq; + int flags; + int cmd; + int nsid; + bool add_ref; + int ref_nsid; +}; + +struct rtnl_net_dump_cb { + struct net *tgt_net; + struct net *ref_net; + struct sk_buff *skb; + struct net_fill_args fillargs; + int idx; + int s_idx; +}; + +typedef u16 u_int16_t; + +typedef u32 u_int32_t; + +typedef u64 u_int64_t; + +struct flow_dissector_key_control { + u16 thoff; + u16 addr_type; + u32 flags; +}; + +enum flow_dissect_ret { + FLOW_DISSECT_RET_OUT_GOOD = 0, + FLOW_DISSECT_RET_OUT_BAD = 1, + FLOW_DISSECT_RET_PROTO_AGAIN = 2, + FLOW_DISSECT_RET_IPPROTO_AGAIN = 3, + FLOW_DISSECT_RET_CONTINUE = 4, +}; + +struct flow_dissector_key_basic { + __be16 n_proto; + u8 ip_proto; + u8 padding; +}; + +struct flow_dissector_key_tags { + u32 flow_label; +}; + +struct flow_dissector_key_vlan { + union { + struct { + u16 vlan_id: 12; + u16 vlan_dei: 1; + u16 vlan_priority: 3; + }; + __be16 vlan_tci; + }; + __be16 vlan_tpid; +}; + +struct flow_dissector_mpls_lse { + u32 mpls_ttl: 8; + u32 mpls_bos: 1; + u32 mpls_tc: 3; + u32 mpls_label: 20; +}; + +struct flow_dissector_key_mpls { + struct flow_dissector_mpls_lse ls[7]; + u8 used_lses; +}; + +struct flow_dissector_key_enc_opts { + u8 data[255]; + u8 len; + __be16 dst_opt_type; +}; + +struct flow_dissector_key_keyid { + __be32 keyid; +}; + +struct flow_dissector_key_ipv4_addrs { + __be32 src; + __be32 dst; +}; + +struct flow_dissector_key_ipv6_addrs { + struct in6_addr src; + struct in6_addr dst; +}; + +struct flow_dissector_key_tipc { + __be32 key; +}; + +struct flow_dissector_key_addrs { + union { + struct flow_dissector_key_ipv4_addrs v4addrs; + struct flow_dissector_key_ipv6_addrs v6addrs; + struct flow_dissector_key_tipc tipckey; + }; +}; + +struct flow_dissector_key_arp { + __u32 sip; + __u32 tip; + __u8 op; + unsigned char sha[6]; + unsigned char tha[6]; +}; + +struct flow_dissector_key_ports { + union { + __be32 ports; + struct { + __be16 src; + __be16 dst; + }; + }; +}; + +struct flow_dissector_key_icmp { + struct { + u8 type; + u8 code; + }; + u16 id; +}; + +struct flow_dissector_key_eth_addrs { + unsigned char dst[6]; + unsigned char src[6]; +}; + +struct flow_dissector_key_tcp { + __be16 flags; +}; + +struct flow_dissector_key_ip { + __u8 tos; + __u8 ttl; +}; + +struct flow_dissector_key_meta { + int ingress_ifindex; + u16 ingress_iftype; +}; + +struct flow_dissector_key_ct { + u16 ct_state; + u16 ct_zone; + u32 ct_mark; + u32 ct_labels[4]; +}; + +struct flow_dissector_key_hash { + u32 hash; +}; + +struct flow_dissector_key { + enum flow_dissector_key_id key_id; + size_t offset; +}; + +struct flow_keys_basic { + struct flow_dissector_key_control control; + struct flow_dissector_key_basic basic; +}; + +struct flow_keys { + struct flow_dissector_key_control control; + struct flow_dissector_key_basic basic; + struct flow_dissector_key_tags tags; + struct flow_dissector_key_vlan vlan; + struct flow_dissector_key_vlan cvlan; + struct flow_dissector_key_keyid keyid; + struct flow_dissector_key_ports ports; + struct flow_dissector_key_icmp icmp; + struct flow_dissector_key_addrs addrs; + int: 32; +}; + +struct flow_keys_digest { + u8 data[16]; +}; + +enum ip_conntrack_info { + IP_CT_ESTABLISHED = 0, + IP_CT_RELATED = 1, + IP_CT_NEW = 2, + IP_CT_IS_REPLY = 3, + IP_CT_ESTABLISHED_REPLY = 3, + IP_CT_RELATED_REPLY = 4, + IP_CT_NUMBER = 5, + IP_CT_UNTRACKED = 7, +}; + +struct xt_table_info; + +struct xt_table { + struct list_head list; + unsigned int valid_hooks; + struct xt_table_info *private; + struct module *me; + u_int8_t af; + int priority; + int (*table_init)(struct net *); + const char name[32]; +}; + +union nf_inet_addr { + __u32 all[4]; + __be32 ip; + __be32 ip6[4]; + struct in_addr in; + struct in6_addr in6; +}; + +struct ip_ct_tcp_state { + u_int32_t td_end; + u_int32_t td_maxend; + u_int32_t td_maxwin; + u_int32_t td_maxack; + u_int8_t td_scale; + u_int8_t flags; +}; + +struct ip_ct_tcp { + struct ip_ct_tcp_state seen[2]; + u_int8_t state; + u_int8_t last_dir; + u_int8_t retrans; + u_int8_t last_index; + u_int32_t last_seq; + u_int32_t last_ack; + u_int32_t last_end; + u_int16_t last_win; + u_int8_t last_wscale; + u_int8_t last_flags; +}; + +union nf_conntrack_man_proto { + __be16 all; + struct { + __be16 port; + } tcp; + struct { + __be16 port; + } udp; + struct { + __be16 id; + } icmp; + struct { + __be16 port; + } dccp; + struct { + __be16 port; + } sctp; + struct { + __be16 key; + } gre; +}; + +struct nf_ct_dccp { + u_int8_t role[2]; + u_int8_t state; + u_int8_t last_pkt; + u_int8_t last_dir; + u_int64_t handshake_seq; +}; + +struct ip_ct_sctp { + enum sctp_conntrack state; + __be32 vtag[2]; + u8 last_dir; + u8 flags; +}; + +struct nf_ct_event; + +struct nf_ct_event_notifier { + int (*fcn)(unsigned int, struct nf_ct_event *); +}; + +struct nf_exp_event; + +struct nf_exp_event_notifier { + int (*fcn)(unsigned int, struct nf_exp_event *); +}; + +enum bpf_ret_code { + BPF_OK = 0, + BPF_DROP = 2, + BPF_REDIRECT = 7, + BPF_LWT_REROUTE = 128, +}; + +enum { + BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = 1, + BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = 2, + BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = 4, +}; + +struct ip_tunnel_parm { + char name[16]; + int link; + __be16 i_flags; + __be16 o_flags; + __be32 i_key; + __be32 o_key; + struct iphdr iph; +}; + +struct ip_tunnel_key { + __be64 tun_id; + union { + struct { + __be32 src; + __be32 dst; + } ipv4; + struct { + struct in6_addr src; + struct in6_addr dst; + } ipv6; + } u; + __be16 tun_flags; + u8 tos; + u8 ttl; + __be32 label; + __be16 tp_src; + __be16 tp_dst; +}; + +struct dst_cache_pcpu; + +struct dst_cache { + struct dst_cache_pcpu *cache; + long unsigned int reset_ts; +}; + +struct ip_tunnel_info { + struct ip_tunnel_key key; + struct dst_cache dst_cache; + u8 options_len; + u8 mode; +}; + +struct lwtunnel_state { + __u16 type; + __u16 flags; + __u16 headroom; + atomic_t refcnt; + int (*orig_output)(struct net *, struct sock *, struct sk_buff *); + int (*orig_input)(struct sk_buff *); + struct callback_head rcu; + __u8 data[0]; +}; + +union tcp_word_hdr { + struct tcphdr hdr; + __be32 words[5]; +}; + +struct arphdr { + __be16 ar_hrd; + __be16 ar_pro; + unsigned char ar_hln; + unsigned char ar_pln; + __be16 ar_op; +}; + +struct fib_info; + +struct fib_nh { + struct fib_nh_common nh_common; + struct hlist_node nh_hash; + struct fib_info *nh_parent; + __u32 nh_tclassid; + __be32 nh_saddr; + int nh_saddr_genid; +}; + +struct fib_info { + struct hlist_node fib_hash; + struct hlist_node fib_lhash; + struct list_head nh_list; + struct net *fib_net; + int fib_treeref; + refcount_t fib_clntref; + unsigned int fib_flags; + unsigned char fib_dead; + unsigned char fib_protocol; + unsigned char fib_scope; + unsigned char fib_type; + __be32 fib_prefsrc; + u32 fib_tb_id; + u32 fib_priority; + struct dst_metrics *fib_metrics; + int fib_nhs; + bool fib_nh_is_v6; + bool nh_updated; + struct nexthop *nh; + struct callback_head rcu; + struct fib_nh fib_nh[0]; +}; + +struct nh_info; + +struct nh_group; + +struct nexthop { + struct rb_node rb_node; + struct list_head fi_list; + struct list_head f6i_list; + struct list_head fdb_list; + struct list_head grp_list; + struct net *net; + u32 id; + u8 protocol; + u8 nh_flags; + bool is_group; + refcount_t refcnt; + struct callback_head rcu; + union { + struct nh_info *nh_info; + struct nh_group *nh_grp; + }; +}; + +struct nh_info { + struct hlist_node dev_hash; + struct nexthop *nh_parent; + u8 family; + bool reject_nh; + bool fdb_nh; + union { + struct fib_nh_common fib_nhc; + struct fib_nh fib_nh; + struct fib6_nh fib6_nh; + }; +}; + +struct nh_grp_entry { + struct nexthop *nh; + u8 weight; + atomic_t upper_bound; + struct list_head nh_list; + struct nexthop *nh_parent; +}; + +struct nh_group { + struct nh_group *spare; + u16 num_nh; + bool mpath; + bool fdb_nh; + bool has_v4; + struct nh_grp_entry nh_entries[0]; +}; + +enum metadata_type { + METADATA_IP_TUNNEL = 0, + METADATA_HW_PORT_MUX = 1, +}; + +struct hw_port_info { + struct net_device *lower_dev; + u32 port_id; +}; + +struct metadata_dst { + struct dst_entry dst; + enum metadata_type type; + union { + struct ip_tunnel_info tun_info; + struct hw_port_info port_info; + } u; +}; + +struct gre_base_hdr { + __be16 flags; + __be16 protocol; +}; + +struct gre_full_hdr { + struct gre_base_hdr fixed_header; + __be16 csum; + __be16 reserved1; + __be32 key; + __be32 seq; +}; + +struct pptp_gre_header { + struct gre_base_hdr gre_hd; + __be16 payload_len; + __be16 call_id; + __be32 seq; + __be32 ack; +}; + +struct tipc_basic_hdr { + __be32 w[4]; +}; + +struct icmphdr { + __u8 type; + __u8 code; + __sum16 checksum; + union { + struct { + __be16 id; + __be16 sequence; + } echo; + __be32 gateway; + struct { + __be16 __unused; + __be16 mtu; + } frag; + __u8 reserved[4]; + } un; +}; + +enum l2tp_debug_flags { + L2TP_MSG_DEBUG = 1, + L2TP_MSG_CONTROL = 2, + L2TP_MSG_SEQ = 4, + L2TP_MSG_DATA = 8, +}; + +struct pppoe_tag { + __be16 tag_type; + __be16 tag_len; + char tag_data[0]; +}; + +struct pppoe_hdr { + __u8 type: 4; + __u8 ver: 4; + __u8 code; + __be16 sid; + __be16 length; + struct pppoe_tag tag[0]; +}; + +struct mpls_label { + __be32 entry; +}; + +enum batadv_packettype { + BATADV_IV_OGM = 0, + BATADV_BCAST = 1, + BATADV_CODED = 2, + BATADV_ELP = 3, + BATADV_OGM2 = 4, + BATADV_UNICAST = 64, + BATADV_UNICAST_FRAG = 65, + BATADV_UNICAST_4ADDR = 66, + BATADV_ICMP = 67, + BATADV_UNICAST_TVLV = 68, +}; + +struct batadv_unicast_packet { + __u8 packet_type; + __u8 version; + __u8 ttl; + __u8 ttvn; + __u8 dest[6]; +}; + +struct nf_conntrack_zone { + u16 id; + u8 flags; + u8 dir; +}; + +struct nf_conntrack_man { + union nf_inet_addr u3; + union nf_conntrack_man_proto u; + u_int16_t l3num; +}; + +struct nf_conntrack_tuple { + struct nf_conntrack_man src; + struct { + union nf_inet_addr u3; + union { + __be16 all; + struct { + __be16 port; + } tcp; + struct { + __be16 port; + } udp; + struct { + u_int8_t type; + u_int8_t code; + } icmp; + struct { + __be16 port; + } dccp; + struct { + __be16 port; + } sctp; + struct { + __be16 key; + } gre; + } u; + u_int8_t protonum; + u_int8_t dir; + } dst; +}; + +struct nf_conntrack_tuple_hash { + struct hlist_nulls_node hnnode; + struct nf_conntrack_tuple tuple; +}; + +struct nf_ct_udp { + long unsigned int stream_ts; +}; + +struct nf_ct_gre { + unsigned int stream_timeout; + unsigned int timeout; +}; + +union nf_conntrack_proto { + struct nf_ct_dccp dccp; + struct ip_ct_sctp sctp; + struct ip_ct_tcp tcp; + struct nf_ct_udp udp; + struct nf_ct_gre gre; + unsigned int tmpl_padto; +}; + +struct nf_ct_ext; + +struct nf_conn { + struct nf_conntrack ct_general; + spinlock_t lock; + u32 timeout; + struct nf_conntrack_zone zone; + struct nf_conntrack_tuple_hash tuplehash[2]; + long unsigned int status; + u16 cpu; + possible_net_t ct_net; + struct hlist_node nat_bysource; + struct { } __nfct_init_offset; + struct nf_conn *master; + u_int32_t mark; + u_int32_t secmark; + struct nf_ct_ext *ext; + union nf_conntrack_proto proto; +}; + +struct xt_table_info { + unsigned int size; + unsigned int number; + unsigned int initial_entries; + unsigned int hook_entry[5]; + unsigned int underflow[5]; + unsigned int stacksize; + void ***jumpstack; + unsigned char entries[0]; +}; + +struct nf_conntrack_tuple_mask { + struct { + union nf_inet_addr u3; + union nf_conntrack_man_proto u; + } src; +}; + +struct nf_ct_ext { + u8 offset[8]; + u8 len; + char data[0]; +}; + +struct nf_conntrack_helper; + +struct nf_conntrack_expect { + struct hlist_node lnode; + struct hlist_node hnode; + struct nf_conntrack_tuple tuple; + struct nf_conntrack_tuple_mask mask; + void (*expectfn)(struct nf_conn *, struct nf_conntrack_expect *); + struct nf_conntrack_helper *helper; + struct nf_conn *master; + struct timer_list timeout; + refcount_t use; + unsigned int flags; + unsigned int class; + union nf_inet_addr saved_addr; + union nf_conntrack_man_proto saved_proto; + enum ip_conntrack_dir dir; + struct callback_head rcu; +}; + +enum nf_ct_ext_id { + NF_CT_EXT_HELPER = 0, + NF_CT_EXT_NAT = 1, + NF_CT_EXT_SEQADJ = 2, + NF_CT_EXT_ACCT = 3, + NF_CT_EXT_ECACHE = 4, + NF_CT_EXT_TSTAMP = 5, + NF_CT_EXT_LABELS = 6, + NF_CT_EXT_SYNPROXY = 7, + NF_CT_EXT_NUM = 8, +}; + +struct nf_ct_event { + struct nf_conn *ct; + u32 portid; + int report; +}; + +struct nf_exp_event { + struct nf_conntrack_expect *exp; + u32 portid; + int report; +}; + +struct nf_conn_labels { + long unsigned int bits[2]; +}; + +struct _flow_keys_digest_data { + __be16 n_proto; + u8 ip_proto; + u8 padding; + __be32 ports; + __be32 src; + __be32 dst; +}; + +struct rps_sock_flow_table { + u32 mask; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + u32 ents[0]; +}; + +struct ipv4_devconf { + void *sysctl; + int data[32]; + long unsigned int state[1]; +}; + +enum nf_dev_hooks { + NF_NETDEV_INGRESS = 0, + NF_NETDEV_NUMHOOKS = 1, +}; + +enum { + IF_OPER_UNKNOWN = 0, + IF_OPER_NOTPRESENT = 1, + IF_OPER_DOWN = 2, + IF_OPER_LOWERLAYERDOWN = 3, + IF_OPER_TESTING = 4, + IF_OPER_DORMANT = 5, + IF_OPER_UP = 6, +}; + +struct ifbond { + __s32 bond_mode; + __s32 num_slaves; + __s32 miimon; +}; + +typedef struct ifbond ifbond; + +struct ifslave { + __s32 slave_id; + char slave_name[16]; + __s8 link; + __s8 state; + __u32 link_failure_count; +}; + +typedef struct ifslave ifslave; + +struct netdev_boot_setup { + char name[16]; + struct ifmap map; +}; + +enum { + NAPIF_STATE_SCHED = 1, + NAPIF_STATE_MISSED = 2, + NAPIF_STATE_DISABLE = 4, + NAPIF_STATE_NPSVC = 8, + NAPIF_STATE_LISTED = 16, + NAPIF_STATE_NO_BUSY_POLL = 32, + NAPIF_STATE_IN_BUSY_POLL = 64, + NAPIF_STATE_PREFER_BUSY_POLL = 128, +}; + +enum gro_result { + GRO_MERGED = 0, + GRO_MERGED_FREE = 1, + GRO_HELD = 2, + GRO_NORMAL = 3, + GRO_DROP = 4, + GRO_CONSUMED = 5, +}; + +typedef enum gro_result gro_result_t; + +enum netdev_queue_state_t { + __QUEUE_STATE_DRV_XOFF = 0, + __QUEUE_STATE_STACK_XOFF = 1, + __QUEUE_STATE_FROZEN = 2, +}; + +struct bpf_xdp_link { + struct bpf_link link; + struct net_device *dev; + int flags; +}; + +struct netdev_net_notifier { + struct list_head list; + struct notifier_block *nb; +}; + +struct netpoll; + +struct netpoll_info { + refcount_t refcnt; + struct semaphore dev_lock; + struct sk_buff_head txq; + struct delayed_work tx_work; + struct netpoll *netpoll; + struct callback_head rcu; +}; + +struct udp_tunnel_info { + short unsigned int type; + sa_family_t sa_family; + __be16 port; + u8 hw_priv; +}; + +struct in_ifaddr; + +struct ip_mc_list; + +struct in_device { + struct net_device *dev; + refcount_t refcnt; + int dead; + struct in_ifaddr *ifa_list; + struct ip_mc_list *mc_list; + struct ip_mc_list **mc_hash; + int mc_count; + spinlock_t mc_tomb_lock; + struct ip_mc_list *mc_tomb; + long unsigned int mr_v1_seen; + long unsigned int mr_v2_seen; + long unsigned int mr_maxdelay; + long unsigned int mr_qi; + long unsigned int mr_qri; + unsigned char mr_qrv; + unsigned char mr_gq_running; + unsigned char mr_ifc_count; + struct timer_list mr_gq_timer; + struct timer_list mr_ifc_timer; + struct neigh_parms *arp_parms; + struct ipv4_devconf cnf; + struct callback_head callback_head; +}; + +struct offload_callbacks { + struct sk_buff * (*gso_segment)(struct sk_buff *, netdev_features_t); + struct sk_buff * (*gro_receive)(struct list_head *, struct sk_buff *); + int (*gro_complete)(struct sk_buff *, int); +}; + +struct packet_offload { + __be16 type; + u16 priority; + struct offload_callbacks callbacks; + struct list_head list; +}; + +struct netdev_notifier_info_ext { + struct netdev_notifier_info info; + union { + u32 mtu; + } ext; +}; + +struct netdev_notifier_change_info { + struct netdev_notifier_info info; + unsigned int flags_changed; +}; + +struct netdev_notifier_changelowerstate_info { + struct netdev_notifier_info info; + void *lower_state_info; +}; + +struct netdev_notifier_pre_changeaddr_info { + struct netdev_notifier_info info; + const unsigned char *dev_addr; +}; + +typedef int (*bpf_op_t)(struct net_device *, struct netdev_bpf *); + +enum { + NESTED_SYNC_IMM_BIT = 0, + NESTED_SYNC_TODO_BIT = 1, +}; + +struct netdev_nested_priv { + unsigned char flags; + void *data; +}; + +struct netdev_bonding_info { + ifslave slave; + ifbond master; +}; + +struct netdev_notifier_bonding_info { + struct netdev_notifier_info info; + struct netdev_bonding_info bonding_info; +}; + +union inet_addr { + __u32 all[4]; + __be32 ip; + __be32 ip6[4]; + struct in_addr in; + struct in6_addr in6; +}; + +struct netpoll { + struct net_device *dev; + char dev_name[16]; + const char *name; + union inet_addr local_ip; + union inet_addr remote_ip; + bool ipv6; + u16 local_port; + u16 remote_port; + u8 remote_mac[6]; +}; + +enum qdisc_state_t { + __QDISC_STATE_SCHED = 0, + __QDISC_STATE_DEACTIVATED = 1, +}; + +struct tcf_walker { + int stop; + int skip; + int count; + bool nonempty; + long unsigned int cookie; + int (*fn)(struct tcf_proto *, void *, struct tcf_walker *); +}; + +enum { + IPV4_DEVCONF_FORWARDING = 1, + IPV4_DEVCONF_MC_FORWARDING = 2, + IPV4_DEVCONF_PROXY_ARP = 3, + IPV4_DEVCONF_ACCEPT_REDIRECTS = 4, + IPV4_DEVCONF_SECURE_REDIRECTS = 5, + IPV4_DEVCONF_SEND_REDIRECTS = 6, + IPV4_DEVCONF_SHARED_MEDIA = 7, + IPV4_DEVCONF_RP_FILTER = 8, + IPV4_DEVCONF_ACCEPT_SOURCE_ROUTE = 9, + IPV4_DEVCONF_BOOTP_RELAY = 10, + IPV4_DEVCONF_LOG_MARTIANS = 11, + IPV4_DEVCONF_TAG = 12, + IPV4_DEVCONF_ARPFILTER = 13, + IPV4_DEVCONF_MEDIUM_ID = 14, + IPV4_DEVCONF_NOXFRM = 15, + IPV4_DEVCONF_NOPOLICY = 16, + IPV4_DEVCONF_FORCE_IGMP_VERSION = 17, + IPV4_DEVCONF_ARP_ANNOUNCE = 18, + IPV4_DEVCONF_ARP_IGNORE = 19, + IPV4_DEVCONF_PROMOTE_SECONDARIES = 20, + IPV4_DEVCONF_ARP_ACCEPT = 21, + IPV4_DEVCONF_ARP_NOTIFY = 22, + IPV4_DEVCONF_ACCEPT_LOCAL = 23, + IPV4_DEVCONF_SRC_VMARK = 24, + IPV4_DEVCONF_PROXY_ARP_PVLAN = 25, + IPV4_DEVCONF_ROUTE_LOCALNET = 26, + IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL = 27, + IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL = 28, + IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN = 29, + IPV4_DEVCONF_DROP_UNICAST_IN_L2_MULTICAST = 30, + IPV4_DEVCONF_DROP_GRATUITOUS_ARP = 31, + IPV4_DEVCONF_BC_FORWARDING = 32, + __IPV4_DEVCONF_MAX = 33, +}; + +struct in_ifaddr { + struct hlist_node hash; + struct in_ifaddr *ifa_next; + struct in_device *ifa_dev; + struct callback_head callback_head; + __be32 ifa_local; + __be32 ifa_address; + __be32 ifa_mask; + __u32 ifa_rt_priority; + __be32 ifa_broadcast; + unsigned char ifa_scope; + unsigned char ifa_prefixlen; + __u32 ifa_flags; + char ifa_label[16]; + __u32 ifa_valid_lft; + __u32 ifa_preferred_lft; + long unsigned int ifa_cstamp; + long unsigned int ifa_tstamp; +}; + +struct udp_tunnel_nic_shared { + struct udp_tunnel_nic *udp_tunnel_nic_info; + struct list_head devices; +}; + +struct dev_kfree_skb_cb { + enum skb_free_reason reason; +}; + +struct netdev_adjacent { + struct net_device *dev; + bool master; + bool ignore; + u16 ref_nr; + void *private; + struct list_head list; + struct callback_head rcu; +}; + +struct netdev_hw_addr { + struct list_head list; + unsigned char addr[32]; + unsigned char type; + bool global_use; + int sync_cnt; + int refcount; + int synced; + struct callback_head callback_head; +}; + +enum { + NDA_UNSPEC = 0, + NDA_DST = 1, + NDA_LLADDR = 2, + NDA_CACHEINFO = 3, + NDA_PROBES = 4, + NDA_VLAN = 5, + NDA_PORT = 6, + NDA_VNI = 7, + NDA_IFINDEX = 8, + NDA_MASTER = 9, + NDA_LINK_NETNSID = 10, + NDA_SRC_VNI = 11, + NDA_PROTOCOL = 12, + NDA_NH_ID = 13, + NDA_FDB_EXT_ATTRS = 14, + __NDA_MAX = 15, +}; + +struct nda_cacheinfo { + __u32 ndm_confirmed; + __u32 ndm_used; + __u32 ndm_updated; + __u32 ndm_refcnt; +}; + +struct ndt_stats { + __u64 ndts_allocs; + __u64 ndts_destroys; + __u64 ndts_hash_grows; + __u64 ndts_res_failed; + __u64 ndts_lookups; + __u64 ndts_hits; + __u64 ndts_rcv_probes_mcast; + __u64 ndts_rcv_probes_ucast; + __u64 ndts_periodic_gc_runs; + __u64 ndts_forced_gc_runs; + __u64 ndts_table_fulls; +}; + +enum { + NDTPA_UNSPEC = 0, + NDTPA_IFINDEX = 1, + NDTPA_REFCNT = 2, + NDTPA_REACHABLE_TIME = 3, + NDTPA_BASE_REACHABLE_TIME = 4, + NDTPA_RETRANS_TIME = 5, + NDTPA_GC_STALETIME = 6, + NDTPA_DELAY_PROBE_TIME = 7, + NDTPA_QUEUE_LEN = 8, + NDTPA_APP_PROBES = 9, + NDTPA_UCAST_PROBES = 10, + NDTPA_MCAST_PROBES = 11, + NDTPA_ANYCAST_DELAY = 12, + NDTPA_PROXY_DELAY = 13, + NDTPA_PROXY_QLEN = 14, + NDTPA_LOCKTIME = 15, + NDTPA_QUEUE_LENBYTES = 16, + NDTPA_MCAST_REPROBES = 17, + NDTPA_PAD = 18, + __NDTPA_MAX = 19, +}; + +struct ndtmsg { + __u8 ndtm_family; + __u8 ndtm_pad1; + __u16 ndtm_pad2; +}; + +struct ndt_config { + __u16 ndtc_key_len; + __u16 ndtc_entry_size; + __u32 ndtc_entries; + __u32 ndtc_last_flush; + __u32 ndtc_last_rand; + __u32 ndtc_hash_rnd; + __u32 ndtc_hash_mask; + __u32 ndtc_hash_chain_gc; + __u32 ndtc_proxy_qlen; +}; + +enum { + NDTA_UNSPEC = 0, + NDTA_NAME = 1, + NDTA_THRESH1 = 2, + NDTA_THRESH2 = 3, + NDTA_THRESH3 = 4, + NDTA_CONFIG = 5, + NDTA_PARMS = 6, + NDTA_STATS = 7, + NDTA_GC_INTERVAL = 8, + NDTA_PAD = 9, + __NDTA_MAX = 10, +}; + +enum { + RTN_UNSPEC = 0, + RTN_UNICAST = 1, + RTN_LOCAL = 2, + RTN_BROADCAST = 3, + RTN_ANYCAST = 4, + RTN_MULTICAST = 5, + RTN_BLACKHOLE = 6, + RTN_UNREACHABLE = 7, + RTN_PROHIBIT = 8, + RTN_THROW = 9, + RTN_NAT = 10, + RTN_XRESOLVE = 11, + __RTN_MAX = 12, +}; + +enum { + NEIGH_ARP_TABLE = 0, + NEIGH_ND_TABLE = 1, + NEIGH_DN_TABLE = 2, + NEIGH_NR_TABLES = 3, + NEIGH_LINK_TABLE = 3, +}; + +struct neigh_seq_state { + struct seq_net_private p; + struct neigh_table *tbl; + struct neigh_hash_table *nht; + void * (*neigh_sub_iter)(struct neigh_seq_state *, struct neighbour *, loff_t *); + unsigned int bucket; + unsigned int flags; +}; + +struct neighbour_cb { + long unsigned int sched_next; + unsigned int flags; +}; + +enum netevent_notif_type { + NETEVENT_NEIGH_UPDATE = 1, + NETEVENT_REDIRECT = 2, + NETEVENT_DELAY_PROBE_TIME_UPDATE = 3, + NETEVENT_IPV4_MPATH_HASH_UPDATE = 4, + NETEVENT_IPV6_MPATH_HASH_UPDATE = 5, + NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE = 6, +}; + +struct neigh_dump_filter { + int master_idx; + int dev_idx; +}; + +struct neigh_sysctl_table { + struct ctl_table_header *sysctl_header; + struct ctl_table neigh_vars[21]; +}; + +struct netlink_dump_control { + int (*start)(struct netlink_callback *); + int (*dump)(struct sk_buff *, struct netlink_callback *); + int (*done)(struct netlink_callback *); + void *data; + struct module *module; + u32 min_dump_alloc; +}; + +struct rtnl_link_stats { + __u32 rx_packets; + __u32 tx_packets; + __u32 rx_bytes; + __u32 tx_bytes; + __u32 rx_errors; + __u32 tx_errors; + __u32 rx_dropped; + __u32 tx_dropped; + __u32 multicast; + __u32 collisions; + __u32 rx_length_errors; + __u32 rx_over_errors; + __u32 rx_crc_errors; + __u32 rx_frame_errors; + __u32 rx_fifo_errors; + __u32 rx_missed_errors; + __u32 tx_aborted_errors; + __u32 tx_carrier_errors; + __u32 tx_fifo_errors; + __u32 tx_heartbeat_errors; + __u32 tx_window_errors; + __u32 rx_compressed; + __u32 tx_compressed; + __u32 rx_nohandler; +}; + +struct rtnl_link_ifmap { + __u64 mem_start; + __u64 mem_end; + __u64 base_addr; + __u16 irq; + __u8 dma; + __u8 port; +}; + +enum { + IFLA_UNSPEC = 0, + IFLA_ADDRESS = 1, + IFLA_BROADCAST = 2, + IFLA_IFNAME = 3, + IFLA_MTU = 4, + IFLA_LINK = 5, + IFLA_QDISC = 6, + IFLA_STATS = 7, + IFLA_COST = 8, + IFLA_PRIORITY = 9, + IFLA_MASTER = 10, + IFLA_WIRELESS = 11, + IFLA_PROTINFO = 12, + IFLA_TXQLEN = 13, + IFLA_MAP = 14, + IFLA_WEIGHT = 15, + IFLA_OPERSTATE = 16, + IFLA_LINKMODE = 17, + IFLA_LINKINFO = 18, + IFLA_NET_NS_PID = 19, + IFLA_IFALIAS = 20, + IFLA_NUM_VF = 21, + IFLA_VFINFO_LIST = 22, + IFLA_STATS64 = 23, + IFLA_VF_PORTS = 24, + IFLA_PORT_SELF = 25, + IFLA_AF_SPEC = 26, + IFLA_GROUP = 27, + IFLA_NET_NS_FD = 28, + IFLA_EXT_MASK = 29, + IFLA_PROMISCUITY = 30, + IFLA_NUM_TX_QUEUES = 31, + IFLA_NUM_RX_QUEUES = 32, + IFLA_CARRIER = 33, + IFLA_PHYS_PORT_ID = 34, + IFLA_CARRIER_CHANGES = 35, + IFLA_PHYS_SWITCH_ID = 36, + IFLA_LINK_NETNSID = 37, + IFLA_PHYS_PORT_NAME = 38, + IFLA_PROTO_DOWN = 39, + IFLA_GSO_MAX_SEGS = 40, + IFLA_GSO_MAX_SIZE = 41, + IFLA_PAD = 42, + IFLA_XDP = 43, + IFLA_EVENT = 44, + IFLA_NEW_NETNSID = 45, + IFLA_IF_NETNSID = 46, + IFLA_TARGET_NETNSID = 46, + IFLA_CARRIER_UP_COUNT = 47, + IFLA_CARRIER_DOWN_COUNT = 48, + IFLA_NEW_IFINDEX = 49, + IFLA_MIN_MTU = 50, + IFLA_MAX_MTU = 51, + IFLA_PROP_LIST = 52, + IFLA_ALT_IFNAME = 53, + IFLA_PERM_ADDRESS = 54, + IFLA_PROTO_DOWN_REASON = 55, + __IFLA_MAX = 56, +}; + +enum { + IFLA_PROTO_DOWN_REASON_UNSPEC = 0, + IFLA_PROTO_DOWN_REASON_MASK = 1, + IFLA_PROTO_DOWN_REASON_VALUE = 2, + __IFLA_PROTO_DOWN_REASON_CNT = 3, + IFLA_PROTO_DOWN_REASON_MAX = 2, +}; + +enum { + IFLA_BRPORT_UNSPEC = 0, + IFLA_BRPORT_STATE = 1, + IFLA_BRPORT_PRIORITY = 2, + IFLA_BRPORT_COST = 3, + IFLA_BRPORT_MODE = 4, + IFLA_BRPORT_GUARD = 5, + IFLA_BRPORT_PROTECT = 6, + IFLA_BRPORT_FAST_LEAVE = 7, + IFLA_BRPORT_LEARNING = 8, + IFLA_BRPORT_UNICAST_FLOOD = 9, + IFLA_BRPORT_PROXYARP = 10, + IFLA_BRPORT_LEARNING_SYNC = 11, + IFLA_BRPORT_PROXYARP_WIFI = 12, + IFLA_BRPORT_ROOT_ID = 13, + IFLA_BRPORT_BRIDGE_ID = 14, + IFLA_BRPORT_DESIGNATED_PORT = 15, + IFLA_BRPORT_DESIGNATED_COST = 16, + IFLA_BRPORT_ID = 17, + IFLA_BRPORT_NO = 18, + IFLA_BRPORT_TOPOLOGY_CHANGE_ACK = 19, + IFLA_BRPORT_CONFIG_PENDING = 20, + IFLA_BRPORT_MESSAGE_AGE_TIMER = 21, + IFLA_BRPORT_FORWARD_DELAY_TIMER = 22, + IFLA_BRPORT_HOLD_TIMER = 23, + IFLA_BRPORT_FLUSH = 24, + IFLA_BRPORT_MULTICAST_ROUTER = 25, + IFLA_BRPORT_PAD = 26, + IFLA_BRPORT_MCAST_FLOOD = 27, + IFLA_BRPORT_MCAST_TO_UCAST = 28, + IFLA_BRPORT_VLAN_TUNNEL = 29, + IFLA_BRPORT_BCAST_FLOOD = 30, + IFLA_BRPORT_GROUP_FWD_MASK = 31, + IFLA_BRPORT_NEIGH_SUPPRESS = 32, + IFLA_BRPORT_ISOLATED = 33, + IFLA_BRPORT_BACKUP_PORT = 34, + IFLA_BRPORT_MRP_RING_OPEN = 35, + IFLA_BRPORT_MRP_IN_OPEN = 36, + __IFLA_BRPORT_MAX = 37, +}; + +enum { + IFLA_INFO_UNSPEC = 0, + IFLA_INFO_KIND = 1, + IFLA_INFO_DATA = 2, + IFLA_INFO_XSTATS = 3, + IFLA_INFO_SLAVE_KIND = 4, + IFLA_INFO_SLAVE_DATA = 5, + __IFLA_INFO_MAX = 6, +}; + +enum { + IFLA_VF_INFO_UNSPEC = 0, + IFLA_VF_INFO = 1, + __IFLA_VF_INFO_MAX = 2, +}; + +enum { + IFLA_VF_UNSPEC = 0, + IFLA_VF_MAC = 1, + IFLA_VF_VLAN = 2, + IFLA_VF_TX_RATE = 3, + IFLA_VF_SPOOFCHK = 4, + IFLA_VF_LINK_STATE = 5, + IFLA_VF_RATE = 6, + IFLA_VF_RSS_QUERY_EN = 7, + IFLA_VF_STATS = 8, + IFLA_VF_TRUST = 9, + IFLA_VF_IB_NODE_GUID = 10, + IFLA_VF_IB_PORT_GUID = 11, + IFLA_VF_VLAN_LIST = 12, + IFLA_VF_BROADCAST = 13, + __IFLA_VF_MAX = 14, +}; + +struct ifla_vf_mac { + __u32 vf; + __u8 mac[32]; +}; + +struct ifla_vf_broadcast { + __u8 broadcast[32]; +}; + +struct ifla_vf_vlan { + __u32 vf; + __u32 vlan; + __u32 qos; +}; + +enum { + IFLA_VF_VLAN_INFO_UNSPEC = 0, + IFLA_VF_VLAN_INFO = 1, + __IFLA_VF_VLAN_INFO_MAX = 2, +}; + +struct ifla_vf_vlan_info { + __u32 vf; + __u32 vlan; + __u32 qos; + __be16 vlan_proto; +}; + +struct ifla_vf_tx_rate { + __u32 vf; + __u32 rate; +}; + +struct ifla_vf_rate { + __u32 vf; + __u32 min_tx_rate; + __u32 max_tx_rate; +}; + +struct ifla_vf_spoofchk { + __u32 vf; + __u32 setting; +}; + +struct ifla_vf_link_state { + __u32 vf; + __u32 link_state; +}; + +struct ifla_vf_rss_query_en { + __u32 vf; + __u32 setting; +}; + +enum { + IFLA_VF_STATS_RX_PACKETS = 0, + IFLA_VF_STATS_TX_PACKETS = 1, + IFLA_VF_STATS_RX_BYTES = 2, + IFLA_VF_STATS_TX_BYTES = 3, + IFLA_VF_STATS_BROADCAST = 4, + IFLA_VF_STATS_MULTICAST = 5, + IFLA_VF_STATS_PAD = 6, + IFLA_VF_STATS_RX_DROPPED = 7, + IFLA_VF_STATS_TX_DROPPED = 8, + __IFLA_VF_STATS_MAX = 9, +}; + +struct ifla_vf_trust { + __u32 vf; + __u32 setting; +}; + +enum { + IFLA_VF_PORT_UNSPEC = 0, + IFLA_VF_PORT = 1, + __IFLA_VF_PORT_MAX = 2, +}; + +enum { + IFLA_PORT_UNSPEC = 0, + IFLA_PORT_VF = 1, + IFLA_PORT_PROFILE = 2, + IFLA_PORT_VSI_TYPE = 3, + IFLA_PORT_INSTANCE_UUID = 4, + IFLA_PORT_HOST_UUID = 5, + IFLA_PORT_REQUEST = 6, + IFLA_PORT_RESPONSE = 7, + __IFLA_PORT_MAX = 8, +}; + +struct if_stats_msg { + __u8 family; + __u8 pad1; + __u16 pad2; + __u32 ifindex; + __u32 filter_mask; +}; + +enum { + IFLA_STATS_UNSPEC = 0, + IFLA_STATS_LINK_64 = 1, + IFLA_STATS_LINK_XSTATS = 2, + IFLA_STATS_LINK_XSTATS_SLAVE = 3, + IFLA_STATS_LINK_OFFLOAD_XSTATS = 4, + IFLA_STATS_AF_SPEC = 5, + __IFLA_STATS_MAX = 6, +}; + +enum { + IFLA_OFFLOAD_XSTATS_UNSPEC = 0, + IFLA_OFFLOAD_XSTATS_CPU_HIT = 1, + __IFLA_OFFLOAD_XSTATS_MAX = 2, +}; + +enum { + XDP_ATTACHED_NONE = 0, + XDP_ATTACHED_DRV = 1, + XDP_ATTACHED_SKB = 2, + XDP_ATTACHED_HW = 3, + XDP_ATTACHED_MULTI = 4, +}; + +enum { + IFLA_XDP_UNSPEC = 0, + IFLA_XDP_FD = 1, + IFLA_XDP_ATTACHED = 2, + IFLA_XDP_FLAGS = 3, + IFLA_XDP_PROG_ID = 4, + IFLA_XDP_DRV_PROG_ID = 5, + IFLA_XDP_SKB_PROG_ID = 6, + IFLA_XDP_HW_PROG_ID = 7, + IFLA_XDP_EXPECTED_FD = 8, + __IFLA_XDP_MAX = 9, +}; + +enum { + IFLA_EVENT_NONE = 0, + IFLA_EVENT_REBOOT = 1, + IFLA_EVENT_FEATURES = 2, + IFLA_EVENT_BONDING_FAILOVER = 3, + IFLA_EVENT_NOTIFY_PEERS = 4, + IFLA_EVENT_IGMP_RESEND = 5, + IFLA_EVENT_BONDING_OPTIONS = 6, +}; + +enum { + IFLA_BRIDGE_FLAGS = 0, + IFLA_BRIDGE_MODE = 1, + IFLA_BRIDGE_VLAN_INFO = 2, + IFLA_BRIDGE_VLAN_TUNNEL_INFO = 3, + IFLA_BRIDGE_MRP = 4, + IFLA_BRIDGE_CFM = 5, + __IFLA_BRIDGE_MAX = 6, +}; + +enum { + BR_MCAST_DIR_RX = 0, + BR_MCAST_DIR_TX = 1, + BR_MCAST_DIR_SIZE = 2, +}; + +enum rtattr_type_t { + RTA_UNSPEC = 0, + RTA_DST = 1, + RTA_SRC = 2, + RTA_IIF = 3, + RTA_OIF = 4, + RTA_GATEWAY = 5, + RTA_PRIORITY = 6, + RTA_PREFSRC = 7, + RTA_METRICS = 8, + RTA_MULTIPATH = 9, + RTA_PROTOINFO = 10, + RTA_FLOW = 11, + RTA_CACHEINFO = 12, + RTA_SESSION = 13, + RTA_MP_ALGO = 14, + RTA_TABLE = 15, + RTA_MARK = 16, + RTA_MFC_STATS = 17, + RTA_VIA = 18, + RTA_NEWDST = 19, + RTA_PREF = 20, + RTA_ENCAP_TYPE = 21, + RTA_ENCAP = 22, + RTA_EXPIRES = 23, + RTA_PAD = 24, + RTA_UID = 25, + RTA_TTL_PROPAGATE = 26, + RTA_IP_PROTO = 27, + RTA_SPORT = 28, + RTA_DPORT = 29, + RTA_NH_ID = 30, + __RTA_MAX = 31, +}; + +struct rta_cacheinfo { + __u32 rta_clntref; + __u32 rta_lastuse; + __s32 rta_expires; + __u32 rta_error; + __u32 rta_used; + __u32 rta_id; + __u32 rta_ts; + __u32 rta_tsage; +}; + +struct ifinfomsg { + unsigned char ifi_family; + unsigned char __ifi_pad; + short unsigned int ifi_type; + int ifi_index; + unsigned int ifi_flags; + unsigned int ifi_change; +}; + +struct rtnl_af_ops { + struct list_head list; + int family; + int (*fill_link_af)(struct sk_buff *, const struct net_device *, u32); + size_t (*get_link_af_size)(const struct net_device *, u32); + int (*validate_link_af)(const struct net_device *, const struct nlattr *); + int (*set_link_af)(struct net_device *, const struct nlattr *); + int (*fill_stats_af)(struct sk_buff *, const struct net_device *); + size_t (*get_stats_af_size)(const struct net_device *); +}; + +struct rtnl_link { + rtnl_doit_func doit; + rtnl_dumpit_func dumpit; + struct module *owner; + unsigned int flags; + struct callback_head rcu; +}; + +enum { + IF_LINK_MODE_DEFAULT = 0, + IF_LINK_MODE_DORMANT = 1, + IF_LINK_MODE_TESTING = 2, +}; + +enum lw_bits { + LW_URGENT = 0, +}; + +struct seg6_pernet_data { + struct mutex lock; + struct in6_addr *tun_src; + struct rhashtable hmac_infos; +}; + +enum { + BPF_F_RECOMPUTE_CSUM = 1, + BPF_F_INVALIDATE_HASH = 2, +}; + +enum { + BPF_F_HDR_FIELD_MASK = 15, +}; + +enum { + BPF_F_PSEUDO_HDR = 16, + BPF_F_MARK_MANGLED_0 = 32, + BPF_F_MARK_ENFORCE = 64, +}; + +enum { + BPF_F_INGRESS = 1, +}; + +enum { + BPF_F_TUNINFO_IPV6 = 1, +}; + +enum { + BPF_F_ZERO_CSUM_TX = 2, + BPF_F_DONT_FRAGMENT = 4, + BPF_F_SEQ_NUMBER = 8, +}; + +enum { + BPF_CSUM_LEVEL_QUERY = 0, + BPF_CSUM_LEVEL_INC = 1, + BPF_CSUM_LEVEL_DEC = 2, + BPF_CSUM_LEVEL_RESET = 3, +}; + +enum { + BPF_F_ADJ_ROOM_FIXED_GSO = 1, + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 2, + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 4, + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 8, + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 16, + BPF_F_ADJ_ROOM_NO_CSUM_RESET = 32, +}; + +enum { + BPF_ADJ_ROOM_ENCAP_L2_MASK = 255, + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 56, +}; + +enum { + BPF_SK_LOOKUP_F_REPLACE = 1, + BPF_SK_LOOKUP_F_NO_REUSEPORT = 2, +}; + +enum bpf_adj_room_mode { + BPF_ADJ_ROOM_NET = 0, + BPF_ADJ_ROOM_MAC = 1, +}; + +enum bpf_hdr_start_off { + BPF_HDR_START_MAC = 0, + BPF_HDR_START_NET = 1, +}; + +enum bpf_lwt_encap_mode { + BPF_LWT_ENCAP_SEG6 = 0, + BPF_LWT_ENCAP_SEG6_INLINE = 1, + BPF_LWT_ENCAP_IP = 2, +}; + +struct bpf_tunnel_key { + __u32 tunnel_id; + union { + __u32 remote_ipv4; + __u32 remote_ipv6[4]; + }; + __u8 tunnel_tos; + __u8 tunnel_ttl; + __u16 tunnel_ext; + __u32 tunnel_label; +}; + +struct bpf_xfrm_state { + __u32 reqid; + __u32 spi; + __u16 family; + __u16 ext; + union { + __u32 remote_ipv4; + __u32 remote_ipv6[4]; + }; +}; + +struct bpf_tcp_sock { + __u32 snd_cwnd; + __u32 srtt_us; + __u32 rtt_min; + __u32 snd_ssthresh; + __u32 rcv_nxt; + __u32 snd_nxt; + __u32 snd_una; + __u32 mss_cache; + __u32 ecn_flags; + __u32 rate_delivered; + __u32 rate_interval_us; + __u32 packets_out; + __u32 retrans_out; + __u32 total_retrans; + __u32 segs_in; + __u32 data_segs_in; + __u32 segs_out; + __u32 data_segs_out; + __u32 lost_out; + __u32 sacked_out; + __u64 bytes_received; + __u64 bytes_acked; + __u32 dsack_dups; + __u32 delivered; + __u32 delivered_ce; + __u32 icsk_retransmits; +}; + +struct bpf_sock_tuple { + union { + struct { + __be32 saddr; + __be32 daddr; + __be16 sport; + __be16 dport; + } ipv4; + struct { + __be32 saddr[4]; + __be32 daddr[4]; + __be16 sport; + __be16 dport; + } ipv6; + }; +}; + +struct bpf_xdp_sock { + __u32 queue_id; +}; + +enum { + BPF_SOCK_OPS_RTO_CB_FLAG = 1, + BPF_SOCK_OPS_RETRANS_CB_FLAG = 2, + BPF_SOCK_OPS_STATE_CB_FLAG = 4, + BPF_SOCK_OPS_RTT_CB_FLAG = 8, + BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG = 16, + BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG = 32, + BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = 64, + BPF_SOCK_OPS_ALL_CB_FLAGS = 127, +}; + +enum { + BPF_SOCK_OPS_VOID = 0, + BPF_SOCK_OPS_TIMEOUT_INIT = 1, + BPF_SOCK_OPS_RWND_INIT = 2, + BPF_SOCK_OPS_TCP_CONNECT_CB = 3, + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 4, + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 5, + BPF_SOCK_OPS_NEEDS_ECN = 6, + BPF_SOCK_OPS_BASE_RTT = 7, + BPF_SOCK_OPS_RTO_CB = 8, + BPF_SOCK_OPS_RETRANS_CB = 9, + BPF_SOCK_OPS_STATE_CB = 10, + BPF_SOCK_OPS_TCP_LISTEN_CB = 11, + BPF_SOCK_OPS_RTT_CB = 12, + BPF_SOCK_OPS_PARSE_HDR_OPT_CB = 13, + BPF_SOCK_OPS_HDR_OPT_LEN_CB = 14, + BPF_SOCK_OPS_WRITE_HDR_OPT_CB = 15, +}; + +enum { + TCP_BPF_IW = 1001, + TCP_BPF_SNDCWND_CLAMP = 1002, + TCP_BPF_DELACK_MAX = 1003, + TCP_BPF_RTO_MIN = 1004, + TCP_BPF_SYN = 1005, + TCP_BPF_SYN_IP = 1006, + TCP_BPF_SYN_MAC = 1007, +}; + +enum { + BPF_LOAD_HDR_OPT_TCP_SYN = 1, +}; + +enum { + BPF_FIB_LOOKUP_DIRECT = 1, + BPF_FIB_LOOKUP_OUTPUT = 2, +}; + +enum { + BPF_FIB_LKUP_RET_SUCCESS = 0, + BPF_FIB_LKUP_RET_BLACKHOLE = 1, + BPF_FIB_LKUP_RET_UNREACHABLE = 2, + BPF_FIB_LKUP_RET_PROHIBIT = 3, + BPF_FIB_LKUP_RET_NOT_FWDED = 4, + BPF_FIB_LKUP_RET_FWD_DISABLED = 5, + BPF_FIB_LKUP_RET_UNSUPP_LWT = 6, + BPF_FIB_LKUP_RET_NO_NEIGH = 7, + BPF_FIB_LKUP_RET_FRAG_NEEDED = 8, +}; + +struct bpf_fib_lookup { + __u8 family; + __u8 l4_protocol; + __be16 sport; + __be16 dport; + __u16 tot_len; + __u32 ifindex; + union { + __u8 tos; + __be32 flowinfo; + __u32 rt_metric; + }; + union { + __be32 ipv4_src; + __u32 ipv6_src[4]; + }; + union { + __be32 ipv4_dst; + __u32 ipv6_dst[4]; + }; + __be16 h_vlan_proto; + __be16 h_vlan_TCI; + __u8 smac[6]; + __u8 dmac[6]; +}; + +struct bpf_redir_neigh { + __u32 nh_family; + union { + __be32 ipv4_nh; + __u32 ipv6_nh[4]; + }; +}; + +enum rt_scope_t { + RT_SCOPE_UNIVERSE = 0, + RT_SCOPE_SITE = 200, + RT_SCOPE_LINK = 253, + RT_SCOPE_HOST = 254, + RT_SCOPE_NOWHERE = 255, +}; + +enum rt_class_t { + RT_TABLE_UNSPEC = 0, + RT_TABLE_COMPAT = 252, + RT_TABLE_DEFAULT = 253, + RT_TABLE_MAIN = 254, + RT_TABLE_LOCAL = 255, + RT_TABLE_MAX = 4294967295, +}; + +struct nl_info { + struct nlmsghdr *nlh; + struct net *nl_net; + u32 portid; + u8 skip_notify: 1; + u8 skip_notify_kernel: 1; +}; + +struct inet_timewait_sock { + struct sock_common __tw_common; + __u32 tw_mark; + volatile unsigned char tw_substate; + unsigned char tw_rcv_wscale; + __be16 tw_sport; + unsigned int tw_kill: 1; + unsigned int tw_transparent: 1; + unsigned int tw_flowlabel: 20; + unsigned int tw_pad: 2; + unsigned int tw_tos: 8; + u32 tw_txhash; + u32 tw_priority; + struct timer_list tw_timer; + struct inet_bind_bucket *tw_tb; +}; + +struct tcp_timewait_sock { + struct inet_timewait_sock tw_sk; + u32 tw_rcv_wnd; + u32 tw_ts_offset; + u32 tw_ts_recent; + u32 tw_last_oow_ack_time; + int tw_ts_recent_stamp; + u32 tw_tx_delay; + struct tcp_md5sig_key *tw_md5_key; +}; + +struct udp_sock { + struct inet_sock inet; + int pending; + unsigned int corkflag; + __u8 encap_type; + unsigned char no_check6_tx: 1; + unsigned char no_check6_rx: 1; + unsigned char encap_enabled: 1; + unsigned char gro_enabled: 1; + __u16 len; + __u16 gso_size; + __u16 pcslen; + __u16 pcrlen; + __u8 pcflag; + __u8 unused[3]; + int (*encap_rcv)(struct sock *, struct sk_buff *); + int (*encap_err_lookup)(struct sock *, struct sk_buff *); + void (*encap_destroy)(struct sock *); + struct sk_buff * (*gro_receive)(struct sock *, struct list_head *, struct sk_buff *); + int (*gro_complete)(struct sock *, struct sk_buff *, int); + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct sk_buff_head reader_queue; + int forward_deficit; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct udp6_sock { + struct udp_sock udp; + struct ipv6_pinfo inet6; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct tcp6_sock { + struct tcp_sock tcp; + struct ipv6_pinfo inet6; +}; + +struct fib6_result; + +struct fib6_config; + +struct ipv6_stub { + int (*ipv6_sock_mc_join)(struct sock *, int, const struct in6_addr *); + int (*ipv6_sock_mc_drop)(struct sock *, int, const struct in6_addr *); + struct dst_entry * (*ipv6_dst_lookup_flow)(struct net *, const struct sock *, struct flowi6 *, const struct in6_addr *); + int (*ipv6_route_input)(struct sk_buff *); + struct fib6_table * (*fib6_get_table)(struct net *, u32); + int (*fib6_lookup)(struct net *, int, struct flowi6 *, struct fib6_result *, int); + int (*fib6_table_lookup)(struct net *, struct fib6_table *, int, struct flowi6 *, struct fib6_result *, int); + void (*fib6_select_path)(const struct net *, struct fib6_result *, struct flowi6 *, int, bool, const struct sk_buff *, int); + u32 (*ip6_mtu_from_fib6)(const struct fib6_result *, const struct in6_addr *, const struct in6_addr *); + int (*fib6_nh_init)(struct net *, struct fib6_nh *, struct fib6_config *, gfp_t, struct netlink_ext_ack *); + void (*fib6_nh_release)(struct fib6_nh *); + void (*fib6_update_sernum)(struct net *, struct fib6_info *); + int (*ip6_del_rt)(struct net *, struct fib6_info *, bool); + void (*fib6_rt_update)(struct net *, struct fib6_info *, struct nl_info *); + void (*udpv6_encap_enable)(); + void (*ndisc_send_na)(struct net_device *, const struct in6_addr *, const struct in6_addr *, bool, bool, bool, bool); + void (*xfrm6_local_rxpmtu)(struct sk_buff *, u32); + int (*xfrm6_udp_encap_rcv)(struct sock *, struct sk_buff *); + int (*xfrm6_rcv_encap)(struct sk_buff *, int, __be32, int); + struct neigh_table *nd_tbl; + int (*ipv6_fragment)(struct net *, struct sock *, struct sk_buff *, int (*)(struct net *, struct sock *, struct sk_buff *)); +}; + +struct fib6_result { + struct fib6_nh *nh; + struct fib6_info *f6i; + u32 fib6_flags; + u8 fib6_type; + struct rt6_info *rt6; +}; + +struct fib6_config { + u32 fc_table; + u32 fc_metric; + int fc_dst_len; + int fc_src_len; + int fc_ifindex; + u32 fc_flags; + u32 fc_protocol; + u16 fc_type; + u16 fc_delete_all_nh: 1; + u16 fc_ignore_dev_down: 1; + u16 __unused: 14; + u32 fc_nh_id; + struct in6_addr fc_dst; + struct in6_addr fc_src; + struct in6_addr fc_prefsrc; + struct in6_addr fc_gateway; + long unsigned int fc_expires; + struct nlattr *fc_mx; + int fc_mx_len; + int fc_mp_len; + struct nlattr *fc_mp; + struct nl_info fc_nlinfo; + struct nlattr *fc_encap; + u16 fc_encap_type; + bool fc_is_fdb; +}; + +struct ipv6_bpf_stub { + int (*inet6_bind)(struct sock *, struct sockaddr *, int, u32); + struct sock * (*udp6_lib_lookup)(struct net *, const struct in6_addr *, __be16, const struct in6_addr *, __be16, int, int, struct udp_table *, struct sk_buff *); +}; + +struct fib_result { + __be32 prefix; + unsigned char prefixlen; + unsigned char nh_sel; + unsigned char type; + unsigned char scope; + u32 tclassid; + struct fib_nh_common *nhc; + struct fib_info *fi; + struct fib_table *table; + struct hlist_head *fa_head; +}; + +enum { + INET_ECN_NOT_ECT = 0, + INET_ECN_ECT_1 = 1, + INET_ECN_ECT_0 = 2, + INET_ECN_CE = 3, + INET_ECN_MASK = 3, +}; + +struct tcp_skb_cb { + __u32 seq; + __u32 end_seq; + union { + __u32 tcp_tw_isn; + struct { + u16 tcp_gso_segs; + u16 tcp_gso_size; + }; + }; + __u8 tcp_flags; + __u8 sacked; + __u8 ip_dsfield; + __u8 txstamp_ack: 1; + __u8 eor: 1; + __u8 has_rxtstamp: 1; + __u8 unused: 5; + __u32 ack_seq; + union { + struct { + __u32 in_flight: 30; + __u32 is_app_limited: 1; + __u32 unused: 1; + __u32 delivered; + u64 first_tx_mstamp; + u64 delivered_mstamp; + } tx; + union { + struct inet_skb_parm h4; + struct inet6_skb_parm h6; + } header; + struct { + __u32 flags; + struct sock *sk_redir; + void *data_end; + } bpf; + }; +}; + +struct strp_stats { + long long unsigned int msgs; + long long unsigned int bytes; + unsigned int mem_fail; + unsigned int need_more_hdr; + unsigned int msg_too_big; + unsigned int msg_timeouts; + unsigned int bad_hdr_len; +}; + +struct strparser; + +struct strp_callbacks { + int (*parse_msg)(struct strparser *, struct sk_buff *); + void (*rcv_msg)(struct strparser *, struct sk_buff *); + int (*read_sock_done)(struct strparser *, int); + void (*abort_parser)(struct strparser *, int); + void (*lock)(struct strparser *); + void (*unlock)(struct strparser *); +}; + +struct strparser { + struct sock *sk; + u32 stopped: 1; + u32 paused: 1; + u32 aborted: 1; + u32 interrupted: 1; + u32 unrecov_intr: 1; + struct sk_buff **skb_nextp; + struct sk_buff *skb_head; + unsigned int need_bytes; + struct delayed_work msg_timer_work; + struct work_struct work; + struct strp_stats stats; + struct strp_callbacks cb; +}; + +struct strp_msg { + int full_len; + int offset; +}; + +struct xdp_umem { + void *addrs; + u64 size; + u32 headroom; + u32 chunk_size; + u32 chunks; + u32 npgs; + struct user_struct *user; + refcount_t users; + u8 flags; + bool zc; + struct page **pgs; + int id; + struct list_head xsk_dma_list; + struct work_struct work; +}; + +struct xdp_sock; + +struct xsk_map { + struct bpf_map map; + spinlock_t lock; + struct xdp_sock *xsk_map[0]; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct xsk_queue; + +struct xdp_sock { + struct sock sk; + long: 64; + struct xsk_queue *rx; + struct net_device *dev; + struct xdp_umem *umem; + struct list_head flush_node; + struct xsk_buff_pool *pool; + u16 queue_id; + bool zc; + enum { + XSK_READY = 0, + XSK_BOUND = 1, + XSK_UNBOUND = 2, + } state; + long: 64; + struct xsk_queue *tx; + struct list_head tx_list; + spinlock_t rx_lock; + u64 rx_dropped; + u64 rx_queue_full; + struct list_head map_list; + spinlock_t map_list_lock; + struct mutex mutex; + struct xsk_queue *fq_tmp; + struct xsk_queue *cq_tmp; + long: 64; +}; + +struct ipv6_sr_hdr { + __u8 nexthdr; + __u8 hdrlen; + __u8 type; + __u8 segments_left; + __u8 first_segment; + __u8 flags; + __u16 tag; + struct in6_addr segments[0]; +}; + +enum { + SEG6_LOCAL_ACTION_UNSPEC = 0, + SEG6_LOCAL_ACTION_END = 1, + SEG6_LOCAL_ACTION_END_X = 2, + SEG6_LOCAL_ACTION_END_T = 3, + SEG6_LOCAL_ACTION_END_DX2 = 4, + SEG6_LOCAL_ACTION_END_DX6 = 5, + SEG6_LOCAL_ACTION_END_DX4 = 6, + SEG6_LOCAL_ACTION_END_DT6 = 7, + SEG6_LOCAL_ACTION_END_DT4 = 8, + SEG6_LOCAL_ACTION_END_B6 = 9, + SEG6_LOCAL_ACTION_END_B6_ENCAP = 10, + SEG6_LOCAL_ACTION_END_BM = 11, + SEG6_LOCAL_ACTION_END_S = 12, + SEG6_LOCAL_ACTION_END_AS = 13, + SEG6_LOCAL_ACTION_END_AM = 14, + SEG6_LOCAL_ACTION_END_BPF = 15, + __SEG6_LOCAL_ACTION_MAX = 16, +}; + +struct seg6_bpf_srh_state { + struct ipv6_sr_hdr *srh; + u16 hdrlen; + bool valid; +}; + +struct tls_crypto_info { + __u16 version; + __u16 cipher_type; +}; + +struct tls12_crypto_info_aes_gcm_128 { + struct tls_crypto_info info; + unsigned char iv[8]; + unsigned char key[16]; + unsigned char salt[4]; + unsigned char rec_seq[8]; +}; + +struct tls12_crypto_info_aes_gcm_256 { + struct tls_crypto_info info; + unsigned char iv[8]; + unsigned char key[32]; + unsigned char salt[4]; + unsigned char rec_seq[8]; +}; + +struct tls12_crypto_info_chacha20_poly1305 { + struct tls_crypto_info info; + unsigned char iv[12]; + unsigned char key[32]; + unsigned char salt[0]; + unsigned char rec_seq[8]; +}; + +struct tls_sw_context_rx { + struct crypto_aead *aead_recv; + struct crypto_wait async_wait; + struct strparser strp; + struct sk_buff_head rx_list; + void (*saved_data_ready)(struct sock *); + struct sk_buff *recv_pkt; + u8 control; + u8 async_capable: 1; + u8 decrypted: 1; + atomic_t decrypt_pending; + spinlock_t decrypt_compl_lock; + bool async_notify; +}; + +struct cipher_context { + char *iv; + char *rec_seq; +}; + +union tls_crypto_context { + struct tls_crypto_info info; + union { + struct tls12_crypto_info_aes_gcm_128 aes_gcm_128; + struct tls12_crypto_info_aes_gcm_256 aes_gcm_256; + struct tls12_crypto_info_chacha20_poly1305 chacha20_poly1305; + }; +}; + +struct tls_prot_info { + u16 version; + u16 cipher_type; + u16 prepend_size; + u16 tag_size; + u16 overhead_size; + u16 iv_size; + u16 salt_size; + u16 rec_seq_size; + u16 aad_size; + u16 tail_size; +}; + +struct tls_context { + struct tls_prot_info prot_info; + u8 tx_conf: 3; + u8 rx_conf: 3; + int (*push_pending_record)(struct sock *, int); + void (*sk_write_space)(struct sock *); + void *priv_ctx_tx; + void *priv_ctx_rx; + struct net_device *netdev; + struct cipher_context tx; + struct cipher_context rx; + struct scatterlist *partially_sent_record; + u16 partially_sent_offset; + bool in_tcp_sendpages; + bool pending_open_record_frags; + struct mutex tx_lock; + long unsigned int flags; + struct proto *sk_proto; + void (*sk_destruct)(struct sock *); + union tls_crypto_context crypto_send; + union tls_crypto_context crypto_recv; + struct list_head list; + refcount_t refcount; + struct callback_head rcu; +}; + +typedef u64 (*btf_bpf_skb_get_pay_offset)(struct sk_buff *); + +typedef u64 (*btf_bpf_skb_get_nlattr)(struct sk_buff *, u32, u32); + +typedef u64 (*btf_bpf_skb_get_nlattr_nest)(struct sk_buff *, u32, u32); + +typedef u64 (*btf_bpf_skb_load_helper_8)(const struct sk_buff *, const void *, int, int); + +typedef u64 (*btf_bpf_skb_load_helper_8_no_cache)(const struct sk_buff *, int); + +typedef u64 (*btf_bpf_skb_load_helper_16)(const struct sk_buff *, const void *, int, int); + +typedef u64 (*btf_bpf_skb_load_helper_16_no_cache)(const struct sk_buff *, int); + +typedef u64 (*btf_bpf_skb_load_helper_32)(const struct sk_buff *, const void *, int, int); + +typedef u64 (*btf_bpf_skb_load_helper_32_no_cache)(const struct sk_buff *, int); + +struct bpf_scratchpad { + union { + __be32 diff[128]; + u8 buff[512]; + }; +}; + +typedef u64 (*btf_bpf_skb_store_bytes)(struct sk_buff *, u32, const void *, u32, u64); + +typedef u64 (*btf_bpf_skb_load_bytes)(const struct sk_buff *, u32, void *, u32); + +typedef u64 (*btf_bpf_flow_dissector_load_bytes)(const struct bpf_flow_dissector *, u32, void *, u32); + +typedef u64 (*btf_bpf_skb_load_bytes_relative)(const struct sk_buff *, u32, void *, u32, u32); + +typedef u64 (*btf_bpf_skb_pull_data)(struct sk_buff *, u32); + +typedef u64 (*btf_bpf_sk_fullsock)(struct sock *); + +typedef u64 (*btf_sk_skb_pull_data)(struct sk_buff *, u32); + +typedef u64 (*btf_bpf_l3_csum_replace)(struct sk_buff *, u32, u64, u64, u64); + +typedef u64 (*btf_bpf_l4_csum_replace)(struct sk_buff *, u32, u64, u64, u64); + +typedef u64 (*btf_bpf_csum_diff)(__be32 *, u32, __be32 *, u32, __wsum); + +typedef u64 (*btf_bpf_csum_update)(struct sk_buff *, __wsum); + +typedef u64 (*btf_bpf_csum_level)(struct sk_buff *, u64); + +enum { + BPF_F_NEIGH = 2, + BPF_F_PEER = 4, + BPF_F_NEXTHOP = 8, +}; + +typedef u64 (*btf_bpf_clone_redirect)(struct sk_buff *, u32, u64); + +typedef u64 (*btf_bpf_redirect)(u32, u64); + +typedef u64 (*btf_bpf_redirect_peer)(u32, u64); + +typedef u64 (*btf_bpf_redirect_neigh)(u32, struct bpf_redir_neigh *, int, u64); + +typedef u64 (*btf_bpf_msg_apply_bytes)(struct sk_msg *, u32); + +typedef u64 (*btf_bpf_msg_cork_bytes)(struct sk_msg *, u32); + +typedef u64 (*btf_bpf_msg_pull_data)(struct sk_msg *, u32, u32, u64); + +typedef u64 (*btf_bpf_msg_push_data)(struct sk_msg *, u32, u32, u64); + +typedef u64 (*btf_bpf_msg_pop_data)(struct sk_msg *, u32, u32, u64); + +typedef u64 (*btf_bpf_get_cgroup_classid_curr)(); + +typedef u64 (*btf_bpf_skb_cgroup_classid)(const struct sk_buff *); + +typedef u64 (*btf_bpf_get_cgroup_classid)(const struct sk_buff *); + +typedef u64 (*btf_bpf_get_route_realm)(const struct sk_buff *); + +typedef u64 (*btf_bpf_get_hash_recalc)(struct sk_buff *); + +typedef u64 (*btf_bpf_set_hash_invalid)(struct sk_buff *); + +typedef u64 (*btf_bpf_set_hash)(struct sk_buff *, u32); + +typedef u64 (*btf_bpf_skb_vlan_push)(struct sk_buff *, __be16, u16); + +typedef u64 (*btf_bpf_skb_vlan_pop)(struct sk_buff *); + +typedef u64 (*btf_bpf_skb_change_proto)(struct sk_buff *, __be16, u64); + +typedef u64 (*btf_bpf_skb_change_type)(struct sk_buff *, u32); + +typedef u64 (*btf_sk_skb_adjust_room)(struct sk_buff *, s32, u32, u64); + +typedef u64 (*btf_bpf_skb_adjust_room)(struct sk_buff *, s32, u32, u64); + +typedef u64 (*btf_bpf_skb_change_tail)(struct sk_buff *, u32, u64); + +typedef u64 (*btf_sk_skb_change_tail)(struct sk_buff *, u32, u64); + +typedef u64 (*btf_bpf_skb_change_head)(struct sk_buff *, u32, u64); + +typedef u64 (*btf_sk_skb_change_head)(struct sk_buff *, u32, u64); + +typedef u64 (*btf_bpf_xdp_adjust_head)(struct xdp_buff *, int); + +typedef u64 (*btf_bpf_xdp_adjust_tail)(struct xdp_buff *, int); + +typedef u64 (*btf_bpf_xdp_adjust_meta)(struct xdp_buff *, int); + +typedef u64 (*btf_bpf_xdp_redirect)(u32, u64); + +typedef u64 (*btf_bpf_xdp_redirect_map)(struct bpf_map *, u32, u64); + +typedef u64 (*btf_bpf_skb_event_output)(struct sk_buff *, struct bpf_map *, u64, void *, u64); + +typedef u64 (*btf_bpf_skb_get_tunnel_key)(struct sk_buff *, struct bpf_tunnel_key *, u32, u64); + +typedef u64 (*btf_bpf_skb_get_tunnel_opt)(struct sk_buff *, u8 *, u32); + +typedef u64 (*btf_bpf_skb_set_tunnel_key)(struct sk_buff *, const struct bpf_tunnel_key *, u32, u64); + +typedef u64 (*btf_bpf_skb_set_tunnel_opt)(struct sk_buff *, const u8 *, u32); + +typedef u64 (*btf_bpf_skb_under_cgroup)(struct sk_buff *, struct bpf_map *, u32); + +typedef u64 (*btf_bpf_skb_cgroup_id)(const struct sk_buff *); + +typedef u64 (*btf_bpf_skb_ancestor_cgroup_id)(const struct sk_buff *, int); + +typedef u64 (*btf_bpf_sk_cgroup_id)(struct sock *); + +typedef u64 (*btf_bpf_sk_ancestor_cgroup_id)(struct sock *, int); + +typedef u64 (*btf_bpf_xdp_event_output)(struct xdp_buff *, struct bpf_map *, u64, void *, u64); + +typedef u64 (*btf_bpf_get_socket_cookie)(struct sk_buff *); + +typedef u64 (*btf_bpf_get_socket_cookie_sock_addr)(struct bpf_sock_addr_kern *); + +typedef u64 (*btf_bpf_get_socket_cookie_sock)(struct sock *); + +typedef u64 (*btf_bpf_get_socket_cookie_sock_ops)(struct bpf_sock_ops_kern *); + +typedef u64 (*btf_bpf_get_netns_cookie_sock)(struct sock *); + +typedef u64 (*btf_bpf_get_netns_cookie_sock_addr)(struct bpf_sock_addr_kern *); + +typedef u64 (*btf_bpf_get_socket_uid)(struct sk_buff *); + +typedef u64 (*btf_bpf_sock_addr_setsockopt)(struct bpf_sock_addr_kern *, int, int, char *, int); + +typedef u64 (*btf_bpf_sock_addr_getsockopt)(struct bpf_sock_addr_kern *, int, int, char *, int); + +typedef u64 (*btf_bpf_sock_ops_setsockopt)(struct bpf_sock_ops_kern *, int, int, char *, int); + +typedef u64 (*btf_bpf_sock_ops_getsockopt)(struct bpf_sock_ops_kern *, int, int, char *, int); + +typedef u64 (*btf_bpf_sock_ops_cb_flags_set)(struct bpf_sock_ops_kern *, int); + +typedef u64 (*btf_bpf_bind)(struct bpf_sock_addr_kern *, struct sockaddr *, int); + +typedef u64 (*btf_bpf_skb_get_xfrm_state)(struct sk_buff *, u32, struct bpf_xfrm_state *, u32, u64); + +typedef u64 (*btf_bpf_xdp_fib_lookup)(struct xdp_buff *, struct bpf_fib_lookup *, int, u32); + +typedef u64 (*btf_bpf_skb_fib_lookup)(struct sk_buff *, struct bpf_fib_lookup *, int, u32); + +typedef u64 (*btf_bpf_lwt_in_push_encap)(struct sk_buff *, u32, void *, u32); + +typedef u64 (*btf_bpf_lwt_xmit_push_encap)(struct sk_buff *, u32, void *, u32); + +typedef u64 (*btf_bpf_lwt_seg6_store_bytes)(struct sk_buff *, u32, const void *, u32); + +typedef u64 (*btf_bpf_lwt_seg6_action)(struct sk_buff *, u32, void *, u32); + +typedef u64 (*btf_bpf_lwt_seg6_adjust_srh)(struct sk_buff *, u32, s32); + +typedef u64 (*btf_bpf_skc_lookup_tcp)(struct sk_buff *, struct bpf_sock_tuple *, u32, u64, u64); + +typedef u64 (*btf_bpf_sk_lookup_tcp)(struct sk_buff *, struct bpf_sock_tuple *, u32, u64, u64); + +typedef u64 (*btf_bpf_sk_lookup_udp)(struct sk_buff *, struct bpf_sock_tuple *, u32, u64, u64); + +typedef u64 (*btf_bpf_sk_release)(struct sock *); + +typedef u64 (*btf_bpf_xdp_sk_lookup_udp)(struct xdp_buff *, struct bpf_sock_tuple *, u32, u32, u64); + +typedef u64 (*btf_bpf_xdp_skc_lookup_tcp)(struct xdp_buff *, struct bpf_sock_tuple *, u32, u32, u64); + +typedef u64 (*btf_bpf_xdp_sk_lookup_tcp)(struct xdp_buff *, struct bpf_sock_tuple *, u32, u32, u64); + +typedef u64 (*btf_bpf_sock_addr_skc_lookup_tcp)(struct bpf_sock_addr_kern *, struct bpf_sock_tuple *, u32, u64, u64); + +typedef u64 (*btf_bpf_sock_addr_sk_lookup_tcp)(struct bpf_sock_addr_kern *, struct bpf_sock_tuple *, u32, u64, u64); + +typedef u64 (*btf_bpf_sock_addr_sk_lookup_udp)(struct bpf_sock_addr_kern *, struct bpf_sock_tuple *, u32, u64, u64); + +typedef u64 (*btf_bpf_tcp_sock)(struct sock *); + +typedef u64 (*btf_bpf_get_listener_sock)(struct sock *); + +typedef u64 (*btf_bpf_skb_ecn_set_ce)(struct sk_buff *); + +typedef u64 (*btf_bpf_tcp_check_syncookie)(struct sock *, void *, u32, struct tcphdr *, u32); + +typedef u64 (*btf_bpf_tcp_gen_syncookie)(struct sock *, void *, u32, struct tcphdr *, u32); + +typedef u64 (*btf_bpf_sk_assign)(struct sk_buff *, struct sock *, u64); + +typedef u64 (*btf_bpf_sock_ops_load_hdr_opt)(struct bpf_sock_ops_kern *, void *, u32, u64); + +typedef u64 (*btf_bpf_sock_ops_store_hdr_opt)(struct bpf_sock_ops_kern *, const void *, u32, u64); + +typedef u64 (*btf_bpf_sock_ops_reserve_hdr_opt)(struct bpf_sock_ops_kern *, u32, u64); + +typedef u64 (*btf_sk_select_reuseport)(struct sk_reuseport_kern *, struct bpf_map *, void *, u32); + +typedef u64 (*btf_sk_reuseport_load_bytes)(const struct sk_reuseport_kern *, u32, void *, u32); + +typedef u64 (*btf_sk_reuseport_load_bytes_relative)(const struct sk_reuseport_kern *, u32, void *, u32, u32); + +typedef u64 (*btf_bpf_sk_lookup_assign)(struct bpf_sk_lookup_kern *, struct sock *, u64); + +typedef u64 (*btf_bpf_skc_to_tcp6_sock)(struct sock *); + +typedef u64 (*btf_bpf_skc_to_tcp_sock)(struct sock *); + +typedef u64 (*btf_bpf_skc_to_tcp_timewait_sock)(struct sock *); + +typedef u64 (*btf_bpf_skc_to_tcp_request_sock)(struct sock *); + +typedef u64 (*btf_bpf_skc_to_udp6_sock)(struct sock *); + +typedef u64 (*btf_bpf_sock_from_file)(struct file *); + +struct bpf_cpu_map_entry___2; + +struct bpf_dtab_netdev___2; + +enum { + INET_DIAG_REQ_NONE = 0, + INET_DIAG_REQ_BYTECODE = 1, + INET_DIAG_REQ_SK_BPF_STORAGES = 2, + INET_DIAG_REQ_PROTOCOL = 3, + __INET_DIAG_REQ_MAX = 4, +}; + +struct sock_diag_req { + __u8 sdiag_family; + __u8 sdiag_protocol; +}; + +struct sock_diag_handler { + __u8 family; + int (*dump)(struct sk_buff *, struct nlmsghdr *); + int (*get_info)(struct sk_buff *, struct sock *); + int (*destroy)(struct sk_buff *, struct nlmsghdr *); +}; + +struct broadcast_sk { + struct sock *sk; + struct work_struct work; +}; + +typedef int gifconf_func_t(struct net_device *, char *, int, int); + +struct hwtstamp_config { + int flags; + int tx_type; + int rx_filter; +}; + +enum hwtstamp_tx_types { + HWTSTAMP_TX_OFF = 0, + HWTSTAMP_TX_ON = 1, + HWTSTAMP_TX_ONESTEP_SYNC = 2, + HWTSTAMP_TX_ONESTEP_P2P = 3, + __HWTSTAMP_TX_CNT = 4, +}; + +enum hwtstamp_rx_filters { + HWTSTAMP_FILTER_NONE = 0, + HWTSTAMP_FILTER_ALL = 1, + HWTSTAMP_FILTER_SOME = 2, + HWTSTAMP_FILTER_PTP_V1_L4_EVENT = 3, + HWTSTAMP_FILTER_PTP_V1_L4_SYNC = 4, + HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ = 5, + HWTSTAMP_FILTER_PTP_V2_L4_EVENT = 6, + HWTSTAMP_FILTER_PTP_V2_L4_SYNC = 7, + HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ = 8, + HWTSTAMP_FILTER_PTP_V2_L2_EVENT = 9, + HWTSTAMP_FILTER_PTP_V2_L2_SYNC = 10, + HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ = 11, + HWTSTAMP_FILTER_PTP_V2_EVENT = 12, + HWTSTAMP_FILTER_PTP_V2_SYNC = 13, + HWTSTAMP_FILTER_PTP_V2_DELAY_REQ = 14, + HWTSTAMP_FILTER_NTP_ALL = 15, + __HWTSTAMP_FILTER_CNT = 16, +}; + +struct tso_t { + int next_frag_idx; + int size; + void *data; + u16 ip_id; + u8 tlen; + bool ipv6; + u32 tcp_seq; +}; + +struct fib_notifier_info { + int family; + struct netlink_ext_ack *extack; +}; + +enum fib_event_type { + FIB_EVENT_ENTRY_REPLACE = 0, + FIB_EVENT_ENTRY_APPEND = 1, + FIB_EVENT_ENTRY_ADD = 2, + FIB_EVENT_ENTRY_DEL = 3, + FIB_EVENT_RULE_ADD = 4, + FIB_EVENT_RULE_DEL = 5, + FIB_EVENT_NH_ADD = 6, + FIB_EVENT_NH_DEL = 7, + FIB_EVENT_VIF_ADD = 8, + FIB_EVENT_VIF_DEL = 9, +}; + +struct fib_notifier_net { + struct list_head fib_notifier_ops; + struct atomic_notifier_head fib_chain; +}; + +struct xdp_frame_bulk { + int count; + void *xa; + void *q[16]; +}; + +struct xdp_attachment_info { + struct bpf_prog *prog; + u32 flags; +}; + +struct xdp_buff_xsk; + +struct xsk_buff_pool { + struct device *dev; + struct net_device *netdev; + struct list_head xsk_tx_list; + spinlock_t xsk_tx_list_lock; + refcount_t users; + struct xdp_umem *umem; + struct work_struct work; + struct list_head free_list; + u32 heads_cnt; + u16 queue_id; + long: 16; + long: 64; + long: 64; + long: 64; + struct xsk_queue *fq; + struct xsk_queue *cq; + dma_addr_t *dma_pages; + struct xdp_buff_xsk *heads; + u64 chunk_mask; + u64 addrs_cnt; + u32 free_list_cnt; + u32 dma_pages_cnt; + u32 free_heads_cnt; + u32 headroom; + u32 chunk_size; + u32 frame_len; + u8 cached_need_wakeup; + bool uses_need_wakeup; + bool dma_need_sync; + bool unaligned; + void *addrs; + spinlock_t cq_lock; + struct xdp_buff_xsk *free_heads[0]; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct pp_alloc_cache { + u32 count; + void *cache[128]; +}; + +struct page_pool_params { + unsigned int flags; + unsigned int order; + unsigned int pool_size; + int nid; + struct device *dev; + enum dma_data_direction dma_dir; + unsigned int max_len; + unsigned int offset; +}; + +struct page_pool { + struct page_pool_params p; + struct delayed_work release_dw; + void (*disconnect)(void *); + long unsigned int defer_start; + long unsigned int defer_warn; + u32 pages_state_hold_cnt; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + struct pp_alloc_cache alloc; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + struct ptr_ring ring; + atomic_t pages_state_release_cnt; + refcount_t user_cnt; + u64 destroy_cnt; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct xdp_buff_xsk { + struct xdp_buff xdp; + dma_addr_t dma; + dma_addr_t frame_dma; + struct xsk_buff_pool *pool; + bool unaligned; + u64 orig_addr; + struct list_head free_list_node; +}; + +struct flow_match_meta { + struct flow_dissector_key_meta *key; + struct flow_dissector_key_meta *mask; +}; + +struct flow_match_basic { + struct flow_dissector_key_basic *key; + struct flow_dissector_key_basic *mask; +}; + +struct flow_match_control { + struct flow_dissector_key_control *key; + struct flow_dissector_key_control *mask; +}; + +struct flow_match_eth_addrs { + struct flow_dissector_key_eth_addrs *key; + struct flow_dissector_key_eth_addrs *mask; +}; + +struct flow_match_vlan { + struct flow_dissector_key_vlan *key; + struct flow_dissector_key_vlan *mask; +}; + +struct flow_match_ipv4_addrs { + struct flow_dissector_key_ipv4_addrs *key; + struct flow_dissector_key_ipv4_addrs *mask; +}; + +struct flow_match_ipv6_addrs { + struct flow_dissector_key_ipv6_addrs *key; + struct flow_dissector_key_ipv6_addrs *mask; +}; + +struct flow_match_ip { + struct flow_dissector_key_ip *key; + struct flow_dissector_key_ip *mask; +}; + +struct flow_match_ports { + struct flow_dissector_key_ports *key; + struct flow_dissector_key_ports *mask; +}; + +struct flow_match_icmp { + struct flow_dissector_key_icmp *key; + struct flow_dissector_key_icmp *mask; +}; + +struct flow_match_tcp { + struct flow_dissector_key_tcp *key; + struct flow_dissector_key_tcp *mask; +}; + +struct flow_match_mpls { + struct flow_dissector_key_mpls *key; + struct flow_dissector_key_mpls *mask; +}; + +struct flow_match_enc_keyid { + struct flow_dissector_key_keyid *key; + struct flow_dissector_key_keyid *mask; +}; + +struct flow_match_enc_opts { + struct flow_dissector_key_enc_opts *key; + struct flow_dissector_key_enc_opts *mask; +}; + +struct flow_match_ct { + struct flow_dissector_key_ct *key; + struct flow_dissector_key_ct *mask; +}; + +enum flow_block_command { + FLOW_BLOCK_BIND = 0, + FLOW_BLOCK_UNBIND = 1, +}; + +enum flow_block_binder_type { + FLOW_BLOCK_BINDER_TYPE_UNSPEC = 0, + FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS = 1, + FLOW_BLOCK_BINDER_TYPE_CLSACT_EGRESS = 2, + FLOW_BLOCK_BINDER_TYPE_RED_EARLY_DROP = 3, + FLOW_BLOCK_BINDER_TYPE_RED_MARK = 4, +}; + +struct flow_block_offload { + enum flow_block_command command; + enum flow_block_binder_type binder_type; + bool block_shared; + bool unlocked_driver_cb; + struct net *net; + struct flow_block *block; + struct list_head cb_list; + struct list_head *driver_block_list; + struct netlink_ext_ack *extack; + struct Qdisc *sch; +}; + +struct flow_block_cb; + +struct flow_block_indr { + struct list_head list; + struct net_device *dev; + struct Qdisc *sch; + enum flow_block_binder_type binder_type; + void *data; + void *cb_priv; + void (*cleanup)(struct flow_block_cb *); +}; + +struct flow_block_cb { + struct list_head driver_list; + struct list_head list; + flow_setup_cb_t *cb; + void *cb_ident; + void *cb_priv; + void (*release)(void *); + struct flow_block_indr indr; + unsigned int refcnt; +}; + +typedef int flow_indr_block_bind_cb_t(struct net_device *, struct Qdisc *, void *, enum tc_setup_type, void *, void *, void (*)(struct flow_block_cb *)); + +struct flow_indr_dev { + struct list_head list; + flow_indr_block_bind_cb_t *cb; + void *cb_priv; + refcount_t refcnt; + struct callback_head rcu; +}; + +struct rx_queue_attribute { + struct attribute attr; + ssize_t (*show)(struct netdev_rx_queue *, char *); + ssize_t (*store)(struct netdev_rx_queue *, const char *, size_t); +}; + +struct netdev_queue_attribute { + struct attribute attr; + ssize_t (*show)(struct netdev_queue *, char *); + ssize_t (*store)(struct netdev_queue *, const char *, size_t); +}; + +enum __sk_action { + __SK_DROP = 0, + __SK_PASS = 1, + __SK_REDIRECT = 2, + __SK_NONE = 3, +}; + +struct sk_psock_progs { + struct bpf_prog *msg_parser; + struct bpf_prog *skb_parser; + struct bpf_prog *skb_verdict; +}; + +enum sk_psock_state_bits { + SK_PSOCK_TX_ENABLED = 0, +}; + +struct sk_psock_link { + struct list_head list; + struct bpf_map *map; + void *link_raw; +}; + +struct sk_psock_parser { + struct strparser strp; + bool enabled; + void (*saved_data_ready)(struct sock *); +}; + +struct sk_psock_work_state { + struct sk_buff *skb; + u32 len; + u32 off; +}; + +struct sk_psock { + struct sock *sk; + struct sock *sk_redir; + u32 apply_bytes; + u32 cork_bytes; + u32 eval; + struct sk_msg *cork; + struct sk_psock_progs progs; + struct sk_psock_parser parser; + struct sk_buff_head ingress_skb; + struct list_head ingress_msg; + long unsigned int state; + struct list_head link; + spinlock_t link_lock; + refcount_t refcnt; + void (*saved_unhash)(struct sock *); + void (*saved_close)(struct sock *, long int); + void (*saved_write_space)(struct sock *); + struct proto *sk_proto; + struct sk_psock_work_state work_state; + struct work_struct work; + union { + struct callback_head rcu; + struct work_struct gc; + }; +}; + +struct inet6_ifaddr { + struct in6_addr addr; + __u32 prefix_len; + __u32 rt_priority; + __u32 valid_lft; + __u32 prefered_lft; + refcount_t refcnt; + spinlock_t lock; + int state; + __u32 flags; + __u8 dad_probes; + __u8 stable_privacy_retry; + __u16 scope; + __u64 dad_nonce; + long unsigned int cstamp; + long unsigned int tstamp; + struct delayed_work dad_work; + struct inet6_dev *idev; + struct fib6_info *rt; + struct hlist_node addr_lst; + struct list_head if_list; + struct list_head tmp_list; + struct inet6_ifaddr *ifpub; + int regen_count; + bool tokenized; + struct callback_head rcu; + struct in6_addr peer_addr; +}; + +struct fib_rule_uid_range { + __u32 start; + __u32 end; +}; + +enum { + FRA_UNSPEC = 0, + FRA_DST = 1, + FRA_SRC = 2, + FRA_IIFNAME = 3, + FRA_GOTO = 4, + FRA_UNUSED2 = 5, + FRA_PRIORITY = 6, + FRA_UNUSED3 = 7, + FRA_UNUSED4 = 8, + FRA_UNUSED5 = 9, + FRA_FWMARK = 10, + FRA_FLOW = 11, + FRA_TUN_ID = 12, + FRA_SUPPRESS_IFGROUP = 13, + FRA_SUPPRESS_PREFIXLEN = 14, + FRA_TABLE = 15, + FRA_FWMASK = 16, + FRA_OIFNAME = 17, + FRA_PAD = 18, + FRA_L3MDEV = 19, + FRA_UID_RANGE = 20, + FRA_PROTOCOL = 21, + FRA_IP_PROTO = 22, + FRA_SPORT_RANGE = 23, + FRA_DPORT_RANGE = 24, + __FRA_MAX = 25, +}; + +enum { + FR_ACT_UNSPEC = 0, + FR_ACT_TO_TBL = 1, + FR_ACT_GOTO = 2, + FR_ACT_NOP = 3, + FR_ACT_RES3 = 4, + FR_ACT_RES4 = 5, + FR_ACT_BLACKHOLE = 6, + FR_ACT_UNREACHABLE = 7, + FR_ACT_PROHIBIT = 8, + __FR_ACT_MAX = 9, +}; + +struct fib_rule_notifier_info { + struct fib_notifier_info info; + struct fib_rule *rule; +}; + +struct trace_event_raw_kfree_skb { + struct trace_entry ent; + void *skbaddr; + void *location; + short unsigned int protocol; + char __data[0]; +}; + +struct trace_event_raw_consume_skb { + struct trace_entry ent; + void *skbaddr; + char __data[0]; +}; + +struct trace_event_raw_skb_copy_datagram_iovec { + struct trace_entry ent; + const void *skbaddr; + int len; + char __data[0]; +}; + +struct trace_event_data_offsets_kfree_skb {}; + +struct trace_event_data_offsets_consume_skb {}; + +struct trace_event_data_offsets_skb_copy_datagram_iovec {}; + +typedef void (*btf_trace_kfree_skb)(void *, struct sk_buff *, void *); + +typedef void (*btf_trace_consume_skb)(void *, struct sk_buff *); + +typedef void (*btf_trace_skb_copy_datagram_iovec)(void *, const struct sk_buff *, int); + +struct trace_event_raw_net_dev_start_xmit { + struct trace_entry ent; + u32 __data_loc_name; + u16 queue_mapping; + const void *skbaddr; + bool vlan_tagged; + u16 vlan_proto; + u16 vlan_tci; + u16 protocol; + u8 ip_summed; + unsigned int len; + unsigned int data_len; + int network_offset; + bool transport_offset_valid; + int transport_offset; + u8 tx_flags; + u16 gso_size; + u16 gso_segs; + u16 gso_type; + char __data[0]; +}; + +struct trace_event_raw_net_dev_xmit { + struct trace_entry ent; + void *skbaddr; + unsigned int len; + int rc; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_net_dev_xmit_timeout { + struct trace_entry ent; + u32 __data_loc_name; + u32 __data_loc_driver; + int queue_index; + char __data[0]; +}; + +struct trace_event_raw_net_dev_template { + struct trace_entry ent; + void *skbaddr; + unsigned int len; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_raw_net_dev_rx_verbose_template { + struct trace_entry ent; + u32 __data_loc_name; + unsigned int napi_id; + u16 queue_mapping; + const void *skbaddr; + bool vlan_tagged; + u16 vlan_proto; + u16 vlan_tci; + u16 protocol; + u8 ip_summed; + u32 hash; + bool l4_hash; + unsigned int len; + unsigned int data_len; + unsigned int truesize; + bool mac_header_valid; + int mac_header; + unsigned char nr_frags; + u16 gso_size; + u16 gso_type; + char __data[0]; +}; + +struct trace_event_raw_net_dev_rx_exit_template { + struct trace_entry ent; + int ret; + char __data[0]; +}; + +struct trace_event_data_offsets_net_dev_start_xmit { + u32 name; +}; + +struct trace_event_data_offsets_net_dev_xmit { + u32 name; +}; + +struct trace_event_data_offsets_net_dev_xmit_timeout { + u32 name; + u32 driver; +}; + +struct trace_event_data_offsets_net_dev_template { + u32 name; +}; + +struct trace_event_data_offsets_net_dev_rx_verbose_template { + u32 name; +}; + +struct trace_event_data_offsets_net_dev_rx_exit_template {}; + +typedef void (*btf_trace_net_dev_start_xmit)(void *, const struct sk_buff *, const struct net_device *); + +typedef void (*btf_trace_net_dev_xmit)(void *, struct sk_buff *, int, struct net_device *, unsigned int); + +typedef void (*btf_trace_net_dev_xmit_timeout)(void *, struct net_device *, int); + +typedef void (*btf_trace_net_dev_queue)(void *, struct sk_buff *); + +typedef void (*btf_trace_netif_receive_skb)(void *, struct sk_buff *); + +typedef void (*btf_trace_netif_rx)(void *, struct sk_buff *); + +typedef void (*btf_trace_napi_gro_frags_entry)(void *, const struct sk_buff *); + +typedef void (*btf_trace_napi_gro_receive_entry)(void *, const struct sk_buff *); + +typedef void (*btf_trace_netif_receive_skb_entry)(void *, const struct sk_buff *); + +typedef void (*btf_trace_netif_receive_skb_list_entry)(void *, const struct sk_buff *); + +typedef void (*btf_trace_netif_rx_entry)(void *, const struct sk_buff *); + +typedef void (*btf_trace_netif_rx_ni_entry)(void *, const struct sk_buff *); + +typedef void (*btf_trace_napi_gro_frags_exit)(void *, int); + +typedef void (*btf_trace_napi_gro_receive_exit)(void *, int); + +typedef void (*btf_trace_netif_receive_skb_exit)(void *, int); + +typedef void (*btf_trace_netif_rx_exit)(void *, int); + +typedef void (*btf_trace_netif_rx_ni_exit)(void *, int); + +typedef void (*btf_trace_netif_receive_skb_list_exit)(void *, int); + +struct trace_event_raw_napi_poll { + struct trace_entry ent; + struct napi_struct *napi; + u32 __data_loc_dev_name; + int work; + int budget; + char __data[0]; +}; + +struct trace_event_data_offsets_napi_poll { + u32 dev_name; +}; + +typedef void (*btf_trace_napi_poll)(void *, struct napi_struct *, int, int); + +enum tcp_ca_state { + TCP_CA_Open = 0, + TCP_CA_Disorder = 1, + TCP_CA_CWR = 2, + TCP_CA_Recovery = 3, + TCP_CA_Loss = 4, +}; + +struct trace_event_raw_sock_rcvqueue_full { + struct trace_entry ent; + int rmem_alloc; + unsigned int truesize; + int sk_rcvbuf; + char __data[0]; +}; + +struct trace_event_raw_sock_exceed_buf_limit { + struct trace_entry ent; + char name[32]; + long int *sysctl_mem; + long int allocated; + int sysctl_rmem; + int rmem_alloc; + int sysctl_wmem; + int wmem_alloc; + int wmem_queued; + int kind; + char __data[0]; +}; + +struct trace_event_raw_inet_sock_set_state { + struct trace_entry ent; + const void *skaddr; + int oldstate; + int newstate; + __u16 sport; + __u16 dport; + __u16 family; + __u16 protocol; + __u8 saddr[4]; + __u8 daddr[4]; + __u8 saddr_v6[16]; + __u8 daddr_v6[16]; + char __data[0]; +}; + +struct trace_event_data_offsets_sock_rcvqueue_full {}; + +struct trace_event_data_offsets_sock_exceed_buf_limit {}; + +struct trace_event_data_offsets_inet_sock_set_state {}; + +typedef void (*btf_trace_sock_rcvqueue_full)(void *, struct sock *, struct sk_buff *); + +typedef void (*btf_trace_sock_exceed_buf_limit)(void *, struct sock *, struct proto *, long int, int); + +typedef void (*btf_trace_inet_sock_set_state)(void *, const struct sock *, const int, const int); + +struct trace_event_raw_udp_fail_queue_rcv_skb { + struct trace_entry ent; + int rc; + __u16 lport; + char __data[0]; +}; + +struct trace_event_data_offsets_udp_fail_queue_rcv_skb {}; + +typedef void (*btf_trace_udp_fail_queue_rcv_skb)(void *, int, struct sock *); + +struct trace_event_raw_tcp_event_sk_skb { + struct trace_entry ent; + const void *skbaddr; + const void *skaddr; + int state; + __u16 sport; + __u16 dport; + __u8 saddr[4]; + __u8 daddr[4]; + __u8 saddr_v6[16]; + __u8 daddr_v6[16]; + char __data[0]; +}; + +struct trace_event_raw_tcp_event_sk { + struct trace_entry ent; + const void *skaddr; + __u16 sport; + __u16 dport; + __u8 saddr[4]; + __u8 daddr[4]; + __u8 saddr_v6[16]; + __u8 daddr_v6[16]; + __u64 sock_cookie; + char __data[0]; +}; + +struct trace_event_raw_tcp_retransmit_synack { + struct trace_entry ent; + const void *skaddr; + const void *req; + __u16 sport; + __u16 dport; + __u8 saddr[4]; + __u8 daddr[4]; + __u8 saddr_v6[16]; + __u8 daddr_v6[16]; + char __data[0]; +}; + +struct trace_event_raw_tcp_probe { + struct trace_entry ent; + __u8 saddr[28]; + __u8 daddr[28]; + __u16 sport; + __u16 dport; + __u32 mark; + __u16 data_len; + __u32 snd_nxt; + __u32 snd_una; + __u32 snd_cwnd; + __u32 ssthresh; + __u32 snd_wnd; + __u32 srtt; + __u32 rcv_wnd; + __u64 sock_cookie; + char __data[0]; +}; + +struct trace_event_data_offsets_tcp_event_sk_skb {}; + +struct trace_event_data_offsets_tcp_event_sk {}; + +struct trace_event_data_offsets_tcp_retransmit_synack {}; + +struct trace_event_data_offsets_tcp_probe {}; + +typedef void (*btf_trace_tcp_retransmit_skb)(void *, const struct sock *, const struct sk_buff *); + +typedef void (*btf_trace_tcp_send_reset)(void *, const struct sock *, const struct sk_buff *); + +typedef void (*btf_trace_tcp_receive_reset)(void *, struct sock *); + +typedef void (*btf_trace_tcp_destroy_sock)(void *, struct sock *); + +typedef void (*btf_trace_tcp_rcv_space_adjust)(void *, struct sock *); + +typedef void (*btf_trace_tcp_retransmit_synack)(void *, const struct sock *, const struct request_sock *); + +typedef void (*btf_trace_tcp_probe)(void *, struct sock *, struct sk_buff *); + +struct trace_event_raw_fib_table_lookup { + struct trace_entry ent; + u32 tb_id; + int err; + int oif; + int iif; + u8 proto; + __u8 tos; + __u8 scope; + __u8 flags; + __u8 src[4]; + __u8 dst[4]; + __u8 gw4[4]; + __u8 gw6[16]; + u16 sport; + u16 dport; + u32 __data_loc_name; + char __data[0]; +}; + +struct trace_event_data_offsets_fib_table_lookup { + u32 name; +}; + +typedef void (*btf_trace_fib_table_lookup)(void *, u32, const struct flowi4 *, const struct fib_nh_common *, int); + +struct trace_event_raw_qdisc_dequeue { + struct trace_entry ent; + struct Qdisc *qdisc; + const struct netdev_queue *txq; + int packets; + void *skbaddr; + int ifindex; + u32 handle; + u32 parent; + long unsigned int txq_state; + char __data[0]; +}; + +struct trace_event_raw_qdisc_reset { + struct trace_entry ent; + u32 __data_loc_dev; + u32 __data_loc_kind; + u32 parent; + u32 handle; + char __data[0]; +}; + +struct trace_event_raw_qdisc_destroy { + struct trace_entry ent; + u32 __data_loc_dev; + u32 __data_loc_kind; + u32 parent; + u32 handle; + char __data[0]; +}; + +struct trace_event_raw_qdisc_create { + struct trace_entry ent; + u32 __data_loc_dev; + u32 __data_loc_kind; + u32 parent; + char __data[0]; +}; + +struct trace_event_data_offsets_qdisc_dequeue {}; + +struct trace_event_data_offsets_qdisc_reset { + u32 dev; + u32 kind; +}; + +struct trace_event_data_offsets_qdisc_destroy { + u32 dev; + u32 kind; +}; + +struct trace_event_data_offsets_qdisc_create { + u32 dev; + u32 kind; +}; + +typedef void (*btf_trace_qdisc_dequeue)(void *, struct Qdisc *, const struct netdev_queue *, int, struct sk_buff *); + +typedef void (*btf_trace_qdisc_reset)(void *, struct Qdisc *); + +typedef void (*btf_trace_qdisc_destroy)(void *, struct Qdisc *); + +typedef void (*btf_trace_qdisc_create)(void *, const struct Qdisc_ops *, struct net_device *, u32); + +struct bridge_stp_xstats { + __u64 transition_blk; + __u64 transition_fwd; + __u64 rx_bpdu; + __u64 tx_bpdu; + __u64 rx_tcn; + __u64 tx_tcn; +}; + +struct br_mcast_stats { + __u64 igmp_v1queries[2]; + __u64 igmp_v2queries[2]; + __u64 igmp_v3queries[2]; + __u64 igmp_leaves[2]; + __u64 igmp_v1reports[2]; + __u64 igmp_v2reports[2]; + __u64 igmp_v3reports[2]; + __u64 igmp_parse_errors; + __u64 mld_v1queries[2]; + __u64 mld_v2queries[2]; + __u64 mld_leaves[2]; + __u64 mld_v1reports[2]; + __u64 mld_v2reports[2]; + __u64 mld_parse_errors; + __u64 mcast_bytes[2]; + __u64 mcast_packets[2]; +}; + +struct br_ip { + union { + __be32 ip4; + struct in6_addr ip6; + } src; + union { + __be32 ip4; + struct in6_addr ip6; + unsigned char mac_addr[6]; + } dst; + __be16 proto; + __u16 vid; +}; + +struct bridge_id { + unsigned char prio[2]; + unsigned char addr[6]; +}; + +typedef struct bridge_id bridge_id; + +struct mac_addr { + unsigned char addr[6]; +}; + +typedef struct mac_addr mac_addr; + +typedef __u16 port_id; + +struct bridge_mcast_own_query { + struct timer_list timer; + u32 startup_sent; +}; + +struct bridge_mcast_other_query { + struct timer_list timer; + long unsigned int delay_time; +}; + +struct net_bridge_port; + +struct bridge_mcast_querier { + struct br_ip addr; + struct net_bridge_port *port; +}; + +struct net_bridge; + +struct net_bridge_vlan_group; + +struct bridge_mcast_stats; + +struct net_bridge_port { + struct net_bridge *br; + struct net_device *dev; + struct list_head list; + long unsigned int flags; + struct net_bridge_vlan_group *vlgrp; + struct net_bridge_port *backup_port; + u8 priority; + u8 state; + u16 port_no; + unsigned char topology_change_ack; + unsigned char config_pending; + port_id port_id; + port_id designated_port; + bridge_id designated_root; + bridge_id designated_bridge; + u32 path_cost; + u32 designated_cost; + long unsigned int designated_age; + struct timer_list forward_delay_timer; + struct timer_list hold_timer; + struct timer_list message_age_timer; + struct kobject kobj; + struct callback_head rcu; + struct bridge_mcast_own_query ip4_own_query; + struct bridge_mcast_own_query ip6_own_query; + unsigned char multicast_router; + struct bridge_mcast_stats *mcast_stats; + struct timer_list multicast_router_timer; + struct hlist_head mglist; + struct hlist_node rlist; + char sysfs_name[16]; + struct netpoll *np; + int offload_fwd_mark; + u16 group_fwd_mask; + u16 backup_redirected_cnt; + struct bridge_stp_xstats stp_xstats; +}; + +struct bridge_mcast_stats { + struct br_mcast_stats mstats; + struct u64_stats_sync syncp; +}; + +struct net_bridge { + spinlock_t lock; + spinlock_t hash_lock; + struct hlist_head frame_type_list; + struct net_device *dev; + long unsigned int options; + __be16 vlan_proto; + u16 default_pvid; + struct net_bridge_vlan_group *vlgrp; + struct rhashtable fdb_hash_tbl; + struct list_head port_list; + union { + struct rtable fake_rtable; + struct rt6_info fake_rt6_info; + }; + u16 group_fwd_mask; + u16 group_fwd_mask_required; + bridge_id designated_root; + bridge_id bridge_id; + unsigned char topology_change; + unsigned char topology_change_detected; + u16 root_port; + long unsigned int max_age; + long unsigned int hello_time; + long unsigned int forward_delay; + long unsigned int ageing_time; + long unsigned int bridge_max_age; + long unsigned int bridge_hello_time; + long unsigned int bridge_forward_delay; + long unsigned int bridge_ageing_time; + u32 root_path_cost; + u8 group_addr[6]; + enum { + BR_NO_STP = 0, + BR_KERNEL_STP = 1, + BR_USER_STP = 2, + } stp_enabled; + u32 hash_max; + u32 multicast_last_member_count; + u32 multicast_startup_query_count; + u8 multicast_igmp_version; + u8 multicast_router; + u8 multicast_mld_version; + spinlock_t multicast_lock; + long unsigned int multicast_last_member_interval; + long unsigned int multicast_membership_interval; + long unsigned int multicast_querier_interval; + long unsigned int multicast_query_interval; + long unsigned int multicast_query_response_interval; + long unsigned int multicast_startup_query_interval; + struct rhashtable mdb_hash_tbl; + struct rhashtable sg_port_tbl; + struct hlist_head mcast_gc_list; + struct hlist_head mdb_list; + struct hlist_head router_list; + struct timer_list multicast_router_timer; + struct bridge_mcast_other_query ip4_other_query; + struct bridge_mcast_own_query ip4_own_query; + struct bridge_mcast_querier ip4_querier; + struct bridge_mcast_stats *mcast_stats; + struct bridge_mcast_other_query ip6_other_query; + struct bridge_mcast_own_query ip6_own_query; + struct bridge_mcast_querier ip6_querier; + struct work_struct mcast_gc_work; + struct timer_list hello_timer; + struct timer_list tcn_timer; + struct timer_list topology_change_timer; + struct delayed_work gc_work; + struct kobject *ifobj; + u32 auto_cnt; + int offload_fwd_mark; + struct hlist_head fdb_list; + struct hlist_head mrp_list; + struct hlist_head mep_list; +}; + +struct net_bridge_vlan_group { + struct rhashtable vlan_hash; + struct rhashtable tunnel_hash; + struct list_head vlan_list; + u16 num_vlans; + u16 pvid; + u8 pvid_state; +}; + +struct net_bridge_fdb_key { + mac_addr addr; + u16 vlan_id; +}; + +struct net_bridge_fdb_entry { + struct rhash_head rhnode; + struct net_bridge_port *dst; + struct net_bridge_fdb_key key; + struct hlist_node fdb_node; + long unsigned int flags; + long: 64; + long: 64; + long unsigned int updated; + long unsigned int used; + struct callback_head rcu; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct trace_event_raw_br_fdb_add { + struct trace_entry ent; + u8 ndm_flags; + u32 __data_loc_dev; + unsigned char addr[6]; + u16 vid; + u16 nlh_flags; + char __data[0]; +}; + +struct trace_event_raw_br_fdb_external_learn_add { + struct trace_entry ent; + u32 __data_loc_br_dev; + u32 __data_loc_dev; + unsigned char addr[6]; + u16 vid; + char __data[0]; +}; + +struct trace_event_raw_fdb_delete { + struct trace_entry ent; + u32 __data_loc_br_dev; + u32 __data_loc_dev; + unsigned char addr[6]; + u16 vid; + char __data[0]; +}; + +struct trace_event_raw_br_fdb_update { + struct trace_entry ent; + u32 __data_loc_br_dev; + u32 __data_loc_dev; + unsigned char addr[6]; + u16 vid; + long unsigned int flags; + char __data[0]; +}; + +struct trace_event_data_offsets_br_fdb_add { + u32 dev; +}; + +struct trace_event_data_offsets_br_fdb_external_learn_add { + u32 br_dev; + u32 dev; +}; + +struct trace_event_data_offsets_fdb_delete { + u32 br_dev; + u32 dev; +}; + +struct trace_event_data_offsets_br_fdb_update { + u32 br_dev; + u32 dev; +}; + +typedef void (*btf_trace_br_fdb_add)(void *, struct ndmsg *, struct net_device *, const unsigned char *, u16, u16); + +typedef void (*btf_trace_br_fdb_external_learn_add)(void *, struct net_bridge *, struct net_bridge_port *, const unsigned char *, u16); + +typedef void (*btf_trace_fdb_delete)(void *, struct net_bridge *, struct net_bridge_fdb_entry *); + +typedef void (*btf_trace_br_fdb_update)(void *, struct net_bridge *, struct net_bridge_port *, const unsigned char *, u16, long unsigned int); + +struct trace_event_raw_page_pool_release { + struct trace_entry ent; + const struct page_pool *pool; + s32 inflight; + u32 hold; + u32 release; + u64 cnt; + char __data[0]; +}; + +struct trace_event_raw_page_pool_state_release { + struct trace_entry ent; + const struct page_pool *pool; + const struct page *page; + u32 release; + long unsigned int pfn; + char __data[0]; +}; + +struct trace_event_raw_page_pool_state_hold { + struct trace_entry ent; + const struct page_pool *pool; + const struct page *page; + u32 hold; + long unsigned int pfn; + char __data[0]; +}; + +struct trace_event_raw_page_pool_update_nid { + struct trace_entry ent; + const struct page_pool *pool; + int pool_nid; + int new_nid; + char __data[0]; +}; + +struct trace_event_data_offsets_page_pool_release {}; + +struct trace_event_data_offsets_page_pool_state_release {}; + +struct trace_event_data_offsets_page_pool_state_hold {}; + +struct trace_event_data_offsets_page_pool_update_nid {}; + +typedef void (*btf_trace_page_pool_release)(void *, const struct page_pool *, s32, u32, u32); + +typedef void (*btf_trace_page_pool_state_release)(void *, const struct page_pool *, const struct page *, u32); + +typedef void (*btf_trace_page_pool_state_hold)(void *, const struct page_pool *, const struct page *, u32); + +typedef void (*btf_trace_page_pool_update_nid)(void *, const struct page_pool *, int); + +struct trace_event_raw_neigh_create { + struct trace_entry ent; + u32 family; + u32 __data_loc_dev; + int entries; + u8 created; + u8 gc_exempt; + u8 primary_key4[4]; + u8 primary_key6[16]; + char __data[0]; +}; + +struct trace_event_raw_neigh_update { + struct trace_entry ent; + u32 family; + u32 __data_loc_dev; + u8 lladdr[32]; + u8 lladdr_len; + u8 flags; + u8 nud_state; + u8 type; + u8 dead; + int refcnt; + __u8 primary_key4[4]; + __u8 primary_key6[16]; + long unsigned int confirmed; + long unsigned int updated; + long unsigned int used; + u8 new_lladdr[32]; + u8 new_state; + u32 update_flags; + u32 pid; + char __data[0]; +}; + +struct trace_event_raw_neigh__update { + struct trace_entry ent; + u32 family; + u32 __data_loc_dev; + u8 lladdr[32]; + u8 lladdr_len; + u8 flags; + u8 nud_state; + u8 type; + u8 dead; + int refcnt; + __u8 primary_key4[4]; + __u8 primary_key6[16]; + long unsigned int confirmed; + long unsigned int updated; + long unsigned int used; + u32 err; + char __data[0]; +}; + +struct trace_event_data_offsets_neigh_create { + u32 dev; +}; + +struct trace_event_data_offsets_neigh_update { + u32 dev; +}; + +struct trace_event_data_offsets_neigh__update { + u32 dev; +}; + +typedef void (*btf_trace_neigh_create)(void *, struct neigh_table *, struct net_device *, const void *, const struct neighbour *, bool); + +typedef void (*btf_trace_neigh_update)(void *, struct neighbour *, const u8 *, u8, u32, u32); + +typedef void (*btf_trace_neigh_update_done)(void *, struct neighbour *, int); + +typedef void (*btf_trace_neigh_timer_handler)(void *, struct neighbour *, int); + +typedef void (*btf_trace_neigh_event_send_done)(void *, struct neighbour *, int); + +typedef void (*btf_trace_neigh_event_send_dead)(void *, struct neighbour *, int); + +typedef void (*btf_trace_neigh_cleanup_and_release)(void *, struct neighbour *, int); + +struct net_dm_drop_point { + __u8 pc[8]; + __u32 count; +}; + +struct net_dm_alert_msg { + __u32 entries; + struct net_dm_drop_point points[0]; +}; + +enum { + NET_DM_CMD_UNSPEC = 0, + NET_DM_CMD_ALERT = 1, + NET_DM_CMD_CONFIG = 2, + NET_DM_CMD_START = 3, + NET_DM_CMD_STOP = 4, + NET_DM_CMD_PACKET_ALERT = 5, + NET_DM_CMD_CONFIG_GET = 6, + NET_DM_CMD_CONFIG_NEW = 7, + NET_DM_CMD_STATS_GET = 8, + NET_DM_CMD_STATS_NEW = 9, + _NET_DM_CMD_MAX = 10, +}; + +enum net_dm_attr { + NET_DM_ATTR_UNSPEC = 0, + NET_DM_ATTR_ALERT_MODE = 1, + NET_DM_ATTR_PC = 2, + NET_DM_ATTR_SYMBOL = 3, + NET_DM_ATTR_IN_PORT = 4, + NET_DM_ATTR_TIMESTAMP = 5, + NET_DM_ATTR_PROTO = 6, + NET_DM_ATTR_PAYLOAD = 7, + NET_DM_ATTR_PAD = 8, + NET_DM_ATTR_TRUNC_LEN = 9, + NET_DM_ATTR_ORIG_LEN = 10, + NET_DM_ATTR_QUEUE_LEN = 11, + NET_DM_ATTR_STATS = 12, + NET_DM_ATTR_HW_STATS = 13, + NET_DM_ATTR_ORIGIN = 14, + NET_DM_ATTR_HW_TRAP_GROUP_NAME = 15, + NET_DM_ATTR_HW_TRAP_NAME = 16, + NET_DM_ATTR_HW_ENTRIES = 17, + NET_DM_ATTR_HW_ENTRY = 18, + NET_DM_ATTR_HW_TRAP_COUNT = 19, + NET_DM_ATTR_SW_DROPS = 20, + NET_DM_ATTR_HW_DROPS = 21, + NET_DM_ATTR_FLOW_ACTION_COOKIE = 22, + __NET_DM_ATTR_MAX = 23, + NET_DM_ATTR_MAX = 22, +}; + +enum net_dm_alert_mode { + NET_DM_ALERT_MODE_SUMMARY = 0, + NET_DM_ALERT_MODE_PACKET = 1, +}; + +enum { + NET_DM_ATTR_PORT_NETDEV_IFINDEX = 0, + NET_DM_ATTR_PORT_NETDEV_NAME = 1, + __NET_DM_ATTR_PORT_MAX = 2, + NET_DM_ATTR_PORT_MAX = 1, +}; + +enum { + NET_DM_ATTR_STATS_DROPPED = 0, + __NET_DM_ATTR_STATS_MAX = 1, + NET_DM_ATTR_STATS_MAX = 0, +}; + +enum net_dm_origin { + NET_DM_ORIGIN_SW = 0, + NET_DM_ORIGIN_HW = 1, +}; + +struct devlink_trap_metadata { + const char *trap_name; + const char *trap_group_name; + struct net_device *input_dev; + const struct flow_action_cookie *fa_cookie; + enum devlink_trap_type trap_type; +}; + +struct net_dm_stats { + u64 dropped; + struct u64_stats_sync syncp; +}; + +struct net_dm_hw_entry { + char trap_name[40]; + u32 count; +}; + +struct net_dm_hw_entries { + u32 num_entries; + struct net_dm_hw_entry entries[0]; +}; + +struct per_cpu_dm_data { + spinlock_t lock; + union { + struct sk_buff *skb; + struct net_dm_hw_entries *hw_entries; + }; + struct sk_buff_head drop_queue; + struct work_struct dm_alert_work; + struct timer_list send_timer; + struct net_dm_stats stats; +}; + +struct dm_hw_stat_delta { + struct net_device *dev; + long unsigned int last_rx; + struct list_head list; + struct callback_head rcu; + long unsigned int last_drop_val; +}; + +struct net_dm_alert_ops { + void (*kfree_skb_probe)(void *, struct sk_buff *, void *); + void (*napi_poll_probe)(void *, struct napi_struct *, int, int); + void (*work_item_func)(struct work_struct *); + void (*hw_work_item_func)(struct work_struct *); + void (*hw_trap_probe)(void *, const struct devlink *, struct sk_buff *, const struct devlink_trap_metadata *); +}; + +struct net_dm_skb_cb { + union { + struct devlink_trap_metadata *hw_metadata; + void *pc; + }; +}; + +struct clock_identity { + u8 id[8]; +}; + +struct port_identity { + struct clock_identity clock_identity; + __be16 port_number; +}; + +struct ptp_header { + u8 tsmt; + u8 ver; + __be16 message_length; + u8 domain_number; + u8 reserved1; + u8 flag_field[2]; + __be64 correction; + __be32 reserved2; + struct port_identity source_port_identity; + __be16 sequence_id; + u8 control; + u8 log_message_interval; +} __attribute__((packed)); + +struct update_classid_context { + u32 classid; + unsigned int batch; +}; + +enum lwtunnel_encap_types { + LWTUNNEL_ENCAP_NONE = 0, + LWTUNNEL_ENCAP_MPLS = 1, + LWTUNNEL_ENCAP_IP = 2, + LWTUNNEL_ENCAP_ILA = 3, + LWTUNNEL_ENCAP_IP6 = 4, + LWTUNNEL_ENCAP_SEG6 = 5, + LWTUNNEL_ENCAP_BPF = 6, + LWTUNNEL_ENCAP_SEG6_LOCAL = 7, + LWTUNNEL_ENCAP_RPL = 8, + __LWTUNNEL_ENCAP_MAX = 9, +}; + +struct rtnexthop { + short unsigned int rtnh_len; + unsigned char rtnh_flags; + unsigned char rtnh_hops; + int rtnh_ifindex; +}; + +struct lwtunnel_encap_ops { + int (*build_state)(struct net *, struct nlattr *, unsigned int, const void *, struct lwtunnel_state **, struct netlink_ext_ack *); + void (*destroy_state)(struct lwtunnel_state *); + int (*output)(struct net *, struct sock *, struct sk_buff *); + int (*input)(struct sk_buff *); + int (*fill_encap)(struct sk_buff *, struct lwtunnel_state *); + int (*get_encap_size)(struct lwtunnel_state *); + int (*cmp_encap)(struct lwtunnel_state *, struct lwtunnel_state *); + int (*xmit)(struct sk_buff *); + struct module *owner; +}; + +enum { + LWT_BPF_PROG_UNSPEC = 0, + LWT_BPF_PROG_FD = 1, + LWT_BPF_PROG_NAME = 2, + __LWT_BPF_PROG_MAX = 3, +}; + +enum { + LWT_BPF_UNSPEC = 0, + LWT_BPF_IN = 1, + LWT_BPF_OUT = 2, + LWT_BPF_XMIT = 3, + LWT_BPF_XMIT_HEADROOM = 4, + __LWT_BPF_MAX = 5, +}; + +enum { + LWTUNNEL_XMIT_DONE = 0, + LWTUNNEL_XMIT_CONTINUE = 1, +}; + +struct bpf_lwt_prog { + struct bpf_prog *prog; + char *name; +}; + +struct bpf_lwt { + struct bpf_lwt_prog in; + struct bpf_lwt_prog out; + struct bpf_lwt_prog xmit; + int family; +}; + +struct bpf_stab { + struct bpf_map map; + struct sock **sks; + struct sk_psock_progs progs; + raw_spinlock_t lock; + long: 32; + long: 64; + long: 64; + long: 64; +}; + +typedef u64 (*btf_bpf_sock_map_update)(struct bpf_sock_ops_kern *, struct bpf_map *, void *, u64); + +typedef u64 (*btf_bpf_sk_redirect_map)(struct sk_buff *, struct bpf_map *, u32, u64); + +typedef u64 (*btf_bpf_msg_redirect_map)(struct sk_msg *, struct bpf_map *, u32, u64); + +struct sock_map_seq_info { + struct bpf_map *map; + struct sock *sk; + u32 index; +}; + +struct bpf_iter__sockmap { + union { + struct bpf_iter_meta *meta; + }; + union { + struct bpf_map *map; + }; + union { + void *key; + }; + union { + struct sock *sk; + }; +}; + +struct bpf_shtab_elem { + struct callback_head rcu; + u32 hash; + struct sock *sk; + struct hlist_node node; + u8 key[0]; +}; + +struct bpf_shtab_bucket { + struct hlist_head head; + raw_spinlock_t lock; +}; + +struct bpf_shtab { + struct bpf_map map; + struct bpf_shtab_bucket *buckets; + u32 buckets_num; + u32 elem_size; + struct sk_psock_progs progs; + atomic_t count; + long: 32; + long: 64; + long: 64; +}; + +typedef u64 (*btf_bpf_sock_hash_update)(struct bpf_sock_ops_kern *, struct bpf_map *, void *, u64); + +typedef u64 (*btf_bpf_sk_redirect_hash)(struct sk_buff *, struct bpf_map *, void *, u64); + +typedef u64 (*btf_bpf_msg_redirect_hash)(struct sk_msg *, struct bpf_map *, void *, u64); + +struct sock_hash_seq_info { + struct bpf_map *map; + struct bpf_shtab *htab; + u32 bucket_id; +}; + +struct dst_cache_pcpu { + long unsigned int refresh_ts; + struct dst_entry *dst; + u32 cookie; + union { + struct in_addr in_saddr; + struct in6_addr in6_saddr; + }; +}; + +enum devlink_command { + DEVLINK_CMD_UNSPEC = 0, + DEVLINK_CMD_GET = 1, + DEVLINK_CMD_SET = 2, + DEVLINK_CMD_NEW = 3, + DEVLINK_CMD_DEL = 4, + DEVLINK_CMD_PORT_GET = 5, + DEVLINK_CMD_PORT_SET = 6, + DEVLINK_CMD_PORT_NEW = 7, + DEVLINK_CMD_PORT_DEL = 8, + DEVLINK_CMD_PORT_SPLIT = 9, + DEVLINK_CMD_PORT_UNSPLIT = 10, + DEVLINK_CMD_SB_GET = 11, + DEVLINK_CMD_SB_SET = 12, + DEVLINK_CMD_SB_NEW = 13, + DEVLINK_CMD_SB_DEL = 14, + DEVLINK_CMD_SB_POOL_GET = 15, + DEVLINK_CMD_SB_POOL_SET = 16, + DEVLINK_CMD_SB_POOL_NEW = 17, + DEVLINK_CMD_SB_POOL_DEL = 18, + DEVLINK_CMD_SB_PORT_POOL_GET = 19, + DEVLINK_CMD_SB_PORT_POOL_SET = 20, + DEVLINK_CMD_SB_PORT_POOL_NEW = 21, + DEVLINK_CMD_SB_PORT_POOL_DEL = 22, + DEVLINK_CMD_SB_TC_POOL_BIND_GET = 23, + DEVLINK_CMD_SB_TC_POOL_BIND_SET = 24, + DEVLINK_CMD_SB_TC_POOL_BIND_NEW = 25, + DEVLINK_CMD_SB_TC_POOL_BIND_DEL = 26, + DEVLINK_CMD_SB_OCC_SNAPSHOT = 27, + DEVLINK_CMD_SB_OCC_MAX_CLEAR = 28, + DEVLINK_CMD_ESWITCH_GET = 29, + DEVLINK_CMD_ESWITCH_SET = 30, + DEVLINK_CMD_DPIPE_TABLE_GET = 31, + DEVLINK_CMD_DPIPE_ENTRIES_GET = 32, + DEVLINK_CMD_DPIPE_HEADERS_GET = 33, + DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET = 34, + DEVLINK_CMD_RESOURCE_SET = 35, + DEVLINK_CMD_RESOURCE_DUMP = 36, + DEVLINK_CMD_RELOAD = 37, + DEVLINK_CMD_PARAM_GET = 38, + DEVLINK_CMD_PARAM_SET = 39, + DEVLINK_CMD_PARAM_NEW = 40, + DEVLINK_CMD_PARAM_DEL = 41, + DEVLINK_CMD_REGION_GET = 42, + DEVLINK_CMD_REGION_SET = 43, + DEVLINK_CMD_REGION_NEW = 44, + DEVLINK_CMD_REGION_DEL = 45, + DEVLINK_CMD_REGION_READ = 46, + DEVLINK_CMD_PORT_PARAM_GET = 47, + DEVLINK_CMD_PORT_PARAM_SET = 48, + DEVLINK_CMD_PORT_PARAM_NEW = 49, + DEVLINK_CMD_PORT_PARAM_DEL = 50, + DEVLINK_CMD_INFO_GET = 51, + DEVLINK_CMD_HEALTH_REPORTER_GET = 52, + DEVLINK_CMD_HEALTH_REPORTER_SET = 53, + DEVLINK_CMD_HEALTH_REPORTER_RECOVER = 54, + DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE = 55, + DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET = 56, + DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR = 57, + DEVLINK_CMD_FLASH_UPDATE = 58, + DEVLINK_CMD_FLASH_UPDATE_END = 59, + DEVLINK_CMD_FLASH_UPDATE_STATUS = 60, + DEVLINK_CMD_TRAP_GET = 61, + DEVLINK_CMD_TRAP_SET = 62, + DEVLINK_CMD_TRAP_NEW = 63, + DEVLINK_CMD_TRAP_DEL = 64, + DEVLINK_CMD_TRAP_GROUP_GET = 65, + DEVLINK_CMD_TRAP_GROUP_SET = 66, + DEVLINK_CMD_TRAP_GROUP_NEW = 67, + DEVLINK_CMD_TRAP_GROUP_DEL = 68, + DEVLINK_CMD_TRAP_POLICER_GET = 69, + DEVLINK_CMD_TRAP_POLICER_SET = 70, + DEVLINK_CMD_TRAP_POLICER_NEW = 71, + DEVLINK_CMD_TRAP_POLICER_DEL = 72, + DEVLINK_CMD_HEALTH_REPORTER_TEST = 73, + __DEVLINK_CMD_MAX = 74, + DEVLINK_CMD_MAX = 73, +}; + +enum devlink_eswitch_mode { + DEVLINK_ESWITCH_MODE_LEGACY = 0, + DEVLINK_ESWITCH_MODE_SWITCHDEV = 1, +}; + +enum { + DEVLINK_ATTR_STATS_RX_PACKETS = 0, + DEVLINK_ATTR_STATS_RX_BYTES = 1, + DEVLINK_ATTR_STATS_RX_DROPPED = 2, + __DEVLINK_ATTR_STATS_MAX = 3, + DEVLINK_ATTR_STATS_MAX = 2, +}; + +enum { + DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT = 0, + DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT = 1, + __DEVLINK_FLASH_OVERWRITE_MAX_BIT = 2, + DEVLINK_FLASH_OVERWRITE_MAX_BIT = 1, +}; + +enum { + DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT = 0, + DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE = 1, +}; + +enum devlink_attr { + DEVLINK_ATTR_UNSPEC = 0, + DEVLINK_ATTR_BUS_NAME = 1, + DEVLINK_ATTR_DEV_NAME = 2, + DEVLINK_ATTR_PORT_INDEX = 3, + DEVLINK_ATTR_PORT_TYPE = 4, + DEVLINK_ATTR_PORT_DESIRED_TYPE = 5, + DEVLINK_ATTR_PORT_NETDEV_IFINDEX = 6, + DEVLINK_ATTR_PORT_NETDEV_NAME = 7, + DEVLINK_ATTR_PORT_IBDEV_NAME = 8, + DEVLINK_ATTR_PORT_SPLIT_COUNT = 9, + DEVLINK_ATTR_PORT_SPLIT_GROUP = 10, + DEVLINK_ATTR_SB_INDEX = 11, + DEVLINK_ATTR_SB_SIZE = 12, + DEVLINK_ATTR_SB_INGRESS_POOL_COUNT = 13, + DEVLINK_ATTR_SB_EGRESS_POOL_COUNT = 14, + DEVLINK_ATTR_SB_INGRESS_TC_COUNT = 15, + DEVLINK_ATTR_SB_EGRESS_TC_COUNT = 16, + DEVLINK_ATTR_SB_POOL_INDEX = 17, + DEVLINK_ATTR_SB_POOL_TYPE = 18, + DEVLINK_ATTR_SB_POOL_SIZE = 19, + DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE = 20, + DEVLINK_ATTR_SB_THRESHOLD = 21, + DEVLINK_ATTR_SB_TC_INDEX = 22, + DEVLINK_ATTR_SB_OCC_CUR = 23, + DEVLINK_ATTR_SB_OCC_MAX = 24, + DEVLINK_ATTR_ESWITCH_MODE = 25, + DEVLINK_ATTR_ESWITCH_INLINE_MODE = 26, + DEVLINK_ATTR_DPIPE_TABLES = 27, + DEVLINK_ATTR_DPIPE_TABLE = 28, + DEVLINK_ATTR_DPIPE_TABLE_NAME = 29, + DEVLINK_ATTR_DPIPE_TABLE_SIZE = 30, + DEVLINK_ATTR_DPIPE_TABLE_MATCHES = 31, + DEVLINK_ATTR_DPIPE_TABLE_ACTIONS = 32, + DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED = 33, + DEVLINK_ATTR_DPIPE_ENTRIES = 34, + DEVLINK_ATTR_DPIPE_ENTRY = 35, + DEVLINK_ATTR_DPIPE_ENTRY_INDEX = 36, + DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES = 37, + DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES = 38, + DEVLINK_ATTR_DPIPE_ENTRY_COUNTER = 39, + DEVLINK_ATTR_DPIPE_MATCH = 40, + DEVLINK_ATTR_DPIPE_MATCH_VALUE = 41, + DEVLINK_ATTR_DPIPE_MATCH_TYPE = 42, + DEVLINK_ATTR_DPIPE_ACTION = 43, + DEVLINK_ATTR_DPIPE_ACTION_VALUE = 44, + DEVLINK_ATTR_DPIPE_ACTION_TYPE = 45, + DEVLINK_ATTR_DPIPE_VALUE = 46, + DEVLINK_ATTR_DPIPE_VALUE_MASK = 47, + DEVLINK_ATTR_DPIPE_VALUE_MAPPING = 48, + DEVLINK_ATTR_DPIPE_HEADERS = 49, + DEVLINK_ATTR_DPIPE_HEADER = 50, + DEVLINK_ATTR_DPIPE_HEADER_NAME = 51, + DEVLINK_ATTR_DPIPE_HEADER_ID = 52, + DEVLINK_ATTR_DPIPE_HEADER_FIELDS = 53, + DEVLINK_ATTR_DPIPE_HEADER_GLOBAL = 54, + DEVLINK_ATTR_DPIPE_HEADER_INDEX = 55, + DEVLINK_ATTR_DPIPE_FIELD = 56, + DEVLINK_ATTR_DPIPE_FIELD_NAME = 57, + DEVLINK_ATTR_DPIPE_FIELD_ID = 58, + DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH = 59, + DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE = 60, + DEVLINK_ATTR_PAD = 61, + DEVLINK_ATTR_ESWITCH_ENCAP_MODE = 62, + DEVLINK_ATTR_RESOURCE_LIST = 63, + DEVLINK_ATTR_RESOURCE = 64, + DEVLINK_ATTR_RESOURCE_NAME = 65, + DEVLINK_ATTR_RESOURCE_ID = 66, + DEVLINK_ATTR_RESOURCE_SIZE = 67, + DEVLINK_ATTR_RESOURCE_SIZE_NEW = 68, + DEVLINK_ATTR_RESOURCE_SIZE_VALID = 69, + DEVLINK_ATTR_RESOURCE_SIZE_MIN = 70, + DEVLINK_ATTR_RESOURCE_SIZE_MAX = 71, + DEVLINK_ATTR_RESOURCE_SIZE_GRAN = 72, + DEVLINK_ATTR_RESOURCE_UNIT = 73, + DEVLINK_ATTR_RESOURCE_OCC = 74, + DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID = 75, + DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS = 76, + DEVLINK_ATTR_PORT_FLAVOUR = 77, + DEVLINK_ATTR_PORT_NUMBER = 78, + DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER = 79, + DEVLINK_ATTR_PARAM = 80, + DEVLINK_ATTR_PARAM_NAME = 81, + DEVLINK_ATTR_PARAM_GENERIC = 82, + DEVLINK_ATTR_PARAM_TYPE = 83, + DEVLINK_ATTR_PARAM_VALUES_LIST = 84, + DEVLINK_ATTR_PARAM_VALUE = 85, + DEVLINK_ATTR_PARAM_VALUE_DATA = 86, + DEVLINK_ATTR_PARAM_VALUE_CMODE = 87, + DEVLINK_ATTR_REGION_NAME = 88, + DEVLINK_ATTR_REGION_SIZE = 89, + DEVLINK_ATTR_REGION_SNAPSHOTS = 90, + DEVLINK_ATTR_REGION_SNAPSHOT = 91, + DEVLINK_ATTR_REGION_SNAPSHOT_ID = 92, + DEVLINK_ATTR_REGION_CHUNKS = 93, + DEVLINK_ATTR_REGION_CHUNK = 94, + DEVLINK_ATTR_REGION_CHUNK_DATA = 95, + DEVLINK_ATTR_REGION_CHUNK_ADDR = 96, + DEVLINK_ATTR_REGION_CHUNK_LEN = 97, + DEVLINK_ATTR_INFO_DRIVER_NAME = 98, + DEVLINK_ATTR_INFO_SERIAL_NUMBER = 99, + DEVLINK_ATTR_INFO_VERSION_FIXED = 100, + DEVLINK_ATTR_INFO_VERSION_RUNNING = 101, + DEVLINK_ATTR_INFO_VERSION_STORED = 102, + DEVLINK_ATTR_INFO_VERSION_NAME = 103, + DEVLINK_ATTR_INFO_VERSION_VALUE = 104, + DEVLINK_ATTR_SB_POOL_CELL_SIZE = 105, + DEVLINK_ATTR_FMSG = 106, + DEVLINK_ATTR_FMSG_OBJ_NEST_START = 107, + DEVLINK_ATTR_FMSG_PAIR_NEST_START = 108, + DEVLINK_ATTR_FMSG_ARR_NEST_START = 109, + DEVLINK_ATTR_FMSG_NEST_END = 110, + DEVLINK_ATTR_FMSG_OBJ_NAME = 111, + DEVLINK_ATTR_FMSG_OBJ_VALUE_TYPE = 112, + DEVLINK_ATTR_FMSG_OBJ_VALUE_DATA = 113, + DEVLINK_ATTR_HEALTH_REPORTER = 114, + DEVLINK_ATTR_HEALTH_REPORTER_NAME = 115, + DEVLINK_ATTR_HEALTH_REPORTER_STATE = 116, + DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT = 117, + DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT = 118, + DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS = 119, + DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD = 120, + DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER = 121, + DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME = 122, + DEVLINK_ATTR_FLASH_UPDATE_COMPONENT = 123, + DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG = 124, + DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE = 125, + DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL = 126, + DEVLINK_ATTR_PORT_PCI_PF_NUMBER = 127, + DEVLINK_ATTR_PORT_PCI_VF_NUMBER = 128, + DEVLINK_ATTR_STATS = 129, + DEVLINK_ATTR_TRAP_NAME = 130, + DEVLINK_ATTR_TRAP_ACTION = 131, + DEVLINK_ATTR_TRAP_TYPE = 132, + DEVLINK_ATTR_TRAP_GENERIC = 133, + DEVLINK_ATTR_TRAP_METADATA = 134, + DEVLINK_ATTR_TRAP_GROUP_NAME = 135, + DEVLINK_ATTR_RELOAD_FAILED = 136, + DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS = 137, + DEVLINK_ATTR_NETNS_FD = 138, + DEVLINK_ATTR_NETNS_PID = 139, + DEVLINK_ATTR_NETNS_ID = 140, + DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP = 141, + DEVLINK_ATTR_TRAP_POLICER_ID = 142, + DEVLINK_ATTR_TRAP_POLICER_RATE = 143, + DEVLINK_ATTR_TRAP_POLICER_BURST = 144, + DEVLINK_ATTR_PORT_FUNCTION = 145, + DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER = 146, + DEVLINK_ATTR_PORT_LANES = 147, + DEVLINK_ATTR_PORT_SPLITTABLE = 148, + DEVLINK_ATTR_PORT_EXTERNAL = 149, + DEVLINK_ATTR_PORT_CONTROLLER_NUMBER = 150, + DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT = 151, + DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK = 152, + DEVLINK_ATTR_RELOAD_ACTION = 153, + DEVLINK_ATTR_RELOAD_ACTIONS_PERFORMED = 154, + DEVLINK_ATTR_RELOAD_LIMITS = 155, + DEVLINK_ATTR_DEV_STATS = 156, + DEVLINK_ATTR_RELOAD_STATS = 157, + DEVLINK_ATTR_RELOAD_STATS_ENTRY = 158, + DEVLINK_ATTR_RELOAD_STATS_LIMIT = 159, + DEVLINK_ATTR_RELOAD_STATS_VALUE = 160, + DEVLINK_ATTR_REMOTE_RELOAD_STATS = 161, + DEVLINK_ATTR_RELOAD_ACTION_INFO = 162, + DEVLINK_ATTR_RELOAD_ACTION_STATS = 163, + __DEVLINK_ATTR_MAX = 164, + DEVLINK_ATTR_MAX = 163, +}; + +enum devlink_dpipe_match_type { + DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0, +}; + +enum devlink_dpipe_action_type { + DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY = 0, +}; + +enum devlink_dpipe_field_ethernet_id { + DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC = 0, +}; + +enum devlink_dpipe_field_ipv4_id { + DEVLINK_DPIPE_FIELD_IPV4_DST_IP = 0, +}; + +enum devlink_dpipe_field_ipv6_id { + DEVLINK_DPIPE_FIELD_IPV6_DST_IP = 0, +}; + +enum devlink_dpipe_header_id { + DEVLINK_DPIPE_HEADER_ETHERNET = 0, + DEVLINK_DPIPE_HEADER_IPV4 = 1, + DEVLINK_DPIPE_HEADER_IPV6 = 2, +}; + +enum devlink_resource_unit { + DEVLINK_RESOURCE_UNIT_ENTRY = 0, +}; + +enum devlink_port_function_attr { + DEVLINK_PORT_FUNCTION_ATTR_UNSPEC = 0, + DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR = 1, + __DEVLINK_PORT_FUNCTION_ATTR_MAX = 2, + DEVLINK_PORT_FUNCTION_ATTR_MAX = 1, +}; + +struct devlink_dpipe_match { + enum devlink_dpipe_match_type type; + unsigned int header_index; + struct devlink_dpipe_header *header; + unsigned int field_id; +}; + +struct devlink_dpipe_action { + enum devlink_dpipe_action_type type; + unsigned int header_index; + struct devlink_dpipe_header *header; + unsigned int field_id; +}; + +struct devlink_dpipe_value { + union { + struct devlink_dpipe_action *action; + struct devlink_dpipe_match *match; + }; + unsigned int mapping_value; + bool mapping_valid; + unsigned int value_size; + void *value; + void *mask; +}; + +struct devlink_dpipe_entry { + u64 index; + struct devlink_dpipe_value *match_values; + unsigned int match_values_count; + struct devlink_dpipe_value *action_values; + unsigned int action_values_count; + u64 counter; + bool counter_valid; +}; + +struct devlink_dpipe_dump_ctx { + struct genl_info *info; + enum devlink_command cmd; + struct sk_buff *skb; + struct nlattr *nest; + void *hdr; +}; + +struct devlink_dpipe_table_ops; + +struct devlink_dpipe_table { + void *priv; + struct list_head list; + const char *name; + bool counters_enabled; + bool counter_control_extern; + bool resource_valid; + u64 resource_id; + u64 resource_units; + struct devlink_dpipe_table_ops *table_ops; + struct callback_head rcu; +}; + +struct devlink_dpipe_table_ops { + int (*actions_dump)(void *, struct sk_buff *); + int (*matches_dump)(void *, struct sk_buff *); + int (*entries_dump)(void *, bool, struct devlink_dpipe_dump_ctx *); + int (*counters_set_update)(void *, bool); + u64 (*size_get)(void *); +}; + +struct devlink_resource_size_params { + u64 size_min; + u64 size_max; + u64 size_granularity; + enum devlink_resource_unit unit; +}; + +typedef u64 devlink_resource_occ_get_t(void *); + +struct devlink_resource { + const char *name; + u64 id; + u64 size; + u64 size_new; + bool size_valid; + struct devlink_resource *parent; + struct devlink_resource_size_params size_params; + struct list_head list; + struct list_head resource_list; + devlink_resource_occ_get_t *occ_get; + void *occ_get_priv; +}; + +enum devlink_param_type { + DEVLINK_PARAM_TYPE_U8 = 0, + DEVLINK_PARAM_TYPE_U16 = 1, + DEVLINK_PARAM_TYPE_U32 = 2, + DEVLINK_PARAM_TYPE_STRING = 3, + DEVLINK_PARAM_TYPE_BOOL = 4, +}; + +struct devlink_flash_notify { + const char *status_msg; + const char *component; + long unsigned int done; + long unsigned int total; + long unsigned int timeout; +}; + +struct devlink_param { + u32 id; + const char *name; + bool generic; + enum devlink_param_type type; + long unsigned int supported_cmodes; + int (*get)(struct devlink *, u32, struct devlink_param_gset_ctx *); + int (*set)(struct devlink *, u32, struct devlink_param_gset_ctx *); + int (*validate)(struct devlink *, u32, union devlink_param_value, struct netlink_ext_ack *); +}; + +struct devlink_param_item { + struct list_head list; + const struct devlink_param *param; + union devlink_param_value driverinit_value; + bool driverinit_value_valid; + bool published; +}; + +enum devlink_param_generic_id { + DEVLINK_PARAM_GENERIC_ID_INT_ERR_RESET = 0, + DEVLINK_PARAM_GENERIC_ID_MAX_MACS = 1, + DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV = 2, + DEVLINK_PARAM_GENERIC_ID_REGION_SNAPSHOT = 3, + DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI = 4, + DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX = 5, + DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN = 6, + DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY = 7, + DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE = 8, + DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE = 9, + DEVLINK_PARAM_GENERIC_ID_ENABLE_REMOTE_DEV_RESET = 10, + __DEVLINK_PARAM_GENERIC_ID_MAX = 11, + DEVLINK_PARAM_GENERIC_ID_MAX = 10, +}; + +struct devlink_region_ops { + const char *name; + void (*destructor)(const void *); + int (*snapshot)(struct devlink *, const struct devlink_region_ops *, struct netlink_ext_ack *, u8 **); + void *priv; +}; + +struct devlink_port_region_ops { + const char *name; + void (*destructor)(const void *); + int (*snapshot)(struct devlink_port *, const struct devlink_port_region_ops *, struct netlink_ext_ack *, u8 **); + void *priv; +}; + +enum devlink_health_reporter_state { + DEVLINK_HEALTH_REPORTER_STATE_HEALTHY = 0, + DEVLINK_HEALTH_REPORTER_STATE_ERROR = 1, +}; + +struct devlink_health_reporter; + +struct devlink_fmsg; + +struct devlink_health_reporter_ops { + char *name; + int (*recover)(struct devlink_health_reporter *, void *, struct netlink_ext_ack *); + int (*dump)(struct devlink_health_reporter *, struct devlink_fmsg *, void *, struct netlink_ext_ack *); + int (*diagnose)(struct devlink_health_reporter *, struct devlink_fmsg *, struct netlink_ext_ack *); + int (*test)(struct devlink_health_reporter *, struct netlink_ext_ack *); +}; + +struct devlink_health_reporter { + struct list_head list; + void *priv; + const struct devlink_health_reporter_ops *ops; + struct devlink *devlink; + struct devlink_port *devlink_port; + struct devlink_fmsg *dump_fmsg; + struct mutex dump_lock; + u64 graceful_period; + bool auto_recover; + bool auto_dump; + u8 health_state; + u64 dump_ts; + u64 dump_real_ts; + u64 error_count; + u64 recovery_count; + u64 last_recovery_ts; + refcount_t refcount; +}; + +struct devlink_fmsg { + struct list_head item_list; + bool putting_binary; +}; + +enum devlink_trap_generic_id { + DEVLINK_TRAP_GENERIC_ID_SMAC_MC = 0, + DEVLINK_TRAP_GENERIC_ID_VLAN_TAG_MISMATCH = 1, + DEVLINK_TRAP_GENERIC_ID_INGRESS_VLAN_FILTER = 2, + DEVLINK_TRAP_GENERIC_ID_INGRESS_STP_FILTER = 3, + DEVLINK_TRAP_GENERIC_ID_EMPTY_TX_LIST = 4, + DEVLINK_TRAP_GENERIC_ID_PORT_LOOPBACK_FILTER = 5, + DEVLINK_TRAP_GENERIC_ID_BLACKHOLE_ROUTE = 6, + DEVLINK_TRAP_GENERIC_ID_TTL_ERROR = 7, + DEVLINK_TRAP_GENERIC_ID_TAIL_DROP = 8, + DEVLINK_TRAP_GENERIC_ID_NON_IP_PACKET = 9, + DEVLINK_TRAP_GENERIC_ID_UC_DIP_MC_DMAC = 10, + DEVLINK_TRAP_GENERIC_ID_DIP_LB = 11, + DEVLINK_TRAP_GENERIC_ID_SIP_MC = 12, + DEVLINK_TRAP_GENERIC_ID_SIP_LB = 13, + DEVLINK_TRAP_GENERIC_ID_CORRUPTED_IP_HDR = 14, + DEVLINK_TRAP_GENERIC_ID_IPV4_SIP_BC = 15, + DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_RESERVED_SCOPE = 16, + DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE = 17, + DEVLINK_TRAP_GENERIC_ID_MTU_ERROR = 18, + DEVLINK_TRAP_GENERIC_ID_UNRESOLVED_NEIGH = 19, + DEVLINK_TRAP_GENERIC_ID_RPF = 20, + DEVLINK_TRAP_GENERIC_ID_REJECT_ROUTE = 21, + DEVLINK_TRAP_GENERIC_ID_IPV4_LPM_UNICAST_MISS = 22, + DEVLINK_TRAP_GENERIC_ID_IPV6_LPM_UNICAST_MISS = 23, + DEVLINK_TRAP_GENERIC_ID_NON_ROUTABLE = 24, + DEVLINK_TRAP_GENERIC_ID_DECAP_ERROR = 25, + DEVLINK_TRAP_GENERIC_ID_OVERLAY_SMAC_MC = 26, + DEVLINK_TRAP_GENERIC_ID_INGRESS_FLOW_ACTION_DROP = 27, + DEVLINK_TRAP_GENERIC_ID_EGRESS_FLOW_ACTION_DROP = 28, + DEVLINK_TRAP_GENERIC_ID_STP = 29, + DEVLINK_TRAP_GENERIC_ID_LACP = 30, + DEVLINK_TRAP_GENERIC_ID_LLDP = 31, + DEVLINK_TRAP_GENERIC_ID_IGMP_QUERY = 32, + DEVLINK_TRAP_GENERIC_ID_IGMP_V1_REPORT = 33, + DEVLINK_TRAP_GENERIC_ID_IGMP_V2_REPORT = 34, + DEVLINK_TRAP_GENERIC_ID_IGMP_V3_REPORT = 35, + DEVLINK_TRAP_GENERIC_ID_IGMP_V2_LEAVE = 36, + DEVLINK_TRAP_GENERIC_ID_MLD_QUERY = 37, + DEVLINK_TRAP_GENERIC_ID_MLD_V1_REPORT = 38, + DEVLINK_TRAP_GENERIC_ID_MLD_V2_REPORT = 39, + DEVLINK_TRAP_GENERIC_ID_MLD_V1_DONE = 40, + DEVLINK_TRAP_GENERIC_ID_IPV4_DHCP = 41, + DEVLINK_TRAP_GENERIC_ID_IPV6_DHCP = 42, + DEVLINK_TRAP_GENERIC_ID_ARP_REQUEST = 43, + DEVLINK_TRAP_GENERIC_ID_ARP_RESPONSE = 44, + DEVLINK_TRAP_GENERIC_ID_ARP_OVERLAY = 45, + DEVLINK_TRAP_GENERIC_ID_IPV6_NEIGH_SOLICIT = 46, + DEVLINK_TRAP_GENERIC_ID_IPV6_NEIGH_ADVERT = 47, + DEVLINK_TRAP_GENERIC_ID_IPV4_BFD = 48, + DEVLINK_TRAP_GENERIC_ID_IPV6_BFD = 49, + DEVLINK_TRAP_GENERIC_ID_IPV4_OSPF = 50, + DEVLINK_TRAP_GENERIC_ID_IPV6_OSPF = 51, + DEVLINK_TRAP_GENERIC_ID_IPV4_BGP = 52, + DEVLINK_TRAP_GENERIC_ID_IPV6_BGP = 53, + DEVLINK_TRAP_GENERIC_ID_IPV4_VRRP = 54, + DEVLINK_TRAP_GENERIC_ID_IPV6_VRRP = 55, + DEVLINK_TRAP_GENERIC_ID_IPV4_PIM = 56, + DEVLINK_TRAP_GENERIC_ID_IPV6_PIM = 57, + DEVLINK_TRAP_GENERIC_ID_UC_LB = 58, + DEVLINK_TRAP_GENERIC_ID_LOCAL_ROUTE = 59, + DEVLINK_TRAP_GENERIC_ID_EXTERNAL_ROUTE = 60, + DEVLINK_TRAP_GENERIC_ID_IPV6_UC_DIP_LINK_LOCAL_SCOPE = 61, + DEVLINK_TRAP_GENERIC_ID_IPV6_DIP_ALL_NODES = 62, + DEVLINK_TRAP_GENERIC_ID_IPV6_DIP_ALL_ROUTERS = 63, + DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_SOLICIT = 64, + DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_ADVERT = 65, + DEVLINK_TRAP_GENERIC_ID_IPV6_REDIRECT = 66, + DEVLINK_TRAP_GENERIC_ID_IPV4_ROUTER_ALERT = 67, + DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_ALERT = 68, + DEVLINK_TRAP_GENERIC_ID_PTP_EVENT = 69, + DEVLINK_TRAP_GENERIC_ID_PTP_GENERAL = 70, + DEVLINK_TRAP_GENERIC_ID_FLOW_ACTION_SAMPLE = 71, + DEVLINK_TRAP_GENERIC_ID_FLOW_ACTION_TRAP = 72, + DEVLINK_TRAP_GENERIC_ID_EARLY_DROP = 73, + DEVLINK_TRAP_GENERIC_ID_VXLAN_PARSING = 74, + DEVLINK_TRAP_GENERIC_ID_LLC_SNAP_PARSING = 75, + DEVLINK_TRAP_GENERIC_ID_VLAN_PARSING = 76, + DEVLINK_TRAP_GENERIC_ID_PPPOE_PPP_PARSING = 77, + DEVLINK_TRAP_GENERIC_ID_MPLS_PARSING = 78, + DEVLINK_TRAP_GENERIC_ID_ARP_PARSING = 79, + DEVLINK_TRAP_GENERIC_ID_IP_1_PARSING = 80, + DEVLINK_TRAP_GENERIC_ID_IP_N_PARSING = 81, + DEVLINK_TRAP_GENERIC_ID_GRE_PARSING = 82, + DEVLINK_TRAP_GENERIC_ID_UDP_PARSING = 83, + DEVLINK_TRAP_GENERIC_ID_TCP_PARSING = 84, + DEVLINK_TRAP_GENERIC_ID_IPSEC_PARSING = 85, + DEVLINK_TRAP_GENERIC_ID_SCTP_PARSING = 86, + DEVLINK_TRAP_GENERIC_ID_DCCP_PARSING = 87, + DEVLINK_TRAP_GENERIC_ID_GTP_PARSING = 88, + DEVLINK_TRAP_GENERIC_ID_ESP_PARSING = 89, + DEVLINK_TRAP_GENERIC_ID_BLACKHOLE_NEXTHOP = 90, + __DEVLINK_TRAP_GENERIC_ID_MAX = 91, + DEVLINK_TRAP_GENERIC_ID_MAX = 90, +}; + +enum devlink_trap_group_generic_id { + DEVLINK_TRAP_GROUP_GENERIC_ID_L2_DROPS = 0, + DEVLINK_TRAP_GROUP_GENERIC_ID_L3_DROPS = 1, + DEVLINK_TRAP_GROUP_GENERIC_ID_L3_EXCEPTIONS = 2, + DEVLINK_TRAP_GROUP_GENERIC_ID_BUFFER_DROPS = 3, + DEVLINK_TRAP_GROUP_GENERIC_ID_TUNNEL_DROPS = 4, + DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_DROPS = 5, + DEVLINK_TRAP_GROUP_GENERIC_ID_STP = 6, + DEVLINK_TRAP_GROUP_GENERIC_ID_LACP = 7, + DEVLINK_TRAP_GROUP_GENERIC_ID_LLDP = 8, + DEVLINK_TRAP_GROUP_GENERIC_ID_MC_SNOOPING = 9, + DEVLINK_TRAP_GROUP_GENERIC_ID_DHCP = 10, + DEVLINK_TRAP_GROUP_GENERIC_ID_NEIGH_DISCOVERY = 11, + DEVLINK_TRAP_GROUP_GENERIC_ID_BFD = 12, + DEVLINK_TRAP_GROUP_GENERIC_ID_OSPF = 13, + DEVLINK_TRAP_GROUP_GENERIC_ID_BGP = 14, + DEVLINK_TRAP_GROUP_GENERIC_ID_VRRP = 15, + DEVLINK_TRAP_GROUP_GENERIC_ID_PIM = 16, + DEVLINK_TRAP_GROUP_GENERIC_ID_UC_LB = 17, + DEVLINK_TRAP_GROUP_GENERIC_ID_LOCAL_DELIVERY = 18, + DEVLINK_TRAP_GROUP_GENERIC_ID_EXTERNAL_DELIVERY = 19, + DEVLINK_TRAP_GROUP_GENERIC_ID_IPV6 = 20, + DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_EVENT = 21, + DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_GENERAL = 22, + DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_SAMPLE = 23, + DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_TRAP = 24, + DEVLINK_TRAP_GROUP_GENERIC_ID_PARSER_ERROR_DROPS = 25, + __DEVLINK_TRAP_GROUP_GENERIC_ID_MAX = 26, + DEVLINK_TRAP_GROUP_GENERIC_ID_MAX = 25, +}; + +struct devlink_info_req { + struct sk_buff *msg; +}; + +struct trace_event_raw_devlink_hwmsg { + struct trace_entry ent; + u32 __data_loc_bus_name; + u32 __data_loc_dev_name; + u32 __data_loc_driver_name; + bool incoming; + long unsigned int type; + u32 __data_loc_buf; + size_t len; + char __data[0]; +}; + +struct trace_event_raw_devlink_hwerr { + struct trace_entry ent; + u32 __data_loc_bus_name; + u32 __data_loc_dev_name; + u32 __data_loc_driver_name; + int err; + u32 __data_loc_msg; + char __data[0]; +}; + +struct trace_event_raw_devlink_health_report { + struct trace_entry ent; + u32 __data_loc_bus_name; + u32 __data_loc_dev_name; + u32 __data_loc_driver_name; + u32 __data_loc_reporter_name; + u32 __data_loc_msg; + char __data[0]; +}; + +struct trace_event_raw_devlink_health_recover_aborted { + struct trace_entry ent; + u32 __data_loc_bus_name; + u32 __data_loc_dev_name; + u32 __data_loc_driver_name; + u32 __data_loc_reporter_name; + bool health_state; + u64 time_since_last_recover; + char __data[0]; +}; + +struct trace_event_raw_devlink_health_reporter_state_update { + struct trace_entry ent; + u32 __data_loc_bus_name; + u32 __data_loc_dev_name; + u32 __data_loc_driver_name; + u32 __data_loc_reporter_name; + u8 new_state; + char __data[0]; +}; + +struct trace_event_raw_devlink_trap_report { + struct trace_entry ent; + u32 __data_loc_bus_name; + u32 __data_loc_dev_name; + u32 __data_loc_driver_name; + u32 __data_loc_trap_name; + u32 __data_loc_trap_group_name; + u32 __data_loc_input_dev_name; + char __data[0]; +}; + +struct trace_event_data_offsets_devlink_hwmsg { + u32 bus_name; + u32 dev_name; + u32 driver_name; + u32 buf; +}; + +struct trace_event_data_offsets_devlink_hwerr { + u32 bus_name; + u32 dev_name; + u32 driver_name; + u32 msg; +}; + +struct trace_event_data_offsets_devlink_health_report { + u32 bus_name; + u32 dev_name; + u32 driver_name; + u32 reporter_name; + u32 msg; +}; + +struct trace_event_data_offsets_devlink_health_recover_aborted { + u32 bus_name; + u32 dev_name; + u32 driver_name; + u32 reporter_name; +}; + +struct trace_event_data_offsets_devlink_health_reporter_state_update { + u32 bus_name; + u32 dev_name; + u32 driver_name; + u32 reporter_name; +}; + +struct trace_event_data_offsets_devlink_trap_report { + u32 bus_name; + u32 dev_name; + u32 driver_name; + u32 trap_name; + u32 trap_group_name; + u32 input_dev_name; +}; + +typedef void (*btf_trace_devlink_hwmsg)(void *, const struct devlink *, bool, long unsigned int, const u8 *, size_t); + +typedef void (*btf_trace_devlink_hwerr)(void *, const struct devlink *, int, const char *); + +typedef void (*btf_trace_devlink_health_report)(void *, const struct devlink *, const char *, const char *); + +typedef void (*btf_trace_devlink_health_recover_aborted)(void *, const struct devlink *, const char *, bool, u64); + +typedef void (*btf_trace_devlink_health_reporter_state_update)(void *, const struct devlink *, const char *, bool); + +typedef void (*btf_trace_devlink_trap_report)(void *, const struct devlink *, struct sk_buff *, const struct devlink_trap_metadata *); + +struct devlink_sb { + struct list_head list; + unsigned int index; + u32 size; + u16 ingress_pools_count; + u16 egress_pools_count; + u16 ingress_tc_count; + u16 egress_tc_count; +}; + +struct devlink_region { + struct devlink *devlink; + struct devlink_port *port; + struct list_head list; + union { + const struct devlink_region_ops *ops; + const struct devlink_port_region_ops *port_ops; + }; + struct list_head snapshot_list; + u32 max_snapshots; + u32 cur_snapshots; + u64 size; +}; + +struct devlink_snapshot { + struct list_head list; + struct devlink_region *region; + u8 *data; + u32 id; +}; + +enum devlink_multicast_groups { + DEVLINK_MCGRP_CONFIG = 0, +}; + +struct devlink_reload_combination { + enum devlink_reload_action action; + enum devlink_reload_limit limit; +}; + +struct devlink_fmsg_item { + struct list_head list; + int attrtype; + u8 nla_type; + u16 len; + int value[0]; +}; + +struct devlink_stats { + u64 rx_bytes; + u64 rx_packets; + struct u64_stats_sync syncp; +}; + +struct devlink_trap_policer_item { + const struct devlink_trap_policer *policer; + u64 rate; + u64 burst; + struct list_head list; +}; + +struct devlink_trap_group_item { + const struct devlink_trap_group *group; + struct devlink_trap_policer_item *policer_item; + struct list_head list; + struct devlink_stats *stats; +}; + +struct devlink_trap_item { + const struct devlink_trap *trap; + struct devlink_trap_group_item *group_item; + struct list_head list; + enum devlink_trap_action action; + struct devlink_stats *stats; + void *priv; +}; + +struct gro_cell; + +struct gro_cells { + struct gro_cell *cells; +}; + +struct gro_cell { + struct sk_buff_head napi_skbs; + struct napi_struct napi; +}; + +enum { + SK_DIAG_BPF_STORAGE_REQ_NONE = 0, + SK_DIAG_BPF_STORAGE_REQ_MAP_FD = 1, + __SK_DIAG_BPF_STORAGE_REQ_MAX = 2, +}; + +enum { + SK_DIAG_BPF_STORAGE_REP_NONE = 0, + SK_DIAG_BPF_STORAGE = 1, + __SK_DIAG_BPF_STORAGE_REP_MAX = 2, +}; + +enum { + SK_DIAG_BPF_STORAGE_NONE = 0, + SK_DIAG_BPF_STORAGE_PAD = 1, + SK_DIAG_BPF_STORAGE_MAP_ID = 2, + SK_DIAG_BPF_STORAGE_MAP_VALUE = 3, + __SK_DIAG_BPF_STORAGE_MAX = 4, +}; + +typedef u64 (*btf_bpf_sk_storage_get)(struct bpf_map *, struct sock *, void *, u64); + +typedef u64 (*btf_bpf_sk_storage_delete)(struct bpf_map *, struct sock *); + +typedef u64 (*btf_bpf_sk_storage_get_tracing)(struct bpf_map *, struct sock *, void *, u64); + +typedef u64 (*btf_bpf_sk_storage_delete_tracing)(struct bpf_map *, struct sock *); + +struct bpf_sk_storage_diag { + u32 nr_maps; + struct bpf_map *maps[0]; +}; + +struct bpf_iter_seq_sk_storage_map_info { + struct bpf_map *map; + unsigned int bucket_id; + unsigned int skip_elems; +}; + +struct bpf_iter__bpf_sk_storage_map { + union { + struct bpf_iter_meta *meta; + }; + union { + struct bpf_map *map; + }; + union { + struct sock *sk; + }; + union { + void *value; + }; +}; + +struct compat_cmsghdr { + compat_size_t cmsg_len; + compat_int_t cmsg_level; + compat_int_t cmsg_type; +}; + +typedef struct sk_buff * (*gro_receive_t)(struct list_head *, struct sk_buff *); + +struct nvmem_cell___2; + +struct fch_hdr { + __u8 daddr[6]; + __u8 saddr[6]; +}; + +struct fcllc { + __u8 dsap; + __u8 ssap; + __u8 llc; + __u8 protid[3]; + __be16 ethertype; +}; + +enum macvlan_mode { + MACVLAN_MODE_PRIVATE = 1, + MACVLAN_MODE_VEPA = 2, + MACVLAN_MODE_BRIDGE = 4, + MACVLAN_MODE_PASSTHRU = 8, + MACVLAN_MODE_SOURCE = 16, +}; + +struct tc_ratespec { + unsigned char cell_log; + __u8 linklayer; + short unsigned int overhead; + short int cell_align; + short unsigned int mpu; + __u32 rate; +}; + +struct tc_prio_qopt { + int bands; + __u8 priomap[16]; +}; + +enum { + TCA_UNSPEC = 0, + TCA_KIND = 1, + TCA_OPTIONS = 2, + TCA_STATS = 3, + TCA_XSTATS = 4, + TCA_RATE = 5, + TCA_FCNT = 6, + TCA_STATS2 = 7, + TCA_STAB = 8, + TCA_PAD = 9, + TCA_DUMP_INVISIBLE = 10, + TCA_CHAIN = 11, + TCA_HW_OFFLOAD = 12, + TCA_INGRESS_BLOCK = 13, + TCA_EGRESS_BLOCK = 14, + TCA_DUMP_FLAGS = 15, + __TCA_MAX = 16, +}; + +struct vlan_pcpu_stats { + u64 rx_packets; + u64 rx_bytes; + u64 rx_multicast; + u64 tx_packets; + u64 tx_bytes; + struct u64_stats_sync syncp; + u32 rx_errors; + u32 tx_dropped; +}; + +struct netpoll___2; + +struct skb_array { + struct ptr_ring ring; +}; + +struct macvlan_port; + +struct macvlan_dev { + struct net_device *dev; + struct list_head list; + struct hlist_node hlist; + struct macvlan_port *port; + struct net_device *lowerdev; + void *accel_priv; + struct vlan_pcpu_stats *pcpu_stats; + long unsigned int mc_filter[4]; + netdev_features_t set_features; + enum macvlan_mode mode; + u16 flags; + unsigned int macaddr_count; + u32 bc_queue_len_req; + struct netpoll___2 *netpoll; +}; + +struct psched_ratecfg { + u64 rate_bytes_ps; + u32 mult; + u16 overhead; + u8 linklayer; + u8 shift; +}; + +struct mini_Qdisc_pair { + struct mini_Qdisc miniq1; + struct mini_Qdisc miniq2; + struct mini_Qdisc **p_miniq; +}; + +struct pfifo_fast_priv { + struct skb_array q[3]; +}; + +struct tc_qopt_offload_stats { + struct gnet_stats_basic_packed *bstats; + struct gnet_stats_queue *qstats; +}; + +enum tc_mq_command { + TC_MQ_CREATE = 0, + TC_MQ_DESTROY = 1, + TC_MQ_STATS = 2, + TC_MQ_GRAFT = 3, +}; + +struct tc_mq_opt_offload_graft_params { + long unsigned int queue; + u32 child_handle; +}; + +struct tc_mq_qopt_offload { + enum tc_mq_command command; + u32 handle; + union { + struct tc_qopt_offload_stats stats; + struct tc_mq_opt_offload_graft_params graft_params; + }; +}; + +struct mq_sched { + struct Qdisc **qdiscs; +}; + +struct sch_frag_data { + long unsigned int dst; + struct qdisc_skb_cb cb; + __be16 inner_protocol; + u16 vlan_tci; + __be16 vlan_proto; + unsigned int l2_len; + u8 l2_data[18]; + int (*xmit)(struct sk_buff *); +}; + +enum tc_link_layer { + TC_LINKLAYER_UNAWARE = 0, + TC_LINKLAYER_ETHERNET = 1, + TC_LINKLAYER_ATM = 2, +}; + +enum { + TCA_STAB_UNSPEC = 0, + TCA_STAB_BASE = 1, + TCA_STAB_DATA = 2, + __TCA_STAB_MAX = 3, +}; + +struct qdisc_rate_table { + struct tc_ratespec rate; + u32 data[256]; + struct qdisc_rate_table *next; + int refcnt; +}; + +struct Qdisc_class_common { + u32 classid; + struct hlist_node hnode; +}; + +struct Qdisc_class_hash { + struct hlist_head *hash; + unsigned int hashsize; + unsigned int hashmask; + unsigned int hashelems; +}; + +struct qdisc_watchdog { + u64 last_expires; + struct hrtimer timer; + struct Qdisc *qdisc; +}; + +enum tc_root_command { + TC_ROOT_GRAFT = 0, +}; + +struct tc_root_qopt_offload { + enum tc_root_command command; + u32 handle; + bool ingress; +}; + +struct check_loop_arg { + struct qdisc_walker w; + struct Qdisc *p; + int depth; +}; + +struct tcf_bind_args { + struct tcf_walker w; + long unsigned int base; + long unsigned int cl; + u32 classid; +}; + +struct tc_bind_class_args { + struct qdisc_walker w; + long unsigned int new_cl; + u32 portid; + u32 clid; +}; + +struct qdisc_dump_args { + struct qdisc_walker w; + struct sk_buff *skb; + struct netlink_callback *cb; +}; + +enum net_xmit_qdisc_t { + __NET_XMIT_STOLEN = 65536, + __NET_XMIT_BYPASS = 131072, +}; + +struct tc_skb_ext { + __u32 chain; + __u16 mru; +}; + +enum { + TCA_ACT_UNSPEC = 0, + TCA_ACT_KIND = 1, + TCA_ACT_OPTIONS = 2, + TCA_ACT_INDEX = 3, + TCA_ACT_STATS = 4, + TCA_ACT_PAD = 5, + TCA_ACT_COOKIE = 6, + TCA_ACT_FLAGS = 7, + TCA_ACT_HW_STATS = 8, + TCA_ACT_USED_HW_STATS = 9, + __TCA_ACT_MAX = 10, +}; + +enum tca_id { + TCA_ID_UNSPEC = 0, + TCA_ID_POLICE = 1, + TCA_ID_GACT = 5, + TCA_ID_IPT = 6, + TCA_ID_PEDIT = 7, + TCA_ID_MIRRED = 8, + TCA_ID_NAT = 9, + TCA_ID_XT = 10, + TCA_ID_SKBEDIT = 11, + TCA_ID_VLAN = 12, + TCA_ID_BPF = 13, + TCA_ID_CONNMARK = 14, + TCA_ID_SKBMOD = 15, + TCA_ID_CSUM = 16, + TCA_ID_TUNNEL_KEY = 17, + TCA_ID_SIMP = 22, + TCA_ID_IFE = 25, + TCA_ID_SAMPLE = 26, + TCA_ID_CTINFO = 27, + TCA_ID_MPLS = 28, + TCA_ID_CT = 29, + TCA_ID_GATE = 30, + __TCA_ID_MAX = 255, +}; + +struct tcf_t { + __u64 install; + __u64 lastuse; + __u64 expires; + __u64 firstuse; +}; + +struct psample_group { + struct list_head list; + struct net *net; + u32 group_num; + u32 refcount; + u32 seq; + struct callback_head rcu; +}; + +struct action_gate_entry { + u8 gate_state; + u32 interval; + s32 ipv; + s32 maxoctets; +}; + +enum qdisc_class_ops_flags { + QDISC_CLASS_OPS_DOIT_UNLOCKED = 1, +}; + +enum tcf_proto_ops_flags { + TCF_PROTO_OPS_DOIT_UNLOCKED = 1, +}; + +typedef void tcf_chain_head_change_t(struct tcf_proto *, void *); + +struct tcf_idrinfo { + struct mutex lock; + struct idr action_idr; + struct net *net; +}; + +struct tc_action_ops; + +struct tc_cookie; + +struct tc_action { + const struct tc_action_ops *ops; + __u32 type; + struct tcf_idrinfo *idrinfo; + u32 tcfa_index; + refcount_t tcfa_refcnt; + atomic_t tcfa_bindcnt; + int tcfa_action; + struct tcf_t tcfa_tm; + struct gnet_stats_basic_packed tcfa_bstats; + struct gnet_stats_basic_packed tcfa_bstats_hw; + struct gnet_stats_queue tcfa_qstats; + struct net_rate_estimator *tcfa_rate_est; + spinlock_t tcfa_lock; + struct gnet_stats_basic_cpu *cpu_bstats; + struct gnet_stats_basic_cpu *cpu_bstats_hw; + struct gnet_stats_queue *cpu_qstats; + struct tc_cookie *act_cookie; + struct tcf_chain *goto_chain; + u32 tcfa_flags; + u8 hw_stats; + u8 used_hw_stats; + bool used_hw_stats_valid; +}; + +typedef void (*tc_action_priv_destructor)(void *); + +struct tc_action_ops { + struct list_head head; + char kind[16]; + enum tca_id id; + size_t size; + struct module *owner; + int (*act)(struct sk_buff *, const struct tc_action *, struct tcf_result *); + int (*dump)(struct sk_buff *, struct tc_action *, int, int); + void (*cleanup)(struct tc_action *); + int (*lookup)(struct net *, struct tc_action **, u32); + int (*init)(struct net *, struct nlattr *, struct nlattr *, struct tc_action **, int, int, bool, struct tcf_proto *, u32, struct netlink_ext_ack *); + int (*walk)(struct net *, struct sk_buff *, struct netlink_callback *, int, const struct tc_action_ops *, struct netlink_ext_ack *); + void (*stats_update)(struct tc_action *, u64, u64, u64, u64, bool); + size_t (*get_fill_size)(const struct tc_action *); + struct net_device * (*get_dev)(const struct tc_action *, tc_action_priv_destructor *); + struct psample_group * (*get_psample_group)(const struct tc_action *, tc_action_priv_destructor *); +}; + +struct tc_cookie { + u8 *data; + u32 len; + struct callback_head rcu; +}; + +struct tcf_block_ext_info { + enum flow_block_binder_type binder_type; + tcf_chain_head_change_t *chain_head_change; + void *chain_head_change_priv; + u32 block_index; +}; + +struct tcf_qevent { + struct tcf_block *block; + struct tcf_block_ext_info info; + struct tcf_proto *filter_chain; +}; + +struct tcf_exts { + __u32 type; + int nr_actions; + struct tc_action **actions; + struct net *net; + int action; + int police; +}; + +enum pedit_header_type { + TCA_PEDIT_KEY_EX_HDR_TYPE_NETWORK = 0, + TCA_PEDIT_KEY_EX_HDR_TYPE_ETH = 1, + TCA_PEDIT_KEY_EX_HDR_TYPE_IP4 = 2, + TCA_PEDIT_KEY_EX_HDR_TYPE_IP6 = 3, + TCA_PEDIT_KEY_EX_HDR_TYPE_TCP = 4, + TCA_PEDIT_KEY_EX_HDR_TYPE_UDP = 5, + __PEDIT_HDR_TYPE_MAX = 6, +}; + +enum pedit_cmd { + TCA_PEDIT_KEY_EX_CMD_SET = 0, + TCA_PEDIT_KEY_EX_CMD_ADD = 1, + __PEDIT_CMD_MAX = 2, +}; + +struct tc_pedit_key { + __u32 mask; + __u32 val; + __u32 off; + __u32 at; + __u32 offmask; + __u32 shift; +}; + +struct tcf_pedit_key_ex { + enum pedit_header_type htype; + enum pedit_cmd cmd; +}; + +struct tcf_pedit { + struct tc_action common; + unsigned char tcfp_nkeys; + unsigned char tcfp_flags; + struct tc_pedit_key *tcfp_keys; + struct tcf_pedit_key_ex *tcfp_keys_ex; +}; + +struct tcf_mirred { + struct tc_action common; + int tcfm_eaction; + bool tcfm_mac_header_xmit; + struct net_device *tcfm_dev; + struct list_head tcfm_list; +}; + +struct tcf_vlan_params { + int tcfv_action; + unsigned char tcfv_push_dst[6]; + unsigned char tcfv_push_src[6]; + u16 tcfv_push_vid; + __be16 tcfv_push_proto; + u8 tcfv_push_prio; + struct callback_head rcu; +}; + +struct tcf_vlan { + struct tc_action common; + struct tcf_vlan_params *vlan_p; +}; + +struct tcf_tunnel_key_params { + struct callback_head rcu; + int tcft_action; + struct metadata_dst *tcft_enc_metadata; +}; + +struct tcf_tunnel_key { + struct tc_action common; + struct tcf_tunnel_key_params *params; +}; + +struct tcf_csum_params { + u32 update_flags; + struct callback_head rcu; +}; + +struct tcf_csum { + struct tc_action common; + struct tcf_csum_params *params; +}; + +struct tcf_gact { + struct tc_action common; + u16 tcfg_ptype; + u16 tcfg_pval; + int tcfg_paction; + atomic_t packets; +}; + +struct tcf_police_params { + int tcfp_result; + u32 tcfp_ewma_rate; + s64 tcfp_burst; + u32 tcfp_mtu; + s64 tcfp_mtu_ptoks; + struct psched_ratecfg rate; + bool rate_present; + struct psched_ratecfg peak; + bool peak_present; + struct callback_head rcu; +}; + +struct tcf_police { + struct tc_action common; + struct tcf_police_params *params; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + spinlock_t tcfp_lock; + s64 tcfp_toks; + s64 tcfp_ptoks; + s64 tcfp_t_c; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct tcf_sample { + struct tc_action common; + u32 rate; + bool truncate; + u32 trunc_size; + struct psample_group *psample_group; + u32 psample_group_num; + struct list_head tcfm_list; +}; + +struct tcf_skbedit_params { + u32 flags; + u32 priority; + u32 mark; + u32 mask; + u16 queue_mapping; + u16 ptype; + struct callback_head rcu; +}; + +struct tcf_skbedit { + struct tc_action common; + struct tcf_skbedit_params *params; +}; + +struct nf_nat_range2 { + unsigned int flags; + union nf_inet_addr min_addr; + union nf_inet_addr max_addr; + union nf_conntrack_man_proto min_proto; + union nf_conntrack_man_proto max_proto; + union nf_conntrack_man_proto base_proto; +}; + +struct tcf_ct_flow_table; + +struct tcf_ct_params { + struct nf_conn *tmpl; + u16 zone; + u32 mark; + u32 mark_mask; + u32 labels[4]; + u32 labels_mask[4]; + struct nf_nat_range2 range; + bool ipv4_range; + u16 ct_action; + struct callback_head rcu; + struct tcf_ct_flow_table *ct_ft; + struct nf_flowtable *nf_ft; +}; + +struct tcf_ct { + struct tc_action common; + struct tcf_ct_params *params; +}; + +struct tcf_mpls_params { + int tcfm_action; + u32 tcfm_label; + u8 tcfm_tc; + u8 tcfm_ttl; + u8 tcfm_bos; + __be16 tcfm_proto; + struct callback_head rcu; +}; + +struct tcf_mpls { + struct tc_action common; + struct tcf_mpls_params *mpls_p; +}; + +struct tcfg_gate_entry { + int index; + u8 gate_state; + u32 interval; + s32 ipv; + s32 maxoctets; + struct list_head list; +}; + +struct tcf_gate_params { + s32 tcfg_priority; + u64 tcfg_basetime; + u64 tcfg_cycletime; + u64 tcfg_cycletime_ext; + u32 tcfg_flags; + s32 tcfg_clockid; + size_t num_entries; + struct list_head entries; +}; + +struct tcf_gate { + struct tc_action common; + struct tcf_gate_params param; + u8 current_gate_status; + ktime_t current_close_time; + u32 current_entry_octets; + s32 current_max_octets; + struct tcfg_gate_entry *next_entry; + struct hrtimer hitimer; + enum tk_offsets tk_offset; +}; + +struct tcf_filter_chain_list_item { + struct list_head list; + tcf_chain_head_change_t *chain_head_change; + void *chain_head_change_priv; +}; + +struct tcf_net { + spinlock_t idr_lock; + struct idr idr; +}; + +struct tcf_block_owner_item { + struct list_head list; + struct Qdisc *q; + enum flow_block_binder_type binder_type; +}; + +struct tcf_chain_info { + struct tcf_proto **pprev; + struct tcf_proto *next; +}; + +struct tcf_dump_args { + struct tcf_walker w; + struct sk_buff *skb; + struct netlink_callback *cb; + struct tcf_block *block; + struct Qdisc *q; + u32 parent; + bool terse_dump; +}; + +struct tcamsg { + unsigned char tca_family; + unsigned char tca__pad1; + short unsigned int tca__pad2; +}; + +enum { + TCA_ROOT_UNSPEC = 0, + TCA_ROOT_TAB = 1, + TCA_ROOT_FLAGS = 2, + TCA_ROOT_COUNT = 3, + TCA_ROOT_TIME_DELTA = 4, + __TCA_ROOT_MAX = 5, +}; + +struct tc_action_net { + struct tcf_idrinfo *idrinfo; + const struct tc_action_ops *ops; +}; + +struct tc_fifo_qopt { + __u32 limit; +}; + +enum tc_fifo_command { + TC_FIFO_REPLACE = 0, + TC_FIFO_DESTROY = 1, + TC_FIFO_STATS = 2, +}; + +struct tc_fifo_qopt_offload { + enum tc_fifo_command command; + u32 handle; + u32 parent; + union { + struct tc_qopt_offload_stats stats; + }; +}; + +enum { + TCA_FQ_CODEL_UNSPEC = 0, + TCA_FQ_CODEL_TARGET = 1, + TCA_FQ_CODEL_LIMIT = 2, + TCA_FQ_CODEL_INTERVAL = 3, + TCA_FQ_CODEL_ECN = 4, + TCA_FQ_CODEL_FLOWS = 5, + TCA_FQ_CODEL_QUANTUM = 6, + TCA_FQ_CODEL_CE_THRESHOLD = 7, + TCA_FQ_CODEL_DROP_BATCH_SIZE = 8, + TCA_FQ_CODEL_MEMORY_LIMIT = 9, + __TCA_FQ_CODEL_MAX = 10, +}; + +enum { + TCA_FQ_CODEL_XSTATS_QDISC = 0, + TCA_FQ_CODEL_XSTATS_CLASS = 1, +}; + +struct tc_fq_codel_qd_stats { + __u32 maxpacket; + __u32 drop_overlimit; + __u32 ecn_mark; + __u32 new_flow_count; + __u32 new_flows_len; + __u32 old_flows_len; + __u32 ce_mark; + __u32 memory_usage; + __u32 drop_overmemory; +}; + +struct tc_fq_codel_cl_stats { + __s32 deficit; + __u32 ldelay; + __u32 count; + __u32 lastcount; + __u32 dropping; + __s32 drop_next; +}; + +struct tc_fq_codel_xstats { + __u32 type; + union { + struct tc_fq_codel_qd_stats qdisc_stats; + struct tc_fq_codel_cl_stats class_stats; + }; +}; + +typedef u32 codel_time_t; + +typedef s32 codel_tdiff_t; + +struct codel_params { + codel_time_t target; + codel_time_t ce_threshold; + codel_time_t interval; + u32 mtu; + bool ecn; +}; + +struct codel_vars { + u32 count; + u32 lastcount; + bool dropping; + u16 rec_inv_sqrt; + codel_time_t first_above_time; + codel_time_t drop_next; + codel_time_t ldelay; +}; + +struct codel_stats { + u32 maxpacket; + u32 drop_count; + u32 drop_len; + u32 ecn_mark; + u32 ce_mark; +}; + +typedef u32 (*codel_skb_len_t)(const struct sk_buff *); + +typedef codel_time_t (*codel_skb_time_t)(const struct sk_buff *); + +typedef void (*codel_skb_drop_t)(struct sk_buff *, void *); + +typedef struct sk_buff * (*codel_skb_dequeue_t)(struct codel_vars *, void *); + +struct codel_skb_cb { + codel_time_t enqueue_time; + unsigned int mem_usage; +}; + +struct fq_codel_flow { + struct sk_buff *head; + struct sk_buff *tail; + struct list_head flowchain; + int deficit; + struct codel_vars cvars; +}; + +struct fq_codel_sched_data { + struct tcf_proto *filter_list; + struct tcf_block *block; + struct fq_codel_flow *flows; + u32 *backlogs; + u32 flows_cnt; + u32 quantum; + u32 drop_batch_size; + u32 memory_limit; + struct codel_params cparams; + struct codel_stats cstats; + u32 memory_usage; + u32 drop_overmemory; + u32 drop_overlimit; + u32 new_flow_count; + struct list_head new_flows; + struct list_head old_flows; +}; + +enum { + TCA_CGROUP_UNSPEC = 0, + TCA_CGROUP_ACT = 1, + TCA_CGROUP_POLICE = 2, + TCA_CGROUP_EMATCHES = 3, + __TCA_CGROUP_MAX = 4, +}; + +struct tcf_ematch_tree_hdr { + __u16 nmatches; + __u16 progid; +}; + +struct tcf_pkt_info { + unsigned char *ptr; + int nexthdr; +}; + +struct tcf_ematch_ops; + +struct tcf_ematch { + struct tcf_ematch_ops *ops; + long unsigned int data; + unsigned int datalen; + u16 matchid; + u16 flags; + struct net *net; +}; + +struct tcf_ematch_ops { + int kind; + int datalen; + int (*change)(struct net *, void *, int, struct tcf_ematch *); + int (*match)(struct sk_buff *, struct tcf_ematch *, struct tcf_pkt_info *); + void (*destroy)(struct tcf_ematch *); + int (*dump)(struct sk_buff *, struct tcf_ematch *); + struct module *owner; + struct list_head link; +}; + +struct tcf_ematch_tree { + struct tcf_ematch_tree_hdr hdr; + struct tcf_ematch *matches; +}; + +struct cls_cgroup_head { + u32 handle; + struct tcf_exts exts; + struct tcf_ematch_tree ematches; + struct tcf_proto *tp; + struct rcu_work rwork; +}; + +enum { + TCA_EMATCH_TREE_UNSPEC = 0, + TCA_EMATCH_TREE_HDR = 1, + TCA_EMATCH_TREE_LIST = 2, + __TCA_EMATCH_TREE_MAX = 3, +}; + +struct tcf_ematch_hdr { + __u16 matchid; + __u16 kind; + __u16 flags; + __u16 pad; +}; + +struct sockaddr_nl { + __kernel_sa_family_t nl_family; + short unsigned int nl_pad; + __u32 nl_pid; + __u32 nl_groups; +}; + +struct nlmsgerr { + int error; + struct nlmsghdr msg; +}; + +enum nlmsgerr_attrs { + NLMSGERR_ATTR_UNUSED = 0, + NLMSGERR_ATTR_MSG = 1, + NLMSGERR_ATTR_OFFS = 2, + NLMSGERR_ATTR_COOKIE = 3, + NLMSGERR_ATTR_POLICY = 4, + __NLMSGERR_ATTR_MAX = 5, + NLMSGERR_ATTR_MAX = 4, +}; + +struct nl_pktinfo { + __u32 group; +}; + +enum { + NETLINK_UNCONNECTED = 0, + NETLINK_CONNECTED = 1, +}; + +enum netlink_skb_flags { + NETLINK_SKB_DST = 8, +}; + +struct netlink_notify { + struct net *net; + u32 portid; + int protocol; +}; + +struct netlink_tap { + struct net_device *dev; + struct module *module; + struct list_head list; +}; + +struct netlink_sock { + struct sock sk; + u32 portid; + u32 dst_portid; + u32 dst_group; + u32 flags; + u32 subscriptions; + u32 ngroups; + long unsigned int *groups; + long unsigned int state; + size_t max_recvmsg_len; + wait_queue_head_t wait; + bool bound; + bool cb_running; + int dump_done_errno; + struct netlink_callback cb; + struct mutex *cb_mutex; + struct mutex cb_def_mutex; + void (*netlink_rcv)(struct sk_buff *); + int (*netlink_bind)(struct net *, int); + void (*netlink_unbind)(struct net *, int); + struct module *module; + struct rhash_head node; + struct callback_head rcu; + struct work_struct work; +}; + +struct listeners; + +struct netlink_table { + struct rhashtable hash; + struct hlist_head mc_list; + struct listeners *listeners; + unsigned int flags; + unsigned int groups; + struct mutex *cb_mutex; + struct module *module; + int (*bind)(struct net *, int); + void (*unbind)(struct net *, int); + bool (*compare)(struct net *, struct sock *); + int registered; +}; + +struct listeners { + struct callback_head rcu; + long unsigned int masks[0]; +}; + +struct netlink_tap_net { + struct list_head netlink_tap_all; + struct mutex netlink_tap_lock; +}; + +struct netlink_compare_arg { + possible_net_t pnet; + u32 portid; +}; + +struct netlink_broadcast_data { + struct sock *exclude_sk; + struct net *net; + u32 portid; + u32 group; + int failure; + int delivery_failure; + int congested; + int delivered; + gfp_t allocation; + struct sk_buff *skb; + struct sk_buff *skb2; + int (*tx_filter)(struct sock *, struct sk_buff *, void *); + void *tx_data; +}; + +struct netlink_set_err_data { + struct sock *exclude_sk; + u32 portid; + u32 group; + int code; +}; + +struct nl_seq_iter { + struct seq_net_private p; + struct rhashtable_iter hti; + int link; +}; + +struct bpf_iter__netlink { + union { + struct bpf_iter_meta *meta; + }; + union { + struct netlink_sock *sk; + }; +}; + +enum { + CTRL_CMD_UNSPEC = 0, + CTRL_CMD_NEWFAMILY = 1, + CTRL_CMD_DELFAMILY = 2, + CTRL_CMD_GETFAMILY = 3, + CTRL_CMD_NEWOPS = 4, + CTRL_CMD_DELOPS = 5, + CTRL_CMD_GETOPS = 6, + CTRL_CMD_NEWMCAST_GRP = 7, + CTRL_CMD_DELMCAST_GRP = 8, + CTRL_CMD_GETMCAST_GRP = 9, + CTRL_CMD_GETPOLICY = 10, + __CTRL_CMD_MAX = 11, +}; + +enum { + CTRL_ATTR_UNSPEC = 0, + CTRL_ATTR_FAMILY_ID = 1, + CTRL_ATTR_FAMILY_NAME = 2, + CTRL_ATTR_VERSION = 3, + CTRL_ATTR_HDRSIZE = 4, + CTRL_ATTR_MAXATTR = 5, + CTRL_ATTR_OPS = 6, + CTRL_ATTR_MCAST_GROUPS = 7, + CTRL_ATTR_POLICY = 8, + CTRL_ATTR_OP_POLICY = 9, + CTRL_ATTR_OP = 10, + __CTRL_ATTR_MAX = 11, +}; + +enum { + CTRL_ATTR_OP_UNSPEC = 0, + CTRL_ATTR_OP_ID = 1, + CTRL_ATTR_OP_FLAGS = 2, + __CTRL_ATTR_OP_MAX = 3, +}; + +enum { + CTRL_ATTR_MCAST_GRP_UNSPEC = 0, + CTRL_ATTR_MCAST_GRP_NAME = 1, + CTRL_ATTR_MCAST_GRP_ID = 2, + __CTRL_ATTR_MCAST_GRP_MAX = 3, +}; + +enum { + CTRL_ATTR_POLICY_UNSPEC = 0, + CTRL_ATTR_POLICY_DO = 1, + CTRL_ATTR_POLICY_DUMP = 2, + __CTRL_ATTR_POLICY_DUMP_MAX = 3, + CTRL_ATTR_POLICY_DUMP_MAX = 2, +}; + +struct genl_start_context { + const struct genl_family *family; + struct nlmsghdr *nlh; + struct netlink_ext_ack *extack; + const struct genl_ops *ops; + int hdrlen; +}; + +struct netlink_policy_dump_state; + +struct ctrl_dump_policy_ctx { + struct netlink_policy_dump_state *state; + const struct genl_family *rt; + unsigned int opidx; + u32 op; + u16 fam_id; + u8 policies: 1; + u8 single_op: 1; +}; + +enum netlink_attribute_type { + NL_ATTR_TYPE_INVALID = 0, + NL_ATTR_TYPE_FLAG = 1, + NL_ATTR_TYPE_U8 = 2, + NL_ATTR_TYPE_U16 = 3, + NL_ATTR_TYPE_U32 = 4, + NL_ATTR_TYPE_U64 = 5, + NL_ATTR_TYPE_S8 = 6, + NL_ATTR_TYPE_S16 = 7, + NL_ATTR_TYPE_S32 = 8, + NL_ATTR_TYPE_S64 = 9, + NL_ATTR_TYPE_BINARY = 10, + NL_ATTR_TYPE_STRING = 11, + NL_ATTR_TYPE_NUL_STRING = 12, + NL_ATTR_TYPE_NESTED = 13, + NL_ATTR_TYPE_NESTED_ARRAY = 14, + NL_ATTR_TYPE_BITFIELD32 = 15, +}; + +enum netlink_policy_type_attr { + NL_POLICY_TYPE_ATTR_UNSPEC = 0, + NL_POLICY_TYPE_ATTR_TYPE = 1, + NL_POLICY_TYPE_ATTR_MIN_VALUE_S = 2, + NL_POLICY_TYPE_ATTR_MAX_VALUE_S = 3, + NL_POLICY_TYPE_ATTR_MIN_VALUE_U = 4, + NL_POLICY_TYPE_ATTR_MAX_VALUE_U = 5, + NL_POLICY_TYPE_ATTR_MIN_LENGTH = 6, + NL_POLICY_TYPE_ATTR_MAX_LENGTH = 7, + NL_POLICY_TYPE_ATTR_POLICY_IDX = 8, + NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE = 9, + NL_POLICY_TYPE_ATTR_BITFIELD32_MASK = 10, + NL_POLICY_TYPE_ATTR_PAD = 11, + NL_POLICY_TYPE_ATTR_MASK = 12, + __NL_POLICY_TYPE_ATTR_MAX = 13, + NL_POLICY_TYPE_ATTR_MAX = 12, +}; + +struct netlink_policy_dump_state___2 { + unsigned int policy_idx; + unsigned int attr_idx; + unsigned int n_alloc; + struct { + const struct nla_policy *policy; + unsigned int maxtype; + } policies[0]; +}; + +struct trace_event_raw_bpf_test_finish { + struct trace_entry ent; + int err; + char __data[0]; +}; + +struct trace_event_data_offsets_bpf_test_finish {}; + +typedef void (*btf_trace_bpf_test_finish)(void *, int *); + +struct bpf_fentry_test_t { + struct bpf_fentry_test_t *a; +}; + +struct bpf_raw_tp_test_run_info { + struct bpf_prog *prog; + void *ctx; + u32 retval; +}; + +struct ethtool_cmd { + __u32 cmd; + __u32 supported; + __u32 advertising; + __u16 speed; + __u8 duplex; + __u8 port; + __u8 phy_address; + __u8 transceiver; + __u8 autoneg; + __u8 mdio_support; + __u32 maxtxpkt; + __u32 maxrxpkt; + __u16 speed_hi; + __u8 eth_tp_mdix; + __u8 eth_tp_mdix_ctrl; + __u32 lp_advertising; + __u32 reserved[2]; +}; + +struct ethtool_value { + __u32 cmd; + __u32 data; +}; + +enum tunable_id { + ETHTOOL_ID_UNSPEC = 0, + ETHTOOL_RX_COPYBREAK = 1, + ETHTOOL_TX_COPYBREAK = 2, + ETHTOOL_PFC_PREVENTION_TOUT = 3, + __ETHTOOL_TUNABLE_COUNT = 4, +}; + +enum tunable_type_id { + ETHTOOL_TUNABLE_UNSPEC = 0, + ETHTOOL_TUNABLE_U8 = 1, + ETHTOOL_TUNABLE_U16 = 2, + ETHTOOL_TUNABLE_U32 = 3, + ETHTOOL_TUNABLE_U64 = 4, + ETHTOOL_TUNABLE_STRING = 5, + ETHTOOL_TUNABLE_S8 = 6, + ETHTOOL_TUNABLE_S16 = 7, + ETHTOOL_TUNABLE_S32 = 8, + ETHTOOL_TUNABLE_S64 = 9, +}; + +enum phy_tunable_id { + ETHTOOL_PHY_ID_UNSPEC = 0, + ETHTOOL_PHY_DOWNSHIFT = 1, + ETHTOOL_PHY_FAST_LINK_DOWN = 2, + ETHTOOL_PHY_EDPD = 3, + __ETHTOOL_PHY_TUNABLE_COUNT = 4, +}; + +enum ethtool_stringset { + ETH_SS_TEST = 0, + ETH_SS_STATS = 1, + ETH_SS_PRIV_FLAGS = 2, + ETH_SS_NTUPLE_FILTERS = 3, + ETH_SS_FEATURES = 4, + ETH_SS_RSS_HASH_FUNCS = 5, + ETH_SS_TUNABLES = 6, + ETH_SS_PHY_STATS = 7, + ETH_SS_PHY_TUNABLES = 8, + ETH_SS_LINK_MODES = 9, + ETH_SS_MSG_CLASSES = 10, + ETH_SS_WOL_MODES = 11, + ETH_SS_SOF_TIMESTAMPING = 12, + ETH_SS_TS_TX_TYPES = 13, + ETH_SS_TS_RX_FILTERS = 14, + ETH_SS_UDP_TUNNEL_TYPES = 15, + ETH_SS_COUNT = 16, +}; + +struct ethtool_gstrings { + __u32 cmd; + __u32 string_set; + __u32 len; + __u8 data[0]; +}; + +struct ethtool_sset_info { + __u32 cmd; + __u32 reserved; + __u64 sset_mask; + __u32 data[0]; +}; + +struct ethtool_perm_addr { + __u32 cmd; + __u32 size; + __u8 data[0]; +}; + +enum ethtool_flags { + ETH_FLAG_TXVLAN = 128, + ETH_FLAG_RXVLAN = 256, + ETH_FLAG_LRO = 32768, + ETH_FLAG_NTUPLE = 134217728, + ETH_FLAG_RXHASH = 268435456, +}; + +struct ethtool_rxfh { + __u32 cmd; + __u32 rss_context; + __u32 indir_size; + __u32 key_size; + __u8 hfunc; + __u8 rsvd8[3]; + __u32 rsvd32; + __u32 rss_config[0]; +}; + +struct ethtool_get_features_block { + __u32 available; + __u32 requested; + __u32 active; + __u32 never_changed; +}; + +struct ethtool_gfeatures { + __u32 cmd; + __u32 size; + struct ethtool_get_features_block features[0]; +}; + +struct ethtool_set_features_block { + __u32 valid; + __u32 requested; +}; + +struct ethtool_sfeatures { + __u32 cmd; + __u32 size; + struct ethtool_set_features_block features[0]; +}; + +enum ethtool_sfeatures_retval_bits { + ETHTOOL_F_UNSUPPORTED__BIT = 0, + ETHTOOL_F_WISH__BIT = 1, + ETHTOOL_F_COMPAT__BIT = 2, +}; + +struct ethtool_per_queue_op { + __u32 cmd; + __u32 sub_command; + __u32 queue_mask[128]; + char data[0]; +}; + +enum { + ETH_RSS_HASH_TOP_BIT = 0, + ETH_RSS_HASH_XOR_BIT = 1, + ETH_RSS_HASH_CRC32_BIT = 2, + ETH_RSS_HASH_FUNCS_COUNT = 3, +}; + +struct ethtool_rx_flow_rule { + struct flow_rule *rule; + long unsigned int priv[0]; +}; + +struct ethtool_rx_flow_spec_input { + const struct ethtool_rx_flow_spec *fs; + u32 rss_ctx; +}; + +struct ethtool_link_usettings { + struct ethtool_link_settings base; + struct { + __u32 supported[3]; + __u32 advertising[3]; + __u32 lp_advertising[3]; + } link_modes; +}; + +struct ethtool_rx_flow_key { + struct flow_dissector_key_basic basic; + union { + struct flow_dissector_key_ipv4_addrs ipv4; + struct flow_dissector_key_ipv6_addrs ipv6; + }; + struct flow_dissector_key_ports tp; + struct flow_dissector_key_ip ip; + struct flow_dissector_key_vlan vlan; + struct flow_dissector_key_eth_addrs eth_addrs; + long: 48; +}; + +struct ethtool_rx_flow_match { + struct flow_dissector dissector; + int: 32; + struct ethtool_rx_flow_key key; + struct ethtool_rx_flow_key mask; +}; + +enum { + ETHTOOL_UDP_TUNNEL_TYPE_VXLAN = 0, + ETHTOOL_UDP_TUNNEL_TYPE_GENEVE = 1, + ETHTOOL_UDP_TUNNEL_TYPE_VXLAN_GPE = 2, + __ETHTOOL_UDP_TUNNEL_TYPE_CNT = 3, +}; + +enum { + ETHTOOL_MSG_USER_NONE = 0, + ETHTOOL_MSG_STRSET_GET = 1, + ETHTOOL_MSG_LINKINFO_GET = 2, + ETHTOOL_MSG_LINKINFO_SET = 3, + ETHTOOL_MSG_LINKMODES_GET = 4, + ETHTOOL_MSG_LINKMODES_SET = 5, + ETHTOOL_MSG_LINKSTATE_GET = 6, + ETHTOOL_MSG_DEBUG_GET = 7, + ETHTOOL_MSG_DEBUG_SET = 8, + ETHTOOL_MSG_WOL_GET = 9, + ETHTOOL_MSG_WOL_SET = 10, + ETHTOOL_MSG_FEATURES_GET = 11, + ETHTOOL_MSG_FEATURES_SET = 12, + ETHTOOL_MSG_PRIVFLAGS_GET = 13, + ETHTOOL_MSG_PRIVFLAGS_SET = 14, + ETHTOOL_MSG_RINGS_GET = 15, + ETHTOOL_MSG_RINGS_SET = 16, + ETHTOOL_MSG_CHANNELS_GET = 17, + ETHTOOL_MSG_CHANNELS_SET = 18, + ETHTOOL_MSG_COALESCE_GET = 19, + ETHTOOL_MSG_COALESCE_SET = 20, + ETHTOOL_MSG_PAUSE_GET = 21, + ETHTOOL_MSG_PAUSE_SET = 22, + ETHTOOL_MSG_EEE_GET = 23, + ETHTOOL_MSG_EEE_SET = 24, + ETHTOOL_MSG_TSINFO_GET = 25, + ETHTOOL_MSG_CABLE_TEST_ACT = 26, + ETHTOOL_MSG_CABLE_TEST_TDR_ACT = 27, + ETHTOOL_MSG_TUNNEL_INFO_GET = 28, + __ETHTOOL_MSG_USER_CNT = 29, + ETHTOOL_MSG_USER_MAX = 28, +}; + +enum { + ETHTOOL_A_HEADER_UNSPEC = 0, + ETHTOOL_A_HEADER_DEV_INDEX = 1, + ETHTOOL_A_HEADER_DEV_NAME = 2, + ETHTOOL_A_HEADER_FLAGS = 3, + __ETHTOOL_A_HEADER_CNT = 4, + ETHTOOL_A_HEADER_MAX = 3, +}; + +enum { + ETHTOOL_A_STRSET_UNSPEC = 0, + ETHTOOL_A_STRSET_HEADER = 1, + ETHTOOL_A_STRSET_STRINGSETS = 2, + ETHTOOL_A_STRSET_COUNTS_ONLY = 3, + __ETHTOOL_A_STRSET_CNT = 4, + ETHTOOL_A_STRSET_MAX = 3, +}; + +enum { + ETHTOOL_A_LINKINFO_UNSPEC = 0, + ETHTOOL_A_LINKINFO_HEADER = 1, + ETHTOOL_A_LINKINFO_PORT = 2, + ETHTOOL_A_LINKINFO_PHYADDR = 3, + ETHTOOL_A_LINKINFO_TP_MDIX = 4, + ETHTOOL_A_LINKINFO_TP_MDIX_CTRL = 5, + ETHTOOL_A_LINKINFO_TRANSCEIVER = 6, + __ETHTOOL_A_LINKINFO_CNT = 7, + ETHTOOL_A_LINKINFO_MAX = 6, +}; + +enum { + ETHTOOL_A_LINKMODES_UNSPEC = 0, + ETHTOOL_A_LINKMODES_HEADER = 1, + ETHTOOL_A_LINKMODES_AUTONEG = 2, + ETHTOOL_A_LINKMODES_OURS = 3, + ETHTOOL_A_LINKMODES_PEER = 4, + ETHTOOL_A_LINKMODES_SPEED = 5, + ETHTOOL_A_LINKMODES_DUPLEX = 6, + ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG = 7, + ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE = 8, + __ETHTOOL_A_LINKMODES_CNT = 9, + ETHTOOL_A_LINKMODES_MAX = 8, +}; + +enum { + ETHTOOL_A_LINKSTATE_UNSPEC = 0, + ETHTOOL_A_LINKSTATE_HEADER = 1, + ETHTOOL_A_LINKSTATE_LINK = 2, + ETHTOOL_A_LINKSTATE_SQI = 3, + ETHTOOL_A_LINKSTATE_SQI_MAX = 4, + ETHTOOL_A_LINKSTATE_EXT_STATE = 5, + ETHTOOL_A_LINKSTATE_EXT_SUBSTATE = 6, + __ETHTOOL_A_LINKSTATE_CNT = 7, + ETHTOOL_A_LINKSTATE_MAX = 6, +}; + +enum { + ETHTOOL_A_DEBUG_UNSPEC = 0, + ETHTOOL_A_DEBUG_HEADER = 1, + ETHTOOL_A_DEBUG_MSGMASK = 2, + __ETHTOOL_A_DEBUG_CNT = 3, + ETHTOOL_A_DEBUG_MAX = 2, +}; + +enum { + ETHTOOL_A_WOL_UNSPEC = 0, + ETHTOOL_A_WOL_HEADER = 1, + ETHTOOL_A_WOL_MODES = 2, + ETHTOOL_A_WOL_SOPASS = 3, + __ETHTOOL_A_WOL_CNT = 4, + ETHTOOL_A_WOL_MAX = 3, +}; + +enum { + ETHTOOL_A_FEATURES_UNSPEC = 0, + ETHTOOL_A_FEATURES_HEADER = 1, + ETHTOOL_A_FEATURES_HW = 2, + ETHTOOL_A_FEATURES_WANTED = 3, + ETHTOOL_A_FEATURES_ACTIVE = 4, + ETHTOOL_A_FEATURES_NOCHANGE = 5, + __ETHTOOL_A_FEATURES_CNT = 6, + ETHTOOL_A_FEATURES_MAX = 5, +}; + +enum { + ETHTOOL_A_PRIVFLAGS_UNSPEC = 0, + ETHTOOL_A_PRIVFLAGS_HEADER = 1, + ETHTOOL_A_PRIVFLAGS_FLAGS = 2, + __ETHTOOL_A_PRIVFLAGS_CNT = 3, + ETHTOOL_A_PRIVFLAGS_MAX = 2, +}; + +enum { + ETHTOOL_A_RINGS_UNSPEC = 0, + ETHTOOL_A_RINGS_HEADER = 1, + ETHTOOL_A_RINGS_RX_MAX = 2, + ETHTOOL_A_RINGS_RX_MINI_MAX = 3, + ETHTOOL_A_RINGS_RX_JUMBO_MAX = 4, + ETHTOOL_A_RINGS_TX_MAX = 5, + ETHTOOL_A_RINGS_RX = 6, + ETHTOOL_A_RINGS_RX_MINI = 7, + ETHTOOL_A_RINGS_RX_JUMBO = 8, + ETHTOOL_A_RINGS_TX = 9, + __ETHTOOL_A_RINGS_CNT = 10, + ETHTOOL_A_RINGS_MAX = 9, +}; + +enum { + ETHTOOL_A_CHANNELS_UNSPEC = 0, + ETHTOOL_A_CHANNELS_HEADER = 1, + ETHTOOL_A_CHANNELS_RX_MAX = 2, + ETHTOOL_A_CHANNELS_TX_MAX = 3, + ETHTOOL_A_CHANNELS_OTHER_MAX = 4, + ETHTOOL_A_CHANNELS_COMBINED_MAX = 5, + ETHTOOL_A_CHANNELS_RX_COUNT = 6, + ETHTOOL_A_CHANNELS_TX_COUNT = 7, + ETHTOOL_A_CHANNELS_OTHER_COUNT = 8, + ETHTOOL_A_CHANNELS_COMBINED_COUNT = 9, + __ETHTOOL_A_CHANNELS_CNT = 10, + ETHTOOL_A_CHANNELS_MAX = 9, +}; + +enum { + ETHTOOL_A_COALESCE_UNSPEC = 0, + ETHTOOL_A_COALESCE_HEADER = 1, + ETHTOOL_A_COALESCE_RX_USECS = 2, + ETHTOOL_A_COALESCE_RX_MAX_FRAMES = 3, + ETHTOOL_A_COALESCE_RX_USECS_IRQ = 4, + ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ = 5, + ETHTOOL_A_COALESCE_TX_USECS = 6, + ETHTOOL_A_COALESCE_TX_MAX_FRAMES = 7, + ETHTOOL_A_COALESCE_TX_USECS_IRQ = 8, + ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ = 9, + ETHTOOL_A_COALESCE_STATS_BLOCK_USECS = 10, + ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX = 11, + ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX = 12, + ETHTOOL_A_COALESCE_PKT_RATE_LOW = 13, + ETHTOOL_A_COALESCE_RX_USECS_LOW = 14, + ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW = 15, + ETHTOOL_A_COALESCE_TX_USECS_LOW = 16, + ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW = 17, + ETHTOOL_A_COALESCE_PKT_RATE_HIGH = 18, + ETHTOOL_A_COALESCE_RX_USECS_HIGH = 19, + ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH = 20, + ETHTOOL_A_COALESCE_TX_USECS_HIGH = 21, + ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH = 22, + ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 23, + __ETHTOOL_A_COALESCE_CNT = 24, + ETHTOOL_A_COALESCE_MAX = 23, +}; + +enum { + ETHTOOL_A_PAUSE_UNSPEC = 0, + ETHTOOL_A_PAUSE_HEADER = 1, + ETHTOOL_A_PAUSE_AUTONEG = 2, + ETHTOOL_A_PAUSE_RX = 3, + ETHTOOL_A_PAUSE_TX = 4, + ETHTOOL_A_PAUSE_STATS = 5, + __ETHTOOL_A_PAUSE_CNT = 6, + ETHTOOL_A_PAUSE_MAX = 5, +}; + +enum { + ETHTOOL_A_EEE_UNSPEC = 0, + ETHTOOL_A_EEE_HEADER = 1, + ETHTOOL_A_EEE_MODES_OURS = 2, + ETHTOOL_A_EEE_MODES_PEER = 3, + ETHTOOL_A_EEE_ACTIVE = 4, + ETHTOOL_A_EEE_ENABLED = 5, + ETHTOOL_A_EEE_TX_LPI_ENABLED = 6, + ETHTOOL_A_EEE_TX_LPI_TIMER = 7, + __ETHTOOL_A_EEE_CNT = 8, + ETHTOOL_A_EEE_MAX = 7, +}; + +enum { + ETHTOOL_A_TSINFO_UNSPEC = 0, + ETHTOOL_A_TSINFO_HEADER = 1, + ETHTOOL_A_TSINFO_TIMESTAMPING = 2, + ETHTOOL_A_TSINFO_TX_TYPES = 3, + ETHTOOL_A_TSINFO_RX_FILTERS = 4, + ETHTOOL_A_TSINFO_PHC_INDEX = 5, + __ETHTOOL_A_TSINFO_CNT = 6, + ETHTOOL_A_TSINFO_MAX = 5, +}; + +enum { + ETHTOOL_A_CABLE_TEST_UNSPEC = 0, + ETHTOOL_A_CABLE_TEST_HEADER = 1, + __ETHTOOL_A_CABLE_TEST_CNT = 2, + ETHTOOL_A_CABLE_TEST_MAX = 1, +}; + +enum { + ETHTOOL_A_CABLE_TEST_TDR_UNSPEC = 0, + ETHTOOL_A_CABLE_TEST_TDR_HEADER = 1, + ETHTOOL_A_CABLE_TEST_TDR_CFG = 2, + __ETHTOOL_A_CABLE_TEST_TDR_CNT = 3, + ETHTOOL_A_CABLE_TEST_TDR_MAX = 2, +}; + +enum { + ETHTOOL_A_TUNNEL_INFO_UNSPEC = 0, + ETHTOOL_A_TUNNEL_INFO_HEADER = 1, + ETHTOOL_A_TUNNEL_INFO_UDP_PORTS = 2, + __ETHTOOL_A_TUNNEL_INFO_CNT = 3, + ETHTOOL_A_TUNNEL_INFO_MAX = 2, +}; + +enum ethtool_multicast_groups { + ETHNL_MCGRP_MONITOR = 0, +}; + +struct ethnl_req_info { + struct net_device *dev; + u32 flags; +}; + +struct ethnl_reply_data { + struct net_device *dev; +}; + +struct ethnl_request_ops { + u8 request_cmd; + u8 reply_cmd; + u16 hdr_attr; + unsigned int req_info_size; + unsigned int reply_data_size; + bool allow_nodev_do; + int (*parse_request)(struct ethnl_req_info *, struct nlattr **, struct netlink_ext_ack *); + int (*prepare_data)(const struct ethnl_req_info *, struct ethnl_reply_data *, struct genl_info *); + int (*reply_size)(const struct ethnl_req_info *, const struct ethnl_reply_data *); + int (*fill_reply)(struct sk_buff *, const struct ethnl_req_info *, const struct ethnl_reply_data *); + void (*cleanup_data)(struct ethnl_reply_data *); +}; + +struct ethnl_dump_ctx { + const struct ethnl_request_ops *ops; + struct ethnl_req_info *req_info; + struct ethnl_reply_data *reply_data; + int pos_hash; + int pos_idx; +}; + +typedef void (*ethnl_notify_handler_t)(struct net_device *, unsigned int, const void *); + +enum { + ETHTOOL_A_BITSET_BIT_UNSPEC = 0, + ETHTOOL_A_BITSET_BIT_INDEX = 1, + ETHTOOL_A_BITSET_BIT_NAME = 2, + ETHTOOL_A_BITSET_BIT_VALUE = 3, + __ETHTOOL_A_BITSET_BIT_CNT = 4, + ETHTOOL_A_BITSET_BIT_MAX = 3, +}; + +enum { + ETHTOOL_A_BITSET_BITS_UNSPEC = 0, + ETHTOOL_A_BITSET_BITS_BIT = 1, + __ETHTOOL_A_BITSET_BITS_CNT = 2, + ETHTOOL_A_BITSET_BITS_MAX = 1, +}; + +enum { + ETHTOOL_A_BITSET_UNSPEC = 0, + ETHTOOL_A_BITSET_NOMASK = 1, + ETHTOOL_A_BITSET_SIZE = 2, + ETHTOOL_A_BITSET_BITS = 3, + ETHTOOL_A_BITSET_VALUE = 4, + ETHTOOL_A_BITSET_MASK = 5, + __ETHTOOL_A_BITSET_CNT = 6, + ETHTOOL_A_BITSET_MAX = 5, +}; + +typedef const char (* const ethnl_string_array_t)[32]; + +enum { + ETHTOOL_A_STRING_UNSPEC = 0, + ETHTOOL_A_STRING_INDEX = 1, + ETHTOOL_A_STRING_VALUE = 2, + __ETHTOOL_A_STRING_CNT = 3, + ETHTOOL_A_STRING_MAX = 2, +}; + +enum { + ETHTOOL_A_STRINGS_UNSPEC = 0, + ETHTOOL_A_STRINGS_STRING = 1, + __ETHTOOL_A_STRINGS_CNT = 2, + ETHTOOL_A_STRINGS_MAX = 1, +}; + +enum { + ETHTOOL_A_STRINGSET_UNSPEC = 0, + ETHTOOL_A_STRINGSET_ID = 1, + ETHTOOL_A_STRINGSET_COUNT = 2, + ETHTOOL_A_STRINGSET_STRINGS = 3, + __ETHTOOL_A_STRINGSET_CNT = 4, + ETHTOOL_A_STRINGSET_MAX = 3, +}; + +enum { + ETHTOOL_A_STRINGSETS_UNSPEC = 0, + ETHTOOL_A_STRINGSETS_STRINGSET = 1, + __ETHTOOL_A_STRINGSETS_CNT = 2, + ETHTOOL_A_STRINGSETS_MAX = 1, +}; + +struct strset_info { + bool per_dev; + bool free_strings; + unsigned int count; + const char (*strings)[32]; +}; + +struct strset_req_info { + struct ethnl_req_info base; + u32 req_ids; + bool counts_only; +}; + +struct strset_reply_data { + struct ethnl_reply_data base; + struct strset_info sets[16]; +}; + +struct linkinfo_reply_data { + struct ethnl_reply_data base; + struct ethtool_link_ksettings ksettings; + struct ethtool_link_settings *lsettings; +}; + +struct linkmodes_reply_data { + struct ethnl_reply_data base; + struct ethtool_link_ksettings ksettings; + struct ethtool_link_settings *lsettings; + bool peer_empty; +}; + +struct link_mode_info { + int speed; + u8 duplex; +}; + +struct linkstate_reply_data { + struct ethnl_reply_data base; + int link; + int sqi; + int sqi_max; + bool link_ext_state_provided; + struct ethtool_link_ext_state_info ethtool_link_ext_state_info; +}; + +struct debug_reply_data { + struct ethnl_reply_data base; + u32 msg_mask; +}; + +struct wol_reply_data { + struct ethnl_reply_data base; + struct ethtool_wolinfo wol; + bool show_sopass; +}; + +struct features_reply_data { + struct ethnl_reply_data base; + u32 hw[2]; + u32 wanted[2]; + u32 active[2]; + u32 nochange[2]; + u32 all[2]; +}; + +struct privflags_reply_data { + struct ethnl_reply_data base; + const char (*priv_flag_names)[32]; + unsigned int n_priv_flags; + u32 priv_flags; +}; + +struct rings_reply_data { + struct ethnl_reply_data base; + struct ethtool_ringparam ringparam; +}; + +struct channels_reply_data { + struct ethnl_reply_data base; + struct ethtool_channels channels; +}; + +struct coalesce_reply_data { + struct ethnl_reply_data base; + struct ethtool_coalesce coalesce; + u32 supported_params; +}; + +enum { + ETHTOOL_A_PAUSE_STAT_UNSPEC = 0, + ETHTOOL_A_PAUSE_STAT_PAD = 1, + ETHTOOL_A_PAUSE_STAT_TX_FRAMES = 2, + ETHTOOL_A_PAUSE_STAT_RX_FRAMES = 3, + __ETHTOOL_A_PAUSE_STAT_CNT = 4, + ETHTOOL_A_PAUSE_STAT_MAX = 3, +}; + +struct pause_reply_data { + struct ethnl_reply_data base; + struct ethtool_pauseparam pauseparam; + struct ethtool_pause_stats pausestat; +}; + +struct eee_reply_data { + struct ethnl_reply_data base; + struct ethtool_eee eee; +}; + +struct tsinfo_reply_data { + struct ethnl_reply_data base; + struct ethtool_ts_info ts_info; +}; + +enum { + ETHTOOL_A_CABLE_PAIR_A = 0, + ETHTOOL_A_CABLE_PAIR_B = 1, + ETHTOOL_A_CABLE_PAIR_C = 2, + ETHTOOL_A_CABLE_PAIR_D = 3, +}; + +enum { + ETHTOOL_A_CABLE_RESULT_UNSPEC = 0, + ETHTOOL_A_CABLE_RESULT_PAIR = 1, + ETHTOOL_A_CABLE_RESULT_CODE = 2, + __ETHTOOL_A_CABLE_RESULT_CNT = 3, + ETHTOOL_A_CABLE_RESULT_MAX = 2, +}; + +enum { + ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC = 0, + ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 1, + ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 2, + __ETHTOOL_A_CABLE_FAULT_LENGTH_CNT = 3, + ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = 2, +}; + +enum { + ETHTOOL_A_CABLE_TEST_NTF_STATUS_UNSPEC = 0, + ETHTOOL_A_CABLE_TEST_NTF_STATUS_STARTED = 1, + ETHTOOL_A_CABLE_TEST_NTF_STATUS_COMPLETED = 2, +}; + +enum { + ETHTOOL_A_CABLE_NEST_UNSPEC = 0, + ETHTOOL_A_CABLE_NEST_RESULT = 1, + ETHTOOL_A_CABLE_NEST_FAULT_LENGTH = 2, + __ETHTOOL_A_CABLE_NEST_CNT = 3, + ETHTOOL_A_CABLE_NEST_MAX = 2, +}; + +enum { + ETHTOOL_A_CABLE_TEST_NTF_UNSPEC = 0, + ETHTOOL_A_CABLE_TEST_NTF_HEADER = 1, + ETHTOOL_A_CABLE_TEST_NTF_STATUS = 2, + ETHTOOL_A_CABLE_TEST_NTF_NEST = 3, + __ETHTOOL_A_CABLE_TEST_NTF_CNT = 4, + ETHTOOL_A_CABLE_TEST_NTF_MAX = 3, +}; + +enum { + ETHTOOL_A_CABLE_TEST_TDR_CFG_UNSPEC = 0, + ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST = 1, + ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST = 2, + ETHTOOL_A_CABLE_TEST_TDR_CFG_STEP = 3, + ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR = 4, + __ETHTOOL_A_CABLE_TEST_TDR_CFG_CNT = 5, + ETHTOOL_A_CABLE_TEST_TDR_CFG_MAX = 4, +}; + +enum { + ETHTOOL_A_CABLE_AMPLITUDE_UNSPEC = 0, + ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 1, + ETHTOOL_A_CABLE_AMPLITUDE_mV = 2, + __ETHTOOL_A_CABLE_AMPLITUDE_CNT = 3, + ETHTOOL_A_CABLE_AMPLITUDE_MAX = 2, +}; + +enum { + ETHTOOL_A_CABLE_PULSE_UNSPEC = 0, + ETHTOOL_A_CABLE_PULSE_mV = 1, + __ETHTOOL_A_CABLE_PULSE_CNT = 2, + ETHTOOL_A_CABLE_PULSE_MAX = 1, +}; + +enum { + ETHTOOL_A_CABLE_STEP_UNSPEC = 0, + ETHTOOL_A_CABLE_STEP_FIRST_DISTANCE = 1, + ETHTOOL_A_CABLE_STEP_LAST_DISTANCE = 2, + ETHTOOL_A_CABLE_STEP_STEP_DISTANCE = 3, + __ETHTOOL_A_CABLE_STEP_CNT = 4, + ETHTOOL_A_CABLE_STEP_MAX = 3, +}; + +enum { + ETHTOOL_A_CABLE_TDR_NEST_UNSPEC = 0, + ETHTOOL_A_CABLE_TDR_NEST_STEP = 1, + ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE = 2, + ETHTOOL_A_CABLE_TDR_NEST_PULSE = 3, + __ETHTOOL_A_CABLE_TDR_NEST_CNT = 4, + ETHTOOL_A_CABLE_TDR_NEST_MAX = 3, +}; + +enum { + ETHTOOL_A_TUNNEL_UDP_ENTRY_UNSPEC = 0, + ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT = 1, + ETHTOOL_A_TUNNEL_UDP_ENTRY_TYPE = 2, + __ETHTOOL_A_TUNNEL_UDP_ENTRY_CNT = 3, + ETHTOOL_A_TUNNEL_UDP_ENTRY_MAX = 2, +}; + +enum { + ETHTOOL_A_TUNNEL_UDP_TABLE_UNSPEC = 0, + ETHTOOL_A_TUNNEL_UDP_TABLE_SIZE = 1, + ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES = 2, + ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY = 3, + __ETHTOOL_A_TUNNEL_UDP_TABLE_CNT = 4, + ETHTOOL_A_TUNNEL_UDP_TABLE_MAX = 3, +}; + +enum { + ETHTOOL_A_TUNNEL_UDP_UNSPEC = 0, + ETHTOOL_A_TUNNEL_UDP_TABLE = 1, + __ETHTOOL_A_TUNNEL_UDP_CNT = 2, + ETHTOOL_A_TUNNEL_UDP_MAX = 1, +}; + +enum udp_parsable_tunnel_type { + UDP_TUNNEL_TYPE_VXLAN = 1, + UDP_TUNNEL_TYPE_GENEVE = 2, + UDP_TUNNEL_TYPE_VXLAN_GPE = 4, +}; + +enum udp_tunnel_nic_info_flags { + UDP_TUNNEL_NIC_INFO_MAY_SLEEP = 1, + UDP_TUNNEL_NIC_INFO_OPEN_ONLY = 2, + UDP_TUNNEL_NIC_INFO_IPV4_ONLY = 4, + UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN = 8, +}; + +struct udp_tunnel_nic_ops { + void (*get_port)(struct net_device *, unsigned int, unsigned int, struct udp_tunnel_info *); + void (*set_port_priv)(struct net_device *, unsigned int, unsigned int, u8); + void (*add_port)(struct net_device *, struct udp_tunnel_info *); + void (*del_port)(struct net_device *, struct udp_tunnel_info *); + void (*reset_ntf)(struct net_device *); + size_t (*dump_size)(struct net_device *, unsigned int); + int (*dump_write)(struct net_device *, unsigned int, struct sk_buff *); +}; + +struct ethnl_tunnel_info_dump_ctx { + struct ethnl_req_info req_info; + int pos_hash; + int pos_idx; +}; + +struct nf_hook_entries_rcu_head { + struct callback_head head; + void *allocation; +}; + +struct nf_conn___2; + +enum nf_nat_manip_type; + +struct nf_nat_hook { + int (*parse_nat_setup)(struct nf_conn___2 *, enum nf_nat_manip_type, const struct nlattr *); + void (*decode_session)(struct sk_buff *, struct flowi *); + unsigned int (*manip_pkt)(struct sk_buff *, struct nf_conn___2 *, enum nf_nat_manip_type, enum ip_conntrack_dir); +}; + +struct nf_conntrack_tuple___2; + +struct nf_ct_hook { + int (*update)(struct net *, struct sk_buff *); + void (*destroy)(struct nf_conntrack *); + bool (*get_tuple_skb)(struct nf_conntrack_tuple___2 *, const struct sk_buff *); +}; + +struct nfnl_ct_hook { + struct nf_conn___2 * (*get_ct)(const struct sk_buff *, enum ip_conntrack_info *); + size_t (*build_size)(const struct nf_conn___2 *); + int (*build)(struct sk_buff *, struct nf_conn___2 *, enum ip_conntrack_info, u_int16_t, u_int16_t); + int (*parse)(const struct nlattr *, struct nf_conn___2 *); + int (*attach_expect)(const struct nlattr *, struct nf_conn___2 *, u32, u32); + void (*seq_adjust)(struct sk_buff *, struct nf_conn___2 *, enum ip_conntrack_info, s32); +}; + +struct nf_ipv6_ops { + void (*route_input)(struct sk_buff *); + int (*fragment)(struct net *, struct sock *, struct sk_buff *, int (*)(struct net *, struct sock *, struct sk_buff *)); + int (*reroute)(struct sk_buff *, const struct nf_queue_entry *); +}; + +struct nf_queue_entry { + struct list_head list; + struct sk_buff *skb; + unsigned int id; + unsigned int hook_index; + struct net_device *physin; + struct net_device *physout; + struct nf_hook_state state; + u16 size; +}; + +struct nf_loginfo { + u_int8_t type; + union { + struct { + u_int32_t copy_len; + u_int16_t group; + u_int16_t qthreshold; + u_int16_t flags; + } ulog; + struct { + u_int8_t level; + u_int8_t logflags; + } log; + } u; +}; + +struct nf_log_buf { + unsigned int count; + char buf[1020]; +}; + +struct nf_bridge_info { + enum { + BRNF_PROTO_UNCHANGED = 0, + BRNF_PROTO_8021Q = 1, + BRNF_PROTO_PPPOE = 2, + } orig_proto: 8; + u8 pkt_otherhost: 1; + u8 in_prerouting: 1; + u8 bridged_dnat: 1; + __u16 frag_max_size; + struct net_device *physindev; + struct net_device *physoutdev; + union { + __be32 ipv4_daddr; + struct in6_addr ipv6_daddr; + char neigh_header[8]; + }; +}; + +struct ip_rt_info { + __be32 daddr; + __be32 saddr; + u_int8_t tos; + u_int32_t mark; +}; + +struct ip6_rt_info { + struct in6_addr daddr; + struct in6_addr saddr; + u_int32_t mark; +}; + +struct nf_sockopt_ops { + struct list_head list; + u_int8_t pf; + int set_optmin; + int set_optmax; + int (*set)(struct sock *, int, sockptr_t, unsigned int); + int get_optmin; + int get_optmax; + int (*get)(struct sock *, int, void *, int *); + struct module *owner; +}; + +struct xt_action_param; + +struct xt_mtchk_param; + +struct xt_mtdtor_param; + +struct xt_match { + struct list_head list; + const char name[29]; + u_int8_t revision; + bool (*match)(const struct sk_buff *, struct xt_action_param *); + int (*checkentry)(const struct xt_mtchk_param *); + void (*destroy)(const struct xt_mtdtor_param *); + void (*compat_from_user)(void *, const void *); + int (*compat_to_user)(void *, const void *); + struct module *me; + const char *table; + unsigned int matchsize; + unsigned int usersize; + unsigned int compatsize; + unsigned int hooks; + short unsigned int proto; + short unsigned int family; +}; + +struct xt_entry_match { + union { + struct { + __u16 match_size; + char name[29]; + __u8 revision; + } user; + struct { + __u16 match_size; + struct xt_match *match; + } kernel; + __u16 match_size; + } u; + unsigned char data[0]; +}; + +struct xt_tgchk_param; + +struct xt_tgdtor_param; + +struct xt_target { + struct list_head list; + const char name[29]; + u_int8_t revision; + unsigned int (*target)(struct sk_buff *, const struct xt_action_param *); + int (*checkentry)(const struct xt_tgchk_param *); + void (*destroy)(const struct xt_tgdtor_param *); + void (*compat_from_user)(void *, const void *); + int (*compat_to_user)(void *, const void *); + struct module *me; + const char *table; + unsigned int targetsize; + unsigned int usersize; + unsigned int compatsize; + unsigned int hooks; + short unsigned int proto; + short unsigned int family; +}; + +struct xt_entry_target { + union { + struct { + __u16 target_size; + char name[29]; + __u8 revision; + } user; + struct { + __u16 target_size; + struct xt_target *target; + } kernel; + __u16 target_size; + } u; + unsigned char data[0]; +}; + +struct xt_standard_target { + struct xt_entry_target target; + int verdict; +}; + +struct xt_error_target { + struct xt_entry_target target; + char errorname[30]; +}; + +struct xt_counters { + __u64 pcnt; + __u64 bcnt; +}; + +struct xt_counters_info { + char name[32]; + unsigned int num_counters; + struct xt_counters counters[0]; +}; + +struct xt_action_param { + union { + const struct xt_match *match; + const struct xt_target *target; + }; + union { + const void *matchinfo; + const void *targinfo; + }; + const struct nf_hook_state *state; + int fragoff; + unsigned int thoff; + bool hotdrop; +}; + +struct xt_mtchk_param { + struct net *net; + const char *table; + const void *entryinfo; + const struct xt_match *match; + void *matchinfo; + unsigned int hook_mask; + u_int8_t family; + bool nft_compat; +}; + +struct xt_mtdtor_param { + struct net *net; + const struct xt_match *match; + void *matchinfo; + u_int8_t family; +}; + +struct xt_tgchk_param { + struct net *net; + const char *table; + const void *entryinfo; + const struct xt_target *target; + void *targinfo; + unsigned int hook_mask; + u_int8_t family; + bool nft_compat; +}; + +struct xt_tgdtor_param { + struct net *net; + const struct xt_target *target; + void *targinfo; + u_int8_t family; +}; + +struct xt_percpu_counter_alloc_state { + unsigned int off; + const char *mem; +}; + +struct compat_xt_entry_match { + union { + struct { + u_int16_t match_size; + char name[29]; + u_int8_t revision; + } user; + struct { + u_int16_t match_size; + compat_uptr_t match; + } kernel; + u_int16_t match_size; + } u; + unsigned char data[0]; +}; + +struct compat_xt_entry_target { + union { + struct { + u_int16_t target_size; + char name[29]; + u_int8_t revision; + } user; + struct { + u_int16_t target_size; + compat_uptr_t target; + } kernel; + u_int16_t target_size; + } u; + unsigned char data[0]; +}; + +struct compat_xt_counters { + compat_u64 pcnt; + compat_u64 bcnt; +}; + +struct compat_xt_counters_info { + char name[32]; + compat_uint_t num_counters; + struct compat_xt_counters counters[0]; +} __attribute__((packed)); + +struct compat_delta { + unsigned int offset; + int delta; +}; + +struct xt_af { + struct mutex mutex; + struct list_head match; + struct list_head target; + struct mutex compat_mutex; + struct compat_delta *compat_tab; + unsigned int number; + unsigned int cur; +}; + +struct compat_xt_standard_target { + struct compat_xt_entry_target t; + compat_uint_t verdict; +}; + +struct compat_xt_error_target { + struct compat_xt_entry_target t; + char errorname[30]; +}; + +struct nf_mttg_trav { + struct list_head *head; + struct list_head *curr; + uint8_t class; +}; + +enum { + MTTG_TRAV_INIT = 0, + MTTG_TRAV_NFP_UNSPEC = 1, + MTTG_TRAV_NFP_SPEC = 2, + MTTG_TRAV_DONE = 3, +}; + +struct xt_tcp { + __u16 spts[2]; + __u16 dpts[2]; + __u8 option; + __u8 flg_mask; + __u8 flg_cmp; + __u8 invflags; +}; + +struct xt_udp { + __u16 spts[2]; + __u16 dpts[2]; + __u8 invflags; +}; + +struct ip_mreqn { + struct in_addr imr_multiaddr; + struct in_addr imr_address; + int imr_ifindex; +}; + +struct rtmsg { + unsigned char rtm_family; + unsigned char rtm_dst_len; + unsigned char rtm_src_len; + unsigned char rtm_tos; + unsigned char rtm_table; + unsigned char rtm_protocol; + unsigned char rtm_scope; + unsigned char rtm_type; + unsigned int rtm_flags; +}; + +struct rtvia { + __kernel_sa_family_t rtvia_family; + __u8 rtvia_addr[0]; +}; + +struct ip_sf_list; + +struct ip_mc_list { + struct in_device *interface; + __be32 multiaddr; + unsigned int sfmode; + struct ip_sf_list *sources; + struct ip_sf_list *tomb; + long unsigned int sfcount[2]; + union { + struct ip_mc_list *next; + struct ip_mc_list *next_rcu; + }; + struct ip_mc_list *next_hash; + struct timer_list timer; + int users; + refcount_t refcnt; + spinlock_t lock; + char tm_running; + char reporter; + char unsolicit_count; + char loaded; + unsigned char gsquery; + unsigned char crcount; + struct callback_head rcu; +}; + +struct ip_sf_socklist { + unsigned int sl_max; + unsigned int sl_count; + struct callback_head rcu; + __be32 sl_addr[0]; +}; + +struct ip_mc_socklist { + struct ip_mc_socklist *next_rcu; + struct ip_mreqn multi; + unsigned int sfmode; + struct ip_sf_socklist *sflist; + struct callback_head rcu; +}; + +struct ip_sf_list { + struct ip_sf_list *sf_next; + long unsigned int sf_count[2]; + __be32 sf_inaddr; + unsigned char sf_gsresp; + unsigned char sf_oldin; + unsigned char sf_crcount; +}; + +struct ipv4_addr_key { + __be32 addr; + int vif; +}; + +struct inetpeer_addr { + union { + struct ipv4_addr_key a4; + struct in6_addr a6; + u32 key[4]; + }; + __u16 family; +}; + +struct inet_peer { + struct rb_node rb_node; + struct inetpeer_addr daddr; + u32 metrics[17]; + u32 rate_tokens; + u32 n_redirects; + long unsigned int rate_last; + union { + struct { + atomic_t rid; + }; + struct callback_head rcu; + }; + __u32 dtime; + refcount_t refcnt; +}; + +struct fib_rt_info { + struct fib_info *fi; + u32 tb_id; + __be32 dst; + int dst_len; + u8 tos; + u8 type; + u8 offload: 1; + u8 trap: 1; + u8 unused: 6; +}; + +struct uncached_list { + spinlock_t lock; + struct list_head head; +}; + +struct ip_rt_acct { + __u32 o_bytes; + __u32 o_packets; + __u32 i_bytes; + __u32 i_packets; +}; + +struct rt_cache_stat { + unsigned int in_slow_tot; + unsigned int in_slow_mc; + unsigned int in_no_route; + unsigned int in_brd; + unsigned int in_martian_dst; + unsigned int in_martian_src; + unsigned int out_slow_tot; + unsigned int out_slow_mc; +}; + +struct fib_alias { + struct hlist_node fa_list; + struct fib_info *fa_info; + u8 fa_tos; + u8 fa_type; + u8 fa_state; + u8 fa_slen; + u32 tb_id; + s16 fa_default; + u8 offload: 1; + u8 trap: 1; + u8 unused: 6; + struct callback_head rcu; +}; + +struct fib_prop { + int error; + u8 scope; +}; + +struct net_offload { + struct offload_callbacks callbacks; + unsigned int flags; +}; + +struct raw_hashinfo { + rwlock_t lock; + struct hlist_head ht[256]; +}; + +enum ip_defrag_users { + IP_DEFRAG_LOCAL_DELIVER = 0, + IP_DEFRAG_CALL_RA_CHAIN = 1, + IP_DEFRAG_CONNTRACK_IN = 2, + __IP_DEFRAG_CONNTRACK_IN_END = 65537, + IP_DEFRAG_CONNTRACK_OUT = 65538, + __IP_DEFRAG_CONNTRACK_OUT_END = 131073, + IP_DEFRAG_CONNTRACK_BRIDGE_IN = 131074, + __IP_DEFRAG_CONNTRACK_BRIDGE_IN = 196609, + IP_DEFRAG_VS_IN = 196610, + IP_DEFRAG_VS_OUT = 196611, + IP_DEFRAG_VS_FWD = 196612, + IP_DEFRAG_AF_PACKET = 196613, + IP_DEFRAG_MACVLAN = 196614, +}; + +enum { + INET_FRAG_FIRST_IN = 1, + INET_FRAG_LAST_IN = 2, + INET_FRAG_COMPLETE = 4, + INET_FRAG_HASH_DEAD = 8, +}; + +struct ipq { + struct inet_frag_queue q; + u8 ecn; + u16 max_df_size; + int iif; + unsigned int rid; + struct inet_peer *peer; +}; + +struct ip_options_data { + struct ip_options_rcu opt; + char data[40]; +}; + +struct ipcm_cookie { + struct sockcm_cookie sockc; + __be32 addr; + int oif; + struct ip_options_rcu *opt; + __u8 ttl; + __s16 tos; + char priority; + __u16 gso_size; +}; + +struct ip_fraglist_iter { + struct sk_buff *frag; + struct iphdr *iph; + int offset; + unsigned int hlen; +}; + +struct ip_frag_state { + bool DF; + unsigned int hlen; + unsigned int ll_rs; + unsigned int mtu; + unsigned int left; + int offset; + int ptr; + __be16 not_last_frag; +}; + +struct ip_reply_arg { + struct kvec iov[1]; + int flags; + __wsum csum; + int csumoffset; + int bound_dev_if; + u8 tos; + kuid_t uid; +}; + +struct ip_mreq_source { + __be32 imr_multiaddr; + __be32 imr_interface; + __be32 imr_sourceaddr; +}; + +struct ip_msfilter { + __be32 imsf_multiaddr; + __be32 imsf_interface; + __u32 imsf_fmode; + __u32 imsf_numsrc; + __be32 imsf_slist[1]; +}; + +struct group_req { + __u32 gr_interface; + struct __kernel_sockaddr_storage gr_group; +}; + +struct group_source_req { + __u32 gsr_interface; + struct __kernel_sockaddr_storage gsr_group; + struct __kernel_sockaddr_storage gsr_source; +}; + +struct group_filter { + __u32 gf_interface; + struct __kernel_sockaddr_storage gf_group; + __u32 gf_fmode; + __u32 gf_numsrc; + struct __kernel_sockaddr_storage gf_slist[1]; +}; + +struct in_pktinfo { + int ipi_ifindex; + struct in_addr ipi_spec_dst; + struct in_addr ipi_addr; +}; + +struct compat_group_req { + __u32 gr_interface; + struct __kernel_sockaddr_storage gr_group; +} __attribute__((packed)); + +struct compat_group_source_req { + __u32 gsr_interface; + struct __kernel_sockaddr_storage gsr_group; + struct __kernel_sockaddr_storage gsr_source; +} __attribute__((packed)); + +struct compat_group_filter { + __u32 gf_interface; + struct __kernel_sockaddr_storage gf_group; + __u32 gf_fmode; + __u32 gf_numsrc; + struct __kernel_sockaddr_storage gf_slist[1]; +} __attribute__((packed)); + +struct tcpvegas_info { + __u32 tcpv_enabled; + __u32 tcpv_rttcnt; + __u32 tcpv_rtt; + __u32 tcpv_minrtt; +}; + +struct tcp_dctcp_info { + __u16 dctcp_enabled; + __u16 dctcp_ce_state; + __u32 dctcp_alpha; + __u32 dctcp_ab_ecn; + __u32 dctcp_ab_tot; +}; + +struct tcp_bbr_info { + __u32 bbr_bw_lo; + __u32 bbr_bw_hi; + __u32 bbr_min_rtt; + __u32 bbr_pacing_gain; + __u32 bbr_cwnd_gain; +}; + +union tcp_cc_info { + struct tcpvegas_info vegas; + struct tcp_dctcp_info dctcp; + struct tcp_bbr_info bbr; +}; + +enum { + BPF_TCP_ESTABLISHED = 1, + BPF_TCP_SYN_SENT = 2, + BPF_TCP_SYN_RECV = 3, + BPF_TCP_FIN_WAIT1 = 4, + BPF_TCP_FIN_WAIT2 = 5, + BPF_TCP_TIME_WAIT = 6, + BPF_TCP_CLOSE = 7, + BPF_TCP_CLOSE_WAIT = 8, + BPF_TCP_LAST_ACK = 9, + BPF_TCP_LISTEN = 10, + BPF_TCP_CLOSING = 11, + BPF_TCP_NEW_SYN_RECV = 12, + BPF_TCP_MAX_STATES = 13, +}; + +enum inet_csk_ack_state_t { + ICSK_ACK_SCHED = 1, + ICSK_ACK_TIMER = 2, + ICSK_ACK_PUSHED = 4, + ICSK_ACK_PUSHED2 = 8, + ICSK_ACK_NOW = 16, +}; + +enum { + TCP_FLAG_CWR = 32768, + TCP_FLAG_ECE = 16384, + TCP_FLAG_URG = 8192, + TCP_FLAG_ACK = 4096, + TCP_FLAG_PSH = 2048, + TCP_FLAG_RST = 1024, + TCP_FLAG_SYN = 512, + TCP_FLAG_FIN = 256, + TCP_RESERVED_BITS = 15, + TCP_DATA_OFFSET = 240, +}; + +struct tcp_repair_opt { + __u32 opt_code; + __u32 opt_val; +}; + +struct tcp_repair_window { + __u32 snd_wl1; + __u32 snd_wnd; + __u32 max_window; + __u32 rcv_wnd; + __u32 rcv_wup; +}; + +enum { + TCP_NO_QUEUE = 0, + TCP_RECV_QUEUE = 1, + TCP_SEND_QUEUE = 2, + TCP_QUEUES_NR = 3, +}; + +struct tcp_info { + __u8 tcpi_state; + __u8 tcpi_ca_state; + __u8 tcpi_retransmits; + __u8 tcpi_probes; + __u8 tcpi_backoff; + __u8 tcpi_options; + __u8 tcpi_snd_wscale: 4; + __u8 tcpi_rcv_wscale: 4; + __u8 tcpi_delivery_rate_app_limited: 1; + __u8 tcpi_fastopen_client_fail: 2; + __u32 tcpi_rto; + __u32 tcpi_ato; + __u32 tcpi_snd_mss; + __u32 tcpi_rcv_mss; + __u32 tcpi_unacked; + __u32 tcpi_sacked; + __u32 tcpi_lost; + __u32 tcpi_retrans; + __u32 tcpi_fackets; + __u32 tcpi_last_data_sent; + __u32 tcpi_last_ack_sent; + __u32 tcpi_last_data_recv; + __u32 tcpi_last_ack_recv; + __u32 tcpi_pmtu; + __u32 tcpi_rcv_ssthresh; + __u32 tcpi_rtt; + __u32 tcpi_rttvar; + __u32 tcpi_snd_ssthresh; + __u32 tcpi_snd_cwnd; + __u32 tcpi_advmss; + __u32 tcpi_reordering; + __u32 tcpi_rcv_rtt; + __u32 tcpi_rcv_space; + __u32 tcpi_total_retrans; + __u64 tcpi_pacing_rate; + __u64 tcpi_max_pacing_rate; + __u64 tcpi_bytes_acked; + __u64 tcpi_bytes_received; + __u32 tcpi_segs_out; + __u32 tcpi_segs_in; + __u32 tcpi_notsent_bytes; + __u32 tcpi_min_rtt; + __u32 tcpi_data_segs_in; + __u32 tcpi_data_segs_out; + __u64 tcpi_delivery_rate; + __u64 tcpi_busy_time; + __u64 tcpi_rwnd_limited; + __u64 tcpi_sndbuf_limited; + __u32 tcpi_delivered; + __u32 tcpi_delivered_ce; + __u64 tcpi_bytes_sent; + __u64 tcpi_bytes_retrans; + __u32 tcpi_dsack_dups; + __u32 tcpi_reord_seen; + __u32 tcpi_rcv_ooopack; + __u32 tcpi_snd_wnd; +}; + +enum { + TCP_NLA_PAD = 0, + TCP_NLA_BUSY = 1, + TCP_NLA_RWND_LIMITED = 2, + TCP_NLA_SNDBUF_LIMITED = 3, + TCP_NLA_DATA_SEGS_OUT = 4, + TCP_NLA_TOTAL_RETRANS = 5, + TCP_NLA_PACING_RATE = 6, + TCP_NLA_DELIVERY_RATE = 7, + TCP_NLA_SND_CWND = 8, + TCP_NLA_REORDERING = 9, + TCP_NLA_MIN_RTT = 10, + TCP_NLA_RECUR_RETRANS = 11, + TCP_NLA_DELIVERY_RATE_APP_LMT = 12, + TCP_NLA_SNDQ_SIZE = 13, + TCP_NLA_CA_STATE = 14, + TCP_NLA_SND_SSTHRESH = 15, + TCP_NLA_DELIVERED = 16, + TCP_NLA_DELIVERED_CE = 17, + TCP_NLA_BYTES_SENT = 18, + TCP_NLA_BYTES_RETRANS = 19, + TCP_NLA_DSACK_DUPS = 20, + TCP_NLA_REORD_SEEN = 21, + TCP_NLA_SRTT = 22, + TCP_NLA_TIMEOUT_REHASH = 23, + TCP_NLA_BYTES_NOTSENT = 24, + TCP_NLA_EDT = 25, +}; + +struct tcp_zerocopy_receive { + __u64 address; + __u32 length; + __u32 recv_skip_hint; + __u32 inq; + __s32 err; + __u64 copybuf_address; + __s32 copybuf_len; + __u32 flags; +}; + +struct tcp_md5sig_pool { + struct ahash_request *md5_req; + void *scratch; +}; + +enum tcp_chrono { + TCP_CHRONO_UNSPEC = 0, + TCP_CHRONO_BUSY = 1, + TCP_CHRONO_RWND_LIMITED = 2, + TCP_CHRONO_SNDBUF_LIMITED = 3, + __TCP_CHRONO_MAX = 4, +}; + +struct tcp_splice_state { + struct pipe_inode_info *pipe; + size_t len; + unsigned int flags; +}; + +enum tcp_fastopen_client_fail { + TFO_STATUS_UNSPEC = 0, + TFO_COOKIE_UNAVAILABLE = 1, + TFO_DATA_NOT_ACKED = 2, + TFO_SYN_RETRANSMITTED = 3, +}; + +struct tcp_sack_block_wire { + __be32 start_seq; + __be32 end_seq; +}; + +struct static_key_false_deferred { + struct static_key_false key; + long unsigned int timeout; + struct delayed_work work; +}; + +struct mptcp_ext { + union { + u64 data_ack; + u32 data_ack32; + }; + u64 data_seq; + u32 subflow_seq; + u16 data_len; + u8 use_map: 1; + u8 dsn64: 1; + u8 data_fin: 1; + u8 use_ack: 1; + u8 ack64: 1; + u8 mpc_map: 1; + u8 frozen: 1; + u8 __unused: 1; +}; + +enum tcp_queue { + TCP_FRAG_IN_WRITE_QUEUE = 0, + TCP_FRAG_IN_RTX_QUEUE = 1, +}; + +enum tcp_ca_ack_event_flags { + CA_ACK_SLOWPATH = 1, + CA_ACK_WIN_UPDATE = 2, + CA_ACK_ECE = 4, +}; + +struct tcp_sacktag_state { + u64 first_sackt; + u64 last_sackt; + u32 reord; + u32 sack_delivered; + int flag; + unsigned int mss_now; + struct rate_sample *rate; +}; + +enum pkt_hash_types { + PKT_HASH_TYPE_NONE = 0, + PKT_HASH_TYPE_L2 = 1, + PKT_HASH_TYPE_L3 = 2, + PKT_HASH_TYPE_L4 = 3, +}; + +enum { + BPF_WRITE_HDR_TCP_CURRENT_MSS = 1, + BPF_WRITE_HDR_TCP_SYNACK_COOKIE = 2, +}; + +enum tsq_flags { + TSQF_THROTTLED = 1, + TSQF_QUEUED = 2, + TCPF_TSQ_DEFERRED = 4, + TCPF_WRITE_TIMER_DEFERRED = 8, + TCPF_DELACK_TIMER_DEFERRED = 16, + TCPF_MTU_REDUCED_DEFERRED = 32, +}; + +struct mptcp_out_options { + u16 suboptions; + u64 sndr_key; + u64 rcvr_key; + union { + struct in_addr addr; + struct in6_addr addr6; + }; + u8 addr_id; + u16 port; + u64 ahmac; + u8 rm_id; + u8 join_id; + u8 backup; + u32 nonce; + u64 thmac; + u32 token; + u8 hmac[20]; + struct mptcp_ext ext_copy; +}; + +struct tcp_out_options { + u16 options; + u16 mss; + u8 ws; + u8 num_sack_blocks; + u8 hash_size; + u8 bpf_opt_len; + __u8 *hash_location; + __u32 tsval; + __u32 tsecr; + struct tcp_fastopen_cookie *fastopen_cookie; + struct mptcp_out_options mptcp; +}; + +struct tsq_tasklet { + struct tasklet_struct tasklet; + struct list_head head; +}; + +struct tcp_md5sig { + struct __kernel_sockaddr_storage tcpm_addr; + __u8 tcpm_flags; + __u8 tcpm_prefixlen; + __u16 tcpm_keylen; + int tcpm_ifindex; + __u8 tcpm_key[80]; +}; + +struct icmp_err { + int errno; + unsigned int fatal: 1; +}; + +enum tcp_tw_status { + TCP_TW_SUCCESS = 0, + TCP_TW_RST = 1, + TCP_TW_ACK = 2, + TCP_TW_SYN = 3, +}; + +struct tcp4_pseudohdr { + __be32 saddr; + __be32 daddr; + __u8 pad; + __u8 protocol; + __be16 len; +}; + +enum tcp_seq_states { + TCP_SEQ_STATE_LISTENING = 0, + TCP_SEQ_STATE_ESTABLISHED = 1, +}; + +struct tcp_seq_afinfo { + sa_family_t family; +}; + +struct tcp_iter_state { + struct seq_net_private p; + enum tcp_seq_states state; + struct sock *syn_wait_sk; + struct tcp_seq_afinfo *bpf_seq_afinfo; + int bucket; + int offset; + int sbucket; + int num; + loff_t last_pos; +}; + +struct bpf_iter__tcp { + union { + struct bpf_iter_meta *meta; + }; + union { + struct sock_common *sk_common; + }; + uid_t uid; +}; + +enum tcp_metric_index { + TCP_METRIC_RTT = 0, + TCP_METRIC_RTTVAR = 1, + TCP_METRIC_SSTHRESH = 2, + TCP_METRIC_CWND = 3, + TCP_METRIC_REORDERING = 4, + TCP_METRIC_RTT_US = 5, + TCP_METRIC_RTTVAR_US = 6, + __TCP_METRIC_MAX = 7, +}; + +enum { + TCP_METRICS_ATTR_UNSPEC = 0, + TCP_METRICS_ATTR_ADDR_IPV4 = 1, + TCP_METRICS_ATTR_ADDR_IPV6 = 2, + TCP_METRICS_ATTR_AGE = 3, + TCP_METRICS_ATTR_TW_TSVAL = 4, + TCP_METRICS_ATTR_TW_TS_STAMP = 5, + TCP_METRICS_ATTR_VALS = 6, + TCP_METRICS_ATTR_FOPEN_MSS = 7, + TCP_METRICS_ATTR_FOPEN_SYN_DROPS = 8, + TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS = 9, + TCP_METRICS_ATTR_FOPEN_COOKIE = 10, + TCP_METRICS_ATTR_SADDR_IPV4 = 11, + TCP_METRICS_ATTR_SADDR_IPV6 = 12, + TCP_METRICS_ATTR_PAD = 13, + __TCP_METRICS_ATTR_MAX = 14, +}; + +enum { + TCP_METRICS_CMD_UNSPEC = 0, + TCP_METRICS_CMD_GET = 1, + TCP_METRICS_CMD_DEL = 2, + __TCP_METRICS_CMD_MAX = 3, +}; + +struct tcp_fastopen_metrics { + u16 mss; + u16 syn_loss: 10; + u16 try_exp: 2; + long unsigned int last_syn_loss; + struct tcp_fastopen_cookie cookie; +}; + +struct tcp_metrics_block { + struct tcp_metrics_block *tcpm_next; + possible_net_t tcpm_net; + struct inetpeer_addr tcpm_saddr; + struct inetpeer_addr tcpm_daddr; + long unsigned int tcpm_stamp; + u32 tcpm_lock; + u32 tcpm_vals[5]; + struct tcp_fastopen_metrics tcpm_fastopen; + struct callback_head callback_head; +}; + +struct tcpm_hash_bucket { + struct tcp_metrics_block *chain; +}; + +struct icmp_filter { + __u32 data; +}; + +struct raw_iter_state { + struct seq_net_private p; + int bucket; +}; + +struct raw_sock { + struct inet_sock inet; + struct icmp_filter filter; + u32 ipmr_table; +}; + +struct raw_frag_vec { + struct msghdr *msg; + union { + struct icmphdr icmph; + char c[1]; + } hdr; + int hlen; +}; + +struct ip_tunnel_encap { + u16 type; + u16 flags; + __be16 sport; + __be16 dport; +}; + +struct ip_tunnel_encap_ops { + size_t (*encap_hlen)(struct ip_tunnel_encap *); + int (*build_header)(struct sk_buff *, struct ip_tunnel_encap *, u8 *, struct flowi4 *); + int (*err_handler)(struct sk_buff *, u32); +}; + +struct udp_skb_cb { + union { + struct inet_skb_parm h4; + struct inet6_skb_parm h6; + } header; + __u16 cscov; + __u8 partial_cov; +}; + +struct udp_dev_scratch { + u32 _tsize_state; + u16 len; + bool is_linear; + bool csum_unnecessary; +}; + +struct udp_seq_afinfo { + sa_family_t family; + struct udp_table *udp_table; +}; + +struct udp_iter_state { + struct seq_net_private p; + int bucket; + struct udp_seq_afinfo *bpf_seq_afinfo; +}; + +struct bpf_iter__udp { + union { + struct bpf_iter_meta *meta; + }; + union { + struct udp_sock *udp_sk; + }; + uid_t uid; + int: 32; + int bucket; +}; + +struct inet_protosw { + struct list_head list; + short unsigned int type; + short unsigned int protocol; + struct proto *prot; + const struct proto_ops *ops; + unsigned char flags; +}; + +typedef struct sk_buff * (*gro_receive_sk_t)(struct sock *, struct list_head *, struct sk_buff *); + +typedef struct sock * (*udp_lookup_t)(const struct sk_buff *, __be16, __be16); + +struct arpreq { + struct sockaddr arp_pa; + struct sockaddr arp_ha; + int arp_flags; + struct sockaddr arp_netmask; + char arp_dev[16]; +}; + +typedef struct { + char ax25_call[7]; +} ax25_address; + +enum { + AX25_VALUES_IPDEFMODE = 0, + AX25_VALUES_AXDEFMODE = 1, + AX25_VALUES_BACKOFF = 2, + AX25_VALUES_CONMODE = 3, + AX25_VALUES_WINDOW = 4, + AX25_VALUES_EWINDOW = 5, + AX25_VALUES_T1 = 6, + AX25_VALUES_T2 = 7, + AX25_VALUES_T3 = 8, + AX25_VALUES_IDLE = 9, + AX25_VALUES_N2 = 10, + AX25_VALUES_PACLEN = 11, + AX25_VALUES_PROTOCOL = 12, + AX25_VALUES_DS_TIMEOUT = 13, + AX25_MAX_VALUES = 14, +}; + +enum ip_conntrack_status { + IPS_EXPECTED_BIT = 0, + IPS_EXPECTED = 1, + IPS_SEEN_REPLY_BIT = 1, + IPS_SEEN_REPLY = 2, + IPS_ASSURED_BIT = 2, + IPS_ASSURED = 4, + IPS_CONFIRMED_BIT = 3, + IPS_CONFIRMED = 8, + IPS_SRC_NAT_BIT = 4, + IPS_SRC_NAT = 16, + IPS_DST_NAT_BIT = 5, + IPS_DST_NAT = 32, + IPS_NAT_MASK = 48, + IPS_SEQ_ADJUST_BIT = 6, + IPS_SEQ_ADJUST = 64, + IPS_SRC_NAT_DONE_BIT = 7, + IPS_SRC_NAT_DONE = 128, + IPS_DST_NAT_DONE_BIT = 8, + IPS_DST_NAT_DONE = 256, + IPS_NAT_DONE_MASK = 384, + IPS_DYING_BIT = 9, + IPS_DYING = 512, + IPS_FIXED_TIMEOUT_BIT = 10, + IPS_FIXED_TIMEOUT = 1024, + IPS_TEMPLATE_BIT = 11, + IPS_TEMPLATE = 2048, + IPS_UNTRACKED_BIT = 12, + IPS_UNTRACKED = 4096, + IPS_NAT_CLASH_BIT = 12, + IPS_NAT_CLASH = 4096, + IPS_HELPER_BIT = 13, + IPS_HELPER = 8192, + IPS_OFFLOAD_BIT = 14, + IPS_OFFLOAD = 16384, + IPS_HW_OFFLOAD_BIT = 15, + IPS_HW_OFFLOAD = 32768, + IPS_UNCHANGEABLE_MASK = 56313, + __IPS_MAX_BIT = 16, +}; + +enum { + XFRM_LOOKUP_ICMP = 1, + XFRM_LOOKUP_QUEUE = 2, + XFRM_LOOKUP_KEEP_DST_REF = 4, +}; + +struct icmp_ext_hdr { + __u8 reserved1: 4; + __u8 version: 4; + __u8 reserved2; + __sum16 checksum; +}; + +struct icmp_extobj_hdr { + __be16 length; + __u8 class_num; + __u8 class_type; +}; + +struct icmp_bxm { + struct sk_buff *skb; + int offset; + int data_len; + struct { + struct icmphdr icmph; + __be32 times[3]; + } data; + int head_len; + struct ip_options_data replyopts; +}; + +struct icmp_control { + bool (*handler)(struct sk_buff *); + short int error; +}; + +struct ifaddrmsg { + __u8 ifa_family; + __u8 ifa_prefixlen; + __u8 ifa_flags; + __u8 ifa_scope; + __u32 ifa_index; +}; + +enum { + IFA_UNSPEC = 0, + IFA_ADDRESS = 1, + IFA_LOCAL = 2, + IFA_LABEL = 3, + IFA_BROADCAST = 4, + IFA_ANYCAST = 5, + IFA_CACHEINFO = 6, + IFA_MULTICAST = 7, + IFA_FLAGS = 8, + IFA_RT_PRIORITY = 9, + IFA_TARGET_NETNSID = 10, + __IFA_MAX = 11, +}; + +struct ifa_cacheinfo { + __u32 ifa_prefered; + __u32 ifa_valid; + __u32 cstamp; + __u32 tstamp; +}; + +enum { + IFLA_INET_UNSPEC = 0, + IFLA_INET_CONF = 1, + __IFLA_INET_MAX = 2, +}; + +struct in_validator_info { + __be32 ivi_addr; + struct in_device *ivi_dev; + struct netlink_ext_ack *extack; +}; + +struct netconfmsg { + __u8 ncm_family; +}; + +enum { + NETCONFA_UNSPEC = 0, + NETCONFA_IFINDEX = 1, + NETCONFA_FORWARDING = 2, + NETCONFA_RP_FILTER = 3, + NETCONFA_MC_FORWARDING = 4, + NETCONFA_PROXY_NEIGH = 5, + NETCONFA_IGNORE_ROUTES_WITH_LINKDOWN = 6, + NETCONFA_INPUT = 7, + NETCONFA_BC_FORWARDING = 8, + __NETCONFA_MAX = 9, +}; + +struct inet_fill_args { + u32 portid; + u32 seq; + int event; + unsigned int flags; + int netnsid; + int ifindex; +}; + +struct devinet_sysctl_table { + struct ctl_table_header *sysctl_header; + struct ctl_table devinet_vars[33]; +}; + +struct rtentry { + long unsigned int rt_pad1; + struct sockaddr rt_dst; + struct sockaddr rt_gateway; + struct sockaddr rt_genmask; + short unsigned int rt_flags; + short int rt_pad2; + long unsigned int rt_pad3; + void *rt_pad4; + short int rt_metric; + char *rt_dev; + long unsigned int rt_mtu; + long unsigned int rt_window; + short unsigned int rt_irtt; +}; + +struct pingv6_ops { + int (*ipv6_recv_error)(struct sock *, struct msghdr *, int, int *); + void (*ip6_datagram_recv_common_ctl)(struct sock *, struct msghdr *, struct sk_buff *); + void (*ip6_datagram_recv_specific_ctl)(struct sock *, struct msghdr *, struct sk_buff *); + int (*icmpv6_err_convert)(u8, u8, int *); + void (*ipv6_icmp_error)(struct sock *, struct sk_buff *, int, __be16, u32, u8 *); + int (*ipv6_chk_addr)(struct net *, const struct in6_addr *, const struct net_device *, int); +}; + +struct compat_rtentry { + u32 rt_pad1; + struct sockaddr rt_dst; + struct sockaddr rt_gateway; + struct sockaddr rt_genmask; + short unsigned int rt_flags; + short int rt_pad2; + u32 rt_pad3; + unsigned char rt_tos; + unsigned char rt_class; + short int rt_pad4; + short int rt_metric; + compat_uptr_t rt_dev; + u32 rt_mtu; + u32 rt_window; + short unsigned int rt_irtt; +}; + +struct igmphdr { + __u8 type; + __u8 code; + __sum16 csum; + __be32 group; +}; + +struct igmpv3_grec { + __u8 grec_type; + __u8 grec_auxwords; + __be16 grec_nsrcs; + __be32 grec_mca; + __be32 grec_src[0]; +}; + +struct igmpv3_report { + __u8 type; + __u8 resv1; + __sum16 csum; + __be16 resv2; + __be16 ngrec; + struct igmpv3_grec grec[0]; +}; + +struct igmpv3_query { + __u8 type; + __u8 code; + __sum16 csum; + __be32 group; + __u8 qrv: 3; + __u8 suppress: 1; + __u8 resv: 4; + __u8 qqic; + __be16 nsrcs; + __be32 srcs[0]; +}; + +struct igmp_mc_iter_state { + struct seq_net_private p; + struct net_device *dev; + struct in_device *in_dev; +}; + +struct igmp_mcf_iter_state { + struct seq_net_private p; + struct net_device *dev; + struct in_device *idev; + struct ip_mc_list *im; +}; + +struct fib_config { + u8 fc_dst_len; + u8 fc_tos; + u8 fc_protocol; + u8 fc_scope; + u8 fc_type; + u8 fc_gw_family; + u32 fc_table; + __be32 fc_dst; + union { + __be32 fc_gw4; + struct in6_addr fc_gw6; + }; + int fc_oif; + u32 fc_flags; + u32 fc_priority; + __be32 fc_prefsrc; + u32 fc_nh_id; + struct nlattr *fc_mx; + struct rtnexthop *fc_mp; + int fc_mx_len; + int fc_mp_len; + u32 fc_flow; + u32 fc_nlflags; + struct nl_info fc_nlinfo; + struct nlattr *fc_encap; + u16 fc_encap_type; +}; + +struct fib_result_nl { + __be32 fl_addr; + u32 fl_mark; + unsigned char fl_tos; + unsigned char fl_scope; + unsigned char tb_id_in; + unsigned char tb_id; + unsigned char prefixlen; + unsigned char nh_sel; + unsigned char type; + unsigned char scope; + int err; +}; + +struct fib_dump_filter { + u32 table_id; + bool filter_set; + bool dump_routes; + bool dump_exceptions; + unsigned char protocol; + unsigned char rt_type; + unsigned int flags; + struct net_device *dev; +}; + +struct fib_nh_notifier_info { + struct fib_notifier_info info; + struct fib_nh *fib_nh; +}; + +struct fib_entry_notifier_info { + struct fib_notifier_info info; + u32 dst; + int dst_len; + struct fib_info *fi; + u8 tos; + u8 type; + u32 tb_id; +}; + +typedef unsigned int t_key; + +struct key_vector { + t_key key; + unsigned char pos; + unsigned char bits; + unsigned char slen; + union { + struct hlist_head leaf; + struct key_vector *tnode[0]; + }; +}; + +struct tnode { + struct callback_head rcu; + t_key empty_children; + t_key full_children; + struct key_vector *parent; + struct key_vector kv[1]; +}; + +struct trie_use_stats { + unsigned int gets; + unsigned int backtrack; + unsigned int semantic_match_passed; + unsigned int semantic_match_miss; + unsigned int null_node_hit; + unsigned int resize_node_skipped; +}; + +struct trie_stat { + unsigned int totdepth; + unsigned int maxdepth; + unsigned int tnodes; + unsigned int leaves; + unsigned int nullpointers; + unsigned int prefixes; + unsigned int nodesizes[32]; +}; + +struct trie { + struct key_vector kv[1]; + struct trie_use_stats *stats; +}; + +struct fib_trie_iter { + struct seq_net_private p; + struct fib_table *tb; + struct key_vector *tnode; + unsigned int index; + unsigned int depth; +}; + +struct fib_route_iter { + struct seq_net_private p; + struct fib_table *main_tb; + struct key_vector *tnode; + loff_t pos; + t_key key; +}; + +struct ipfrag_skb_cb { + union { + struct inet_skb_parm h4; + struct inet6_skb_parm h6; + }; + struct sk_buff *next_frag; + int frag_run_len; +}; + +struct icmpv6_echo { + __be16 identifier; + __be16 sequence; +}; + +struct icmpv6_nd_advt { + __u32 reserved: 5; + __u32 override: 1; + __u32 solicited: 1; + __u32 router: 1; + __u32 reserved2: 24; +}; + +struct icmpv6_nd_ra { + __u8 hop_limit; + __u8 reserved: 3; + __u8 router_pref: 2; + __u8 home_agent: 1; + __u8 other: 1; + __u8 managed: 1; + __be16 rt_lifetime; +}; + +struct icmp6hdr { + __u8 icmp6_type; + __u8 icmp6_code; + __sum16 icmp6_cksum; + union { + __be32 un_data32[1]; + __be16 un_data16[2]; + __u8 un_data8[4]; + struct icmpv6_echo u_echo; + struct icmpv6_nd_advt u_nd_advt; + struct icmpv6_nd_ra u_nd_ra; + } icmp6_dataun; +}; + +struct ping_iter_state { + struct seq_net_private p; + int bucket; + sa_family_t family; +}; + +struct pingfakehdr { + struct icmphdr icmph; + struct msghdr *msg; + sa_family_t family; + __wsum wcheck; +}; + +struct ping_table { + struct hlist_nulls_head hash[64]; + rwlock_t lock; +}; + +enum lwtunnel_ip_t { + LWTUNNEL_IP_UNSPEC = 0, + LWTUNNEL_IP_ID = 1, + LWTUNNEL_IP_DST = 2, + LWTUNNEL_IP_SRC = 3, + LWTUNNEL_IP_TTL = 4, + LWTUNNEL_IP_TOS = 5, + LWTUNNEL_IP_FLAGS = 6, + LWTUNNEL_IP_PAD = 7, + LWTUNNEL_IP_OPTS = 8, + __LWTUNNEL_IP_MAX = 9, +}; + +enum lwtunnel_ip6_t { + LWTUNNEL_IP6_UNSPEC = 0, + LWTUNNEL_IP6_ID = 1, + LWTUNNEL_IP6_DST = 2, + LWTUNNEL_IP6_SRC = 3, + LWTUNNEL_IP6_HOPLIMIT = 4, + LWTUNNEL_IP6_TC = 5, + LWTUNNEL_IP6_FLAGS = 6, + LWTUNNEL_IP6_PAD = 7, + LWTUNNEL_IP6_OPTS = 8, + __LWTUNNEL_IP6_MAX = 9, +}; + +enum { + LWTUNNEL_IP_OPTS_UNSPEC = 0, + LWTUNNEL_IP_OPTS_GENEVE = 1, + LWTUNNEL_IP_OPTS_VXLAN = 2, + LWTUNNEL_IP_OPTS_ERSPAN = 3, + __LWTUNNEL_IP_OPTS_MAX = 4, +}; + +enum { + LWTUNNEL_IP_OPT_GENEVE_UNSPEC = 0, + LWTUNNEL_IP_OPT_GENEVE_CLASS = 1, + LWTUNNEL_IP_OPT_GENEVE_TYPE = 2, + LWTUNNEL_IP_OPT_GENEVE_DATA = 3, + __LWTUNNEL_IP_OPT_GENEVE_MAX = 4, +}; + +enum { + LWTUNNEL_IP_OPT_VXLAN_UNSPEC = 0, + LWTUNNEL_IP_OPT_VXLAN_GBP = 1, + __LWTUNNEL_IP_OPT_VXLAN_MAX = 2, +}; + +enum { + LWTUNNEL_IP_OPT_ERSPAN_UNSPEC = 0, + LWTUNNEL_IP_OPT_ERSPAN_VER = 1, + LWTUNNEL_IP_OPT_ERSPAN_INDEX = 2, + LWTUNNEL_IP_OPT_ERSPAN_DIR = 3, + LWTUNNEL_IP_OPT_ERSPAN_HWID = 4, + __LWTUNNEL_IP_OPT_ERSPAN_MAX = 5, +}; + +struct ip6_tnl_encap_ops { + size_t (*encap_hlen)(struct ip_tunnel_encap *); + int (*build_header)(struct sk_buff *, struct ip_tunnel_encap *, u8 *, struct flowi6 *); + int (*err_handler)(struct sk_buff *, struct inet6_skb_parm *, u8, u8, int, __be32); +}; + +struct geneve_opt { + __be16 opt_class; + u8 type; + u8 length: 5; + u8 r3: 1; + u8 r2: 1; + u8 r1: 1; + u8 opt_data[0]; +}; + +struct vxlan_metadata { + u32 gbp; +}; + +struct erspan_md2 { + __be32 timestamp; + __be16 sgt; + __u8 hwid_upper: 2; + __u8 ft: 5; + __u8 p: 1; + __u8 o: 1; + __u8 gra: 2; + __u8 dir: 1; + __u8 hwid: 4; +}; + +struct erspan_metadata { + int version; + union { + __be32 index; + struct erspan_md2 md2; + } u; +}; + +struct nhmsg { + unsigned char nh_family; + unsigned char nh_scope; + unsigned char nh_protocol; + unsigned char resvd; + unsigned int nh_flags; +}; + +struct nexthop_grp { + __u32 id; + __u8 weight; + __u8 resvd1; + __u16 resvd2; +}; + +enum { + NEXTHOP_GRP_TYPE_MPATH = 0, + __NEXTHOP_GRP_TYPE_MAX = 1, +}; + +enum { + NHA_UNSPEC = 0, + NHA_ID = 1, + NHA_GROUP = 2, + NHA_GROUP_TYPE = 3, + NHA_BLACKHOLE = 4, + NHA_OIF = 5, + NHA_GATEWAY = 6, + NHA_ENCAP_TYPE = 7, + NHA_ENCAP = 8, + NHA_GROUPS = 9, + NHA_MASTER = 10, + NHA_FDB = 11, + __NHA_MAX = 12, +}; + +struct nh_config { + u32 nh_id; + u8 nh_family; + u8 nh_protocol; + u8 nh_blackhole; + u8 nh_fdb; + u32 nh_flags; + int nh_ifindex; + struct net_device *dev; + union { + __be32 ipv4; + struct in6_addr ipv6; + } gw; + struct nlattr *nh_grp; + u16 nh_grp_type; + struct nlattr *nh_encap; + u16 nh_encap_type; + u32 nlflags; + struct nl_info nlinfo; +}; + +enum nexthop_event_type { + NEXTHOP_EVENT_DEL = 0, + NEXTHOP_EVENT_REPLACE = 1, +}; + +struct nh_notifier_single_info { + struct net_device *dev; + u8 gw_family; + union { + __be32 ipv4; + struct in6_addr ipv6; + }; + u8 is_reject: 1; + u8 is_fdb: 1; + u8 has_encap: 1; +}; + +struct nh_notifier_grp_entry_info { + u8 weight; + u32 id; + struct nh_notifier_single_info nh; +}; + +struct nh_notifier_grp_info { + u16 num_nh; + bool is_fdb; + struct nh_notifier_grp_entry_info nh_entries[0]; +}; + +struct nh_notifier_info { + struct net *net; + struct netlink_ext_ack *extack; + u32 id; + bool is_grp; + union { + struct nh_notifier_single_info *nh; + struct nh_notifier_grp_info *nh_grp; + }; +}; + +struct inet6_protocol { + void (*early_demux)(struct sk_buff *); + void (*early_demux_handler)(struct sk_buff *); + int (*handler)(struct sk_buff *); + int (*err_handler)(struct sk_buff *, struct inet6_skb_parm *, u8, u8, int, __be32); + unsigned int flags; +}; + +struct snmp_mib { + const char *name; + int entry; +}; + +struct fib4_rule { + struct fib_rule common; + u8 dst_len; + u8 src_len; + u8 tos; + __be32 src; + __be32 srcmask; + __be32 dst; + __be32 dstmask; + u32 tclassid; +}; + +enum { + PIM_TYPE_HELLO = 0, + PIM_TYPE_REGISTER = 1, + PIM_TYPE_REGISTER_STOP = 2, + PIM_TYPE_JOIN_PRUNE = 3, + PIM_TYPE_BOOTSTRAP = 4, + PIM_TYPE_ASSERT = 5, + PIM_TYPE_GRAFT = 6, + PIM_TYPE_GRAFT_ACK = 7, + PIM_TYPE_CANDIDATE_RP_ADV = 8, +}; + +struct pimreghdr { + __u8 type; + __u8 reserved; + __be16 csum; + __be32 flags; +}; + +typedef short unsigned int vifi_t; + +struct vifctl { + vifi_t vifc_vifi; + unsigned char vifc_flags; + unsigned char vifc_threshold; + unsigned int vifc_rate_limit; + union { + struct in_addr vifc_lcl_addr; + int vifc_lcl_ifindex; + }; + struct in_addr vifc_rmt_addr; +}; + +struct mfcctl { + struct in_addr mfcc_origin; + struct in_addr mfcc_mcastgrp; + vifi_t mfcc_parent; + unsigned char mfcc_ttls[32]; + unsigned int mfcc_pkt_cnt; + unsigned int mfcc_byte_cnt; + unsigned int mfcc_wrong_if; + int mfcc_expire; +}; + +struct sioc_sg_req { + struct in_addr src; + struct in_addr grp; + long unsigned int pktcnt; + long unsigned int bytecnt; + long unsigned int wrong_if; +}; + +struct sioc_vif_req { + vifi_t vifi; + long unsigned int icount; + long unsigned int ocount; + long unsigned int ibytes; + long unsigned int obytes; +}; + +struct igmpmsg { + __u32 unused1; + __u32 unused2; + unsigned char im_msgtype; + unsigned char im_mbz; + unsigned char im_vif; + unsigned char im_vif_hi; + struct in_addr im_src; + struct in_addr im_dst; +}; + +enum { + IPMRA_TABLE_UNSPEC = 0, + IPMRA_TABLE_ID = 1, + IPMRA_TABLE_CACHE_RES_QUEUE_LEN = 2, + IPMRA_TABLE_MROUTE_REG_VIF_NUM = 3, + IPMRA_TABLE_MROUTE_DO_ASSERT = 4, + IPMRA_TABLE_MROUTE_DO_PIM = 5, + IPMRA_TABLE_VIFS = 6, + IPMRA_TABLE_MROUTE_DO_WRVIFWHOLE = 7, + __IPMRA_TABLE_MAX = 8, +}; + +enum { + IPMRA_VIF_UNSPEC = 0, + IPMRA_VIF = 1, + __IPMRA_VIF_MAX = 2, +}; + +enum { + IPMRA_VIFA_UNSPEC = 0, + IPMRA_VIFA_IFINDEX = 1, + IPMRA_VIFA_VIF_ID = 2, + IPMRA_VIFA_FLAGS = 3, + IPMRA_VIFA_BYTES_IN = 4, + IPMRA_VIFA_BYTES_OUT = 5, + IPMRA_VIFA_PACKETS_IN = 6, + IPMRA_VIFA_PACKETS_OUT = 7, + IPMRA_VIFA_LOCAL_ADDR = 8, + IPMRA_VIFA_REMOTE_ADDR = 9, + IPMRA_VIFA_PAD = 10, + __IPMRA_VIFA_MAX = 11, +}; + +enum { + IPMRA_CREPORT_UNSPEC = 0, + IPMRA_CREPORT_MSGTYPE = 1, + IPMRA_CREPORT_VIF_ID = 2, + IPMRA_CREPORT_SRC_ADDR = 3, + IPMRA_CREPORT_DST_ADDR = 4, + IPMRA_CREPORT_PKT = 5, + IPMRA_CREPORT_TABLE = 6, + __IPMRA_CREPORT_MAX = 7, +}; + +struct vif_device { + struct net_device *dev; + long unsigned int bytes_in; + long unsigned int bytes_out; + long unsigned int pkt_in; + long unsigned int pkt_out; + long unsigned int rate_limit; + unsigned char threshold; + short unsigned int flags; + int link; + struct netdev_phys_item_id dev_parent_id; + __be32 local; + __be32 remote; +}; + +struct vif_entry_notifier_info { + struct fib_notifier_info info; + struct net_device *dev; + short unsigned int vif_index; + short unsigned int vif_flags; + u32 tb_id; +}; + +enum { + MFC_STATIC = 1, + MFC_OFFLOAD = 2, +}; + +struct mr_mfc { + struct rhlist_head mnode; + short unsigned int mfc_parent; + int mfc_flags; + union { + struct { + long unsigned int expires; + struct sk_buff_head unresolved; + } unres; + struct { + long unsigned int last_assert; + int minvif; + int maxvif; + long unsigned int bytes; + long unsigned int pkt; + long unsigned int wrong_if; + long unsigned int lastuse; + unsigned char ttls[32]; + refcount_t refcount; + } res; + } mfc_un; + struct list_head list; + struct callback_head rcu; + void (*free)(struct callback_head *); +}; + +struct mfc_entry_notifier_info { + struct fib_notifier_info info; + struct mr_mfc *mfc; + u32 tb_id; +}; + +struct mr_table_ops { + const struct rhashtable_params *rht_params; + void *cmparg_any; +}; + +struct mr_table { + struct list_head list; + possible_net_t net; + struct mr_table_ops ops; + u32 id; + struct sock *mroute_sk; + struct timer_list ipmr_expire_timer; + struct list_head mfc_unres_queue; + struct vif_device vif_table[32]; + struct rhltable mfc_hash; + struct list_head mfc_cache_list; + int maxvif; + atomic_t cache_resolve_queue_len; + bool mroute_do_assert; + bool mroute_do_pim; + bool mroute_do_wrvifwhole; + int mroute_reg_vif_num; +}; + +struct mr_vif_iter { + struct seq_net_private p; + struct mr_table *mrt; + int ct; +}; + +struct mr_mfc_iter { + struct seq_net_private p; + struct mr_table *mrt; + struct list_head *cache; + spinlock_t *lock; +}; + +struct mfc_cache_cmp_arg { + __be32 mfc_mcastgrp; + __be32 mfc_origin; +}; + +struct mfc_cache { + struct mr_mfc _c; + union { + struct { + __be32 mfc_mcastgrp; + __be32 mfc_origin; + }; + struct mfc_cache_cmp_arg cmparg; + }; +}; + +struct ipmr_result { + struct mr_table *mrt; +}; + +struct compat_sioc_sg_req { + struct in_addr src; + struct in_addr grp; + compat_ulong_t pktcnt; + compat_ulong_t bytecnt; + compat_ulong_t wrong_if; +}; + +struct compat_sioc_vif_req { + vifi_t vifi; + compat_ulong_t icount; + compat_ulong_t ocount; + compat_ulong_t ibytes; + compat_ulong_t obytes; +}; + +struct rta_mfc_stats { + __u64 mfcs_packets; + __u64 mfcs_bytes; + __u64 mfcs_wrong_if; +}; + +struct bictcp { + u32 cnt; + u32 last_max_cwnd; + u32 last_cwnd; + u32 last_time; + u32 bic_origin_point; + u32 bic_K; + u32 delay_min; + u32 epoch_start; + u32 ack_cnt; + u32 tcp_cwnd; + u16 unused; + u8 sample_cnt; + u8 found; + u32 round_start; + u32 end_seq; + u32 last_ack; + u32 curr_rtt; +}; + +struct tls_rec { + struct list_head list; + int tx_ready; + int tx_flags; + struct sk_msg msg_plaintext; + struct sk_msg msg_encrypted; + struct scatterlist sg_aead_in[2]; + struct scatterlist sg_aead_out[2]; + char content_type; + struct scatterlist sg_content_type; + char aad_space[13]; + u8 iv_data[16]; + struct aead_request aead_req; + u8 aead_req_ctx[0]; +}; + +struct tx_work { + struct delayed_work work; + struct sock *sk; +}; + +struct tls_sw_context_tx { + struct crypto_aead *aead_send; + struct crypto_wait async_wait; + struct tx_work tx_work; + struct tls_rec *open_rec; + struct list_head tx_list; + atomic_t encrypt_pending; + spinlock_t encrypt_compl_lock; + int async_notify; + u8 async_capable: 1; + long unsigned int tx_bitmask; +}; + +enum { + TCP_BPF_IPV4 = 0, + TCP_BPF_IPV6 = 1, + TCP_BPF_NUM_PROTS = 2, +}; + +enum { + TCP_BPF_BASE = 0, + TCP_BPF_TX = 1, + TCP_BPF_NUM_CFGS = 2, +}; + +enum { + UDP_BPF_IPV4 = 0, + UDP_BPF_IPV6 = 1, + UDP_BPF_NUM_PROTS = 2, +}; + +struct netlbl_audit { + u32 secid; + kuid_t loginuid; + unsigned int sessionid; +}; + +struct cipso_v4_std_map_tbl { + struct { + u32 *cipso; + u32 *local; + u32 cipso_size; + u32 local_size; + } lvl; + struct { + u32 *cipso; + u32 *local; + u32 cipso_size; + u32 local_size; + } cat; +}; + +struct cipso_v4_doi { + u32 doi; + u32 type; + union { + struct cipso_v4_std_map_tbl *std; + } map; + u8 tags[5]; + refcount_t refcount; + struct list_head list; + struct callback_head rcu; +}; + +struct cipso_v4_map_cache_bkt { + spinlock_t lock; + u32 size; + struct list_head list; +}; + +struct cipso_v4_map_cache_entry { + u32 hash; + unsigned char *key; + size_t key_len; + struct netlbl_lsm_cache *lsm_data; + u32 activity; + struct list_head list; +}; + +struct xfrm_policy_afinfo { + struct dst_ops *dst_ops; + struct dst_entry * (*dst_lookup)(struct net *, int, int, const xfrm_address_t *, const xfrm_address_t *, u32); + int (*get_saddr)(struct net *, int, xfrm_address_t *, xfrm_address_t *, u32); + int (*fill_dst)(struct xfrm_dst *, struct net_device *, const struct flowi *); + struct dst_entry * (*blackhole_route)(struct net *, struct dst_entry *); +}; + +struct xfrm_state_afinfo { + u8 family; + u8 proto; + const struct xfrm_type_offload *type_offload_esp; + const struct xfrm_type *type_esp; + const struct xfrm_type *type_ipip; + const struct xfrm_type *type_ipip6; + const struct xfrm_type *type_comp; + const struct xfrm_type *type_ah; + const struct xfrm_type *type_routing; + const struct xfrm_type *type_dstopts; + int (*output)(struct net *, struct sock *, struct sk_buff *); + int (*transport_finish)(struct sk_buff *, int); + void (*local_error)(struct sk_buff *, u32); +}; + +struct ip_tunnel; + +struct ip6_tnl; + +struct xfrm_tunnel_skb_cb { + union { + struct inet_skb_parm h4; + struct inet6_skb_parm h6; + } header; + union { + struct ip_tunnel *ip4; + struct ip6_tnl *ip6; + } tunnel; +}; + +struct xfrm_mode_skb_cb { + struct xfrm_tunnel_skb_cb header; + __be16 id; + __be16 frag_off; + u8 ihl; + u8 tos; + u8 ttl; + u8 protocol; + u8 optlen; + u8 flow_lbl[3]; +}; + +struct xfrm_spi_skb_cb { + struct xfrm_tunnel_skb_cb header; + unsigned int daddroff; + unsigned int family; + __be32 seq; +}; + +struct xfrm_input_afinfo { + u8 family; + bool is_ipip; + int (*callback)(struct sk_buff *, u8, int); +}; + +struct xfrm4_protocol { + int (*handler)(struct sk_buff *); + int (*input_handler)(struct sk_buff *, int, __be32, int); + int (*cb_handler)(struct sk_buff *, int); + int (*err_handler)(struct sk_buff *, u32); + struct xfrm4_protocol *next; + int priority; +}; + +typedef u64 (*btf_bpf_tcp_send_ack)(struct tcp_sock *, u32); + +struct seqcount_mutex { + seqcount_t seqcount; +}; + +typedef struct seqcount_mutex seqcount_mutex_t; + +enum { + XFRM_STATE_VOID = 0, + XFRM_STATE_ACQ = 1, + XFRM_STATE_VALID = 2, + XFRM_STATE_ERROR = 3, + XFRM_STATE_EXPIRED = 4, + XFRM_STATE_DEAD = 5, +}; + +struct xfrm_if; + +struct xfrm_if_cb { + struct xfrm_if * (*decode_session)(struct sk_buff *, short unsigned int); +}; + +struct xfrm_if_parms { + int link; + u32 if_id; +}; + +struct xfrm_if { + struct xfrm_if *next; + struct net_device *dev; + struct net *net; + struct xfrm_if_parms p; + struct gro_cells gro_cells; +}; + +struct xfrm_policy_walk { + struct xfrm_policy_walk_entry walk; + u8 type; + u32 seq; +}; + +struct xfrm_kmaddress { + xfrm_address_t local; + xfrm_address_t remote; + u32 reserved; + u16 family; +}; + +struct xfrm_migrate { + xfrm_address_t old_daddr; + xfrm_address_t old_saddr; + xfrm_address_t new_daddr; + xfrm_address_t new_saddr; + u8 proto; + u8 mode; + u16 reserved; + u32 reqid; + u16 old_family; + u16 new_family; +}; + +struct xfrmk_spdinfo { + u32 incnt; + u32 outcnt; + u32 fwdcnt; + u32 inscnt; + u32 outscnt; + u32 fwdscnt; + u32 spdhcnt; + u32 spdhmcnt; +}; + +struct ip6_mh { + __u8 ip6mh_proto; + __u8 ip6mh_hdrlen; + __u8 ip6mh_type; + __u8 ip6mh_reserved; + __u16 ip6mh_cksum; + __u8 data[0]; +}; + +struct xfrm_flo { + struct dst_entry *dst_orig; + u8 flags; +}; + +struct xfrm_pol_inexact_node { + struct rb_node node; + union { + xfrm_address_t addr; + struct callback_head rcu; + }; + u8 prefixlen; + struct rb_root root; + struct hlist_head hhead; +}; + +struct xfrm_pol_inexact_key { + possible_net_t net; + u32 if_id; + u16 family; + u8 dir; + u8 type; +}; + +struct xfrm_pol_inexact_bin { + struct xfrm_pol_inexact_key k; + struct rhash_head head; + struct hlist_head hhead; + seqcount_spinlock_t count; + struct rb_root root_d; + struct rb_root root_s; + struct list_head inexact_bins; + struct callback_head rcu; +}; + +enum xfrm_pol_inexact_candidate_type { + XFRM_POL_CAND_BOTH = 0, + XFRM_POL_CAND_SADDR = 1, + XFRM_POL_CAND_DADDR = 2, + XFRM_POL_CAND_ANY = 3, + XFRM_POL_CAND_MAX = 4, +}; + +struct xfrm_pol_inexact_candidates { + struct hlist_head *res[4]; +}; + +enum xfrm_ae_ftype_t { + XFRM_AE_UNSPEC = 0, + XFRM_AE_RTHR = 1, + XFRM_AE_RVAL = 2, + XFRM_AE_LVAL = 4, + XFRM_AE_ETHR = 8, + XFRM_AE_CR = 16, + XFRM_AE_CE = 32, + XFRM_AE_CU = 64, + __XFRM_AE_MAX = 65, +}; + +enum xfrm_nlgroups { + XFRMNLGRP_NONE = 0, + XFRMNLGRP_ACQUIRE = 1, + XFRMNLGRP_EXPIRE = 2, + XFRMNLGRP_SA = 3, + XFRMNLGRP_POLICY = 4, + XFRMNLGRP_AEVENTS = 5, + XFRMNLGRP_REPORT = 6, + XFRMNLGRP_MIGRATE = 7, + XFRMNLGRP_MAPPING = 8, + __XFRMNLGRP_MAX = 9, +}; + +enum { + XFRM_MODE_FLAG_TUNNEL = 1, +}; + +struct km_event { + union { + u32 hard; + u32 proto; + u32 byid; + u32 aevent; + u32 type; + } data; + u32 seq; + u32 portid; + u32 event; + struct net *net; +}; + +struct xfrm_mgr { + struct list_head list; + int (*notify)(struct xfrm_state *, const struct km_event *); + int (*acquire)(struct xfrm_state *, struct xfrm_tmpl *, struct xfrm_policy *); + struct xfrm_policy * (*compile_policy)(struct sock *, int, u8 *, int, int *); + int (*new_mapping)(struct xfrm_state *, xfrm_address_t *, __be16); + int (*notify_policy)(struct xfrm_policy *, int, const struct km_event *); + int (*report)(struct net *, u8, struct xfrm_selector *, xfrm_address_t *); + int (*migrate)(const struct xfrm_selector *, u8, u8, const struct xfrm_migrate *, int, const struct xfrm_kmaddress *, const struct xfrm_encap_tmpl *); + bool (*is_alive)(const struct km_event *); +}; + +struct xfrmk_sadinfo { + u32 sadhcnt; + u32 sadhmcnt; + u32 sadcnt; +}; + +struct xfrm_translator { + int (*alloc_compat)(struct sk_buff *, const struct nlmsghdr *); + struct nlmsghdr * (*rcv_msg_compat)(const struct nlmsghdr *, int, const struct nla_policy *, struct netlink_ext_ack *); + int (*xlate_user_policy_sockptr)(u8 **, int); + struct module *owner; +}; + +struct ip_beet_phdr { + __u8 nexthdr; + __u8 hdrlen; + __u8 padlen; + __u8 reserved; +}; + +struct ip_tunnel_6rd_parm { + struct in6_addr prefix; + __be32 relay_prefix; + u16 prefixlen; + u16 relay_prefixlen; +}; + +struct ip_tunnel_prl_entry; + +struct ip_tunnel { + struct ip_tunnel *next; + struct hlist_node hash_node; + struct net_device *dev; + struct net *net; + long unsigned int err_time; + int err_count; + u32 i_seqno; + u32 o_seqno; + int tun_hlen; + u32 index; + u8 erspan_ver; + u8 dir; + u16 hwid; + struct dst_cache dst_cache; + struct ip_tunnel_parm parms; + int mlink; + int encap_hlen; + int hlen; + struct ip_tunnel_encap encap; + struct ip_tunnel_6rd_parm ip6rd; + struct ip_tunnel_prl_entry *prl; + unsigned int prl_count; + unsigned int ip_tnl_net_id; + struct gro_cells gro_cells; + __u32 fwmark; + bool collect_md; + bool ignore_df; +}; + +struct __ip6_tnl_parm { + char name[16]; + int link; + __u8 proto; + __u8 encap_limit; + __u8 hop_limit; + bool collect_md; + __be32 flowinfo; + __u32 flags; + struct in6_addr laddr; + struct in6_addr raddr; + __be16 i_flags; + __be16 o_flags; + __be32 i_key; + __be32 o_key; + __u32 fwmark; + __u32 index; + __u8 erspan_ver; + __u8 dir; + __u16 hwid; +}; + +struct ip6_tnl { + struct ip6_tnl *next; + struct net_device *dev; + struct net *net; + struct __ip6_tnl_parm parms; + struct flowi fl; + struct dst_cache dst_cache; + struct gro_cells gro_cells; + int err_count; + long unsigned int err_time; + __u32 i_seqno; + __u32 o_seqno; + int hlen; + int tun_hlen; + int encap_hlen; + struct ip_tunnel_encap encap; + int mlink; +}; + +struct xfrm_skb_cb { + struct xfrm_tunnel_skb_cb header; + union { + struct { + __u32 low; + __u32 hi; + } output; + struct { + __be32 low; + __be32 hi; + } input; + } seq; +}; + +struct ip_tunnel_prl_entry { + struct ip_tunnel_prl_entry *next; + __be32 addr; + u16 flags; + struct callback_head callback_head; +}; + +struct xfrm_trans_tasklet { + struct tasklet_struct tasklet; + struct sk_buff_head queue; +}; + +struct xfrm_trans_cb { + union { + struct inet_skb_parm h4; + struct inet6_skb_parm h6; + } header; + int (*finish)(struct net *, struct sock *, struct sk_buff *); + struct net *net; +}; + +struct xfrm_user_offload { + int ifindex; + __u8 flags; +}; + +struct sadb_alg { + __u8 sadb_alg_id; + __u8 sadb_alg_ivlen; + __u16 sadb_alg_minbits; + __u16 sadb_alg_maxbits; + __u16 sadb_alg_reserved; +}; + +struct xfrm_algo_aead_info { + char *geniv; + u16 icv_truncbits; +}; + +struct xfrm_algo_auth_info { + u16 icv_truncbits; + u16 icv_fullbits; +}; + +struct xfrm_algo_encr_info { + char *geniv; + u16 blockbits; + u16 defkeybits; +}; + +struct xfrm_algo_comp_info { + u16 threshold; +}; + +struct xfrm_algo_desc { + char *name; + char *compat; + u8 available: 1; + u8 pfkey_supported: 1; + union { + struct xfrm_algo_aead_info aead; + struct xfrm_algo_auth_info auth; + struct xfrm_algo_encr_info encr; + struct xfrm_algo_comp_info comp; + } uinfo; + struct sadb_alg desc; +}; + +struct xfrm_algo_list { + struct xfrm_algo_desc *algs; + int entries; + u32 type; + u32 mask; +}; + +struct xfrm_aead_name { + const char *name; + int icvbits; +}; + +enum { + XFRM_SHARE_ANY = 0, + XFRM_SHARE_SESSION = 1, + XFRM_SHARE_USER = 2, + XFRM_SHARE_UNIQUE = 3, +}; + +struct xfrm_user_tmpl { + struct xfrm_id id; + __u16 family; + xfrm_address_t saddr; + __u32 reqid; + __u8 mode; + __u8 share; + __u8 optional; + __u32 aalgos; + __u32 ealgos; + __u32 calgos; +}; + +struct xfrm_userpolicy_type { + __u8 type; + __u16 reserved1; + __u8 reserved2; +}; + +enum xfrm_sadattr_type_t { + XFRMA_SAD_UNSPEC = 0, + XFRMA_SAD_CNT = 1, + XFRMA_SAD_HINFO = 2, + __XFRMA_SAD_MAX = 3, +}; + +struct xfrmu_sadhinfo { + __u32 sadhcnt; + __u32 sadhmcnt; +}; + +enum xfrm_spdattr_type_t { + XFRMA_SPD_UNSPEC = 0, + XFRMA_SPD_INFO = 1, + XFRMA_SPD_HINFO = 2, + XFRMA_SPD_IPV4_HTHRESH = 3, + XFRMA_SPD_IPV6_HTHRESH = 4, + __XFRMA_SPD_MAX = 5, +}; + +struct xfrmu_spdinfo { + __u32 incnt; + __u32 outcnt; + __u32 fwdcnt; + __u32 inscnt; + __u32 outscnt; + __u32 fwdscnt; +}; + +struct xfrmu_spdhinfo { + __u32 spdhcnt; + __u32 spdhmcnt; +}; + +struct xfrmu_spdhthresh { + __u8 lbits; + __u8 rbits; +}; + +struct xfrm_usersa_info { + struct xfrm_selector sel; + struct xfrm_id id; + xfrm_address_t saddr; + struct xfrm_lifetime_cfg lft; + struct xfrm_lifetime_cur curlft; + struct xfrm_stats stats; + __u32 seq; + __u32 reqid; + __u16 family; + __u8 mode; + __u8 replay_window; + __u8 flags; +}; + +struct xfrm_usersa_id { + xfrm_address_t daddr; + __be32 spi; + __u16 family; + __u8 proto; +}; + +struct xfrm_aevent_id { + struct xfrm_usersa_id sa_id; + xfrm_address_t saddr; + __u32 flags; + __u32 reqid; +}; + +struct xfrm_userspi_info { + struct xfrm_usersa_info info; + __u32 min; + __u32 max; +}; + +struct xfrm_userpolicy_info { + struct xfrm_selector sel; + struct xfrm_lifetime_cfg lft; + struct xfrm_lifetime_cur curlft; + __u32 priority; + __u32 index; + __u8 dir; + __u8 action; + __u8 flags; + __u8 share; +}; + +struct xfrm_userpolicy_id { + struct xfrm_selector sel; + __u32 index; + __u8 dir; +}; + +struct xfrm_user_acquire { + struct xfrm_id id; + xfrm_address_t saddr; + struct xfrm_selector sel; + struct xfrm_userpolicy_info policy; + __u32 aalgos; + __u32 ealgos; + __u32 calgos; + __u32 seq; +}; + +struct xfrm_user_expire { + struct xfrm_usersa_info state; + __u8 hard; +}; + +struct xfrm_user_polexpire { + struct xfrm_userpolicy_info pol; + __u8 hard; +}; + +struct xfrm_usersa_flush { + __u8 proto; +}; + +struct xfrm_user_report { + __u8 proto; + struct xfrm_selector sel; +}; + +struct xfrm_user_kmaddress { + xfrm_address_t local; + xfrm_address_t remote; + __u32 reserved; + __u16 family; +}; + +struct xfrm_user_migrate { + xfrm_address_t old_daddr; + xfrm_address_t old_saddr; + xfrm_address_t new_daddr; + xfrm_address_t new_saddr; + __u8 proto; + __u8 mode; + __u16 reserved; + __u32 reqid; + __u16 old_family; + __u16 new_family; +}; + +struct xfrm_user_mapping { + struct xfrm_usersa_id id; + __u32 reqid; + xfrm_address_t old_saddr; + xfrm_address_t new_saddr; + __be16 old_sport; + __be16 new_sport; +}; + +struct xfrm_dump_info { + struct sk_buff *in_skb; + struct sk_buff *out_skb; + u32 nlmsg_seq; + u16 nlmsg_flags; +}; + +struct xfrm_link { + int (*doit)(struct sk_buff *, struct nlmsghdr *, struct nlattr **); + int (*start)(struct netlink_callback *); + int (*dump)(struct sk_buff *, struct netlink_callback *); + int (*done)(struct netlink_callback *); + const struct nla_policy *nla_pol; + int nla_max; +}; + +struct espintcp_msg { + struct sk_buff *skb; + struct sk_msg skmsg; + int offset; + int len; +}; + +struct espintcp_ctx { + struct strparser strp; + struct sk_buff_head ike_queue; + struct sk_buff_head out_queue; + struct espintcp_msg partial; + void (*saved_data_ready)(struct sock *); + void (*saved_write_space)(struct sock *); + void (*saved_destruct)(struct sock *); + struct work_struct work; + bool tx_running; +}; + +struct unix_stream_read_state { + int (*recv_actor)(struct sk_buff *, int, int, struct unix_stream_read_state *); + struct socket *socket; + struct msghdr *msg; + struct pipe_inode_info *pipe; + size_t size; + int flags; + unsigned int splice_flags; +}; + +struct ipv6_params { + __s32 disable_ipv6; + __s32 autoconf; +}; + +enum flowlabel_reflect { + FLOWLABEL_REFLECT_ESTABLISHED = 1, + FLOWLABEL_REFLECT_TCP_RESET = 2, + FLOWLABEL_REFLECT_ICMPV6_ECHO_REPLIES = 4, +}; + +struct in6_rtmsg { + struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_src; + struct in6_addr rtmsg_gateway; + __u32 rtmsg_type; + __u16 rtmsg_dst_len; + __u16 rtmsg_src_len; + __u32 rtmsg_metric; + long unsigned int rtmsg_info; + __u32 rtmsg_flags; + int rtmsg_ifindex; +}; + +struct compat_in6_rtmsg { + struct in6_addr rtmsg_dst; + struct in6_addr rtmsg_src; + struct in6_addr rtmsg_gateway; + u32 rtmsg_type; + u16 rtmsg_dst_len; + u16 rtmsg_src_len; + u32 rtmsg_metric; + u32 rtmsg_info; + u32 rtmsg_flags; + s32 rtmsg_ifindex; +}; + +struct ac6_iter_state { + struct seq_net_private p; + struct net_device *dev; + struct inet6_dev *idev; +}; + +struct ip6_fraglist_iter { + struct ipv6hdr *tmp_hdr; + struct sk_buff *frag; + int offset; + unsigned int hlen; + __be32 frag_id; + u8 nexthdr; +}; + +struct ip6_frag_state { + u8 *prevhdr; + unsigned int hlen; + unsigned int mtu; + unsigned int left; + int offset; + int ptr; + int hroom; + int troom; + __be32 frag_id; + u8 nexthdr; +}; + +struct ip6_ra_chain { + struct ip6_ra_chain *next; + struct sock *sk; + int sel; + void (*destructor)(struct sock *); +}; + +struct ipcm6_cookie { + struct sockcm_cookie sockc; + __s16 hlimit; + __s16 tclass; + __s8 dontfrag; + struct ipv6_txoptions *opt; + __u16 gso_size; +}; + +enum { + IFLA_INET6_UNSPEC = 0, + IFLA_INET6_FLAGS = 1, + IFLA_INET6_CONF = 2, + IFLA_INET6_STATS = 3, + IFLA_INET6_MCAST = 4, + IFLA_INET6_CACHEINFO = 5, + IFLA_INET6_ICMP6STATS = 6, + IFLA_INET6_TOKEN = 7, + IFLA_INET6_ADDR_GEN_MODE = 8, + __IFLA_INET6_MAX = 9, +}; + +enum in6_addr_gen_mode { + IN6_ADDR_GEN_MODE_EUI64 = 0, + IN6_ADDR_GEN_MODE_NONE = 1, + IN6_ADDR_GEN_MODE_STABLE_PRIVACY = 2, + IN6_ADDR_GEN_MODE_RANDOM = 3, +}; + +struct ifla_cacheinfo { + __u32 max_reasm_len; + __u32 tstamp; + __u32 reachable_time; + __u32 retrans_time; +}; + +struct wpan_phy; + +struct wpan_dev_header_ops; + +struct wpan_dev { + struct wpan_phy *wpan_phy; + int iftype; + struct list_head list; + struct net_device *netdev; + const struct wpan_dev_header_ops *header_ops; + struct net_device *lowpan_dev; + u32 identifier; + __le16 pan_id; + __le16 short_addr; + __le64 extended_addr; + atomic_t bsn; + atomic_t dsn; + u8 min_be; + u8 max_be; + u8 csma_retries; + s8 frame_retries; + bool lbt; + bool promiscuous_mode; + bool ackreq; +}; + +struct prefixmsg { + unsigned char prefix_family; + unsigned char prefix_pad1; + short unsigned int prefix_pad2; + int prefix_ifindex; + unsigned char prefix_type; + unsigned char prefix_len; + unsigned char prefix_flags; + unsigned char prefix_pad3; +}; + +enum { + PREFIX_UNSPEC = 0, + PREFIX_ADDRESS = 1, + PREFIX_CACHEINFO = 2, + __PREFIX_MAX = 3, +}; + +struct prefix_cacheinfo { + __u32 preferred_time; + __u32 valid_time; +}; + +struct in6_ifreq { + struct in6_addr ifr6_addr; + __u32 ifr6_prefixlen; + int ifr6_ifindex; +}; + +enum { + DEVCONF_FORWARDING = 0, + DEVCONF_HOPLIMIT = 1, + DEVCONF_MTU6 = 2, + DEVCONF_ACCEPT_RA = 3, + DEVCONF_ACCEPT_REDIRECTS = 4, + DEVCONF_AUTOCONF = 5, + DEVCONF_DAD_TRANSMITS = 6, + DEVCONF_RTR_SOLICITS = 7, + DEVCONF_RTR_SOLICIT_INTERVAL = 8, + DEVCONF_RTR_SOLICIT_DELAY = 9, + DEVCONF_USE_TEMPADDR = 10, + DEVCONF_TEMP_VALID_LFT = 11, + DEVCONF_TEMP_PREFERED_LFT = 12, + DEVCONF_REGEN_MAX_RETRY = 13, + DEVCONF_MAX_DESYNC_FACTOR = 14, + DEVCONF_MAX_ADDRESSES = 15, + DEVCONF_FORCE_MLD_VERSION = 16, + DEVCONF_ACCEPT_RA_DEFRTR = 17, + DEVCONF_ACCEPT_RA_PINFO = 18, + DEVCONF_ACCEPT_RA_RTR_PREF = 19, + DEVCONF_RTR_PROBE_INTERVAL = 20, + DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN = 21, + DEVCONF_PROXY_NDP = 22, + DEVCONF_OPTIMISTIC_DAD = 23, + DEVCONF_ACCEPT_SOURCE_ROUTE = 24, + DEVCONF_MC_FORWARDING = 25, + DEVCONF_DISABLE_IPV6 = 26, + DEVCONF_ACCEPT_DAD = 27, + DEVCONF_FORCE_TLLAO = 28, + DEVCONF_NDISC_NOTIFY = 29, + DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL = 30, + DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL = 31, + DEVCONF_SUPPRESS_FRAG_NDISC = 32, + DEVCONF_ACCEPT_RA_FROM_LOCAL = 33, + DEVCONF_USE_OPTIMISTIC = 34, + DEVCONF_ACCEPT_RA_MTU = 35, + DEVCONF_STABLE_SECRET = 36, + DEVCONF_USE_OIF_ADDRS_ONLY = 37, + DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT = 38, + DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN = 39, + DEVCONF_DROP_UNICAST_IN_L2_MULTICAST = 40, + DEVCONF_DROP_UNSOLICITED_NA = 41, + DEVCONF_KEEP_ADDR_ON_DOWN = 42, + DEVCONF_RTR_SOLICIT_MAX_INTERVAL = 43, + DEVCONF_SEG6_ENABLED = 44, + DEVCONF_SEG6_REQUIRE_HMAC = 45, + DEVCONF_ENHANCED_DAD = 46, + DEVCONF_ADDR_GEN_MODE = 47, + DEVCONF_DISABLE_POLICY = 48, + DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN = 49, + DEVCONF_NDISC_TCLASS = 50, + DEVCONF_RPL_SEG_ENABLED = 51, + DEVCONF_MAX = 52, +}; + +enum { + INET6_IFADDR_STATE_PREDAD = 0, + INET6_IFADDR_STATE_DAD = 1, + INET6_IFADDR_STATE_POSTDAD = 2, + INET6_IFADDR_STATE_ERRDAD = 3, + INET6_IFADDR_STATE_DEAD = 4, +}; + +enum nl802154_cca_modes { + __NL802154_CCA_INVALID = 0, + NL802154_CCA_ENERGY = 1, + NL802154_CCA_CARRIER = 2, + NL802154_CCA_ENERGY_CARRIER = 3, + NL802154_CCA_ALOHA = 4, + NL802154_CCA_UWB_SHR = 5, + NL802154_CCA_UWB_MULTIPLEXED = 6, + __NL802154_CCA_ATTR_AFTER_LAST = 7, + NL802154_CCA_ATTR_MAX = 6, +}; + +enum nl802154_cca_opts { + NL802154_CCA_OPT_ENERGY_CARRIER_AND = 0, + NL802154_CCA_OPT_ENERGY_CARRIER_OR = 1, + __NL802154_CCA_OPT_ATTR_AFTER_LAST = 2, + NL802154_CCA_OPT_ATTR_MAX = 1, +}; + +enum nl802154_supported_bool_states { + NL802154_SUPPORTED_BOOL_FALSE = 0, + NL802154_SUPPORTED_BOOL_TRUE = 1, + __NL802154_SUPPORTED_BOOL_INVALD = 2, + NL802154_SUPPORTED_BOOL_BOTH = 3, + __NL802154_SUPPORTED_BOOL_AFTER_LAST = 4, + NL802154_SUPPORTED_BOOL_MAX = 3, +}; + +struct wpan_phy_supported { + u32 channels[32]; + u32 cca_modes; + u32 cca_opts; + u32 iftypes; + enum nl802154_supported_bool_states lbt; + u8 min_minbe; + u8 max_minbe; + u8 min_maxbe; + u8 max_maxbe; + u8 min_csma_backoffs; + u8 max_csma_backoffs; + s8 min_frame_retries; + s8 max_frame_retries; + size_t tx_powers_size; + size_t cca_ed_levels_size; + const s32 *tx_powers; + const s32 *cca_ed_levels; +}; + +struct wpan_phy_cca { + enum nl802154_cca_modes mode; + enum nl802154_cca_opts opt; +}; + +struct wpan_phy { + const void *privid; + u32 flags; + u8 current_channel; + u8 current_page; + struct wpan_phy_supported supported; + s32 transmit_power; + struct wpan_phy_cca cca; + __le64 perm_extended_addr; + s32 cca_ed_level; + u8 symbol_duration; + u16 lifs_period; + u16 sifs_period; + struct device dev; + possible_net_t _net; + long: 64; + char priv[0]; +}; + +struct ieee802154_addr { + u8 mode; + __le16 pan_id; + union { + __le16 short_addr; + __le64 extended_addr; + }; +}; + +struct wpan_dev_header_ops { + int (*create)(struct sk_buff *, struct net_device *, const struct ieee802154_addr *, const struct ieee802154_addr *, unsigned int); +}; + +union fwnet_hwaddr { + u8 u[16]; + struct { + __be64 uniq_id; + u8 max_rec; + u8 sspd; + __be16 fifo_hi; + __be32 fifo_lo; + } uc; +}; + +struct in6_validator_info { + struct in6_addr i6vi_addr; + struct inet6_dev *i6vi_dev; + struct netlink_ext_ack *extack; +}; + +struct ifa6_config { + const struct in6_addr *pfx; + unsigned int plen; + const struct in6_addr *peer_pfx; + u32 rt_priority; + u32 ifa_flags; + u32 preferred_lft; + u32 valid_lft; + u16 scope; +}; + +enum cleanup_prefix_rt_t { + CLEANUP_PREFIX_RT_NOP = 0, + CLEANUP_PREFIX_RT_DEL = 1, + CLEANUP_PREFIX_RT_EXPIRE = 2, +}; + +enum { + IPV6_SADDR_RULE_INIT = 0, + IPV6_SADDR_RULE_LOCAL = 1, + IPV6_SADDR_RULE_SCOPE = 2, + IPV6_SADDR_RULE_PREFERRED = 3, + IPV6_SADDR_RULE_HOA = 4, + IPV6_SADDR_RULE_OIF = 5, + IPV6_SADDR_RULE_LABEL = 6, + IPV6_SADDR_RULE_PRIVACY = 7, + IPV6_SADDR_RULE_ORCHID = 8, + IPV6_SADDR_RULE_PREFIX = 9, + IPV6_SADDR_RULE_NOT_OPTIMISTIC = 10, + IPV6_SADDR_RULE_MAX = 11, +}; + +struct ipv6_saddr_score { + int rule; + int addr_type; + struct inet6_ifaddr *ifa; + long unsigned int scorebits[1]; + int scopedist; + int matchlen; +}; + +struct ipv6_saddr_dst { + const struct in6_addr *addr; + int ifindex; + int scope; + int label; + unsigned int prefs; +}; + +struct if6_iter_state { + struct seq_net_private p; + int bucket; + int offset; +}; + +enum addr_type_t { + UNICAST_ADDR = 0, + MULTICAST_ADDR = 1, + ANYCAST_ADDR = 2, +}; + +struct inet6_fill_args { + u32 portid; + u32 seq; + int event; + unsigned int flags; + int netnsid; + int ifindex; + enum addr_type_t type; +}; + +enum { + DAD_PROCESS = 0, + DAD_BEGIN = 1, + DAD_ABORT = 2, +}; + +struct ifaddrlblmsg { + __u8 ifal_family; + __u8 __ifal_reserved; + __u8 ifal_prefixlen; + __u8 ifal_flags; + __u32 ifal_index; + __u32 ifal_seq; +}; + +enum { + IFAL_ADDRESS = 1, + IFAL_LABEL = 2, + __IFAL_MAX = 3, +}; + +struct ip6addrlbl_entry { + struct in6_addr prefix; + int prefixlen; + int ifindex; + int addrtype; + u32 label; + struct hlist_node list; + struct callback_head rcu; +}; + +struct ip6addrlbl_init_table { + const struct in6_addr *prefix; + int prefixlen; + u32 label; +}; + +struct rd_msg { + struct icmp6hdr icmph; + struct in6_addr target; + struct in6_addr dest; + __u8 opt[0]; +}; + +struct fib6_gc_args { + int timeout; + int more; +}; + +struct rt6_exception { + struct hlist_node hlist; + struct rt6_info *rt6i; + long unsigned int stamp; + struct callback_head rcu; +}; + +typedef struct rt6_info * (*pol_lookup_t)(struct net *, struct fib6_table *, struct flowi6 *, const struct sk_buff *, int); + +struct route_info { + __u8 type; + __u8 length; + __u8 prefix_len; + __u8 reserved_l: 3; + __u8 route_pref: 2; + __u8 reserved_h: 3; + __be32 lifetime; + __u8 prefix[0]; +}; + +struct rt6_rtnl_dump_arg { + struct sk_buff *skb; + struct netlink_callback *cb; + struct net *net; + struct fib_dump_filter filter; +}; + +struct netevent_redirect { + struct dst_entry *old; + struct dst_entry *new; + struct neighbour *neigh; + const void *daddr; +}; + +struct trace_event_raw_fib6_table_lookup { + struct trace_entry ent; + u32 tb_id; + int err; + int oif; + int iif; + __u8 tos; + __u8 scope; + __u8 flags; + __u8 src[16]; + __u8 dst[16]; + u16 sport; + u16 dport; + u8 proto; + u8 rt_type; + u32 __data_loc_name; + __u8 gw[16]; + char __data[0]; +}; + +struct trace_event_data_offsets_fib6_table_lookup { + u32 name; +}; + +typedef void (*btf_trace_fib6_table_lookup)(void *, const struct net *, const struct fib6_result *, struct fib6_table *, const struct flowi6 *); + +enum rt6_nud_state { + RT6_NUD_FAIL_HARD = 4294967293, + RT6_NUD_FAIL_PROBE = 4294967294, + RT6_NUD_FAIL_DO_RR = 4294967295, + RT6_NUD_SUCCEED = 1, +}; + +struct fib6_nh_dm_arg { + struct net *net; + const struct in6_addr *saddr; + int oif; + int flags; + struct fib6_nh *nh; +}; + +struct __rt6_probe_work { + struct work_struct work; + struct in6_addr target; + struct net_device *dev; +}; + +struct fib6_nh_frl_arg { + u32 flags; + int oif; + int strict; + int *mpri; + bool *do_rr; + struct fib6_nh *nh; +}; + +struct fib6_nh_excptn_arg { + struct rt6_info *rt; + int plen; +}; + +struct fib6_nh_match_arg { + const struct net_device *dev; + const struct in6_addr *gw; + struct fib6_nh *match; +}; + +struct fib6_nh_age_excptn_arg { + struct fib6_gc_args *gc_args; + long unsigned int now; +}; + +struct fib6_nh_rd_arg { + struct fib6_result *res; + struct flowi6 *fl6; + const struct in6_addr *gw; + struct rt6_info **ret; +}; + +struct ip6rd_flowi { + struct flowi6 fl6; + struct in6_addr gateway; +}; + +struct fib6_nh_del_cached_rt_arg { + struct fib6_config *cfg; + struct fib6_info *f6i; +}; + +struct arg_dev_net_ip { + struct net_device *dev; + struct net *net; + struct in6_addr *addr; +}; + +struct arg_netdev_event { + const struct net_device *dev; + union { + unsigned char nh_flags; + long unsigned int event; + }; +}; + +struct rt6_mtu_change_arg { + struct net_device *dev; + unsigned int mtu; + struct fib6_info *f6i; +}; + +struct rt6_nh { + struct fib6_info *fib6_info; + struct fib6_config r_cfg; + struct list_head next; +}; + +struct fib6_nh_exception_dump_walker { + struct rt6_rtnl_dump_arg *dump; + struct fib6_info *rt; + unsigned int flags; + unsigned int skip; + unsigned int count; +}; + +enum fib6_walk_state { + FWS_S = 0, + FWS_L = 1, + FWS_R = 2, + FWS_C = 3, + FWS_U = 4, +}; + +struct fib6_walker { + struct list_head lh; + struct fib6_node *root; + struct fib6_node *node; + struct fib6_info *leaf; + enum fib6_walk_state state; + unsigned int skip; + unsigned int count; + unsigned int skip_in_node; + int (*func)(struct fib6_walker *); + void *args; +}; + +struct fib6_entry_notifier_info { + struct fib_notifier_info info; + struct fib6_info *rt; + unsigned int nsiblings; +}; + +struct ipv6_route_iter { + struct seq_net_private p; + struct fib6_walker w; + loff_t skip; + struct fib6_table *tbl; + int sernum; +}; + +struct bpf_iter__ipv6_route { + union { + struct bpf_iter_meta *meta; + }; + union { + struct fib6_info *rt; + }; +}; + +struct fib6_cleaner { + struct fib6_walker w; + struct net *net; + int (*func)(struct fib6_info *, void *); + int sernum; + void *arg; + bool skip_notify; +}; + +enum { + FIB6_NO_SERNUM_CHANGE = 0, +}; + +struct fib6_dump_arg { + struct net *net; + struct notifier_block *nb; + struct netlink_ext_ack *extack; +}; + +struct fib6_nh_pcpu_arg { + struct fib6_info *from; + const struct fib6_table *table; +}; + +struct lookup_args { + int offset; + const struct in6_addr *addr; +}; + +struct ipv6_mreq { + struct in6_addr ipv6mr_multiaddr; + int ipv6mr_ifindex; +}; + +struct in6_flowlabel_req { + struct in6_addr flr_dst; + __be32 flr_label; + __u8 flr_action; + __u8 flr_share; + __u16 flr_flags; + __u16 flr_expires; + __u16 flr_linger; + __u32 __flr_pad; +}; + +struct ip6_mtuinfo { + struct sockaddr_in6 ip6m_addr; + __u32 ip6m_mtu; +}; + +struct nduseroptmsg { + unsigned char nduseropt_family; + unsigned char nduseropt_pad1; + short unsigned int nduseropt_opts_len; + int nduseropt_ifindex; + __u8 nduseropt_icmp_type; + __u8 nduseropt_icmp_code; + short unsigned int nduseropt_pad2; + unsigned int nduseropt_pad3; +}; + +enum { + NDUSEROPT_UNSPEC = 0, + NDUSEROPT_SRCADDR = 1, + __NDUSEROPT_MAX = 2, +}; + +struct nd_msg { + struct icmp6hdr icmph; + struct in6_addr target; + __u8 opt[0]; +}; + +struct rs_msg { + struct icmp6hdr icmph; + __u8 opt[0]; +}; + +struct ra_msg { + struct icmp6hdr icmph; + __be32 reachable_time; + __be32 retrans_timer; +}; + +struct icmp6_filter { + __u32 data[8]; +}; + +struct raw6_sock { + struct inet_sock inet; + __u32 checksum; + __u32 offset; + struct icmp6_filter filter; + __u32 ip6mr_table; + struct ipv6_pinfo inet6; +}; + +typedef int mh_filter_t(struct sock *, struct sk_buff *); + +struct raw6_frag_vec { + struct msghdr *msg; + int hlen; + char c[4]; +}; + +struct ipv6_destopt_hao { + __u8 type; + __u8 length; + struct in6_addr addr; +} __attribute__((packed)); + +typedef void ip6_icmp_send_t(struct sk_buff *, u8, u8, __u32, const struct in6_addr *, const struct inet6_skb_parm *); + +struct icmpv6_msg { + struct sk_buff *skb; + int offset; + uint8_t type; +}; + +struct icmp6_err { + int err; + int fatal; +}; + +struct mld_msg { + struct icmp6hdr mld_hdr; + struct in6_addr mld_mca; +}; + +struct mld2_grec { + __u8 grec_type; + __u8 grec_auxwords; + __be16 grec_nsrcs; + struct in6_addr grec_mca; + struct in6_addr grec_src[0]; +}; + +struct mld2_report { + struct icmp6hdr mld2r_hdr; + struct mld2_grec mld2r_grec[0]; +}; + +struct mld2_query { + struct icmp6hdr mld2q_hdr; + struct in6_addr mld2q_mca; + __u8 mld2q_qrv: 3; + __u8 mld2q_suppress: 1; + __u8 mld2q_resv2: 4; + __u8 mld2q_qqic; + __be16 mld2q_nsrcs; + struct in6_addr mld2q_srcs[0]; +}; + +struct igmp6_mc_iter_state { + struct seq_net_private p; + struct net_device *dev; + struct inet6_dev *idev; +}; + +struct igmp6_mcf_iter_state { + struct seq_net_private p; + struct net_device *dev; + struct inet6_dev *idev; + struct ifmcaddr6 *im; +}; + +enum ip6_defrag_users { + IP6_DEFRAG_LOCAL_DELIVER = 0, + IP6_DEFRAG_CONNTRACK_IN = 1, + __IP6_DEFRAG_CONNTRACK_IN = 65536, + IP6_DEFRAG_CONNTRACK_OUT = 65537, + __IP6_DEFRAG_CONNTRACK_OUT = 131072, + IP6_DEFRAG_CONNTRACK_BRIDGE_IN = 131073, + __IP6_DEFRAG_CONNTRACK_BRIDGE_IN = 196608, +}; + +struct frag_queue { + struct inet_frag_queue q; + int iif; + __u16 nhoffset; + u8 ecn; +}; + +struct tcp6_pseudohdr { + struct in6_addr saddr; + struct in6_addr daddr; + __be32 len; + __be32 protocol; +}; + +struct rt0_hdr { + struct ipv6_rt_hdr rt_hdr; + __u32 reserved; + struct in6_addr addr[0]; +}; + +struct ipv6_rpl_sr_hdr { + __u8 nexthdr; + __u8 hdrlen; + __u8 type; + __u8 segments_left; + __u32 cmpre: 4; + __u32 cmpri: 4; + __u32 reserved: 4; + __u32 pad: 4; + __u32 reserved1: 16; + union { + struct in6_addr addr[0]; + __u8 data[0]; + } segments; +}; + +struct tlvtype_proc { + int type; + bool (*func)(struct sk_buff *, int); +}; + +struct ip6fl_iter_state { + struct seq_net_private p; + struct pid_namespace *pid_ns; + int bucket; +}; + +struct sr6_tlv { + __u8 type; + __u8 len; + __u8 data[0]; +}; + +enum { + SEG6_ATTR_UNSPEC = 0, + SEG6_ATTR_DST = 1, + SEG6_ATTR_DSTLEN = 2, + SEG6_ATTR_HMACKEYID = 3, + SEG6_ATTR_SECRET = 4, + SEG6_ATTR_SECRETLEN = 5, + SEG6_ATTR_ALGID = 6, + SEG6_ATTR_HMACINFO = 7, + __SEG6_ATTR_MAX = 8, +}; + +enum { + SEG6_CMD_UNSPEC = 0, + SEG6_CMD_SETHMAC = 1, + SEG6_CMD_DUMPHMAC = 2, + SEG6_CMD_SET_TUNSRC = 3, + SEG6_CMD_GET_TUNSRC = 4, + __SEG6_CMD_MAX = 5, +}; + +struct seg6_hmac_info { + struct rhash_head node; + struct callback_head rcu; + u32 hmackeyid; + char secret[64]; + u8 slen; + u8 alg_id; +}; + +typedef short unsigned int mifi_t; + +typedef __u32 if_mask; + +struct if_set { + if_mask ifs_bits[8]; +}; + +struct mif6ctl { + mifi_t mif6c_mifi; + unsigned char mif6c_flags; + unsigned char vifc_threshold; + __u16 mif6c_pifi; + unsigned int vifc_rate_limit; +}; + +struct mf6cctl { + struct sockaddr_in6 mf6cc_origin; + struct sockaddr_in6 mf6cc_mcastgrp; + mifi_t mf6cc_parent; + struct if_set mf6cc_ifset; +}; + +struct sioc_sg_req6 { + struct sockaddr_in6 src; + struct sockaddr_in6 grp; + long unsigned int pktcnt; + long unsigned int bytecnt; + long unsigned int wrong_if; +}; + +struct sioc_mif_req6 { + mifi_t mifi; + long unsigned int icount; + long unsigned int ocount; + long unsigned int ibytes; + long unsigned int obytes; +}; + +struct mrt6msg { + __u8 im6_mbz; + __u8 im6_msgtype; + __u16 im6_mif; + __u32 im6_pad; + struct in6_addr im6_src; + struct in6_addr im6_dst; +}; + +enum { + IP6MRA_CREPORT_UNSPEC = 0, + IP6MRA_CREPORT_MSGTYPE = 1, + IP6MRA_CREPORT_MIF_ID = 2, + IP6MRA_CREPORT_SRC_ADDR = 3, + IP6MRA_CREPORT_DST_ADDR = 4, + IP6MRA_CREPORT_PKT = 5, + __IP6MRA_CREPORT_MAX = 6, +}; + +struct mfc6_cache_cmp_arg { + struct in6_addr mf6c_mcastgrp; + struct in6_addr mf6c_origin; +}; + +struct mfc6_cache { + struct mr_mfc _c; + union { + struct { + struct in6_addr mf6c_mcastgrp; + struct in6_addr mf6c_origin; + }; + struct mfc6_cache_cmp_arg cmparg; + }; +}; + +struct ip6mr_result { + struct mr_table *mrt; +}; + +struct compat_sioc_sg_req6 { + struct sockaddr_in6 src; + struct sockaddr_in6 grp; + compat_ulong_t pktcnt; + compat_ulong_t bytecnt; + compat_ulong_t wrong_if; +}; + +struct compat_sioc_mif_req6 { + mifi_t mifi; + compat_ulong_t icount; + compat_ulong_t ocount; + compat_ulong_t ibytes; + compat_ulong_t obytes; +}; + +struct xfrm6_protocol { + int (*handler)(struct sk_buff *); + int (*input_handler)(struct sk_buff *, int, __be32, int); + int (*cb_handler)(struct sk_buff *, int); + int (*err_handler)(struct sk_buff *, struct inet6_skb_parm *, u8, u8, int, __be32); + struct xfrm6_protocol *next; + int priority; +}; + +struct br_input_skb_cb { + struct net_device *brdev; + u16 frag_max_size; + u8 igmp; + u8 mrouters_only: 1; + u8 proxyarp_replied: 1; + u8 src_port_isolated: 1; + u8 vlan_filtered: 1; + u8 br_netfilter_broute: 1; + int offload_fwd_mark; +}; + +struct nf_bridge_frag_data; + +struct fib6_rule { + struct fib_rule common; + struct rt6key src; + struct rt6key dst; + u8 tclass; +}; + +struct calipso_doi; + +struct netlbl_calipso_ops { + int (*doi_add)(struct calipso_doi *, struct netlbl_audit *); + void (*doi_free)(struct calipso_doi *); + int (*doi_remove)(u32, struct netlbl_audit *); + struct calipso_doi * (*doi_getdef)(u32); + void (*doi_putdef)(struct calipso_doi *); + int (*doi_walk)(u32 *, int (*)(struct calipso_doi *, void *), void *); + int (*sock_getattr)(struct sock *, struct netlbl_lsm_secattr *); + int (*sock_setattr)(struct sock *, const struct calipso_doi *, const struct netlbl_lsm_secattr *); + void (*sock_delattr)(struct sock *); + int (*req_setattr)(struct request_sock *, const struct calipso_doi *, const struct netlbl_lsm_secattr *); + void (*req_delattr)(struct request_sock *); + int (*opt_getattr)(const unsigned char *, struct netlbl_lsm_secattr *); + unsigned char * (*skbuff_optptr)(const struct sk_buff *); + int (*skbuff_setattr)(struct sk_buff *, const struct calipso_doi *, const struct netlbl_lsm_secattr *); + int (*skbuff_delattr)(struct sk_buff *); + void (*cache_invalidate)(); + int (*cache_add)(const unsigned char *, const struct netlbl_lsm_secattr *); +}; + +struct calipso_doi { + u32 doi; + u32 type; + refcount_t refcount; + struct list_head list; + struct callback_head rcu; +}; + +struct calipso_map_cache_bkt { + spinlock_t lock; + u32 size; + struct list_head list; +}; + +struct calipso_map_cache_entry { + u32 hash; + unsigned char *key; + size_t key_len; + struct netlbl_lsm_cache *lsm_data; + u32 activity; + struct list_head list; +}; + +enum { + SEG6_IPTUNNEL_UNSPEC = 0, + SEG6_IPTUNNEL_SRH = 1, + __SEG6_IPTUNNEL_MAX = 2, +}; + +struct seg6_iptunnel_encap { + int mode; + struct ipv6_sr_hdr srh[0]; +}; + +enum { + SEG6_IPTUN_MODE_INLINE = 0, + SEG6_IPTUN_MODE_ENCAP = 1, + SEG6_IPTUN_MODE_L2ENCAP = 2, +}; + +struct seg6_lwt { + struct dst_cache cache; + struct seg6_iptunnel_encap tuninfo[0]; +}; + +enum l3mdev_type { + L3MDEV_TYPE_UNSPEC = 0, + L3MDEV_TYPE_VRF = 1, + __L3MDEV_TYPE_MAX = 2, +}; + +enum { + SEG6_LOCAL_UNSPEC = 0, + SEG6_LOCAL_ACTION = 1, + SEG6_LOCAL_SRH = 2, + SEG6_LOCAL_TABLE = 3, + SEG6_LOCAL_NH4 = 4, + SEG6_LOCAL_NH6 = 5, + SEG6_LOCAL_IIF = 6, + SEG6_LOCAL_OIF = 7, + SEG6_LOCAL_BPF = 8, + SEG6_LOCAL_VRFTABLE = 9, + __SEG6_LOCAL_MAX = 10, +}; + +enum { + SEG6_LOCAL_BPF_PROG_UNSPEC = 0, + SEG6_LOCAL_BPF_PROG = 1, + SEG6_LOCAL_BPF_PROG_NAME = 2, + __SEG6_LOCAL_BPF_PROG_MAX = 3, +}; + +struct seg6_local_lwt; + +struct seg6_local_lwtunnel_ops { + int (*build_state)(struct seg6_local_lwt *, const void *, struct netlink_ext_ack *); + void (*destroy_state)(struct seg6_local_lwt *); +}; + +enum seg6_end_dt_mode { + DT_INVALID_MODE = 4294967274, + DT_LEGACY_MODE = 0, + DT_VRF_MODE = 1, +}; + +struct seg6_end_dt_info { + enum seg6_end_dt_mode mode; + struct net *net; + int vrf_ifindex; + int vrf_table; + __be16 proto; + u16 family; + int hdrlen; +}; + +struct seg6_action_desc; + +struct seg6_local_lwt { + int action; + struct ipv6_sr_hdr *srh; + int table; + struct in_addr nh4; + struct in6_addr nh6; + int iif; + int oif; + struct bpf_lwt_prog bpf; + struct seg6_end_dt_info dt_info; + int headroom; + struct seg6_action_desc *desc; + long unsigned int parsed_optattrs; +}; + +struct seg6_action_desc { + int action; + long unsigned int attrs; + long unsigned int optattrs; + int (*input)(struct sk_buff *, struct seg6_local_lwt *); + int static_headroom; + struct seg6_local_lwtunnel_ops slwt_ops; +}; + +struct seg6_action_param { + int (*parse)(struct nlattr **, struct seg6_local_lwt *); + int (*put)(struct sk_buff *, struct seg6_local_lwt *); + int (*cmp)(struct seg6_local_lwt *, struct seg6_local_lwt *); + void (*destroy)(struct seg6_local_lwt *); +}; + +struct sr6_tlv_hmac { + struct sr6_tlv tlvhdr; + __u16 reserved; + __be32 hmackeyid; + __u8 hmac[32]; +}; + +enum { + SEG6_HMAC_ALGO_SHA1 = 1, + SEG6_HMAC_ALGO_SHA256 = 2, +}; + +struct seg6_hmac_algo { + u8 alg_id; + char name[64]; + struct crypto_shash **tfms; + struct shash_desc **shashs; +}; + +enum { + RPL_IPTUNNEL_UNSPEC = 0, + RPL_IPTUNNEL_SRH = 1, + __RPL_IPTUNNEL_MAX = 2, +}; + +struct rpl_iptunnel_encap { + struct ipv6_rpl_sr_hdr srh[0]; +}; + +struct rpl_lwt { + struct dst_cache cache; + struct rpl_iptunnel_encap tuninfo; +}; + +struct rt2_hdr { + struct ipv6_rt_hdr rt_hdr; + __u32 reserved; + struct in6_addr addr; +}; + +struct mip6_report_rate_limiter { + spinlock_t lock; + ktime_t stamp; + int iif; + struct in6_addr src; + struct in6_addr dst; +}; + +enum { + IP6_FH_F_FRAG = 1, + IP6_FH_F_AUTH = 2, + IP6_FH_F_SKIP_RH = 4, +}; + +struct sockaddr_pkt { + short unsigned int spkt_family; + unsigned char spkt_device[14]; + __be16 spkt_protocol; +}; + +struct sockaddr_ll { + short unsigned int sll_family; + __be16 sll_protocol; + int sll_ifindex; + short unsigned int sll_hatype; + unsigned char sll_pkttype; + unsigned char sll_halen; + unsigned char sll_addr[8]; +}; + +struct tpacket_stats { + unsigned int tp_packets; + unsigned int tp_drops; +}; + +struct tpacket_stats_v3 { + unsigned int tp_packets; + unsigned int tp_drops; + unsigned int tp_freeze_q_cnt; +}; + +struct tpacket_rollover_stats { + __u64 tp_all; + __u64 tp_huge; + __u64 tp_failed; +}; + +union tpacket_stats_u { + struct tpacket_stats stats1; + struct tpacket_stats_v3 stats3; +}; + +struct tpacket_auxdata { + __u32 tp_status; + __u32 tp_len; + __u32 tp_snaplen; + __u16 tp_mac; + __u16 tp_net; + __u16 tp_vlan_tci; + __u16 tp_vlan_tpid; +}; + +struct tpacket_hdr { + long unsigned int tp_status; + unsigned int tp_len; + unsigned int tp_snaplen; + short unsigned int tp_mac; + short unsigned int tp_net; + unsigned int tp_sec; + unsigned int tp_usec; +}; + +struct tpacket2_hdr { + __u32 tp_status; + __u32 tp_len; + __u32 tp_snaplen; + __u16 tp_mac; + __u16 tp_net; + __u32 tp_sec; + __u32 tp_nsec; + __u16 tp_vlan_tci; + __u16 tp_vlan_tpid; + __u8 tp_padding[4]; +}; + +struct tpacket_hdr_variant1 { + __u32 tp_rxhash; + __u32 tp_vlan_tci; + __u16 tp_vlan_tpid; + __u16 tp_padding; +}; + +struct tpacket3_hdr { + __u32 tp_next_offset; + __u32 tp_sec; + __u32 tp_nsec; + __u32 tp_snaplen; + __u32 tp_len; + __u32 tp_status; + __u16 tp_mac; + __u16 tp_net; + union { + struct tpacket_hdr_variant1 hv1; + }; + __u8 tp_padding[8]; +}; + +struct tpacket_bd_ts { + unsigned int ts_sec; + union { + unsigned int ts_usec; + unsigned int ts_nsec; + }; +}; + +struct tpacket_hdr_v1 { + __u32 block_status; + __u32 num_pkts; + __u32 offset_to_first_pkt; + __u32 blk_len; + __u64 seq_num; + struct tpacket_bd_ts ts_first_pkt; + struct tpacket_bd_ts ts_last_pkt; +}; + +union tpacket_bd_header_u { + struct tpacket_hdr_v1 bh1; +}; + +struct tpacket_block_desc { + __u32 version; + __u32 offset_to_priv; + union tpacket_bd_header_u hdr; +}; + +enum tpacket_versions { + TPACKET_V1 = 0, + TPACKET_V2 = 1, + TPACKET_V3 = 2, +}; + +struct tpacket_req { + unsigned int tp_block_size; + unsigned int tp_block_nr; + unsigned int tp_frame_size; + unsigned int tp_frame_nr; +}; + +struct tpacket_req3 { + unsigned int tp_block_size; + unsigned int tp_block_nr; + unsigned int tp_frame_size; + unsigned int tp_frame_nr; + unsigned int tp_retire_blk_tov; + unsigned int tp_sizeof_priv; + unsigned int tp_feature_req_word; +}; + +union tpacket_req_u { + struct tpacket_req req; + struct tpacket_req3 req3; +}; + +struct fanout_args { + __u16 id; + __u16 type_flags; + __u32 max_num_members; +}; + +struct virtio_net_hdr { + __u8 flags; + __u8 gso_type; + __virtio16 hdr_len; + __virtio16 gso_size; + __virtio16 csum_start; + __virtio16 csum_offset; +}; + +struct packet_mclist { + struct packet_mclist *next; + int ifindex; + int count; + short unsigned int type; + short unsigned int alen; + unsigned char addr[32]; +}; + +struct pgv; + +struct tpacket_kbdq_core { + struct pgv *pkbdq; + unsigned int feature_req_word; + unsigned int hdrlen; + unsigned char reset_pending_on_curr_blk; + unsigned char delete_blk_timer; + short unsigned int kactive_blk_num; + short unsigned int blk_sizeof_priv; + short unsigned int last_kactive_blk_num; + char *pkblk_start; + char *pkblk_end; + int kblk_size; + unsigned int max_frame_len; + unsigned int knum_blocks; + uint64_t knxt_seq_num; + char *prev; + char *nxt_offset; + struct sk_buff *skb; + rwlock_t blk_fill_in_prog_lock; + short unsigned int retire_blk_tov; + short unsigned int version; + long unsigned int tov_in_jiffies; + struct timer_list retire_blk_timer; +}; + +struct pgv { + char *buffer; +}; + +struct packet_ring_buffer { + struct pgv *pg_vec; + unsigned int head; + unsigned int frames_per_block; + unsigned int frame_size; + unsigned int frame_max; + unsigned int pg_vec_order; + unsigned int pg_vec_pages; + unsigned int pg_vec_len; + unsigned int *pending_refcnt; + union { + long unsigned int *rx_owner_map; + struct tpacket_kbdq_core prb_bdqc; + }; +}; + +struct packet_fanout { + possible_net_t net; + unsigned int num_members; + u32 max_num_members; + u16 id; + u8 type; + u8 flags; + union { + atomic_t rr_cur; + struct bpf_prog *bpf_prog; + }; + struct list_head list; + spinlock_t lock; + refcount_t sk_ref; + long: 64; + struct packet_type prot_hook; + struct sock *arr[0]; +}; + +struct packet_rollover { + int sock; + atomic_long_t num; + atomic_long_t num_huge; + atomic_long_t num_failed; + long: 64; + long: 64; + long: 64; + long: 64; + u32 history[16]; +}; + +struct packet_sock { + struct sock sk; + struct packet_fanout *fanout; + union tpacket_stats_u stats; + struct packet_ring_buffer rx_ring; + struct packet_ring_buffer tx_ring; + int copy_thresh; + spinlock_t bind_lock; + struct mutex pg_vec_lock; + unsigned int running; + unsigned int auxdata: 1; + unsigned int origdev: 1; + unsigned int has_vnet_hdr: 1; + unsigned int tp_loss: 1; + unsigned int tp_tx_has_off: 1; + int pressure; + int ifindex; + __be16 num; + struct packet_rollover *rollover; + struct packet_mclist *mclist; + atomic_t mapped; + enum tpacket_versions tp_version; + unsigned int tp_hdrlen; + unsigned int tp_reserve; + unsigned int tp_tstamp; + struct completion skb_completion; + struct net_device *cached_dev; + int (*xmit)(struct sk_buff *); + long: 64; + struct packet_type prot_hook; + atomic_t tp_drops; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct packet_mreq_max { + int mr_ifindex; + short unsigned int mr_type; + short unsigned int mr_alen; + unsigned char mr_address[32]; +}; + +union tpacket_uhdr { + struct tpacket_hdr *h1; + struct tpacket2_hdr *h2; + struct tpacket3_hdr *h3; + void *raw; +}; + +struct packet_skb_cb { + union { + struct sockaddr_pkt pkt; + union { + unsigned int origlen; + struct sockaddr_ll ll; + }; + } sa; +}; + +struct _strp_msg { + struct strp_msg strp; + int accum_len; +}; + +struct vlan_group { + unsigned int nr_vlan_devs; + struct hlist_node hlist; + struct net_device **vlan_devices_arrays[16]; +}; + +struct vlan_info { + struct net_device *real_dev; + struct vlan_group grp; + struct list_head vid_list; + unsigned int nr_vids; + struct callback_head rcu; +}; + +enum vlan_flags { + VLAN_FLAG_REORDER_HDR = 1, + VLAN_FLAG_GVRP = 2, + VLAN_FLAG_LOOSE_BINDING = 4, + VLAN_FLAG_MVRP = 8, + VLAN_FLAG_BRIDGE_BINDING = 16, +}; + +struct vlan_priority_tci_mapping { + u32 priority; + u16 vlan_qos; + struct vlan_priority_tci_mapping *next; +}; + +struct vlan_dev_priv { + unsigned int nr_ingress_mappings; + u32 ingress_priority_map[8]; + unsigned int nr_egress_mappings; + struct vlan_priority_tci_mapping *egress_priority_map[16]; + __be16 vlan_proto; + u16 vlan_id; + u16 flags; + struct net_device *real_dev; + unsigned char real_dev_addr[6]; + struct proc_dir_entry *dent; + struct vlan_pcpu_stats *vlan_pcpu_stats; + struct netpoll *netpoll; +}; + +enum vlan_protos { + VLAN_PROTO_8021Q = 0, + VLAN_PROTO_8021AD = 1, + VLAN_PROTO_NUM = 2, +}; + +struct vlan_vid_info { + struct list_head list; + __be16 proto; + u16 vid; + int refcount; +}; + +enum nl80211_iftype { + NL80211_IFTYPE_UNSPECIFIED = 0, + NL80211_IFTYPE_ADHOC = 1, + NL80211_IFTYPE_STATION = 2, + NL80211_IFTYPE_AP = 3, + NL80211_IFTYPE_AP_VLAN = 4, + NL80211_IFTYPE_WDS = 5, + NL80211_IFTYPE_MONITOR = 6, + NL80211_IFTYPE_MESH_POINT = 7, + NL80211_IFTYPE_P2P_CLIENT = 8, + NL80211_IFTYPE_P2P_GO = 9, + NL80211_IFTYPE_P2P_DEVICE = 10, + NL80211_IFTYPE_OCB = 11, + NL80211_IFTYPE_NAN = 12, + NUM_NL80211_IFTYPES = 13, + NL80211_IFTYPE_MAX = 12, +}; + +struct cfg80211_conn; + +struct cfg80211_cached_keys; + +enum ieee80211_bss_type { + IEEE80211_BSS_TYPE_ESS = 0, + IEEE80211_BSS_TYPE_PBSS = 1, + IEEE80211_BSS_TYPE_IBSS = 2, + IEEE80211_BSS_TYPE_MBSS = 3, + IEEE80211_BSS_TYPE_ANY = 4, +}; + +struct cfg80211_internal_bss; + +enum nl80211_chan_width { + NL80211_CHAN_WIDTH_20_NOHT = 0, + NL80211_CHAN_WIDTH_20 = 1, + NL80211_CHAN_WIDTH_40 = 2, + NL80211_CHAN_WIDTH_80 = 3, + NL80211_CHAN_WIDTH_80P80 = 4, + NL80211_CHAN_WIDTH_160 = 5, + NL80211_CHAN_WIDTH_5 = 6, + NL80211_CHAN_WIDTH_10 = 7, + NL80211_CHAN_WIDTH_1 = 8, + NL80211_CHAN_WIDTH_2 = 9, + NL80211_CHAN_WIDTH_4 = 10, + NL80211_CHAN_WIDTH_8 = 11, + NL80211_CHAN_WIDTH_16 = 12, +}; + +enum ieee80211_edmg_bw_config { + IEEE80211_EDMG_BW_CONFIG_4 = 4, + IEEE80211_EDMG_BW_CONFIG_5 = 5, + IEEE80211_EDMG_BW_CONFIG_6 = 6, + IEEE80211_EDMG_BW_CONFIG_7 = 7, + IEEE80211_EDMG_BW_CONFIG_8 = 8, + IEEE80211_EDMG_BW_CONFIG_9 = 9, + IEEE80211_EDMG_BW_CONFIG_10 = 10, + IEEE80211_EDMG_BW_CONFIG_11 = 11, + IEEE80211_EDMG_BW_CONFIG_12 = 12, + IEEE80211_EDMG_BW_CONFIG_13 = 13, + IEEE80211_EDMG_BW_CONFIG_14 = 14, + IEEE80211_EDMG_BW_CONFIG_15 = 15, +}; + +struct ieee80211_edmg { + u8 channels; + enum ieee80211_edmg_bw_config bw_config; +}; + +struct ieee80211_channel; + +struct cfg80211_chan_def { + struct ieee80211_channel *chan; + enum nl80211_chan_width width; + u32 center_freq1; + u32 center_freq2; + struct ieee80211_edmg edmg; + u16 freq1_offset; +}; + +struct ieee80211_mcs_info { + u8 rx_mask[10]; + __le16 rx_highest; + u8 tx_params; + u8 reserved[3]; +}; + +struct ieee80211_ht_cap { + __le16 cap_info; + u8 ampdu_params_info; + struct ieee80211_mcs_info mcs; + __le16 extended_ht_cap_info; + __le32 tx_BF_cap_info; + u8 antenna_selection_info; +} __attribute__((packed)); + +struct key_params; + +struct cfg80211_ibss_params { + const u8 *ssid; + const u8 *bssid; + struct cfg80211_chan_def chandef; + const u8 *ie; + u8 ssid_len; + u8 ie_len; + u16 beacon_interval; + u32 basic_rates; + bool channel_fixed; + bool privacy; + bool control_port; + bool control_port_over_nl80211; + bool userspace_handles_dfs; + int: 24; + int mcast_rate[5]; + struct ieee80211_ht_cap ht_capa; + struct ieee80211_ht_cap ht_capa_mask; + struct key_params *wep_keys; + int wep_tx_key; + int: 32; +} __attribute__((packed)); + +enum nl80211_auth_type { + NL80211_AUTHTYPE_OPEN_SYSTEM = 0, + NL80211_AUTHTYPE_SHARED_KEY = 1, + NL80211_AUTHTYPE_FT = 2, + NL80211_AUTHTYPE_NETWORK_EAP = 3, + NL80211_AUTHTYPE_SAE = 4, + NL80211_AUTHTYPE_FILS_SK = 5, + NL80211_AUTHTYPE_FILS_SK_PFS = 6, + NL80211_AUTHTYPE_FILS_PK = 7, + __NL80211_AUTHTYPE_NUM = 8, + NL80211_AUTHTYPE_MAX = 7, + NL80211_AUTHTYPE_AUTOMATIC = 8, +}; + +enum nl80211_mfp { + NL80211_MFP_NO = 0, + NL80211_MFP_REQUIRED = 1, + NL80211_MFP_OPTIONAL = 2, +}; + +enum nl80211_sae_pwe_mechanism { + NL80211_SAE_PWE_UNSPECIFIED = 0, + NL80211_SAE_PWE_HUNT_AND_PECK = 1, + NL80211_SAE_PWE_HASH_TO_ELEMENT = 2, + NL80211_SAE_PWE_BOTH = 3, +}; + +struct cfg80211_crypto_settings { + u32 wpa_versions; + u32 cipher_group; + int n_ciphers_pairwise; + u32 ciphers_pairwise[5]; + int n_akm_suites; + u32 akm_suites[2]; + bool control_port; + __be16 control_port_ethertype; + bool control_port_no_encrypt; + bool control_port_over_nl80211; + bool control_port_no_preauth; + struct key_params *wep_keys; + int wep_tx_key; + const u8 *psk; + const u8 *sae_pwd; + u8 sae_pwd_len; + enum nl80211_sae_pwe_mechanism sae_pwe; +}; + +struct ieee80211_vht_mcs_info { + __le16 rx_mcs_map; + __le16 rx_highest; + __le16 tx_mcs_map; + __le16 tx_highest; +}; + +struct ieee80211_vht_cap { + __le32 vht_cap_info; + struct ieee80211_vht_mcs_info supp_mcs; +}; + +enum nl80211_bss_select_attr { + __NL80211_BSS_SELECT_ATTR_INVALID = 0, + NL80211_BSS_SELECT_ATTR_RSSI = 1, + NL80211_BSS_SELECT_ATTR_BAND_PREF = 2, + NL80211_BSS_SELECT_ATTR_RSSI_ADJUST = 3, + __NL80211_BSS_SELECT_ATTR_AFTER_LAST = 4, + NL80211_BSS_SELECT_ATTR_MAX = 3, +}; + +enum nl80211_band { + NL80211_BAND_2GHZ = 0, + NL80211_BAND_5GHZ = 1, + NL80211_BAND_60GHZ = 2, + NL80211_BAND_6GHZ = 3, + NL80211_BAND_S1GHZ = 4, + NUM_NL80211_BANDS = 5, +}; + +struct cfg80211_bss_select_adjust { + enum nl80211_band band; + s8 delta; +}; + +struct cfg80211_bss_selection { + enum nl80211_bss_select_attr behaviour; + union { + enum nl80211_band band_pref; + struct cfg80211_bss_select_adjust adjust; + } param; +}; + +struct cfg80211_connect_params { + struct ieee80211_channel *channel; + struct ieee80211_channel *channel_hint; + const u8 *bssid; + const u8 *bssid_hint; + const u8 *ssid; + size_t ssid_len; + enum nl80211_auth_type auth_type; + int: 32; + const u8 *ie; + size_t ie_len; + bool privacy; + int: 24; + enum nl80211_mfp mfp; + struct cfg80211_crypto_settings crypto; + const u8 *key; + u8 key_len; + u8 key_idx; + short: 16; + u32 flags; + int bg_scan_period; + struct ieee80211_ht_cap ht_capa; + struct ieee80211_ht_cap ht_capa_mask; + struct ieee80211_vht_cap vht_capa; + struct ieee80211_vht_cap vht_capa_mask; + bool pbss; + int: 24; + struct cfg80211_bss_selection bss_select; + const u8 *prev_bssid; + const u8 *fils_erp_username; + size_t fils_erp_username_len; + const u8 *fils_erp_realm; + size_t fils_erp_realm_len; + u16 fils_erp_next_seq_num; + long: 48; + const u8 *fils_erp_rrk; + size_t fils_erp_rrk_len; + bool want_1x; + int: 24; + struct ieee80211_edmg edmg; + int: 32; +} __attribute__((packed)); + +struct cfg80211_cqm_config; + +struct wiphy; + +struct wireless_dev { + struct wiphy *wiphy; + enum nl80211_iftype iftype; + struct list_head list; + struct net_device *netdev; + u32 identifier; + struct list_head mgmt_registrations; + spinlock_t mgmt_registrations_lock; + u8 mgmt_registrations_need_update: 1; + struct mutex mtx; + bool use_4addr; + bool is_running; + u8 address[6]; + u8 ssid[32]; + u8 ssid_len; + u8 mesh_id_len; + u8 mesh_id_up_len; + struct cfg80211_conn *conn; + struct cfg80211_cached_keys *connect_keys; + enum ieee80211_bss_type conn_bss_type; + u32 conn_owner_nlportid; + struct work_struct disconnect_wk; + u8 disconnect_bssid[6]; + struct list_head event_list; + spinlock_t event_lock; + struct cfg80211_internal_bss *current_bss; + struct cfg80211_chan_def preset_chandef; + struct cfg80211_chan_def chandef; + bool ibss_fixed; + bool ibss_dfs_possible; + bool ps; + int ps_timeout; + int beacon_interval; + u32 ap_unexpected_nlportid; + u32 owner_nlportid; + bool nl_owner_dead; + bool cac_started; + long unsigned int cac_start_time; + unsigned int cac_time_ms; + struct { + struct cfg80211_ibss_params ibss; + struct cfg80211_connect_params connect; + struct cfg80211_cached_keys *keys; + const u8 *ie; + size_t ie_len; + u8 bssid[6]; + u8 prev_bssid[6]; + u8 ssid[32]; + s8 default_key; + s8 default_mgmt_key; + bool prev_bssid_valid; + } wext; + struct cfg80211_cqm_config *cqm_config; + struct list_head pmsr_list; + spinlock_t pmsr_lock; + struct work_struct pmsr_free_wk; + long unsigned int unprot_beacon_reported; +}; + +struct iw_encode_ext { + __u32 ext_flags; + __u8 tx_seq[8]; + __u8 rx_seq[8]; + struct sockaddr addr; + __u16 alg; + __u16 key_len; + __u8 key[0]; +}; + +struct iwreq { + union { + char ifrn_name[16]; + } ifr_ifrn; + union iwreq_data u; +}; + +struct iw_event { + __u16 len; + __u16 cmd; + union iwreq_data u; +}; + +struct compat_iw_point { + compat_caddr_t pointer; + __u16 length; + __u16 flags; +}; + +struct __compat_iw_event { + __u16 len; + __u16 cmd; + compat_caddr_t pointer; +}; + +enum nl80211_reg_initiator { + NL80211_REGDOM_SET_BY_CORE = 0, + NL80211_REGDOM_SET_BY_USER = 1, + NL80211_REGDOM_SET_BY_DRIVER = 2, + NL80211_REGDOM_SET_BY_COUNTRY_IE = 3, +}; + +enum nl80211_dfs_regions { + NL80211_DFS_UNSET = 0, + NL80211_DFS_FCC = 1, + NL80211_DFS_ETSI = 2, + NL80211_DFS_JP = 3, +}; + +enum nl80211_user_reg_hint_type { + NL80211_USER_REG_HINT_USER = 0, + NL80211_USER_REG_HINT_CELL_BASE = 1, + NL80211_USER_REG_HINT_INDOOR = 2, +}; + +enum nl80211_mntr_flags { + __NL80211_MNTR_FLAG_INVALID = 0, + NL80211_MNTR_FLAG_FCSFAIL = 1, + NL80211_MNTR_FLAG_PLCPFAIL = 2, + NL80211_MNTR_FLAG_CONTROL = 3, + NL80211_MNTR_FLAG_OTHER_BSS = 4, + NL80211_MNTR_FLAG_COOK_FRAMES = 5, + NL80211_MNTR_FLAG_ACTIVE = 6, + __NL80211_MNTR_FLAG_AFTER_LAST = 7, + NL80211_MNTR_FLAG_MAX = 6, +}; + +enum nl80211_key_mode { + NL80211_KEY_RX_TX = 0, + NL80211_KEY_NO_TX = 1, + NL80211_KEY_SET_TX = 2, +}; + +enum nl80211_bss_scan_width { + NL80211_BSS_CHAN_WIDTH_20 = 0, + NL80211_BSS_CHAN_WIDTH_10 = 1, + NL80211_BSS_CHAN_WIDTH_5 = 2, + NL80211_BSS_CHAN_WIDTH_1 = 3, + NL80211_BSS_CHAN_WIDTH_2 = 4, +}; + +struct nl80211_wowlan_tcp_data_seq { + __u32 start; + __u32 offset; + __u32 len; +}; + +struct nl80211_wowlan_tcp_data_token { + __u32 offset; + __u32 len; + __u8 token_stream[0]; +}; + +struct nl80211_wowlan_tcp_data_token_feature { + __u32 min_len; + __u32 max_len; + __u32 bufsize; +}; + +enum nl80211_ext_feature_index { + NL80211_EXT_FEATURE_VHT_IBSS = 0, + NL80211_EXT_FEATURE_RRM = 1, + NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER = 2, + NL80211_EXT_FEATURE_SCAN_START_TIME = 3, + NL80211_EXT_FEATURE_BSS_PARENT_TSF = 4, + NL80211_EXT_FEATURE_SET_SCAN_DWELL = 5, + NL80211_EXT_FEATURE_BEACON_RATE_LEGACY = 6, + NL80211_EXT_FEATURE_BEACON_RATE_HT = 7, + NL80211_EXT_FEATURE_BEACON_RATE_VHT = 8, + NL80211_EXT_FEATURE_FILS_STA = 9, + NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA = 10, + NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED = 11, + NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI = 12, + NL80211_EXT_FEATURE_CQM_RSSI_LIST = 13, + NL80211_EXT_FEATURE_FILS_SK_OFFLOAD = 14, + NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK = 15, + NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X = 16, + NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME = 17, + NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP = 18, + NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE = 19, + NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION = 20, + NL80211_EXT_FEATURE_MFP_OPTIONAL = 21, + NL80211_EXT_FEATURE_LOW_SPAN_SCAN = 22, + NL80211_EXT_FEATURE_LOW_POWER_SCAN = 23, + NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN = 24, + NL80211_EXT_FEATURE_DFS_OFFLOAD = 25, + NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211 = 26, + NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT = 27, + NL80211_EXT_FEATURE_DATA_ACK_SIGNAL_SUPPORT = 27, + NL80211_EXT_FEATURE_TXQS = 28, + NL80211_EXT_FEATURE_SCAN_RANDOM_SN = 29, + NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT = 30, + NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 = 31, + NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER = 32, + NL80211_EXT_FEATURE_AIRTIME_FAIRNESS = 33, + NL80211_EXT_FEATURE_AP_PMKSA_CACHING = 34, + NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD = 35, + NL80211_EXT_FEATURE_EXT_KEY_ID = 36, + NL80211_EXT_FEATURE_STA_TX_PWR = 37, + NL80211_EXT_FEATURE_SAE_OFFLOAD = 38, + NL80211_EXT_FEATURE_VLAN_OFFLOAD = 39, + NL80211_EXT_FEATURE_AQL = 40, + NL80211_EXT_FEATURE_BEACON_PROTECTION = 41, + NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH = 42, + NL80211_EXT_FEATURE_PROTECTED_TWT = 43, + NL80211_EXT_FEATURE_DEL_IBSS_STA = 44, + NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS = 45, + NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT = 46, + NL80211_EXT_FEATURE_SCAN_FREQ_KHZ = 47, + NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211_TX_STATUS = 48, + NL80211_EXT_FEATURE_OPERATING_CHANNEL_VALIDATION = 49, + NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK = 50, + NL80211_EXT_FEATURE_SAE_OFFLOAD_AP = 51, + NL80211_EXT_FEATURE_FILS_DISCOVERY = 52, + NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP = 53, + NL80211_EXT_FEATURE_BEACON_RATE_HE = 54, + NUM_NL80211_EXT_FEATURES = 55, + MAX_NL80211_EXT_FEATURES = 54, +}; + +enum nl80211_dfs_state { + NL80211_DFS_USABLE = 0, + NL80211_DFS_UNAVAILABLE = 1, + NL80211_DFS_AVAILABLE = 2, +}; + +struct nl80211_vendor_cmd_info { + __u32 vendor_id; + __u32 subcmd; +}; + +enum nl80211_sar_type { + NL80211_SAR_TYPE_POWER = 0, + NUM_NL80211_SAR_TYPE = 1, +}; + +struct ieee80211_he_cap_elem { + u8 mac_cap_info[6]; + u8 phy_cap_info[11]; +}; + +struct ieee80211_he_mcs_nss_supp { + __le16 rx_mcs_80; + __le16 tx_mcs_80; + __le16 rx_mcs_160; + __le16 tx_mcs_160; + __le16 rx_mcs_80p80; + __le16 tx_mcs_80p80; +}; + +struct ieee80211_he_6ghz_capa { + __le16 capa; +}; + +enum environment_cap { + ENVIRON_ANY = 0, + ENVIRON_INDOOR = 1, + ENVIRON_OUTDOOR = 2, +}; + +struct regulatory_request { + struct callback_head callback_head; + int wiphy_idx; + enum nl80211_reg_initiator initiator; + enum nl80211_user_reg_hint_type user_reg_hint_type; + char alpha2[3]; + enum nl80211_dfs_regions dfs_region; + bool intersect; + bool processed; + enum environment_cap country_ie_env; + struct list_head list; +}; + +struct ieee80211_freq_range { + u32 start_freq_khz; + u32 end_freq_khz; + u32 max_bandwidth_khz; +}; + +struct ieee80211_power_rule { + u32 max_antenna_gain; + u32 max_eirp; +}; + +struct ieee80211_wmm_ac { + u16 cw_min; + u16 cw_max; + u16 cot; + u8 aifsn; +}; + +struct ieee80211_wmm_rule { + struct ieee80211_wmm_ac client[4]; + struct ieee80211_wmm_ac ap[4]; +}; + +struct ieee80211_reg_rule { + struct ieee80211_freq_range freq_range; + struct ieee80211_power_rule power_rule; + struct ieee80211_wmm_rule wmm_rule; + u32 flags; + u32 dfs_cac_ms; + bool has_wmm; +}; + +struct ieee80211_regdomain { + struct callback_head callback_head; + u32 n_reg_rules; + char alpha2[3]; + enum nl80211_dfs_regions dfs_region; + struct ieee80211_reg_rule reg_rules[0]; +}; + +struct ieee80211_channel { + enum nl80211_band band; + u32 center_freq; + u16 freq_offset; + u16 hw_value; + u32 flags; + int max_antenna_gain; + int max_power; + int max_reg_power; + bool beacon_found; + u32 orig_flags; + int orig_mag; + int orig_mpwr; + enum nl80211_dfs_state dfs_state; + long unsigned int dfs_state_entered; + unsigned int dfs_cac_ms; +}; + +struct ieee80211_rate { + u32 flags; + u16 bitrate; + u16 hw_value; + u16 hw_value_short; +}; + +struct ieee80211_sta_ht_cap { + u16 cap; + bool ht_supported; + u8 ampdu_factor; + u8 ampdu_density; + struct ieee80211_mcs_info mcs; + char: 8; +} __attribute__((packed)); + +struct ieee80211_sta_vht_cap { + bool vht_supported; + u32 cap; + struct ieee80211_vht_mcs_info vht_mcs; +}; + +struct ieee80211_sta_he_cap { + bool has_he; + struct ieee80211_he_cap_elem he_cap_elem; + struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; + u8 ppe_thres[25]; +} __attribute__((packed)); + +struct ieee80211_sband_iftype_data { + u16 types_mask; + struct ieee80211_sta_he_cap he_cap; + struct ieee80211_he_6ghz_capa he_6ghz_capa; + char: 8; +} __attribute__((packed)); + +struct ieee80211_sta_s1g_cap { + bool s1g; + u8 cap[10]; + u8 nss_mcs[5]; +}; + +struct ieee80211_supported_band { + struct ieee80211_channel *channels; + struct ieee80211_rate *bitrates; + enum nl80211_band band; + int n_channels; + int n_bitrates; + struct ieee80211_sta_ht_cap ht_cap; + struct ieee80211_sta_vht_cap vht_cap; + struct ieee80211_sta_s1g_cap s1g_cap; + struct ieee80211_edmg edmg_cap; + u16 n_iftype_data; + const struct ieee80211_sband_iftype_data *iftype_data; +}; + +struct key_params { + const u8 *key; + const u8 *seq; + int key_len; + int seq_len; + u16 vlan_id; + u32 cipher; + enum nl80211_key_mode mode; +}; + +struct mac_address { + u8 addr[6]; +}; + +struct cfg80211_sar_freq_ranges { + u32 start_freq; + u32 end_freq; +}; + +struct cfg80211_sar_capa { + enum nl80211_sar_type type; + u32 num_freq_ranges; + const struct cfg80211_sar_freq_ranges *freq_ranges; +}; + +struct cfg80211_ssid { + u8 ssid[32]; + u8 ssid_len; +}; + +enum cfg80211_signal_type { + CFG80211_SIGNAL_TYPE_NONE = 0, + CFG80211_SIGNAL_TYPE_MBM = 1, + CFG80211_SIGNAL_TYPE_UNSPEC = 2, +}; + +struct ieee80211_txrx_stypes; + +struct ieee80211_iface_combination; + +struct wiphy_iftype_akm_suites; + +struct wiphy_wowlan_support; + +struct cfg80211_wowlan; + +struct wiphy_iftype_ext_capab; + +struct wiphy_coalesce_support; + +struct wiphy_vendor_command; + +struct cfg80211_pmsr_capabilities; + +struct wiphy { + u8 perm_addr[6]; + u8 addr_mask[6]; + struct mac_address *addresses; + const struct ieee80211_txrx_stypes *mgmt_stypes; + const struct ieee80211_iface_combination *iface_combinations; + int n_iface_combinations; + u16 software_iftypes; + u16 n_addresses; + u16 interface_modes; + u16 max_acl_mac_addrs; + u32 flags; + u32 regulatory_flags; + u32 features; + u8 ext_features[7]; + u32 ap_sme_capa; + enum cfg80211_signal_type signal_type; + int bss_priv_size; + u8 max_scan_ssids; + u8 max_sched_scan_reqs; + u8 max_sched_scan_ssids; + u8 max_match_sets; + u16 max_scan_ie_len; + u16 max_sched_scan_ie_len; + u32 max_sched_scan_plans; + u32 max_sched_scan_plan_interval; + u32 max_sched_scan_plan_iterations; + int n_cipher_suites; + const u32 *cipher_suites; + int n_akm_suites; + const u32 *akm_suites; + const struct wiphy_iftype_akm_suites *iftype_akm_suites; + unsigned int num_iftype_akm_suites; + u8 retry_short; + u8 retry_long; + u32 frag_threshold; + u32 rts_threshold; + u8 coverage_class; + char fw_version[32]; + u32 hw_version; + const struct wiphy_wowlan_support *wowlan; + struct cfg80211_wowlan *wowlan_config; + u16 max_remain_on_channel_duration; + u8 max_num_pmkids; + u32 available_antennas_tx; + u32 available_antennas_rx; + u32 probe_resp_offload; + const u8 *extended_capabilities; + const u8 *extended_capabilities_mask; + u8 extended_capabilities_len; + const struct wiphy_iftype_ext_capab *iftype_ext_capab; + unsigned int num_iftype_ext_capab; + const void *privid; + struct ieee80211_supported_band *bands[5]; + void (*reg_notifier)(struct wiphy *, struct regulatory_request *); + const struct ieee80211_regdomain *regd; + struct device dev; + bool registered; + struct dentry *debugfsdir; + const struct ieee80211_ht_cap *ht_capa_mod_mask; + const struct ieee80211_vht_cap *vht_capa_mod_mask; + struct list_head wdev_list; + possible_net_t _net; + const struct iw_handler_def *wext; + const struct wiphy_coalesce_support *coalesce; + const struct wiphy_vendor_command *vendor_commands; + const struct nl80211_vendor_cmd_info *vendor_events; + int n_vendor_commands; + int n_vendor_events; + u16 max_ap_assoc_sta; + u8 max_num_csa_counters; + u32 bss_select_support; + u8 nan_supported_bands; + u32 txq_limit; + u32 txq_memory_limit; + u32 txq_quantum; + long unsigned int tx_queue_len; + u8 support_mbssid: 1; + u8 support_only_he_mbssid: 1; + const struct cfg80211_pmsr_capabilities *pmsr_capa; + struct { + u64 peer; + u64 vif; + u8 max_retry; + } tid_config_support; + u8 max_data_retry_count; + const struct cfg80211_sar_capa *sar_capa; + long: 64; + long: 64; + long: 64; + char priv[0]; +}; + +struct cfg80211_match_set { + struct cfg80211_ssid ssid; + u8 bssid[6]; + s32 rssi_thold; + s32 per_band_rssi_thold[5]; +}; + +struct cfg80211_sched_scan_plan { + u32 interval; + u32 iterations; +}; + +struct cfg80211_sched_scan_request { + u64 reqid; + struct cfg80211_ssid *ssids; + int n_ssids; + u32 n_channels; + enum nl80211_bss_scan_width scan_width; + const u8 *ie; + size_t ie_len; + u32 flags; + struct cfg80211_match_set *match_sets; + int n_match_sets; + s32 min_rssi_thold; + u32 delay; + struct cfg80211_sched_scan_plan *scan_plans; + int n_scan_plans; + u8 mac_addr[6]; + u8 mac_addr_mask[6]; + bool relative_rssi_set; + s8 relative_rssi; + struct cfg80211_bss_select_adjust rssi_adjust; + struct wiphy *wiphy; + struct net_device *dev; + long unsigned int scan_start; + bool report_results; + struct callback_head callback_head; + u32 owner_nlportid; + bool nl_owner_dead; + struct list_head list; + struct ieee80211_channel *channels[0]; +}; + +struct cfg80211_pkt_pattern { + const u8 *mask; + const u8 *pattern; + int pattern_len; + int pkt_offset; +}; + +struct cfg80211_wowlan_tcp { + struct socket *sock; + __be32 src; + __be32 dst; + u16 src_port; + u16 dst_port; + u8 dst_mac[6]; + int payload_len; + const u8 *payload; + struct nl80211_wowlan_tcp_data_seq payload_seq; + u32 data_interval; + u32 wake_len; + const u8 *wake_data; + const u8 *wake_mask; + u32 tokens_size; + struct nl80211_wowlan_tcp_data_token payload_tok; +}; + +struct cfg80211_wowlan { + bool any; + bool disconnect; + bool magic_pkt; + bool gtk_rekey_failure; + bool eap_identity_req; + bool four_way_handshake; + bool rfkill_release; + struct cfg80211_pkt_pattern *patterns; + struct cfg80211_wowlan_tcp *tcp; + int n_patterns; + struct cfg80211_sched_scan_request *nd_config; +}; + +struct ieee80211_iface_limit { + u16 max; + u16 types; +}; + +struct ieee80211_iface_combination { + const struct ieee80211_iface_limit *limits; + u32 num_different_channels; + u16 max_interfaces; + u8 n_limits; + bool beacon_int_infra_match; + u8 radar_detect_widths; + u8 radar_detect_regions; + u32 beacon_int_min_gcd; +}; + +struct ieee80211_txrx_stypes { + u16 tx; + u16 rx; +}; + +struct wiphy_wowlan_tcp_support { + const struct nl80211_wowlan_tcp_data_token_feature *tok; + u32 data_payload_max; + u32 data_interval_max; + u32 wake_payload_max; + bool seq; +}; + +struct wiphy_wowlan_support { + u32 flags; + int n_patterns; + int pattern_max_len; + int pattern_min_len; + int max_pkt_offset; + int max_nd_match_sets; + const struct wiphy_wowlan_tcp_support *tcp; +}; + +struct wiphy_coalesce_support { + int n_rules; + int max_delay; + int n_patterns; + int pattern_max_len; + int pattern_min_len; + int max_pkt_offset; +}; + +struct wiphy_vendor_command { + struct nl80211_vendor_cmd_info info; + u32 flags; + int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int); + int (*dumpit)(struct wiphy *, struct wireless_dev *, struct sk_buff *, const void *, int, long unsigned int *); + const struct nla_policy *policy; + unsigned int maxattr; +}; + +struct wiphy_iftype_ext_capab { + enum nl80211_iftype iftype; + const u8 *extended_capabilities; + const u8 *extended_capabilities_mask; + u8 extended_capabilities_len; +}; + +struct cfg80211_pmsr_capabilities { + unsigned int max_peers; + u8 report_ap_tsf: 1; + u8 randomize_mac_addr: 1; + struct { + u32 preambles; + u32 bandwidths; + s8 max_bursts_exponent; + u8 max_ftms_per_burst; + u8 supported: 1; + u8 asap: 1; + u8 non_asap: 1; + u8 request_lci: 1; + u8 request_civicloc: 1; + u8 trigger_based: 1; + u8 non_trigger_based: 1; + } ftm; +}; + +struct wiphy_iftype_akm_suites { + u16 iftypes_mask; + const u32 *akm_suites; + int n_akm_suites; +}; + +struct iw_ioctl_description { + __u8 header_type; + __u8 token_type; + __u16 token_size; + __u16 min_tokens; + __u16 max_tokens; + __u32 flags; +}; + +typedef int (*wext_ioctl_func)(struct net_device *, struct iwreq *, unsigned int, struct iw_request_info *, iw_handler); + +struct iw_thrspy { + struct sockaddr addr; + struct iw_quality qual; + struct iw_quality low; + struct iw_quality high; +}; + +struct netlbl_af4list { + __be32 addr; + __be32 mask; + u32 valid; + struct list_head list; +}; + +struct netlbl_af6list { + struct in6_addr addr; + struct in6_addr mask; + u32 valid; + struct list_head list; +}; + +struct netlbl_domaddr_map { + struct list_head list4; + struct list_head list6; +}; + +struct netlbl_dommap_def { + u32 type; + union { + struct netlbl_domaddr_map *addrsel; + struct cipso_v4_doi *cipso; + struct calipso_doi *calipso; + }; +}; + +struct netlbl_domaddr4_map { + struct netlbl_dommap_def def; + struct netlbl_af4list list; +}; + +struct netlbl_domaddr6_map { + struct netlbl_dommap_def def; + struct netlbl_af6list list; +}; + +struct netlbl_dom_map { + char *domain; + u16 family; + struct netlbl_dommap_def def; + u32 valid; + struct list_head list; + struct callback_head rcu; +}; + +struct netlbl_domhsh_tbl { + struct list_head *tbl; + u32 size; +}; + +enum { + NLBL_MGMT_C_UNSPEC = 0, + NLBL_MGMT_C_ADD = 1, + NLBL_MGMT_C_REMOVE = 2, + NLBL_MGMT_C_LISTALL = 3, + NLBL_MGMT_C_ADDDEF = 4, + NLBL_MGMT_C_REMOVEDEF = 5, + NLBL_MGMT_C_LISTDEF = 6, + NLBL_MGMT_C_PROTOCOLS = 7, + NLBL_MGMT_C_VERSION = 8, + __NLBL_MGMT_C_MAX = 9, +}; + +enum { + NLBL_MGMT_A_UNSPEC = 0, + NLBL_MGMT_A_DOMAIN = 1, + NLBL_MGMT_A_PROTOCOL = 2, + NLBL_MGMT_A_VERSION = 3, + NLBL_MGMT_A_CV4DOI = 4, + NLBL_MGMT_A_IPV6ADDR = 5, + NLBL_MGMT_A_IPV6MASK = 6, + NLBL_MGMT_A_IPV4ADDR = 7, + NLBL_MGMT_A_IPV4MASK = 8, + NLBL_MGMT_A_ADDRSELECTOR = 9, + NLBL_MGMT_A_SELECTORLIST = 10, + NLBL_MGMT_A_FAMILY = 11, + NLBL_MGMT_A_CLPDOI = 12, + __NLBL_MGMT_A_MAX = 13, +}; + +struct netlbl_domhsh_walk_arg { + struct netlink_callback *nl_cb; + struct sk_buff *skb; + u32 seq; +}; + +enum { + NLBL_UNLABEL_C_UNSPEC = 0, + NLBL_UNLABEL_C_ACCEPT = 1, + NLBL_UNLABEL_C_LIST = 2, + NLBL_UNLABEL_C_STATICADD = 3, + NLBL_UNLABEL_C_STATICREMOVE = 4, + NLBL_UNLABEL_C_STATICLIST = 5, + NLBL_UNLABEL_C_STATICADDDEF = 6, + NLBL_UNLABEL_C_STATICREMOVEDEF = 7, + NLBL_UNLABEL_C_STATICLISTDEF = 8, + __NLBL_UNLABEL_C_MAX = 9, +}; + +enum { + NLBL_UNLABEL_A_UNSPEC = 0, + NLBL_UNLABEL_A_ACPTFLG = 1, + NLBL_UNLABEL_A_IPV6ADDR = 2, + NLBL_UNLABEL_A_IPV6MASK = 3, + NLBL_UNLABEL_A_IPV4ADDR = 4, + NLBL_UNLABEL_A_IPV4MASK = 5, + NLBL_UNLABEL_A_IFACE = 6, + NLBL_UNLABEL_A_SECCTX = 7, + __NLBL_UNLABEL_A_MAX = 8, +}; + +struct netlbl_unlhsh_tbl { + struct list_head *tbl; + u32 size; +}; + +struct netlbl_unlhsh_addr4 { + u32 secid; + struct netlbl_af4list list; + struct callback_head rcu; +}; + +struct netlbl_unlhsh_addr6 { + u32 secid; + struct netlbl_af6list list; + struct callback_head rcu; +}; + +struct netlbl_unlhsh_iface { + int ifindex; + struct list_head addr4_list; + struct list_head addr6_list; + u32 valid; + struct list_head list; + struct callback_head rcu; +}; + +struct netlbl_unlhsh_walk_arg { + struct netlink_callback *nl_cb; + struct sk_buff *skb; + u32 seq; +}; + +enum { + NLBL_CIPSOV4_C_UNSPEC = 0, + NLBL_CIPSOV4_C_ADD = 1, + NLBL_CIPSOV4_C_REMOVE = 2, + NLBL_CIPSOV4_C_LIST = 3, + NLBL_CIPSOV4_C_LISTALL = 4, + __NLBL_CIPSOV4_C_MAX = 5, +}; + +enum { + NLBL_CIPSOV4_A_UNSPEC = 0, + NLBL_CIPSOV4_A_DOI = 1, + NLBL_CIPSOV4_A_MTYPE = 2, + NLBL_CIPSOV4_A_TAG = 3, + NLBL_CIPSOV4_A_TAGLST = 4, + NLBL_CIPSOV4_A_MLSLVLLOC = 5, + NLBL_CIPSOV4_A_MLSLVLREM = 6, + NLBL_CIPSOV4_A_MLSLVL = 7, + NLBL_CIPSOV4_A_MLSLVLLST = 8, + NLBL_CIPSOV4_A_MLSCATLOC = 9, + NLBL_CIPSOV4_A_MLSCATREM = 10, + NLBL_CIPSOV4_A_MLSCAT = 11, + NLBL_CIPSOV4_A_MLSCATLST = 12, + __NLBL_CIPSOV4_A_MAX = 13, +}; + +struct netlbl_cipsov4_doiwalk_arg { + struct netlink_callback *nl_cb; + struct sk_buff *skb; + u32 seq; +}; + +struct netlbl_domhsh_walk_arg___2 { + struct netlbl_audit *audit_info; + u32 doi; +}; + +enum { + NLBL_CALIPSO_C_UNSPEC = 0, + NLBL_CALIPSO_C_ADD = 1, + NLBL_CALIPSO_C_REMOVE = 2, + NLBL_CALIPSO_C_LIST = 3, + NLBL_CALIPSO_C_LISTALL = 4, + __NLBL_CALIPSO_C_MAX = 5, +}; + +enum { + NLBL_CALIPSO_A_UNSPEC = 0, + NLBL_CALIPSO_A_DOI = 1, + NLBL_CALIPSO_A_MTYPE = 2, + __NLBL_CALIPSO_A_MAX = 3, +}; + +struct netlbl_calipso_doiwalk_arg { + struct netlink_callback *nl_cb; + struct sk_buff *skb; + u32 seq; +}; + +struct dcbmsg { + __u8 dcb_family; + __u8 cmd; + __u16 dcb_pad; +}; + +enum dcbnl_commands { + DCB_CMD_UNDEFINED = 0, + DCB_CMD_GSTATE = 1, + DCB_CMD_SSTATE = 2, + DCB_CMD_PGTX_GCFG = 3, + DCB_CMD_PGTX_SCFG = 4, + DCB_CMD_PGRX_GCFG = 5, + DCB_CMD_PGRX_SCFG = 6, + DCB_CMD_PFC_GCFG = 7, + DCB_CMD_PFC_SCFG = 8, + DCB_CMD_SET_ALL = 9, + DCB_CMD_GPERM_HWADDR = 10, + DCB_CMD_GCAP = 11, + DCB_CMD_GNUMTCS = 12, + DCB_CMD_SNUMTCS = 13, + DCB_CMD_PFC_GSTATE = 14, + DCB_CMD_PFC_SSTATE = 15, + DCB_CMD_BCN_GCFG = 16, + DCB_CMD_BCN_SCFG = 17, + DCB_CMD_GAPP = 18, + DCB_CMD_SAPP = 19, + DCB_CMD_IEEE_SET = 20, + DCB_CMD_IEEE_GET = 21, + DCB_CMD_GDCBX = 22, + DCB_CMD_SDCBX = 23, + DCB_CMD_GFEATCFG = 24, + DCB_CMD_SFEATCFG = 25, + DCB_CMD_CEE_GET = 26, + DCB_CMD_IEEE_DEL = 27, + __DCB_CMD_ENUM_MAX = 28, + DCB_CMD_MAX = 27, +}; + +enum dcbnl_attrs { + DCB_ATTR_UNDEFINED = 0, + DCB_ATTR_IFNAME = 1, + DCB_ATTR_STATE = 2, + DCB_ATTR_PFC_STATE = 3, + DCB_ATTR_PFC_CFG = 4, + DCB_ATTR_NUM_TC = 5, + DCB_ATTR_PG_CFG = 6, + DCB_ATTR_SET_ALL = 7, + DCB_ATTR_PERM_HWADDR = 8, + DCB_ATTR_CAP = 9, + DCB_ATTR_NUMTCS = 10, + DCB_ATTR_BCN = 11, + DCB_ATTR_APP = 12, + DCB_ATTR_IEEE = 13, + DCB_ATTR_DCBX = 14, + DCB_ATTR_FEATCFG = 15, + DCB_ATTR_CEE = 16, + __DCB_ATTR_ENUM_MAX = 17, + DCB_ATTR_MAX = 16, +}; + +enum ieee_attrs { + DCB_ATTR_IEEE_UNSPEC = 0, + DCB_ATTR_IEEE_ETS = 1, + DCB_ATTR_IEEE_PFC = 2, + DCB_ATTR_IEEE_APP_TABLE = 3, + DCB_ATTR_IEEE_PEER_ETS = 4, + DCB_ATTR_IEEE_PEER_PFC = 5, + DCB_ATTR_IEEE_PEER_APP = 6, + DCB_ATTR_IEEE_MAXRATE = 7, + DCB_ATTR_IEEE_QCN = 8, + DCB_ATTR_IEEE_QCN_STATS = 9, + DCB_ATTR_DCB_BUFFER = 10, + __DCB_ATTR_IEEE_MAX = 11, +}; + +enum ieee_attrs_app { + DCB_ATTR_IEEE_APP_UNSPEC = 0, + DCB_ATTR_IEEE_APP = 1, + __DCB_ATTR_IEEE_APP_MAX = 2, +}; + +enum cee_attrs { + DCB_ATTR_CEE_UNSPEC = 0, + DCB_ATTR_CEE_PEER_PG = 1, + DCB_ATTR_CEE_PEER_PFC = 2, + DCB_ATTR_CEE_PEER_APP_TABLE = 3, + DCB_ATTR_CEE_TX_PG = 4, + DCB_ATTR_CEE_RX_PG = 5, + DCB_ATTR_CEE_PFC = 6, + DCB_ATTR_CEE_APP_TABLE = 7, + DCB_ATTR_CEE_FEAT = 8, + __DCB_ATTR_CEE_MAX = 9, +}; + +enum peer_app_attr { + DCB_ATTR_CEE_PEER_APP_UNSPEC = 0, + DCB_ATTR_CEE_PEER_APP_INFO = 1, + DCB_ATTR_CEE_PEER_APP = 2, + __DCB_ATTR_CEE_PEER_APP_MAX = 3, +}; + +enum dcbnl_pfc_up_attrs { + DCB_PFC_UP_ATTR_UNDEFINED = 0, + DCB_PFC_UP_ATTR_0 = 1, + DCB_PFC_UP_ATTR_1 = 2, + DCB_PFC_UP_ATTR_2 = 3, + DCB_PFC_UP_ATTR_3 = 4, + DCB_PFC_UP_ATTR_4 = 5, + DCB_PFC_UP_ATTR_5 = 6, + DCB_PFC_UP_ATTR_6 = 7, + DCB_PFC_UP_ATTR_7 = 8, + DCB_PFC_UP_ATTR_ALL = 9, + __DCB_PFC_UP_ATTR_ENUM_MAX = 10, + DCB_PFC_UP_ATTR_MAX = 9, +}; + +enum dcbnl_pg_attrs { + DCB_PG_ATTR_UNDEFINED = 0, + DCB_PG_ATTR_TC_0 = 1, + DCB_PG_ATTR_TC_1 = 2, + DCB_PG_ATTR_TC_2 = 3, + DCB_PG_ATTR_TC_3 = 4, + DCB_PG_ATTR_TC_4 = 5, + DCB_PG_ATTR_TC_5 = 6, + DCB_PG_ATTR_TC_6 = 7, + DCB_PG_ATTR_TC_7 = 8, + DCB_PG_ATTR_TC_MAX = 9, + DCB_PG_ATTR_TC_ALL = 10, + DCB_PG_ATTR_BW_ID_0 = 11, + DCB_PG_ATTR_BW_ID_1 = 12, + DCB_PG_ATTR_BW_ID_2 = 13, + DCB_PG_ATTR_BW_ID_3 = 14, + DCB_PG_ATTR_BW_ID_4 = 15, + DCB_PG_ATTR_BW_ID_5 = 16, + DCB_PG_ATTR_BW_ID_6 = 17, + DCB_PG_ATTR_BW_ID_7 = 18, + DCB_PG_ATTR_BW_ID_MAX = 19, + DCB_PG_ATTR_BW_ID_ALL = 20, + __DCB_PG_ATTR_ENUM_MAX = 21, + DCB_PG_ATTR_MAX = 20, +}; + +enum dcbnl_tc_attrs { + DCB_TC_ATTR_PARAM_UNDEFINED = 0, + DCB_TC_ATTR_PARAM_PGID = 1, + DCB_TC_ATTR_PARAM_UP_MAPPING = 2, + DCB_TC_ATTR_PARAM_STRICT_PRIO = 3, + DCB_TC_ATTR_PARAM_BW_PCT = 4, + DCB_TC_ATTR_PARAM_ALL = 5, + __DCB_TC_ATTR_PARAM_ENUM_MAX = 6, + DCB_TC_ATTR_PARAM_MAX = 5, +}; + +enum dcbnl_cap_attrs { + DCB_CAP_ATTR_UNDEFINED = 0, + DCB_CAP_ATTR_ALL = 1, + DCB_CAP_ATTR_PG = 2, + DCB_CAP_ATTR_PFC = 3, + DCB_CAP_ATTR_UP2TC = 4, + DCB_CAP_ATTR_PG_TCS = 5, + DCB_CAP_ATTR_PFC_TCS = 6, + DCB_CAP_ATTR_GSP = 7, + DCB_CAP_ATTR_BCN = 8, + DCB_CAP_ATTR_DCBX = 9, + __DCB_CAP_ATTR_ENUM_MAX = 10, + DCB_CAP_ATTR_MAX = 9, +}; + +enum dcbnl_numtcs_attrs { + DCB_NUMTCS_ATTR_UNDEFINED = 0, + DCB_NUMTCS_ATTR_ALL = 1, + DCB_NUMTCS_ATTR_PG = 2, + DCB_NUMTCS_ATTR_PFC = 3, + __DCB_NUMTCS_ATTR_ENUM_MAX = 4, + DCB_NUMTCS_ATTR_MAX = 3, +}; + +enum dcbnl_bcn_attrs { + DCB_BCN_ATTR_UNDEFINED = 0, + DCB_BCN_ATTR_RP_0 = 1, + DCB_BCN_ATTR_RP_1 = 2, + DCB_BCN_ATTR_RP_2 = 3, + DCB_BCN_ATTR_RP_3 = 4, + DCB_BCN_ATTR_RP_4 = 5, + DCB_BCN_ATTR_RP_5 = 6, + DCB_BCN_ATTR_RP_6 = 7, + DCB_BCN_ATTR_RP_7 = 8, + DCB_BCN_ATTR_RP_ALL = 9, + DCB_BCN_ATTR_BCNA_0 = 10, + DCB_BCN_ATTR_BCNA_1 = 11, + DCB_BCN_ATTR_ALPHA = 12, + DCB_BCN_ATTR_BETA = 13, + DCB_BCN_ATTR_GD = 14, + DCB_BCN_ATTR_GI = 15, + DCB_BCN_ATTR_TMAX = 16, + DCB_BCN_ATTR_TD = 17, + DCB_BCN_ATTR_RMIN = 18, + DCB_BCN_ATTR_W = 19, + DCB_BCN_ATTR_RD = 20, + DCB_BCN_ATTR_RU = 21, + DCB_BCN_ATTR_WRTT = 22, + DCB_BCN_ATTR_RI = 23, + DCB_BCN_ATTR_C = 24, + DCB_BCN_ATTR_ALL = 25, + __DCB_BCN_ATTR_ENUM_MAX = 26, + DCB_BCN_ATTR_MAX = 25, +}; + +enum dcb_general_attr_values { + DCB_ATTR_VALUE_UNDEFINED = 255, +}; + +enum dcbnl_app_attrs { + DCB_APP_ATTR_UNDEFINED = 0, + DCB_APP_ATTR_IDTYPE = 1, + DCB_APP_ATTR_ID = 2, + DCB_APP_ATTR_PRIORITY = 3, + __DCB_APP_ATTR_ENUM_MAX = 4, + DCB_APP_ATTR_MAX = 3, +}; + +enum dcbnl_featcfg_attrs { + DCB_FEATCFG_ATTR_UNDEFINED = 0, + DCB_FEATCFG_ATTR_ALL = 1, + DCB_FEATCFG_ATTR_PG = 2, + DCB_FEATCFG_ATTR_PFC = 3, + DCB_FEATCFG_ATTR_APP = 4, + __DCB_FEATCFG_ATTR_ENUM_MAX = 5, + DCB_FEATCFG_ATTR_MAX = 4, +}; + +struct dcb_app_type { + int ifindex; + struct dcb_app app; + struct list_head list; + u8 dcbx; +}; + +struct dcb_ieee_app_prio_map { + u64 map[8]; +}; + +struct dcb_ieee_app_dscp_map { + u8 map[64]; +}; + +enum dcbevent_notif_type { + DCB_APP_EVENT = 1, +}; + +struct reply_func { + int type; + int (*cb)(struct net_device *, struct nlmsghdr *, u32, struct nlattr **, struct sk_buff *); +}; + +enum switchdev_attr_id { + SWITCHDEV_ATTR_ID_UNDEFINED = 0, + SWITCHDEV_ATTR_ID_PORT_STP_STATE = 1, + SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS = 2, + SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS = 3, + SWITCHDEV_ATTR_ID_PORT_MROUTER = 4, + SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME = 5, + SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING = 6, + SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL = 7, + SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED = 8, + SWITCHDEV_ATTR_ID_BRIDGE_MROUTER = 9, + SWITCHDEV_ATTR_ID_MRP_PORT_ROLE = 10, +}; + +struct switchdev_attr { + struct net_device *orig_dev; + enum switchdev_attr_id id; + u32 flags; + void *complete_priv; + void (*complete)(struct net_device *, int, void *); + union { + u8 stp_state; + long unsigned int brport_flags; + bool mrouter; + clock_t ageing_time; + bool vlan_filtering; + u16 vlan_protocol; + bool mc_disabled; + u8 mrp_port_role; + } u; +}; + +enum switchdev_notifier_type { + SWITCHDEV_FDB_ADD_TO_BRIDGE = 1, + SWITCHDEV_FDB_DEL_TO_BRIDGE = 2, + SWITCHDEV_FDB_ADD_TO_DEVICE = 3, + SWITCHDEV_FDB_DEL_TO_DEVICE = 4, + SWITCHDEV_FDB_OFFLOADED = 5, + SWITCHDEV_FDB_FLUSH_TO_BRIDGE = 6, + SWITCHDEV_PORT_OBJ_ADD = 7, + SWITCHDEV_PORT_OBJ_DEL = 8, + SWITCHDEV_PORT_ATTR_SET = 9, + SWITCHDEV_VXLAN_FDB_ADD_TO_BRIDGE = 10, + SWITCHDEV_VXLAN_FDB_DEL_TO_BRIDGE = 11, + SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE = 12, + SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE = 13, + SWITCHDEV_VXLAN_FDB_OFFLOADED = 14, +}; + +struct switchdev_notifier_info { + struct net_device *dev; + struct netlink_ext_ack *extack; +}; + +struct switchdev_notifier_port_obj_info { + struct switchdev_notifier_info info; + const struct switchdev_obj *obj; + struct switchdev_trans *trans; + bool handled; +}; + +struct switchdev_notifier_port_attr_info { + struct switchdev_notifier_info info; + const struct switchdev_attr *attr; + struct switchdev_trans *trans; + bool handled; +}; + +typedef void switchdev_deferred_func_t(struct net_device *, const void *); + +struct switchdev_deferred_item { + struct list_head list; + struct net_device *dev; + switchdev_deferred_func_t *func; + long unsigned int data[0]; +}; + +typedef int (*lookup_by_table_id_t)(struct net *, u32); + +struct l3mdev_handler { + lookup_by_table_id_t dev_lookup; +}; + +struct ncsi_dev { + int state; + int link_up; + struct net_device *dev; + void (*handler)(struct ncsi_dev *); +}; + +enum { + NCSI_CAP_BASE = 0, + NCSI_CAP_GENERIC = 0, + NCSI_CAP_BC = 1, + NCSI_CAP_MC = 2, + NCSI_CAP_BUFFER = 3, + NCSI_CAP_AEN = 4, + NCSI_CAP_VLAN = 5, + NCSI_CAP_MAX = 6, +}; + +enum { + NCSI_MODE_BASE = 0, + NCSI_MODE_ENABLE = 0, + NCSI_MODE_TX_ENABLE = 1, + NCSI_MODE_LINK = 2, + NCSI_MODE_VLAN = 3, + NCSI_MODE_BC = 4, + NCSI_MODE_MC = 5, + NCSI_MODE_AEN = 6, + NCSI_MODE_FC = 7, + NCSI_MODE_MAX = 8, +}; + +struct ncsi_channel_version { + u32 version; + u32 alpha2; + u8 fw_name[12]; + u32 fw_version; + u16 pci_ids[4]; + u32 mf_id; +}; + +struct ncsi_channel_cap { + u32 index; + u32 cap; +}; + +struct ncsi_channel_mode { + u32 index; + u32 enable; + u32 size; + u32 data[8]; +}; + +struct ncsi_channel_mac_filter { + u8 n_uc; + u8 n_mc; + u8 n_mixed; + u64 bitmap; + unsigned char *addrs; +}; + +struct ncsi_channel_vlan_filter { + u8 n_vids; + u64 bitmap; + u16 *vids; +}; + +struct ncsi_channel_stats { + u32 hnc_cnt_hi; + u32 hnc_cnt_lo; + u32 hnc_rx_bytes; + u32 hnc_tx_bytes; + u32 hnc_rx_uc_pkts; + u32 hnc_rx_mc_pkts; + u32 hnc_rx_bc_pkts; + u32 hnc_tx_uc_pkts; + u32 hnc_tx_mc_pkts; + u32 hnc_tx_bc_pkts; + u32 hnc_fcs_err; + u32 hnc_align_err; + u32 hnc_false_carrier; + u32 hnc_runt_pkts; + u32 hnc_jabber_pkts; + u32 hnc_rx_pause_xon; + u32 hnc_rx_pause_xoff; + u32 hnc_tx_pause_xon; + u32 hnc_tx_pause_xoff; + u32 hnc_tx_s_collision; + u32 hnc_tx_m_collision; + u32 hnc_l_collision; + u32 hnc_e_collision; + u32 hnc_rx_ctl_frames; + u32 hnc_rx_64_frames; + u32 hnc_rx_127_frames; + u32 hnc_rx_255_frames; + u32 hnc_rx_511_frames; + u32 hnc_rx_1023_frames; + u32 hnc_rx_1522_frames; + u32 hnc_rx_9022_frames; + u32 hnc_tx_64_frames; + u32 hnc_tx_127_frames; + u32 hnc_tx_255_frames; + u32 hnc_tx_511_frames; + u32 hnc_tx_1023_frames; + u32 hnc_tx_1522_frames; + u32 hnc_tx_9022_frames; + u32 hnc_rx_valid_bytes; + u32 hnc_rx_runt_pkts; + u32 hnc_rx_jabber_pkts; + u32 ncsi_rx_cmds; + u32 ncsi_dropped_cmds; + u32 ncsi_cmd_type_errs; + u32 ncsi_cmd_csum_errs; + u32 ncsi_rx_pkts; + u32 ncsi_tx_pkts; + u32 ncsi_tx_aen_pkts; + u32 pt_tx_pkts; + u32 pt_tx_dropped; + u32 pt_tx_channel_err; + u32 pt_tx_us_err; + u32 pt_rx_pkts; + u32 pt_rx_dropped; + u32 pt_rx_channel_err; + u32 pt_rx_us_err; + u32 pt_rx_os_err; +}; + +struct ncsi_package; + +struct ncsi_channel { + unsigned char id; + int state; + bool reconfigure_needed; + spinlock_t lock; + struct ncsi_package *package; + struct ncsi_channel_version version; + struct ncsi_channel_cap caps[6]; + struct ncsi_channel_mode modes[8]; + struct ncsi_channel_mac_filter mac_filter; + struct ncsi_channel_vlan_filter vlan_filter; + struct ncsi_channel_stats stats; + struct { + struct timer_list timer; + bool enabled; + unsigned int state; + } monitor; + struct list_head node; + struct list_head link; +}; + +struct ncsi_dev_priv; + +struct ncsi_package { + unsigned char id; + unsigned char uuid[16]; + struct ncsi_dev_priv *ndp; + spinlock_t lock; + unsigned int channel_num; + struct list_head channels; + struct list_head node; + bool multi_channel; + u32 channel_whitelist; + struct ncsi_channel *preferred_channel; +}; + +struct ncsi_request { + unsigned char id; + bool used; + unsigned int flags; + struct ncsi_dev_priv *ndp; + struct sk_buff *cmd; + struct sk_buff *rsp; + struct timer_list timer; + bool enabled; + u32 snd_seq; + u32 snd_portid; + struct nlmsghdr nlhdr; +}; + +struct ncsi_dev_priv { + struct ncsi_dev ndev; + unsigned int flags; + unsigned int gma_flag; + spinlock_t lock; + unsigned int package_probe_id; + unsigned int package_num; + struct list_head packages; + struct ncsi_channel *hot_channel; + struct ncsi_request requests[256]; + unsigned int request_id; + unsigned int pending_req_num; + struct ncsi_package *active_package; + struct ncsi_channel *active_channel; + struct list_head channel_queue; + struct work_struct work; + struct packet_type ptype; + struct list_head node; + struct list_head vlan_vids; + bool multi_package; + bool mlx_multi_host; + u32 package_whitelist; +}; + +struct ncsi_cmd_arg { + struct ncsi_dev_priv *ndp; + unsigned char type; + unsigned char id; + unsigned char package; + unsigned char channel; + short unsigned int payload; + unsigned int req_flags; + union { + unsigned char bytes[16]; + short unsigned int words[8]; + unsigned int dwords[4]; + }; + unsigned char *data; + struct genl_info *info; +}; + +struct ncsi_pkt_hdr { + unsigned char mc_id; + unsigned char revision; + unsigned char reserved; + unsigned char id; + unsigned char type; + unsigned char channel; + __be16 length; + __be32 reserved1[2]; +}; + +struct ncsi_cmd_pkt_hdr { + struct ncsi_pkt_hdr common; +}; + +struct ncsi_cmd_pkt { + struct ncsi_cmd_pkt_hdr cmd; + __be32 checksum; + unsigned char pad[26]; +}; + +struct ncsi_cmd_sp_pkt { + struct ncsi_cmd_pkt_hdr cmd; + unsigned char reserved[3]; + unsigned char hw_arbitration; + __be32 checksum; + unsigned char pad[22]; +}; + +struct ncsi_cmd_dc_pkt { + struct ncsi_cmd_pkt_hdr cmd; + unsigned char reserved[3]; + unsigned char ald; + __be32 checksum; + unsigned char pad[22]; +}; + +struct ncsi_cmd_rc_pkt { + struct ncsi_cmd_pkt_hdr cmd; + __be32 reserved; + __be32 checksum; + unsigned char pad[22]; +}; + +struct ncsi_cmd_ae_pkt { + struct ncsi_cmd_pkt_hdr cmd; + unsigned char reserved[3]; + unsigned char mc_id; + __be32 mode; + __be32 checksum; + unsigned char pad[18]; +}; + +struct ncsi_cmd_sl_pkt { + struct ncsi_cmd_pkt_hdr cmd; + __be32 mode; + __be32 oem_mode; + __be32 checksum; + unsigned char pad[18]; +}; + +struct ncsi_cmd_svf_pkt { + struct ncsi_cmd_pkt_hdr cmd; + __be16 reserved; + __be16 vlan; + __be16 reserved1; + unsigned char index; + unsigned char enable; + __be32 checksum; + unsigned char pad[18]; +}; + +struct ncsi_cmd_ev_pkt { + struct ncsi_cmd_pkt_hdr cmd; + unsigned char reserved[3]; + unsigned char mode; + __be32 checksum; + unsigned char pad[22]; +}; + +struct ncsi_cmd_sma_pkt { + struct ncsi_cmd_pkt_hdr cmd; + unsigned char mac[6]; + unsigned char index; + unsigned char at_e; + __be32 checksum; + unsigned char pad[18]; +}; + +struct ncsi_cmd_ebf_pkt { + struct ncsi_cmd_pkt_hdr cmd; + __be32 mode; + __be32 checksum; + unsigned char pad[22]; +}; + +struct ncsi_cmd_egmf_pkt { + struct ncsi_cmd_pkt_hdr cmd; + __be32 mode; + __be32 checksum; + unsigned char pad[22]; +}; + +struct ncsi_cmd_snfc_pkt { + struct ncsi_cmd_pkt_hdr cmd; + unsigned char reserved[3]; + unsigned char mode; + __be32 checksum; + unsigned char pad[22]; +}; + +struct ncsi_cmd_oem_pkt { + struct ncsi_cmd_pkt_hdr cmd; + __be32 mfr_id; + unsigned char data[0]; +}; + +struct ncsi_cmd_handler { + unsigned char type; + int payload; + int (*handler)(struct sk_buff *, struct ncsi_cmd_arg *); +}; + +enum { + NCSI_CAP_GENERIC_HWA = 1, + NCSI_CAP_GENERIC_HDS = 2, + NCSI_CAP_GENERIC_FC = 4, + NCSI_CAP_GENERIC_FC1 = 8, + NCSI_CAP_GENERIC_MC = 16, + NCSI_CAP_GENERIC_HWA_UNKNOWN = 0, + NCSI_CAP_GENERIC_HWA_SUPPORT = 32, + NCSI_CAP_GENERIC_HWA_NOT_SUPPORT = 64, + NCSI_CAP_GENERIC_HWA_RESERVED = 96, + NCSI_CAP_GENERIC_HWA_MASK = 96, + NCSI_CAP_GENERIC_MASK = 127, + NCSI_CAP_BC_ARP = 1, + NCSI_CAP_BC_DHCPC = 2, + NCSI_CAP_BC_DHCPS = 4, + NCSI_CAP_BC_NETBIOS = 8, + NCSI_CAP_BC_MASK = 15, + NCSI_CAP_MC_IPV6_NEIGHBOR = 1, + NCSI_CAP_MC_IPV6_ROUTER = 2, + NCSI_CAP_MC_DHCPV6_RELAY = 4, + NCSI_CAP_MC_DHCPV6_WELL_KNOWN = 8, + NCSI_CAP_MC_IPV6_MLD = 16, + NCSI_CAP_MC_IPV6_NEIGHBOR_S = 32, + NCSI_CAP_MC_MASK = 63, + NCSI_CAP_AEN_LSC = 1, + NCSI_CAP_AEN_CR = 2, + NCSI_CAP_AEN_HDS = 4, + NCSI_CAP_AEN_MASK = 7, + NCSI_CAP_VLAN_ONLY = 1, + NCSI_CAP_VLAN_NO = 2, + NCSI_CAP_VLAN_ANY = 4, + NCSI_CAP_VLAN_MASK = 7, +}; + +struct ncsi_rsp_pkt_hdr { + struct ncsi_pkt_hdr common; + __be16 code; + __be16 reason; +}; + +struct ncsi_rsp_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 checksum; + unsigned char pad[22]; +}; + +struct ncsi_rsp_oem_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 mfr_id; + unsigned char data[0]; +}; + +struct ncsi_rsp_oem_mlx_pkt { + unsigned char cmd_rev; + unsigned char cmd; + unsigned char param; + unsigned char optional; + unsigned char data[0]; +}; + +struct ncsi_rsp_oem_bcm_pkt { + unsigned char ver; + unsigned char type; + __be16 len; + unsigned char data[0]; +}; + +struct ncsi_rsp_gls_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 status; + __be32 other; + __be32 oem_status; + __be32 checksum; + unsigned char pad[10]; +}; + +struct ncsi_rsp_gvi_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 ncsi_version; + unsigned char reserved[3]; + unsigned char alpha2; + unsigned char fw_name[12]; + __be32 fw_version; + __be16 pci_ids[4]; + __be32 mf_id; + __be32 checksum; +}; + +struct ncsi_rsp_gc_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 cap; + __be32 bc_cap; + __be32 mc_cap; + __be32 buf_cap; + __be32 aen_cap; + unsigned char vlan_cnt; + unsigned char mixed_cnt; + unsigned char mc_cnt; + unsigned char uc_cnt; + unsigned char reserved[2]; + unsigned char vlan_mode; + unsigned char channel_cnt; + __be32 checksum; +}; + +struct ncsi_rsp_gp_pkt { + struct ncsi_rsp_pkt_hdr rsp; + unsigned char mac_cnt; + unsigned char reserved[2]; + unsigned char mac_enable; + unsigned char vlan_cnt; + unsigned char reserved1; + __be16 vlan_enable; + __be32 link_mode; + __be32 bc_mode; + __be32 valid_modes; + unsigned char vlan_mode; + unsigned char fc_mode; + unsigned char reserved2[2]; + __be32 aen_mode; + unsigned char mac[6]; + __be16 vlan; + __be32 checksum; +}; + +struct ncsi_rsp_gcps_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 cnt_hi; + __be32 cnt_lo; + __be32 rx_bytes; + __be32 tx_bytes; + __be32 rx_uc_pkts; + __be32 rx_mc_pkts; + __be32 rx_bc_pkts; + __be32 tx_uc_pkts; + __be32 tx_mc_pkts; + __be32 tx_bc_pkts; + __be32 fcs_err; + __be32 align_err; + __be32 false_carrier; + __be32 runt_pkts; + __be32 jabber_pkts; + __be32 rx_pause_xon; + __be32 rx_pause_xoff; + __be32 tx_pause_xon; + __be32 tx_pause_xoff; + __be32 tx_s_collision; + __be32 tx_m_collision; + __be32 l_collision; + __be32 e_collision; + __be32 rx_ctl_frames; + __be32 rx_64_frames; + __be32 rx_127_frames; + __be32 rx_255_frames; + __be32 rx_511_frames; + __be32 rx_1023_frames; + __be32 rx_1522_frames; + __be32 rx_9022_frames; + __be32 tx_64_frames; + __be32 tx_127_frames; + __be32 tx_255_frames; + __be32 tx_511_frames; + __be32 tx_1023_frames; + __be32 tx_1522_frames; + __be32 tx_9022_frames; + __be32 rx_valid_bytes; + __be32 rx_runt_pkts; + __be32 rx_jabber_pkts; + __be32 checksum; +}; + +struct ncsi_rsp_gns_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 rx_cmds; + __be32 dropped_cmds; + __be32 cmd_type_errs; + __be32 cmd_csum_errs; + __be32 rx_pkts; + __be32 tx_pkts; + __be32 tx_aen_pkts; + __be32 checksum; +}; + +struct ncsi_rsp_gnpts_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 tx_pkts; + __be32 tx_dropped; + __be32 tx_channel_err; + __be32 tx_us_err; + __be32 rx_pkts; + __be32 rx_dropped; + __be32 rx_channel_err; + __be32 rx_us_err; + __be32 rx_os_err; + __be32 checksum; +}; + +struct ncsi_rsp_gps_pkt { + struct ncsi_rsp_pkt_hdr rsp; + __be32 status; + __be32 checksum; +}; + +struct ncsi_rsp_gpuuid_pkt { + struct ncsi_rsp_pkt_hdr rsp; + unsigned char uuid[16]; + __be32 checksum; +}; + +struct ncsi_rsp_oem_handler { + unsigned int mfr_id; + int (*handler)(struct ncsi_request *); +}; + +struct ncsi_rsp_handler { + unsigned char type; + int payload; + int (*handler)(struct ncsi_request *); +}; + +struct ncsi_aen_pkt_hdr { + struct ncsi_pkt_hdr common; + unsigned char reserved2[3]; + unsigned char type; +}; + +struct ncsi_aen_lsc_pkt { + struct ncsi_aen_pkt_hdr aen; + __be32 status; + __be32 oem_status; + __be32 checksum; + unsigned char pad[14]; +}; + +struct ncsi_aen_hncdsc_pkt { + struct ncsi_aen_pkt_hdr aen; + __be32 status; + __be32 checksum; + unsigned char pad[18]; +}; + +struct ncsi_aen_handler { + unsigned char type; + int payload; + int (*handler)(struct ncsi_dev_priv *, struct ncsi_aen_pkt_hdr *); +}; + +enum { + ncsi_dev_state_registered = 0, + ncsi_dev_state_functional = 256, + ncsi_dev_state_probe = 512, + ncsi_dev_state_config = 768, + ncsi_dev_state_suspend = 1024, +}; + +enum { + MLX_MC_RBT_SUPPORT = 1, + MLX_MC_RBT_AVL = 8, +}; + +enum { + ncsi_dev_state_major = 65280, + ncsi_dev_state_minor = 255, + ncsi_dev_state_probe_deselect = 513, + ncsi_dev_state_probe_package = 514, + ncsi_dev_state_probe_channel = 515, + ncsi_dev_state_probe_mlx_gma = 516, + ncsi_dev_state_probe_mlx_smaf = 517, + ncsi_dev_state_probe_cis = 518, + ncsi_dev_state_probe_gvi = 519, + ncsi_dev_state_probe_gc = 520, + ncsi_dev_state_probe_gls = 521, + ncsi_dev_state_probe_dp = 522, + ncsi_dev_state_config_sp = 769, + ncsi_dev_state_config_cis = 770, + ncsi_dev_state_config_oem_gma = 771, + ncsi_dev_state_config_clear_vids = 772, + ncsi_dev_state_config_svf = 773, + ncsi_dev_state_config_ev = 774, + ncsi_dev_state_config_sma = 775, + ncsi_dev_state_config_ebf = 776, + ncsi_dev_state_config_dgmf = 777, + ncsi_dev_state_config_ecnt = 778, + ncsi_dev_state_config_ec = 779, + ncsi_dev_state_config_ae = 780, + ncsi_dev_state_config_gls = 781, + ncsi_dev_state_config_done = 782, + ncsi_dev_state_suspend_select = 1025, + ncsi_dev_state_suspend_gls = 1026, + ncsi_dev_state_suspend_dcnt = 1027, + ncsi_dev_state_suspend_dc = 1028, + ncsi_dev_state_suspend_deselect = 1029, + ncsi_dev_state_suspend_done = 1030, +}; + +struct vlan_vid { + struct list_head list; + __be16 proto; + u16 vid; +}; + +struct ncsi_oem_gma_handler { + unsigned int mfr_id; + int (*handler)(struct ncsi_cmd_arg *); +}; + +enum ncsi_nl_commands { + NCSI_CMD_UNSPEC = 0, + NCSI_CMD_PKG_INFO = 1, + NCSI_CMD_SET_INTERFACE = 2, + NCSI_CMD_CLEAR_INTERFACE = 3, + NCSI_CMD_SEND_CMD = 4, + NCSI_CMD_SET_PACKAGE_MASK = 5, + NCSI_CMD_SET_CHANNEL_MASK = 6, + __NCSI_CMD_AFTER_LAST = 7, + NCSI_CMD_MAX = 6, +}; + +enum ncsi_nl_attrs { + NCSI_ATTR_UNSPEC = 0, + NCSI_ATTR_IFINDEX = 1, + NCSI_ATTR_PACKAGE_LIST = 2, + NCSI_ATTR_PACKAGE_ID = 3, + NCSI_ATTR_CHANNEL_ID = 4, + NCSI_ATTR_DATA = 5, + NCSI_ATTR_MULTI_FLAG = 6, + NCSI_ATTR_PACKAGE_MASK = 7, + NCSI_ATTR_CHANNEL_MASK = 8, + __NCSI_ATTR_AFTER_LAST = 9, + NCSI_ATTR_MAX = 8, +}; + +enum ncsi_nl_pkg_attrs { + NCSI_PKG_ATTR_UNSPEC = 0, + NCSI_PKG_ATTR = 1, + NCSI_PKG_ATTR_ID = 2, + NCSI_PKG_ATTR_FORCED = 3, + NCSI_PKG_ATTR_CHANNEL_LIST = 4, + __NCSI_PKG_ATTR_AFTER_LAST = 5, + NCSI_PKG_ATTR_MAX = 4, +}; + +enum ncsi_nl_channel_attrs { + NCSI_CHANNEL_ATTR_UNSPEC = 0, + NCSI_CHANNEL_ATTR = 1, + NCSI_CHANNEL_ATTR_ID = 2, + NCSI_CHANNEL_ATTR_VERSION_MAJOR = 3, + NCSI_CHANNEL_ATTR_VERSION_MINOR = 4, + NCSI_CHANNEL_ATTR_VERSION_STR = 5, + NCSI_CHANNEL_ATTR_LINK_STATE = 6, + NCSI_CHANNEL_ATTR_ACTIVE = 7, + NCSI_CHANNEL_ATTR_FORCED = 8, + NCSI_CHANNEL_ATTR_VLAN_LIST = 9, + NCSI_CHANNEL_ATTR_VLAN_ID = 10, + __NCSI_CHANNEL_ATTR_AFTER_LAST = 11, + NCSI_CHANNEL_ATTR_MAX = 10, +}; + +struct sockaddr_xdp { + __u16 sxdp_family; + __u16 sxdp_flags; + __u32 sxdp_ifindex; + __u32 sxdp_queue_id; + __u32 sxdp_shared_umem_fd; +}; + +struct xdp_ring_offset { + __u64 producer; + __u64 consumer; + __u64 desc; + __u64 flags; +}; + +struct xdp_mmap_offsets { + struct xdp_ring_offset rx; + struct xdp_ring_offset tx; + struct xdp_ring_offset fr; + struct xdp_ring_offset cr; +}; + +struct xdp_umem_reg { + __u64 addr; + __u64 len; + __u32 chunk_size; + __u32 headroom; + __u32 flags; +}; + +struct xdp_statistics { + __u64 rx_dropped; + __u64 rx_invalid_descs; + __u64 tx_invalid_descs; + __u64 rx_ring_full; + __u64 rx_fill_ring_empty_descs; + __u64 tx_ring_empty_descs; +}; + +struct xdp_options { + __u32 flags; +}; + +struct xdp_desc { + __u64 addr; + __u32 len; + __u32 options; +}; + +struct xdp_ring; + +struct xsk_queue { + u32 ring_mask; + u32 nentries; + u32 cached_prod; + u32 cached_cons; + struct xdp_ring *ring; + u64 invalid_descs; + u64 queue_empty_descs; +}; + +struct xdp_ring_offset_v1 { + __u64 producer; + __u64 consumer; + __u64 desc; +}; + +struct xdp_mmap_offsets_v1 { + struct xdp_ring_offset_v1 rx; + struct xdp_ring_offset_v1 tx; + struct xdp_ring_offset_v1 fr; + struct xdp_ring_offset_v1 cr; +}; + +struct xsk_map_node { + struct list_head node; + struct xsk_map *map; + struct xdp_sock **map_entry; +}; + +struct xdp_ring { + u32 producer; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + u32 pad1; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + u32 consumer; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + u32 pad2; + u32 flags; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + u32 pad3; + long: 32; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; + long: 64; +}; + +struct xdp_rxtx_ring { + struct xdp_ring ptrs; + struct xdp_desc desc[0]; +}; + +struct xdp_umem_ring { + struct xdp_ring ptrs; + u64 desc[0]; +}; + +struct xsk_dma_map { + dma_addr_t *dma_pages; + struct device *dev; + struct net_device *netdev; + refcount_t users; + struct list_head list; + u32 dma_pages_cnt; + bool dma_need_sync; +}; + +struct mptcp_mib { + long unsigned int mibs[23]; +}; + +struct mptcp_options_received { + u64 sndr_key; + u64 rcvr_key; + u64 data_ack; + u64 data_seq; + u32 subflow_seq; + u16 data_len; + u16 mp_capable: 1; + u16 mp_join: 1; + u16 fastclose: 1; + u16 dss: 1; + u16 add_addr: 1; + u16 rm_addr: 1; + u16 family: 4; + u16 echo: 1; + u16 backup: 1; + u32 token; + u32 nonce; + u64 thmac; + u8 hmac[20]; + u8 join_id; + u8 use_map: 1; + u8 dsn64: 1; + u8 data_fin: 1; + u8 use_ack: 1; + u8 ack64: 1; + u8 mpc_map: 1; + u8 __unused: 2; + u8 addr_id; + u8 rm_id; + union { + struct in_addr addr; + struct in6_addr addr6; + }; + u64 ahmac; + u16 port; +}; + +struct mptcp_addr_info { + sa_family_t family; + __be16 port; + u8 id; + u8 flags; + int ifindex; + union { + struct in_addr addr; + struct in6_addr addr6; + }; +}; + +enum mptcp_pm_status { + MPTCP_PM_ADD_ADDR_RECEIVED = 0, + MPTCP_PM_ADD_ADDR_SEND_ACK = 1, + MPTCP_PM_RM_ADDR_RECEIVED = 2, + MPTCP_PM_ESTABLISHED = 3, + MPTCP_PM_ALREADY_ESTABLISHED = 4, + MPTCP_PM_SUBFLOW_ESTABLISHED = 5, +}; + +struct mptcp_pm_data { + struct mptcp_addr_info local; + struct mptcp_addr_info remote; + struct list_head anno_list; + spinlock_t lock; + u8 addr_signal; + bool server_side; + bool work_pending; + bool accept_addr; + bool accept_subflow; + u8 add_addr_signaled; + u8 add_addr_accepted; + u8 local_addr_used; + u8 subflows; + u8 add_addr_signal_max; + u8 add_addr_accept_max; + u8 local_addr_max; + u8 subflows_max; + u8 status; + u8 rm_id; +}; + +struct mptcp_data_frag { + struct list_head list; + u64 data_seq; + u16 data_len; + u16 offset; + u16 overhead; + u16 already_sent; + struct page *page; +}; + +struct mptcp_sock { + struct inet_connection_sock sk; + u64 local_key; + u64 remote_key; + u64 write_seq; + u64 snd_nxt; + u64 ack_seq; + u64 rcv_wnd_sent; + u64 rcv_data_fin_seq; + int wmem_reserved; + struct sock *last_snd; + int snd_burst; + int old_wspace; + u64 snd_una; + u64 wnd_end; + long unsigned int timer_ival; + u32 token; + int rmem_pending; + int rmem_released; + long unsigned int flags; + bool can_ack; + bool fully_established; + bool rcv_data_fin; + bool snd_data_fin_enable; + bool rcv_fastclose; + bool use_64bit_ack; + spinlock_t join_list_lock; + struct sock *ack_hint; + struct work_struct work; + struct sk_buff *ooo_last_skb; + struct rb_root out_of_order_queue; + struct sk_buff_head receive_queue; + struct sk_buff_head skb_tx_cache; + int tx_pending_data; + int size_goal_cache; + struct list_head conn_list; + struct list_head rtx_queue; + struct mptcp_data_frag *first_pending; + struct list_head join_list; + struct socket *subflow; + struct sock *first; + struct mptcp_pm_data pm; + struct { + u32 space; + u32 copied; + u64 time; + u64 rtt_us; + } rcvq_space; +}; + +struct mptcp_subflow_request_sock { + struct tcp_request_sock sk; + u16 mp_capable: 1; + u16 mp_join: 1; + u16 backup: 1; + u8 local_id; + u8 remote_id; + u64 local_key; + u64 idsn; + u32 token; + u32 ssn_offset; + u64 thmac; + u32 local_nonce; + u32 remote_nonce; + struct mptcp_sock *msk; + struct hlist_nulls_node token_node; +}; + +enum mptcp_data_avail { + MPTCP_SUBFLOW_NODATA = 0, + MPTCP_SUBFLOW_DATA_AVAIL = 1, + MPTCP_SUBFLOW_OOO_DATA = 2, +}; + +struct mptcp_subflow_context { + struct list_head node; + u64 local_key; + u64 remote_key; + u64 idsn; + u64 map_seq; + u32 snd_isn; + u32 token; + u32 rel_write_seq; + u32 map_subflow_seq; + u32 ssn_offset; + u32 map_data_len; + u32 request_mptcp: 1; + u32 request_join: 1; + u32 request_bkup: 1; + u32 mp_capable: 1; + u32 mp_join: 1; + u32 fully_established: 1; + u32 pm_notified: 1; + u32 conn_finished: 1; + u32 map_valid: 1; + u32 mpc_map: 1; + u32 backup: 1; + u32 rx_eof: 1; + u32 can_ack: 1; + u32 disposable: 1; + enum mptcp_data_avail data_avail; + u32 remote_nonce; + u64 thmac; + u32 local_nonce; + u32 remote_token; + u8 hmac[20]; + u8 local_id; + u8 remote_id; + struct sock *tcp_sock; + struct sock *conn; + const struct inet_connection_sock_af_ops *icsk_af_ops; + void (*tcp_data_ready)(struct sock *); + void (*tcp_state_change)(struct sock *); + void (*tcp_write_space)(struct sock *); + void (*tcp_error_report)(struct sock *); + struct callback_head rcu; +}; + +enum linux_mptcp_mib_field { + MPTCP_MIB_NUM = 0, + MPTCP_MIB_MPCAPABLEPASSIVE = 1, + MPTCP_MIB_MPCAPABLEPASSIVEACK = 2, + MPTCP_MIB_MPCAPABLEPASSIVEFALLBACK = 3, + MPTCP_MIB_MPCAPABLEACTIVEFALLBACK = 4, + MPTCP_MIB_RETRANSSEGS = 5, + MPTCP_MIB_JOINNOTOKEN = 6, + MPTCP_MIB_JOINSYNRX = 7, + MPTCP_MIB_JOINSYNACKRX = 8, + MPTCP_MIB_JOINSYNACKMAC = 9, + MPTCP_MIB_JOINACKRX = 10, + MPTCP_MIB_JOINACKMAC = 11, + MPTCP_MIB_DSSNOMATCH = 12, + MPTCP_MIB_INFINITEMAPRX = 13, + MPTCP_MIB_OFOQUEUETAIL = 14, + MPTCP_MIB_OFOQUEUE = 15, + MPTCP_MIB_OFOMERGE = 16, + MPTCP_MIB_NODSSWINDOW = 17, + MPTCP_MIB_DUPDATA = 18, + MPTCP_MIB_ADDADDR = 19, + MPTCP_MIB_ECHOADD = 20, + MPTCP_MIB_RMADDR = 21, + MPTCP_MIB_RMSUBFLOW = 22, + __MPTCP_MIB_MAX = 23, +}; + +struct mptcp_skb_cb { + u64 map_seq; + u64 end_seq; + u32 offset; +}; + +struct mptcp_sendmsg_info { + int mss_now; + int size_goal; + u16 limit; + u16 sent; + unsigned int flags; +}; + +struct subflow_send_info { + struct sock *ssk; + u64 ratio; +}; + +enum mapping_status { + MAPPING_OK = 0, + MAPPING_INVALID = 1, + MAPPING_EMPTY = 2, + MAPPING_DATA_FIN = 3, + MAPPING_DUMMY = 4, +}; + +enum mptcp_addr_signal_status { + MPTCP_ADD_ADDR_SIGNAL = 0, + MPTCP_ADD_ADDR_ECHO = 1, + MPTCP_ADD_ADDR_IPV6 = 2, + MPTCP_ADD_ADDR_PORT = 3, + MPTCP_RM_ADDR_SIGNAL = 4, +}; + +struct mptcp_pm_add_entry; + +struct token_bucket { + spinlock_t lock; + int chain_len; + struct hlist_nulls_head req_chain; + struct hlist_nulls_head msk_chain; +}; + +struct mptcp_pernet { + struct ctl_table_header *ctl_table_hdr; + int mptcp_enabled; + unsigned int add_addr_timeout; +}; + +enum { + INET_ULP_INFO_UNSPEC = 0, + INET_ULP_INFO_NAME = 1, + INET_ULP_INFO_TLS = 2, + INET_ULP_INFO_MPTCP = 3, + __INET_ULP_INFO_MAX = 4, +}; + +enum { + MPTCP_SUBFLOW_ATTR_UNSPEC = 0, + MPTCP_SUBFLOW_ATTR_TOKEN_REM = 1, + MPTCP_SUBFLOW_ATTR_TOKEN_LOC = 2, + MPTCP_SUBFLOW_ATTR_RELWRITE_SEQ = 3, + MPTCP_SUBFLOW_ATTR_MAP_SEQ = 4, + MPTCP_SUBFLOW_ATTR_MAP_SFSEQ = 5, + MPTCP_SUBFLOW_ATTR_SSN_OFFSET = 6, + MPTCP_SUBFLOW_ATTR_MAP_DATALEN = 7, + MPTCP_SUBFLOW_ATTR_FLAGS = 8, + MPTCP_SUBFLOW_ATTR_ID_REM = 9, + MPTCP_SUBFLOW_ATTR_ID_LOC = 10, + MPTCP_SUBFLOW_ATTR_PAD = 11, + __MPTCP_SUBFLOW_ATTR_MAX = 12, +}; + +enum { + MPTCP_PM_ATTR_UNSPEC = 0, + MPTCP_PM_ATTR_ADDR = 1, + MPTCP_PM_ATTR_RCV_ADD_ADDRS = 2, + MPTCP_PM_ATTR_SUBFLOWS = 3, + __MPTCP_PM_ATTR_MAX = 4, +}; + +enum { + MPTCP_PM_ADDR_ATTR_UNSPEC = 0, + MPTCP_PM_ADDR_ATTR_FAMILY = 1, + MPTCP_PM_ADDR_ATTR_ID = 2, + MPTCP_PM_ADDR_ATTR_ADDR4 = 3, + MPTCP_PM_ADDR_ATTR_ADDR6 = 4, + MPTCP_PM_ADDR_ATTR_PORT = 5, + MPTCP_PM_ADDR_ATTR_FLAGS = 6, + MPTCP_PM_ADDR_ATTR_IF_IDX = 7, + __MPTCP_PM_ADDR_ATTR_MAX = 8, +}; + +enum { + MPTCP_PM_CMD_UNSPEC = 0, + MPTCP_PM_CMD_ADD_ADDR = 1, + MPTCP_PM_CMD_DEL_ADDR = 2, + MPTCP_PM_CMD_GET_ADDR = 3, + MPTCP_PM_CMD_FLUSH_ADDRS = 4, + MPTCP_PM_CMD_SET_LIMITS = 5, + MPTCP_PM_CMD_GET_LIMITS = 6, + __MPTCP_PM_CMD_AFTER_LAST = 7, +}; + +struct mptcp_pm_addr_entry { + struct list_head list; + struct mptcp_addr_info addr; + struct callback_head rcu; +}; + +struct mptcp_pm_add_entry___2 { + struct list_head list; + struct mptcp_addr_info addr; + struct timer_list add_timer; + struct mptcp_sock *sock; + u8 retrans_times; +}; + +struct pm_nl_pernet { + spinlock_t lock; + struct list_head local_addr_list; + unsigned int addrs; + unsigned int add_addr_signal_max; + unsigned int add_addr_accept_max; + unsigned int local_addr_max; + unsigned int subflows_max; + unsigned int next_id; +}; + +struct join_entry { + u32 token; + u32 remote_nonce; + u32 local_nonce; + u8 join_id; + u8 local_id; + u8 backup; + u8 valid; +}; + +struct pcibios_fwaddrmap { + struct list_head list; + struct pci_dev *dev; + resource_size_t fw_addr[17]; +}; + +struct pci_check_idx_range { + int start; + int end; +}; + +struct pci_raw_ops { + int (*read)(unsigned int, unsigned int, unsigned int, int, int, u32 *); + int (*write)(unsigned int, unsigned int, unsigned int, int, int, u32); +}; + +struct acpi_table_mcfg { + struct acpi_table_header header; + u8 reserved[8]; +}; + +struct acpi_mcfg_allocation { + u64 address; + u16 pci_segment; + u8 start_bus_number; + u8 end_bus_number; + u32 reserved; +}; + +struct pci_mmcfg_hostbridge_probe { + u32 bus; + u32 devfn; + u32 vendor; + u32 device; + const char * (*probe)(); +}; + +typedef bool (*check_reserved_t)(u64, u64, enum e820_type); + +struct physdev_restore_msi { + uint8_t bus; + uint8_t devfn; +}; + +struct physdev_setup_gsi { + int gsi; + uint8_t triggering; + uint8_t polarity; +}; + +struct xen_pci_frontend_ops { + int (*enable_msi)(struct pci_dev *, int *); + void (*disable_msi)(struct pci_dev *); + int (*enable_msix)(struct pci_dev *, int *, int); + void (*disable_msix)(struct pci_dev *); +}; + +struct xen_msi_ops { + int (*setup_msi_irqs)(struct pci_dev *, int, int); + void (*teardown_msi_irqs)(struct pci_dev *); +}; + +struct xen_device_domain_owner { + domid_t domain; + struct pci_dev *dev; + struct list_head list; +}; + +struct pci_root_info { + struct acpi_pci_root_info common; + struct pci_sysdata sd; + bool mcfg_added; + u8 start_bus; + u8 end_bus; +}; + +struct irq_info___3 { + u8 bus; + u8 devfn; + struct { + u8 link; + u16 bitmap; + } __attribute__((packed)) irq[4]; + u8 slot; + u8 rfu; +}; + +struct irq_routing_table { + u32 signature; + u16 version; + u16 size; + u8 rtr_bus; + u8 rtr_devfn; + u16 exclusive_irqs; + u16 rtr_vendor; + u16 rtr_device; + u32 miniport_data; + u8 rfu[11]; + u8 checksum; + struct irq_info___3 slots[0]; +}; + +struct irq_router { + char *name; + u16 vendor; + u16 device; + int (*get)(struct pci_dev *, struct pci_dev *, int); + int (*set)(struct pci_dev *, struct pci_dev *, int, int); +}; + +struct irq_router_handler { + u16 vendor; + int (*probe)(struct irq_router *, struct pci_dev *, u16); +}; + +struct pci_setup_rom { + struct setup_data data; + uint16_t vendor; + uint16_t devid; + uint64_t pcilen; + long unsigned int segment; + long unsigned int bus; + long unsigned int device; + long unsigned int function; + uint8_t romdata[0]; +}; + +enum pci_bf_sort_state { + pci_bf_sort_default = 0, + pci_force_nobf = 1, + pci_force_bf = 2, + pci_dmi_bf = 3, +}; + +struct pci_root_res { + struct list_head list; + struct resource res; +}; + +struct pci_root_info___2 { + struct list_head list; + char name[12]; + struct list_head resources; + struct resource busn; + int node; + int link; +}; + +struct amd_hostbridge { + u32 bus; + u32 slot; + u32 device; +}; + +struct saved_msr { + bool valid; + struct msr_info info; +}; + +struct saved_msrs { + unsigned int num; + struct saved_msr *array; +}; + +struct saved_context { + struct pt_regs regs; + u16 ds; + u16 es; + u16 fs; + u16 gs; + long unsigned int kernelmode_gs_base; + long unsigned int usermode_gs_base; + long unsigned int fs_base; + long unsigned int cr0; + long unsigned int cr2; + long unsigned int cr3; + long unsigned int cr4; + u64 misc_enable; + bool misc_enable_saved; + struct saved_msrs saved_msrs; + long unsigned int efer; + u16 gdt_pad; + struct desc_ptr gdt_desc; + u16 idt_pad; + struct desc_ptr idt; + u16 ldt; + u16 tss; + long unsigned int tr; + long unsigned int safety; + long unsigned int return_address; +} __attribute__((packed)); + +typedef int (*pm_cpu_match_t)(const struct x86_cpu_id *); + +struct restore_data_record { + long unsigned int jump_address; + long unsigned int jump_address_phys; + long unsigned int cr3; + long unsigned int magic; + u8 e820_digest[16]; +}; + +#ifndef BPF_NO_PRESERVE_ACCESS_INDEX +#pragma clang attribute pop +#endif + +#endif /* __VMLINUX_H__ */ diff --git a/pkg/proc/internal/ebpf/bpf/trace.bpf.c b/pkg/proc/internal/ebpf/bpf/trace.bpf.c new file mode 100644 index 0000000000..d4b2776059 --- /dev/null +++ b/pkg/proc/internal/ebpf/bpf/trace.bpf.c @@ -0,0 +1,247 @@ +#include "include/trace.bpf.h" +#include + +#define STRING_KIND 24 + +// parse_string_param will parse a string parameter. The parsed value of the string +// will be put into param->deref_val. This function expects the string struct +// which contains a pointer to the string and the length of the string to have +// already been read from memory and passed in as param->val. +__always_inline +int parse_string_param(struct pt_regs *ctx, function_parameter_t *param) { + u64 str_len; + size_t str_addr; + + memcpy(&str_addr, param->val, sizeof(str_addr)); + memcpy(&str_len, param->val + sizeof(str_addr), sizeof(str_len)); + param->daddr = str_addr; + + if (str_addr != 0) { + if (str_len > 0x30) { + str_len = 0x30; + } + int ret = bpf_probe_read_user(¶m->deref_val, str_len, (void *)(str_addr)); + if (ret < 0) { + return 1; + } + } + return 0; +} + +__always_inline +int parse_param_stack(struct pt_regs *ctx, function_parameter_t *param) { + long ret; + size_t addr = ctx->sp + param->offset; + ret = bpf_probe_read_user(¶m->val, param->size, (void *)(addr)); + if (ret < 0) { + return 1; + } + return 0; +} + +__always_inline +void get_value_from_register(struct pt_regs *ctx, void *dest, int reg_num) { + switch (reg_num) { + case 0: // RAX + memcpy(dest, &ctx->ax, sizeof(ctx->ax)); + break; + case 1: // RDX + memcpy(dest, &ctx->dx, sizeof(ctx->dx)); + break; + case 2: // RCX + memcpy(dest, &ctx->cx, sizeof(ctx->cx)); + break; + case 3: // RBX + memcpy(dest, &ctx->bx, sizeof(ctx->bx)); + break; + case 4: // RSI + memcpy(dest, &ctx->si, sizeof(ctx->si)); + break; + case 5: // RDI + memcpy(dest, &ctx->di, sizeof(ctx->di)); + break; + case 6: // RBP + memcpy(dest, &ctx->bp, sizeof(ctx->bp)); + break; + case 7: // RSP + memcpy(dest, &ctx->sp, sizeof(ctx->sp)); + break; + case 8: // R8 + memcpy(dest, &ctx->r8, sizeof(ctx->r8)); + break; + case 9: // R9 + memcpy(dest, &ctx->r9, sizeof(ctx->r9)); + break; + case 10: // R10 + memcpy(dest, &ctx->r10, sizeof(ctx->r10)); + break; + case 11: // R11 + memcpy(dest, &ctx->r11, sizeof(ctx->r11)); + break; + case 12: // R12 + memcpy(dest, &ctx->r12, sizeof(ctx->r12)); + break; + case 13: // R13 + memcpy(dest, &ctx->r13, sizeof(ctx->r13)); + break; + case 14: // R14 + memcpy(dest, &ctx->r14, sizeof(ctx->r14)); + break; + case 15: // R15 + memcpy(dest, &ctx->r15, sizeof(ctx->r15)); + break; + } +} + +__always_inline +int parse_param_registers(struct pt_regs *ctx, function_parameter_t *param) { + switch (param->n_pieces) { + case 6: + get_value_from_register(ctx, param->val+40, param->reg_nums[5]); + case 5: + get_value_from_register(ctx, param->val+32, param->reg_nums[4]); + case 4: + get_value_from_register(ctx, param->val+24, param->reg_nums[3]); + case 3: + get_value_from_register(ctx, param->val+16, param->reg_nums[2]); + case 2: + get_value_from_register(ctx, param->val+8, param->reg_nums[1]); + case 1: + get_value_from_register(ctx, param->val, param->reg_nums[0]); + } + return 0; +} + +__always_inline +int parse_param(struct pt_regs *ctx, function_parameter_t *param) { + if (param->size > 0x30) { + return 0; + } + + // Parse the initial value of the parameter. + // If the parameter is a basic type, we will be finished here. + // If the parameter is a more complex type such as a string or + // a slice we will need some further processing below. + int ret = 0; + if (param->in_reg) { + ret = parse_param_registers(ctx, param); + } else { + ret = parse_param_stack(ctx, param); + } + if (ret != 0) { + return ret; + } + + switch (param->kind) { + case STRING_KIND: + return parse_string_param(ctx, param); + } + + return 0; +} + +__always_inline +int get_goroutine_id(function_parameter_list_t *parsed_args) { + // Since eBPF programs have such strict stack requirements + // me must implement our own heap using a ringbuffer. + // Reserve some memory in our "heap" for the task_struct. + struct task_struct *task; + task = bpf_ringbuf_reserve(&heap, sizeof(struct task_struct), 0); + if (!task) { + return 0; + } + + // Get the current task. + __u64 task_ptr = bpf_get_current_task(); + if (!task_ptr) + { + bpf_ringbuf_discard(task, 0); + return 0; + } + // The bpf_get_current_task helper returns us the address of the task_struct in + // kernel memory. Use the bpf_probe_read_kernel helper to read the struct out of + // kernel memory. + bpf_probe_read_kernel(task, sizeof(struct task_struct), (void*)(task_ptr)); + + // Get the Goroutine ID which is stored in thread local storage. + __u64 goid; + size_t g_addr; + bpf_probe_read_user(&g_addr, sizeof(void *), (void*)(task->thread.fsbase+parsed_args->g_addr_offset)); + bpf_probe_read_user(&goid, sizeof(void *), (void*)(g_addr+parsed_args->goid_offset)); + parsed_args->goroutine_id = goid; + + // Free back up the memory we reserved for the task_struct. + bpf_ringbuf_discard(task, 0); + + return 1; +} + +__always_inline +void parse_params(struct pt_regs *ctx, unsigned int n_params, function_parameter_t params[6]) { + // Since we cannot loop in eBPF programs let's take adavantage of the + // fact that in C switch cases will pass through automatically. + switch (n_params) { + case 6: + parse_param(ctx, ¶ms[5]); + case 5: + parse_param(ctx, ¶ms[4]); + case 4: + parse_param(ctx, ¶ms[3]); + case 3: + parse_param(ctx, ¶ms[2]); + case 2: + parse_param(ctx, ¶ms[1]); + case 1: + parse_param(ctx, ¶ms[0]); + } +} + +SEC("uprobe/dlv_trace") +int uprobe__dlv_trace(struct pt_regs *ctx) { + function_parameter_list_t *args; + function_parameter_list_t *parsed_args; + uint64_t key = ctx->ip; + + args = bpf_map_lookup_elem(&arg_map, &key); + if (!args) { + return 1; + } + + parsed_args = bpf_ringbuf_reserve(&events, sizeof(function_parameter_list_t), 0); + if (!parsed_args) { + return 1; + } + + // Initialize the parsed_args struct. + parsed_args->goid_offset = args->goid_offset; + parsed_args->g_addr_offset = args->g_addr_offset; + parsed_args->goroutine_id = args->goroutine_id; + parsed_args->fn_addr = args->fn_addr; + parsed_args->n_parameters = args->n_parameters; + parsed_args->n_ret_parameters = args->n_ret_parameters; + memcpy(parsed_args->params, args->params, sizeof(args->params)); + memcpy(parsed_args->ret_params, args->ret_params, sizeof(args->ret_params)); + + if (!get_goroutine_id(parsed_args)) { + bpf_ringbuf_discard(parsed_args, 0); + return 1; + } + + if (!args->is_ret) { + // In uprobe at function entry. + + // Parse input parameters. + parse_params(ctx, args->n_parameters, parsed_args->params); + } else { + // We are now stopped at the RET instruction for this function. + + // Parse output parameters. + parse_params(ctx, args->n_ret_parameters, parsed_args->ret_params); + } + + bpf_ringbuf_submit(parsed_args, BPF_RB_FORCE_WAKEUP); + + return 0; +} + +char _license[] SEC("license") = "Dual MIT/GPL"; diff --git a/pkg/proc/internal/ebpf/build/build-ebpf-builder-img.sh b/pkg/proc/internal/ebpf/build/build-ebpf-builder-img.sh new file mode 100755 index 0000000000..c308363fa5 --- /dev/null +++ b/pkg/proc/internal/ebpf/build/build-ebpf-builder-img.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +sudo docker build \ + -t delve-ebpf-builder:v0.0.1 \ + -f pkg/proc/internal/ebpf/build/ebpf-Dockerfile ./pkg/proc/internal/ebpf/build diff --git a/pkg/proc/internal/ebpf/build/build-ebpf-objects.sh b/pkg/proc/internal/ebpf/build/build-ebpf-objects.sh new file mode 100755 index 0000000000..05efa784ff --- /dev/null +++ b/pkg/proc/internal/ebpf/build/build-ebpf-objects.sh @@ -0,0 +1,17 @@ +#!/bin/bash -e + +# The go generate command seems to not like being run from +# the vendor directory. Remove it and restore it after. +rm -rf vendor + +restore_vendor() { + git checkout vendor +} + +trap restore_vendor EXIT + +docker run \ + -it \ + --rm \ + -v "$(pwd)":/delve-bpf \ + delve-ebpf-builder:v0.0.1 diff --git a/pkg/proc/internal/ebpf/build/ebpf-Dockerfile b/pkg/proc/internal/ebpf/build/ebpf-Dockerfile new file mode 100644 index 0000000000..673067634a --- /dev/null +++ b/pkg/proc/internal/ebpf/build/ebpf-Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:21.04 + +ENV DEBIAN_FRONTEND noninteractive +RUN apt-get update && apt-get install -y \ + build-essential \ + gcc-multilib \ + git \ + wget \ + clang \ + linux-headers-5.11.0-40 \ + libbpf-dev + +RUN wget https://golang.org/dl/go1.17.3.linux-amd64.tar.gz +RUN tar -C /usr/local -xzf go1.17.3.linux-amd64.tar.gz +RUN cp /usr/local/go/bin/go /usr/bin/go + +WORKDIR /delve-bpf/pkg/proc/internal/ebpf/ + +CMD [ "go", "generate", "./..." ] diff --git a/pkg/proc/internal/ebpf/context.go b/pkg/proc/internal/ebpf/context.go new file mode 100644 index 0000000000..695b8105c6 --- /dev/null +++ b/pkg/proc/internal/ebpf/context.go @@ -0,0 +1,34 @@ +package ebpf + +import ( + "reflect" + + "github.com/go-delve/delve/pkg/dwarf/godwarf" + "github.com/go-delve/delve/pkg/dwarf/op" +) + +type UProbeArgMap struct { + Offset int64 // Offset from the stackpointer. + Size int64 // Size in bytes. + Kind reflect.Kind // Kind of variable. + Pieces []int // Pieces of the variables as stored in registers. + InReg bool // True if this param is contained in a register. + Ret bool // True if this param is a return value. +} + +type RawUProbeParam struct { + Pieces []op.Piece + RealType godwarf.Type + Kind reflect.Kind + Len int64 + Base uint64 + Addr uint64 + Data []byte +} + +type RawUProbeParams struct { + FnAddr int + GoroutineID int + InputParams []*RawUProbeParam + ReturnParams []*RawUProbeParam +} diff --git a/pkg/proc/internal/ebpf/dummy.go b/pkg/proc/internal/ebpf/dummy.go new file mode 100644 index 0000000000..9ef6e6d3f4 --- /dev/null +++ b/pkg/proc/internal/ebpf/dummy.go @@ -0,0 +1,14 @@ +//go:build dummy +// +build dummy + +// This file is part of a workaround for `go mod vendor` which won't +// vendor C files if there are no Go files in the same directory. +// +// See https://github.com/golang/go/issues/26366 + +package ebpf + +import ( + _ "github.com/go-delve/delve/pkg/proc/internal/ebpf/bpf" + _ "github.com/go-delve/delve/pkg/proc/internal/ebpf/bpf/include" +) diff --git a/pkg/proc/internal/ebpf/helpers.go b/pkg/proc/internal/ebpf/helpers.go new file mode 100644 index 0000000000..faf371799d --- /dev/null +++ b/pkg/proc/internal/ebpf/helpers.go @@ -0,0 +1,227 @@ +//go:build linux && amd64 && cgo && go1.16 +// +build linux,amd64,cgo,go1.16 + +package ebpf + +// #include "./bpf/include/function_vals.bpf.h" +import "C" +import ( + "debug/elf" + "encoding/binary" + "errors" + "reflect" + "runtime" + "sync" + "unsafe" + + "github.com/go-delve/delve/pkg/dwarf/godwarf" + "github.com/go-delve/delve/pkg/dwarf/op" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/link" + "github.com/cilium/ebpf/ringbuf" +) + +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -tags "go1.16" -target amd64 trace bpf/trace.bpf.c -- -I./bpf/include + +const FakeAddressBase = 0xbeed000000000000 + +type EBPFContext struct { + objs *traceObjects + bpfEvents chan []byte + bpfRingBuf *ringbuf.Reader + executable *link.Executable + bpfArgMap *ebpf.Map + + parsedBpfEvents []RawUProbeParams + m sync.Mutex +} + +func (ctx *EBPFContext) Close() { + if ctx.objs != nil { + ctx.objs.Close() + } +} + +func (ctx *EBPFContext) AttachUprobe(pid int, name string, offset uint64) error { + if ctx.executable == nil { + return errors.New("no eBPF program loaded") + } + _, err := ctx.executable.Uprobe(name, ctx.objs.tracePrograms.UprobeDlvTrace, &link.UprobeOptions{PID: pid, Offset: offset}) + return err +} + +func (ctx *EBPFContext) UpdateArgMap(key uint64, goidOffset int64, args []UProbeArgMap, gAddrOffset uint64, isret bool) error { + if ctx.bpfArgMap == nil { + return errors.New("eBPF map not loaded") + } + params := createFunctionParameterList(key, goidOffset, args, isret) + params.g_addr_offset = C.longlong(gAddrOffset) + return ctx.bpfArgMap.Update(unsafe.Pointer(&key), unsafe.Pointer(¶ms), ebpf.UpdateAny) +} + +func (ctx *EBPFContext) GetBufferedTracepoints() []RawUProbeParams { + ctx.m.Lock() + defer ctx.m.Unlock() + + if len(ctx.parsedBpfEvents) == 0 { + return make([]RawUProbeParams, 0) + } + + events := make([]RawUProbeParams, len(ctx.parsedBpfEvents)) + copy(events, ctx.parsedBpfEvents) + ctx.parsedBpfEvents = ctx.parsedBpfEvents[:0] + return events +} + +func LoadEBPFTracingProgram(path string) (*EBPFContext, error) { + var ( + ctx EBPFContext + err error + objs traceObjects + ) + + ctx.executable, err = link.OpenExecutable(path) + if err != nil { + return nil, err + } + + if err := loadTraceObjects(&objs, nil); err != nil { + return nil, err + } + ctx.objs = &objs + + ctx.bpfRingBuf, err = ringbuf.NewReader(objs.Events) + if err != nil { + return nil, err + } + + ctx.bpfArgMap = objs.ArgMap + + // TODO(derekparker): This should eventually be moved to a more generalized place. + go func() { + for { + e, err := ctx.bpfRingBuf.Read() + if err != nil { + return + } + + parsed := parseFunctionParameterList(e.RawSample) + + ctx.m.Lock() + ctx.parsedBpfEvents = append(ctx.parsedBpfEvents, parsed) + ctx.m.Unlock() + } + }() + + return &ctx, nil +} + +func parseFunctionParameterList(rawParamBytes []byte) RawUProbeParams { + params := (*C.function_parameter_list_t)(unsafe.Pointer(&rawParamBytes[0])) + + defer runtime.KeepAlive(params) // Ensure the param is not garbage collected. + + var rawParams RawUProbeParams + rawParams.FnAddr = int(params.fn_addr) + rawParams.GoroutineID = int(params.goroutine_id) + + parseParam := func(param C.function_parameter_t) *RawUProbeParam { + iparam := &RawUProbeParam{} + data := make([]byte, 0x60) + ret := param + iparam.Kind = reflect.Kind(ret.kind) + + val := C.GoBytes(unsafe.Pointer(&ret.val), C.int(ret.size)) + rawDerefValue := C.GoBytes(unsafe.Pointer(&ret.deref_val[0]), 0x30) + copy(data, val) + copy(data[0x30:], rawDerefValue) + iparam.Data = data + + pieces := make([]op.Piece, 0, 2) + pieces = append(pieces, op.Piece{Size: 0x30, Kind: op.AddrPiece, Val: FakeAddressBase}) + pieces = append(pieces, op.Piece{Size: 0x30, Kind: op.AddrPiece, Val: FakeAddressBase + 0x30}) + iparam.Pieces = pieces + + iparam.Addr = FakeAddressBase + + switch iparam.Kind { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + iparam.RealType = &godwarf.IntType{BasicType: godwarf.BasicType{CommonType: godwarf.CommonType{ByteSize: 8}}} + case reflect.String: + strLen := binary.LittleEndian.Uint64(val[8:]) + iparam.Base = FakeAddressBase + 0x30 + iparam.Len = int64(strLen) + } + return iparam + } + + for i := 0; i < int(params.n_parameters); i++ { + rawParams.InputParams = append(rawParams.InputParams, parseParam(params.params[i])) + } + for i := 0; i < int(params.n_ret_parameters); i++ { + rawParams.ReturnParams = append(rawParams.ReturnParams, parseParam(params.ret_params[i])) + } + + return rawParams +} + +func createFunctionParameterList(entry uint64, goidOffset int64, args []UProbeArgMap, isret bool) C.function_parameter_list_t { + var params C.function_parameter_list_t + params.goid_offset = C.uint(goidOffset) + params.fn_addr = C.uint(entry) + params.is_ret = C.bool(isret) + params.n_parameters = C.uint(0) + params.n_ret_parameters = C.uint(0) + for _, arg := range args { + var param C.function_parameter_t + param.size = C.uint(arg.Size) + param.offset = C.int(arg.Offset) + param.kind = C.uint(arg.Kind) + if arg.InReg { + param.in_reg = true + param.n_pieces = C.int(len(arg.Pieces)) + for i := range arg.Pieces { + if i > 5 { + break + } + param.reg_nums[i] = C.int(arg.Pieces[i]) + } + } + if !arg.Ret { + params.params[params.n_parameters] = param + params.n_parameters++ + } else { + params.ret_params[params.n_ret_parameters] = param + params.n_ret_parameters++ + } + } + return params +} + +func AddressToOffset(f *elf.File, addr uint64) (uint64, error) { + sectionsToSearchForSymbol := []*elf.Section{} + + for i := range f.Sections { + if f.Sections[i].Flags == elf.SHF_ALLOC+elf.SHF_EXECINSTR { + sectionsToSearchForSymbol = append(sectionsToSearchForSymbol, f.Sections[i]) + } + } + + var executableSection *elf.Section + + // Find what section the symbol is in by checking the executable section's + // addr space. + for m := range sectionsToSearchForSymbol { + if addr > sectionsToSearchForSymbol[m].Addr && + addr < sectionsToSearchForSymbol[m].Addr+sectionsToSearchForSymbol[m].Size { + executableSection = sectionsToSearchForSymbol[m] + } + } + + if executableSection == nil { + return 0, errors.New("could not find symbol in executable sections of binary") + } + + return uint64(addr - executableSection.Addr + executableSection.Offset), nil +} diff --git a/pkg/proc/internal/ebpf/helpers_disabled.go b/pkg/proc/internal/ebpf/helpers_disabled.go new file mode 100644 index 0000000000..daf7f091ff --- /dev/null +++ b/pkg/proc/internal/ebpf/helpers_disabled.go @@ -0,0 +1,44 @@ +//go:build !linux || !amd64 || !go1.16 || !cgo +// +build !linux !amd64 !go1.16 !cgo + +package ebpf + +import ( + "debug/elf" + "errors" +) + +type EBPFContext struct { +} + +func (ctx *EBPFContext) Close() { + +} + +func (ctx *EBPFContext) AttachUprobe(pid int, name string, offset uint32) error { + return errors.New("eBPF is disabled") +} + +func (ctx *EBPFContext) AttachURetprobe(pid int, name string, offset uint32) error { + return errors.New("eBPF is disabled") +} + +func (ctx *EBPFContext) UpdateArgMap(key uint64, goidOffset int64, args []UProbeArgMap, gAddrOffset uint64, isret bool) error { + return errors.New("eBPF is disabled") +} + +func (ctx *EBPFContext) GetBufferedTracepoints() []RawUProbeParams { + return nil +} + +func SymbolToOffset(file, symbol string) (uint32, error) { + return 0, errors.New("eBPF disabled") +} + +func LoadEBPFTracingProgram(path string) (*EBPFContext, error) { + return nil, errors.New("eBPF disabled") +} + +func AddressToOffset(f *elf.File, addr uint64) (uint32, error) { + return 0, errors.New("eBPF disabled") +} diff --git a/pkg/proc/internal/ebpf/trace_bpfel_x86.go b/pkg/proc/internal/ebpf/trace_bpfel_x86.go new file mode 100644 index 0000000000..61675e26c1 --- /dev/null +++ b/pkg/proc/internal/ebpf/trace_bpfel_x86.go @@ -0,0 +1,126 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build (386 || amd64) && go1.16 +// +build 386 amd64 +// +build go1.16 + +package ebpf + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +// loadTrace returns the embedded CollectionSpec for trace. +func loadTrace() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_TraceBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load trace: %w", err) + } + + return spec, err +} + +// loadTraceObjects loads trace and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *traceObjects +// *tracePrograms +// *traceMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func loadTraceObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := loadTrace() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// traceSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type traceSpecs struct { + traceProgramSpecs + traceMapSpecs +} + +// traceSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type traceProgramSpecs struct { + UprobeDlvTrace *ebpf.ProgramSpec `ebpf:"uprobe__dlv_trace"` +} + +// traceMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type traceMapSpecs struct { + ArgMap *ebpf.MapSpec `ebpf:"arg_map"` + Events *ebpf.MapSpec `ebpf:"events"` + Heap *ebpf.MapSpec `ebpf:"heap"` +} + +// traceObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign. +type traceObjects struct { + tracePrograms + traceMaps +} + +func (o *traceObjects) Close() error { + return _TraceClose( + &o.tracePrograms, + &o.traceMaps, + ) +} + +// traceMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign. +type traceMaps struct { + ArgMap *ebpf.Map `ebpf:"arg_map"` + Events *ebpf.Map `ebpf:"events"` + Heap *ebpf.Map `ebpf:"heap"` +} + +func (m *traceMaps) Close() error { + return _TraceClose( + m.ArgMap, + m.Events, + m.Heap, + ) +} + +// tracePrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to loadTraceObjects or ebpf.CollectionSpec.LoadAndAssign. +type tracePrograms struct { + UprobeDlvTrace *ebpf.Program `ebpf:"uprobe__dlv_trace"` +} + +func (p *tracePrograms) Close() error { + return _TraceClose( + p.UprobeDlvTrace, + ) +} + +func _TraceClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +//go:embed trace_bpfel_x86.o +var _TraceBytes []byte diff --git a/pkg/proc/internal/ebpf/trace_bpfel_x86.o b/pkg/proc/internal/ebpf/trace_bpfel_x86.o new file mode 100644 index 0000000000000000000000000000000000000000..33ac3f003d861928fbf640f4b25527ee6814d16e GIT binary patch literal 911344 zcmeFa33wD$_V-`a)g3x?6A~byK#0xlB8GG%-54-#7z8vbYFyB`r&%QK2~i}Vn1D-^ z#VDw#D2p5JIO>4Q2#y;%j^Z}rI*g8r>!9O;#pB>tLk=l<^0iO_6^v!<^Qv-Z>ML8!4yv-S9JEQ(iNBr}y2+ zym}d<)g@qA8-M=!XSYM97b2QmtHY9RWwvmBct$_+bWFbz`BZhWtd)+Wr}Jmw|J7N- z`B~@idFdA6@daX=TBLyK1!B`Jxg0URKy13Dmu9i)7S6^RUm!N!vVuz-Um&)rCC2He z7l>_YDb_5usU@jdY*R~xX0c5zm72viwNz;q+tgC6S!`2Fjb^b;Ew!4(Hnr4g7TeTP zuUTwU%T&!`n_8MRi*0IY)hxEDrA@Qgrj~`8#WuAp(JZ#9Ww~atO)V=li*0IIrCDrK z%NosMn_AXt7TeUaPP5pimi3y&HnnWfEVij-qh_&9Et@opZED%9S!`2_$a{K$Sm=Y5 z34O3_YRT0swy8ywIK4nD#$U&a#rSI$i}BYi7UQp3EXH56Sd71Bu^4~NVln=j#bW$5 zi^ceB7K`!MEEeOhSuDn1vsjG3X0aH5&0;bBn#E%LHH*dgYZi;~*DMy}uURa{U$a<@ zzhX0hmB&0^92n#E##G>gUfX%>s| z)hrg{uURbgp;;{SqggEUrCBWWr&%oYsaY)at640@U$a<@zhGhWib z@z*RC&~Fd3_RPd3)-rDD6F{+sYTPx(^{ zDzhH{r**kaH*VtR|E-<3c`N5NE#1uN{pa!a^`jE~b~UuPgw|MFI>vuapJ?~Bs0mHW zWgjBn-kZBP-|kjGU660T*^}Z!)|uRX|9O6*9qMr2=m?sI^gXlXyuW41d3AhVCjYyF zB(QvYdLRTl)}GLpE;#9N_w#jUU|?z>32sO~!klj($Rm+XuVJ2O_uz8#?SJyFOTK-B zE#>WROL>QI`b>FOSzIryQ*1-l@oY&)a^CLxyxqEyzT1~8=bxy{_0O-;<;J<+ z^6e_!k2Z72lK#QEtIIn?m!~W`G2b3#McLZSA*+_-vCgp#S^Kk{Xz#4^AH@CGzFyRy zA#04TmtW3MU9VDI&cJR|PW$sHLCDhmyQRFrd|tl2izPa-dAvi`L0k{4*K9-9Ft*T} z)fGq7ztn#rtBU!@a`74p&hdLdRLv8;a~z5e66tkcuz zQ+$PH>ILE$8I(t}l$g|v^}Yui>l}0*ozYm-n-|pfe(H(Fq5{KDBi~q*Z}?;E?`8O@ z#*IZi4Sz2Cd$7N;K%V2yK{cs{jRkq^Pp4m@?#DdtqSu9PdfjpLx{#n~)(N#Rqt9A$ zgGHYc?WmsD1$tf=byyGf<@A~Lpp1Eyf7M|=SL*cjY(v%{wzTfhNaovx9p>}y zIz6?T>J?|3Z|~4yehp=RMz@7Jo!eo4(df{4iVazPbh`Ww^Go_CGrweiJ0I7dU(T;0 zogW+2k5o(fSF;UqtBC*q(r0%=Kh*NZq8!67`s`--W1K!}_(h))!=KCPyRyHrK=u_f z`pjm3I=!w_pXjH2dwbVs7ehay&n&|)`V1L<(Pz-`i#{F0FZv9yzp+3r2pN6K4RSjD zT&F%e^@(-zXV!svegDbui#~re{G!hv48Q2}d&4jK{1^Kh^}cIHpWm@RonFhf^ZLHM zubjqR)RCe$nTb>~AdC#5SYPFPPKmC)jSgK5MYr(0x)Z z+ik!9Je1RK`~ByEI(@w^=YPBZ9Iew+tN*9_&q|K}-|s*7(CKKDD8FC3|CIah|NZ_` zo)0t6cmJ>5fBu7YV6LB^8-CH}XNEt9erhcG)bNWwKQa8G&yU&PSg?_8MxP%shxn-g zdYiS7h5`FMtJpsY4?{8V)7oy?hf7l`%cA`|%JD)RlY&-)>EG%00JiD$3eIP&y`x3- zYZxcN|bd2F@qnkuTy*!t-Vr`5iKui?OJl z%({GHYWE>h4QmoMi#YxWN#8J0)`Ny|vR-V-?=YPo^5^sS$#4vZhv?^BYG)F>^8hK3 z_AiP3{Zi@|`h?N%m-M)PT>pWAGQFSYNqg)7&gA_y=81NYpG))Y+p%Lo_rqiLex9ZG z^RhTS;`MXnSbnY?Ydd;>ty1UH`JDU9eIyzkT2ICP`a1JldConbbzrVDGYr41Gv^up z82YQR=v>1u>&$e+pUdf|vA?lkD%;FD)5M%k@5y%CuY(66*Z-UA;J*62O12@Zb03B} z;{Tm}m~&VMraq?_e$nUIhChb(G!~s@_(h+MhF|nKnf;9g^=vcxY+z2OE7*4Gb9;Y| zIFof?>hlc4FZw*)@QXfAGyI~@Qw_i9^Az?s7SyrL=<{Uebh?~vr#`oLeNJK>nEE`) z@QXet8h+8|1j8@-9B=qVpX1oySWwG0qt7&RI-O+Osn6|QpC_^oOnshU_(h+`8-CH} zafV;?d92|VeICR9#)2BQ8GRnjoKBar-FAJ};4b6;=KiyDA4d9(yYK(O&jF8O9hmw& z((sEu#~S_^n$}o!gy9!`9&Y$WpNFx(v7nl5MxTc=oBJ>^_S1d_mG`u^Tib`B9R2-< zm9%+)f0=z4m-ET&!^nJSm?ZP0AuaQ%p;qQk!vvX+4HISlHI0}0P9Ijq`TXbhVPrjM z7$@t+e`6n}xm~}c$6XMje#z{^%wf*ovJcb7{O|9>EZ6yT?!#=~`!FA}4$O7t1H&)t z%=?Bv2E8^G{oU}(I`f|4mv!b{_BR%6V4GQI{>Ge6-^6y?uY;ZYFtqSxzHjzh*(dxf z>%i3KJBDBM`L^K~eZFP*MW1gPe$nR}>~Abs&o-ma*O}AlC2TwOxxGI}yv8~(_4yaW zFZz7d@QXfQG5n&>mkqz@^Ck8-7OZ2N(dUcI>GUGDo%-C~_4xwpz|`mShF|pgXTvZ0 ze9rKTKL2F+MW4^Izp-E~+l)S+VNRzPvhCF8_O8#TSqG**pECTS&nFGP=<^A~FZz7k z@QXhG$o|HHHEc8be2h7rUch$S^;u)lzs~Q&_`i4ft$ZJ5HS56C=c9&S^!W$FFZz7M z@QXelHvFQ`huGg(u!?O)pARyd`!KES-Vj*TxSk8{Ibp*WcXvyYh%$E!!PU1frek! znFHA0SWv|_v(D_#oK8pCcItC`zfaqbbztgqU&Al@9BueTpQ8-F=yRmu7k%!-{>Fkz zwi$hnU{0sQY&-S2z3X#t)`6+d;f7!IxtHM=eeP-aMW1^Ze$nUd>~AcnV4KnBZp`U) zkZq?vw|9N+$~rLhIn3~jK8G59(Pz2g7k%zx_(h*X*xy)?WSh}viW%>*VB4wB?OmT` ztOHY@gAKpvb7#XZ`Ybj4qR)ik7k!qnzpeokFu(Z9}pnBUqy z%ua@Wk{IX4q9VgD`W$HZW1QYI{G!je;TL@>_BR&9*k<%OfZ5!K*~EI?mVFq?@j}$8 z9{;a2_F*=1KAC+OnGX$u87OY^KS!eELPN&ae+j*b1z2B$Z!#XhadAH#gecomG zMW1&Xe$nS0hF|n~JNp|8mb1<1^ET#mx}I&PKDT#$-pV>K^?8fo7k%Dr_(h*L8Gg~{ zjfP+Jxs3gd1xwgw^tqHdoj#3ir#`oLeJ*AlnEJfI@QXgLH~gZ{MTTGWd7a@GeO}A{ z#)5@xGy1%SIi0R!+o{j(U7uI84orPsW%xy(R~mlN=K{ko`kZh0MW0u&zp~19VWP~xrtwnW>BE{i zpa0xGjI0L@<7B<~Z|uXYYS%C6agXqeRtE+={r=@Am^1q@@;>l?e;;N8=ezCeOy@q# zZ*w1JN1iX{I#X!)Wu577_+_2xXZU5E*}?G3I@6c^jRh{-%sSJDIh}s1Q=ho5cfJR; zx1paT`UUTiHvFQ`e8VsL>}B{xpFIt~=(7j=@g8Zm8GZ6=^YLCZ`MV9B>*x0V9MRp- zkLWYU@QXhAHT%DKU%KcsYNQu^Mhw5`vn%`Y9%;52eP%P`J?EY4XXpBfb+U`0AJJ!) z;TL^|48Q1;|2)YrbSwIFjP#<<0Q>PCX|@@C;>CvehxeR!>a$ay(C5#r1M~j#C&MrL z{L%1>K7TO$qR;OQzv%N{?8keg*=F?l9W&l@&UV|c?=>Xr&V86Ie~0C_^1GyOSqG** zzcKux&#w)?=<_SXFZ%qa;TL^=$$q>?nr%j(Uoe~dFl*SqE&DK(qqz@L(2exl{=K#I zm&MX~LZ|1i8MUiVO#AtD!0r5D_P5t9<vkkxK^DM(J`fN1(qR+|f$NON}X7t&>jQ7E^?bPS?{=9!C>%i3K8HQi< zdAi{jeV%6cMW3e{e$nSC?8p0H*=F>4GBe%>%eGUW+q*s|u?|dqo@Dq%pA!wg=yQVM z7k!R5{G!is?8p0H*=F>aX2$zq*>>u4d)McQtOHY@Cm4Rw=kbPL^m&}&7kwUU_(h+` zupjS(Wt-9G(ad-sEZc3@XN^VwI=^@ETl?O{QLF<~pGO*g(dSshFZw*f@QXeVH~gZ{ z!`P4a!LrTh^H65nfvL}T48Q2}ZNo46e9Q2QKHoI_qR%(jkN3f{&FJ%WX1ouUZKpoB z_veV$SO=y)|6=$>pRXEz(dR3MU-bF1;TL_r#D2UFmTg9#FEZnOuxvZ^xxMT21=fM7 z&*u%l==0BpU-bE$;TL`W$?%IlpJhMZ2g^32&u5tNK3KM$`rO|2`84am)aO%%U-bE; z;TL^AVfaO#j~jl`=O5XR_rbEw=<_jVybqS`w(GOTqJN$HFu%2ZnANNUQ=g9-e$nS2 z48Q2}5yLO~eAw`dJ|AK~-UrJzqt6GK&3%|w_HWBR4CUzWH>@%d%R4mSL<&KzX;Wt|yg_+_0r(D2JTa{&AC zK3KMyb!LBNybqRbr#`p$`?UR72c|yvHT%i3KFvBnU9BTMQpXG*M^tp@S7kv(4Ki&t+HlxoJGu{Wwwo{+myFSZU2c|v; z8-CH}&W2y~S!(!2p9#Y+`Yd5T-UrJzqt8Licpt2O&f3<`scS6y*SQb#Tib`($vdc9VJJs`zhNbx)&B1z zZ)8tqA4cW_-UrL&;(f4UYi0i6eXzn4W&YuPu*`TLEZhIwK8&mfcpoh1``_4ysYcFz zzuwAeXwjZ>&(5(cpog=&il0O{XXp;)0%kYan?=<|P z&pQmi=<{~=<9)DfGy1%Z8SjH-+o{j(U7xqI4orRCV)#X$HyeJ@=S_xR^m(J<7kw^c zKi&t+Hlxp_%y=Ix+fIFM@A_QKIxzKlgW(r_UT^qCpNkB?=<_>u4d)MdHtOHY@R~dfM=aq(E^tr(Bi$3QYe$nR@?8p0H*=F>4IWyh|%XZuK zS!2<^&V88Q+CI!>tOHY@^9;Y}bFSeReajC|NHwe8+1OM`!L)0?~-<8U7PDnq2ZTx zroZ8jK}n58{S3dXGdmc5S!epPAMb-@n^|Z2Fyno&o%%!%biNO^x1paT>#e}>i$3!W ze~i=jGW?>?o`zra*@OLfA1vF9KJ%FIK3L>xS=)Y}*13=U+uX`*M>g^Ph-(n zhF|pgPs1VX@2l)Fqc)uC*zrPPtrSs|BhuOaOVJ>DJnCr|%hF{hhQYzlx+=GpE4pbS#VPnw+ z>}c*mv@oaBqu6fyb+Gd}_qX|+dp_%+y{>2lY%H2#_(h-R z8U7fjKiBY!KBpUg(dRVw<2}-BGx}^|PNyr`cItC`f6hIJbztgqis2W1o^AMJ@H7^k zW%xy(jfP+JIhp-; z_(h+mupjS{W}DIH$;^1qIonQsZtwb>#5yqbd6MB5eNHs|F?bq_CK!Iv=Xk>}`W(l8 zyhoaCMxSYByyu+lw(GNo(|7K}{MPniPULYl^?8Ef7kwUY_+#)i79D5!MW4qSe$nSK z?8keg*=F>4G_$!6L#12Rw(P@Dj{bhbO6)z*ztinF+tng}i+1m0@MQij&yE(=w_%(l zXqZ$BqWuY(Uk$Y~pBg5}{A`#g^Ra2X)PMT0YEJ*3+n15`p<$e?AODSgnO4-;? z|8Sar*zPnxCrN{_N*}f9^KGkUg+5%Hac$Ixn=-B%{imC1wZ(~BGSvsI+E(dm+t!gC zlO(%~r%hWVS)mW7ZYj$+tJXN{DD$kNI+j&$oK@|gwQfuC)g8~;sH0q69rS&!e;nIV z#lt(E=0{a!PILX^nk}atYMl0-c#5^fD0WQJtk3p`iNxR!##%iX>HK z_mo`8SErBHxARTyCGi#cnRIRPC~d|52NAZ)W3|<$?N+M4N>|^nGFMAi+pjYD{A&AE zCZAtzzsltEtL;~re15h4DwD6{zpyUTuLtz&_nu!3xH{GXu8x&}t79GD@~g1klY-&u zSOd314IC@aTHLV??Ce+zc6O`>J3H2doqk=`$YO7?(}#81nPt^mxqA;>+_9F$9cqb& zbgUy>9cu_z$NIt5v379zb!*nufU9E-rs^8_#nNc{L*$oBK3^$*!Q`v^|0wSIIa2!8 z6w}(F9^8!`E5go>HDPDRs<6{nt=|po^krK!TPnj&AL_L8*T!pMhg$wOd&|{z*;;RH z)b;Q?C}>S-%USG?m)}F;^+(L_BJp-qi+KH>swt4p5pPG$bSxdR>R2>f9m|EQW1(<$ zED^4b#Z`4!Yf-7qS&RKf`o)OXZ=_$6csmL~yuK1P$@V7x*e&Jzzm-nI(Xnjubu5{D z9m^$O$5P4H@!xViU;Smowhr%@#EZnW-qan>Y$p+cKl1rx#o3!)S8nRZ$`{}n*1wYEqYAX$? zkS#T9v$k8wWv!9KXvj9)nT2If&#KcmZ#-x|Ox4a`YiqTR_tS5smVT6<)mGZNPUqsU zKwHVBR^NtZk{E5R)R!gylDU;!{3!owx|O=D(7E`x1Y60aQr|6Pk{ESq)=4%jYB!~Q z*rc7m)~RcCyq|t6Rq&(ythUmSitDB5&Dw4ym$gO`qaooNB$v9o+cm_8soME#4XM`g ze)_Fc!H@E@+Db##=vvSpp z^Y2!2*=!^++G^+719N(YoSfX=JLKfqJ+iQ|RBkyr`}f?t&+d^uA_3R39NXR>&n>|L z*8V+rjo`01dq^-m62V~>9Y!LmKE;CIS^C;v%BL&%j(MKqku>O*vXN! z(VjMP2nlp+cVfu0ayU+B+Fhz833KyNrJed%R$hqn?m@dEJ&O?Z+L8_EpZ{rF|PX%FxsC**P8Mb`+? z;)gN?&sTgnCON=5nlsn`OD*=UkyYtly-%O^d0Ey0AuG^3bNYehzrZp5?NraPy=x*zM~*_V z2T|e_iaeN-(ZL}hi%d18qZ0g-ha#m*F^5ICWXn3doKsr2-|67djsD5cC!)9;m4A8K zlA&$d08Y2|#{c%W*$z4BpK~CBAT1?9E7T7r%g!1A6YdhA$Br}be;}Gk-X%AX9o`ep z*%Z;$3Xg`pk&Yu_E4vK`4&7I9hC5iH5jYM7vzPn+u6oUiS%E|0dk+5x@_vzfPA2#6 z?Q+izTY)2y`X@T0PrEZ>fnHpPUC`=4zQt#cqT_;am_AP#OUJ!)!?SQqpLhgZ*UGNI zL8hK1R`&kCaM)J%F>pjCA~+xCIVw_*!zMcH6{1fix`eaOr4$zyfdy#*q zSU37*Fy}dFh0~2*f5H(Zs~jtIC6aXshE~9Y!l5@{0=7eMa^o?`vLf`>xAUn!eRJrA zCJTeXFnxiSv&*u=-}%SkV3>NBs~8D~>BkdXt(<6>e$d1I+}tqDwb7#$`;9!!^TMwCgb z`@3*`f)t@t_9mEIJSSl@lL8xo)gwC#rf08jkgO+;LOVvY=?_D;OGo3FM}gI=D{|P4 zQY~__hr{NRyVs8J9zx#xx@OZKzsx-ufs|2CM_f>dUauMoN2ufI4Z%)sFM2UGpSQeg zuNoZBr#$wEW-o*-kn^S3)BMPtqrJJ~ohz5R=fi2cZ3qKaAM)now4n3a0QV;NESLVA zgYEu_;$8aFWsds~gh4k*rN|k3@)`47H;x0#O(L`*ewv;dJRwAKNbdf%<@Z zDMCk59f_4A=$ugK-UXlKuHjU#a;ncLmD`09xH}*Wxk-ds?ns1P2yOd%9mC?B#arf&p-g5f-?k5%zY|2wnGLgnitb5cYK+Lb!wb zGQxiD`w08H-y$rO-WZ1kJ?OL)yZzB1%N>f)cE=zLxOE5}_gsWQ_ez8z_a1~_c??;-M=I3 z<^F&$-|f+r+EI+Kx4Roc*F6AXANLr9ecjU#?%+;E*w4KfVSo1~goW;72zPYfK^Swt zM>xRkibg4SCxmf#7(&k-g>axd24Ru3dtx_g_o{?D89vLMj?i{n5eD4(2p#t(ghBTK zgdz8Ngjw#J2)nqSBMiGgAk21iqSWpk5k}md5k}pS2r+&LbKC}m-Q5<1x$ZRx^W57J z_HZ9U*wbB$u$TJ|!hH85gaz&o2z$FZsF>>(Bkbc=AnfZ_Biuo1JsKYs1)br=?qv8Z z_acP0yAWZ(y#t}+K8`Tx{taQs{TIS4w^t6;dS`@TcRz&L?(qn_y3-Iw+%|+!_YQ>J z+$Ry{xUVDZ?tYFi*A3v-G|w$S*uyPF*wd{-*vmZ`VZJ*DVS&3CVQ=?$2wnGCgniui z5cYMyN4SHViwgI16A1fD3(nydJe%(xh6Bqz4x#Oyicrt1bsYa_54V-$FX#A06z?ua z=(rCc47!gY)T>Dr?ihm3eo6NY_?qz#s>G4yev2?yN}b7RZr|C>rP~WvA++5JgaP+p zgpPY0!k~L5LY?cqzv|moMIEF_=!@u5q!8Al+sSi zr`ms=boV7ZqdwB73v2HblQI_^^l zgH~U<=Il{GX;+_ZTkfauT5bE4t<5p1IaX7TxCW>>fM;LHdBXrz1=~z-X^`@Lw zQR)Z|Eq5n`wmTYOz^$cYN%s*BgU;X1Lb`c4wA@=M&V3YNzmPLHQhwia zI^4PWdCcLsD=2P%dO~nd$;5rgaaU8^Egbh$ChibC{{)@eDK3CR%k6{Ec84O=t+<<0 z+(aqToMIZMn4d{8t1soTk?Q|PPO*Vgd`BtV9*A_@!IZ>30Aa|TgfL6SrC&cf^YAa- zh45MKN`$uicZ2~qZwESWFN8t&c!VLh8DW-t6T&X;3kb1NBFvVY#`mY3YQJ=ML6){V z0b#(s0-@tRLxs2@BnY{CBh+P2D5Nt^{?fe=KHL2R!hriFLdV^mq9os&cBEAGU%GSP zv)yM923!YD#~n^lZUaI+uSdiv?bI*bSKzbV9zZ>hUf`JXzI5wxV7rSmF%<*ooIj@A zui>-YY@qG#fH2?=La6T;&gE454{;C1f#ps_sI}8SPUp8xLEpD=+>I3H{vKh#eG#GK zzK1aAeuFUNc2(4eF@#;*VF<(S7=+pG2?)Eo^#~*GMF^wrwFtYpD-hwa`T(g(Itfm~G);B-#^8wKIggg){LsX~ta$t-@At zm#L2B3y0&2ZPtzu^||s$MLM-90Fcv$HouBGuf3mzZ$&Wj&+4_ zxUPqSH{daE1jcK?Iq3V!Y$uXX)Gc4q3KUIPYInd-1lJq>rDmf?Ns#O4bW^uYF zVrq>Kxrt)+tPgpKq`roKlso) zF;#W(^f_*#Rpt56C$Uh)06DlqJN*;O<1wdiLJjhxcR)MJeCUUp2Q?JrV5xEn6Khqq z4?8B-spEWzCDyCcd>D|}pr-kt5*yW}KExB7)IuM;#Afd<0JnEw!m_;wd@4!=ZSP@F zcPe(LMA-Iz1dYPF=M*Q_*j{*`ra_6dwl}OuQ%Pc-?TrM@q?C!odfPkRr_#h*wpS0j zf#P;fY_PrOi?MA&E7jn{M%$y2FN%T65}Rx<=V@DXkxXp1y%8@%ia$dose~2qt^i?+ z3ez?b4tQ6;Vq2{N&@PGGfYe9MObiQn;Rkfe zy%M_yywE0H-ta_4z`GGCxxBp-dj`Bae5y=T20U6VxbzW;Q33Bh#4+uY*f-!k?w2q! zQ5EoB@@Z6J|A6OylM5io(Cn)3U~+maR(=+1iYg_=TUiwB&G(u zlR&41(eu@b=74vePlqNJqIZ2dEU_ZsT?!h1G|oFbu{Pjc1>#;hBC#&uE%Rw?;uZ86 zh}VK66YB%s??G);!cmD00q;i;uZJ~>jp+H;ZEFu&9gj|I3V3}%yyhH}*c|XY&}fP~ zHeoql@tgQk+O4+b9G3_?UJ}G9k5A+}-fp1D-H`HxgzI=u|6p5(4FR2)h&f)R9k8-? z1=S{s9q%yE4=*8?bRy|^$AWSxZd{_m@m7PlMdK5dj`wGuCL~5V-UiTtU!cf|i7LnY z2*iujNr`I5`yRw|b5f$l@pAFY-*^S`tV`57-gWdlU@y7c!Iq{t1z3v38s=bj*V`81--L*-N-&u+EjyDA(;?AHq9K>t(jKqqdR|PtSu6pMu)&#vH{J7@C+Tg%HJZf9Z z=svqO5e&QQgZinVCE-p$I^0Dg#6Af^?2{mL-1`v*-6s%+Ebm1a7Um_1*MkG!1pR|D zo0|ycT3a%^G~s@N7|XRI$PAC=FnrRy#9KkH1T-6KtaDjnL(tnDWIcy++7cUs-U!f> zS7Hn=Pi#UvD2~Sdip1uiR}K1s`euH@3Kfl~JNyNSaA>D6jJgz&1!E9-B`zwr0Zt{j z3h)@6t^g0g}tvp z?;MM`>l3lCmmLjQ?^E0jiQ=$V&`nEbaUvP^;-C@xBIS}qdDu&W&cZI7voui=_Lk-a zti`xDca|k8!`^aG%Tb8CF|kkBTLU@)U+Z>mO3Vy<&w*HmHzyW^z1KnaQp#Hr3&Y-b zpbv>|O)Lp}NA$yeUma+9VtLpr#h?9n^mycQTVh4n8}8HXiB(~*8pOkJM`BHQ;ISYs z;Z9rvd#?$5li*+t-IZ92MuFBeBHOzY>%(3X=mnyC5*xzaouCD0fmS3ohP?p(0?G44 z_a-)l+iltBTGSAv>TGL)Rw!YT~fJcFid!7|O1jm!;cm}rhDaUMz$vK6SHgM9p6g}ArPlS(;8&Zr&TQGH7=IF)PV+`wsCIO7k$yFPC zxS+&UANg=$Nlg9Ihl@&z72UFMZWos%72UBgw3bw;o<3YsQmOj;aA`@ED)wP^NwwO| zhdCuRs>+ACCAI2EALfV+WJqQ{6b0_@bgW#c5SXoHI@NlZDiu&+KDysSe_?$mL%L4&rcre3?4$NW&Lo% z#fCW3?aK z#&{%fL4 zIf-)RLKy3SU98A_r0kC*PS;Rxm{1@w119L4is(Y>PELFp$SOR=$J2p!VZD!M00V_n zd^{8ASjA6(bDgDebvX{QNbAeumU;wGNN^*r6(v1zv;rPyalC{CdL12KAJ2S}mSbh} zl3b32gLXrZ7=@YRI@h8MRy-@^I*?U31Tj1;i-5txJ$$?#n3YlY4L~f-7a_CU%MtMG zva+wD%^nHaX`$Q-uLBOH$GDlmepX^0xR)~- zP)PHJE7=IL3L6o_cor~NIMv6qf#JdyAEyALg_rnv4lvhB+zQ6lGN5pYA2l6>)nF`2 zPaJ{g$6V(yihm37=TnUir})CX5z{XQJOYT;UqH!sfpda$2PJN!qtoi}w5{ynI)y{xh3HD7@s1X3p zdcRbqIux*qVyaSAY9fGZuz#vrodftY#T<~TQR9D)9hzqV2c~M(WWc`&#-!?03!wY6 zfP+%?>T-ZbaBym>S^^kKa7e0I{Sh$tPk`!Ft6C3OMsR4VO??h{gy68$LiGdSMS{aq zOH}Sk4M(JwtAPNn_1M%3wHx3QN_J#wmAc=LIV!bAtp%Kfn*paLwN||bXeKy1wN8Bq zxQXDH)Oz(T;BkUuQyWwSPfiTSr8cU5fVU~;_|ztKF<|NQfD=-iz3TxF6P%c`Z0{-1 zm={2`DQuzq1#}WoI+bgCAAp*P#-&_rs62?>Frx9PnC-bBE^I=o*!Gg34=HY9DrtLr zfw=!qN>$k2K|W1NRodPOAbTBB)}^X!uK^SzIyqHsd$atwQ&KgycQt4z#hsd}MF|ht z)>A~MrRuQR0@^@ydaB;`4hQ{AbVh2b?WI9|UId+)YPP*IL4%3vQ?0f)6I4aikZQBN z`Jm&8CZ`tK-c6v%M2)E>wzmp&G0|D6<+k@MXd%(rsTH=T9>(V9OQ0#()AR;|jvzWG zwZ`_I1O4@7(A3mg+glInf$uLkO{sOZ_X%hi(X`Zh+xrQ0BGL5J2HVSf#I~A<&P{E! zJr6XG=)BY>+dIOi8L7>-cPi*PiaS4L1-zM{4~Uvm;edCSPc5n3fVT!T>Q%(eOt}H? zRnXByvr@5u_c7=cq6<>R*qQ)cKy+a$8StWi&~>>eRT1zMXaU7toT?0X6(F91t*NSj zHwJVY#a)uB4tVdbMt{Bqx-?Z2@Uqv~))z#xQ?&ul1x09&c224e8&p^=&iWWMH&q|- zJ_p_R320twYQV~F#zK&}ufq3#zy0P6g84gJLkNEN8b;l&l^G&ME=!iMTCKMtdQy>;TGS?@||;>|LrpL&66sVI>lt zgm3lmVm^WrHd4Zor7aK@I- zNWKo>TazP8ZM(~i^TDEau(W;F=F)i|NFIk|_Q?8H*r2{k82`CN-^g3ZZ;eNI!c&B>#D z9*1h#&B?US;}LH)Cr|Nt0=P>{a4z(m_`#cF8Y)M|_a~;@eNnY>s z$>2as@(!O*0oyIfhkQO2Y_+H-!Q8mhN@phj>PMcA$SyOJpZa_TIBRC|N1xB6KAxEj zW0Q@?q#p6k%w&Pj4dB4cWQos{k=~k_+|B1k%70dJKcCN{{AVSP_4#aYXjbx6pQnI> zvy$ifd=A)|m2C5QDmXAJxzy(-usthzkI&P<)~w`1K2HaCxghzp&*y@(E>JImS(oRP zUR3rF-L}jqZQUt|P`!buC|&i>FSW{ErKo1ijvzwyfqzy@sinT~VP+|2wR-<>efM`^ z=^XVV;&_@~RNAIyVs`L-;l-s3ROmk2`sWa2+FH6$UF{QDmlM-rAx}D&{>z2-h{I*D^-;*>7v?jRw>TnbeGdwv6vFh zFI~P<0HGR=IIhM5Bs>VfgL@@qe=LYAb#>|OYO)UtOYc+{`*2O^-KzC9OLDljbcI^z z$6QzXJ9V26i%RcTt9-b=^!Ms<08h3XN>{1x(Je0Z^J2j0Lp3ZZeMFUEACvc+mzJ(k z^z6p4taPn<2N`g$+*rC!op82g9Ww&0x~cRP^&w?Vx!qj4-YR|{jdh&{Tm2CSyq-7@L_p@Q5SoXaK^=1ybyLgiv-6DM)He=5uN-Uo5#e5LRK*CwC7 zR$<%w-cR|BirQWXe+cmaYRtDP*DiX9DzaI*HZCKZmFkYjW{Ug{HA(pJFNK}dp`gbp z>IW6Gz20}&*1*fr)*n^U_6GR$ld8a-4Tzibv#PYcJwaSgD?ZBh_Vvk*SJ~cJ5RYOY zJ_a9?fq1-}c(q-01oY?x<26*XU|iKBk{geYztwqw`_qWe!u8ji?MH>BY%kZRy!aEizXfp{dc@b--cCOCjN?9TcTn3>^jWVs?&J0W@n@g; z@r|}u?NdPlj*L*lgo?{6T^WtVsz zdIH2Hl*dmAc$-07v!U_R0-k-ho&v+-xKZs2;*`6_&k798_o;%0`o7Y4k^pquDpqRRLZJOTJLBECG}wfVG9dB=fQlA_L4Ry>SQ^}-7M0!5vNwP~OaGgJ^4xMoV( zqQbZmwkWj=B6*6;M9Mt@Z_;VAu!@!4MhP!eQ6#)jsRI!AA;n#U(w?BGi&0t-p&ExM zxmF{OMu1$a6cUIpb*hgRaX|EE?B1OP}yZlU4% z^|%kWs%d4TDU0RmT#U_frPd>gyW%!v@ezP$*X@9>eYk`23qnYI4Y^A-tL^}<(%tHU zvMVXSd(;KU?;fRMh~g|(Ad7?#_X76x;djW-DxojQXQM}*T2(@eX(1htRt^b(x3#dr zN&chAKTeg9|1>%tsZuod+1Xgw1|0d4g)a#?b>-?O#AVU6JGmUS#r3u~!71fomFvT) z<+;iQ45OIS%3T!)97u3_c}$f7rV*S`UaW=!77(0So>aR7ct+QkSEzjeD=4O+yiy$q zc#L3jd6k+1NbU+~EU#8AezLR5Yt(GO5fpQFd97LqID=qHd7Vn#j5V1i{W<0JYHTz5 zm|$x8RQ2)--Grv{X0;oVaeJnfx2k;ryiiOpZ&L>YxNhf`FXY=`uJw84OVrVR%#8Bo zs@8||%U7sLfcaETbNMP&58zqcQocq_11zVQndNKMT)@)=v&z@0B>*nxg7Wq1_dZ-$ zzCk?)pkIeL7nN^RZv$SVb1p95r2YYTl$QL~^3C4QfVU{-l5)%Ty552f4(hl|%fq%; z;M45#Tx{TgSVD8kUE3S#)7KNM}azMOBL7M82$HsIl48Z876;X8=0co?a#1#AX9NN^n> z2UF`Cf<@)Hv1-AJxB-tg&JE?YXm1?1(~pA|m)F_eh6?=+uqEZK*m%NuEZ(K%3-L|1 z2s*GJkCu%*x|Ukm{os(j8Fr?CdDL50Hhqqhy~i)3C8nC3oSXx4=F!OHQO8=@#F1_R zOjyX)IVk&lGmku4#jNaWei373-v*Z2S=kS4Io9=g>KBRGDZ%@Q$fI$yO1{A1X;kXv zgX6i*?7?L}!{N*sOxLhEgVm9U;_LI=!InDShk1iB3CDq07j1)a?Z=+@P|UY>9m9>} zfIbZ5=33cD|1u5LLAR{&mocrtygRwgb8%Q)0%g}ax5U*FzY@3N=J_@N72zz8ht&gs zLJXyITRgYyDV*fo9RYG;2(fp2-W~dYloi#c+ABG|5`fXaW{r69(UEl zr~qHuo^Y+Q2Pg`+B)GkJ(&a}jt`feXtsX}@hNoTJURc?0A?cvMAt?Skipq5g`m2|5 zz}?fkzop&+a0k%uZL+(fDucQsD5hHGIy zGvIOZ`&w$5UzdWuVRf4iz57P3>_$54AdFh2vs0F$kA}H%_{~w-6?FQbtng072+Nib zm1J4*Vub1kWY4>Ki7ZQ5c+RTDcsQk5_;h7=oyE>sE`Q9;`3=sBS!M507D;3gMyPIH zW?L`c2Tv*so%}P!?ZVmbl2z6XnKQFq^AbXFambp*~TMyU4p&l*ep2gpI6IY;8GT0iEftlYBe z>7<%0nng8P>J&r`IRT!daZ){iD|ifsQGGVrlJB$~M+5!}opu7s!l&g~ss$;}`#r7< zC*rhmP$BnoZ5B3%>FY9lXFra#5Fss1$V%d_YeJT4L`p7TB2GKc7w<`ccSq_zo&>lU zF+ARNRFAp-NvC9$tE&OrHK%4(SlJVid-2ui<0Z~sVHJjUhwO#&hNBwIi*4(ks{nh4 z!)i8~!q3H(VOO;xhAS~5+)ph896Jxm_6f(-V!)2$03*XmbtiyJ8WpZl_xmt9T&w=* z!@l7<^%9`yUi8F%;rh&+s|rt5Q&6w{E<()y;bwInfWIJkK==Z6DS#)zf#Fv5(@|Q$ zW5Nrq>|Ig+0mnUMSv3LYj}g@kO6A#0D6xAtc~QVFMW6>;wlR}OMju5XCpCn88)iIRe(Q5iq!%DuK~|R zlIjKk5AL5M73wws_sR2-%CZlrt6zvzVQ627sCy7~U=*!ghnlVga1~yR(0m15dLR~mhH_0 zaULH=!nU`-r;QQZJ>KBcN0DN?XvE&g;p0e!jWzS*h+2-w$~w3{LD$|3;OX@#y4G6> z;^(%{Be?H-%%^`uaNqYFh;_axQe%6s`1D2OINRIc)0Yw4%YEk4KO+Ph1KK2jV&p5I5*p@`&*GJavHY5*&r$Ia-EfD-|9v*Y{(I0?Wq`k6|r2k~~6 z9Zlk!);t8SwINz!vA-pis0b;7!4NWj$v_tMwPA zdSO~P`;|P1I*z2nQv2p;D+yO=%-2s$;kx)=vM;^+xvha~)jio(_-ChVN= zsns~3Zv#2_d{jLN;HlK&1^a$J=HoJ7zw zC#H4>G!yj7DOTU%TCFtx^67*SF59FOre5PUDdUZ}2fEf)3T0ka6M!=gSJKzTTeuyjuc+)FXnW9hyg zz*oH+uv*^?P`KDRi?LeY1sF`Q1gq;vJaCMmm1$|DRz12vFZau^)IJX2#qq{Sy?PeF z)8nSd)Uvfy;LVX{EJHU()XRwC8GQ?C`Z{3u8xVafrl#89N8N_ScB2osV}1P+(4DG! zPhI9CLUcZCf)^8%_b4r(dC z%P=QPPQy_tB^ekfrkJ2JAfVzn;2u>-Qak~KZxBcL_VQLb^E?zq-yyz}U{66Z{$QJEF7 z%8sR|3%Dj1MARP<#TUj4Q4@Mr;w#Zbs0r4dRwPX#OXvBVonV5_+93<+>}RZ9g3dGH zr*ZD>#LpsePG3&($MB!wT}|G{k;Ah%=t?=Y@p)-ZeG;YSg!R8ji0{8_VJZ>de*qWpGK9^NEyuh#S=o0{V%}rm>hTdt z$;y73VqQX!_jfeL%6<)p#q-fN*XiY{yU~1JmGW_wSP9^J$O2rtEgPzcm=&6 zxV*oD^TohfQuDJ}~S3LqQA3eaCEH!e%AYL2A zZ>=5zja`iLu8ZPVQfon6vqe$-F6tG~h%eEg>!Uw7-kYG4PDOb)M6ICrIf#ERvN#$G zdYeIfm0J=m4thU>c#xJxlR+Zba#~M%#kkVi4b&FOMz^dbfb4OhMdj(Ir7|1t>%-!0l1| zVyhq2&vZw0E%L;EEMMyGjBZ5Ado63qQk-{J6u)#TMoMnq-BJ83sobAP_e3i~-aa5+ z@b8UQhP)#{EP>xet3uxKe%yW0nvmDv$K4;T4Ox*ZFVGZCi4U9%sCH)jxLRh4r^n66>mzw@nd5#qUD7KFoPIKE&E(qEYyKI#J7I_P4w z^eQ*J^f|nwjb`K3vG9ZNSJUyr;_#N;<7<-qOB$ZO*H(ldLmKYE>ng*4!f{vXzeQEy zzxc=3SB2m6k8h|7e}&`YD9^=J;Q;E$>6cW6yZOgUtHOQ!<7HJ=_9dvKEWHbGg#BNH z#bc1m66f7MYHu`S-9aewy*}8wfXcb&|K10CYXGj~`+bVly}tfG=#x~B`0!z$3U$(+ zdI{Xvr&7HJU;%v82S1)hPrOObBp>&wR`+5Doj+Foq)&|+bBkrw(ayl9eQMQv$c;Pr zvp)5z7q-rL@%X&YRJCQ&{i9E_`U=T-Mr`WSs($q0i#~IB`Qn%_`?RTESj!mx*=Iqr z5b!mX^Hm@G+HYa91)NXg^ffqlVe&a-!yC8X^ufmMwaMY=73OcjS=S~<`@9((y4K2m z6+JcR4FtulI5p{fGeC_*2M#$HmHu{srK$kK2{sQ1t1*DX3BDVUtHvSy;Z&7>4RBQ> zfVK1efS5YhhaUzMWB&su6y(WBjl^+gVmxUKsR$#}!|BedlZl*)7B;{h=%`x~lADN@IrANyo}%k~q*H37NvIR6ZBoebc! ztiHLb9x&n%a&o@x=GCsoy&SE)j%Bn!`;H-R_w`7$1uSEq6i!_{%-oop3< zgOfbxqq%A+4yMuBAEPnP`|!!!aM|AE{d6u3(Wi6O8;IhJKSR2={dAwt#Xx-M(7y z*ScuRR954bm`k`6q$XHqlvb3MREE=JNm+)eMQMg+MJ}beV48~BLYhU{LS;r}MYf1( zYP;?K&-2Wj8T$VIuNSY&d7tO3&pG$pv(Mucc#|6s`YuIRa0ML;jE9zwxa4`T`31AiVkM>-M+3MaU*$rAE(dvOuH+dPjx_>!V73}li!%W{ zi?YUL%Qvuq%B}dbm}hJP^tl&r##&czdC^_buhKeKP>us|&eyy0kR#&6!21(NuXu`I+nq+qXPYc$&nq_YQe-yX7TI4VVJ6vCD_65kQOH6d|h%1S- zfedfpH*2N~qp`m5k~hdIruleGBvN9@jFM>&X5O)8)7mlMZD6r{9&R%zxRgjxc9dLI-~bTwP!e zkoljWYmhSkn=i*ARjm|`<|vRw5d2Nxa1`AsFLAM4(%X;;i%?O-CqQ5M-4Bw zcen?T=%|(2nfP>HiJ+4ltK~#!ryog@9UJBK0QQsOz*;$ABuP$jG|2uF(5Mr59F6i0 zNEQ-!9Zhl$U>iXPN3;Aq&7tilNOiQxYDf+d_#CaW7T}?Zljb-fp965JJ33Bk2JLjs zJ_nyRj4oSze33{8j6KDdJ}ur@9rU@lB^+G>$yYv8-iP9zNbt3U#ryUALqFj|ulPa`2mgZ)z2b2oZp(i3 z*$!)}a`}@lfE9V=@@HSrVci4bl>Fk$$84{nUwuOy)@tSNH(vn`i70<3eVDav1aS<% z`$`O-`#yu#SV?A%7`pH3?ScZP+h66Ld;iZG!b0s3ValZFPdR5A;2e zH?1+j>VPc?W9|TTNW=EAN6-ZDw>dSfIl(#uGH#@NX)QQF0%Gl^rL`tlLzJvz+6mmx zp=6!XPGZxWA~WqT+ZW$vUT*!fFDoC0Um= zzpz}`zQnO-rP;#j2;!7=O$!LCE9i!iaOqDA3hQ*`GCM6_SOXNvG~9_X26Wmsc+E*G z5Y`mXF^a)TD-u>nx$Kr!f-x27Cz73-Rw}HWN_JXWnXvXMveTyGo(&LhWywt|7uF9T zPFeS~kg)Wb(NyA{>S&U-b9IyKDmx z)WZmub8sG-uo`N$s0A8`ChSQ7-{q3;^UHQ<*4JMO$snICf7*iH!6LxVbVQn12BhpVNm3T=>TCN5+Mmsz_)P{T8NHR#$ zl_XTh;u3Ff*l9)|JhQ(+EPl6`>XWa-R0S(>15)x9U=hKMKGS*+z_oOm&rGmB0o9VI z+}An5`drCw@^yA&uLHXH+`U5$ikb5xwW&9n8GM#CV-tMav!LXlxXQ=h>Q0v-yh(^R z6(yWQFc})S46u*jYN+)(z{dpFK&>~y^Bq*du0^eI!*&5d8ESuSz zybDHLvVoT?k@j0jGUgf&!PXuLvq$8#spl5rh>ZlgQ5-wq@PFgrGNdt&W>B2Q=k)jr zkK9%~>?@IRTb$k|*q#VBgvidCfXI76YqJ3t668T^4`U3@Dhxnt#qb;=-JId`WBwCv zJj?U{lS3+H%^3Y($+f`fF0H9B+H`GOP>l4+hY=HHR*XU#euqyUt6hj_>81v54=+Nr z)OUOp9z`Jvi#m@CMJO!l+I>%wi>a{QfGMI58UaT1&T*68z0~oJZnFB394KWeiEI=%I^{EngFmLzoSNLIpxo(_+W_Q4+~o8~+KS6?v(uEX1NfZaEl$6D zTltyp49Wul-o2 z4fH#?WLO>9NbW&o`uQs%$1x~*0&pqCmjkWEy2%!_)&YHH)^s;$t+Rqtown?$;527I zo~OWuKF2A@g+5Cabca5t0gh9oJ)qCK0sP%M-B}_RD(LB)AeSlV z0H8stRBdWWL(o#;yMQ8d`;cUbQz8sbD(x>?asC%V!H6b*Bt zE8VK-0%yL%`cYAV6P@Qj6b*Nx^Q>bi!s-~|MCUmPG@sNq(pic#N}w8|QBHI&PY3NJ zy3mO(xEUMsKnWT zE7q=#cE!d!8-;ZxWL)7cb>c#@TR_|uyUdAB)V-keTM_02CpuBDfw*Q}?rgyXI;i3) zq->(I6|rN-5l`Y=;dJSm^%aDBn;^W>>Cv$-0dJB^^huC(a*of)^-VzY)r3m#p;Sg% zH#YtEp&38JO?M4iorwx7yzQ}EdP;kKWl~Aip7s!vpIb=mXm6j1!n4Jp_Plh-scpsX zFH$4JVQgLd1x~Lg&);FM-zji^7r~MCK4}BEeLC9S)a>8kP8W+4_*fjP=ut$JNDG|l za423A6fyS!dTF*FrSBKVBN5k8h$oOXL9wzET{9YBYrl(n5fqnokY~XIM>e5@CTYOS zJ(vM_@;D$hsdYGhDkGe z;+Z`IPHG*ZZ-yL>Fu9rQhYg<>0@!DNZ1^k&a6>-;^M;oy$$6MJoS#%Dr@W#sdu_TtIN z)CC#1Q3}cD=Bps1Nag`J0mC!KN=MhIWJE@Z?4z8G%$Oi)rj&>HqcTe6d5|z%m{BH& zD!3@4T#izq6=sCwcojfV#!OiXVC7t#Q7NxgFgl}3P6a&rDMlD$GO8tY4(rCED8^>g zYQ|$ovP~26tHnodxfKSkFwJf)J`MV@TaQnJe&Tk?7vOAtKJxmhJ4wC*I7o27?UAo3 z$!Bh#+^Zy?yG_}oBwx5Y%l%5y;`Yk}0M^f!Zc82l@J#4Iw=I8D@Rd6t+hLiAC11O7 znU{iZ-1)Mzf^XeWJ%FcM54nqEZvZbWwz^B?GyS7**j*~ODfrG^CSOx<#NB4u;ix;r zd(Y)p_4s4JRkuHJB7V;g)`gxb%O37GtYhKVqI0 z`~R^!vJ>TGi1?M0aCZxU zyFNLI=+Mpr{Y}2QB|??K=*RKYM4Qw8H4V5;L*Z=tG=v$z2E~a0-bi&u;!Jt1 zf-@8Eg(B6qvdEF=jXD3!;OZM4`avD6%qu}sM26_1;Iv1NfY&?0p z3D@T5oY*AJhuM^kRMGBA?{jRU`$j9OQ61Wvp>dg3# zmZ^1qE#+Z|Tq5L}kN#D|p-MaF?Eq*aiM} z)D_4N;Eem8JL`(Ldh?L~g*pta+anTtEaXLEd7BiiK#FLH{UoJfCDIT(rLYQVD2IF2 z&eL^%83Jsl8vP6sbSHo(ZB`>e)NpZ3YwCh=y**pkUoL?&Ze7+Qsmm3ts~aNM0=Ubt zzOFzsR#NItIfuslOX~8rQeu{}_LjCu>tmEw=<5d(FC*>kQM!BrDQ^P&O`<39+W_&8 zEE);p`smjbk^Bu;9`SG;SJ`DWMZ6HfHpBJ;xDt!%ba@ECTLm7ebIG3+EUrt^L~Nx7 zhlxty-Y!KpHi|hpG8>8KDc<{VD&;i5$|(r0D#tI!DVUoRlz9MF$o)8kLc5I^=H-l) z6P09sPKhj2upnoGycxi%dLXA%&Qy{Ib0*8V3aWF;5@(vv1CzBNNxu3Nry*rD&-4+eU$3OIaRU`PH!+gno}(c0NbWQQj=2?Z+*4ha(54&pctTRV=k!E^N9(>3aSuTV;&rFp8~;tQ z%NeguyD`ur?Qx^MQ z=j+xKRCWN55-U!V(p{0G_Na%}E}V+E=vecUUFcM|yMv-wFc54ZH} z?9*OtPR<e(^;wIU0runHyJnt&Va{J{c3c8|a)2jUV(X;sxz>RJ; zdN#4ItVCyq#;P224mvac!Wk#WLTAQ}6i=Y0u$#M7O9_H(vCl<&AbC*mq2}_zjw|4P z-PJ{zKXSQpl({*{)kB#-_PEZ3nN$9W>57f|K1Cr>c^f3LX$n^ty?t^X46LTJeUN>D zbmUS;(l`v0oe1|OV)ZfE0$1EoS#t~*!2q~*diGeGFWcHWLh@xzv#;Z-YnPm6?FPz}S~BYv@Q36 zSa0nT@jXDuk#2~yZ8yXf?S^od-bnPfnY(X~`Co)(oA9|>oJ@+(y8n(1fpZZ!Pucx} zjhs{}{388{-GPrl(w90ee_=!5D!>SWzmxouj-35W@DDZw(up(eX28GL5SXq&OAbmu zAdMuB{jyakdqBx#pi%9Dm(>I1b;E|Ys9=|SL3 zE|*6DqX=BdA$fK`O?!{PNJbZ$;8uV;xk`QoI6;t@T+RF3xnWI8u95#h!kd|rlUHlT zKx8KJc9Z@zqcFyo!lW5j;AtO5u8YKq1#$xntml>3BN6NSty>H`JUiZtNbQnEy# zYT*1kY&&`*scZ+mMRGwSlBi`y%(5FyI9!jXJsRrsi}ed+9t>r$5gU+|vjCjnI%K6k zfaBkYtPBHiy?74yI~zApklf1M0h9MWJT&8OJacL6Vaz8JMPn?+qoX$x?{YR%!Zc$8 zo7wXY7&YT%JndbGBqWZe^7xUv)8D7InNmKM>XI|zgcWx@)x*;m3@1`ed6$y>km~1? zlr&W=eoVFHLy$21lp5eKEw>Rrrv~LxNUpvG&VETPk=p?LivOBg%HwV))u`W6%i_Jy zld0vJaXmcbPQ$}q4Ih5d2VH6y)>AlrJ(^qrc%7i1$HjXxnhE-QFdu$~ru|4Tzyl?2 zf+_OLgroxRE}&*mI*qqr?C51%Dge#+?7vRQGV1;}l2EGKI!{8vb9WTMV@H@GzhKC^ z<|%a2nAZJVNIpVJ#jzx#Ke^&SxY|VGyqGL${K5O5@%@9*?uM7f6djV~Kk)i6Y(#3Z z#v8!Mr|>1aWEVK$K~h>WdOJ_RjSd^(Nj6r%+$NeAf!^2Y5vdcqV9cd<%6N-RG-5LL z!xZuIEjgTyHyP_+BtC(MeGNhmh{X%yDR>mMm~J!Xx3dPdI3G?JmY^1o0C2rpiVaMK z0PX-kw!oh^nA(VC3oM+*S++oqQ=-Qa+(ZRWEI@2jWri7WT)P1K+icCa4L zBys;a@^Ad|{}I#stDS40smI1=qf-S^*BfAp)};8L5WkHV|0aHirv7v|;okR=B%fw4 z0C_}eBJZ}GiXem!ZP4wo<*!g09pbnN*1e{{%D5e-?0;^=8bX3t=apZ;E<6K%)_XM> z7!ZXG-U1m^Q0J}Y^SE!?eMpAXpN{aVs*#~dWs>}{2U5r7#2 zJnuabpElm&#YFfD#LsQ}Rxc*Pw}7}tZu9yb)?N_L=hu5N_5G2OZTDgdyBl6Oo~qs9 z#T52=@1U8T;J{&cZ^&U)y{&2EuK>N^ZFX3-uWH)xk)Rj7E!eM(P>N`7<|S_{7UL|W ztUyfj%0tLK4}8nLTHX>;!%be-Y591{A0gULHaA1`JQ;5BYB?S}r4QayDPz;2v(5@` z^}0wW2jP@k`*xb$4zeV1ombKjo#VM4K7Ln`PVws8DzaoMyc^`%UV_A$Vy0IPgLm%i z-2q>;7k3;*dZ*VV7r_ZP@Uy&;hL!tXm0q7_Tn0C}rFhtP!BM_=uXDTu@qTB_kswfh z#Xjg9nIqwn+}AnMgMOc4_^`7n9T(wv-;L1N{?2~+XDWV$iQpqlf6@$efOOg1IUoy0 zV>C|iapxe;Kft%=ARbBsMN;b|PjBYPU9rMFlt(LtM7mY4! zuc8mcTQ2J(Mf)&9x4r?f&OQ|QrI4c_F0uWh#ntVkqK^cYA-;BXOL`?LZiYn`EKXGx zAH$*xEY4OIpTMFsEJi7d0~AK9t6QnE_>97U#r4YKa|#0%)0M>+6b3BrQ5G$*$b`ki z%Hm5{WWXYJ#lt~Zq{HHA<>D(?n6TKaEWU5$d{T&to!+I0MFXwk6Xjrtzi0O#PH>{I`qlJD{6d2aR zaZ&nSlo-~26%a>F{J=!B?5C?LMx?gvqASa0B?v5Gz#KZ+W|`T)fK zeiF@w)uQNU(P~&nLA*ig7je?CegpAENWTirZMEAIrQd|hZS5N#o&P*3JZ|e9MZXKv zZKc5_&yD^e{BCOys`1dLP;vhhw%f{t>^VxyUn1Xa-3;PU@ZX}`ZB>F;OaF+F+nS^3 zUs36{7JxWRO|NoWHHsX1wcC0|xlGV&+*X|;q1U>tZJ_f*x3!2?oYIWknyM7(CtL)LJRqIHAEp>28%)IqOIv`RCvJ^6D`s$P|7S$N%szX|f`)rnU7&W;GB={1Q~s-lj1 zZK6e|GP{w>PWtLZD;qM_wW&8GT0KBKh)LHQ6RmSW{6c5wO^MbJ(6=VaFH>($vn(|vjg)aOsf*s4XyNAfh`%iTC{otdq4oF{F1zX{60K)JGY*0Lx|U>p2IA7p z*8NG=QAJX>ldRuCJcpU12a+t^?}*IwV4Xk7!XY(n3x(264<=b%L41$Lsd|2r)g8p| z(P?^7l64N~J#uO5B}vwuApRWW>ZM86JkVrxm_&EIEXlfgm_vKW#<#wQUY=xa1bs<# zx*kfhKCy5hicZz_)GL#$KG@g&iVj&Xy(-Ci8!rDQmw9@1lJ!VIRG$I8Cdpa}dbvAf zXXv#_)&y{REuE#eBw77Itcl)wYmzlW(b@WmB&%4_Ir_;YYci~fgyNwIo^ILr(5K#KM8 zFsynYOQJx}PqBtT#w%*W^@0>@l%f&(h?MwliIMuK6ze+3IKEMOQHm8-bfG>r#d;9L zTDnLtNwJoL_zfu3OH-^ZATEa@y)4CQP;{|gj>Rkv&iKHy(Q(;irLW6<$7xetbSdt%am)8i9xWMh-2xo1=%Zf zOca_B@$DN|>L)u`7Krbmy-L?otzMwL6y_w|lWIK+Vl7S9%~WfPqO0}Jsn%;C&e1ix zKhg;b9+cMUAdX>*o-eI_il*vAq%{Kc zF@H|6gv~1E>no)-6I56RmoxR%(wYO}`0gND0^&C7PJN@a)__XL zst^iCHB_o&C>dTLLs_W zZ;{>pP_j9?%Q3K3b`w*hj_-rTd9di9EUI+Zd0MNqvSGp1eXf2&T0KFI_o0OQbuGtQ zf{BuMDZvlx`8k?RV<1zEcEs1b$2c^3Eo`|g#yW5W$c~N}FTu6jXV6Yn`#H!x;wpz+ z2m_z7nuPlh3+EuslO1%O>tu&q0uh%BGA5q_a5ccIfV=EKJY!wvNRsp`#thdvFmdr9 z!pL2OhfTwjMzPr~FM#2z`w;Z=Soiqog(z&nQpeYT4+kMfK#y7T`xNWIMr{t z8#JR88tmx(9Zwz+M|b4@1I|uC|Ft1WJQ?OmPF|y_4Qp~N^v(tNR9Kf+C|Hg|Vbc_> z2q(#V6s!z;t`!+yCN@cBHH;@WV&Oc)pqdR@3w`T$%v)`us{u1c~Y zTqaKk@QY9vE|)>TS@RLVbKy!JslItOa=j^>9~ql|dJbrF7#;p})g6C6Tx3|Io=10% zxi(c9d0tL-5}P&t6_BU zX~*g^4XNG}K44gHLw4V}$lq(>7Q>>G3tjqxUJs-DKczkzN@MthVTBaE5yoKPeh_y9 z-wbPR>oE}TKH3|`U|_YPx59?o+M(#}u-k3D4&s!(6UIQH8N_LMH;jS8Aw^B$&Ti`j z=-vTH%X?wJ+oFjMcKLp|$Zf5|ybaR_;jwOO$oA+EW?#6(ZCwQVpc?sW4r8EjiK36g z4Q^|KqEEtFqBR-B`usGUpJ+`}bRb-iXoVDg7A{J(9so%iiGLn0Nwiid*%#qb3=I^u zgv%1GR}_62E>E=ffjGAZ!|1qw1LB*+zY14kFaY9OdnjC+XgM&}|LF~+x;5O8Xr+Mo zmhr=3Ey>DI^8nw4T}jsEApQs*3EN55bs(-GN5g?6>lQ`dhtWNrrRZ2Vm}JdYbUfTY z$$C`LiEw_B_0X-FHiPo_L%1Nx+WtZ`%pb!=N!D&fKZVDln+xJn`8iyYq;>xeuibIH zeq#J&`vCs?#T#B;0Oc8~H!-6}Ka-hB@77*S;?ZO`f12L%np*eMVEq<(e%))F4s*xI zJaYDlL1;7_Vsc3K$6ItRO(9(!YSU<36Y|I_AmMyp8}iAi3d%yJyc58sdR@pb=PI~9 zWXr_>9w1B!1th(ovnc4Pp?qEvVYnewAeWsVmE0IAl20j^7AlcX131$1P^nA;a6P*< zRLOJIKT$3#Lk&6kq9PP;?`9zBTi}-KYbd14LI78a+d?jRwSq7*Rifbbkf~YqitY+& zxXKO0mFMmdrk3|BnjON_a;tKAPsnsw$3d)sdqaMQm4GITvoJH*5y8ADK~pmj%KT8N!+H(G@hu3I zA!Ujl2$egmBZ?jjg>XO-lU5u`b*R!|oucTW&^-<-3&gQM9IC?P^%xY72i*}#7vZtC zZos#`0Ki@08yzlm71+&y1WEgq`53@?SeRY~Ti&xgFadMTGy$3YAT)vswb~J{P-_s{ z9=POLvu7P1`3`{NU+b`WB9seyog*kehJ^FC-jOfARvyraNjQN@3UnyxJl==?WDTOH8(Um(`Q zHV1Sbt9&~hmC)A55H^b$4%t)18$$kq3T{JJYmkC4GCNAa?G963qF|=OFRxN?2h?zb zf;$}nd7FY+(8+87*MLgs3Eu)s6P>qL+Rj$64BGCl;BjdCTmaYF zC!pUcUSUu{I=o;$`msFalVI#)#(SH}*zjzdqC`smg63*br)xMzoHi_oqef%y|EINam$^WNbEc zewts#;#rUukn>d%9!SfV9|WT>+=FRF@ims}w6XFrIOEFoP#P}l0&pkk;j~g2yNzdI zTA6$il3A4KMQK&MM0oH?q~MV>^n4E@mD!ZsGPlSzWl*WPyNRQhr$&|8!)%N%CZ29K z$pLW2O+Zg`pS(apFSA*WQ;=sKkW&-{%ocgOf-}so8k}dgIIP*Anp(&PnkO9AJP;RfzKP|ZMT!QQ zSpInmw31w&Z#E=gb}SmoU=xSKPeS%L$%dHC308xmp(f7n#O9TUnJ!^nr2JiA`UPgr zqMNV^%z&`22Js%z;bsv|(13Wcb%a?atS3OPK7|-YnpFaa%CS;>0yN5OX=lB-AzDK& zG|>fp2lQ1h)QXEtbU`yvOS7q#7Mf*l&G-Xax5q+PmEz@8Uj5{%)qt%d2T>>tucYc+ zo4AB_VIK*dvE?<(-PlJGJC*k;_L0yUGp(VEJ=iTmKOn|${cEYgylWqU?dz%e*wy`d zsyvFY_mfQ{BBFaTH#`b>13(8N_Yl09ik_@zs0Jhc-omyLdO!FrcpKYFsM7M%*gL7^ z@iU?Crrs>yxBwU6Jpn&WSQNHDMBvyloGMQsN^UZiA{KfH`8)g=vP0FuxfmXnrFt|Y z2`2ju_$n1EQsXsqC45nwoS{|l<$#kr$=B0R!YBYYoX=p(%mf9iQ%{#=fFtB=4KzZR z-*HuY7W-%F0bIIkQwy-e5oC&oQl$X{-v#|JVmt@HF)l7z8g{|e*ZUSNfjq@5#aKCl1%%L zL^EdnhrKc9xc@39;ec7fq1(S90WPs2Relcx*UUOp7`q;Y?-yHBd3|2gAc5PEDZ1rk zELDkmWD2cvWJl9>WNIDUv+o_L*j40$huma5Y`TH4RD77qUN=)X`zah$&Xtb?K0-LB z!U=CkYDPGD0N%v(F_hB>!26ay!EUPa0lcH>Q&bH)$GedNIDp!4E>gvd7oVXvjD#~@ zUi~~ZpHKL*voBH$_>Px%$xlma5g#fYNICg3wL~-Ok+6u~cf+I^jg<5>gj6H`Y*Tmt zLegWmLj8@T(_S%BsQ3p-kG*66BI&U`>KYCjry+qn&+WkN1Qvk51qr^=_|bjgE0f(J z;f+DMFBH#IJ6~m>020nrdmrxXstOb-c7oftIh^bARpa-smq7dT@US&xp;El=V(nkO z6bWra-KJloVR*yklBEdhCX&4A^2qBI>~-N_J75k;-ojNzVZbVaw{ew`cNlh8ArImm zS3nj43JKnI1?8oHs|lK1`En9~{k-SGg+&V9cNNK*fLqDg2d)xs1(y))bCt^3kgOs2 z&{ZbC0)(l=_PfgEF~EadXIvrde?wY2dg;6z_CLcMDLvxo?_$jRzm_bCik~I%7CgMK z;GuP=#-S2<6fe4r*I;A25M8PG#uY!8_bpTxYq<_Vb@Sk!+lW?Il3WDfX7MoexKzP+ z(BpEzZI2=7Bhcd(z#4+1&|@RuV}kFY$FBjj16dq{9%I|jk3)~|L86mRPC$>}1L%iO z#1GKp4*U@tp{&`~7&-!CG{olbD(9Ir_&blFscRrX)U1;y>FN8_4|*Ja&;q zI=S!Eo>TZXxi^*j?IixYUH5Nb`#G7Np+;8 z!efrOq$WG^!!0Dxj3>wqeQ%?FHvHEQtu|@KZalMT@yX>7!#nVuZT#^bfis|VWdeUI zM|RNTAI?!7+RFzh#Z)VY`x6!vbe1lK!EZBM|8*wFQ#v-z$ zQfOox?cJ4h6Q{)>s9*v6_Wc&;Z`%aiW zBH1Ueg2AMAH3j!D+y)?@;uKsl(cOaeb>t_}XXL`%F>(ocn*k9_r?q5z+R2pQ!b&;_Uhcmb6?=|y)HhO!@Yzr_WJS8P!Pk=Ln{$4?v?K% zto8Xw%u5JjKj0w2%Lw8#0RKEe1A@@tp5c|frZg1n+H1=WfHSG@yL)d?o(AAFyt=nY zo}*yT-m$n{1;KfQ-yy$+fj3xZW9;@l;5zD$Nt)J3hYwRM-X!zRiS}zA-K52jYw z`G7r?hhtuo>oa$~j(ef4H(}k;`yQT}!C}%6i1+{DH)m*IX&i+`_Ehx9TQbB0U8EBx z?)*K7U$;30z}>CtE-sk~pjS&g)CI?o05paY4|nlcJptSiUDze$wuXUNiHo{m8n+O{ zh4)Ao?DvSZyNkQjxUKP!&8kHpk9Jw+<{zb+PgK)oSw`f*LF9TD>}wv0csbSinD)b) zuX3;k?(J-J{qx0~E^;lx`GLSwgHv3w%Z$8Eybn2=_6#Md zgA;SHn_-#*Pa@fA)Wh7-`!b&Rn&O$=H;nfrLHylGE{7BDyZqBhlj{I2%i-tWPJa0V z;K~&MG}!V_0B6Nv;%;TAogu+2k(q!S$eA!pV3KthFGncTTg)VQmHRYwa>OI;;i|R}{l+#55_06X-UZ9M;Dmt~QA@>^um%kzz

Puf<(-xf8(Am2~mR*8sywG9DG_EdU39DJoJk;1ZHd=#me` zI--?SN5SB;$rZMJ8#7Kul2^9JR@?`WixTmpS9XJ%c~tuo-tz7M*51!vzYGBQ^5S2- z1-yNfU&dd(MVhe@@n+wFAo3mJj0$-cT(a`ctkB|J)3YjY&KM07E4g=tUk2ff!#KMl zUk+AqPQ?&e2;h=Ax1vCn0^VJTj0G!-e32@;m_~~C! zCGWp58qa`=YPnd!c@>M~Gk`Ix;cQ?t`6j{n6&vH* zAqH18#@mzO6`I4k78>9XMpU38mV-u6r5Ra){Y=I_WWjy{=?aRkE8<%D1}ci>{adK$ zMmT9lNk3G9t0@+O{Mh`-*4z|+kJs@Q*yfU(V>nc4-wiUwp~%5Yev@0_CInm7)L}Y! zIU26**~nClxU(W}GWnfVL1&$3Rm5NJN~EP3-nf;&s{&n&FF-HjMHaJ>vZDZg@9(KF z%Az+kqDUMnp0uRO91==-d7Qn?M9(VB&AlNjOlzEJDZDQy%f&)lXE{xGS)87 ztBA}iaJ`scFdrPjNd8YA0o_rA=XyJo91;$cx)ka zeTB}d;eVbkfpJJ9;B1{iW+MofZw<66*URgH6V^?M@22RY=d|&=*|kv*;Ru2 zleZTtFlR@1dGQPQVg+XD_JX+Xy;RYJ%NO&adVaa0CBdSF|47%ULKE>x>GyuwsDUDAl zfXmS|v?hq}D&n>A2+}Y;2M*UDpraKow5JpBkxUTb^!W9Ax2J17^H;nUj%MP{aJt21 z0>K@)GrR^KcpC6d+!@{cLDdMyArHBL8F^M zRq37t>qF2-M03;eX*>%{#lN+J?oY?3aSe#;$h>qr!P*4+>o8>V(}SoZGw>-Rg)T_X zPq5~K_$&87IzFP0DS9xy2%&&3J_eW7=_Ru1Q~nU#t#B zzsyV0YZ9#4knz0V()48s)`K9<-(%^u30B8T@fy8?P?n`{geIU(zW49(^!fygCb2ry zLH0y?LxNQ>R?|k+gPu%pL~ap^P3f#nZ%XJEK(*m&`4nBb-ki{FGs=}MmeZZDGWMz@11m~kcQOpm!pMzfeQ(V=C%iYBQ&)rqMfEh`b>UO{*R(9SXy z-Uuwn>ZWiSuq-Q2VL7lWs~?aveiLwY)(9ZiwwrD5%TJkk6Qd$b&D)UW7zFegw-{K;r^Ls=khj5Y7PDrxI zPb=yr8+mmJUcxFLz!nxWL99LuQE zj1}vlg^@_%MzN)h7PdkQmmvtw>o#a%GJs3C9$KKQ_Bp2Q&_XQQ9nivTCE1CLKLBXn zfS6uD#_7(`?+IQ+#$#G|2^o)R;bmkzriBJ%Jf?+Lka61b!E~5s zJf@#L$oN6!>@{Tku!7fdHB?MLjkp@>uR=|GWFyk{Mn(n&Ct_M5ZvvrDk*jcl1WgIscJ)&jM=Q z2jck-QY$*7+q>~!7b)rSiQ-ez5yoY3l3R+0{X?Oq)r%W54nk3PMzC72JlxyGTJ8 zg*RTo?I^r!70g88-KyXY6y9tFccSpB70g26J+7b_FU8Q{98sbZ! zL7CW{;2Dn@)0aW#XZju1{h(D1puw58!&(O7`adKy;IOVnp>sETXeJiLV-5eX%zO;| z-bQVR+%M1!Q)Ht0B6!fn4;f|(44C)8(_s$46Cdcm$-N78Bk~jBMly`HhC(e6cNBBK zj>my_7Do=fa{Du@7#qUiofA=6?2)$sZiYv3SFtG{0z^7_#rU0Cz;cqzF1F>*N^(ze zzSjLtSlRkXg zec@t{mPp;WZLkqn8ebv&j$R5|Gmih?xHLmY6^=NFws>i2XYv>3qgX5a9l6Jnivt>K99j`Qigs;8NsbC~O%XLoS8`cx7-I zR9gg~d2sP~F?s`Q5kxeZkuYDNC^=oMI8uvdyhoM?@QCK+OBn4N#^51pi{q04Pqi)6 z<%lcR7hQp3q~QUTgIHPY*9>b5d|!be^2M4=xebZpPV2L1gXk>uOo+u=v_Uan>(B;` zgnRBYtw$SliGmGic4!37U9Y;#pk~|!-??)rhCXmqEe>Vz1w!Gi2(&dz zDmamq&*!K6ljMi20yzefQ3O9`70GJ>R}%b`RU&5sDhPhg!WJCm?3XOe3IRBPU$e^P zK>%mrx2%vn3HXxyoXo0}dC2AI)ENGrg}%)!q|!s$^wI630A7@1ZzMmRxlyw8)w~z1_T@HF`C4G7|Z}Zs_X& zsF-?M#u?;>Owm*gBIX=KQhD)zIGUAf{%c9zvHy!K|0hKpFei&2Pr?cAf5X#W3MCea zgs$<5D!Sr_EMd!Sl-|`P>6aKjgj>sk`u4w3{mQ}qNx^nSad^aESuz<0 z4(V@Hx(|X;_$N!39U!5+iGQ;Y)EV_E)sYe#L`=h|==*jtj6G;*)hec3h93Wd00!D6 z@I4izWvxPB6ValJ8-V#)n}Gb5+z2elicMNh1D0g%fYiGkj?00eEFVJU#`PxP>a4Cn z+MX{1W7Z&r6~Lyf*rfXmU^DK)L&O15 zEah$(_zH*;8M$EXY)Z~}Y2){AV6u-vZiFA>g&w3ooHh+HV==WKxKE8=ekxKAs6? zEuO;MiKlLUgl9YR7@qCT1bD$E+jzRn0eBkN|AaszU0g36kih+)=sH9#IM&W!&B(^n z_Km|sJk+NBd>HK~U0*}ZuULrovk|QtH{6TRel9~4oaaaI8SIZ>rXm!vxY&w(lXV2A zi@C+-Q*fu5oAGp*@8X$Yeubwnf5a0zBp-*bh=MplG`sHQ_MYl?^a#r+-3v%Umtw4%b=e7D%OS58 z&u7NRpIgxIUk=-?5R0v7_^$@gn=7`V;inG?wNj!U4gWMqc9FB~=poKlume3r+K|a< z*ohwE0!SEMKo61jOftNP9^zvF{y4sb9wOc5#4o_hnN?bM$}S~CtjaWAr<8^Pe&OoM zDdkteKoda)!})WgiI|N5IE2Km*y)dI%85(rYGT4_8g!2AYaZPH0~JJCP*!|o9MmIb z$%^d={5&KplQ=fK_1 zaQ7U+xd016rBSyw2wN;7;^`OuV!2BNmJLVL0pO5jF|J)vk{nb&x~-NaR&kPi8>P*s z0=wb$dKbbwU-ZtExZNu$_aQ}fbgA$yFa0SJ{ zbszyJrn^MV=%kzq7xs8WYKs2FawH6#$^nR!ehZ4>JVYAH*+4`ZOHMu_jU{IgBE7|q z`Z>QC_r%Ob;BDS=u3R;+!~0Ls{)`BMVr-jeFKHX?I7E9VoKSK_F`~UkK}oT}g_uSI zi}A&7Sq;h02vS^L?7?-umln&#u*oLzWeD;`z-WRA&`F#8x5tfL5P8H!ZS-9T4^P3C zvtAS}M=qd?i?LAD0+B6-w(&5mt%nQRdMH4mV`V)Y>UkZWIj9k6O7|%kS?t%0I;8J^ zb@eLj@cS2d+P93SvCB1Wbaic8U6mnPKb&x)uS2w_DYza*M1{xEPC**ZgoI%#(r~VV z8_=Aer{G46YUm{?Yk;<<6$j){NX8P}TpYxDS9!4<1)J$)bJKrS3JsM&FS>Z!!URqVFF- z?mk@(#0@BZhd(w&IT2R2!=H3%G-+3W0}g*|rn(edjTUqMD=0#;4T;fhJ~w0Vxrq&Q z$KrF-8BTa^?-G1&Vsm@r@VUu_gnL)TnCmzbz|(mp7<3E(jNb)CjK^HZP{1t&mtwAC z41lMhF2h{M6#yP=PrzKqRKP59b~)xc=y!6?-VK)7 zn_%mp*gE3}YF-5-6Li5Z#q0y56J+6+V!i<65_I+X<#zz?9Qu8B%<;3vED@i>SF_uOuR-gNP9hB*@k&0L75!(5Li(r`cA=RSys{RJ!<#pFm8cpEn2 zYE*&#@WF5m%9ehW=VOvwi$bGr0dGAo%WP<~1mL1QiCxf}7YmqQ#7!`r+g zBangEO#4W@BeA*cQOFHde%BrZcOh~UTLiiYdW_ZG!c27Oli}uns;f6%mUh?6=}Y8H zkB{wL>GnErlWDu149*`2F}t0W585@g-xqbdf*Dh zxwIIi2c{_Q4iLqf`Y(C z#piCLiEL4Nvyz)k>1Jt$olU0MQfC_bN((h~So@nA|y zOW=s&A>fRbz@LhTg40_9t}CNiABL=HEddkE;a>oGr=7eoZ2FA0FblHre+-Qo;8zM1OL zi~tutkDzL>$ngV;m=A3)$taaNB4k*aQ6`fWJeE-|J1JO(MUL(Y9>*fb004*f1Qt1l zD|ix%9OD$!Vv*x21y5zv%4rIgXRMBoY*u7!3>+LBE&7!isP*-MnQ+Ok@hWipdd+we z)v?DXNVF-2p()IYO)*{o(z57o4z4N%Kv&kjoM;ga2PW~12oFm~05SJKhe7{BSfbHk zSECZ1&{T>n7)tdVAipZA*1CCSG)>*%}!`x*#7!C6PTERkn0KgBWA z+Yl1N0Y@KMso*n5Usj|DU0(@yar)8~yF;4~}$^H^y;&|o;BfdeX4)M|kA&z&W zq02P5VR#OSkP0>#NrB!9HXCTQJ%N11&x5l(ff0(gfV+4CC5pF#JL7PN;%$acP6zN- z_IhMumV)g@hOAP~b{L)IVgP4iC$hH!z!`tRu;m6Nc@cTttt2lQLAf80LRxs)$j1Rz zXo?4cI62h~w#m?u7@0^f;U91)26pcc+n!|mw$tu}|GId?DKqdo^0vx1ohYvhVeJv; zN6vlof&Re>D9dT^*^iRfKk`9rKntV`U%Gh<44PSqr^8%;XM*`Sp2B<%Pd(z+gEm7K zXLm9`g`H-8i>Jf<2~T`HA;J#=yp7Q9XJGb=`!nM0!#p%2^McVrnxCOd+PTMH=>=$0 z<^vL`DS99SHP8c75BmKvQ|vqkFC6{02s?cN)aLzr5r~PBfp8w}^wF=YXhsn%vd@fs z#D6K2O$ccR1^#QHCU2b-h2IKonSxH+MejgzvapCZH_j*cy-;&l-^1NTqCX1JaCSgo zOn(;o9hR-=uR=7O_Em6di_Z&rMxz7y`2rFBj94i-qNUIy9dN?%WuZ@=qTpbm$vw(k z^7B<;XITQtaDuN3{kXCmA$Y{TLiq&@oPS!WSu?3fJ^*)o3+H5r*8s}NEtc@O z2o@1sQ-lqev8J`GC_j?ZFdXY*e37Za;4m}rOfb*IQ4vbTp)ITmhW znYpCMCFvvj1xdygMf;Zr;7J!36`8wWz?3SUC>5$^#$h;+tjdBuz2a4-6nq--R4H?avF$^A}uK|6&G@}?6 z_G@tC5!YtOdti8k!Yo5<&j9#?ejQ%EtqQKsz|VC7_L8$H87SnX6vPr(nc~U}c|Q#N z-MtDy(6%^+NeE(*l1zrL_{Kma;sAwU-%8WB{?zy_{@HXUFef@=D{%~v7V);ehj?>v z46yY&q+j6AO7(M*aMRumCm3hn7;QpM#o^Z2a^Yz>&Nv^EYu<++8^;+J1A2T8$i;C+ zn&stvdEIfGv1vM%zCM7Y2aYp-0^p!e#~t!?D>p;W)Cux00B@x1m0BuYNIq}l&ck8f z48W0A1Q1BYplBzOoZEnhJsnXNiB4U4JI^Reh>3~cx359A2+}d}OB)|LP}~`q_@#{x zL4wS#ru-Amh7)w|>X#0*8g~(N>1xZt&`T{rR@VSmg{=f#y9VVIi15$P0RFD|@_IlL zWjMQQfo5Ec7$eg(ly5IhWP3?Bkyol7k?A5S)oekjY36Y}@!f}Ig4qdAVRk16=J|NG zGsocB-nYESPzqlzp(}+UJE* z-bX!ZPkHLl6`S;F{GuknJHfV1E~sq0RCJLc?-2wdwx41QfK5j)=aXFEP5ZAm&iu`= z&E|VbP_vrkfOLhQUun&^KL63ZM3gZ0~FeGS7S}fyA zJT&N+`3RPx62pSF90lN)<$_>9Ge*I;y#qdN(K{&95gx~MHll4&pWky3ZBIzp*SUzc zFJL7_8$`6H;N|13!F>?zGYE;HZ_tll(Wb!3ahZ527@xp@xow^r5X4{=?JGg_nUGtW zoe{eb-i43^_5*e!8x+%B&45>f0eLonCs6hTgYtYp9Z6mb=F1`gC-wDUL0;fPm>Yvd z_~E<8VBUE|=pN*lc*;p|$Vz?_3A!F|If?fLb)3808w}hE8}1~(6+}m03*4dj?I4EZ zT40Xicfgn(tXBLk+#}gFikry4Bk+Xc_rUEPat)Yohj>4jAU6S6^B)9tE$>@O$cI4> zemmyFpnOSr+>dm=4&dBys4TqNj8b5;g8FILY z9Igq{FWsyO^4FY0d=?H@!r?#Ua4jXG`zvtS2UcQU(9XqwUECVX`+&SxaDpm=d0!IE zKoRM92Ch@d3kCIrEG;ly@oho$zEK8>!{E+ZV3Fe6!I@g%NyRgRy3?lxHY&a&sJoK1 zz)r`3%~D!wNYy%Tw4UECYgPeF8@ z6wir72bJtYgbPR|4+rf#SS1UBfimUp0VLDZ0yimsFsPfPNOv=)O32p}LHk?$Z!Z=F z0~?g9MJ&M#p8L?Pukh>0AV7GF=1ahwyct`P4um=}8Dt;`89?Bdf zAv*`P%B73;krs=#{|jeO>t@25YqJYJyVA1o^KjkKON~Zk?a;my)f2xZ7?hvD?bncs zO{gzLu;q7Ra}fI$4#T=fA6S)%MBG*xA4w;Hw5-@?KN;xC`Vj%;e~f@qfS#;O_}f7B z{}fzpF5Peg^T;HVkKl02xOkF3zV!R(Bs*_A1zR&IfQG1MlH7^lI+Ld*i0E@b zIlp28eVBJ&D7+nF=)Y;RWM>BRn51d&TcV7~>6 zByrayxeEsVa^8(-s6A(xJxPz3?LCuFLaun(-wV!i1zv+s&hH#>7p(pKKeo;VE~?`F z|L5!gaujuUk@X~C%W#mh3(9IHi=tv$Vw&O|@2Ggq%EE%kjM9=))3j1a0Zq*^i_*-Z z!fR<4v$V3Zw7Zpd&$NsEKhLu}tbPB#*K1$1^PYL;em!&M%$$LNDej#tKU03*2S2}2 zun2i{0kP+yX)*Gsacjqt$xf~PONd(<<+g#`H+F-)NVG+YUu zM~v;|Z2V$SRx0Cq7#qaz#NlvXVC4g$0#I1?WpaUnpMw>0m4aV_mGUtKzXq{O zSHW+=RdTO_--EUCkb<+p&GJ(Pe+28~X+Up^!MWg0`4@oWc0RaEx~>by;LqRznGP66 zVt)k>%Wew(4jz-&0H%=5Kf#mo5a0=d3&B(JOTa#Ye}g~CKLH;SXgTMsrYNcJ2=p9H zw@eU+>d3(oWIGTi9QP~XNW6C8S`?LIqOP1lX*sDcanTG0`#-^+u-<@&p&1`fq^K2! zXH%*FvBCLb|KadtEFXp;ulPnK%@`Fi2-VA(|8;f;(6tdtsFA*e1V)KwL31)R*wX`5 zH}8k)Fdv1A#SNO;8BhNoo`mLn2mfnB!@6dC3d3-$DB0Nm88M&~VjmDD?%}CrC{J84 zxM=3fv+9c`t^ruvJLgdQ&B>9gk=xuicg?|roq}#TQSuoDxjA@er=WXIoO};Z3138y z949|4Z71lNV}>%K&kd9j9dpc2A*Y+aLv@(V$bnT6{O|hqY(w|a{9<;6{P3n%U1yGwVg8{a#@%! zr$Fw94flTjoI?4wf{dJ^$Xq-#XL@87+&*Wvd>>-kNhF~|PK9P1Lt;YPWI{FJ6xidU z7>4)ToM!{dMNP!PSvW6KRwEl{>%x`8&j8dj3U`iXeFooWlJD_3Ufn7wz;08bRyl>b zl?y*O?Fl(Wx^*u+VDjV?>lS6w*QX%aI%hi8t72x;LrIey`L#+^EDGt20t1Cak1L$^ zrYNM}l}$4g(s>1OC?pD$#hRm#{!un9asrzFW5nzh#6kpu#!2Wsu5X~?`~#>d*TG_! zF0KwrdQzcB7SSKwJUuPZW0M$wF1r07#dt4lN1a?_uEdv@Ze$@0C0jvpfB#JY(}Cl9thx9 zQH8-Zay(!SQX@v8V{SZ9V03VUEP)MuKqw>g@;!PBceGuhPA->Dzeff7#fZu0pvK-~c-N5N=d@iQoOm=7! z9GB=1*`{0y8+P+!wpXqO@YmHpW!t>#o5g<44n!WJf5{F;)`))1&Xu)r!&&%ScAng- z;P>qO$UNd~b^#v($C>d*cA@59gjmjktT>fzEQ8)z3+1BS|NbYzMI>+_n`d+*ppO!J zvdxarXl7Tax_K2;Or_s}tW76e)rkihK};ID`uZt%)q0PmBVl?`@Q$1kB-)eykL*{TNlH>?W3g2`(5-4!8TJ_JzJ zfG5empaEBb)->S!J94$QArG$BHps!S;=2>8;c66sDw?PvS8F>!ya{$TjefHB673e73n^HZRI??mym8 zCRe}%J`eASh6-5);8#;y8Y&~R&LUiAM z3wZh)fHfX>^#TqNq>Z=bR{-{)-FV#93phnK>Ena)Z@@nU_V_&61hHc9jn9{t09sRy z`NtQ?RKOb(0U6k0VKhgGp|QVHchtb=3Q)TYNrrsb5b;Ha4edd}X-2O`>%q{uo`@h!_7X} z+$%={coLt}+>&&qDnr-i?Xvcg<8IAu)U9sKYhpR^MQ1zW~XgsKg3UcKCafdreKwg(=72J~Nh&fe27`E;8{VH5a-~uomCC?1%7g zi_cw=e&7on=h2v!FL6iS>QsCTL5{z|2|kUlu)n6`weNxPeDdj}%UA?`DEBu)7g{o; z2!sc03e;#zk1N|rFj6Aa1BSlL36;nZvZgE!oz}!U@(1%@vf+cFxG4ExD8qre5W4G= z4JrRz)P-qA64`JJ*d}fq4E;eEPC=~^OB;;t{}rGu$DvOpcyIC|l3LPWOoo)b8$7%Y0J)g1cH_sw?XG|(GcdMyW})u zA5`B#D1LfkeV+Q0bGq>n3_PySpyG%yjP3?cN+@}1+W0r@GS=Kot8I}0|i5XJyw+m$TVX8FY)hxJv#+HFTDTNg0Uc07$;wY$m7}_EMCXt{#AT6>B zpf%9hwx{yU1mcCK{v9$e28unWl)h43kjO6qx_ys?-<_!OOMqg6dlF;ii*USvU}2(D zx^F>GL{OQC%hLfr5Zs%HuPg!X(}4RDZ9ccL6Tu?vJj{d57=p#vdAJhL^bBB0VxFu8 zTt;wzV!qr07)r1-u|PfxC?!~ySSafOD+wM*ERqM5o8^hqC2p1z0lf$w zNvy;9CrC4%Mo<@dha-RSHUVb*fn2y99odH3Hv@*@S7a>2ZpbDqbT4^CAG`gpN1K&z zq35H2Q3O%q)3`B6%UF>{wE~%ltUt~u&IJV`oE$a3CU=UGWx$` z8}cI?_MxtUlTBR%cT+A7hZ7j;LyG<@xB&Qn3*HMG`+gLgQ%oKr2SD>8OhoYzP2LXR zZhguSe8He#>JV%SZXj25rL0$M&Xfhv@a*gHOq`jCw6d!wGGqB82!<`0adI@oD4ycU zOsAZx{M(v|*3c4_!O3ahbaB>^kD>mRGbogc8G=#@UD!R|GCF@)fV}QME6MIPLqw{(my$ zk8UV6n$d-r9fkNRV$P=!j{y6|K(XIIYw?O|d^QOUe=JmkPGvWMOQ05=%6a(6+soFW zQ=w90Sf7aEs3tF(mBDi{CsBS0S6qlU!;9YmT-LWFVs-a55*z}-3ek1G>9vJZg$>oMQtM=5^l=sDlZQ@_Qv5X+mNrv)cK4tu39G1~u# zP}<$9VJDIs-*mJOKc~cFCPoo4(2y*&^1PSHO(ax&C_WKHImUM_{$$F<`?HSf_X_ zIMxw(M)5ds6GvdL;_=`ZN8qI53E*f4uduung;W;#qvVgUTo4VI=*Ka-sQFwoCi&xJ z)NNsy?03o*fYrZ1tk~a5x&a#rrueZH4S5nr*)-K}%Xa`}1k?Nh>8ik6D}w2MyupFZ zYJwU5AoBOBaPA{#pMXy(55u~`A>#b}Fk8?Do;UYv(xc+g0;@@t`%T^n&nb%cC&@9&rWN8{tRTT}$?Ft&kcit9wDxDpB??TWs7Aph{?77gK*R5d zXd5JN;at3S{sWNc&y(8$+~p+su^0&8I+g67E?)z@L}G3Iv!#C?fXd-gf0^t7;BxT# z=gMIKTKyF%{t7usf%M-g=O{?^-zD!>VEO0EM--&_7s!nY+WGI6F93R(@Gae6Dfa{B z{|T`DtK9ka5t6VuaiHM7};d{cgj&{7M!E){kvqp+wn%_ zJZw7n4_LI_rvD`<;w*oyZru*Kdx!%5&APP^#97kOU#DA*?W~jkux^b*N51kpcygKl zm~O3vBo7pw{U>#c8sQ@H<#PY2(7F)c_S(gNPLJHYm+gW7&dr*SjON10 z@tY2-5;d_;ChWTUy$8e7VA3;IQf~OjC(^`wJcIs;SEK@fSI8 zZ9pG?hQKD)x=MI0ofJ6X*uD`m%SC7^bL>$6@2C^h^#Yx z?i&_qSzq{YU*6?7zLu)km%bud2sfPfU-@RsiOPeoePwc{f^U3tc`P1M2sfvE6|xLA zT;sp>?bM8ykuqZs6#F3J94Aiuj%n)AAPadg7Bk{Cmn3{ z6XbG{V1}Q4(AilC#1wD(WNbE0T2F+tw;)6xI`T(`hkOnmC>h@N2^kG}c7E6wC7UaF z2RZIh@UAaTUaH^-vOitHQ6D~myaze#TLi`40P{FuXYxdd^V)~G?1M0!8-s}WGo$2M z0NZ3_qFdZet`gDmHVZvd_Q8`Qw_yidrF025CV_b_o$<$ue^HqMIUdR6#uJ?x&&dx?6U~Ah4?W;9*2gP)PBmq9T^IK z&d}uT!JirD+I69B?5_+>N4xwhBT}RPhJTGK82_NF((IXV zcTD{5iyU`y7WJs{xRXCnLFnx=f5&wWbz&god1iCow@eNLJWXN!>8s@l2WR_VzQdY5 z8dd?Ztrfq8f0bmmw}L_omz-(`E}MdgQ;d$4w?e~H;W4qHN#$9RAB$TtjK83>55hhu zCK)_U?nC40WFvIj!&K_Yi;Y;h1|keo3};{qfMYV%z(yo9uv76gaEuwrkLiY2?uX?( z@@9sCb(?FU^Or)o55}U%@VLkhAM7I@MkTa9YRU#xC}Sni?uD*8Ak0kpC#ne-+9jxu zP45Up8$8#wQIMGF%sLE5A}Q0vx2H*&vK_2GClha`mg*GAnY;%w_!mst!W(J=+=?zm zE7Ig82#eDtGi@0FaQ#co^zoACj$ulwhKt)oybf)$7xezFf`tU z%)AnC3&DJ3=3u}=f(6LT(SQ{McO(CMlFdTo(nEkf1eM5`O$zQsUhGkD zAM)aef=mLOxI7GU>G6Ttnx>9Q4|4Z%{3X;RrN!UhhdDypEZU?+guo9WM2jGYW ztn%%Y?*Lj8toH4ap95@yD&GP5BcM0IBfi5j`fg1dN3h0sOeO+K3D){fN(-=)d0EI;fUpS+323=5twO@jdAw~>|Q3PZy|`F*k{WRmGpi%{anGT z$c>4)VVAEV15PWO14uJ1jBu0>+PI$=HVm)Zmi$$TybfFUa3#E9!g1=F%Rx0=hMf#|M3neYiu8E}nlJQrowHg;_e`JNF*tmE zw5$dP5)p+it^izwPhTalxE{5ZjqF&I4>R8UO-uPKNH&{Uem48S2}(-cnu@_j{d znACr&pt&zL^jMKA5L`S0cZ!z2Nbx!0&$mk01();)!YOl;%U@u13%N{$ORs3lheqMqBusMK}(8hK5KL1+NCe(d1(AyIx+<`Itz=&XX%zTy&@l3|Bm4}Abf288 z>}~itO@R-oqYjOu?MDDJl}!dx_fa66x=e)DSaj_%yx*k6I$*9;4&dl!`Mh$Wf`AWI zcsb}e#iJLet&=a3?#p~y)*ocm*++ZPJ6}`)mm`YRDugan1saPZh&VPzIL8;4)ioMk zboDtg)9mV#Ta~MB@O?O0<#O)l`eeO|Sa*f*ou z%wX8Zih&ooAB1Q$CcMBGrAZ6IK@uJT;W#nmqP!gn;l^QP*u`-kPU$tSg)=8jiCv+g z{x-13#Rl|#8Rwrg8feBU5?%w-kO0m8!wcHak_|IEB^}oP|0{kR7!Kt#Xni!RFuwn< zOrw`BnuuyfQ%tA+Cq&J-^#3;ui|3F{BpUpNoZ^e~um9_2G7#rqLbdP03@lc3vH1Wb zUOvdSwZKf6G6ZcL)u0D%Qk(W**Ev#XEsqtv{{#Ez(Z%?ObhLV8G{GG2qQujxE#CjbFzkECpnb%E9#dTOsK$zB zQU7KGt)M3WDkUyQ+!y(TP_d z=0|=f?tdb`--q9^;?pYm4m1=caRPqR%cLJDpp%GiWKkVC_b*IC2fcBzk)ru%CD6D8 zb97%@DE4N|*uCOLUu5gnO=#(zVLBGpq68h%Y`|)QIq0*i0G!7+V^Hu~`-fOt(scLNrFPiJApR)#6o6U4`+iVRP#h+O^K)RQMH3wC@ha5GPtu(~LU^VA8eFNmM2n|n^- z5?#{*W&H!<)g`9~@6BTG4X457!F#h55bytUd+^>YL)pc9@}sP7 zpm8nXXB$sNlvMzlLzGBV2&y1T@*Ie^CW00dC3_CUS~nxnh2`5?}-OFj99wF1Ps zzK?d8QlIuONutz(pnj>&sHTwY4#LUmDyr#g4}^UNxUpq4VepY$(dM_5Gx%JVW`DD+c65( zCE)d}g7pbr-t0Jps>GuSwrr_vHsA*CRsi;TV*V1zQrPYX-GHn_5Phcq&0YuI!#hBA!uDheXsXcm|0$px{{~;sXF@ z=r$w*uMI+_vK@&y0UNIJ&mrE8OH4Zw3eo+cjyuKf1UU(sGnDE*2=TCjy$R^9e}S?6 zJd9$+o)kF~8ZLvqDH^{N;FsL{QljKs*rZY|*`I<=GYdNP9(X-$oZ{saxd57>B=QOz zuL5v+G(g@cgmH((FtV>eP1MAz334G80slbPDqcf(BPi$DL*GUEqKowKWGy_gKY{yz zIFQ2YY`j2y5TP}$+P$9Qly9oa{zi(K^*%-D%@i-@rf;T1J`s2ejv8OT97;i)jK3k7 zas?`NQIuGfBHKaNgDUwRU>znY*bC11BPV8v;BBn3S}SJ2NhkcKrW^j@8IQmT}Y z5bKLH`!vML#3ui=_HDBH-H2A4Ato^1)nEOmnRi` zkuVz{dVm7rg9NS>C&;T~@V6GGTy`I#ilnwjqWZw!j}kI9`vF+l;&3P;JZ`@O2ekY_ zC*p{A5fK`Fx!E5sE>mbY z=MK2BhaJFiJm`*<_W(GvUU%c%&bL(bP^#}jpYjUE$&(JTHAOxJ!4fw@e+m_#C5#W6 zfTvTI$@U8BQdY?nz{_OwOiHcQ9qHX>Ul+6xn4Tv{P zKbL}`a1)3lwIk(#!`cDjPX76n!w##l!tP8th8GkRt!3f{w|owouPA=Ak;Hlcr}sv8 zf!qgR-)?dj%0miD+(q&jfP1bv?&VB%`ta z38viz;#ct~UL(EjmVZF>l~xcv?AENA_hTPACHNh8g}29A5Etyb?%G<1)?*Wx<9Niq zf%rKv2YJ-JnRuV#_uO^FA1Hp`y_5JmF#Gp`dl&I9;0@QJ=#RM%5MNOIq5C9pi>2YQ z>m&C$;sh|e|Jbdq150qLShzp#jv~%c_Mf<8iTf%3)E!4WPRXBeJBdrd9R5kSNqi5O zKYRGh9Uxu?=Jb8;4iZ1A_zQO)@eajby7P%?zOcJBa_@V01##n8csj)UAG_iV|G^zt52kUP-T&myBR&NAN-B+?LtKFT;hOr3J0JF%cpc@&Z4>*6rogfyM$C0f z$6}mE?SZq~QLmZCVf$;J^s2rpSddE%^_#|ciwAMlFiSq$fJpENDQGn_|rwN9nYaoa0a7X4CGu<%wGUA<0wPd;|cFSUDVktkTAU)Ru zxDrft7hM!sQFLhCA4JhO^WfEsZh0&8L&)2D3V8x_e5EhW2Cx^C zn0U@DsddgLnH>mvK7e!Yc{ipy)QF8Gu(N+bdrue9@sYxb!GS#|VfqX?Z4wWqF`wF9 z6gh0`I|PXo8p?2l=7tn5y06L6M$C62wFQnS&76u$G`kq`PEnI03!vdQp|uz)M*+BE zucPT)Iz~MEUKZS(5}8Lm4naCuhfghfA_Y(31rYQNC+XP_&=m873^@&&Su|oE%fRq_ zBXpr>U|v1BXr+qQI|M1=>^0VqH*Y^l-w=F~5!rP3X@(|u!q426kUxQ)3k`t8HVEKk zhEuMAJSw*)KFcuWMgUJ4KF{#VrvTglzsLy4oeI9p=qUFpH(zB0Bm4Qj&dAdYFZ{I^ z!`>?@x9}V8!4%THTX1wAOxg4Mw!}s@wl3O&eY+zd;~PUxZ-7ux%-bSgMI?8T(>vgF z08GEk093%~aKLW_cW!aYNq`o#3F@vbCSR9j6U^V@ZnNW)>X%HGF{2={h4Z~ z%)+b7U1@-4t4%rd@o=TxR_&GJ0i2=Rt1Wqhg6FE!4>3 zmSAUfP}1JFF9=?!&a)c#FuqugO=NrEh$B~DjZI_+mFF*2V-wkjie9en=deyIdZqem zhZXfiI8F`K{T){0OZ#2b*ly-jcDt*uaafls+EYEyVRZ!kNKx5aU4Y3ND4U98Uv;6w z8n6kQR4mZ`>LQ1gwnfwKAiGzq%VMmlpngf9H>xW=sit_XTF!(KzwbSOOukvcLF8)% zfSdg5)lSX255!4)v%1z}tx)t<^#+esqv%leW{OEu zV0)E~^RMBRvl5D{trtowDCqydzU5GC_ro-h&8yT)g1`-4C25Qt^&cHRd8pO zA@$|hkw9X1RmEi;gAZbUl{38+)U2) z@#fo5TbZ9hO)$?w^_cO9Qfo5+)ieh}y~LabwGCcPAv<}1iPi)aPFQak$ji`5aHuZg zlwQq8yV?1R;|m)pg;Q6XDadxs>F0M%)}0@Y=H1l4W+3^m?tvWile3N^v( z3Dsj3LTzo%gld}epE=_)g8qu)Gp=>sM%&E)S$TuYL59L)UM_csNKw8 zpyrx!=qtp!PGbf_k-C47I;`C)5FE71V3YtxyM=yP*y;k3lUk|A0E!bYnqch?xa-s5uDg zFmo!@;pXj7N0<*l9cgZcT4=rkb(HxY)Y0Z?sAEhAR&~ajZJ>@b+e001UIBH2ITC7- zIRolM^G>Lf%r#Iao7%x89lT4EMJonuagdb4>K)LYDlpq84?LM=0o zK)u!c25PyfugAtS(+72~nG5xHb0pMx=Cx4oFy}$7(9H+&cc*S{!{1%H`3C;x>*kmE zTcDeNShW4?$gbO@V7`eci?ZaZXU+p65Tw7 zzx#Fb0{)i5mkn4a(ajF{dq6k);cvNaPQ%{{-7Ll5gSxpCe-G*AM*Kajn=j*UrEY$R zzg4>VGyYcVW(=Bdm2M{C?-AX+41a5MlWq}TtD7_NSFM|s_^Z*)8vNDj=1cfnr<+Id zw_Z0-(b?$WQ=cBdj)()g}xnPNaV-qyWY?4aJ4kQPyw(eYq?~RpXt>Xb?{l zMprwdtjUVTRJX!PXMaSBpK3I`d+iDjLX%Ev{g@^HBjW)&5xk4|1XF%(tx4=dT zSyLD;&bvmL(Cbv{ld=D`(F;n^MXzxGC*woX`yp+2!#ofxYBlmCBJFI4)XlEZc*e_l zd1Fl(&v+Sbs+r5TKk>Y_q^3e%2FIN2IW?7mB$tIsVS1*0dAtH z=#@3orBg-hs+!q&f<|0;z``Thi_oVmg=|5z$f%KYKuza#xXP^2EDOe*(DpTUv~}NO z;kb6F$&9wztFW?a0?}5sk_^;zj%i^qRfM`g{TsQpz@x@$GqO7sU@afzX)l^Rlbh+M|hkV{b`qhP`h_EE4l z6hy;i=xr%Gjjb_d3za!WO_IC>u*-%&O>4Ze9e@|eo7DtlM+I>;L75BSS$1>OguV(| zpe76faGG19@QV~UQTW#bI8YY~f35;I3ZLrLmlS9`3cs zA$T)@KZ;AODZ>flsJBKbNek3%YzL{4XCc6OlMU&A6$Hs!dR8QwaCuonH%zE?wptJMHB>GcY(sac>!))n$J<2Ul|9X#R%ML|tgj32HC*U(&N zaE;rhFE_+y7_Qw3jad{>8v1u0<=@ zuf%56bk>YqJO%rDL9tuoLDMP5`{WN0;B9Rautnkz1x45l6%7%#nTY)oEfh?`1}?D} zUW69Q;MH*UYE3nNG{RZD7InGtE3#^=RnV7w1`CZ;@mN=hNQP`EA{hT0ZD{QZ-#>so;SE6jptn!qF*;U^ zx+ot;BOgw}l#@ONJIIWiNU-%*YJ@mPI|>?3ODlYn5eMM3BxGW~KsjsBQkJoioJ@gb zoG46?qoLta9EBHW6BLY2h~h7(*=7vA=>3>nErh*Oe4D|q+qhPIhvl=|U>fQtuzYqW z;I~?o@aYUJ;JMnv)oymR?lS(;m7}-*GEKgKj_Pt)i$^bm_gzWwIS9sztNpyAi$4|X z@7Ls3nDUOU0e*+9Q*e!6$ZY`5ih+J)#qIDSbRMCOWV&c3pb7Gq2NvjQzM%BaD05`Z z4hnnZQ?#PnBRT5;Nc2qBu#3EBGVh>cayn%B;P z4^EMuEH8y-3gwlJpc;2+`tbdAWZ@l)yi{p9_u6T8^wZ?FEjC9C3fHkqv19dpc*GUP zYevZv3Q}<3&+iJPi55zAC0q_hrz}Ke-ZPr^lbDh${qXmV0CI6EqS6`gF~KzCZ%@GY z1k;hf{T0keHf5oLnaJ#k3a(AI<+Xr6$jvO|{B3~Pj)3cugK{Y#nc#X9!-_gh+uI3n zLvp@cr(kw+f!qvun`~}OE|l8=9}wJ>j1BC7(*z~S)8#?HKLm46;N2Z(wi&`9D^k{)?2|b%L1nqmxH61MaIh8k{{$<$o!IPZt^Pm zGb9;qPp*|z;@_a-7W0xf%YR@q4{HVDj^sKSjXdT$S&@7|HU$`$A;xzmACtuj?n*u> zO90$K&rd$38HbU3&d=eWixkZ`NlZl?=AXcxu>S8xJueyKgdk*aNSHQKhNWbqVSDH_ zqZ3qn0V0|w<}8*~C>M_8&5N;BR>3Wco$@IF*R9gUUirL&vc;Bs2|!owidz@kat~l7 zycFe&QRMKJ-@V?pIH(zGV4P9{Bd0^W?vZr0;roR zKwQ|(d!7m%t0iH2-?L1&8oxaKz*DPRnab`MZKlgs^r2^$ZuM34kq5gA27x%bAA3&f z))+;{J*RYQ8i@1e6VFe&wP0+x!hPz&SKZZ^`0%I1Cp`3Uc>uN9;|i6~QRsW(hQ8zY z4;3fnsf&EljGtNXA_E6%6;6nRgl4pW-X4bvbxb^x%$0UArF{+BHl66jbD_0pfF6j@ z@h74h4Uk@7a|NtH1GH3atW6#!(~)`Y(OrmjXpN00K&?k>3_vWYGi)A318jzVY8%$5 z#D;JK+^`m~5e+aKVksoHDY;VS0lE-8mb^^1>x<0N@B|vv z6@b?WwxB`vg9rV|gC~=5&j(-%!PewmeDYo$1^N`4+Az3zo8al>!)OzTn9&Y`q2*O> zTGS9VqZ=900|GY`SIDq{3>(`U8-_Pb&-_1Z$TiN0K~#d`yeqPq>rWh^*0@>eFPB#a z`fJ*jM-ivLU3lMf$NdQY&@w0u@YMbb?(@Z`Ws&2=PLyfV-y5qu55UREve1=ue2@2M zWlrvyxF|m_3(8dk!p-!HvOEkE&*D{)s49!>vwZ|!(cU7uv`DOhSMdymoJc+C=vt^Egb!9%;SHb!+KktB|Tdu^TWdS)HHVhle@I^d;8{5XR zI(ZX-JCjXiyX5T(9xK}??*njjHkTdHQa;#*y~Wu7P|nv}J<$c_dwaQN^?)%~(Rt+s zG1dS@ca#r{u||WMk>LFD!Wc~9E6U}rp5f5$EDt?laL{*^M`_kHNORsTC@+e!N)_E* zK0U^o4`RuC%4f$|_k;LGqJ`ynPqbFqRhC!ASdS^Xw|sGowH?GsxUYO!jP;VDMdhnv ztk*!iWovPHZH$%@02aiEY2|#94{uSJjyP_+995RmFr)n9m+!@zebsiFBrPrHafa`q zS_b)(@P2FO|9lXcF}y5KwgH?X7*SRzdjL2|BT+f?0b_GuQ&?6eCjhvNMwKm-(*Ydl z=&}dpjS9w;t&+C_IGnL%Yve)&Y7d6(7$f*`E<#={N=C~AGR)#y3C_SbKUgRJL4$h+w;uv>D)_Nhr zQRxQPen2}4FBh(j4Cw63VB{1N%jG91dk$t2>Ii+9#$HS=kL3q=hT`%#T*Ja)e&gi+ zKX4Dq=@ed~(UFi91nnAgmLU~XaBl?udP0&40f>)Ml)=L0>0d`ec z0k&f7g*nekr(ov`tem1}8Si=ET+Tz%XbFT<)2j?mET+ zau>w7f-Eo2lW!>xRut#UPZc~^JV5>g;L>`ixIjidA9nL_aiL5Eu+7TiBIyJ4?v5m^ zDxNMoDOg=RN9HQ1Dz1?E3LYt5EQc#tQ@lz}P_VXmgS<{bb#a|6Q&3a8;g(2{R%b}pOkMac&zwKd0fHf;#2Y) z1&mgf{aQT&rMP`VtQEycg_tcTabpDaGt&Z6?fb!9r%WVRMZjx~J>h2J zXNmA*5M|vn#ZKKCqI`U|7~gzT7sXp-wiSEvOg{&n+EY*>Ua`N7SFpI+yow4-yWqL@ zzJ}&^7FCs_b)YOx3dp}nu{nrgcQ}Bn!0YJq)?x%_-`^NAKC@LAss~@dL$Tz_t1wn2K#5h-NEGfso=KQ;`YMW}WEOz^zOxvce!ILtaUNA3*^4|H4KoU+hbddfV5CX_ za014bo06_5;Ya&%oE&})y5KT+ofii$hP+6H80C;QG#s;N+ zn2r1pF}V3IM?n(@mKhYp;u<_-ZVyCd%S$vsrS!$__r5c_>k=NaK%m3 zk74#%1sND-8>ilx<$3Z|*l=}eU*1O^0dQJ6l;_J6$|kEET>&7WC$cJl(Rc+y-_;Ay z5uE69nNY@MLFc+0QsKwM&ft{35cUeutvqm6`JP)&7t{pw`fxnDgK^K0 zp|}SaPZBg({7c!>vph;(0!yA+=3(S$2jEEeLaHwZaH_9BVfR(g8-+bwK_ARPZUQ*+ zkb*1A1J*%61;JJ2*p7VxbcU#JxhAZ(i0~go`Q@>~>IUN3WxsMKc2c&01y|puSkr>D zJYkmevHV<)m!L%GLllNKi0B;<;kYFtq6-0RlZ1#aQIL#?u29ex5nZF;Qk3H33cTew z=528#bmIZ&Gros)nfP-hPP3)6a7$59#9tt-?c1<9MXC537~A$^VDv`hw1xSnd9R-Yy_#F+j zvHph&k+J};^PW5R(VZYm{&J~oK)_7R1 zp@uxT9A9P4R5YYKGs>bKh7a@~S{{h9Zi5{MFbwxoX@VM0xWtV8@a>|iO8#laM=ux?tmb-pD*C~eG0yW=MO9R3YRX^1ee9W#-+=(%H|tfx=hcV{HS?K&y!n}&A0kR zs}bMn1%d6b;dp{fgl+;&*tO~q%x$-@GlD*geSG)#UA<_FRr^+NfJf}iwN zQb)Ra^+8g9){kk%7$mw&-(462#h<#A(2ONJEX?48^uKgz!Gs@%|3>0775t;?va^B< zx7^0$ZXt!={z+ zIQT0es!O6ZFUQ-oc9?5;k5BM>t0hofp8d@2bbiuOY_J4K?cwfD@35!v95i&|UZ9 zQ3Uib1<)4(n4+g1xzrkc6~A5{Nm1*iM`gW2a#tW~u~23EJ?JLM3MC;&0JabyrJ*af zIlQar;x$^`IZsXpA_%X@*X2A&pCsviaJn48xpg(tuu?&PN&_5n>li?3P;iZIA`^|i za34BEeh74$5rq)=ZR@4*B1)v`rhrB>n?c2<7N}UWn+s995A;rvsI&jI6pbWAgZz(i zAYYSp+(J#dPLLBhMjg4i0s2_cKIG;oxxottcEc|yv+&uxpLCPRO@?lKMUED+qunk( zhk}#12dhk%BUUStA-2~QCFetgVV^5TYnFmSc$R$V$9G>pO4{~DN0{27b1jyKPE8x# z3l=L3T>F?FZfy@5QIQS$4;lD404uML!l8KBa7wWkW5#s2S!rO^0Ki}0tTJ#b8Dhh0 znyZZhnE;!o$xW3}q(zRmL$$4kDOX#>WZyo@z9oiy?uu~1-H({`?v9&*$?Z}D&wXD) zXYYVurO5Wk{666|_8^v#8$-j^!7u~>Ic z9zPCpNIg9Hav{Pvb2Y?zdJ5zRxmbU@1H_@vEW?#`o%xenhO6p=@)L-i zd>C=!!=b`)~%;mB|?72B);3Zl`Px;3N#L+a=op_?n_2bq8ceWizzyu*_93tnO&&4IU+K zcpbXxpOKw*A>!c`g>|xEFm{CDJ*gOl3?2Ye4rw$pxbZHGG05No*w9(%Vr(5g>8A)x zgNf)b?G5-xQ>>HmsQlc;b%0N6V9Nb{R$Y{=RS>AdW!d{cQR1>X{#1pN(iyA#Vi_XX zxV7pbfISOo$P*Lltw_ZhxB=;cFPIGINnWw#byPbifFQ&P{AyKgZe9u1 zVGe>S%+XLW+CGoJ0@2?gUxTKEf*pVe{RH45zQ&O+FDMx37=Raikm1w_%{~qrQ(Wbc zZ$ZQ1_l4v407KtI82K35?YLJ-X0U_b5pW+l1Ty{cG|B-Cbzr6HP55aKf#6B8x?bLZ zYU3IL_f_?%kmwzs=>vGA9!LJ?hHci=d*xWj(``3mZG9l}JXu{Il+U2kX3uNtbLAw6 zG1S)Q$>|E#)%TIt1GxCs*XKtr{(7{2fGkrs8|n)rZ6AB<8f47I`a-z|Hk~m5i%s=K z+z+AM218l<_$7>~Zp}9qfXlELGASD4glHre5S(c`7a*M5%SB zlD;h!=Wart#pb5Q$uhnbU$Q{f0$LV8 zY(hz;+@_$YWSQKpU}DKCc@&UHVv|a0HG}-MD_|59SC`14(6E2~5xZ%3VS_yh4nTy) zz=p3nxTXZB|0)<*f^)PK45Fy2IY&VW(oV-1MLv#$Ph`NwoTnL?@Y)N!@gEhTah zo=%^p!LSq|m!RjYyB1J}z^JjYN4FyNzalXHNWZ)!ApZtbQv`1-DU^NT)7Do3b4zMv z0e}~xZZFv^3jv(V^Gcq?##T_im{B5Ecfof8l&dol;z+DVbQ+HkuSHs$9MCj+Gbv^v zco*QK>jBpxt*rt6!Ekdu(&|F+8>o8TfQU(W%OlBbM9cKcV zUP%eEAPZjEX%#@P{ov6y5XL6^o8 zrg0vx{08vxDAq6cxhuyp+W4 z_;(8TM2{Az453QXOEV_Izvq740p>Av@9Vj_vl9zJ$-( zKwNe9m+o>{Z4|v)y3b*yg7`)KYo$1mpo5|VrH36>4u~tj!O~+6s~3nvf4%f1K6z90 zM(LLhYb>ZMRzSs@rKcR$6wteUL2s2}S#1`G<8r7J%W88Ky|rUvB;fLqofVmGDcMUF8qNiB*zR?SJRkb5A;C4Y13 z0?l{>A=>XDfIQK3ZRDAt*;-95Q^Cfqjgk)mc&6HXZLF*Y@YvI0Ee`%rePPSBUbzW2 zoCxRIfP4nfoucYm8F_3HHAFeOiYcD9suXxB;?!fESzGx9`aVt(=%^@p3gV8~difPv8&Bc; zBYHmoIC=vxeL4?F=#7+JgSZxBuK59V2?OiBStBV0gX)8LWj3f@#=a4LrZ0dGjg5CO z`g-Yv)r*CcQ;2N`09V9eh;5F7;g}!xRxkpwEdcN;@W}cKIab*e)>q0Y3P#nhlCu?z zuHP)n6^yChDeqM<78A@B08Y_3Od}hIsqytEWi@QRptwz_Kb7SpO;P<%NKsL}JOC@s zlZi;tQ3aEbBI^W*6H#2R>DC!gI~v`l)Z>-lAY>|UeVtm5SAr8k+>K1DPtvXFil*0l zb?atDGwLnfx*L=?9eF#m-qx-A6z9U(Hf6YBX^hk$Uqg8?dueRejikA8DINEG<5HObtJlfoCivh7a9))xMa?Km z4aef})Hn%!O5bCc z%*KoF)8!8^9!=|2r_(ig7Ql__Ogi?bzZGs1KcvUX1O-2)$H}c$I9E~rQo@Ga{G8rO zW&*hX{UzOuwAWwLy)qj%ToHat56E5s9!Rk#1$Yjc24HkYQKo*51R2<|I&4TXR_7f#N2E zn%TC)ihlYr7TX zv~j-OJfUmzp9Zcg9&wn_))03)IREw6JD_dhP}# z*sEGt_kc!G8a#Gw3u_gK^Ruk!jbpur`BUdl-_J*gIQTJ3u4Imp1m{7FM5f z^ms&x_OTXL`LB5V*#ko8HgPToQ z0;Zd(QwSb&VT^J?7aHM`phL%jI%JQ9!$MK(lB?kGN|Id%hcsMmpNLwu-c_L4{UK8z zmbkJ;lKuTI`k>~1SJo7wr7l{|U+R)IaBtu}fmjCjUjVqfdcYOS&k_vFU2*c1vRUDB zUbIO2kPCgo8Q9TRYhtC#lz%DzR=KR@UY05& zSmVlzEJm+&<>Lh@T-y}KJdqtQABTp=nqYirM?XLP=fua#XJNyU?HZ50?djp=hi>t$ zct;Q?FgMtnfCJbG7OVfMfHL(3E9C$_VcpmJzU+RO1)1xU*1Fnom@%}`DS;(6*aZS85 zpy5tpAOxe^Uivw*aX20 z>ZnX1Qqj0+eBk~i3Z%6?;|q6h(LgMO(Ew&Y5Aj$rR>~|qHeXIpFXJSPz36_tqDz|m z0rnh1cA6&71GqqgX|b{?M0lH7P8#-{0Q^Nrd)G8XBn!GkGQzB`!)C;Ua-ct1XMqp~ zc@kbPuwOuLRw0I_$t*bNI1xg_5LAD_H3Y*E)D*x1f)NO69$+iM$TU+vq@Xa(D>nn) zBb!law%iT)hhTIXK2HJg05B#kD1T9I#-`;-4WYAdgtS80 z6EKLND6L3N0?ZQ!g8O0XW%er%G_*0{p_BM=YLduzyrWyB=vpH~f5(o2#oUJ2ge)t(# zk(rD2ADG%pAXp&MLUIR5uHAp+n&SOG$?aqhjgZ{WB-ivma!H!uK&n!XLJrgS<{`m0 zl+YF=NDJzrWqG`>%Y?Dr85t1}u8?4F5_JE^#~AE?A|HoA4nAITk&m=kZQMwn+yu*0 zqJ7A&l050~A5W4sV>QVwgIuBL7?P_axlaF)Yli!;V4CqXIw02yi205@E_yhnrBb=}F{YL_n0FVyD7}rwVh@TFJ`+E^3Z9qd}#7k8vC; z?9Zmjkuc{Vw!yC=1>51*Oa;%uuM!12&`54q@H`sHLV$KHQoa+7;qy zn*(We@^U41Fm0#I1?(l8*VA^%L73b=Uj}$1?STAP!JBD^<#!6+N;@XcDmavOQpS83 zcJp@HDcM@V;k2J*3V@UFPTD!yUBSC)e_KTgj-+Y2b+4kMX;}ZNQS@F~tZr>r^nMzS z75@m-q8#!2APsZRzm?swG(6ih`zRdRhiRB?rYiaq>`q;ljm8~K~0yF7h2R=O;?haSd{(ea9I9HUS?6vKwM@1OqTus5`trqo;Cd1reQ5!W`%xa4|pvh`} zg_5O7n7iX?TuYN)1I^N2-F(_}M`ThuH~ zcJq`)Ez?xjJZn+gG{u=0Eo!%>8_X*fby8D3^O{A~|0Nu<`X**PDViK+j8%2f6mP~_ z)lf|h%s70UQ&U6JVO8&FYGgLDsx6vsG+kEpgC?ih#H!9{y2Ol2fnKV!P zHSAw9UPx6p{1ztDj1j6C=+BAJ^qN>Yo^}NL2Ty@~CKih~fq0(X!o>3M9uSwT6cfwC zS3o?xO*OGR9REi+ENLc|hf_fF48$Sb#PV=QO@0$M&iB!jVde_;sHRL4H_lJh)Y8lo zYQCl{v$IeiXv#M8h5ABMj@d(~pFoYv5b9QDflwzw9I~6uBBA~T@eb52W-)GTM^DEg z%QZ_7P7se^Tbrdq<$$;wYGckosI}&;W`$5in%bJL3N;1Po&0NO&Jk)Yh|{ILxlpK& zwXB1=OsH?QEYDmm)P4|$tfRR`s9!;6DXlx1RXDI+3q4@!8|W7+MDLXtL(HVkQ{ewT zARIx(1gAZ9lJ^2*`9v!3+T91l#ljRR9>sYKTQ8{jcEh?)$Vxui&i!ulO3d5zAYE0) zW=tgKk}GK?D7jL83=2zchJPmXssW)HY$axUktOLCl^A}nB6+oBbb|xFBn78iC|uOzTE#E&f$*%yqR7ge*qjIn4exKj{z05xkXNB5NaJ9G^w$r7~v=Zh;vM$>Q`fSq~B}Elbj8L=V?4 zO`jtZAmJUfx6>C!6YCvZ@?txH@Q3DIm+%z-<_P?d^YQB*N3Pobg`uy`UcBBaTIWQQ zuT2j2z;wFYn&XhSXlR?$Nag`}B-bv-CA(;7pVNeo4zQ#{jz>-#99GNAQJj{17^Y*6 zPxgWxhEDkQ(7hUN%Sn;_HFVBNm4mg@U2@Xoa6mVNUUbdLloJ3HA8~t5uABH<>bp}wF7tL^pNEMPT1}_1#*Fg9yz_`2LL{Fe`iji+@PUnPOD{^x9B8&I(VAu*tOJ6@_xH$*M zMvg%zMr4F^`1*v*unt4Z9Lzcv!C&8K6tqHdHBCB@VO10oOS<7L6xY&Z1DISOlk2!a z;&Z^_k$?ao36`o#06{=8pcEM|49p-5-zF&f#3yOejR#Jf?NDl=VF$jmn*-nl>re5a z(L4ZO>F`-vob0Y)XW9+2P(yWEJvmsz=V|rjC;&U~MVdoC1>lH(nbt@?2Y7*k`Bj=r zzOB{1PV?Yo5(r-dtdZ+m(hyV^f}bmn)QIjM2=CWW{x%Cqdo;}_-AH_fV`=y-C?vm< z569CojhpMic8u7SCVznOWisA}kD|ti-D&b?m|P$y_Q1X0HSA5p>6#NDMd`O6%2x4R z8XrLARQMjsI4=-Nk{{A=`tmO*-$lv?+2tQYF0UYypTaIP93YniQ0Aci43QOqV>kq` z1LlyWU*U{J{8Gcu!$=1sg$l-HSQj0oZvd1F#mO3patcmRIyfk&Pa{z%g&5A@OUJ#m zPk*K1^PZ4!3Y|^sA@7HTv+7(Lmh!rS9HLmt=6Ep4smG*&&5uW=Yyp$rWHMCZRu(`J z!7xBuz;J@$SZ2Y5wrRLmzzeCAzT89L+ziE(pHcjW!AhpMSR?$G!r|wn`a2wchRgW+ zY$V86=* zSuHiE4o8b~HZ2Fse}5qiwu=;ye_+)_p~V^HriKxoZ;YC9kx(sw>iTlKZY7N_ggZMV~@c?3-aAIj-Dow z^B+LNAwJ9Cy2YwH;e354q!AD;gkjWnC)qMv0SOj~K zFmg6*y-V~RL<<4DTm5|oilFUonEUR8nM3@Q#g6d4>)EW3BMj%VkQWn4aWpGl3@P#( z4VS`-41YthE`9uLCiH~MwhDGaC6E$7RIs8Sw8EFvcSRJah~oZ_|8TTSqW}M|BvNDz zTO$le9JH()A96#1o$)k2HEfx9_PvHdN2W-tl#k+p_Yu=Ea2o~S5rDtaAxi;Vn=&dJ zMLWsNN_-y^5*`(|tn|s30Q~M^R%NDPqhX)z74pHv3WrOys*J8M-3%Y-(s%wKz%7-y zqIZ1Qhulgm`BuYLGg=qPvxr;LWhXq*?f4=WL&KgLT4QKPFS&5Q+N3+={g5!+n%+o0 z3>Z8Xnc5bEM%psukwv?73}^a>7lztnXh^3#_{>MA^gPuaYJBMSj&#GKR=*!Uw$UA5 zic@saJa7B;pv6wxP&n;t3whdLhE(25|YlA7RP>@JW)s7_LUXbl(p{&zV^L=NH8KrxzKvGw{S2|1W;S zM;C$=s7vsEwJ1sF75G!*;PvAO)PpF@lHiH-SZ|sbl`f}1FP1_!8sepZB7!l<6qy2V z_(L{hF+`5s%|8yq-AHIk(+A0|u*5q?<1zOA8bGB^Ou*RppoWPU`~C^wmjWkY?E5_2 z=RBH>vF}+(7@kajftxmN=blQh;A0|O3(L}9i7t>$!4Nqzg_xSY(D03g3$da{bDo?C ziol(iIoK%LzLz0uBpynSjw^}~)5y4DKzfXPAT?abA4XP9gFct|f$4E_Z*F)XF$noK z0}>9+;PeKDZv`k#6o=g9-uTh5y9`5NA>!^Zp*R=9AV2*ns@H!Rj3;^>m z(1mwAxWET7_*j2yJqp3di8`0furCJtZI@vw)Q(am$6lf!DXAUM{MfwC(_~g;VWL&Fo=vS)LWyx~;;qWAT3M_mDD4|4p4(rU-P~r4^J~`j8 zJptop8(@@Y6^$z8chI!bI>?P^<8Fkp4XVP4Hm(_fQ|=}-sc9NqXj0n&xGhLPlUe{6 zNDd@cdgL&z))?*USPe}o)8tgZ3#8Vx5|diMA%djJJbeEWPd)*oSn)=sJb(bXNj4W# zaNl`QtQh5&FSNo&8X1rFBaCgx%CC?)M2Y0u#InaR6zqla@gOOVlIZ8i*j7y1_re2* zm|q!fAr>IUZ^hVT48WA#VLhsNDp7R>T z$7qS`whY5&)Ye=qV;!G_&}>0V+!1hvU@KbU9)Nn20o%|j-U~<~_#{0~4gh2lY{$aE z2mm{<0}BVGfQ}^j6s`9HE%^*B=?V=y(RgkEyhv)*Xgo*%j;mLm1bmLhlPV`qX}?Gh zeMpmQ`IqSxhV3*07CP@nJuSX}3UJ+^|HE&K{`m2|ih#z6#g!Z}PR%9AqW{5^-&I>$86%$qu;gtj0Ix*dn$K=6CbyQ6 zTaO@~xuUXC?u3oL@JHZMP`OWAUyd4cL_55qGESZW@F?ItRG)vf+DgeEcCeSqrY*YF{#PkR8j0Bb69X@gM|8;P@@qvf0g%T<(<=Rk&gGthVnc%IP-#rp^^5E`kgA;#BP z$>LNz@-Y7=)_h6h0bq=KuEvAFSoac*KLg{8)H-n2Ar1rFJ0RlOz^@>~y+`A3K&$&# zZSi+tjQh04BfwbqzZ(Al!r4NO*KvS55sw_a6ClH_H2w*Uar-r%1jf4CXgmdsbKjxy zG!R3*50L`CcVL(+Zmr~D$`MMFwkQgVVal1;4mla=_uE(c3_;7C+zMEYlxujN1ywOG zxw%8Uk<5kp66Jhl=0wBKo!hnEI9+rLORs z8Y`6FqHT$E&$}>mD2K{2a$z@`levH@f<0(XBJa-cMRO8~!@hKkkKcn%=v{8^wQL^~ zQ+(rz`ZQp!S1aRHk z+n}YU%c8yj(WpYaZF(%~j$n8k`HtzsF*3{!cnfuzSpZicTlFk7E6qaOlnLS`(Ra-v ziy94ztAOl1v&^EN0<|2D1XyY2Sycsyw-Q#-X2qMJASKRf6Q6`x3F3{6_i5|mV=eo@ zEVQbhKwQN?H2YiCSuI;*7Fks+(wF0~)-1NF#+ufdB{*dd;&84vORcIMh?n-OXgegb z+xw9@1E=gEqh>*DFe|Kzws@H~nscnGkCtsR7g|+hWB6lpnN>Xi8OMFIx!S6VwGUg& zt@r>h3M?=5Z#Ao}YAj?-+sv=5YAR?UrS&J~E^BlvVY|8Cs#ZhB8w)$k!`A5L!KdbN ztJ)5kpUTh|=25~Z>?lIG3vWDJfrfj95kC`KT zXt>wRl@DsT&ul9n*HCEY$>|#IH#^JMHS{&}<#G-E%pP)^hW;kr@73^t*;^jd@Ss^J zFKBqk>@V%d!=WxRi=0CSM+1ZYE*@nN%A-VNYc@j!Ei9HP|*nH6%fhQa2mvRuOu zbB=sd!z1QAxm-iBxlpdx@Tj>&exqTixlA6`Fw9&b&uJKLu9jA06esUv<{H^h!w9oV zDh(seO)?w6wW7q_TH|02ju>}GTztV(bh5?cmk&UXKh)mLZ^&W|(jOy7X=v_`mE$xh zf1I46A=&ScuV^s+jpSSnUcXCLYVi4+$aNZ8_&xGV4Jm#lk7!8s`{dsm()?*M_RnzG z(*2n-MT6gu@}eQbpDXXzkm+wLi#4?L=gA2gvizOpa~iV!`Es6y9Dfh_u7+0r0=ZGc z&HmnUuZCOvh4Oa|x&Hn#sG+sLNH#bb4rm+yAepS;R)4X~)6mvGT=vt@&R-%2YiREu zBgbp#;4hWs8uI*;=lkc$CK|f=7s?b3clejc_JG>dD|GiSlS8zmhkuhCui;MrR{6Y!p8g$j zj)q?TYWXgJ2NebWujG0Sclme8Pqo_J{(W+vhI{<`<*yog`wz-<0B(5t_zxStdq9mu zW51+NO>z-$f}-04raVh;>PH#RKzM!cqsv+-Vgs@m{TjFQwgC1HbSGyI#L900OP@pB z>INJc#T3c7fD0?=aRGT6B5u5IfTgP%>cLGZ&V>6WN5Cf=0Qz=B=MW!Alhg9U{ZxZM zrfdw!yX1Jo0KP>4_=TWRAWz-};I{Y1KyTS!OPqm1IatF@f#GtLR&xc)kJcr_2qk?yM)Kv2h}0t*e>8Vmw_l=fw!XF!g| z1Fu2$LV8XHZ~_zr9C8|fJN~-@IG77apme%B;F3QAXq{2q6DZJiyy8~*C#Lw5|*WPehK6D*BkuYU{f4Po9bu5xPwIPOwGlUguDelO1JpyF7 z_d%HpZ4A)mKB%!45UWKRYXfuLXEfFU=DQs!V?27AmhfM9D=5q&(RJJL&lO&O_(m(Zw~-dwT18}Y#zm7X90JOp-PF#qKCI#7^?I^ItDU-DUrqoNzX*R$Uw6oL zfZ7D-u2buD=DMV}EO_bhFL*{TS#aBT_BvXpkD<(7pTF*t)c_t?Ubvnn_XE7;aOUFm zOj(T8zchkN*K_4qz?H>-zpv+E{|8>Bz60ed&rS~9)>diVrOW0HOe#6;?ESgbK|;;A_; zMdST9XoV!q(QQn~C|0(X`0))uv{s8nLHS-gB;ZSMcrj`qow4BrS`sXgyRU>BlBK~h z@+SaCKz z&ZHIaH37hx^d4p?nH~_=u2n(Yc=c+gU-RlnX007E45JRstbWF<_3;bgZs-t}$0B{wFPOs8yDVSMf!bkAVL!hd z&Wv9%g}rz_oKe4FMU1kT-wpd6D`L;WL%we4NO~JN{bE@1M|xZNvWBDS?d2;_DxJO40z&6O>^h z(i$+EU<&3QT>$F|reeC$6Tmg$f0$tu0=_26G)yWwA}$*!Q=T?UWG?`(7*97#Wj_Gl zO7M(XhVx&r5GwSP(}wLv;$-~9^ADwvVWVPh%OD9QM0^`O8MY4iZNZXmB%!OoLUt%y z@TLz8oos;pugG&e6|V42c4cHO;+0{mV69MHoENnbsiC2TN@{ko|M7pwasLOocnm)r z#CUQlyxDaMhRtq4%*!m|dO9yzlb#5mnA0oUy=DS}DCXZF5p9%i2Ie6zqWp3pvta5m z7Ck6~6|)VR_VO}=zyu@GHN{{~F&lQcxYWX&VmW|c2&;`bMP#F_4yFY30u;Lzi_!U7 zsBtm3VL(pxgxd%^2IQL{VW{hWI(h^p&Oe^M0UNsEvAVUIrBAxmJV1;MUt7w?tk6YS3R$Z?Pq670$L$%TL;1beeHKj?P&O99?gc%z7+(F7jYY5rLA+slI2*}1 z6vRd3*X#<5qFpU63BP48L&8JG^gDLyqM33ed$ol>9>XQ@kL;~@TN9e>-_h)9EVH5D z*P4yk9LwHiQC*Q8tBH1C$bMC!)hUI98}A>qQoZx;}w1kTM~X-bVPNv zk=W)ZMXG%9?Ma7@*ci6kNQdf{?M@O?I>l4HGHee-xEN39|MBaaiS)^bgC+bv0kJba6pl-H4uvxmgIdV+P_#Jed|by@2dP;hUTzr;+AA%MXwYW1jE%17 zzS`0u_rY&2n6p}XqRq)`Eq(GZl{h4onB6jyt1K6#IW2RejmGOO+eZ7WH(KV&)3C#8 zb6Xbh*Mv4w!JOB!x4Z@kAHRLGWzEC4HyFN&2(e3S4sFI!yC=3_Gj4G6@HYEa87s#^ zg*&`$(h*&@`$Xd8h#jTF*9rxrNSw-+OLbW~jY_*h!x_}mwHp3H)!eG#EUM<08qT3= z?$vM}Rdc_F3#ghWG+ad0{8z&zRL#2ZoeS{asG5lyE~9F;&~PQY5V!PDP#=a-riep1 z!ovkB+Bcva-3Q?Ir5?%=-E?toWZ!%r!}lO)XSsbtuw_WMr4i3)Kp zUGCFvoks_80Kg6E1)Ku-9l&qAT};Q^sWWO)wAgcxW7zJ8VT%Xx<79fXb7(% zO|QaKSHc1=f<@&D`?7@%s4osz#$7OI_9TWi zyR4#aP(B6gT&?1QM#fq4?uH z!(feb9*u%+xh1`29z3`)m?yWw&RYb|V4=+0g99^f0&WUcNIOP$JU(?{{OQn;5S%A( z(vTQjD4PO?k)6iDWwI||#p{5SV0H6M(IhB~v~E*`o!-CY2ErYTkwYM1ND9`HV>Ebz zwdDj2&4P7gnFbjQT~*3ErLFLEgaNvK3qr*UQv%-!k2Lg(t^1bwE|R4lpf4ObFIlA%(tkmpa97- zf&~_J81#w@^*J+$p7LAS+mGQ7u8!NR}Nev8Y@S56W|b=%qV= zxFcy5EVHN{pl3<*=HN7RK%fmow*)IJ>TNB{4bHKsm0H$1xD2l?fif3DvrTZdMI8Zg z%x?`=;YAlsZG(7`=O0b&f?F*r7IOmb@Y)BfL!Hz2&em%SYVpCad&9|?Hm4(Rh(syHB{ zhngP^DEY0H3=M>)I6N&KhDE8LAmN}6$D-6x4UYv7$dPlMW>d2$U}rm z0y&1yKv|C!zXoJ^*KjZM8$wAJV{(`CdjLm%?|_a+oC!z|9(W@97j)>dMy`Qp5fcRo z!?{3w^c8{gfd>3iDVMejSkU_@6E8th6LB$sH$$rNMUl}aN@O^PRxcA5nFQtoei5nz4z^gt$eYl zhONalZ7qSVPqoKOYkK@PdEAwpaG}1t#JYey1w~Hd^>E@cfQw>Pz$yh)7(NQb$oc@z zmkj|N`=BRZA&lb0(*b!89=Om3%v6>*{*88=xw{!$=LKCPhwxk$YS`}8sj*b9&-YNK930TX1*V+D*QTfwwN8~ph8 zLkAy{2+A#Zc$$>Aphu!Lf!7GOqIcN|3B$IaL#`f;VK_-XLC^XvB-;qK2hq1bhbLz| zHP`XfB;WuW3_`;SHspzHNU}DnN_~)F`|ST!#Z3oj^WsEhAR4Q8ku22ia}<|T7C?nz z1rpPDH^?KN49F}zaFKlq7IHO|A?floOhIaO(=ZhYmYZjGJCPxgGZody5NeaTefb<267l$pV7#301kTq`+y5nUhtAr|`qQ&q{FjIaD4@Z;Qw-^z95137`E0~A-Kk*dJK*Kg19LizCR{9@V zXqDncnBn{rep}E>Kel=QhtB(~vkt#Dii7WO_$Wj$AZb*o-R}Dt&vpwY9`fpHIwRlBo+D4llsCRkUCyi<}}!k)X4%oM3NsdX-WK{OpgaTN(vZl8q2_c(0Fil0`_rv&V|H zL3!XXwn=C~ejUcZwgf!+F2Jb*@oG>$jR%&^LK4xnPdxT}4N3G8B;1A1#t`uh0C!Mx zsAvIrf8h0CBe_Pay@ABr1mJowmx>mE*URUjXzkbVCW_W^tu`M;E3*Ew07Wa6HV;a~ z&sfcNr{Iyd6%K(6cMgz;^}hh~-L!?_T8c;=1{S*iWqT+xzXFTgwXx~If&UFS$Xy@E z5u>}5it+vjET*1=l`?S@ChoS{?PDOr-9_VZpu-*6%RB+}xO+j$)9*ilneO|5?Dk1u zu6rP`Z$|{=6tJy(B#;|})4)9Ucpz_VoB?)rPu2Jru#5X8jc0*f-LGpr2fW?A2*`0d z56pM31ct^8z#i@@jTeCh?oWZdm3j$S=-v(FK>iIZa{mbA9J~x1q@c;2)CMgdZ8@g~O609NOVhBq*$KdV z#p!`bvbzRwi^lKT|Dy{I42W?q_YUu#*?m>27 zzibZR)$*LcVZ(MWY&Sa%n?+VJFe}<448prD!{9o*F*qw$J^`>*!mA-!_%86ZFg%jw zkwpOBye-c1$zlMPhexy0sVl*h9QIiW&*vb?8Z1vA8AyL}zTo zy@YR7H@5xwrB9-t^>e!{>mwliGX?ND8$*E zF;W4z$vB5Max(y2JkIA#lDPnm(*?Yqdz*%fcq7+#m}2w|e9IIEbL4D1a8Q3nj1~Ym zsSjbP=p7xPUl60!01oP5L}G)6U-8EBb`8Jfq~QDSNPk}&Bxs?yoFh-bV|MQf96t}> zO85_w>mLA@mw(~775dyjUqy1&2h5`gUPB5c062ozkwOZzLVC$%O0voLK6QVgcUC{x@R zx@E}Yg3O8KcUxmc%^rvZ0T zR5F2h&2%rG!%b}JT*z<-0R+)@x;e;jckB=zC@Em9`z0vysz@?0F4~EiKnHi9d;-7= z^caG6==Ch%Ry6FsTQOE>B5n!DeQ<{>doG&bLmFCRkbOo&8w`Q3Yq%A24?8TgowgVc zCjmGh?J)O9)6gD6Yui%zl)Av6i^q4rj~LOghOaQ%12Wt%Kti3r*bDTyUj_0DYWsjb zY-vA^Kea4~j@TVK4@~DW#2##GMlKTCYhwI=4i;m@*Jkt#<~LY-Z#G)MRg2hfN(o2C zuY%nlVfR)5m$#p=3mQ2|bpX4d-5}wEtOv0Rdbft3u?yN?!y)W~4gqjE`31Y6BQ+ex zsm%!hZV`XQmgsXDe#0*4EC9E2zhmQbv6dV$%j7x$Hwb^=%;a_rM{#CyFMwN=V>mPU zi-zMkGkHwI37nby3&6qo6K5v>(Qp!HCau=6Gn35$JjpnNW0EZap_a?s zDsR(p*4!ZrG@Qe+>;3@t=e+rq9HZd^&R{>S;i9=uzNX<44rITj;cxSxT%qAIPG_&v zaK$_#w`%wYN43Av@UMAF9@KCZ=eEykxMp6I*EL)>uSh$xn!^?_uPK*?Af4zoH5p!P zZDnb)c+oSp*JSm^SyVSof-W1qS5u6)kwpy#ajRC#i+0BLBnp#13u)aft`?4MSVTRq zoB|atSM|NPxEj!4HA)^?nnU#U%lQaO9tEWz zP6b{7+(tp^??)Tg1;(KXP9HqQQz0;Heesxj1bW4yXeTOd5&BFn)B`{`>;ehz(L4-v z@Tn*+JOhC)_cBNs2LYS7KLqkDdN9!A-k@;^(8m|D9HNjt0?g#M@3=`V1{N8<@1dP3 z?zkjB(T;Y%WXPQWe&Mgjr5O2zcJR(ivGQvTJul%yS1rQJ%e^kucqz8vl1J`_8Xr5j z>k=B7d?bdGUqe6w;h7uB8}R-Mo?8sYk8d~<(j$iX`2{7eG{cdQZIM*#V$lIUhQq+P zO5a!vT`>at?p6E4FDQ=mqX}FFnw0 z{E}$U8|k(=ZqJIFJ|SigJ_5A5VP*czmv6o>bRYZwnFMr)Wrhxav1MCE-+!z3Kue^tX| zoS>n@SnTwZIK00=OP<1Uns+sn;qZQyhAB8(^O=UJe%vDQA%dDZ6v+`Q$}sA2Ux)M? zN~S3w6urH84z22XBF9T=>K^*=y0)|rk1W88Gd0K0Y!80#Kfju9s*9|y*{GhlZl z;R&F_J;)ax=>G{UbJM4)xTc;2&Tt=wGH>9X0#>+>0eSLp8aT&&5m-&JI0IbPG4$8% zM^D3X`-@E7d06k{R_ZKpwYyGixY0TXT;r|}+`a)$oCj99X>ruD5qJT()kt-~hZxZt z(*$=M9(jP;2V@wjO1&|FNL>r|i4~+-i8N~Z5k&8?CLO~3hBT{zjq)0am88@a z`uCF3DpsO){Q@a{3UoBJiq)h+8EZVA}#9gxIzDjOx<*c5aR|Q#81G|>ttzj*wQAl6bZn` zWNNtSg7Yn;wJof*sE2l+1h(gXTkCoqFj8Mv>pv>J@Ox|;*b{Q;&Rd&9@ZL4T9I5F##-3_gi2~d)McB9 zrS=WeOyl+Q=uB+fzR@KbTm|jizR^ZDubS5d+KjYTXxj3`kCew0_D84z_=)qF0=b{? z03)Sk+9u#ZMyd(Ds8jlxk-|EZ@DO7PT;-E@9hp10S}Azktkl5j_*jseI^%{?}0dv z^*YK?sslrtSTP;WaxcGz%GNU=bm$-9xkfMlIS~6lWJ$o1L*!5`cm;mc*$hjqxE4fu z`J1^GM0)vKfavAppqcs?tn3#KvfXnsx?+qhMLgSn4HCu%K!-chKQ#n;+;sWWKjc*- zV7_||l-q0p-Uuvme+=wS=mZu=d+3{hB^-BN)o=kzxufmd5&k9s7jp7)$|M4pxSf5& z1E|KpW$yiOnY+0rz!mP_f!roH1#aTj+_b?dH*jn8wTL8OwUIgx+Kq$-zH(`gNhqt$+Ch1|4+=&mPP=oXeK~IdGslllv z=;d9Fl~`Dc5vG^#cnTsk!i#p!Hxb62MT%E;!$T9&PDMcO2JjFs&6_LxYe@IDmBTdn zy?HgRl&Ob>Qb=M&%aBVQ$fYcJ5WRHe2*WDC zbaLiaZ%hqm?1rxz5}#-v@`+VCkTZv2>=K>4avvUeG2u2iL-FF!boSylngN*g6pN9e zITq`bK&Ku|86L;lNuq{PUXL_2jP_>AEC8=8j`8Nn4ggNZComn#2XLD>);mbvtzn#Z zu;D8O#fk~u=yKvj1lHDX8{)7TGM89cp79t+tSYCkf~+c+UAE$03o`kz+`yMXR+sZN zPwd(Iu zsXy#|0+{0UV3do~v*FfI(D`ir9GO8{jb=aHK#q#nyz&rSvizk-1)7%s!`VSi?|M61)SV!%Ez7<67FDEWE4)1{D)J$X_q+ub zH5xL$iQz+UnMF;}w8o2_sFy&zM!VLFS2-7eiaH}|>%6!OdV`j&$BjPfOAwdCDjbx< zI3JPboWdHy>xi90O!M+>h@5CoBXh>Vlv8~==JAsOTvngK=bNT!nBl!aKCj_fZ$0^n zhUdKXYgE75*!PDdQ@rTqukCWWmctKPcIP9&FCm+M(3UHZ&4)C+>}?_c(C~^kMV`_y z)0=A8Mj%)Gmk>8!k9rovBer>EEj)0_egYqy8n&Z#lmNPgPwYUHvH+VYPd`QBi+qjY zGcT6Lw!_#~O)htYlCQWvIt}rySM~$(Lh3HKJV?WCI5tAV9ys=-hP^1sxH$6PHWuaxFh_9_Saj-MnAaqMr((B4f+5nNi@t}WKp9auEUTsm4?~aeP@3N>%S~kwU-=aF=@M9P1G)nD;jt*WV} zDfV2eO4c;hj@CR~)Bo%^NpQ2KY4!rE>Y(Xqd!bcz)im8+WK}&u<^iPHGxlPuS`I3q zRGML5h#Po7&y(y~`!cIK0NP0OoE;b1(+f?WgP`Z_hjH zE7U(Au9xNZD?-^&P5AZCm+b!vb(5wF`!%6jfcPuQFWZe6l?mdO;}v^sjOqyDufxu? z`*3pkjazV%N({0_-})JhLy3=}+;^kGF~sUHQu^R&3rxhrR=k5$WR)8M{IbpfYRJbx z93F7^#-da?M7Et@qve8;gSz`TOc`3)u_5~&$R*m_<#TvgMZR>fV-)y08|T{jOZEkc zaJV(BQgLHwgPMM%Ll|zgV`H33Hv5Zt)j2rRY&VKZl~r_7G8VDoqJEn)0X8UN=HGt z{@kZfU+J9sYkLruk*dt9 zHfvdlnqgJdAolNZRbf@M9=4ToZIoJ#vq#UNc==i(d{tsojdF>NyJ)%GjBF( zU~LP^W#nM*R+P(=knn3V+fXhk-x)qZxx5Ss2XQ;frKLd_cBnL2N5iKoldq5CH2zHG z@XjPR8#`65YzQ@mYSl(I25Q^rRGHI*>2Q~7DyRR^F3-A`hO&VZ4-WcM-jDR zaoHtb#QPAHg|L0aWkl2E9~b6v8MwFeZb<%h^6({ckyh3);ku47Z<`ei;ynGn&E8Aj%&vQde*Q30}jil1gbBk77P;=GbS zAtkQug3<+qIMRDxL|Pw)Rjw$Pkk*teu02ru8)=;Y+p7pJBdsIHhOek)vJet3JO8K^ z(XUkgt5(awkZ{$ys;cBj4cFAJXrZ{Sj>{(@;Sv&1XEUD$@X@lM!ks!-GGEkeB;!t< zE2a=t}XX{wcsDcPqW4s-3~0*i_? z>viZ`R=XkNA{L8pSsA{4NRk=iHzhOR^Tgdqf!~p8$tV=S@Q>kh+OB}wD)5e5dC!MPY555Nr#+2fTA~7`*jdSZ+6SD zU z_FpGlU9cz0KQy;AY*ZL+wfCYHQIlqK;Hkxp_-U4i1_#H!W-9(L=#_nN{8i+`RXE<@ zJHRZY{L-F=;U#ztiCq^i=Mv0D`UX;P0Fhu0nqNwq2MJzB0TSp+8QwsPI}aH&lq7S} z$kv5q8o@l3CmU(CH&MG4$%40DBkOp z3z>a=ABqo^sd(zA;@1|SXiyEo`KRx6A!SLZ+@-}Etyupc3B4K0b)=@`H%OczQ!3_$?ZST@ z33(rjG!JWq3=*OS-Qj^@OMyYC-g4Zi>1A*5{`Y?+y@7cD8^1mpHpYrR#E-2E_6iNEkK_Op&ty+$nDwm?;-($;Sh8 zlXt{zuR#83*N4 z4Pz0(jmdf39WXeP^P}CtP00oPE$(fk=1MN)cAh;=NG{@z^Z-c`lZ&|{WltL?m&m6O zvA;>uB)L>R2dHxZ&@{O$I@oq6&yde!4$UPpDY?S1Jp>DmVVFvV8X#_AskFpX=NnI- zD2NZWUo-v>#TvczJ0#|k5NTLzwsD`4_{f|8@#Zfe-hY53T)Nmf%7kzme>EziVu1Zm zM5u-*|37`-92XtcDYMFZ@X!}F#1yL`@7FNZ8Y>^t@IR|V4%RTu>XO4WJZ<&Ju^OgZ zeR8UXXRMhRJ0J|)W?(04A0!U(ludquhfk1TqReK5<*zX2biWO2 zAtwNQO+aU?g%55Q{qcI?||=w{C}Y{^)4YPKtp z=NEUo^V5UW0@frT!t{4skziQLR6)Q8~2E)BBo4f@un9}S%mqT{cQ0Rhd z8t!*_)e z#>f&#c)Hu8ZY+OetRrlSJL`JzgC`Dd9`^moDUo59lkqT!R5I;YwEUHgeRf%fhec%E z0u}Wg09U#cRMgdg&q$Jriuxmf7gp2kE+b_njOV~a?6TQD#B<6P{5($v-`Jd?_AF%& zjJ_bFeKy+xkIi-*2F-dk!667C63XQRc;eO~5xdO;H8d`d;j1WSAAzMN z<+1VuNEn)y$H~rkS1w3Z*j?_3E+QqBHe zH0Cs0ZBf43sv1nh?1vmlDc@>U&7jGYT3&5cJCNz8NS0Q<%c|~$j7vm%`F^V!I2CV% z(cXu@{4fYIri}6HZZ60A&i9&bDaS7GsjcC4(A;wD0v97JoJ+0C9YQ^(L)NCe zkx-=|4%w~cE_^&#Q`>TUAowK^=Ty6Lk5CIiyszE9TnV)t#Ggm$Q0^0IJ*dYYhKKSqzEgR=P!~a={-wN7@a-~8oy+?R^N!!(LYML);myY%8H8$oGU|rI z4Y{IgxqJzk#Ok-BxXl8*Kz`=a;Rd_gVmwRAy`k(Aca+OWns3fizrp^ zMA@8;B<5)KMA@tdSJ;DID4RC{z9O{(luZx7LRI)Kl+6|ZcHr*vCNdkqb?=^Xk0IND z;(tdt3K5Qc(WhMI!(vP%*HG>Y<<$^#X!@1M7;+P6 z7%4x@F?^tg@`F&WhL{WELx|Ka0Owp0;_)MZtJQ#VbhLkfJ|Jfv;Q$USm#1OE-VA~> zk+d0%gu+d2q0kPY&|ZMvDY7|?15jKpBSrpE*j$c;Y>26=7)qgC1gi;DQ$}*shL_7n zP(Rq4$DkY;u8tt(f8lahQXU267*SF#ElJ@pJzkDws+&=`hmiaUc5HNcbRawiazoXI zI)7DaT=_Dg?4UYFpf9lqE2I07)!L7@tHN>JIP1ayTL7Jh#jyf?j6&3P%0IwBqs+c2Z1GumLxS|S2ra>j*y$abH4>4q6CA{ydVO2#g_9ZYv;Do4y zYw)1rdlKSIak@ed8-S0-kfk%Q^!=1@ANE&;OO`-|TgbB&SVSEHa*0u+c)gfsnWIOA zh7dt2En`N-NFPRXY~hJfNXwnD;1N$)WxXfENjw&589;h-vosD93OcvUP>Kn~M(A@A zjkn^ynT8%(TbX3#!u}P7Z!)4_TZ<>#_Y{EVQD9yn#g8yEoFUwa z@>SSiSyG}Q=K;Py0b8C#yr$PV+*CG8#O0F!UXqZBjpWZ7nkPEtF%2rwB`*PHBR52H zVxkNJ_>`2H*jU=SgiEkDv59m6CVSDs_!2#`0I-puMPjae1i%$PB{5Hq0@QB=Nor!g zoB-HMYH5iD@1YC+;pEXo)|!Ouu6#tMH%qI?gcKgm*NB3jFwuHi^z zC6>sx8nP2d$$S9Uubjj&@-DzcA1t*>#6`w{7YJ@nERzEPWdye*&cOH2;g#=GMDnoc zkQ5!T(fH;YN zU6V59@MQD?1h*&U%29x{bAbG$JozD97;_2GEh%3H?t^n^-NYS91<`(_dr~2fIk}Yg zNGg*1J7T5deyH7{CWW!G3ROppdDjNe@HiM)fsZ90(@ZR5DNi*ai zz~>~nJE>a!iPFe1y(ejxoQuTx!-S-F(ti0-wPCdDgRu2UI*j+f5Psi-2)jqToD{u^ z^c5r))j@V*W|BjGkBDY0Q>u4f=BiPWVJ)8tV!_6L4eqN zz}kdN`51uPy>$t=ZyvyDygs2&P9>-WS0xmw7qsM~1dQ!o1F_p15-_%V3&dgAn9xJ0 z_d(o9ZAvH*Y8!~N;j~tG_Q0AbaA4Ti(;?jeUR~_vK-+sK#La#} zbj}L#zLT#65Fbm*ttaaixbPemAq3dz^Jj!}!o^(UP ziCyLFEK@an#fgU*nxPKQv7Kzt-+n=@0W4?x_pe&WP5faczOMrOOSM5ul}!$(baIFaRa zG=XKGI;-gLQux5*XU?rc?E>9+8~oepJT8o8BY_oG@vKu0LKwN6JclHsTM;>7o=1`u zL&ETa(;>$JIP@<%UGgan3~=gUY7de8JhDp#){E#^Xv zou275ENZEySDjcD`B2j=CsswaX?o3xRgrHs&31Y$>K9FOoLCjPpy_odRz*bfun%uI zu_`hNo)0C@=Q{H&Dg!dEiu0T$I41*|OR_heV=Ss35{AP(-&tx=E)d6hfwRn_B#7VK zUFfX9HK-tt!&}bd7L}tl7dg*b6kW}}2b;uVvD3f@*&t)zmpC0()eH0+oz-0G%(JRG zXcL*SEJKF5g3PFFA3He7@7YjHh+ zU#n{xeuZl`eq&rK@mtIF8GdWK4&k?s>u>yGL~#UR_2r@^87vBuWGXc<)M($2wmlQj zh@fv$a*c63o~f1NQ0JkOL(9(3sN*f6-Qs5a_*!{s60tf-j)NnP^Kj&SxJXO*X#^jj zH>K~S_8|BWUB^tQJwUJqT?Z}HPa;^GoUMaTL7B~ zK0?>}E#NDH4d`0W1N;{N8_~5IChle+*o3at3FuAmF}l`veQ`DKMZjist&yWcThO)M z2etkr*_u>}@h{wUc<>WXL$A=Old14Ryp&{XNir(0@suj@9f3w&%Dm@EVX*Bk7&zmp zfEM>bNO`353DD}MO>wST+kq%f*+|YB zDL@@3?tg%xGn6Exi~Y}t7N-SAo8wUmK|J-*M#?li-j0+P?prHxFEuL7}94ZXC9t5F z02sCyf*&81F`xL@BOk=W`{deYL}4gk7r_=p!HFu>jK+&w5rt-eTM4!y3Tc3c2tM(6 zaQ+<@YGeU*vhn;w3qpqNyZ=M{7tHwM8KE|%9^8u&Ydo$e;J?K+1HV?+Jp2k*6@Ft} z-{H5G>l}Wu6K%rh|G$6apkd4VKO`Iy_AgX62K~P}hHd=+$JTp*M^$bA-zT#tWQG#X zq|E>`CnuXD90Hi3he(MO4G0>Vgdzq+L<|smXc7v*u^>ee z6qIsN5Jj=0QvTnyX7)_(`~IFM&t!l0Uc2{tpqcUEl^81|h-bWVIKp$wU-14}uO_zz zN2VyUJ^W+8Cp@Jq}^5#n#w{X|{vbR8f0I~2m(pxA$ z1#kt}=AAB&0C+0$s<)U&IN@QWcfLFclcO|nfe*tjM^@ev@>}cMb-cor1COn{g z%Udtwdtzscg7da_XY9mnz4xHhr(mt`W4PAfJu3fz7zgwn?+F>#D-xXT-czy#fKA@@ zo|UZ??C}03r)6Pm*aS|$=RIfH%H(~o7H4$>aj|tkUJTIA9&H>-wzTrsr%5Y z$654}0pHX3$Xh0?2Vl1FQH1GZFNQQvfjA|0c@GLJ*g4WUf8sqVter69bI-fIXNC1C z5xKd?drnx6?1$BB4l5A_c*O5Q9xV63-Pu0pwo))8;Qda?@@#d#F>56d)8^CgLq(a z%zMshO+z7NH;;Ss6GWBRYRINrKKxpKl=7H^5e*{-@H4qtW<>hopIY_YzD=Nztd#_Qj{mh|6tfK z9>6vBJcbQRP<_9m>U#mhhE)L0+KU)AjCoVjIy(`{OX+@@hz$=;A`MM+HN+U=OiMng z>^MwYZUyi}RG2|Y3oE>y;xx16n+oDhJZ}x)1=aVQooHtRW{nW+_IJ z9#d+lM-Pxrs!2B^lT7J^PH&2HGOW^DJcDU5CB?+b_5v8aN5ZWkYzj=K=%H&)EiZ)W z@)JkNhrVSgWJi$AR;EwGE(DOeDd9J3cp}fU`hdAbJ_M8T6k5aFDxXo1Zf=vWDlpA@ z`5}Nu2^r>2`I!P~ekhMCXls5fe^p?apGf!Rk)@!^%sn_sf}8ZzK(#Xu%IneOvuo|m zqtdJF*yeGb1wBfgK?n1M+_5~eWSVK7ie2;VX#T)!blgaHGS6mx`41x2**u3N#plSX z;P&bDh|uLolLrADyDX%=^(2TBr3>CYw4McVCUrGUw26Kc!Hn6IadG0%#;hzVk%u>G zZFBLiE}RF)Fy)>Bqa9@P_{KqU9$+uQe>djK?r@pk zz&x>Wx*P!D;D58RL=ICX-(qGST|+v#u}nT-qi?3NaB5?9tXuhRV+~gE+e8NJxGzbS zhX?G~K0Xe0MmxBOmoNU=nDsk(f1YD;zELbLAQp=eIxa33H@aez&r2Jz`SR)qk&hR} zSLVuxhH2W}TaZ#sDy!uxSmLsrP+23_D{xgl!Ao2mC3oc(xd|qmv`s6w#-h}$a+{1c ztj#OyW%SlTi^`p{KO*}$5>g~q?vV=t+(5LfJSA5HIED4fvpm$}qT{LjO@?5?kW~2x zrCS z#2*`R?ebfS#$=e+i<6b?1c&TYr6xy1m*Fh@AE)44WhoB9qN=zvP!R05kVEyNS(V%k z0rs$Yl_n1;Xi?>qrvRLZiB&H72cVWpP|GST*1$4@UgeW_0sccKo+?vTC`hU*lurVN zQ_3e-)yRJ-NU7Q)Uj%S^rB-d#++^Fn6{Ar#>6Q3$5P*Yv zYo#gM0626rDlOR#V3AL^Roe1OWm1I9xCX$T`OM1hax8!ym{pmrxjVpu-4$B7!ciqV zC|d&QFb_u#c}>h&h3O%W;wM2mvSN_Y8f{O_yP|WFq|sKM10G+Vq*?UR-P;6NNrl_3 zPf+f7pb|_f-Ok@N<8sg?sb;%%SebQA+Opj`4dP&ROWL{J`W3|4*F9;^cI%R&9!Uqc zTN@SiOgg&VO6nMq?3HwCyVVx-5&52-bap!~dqvE8C!O1FeF@^Q53<~-Evo0Ru1R?^{MckJ%tP>p843*QSx+oV`eVI^sDK6H6) z_Oc|GT&190k}ad5ZJ(4UpM}Y56g)dAUv2|%6WbxFK)$6QGijpcCLeKcA(Gg*-nR$p zjJFZw+&IxZNw$ZI`0j^Lts)V;8Y6yjwWJiQcWyWX-Qk;5{Pl} z@Fs1Q_XEO@mLzS9-4|(m;vfo2qEHw~s6TcQut4Cm3|UxV_!eUpfmfyE80h{;LUBmI2>?z_2NIAL19-7lAQEw} zM;<(KA_1pBj92aBlSbec6l`K?sju4y*;8g7dLGE0+7F^x}XSm*@aP)>iff(70 zkDziwjKUGF=FsH=I~u39>Yj`AJ7bzPkCn^oo8im|#JJxa+bl&I0A3C+XofF60C@O0 zu9+=qmdCfj$2SYc7Ck34!v-?-?wqVh%pf?-kf+!ua6DPUtvA zpvu<;3e7hhzj3~q_;vU;;8*yz;uj_8O1RhYDhwR6#jG}1S{sf)aeB`N;h`xY=QW+4 za~U6@!QW z8?OQT(roK?U<#iLgz5ZUke`s|U5%B%Y~v72xd~qdEHr)wa;WbBmKf)O z+#Ih4t~Ht?MB#@wfMrG-ASdKqz-prtkcahafHhjj4X~_>g#cp#lxrybi$I!jr@|5- z^7|ebg;$wq-NHi&6J8|c3|S9%o#K~t-()B>UlD%ee9Q2Q^7bBVX3W7%yTl=um^>ns zF8H$)1O5VNQ`r>DFbRqdpq68SEjl&7-OLaE@mgeDvBJdIrkLk^9chqTYGOsWJzUEe z3YRc-ongubc*~XcHh4hy2)`oVir~S9u8|4wOw5-yE0~4((o=wMn?Ysy35jb`5gH@1r5ru+zjj&BO7YZ2(r0j&wHL!gfV+7aXXv}H1fwylZUwl9U<_u}?Ey~_T#s3G2ymQWteJ>!guvrJA^Fxjk@a{ynG$rQ|bmngW&+=B04B4FXtM~f03DnA(iLNm=nYmu6}V^n~q zSCQrWTo!1gF(Rsg@1K$l>M%X*B)5UQqu^c?HDRly8F8?jOsG!`+o2I*co)L`47(h2 z=?!qWty+uJbBY0`uO}3mFAu+Qz8moC@Xf(5CV?maKXxf7xc|kvRChgYBnrO&fM5F{ ztk|M+WvoBD9Ais5_%@AFE(^o?28eK#4_4w^z32=Xx?pU-8zwwW>xv=hrvQqd=vHZl zJI*@jhyxqli{MhYQ_$RZusWO$=#D*uY7Cn52F^M zNu;@tuoQJ)n)`dG?U#_}rntl8BZB12gzpNyO`3eagf*i9@w@|jjW+bsH1}zU zc6=7$@rh@eqA@OmlH2%aL5-fUtp)1FCYVxci#i~_4r{l7ZCY@*#no=urbcfC^h6#= zGoovGLx3)R5OXmt#t#MR#?ZD}c%l9ppwEcTMu!0rv(@Cb3v2NOVmx#Vx~$oQY)=4b z#&-C672!mn%lJUy4M5%44V*}(^ti9j*st(LplQs)0G&+>fwu7#Oxfkhz@R}_Q5mNI zvyE?II+L8b37BhqvK51S!l}SK<8PR9^LsNeUvuZcD9uCr50UzLO-!RvO`rU~y14%v z)!_AHtv4d>6#e0-FBwY20l#s+&iF;oRs-n{PvXaZ9!smGqS};0VX~qn!u0@((#-&F zpf{l?6$9QOlLt|hmIC$>Y(`O{b^Nah9zr`l`f8jUre)xV(T+Q=)4~nsBWTB|BM6X5 z4chT&NAM`x@mJwmFEV)y?RYVQau@AdJdSpJIe=T^zNj{9k})3ARw@x*7q~X>91>MxX+S`j6iZ597xk1+R5%a?8YlT6n3T6^3t{2SmAMRG%@@KiCj3c=Ww@S& z8yfjP%sZEnrn*nmgcjAqu2cPw7*Bv^#$?14V}?1Eydp7(;yf3v>F@B1+st{GbyHp9 zt*iN!*|9yT1z3-WZe1;`93<1=6x&%;nI~zXouQ<1n53m9o<=RM%#W>#E~y+Hn0(l)d=Cm+lnsn)fVhTC>D0V7tR`3{hDrN%?k;&uOskk5T1Hlv6 zsffNm@+6&&y9L^r^YAkqGGbGDxVYaA4fKEbwR50vi)T#P77A+1#j~j0ofOofcJ~1A zK1LmC_qEF+!`0_dyHm0w=M=YMb_}5aY`bxn2xARzys$^dbe0!@Y0;Is=vF{sq4sXe-Kn9;!4C zZGGY#6n?q*>UanNTa_7KVP7&oPAqP;PqhTOADz1|Mefs)AfC-FLxz8aAox=ezvVc@ zQjNn_yyJO04zWbfAFaS4mS?Yxv|FV(x6%uq93(p{ac*S_;46YvbR_g8P3uS7qIaZk zlPh2no`0numG=SYFtNBZ{giwFu<%iY|E_erRRZ8Dy(S%NEB^uUdr)iBv9|K2qPx@W zIO_utr|P=&Af7D)ar3c0Jv%P8op?`rF0FqeL>Uyf>^Sj>DLbPL&J4lB-6)>XcT)CX zO7maJsViZ!*Zf%i2;dcjeVE^z18`z|iYX24{_+aKXPDA72Ru$u-fy0@@CIeLLHV5a zVy2<&aPxA&L=z;QgB0fv?mD~(wVeuSU3_WA()|!Zq(hgZav0lVZc0siB(w^}>~wk4 z&6@UG4FXtjDXL`vT|0P0H^=B5WV`zja(#f)_R3~E=BxeYROj*_7$9bbc`#EZ0c zVkksZ(5{2po&^VVam19jLctL~+Bj&(5H$OA4jsuK>Xm08vx`dLH7MZc6bwTFZ`wOz zG8_dw0O0oiS`_e33a<0|Wgi9kUW^SCjPP3W#G*)D9O<>?^~z+Fx09TqU^EU(ELSkb z+g;wL;Ch^#*r;Hvw~yScpun3ew<;Lt9VFjZFdk=$$ABC@Az!lH(Li_7=)n0B*sjc&Et43U2b=B=1o$)jL%_12|0k z_BVT{hv!FMLdPivd411Aq510Z8|T}FU-UY0KI9l}^%si)m2xc4CtnAwX@$tPF2}|MIut&5+os%( zom=;p2W2VzW!D1b+5FJb#n!N6l;_HOV8Th4UY-~0I?VEXZVWj}8RdntQi;j(>2eD| z(6NTLugPsB`B{+@o z({BKtNqmnc*1ZW9!ddzxRG9yglb=JRMr==)<#3WearrKsTzeq$9lag6&QS#uzS{mC z+<#ob`?$_=+vLcRzMb&wIhgQi!4J@PzplhSOh*+~@KL%YzfkZodi9eEcHutAIRHEG z3A*?=go{1hjV?Y(!JhO!(p0b)hgO3M_N5P!eF5yirx*$3DfkQ{0h+C`Yx^-0poJHP z&(kN$kxJ|Uj6&?yAoPQM)JiX}i6&^B@)%(u{jz@QO5JlF-8Yg`Re z4n|jCo-ql?g_aVVD4BMi6>&v}CynhAl%-8Vq7i^0; zUcBv!www-~hEG(xcay*&{J1HM^So)Xu26IT0R4`R0o1i-j6!C#n51c!Wxyi|(v0t6 zh2JV@3v?NOD71ih+qM`o$H~>91@4}()o}=1+A7*KgG)y-Uf`jLAEX%uO!#bB0I0{l z!fpV4Mq8NjDndHYG_ru4UM4WtIErx=XKe;>kkJFCj1rh<^aF;&2+TL4cR(y)0lxo1 z;ktVeRhuI%5H9MO2DC*CkAfO~g7Fy86$|EZpwBox5Hd(l@n2y0gB~2N6F}Se8K#Wi z06Q6UJe=`cV6gX}Fy&yL1Ud~z_uiM3&MDHtxd6k3aIwsH(8)HE6`lt6F-#yk_&qS! zpyh)v+9BjW00;HXgejk3KLd<&G%4uaL+SiTI&tv@z3K5SmidWv;_*52T;=9j=u9+* zDJwq%3yrY~e*sQ5ZU*uo{8!)-ryEO^=^wyi&3!czxx+C0 zbo>JGE*5!-NPW5rl4-%t5D*Y++x-cL0$s**WF?zk1Jn(=_HhlF(#!ZhV}UXq4m6Dw z3a zfLxlI6KWlIfQ4|9;6JVS{Pr$Kh0uarJiO4sKa1f}ud*HXDg``Oo zspMoLl=+lO^!)-hRi-DUr4Tm!`SkMY~_LwJ%a z`jCI?F(k^S%F&nnGe*ONXJh?FYeWRc^ECCnkv@Awp~yTo6p6UJmH`OL}R zAkCPq@E>5Du~^}Gpu!>RSF}fK89N_fgEZrVj*(>Q0CX7-s|ub8Y;Mp&J5Gp>K;0PLOVh@{ zmgofZ8P6)=&OnpfdwvxEa-e0r2vc6S%mRi#Ps$LD@jC}{tCG^((d;?F&J*`oaeuAWJ zTt!bN-;gd}gAgAEpM*)oI{?1)ek0}$9|5>AEX0K1GX;~=rTj|46wD4zE4V4Wo%{{J z4ot;V;R0acqe!8fG3;*w5BbLWG>qC40engQmUJ{Id_bIjILi=1I)m@VNleXt8iKaC zElnt;1?sM-sdfPN#D!7!-wp=yDnE|E0c9~ zdGcBX>+AC6WB^D0p1J}#7r+m6-&;3cu1CjHk%>s$S2t0vfC(4f`|AqjoeIk8rpj^v zAGIj2n=T&$aKj&}E8-2>2grd9b;a@mOgLRD>gLNt#Ghef-2$1ept5eE?4h8lZjroN zL3Le;oT%V|y2bJq1)J)Y$Tn$VG`i z>UQF~H>i+=PeRxyj=SX#WW6(V{tIEpkVsHYxSg^YpdXoh<95kj%H&(OuE{~5r^%Tg z;EXO#HS+Vj#(th|?9BIg7*OWH<}tGQD{PwLOe32=Hn#Z_Y>rTVo<#u00cKHXes=3} zj)Gs@I0at<>d^^C4kW25esjxJ(4hub{O;DW^2z8Aw+nYc{&35+Fya#VC%g**W|Q%G zPL6YKxfwc($(z4m{IqiBZv>!D!9SD&FM<9=HZ}O!TwHL=dS&w>Y<>*jdG;klTGQk{ z@Iex90&!i4rt%PUc*yKTt{($%5s1h4CFD1tcnU)^7EWj?&p?OcqrPwo_w{1vhO z3C+toIAfoKFZgcpJYGP2oq~4PJWU>gE=OU_JS-Uj_L0fjd3YmoH^?Pc&f`~LSbG&t zKDf!M`!KnfeGMJ{JDtWZwzwSjzDFxcE(QsHNW;->fJJZy@2}WySa6CHY3w3ve}iT+ zlh#xHFcQbpGJnBzEtAxz(%e_VqFoLs5O=O)Pq4QB1S zAfM12eZG!ic-Fxp2G! z;n{`3k(jqGyl%;vGk+b5Ou*K(!(?+g+g!LV>on1#b@ZY%z-*X zzZnH0PW+xGcfr*|LAd${awU58{m(R)j6QRC4jo<2)JSjhS6WaG1>7k93vCgG5d~yLtGPz1<-U|5;#2Dhd)$(Zt z4)139oC1NhgjW0?G&8zPnTT*f04;w{$kk|;4TFG?Z?`tf`9y_ zavY#FnVk2pl{Wyg2rl@;djSj={nh*yJi{e_4L>rRH4tK2V2hj#JGo>hF0fVJ1{gu$ z2yBxJ0US0FsFy1N92{q0r(6%1Ok(kYJ+czO%U4YT2j!E1xnzx?5n&V5lR!bBH_O?X;N9;{SiTHYx z)fqIB?6nM-NS?FEhm4Pr(%Z0|8{p%5R3pXifMzvAq2zM7hrCDuao+4DFESME3*du0 z9YHInAef($hh>FY_|sgUk%!qZ<8O2A4-~{%LqOazeI6*pD;+~L?aOZP?m%FAoV5aG zTo?}qisP(uMPCF;Nslzn$J$%;pSI?8r*Ohm zHL#sM)v_DJxS_b*Q^Pm>F7|?0mS>Cn5+2XPf*P zVjSvjo_guLHUix}JLR_*B285f&mQSjCOtg|`K0BIf zX?>(9$1@Q(?Lb}nz}gialpH!&%4M^U2Y1%!k!`-=(AR@IYu!d-`2n*#(a#ffSi=PkgS<$IdrQ)ifz zvnwM!y0B;|l{X_tdVIoa1v3uWC{IvWWh3IW{R0rP(VlE!4TD(|YU{>$@`d#f%s6D% zdkTcL5N4c8V?Bk!%E2-LH#`L%Jb)FwdOprmEUbY@vm-Pe81E^?rGMlR7nKPfJaSe2 zqNZIzK1}qK39A%tUQKj^ry8z|jg-nso*F#K3SzSxJzInoeebZ)vsGBTV756A_9lC_ z3F}qlL-8ok6i>ade3S6}Zvp5g&rT6*X{LHgoK^}Z*j(;!_LMrUXHjvv6ioB1b%rNd zAD~=2#bDjnAByvrE?sKr8w1q^R^0~GMOLkX3JRE3L8bYg$1hefhoN+zgi?&AXR$_x zpT(kgv&1MJx7}+{l1s$(;YUe$us#;!slN~;h63Fw+oQs8Cq7PhWmQvU8L#UYt&P{^ z<;rLREcH<^5e~~dMU!-&9IfC+-3*?`3K_dssJr6&+rdI*I2qi}4o+7*1>DyTQuEI8 zH-Y=u!P&}uD)cQ;2b-+Uhy<=Z#!72_!e-s9i&%O*}duDUUqQ!dl9}B+|v#w zVx5!CXMlUy!N-;T+rZuJ;8w*&;BI!19%^Lync%K=aMYRz&jNR`gKsPO*}BV-Wd}c0 zTnzKe?cisM=YTug!Q+bOf;-v4pA^pnceH~S6we1|+QGEzBI&aL+`$fZR=f~w+re&% z7lGT`!M=)1!0qhd5XFnZm)XGr#Y@1J9lS;HQgB;4I9Ks9u(X3q6fXy7*um9`ZwH%p zunQU*PM;OvbUS#zGA{)icJKkkD|MHF8@>PJpop!~gZT39DqTJWQ!a{kpoqPwU^Nx7 z9g6PKyJvN|0=CxZ*(jK6bh%5pxfZteE4UkQOaaXs&L~(9_p;`b6Zh)5aN=HF{;tgK zgW!1u_XC!!ibSXk;6erB*x{&$CUr#{^gP*CL4}SR^#G2?M!i7(fRz%?->@z&CVEKfn;w+i6}+nFX<5f9K(8Y}x%idQaoQV{6Bo(s zEtu)}mHlCl+r+oYtaV?QHLzKOF0Y0ehy5KyQ6Iq@Y$e*g&{X2HX{+^Yn?g5cK*zJ?%HNEIH_Yvf-Fj_X^b z6J?3R@n3zbOi^$`$Gg2IKXZDDLV;Hui`GCDH5 zy0%2_fEcGjUTvw|3#gij0yLy{tvm!^*M{P~T7DN+}WIMzAuKfN$jllDa7-Rdy4|;4(@(ikfbcyXp)cDIF!o~Y19UFwrFd(;YgqALT z4DcaIF04NV!edp2vjI$jyF)O|LvsSW{|5CH)O_{PGDksu7e?sfH{D$jmGRsPrDxgI zBs~ktj0H5@j}yNJB<*%{)At+vpgY?q1|jKw54hyJ2u9Ulz#jpfpT}geKLb8_B_`1f z=K`iQuaC5ye+6u50cKtWJAVhlOH(ZNPas?5c?b95So#PvUwp8JDGbC z!5FqZax(W)0NWU68X~^M8TtI$8@uT+3gjcoYhe`1e*vzguqPPP;il8zW0-sdHy$ep zv~SGN#DJSGK)5ZEL%57$Njb=Fx{VUK4<-d<($pxG-H=QS&5SbH7r&$+BpO@gSY^`E*e0hb(2aV{{T+g5zldZt#rA-_3Mt=$()Zm+?sD*U1pJ!)6lDD3 z)j(D{nZFjGMdQ~3yc&KB>AVgb<&fd>@J0YNZ6m0NjNU@dMbFc|jhv%74!c|*z==-s zFtY?dn_xk_5^yhvS|@kHr8{7G>wxQ`zEU2&b?rFYVUeGqc?={dj4Y3o7Cd*-cvmyL5&J?}t-T%y`9 zF<%XvJmA-|?xBLa$xp52CV#LqWZ2S!epftNyY7lN`(25hwO}8`55e5lf>$Yi*za<* z(}LG2e#Gxez(YL+ifa(4Hd=71;ztpQ)>?43;>Td$rv;ZNe%$Z!AwszSiDGHL32m47 zPoune0eL~SYZ#T<7tuHf3bsoA4k&>*_!y9fm3tYGKQj>9K%nib5vn|~$dI2S@_b>f1WjcHR(jdn#fD3M1rvrP zhR(y@lN8&fhEJY?NgPFKnPJLKaOnYp<%TVL0eB*FyAhQA0C$tg3L_WiA7MLumWkGo zJm@jivB@Tov0Fjd6t@~Y5as~QFtn`8$og#tZR*};WOXAdGH4o8WW+W@W+LR&*6{&? zSqS;B=tUT28_nhK2rNS}qH#&V93w@O%~SyA8L;lY56;Izi0_{g--{aPp%CNzC)n1; zQNrN}Y4nPr4;?%0BAVAAbgeM1UkPWwAZU#_<(mLb#Wt8z?pEN(H1Z%|9TkNDW{yVz zySt)cHuP+H8c<0l>3XhaF9hjge@lKRPhNUX->zmyQPyO!~^j?EzwMDAzQb= zmQR?^#hlD|u90W*ITsgO-qUJ}dAR#)vPFr3cXxF800P1Z(O%cGE>MVUokDMi=RO?z z4oJ#!Sm;QR&jjEpH*GRON6b1kcMwXumcvo(=Wwv(9CRyGW7zAtepk%eJU_xQjcjd( zEteRW%EKOx<{(r~$~T6=sd!E1eh6Mc^{J2MevmAkWv^N`3OuHEvHIviX47ZIxC$oG ztnYf%w4f+V<;S*o8(}hhDMZw{R!m6^N0u$zgcg8uy6JGlZ)&Qoxm!YI=fVk7j5TC4 zl(gYwR)F$N<1>bFDBnFG!Z031y0?M}20qm`4i+rvh%ttH64d%as%P_{;)9T$_t6Y! z?h0?QC-n_C_1%ld~ITQDvkxCh_BZ4&n zaYZPWv3){~zOvdkq;tYeAAykd3;E<8q#{HAP_8@#;P~W*rpq4zyO1N|%22WV8^AY~ z282qa3n5zgC`<;1O3~LuE;bDc)yVdMe~pCGgG1ZoFa=kI>g5f9x6#3ft3x~GGyumq zFZ8ios9;EFkGxyK(9mb{LBKw8?V8X*t8PLBhK05yS`8p}VR)#-Z+)!j+R!q;wO`S7 zp;Eu~HHhPsA6o6VPAjt!p|yVNFA(SR$k080tJ%az=^7O(^IIQ+*lcvD+HZXhk`(+g zq0N4aZr-rj^`STX)+w0rp6A$5z2Ev3#1*O_w9{`zZ}5!^9rRmt7@SjaeCVj(`UjFs z6GEr_R+AedG%E&Sb0{}pbx|}elozlD zfY`rVLiqvfT1C@Cg#oKT(XFB4fHf7wKFkP}2CM~&ZVRmrSZkGJQD|+z3V}LNMVuL` z4&XHu6fe9i6N**$%Ta3S`0fi-P_she>BE}@K@{N~kVoObJ|v28bVsgh2-RR4WG>Hu zx%(Zc?3bV_6;&Zg8z0<5Rm0`Wq06=X0l3Vw1S;s8;BpR3xYR!gm-7^C4w-VSf`>x* z(2RnILqS=MgCcC_kx;hm{&oavP@%HW0<+1Zp**=z*?BCKFYf|y3?2^^@H~@0t@uQ! zF!q(dCqq*uZIAFr37 zL|(^!GlWq%6%}3ycnv9Zf^0p6N>Cs|My$oyfTs32a)L&V6=+?f`)M1|x<-q1C0f^L z^IV12mBwq=Q}bMn5!M%rBc=2KBRe*x-Gp}cet5_^@gUmWN(GyZ(HQ?>)6O0WEp*Ev z{-oIhw2jvu(dYwR9+29IhWlX>?81UYRXjZ4_|B}t`9&4^S$Mwf1Hf)_Vm3Vn@)=Ya zm%&zUoLEsMov-2}6r*8S3Tr5k;S5<><&sBWZ6=wls?xcpoFurT%8avIu>J$l>MA?V zx`?{SKHrJAgslviG2Kow?mSWkNB~@CSbp}REORMlg`+XP`zd?e_s$6gxT|+o?Y433-^#3IP z7FM};Mg5~B^c)99E+0@V-E>&i{WDZ{B4Q8}y{qJ3xBDnnh2 z7OryCMLM9wtz`&xak5J24XBIJLt7OgIKGV>zYXTLXtN_?Nt#h@Qi^_x%632HQ!q)@4+`+L3-+VM2bYUcyU;zS4pPyh@h`>IsU=ae_ z3NEpo5(Jj6z6>Kfi_vhjhY77+R!NgvN$oa(n5H}9IT=hB1z(VK-spmX^G7ue-9t>eP-viqA z3YhC+Pot8v7q*r{mz~&0?bjp{yc`{}E^0%P${J@$9R#WCUq#M8M}lieur;(y@nT4( zLBU?X1i@(Dy^L@~>&h!Ai_yBW4F%UtXCG`j1hG{(Jv`UBX&ju7_k?F)JP2swam5)a^HGpNE3xSqDwbfADJ;LvD*m3h+u1tq+N0EHm0) zLOUof>aqrk0}vFKbo6@)G{kK;fKU6xd5}$q$+1`1);Hy{777mBx8)i?Q^PA2C(B*@ zm1{ORRj$X9=eu%W>}8tM<)-GQ{84Y@ zv%w|(5MkJkmhGb((G5?6*t=-i+QWol#|BgOR$}jMz~`heB|-OqPmOH|%0Vz;*tsE_ z7lJ+~2R_)4E9b(58-))y*3C{;8l%g^LGr z<_&PrU!lvp5j-9)2P%BL>%h|jqrxw{;9zOfg$Pl41&SHOObUbvpuI$nUq*#3Ux&#h z3b?EY%27-3k`UHGMB57N3&MmWYgOdRuN7QYkta_nXjhRhe^b!DqCiGxW_CrPY_6th z9V({t{v&&uSy3!o!Gw1iJ64qNh>@XFMX7Y8MocZlDW|WfIAvfY&U(-jFAwN5+n9D3H+*9o>Hq;FLrI<=cxJQ+b0MjeUz0C)9r@e=@4PqgX+*pxw9AE^--{I z!w@+_!KWLBBK}Bd``^&g#djOzBT#T9It|AkOo|kX?-6C%`}lG(s{9Wd(ELmwTQmj9 z7C$u_qMU^-dghT!*3U>A>h~{Edj5j&(JX~cenr~shfkd2zo8=2Wh|~Kzi$X?nQz1K zXOL$it-{`n|1ObK!Mjy_z9G2+Npgt%FGMAFiiQ4Q+Oo)2%p$)t9$Ns{!GJre5PhC?2Q2tx-$@QjLEtxRmJxoK6~y%+ApmQcgHl!Epu)dhrKAdu#vI|rKkVpKT1 zo0(Xsb~Zh9K?3i;LL=-N2}B0d-D6VWQN&=@ASWYF|6L!o7WQWv3()!1$m^zyVj85Y zxz~~n>Pa}n9@_E`FPBj{*W6E&F|`q4<2QiZf#UmbP}-m2IC!==7T`9WLMo19qa}L! z^uO37qr((jmQF(^ITe+uEc&)RFwm9NYLEi_WVn6EOc6Jli2*qPmj`mP+ zH{C+*U~>3jij`Afmf{V2%I!=l9;WC45l;0quS;I3z>8gl;R<|SJVDzk(n_@QnsT;+ z)_7cOyb^2U#oSDR-y4)m6a>84a-9Ohn=2Q$j<}ZY&6AHPFulX@WyPB!HPqDXGq6)4 zo_EOeQ0#(%_zxc4pbN?z{1+UB+|qGYzUY|FF99;V^CH*KsNPYgo2tOs835 zTd%aR5WsR4QiC=F7%oEsjD|=tHNowW05>RTj|8|Gz$L@>nwtCasc{VPHpEx@_qK{BjFSbXSl+Zo&fh!%{UYU-S!0EZg%l{*Ode(H{&-q33e9%~e&c+j@rz*ogMX%2RFriu?1+*g z4JQywisblOO`Akny0}P_)sSIWQiO6qE4nktXjze-wViA&FQQ%Fl!vXpF=Tzn0Kw0{VJ_kLNx7P}~~{;pq`q z$Tt%(9KO5}0C3*=fqQ7V5>CjG_Q;2!`^fn0%)G?YpAOw_E~ zAbGW@$7M9clnWY~w8fBgiMJf`8YuWc@!RM_Mk=UxID!QV8XOLn%gHBqSn?f*!|8Me z2iIdVg0d^NI~;Ms8Jwi#-*rI4864j|V!i{YIfGM_`FpV6yh-p@#qYzsS(D&Q#XG@G zn*?Vo{s8Q55}c#>L$Iq!aGqj(r^tn`u*OEQ80&6B`eaZ->85zS7r#!)-T526G=6V( z{FMm!o4v4dwIe>_yibRIty{Ty|IRsY9393O;kB$UX}8 zJA5)15Jv&~+~Jo~v6IaH9B>qAf>c~`QnZX}h-nV-WjHKc01idM!f@E(;IJ@!g@8?j z1%|I3O|nLl2S*$(G~-7cSyPCPI<&Sreq|v9Ig^gTy{QV0BXhIXli&#!JmHAN?i&b3 zWA`omipK6F5+NG9Q;z277^cHTj?(vt>?{R8AhHzmZj=jW9Hv|h=uhyYqsF2aCdWLE z3L5<6ETNxFkD8ZG6C(-Ntke`U7}QTXF}Wl0$RGLPLR8x;5C~E(3nS0v~5ao zX&L=cvU456Bcu~5t_n#)v#NJtXOf&w7MjD#gwc;~jJ{GtF5LB#9nlPx4+<_L%~3~^ z6|_L*ql1Jmko`n~x=S)#V$m*8jKlR9J?vhHqvgO`G`)i?8LhUxHTX?#$4U=zNS5KEnpYs>d&LC`*IfY{S%t2_m~ZL7h>5Z;^bgr z@-obVx?c`lQ@sBKGrPrXYK?s@+%?O7k0t6n9$lMAB7!;iLFifZvc-nZ)k1H=uwPGtuf2(40k*5Yb*Vr3e7>{h=jJK z;?E}X1Z;7>ooj*t5`ZtH{?!CW!2mo4{<{fIe*r$F(EZaSyj{wD@cAaWyhO@N*B6@P zNrNXN2;Idd(`8#g;vCqy)TCIBgQuK;T0)5|0&vR{m#|Eh0v?%r__4|7YSH*mFK$4`Ml0zU zAYBd-PC63MaKQsEJ3Ws4*Dg03D(`=dyOe?#{=7>i>_g*O4bdU_nkW$oudc$(Z5d;j4O zEYKKn9$7f-!a4_8buTC9Uzkg~PrVvqYZciIc=lyLq}%R|3s|eM$XZ8Ma~kmW_-jyc z?Lygq8|sW_;Q|_*`3-W?0xkTl^aXHY^~6YBTL>o(BTV}+&J>FpeDWB8Gp(e-=EeOH z^Wpg7hM*L1ip$25hHTkF!P164y#2~1%NlZJQrAfBS>BK*(;&vK-QJKdO#lyAS2Q4N zvLi>AN*fAgN0_YWj`F#(VY=)Im`R?lYN*LtI}eJx8tU8T;#Yo$z;Ov*)1YbXo+PvK z1}zSTSq&s-!5YJ(4Nkd2`Sut*ul0#$FFG`y3+T6t9G1#D?1tBllb~8wlIBc)daPgMv%W8}OW#I5_HWBA9|+-r{^l zae107wVOxFI_0$viYe;J=+g$X;|@Nynr`vSQ{LW0}?MQ{P)?n*!udO&59R-w4L zE@pokrvICv%Tc%m(|;On^5V&KO#h#T$-U&nt$6&4_H&#I0W+``5M2?ut*!v|0dl5T z-#fM=e@|~MHW9kFH@**!;o3*!)P22mIRo$$!Tr6_HSK{)e`yoCqHmz`G`|6=1|Z(Q z19zYRxPK!V?ogsKjZzzT6#NL8kDAgJP3(C5cL{eBNs4Y19U6vDcO7Ki+IIr(jtUmZ+)@MN5XT# z+gCqd`Vka{PwN-N9vJ$pz9hT`)fC1~vAy2+U-+u|{=_f#m2N=`IsIY+We^R9)fFAF_2gYRrp}UdZ;{) zzKeL#jtQ<^g54Yc4`Vu;68^@R`$ZV1dFZGyzv`~JcaS_6Xwt;}zo>xbJ_dD%Z}DT_ zguvNiO-ig{txaikYWZ#~gwWd3{KW|6x)glm1?|tb1nX0L_>4Igq`WBa_oTGu0>Z=W zdsEtET}2}IrI=WPx-Uikaw`IW%oF#+?XK|gdonHq3<9)T0w_a1?!x&2{)}%|JQi=vLh64l5;mFqnHDDJ9ApHQ(mRumgIPO9pD2Jo1WZ6 z-UQfBaBH$lE&?1Qn2}8Ha-+6&gN`Un&ZPUU1*D#soJm_xMWh}dR<9uSlw|iWuxV>c zsO8+ZF4kCnx(-_m5aGCew$A33v+Z*DvVR>~&Mc@@%lQ+;a>cH7@;fMsCZa@q0?W~- z<94sh*4zb)?vW(%tlFX!llf_YdfpqKh88+0+%8yBE_6u4UbjpGP3VbNBALE>9`wLHAtgysP^h z+;LwZ$DUnE`Eq+|>>knzwDB9EOAU%BO?Amf0X&denTmqk?RMCDVmTeB9g!;ImZ39% zju;7Bt)M$*1z=Qat_%UVaEwmPlMewn(qmHdwan$PkO&=7nru7qKUd67mP?nRLnh0` zC>M7CIQQoy>vElfxyebg0>H&*UUG_j7{KLXezH$K1sFmOEJ!xxHU$flZCS7EEJ_Z_ zod9;aB)PlXt6*_*Px+OCCCS~bL7tomL>O*e<@g=+^^9i$S8|c=IUT7CMCPa zBP5yA@Uw;@dVjLLj3c@#S!O`NF}MQ}?Vw;aDnJ(im+U)H%yR%7x4V!80{|SiHHhdi zCAJn39SvaD?nXo>Dp;4?NlsN_>k;cY3hqfp@%$6vvJXH@7yZH)ayWncBM;|~aQq{eT_!j*w4RJ93jcU>iz%v-AxrgG{?r}Rgxj#`}2E{Dsh|d$X*eb$-L>vrT z0_~147M~`%S3n)^y~q*n&coaOv;x5&HjSJp*b)_FFSh};W>nhelS^N_cmA(ATjw8& z3cmjuH75438)1{Ul_~^LO-~y1GD-hU?NGtV>IGjnF<%$YMO zb}%S!iaiRr{WkJ;X5KVA3Ro#HIB&My2gC#}$eVXa)ITfF{)Nxn+wnOYLv$P+@OBBD z1M~*^i|+Y(@;>+6y!7_!^AM+wA{mkwwtdj8msvqoo=%6x5U%I}oY;lLANJ#Uwig$# zN_1Tb+z)tPpo}IIn#)ydt)^sMRi``{|F|w%hZFmjK$ZT#^XzS0oFv)2n5Z5C1`7_5u1XeU?0+leC$^Nlq)};5*&V~`7AB1PN93ttwXd(B zbhpMi7Y0?oJEa>^;I_Bt(Q*HTcS$2c#k%7J{iE|#J9r1$m3g%IT&_xrkcHZCm6)LG zT_KO+iTiQ}cZTjSKwZ*d#njhJJC9r^wJgK+NGk&AOi+5quPJ``v?~L3g=!@dz`V#E#$CdW2zr*@5;$ zE_8OW{6J2ec#-peQTJCI$gMq&tJr7A`}#XN>U#O$o+R*dN6(gWo9JWLFCDXW)krw+*4>r2i^WzQ7&({=b|&BkBB$eK zB`kXA9U}kiz{uSypQ7?PB9E-Z^&{JHvm;rkHHx&uZOs3F-A(s%22N}$9#MZ&UiyJ^ zGdE}t>g-v>{uXXf+3Bts|BmiQc17tNd~4nTx|dQHiNDWdHa(R9onOb9Oq~A4yu>ZH z0+0Mt#2LyLGWn~y@G z+(XZN!(DuddmnHwJ@Z|FMsOcJ^TR-267%n8^nC(2N7Nq3tF+GpBLp5~D1Oz!Lkz`l zI~dF8yTrjb2He%aZ4&0;yrH(o-Mq=Y9~hrE%$@*fI*%|EU(JfrP?1bvDDIC$;ZcU- zN1S9LLvfXpOkya$9JoosOlBy)4tPf3F^1yXfe!^9XDI$~44(x&2t1KD&wd5GFYsjE zBHJ2kDm;}}!}y13!m@)XQ3IjPaO-^W;Qt>|*UA3dyVu>P8X^pOp;oxDODOOVe>_`q zF}J=Sc!VS1$2gb};UjNAZ~sRlVf(CuiIIq%0qmtM_>&^h_*_6+(&Pxc77F9&jBj@Q1l+zb{)^)$;dX`b{f?i4+ZM(fkyDNTY52gxcq_+K;7FmZvK$y7 zRrgGU8S;|k_Nr$iaa)L{Hu&cv6}Gd3=OaDr;SOGiRN7;J85qWYG1A+f>|ko7uN~}Q zT4WF(GyKfZc^WAtZqJ0t&rh-35J|IN*T9qSUs9}h)kKg7HQZP^O<<(|(m?wKNoh5_ zJdm{r2Qvn8Gzg$K=PLulc9(;h10!~ygINQkHj9{4ZT7&JZR+6FfpL2P@bsBMp%2g7q&sdq3UH*RMG`X1#!xs`SvpsyFM&K+VG z1G=1jP40zu1t9tNugx85*8q1ufNieJ9cB%w>rFB;cckqE=oEZZE+_B-9poOqK6ebq zZ$Lr+%-qt65^`{^$JvyFbJG)mv&ge-^xafRDrW;GL$DRf?Lw%2(B zSKE>M{c;Pk{Zn)G)2>}2?u&Bg&xvEBh)>DYaWIdxv;EU^BXxLsk^Q)VNFzM4-W&Y% z_Rr6?-MDx{vU>rE_i=DxZqT0P;37;p)WN@VBla2x7h~5u91P8k+3^l8!N|`5L$9J- zm*!U3mmOS|Tj_OfObz$K$2U2lS4cghW$CO`{wIY0KNX2ILhbYNKL`2#2{+b+zA@@w z9@0NW5oQ015a(J+>IC$! zC$@%22l>zB+MZl|gpdC$HaP|OQs6mkawhPL!1LJTVyE_k*u=q$*yMHxQ?bc|fDTgA zu*qcL4~bwpHkkp0#{w_W3f}}e3%s1$+g1Zd3(Uyv>xDihK*B=O{AvHfa+$D;6q)xw zc(%?@D0l=7H^WKZHB!N$R^lnT>Y3jO^g`0qLZuBQ63`3vN_pxX++RJV{fExwvgiVw z*ai2C#lFe4Ka$`5`0$r>p8XZj0)LCe{sKCUL$V2rHM=(no3Yq|fU0f5VuiqwqV^pY zn+hxw*eVvgFW@bH82BEGO$Ai44U4@BY!JzIEOsVY(R6+giva;_^`Uh@N z{%KrwZm1{&ju$$*p{EAyuK~}*jXh2FqW;=kdngwo^gpH4S9VD*0Di{4kM2lx@cJAR zoakU(ZjL?E!57%$atB}LwzM}o_zL6P@8Ij)_PqaVm?5c!{O>eFKS+kgVu+FctX%sl zp)^CY$!-BYG_2X8o^wuAs@KBEoFU^YUto# z9@S6;XrgaX4c#2f&+TJ-0vf^FxqWSa2Mcls*^3>#Lzg=O(5M&E%iaoTZ13g{^Fm9h z-i&&bMwl%4=7y3wko8a8SYKMgZ2#k2`!-Q&C9J|4)j<34G?q_fCr*s3u4Eh!R z`?={iH6Nh=u?xJI>Rj*OLrnRjgC$hweh1aqwJ9-af;CiU#KBUGd>36jyE8ohBaB>x zWR7HI8Ak5zV0mubYbMr;ZC2jscwg*U3!NhZfRH+x51joK6-Io3j zvr1or{2ym|hqT1CI1aX znUfOhoLwdtiKWtY2y}^7wb}m$$KIogdiy^tOrJLS<3jeLk|Uj!{IoD=Yp6KA`*ti$ z9DJbV{&^t>+9FZ-Wno*JPfW-ENO^WHjM~<~C67uaEabTh&{q$&3*+fSis}|t*oTq) zIuW&B7gloqB>~#qfY;6}|GoB@2d2{9PeL+&P0hvmjyK*v3la}kUt2_7l;3N5}g^un4eBd zDj_j(e(8H@bKi)L+))`i62uGbLsIk?PV6VJ{x%N|1 z*1qu=I@b-rvz4@nW9eK!M&%WOUUaUX0h%Uw zQdw!ejDY@JdQy2^e}llA^rZ44|9OFVc`+|EjH^V&CT{i7!fFc1K;jST^{!4WrzAH$ zO#go>%1Tk9-X$*9f6y-a8YgzwLo)GtCoer_Eu z7D-JW6R+!uH={|VTCNv*q@g5THql}KtB4okB-b}S;IgO&=kN|B5b@{E*At(0S?$gF z9H~el_96D?0kuFc$-`UoSwi0k<@hfo0_fkqzKG65d=;k757^lbrp?b%8>(dbeBXYA zWauL5|E2jXsy5TKU&)ASW@c2gGNYQE8P%&qHQw-dM!(VtHS^SSe$ zA+w1FlNdK&O|gs(?EiohYi)_qRfbsVKkd7jOV-?fV`*XsmqoQWu{L9+`&*W0Um@F1 zU4=cC(<h)9TebZ|?$jVqAbI z=#Ok>@8@IJsjRa3qneTMmxM2Q09nUv8R-9_+50AX9JqmyK{NGZH7)! z7$(st9K zW2Yk-;vbu158$HB)2Q?!a8E$@CLMqPY8 zenpOL&4rq?J5e3v;K-b88v`^`{~%LwK)+t?L8dxak@kD|_^0PEN$rG zu3>YDs@)KZ+kX(on?lq#hAOfZTb(cl4~Saa~YDql8Uu>L>kW-Il9m3SP38l11^mP1VQ@~wHbGxsDx8(Wb7yY?#C9OB^w;I2x8Z(46#I)g3s&O$k|@@o z@{+(;H2Ze|T~PcwC+5YLKoNgsPCCtx37yhel@s>Wk(fV4 z(f@`kZBXIl^d z|BF7gr-;SkiM0~BV*j&vw&~f>^RkqtMx^uqg!-K+iN>ztXDbOU_Vq%~r^M+T$dwmb zn3ALdvi|?yp2>ZZJN`x@>3E?g&o(GUItTaa`s=}eBTl85+@Wz&N=HK{W_IVLJk{W% zz{J5+(t5qn&2a2#o(#wOZ{^r?xzOjT`Bdl0hwz$=y!mf)o837gxni<_CUhxkqnRZ8 z@8smz5r96rETm7p$-%p{PkE45$s$_X)ih%%ivJ!R?88VD-lv02y1!9YPfBWXhS zEky0W1rZwsWZRwJc0tS*0Vh9CSuaqIP&G55Cz738(`x?c$w9N~eET(U*DI*yRP&9`lYzvy`nlCn zdo0lS-&iHDI%fL;nuq4qaeE=KS;B;?EA2bL&RZB4@~eB><$!jg2UN4$2atKJ-=g|V zy9>~d-dk1=x4#2=XSAxmgB^Qhf%m#g>|CcL?_}`R@wK_(KLEi@qWn-Bga%_+m*9D?}Qf#aBNl3 zE=O&UK(DH>9ZX>T+m++0m_YQwyLJBQxY(8iLg#SV@l}Ld3n>WY@Z44Mpm+rJ#V7Gi@>ifX(<9zf!~Rs zu~hstvdKC zl+a;O%$JswKCY1S?;1$B|An%VYvw~s{1{6D2Ij~dXFc>k?hyKy=H z61U?gWNa1x#5~Mi$(1x%fA=u2a0GDXbYRc0d4YpF%hldtivoPrymy$+Pju00-!RWk zN3&MszYn94EQ9oh*gtF)9p})vH8{l&6KA&HKZ`}JTe;M|Bm*GN+~aT{ zi25GXV+-+&`}K(e>5b`;F|mW*;DO=c(gJDzS;OUgjjZ8zHX^Z|@1v(@J`jzcJ)GB% zZy?e;t1+3D|Jc&5q{;A@euk%ATyS_7yPKzOh0yRrz1SJF_Nd>x%C_V}8_tO|&_V|% z(f5=CA4n!nrnMdod@s<4)_SsoQ>5>y!8@a&tOt|xl1*F|$znk0C$19xQ@$>#ijo(* zn|Q*0-zs|<7aiqB>_;X>IykM0-t=I+|1S1KJn~?{{#SHbCz@Go520iJfGYbA7y2da zK;m5L;0((0nS();Ws`$5x$}N;Ft{qpM{nHS75+IHQJtF^)p?mw4atnEil`1CuqJ;# zH*p6C7jP4&61lJ{?!|f_iuo63Br-HJkxMcYximA8%QEwOx#ag=jq0i@+t(#GjHu3W zFr26^b1;Iau6OXC%&4xGs9r}D@vp10Q=HC7qMGht6j7y$aeWmhux&>a_3x;%A3B{o z39#D1T?E+Z;BL}Rg&so_iv3eZ%bTj~Ury&{Lg(PCCcK5vg$_n%hQ3uA;ED9Wu?ffr z`8Cx##y-=CwzQOy`EGo5r2443za0x)FTM4$YW7XYvW$C7xldv^l#xE_N2=`>^mM`F zKw_wM(6*XKZx>xV<|d8M*SOnPx3oD9Ixsis0E8Qpkg4YRY@0;>5?&+y*Q)IZF0==G zoye~TbnKi%e0KqrGYRzuQ9KCflxQx~n+d?=T1M43nbAB4wA>Y7O|694A` zrG!3Y7T%u_dOaXFtiKu)ybRQnh`)v`zv*BtCivdLr{sUHgU_nl+r~tzVLqoYVF&A~ z3vD}Ku*CKS6Sq#l3i<{AONx0I@adbtS5nL_N(ha9_Vojp|+_QAWsM6~6Uivjd5LI?u`Te*)SP|Jb#jC*7;xj`+iTBdLp2 z?Q445)Zo~mrY|e(#1QwlXN*2SFq~$c%148e$dALq>A(5-X;?(zY*f|t$wqKWP*U>%(y+)pXWqoWDaD~8ctdIQ&+$OM_^|9T+M1ei5k2T_r;8cOV zxl!93SR$}5H)c-+?CZeqtd9)<`U?EPtBUi0n+5jgR@w`J@dAJ5_O|~4rVISVi}PE6 zg#z`wI3EM_*ece~8)6>@J`zbFZ>W6=*e;NjH_Xm=Vf?(2wi?ikX0v;7EzoohYK_>v z_ybTV(3stee*#AeG-3B*^Jh2+Kp@EO#Z$1%@VP)JZyNJ|N|vytE&wMs7mi4I>cgH$ z*#DOD9Kwt;KcV?V$}^!fBgGn0HDzyna-d&^xOM(&T-LvFV@Ht9sQ+>#ee%T&b})Lp zM3kWZE9_uA5EZ@KXR?Da3e-!Rp2ZHv&JJcr=spj@T#1sTlTN<`lR)|M)qiq#`hfp` zZ8eD88D8ji(bo5RTB5|uy-9es&Q~psT^#0rsfbmQ*!%QBN|pUTDFuy7wbYs1Snu^fOlkdop-^)wGNZ=CG|AQaA|%NSy|5l%aoGQo(od!5h5DyFFX1Zj zvCZW)3f}+1u^zOMo&FbzRm?Av>@xP*4WYzKLkAbhL7V65oRzAI5&nC^( zaZVf9q}hR{w|_N~Zz7fUVBqsNXnGsjqR0tD z*%BFQZ*-FHBA44S4z@;y*$EE5k6dl10J@aCEi%%+3LGKnY>$k#i-0**r1L{$O!{T{ zkCCzV6C~1b{GTF|>{oy$x+5~h{s8C^0Y68k*}Z@+KmQV$onAxT8JS~)*i6?qc17md z1AuFvA-3AcB6|>^C9R8Wv~ggFWarn&PWHcHjo4wt8T6MY&Y;#PR`3URa#FA6VPzyc z!r5Q)E>rpANOsWUb=K(w3;U}hwv^T)5&3JVBsnTVVQqw2aSu|8i3M`})gAR5(}ZHj z#KVEcx3(jDXrwCLEJvDm=vqRyPJWefo5V8kc{yoiXwcsM9DCc|B)Ln1iL(@M{+)te z8jRbQkmv~>mjx^Am8|78dI8DhK~65Ff!r-&t_UXnolR4|GI+Uu&;5!>uHpm~`7%bw zqG6nXay$t>Av`=dx-=vzBZ6aiyc-d;+h1h%G7q2skcCsx>m+b>5bfAgWP&g5gSLF6 z=iMg3`l9q8z6$;LbmCD5r}4FfJS%GxKb$HfW*I5MwDu5>46KIvuq z=LI8g5=|ho0yitN3D=M8#btZ#YouEACQj^dbeZmkYzHp1-@lVr2#+lGyx$~eckv3r zXQ4ph?hyZ?jM@v2QRXqSoAGyaTIb({^_e(R^prej&6KN$m2eOl|!a%k9=rlJ7{SmU9l-i^;oj zT6wlT54g8C#-3izsk(qH%=#~thwUWbqPMW>%jN8pBBnd%12f8_wjc1gz$@i3`wmgh z5SUpWw`U`nCorp=+2f^zPS{K{e?91hZo!TH1HFy@f^z#ji4@UF{ddUNtAHr^3(LpY zw*cLT^KSWA`wpOQw-=Q^9AE0-z4Aby$@ush$M2U1nt0>wH?Yo>J}7^LrXBF^mYorc z%O}}7phB|uVfiAvqsa55F8w9tHTDlA$B3l5e3k7??lgj$@^v=uU}^c+Ug#)vio~{| z6S#^=upEDRxozaMR#1+xgOwQgAO{~~VCjVP46s$@oV|1}QMAri+vtK#!a!3R`ttu@ z>X8t>qt}aZS^vQ;5_5*ua25NAgkt_{<@Rnav`SwmFXI5M(m5nQ1<;=24eEC$VBV(4 zbE)6?!1MHb{+s1dFI0ecMq}3&pBTB1LK546a>Re2URUUDkSHFk=ZOtpg@@`nUz7C^ zO=)aBUp{iLDU7SI-rYOU#Lr(zrAJKv2?#z@ekBr^!n)$@{x= zhXq;QWz+GTZwsRSTx-t*G~qY-80aEEGd0g)X+3hXwUNk51l&g{L1zS9GU@>PViP=X=2u36w#0T#{Sf;dXOHNOa&7&EIvOfm zS3lG?MNMI3{pGfDHLK}7KKr9sdCR-m^Pb^(-oL(nq@9IY3weyWp?q7+d`t z>vtCRA)_ZPq#kdo=f4VuLRSjiT+e?qO@O3N^lzzW?YRfFsC~oe`r(1X&a6o)-C92) zp#SHlbX)y@Ai^o#UVn9(EV-@o2QDT^*C4#4Pg5|<`5kbf+R-HuLg|IB)O1sB!4J@N;m zGZIj{o<&_8!J8%>9M7(=q{}63t=q<4>}S*}{qyRryy!kcEH{L}D_DUWDo{n>H&D@~ z&-1CsAlm4TomQfkZEq=qI@|@$p}z4NINq)OKn~wm!LP(WaHK{7z@D^TO#R;dB@L z5=~vUF3y(-UZ$zb2~~2B__Ip*BI5E84=^(+?BtTryQmZ`mZanO)HVpbThiO!=U`DuUptyGdqwhI$sl_#(B^&M{gNT} z7}OL#C>d%`2D*r3amg@yEznos!;+D9Lo2p23oI!aZ6_hQQ=qzJjP3dYjZ~nfWUPIb z!Yve7S~AHF7|rHTfsab2=>JOX7g$y@&5k1nhs&+Aykxe03Q&WrD4A!c0?`jpTUoNm zt^o!!%K0Cc)Y#3ymCSeiRVAxzEuay6QnHTsUz98{Q1qfkywKSVIKL|?CFd;H{trn~ zJfWdD5!*}u?U|Tq$<5FBC*mznl7v2?N|^j#KrghpVL%yslFxL1Hk8Pqme@X=h_XF) zN|z^@x32%~naIX>Qap*A??3;Sj=twk>`)tpPV#+CqI~x@43wHvvj5?KNRm1FASF(h zT+TgX|FcN+ExVfIZ)cwYYB@vaZ~uC$ljz8Zm#>5WkzoD{IEEW}M7f?xuzhWB za`3;gkguy>CD;d&%4;Q|xm+hQqu|BsX4$@gc99?3 zY%jf$`4cO3P_>w>Y6jJIJ(^?1#1#JqB(WZ|WuErn^z?B4&~(rK;-VirofC{4jGKOd z_0iYa)5FtS+LjK+PmjbqI(TF{UzxU#cX2!cHto|>jz_0Q?coT$4>8BY=}aCZXKv~v z8yLQM4Ktr;b!Ft^*SRj~5-LJFwhsvVTT9aOgYW5N|Dv21OJv*VWNT4Tvu>x8mHONx zvyC51*pnpQnhZ~IBhe502PTb?uVxYC{5O$^Z4;hqIuU!J8Aw_ue5EmZp?5@8+ogt2 zOiEWb^!y%7-Y7qD89QgL7`(o~-Z6(q%O&JGt56Qz_X_O;_~^fI2Bh^(gsjN(X{r(5 zFSJwe;eS~_!$s0UU{$~nLR zZzMC73v_Uh2XqGXW@!$T1D&f06PCxvSPmHRzb~+h3X(I4Z3XQ3bg;c3Xg>mUn(#wG z*scZi2$mlU4zNK2EBsW@!saroQ`k|^lKBnR<1bta((k=@5$`^d)J9obkZq44^kB)! z{sQ^NzOKNYjL%Z>`4!y@fZqjv1FivzYk=Lrv%r%Adw{or_XPF=UjVfN`+y5BVys>Y z{0@tbN+Rz3B~E`r_=^kp_Vc|0JCIhWC4HX|O3TJq-=6y*4G3ak&Pt==G!JO^`07PcUY*tp(N3* zwEU=ndWiivUZ@DqWalHf_d-XeJ&xzn3!RJ`n@z%t{Jo|2J?=x@J+`mZv&$X)UK+HY zJNTnCY&SaCUmCI79sF6!HXsLomGT9egZk3A4R%UK?Zqo>3kQLCrS0G#E8g429Qg6R zw!4GuIR7W=piz8?9q6EOe5n1mgC_A|_8JGl_(*$~gHW8Ar-P>PG4>?~&EjM2TMlyK zlk5ryx$!A>gM+;IH2af-=JDC~@Pm`(3CHKr|1ZP(G6BnPJ0bbi59fb~r}p&fs3g(d zzbBIAI65%!5B3Zqq0dt4Ixy6g5t|Gtod4KR;w_h&YlK@o^-bBPGMyQQxrB!geIxu5 zq^~EGIcQ zUTBw}?H~(uWeuQ;|uLwv=uX!;*dAY0 z_`QQ4;$EO|pQ9h+m4U*~ZsZ8o{xr*<;-dqFO-V;-M|?D6*|LTi8jvpdcMT;QUZr2v zGRjkn7s~#mLFu*2lyks2|MtHnoPQ~vs-%ui&=a@XDI(EHy-E`E`STmbk?_2(q38GG zB(?kTOb)RLk0(=FOSsCHW|WxzN62@g1X_$lW|yH8YyY;a!T(%pKf^fssoF1$zu!98 zSsJiE0CG^OzpFIM)&T`Fr>`x|w)IX@$1oitCXL|N(x$eBgWpP8OE5f{DDVX%cGyH{lt3o2W0_&ME$g95( z1U4{ZNIfur!;InZ^5pu~MrI7R5k~Cdf6I&^wYs^fw8GwlM9k)IEco-lY|i`nJ-({7cNXQazV^jreRQ+Y?UXEVJ)O z^#_Jf_J87EbOBE6Y9ioIuuJXHTxd5t6ZI1Tt%_M#zrTaorH$YCm{)w-*fUL0xDHJHA2B3=21#)Cg2R9iv?aqZbeKU93$vBYX0fQ}c6A`kl= zy4ps4Jn!_+@iD}@6S3ZD2X&RV=b@osH{VO}$!MC$J zKr(SvXU}eNFsyUX{t6r?5N~N$7@(-R0b)tL5%amb1g{RM{2lc2tCs|TY-{?=r0 zPcZ>cSA}LK(#RL&I{?N^CpyGypFx@h#?6HfB+Vlantjbyl%<9F+29b9s**riE*hw^Z}%)Cy_+LGFWtIS-aYUg&~Iz?Wb!U5Ky1aJmp*gDs7$3#vWVa}hC%T@g2c?aevGeBE&cS^Eae zsPK(o%*b0DE%CQt7qgVGTH;OMp=LR#e>t-mj2n3|CjE-P1*|ZukZQ~N4y;T!maSl4 zFXU05#s8t6WB#|_Qp9~OUz;G$_((L@o55_8<8TWYG!cj2fjOoSyhhr`RxoT%2h}{^ zgAr5Za2puq`+qdsorEWy!C!cpBCa*9dWds490oT@#*c8A4~{mK4%>o@)Iu7z9k@7p zoRb!SyebcUFU35R>K*2vPTiUj&H0}FE3(=j@{Fwbt$7`r4FD^Qhoa&@u+pUZv@^io z=_WM@>}y)0ti?PN9Apfr_8trl@nU<(N`-&i^z>Bacow+t#aG+m3Dbjiyo27Xc0cLh z#OV?H3hK$L!BYw7`9)Gr})HC$<(ZzS=I;j~!*u@Fz0Gc-1LR zVj}U5gUO{i_T+U8LlWO(%&HEgIn+y@9xr7pd^LJOe_W|9b80etGpVDl!uV2_(2gW% z>|0grIX#``G1G}edWqzMdgy%g{_l`?BYryF@Itq88M;g2s>gCs|GCn%rJg5I`O9=2 zLtY^N(oZP7SlTrH3;LR!sioP$NKQOul4+&c5ig^B(<$Fxl+`9LQNGabhIx`$lGzEb zC%5fzbb#jkFD~2Nv4orj{1(^Ha)uNnyVsVGXAWJItnOA|*i<-d4Mt5buy6w=ZUe@R z{MEM_IRaLg)W&@I)HtR{EfiD z+eyfPgSuCdVeK#u0(rahNcYQ}PgH#xKVq)KN7rpS;xoxy<8p4nozdGtJ@&8w^tgkH zC`LOe&yaw>0>88&R*Ht{E!^+qkW5sn9r?2kOr zX~Wb(-@uXQJFiXZ)fg{n1FE%Iy&ClmL}kyszBJm3*APtqJjE-{BI{xQN4(4wio8;a z{1fDvUqNkEJ3v+e)*uS4lQ7>PiTa0KOPJJ3S~=wDAfaKpfkAV`AkH5VL+GEvnAI-E zBalYSKkrD6Hx(e8q07-MUWiV_?}AS{?n9xBxJ$sGndTxZ1#`@+;E~d-<6xNkpU8^t z!fEGYop`|CFGcJ{Y4zUzQ;T>$C`(rUUs6Of++jT!Hn)IlHj#Vz=c9K#J5?|ntT1nbmk2fjD@{H4sbFKUw`ul%!23(E3E0=P2Rm#5 zgWw=@DA-dl1P(Dh!K(!2PmzY20pOE@&A?&iB8NHPNOLXtnn-iO(dItzGr>G?jCl^M z7i40~&fXV%dG5~GgvzlmK918H{ocZidCirwE(CoSH(Eu|Bsx)br}pddXk>mMmk zja+UdT`5b(+y8IGi4?E=8;Oi(`C|}xp$Bk_f1u5U{Z5p_RCBpj?v;a~#C%h4ibKF` z^9jyBS5)(rBi{44i-Qzr-3(qFl%SFCEE! z{-sEhC(=p0p{xI&+M0Am+|Q=8Q^w~1&r_aSEe-RWOzW%vrK6eBI!=@@n--tZRwTRp z5m`e|%~hhXhc%QWmhgKw^pq|=Y2Nc2N=ATQD5n|DjSVH@mkjf0L&?ivQZk#%;x623 zLH|zXUgngGy~Lu~T@Z1uY8djnbjTkh_`PW%<|Hl)NyH0qxx`I1$b7^d)tXuc*OIZ3bz%r<3BlVj2OU{J>~sTyDY+^uPPB)Sj` zn`a2C(u=@|nFVT@{tYsY?I-2d`P!;7GIao**8k0}WFT1qT^ovff}DScTXZr`u}?=7 z_6LzbIx}ZNiD6MQGZ+k}3vw3N)YQ4WoegsLPWta;@?XO*nTt0i!3C1wKoYF*|3xS@ zhL-PC$TOXg=z~dLFlb60_5;J_NQb9^5p%4=)4{0WAJ`LN`-3sl$4Li(JZ~IMSDRrY zF+zTZjRrInOTO9vj%U)^36C58TT53|5>Db?d-`v5253WntD!`@0l5_ur=TT5um2kz z{h&|R-BhReD4BKmig z&+G+v2<9jrN?wY70CNRBuXrQ!pkI46#dw!XO}Gy7%rb|+g4tei3xWoH`3Fim|Trh)qM_6aazW;%QlY;Wd(!5^{WQ(%;TH-}sL|Jog&$A!N8ICXa*JKKx*8{{Rp zFU-2?HknH?}KWoC9_T?U>J#5e(cNvVZYd zI90N7#_p!Nm05E>GY zPS}OSD;r|}bPy;TYJ*Gp+b5A^l?}6pEK7o4Hqw>@ULBI`ve9-mFhQVE*%-SKcuAmf z*;re+Jm75+Xi_%G4gxBE1%hQ$?8U$-0->^L_GaL9fu?1%?Y+QKfo5g%?4!U2ft<2M zwv6R8EnIF{jeebcpV%$0Y?Ymhni`~e**g0n(D^sQgv&PCwZQL7f&8*=y~z!z#&#*+7`$TafSWh{ADIcifD2^3xfy(gNH zvS^_2W@w|(fn|IRa5q#h)V3@hD4YZp{0_A%cP#>Z8WtD-#16T21b3z@;dIt&* zhIR{?vc7@Bg3Yed$uY-phHUFcUK`SbI_A0VyOf-=4v z*bfcbkF2n4bfEC;Pm#w9`4c*%Y*L``e&~9kSlN_7;d73P z%BBSh=R=Q(taI7yK;c3@{@nE!R9rSMQ1}THu7|pmEeaI=<>=6|nm}Q*HOV?HDO(jN z>N3(1!@2XX0z3UOo4b7L&_zuaZ-J2<%k;;UVrJ@#z2 z7k)s4_?8+UcP(ORkg-4)-k3ssl`h9mTqfsSyQDB55h%ys zn^Bm36h?YEP5yTZBkOJof9y)^V{P{!J1<+gIPT+Rn zYJt0eNx*{wcLUD@Izo9sP-PzCA%F<$83T*iJzn`65&4CK{%HpsUGYUe<0 zw(cZW$g1Vt?3ER_S@E`n`t`|X+@u^@wO+C zLmYG?1m|iaUl=K zl>HnWfhjL?P=P70chDVE-s9j%O!1_@{rM*5*eG7>8l z(?ycgFhdM~cX5`#|pAEkAA_$o}SW4^UL9r8B~`MZQXPDA#|DB~%VQEm*i&c7(* zVW=paN*Q}N=v&K8dlZ9YMivwCo`z@Am=|!FJhOf%m$BiR+HD!B-A-!qc1shugVcr& zO~Rd-cfeiAJD|@A+`o6r9WXDQigpl*r|^~dW@Km@H!9!1q*Z_AGMS-$T*ju6p`d?n zMuzSqL#dwkeljFGOf=aCYO!J|19?UQiC(BzL(en8@M;*WhAnhM0Pk! zZb>F`5tAGLJ4&5j?Rl#S=x?nJmp(5S-`CEg$NIk3?p~R!i*3YE?_hf^Q_^OnQaFV! z`p4P@yq7^X&0klWPUZ_j>>Aq71oKb7-3K#DywS``+IhKq0vooT4H8ZN$ zh$>aU*JUJdq31~G6E*ak8KLK8hJK6CsRGW=4E;9aNF{-_fD39nd9l$@p1*dN9m>Ue zsmo89W?bdqvt5ntNI)y?b7mI4Yz@*WQR9p~rR5x4fmTa@Rjq#5R4G&DPsmd$*44FH z_C*)b8jK$14XMVumfDwIA<7OQ|5NHOy;YSLFa3xqqlb{rfbqYf=d~c`pW?=Pa@&sa zf6nL}ejyh};;Z-BPO4tg(jx$ONe}dD!>AG~m`ncKGjTLsqFel~p?Cx>F>$bwoQ=o+ zN9O$*S=NNJc(d%NUe#r;rBcK_#a>4nb6jRkoWDD*2cirJH5&UM8+ zhGM?s;8={k*g-E^_(})I(N4Z{a6Dt_76&IVmhN!So3V7CgA-*e-P$nsiH!Zx(6bp& zF-b_^bxd<9GvgoLb=|S#|C0 zb57#dVUm3flMnGM#{Xa7#=bM<58EFJbBlWNlB8_ZRG{L5%(cD2ZEZo6C4(%c4AeZ(~ z?jVo$aIAyovL+mu!|OtJt&@zXYpN4RmHel!nce6lSJNza zIJkym)Al*Iwl2>$CG|_&(3M_S*W7jlG=h<2^H2w)>hkSB9b8{`fb9o-Aed3Q;T}mDzsVZuWCzog}$-C~g5HO22)#k@gn{ z9lDKX+LDx*Zewgy0;}3V-NxFsKv#(%+HI2Oi??=c%`>j~Q{!XMXq~X1?AlN4qLw1% zpM!+)54T8i7P_3PM2WS8s-r=4oPCv-7hY&=IyS8*Rg!lWUg%{NeRU>jXf$3DV!(iF$I*^r%E4(RrcAxomeZX;%jP+a;D03D&d``H)Yyz3wwXX&(Na zV8CzGvin@;bC>#LwKNOGN4{IQ8=r_7J1cpx(HJmlRwJch@<-ZW%xrLYFBng6QN9nX zF!e2YkdoBz2P@5fhw{~UUz7b=AaMlfgWwR;7S#7Y4}n8X9Mm1FW5G*JPlw~c%gkAz z?wooU9Hx6Yb+gZSaICoiY4%}c@)2;7S>uW@0i0qkNBWuM>QQi-X^XiO>!3uPDUJlQ%;_j9jsmmI zH-{(jda$t>;-oi#L35?U8^NaLT8B4*IcBuOo54KufWuqBuzA$sXz&29_%}H04+YE* zT^4@gIQ8kC5(;$X6UI+zh{e=w}2_;M88&;T%=j&`6R|9?$a@qarA?U%KiPu$zr zp;L4tPOK-j#EF7&J@$RA^fG<EI$@gfie@h@8d}Jd@^4q~G@s#K0e2JdFm0u_Q?PHy7>fU^u zk2F%}oITN*E_MQ8iszzOeCaGqEEEkBd|8eFpoM>Usn!Jb1p3q9ECBQR)I;C2d;$}%pP4t3>P$A2;? z<8SEFT%1aLOY*+JCMR*#&U_V+4YKddB>L2+%?qK7kE-7VgGSE8k|En)1m>7xqIk9` zsl5k=%{6~`-fPXk_rZv{|4a7j=7MqnOw>FAYS_hK%sdI|R}3G5UCf~U$*@bnxOoYw zcBj=~g?Yna4OnRwIa~_%Hp?A;1okzn9WDb0nJ+;7(rP(4#B6l90<1DWJ6s8#Z~g%F zK(CL%p{5CzQCtO%H7!9oSit`ToM%S<$rn49fvdqq(Wj^iJu6O*Uh0eHR7_L61sjd@ z2QUDb+juvkbu|$3Ou4h(8DQ8P1s*3=CkNp~Oe(fB!KgV7sZKx!gK=}J!?VD0bC$!i z!3uLBs8joMz#ismCp{OeG`E3jkn_M^=6;7mz~jtgE^HOp+dL2IK8EwbK4zwqUI3nL z7C5{R9AZ|2T5A`9L(LZs{|ydf{~K+i_*N`D)_7rX!}EQP+ZDoyaUGu@oP?^asl|HJ3X46uiz12eoQG14o)s4nGG+rF(^S;AsB;3Ud^(qgK z=7Gb^(cdN`Zw`(%fx0Ay!Eq+nq1f+X(_XNcum^yXOet6?*aDnl`hh12wgjh{ZJ-RI zek*W>*$-a(4A>f+ZJPedt1fOAzYVy`biXe-?Tdix%>2`m7B~>xX4;`VQetik?leb% zw+Tx1?~Q)=TN2xYOc__eYK{(YMIgG)v4Oh>qCYr32tG0p-2rO@kHS3y(Y=m4!j*w& zaCfpG7VZ^@zP>rh1#oXZBY-u%Lby*LdJy``o#0af(PCIT2DxqdTHr`n@9jh2L4oM7 zUjp9O%_&YfJS1@Jpe#Sel{p^0}hMI0{Aigu%^pWBB1y(`>5E85d> z89X2>dK#>yl-^`umKVJMkKSeEuNxlo{OE14HtNISMSk>tSX=cG@G3w0D69>l0$%4w zpM%v*-Qm65aof4M+R0t!HS*u$$M_8ET7>!HX->gae4C5L<_z3;Ytmo9Mc7<{+gI=% zE+Xb3+&cspa>3UvUnlGQT`*=Y1NGTp5!l7t=mQ}X1c>w;9&DEsG0l(Jlm{wxEdT{b~#)F zUTDG_lDS$74mD9w-Yxi_g2POSlYRz{H2-kY&%x2=c<^c|;5u-Oxe3%e;R|rA84qd! zzXTsKPdoeyoM2u8HIrY1lgwKV*Mm=(YNxyboMKXYdAHn<6E%C zEd7Rcy9l@mTxA;5ldG*ZgX>HuP;<2f{L++znvL(kugysgw}KnZ5QpD`Tg-nz-DABC z+-B}^xE}u($y37)AeQ zn0{}}kE~G?!oR@uTMzGGhg>IkCrm#jvs+KT_1gv052Ze4tA*p)(Pw{Vd(W}R>)?v) z=qvC|hY?&U*Oa?C5#0)|AI>^+b#n$SL4~)(T#ZBBc%%BH7`5*_Aa)MwSsfuMcI`RKg5Mu ziT7Zt-ERtc=8n&kA1XHk*))$-lga_ZUUa?VJa}Dpv=)A@Gm$ojH)f|lNNWLmjrjhB zuCKTXyEOJ6z%?s)L#ch|gAflz1CSRD7Nt>mWcwotr|U;*;87Bbt{*9053&Y!kA!(p z!W@Z5#J@tqY^`9;LvF1rHOxF>(>k~c3>xWuG>Tzhj*)v+i!~g~Gjh-9kTL>nZlqdO z`X4ZC4!~8snu~mM2(HF_4Hq2U)`moj+T#>IOSo)*DBec?dqUH@1oF)M8UD+sLlRvFx%8Qlu;;Xe8Q>p9x%t0 zQ6j~A!LVuJr1ya>&Cn*8OggsvLEb|AgX+n`EY~;iht+CrcD&Yx9;2BAvCyF`#WQKB6#HBuvJqCHEtHZ~^Y}4K0 z6CiIOzmd?pw=gREgNf99j$D&C3-U~aS&-t{V8DFkr00NH<~xVyg1*_~@H{Zv1lcR9 zVTXW?Ogo2FU}Mu69D5*kI3EnE?bZuk0ESJfRxSi1rj%)O&vr;J0;8;dpjmtpF+}{H z_!v1qUOWC{AkTa^I5`d+3kJ<$C~B?s0>kELhsS|fag#*WjueLYz40+svzd3kOM5*L z@{Igcp3v6jdxs*=@+nZ(Glez8- zM$Mf_KWNC-velX=aOjOCF4zIzE_iegWi}?pS|!dooxE2F*ZFE36Y3Hs^wBiG#tG z<`S^0JW@%Y6fvopcnpl1)I_`pOq>j%VLO9y(~@cVc@nl5tT1PQnot+8(p(7E(vHnkcJ>aXT z(gyCinVWDgMS=p30>|NkuYoAJB&bAD14$r}G*ckhE-e(LL`fD6#vJwPqxl+q*-SN$#Z_aG=>6 zMYYl%V4jJCcS_~$3G#tu3DQ}HdH69&_(BvS_5ebSyth>?Y9OY4LKOD`IYvK?3W(TG zb2eml5Y$WR;u**?O9)YeJqw1t>pLD<*p_1{=NGgsrze7tGY~h+8G&m%V@1W8gquyb zCOIt_3xEmu^Ec5SO6+2(+GKVIY1O_?3@zBfVAy;F>L4=;jF_(iJOu2Tn$QjfyPF>g z)i!+?m}|O`iDC)Z+w=)=H0YQ?ptj2~V1E+_HQ!RuH3tXEW#C{_7GOD;XKKJwSwN2k z_ceEb+Ad`e88?rCzfmi81vt{Hu`7{wG~>0L<8edIS-4F2$C1{M`8fG;mfEg; zgIFwi&U2$$EV;tJ35=vx_&0;OsTKY$pyTB^khH?KC02Ts6~E8*y&NjXDqGc6B!6c5^<#?e6@D+r!y~8=4voLkhmv< z{mpLMLe`str+_2O>EO{Z@KmtO+z#F#cpBJfhJETcqSL{n%_wltAVQaclllIol==+0 z8hbpFRI93jc-hQ8{#vdY45yl44VYsV5KkLuEyz6aE8N$v2h1J3LPCQYAb#{mh&H%J zFw5Kn>MFAdw9TUdP5{H^Iq*EWJ~?d2w(|c4=h|`}ZC=3pq6F1JmU$Jtvy~){0K1y^ zKuxwD>~7@V{2g;>iw$6pw2`W-l|P$W%C(Oo1Je($mhEWBE4g-tW3(_s2<%os)38IhW&hckadQ;kKlr&lqORT)a9fe-2sZByfvFlv^=8?wZ_@bhGlm zBCNapmBhLWuiEo#jrCA~-+)=>$pF6v!{%=Reh225*8==E7%?9P_&wM)Eyq2q{85xU z%l?r7b0A*LQEmz`KP={Q`u39Z?p|l&<@=Ag`KNQlP-2JWDzD>oL2m$MLzcOW_&QGH zfVt*+aEP2mbOC#tqR)73mtX{R%m#3wU=-|cHiD-Mb_HECkW94dyMcpEet_Ml#3Me4&jCac-v^mh%*D$axnx%lR4C_Vlh(y}6<{7O&+@!3{ZQ z;AW-$P|MfuLB?TwhG_p)wcl3l&qdq$71!6BuX?|VUKw7?slyF930&rw7byCWS8(z# z;JC%Lhg0lST^2&z+CWwNeG$lO%1B#lYXsOkRa^Umj=2ftq5ngD902y`4}O1=&p(+g zCfj)gn7dHBM%0EtmiY<%hu~0<_kyALn_xcJJ2mv~3pVOZs^!@aY&Hu~R{IPCkGAqZ zCavyvFTkwFtD3t)yd5LJ-N3Nf9AIyd0jwtpMeN-rqO2J-qN5RW2vOWaB3k*A;Szh0 zXzqu1h@46dR?TAq+#6&KxIaO9`NXOsEMoVUSR?T2Brrf@9UPzmv&@(P_X5LaET{vR z3-aQ~Gf8vEc{us~IKtY~o*<*#<0xr|nW&@Ovq79@Fe^22Oag85dZ2tHxSRO`{9LX< zZe{i{VN%unjt2LzhRXiu7gX$rdPaYhylqa+@*C0WZp%GMb0}Voe-Fglzd@ZC)`6^M z3sE0(pu|~8h+|*KV#J(=S3BrR$TH^!co7&*ZFesQBdJ4(OTg}_Lx@Yk+|(h&Wgz?4 z8zsNnB)@M-HEzp+xjwJaL(ajjgwkg7t3Y0bg5rS^dNr79J_08QUIRL21V1`lu#gJ4 z7Ie*Lgz8G}IxvrAD;(hsX5{h^UfnK!09oeA06zq&iBY8KJvpHx*#hqAc~4hJO<2*R zItkWiF+y0tdt6Vx{AoqcMsbK-P4oisU4oOpnlrfG_8N+0KIP0$3wS$Z6@Lq=J=cO9 z6o!klg7dpORFV@meUNM=8GAjFNJ)45PX3xbkZQZX3$o0h0PhC*$v&uifO{m483SrI z>%eHSJesZeN03~*7B>Y7_o^hPYw?kRp=*zo z?)Uk@%x1El9;e-}ir{VN*%cr!nM6^`R0(!Bmj-w^m}_nTbxk}T>}_rZbzG_f`+KEp zLl(AO1Wr9kTh3fuHYvDS&Xu^li61xYY{JcU-o?#vzQyh0bR}xU*$X%7jKJ;cRN{7X zj>YZHA>H>JblX!%S$DX4d@~jDcDRbuz=%oSVwHz0a#JT9Enqyg@16mU)B_J~cr(Fb zBezral4gMinep7!)asZGjxrNLoji^MOH50E$AhEI+yLi*W6Vhb&IL=&r2)gA$vAAEF75vVB3sUPxFM$tV&1?u;Ah6Wko_{HHWLtOGkgW2m;r7E zBYI|`#ry}DYmO&W@m0`Cng2D=Rg3D)<1JvGS&VY8IOURuTH-15zX^KwR^_+AG!woJ zR+!s%gsf>2_g%2cYzNN~+zQsE>he8somQSUo%g}@=FlJgA?yQiLuwiF5%{PXOQ=@u z$Kb}4y*~k;O4)lG_>O5pS*A_XOHH+>m?4Pk!}%3Fn2}+hMJP?QlHgJ`sd}1@jET3qknTa7oC057u_@4a~i{?*sks zVD8O@v8$%{ZIOt(R-Scxr&S794J-2cg%2g{eM&JvcJe=U0Oz<`k6G#5aHy zW?6tYf^}v&s4ep*u-RM+UL%E+N5qb1^TC5II$mUX71xcb3ET2?nR5-Qma`r=b>RJiN8XYd6{wGb4mS0Fw9e2e-owY==YLo=6O|`2kIH^ z3xbxHZxzC@eIF9%T++0hHMk+?Y1}O56I|QrCMr%Gm*q<}nGTyr2UeJ`0~`icnSX<7qyn(c{1RXs zJi>&zI1QDzht!*1pst<@!3MMYFMdlZ0vpXbT7=_ggR)wZ8Q zWRf@M{|cooZ{bzGEI$jjgsa~!B=&#!=6&56M!Zw5a!=YcxR`~&>hToT}`;5I$S*9QXRcQ@Np z_wToWJfM?&tLYo?R$9k(lw`gAM@Y|fisrH_z8B)wFc+lV|2}Y;$)PS4?+4E|Jp+^< z0xj2?UM3gxAh^POOQ_b(L*PpDYk=#)i%f((HFN`bvDr1ihrvrs{{SBWFEzsgd=$LQ zlz?jC$H2=?eSnXHSD5Lb4zW*wtIWaxH-f9px!~<5ae?xCr8Q<{fPVtld4264lr(Iw zLE!YmYdOWZA!h<^mUAMm?Oci*b~cFL$}gq%Im}02C;E4!3Z8*1)AtxgI%(w3g8q@% zRcs)__GOa#Q)F&AZ{miWFLAS+FoCw?ii%T&o9$HK<~S|5U7WMU@0D>ld2&ZvQn?GM z<@_Btpbl6ho%s8o`Gp*EP9qF z^V>MH(t&AHye@VdYVuZY`vtyllYD{ri}8(CbRn_xBu&S@H?BV$m5a3RBk|<#QSK-4 zCtED*X36P+IFFx8$Ma8Kq7O(4mud=+$5USyejWIWe~PGc^!ynW^@%97RrR)M{4#Id5+;tr9^ir$7V&#|TL&n_z10NKYCS$wwhxT1n* zg^n+>2Ib<$`X1?j@Ny2eNab$fo1Rq%^=S~XT{QS4QMwBRQY>m5Mr zcmc5}#$YZyuM3&?woi%27Jud6LqC-k^AW0gLULL>9Q!G!A{dE%gbMxGLQ2t~Ll(g0p3rV0G6XnE{5E^MC_ zG`Qavt<=vKjX#`_^NUu+9w0h^h{1e{%66(yg^X_4E zzKJI_^n!;#mbqb!k3+$*N&Y@4ALM=I#M9=wFWB9bKIXUi{lHuk-oPh(N!}g?@}Sa( z_&XL_O2Y4-+lOeO2Vg_*!n|6I!9$1PG?A$tF7i@Jemu>8Z$JeKeZ6Q>@A`pl52aeI z=q$oL+i0!J@Zo*W%gf|EIPY3oL#uspQS5wj(kJpSp*LI$NJZM0(g7w9^83kUbb#b2 zc{y!fzAd1uq$_Ci@&QL3yH^#J#f~Leg)8X*a{#TmtBR^(rw4F#QFUy&fDCch&^0aw zbnv^Du8|yOuPd6&`7h)0z@xIWtnFd@kRl!bw5*3x*0q#XyYXR^HCdt(`e$+^8eKFZ zH8PH&;N!Mfmeh$|O2M1=VIh7Pg(#z}FUwdzm2#9*qBnp%=_+ICcpm|p&p7(pc0ezw zg6{PLpiBD7qHAJdu0pT;aQa&B0LB;H92+Pg6HIN<8a{_qRg@aktGSLmf;Igb88?&H zUstp-b`U{_NjZ)vdTH=@Krg<&=p`n}YDzxvZ_VY z$EU|m<6@q@9OGQiGDeK^j!eX>`L^lXB)vl52EJfgKH0J+mtm6w6y_4?p?Inic0-N zW7NWseQ@$#BlT8$Xi=*9=2KIDqnw{eP3=of9f-=iWx#&a)a{@181DP0b6EK7g8% z`q)oG4y2}}KB@#p7R|DvpHa$O=^MSYVJxDYRy0&fpM4{&efG$BY7u`FefD)qrtS4; z`s}*_97CT?F8q(Bo3<_S=c)vK=?m1f!B3_y{Sd&E_^enLGSU6P)Oc%ZOE4|IB(@77 z+WM!{%k}`YeYM2Tjtv1cwHbV9IN6tG@}c4V3HcLcx975_$P-#-e=#gpj7J;fmwcGM zEP(BNn7$@}ulO*%j5(_I!!T+#2>EeXS!{LyKMkvhEe_!4VO6nn1NdcFU2IhVzYc4R z-2!MSe;d{udoT#G3MR)k1`sNk9(yi;tOBfY64jqK90T#K?!wq7gz0bS{!wVfz7F8k z!cgpIK)=fOT47c!2Ys!aErsFOu7EB+UoVWr1_ba%VfR>G0B_108$Ki_Z&XmbOG&*J zVAGuZ7phB0v?3aba%kZ1mOOpAV`~A6Ozck!^J0Gt zLjF}4k39-}O3wCYyvaFFD9;`qj}`KhayhE73+d-00c}V{^z-B{W<>hNWq&&T(?nLa z1DL4)62O6s0LeYk$aw$Mo~StPTG1(tvuV{O7v@*-$%J?fi|1e3Yf0DS`S& z)?VmU?K8=w{1=eCCR*AEr6u$IGdOPpBYlaTQg}Slm$bSQCe1! zTK8QUi{&kJdK%HKXq1(A7kZ98Djr*iNBiv|)Z-}u92yVB&H*kNKn)+pVZus4lPY1K zcqO2N&uFUqrU1rJ-PzmyVX2hrzAXqTi}M)3?UX8iGSmHXJ9Gy;ewdpCRaCCISvN1%w_cErl2G zaQr+fz^-82j0>Aa?=w_aAcV2`=ILzZ5v{L#`{= zJ~6F@F7aEaHrJ){oo6Xs^kLENLI%0^JB6v`*t>M6Gw!miZ&#D;R))X4bJ20^)_AOd z&73qM`vg*yUZ$`BBP84JLh3zvqR~dZ+p}pt!Ksm~!E~l0PacS>+7G((=-lKQn;ZT_Eo( zIC^3g0mJ5l=lwIQD41jV{LQjt=W2Ha`O1bQGoE&^3z%CHw!86Hzr&_Ubcc944JE}M zpjhjllpr{38%XTDtI$|uKeASrz;h(MN7q`h3z6zB;jy*LQVWO2*RD)`ZSIM+tMuI# z+T1s;UCk-PTmGl<7?@9$wBM2<+FRqPUilv8c^K&plF|E|nAmsW3kr0vMA}TSW51qu zeE0^D{)|*}dXrw3Y+Y|*;O7a^-ut$k1SSoZYw3aA;%;(aclS`|7(AA994@`7Ulkc$ zi$B+1JzU4gDkSy|!z~>>6>c0JNwv0{_+0GJW^^thl071CP{d|5zJPYQewAJO)@>yE8ckDS4T;Jp+7)ge?tPVAVeN1ymE9e~UB3TLdc!u6Ui3Nf zZ5H2V@x3Euc;_g;WwJT@6zPyJaq^v?i))!S9B%Qj=Y)W&>E`is=|@6eNk%`xVo?; zHUc2WRJbg56`*CinGYna0rZ)tTlhf21Hju7=hnhiv1fo#EpS`m>exSkz5;6s z*Tg;o;sUqxfrPJt5`ndRAR(tmmenM1N8v`ke@jwcm)CP6b-YuJW0E1-y=C$19eSkc zoRQS&Gd|1#{@8~pgA@h(6UWu zS$`6sskIc$ik%N^kOXEFw8kz4{vt55U`gy+;2nWk1ttx<9P;*MFrbprNHSDvbbP-tU8EuV!@8V zlYlEFWJv+16fMwNp``_!OU#Eh3Y}EIxx`XP%X)Hw6B>Lbq(wTVzzq#PA9__ZPc6s` z4ZaxqPUy6PcxdpIke2H7f{~%YH$y!q5VowKBsBOQNQ-|)K}BfrLy%VVnFV!xh65TR znr9U>hX%g~sY%Z+m>e4XH8e-U&MBA`8a$NN_KwiG1+AgMW1s^jLgy7Mp_~CNFIdI| z(4S`IbpY)&`+`<{?L7_rKeh@?|aMYf{P= z(JQh06vUpw^92&SFDqJG)=@f{vXc6(edM0>5G&dnci@$Dm{}ovkAm2aAiF)eMjNrd z?6x1hGB<$!bho_%7(hQ77J#9Hj0#{cT7G2!E={^AfPu8tsR6_awhf*gz#wT{O9L7# zP3GKy_NF25{dbC+W~Nv48n)o(eS{)UXcxquz@rr~giF{QL?2pE!ubbXGA(v5knbPh z=H=1FmfQOk#4J2&ZyMKMFkby|7@S* zS(@W=$*~f>uw7LU+vPO>?UL2x_z~w(ntcs9%7>FQliC7i`o|?HS;_k!2zj9$_mU9a z|Buk0LgWo>R`lDHK!6MZCGf)e)sP1?bld9YdxWT5@&#X|5;)WV)W^4k4lSu zNP6r;v3>{@Z3>6c-ns-(!l2Rz&=F=djjvw-V+wfd?g#C2{6=%!Avqp|Uf3>A%W-Ua zj^oHN+1xAAbF3`jwCG^Q&9urG53>Kk&09pe``QN-#Oi~B97wvy0y=bzq)QwJ=vhK> zK^`{b^m@B@gq0Jo!Dc!Xraz_YX=gpQGs5=NF__`YXugJ)~lP z`wy%XUIz|kPikhN=;b>mTti{l~7{b08&>x2YY1(w)u zR&PJ4YPiC7XZOjn{yB~C8o0_n=pOhtBHFcZIJDPh`=AE{QJsnmqCW+qBUCg1(QARI zUPb*8eHw@wRMZdAcY&x;MSCLpEf6)SXb(hv`uc^Kpdts+z(6!nMY|&^3`ET;>WfG| za`Ky$ev*p%Ad*kZspv=*^+r@0L_A7GyNT8je#E0ywCiTum6O@nbZX`pM7(`y4YAY+ z$HH&ft~}>?w1g+%t+p%g)|PH$Pli9VU3tB>@)UTR?e<{EQ=STcX1gcu;UAw&gSXr6 zsR2)izqQ@vu=G&71>Rx1R|Y%-{=s(T<=GlO6aLY5R!mSw%T z06rOZv)wCU8LRD6;Jj@2R`_)ZKNXH=yZ?fO3c7KHLS&05JxFp-{ zN~hEv<{5BBw%ZrpDB)+qb=g+G*XWuhwrzu{2kpX;PmiBfVn2wG**Fi=8EB#wXcL;2{xN+z_Ef?fs>8gU274%8l0tHbYCQR4cO`y zGW_Y?+iL}B_1yf@FT7s|(`uww?{f_5H^ZyKd;KPT#l9YJMiDjS)Zk`0Q*iktHg4ET zy%y;f)K-Vx^AK;5EN_LEb#Yh1+H-Cbj<{C_yaqlyqCMfz<2k>&9bO)B?<8Dne=Qt| zx{m~W2i!gCz6h%|?u2ur?myu-rOfxjPSh{+T>?K7WI5fa_>i+ZZk96$*S6du{%Aei zhngGJ-u8`@`F^-0n)YMGLszwCW`GY8$ zYp){Gw-!=aL}i|fet}@vn?$l@ zH1TtfhH1U|hfxWx{WKBvbw*m}&p>G}ZhaOE>+c4hm*Hj;7%|C{qQ8J?&GR{sXHO=R zHotTwH{Sn_f7rF;6J3n2-?2<)FNN&qQ8b?*{cZ|X{sLr~N_uO&{V85#@h?n~WRatKduKQpOSu zeGS}V_63;$@hujVD{Sv+no*Z(Yg8w4?Pk2_yeF=U?_*1ww z2r8_$dzw|YE^#$uMD~JInp)>{}Nsma*NPE zM|eBDI^@a+Gp`o@3SJX(<&&8Y3x5r-3%Q4&zghSjczwt{9M<%|g*S%W`hdTKsk{6y zX>zOVhae+gvAp(9+Q@pyd)!>x{|0cSHDoZC5k2!E+U+oWUg!UWwWJk2RCx6V>?u61 zf&2RYBirfr^1kReKdImgmbKTCZ2j@#s-1-R!5cDzdH$ol(EF&(2knJvpJn`|eMk?g z&x-DfJ7jm9{9UNBT>BiUp%vV!(P8^st)Xki_;?-|HenPsbU7F?QBa>0{~gE%WIBnZ zYE7S)cdlbm8@3$;P9t8+IR-c6%*4%d7U0^>Qrxg} z4sN!y5;w=%?>LsdGg%(mhZ51Bj(DQla_%MEayH?HoDXrcoS$%QXSdxYjeT*mol@K! z=NQ~B&LZ51a{+GDS&Q4%*@WB8`53pm^DAx-r>~R6D;o-Mdpec4xy}^aUe3w5yE>QQ z?&jQ!+uL~&w~w<8x36PSyxpDtvW9gI#NETG!`;)04q!=}|2b>f)%M@HZ)-Lqo*>KI zmmzPV@|LU;UjgfkEb4zlZf^#!;Z5U2tg{2HNHEX57T{6fNK-^lew`8DJ{sh#OG=fE7o@oY)1V?~zGZQQo+#eiiP5_S)JOC^)7lB$q2Z9y4;?;%O zNU$z-k;P!M**emHCh{O~vbmnPdLQRtu+`iHY9U8~OU&Z|9s({iFM#@1@rwyjTWqbEWA#Bo|l? z<}$pat!5kxI}G2j?qJ5jc?{pM?no-&c*spQib{B7$XyiVb~s$Zmo4D$E+vWaa7D{FnoBQf308Cvf>ayw zg(F2M;i}2`PkSYO;6)t1f73qX6wrGzMk>pSo&o2dL%||;Ed?{D;?=RV4)PkL*6I-; zck$Mt?v;+WOi{+@lM;UlR~xnmOZ;Q{`&;R~C4So4waSWqF1oU}n{4016Vv8WT8`dX zUMJ5_ry9~9!H8LR1QvXNB<=+rb2Rbp;%>NoALyEsKy8!vgL!5qIOI4&9{}U#OmM2; zgWyOLVZXQS1n?oS#4HEZ*z3Ux^8=?eGJo0|z&ewBlj_4@vw41s|5LI@z)8G6oH7h~ z2q*t|GKt&U5gU0vaDe3Z6=azP1{lS!!HB*EPw^WtS05%){1$YKtZa%T?suSTWMNYw z_-`y ze}pVEX>Wd$S7l^9Z0@bNse9odLa2mCE0fI`+?+Jm4xl$e+827RASr3I|9kSRgz^FXAkfT_Pt6% zcJXe3WQR)lIEouceozT7fjA(L{HT(gaPh=I@{>xk!^N$E`5dE_FgFq5eNtf*69|K92N^-J`9phh@t&;5Q;$eX# ztdekc@nL}^TP1dOaa|zEQAt*I@vK17MJ1u^;!^`jL?u>s@yb9FRY{ke;_CuQSC!=C z6yF(0x~U{Pr}*JO(p@FtoZ@E#Ne`9SImMd;$u26%$|-&?kn~hZD5v=IK$5ExE2sGT zK+;PkUAh$SxtCuXyQ(CoOYz=;WH*&$cPWkslHMu_cPSnjNcyP6?owP5NcyTIt4nc3 zAlY3dp)SRBfkbZ0W3Mj7&4FYOm2`;|&k7`asw5{;yd;qHQ%QED_`E>UUnSv4@nwNz zfJ*F0@#;WgRFV}bz9W$ArIJvj_`yKps>F&EzaB^is-#P__@h7)Q%O#=_`5(dNF~|P z;*jgt;b4`7qs2V}$=)ilqs4m!lK)XjRXv5!k~#0qR@9Mu5ARO`tx#zCYO8Yz~wU00*0`puYd< zKyYvKuRwVum}kBN50h!M7#!Ju1h*{ggYb?Tkfnc(#ek~6pF0?-Wp)d2l;RgWjWtW+ zj1er!vJc^J@nDp67il+yXaViO0#jSy)LL}kz{3}I*;M72+3c;afd4Sd6 zVZ6-`cI`UAe9z86E9nTxGOGj4dN9k}7GMKto4Y|ZS0flU>%pb_u`y}_dz&W%Q;+r!i~j_&OsXWv`_-G= z2=E>m@>aOh28??eYK~;%Vy}fI10T&tq?LpQS}$1CPBWf28y< zkG(nBA?rE`d8BYK-~Ynr6<+UH|3+o@Qs?{4av4pT!QB5wnEwd5IreORmuIAGmr9Dq zLA=P3TVA>$Iv$K*e}abHiH^M%pB~kQt-NgrBKF;dvA^Sy9PN9!pf>|pR~Y8w_JKYX zFl%o)!g*?FtmY)k8vhmgPjfR>?(_XBSwAzBoa{vu>?joL>}&3(U=lhCnSCvk_8G71 zz>?G+_Q}hlbD8%KmTgV{6;5|NmNO7Hb)H|(dK-Pnig4_SGyKQ+hpvbeyiFuK ze?>08kw6|Q1VvJ?!Wxuo@4F)Q5m%#6RPRSJp97lAuoe8??+2*=i6|GM%!@=< z#P$kO9=?Jby~9gsAQFCnCRVf}7NT&P*a#9!D(^3ejbCY5vqkwZRXz|y1j-{(-W|}K ziz)L(qIb}W?)!vsV+HI#ZxYENT8x8N#GVa`F^XbPkbQ{!v}lx~5wS~F#P$o48=YQ| zF)PAWY(Y<61R}~~HMz1CvAcN2R`V{`2sbk?(qCirm)v5$gJoV-27)qqr`4p#AS>^U8mqC zh@F3s`UEgb5190R?nE$Rt{lWK^yD&{LEgKJ^2vgeK*!t-UL<%V=$eN>-OL{aroA%s zXfV$2KhX5LMY7ylME{AUWd!%_C6BhIOD~s5QW>65zA?-9e^pgK()cLeUh*)h6_tyM zK9khfV6SrCM3_JMe`H*HkUC7g%=971GJpTVvg9U^y&lZfXX150-2ghNhwdK+`x|)# zT8;Av9@lK)SR`>0Rq!atA>=Fm*!>t7H&cG_@o}((^KUfsYbc0oKiNh>)?XA%oseas zglOge8H||SK$#cqr@&nE-0_xmr)2ds$PKkW;_p|2PDRLm5RvJRUk_p)g7^SM5Pdxu z(Yy{kndlq9Tq7T@*Tf$NTg{v$46Bcj*CXH(vmbFwMfp*1nUODm)(SobZgu6djuLzv zETQ5gSDl!6L$=(W3;dE|;FtRV{^S*%L*)Fk_m?C1=c$=grM>`p6OCTTi=g)mL0{sC5)jU)UcwpYPA z^8%<35WEI9o3}u12wT9(=Cc4_2dA5|jcgj;VeWYYoMoDlzc>I}&Ce)nGkFVaGkv&L z#kavlW@LcxfQ!xH0lo{KXeI@?6c_#P`SYZ}}YX!dr>&)-K7X`lqo6Tx) ztKh%E$>u@uC&BN*S>`#g;4E+l*lOf1VY%QB;1Y8=c!J=M;4&lk6!j8*0+*X^ulS)q zgDZ{PAzdZPzksWZ+(5ls@K9?+Z^3xt|BTJ3K4o{s`}O9^nq$8glo{=ccjn9`KToI~IOacu#m) z$ZZJ1`@zdY?guo0mnFPEyfWktdXeY6ga^Q@LhfYryDf(eygKBT7y7&xyoS3B0lVAoqMvKPtQ8E)txeGayw zFX9gCNq3CC-XUD?$b6|v-{R(1p)}Io#8hUIPyhV|vP|;fzvsYQ{j{t;yZBeo)w`TJ zgZ>R1Y?4ndJ`d)ZJaN?hv`O=;roHR`jFx0&lA-*JMR4#;J@1B}kuQNLk5y z364x=R&+#%I9|~X?;utCPey1(TX2WUiPt+^t39YHy10Yxd8)QT)Z}+=AB)=FRncoZ zsCmy&+=sMd?RX*2cM{?q8GO=7h}Vun43`~KoBJ~}ZM0wekhHrw`?n8~=D_|BVR}t| z_9b`TWns+qXX^Jl37Hi=9XEdlqiUX=V7;vG^?ntZJsGl0B_X;roC4;WVT1h7bxj2w z(?F;$FQ$Qen4>_+&z=stR^A9W*WR`^_0!CMuC-!k@_q<82Dd+5%ijOD_9c_%#Pjcr z=pC!XTT%}rB>fsaX;}xUSeoB|b&`sdHu(MP&Vnx?fKOxN=J#NF3E8umkWCg|z1HI( z!q;~a{dtY~GVYMqB>J7qCcI@>qRY=>_mYX{Y>BRi82U8%IiPEl$U}2=WFJo z61L}xU?fRfPJ>*sGY>b*S&nNvH{yn!hj6o~eTW)y3UQ-OEpAsU`aG$p z|7OE$eIKYaHGX^5^aIk4MwZXm`-85-tl2TR5Sibi55&7)IZlKb)&4}TPv?SU3f_3( z6<~TNX)Q%&MNh*Wau!a00qNw~zbB!TtrW56GFOyZ}YFk^Qaw z&nR8QzEfhwgIITItW%a-))t9%HyGjhSNs}_N59@6R-Jvc#FAdy?*i10(O9<)iFQe@J)6JgWTgG1oX3e&KiH>j zcy^qj-YiD}-v7Tc9YvN7K-S ziudtoVAc5~wM39_Ewu61yg1x{LDwQxO1=wiG03+Ts1?1!6TygOUMGi@lE!JGUE%=6Fq_P7+Jlv4?I|3D6_ zV7a$=Ie$}0ULjJ;9FNvm(Yj8xBKDP{l`O|qB28s{H5g81d<~eL%J^C^$1*39pX6j^BJz~WJ{nk2)B#1pWNP@h}Ry6@}4p#520m+?MjJz1_73{3YXafH_Lfh zRGlwz!%lY;`7C22155q}{B`!DcVfO{X)M>sVDlKnN4p5QcqRBaIMUn&YRh~AtVq4p zcq3S8qEr&GZx(6t zE3dbRH1(C&TR}$He}8OQxl*J%G?Htt2_og5Kz_F;BPp&0b4g`1Mbj>J7lJ(V0@J%* z$lc)3RMWl(%-3$A-BKpzLg<~Blg zsCWX5m^%X82=Zk5uaela2*dVF7Dwi>fA}N*EXW%SzKBv8vq3(2HH3vt}kjGiyLp^<$FtB$FJZ^tCudtBf# z3DG@eYImb|nY?}MTkRuCQ|t8=GAsIT-25Xs>>6yB%0>;PGWzs~radQ$ui$h+&;_cAWz zO)!$W#qbu`-DD9@%kwta!|VnYit;<4zj64Q+YVuSGXm!|yq5DZF0JZ7^!oNH#qH&t z{yahHqSf$_dYt@H(u&yka-HVH`}uI}(_F}Xdevpe5)@h~Mh=zFS3hTs*4U`D@A;Ns9YADq5Dr6mt~b-t0HLw z<)2G7_kT=$E9w%dtcqJfp*Amfjnbx3m3<=-yQM|! zmWtR-Bjy~4Mh}g+&ncwQUAkz6cPYDT?o6frzvd57II^e2*d#%GaLKZ?DmF>7;|~O7 z#t!{e&f~_QUUd#QZc`EtYu-u6+@wn(sSUZ{Vr=7tTge+0di9SGHw+FDhA=lgyP+ z4?INI*L}$mTu#}T1s(L5r&cze$E9aL8>Q%z5GR+{Rz4AqfmrKuj5rn)slb;~(vs&mp*w`8a; zVYMp%R!dpurK!G@u4>iI;0m1cJ>3fagwE*6buB!n3Ts$p!F2Q5fU5~rO zkFrCe{H`}q?m$}mplB{f^GWgCf#+{{>MK|$%0E`kR>Kw~{Hqg_wfX_edy&i|Qp%L! zULdv@u1*ZM(pSu7F@*t9Oqx$kv(*n*(@amh+^yLiO|$Gm$-WaSZplz}FHTcUx8h3~ zsvG%1iTu+7q+4-QhU(-i(p1x}xG_W3y2?|{u;Ti3RnLm6z0S){B-4uBcJZw^3{T36 z*0o;pomue+G}Vf2c+`q7`Pvy)+~EhP6(4JF#Vd%Nw4!sJm*38;ILi;uu;Qk0M=M5d z@RG{tiyJdk*W8q*nr_AQ8LAbxrm3b|ab1S$wl!(0=~i5mp}L%hALL(#6<4RLdREN4 z+tcmLikqoR?Tg>zNm+5ZAEh%Z?%C6~;vsm{ip}?U8Dv;-nIE85e4@P-Clfnq#nryz z&aAlI56`gTI=iD4SKjLtCc}zrGF0O{MBnWthkQvrpmw0tavSTsaD*GCuPOljT*!1%!(hNseLhr;ZLo&)z{9j zV&q9L8MWe*?X5V3*hwqq`HDNU;u1eR!-}i2I$F_r%F8puiYqfz*FTe{nr_AA8LG{H zNmEU?;<60Y9e+(zO}FBXP{*>adcjl8u;TV~RnLkeIUkUJomp`Pb*WbT9iEgGSNTyo zv*Mj-suf?vqgI^7DTVw?x1ug(ESa_c99XaVYa-}krVsOE(t_*!*gLbJ#i57%%dp_G z^h?$0b2XdUq-y%gW{1_W0!y}}sis?Sdxq-PH_}woEx0X1b=li#s_7QonxX1$^;9z~ zxFucHv*5<}J>AYMSWjK51sCB-Sup;A7iBwtSlQI3)-|ipQ~N!FN9@NxZ*3~p`Z8Mm zE`L*N(?_A?+H{?$ur{4Ztke?cpOBbS*QPEYYtswE9oMED+vwV~oF%EQO`m1?+F`*t zxvy93j6S%0myQpC zmaghqaM>VFw=)ag8u2ao7d$BoZuO&d)(1aBQ*GEY>i5BQgS`y$_|tA}y2TIZY;9Ud z>|{UO;VbT}A6D$`<&e=2cXaPqiQCxK$-fLMZqHC%E)Ti}s_9nTmZ6%rUz%#V6}M)n zZYoGqO}FBf4AohMo@#~_UrJZ?tQg_OkNm6Pf5#oheCksB;l+4TR-ENW>CB1`ps7~e zf=5TvkvuIR|1zvN*$?P!ZTb_jlU7{jEAGsSFZtmaR@~aHqZM0=y~1QzaZ843?x-}? zbSu7;p}OwSG}Uw~Zpu)t8=a<_ZpDoms@qFF)eI}HPgnJ!Ka4xa{b(N=#qbtjSPy`8~Y+(^S)~xH?01GEBnVxEf z6_=;0dRAOL+tcmLiqBD(I--7#CuK$JI4??PR?O}0Td@d_TJa@cJKc)9Hr+0(k<{9B z0ugj=x)e{+g3j??UOThkEI&NMf~z7OEf|^SC6&<+S7xZLX-!j2x8U*&)ry5_s_7P7 zmZ7?BQJQMH1$T7mSk~oBJk<;fZckVBESPt)r`wqYAEYkTg0JIAS#Xsf#kXME+Vp4i zv={E>pSfw;arTY!Z>9fto&R?h`-#r}E%W8;{J)b~=*quM{@=V^JznYm-Q@p`?B>a5 z`G2?gf0y+3ZP7? zEB=q_bNi{OG}C=6U-syKTi@$_yEp$I*TWLO-7fe4uJqeMdRfIE@$>z^&Ocbncg!#E z|EK(dO-sl8w)y$}f9*%jeLJS?@eY5?{@>QOHMMm{LEC~U(^`h%8#c`vW+mp#p4KvN zVT(0w)|3TSA~CwYe)Ob7L*iN;BF<%xvVvbbel+d`{tX={r$dtRG0cgm6kk_EF{ z7Fx4frnFj97R*e{Ro6ZKYQMEYvJsZS}Z@m+4G1oQ*>vyOye4W#Jojw7h2OL zYwrr$l_`-pzGcC@mN|(3JyKdnfeh=?qu zX-hA65*KzBVb1J@Z99{b8fFz+B<9SYfBd4>M9Z9(xhh*Qd)~~ci)N75!j=V#TU0ia ze5Wm1umEEw+NLZ#UWKg-=1*-wZOU~2BE1UnjaXFJQE3tBwaa1p?1j^&ESTO-ws6tZ zxwG4>F?C}T^wTX$N$Co$N1%k1)^`+&3Y{o*VzC{>$VPes|=`AxbIOa~1&X_Z0 zW;?+`8soh7qN#J{Pi?0&WA>buc{Gg-VM?GaeBziy!=##03RzQb1u(j*$~tku?6#Jv zQ>GoCSh#fFw8Y%`(`h@^wPj6J<%x#I(T(Mas>%uF?IoqP)s;2l+RMh(W{8?7Vl~!}rdI09$I1W7hQ{*xG*MGcC&Ie&dMY?mS>-#AQCnADla{n< zmsZs_ly?-4E-ULODl4zDbU@KQdtys5>af*)LW=$O3SX$u?P1WU%qtkhO`6SHNSUGl5x-?N!Z=E=$ZQ88F zy!majXUv{9MSGCjlDltI&2;)&3Q{F+? zP+C!5mME=i=u|$sw6TL+E254@(J`R8%@gRVU z=nzshu`y9u(}}RQsbfJzwYj>oqgZMtQCpXBo#S_2jPJsZ z?6hXmt|~#B>}VD#Z$tUG1FC9EM^|-7x2m$fG(oQ|FYFM|FrJ>%)KFemTi@|Q$5z!& zOq5kNG?bS%)^^M+D9faV(#DRNwZDkO#QMs{(POGQUVo4R)mdBDF>k2@886y5yoSd5 zrqaevD!;tBV**tT)g2>`PgK>`j%WCl$%65oDNW{f$-*xSeO6k>xcc%2&%EjK^3KKD z97^lU841&qYS&7rWZEdhC2G|PhKL5gPqh!2P+nhF>30-A=d_lCF6|}JiINn1L}E;3 zO<8&gM0!A{(h)Mm)L_+2^_>KaNYvFfGg?j?1sY@^(U!*C*$@b%F3KC*Q%0uf(0i(@YirUK zeNjj4#!@CHVg#xIXXw=>#x#u`%b?(wU96BEaZKabL}jw%9(7Ely1Y7wj<;iIeOYZy z)g;L#P)bQMbtl%h*Yvof9`iCyCE*uNMpfBUBnMTooUVz|78prc#ps3#ZE#76?!elM zbP3RzTo!z~An^8W9b$RK%FMwpZzlJS43-Wv8ntl89GT{}TnOP-Fma`Xn>n)-wY8?2M&%bq|MFNp-RJoS)hY)-J}vQkt# zJ`Kh+HB7SRwX{udS)Ab0^rfTy-a{BRb!E_1r&-E!u~IhZ zI*)Z0R9;$9i_ts8liC|oRoTFXsAEt=MN?y0?Zg^c0?FjqF41HlYnPqJlxyfLc11ac z9K$;Fzl6$6nUT8G*}`dU7-{}I&bZj_Ta{E=BkTWqhW*NMl{K`_l&HSEu4+;mOZ?es zu@lp0FW_KIkB?e8Amik0+JdF6ZS7>!TQX&Gc-Bs7am#|)GnTd!&2Md4pu1VCp&>E0 zzPw!iHr4oRSGhRaoVUW2Jw%GUAhtAVp^c@~S0lT~BSfC4KBBI^versU+0Zu8OVe2v z4ss|FL`0=pcIR?hk}hPFN%0s4i18`(GAkX^&{0%R8Iy^4TI~xI6tkmNd1G2`^|h?O zRI{TRo0yCY8b`O!Vr*l_SgbZXiWwV@Y~|QmdU}G>%|)%=_@oONtzMbSt@fCx zn5aW>?O3XGbeYZpI+A8c)yS#HOknIfYO8eF=?`nu=Fgowg(FV}Lk8dRiL$y%j&a9U zmRD)Qb+iO;HKL>Tf7PlS%XX@~nS;&6oWLBPnBF?OwIwlQcFUaUa?sey!JBu5K}sy5 zWI1vOOwuShWCo0G zYOL)H8QqYUbj!jMXUoAKV=hPHa$=h-7gM0WC@-t8t?NWw-dtK4F}u^$By7S?!X{MKH#Y687)>>tu9YP(N?Rr;`HSZ-T42$R z8yUvruy}leGb~w*vB;8EUsFDAXThpXB{F(2ri~q4S=Cfu{vVZDAxS;4LiA>;ohgrD z0Bfim$5hYey^)Sk**Ixuy0X;Mb?QzoLIYX-HL$?niAs4nlS1`>)}h#yW9sQ!466U- zQtM<|X5U)I;Rv-^T3%j8#qT8VT1H@2OpUzTcvhSAZyn`ZmbCdx^~`8ZV|?rAGFQ&| zYsjvQRdJ~-{QqMFZ{69*NLpIX*#BR&YosaEvEh=d;2r@Ux%B@UtyYc}+m$Ne-C~k4 zT@g=BUf zUDjFS51Ij)*Oyn<(p|@nZmR069R(GjEsL>o_B^>;_a91D#o2Ia150kNIDQQzbm^!S z^Zz0;=gqqE{NHCQy@yUWjy(#aQB%Wz$#iUKLK+X-JgGv->p$C!i>znWo)Kl|4M^*c z-5j^D<|O9MUN~3oYW;^&jcKS%aOOy_scEVnLm%aAC73D_H0j#<|8z|fo7G!WolGX& z(PHc={|~KuDoZQbvrshd*8M+>z1emgN0N4%k8&QNG&H;Vl9E^|{w0Yjl2TRwH@Pq) zMF0tAVj%nJ&)%PzM?`{9pR*Q;^eKEaH@C^n&o0oGe*Rzj#woI_{Le7x05Xaf9(@l_ zIpM!QpQ@9iWAvz-{T^F`vEo1z%o}7WTG~b0mnoe2i+qUkY1p@ypZ6Fa3ggJS=9_kaKE+yDH}XHx(AU*9}Q{psZ||MksZo~Hi% z{vS`u{quXMi-T4?s(*rEJWT!TU%vk8pHI@>{hya#ef5|Bc#=vl|N5W*^)&U(_b?pL z%m+=qeEVPDeDl?l#JBH%`gZ-aQ-6Q;(@$uvUj1WrxAh9s+4 z4fqEIG8E)xEHG|3Ay>DzyR(N%sJvt)(a;*}m{SR!A#s{3*_$ z>#GZL?`j&YRf0p zL&@wlt*veo+TWg?s2N`!o&M3^-6C4R^5c=e=VwQE_Ymk~6eEr@{_=4>V(8e}_NR0F z;p*sSj!_aSe2!n=vK^*xFZNq4VD2_xk13HJVgB)Hb%E8-ZHCBveWKjShcoSw<{+uZ zpYP})X%!&lY`5ED1w>MZNITta8Q7_bBY1s(bq7La)>v|82aBCFgSE)T9jrsu!na!l zFpKEP?qm@=*Xn2)-<)q3QIPeXxtY6kbPQv5kb=z&7FAOV^zeL92T_1xcX!NMEUI~A zhPKS?)Jd3sz|Y1U<06J|U=4g=>lNg+XSDaMmlj`ptg`%nbho|UoV@s!b*&(h!n1KxPj@WJL~>>?=s$;Y94fQeL7oy!TbT!7>RxL zVx@J@o@W7&d49Y{?8$L*zFkoXMqjsE&lUhPi({drtZp93WF!cv&NrVJ{A9n?R&Dox zU168xp>Ue7v=UpL)57X{b+#JK?`eKxescDh#jTDv5G)wu++Ww)sUi)V=fMcS7-KU~&iT>x=IS%OA2wwp ziFKH=D@-*CBud(36Uam9x zw-OOyRX}606m!xkIj2sGEEdWN-`!(O*JfZ$4K`QI*fnNmnK11J*$^jAbeCds+#)N$ z8@a0)wPOrfD@bi~5};^60+!ELQ^Pecx1Ve9djbsZ7&tNLGyy%U`*mQ!B&$pwf(L;7 zaSC5{gBEz0;`eV26dBM0yZ9@-5Dl?b12`MzPWvPvAtnuqz0f5!^#st z$mlW1>(m9{gscP*VI9F{TZf%rq;RIMasmS8XH3b>&Dn`4zkUV74j!GHoFSe+)|_;+ zJ-Oqr>xQx4-EK=~F7NL|a4R;3J8?US@>j8h#AvbharWu$-Hv5s>&!*ZZovQ;V2Yc; z<<$hJ=Ja|GQrTmQs*&Odfans&^bk`-~y}fPRyS@)PZG=SRo3AOrFMmJO&t`qGEJGw^__a*^ zY}TW`qm!%EQ5Mis2P|-|+3k5o0VwS5S&J#o@dNzb^S2KeD2K8(rkh~ivo*8{Xgj?; zOFwS6`^_gLyH_dt8ARN1Mg^ug;*2*pV}z>FGV3?v#{Ap_v|v4$_RV*X7!Odpu{Ho)?Z=Z6x4L` zfoY+~Se;h)()zCc9zCW+vOV+ux&pD}ATl57VnjVw?~XQCv@-^9v_mdBVsw5-Wg`j( z9K-AY1+3D(V7BetLHGj4AYS|Vcy{#RFeT8vGw&1vAcblhQS9nWaHV&<`x}2ZxA#uo zX%AX4$#uZw`i4!vW#byyAFuXBo9^BC^LZ&2C{)QpG4J#<_Sl@t09Nzr= z9GoU@Il4aH)|$kV8}nMuxxf&|hbS2a9PU5wSz*(e zj>j3SzA*J4w*LK#k=Jf>eD5K4w-wR{njszPr(@w=m{F|PVJ%!Jg2&uI7*VSMTHq67 zU%o#c@SFUGx#V|u?0Jt}{T=YQzNn9`ulc^SvT+`+k4`W}gXTZ` z=pif-cYot40Cs?gI7)l#oFBFflwKU2d|o8D~UZOvGSs8-*4zzeiD=;XW%GUw^ z%MJGA8f8FLj_||v>TY|-KnYkQ^Gm3PVaT25@7brb6Mq>zINc1cixjr;8cjMw9@Jn6 zXI8%gm6rW$S^|}JyyM~q|0~8{hHO=dCnN~55jw??Df^=bf#Ckr!-|2J$?5<-BMg+D zU$Y(A(Ycktun_T)dc@8Ku>2p&!lhf~7SQ#^GwlIJm{Fe7XnxiwyR%ca*BN(B&P*yc z4pIgb!g+vj;U-1z3zdb%1J2#>ehOhF{jwKj?!}pBhRzI~C-FR~Re!L)2yTfSjUQmv z^^7acI~MO47>M%^-~wZf+$!12dUB0tj_(jttmHN6X{a9UI)GuN7f^dUX5cd{E~nLv zltR*TvgaCtur7IXzS#j^MJ+_&(->);Qq+wEfgu*8MoiO4@Mec-Ky*0JB6ABKP^8l( z^6fH=B@SIOXDN;`m1XY+9wVrIsws}Ze=f|7bVYn5_h-ks<;=!YOS2O!U){C za6__F=r*)=WfSFcR6XiUq-JW4OmDv z|4z2@48Q=#vhP_8uUkzPIu!4;bB4FB;lYb+xq$|RafR$+P;2K$xv26v)Xo{_<$iT` zi)^X@gR<8j8~Zh)*H>aU81Ai<*fgn@OER_{Pwwo8$j_(CX zczfk|;m7$oW}n^6rGqArXaLm&L$?oP_g!9TOdb|g@XPI2Dt;DPUQY7R3$y@ zGP}kp;6*Rc75o>iQ7sh(G7%tbk)*THu4xBh14{y>DCWOmW76yQk`(DD}XhZ1QfyAqArj>I-eT+QQc#w6C9I>4l+2qMT@ZXKb&OeW3AHXYJIXLk|Syk{%Z z-JL}A1D#eTKM+Cyg*_grLD6dgjW5WUhBOMe9^jp82?k&zTj}WPVjJ|#pR6gDQuDjH z`8vN%q{rMZ{DBDiR-ps{6bh6sgkBP3I&X6fJTOO;n9t=P91>YpU)@R%Ib*53dRw-F z6h|MY>>i?;qsTq6J^_~Zi(tUhImy^hx7Vm=!)EW!u8}01X1-**DHF6l12rHX@Qj9} zPCE*LTjbejWsAURw>ttVp>f&aFn$kbbdvgIq824s!CI!OrP1Pa&I=;Wk4NMz^&^QV?VjQ2V;GJND7Zs9M%1x0sD8q zJ3$|%5G@t$IZq*M3%&LCoc326*cR)mFpF`*Y%}WMt7I@Nu6H-`nwmC1SI``R?zavI z`6~OK@XdC24IPs(RH(mE1)__3WdfjWVEJBAKY=p!gnV9yZoQ^$sSS=!XT5=+xKv)f{m7Qmu-f4 z)z7V&UcADAW&8$>hv4~QNJvQ1GclpOb38J)sib`t}2`d8l8Uh!E$LYT`6rfQZE zo^g+iKhaVB)DCL_6Yw;fF4t;A^A%7iX?qC0sxv{56~Lw>A<~)3hN;|a7pWbgmDT?0 z>`cK$I+d_B*nZ`V{$=gET!k%{A>;!c6ezlJThBeE7gwhyog>%+I2Jia=iV8AK95ER zsDAn3C3wpkx4V;r8clRJ-Lu{1VD5o0;|HLZBzfFYy4f{7umJ z9#{qAt8-xE#wY}M|l^M zvMe!jqlDvhdywAdu!dME=C|m~DN(^Vqs-{X>hd0`S@n%e0`dCtD`s9(_-F1~j`ZJt2+Lb^ z%b-h(IWJ~7)TvFcuRoMD^A;~HBdlVL9R=hA_26`bNOrHOgW^wN-=cD7ZxD2P=dV(9qzSSftFJ!1VJ}SDOT)CUGffUKf-cg+af{ZlrZj@tpHtyfoK-j10!_@Kg*|DNLQH&B9#s-uH``q#j8{8F}%`%6*m%mDKVckNv zRYCS)S2pC_Ie1XajyST)>>;lXjI>c^nKsH%2JEu>zy)1-l!{grml)qDE&8m`jegwb z&-w^epaOnUftM|I3^{x)P>fD>e8}#|hS&}^>#?LE@jV4^KERMP@(16q(~SL`BJd|D zg(c7FC?;WeOvfPEXzF z4l#i_CxQA0yO)-4Aw7`8DB4P(5vWFv`f4dmeK<4Wi2O5{?u2_I-tIRmPWTqy+&T+v zw<3?jqeuoK$h7frVc@$WFO#C&0+g~xHLb;1W>JD6a(OFW=g4Y8z_>#mgh3jfx>rEC zdW1oG{0NU_kIUTR{OTU1ZG}Cf$)*L4Pm)WfTVWvm6m#!T%o##W;6Ai+VTPQs>Qm5= zx)B}`ZCDMT_HXMcMoe-D1JXy&nbRXVZKx0g69{UMV>O1*0j|pvsAO10|7HEyA2jEDJYR9ha|>2 zh(7x0Gib@LfLxa^sH?}6@cm60m<-spY^E(=r58oJ;;acnJ7F@Q)lG!G(H^XpXU&`^ zJ1bGWwWFt6!aLWciCOeSBtx(e$7}0EB z7lUb%Hr-$bcApTME{TxUYutDIhFv}PoAF=5o%T0>fAyBjcHC#4a=8BF6%gGi%!$9e zdG&7`WmS#T2BwSHFl01}UJ1b==O1>XRk*0%VZ?`qsjN!Dpda9QF3z_2?nBOc1l6zH zveCP%8GA0oiX%r@2&29pN!_3B%TyQkP{P9Y!$un^=b%cAPDfbHPSa(J`>U~*!HE7e z`R~S~I)|GD3Nyy6U-ny7yxHDe9ixoDn@~9RT_!Oxv~4JGZoPAqAU)&^@pb`#s{cJ& z7bTuQX4gW+Z8hLjj}Q}Hj0lb%kb7hqJ59oOA&I9RrwZXKZ~^MK;z|f-jryX5vrp0$ z!@|iH<7buG(<5MI7}&;+pixJ%JV(Q07TOubn_rz1L+)!`MFUuzqDtm({?tfCS2$3d z3LqrByaJExaCMTPd$9Odl;zg79DJ?5gZG>m{|-Sga?m?~r0L90@2o#PDV z!aYbEiT)Kdqn6Y+ZahL=s(^X`Tdm|cN_t^ym0?gYq5=zzC5)weMX)2(NTwr$oQ8LP zEJc^D?BIYDaZZ_Q*sW;rN@Uw4_^t$~tH{<|+$lW-NbiYQ5ZCrlA<_M%{o1kzd!~n0 zvXN=O0Z=j}KfL*w8<{#qdW(0aH+Uk#UDPs>3w_+GJ4pH$cg)}X>)k=x-`@SiH9im& zx36%Kv#eptdi6_gUOt!iJGVa;J;7VZ`=_nqfMm^`)b-zf`VIFo<$`7T&1>!v{uqyK z>+k<|*x|T&$ZTcIJqJ?xi3_o8I}SqBr^-E`m=6<>A6!KbHOjaT?;6K)q55}k6X}_( zu_n>aDRRe?;EtyC`W_ufqej|qf;X-l!Eibb{bj>*D;+ibgb!>HNbkm*p9%l3^&C1npyP5Q9dklyD8E3~2~eAZ&wN81{LH6AHdYz_{N0k8_1X6${= z(IB!zLZx?lF$1+}px471bO9N&3Dr+uXI=HatyfT+7gUr~Ll2f3d4D0BGOMuIQ z1sApZ6(}woTAy6G{s`0HWb@rzO|xw$@H40P*n>37*OiTV>hdG=fL8=Og0rej4uFB? z$LB8G#67C+%go+#vOwY^)t5LaLM&`(3B!K)Np~>Znq8M486NOWg7cQ6zM}19=DRn) zd0)2De)~lyp%yy5a>^nl3mI1QUSWrDVV!ltWyaFaHS0ULFT@R}a9G6!V7OX*Ci@e(mz^I1JqSIU5 zJXPB`T047>2N3pQ$09pb1tcGyDG811y;$@s_lQ0imwc`mL3QDX4>sGrqA~Pu$%}%t z*8A-_rj0c#QDz}#Dm&*Mi;3<6cl;xCgv6ZUM}5-_;Sr0iM>eJzT1S1KcFC--m6KY< zSk)+|OMtDU$7_NTK?MCyJrVagt)V8ix>ch7$RukFqt@Mg!5-@f{1UG5)|*SJ8R za^C%hi!5-{$kgl2(=^C?J)!TwG^64%Acbbg-~75=8B|4lAc8Z}wZR=MVrE)je?O|r zU1F$MHfy0Tpd5*5s}PX&wu-rydO~p(Z3ADKOec$~IWhW3EsLChM380EI!UG*Pom3@ zqC8<&-EcGEZp$TPl`^Z3SPjuDu*=(Qv@tq4Ga~E#s6SuE9SC8UB@K} zmljfj>H6mzz39ExeLc@$paHEUdA%~ePPL6P+N2hfUp&$zXAnzmbTjX>S4vKNs@bVX& zRxUDuDLoCsEGs8mX5b9@*$kXi{rJuUUqPfZ=9uby4`zl2*e(|>iRV|lF_jt21obwN z1=7jq9ARlPIS2JGQ^MLDb|Oh%EKcTWYID)=5e!qoPzqp4mDj6H!9uU1rvq8#K65wN zMX^t~Rb8O$)xLSp@H65gEo8`oz;9xMb7GDG5*v&JQP`lW0k5M%?805`H5#uDw)6ro zr|Xx$Oi~x4|B4HtMgEVk@Y?hmXGe$x7RkEzdYS}4_&&wcbi6Y`r7pgG{p&$hN@;%n zqJj6X*Y9Wpx$?`W751YbiyD9b8J~s9EI`RMM6Bx7w<#^&!*yUF4pDwIt`1r5{843h zKEde(`T#D1b83~CBFLKK7drQn>*F7p{kj~j=0T-5N4RDRdX6Y@26`H)&rGtm+c(^) zjVZYIa);RlEJ0m02$tNVZ01;zxt2L1%cK8#A^@$`9x|OmNnrj{+Bf4=bqD% zCD_2HzrKJO*p%RV49)~ECiftjR6}w+mnd$%X^|WvqibUTe_i8@<)F^-#X+5y8|$>9 z%sDfS+Jid0FwOl6CvluUYC)kQ%FRN?GYxoZD3zqT(TXWF(a}{5?X*3krcz!)s!PUc zKuEf40VG8j(HexZ0U8w?#2Qe5E$BZ>$O2*|XXRW+hIqx(2)f=1KyY9lL}3i3ETVOW zw*=99U@;hdF4m+BzC<*_s-;nLdPWckT{T#wv?n)Jo$!8lg%H!M{>@^(e)~_HS>ctc z9Y4N#`74eRpUL_AuQ24#qz}aK=UM-L?lWYpZ=Xwl`STCIzkV*`x8G|CLRICM0EtE< zgi{*~Yq*V40KM6o5PKk;1$f)!{s9V19}34;+%6)z%*?u`(v;2mOi^HBEagR-AF%>> zkj!93{cfITW7$WC1p+qbdz^G}$tXYBOa)ChU=z=U`tELnhX*SGFs&_R=3{+8Vmej0 zs@4_K6^U#4fpCH#h#X-!IW8wBJX{qRDV{6oLw1`PL3QkJFyaV+11nX17nm~NZ*h!b z0}%NKoeFPrq1u0BXVFGPt}Z#^ZHd1r5>42BU8lFSEKBQrr)XJ{RL!mJG!OJ52WXIk zcu1WRhm6ONZ}gg#f}zb^)px}s@O^krBu1$%(kp9Sq{?;cFv&#`(_8WYDv~14Lyj%< z+091#{_psQE+2^!_7d8MsZFOJCjN|%b>;U5-{aE{SAcl<|Hi^r9iQgv=Gqh-7H43_xX!kVuM4X@060&?bS5a)>;z^rP2YsN z*-Kodwm!SdMDn&6y7?f#$Z3u2M17WUtrFirtxpkS=toajrvkGni4LzWa4Qwv0aLgB z5f6Nj?zm9KHFDJ2&ghh^8VFx@@dViEb4ed82znf!AX+kaL=oTN5!=yDP3m1Mh}eLN z)ho`vivkqbU5Xa_>jZMvJJ}$9jJ5NeUI(!Yj5xfbZkb8_kVxB=WLlI3v;0@;Chl*b zSg=+T`rLIgL`WBUuaAB1Za!oCj%L!We3Q~21SWxaP&^SM*(7p(=O}LJ42)O03`?u6 z_3Zod2kYxwyi*8->fi?nrAGiT9s={TonYCqzB6-<4Pb8g^iMBm=N5q8NOP@j;qSDN zRM~1+^nqD;@X8|I5;F&Y0G881z)NTf6vT8I#AHG);2c`V>BY!eQ{-xl4E~ar09UYkRJ6)WLng}Jvpwf z1}RnWYJYZyp^`%$BKbr#Jgww%HM5x~_D zY6BcChorm0L(f#C+?f7WA7CJ4rDHvWatGgTPzu>zB~n6E+M*jFw{TQMr1v)k#-R;; zlW;@}K!vVBO^uN!COno!ky#H2X8RM=&~hl2jHqb^dm#FtV~ZxjNn?2~!vZ zP$UoYsoCNJ9n6R@)YOcUCgLFo3Ts+!oD?(HXUIW%csK^mmGv{+5#ZpYMCQs@?Lwyp z{5qVghl_CcTSyB}Wi{3H*fdFSwymkqe#i5pU|14Q?sg4Xt5Xec*bKm+c&YLx%018* z)l?tbB?Rwe%_}P?PUKs_7E)HKqoib*KDp6K$|wfdue4kE?seG*;0{`c+oa$?6mg8t z>lyo-4y70IAaVGl9MnBc;z#5VS^-+^5M<)b4*MncS!LdA=LGS>zHSlViUFL$hxC)} zY}L&TCd~fDeIizpFhOU#4CRI@x#;Vq<_f|}mN3MXvnmd>DQEz)t5S50MSM_bojOI! zcrb*Gm$zd1`!ubIGdjky^{rhe2*m@l z5)0CpY%w!--c@v#^5K}`^^_txWTZG4Lr_p&r2rf~G651U?3iAmQJyp0bu@#$$1Aq> zX@3@Xd!-;BkuaBMX~*-!mba3?aa})sant;n@tSuE{tM+%p#6O_{zkGZPbGiHEj-m@ven zW6OTZa-odpq?*c#fc}Ezh;DF4lK)+<1V)L_T+u4Vd@(pjP?J)p+MzfUATg9zc5bwh zkYQz?+m_5R47V|sg^asnOs=sa&gsnx=HkiH6uC5Y(rDZw5wt24T~>l(?n?B`f=WlW zAlp?l*^#K2rf|MX7r{zathkv2h%0=F3$-v*fy-$s-pp1Yt&SZRE z26x~vg&ELoN*@QrE^e6h;{S_>csp}y!A-P^Fe$-!aKn9wk4sov+xq^r5b<*jz?bHv-Z=G`PZ zs!V*Rvh*?+?xx!hSP0Bf9tRqCnQWzx!4PxO_zCEe3e2ZX>G2&NuprW@6Jboyd+kfB zhQGqa;i#`taHrDs&ozWyV0HB*rlGQxX2jyaD+P_h^Az#G^VHIo(}VpIdzNfU0xKhu zSAL($5-^1ilHjj#TXA#3+(Rc=42`mXYXH_*q2LHgOYR}UWVjU=6}Gv7CH%jf3t5&L zimmab&x?%$u8z=Bw1uI-oB0XPg>pgpF3zSH1TlYYSK7U!;;c#)JkM2pu%NdU zbW((RCLVqYo&jo5QfZMAc2O}yS#R(f13R0)AGk)ix(Zgi%U@Vs);i9(5_c3Sbc+k4 z^FalcK2>)JO$U-UZo;6~(UVMHIv=*p@yVN`S%`irbQbHsw-GK&B#{we@wE5Bt+^{CiLHG%3dF~y5y8IuPe zj!#8>30u$zANpf7O@bl=Qe1D>?2Tw(fnOyf6DTsHqHqWft_|exa>YC?Qkzq$)kn5w znb5mzW7!P{4o2cZq+lgi56@5AMUIB1f;i5vY@hT@CyjZo*C|>N*@YSdC{jsbFUx?T zj@mMHDvSwe%%L=pN$5L$3Dfw^nLet8Q6`1!l_Q+|R@fFp9^MOLF!-{1k;2;JhV*vD z0R`{8fmc-+Bs9b;*^N50F(C0j?MoB7)S8~-H%+H5-cK!l;#-A=_ozH>Zhk_ZTmw3?3gdrpOeP*Fr=~ z@x2i~sgigy5P$E8uAY>bld#Lc``Zy0MD-^lI*m{ylpb_5_kB_G!Yw_neE-(>U;WWj zM!Sc?9NJ7ppDz%j<%Up(Mqj z{hDZc#jL66H}?YuCTxkkkFc660rGQ|-!YWce_zK}c*q95!sA#fp5q)U5Xj8+u-l%p zqSDp~GWCO)`&U{&Qp!}gT)6pDW^AnHln9NFH+IF1&whg(#7U2wv$~p*wm{VjroEfN z?vTU7bx$%frYY3NCNhN6uh!PeQ^tKq0)G;+*L!|z*31Udda@2&Xx}fH)jkp$43?#uu)1Pr>{uB}#y3U%#f`+XoqZ7|U|4 z?F2Z^5;pWWMi&{A)d!G!V09R0R_V_uUu?&i24xF~s&Jg}hzlzW@G8`{NwZQ0;Zody zDl9GO_}DE(6;7OU26LQVZI79-N{c;V*d`qi#mp2Oj)_L(W!z$qso^4NMIT1X_U9ZY zvuGNe%4tp+rW;n#3KrDdDwyx$SDB2&FEa}@ra4%^KN*_F@k?8=F2Yr6kpR@%c-i)GVTpR6y_xfxh5%Qx$)%6l=rXtm%3pBnSa_d0ZGBeDp7gl zrIDzYz#CU$(uNEoN>BJ?H3b|M(Y|22g zB-T?>zzqV6-b`sF)Gd!_Q(|T!Cidms0tv+(7wWf|ATm>@->k=49V}|*Wd^x|-asEv zxvyDMJmz{y7yCP=t6($|*6=`?{fbTto9L4jR3v-2#3?1(^zdqT#<%AHaR4f0MsOG zDSY=uJq=Ed3o(q%;aJ@=o~dT+D2t^rzFAhutCmlq2mQdt{QciGZ(B6?jtAz;zG|81>enhS%L0JQ z=udB+R27I?mUseVixzs_7AX_xEGw8255`e*Qh9$i6%9*)<1a^o@Gi zZEaujB)S(z#008;O18MW_<9O`GljmLLjN&^rodN2kwh(DFT&p}!rv~!|FH;qI^mvWkejHP(#AY&hF*bbpltXh_NQDdts^=?k`{Jp%DDOlmuzT- zTgW?qarNz=WK0^0xh$9II2ng!|D0~01}}_gbbY6%zNzVDZu^~nJ`;-J`bkch`*O&< ztkPlT=}l#N^CxpMz6+=JO|=hqT1dIjtW*|Qo$GSIS-UV22VGwb%QxB%@)pDTA`fOovkPE|dx8gFbxwBh zK}N|{n)RM?>_D89K?PxyJlAE$0Ewvjr%!5Ul%*N^9M(hz zqYhIiz0{l>xCD6}BD#PpbsVNL&rx@RN$Jd@&qJH=B&lzzOpP&Q9UTd2b4f-Y1U9F* zPG={Il319_uJ1@0SUAXhFBR5*mwwb9xbpi>$h)!qX*-dK|p!#pj03 z6hEaP7AMT%LAuB&qoldrMV8+j9!-nPHfB0Fxw7!~TeGuy?&p!T!S$T?2cl2ZAzb^L zisyhh_I5jOR^h>EhmwBE6kzaUGuH4+T2h4jbQ0D+b0JuZswlM zv^sKQJ2hvu7Vic{?bLD8>W;#k#3h(7aTh!4f9r|1Y+4mO9pgxEG1}bl$l!*7mjb8O zM>+~Go-AL`5+kE*CZ_Tsl*-g$O7oRr?3Y+}kpBS+m~;L-Ls5^Cz&|h1=2OoX0GU2* z)#Z#G1_$aA0&{X|@OMb(g2s895{w7S`x!mbodWNPa=@OiO!v0JrIC5K51XIfj45Ob|(wlde*qwfnI#qFd zw(Mh1Z|U9-=HMXb=@cwCS_&Qv@fh!Hu1(y{%)Onr*vU4}%q}+>3RcK-Mc#*0N{F6J zZnU-~ga|W_00KeT%d)L@|;X^R!MCCGBl z4IeZOyY~;aKCUT7Nd(HM*zYIfKuent*<}eMeS1>DvAh=97%0Ymgf1PcA>^VxsvH|_ z*`<;TkS=dUPbte56tSul!%`3hm`q#@9AcY-NIHGS(n)Klul)11TC%lDQ>H^-(+Ya; zU~w?2K=xb*9rhJ%fVaAzQ?cqEsXPN2bAc{yY|2A8vB*no%1bx73oF%Fu&nj8E!&CeAL;SQ2D3lc#f&1x zVOFn@>SKd&4|Hzvl*66-zVr|cP8A=1TI-`|RUqYck}m?nCc_(wu?*T@aY}@1_RHjV zQ^q5Fs!HnUL&L$rRLfXe@p`hgG;s*`eM7~m%4=Q)P>SYrS1aIU><`UFp|7<2C@DFK zLxRsQh>2Tgi&C*av_lifR;Pf>T>N{Q1+x|Nq#lnu0^sDOIjqDuF0Z{m6Foqxi6@s> z5m&7!NUy-bnJ%A3)LTe;aLK7K6cdL%DeW^mmR-^Y!N4{O1prKPfiRHn^usC8)VYCg zfwBZObP zszfmK;}TUmZW;Nlwr99XMMKR4?j82wYxP$uszD3LEFO=pcw%_DHGEbZ3oalXuph>;skWTA zXIIwDh(et9P$J^!(q&cVNFTRuG%*_{80$oVd8&ku^{Sjw_@TNS=xs|6xBA$(uW7qHm4z-csv89c7BxtOEYGS3}p zc#h4nMY+m}6K@VEIJYv`OTQi6Vw&t;J?+D!t^T-M{ej_iEQU11QsG)>e7=Ig~? zUw~xM%Jwr|FYn?8J+eblY1P*@P{V3AuP$`+v>-_!V4`k@o6#w7sdRZ!CT148g4N(c ztuN>4!OL5nD*eUjQlspz8^R{eL(6E);&}Y4&3z5EUy20VCxzkeDW(-ftSFSWVmHr(qOFOeNatB7?9^15B*2xP2ksY~gu4{??6&yHmq(76yl`lT5k_qR}*(cb#a;MB2 zDw`9IPGE!QGWynYsL{MTc4gxq$j>@@8jTAr-8Y2he`v}qevQFj_e#mF4@DNbI7Aioyj@|Zi zS&ELxE*rylf0sL?YHetSsM}+71%7Jx+E561^b6qUQNUx=XXW5Hj~0(dBd|-YSCBTG z=~$@oo-srdh7hn%+THaI#TbRd8sPRtTW;q!&9ZQ0CY$`LTExEF&!m(E6~rBIWn)BqmOIXHJOh1xw|6C|63Lm#3LB!rYqJ zQ?UplD1@vq>m#mg^=7;1ldfbrqadV4&fKM`Z9Yl!^=3;CZhid7+Isdeu$!!RXINiBL-9RPA@94P1Q1@$+)EV}sgSThA znaAVt-Y8^KW*TUv-WcVTdIqisN6!MSzgA;z6Yv>I$P+xDT}l5^sevlZ2r{6if(Ro8 zV3x$;3Iyuf6bCm5*Ni&99yahrA-`=m((3F${YBKCB)J#F0Gifx5R+JcP00O_IhHMy zXx$3Gy$61nD17hGRZVG=0#CvdPFPpkECobZMkV9HdT=-ZlPcLZc=h?65$2`bI`8_~ z&pqCDrtf5F=ZLkA8nbe(JlR~2C9DTKtG=mdUZ3WCfW}Cl7lmS6ACQ1QPPeBB_ty~x zfl#oXni^Q&;?S=yN%$lbW?#}+d7(FGC_LWiO#ecz0CLt3XpFSBWOSmCS_gV~e5Gt< z!&>B}WV1)I?}2GvUxkt?ToLHH2zBiUIgX(~M?Z*M_>xnS@wu^x-E18u@2nnkU>f`g zLt{Uz+ECYRPto6xHhThQC3NaMSGlw zV0G?G$4MBY$axXJ#aS7^OMgI~nCv|Lsc@FWShZjb0*3R2R<)BIptZ;kxK1Fl1Xipi zH;|0gZ2+#^?oJ5~VP5euyqrQ)1aA49otQ&ITsoWrjK<=VUhU^R&u{U7V3c6H#LyCP8b22o57T}1MbKuwUFU>8uJy9a3GJiV9kebk zf>(Mfromd?@Hp+Fi_^f{XT$q1WIH#2FcQVD%{ZzSA5n!fmFhmj8#jywD3;-iZT50N zu+kF*aZ7~Yjb`hiCXKw^wcsS#Ad#)T{VsWxW zKpDHZf;IH1SSodMqL&rNW^aq4DwHjGsxMt$vk2+%IU?$15Is$33a@a>$oQ&ulwbJj zAth^{61mH${3tOPfJNTGEv-mXOWZ-=zNnbipZjrM-R?K;M?Ale?Yfo@Fp{vCn&DAL z^O%O3#q=(9=!uY9*6KcHOArbJlu)LwU#j;iL9Tag@J0X;jtP?lY1;)s2{0t+*6GA7 zj8Suu%G!WvqQq;x1w+(sT$G_&AB|*DKyLx(y_d(q-U@xwCd4QUDOFPO)LRuwICAn) zn>3^yhrdj?c!Wyj!U7*Jb7x|h&$7Nu8Ns>1-R7L?8q#7%(VMFHQsu9KJIgc&_IlKUO<1{~`3vQynx zI*<3Y`&@9=&k;mS_E}QC#&OI|J-)Ge|Grd9{=R&VrpXixnty%yK3_x^5N*xw`tEjq zH^SO@jF=a$F%!+>F{W6$?hAofEbn!DGf;iu45TBLLVI<89v?M6GQ!O?PGGORh_`Uql6Y$1oTwd4KBYk*(nD>Qyhlb0_ibA(@)J^97G^LV z_bl#l6LhTOote=S4WpL*jDTzIx2FYsUO$@Sq#^~+MR-)Z`xxum!$R;%EPj2};e(bpu4{cKY@#q5Ci1gI^@|_f3?fkSH zgo(otVS%DuGOcGZ{5i?4Y_%0&A&b zNp(}tA^PsMXJTOe8ul6vr3tg+s}Ee_MjpO$b%CTk!~67^r{tkRU@JcFBQSSC6X1x( zzb%AXTw+!pwty5*IG;`Xb8~xQCH$1Qy?EcDpNE1``+Eu4;u24~MC^~f8}A>gXB50S z%eZ72pLw-&&@>_D9N}F)Fs01O%i#uug%U?ASBh_|>gU}iy5A`Oyks^ubIXjdWrNw= zcL^vg=b;4L%hwe}C(>4t9qca4tUsay5MGRMI(?3M_<0@w+N;P6HhnI2U@m_$Jnr$N zvZ);3EQ*0*kLdlbJdw$Xht6y*+6F@03QoFGX=*?Sj}wk6O~*CrvHPMO#j;0;Dlmd`jU^}1lklVP+P zL7)PaVIpi5z?$AubBGt#qbAV5bN>;)PgUL5(}-43K>^m-`Mx|}M4QjfQjs`OSjGxa z$>?&>!#DUigZ(PalbC7FjZJ_>AUO0Jch~}G)D)WVr>L@y^wE>c?`Cq?*QD<6aHdm- zF$;y83PA-p3R+A|ClTTAY60srXS~P(DFMm@gmW#J7zha3SZFA;yT5|E=k%yrH7kgq zWIBr;a$4rh^0s^xJHLU#!q$cnl)%Y#lXkd4MV^@#*R;f)7U_iB(Awh;u?}U9CAcq5 zJ1S5d4H!0C6%9+wT`UU#kk)9-;ssSlpG0T*yd9v<#V~^5_>6+)tNMY+)@VdAPz)SO z@Fg@%bqDeER-$!X?<^m{gxu8_2`-k?Vf3ezLl!nE2mPG4=sc(N;v>uN?ryHM>x0Nu zQ*~e7GZJ>D9AjZ|W04e9w5&u}QY7nI>(OYxc%6B5hhSUBse)2P;e*?-7g~+20&CAP zdkI<_!97_0lki)H6u8%eNMddQ+5~GE^YJw=x5TO&4wRMOV7x&RlrDzo=JkUQoyA)P zlmp1fp^~g}XF;Z7n`8!dyUPrtoeYy&1mmcVgJW5AV?3=A5O3PrqHItpElg0xZ0v8Y zZ(mGp0-QIAO-)tG=Jo+w;=|gWO&P5}ym+SlO0>vytLI?!Nj01EY1vxMjfrL=mh=9^ z+?h%+s}{x(JOKW4R{MJEHfW;4U8eKzZ$6DhXUW&6$YFSW%&i1SbWyaGp9p@syF^pR zj0Nq6Xaxt%oZtj`1&q~|@fq{?trB3In*(MtQ8*7JWO@R1_t7LLq0(pzAml=@#BYGK z%6GbbNj^pj?4YCG1wqMJzv^y)lY=uJvK1$DBcDKdH#k4y#V}Z8&|Z@>zGoc5M!eS! zV}lhHYhCDxvtr(*Dr_nJy&0bPwj)sZTf?vr%~#(bqZ*)s06uOH?p?_{e6 zkKOMW2KaGGJ6(iF{_39YX$ZpYT798&B^r{Crbdv~M=(S0610mA!lE`&?pyK$ypk_hA6EXtstRqS;80a3oq99tNRymh5FYK;OkC8j$@Iu z?Psw6T%Q6x&7FKf!&T+@6-|HO*i>HH!SIX#qcol%2m3Pa@#TaXu%Ox3IbLVL=h_qr z6WSd4>oQOS*4$_Nuk*bXW!K$Y;Ypn${)Pi3pcltH<#P<_pBVBLc~>R2DFlxe19ya1 z$)e)OYoIlvzmZ*G-wlayKRg|ns}E9_@)fQ-DUI|f{*zK8f6vr*KPC%eP#|zS`aRk! zbwdrSD+PDK&STjCkAuZ_vleoK;J7Oh_3hE;Xh>s(2D^>eh@9GPwbMh&pf`3{9td2J)I#nY}4F`i@1>ZLj>$h=gz!=H@76E?= zRcX6kWS5iCl*7z6h|Mi_F^GCY9(UH1_zzwfPizHXSKZM^BNIE~q6sw2-Cto&Mh@bU zQEuuBe!uE{t19G;kE7jTKS#F#S!5)r2X3&^Oz}Z71U$}8F1KqovBLZLq+WlKcf13@ zPGI38Ig#Q_k^b_Sn=M#=?shOJ;Hg{Sf_Z4tGzAg5;s8r6^wZQFvdhF&Q;*$jZt|W3 z9+!iPIelw~6vlr%LPU>2N;XX;bv=?;Tu2>lbreICw!;|BabLEd9>kt+l%^FF7Pr@T zJmJLcxkd8%V>V&(o+jV2+4ZQf!SX|8Op)cO%je(N)-mFo)7_Hsz?-Yciw{me-(<9N zQEl9Or|}xo=}whfD9Qxfs44cy$XLHDFCG3&HBI5w{!@B@(y3cGe+(lGk&+ikJJsqt z=gW5gv_sA%=z!tkEVpLHibk^7bt}a;XN9}GMtHYKi{wg|#fQmOj38~e>s)?OS(7Gs zQP+pFvs(^EL=`2Qo?D)C^7TOv<~-_rm>|ZnVDt{?7XnzcL$Zw9^Eq|c9kj4Ji=VY8 z6V;!iJDL00XAAG}wE1C`s zQ7-{#2y$3y+5xn$u6VfUAa8$%Tk?Y*@6J!Y`sSPeTvmVq3j_*elYJ{3KF>ZzeFt+P z|MmRZoj#p5p3>oIt^?$BboyXYrt+Yp=h##(`*gF#^9C2NU@(=dEf&Lvt@gDE(4{_K z#_cU4MlAT?4T;6)_~1wnPB$2U9&SZNvPaM)?7SlPEXcwiEJxV_u}GSil(cnGJ4_|! zXA+EVhJ$k;ctGH!1Gt$usMHO=yF*qPf_R>MQ77_?4^N=3-MOgXJ3MP_LnBfjFoL3! zfL)Hgvrc@C=t-7dL6=2$PvX)oECqwYrhPf!DLqOc1$EEnmRUKucCi%vJBS5#Ux`B{ z@j@J&h1e_RJkoM#O|CGOm};32!YE`+J{g|6E5bnp*;3)0yNl%Fc5@=NvY{y^o>)fC zoGO!Rbol=^Tuk?sK`(|vMOGN{$R5rek_hM8%HsPbY_ z<@P*fi_)TE#bsW{UCjD9)QgIy%r&Ize9s2D4Kj6XADJW+Z zZU&4i5>=d;D?AWl>lEV^G-uL?!8{tE*vJPj^B}aMp#! ztq8EBITd05my4 zBt0fguCiti+zSaXKR^IWHp3R3+&;LAz56%96<{VvPuS0@hSL)Yt@3xOqGA~4)lyXS z=!&zh3*t6Za<4OBw0soM9c5)z@A2_&#eYoVp&>_z2f9sbJdKq>;p zWBrcTFxnQl8NnQ!bmq&9f~v*lXfltPn=q9mW4t0WJ);Yzi36RoW!kfpAGScycx+!j z;C*_wH8ay~&UyRk97@{NRh-mC*t0DAafb{}Oi?PAl7S(Zi;$*O7+t=|ZTOIK^L)S= zv;eOJ_1E6k0!Wd1d&xxwii_9PgwM}&=8C7Fg%BR-ZsFPNEbfq*3@QE)FCb@R7h#lQ zm8Ym*3`kll5;qP(R8<}t*d}`D%O_M8wITgOa$vtk_$f2nMV85FQ9kzBZ*D#>v&3*Y z&$^xwkA&~2%I0oh8t{g&!)EoC4BrzrYIDjO2Bj(~s93GYG_=BUCFMl`GDgft#fe4K zkCZSTHN>hWTpnK@CMZWt32CQ;5+SB^=rvW1q9OhE9aafmw^clG6?~0tD1@m6z@Lni z7Yc2F9aH`0L((NhKe#SU(La*JN^GFc7SgC&m0f;rdT(9BjlgJEyixL6V3FMX; zJ$-pF?;3M9PRKmqMEKz=l%U-NGEJ69l76bi5?}wXCEWD@flncD?~g!AwUv zB`Aa(2S33oeaM>4Wt}AZmx+GD3NK6LM9aR1KEdt6)T_)Dhlk@x7L|PBb^?CRx==kP zUlPlahKfc5?Gn{s+QSZwo(wrCuX$@fG$kpTTtL(~wt~w}eI5brl{=CiuCE|2#m3p8 z-MlsOy_cw9@_2PwflZ-Ln8~4ei7YT#i!K7Qt8QWjkeegrbessVB3KQ<5!a6$a$7EP zGLQ}GEmkvkr$1wsg9)7R>>=K<;d8dxAcPXp=aJ&%OU#Y93jnu{9cN}H9|nFD!i=dH zM@j}(lHk=2pVw42S6rNtgf{y1^tF|1qTK3rOE0JRBth(aMTk@8Br}{+5FUDFy$IJq z!$NoBsU6WbhfQSch9V1pQKXA;ZQZyr%$DI&6e<~R@y69TW(G)rq1BNJ^3%E`xL{1= zAds-(SCvxDIw#gu!s|+tU`lAZ|9j&;P(YooPRWV75fW(b7~yWXK~ytUlbdUbRCOZ*9a%)*mXD5uyYTlQr@ALEa=xK}b|4k*b*}cyEJYj( zvbadZ|803APZOhrc4BO@&(LW6e~Q2K+gpmJ`u` ze$^2gFZG|HR=OIzcwEM+Wz+HbSX8>;7(b+O_E3_6a{REl(Ge~M%OP(SuR7CS-?TG@ zEv$w@;X|@`h2tK&g|n`_=}MSH@CQd!Z{!Zjg6(~RglH`C=DZKI3s`)leiZXchgg$w zd5woBa6&ps(nFqcoov>IV0S9?NirgJU)|QX zwQn%wpR^{0P-zUDj(xz4-}GE9F46ir_I;{kur;CSK8|bWK~^FZu%!?}YMh!&swV66 z{4EG##-{Ucn!T@9Q}F9K_)V!>3S=n|+q~+rjbSmKFd}k>ApG_IBu# zY&A47k~>NjG-YERx>WT~t^?*DA^+#*B>*vY8pciiNNdV1Ox$?@hwV47YLS?{)iE}i z#viLs2&FhVFUkn{__Nsb__Jt|zbNOAzFi$f17Bt|9(zzjY?9c|MCQUx{t#-V8k&QX z#l%{qceS4 zCN1cx+yk*lOd3ZxwZAQAxQc`m7`)Eo{*(U19xOQ9*UUfYAW%RQwagdTS3}CQZk}zAGa#Ur{W#kL#m}bxp zzj!Vq6LPgVKXd=%{eq{Z87wo3uM~{j5)d7Rj3f~Qb7e$Qhodj$sY#t0l3+hVsh~$zOiA_5G*Q?bPMKyR!>*k^`xx9tVI0;r&kV zD|vlE6I=-}l*2>_NFZO#%MOaTuDU<%y-JR5Q<7m=A(REDGA;n?4r#>LpvqB)twLLO z-Cg5-3<95~PMs(oEBF1M7yuwXl};#9B@cSHS$nz@qN*QBlsHUc^p|tudINz8(qr!> z$8V+%r1r8Z_~f3OYMn~xmhp7E!K@3W4KVlDHTG8<41br2W$as4UKGtMq zE$=R;z80*;fTe&6j)Jbq6ip3lkI;ohFu;cOa<{#Ve3|0XOplUgjzs7hMB;J7qG1I^ zW(qBlZ!7JEKPp~5NSJhDs=EDUuWBQav=Odz`!KevqfPouQmp!6Y;p?5$*W;;*;N~Y zQDcWCF|8%E=tbEfKURq$FG}Lv!W8XeEO91qh|_r7bvPxfdKSmGWI6P$dhQs(CB_*) z5(rs3#il^i81*Fwnl;F_G#|kw8%V(7DSCM<;f>xD<*b-kfTo~RgPsKqEO-Ylfp|_; zYTFMO8ON&On@i?2zb-w37X!P3K3c(jAH zit{qTb2~X6-3iPfMmG0s9z+#-jH4useE%MW1xB<*K6Dxqo_mNePCMRUm1E;Kz`$=Y zKm;!K&;U@jc%s703ci`VUFE`pu8B^SW21!;t@WN~Pa7O%E4jWiTu91L?H@yI7H>Te z>OE;NM3sS)f+vIh+T!M%2*Z5g5WDeFeyvcNN$o1$`39$%M*XVX?nj+Rzk)xh#?iANl8sOCPCsRB!)>o{Iks5T06(Ta& zV>LL9l}N@4r;5_KqPzVVjXh0ror14}8-sg~o^^2CDm#|gmqPITB zT!qTq+8YWTk2iwYo{1ws<;4{kQE&t`3H84)E2Kmiu%MI~^E>!7*gTNkv5o?}bW_8} zTv|(PTxPT2;06{MwNH{D2Po%aNg5o*DYx6l zH{vXt0$46L$d`ITP2ygl7x#zD$}~vVAY#0%w`gBlzXXcVh|x{)d%Z)RBj2dbh-N3H zQ9f+^8A)FlG)Fn(6uYdXa ztN-|x8GY0vSY@_Y;2`bGvRoDc&+=!v&WY#V!E}MgVp{ptg_hIXZ>JCt;zFtkT+rGH z)->Al+GYuH>k1WkoioXR)@jOjzxsX&}!0mM++o z<9g=&6B`%bgOK*VAmL%l(jfLJS!_)})k%K=|xwH+^9pxJ9UUkKjEFKu{jKt7`(xnXj@Qd3*|D-BXVCKh+s1HeY}ge z#}k~m0_Z>!*N~rPVgU?_Z4=_N<6%rpyNCjMsVkzgpcP&O4jh~%ML zSr!t-3-E`~-@TLxLmv5>Jcm_z zUm2>BlfQYN59lD&E#}4p*oiyLA5{F|5JZIk;#&=M@?i$|aEEZhW#HnYi0%$a8-i?p zz=d;2%g#z;lNr)H7UDM_YTi=_Y#adTK_S5eZ9W0NPQa=Yu;vO>l?fMWnrcUV2{3VI zB*=xXx+q}tINPv z*I8g(Yg%@QK@lLr+VF?n>9o2J7|^TWK{u<)YPtK+=6cnke#vo|*7P{4itLsR$}c!k zHx3#EA*>02vgSe+!CrC!F*d*2V9&(%GP*eFt-z#!=ect~g7Q8I7Za52!g*np0@p-q zP(k8dLym95h)#WDAe555M1$N#Sb9UTm&v7x+{S`f1O?u3P%H7!+hCaV?WuRisuqou z^x+pODP`(nWi0OnL#6`xpvJ&KwV40keVx~sMJz3OktD_6^7D- zbg!_;rc=ezrPGS{vs7AC7q#XQhDs->zMd*N7aaHrdyWyUE>wwAU7&o6pVIs!#+^iC zFG^0>RRrO7xa0$ijDucXwu1Ajs@&C2V#xBIskzH{C%tw8GPt7m{^_|NhhuHgi1Wv> zcvNXSKmdMr9Jxo5zw4Z33j_qV_Z)*cU5*`=M^vqXF=Qo?_FNJvei} zNJFk%7$j5fwD2lhFMy$w-DjSQXJ-R)ryHo!gz8jgb+(}3EoMEd$rF@)0-=l&557~R z7J$2YdFNncST1^|a*9#WCtfl7-2*^A9+vWoz(||iY2Xutdw7uRcrD;$Lwv5m7$F=A zP5y)CfLFXZ!uKBmO>R}T(;+BfkqT5Q2LV6I_qk~9?mJSsT;A9eF_j;-lS@`gXZ|2n z?M`!3yc`Tqq%YN2mCyu>728wRn(npxx7jmb&aux;QGSjJwYwg|z5E++iFidag z9wc=HRZr8(TUJ0sf%GD()>8=yD*!c!m7lTA&504HLw+^P;2Na)1P=n-L*8Dq;Bk1^ znNwO#Q}uZI5Pv7kASx@J>)k43YsYt_txl8><}b9h_VA^9jF*i#1jC~khZZsdZX*Ko z5G`69DR>Wk2#0gM!OU4nEsPz9xIaudx8jq4__lwq#xKZpg}Jw7PVfbY3?4%y9YgcC zzN~}~qw?(0;^ww@mrM#hr^y_~8JTtxBzyac%DLGZj1h3rz8bJTxA?#f6MY1=U z1pO2cg*Kb8@|xOA{EJGDoW2rJD?F0shs3SE)wP7%JS-cKHG;;kRK8 zysK6QHvBSoS4yDP{logQR@JWJ-bMG+0UL_FPd5@5}6dV=Qe z)9Q}rb=VZpPTCG>itW6QB=}Tc;MnAI;HNB+Qe|an5`{L^1v=kg`xyv4i@{h_5t(zznd+F zx=3OG>&N_+{H?ow_%Q}H+LWu-uPiB`iFoeE2V$0~IsVu%NT<{e#sCSqU^|pHg>mqh z36`(?(O-21=tu%U9wr*F9jFp=F7fM`A5X!A*;QuMv=FF?F@w#*92h$KBd#{BW=tu` zK0}cMypak=c~G+Vs3308n9%LYtMD>+|9FH^dS`cJnJ-}=BNvjPDjZ1wzK-~EKG@K(Jz~ZxHOH5w=tIW!;@gl-?n3WT zoPw6w4nZFkbI)KC&!v+UCt3g_k54E&CyoqX&km=59L92g%Y2`z@%qBWy(VXca&+$5 z#s#%si^v@SLrlrKgle`@<(>oVAK@3Vpg)>~{cDa7>Erm3OvEp>h2u;dT6qE-AG(jm zbb~K2(-9|FjAy3r~7x|LC zs%&6PI`m8~=y7}Nnp-|-^$K`aFMs>t_51Y?uiw4=?x$Bjbo9I5UjOt14yS*4|LWiG zJMHbO@87(g6KnN~Y>^|7GV53&0&IPEZYyk?5EdFPi8q4z=x!mZa0)0-gD6yMyue%% zia#rvyheA`77y>0!qGq|Y$l;Cy4Nt0tQ7M<9{%RMP}D}B@^oE%$t6LRNo_r_BETsh zV|62V$;ZOmc<*E|5F2rvbp28N`ZOa%fx+?DrP6I@ zfeQh!G}a6YPo4%@SQ4#d5J;wW?bAJ#%>_)m8)a**v?Am=h9!75anToPF_#}JRuKpt^7ki~ex_!uTc+TWKCj>U3ju#7Snnmq%XmCQL&DG0&fa$(3hk(63+ zbxL#wOBQ2?YEU@F*LErd9th-U%zaTJu-c{xYEBrz@_s26Z0yPf=(0gIM3@1XE z5A$TkskRngOCqg8sio+mr&*bs z47S!eksW^pe6H!3N7L?9!%7~8J1zyjy8MLLDBRyhP3qfegNWmBsn-M_c|U?ivLXs7 z>Vkx(Haod3-bCQfwdZa^Nsj15u2`=F(A-=@7tOnlOuI!kKwib1933UhG2h4z}ph5e|_hh z>F?hBvi|Pn_y73u?VI0z`C*ax`_J#bfBDNI;oX1#^8F(E>#Mh~-~8};ne@}kU*Es^ zb*=CDw~La0d$<1E+gGpF?|yyx{i|jAo45aX^>+RK?|Hg??#|!dynXfh$6wZe`{}oL ze_xd6A^6oJR#4S_5AntY390WW<#Wx={t6;302Ay0#i-YC&>mXY_=oKjZ!0G+#mc#O z1%b7!N1lhF;cWPm3qs-zIFob+0T$-ewO2@}w`>L*cO2}Y<`2m!DkbpL+V6po9RikP z-p``9d4NX3Q6X>P7l3asnaMtwcEyx3ZOkcUFXU=hdQ{)vdq6*IucR837I0YTCvYwh z0%~k#3l!GKHWVuv_zTx;;AoMtMXDprV`BADX<1A(`NeZ+1iDeOmnKe@QWV|i4QC6? zjnWF9CMu7G7zwzgIgu~U>OKYJ!Dqx1VaG3hBRt-4xakQ6GNUbd5MFFx0hm1{rh|1(I-bpnj-6$-+%w=-MeRsvAKR+zxm~-|9-CgLFSYC*Drti$^2CMw4phZ zK1M>5z6J;#0z{+_L>bIW5%nNWFZ5DI5+s*1Wc4u=4dNwUZxY5iR5adMUp}rbF@?_w zR>!zUT^{Wj0nnGnd$GDD4fxoyGfoz7lXHH5>XbI6O$tqckQ6|;E)^86BF-D1A~l46 zt+e+3mwX!n&cV;H2IC_hlY@4u!XXi?c=@eX{g5^Yn##@z{VJ?KUbzrfV3Q$=MCqoW zDv2F&Uu5tA9fHLvmPfo$3s9@~1?EZ0jxWSC6)x!##0kCDEDDPQ2r88Y^*e~jN{}c+ zgqsmFKh>ucWt$f*1e@uDRuDh600~yzT(q;fyuiCZ=50?SPH-fVRW~{my*|ZpTh2<< z6(I{T4^lVSZPuJ46wOwEO18VW#9j1=*kSgLN0)33Rl7m4LsLpD2Mbi=@HRpP(+2WQ zpS|jtW+jrU*Uc41GY?48b~PQW)$RS|EtFiOnH7m?enf)`r%~^?mMubjz?8Wo`+M%c zgYAQMc_l-{+kh(~?i3-uI*fTIhV#A_bqSXVreI*k0)2-`7vLrC1^LDlpghJ04_CCn1Z@`Y zkF%lYu!u#tKz1lm=q|t>xk4bV7?H{v0NZSjz=!-Da*?{Y2)7`|5J#th?99ARnI+%@ zQ_Al1PVPjY6iZ(hK5N;|uC%_#vo(*!G>-6|%4QoTlANMT3CHPhr z*aBrxPL&0fl~L*_zG`INau$^x428L?5HFDS1jEsL@3%-_G*Vyy*&7LAV$kS^36EGA z);x+Tkl19Nf)X_q74py=a}a?eo!z?THl;=po#j0~$rabuOnYy!gW>+a`{^I+SHFD! z_P>99{~9v)=Qlt2CerUOe|r7H>bbm^uimY{{*M>yf4_hCr}dieVGWd|bs|`l z2Kp5H1FT#NnWnt(WmAj~ajrK-&#@ZDWBeiomoq?ab$pO7RejIhGBK0NA{0$i#q3_$ zXCJm44q|FJbB}nA{$`U+8EJX-5#t5PxtvDyM^UW2F&)hngQWt@epP>i;XNikBD9Jz zXNj)xi?P3#8>`BF>JD7Cokj@^wYpWWh|9rLU73Hj>p$PTTmS33_p1*6^zuC@|G!7{ z`#102cjHPDd)caIa11?t70>X27-3l2Rr&YvJy!UzQ#wDbU=EJIuYY*+%d5ihe}`Fn z_v(F%J*@GJ>zZ=-K$Y@+2n1_vSf&edA)IV!b>9PS_ZMISVlaq8|xl|Rp} z8>MEriLyj8+m+lB(QC~9E&o2h&2+Ay$t#B^4y@pqfSocAG}6A-Q)7yEYlU*Daw1MyUc?Dcp^vH% z#ql|0G#;e9xQA%jMDzsmb$LzG)FNmT3PqbxNZONIxH{gysPFnNQ)|H(XliRGx(LhD zZ$zT1-cv`VEyIEMMRMiQNuE#cdgJfSQ#Sw^lL#>uqWAxouXlm+JPz1 z%pi}@ItvK~;l8@32Vtzbx9Z+o)AgFFy8Rd*|E_oa=ho}iyL%<3a7~giDn^MgSti;e zECXhNL8HVNXH_stBAN*hA}gQ_F{1$kYa$VXl4U;M@80M9e!qWJb+5kl-)Eo4?>zU} zd!K#wsWIMkIM{&v$_GS^n(2~bx6?%ojd{hPjiQvQ;{X(a<3#lQj3dOg! z4(HTjoAep!V6M(Ua0FRs1z_DvJPXRMo9brjsO_7(68dXm!1j&R1vB(`MYd?ph2qsA zmW4$^BOyE`jaNV>kyNpEtOt(^LK>W7c~x?`VY?V~#hRqJG+;1fVmL#F*)7by(R(!SSR=<{7dpH^Lq@oq8iHJjjiZQP4F^F;g>?N zPv$8IQVE1c##|gKu82!3FR|N^vxo3RVN;LuhGgGWZ4L?jMvb93)C^6(_E}U~vMtfj zIVkJK+@5^AU10XLiuVb5iLi(2I2rIp!TMopd5$s>{nkhp6aijvg$)}rM#T?<5oZ{9 zIvpe5k0snjDz8F1lnXq!+%Rs{-4ryuI@Ci28Ft6oFi=fX8y=TMg!N~8q^n+f zy+f3~S7Chs1iOYKx|yp`o}IV9evWzsf?uLiwaatQ5(_N9nf?i4J0q z7yu3`0E7F|$qh`v;P7c>F&S-J1&mUyq|f@Dub zMN#zPo^K)fg$6p{Flv#l!7;{(m|B|9*lt)J`#LBaUFpsmOHU>qbiC}ws(EqYP}1Bu zQ#Cp-Eg6a>vT!5G`oUbqY;LRU88D4*dss`b082R{ak#wGUQZ&~IA`0vlHo;jt(?Z8 zLo6H<+`>HPZ>%;Ir0ejq69D3NimpH~N-~2JYJZQ#qeE+sBxE$CU*Upsa6aik5LB^l z5%%P0gFeV~LcXI#;!;(7yXOT;ks~-J>FRMFx))eSstJ3LJFpq|XpIioknLCqtrndg z3OUlEkDoDb^(@w&T452T#LKc$$FIJDR3Vpfg+oGn(t?=UhEx^SVA8#q@j_^XP%$4d z6VMnG!v&9r&vvvWm|fk0d9c0!AuX<_wcTLxVwLlM6M?eGnF%mm&>WdpaJkyg*{~DK z&N8kFL_j=(B}Uh`SmN&B1f5|;#m_2bJ7QmhkYk;9xN)-)<&U86KAwf$TsTaSS^_3L zQ|rP=DN<7D4wr%1B!}qFFvwY!_6uDaR~JhL;$<1c$YUt9jijEo5pRUF#NkXh1(ON6 z?c)#ST%7R@s%zsk?3LKnP?N#mqHsP$5279PuKzyozc`0xztz#QmMiao= z?mXbYiMQ4ndQSQ7)yRpZSX<*h!#WRU=EYmr(jB?%lYUluv$L~$M{J3AU`8QVAP3z( zypPjvk73p~&g*#}Rqp}$^he7^tb;US!K`w?zvijw>yR;1htTs4R!}wyAQkyQ?OIWS z+>L;s?Xs8A5gZ$gT(+3mA*)1MB{ef`$daVoIdQ6i36z$+*P)@3UJOVaP85~CNEGcK za_ELoBHJkmXOv@YjfqJ@np=ogbUE!MMQWP!pg~!R=AKw+yT5~n`>3i;@*#tYInfc0 z05PjI5M%8RmK-KR&VfLy-(iT0w2hsyPv`RGK&p`?M(IlF?u&2I1|PeSEQw{W%>C_S zTmFT}nHC@j$uY~~9v6yhlQC2@ytO0}52Ngi%y}73dHkg4a)=q?hO;E48)Xm4GB-bI3jvObTHB36PTgtq8D;L;*v{5QtY%2Cmp+1ftR||l@8M>!-1bqqFj$nwUoEtR%*>W3rC=}BPFz>C z+=(f(E-eBCpPN?;>gTwy#a5?;=8lv;p0f{U5&nw{vXv&F6-c;Vzu4g_n?QIzCJJny z>cWbMn1&EOiY|G08gxUt-o-y1dBvtV`@0{c0sHiK zOiy2o;Q9vxwR4NpQ?~CDw&5C3L(kADfx$I~Y#|u`Zh*=5RLV2WIq+=$HcXNn#I757 zE$op9-+#osDfF#KQ(T2(V(sY99(vQfz`r3QfTCFuwPACpYQIjxaKP+2h(@_nK%$PB z0JJ+p+j{S)hC0ck7|x$H0n$FBhT=q+V95R2RG!l5@aHI{*x;kC8qk1B#ti!CDzZkr zzag7!40^R|>o5|J!#l@~q(S+HK4!}|9F7kar&D`*Az-=a#)U9G?9bgLZk%#}lq-2} zmspNzEohNc;M)y`%t z*l>&leM}-p!EAEchNIb;2=Cz%#k{3t?G49G*^rn1fL3m^`FL z77-Tq@L|?+Ya_*wCg8l^hz>oO?I8|LvC!3PMA{%dn-E)B@&`2#B&G(p@K>x!M>1a} z&m!ECaw>)?q72!kpjw5C$CndKCR4+rWYz^`q6l0mYfCIu32gcZw1h+mVJ;CBN2=0B zxWf9xZ4m-F>*ecajz!m@Jl^53&7;}mU^DB9piXqgEJre z^c%+9ZcBA!6mKb=Y-uu?vqaQwZtHR#Pu@^v(;KBGj3K98rl8r0NTwM(nmeYO1d71h zEHsHnGP8aeEmqW-pnR|a(YV`ATZ+`m?nK_{k~r(RWJQB&$|QgR?gqVgI07R}^9<6G zMZ?$&IS+{SJOU05*7kQ+BSR28xDVe>SD5-_Sv0zKA;gV?=9^MG7?5XUw93#wmKo#+w2O_|T!SjHjdb}s z3K~IixC{@gO!|+t$tK4W7Q;1&hVz7duR%#@fz0FewopT%Z;BLgkg8*24}|p=w%9Y2 z`PD&23h3axlsk*hBVk>Eb4Q;#J{2y!g&upj?C@;EOG5;w8n&uqgMikcrG=uZO&+OC zFC7<2=_}PmU6=l7Z*j&vYnLmxNOXB6$X6$2;5{cif9-w1x57g`gN73ArMxXhR{LGV z&y7fsUa_|Cs2XDMWopeci$PXdrxFu6Mc`D8so?{hHEha&n37`c^h|H61f$d>X3=rc zo4EyuyyGAN1-=Flb5QZ_@X-F*=0Rt(?7Mpf zaCjm`I*n6A{SI2fyx9TwQ7oZavSxyZpPuKlV2m zZY)@D-QwTP=HLU(!HW%7##hf8Sq7u09LBRd!eMd=`zk9Fj8mi21t}=;kd3hJfUzOj z&QhZtU8Wft5t2_$1TvjkoLin69fgbTbf*GR#w8Rxg>TlzGeIL6v>U~&Lb${GbQJ6T zpM#L~?KPw@I|zexAS8+(i=8I+d7M7UP9Vj=5W$1UCQ4e;1oKBzQrhS|zKqm9N}(>z zM|r%lj-##D5pbk=D8}rPcj!aewQEqV7bTj0N1C5Y0a z4Y2PXbMQe!ctTKTlbW%*TE|+|4HNU)6repgzMJ|N-5BnG5f{}I%Mv8o9~O_5m8D0y zyvW)g9PT2wY@xVSY^kx#T-wmaVO;%*bKx2q9z3;zFy;wG`6@JjlsQLTA@Aok5o#o- z^9Mv0vfq-nGX7{!%7&>rc11^(QCBCRgghI-Lb$Xu|?x z@Z~WV))61lu?Woi8c!RzXcP0m6T0+zXV&XhZdoNsQ8^e0N|TF6mJ00iC6n$5>-;v? zAk9p9I})@pF^V-DcPB(CH#oP8AFIJ?!SZ^F^%wf7?6Ikpn{}wVHR`xhMG=% zH{Gu#73_Ehe49k79chcWafAh2(crssuro1(bXTl`p<0UKG{-cHMPyhOtQ;=FA?;~i zu}*jQl=wd<9Z?!(EnJ)RQ#fV3_frCDo z$|g;rQU^$no~N#h6cUtg7AW#*WOH3J|G1!^)r2rHRfBOi(bBr**cwZ0O+QZp2gDJH z`Kwut&1q;j=C%0KQaVRJQIbjyNY`+knxZ-M^fZ zvF{-msJ@1>?ri~8;ULb|bZ($)`s$Z0>F4le$287-K)Ns6e}IBez3Cv*^g7z5oI&omlv9fsr)?qCo_LOS zqahsmV4*AKO)W7#!4nD3$s&Qjy^!f9A{x;SQ@Sd-RgBx3HE;#7UV*2JiPPmN{&RTiFv6A21(XxM+>X-&s|I>GpQTnjZ}o96cFvrd^^;{QcRJP z9m-ySd~7CfYBYa%^S!hCX~W|RWhz@#P880Zm;d!RNpV&!`m!Rd-;?gz7ut$`TXrBt zTWu|fj&$^FBr2R%f}3>Jao-3(HcOjUE^krFA8Ge7m2 z;mnkW1~oRr$SDaiHcal2#HDWLh=>Lh`dxy&+=$V+rezvzQMm$IeTEPm%YgFYNP@YF zv9}f7tt1vzF0-i9icn2;5axSDV=mBHGmkNV63)R2FEL@az*bDchkKHLjzQ<$)~-q_3}FPXs%2wWs$UK z5ZB;s#qGunvF62gi8kxU#v$s9Wdd**EOs5bwU!5&P};(1eI$mnPS<8pP#ey8%}ax@ zupE3dWnoa|`J@A~w^3iT7V=yY+R=doBZl85c5GQv5#_A!Bkdu>MAiZ%D~!p*Jd#PK zN7mbI2W=xdW}q4bgIR;+&P=`7;^NZed>6)Z#Y?^L(!%)sJf6<-6vniM#)|ev zvFU7Wm7Nw*6!slHSn{K__%zoJ6*7dbS|*!8HSBs*lQVZOtvesNE&wW z=}83wCsS@Nz}P=#(SVw!X_$&i^6~t_+`Y-cgQ@8yT+84^V~Tb!G=22r*=r(ZX2$1B z`%_dASUi z;Z`H2*bc&Z)K<`wU=9R&Y6#$ph2G@De~wLcR1J>b9FymBj+KHO4Q=y;*2ZyS+b>7k zMXP8N<(p8I!}a*f5b#8+(Hv}{Fy<-Y2E#WJ+-7tR<#p4XJ=+dSKOBu)RNu_sjYFT* zZN^X91g$WT#S^C98BFxr!TV9OVa%El4*9%R`ERSzd@SLI7E(|dB5To-(Vc$ShU$V>y)Rrhmq$gPCm_+eb|8b zogxmbG8?SUDLA|FG+ozmI0wFJY-}E8_y@uto^}e3dJgZr_dsdL>PI* zZkr6MoF2gyV2OIT%v)z#j#jE6GoA2io>Z4ih&3OtM<|(a8340wnh=+377yi!OIhib38gWJBNkM z4EwMPt)_K!RgmF6T31Z2jyXvcs?#%SFWy8e9=ADk{N@_dXuenrxGq8WBfT`t6prj< zT2M{jWS-|hIDBLV>VYem86+9q(&cRl4n!F695|bqg`R^=P~*!?@(hVZ6|yCV*)m8+ zl`pMdfMKSIpk#e1{ywx(J%v!8pb#?q3)8AR;_7w!A0Cgy?mLr@TCH^O64N+9@?cqQ3`o#()Hy)lzJrN;nG}&Yp3*ju&b&+5+N09R9_29hVSvoWr(+PTelZ= zZnEmpM*1%le?GpDlYc4HIexL;R#xwv)ma$LSI8tbO6bT6cCdM58>wL)LIg86B%_UM zK47WF9u92R>Y#Io;sg2=1({`78B zP+P~G%}ErJFM+%|tLyb1EQwdS18UESEtf*n#R#rw(DyexKVje+C}toDgZ`j?6F;v> zAlb5!7iIVnp2n5sR1LDRvl`cxFYGH+fHbp0gb93FY02}P_6F}~u}vwBZwD*2h_jg@ zyd^WoLi#LvR{Kv5mPx)+)1h)mhC;v)@llWT;|C8W(mL;zaoi7&&rdZSTw&?EpNnlg zOh0t#K;7PrS9PeNMyYftwA{XGhby|6QbJ*aXPvboC6HPC44xF~JZ};zI@6EkW8CGPcF%_gZw+RC|9q zl`K^%4IqbhXqUl`#fv-I>){i^4Ql!zdxM>knau60T!-c!I}8J;B8U==|A)n{sbu^9l8E#?fI;E`=V>>|YAsf8| z`hNpb&9c>rq)JlpzY{|LQpN_;xg0id zFmbY_(~q*6t@T$e%$Y21`0*Te^%z6$&!MovC#VUzfY>+$Ne+?@5e`no!jSM$>=V=& z?k@h2hou%ChbOl;u%vxOmN%fxE%F-=*GL@L+QpP45O+ql$>@_Uh9Fm&i5<)j_IE~5d znY@dF2NBZ{KhcO?%qbuRJO(5CS2KNmlv=8mSbbw-i##F-Sl5NS2!+{s+;(Z?V$1Sc zFM-IS6f&cg8H#BlBi#=w1s=ZR)dI7t?)F|P^Ic*v=1A+CmF{v zAv0us9adh_xlbPB=rs-@_k4pWP5@yj<(x;S7;&PnUo)os2GIi0p}Fw!HV;s|US%ydp^;1WU~C|P6Cf-$LxKT! z01qVR70K?#=Av%tDmh5Ey`$XQ=&KpUs6PSm?KNPb;|-@lJmFLag2#yQ+AUI|I8&}r z!>5>aD{*uz`EfU0F+0gzh?xevLNEsjL}x zvSn1SzN{`;6V4Qk2z84C!!ja#p`5FPIXCr=N^U@}Y^#PuNk@7&wm8Q0)C}q%HkQ{; zxbYF4+EE(mMR8fZbnp3w6X@xw2a{4A3~(sc^iX&k>x35{%`Nm2%uG&9;c~K*WO@$W ze<#d?B@2@?lXBVZ`;*1g3+E@MO4zk>s79sGT$lRkfSu!6d!Li(oTush)Wp(j^OFO9 zn*uLA>;&e!fyGXQoL|EHiKJ~%Xl|B#K`+(tgY%DI3Qd~49%X?bojR^vR2Q*6+<1s# z-Kew|3ss%7=;V&mc332BIu=0bV=S%3^dIoy{+q8}Gt*_Zt1G0E$mMXh0JMz5B4Pu*ji=6l_Ky$fqV)!E`}sc207v>bJ$*d8 zG>Tk&eD6xUp0b&JF!k{9!eqCVrRaS$6ul4J$8$ewuKDqW@tMW$M;xKUr%r9gCDDSr zT%{Tl-|uD$%oSf~t2*+T2jf$EuctFeQSEfsgFzVs)rk(FNy86Y!UJs*La^0ivD>ZN z;Lh#l7=Ee#a>Ps7F;kFMb;BUSdYxN0n@UJUTKj<(h%*VU%M#{r#VdwNK?<$!^2KY}l9=}8t`x8~COhT`g2Lg(lT`o9pMpF_N?~o2 zuT6X;M5&=fQv#NnuFYq`x}w2CRD}0m&Jyy1W|Ad!9aRgY-iLsw^LHC#26lGCJQ`Ht zZ~|2m)L^8^pt@Z3^g7q=d>N5tXW8*>!rK2lqS0PGWWPA<(Q&yu=xpTUDQ*2 zEvMTGXAxrYuvo>Dg$js(GRR*ewiOHoD&_!V=tafWgkT57%e1UM`Q?BBx&Yux@ykSn z6a#pl6XGc&qCF2dw1fbx2>w!kbO0Z%KX6*&-a!C8UR?O_MR^4UQrp`5NKE;bXR((N=Xi_Y?(A6^i znZ>#Xakz#2)=o_qGLqRdt;<2FbN2J1XVk-7OpIlv1{t$ze{&gE7{rK^;c$*_p$=?P znib_VFb@ia%3&4g4oa1;!d60i(CCwHMGtvjgqp_S+Fy+3p$0ZkY2+4xJb=z9lLy!| zK1Q98F?5Z@yCqlH_ro`NjJ8~p=-DLJjL#x*rouWNNun_KVev4cG0l&bUqvXKQbEGyol>m zDiG;vhegMgRTjHun*`ZLZ`ZIzX9WmF?RY=#%rh!xl3WT&+Ob1Nd4FR5)?4HiR`9L4FlN>SMp^BN?MK5L&|ZEqt!q{}mf2y0m!Y0>3Y!a>PLkiWhdvD{?<2jv~Ytn&N;iTE;0$ z$TG^=VQ%vy^81!PcftZu$1>`wJfE>|+z8lGIo|zsq*6IpT9$1XE=%J`>jBI!@ar9n zUu|}rI@$wYr!tZQm&Fpp3*)DhU%8RxCw4Y~SRU0PlNndU172UYa?yXQ)sS+a_um-F(Hdwz7uajto=(cy&n?=+K_IgWf!r>Tq{9f#hw5uzy&MBo5_6~z%Cmh5GlinW5j5*RiR(9;ewu>z6fle5i^75;}bd?FE8YE&N z25DQKi+p86SSetbR}6WiDsZV~Z$R2wYFJL_OtTksi9d#pOtKk_;Rr?_ipXw9SkHs8 z*AwdLLp;r(+`YQ!SWFv-SwgQyUa&gxLG^%8cZ9Zwx3O8mtRJdaqU%)B6ygY03LTbL z+yQ2SiD^=kv~Bx`CtLJ%HSrWq zZHKOhy+XidZG`$EvU}dU6U@o`GqK&aVQ>3w(5Zv!Cgq4gyM2oV$>Qx>&R^BX!?!#< zBvi7W!pxN`9aR-*)-Lp3j`2zqw1V-YwhTaduS!tI^rGECm=!6EW?YMr?#WkdiB^wB zEwgjoZbUO3*>n7Y+r&5Fb5UZbL-n4sp03fsqJUWU0CB*-62oY{yxy;NCq#w8JSh+1J_FeC9DYq>@`z_)6}hhb|CTKtT5QY@`@{9qX#1dU-9#9K zXotLEdWRqvcE2^1vsuR%`8-bg5>1OTyOAKdCCM>TY`o2m1SwB^M$IGw)+qFr;*q$~ z1WPUcfMKhaVlZMzBc4S3Z17SO7jGcCR5+iX$8lpY47i8cW%8gr}- z`6IO_a)HHBxzXWk5^Rw>q?RcMEFCn3S}Pl0?uY15s7>CiaznU6w8IGzqlVYKoqf|` zZU5@bm|vX%MXFdqE>K&v&&W?!>L4vFfQarM3<`vtp>2ee648eoT&fQ#B7ZsmaM+SE z6culqFilLlC*GBNej$Zsjw(LLABEdAS_E28j@q=o1XOTfhB0}lV!mKYscHsGdIKY3 zj<@yHNDa%OZq_PO==S3t2Q=uSn7Zl&<{vgT&XQ2!jy*&1z?es5>Y}_=EKW}U9n;-^TxNd=J-jr2B(j@GeKQq zSiCyC#i^p;I}AEs?-BZ5ScJYf!1SbAWhz60q>MY-&{Or+JFpH5;TWLvW?pUU!K&rx zKmj71@B%lLqe5(>Sk%I1DFE%3hf9H0?FdNc)-~+SrIg14 ziCHNl3DsG3V-0BH7xsoj{kW0NuQP+tNqs)=q&tANfk#s1P{$cjh?zZ>X90Ly_#nk$ z{i~5oRQZ5--6vtODo9Kl70K2*bJUoo@RY-lvr|4Tu>rzJPe($9*aAIL(=_M`m!Ll@R%TKcPVtje5L}lt+<%;AbWv`IZciE!IRsy9`C9J~R z)(;%rFRgTp)PXL`z~zKi7v_?RYmPPG#CodbauW`qtxxv#vH=gcvymZ;QKOo3|CkNi zE3Gy|HmW#<)1|adj$WNrU?McnV>NcBq!vKNGbLlHNjlOzO2LR7dHn=cYzl3P%^XTp z&`c)@^w__62F7V;!XZgJ6O%AyMr@n81^GsL1S#1wq)1RD*SKN@Q>0%J6jN+qm&tD?>4>mOxO`e$-zh2z z_RPrU6Ip`PuC*m3WeV3o7;Yj-04S*%jFzSJttqW{7pPur<|!@O*xZE&g*EZe0*<$z z;laz`n^Vlw`erwF+-2u1NWU-v34vX zN!vJ2s4{D`Kne zN!jE3`5k?a_OV-L^J?X?gNtnd+XJ5z?nTuZ-Hq`NNa7pH94;BTEM3R-RN!AY2`L)l+EU-DNZ(7?lTv;4a3*-V- z$|Vn;u{}&27epGQ9vL>5cr$PEd@B_QJ6Un*EZ9dp*}EmZ6$UlHUYuXHa=&AEm-zTt zFyg7P)7Q;p%gsk;otSB;Eowt*w>D?wFY|pI0Qkir+m4q&eh!gEHwesIWkb~^BBt`t z;L>?H7@pg%&Sf8^`&HJmcjdN}b#oEKcWXe5Z!c#&#bvWeIRkc=?pMKFsJtdGbD*X~ zh%`Z5!$&0T%g~y%f;AM^LTiw*4uV`U_zE!7;*z)=f-}x7^_b*x4vtz9jzuCvsrY@K zi<3b<7;e)g8kIJRXD%ketRCPAr;`5tO-(Q^)#yjcJb4#S0Sp^+PP#IV^YXYFLDptw za%OJfHN4HfJar#ifrY7;u^AY_VkR(waY#Su!^zpng{k`^*!lZYgZbO@6Eow|1R#k7 zE9!=7a+gIZEj>g|yR_#mbvCtuNQ8>pf4z&Bct6{e(m}`ylJ26HUB3BGJ-v#5>e?%z zkFaR5a$^3NpER?RQ+mA9OZ&mYQcOcp;?PR*j!mfE_1=%Bv?x;twk*&?Kouk(ba7%J z{a%o@5rVK~!{GLCQ|5W><0pW!@JEY)lLrwY?H?GT6KT?>H{p(Vy$2ku`$yUXZ)~yV z?e2m71@ngNZ}&3GsDl!XWk!hZWFqs?vXNemSyczV4;RuUYm{%qpvjFuJ zikx9u8Y7$Aa$Tx6`@7ONBy=-^K-wbXRyFyMkvK(MJJ7)It{;i;mEh4TilK;s?L|?> z^CX&f0+X5HJdrxe4vliye>=D~W_WxC*J`QRG;=;qv!Xzf;Xh6~kp)g1by57Z9?&z*-kEFj08) z330lqAivn#@>h_>95V7QCiEhnr3{TXQ+k}qq2qwE8bf`ekJ5HeL)iP(6IcY?n}7_S z#4S{ih8;es8=ORj)pa?vsR@$&;QroQ1>aLPOncDf+5vVTFqVSOIS!{Wh%RcHJ}eJH z$}kMSbx)*q4)fR8XoH4W7p*vpBBW1g;tc-;Ooo*=MA1%{ISx77;N&+?+k`+pAk$+o zPklotYp%;WxgNVYqFF0%tidiFtfR!>P2wn$jo1lA`H}U-CdjrD^;ynbAQ6)^D$tj*8hR-&bydSuU23qh((au_VEUOzMT*@2>)(Kh$2 zgQmMG;pnhf&=4?%@EvYZ7ZJKTm?C=J(GEtsMnin40CpRc5>e$&Vb-#^aA51>MKWkN z0~KC0BnELHpwI8FiBxdNRtTa}6+IWQU5X1AIk}Y$CoHu57~3UBLD?q?QCObAq%$V| zK!kSLak^nG8c zg!+rP8a!}N+q+hw>sESWYbaOQe$^JvItlr8xC8)NJpg6>e!gZj8SFc0%XuaV<>KXv@yUF0Z3(2m% zz&7?Jz=E!W%aEH$G5ZSrMTK*GBqMfZJUW!p0N_oy1OvX79i<+fsT`=jPdjA4i^@Wo z0*?kpMjR$q?%2e~H8mv+x{)kMs?!6vzsw0b43YPFevhJ}u`@{WSMy??8_>2aUMR-f zP^%r$(VwUy(Y~diFm&6TrA9<_m$10F8iceIg6nY)Za|4$m?lhcs%l0#e*pGl6`}4% zmXz9?sV0^c-I*4UXrP_nstYNu7*#qc`JoUz$E!kFjI5Wi-zTgDZi7c5R(4n>5m|)P z(2LZGq&BE58+xd?GnuwPJ%lW5LG%p`@@R>P)iU#9kfI|X*c2?;PFl_k2ddWdU z%;)0kZTAh|rG~PI*>VwXV@<4Y>0XsiGGtmnP>vInsNq>Dj!Gr>Bo8ktx8rfwp{9u* z9VvP%ns{_5mw=2YPZ7Y`40bnkaaEmU-W+aCzb1<;rr-ilH*(vOO!fRoY`99$_%k8_#S|#Ik%7Z&115`PTby|exm7I)tpTip3elc>_qdEA+ z!rEVdGH2B71Rn2Ax?r9Bwq(OL~6Q z;L+-k7dw(mf_gv?qsW%OQcd zlx-wKCuy0d!LG_BWL{;|RYYz8>y)cAt^I1XXf`)C%=|h>17ABRE?{CiHR=$F76vI; z5TyyKCB8H^72!m)L3ocSVO3C~fJRNYN~bIz2*dwzNo=@*W{rc=Mt?%=Nfc+H8(1|s ziy|}W7D2s=LNW}zJkmC@=xTVm+W}KV0R(1^rFT2GZJ{58Tq9+s&>Z{usK$ zbuOIHqn@WvVj2m+)eHr5!y=K!LcuKzUpz}#;j<{qjlUB$vuU7jDV&<>5eXp$eYv1_I`RpNJF2K zNF$&iuiI^Mcha}m6ow5p7lX{Kpp++!`_Z910Uqs2{fMo0!6*eBq9|TC(oxEq?`o{` zI*r#mbC=mNIAOa}X$9viCIu;Wtf-W>kzbXN8E16VTuL!Bfk$Ugc{d@PZ)6f(!;>2@ zDZ^=v=cY`5pu^xI(i?mtyD%$BY6*YIgWdhKj&^m5BAk}tiLPmpz7481-LMC`6VLOc zdmF1;_^WL5KsVTmg;3v9rUeRIkMQy;rMt+QPotp@m6lMCOvF?Yr%_tq}aZ;I9SpHhSaoyL!bd$rGW z*b5y+FLQ!dUea=X9WF-nN*xH)FELAcD4BV6a#>rWJH0JV{lB$>gB2Dz)=l_nKcS93o}}lFM*ZNW=L$QU3Revi_D_KQP!4QE_eW`SgP82CdQ8cfjl00(^#L0P(It`kiH_>{M_6V!X)R+1& zV2c+WWQ(XM^_bHuX_(&k&`RrKyss*?^_0gPsNngC;nRClekVx_BG8pebdr`4SrbR; z83z^e#HC0hJ@Gn7O)H2Jw5d`-RTN54Iw+eSa-k(%N$+Ky$B+?%7W zksxFzKf)fbG8?>@gqQ13g>+kE?M`#X$DA^cdreAo=}o%YG@XaIL=}UdXjetbjv__G^4%k?;0baehfyvdYk4pjPY2uok=?Wc0Qvo*Q2q1!@)Hr<8 zSTV{lPQr-$@ard?vY~oWI*T%IY z5nt9C%D(pX<$Rh70UVXLYyAWm(x8w zFlx?d5~3edgewxsm^}GC<C$IE&Tj9&?fOA$sO z26P-(g!Tw(mvPD{N!#4hn)9krGTSS^oR`OQWULcu{ewv@wTnEyoF;Qry>yg@HCg>` zp{2~XNn&p_`D7oG*nar#it0KHGsY#3;+nPG1`_qgTq~_#i#^D?*;45jyqF?rOMS_+ zjx?c37-r5LX;lLxCPMN@ogl6#9l%IbW36E#4S+Wvxd!9{sKE4I zNllBFZfp;s?-fK|qq2dB>UI^rn?BAFE+y}vm0BI;@0K1kLXu5)xSI`3w34R^`vTEb zzu*-LJyVKOL^r3lNEr@!V%hG|uCijn@O9LB>6ldKx48$QTrcZRDknS7mfgqhFv^MC z+WRA1T$|eLgc8dHW+y0hYA1R(OY{IaykojHD_rW0x1@{{vr>VG>lK-w>J~a$yILC> z8|ezBZBfD0CKZHNI%_f30W+sQQ3D?#()>0tDy&r2hjHaag&_`!b3ulPk%CzdS90>} zeF#k^gtz3=YwzqPnImp(p`VflF$f*18CfyLvK5+g>>!0zr4=40w}@}-j!c*nC@3a2 zLpcg(*u;$mZAclwd34Re%PNtjim}whdC9t%jIs#yqocBskU%RHkz8-q{)jA2*U5wk z*e{a=NO4hWFD6j_>v@<}SFzCxh##=Ir@ivL4<*kh2SUhCHp3X&Fmlg-G2m>5Tibef zz&t1$m=(*-5gB;N{CMZq3#gpMVWUaR!dPUuQ_Ee==O^lIhD*J!XRI{*>qlEhqJEwV zm8xU7jDrA@Mnc5;`M|I1laH8 z*jFI?YlTa#$~X0W;@K}rSOT@~iZS+7$62Kj4IzX;sqXjDtk%?^-3}H43X5%LM5GC& zu#h#dd&;ADYK;tqwa>#9FlUkh8wtt)1jirTTp<;N1-gOBu|wF(_@O*5*2JqKD>~YN z^OAl9YnRQiw~q^zhlgnE2Az-L+|{av(kK1zM*pjNm=$UiN)JV_wmO4qUxLb0#u+}d z!ag;J6j*4eSRWs73H5SHJ@|B8YRAFbm+xfRA&^vTE&Ec+lHdDi&dHM6ai&yh^EdJl z7)og2GDf2q4|Lk+_ta`c=aY?&H$>JUR;O3AGqG3JMRA>?qMa`1nzlNwe$X#6bn2M- z3;N1WI`Z;23;OyzZeqU0X%jm%#C4vOPV}i{4S2~hpG^+RV3(74%@k(4nVk*}zkw@p z%3YAz6(vZ%4(K8};mBSPWG!G>2a>#^KAO~RNOkqw8HL{H5MPtQT)!u9FI>v&=BZ`W z20Kwrp@PD6Th)!P~d_BP>5p|Sn;L#`1Tf+VKS+6G;! za3KRIcyPuUBAX~mDsQ(i={{*3?%%~a6_XMGy>QEqr2Bor`+~}MIhL$xrGlsdjOIF_ zWwz#0WXTE+|MD#wH>NcpKkPNY3E|yxL2X~#O8q*?YAPL&4)?J)3agDAE!|qzH<2|Nb`s>w-KOJ>edC7GFe~F;?X{k zk7G&b((R(l@SD0ulCRwyW7c><<@}L&7yN>DXjQP3Z;sv*_uvet6IfJ)*cG!63<^hF zNm=+VIL~<{Z}XMP#7D_i5XvLv6gskamkH@zR1KRK{e=73Aags2PGUT@)95~+$)W%! zN+e1uC(B@IM*W1>Px+ocZgxb>n0Qg1JI!$r+SPZwhf!H88uQa&Fv2+ut9i#(d;44E zpqA=sO(Fov`#gH>lc;={q?trjbopv2RTV>i({TDLoo&A)CE8J)q@6u~9ph#^3d+96 zFU#Ylv<(p{s}gxF6pTj|6pM)vj2TtA5b0z6=*?JIqq65>}c5E1hnrgo>+f zH%f8^TB*(b=u%&tz47!9@2g2Nu-v1g*BxC2O)gMlHh@}z!|7=Y#~U;*%d)T}RkTlX zN^Gfg7v7gXklPF2g0L!ou)49?M+9S5hU!*udu@Sr#`r_E&h@jH>}Aihj2pR&?F37= zjWk$YGlEjLY^<-wwiAP=Fc+Dz8!WV=#4CSItehori7`TMQAagQop-}hGkx^u4AqgaH(_!1Cd1KEm56@z73K%()RQvT{#5CL3%-z!cOF5g#DRw$?e1PMZIYxSl^0^iYcUn&r5EuWl5)l2yJIU zgJ`z6vmo`dtC9{gLU1hJ01owtiXrTIb+QwI<&w_twmM#)Xp1%_-`xn(&aa-dDy$&1 z6K_!JM!v$eOYIC5X0yN_NPeuescbDwuDmRTshmX1D5sC551IO?qfpT4EHiBEP$U3p z-_`y8%xc>zlXL4iP%6h>pIxWC%`*D!&DEX3t=lhRh>yQV8p_j4o!;eIZkwdQx1WFE zZBiyjazqaK7U2}E7O#3mtM)L&>JTzqHe@x&>?hE#fO5L=F4Fdi!`+P zx6yFKz zP;DUNDef+t*VVBBY9=L#W2y*OBPKr0B_kbo=ua=J5&8yd1Zlf<4-#ty9aIJ!N3d>| zl4;Sn&XG|EC!PYwwqQ_fQOQ~Jzk^vzEHgAx-t}gIbB!7>^$xHLMKyCyju!a|a8!~y8bF^6^-G}#$x#sl82 zAnO7GjD;oWr$hf`r&Hhn7f5J-xwMd#BQ(S}aF*_*ffcH4k5(ZuimgNHFni&GD0$EOGOvOPP8 z=kF_HX70^g9r1W}aenfC1JfJDrNYwRSV4$13G|MwA+Wb7NH8=ef;vk#l4GMwxHh3j zg^3M2R*M-j7FQvh*N-F>GA4yoTUSP+`On$LmAv$i0P$t|_Ct)=6AWe| zssqM|b|Z6)V>NhnFeTJm-9(zim$ACh2luUK;Td$n7Ld18>9NB<@JTOE#Kf{t?fB6lc_VVFCc+xW{stUKKp6G<3O%lDq9QY`zRCg&)NSQP~hD)u2enY zjh_u0KyrTNhXgM5pZg9aadL)rX-JQoiS;~FFa)TlT0l00rKK(AroMCKeqd_bts?GFvhUNMOzH9uKt!2wQIc{0?AL=!?9@f*VCf5UKnOu zM6;TT3dO5GOc-XT!R;O0n zoUKGfM~tRIq@g)z$%ZU8j0)u3kE={{LkCyeUY86VP+{m1OQ(}OHfw)5=#`wMCi$sF z9oqb;CQ^^;CG|q!VpCv>2f){`$YG{ZjLtVyU-6MWOf+M8?W3}7RU6ta8lRmQ+seM+^&4raS5%f_k422(M zw{uDSpb4qDmT#Z1jdRJO&Np3pW~`8du~XnrS*9Y5wt*M<<4KYA-QDHEre5$9Vqd(y zA-3BLCGW5SyOy?5vH#jk3L+EsQak&n7&OWozt87N(G;QR5Sj=I)Oo7njDDrsifx(Y)hbhBXTw zpC7zDJ$@tbLJw-Qg~(7(@saG-j@iY1<39rU1?1r^wtEgP5F~;UVwK933QctsK`0?) zU(|kyq!I(TqEvZ!R_%Z<$*kz4^V@z|*zyUo%UqSBRZ@cGgKe3a<*HAWZyes@#D=2y z<;7>pq7iKYs#Hm_zP1xdSGay3OwQEgE{ z_5SOlUc5f)1J_5fqhDLaTesdO?)KZn-Fch1x9O5w&v&}q-Q0F@I~IyycIM1Cx7CF$ z(Z%H3vKZ#uqFWsFIW%Bz+wpeIXvc)mI;w&8JKglanqZn3nuwm>gkQW_rXG-{Jh)pg zRHVSfzIb!Ln^=L~mwKh6;tGkPlg7&;+p|7+VRP$E6Izsf$eF#O+PD_Y%k^+d-EQi{ zl{Ia4O42Ph#z)*sVE;`b!*ycW+YNoyypYF*$%hkjGkVKvaPKuHJg*8}9rbu|vL(0u zTod>Ux;FB@9yh|b(9~q5eX3kr6P*~aTW*hgg`ASi06y5}s1PFdmTj^n%7BU|fj+U61vUC(<_hjo$?gq;cC1a^94W#*oyx?;Kgg}C`0ZKd0wml>-A$AO z84tqV$GH?;)+0eDsw zknC9Z9<)>k!?JZAnO9%7AHh()pVOMk+;4BlPOeXNI3@$dw%kxGRdnb)xAJuzTc5+l9k|M zHL_ff`01#K3k`k~Mi3V{q~&W7PmdWQuDmmRaW*dAH_I68gp68(_NuOpBhdRhSlF0a ztHQGT)Pk}+MeXs7fxeT5?w}`NN~Ku2afG8bd`j%_r~_>%ODQyKws4MTOl;w;a>;-S zP@=I-qn8hv`FbARKrU=v&l>V+3m_=jIHcgn0AuGNPDdqEi?Aq9A5$g7+K?(SAp9jK zRQl82sXP$Yn;EjsB-Ci3_C7@8>kcW@adCVh)S~lquZUoG_~H^(rRDAc}_IGAfS;q+9PLjr%hBO4<$*n#|tr z#?c1!y&MT}TLM*B==KukcBf_-Y$kt-#y3Ks(vd5=(Ha$(rBJYeBn7WvArhkO>@Z|f z_E;F3TwJ^gJx_wG@Ke{|XRg6(6KW|}t%$2NqB)SELAK|Vr?lEoEFB!L`*49!+f;9d zGSwB9HG-DK@-pr{pet)fTXj$EX|{NO^HIAW_oA-KaJN->b<)DUl{wqP&R-oNKJbe4 zt;(!ZNJqog#a@;F_EpHcS0P`#3W;fYq1Dne#HkC{bgH(7$8Xxe?Z$k!7R;@p!D*+R z@~h)jkbZ|6ZcHwqBnHLD;KKcI2pz+wk^k$x`u0Ewdn=9wAcn`B=V1yd$17F2B<+fq zv$&oDyATI;US{o!W&WOeARoH)@i&NXJs@b zn9H2dUfuhSizdkjwETdyf2ZsFvbvKYDVqt)*C)U1kYx_MH2KEQUNJS>sxF_U^**9ouBd9{GyGE$6<+w&iI{J%;WPp=~B7z$4ie)9_HpJ zX9tU~EiO&Y)Oyy)#Yf`{lM@44ayjlnyS{4r*~z6><`!NWOm@w>$wjJppVllbEexh+ zUml<4x#KchM&lP2J7U~u z2-0tk`E6?fWT=6GfDa!k1#eTPz1)fRRcIErbg-D%A&3_Gn*1e( zpTgD}qK&X_orL&dYIEWERFv}+c6)FO(XKK$$tEOuW3O4}D8lrwz~;+D5NT+(BE3_s zKIN_Q(Ac#Fwm37kw*Lr7{=y8g>G8hG6AVdYKZR>?n=qt(32)GHd5*oomU@-r!CFzq z87yzkim=EiJWM6X$^;&SZL!sE$0l`cnnK9}iyIob=cP|?fLmnP!nB<(~bt|MpZS{pmLG|)PaTGxn z8;~Wcrszl3acmo++o8LMa&;F+RTS3k?fdt~M@R;}Af()0KP zhT#GsGGb_-$_~@<%BYB5AT7z|r$OE?(ys&RZ7V|jZb}JAv4LPF$-G4=BaPT>;BF{g z_QGP?Wr1!FcaU$i4>l>~=AuuKBuwZ+FuXFx2@}(7eVnT-KAvGFcW~pgFb%Ap4r=n% z@%u|%#QZoyEtSb4p%H%D{SpSRogJL+Z}%}iZeY-c^5YSn0NJ#3zU_^pIt$#y?;bZC zP})YKr=ob0OzfiFFOI91+;@k*o1cCd@cSXlJQ8Qe9<6Sa+G_7$w?IE9w~6*-B1KIA zN+&nR^w+_9+L^~aGngdw2&>!$(2*ZALO&D|9yP;GNv?>IpBXof{<1}Uj@fCm*)B%1 zgzz%QT;Gk+UyGKYm$m(I&sX15$@7i>;(Li3FEY-A&O)Aj&}ceZ=K>BHGryd2 z)k*lc#PLNhd=??9YA!N^@nbfvW>}GI&p*#%-@N*;FOhhXg=xAj1$g&Wp@`{eeU3v^ z3#nMnF*n>-E;<)bc|QbG8t!F_*~$k+d=sFH;hIc8i4ai>U#90mOmq0A_Y1ou;TAZA z9;K@QW9)s$Yf`k^w}&w5l{E^kH{%^OHJCiU!k05!MZ{$rkVT_fh>&dY#~P5Xf`X*&!i^{vjf5HPk7AoE zvkuXfQlB9o)E$i)@I zNbNbV)KMuFV{)yM+Zu)wrkvF!|SkgK9Y{$e37>n?%syxoABk)RQUR+t_7C#e{}~R}wTk+cp6&zoGq~nfB8>XsfU{FM<2m9z~IZ z%oK^YgAyITfY@e6gcYSuO}y@MKy!>bJk>V?fnjaMC%owk48A&~n+yVYu?42u8ZH#1 z4lt*K-iO|+b*!q@L-D&h1BVsE>Cp07ocXMu`oQuv@H?sXyB&t>Mq|`_$tpb$Ndh=JL_|W$ zVY4@$t9B)cKt=2No#v9$_#^s)0a(fk^X1CQ*|nCrIwvdmlBX9Y-_uq6%j|EWpR_P? zu&;A#I4Xn`A(T;=K;lvBmcgoco-7DmL;$9V4=DpkkL$=!h77b1evxcW`*{{{G zGpz2)UnmpVhp=o2vPGtQRnyXn3P%fK+Pm&davhnVszuF­Fz!?;nUtmLm8q?CPJ zLh#Qcre8E)J1ct8oON-iKIdj*coE3{SB6rZ3R4g+=`=Ao4-bO}*&bJzB~oGg9U?;= z#ez_2;N1nfHy(iM$mP8BWes|N^JoCkfV?}J5hvGM$P3w&DBPgbP<(h zZ0J+Y9}wlT)d-;}&JQd22zx#738_H*)@vMHivojRS>07>q)jMrn4APE0Cf}*`J>Ad znW=z8($Q|Ce@p+7!z*2*U>t}bL!A`CC$2KD3UYrFrf zQ3nl|(fsmBD1w@UKS|hCWxJhl`~+phTNV4g=~HCMG!alQME(ey9Geo0moTxAXxpj) zOkSQAVxm2sR}OGRyawBFhRQ_M5Hf$wA3*-xDC4)@fH$yzfY7N?cdU^0B4WNCY0gDA znB+o0&aGm}IcTid|>r_F`H!tBf_oYYDUv1c{gTVkFr8dNt;X^f`D7D}S z@ID7*C3ye#?H0cKd<);cJ-AOepTTt(sFo53boD6kaFskGPW4b1#Uu0TI^TwnYDk{O z#8nhnZsl+<5p7Y86I?wy&|C9rVL4V(D*}Vj4M$GV6N$q3zl(H##^=y_#4wlN@@BP+ ziF8X}_RP!||3pXYre0F~P~5YWklLB!7&Sj)^{+weqM{8s6N6+)w`+H_H0)HP5EHp(@(z9+&|4H+n7_^S<_h4N!vI=S#*oTo2m<|ZZwv*XS;f^|^mzgOg#nVPx^{qP$6;&l;A_pU5w zVe;i`N?N!Mf87@r6fxig^omwQ+`_AG7rS&_>@`(iyrzP$URS|ar>~2dVOO}S+8@5Y zJKdtI^4z+4^QP>DU%e{w_VaHOx$x@v<0}X0I{dAh5A~&mtG@Jj@!EbM+e=sG(W!|h zvRACHa3k5t2V1kuF$h#ZARC<2*&(z*Liz}{0ko{>Pq~37z8LQTx?QRhi69d=8ZCx{ zNFHHR*x>AabL$B2p@+>hhnI5?9>njge^`zYe(-pDnioZREVxZCw!RbelbEsmTC8u_ z^@E`vlqA%_t2MkQFF!Xx<+iP0wsQ7%6i$4++!!tK;V8JAF4rcxoL~XiyQ0_(;>|n4 zp}YvVtp_sgDfLr5I!GFY!UfukH*>L~ow#_w!-Z2n#l^)r)g=@gS*v&p%)W*oRk(PK z{!g)FRH8TZ`QJg!iWLlShArs})N*!)Udu7M6wu8h`gb{xFi(V5K3(9D{ z2G*jqvl;#Lc!(WBozCoTW=LdZ>&FJzk7ag=@)V~ix8&E%{z&A>RL;42$ng1;xNWXb zIL9F#uWsFhugA`IaEPC-8rbd!b~;gT^JuwL-_<*DU5lAQ8@t#Y`O9GG^41p@H6$os zPN4hi86hw8aE_WMgXaf#YDxIMi9^nQexcv~3z_2DPrSc=;_i!AeggE{G=SJn(a{^O zqVB2P&ax|lM}e}xZhfHNAlPtho7I+EcW&Lpoe3N){<($RsYs?9<8t$6j*^G0gc!+A z+-fg`YME@2E7L__gJc1%oMGab@ctR15?mn+s11>LQv=D&odB1ES@xl>$d@EM=u|+o zGk_?#Fre}8cK-4*lf&3S`}f4J36ybuad2}aOh2(k@VQZDa0YYkQiyAZv|Yf%4!B#f z{p#b^qgQ=TN&39^@elAqIfX{t&hs7kg%&UI z{gsHlO>9kirx&{0jly8JlkmlE;FfZ&93UB>y2e~pjHif%DU*#o<8p#crK*X*Do+&! ze(!i#z@r^v3O{(qAA-I$NZX39bb%f`s=S2uF5vI)&B=o~ENLE}{40OP% z{PyT^W{Gj@yIVe8^M~JmJGk+vKV{P;-J(Z=bR=TI5zCnOyrI@rppuwbLMf?cTu4qe zu*V}-+FAXOfgwEECDpbemd+!K5gB$_n(w_&mVovs<;VRJ&*I44iS`J|)F|W*&ZHQ_ zxe>382C#LSfWPToiL*l1G74yC!q&klb&e>vhx!x#4#ko=SM0xOn`acv*DA`yI5{O5 zRX}dfgAyrq%RyY6+vQaPo5SU)7&4MPZdaj6n@G9d=M6ia=8m^*b~%rAjm2YFU61di z0?Nr)o^W=az9GwK38{YA<(q8P@P&9N)Pp)wpC67Uwkj+>s&l63xO?*t;(VlYX}swp z7sg*1EG-~-#hvYbq#`8F^|ALKF3chC^^sG^ZzCuUgk~2$Y1NiuxHR)#to0U?qR3F5RAjij*H*#h>t!E*O^c@l45)JzQv=ddb6H#SA!n6Yem*W2dQ5S=&EdICYAarE8HCVKGM$%;oz}n+*9E} z&GG5@ANsQ1Oe~Ib-+uuM``6}W(ag2ai4o-e`Nty|GL2w#TeR6-Y4Ag(F;nk(<;lt3 z5eKxULyFNVPg@5dC|qc|tUY3ya8)8kF0Tm%MwzrEU}~*843ZS)tjsa=U3Fmt78{pB zx}v~XQc2C|eE0$p$jfNRqCEC=Q&K4VgcVj@vpC=?}7GIfKy8j4=6N9;XA3{CDRGyf8 zFg43;z7*y8Za*1UN6k#!yPWCK+~U&U%9xpj`OC={AiM+V%m&v-FU(D&FuOLlynb90 zKQ;R{WfOUQ$wap01|d-Y%0>*5Tb52xv0k*jHLh^=53UEY2glYK9%Zj%*%>BT*;PD~ z5s#am68S7(4fJAcJR-`qK{A_V*=Wy+cR-b~moJZA6{89yiLWSat$+gh$|~leqR8lW z6vxCz@oRgLuo6^!DB{Zlrp<%tIXqc#4QF9;ewwYeMNBZh3v;iv2zBjZ8(f;1pI#c= zN9DTI$rad=*V{w+Dwduyn9x>%Y>ggjEv`^?_Yfi+jEzU?g2G_9qF8)#%VscsAD&<- zs*Zkhfq|M_g>~%7Bn&jT*sN2TpFJk zUmEXKf}$2LcW7WoI@HK3`r@G`t1caPI&(3mT$+!u?ogA7%pdkX{^%9cmc_x;47SNr zb<$@OYV^e9^!RHdGpI)DzHH~qgBme0Ww%xRfofytxNpTJfyrJ?Yc;dxHWxz8iEL$~ zp`dfvC-J}zw-6+r_J5pSh*iwv=q4rN>5T@XtK>Bcab zV|TWQu!9VThQleaY>4`Hv(+8Dy!xiy)LNh%BpsgM;$Qo?3oGgRr4?)~juD8roL3LH zC~Zlm%XVJEc6iUCduX4Rs~AcRo}el!+?J}pfCVx$@B4Jle{%d{b8^h(@RMUalAJ&= znv)goZ0S6>lQd2sR;4L#U_NclI6uBHJ~O!Qlh6gOflkd#UKtl&e`Nc3W%T^y0whSc zLkEMaiq^(c{Ir;#cTUbr=}dW6#Yzo zjsB{A=C1J^ZuVhz{X)H@Ne+uWH&CiDW;H0d$ccMgVb=zvN~Y<6C8;p;uw)$Jk|70E zi$LX_3=M%sBm}(jjGi#6nTy)oL&3szVe4y|@S-$mSI|#k=HshV`PeSX4!Czebm4VD z7op^^>$(mW$yn|{WUM6l-U|YY8s2&<5p)ha4mwYWjJyT*W@~4*vYMNcWE4%uPB{Jz9L_3H({ za|w@m ze+dEM%iI8d_Bq0zAa^O?djT}3#`yRBzznO$?FWE=3-AU1{z@c%=T`v-2tarJ8~*Vh ze^33V?TA^_=cDWQwcy71_c!v}za2P0kJH=c`H{@?zD^#% zXMQJtev~-+{n_sW{xq=qTL1lI!ehYyAmMZ1pGo)v_~%M`e*gD`$N2qh!sq<{Lc$mP z{!+r4Sf5LH4ER?PJ_r8QgfD=9y`-l%f1{)a{?{cv@H3=SoiBjDFkyB27biRh{H}!0 zf!|Zo1OK*?UIWg56sv5_SM%rV_?i19q{i_df>kY%#UZ(&nEmF{qfm^$AJG?!mk5=F5z?F-$?i^;CC?DRksV^F9-fs zl}SH62mC?7qflYU*$X`hKUBG`0SbZ`E{C9v~Q8~aro$$wj z{|T_Z^%n521K(4b!0&=^xDLOUb|w5e@NM7~l>?E+O89pGe<0!a0naBq z2E3N=IPh-5_khn5z7PEIgeQQ%E8$7tznJg?;2%o(A@HXXegyn?fjyt8=RW}cx2f9& z@MnSl81UE>?MnD{;9mxIdf6znp04E&5r?le1U&FVKE;+ z4XpCVfd6sA=fMBGqzC?&CH-UO6r0#vN)P;{z<&Yw;+3ZPdf@*8`21D+B;gC-4<_8a z#xw^00p$gL75E309{3Lc|0Uq&Bg}E&|59my_kjPh(g2?V{}rWyFuV!;UnvdnIq+Xq z8sI+yEPm$#_)h}=FmUtx=|kZE8gLBwE#SWnd=C75310yJ)r3Vz{uc0mtMtG>2CRN- z{$SJm6!4b|5B&4MS_|jEzYP3+z!$*34*WNPMTEZKi<;(BfMdY#0#^Fhfxi;?M}W_P ze+Te?58S*CZv?EdXqK6S36BBK0skG)=fEEU{?ov30j~i6kH8neL*VZL7U4Mp{yl)_ zz~{g}rZm9c0W5mhtU^zK{~q8N@b?1$ec*H8?+5;$fG>c582Hn`B4Gam@c#@r2KuYmtK@J}c`gzaAg|1U}p{OlJ;+eN_M3GDd>{M8Ac1Ajxp7r-w7|CGwv zV$J~nwBT)cW#DH3p99`bcntX81ODH@p9BAK;CsLqz<(O}-vS=nVNE3bI`Aife@5wn ze*pMrl^*y4Sb3XW`T+PJDh=>I1pY@#1N_Ut?-abpx&Zz^fSY}I2arm04*XTXD(Czu z-v>TXnuDf!9{96>W5C~*@I3G|u-f%H@JE38zc~kflJHx==b7dL_&b3;Cl6VF!0u1r zA4>Qf`0pls0sI-@|C}h%{{`?r1-<~j@msUZV|a4l{}cQe@V{B`G~!!< ze?fTQabWfBIq-)v%?0pBfPWEubE-d0^MCPg?7Nwk;C~7D0(ckrmlgR5cpl)-0iFZ@ zyTIy)3*i4S;m-j78DO{fKViHQKL-3Gz`vrrz&{SGemMV<8_j1Dz5xEUOy7Lzjpp;; zmGcMq-N643>BoS-78nxOoCDtkz72c<{K14j1H1t2I(*rU=GBD9fVY7Eh4KO)1OKY> z0)HG>ZTSrFCxGc{h{uiQhcf*b@TY)(4fHwi-v|DGfiHl6vZR0ajppYQeh&CofPbAd zW5E9(u*w(wt}n^;4*VSOzf?KE-voRUxOvZw=G%ak{yE?&;BN*V171k@9QgMGvn@6k zz?;D8&*r^1n*GF&z4ykAHxeEP{&>Ro-h1PN-wmuec24^50sdFY`xQ5u9|ryn!C!g9 zeD8099DD`A!c!~iQ>0Pfj`8oufIY8(e*&2Q-tmq6`Ck)uKN{Wq=5ONnX9Hj4x*HMY zrZ%6=Jhwo84w%SipH+e{jWHJZdBFVljywKo)4UVB`b+=42bg@8k-h==`9S;c`}sS@ zzi$TrBEPTm?@q$|!0!jvch#5ofM4LZ^WQV2EWY)5s@p@-ls3)*-_FFZ0Q28FKER*f zm+-d$F9&=>b!AGF|DO4V0?~|bYvC{akEqN(c}V;01@ONE{ChM04+D<@pY!jJ0^j3z zj5Lx1R41kXF7TcgeDISAj{*PXgwKKhM#2}sKVH%^@IMDUp)!Gg5twK%Jn>%-h3EHk z;2!~>1OHmW7r?&(?Dh9s5U9SaX{MC-i)aTh<#=qq8rW%wdLOW9KkzpJmwER>C(R?^ zapK4L_u+)kf%Cs-#sFReU&`0`-OtEX@Pd^l|9j>hz!vzgqCP(j{06Z53ix9Qj{*Pj zgwKILk?;lZCrf(z`3FmS;J;qd1OM%k9{AJ1ljKtcf4-y#{-u&0_}5B$U@NW=a?u5^QzYduH-tmAx-;gjQz5Msg2Ma_IYxK!ClLi|0>=^hDWI0Omp@fBB zO!yr5bzset3;qog{tWOLu;&tGetW`N3*V9OIq-J_e~7eN7lP?xuk*Kn%NqXvgr6hb z4+4JyX+)Dh1$>WR{r985`qnxBKArFd@IL}}Ih3z8sP+CF@GpQDd=vQp2A&2U1J3`R zd8t5D>AS%HDrs2nANve=t%b3S|NQqvpI;FEl7t)5e@((F^Xn5n2mak9J@AXblPZTs zkCpVmMOSeSJOy6$f9sj%#>)wR5_mb`KM#DE@b>`!A>cXEUy%1dC@}NtyMR9;Jbm#0 z)Alalu4QGJ?%b=YB!ygZ0C6E`rMRY~sz}`+1yY8Bf*`k0Rlq_TcJ{ThsC@}*-%_Fw zpu}(yB0>`cns93ZEp`yafQsROc7OxM2Aj|-MD%!;kJ>Knqpm(4<$T{5-Zdy`+*-nvI?FWa;4joXpzRvn`W`(@fsh6*2rePC~0S~x?* ze#>~ec-@Y5&|cv>b`JI-lySKOHa}xtuzt7>^Iq&lDtsl@q0LxcCmVe>d$Vkg8Qu;X zOM&Hle!~5fV809H(S^PS1DA`S)yHIa!M`SZ3j6c0QTYqYu>D*MX7*K---!1bUJKb% z*jmB}`yH&q`f~Ym*mvN)Mu^MW%klo-P>zq>g)`Xy1RMXt@;wNMb`7ul z!rsJt7q9P=J%#;)uxof{2YH0nXWzXV_H8UjMXIoGhgpMtlh*0NelF}2D4)W90qh%T zBk04hPjY=U-f`G%*j?DCVY5C{*gpk(3wCx9?yX=y4rUGZJ7AxJ-G%*8*k@r+VSf_# zIoKIKU%vwzOW_#)`(4=!j|UgVa$3i2fht~Dg6}&huW6nC6LzSN7;kGY#m=;> zy}}mc{)Jrm?Xdq&`#+6!E_g^-v2aG~yFMJ>-L$t4T5ET}$ymG&pW}9tb>0Q1meBvH z8=5StMf8Hs2s$=+{p~`D<0q?_&7bt>MLU zJMAW3HLOFsi`O$?^K&r8>)GBG+i6+jdR!1|82jIXb?%Hs;d_eL!!C(`2Jbbzc#h>h zyLi0>>tiYWH2ymx8&%0Vun}W8pT0hpXK%qf4?Vy;*WrTqi@2{3psW{4aIXUU4YKvN z_HS}^ewA!=@6b0tiS^&46(`zv4g8z3o3OtKn|-#6*If1#wwARwVxJ3?V=4SB{`;0} z*Aqo+ug5xng>saIF)hcOK7a3`ypNS?cxhR)4~(Y3cnmMJb9j-ltR2n8#bfb#Ayy7r z`1vAN^z+3U?0?3w-huZnUKjiT{zIMrE&h7|Z0s(azb}FP&fvmx0l}p*S60J|V}tkMy^EK>KN-Sy`%GcGeb@kg{#t|G#(uCA{vH0~{@p&Wgw62} zmpfsjFNMC^kLzdei|b||!#iXA6}(f#-@-fN;j>oi)PVhElzkZQTz(HW_glk8-_72AFU?_BDzS^q9xH^cUE+1E!Xj~JOus6Q1 zy$#Ne*5S6Vfqi4L&hfottsTqRr*rmC=IpoU?4O7IChQYS;WOGVib8$fj`CkunchMy zJohjb?q+~>-1Z-Y?Yi-~_^09T;-zKnW!PYZb+8nEONBfZ_r=fYRAv8B>wFIUtFoyh zpJ$^2q3`?-%5mJVd>J-B<0ZTnus@IY8eUq~eh&NoHp+3FaE|>u*uO0&e?P!@YIyxK z%4v7;T6d(R%|I>o zDU`1MTl?b5%+}tD9cWo==IjGG`%O7}f6hLYvk&F$uVIJRs{UtCeiLk-uXrxofX#Yw zd711Q?8CCVuwO2F3cKy~v7c9Zeb_(a^z>%%_kas+f1HdYPeYkoIPdx-Kk%AUf0yX+nE)?D5NoAKwCwH|ixUX=5=T>m4m|5_{X z{B=3(8eS#YP1su2UX3!_?|{wkGEkKZJ1G1`?B{Rg0GLFD!Bec<1_PtT- zTmfy~A{(E-eSO*Jix<9A_O&Q~x9sa+zgITeec$_JKLPgpW#bs(lz>AaLVV`&qKE-l zz>g&A^%1Q9bhrj^{xa+vqc8ic>@N7rF30-(o}h-ZF6?ihJbdQS=6~Y#VgC*6w_+V0 z?4Mi?``#rU6bp{^VA&T77x3CUBH2(wkjkGb= z=658a9bjL0X>7MCY~HJ|4VSR*jqoKFhrhHa}le*iV7Y{j=aXu<{D277f)g8lm_ z=Q%e++zZ&DAHx0v*pEhe7xo{+F2m;U%KjF1=s(cpdmkRl`CGC}VPD7fVLux7aVW3CuEBmH>>IhxBXIu-{lY#UiSN`{j@4_hp8*>(g?qmZ*#GZ$zx&-2 zc>gE7---8s#{0YRj<@fQ@y_K-c<1516S;5!0Sn&3IrcA6exb_#o7TDLZq_*!H_QGW z>pUK(p$?emA6}cdlw_A+e-C1~81FT_xZDfAF5d5}@+s_x$YwvGz6xffK zjdt1hWZ5_`?|X)9oLl$ZDjVm}eTQT}9rg*?&w%|(*>%|by%6j6OxRtO{}}9_mW}(A zeQ%TfY}gzdasB7Oe!t3}3;RFF#_x*PJ|+A4D5rj0|7O@_3QnZi|4}CgD8B z;ITXy8_f}(FXij-T9k7PP{Zr>u)}^}`&eDrT(G+fYk22(iqB(# z7M63&_GWB*qYLql{e<$jqulYnM|Mr?ah)>k_oMtl*b$e1ul-D6{}OE1`E#(@K3u*i zy9S%jJ6?qME?zuW)9&HL1#*UXzl!x)&gGl3S*JgRUBx@=|Cg{?R>SLWWOre6K|RAg z4(;z(J!!A!Y{&Z#+Lrzc9)oSMPK|)Y>)apZJQkOS$*u(o|E;|i+mum`rSMSLPvm|S z3-7~!C%7=)M){4fYht{uy&UU5FSkCwi@jEUJ}3Mk_`A9FF9CDG+v?e1No6Qr<2Ymk z`@_dAv}OMJn4bxBvEoUr!+tcxOUoMjpzTM>#@p&RVVn|ISo@jWx{t}N>vrO5uf{R3 z6fVoH`@^zPzq{=BvGP4CY!?1oyBuZj#D371aA$&NG_ZY)kHfwKWi_n&3D{S{?!x|z z)|tZQ?`FdK@O@6@HQ2um`*Ba(Pc}YgYaf%1H*6m27RG!0P5Wb2nNPw= zyCg>a!#cbd@H)Sitbi>*Mt|urYoN-&y~o z$}{wb3op}k1byKCvZt_DpIZoU3Cgh)o`~(WtUXCKR$YCL@EHk<-&t2KPtI+}vAveH z8(?37ed8_sjT74mI)&wWl(Tvj&@*8(1}-m@U4wlPHt)Tm zF`f>~05-1~??9WOB~TDTj>lws;8r&K7S?AU%+_Lkc-`Z|`uG~i`p_=n z^%t_K7Z=<=gtq!?lrxqoUVkTh37hr7{X-C+f3Su7htQC`#^U~A)vFq?yAlCaSzT9o zKJkKklGTEB!sqYa*k?hd_mf={BgU|f+mOX>!xC(_VGXw1unAjBXf?*fwkoL*Z|9ZQ z{)KXkW5dE&*j5if-9o&uADXit0~=lH!XC>1|Lzah;#e=jao8WOm)(N>6xqDbc$VxA z>=(%H!rqYGgZ+MJhkLy6TbTVQ4}Ey=1GaV!zD<;4)eCEAfHScD8Tkp=xDO0LzXmq$ z{lasacX)l^2Vq;&kISy1oabZQH)dVfT5yQCE)S27tCvvDSof+GT<4dg;kATvUM#pi zUoVe?qx<0=l;^GN6c{VrA0{7Ax904R#x@M?b0}B-ik!{A z6Y+k2GFQ&OjdD5vzR5QKj>GorbL;av2$#PjSN@AR`?ERwOF8@7Ir}eiHpd>`=RfAk zFUA8Um-E@I?T6&b`S(OFFXhUw%-Q_A60h^4xpMvusmq_2D}PzeK9;jznX})Jv)`4o zKa{h7HD`Y=Xa8Q#{!x}1Ys!W|D2e)6#m0}p_nxC z$l($f( z4}f_%;zSLcxRA3NGyiiaUm@n0$yai(?jg<_In~MCRPXNUoMCoB%*4i2(yBA25W;j1 ztkC9>LztXWb3b5eiZH1I=7_+Y5SVg^vqi+LlWbb#Y~}o@+!5Ml#b?5N*UW;5);+Jz zn34pu$YLH6PkN>nI4g4s(${juV|8xf0fuNM3c~bm=Y|mgDSHB~`Wb!`S_0rB`N^ zCt^C95*E)MSwg6#Czs&9;)c!klY);kd7zAwo+5N+L%ALE>0m15DL_Po4ArA{6#-%U3OGo+rr?DA6O zvL}_oZo_eM`@WmQU2#LM-{aV<)p=#H#<`uq8$JR0bnI=DFTK01a-X8TjdF!|vyDD% ztJTGKvu5stPAOs-`NF&1X7#}gpVQoS=R4xI$B!I8)V`y9UQ+-L96xorj%Siau@bTH zGD&}TJ6RoUwWEB=c{|&4c!!)o1{G)DyGx(phi}zm)WO4qGts_FSE0{+B%EDKo}NZW z;AAt0&TKImFs7S5b$dDAp}p>9q3^L<=PSjzuQ4TUnQMhE`afMO*T{P-b9ZrS8ct!W zQgaPvFfS*8Y21Sm=8`(Ti6qbQI*Q3hIp@<} z2^8h5xk!z;!K|>%rV8r*(=f}m^c{o z8J*rj8cAq{t2r{dU_K>e^G4AoW|qfvYTPil1~VjY;#!w0Leqt$$1FN;$FT`R4`4gu zQjW>%V&1It@i6C&<_gD;hZ*RYo%48h7BdBNqV{YH*`e8mkmeUzr($OcW|*cv7GjWs zTD37{_vsccyn$YR^5CJM@}(pCM}jH zDgjC2itSUInA0B}R@vTF%t`DqsUAI;G8yBBBb_6Mm_Y=SvYtG507=epRLq5ndG|JN z3*7)7^xG{=D}3e{#yn{1IEmm&`3#d!{RC17Vl7MtcpNj!9k_%0gN;VO1Yk(|e0-I0 zo4ZFMvY03*Yh%W%)3@P26e7d>9xUtp4@h}xLJ{dSh zm=OFJ^2UHMl^13#LRtoZFUD4j<1r z$NOfOwGp{+&z?GRoGH)Fo@yai14dey?G4jXp4@*X%=C8R6i&PyoP1(;#T%2^A=OaG zk{yp}IE9I+kt#@ChdI`$)hT3N&AoHvEq(d!^!Fifxm*(Wkr;Z#ux&of)FaM1D{<;~<{r5=;w+PdSSf6+VL5%TJ!!!iO_nC=Q}+!a1pZ?96Rw0GyCFkLweE z5d9c2L;SOGWvuI14jpKp=A?S$EsXcoT``?}xY~pZ2HGy1iZ)LkKyp@mh-3R4ID}*= zJj38qbrsG&ptHwwzz)=D<9v({-Rh*Chj8*oUt;G*Im8GTKISlwCw-J-_P~RQBYaRW z;8wyX=7vGbZXM@;Cy@q%sf2NIrXB}S!CVpA5B(eGn%GjNc&$Q*Jl*9=SqXYT1 zVqe6RtKrigR$`BjyNze0P#Dg%I8}vwsrize%^n=D6`_zBAvp~suh={f@Ji4B_)&~T zY|n5yI(_Wm{xb&;;a&blfsNqV~$cZ%kBG-OJbGT?EGR5G1<24 z3;3+A5GPZlrrC2Gji-9Rc8`)@;nmN*Oweik7zTx;U`Xp`9HJmCHo&WWob0oUhs24{7QXhMo{Tr_w} zfgoqlAuuq(#rAyKf8gwG+3mc842e&<@6Zi+a*HD^)&L(_blLcc3hl#_08V-bbp1qc zjZGiUhx#~SR#=?KF?u`>vCoDF0<>%$2j!b5P#vTS@&$HvZVnwBKITK^#ICrt!2jXV0-t-h!g&6$GBq*><601h z4m`o2N1^riV~l`hCWLDX;^ELc{Y0PjN1LZ0WK&K*@JwN(AvGRkpiNNk zO+49%UHcI7)8k&?_#ON4(M9H(FakYygc%Gob`Dl)zgTaZC(gQL>tL+v{{66Y9Yih= zoZG=6uO5wKM~ujCGz!rPt6t($1vM`R6!}(C=er6=fxqRBq7lpHPz95df^Cf$=^?qZ? zek6Y4?b~^Wbegoi3SoeQDb!DeXQBK*${0Ed^M5EAP`J{Bo1esHIy{lLPmLKrY{-*gzGe_VlZosZXUSV&bKe0aQykM3&q z+`2v+BiX~T{da60ImXn#Fi-H#o&(J|PDP2YA24}PPRh>7#&N3`k)s;ST#pMQo#B+Q zpV^`@_}auda`gx|%x%sr#9PRLfj6$hcRWGG9S=7StrtJE-uQMpa4OX9dD0CZ!}`sf z)B5K9&wU2?~n{UlrV#egzIH^_l&S~LMZENqNespsSnqmCMYZ?wAD?<`P=3F|% zJa*xZ`5=BYeS#_NUV&uj9b|apX*v`fKZxnvIckmP0V*8t^}@jCz!vf_;odfYdIrW9 z=!&6{LfZ8pa~LrN3ztI-UU&n23jc-c7 zp@4B=7#r`F&fyBpf%5^LK;rej#sB7@w`4Fhm88A`fC1JfA=u;oKVLvd+$g>p7LhmlW($u>?8xc>9BK ztlm+D)kFWiB5uIW5GTjJ^;Yz{=iZd@{VBIT^M%2B>hqq{c*?D~3qU$VkNjz$If@iR zC-@(8ZF5KbkiZTxArly1UvkZ zvuM9pgo}09Jf1WH^SX{F2jTjT_n21#L;rY{KaSL8NWkakMo142*)ekBNj6^m`7J`Y z>xVkbkcs^1@l%Nh0mzez>v-!p9yQ_<%sYSHHU@*>rVP&8adQq={D0M-fY)4&;xJKv zoHbq}g$SzwB0n&DcksAnkEwW=(h{G|)vdinWhK-jvaO(hyo--#nbkL1;T{_6hK~*I zz;VOO0VGEN=q~sc>swxRr>TX!iMB2yC_-+H| zm?#?>1>b+hG#~u34ENS}Kx>Y7e?c#;sBXAgQH%jb{I-ch6_w$#wdduBfj*=!!8jGS zs5~_)hnf(Xiupt%Jjm1iNVxrB560%W`g?%N6J&g5a~t%=>qva!jFSW}%)E)jq2dEa ze1LfAV!+{4oNE_7q~L`B*XzT0oDhffxY0d&3=ebnpEyU*atad_+Tespwr>j~MRt*d!cixiJY zC>#=qga^*(^|%D^>)6ec$cu2~_!)lnizJJ9o{NtI6xxrqv!i%$j(h>=a`DQG9IczD zk!luIi2q-e9cE?)+%~|0M^9&QjmIB(BEvaWxjOf7CVuU!FG%#5HulZfd!ilhrDDW- zUZG9mH2~v2bR2CF0bM}5!;mCC7CM0DhoC!AwN~enP0ul{|-o`Ds*DZdb&95K$eG@ZL<}sW-f}?c~NzU-F8c!1O z^gCPySI4`H!$*ydc#?>A_^h5hfpJNyK2AP{^I}>MhvvA44?hG*y|{ZtqEqAsiAT`$Adcd2 zzQDs_TnBkl&7CIVbsTA4p1%L47b4G#67xOnrl&kDyG!X!8%Ps#*V3DBe%{S@Eq>n9 zpMKZE)llIsd(jXAmw*Gu!szY*$0}h=n5%B+a=1HTIuj*v3ct4qT@ClD$VbQAb+IRJ zo@n8I2;qjy07e&waE4=Q_+a5VD9>Fhh}X##w$851a97Emg>Q9mg4b@trwMm_;h6+Z zAiPQE9UZd1AHWa;Bep}E`1S`s)Ciq24wYlxDSS>a>{#ueDOFc++nI19$-1J39G-+> zxxU?9t+wX~LGTb5%i?Q{SPv9poT8C!yh18LjxXdmJD=ly7r*tuR|R}bb^ED1jvvI$ z48K>79f+M3!&Q9SqLjGEquRlDuP1NkGcZ5@LR#;G${TYK-JV0w7-uf$7FNFPRBUiL z(ep6u3bj{BSOvFMTj4{p*OYSOGQu{;4RP+!SBG`IOP+*s&THI9(1Z9)TdM^X;{yg? z*hPECL_pz=;r93}FANOzBN;qLL_YA)2SeZ-mT9%HN!&ueLW=A08Q&>9<3lp7z0Qnl zH**VzCr-MsBX~Zl#e4Z zEfI2TqwRtx3>>hNgZOmb-bTXKc)G+@7GLM#(eEa@D^JbHgdEL7)V_^Il(BWn0L6t*_aRoy5(17)|co7hvR(l!VJxwz>5RePPJ)&a8WO z;NWHm2faTIQKEd|a~9A0xLwAWl)3nVg(sZRKram6Y~hL5o*84;^)76L9|^)8p3>uR zdso7^6Z{M$IO9RWo>cl_{2D9&L!~Qjh`&s@GTsV27WYU_ z8kYP5&%Xq_`$J*h|MG!iMUs8*{SMZ9KL6OcpX}jhVf^`E{Cymc@1LMyOma8B_FDb! z5kH*_KcDrF&G=)na1eAR{-CamJ3RlWF8?FG%i~({my%c95Lec3&|>nqQd#S-ep~rJ z-#5QZ47&-x08IA3a-Pcl&MmBc#SJ{ilx`?hI@eSj1;djUx31`tcDQPCqK4rox^}aM zT>gbrZm}`6EuI=a_S#CQ=Yiu_+<=4dq;%>f*S$1p26=c4{D$@FEF3}q;bg^MGIBtU z-=(6huejkb+M6Nar=?9((S=M9_m0^d2jVAHS!^yq3o-<(B`|v%ocIGo2JxXMt;d z7V!T5S9f+b>Xq*7nt$!iu6q1kcXsu^c4z2~X~nMkSMKYsd#ZR(JoW8AUE(+r*ED@f zOON%T>%xvpe3=KZ;JjRLXO})1zu4Cw0wh-o z{*i}WIw?IGV`t`mUL65f1XNV#ZaTv;R^3di`=I%~aK-#?&f6wmQ^ghjkOZ;&AhA6d zhD*+ig?-RYR5-a<1~2{+f4X_Bn~6X@NFk=yyCAeS0x;JM_+#M z?oqyf9Tk5y=U>{bzBdj}L*iXAo&twoamL>?p8x#_?o9D3WIPy--(#YC=utbK;`s2q z6>>j#LjF0|ev7d*8#};8l{1FR&Jr}*JTRh$Jg%#qHecdYI+r9YnvG5h) z>RAn_jYmu2YvXXs&3wH_d837!UffTFTi^VT5u*b5DMENms^50vE1B@4QPmrW?`rqH z^NPP|bS?PlC zcd_K3!RsNHUl7(c-w#~EYGg0mANhlL-RIg1vWEC;;ESslWEi(umpOh8cqiF@H|M_yekO9@@h^L9mOXp4 zmKAec1+VA$25?#I`c!iMi{P(`Ux)o&`ipB>J;#@T8{&_`f6)Z(BmOeDIJh8d=lEi9 zNBpPU-{^v@D=uG-?f-Bs8;fh;OMe6XBk>n79~|R*GyKJ`$2?u;i^1#ie~kWJeAaS& zF}N)LJp2#pAval$F9J8ku1`no<8f}m{PCEti|pg|bIjun#6I3I$2{IF;idRHsNePd zec877aaW*y#+bkaf6vY1Jqvu_FW@sK=Ki_An%LXd#ooS~Y~N4(6Y-tgKPKauCH~#S zU%=!ntdI9!7Jru8|KFG=BJppC|AGEnk?Sq-_ml01iGP-CzexN$;;XO3{{IjkcAQ}I z^;;L;PCq6pDJTA#_#^b+XJ6Jx{4Md4{$u;HPU0Vkef&}4pNW0^MdIHT`}j=2ov(jc z?BiF(4|^QygOh1p`~vbi^6H7-O5R2;E%A(8NBzZ|aOJ*p%!ws_GP#2OEAEhSRT_yu zL2mBL#$vQ|ST-IU>$?sA^#gpK#O@z`vHR~Z@z2EWe~ZMwD|Y`XU~-o8+DGjERZaX2 zvGr*t{*KuC^b-G2Y<czs@VF}6Msu=eL9K1FSb6z#6J;RpIPEx zimlI1;^(~btiSbH7h9jQ*!on()~7DEKAcCM`?EeRvGwVQtxr#EefnbSQ^i~$+~4m) zpXwObTd~`>Ew(=0#6J>SpGo3hh^^0d;xAyH6dvFDtc!j8irD&aUKOry|AyH5v=V<; zY<)OSc7FSj*!oPw)@LTRJ`1t+*%n)$U9t5kl;ZKM&$`(9l*QJkBF?ld#1Fk1bMsD+ zw^r=Qt{w1;XsU-fo z*!pm8Wa?*qT4L+d5nG?0*!m2_)@LNPJ`=I^nTf5>Tx@;1kBIfbZ_2WD++6l@{7CRH z#}5UM#C@!P$(u0`c#gjpJQIHt{)_K}`zi5Xfggm4!WTKd2)qeOuLD2eX}HA}55X5dJIlu6PlNB@oa>kR z`2Jxh$Gm^o75n~y6AE(u)p%dL8t;qUpF3jr_g>;3i{0O+iGL|}f8R;`Ma=!h`nbQB z#6Esi?EYR){7td@dpq&>#P08d#6K3hzfZ;P?{l&H`%>)wz9V*j&mI%waept0-QP=M z_xFm}{k*&J@i)ZQrzy5RZL#&~imgvyY<-4e>oXQxpQ+gT%*EDcA+|nUJa=Jy z9uN1#j&CBiKC{HXBep)A{Eqwc_9e0PsU-e}*!naRe@AS6dWnB1wm##;KNDM@MdIHP zTOUp;&iY%QqS*SB#MY-Gwmy7r!|kn4Lu`GTV(ZfuTc3{D`jqgTfcx`!xGZ-2ZiuZ< zEAjWm)@PXbr()|fPy9P#>yzQWKdG;$Mob&raemV4TnTTAy{X`(H(DeQILs(-2#qrr7$l#nz`Q_UETB zwmw6#^%;w;&qQo}nivPM{vHpv#IFB9Y<)(Fe=fE@%fz2y+{67_pQ70NuZXQrE%9%N ztxqfQcg5DHpZG^&>oZCGbFuYVimlI%*!pl1bjD+Siel?i5?h~&*!tAO)~6x1J{w}| zQ@Ac3&*R}@jyWDK=a}Q+irC}fT8=p$Ziqb|-Vl2{+{`h@!!5DL!vnF$!$Yyh!z1w! z?Z)wN_3^R(9uL>W9uIHinB(E5*yG_=jyWD~i#;Chn=<*pY6n7cw*eY^;s8t|5dT|sVDxX*!r{+e@|?E28n+xwm#FuzYtrWZL#&)6IeG0e-=K0U#;iA~>R})*GM&j>?txqrUkHpqz zlK2;5>$9EsvnR*;S)ZcV^(%|5Pc`v3#MY;o_&Z|j(-T{tf!O+t#MWmbwmvhl^;w9m z&$ih5?24^Vc0-KU`i#UL50Ax;e<`*;JBfe&N8|piPg(5k>tgG(k@!1e>(fj8L$UQ4 zC;pk(`YaOvj@bHSwOC)*Z(VGC%3|wN6yM0Pei^sD* z6|wyrV(ZgN{5`St86^IR*!s*8|59vyb`pQ#rdU7gvo3c1Dq`zXOZ*#R>(dfjpN`o2 z^u*R@AhtduvGtjVtVkH^DhvB$#|vB$$xvB$%6vB$&99CJLpE%tbLC&wHQ?}|Mh z&g!u~WR8amVvmQ5Ip%n{A@+E9L+t+26T80;68}`}{ytCqJ7V|u?3uBC-hWB#{$5G^ zb+P;VM&fUa-QT;3e;{^$A0_^&*!_Jjc7I=r-QRb_?(f-;#dzG`i(>cplGy#dB6feT ziQV7pV)yqQvB$%^Vz*!US@HPRrz*C;DYicC#NQWNpJC#kimlH)@o$T*&u-!`;vSIW zMe9=%yM9%%^{FTRrr7$l#nz`QwmyBa^%;t-&sc1IrefoZ9FW3ly_CjN!k`fMkDCh?=b z)~6`8J|(gBsfevlO>BJ{V(ZfsTc5Vr`gFzCrzf^Pl}4oXQxpQ+gT%*EDcDYia4 zV(XLL9OJV-MX~iMiLFmrY<=cpkB1jxw@=}gxPR-jF1EiWwmyx--xgb+ZsH$`t(fa5EwT0KB>ukG`V15Q zL~MO#iGL}!K09LT!vtA8|5=}+*!q;j)~6!2J~grRX^5>)Q*3=&V(YWM5s&Zja4E+e z4_9-{@o-J-@o*!@91l0e9uK#~9uK#3%<*tX?D6nO?D6ne?D6nK?D25@#j*Y#4{wM) z9&Y8BY<+gc)~E2YSbyuYF19{pvGu8n ztxsKSeKy3_rzN&NZL#%P-ye_f@o-7(_G^f(Pc!lN#MWn!_$OlPGfVv2V(YV;_>0Y0 zKkHKxyM9%%^{FTRrr7$l6Ms)^eFkFdGZI^$iP-wg#MWmawm#cp>$5AiK7|7@KI>By zXIds=kB6sX$G;=CKH0&zKl{sK>r+kq8)ECzO8h;s^%*4ovDo@d6aPYNeYO*Sb|}`@ z`V_^h`irekRcw9gV(YUZwmvPf_34PMPfu)p24d?o5?i0K*!pZ7j`jC=xG8r1`(o=e zO#Cyk^;snTU9t5k97*&QTc2v;Z-}i=Gx2xC)~A>Fhhpn9PW&^m^;w9m&$ih5?24^V z;b@G<`mBqsPg!hzs$%O?7h9i(*!t{>Js!pkh~auQ%n3UvGwUB{(;!~j1vD$ zY<(7qe@AS6vex=R&*!m1NW4s;@k8;fM@HEF956{FN4=-}e@$k0TD;B6feTCH@Vu`+F<#cg61S{lq^KyT4Bo z|6J_;z7)H^?}**sv*R%y_xGaM{kya`nrB4vGu7W{<_%uY$X1+*!pzE)~7GF zK0~qf8H=sYRBV0bV(YUMTb~`V_1P6$pJ6-3>+$eN?D!XA>$9Esi?4{=Tc48H+t?Z!=R;<7EDT%F5MQnX)V(ZfoTc4)b`n1K? zrz^HTeX;c!h^v**czo+q68rd7 zvGu7Z{-)Uav=e_%Y<&iae=N2>Q?d1#i>=R6Y<+gb)+aj?dwjeQdwksb$rz8v#~rc9#{;q3e=K(U&%|#3 zrP%GiD|Y)Ae<~i&?OztV{cB>ke_ibM*b#etwkvl3F25@7-=B}F*#4&2pO1Fp?~DEU z7$*Ly*q@Ji;@=kg^Rb)wi?5FL^XH=^cKxbie?IDozbW?Tqb;^RU9t7)i>=R4Y<oXNwpSjrjEXCGmTWo#$-58(8X9Kb0n~AN@BJpRhiQ8MBqS)J4#MY;l_?u$u(@y+7 zvGo}w{;}BlOcVb?Y<;#9fA-o~f9q2eTc48H`c%Z$rzW;O4YBoUimgvuY<;?7>(diw zS}L!L_4D|wDt7y}#MY;i_=jTaGfw<-vGrLd{_M_peCtyb`}k$C^{FQQhS>Tv6Msi+ zeR_$1D7HRhvGtjXt@X*-yv#tWQyFeM(~MQx;pFx!B{gh1l&=czxWz z^;s9&UlUuOM&fUatxq@c55?AJocL#A>$6DwJ7VjT{Y$fhpKIOz;6I-8#*!ncZ z)~7ADK3%c(>5Hw;P;7n1V(T*%Tc4TO`m}LP=l5kEpLN8JZzQ%plf=IiTc4f8UwlK{ zzx64Jz5kln`ZN-MOKg2QiN7zlKEuR65nG>G;$Mob&yLvoWN(c1w?0L&^(l$1Pep8f zYGUit5L=(7*!r}@)@S`q@%SE}m2w=uzt3^_{$A|yStG~c`+Kp+XDzYEW9=M=@9)JP zkB!70kB!A1k4?lLkJT|IWdHJbY(wnvSS!cj`+KpUS9Wq7zP}gyd1Wuh;rn~BpH~iY z9KOF7f9G=C&trbHrP%$k__MLT?(ZeB{dKYX`$ppLh~3|NiGL(^f1f1&x!C=EnfQ0b z?(c=S#QM5^C9(T^CGpqA?(Z97_xG0A{kt-NZi-Tc1(lpNg%| zJn?Uft*&tY<;R?>r)p$xf17R+Ynoyme~5V#nxy2ZSnXX50}Jl zzlPZQG!uVMY<&iaer+qsO|kW9C;pz;`V7R@ zXC$^h6S4J~iLK8$9Esvws`wYki91RsF@*rz*BSb+Pr?5L=&?*!pzD z)~6@7J_E7!8HugWSZsYZ-Wluf@o-b@`uD}wXPEeBV(YU={JUc7Qy3)rimgvI@i)ZQ zrTc5Jn`c%c%r!KZW4YBpv z6?;6K{lfX}R}ovETH$6DwJ7VjTz5D$7t&6QsIq}!T)~Av9 zTVm_e5nG?0*!m2_)@LNPJ`=I^nTf5>LTr7u#nxv>Y<-6BiSc?oJj!wS{yxXy`+Kp+ z!;2h;@9)JP5ATRQ9^TDy`2POA@%SDOSHvCl#U2kAa~!_E7kfNh%5nJqUhMI3OYHN}K64 zz5j~X{k@j>H^lDmt;F9IyTA7n|48iqK1uv@vHSZ{?EbzZc7M-?F&_8#qS*btBzAwV zh~3|7V)yrk*!_J&oOyYFJf6qH1+m+&Dz-lL#NQTMpKjtGimlH$@z2H9XPNkS#nz|r zfmmPHuOzlUmBe2cTc3@@-xgb+uGsqY#nxviwmxIA^_hyT&s=PMmSXF(Bep)fV#_o9 zV2sz};gQ(!FT~boJMkAk6t}lNC9$`!iLFl~@wdg+r@nJ4~jvGv(a z{KXH)`dgop*!on&)~6=6J`J(;X^O2+TWo#0V(ZfvTc3g0`qch?te?ljb+OyGBep)h z#6K2WpK0P>imlI1;xB$A9^d+u#6EsiY<=p9zbUpp?Zn>`Tc1JVAB(NeRBV0bV(YUM zTb~`V^$4PlJiIM-`>cO79?$xe#r8ME)~A{HyJG9p zPyA!C^_eFAh1mLRC;seXv3}O4D0cnIV(U{){0*`7X^O2+TWo#0V(ZfvTc4rW`i#Za zXDYTnbFuYVh^slj`ZN=NM{Iq1 ziGL`zKI6nc6I-7};@=TlpX}qY{??}`wmv1X^{I%hPfcun8e;3y6kDIR*!pzD)~EbS zu|6ITS8^P_zt3^_{$A|ya5Kl@`+Kp+!yU25!`&QnJlqp|JUkJ5JUkV9JUkP7JiPHA zWBolIZizh}?&O%`;jY-@;a-mUe7G<6czBRwj)#Y0kB3J&=6HBp?D6o9c-3FWvA*u_ z6|wyr;ybUv^R-7JKSkp2iQV4^iGLz?f1f4(rP%#_C-E0P5$osvzAkqCDq{EdTH@aj zyT7-@?(ZG3`+HC9{yq@9zmLT3?-Q~6`%LWqz7V^=FU9Wfyrz5sLU9t5k|7xs{$HNt|+qWsUKJCOm5L=&7;-87F&m!^f zimgxKQ|Iej5?h~2;;)OX&qm^Ji>*&L@ejn-XC$^h6S4J~iLK8Uwm$X5-x6D&PU0Vkt$5GkKD%P;Q}~S-kM&s>Tc5Jn`c%c%r!KZW8)ECz6kDIdZ^q+!JX{pJ{c2+C(@6Xs zvGwUC{*l=FOcMV>Y<;#9fA-l}KkHKzyMAS{^{FQQhS>Tv6Msi+eR^W+GZ0&!k=Xi7 z#MWmfwmu87_1P9%pIx!_$$l%wYkkIIkB28Y=6HCXV~&RxVvmQnbIkGZuGr(@Y#NW} z@o*u>91j=89uL>V9uL>W9uGIf9uF_Y9uMz`Js!?J7mrWoc(@?;c(|Bjj)&L99uJpt z%<*tp?D23V#~cs0#U2lL#O_ZcvHSZZ@h`>h?>mXV_`k<^+}}%L@4qH?e{UrIme~Eh zllc2$_xEAqpNQSxXNi9)c7NXyyT50jkM(zdFN)pYOJeu;irD?VCU$>sh~3|tV)yr! zIMY)6LOj05!|P(VUtMf{HWGhVY<>EPe=N2>)5O0NTc4f8U-<1r+eo z8)ECzO8i~1_34YP&rocA#$xL;6V(ZgS{3EgTnI!(X*!nCJ|E}2j6lSr$u3t%PeJWz> zQxjXChS>Tv#nz`Swmx04_34YP&rocAMq=yJ_+qTD$HN<9*S{yWK7+(R6oZFHQ?d1#i>=R6Y<+gb)+hUNjK}&E#nz`J zwmucH^{I)iPhD(%cElbJ?~1KY`TvN=w?0*|{Y|m;X(#@^*!m0;|5R*!=81n>Y<+eU zfAK4^e%7ZXcKxbi>r+qsO|kW9i>*&rY<>D->oXKvpRw5bOvTn`F19{PvGv&&Tc7?{ zV|*SD55$gdCbm9{#Gn0c+}`>W#ooRmwm!AQ-xUAD6?oouE5<8{zbCdngTy};Tc2s- zUx=;GcH(D3Y2GhepQ70Ml*HDjBDOv?vGr+)txr>IecEE{(-m8vp4j?Se=pY0t2V(d4 zk=XrxB6feDiQV59V)yrLvHSau*!_L*`!QaRhlgV8GZ$N*W#TXVm$<$4Sr>czs@VF} z6Msu=eL9K1FSb6z#6J;RpIPEximlI1;xBw7*5CT9i>*&tY<;R?>r)q7pAE6~X^E{* zM{Iq1V(ZfvTc7G8*3aYNn%M2z7F(Zg;vb2v&m{3L#MWm!@fW@sk8gd}#Xf#TY<+5p ze?x42T8Y0awm$vDKN4G?iP-wg#MWmawm#cp>$5AiK861pzJ9V(U{$ z{B^PQ*$`Wwme~4q#MY-Lwmt)~^%;q+&qQo}W@76z7h9jsAH{e)9`1@A-&kyYrip)B zY<+eU|N6J${;f}0?ETlp)@LK}x5d_{oA?J}>oZFHQ?d1#C;n}*_1P6$pTf6e{jJZs z*!q;k)~71AK6SD6*$`Wwme~5V#nxwi8ISMra7pa;Yly8+Gx7Jt)@P9TCt~X}OZ?kn z>$98qi+>#JXMIXy*RLwJKJ~=k6kDHm;_r#A&p>Q_Mq=wT5nG>`*!nEQ)@NI6eRjpx zr|_K^pYi%DJP0_zU8W_`Bks`1(rR-#~m?JQ9Cg+<)--?LQN*+FR`QEq{Mp-|gEFJN}N??Kc#= z{bpjvzYshAZL#Cu6+8aIdOW`4Ul%+6ve@xg#g4x&cKnrxoF9Kn?Dz*_$3GK0{vEO7 zU;lx)KgVAaJN}l~@pr_IzbAJ51F_>Di5>q$?D%J5$G;Fe{%x`2pFi~c_zMqs*ztG7j=v{%`~$J$ zABi3RMC|xyV#nWo#QF7Ou6katd_7`rda~Ptx#-Dmk0OBV_F%4gvfHC6c6%_FJpFDD z=8h-3J*Hx}2Xn{M@Ag=V-5$&xPruuPx#P)h59W?1yFHjYp6vEu?s&4>gSp_zj-R>T z$&R17-pP)ix!uW*pSj%0j-MBMvg2p2cCzDdh#h}Z?D*Sa$KMq@{=V4p55H$&R17(#ejWxzWjvpSjSD$&R17&&iIT zxzEXtpSjP;j-R>D$&R17&&iITxzEXtpSjP;j-R>D$&R17%*l?Qxy#9pe=2tT%uP&dj-R=>>395dvE$FKiGIh=+}d2<@iUh;+3|P9 zj(;R}{LGEb^&S6G?D&}*n|{a7+}LEt&)nE#$Isl@WXI3k*ks4g+}LEt&)nE#$Io2Y zWY>?mn#pbt=4K|lJ(!D`?Dk;pWwP6Yxt7Up59U@TyFHjone5|L#cmJgPNv`Ou_1PQ zFn2QjZjX-G?ZMp1^t(L{(;!>kHn6D zB6j>UvEyHe9sjo2@$ZTqKXduAevY5Hd&!QUxq8WtpSgL-j-R=B$&R17cgc>Qxpv8p zf4vsj@t4Jpzbbb8b+O~$5Ig>s*ztG7j=v{%`~$J$XRch<&+#)iF4^%j7cSZHuiqHi z@iW&g{f?ixZOM+GxopXfpSf$vj-R<}$&R17YsrqExogRepSf$vj-R<}$&R17YsrqE zxogRepSf$vj-R<`$&R17XUUGAxn{|ZpSfkpj-R0eu?D(0hlYYnF6g&R5*ztG8 zj=wK<{6n$hAB!FTRP6ZYV#mJ}JO0^oV*MOHb8E7`j-RCwBbIjY+@b zXD&>#?CH;=SBzFAFeM!ILuZbN$b6?W$_?u$K&)k>vJN~ZN@iUht{f?ix zE6I+ZxhlzyKYM;;$Io1p^gDj$o+LYd=9(lse&&`WJAUStBs+fQmLxlV=9VNoe&&`W zJAUStBs+fQmLxlV=9VNoe&&`WJAUShBs>0^*zq$LB>j$mD0ckJ^+>BRhWPrXxFk=B6V%e&(hlJAUS-BRhWP zrXxFk=B6V%e&(hlJAUS-BRhWPrXxFk=9(ire&&`VJAUSpBRhWPjw3t%Vl%SiuZkUi zQ|$PAV#hxaJN}W_@lV8#ei8rkue#g3o3)#!Kpb+O}TZZ-NHe@pE6nOlv1$KMk>e&$xA z-|>&cj-R>G=y&|gjYf9-%!NjF{N*E&9Y1rO(eL<~+l=h^nahmq_?f$m?D(0xjO_TC zyNvAknY)ba_?f$m?D(0xjO_TCyNvAknY)ba_?f$m?D(0BjO_TCdyMS(nQM&f_?cUb z?D&~WjO_T=Tag_cb5GIl_F%3lvfHC8c6*G(ZV%>;;`(lnrP%Gk+)?zqJ(xR+ z?Dk;pD6-pwxueK#59W>{yFHjYitP4a?kKX`gSnu{j=wE-{6n$hpNkzob2)K)$6q=b z+40xKj=wE-{9Uo*?~5J(Q0(}}V#hxfJN~)Y@h`=We@E>2nQJK@KXWUQ9e+*i_?bJ2 ze#g&TN%{DvV#m*1Nc21Y;#OqG&)i4!JN}B;@iX@k{f@sOcKpnJM8D&2iyc36AJOml z`(nq>Tt@U;f95VCJAURWB0K)#>Bx?sxrpeu{>(i@cKpmWM0WhlEkt(w%q>KA{LC#x zcKpmOM0WhlEkt(w%q>KA{LC#xcKpmOM0WhlEkt(w%oRj-{LBqRcKpl*M0Whl{X=&A z%=JTd{Mot4j-R=F=y&`LvEy%w9e-Qw_`71q-xoXnq1f?{#g2a}cKma(<7X}&*3a=X z_YT?dGuIB;@iVs$+3_=%4%zWDcMjR{Ggl7T@iR9L+3_XYP}H{MlGot`qtle^c!End^jp$KMq@e&#Nr z-|;h73EA;8HwoGCXLm-n{>(i>zx8LX5whcFZV|HeXD$)4<7X}rvg2ni5whcFE)lZh zXD$)4<7X}rvg2ni5whcFE)lZhXD$)4<7aLVvg2ni5VGTE?hmr#XRZ&j<7aLUvg2ni z53=KD?hdl!uZbN$b9K<~_?u$K&s-h!JN~ZN@iSKk{f>VqcKpoMLBHdliXA_5Z_w}f znQMdW_?cUS?D&~WgY5X3JA>@_nJa_r_?a7n?D&}rgY5X33xn+VnG1vL_?ZiX?D&}r zgY5X33xn+VnG1vL_?ZiX?D&}rgY5X3`-1HHF*gI*?ZI3OWVZ)%FOc0H%(XyvdoZ^G z+3mqx3S_qjb0?5}yt>%!!CVRSyFFTBw+C}2(C_x>iQOK|l|aASVHp6vKJS3TMBbFO-_dB6ubJdd_Kj*3^JATepPj>vAd!Fq0 zIoCYd@pEo@vg7Am@?^))x#P)>fBoH&9Y5!Wr{D3n#E!oscKkiD;~$6}|48ikCt}Ax z6FdHe*zs?R9Y5!O&)1K0lat*ZoQs_7_Tb#(WVZ+B8YjCwIJY?2?ZLUk$!-tM9Zq(8 zaISE&+kxpNk#;QtbG5 z#EzeHYqNfipL1!G9Y5#JCOdx4l}&d1oEw|$_&FCg+3|DkYqH}nemJt@=UmtHJN}B; z@pGzaPY-xoW6&RtEvsttpL0*s z@Ax^_G}-ZUZfUaP=Umcc$IrQ>$&R0MNs}Ev=aMEne$FLLcKn=6n(X*Fmo(Y&b1rGJ z*x46*Dcxcb8cI*eB_&L`r+3|DkR394aV#m+9ROxs89kJu*T&nat{(;!>b1qf-9sfk^_&GN! z{f?h=p^_ax=RPGne$I7DcKn>%l&Lk%$!-tM zMM-vhaPCR6+kUV#m+980mNXW3l7sT#WQP{<+xkb1p{u9siEl@pCRl`W-*# zRwO%q&ZS6p{G2N& z$KMn?e$I7BzvJ(U9Y5zfq~Gxm#g3nI7t-(eIaeXs@pEoMvg0p(DYE0|+=KKxe$F*W zcKn=MknH$5mmt~kb1p%$W z@pEoKvg7AmfMmzdx&O$HpL6|@9Y5#xBRl@$S0X!p&fQ19<8O)`e_QPMyJE-R7d!r; z*zu3Wj(;k4{ByD6Uy2<+=iX!e96#sUBRl?z*zt2NJ^CGgPwe=|V#mJ_JN|6`|FL(c z;ZYRr;{PWM31JV55cXjYTL}BG4|@c}h@e3Q!fKE$fIv`$sE9#DgP;Z!jPL*vTq3wc z7LAG+P%xrG6x1jP5mBR{1Qq;Ob>01R_xCyfbIzOJc|~0pWIlJ_xx1?}Q`Iw>>6q`g z`>(Hsr|a4M4~Xsl>ucfZ?RNh|V!QwPT6lW9-Tx%9-G6;8JiXoSf123tzrOaJ-fkaX z+^5F&c<5`f>FxG-=xeWO+vB0HwWe*4hrYI&wmlxvpBdZZp|72$x7+(m7Te>IDz?WX zU2Km>rq~{jY_UBaxng@f^2PRe6pHQfC>Gn}p|5?WkI(MEzSfzx-G6;;Gi|&7`dVh% zcK`LY%e3wO>uZ&1+x^$qCeyb2A9>8!?!Ueknci;qKSpf#Utfz%Z@2p&FSh%yuSKS} z+x<@#+x^$qBGcRL{-=xW{_AUt>Fsv^^|i#b?f&a)hiTjWkNm>e?!Ue^nBH#pUtbGM z+wQ-<_LsKZe|@blZM*;aT3_0B|Mj)LwC(=uYkg_k{nyv}(zg4rul1#E_g`P@OWW?h zzSftv-G67>uYmq+x^$q;?lPJudltOZTDYaYfIbizrMDX zw%z}DvE6@tEiJv>?tik_?!Ug4mfmjnKV5A1Utdd0Z@2rOEw=lwucf88+x^cM+x^$q z#?ssE{_AUDY1{qR*S^xW`>(HcrET|LU)xIC?!Ug4mA2h~eeEi3yZ`!HRoZs{^|h+B z?f&a)RcYJ(*Vn4jw)?NIRi$nBUtg(J4q-`Icx~W+q5*a-j5B}2o@NB9qi z1;T4I3on0rc#G!Y4I={KF%gZ!1L|u_^|g`u+C+V=>v9|Arpn<0k%nzFraj4NH2d9RI&m{UO(f->Sajx`6+fIsg-F9zMK%cu+ZbxV^R4@Q9}2QT|{rb%=rR#u3fJ!~NF)A4%{Qu>(L4#V(7@E(iV} z?((eJW&i)HT?Qlk=gclc|5v;08sY!h?D8%3ll{N>VMa&zn?xptH&YMddcD*GyK#8M zh*nvvDRTXqPq5fK}%9>rh# z%)|JObz`vldPGNF(vi;U#&GrZBOQ5FNAmQokh)Q*o~Zk- zzIJ3@61@6E`M-M&^M9JDuD*8kzj-D2e;P&ga@EzBQ~zJQPJQ*|)c@6QD*hMu&#S*- z_>J#OwPn54dQNH>_`RWtp|Nmd`UtJ}xt`b*QiL0x`f36bhRh<9rYe)JO zAN9s0^~SE>!qn?PkE(Zmg+=&(4-1qjqux_zzZ300zN$Byt9P#b`VTieKUhcnK7I8l zcPo&1g8Gz`yR~kurT)_4TkfdOSFgT_=OVvbITKGp{^dRr$9^YDTz?wM-4=H<`M$T^ zQT67*4koTYz2$DpTba22RFu1wZEE8B(^~E}sh){vBRrbJ%+o7%|u0P%7ZlO36k3n4jRVw}S%0;|? z6BE~;Vsp2r>Y8{d@(bjEI+S|G;e%Gdu_k3 zB+nb~BgY^4jyIk+K-=$2MEtXgCZ6!FH(&oX2&+Ewue3AqEad;)$i#DzUsb*RQ`bpF z{Fhxc>B=yY;JJ;`&o0%Z$?@c&el0nkWYjMw$D==m=x&!}KGdI%bhr0p{Pm{}-L0w2|N7IA?p9ll zGY9d3eRP)Jr$1fkZu+lHS>ufSlQQq=PgAv;02&X-;>$Ugm%ODM@!5 zCH;*<{AZc>@(^Ddp}$+*uTa0;AQRW0vUImc<>#1&IxovSABp_7(%&4!yUFons83b8 z+n17`hx@}r19g_)7l-`mG7lFq-q_@qV!uPfO*|L*1ACcx65?xHns}u8w57XsuVdo+ zQ=jg3Z*>#bpGI}JJelY9r##(lYgsL|USq#s$_nl2# ze|ps2iew$ppKA3q>979us=MjGW~z@O;DeLb+>l*I(5(;_4&s4)AsuckbkqRFKNiX zLDrE>=rTz~r4-Cm3|as8=UcWWTWqd)EI zZVMu`{Ju;)?vBemtUtZ$Zd-#|Y8}CT$I5!7KdtL-M_X&D`lvInnThL93%lFLGN0>D zF}vG`*J!ExA?gp6aY#X(pURnh{b^%&TNGyE0pveB*u?dxi{0(K%=3B3KP~foJn}co zd1DFUTkLg5ecIUF9*}u8gz^7V=HV3N7sxyrIOMM4^L^Sx+wTh^e}?>gOA)_Y_M3(H z?if=i9`#e?d|Q9o+1<9t`L_NPw!77>tfkgR6+wN9d`jv+Gh{ifgop+)B=Q7XhPh-1V1?g`T;Rle<)e4dH?yX5|(ueR)N`mams{)Uj>uZ4*hBmT0SpX*PZyIV_H zchV7$s$lBqPszJmFF8*A>2r6>k)LmVnmg+A4ezJz_vuf|yIYCO=W(d>uslzRLw=98 z`n&x;{i$|$dr0R0LgaUr^(BD(Fc}B^X@7T{9Hpi1&&a>Eyou)^|1nt?Ldb7c+2rf1 zTf5t&kd~^CIw*vQWo=9y{po#oyCmyEI^r3!uB9GvXWJiYRQGelkI3Ur zUme`tcF6itg#3GD{)t0>pO*Q&@KbjcpKni7ZT0*b@f9-9$9(3^KPr!3eKm7;J2Oa2 z-TzT%bSo40p-xBp^&jM4FY|l?@*B!LsjourZsTPBPep#ZVmtyYX5u@Pi(KVR2_`-E%Ni# zSA%f3cjf1zud?876=WQu5$`GWvk|W>xLae{ufA%%yJf~|sr%%@S$VWU;j$dDu-`)20H+70| zJSSz|&O)8p@_Zp4@egGlExI6`guB)4tfkJ|aXfxmzw}il+^v}$ zr@q>SyS0>cEr|T5Wxmx{&v3UIvhL`sQn=fBnQ!&gGTg0^^jBXM!`*7i{a^p}0(T4c z)AIWwQRlSGxBBWB?sjh{E%i7>zWyupIv$VwG+B3&kzZTZ9es5Tce_|iOC1m52~j4V zf%pwF4ncL*4R=emAJ_Q#&XIK?`U`iq&-Zi#ZPhQ-nJ4Q)GV;60{Gk6@guA^a&uh|9 z=O$TqLa6i7HTt{N;}`iihM9N<^4AV9as5{w-0hG&kH|&-+ucmQzG{iPEs=FcUk$|F zPRqKWuTtV}&&qmKi1;B{FZ5MU-0eV3Ex%7+O~l=1$oi$Pa^i01Wqr|CGjX>LGJpEe z--EKQ>8r1}TTK}UeN_{88!qFJi2B=P-O*P`aku_54v~m&YNE6JK7Cabce}=3H<8~= z#vu;*`EveKi1_3#x~e)4M1TL5bs_h-d#^rUIXRw0#Lvq8Kk|e({{@-1vyd&~M2 zK%GBZ>OA#)0rA{ACZ3LXHF;dbVZUMWbJSOFakt*mUwu^>ce`7TQ(vvc-R8;h=&Q)M z+sc5JT91(bPqf65f2*v6`f4xkHci$keH9vaTUb_0{eA)Qt^G}0Uj@hA#`ZLEeRUak zdt25KebpOxTQBQKI`a3+I-;+l<8DvOI+Bn4k<#CI#9x$kqyX{#^86+BD|dCD@3hS4 ziC=r;6=c7q$S;z4I2-x(WPQm){!CdH(vW{j=KmPP7njk;q1Io-UzDF$)H3gJR_ku^ z_0@9RZF@%(*H`gzw^6b#=&R$n+i97%^;LV^Exm!3n%|J$S&ly%`6sHH{6ys6BW{mfllfm?-N)TB`)aB60>_^gG;w`3A9o8$e=|{kOKX!KgZ%E&UwzdgcYC93X@b2@A^$#Ek1`P-BkN22x8C|M%6gH6 z{Pr@>2asQ;p8kHnFCY26WSvSue!t!(UtgWb-KKXn@u=_IQJ?P{na>l7yzw=1zOAoP z)`~gvVE4pw3di zUqJrmUM8Miq`x}tq|EdBYD@0cP{tvM_*XK|=ObRBvHos#|1WY^QRi>69_gz!x!cDw z&!?l#5E%!3H79qwTvkhs^GSEq=Nl*MQPe4Ke7qcIj&*+OY`aP3rDDWCZ=`e7I)(fB zTA82ot*=gUXo}PisDK>K|!ljwc%Xoi6idD)L*)@swb{N2;1SiO3%y^Jfh5zY8<@naKam zZ{opa`m59K?yGOB*GbT?1@^p(I&EcM%|*YSk$E*8`7P{mK>daGyo&rKmeu<@(64YA zhiv5Uk$E*4^}EVAU=NrSQ7HL%XxAn;_YO<%|ZNKnNJE4Unuix2KHMd^GURI-lY3tS{FH< z1k{;t{XG1>QpDf0=T+2SDf4O&_5B0&e$?yvsPnYUpT&rO+{NVQqkc{4Zw%^xD)Uk* z>iiKfbs~|!O6E`V{uG^K+HULqt)AB-zq9l=AN9|d)!(PyKZE>XavqzG$6fLOlV6Jb z+XE(EXdRcnZQ2cTJgJDM$@xQ!^>eeceZJ>9>)Yyajr_LO{?ufE{O9F-I2-wITK!bN zZ^H49>0#<8pw8=UO*|Fx3(ZYD4)wp3c|I5U(`COU$p1-R56MLSE}6G8k$558 zJIFes|4O90eH+qJuv=-&3-db$6QTTy?%>$e_01pP=9E^ z)G0-Np{xsWha-Ls^`a{Z^`q9>Y^lj7nSb1vQ$NhGatY2xU-%k3QkN7fK z*RrwS1@e3?GGOn~e0@^Z-$c}zXIVX;Lfo7Wsn_8VpDXJ{4C+5(ubaqU<=6XH@2^9C zMOoMMU-Nahe3`Ebk-t~QE!VpLI^Xey%>U;1NKSl~#1nA;ITX@4s$bUQ)yeN9kD~zU zoAXq4ev5e7@}^EY;!`B9|BA7@6$MRx9QIpHo;M{T{#rAWUx0WA>+!FipJKn2Wqr&< z{&TV(6(GNbJa0-x{+=+i-&EwUEo0(7^lNBe6VFAR1nF-8@xNq!Nk)9BJa3A}e#^@^ zWFvo)HJ_^UaO7Vn>tj0di)DSuM*e-WZssGuPMGOeJmND$Ca(X=w7cCf*u>MCx}!ed ziasV@fOr?neqWx|Kj(W^%eq;Jcu>~6ER6q!uBLvBHD5Y)j>!2#436{YK$9P^<^v~x zgw)AHoh{aQsrQp0f1tg7A^%aiKNn!X^Lv^7#-q+fd0nLhb&_Pg$VC31GT-JQezdHq zpNcyD2bj3eS_ho|?w5Hrh&lmTzlspAC&yWY`axM=0;u0EVD_7iI)`O_DL_0R>q`#m zH<$iKp?+uSZxZTU-{0)F1o67k-zdaWWF3h^{TZ^3s8S=O&M*JtaA7&u_h|H5g)ISrc_oLo- zgn0ilCLWDC>m)yCxj8=j|3)E`pM^R{Wj-{YL$b4dzDMP8nuh#xa{Ou7@AhVhj>?+|1%IDEd9+v{WCKE7a)Iz%>N09|0DBc zA>s)#|EF2s=Zt5*98Us%E`0`@aZ9qs)yZEg=l?#$8_Rxk5WicVzvN@TZ}m3y(~&<` zo=3zX{+v87C`5dmod5f*^KR!je+f7BbFtqyWj+rf|FX=tsi@ym=J^2fSGPCy1IWL@ z`uVBH1@c$Ox{#0jaOqbR@;k_SQG(-NU&-t@0r|H}f3r~kkoEn3pYK6uZ1k-oGS8d$ zp*Y*7%Qz&U&KjBLQ?TDt_IiZ;*R6R?y>5^EF9LdB>V4zZeCh1Bxg3wrs^`Qj$$qnt zUnih*)az!W3#|K@dVeYE1f;*w$Uh+S zd>-Oud`X?Mx`Vm=pZN7YxUQ-b_ORdtSfeuQ|6%>RYBzqOKiJ|Fql%i}Z! z@fLD^9&N1y&hd;aXZ9OH{BJ8oo#&&!8)V*#u^t~zo&7S;r=d<=`*{kEr?MP>67t`* ztmZxB2c%zF$p5mbIsQn*tI6Xu0rAQ*4sob|sEVnRf&6wdK1IksE6*>|@N;P_roN% zgHk7h`87-LH^;!J0SKI*9xV(%%B)|JKOtH_{qE zecQCGX#G{KQ;46H=hq4Nd3BQGkGJlRQbc_@ChJ!c;sdLh`ZC> zoH_OHjWYT1h_ANi0UYN;A(LN<{9mk}le(WHKD(C5FF^baInPf;JgS_@&&Tn)7#bk7WKc7`7j;%pUZrhhx}2p9wj6Hq8z9BJhU8)`f|UlQ`yM> zRpy@*jOPxSC!>%bA?rmV;+L%BQ_p{KoMs+Wzb8U|B^jS$ag|{dM)e)ay>jZ&%sGqY>XL>r^!M`;E-EdB~q2>q0T&t>yVn7LI3v zJl~12<}+s;itCu;NkW|lHB3Ab`S;5D5{dkftS|A%A1~`{68g1K))({nHs^SHNPkOF zf2OQ2h3MC7vc3ed-^W^-<4;GOZ2=RHMt*x4hamD7%KDOs{MTiDDMbEySznTnpC|Xj z5bn2UW!{do`t6Lv*Rn1YBmR}l+v$k+s%QF@g>k+{>Ibdo_fGw8*7~H@Db#tlwy6_^ z{H7I5JQw-h!)){KsWI%16KI$T*jv&KwzsAnH6Vb)u2qM8+W%`LD>jV_v^h2QICdj6-6`j+n1g z>*}xSbsN-wM%JCokjbe{znTF zPeYw|8kxAcZkE1n+I`XbtGfTA&Zn}z6eE7Fg2^vN{jb$SMc0Y3#zWsWt)lh)>UAO1 z+0sLASMS3_yq&B^xu{=D`Wub<-K4+CsMA6ETZ;H*SudgyZy@~*qJD(*Hy8OGrN1HM z_qUE)y$=EL)(uU6^R4@x85{loEwWA}BVJDK=LsvETzzXyNdK=suVFoo^=;GMlJzAH zb#9P#p#<^eGXG~HzTP^|R`&VSyCZ3M{_LSqyP1oCK~DLuLSWNnfFSt-!Ej|i$ndFWZug}ohdTU7a^V}^Ijh7%e)sr{dZ*E zOFen0NdaTCcmQ=i`W1 zmiaj_+?zjG=I0>to5^{8DdM-c(ciDuYs81hJRFbu(;`iN3gZ9B{1$^c&B9H7>I(hU zY1{ki+v@cP)LAX_c`@qTDCSQ2)crz0(K>h}q=Yxp z=AQt5E_pH!r;KoN^{xJLJW+_Rm3cT1@w&1u6k@-lhzTcp29$S)`T%|ZThIi7s{eD5A$jx&Th7iFGLLY+=B4r$1r6Km@D z5T7RdO-KCxfXRK-qri5P-m5#ho>X|XnB*LgZMSF?j)nmEcy8+Kcv6UY1L%@FF~CXGH=HqK2z3( z0>oR$@fTpflbY*&smIGmXP;I?){#`y`BLWpJj8oNnL1ghKSajChx&8NnEV9P$*5@J z**FimK4juW$S)`3;6wbmjwU~V{SIwo;#tT)A?rd6@|QF)`2~otk@KiH{Jb8u*RLD( z_c^Vr98Ut`_sY8C8|CEcTUD#-|JCy&qQdcQ8i6|2=(8pY~oqS?| zdpSsJEu`$~Uvk^fjVvtJ+b_f#

DvAk?|s$?P|T`~$M?Bq6_?j6)Iff0A`4I#Jhi z+LGG(wi;)|56U=%@N>KnGWm&P^jD`Hko6)3@m8{aGm>ok$|B7iz~UZeBWc?jY=oO&i+fczI~ns_Smd&#MR z#GA?dQ-q)I-!h-4-lq5Cw4*X_CysSu`qp$go>JsjmU%4tVQ>DW0ov+%BdGI!7ZcAz zod@ffcpCCs%k!5Q#A9WCNXC9o_B3@0kl#<%i&Df#%kz#L9M9N*sS_NhzdG$lnGaJ? zXNat8(a7&F>rOQCZ;^E;5%~+`@tBAFkn}4O`A^Buw;0F2LVhms$j_2-%S8QqWPOQ2 zeiP|$Jn|RIyqb*sXJtMtM*h<>zoj7mxU3`5bD$%*M(&D!Yy z)$86#`m59Oo9Wx?{0j94HZbwRB>mNC0Xfd7BqyeCy(;TSF5=zgb+%m8|2Ry4ml{vx zx3YgO=-1f3CO--Jlcc}dh*y#IC>{HKytS!QjQkoh4nf3c);Ib2h~F&hS~2SXChJ1v z1pR$Zd%|AtlAM^n)l|kI3i*=<>#gd%6!G|`CZ0J_e|6epvQ7mNpC;=|G2&Oc>hD#9 zjra#L|K}mTOy>Dy#GCdub)qIY$D(h&Ea(40#AnL+e+l~aW@A$)75Q!Ccyh4cn`Qn_ zME;vHKPMvpu5eR76Zzi{FmWH^=KVeD{Q!u+BI`vA>Q|8drXxR3=JP`2p9`4%CL{k2 zS$EQrpDpuwHu5Xm>k;BbGN0!lK6-%JZ{lSA)oG!CzOCMuIK_$STdifkg~)F#^I;wy zr(^o-?^3TrqRw5iE@Yuj6`9YIkbj@d+mVQ0-^0|;L3~qN6E8&kY;zOOzE8^GM`BDf4*@@+(PyQh5cZ%+Ca`i29T_JUTg81ES^j5Vluhd_iwn5f~_~}ke-!kuOQSa-R z;f>dl{37Hx4d^`e{sHFO^FQ)8%i|~!#}n1l)JaC2iS0~03h}>W-pfUNw#>sth%fP* zI+-}0?fpzVFjIeZS}&Qm6H(`w%x^yAXSCJdt9HWt<|ZCO{*yAFXCr@v^s5B%9WuWa z;P}_ed>)7TpUV7}hB`SRb39SVUoP``9P(>Pe-n^@vW=-zfc)0d-$dk}ke|D6mi|7c z-4m&AtIyv(>csS|YeM>e^*RjlmvuDpG{h@N{kYkByVLHM`8gi>z2rPR68RHb>+e;+ zA4h(7nV%DpKc$?>PeZ(Fn285b=WSUR0xR`)r*$5zZ>!INqRxDo&r4C~v2G?m3;8u= zp3g%5TAAmIkY8Ko`FO+^$UL8c_#Bz%Q&9h!D&}|!kiTB$y#V5)WuDJL{8gFf3sC=< z%=0D4zcJ42HwE$UVobag@zFBRXQk-vPJ3DA;j}qUOyBAt`wbwzROaCV#9PX`P>lK$ zdg*Fv9Y_9`u_m5?_)T(NU5fabiY7lWSATWdM`iVG^*%}LH>sJ47vcU^Z-9v>q0Sze zhcmI?GBW>%kY7!XKZN||ElvG2 zDDyya4exR8vDc#o-nd_mGYN5Xy(jfPhlR+$#vFeP@{h^7mWc5gA@O45{}gBHWFS69 z)~O)&TUy!VCn3H<)}v_DIUwt46dsS=WSz=F9rL*zHQ%Dnn_bO*(~#d)jz10ghh?40 zLw>BRQ!$9Il;LeiES;nCd@%ggOrlsodb6Sa<&lKS2^@6>wEpl@8t%Y6m|9+nj@mB*T zo`d+q)lEDf`+Z&>U#S?Mr)1qsN1e0nOr1EypNux~Ld1QtuKDiL+np9J>sl(}$K?K> zig9Qq>s>C6|B$SAA=DYxS?^1Iz6QtBT8=+}{86&r1(4rU*1II+e^lGl&qscbY9=0q z{BH6*t^~(_z4{UA<4i#Qr!`GH7eAM2vYuvPzmzfZyOr-e*Bb+P{Hw9(!5ZIyq@iRoM4%eonZ_;a$p z$0L4O=EG#{_cNLI;&H!fDD!hR@^9*<_pV-lK>n*T@1-MuxIBKdk^iF1d-=$3B=_@p z#AD^>UV!+K%I0`dAJbo*79q!znBm0qt!lF0QsiH#q_?W`cH|$3HSt1g|N6FRLk8-v z>UkXMl$H4{4RzkFWAbAVuP5_!0pb;9zAZ(3h|F&}*zW^!oWWJ*`0W4hk@NEu)Ojjk zjwc%V<>fe|kv~P|$wcJOlX)x;`S+GJ^&^p=FZ<26>ggQQUXgjM82!4vr{1o9-+?*@ zWFE`Jez&$W`7y{Zka;W~`I}`POGf@}GH(|n|BY&qTWi2RafCO-=C$K`dKT*Ujxapt1_>8hqqDe{x#{5%QqKjb_-8}Z$8Kg`DCccYx2 zr(?el1-(LlE&CIX}-we1MEYG3q}d=jV}Y^nRT7w46VuqfS#9hbZJ1$m>zL zh)?gJYpUO;KjGBYw;qx6nIPhms_3oi^NEOWm&aXJ4ZYoIZ^(M#Lw)T@>w%_z4C=ou^L#q;f9hiL3y~iq{Y^&x8JXwPkzZ5#n~nU< z_IiZ)7uC&va}d8l`kVNa-tM%Tvfs#SoS434u3M*m&zR|r-xbhS&!+Z*Xr#~t0u>p zfI49^|Cb`3UR!^!I=@2w3bO75QU8#v7g?xNN%~ui_^(nY&H6bz#~CT>OFs7dsjLez z*ze>{<~UPPzk!THB=T>Obt(q=f6BTLkNi(+nfm$2?-XU?3CQmw<4}rt1-W09;OE=V zUcc5kW1w%%m*YuA{5n~8VxIQq*OB!lv!*xxfUGYe)QOXI!G}8L?<%SDPvnPWT}wcI zb6H0+to6a!cW-&Tc?T#7D?F5{KjYROb0yY4hP z$j`IJOUa0G+2^??s(q^86(Ob>;+2 zem3$a%i}H?`GXpn{8G$sLwlNd6!N#papof4HQMACA--JZ&rBT8PC5S%Wa;m7+Gd%D z6H%wAw$4$%55>>xdzpuQSxyaoYm(g0eW-Im=HU?X^JE^*M*fxNx|({tBYvu(i5H+> z^W`|>Q2(OL!)d6qPv+q$ZR9wM5FaK#$3on12Z!|cs_PFRKUUU}xQ$M2earmaAoV;B`Co+Tt?K8F{7EuC z`IyIM22Fkr>NJpbBoTF{TjycwI1&F_=G7qTJTK29@{r$7jh{w<6{6M{3y{?G-H)XvjK>Sc+lV6PeE( z@;ssx@g;Rkeqgiy>a-p5Jf#rF(^%G{B;=nhtG`#BZ=nA80VW=Lw-Lx}MXXwAaC{PE6lA(og@dUN1%di*i3nLH-A_9;G9{q>QN(kNg*9 zT_{2Rkme>o6ZzZZ`9&V$wPamOMV%_LUih+gJ*SPA;|Ze9eUe|W#L3mSI)(KA>ih@! zXJwu*!hX$lmeu1F`>iMIPCDwm-OSW4K)h!I6VE~Y+A;*Q710a)G0xH zf0&6!AwH_FiN~S-E%v&G{P2z@KZyJl@;X});*XRw`FYRluTI+#(zn&;O)&nq4mR;5 zVK=lOII=x8!+265?mA^8od^b=0}r zeqMn5N^(4f$T!!|Qs)E6uPeuyhWx~?<~Z|^zeU!C7{n(_zfus-k@X@0^_xh4bC5qm z`s+hHN9OYk#OH*Y?S#zp1*o&sUXKvZmU+Gq@h};OwCzr9eXFd! z?!4fQ510M=5N|H)MGoTK0{Z*a>-MPMN9OZ%jE1Cb}kiRQr@)MB1PS&XuOUWu0q5f`JU$Sug`7-Y% zBmY~O_X4PYdz?9*Y~-Jld9Mih&le)Us`NJz@t)G(BE+{=l5yLizdG$_ znJ1HXIx&6gWI+F~o<}48Yef^!Mf^cIFN(*y(B57bu;2DAO`QzXd0*zqAmVLgel9}1 zoXo?Kuj+bEyIsz!^RVAB?R1WM-2nM_$-JG0`bmvUehl(|lld)%`PEE*GV-U&d|rV3 z`7)nJBmW!g`K>y?!gy|!dA=0=>Ll}gBI+FOWR52r`+cyji3gc4^IjtISIRt}iu^$` z4yDL{KFZWjL;f0>=VM;e+nqM9s=lqx12La`Df4sW>rSq|^{LFO*{Jii%+HC)50iKf z#lRP znwtCo;zMM;$VWU*jz1suzo}yCM82WFI_)-DUs6yfLi&}9c(cCxd)4bj80R*!9%W*` zGy0hPQq)=A&BWsouPEbFh`9MXg6j8rs9#0KCmQ{lX|H#vlU&p6H-P*~GCui;*Os4S z27bOn<4m3GT>aH)!)5)7M|`xbN2Q2=B>gSGcy5vPC<^)UvW^rW{aG zI>)GQb(Z^E5c^G(^Z9t>KioxsmzvB_{}WkX(vkn7%>Q}FF9?`A$;iL1j>M7wY;_aQ zM*i2bPDLU9o~$E@h@X=CNgDcFeSoPS#C~_mx|4}ImpYsLV&q54IHV%KzKlaA@*@JK zPA>9yM9c9YeyN&?=OJEQ#vyr^-tM%vGCw5Ye%s4lA9p*s`qp)g^#AI8EU0s%tZSLb zZ+MN#&%<~=AnR8S>g<+vCk1sn);4vb5zmwJ=RCxZ$>TH%`<>QZjvx7cSs$}-JbPu` ziP@vS&uO*gIFnE(Pu8PIS|SV?6RdwAU%*x0n8wBHmBt=PdO1m%e7d zh3MCNK@$&RzqfZZ@pRO`AoD;p@*k7+F^K%1>YF-=$Uh_ZheG5}m32P}`Q>FCBKPWg zPP<^;RIhXLervCf$nPx2laBbcGH$`QoZ9v+zn;hbi{|%P-}E0_)KB+6VmjbAZ$kf% zZGNA1GX7u0tq1Xc5wGzdv3V*|&1XG1v$k2&nz|Kl#jQ!*iU+L!eLlVHRP%-VY+H9f z6-$t~wOpy&c6`0MUEMVfiKkRRwHWioroJY9ex5#S`%q>32=z44U)k=t z_CRH8`c}7XTMrlUV70xjx~-eNy`iC1Kcu!>4^!9nZm#V^)b`4$2zWu?JeQ) z@E!0R_+B_2UInj*&3UnNe6L~qJMbac{65$D{_nB z$Jt*Zwoisr;Kgt{yas*+-UELCABMk$BW0?y?~k$YK==;WJb!iizZl!i>y^%S^L`D- zyO5s;e+YjDe+d`Cr{Qz(Z}4R}LMB#wd@8}U;Q-tMZVPvWd&7g_;qXW}5grGd_w_jA ze+Rawz<0yTVDonxoO&79{v`YyybaEQUx(j;55fiTQTPP>9b63m3}1l%gw+yjHT(V& z0at>n!_ja<*!(>LXS`cudmP*q?gjUU8c0a0&be{5M=iozv=O-yb94DsWA>E*yYcz-{4fuzpVAJ|6uX z#O>j*`TO(E@h4*YICwIA2b=;gfEUB}!Rhd$@EUj>oCR-zUx3Z^oSpvXV*6Y0KKLMP zK6mBRJBsZm;P2pK_-FVMTt=R{|NH(2SApxmP2d zGWa1l1AY>I4&Damz`Nmn@Ikl$J`SIP&%!0}AMoFB8SD2|&iyeGHt$<=w%5e=x^MtC z?~``EzcaS?fJ5*wcocjKoCHsW7r={Q^S(Rhc+;`{QFtx95zdBRf?tJq!Flk0_#^lT zTnK*+pMuTjhn@bHVEZ5N-*6c{(Wv(C`39~5*N2oy08SV=Yg%jXgVe@-z=lEw} z`&>8`UIMRx*TC!GEO-n23T*z)gmb*_VtYP(82$o21)qg~hwYbuby&aN8DafC#yOs9 zaDBK5+zt-Hec*xc_3$mQ`JAY8d{eP~4s8B@qmzFhwx`37!fW7la2C8BeihyY=fV5o zkKiM4A#8rH==Ap#wx5N6hp)iqeT`1N3i1NEeSe99Yr*y5mT(;0748N1hp&Tgf^UN- z!pZO~coBRboDQ#spMf{RFT$_Gd*FBBeE3uN1pFQR6I=>kfy-L&1906RVDtC5o$a-- zy*}Ioj)7z0&TtPn1P_LX!z1BDcpN+#o(`{o&F6BQ@yN#ZH{kv7=kO``3S8Fu{j#&a z3UCx$8*Tx2fd|4j!V}>+a2os=ya9d@-UELGpMcN7=5uh)_*9bL2io&lec1ecQYXJZ zwhxELz~=YI&iBv5_B41Uybj(9o4;@2)PD!t55vddV)%EsjQqmY9-o?UW4Jxs3%(Y< z37!O}!1urp!I|(D_*M8_xB&hdJ_r8^N6N3r?eVGwH-kIEA$SCQ8+-?x3Y*U>JNJ(@ z*uD|Yf!~5Zg1>}|;XmNA@(Xo)e5%6%I2P^&4}}xqsqmffeQ*Z60e%7A1>4uPvio-w z+fTv2!9IB_h5h|i;QDZDI0z4hN5K=}6nF{z2)qu?hF^#G!AD?oy?y8Y`ZKow4Og(< z59#Db!!6*>aDO-f9tY2W?}F3eC*gm=J79BN45vSbvHb*m7Phb3VBdcttoJoJ^=iUR zVDtW4C%+H24~K7oli>yMGWc=$1$YN+uBYrA-&@$e4?YNg0-N`-JM}JM`#*4myaC7_ z-Wt9XShE+6ut?b3D1Y`g*U?6;aqq> zd>H-`j;v$7ocQn86Qkfda0|E-9D>dJuAT9|1>0|j?}YD#ABCTWv*FiZbDdA;cs|DV z6Yvl4AFyBEU}(=bQE&seHQWt0*ST|!Z#1?i!E@ln@PqK<@bmBv_-*(j_zU;1I z^WNX;!}0Kq@I=`BeGF&3?!k8Rcaog#Yp{J2yaRp*E`Yy*e}*r^m8|y@JI7NGZVh*b zfn*_Z5?*R9N5lC~;L-3Tcn-W2UI{-9o4=Fc9M2or{yzLE{4M+od>O9T z%sXCn;FfR~*j$&}Io=zveLOr9eg%FDJ_(!ap*#Dl*xY;k(Qr%HT<632{se3v3on9~ z!)xHZ@Ikl`J`JCTeJ#BGs|?qLTf&{;e((+O1b7a7FT4tV4t@#V4d=s!a4}p8N4E5i zPc$3@2jO@)5l)6v;dD3?-VDD6zYl*7e-Hl-hsSvPe+}Fm?g9^jN5fO#`S1hq6Yyp@ z4?YeT!x!PQt-SrM1~-J;z=Po%;R*0!cm=!}-T|BIX*%=GA#DE=J_BEX!&-a$Uj?oQ z$G~0S{_yqiZSXYMT))Wa-!g1p39o~z2i{>ZVb1Fd&9TDx5MT-rq2HF$M#k5 zv#`0orStu}vHbvi4E`QI4~Mn$jz?9v0o(@e4iAAx!;|1S@KSgsya9e0&VxUJzk^HQ zD{!S)@A%Y(W8kjvKzJma1kZvO!wv#t9N|P!r|S#+s)qvaOQ&m zwm%9#1^)|v1^x*B0zLy@gv$oK$6F0HfB)J!{upfU0{4frqz5TBPw}AV=L*P;H1o%$)9(W796E=TO#p(YcZ2tkS(Zk!nShyz~58n(= zhL^&Rz+2%r;1A$p_;zr)pf zdHdTCZUYD5!SIdnRCqSL7+wKC32%aP;Jxrc_!xW&{uRCgSM2Q_uV}bA9EAJB*Tc8L z)8Ga0{cr}n9^MAO0q=u9fzQF0;BtMu<5LrE49CJf;dpp7JQ1D^FNRmZPr{pE^LO%` z$J1VHKL{U#Pr<*zzP{e^ssh)CTf;+O^Y=BJ+wdpw3HS_r0gmYBvswl9zy3UKHMjxX0`3Hd z;OpS=@a=F4{1Chv&VqNt`S7>!S@i#e_(gaZ z`~mzK{4M-5TyKDPyqdus;6Cs$I1!!#o4@bq%tuSH{SkOAyanC~ABK;^Kfr&${(;`{ zxCU+lw}<<~L*X0YDez2q0lW-e39o~9z{lWI@Nckhkas+)!|mb0@C0}kd>_05UJq}F zcf$MN58-d%i?DyNx4-q_7`P`q7`_=!f@i{a!4JY~;OF3%;N5UO{5kv`{0sayTsXu# zUf;q$!+*h5;=SJ=4L657!hPZ4@ECY1JP%HTSHkPyt?;YxJMdxnI9v?>4wt#sJ6=`c z`fw|_D?9*BfXBjjzzgAJ@Z)e6{1UteJ_r}Wr{N25nW5hCih>)$ZQ&kpJbV*88J-KL z!H>evz}w(lct89Z{2g2ZUx6zP^Nv?tI0o(t4}?d;N$@OqG5i?34&Dssz268;yw z1I~jF!zbXga48&dlXrY-!cE{fxDPxWz6DN(7r@Kl$KfpaC3p{f5H5sI!x!K(H+#n? z3T_Cug?qs9@J;Y!crKgJ zd<;GX{|aA$D~|JyS2Wxl4#GFUy{673C{4M+od>O7d!DqD!>VN(Ik~(lpxC=Z0z5yN&&xG%WSHMrfTj1B= zx8O@~#6)j@qu~JD3hoLIfD_=c@O1c2csaZl-Uz<~AB2y=r{G`VD{#e0-tmfsgYY1D zBs?CT0WX4Az-!^>;Wy#^@TYJQ{1f~qTyC;=JZi#?;aIpQ91o9%C&IJg#qbLF8F(|i z1AZI+2>t>-4WEa7Q@rC<8LkVrgge9i;1Texa56j}z7Kv3eg=LXejR=fE`Wc8OW{gW zz2kKa+yw3o4}}xqDezo)DZCEe3cm)w3x5osfPaAhfc>|7$0G`E0}qC8gp=Tz@Lljz z@DBKG_%K`qpMx*L{$y`|E5UW(7H}uHAABu*JG=yb7+wo+fp@}r@FDn1_zZjjE;r3P zK2dN3xHa4j9tht6kAtVfsqh2v_=*;1A$0 z;gfI)d>O7V!#jSp;bw4GxF0+c9s|#WAAncE&%%4*{qU!75&RSUCtPl(cRU)wF>n{S zKYTsB9^L})g!AA-@R#rz_yQa@%iF&ya6LE%?gICRuZPFNQ{Xx9J@5+n3HUkqMR*^4 z2tEs+hkdiX<5d~13%7(j!~Nh9@U8GncoF;n{0RI6{1*Hn`~`dlz5s`%c*iFIw}QLE z1K-UnA) z;O$>D+!&69d&1YkBjNGzTzE0O99|7)!7swQ;1A%>;BVod;lJSu3o(9h3%E1fA5MVB z!872y;bri%@GkfR_#}J|z63|4di!4oZUVQ5d%@Sj6W}}Gh43I>&ESr3 z2p$372Hydv!pq?`@J2WXehdBx{t_;R|A5Qh?H!-$Z~%^ld%;8DM0hHECww2A0dIg` zfOo<9@KN{_{2T0B>>ZzKa1*!_JP;lYPlXr4>F`>38@wC-2>uHG5xxYMyT{xAYv87E z2e>bM9egW14PFR80I!ChgI|XC!XLt4z-Qp!VgC~E_*8=%!R_Fl@U`&G@Dz9+d@uYM zydK^TzX^W;e-597e}(^nD=+nqS3S5D+zlQC-w02DXT$fv55sHWt?+B`d+;alH}FsJ zUvT*}@A%Y)o5P*pe(?41Sa>?T2!0TL0^S6_0>2F(f{(*Lz!%~0dwo``p#InI->3mM zhTFrv;bHI?_;z?cd_TMjeinWa-VGmskHO!==i#vXyyH_9ZUDD|yTe1^(eNaA4!jgz z2|o=#55EDw4}S`O3;zONhAZCh9j`iYOSlU>0KNep4=;vSz)!)O;hpe1@W=31@Q?5% zxZE=Dcw7TFg*(7~;p^aA;c4(f_yKq|{2cr;ychlu{sKM&{|@^f@QzP4xDnhA?g?KD z-waQI=fU^FkHPEVm*BVI0{CnA9Q+qtb~(leZU}dPd%&aNiEs*h5BvnY0p1Sh!tcXJ z;BVk_@Fh6nLGSp~fCF$lxCcB09tBT;XTf*F>F^WqM)+lT4}1VV3jYI_Pxp>bEx0Kh z2ls}D!Z*W{;W_XU_+dB`-VE=6^Wekq3HU5r3P-H)j#o{%2^%sa37!nkh11|i;b-7&a4x(b{tW&OE`hJW zl^*tvS6w&;?g|ftN5V<)EO;^e5S$5bfnSB+g$v-5@Q?5XIP4Mc_*8)daA&v=JPb~R zr@(XJrSK#0T6hb*6V8JV!C%5>;7f4CO7D2pfCF$lxF>uqd^0=+o(JCxKL)Rdx5ID3 zAHbi(C*fb=f8ffGddI6C+zJlD{ooPsZSWL$F8l!e82k+UJp4NR9$Wx_1)qg4!et-x zj#o9f5!?>$3117}3{Qn;!;9e+@RRT+I0xPfAB2y=r{G`VD{#dO@AyT-&Ebx4UwAk? z2A&GfgVW%Z@H%)a{3`qo{2BZed=|b4mtEx@uWE2ZxD6bH2f;VOx53lk#qe@?HJk;% z2=9XP;iK>=_&3=1xOcp&!1duaaA&w5JOaKIPKM{h_rZ_B&%n>aufy-b1@KAuC-_ge z+-mRm)r1?vv2af~9v%%(glEHx;T7;x@Md@?{0{sv{1yBodUJXA7zYOn%KZL)4&%l4dWuNelPc^t9+y)N9gW!?yO!zMNLHG%HBm6SF z2R;BFgNxvw;6LHYPkP6z7Tgq$gL}h6;hW*f@Emw4oDM$$Z-jH;H{t#8r||diukfF6 zxu?A2R}*dw$HFhex$u7YWB3I81N;YECDVJnwc%!P2e=PB3{Hfnz;ofH@FVbAcnf?0 zJ_3IOpMx*K5o^8UQv(jb?cg5p5O@?k8NL&K1bzbE2)_*Pfe*k(;gfI)d>O8=&O2VU z;bw3LxDPxGPK0;CAHW6hSMXW*B3$-qZ-1)64dFI$5FP}NgvY}(;QQeWcq63VaXz5WF7V0`G+L;6w12@EQ059QLfYzg6LAxH;Sj?gd{9-wY?gGvT}7 zba)lK0p1Sh!auzkgxkQ~;UVy7coIAZ-Ujc4^Wa19m+%?*clZii?m3^; zDyaYU`(Lhs8^UeiAUqhp9=;8p1}}uu;Fa(?_yzcV_+$74`~&<4?BD1euPC?y+!_wT zgW*x|L^uUr0zU$;gR|k+;eGHC_%!?r{5M>FlXtvo!A;>fcow`6UIwp%H^8sJyWxEJ zbND;>7x-_u{J+qDxG5Y5_lAeUH^YBfj@`8hJS=h;fT%N@u~{f zhg-v);1GNxdd{3Uz_{u3^{)jM9*;D&G;I0z4dN5bRb8So-_IlLOqf?tGp!w2AF z@b~a}I4s*cURB`+aBp}pJO-W!&xRMnkHSyGo8c4iY4|)G_Pn>h72#;OIouKM3lE3K zz*FIQa2mW4UI%Z5UxVL+KY_o2e}eyl%Ww0JUv0QK+zIXnUk{Ikr^Acj2jM5+P4Fx5 z+wdXyIQ#>A5f0z(9iJL-Gq?*p7@i2vgcrjP!|UMZ;avCw_$d56d;u=^g17(G;l^+r z+!s!Qr^9!_E8q?AR`^x;9r!SO94>}`hs(U^9gnJTeYh3e6&?U5z+>S%;DzuqcoqCF z_(gaZ`~mzK{4M-5{1+Vgl6U;Bft$eX;a>2y@J;X}I0e23eh7XF{ulfT{1*Hn9DLc^ z{}6mFJORD~UI;IPSHTyvI`=ZVt!7J>htG zG&~WW4L=BH!0X{{@EhUMTkQ5M*PNh2p zX^@tXmJsRg66x*|kq(iL7Z6DS=@g_(I;1=P@$Gl48P?1(?0MFGowL5}T^%>V9dR!_ z01v^V@C1AlKg93w2fv4VQ{s#`4=#Z#<9fIy?urNEv3Mq4f`7+<;iLEhzJp)jFE)q0 z%Ht|{1fGb`;cNI2j_^nL`7v=~oD&zr74bK?Dei##;t_Z%o{v}K-|=7gZ+r#+hu`3g zTf%-ha8XzsXSgsfhrhvHaX&l~Ps7{r0elwU#xHS-azX6u-u;c7{DVF!(JcZ zR5%+hh|Ay_xG`>vd*KmyHeQN1;l21Dd>22#Z*i=BVXq`O9nOi1;flBpZh_n5K6pM} zhBx6o_yoR;@8j1v#{RHRa-1IL!o_hVTo-?jd*b1EI$ns^;BELIK7()ICphAPuum$S z1?R;@aT#0_H^9B|AUpz(!&C4~ya=zv>+xp110TYt@W1#Weuv{94Ev|RS#dR754Xf! z@jyHd&%(dq-|?ULD87L2;1@XRp|D2+oC1G_^W&oUOI!ul!Od|e+#ip|Q}8^z9&g15 z@CAGazrfKBhdqdiYMb)cq!h1_u=FCG`@`=;|NE> z-f?g;oDt{2b#N2h4)?~x@K1O?UWK>d^Y}V`j3XSS2Tq1F;ykznu8iy9mbfb(h{xiY zcnRK)_u*6cU;Gfi!ygr_3RlBTacBG^o`~n+HFzgJg74y&IL66vZz7xq=fvgk*SI6@hiBkLcoW`%Z{X)R z`l)bV5}Xm|$7OK~+zk)GQ}9B(9v{Si;|uscj{Hx!_XC^|r^9)0DO?jb!(H%DJRZ-& z+wnep3g5<0ag@_xj|4ak&WTIouW&8g6nDUV@d!K>&&ONw0elhP#P{(N{0c`n6ZVUS zW8+V72Amszfve)ixFha`hvG?i4qk(g<8$~nevG4?4SU7IpWrMwKQ4u<;fA<1?tus6 z3HTTM8{UX_F(Kr{iC6&I{r53gNQ2CT@b;;of*Oo`PrMxp*;Nj(6k3_#D24pW(sr_+2~LM|;$pZWZi?IBo_GkJh-c$vcoW`(PvFb=K7NgBUk`gV#%*ygJQPpDbMSJ! z7oWrtZiM&6#EEfQoEI0xWpEAL7`Mg!an76Jy|r;O+!pu3L-8a$2Oq+3ag1BxeMxWz zoEMkEb#XJ?84twc@oc;T|A`Od3-}(6emmSB4}XHQ;QY80u7(@p*0={Aj3?k<@Nak{ z-i?prOZXmsg`?jI`z6Gm;?M9hydH1HJMdq4#NF_oiFh_%hPUCp_$0oHAK928{*cuA0CP);W>CY-iB}B z2ly?H^&sq%1gFC}ac?{rPr$SBa=aPu!~ftHIO4-_&xbe@&WVfRYWN%c9qx{Y;;DEM z{vY0hPvIN*Igb7)?2!bg!#Qy=ToKp7&2cB(ACJOI@jAQ%AI9hKE&L2eejN6Rhd;qt zaDH40SHlf)Yup15#uM-__&2-}@5aaRC43LR!qK0E{Sx9&@n^U&E{DIy-{SVTFCK}f z<3)HK-ieRmi})UXjblCydnLi?ac*1!SHTT%YupnL#q;qhybB+~XYoz^6i0d%_K1s9 z;LJE5{t{Qk4R9;m9S_3e@hrR)@5Bf2Y5W97d>;0Rhd;&{aBlns{tADCzr$VdC_EX@ z#Vha*ydVFAui;1dJ&yk(?3WT}#RYL0Tmv`8ZE-I=43EdN@KSsQ-^DL+w3p%j1UNM= zg3IGNxCw5Dd*fkvGM;7YhI?trJ^Ie0n#9iPNE z@lzb-b+|V^PKmSPVz?as8h?x1<34yeo`UD$mG}?551+#S;)nPh{@_j6FDXusbK&B+ z60VC|;Ldm?o{Z<>6?ik=i%;UK_yK;4W4#S~CBf-%PFxIE#C33U+zI!`qwsXR5U;`8 z@IibA-@s3B#CKt@4{>sw3FpOM;%c}NZi~m`#dsawfe+(z_!fSKBfk%O#KWK9EI2*1ETD;|i);+c2}K8`Qpd-xTO9y#oj2&ch0a7kPR*T=1JA3PjS!SnD+{0H8T z&*R%TT9mLy0-PFW$Axe?{0;sNcfmj4G59CE7_Y-S@DY3kzs0elhJBLa^!N*054XfU z@CZB=&&R9qR(up+#1HX%96wsPKPAqFi{Xm64*ouR`20?|KOT#J!N1|%F~a8`!RPTE z{1Qix89pyLPKR^i_P7Tgj3?k<@NalOK7lXeRI$Q6nQ&fQ5?8@Z@Q-*Do`sjG+#3(Wlkr@<0&m9q@Ns+zKgMrx%(!8{#5e~o zh|A!*xFP-y&%%rFTD%>f!?*BT96esRHz7`gbKu&zF>Z@{;h}gEo`YB54R{wmhA-h; z_!*8IKkO3^e~t^_(zrTqgxlh7_(wb*&%lfDT6`Rz$G7ow9Oa|1PkfvTXUBzcd0ZPe z$6at=JOWR}^YJRY1@FiI;O97Ug0N3KoDzSAi{Z++A#R8J;W2m?UXHimL-+!|kKf@B z6NWuf;?Hm~Tp2gS?QlOl2G7FF@qYX_zJmY5Z*a^+;r_%pEzW_9;tIGnZiYMJet0CF zh8N(~cq=}D&)}Q*8IF=T?DY{&jX%Rha0Ofkx4>QSKs*l5!u#-XdCU*m#F!yct^WBfhthR5Kkcs@RiPviGE#>e5k ziEt*I6Bom^a3lOPUWnJ=ZTKKQgKyv`IAXGJ?}zwPoCW8{rEq=R9CyO~@hChUFT`u` zC43t{$5E1pJ>uh(I4drIOXKRe5pIKf;vskvo{LxFE%*RFgKy$zI7*7J*GD)t{tOqv zRd9X$J?@SN`|)Xf13$%)KMDJ!!0B-=TpU-zb#V(k5zoX+@Or!x-^DL+ zw3OlA1UNPR4A;TUaVOj#kHRzXV!RID!B6lj93fS>HyVzOKf+0IN}LX7!8vd~Tmo0X zRdFp`AAgHm;&!+T?u7^7A$Sy?fT!VEcs~9Wuf*%|X1oLcg%9Bq_zb>;uj90-!|zu% zoC_Dg#c(NH0awMfaDDtOZi(CBF1QySfQR5wcmke=XW{wySG*Fh$D8pE{1-liPvA57 z626Y_;z#%eeutxc8h)Q*;dnSPPJz?lO!zaL2N%L$;4-)pu8!;AhPWASg*)JGxDOtP zhv6}J5}tu)4zKQSSC-@bPkS6?oM#Hi3M>r`?iPPaM zI0w#$i{O&D9IlLO;%{(c+yb}3op2A_4-dj4@HjjL&%|@_V!Rx$#hdUpyc-|D$M8S+ z0{$1@#t-l_{02u#8-8D7;16*^oD8SN8E`h78yCVQa5-EB*TM~OGu#??!aeZ-JQR_!7R4-{4po!(K^o23!JHz_oEF+#k=ti|{(U1E0W`@dNx8$I2A$PlD6ooVXaS zi0k0yxD)P=N8#ysAzp*G<9+xPzK@^dw>Wa;w(5nu7GRc#<&Om0gu58 z@d~^d@5LwaQye=>*z04Q0q4e*aXtJ!?v3Z;Rd_2tjL+d)_!*9zHQXBye}c2%lDHzS zgPY?{cr>1Z=i!z354;bb!WFWG`)lCFxHIm9hvS8K1>TJJ;&b>KeuUrSkFtmRlH*Lc zFfN6w;fA<1{vSSs&*EG78IJr}xF;U|1ZTlTaT#0#x4<26Upx{|$BXeQyaoS@@8MTC z`sZPvgg7@Yg3IGtxGC;{`{EIJDxQy5;VpPS{s&*fkMMgOJ4e{-W1Io!!)0(S+!S}f zeeno970<`3@D`jqXSlBjE{|*Brnm#{i$~y}@glqyZ^wu5S$q>e#gTG_`{UviI5W(#Gm5NaA8~ye~rJz?QtJG98baX@Jjp# z-jDyrSMUS;4#&?I_DhMg;X=3^u7#W7PIv$wgJ&*5wM5q^*3=cf*>a_WBrSz`5}k_$&Mk{tkD+Kj1O=C%go2 zz}xX5d=}rrkMMgOyCD5=Hk=oi#8q$u+yZyT6YxyD1pkQ-;xqUjeug6#3VX!EX>oR3 z2$#h*aTDAQ_r}BUWIPwIz?<=2d=g*95Aa(Yt8mya2~LM|;$pZWu7jK7PPjiFg{R|% zcn#i$58^ZU27ZDg772TOh_m4QxHPVTo8YdvA0COP;RSd#-inXmv-l={iX#;b`^3d5 zaAuqje~laB*0={Ag2&>ScnMyQcjCYCBm5f2C>Hifgwx_|xDfslSH%r*E8G_k!4vUp zybN!`d+-T-8Q;gRag5?&zr46Ou7Vrk_P7roj;G*xcqRS=@5BG#>-Y(d`$f1vDNc`b z;o`Uwu8UjX&Uga;8UKcV$NTVU{20H*F-n9zlHd%uFfNU&<3_kW?t@3*X?P+2s$_V7 zE!-4$!2R$e{2IsjGW@(mI1TMYzs2owA3Orj#7pp> z_$a=J@8S12cA2op$2bGdjqBs)xHayG`{E&ZB3^)3;Z1lCK8>&A|L_|evuxNaInID{ z;lj8a{u+Oa+v7fXIG%zx<6Za|zJ~AP*EmMGuumeK27iu=;PSW@Zi+kLzIYs-ffwPm zcso9X&*Gc-DUMV=>=hTMz?pGA{3Wi68{k&BJ066`<5_qq-hg-EWB4L|gkR$r6~car za2lKk7r~`*b=(NI#oh1}{0sgKZ^XOtaeN6s#&2-UieazBI4#bBtKd4gIqrn}<574u z{vH2?|HfDFfA|fKSt;z19H+xsa1NXg7r|fRO1Lg=fd}B>cnY46m*GwLAU=t&;s^LG zj`da8HwjLMbK+vSBCdm*<4(9g9)+jlg?J6#hL7WO_!fSKBUcW4#mC8TMqC0{zzuK< z+!+tRWAIe`D_(=Q;e+@LzJZ_Mh*iQ~32{oC6&Jvzadq4Xx4}K}5Ihmj#%u6qyceIu zSMdY<7H6*-_RELA#8q(v+zNNcgYbC#3to)Z;T`xeK8J7NXE<`Tutz-n3C@8F;xf1f zZj9UFUU(>;gy-P3cnjW-PvaZ-8IDjr>=g$m!x?cNToQka+u)vfD4vYx;Z=AmK8Vla zTlhJSS|jX}0Dp=<$3<~PTo-?byW$`5c>D`qhJVK=@kM+Wzr@jM(g&x;*>NFU4p+ks zackTI55^PlFZegS5g)*R<16?-{07JTI_#Gir^PvNF90q?@c z@J0L(C#ecnY3}SK>eLK70!Qiyz{5IDYN0M{=AA=fx#)1KbMt zz=QDw{0sgKZ^XOtaeN8i!>@4kI$@uL_;XwYSHN{}3)}?{#N+TR{2She_u`ZI7Jh`^ zJ|E+3I4>@VtKj;$J0655;Q4qJK7lXeJNN~T`c1h1Bb*9n!v%2}Tmv`8ZE-I= z6i>o)@N)b+{tN$&uiyvx9gbZu?3WB@!ufD1Tpc&Y?QkDF0#CyW@mjnCAHf&!UHl5i zs2}!8jML#<_zPSa*T=1J4?F}a8Eq^3C@9w;5xVoZijp0VR$m0i&x;ycrQMQui^*z zEsoVB?3Dzk!};+SxCU;3Tj3FS5?+HhjHh2M@s$@oc;dZ^C=<349sf$FFgWW?{cXI1T-$_c6|Z^Wc)WDsG6|;9htbo`UD& z)p#2|gwNsI_yvyEBJ7h8r@=XJFfsl?-RX`EV&*9XH19a34GZPs0oG zTD$`v!58pd{0hhTKJ1eir^C7M7q~L6k6Ym$cnF?^=i-%k3qF9);G6gvj?yaZ^AS#s zKf^_E1zZQWz+Lb_JPyyozu`^zFMJaJiyz@=t;0U?accZIu8Qm87WfA|2G7JR@CLjK zAHx^%UHlS9YZLZJfK%h_xDYOjYvLxj9qx^X;mLR|UV%5`z4$eb(l+c7AE(4waRFQ! zSI3QT8{88Q!4vUpybN!`d+-T-8Q;gRag26hzeG3<{u~#u?GQ0`z!6)z)d|S$GxRh*2n5 z2%d;%2NMw9M{10@%Ok79*ig8`8a3S@ZLhWEUt;0;C8q- zo``4SC3rpFi;v?=_#S?RqjwAUC&ZuP&v0Q}9@oaLaTojp9)o|vi}5KFo{5*@P52Iu+bi6c6sO0z z@E5o|u7#W8Zg>D5jc4FRcrD(J58<=;CVq-z^bUK)$Ek28To{+a)$sSY6Yh^E;Gghf zyb~Y6Pw_kaL7%WkQk)*=!o_hVTo<>%o$&xX8qdIs@LIebAHrvGgT7&p7PvDWfS2Ia zcq=}DPvh(OF^|md<8$m5&MVxW8>sF3oeMu z;X1e}?u3899059BDw$U@G86&AH-+zE&Lou{W0v50Dp?};1akpZh%|h&UgSGjc4FRcrD(J58<=;CVq+| z4GMe3#VK%RoDYAAtKtT@74D7);qiDDUWzy1UHBNji0|T;INIQ_Ujm#OXUCQB*Z5o9 z9{0h+@f17{uf%`gefSjq7eB=B@CQS}UP*C!oC_Dnm2h3$0(Zs(@Mt^(FT!i_c6tOI#H90q?@c@I`zVzr@jph5h2;PjC)g z5SPI+3E#u7aGY^rzr;8# z&Vh^K3b;0IhCAYZcqE>N7vR-+D?Wfv_BYF(-!olHl|>H!gv{#*J_r+!GJM6Y*@k3~$1F@Ckew z-^Z_Uj7edyL^uup92dbAa2?zNcfkYkI6MpghBx8A@JakHeuUdi4*PV+gYbAf3opeR z@IHJBC!P}ClL}|U1#uZ%12@KPaW6a+Pr`HXa{L!QiZ9?h_yzu8YS&A$2h`_uvZ+M3}?i7a0y%)*T>)E?szbs zi09xH_z%1vpT;-vQylrHuvdJX3TMZKad})DH^-gv4|pv8885{f@gDp)zKS2>_c+eX zuvc=N85h7MaAjN%x5d5iP&^6G#Y^!9ybB-07x7*E5=Z+v?3Dng#@TTpTn<;m4RIUX z6%WK?@l3n~ug81wF?KRSz*6~_!FE3=f|aRHQW%l#y#*zJPFUi%kl5{5I%+f z#Sd|mU&3B-a59_`=fP!hRono#!rk!*JQ2^v%kVb57oWse@dNx8$C@4XOM(mIQn(s! zh+E?x_!Pc`@8MTC#+>l}_&6obiVNT}xC*Y1zsKG1k9a(uffwPm_yGPJU%~(3H#p|p zuwP=F7U#f4aRs~?@50CMMf@B`m>1p~2PeZBaUNU(_s7HVWIPwIz?<=5d*ErU~u*b(Z6V8vz;IDB<+zSuIlkgn85%0i<@i}}8Kf{q1g+1co zPjD8TAD6x!@cn^JQ>f$EASt9H$ILp;d?m3(y&)doC0US1#wAS1%Hd% z;y!pJo`IL(4fq7Ui0|XKIQDO0pX9g*E{&_>Mz{^`iHG2ccp+Yex8cM1UwjY0!ZDVG zJ>uh3I5W1KbLC$Aj>AJPR+y8}KfC3}3`|@k<TJJ;*L_s4_q82l4njMw2E_%J?) zZ{cS+%F3|UCpZJnjqBkSxGNrnC*rwy72bvqx3b40pu+@JKujFTktuR(u?v!?*A=9CKaR z>m!^BXTt??8C(N5#%*ygJQPpDbMRWc72m>7aOCy$z!`CFToPBqjd6S250Az(@lw1A zAHf&#ef$>3{$JQ51juuf|*P0el+Yz)x}HzrtSe zaVnf07slmrZQLAp#y{Y(_-DKnZ^V1>-}owih~MKld&6GIab}z!m&P@46Wkv6#Ut@_ zya=zuJMmF`5#PhFam;;TpCmW~{u~#Fuf!YiZhRa+!f$ZQ{b8TP zI4#bBi{c8nHg1MH;(mA}o`x6THF!HdjL+jc_$7{hAncV0r^PvONn8Ur!=3PtcoJTK z*Wm5=Fg}m(;Fmc1L3-e{I43TSzrywK_qaPAi6`MXcsc$Z|Aqg?SMY!M4UTyz?3Ea& z#W`?MTmjd{&2UHD50Avt@B;h?-i?prOZXmsg`*!1dnLjtaaLRam&Vm`Bish}#3S)k zyaMmWNAP)k8$ZWUj)Z;UbMbZgZto7cm`gK*W*9&F?aHL~lpAT?aoDCPmWpEAL7;nNm@e!Q( zczADWoE;a!WpPd11h>Pz@i06Y&&4b7X1o`l#8>eH{1(SL5%x-g)8U-B7_Nxx;O4j! z?vF>|>3AVtgSX*B_#D2Czd0H9X^K1GzIX&)jeo~~;lJ?}{2zXUW1b4{PmI&z9Jna1 zfcxR0coLq2m*d~@U-)l)1^)uW-h*;q!CgqPPOC zjho?)xF4Q|=iuddGv0-d;fwe#eu<-<3wtEM8E_6<6j#8taWmWz_roLcG`s+>##`|L zd>UWJk8yk`#AE&aDN<}3}?i7aAjN@H^=R8Z#)c7#*6Re;SzmtGMo|T!6k5ITo1RzUGYFX7XOTw;*EF@{u^J#5Ak~(=W^IDInIpp9CSHQqX?P*tfOp|z_!54E-{Uy{hJ8}uY`74vgulUUaBn;u z&%_JxQoIW9#mDeP{0Jwx7WPPobK&Z^KK>pL!$0FCcop7+_uv!wGQN*vTo3og$0>0( zoEMkGRq(gCHSU22;|cf|{2ShgcjM#uGQN$Ux3b3U|f>@I*WlFTv~aPJ9HP$G7ow9OYKn zD?Uz%v*H4{G_H;t;a+$co{Z<>6?ik=i_hU}_z`}OW8V&YeT*~U-1rOp75)Z)hr8e( z@EH6PUX0h_9r!Rlhi~C$IOd(O*GD)N&V~!(O1KtoiaX%Gcm$q`=i^m)3*L|a!PoF( z9Pw`0D=z*7XT=3^S^PC_iaX-|cr^YAFUOnkPJ9HP$G7ow9OYiv>oZ&!SH^X4bKD8{ z$D{Ccyb!O!+wehr2H(I>aHRWTk9asG&V~!&a<~?5hCAUO@JKujFTktuR(t@T#@F#< z9O1vP*M~R-&VmczGPoxG7I(n?@F+Y3FUITfpZFNQgzw`wIM#!(S5lk-e~GK&*0>A) z0gu76@e;fOufxCN?RXD9h>zpb_!_>CU*r4_!@ghOukbhcJKP2TfXCpU@M63U@4$!g zIeZI0!;v3_`_tnx_y&H2BR&qF7Z0bxeery}3~$1F@Ckew-^Z_Uj3?p!iEtYH9qxep z;t_Z%o{yj4w>a|C@ZOj>E>47#<6d|W9*<|?rFaA0g^%Hj_%42lqdg1vC%~z3c3cRT z#Wisg+z$7~!|-H07q7sZ@m_oqU&RmcdmQI^*e^NGjPv8txCU;5+vC1?B%Y2J;dOW? zK8i2md-yeu`6BF-1gFQjaS2=nH^8lNPdpS)#`EwhycHkBXYnok97lZ__DO(0#h>G% zxFW8L+v4tc5FU?b;iY&3-i43hi})^niKD#=dwq&O!xeCC+zfZbqwz2JH@pcSz^Czb z{1iue9qx^bQ{c=vAN~?o#SL&P+#L_XA!h7%ud;>qgZ*i;$ks|!RSFHd0uT=C15z^qSxBxDVtK&wv4ep7D;E8xP zUV}H|z4#=)iXY&&I99~4R}!2B=f+>)M)-T&4G+Q-@NB#sZ^rxZKlnO+f+Ix=d&I*j zaW-5C*TRi(8{88Q!4vUpybK@3XYoz^6i132_K1s9;LJE5{t{Qk4RIUX3lGCn@oc;d zZ^C=<349sHiW2rofK%gKxHv9{zs4PKUpyTz#B1>$d<37zxAAivC2H6sK2C|V;sUrH z?t=T`5qK_MiZ|e0_!z!~Z{cS+a@VtKj`{LqyxEbz< z`{9vz8oq;{;iz%K`x4^JI1m03SI13o2Rs;$!@uC=_z!#lpT)QFOC00FutyS{0r$hh z@mM?=FT^YGX1o`l#8>eH{1(TG%U+xg=fuTuMO+6r$DQymcrjjwU*L%G!adP(ecS?f z#slzZJOeMnYw>n`2%p6_@lzZrez-R-PJuJye7G9^27iaU;GOsYK8>&A$2h`A;l8B! zQ~Vh&jLYG#aT`1ckH$0bBD@xF$A|DW{0zrUKo6WA=fcHtC0rM`z@6~`JQ2^tOYnNU z6Cc5e5{COz;cU1dE`w{}#<(r+g@@uvcn)5Uf5(5}llWi!2uDa1_W2N}!P#&@Tn5*` zjd5Gt3lGJU@jAQ(@5dML4g3U0OdR%!i<9E?xGJuTTi`CZFCKxX;`w+L-h%hzfABT@ z2*1a%lZ3rK#u;#K{006Be}linUGNWh4E_l(#_RA7d>CKGxA6n~3`a^D_WJ-Q#p!V_ zTpU-zb#V*a84tjt@eI5Ouf==tQG5a4!7p&skHdZ+;Z!&qE{MzE8n`iTi+kY-_$Ry= zufsR+1N;`pN*4A=g45xgxEQX8>)__N6Yh^k;puoGUW2#cgE(IDaR0|R1I~@Vz;$pF z+z$7~!|+nP7H`Lg@L7BlKgE$!ggxTo6gV@^hrh&CaRb~6cgKV9csvU)#T)Q0d<cVn+#{h1#nqh8-Itpf;fLG(K_y9hQuj9u!V(M^TT>J^nfeYXg zxH7JXTjH*GARdcn;x+gLzK37n=%0o?65}j5KQ4)@;l{WWmXut#z{0FT5o@DjWc|A~*|tN1>Ci({t`@6U%z;DvY<-i8n33-}&> zgFna+-j@t##uf0_xEbz@2jcN~HeP|Z;5+ykj+!ytmk_7Lxo`r;wHEqo{DGVWq1?bgHPZa_yLZbIqVS|e~h!? zytpK;g6re&aX0)U9*2L%zvBPlKk-p~0pGzdaMUbezmIS#oDCPmWpEAL7`Mf}@K8Jp zFT%_48oUwj#Ygc?{1ivZ8up8eQ{s%cATEPz;ug3w9)L&VpYSrg3Gcyw;~V%1j+ia% z^C3=-GvmUz7H*2W;(>T9{u!^poACjB0pGzd@dw$%9!YU}TmXNGE8?2C3GR$X;z@W8 zUXC~8UHCk{jvwO)pM`xs#7S^woEMkG6>%Nh9CyO~@n}2+FUITe4txYZz;E#fpNGAY z;taR|E{&_>PPh*qj;G*xcqRS=@586?zxW}3hd;%o$&xX8qdIs z@LIebAHtXM9sB}E%^CLk2&cl?a6w!K*T9W&Tigo|#gp(Hyd3|I|H6OcEBHVB2FJ`5 z_DhV@;vBdru7GRfX1F8nhezURcmZC6x8uY3Jbs8@;~2T=h120&_zPSa*T=1J4?F}< z!gKLTyagY?m+&q849Cn9_W1~>!ufFtTp8EHEpb;o5Rb((@e;fq@5D#&d3+l`$5HZz zz2f7PI4drIOXKRe5pIKf;bC|Ro{v}KZTJvAhi~H-I9k52S3;Zy=fK5qCHxI;iM!!J zcmke{m*dTNAN~hl$4_vi{9&JXI3>=83*mCO7H)<+;Q@FIo{4|O8}M#?0$;%oaO47E zpV&AtPK~qRJh%`pjjQ9v_eH{1(S5681@g)8SmWHg1MH;(mA}o`x6T)p#pDfN$a` zMZ>+RaduoD*TS7}e>@6L#|!Z~yaOM`=kP8345ume>@6L z#|!ZqybT}3XK?fiVUKvYATEPz;KsNu?u}RA4R{wmhA-l~_$7{3G2EK~e~Po<(zrTq zggfItcsQPdm*CZSD?WfP;+r^frLadl{0Yv93*oZ3CjJh0zAJ=_v^#RKtJJQJ_L8}KfC z4d2JFaf}*auS7Tv{u~#<<#8?C6nDe@@hJQYUX0h_9r$m25#PlxakQFYuY@=a&Vh^J zYPcQlfd}J>cn;oEg@x9}Sr zwN}{cBb*9n!v%2}Tmv`8ZE-I=6i>o)@N)b+{tN$&ui*di8yvHC*e@|oizCzte?BHo zjML(LxHzta8{w9?D;|c&<5_qq-hlVx6ZkT|k6+^$b;Ev%a2otME`rPBTDT=1ho|F3 zcqRS=@5ATub^I7d_$KTT2Peb1aA8~ye}jkMv3Mq4g4g4n_y|6aZ{z1UO1-d068tIt z3>U`b@YncT+#dJA!|@b653j_3;C=WM{ue*Q@9+op!+uF|dYlUv$CYqh+yZyT1Mp}( z124jB@pgO&pT#%vGaRKs*y|&l0e_B*;PSW@Zi+kLzIX(lis$21crQMNFXFrSC63lG z?3Dm#z@OtHxIC_po8wNnKOTjr*pWuj1!(Jca*McnH~b?WhkwSu;!XGjK96tX z=Qw(+uvZeC5$DHcac%q^?v97zsdyvaiI3p(_%@E(I@}u>E>`q~? zR5%mPi%a6FxGrvi`{AK@5}t#%;eGfN{ue*Q@9+nm!#+uIdYlUv$CYqh+yZyTWAIYE z0soD!;P*IomvHaLI3v!Bzr?k1W84|{!Nc)lyb5o@`|&^c8h(V|=h4xg0tZKxD>92o8mUO6W)k-;KTSFeum%U*geAi$#7bn0~f^=aBbWS-@p&> zTO6xrcyAJ%4(G&`a9!L2_s7HVWIPwIz|Zh|9J^PzFCET~3*oZ3CT@az;(>T9o{2Z& z9r!Rlhi~C$ICAf>M|_+NXT*7NFNFU7B|E#aC_Vb564sRJiHR`z=!Y|d>uc=Z*a`MVZX#U2QG-q;JWx*+#dJAzu;AP z6W)VQ;LG?Oj@~capAdhF^WdVm02WSx z99P11aSPlT55S}G47>=h#oO^Ad=}rtPjRGyVV}4-1^x^d#^vxg_&eMMkHJ&%e0&;T z!T;emIOdPx{=_&f&Vh^K|KV-;AU=cd;Yav2{%}xuf3d-#%i^za4O|yD!p(6T+!YVR zWARM91h2<`;iLEzK98^BTlfKfiK7h(`zFAtadun?SHj=pPPjjwfPcb^@jAQ%AI9hK zD;#-f*dr#6i<9BBI5Ykn=f#C_30xM}!A)>G+#3(Wlkso(AAA|V!7+!0Jrm=!xHIm9 zhvO-D9$tz6!29qi{4aip-{B92hkKLa^f(tTjw|81xCQQv2jJ0o23~~M;_W!`h;VNz zoDCPmWpEAL7@4kkztR7_*48DE{uQ13-KDf4Ijj3@D2O~ zM;sOI`4A_^|A%Wk0dsTQ`v4rZw&vJ(>WjUYR%W_0NNu%@ihUcTrPMKqY8}fU_HAfT zwM|KDCy0F;8vB+Kj;#!0rv`CKZG$gm-spSJb$w@k_wzhS-rqmdygi-o48TKi8GnW6 z<3%qHzy5N#Ki&in$J^oE@xk~gd?G#+iPsZorsdxsy3qOWmz;EJ@@pt%uOT*WHC{E#1@rC$Gd?UUGKY_o-Kj1|!3t#Ut zcuhP255?Qy-Ea#&5}$z2!Wldr-;N)`zu-QXhx;#!H^z;4Yut?Y$A{zNaT;HYufezA zNAOGdzqpLQ!N1}qr-tXX5?%)n!du`S@zpqwpTe)=F8me#3HQAs+-DWM9**HH@y>WZ z`~m&~|9}^n7QVh^@S1o49*VcYyWtjmEItKah_A-C;YaX`cn;rH=e{1aa3>hSgV$D82ccssm1J{Z4`KgaWM zL+5i(VV!Z+c2@hn`#bMO+`@I02qYvGOYFuW7q10RB0@k#hR zoWav^9zTMg!>7*-_dg$BfoI~oaVLHezlA@+75qEycSHDkSHjJ{TW|Ps11CtMEhG)$j(m z5pRum#rxnxaSES`FT_{j8Tc;z7=97Ijz7fR_!qq7o#A;dhx_AA@Nm2{-V-PB(YPI7 zfoI~oaVLHezlFcT|HFUcy1T;jS{-kQ2jc`j03U%T;WO|Qd=2Z3jQ7UyEisuKwdVhHTSbQQr2VaJ-$2t56eh&W^m+?3FSG?o{ z;XW(jb?_j(1>OPs2ChJboO%gx|-X<9T?|2bmY{k2k?v;vMjw_$=Ix zuf{jy`)~oz#_!@U@DF&|hr;t%3vY^t;8A!CJ`hj9lW{w~0$+<~;9Ky+_(}W$^~#GB*McrQE_AA?W9 z=i@8zOq|D0;39q(e~IVg#hwVyYXuy|gK!hx1@DE&;$!iN_#Av0&fy2}Q}|Wfg}=h{ z@uIWB^I8t~$D82ccxSvPPU55S$@n}x70ngy*#^UJGxGhv98; z0w09`jsJts#+Tyj@E!PJ{49PQe~7#BFL;S3!}D7aNAWa49DW2phu^}V<9T@bXT$yb<4y2j9LKxj z1MoL^K3?j%@b#>M2jHQ28@wBC!AIf~@L4#6r{ml4L--l|U)+Vi!t?Q>&xhx=9PW=d z#Y6BYJO(H6(fDM19-fM4;Jff+_`kS}zrl;W5T4KScx^lsZ-aNkE%-=$0zM08@Gba$ z{4#zAe};Q--xtI4SOu?#V|YuvGaieN!KdK!@%1=|AHmPz|KjGC!hQF~*yG&G1%uSKNY+ z!)^E?d=0)0Ka8KpZ{g4I4|uWJ;dv~J*Tw^J6W#^?j+b~P{CX?mC?1G6$D{FHcq~2! zpMuZF@8M7J_xKOI^sC{%tKkiBBiAAx)9`tCDxQJw!jIt>@SFH!{2lJWeg8{8ydK^P?}87*N8^+6 zd3Y+Gfp2>we7*PLS@?In)SKbQuZlOsL-8|sHlB|ceJlKW%i(&wIc~=L<74oN_#AvW zo`LViFW}ek2l#9JGv5F0@I1!jN%$;$8J>ajcou#IzmL1|Z@Aw(;p<-=55U9m4tQ^T z7(O1Ki7&-jd^dgq&&FN&Yy2zjJ10DkweiMy1Rjm|!Q=5Hd=|b8&%k*+3%`Qj$K805 zcfXUJeJ2%ycymK?}`t?hvVaM z8efdB!MEW1@$&!KabzWpW=1i5BD30 zoA5690DL4q5ub;r;hXUN_-Xt){uIy0i+>RAyAs|655wEzz3`!UB0d9W@b&mE{5US+ z_wZc&3tsBO@H|$<8{%Pj2fPnH61U+g_$Hjkv+x}JDV~S>l*4_O$5A{K$MJ6XV0<(_ z4_}UF;(KrbzluM=-{2m+^he=&tbsSiBk*Xv4<3&v;j{2%cm~enS@;$FKJLc9;eH>7 z=dn5-fQRE9@ZR_^d^|o2Uyg6U_u;4UC7*=*T#awV58>zVJ)ec2uM>Zb=i|jc4?lh- zJO~fR+u_~uS@;q>9p~_4_$53Ce~FvF2>06;AC4#Ev+?8j1^hPt9RG+H`!aleE8=zW z?|7-N!jE4SZ-g81c6c8=9#6to;2ZIM_!;~v{s4cAf5A)5r9a*T55?QzJ@Gg^6-Khx@L8*Ts!^Yut?Y$A{zNaT;HYufaL|3VsKFhX05E#C6@_`K*pN z#Dj4h?}`t=N8m~L415W`7T<~=z)#^t;}!cBN*ydORsPr_&7489KM@T2$z{1*Nc{|`sL z3(sc*JP2=rcf@<+arju=hA+U=@C`VRAIJa0zu~1S;r=V*b@2{(H{61c#3$f4@cZ~@ zy!iLw>sS<5;#s(e=itxrJiO|>@VugUAl@90#(Uwh_!xW&J|91cU&3$W-|%8Tg!?Uz z*T$RTBk@FhI&Q~T1$W@v@PqhiT*B|;x%g+i$WP(6@G5!ws;J!bH=eY`A9}mQv! z5gvj^;W0Rauf{jy`)~oz#_!@U@UlJOeyiaPa3kItACKGc1$Y|10q61K_$B-{{uHnB zd${la;d(q0?|}EjcjJfgv-oZNDgGWu{s>=xU%U!l56AG9cxSvXJ`5j+Ps11CtME${ri^t*Pa0k8>KZIYz@8P-l7rfMB;XbS44e?OC9o`dG)3kFn%7tjX%bVE)nj(0$v9< z;w^DAJ`n#KpM+=N9DWSHgy-Nd@y~eCCFzgX!7;owJ{6yfFUMJYCw>$^kB?p|eElcj zv+y)L1LyH9{0e>_e}jLj_<^eph zv+z`WBfcL$gWte&@qE1a^5Om~;q`DM9)%P55PS?i6}RJS@$L8#`~rR(e~y2|i>(lz z$BKAe+<@bFH+(QY8n@w#@HO~0{4jnVzlA@;Kj1}I49{Z)ybg}xt??Lq5N^e%;0y89 z_*VQ7eh$BhKf^!b#a9Z?V`aPn9*Vced*ktVGCl`ifp5YO;Aioh_%r+?UVLTx;|=go zygl94o|?x;M4Ji_-cGBehSaVUHEJKEAG2mcpj_ajqoVkj1R>B#wX$P z@l1Rt?!+(SGX5I>iu-WhUc*oUJp0o(RdF$7N_v(_!2xF=kR0r zB|HaziGRXNtQDTe%6NS|7;l4j$4PuFJ`G=tJMbO&QT!r)2Y-Qk@RI$*^H>EB!=vzM zyer-l?~ljh6h0kaf~Vsr@Qe5z{3V`;`>f4;@H%)SJP;4YBk|UFUpx*Uhtqfpz7F4s zJMqi-UHldP887*N%nxsXhu|IYo_K$J2u|Ts@P+tld@Jt6&*RznzjzM*5Pych#^2+g z@b7rhXn6j8@v?Yjye1xux5B&P7JL*w8DD^}!nfcD@w501{1yHIFS<^6UMt{ra070_ zyWj)xk@!S>KE52!#P{F=?!sT-`FQbl!}C}fNAYHOE4(W{2v5NO!RO+c_)gr3OZYwf z5&i;ygXiI2@Sk|`^}_R98ZVDm#r^RhJQDAS_r*uxiTDhh!Pn!v@uT=f{28v`Kk+i_ zhv(NH*W)elzIYryA774V;(KrbzluM=-{2m+^akO+Yv4h6B;Fctk9WcQ;Ia4!d^A2A zPr+BcgIP5EItiijHlyU@k97I{1*NQ zS8!ybaQ~(88h98Ug%kJ?d<;GxUyf(udvF22ia)^r!;1|F_g@yTjYr^Z@g8_APT|w> zCHPi+AASnIhRgUn{0ClUl!|;yy0NjdC z!x?-RegwaO-^O3#`M3xFYtwN5)$m5R3GaY+!w29bJ{-5=iTE^p7QO^e$2t5MehJUP z-{7C|A9%6)@O=B>z#6$6RcuzbIABWGu z89WVl;F4KI7x1h26Z|dy0so34!@~1j0@vXc@M?H%yfGevH^*_j1Ku4UijToL z{1AQ)e}U)Yy5Zq@t%9R?Al@90#(UwhcoIGpUx=^758_$4i09yWxCi$g!F=#Qyd6&9 z{qZ4qJU$Ay;dAh1_Ui>63;f=Nozux)yQhXi013!$P#joQJaX0=2FR@kl zdRN3zJQ#0@cgFkT!|-wVG<*@h3g3k9#j|h`&%vMLd3f=y!}D4JNAW(_yBw)J`rDxr{Np$ zWB3{T8vYP}iGRd>c4j_!W88?R;_LBU_;Fms@8R!pWS8*uu8TLtBk=Zk4}1td4WEan z;`?wXei6TgKf#MMhx_)!%i*=~2DlM#jd#ZfK>#RKu?cr@M%kHyE}Q}Frt3Op0vjXUv+_$~YiuHfHszcJzYt%}#j4fyok!jHcI zPs2ChJboO%gx|)W;_vYvcs=PFg*V2# z;{)&!coMz@Ux{zT58(oyjo-!J;9u}k`-SJR8Xka0;9c;+_&9tvz7pS#AIBy937(Jp z?jP>A7TyeRgZIGW@I-tjz6{UA_u{AU>-b~*KiublaNia1y0{T-b~*Kiua)`r~zRBi;t@fyd#A_)L5mz5(BjpTMu+5Ae7654=oEcphuxL3k@X z1|N(k;WVCtufuoZPW&={7k`C+#!DR(?!Ouyj7Q?F@%FeGx8PRXhTCxm&f!j6#9!cV z@I3qrjvO4G*K+twd@=68ci>0yi}*Xd_#s>m{y#hjZ;6}n(fB|3EPNTBf%AA4eg(ge zyYX+hUot$8)$ss49Pfbl#^dp1d=9<>--I8)&*C@nXZT0F_}Fm&mGK66DBd3LjmP83 z_#Au%z6n2opT%$D&+vS_$hdI-NjB^LQ411;3BG@o%`_5#f2PjtAi3cn7>UJ`7L7XXB~(Mtnbh2ET#7!av|&ab!Yx z9!uae@x{0UKZR%GZ}Bg9sUySJvnt*Y55?QzJ@Ghv98TjY_&WSBej2}yKf)FKCtl{? z;dyL^kH#nB^YAqMBrf9j@Yi@gUi_%=^{#~1!$a|Cygxn)pNgm88TdZ@EPfk*g@42U zY7O`OKiq(~#e3r;@JaY0JRRSSpTz&gpW&Zy-=o9**2Dwx)_8Y(D4vYZ!&l=w@ZQ3GT)};g3-?(GZ-|HE9q>MQ zEKcFm@g;aV&f&-KOLz{RhyTF;ni!tPT6j~uIo=8HhmXJ~;B)Ys_(MDw|ALn~KHO(j zydfTnU&im^PjChQj{8mGdhq)AD0~7w2VaBl!1v=P@q74F{5@W5a=6d3cx^loZ;5xn zd*UQM8lQ~M!&l>(_*Q%uz8^n|3-~!)#P8$J@jM(kAw2JY;Wh9^_$GW8ehj~WKfyoZ zKK}_{-*R|e9K+k--S9#9SlouM#JAx`@XPoe{5k#^uW(|xe}7z$x4=8&{qY3+AAByp z0?)yp;(55wN#Q=r<0#$?Z-sZoUHA(;A1{7#_)}Q`3McS*oWiH$OYn4jFMa~g z#$EVp{44HzN_ZZt;f?Uo_(Xgjo`!G2_v5GW>-ZyF!GGdq+QR+%<9fUW-Wl(YC*c3! zbMY1UM*IYR3D3b_;-Bymr-u8ljMvA5@iusOoW#fC)9}T(1K)uk#V_J_@E3SKUi`H1 zJXXT%;YK_PC-5Qo7gQwT#D0YhxaeS*Wlam!}xjpHZJ3D@YUypujfYm4*mrH z4=-|V`1zK@QM@VM9Pfnp!$;s#@VU4hUxu&3*WnxS?KqDg#GUvl+;m=eerMw;_&R(i zj-4NVzAf<1cz-+r{|BFor{Nhmk7wam@W=QYJP-eZ|HO-55T3{KcrCms-U9D{_r{0e zlknO2a(p*_6u*c+!xj7|UgpB^Jo@9U@UFN8PsC^749?;Q@w501{0W|i`&<<6w>*yG z&G1%uFMKGTh|k1V;al*7_*wiW{u=*^`?iPsuZ9QUt?;h61-Ife@ufJ6^Y}UZCjJ!9 z!+kCe_gw)Gz$5S&d=PHMr{Ih544lWa@GJOz+>L+3b(e(uNAae(0T0Jp;%)IxcsIN^ zJ`j(^N8qFJ@%SWsIz9(qgfGQc;_3JXd>g(SKY$;@PvYnCZ2Vt52Y-sc!$0ER@FG*f zKR-+26>t=9iW~57yd~Zi?}YcpNqj6m4PT6><6H4VcsBk7{}1=cgy*>$-UyGtqwzj? zJf4Kl!k6Rg@SXT6JR5i6uW{X_;r?sl2Hb>q!3W?Y@rn36+=1`KkK-bK56{Ja;(nKf z`>&2S#zXM7cn>@lr|{|cKKulpjaRrleEt1#J^l&znHqll@^~FwkGH@(@mKg~yyO+(d98^z#PxVjd@w!+pN!AJ8GJ3i89#_0$Is#teh+u! zpYfv8!t+`NuYotj4R}kuJx<^Q@e%lVd>Xz0PsLfB!w=!7@N7H>f8OgwB9TaZ$w=e} z_WxYSqpJIhUdg-{@`C*p7V>sg_g}~h_Sad+3-;?5@`C-?LSC@H^+MjZ>d^~%!TAK< zACJRF;gc5fg6BVDAuo9TDY#=HFF1eWLSAtGUOa0dFF61FLSArw&O%Q0@oD%r{3ias*ZrzL4+~!ZSG?5K;n!Qg*TMOLco^q*!$)!cME0-3 zPvdX#>eqy?Z##S}z7{{!>!42ozry*s?9anJoL~9c@bxwHI(WUU*gqIwfbYj2;(i_B z*Bgq*;!}GaT+g|9D(Ca;KZ2j){CoH(&M!7Se7)=A-SElyCS1b5;f<~fzuvaJ4*ECa z12}&I`={gcIX?qG&iR+vpNm(%K774#d=#FBpTytbzS+N@Kj^;#j`lkEylG;8dpw5o zM=Z3z;PdW;g}mVN=5*Z7<8%0J+-F93J_GT7_$+)ke!17dJl?<`bH0cD#b<`+x$;6@ z(7*peUeJG2JYpd)I3Hig3(k+h2QK6V=MP=T3(iko$P4yQUC0ae&&5~wI(WaI!QbIE zZV1nRdwd+exYxmar{NnpUts@5{5t2q#!KE9em_>~b1;`}{$Hs{}E|5v=h&Ee}$;8XC;_%-}HUj3Hv`>`&L^*VTen%UnQ zAI$mx;LACmWxs&G#;e>Kp2sNMim${^;}3fsy#HU~`J7+jw(z{x#OwDunAetgf6gDy z{<-)b+=Z9CJv@&_d=S0>-_+}%|6RC~^Y5_#5uVHWMeq1$UJE|&R#?ajKJV7V19~0I zZ%2GQz7D^Lf588j3(sp8d_=E{m#3`J{8Jxv=T)-t<#uXe{@W%FjE$Fixj^Y@O;{;CP6i(v| z&f+{S;1Vw53Xb#%+W-B2E{CHyhT}MalQ@ObID@k|j|;ej%eaCgfB*6OYY2b6|2T?c zIF1uIiBmX@d;ht-c0F14^SFRZxQr_}vKa3_j^Y@O;{;CP6i(v|&f+{S;1Vw53XUvJ ze;maz9LEWq#3`J{8Jxv=T)-t<#uXe{g8n#)V>pfzIEhm@jWall^SFRZxQr_}QvJ*i zzW)02kE1w-7d$5TT96YsiBmX@GdPR$xPVKzj4L>@RB-i?zwYPD;V6#bI8NXsPT@4p z;4IGL0xsb)uHZ;t`r{~$;W$pGOpmrg1=bye#NUl8_VG+j^Q{? z;3Q7rG|u2G&f@|u;WDn^$kIXk-k*OQ#W5Vm37o_!oW>cP#d%!7C0xc89I2x}j^Y@O z;{;CP6i(v|&f+{S;1Vw53Xc4X{y2(bIF1uIiBmX@GdPR$xPVKzj4L>@4E=Ew$8a1c za1y6*8fS18=Wzj-a2Z!{WLf&-D30McPT(X?;WW5rp0hT}MalQ@ObID@k|j|;ej%eaCgE6^WDaSX?C0w-|_ zr*Q^naUK_N372sNM^>aij^Y@O;{;CP6i(v|&f+{S;1Vw53XZHqe;maz9LEWq#3`J{ z8Jxv=T)-t<#uXe{nf^G6V>pfzIEhm@jWall^SFRZxQr_}vI_li6vuEJCvXy{a2jWD z7UyvRmv9+ZaAZ~b<0y{dI8NXsPT@4p;4IGL0xsb)uHeXO^v6*g!*QIzNu0uIoWWU~ z#|2!%Wn96L)#;C;IELdmfs;6e(>Q~(IFAdsgv+>sBWutfM{x|taRMiC3a4=fXK@}E za0!=j1xMDTKaS!Uj^hMQ;uKEf49?;_F5nU_;|h+fMSmQ{F&xJUoWv=d#u=Q&d0fCH zT*eg~=}&(g#W5Vm37o_!oW>cP#d%!7C0xc899f(GIErI9juSYEQ#g$?IE(YRfJ?ZH zD>(9h^v6*g!*QIzNu0uIoWWU~#|2!%Wn96LDE)C1$8a1ca1y6*8fS18=Wzj-a2Z!{ zWSvOu>#u+R#!(!@ah$+OoWg0G!C9Qg1zf^qT)~lbYxV#B{SS`f7>?rvPT~|!;|$K? zJTBl8F5?Q0tVe$w#W5Vm37o_!oW>cP#d%!7C0xc899f_KIErI9juSYEQ#g$?IE(YR zfJ?ZHD>$+N{c#k>a2zLa5~pw)XK)thaRHZb8CP&*L;B+=j^Q{?;3Q7rG|u2G&f@|u z;WDn^$VT+XQ5?f@oWMz(!fBkrS)9iOT*75s!I1&<$59-^ah$+OoWg0G!C9Qg1zf^q zT)~lz>5rp0hT}MalQ@ObID@k|j|;ej%eaCgo6sLeaSX?C0w-|_r*Q^naUK_N372sN zM>eHDj^Y@O;{;CP6i(v|&f+{S;1Vw53SRjCq4%%9|JH}+5ydea#|fOoDV)X`oW*%u zz$IM96&x8D?ze;maz9LEWq#3`J{8Jxv=T)-t<#uXfi(H}=~499T-Cvgg=aRz5`9v5&4 zmvIG08t9LsIELdmfs;6e(>Q~(IFAdsgv+>sBaQUOQ5?f@oWMz(!fBkrS)9iOT*75s z!I8oA$59-^ah$+OoWg0G!C9Qg1zf^qT)~kc^v6*g!*QIzNu0uIoWWU~#|2!%Wn96L zq4dX59K&&(z)76KX`I1XoW})R!ev~+kzw@5Q5?f@oWMz(!fBkrS)9iOT*75s!I9zg z$59-^ah$+OoWg0G!C9Qg1zf^qT)~kM^v6*g!*QIzNu0uIoWWU~#|2!%Wn96Lk@Uw= z9K&&(z)76KX`I1XoW})R!ev~+kGOplAoc=h9V>pfzIEhm@jWall^SFRZxQr_} zGAdI0`s?36aTLdJ94BxRr*Il)a2Drr0he$YS8!yTTK&I&|Bs_MhT}MalQ@ObID@k| zj|;ej%eaCg+tMFLaSX?C0w-|_r*Q^naUK_N372sNN4BFsj^Y@O;{;CP6i(v|&f+{S z;1Vw53XW_~e;maz9LEWq#3`J{8Jxv=T)-t<#uXgdf&Ms(V>pfzIEhm@jWall^SFRZ zxQr_}GMfH4ieosA6F7-eIE^zni}SdEOSp_HII<)CaTLdJ94BxRr*Il)a2Drr0he$Y zS8!w}`r{~$;W$pGOpmr&h*Do9K&&(z)76KX`I1XoW})R!ev~+ zkzMGIqd11+IDwNmh0{2LvpA0nxP;5Nf+NlJ$59-^ah$+OoWg0G!C9Qg1zf^qT)~lD z>5rp0hT}MalQ@ObID@k|j|;ej%eaCgW9W~gIELdmfs;6e(>Q~(IFAdsgv+>sBfHTb zM{x|taRMiC3a4=fXK@}Ea0!=j1xFI}$59-^ah$+OoWg0G!C9Qg1zf^qT)~mu>5rp0 zhT}MalQ@ObID@k|j|;ej%eaCgd(a<8aSX?C0w-|_r*Q^naUK_N372sNNA{#Yj^Y@O z;{;CP6i(v|&f+{S;1Vw53XbeWe;maz9LEWq#3`J{8Jxv=T)-t<#uXgdoBlY8V>pfz zIEhm@jWall^SFRZxQr_}vJd@n6vuEJCvXy{a2jWD7UyvRmv9+ZaAaTl<0y{dI8NXs zPT@4p;4IGL0xsb)uHeXi^v6*g!*QIzNu0uIoWWU~#|2!%Wn96L{ppXRIELdmfs;6e z(>Q~(IFAdsgv+>sBL~nQM{x|taRMiC3a4=fXK@}Ea0!=j1xF5~KaS!Uj^hMQ;uKEf z49?;_F5nU_;|h+n&>u%}499T-Cvgg=aRz5`9v5&4mvIG04x&Gf;uwzO1Ww`jq(6@07>?rvPT~|!;|$K?JTBl8F5?Q0jE&U3{`&ntj^Y@O;{;CP6i(v| z&f+{S;1Vw53XY7c)&KkV|2T?cIF1uIiBmX@GdPR$xPVKzj4L>DDE)C1$8a1ca1y6* z8fS18=Wzj-a2Z!{Q~( zIFAdsgv+>sBNOP4qd11+IDwNmh0{2LvpA0nxP;5Nf+I)LA4hQv$8iEDaSEq#24`^| z7jOxeaRo>IO@AE4F&xJUoWv=d#u=Q&d0fCHT*eg~Ig0)`ieosA6F7-eIE^zni}SdE zOSp_HIMPag9K|sl#|fOoDV)X`oW*%uz$IM96&yL5{y2(bIF1uIiBmX@GdPR$xPVKz zj4L>D4E=Ew$8a1ca1y6*8fS18=Wzj-a2Z!{!l-{c#k>a2zLa5~pw)XK)thaRHZb8CP&* zBK>g`$8a1ca1y6*8fS18=Wzj-a2Z!{GOpmr3G~NN z9K&&(z)76KX`I1XoW})R!ev~+k^j&iM{x|taRMiC3a4=fXK@}Ea0!=j1xHS#KaS!U zj^hMQ;uKEf49?;_F5nU_;|h+PM1LH`F&xJUoWv=d#u=Q&d0fCHT*eg~Ihp=AieosA z6F7-eIE^zni}SdEOSp_HIC2X8aTLdJ94BxRr*Il)a2Drr0he$YS8$|_{y2(bIF1uI ziBmX@GdPR$xPVKzj4L>DD*bU3$8a1ca1y6*8fS18=Wzj-a2Z!{a2zLa5~pw) zXK)thaRHZb8CP)Rj7aV4uiyXUD30McPT(X?;WW?rvPT~|!;|$K?JTBl8F5?Q0oK1fm#W5Vm z37o_!oW>cP#d%!7C0xc8965*nIErI9juSYEQ#g$?IE(YRfJ?ZHD>!m4{c#k>a2zLa z5~pw)XK)thaRHZb8CP)RJo@7(j^Q{?;3Q7rG|u2G&f@|u;WDn^$ocfgQ5?f@oWQNP z4Y%VCoWq^Ch`Vq%?!k2zg!`|B>v0oq#x1xNx8Zi&fpfSM7jYNv#yz<1Li*!++=QEP z3vR`2xE*)k9PY$L+=aVw53ak2{)Pp$>v0oq z#x1xNx8Zi&fpfSM7jYNv#yz<1V*2BH+=QEP3vR`2xE*)k9PY$L+=aVw53aj}{!#2j*W)JKj9YLkZo}=k1LtrjF5)iSjeBrihW@x7 zH{oX7f?IJLZpR%shdXf*cj0c_gX=D(Kd#43xEZ(LR@{c$aR<)fPF%!YxEuH2y36Q~ z>v0oq#x1xNx8Zi&fpfSM7jYNv#yz<1a{A+X+=QEP3vR`2xE*)k9PY$L+=aVw53ZX^ ze_W57a5HYft+)-h;|`p|ow$g*a5wJ3byv_I*W)JKj9YLkZo}=k1LtrjF5)iSjeBt2 zH2ULu+=QEP3vR`2xE*)k9PY$L+=aVw53akC{#m|duE$Nd8Mok8+=kn62hQP6T*O_t8~5P4tLcyHaT9LFEw~l8;db1CbGQ>1aTo5! zJ-F@~`r~@sgqv{-ZpCf59e3ay?!-mhg}ZSNuDh20xE?p*X54~XaT{*O9XN+OaS?an zZrp?GI_Qt1aTo5!J-BW<{c$~R!p*n^x8gS3jyrG;cj6-M z!rizB*Ih?{T#uV@Gj74HxDB`C4xGcCxQM%OH}1i8*V7-@<0jmUTW~9G!|k{O=Wr)3 z;x62cdvINr{t;l1UkiT!zZR~?O}H7i;8xs* z+i?fZ;Z9t{UAPBdrD{jN>xC7^KCobYH+>Lv1-Hr6e^|%Q);}+bC+i*MXz&YHBi?|DS;~rdh6a8^L zZoSeN4tL@r?!w);2iM(9e_W57a5HYft+)-h;|`p|ow$g*a5wJ3b+^zT z*W)JKj9YLkZo}=k1LtrjF5)iSjeBt2t@OwBxCuAo7Tk*4a69h6IoyehxC?jV9$a@D z{c$~R!p*n^x8gS3jyrG;cj6-M!rizB*WFHkT#uV@Gj74HxDB`C4xGcCxQM%OH}1i8 zchDc#<0jmUTW~9G!|k{O=Wr)3;x62cdvINj{+YmKuE$Nd8Mok8+=kn62hQP6T*O_t8~5P4yXcSWaT9LFEw~l8;db1CbGQ>1aTo5! zJ-F^}`r~@sgqv{-ZpCf59e3ay?!-mhg}ZSNuFKOO*W)JKj9YLkZo}=k1LtrjF5)iS zjeBt2J@m)*xCuAo7Tk*4a69h6IoyehxC?jV9$a@X{c$~R!p*n^x8gS3jyrG;cj6-M z!rizB*WE{dT#uV@Gj74HxDB`C4xGcCxQM%OH}1i8_tPKO<0jmUTW~9G!|k{O=Wr)3 z;x62cdvM(Y^vCtM2{+>w+=|<9JMO?a+=+|03wPrlT=yXTaXoIr&A0`(;x^olJ8%wn z;v(+C-M9zWJw$(8kDG8aZo#d%4Y%VCoWq^Ch`Vq%?!k2r(;wI4Cftl$a4T-Z?YINy za3?O}F5HcKaNQ&H$Mv`gH{%xEira8I?!YBdrD{jN>xC7^KCobYH+>Lv1-ShOv^|%Q);}+bC+i*MXz&YHBi?|DS z;~rf10{wA4ZoSeN4tL@r?!w);2iLtwe_W57a5HYft+)-h;|`p|ow$g* za5wJ3buZB$*W)JKj9YLkZo}=k1LtrjF5)iSjeBt2%k;SeN4tL@r?!w);2iLtye_W57a5HYft+)-h;|`p| zow$g*a5wJ3btU@adfbGYaSLw6ZMYqG;2iG6McjqEaSyJ0jsCbEH{q3fAKtI}efuRN zk=1&=NcH=Ie@}QHzr4%~%e=VE^UJ)nOk~hujI)2i`$k>TT98x_InJ~WkAAddm z?~_L!bNI25L9MMP9DT^x!w#Ex{Eq2APo&dLoE#nmKp~KsiBq{gQdn=s=j9L zi`PAT<1wh6iiIg3wq?LxZJ;f6|a(ZEz48YpJ1H{qHMlYzR_A zEe-G88ySSgT51>(tPKxBV=WB}mKtiQaY${gmIl|B8fz&Cjn#J|7+EdFf;4hiuvtru zBZ9TzL1?U{VZl;EEe#Eph6JIpmKp}v)@q?KNDcp_U}KF<5G>rG|e}u-Q=kDgJw~gJVHzsHGvjdyON5G$IHM zwKTl8R7=BxrN&wsT3f26h9SY);2<>qlWI#1L29U_##pd6xc3T22BEQ*8b;LCh6ia_ z5E}kTLxZ)(Awg=WrNO~c^^bP%58yv3SZb{PX%BungVY!c(#XbOvzCSjOO3TOELdvz zCk+kOh6JIpmKp}v)~X*Y!KM9^dY1;rYD@p5kqy1OBZAOaOT&YuhFWSI7OV{oLSrp8 z)Y6b(vte+M8f&4J8vaSaWafzh6kacmWBmOjkPqiwp2?E zLxQ!zL1_FZ)s`B9)KE)}vD#WKjU4g!8!$2m)z9_br4d1>ezf*34G%)~bFO!(`tjDA zh6SPexe{#F($HY3`Ug4K{3i_w)&>Wm`lH%=tokz&JfI;+)q76w+KAroBZE*q9ULD~ zOT&XSEC|&*O>k^zkcI@Ip_T>*OVv9~aK4rrgQdn=s@{fzV?n6ikAkIIYK+y^YH8%~ z-ec8!Q*Rm(gz8PIcWHPKsyC_NX=`a%u+&&f)f-puv7td|sHGvnQuU@5JlWt{YOJLo zRPSZMu~?9X1uG+iG$IJqJ6Z4M@E}z0WWo7iK^hu_Awj6#z=Bh?G`O}@OV#)A?;qaA zTB_dDf=33Su^~tewN$;&1;=V>Xz$9%AT-p{h+wID!|OdYJP3`oRK4}}ZVn4V^&S|! zPAv@$ma2EdU~@>21_z<>pHy3F3{v&h*Zauot*HR)32-Q1Z@bn{UX?T!^1)+MM z>pj*uG)N7#G^DmvOM`=@>K!k5fm&(|mKtlR;h$97to{KD?m9uL-WY?mS{gYxxU^at z5iC{jk-eM4gV0z@4Yf3^wpmNn8))w%hX$dcmWBjN)mv(CJ%ekh`YF(R-9f0{Kzo;} zx6L30hekH`rV&9H9)#-cGdMM@mWBptND!)b&EQxq4X!QKQuPBU_>&N%hT2;7GpTp8 zmKtiQdY27epq5591WUCvB3P>4ZhJR}2cfZ+syE)=&0#^P-hqQBtEHjAQuSUOYz_(1 z;2=~#H-k<=s@`sU*Q&SM;E}a7G8R1GpEM#^tKMaMcZUU`dYA288XAPgT571JA;D(# z#@l;-a1g3D-rl8#TB?4w2iF~>hT2*~u+&&f)%$bsfLM@54*&ZpMg*aHm+f7u-duar z&>&R*A{=ZE2~zbhoV{yfJBc92%q{L8#vJ{=c-dXSF6v%kayL3@s>*h@x2=sTjDcYSqUIgpSl;q5)wP3`H{& z!9<~dfWd@)-@xa^XI@hz-s{K)W-}O}O zbK2r2Ev1#^UXRgolZqg8>O)#e>pYxVx>SUs#nP!F9xayEqpq}9l}6Pj5sR*NlZpsT zaV^pG#qIfi38z5HIq#5mfk;bnDXpWfw5f@mJt=br_MFB zl&-4MsUn>mUs{j4n|9q0=1`eQzCET4uQOhT1tD>kT!vEaoGZIGQJ|D?IF?Mxy{$0 zd1UaEE`gpdMOrzBl?WMKX;;y~SuBmJ(xxJJ9ADxs(kDP7fOHS(ikSid6mVfv6iu$D$uiF1#cNe;QjO)A>66iFn9m3GaPE`eSw z#Z#acb9{*wOjp`fC9ak0v(sdObs?hUGm}@IyRby`#nE87fzo_9p>$Q1mYYtihd>5qja{JU za!W(vtspn;rYeqCQ{;H{Mf6a*hqRRT*P!WlfvZ|km%tUHs8gWziXs(5bX>Y2(Q(CX z0?FsFRa$ORabDSVOPt} zmx>&RZwA|EZ5b`_apu{5emn~Jwl$Cr5jisO|P+Vg!1?4nVZu-tU&SSrKF zQE5m7Y1}3dqz)@E)u*K-taOnnmexmIX%3eyEhU;k7b%@8xPo z<2PX`tvnvD`$D4_qEXc4``iLc=~8ie)8ZkmyF}ckIt1c2YTYDS$2x(h#iyVo5WE&k z+e5d`)oSTdk--*Ar-}~KV(C!PYFaF7CUG=+IiC>5Q9;#nM$(qWyH( zA?*UOY;j1mpK+T&8au4OzV4Gy5>^f^eH}>aL!wJfbv|6SM3<_&BoaFA6xI@rYl??J zXh+ewhIWAyrBOpzOPn%IkwfCwJ)o-%amrN3b^BM9W>#04BQvLT3B+}Zq_o2hX%~p= z6o)`sM{NRW?P4Vk(zEdreX8yuT`^OjPmQ_+VmXRFHFOAMu*F>>U3I0cinq1gGP;Hr z(Wi#ysVb4Cai_p}&8R~lU!#UVzPeaxtGbD|(%cMzRE;7_Etck?DqSi9G{sXOHXVOR zyFfCgI0VAa@g?5SeKsWy-W?_ojH=S^#3@|@$(Z6Pa17!2L)rxbFU27c4N;rGdvX+S zyDnDXQk_q^L@vgSe4hflZqy~Pr?|o?9Rd%D#a$xhbfry2F^?+|=nazyxwyGmERkt( zhd>AEuw5Dgk!G>9Roz4voZBG~WKqPI#nN0=rAu`RWR{~2X&1;Ri=|PuNraKZ-cS_z zWU;i)CGHYvAfrx!REnZ)4DAA`6vangLPH>)qBemRF^YqhJh3HOMBPIof#T-FV(F?X zkue!|2xLsuE)XM8#7Kx^r`({MsuqcM&|wdWb}(*kuO+5H9~i}lUqY9_iBgNDv#NBc zXc8U2mxiIQq-od`NtXCvILAOJs{{oYEnXEh+8-pC5=C0%_wCrA@{8 zQH!Ou>LwM}=`x&vE8M z+GD0byXRV^OGWc;@upLE2=sy(M!q>=NSi>cb(la8lPBV)D%zS?k%L7ilsIgRo5Ny> zh>JS~jz^*nfvk(#1;RCo&%uO-K-5_*Z7Nd7;!Q+W?w-JVX%yKQ+VXu0yel}bbXAp3 z6}z+JkJ2s;fm`FSO`<#W2`CA~ro|Eg8pmf|tll)&xJx(%5;V0#;ACvnE)b=zS{f?O z&sr>PRV6NrzU~u&>-a??XLY5yIH9zZt`;x{Bzi!gJ0`zqjOMK*0S2|S0 zs>RZ#;$ox4n^a_IiezYr&k;GHG*4BD$c#G$g3@6nu0-ledsS(uh|!Gavj)z*i5GXC zWr6Til@6Df64!m>E`b)FILM#ccu!=`ew_KdOf`hpNPR3Ed?Tf^mmHf<@7+g*Jhn#NtgV za?9}#i3E$An=?xs7{;9fG3BrlM=QD#hXT6NP!VD&5?v0vX}w*FycIcNu1+XjRi#r! z7CF8&RBXs%iM(-dEAd%O_cna7odSntjz1()O;;K!g5TmMtv5)7n!^gT zFRy#Ro4CcBVt7}yR=QNYL#22MyuPCjfmcz~F0enk>X0^pM>a(+rMcTmoY9P#Z-Yhc0y!E*Yvvj^sR+#!iApDw_dtaQXoflu{1sC21_TZ^T$s&uIMC``uh z0tp;N+)4#rW$r@~r$6J!R;#65GbKV(cS@vY+#!&fQM7kX*rg%xn-2~vZ7Pz~Vu?3} zyc}*)@%aFYC9e7DN^?XJuNF&}imS&KOQ(t}xhWpPQrcDYk#30tdT)10AZJtLij5OW zT&QU^OUy0i6bRQSPRqN*A(69jyFl~kgwjwEy%tNGihj~!iBBwKzbbJivBLz;cfE!Y z)lSIwxhhJWT8g^_vO9`1KcQ1tN{5QG87{k*ZYU8Ld1y<-vr|hnRJyrHSLu|9<5UlU zIF902Hna-_v&GU-aa?Axw5dpKizWKL+?ktHWV^)@VHr0c0Yb-NrK_rRs(4$>_(R}r z#l=R6M%4X8;sJM40yjH~@lGgFeB>|Q{QtiFJ=4GbktM$Uhd=nG{kvcIYVrB^cHVyd z5I;QKH{MG4vv)uHq{`}vh{9p6G^DkeW@X1$y{O|=ofB!r8{PB~oy{wPYkKvy8 z)A`?g4&v))`1joY`^Vr9vfa<9z5Q~&?ze%D&HvlXe}8|UW8Z%L1wXuZ&-y=P{y+Zk z+tJ@U_Br=s^Z)!mU-SOs-5q;B_E-Lw`Ct6kYyO}8=~owcKmV5*_OZwR%H#jtzkJPq zKK{>fK7Ky_KZkq2ChEhl{qgIO`}Exd_tBm8^6 z{a?p@{agS2TYUSRfBpKU%zys9vFF!w{`2eo_Wv38)jjOXVIThW+pjHs`o-(#=e%F! LDRuk){j&c7-CJ|s literal 0 HcmV?d00001 diff --git a/pkg/proc/linutil/dynamic.go b/pkg/proc/linutil/dynamic.go index 73fd34dce7..2e02a7741c 100644 --- a/pkg/proc/linutil/dynamic.go +++ b/pkg/proc/linutil/dynamic.go @@ -44,10 +44,10 @@ func readUintRaw(reader io.Reader, order binary.ByteOrder, ptrSize int) (uint64, // dynamicSearchDebug searches for the DT_DEBUG entry in the .dynamic section func dynamicSearchDebug(p proc.Process) (uint64, error) { bi := p.BinInfo() - mem := p.CurrentThread() + mem := p.Memory() dynbuf := make([]byte, bi.ElfDynamicSection.Size) - _, err := mem.ReadMemory(dynbuf, uintptr(bi.ElfDynamicSection.Addr)) + _, err := mem.ReadMemory(dynbuf, bi.ElfDynamicSection.Addr) if err != nil { return 0, err } @@ -73,7 +73,7 @@ func dynamicSearchDebug(p proc.Process) (uint64, error) { func readPtr(p proc.Process, addr uint64) (uint64, error) { ptrbuf := make([]byte, p.BinInfo().Arch.PtrSize()) - _, err := p.CurrentThread().ReadMemory(ptrbuf, uintptr(addr)) + _, err := p.Memory().ReadMemory(ptrbuf, addr) if err != nil { return 0, err } @@ -115,14 +115,14 @@ func readCString(p proc.Process, addr uint64) (string, error) { if addr == 0 { return "", nil } - mem := p.CurrentThread() + mem := p.Memory() buf := make([]byte, 1) r := []byte{} for { if len(r) > maxLibraryPathLength { return "", fmt.Errorf("error reading libraries: string too long (%d)", len(r)) } - _, err := mem.ReadMemory(buf, uintptr(addr)) + _, err := mem.ReadMemory(buf, addr) if err != nil { return "", err } diff --git a/pkg/proc/linutil/regs_amd64_arch.go b/pkg/proc/linutil/regs_amd64_arch.go index f25dd58986..dbea33960a 100644 --- a/pkg/proc/linutil/regs_amd64_arch.go +++ b/pkg/proc/linutil/regs_amd64_arch.go @@ -1,13 +1,12 @@ package linutil import ( - "bytes" - "encoding/binary" "fmt" - "golang.org/x/arch/x86/x86asm" - + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" ) // AMD64Registers implements the proc.Registers interface for the native/linux @@ -15,7 +14,7 @@ import ( type AMD64Registers struct { Regs *AMD64PtraceRegs Fpregs []proc.Register - Fpregset *AMD64Xstate + Fpregset *amd64util.AMD64Xstate loadFpRegs func(*AMD64Registers) error } @@ -130,164 +129,6 @@ func (r *AMD64Registers) GAddr() (uint64, bool) { return 0, false } -// Get returns the value of the n-th register (in x86asm order). -func (r *AMD64Registers) Get(n int) (uint64, error) { - reg := x86asm.Reg(n) - const ( - mask8 = 0x000000ff - mask16 = 0x0000ffff - mask32 = 0xffffffff - ) - - switch reg { - // 8-bit - case x86asm.AL: - return r.Regs.Rax & mask8, nil - case x86asm.CL: - return r.Regs.Rcx & mask8, nil - case x86asm.DL: - return r.Regs.Rdx & mask8, nil - case x86asm.BL: - return r.Regs.Rbx & mask8, nil - case x86asm.AH: - return (r.Regs.Rax >> 8) & mask8, nil - case x86asm.CH: - return (r.Regs.Rcx >> 8) & mask8, nil - case x86asm.DH: - return (r.Regs.Rdx >> 8) & mask8, nil - case x86asm.BH: - return (r.Regs.Rbx >> 8) & mask8, nil - case x86asm.SPB: - return r.Regs.Rsp & mask8, nil - case x86asm.BPB: - return r.Regs.Rbp & mask8, nil - case x86asm.SIB: - return r.Regs.Rsi & mask8, nil - case x86asm.DIB: - return r.Regs.Rdi & mask8, nil - case x86asm.R8B: - return r.Regs.R8 & mask8, nil - case x86asm.R9B: - return r.Regs.R9 & mask8, nil - case x86asm.R10B: - return r.Regs.R10 & mask8, nil - case x86asm.R11B: - return r.Regs.R11 & mask8, nil - case x86asm.R12B: - return r.Regs.R12 & mask8, nil - case x86asm.R13B: - return r.Regs.R13 & mask8, nil - case x86asm.R14B: - return r.Regs.R14 & mask8, nil - case x86asm.R15B: - return r.Regs.R15 & mask8, nil - - // 16-bit - case x86asm.AX: - return r.Regs.Rax & mask16, nil - case x86asm.CX: - return r.Regs.Rcx & mask16, nil - case x86asm.DX: - return r.Regs.Rdx & mask16, nil - case x86asm.BX: - return r.Regs.Rbx & mask16, nil - case x86asm.SP: - return r.Regs.Rsp & mask16, nil - case x86asm.BP: - return r.Regs.Rbp & mask16, nil - case x86asm.SI: - return r.Regs.Rsi & mask16, nil - case x86asm.DI: - return r.Regs.Rdi & mask16, nil - case x86asm.R8W: - return r.Regs.R8 & mask16, nil - case x86asm.R9W: - return r.Regs.R9 & mask16, nil - case x86asm.R10W: - return r.Regs.R10 & mask16, nil - case x86asm.R11W: - return r.Regs.R11 & mask16, nil - case x86asm.R12W: - return r.Regs.R12 & mask16, nil - case x86asm.R13W: - return r.Regs.R13 & mask16, nil - case x86asm.R14W: - return r.Regs.R14 & mask16, nil - case x86asm.R15W: - return r.Regs.R15 & mask16, nil - - // 32-bit - case x86asm.EAX: - return r.Regs.Rax & mask32, nil - case x86asm.ECX: - return r.Regs.Rcx & mask32, nil - case x86asm.EDX: - return r.Regs.Rdx & mask32, nil - case x86asm.EBX: - return r.Regs.Rbx & mask32, nil - case x86asm.ESP: - return r.Regs.Rsp & mask32, nil - case x86asm.EBP: - return r.Regs.Rbp & mask32, nil - case x86asm.ESI: - return r.Regs.Rsi & mask32, nil - case x86asm.EDI: - return r.Regs.Rdi & mask32, nil - case x86asm.R8L: - return r.Regs.R8 & mask32, nil - case x86asm.R9L: - return r.Regs.R9 & mask32, nil - case x86asm.R10L: - return r.Regs.R10 & mask32, nil - case x86asm.R11L: - return r.Regs.R11 & mask32, nil - case x86asm.R12L: - return r.Regs.R12 & mask32, nil - case x86asm.R13L: - return r.Regs.R13 & mask32, nil - case x86asm.R14L: - return r.Regs.R14 & mask32, nil - case x86asm.R15L: - return r.Regs.R15 & mask32, nil - - // 64-bit - case x86asm.RAX: - return r.Regs.Rax, nil - case x86asm.RCX: - return r.Regs.Rcx, nil - case x86asm.RDX: - return r.Regs.Rdx, nil - case x86asm.RBX: - return r.Regs.Rbx, nil - case x86asm.RSP: - return r.Regs.Rsp, nil - case x86asm.RBP: - return r.Regs.Rbp, nil - case x86asm.RSI: - return r.Regs.Rsi, nil - case x86asm.RDI: - return r.Regs.Rdi, nil - case x86asm.R8: - return r.Regs.R8, nil - case x86asm.R9: - return r.Regs.R9, nil - case x86asm.R10: - return r.Regs.R10, nil - case x86asm.R11: - return r.Regs.R11, nil - case x86asm.R12: - return r.Regs.R12, nil - case x86asm.R13: - return r.Regs.R13, nil - case x86asm.R14: - return r.Regs.R14, nil - case x86asm.R15: - return r.Regs.R15, nil - } - - return 0, proc.ErrUnknownRegister -} - // Copy returns a copy of these registers that is guaranteed not to change. func (r *AMD64Registers) Copy() (proc.Registers, error) { if r.loadFpRegs != nil { @@ -299,7 +140,7 @@ func (r *AMD64Registers) Copy() (proc.Registers, error) { } var rr AMD64Registers rr.Regs = &AMD64PtraceRegs{} - rr.Fpregset = &AMD64Xstate{} + rr.Fpregset = &amd64util.AMD64Xstate{} *(rr.Regs) = *(r.Regs) if r.Fpregset != nil { *(rr.Fpregset) = *(r.Fpregset) @@ -311,121 +152,70 @@ func (r *AMD64Registers) Copy() (proc.Registers, error) { return &rr, nil } -// AMD64PtraceFpRegs tracks user_fpregs_struct in /usr/include/x86_64-linux-gnu/sys/user.h -type AMD64PtraceFpRegs struct { - Cwd uint16 - Swd uint16 - Ftw uint16 - Fop uint16 - Rip uint64 - Rdp uint64 - Mxcsr uint32 - MxcrMask uint32 - StSpace [32]uint32 - XmmSpace [256]byte - Padding [24]uint32 -} - -// AMD64Xstate represents amd64 XSAVE area. See Section 13.1 (and -// following) of Intel® 64 and IA-32 Architectures Software Developer’s -// Manual, Volume 1: Basic Architecture. -type AMD64Xstate struct { - AMD64PtraceFpRegs - Xsave []byte // raw xsave area - AvxState bool // contains AVX state - YmmSpace [256]byte - Avx512State bool // contains AVX512 state - ZmmSpace [512]byte -} - -// Decode decodes an XSAVE area to a list of name/value pairs of registers. -func (xsave *AMD64Xstate) Decode() (regs []proc.Register) { - // x87 registers - regs = proc.AppendUint64Register(regs, "CW", uint64(xsave.Cwd)) - regs = proc.AppendUint64Register(regs, "SW", uint64(xsave.Swd)) - regs = proc.AppendUint64Register(regs, "TW", uint64(xsave.Ftw)) - regs = proc.AppendUint64Register(regs, "FOP", uint64(xsave.Fop)) - regs = proc.AppendUint64Register(regs, "FIP", xsave.Rip) - regs = proc.AppendUint64Register(regs, "FDP", xsave.Rdp) - - for i := 0; i < len(xsave.StSpace); i += 4 { - var buf bytes.Buffer - binary.Write(&buf, binary.LittleEndian, uint64(xsave.StSpace[i+1])<<32|uint64(xsave.StSpace[i])) - binary.Write(&buf, binary.LittleEndian, uint16(xsave.StSpace[i+2])) - regs = proc.AppendBytesRegister(regs, fmt.Sprintf("ST(%d)", i/4), buf.Bytes()) +func (r *AMD64Registers) SetReg(regNum uint64, reg *op.DwarfRegister) (bool, error) { + var p *uint64 + switch regNum { + case regnum.AMD64_Rax: + p = &r.Regs.Rax + case regnum.AMD64_Rbx: + p = &r.Regs.Rbx + case regnum.AMD64_Rcx: + p = &r.Regs.Rcx + case regnum.AMD64_Rdx: + p = &r.Regs.Rdx + case regnum.AMD64_Rsi: + p = &r.Regs.Rsi + case regnum.AMD64_Rdi: + p = &r.Regs.Rdi + case regnum.AMD64_Rbp: + p = &r.Regs.Rbp + case regnum.AMD64_Rsp: + p = &r.Regs.Rsp + case regnum.AMD64_R8: + p = &r.Regs.R8 + case regnum.AMD64_R9: + p = &r.Regs.R9 + case regnum.AMD64_R10: + p = &r.Regs.R10 + case regnum.AMD64_R11: + p = &r.Regs.R11 + case regnum.AMD64_R12: + p = &r.Regs.R12 + case regnum.AMD64_R13: + p = &r.Regs.R13 + case regnum.AMD64_R14: + p = &r.Regs.R14 + case regnum.AMD64_R15: + p = &r.Regs.R15 + case regnum.AMD64_Rip: + p = &r.Regs.Rip } - // SSE registers - regs = proc.AppendUint64Register(regs, "MXCSR", uint64(xsave.Mxcsr)) - regs = proc.AppendUint64Register(regs, "MXCSR_MASK", uint64(xsave.MxcrMask)) - - for i := 0; i < len(xsave.XmmSpace); i += 16 { - n := i / 16 - regs = proc.AppendBytesRegister(regs, fmt.Sprintf("XMM%d", n), xsave.XmmSpace[i:i+16]) - if xsave.AvxState { - regs = proc.AppendBytesRegister(regs, fmt.Sprintf("YMM%d", n), xsave.YmmSpace[i:i+16]) - if xsave.Avx512State { - regs = proc.AppendBytesRegister(regs, fmt.Sprintf("ZMM%d", n), xsave.ZmmSpace[n*32:(n+1)*32]) - } + if p != nil { + if reg.Bytes != nil && len(reg.Bytes) != 8 { + return false, fmt.Errorf("wrong number of bytes for register %s (%d)", regnum.AMD64ToName(regNum), len(reg.Bytes)) } + *p = reg.Uint64Val + return false, nil } - return -} - -const ( - _XSAVE_HEADER_START = 512 - _XSAVE_HEADER_LEN = 64 - _XSAVE_EXTENDED_REGION_START = 576 - _XSAVE_SSE_REGION_LEN = 416 - _XSAVE_AVX512_ZMM_REGION_START = 1152 -) - -// LinuxX86XstateRead reads a byte array containing an XSAVE area into regset. -// If readLegacy is true regset.PtraceFpRegs will be filled with the -// contents of the legacy region of the XSAVE area. -// See Section 13.1 (and following) of Intel® 64 and IA-32 Architectures -// Software Developer’s Manual, Volume 1: Basic Architecture. -func AMD64XstateRead(xstateargs []byte, readLegacy bool, regset *AMD64Xstate) error { - if _XSAVE_HEADER_START+_XSAVE_HEADER_LEN >= len(xstateargs) { - return nil - } - if readLegacy { - rdr := bytes.NewReader(xstateargs[:_XSAVE_HEADER_START]) - if err := binary.Read(rdr, binary.LittleEndian, ®set.AMD64PtraceFpRegs); err != nil { - return err + if r.loadFpRegs != nil { + err := r.loadFpRegs(r) + if err != nil { + return false, err } - } - xsaveheader := xstateargs[_XSAVE_HEADER_START : _XSAVE_HEADER_START+_XSAVE_HEADER_LEN] - xstate_bv := binary.LittleEndian.Uint64(xsaveheader[0:8]) - xcomp_bv := binary.LittleEndian.Uint64(xsaveheader[8:16]) - - if xcomp_bv&(1<<63) != 0 { - // compact format not supported - return nil + r.loadFpRegs = nil } - if xstate_bv&(1<<2) == 0 { - // AVX state not present - return nil + if regNum < regnum.AMD64_XMM0 || regNum > regnum.AMD64_XMM0+15 { + return false, fmt.Errorf("can not set %s", regnum.AMD64ToName(regNum)) } - avxstate := xstateargs[_XSAVE_EXTENDED_REGION_START:] - regset.AvxState = true - copy(regset.YmmSpace[:], avxstate[:len(regset.YmmSpace)]) + reg.FillBytes() - if xstate_bv&(1<<6) == 0 { - // AVX512 state not present - return nil + err := r.Fpregset.SetXmmRegister(int(regNum-regnum.AMD64_XMM0), reg.Bytes) + if err != nil { + return false, err } - - avx512state := xstateargs[_XSAVE_AVX512_ZMM_REGION_START:] - regset.Avx512State = true - copy(regset.ZmmSpace[:], avx512state[:len(regset.ZmmSpace)]) - - // TODO(aarzilli): if xstate_bv&(1<<7) is set then xstateargs[1664:2688] - // contains ZMM16 through ZMM31, those aren't just the higher 256bits, it's - // the full register so each is 64 bytes (512bits) - - return nil + return true, nil } diff --git a/pkg/proc/linutil/regs_arm64_arch.go b/pkg/proc/linutil/regs_arm64_arch.go index a82b0b7d1c..8bdae1320b 100644 --- a/pkg/proc/linutil/regs_arm64_arch.go +++ b/pkg/proc/linutil/regs_arm64_arch.go @@ -2,22 +2,23 @@ package linutil import ( "fmt" - "golang.org/x/arch/arm64/arm64asm" "github.com/go-delve/delve/pkg/proc" ) -// Regs is a wrapper for sys.PtraceRegs. +// ARM64Registers is a wrapper for sys.PtraceRegs. type ARM64Registers struct { - Regs *ARM64PtraceRegs //general-purpose registers - Fpregs []proc.Register //Formatted floating point registers - Fpregset []byte //holding all floating point register values + Regs *ARM64PtraceRegs //general-purpose registers + iscgo bool + tpidr_el0 uint64 + Fpregs []proc.Register //Formatted floating point registers + Fpregset []byte //holding all floating point register values loadFpRegs func(*ARM64Registers) error } -func NewARM64Registers(regs *ARM64PtraceRegs, loadFpRegs func(*ARM64Registers) error) *ARM64Registers { - return &ARM64Registers{Regs: regs, loadFpRegs: loadFpRegs} +func NewARM64Registers(regs *ARM64PtraceRegs, iscgo bool, tpidr_el0 uint64, loadFpRegs func(*ARM64Registers) error) *ARM64Registers { + return &ARM64Registers{Regs: regs, iscgo: iscgo, tpidr_el0: tpidr_el0, loadFpRegs: loadFpRegs} } // ARM64PtraceRegs is the struct used by the linux kernel to return the @@ -102,24 +103,16 @@ func (r *ARM64Registers) BP() uint64 { // TLS returns the address of the thread local storage memory segment. func (r *ARM64Registers) TLS() uint64 { - return 0 + if !r.iscgo { + return 0 + } + return r.tpidr_el0 } // GAddr returns the address of the G variable if it is known, 0 and false // otherwise. func (r *ARM64Registers) GAddr() (uint64, bool) { - return r.Regs.Regs[28], true -} - -// Get returns the value of the n-th register (in arm64asm order). -func (r *ARM64Registers) Get(n int) (uint64, error) { - reg := arm64asm.Reg(n) - - if reg >= arm64asm.X0 && reg <= arm64asm.X30 { - return r.Regs.Regs[reg-arm64asm.X0], nil - } - - return 0, proc.ErrUnknownRegister + return r.Regs.Regs[28], !r.iscgo } // Copy returns a copy of these registers that is guaranteed not to change. diff --git a/pkg/proc/linutil/regs_i386_arch.go b/pkg/proc/linutil/regs_i386_arch.go index ed7d6bbea3..d456ff00fe 100644 --- a/pkg/proc/linutil/regs_i386_arch.go +++ b/pkg/proc/linutil/regs_i386_arch.go @@ -1,11 +1,8 @@ package linutil import ( - "bytes" - "encoding/binary" - "fmt" "github.com/go-delve/delve/pkg/proc" - "golang.org/x/arch/x86/x86asm" + "github.com/go-delve/delve/pkg/proc/amd64util" ) // I386Registers implements the proc.Registers interface for the native/linux @@ -13,7 +10,7 @@ import ( type I386Registers struct { Regs *I386PtraceRegs Fpregs []proc.Register - Fpregset *I386Xstate + Fpregset *amd64util.AMD64Xstate Tls uint64 loadFpRegs func(*I386Registers) error @@ -114,80 +111,6 @@ func (r *I386Registers) GAddr() (uint64, bool) { return 0, false } -// Get returns the value of the n-th register (in x86asm order). -func (r *I386Registers) Get(n int) (uint64, error) { - reg := x86asm.Reg(n) - const ( - mask8 = 0x000000ff - mask16 = 0x0000ffff - ) - - switch reg { - // 8-bit - case x86asm.AL: - return uint64(r.Regs.Eax) & mask8, nil - case x86asm.CL: - return uint64(r.Regs.Ecx) & mask8, nil - case x86asm.DL: - return uint64(r.Regs.Edx) & mask8, nil - case x86asm.BL: - return uint64(r.Regs.Ebx) & mask8, nil - case x86asm.AH: - return (uint64(r.Regs.Eax) >> 8) & mask8, nil - case x86asm.CH: - return (uint64(r.Regs.Ecx) >> 8) & mask8, nil - case x86asm.DH: - return (uint64(r.Regs.Edx) >> 8) & mask8, nil - case x86asm.BH: - return (uint64(r.Regs.Ebx) >> 8) & mask8, nil - case x86asm.SPB: - return uint64(r.Regs.Esp) & mask8, nil - case x86asm.BPB: - return uint64(r.Regs.Ebp) & mask8, nil - case x86asm.SIB: - return uint64(r.Regs.Esi) & mask8, nil - case x86asm.DIB: - return uint64(r.Regs.Edi) & mask8, nil - - // 16-bit - case x86asm.AX: - return uint64(r.Regs.Eax) & mask16, nil - case x86asm.CX: - return uint64(r.Regs.Ecx) & mask16, nil - case x86asm.DX: - return uint64(r.Regs.Edx) & mask16, nil - case x86asm.BX: - return uint64(r.Regs.Ebx) & mask16, nil - case x86asm.SP: - return uint64(r.Regs.Esp) & mask16, nil - case x86asm.BP: - return uint64(r.Regs.Ebp) & mask16, nil - case x86asm.SI: - return uint64(r.Regs.Esi) & mask16, nil - case x86asm.DI: - return uint64(r.Regs.Edi) & mask16, nil - - // 32-bit - case x86asm.EAX: - return uint64(uint32(r.Regs.Eax)), nil - case x86asm.ECX: - return uint64(uint32(r.Regs.Ecx)), nil - case x86asm.EDX: - return uint64(uint32(r.Regs.Edx)), nil - case x86asm.EBX: - return uint64(uint32(r.Regs.Ebx)), nil - case x86asm.ESP: - return uint64(uint32(r.Regs.Esp)), nil - case x86asm.EBP: - return uint64(uint32(r.Regs.Ebp)), nil - case x86asm.ESI: - return uint64(uint32(r.Regs.Esi)), nil - case x86asm.EDI: - return uint64(uint32(r.Regs.Edi)), nil - } - return 0, proc.ErrUnknownRegister -} - // Copy returns a copy of these registers that is guaranteed not to change. func (r *I386Registers) Copy() (proc.Registers, error) { if r.loadFpRegs != nil { @@ -199,7 +122,7 @@ func (r *I386Registers) Copy() (proc.Registers, error) { } var rr I386Registers rr.Regs = &I386PtraceRegs{} - rr.Fpregset = &I386Xstate{} + rr.Fpregset = &amd64util.AMD64Xstate{} *(rr.Regs) = *(r.Regs) if r.Fpregset != nil { *(rr.Fpregset) = *(r.Fpregset) @@ -210,95 +133,3 @@ func (r *I386Registers) Copy() (proc.Registers, error) { } return &rr, nil } - -// I386PtraceFpRegs tracks user_fpregs_struct in /usr/include/x86_64-linux-gnu/sys/user.h -type I386PtraceFpRegs struct { - Cwd uint16 - Swd uint16 - Ftw uint16 - Fop uint16 - Rip uint64 - Rdp uint64 - Mxcsr uint32 - MxcrMask uint32 - StSpace [32]uint32 - XmmSpace [256]byte - Padding [24]uint32 -} - -// I386Xstate represents amd64 XSAVE area. See Section 13.1 (and -// following) of Intel® 64 and IA-32 Architectures Software Developer’s -// Manual, Volume 1: Basic Architecture. -type I386Xstate struct { - I386PtraceFpRegs - Xsave []byte // raw xsave area - AvxState bool // contains AVX state - YmmSpace [256]byte -} - -// Decode decodes an XSAVE area to a list of name/value pairs of registers. -func (xsave *I386Xstate) Decode() (regs []proc.Register) { - // x87 registers - regs = proc.AppendUint64Register(regs, "CW", uint64(xsave.Cwd)) - regs = proc.AppendUint64Register(regs, "SW", uint64(xsave.Swd)) - regs = proc.AppendUint64Register(regs, "TW", uint64(xsave.Ftw)) - regs = proc.AppendUint64Register(regs, "FOP", uint64(xsave.Fop)) - regs = proc.AppendUint64Register(regs, "FIP", uint64(xsave.Rip)) - regs = proc.AppendUint64Register(regs, "FDP", uint64(xsave.Rdp)) - - for i := 0; i < len(xsave.StSpace); i += 4 { - var buf bytes.Buffer - binary.Write(&buf, binary.LittleEndian, uint64(xsave.StSpace[i+1])<<32|uint64(xsave.StSpace[i])) - binary.Write(&buf, binary.LittleEndian, uint16(xsave.StSpace[i+2])) - regs = proc.AppendBytesRegister(regs, fmt.Sprintf("ST(%d)", i/4), buf.Bytes()) - } - - // SSE registers - regs = proc.AppendUint64Register(regs, "MXCSR", uint64(xsave.Mxcsr)) - regs = proc.AppendUint64Register(regs, "MXCSR_MASK", uint64(xsave.MxcrMask)) - - for i := 0; i < len(xsave.XmmSpace); i += 16 { - regs = proc.AppendBytesRegister(regs, fmt.Sprintf("XMM%d", i/16), xsave.XmmSpace[i:i+16]) - if xsave.AvxState { - regs = proc.AppendBytesRegister(regs, fmt.Sprintf("YMM%d", i/16), xsave.YmmSpace[i:i+16]) - } - } - - return -} - -// LinuxX86XstateRead reads a byte array containing an XSAVE area into regset. -// If readLegacy is true regset.PtraceFpRegs will be filled with the -// contents of the legacy region of the XSAVE area. -// See Section 13.1 (and following) of Intel® 64 and IA-32 Architectures -// Software Developer’s Manual, Volume 1: Basic Architecture. -func I386XstateRead(xstateargs []byte, readLegacy bool, regset *I386Xstate) error { - if _XSAVE_HEADER_START+_XSAVE_HEADER_LEN >= len(xstateargs) { - return nil - } - if readLegacy { - rdr := bytes.NewReader(xstateargs[:_XSAVE_HEADER_START]) - if err := binary.Read(rdr, binary.LittleEndian, ®set.I386PtraceFpRegs); err != nil { - return err - } - } - xsaveheader := xstateargs[_XSAVE_HEADER_START : _XSAVE_HEADER_START+_XSAVE_HEADER_LEN] - xstate_bv := binary.LittleEndian.Uint64(xsaveheader[0:8]) - xcomp_bv := binary.LittleEndian.Uint64(xsaveheader[8:16]) - - if xcomp_bv&(1<<63) != 0 { - // compact format not supported - return nil - } - - if xstate_bv&(1<<2) == 0 { - // AVX state not present - return nil - } - - avxstate := xstateargs[_XSAVE_EXTENDED_REGION_START:] - regset.AvxState = true - copy(regset.YmmSpace[:], avxstate[:len(regset.YmmSpace)]) - - return nil -} diff --git a/pkg/proc/linutil/regs_test.go b/pkg/proc/linutil/regs_test.go deleted file mode 100644 index a9ed0fbf17..0000000000 --- a/pkg/proc/linutil/regs_test.go +++ /dev/null @@ -1,60 +0,0 @@ -package linutil - -import ( - "testing" - - "golang.org/x/arch/x86/x86asm" -) - -func TestAMD64Get(t *testing.T) { - val := uint64(0xffffffffdeadbeef) - regs := AMD64Registers{ - Regs: &AMD64PtraceRegs{ - Rax: val, - }, - } - // Test AL, low 8 bits of RAX - al, err := regs.Get(int(x86asm.AL)) - if err != nil { - t.Fatal(err) - } - if al != 0xef { - t.Fatalf("expected %#v, got %#v\n", 0xef, al) - } - - // Test AH, high 8 bits of RAX - ah, err := regs.Get(int(x86asm.AH)) - if err != nil { - t.Fatal(err) - } - if ah != 0xBE { - t.Fatalf("expected %#v, got %#v\n", 0xbe, ah) - } - - // Test AX, lower 16 bits of RAX - ax, err := regs.Get(int(x86asm.AX)) - if err != nil { - t.Fatal(err) - } - if ax != 0xBEEF { - t.Fatalf("expected %#v, got %#v\n", 0xbeef, ax) - } - - // Test EAX, lower 32 bits of RAX - eax, err := regs.Get(int(x86asm.EAX)) - if err != nil { - t.Fatal(err) - } - if eax != 0xDEADBEEF { - t.Fatalf("expected %#v, got %#v\n", uint64(0xdeadbeef), eax) - } - - // Test RAX, full 64 bits of register - rax, err := regs.Get(int(x86asm.RAX)) - if err != nil { - t.Fatal(err) - } - if rax != val { - t.Fatalf("expected %#v, got %#v\n", val, rax) - } -} diff --git a/pkg/proc/macutil/rosetta_darwin.go b/pkg/proc/macutil/rosetta_darwin.go new file mode 100644 index 0000000000..85e624eb6c --- /dev/null +++ b/pkg/proc/macutil/rosetta_darwin.go @@ -0,0 +1,19 @@ +package macutil + +import ( + "errors" + "syscall" +) + +// CheckRosetta returns an error if the calling process is being translated +// by Apple Rosetta. +func CheckRosetta() error { + pt, err := syscall.Sysctl("sysctl.proc_translated") + if err != nil { + return nil + } + if len(pt) > 0 && pt[0] == 1 { + return errors.New("can not run under Rosetta, check that the installed build of Go is right for your CPU architecture") + } + return nil +} diff --git a/pkg/proc/macutil/rosetta_other.go b/pkg/proc/macutil/rosetta_other.go new file mode 100644 index 0000000000..1dae72fdaa --- /dev/null +++ b/pkg/proc/macutil/rosetta_other.go @@ -0,0 +1,10 @@ +//go:build !darwin +// +build !darwin + +package macutil + +// CheckRosetta returns an error if the calling process is being translated +// by Apple Rosetta. +func CheckRosetta() error { + return nil +} diff --git a/pkg/proc/mem.go b/pkg/proc/mem.go index d7891f48bb..cb2a35f67b 100644 --- a/pkg/proc/mem.go +++ b/pkg/proc/mem.go @@ -1,6 +1,7 @@ package proc import ( + "encoding/binary" "errors" "fmt" @@ -9,13 +10,13 @@ import ( const cacheEnabled = true -// MemoryReader is like io.ReaderAt, but the offset is a uintptr so that it +// MemoryReader is like io.ReaderAt, but the offset is a uint64 so that it // can address all of 64-bit memory. // Redundant with memoryReadWriter but more easily suited to working with // the standard io package. type MemoryReader interface { // ReadMemory is just like io.ReaderAt.ReadAt. - ReadMemory(buf []byte, addr uintptr) (n int, err error) + ReadMemory(buf []byte, addr uint64) (n int, err error) } // MemoryReadWriter is an interface for reading or writing to @@ -23,21 +24,21 @@ type MemoryReader interface { // target memory or possibly a cache. type MemoryReadWriter interface { MemoryReader - WriteMemory(addr uintptr, data []byte) (written int, err error) + WriteMemory(addr uint64, data []byte) (written int, err error) } type memCache struct { loaded bool - cacheAddr uintptr + cacheAddr uint64 cache []byte mem MemoryReadWriter } -func (m *memCache) contains(addr uintptr, size int) bool { - return addr >= m.cacheAddr && addr <= (m.cacheAddr+uintptr(len(m.cache)-size)) +func (m *memCache) contains(addr uint64, size int) bool { + return addr >= m.cacheAddr && addr <= (m.cacheAddr+uint64(len(m.cache)-size)) } -func (m *memCache) ReadMemory(data []byte, addr uintptr) (n int, err error) { +func (m *memCache) ReadMemory(data []byte, addr uint64) (n int, err error) { if m.contains(addr, len(data)) { if !m.loaded { _, err := m.mem.ReadMemory(m.cache, m.cacheAddr) @@ -53,11 +54,15 @@ func (m *memCache) ReadMemory(data []byte, addr uintptr) (n int, err error) { return m.mem.ReadMemory(data, addr) } -func (m *memCache) WriteMemory(addr uintptr, data []byte) (written int, err error) { +func (m *memCache) WriteMemory(addr uint64, data []byte) (written int, err error) { return m.mem.WriteMemory(addr, data) } -func cacheMemory(mem MemoryReadWriter, addr uintptr, size int) MemoryReadWriter { +func CreateLoadedCachedMemory(data []byte) MemoryReadWriter { + return &memCache{loaded: true, cacheAddr: fakeAddressUnresolv, cache: data, mem: nil} +} + +func cacheMemory(mem MemoryReadWriter, addr uint64, size int) MemoryReadWriter { if !cacheEnabled { return mem } @@ -75,11 +80,6 @@ func cacheMemory(mem MemoryReadWriter, addr uintptr, size int) MemoryReadWriter return &memCache{false, addr, make([]byte, size), mem} } -// fakeAddress used by extractVarInfoFromEntry for variables that do not -// have a memory address, we can't use 0 because a lot of code (likely -// including client code) assumes that addr == 0 is nil -const fakeAddress = 0xbeef0000 - // compositeMemory represents a chunk of memory that is stored in CPU // registers or non-contiguously. // @@ -88,49 +88,120 @@ const fakeAddress = 0xbeef0000 // with some fields stored into CPU registers and other fields stored in // memory. type compositeMemory struct { + base uint64 // base address for this composite memory realmem MemoryReadWriter + arch *Arch regs op.DwarfRegisters pieces []op.Piece data []byte } -func newCompositeMemory(mem MemoryReadWriter, regs op.DwarfRegisters, pieces []op.Piece) (*compositeMemory, error) { - cmem := &compositeMemory{realmem: mem, regs: regs, pieces: pieces, data: []byte{}} - for _, piece := range pieces { - if piece.IsRegister { - reg := regs.Bytes(piece.RegNum) - sz := piece.Size - if sz == 0 && len(pieces) == 1 { - sz = len(reg) +// CreateCompositeMemory created a new composite memory type using the provided MemoryReadWriter as the +// underlying memory buffer. +func CreateCompositeMemory(mem MemoryReadWriter, arch *Arch, regs op.DwarfRegisters, pieces []op.Piece) (*compositeMemory, error) { + // This is basically a small wrapper to avoid having to change all callers + // of newCompositeMemory since it existed first. + cm, err := newCompositeMemory(mem, arch, regs, pieces) + if cm != nil { + cm.base = fakeAddressUnresolv + } + return cm, err +} + +func newCompositeMemory(mem MemoryReadWriter, arch *Arch, regs op.DwarfRegisters, pieces []op.Piece) (*compositeMemory, error) { + cmem := &compositeMemory{realmem: mem, arch: arch, regs: regs, pieces: pieces, data: []byte{}} + for i := range pieces { + piece := &pieces[i] + switch piece.Kind { + case op.RegPiece: + reg := regs.Bytes(piece.Val) + if piece.Size == 0 && i == len(pieces)-1 { + piece.Size = len(reg) } - if sz > len(reg) { + if piece.Size > len(reg) { if regs.FloatLoadError != nil { - return nil, fmt.Errorf("could not read %d bytes from register %d (size: %d), also error loading floating point registers: %v", sz, piece.RegNum, len(reg), regs.FloatLoadError) + return nil, fmt.Errorf("could not read %d bytes from register %d (size: %d), also error loading floating point registers: %v", piece.Size, piece.Val, len(reg), regs.FloatLoadError) } - return nil, fmt.Errorf("could not read %d bytes from register %d (size: %d)", sz, piece.RegNum, len(reg)) + return nil, fmt.Errorf("could not read %d bytes from register %d (size: %d)", piece.Size, piece.Val, len(reg)) } - cmem.data = append(cmem.data, reg[:sz]...) - } else { + cmem.data = append(cmem.data, reg[:piece.Size]...) + case op.AddrPiece: buf := make([]byte, piece.Size) - mem.ReadMemory(buf, uintptr(piece.Addr)) + mem.ReadMemory(buf, uint64(piece.Val)) cmem.data = append(cmem.data, buf...) + case op.ImmPiece: + buf := piece.Bytes + if buf == nil { + sz := 8 + if piece.Size > sz { + sz = piece.Size + } + if piece.Size == 0 && i == len(pieces)-1 { + piece.Size = arch.PtrSize() // DWARF doesn't say what this should be + } + buf = make([]byte, sz) + binary.LittleEndian.PutUint64(buf, piece.Val) + } + cmem.data = append(cmem.data, buf[:piece.Size]...) + default: + panic("unsupported piece kind") } } return cmem, nil } -func (mem *compositeMemory) ReadMemory(data []byte, addr uintptr) (int, error) { - addr -= fakeAddress - if addr >= uintptr(len(mem.data)) || addr+uintptr(len(data)) > uintptr(len(mem.data)) { +func (mem *compositeMemory) ReadMemory(data []byte, addr uint64) (int, error) { + addr -= mem.base + if addr >= uint64(len(mem.data)) || addr+uint64(len(data)) > uint64(len(mem.data)) { return 0, errors.New("read out of bounds") } - copy(data, mem.data[addr:addr+uintptr(len(data))]) + copy(data, mem.data[addr:addr+uint64(len(data))]) return len(data), nil } -func (mem *compositeMemory) WriteMemory(addr uintptr, data []byte) (int, error) { - //TODO(aarzilli): implement - return 0, errors.New("can't write composite memory") +func (mem *compositeMemory) WriteMemory(addr uint64, data []byte) (int, error) { + addr -= mem.base + if addr >= uint64(len(mem.data)) || addr+uint64(len(data)) > uint64(len(mem.data)) { + return 0, errors.New("write out of bounds") + } + if mem.regs.ChangeFunc == nil { + return 0, errors.New("can not write registers") + } + + copy(mem.data[addr:], data) + + curAddr := uint64(0) + donesz := 0 + for _, piece := range mem.pieces { + if curAddr < (addr+uint64(len(data))) && addr < (curAddr+uint64(piece.Size)) { + // changed memory interval overlaps current piece + pieceMem := mem.data[curAddr : curAddr+uint64(piece.Size)] + + switch piece.Kind { + case op.RegPiece: + oldReg := mem.regs.Reg(piece.Val) + newReg := op.DwarfRegisterFromBytes(pieceMem) + err := mem.regs.ChangeFunc(piece.Val, oldReg.Overwrite(newReg)) + if err != nil { + return donesz, err + } + case op.AddrPiece: + n, err := mem.realmem.WriteMemory(uint64(piece.Val), pieceMem) + if err != nil { + return donesz + n, err + } + case op.ImmPiece: + //TODO(aarzilli): maybe return an error if the user tried to change the value? + // nothing to do + default: + panic("unsupported piece kind") + } + donesz += piece.Size + } + curAddr += uint64(piece.Size) + } + + return len(data), nil } // DereferenceMemory returns a MemoryReadWriter that can read and write the diff --git a/pkg/proc/moduledata.go b/pkg/proc/moduledata.go index 90f6e1131b..65c02ed86f 100644 --- a/pkg/proc/moduledata.go +++ b/pkg/proc/moduledata.go @@ -7,13 +7,17 @@ import ( // delve counterpart to runtime.moduledata type moduleData struct { - text, etext uintptr - types, etypes uintptr + text, etext uint64 + types, etypes uint64 typemapVar *Variable } func loadModuleData(bi *BinaryInfo, mem MemoryReadWriter) ([]moduleData, error) { - scope := globalScope(bi, bi.Images[0], mem) + // +rtype -var firstmoduledata moduledata + // +rtype -field moduledata.text uintptr + // +rtype -field moduledata.types uintptr + + scope := globalScope(nil, bi, bi.Images[0], mem) var md *Variable md, err := scope.findGlobal("runtime", "firstmoduledata") if err != nil { @@ -44,11 +48,11 @@ func loadModuleData(bi *BinaryInfo, mem MemoryReadWriter) ([]moduleData, error) var err error - touint := func(name string) (ret uintptr) { + touint := func(name string) (ret uint64) { if err == nil { var n uint64 n, err = vars[name].asUint() - ret = uintptr(n) + ret = n } return ret } @@ -71,7 +75,7 @@ func loadModuleData(bi *BinaryInfo, mem MemoryReadWriter) ([]moduleData, error) return r, nil } -func findModuleDataForType(bi *BinaryInfo, mds []moduleData, typeAddr uintptr, mem MemoryReadWriter) *moduleData { +func findModuleDataForType(bi *BinaryInfo, mds []moduleData, typeAddr uint64, mem MemoryReadWriter) *moduleData { for i := range mds { if typeAddr >= mds[i].types && typeAddr < mds[i].etypes { return &mds[i] @@ -80,7 +84,7 @@ func findModuleDataForType(bi *BinaryInfo, mds []moduleData, typeAddr uintptr, m return nil } -func resolveTypeOff(bi *BinaryInfo, mds []moduleData, typeAddr uintptr, off uintptr, mem MemoryReadWriter) (*Variable, error) { +func resolveTypeOff(bi *BinaryInfo, mds []moduleData, typeAddr, off uint64, mem MemoryReadWriter) (*Variable, error) { // See runtime.(*_type).typeOff in $GOROOT/src/runtime/type.go md := findModuleDataForType(bi, mds, typeAddr, mem) @@ -96,19 +100,19 @@ func resolveTypeOff(bi *BinaryInfo, mds []moduleData, typeAddr uintptr, off uint } v.loadValue(LoadConfig{false, 1, 0, 0, -1, 0}) addr, _ := constant.Int64Val(v.Value) - return v.newVariable(v.Name, uintptr(addr), rtyp, mem), nil + return v.newVariable(v.Name, uint64(addr), rtyp, mem), nil } if t, _ := md.typemapVar.mapAccess(newConstant(constant.MakeUint64(uint64(off)), mem)); t != nil { return t, nil } - res := md.types + uintptr(off) + res := md.types + off - return newVariable("", res, rtyp, bi, mem), nil + return newVariable("", uint64(res), rtyp, bi, mem), nil } -func resolveNameOff(bi *BinaryInfo, mds []moduleData, typeAddr uintptr, off uintptr, mem MemoryReadWriter) (name, tag string, pkgpathoff int32, err error) { +func resolveNameOff(bi *BinaryInfo, mds []moduleData, typeAddr, off uint64, mem MemoryReadWriter) (name, tag string, pkgpathoff int32, err error) { // See runtime.resolveNameOff in $GOROOT/src/runtime/type.go for _, md := range mds { if typeAddr >= md.types && typeAddr < md.etypes { @@ -129,8 +133,8 @@ func resolveNameOff(bi *BinaryInfo, mds []moduleData, typeAddr uintptr, off uint return loadName(bi, resv.Addr, mem) } -func reflectOffsMapAccess(bi *BinaryInfo, off uintptr, mem MemoryReadWriter) (*Variable, error) { - scope := globalScope(bi, bi.Images[0], mem) +func reflectOffsMapAccess(bi *BinaryInfo, off uint64, mem MemoryReadWriter) (*Variable, error) { + scope := globalScope(nil, bi, bi.Images[0], mem) reflectOffs, err := scope.findGlobal("runtime", "reflectOffs") if err != nil { return nil, err @@ -151,7 +155,7 @@ const ( nameflagHasPkg = 1 << 2 ) -func loadName(bi *BinaryInfo, addr uintptr, mem MemoryReadWriter) (name, tag string, pkgpathoff int32, err error) { +func loadName(bi *BinaryInfo, addr uint64, mem MemoryReadWriter) (name, tag string, pkgpathoff int32, err error) { off := addr namedata := make([]byte, 3) _, err = mem.ReadMemory(namedata, off) @@ -164,7 +168,7 @@ func loadName(bi *BinaryInfo, addr uintptr, mem MemoryReadWriter) (name, tag str rawstr := make([]byte, int(namelen)) _, err = mem.ReadMemory(rawstr, off) - off += uintptr(namelen) + off += uint64(namelen) if err != nil { return "", "", 0, err } @@ -182,7 +186,7 @@ func loadName(bi *BinaryInfo, addr uintptr, mem MemoryReadWriter) (name, tag str rawstr := make([]byte, int(taglen)) _, err = mem.ReadMemory(rawstr, off) - off += uintptr(taglen) + off += uint64(taglen) if err != nil { return "", "", 0, err } diff --git a/pkg/proc/native/dump_linux.go b/pkg/proc/native/dump_linux.go new file mode 100644 index 0000000000..bbf57acbfa --- /dev/null +++ b/pkg/proc/native/dump_linux.go @@ -0,0 +1,123 @@ +package native + +import ( + "fmt" + "io/ioutil" + "strconv" + "strings" + + "github.com/go-delve/delve/pkg/proc" +) + +func (p *nativeProcess) MemoryMap() ([]proc.MemoryMapEntry, error) { + const VmFlagsPrefix = "VmFlags:" + + smapsbuf, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/smaps", p.pid)) + if err != nil { + // Older versions of Linux don't have smaps but have maps which is in a similar format. + smapsbuf, err = ioutil.ReadFile(fmt.Sprintf("/proc/%d/maps", p.pid)) + if err != nil { + return nil, err + } + } + smapsLines := strings.Split(string(smapsbuf), "\n") + r := make([]proc.MemoryMapEntry, 0) + +smapsLinesLoop: + for i := 0; i < len(smapsLines); { + line := smapsLines[i] + if line == "" { + i++ + continue + } + start, end, perm, offset, dev, filename, err := parseSmapsHeaderLine(i+1, line) + if err != nil { + return nil, err + } + var vmflags []string + for i++; i < len(smapsLines); i++ { + line := smapsLines[i] + if line == "" || line[0] < 'A' || line[0] > 'Z' { + break + } + if strings.HasPrefix(line, VmFlagsPrefix) { + vmflags = strings.Split(strings.TrimSpace(line[len(VmFlagsPrefix):]), " ") + } + } + + for i := range vmflags { + switch vmflags[i] { + case "pf": + // pure PFN range, see https://github.com/go-delve/delve/issues/2630 + continue smapsLinesLoop + case "dd": + // "don't dump" + continue smapsLinesLoop + case "io": + continue smapsLinesLoop + } + } + if strings.HasPrefix(dev, "00:") { + filename = "" + offset = 0 + } + + r = append(r, proc.MemoryMapEntry{ + Addr: start, + Size: end - start, + + Read: perm[0] == 'r', + Write: perm[1] == 'w', + Exec: perm[2] == 'x', + + Filename: filename, + Offset: offset, + }) + + } + return r, nil +} + +func parseSmapsHeaderLine(lineno int, in string) (start, end uint64, perm string, offset uint64, dev, filename string, err error) { + fields := strings.SplitN(in, " ", 6) + if len(fields) != 6 { + err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (wrong number of fields)", lineno, in) + return + } + + v := strings.Split(fields[0], "-") + if len(v) != 2 { + err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (bad first field)", lineno, in) + return + } + start, err = strconv.ParseUint(v[0], 16, 64) + if err != nil { + err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (%v)", lineno, in, err) + return + } + end, err = strconv.ParseUint(v[1], 16, 64) + if err != nil { + err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (%v)", lineno, in, err) + return + } + + perm = fields[1] + if len(perm) < 4 { + err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (permissions column too short)", lineno, in) + return + } + + offset, err = strconv.ParseUint(fields[2], 16, 64) + if err != nil { + err = fmt.Errorf("malformed /proc/pid/maps on line %d: %q (%v)", lineno, in, err) + return + } + + dev = fields[3] + + // fields[4] -> inode + + filename = strings.TrimLeft(fields[5], " ") + return + +} diff --git a/pkg/proc/native/dump_linux_amd64.go b/pkg/proc/native/dump_linux_amd64.go new file mode 100644 index 0000000000..0e36b3b48d --- /dev/null +++ b/pkg/proc/native/dump_linux_amd64.go @@ -0,0 +1,152 @@ +package native + +import ( + "bytes" + "debug/elf" + "encoding/binary" + "fmt" + "io/ioutil" + "path/filepath" + + "github.com/go-delve/delve/pkg/elfwriter" + "github.com/go-delve/delve/pkg/proc/linutil" + "golang.org/x/sys/unix" +) + +const _NT_AUXV elf.NType = 0x6 + +type linuxPrPsInfo struct { + State uint8 + Sname int8 + Zomb uint8 + Nice int8 + _ [4]uint8 + Flag uint64 + Uid, Gid uint32 + Pid, Ppid, Pgrp, Sid int32 + Fname [16]uint8 + Args [80]uint8 +} + +func (p *nativeProcess) DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (threadsDone bool, out []elfwriter.Note, err error) { + tobytes := func(x interface{}) []byte { + out := new(bytes.Buffer) + _ = binary.Write(out, binary.LittleEndian, x) + return out.Bytes() + } + + prpsinfo := linuxPrPsInfo{ + Pid: int32(p.pid), + } + + fname := p.os.comm + if len(fname) > len(prpsinfo.Fname)-1 { + fname = fname[:len(prpsinfo.Fname)-1] + } + copy(prpsinfo.Fname[:], fname) + prpsinfo.Fname[len(fname)] = 0 + + if cmdline, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/cmdline", p.pid)); err == nil { + for len(cmdline) > 0 && cmdline[len(cmdline)-1] == '\n' { + cmdline = cmdline[:len(cmdline)-1] + } + if zero := bytes.Index(cmdline, []byte{0}); zero >= 0 { + cmdline = cmdline[zero+1:] + } + path := p.BinInfo().Images[0].Path + if abs, err := filepath.Abs(path); err == nil { + path = abs + } + args := make([]byte, 0, len(path)+len(cmdline)+1) + args = append(args, []byte(path)...) + args = append(args, 0) + args = append(args, cmdline...) + if len(args) > len(prpsinfo.Args)-1 { + args = args[:len(prpsinfo.Args)-1] + } + copy(prpsinfo.Args[:], args) + prpsinfo.Args[len(args)] = 0 + } + notes = append(notes, elfwriter.Note{ + Type: elf.NT_PRPSINFO, + Data: tobytes(prpsinfo), + }) + + auxvbuf, err := ioutil.ReadFile(fmt.Sprintf("/proc/%d/auxv", p.pid)) + if err == nil { + notes = append(notes, elfwriter.Note{ + Type: _NT_AUXV, + Data: auxvbuf, + }) + } + + for _, th := range p.threads { + regs, err := th.Registers() + if err != nil { + return false, notes, err + } + + regs, err = regs.Copy() // triggers floating point register load + if err != nil { + return false, notes, err + } + + nregs := regs.(*linutil.AMD64Registers) + + var prstatus linuxPrStatusAMD64 + prstatus.Pid = int32(th.ID) + prstatus.Ppid = int32(p.pid) + prstatus.Pgrp = int32(p.pid) + prstatus.Sid = int32(p.pid) + prstatus.Reg = *(nregs.Regs) + notes = append(notes, elfwriter.Note{ + Type: elf.NT_PRSTATUS, + Data: tobytes(prstatus), + }) + + var xsave []byte + + if nregs.Fpregset != nil && nregs.Fpregset.Xsave != nil { + xsave = make([]byte, len(nregs.Fpregset.Xsave)) + copy(xsave, nregs.Fpregset.Xsave) + } else { + xsave = make([]byte, 512+64) // XSAVE header start + XSAVE header length + } + + // Even if we have the XSAVE area on some versions of linux (or some CPU + // models?) it won't contain the legacy x87 registers, so copy them over + // in case we got them from PTRACE_GETFPREGS. + buf := new(bytes.Buffer) + binary.Write(buf, binary.LittleEndian, &nregs.Fpregset.AMD64PtraceFpRegs) + copy(xsave, buf.Bytes()) + + notes = append(notes, elfwriter.Note{ + Type: _NT_X86_XSTATE, + Data: xsave, + }) + + threadDone() + } + + return true, notes, nil +} + +type linuxPrStatusAMD64 struct { + Siginfo linuxSiginfo + Cursig uint16 + _ [2]uint8 + Sigpend uint64 + Sighold uint64 + Pid, Ppid, Pgrp, Sid int32 + Utime, Stime, CUtime, CStime unix.Timeval + Reg linutil.AMD64PtraceRegs + Fpvalid int64 +} + +// LinuxSiginfo is a copy of the +// siginfo kernel struct. +type linuxSiginfo struct { + Signo int32 + Code int32 + Errno int32 +} diff --git a/pkg/proc/native/dump_linux_other.go b/pkg/proc/native/dump_linux_other.go new file mode 100644 index 0000000000..d74491af8f --- /dev/null +++ b/pkg/proc/native/dump_linux_other.go @@ -0,0 +1,12 @@ +//go:build linux && !amd64 +// +build linux,!amd64 + +package native + +import ( + "github.com/go-delve/delve/pkg/elfwriter" +) + +func (p *nativeProcess) DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (threadsDone bool, out []elfwriter.Note, err error) { + return false, notes, nil +} diff --git a/pkg/proc/native/dump_other.go b/pkg/proc/native/dump_other.go new file mode 100644 index 0000000000..0c4ce14a07 --- /dev/null +++ b/pkg/proc/native/dump_other.go @@ -0,0 +1,17 @@ +//go:build (freebsd && amd64) || darwin +// +build freebsd,amd64 darwin + +package native + +import ( + "github.com/go-delve/delve/pkg/elfwriter" + "github.com/go-delve/delve/pkg/proc" +) + +func (p *nativeProcess) MemoryMap() ([]proc.MemoryMapEntry, error) { + return nil, proc.ErrMemoryMapNotSupported +} + +func (p *nativeProcess) DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (threadsDone bool, notesout []elfwriter.Note, err error) { + return false, notes, nil +} diff --git a/pkg/proc/native/dump_windows_amd64.go b/pkg/proc/native/dump_windows_amd64.go new file mode 100644 index 0000000000..084de02fee --- /dev/null +++ b/pkg/proc/native/dump_windows_amd64.go @@ -0,0 +1,91 @@ +package native + +import ( + "errors" + "fmt" + "unsafe" + + "github.com/go-delve/delve/pkg/elfwriter" + "github.com/go-delve/delve/pkg/proc" +) + +func (p *nativeProcess) MemoryMap() ([]proc.MemoryMapEntry, error) { + var memoryMapError error + r := []proc.MemoryMapEntry{} + + p.execPtraceFunc(func() { + is64 := true + if isWow64 := uint32(0); _IsWow64Process(p.os.hProcess, &isWow64) != 0 { + if isWow64 != 0 { + is64 = false + } + } + + maxaddr := uint64(1 << 48) // windows64 uses only 48 bit addresses + if !is64 { + maxaddr = uint64(^uint32(0)) + } + + var meminfo _MEMORY_BASIC_INFORMATION + + for addr := uint64(0); addr < maxaddr; addr += meminfo.RegionSize { + size := _VirtualQueryEx(p.os.hProcess, uintptr(addr), &meminfo, unsafe.Sizeof(meminfo)) + if size == 0 { + // size == 0 is an error and the only error returned by VirtualQueryEx + // is when addr is above the highest address allocated for the + // application. + return + } + if size != unsafe.Sizeof(meminfo) { + memoryMapError = fmt.Errorf("bad size returned by _VirtualQueryEx: %d (expected %d)", size, unsafe.Sizeof(meminfo)) + return + } + if addr+meminfo.RegionSize <= addr { + // this shouldn't happen + memoryMapError = errors.New("VirtualQueryEx wrapped around the address space or stuck") + return + } + if meminfo.State == _MEM_FREE || meminfo.State == _MEM_RESERVE { + continue + } + if meminfo.Protect&_PAGE_GUARD != 0 { + // reading from this range will result in an error. + continue + } + + var mme proc.MemoryMapEntry + mme.Addr = addr + mme.Size = meminfo.RegionSize + + switch meminfo.Protect & 0xff { + case _PAGE_EXECUTE: + mme.Exec = true + case _PAGE_EXECUTE_READ: + mme.Exec = true + mme.Read = true + case _PAGE_EXECUTE_READWRITE: + mme.Exec = true + mme.Read = true + mme.Write = true + case _PAGE_EXECUTE_WRITECOPY: + mme.Exec = true + mme.Read = true + case _PAGE_NOACCESS: + case _PAGE_READONLY: + mme.Read = true + case _PAGE_READWRITE: + mme.Read = true + mme.Write = true + case _PAGE_WRITECOPY: + mme.Read = true + } + r = append(r, mme) + } + }) + + return r, memoryMapError +} + +func (p *nativeProcess) DumpProcessNotes(notes []elfwriter.Note, threadDone func()) (threadsDone bool, out []elfwriter.Note, err error) { + return false, notes, nil +} diff --git a/pkg/proc/native/hwbreak_amd64.go b/pkg/proc/native/hwbreak_amd64.go new file mode 100644 index 0000000000..e15652a362 --- /dev/null +++ b/pkg/proc/native/hwbreak_amd64.go @@ -0,0 +1,39 @@ +package native + +import ( + "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" +) + +func (t *nativeThread) writeHardwareBreakpoint(addr uint64, wtype proc.WatchType, idx uint8) error { + return t.withDebugRegisters(func(drs *amd64util.DebugRegisters) error { + return drs.SetBreakpoint(idx, addr, wtype.Read(), wtype.Write(), wtype.Size()) + }) +} + +func (t *nativeThread) clearHardwareBreakpoint(addr uint64, wtype proc.WatchType, idx uint8) error { + return t.withDebugRegisters(func(drs *amd64util.DebugRegisters) error { + drs.ClearBreakpoint(idx) + return nil + }) +} + +func (t *nativeThread) findHardwareBreakpoint() (*proc.Breakpoint, error) { + var retbp *proc.Breakpoint + err := t.withDebugRegisters(func(drs *amd64util.DebugRegisters) error { + ok, idx := drs.GetActiveBreakpoint() + if ok { + for _, bp := range t.dbp.Breakpoints().M { + if bp.WatchType != 0 && bp.HWBreakIndex == idx { + retbp = bp + break + } + } + } + return nil + }) + if err != nil { + return nil, err + } + return retbp, nil +} diff --git a/pkg/proc/native/hwbreak_other.go b/pkg/proc/native/hwbreak_other.go new file mode 100644 index 0000000000..548f3336dd --- /dev/null +++ b/pkg/proc/native/hwbreak_other.go @@ -0,0 +1,22 @@ +//go:build (linux && 386) || (darwin && arm64) +// +build linux,386 darwin,arm64 + +package native + +import ( + "errors" + + "github.com/go-delve/delve/pkg/proc" +) + +func (t *nativeThread) findHardwareBreakpoint() (*proc.Breakpoint, error) { + return nil, errors.New("hardware breakpoints not supported") +} + +func (t *nativeThread) writeHardwareBreakpoint(addr uint64, wtype proc.WatchType, idx uint8) error { + return errors.New("hardware breakpoints not supported") +} + +func (t *nativeThread) clearHardwareBreakpoint(addr uint64, wtype proc.WatchType, idx uint8) error { + return errors.New("hardware breakpoints not supported") +} diff --git a/pkg/proc/native/nonative_darwin.go b/pkg/proc/native/nonative_darwin.go index 30ccb8fa0a..0ef1e43a1e 100644 --- a/pkg/proc/native/nonative_darwin.go +++ b/pkg/proc/native/nonative_darwin.go @@ -1,4 +1,5 @@ -//+build darwin,!macnative +//go:build darwin && !macnative +// +build darwin,!macnative package native @@ -6,13 +7,16 @@ import ( "errors" "sync" + "github.com/go-delve/delve/pkg/dwarf/op" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" ) var ErrNativeBackendDisabled = errors.New("native backend disabled during compilation") // Launch returns ErrNativeBackendDisabled. -func Launch(_ []string, _ string, _ bool, _ []string, _ string, _ [3]string) (*proc.Target, error) { +func Launch(_ []string, _ string, _ proc.LaunchFlags, _ []string, _ string, _ [3]string) (*proc.Target, error) { return nil, ErrNativeBackendDisabled } @@ -31,9 +35,7 @@ type osSpecificDetails struct{} // osProcessDetails holds Darwin specific information. type osProcessDetails struct{} -func findExecutable(path string, pid int) string { - panic(ErrNativeBackendDisabled) -} +func (os *osProcessDetails) Close() {} func killProcess(pid int) error { panic(ErrNativeBackendDisabled) @@ -59,7 +61,7 @@ func (dbp *nativeProcess) trapWait(pid int) (*nativeThread, error) { panic(ErrNativeBackendDisabled) } -func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { +func (dbp *nativeProcess) stop(trapthread *nativeThread) (*nativeThread, error) { panic(ErrNativeBackendDisabled) } @@ -81,33 +83,35 @@ func (dbp *nativeProcess) EntryPoint() (uint64, error) { panic(ErrNativeBackendDisabled) } -// Blocked returns true if the thread is blocked -func (t *nativeThread) Blocked() bool { +func (dbp *nativeProcess) SupportsBPF() bool { panic(ErrNativeBackendDisabled) } -// SetPC sets the value of the PC register. -func (t *nativeThread) SetPC(pc uint64) error { +func (dbp *nativeProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error { panic(ErrNativeBackendDisabled) } -// SetSP sets the value of the SP register. -func (t *nativeThread) SetSP(sp uint64) error { +func (dbp *nativeProcess) GetBufferedTracepoints() []ebpf.RawUProbeParams { panic(ErrNativeBackendDisabled) } -// SetDX sets the value of the DX register. -func (t *nativeThread) SetDX(dx uint64) error { +// SetPC sets the value of the PC register. +func (t *nativeThread) setPC(pc uint64) error { + panic(ErrNativeBackendDisabled) +} + +// SetReg changes the value of the specified register. +func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) error { panic(ErrNativeBackendDisabled) } // ReadMemory reads len(buf) bytes at addr into buf. -func (t *nativeThread) ReadMemory(buf []byte, addr uintptr) (int, error) { +func (t *nativeThread) ReadMemory(buf []byte, addr uint64) (int, error) { panic(ErrNativeBackendDisabled) } // WriteMemory writes the contents of data at addr. -func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (int, error) { +func (t *nativeThread) WriteMemory(addr uint64, data []byte) (int, error) { panic(ErrNativeBackendDisabled) } @@ -123,6 +127,10 @@ func (t *nativeThread) restoreRegisters(sr proc.Registers) error { panic(ErrNativeBackendDisabled) } +func (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) error) error { + return proc.ErrHWBreakUnsupported +} + // Stopped returns whether the thread is stopped at // the operating system level. func (t *nativeThread) Stopped() bool { diff --git a/pkg/proc/native/proc.go b/pkg/proc/native/proc.go index 3a80b86e73..071cac7cd7 100644 --- a/pkg/proc/native/proc.go +++ b/pkg/proc/native/proc.go @@ -22,27 +22,30 @@ type nativeProcess struct { // List of threads mapped as such: pid -> *Thread threads map[int]*nativeThread - // Active thread - currentThread *nativeThread - - os *osProcessDetails - firstStart bool - stopMu sync.Mutex - resumeChan chan<- struct{} - ptraceChan chan func() - ptraceDoneChan chan interface{} - childProcess bool // this process was launched, not attached to + // Thread used to read and write memory + memthread *nativeThread + + os *osProcessDetails + firstStart bool + resumeChan chan<- struct{} + ptraceChan chan func() + ptraceDoneChan chan interface{} + childProcess bool // this process was launched, not attached to + stopMu sync.Mutex // protects manualStopRequested + // manualStopRequested is set if all the threads in the process were + // signalled to stop as a result of a Halt API call. Used to disambiguate + // why a thread is found to have stopped. manualStopRequested bool // Controlling terminal file descriptor for // this process. ctty *os.File + iscgo bool + exited, detached bool } -var _ proc.ProcessInternal = &nativeProcess{} - // newProcess returns an initialized Process struct. Before returning, // it will also launch a goroutine in order to handle ptrace(2) // functions. For more information, see the documentation on @@ -67,39 +70,8 @@ func (dbp *nativeProcess) BinInfo() *proc.BinaryInfo { return dbp.bi } -// Recorded always returns false for the native proc backend. -func (dbp *nativeProcess) Recorded() (bool, string) { return false, "" } - -// Restart will always return an error in the native proc backend, only for -// recorded traces. -func (dbp *nativeProcess) Restart(string) error { return proc.ErrNotRecorded } - -// ChangeDirection will always return an error in the native proc backend, only for -// recorded traces. -func (dbp *nativeProcess) ChangeDirection(dir proc.Direction) error { - if dir != proc.Forward { - return proc.ErrNotRecorded - } - return nil -} - -// GetDirection will always return Forward. -func (p *nativeProcess) GetDirection() proc.Direction { return proc.Forward } - -// When will always return an empty string and nil, not supported on native proc backend. -func (dbp *nativeProcess) When() (string, error) { return "", nil } - -// Checkpoint will always return an error on the native proc backend, -// only supported for recorded traces. -func (dbp *nativeProcess) Checkpoint(string) (int, error) { return -1, proc.ErrNotRecorded } - -// Checkpoints will always return an error on the native proc backend, -// only supported for recorded traces. -func (dbp *nativeProcess) Checkpoints() ([]proc.Checkpoint, error) { return nil, proc.ErrNotRecorded } - -// ClearCheckpoint will always return an error on the native proc backend, -// only supported in recorded traces. -func (dbp *nativeProcess) ClearCheckpoint(int) error { return proc.ErrNotRecorded } +// StartCallInjection notifies the backend that we are about to inject a function call. +func (dbp *nativeProcess) StartCallInjection() (func(), error) { return func() {}, nil } // Detach from the process being debugged, optionally killing it. func (dbp *nativeProcess) Detach(kill bool) (err error) { @@ -135,7 +107,7 @@ func (dbp *nativeProcess) Valid() (bool, error) { return false, proc.ErrProcessDetached } if dbp.exited { - return false, &proc.ErrProcessExited{Pid: dbp.Pid()} + return false, proc.ErrProcessExited{Pid: dbp.pid} } return true, nil } @@ -146,11 +118,6 @@ func (dbp *nativeProcess) ResumeNotify(ch chan<- struct{}) { dbp.resumeChan = ch } -// Pid returns the process ID. -func (dbp *nativeProcess) Pid() int { - return dbp.pid -} - // ThreadList returns a list of threads in the process. func (dbp *nativeProcess) ThreadList() []proc.Thread { r := make([]proc.Thread, 0, len(dbp.threads)) @@ -166,14 +133,9 @@ func (dbp *nativeProcess) FindThread(threadID int) (proc.Thread, bool) { return th, ok } -// CurrentThread returns the current selected, active thread. -func (dbp *nativeProcess) CurrentThread() proc.Thread { - return dbp.currentThread -} - -// SetCurrentThread is used internally by proc.Target to change the current thread. -func (p *nativeProcess) SetCurrentThread(th proc.Thread) { - p.currentThread = th.(*nativeThread) +// Memory returns the process memory. +func (dbp *nativeProcess) Memory() proc.MemoryReadWriter { + return dbp.memthread } // Breakpoints returns a list of breakpoints currently set. @@ -181,11 +143,11 @@ func (dbp *nativeProcess) Breakpoints() *proc.BreakpointMap { return &dbp.breakpoints } -// RequestManualStop sets the `halt` flag and +// RequestManualStop sets the `manualStopRequested` flag and // sends SIGSTOP to all threads. func (dbp *nativeProcess) RequestManualStop() error { if dbp.exited { - return &proc.ErrProcessExited{Pid: dbp.Pid()} + return proc.ErrProcessExited{Pid: dbp.pid} } dbp.stopMu.Lock() defer dbp.stopMu.Unlock() @@ -205,53 +167,74 @@ func (dbp *nativeProcess) CheckAndClearManualStopRequest() bool { return msr } -func (dbp *nativeProcess) WriteBreakpoint(addr uint64) (string, int, *proc.Function, []byte, error) { - f, l, fn := dbp.bi.PCToLine(uint64(addr)) +func (dbp *nativeProcess) WriteBreakpoint(bp *proc.Breakpoint) error { + if bp.WatchType != 0 { + for _, thread := range dbp.threads { + err := thread.writeHardwareBreakpoint(bp.Addr, bp.WatchType, bp.HWBreakIndex) + if err != nil { + return err + } + } + return nil + } - originalData := make([]byte, dbp.bi.Arch.BreakpointSize()) - _, err := dbp.currentThread.ReadMemory(originalData, uintptr(addr)) + bp.OriginalData = make([]byte, dbp.bi.Arch.BreakpointSize()) + _, err := dbp.memthread.ReadMemory(bp.OriginalData, bp.Addr) if err != nil { - return "", 0, nil, nil, err - } - if err := dbp.writeSoftwareBreakpoint(dbp.currentThread, addr); err != nil { - return "", 0, nil, nil, err + return err } - - return f, l, fn, originalData, nil + return dbp.writeSoftwareBreakpoint(dbp.memthread, bp.Addr) } func (dbp *nativeProcess) EraseBreakpoint(bp *proc.Breakpoint) error { - return dbp.currentThread.ClearBreakpoint(bp) + if bp.WatchType != 0 { + for _, thread := range dbp.threads { + err := thread.clearHardwareBreakpoint(bp.Addr, bp.WatchType, bp.HWBreakIndex) + if err != nil { + return err + } + } + return nil + } + + return dbp.memthread.clearSoftwareBreakpoint(bp) } // ContinueOnce will continue the target until it stops. // This could be the result of a breakpoint or signal. func (dbp *nativeProcess) ContinueOnce() (proc.Thread, proc.StopReason, error) { if dbp.exited { - return nil, proc.StopExited, &proc.ErrProcessExited{Pid: dbp.Pid()} + return nil, proc.StopExited, proc.ErrProcessExited{Pid: dbp.pid} } - if err := dbp.resume(); err != nil { - return nil, proc.StopUnknown, err - } + for { - for _, th := range dbp.threads { - th.CurrentBreakpoint.Clear() - } + if err := dbp.resume(); err != nil { + return nil, proc.StopUnknown, err + } - if dbp.resumeChan != nil { - close(dbp.resumeChan) - dbp.resumeChan = nil - } + for _, th := range dbp.threads { + th.CurrentBreakpoint.Clear() + } - trapthread, err := dbp.trapWait(-1) - if err != nil { - return nil, proc.StopUnknown, err - } - if err := dbp.stop(trapthread); err != nil { - return nil, proc.StopUnknown, err + if dbp.resumeChan != nil { + close(dbp.resumeChan) + dbp.resumeChan = nil + } + + trapthread, err := dbp.trapWait(-1) + if err != nil { + return nil, proc.StopUnknown, err + } + trapthread, err = dbp.stop(trapthread) + if err != nil { + return nil, proc.StopUnknown, err + } + if trapthread != nil { + dbp.memthread = trapthread + return trapthread, proc.StopUnknown, nil + } } - return trapthread, proc.StopUnknown, err } // FindBreakpoint finds the breakpoint for the given pc. @@ -282,11 +265,31 @@ func (dbp *nativeProcess) initialize(path string, debugInfoDirs []string) (*proc if !dbp.childProcess { stopReason = proc.StopAttached } - return proc.NewTarget(dbp, proc.NewTargetConfig{ - Path: path, - DebugInfoDirs: debugInfoDirs, - DisableAsyncPreempt: runtime.GOOS == "windows" || runtime.GOOS == "freebsd", - StopReason: stopReason}) + tgt, err := proc.NewTarget(dbp, dbp.pid, dbp.memthread, proc.NewTargetConfig{ + Path: path, + DebugInfoDirs: debugInfoDirs, + + // We disable asyncpreempt for the following reasons: + // - on Windows asyncpreempt is incompatible with debuggers, see: + // https://github.com/golang/go/issues/36494 + // - freebsd's backend is generally broken and asyncpreempt makes it even more so, see: + // https://github.com/go-delve/delve/issues/1754 + // - on linux/arm64 asyncpreempt can sometimes restart a sequence of + // instructions, if the sequence happens to contain a breakpoint it will + // look like the breakpoint was hit twice when it was "logically" only + // executed once. + // See: https://go-review.googlesource.com/c/go/+/208126 + DisableAsyncPreempt: runtime.GOOS == "windows" || runtime.GOOS == "freebsd" || (runtime.GOOS == "linux" && runtime.GOARCH == "arm64"), + + StopReason: stopReason, + CanDump: runtime.GOOS == "linux"}) + if err != nil { + return nil, err + } + if dbp.bi.Arch.Name == "arm64" { + dbp.iscgo = tgt.IsCgo() + } + return tgt, nil } func (dbp *nativeProcess) handlePtraceFuncs() { @@ -314,10 +317,11 @@ func (dbp *nativeProcess) postExit() { if dbp.ctty != nil { dbp.ctty.Close() } + dbp.os.Close() } func (dbp *nativeProcess) writeSoftwareBreakpoint(thread *nativeThread, addr uint64) error { - _, err := thread.WriteMemory(uintptr(addr), dbp.bi.Arch.BreakpointInstruction()) + _, err := thread.WriteMemory(addr, dbp.bi.Arch.BreakpointInstruction()) return err } diff --git a/pkg/proc/native/proc_darwin.go b/pkg/proc/native/proc_darwin.go index d8dfb758a2..74e176be01 100644 --- a/pkg/proc/native/proc_darwin.go +++ b/pkg/proc/native/proc_darwin.go @@ -1,4 +1,5 @@ -//+build darwin,macnative +//go:build darwin && macnative +// +build darwin,macnative package native @@ -18,6 +19,8 @@ import ( sys "golang.org/x/sys/unix" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" + "github.com/go-delve/delve/pkg/proc/macutil" ) // osProcessDetails holds Darwin specific information. @@ -33,11 +36,13 @@ type osProcessDetails struct { portSet C.mach_port_t } +func (os *osProcessDetails) Close() {} + // Launch creates and begins debugging a new process. Uses a // custom fork/exec process in order to take advantage of // PT_SIGEXC on Darwin which will turn Unix signals into // Mach exceptions. -func Launch(cmd []string, wd string, foreground bool, _ []string, _ string, _ [3]string) (*proc.Target, error) { +func Launch(cmd []string, wd string, flags proc.LaunchFlags, _ []string, _ string, _ [3]string) (*proc.Target, error) { argv0Go, err := filepath.Abs(cmd[0]) if err != nil { return nil, err @@ -51,6 +56,9 @@ func Launch(cmd []string, wd string, foreground bool, _ []string, _ string, _ [3 if _, err := os.Stat(argv0Go); err != nil { return nil, err } + if err := macutil.CheckRosetta(); err != nil { + return nil, err + } argv0 := C.CString(argv0Go) argvSlice := make([]*C.char, 0, len(cmd)+1) @@ -113,12 +121,12 @@ func Launch(cmd []string, wd string, foreground bool, _ []string, _ string, _ [3 if err != nil { return nil, err } - if err := dbp.stop(nil); err != nil { + if _, err := dbp.stop(nil); err != nil { return nil, err } dbp.os.initialized = true - dbp.currentThread = trapthread + dbp.memthread = trapthread tgt, err := dbp.initialize(argv0Go, []string{}) if err != nil { @@ -130,6 +138,9 @@ func Launch(cmd []string, wd string, foreground bool, _ []string, _ string, _ [3 // Attach to an existing process with the given PID. func Attach(pid int, _ []string) (*proc.Target, error) { + if err := macutil.CheckRosetta(); err != nil { + return nil, err + } dbp := newProcess(pid) kret := C.acquire_mach_task(C.int(pid), @@ -188,7 +199,7 @@ func (dbp *nativeProcess) kill() (err error) { func (dbp *nativeProcess) requestManualStop() (err error) { var ( task = C.mach_port_t(dbp.os.task) - thread = C.mach_port_t(dbp.currentThread.os.threadAct) + thread = C.mach_port_t(dbp.memthread.os.threadAct) exceptionPort = C.mach_port_t(dbp.os.exceptionPort) ) dbp.os.halt = true @@ -267,8 +278,8 @@ func (dbp *nativeProcess) addThread(port int, attach bool) (*nativeThread, error } dbp.threads[port] = thread thread.os.threadAct = C.thread_act_t(port) - if dbp.currentThread == nil { - dbp.currentThread = thread + if dbp.memthread == nil { + dbp.memthread = thread } return thread, nil } @@ -422,35 +433,35 @@ func (dbp *nativeProcess) resume() error { } // stop stops all running threads and sets breakpoints -func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { +func (dbp *nativeProcess) stop(trapthread *nativeThread) (*nativeThread, error) { if dbp.exited { - return &proc.ErrProcessExited{Pid: dbp.Pid()} + return nil, proc.ErrProcessExited{Pid: dbp.pid} } for _, th := range dbp.threads { if !th.Stopped() { if err := th.stop(); err != nil { - return dbp.exitGuard(err) + return nil, dbp.exitGuard(err) } } } ports, err := dbp.waitForStop() if err != nil { - return err + return nil, err } if !dbp.os.initialized { - return nil + return nil, nil } trapthread.SetCurrentBreakpoint(true) for _, port := range ports { if th, ok := dbp.threads[port]; ok { err := th.SetCurrentBreakpoint(true) if err != nil { - return err + return nil, err } } } - return nil + return trapthread, nil } func (dbp *nativeProcess) detach(kill bool) error { @@ -462,4 +473,16 @@ func (dbp *nativeProcess) EntryPoint() (uint64, error) { return 0, nil } +func (dbp *nativeProcess) SupportsBPF() bool { + return false +} + +func (dbp *nativeProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error { + panic("not implemented") +} + +func (dbp *nativeProcess) GetBufferedTracepoints() []ebpf.RawUProbeParams { + panic("not implemented") +} + func initialize(dbp *nativeProcess) error { return nil } diff --git a/pkg/proc/native/proc_ebpf_linux.go b/pkg/proc/native/proc_ebpf_linux.go new file mode 100644 index 0000000000..1c65e5ef68 --- /dev/null +++ b/pkg/proc/native/proc_ebpf_linux.go @@ -0,0 +1,8 @@ +//go:build linux && amd64 && cgo && go1.16 +// +build linux,amd64,cgo,go1.16 + +package native + +func (dbp *nativeProcess) SupportsBPF() bool { + return true +} diff --git a/pkg/proc/native/proc_freebsd.c b/pkg/proc/native/proc_freebsd.c index 09890d7cc1..887aa4df1c 100644 --- a/pkg/proc/native/proc_freebsd.c +++ b/pkg/proc/native/proc_freebsd.c @@ -3,11 +3,13 @@ #include #include #include +#include #include #include #include #include +#include #include "proc_freebsd.h" @@ -66,21 +68,23 @@ int find_status(int pid){ return (status); } -int get_entry_point(int pid) { +uintptr_t get_entry_point(int pid) { void *ep = NULL; + errno = EINVAL; + struct procstat *ps = procstat_open_sysctl(); if (ps == NULL) - return -1; + return 0; uint cnt = 0; struct kinfo_proc *kipp = procstat_getprocs(ps, KERN_PROC_PID, pid, &cnt); if (cnt == 0) - return -1; + return 0; Elf_Auxinfo *auxv = procstat_getauxv(ps, kipp, &cnt); if (auxv == NULL) - return -1; + return 0; for (int i = 0; i < cnt; i++) { if (auxv[i].a_type == AT_ENTRY) { @@ -89,5 +93,6 @@ int get_entry_point(int pid) { } } procstat_freeauxv(ps, auxv); - return (int)ep; + errno = 0; + return (uintptr_t)ep; } diff --git a/pkg/proc/native/proc_freebsd.go b/pkg/proc/native/proc_freebsd.go index f2fe628a49..c2adc73e95 100644 --- a/pkg/proc/native/proc_freebsd.go +++ b/pkg/proc/native/proc_freebsd.go @@ -15,6 +15,7 @@ import ( sys "golang.org/x/sys/unix" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" isatty "github.com/mattn/go-isatty" ) @@ -37,17 +38,21 @@ type osProcessDetails struct { tid int } +func (os *osProcessDetails) Close() {} + // Launch creates and begins debugging a new process. First entry in // `cmd` is the program to run, and then rest are the arguments // to be supplied to that process. `wd` is working directory of the program. // If the DWARF information cannot be found in the binary, Delve will look // for external debug files in the directories passed in. -func Launch(cmd []string, wd string, foreground bool, debugInfoDirs []string, tty string, redirects [3]string) (*proc.Target, error) { +func Launch(cmd []string, wd string, flags proc.LaunchFlags, debugInfoDirs []string, tty string, redirects [3]string) (*proc.Target, error) { var ( process *exec.Cmd err error ) + foreground := flags&proc.LaunchForeground != 0 + stdin, stdout, stderr, closefn, err := openRedirects(redirects, foreground) if err != nil { return nil, err @@ -178,8 +183,8 @@ func (dbp *nativeProcess) addThread(tid int, attach bool) (*nativeThread, error) os: new(osSpecificDetails), } - if dbp.currentThread == nil { - dbp.currentThread = dbp.threads[tid] + if dbp.memthread == nil { + dbp.memthread = dbp.threads[tid] } return dbp.threads[tid], nil @@ -345,19 +350,19 @@ func (dbp *nativeProcess) resume() error { // Used by ContinueOnce // stop stops all running threads and sets breakpoints -func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { +func (dbp *nativeProcess) stop(trapthread *nativeThread) (*nativeThread, error) { if dbp.exited { - return &proc.ErrProcessExited{Pid: dbp.Pid()} + return nil, proc.ErrProcessExited{Pid: dbp.pid} } // set breakpoints on all threads for _, th := range dbp.threads { if th.CurrentBreakpoint.Breakpoint == nil { if err := th.SetCurrentBreakpoint(true); err != nil { - return err + return nil, err } } } - return nil + return trapthread, nil } // Used by Detach @@ -372,6 +377,18 @@ func (dbp *nativeProcess) EntryPoint() (uint64, error) { return uint64(ep), err } +func (dbp *nativeProcess) SupportsBPF() bool { + return false +} + +func (dbp *nativeProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error { + panic("not implemented") +} + +func (dbp *nativeProcess) GetBufferedTracepoints() []ebpf.RawUProbeParams { + panic("not implemented") +} + // Usedy by Detach func killProcess(pid int) error { return sys.Kill(pid, sys.SIGINT) diff --git a/pkg/proc/native/proc_freebsd.h b/pkg/proc/native/proc_freebsd.h index a202c2b1e1..76bbc38309 100644 --- a/pkg/proc/native/proc_freebsd.h +++ b/pkg/proc/native/proc_freebsd.h @@ -1,4 +1,6 @@ +#include + char * find_command_name(int pid); char * find_executable(int pid); int find_status(int pid); -int get_entry_point(int pid); +uintptr_t get_entry_point(int pid); diff --git a/pkg/proc/native/proc_linux.go b/pkg/proc/native/proc_linux.go index 605819bc9a..371735fe76 100644 --- a/pkg/proc/native/proc_linux.go +++ b/pkg/proc/native/proc_linux.go @@ -3,6 +3,7 @@ package native import ( "bufio" "bytes" + "debug/elf" "errors" "fmt" "io/ioutil" @@ -19,6 +20,7 @@ import ( sys "golang.org/x/sys/unix" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" "github.com/go-delve/delve/pkg/proc/linutil" isatty "github.com/mattn/go-isatty" @@ -36,12 +38,23 @@ const ( // version of the kernel ('T' is job control stop on modern 3.x+ kernels) we // may want to differentiate at some point. statusTraceStopT = 'T' + + personalityGetPersonality = 0xffffffff // argument to pass to personality syscall to get the current personality + _ADDR_NO_RANDOMIZE = 0x0040000 // ADDR_NO_RANDOMIZE linux constant ) // osProcessDetails contains Linux specific // process details. type osProcessDetails struct { comm string + + ebpf *ebpf.EBPFContext +} + +func (os *osProcessDetails) Close() { + if os.ebpf != nil { + os.ebpf.Close() + } } // Launch creates and begins debugging a new process. First entry in @@ -49,12 +62,14 @@ type osProcessDetails struct { // to be supplied to that process. `wd` is working directory of the program. // If the DWARF information cannot be found in the binary, Delve will look // for external debug files in the directories passed in. -func Launch(cmd []string, wd string, foreground bool, debugInfoDirs []string, tty string, redirects [3]string) (*proc.Target, error) { +func Launch(cmd []string, wd string, flags proc.LaunchFlags, debugInfoDirs []string, tty string, redirects [3]string) (*proc.Target, error) { var ( process *exec.Cmd err error ) + foreground := flags&proc.LaunchForeground != 0 + stdin, stdout, stderr, closefn, err := openRedirects(redirects, foreground) if err != nil { return nil, err @@ -73,6 +88,15 @@ func Launch(cmd []string, wd string, foreground bool, debugInfoDirs []string, tt } }() dbp.execPtraceFunc(func() { + if flags&proc.LaunchDisableASLR != 0 { + oldPersonality, _, err := syscall.Syscall(sys.SYS_PERSONALITY, personalityGetPersonality, 0, 0) + if err == syscall.Errno(0) { + newPersonality := oldPersonality | _ADDR_NO_RANDOMIZE + syscall.Syscall(sys.SYS_PERSONALITY, newPersonality, 0, 0) + defer syscall.Syscall(sys.SYS_PERSONALITY, oldPersonality, 0, 0) + } + } + process = exec.Command(cmd[0]) process.Args = cmd process.Stdin = stdin @@ -130,12 +154,7 @@ func Attach(pid int, debugInfoDirs []string) (*proc.Target, error) { return nil, err } - execPath, err := findExecutable(pid) - if err != nil { - return nil, err - } - - tgt, err := dbp.initialize(execPath, debugInfoDirs) + tgt, err := dbp.initialize(findExecutable("", dbp.pid), debugInfoDirs) if err != nil { _ = dbp.Detach(false) return nil, err @@ -174,25 +193,44 @@ func initialize(dbp *nativeProcess) error { comm = match[1] } dbp.os.comm = strings.ReplaceAll(string(comm), "%", "%%") + return nil } +func (dbp *nativeProcess) GetBufferedTracepoints() []ebpf.RawUProbeParams { + if dbp.os.ebpf == nil { + return nil + } + return dbp.os.ebpf.GetBufferedTracepoints() +} + // kill kills the target process. -func (dbp *nativeProcess) kill() (err error) { +func (dbp *nativeProcess) kill() error { if dbp.exited { return nil } if !dbp.threads[dbp.pid].Stopped() { return errors.New("process must be stopped in order to kill it") } - if err = sys.Kill(-dbp.pid, sys.SIGKILL); err != nil { + if err := sys.Kill(-dbp.pid, sys.SIGKILL); err != nil { return errors.New("could not deliver signal " + err.Error()) } - if _, _, err = dbp.wait(dbp.pid, 0); err != nil { - return + // wait for other threads first or the thread group leader (dbp.pid) will never exit. + for threadID := range dbp.threads { + if threadID != dbp.pid { + dbp.wait(threadID, 0) + } + } + for { + wpid, status, err := dbp.wait(dbp.pid, 0) + if err != nil { + return err + } + if wpid == dbp.pid && status != nil && status.Signaled() && status.Signal() == sys.SIGKILL { + dbp.postExit() + return err + } } - dbp.postExit() - return } func (dbp *nativeProcess) requestManualStop() (err error) { @@ -244,8 +282,16 @@ func (dbp *nativeProcess) addThread(tid int, attach bool) (*nativeThread, error) dbp: dbp, os: new(osSpecificDetails), } - if dbp.currentThread == nil { - dbp.currentThread = dbp.threads[tid] + if dbp.memthread == nil { + dbp.memthread = dbp.threads[tid] + } + for _, bp := range dbp.Breakpoints().M { + if bp.WatchType != 0 { + err := dbp.threads[tid].writeHardwareBreakpoint(bp.Addr, bp.WatchType, bp.HWBreakIndex) + if err != nil { + return nil, err + } + } } return dbp.threads[tid], nil } @@ -265,9 +311,11 @@ func (dbp *nativeProcess) updateThreadList() error { return linutil.ElfUpdateSharedObjects(dbp) } -func findExecutable(pid int) (string, error) { - path := fmt.Sprintf("/proc/%d/exe", pid) - return filepath.EvalSymlinks(path) +func findExecutable(path string, pid int) string { + if path == "" { + path = fmt.Sprintf("/proc/%d/exe", pid) + } + return path } func (dbp *nativeProcess) trapWait(pid int) (*nativeThread, error) { @@ -279,6 +327,7 @@ type trapWaitOptions uint8 const ( trapWaitHalt trapWaitOptions = 1 << iota trapWaitNohang + trapWaitDontCallExitGuard ) func (dbp *nativeProcess) trapWaitInternal(pid int, options trapWaitOptions) (*nativeThread, error) { @@ -310,6 +359,16 @@ func (dbp *nativeProcess) trapWaitInternal(pid int, options trapWaitOptions) (*n delete(dbp.threads, wpid) continue } + if status.Signaled() { + // Signaled means the thread was terminated due to a signal. + if wpid == dbp.pid { + dbp.postExit() + return nil, proc.ErrProcessExited{Pid: wpid, Status: -int(status.Signal())} + } + // does this ever happen? + delete(dbp.threads, wpid) + continue + } if status.StopSignal() == sys.SIGTRAP && status.TrapCause() == sys.PTRACE_EVENT_CLONE { // A traced thread has cloned a new thread, grab the pid and // add it to our list of traced threads. @@ -374,11 +433,15 @@ func (dbp *nativeProcess) trapWaitInternal(pid int, options trapWaitOptions) (*n th.os.running = false return th, nil } else if err := th.resumeWithSig(int(status.StopSignal())); err != nil { - if err == sys.ESRCH { + if err != sys.ESRCH { + return nil, err + } + // do the same thing we do if a thread quit + if wpid == dbp.pid { dbp.postExit() - return nil, proc.ErrProcessExited{Pid: dbp.pid} + return nil, proc.ErrProcessExited{Pid: wpid, Status: status.ExitStatus()} } - return nil, err + delete(dbp.threads, wpid) } } } @@ -448,7 +511,7 @@ func (dbp *nativeProcess) exitGuard(err error) error { return err } if status(dbp.pid, dbp.os.comm) == statusZombie { - _, err := dbp.trapWaitInternal(-1, 0) + _, err := dbp.trapWaitInternal(-1, trapWaitDontCallExitGuard) return err } @@ -475,9 +538,9 @@ func (dbp *nativeProcess) resume() error { } // stop stops all running threads and sets breakpoints -func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { +func (dbp *nativeProcess) stop(trapthread *nativeThread) (*nativeThread, error) { if dbp.exited { - return &proc.ErrProcessExited{Pid: dbp.Pid()} + return nil, proc.ErrProcessExited{Pid: dbp.pid} } for _, th := range dbp.threads { @@ -489,7 +552,7 @@ func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { for { th, err := dbp.trapWaitInternal(-1, trapWaitNohang) if err != nil { - return dbp.exitGuard(err) + return nil, dbp.exitGuard(err) } if th == nil { break @@ -500,7 +563,7 @@ func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { for _, th := range dbp.threads { if th.os.running { if err := th.stop(); err != nil { - return dbp.exitGuard(err) + return nil, dbp.exitGuard(err) } } } @@ -519,23 +582,96 @@ func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { } _, err := dbp.trapWaitInternal(-1, trapWaitHalt) if err != nil { - return err + return nil, err } } if err := linutil.ElfUpdateSharedObjects(dbp); err != nil { - return err + return nil, err } + switchTrapthread := false + // set breakpoints on SIGTRAP threads + var err1 error for _, th := range dbp.threads { + pc, _ := th.PC() + + if !th.os.setbp && pc != th.os.phantomBreakpointPC { + // check if this could be a breakpoint hit anyway that the OS hasn't notified us about, yet. + if _, ok := dbp.FindBreakpoint(pc, dbp.BinInfo().Arch.BreakInstrMovesPC()); ok { + th.os.phantomBreakpointPC = pc + } + } + + if pc != th.os.phantomBreakpointPC { + th.os.phantomBreakpointPC = 0 + } + if th.CurrentBreakpoint.Breakpoint == nil && th.os.setbp { if err := th.SetCurrentBreakpoint(true); err != nil { - return err + err1 = err + continue + } + } + + if th.CurrentBreakpoint.Breakpoint == nil && th.os.setbp && (th.Status != nil) && ((*sys.WaitStatus)(th.Status).StopSignal() == sys.SIGTRAP) && dbp.BinInfo().Arch.BreakInstrMovesPC() { + manualStop := false + if th.ThreadID() == trapthread.ThreadID() { + dbp.stopMu.Lock() + manualStop = dbp.manualStopRequested + dbp.stopMu.Unlock() + } + if !manualStop && th.os.phantomBreakpointPC == pc { + // Thread received a SIGTRAP but we don't have a breakpoint for it and + // it wasn't sent by a manual stop request. It's either a hardcoded + // breakpoint or a phantom breakpoint hit (a breakpoint that was hit but + // we have removed before we could receive its signal). Check if it is a + // hardcoded breakpoint, otherwise rewind the thread. + isHardcodedBreakpoint := false + pc, _ := th.PC() + for _, bpinstr := range [][]byte{ + dbp.BinInfo().Arch.BreakpointInstruction(), + dbp.BinInfo().Arch.AltBreakpointInstruction()} { + if bpinstr == nil { + continue + } + buf := make([]byte, len(bpinstr)) + _, _ = th.ReadMemory(buf, pc-uint64(len(buf))) + if bytes.Equal(buf, bpinstr) { + isHardcodedBreakpoint = true + break + } + } + if !isHardcodedBreakpoint { + // phantom breakpoint hit + _ = th.setPC(pc - uint64(len(dbp.BinInfo().Arch.BreakpointInstruction()))) + th.os.setbp = false + if trapthread.ThreadID() == th.ThreadID() { + // Will switch to a different thread for trapthread because we don't + // want pkg/proc to believe that this thread was stopped by a + // hardcoded breakpoint. + switchTrapthread = true + } + } } } } - return nil + if err1 != nil { + return nil, err1 + } + + if switchTrapthread { + trapthreadID := trapthread.ID + trapthread = nil + for _, th := range dbp.threads { + if th.os.setbp && th.ThreadID() != trapthreadID { + return th, nil + } + } + } + + return trapthread, nil } func (dbp *nativeProcess) detach(kill bool) error { @@ -570,6 +706,86 @@ func (dbp *nativeProcess) EntryPoint() (uint64, error) { return linutil.EntryPointFromAuxv(auxvbuf, dbp.bi.Arch.PtrSize()), nil } +func (dbp *nativeProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error { + // Lazily load and initialize the BPF program upon request to set a uprobe. + if dbp.os.ebpf == nil { + var err error + dbp.os.ebpf, err = ebpf.LoadEBPFTracingProgram(dbp.bi.Images[0].Path) + if err != nil { + return err + } + } + + // We only allow up to 12 args for a BPF probe. + // 6 inputs + 6 outputs. + // Return early if we have more. + if len(args) > 12 { + return errors.New("too many arguments in traced function, max is 12 input+return") + } + + fn, ok := dbp.bi.LookupFunc[fnName] + if !ok { + return fmt.Errorf("could not find function: %s", fnName) + } + + key := fn.Entry + err := dbp.os.ebpf.UpdateArgMap(key, goidOffset, args, dbp.BinInfo().GStructOffset(), false) + if err != nil { + return err + } + + debugname := dbp.bi.Images[0].Path + + // First attach a uprobe at all return addresses. We do this instead of using a uretprobe + // for two reasons: + // 1. uretprobes do not play well with Go + // 2. uretprobes seem to not restore the function return addr on the stack when removed, destroying any + // kind of workaround we could come up with. + // TODO(derekparker): this whole thing could likely be optimized a bit. + img := dbp.BinInfo().PCToImage(fn.Entry) + f, err := elf.Open(img.Path) + if err != nil { + return fmt.Errorf("could not open elf file to resolve symbol offset: %w", err) + } + + var regs proc.Registers + mem := dbp.Memory() + regs, _ = dbp.memthread.Registers() + instructions, err := proc.Disassemble(mem, regs, &proc.BreakpointMap{}, dbp.BinInfo(), fn.Entry, fn.End) + if err != nil { + return err + } + + var addrs []uint64 + for _, instruction := range instructions { + if instruction.IsRet() { + addrs = append(addrs, instruction.Loc.PC) + } + } + addrs = append(addrs, proc.FindDeferReturnCalls(instructions)...) + for _, addr := range addrs { + err := dbp.os.ebpf.UpdateArgMap(addr, goidOffset, args, dbp.BinInfo().GStructOffset(), true) + if err != nil { + return err + } + off, err := ebpf.AddressToOffset(f, addr) + if err != nil { + return err + } + err = dbp.os.ebpf.AttachUprobe(dbp.pid, debugname, off) + if err != nil { + return err + } + } + + off, err := ebpf.AddressToOffset(f, fn.Entry) + if err != nil { + return err + } + + return dbp.os.ebpf.AttachUprobe(dbp.pid, debugname, off) +} + func killProcess(pid int) error { return sys.Kill(pid, sys.SIGINT) } diff --git a/pkg/proc/native/proc_no_ebpf_linux.go b/pkg/proc/native/proc_no_ebpf_linux.go new file mode 100644 index 0000000000..4b789fa314 --- /dev/null +++ b/pkg/proc/native/proc_no_ebpf_linux.go @@ -0,0 +1,8 @@ +//go:build !linux || !amd64 || !go1.16 || !cgo +// +build !linux !amd64 !go1.16 !cgo + +package native + +func (dbp *nativeProcess) SupportsBPF() bool { + return false +} diff --git a/pkg/proc/native/proc_unix.go b/pkg/proc/native/proc_unix.go index 2ca69f3a44..f7a48d5409 100644 --- a/pkg/proc/native/proc_unix.go +++ b/pkg/proc/native/proc_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package native diff --git a/pkg/proc/native/proc_windows.go b/pkg/proc/native/proc_windows.go index 133d218f93..5b8c3d352d 100644 --- a/pkg/proc/native/proc_windows.go +++ b/pkg/proc/native/proc_windows.go @@ -10,6 +10,8 @@ import ( sys "golang.org/x/sys/windows" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" + "github.com/go-delve/delve/pkg/proc/winutil" ) // osProcessDetails holds Windows specific information. @@ -20,8 +22,10 @@ type osProcessDetails struct { running bool } +func (os *osProcessDetails) Close() {} + // Launch creates and begins debugging a new process. -func Launch(cmd []string, wd string, foreground bool, _ []string, _ string, redirects [3]string) (*proc.Target, error) { +func Launch(cmd []string, wd string, flags proc.LaunchFlags, _ []string, _ string, redirects [3]string) (*proc.Target, error) { argv0Go, err := filepath.Abs(cmd[0]) if err != nil { return nil, err @@ -85,9 +89,11 @@ func initialize(dbp *nativeProcess) error { // Suspend all threads so that the call to _ContinueDebugEvent will // not resume the target. for _, thread := range dbp.threads { - _, err := _SuspendThread(thread.os.hThread) - if err != nil { - return err + if !thread.os.dbgUiRemoteBreakIn { + _, err := _SuspendThread(thread.os.hThread) + if err != nil { + return err + } } } @@ -195,7 +201,7 @@ func (dbp *nativeProcess) updateThreadList() error { return nil } -func (dbp *nativeProcess) addThread(hThread syscall.Handle, threadID int, attach, suspendNewThreads bool) (*nativeThread, error) { +func (dbp *nativeProcess) addThread(hThread syscall.Handle, threadID int, attach, suspendNewThreads bool, dbgUiRemoteBreakIn bool) (*nativeThread, error) { if thread, ok := dbp.threads[threadID]; ok { return thread, nil } @@ -204,22 +210,29 @@ func (dbp *nativeProcess) addThread(hThread syscall.Handle, threadID int, attach dbp: dbp, os: new(osSpecificDetails), } + thread.os.dbgUiRemoteBreakIn = dbgUiRemoteBreakIn thread.os.hThread = hThread dbp.threads[threadID] = thread - if dbp.currentThread == nil { - dbp.currentThread = dbp.threads[threadID] + if dbp.memthread == nil { + dbp.memthread = dbp.threads[threadID] } - if suspendNewThreads { + if suspendNewThreads && !dbgUiRemoteBreakIn { _, err := _SuspendThread(thread.os.hThread) if err != nil { return nil, err } } - return thread, nil -} -func findExecutable(path string, pid int) string { - return path + for _, bp := range dbp.Breakpoints().M { + if bp.WatchType != 0 { + err := thread.writeHardwareBreakpoint(bp.Addr, bp.WatchType, bp.HWBreakIndex) + if err != nil { + return nil, err + } + } + } + + return thread, nil } type waitForDebugEventFlags int @@ -261,14 +274,16 @@ func (dbp *nativeProcess) waitForDebugEvent(flags waitForDebugEventFlags) (threa } dbp.os.entryPoint = uint64(debugInfo.BaseOfImage) dbp.os.hProcess = debugInfo.Process - _, err = dbp.addThread(debugInfo.Thread, int(debugEvent.ThreadId), false, flags&waitSuspendNewThreads != 0) + _, err = dbp.addThread(debugInfo.Thread, int(debugEvent.ThreadId), false, + flags&waitSuspendNewThreads != 0, debugInfo.StartAddress == dbgUiRemoteBreakin.Addr()) if err != nil { return 0, 0, err } break case _CREATE_THREAD_DEBUG_EVENT: debugInfo := (*_CREATE_THREAD_DEBUG_INFO)(unionPtr) - _, err = dbp.addThread(debugInfo.Thread, int(debugEvent.ThreadId), false, flags&waitSuspendNewThreads != 0) + _, err = dbp.addThread(debugInfo.Thread, int(debugEvent.ThreadId), false, + flags&waitSuspendNewThreads != 0, debugInfo.StartAddress == dbgUiRemoteBreakin.Addr()) if err != nil { return 0, 0, err } @@ -310,7 +325,7 @@ func (dbp *nativeProcess) waitForDebugEvent(flags waitForDebugEventFlags) (threa atbp := true if thread, found := dbp.threads[tid]; found { data := make([]byte, dbp.bi.Arch.BreakpointSize()) - if _, err := thread.ReadMemory(data, exception.ExceptionRecord.ExceptionAddress); err == nil { + if _, err := thread.ReadMemory(data, uint64(exception.ExceptionRecord.ExceptionAddress)); err == nil { instr := dbp.bi.Arch.BreakpointInstruction() for i := range instr { if data[i] != instr[i] { @@ -320,7 +335,7 @@ func (dbp *nativeProcess) waitForDebugEvent(flags waitForDebugEventFlags) (threa } } if !atbp { - thread.SetPC(uint64(exception.ExceptionRecord.ExceptionAddress)) + thread.setPC(uint64(exception.ExceptionRecord.ExceptionAddress)) } } @@ -407,9 +422,9 @@ func (dbp *nativeProcess) resume() error { } // stop stops all running threads threads and sets breakpoints -func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { +func (dbp *nativeProcess) stop(trapthread *nativeThread) (*nativeThread, error) { if dbp.exited { - return &proc.ErrProcessExited{Pid: dbp.Pid()} + return nil, proc.ErrProcessExited{Pid: dbp.pid} } dbp.os.running = false @@ -424,15 +439,23 @@ func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { // call to _ContinueDebugEvent will resume execution of some of the // target threads. - err = trapthread.SetCurrentBreakpoint(true) + err := trapthread.SetCurrentBreakpoint(true) if err != nil { - return err + return nil, err } + context := winutil.NewCONTEXT() + for _, thread := range dbp.threads { - _, err := _SuspendThread(thread.os.hThread) - if err != nil { - return err + thread.os.delayErr = nil + if !thread.os.dbgUiRemoteBreakIn { + // Wait before reporting the error, the thread could be removed when we + // call waitForDebugEvent in the next loop. + _, thread.os.delayErr = _SuspendThread(thread.os.hThread) + if thread.os.delayErr == nil { + // This call will block until the thread has stopped. + _ = _GetThreadContext(thread.os.hThread, context) + } } } @@ -446,18 +469,51 @@ func (dbp *nativeProcess) stop(trapthread *nativeThread) (err error) { } }) if err != nil { - return err + return nil, err } if tid == 0 { break } err = dbp.threads[tid].SetCurrentBreakpoint(true) if err != nil { - return err + return nil, err } } - return nil + // Check if trapthread still exist, if the process is dying it could have + // been removed while we were stopping the other threads. + trapthreadFound := false + for _, thread := range dbp.threads { + if thread.ID == trapthread.ID { + trapthreadFound = true + } + if thread.os.delayErr != nil && thread.os.delayErr != syscall.Errno(0x5) { + // Do not report Access is denied error, it is caused by the thread + // having already died but we haven't been notified about it yet. + return nil, thread.os.delayErr + } + } + + if !trapthreadFound { + wasDbgUiRemoteBreakIn := trapthread.os.dbgUiRemoteBreakIn + // trapthread exited during stop, pick another one + trapthread = nil + for _, thread := range dbp.threads { + if thread.CurrentBreakpoint.Breakpoint != nil && thread.os.delayErr == nil { + trapthread = thread + break + } + } + if trapthread == nil && wasDbgUiRemoteBreakIn { + // If this was triggered by a manual stop request we should stop + // regardless, pick a thread. + for _, thread := range dbp.threads { + return thread, nil + } + } + } + + return trapthread, nil } func (dbp *nativeProcess) detach(kill bool) error { @@ -478,6 +534,18 @@ func (dbp *nativeProcess) EntryPoint() (uint64, error) { return dbp.os.entryPoint, nil } +func (dbp *nativeProcess) SupportsBPF() bool { + return false +} + +func (dbp *nativeProcess) SetUProbe(fnName string, goidOffset int64, args []ebpf.UProbeArgMap) error { + return nil +} + +func (dbp *nativeProcess) GetBufferedTracepoints() []ebpf.RawUProbeParams { + return nil +} + func killProcess(pid int) error { p, err := os.FindProcess(pid) if err != nil { diff --git a/pkg/proc/native/ptrace_darwin.go b/pkg/proc/native/ptrace_darwin.go index 5fd6ca41bc..335b879fa4 100644 --- a/pkg/proc/native/ptrace_darwin.go +++ b/pkg/proc/native/ptrace_darwin.go @@ -1,4 +1,5 @@ -//+build darwin,macnative +//go:build darwin && macnative +// +build darwin,macnative package native diff --git a/pkg/proc/native/ptrace_freebsd.go b/pkg/proc/native/ptrace_freebsd.go index 1e3fc431e9..f165e47db9 100644 --- a/pkg/proc/native/ptrace_freebsd.go +++ b/pkg/proc/native/ptrace_freebsd.go @@ -14,7 +14,7 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc/fbsdutil" + "github.com/go-delve/delve/pkg/proc/amd64util" ) // ptraceAttach executes the sys.PtraceAttach call. @@ -54,7 +54,7 @@ func ptraceGetLwpInfo(wpid int) (info sys.PtraceLwpInfoStruct, err error) { return info, err } -func ptraceGetRegset(id int) (regset fbsdutil.AMD64Xstate, err error) { +func ptraceGetRegset(id int) (regset amd64util.AMD64Xstate, err error) { _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETFPREGS, uintptr(id), uintptr(unsafe.Pointer(®set.AMD64PtraceFpRegs)), 0, 0, 0) if err == syscall.Errno(0) || err == syscall.ENODEV { var xsave_len C.size_t @@ -62,7 +62,7 @@ func ptraceGetRegset(id int) (regset fbsdutil.AMD64Xstate, err error) { defer C.free(unsafe.Pointer(xsave)) if xsave != nil { xsave_sl := C.GoBytes(unsafe.Pointer(xsave), C.int(xsave_len)) - err = fbsdutil.AMD64XstateRead(xsave_sl, false, ®set) + err = amd64util.AMD64XstateRead(xsave_sl, false, ®set) } } return diff --git a/pkg/proc/native/ptrace_linux.go b/pkg/proc/native/ptrace_linux.go index d13127557d..38915d9831 100644 --- a/pkg/proc/native/ptrace_linux.go +++ b/pkg/proc/native/ptrace_linux.go @@ -24,3 +24,12 @@ func ptraceDetach(tid, sig int) error { func ptraceCont(tid, sig int) error { return sys.PtraceCont(tid, sig) } + +// ptraceSingleStep executes ptrace PTRACE_SINGLESTEP +func ptraceSingleStep(pid, sig int) error { + _, _, e1 := sys.Syscall6(sys.SYS_PTRACE, uintptr(sys.PTRACE_SINGLESTEP), uintptr(pid), uintptr(0), uintptr(sig), 0, 0) + if e1 != 0 { + return e1 + } + return nil +} diff --git a/pkg/proc/native/ptrace_linux_386.go b/pkg/proc/native/ptrace_linux_386.go index 3c82e7245c..07c7428728 100644 --- a/pkg/proc/native/ptrace_linux_386.go +++ b/pkg/proc/native/ptrace_linux_386.go @@ -9,7 +9,7 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/go-delve/delve/pkg/proc/amd64util" ) // ptraceGetRegset returns floating point registers of the specified thread @@ -17,20 +17,21 @@ import ( // See i386_linux_fetch_inferior_registers in gdb/i386-linux-nat.c.html // and i386_supply_xsave in gdb/i386-tdep.c.html // and Section 13.1 (and following) of Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture -func ptraceGetRegset(tid int) (regset linutil.I386Xstate, err error) { - _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETFPREGS, uintptr(tid), uintptr(0), uintptr(unsafe.Pointer(®set.I386PtraceFpRegs)), 0, 0) +func ptraceGetRegset(tid int) (regset amd64util.AMD64Xstate, err error) { + _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETFPREGS, uintptr(tid), uintptr(0), uintptr(unsafe.Pointer(®set.AMD64PtraceFpRegs)), 0, 0) if err == syscall.Errno(0) || err == syscall.ENODEV { // ignore ENODEV, it just means this CPU doesn't have X87 registers (??) err = nil } - var xstateargs [_X86_XSTATE_MAX_SIZE]byte - iov := sys.Iovec{Base: &xstateargs[0], Len: _X86_XSTATE_MAX_SIZE} + xstateargs := make([]byte, amd64util.AMD64XstateMaxSize()) + iov := sys.Iovec{Base: &xstateargs[0], Len: uint32(len(xstateargs))} _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETREGSET, uintptr(tid), _NT_X86_XSTATE, uintptr(unsafe.Pointer(&iov)), 0, 0) if err != syscall.Errno(0) { - if err == syscall.ENODEV || err == syscall.EIO { + if err == syscall.ENODEV || err == syscall.EIO || err == syscall.EINVAL { // ignore ENODEV, it just means this CPU or kernel doesn't support XSTATE, see https://github.com/go-delve/delve/issues/1022 // also ignore EIO, it means that we are running on an old kernel (pre 2.6.34) and PTRACE_GETREGSET is not implemented + // also ignore EINVAL, it means the kernel itself does not support the NT_X86_XSTATE argument (but does support PTRACE_GETREGSET) err = nil } return @@ -39,7 +40,7 @@ func ptraceGetRegset(tid int) (regset linutil.I386Xstate, err error) { } regset.Xsave = xstateargs[:iov.Len] - err = linutil.I386XstateRead(regset.Xsave, false, ®set) + err = amd64util.AMD64XstateRead(regset.Xsave, false, ®set) return } diff --git a/pkg/proc/native/ptrace_linux_64bit.go b/pkg/proc/native/ptrace_linux_64bit.go index d31cdf59ff..c79362f9f2 100644 --- a/pkg/proc/native/ptrace_linux_64bit.go +++ b/pkg/proc/native/ptrace_linux_64bit.go @@ -1,3 +1,4 @@ +//go:build (linux && amd64) || (linux && arm64) // +build linux,amd64 linux,arm64 package native diff --git a/pkg/proc/native/ptrace_linux_amd64.go b/pkg/proc/native/ptrace_linux_amd64.go index a56cf19d01..b60c09c00e 100644 --- a/pkg/proc/native/ptrace_linux_amd64.go +++ b/pkg/proc/native/ptrace_linux_amd64.go @@ -6,7 +6,7 @@ import ( sys "golang.org/x/sys/unix" - "github.com/go-delve/delve/pkg/proc/linutil" + "github.com/go-delve/delve/pkg/proc/amd64util" ) // ptraceGetRegset returns floating point registers of the specified thread @@ -14,20 +14,21 @@ import ( // See amd64_linux_fetch_inferior_registers in gdb/amd64-linux-nat.c.html // and amd64_supply_xsave in gdb/amd64-tdep.c.html // and Section 13.1 (and following) of Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1: Basic Architecture -func ptraceGetRegset(tid int) (regset linutil.AMD64Xstate, err error) { +func ptraceGetRegset(tid int) (regset amd64util.AMD64Xstate, err error) { _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETFPREGS, uintptr(tid), uintptr(0), uintptr(unsafe.Pointer(®set.AMD64PtraceFpRegs)), 0, 0) if err == syscall.Errno(0) || err == syscall.ENODEV { // ignore ENODEV, it just means this CPU doesn't have X87 registers (??) err = nil } - var xstateargs [_X86_XSTATE_MAX_SIZE]byte - iov := sys.Iovec{Base: &xstateargs[0], Len: _X86_XSTATE_MAX_SIZE} + xstateargs := make([]byte, amd64util.AMD64XstateMaxSize()) + iov := sys.Iovec{Base: &xstateargs[0], Len: uint64(len(xstateargs))} _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETREGSET, uintptr(tid), _NT_X86_XSTATE, uintptr(unsafe.Pointer(&iov)), 0, 0) if err != syscall.Errno(0) { - if err == syscall.ENODEV || err == syscall.EIO { + if err == syscall.ENODEV || err == syscall.EIO || err == syscall.EINVAL { // ignore ENODEV, it just means this CPU or kernel doesn't support XSTATE, see https://github.com/go-delve/delve/issues/1022 // also ignore EIO, it means that we are running on an old kernel (pre 2.6.34) and PTRACE_GETREGSET is not implemented + // also ignore EINVAL, it means the kernel itself does not support the NT_X86_XSTATE argument (but does support PTRACE_GETREGSET) err = nil } return @@ -36,6 +37,6 @@ func ptraceGetRegset(tid int) (regset linutil.AMD64Xstate, err error) { } regset.Xsave = xstateargs[:iov.Len] - err = linutil.AMD64XstateRead(regset.Xsave, false, ®set) + err = amd64util.AMD64XstateRead(regset.Xsave, false, ®set) return } diff --git a/pkg/proc/native/register_linux_386.go b/pkg/proc/native/register_linux_386.go index e3fb191603..906b34fc76 100644 --- a/pkg/proc/native/register_linux_386.go +++ b/pkg/proc/native/register_linux_386.go @@ -5,12 +5,15 @@ import ( sys "golang.org/x/sys/unix" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" "github.com/go-delve/delve/pkg/proc/linutil" ) -// SetPC sets EIP to the value specified by 'pc'. -func (thread *nativeThread) SetPC(pc uint64) error { +// setPC sets EIP to the value specified by 'pc'. +func (thread *nativeThread) setPC(pc uint64) error { ir, err := registers(thread) if err != nil { return err @@ -21,29 +24,26 @@ func (thread *nativeThread) SetPC(pc uint64) error { return err } -// SetSP sets ESP to the value specified by 'sp' -func (thread *nativeThread) SetSP(sp uint64) (err error) { - var ir proc.Registers - ir, err = registers(thread) +func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) error { + ir, err := registers(thread) if err != nil { return err } r := ir.(*linutil.I386Registers) - r.Regs.Esp = int32(sp) - thread.dbp.execPtraceFunc(func() { err = sys.PtraceSetRegs(thread.ID, (*sys.PtraceRegs)(r.Regs)) }) - return -} - -func (thread *nativeThread) SetDX(dx uint64) (err error) { - var ir proc.Registers - ir, err = registers(thread) - if err != nil { - return err + switch regNum { + case regnum.I386_Eip: + r.Regs.Eip = int32(reg.Uint64Val) + case regnum.I386_Esp: + r.Regs.Esp = int32(reg.Uint64Val) + case regnum.I386_Edx: + r.Regs.Edx = int32(reg.Uint64Val) + default: + //TODO(aarzilli): when the register calling convention is adopted by Go on + // i386 this should be implemented. + return fmt.Errorf("changing register %d not implemented", regNum) } - r := ir.(*linutil.I386Registers) - r.Regs.Edx = int32(dx) thread.dbp.execPtraceFunc(func() { err = sys.PtraceSetRegs(thread.ID, (*sys.PtraceRegs)(r.Regs)) }) - return + return err } func registers(thread *nativeThread) (proc.Registers, error) { @@ -56,7 +56,7 @@ func registers(thread *nativeThread) (proc.Registers, error) { return nil, err } r := linutil.NewI386Registers(®s, func(r *linutil.I386Registers) error { - var fpregset linutil.I386Xstate + var fpregset amd64util.AMD64Xstate var floatLoadError error r.Fpregs, fpregset, floatLoadError = thread.fpRegisters() r.Fpregset = &fpregset @@ -69,17 +69,9 @@ func registers(thread *nativeThread) (proc.Registers, error) { return r, nil } -const ( - _X86_XSTATE_MAX_SIZE = 2688 - _NT_X86_XSTATE = 0x202 - - _XSAVE_HEADER_START = 512 - _XSAVE_HEADER_LEN = 64 - _XSAVE_EXTENDED_REGION_START = 576 - _XSAVE_SSE_REGION_LEN = 416 -) +const _NT_X86_XSTATE = 0x202 -func (thread *nativeThread) fpRegisters() (regs []proc.Register, fpregs linutil.I386Xstate, err error) { +func (thread *nativeThread) fpRegisters() (regs []proc.Register, fpregs amd64util.AMD64Xstate, err error) { thread.dbp.execPtraceFunc(func() { fpregs, err = ptraceGetRegset(thread.ID) }) regs = fpregs.Decode() if err != nil { diff --git a/pkg/proc/native/registers_darwin_amd64.go b/pkg/proc/native/registers_darwin_amd64.go index 8923441acc..e965ea77bf 100644 --- a/pkg/proc/native/registers_darwin_amd64.go +++ b/pkg/proc/native/registers_darwin_amd64.go @@ -1,16 +1,18 @@ -//+build darwin,macnative +//go:build darwin && macnative +// +build darwin,macnative package native // #include "threads_darwin.h" import "C" import ( - "errors" "fmt" "unsafe" "golang.org/x/arch/x86/x86asm" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" "github.com/go-delve/delve/pkg/proc" ) @@ -111,7 +113,7 @@ func (r *Regs) GAddr() (uint64, bool) { } // SetPC sets the RIP register to the value specified by `pc`. -func (thread *nativeThread) SetPC(pc uint64) error { +func (thread *nativeThread) setPC(pc uint64) error { kret := C.set_pc(thread.os.threadAct, C.uint64_t(pc)) if kret != C.KERN_SUCCESS { return fmt.Errorf("could not set pc") @@ -119,13 +121,12 @@ func (thread *nativeThread) SetPC(pc uint64) error { return nil } -// SetSP sets the RSP register to the value specified by `pc`. -func (thread *nativeThread) SetSP(sp uint64) error { - return errors.New("not implemented") -} - -func (thread *nativeThread) SetDX(dx uint64) error { - return errors.New("not implemented") +// SetReg changes the value of the specified register. +func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) error { + if regNum != regnum.AMD64_Rip { + return fmt.Errorf("changing register %d not implemented", regNum) + } + return thread.setPC(reg.Uint64Val) } func (r *Regs) Get(n int) (uint64, error) { diff --git a/pkg/proc/native/registers_freebsd_amd64.go b/pkg/proc/native/registers_freebsd_amd64.go index 7e7de29185..7b3ffd9a92 100644 --- a/pkg/proc/native/registers_freebsd_amd64.go +++ b/pkg/proc/native/registers_freebsd_amd64.go @@ -5,12 +5,15 @@ import ( sys "golang.org/x/sys/unix" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" "github.com/go-delve/delve/pkg/proc/fbsdutil" ) // SetPC sets RIP to the value specified by 'pc'. -func (thread *nativeThread) SetPC(pc uint64) error { +func (thread *nativeThread) setPC(pc uint64) error { ir, err := registers(thread) if err != nil { return err @@ -21,27 +24,23 @@ func (thread *nativeThread) SetPC(pc uint64) error { return err } -// SetSP sets RSP to the value specified by 'sp' -func (thread *nativeThread) SetSP(sp uint64) (err error) { - var ir proc.Registers - ir, err = registers(thread) +// SetReg changes the value of the specified register. +func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) (err error) { + ir, err := registers(thread) if err != nil { return err } r := ir.(*fbsdutil.AMD64Registers) - r.Regs.Rsp = int64(sp) - thread.dbp.execPtraceFunc(func() { err = sys.PtraceSetRegs(thread.ID, (*sys.Reg)(r.Regs)) }) - return -} - -func (thread *nativeThread) SetDX(dx uint64) (err error) { - var ir proc.Registers - ir, err = registers(thread) - if err != nil { - return err + switch regNum { + case regnum.AMD64_Rip: + r.Regs.Rip = int64(reg.Uint64Val) + case regnum.AMD64_Rsp: + r.Regs.Rsp = int64(reg.Uint64Val) + case regnum.AMD64_Rdx: + r.Regs.Rdx = int64(reg.Uint64Val) + default: + return fmt.Errorf("changing register %d not implemented", regNum) } - r := ir.(*fbsdutil.AMD64Registers) - r.Regs.Rdx = int64(dx) thread.dbp.execPtraceFunc(func() { err = sys.PtraceSetRegs(thread.ID, (*sys.Reg)(r.Regs)) }) return } @@ -61,7 +60,7 @@ func registers(thread *nativeThread) (proc.Registers, error) { return nil, err } r := fbsdutil.NewAMD64Registers(®s, uint64(fsbase), func(r *fbsdutil.AMD64Registers) error { - var fpregset fbsdutil.AMD64Xstate + var fpregset amd64util.AMD64Xstate var floatLoadError error r.Fpregs, fpregset, floatLoadError = thread.fpRegisters() r.Fpregset = &fpregset @@ -70,17 +69,9 @@ func registers(thread *nativeThread) (proc.Registers, error) { return r, nil } -const ( - _X86_XSTATE_MAX_SIZE = 2688 - _NT_X86_XSTATE = 0x202 - - _XSAVE_HEADER_START = 512 - _XSAVE_HEADER_LEN = 64 - _XSAVE_EXTENDED_REGION_START = 576 - _XSAVE_SSE_REGION_LEN = 416 -) +const _NT_X86_XSTATE = 0x202 -func (thread *nativeThread) fpRegisters() (regs []proc.Register, fpregs fbsdutil.AMD64Xstate, err error) { +func (thread *nativeThread) fpRegisters() (regs []proc.Register, fpregs amd64util.AMD64Xstate, err error) { thread.dbp.execPtraceFunc(func() { fpregs, err = ptraceGetRegset(thread.ID) }) if err != nil { err = fmt.Errorf("could not get floating point registers: %v", err.Error()) diff --git a/pkg/proc/native/registers_linux_amd64.go b/pkg/proc/native/registers_linux_amd64.go index 5066af01aa..676d89649b 100644 --- a/pkg/proc/native/registers_linux_amd64.go +++ b/pkg/proc/native/registers_linux_amd64.go @@ -2,15 +2,19 @@ package native import ( "fmt" + "syscall" + "unsafe" sys "golang.org/x/sys/unix" + "github.com/go-delve/delve/pkg/dwarf/op" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" "github.com/go-delve/delve/pkg/proc/linutil" ) // SetPC sets RIP to the value specified by 'pc'. -func (thread *nativeThread) SetPC(pc uint64) error { +func (thread *nativeThread) setPC(pc uint64) error { ir, err := registers(thread) if err != nil { return err @@ -21,29 +25,31 @@ func (thread *nativeThread) SetPC(pc uint64) error { return err } -// SetSP sets RSP to the value specified by 'sp' -func (thread *nativeThread) SetSP(sp uint64) (err error) { - var ir proc.Registers - ir, err = registers(thread) +// SetReg changes the value of the specified register. +func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) error { + ir, err := registers(thread) if err != nil { return err } r := ir.(*linutil.AMD64Registers) - r.Regs.Rsp = sp - thread.dbp.execPtraceFunc(func() { err = sys.PtraceSetRegs(thread.ID, (*sys.PtraceRegs)(r.Regs)) }) - return -} - -func (thread *nativeThread) SetDX(dx uint64) (err error) { - var ir proc.Registers - ir, err = registers(thread) + fpchanged, err := r.SetReg(regNum, reg) if err != nil { return err } - r := ir.(*linutil.AMD64Registers) - r.Regs.Rdx = dx - thread.dbp.execPtraceFunc(func() { err = sys.PtraceSetRegs(thread.ID, (*sys.PtraceRegs)(r.Regs)) }) - return + thread.dbp.execPtraceFunc(func() { + err = sys.PtraceSetRegs(thread.ID, (*sys.PtraceRegs)(r.Regs)) + if err != nil { + return + } + if fpchanged && r.Fpregset != nil && r.Fpregset.Xsave != nil { + iov := sys.Iovec{Base: &r.Fpregset.Xsave[0], Len: uint64(len(r.Fpregset.Xsave))} + _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_SETREGSET, uintptr(thread.ID), _NT_X86_XSTATE, uintptr(unsafe.Pointer(&iov)), 0, 0) + if err == syscall.Errno(0) { + err = nil + } + } + }) + return err } func registers(thread *nativeThread) (proc.Registers, error) { @@ -56,7 +62,7 @@ func registers(thread *nativeThread) (proc.Registers, error) { return nil, err } r := linutil.NewAMD64Registers(®s, func(r *linutil.AMD64Registers) error { - var fpregset linutil.AMD64Xstate + var fpregset amd64util.AMD64Xstate var floatLoadError error r.Fpregs, fpregset, floatLoadError = thread.fpRegisters() r.Fpregset = &fpregset @@ -65,17 +71,9 @@ func registers(thread *nativeThread) (proc.Registers, error) { return r, nil } -const ( - _X86_XSTATE_MAX_SIZE = 2688 - _NT_X86_XSTATE = 0x202 - - _XSAVE_HEADER_START = 512 - _XSAVE_HEADER_LEN = 64 - _XSAVE_EXTENDED_REGION_START = 576 - _XSAVE_SSE_REGION_LEN = 416 -) +const _NT_X86_XSTATE = 0x202 -func (thread *nativeThread) fpRegisters() (regs []proc.Register, fpregs linutil.AMD64Xstate, err error) { +func (thread *nativeThread) fpRegisters() (regs []proc.Register, fpregs amd64util.AMD64Xstate, err error) { thread.dbp.execPtraceFunc(func() { fpregs, err = ptraceGetRegset(thread.ID) }) regs = fpregs.Decode() if err != nil { diff --git a/pkg/proc/native/registers_linux_arm64.go b/pkg/proc/native/registers_linux_arm64.go index 19ee8aba78..cebbd17586 100644 --- a/pkg/proc/native/registers_linux_arm64.go +++ b/pkg/proc/native/registers_linux_arm64.go @@ -8,6 +8,8 @@ import ( sys "golang.org/x/sys/unix" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" "github.com/go-delve/delve/pkg/proc" "github.com/go-delve/delve/pkg/proc/linutil" ) @@ -15,6 +17,7 @@ import ( const ( _AARCH64_GREGS_SIZE = 34 * 8 _AARCH64_FPREGS_SIZE = 32*16 + 8 + _NT_ARM_TLS = 0x401 // used in PTRACE_GETREGSET on ARM64 to retrieve the value of TPIDR_EL0, see source/include/uapi/linux/elf.h and source/arch/arm64/kernel/ptrace.c ) func ptraceGetGRegs(pid int, regs *linutil.ARM64PtraceRegs) (err error) { @@ -26,6 +29,15 @@ func ptraceGetGRegs(pid int, regs *linutil.ARM64PtraceRegs) (err error) { return } +func ptraceGetTpidr_el0(pid int, tpidr_el0 *uint64) (err error) { + iov := sys.Iovec{Base: (*byte)(unsafe.Pointer(tpidr_el0)), Len: uint64(unsafe.Sizeof(*tpidr_el0))} + _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETREGSET, uintptr(pid), uintptr(_NT_ARM_TLS), uintptr(unsafe.Pointer(&iov)), 0, 0) + if err == syscall.Errno(0) { + err = nil + } + return +} + func ptraceSetGRegs(pid int, regs *linutil.ARM64PtraceRegs) (err error) { iov := sys.Iovec{Base: (*byte)(unsafe.Pointer(regs)), Len: _AARCH64_GREGS_SIZE} _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_SETREGSET, uintptr(pid), uintptr(elf.NT_PRSTATUS), uintptr(unsafe.Pointer(&iov)), 0, 0) @@ -54,8 +66,8 @@ func ptraceGetFpRegset(tid int) (fpregset []byte, err error) { return fpregset, err } -// SetPC sets PC to the value specified by 'pc'. -func (thread *nativeThread) SetPC(pc uint64) error { +// setPC sets PC to the value specified by 'pc'. +func (thread *nativeThread) setPC(pc uint64) error { ir, err := registers(thread) if err != nil { return err @@ -66,21 +78,26 @@ func (thread *nativeThread) SetPC(pc uint64) error { return err } -// SetSP sets RSP to the value specified by 'sp' -func (thread *nativeThread) SetSP(sp uint64) (err error) { - var ir proc.Registers - ir, err = registers(thread) +func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) error { + ir, err := registers(thread) if err != nil { return err } r := ir.(*linutil.ARM64Registers) - r.Regs.Sp = sp - thread.dbp.execPtraceFunc(func() { err = ptraceSetGRegs(thread.ID, r.Regs) }) - return -} -func (thread *nativeThread) SetDX(dx uint64) (err error) { - return fmt.Errorf("not supported") + switch regNum { + case regnum.ARM64_PC: + r.Regs.Pc = reg.Uint64Val + case regnum.ARM64_SP: + r.Regs.Sp = reg.Uint64Val + default: + //TODO(aarzilli): when the register calling convention is adopted by Go on + // arm64 this should be implemented. + return fmt.Errorf("changing register %d not implemented", regNum) + } + + thread.dbp.execPtraceFunc(func() { err = ptraceSetGRegs(thread.ID, r.Regs) }) + return err } func registers(thread *nativeThread) (proc.Registers, error) { @@ -92,7 +109,14 @@ func registers(thread *nativeThread) (proc.Registers, error) { if err != nil { return nil, err } - r := linutil.NewARM64Registers(®s, func(r *linutil.ARM64Registers) error { + var tpidr_el0 uint64 + if thread.dbp.iscgo { + thread.dbp.execPtraceFunc(func() { err = ptraceGetTpidr_el0(thread.ID, &tpidr_el0) }) + if err != nil { + return nil, err + } + } + r := linutil.NewARM64Registers(®s, thread.dbp.iscgo, tpidr_el0, func(r *linutil.ARM64Registers) error { var floatLoadError error r.Fpregs, r.Fpregset, floatLoadError = thread.fpRegisters() return floatLoadError diff --git a/pkg/proc/native/registers_windows_amd64.go b/pkg/proc/native/registers_windows_amd64.go index f3669e40d9..2f44bc3318 100644 --- a/pkg/proc/native/registers_windows_amd64.go +++ b/pkg/proc/native/registers_windows_amd64.go @@ -4,12 +4,14 @@ import ( "fmt" "unsafe" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" "github.com/go-delve/delve/pkg/proc" "github.com/go-delve/delve/pkg/proc/winutil" ) // SetPC sets the RIP register to the value specified by `pc`. -func (thread *nativeThread) SetPC(pc uint64) error { +func (thread *nativeThread) setPC(pc uint64) error { context := winutil.NewCONTEXT() context.ContextFlags = _CONTEXT_ALL @@ -23,8 +25,8 @@ func (thread *nativeThread) SetPC(pc uint64) error { return _SetThreadContext(thread.os.hThread, context) } -// SetSP sets the RSP register to the value specified by `sp`. -func (thread *nativeThread) SetSP(sp uint64) error { +// SetReg changes the value of the specified register. +func (thread *nativeThread) SetReg(regNum uint64, reg *op.DwarfRegister) error { context := winutil.NewCONTEXT() context.ContextFlags = _CONTEXT_ALL @@ -33,21 +35,60 @@ func (thread *nativeThread) SetSP(sp uint64) error { return err } - context.Rsp = sp - - return _SetThreadContext(thread.os.hThread, context) -} - -func (thread *nativeThread) SetDX(dx uint64) error { - context := winutil.NewCONTEXT() - context.ContextFlags = _CONTEXT_ALL - - err := _GetThreadContext(thread.os.hThread, context) - if err != nil { - return err + var p *uint64 + + switch regNum { + case regnum.AMD64_Rax: + p = &context.Rax + case regnum.AMD64_Rbx: + p = &context.Rbx + case regnum.AMD64_Rcx: + p = &context.Rcx + case regnum.AMD64_Rdx: + p = &context.Rdx + case regnum.AMD64_Rsi: + p = &context.Rsi + case regnum.AMD64_Rdi: + p = &context.Rdi + case regnum.AMD64_Rbp: + p = &context.Rbp + case regnum.AMD64_Rsp: + p = &context.Rsp + case regnum.AMD64_R8: + p = &context.R8 + case regnum.AMD64_R9: + p = &context.R9 + case regnum.AMD64_R10: + p = &context.R10 + case regnum.AMD64_R11: + p = &context.R11 + case regnum.AMD64_R12: + p = &context.R12 + case regnum.AMD64_R13: + p = &context.R13 + case regnum.AMD64_R14: + p = &context.R14 + case regnum.AMD64_R15: + p = &context.R15 + case regnum.AMD64_Rip: + p = &context.Rip } - context.Rdx = dx + if p != nil { + if reg.Bytes != nil && len(reg.Bytes) != 8 { + return fmt.Errorf("wrong number of bytes for register %s (%d)", regnum.AMD64ToName(regNum), len(reg.Bytes)) + } + *p = reg.Uint64Val + } else { + if regNum < regnum.AMD64_XMM0 || regNum > regnum.AMD64_XMM0+15 { + return fmt.Errorf("can not set register %s", regnum.AMD64ToName(regNum)) + } + reg.FillBytes() + if len(reg.Bytes) > 16 { + return fmt.Errorf("too many bytes when setting register %s", regnum.AMD64ToName(regNum)) + } + copy(context.FltSave.XmmRegisters[(regNum-regnum.AMD64_XMM0)*16:], reg.Bytes) + } return _SetThreadContext(thread.os.hThread, context) } diff --git a/pkg/proc/native/syscall_windows.go b/pkg/proc/native/syscall_windows.go index b066a1bfc3..0cb622b334 100644 --- a/pkg/proc/native/syscall_windows.go +++ b/pkg/proc/native/syscall_windows.go @@ -70,6 +70,17 @@ type _EXCEPTION_RECORD struct { ExceptionInformation [_EXCEPTION_MAXIMUM_PARAMETERS]uintptr } +type _MEMORY_BASIC_INFORMATION struct { + BaseAddress uintptr + AllocationBase uintptr + AllocationProtect uint32 + PartitionId uint16 + RegionSize uint64 + State uint32 + Protect uint32 + Type uint32 +} + const ( _ThreadBasicInformation = 0 @@ -93,6 +104,20 @@ const ( _EXCEPTION_SINGLE_STEP = 0x80000004 _EXCEPTION_MAXIMUM_PARAMETERS = 15 + + _MEM_FREE = 0x10000 + _MEM_RESERVE = 0x2000 + + _PAGE_EXECUTE = 0x10 + _PAGE_EXECUTE_READ = 0x20 + _PAGE_EXECUTE_READWRITE = 0x40 + _PAGE_EXECUTE_WRITECOPY = 0x80 + _PAGE_NOACCESS = 0x01 + _PAGE_READONLY = 0x02 + _PAGE_READWRITE = 0x04 + _PAGE_WRITECOPY = 0x08 + + _PAGE_GUARD = 0x100 ) func _NT_SUCCESS(x _NTSTATUS) bool { @@ -117,3 +142,5 @@ type _CONTEXT = winutil.CONTEXT //sys _DebugActiveProcess(processid uint32) (err error) = kernel32.DebugActiveProcess //sys _DebugActiveProcessStop(processid uint32) (err error) = kernel32.DebugActiveProcessStop //sys _QueryFullProcessImageName(process syscall.Handle, flags uint32, exename *uint16, size *uint32) (err error) = kernel32.QueryFullProcessImageNameW +//sys _VirtualQueryEx(process syscall.Handle, addr uintptr, buffer *_MEMORY_BASIC_INFORMATION, length uintptr) (lengthOut uintptr) = kernel32.VirtualQueryEx +//sys _IsWow64Process(process syscall.Handle, wow64process *uint32) (ok uint32) = kernel32.IsWow64Process diff --git a/pkg/proc/native/threads.go b/pkg/proc/native/threads.go index 780f3bc845..3088545e22 100644 --- a/pkg/proc/native/threads.go +++ b/pkg/proc/native/threads.go @@ -53,6 +53,17 @@ func (t *nativeThread) StepInstruction() (err error) { defer func() { t.singleStepping = false }() + + if bp := t.CurrentBreakpoint.Breakpoint; bp != nil && bp.WatchType != 0 && t.dbp.Breakpoints().M[bp.Addr] == bp { + err = t.clearHardwareBreakpoint(bp.Addr, bp.WatchType, bp.HWBreakIndex) + if err != nil { + return err + } + defer func() { + err = t.writeHardwareBreakpoint(bp.Addr, bp.WatchType, bp.HWBreakIndex) + }() + } + pc, err := t.PC() if err != nil { return err @@ -61,7 +72,7 @@ func (t *nativeThread) StepInstruction() (err error) { bp, ok := t.dbp.FindBreakpoint(pc, false) if ok { // Clear the breakpoint so that we can continue execution. - err = t.ClearBreakpoint(bp) + err = t.clearSoftwareBreakpoint(bp) if err != nil { return err } @@ -109,31 +120,40 @@ func (t *nativeThread) Common() *proc.CommonThread { // thread is stopped at as CurrentBreakpoint on the thread struct. func (t *nativeThread) SetCurrentBreakpoint(adjustPC bool) error { t.CurrentBreakpoint.Clear() - pc, err := t.PC() - if err != nil { - return err - } - // If the breakpoint instruction does not change the value - // of PC after being executed we should look for breakpoints - // with bp.Addr == PC and there is no need to call SetPC - // after finding one. - adjustPC = adjustPC && t.BinInfo().Arch.BreakInstrMovesPC() + var bp *proc.Breakpoint - if bp, ok := t.dbp.FindBreakpoint(pc, adjustPC); ok { - if adjustPC { - if err = t.SetPC(bp.Addr); err != nil { - return err - } + if t.dbp.Breakpoints().HasHWBreakpoints() { + var err error + bp, err = t.findHardwareBreakpoint() + if err != nil { + return err } - t.CurrentBreakpoint = bp.CheckCondition(t) - if t.CurrentBreakpoint.Breakpoint != nil && t.CurrentBreakpoint.Active { - if g, err := proc.GetG(t); err == nil { - t.CurrentBreakpoint.HitCount[g.ID]++ + } + if bp == nil { + pc, err := t.PC() + if err != nil { + return err + } + + // If the breakpoint instruction does not change the value + // of PC after being executed we should look for breakpoints + // with bp.Addr == PC and there is no need to call SetPC + // after finding one. + adjustPC = adjustPC && t.BinInfo().Arch.BreakInstrMovesPC() + + var ok bool + bp, ok = t.dbp.FindBreakpoint(pc, adjustPC) + if ok { + if adjustPC { + if err = t.setPC(bp.Addr); err != nil { + return err + } } - t.CurrentBreakpoint.TotalHitCount++ } } + + t.CurrentBreakpoint.Breakpoint = bp return nil } @@ -148,9 +168,9 @@ func (t *nativeThread) ThreadID() int { return t.ID } -// ClearBreakpoint clears the specified breakpoint. -func (t *nativeThread) ClearBreakpoint(bp *proc.Breakpoint) error { - if _, err := t.WriteMemory(uintptr(bp.Addr), bp.OriginalData); err != nil { +// clearSoftwareBreakpoint clears the specified breakpoint. +func (t *nativeThread) clearSoftwareBreakpoint(bp *proc.Breakpoint) error { + if _, err := t.WriteMemory(bp.Addr, bp.OriginalData); err != nil { return fmt.Errorf("could not clear breakpoint %s", err) } return nil @@ -175,3 +195,8 @@ func (t *nativeThread) PC() (uint64, error) { } return regs.PC(), nil } + +// ProcessMemory returns this thread's process memory. +func (t *nativeThread) ProcessMemory() proc.MemoryReadWriter { + return t.dbp.Memory() +} diff --git a/pkg/proc/native/threads_darwin.go b/pkg/proc/native/threads_darwin.go index 1ce8902d2e..e1a827103c 100644 --- a/pkg/proc/native/threads_darwin.go +++ b/pkg/proc/native/threads_darwin.go @@ -1,4 +1,5 @@ -//+build darwin,macnative +//go:build darwin && macnative +// +build darwin,macnative package native @@ -13,6 +14,7 @@ import ( sys "golang.org/x/sys/unix" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" ) // waitStatus is a synonym for the platform-specific WaitStatus @@ -85,32 +87,13 @@ func (t *nativeThread) resume() error { return nil } -func (t *nativeThread) Blocked() bool { - // TODO(dp) cache the func pc to remove this lookup - regs, err := t.Registers() - if err != nil { - return false - } - pc := regs.PC() - fn := t.BinInfo().PCToFunc(pc) - if fn == nil { - return false - } - switch fn.Name { - case "runtime.kevent", "runtime.mach_semaphore_wait", "runtime.usleep", "runtime.mach_semaphore_timedwait": - return true - default: - return false - } -} - // Stopped returns whether the thread is stopped at // the operating system level. func (t *nativeThread) Stopped() bool { return C.thread_blocked(t.os.threadAct) > C.int(0) } -func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (int, error) { +func (t *nativeThread) WriteMemory(addr uint64, data []byte) (int, error) { if t.dbp.exited { return 0, proc.ErrProcessExited{Pid: t.dbp.pid} } @@ -128,7 +111,7 @@ func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (int, error) { return len(data), nil } -func (t *nativeThread) ReadMemory(buf []byte, addr uintptr) (int, error) { +func (t *nativeThread) ReadMemory(buf []byte, addr uint64) (int, error) { if t.dbp.exited { return 0, proc.ErrProcessExited{Pid: t.dbp.pid} } @@ -151,3 +134,7 @@ func (t *nativeThread) ReadMemory(buf []byte, addr uintptr) (int, error) { func (t *nativeThread) restoreRegisters(sr proc.Registers) error { return errors.New("not implemented") } + +func (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) error) error { + return proc.ErrHWBreakUnsupported +} diff --git a/pkg/proc/native/threads_freebsd.go b/pkg/proc/native/threads_freebsd.go index 2c569f6cbb..1d661ad3dd 100644 --- a/pkg/proc/native/threads_freebsd.go +++ b/pkg/proc/native/threads_freebsd.go @@ -11,6 +11,7 @@ import ( sys "golang.org/x/sys/unix" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" ) type waitStatus sys.WaitStatus @@ -75,17 +76,6 @@ func (t *nativeThread) singleStep() (err error) { return nil } -func (t *nativeThread) Blocked() bool { - loc, err := t.Location() - if err != nil { - return false - } - if loc.Fn != nil && ((loc.Fn.Name == "runtime.futex") || (loc.Fn.Name == "runtime.usleep") || (loc.Fn.Name == "runtime.clone")) { - return true - } - return false -} - func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error { sr := savedRegs.(*fbsdutil.AMD64Registers) @@ -110,24 +100,28 @@ func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error { return restoreRegistersErr } -func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (written int, err error) { +func (t *nativeThread) WriteMemory(addr uint64, data []byte) (written int, err error) { if t.dbp.exited { return 0, proc.ErrProcessExited{Pid: t.dbp.pid} } if len(data) == 0 { return 0, nil } - t.dbp.execPtraceFunc(func() { written, err = ptraceWriteData(t.ID, addr, data) }) + t.dbp.execPtraceFunc(func() { written, err = ptraceWriteData(t.ID, uintptr(addr), data) }) return written, err } -func (t *nativeThread) ReadMemory(data []byte, addr uintptr) (n int, err error) { +func (t *nativeThread) ReadMemory(data []byte, addr uint64) (n int, err error) { if t.dbp.exited { return 0, proc.ErrProcessExited{Pid: t.dbp.pid} } if len(data) == 0 { return 0, nil } - t.dbp.execPtraceFunc(func() { n, err = ptraceReadData(t.ID, addr, data) }) + t.dbp.execPtraceFunc(func() { n, err = ptraceReadData(t.ID, uintptr(addr), data) }) return n, err } + +func (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) error) error { + return proc.ErrHWBreakUnsupported +} diff --git a/pkg/proc/native/threads_linux.go b/pkg/proc/native/threads_linux.go index 5240babc93..4c8bd46a80 100644 --- a/pkg/proc/native/threads_linux.go +++ b/pkg/proc/native/threads_linux.go @@ -13,10 +13,10 @@ type waitStatus sys.WaitStatus // osSpecificDetails hold Linux specific // process details. type osSpecificDetails struct { - delayedSignal int - registers sys.PtraceRegs - running bool - setbp bool + delayedSignal int + running bool + setbp bool + phantomBreakpointPC uint64 } func (t *nativeThread) stop() (err error) { @@ -60,7 +60,45 @@ func (t *nativeThread) Blocked() bool { return false } -func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (written int, err error) { +// func (t *nativeThread) singleStep() (err error) { +// sig := 0 +// for { +// t.dbp.execPtraceFunc(func() { err = ptraceSingleStep(t.ID, sig) }) +// sig = 0 +// if err != nil { +// return err +// } +// wpid, status, err := t.dbp.waitFast(t.ID) +// if err != nil { +// return err +// } +// if (status == nil || status.Exited()) && wpid == t.dbp.pid { +// t.dbp.postExit() +// rs := 0 +// if status != nil { +// rs = status.ExitStatus() +// } +// return proc.ErrProcessExited{Pid: t.dbp.pid, Status: rs} +// } +// if wpid == t.ID { +// switch s := status.StopSignal(); s { +// case sys.SIGTRAP: +// return nil +// case sys.SIGSTOP: +// // delayed SIGSTOP, ignore it +// case sys.SIGILL, sys.SIGBUS, sys.SIGFPE, sys.SIGSEGV, sys.SIGSTKFLT: +// // propagate signals that can have been caused by the current instruction +// sig = int(s) +// default: +// // delay propagation of all other signals +// t.os.delayedSignal = int(s) +// } +// } +// } +// } + +// func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (written int, err error) { +func (t *nativeThread) WriteMemory(addr uint64, data []byte) (written int, err error) { if t.dbp.exited { return 0, proc.ErrProcessExited{Pid: t.dbp.pid} } @@ -70,24 +108,24 @@ func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (written int, err // ProcessVmWrite can't poke read-only memory like ptrace, so don't // even bother for small writes -- likely breakpoints and such. if len(data) > sys.SizeofPtr { - written, _ = processVmWrite(t.ID, addr, data) + written, _ = processVmWrite(t.ID, uintptr(addr), data) } if written == 0 { - t.dbp.execPtraceFunc(func() { written, err = sys.PtracePokeData(t.ID, addr, data) }) + t.dbp.execPtraceFunc(func() { written, err = sys.PtracePokeData(t.ID, uintptr(addr), data) }) } return } -func (t *nativeThread) ReadMemory(data []byte, addr uintptr) (n int, err error) { +func (t *nativeThread) ReadMemory(data []byte, addr uint64) (n int, err error) { if t.dbp.exited { return 0, proc.ErrProcessExited{Pid: t.dbp.pid} } if len(data) == 0 { return } - n, _ = processVmRead(t.ID, addr, data) + n, _ = processVmRead(t.ID, uintptr(addr), data) if n == 0 { - t.dbp.execPtraceFunc(func() { n, err = sys.PtracePeekData(t.ID, addr, data) }) + t.dbp.execPtraceFunc(func() { n, err = sys.PtracePeekData(t.ID, uintptr(addr), data) }) } return } diff --git a/pkg/proc/native/threads_linux_amd64.go b/pkg/proc/native/threads_linux_amd64.go index 049195adc7..95147e47b3 100644 --- a/pkg/proc/native/threads_linux_amd64.go +++ b/pkg/proc/native/threads_linux_amd64.go @@ -7,6 +7,7 @@ import ( sys "golang.org/x/sys/unix" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" "github.com/go-delve/delve/pkg/proc/linutil" ) @@ -38,10 +39,49 @@ func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error { } _, _, restoreRegistersErr = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_SETFPREGS, uintptr(t.ID), uintptr(0), uintptr(unsafe.Pointer(&sr.Fpregset.AMD64PtraceFpRegs)), 0, 0) - return }) if restoreRegistersErr == syscall.Errno(0) { restoreRegistersErr = nil } return restoreRegistersErr } + +const debugRegUserOffset = 848 // offset of debug registers in the user struct, see source/arch/x86/kernel/ptrace.c + +func (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) error) error { + var err error + t.dbp.execPtraceFunc(func() { + debugregs := make([]uint64, 8) + + for i := range debugregs { + if i == 4 || i == 5 { + continue + } + _, _, err = sys.Syscall6(sys.SYS_PTRACE, sys.PTRACE_PEEKUSR, uintptr(t.ID), uintptr(debugRegUserOffset+uintptr(i)*unsafe.Sizeof(debugregs[0])), uintptr(unsafe.Pointer(&debugregs[i])), 0, 0) + if err != nil && err != syscall.Errno(0) { + return + } + } + + drs := amd64util.NewDebugRegisters(&debugregs[0], &debugregs[1], &debugregs[2], &debugregs[3], &debugregs[6], &debugregs[7]) + + err = f(drs) + + if drs.Dirty { + for i := range debugregs { + if i == 4 || i == 5 { + // Linux will return EIO for DR4 and DR5 + continue + } + _, _, err = sys.Syscall6(sys.SYS_PTRACE, sys.PTRACE_POKEUSR, uintptr(t.ID), uintptr(debugRegUserOffset+uintptr(i)*unsafe.Sizeof(debugregs[0])), uintptr(debugregs[i]), 0, 0) + if err != nil && err != syscall.Errno(0) { + return + } + } + } + }) + if err == syscall.Errno(0) || err == sys.ESRCH { + err = nil + } + return err +} diff --git a/pkg/proc/native/threads_linux_arm64.go b/pkg/proc/native/threads_linux_arm64.go index f2f4d29084..ea0e7642d7 100644 --- a/pkg/proc/native/threads_linux_arm64.go +++ b/pkg/proc/native/threads_linux_arm64.go @@ -2,6 +2,7 @@ package native import ( "debug/elf" + "errors" "fmt" "syscall" "unsafe" @@ -42,3 +43,148 @@ func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error { } return restoreRegistersErr } + +const ( + _MAX_ARM64_WATCH = 16 + _NT_ARM_HW_WATCH = 0x403 + _TRAP_HWBKPT = 0x4 +) + +type watchpointState struct { + num uint8 + debugVer uint8 + words []uint64 +} + +func (wpstate *watchpointState) set(idx uint8, addr, ctrl uint64) { + wpstate.words[1+idx*2] = addr + wpstate.words[1+idx*2+1] = ctrl +} + +// getWatchpoints reads the NT_ARM_HW_WATCH ptrace register set. +// The format of this register set is described by user_hwdebug_state in +// arch/arm64/include/uapi/asm/ptrace.h. +// It consists of one 64bit word containing: +// * 1byte number of watchpoints +// * 1byte debug architecture version (the 4 least significant bits of ID_AA64DFR0_EL1) +// * 6bytes padding +// Followed by 2 64bit words for each watchpoint, up to a maximum of 16 +// watchpoints. The first word contains the address at which the watchpoint +// is set (DBGWVRn_EL1), the second word is the control register for the +// watchpoint (DBGWCRn_EL1), as described by +// ARM - Architecture Reference Manual Armv8, for A-profile architectures +// section D13.3.11 +// where only the BAS, LSC, PAC and E fields are accessible. +func (t *nativeThread) getWatchpoints() (*watchpointState, error) { + words := make([]uint64, _MAX_ARM64_WATCH*2+1) + iov := sys.Iovec{Base: (*byte)(unsafe.Pointer(&words[0])), Len: uint64(len(words)) * uint64(unsafe.Sizeof(words[0]))} + var err error + t.dbp.execPtraceFunc(func() { + _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETREGSET, uintptr(t.ID), _NT_ARM_HW_WATCH, uintptr(unsafe.Pointer(&iov)), 0, 0) + }) + if err != syscall.Errno(0) { + return nil, err + } + wpstate := &watchpointState{num: uint8(words[0] & 0xff), debugVer: uint8((words[0] >> 8) & 0xff), words: words} + if wpstate.num > _MAX_ARM64_WATCH { + // According to the specification this should never be more than 16 but + // the code here will not work if this limit ever gets relaxed. + wpstate.num = _MAX_ARM64_WATCH + } + // remove the watchpoint registers that don't exist from the words slice so + // that we won't try later to write them (which would cause an ENOSPC + // error). + wpstate.words = wpstate.words[:wpstate.num*2+1] + return wpstate, nil +} + +// setWatchpoints saves the watchpoint state of the given thread. +// See (*nativeThread).getWatchpoints for a description of how this works. +func (t *nativeThread) setWatchpoints(wpstate *watchpointState) error { + iov := sys.Iovec{Base: (*byte)(unsafe.Pointer(&(wpstate.words[0]))), Len: uint64(len(wpstate.words)) * uint64(unsafe.Sizeof(wpstate.words[0]))} + var err error + t.dbp.execPtraceFunc(func() { + _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_SETREGSET, uintptr(t.ID), _NT_ARM_HW_WATCH, uintptr(unsafe.Pointer(&iov)), 0, 0) + }) + if err != syscall.Errno(0) { + return err + } + return nil +} + +type ptraceSiginfoArm64 struct { + signo uint32 + errno uint32 + code uint32 + addr uint64 // only valid if Signo is SIGTRAP, SIGFPE, SIGILL, SIGBUS or SIGEMT + pad [128]byte // the total size of siginfo_t on ARM64 is 128 bytes so this is more than enough padding for all the fields we don't care about +} + +func (t *nativeThread) findHardwareBreakpoint() (*proc.Breakpoint, error) { + var siginfo ptraceSiginfoArm64 + var err error + t.dbp.execPtraceFunc(func() { + _, _, err = syscall.Syscall6(syscall.SYS_PTRACE, sys.PTRACE_GETSIGINFO, uintptr(t.ID), 0, uintptr(unsafe.Pointer(&siginfo)), 0, 0) + }) + if err != syscall.Errno(0) { + return nil, err + } + if siginfo.signo != uint32(sys.SIGTRAP) || (siginfo.code&0xffff) != _TRAP_HWBKPT { + return nil, nil + } + + for _, bp := range t.dbp.Breakpoints().M { + if bp.WatchType != 0 && siginfo.addr >= bp.Addr && siginfo.addr < bp.Addr+uint64(bp.WatchType.Size()) { + return bp, nil + } + } + + return nil, fmt.Errorf("could not find hardware breakpoint for address %#x", siginfo.addr) +} + +func (t *nativeThread) writeHardwareBreakpoint(addr uint64, wtype proc.WatchType, idx uint8) error { + wpstate, err := t.getWatchpoints() + if err != nil { + return err + } + if idx >= wpstate.num { + return errors.New("hardware breakpoints exhausted") + } + + const ( + readBreakpoint = 0x1 + writeBreakpoint = 0x2 + lenBitOffset = 5 + typeBitOffset = 3 + privBitOffset = 1 + ) + + var typ uint64 + if wtype.Read() { + typ |= readBreakpoint + } + if wtype.Write() { + typ |= writeBreakpoint + } + + len := uint64((1 << wtype.Size()) - 1) // arm wants the length expressed as address bitmask + + priv := uint64(3) + + ctrl := (len << lenBitOffset) | (typ << typeBitOffset) | (priv << privBitOffset) | 1 + wpstate.set(idx, addr, ctrl) + + return t.setWatchpoints(wpstate) +} + +func (t *nativeThread) clearHardwareBreakpoint(addr uint64, wtype proc.WatchType, idx uint8) error { + wpstate, err := t.getWatchpoints() + if err != nil { + return err + } + if idx >= wpstate.num { + return errors.New("hardware breakpoints exhausted") + } + wpstate.set(idx, 0, 0) + return t.setWatchpoints(wpstate) +} diff --git a/pkg/proc/native/threads_windows.go b/pkg/proc/native/threads_windows.go index fb42937793..64231349c7 100644 --- a/pkg/proc/native/threads_windows.go +++ b/pkg/proc/native/threads_windows.go @@ -7,16 +7,21 @@ import ( sys "golang.org/x/sys/windows" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/amd64util" "github.com/go-delve/delve/pkg/proc/winutil" ) +const enableHardwareBreakpoints = false // see https://github.com/go-delve/delve/issues/2768 + // waitStatus is a synonym for the platform-specific WaitStatus type waitStatus sys.WaitStatus // osSpecificDetails holds information specific to the Windows // operating system / kernel. type osSpecificDetails struct { - hThread syscall.Handle + hThread syscall.Handle + dbgUiRemoteBreakIn bool // whether thread is an auxiliary DbgUiRemoteBreakIn thread created by Windows + delayErr error } func (t *nativeThread) singleStep() error { @@ -77,9 +82,11 @@ func (t *nativeThread) singleStep() error { } for i := 0; i < suspendcnt; i++ { - _, err = _SuspendThread(t.os.hThread) - if err != nil { - return err + if !t.os.dbgUiRemoteBreakIn { + _, err = _SuspendThread(t.os.hThread) + if err != nil { + return err + } } } @@ -111,33 +118,13 @@ func (t *nativeThread) resume() error { return err } -func (t *nativeThread) Blocked() bool { - // TODO: Probably incorrect - what are the runtime functions that - // indicate blocking on Windows? - regs, err := t.Registers() - if err != nil { - return false - } - pc := regs.PC() - fn := t.BinInfo().PCToFunc(pc) - if fn == nil { - return false - } - switch fn.Name { - case "runtime.kevent", "runtime.usleep": - return true - default: - return false - } -} - // Stopped returns whether the thread is stopped at the operating system // level. On windows this always returns true. func (t *nativeThread) Stopped() bool { return true } -func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (int, error) { +func (t *nativeThread) WriteMemory(addr uint64, data []byte) (int, error) { if t.dbp.exited { return 0, proc.ErrProcessExited{Pid: t.dbp.pid} } @@ -145,7 +132,7 @@ func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (int, error) { return 0, nil } var count uintptr - err := _WriteProcessMemory(t.dbp.os.hProcess, addr, &data[0], uintptr(len(data)), &count) + err := _WriteProcessMemory(t.dbp.os.hProcess, uintptr(addr), &data[0], uintptr(len(data)), &count) if err != nil { return 0, err } @@ -154,7 +141,7 @@ func (t *nativeThread) WriteMemory(addr uintptr, data []byte) (int, error) { var ErrShortRead = errors.New("short read") -func (t *nativeThread) ReadMemory(buf []byte, addr uintptr) (int, error) { +func (t *nativeThread) ReadMemory(buf []byte, addr uint64) (int, error) { if t.dbp.exited { return 0, proc.ErrProcessExited{Pid: t.dbp.pid} } @@ -162,7 +149,7 @@ func (t *nativeThread) ReadMemory(buf []byte, addr uintptr) (int, error) { return 0, nil } var count uintptr - err := _ReadProcessMemory(t.dbp.os.hProcess, addr, &buf[0], uintptr(len(buf)), &count) + err := _ReadProcessMemory(t.dbp.os.hProcess, uintptr(addr), &buf[0], uintptr(len(buf)), &count) if err == nil && count != uintptr(len(buf)) { err = ErrShortRead } @@ -172,3 +159,30 @@ func (t *nativeThread) ReadMemory(buf []byte, addr uintptr) (int, error) { func (t *nativeThread) restoreRegisters(savedRegs proc.Registers) error { return _SetThreadContext(t.os.hThread, savedRegs.(*winutil.AMD64Registers).Context) } + +func (t *nativeThread) withDebugRegisters(f func(*amd64util.DebugRegisters) error) error { + if !enableHardwareBreakpoints { + return errors.New("hardware breakpoints not supported") + } + + context := winutil.NewCONTEXT() + context.ContextFlags = _CONTEXT_DEBUG_REGISTERS + + err := _GetThreadContext(t.os.hThread, context) + if err != nil { + return err + } + + drs := amd64util.NewDebugRegisters(&context.Dr0, &context.Dr1, &context.Dr2, &context.Dr3, &context.Dr6, &context.Dr7) + + err = f(drs) + if err != nil { + return err + } + + if drs.Dirty { + return _SetThreadContext(t.os.hThread, context) + } + + return nil +} diff --git a/pkg/proc/native/zsyscall_windows.go b/pkg/proc/native/zsyscall_windows.go index 753528b84e..9476c2e9d5 100644 --- a/pkg/proc/native/zsyscall_windows.go +++ b/pkg/proc/native/zsyscall_windows.go @@ -1,19 +1,47 @@ -// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT +// Code generated by 'go generate'; DO NOT EDIT. package native import ( "syscall" "unsafe" + + "golang.org/x/sys/windows" ) var _ unsafe.Pointer +// Do the interface allocations only once for common +// Errno values. +const ( + errnoERROR_IO_PENDING = 997 +) + var ( - modntdll = syscall.NewLazyDLL("ntdll.dll") - modkernel32 = syscall.NewLazyDLL("kernel32.dll") + errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e syscall.Errno) error { + switch e { + case 0: + return nil + case errnoERROR_IO_PENDING: + return errERROR_IO_PENDING + } + // TODO: add more here, after collecting data on the common + // error values see on Windows. (perhaps when running + // all.bat?) + return e +} + +var ( + modntdll = windows.NewLazySystemDLL("ntdll.dll") + modkernel32 = windows.NewLazySystemDLL("kernel32.dll") procNtQueryInformationThread = modntdll.NewProc("NtQueryInformationThread") + dbgUiRemoteBreakin = modntdll.NewProc("DbgUiRemoteBreakin") procGetThreadContext = modkernel32.NewProc("GetThreadContext") procSetThreadContext = modkernel32.NewProc("SetThreadContext") procSuspendThread = modkernel32.NewProc("SuspendThread") @@ -26,6 +54,8 @@ var ( procDebugActiveProcess = modkernel32.NewProc("DebugActiveProcess") procDebugActiveProcessStop = modkernel32.NewProc("DebugActiveProcessStop") procQueryFullProcessImageNameW = modkernel32.NewProc("QueryFullProcessImageNameW") + procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx") + procIsWow64Process = modkernel32.NewProc("IsWow64Process") ) func _NtQueryInformationThread(threadHandle syscall.Handle, infoclass int32, info uintptr, infolen uint32, retlen *uint32) (status _NTSTATUS) { @@ -38,7 +68,7 @@ func _GetThreadContext(thread syscall.Handle, context *_CONTEXT) (err error) { r1, _, e1 := syscall.Syscall(procGetThreadContext.Addr(), 2, uintptr(thread), uintptr(unsafe.Pointer(context)), 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -50,7 +80,7 @@ func _SetThreadContext(thread syscall.Handle, context *_CONTEXT) (err error) { r1, _, e1 := syscall.Syscall(procSetThreadContext.Addr(), 2, uintptr(thread), uintptr(unsafe.Pointer(context)), 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -63,7 +93,7 @@ func _SuspendThread(threadid syscall.Handle) (prevsuspcount uint32, err error) { prevsuspcount = uint32(r0) if prevsuspcount == 0xffffffff { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -76,7 +106,7 @@ func _ResumeThread(threadid syscall.Handle) (prevsuspcount uint32, err error) { prevsuspcount = uint32(r0) if prevsuspcount == 0xffffffff { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -88,7 +118,7 @@ func _ContinueDebugEvent(processid uint32, threadid uint32, continuestatus uint3 r1, _, e1 := syscall.Syscall(procContinueDebugEvent.Addr(), 3, uintptr(processid), uintptr(threadid), uintptr(continuestatus)) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -100,7 +130,7 @@ func _WriteProcessMemory(process syscall.Handle, baseaddr uintptr, buffer *byte, r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseaddr), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(byteswritten)), 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -112,7 +142,7 @@ func _ReadProcessMemory(process syscall.Handle, baseaddr uintptr, buffer *byte, r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseaddr), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(bytesread)), 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -124,7 +154,7 @@ func _DebugBreakProcess(process syscall.Handle) (err error) { r1, _, e1 := syscall.Syscall(procDebugBreakProcess.Addr(), 1, uintptr(process), 0, 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -136,7 +166,7 @@ func _WaitForDebugEvent(debugevent *_DEBUG_EVENT, milliseconds uint32) (err erro r1, _, e1 := syscall.Syscall(procWaitForDebugEvent.Addr(), 2, uintptr(unsafe.Pointer(debugevent)), uintptr(milliseconds), 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -148,7 +178,7 @@ func _DebugActiveProcess(processid uint32) (err error) { r1, _, e1 := syscall.Syscall(procDebugActiveProcess.Addr(), 1, uintptr(processid), 0, 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -160,7 +190,7 @@ func _DebugActiveProcessStop(processid uint32) (err error) { r1, _, e1 := syscall.Syscall(procDebugActiveProcessStop.Addr(), 1, uintptr(processid), 0, 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } @@ -172,10 +202,22 @@ func _QueryFullProcessImageName(process syscall.Handle, flags uint32, exename *u r1, _, e1 := syscall.Syscall6(procQueryFullProcessImageNameW.Addr(), 4, uintptr(process), uintptr(flags), uintptr(unsafe.Pointer(exename)), uintptr(unsafe.Pointer(size)), 0, 0) if r1 == 0 { if e1 != 0 { - err = error(e1) + err = errnoErr(e1) } else { err = syscall.EINVAL } } return } + +func _VirtualQueryEx(process syscall.Handle, addr uintptr, buffer *_MEMORY_BASIC_INFORMATION, length uintptr) (lengthOut uintptr) { + r0, _, _ := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(addr), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0) + lengthOut = uintptr(r0) + return +} + +func _IsWow64Process(process syscall.Handle, wow64process *uint32) (ok uint32) { + r0, _, _ := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(process), uintptr(unsafe.Pointer(wow64process)), 0) + ok = uint32(r0) + return +} diff --git a/pkg/proc/pe.go b/pkg/proc/pe.go index 21a9a27ad4..6295f8f89a 100644 --- a/pkg/proc/pe.go +++ b/pkg/proc/pe.go @@ -5,62 +5,62 @@ import ( ) const ( - IMAGE_FILE_MACHINE_UNKNOWN = 0x0 - IMAGE_FILE_MACHINE_AM33 = 0x1d3 - IMAGE_FILE_MACHINE_AMD64 = 0x8664 - IMAGE_FILE_MACHINE_ARM = 0x1c0 - IMAGE_FILE_MACHINE_ARMNT = 0x1c4 - IMAGE_FILE_MACHINE_ARM64 = 0xaa64 - IMAGE_FILE_MACHINE_EBC = 0xebc - IMAGE_FILE_MACHINE_I386 = 0x14c - IMAGE_FILE_MACHINE_IA64 = 0x200 - IMAGE_FILE_MACHINE_M32R = 0x9041 - IMAGE_FILE_MACHINE_MIPS16 = 0x266 - IMAGE_FILE_MACHINE_MIPSFPU = 0x366 - IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466 - IMAGE_FILE_MACHINE_POWERPC = 0x1f0 - IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1 - IMAGE_FILE_MACHINE_R4000 = 0x166 - IMAGE_FILE_MACHINE_SH3 = 0x1a2 - IMAGE_FILE_MACHINE_SH3DSP = 0x1a3 - IMAGE_FILE_MACHINE_SH4 = 0x1a6 - IMAGE_FILE_MACHINE_SH5 = 0x1a8 - IMAGE_FILE_MACHINE_THUMB = 0x1c2 - IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169 + _IMAGE_FILE_MACHINE_UNKNOWN = 0x0 + _IMAGE_FILE_MACHINE_AM33 = 0x1d3 + _IMAGE_FILE_MACHINE_AMD64 = 0x8664 + _IMAGE_FILE_MACHINE_ARM = 0x1c0 + _IMAGE_FILE_MACHINE_ARMNT = 0x1c4 + _IMAGE_FILE_MACHINE_ARM64 = 0xaa64 + _IMAGE_FILE_MACHINE_EBC = 0xebc + _IMAGE_FILE_MACHINE_I386 = 0x14c + _IMAGE_FILE_MACHINE_IA64 = 0x200 + _IMAGE_FILE_MACHINE_M32R = 0x9041 + _IMAGE_FILE_MACHINE_MIPS16 = 0x266 + _IMAGE_FILE_MACHINE_MIPSFPU = 0x366 + _IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466 + _IMAGE_FILE_MACHINE_POWERPC = 0x1f0 + _IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1 + _IMAGE_FILE_MACHINE_R4000 = 0x166 + _IMAGE_FILE_MACHINE_SH3 = 0x1a2 + _IMAGE_FILE_MACHINE_SH3DSP = 0x1a3 + _IMAGE_FILE_MACHINE_SH4 = 0x1a6 + _IMAGE_FILE_MACHINE_SH5 = 0x1a8 + _IMAGE_FILE_MACHINE_THUMB = 0x1c2 + _IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169 ) -type PEMachine uint16 +type _PEMachine uint16 // PEMachineString map pe machine to name, See $GOROOT/src/debug/pe/pe.go for detail -var PEMachineString = map[uint16]string{ - IMAGE_FILE_MACHINE_UNKNOWN: "unknown", - IMAGE_FILE_MACHINE_AM33: "am33", - IMAGE_FILE_MACHINE_AMD64: "amd64", - IMAGE_FILE_MACHINE_ARM: "arm", - IMAGE_FILE_MACHINE_ARMNT: "armnt", - IMAGE_FILE_MACHINE_ARM64: "arm64", - IMAGE_FILE_MACHINE_EBC: "ebc", - IMAGE_FILE_MACHINE_I386: "i386", - IMAGE_FILE_MACHINE_IA64: "ia64", - IMAGE_FILE_MACHINE_M32R: "m32r", - IMAGE_FILE_MACHINE_MIPS16: "mips16", - IMAGE_FILE_MACHINE_MIPSFPU: "mipsfpu", - IMAGE_FILE_MACHINE_MIPSFPU16: "mipsfpu16", - IMAGE_FILE_MACHINE_POWERPC: "powerpc", - IMAGE_FILE_MACHINE_POWERPCFP: "powerpcfp", - IMAGE_FILE_MACHINE_R4000: "r4000", - IMAGE_FILE_MACHINE_SH3: "sh3", - IMAGE_FILE_MACHINE_SH3DSP: "sh3dsp", - IMAGE_FILE_MACHINE_SH4: "sh4", - IMAGE_FILE_MACHINE_SH5: "sh5", - IMAGE_FILE_MACHINE_THUMB: "thumb", - IMAGE_FILE_MACHINE_WCEMIPSV2: "wcemipsv2", +var _PEMachineString = map[_PEMachine]string{ + _IMAGE_FILE_MACHINE_UNKNOWN: "unknown", + _IMAGE_FILE_MACHINE_AM33: "am33", + _IMAGE_FILE_MACHINE_AMD64: "amd64", + _IMAGE_FILE_MACHINE_ARM: "arm", + _IMAGE_FILE_MACHINE_ARMNT: "armnt", + _IMAGE_FILE_MACHINE_ARM64: "arm64", + _IMAGE_FILE_MACHINE_EBC: "ebc", + _IMAGE_FILE_MACHINE_I386: "i386", + _IMAGE_FILE_MACHINE_IA64: "ia64", + _IMAGE_FILE_MACHINE_M32R: "m32r", + _IMAGE_FILE_MACHINE_MIPS16: "mips16", + _IMAGE_FILE_MACHINE_MIPSFPU: "mipsfpu", + _IMAGE_FILE_MACHINE_MIPSFPU16: "mipsfpu16", + _IMAGE_FILE_MACHINE_POWERPC: "powerpc", + _IMAGE_FILE_MACHINE_POWERPCFP: "powerpcfp", + _IMAGE_FILE_MACHINE_R4000: "r4000", + _IMAGE_FILE_MACHINE_SH3: "sh3", + _IMAGE_FILE_MACHINE_SH3DSP: "sh3dsp", + _IMAGE_FILE_MACHINE_SH4: "sh4", + _IMAGE_FILE_MACHINE_SH5: "sh5", + _IMAGE_FILE_MACHINE_THUMB: "thumb", + _IMAGE_FILE_MACHINE_WCEMIPSV2: "wcemipsv2", } -func (m PEMachine) String() string { - str, ok := PEMachineString[uint16(m)] +func (m _PEMachine) String() string { + str, ok := _PEMachineString[m] if ok { return str } - return fmt.Sprintf("unkown image file machine code %d\n", uint16(m)) + return fmt.Sprintf("unknown image file machine code %d\n", uint16(m)) } diff --git a/pkg/proc/proc_general_test.go b/pkg/proc/proc_general_test.go index b23f8a8011..870efc8c08 100644 --- a/pkg/proc/proc_general_test.go +++ b/pkg/proc/proc_general_test.go @@ -1,6 +1,7 @@ package proc import ( + "os" "path/filepath" "runtime" "testing" @@ -24,7 +25,7 @@ func TestIssue554(t *testing.T) { case 8: addr = 0xffffffffffffffff } - if mem.contains(uintptr(addr), 40) { + if mem.contains(addr, 40) { t.Fatalf("should be false") } } @@ -41,7 +42,7 @@ type memRead struct { size int } -func (dm *dummyMem) ReadMemory(buf []byte, addr uintptr) (int, error) { +func (dm *dummyMem) ReadMemory(buf []byte, addr uint64) (int, error) { dm.t.Logf("read addr=%#x size=%#x\n", addr, len(buf)) dm.reads = append(dm.reads, memRead{uint64(addr), len(buf)}) a := int64(addr) - int64(dm.base) @@ -55,7 +56,7 @@ func (dm *dummyMem) ReadMemory(buf []byte, addr uintptr) (int, error) { return len(buf), nil } -func (dm *dummyMem) WriteMemory(uintptr, []byte) (int, error) { +func (dm *dummyMem) WriteMemory(uint64, []byte) (int, error) { panic("not supported") } @@ -80,7 +81,7 @@ func TestReadCStringValue(t *testing.T) { t.Logf("base is %#x\n", tc.base) dm.base = tc.base dm.reads = dm.reads[:0] - out, done, err := readCStringValue(dm, uintptr(tc.base), LoadConfig{MaxStringLen: maxstrlen}) + out, done, err := readCStringValue(dm, tc.base, LoadConfig{MaxStringLen: maxstrlen}) if err != nil { t.Errorf("base=%#x readCStringValue: %v", tc.base, err) } @@ -118,3 +119,50 @@ func TestDwarfVersion(t *testing.T) { } } } + +func TestRegabiFlagSentinel(t *testing.T) { + // Detect if the regabi flag in the producer string gets removed + if !protest.RegabiSupported() { + t.Skip("irrelevant before Go 1.17 or on non-amd64 architectures") + } + fixture := protest.BuildFixture("math", 0) + bi := NewBinaryInfo(runtime.GOOS, runtime.GOARCH) + assertNoError(bi.LoadBinaryInfo(fixture.Path, 0, nil), t, "LoadBinaryInfo") + if !bi.regabi { + t.Errorf("regabi flag not set %s GOEXPERIMENT=%s", runtime.Version(), os.Getenv("GOEXPERIMENT")) + } +} + +func TestGenericFunctionParser(t *testing.T) { + // Normal parsing + + var testCases = []struct{ name, pkg, rcv, base string }{ + {"github.com/go-delve/delve.afunc", "github.com/go-delve/delve", "", "afunc"}, + {"github.com/go-delve/delve..afunc", "github.com/go-delve/delve", "", "afunc"}, // malformed + {"github.com/go-delve/delve.afunc[some/[thing].el se]", "github.com/go-delve/delve", "", "afunc[some/[thing].el se]"}, + {"github.com/go-delve/delve.Receiver.afunc", "github.com/go-delve/delve", "Receiver", "afunc"}, + {"github.com/go-delve/delve.(*Receiver).afunc", "github.com/go-delve/delve", "(*Receiver)", "afunc"}, + {"github.com/go-delve/delve.Receiver.afunc[some/[thing].el se]", "github.com/go-delve/delve", "Receiver", "afunc[some/[thing].el se]"}, // malformed + {"github.com/go-delve/delve.(*Receiver).afunc[some/[thing].el se]", "github.com/go-delve/delve", "(*Receiver)", "afunc[some/[thing].el se]"}, // malformed + {"github.com/go-delve/delve.Receiver[some/[thing].el se].afunc", "github.com/go-delve/delve", "Receiver[some/[thing].el se]", "afunc"}, + {"github.com/go-delve/delve.(*Receiver[some/[thing].el se]).afunc", "github.com/go-delve/delve", "(*Receiver[some/[thing].el se])", "afunc"}, + + {"github.com/go-delve/delve.afunc[.some/[thing].el se]", "github.com/go-delve/delve", "", "afunc[.some/[thing].el se]"}, + {"github.com/go-delve/delve.Receiver.afunc[.some/[thing].el se]", "github.com/go-delve/delve", "Receiver", "afunc[.some/[thing].el se]"}, // malformed + {"github.com/go-delve/delve.Receiver[.some/[thing].el se].afunc", "github.com/go-delve/delve", "Receiver[.some/[thing].el se]", "afunc"}, + {"github.com/go-delve/delve.(*Receiver[.some/[thing].el se]).afunc", "github.com/go-delve/delve", "(*Receiver[.some/[thing].el se])", "afunc"}, + } + + for _, tc := range testCases { + fn := &Function{Name: tc.name} + if fn.PackageName() != tc.pkg { + t.Errorf("Package name mismatch: %q %q", tc.pkg, fn.PackageName()) + } + if fn.ReceiverName() != tc.rcv { + t.Errorf("Receiver name mismatch: %q %q", tc.rcv, fn.ReceiverName()) + } + if fn.BaseName() != tc.base { + t.Errorf("Base name mismatch: %q %q", tc.base, fn.BaseName()) + } + } +} diff --git a/pkg/proc/proc_linux_test.go b/pkg/proc/proc_linux_test.go index 4f8b9458f8..d10e17ff4c 100644 --- a/pkg/proc/proc_linux_test.go +++ b/pkg/proc/proc_linux_test.go @@ -14,7 +14,7 @@ func TestLoadingExternalDebugInfo(t *testing.T) { fixture := protest.BuildFixture("locationsprog", 0) defer os.Remove(fixture.Path) stripAndCopyDebugInfo(fixture, t) - p, err := native.Launch(append([]string{fixture.Path}, ""), "", false, []string{filepath.Dir(fixture.Path)}, "", [3]string{}) + p, err := native.Launch(append([]string{fixture.Path}, ""), "", 0, []string{filepath.Dir(fixture.Path)}, "", [3]string{}) if err != nil { t.Fatal(err) } diff --git a/pkg/proc/proc_test.go b/pkg/proc/proc_test.go index fedc1fa14a..798aefc5eb 100644 --- a/pkg/proc/proc_test.go +++ b/pkg/proc/proc_test.go @@ -2,6 +2,7 @@ package proc_test import ( "bytes" + "encoding/binary" "flag" "fmt" "go/ast" @@ -23,12 +24,16 @@ import ( "time" "github.com/go-delve/delve/pkg/dwarf/frame" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/dwarf/regnum" "github.com/go-delve/delve/pkg/goversion" "github.com/go-delve/delve/pkg/logflags" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/core" "github.com/go-delve/delve/pkg/proc/gdbserial" "github.com/go-delve/delve/pkg/proc/native" protest "github.com/go-delve/delve/pkg/proc/test" + "github.com/go-delve/delve/service/api" ) var normalLoadConfig = proc.LoadConfig{true, 1, 64, 64, -1, 0} @@ -54,6 +59,34 @@ func TestMain(m *testing.M) { os.Exit(protest.RunTestsWithFixtures(m)) } +func matchSkipConditions(conditions ...string) bool { + for _, cond := range conditions { + condfound := false + for _, s := range []string{runtime.GOOS, runtime.GOARCH, testBackend, buildMode} { + if s == cond { + condfound = true + break + } + } + if !condfound { + return false + } + } + return true +} + +func skipOn(t testing.TB, reason string, conditions ...string) { + if matchSkipConditions(conditions...) { + t.Skipf("skipped on %s: %s", strings.Join(conditions, "/"), reason) + } +} + +func skipUnlessOn(t testing.TB, reason string, conditions ...string) { + if !matchSkipConditions(conditions...) { + t.Skipf("skipped on %s: %s", strings.Join(conditions, "/"), reason) + } +} + func withTestProcess(name string, t testing.TB, fn func(p *proc.Target, fixture protest.Fixture)) { withTestProcessArgs(name, t, ".", []string{}, 0, fn) } @@ -69,9 +102,9 @@ func withTestProcessArgs(name string, t testing.TB, wd string, args []string, bu switch testBackend { case "native": - p, err = native.Launch(append([]string{fixture.Path}, args...), wd, false, []string{}, "", [3]string{}) + p, err = native.Launch(append([]string{fixture.Path}, args...), wd, 0, []string{}, "", [3]string{}) case "lldb": - p, err = gdbserial.LLDBLaunch(append([]string{fixture.Path}, args...), wd, false, []string{}, "", [3]string{}) + p, err = gdbserial.LLDBLaunch(append([]string{fixture.Path}, args...), wd, 0, []string{}, "", [3]string{}) case "rr": protest.MustHaveRecordingAllowed(t) t.Log("recording") @@ -102,7 +135,7 @@ func getRegisters(p *proc.Target, t *testing.T) proc.Registers { func dataAtAddr(thread proc.MemoryReadWriter, addr uint64) ([]byte, error) { data := make([]byte, 1) - _, err := thread.ReadMemory(data, uintptr(addr)) + _, err := thread.ReadMemory(data, addr) return data, err } @@ -286,8 +319,8 @@ func TestBreakpoint(t *testing.T) { assertNoError(err, t, "Registers") pc := regs.PC() - if bp.TotalHitCount != 1 { - t.Fatalf("Breakpoint should be hit once, got %d\n", bp.TotalHitCount) + if bp.UserBreaklet().TotalHitCount != 1 { + t.Fatalf("Breakpoint should be hit once, got %d\n", bp.UserBreaklet().TotalHitCount) } if pc-1 != bp.Addr && pc != bp.Addr { @@ -328,10 +361,10 @@ func TestClearBreakpointBreakpoint(t *testing.T) { withTestProcess("testprog", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFunctionBreakpoint(p, t, "main.sleepytime") - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint()") - data, err := dataAtAddr(p.CurrentThread(), bp.Addr) + data, err := dataAtAddr(p.Memory(), bp.Addr) assertNoError(err, t, "dataAtAddr") int3 := []byte{0xcc} @@ -352,7 +385,7 @@ type nextTest struct { func countBreakpoints(p *proc.Target) int { bpcount := 0 for _, bp := range p.Breakpoints().M { - if bp.LogicalID >= 0 { + if bp.LogicalID() >= 0 { bpcount++ } } @@ -391,7 +424,7 @@ func testseq(program string, contFunc contFunc, testcases []nextTest, initialLoc testseq2(t, program, initialLocation, seqTestcases) } -const traceTestseq2 = false +const traceTestseq2 = true func testseq2(t *testing.T, program string, initialLocation string, testcases []seqTest) { testseq2Args(".", []string{}, 0, t, program, initialLocation, testcases) @@ -441,7 +474,7 @@ func testseq2Args(wd string, args []string, buildFlags protest.BuildFlags, t *te if traceTestseq2 { t.Log("clearing initial breakpoint") } - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint() returned an error") } case contReverseNext: @@ -471,7 +504,7 @@ func testseq2Args(wd string, args []string, buildFlags protest.BuildFlags, t *te t.Log("continue") } assertNoError(p.Continue(), t, "Continue() returned an error") - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint() returned an error") } @@ -485,7 +518,7 @@ func testseq2Args(wd string, args []string, buildFlags protest.BuildFlags, t *te } switch pos := tc.pos.(type) { case int: - if ln != pos { + if pos >= 0 && ln != pos { t.Fatalf("Program did not continue to correct next location expected %d was %s:%d (%#x) (testcase %d)", pos, filepath.Base(f), ln, pc, i) } case string: @@ -551,9 +584,7 @@ func TestNextGeneral(t *testing.T) { } func TestNextConcurrent(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") testcases := []nextTest{ {8, 9}, {9, 10}, @@ -566,7 +597,7 @@ func TestNextConcurrent(t *testing.T) { f, ln := currentLineNumber(p, t) initV := evalVariable(p, t, "n") initVval, _ := constant.Int64Val(initV.Value) - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint()") for _, tc := range testcases { g, err := proc.GetG(p.CurrentThread()) @@ -589,9 +620,7 @@ func TestNextConcurrent(t *testing.T) { } func TestNextConcurrentVariant2(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") // Just like TestNextConcurrent but instead of removing the initial breakpoint we check that when it happens is for other goroutines testcases := []nextTest{ {8, 9}, @@ -804,11 +833,13 @@ func TestSwitchThread(t *testing.T) { func TestCGONext(t *testing.T) { // Test if one can do 'next' in a cgo binary // On OSX with Go < 1.5 CGO is not supported due to: https://github.com/golang/go/issues/8973 - if runtime.GOOS == "darwin" && strings.Contains(runtime.Version(), "1.4") { - return + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 5) { + skipOn(t, "upstream issue", "darwin") } protest.MustHaveCgo(t) + skipOn(t, "broken - cgo stacktraces", "darwin", "arm64") + protest.AllowRecording(t) withTestProcess("cgotest", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.main") @@ -915,6 +946,8 @@ func stackMatch(stack []loc, locations []proc.Stackframe, skipRuntime bool) bool } func TestStacktraceGoroutine(t *testing.T) { + skipOn(t, "broken - cgo stacktraces", "darwin", "arm64") + mainStack := []loc{{14, "main.stacktraceme"}, {29, "main.main"}} if goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) { mainStack[0].line = 15 @@ -925,17 +958,9 @@ func TestStacktraceGoroutine(t *testing.T) { {{10, "main.agoroutine"}}, } - tgtAgoroutineCount := 10 - - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { - // We try to make sure that all goroutines are stopped at a sensible place - // before reading their stacktrace, but due to the nature of the test - // program there is no guarantee that we always find them in a reasonable - // state. - // Asynchronous preemption in Go 1.14 exacerbates this problem, to avoid - // unnecessary flakiness reduce the target count to 9, allowing one - // goroutine to be in a bad state. - tgtAgoroutineCount = 9 + lenient := 0 + if runtime.GOOS == "windows" { + lenient = 1 } protest.AllowRecording(t) @@ -987,7 +1012,7 @@ func TestStacktraceGoroutine(t *testing.T) { t.Fatalf("Main goroutine stack not found %d", mainCount) } - if agoroutineCount < tgtAgoroutineCount { + if agoroutineCount < 10-lenient { t.Fatalf("Goroutine stacks not found (%d)", agoroutineCount) } @@ -997,10 +1022,7 @@ func TestStacktraceGoroutine(t *testing.T) { } func TestKill(t *testing.T) { - if testBackend == "lldb" { - // k command presumably works but leaves the process around? - return - } + skipOn(t, "N/A", "lldb") // k command presumably works but leaves the process around? withTestProcess("testprog", t, func(p *proc.Target, fixture protest.Fixture) { if err := p.Detach(true); err != nil { t.Fatal(err) @@ -1044,8 +1066,8 @@ func TestGetG(t *testing.T) { }) // On OSX with Go < 1.5 CGO is not supported due to: https://github.com/golang/go/issues/8973 - if runtime.GOOS == "darwin" && strings.Contains(runtime.Version(), "1.4") { - return + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 5) { + skipOn(t, "upstream issue", "darwin") } protest.MustHaveCgo(t) @@ -1070,11 +1092,11 @@ func TestContinueMulti(t *testing.T) { } assertNoError(err, t, "Continue()") - if bp := p.CurrentThread().Breakpoint(); bp.LogicalID == bp1.LogicalID { + if bp := p.CurrentThread().Breakpoint(); bp.LogicalID() == bp1.LogicalID() { mainCount++ } - if bp := p.CurrentThread().Breakpoint(); bp.LogicalID == bp2.LogicalID { + if bp := p.CurrentThread().Breakpoint(); bp.LogicalID() == bp2.LogicalID() { sayhiCount++ } } @@ -1133,16 +1155,16 @@ func evalVariableOrError(p *proc.Target, symbol string) (*proc.Variable, error) var frame proc.Stackframe frame, err = findFirstNonRuntimeFrame(p) if err == nil { - scope = proc.FrameToScope(p.BinInfo(), p.CurrentThread(), nil, frame) + scope = proc.FrameToScope(p, p.Memory(), nil, frame) } } else { - scope, err = proc.GoroutineScope(p.CurrentThread()) + scope, err = proc.GoroutineScope(p, p.CurrentThread()) } if err != nil { return nil, err } - return scope.EvalVariable(symbol, normalLoadConfig) + return scope.EvalExpression(symbol, normalLoadConfig) } func evalVariable(p *proc.Target, t testing.TB, symbol string) *proc.Variable { @@ -1156,7 +1178,7 @@ func evalVariable(p *proc.Target, t testing.TB, symbol string) *proc.Variable { } func setVariable(p *proc.Target, symbol, value string) error { - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) if err != nil { return err } @@ -1250,6 +1272,10 @@ func TestVariableEvaluation(t *testing.T) { func TestFrameEvaluation(t *testing.T) { protest.AllowRecording(t) + lenient := false + if runtime.GOOS == "windows" { + lenient = true + } withTestProcess("goroutinestackprog", t, func(p *proc.Target, fixture protest.Fixture) { setFunctionBreakpoint(p, t, "main.stacktraceme") assertNoError(p.Continue(), t, "Continue()") @@ -1262,13 +1288,13 @@ func TestFrameEvaluation(t *testing.T) { found := make([]bool, 10) for _, g := range gs { frame := -1 - frames, err := g.Stacktrace(10, 0) + frames, err := g.Stacktrace(40, 0) if err != nil { t.Logf("could not stacktrace goroutine %d: %v\n", g.ID, err) continue } t.Logf("Goroutine %d %#v", g.ID, g.Thread) - logStacktrace(t, p.BinInfo(), frames) + logStacktrace(t, p, frames) for i := range frames { if frames[i].Call.Fn != nil && frames[i].Call.Fn.Name == "main.agoroutine" { frame = i @@ -1284,7 +1310,7 @@ func TestFrameEvaluation(t *testing.T) { scope, err := proc.ConvertEvalScope(p, g.ID, frame, 0) assertNoError(err, t, "ConvertEvalScope()") t.Logf("scope = %v", scope) - v, err := scope.EvalVariable("i", normalLoadConfig) + v, err := scope.EvalExpression("i", normalLoadConfig) t.Logf("v = %v", v) if err != nil { t.Logf("Goroutine %d: %v\n", g.ID, err) @@ -1294,20 +1320,10 @@ func TestFrameEvaluation(t *testing.T) { found[vval] = true } - firsterr := false - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { - // We try to make sure that all goroutines are stopped at a sensible place - // before reading their stacktrace, but due to the nature of the test - // program there is no guarantee that we always find them in a reasonable - // state. - // Asynchronous preemption in Go 1.14 exacerbates this problem, to avoid - // unnecessary flakiness allow a single goroutine to be in a bad state. - firsterr = true - } for i := range found { if !found[i] { - if firsterr { - firsterr = false + if lenient { + lenient = false } else { t.Fatalf("Goroutine %d not found\n", i) } @@ -1319,10 +1335,14 @@ func TestFrameEvaluation(t *testing.T) { g, err := proc.GetG(p.CurrentThread()) assertNoError(err, t, "GetG()") + frames, err := g.Stacktrace(40, 0) + t.Logf("Goroutine %d %#v", g.ID, g.Thread) + logStacktrace(t, p, frames) + for i := 0; i <= 3; i++ { scope, err := proc.ConvertEvalScope(p, g.ID, i+1, 0) assertNoError(err, t, fmt.Sprintf("ConvertEvalScope() on frame %d", i+1)) - v, err := scope.EvalVariable("n", normalLoadConfig) + v, err := scope.EvalExpression("n", normalLoadConfig) assertNoError(err, t, fmt.Sprintf("EvalVariable() on frame %d", i+1)) n, _ := constant.Int64Val(v.Value) t.Logf("frame %d n %d\n", i+1, n) @@ -1333,6 +1353,29 @@ func TestFrameEvaluation(t *testing.T) { }) } +func TestThreadFrameEvaluation(t *testing.T) { + skipOn(t, "upstream issue - https://github.com/golang/go/issues/29322", "pie") + deadlockBp := proc.FatalThrow + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) { + t.SkipNow() + } + withTestProcess("testdeadlock", t, func(p *proc.Target, fixture protest.Fixture) { + assertNoError(p.Continue(), t, "Continue()") + + bp := p.CurrentThread().Breakpoint() + if bp.Breakpoint == nil || bp.Name != deadlockBp { + t.Fatalf("did not stop at deadlock breakpoint %v", bp) + } + + // There is no selected goroutine during a deadlock, so the scope will + // be a thread scope. + scope, err := proc.ConvertEvalScope(p, 0, 0, 0) + assertNoError(err, t, "ConvertEvalScope() on frame 0") + _, err = scope.EvalExpression("s", normalLoadConfig) + assertNoError(err, t, "EvalVariable(\"s\") on frame 0") + }) +} + func TestPointerSetting(t *testing.T) { withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue() returned an error") @@ -1348,7 +1391,7 @@ func TestPointerSetting(t *testing.T) { pval(1) // change p1 to point to i2 - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "Scope()") i2addr, err := scope.EvalExpression("i2", normalLoadConfig) assertNoError(err, t, "EvalExpression()") @@ -1414,9 +1457,7 @@ func TestIssue325(t *testing.T) { } func TestBreakpointCounts(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") protest.AllowRecording(t) withTestProcess("bpcountstest", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 12) @@ -1430,18 +1471,18 @@ func TestBreakpointCounts(t *testing.T) { } } - t.Logf("TotalHitCount: %d", bp.TotalHitCount) - if bp.TotalHitCount != 200 { - t.Fatalf("Wrong TotalHitCount for the breakpoint (%d)", bp.TotalHitCount) + t.Logf("TotalHitCount: %d", bp.UserBreaklet().TotalHitCount) + if bp.UserBreaklet().TotalHitCount != 200 { + t.Fatalf("Wrong TotalHitCount for the breakpoint (%d)", bp.UserBreaklet().TotalHitCount) } - if len(bp.HitCount) != 2 { - t.Fatalf("Wrong number of goroutines for breakpoint (%d)", len(bp.HitCount)) + if len(bp.UserBreaklet().HitCount) != 2 { + t.Fatalf("Wrong number of goroutines for breakpoint (%d)", len(bp.UserBreaklet().HitCount)) } - for _, v := range bp.HitCount { + for _, v := range bp.UserBreaklet().HitCount { if v != 100 { - t.Fatalf("Wrong HitCount for breakpoint (%v)", bp.HitCount) + t.Fatalf("Wrong HitCount for breakpoint (%v)", bp.UserBreaklet().HitCount) } } }) @@ -1481,12 +1522,12 @@ func TestBreakpointCountsWithDetection(t *testing.T) { if bp := th.Breakpoint(); bp.Breakpoint == nil { continue } - scope, err := proc.GoroutineScope(th) + scope, err := proc.GoroutineScope(p, th) assertNoError(err, t, "Scope()") - v, err := scope.EvalVariable("i", normalLoadConfig) + v, err := scope.EvalExpression("i", normalLoadConfig) assertNoError(err, t, "evalVariable") i, _ := constant.Int64Val(v.Value) - v, err = scope.EvalVariable("id", normalLoadConfig) + v, err = scope.EvalExpression("id", normalLoadConfig) assertNoError(err, t, "evalVariable") id, _ := constant.Int64Val(v.Value) m[id] = i @@ -1497,23 +1538,23 @@ func TestBreakpointCountsWithDetection(t *testing.T) { total += m[i] + 1 } - if uint64(total) != bp.TotalHitCount { - t.Fatalf("Mismatched total count %d %d\n", total, bp.TotalHitCount) + if uint64(total) != bp.UserBreaklet().TotalHitCount { + t.Fatalf("Mismatched total count %d %d\n", total, bp.UserBreaklet().TotalHitCount) } } - t.Logf("TotalHitCount: %d", bp.TotalHitCount) - if bp.TotalHitCount != 200 { - t.Fatalf("Wrong TotalHitCount for the breakpoint (%d)", bp.TotalHitCount) + t.Logf("TotalHitCount: %d", bp.UserBreaklet().TotalHitCount) + if bp.UserBreaklet().TotalHitCount != 200 { + t.Fatalf("Wrong TotalHitCount for the breakpoint (%d)", bp.UserBreaklet().TotalHitCount) } - if len(bp.HitCount) != 2 { - t.Fatalf("Wrong number of goroutines for breakpoint (%d)", len(bp.HitCount)) + if len(bp.UserBreaklet().HitCount) != 2 { + t.Fatalf("Wrong number of goroutines for breakpoint (%d)", len(bp.UserBreaklet().HitCount)) } - for _, v := range bp.HitCount { + for _, v := range bp.UserBreaklet().HitCount { if v != 100 { - t.Fatalf("Wrong HitCount for breakpoint (%v)", bp.HitCount) + t.Fatalf("Wrong HitCount for breakpoint (%v)", bp.UserBreaklet().HitCount) } } }) @@ -1551,7 +1592,7 @@ func BenchmarkGoroutinesInfo(b *testing.B) { assertNoError(p.Continue(), b, "Continue()") b.ResetTimer() for i := 0; i < b.N; i++ { - p.ClearAllGCache() + p.ClearCaches() _, _, err := proc.GoroutinesInfo(p, 0, 0) assertNoError(err, b, "GoroutinesInfo") } @@ -1611,7 +1652,7 @@ func TestPointerLoops(t *testing.T) { func BenchmarkLocalVariables(b *testing.B) { withTestProcess("testvariables", b, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), b, "Continue() returned an error") - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, b, "Scope()") b.ResetTimer() for i := 0; i < b.N; i++ { @@ -1622,13 +1663,11 @@ func BenchmarkLocalVariables(b *testing.B) { } func TestCondBreakpoint(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") protest.AllowRecording(t) withTestProcess("parallel_next", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 9) - bp.Cond = &ast.BinaryExpr{ + bp.UserBreaklet().Cond = &ast.BinaryExpr{ Op: token.EQL, X: &ast.Ident{Name: "n"}, Y: &ast.BasicLit{Kind: token.INT, Value: "7"}, @@ -1640,19 +1679,17 @@ func TestCondBreakpoint(t *testing.T) { n, _ := constant.Int64Val(nvar.Value) if n != 7 { - t.Fatalf("Stoppend on wrong goroutine %d\n", n) + t.Fatalf("Stopped on wrong goroutine %d\n", n) } }) } func TestCondBreakpointError(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") protest.AllowRecording(t) withTestProcess("parallel_next", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 9) - bp.Cond = &ast.BinaryExpr{ + bp.UserBreaklet().Cond = &ast.BinaryExpr{ Op: token.EQL, X: &ast.Ident{Name: "nonexistentvariable"}, Y: &ast.BasicLit{Kind: token.INT, Value: "7"}, @@ -1667,7 +1704,7 @@ func TestCondBreakpointError(t *testing.T) { t.Fatalf("Unexpected error on first Continue(): %v", err) } - bp.Cond = &ast.BinaryExpr{ + bp.UserBreaklet().Cond = &ast.BinaryExpr{ Op: token.EQL, X: &ast.Ident{Name: "n"}, Y: &ast.BasicLit{Kind: token.INT, Value: "7"}, @@ -1683,9 +1720,81 @@ func TestCondBreakpointError(t *testing.T) { n, _ := constant.Int64Val(nvar.Value) if n != 7 { - t.Fatalf("Stoppend on wrong goroutine %d\n", n) + t.Fatalf("Stopped on wrong goroutine %d\n", n) + } + } + }) +} + +func TestHitCondBreakpointEQ(t *testing.T) { + withTestProcess("break", t, func(p *proc.Target, fixture protest.Fixture) { + bp := setFileBreakpoint(p, t, fixture.Source, 7) + bp.UserBreaklet().HitCond = &struct { + Op token.Token + Val int + }{token.EQL, 3} + + assertNoError(p.Continue(), t, "Continue()") + ivar := evalVariable(p, t, "i") + + i, _ := constant.Int64Val(ivar.Value) + if i != 3 { + t.Fatalf("Stopped on wrong hitcount %d\n", i) + } + + err := p.Continue() + if _, exited := err.(proc.ErrProcessExited); !exited { + t.Fatalf("Unexpected error on Continue(): %v", err) + } + }) +} + +func TestHitCondBreakpointGEQ(t *testing.T) { + protest.AllowRecording(t) + withTestProcess("break", t, func(p *proc.Target, fixture protest.Fixture) { + bp := setFileBreakpoint(p, t, fixture.Source, 7) + bp.UserBreaklet().HitCond = &struct { + Op token.Token + Val int + }{token.GEQ, 3} + + for it := 3; it <= 10; it++ { + assertNoError(p.Continue(), t, "Continue()") + ivar := evalVariable(p, t, "i") + + i, _ := constant.Int64Val(ivar.Value) + if int(i) != it { + t.Fatalf("Stopped on wrong hitcount %d\n", i) + } + } + + assertNoError(p.Continue(), t, "Continue()") + }) +} + +func TestHitCondBreakpointREM(t *testing.T) { + protest.AllowRecording(t) + withTestProcess("break", t, func(p *proc.Target, fixture protest.Fixture) { + bp := setFileBreakpoint(p, t, fixture.Source, 7) + bp.UserBreaklet().HitCond = &struct { + Op token.Token + Val int + }{token.REM, 2} + + for it := 2; it <= 10; it += 2 { + assertNoError(p.Continue(), t, "Continue()") + ivar := evalVariable(p, t, "i") + + i, _ := constant.Int64Val(ivar.Value) + if int(i) != it { + t.Fatalf("Stopped on wrong hitcount %d\n", i) } } + + err := p.Continue() + if _, exited := err.(proc.ErrProcessExited); !exited { + t.Fatalf("Unexpected error on Continue(): %v", err) + } }) } @@ -1724,24 +1833,6 @@ func TestStepIntoFunction(t *testing.T) { }) } -func TestIssue384(t *testing.T) { - // Crash related to reading uninitialized memory, introduced by the memory prefetching optimization - - ver, _ := goversion.Parse(runtime.Version()) - if ver.Major < 0 || ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 10, Rev: -1}) { - // go 1.10 emits DW_AT_decl_line and we won't be able to evaluate 'st' - // which is declared after line 13. - t.Skip("can not evaluate not-yet-declared variables with go 1.10") - } - - protest.AllowRecording(t) - withTestProcess("issue384", t, func(p *proc.Target, fixture protest.Fixture) { - setFileBreakpoint(p, t, fixture.Source, 13) - assertNoError(p.Continue(), t, "Continue()") - evalVariable(p, t, "st") - }) -} - func TestIssue332_Part1(t *testing.T) { // Next shouldn't step inside a function call protest.AllowRecording(t) @@ -1807,21 +1898,8 @@ func TestIssue332_Part2(t *testing.T) { }) } -func TestIssue396(t *testing.T) { - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 13) { - // CL 161337 in Go 1.13 and later removes the autogenerated init function - // https://go-review.googlesource.com/c/go/+/161337 - t.Skip("no autogenerated init function in Go 1.13 or later") - } - withTestProcess("callme", t, func(p *proc.Target, fixture protest.Fixture) { - findFunctionLocation(p, t, "main.init") - }) -} - func TestIssue414(t *testing.T) { - if runtime.GOOS == "linux" && runtime.GOARCH == "386" && buildMode == "pie" { - t.Skip("test occasionally hangs on linux/386/pie") - } + skipOn(t, "broken", "linux", "386", "pie") // test occasionally hangs on linux/386/pie // Stepping until the program exits protest.AllowRecording(t) withTestProcess("math", t, func(p *proc.Target, fixture protest.Fixture) { @@ -1863,7 +1941,7 @@ func TestPackageVariables(t *testing.T) { withTestProcess("testvariables", t, func(p *proc.Target, fixture protest.Fixture) { err := p.Continue() assertNoError(err, t, "Continue()") - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "Scope()") vars, err := scope.PackageVariables(normalLoadConfig) assertNoError(err, t, "PackageVariables()") @@ -1946,10 +2024,7 @@ func TestCmdLineArgs(t *testing.T) { } func TestIssue462(t *testing.T) { - // Stacktrace of Goroutine 0 fails with an error - if runtime.GOOS == "windows" { - return - } + skipOn(t, "broken", "windows") // Stacktrace of Goroutine 0 fails with an error withTestProcess("testnextnethttp", t, func(p *proc.Target, fixture protest.Fixture) { go func() { // Wait for program to start listening. @@ -1972,9 +2047,7 @@ func TestIssue462(t *testing.T) { } func TestNextParked(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") protest.AllowRecording(t) withTestProcess("parallel_next", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFunctionBreakpoint(p, t, "main.sayhi") @@ -2025,9 +2098,7 @@ func TestNextParked(t *testing.T) { } func TestStepParked(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") protest.AllowRecording(t) withTestProcess("parallel_next", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFunctionBreakpoint(p, t, "main.sayhi") @@ -2102,9 +2173,9 @@ func TestUnsupportedArch(t *testing.T) { switch testBackend { case "native": - p, err = native.Launch([]string{outfile}, ".", false, []string{}, "", [3]string{}) + p, err = native.Launch([]string{outfile}, ".", 0, []string{}, "", [3]string{}) case "lldb": - p, err = gdbserial.LLDBLaunch([]string{outfile}, ".", false, []string{}, "", [3]string{}) + p, err = gdbserial.LLDBLaunch([]string{outfile}, ".", 0, []string{}, "", [3]string{}) default: t.Skip("test not valid for this backend") } @@ -2185,7 +2256,7 @@ func TestStepCall(t *testing.T) { func TestStepCallPtr(t *testing.T) { // Tests that Step works correctly when calling functions with a // function pointer. - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) { + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) && !protest.RegabiSupported() { testseq("teststepprog", contStep, []nextTest{ {9, 10}, {10, 6}, @@ -2275,6 +2346,19 @@ func TestStepIgnorePrivateRuntime(t *testing.T) { // Tests that Step will ignore calls to private runtime functions // (such as runtime.convT2E in this case) switch { + case goversion.VersionAfterOrEqual(runtime.Version(), 1, 17) && protest.RegabiSupported(): + testseq("teststepprog", contStep, []nextTest{ + {21, 13}, + {13, 14}, + {14, 15}, + {15, 17}, + {17, 22}}, "", t) + case goversion.VersionAfterOrEqual(runtime.Version(), 1, 17): + testseq("teststepprog", contStep, []nextTest{ + {21, 14}, + {14, 15}, + {15, 17}, + {17, 22}}, "", t) case goversion.VersionAfterOrEqual(runtime.Version(), 1, 11): testseq("teststepprog", contStep, []nextTest{ {21, 14}, @@ -2343,20 +2427,18 @@ func TestStepOut(t *testing.T) { } func TestStepConcurrentDirect(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") protest.AllowRecording(t) withTestProcess("teststepconcurrent", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 37) assertNoError(p.Continue(), t, "Continue()") - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint()") for _, b := range p.Breakpoints().M { if b.Name == proc.UnrecoveredPanic { - _, err := p.ClearBreakpoint(b.Addr) + err := p.ClearBreakpoint(b.Addr) assertNoError(err, t, "ClearBreakpoint(unrecovered-panic)") break } @@ -2409,16 +2491,14 @@ func TestStepConcurrentDirect(t *testing.T) { } func TestStepConcurrentPtr(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } + skipOn(t, "broken", "freebsd") protest.AllowRecording(t) withTestProcess("teststepconcurrent", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 24) for _, b := range p.Breakpoints().M { if b.Name == proc.UnrecoveredPanic { - _, err := p.ClearBreakpoint(b.Addr) + err := p.ClearBreakpoint(b.Addr) assertNoError(err, t, "ClearBreakpoint(unrecovered-panic)") break } @@ -2456,7 +2536,7 @@ func TestStepConcurrentPtr(t *testing.T) { kvals[gid] = k assertNoError(p.Step(), t, "Step()") - for p.Breakpoints().HasInternalBreakpoints() { + for p.Breakpoints().HasSteppingBreakpoints() { if p.SelectedGoroutine().ID == gid { t.Fatalf("step did not step into function call (but internal breakpoints still active?) (%d %d)", gid, p.SelectedGoroutine().ID) } @@ -2483,6 +2563,66 @@ func TestStepConcurrentPtr(t *testing.T) { }) } +func TestStepOutBreakpoint(t *testing.T) { + protest.AllowRecording(t) + withTestProcess("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) { + bp := setFileBreakpoint(p, t, fixture.Source, 13) + assertNoError(p.Continue(), t, "Continue()") + p.ClearBreakpoint(bp.Addr) + + // StepOut should be interrupted by a breakpoint on the same goroutine. + setFileBreakpoint(p, t, fixture.Source, 14) + assertNoError(p.StepOut(), t, "StepOut()") + assertLineNumber(p, t, 14, "wrong line number") + if p.Breakpoints().HasSteppingBreakpoints() { + t.Fatal("has internal breakpoints after hitting breakpoint on same goroutine") + } + }) +} + +func TestNextBreakpoint(t *testing.T) { + protest.AllowRecording(t) + withTestProcess("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) { + bp := setFileBreakpoint(p, t, fixture.Source, 34) + assertNoError(p.Continue(), t, "Continue()") + p.ClearBreakpoint(bp.Addr) + + // Next should be interrupted by a breakpoint on the same goroutine. + setFileBreakpoint(p, t, fixture.Source, 14) + assertNoError(p.Next(), t, "Next()") + assertLineNumber(p, t, 14, "wrong line number") + if p.Breakpoints().HasSteppingBreakpoints() { + t.Fatal("has internal breakpoints after hitting breakpoint on same goroutine") + } + }) +} + +func TestNextBreakpointKeepsSteppingBreakpoints(t *testing.T) { + protest.AllowRecording(t) + withTestProcess("testnextprog", t, func(p *proc.Target, fixture protest.Fixture) { + p.KeepSteppingBreakpoints = proc.TracepointKeepsSteppingBreakpoints + bp := setFileBreakpoint(p, t, fixture.Source, 34) + assertNoError(p.Continue(), t, "Continue()") + p.ClearBreakpoint(bp.Addr) + + // Next should be interrupted by a tracepoint on the same goroutine. + bp = setFileBreakpoint(p, t, fixture.Source, 14) + bp.Tracepoint = true + assertNoError(p.Next(), t, "Next()") + assertLineNumber(p, t, 14, "wrong line number") + if !p.Breakpoints().HasSteppingBreakpoints() { + t.Fatal("does not have internal breakpoints after hitting tracepoint on same goroutine") + } + + // Continue to complete next. + assertNoError(p.Continue(), t, "Continue()") + assertLineNumber(p, t, 35, "wrong line number") + if p.Breakpoints().HasSteppingBreakpoints() { + t.Fatal("has internal breakpoints after completing next") + } + }) +} + func TestStepOutDefer(t *testing.T) { protest.AllowRecording(t) withTestProcess("testnextdefer", t, func(p *proc.Target, fixture protest.Fixture) { @@ -2510,8 +2650,6 @@ func TestStepOutDeferReturnAndDirectCall(t *testing.T) { {contStepout, 28}}) } -var maxInstructionLength uint64 - func TestStepOnCallPtrInstr(t *testing.T) { protest.AllowRecording(t) withTestProcess("teststepprog", t, func(p *proc.Target, fixture protest.Fixture) { @@ -2529,7 +2667,7 @@ func TestStepOnCallPtrInstr(t *testing.T) { regs, err := p.CurrentThread().Registers() assertNoError(err, t, "Registers()") pc := regs.PC() - text, err := proc.Disassemble(p.CurrentThread(), regs, p.Breakpoints(), p.BinInfo(), pc, pc+uint64(p.BinInfo().Arch.MaxInstructionLength())) + text, err := proc.Disassemble(p.Memory(), regs, p.Breakpoints(), p.BinInfo(), pc, pc+uint64(p.BinInfo().Arch.MaxInstructionLength())) assertNoError(err, t, "Disassemble()") if text[0].IsCall() { found = true @@ -2544,7 +2682,7 @@ func TestStepOnCallPtrInstr(t *testing.T) { assertNoError(p.Step(), t, "Step()") - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) { + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) && !protest.RegabiSupported() { assertLineNumber(p, t, 6, "Step continued to wrong line,") } else { assertLineNumber(p, t, 5, "Step continued to wrong line,") @@ -2553,14 +2691,13 @@ func TestStepOnCallPtrInstr(t *testing.T) { } func TestIssue594(t *testing.T) { - if runtime.GOOS == "darwin" && testBackend == "lldb" { - // debugserver will receive an EXC_BAD_ACCESS for this, at that point - // there is no way to reconvert this exception into a unix signal and send - // it to the process. - // This is a bug in debugserver/lldb: - // https://bugs.llvm.org//show_bug.cgi?id=22868 - return - } + skipOn(t, "upstream issue", "darwin", "lldb") + // debugserver will receive an EXC_BAD_ACCESS for this, at that point + // there is no way to reconvert this exception into a unix signal and send + // it to the process. + // This is a bug in debugserver/lldb: + // https://bugs.llvm.org//show_bug.cgi?id=22868 + // Exceptions that aren't caused by breakpoints should be propagated // back to the target. // In particular the target should be able to cause a nil pointer @@ -2675,7 +2812,7 @@ func BenchmarkTrace(b *testing.B) { b.ResetTimer() for i := 0; i < b.N; i++ { assertNoError(p.Continue(), b, "Continue()") - s, err := proc.GoroutineScope(p.CurrentThread()) + s, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, b, "Scope()") _, err = s.FunctionArguments(proc.LoadConfig{false, 0, 64, 0, 3, 0}) assertNoError(err, b, "FunctionArguments()") @@ -2719,104 +2856,6 @@ func getg(goid int, gs []*proc.G) *proc.G { return nil } -func TestStacktraceWithBarriers(t *testing.T) { - // Go's Garbage Collector will insert stack barriers into stacks. - // This stack barrier is inserted by overwriting the return address for the - // stack frame with the address of runtime.stackBarrier. - // The original return address is saved into the stkbar slice inside the G - // struct. - - // In Go 1.9 stack barriers have been removed and this test must be disabled. - if ver, _ := goversion.Parse(runtime.Version()); ver.Major < 0 || ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 9, Rev: -1}) { - return - } - - // In Go 1.8 stack barriers are not inserted by default, this enables them. - godebugOld := os.Getenv("GODEBUG") - defer os.Setenv("GODEBUG", godebugOld) - os.Setenv("GODEBUG", "gcrescanstacks=1") - - withTestProcess("binarytrees", t, func(p *proc.Target, fixture protest.Fixture) { - // We want to get a user goroutine with a stack barrier, to get that we execute the program until runtime.gcInstallStackBarrier is executed AND the goroutine it was executed onto contains a call to main.bottomUpTree - setFunctionBreakpoint(p, t, "runtime.gcInstallStackBarrier") - stackBarrierGoids := []int{} - for len(stackBarrierGoids) == 0 { - err := p.Continue() - if _, exited := err.(proc.ErrProcessExited); exited { - t.Logf("Could not run test") - return - } - assertNoError(err, t, "Continue()") - gs, _, err := proc.GoroutinesInfo(p, 0, 0) - assertNoError(err, t, "GoroutinesInfo()") - for _, th := range p.ThreadList() { - if bp := th.Breakpoint(); bp.Breakpoint == nil { - continue - } - - goidVar := evalVariable(p, t, "gp.goid") - goid, _ := constant.Int64Val(goidVar.Value) - - if g := getg(int(goid), gs); g != nil { - stack, err := g.Stacktrace(50, 0) - assertNoError(err, t, fmt.Sprintf("Stacktrace(goroutine = %d)", goid)) - for _, frame := range stack { - if frame.Current.Fn != nil && frame.Current.Fn.Name == "main.bottomUpTree" { - stackBarrierGoids = append(stackBarrierGoids, int(goid)) - break - } - } - } - } - } - - if len(stackBarrierGoids) == 0 { - t.Fatalf("Could not find a goroutine with stack barriers") - } - - t.Logf("stack barrier goids: %v\n", stackBarrierGoids) - - assertNoError(p.StepOut(), t, "StepOut()") - - gs, _, err := proc.GoroutinesInfo(p, 0, 0) - assertNoError(err, t, "GoroutinesInfo()") - - for _, goid := range stackBarrierGoids { - g := getg(goid, gs) - - stack, err := g.Stacktrace(200, 0) - assertNoError(err, t, "Stacktrace()") - - // Check that either main.main or main.main.func1 appear in the - // stacktrace of this goroutine, if we failed at resolving stack barriers - // correctly the stacktrace will be truncated and neither main.main or - // main.main.func1 will appear - found := false - for _, frame := range stack { - if frame.Current.Fn == nil { - continue - } - if name := frame.Current.Fn.Name; name == "main.main" || name == "main.main.func1" { - found = true - } - } - - t.Logf("Stacktrace for %d:\n", goid) - for _, frame := range stack { - name := "<>" - if frame.Current.Fn != nil { - name = frame.Current.Fn.Name - } - t.Logf("\t%s [CFA: %x Ret: %x] at %s:%d", name, frame.Regs.CFA, frame.Ret, frame.Current.File, frame.Current.Line) - } - - if !found { - t.Logf("Truncated stacktrace for %d\n", goid) - } - } - }) -} - func TestAttachDetach(t *testing.T) { if testBackend == "lldb" && runtime.GOOS == "linux" { bs, _ := ioutil.ReadFile("/proc/sys/kernel/yama/ptrace_scope") @@ -2879,12 +2918,16 @@ func TestAttachDetach(t *testing.T) { assertNoError(p.Detach(false), t, "Detach") - resp, err := http.Get("http://127.0.0.1:9191/nobp") - assertNoError(err, t, "Page request after detach") - bs, err := ioutil.ReadAll(resp.Body) - assertNoError(err, t, "Reading /nobp page") - if out := string(bs); !strings.Contains(out, "hello, world!") { - t.Fatalf("/nobp page does not contain \"hello, world!\": %q", out) + if runtime.GOOS != "darwin" { + // Debugserver sometimes will leave a zombie process after detaching, this + // seems to be a bug with debugserver. + resp, err := http.Get("http://127.0.0.1:9191/nobp") + assertNoError(err, t, "Page request after detach") + bs, err := ioutil.ReadAll(resp.Body) + assertNoError(err, t, "Reading /nobp page") + if out := string(bs); !strings.Contains(out, "hello, world!") { + t.Fatalf("/nobp page does not contain \"hello, world!\": %q", out) + } } cmd.Process.Kill() @@ -2947,7 +2990,7 @@ func TestRecursiveNext(t *testing.T) { withTestProcess("increment", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFunctionBreakpoint(p, t, "main.Increment") assertNoError(p.Continue(), t, "Continue") - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint") assertNoError(p.Next(), t, "Next 1") assertNoError(p.Next(), t, "Next 2") @@ -3007,9 +3050,6 @@ func TestIssue893(t *testing.T) { if _, ok := err.(*frame.ErrNoFDEForPC); ok { return } - if _, ok := err.(proc.ErrThreadBlocked); ok { - return - } if _, ok := err.(*proc.ErrNoSourceForPC); ok { return } @@ -3040,10 +3080,10 @@ func TestIssue871(t *testing.T) { var frame proc.Stackframe frame, err = findFirstNonRuntimeFrame(p) if err == nil { - scope = proc.FrameToScope(p.BinInfo(), p.CurrentThread(), nil, frame) + scope = proc.FrameToScope(p, p.Memory(), nil, frame) } } else { - scope, err = proc.GoroutineScope(p.CurrentThread()) + scope, err = proc.GoroutineScope(p, p.CurrentThread()) } assertNoError(err, t, "scope") @@ -3081,7 +3121,7 @@ func TestShadowedFlag(t *testing.T) { } withTestProcess("testshadow", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue") - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "GoroutineScope") locals, err := scope.LocalVariables(normalLoadConfig) assertNoError(err, t, "LocalVariables") @@ -3186,7 +3226,7 @@ func TestIssue844(t *testing.T) { withTestProcess("nextcond", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 9) condbp := setFileBreakpoint(p, t, fixture.Source, 10) - condbp.Cond = &ast.BinaryExpr{ + condbp.UserBreaklet().Cond = &ast.BinaryExpr{ Op: token.EQL, X: &ast.Ident{Name: "n"}, Y: &ast.BasicLit{Kind: token.INT, Value: "11"}, @@ -3197,7 +3237,7 @@ func TestIssue844(t *testing.T) { }) } -func logStacktrace(t *testing.T, bi *proc.BinaryInfo, frames []proc.Stackframe) { +func logStacktrace(t *testing.T, p *proc.Target, frames []proc.Stackframe) { for j := range frames { name := "?" if frames[j].Current.Fn != nil { @@ -3209,20 +3249,20 @@ func logStacktrace(t *testing.T, bi *proc.BinaryInfo, frames []proc.Stackframe) t.Logf("\t%#x %#x %#x %s at %s:%d\n", frames[j].Call.PC, frames[j].FrameOffset(), frames[j].FramePointerOffset(), name, filepath.Base(frames[j].Call.File), frames[j].Call.Line) if frames[j].TopmostDefer != nil { - f, l, fn := bi.PCToLine(frames[j].TopmostDefer.DeferredPC) + _, _, fn := frames[j].TopmostDefer.DeferredFunc(p) fnname := "" if fn != nil { fnname = fn.Name } - t.Logf("\t\ttopmost defer: %#x %s at %s:%d\n", frames[j].TopmostDefer.DeferredPC, fnname, f, l) + t.Logf("\t\ttopmost defer: %#x %s\n", frames[j].TopmostDefer.DwrapPC, fnname) } for deferIdx, _defer := range frames[j].Defers { - f, l, fn := bi.PCToLine(_defer.DeferredPC) + _, _, fn := _defer.DeferredFunc(p) fnname := "" if fn != nil { fnname = fn.Name } - t.Logf("\t\t%d defer: %#x %s at %s:%d\n", deferIdx, _defer.DeferredPC, fnname, f, l) + t.Logf("\t\t%d defer: %#x %s\n", deferIdx, _defer.DwrapPC, fnname) } } @@ -3274,7 +3314,7 @@ func stacktraceCheck(t *testing.T, tc []string, frames []proc.Stackframe) []int func frameInFile(frame proc.Stackframe, file string) bool { for _, loc := range []proc.Location{frame.Current, frame.Call} { - if !strings.HasSuffix(loc.File, "/"+file) && !strings.HasSuffix(loc.File, "\\"+file) { + if !strings.HasSuffix(loc.File, file) && !strings.HasSuffix(loc.File, "/"+file) && !strings.HasSuffix(loc.File, "\\"+file) { return false } if loc.Line <= 0 { @@ -3298,9 +3338,8 @@ func TestCgoStacktrace(t *testing.T) { } } - if runtime.GOARCH == "386" { - t.Skip("cgo stacktraces not supported on i386 for now") - } + skipOn(t, "broken - cgo stacktraces", "386") + skipOn(t, "broken - cgo stacktraces", "linux", "arm64") protest.MustHaveCgo(t) // Tests that: @@ -3344,7 +3383,7 @@ func TestCgoStacktrace(t *testing.T) { assertNoError(err, t, fmt.Sprintf("Stacktrace at iteration step %d", itidx)) t.Logf("iteration step %d", itidx) - logStacktrace(t, p.BinInfo(), frames) + logStacktrace(t, p, frames) m := stacktraceCheck(t, tc, frames) mismatch := (m == nil) @@ -3381,7 +3420,7 @@ func TestCgoStacktrace(t *testing.T) { if frames[j].Current.File != threadFrames[j].Current.File || frames[j].Current.Line != threadFrames[j].Current.Line { t.Logf("stack mismatch between goroutine stacktrace and thread stacktrace") t.Logf("thread stacktrace:") - logStacktrace(t, p.BinInfo(), threadFrames) + logStacktrace(t, p, threadFrames) mismatch = true break } @@ -3413,7 +3452,7 @@ func TestCgoSources(t *testing.T) { for _, needle := range []string{"main.go", "hello.c"} { found := false for _, k := range sources { - if strings.HasSuffix(k, "/"+needle) || strings.HasSuffix(k, "\\"+needle) { + if strings.HasSuffix(k, needle) || strings.HasSuffix(k, "/"+needle) || strings.HasSuffix(k, "\\"+needle) { found = true break } @@ -3435,7 +3474,7 @@ func TestSystemstackStacktrace(t *testing.T) { assertNoError(err, t, "GetG") frames, err := g.Stacktrace(100, 0) assertNoError(err, t, "stacktrace") - logStacktrace(t, p.BinInfo(), frames) + logStacktrace(t, p, frames) m := stacktraceCheck(t, []string{"!runtime.startpanic_m", "runtime.gopanic", "main.main"}, frames) if m == nil { t.Fatal("see previous loglines") @@ -3468,7 +3507,7 @@ func TestSystemstackOnRuntimeNewstack(t *testing.T) { } frames, err := g.Stacktrace(100, 0) assertNoError(err, t, "stacktrace") - logStacktrace(t, p.BinInfo(), frames) + logStacktrace(t, p, frames) m := stacktraceCheck(t, []string{"!runtime.newstack", "main.main"}, frames) if m == nil { t.Fatal("see previous loglines") @@ -3477,10 +3516,7 @@ func TestSystemstackOnRuntimeNewstack(t *testing.T) { } func TestIssue1034(t *testing.T) { - if runtime.GOARCH == "386" { - t.Skip("cgo stacktraces not supported on i386 for now") - } - + skipOn(t, "broken - cgo stacktraces", "386") protest.MustHaveCgo(t) // The external linker on macOS produces an abbrev for DW_TAG_subprogram @@ -3490,7 +3526,7 @@ func TestIssue1034(t *testing.T) { assertNoError(p.Continue(), t, "Continue()") frames, err := p.SelectedGoroutine().Stacktrace(10, 0) assertNoError(err, t, "Stacktrace") - scope := proc.FrameToScope(p.BinInfo(), p.CurrentThread(), nil, frames[2:]...) + scope := proc.FrameToScope(p, p.Memory(), nil, frames[2:]...) args, _ := scope.FunctionArguments(normalLoadConfig) assertNoError(err, t, "FunctionArguments()") if len(args) > 0 { @@ -3500,10 +3536,7 @@ func TestIssue1034(t *testing.T) { } func TestIssue1008(t *testing.T) { - if runtime.GOARCH == "386" { - t.Skip("cgo stacktraces not supported on i386 for now") - } - + skipOn(t, "broken - cgo stacktraces", "386") protest.MustHaveCgo(t) // The external linker on macOS inserts "end of sequence" extended opcodes @@ -3527,9 +3560,9 @@ func testDeclLineCount(t *testing.T, p *proc.Target, lineno int, tgtvars []strin sort.Strings(tgtvars) assertLineNumber(p, t, lineno, "Program did not continue to correct next location") - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, fmt.Sprintf("GoroutineScope (:%d)", lineno)) - vars, err := scope.Locals() + vars, err := scope.Locals(0) assertNoError(err, t, fmt.Sprintf("Locals (:%d)", lineno)) if len(vars) != len(tgtvars) { t.Fatalf("wrong number of variables %d (:%d)", len(vars), lineno) @@ -3560,27 +3593,27 @@ func TestDeclLine(t *testing.T) { setFileBreakpoint(p, t, fixture.Source, 11) setFileBreakpoint(p, t, fixture.Source, 14) - assertNoError(p.Continue(), t, "Continue") + assertNoError(p.Continue(), t, "Continue 1") if goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { testDeclLineCount(t, p, 8, []string{}) } else { testDeclLineCount(t, p, 8, []string{"a"}) } - assertNoError(p.Continue(), t, "Continue") + assertNoError(p.Continue(), t, "Continue 2") testDeclLineCount(t, p, 9, []string{"a"}) - assertNoError(p.Continue(), t, "Continue") + assertNoError(p.Continue(), t, "Continue 3") if goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { testDeclLineCount(t, p, 10, []string{"a"}) } else { testDeclLineCount(t, p, 10, []string{"a", "b"}) } - assertNoError(p.Continue(), t, "Continue") + assertNoError(p.Continue(), t, "Continue 4") testDeclLineCount(t, p, 11, []string{"a", "b"}) - assertNoError(p.Continue(), t, "Continue") + assertNoError(p.Continue(), t, "Continue 5") testDeclLineCount(t, p, 14, []string{"a", "b"}) }) } @@ -3624,9 +3657,13 @@ func TestIssue1101(t *testing.T) { exitErr = p.Continue() } if pexit, exited := exitErr.(proc.ErrProcessExited); exited { - if pexit.Status != 2 && testBackend != "lldb" { - // looks like there's a bug with debugserver on macOS that sometimes + if pexit.Status != 2 && testBackend != "lldb" && (runtime.GOOS != "linux" || runtime.GOARCH != "386") { + // Looks like there's a bug with debugserver on macOS that sometimes // will report exit status 0 instead of the proper exit status. + // + // Also it seems that sometimes on linux/386 we will not receive the + // exit status. This happens if the process exits at the same time as it + // receives a signal. t.Fatalf("process exited status %d (expected 2)", pexit.Status) } } else { @@ -3649,16 +3686,34 @@ func TestIssue1145(t *testing.T) { }() assertNoError(p.Next(), t, "Next()") - if p.Breakpoints().HasInternalBreakpoints() { + if p.Breakpoints().HasSteppingBreakpoints() { t.Fatal("has internal breakpoints after manual stop request") } }) } +func TestHaltKeepsSteppingBreakpoints(t *testing.T) { + withTestProcess("sleep", t, func(p *proc.Target, fixture protest.Fixture) { + p.KeepSteppingBreakpoints = proc.HaltKeepsSteppingBreakpoints + setFileBreakpoint(p, t, fixture.Source, 18) + assertNoError(p.Continue(), t, "Continue()") + resumeChan := make(chan struct{}, 1) + p.ResumeNotify(resumeChan) + go func() { + <-resumeChan + time.Sleep(100 * time.Millisecond) + p.RequestManualStop() + }() + + assertNoError(p.Next(), t, "Next()") + if !p.Breakpoints().HasSteppingBreakpoints() { + t.Fatal("does not have internal breakpoints after manual stop request") + } + }) +} + func TestDisassembleGlobalVars(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("On ARM64 symLookup can't look up variables due to how they are loaded, see issue #1778") - } + skipOn(t, "broken - global variable symbolication", "arm64") // On ARM64 symLookup can't look up variables due to how they are loaded, see issue #1778 // On 386 linux when pie, the genered code use __x86.get_pc_thunk to ensure position-independent. // Locate global variable by // `CALL __x86.get_pc_thunk.ax(SB) 0xb0f7f @@ -3670,7 +3725,7 @@ func TestDisassembleGlobalVars(t *testing.T) { withTestProcess("teststepconcurrent", t, func(p *proc.Target, fixture protest.Fixture) { mainfn := p.BinInfo().LookupFunc["main.main"] regs, _ := p.CurrentThread().Registers() - text, err := proc.Disassemble(p.CurrentThread(), regs, p.Breakpoints(), p.BinInfo(), mainfn.Entry, mainfn.End) + text, err := proc.Disassemble(p.Memory(), regs, p.Breakpoints(), p.BinInfo(), mainfn.Entry, mainfn.End) assertNoError(err, t, "Disassemble") found := false for i := range text { @@ -3774,7 +3829,7 @@ func TestInlinedStacktraceAndVariables(t *testing.T) { } withTestProcessArgs("testinline", t, ".", []string{}, protest.EnableInlining, func(p *proc.Target, fixture protest.Fixture) { - pcs, err := p.BinInfo().LineToPC(fixture.Source, 7) + pcs, err := proc.FindFileLocation(p, fixture.Source, 7) assertNoError(err, t, "LineToPC") if len(pcs) < 2 { t.Fatalf("expected at least two locations for %s:%d (got %d: %#x)", fixture.Source, 7, len(pcs), pcs) @@ -3923,7 +3978,7 @@ func TestInlineBreakpoint(t *testing.T) { t.Skip("inlining not supported") } withTestProcessArgs("testinline", t, ".", []string{}, protest.EnableInlining|protest.EnableOptimization, func(p *proc.Target, fixture protest.Fixture) { - pcs, err := p.BinInfo().LineToPC(fixture.Source, 17) + pcs, err := proc.FindFileLocation(p, fixture.Source, 17) t.Logf("%#v\n", pcs) if len(pcs) != 1 { t.Fatalf("unable to get PC for inlined function call: %v", pcs) @@ -3947,7 +4002,7 @@ func TestIssue951(t *testing.T) { withTestProcess("issue951", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "GoroutineScope") args, err := scope.FunctionArguments(normalLoadConfig) assertNoError(err, t, "FunctionArguments") @@ -3973,9 +4028,6 @@ func TestIssue951(t *testing.T) { } func TestDWZCompression(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } // If dwz is not available in the system, skip this test if _, err := exec.LookPath("dwz"); err != nil { t.Skip("dwz not installed") @@ -3996,7 +4048,7 @@ func TestMapLoadConfigWithReslice(t *testing.T) { withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) { zolotovLoadCfg := proc.LoadConfig{FollowPointers: true, MaxStructFields: -1, MaxVariableRecurse: 3, MaxStringLen: 10, MaxArrayValues: 10} assertNoError(p.Continue(), t, "First Continue()") - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "GoroutineScope") m1, err := scope.EvalExpression("m1", zolotovLoadCfg) assertNoError(err, t, "EvalVariable") @@ -4091,7 +4143,7 @@ func TestIssue1264(t *testing.T) { // of evaluating a single boolean variable. withTestProcess("issue1264", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 8) - bp.Cond = &ast.Ident{Name: "equalsTwo"} + bp.UserBreaklet().Cond = &ast.Ident{Name: "equalsTwo"} assertNoError(p.Continue(), t, "Continue()") assertLineNumber(p, t, 8, "after continue") }) @@ -4103,7 +4155,7 @@ func TestReadDefer(t *testing.T) { frames, err := p.SelectedGoroutine().Stacktrace(10, proc.StacktraceReadDefers) assertNoError(err, t, "Stacktrace") - logStacktrace(t, p.BinInfo(), frames) + logStacktrace(t, p, frames) examples := []struct { frameIdx int @@ -4129,9 +4181,9 @@ func TestReadDefer(t *testing.T) { if d.Unreadable != nil { t.Fatalf("expected %q as %s of frame %d, got unreadable defer: %v", tgt, deferName, frameIdx, d.Unreadable) } - dfn := p.BinInfo().PCToFunc(d.DeferredPC) + _, _, dfn := d.DeferredFunc(p) if dfn == nil { - t.Fatalf("expected %q as %s of frame %d, got %#x", tgt, deferName, frameIdx, d.DeferredPC) + t.Fatalf("expected %q as %s of frame %d, got %#x", tgt, deferName, frameIdx, d.DwrapPC) } if dfn.Name != tgt { t.Fatalf("expected %q as %s of frame %d, got %q", tgt, deferName, frameIdx, dfn.Name) @@ -4157,9 +4209,7 @@ func TestReadDefer(t *testing.T) { } func TestNextUnknownInstr(t *testing.T) { - if runtime.GOARCH != "amd64" { - t.Skip("amd64 only") - } + skipUnlessOn(t, "amd64 only", "amd64") if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 10) { t.Skip("versions of Go before 1.10 can't assemble the instruction VPUNPCKLWD") } @@ -4171,8 +4221,18 @@ func TestNextUnknownInstr(t *testing.T) { } func TestReadDeferArgs(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("arm64 does not support ReadDeferArgs for now") + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 17) { + // When regabi is enabled in Go 1.17 and later, reading arguments of + // deferred functions becomes significantly more complicated because of + // the autogenerated code used to unpack the argument frame stored in + // runtime._defer into registers. + // We either need to know how to do the translation, implementing the ABI1 + // rules in Delve, or have some assistence from the compiler (for example + // have the dwrap function contain entries for each of the captured + // variables with a location describing their offset from DX). + // Ultimately this feature is unimportant enough that we can leave it + // disabled for now. + t.Skip("unsupported") } var tests = []struct { frame, deferCall int @@ -4189,15 +4249,19 @@ func TestReadDeferArgs(t *testing.T) { scope, err := proc.ConvertEvalScope(p, -1, test.frame, test.deferCall) assertNoError(err, t, fmt.Sprintf("ConvertEvalScope(-1, %d, %d)", test.frame, test.deferCall)) - if scope.Fn.Name != "main.f2" { - t.Fatalf("expected function \"main.f2\" got %q", scope.Fn.Name) + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 17) { + // In Go 1.17 deferred function calls can end up inside a wrapper, and + // the scope for this evaluation needs to be the wrapper. + if scope.Fn.Name != "main.f2" { + t.Fatalf("expected function \"main.f2\" got %q", scope.Fn.Name) + } } - avar, err := scope.EvalVariable("a", normalLoadConfig) + avar, err := scope.EvalExpression("a", normalLoadConfig) if err != nil { t.Fatal(err) } - bvar, err := scope.EvalVariable("b", normalLoadConfig) + bvar, err := scope.EvalExpression("b", normalLoadConfig) if err != nil { t.Fatal(err) } @@ -4243,7 +4307,7 @@ func TestIssue1432(t *testing.T) { svar := evalVariable(p, t, "s") t.Logf("%#x", svar.Addr) - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "GoroutineScope()") err = scope.SetVariable(fmt.Sprintf("(*\"main.s\")(%#x).i", svar.Addr), "10") @@ -4313,9 +4377,7 @@ func TestIssue1469(t *testing.T) { } func TestDeadlockBreakpoint(t *testing.T) { - if buildMode == "pie" { - t.Skip("See https://github.com/golang/go/issues/29322") - } + skipOn(t, "upstream issue - https://github.com/golang/go/issues/29322", "pie") deadlockBp := proc.FatalThrow if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 11) { deadlockBp = proc.UnrecoveredPanic @@ -4407,7 +4469,7 @@ func TestAncestors(t *testing.T) { astack, err := a.Stack(100) assertNoError(err, t, fmt.Sprintf("Ancestor %d stack", i)) t.Logf("ancestor %d\n", i) - logStacktrace(t, p.BinInfo(), astack) + logStacktrace(t, p, astack) for _, frame := range astack { if frame.Current.Fn != nil && frame.Current.Fn.Name == "main.main" { mainFound = true @@ -4450,10 +4512,7 @@ func testCallConcurrentCheckReturns(p *proc.Target, t *testing.T, gid1, gid2 int } func TestCallConcurrent(t *testing.T) { - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } - + skipOn(t, "broken", "freebsd") protest.MustSupportFunctionCalls(t, testBackend) withTestProcess("teststepconcurrent", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 24) @@ -4468,12 +4527,12 @@ func TestCallConcurrent(t *testing.T) { returned := testCallConcurrentCheckReturns(p, t, gid1, -1) curthread := p.CurrentThread() - if curbp := curthread.Breakpoint(); curbp.Breakpoint == nil || curbp.LogicalID != bp.LogicalID || returned > 0 { + if curbp := curthread.Breakpoint(); curbp.Breakpoint == nil || curbp.LogicalID() != bp.LogicalID() || returned > 0 { t.Logf("skipping test, the call injection terminated before we hit a breakpoint in a different thread") return } - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint() returned an error") gid2 := p.SelectedGoroutine().ID @@ -4524,7 +4583,7 @@ func TestIssue1615(t *testing.T) { withTestProcess("issue1615", t, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, t, fixture.Source, 19) - bp.Cond = &ast.BinaryExpr{ + bp.UserBreaklet().Cond = &ast.BinaryExpr{ Op: token.EQL, X: &ast.Ident{Name: "s"}, Y: &ast.BasicLit{Kind: token.STRING, Value: `"projects/my-gcp-project-id-string/locations/us-central1/queues/my-task-queue-name"`}, @@ -4536,9 +4595,9 @@ func TestIssue1615(t *testing.T) { } func TestCgoStacktrace2(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("fixture crashes go runtime on windows") - } + skipOn(t, "upstream issue", "windows") + skipOn(t, "broken", "386") + skipOn(t, "broken", "arm64") protest.MustHaveCgo(t) // If a panic happens during cgo execution the stacktrace should show the C // function that caused the problem. @@ -4546,15 +4605,16 @@ func TestCgoStacktrace2(t *testing.T) { p.Continue() frames, err := proc.ThreadStacktrace(p.CurrentThread(), 100) assertNoError(err, t, "Stacktrace()") - logStacktrace(t, p.BinInfo(), frames) - stacktraceCheck(t, []string{"C.sigsegv", "C.testfn", "main.main"}, frames) - }) + logStacktrace(t, p, frames) + m := stacktraceCheck(t, []string{"C.sigsegv", "C.testfn", "main.main"}, frames) + if m == nil { + t.Fatal("see previous loglines") + } + }) } func TestIssue1656(t *testing.T) { - if runtime.GOARCH != "amd64" { - t.Skip("amd64 only") - } + skipUnlessOn(t, "amd64 only", "amd64") withTestProcess("issue1656/", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, filepath.ToSlash(filepath.Join(fixture.BuildDir, "main.s")), 5) assertNoError(p.Continue(), t, "Continue()") @@ -4572,9 +4632,7 @@ func TestBreakpointConfusionOnResume(t *testing.T) { // native.(*Thread).singleStep all agree on which breakpoint the thread is // stopped at. // This test checks for a regression introduced when fixing Issue #1656 - if runtime.GOARCH != "amd64" { - t.Skip("amd64 only") - } + skipUnlessOn(t, "amd64 only", "amd64") withTestProcess("nopbreakpoint/", t, func(p *proc.Target, fixture protest.Fixture) { maindots := filepath.ToSlash(filepath.Join(fixture.BuildDir, "main.s")) maindotgo := filepath.ToSlash(filepath.Join(fixture.BuildDir, "main.go")) @@ -4658,7 +4716,7 @@ func TestIssue1795(t *testing.T) { assertNoError(p.Continue(), t, "Continue()") frames, err := proc.ThreadStacktrace(p.CurrentThread(), 40) assertNoError(err, t, "ThreadStacktrace()") - logStacktrace(t, p.BinInfo(), frames) + logStacktrace(t, p, frames) if err := checkFrame(frames[0], "regexp.(*Regexp).doExecute", "", 0, false); err != nil { t.Errorf("Wrong frame 0: %v", err) } @@ -4678,7 +4736,7 @@ func BenchmarkConditionalBreakpoints(b *testing.B) { b.N = 1 withTestProcess("issue1549", b, func(p *proc.Target, fixture protest.Fixture) { bp := setFileBreakpoint(p, b, fixture.Source, 12) - bp.Cond = &ast.BinaryExpr{ + bp.UserBreaklet().Cond = &ast.BinaryExpr{ Op: token.EQL, X: &ast.Ident{Name: "value"}, Y: &ast.BasicLit{Kind: token.INT, Value: "-1"}, @@ -4776,33 +4834,64 @@ func TestBackwardNextDeferPanic(t *testing.T) { if testBackend != "rr" { t.Skip("Reverse stepping test needs rr") } - testseq2(t, "defercall", "", []seqTest{ - {contContinue, 12}, - {contReverseNext, 11}, - {contReverseNext, 10}, - {contReverseNext, 9}, - {contReverseNext, 27}, - - {contContinueToBreakpoint, 12}, // skip first call to sampleFunction - {contContinueToBreakpoint, 6}, // go to call to sampleFunction through deferreturn - {contReverseNext, 13}, - {contReverseNext, 12}, - {contReverseNext, 11}, - {contReverseNext, 10}, - {contReverseNext, 9}, - {contReverseNext, 27}, - - {contContinueToBreakpoint, 18}, // go to panic call - {contNext, 6}, // panic so the deferred call happens - {contReverseNext, 18}, - {contReverseNext, 17}, - {contReverseNext, 16}, - {contReverseNext, 15}, - {contReverseNext, 23}, - {contReverseNext, 22}, - {contReverseNext, 21}, - {contReverseNext, 28}, - }) + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) { + testseq2(t, "defercall", "", []seqTest{ + {contContinue, 12}, + {contReverseNext, 11}, + {contReverseNext, 10}, + {contReverseNext, 9}, + {contReverseNext, 27}, + + {contContinueToBreakpoint, 12}, // skip first call to sampleFunction + {contContinueToBreakpoint, 6}, // go to call to sampleFunction through deferreturn + {contReverseNext, -1}, // runtime.deferreturn, maybe we should try to skip this + {contReverseStepout, 13}, + {contReverseNext, 12}, + {contReverseNext, 11}, + {contReverseNext, 10}, + {contReverseNext, 9}, + {contReverseNext, 27}, + + {contContinueToBreakpoint, 18}, // go to panic call + {contNext, 6}, // panic so the deferred call happens + {contReverseNext, 18}, + {contReverseNext, 17}, + {contReverseNext, 16}, + {contReverseNext, 15}, + {contReverseNext, 23}, + {contReverseNext, 22}, + {contReverseNext, 21}, + {contReverseNext, 28}, + }) + } else { + testseq2(t, "defercall", "", []seqTest{ + {contContinue, 12}, + {contReverseNext, 11}, + {contReverseNext, 10}, + {contReverseNext, 9}, + {contReverseNext, 27}, + + {contContinueToBreakpoint, 12}, // skip first call to sampleFunction + {contContinueToBreakpoint, 6}, // go to call to sampleFunction through deferreturn + {contReverseNext, 13}, + {contReverseNext, 12}, + {contReverseNext, 11}, + {contReverseNext, 10}, + {contReverseNext, 9}, + {contReverseNext, 27}, + + {contContinueToBreakpoint, 18}, // go to panic call + {contNext, 6}, // panic so the deferred call happens + {contReverseNext, 18}, + {contReverseNext, 17}, + {contReverseNext, 16}, + {contReverseNext, 15}, + {contReverseNext, 23}, + {contReverseNext, 22}, + {contReverseNext, 21}, + {contReverseNext, 28}, + }) + } } func TestIssue1925(t *testing.T) { @@ -4823,9 +4912,7 @@ func TestIssue1925(t *testing.T) { } func TestStepIntoWrapperForEmbeddedPointer(t *testing.T) { - if runtime.GOOS == "linux" && runtime.GOARCH == "386" && buildMode == "pie" { - t.Skip("Skipping wrappers doesn't work on linux/386/PIE due to the use of get_pc_thunk") - } + skipOn(t, "N/A", "linux", "386", "pie") // skipping wrappers doesn't work on linux/386/PIE due to the use of get_pc_thunk // Under some circumstances (when using an interface to call a method on an // embedded field, see _fixtures/ifaceembcall.go) the compiler will // autogenerate a wrapper function that uses a tail call (i.e. it ends in @@ -4842,7 +4929,8 @@ func TestStepIntoWrapperForEmbeddedPointer(t *testing.T) { {contStepout, 29}}) // same test but with next instead of stepout - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) && runtime.GOARCH != "386" { + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) && runtime.GOARCH != "386" && !goversion.VersionAfterOrEqualRev(runtime.Version(), 1, 15, 4) { + // Line numbers generated for versions 1.14 through 1.15.3 on any system except linux/386 testseq2(t, "ifaceembcall", "", []seqTest{ {contContinue, 28}, // main.main, the line calling iface.PtrReceiver() {contStep, 18}, // main.(*A).PtrReceiver @@ -4874,9 +4962,7 @@ func TestRefreshCurThreadSelGAfterContinueOnceError(t *testing.T) { // refreshed after ContinueOnce returns an error due to a segmentation // fault. - if runtime.GOOS != "darwin" && testBackend != "lldb" { - t.Skip("not applicable") - } + skipUnlessOn(t, "N/A", "darwin", "lldb") withTestProcess("issue2078", t, func(p *proc.Target, fixture protest.Fixture) { setFileBreakpoint(p, t, fixture.Source, 4) @@ -4942,9 +5028,7 @@ func TestRequestManualStopWhileStopped(t *testing.T) { func TestStepOutPreservesGoroutine(t *testing.T) { // Checks that StepOut preserves the currently selected goroutine. - if runtime.GOOS == "freebsd" { - t.Skip("XXX - not working") - } + skipOn(t, "broken", "freebsd") rand.Seed(time.Now().Unix()) withTestProcess("issue2113", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue()") @@ -5017,3 +5101,681 @@ func TestStepOutPreservesGoroutine(t *testing.T) { } }) } + +func TestIssue2319(t *testing.T) { + // Check to make sure we don't crash on startup when the target is + // a binary with a mix of DWARF-5 C++ compilation units and + // DWARF-4 Go compilation units. + + // Require CGO, since we need to use the external linker for this test. + protest.MustHaveCgo(t) + + // The test fixture uses linux/amd64 assembly and a *.syso file + // that is linux/amd64, so skip for other architectures. + if runtime.GOOS != "linux" || runtime.GOARCH != "amd64" { + t.Skipf("skipping since not linux/amd64") + } + + // Skip unless on 1.14 or later. The test fixture uses a *.syso + // file, which in 1.13 is not loaded unless we're in internal + // linking mode (we need external linking here). + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { + t.Skip("test contains fixture that is specific to go 1.14+") + } + + fixture := protest.BuildFixture("issue2319/", protest.BuildModeExternalLinker) + + // Load up the binary and make sure there are no crashes. + bi := proc.NewBinaryInfo("linux", "amd64") + assertNoError(bi.LoadBinaryInfo(fixture.Path, 0, nil), t, "LoadBinaryInfo") +} + +func TestDump(t *testing.T) { + if runtime.GOOS == "freebsd" || (runtime.GOOS == "darwin" && testBackend == "native") { + t.Skip("not supported") + } + + convertRegisters := func(arch *proc.Arch, dregs op.DwarfRegisters) string { + dregs.Reg(^uint64(0)) + buf := new(bytes.Buffer) + for i := 0; i < dregs.CurrentSize(); i++ { + reg := dregs.Reg(uint64(i)) + if reg == nil { + continue + } + name, _, repr := arch.DwarfRegisterToString(i, reg) + fmt.Fprintf(buf, " %s=%s", name, repr) + } + return buf.String() + } + + convertThread := func(thread proc.Thread) string { + regs, err := thread.Registers() + assertNoError(err, t, fmt.Sprintf("Thread registers %d", thread.ThreadID())) + arch := thread.BinInfo().Arch + dregs := arch.RegistersToDwarfRegisters(0, regs) + return fmt.Sprintf("%08d %s", thread.ThreadID(), convertRegisters(arch, *dregs)) + } + + convertThreads := func(threads []proc.Thread) []string { + r := make([]string, len(threads)) + for i := range threads { + r[i] = convertThread(threads[i]) + } + sort.Strings(r) + return r + } + + convertGoroutine := func(g *proc.G) string { + threadID := 0 + if g.Thread != nil { + threadID = g.Thread.ThreadID() + } + return fmt.Sprintf("%d pc=%#x sp=%#x bp=%#x lr=%#x gopc=%#x startpc=%#x systemstack=%v thread=%d", g.ID, g.PC, g.SP, g.BP, g.LR, g.GoPC, g.StartPC, g.SystemStack, threadID) + } + + convertFrame := func(arch *proc.Arch, frame *proc.Stackframe) string { + return fmt.Sprintf("currentPC=%#x callPC=%#x frameOff=%#x\n", frame.Current.PC, frame.Call.PC, frame.FrameOffset()) + } + + makeDump := func(p *proc.Target, corePath, exePath string, flags proc.DumpFlags) *proc.Target { + fh, err := os.Create(corePath) + assertNoError(err, t, "Create()") + var state proc.DumpState + p.Dump(fh, flags, &state) + assertNoError(state.Err, t, "Dump()") + if state.ThreadsDone != state.ThreadsTotal || state.MemDone != state.MemTotal || !state.AllDone || state.Dumping || state.Canceled { + t.Fatalf("bad DumpState %#v", &state) + } + c, err := core.OpenCore(corePath, exePath, nil) + assertNoError(err, t, "OpenCore()") + return c + } + + testDump := func(p, c *proc.Target) { + if p.Pid() != c.Pid() { + t.Errorf("Pid mismatch %x %x", p.Pid(), c.Pid()) + } + + threads := convertThreads(p.ThreadList()) + cthreads := convertThreads(c.ThreadList()) + + if len(threads) != len(cthreads) { + t.Errorf("Thread number mismatch %d %d", len(threads), len(cthreads)) + } + + for i := range threads { + if threads[i] != cthreads[i] { + t.Errorf("Thread mismatch\nlive:\t%s\ncore:\t%s", threads[i], cthreads[i]) + } + } + + gos, _, err := proc.GoroutinesInfo(p, 0, 0) + assertNoError(err, t, "GoroutinesInfo() - live process") + cgos, _, err := proc.GoroutinesInfo(c, 0, 0) + assertNoError(err, t, "GoroutinesInfo() - core dump") + + if len(gos) != len(cgos) { + t.Errorf("Goroutine number mismatch %d %d", len(gos), len(cgos)) + } + + var scope, cscope *proc.EvalScope + + for i := range gos { + if convertGoroutine(gos[i]) != convertGoroutine(cgos[i]) { + t.Errorf("Goroutine mismatch\nlive:\t%s\ncore:\t%s", convertGoroutine(gos[i]), convertGoroutine(cgos[i])) + } + + frames, err := gos[i].Stacktrace(20, 0) + assertNoError(err, t, fmt.Sprintf("Stacktrace for goroutine %d - live process", gos[i].ID)) + cframes, err := cgos[i].Stacktrace(20, 0) + assertNoError(err, t, fmt.Sprintf("Stacktrace for goroutine %d - core dump", gos[i].ID)) + + if len(frames) != len(cframes) { + t.Errorf("Frame number mismatch for goroutine %d: %d %d", gos[i].ID, len(frames), len(cframes)) + } + + for j := range frames { + if convertFrame(p.BinInfo().Arch, &frames[j]) != convertFrame(p.BinInfo().Arch, &cframes[j]) { + t.Errorf("Frame mismatch %d.%d\nlive:\t%s\ncore:\t%s", gos[i].ID, j, convertFrame(p.BinInfo().Arch, &frames[j]), convertFrame(p.BinInfo().Arch, &cframes[j])) + } + if frames[j].Call.Fn != nil && frames[j].Call.Fn.Name == "main.main" { + scope = proc.FrameToScope(p, p.Memory(), gos[i], frames[j:]...) + cscope = proc.FrameToScope(c, c.Memory(), cgos[i], cframes[j:]...) + } + } + } + + vars, err := scope.LocalVariables(normalLoadConfig) + assertNoError(err, t, "LocalVariables - live process") + cvars, err := cscope.LocalVariables(normalLoadConfig) + assertNoError(err, t, "LocalVariables - core dump") + + if len(vars) != len(cvars) { + t.Errorf("Variable number mismatch %d %d", len(vars), len(cvars)) + } + + for i := range vars { + varstr := vars[i].Name + "=" + api.ConvertVar(vars[i]).SinglelineString() + cvarstr := cvars[i].Name + "=" + api.ConvertVar(cvars[i]).SinglelineString() + if strings.Contains(varstr, "(unreadable") { + // errors reading from unmapped memory differ between live process and core + continue + } + if varstr != cvarstr { + t.Errorf("Variable mismatch %s %s", varstr, cvarstr) + } + } + } + + withTestProcess("testvariables2", t, func(p *proc.Target, fixture protest.Fixture) { + assertNoError(p.Continue(), t, "Continue()") + corePath := filepath.Join(fixture.BuildDir, "coredump") + corePathPlatIndep := filepath.Join(fixture.BuildDir, "coredump-indep") + + t.Logf("testing normal dump") + + c := makeDump(p, corePath, fixture.Path, 0) + defer os.Remove(corePath) + testDump(p, c) + + if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" { + // No reason to do this test on other goos/goarch because they use the + // platform-independent format anyway. + t.Logf("testing platform-independent dump") + c2 := makeDump(p, corePathPlatIndep, fixture.Path, proc.DumpPlatformIndependent) + defer os.Remove(corePathPlatIndep) + testDump(p, c2) + } + }) +} + +func TestCompositeMemoryWrite(t *testing.T) { + if runtime.GOARCH != "amd64" { + t.Skip("only valid on amd64") + } + skipOn(t, "not implemented", "freebsd") + withTestProcess("fputest/", t, func(p *proc.Target, fixture protest.Fixture) { + getregs := func() (pc, rax, xmm1 uint64) { + regs, err := p.CurrentThread().Registers() + assertNoError(err, t, "Registers") + fmtregs, err := regs.Slice(true) + assertNoError(err, t, "register slice") + + var xmm1buf []byte + + for _, reg := range fmtregs { + switch strings.ToLower(reg.Name) { + case "rax": + rax = reg.Reg.Uint64Val + case "xmm1": + xmm1buf = reg.Reg.Bytes + } + } + + xmm1 = binary.LittleEndian.Uint64(xmm1buf[:8]) + + return regs.PC(), rax, xmm1 + } + + const fakeAddress = 0xbeef0000 + + getmem := func(mem proc.MemoryReader) uint64 { + buf := make([]byte, 8) + _, err := mem.ReadMemory(buf, fakeAddress) + assertNoError(err, t, "ReadMemory") + return binary.LittleEndian.Uint64(buf) + } + + assertNoError(p.Continue(), t, "Continue()") + oldPc, oldRax, oldXmm1 := getregs() + t.Logf("PC %#x AX %#x XMM1 %#x", oldPc, oldRax, oldXmm1) + + memRax, err := proc.NewCompositeMemory(p, []op.Piece{{Size: 0, Val: 0, Kind: op.RegPiece}}, fakeAddress) + assertNoError(err, t, "NewCompositeMemory (rax)") + memXmm1, err := proc.NewCompositeMemory(p, []op.Piece{{Size: 0, Val: 18, Kind: op.RegPiece}}, fakeAddress) + assertNoError(err, t, "NewCompositeMemory (xmm1)") + + if memRax := getmem(memRax); memRax != oldRax { + t.Errorf("reading rax memory, expected %#x got %#x", oldRax, memRax) + } + if memXmm1 := getmem(memXmm1); memXmm1 != oldXmm1 { + t.Errorf("reading xmm1 memory, expected %#x got %#x", oldXmm1, memXmm1) + } + + _, err = memRax.WriteMemory(0xbeef0000, []byte{0xef, 0xbe, 0x0d, 0xf0, 0xef, 0xbe, 0x0d, 0xf0}) + assertNoError(err, t, "WriteMemory (rax)") + _, err = memXmm1.WriteMemory(0xbeef0000, []byte{0xef, 0xbe, 0x0d, 0xf0, 0xef, 0xbe, 0x0d, 0xf0}) + assertNoError(err, t, "WriteMemory (xmm1)") + + newPc, newRax, newXmm1 := getregs() + t.Logf("PC %#x AX %#x XMM1 %#x", newPc, newRax, newXmm1) + + const tgt = 0xf00dbeeff00dbeef + if newRax != tgt { + t.Errorf("reading rax register, expected %#x, got %#x", uint64(tgt), newRax) + } + if newXmm1 != tgt { + t.Errorf("reading xmm1 register, expected %#x, got %#x", uint64(tgt), newXmm1) + } + }) +} + +func TestVariablesWithExternalLinking(t *testing.T) { + protest.MustHaveCgo(t) + // Tests that macOSDebugFrameBugWorkaround works. + // See: + // https://github.com/golang/go/issues/25841 + // https://github.com/go-delve/delve/issues/2346 + withTestProcessArgs("testvariables2", t, ".", []string{}, protest.BuildModeExternalLinker, func(p *proc.Target, fixture protest.Fixture) { + assertNoError(p.Continue(), t, "Continue()") + str1Var := evalVariable(p, t, "str1") + if str1Var.Unreadable != nil { + t.Fatalf("variable str1 is unreadable: %v", str1Var.Unreadable) + } + t.Logf("%#v", str1Var) + if constant.StringVal(str1Var.Value) != "01234567890" { + t.Fatalf("wrong value for str1: %v", str1Var.Value) + } + }) +} + +func TestWatchpointsBasic(t *testing.T) { + skipOn(t, "not implemented", "freebsd") + skipOn(t, "not implemented", "386") + skipOn(t, "see https://github.com/go-delve/delve/issues/2768", "windows") + protest.AllowRecording(t) + + position1 := 19 + position5 := 41 + + if runtime.GOARCH == "arm64" { + position1 = 18 + position5 = 40 + } + + withTestProcess("databpeasy", t, func(p *proc.Target, fixture protest.Fixture) { + setFunctionBreakpoint(p, t, "main.main") + setFileBreakpoint(p, t, fixture.Source, 21) // Position 2 breakpoint + setFileBreakpoint(p, t, fixture.Source, 27) // Position 4 breakpoint + assertNoError(p.Continue(), t, "Continue 0") + assertLineNumber(p, t, 13, "Continue 0") // Position 0 + + scope, err := proc.GoroutineScope(p, p.CurrentThread()) + assertNoError(err, t, "GoroutineScope") + + bp, err := p.SetWatchpoint(scope, "globalvar1", proc.WatchWrite, nil) + assertNoError(err, t, "SetDataBreakpoint(write-only)") + + assertNoError(p.Continue(), t, "Continue 1") + assertLineNumber(p, t, position1, "Continue 1") // Position 1 + + if curbp := p.CurrentThread().Breakpoint().Breakpoint; curbp == nil || (curbp.LogicalID() != bp.LogicalID()) { + t.Fatal("breakpoint not set") + } + + assertNoError(p.ClearBreakpoint(bp.Addr), t, "ClearBreakpoint") + + assertNoError(p.Continue(), t, "Continue 2") + assertLineNumber(p, t, 21, "Continue 2") // Position 2 + + _, err = p.SetWatchpoint(scope, "globalvar1", proc.WatchWrite|proc.WatchRead, nil) + assertNoError(err, t, "SetDataBreakpoint(read-write)") + + assertNoError(p.Continue(), t, "Continue 3") + assertLineNumber(p, t, 22, "Continue 3") // Position 3 + + p.ClearBreakpoint(bp.Addr) + + assertNoError(p.Continue(), t, "Continue 4") + assertLineNumber(p, t, 27, "Continue 4") // Position 4 + + t.Logf("setting final breakpoint") + _, err = p.SetWatchpoint(scope, "globalvar1", proc.WatchWrite, nil) + assertNoError(err, t, "SetDataBreakpoint(write-only, again)") + + assertNoError(p.Continue(), t, "Continue 5") + assertLineNumber(p, t, position5, "Continue 5") // Position 5 + }) +} + +func TestWatchpointCounts(t *testing.T) { + skipOn(t, "not implemented", "freebsd") + skipOn(t, "not implemented", "386") + skipOn(t, "see https://github.com/go-delve/delve/issues/2768", "windows") + protest.AllowRecording(t) + + withTestProcess("databpcountstest", t, func(p *proc.Target, fixture protest.Fixture) { + setFunctionBreakpoint(p, t, "main.main") + assertNoError(p.Continue(), t, "Continue 0") + + scope, err := proc.GoroutineScope(p, p.CurrentThread()) + assertNoError(err, t, "GoroutineScope") + + bp, err := p.SetWatchpoint(scope, "globalvar1", proc.WatchWrite, nil) + assertNoError(err, t, "SetWatchpoint(write-only)") + + for { + if err := p.Continue(); err != nil { + if _, exited := err.(proc.ErrProcessExited); exited { + break + } + assertNoError(err, t, "Continue()") + } + } + + t.Logf("TotalHitCount: %d", bp.UserBreaklet().TotalHitCount) + if bp.UserBreaklet().TotalHitCount != 200 { + t.Fatalf("Wrong TotalHitCount for the breakpoint (%d)", bp.UserBreaklet().TotalHitCount) + } + + if len(bp.UserBreaklet().HitCount) != 2 { + t.Fatalf("Wrong number of goroutines for breakpoint (%d)", len(bp.UserBreaklet().HitCount)) + } + + for _, v := range bp.UserBreaklet().HitCount { + if v != 100 { + t.Fatalf("Wrong HitCount for breakpoint (%v)", bp.UserBreaklet().HitCount) + } + } + }) +} + +func TestManualStopWhileStopped(t *testing.T) { + // Checks that RequestManualStop sent to a stopped thread does not cause the target process to die. + withTestProcess("loopprog", t, func(p *proc.Target, fixture protest.Fixture) { + asyncCont := func(done chan struct{}) { + defer close(done) + err := p.Continue() + t.Logf("%v\n", err) + if err != nil { + panic(err) + } + for _, th := range p.ThreadList() { + if th.Breakpoint().Breakpoint != nil { + t.Logf("unexpected stop at breakpoint: %v", th.Breakpoint().Breakpoint) + panic("unexpected stop at breakpoint") + } + } + } + + const ( + repeatsSlow = 3 + repeatsFast = 5 + ) + + for i := 0; i < repeatsSlow; i++ { + t.Logf("Continue %d (slow)", i) + done := make(chan struct{}) + go asyncCont(done) + time.Sleep(1 * time.Second) + p.RequestManualStop() + time.Sleep(1 * time.Second) + p.RequestManualStop() + time.Sleep(1 * time.Second) + <-done + } + for i := 0; i < repeatsFast; i++ { + t.Logf("Continue %d (fast)", i) + rch := make(chan struct{}) + done := make(chan struct{}) + p.ResumeNotify(rch) + go asyncCont(done) + <-rch + p.RequestManualStop() + p.RequestManualStop() + <-done + } + }) +} + +func TestDwrapStartLocation(t *testing.T) { + // Tests that the start location of a goroutine is unwrapped in Go 1.17 and later. + withTestProcess("goroutinestackprog", t, func(p *proc.Target, fixture protest.Fixture) { + setFunctionBreakpoint(p, t, "main.stacktraceme") + assertNoError(p.Continue(), t, "Continue()") + gs, _, err := proc.GoroutinesInfo(p, 0, 0) + assertNoError(err, t, "GoroutinesInfo") + found := false + for _, g := range gs { + startLoc := g.StartLoc(p) + if startLoc.Fn == nil { + continue + } + t.Logf("%#v\n", startLoc.Fn.Name) + if startLoc.Fn.Name == "main.agoroutine" { + found = true + break + } + } + if !found { + t.Errorf("could not find any goroutine with a start location of main.agoroutine") + } + }) +} + +func TestWatchpointStack(t *testing.T) { + skipOn(t, "not implemented", "freebsd") + skipOn(t, "not implemented", "386") + skipOn(t, "see https://github.com/go-delve/delve/issues/2768", "windows") + protest.AllowRecording(t) + + position1 := 17 + + if runtime.GOARCH == "arm64" { + position1 = 16 + } + + withTestProcess("databpstack", t, func(p *proc.Target, fixture protest.Fixture) { + setFileBreakpoint(p, t, fixture.Source, 11) // Position 0 breakpoint + clearlen := len(p.Breakpoints().M) + + assertNoError(p.Continue(), t, "Continue 0") + assertLineNumber(p, t, 11, "Continue 0") // Position 0 + + scope, err := proc.GoroutineScope(p, p.CurrentThread()) + assertNoError(err, t, "GoroutineScope") + + _, err = p.SetWatchpoint(scope, "w", proc.WatchWrite, nil) + assertNoError(err, t, "SetDataBreakpoint(write-only)") + + watchbpnum := 3 + if recorded, _ := p.Recorded(); recorded { + watchbpnum = 4 + } + + if len(p.Breakpoints().M) != clearlen+watchbpnum { + // want 1 watchpoint, 1 stack resize breakpoint, 1 out of scope sentinel (2 if recorded) + t.Errorf("wrong number of breakpoints after setting watchpoint: %d", len(p.Breakpoints().M)-clearlen) + } + + var retaddr uint64 + for _, bp := range p.Breakpoints().M { + for _, breaklet := range bp.Breaklets { + if breaklet.Kind&proc.WatchOutOfScopeBreakpoint != 0 { + retaddr = bp.Addr + break + } + } + } + + // Note: for recorded processes retaddr will not always be the return + // address, ~50% of the times it will be the address of the CALL + // instruction preceding the return address, this does not matter for this + // test. + + _, err = p.SetBreakpoint(retaddr, proc.UserBreakpoint, nil) + assertNoError(err, t, "SetBreakpoint") + + if len(p.Breakpoints().M) != clearlen+watchbpnum { + // want 1 watchpoint, 1 stack resize breakpoint, 1 out of scope sentinel (which is also a user breakpoint) (and another out of scope sentinel if recorded) + t.Errorf("wrong number of breakpoints after setting watchpoint: %d", len(p.Breakpoints().M)-clearlen) + } + + assertNoError(p.Continue(), t, "Continue 1") + assertLineNumber(p, t, position1, "Continue 1") // Position 1 + + assertNoError(p.Continue(), t, "Continue 2") + t.Logf("%#v", p.CurrentThread().Breakpoint().Breakpoint) + assertLineNumber(p, t, 24, "Continue 2") // Position 2 (watchpoint gone out of scope) + + if len(p.Breakpoints().M) != clearlen+1 { + // want 1 user breakpoint set at retaddr + t.Errorf("wrong number of breakpoints after watchpoint goes out of scope: %d", len(p.Breakpoints().M)-clearlen) + } + + if len(p.Breakpoints().WatchOutOfScope) != 1 { + t.Errorf("wrong number of out-of-scope watchpoints after watchpoint goes out of scope: %d", len(p.Breakpoints().WatchOutOfScope)) + } + + err = p.ClearBreakpoint(retaddr) + assertNoError(err, t, "ClearBreakpoint") + + if len(p.Breakpoints().M) != clearlen { + // want 1 user breakpoint set at retaddr + t.Errorf("wrong number of breakpoints after removing user breakpoint: %d", len(p.Breakpoints().M)-clearlen) + } + }) +} + +func TestWatchpointStackBackwardsOutOfScope(t *testing.T) { + skipUnlessOn(t, "only for recorded targets", "rr") + protest.AllowRecording(t) + + withTestProcess("databpstack", t, func(p *proc.Target, fixture protest.Fixture) { + setFileBreakpoint(p, t, fixture.Source, 11) // Position 0 breakpoint + clearlen := len(p.Breakpoints().M) + + assertNoError(p.Continue(), t, "Continue 0") + assertLineNumber(p, t, 11, "Continue 0") // Position 0 + + scope, err := proc.GoroutineScope(p, p.CurrentThread()) + assertNoError(err, t, "GoroutineScope") + + _, err = p.SetWatchpoint(scope, "w", proc.WatchWrite, nil) + assertNoError(err, t, "SetDataBreakpoint(write-only)") + + assertNoError(p.Continue(), t, "Continue 1") + assertLineNumber(p, t, 17, "Continue 1") // Position 1 + + p.ChangeDirection(proc.Backward) + + assertNoError(p.Continue(), t, "Continue 2") + t.Logf("%#v", p.CurrentThread().Breakpoint().Breakpoint) + assertLineNumber(p, t, 16, "Continue 2") // Position 1 again (because of inverted movement) + + assertNoError(p.Continue(), t, "Continue 3") + t.Logf("%#v", p.CurrentThread().Breakpoint().Breakpoint) + assertLineNumber(p, t, 11, "Continue 3") // Position 0 (breakpoint 1 hit) + + assertNoError(p.Continue(), t, "Continue 4") + t.Logf("%#v", p.CurrentThread().Breakpoint().Breakpoint) + assertLineNumber(p, t, 23, "Continue 4") // Position 2 (watchpoint gone out of scope) + + if len(p.Breakpoints().M) != clearlen { + t.Errorf("wrong number of breakpoints after watchpoint goes out of scope: %d", len(p.Breakpoints().M)-clearlen) + } + + if len(p.Breakpoints().WatchOutOfScope) != 1 { + t.Errorf("wrong number of out-of-scope watchpoints after watchpoint goes out of scope: %d", len(p.Breakpoints().WatchOutOfScope)) + } + + if len(p.Breakpoints().M) != clearlen { + // want 1 user breakpoint set at retaddr + t.Errorf("wrong number of breakpoints after removing user breakpoint: %d", len(p.Breakpoints().M)-clearlen) + } + }) +} + +func TestSetOnFunctions(t *testing.T) { + // The set command between function variables should fail with an error + // Issue #2691 + withTestProcess("goroutinestackprog", t, func(p *proc.Target, fixture protest.Fixture) { + setFunctionBreakpoint(p, t, "main.main") + assertNoError(p.Continue(), t, "Continue()") + scope, err := proc.GoroutineScope(p, p.CurrentThread()) + assertNoError(err, t, "GoroutineScope") + err = scope.SetVariable("main.func1", "main.func2") + if err == nil { + t.Fatal("expected error when assigning between function variables") + } + }) +} + +func TestSetYMMRegister(t *testing.T) { + skipUnlessOn(t, "N/A", "darwin", "amd64") + // Checks that setting a XMM register works. This checks that the + // workaround for a bug in debugserver works. + // See issue #2767. + withTestProcess("setymmreg/", t, func(p *proc.Target, fixture protest.Fixture) { + setFunctionBreakpoint(p, t, "main.asmFunc") + assertNoError(p.Continue(), t, "Continue()") + + getReg := func(pos string) *op.DwarfRegister { + regs := getRegisters(p, t) + + arch := p.BinInfo().Arch + dregs := arch.RegistersToDwarfRegisters(0, regs) + + r := dregs.Reg(regnum.AMD64_XMM0) + t.Logf("%s: %#v", pos, r) + return r + } + + getReg("before") + + p.CurrentThread().SetReg(regnum.AMD64_XMM0, op.DwarfRegisterFromBytes([]byte{ + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, + 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44})) + assertNoError(p.CurrentThread().StepInstruction(), t, "SetpInstruction") + + xmm0 := getReg("after") + + for i := range xmm0.Bytes { + if xmm0.Bytes[i] != 0x44 { + t.Fatalf("wrong register value") + } + } + }) +} + +func TestNilPtrDerefInBreakInstr(t *testing.T) { + // Checks that having a breakpoint on the exact instruction that causes a + // nil pointer dereference does not cause problems. + + var asmfile string + switch runtime.GOARCH { + case "amd64": + asmfile = "main_amd64.s" + case "arm64": + asmfile = "main_arm64.s" + case "386": + asmfile = "main_386.s" + default: + t.Fatalf("assembly file for %s not provided", runtime.GOARCH) + } + + withTestProcess("asmnilptr/", t, func(p *proc.Target, fixture protest.Fixture) { + f := filepath.Join(fixture.BuildDir, asmfile) + f = strings.Replace(f, "\\", "/", -1) + setFileBreakpoint(p, t, f, 5) + t.Logf("first continue") + assertNoError(p.Continue(), t, "Continue()") + t.Logf("second continue") + err := p.Continue() + if runtime.GOOS == "darwin" && err != nil && err.Error() == "bad access" { + // this is also ok + return + } + assertNoError(err, t, "Continue()") + bp := p.CurrentThread().Breakpoint() + if bp != nil { + t.Logf("%#v\n", bp.Breakpoint) + } + if bp == nil || (bp.Name != proc.UnrecoveredPanic) { + t.Fatalf("no breakpoint hit or wrong breakpoint hit: %#v", bp) + } + }) +} diff --git a/pkg/proc/proc_unexported_test.go b/pkg/proc/proc_unexported_test.go index 62327ea8f4..ce26947545 100644 --- a/pkg/proc/proc_unexported_test.go +++ b/pkg/proc/proc_unexported_test.go @@ -73,3 +73,26 @@ func TestAlignAddr(t *testing.T) { c(example.align, example.in+0x10000, example.tgt+0x10000) } } + +func TestConvertInt(t *testing.T) { + var testCases = []struct { + in uint64 + signed bool + size int64 + tgt uint64 + }{ + {1, false, 1, 1}, + {uint64(0xf0), true, 1, 0xfffffffffffffff0}, + {uint64(0xf0), false, 1, 0xf0}, + {uint64(0x70), true, 1, 0x70}, + {uint64(0x90f0), true, 2, 0xffffffffffff90f0}, + {uint64(0x90f0), false, 2, 0x90f0}, + } + for _, tc := range testCases { + out := convertInt(tc.in, tc.signed, tc.size) + t.Logf("in=%#016x signed=%v size=%d -> %#016x\n", tc.in, tc.signed, tc.size, out) + if out != tc.tgt { + t.Errorf("expected=%#016x got=%#016x\n", tc.tgt, out) + } + } +} diff --git a/pkg/proc/proc_unix_test.go b/pkg/proc/proc_unix_test.go index f19dd3baa0..74a39cc6c3 100644 --- a/pkg/proc/proc_unix_test.go +++ b/pkg/proc/proc_unix_test.go @@ -1,14 +1,21 @@ +//go:build linux || darwin // +build linux darwin package proc_test import ( "fmt" + "os" + "os/exec" + "runtime" "syscall" "testing" "time" + "golang.org/x/sys/unix" + "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/pkg/proc/native" protest "github.com/go-delve/delve/pkg/proc/test" ) @@ -30,7 +37,6 @@ func TestIssue419(t *testing.T) { // SIGINT directed at the inferior should be passed along not swallowed by delve withTestProcess("issue419", t, func(p *proc.Target, fixture protest.Fixture) { - defer close(errChan) setFunctionBreakpoint(p, t, "main.main") assertNoError(p.Continue(), t, "Continue()") resumeChan := make(chan struct{}, 1) @@ -54,6 +60,8 @@ func TestIssue419(t *testing.T) { for i := 0; i < 2; i++ { err := <-errChan + t.Logf("error %T %#v\n", err, err) + if v, ok := err.(errIssue419); ok { assertNoError(v.err, t, "syscall.Kill") continue @@ -64,3 +72,31 @@ func TestIssue419(t *testing.T) { } } } + +func TestSignalDeath(t *testing.T) { + if testBackend != "native" || runtime.GOOS != "linux" { + t.Skip("skipped on non-linux non-native backends") + } + var buildFlags protest.BuildFlags + if buildMode == "pie" { + buildFlags |= protest.BuildModePIE + } + fixture := protest.BuildFixture("loopprog", buildFlags) + cmd := exec.Command(fixture.Path) + stdout, err := cmd.StdoutPipe() + assertNoError(err, t, "StdoutPipe") + cmd.Stderr = os.Stderr + assertNoError(cmd.Start(), t, "starting fixture") + p, err := native.Attach(cmd.Process.Pid, []string{}) + assertNoError(err, t, "Attach") + stdout.Close() // target will receive SIGPIPE later on + err = p.Continue() + t.Logf("error is %v", err) + exitErr, isexited := err.(proc.ErrProcessExited) + if !isexited { + t.Fatal("did not exit") + } + if exitErr.Status != -int(unix.SIGPIPE) { + t.Fatalf("expected SIGPIPE got %d\n", exitErr.Status) + } +} diff --git a/pkg/proc/registers.go b/pkg/proc/registers.go index 22c79f6f95..83a58650f8 100644 --- a/pkg/proc/registers.go +++ b/pkg/proc/registers.go @@ -20,7 +20,6 @@ type Registers interface { TLS() uint64 // GAddr returns the address of the G variable if it is known, 0 and false otherwise GAddr() (uint64, bool) - Get(int) (uint64, error) Slice(floatingPoint bool) ([]Register, error) // Copy returns a copy of the registers that is guaranteed not to change // when the registers of the associated thread change. diff --git a/pkg/proc/scope_test.go b/pkg/proc/scope_test.go index 6435fb721e..f95a37118b 100644 --- a/pkg/proc/scope_test.go +++ b/pkg/proc/scope_test.go @@ -104,7 +104,7 @@ func TestScope(t *testing.T) { } scopeCheck.ok = true - _, err := p.ClearBreakpoint(bp.Addr) + err := p.ClearBreakpoint(bp.Addr) assertNoError(err, t, "ClearBreakpoint") } }) @@ -238,7 +238,7 @@ func (check *scopeCheck) Parse(descr string, t *testing.T) { } func (scopeCheck *scopeCheck) checkLocalsAndArgs(p *proc.Target, t *testing.T) (*proc.EvalScope, bool) { - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "GoroutineScope()") ok := true @@ -285,7 +285,7 @@ func (check *scopeCheck) checkVar(v *proc.Variable, t *testing.T) { } func (varCheck *varCheck) checkInScope(line int, scope *proc.EvalScope, t *testing.T) { - v, err := scope.EvalVariable(varCheck.name, normalLoadConfig) + v, err := scope.EvalExpression(varCheck.name, normalLoadConfig) assertNoError(err, t, fmt.Sprintf("EvalVariable(%s)", varCheck.name)) varCheck.check(line, v, t, "EvalExpression") diff --git a/pkg/proc/stack.go b/pkg/proc/stack.go index 12fc275361..9d847f4980 100644 --- a/pkg/proc/stack.go +++ b/pkg/proc/stack.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "go/constant" + "reflect" "github.com/go-delve/delve/pkg/dwarf/frame" "github.com/go-delve/delve/pkg/dwarf/op" @@ -100,18 +101,15 @@ func ThreadStacktrace(thread Thread, depth int) ([]Stackframe, error) { return nil, err } so := thread.BinInfo().PCToImage(regs.PC()) - it := newStackIterator(thread.BinInfo(), thread, thread.BinInfo().Arch.RegistersToDwarfRegisters(so.StaticBase, regs), 0, nil, -1, nil, 0) + dwarfRegs := *(thread.BinInfo().Arch.RegistersToDwarfRegisters(so.StaticBase, regs)) + dwarfRegs.ChangeFunc = thread.SetReg + it := newStackIterator(thread.BinInfo(), thread.ProcessMemory(), dwarfRegs, 0, nil, 0) return it.stacktrace(depth) } return g.Stacktrace(depth, 0) } func (g *G) stackIterator(opts StacktraceOptions) (*stackIterator, error) { - stkbar, err := g.stkbar() - if err != nil { - return nil, err - } - bi := g.variable.bi if g.Thread != nil { regs, err := g.Thread.Registers() @@ -119,16 +117,18 @@ func (g *G) stackIterator(opts StacktraceOptions) (*stackIterator, error) { return nil, err } so := bi.PCToImage(regs.PC()) + dwarfRegs := *(bi.Arch.RegistersToDwarfRegisters(so.StaticBase, regs)) + dwarfRegs.ChangeFunc = g.Thread.SetReg return newStackIterator( - bi, g.Thread, - bi.Arch.RegistersToDwarfRegisters(so.StaticBase, regs), - g.stack.hi, stkbar, g.stkbarPos, g, opts), nil + bi, g.variable.mem, + dwarfRegs, + g.stack.hi, g, opts), nil } so := g.variable.bi.PCToImage(g.PC) return newStackIterator( bi, g.variable.mem, bi.Arch.addrAndStackRegsToDwarfRegisters(so.StaticBase, g.PC, g.SP, g.BP, g.LR), - g.stack.hi, stkbar, g.stkbarPos, g, opts), nil + g.stack.hi, g, opts), nil } type StacktraceOptions uint16 @@ -183,10 +183,8 @@ type stackIterator struct { mem MemoryReadWriter err error - stackhi uint64 - systemstack bool - stackBarrierPC uint64 - stkbar []savedLR + stackhi uint64 + systemstack bool // regs is the register set for the current frame regs op.DwarfRegisters @@ -198,36 +196,12 @@ type stackIterator struct { opts StacktraceOptions } -type savedLR struct { - ptr uint64 - val uint64 -} - -func newStackIterator(bi *BinaryInfo, mem MemoryReadWriter, regs op.DwarfRegisters, stackhi uint64, stkbar []savedLR, stkbarPos int, g *G, opts StacktraceOptions) *stackIterator { - stackBarrierFunc := bi.LookupFunc["runtime.stackBarrier"] // stack barriers were removed in Go 1.9 - var stackBarrierPC uint64 - if stackBarrierFunc != nil && stkbar != nil { - stackBarrierPC = stackBarrierFunc.Entry - fn := bi.PCToFunc(regs.PC()) - if fn != nil && fn.Name == "runtime.stackBarrier" { - // We caught the goroutine as it's executing the stack barrier, we must - // determine whether or not g.stackPos has already been incremented or not. - if len(stkbar) > 0 && stkbar[stkbarPos].ptr < regs.SP() { - // runtime.stackBarrier has not incremented stkbarPos. - } else if stkbarPos > 0 && stkbar[stkbarPos-1].ptr < regs.SP() { - // runtime.stackBarrier has incremented stkbarPos. - stkbarPos-- - } else { - return &stackIterator{err: fmt.Errorf("failed to unwind through stackBarrier at SP %x", regs.SP())} - } - } - stkbar = stkbar[stkbarPos:] - } +func newStackIterator(bi *BinaryInfo, mem MemoryReadWriter, regs op.DwarfRegisters, stackhi uint64, g *G, opts StacktraceOptions) *stackIterator { systemstack := true if g != nil { systemstack = g.SystemStack } - return &stackIterator{pc: regs.PC(), regs: regs, top: true, bi: bi, mem: mem, err: nil, atend: false, stackhi: stackhi, stackBarrierPC: stackBarrierPC, stkbar: stkbar, systemstack: systemstack, g: g, opts: opts} + return &stackIterator{pc: regs.PC(), regs: regs, top: true, bi: bi, mem: mem, err: nil, atend: false, stackhi: stackhi, systemstack: systemstack, g: g, opts: opts} } // Next points the iterator to the next stack frame. @@ -239,12 +213,6 @@ func (it *stackIterator) Next() bool { callFrameRegs, ret, retaddr := it.advanceRegs() it.frame = it.newStackframe(ret, retaddr) - if it.stkbar != nil && it.frame.Ret == it.stackBarrierPC && it.frame.addrret == it.stkbar[0].ptr { - // Skip stack barrier frames - it.frame.Ret = it.stkbar[0].val - it.stkbar = it.stkbar[1:] - } - if it.opts&StacktraceSimple == 0 { if it.bi.Arch.switchStack(it, &callFrameRegs) { return true @@ -291,7 +259,7 @@ func (it *stackIterator) frameBase(fn *Function) int64 { if err != nil { return 0 } - fb, _, _, _ := it.bi.Location(dwarfTree.Entry, dwarf.AttrFrameBase, it.pc, it.regs) + fb, _, _, _ := it.bi.Location(dwarfTree.Entry, dwarf.AttrFrameBase, it.pc, it.regs, it.mem) return fb } @@ -308,6 +276,9 @@ func (it *stackIterator) newStackframe(ret, retaddr uint64) Stackframe { it.regs.FrameBase = it.frameBase(fn) } r := Stackframe{Current: Location{PC: it.pc, File: f, Line: l, Fn: fn}, Regs: it.regs, Ret: ret, addrret: retaddr, stackHi: it.stackhi, SystemStack: it.systemstack, lastpc: it.pc} + if r.Regs.Reg(it.regs.PCRegNum) == nil { + r.Regs.AddReg(it.regs.PCRegNum, op.DwarfRegisterFromUint64(it.pc)) + } r.Call = r.Current if !it.top && r.Current.Fn != nil && it.pc != r.Current.Fn.Entry { // if the return address is the entry point of the function that @@ -377,7 +348,9 @@ func (it *stackIterator) appendInlineCalls(frames []Stackframe, frame Stackframe if !okname || !okfileidx || !okline { break } - if fileidx-1 < 0 || fileidx-1 >= int64(len(frame.Current.Fn.cu.lineInfo.FileNames)) { + var e *dwarf.Entry + filepath, fileErr := frame.Current.Fn.cu.filePath(int(fileidx), e) + if fileErr != nil { break } @@ -400,16 +373,22 @@ func (it *stackIterator) appendInlineCalls(frames []Stackframe, frame Stackframe lastpc: frame.lastpc, }) - frame.Call.File = frame.Current.Fn.cu.lineInfo.FileNames[fileidx-1].Path + frame.Call.File = filepath frame.Call.Line = int(line) } return append(frames, frame) } -// advanceRegs calculates it.callFrameRegs using it.regs and the frame -// descriptor entry for the current stack frame. -// it.regs.CallFrameCFA is updated. +// advanceRegs calculates the DwarfRegisters for a next stack frame +// (corresponding to it.pc). +// +// The computation uses the registers for the current stack frame (it.regs) and +// the corresponding Frame Descriptor Entry (FDE) retrieved from the DWARF info. +// +// The new set of registers is returned. it.regs is not updated, except for +// it.regs.CFA; the caller has to eventually switch it.regs when the iterator +// advances to the next frame. func (it *stackIterator) advanceRegs() (callFrameRegs op.DwarfRegisters, ret uint64, retaddr uint64) { fde, err := it.bi.frameEntries.FDEForPC(it.pc) var framectx *frame.FrameContext @@ -421,7 +400,7 @@ func (it *stackIterator) advanceRegs() (callFrameRegs op.DwarfRegisters, ret uin cfareg, err := it.executeFrameRegRule(0, framectx.CFA, 0) if cfareg == nil { - it.err = fmt.Errorf("CFA becomes undefined at PC %#x", it.pc) + it.err = fmt.Errorf("CFA becomes undefined at PC %#x: %v", it.pc, err) return op.DwarfRegisters{}, 0, 0 } it.regs.CFA = int64(cfareg.Uint64Val) @@ -445,6 +424,7 @@ func (it *stackIterator) advanceRegs() (callFrameRegs op.DwarfRegisters, ret uin if i == framectx.RetAddrReg { if reg == nil { if err == nil { + //lint:ignore ST1005 backwards compatibility err = fmt.Errorf("Undefined return address at %#x", it.pc) } it.err = err @@ -483,13 +463,13 @@ func (it *stackIterator) executeFrameRegRule(regnum uint64, rule frame.DWRule, c case frame.RuleRegister: return it.regs.Reg(rule.Reg), nil case frame.RuleExpression: - v, _, err := op.ExecuteStackProgram(it.regs, rule.Expression, it.bi.Arch.PtrSize()) + v, _, err := op.ExecuteStackProgram(it.regs, rule.Expression, it.bi.Arch.PtrSize(), it.mem.ReadMemory) if err != nil { return nil, err } return it.readRegisterAt(regnum, uint64(v)) case frame.RuleValExpression: - v, _, err := op.ExecuteStackProgram(it.regs, rule.Expression, it.bi.Arch.PtrSize()) + v, _, err := op.ExecuteStackProgram(it.regs, rule.Expression, it.bi.Arch.PtrSize(), it.mem.ReadMemory) if err != nil { return nil, err } @@ -516,7 +496,7 @@ func (it *stackIterator) executeFrameRegRule(regnum uint64, rule frame.DWRule, c func (it *stackIterator) readRegisterAt(regnum uint64, addr uint64) (*op.DwarfRegister, error) { buf := make([]byte, it.bi.Arch.regSize(regnum)) - _, err := it.mem.ReadMemory(buf, uintptr(addr)) + _, err := it.mem.ReadMemory(buf, addr) if err != nil { return nil, err } @@ -544,11 +524,11 @@ func (it *stackIterator) loadG0SchedSP() { // Defer represents one deferred call type Defer struct { - DeferredPC uint64 // Value of field _defer.fn.fn, the deferred function - DeferPC uint64 // PC address of instruction that added this defer - SP uint64 // Value of SP register when this function was deferred (this field gets adjusted when the stack is moved to match the new stack space) - link *Defer // Next deferred function - argSz int64 + DwrapPC uint64 // PC of the deferred function or, in Go 1.17+ a wrapper to it + DeferPC uint64 // PC address of instruction that added this defer + SP uint64 // Value of SP register when this function was deferred (this field gets adjusted when the stack is moved to match the new stack space) + link *Defer // Next deferred function + argSz int64 // Always 0 in Go >=1.17 variable *Variable Unreadable error @@ -599,25 +579,37 @@ func (g *G) readDefers(frames []Stackframe) { } func (d *Defer) load() { - d.variable.loadValue(LoadConfig{false, 1, 0, 0, -1, 0}) - if d.variable.Unreadable != nil { - d.Unreadable = d.variable.Unreadable + v := d.variable // +rtype _defer + v.loadValue(LoadConfig{false, 1, 0, 0, -1, 0}) + if v.Unreadable != nil { + d.Unreadable = v.Unreadable return } - fnvar := d.variable.fieldVariable("fn").maybeDereference() - if fnvar.Addr != 0 { + fnvar := v.fieldVariable("fn") + if fnvar.Kind == reflect.Func { + // In Go 1.18, fn is a func(). + d.DwrapPC = fnvar.Base + } else if val := fnvar.maybeDereference(); val.Addr != 0 { + // In Go <1.18, fn is a *funcval. fnvar = fnvar.loadFieldNamed("fn") if fnvar.Unreadable == nil { - d.DeferredPC, _ = constant.Uint64Val(fnvar.Value) + d.DwrapPC, _ = constant.Uint64Val(fnvar.Value) } } - d.DeferPC, _ = constant.Uint64Val(d.variable.fieldVariable("pc").Value) - d.SP, _ = constant.Uint64Val(d.variable.fieldVariable("sp").Value) - d.argSz, _ = constant.Int64Val(d.variable.fieldVariable("siz").Value) + d.DeferPC, _ = constant.Uint64Val(v.fieldVariable("pc").Value) // +rtype uintptr + d.SP, _ = constant.Uint64Val(v.fieldVariable("sp").Value) // +rtype uintptr + sizVar := v.fieldVariable("siz") // +rtype -opt int32 + if sizVar != nil { + // In Go <1.18, siz stores the number of bytes of + // defer arguments following the defer record. In Go + // 1.18, the defer record doesn't store arguments, so + // we leave this 0. + d.argSz, _ = constant.Int64Val(sizVar.Value) + } - linkvar := d.variable.fieldVariable("link").maybeDereference() + linkvar := v.fieldVariable("link").maybeDereference() // +rtype *_defer if linkvar.Addr != 0 { d.link = &Defer{variable: linkvar} } @@ -645,28 +637,38 @@ func (d *Defer) Next() *Defer { // EvalScope returns an EvalScope relative to the argument frame of this deferred call. // The argument frame of a deferred call is stored in memory immediately // after the deferred header. -func (d *Defer) EvalScope(thread Thread) (*EvalScope, error) { - scope, err := GoroutineScope(thread) +func (d *Defer) EvalScope(t *Target, thread Thread) (*EvalScope, error) { + scope, err := GoroutineScope(t, thread) if err != nil { return nil, fmt.Errorf("could not get scope: %v", err) } bi := thread.BinInfo() - scope.PC = d.DeferredPC - scope.File, scope.Line, scope.Fn = bi.PCToLine(d.DeferredPC) + scope.PC = d.DwrapPC + scope.File, scope.Line, scope.Fn = bi.PCToLine(d.DwrapPC) if scope.Fn == nil { - return nil, fmt.Errorf("could not find function at %#x", d.DeferredPC) + return nil, fmt.Errorf("could not find function at %#x", d.DwrapPC) } // The arguments are stored immediately after the defer header struct, i.e. - // addr+sizeof(_defer). Since CFA in go is always the address of the first - // argument, that's what we use for the value of CFA. - // For SP we use CFA minus the size of one pointer because that would be - // the space occupied by pushing the return address on the stack during the - // CALL. - scope.Regs.CFA = (int64(d.variable.Addr) + d.variable.RealType.Common().ByteSize) - scope.Regs.Reg(scope.Regs.SPRegNum).Uint64Val = uint64(scope.Regs.CFA - int64(bi.Arch.PtrSize())) + // addr+sizeof(_defer). + + if !bi.Arch.usesLR { + // On architectures that don't have a link register CFA is always the address of the first + // argument, that's what we use for the value of CFA. + // For SP we use CFA minus the size of one pointer because that would be + // the space occupied by pushing the return address on the stack during the + // CALL. + scope.Regs.CFA = (int64(d.variable.Addr) + d.variable.RealType.Common().ByteSize) + scope.Regs.Reg(scope.Regs.SPRegNum).Uint64Val = uint64(scope.Regs.CFA - int64(bi.Arch.PtrSize())) + } else { + // On architectures that have a link register CFA and SP have the same + // value but the address of the first argument is at CFA+ptrSize so we set + // CFA to the start of the argument frame minus one pointer size. + scope.Regs.CFA = int64(d.variable.Addr) + d.variable.RealType.Common().ByteSize - int64(bi.Arch.PtrSize()) + scope.Regs.Reg(scope.Regs.SPRegNum).Uint64Val = uint64(scope.Regs.CFA) + } rdr := scope.Fn.cu.image.dwarfReader rdr.Seek(scope.Fn.offset) @@ -674,8 +676,21 @@ func (d *Defer) EvalScope(thread Thread) (*EvalScope, error) { if err != nil { return nil, fmt.Errorf("could not read DWARF function entry: %v", err) } - scope.Regs.FrameBase, _, _, _ = bi.Location(e, dwarf.AttrFrameBase, scope.PC, scope.Regs) - scope.Mem = cacheMemory(scope.Mem, uintptr(scope.Regs.CFA), int(d.argSz)) + scope.Regs.FrameBase, _, _, _ = bi.Location(e, dwarf.AttrFrameBase, scope.PC, scope.Regs, scope.Mem) + scope.Mem = cacheMemory(scope.Mem, uint64(scope.Regs.CFA), int(d.argSz)) return scope, nil } + +// DeferredFunc returns the deferred function, on Go 1.17 and later unwraps +// any defer wrapper. +func (d *Defer) DeferredFunc(p *Target) (file string, line int, fn *Function) { + bi := p.BinInfo() + fn = bi.PCToFunc(d.DwrapPC) + fn = p.dwrapUnwrap(fn) + if fn == nil { + return "", 0, nil + } + file, line = fn.cu.lineInfo.PCToLine(fn.Entry, fn.Entry) + return file, line, fn +} diff --git a/pkg/proc/stackwatch.go b/pkg/proc/stackwatch.go new file mode 100644 index 0000000000..2b33f70ff9 --- /dev/null +++ b/pkg/proc/stackwatch.go @@ -0,0 +1,192 @@ +package proc + +import ( + "errors" + + "github.com/go-delve/delve/pkg/astutil" + "github.com/go-delve/delve/pkg/logflags" +) + +// This file implements most of the details needed to support stack +// watchpoints. Some of the remaining details are in breakpoints, along with +// the code to support non-stack allocated watchpoints. +// +// In Go goroutine stacks start small and are frequently resized by the +// runtime according to the needs of the goroutine. +// To support this behavior we create a StackResizeBreakpoint, deep inside +// the Go runtime, when this breakpoint is hit all the stack watchpoints on +// the goroutine being resized are adjusted for the new stack. +// Furthermore, we need to detect when a goroutine leaves the stack frame +// where the variable we are watching was declared, so that we can notify +// the user that the variable went out of scope and clear the watchpoint. +// +// These breakpoints are created by setStackWatchBreakpoints and cleared by +// clearStackWatchBreakpoints. + +// setStackWatchBreakpoints sets the out of scope sentinel breakpoints for +// watchpoint and a stack resize breakpoint. +func (t *Target) setStackWatchBreakpoints(scope *EvalScope, watchpoint *Breakpoint) error { + // Watchpoint Out-of-scope Sentinel + + woos := func(_ Thread) bool { + watchpointOutOfScope(t, watchpoint) + return true + } + + topframe, retframe, err := topframe(scope.g, nil) + if err != nil { + return err + } + + sameGCond := sameGoroutineCondition(scope.g) + retFrameCond := astutil.And(sameGCond, frameoffCondition(&retframe)) + + var deferpc uint64 + if topframe.TopmostDefer != nil { + _, _, deferfn := topframe.TopmostDefer.DeferredFunc(t) + if deferfn != nil { + var err error + deferpc, err = FirstPCAfterPrologue(t, deferfn, false) + if err != nil { + return err + } + } + } + if deferpc != 0 && deferpc != topframe.Current.PC { + deferbp, err := t.SetBreakpoint(deferpc, WatchOutOfScopeBreakpoint, sameGCond) + if err != nil { + return err + } + deferbreaklet := deferbp.Breaklets[len(deferbp.Breaklets)-1] + deferbreaklet.checkPanicCall = true + deferbreaklet.watchpoint = watchpoint + deferbreaklet.callback = woos + } + + retbp, err := t.SetBreakpoint(retframe.Current.PC, WatchOutOfScopeBreakpoint, retFrameCond) + if err != nil { + return err + } + + retbreaklet := retbp.Breaklets[len(retbp.Breaklets)-1] + retbreaklet.watchpoint = watchpoint + retbreaklet.callback = woos + + if recorded, _ := t.Recorded(); recorded && retframe.Current.Fn != nil { + // Must also set a breakpoint on the call instruction immediately + // preceding retframe.Current.PC, because the watchpoint could also go out + // of scope while we are running backwards. + callerText, err := disassemble(t.Memory(), nil, t.Breakpoints(), t.BinInfo(), retframe.Current.Fn.Entry, retframe.Current.Fn.End, false) + if err != nil { + return err + } + for i, instr := range callerText { + if instr.Loc.PC == retframe.Current.PC && i > 0 { + retbp2, err := t.SetBreakpoint(callerText[i-1].Loc.PC, WatchOutOfScopeBreakpoint, retFrameCond) + if err != nil { + return err + } + retbreaklet2 := retbp2.Breaklets[len(retbp.Breaklets)-1] + retbreaklet2.watchpoint = watchpoint + retbreaklet2.callback = woos + break + } + } + } + + // Stack Resize Sentinel + + fn := t.BinInfo().LookupFunc["runtime.copystack"] + if fn == nil { + return errors.New("could not find runtime.copystack") + } + text, err := Disassemble(t.Memory(), nil, t.Breakpoints(), t.BinInfo(), fn.Entry, fn.End) + if err != nil { + return err + } + var retpc uint64 + for _, instr := range text { + if instr.IsRet() { + if retpc != 0 { + return errors.New("runtime.copystack has too many return instructions") + } + retpc = instr.Loc.PC + } + } + if retpc == 0 { + return errors.New("could not find return instruction in runtime.copystack") + } + rszbp, err := t.SetBreakpoint(retpc, StackResizeBreakpoint, sameGCond) + if err != nil { + return err + } + + rszbreaklet := rszbp.Breaklets[len(rszbp.Breaklets)-1] + rszbreaklet.watchpoint = watchpoint + rszbreaklet.callback = func(th Thread) bool { + adjustStackWatchpoint(t, th, watchpoint) + return false // we never want this breakpoint to be shown to the user + } + + return nil +} + +// clearStackWatchBreakpoints clears all accessory breakpoints for +// watchpoint. +func (t *Target) clearStackWatchBreakpoints(watchpoint *Breakpoint) error { + bpmap := t.Breakpoints() + for _, bp := range bpmap.M { + changed := false + for i, breaklet := range bp.Breaklets { + if breaklet.watchpoint == watchpoint { + bp.Breaklets[i] = nil + changed = true + } + } + if changed { + _, err := t.finishClearBreakpoint(bp) + if err != nil { + return err + } + } + } + return nil +} + +// watchpointOutOfScope is called when the watchpoint goes out of scope. It +// is used as a breaklet callback function. +// Its responsibility is to delete the watchpoint and make sure that the +// user is notified of the watchpoint going out of scope. +func watchpointOutOfScope(t *Target, watchpoint *Breakpoint) { + t.Breakpoints().WatchOutOfScope = append(t.Breakpoints().WatchOutOfScope, watchpoint) + err := t.ClearBreakpoint(watchpoint.Addr) + if err != nil { + log := logflags.DebuggerLogger() + log.Errorf("could not clear out-of-scope watchpoint: %v", err) + } +} + +// adjustStackWatchpoint is called when the goroutine of watchpoint resizes +// its stack. It is used as a breaklet callback function. +// Its responsibility is to move the watchpoint to a its new address. +func adjustStackWatchpoint(t *Target, th Thread, watchpoint *Breakpoint) { + g, _ := GetG(th) + if g == nil { + return + } + err := t.proc.EraseBreakpoint(watchpoint) + if err != nil { + log := logflags.DebuggerLogger() + log.Errorf("could not adjust watchpoint at %#x: %v", watchpoint.Addr, err) + return + } + delete(t.Breakpoints().M, watchpoint.Addr) + watchpoint.Addr = uint64(int64(g.stack.hi) + watchpoint.watchStackOff) + err = t.proc.WriteBreakpoint(watchpoint) + if err != nil { + log := logflags.DebuggerLogger() + log.Errorf("could not adjust watchpoint at %#x: %v", watchpoint.Addr, err) + return + } + t.Breakpoints().M[watchpoint.Addr] = watchpoint +} diff --git a/pkg/proc/target.go b/pkg/proc/target.go index 9711275ed8..13ba66709f 100644 --- a/pkg/proc/target.go +++ b/pkg/proc/target.go @@ -5,9 +5,12 @@ import ( "fmt" "go/constant" "os" + "sort" "strings" + "github.com/go-delve/delve/pkg/dwarf/op" "github.com/go-delve/delve/pkg/goversion" + "github.com/go-delve/delve/pkg/proc/internal/ebpf" ) var ( @@ -23,17 +26,38 @@ var ( ErrProcessDetached = errors.New("detached from the process") ) +type LaunchFlags uint8 + +const ( + LaunchForeground LaunchFlags = 1 << iota + LaunchDisableASLR +) + // Target represents the process being debugged. type Target struct { Process + RecordingManipulation + + proc ProcessInternal + recman RecordingManipulationInternal - proc ProcessInternal + pid int // StopReason describes the reason why the target process is stopped. // A process could be stopped for multiple simultaneous reasons, in which // case only one will be reported. StopReason StopReason + // CanDump is true if core dumping is supported. + CanDump bool + + // KeepSteppingBreakpoints determines whether certain stop reasons (e.g. manual halts) + // will keep the stepping breakpoints instead of clearing them. + KeepSteppingBreakpoints KeepSteppingBreakpoints + + // currentThread is the thread that will be used by next/step/stepout and to evaluate variables if no goroutine is selected. + currentThread Thread + // Goroutine that will be used by default to set breakpoint, eval variables, etc... // Normally selectedGoroutine is currentThread.GetG, it will not be only if SwitchGoroutine is called with a goroutine that isn't attached to a thread selectedGoroutine *G @@ -48,8 +72,26 @@ type Target struct { // have read and parsed from the targets memory. // This must be cleared whenever the target is resumed. gcache goroutineCache + iscgo *bool + + // exitStatus is the exit status of the process we are debugging. + // Saved here to relay to any future commands. + exitStatus int + + // fakeMemoryRegistry contains the list of all compositeMemory objects + // created since the last restart, it exists so that registerized variables + // can be given a unique address. + fakeMemoryRegistry []*compositeMemory + fakeMemoryRegistryMap map[string]*compositeMemory } +type KeepSteppingBreakpoints uint8 + +const ( + HaltKeepsSteppingBreakpoints KeepSteppingBreakpoints = 1 << iota + TracepointKeepsSteppingBreakpoints +) + // ErrProcessExited indicates that the process has exited and contains both // process id and exit status. type ErrProcessExited struct { @@ -66,6 +108,34 @@ func (pe ErrProcessExited) Error() string { // case only one will be reported. type StopReason uint8 +// String maps StopReason to string representation. +func (sr StopReason) String() string { + switch sr { + case StopUnknown: + return "unknown" + case StopLaunched: + return "launched" + case StopAttached: + return "attached" + case StopExited: + return "exited" + case StopBreakpoint: + return "breakpoint" + case StopHardcodedBreakpoint: + return "hardcoded breakpoint" + case StopManual: + return "manual" + case StopNextFinished: + return "next finished" + case StopCallReturned: + return "call returned" + case StopWatchpoint: + return "watchpoint" + default: + return "" + } +} + const ( StopUnknown StopReason = iota StopLaunched // The process was just launched @@ -74,8 +144,9 @@ const ( StopBreakpoint // The target process hit one or more software breakpoints StopHardcodedBreakpoint // The target process hit a hardcoded breakpoint (for example runtime.Breakpoint()) StopManual // A manual stop was requested - StopNextFinished // The next/step/stepout command terminated + StopNextFinished // The next/step/stepout/stepInstruction command terminated StopCallReturned // An injected call completed + StopWatchpoint // The target process hit one or more watchpoints ) // NewTargetConfig contains the configuration for a new Target object, @@ -84,6 +155,7 @@ type NewTargetConfig struct { DebugInfoDirs []string // Directories to search for split debug info DisableAsyncPreempt bool // Go 1.14 asynchronous preemption should be disabled StopReason StopReason // Initial stop reason + CanDump bool // Can create core dumps (must implement ProcessInternal.MemoryMap) } // DisableAsyncPreemptEnv returns a process environment (like os.Environ) @@ -101,7 +173,8 @@ func DisableAsyncPreemptEnv() []string { } // NewTarget returns an initialized Target object. -func NewTarget(p Process, cfg NewTargetConfig) (*Target, error) { +// The p argument can optionally implement the RecordingManipulation interface. +func NewTarget(p ProcessInternal, pid int, currentThread Thread, cfg NewTargetConfig) (*Target, error) { entryPoint, err := p.EntryPoint() if err != nil { return nil, err @@ -118,19 +191,30 @@ func NewTarget(p Process, cfg NewTargetConfig) (*Target, error) { } t := &Target{ - Process: p, - proc: p.(ProcessInternal), - fncallForG: make(map[int]*callInjection), - StopReason: cfg.StopReason, + Process: p, + proc: p, + fncallForG: make(map[int]*callInjection), + StopReason: cfg.StopReason, + currentThread: currentThread, + CanDump: cfg.CanDump, + pid: pid, } - g, _ := GetG(p.CurrentThread()) + if recman, ok := p.(RecordingManipulationInternal); ok { + t.recman = recman + } else { + t.recman = &dummyRecordingManipulation{} + } + t.RecordingManipulation = t.recman + + g, _ := GetG(currentThread) t.selectedGoroutine = g t.createUnrecoveredPanicBreakpoint() t.createFatalThrowBreakpoint() t.gcache.init(p.BinInfo()) + t.fakeMemoryRegistryMap = make(map[string]*compositeMemory) if cfg.DisableAsyncPreempt { setAsyncPreemptOff(t, 1) @@ -139,20 +223,55 @@ func NewTarget(p Process, cfg NewTargetConfig) (*Target, error) { return t, nil } +// Pid returns the pid of the target process. +func (t *Target) Pid() int { + return t.pid +} + +// IsCgo returns the value of runtime.iscgo +func (t *Target) IsCgo() bool { + if t.iscgo != nil { + return *t.iscgo + } + scope := globalScope(t, t.BinInfo(), t.BinInfo().Images[0], t.Memory()) + iscgov, err := scope.findGlobal("runtime", "iscgo") + if err == nil { + iscgov.loadValue(loadFullValue) + if iscgov.Unreadable == nil { + t.iscgo = new(bool) + *t.iscgo = constant.BoolVal(iscgov.Value) + return constant.BoolVal(iscgov.Value) + } + } + return false +} + +// Valid returns true if this Process can be used. When it returns false it +// also returns an error describing why the Process is invalid (either +// ErrProcessExited or ErrProcessDetached). +func (t *Target) Valid() (bool, error) { + ok, err := t.proc.Valid() + if !ok && err != nil { + if pe, ok := err.(ErrProcessExited); ok { + pe.Status = t.exitStatus + err = pe + } + } + return ok, err +} + // SupportsFunctionCalls returns whether or not the backend supports // calling functions during a debug session. // Currently only non-recorded processes running on AMD64 support // function calls. func (t *Target) SupportsFunctionCalls() bool { - if ok, _ := t.Process.Recorded(); ok { - return false - } return t.Process.BinInfo().Arch.Name == "amd64" } -// ClearAllGCache clears the internal Goroutine cache. +// ClearCaches clears internal caches that should not survive a restart. // This should be called anytime the target process executes instructions. -func (t *Target) ClearAllGCache() { +func (t *Target) ClearCaches() { + t.clearFakeMemory() t.gcache.Clear() for _, thread := range t.ThreadList() { thread.Common().g = nil @@ -163,11 +282,12 @@ func (t *Target) ClearAllGCache() { // This is only useful for recorded targets. // Restarting of a normal process happens at a higher level (debugger.Restart). func (t *Target) Restart(from string) error { - t.ClearAllGCache() - err := t.proc.Restart(from) + t.ClearCaches() + currentThread, err := t.recman.Restart(from) if err != nil { return err } + t.currentThread = currentThread t.selectedGoroutine, _ = GetG(t.CurrentThread()) if from != "" { t.StopReason = StopManual @@ -203,7 +323,7 @@ func (p *Target) SwitchThread(tid int) error { return err } if th, ok := p.FindThread(tid); ok { - p.proc.SetCurrentThread(th) + p.currentThread = th p.selectedGoroutine, _ = GetG(p.CurrentThread()) return nil } @@ -221,7 +341,7 @@ func (t *Target) Detach(kill bool) error { } for _, bp := range t.Breakpoints().M { if bp != nil { - _, err := t.ClearBreakpoint(bp.Addr) + err := t.ClearBreakpoint(bp.Addr) if err != nil { return err } @@ -240,13 +360,14 @@ func setAsyncPreemptOff(p *Target, v int64) { return } logger := p.BinInfo().logger - scope := globalScope(p.BinInfo(), p.BinInfo().Images[0], p.CurrentThread()) + scope := globalScope(p, p.BinInfo(), p.BinInfo().Images[0], p.Memory()) + // +rtype -var debug anytype debugv, err := scope.findGlobal("runtime", "debug") if err != nil || debugv.Unreadable != nil { logger.Warnf("could not find runtime/debug variable (or unreadable): %v %v", err, debugv.Unreadable) return } - asyncpreemptoffv, err := debugv.structMember("asyncpreemptoff") + asyncpreemptoffv, err := debugv.structMember("asyncpreemptoff") // +rtype int32 if err != nil { logger.Warnf("could not find asyncpreemptoff field: %v", err) return @@ -260,7 +381,9 @@ func setAsyncPreemptOff(p *Target, v int64) { p.asyncPreemptOff, _ = constant.Int64Val(asyncpreemptoffv.Value) err = scope.setValue(asyncpreemptoffv, newConstant(constant.MakeInt64(v), scope.Mem), "") - logger.Warnf("could not set asyncpreemptoff %v", err) + if err != nil { + logger.Warnf("could not set asyncpreemptoff %v", err) + } } // createUnrecoveredPanicBreakpoint creates the unrecoverable-panic breakpoint. @@ -270,7 +393,7 @@ func (t *Target) createUnrecoveredPanicBreakpoint() { panicpcs, err = FindFunctionLocation(t.Process, "runtime.fatalpanic", 0) } if err == nil { - bp, err := t.setBreakpointWithID(unrecoveredPanicID, panicpcs[0]) + bp, err := t.SetBreakpointWithID(unrecoveredPanicID, panicpcs[0]) if err == nil { bp.Name = UnrecoveredPanic bp.Variables = []string{"runtime.curg._panic.arg"} @@ -280,11 +403,199 @@ func (t *Target) createUnrecoveredPanicBreakpoint() { // createFatalThrowBreakpoint creates the a breakpoint as runtime.fatalthrow. func (t *Target) createFatalThrowBreakpoint() { - fatalpcs, err := FindFunctionLocation(t.Process, "runtime.fatalthrow", 0) + fatalpcs, err := FindFunctionLocation(t.Process, "runtime.throw", 0) if err == nil { - bp, err := t.setBreakpointWithID(fatalThrowID, fatalpcs[0]) + bp, err := t.SetBreakpointWithID(fatalThrowID, fatalpcs[0]) if err == nil { bp.Name = FatalThrow } } } + +// CurrentThread returns the currently selected thread which will be used +// for next/step/stepout and for reading variables, unless a goroutine is +// selected. +func (t *Target) CurrentThread() Thread { + return t.currentThread +} + +type UProbeTraceResult struct { + FnAddr int + GoroutineID int + InputParams []*Variable + ReturnParams []*Variable +} + +func (t *Target) GetBufferedTracepoints() []*UProbeTraceResult { + var results []*UProbeTraceResult + tracepoints := t.proc.GetBufferedTracepoints() + convertInputParamToVariable := func(ip *ebpf.RawUProbeParam) *Variable { + v := &Variable{} + v.RealType = ip.RealType + v.Len = ip.Len + v.Base = ip.Base + v.Addr = ip.Addr + v.Kind = ip.Kind + + cachedMem := CreateLoadedCachedMemory(ip.Data) + compMem, _ := CreateCompositeMemory(cachedMem, t.BinInfo().Arch, op.DwarfRegisters{}, ip.Pieces) + v.mem = compMem + + // Load the value here so that we don't have to export + // loadValue outside of proc. + v.loadValue(loadFullValue) + + return v + } + for _, tp := range tracepoints { + r := &UProbeTraceResult{} + r.FnAddr = tp.FnAddr + r.GoroutineID = tp.GoroutineID + for _, ip := range tp.InputParams { + v := convertInputParamToVariable(ip) + r.InputParams = append(r.InputParams, v) + } + for _, ip := range tp.ReturnParams { + v := convertInputParamToVariable(ip) + r.ReturnParams = append(r.ReturnParams, v) + } + results = append(results, r) + } + return results +} + +// SetNextBreakpointID sets the breakpoint ID of the next breakpoint +func (t *Target) SetNextBreakpointID(id int) { + t.Breakpoints().breakpointIDCounter = id +} + +const ( + FakeAddressBase = 0xbeef000000000000 + fakeAddressUnresolv = 0xbeed000000000000 // this address never resloves to memory +) + +// newCompositeMemory creates a new compositeMemory object and registers it. +// If the same composite memory has been created before it will return a +// cached object. +// This caching is primarily done so that registerized variables don't get a +// different address every time they are evaluated, which would be confusing +// and leak memory. +func (t *Target) newCompositeMemory(mem MemoryReadWriter, regs op.DwarfRegisters, pieces []op.Piece, descr *locationExpr) (int64, *compositeMemory, error) { + var key string + if regs.CFA != 0 && len(pieces) > 0 { + // key is created by concatenating the location expression with the CFA, + // this combination is guaranteed to be unique between resumes. + buf := new(strings.Builder) + fmt.Fprintf(buf, "%#x ", regs.CFA) + op.PrettyPrint(buf, descr.instr) + key = buf.String() + + if cmem := t.fakeMemoryRegistryMap[key]; cmem != nil { + return int64(cmem.base), cmem, nil + } + } + + cmem, err := newCompositeMemory(mem, t.BinInfo().Arch, regs, pieces) + if err != nil { + return 0, cmem, err + } + t.registerFakeMemory(cmem) + if key != "" { + t.fakeMemoryRegistryMap[key] = cmem + } + return int64(cmem.base), cmem, nil +} + +func (t *Target) registerFakeMemory(mem *compositeMemory) (addr uint64) { + t.fakeMemoryRegistry = append(t.fakeMemoryRegistry, mem) + addr = FakeAddressBase + if len(t.fakeMemoryRegistry) > 1 { + prevMem := t.fakeMemoryRegistry[len(t.fakeMemoryRegistry)-2] + addr = uint64(alignAddr(int64(prevMem.base+uint64(len(prevMem.data))), 0x100)) // the call to alignAddr just makes the address look nicer, it is not necessary + } + mem.base = addr + return addr +} + +func (t *Target) findFakeMemory(addr uint64) *compositeMemory { + i := sort.Search(len(t.fakeMemoryRegistry), func(i int) bool { + mem := t.fakeMemoryRegistry[i] + return addr <= mem.base || (mem.base <= addr && addr < (mem.base+uint64(len(mem.data)))) + }) + if i != len(t.fakeMemoryRegistry) { + mem := t.fakeMemoryRegistry[i] + if mem.base <= addr && addr < (mem.base+uint64(len(mem.data))) { + return mem + } + } + return nil +} + +func (t *Target) clearFakeMemory() { + for i := range t.fakeMemoryRegistry { + t.fakeMemoryRegistry[i] = nil + } + t.fakeMemoryRegistry = t.fakeMemoryRegistry[:0] + t.fakeMemoryRegistryMap = make(map[string]*compositeMemory) +} + +// dwrapUnwrap checks if fn is a dwrap wrapper function and unwraps it if it is. +func (t *Target) dwrapUnwrap(fn *Function) *Function { + if fn == nil { + return nil + } + if !strings.Contains(fn.Name, "·dwrap·") && !fn.trampoline { + return fn + } + if unwrap := t.BinInfo().dwrapUnwrapCache[fn.Entry]; unwrap != nil { + return unwrap + } + text, err := disassemble(t.Memory(), nil, t.Breakpoints(), t.BinInfo(), fn.Entry, fn.End, false) + if err != nil { + return fn + } + for _, instr := range text { + if instr.IsCall() && instr.DestLoc != nil && instr.DestLoc.Fn != nil && !instr.DestLoc.Fn.privateRuntime() { + t.BinInfo().dwrapUnwrapCache[fn.Entry] = instr.DestLoc.Fn + return instr.DestLoc.Fn + } + } + return fn +} + +type dummyRecordingManipulation struct { +} + +// Recorded always returns false for the native proc backend. +func (*dummyRecordingManipulation) Recorded() (bool, string) { return false, "" } + +// ChangeDirection will always return an error in the native proc backend, only for +// recorded traces. +func (*dummyRecordingManipulation) ChangeDirection(dir Direction) error { + if dir != Forward { + return ErrNotRecorded + } + return nil +} + +// GetDirection will always return Forward. +func (*dummyRecordingManipulation) GetDirection() Direction { return Forward } + +// When will always return an empty string and nil, not supported on native proc backend. +func (*dummyRecordingManipulation) When() (string, error) { return "", nil } + +// Checkpoint will always return an error on the native proc backend, +// only supported for recorded traces. +func (*dummyRecordingManipulation) Checkpoint(string) (int, error) { return -1, ErrNotRecorded } + +// Checkpoints will always return an error on the native proc backend, +// only supported for recorded traces. +func (*dummyRecordingManipulation) Checkpoints() ([]Checkpoint, error) { return nil, ErrNotRecorded } + +// ClearCheckpoint will always return an error on the native proc backend, +// only supported in recorded traces. +func (*dummyRecordingManipulation) ClearCheckpoint(int) error { return ErrNotRecorded } + +// Restart will always return an error in the native proc backend, only for +// recorded traces. +func (*dummyRecordingManipulation) Restart(string) (Thread, error) { return nil, ErrNotRecorded } diff --git a/pkg/proc/target_exec.go b/pkg/proc/target_exec.go index 885e4d9c9c..528000eeb0 100644 --- a/pkg/proc/target_exec.go +++ b/pkg/proc/target_exec.go @@ -2,6 +2,7 @@ package proc import ( "bytes" + "debug/dwarf" "errors" "fmt" "go/ast" @@ -30,12 +31,12 @@ func (dbp *Target) Next() (err error) { if _, err := dbp.Valid(); err != nil { return err } - if dbp.Breakpoints().HasInternalBreakpoints() { + if dbp.Breakpoints().HasSteppingBreakpoints() { return fmt.Errorf("next while nexting") } if err = next(dbp, false, false); err != nil { - dbp.ClearInternalBreakpoints() + dbp.ClearSteppingBreakpoints() return } @@ -50,27 +51,41 @@ func (dbp *Target) Continue() error { return err } for _, thread := range dbp.ThreadList() { + thread.Common().CallReturn = false thread.Common().returnValues = nil } + dbp.Breakpoints().WatchOutOfScope = nil dbp.CheckAndClearManualStopRequest() defer func() { // Make sure we clear internal breakpoints if we simultaneously receive a // manual stop request and hit a breakpoint. if dbp.CheckAndClearManualStopRequest() { dbp.StopReason = StopManual - dbp.ClearInternalBreakpoints() + if dbp.KeepSteppingBreakpoints&HaltKeepsSteppingBreakpoints == 0 { + dbp.ClearSteppingBreakpoints() + } } }() for { if dbp.CheckAndClearManualStopRequest() { dbp.StopReason = StopManual - dbp.ClearInternalBreakpoints() + if dbp.KeepSteppingBreakpoints&HaltKeepsSteppingBreakpoints == 0 { + dbp.ClearSteppingBreakpoints() + } return nil } - dbp.ClearAllGCache() - trapthread, stopReason, err := dbp.proc.ContinueOnce() + dbp.ClearCaches() + trapthread, stopReason, contOnceErr := dbp.proc.ContinueOnce() dbp.StopReason = stopReason - if err != nil { + + threads := dbp.ThreadList() + for _, thread := range threads { + if thread.Breakpoint().Breakpoint != nil { + thread.Breakpoint().Breakpoint.checkCondition(dbp, thread, thread.Breakpoint()) + } + } + + if contOnceErr != nil { // Attempt to refresh status of current thread/current goroutine, see // Issue #2078. // Errors are ignored because depending on why ContinueOnce failed this @@ -82,14 +97,15 @@ func (dbp *Target) Continue() error { dbp.selectedGoroutine, _ = GetG(curth) } } - return err + if pe, ok := contOnceErr.(ErrProcessExited); ok { + dbp.exitStatus = pe.Status + } + return contOnceErr } if dbp.StopReason == StopLaunched { - dbp.ClearInternalBreakpoints() + dbp.ClearSteppingBreakpoints() } - threads := dbp.ThreadList() - callInjectionDone, callErr := callInjectionProtocol(dbp, threads) // callErr check delayed until after pickCurrentThread, which must always // happen, otherwise the debugger could be left in an inconsistent @@ -109,10 +125,6 @@ func (dbp *Target) Continue() error { switch { case curbp.Breakpoint == nil: // runtime.Breakpoint, manual stop or debugCallV1-related stop - recorded, _ := dbp.Recorded() - if recorded { - return conditionErrors(threads) - } loc, err := curthread.Location() if err != nil || loc.Fn == nil { @@ -123,10 +135,13 @@ func (dbp *Target) Continue() error { switch { case loc.Fn.Name == "runtime.breakpoint": + if recorded, _ := dbp.Recorded(); recorded { + return conditionErrors(threads) + } // In linux-arm64, PtraceSingleStep seems cannot step over BRK instruction // (linux-arm64 feature or kernel bug maybe). if !arch.BreakInstrMovesPC() { - curthread.SetPC(loc.PC + uint64(arch.BreakpointSize())) + setPC(curthread, loc.PC+uint64(arch.BreakpointSize())) } // Single-step current thread until we exit runtime.breakpoint and // runtime.Breakpoint. @@ -142,16 +157,15 @@ func (dbp *Target) Continue() error { if !arch.BreakInstrMovesPC() { bpsize := arch.BreakpointSize() bp := make([]byte, bpsize) - _, err = dbp.CurrentThread().ReadMemory(bp, uintptr(loc.PC)) + dbp.Memory().ReadMemory(bp, loc.PC) if bytes.Equal(bp, arch.BreakpointInstruction()) { - curthread.SetPC(loc.PC + uint64(bpsize)) + setPC(curthread, loc.PC+uint64(bpsize)) } } return conditionErrors(threads) } - case curbp.Active && curbp.Internal: - switch curbp.Kind { - case StepBreakpoint: + case curbp.Active && curbp.Stepping: + if curbp.SteppingInto { // See description of proc.(*Process).next for the meaning of StepBreakpoints if err := conditionErrors(threads); err != nil { return err @@ -172,34 +186,38 @@ func (dbp *Target) Continue() error { return err } } else { - if err := dbp.ClearInternalBreakpoints(); err != nil { + if err := dbp.ClearSteppingBreakpoints(); err != nil { return err } return dbp.StepInstruction() } - default: - curthread.Common().returnValues = curbp.Breakpoint.returnInfo.Collect(curthread) - if err := dbp.ClearInternalBreakpoints(); err != nil { + } else { + curthread.Common().returnValues = curbp.Breakpoint.returnInfo.Collect(dbp, curthread) + if err := dbp.ClearSteppingBreakpoints(); err != nil { return err } dbp.StopReason = StopNextFinished return conditionErrors(threads) } case curbp.Active: - onNextGoroutine, err := onNextGoroutine(curthread, dbp.Breakpoints()) + onNextGoroutine, err := onNextGoroutine(dbp, curthread, dbp.Breakpoints()) if err != nil { return err } - if onNextGoroutine { - err := dbp.ClearInternalBreakpoints() + if onNextGoroutine && + ((!curbp.Tracepoint && !curbp.TraceReturn) || dbp.KeepSteppingBreakpoints&TracepointKeepsSteppingBreakpoints == 0) { + err := dbp.ClearSteppingBreakpoints() if err != nil { return err } } if curbp.Name == UnrecoveredPanic { - dbp.ClearInternalBreakpoints() + dbp.ClearSteppingBreakpoints() } dbp.StopReason = StopBreakpoint + if curbp.Breakpoint.WatchType != 0 { + dbp.StopReason = StopWatchpoint + } return conditionErrors(threads) default: // not a manual stop, not on runtime.Breakpoint, not on a breakpoint, just repeat @@ -233,7 +251,7 @@ func conditionErrors(threads []Thread) error { // - trapthread func pickCurrentThread(dbp *Target, trapthread Thread, threads []Thread) error { for _, th := range threads { - if bp := th.Breakpoint(); bp.Active && bp.Internal { + if bp := th.Breakpoint(); bp.Active && bp.Stepping { return dbp.SwitchThread(th.ThreadID()) } } @@ -254,7 +272,7 @@ func disassembleCurrentInstruction(p Process, thread Thread, off int64) ([]AsmIn return nil, err } pc := regs.PC() + uint64(off) - return disassemble(thread, regs, p.Breakpoints(), p.BinInfo(), pc, pc+uint64(p.BinInfo().Arch.MaxInstructionLength()), true) + return disassemble(p.Memory(), regs, p.Breakpoints(), p.BinInfo(), pc, pc+uint64(p.BinInfo().Arch.MaxInstructionLength()), true) } // stepInstructionOut repeatedly calls StepInstruction until the current @@ -262,13 +280,28 @@ func disassembleCurrentInstruction(p Process, thread Thread, off int64) ([]AsmIn // This function is used to step out of runtime.Breakpoint as well as // runtime.debugCallV1. func stepInstructionOut(dbp *Target, curthread Thread, fnname1, fnname2 string) error { - defer dbp.ClearAllGCache() + defer dbp.ClearCaches() for { if err := curthread.StepInstruction(); err != nil { return err } loc, err := curthread.Location() - if err != nil || loc.Fn == nil || (loc.Fn.Name != fnname1 && loc.Fn.Name != fnname2) { + var locFnName string + if loc.Fn != nil { + locFnName = loc.Fn.Name + // Calls to runtime.Breakpoint are inlined in some versions of Go when + // inlining is enabled. Here we attempt to resolve any inlining. + dwarfTree, _ := loc.Fn.cu.image.getDwarfTree(loc.Fn.offset) + if dwarfTree != nil { + inlstack := reader.InlineStack(dwarfTree, loc.PC) + if len(inlstack) > 0 { + if locFnName2, ok := inlstack[0].Val(dwarf.AttrName).(string); ok { + locFnName = locFnName2 + } + } + } + } + if err != nil || loc.Fn == nil || (locFnName != fnname1 && locFnName != fnname2) { g, _ := GetG(curthread) selg := dbp.SelectedGoroutine() if g != nil && selg != nil && g.ID == selg.ID { @@ -285,21 +318,17 @@ func (dbp *Target) Step() (err error) { if _, err := dbp.Valid(); err != nil { return err } - if dbp.Breakpoints().HasInternalBreakpoints() { + if dbp.Breakpoints().HasSteppingBreakpoints() { return fmt.Errorf("next while nexting") } if err = next(dbp, true, false); err != nil { - switch err.(type) { - case ErrThreadBlocked: // Noop - default: - dbp.ClearInternalBreakpoints() - return - } + _ = dbp.ClearSteppingBreakpoints() + return err } - if bp := dbp.CurrentThread().Breakpoint().Breakpoint; bp != nil && bp.Kind == StepBreakpoint && dbp.GetDirection() == Backward { - dbp.ClearInternalBreakpoints() + if bpstate := dbp.CurrentThread().Breakpoint(); bpstate.Breakpoint != nil && bpstate.Active && bpstate.SteppingInto && dbp.GetDirection() == Backward { + dbp.ClearSteppingBreakpoints() return dbp.StepInstruction() } @@ -326,7 +355,7 @@ func (dbp *Target) StepOut() error { if _, err := dbp.Valid(); err != nil { return err } - if dbp.Breakpoints().HasInternalBreakpoints() { + if dbp.Breakpoints().HasSteppingBreakpoints() { return fmt.Errorf("next while nexting") } @@ -341,7 +370,7 @@ func (dbp *Target) StepOut() error { success := false defer func() { if !success { - dbp.ClearInternalBreakpoints() + dbp.ClearSteppingBreakpoints() } }() @@ -412,15 +441,15 @@ func (dbp *Target) StepInstruction() (err error) { } thread = g.Thread } - dbp.ClearAllGCache() + dbp.ClearCaches() if ok, err := dbp.Valid(); !ok { return err } - thread.Breakpoint().Clear() err = thread.StepInstruction() if err != nil { return err } + thread.Breakpoint().Clear() err = thread.SetCurrentBreakpoint(true) if err != nil { return err @@ -428,6 +457,7 @@ func (dbp *Target) StepInstruction() (err error) { if tg, _ := GetG(thread); tg != nil { dbp.selectedGoroutine = tg } + dbp.StopReason = StopNextFinished return nil } @@ -483,16 +513,14 @@ func next(dbp *Target, stepInto, inlinedStepOut bool) error { success := false defer func() { if !success { - dbp.ClearInternalBreakpoints() + dbp.ClearSteppingBreakpoints() } }() ext := filepath.Ext(topframe.Current.File) csource := ext != ".go" && ext != ".s" - var thread MemoryReadWriter = curthread var regs Registers if selg != nil && selg.Thread != nil { - thread = selg.Thread regs, err = selg.Thread.Registers() if err != nil { return err @@ -518,18 +546,21 @@ func next(dbp *Target, stepInto, inlinedStepOut bool) error { return nil } - topframe.Ret, err = findCallInstrForRet(dbp, thread, topframe.Ret, retframe.Current.Fn) + topframe.Ret, err = findCallInstrForRet(dbp, dbp.Memory(), topframe.Ret, retframe.Current.Fn) if err != nil { return err } } - text, err := disassemble(thread, regs, dbp.Breakpoints(), dbp.BinInfo(), topframe.Current.Fn.Entry, topframe.Current.Fn.End, false) + text, err := disassemble(dbp.Memory(), regs, dbp.Breakpoints(), dbp.BinInfo(), topframe.Current.Fn.Entry, topframe.Current.Fn.End, false) if err != nil && stepInto { return err } - sameFrameCond := astutil.And(sameGCond, frameoffCondition(&topframe)) + var sameFrameCond ast.Expr + if sameGCond != nil { + sameFrameCond = astutil.And(sameGCond, frameoffCondition(&topframe)) + } if stepInto && !backward { err := setStepIntoBreakpoints(dbp, topframe.Current.Fn, text, topframe, sameGCond) @@ -596,7 +627,7 @@ func next(dbp *Target, stepInto, inlinedStepOut bool) error { for _, pc := range pcs { if _, err := allowDuplicateBreakpoint(dbp.SetBreakpoint(pc, NextBreakpoint, sameFrameCond)); err != nil { - dbp.ClearInternalBreakpoints() + dbp.ClearSteppingBreakpoints() return err } } @@ -611,25 +642,12 @@ func next(dbp *Target, stepInto, inlinedStepOut bool) error { if !topframe.Inlined { topframe, retframe := skipAutogeneratedWrappersOut(selg, curthread, &topframe, &retframe) retFrameCond := astutil.And(sameGCond, frameoffCondition(retframe)) - var sameOrRetFrameCond ast.Expr - if sameGCond != nil { - sameOrRetFrameCond = astutil.And(sameGCond, astutil.Or(frameoffCondition(topframe), frameoffCondition(retframe))) - } // Add a breakpoint on the return address for the current frame. // For inlined functions there is no need to do this, the set of PCs // returned by the AllPCsBetween call above already cover all instructions // of the containing function. - bp, err := dbp.SetBreakpoint(retframe.Current.PC, NextBreakpoint, retFrameCond) - if _, isexists := err.(BreakpointExistsError); isexists { - if bp.Kind == NextBreakpoint { - // If the return address shares the same address with one of the lines - // of the function (because we are stepping through a recursive - // function) then the corresponding breakpoint should be active both on - // this frame and on the return frame. - bp.Cond = sameOrRetFrameCond - } - } + bp, _ := dbp.SetBreakpoint(retframe.Current.PC, NextBreakpoint, retFrameCond) // Return address could be wrong, if we are unable to set a breakpoint // there it's ok. if bp != nil { @@ -665,6 +683,7 @@ func setStepIntoBreakpoints(dbp *Target, curfn *Function, text []AsmInstruction, } func setStepIntoBreakpointsReverse(dbp *Target, text []AsmInstruction, topframe Stackframe, sameGCond ast.Expr) error { + bpmap := dbp.Breakpoints() // Set a breakpoint after every CALL instruction for i, instr := range text { if instr.Loc.File != topframe.Current.File || !instr.IsCall() || instr.DestLoc == nil || instr.DestLoc.Fn == nil { @@ -676,8 +695,11 @@ func setStepIntoBreakpointsReverse(dbp *Target, text []AsmInstruction, topframe } if nextIdx := i + 1; nextIdx < len(text) { - if _, err := allowDuplicateBreakpoint(dbp.SetBreakpoint(text[nextIdx].Loc.PC, StepBreakpoint, sameGCond)); err != nil { - return err + _, ok := bpmap.M[text[nextIdx].Loc.PC] + if !ok { + if _, err := allowDuplicateBreakpoint(dbp.SetBreakpoint(text[nextIdx].Loc.PC, StepBreakpoint, sameGCond)); err != nil { + return err + } } } } @@ -785,6 +807,7 @@ func setStepIntoBreakpoint(dbp *Target, curfn *Function, text []AsmInstruction, func allowDuplicateBreakpoint(bp *Breakpoint, err error) (*Breakpoint, error) { if err != nil { + //lint:ignore S1020 this is clearer if _, isexists := err.(BreakpointExistsError); isexists { return bp, nil } @@ -796,6 +819,10 @@ func isAutogenerated(loc Location) bool { return loc.File == "" && loc.Line == 1 } +func isAutogeneratedOrDeferReturn(loc Location) bool { + return isAutogenerated(loc) || (loc.Fn != nil && loc.Fn.Name == "runtime.deferreturn") +} + // skipAutogeneratedWrappers skips autogenerated wrappers when setting a // step-into breakpoint. // See genwrapper in: $GOROOT/src/cmd/compile/internal/gc/subr.go @@ -809,7 +836,7 @@ func skipAutogeneratedWrappersIn(p Process, startfn *Function, startpc uint64) ( // can't exit Go return startfn, startpc } - text, err := Disassemble(p.CurrentThread(), nil, p.Breakpoints(), p.BinInfo(), fn.Entry, fn.End) + text, err := Disassemble(p.Memory(), nil, p.Breakpoints(), p.BinInfo(), fn.Entry, fn.End) if err != nil { break } @@ -855,12 +882,13 @@ func skipAutogeneratedWrappersIn(p Process, startfn *Function, startpc uint64) ( // skipAutogeneratedWrappersOut skip autogenerated wrappers when setting a // step out breakpoint. // See genwrapper in: $GOROOT/src/cmd/compile/internal/gc/subr.go +// It also skips runtime.deferreturn frames (which are only ever on the stack on Go 1.18 or later) func skipAutogeneratedWrappersOut(g *G, thread Thread, startTopframe, startRetframe *Stackframe) (topframe, retframe *Stackframe) { topframe, retframe = startTopframe, startRetframe if startTopframe.Ret == 0 { return } - if !isAutogenerated(startRetframe.Current) { + if !isAutogeneratedOrDeferReturn(startRetframe.Current) { return } retfn := thread.BinInfo().PCToFunc(startTopframe.Ret) @@ -873,9 +901,6 @@ func skipAutogeneratedWrappersOut(g *G, thread Thread, startTopframe, startRetfr var err error var frames []Stackframe if g == nil { - if thread.Blocked() { - return - } frames, err = ThreadStacktrace(thread, maxSkipAutogeneratedWrappers) } else { frames, err = g.Stacktrace(maxSkipAutogeneratedWrappers, 0) @@ -889,7 +914,7 @@ func skipAutogeneratedWrappersOut(g *G, thread Thread, startTopframe, startRetfr return } file, line := frame.Current.Fn.cu.lineInfo.PCToLine(frame.Current.Fn.Entry, frame.Current.Fn.Entry) - if !isAutogenerated(Location{File: file, Line: line, Fn: frame.Current.Fn}) { + if !isAutogeneratedOrDeferReturn(Location{File: file, Line: line, Fn: frame.Current.Fn}) { return &frames[i-1], &frames[i] } } @@ -901,12 +926,14 @@ func skipAutogeneratedWrappersOut(g *G, thread Thread, startTopframe, startRetfr func setDeferBreakpoint(p *Target, text []AsmInstruction, topframe Stackframe, sameGCond ast.Expr, stepInto bool) (uint64, error) { // Set breakpoint on the most recently deferred function (if any) var deferpc uint64 - if topframe.TopmostDefer != nil && topframe.TopmostDefer.DeferredPC != 0 { - deferfn := p.BinInfo().PCToFunc(topframe.TopmostDefer.DeferredPC) - var err error - deferpc, err = FirstPCAfterPrologue(p, deferfn, false) - if err != nil { - return 0, err + if topframe.TopmostDefer != nil && topframe.TopmostDefer.DwrapPC != 0 { + _, _, deferfn := topframe.TopmostDefer.DeferredFunc(p) + if deferfn != nil { + var err error + deferpc, err = FirstPCAfterPrologue(p, deferfn, false) + if err != nil { + return 0, err + } } } if deferpc != 0 && deferpc != topframe.Current.PC { @@ -918,7 +945,12 @@ func setDeferBreakpoint(p *Target, text []AsmInstruction, topframe Stackframe, s // If DeferReturns is set then the breakpoint will also be triggered when // called from runtime.deferreturn. We only do this for the step command, // not for next or stepout. - bp.DeferReturns = FindDeferReturnCalls(text) + for _, breaklet := range bp.Breaklets { + if breaklet.Kind == NextDeferBreakpoint { + breaklet.DeferReturns = FindDeferReturnCalls(text) + break + } + } } } @@ -958,7 +990,7 @@ func stepOutReverse(p *Target, topframe, retframe Stackframe, sameGCond ast.Expr curthread = selg.Thread } - callerText, err := disassemble(curthread, nil, p.Breakpoints(), p.BinInfo(), retframe.Current.Fn.Entry, retframe.Current.Fn.End, false) + callerText, err := disassemble(p.Memory(), nil, p.Breakpoints(), p.BinInfo(), retframe.Current.Fn.Entry, retframe.Current.Fn.End, false) if err != nil { return err } @@ -966,9 +998,7 @@ func stepOutReverse(p *Target, topframe, retframe Stackframe, sameGCond ast.Expr var frames []Stackframe if selg == nil { - if !curthread.Blocked() { - frames, err = ThreadStacktrace(curthread, 3) - } + frames, err = ThreadStacktrace(curthread, 3) } else { frames, err = selg.Stacktrace(3, 0) } @@ -978,21 +1008,32 @@ func stepOutReverse(p *Target, topframe, retframe Stackframe, sameGCond ast.Expr var callpc uint64 - if isPanicCall(frames) { - if len(frames) < 4 || frames[3].Current.Fn == nil { - return &ErrNoSourceForPC{frames[2].Current.PC} + if ok, panicFrame := isPanicCall(frames); ok { + if len(frames) < panicFrame+2 || frames[panicFrame+1].Current.Fn == nil { + if panicFrame < len(frames) { + return &ErrNoSourceForPC{frames[panicFrame].Current.PC} + } else { + return &ErrNoSourceForPC{frames[0].Current.PC} + } } - callpc, err = findCallInstrForRet(p, curthread, frames[2].Ret, frames[3].Current.Fn) + callpc, err = findCallInstrForRet(p, p.Memory(), frames[panicFrame].Ret, frames[panicFrame+1].Current.Fn) if err != nil { return err } - } else if ok, pc := isDeferReturnCall(frames, deferReturns); ok { - callpc = pc } else { - callpc, err = findCallInstrForRet(p, curthread, topframe.Ret, retframe.Current.Fn) + callpc, err = findCallInstrForRet(p, p.Memory(), topframe.Ret, retframe.Current.Fn) if err != nil { return err } + + // check if the call instruction to this frame is a call to runtime.deferreturn + if len(frames) > 0 { + frames[0].Ret = callpc + } + if ok, pc := isDeferReturnCall(frames, deferReturns); ok && pc != 0 { + callpc = pc + } + } _, err = allowDuplicateBreakpoint(p.SetBreakpoint(callpc, NextBreakpoint, sameGCond)) @@ -1001,15 +1042,18 @@ func stepOutReverse(p *Target, topframe, retframe Stackframe, sameGCond ast.Expr } // onNextGoroutine returns true if this thread is on the goroutine requested by the current 'next' command -func onNextGoroutine(thread Thread, breakpoints *BreakpointMap) (bool, error) { - var bp *Breakpoint +func onNextGoroutine(tgt *Target, thread Thread, breakpoints *BreakpointMap) (bool, error) { + var breaklet *Breaklet +breakletSearch: for i := range breakpoints.M { - if breakpoints.M[i].Kind != UserBreakpoint && breakpoints.M[i].internalCond != nil { - bp = breakpoints.M[i] - break + for _, blet := range breakpoints.M[i].Breaklets { + if blet.Kind&steppingMask != 0 && blet.Cond != nil { + breaklet = blet + break breakletSearch + } } } - if bp == nil { + if breaklet == nil { return false, nil } // Internal breakpoint conditions can take multiple different forms: @@ -1021,12 +1065,13 @@ func onNextGoroutine(thread Thread, breakpoints *BreakpointMap) (bool, error) { // function or by returning from the function: // runtime.curg.goid == X && (runtime.frameoff == Y || runtime.frameoff == Z) // Here we are only interested in testing the runtime.curg.goid clause. - w := onNextGoroutineWalker{thread: thread} - ast.Walk(&w, bp.internalCond) + w := onNextGoroutineWalker{tgt: tgt, thread: thread} + ast.Walk(&w, breaklet.Cond) return w.ret, w.err } type onNextGoroutineWalker struct { + tgt *Target thread Thread ret bool err error @@ -1034,7 +1079,7 @@ type onNextGoroutineWalker struct { func (w *onNextGoroutineWalker) Visit(n ast.Node) ast.Visitor { if binx, isbin := n.(*ast.BinaryExpr); isbin && binx.Op == token.EQL && exprToString(binx.X) == "runtime.curg.goid" { - w.ret, w.err = evalBreakpointCondition(w.thread, n.(ast.Expr)) + w.ret, w.err = evalBreakpointCondition(w.tgt, w.thread, n.(ast.Expr)) return nil } return w diff --git a/pkg/proc/test/support.go b/pkg/proc/test/support.go index 277dfecf9c..afaf2d2ffe 100644 --- a/pkg/proc/test/support.go +++ b/pkg/proc/test/support.go @@ -64,7 +64,7 @@ func FindFixturesDir() string { type BuildFlags uint32 const ( - // LinkStrip enables '-ldflas="-s"'. + // LinkStrip enables '-ldflags="-s"'. LinkStrip BuildFlags = 1 << iota // EnableCGOOptimization will build CGO code with optimizations. EnableCGOOptimization @@ -76,6 +76,7 @@ const ( EnableDWZCompression BuildModePIE BuildModePlugin + BuildModeExternalLinker AllNonOptimized ) @@ -141,6 +142,9 @@ func BuildFixture(name string, flags BuildFlags) Fixture { if flags&BuildModePlugin != 0 { buildFlags = append(buildFlags, "-buildmode=plugin") } + if flags&BuildModeExternalLinker != 0 { + buildFlags = append(buildFlags, "-ldflags=-linkmode=external") + } if ver.IsDevel() || ver.AfterOrEqual(goversion.GoVersion{Major: 1, Minor: 11, Rev: -1}) { if flags&EnableDWZCompression != 0 { buildFlags = append(buildFlags, "-ldflags=-compressdwarf=false") @@ -310,7 +314,7 @@ func MustSupportFunctionCalls(t *testing.T, testBackend string) { t.Skip("this version of Go does not support function calls") } - if testBackend == "rr" || (runtime.GOOS == "darwin" && testBackend == "native") { + if runtime.GOOS == "darwin" && testBackend == "native" { t.Skip("this backend does not support function calls") } @@ -363,7 +367,11 @@ var hasCgo = func() bool { if err != nil { panic(err) } - return strings.TrimSpace(string(out)) == "1" + if strings.TrimSpace(string(out)) != "1" { + return false + } + _, err = exec.LookPath("gcc") + return err == nil }() func MustHaveCgo(t *testing.T) { @@ -371,3 +379,15 @@ func MustHaveCgo(t *testing.T) { t.Skip("Cgo not enabled") } } + +func RegabiSupported() bool { + // Tracks regabiSupported variable in ParseGOEXPERIMENT internal/buildcfg/exp.go + switch { + case goversion.VersionAfterOrEqual(runtime.Version(), 1, 18): + return runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "ppc64" + case goversion.VersionAfterOrEqual(runtime.Version(), 1, 17): + return runtime.GOARCH == "amd64" && (runtime.GOOS == "android" || runtime.GOOS == "linux" || runtime.GOOS == "darwin" || runtime.GOOS == "windows") + default: + return false + } +} diff --git a/pkg/proc/threads.go b/pkg/proc/threads.go index 8ca17ff310..35b33670a3 100644 --- a/pkg/proc/threads.go +++ b/pkg/proc/threads.go @@ -2,11 +2,12 @@ package proc import ( "errors" + + "github.com/go-delve/delve/pkg/dwarf/op" ) // Thread represents a thread. type Thread interface { - MemoryReadWriter Location() (*Location, error) // Breakpoint will return the breakpoint that this thread is stopped at or // nil if the thread is not stopped at any breakpoint. @@ -24,17 +25,18 @@ type Thread interface { // RestoreRegisters restores saved registers RestoreRegisters(Registers) error BinInfo() *BinaryInfo + // ProcessMemory returns the process memory. + ProcessMemory() MemoryReadWriter StepInstruction() error - // Blocked returns true if the thread is blocked - Blocked() bool // SetCurrentBreakpoint updates the current breakpoint of this thread, if adjustPC is true also checks for breakpoints that were just hit (this should only be passed true after a thread resume) SetCurrentBreakpoint(adjustPC bool) error // Common returns the CommonThread structure for this thread Common() *CommonThread - SetPC(uint64) error - SetSP(uint64) error - SetDX(uint64) error + // SetReg changes the value of the specified register. A minimal + // implementation of this interface can support just setting the PC + // register. + SetReg(uint64, *op.DwarfRegister) error } // Location represents the location of a thread. @@ -47,17 +49,10 @@ type Location struct { Fn *Function } -// ErrThreadBlocked is returned when the thread -// is blocked in the scheduler. -type ErrThreadBlocked struct{} - -func (tbe ErrThreadBlocked) Error() string { - return "thread blocked" -} - // CommonThread contains fields used by this package, common to all // implementations of the Thread interface. type CommonThread struct { + CallReturn bool // returnValues are the return values of a call injection returnValues []*Variable g *G // cached g for this thread } @@ -75,9 +70,6 @@ func topframe(g *G, thread Thread) (Stackframe, Stackframe, error) { var err error if g == nil { - if thread.Blocked() { - return Stackframe{}, Stackframe{}, ErrThreadBlocked{} - } frames, err = ThreadStacktrace(thread, 1) } else { frames, err = g.Stacktrace(1, StacktraceReadDefers) @@ -94,3 +86,15 @@ func topframe(g *G, thread Thread) (Stackframe, Stackframe, error) { return frames[0], frames[1], nil } } + +func setPC(thread Thread, newPC uint64) error { + return thread.SetReg(thread.BinInfo().Arch.PCRegNum, op.DwarfRegisterFromUint64(newPC)) +} + +func setSP(thread Thread, newSP uint64) error { + return thread.SetReg(thread.BinInfo().Arch.SPRegNum, op.DwarfRegisterFromUint64(newSP)) +} + +func setClosureReg(thread Thread, newClosureReg uint64) error { + return thread.SetReg(thread.BinInfo().Arch.ContextRegNum, op.DwarfRegisterFromUint64(newClosureReg)) +} diff --git a/pkg/proc/types.go b/pkg/proc/types.go index 4f8c746e8d..b52914ac1d 100644 --- a/pkg/proc/types.go +++ b/pkg/proc/types.go @@ -11,16 +11,17 @@ import ( "github.com/go-delve/delve/pkg/dwarf/godwarf" "github.com/go-delve/delve/pkg/dwarf/reader" + "github.com/go-delve/delve/pkg/goversion" ) // The kind field in runtime._type is a reflect.Kind value plus // some extra flags defined here. // See equivalent declaration in $GOROOT/src/reflect/type.go const ( - kindDirectIface = 1 << 5 - kindGCProg = 1 << 6 // Type.gc points to GC program + kindDirectIface = 1 << 5 // +rtype kindDirectIface + kindGCProg = 1 << 6 // +rtype kindGCProg kindNoPointers = 1 << 7 - kindMask = (1 << 5) - 1 + kindMask = (1 << 5) - 1 // +rtype kindMask ) // Value of tflag field in runtime._type. @@ -98,6 +99,17 @@ func newLoadDebugInfoMapsContext(bi *BinaryInfo, image *Image, offsetToVersion m return ctxt } +func (ctxt *loadDebugInfoMapsContext) lookupAbstractOrigin(bi *BinaryInfo, off dwarf.Offset) int { + r, ok := ctxt.abstractOriginTable[off] + if !ok { + bi.Functions = append(bi.Functions, Function{}) + r = len(bi.Functions) - 1 + bi.Functions[r].offset = off + ctxt.abstractOriginTable[off] = r + } + return r +} + // runtimeTypeToDIE returns the DIE corresponding to the runtime._type. // This is done in three different ways depending on the version of go. // * Before go1.7 the type name is retrieved directly from the runtime._type @@ -107,7 +119,7 @@ func newLoadDebugInfoMapsContext(bi *BinaryInfo, image *Image, offsetToVersion m // debug_info // * After go1.11 the runtimeTypeToDIE map is used to look up the address of // the type and map it drectly to a DIE. -func runtimeTypeToDIE(_type *Variable, dataAddr uintptr) (typ godwarf.Type, kind int64, err error) { +func runtimeTypeToDIE(_type *Variable, dataAddr uint64) (typ godwarf.Type, kind int64, err error) { bi := _type.bi _type = _type.maybeDereference() @@ -122,22 +134,33 @@ func runtimeTypeToDIE(_type *Variable, dataAddr uintptr) (typ godwarf.Type, kind md := findModuleDataForType(bi, mds, _type.Addr, _type.mem) if md != nil { so := bi.moduleDataToImage(md) - if rtdie, ok := so.runtimeTypeToDIE[uint64(_type.Addr-md.types)]; ok { - typ, err := godwarf.ReadType(so.dwarf, so.index, rtdie.offset, so.typeCache) - if err != nil { - return nil, 0, fmt.Errorf("invalid interface type: %v", err) - } - if rtdie.kind == -1 { - if kindField := _type.loadFieldNamed("kind"); kindField != nil && kindField.Value != nil { - rtdie.kind, _ = constant.Int64Val(kindField.Value) + if so != nil { + if rtdie, ok := so.runtimeTypeToDIE[uint64(_type.Addr-md.types)]; ok { + typ, err := godwarf.ReadType(so.dwarf, so.index, rtdie.offset, so.typeCache) + if err != nil { + return nil, 0, fmt.Errorf("invalid interface type: %v", err) + } + if rtdie.kind == -1 { + if kindField := _type.loadFieldNamed("kind"); kindField != nil && kindField.Value != nil { + rtdie.kind, _ = constant.Int64Val(kindField.Value) + } } + return typ, rtdie.kind, nil } - return typ, rtdie.kind, nil } } // go1.7 to go1.10 implementation: convert runtime._type structs to type names + if goversion.ProducerAfterOrEqual(_type.bi.Producer(), 1, 17) { + // Go 1.17 changed the encoding of names in runtime._type breaking the + // code below, but the codepath above, using runtimeTypeToDIE should be + // enough. + // The change happened in commit 287025925f66f90ad9b30aea2e533928026a8376 + // reviewed in https://go-review.googlesource.com/c/go/+/318249 + return nil, 0, fmt.Errorf("could not resolve interface type") + } + typename, kind, err := nameOfRuntimeType(mds, _type) if err != nil { return nil, 0, fmt.Errorf("invalid interface type: %v", err) @@ -151,6 +174,34 @@ func runtimeTypeToDIE(_type *Variable, dataAddr uintptr) (typ godwarf.Type, kind return typ, kind, nil } +// resolveParametricType returns the real type of t if t is a parametric +// type, by reading the correct dictionary entry. +func resolveParametricType(tgt *Target, bi *BinaryInfo, mem MemoryReadWriter, t godwarf.Type, dictAddr uint64) (godwarf.Type, error) { + ptyp, _ := t.(*godwarf.ParametricType) + if ptyp == nil { + return t, nil + } + if dictAddr == 0 { + return ptyp.TypedefType.Type, errors.New("parametric type without a dictionary") + } + rtypeAddr, err := readUintRaw(mem, dictAddr+uint64(ptyp.DictIndex*int64(bi.Arch.PtrSize())), int64(bi.Arch.PtrSize())) + if err != nil { + return ptyp.TypedefType.Type, err + } + runtimeType, err := bi.findType("runtime._type") + if err != nil { + return ptyp.TypedefType.Type, err + } + _type := newVariable("", rtypeAddr, runtimeType, bi, mem) + + typ, _, err := runtimeTypeToDIE(_type, 0) + if err != nil { + return ptyp.TypedefType.Type, err + } + + return typ, nil +} + type nameOfRuntimeTypeEntry struct { typename string kind int64 @@ -218,7 +269,7 @@ func nameOfNamedRuntimeType(mds []moduleData, _type *Variable, kind, tflag int64 // For a description of how memory is organized for type names read // the comment to 'type name struct' in $GOROOT/src/reflect/type.go - typename, _, _, err = resolveNameOff(_type.bi, mds, _type.Addr, uintptr(strOff), _type.mem) + typename, _, _, err = resolveNameOff(_type.bi, mds, _type.Addr, uint64(strOff), _type.mem) if err != nil { return "", err } @@ -244,7 +295,7 @@ func nameOfNamedRuntimeType(mds []moduleData, _type *Variable, kind, tflag int64 if ut := uncommon(_type, tflag); ut != nil { if pkgPathField := ut.loadFieldNamed("pkgpath"); pkgPathField != nil && pkgPathField.Value != nil { pkgPathOff, _ := constant.Int64Val(pkgPathField.Value) - pkgPath, _, _, err := resolveNameOff(_type.bi, mds, _type.Addr, uintptr(pkgPathOff), _type.mem) + pkgPath, _, _, err := resolveNameOff(_type.bi, mds, _type.Addr, uint64(pkgPathOff), _type.mem) if err != nil { return "", err } @@ -344,7 +395,7 @@ func nameOfFuncRuntimeType(mds []moduleData, _type *Variable, tflag int64, anony outCount = outCount & (1<<15 - 1) } - cursortyp := _type.newVariable("", _type.Addr+uintptr(uadd), prtyp, _type.mem) + cursortyp := _type.newVariable("", _type.Addr+uint64(uadd), prtyp, _type.mem) var buf bytes.Buffer if anonymous { buf.WriteString("func(") @@ -354,7 +405,7 @@ func nameOfFuncRuntimeType(mds []moduleData, _type *Variable, tflag int64, anony for i := int64(0); i < inCount; i++ { argtype := cursortyp.maybeDereference() - cursortyp.Addr += uintptr(_type.bi.Arch.PtrSize()) + cursortyp.Addr += uint64(_type.bi.Arch.PtrSize()) argtypename, _, err := nameOfRuntimeType(mds, argtype) if err != nil { return "", err @@ -381,7 +432,7 @@ func nameOfFuncRuntimeType(mds []moduleData, _type *Variable, tflag int64, anony buf.WriteString(" (") for i := int64(0); i < outCount; i++ { argtype := cursortyp.maybeDereference() - cursortyp.Addr += uintptr(_type.bi.Arch.PtrSize()) + cursortyp.Addr += uint64(_type.bi.Arch.PtrSize()) argtypename, _, err := nameOfRuntimeType(mds, argtype) if err != nil { return "", err @@ -419,14 +470,14 @@ func nameOfInterfaceRuntimeType(mds []moduleData, _type *Variable, kind, tflag i case imethodFieldName: nameoff, _ := constant.Int64Val(im.Children[i].Value) var err error - methodname, _, _, err = resolveNameOff(_type.bi, mds, _type.Addr, uintptr(nameoff), _type.mem) + methodname, _, _, err = resolveNameOff(_type.bi, mds, _type.Addr, uint64(nameoff), _type.mem) if err != nil { return "", err } case imethodFieldItyp: typeoff, _ := constant.Int64Val(im.Children[i].Value) - typ, err := resolveTypeOff(_type.bi, mds, _type.Addr, uintptr(typeoff), _type.mem) + typ, err := resolveTypeOff(_type.bi, mds, _type.Addr, uint64(typeoff), _type.mem) if err != nil { return "", err } @@ -489,7 +540,7 @@ func nameOfStructRuntimeType(mds []moduleData, _type *Variable, kind, tflag int6 } var err error - fieldname, _, _, err = loadName(_type.bi, uintptr(nameoff), _type.mem) + fieldname, _, _, err = loadName(_type.bi, uint64(nameoff), _type.mem) if err != nil { return "", err } @@ -564,7 +615,7 @@ func uncommon(_type *Variable, tflag int64) *Variable { return nil } - return _type.newVariable(_type.Name, _type.Addr+uintptr(_type.RealType.Size()), typ, _type.mem) + return _type.newVariable(_type.Name, _type.Addr+uint64(_type.RealType.Size()), typ, _type.mem) } var kindToRuntimeTypeName = map[reflect.Kind]string{ @@ -627,7 +678,7 @@ func dwarfToRuntimeType(bi *BinaryInfo, mem MemoryReadWriter, typ godwarf.Type) if err != nil { return 0, 0, false, err } - _type := newVariable("", uintptr(typeAddr), rtyp, bi, mem) + _type := newVariable("", typeAddr, rtyp, bi, mem) kindv := _type.loadFieldNamed("kind") if kindv.Unreadable != nil || kindv.Kind != reflect.Uint { return 0, 0, false, fmt.Errorf("unreadable interface type: %v", kindv.Unreadable) diff --git a/pkg/proc/variables.go b/pkg/proc/variables.go index 35d01ae9d3..0f794da449 100644 --- a/pkg/proc/variables.go +++ b/pkg/proc/variables.go @@ -11,12 +11,14 @@ import ( "math" "reflect" "sort" + "strconv" "strings" "unsafe" "github.com/go-delve/delve/pkg/dwarf/godwarf" "github.com/go-delve/delve/pkg/dwarf/op" "github.com/go-delve/delve/pkg/goversion" + "github.com/go-delve/delve/pkg/logflags" ) const ( @@ -24,13 +26,14 @@ const ( maxArrayStridePrefetch = 1024 // Maximum size of array stride for which we will prefetch the array contents - chanRecv = "chan receive" - chanSend = "chan send" - - hashTophashEmptyZero = 0 // used by map reading code, indicates an empty cell - hashTophashEmptyOne = 1 // used by map reading code, indicates an empty cell in Go 1.12 and later - hashMinTopHashGo111 = 4 // used by map reading code, indicates minimum value of tophash that isn't empty or evacuated, in Go1.11 - hashMinTopHashGo112 = 5 // used by map reading code, indicates minimum value of tophash that isn't empty or evacuated, in Go1.12 + // hashTophashEmptyZero is used by map reading code, indicates an empty cell + hashTophashEmptyZero = 0 // +rtype emptyRest + // hashTophashEmptyOne is used by map reading code, indicates an empty cell in Go 1.12 and later + hashTophashEmptyOne = 1 // +rtype emptyOne + // hashMinTopHashGo111 used by map reading code, indicates minimum value of tophash that isn't empty or evacuated, in Go1.11 + hashMinTopHashGo111 = 4 // +rtype minTopHash + // hashMinTopHashGo112 is used by map reading code, indicates minimum value of tophash that isn't empty or evacuated, in Go1.12 + hashMinTopHashGo112 = 5 // +rtype minTopHash maxFramePrefetchSize = 1 * 1024 * 1024 // Maximum prefetch size for a stack frame @@ -79,6 +82,8 @@ const ( VariableFakeAddress // VariableCPrt means the variable is a C pointer VariableCPtr + // VariableCPURegister means this variable is a CPU register. + VariableCPURegister ) // Variable represents a variable. It contains the address, name, @@ -86,7 +91,7 @@ const ( // and the memory of the debugged process. // If OnlyAddr is true, the variables value has not been loaded. type Variable struct { - Addr uintptr + Addr uint64 OnlyAddr bool Name string DwarfType godwarf.Type @@ -97,6 +102,7 @@ type Variable struct { Value constant.Value FloatSpecial floatSpecial + reg *op.DwarfRegister // contains the value of this variable if VariableCPURegister flag is set and loaded is false Len int64 Cap int64 @@ -107,7 +113,7 @@ type Variable struct { // Base address of the backing byte array for strings // address of the struct backing chan and map variables // address of the function entry point for function variables (0 for nil function pointers) - Base uintptr + Base uint64 stride int64 fieldType godwarf.Type @@ -189,17 +195,18 @@ const ( // G represents a runtime G (goroutine) structure (at least the // fields that Delve is interested in). type G struct { - ID int // Goroutine ID - PC uint64 // PC of goroutine when it was parked. - SP uint64 // SP of goroutine when it was parked. - BP uint64 // BP of goroutine when it was parked (go >= 1.7). - LR uint64 // LR of goroutine when it was parked. - GoPC uint64 // PC of 'go' statement that created this goroutine. - StartPC uint64 // PC of the first function run on this goroutine. - Status uint64 - stkbarVar *Variable // stkbar field of g struct - stkbarPos int // stkbarPos field of g struct - stack stack // value of stack + ID int // Goroutine ID + PC uint64 // PC of goroutine when it was parked. + SP uint64 // SP of goroutine when it was parked. + BP uint64 // BP of goroutine when it was parked (go >= 1.7). + LR uint64 // LR of goroutine when it was parked. + GoPC uint64 // PC of 'go' statement that created this goroutine. + StartPC uint64 // PC of the first function run on this goroutine. + Status uint64 + stack stack // value of stack + + WaitSince int64 + WaitReason int64 SystemStack bool // SystemStack is true if this goroutine is currently executing on a system stack. @@ -310,16 +317,13 @@ func GoroutinesInfo(dbp *Target, start, count int) ([]*G, int, error) { threads := dbp.ThreadList() for _, th := range threads { - if th.Blocked() { - continue - } g, _ := GetG(th) if g != nil { threadg[g.ID] = g } } - allgptr, allglen, err := dbp.gcache.getRuntimeAllg(dbp.BinInfo(), dbp.CurrentThread()) + allgptr, allglen, err := dbp.gcache.getRuntimeAllg(dbp.BinInfo(), dbp.Memory()) if err != nil { return nil, -1, err } @@ -328,7 +332,7 @@ func GoroutinesInfo(dbp *Target, start, count int) ([]*G, int, error) { if count != 0 && len(allg) >= count { return allg, int(i), nil } - gvar, err := newGVariable(dbp.CurrentThread(), uintptr(allgptr+(i*uint64(dbp.BinInfo().Arch.PtrSize()))), true) + gvar, err := newGVariable(dbp.CurrentThread(), allgptr+(i*uint64(dbp.BinInfo().Arch.PtrSize())), true) if err != nil { allg = append(allg, &G{Unreadable: err}) continue @@ -434,16 +438,16 @@ func getGVariable(thread Thread) (*Variable, error) { gaddr, hasgaddr := regs.GAddr() if !hasgaddr { var err error - gaddr, err = readUintRaw(thread, uintptr(regs.TLS()+thread.BinInfo().GStructOffset()), int64(thread.BinInfo().Arch.PtrSize())) + gaddr, err = readUintRaw(thread.ProcessMemory(), regs.TLS()+thread.BinInfo().GStructOffset(), int64(thread.BinInfo().Arch.PtrSize())) if err != nil { return nil, err } } - return newGVariable(thread, uintptr(gaddr), thread.BinInfo().Arch.DerefTLS()) + return newGVariable(thread, gaddr, thread.BinInfo().Arch.DerefTLS()) } -func newGVariable(thread Thread, gaddr uintptr, deref bool) (*Variable, error) { +func newGVariable(thread Thread, gaddr uint64, deref bool) (*Variable, error) { typ, err := thread.BinInfo().findType("runtime.g") if err != nil { return nil, err @@ -493,7 +497,7 @@ func (g *G) UserCurrent() Location { frame := it.Frame() if frame.Call.Fn != nil { name := frame.Call.Fn.Name - if strings.Contains(name, ".") && (!strings.HasPrefix(name, "runtime.") || frame.Call.Fn.exportedRuntime()) { + if strings.Contains(name, ".") && (!strings.HasPrefix(name, "runtime.") || frame.Call.Fn.exportedRuntime()) && !strings.HasPrefix(name, "internal/") && !strings.HasPrefix(name, "runtime/internal") { return frame.Call } } @@ -517,9 +521,28 @@ func (g *G) Go() Location { } // StartLoc returns the starting location of the goroutine. -func (g *G) StartLoc() Location { - f, l, fn := g.variable.bi.PCToLine(g.StartPC) - return Location{PC: g.StartPC, File: f, Line: l, Fn: fn} +func (g *G) StartLoc(tgt *Target) Location { + fn := g.variable.bi.PCToFunc(g.StartPC) + fn = tgt.dwrapUnwrap(fn) + if fn == nil { + return Location{PC: g.StartPC} + } + f, l := fn.cu.lineInfo.PCToLine(fn.Entry, fn.Entry) + return Location{PC: fn.Entry, File: f, Line: l, Fn: fn} +} + +// System returns true if g is a system goroutine. See isSystemGoroutine in +// $GOROOT/src/runtime/traceback.go. +func (g *G) System(tgt *Target) bool { + loc := g.StartLoc(tgt) + if loc.Fn == nil { + return false + } + switch loc.Fn.Name { + case "runtime.main", "runtime.handleAsyncEvent": + return false + } + return strings.HasPrefix(loc.Fn.Name, "runtime.") } func (g *G) Labels() map[string]string { @@ -563,19 +586,19 @@ func (err *IsNilErr) Error() string { return fmt.Sprintf("%s is nil", err.name) } -func globalScope(bi *BinaryInfo, image *Image, mem MemoryReadWriter) *EvalScope { - return &EvalScope{Location: Location{}, Regs: op.DwarfRegisters{StaticBase: image.StaticBase}, Mem: mem, g: nil, BinInfo: bi, frameOffset: 0} +func globalScope(tgt *Target, bi *BinaryInfo, image *Image, mem MemoryReadWriter) *EvalScope { + return &EvalScope{Location: Location{}, Regs: op.DwarfRegisters{StaticBase: image.StaticBase}, Mem: mem, g: nil, BinInfo: bi, target: tgt, frameOffset: 0} } -func newVariableFromThread(t Thread, name string, addr uintptr, dwarfType godwarf.Type) *Variable { - return newVariable(name, addr, dwarfType, t.BinInfo(), t) +func newVariableFromThread(t Thread, name string, addr uint64, dwarfType godwarf.Type) *Variable { + return newVariable(name, addr, dwarfType, t.BinInfo(), t.ProcessMemory()) } -func (v *Variable) newVariable(name string, addr uintptr, dwarfType godwarf.Type, mem MemoryReadWriter) *Variable { +func (v *Variable) newVariable(name string, addr uint64, dwarfType godwarf.Type, mem MemoryReadWriter) *Variable { return newVariable(name, addr, dwarfType, v.bi, mem) } -func newVariable(name string, addr uintptr, dwarfType godwarf.Type, bi *BinaryInfo, mem MemoryReadWriter) *Variable { +func newVariable(name string, addr uint64, dwarfType godwarf.Type, bi *BinaryInfo, mem MemoryReadWriter) *Variable { if styp, isstruct := dwarfType.(*godwarf.StructType); isstruct && !strings.Contains(styp.Name, "<") && !strings.Contains(styp.Name, "{") { // For named structs the compiler will emit a DW_TAG_structure_type entry // and a DW_TAG_typedef entry. @@ -625,8 +648,7 @@ func newVariable(name string, addr uintptr, dwarfType godwarf.Type, bi *BinaryIn v.Kind = reflect.String } if v.Addr != 0 { - n, err := readUintRaw(v.mem, v.Addr, int64(v.bi.Arch.PtrSize())) - v.Base, v.Unreadable = uintptr(n), err + v.Base, v.Unreadable = readUintRaw(v.mem, v.Addr, int64(v.bi.Arch.PtrSize())) } } case *godwarf.ChanType: @@ -755,10 +777,20 @@ func (v *Variable) TypeString() string { if v == nilVariable { return "nil" } - if v.DwarfType != nil { + if v.DwarfType == nil { + return v.Kind.String() + } + if v.DwarfType.Common().Name != "" { return v.DwarfType.Common().Name } - return v.Kind.String() + r := v.DwarfType.String() + if r == "*void" { + cu := v.bi.Images[v.DwarfType.Common().Index].findCompileUnitForOffset(v.DwarfType.Common().Offset) + if cu != nil && cu.isgo { + r = "unsafe.Pointer" + } + } + return r } func (v *Variable) toField(field *godwarf.StructField) (*Variable, error) { @@ -778,7 +810,7 @@ func (v *Variable) toField(field *godwarf.StructField) (*Variable, error) { name = fmt.Sprintf("%s.%s", v.Name, field.Name) } } - return v.newVariable(name, uintptr(int64(v.Addr)+field.ByteOffset), field.Type, v.mem), nil + return v.newVariable(name, uint64(int64(v.Addr)+field.ByteOffset), field.Type, v.mem), nil } // ErrNoGoroutine returned when a G could not be found @@ -800,7 +832,7 @@ func (v *Variable) parseG() (*G, error) { if deref { var err error - gaddr, err = readUintRaw(mem, uintptr(gaddr), int64(v.bi.Arch.PtrSize())) + gaddr, err = readUintRaw(mem, gaddr, int64(v.bi.Arch.PtrSize())) if err != nil { return nil, fmt.Errorf("error derefing *G %s", err) } @@ -812,26 +844,27 @@ func (v *Variable) parseG() (*G, error) { } return nil, ErrNoGoroutine{tid: id} } - for { - if _, isptr := v.RealType.(*godwarf.PtrType); !isptr { - break - } - v = v.maybeDereference() + isptr := func(t godwarf.Type) bool { + _, ok := t.(*godwarf.PtrType) + return ok + } + for isptr(v.RealType) { + v = v.maybeDereference() // +rtype g } v.mem = cacheMemory(v.mem, v.Addr, int(v.RealType.Size())) - schedVar := v.loadFieldNamed("sched") + schedVar := v.loadFieldNamed("sched") // +rtype gobuf if schedVar == nil { return nil, ErrUnreadableG } - pc, _ := constant.Int64Val(schedVar.fieldVariable("pc").Value) - sp, _ := constant.Int64Val(schedVar.fieldVariable("sp").Value) + pc, _ := constant.Int64Val(schedVar.fieldVariable("pc").Value) // +rtype uintptr + sp, _ := constant.Int64Val(schedVar.fieldVariable("sp").Value) // +rtype uintptr var bp, lr int64 - if bpvar := schedVar.fieldVariable("bp"); bpvar != nil && bpvar.Value != nil { + if bpvar := schedVar.fieldVariable("bp"); /* +rtype -opt uintptr */ bpvar != nil && bpvar.Value != nil { bp, _ = constant.Int64Val(bpvar.Value) } - if bpvar := schedVar.fieldVariable("lr"); bpvar != nil && bpvar.Value != nil { + if bpvar := schedVar.fieldVariable("lr"); /* +rtype -opt uintptr */ bpvar != nil && bpvar.Value != nil { lr, _ = constant.Int64Val(bpvar.Value) } @@ -847,27 +880,25 @@ func (v *Variable) parseG() (*G, error) { return n } - id := loadInt64Maybe("goid") - gopc := loadInt64Maybe("gopc") - startpc := loadInt64Maybe("startpc") + id := loadInt64Maybe("goid") // +rtype int64 + gopc := loadInt64Maybe("gopc") // +rtype uintptr + startpc := loadInt64Maybe("startpc") // +rtype uintptr + waitSince := loadInt64Maybe("waitsince") // +rtype int64 + waitReason := int64(0) + if producer := v.bi.Producer(); producer != "" && goversion.ProducerAfterOrEqual(producer, 1, 11) { + waitReason = loadInt64Maybe("waitreason") // +rtype -opt waitReason + } var stackhi, stacklo uint64 - if stackVar := v.loadFieldNamed("stack"); stackVar != nil { - if stackhiVar := stackVar.fieldVariable("hi"); stackhiVar != nil { + if stackVar := v.loadFieldNamed("stack"); /* +rtype stack */ stackVar != nil { + if stackhiVar := stackVar.fieldVariable("hi"); /* +rtype uintptr */ stackhiVar != nil { stackhi, _ = constant.Uint64Val(stackhiVar.Value) } - if stackloVar := stackVar.fieldVariable("lo"); stackloVar != nil { + if stackloVar := stackVar.fieldVariable("lo"); /* +rtype uintptr */ stackloVar != nil { stacklo, _ = constant.Uint64Val(stackloVar.Value) } } - stkbarVar := v.loadFieldNamed("stkbar") - stkbarVarPosFld := v.loadFieldNamed("stkbarPos") - var stkbarPos int64 - if stkbarVarPosFld != nil { // stack barriers were removed in Go 1.9 - stkbarPos, _ = constant.Int64Val(stkbarVarPosFld.Value) - } - - status := loadInt64Maybe("atomicstatus") + status := loadInt64Maybe("atomicstatus") // +rtype uint32 if unreadable { return nil, ErrUnreadableG @@ -886,10 +917,10 @@ func (v *Variable) parseG() (*G, error) { BP: uint64(bp), LR: uint64(lr), Status: uint64(status), + WaitSince: waitSince, + WaitReason: waitReason, CurrentLoc: Location{PC: uint64(pc), File: f, Line: l, Fn: fn}, variable: v, - stkbarVar: stkbarVar, - stkbarPos: int(stkbarPos), stack: stack{hi: stackhi, lo: stacklo}, } return g, nil @@ -922,8 +953,8 @@ func (v *Variable) fieldVariable(name string) *Variable { var errTracebackAncestorsDisabled = errors.New("tracebackancestors is disabled") // Ancestors returns the list of ancestors for g. -func Ancestors(p Process, g *G, n int) ([]Ancestor, error) { - scope := globalScope(p.BinInfo(), p.BinInfo().Images[0], p.CurrentThread()) +func Ancestors(p *Target, g *G, n int) ([]Ancestor, error) { + scope := globalScope(p, p.BinInfo(), p.BinInfo().Images[0], p.Memory()) tbav, err := scope.EvalExpression("runtime.debug.tracebackancestors", loadSingleValue) if err == nil && tbav.Unreadable == nil && tbav.Kind == reflect.Int { tba, _ := constant.Int64Val(tbav.Value) @@ -1009,31 +1040,6 @@ func (a *Ancestor) Stack(n int) ([]Stackframe, error) { return r, nil } -// Returns the list of saved return addresses used by stack barriers -func (g *G) stkbar() ([]savedLR, error) { - if g.stkbarVar == nil { // stack barriers were removed in Go 1.9 - return nil, nil - } - g.stkbarVar.loadValue(LoadConfig{false, 1, 0, int(g.stkbarVar.Len), 3, 0}) - if g.stkbarVar.Unreadable != nil { - return nil, fmt.Errorf("unreadable stkbar: %v", g.stkbarVar.Unreadable) - } - r := make([]savedLR, len(g.stkbarVar.Children)) - for i, child := range g.stkbarVar.Children { - for _, field := range child.Children { - switch field.Name { - case "savedLRPtr": - ptr, _ := constant.Int64Val(field.Value) - r[i].ptr = uint64(ptr) - case "savedLRVal": - val, _ := constant.Int64Val(field.Value) - r[i].val = uint64(val) - } - } - } - return r, nil -} - func (v *Variable) structMember(memberName string) (*Variable, error) { if v.Unreadable != nil { return v.clone(), nil @@ -1057,59 +1063,61 @@ func (v *Variable) structMember(memberName string) (*Variable, error) { v = &v.Children[0] } } - structVar := v.maybeDereference() - structVar.Name = v.Name - if structVar.Unreadable != nil { - return structVar, nil - } - switch t := structVar.RealType.(type) { - case *godwarf.StructType: - for _, field := range t.Field { - if field.Name != memberName { - continue - } - return structVar.toField(field) - } - // Check for embedded field only if field was - // not a regular struct member - for _, field := range t.Field { - isEmbeddedStructMember := - field.Embedded || - (field.Type.Common().Name == field.Name) || - (len(field.Name) > 1 && - field.Name[0] == '*' && - field.Type.Common().Name[1:] == field.Name[1:]) - if !isEmbeddedStructMember { - continue - } - // Check for embedded field referenced by type name - parts := strings.Split(field.Name, ".") - if len(parts) > 1 && parts[1] == memberName { + queue := []*Variable{v} + seen := map[string]struct{}{} // prevent infinite loops + first := true + + for len(queue) > 0 { + v := queue[0] + queue = append(queue[:0], queue[1:]...) + if _, isseen := seen[v.RealType.String()]; isseen { + continue + } + seen[v.RealType.String()] = struct{}{} + + structVar := v.maybeDereference() + structVar.Name = v.Name + if structVar.Unreadable != nil { + return structVar, nil + } + + switch t := structVar.RealType.(type) { + case *godwarf.StructType: + for _, field := range t.Field { + if field.Name == memberName { + return structVar.toField(field) + } + isEmbeddedStructMember := + field.Embedded || + (field.Type.Common().Name == field.Name) || + (len(field.Name) > 1 && + field.Name[0] == '*' && + field.Type.Common().Name[1:] == field.Name[1:]) + if !isEmbeddedStructMember { + continue + } embeddedVar, err := structVar.toField(field) if err != nil { return nil, err } - return embeddedVar, nil - } - // Recursively check for promoted fields on the embedded field - embeddedVar, err := structVar.toField(field) - if err != nil { - return nil, err + // Check for embedded field referenced by type name + parts := strings.Split(field.Name, ".") + if len(parts) > 1 && parts[1] == memberName { + return embeddedVar, nil + } + embeddedVar.Name = structVar.Name + queue = append(queue, embeddedVar) } - embeddedVar.Name = structVar.Name - embeddedField, _ := embeddedVar.structMember(memberName) - if embeddedField != nil { - return embeddedField, nil + default: + if first { + return nil, fmt.Errorf("%s (type %s) is not a struct", vname, structVar.TypeString()) } } - return nil, fmt.Errorf("%s has no member %s", vname, memberName) - default: - if v.Name == "" { - return nil, fmt.Errorf("type %s is not a struct", structVar.TypeString()) - } - return nil, fmt.Errorf("%s (type %s) is not a struct", vname, structVar.TypeString()) + first = false } + + return nil, fmt.Errorf("%s has no member %s", vname, memberName) } func readVarEntry(entry *godwarf.Tree, image *Image) (name string, typ godwarf.Type, err error) { @@ -1128,7 +1136,7 @@ func readVarEntry(entry *godwarf.Tree, image *Image) (name string, typ godwarf.T // Extracts the name and type of a variable from a dwarf entry // then executes the instructions given in the DW_AT_location attribute to grab the variable's address -func extractVarInfoFromEntry(bi *BinaryInfo, image *Image, regs op.DwarfRegisters, mem MemoryReadWriter, entry *godwarf.Tree) (*Variable, error) { +func extractVarInfoFromEntry(tgt *Target, bi *BinaryInfo, image *Image, regs op.DwarfRegisters, mem MemoryReadWriter, entry *godwarf.Tree, dictAddr uint64) (*Variable, error) { if entry.Tag != dwarf.TagFormalParameter && entry.Tag != dwarf.TagVariable { return nil, fmt.Errorf("invalid entry tag, only supports FormalParameter and Variable, got %s", entry.Tag.String()) } @@ -1138,17 +1146,30 @@ func extractVarInfoFromEntry(bi *BinaryInfo, image *Image, regs op.DwarfRegister return nil, err } - addr, pieces, descr, err := bi.Location(entry, dwarf.AttrLocation, regs.PC(), regs) + t, err = resolveParametricType(tgt, bi, mem, t, dictAddr) + if err != nil { + // Log the error, keep going with t, which will be the shape type + logflags.DebuggerLogger().Errorf("could not resolve parametric type of %s", n) + } + + addr, pieces, descr, err := bi.Location(entry, dwarf.AttrLocation, regs.PC(), regs, mem) if pieces != nil { - addr = fakeAddress var cmem *compositeMemory - cmem, err = newCompositeMemory(mem, regs, pieces) + if tgt != nil { + addr, cmem, err = tgt.newCompositeMemory(mem, regs, pieces, descr) + } else { + cmem, err = newCompositeMemory(mem, bi.Arch, regs, pieces) + if cmem != nil { + cmem.base = fakeAddressUnresolv + addr = int64(cmem.base) + } + } if cmem != nil { mem = cmem } } - v := newVariable(n, uintptr(addr), t, bi, mem) + v := newVariable(n, uint64(addr), t, bi, mem) if pieces != nil { v.Flags |= VariableFakeAddress } @@ -1172,8 +1193,8 @@ func (v *Variable) maybeDereference() *Variable { // fake pointer variable constructed by casting an integer to a pointer type return &v.Children[0] } - ptrval, err := readUintRaw(v.mem, uintptr(v.Addr), t.ByteSize) - r := v.newVariable("", uintptr(ptrval), t.Type, DereferenceMemory(v.mem)) + ptrval, err := readUintRaw(v.mem, v.Addr, t.ByteSize) + r := v.newVariable("", ptrval, t.Type, DereferenceMemory(v.mem)) if err != nil { r.Unreadable = err } @@ -1236,9 +1257,8 @@ func (v *Variable) loadValueInternal(recurseLevel int, cfg LoadConfig) { case reflect.String: var val string - if v.Flags&VariableCPtr == 0 { - val, v.Unreadable = readStringValue(DereferenceMemory(v.mem), v.Base, v.Len, cfg) - } else { + switch { + case v.Flags&VariableCPtr != 0: var done bool val, done, v.Unreadable = readCStringValue(DereferenceMemory(v.mem), v.Base, cfg) if v.Unreadable == nil { @@ -1247,6 +1267,19 @@ func (v *Variable) loadValueInternal(recurseLevel int, cfg LoadConfig) { v.Len++ } } + + case v.Flags&VariableCPURegister != 0: + val = fmt.Sprintf("%x", v.reg.Bytes) + s := v.Base - fakeAddressUnresolv + if s < uint64(len(val)) { + val = val[s:] + if v.Len >= 0 && v.Len < int64(len(val)) { + val = val[:v.Len] + } + } + + default: + val, v.Unreadable = readStringValue(DereferenceMemory(v.mem), v.Base, v.Len, cfg) } v.Value = constant.MakeString(val) @@ -1282,10 +1315,13 @@ func (v *Variable) loadValueInternal(recurseLevel int, cfg LoadConfig) { val, v.Unreadable = readIntRaw(v.mem, v.Addr, v.RealType.(*godwarf.IntType).ByteSize) v.Value = constant.MakeInt64(val) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - var val uint64 - val, v.Unreadable = readUintRaw(v.mem, v.Addr, v.RealType.(*godwarf.UintType).ByteSize) - v.Value = constant.MakeUint64(val) - + if v.Flags&VariableCPURegister != 0 { + v.Value = constant.MakeUint64(v.reg.Uint64Val) + } else { + var val uint64 + val, v.Unreadable = readUintRaw(v.mem, v.Addr, v.RealType.(*godwarf.UintType).ByteSize) + v.Value = constant.MakeUint64(val) + } case reflect.Bool: val := make([]byte, 1) _, err := v.mem.ReadMemory(val, v.Addr) @@ -1341,14 +1377,14 @@ func convertToEface(srcv, dstv *Variable) error { return dstv.writeEmptyInterface(typeAddr, srcv) } -func readStringInfo(mem MemoryReadWriter, arch *Arch, addr uintptr) (uintptr, int64, error) { +func readStringInfo(mem MemoryReadWriter, arch *Arch, addr uint64) (uint64, int64, error) { // string data structure is always two ptrs in size. Addr, followed by len // http://research.swtch.com/godata mem = cacheMemory(mem, addr, arch.PtrSize()*2) // read len - strlen, err := readIntRaw(mem, addr+uintptr(arch.PtrSize()), int64(arch.PtrSize())) + strlen, err := readIntRaw(mem, addr+uint64(arch.PtrSize()), int64(arch.PtrSize())) if err != nil { return 0, 0, fmt.Errorf("could not read string len %s", err) } @@ -1357,18 +1393,17 @@ func readStringInfo(mem MemoryReadWriter, arch *Arch, addr uintptr) (uintptr, in } // read addr - val, err := readUintRaw(mem, addr, int64(arch.PtrSize())) + addr, err = readUintRaw(mem, addr, int64(arch.PtrSize())) if err != nil { return 0, 0, fmt.Errorf("could not read string pointer %s", err) } - addr = uintptr(val) if addr == 0 { return 0, 0, nil } return addr, strlen, nil } -func readStringValue(mem MemoryReadWriter, addr uintptr, strlen int64, cfg LoadConfig) (string, error) { +func readStringValue(mem MemoryReadWriter, addr uint64, strlen int64, cfg LoadConfig) (string, error) { if strlen == 0 { return "", nil } @@ -1387,7 +1422,7 @@ func readStringValue(mem MemoryReadWriter, addr uintptr, strlen int64, cfg LoadC return string(val), nil } -func readCStringValue(mem MemoryReadWriter, addr uintptr, cfg LoadConfig) (string, bool, error) { +func readCStringValue(mem MemoryReadWriter, addr uint64, cfg LoadConfig) (string, bool, error) { buf := make([]byte, cfg.MaxStringLen) // val := buf[:0] // part of the string we've already read @@ -1399,7 +1434,7 @@ func readCStringValue(mem MemoryReadWriter, addr uintptr, cfg LoadConfig) (strin // memory we don't even need. // We don't know how big a page is but 1024 is a reasonable minimum common // divisor for all architectures. - curaddr := addr + uintptr(len(val)) + curaddr := addr + uint64(len(val)) maxsize := int(alignAddr(int64(curaddr+1), 1024) - int64(curaddr)) size := len(buf) if size > maxsize { @@ -1444,12 +1479,13 @@ func (v *Variable) loadSliceInfo(t *godwarf.SliceType) { switch f.Name { case sliceArrayFieldName: var base uint64 - base, err = readUintRaw(v.mem, uintptr(int64(v.Addr)+f.ByteOffset), f.Type.Size()) + base, err = readUintRaw(v.mem, uint64(int64(v.Addr)+f.ByteOffset), f.Type.Size()) if err == nil { - v.Base = uintptr(base) + v.Base = base // Dereference array type to get value type ptrType, ok := f.Type.(*godwarf.PtrType) if !ok { + //lint:ignore ST1005 backwards compatibility v.Unreadable = fmt.Errorf("Invalid type %s in slice array", f.Type) return } @@ -1538,6 +1574,7 @@ func (v *Variable) loadArrayValues(recurseLevel int, cfg LoadConfig) { return } if v.Len < 0 { + //lint:ignore ST1005 backwards compatibility v.Unreadable = errors.New("Negative array length") return } @@ -1560,7 +1597,7 @@ func (v *Variable) loadArrayValues(recurseLevel int, cfg LoadConfig) { } for i := int64(0); i < count; i++ { - fieldvar := v.newVariable("", uintptr(int64(v.Base)+(i*v.stride)), v.fieldType, mem) + fieldvar := v.newVariable("", uint64(int64(v.Base)+(i*v.stride)), v.fieldType, mem) fieldvar.loadValueInternal(recurseLevel+1, cfg) if fieldvar.Unreadable != nil { @@ -1589,7 +1626,7 @@ func (v *Variable) readComplex(size int64) { ftyp := &godwarf.FloatType{BasicType: godwarf.BasicType{CommonType: godwarf.CommonType{ByteSize: fs, Name: fmt.Sprintf("float%d", fs)}, BitSize: fs * 8, BitOffset: 0}} realvar := v.newVariable("real", v.Addr, ftyp, v.mem) - imagvar := v.newVariable("imaginary", v.Addr+uintptr(fs), ftyp, v.mem) + imagvar := v.newVariable("imaginary", v.Addr+uint64(fs), ftyp, v.mem) realvar.loadValue(loadSingleValue) imagvar.loadValue(loadSingleValue) v.Value = constant.BinaryOp(realvar.Value, token.ADD, constant.MakeImag(imagvar.Value)) @@ -1601,11 +1638,11 @@ func (v *Variable) writeComplex(real, imag float64, size int64) error { return err } imagaddr := *v - imagaddr.Addr += uintptr(size / 2) + imagaddr.Addr += uint64(size / 2) return imagaddr.writeFloatRaw(imag, int64(size/2)) } -func readIntRaw(mem MemoryReadWriter, addr uintptr, size int64) (int64, error) { +func readIntRaw(mem MemoryReadWriter, addr uint64, size int64) (int64, error) { var n int64 val := make([]byte, int(size)) @@ -1646,7 +1683,7 @@ func (v *Variable) writeUint(value uint64, size int64) error { return err } -func readUintRaw(mem MemoryReadWriter, addr uintptr, size int64) (uint64, error) { +func readUintRaw(mem MemoryReadWriter, addr uint64, size int64) (uint64, error) { var n uint64 val := make([]byte, int(size)) @@ -1731,7 +1768,7 @@ func (v *Variable) writeEmptyInterface(typeAddr uint64, data *Variable) error { return nil } -func (v *Variable) writeSlice(len, cap int64, base uintptr) error { +func (v *Variable) writeSlice(len, cap int64, base uint64) error { for _, f := range v.RealType.(*godwarf.SliceType).Field { switch f.Name { case sliceArrayFieldName: @@ -1782,13 +1819,13 @@ func (v *Variable) readFunctionPtr() { return } - val, err := readUintRaw(v.mem, uintptr(v.closureAddr), int64(v.bi.Arch.PtrSize())) + val, err := readUintRaw(v.mem, v.closureAddr, int64(v.bi.Arch.PtrSize())) if err != nil { v.Unreadable = err return } - v.Base = uintptr(val) + v.Base = val fn := v.bi.PCToFunc(uint64(v.Base)) if fn == nil { v.Unreadable = fmt.Errorf("could not find function for %#v", v.Base) @@ -1900,16 +1937,16 @@ func (v *Variable) mapIterator() *mapIterator { var err error field, _ := sv.toField(f) switch f.Name { - case "count": + case "count": // +rtype -fieldof hmap int v.Len, err = field.asInt() - case "B": + case "B": // +rtype -fieldof hmap uint8 var b uint64 b, err = field.asUint() it.numbuckets = 1 << b it.oldmask = (1 << (b - 1)) - 1 - case "buckets": + case "buckets": // +rtype -fieldof hmap unsafe.Pointer it.buckets = field.maybeDereference() - case "oldbuckets": + case "oldbuckets": // +rtype -fieldof hmap unsafe.Pointer it.oldbuckets = field.maybeDereference() } if err != nil { @@ -1949,7 +1986,7 @@ func (it *mapIterator) nextBucket() bool { for it.bidx < it.numbuckets { it.b = it.buckets.clone() - it.b.Addr += uintptr(uint64(it.buckets.DwarfType.Size()) * it.bidx) + it.b.Addr += uint64(it.buckets.DwarfType.Size()) * it.bidx if it.oldbuckets.Addr <= 0 { break @@ -1965,7 +2002,7 @@ func (it *mapIterator) nextBucket() bool { oldbidx := it.bidx & it.oldmask oldb := it.oldbuckets.clone() - oldb.Addr += uintptr(uint64(it.oldbuckets.DwarfType.Size()) * oldbidx) + oldb.Addr += uint64(it.oldbuckets.DwarfType.Size()) * oldbidx if it.mapEvacuated(oldb) { break @@ -2011,7 +2048,7 @@ func (it *mapIterator) nextBucket() bool { } switch f.Name { - case "tophash": + case "tophash": // +rtype -fieldof bmap [8]uint8 it.tophashes = field case "keys": it.keys = field @@ -2127,15 +2164,20 @@ func (v *Variable) readInterface() (_type, data *Variable, isnil bool) { ityp := resolveTypedef(&v.RealType.(*godwarf.InterfaceType).TypedefType).(*godwarf.StructType) + // +rtype -field iface.tab *itab + // +rtype -field iface.data unsafe.Pointer + // +rtype -field eface._type *_type + // +rtype -field eface.data unsafe.Pointer + for _, f := range ityp.Field { switch f.Name { case "tab": // for runtime.iface - tab, _ := v.toField(f) + tab, _ := v.toField(f) // +rtype *itab tab = tab.maybeDereference() isnil = tab.Addr == 0 if !isnil { var err error - _type, err = tab.structMember("_type") + _type, err = tab.structMember("_type") // +rtype *_type if err != nil { v.Unreadable = fmt.Errorf("invalid interface type: %v", err) return @@ -2207,7 +2249,7 @@ func (v *Variable) ConstDescr() string { if ctyp == nil { return "" } - if typename := v.DwarfType.Common().Name; strings.Index(typename, ".") < 0 || strings.HasPrefix(typename, "C.") { + if typename := v.DwarfType.Common().Name; !strings.Contains(typename, ".") || strings.HasPrefix(typename, "C.") { // only attempt to use constants for user defined type, otherwise every // int variable with value 1 will be described with os.SEEK_CUR and other // similar problems. @@ -2224,6 +2266,73 @@ func (v *Variable) ConstDescr() string { return "" } +// registerVariableTypeConv implements type conversions for CPU register variables (REGNAME.int8, etc) +func (v *Variable) registerVariableTypeConv(newtyp string) (*Variable, error) { + var n int = 0 + for i := 0; i < len(v.reg.Bytes); i += n { + var child *Variable + switch newtyp { + case "int8": + child = newConstant(constant.MakeInt64(int64(int8(v.reg.Bytes[i]))), v.mem) + n = 1 + case "int16": + child = newConstant(constant.MakeInt64(int64(int16(binary.LittleEndian.Uint16(v.reg.Bytes[i:])))), v.mem) + n = 2 + case "int32": + child = newConstant(constant.MakeInt64(int64(int32(binary.LittleEndian.Uint32(v.reg.Bytes[i:])))), v.mem) + n = 4 + case "int64": + child = newConstant(constant.MakeInt64(int64(binary.LittleEndian.Uint64(v.reg.Bytes[i:]))), v.mem) + n = 8 + case "uint8": + child = newConstant(constant.MakeUint64(uint64(v.reg.Bytes[i])), v.mem) + n = 1 + case "uint16": + child = newConstant(constant.MakeUint64(uint64(binary.LittleEndian.Uint16(v.reg.Bytes[i:]))), v.mem) + n = 2 + case "uint32": + child = newConstant(constant.MakeUint64(uint64(binary.LittleEndian.Uint32(v.reg.Bytes[i:]))), v.mem) + n = 4 + case "uint64": + child = newConstant(constant.MakeUint64(uint64(binary.LittleEndian.Uint64(v.reg.Bytes[i:]))), v.mem) + n = 8 + case "float32": + a := binary.LittleEndian.Uint32(v.reg.Bytes[i:]) + x := *(*float32)(unsafe.Pointer(&a)) + child = newConstant(constant.MakeFloat64(float64(x)), v.mem) + n = 4 + case "float64": + a := binary.LittleEndian.Uint64(v.reg.Bytes[i:]) + x := *(*float64)(unsafe.Pointer(&a)) + child = newConstant(constant.MakeFloat64(x), v.mem) + n = 8 + default: + if n == 0 { + for _, pfx := range []string{"uint", "int"} { + if strings.HasPrefix(newtyp, pfx) { + n, _ = strconv.Atoi(newtyp[len(pfx):]) + break + } + } + if n == 0 || popcnt(uint64(n)) != 1 { + return nil, fmt.Errorf("unknown CPU register type conversion to %q", newtyp) + } + n = n / 8 + } + child = newConstant(constant.MakeString(fmt.Sprintf("%x", v.reg.Bytes[i:][:n])), v.mem) + } + v.Children = append(v.Children, *child) + } + + v.loaded = true + v.Kind = reflect.Array + v.Len = int64(len(v.Children)) + v.Base = fakeAddressUnresolv + v.DwarfType = fakeArrayType(uint64(len(v.Children)), &godwarf.VoidType{CommonType: godwarf.CommonType{ByteSize: int64(n)}}) + v.RealType = v.DwarfType + return v, nil +} + // popcnt is the number of bits set to 1 in x. // It's the same as math/bits.OnesCount64, copied here so that we can build // on versions of go that don't have math/bits. @@ -2282,9 +2391,7 @@ func (cm constantsMap) Get(typ godwarf.Type) *constantType { ctyp.initialized = true sort.Sort(constantValuesByValue(ctyp.values)) for i := range ctyp.values { - if strings.HasPrefix(ctyp.values[i].name, typepkg) { - ctyp.values[i].name = ctyp.values[i].name[len(typepkg):] - } + ctyp.values[i].name = strings.TrimPrefix(ctyp.values[i].name, typepkg) if popcnt(uint64(ctyp.values[i].value)) == 1 { ctyp.values[i].singleBit = true } diff --git a/pkg/proc/winutil/regs.go b/pkg/proc/winutil/regs.go index 3822e41596..a2c482e971 100644 --- a/pkg/proc/winutil/regs.go +++ b/pkg/proc/winutil/regs.go @@ -6,8 +6,6 @@ import ( "fmt" "unsafe" - "golang.org/x/arch/x86/x86asm" - "github.com/go-delve/delve/pkg/proc" ) @@ -164,164 +162,6 @@ func (r *AMD64Registers) GAddr() (uint64, bool) { return 0, false } -// Get returns the value of the n-th register (in x86asm order). -func (r *AMD64Registers) Get(n int) (uint64, error) { - reg := x86asm.Reg(n) - const ( - mask8 = 0x000f - mask16 = 0x00ff - mask32 = 0xffff - ) - - switch reg { - // 8-bit - case x86asm.AL: - return r.rax & mask8, nil - case x86asm.CL: - return r.rcx & mask8, nil - case x86asm.DL: - return r.rdx & mask8, nil - case x86asm.BL: - return r.rbx & mask8, nil - case x86asm.AH: - return (r.rax >> 8) & mask8, nil - case x86asm.CH: - return (r.rcx >> 8) & mask8, nil - case x86asm.DH: - return (r.rdx >> 8) & mask8, nil - case x86asm.BH: - return (r.rbx >> 8) & mask8, nil - case x86asm.SPB: - return r.rsp & mask8, nil - case x86asm.BPB: - return r.rbp & mask8, nil - case x86asm.SIB: - return r.rsi & mask8, nil - case x86asm.DIB: - return r.rdi & mask8, nil - case x86asm.R8B: - return r.r8 & mask8, nil - case x86asm.R9B: - return r.r9 & mask8, nil - case x86asm.R10B: - return r.r10 & mask8, nil - case x86asm.R11B: - return r.r11 & mask8, nil - case x86asm.R12B: - return r.r12 & mask8, nil - case x86asm.R13B: - return r.r13 & mask8, nil - case x86asm.R14B: - return r.r14 & mask8, nil - case x86asm.R15B: - return r.r15 & mask8, nil - - // 16-bit - case x86asm.AX: - return r.rax & mask16, nil - case x86asm.CX: - return r.rcx & mask16, nil - case x86asm.DX: - return r.rdx & mask16, nil - case x86asm.BX: - return r.rbx & mask16, nil - case x86asm.SP: - return r.rsp & mask16, nil - case x86asm.BP: - return r.rbp & mask16, nil - case x86asm.SI: - return r.rsi & mask16, nil - case x86asm.DI: - return r.rdi & mask16, nil - case x86asm.R8W: - return r.r8 & mask16, nil - case x86asm.R9W: - return r.r9 & mask16, nil - case x86asm.R10W: - return r.r10 & mask16, nil - case x86asm.R11W: - return r.r11 & mask16, nil - case x86asm.R12W: - return r.r12 & mask16, nil - case x86asm.R13W: - return r.r13 & mask16, nil - case x86asm.R14W: - return r.r14 & mask16, nil - case x86asm.R15W: - return r.r15 & mask16, nil - - // 32-bit - case x86asm.EAX: - return r.rax & mask32, nil - case x86asm.ECX: - return r.rcx & mask32, nil - case x86asm.EDX: - return r.rdx & mask32, nil - case x86asm.EBX: - return r.rbx & mask32, nil - case x86asm.ESP: - return r.rsp & mask32, nil - case x86asm.EBP: - return r.rbp & mask32, nil - case x86asm.ESI: - return r.rsi & mask32, nil - case x86asm.EDI: - return r.rdi & mask32, nil - case x86asm.R8L: - return r.r8 & mask32, nil - case x86asm.R9L: - return r.r9 & mask32, nil - case x86asm.R10L: - return r.r10 & mask32, nil - case x86asm.R11L: - return r.r11 & mask32, nil - case x86asm.R12L: - return r.r12 & mask32, nil - case x86asm.R13L: - return r.r13 & mask32, nil - case x86asm.R14L: - return r.r14 & mask32, nil - case x86asm.R15L: - return r.r15 & mask32, nil - - // 64-bit - case x86asm.RAX: - return r.rax, nil - case x86asm.RCX: - return r.rcx, nil - case x86asm.RDX: - return r.rdx, nil - case x86asm.RBX: - return r.rbx, nil - case x86asm.RSP: - return r.rsp, nil - case x86asm.RBP: - return r.rbp, nil - case x86asm.RSI: - return r.rsi, nil - case x86asm.RDI: - return r.rdi, nil - case x86asm.R8: - return r.r8, nil - case x86asm.R9: - return r.r9, nil - case x86asm.R10: - return r.r10, nil - case x86asm.R11: - return r.r11, nil - case x86asm.R12: - return r.r12, nil - case x86asm.R13: - return r.r13, nil - case x86asm.R14: - return r.r14, nil - case x86asm.R15: - return r.r15, nil - } - - return 0, proc.ErrUnknownRegister -} - // Copy returns a copy of these registers that is guaranteed not to change. func (r *AMD64Registers) Copy() (proc.Registers, error) { var rr AMD64Registers diff --git a/pkg/proc/x86_disasm.go b/pkg/proc/x86_disasm.go index ad962bf8a4..96e2070195 100644 --- a/pkg/proc/x86_disasm.go +++ b/pkg/proc/x86_disasm.go @@ -1,6 +1,8 @@ package proc import ( + "github.com/go-delve/delve/pkg/dwarf/op" + "golang.org/x/arch/x86/x86asm" ) @@ -8,7 +10,7 @@ type x86Inst x86asm.Inst // AsmDecode decodes the assembly instruction starting at mem[0:] into asmInst. // It assumes that the Loc and AtPC fields of asmInst have already been filled. -func x86AsmDecode(asmInst *AsmInstruction, mem []byte, regs Registers, memrw MemoryReadWriter, bi *BinaryInfo, bit int) error { +func x86AsmDecode(asmInst *AsmInstruction, mem []byte, regs *op.DwarfRegisters, memrw MemoryReadWriter, bi *BinaryInfo, bit int) error { inst, err := x86asm.Decode(mem, bit) if err != nil { asmInst.Inst = (*x86Inst)(nil) @@ -76,7 +78,7 @@ func (inst *x86Inst) OpcodeEquals(op uint64) bool { return uint64(inst.Op) == op } -func resolveCallArgX86(inst *x86asm.Inst, instAddr uint64, currentGoroutine bool, regs Registers, mem MemoryReadWriter, bininfo *BinaryInfo) *Location { +func resolveCallArgX86(inst *x86asm.Inst, instAddr uint64, currentGoroutine bool, regs *op.DwarfRegisters, mem MemoryReadWriter, bininfo *BinaryInfo) *Location { switch inst.Op { case x86asm.CALL, x86asm.LCALL, x86asm.JMP, x86asm.LJMP: // ok @@ -94,7 +96,7 @@ func resolveCallArgX86(inst *x86asm.Inst, instAddr uint64, currentGoroutine bool if !currentGoroutine || regs == nil { return nil } - pc, err = regs.Get(int(arg)) + pc, err = bininfo.Arch.getAsmRegister(regs, int(arg)) if err != nil { return nil } @@ -105,12 +107,12 @@ func resolveCallArgX86(inst *x86asm.Inst, instAddr uint64, currentGoroutine bool if arg.Segment != 0 { return nil } - base, err1 := regs.Get(int(arg.Base)) - index, err2 := regs.Get(int(arg.Index)) + base, err1 := bininfo.Arch.getAsmRegister(regs, int(arg.Base)) + index, err2 := bininfo.Arch.getAsmRegister(regs, int(arg.Index)) if err1 != nil || err2 != nil { return nil } - addr := uintptr(int64(base) + int64(index*uint64(arg.Scale)) + arg.Disp) + addr := uint64(int64(base) + int64(index*uint64(arg.Scale)) + arg.Disp) pc, err = readUintRaw(mem, addr, int64(inst.MemBytes)) if err != nil { return nil diff --git a/pkg/terminal/colorize/colorize.go b/pkg/terminal/colorize/colorize.go new file mode 100644 index 0000000000..4083931c8b --- /dev/null +++ b/pkg/terminal/colorize/colorize.go @@ -0,0 +1,298 @@ +package colorize + +import ( + "fmt" + "go/ast" + "go/parser" + "go/token" + "io" + "io/ioutil" + "path/filepath" + "reflect" + "sort" +) + +// Style describes the style of a chunk of text. +type Style uint8 + +const ( + NormalStyle Style = iota + KeywordStyle + StringStyle + NumberStyle + CommentStyle + LineNoStyle + ArrowStyle +) + +// Print prints to out a syntax highlighted version of the text read from +// reader, between lines startLine and endLine. +func Print(out io.Writer, path string, reader io.Reader, startLine, endLine, arrowLine int, colorEscapes map[Style]string) error { + buf, err := ioutil.ReadAll(reader) + if err != nil { + return err + } + + w := &lineWriter{w: out, lineRange: [2]int{startLine, endLine}, arrowLine: arrowLine, colorEscapes: colorEscapes} + + if filepath.Ext(path) != ".go" { + w.Write(NormalStyle, buf, true) + return nil + } + + var fset token.FileSet + f, err := parser.ParseFile(&fset, path, buf, parser.ParseComments) + if err != nil { + w.Write(NormalStyle, buf, true) + return nil + } + + var base int + + fset.Iterate(func(file *token.File) bool { + base = file.Base() + return false + }) + + toks := []colorTok{} + + emit := func(tok token.Token, start, end token.Pos) { + if _, ok := tokenToStyle[tok]; !ok { + return + } + start -= token.Pos(base) + if end == token.NoPos { + // end == token.NoPos it's a keyword and we have to find where it ends by looking at the file + for end = start; end < token.Pos(len(buf)); end++ { + if buf[end] < 'a' || buf[end] > 'z' { + break + } + } + } else { + end -= token.Pos(base) + } + if start < 0 || start >= end || end > token.Pos(len(buf)) { + // invalid token? + return + } + toks = append(toks, colorTok{tok, int(start), int(end)}) + } + + emit(token.PACKAGE, f.Package, token.NoPos) + + for _, cgrp := range f.Comments { + for _, cmnt := range cgrp.List { + emit(token.COMMENT, cmnt.Pos(), cmnt.End()) + } + } + + ast.Inspect(f, func(n ast.Node) bool { + if n == nil { + return true + } + + switch n := n.(type) { + case *ast.BasicLit: + emit(n.Kind, n.Pos(), n.End()) + return true + case *ast.Ident: + //TODO(aarzilli): builtin functions? basic types? + return true + case *ast.IfStmt: + emit(token.IF, n.If, token.NoPos) + if n.Else != nil { + for elsepos := int(n.Body.End()) - base; elsepos < len(buf)-4; elsepos++ { + if string(buf[elsepos:][:4]) == "else" { + emit(token.ELSE, token.Pos(elsepos+base), token.Pos(elsepos+base+4)) + break + } + } + } + return true + } + + nval := reflect.ValueOf(n) + if nval.Kind() != reflect.Ptr { + return true + } + nval = nval.Elem() + if nval.Kind() != reflect.Struct { + return true + } + + tokposval := nval.FieldByName("TokPos") + tokval := nval.FieldByName("Tok") + if tokposval != (reflect.Value{}) && tokval != (reflect.Value{}) { + emit(tokval.Interface().(token.Token), tokposval.Interface().(token.Pos), token.NoPos) + } + + for _, kwname := range []string{"Case", "Begin", "Defer", "Pacakge", "For", "Func", "Go", "Interface", "Map", "Return", "Select", "Struct", "Switch"} { + kwposval := nval.FieldByName(kwname) + if kwposval != (reflect.Value{}) { + kwpos, ok := kwposval.Interface().(token.Pos) + if ok { + emit(token.ILLEGAL, kwpos, token.NoPos) + } + } + } + + return true + }) + + sort.Slice(toks, func(i, j int) bool { return toks[i].start < toks[j].start }) + + flush := func(start, end int, style Style) { + if start < end { + w.Write(style, buf[start:end], end == len(buf)) + } + } + + cur := 0 + for _, tok := range toks { + flush(cur, tok.start, NormalStyle) + flush(tok.start, tok.end, tokenToStyle[tok.tok]) + cur = tok.end + } + if cur != len(buf) { + flush(cur, len(buf), NormalStyle) + } + + return nil +} + +var tokenToStyle = map[token.Token]Style{ + token.ILLEGAL: KeywordStyle, + token.COMMENT: CommentStyle, + token.INT: NumberStyle, + token.FLOAT: NumberStyle, + token.IMAG: NumberStyle, + token.CHAR: StringStyle, + token.STRING: StringStyle, + token.BREAK: KeywordStyle, + token.CASE: KeywordStyle, + token.CHAN: KeywordStyle, + token.CONST: KeywordStyle, + token.CONTINUE: KeywordStyle, + token.DEFAULT: KeywordStyle, + token.DEFER: KeywordStyle, + token.ELSE: KeywordStyle, + token.FALLTHROUGH: KeywordStyle, + token.FOR: KeywordStyle, + token.FUNC: KeywordStyle, + token.GO: KeywordStyle, + token.GOTO: KeywordStyle, + token.IF: KeywordStyle, + token.IMPORT: KeywordStyle, + token.INTERFACE: KeywordStyle, + token.MAP: KeywordStyle, + token.PACKAGE: KeywordStyle, + token.RANGE: KeywordStyle, + token.RETURN: KeywordStyle, + token.SELECT: KeywordStyle, + token.STRUCT: KeywordStyle, + token.SWITCH: KeywordStyle, + token.TYPE: KeywordStyle, + token.VAR: KeywordStyle, +} + +type colorTok struct { + tok token.Token // the token type or ILLEGAL for keywords + start, end int // start and end positions of the token +} + +type lineWriter struct { + w io.Writer + lineRange [2]int + arrowLine int + + curStyle Style + started bool + lineno int + + colorEscapes map[Style]string +} + +func (w *lineWriter) style(style Style) { + if w.colorEscapes == nil { + return + } + esc := w.colorEscapes[style] + if esc == "" { + esc = w.colorEscapes[NormalStyle] + } + fmt.Fprintf(w.w, "%s", esc) +} + +func (w *lineWriter) inrange() bool { + lno := w.lineno + if !w.started { + lno = w.lineno + 1 + } + return lno >= w.lineRange[0] && lno < w.lineRange[1] +} + +func (w *lineWriter) nl() { + w.lineno++ + if !w.inrange() || !w.started { + return + } + w.style(ArrowStyle) + if w.lineno == w.arrowLine { + fmt.Fprintf(w.w, "=>") + } else { + fmt.Fprintf(w.w, " ") + } + w.style(LineNoStyle) + fmt.Fprintf(w.w, "%4d:\t", w.lineno) + w.style(w.curStyle) +} + +func (w *lineWriter) writeInternal(style Style, data []byte) { + if !w.inrange() { + return + } + + if !w.started { + w.started = true + w.curStyle = style + w.nl() + } else if w.curStyle != style { + w.curStyle = style + w.style(w.curStyle) + } + + w.w.Write(data) +} + +func (w *lineWriter) Write(style Style, data []byte, last bool) { + cur := 0 + for i := range data { + if data[i] == '\n' { + if last && i == len(data)-1 { + w.writeInternal(style, data[cur:i]) + if w.curStyle != NormalStyle { + w.style(NormalStyle) + } + if w.inrange() { + w.w.Write([]byte{'\n'}) + } + last = false + } else { + w.writeInternal(style, data[cur:i+1]) + w.nl() + } + cur = i + 1 + } + } + if cur < len(data) { + w.writeInternal(style, data[cur:]) + } + if last { + if w.curStyle != NormalStyle { + w.style(NormalStyle) + } + if w.inrange() { + w.w.Write([]byte{'\n'}) + } + } +} diff --git a/pkg/terminal/command.go b/pkg/terminal/command.go index 3dcb9c546a..29f0ce7429 100644 --- a/pkg/terminal/command.go +++ b/pkg/terminal/command.go @@ -2,6 +2,8 @@ // input and dispatching to appropriate backend commands. package terminal +//lint:file-ignore ST1005 errors here can be capitalized + import ( "bufio" "bytes" @@ -10,6 +12,7 @@ import ( "go/parser" "go/scanner" "io" + "io/ioutil" "math" "os" "os/exec" @@ -20,9 +23,12 @@ import ( "strconv" "strings" "text/tabwriter" + "time" "github.com/cosiner/argv" + "github.com/go-delve/delve/pkg/config" "github.com/go-delve/delve/pkg/locspec" + "github.com/go-delve/delve/pkg/terminal/colorize" "github.com/go-delve/delve/service" "github.com/go-delve/delve/service/api" "github.com/go-delve/delve/service/rpc2" @@ -116,23 +122,40 @@ func DebugCommands(client service.Client) *Commands { Type "help" followed by the name of a command for more information about it.`}, {aliases: []string{"break", "b"}, group: breakCmds, cmdFn: breakpoint, helpMsg: `Sets a breakpoint. - break [name] + break [name] [linespec] -See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/locspec.md for the syntax of linespec. +See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/locspec.md for the syntax of linespec. If linespec is omitted a breakpoint will be set on the current line. See also: "help on", "help cond" and "help clear"`}, - {aliases: []string{"trace", "t"}, group: breakCmds, cmdFn: tracepoint, helpMsg: `Set tracepoint. + {aliases: []string{"trace", "t"}, group: breakCmds, cmdFn: tracepoint, allowedPrefixes: onPrefix, helpMsg: `Set tracepoint. - trace [name] + trace [name] [linespec] -A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/locspec.md for the syntax of linespec. +A tracepoint is a breakpoint that does not stop the execution of the program, instead when the tracepoint is hit a notification is displayed. See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/locspec.md for the syntax of linespec. If linespec is omitted a tracepoint will be set on the current line. See also: "help on", "help cond" and "help clear"`}, + {aliases: []string{"watch"}, group: breakCmds, cmdFn: watchpoint, helpMsg: `Set watchpoint. + + watch [-r|-w|-rw] + + -r stops when the memory location is read + -w stops when the memory location is written + -rw stops when the memory location is read or written + +The memory location is specified with the same expression language used by 'print', for example: + + watch v + +will watch the address of variable 'v'. + +Note that writes that do not change the value of the watched memory address might not be reported. + +See also: "help print".`}, {aliases: []string{"restart", "r"}, group: runCmds, cmdFn: restart, helpMsg: `Restart process. For recorded targets the command takes the following forms: - restart resets ot the start of the recording + restart resets to the start of the recording restart [checkpoint] resets the recording to the given checkpoint restart -r [newargv...] [redirects...] re-records the target process @@ -150,12 +173,22 @@ A list of file redirections can be specified after the new argument list to over 2>error.txt redirects the standard error of the target process to error.txt `}, {aliases: []string{"rebuild"}, group: runCmds, cmdFn: c.rebuild, allowedPrefixes: revPrefix, helpMsg: "Rebuild the target executable and restarts it. It does not work if the executable was not built by delve."}, - {aliases: []string{"continue", "c"}, group: runCmds, cmdFn: c.cont, allowedPrefixes: revPrefix, helpMsg: "Run until breakpoint or program termination."}, + {aliases: []string{"continue", "c"}, group: runCmds, cmdFn: c.cont, allowedPrefixes: revPrefix, helpMsg: `Run until breakpoint or program termination. + + continue [] + +Optional linespec argument allows you to continue until a specific location is reached. The program will halt if a breakpoint is hit before reaching the specified location. + +For example: + + continue main.main + continue encoding/json.Marshal +`}, {aliases: []string{"step", "s"}, group: runCmds, cmdFn: c.step, allowedPrefixes: revPrefix, helpMsg: "Single step through program."}, {aliases: []string{"step-instruction", "si"}, group: runCmds, allowedPrefixes: revPrefix, cmdFn: c.stepInstruction, helpMsg: "Single step a single cpu instruction."}, {aliases: []string{"next", "n"}, group: runCmds, cmdFn: c.next, allowedPrefixes: revPrefix, helpMsg: `Step over to next source line. - next [count] + next [count] Optional [count] argument allows you to skip multiple lines. `}, @@ -188,20 +221,67 @@ Current limitations: clearall [] If called with the linespec argument it will delete all the breakpoints matching the linespec. If linespec is omitted all breakpoints are deleted.`}, + {aliases: []string{"toggle"}, group: breakCmds, cmdFn: toggle, helpMsg: `Toggles on or off a breakpoint. + +toggle `}, {aliases: []string{"goroutines", "grs"}, group: goroutineCmds, cmdFn: goroutines, helpMsg: `List program goroutines. - goroutines [-u (default: user location)|-r (runtime location)|-g (go statement location)|-s (start location)] [-t (stack trace)] [-l (labels)] + goroutines [-u|-r|-g|-s] [-t [depth]] [-l] [-with loc expr] [-without loc expr] [-group argument] Print out info for every goroutine. The flag controls what information is shown along with each goroutine: - -u displays location of topmost stackframe in user code + -u displays location of topmost stackframe in user code (default) -r displays location of topmost stackframe (including frames inside private runtime functions) -g displays location of go instruction that created the goroutine -s displays location of the start function - -t displays goroutine's stacktrace + -t displays goroutine's stacktrace (an optional depth value can be specified, default: 10) -l displays goroutine's labels -If no flag is specified the default is -u.`}, +If no flag is specified the default is -u, i.e. the first frame within the first 30 frames that is not executing a runtime private function. + +FILTERING + +If -with or -without are specified only goroutines that match the given condition are returned. + +To only display goroutines where the specified location contains (or does not contain, for -without and -wo) expr as a substring, use: + + goroutines -with (userloc|curloc|goloc|startloc) expr + goroutines -w (userloc|curloc|goloc|startloc) expr + goroutines -without (userloc|curloc|goloc|startloc) expr + goroutines -wo (userloc|curloc|goloc|startloc) expr + +To only display goroutines that have (or do not have) the specified label key and value, use: + + + goroutines -with label key=value + goroutines -without label key=value + +To only display goroutines that have (or do not have) the specified label key, use: + + goroutines -with label key + goroutines -without label key + +To only display goroutines that are running (or are not running) on a OS thread, use: + + + goroutines -with running + goroutines -without running + +To only display user (or runtime) goroutines, use: + + goroutines -with user + goroutines -without user + +GROUPING + + goroutines -group (userloc|curloc|goloc|startloc|running|user) + +Groups goroutines by the given location, running status or user classification, up to 5 goroutines per group will be displayed as well as the total number of goroutines in the group. + + goroutines -group label key + +Groups goroutines by the value of the label with the specified key. +`}, {aliases: []string{"goroutine", "gr"}, group: goroutineCmds, allowedPrefixes: onPrefix, cmdFn: c.goroutine, helpMsg: `Shows or changes current goroutine goroutine @@ -211,12 +291,18 @@ If no flag is specified the default is -u.`}, Called without arguments it will show information about the current goroutine. Called with a single argument it will switch to the specified goroutine. Called with more arguments it will execute a command on the specified goroutine.`}, - {aliases: []string{"breakpoints", "bp"}, group: breakCmds, cmdFn: breakpoints, helpMsg: "Print out info for active breakpoints."}, + {aliases: []string{"breakpoints", "bp"}, group: breakCmds, cmdFn: breakpoints, helpMsg: `Print out info for active breakpoints. + + breakpoints [-a] + +Specifying -a prints all physical breakpoint, including internal breakpoints.`}, {aliases: []string{"print", "p"}, group: dataCmds, allowedPrefixes: onPrefix | deferredPrefix, cmdFn: printVar, helpMsg: `Evaluate an expression. - [goroutine ] [frame ] print + [goroutine ] [frame ] print [%format] + +See Documentation/cli/expr.md for a description of supported expressions. -See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/expr.md for a description of supported expressions.`}, +The optional format argument is a format specifier, like the ones used by the fmt package. For example "print %x v" will print v as an hexadecimal number.`}, {aliases: []string{"whatis"}, group: dataCmds, cmdFn: whatisCommand, helpMsg: `Prints type of an expression. whatis `}, @@ -224,7 +310,7 @@ See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/expr.md for a descri [goroutine ] [frame ] set = -See $GOPATH/src/github.com/go-delve/delve/Documentation/cli/expr.md for a description of supported expressions. Only numerical variables and pointers can be changed.`}, +See Documentation/cli/expr.md for a description of supported expressions. Only numerical variables and pointers can be changed.`}, {aliases: []string{"sources"}, cmdFn: sources, helpMsg: `Print list of source files. sources [] @@ -261,7 +347,7 @@ If regex is specified only package variables with a name matching it will be ret regs [-a] -Argument -a shows more registers.`}, +Argument -a shows more registers. Individual registers can also be displayed by 'print' and 'display'. See Documentation/cli/expr.md.`}, {aliases: []string{"exit", "quit", "q"}, cmdFn: exitCommand, helpMsg: `Exit the debugger. exit [-c] @@ -349,14 +435,43 @@ If no argument is specified the function being executed in the selected stack fr -l disassembles the specified function`}, {aliases: []string{"on"}, group: breakCmds, cmdFn: c.onCmd, helpMsg: `Executes a command when a breakpoint is hit. - on . + on + on -edit + -Supported commands: print, stack and goroutine)`}, - {aliases: []string{"condition", "cond"}, group: breakCmds, cmdFn: conditionCmd, helpMsg: `Set breakpoint condition. +Supported commands: print, stack, goroutine, trace and cond. +To convert a breakpoint into a tracepoint use: + + on trace + +The command 'on cond ' is equivalent to 'cond '. + +The command 'on x -edit' can be used to edit the list of commands executed when the breakpoint is hit.`}, + {aliases: []string{"condition", "cond"}, group: breakCmds, cmdFn: conditionCmd, allowedPrefixes: onPrefix, helpMsg: `Set breakpoint condition. condition . + condition -hitcount + +Specifies that the breakpoint, tracepoint or watchpoint should break only if the boolean expression is true. + +See Documentation/cli/expr.md for a description of supported expressions. -Specifies that the breakpoint or tracepoint should break only if the boolean expression is true.`}, +With the -hitcount option a condition on the breakpoint hit count can be set, the following operators are supported + + condition -hitcount bp > n + condition -hitcount bp >= n + condition -hitcount bp < n + condition -hitcount bp <= n + condition -hitcount bp == n + condition -hitcount bp != n + condition -hitcount bp % n + +The '% n' form means we should stop at the breakpoint when the hitcount is a multiple of n. + +Examples: + cond 2 i == 10 breakpoint 2 will stop when variable i equals 10 + cond name runtime.curg.goid == 5 breakpoint 'name' will stop only on goroutine 5 +`}, {aliases: []string{"config"}, cmdFn: configureCmd, helpMsg: `Changes configuration parameters. config -list @@ -388,26 +503,39 @@ Defines as an alias to or removes an alias.`}, If locspec is omitted edit will open the current source file in the editor, otherwise it will open the specified location.`}, {aliases: []string{"libraries"}, cmdFn: libraries, helpMsg: `List loaded dynamic libraries`}, - {aliases: []string{"examinemem", "x"}, group: dataCmds, cmdFn: examineMemoryCmd, helpMsg: `Examine memory: + {aliases: []string{"examinemem", "x"}, group: dataCmds, cmdFn: examineMemoryCmd, helpMsg: `Examine raw memory at the given address. + +Examine memory: - examinemem [-fmt ] [-len ]

+ examinemem [-fmt ] [-count|-len ] [-size ]
+ examinemem [-fmt ] [-count|-len ] [-size ] -x -Format represents the data format and the value is one of this list (default hex): bin(binary), oct(octal), dec(decimal), hex(hexadecimal),. +Format represents the data format and the value is one of this list (default hex): bin(binary), oct(octal), dec(decimal), hex(hexadecimal), addr(address). Length is the number of bytes (default 1) and must be less than or equal to 1000. -Address is the memory location of the target to examine. +Address is the memory location of the target to examine. Please note '-len' is deprecated by '-count and -size'. +Expression can be an integer expression or pointer value of the memory location to examine. For example: - x -fmt hex -len 20 0xc00008af38`}, + x -fmt hex -count 20 -size 1 0xc00008af38 + x -fmt hex -count 20 -size 1 -x 0xc00008af38 + 8 + x -fmt hex -count 20 -size 1 -x &myVar + x -fmt hex -count 20 -size 1 -x myPtrVar`}, {aliases: []string{"display"}, group: dataCmds, cmdFn: display, helpMsg: `Print value of an expression every time the program stops. - display -a + display -a [%format] display -d The '-a' option adds an expression to the list of expression printed every time the program stops. The '-d' option removes the specified expression from the list. If display is called without arguments it will print the value of all expression in the list.`}, + + {aliases: []string{"dump"}, cmdFn: dump, helpMsg: `Creates a core dump from the current process state + + dump + +The core dump is always written in ELF, even on systems (windows, macOS) where this is not customary. For environments other than linux/amd64 threads and registers are dumped in a format that only Delve can read back.`}, } addrecorded := client == nil @@ -478,10 +606,10 @@ func (c *Commands) Register(cmdstr string, cf cmdfunc, helpMsg string) { // Find will look up the command function for the given command input. // If it cannot find the command it will default to noCmdAvailable(). // If the command is an empty string it will replay the last command. -func (c *Commands) Find(cmdstr string, prefix cmdPrefix) cmdfunc { +func (c *Commands) Find(cmdstr string, prefix cmdPrefix) command { // If use last command, if there was one. if cmdstr == "" { - return nullCommand + return command{aliases: []string{"nullcmd"}, cmdFn: nullCommand} } for _, v := range c.cmds { @@ -489,11 +617,11 @@ func (c *Commands) Find(cmdstr string, prefix cmdPrefix) cmdfunc { if prefix != noPrefix && v.allowedPrefixes&prefix == 0 { continue } - return v.cmdFn + return v } } - return noCmdAvailable + return command{aliases: []string{"nocmd"}, cmdFn: noCmdAvailable} } // CallWithContext takes a command and a context that command should be executed in. @@ -504,7 +632,7 @@ func (c *Commands) CallWithContext(cmdstr string, t *Term, ctx callContext) erro if len(vals) > 1 { args = strings.TrimSpace(vals[1]) } - return c.Find(cmdname, ctx.Prefix)(t, ctx, args) + return c.Find(cmdname, ctx.Prefix).cmdFn(t, ctx, args) } // Call takes a command to execute. @@ -531,10 +659,10 @@ func (c *Commands) Merge(allAliases map[string][]string) { } } -var noCmdError = errors.New("command not available") +var errNoCmd = errors.New("command not available") func noCmdAvailable(t *Term, ctx callContext, args string) error { - return noCmdError + return errNoCmd } func nullCommand(t *Term, ctx callContext, args string) error { @@ -551,7 +679,7 @@ func (c *Commands) help(t *Term, ctx callContext, args string) error { } } } - return noCmdError + return errNoCmd } fmt.Println("The following commands are available:") @@ -607,10 +735,10 @@ func threads(t *Term, ctx callContext, args string) error { } if th.Function != nil { fmt.Printf("%sThread %d at %#v %s:%d %s\n", - prefix, th.ID, th.PC, shortenFilePath(th.File), + prefix, th.ID, th.PC, t.formatPath(th.File), th.Line, th.Function.Name()) } else { - fmt.Printf("%sThread %s\n", prefix, formatThread(th)) + fmt.Printf("%sThread %s\n", prefix, t.formatThread(th)) } } return nil @@ -651,91 +779,81 @@ func (a byGoroutineID) Len() int { return len(a) } func (a byGoroutineID) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a byGoroutineID) Less(i, j int) bool { return a[i].ID < a[j].ID } -// The number of goroutines we're going to request on each RPC call -const goroutineBatchSize = 10000 - -type printGoroutinesFlags uint8 - -const ( - printGoroutinesStack printGoroutinesFlags = 1 << iota - printGoroutinesLabels -) - -func printGoroutines(t *Term, gs []*api.Goroutine, fgl formatGoroutineLoc, flags printGoroutinesFlags, state *api.DebuggerState) error { +func printGoroutines(t *Term, indent string, gs []*api.Goroutine, fgl api.FormatGoroutineLoc, flags api.PrintGoroutinesFlags, depth int, state *api.DebuggerState) error { for _, g := range gs { - prefix := " " + prefix := indent + " " if state.SelectedGoroutine != nil && g.ID == state.SelectedGoroutine.ID { - prefix = "* " + prefix = indent + "* " } - fmt.Printf("%sGoroutine %s\n", prefix, formatGoroutine(g, fgl)) - if flags&printGoroutinesLabels != 0 { - writeGoroutineLabels(os.Stdout, g, "\t") + fmt.Printf("%sGoroutine %s\n", prefix, t.formatGoroutine(g, fgl)) + if flags&api.PrintGoroutinesLabels != 0 { + writeGoroutineLabels(os.Stdout, g, indent+"\t") } - if flags&printGoroutinesStack != 0 { - stack, err := t.client.Stacktrace(g.ID, 10, 0, nil) + if flags&api.PrintGoroutinesStack != 0 { + stack, err := t.client.Stacktrace(g.ID, depth, 0, nil) if err != nil { return err } - printStack(os.Stdout, stack, "\t", false) + printStack(t, os.Stdout, stack, indent+"\t", false) } } return nil } func goroutines(t *Term, ctx callContext, argstr string) error { - args := strings.Split(argstr, " ") - var fgl = fglUserCurrent - var flags printGoroutinesFlags - - switch len(args) { - case 0: - // nothing to do - case 1, 2: - for _, arg := range args { - switch arg { - case "-u": - fgl = fglUserCurrent - case "-r": - fgl = fglRuntimeCurrent - case "-g": - fgl = fglGo - case "-s": - fgl = fglStart - case "-t": - flags |= printGoroutinesStack - case "-l": - flags |= printGoroutinesLabels - case "": - // nothing to do - default: - return fmt.Errorf("wrong argument: '%s'", arg) - } - } - default: - return fmt.Errorf("too many arguments") + filters, group, fgl, flags, depth, batchSize, err := api.ParseGoroutineArgs(argstr) + if err != nil { + return err } + state, err := t.client.GetState() if err != nil { return err } var ( - start = 0 - gslen = 0 - gs []*api.Goroutine + start = 0 + gslen = 0 + gs []*api.Goroutine + groups []api.GoroutineGroup + tooManyGroups bool ) + t.longCommandStart() for start >= 0 { - gs, start, err = t.client.ListGoroutines(start, goroutineBatchSize) - if err != nil { - return err + if t.longCommandCanceled() { + fmt.Printf("interrupted\n") + return nil } - sort.Sort(byGoroutineID(gs)) - err = printGoroutines(t, gs, fgl, flags, state) + gs, groups, start, tooManyGroups, err = t.client.ListGoroutinesWithFilter(start, batchSize, filters, &group) if err != nil { return err } - gslen += len(gs) + if len(groups) > 0 { + for i := range groups { + fmt.Printf("%s\n", groups[i].Name) + err = printGoroutines(t, "\t", gs[groups[i].Offset:][:groups[i].Count], fgl, flags, depth, state) + if err != nil { + return err + } + fmt.Printf("\tTotal: %d\n", groups[i].Total) + if i != len(groups)-1 { + fmt.Printf("\n") + } + } + if tooManyGroups { + fmt.Printf("Too many groups\n") + } + } else { + sort.Sort(byGoroutineID(gs)) + err = printGoroutines(t, "", gs, fgl, flags, depth, state) + if err != nil { + return err + } + gslen += len(gs) + } + } + if gslen > 0 { + fmt.Printf("[%d goroutines]\n", gslen) } - fmt.Printf("[%d goroutines]\n", gslen) return nil } @@ -746,16 +864,8 @@ func selectedGID(state *api.DebuggerState) int { return state.SelectedGoroutine.ID } -func split2PartsBySpace(s string) []string { - v := strings.SplitN(s, " ", 2) - for i, _ := range v { - v[i] = strings.TrimSpace(v[i]) - } - return v -} - func (c *Commands) goroutine(t *Term, ctx callContext, argstr string) error { - args := split2PartsBySpace(argstr) + args := config.Split2PartsBySpace(argstr) if ctx.Prefix == onPrefix { if len(args) != 1 || args[0] != "" { @@ -804,7 +914,7 @@ func (c *Commands) frameCommand(t *Term, ctx callContext, argstr string, directi return errors.New("not enough arguments") } } else { - args := split2PartsBySpace(argstr) + args := config.Split2PartsBySpace(argstr) var err error if frame, err = strconv.Atoi(args[0]); err != nil { return err @@ -840,7 +950,7 @@ func (c *Commands) frameCommand(t *Term, ctx callContext, argstr string, directi } printcontext(t, state) th := stack[frame] - fmt.Printf("Frame %d: %s:%d (PC: %x)\n", frame, shortenFilePath(th.File), th.Line, th.PC) + fmt.Printf("Frame %d: %s:%d (PC: %x)\n", frame, t.formatPath(th.File), th.Line, th.PC) printfile(t, th.File, th.Line, true) return nil } @@ -848,7 +958,10 @@ func (c *Commands) frameCommand(t *Term, ctx callContext, argstr string, directi func (c *Commands) deferredCommand(t *Term, ctx callContext, argstr string) error { ctx.Prefix = deferredPrefix - space := strings.Index(argstr, " ") + space := strings.IndexRune(argstr, ' ') + if space < 0 { + return errors.New("not enough arguments") + } var err error ctx.Scope.DeferredCall, err = strconv.Atoi(argstr[:space]) @@ -867,34 +980,25 @@ func printscope(t *Term) error { return err } - fmt.Printf("Thread %s\n", formatThread(state.CurrentThread)) + fmt.Printf("Thread %s\n", t.formatThread(state.CurrentThread)) if state.SelectedGoroutine != nil { - writeGoroutineLong(os.Stdout, state.SelectedGoroutine, "") + writeGoroutineLong(t, os.Stdout, state.SelectedGoroutine, "") } return nil } -func formatThread(th *api.Thread) string { +func (t *Term) formatThread(th *api.Thread) string { if th == nil { return "" } - return fmt.Sprintf("%d at %s:%d", th.ID, shortenFilePath(th.File), th.Line) + return fmt.Sprintf("%d at %s:%d", th.ID, t.formatPath(th.File), th.Line) } -type formatGoroutineLoc int - -const ( - fglRuntimeCurrent = formatGoroutineLoc(iota) - fglUserCurrent - fglGo - fglStart -) - -func formatLocation(loc api.Location) string { - return fmt.Sprintf("%s:%d %s (%#v)", shortenFilePath(loc.File), loc.Line, loc.Function.Name(), loc.PC) +func (t *Term) formatLocation(loc api.Location) string { + return fmt.Sprintf("%s:%d %s (%#v)", t.formatPath(loc.File), loc.Line, loc.Function.Name(), loc.PC) } -func formatGoroutine(g *api.Goroutine, fgl formatGoroutineLoc) string { +func (t *Term) formatGoroutine(g *api.Goroutine, fgl api.FormatGoroutineLoc) string { if g == nil { return "" } @@ -904,33 +1008,80 @@ func formatGoroutine(g *api.Goroutine, fgl formatGoroutineLoc) string { var locname string var loc api.Location switch fgl { - case fglRuntimeCurrent: + case api.FglRuntimeCurrent: locname = "Runtime" loc = g.CurrentLoc - case fglUserCurrent: + case api.FglUserCurrent: locname = "User" loc = g.UserCurrentLoc - case fglGo: + case api.FglGo: locname = "Go" loc = g.GoStatementLoc - case fglStart: + case api.FglStart: locname = "Start" loc = g.StartLoc } - thread := "" + + buf := new(strings.Builder) + fmt.Fprintf(buf, "%d - %s: %s", g.ID, locname, t.formatLocation(loc)) if g.ThreadID != 0 { - thread = fmt.Sprintf(" (thread %d)", g.ThreadID) + fmt.Fprintf(buf, " (thread %d)", g.ThreadID) } - return fmt.Sprintf("%d - %s: %s%s", g.ID, locname, formatLocation(loc), thread) -} -func writeGoroutineLong(w io.Writer, g *api.Goroutine, prefix string) { + if (g.Status == api.GoroutineWaiting || g.Status == api.GoroutineSyscall) && g.WaitReason != 0 { + var wr string + if g.WaitReason > 0 && g.WaitReason < int64(len(waitReasonStrings)) { + wr = waitReasonStrings[g.WaitReason] + } else { + wr = fmt.Sprintf("unknown wait reason %d", g.WaitReason) + } + fmt.Fprintf(buf, " [%s", wr) + if g.WaitSince > 0 { + fmt.Fprintf(buf, " %s", time.Since(time.Unix(0, g.WaitSince)).String()) + } + fmt.Fprintf(buf, "]") + } + + return buf.String() +} + +var waitReasonStrings = [...]string{ + "", + "GC assist marking", + "IO wait", + "chan receive (nil chan)", + "chan send (nil chan)", + "dumping heap", + "garbage collection", + "garbage collection scan", + "panicwait", + "select", + "select (no cases)", + "GC assist wait", + "GC sweep wait", + "GC scavenge wait", + "chan receive", + "chan send", + "finalizer wait", + "force gc (idle)", + "semacquire", + "sleep", + "sync.Cond.Wait", + "timer goroutine (idle)", + "trace reader (blocked)", + "wait for GC cycle", + "GC worker (idle)", + "preempted", + "debug call", +} + +func writeGoroutineLong(t *Term, w io.Writer, g *api.Goroutine, prefix string) { fmt.Fprintf(w, "%sGoroutine %d:\n%s\tRuntime: %s\n%s\tUser: %s\n%s\tGo: %s\n%s\tStart: %s\n", prefix, g.ID, - prefix, formatLocation(g.CurrentLoc), - prefix, formatLocation(g.UserCurrentLoc), - prefix, formatLocation(g.GoStatementLoc), - prefix, formatLocation(g.StartLoc)) + prefix, t.formatLocation(g.CurrentLoc), + prefix, t.formatLocation(g.UserCurrentLoc), + prefix, t.formatLocation(g.GoStatementLoc), + prefix, t.formatLocation(g.StartLoc)) writeGoroutineLabels(w, g, prefix+"\t") } @@ -972,7 +1123,7 @@ func restart(t *Term, ctx callContext, args string) error { } func restartRecorded(t *Term, ctx callContext, args string) error { - v := split2PartsBySpace(args) + v := config.Split2PartsBySpace(args) rerecord := false resetArgs := false @@ -1041,7 +1192,7 @@ func restartIntl(t *Term, rerecord bool, restartPos string, resetArgs bool, newA return err } for i := range discarded { - fmt.Printf("Discarded %s at %s: %v\n", formatBreakpointName(discarded[i].Breakpoint, false), formatBreakpointLocation(discarded[i].Breakpoint), discarded[i].Reason) + fmt.Printf("Discarded %s at %s: %v\n", formatBreakpointName(discarded[i].Breakpoint, false), t.formatBreakpointLocation(discarded[i].Breakpoint), discarded[i].Reason) } return nil } @@ -1131,6 +1282,21 @@ func (c *Commands) rebuild(t *Term, ctx callContext, args string) error { } func (c *Commands) cont(t *Term, ctx callContext, args string) error { + if args != "" { + tmp, err := setBreakpoint(t, ctx, false, args) + if err != nil { + if !strings.Contains(err.Error(), "Breakpoint exists") { + return err + } + } + defer func() { + for _, bp := range tmp { + if _, err := t.client.ClearBreakpoint(bp.ID); err != nil { + fmt.Printf("failed to clear temporary breakpoint: %d", bp.ID) + } + } + }() + } if ctx.Prefix == revPrefix { return c.rewind(t, ctx, args) } @@ -1157,8 +1323,28 @@ func continueUntilCompleteNext(t *Term, state *api.DebuggerState, op string, sho } return nil } + skipBreakpoints := false for { - fmt.Printf("\tbreakpoint hit during %s, continuing...\n", op) + fmt.Printf("\tbreakpoint hit during %s", op) + if !skipBreakpoints { + fmt.Printf("\n") + answer, err := promptAutoContinue(t, op) + switch answer { + case "f": // finish next + skipBreakpoints = true + fallthrough + case "c": // continue once + fmt.Printf("continuing...\n") + case "s": // stop and cancel + fallthrough + default: + t.client.CancelNext() + printfile(t, state.CurrentThread.File, state.CurrentThread.Line, true) + return err + } + } else { + fmt.Printf(", continuing...\n") + } stateChan := t.client.DirectionCongruentContinue() var state *api.DebuggerState for state = range stateChan { @@ -1175,6 +1361,20 @@ func continueUntilCompleteNext(t *Term, state *api.DebuggerState, op string, sho } } +func promptAutoContinue(t *Term, op string) (string, error) { + for { + answer, err := t.line.Prompt(fmt.Sprintf("[c] continue [s] stop here and cancel %s, [f] finish %s skipping all breakpoints? ", op, op)) + if err != nil { + return "", err + } + answer = strings.ToLower(strings.TrimSpace(answer)) + switch answer { + case "f", "c", "s": + return answer, nil + } + } +} + func scopePrefixSwitch(t *Term, ctx callContext) error { if ctx.Scope.GoroutineID > 0 { _, err := t.client.SwitchGoroutine(ctx.Scope.GoroutineID) @@ -1187,7 +1387,7 @@ func scopePrefixSwitch(t *Term, ctx callContext) error { func exitedToError(state *api.DebuggerState, err error) (*api.DebuggerState, error) { if err == nil && state.Exited { - return nil, fmt.Errorf("Process has exited with status %d", state.ExitStatus) + return nil, fmt.Errorf("Process %d has exited with status %d", state.Pid, state.ExitStatus) } return state, err } @@ -1210,14 +1410,14 @@ func (c *Commands) step(t *Term, ctx callContext, args string) error { return continueUntilCompleteNext(t, state, "step", true) } -var notOnFrameZeroErr = errors.New("not on topmost frame") +var errNotOnFrameZero = errors.New("not on topmost frame") func (c *Commands) stepInstruction(t *Term, ctx callContext, args string) error { if err := scopePrefixSwitch(t, ctx); err != nil { return err } if c.frame != 0 { - return notOnFrameZeroErr + return errNotOnFrameZero } defer t.onStop() @@ -1253,7 +1453,7 @@ func (c *Commands) next(t *Term, ctx callContext, args string) error { return err } if c.frame != 0 { - return notOnFrameZeroErr + return errNotOnFrameZero } nextfn := t.client.Next @@ -1291,7 +1491,7 @@ func (c *Commands) stepout(t *Term, ctx callContext, args string) error { return err } if c.frame != 0 { - return notOnFrameZeroErr + return errNotOnFrameZero } stepoutfn := t.client.StepOut @@ -1342,19 +1542,19 @@ func clear(t *Term, ctx callContext, args string) error { if err != nil { return err } - fmt.Printf("%s cleared at %s\n", formatBreakpointName(bp, true), formatBreakpointLocation(bp)) + fmt.Printf("%s cleared at %s\n", formatBreakpointName(bp, true), t.formatBreakpointLocation(bp)) return nil } func clearAll(t *Term, ctx callContext, args string) error { - breakPoints, err := t.client.ListBreakpoints() + breakPoints, err := t.client.ListBreakpoints(false) if err != nil { return err } var locPCs map[uint64]struct{} if args != "" { - locs, err := t.client.FindLocation(api.EvalScope{GoroutineID: -1, Frame: 0}, args, true) + locs, err := t.client.FindLocation(api.EvalScope{GoroutineID: -1, Frame: 0}, args, true, t.substitutePathRules()) if err != nil { return err } @@ -1380,10 +1580,28 @@ func clearAll(t *Term, ctx callContext, args string) error { _, err := t.client.ClearBreakpoint(bp.ID) if err != nil { - fmt.Printf("Couldn't delete %s at %s: %s\n", formatBreakpointName(bp, false), formatBreakpointLocation(bp), err) + fmt.Printf("Couldn't delete %s at %s: %s\n", formatBreakpointName(bp, false), t.formatBreakpointLocation(bp), err) } - fmt.Printf("%s cleared at %s\n", formatBreakpointName(bp, true), formatBreakpointLocation(bp)) + fmt.Printf("%s cleared at %s\n", formatBreakpointName(bp, true), t.formatBreakpointLocation(bp)) + } + return nil +} + +func toggle(t *Term, ctx callContext, args string) error { + if args == "" { + return fmt.Errorf("not enough arguments") + } + id, err := strconv.Atoi(args) + var bp *api.Breakpoint + if err == nil { + bp, err = t.client.ToggleBreakpoint(id) + } else { + bp, err = t.client.ToggleBreakpointByName(args) } + if err != nil { + return err + } + fmt.Printf("%s toggled at %s\n", formatBreakpointName(bp, true), t.formatBreakpointLocation(bp)) return nil } @@ -1395,41 +1613,20 @@ func (a byID) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a byID) Less(i, j int) bool { return a[i].ID < a[j].ID } func breakpoints(t *Term, ctx callContext, args string) error { - breakPoints, err := t.client.ListBreakpoints() + breakPoints, err := t.client.ListBreakpoints(args == "-a") if err != nil { return err } sort.Sort(byID(breakPoints)) for _, bp := range breakPoints { - fmt.Printf("%s at %v (%d)\n", formatBreakpointName(bp, true), formatBreakpointLocation(bp), bp.TotalHitCount) - - var attrs []string - if bp.Cond != "" { - attrs = append(attrs, fmt.Sprintf("\tcond %s", bp.Cond)) - } - if bp.Stacktrace > 0 { - attrs = append(attrs, fmt.Sprintf("\tstack %d", bp.Stacktrace)) - } - if bp.Goroutine { - attrs = append(attrs, "\tgoroutine") - } - if bp.LoadArgs != nil { - if *(bp.LoadArgs) == longLoadConfig { - attrs = append(attrs, "\targs -v") - } else { - attrs = append(attrs, "\targs") - } - } - if bp.LoadLocals != nil { - if *(bp.LoadLocals) == longLoadConfig { - attrs = append(attrs, "\tlocals -v") - } else { - attrs = append(attrs, "\tlocals") - } - } - for i := range bp.Variables { - attrs = append(attrs, fmt.Sprintf("\tprint %s", bp.Variables[i])) + enabled := "(enabled)" + if bp.Disabled { + enabled = "(disabled)" } + fmt.Printf("%s %s at %v (%d)\n", formatBreakpointName(bp, true), enabled, t.formatBreakpointLocation(bp), bp.TotalHitCount) + + attrs := formatBreakpointAttrs("\t", bp, false) + if len(attrs) > 0 { fmt.Printf("%s\n", strings.Join(attrs, "\n")) } @@ -1437,14 +1634,59 @@ func breakpoints(t *Term, ctx callContext, args string) error { return nil } -func setBreakpoint(t *Term, ctx callContext, tracepoint bool, argstr string) error { - args := split2PartsBySpace(argstr) +func formatBreakpointAttrs(prefix string, bp *api.Breakpoint, includeTrace bool) []string { + var attrs []string + if bp.Cond != "" { + attrs = append(attrs, fmt.Sprintf("%scond %s", prefix, bp.Cond)) + } + if bp.HitCond != "" { + attrs = append(attrs, fmt.Sprintf("%scond -hitcount %s", prefix, bp.HitCond)) + } + if bp.Stacktrace > 0 { + attrs = append(attrs, fmt.Sprintf("%sstack %d", prefix, bp.Stacktrace)) + } + if bp.Goroutine { + attrs = append(attrs, fmt.Sprintf("%sgoroutine", prefix)) + } + if bp.LoadArgs != nil { + if *(bp.LoadArgs) == longLoadConfig { + attrs = append(attrs, fmt.Sprintf("%sargs -v", prefix)) + } else { + attrs = append(attrs, fmt.Sprintf("%sargs", prefix)) + } + } + if bp.LoadLocals != nil { + if *(bp.LoadLocals) == longLoadConfig { + attrs = append(attrs, fmt.Sprintf("%slocals -v", prefix)) + } else { + attrs = append(attrs, fmt.Sprintf("%slocals", prefix)) + } + } + for i := range bp.Variables { + attrs = append(attrs, fmt.Sprintf("%sprint %s", prefix, bp.Variables[i])) + } + if includeTrace && bp.Tracepoint { + attrs = append(attrs, fmt.Sprintf("%strace", prefix)) + } + for i := range bp.VerboseDescr { + attrs = append(attrs, fmt.Sprintf("%s%s", prefix, bp.VerboseDescr[i])) + } + return attrs +} + +func setBreakpoint(t *Term, ctx callContext, tracepoint bool, argstr string) ([]*api.Breakpoint, error) { + args := config.Split2PartsBySpace(argstr) requestedBp := &api.Breakpoint{} spec := "" switch len(args) { case 1: - spec = argstr + if len(args[0]) != 0 { + spec = argstr + } else { + // no arg specified + spec = "+0" + } case 2: if api.ValidBreakpointName(args[0]) == nil { requestedBp.Name = args[0] @@ -1453,23 +1695,24 @@ func setBreakpoint(t *Term, ctx callContext, tracepoint bool, argstr string) err spec = argstr } default: - return fmt.Errorf("address required") + return nil, fmt.Errorf("address required") } requestedBp.Tracepoint = tracepoint - locs, err := t.client.FindLocation(ctx.Scope, spec, true) + locs, err := t.client.FindLocation(ctx.Scope, spec, true, t.substitutePathRules()) if err != nil { if requestedBp.Name == "" { - return err + return nil, err } requestedBp.Name = "" spec = argstr var err2 error - locs, err2 = t.client.FindLocation(ctx.Scope, spec, true) + locs, err2 = t.client.FindLocation(ctx.Scope, spec, true, t.substitutePathRules()) if err2 != nil { - return err + return nil, err } } + created := []*api.Breakpoint{} for _, loc := range locs { requestedBp.Addr = loc.PC requestedBp.Addrs = loc.PCs @@ -1479,16 +1722,17 @@ func setBreakpoint(t *Term, ctx callContext, tracepoint bool, argstr string) err bp, err := t.client.CreateBreakpoint(requestedBp) if err != nil { - return err + return nil, err } + created = append(created, bp) - fmt.Printf("%s set at %s\n", formatBreakpointName(bp, true), formatBreakpointLocation(bp)) + fmt.Printf("%s set at %s\n", formatBreakpointName(bp, true), t.formatBreakpointLocation(bp)) } var shouldSetReturnBreakpoints bool loc, err := locspec.Parse(spec) if err != nil { - return err + return nil, err } switch t := loc.(type) { case *locspec.NormalLocationSpec: @@ -1503,7 +1747,7 @@ func setBreakpoint(t *Term, ctx callContext, tracepoint bool, argstr string) err } addrs, err := t.client.(*rpc2.RPCClient).FunctionReturnLocations(locs[0].Function.Name()) if err != nil { - return err + return nil, err } for j := range addrs { _, err = t.client.CreateBreakpoint(&api.Breakpoint{ @@ -1513,28 +1757,32 @@ func setBreakpoint(t *Term, ctx callContext, tracepoint bool, argstr string) err LoadArgs: &ShortLoadConfig, }) if err != nil { - return err + return nil, err } } } } - return nil + return created, nil } func breakpoint(t *Term, ctx callContext, args string) error { - return setBreakpoint(t, ctx, false, args) + _, err := setBreakpoint(t, ctx, false, args) + return err } func tracepoint(t *Term, ctx callContext, args string) error { - return setBreakpoint(t, ctx, true, args) -} - -func edit(t *Term, ctx callContext, args string) error { - file, lineno, _, err := getLocation(t, ctx, args, false) - if err != nil { - return err + if ctx.Prefix == onPrefix { + if args != "" { + return errors.New("too many arguments to trace") + } + ctx.Breakpoint.Tracepoint = true + return nil } + _, err := setBreakpoint(t, ctx, true, args) + return err +} +func runEditor(args ...string) error { var editor string if editor = os.Getenv("DELVE_EDITOR"); editor == "" { if editor = os.Getenv("EDITOR"); editor == "" { @@ -1542,33 +1790,81 @@ func edit(t *Term, ctx callContext, args string) error { } } - cmd := exec.Command(editor, fmt.Sprintf("+%d", lineno), file) + cmd := exec.Command(editor, args...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr return cmd.Run() } -func examineMemoryCmd(t *Term, ctx callContext, args string) error { - v := strings.FieldsFunc(args, func(c rune) bool { - return c == ' ' - }) +func edit(t *Term, ctx callContext, args string) error { + file, lineno, _, err := getLocation(t, ctx, args, false) + if err != nil { + return err + } + return runEditor(fmt.Sprintf("+%d", lineno), file) +} + +func watchpoint(t *Term, ctx callContext, args string) error { + v := strings.SplitN(args, " ", 2) + if len(v) != 2 { + return errors.New("wrong number of arguments: watch [-r|-w|-rw] ") + } + var wtype api.WatchType + switch v[0] { + case "-r": + wtype = api.WatchRead + case "-w": + wtype = api.WatchWrite + case "-rw": + wtype = api.WatchRead | api.WatchWrite + default: + return fmt.Errorf("wrong argument %q to watch", v[0]) + } + bp, err := t.client.CreateWatchpoint(ctx.Scope, v[1], wtype) + if err != nil { + return err + } + fmt.Printf("%s set at %s\n", formatBreakpointName(bp, true), t.formatBreakpointLocation(bp)) + return nil +} +func examineMemoryCmd(t *Term, ctx callContext, argstr string) error { var ( - address int64 + address uint64 err error ok bool + args = strings.Split(argstr, " ") ) // Default value priFmt := byte('x') - length := 1 + count := 1 + size := 1 + isExpr := false + + // nextArg returns the next argument that is not an empty string, if any, and + // advances the args slice to the position after that. + nextArg := func() string { + for len(args) > 0 { + arg := args[0] + args = args[1:] + if arg != "" { + return arg + } + } + return "" + } - for i := 0; i < len(v); i++ { - switch v[i] { +loop: + for { + switch cmd := nextArg(); cmd { + case "": + // no more arguments + break loop case "-fmt": - i++ - if i >= len(v) { + arg := nextArg() + if arg == "" { return fmt.Errorf("expected argument after -fmt") } fmtMapToPriFmt := map[string]byte{ @@ -1581,49 +1877,99 @@ func examineMemoryCmd(t *Term, ctx callContext, args string) error { "bin": 'b', "binary": 'b', } - priFmt, ok = fmtMapToPriFmt[v[i]] + priFmt, ok = fmtMapToPriFmt[arg] if !ok { - return fmt.Errorf("%q is not a valid format", v[i]) + return fmt.Errorf("%q is not a valid format", arg) } - case "-len": - i++ - if i >= len(v) { - return fmt.Errorf("expected argument after -len") + case "-count", "-len": + arg := nextArg() + if arg == "" { + return fmt.Errorf("expected argument after -count/-len") } var err error - length, err = strconv.Atoi(v[i]) - if err != nil || length <= 0 { - return fmt.Errorf("len must be an positive integer") + count, err = strconv.Atoi(arg) + if err != nil || count <= 0 { + return fmt.Errorf("count/len must be a positive integer") } - // TODO, maybe configured by user. - if length > 1000 { - return fmt.Errorf("len must be less than or equal to 1000") + case "-size": + arg := nextArg() + if arg == "" { + return fmt.Errorf("expected argument after -size") } - default: - if i != len(v)-1 { - return fmt.Errorf("unknown option %q", v[i]) + var err error + size, err = strconv.Atoi(arg) + if err != nil || size <= 0 || size > 8 { + return fmt.Errorf("size must be a positive integer (<=8)") } - // TODO, maybe we can support expression. - address, err = strconv.ParseInt(v[len(v)-1], 0, 64) - if err != nil { - return fmt.Errorf("convert address into uintptr type failed, %s", err) + case "-x": + isExpr = true + break loop // remaining args are going to be interpreted as expression + default: + if len(args) > 0 { + return fmt.Errorf("unknown option %q", args[0]) } + args = []string{cmd} + break loop // only one arg left to be evaluated as a uint } } - if address == 0 { + // TODO, maybe configured by user. + if count*size > 1000 { + return fmt.Errorf("read memory range (count*size) must be less than or equal to 1000 bytes") + } + + if len(args) == 0 { return fmt.Errorf("no address specified") } - memArea, err := t.client.ExamineMemory(uintptr(address), length) + if isExpr { + expr := strings.Join(args, " ") + val, err := t.client.EvalVariable(ctx.Scope, expr, t.loadConfig()) + if err != nil { + return err + } + + // "-x &myVar" or "-x myPtrVar" + if val.Kind == reflect.Ptr { + if len(val.Children) < 1 { + return fmt.Errorf("bug? invalid pointer: %#v", val) + } + address = val.Children[0].Addr + // "-x 0xc000079f20 + 8" or -x 824634220320 + 8 + } else if val.Kind == reflect.Int && val.Value != "" { + address, err = strconv.ParseUint(val.Value, 0, 64) + if err != nil { + return fmt.Errorf("bad expression result: %q: %s", val.Value, err) + } + } else { + return fmt.Errorf("unsupported expression type: %s", val.Kind) + } + } else { + address, err = strconv.ParseUint(args[0], 0, 64) + if err != nil { + return fmt.Errorf("convert address into uintptr type failed, %s", err) + } + } + + memArea, isLittleEndian, err := t.client.ExamineMemory(address, count*size) if err != nil { return err } - - fmt.Print(api.PrettyExamineMemory(uintptr(address), memArea, priFmt)) + fmt.Print(api.PrettyExamineMemory(uintptr(address), memArea, isLittleEndian, priFmt, size)) return nil } +func parseFormatArg(args string) (fmtstr, argsOut string) { + if len(args) < 1 || args[0] != '%' { + return "", args + } + v := strings.SplitN(args, " ", 2) + if len(v) == 1 { + return v[0], "" + } + return v[0], v[1] +} + func printVar(t *Term, ctx callContext, args string) error { if len(args) == 0 { return fmt.Errorf("not enough arguments") @@ -1632,12 +1978,13 @@ func printVar(t *Term, ctx callContext, args string) error { ctx.Breakpoint.Variables = append(ctx.Breakpoint.Variables, args) return nil } + fmtstr, args := parseFormatArg(args) val, err := t.client.EvalVariable(ctx.Scope, args, t.loadConfig()) if err != nil { return err } - fmt.Println(val.MultilineString("")) + fmt.Println(val.MultilineString("", fmtstr)) return nil } @@ -1649,6 +1996,10 @@ func whatisCommand(t *Term, ctx callContext, args string) error { if err != nil { return err } + if val.Flags&api.VariableCPURegister != 0 { + fmt.Println("CPU Register") + return nil + } if val.Type != "" { fmt.Println(val.Type) } @@ -1697,7 +2048,7 @@ func printFilteredVariables(varType string, vars []api.Variable, filter string, if cfg == ShortLoadConfig { fmt.Printf("%s = %s\n", name, v.SinglelineString()) } else { - fmt.Printf("%s = %s\n", name, v.MultilineString("")) + fmt.Printf("%s = %s\n", name, v.MultilineString("", "")) } } } @@ -1731,7 +2082,7 @@ func types(t *Term, ctx callContext, args string) error { } func parseVarArguments(args string, t *Term) (filter string, cfg api.LoadConfig) { - if v := split2PartsBySpace(args); len(v) >= 1 && v[0] == "-v" { + if v := config.Split2PartsBySpace(args); len(v) >= 1 && v[0] == "-v" { if len(v) == 2 { return v[1], t.loadConfig() } else { @@ -1818,7 +2169,7 @@ func stackCommand(t *Term, ctx callContext, args string) error { if err != nil { return err } - printStack(os.Stdout, stack, "", sa.offsets) + printStack(t, os.Stdout, stack, "", sa.offsets) if sa.ancestors > 0 { ancestors, err := t.client.Ancestors(ctx.Scope.GoroutineID, sa.ancestors, sa.ancestorDepth) if err != nil { @@ -1830,7 +2181,7 @@ func stackCommand(t *Term, ctx callContext, args string) error { fmt.Printf("\t%s\n", ancestor.Unreadable) continue } - printStack(os.Stdout, ancestor.Stack, "\t", false) + printStack(t, os.Stdout, ancestor.Stack, "\t", false) } } return nil @@ -1959,7 +2310,7 @@ func getLocation(t *Term, ctx callContext, args string, showContext bool) (file return loc.File, loc.Line, true, nil default: - locs, err := t.client.FindLocation(ctx.Scope, args, false) + locs, err := t.client.FindLocation(ctx.Scope, args, false, t.substitutePathRules()) if err != nil { return "", 0, false, err } @@ -1999,15 +2350,15 @@ func (c *Commands) sourceCommand(t *Term, ctx callContext, args string) error { return c.executeFile(t, args) } -var disasmUsageError = errors.New("wrong number of arguments: disassemble [-a ] [-l ]") +var errDisasmUsage = errors.New("wrong number of arguments: disassemble [-a ] [-l ]") func disassCommand(t *Term, ctx callContext, args string) error { var cmd, rest string if args != "" { - argv := split2PartsBySpace(args) + argv := config.Split2PartsBySpace(args) if len(argv) != 2 { - return disasmUsageError + return errDisasmUsage } cmd = argv[0] rest = argv[1] @@ -2030,15 +2381,15 @@ func disassCommand(t *Term, ctx callContext, args string) error { switch cmd { case "": - locs, err := t.client.FindLocation(ctx.Scope, "+0", true) + locs, err := t.client.FindLocation(ctx.Scope, "+0", true, t.substitutePathRules()) if err != nil { return err } disasm, disasmErr = t.client.DisassemblePC(ctx.Scope, locs[0].PC, flavor) case "-a": - v := split2PartsBySpace(rest) + v := config.Split2PartsBySpace(rest) if len(v) != 2 { - return disasmUsageError + return errDisasmUsage } startpc, err := strconv.ParseInt(v[0], 0, 64) if err != nil { @@ -2050,7 +2401,7 @@ func disassCommand(t *Term, ctx callContext, args string) error { } disasm, disasmErr = t.client.DisassembleRange(ctx.Scope, uint64(startpc), uint64(endpc), flavor) case "-l": - locs, err := t.client.FindLocation(ctx.Scope, rest, true) + locs, err := t.client.FindLocation(ctx.Scope, rest, true, t.substitutePathRules()) if err != nil { return err } @@ -2059,7 +2410,7 @@ func disassCommand(t *Term, ctx callContext, args string) error { } disasm, disasmErr = t.client.DisassemblePC(ctx.Scope, locs[0].PC, flavor) default: - return disasmUsageError + return errDisasmUsage } if disasmErr != nil { @@ -2090,64 +2441,8 @@ func digits(n int) int { return int(math.Floor(math.Log10(float64(n)))) + 1 } -const stacktraceTruncatedMessage = "(truncated)" - -func printStack(out io.Writer, stack []api.Stackframe, ind string, offsets bool) { - if len(stack) == 0 { - return - } - - extranl := offsets - for i := range stack { - if extranl { - break - } - extranl = extranl || (len(stack[i].Defers) > 0) || (len(stack[i].Arguments) > 0) || (len(stack[i].Locals) > 0) - } - - d := digits(len(stack) - 1) - fmtstr := "%s%" + strconv.Itoa(d) + "d 0x%016x in %s\n" - s := ind + strings.Repeat(" ", d+2+len(ind)) - - for i := range stack { - if stack[i].Err != "" { - fmt.Fprintf(out, "%serror: %s\n", s, stack[i].Err) - continue - } - fmt.Fprintf(out, fmtstr, ind, i, stack[i].PC, stack[i].Function.Name()) - fmt.Fprintf(out, "%sat %s:%d\n", s, shortenFilePath(stack[i].File), stack[i].Line) - - if offsets { - fmt.Fprintf(out, "%sframe: %+#x frame pointer %+#x\n", s, stack[i].FrameOffset, stack[i].FramePointerOffset) - } - - for j, d := range stack[i].Defers { - deferHeader := fmt.Sprintf("%s defer %d: ", s, j+1) - s2 := strings.Repeat(" ", len(deferHeader)) - if d.Unreadable != "" { - fmt.Fprintf(out, "%s(unreadable defer: %s)\n", deferHeader, d.Unreadable) - continue - } - fmt.Fprintf(out, "%s%#016x in %s\n", deferHeader, d.DeferredLoc.PC, d.DeferredLoc.Function.Name()) - fmt.Fprintf(out, "%sat %s:%d\n", s2, d.DeferredLoc.File, d.DeferredLoc.Line) - fmt.Fprintf(out, "%sdeferred by %s at %s:%d\n", s2, d.DeferLoc.Function.Name(), d.DeferLoc.File, d.DeferLoc.Line) - } - - for j := range stack[i].Arguments { - fmt.Fprintf(out, "%s %s = %s\n", s, stack[i].Arguments[j].Name, stack[i].Arguments[j].SinglelineString()) - } - for j := range stack[i].Locals { - fmt.Fprintf(out, "%s %s = %s\n", s, stack[i].Locals[j].Name, stack[i].Locals[j].SinglelineString()) - } - - if extranl { - fmt.Fprintln(out) - } - } - - if len(stack) > 0 && !stack[len(stack)-1].Bottom { - fmt.Fprintf(out, "%s"+stacktraceTruncatedMessage+"\n", ind) - } +func printStack(t *Term, out io.Writer, stack []api.Stackframe, ind string, offsets bool) { + api.PrintStack(t.formatPath, out, stack, ind, offsets, func(api.Stackframe) bool { return true }) } func printcontext(t *Term, state *api.DebuggerState) { @@ -2176,14 +2471,14 @@ func printcontext(t *Term, state *api.DebuggerState) { } } if th == nil { - printcontextLocation(state.SelectedGoroutine.CurrentLoc) + printcontextLocation(t, state.SelectedGoroutine.CurrentLoc) return } } if th.File == "" { fmt.Printf("Stopped at: 0x%x\n", state.CurrentThread.PC) - t.Println("=>", "no source available") + _ = colorize.Print(t.stdout, "", bytes.NewReader([]byte("no source available")), 1, 10, 1, nil) return } @@ -2192,10 +2487,14 @@ func printcontext(t *Term, state *api.DebuggerState) { if state.When != "" { fmt.Println(state.When) } + + for _, watchpoint := range state.WatchOutOfScope { + fmt.Printf("%s went out of scope and was cleared\n", formatBreakpointName(watchpoint, true)) + } } -func printcontextLocation(loc api.Location) { - fmt.Printf("> %s() %s:%d (PC: %#v)\n", loc.Function.Name(), shortenFilePath(loc.File), loc.Line, loc.PC) +func printcontextLocation(t *Term, loc api.Location) { + fmt.Printf("> %s() %s:%d (PC: %#v)\n", loc.Function.Name(), t.formatPath(loc.File), loc.Line, loc.PC) if loc.Function != nil && loc.Function.Optimized { fmt.Println(optimizedFunctionWarning) } @@ -2207,7 +2506,7 @@ func printReturnValues(th *api.Thread) { } fmt.Println("Values returned:") for _, v := range th.ReturnValues { - fmt.Printf("\t%s: %s\n", v.Name, v.MultilineString("\t")) + fmt.Printf("\t%s: %s\n", v.Name, v.MultilineString("\t", "")) } fmt.Println() } @@ -2216,7 +2515,7 @@ func printcontextThread(t *Term, th *api.Thread) { fn := th.Function if th.Breakpoint == nil { - printcontextLocation(api.Location{PC: th.PC, File: th.File, Line: th.Line, Function: th.Function}) + printcontextLocation(t, api.Location{PC: th.PC, File: th.File, Line: th.Line, Function: th.Function}) printReturnValues(th) return } @@ -2242,12 +2541,14 @@ func printcontextThread(t *Term, th *api.Thread) { } bpname := "" - if th.Breakpoint.Name != "" { + if th.Breakpoint.WatchExpr != "" { + bpname = fmt.Sprintf("watchpoint on [%s] ", th.Breakpoint.WatchExpr) + } else if th.Breakpoint.Name != "" { bpname = fmt.Sprintf("[%s] ", th.Breakpoint.Name) } if th.Breakpoint.Tracepoint || th.Breakpoint.TraceReturn { - printTracepoint(th, bpname, fn, args, hasReturnValue) + printTracepoint(t, th, bpname, fn, args, hasReturnValue) return } @@ -2256,7 +2557,7 @@ func printcontextThread(t *Term, th *api.Thread) { bpname, fn.Name(), args, - shortenFilePath(th.File), + t.formatPath(th.File), th.Line, th.GoroutineID, hitCount, @@ -2267,7 +2568,7 @@ func printcontextThread(t *Term, th *api.Thread) { bpname, fn.Name(), args, - shortenFilePath(th.File), + t.formatPath(th.File), th.Line, th.Breakpoint.TotalHitCount, th.PC) @@ -2277,10 +2578,10 @@ func printcontextThread(t *Term, th *api.Thread) { } printReturnValues(th) - printBreakpointInfo(th, false) + printBreakpointInfo(t, th, false) } -func printBreakpointInfo(th *api.Thread, tracepointOnNewline bool) { +func printBreakpointInfo(t *Term, th *api.Thread, tracepointOnNewline bool) { if th.BreakpointInfo == nil { return } @@ -2302,18 +2603,18 @@ func printBreakpointInfo(th *api.Thread, tracepointOnNewline bool) { if bpi.Goroutine != nil { tracepointnl() - writeGoroutineLong(os.Stdout, bpi.Goroutine, "\t") + writeGoroutineLong(t, os.Stdout, bpi.Goroutine, "\t") } for _, v := range bpi.Variables { tracepointnl() - fmt.Printf("\t%s: %s\n", v.Name, v.MultilineString("\t")) + fmt.Printf("\t%s: %s\n", v.Name, v.MultilineString("\t", "")) } for _, v := range bpi.Locals { tracepointnl() if *bp.LoadLocals == longLoadConfig { - fmt.Printf("\t%s: %s\n", v.Name, v.MultilineString("\t")) + fmt.Printf("\t%s: %s\n", v.Name, v.MultilineString("\t", "")) } else { fmt.Printf("\t%s: %s\n", v.Name, v.SinglelineString()) } @@ -2322,24 +2623,24 @@ func printBreakpointInfo(th *api.Thread, tracepointOnNewline bool) { if bp.LoadArgs != nil && *bp.LoadArgs == longLoadConfig { for _, v := range bpi.Arguments { tracepointnl() - fmt.Printf("\t%s: %s\n", v.Name, v.MultilineString("\t")) + fmt.Printf("\t%s: %s\n", v.Name, v.MultilineString("\t", "")) } } if bpi.Stacktrace != nil { tracepointnl() fmt.Printf("\tStack:\n") - printStack(os.Stdout, bpi.Stacktrace, "\t\t", false) + printStack(t, os.Stdout, bpi.Stacktrace, "\t\t", false) } } -func printTracepoint(th *api.Thread, bpname string, fn *api.Function, args string, hasReturnValue bool) { +func printTracepoint(t *Term, th *api.Thread, bpname string, fn *api.Function, args string, hasReturnValue bool) { if th.Breakpoint.Tracepoint { fmt.Fprintf(os.Stderr, "> goroutine(%d): %s%s(%s)", th.GoroutineID, bpname, fn.Name(), args) if !hasReturnValue { fmt.Println() } - printBreakpointInfo(th, !hasReturnValue) + printBreakpointInfo(t, th, !hasReturnValue) } if th.Breakpoint.TraceReturn { retVals := make([]string, 0, len(th.ReturnValues)) @@ -2351,7 +2652,7 @@ func printTracepoint(th *api.Thread, bpname string, fn *api.Function, args strin if th.Breakpoint.TraceReturn || !hasReturnValue { if th.BreakpointInfo != nil && th.BreakpointInfo.Stacktrace != nil { fmt.Fprintf(os.Stderr, "\tStack:\n") - printStack(os.Stderr, th.BreakpointInfo.Stacktrace, "\t\t", false) + printStack(t, os.Stderr, th.BreakpointInfo.Stacktrace, "\t\t", false) } } } @@ -2360,6 +2661,13 @@ func printfile(t *Term, filename string, line int, showArrow bool) error { if filename == "" { return nil } + + lineCount := t.conf.GetSourceListLineCount() + arrowLine := 0 + if showArrow { + arrowLine = line + } + file, err := os.Open(t.substitutePath(filename)) if err != nil { return err @@ -2372,38 +2680,7 @@ func printfile(t *Term, filename string, line int, showArrow bool) error { fmt.Println("Warning: listing may not match stale executable") } - lineCount := t.conf.GetSourceListLineCount() - - buf := bufio.NewScanner(file) - l := line - for i := 1; i < l-lineCount; i++ { - if !buf.Scan() { - return nil - } - } - - s := l - lineCount - if s < 1 { - s = 1 - } - - for i := s; i <= l+lineCount; i++ { - if !buf.Scan() { - return nil - } - - var prefix string - if showArrow { - prefix = " " - if i == l { - prefix = "=>" - } - } - - prefix = fmt.Sprintf("%s%4d:\t", prefix, i) - t.Println(prefix, buf.Text()) - } - return nil + return colorize.Print(t.stdout, file.Name(), file, line-lineCount, line+lineCount+1, arrowLine, t.colorEscapes) } // ExitRequestError is returned when the user @@ -2432,7 +2709,7 @@ func getBreakpointByIDOrName(t *Term, arg string) (*api.Breakpoint, error) { } func (c *Commands) onCmd(t *Term, ctx callContext, argstr string) error { - args := split2PartsBySpace(argstr) + args := config.Split2PartsBySpace(argstr) if len(args) < 2 { return errors.New("not enough arguments") @@ -2445,20 +2722,104 @@ func (c *Commands) onCmd(t *Term, ctx callContext, argstr string) error { ctx.Prefix = onPrefix ctx.Breakpoint = bp - err = c.CallWithContext(args[1], t, ctx) - if err != nil { - return err + + if args[1] == "-edit" { + f, err := ioutil.TempFile("", "dlv-on-cmd-") + if err != nil { + return err + } + defer func() { + _ = os.Remove(f.Name()) + }() + attrs := formatBreakpointAttrs("", ctx.Breakpoint, true) + _, err = f.Write([]byte(strings.Join(attrs, "\n"))) + if err != nil { + return err + } + err = f.Close() + if err != nil { + return err + } + + err = runEditor(f.Name()) + if err != nil { + return err + } + + fin, err := os.Open(f.Name()) + if err != nil { + return err + } + defer fin.Close() + + err = c.parseBreakpointAttrs(t, ctx, fin) + if err != nil { + return err + } + } else { + err = c.CallWithContext(args[1], t, ctx) + if err != nil { + return err + } } return t.client.AmendBreakpoint(ctx.Breakpoint) } +func (c *Commands) parseBreakpointAttrs(t *Term, ctx callContext, r io.Reader) error { + ctx.Breakpoint.Tracepoint = false + ctx.Breakpoint.Goroutine = false + ctx.Breakpoint.Stacktrace = 0 + ctx.Breakpoint.Variables = ctx.Breakpoint.Variables[:0] + ctx.Breakpoint.Cond = "" + ctx.Breakpoint.HitCond = "" + + scan := bufio.NewScanner(r) + lineno := 0 + for scan.Scan() { + lineno++ + err := c.CallWithContext(scan.Text(), t, ctx) + if err != nil { + fmt.Printf("%d: %s\n", lineno, err.Error()) + } + } + return scan.Err() +} + func conditionCmd(t *Term, ctx callContext, argstr string) error { - args := split2PartsBySpace(argstr) + args := config.Split2PartsBySpace(argstr) if len(args) < 2 { return fmt.Errorf("not enough arguments") } + if args[0] == "-hitcount" { + // hitcount breakpoint + + if ctx.Prefix == onPrefix { + ctx.Breakpoint.HitCond = args[1] + return nil + } + + args = config.Split2PartsBySpace(args[1]) + if len(args) < 2 { + return fmt.Errorf("not enough arguments") + } + + bp, err := getBreakpointByIDOrName(t, args[0]) + if err != nil { + return err + } + + bp.HitCond = args[1] + + return t.client.AmendBreakpoint(bp) + } + + if ctx.Prefix == onPrefix { + ctx.Breakpoint.Cond = argstr + return nil + } + bp, err := getBreakpointByIDOrName(t, args[0]) if err != nil { return err @@ -2468,13 +2829,6 @@ func conditionCmd(t *Term, ctx callContext, argstr string) error { return t.client.AmendBreakpoint(bp) } -// shortenFilePath take a full file path and attempts to shorten -// it by replacing the current directory to './'. -func shortenFilePath(fullPath string) string { - workingDir, _ := os.Getwd() - return strings.Replace(fullPath, workingDir, ".", 1) -} - func (c *Commands) executeFile(t *Term, name string) error { fh, err := os.Open(name) if err != nil { @@ -2579,10 +2933,11 @@ func display(t *Term, ctx callContext, args string) error { case strings.HasPrefix(args, addOption): args = strings.TrimSpace(args[len(addOption):]) + fmtstr, args := parseFormatArg(args) if args == "" { return fmt.Errorf("not enough arguments") } - t.addDisplay(args) + t.addDisplay(args, fmtstr) t.printDisplay(len(t.displays) - 1) case strings.HasPrefix(args, delOption): @@ -2599,11 +2954,44 @@ func display(t *Term, ctx callContext, args string) error { return nil } +func dump(t *Term, ctx callContext, args string) error { + if args == "" { + return fmt.Errorf("not enough arguments") + } + dumpState, err := t.client.CoreDumpStart(args) + if err != nil { + return err + } + for { + if dumpState.ThreadsDone != dumpState.ThreadsTotal { + fmt.Printf("\rDumping threads %d / %d...", dumpState.ThreadsDone, dumpState.ThreadsTotal) + } else { + fmt.Printf("\rDumping memory %d / %d...", dumpState.MemDone, dumpState.MemTotal) + } + if !dumpState.Dumping { + break + } + dumpState = t.client.CoreDumpWait(1000) + } + fmt.Printf("\n") + if dumpState.Err != "" { + fmt.Printf("error dumping: %s\n", dumpState.Err) + } else if !dumpState.AllDone { + fmt.Printf("canceled\n") + } else if dumpState.MemDone != dumpState.MemTotal { + fmt.Printf("Core dump could be incomplete\n") + } + return nil +} + func formatBreakpointName(bp *api.Breakpoint, upcase bool) string { thing := "breakpoint" if bp.Tracepoint { thing = "tracepoint" } + if bp.WatchExpr != "" { + thing = "watchpoint" + } if upcase { thing = strings.Title(thing) } @@ -2611,10 +2999,13 @@ func formatBreakpointName(bp *api.Breakpoint, upcase bool) string { if id == "" { id = strconv.Itoa(bp.ID) } + if bp.WatchExpr != "" && bp.WatchExpr != bp.Name { + return fmt.Sprintf("%s %s on [%s]", thing, id, bp.WatchExpr) + } return fmt.Sprintf("%s %s", thing, id) } -func formatBreakpointLocation(bp *api.Breakpoint) string { +func (t *Term) formatBreakpointLocation(bp *api.Breakpoint) string { var out bytes.Buffer if len(bp.Addrs) > 0 { for i, addr := range bp.Addrs { @@ -2628,11 +3019,13 @@ func formatBreakpointLocation(bp *api.Breakpoint) string { // In case we are connecting to an older version of delve that does not return the Addrs field. fmt.Fprintf(&out, "%#x", bp.Addr) } - fmt.Fprintf(&out, " for ") - p := shortenFilePath(bp.File) - if bp.FunctionName != "" { - fmt.Fprintf(&out, "%s() ", bp.FunctionName) + if bp.WatchExpr == "" { + fmt.Fprintf(&out, " for ") + p := t.formatPath(bp.File) + if bp.FunctionName != "" { + fmt.Fprintf(&out, "%s() ", bp.FunctionName) + } + fmt.Fprintf(&out, "%s:%d", p, bp.Line) } - fmt.Fprintf(&out, "%s:%d", p, bp.Line) return out.String() } diff --git a/pkg/terminal/command_test.go b/pkg/terminal/command_test.go index da9d553b55..9a6429fe7a 100644 --- a/pkg/terminal/command_test.go +++ b/pkg/terminal/command_test.go @@ -8,6 +8,7 @@ import ( "net/http" "os" "path/filepath" + "reflect" "regexp" "runtime" "strconv" @@ -177,7 +178,7 @@ func withTestTerminalBuildFlags(name string, t testing.TB, buildFlags test.Build func TestCommandDefault(t *testing.T) { var ( cmds = Commands{} - cmd = cmds.Find("non-existant-command", noPrefix) + cmd = cmds.Find("non-existant-command", noPrefix).cmdFn ) err := cmd(nil, callContext{}, "") @@ -193,7 +194,7 @@ func TestCommandDefault(t *testing.T) { func TestCommandReplayWithoutPreviousCommand(t *testing.T) { var ( cmds = DebugCommands(nil) - cmd = cmds.Find("", noPrefix) + cmd = cmds.Find("", noPrefix).cmdFn err = cmd(nil, callContext{}, "") ) @@ -205,7 +206,7 @@ func TestCommandReplayWithoutPreviousCommand(t *testing.T) { func TestCommandThread(t *testing.T) { var ( cmds = DebugCommands(nil) - cmd = cmds.Find("thread", noPrefix) + cmd = cmds.Find("thread", noPrefix).cmdFn ) err := cmd(nil, callContext{}, "") @@ -247,16 +248,13 @@ func TestExecuteFile(t *testing.T) { } func TestIssue354(t *testing.T) { - printStack(os.Stdout, []api.Stackframe{}, "", false) - printStack(os.Stdout, []api.Stackframe{ + printStack(&Term{}, os.Stdout, []api.Stackframe{}, "", false) + printStack(&Term{}, os.Stdout, []api.Stackframe{ {Location: api.Location{PC: 0, File: "irrelevant.go", Line: 10, Function: nil}, Bottom: true}}, "", false) } func TestIssue411(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } test.AllowRecording(t) withTestTerminal("math", t, func(term *FakeTerminal) { term.MustExec("break _fixtures/math.go:8") @@ -270,9 +268,6 @@ func TestIssue411(t *testing.T) { } func TestTrace(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } test.AllowRecording(t) withTestTerminal("issue573", t, func(term *FakeTerminal) { term.MustExec("trace foo") @@ -289,9 +284,6 @@ func TestTrace(t *testing.T) { } func TestTraceWithName(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } test.AllowRecording(t) withTestTerminal("issue573", t, func(term *FakeTerminal) { term.MustExec("trace foobar foo") @@ -308,9 +300,6 @@ func TestTraceWithName(t *testing.T) { } func TestTraceOnNonFunctionEntry(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } test.AllowRecording(t) withTestTerminal("issue573", t, func(term *FakeTerminal) { term.MustExec("trace foobar issue573.go:19") @@ -342,17 +331,9 @@ func TestScopePrefix(t *testing.T) { const goroutinesCurLinePrefix = "* Goroutine " test.AllowRecording(t) - tgtAgoroutineCount := 10 - - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { - // We try to make sure that all goroutines are stopped at a sensible place - // before reading their stacktrace, but due to the nature of the test - // program there is no guarantee that we always find them in a reasonable - // state. - // Asynchronous preemption in Go 1.14 exacerbates this problem, to avoid - // unnecessary flakiness reduce the target count to 9, allowing one - // goroutine to be in a bad state. - tgtAgoroutineCount = 9 + lenient := 0 + if runtime.GOOS == "windows" { + lenient = 1 } withTestTerminal("goroutinestackprog", t, func(term *FakeTerminal) { @@ -407,7 +388,7 @@ func TestScopePrefix(t *testing.T) { } } } - if len(agoroutines)+extraAgoroutines < tgtAgoroutineCount { + if len(agoroutines)+extraAgoroutines < 10-lenient { t.Fatalf("Output of goroutines did not have 10 goroutines stopped on main.agoroutine (%d+%d found): %q", len(agoroutines), extraAgoroutines, goroutinesOut) } } @@ -421,6 +402,7 @@ func TestScopePrefix(t *testing.T) { stackOut := strings.Split(term.MustExec(fmt.Sprintf("goroutine %d stack", gid)), "\n") fid := -1 for _, line := range stackOut { + line = strings.TrimLeft(line, " ") space := strings.Index(line, " ") if space < 0 { continue @@ -436,7 +418,7 @@ func TestScopePrefix(t *testing.T) { } } if fid < 0 { - t.Fatalf("Could not find frame for goroutine %d: %v", gid, stackOut) + t.Fatalf("Could not find frame for goroutine %d: %q", gid, stackOut) } term.AssertExec(fmt.Sprintf("goroutine %d frame %d locals", gid, fid), "(no locals)\n") argsOut := strings.Split(term.MustExec(fmt.Sprintf("goroutine %d frame %d args", gid, fid)), "\n") @@ -451,13 +433,13 @@ func TestScopePrefix(t *testing.T) { seen[ival] = true } - firsterr := tgtAgoroutineCount != 10 - for i := range seen { - if firsterr { - firsterr = false - } else if !seen[i] { - t.Fatalf("goroutine %d not found", i) + if !seen[i] { + if lenient > 0 { + lenient-- + } else { + t.Fatalf("goroutine %d not found", i) + } } } @@ -497,14 +479,15 @@ func TestScopePrefix(t *testing.T) { } func TestOnPrefix(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } if runtime.GOOS == "freebsd" { t.Skip("test is not valid on FreeBSD") } const prefix = "\ti: " test.AllowRecording(t) + lenient := false + if runtime.GOOS == "windows" { + lenient = true + } withTestTerminal("goroutinestackprog", t, func(term *FakeTerminal) { term.MustExec("b agobp main.agoroutine") term.MustExec("on agobp print i") @@ -536,22 +519,13 @@ func TestOnPrefix(t *testing.T) { } } - firsterr := false - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { - // We try to make sure that all goroutines are stopped at a sensible place - // before reading their stacktrace, but due to the nature of the test - // program there is no guarantee that we always find them in a reasonable - // state. - // Asynchronous preemption in Go 1.14 exacerbates this problem, to avoid - // unnecessary flakiness allow a single goroutine to be in a bad state. - firsterr = true - } - for i := range seen { - if firsterr { - firsterr = false - } else if !seen[i] { - t.Fatalf("Goroutine %d not seen\n", i) + if !seen[i] { + if lenient { + lenient = false + } else { + t.Fatalf("Goroutine %d not seen\n", i) + } } } }) @@ -569,9 +543,6 @@ func TestNoVars(t *testing.T) { } func TestOnPrefixLocals(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } if runtime.GOOS == "freebsd" { t.Skip("test is not valid on FreeBSD") } @@ -608,21 +579,8 @@ func TestOnPrefixLocals(t *testing.T) { } } - firsterr := false - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { - // We try to make sure that all goroutines are stopped at a sensible place - // before reading their stacktrace, but due to the nature of the test - // program there is no guarantee that we always find them in a reasonable - // state. - // Asynchronous preemption in Go 1.14 exacerbates this problem, to avoid - // unnecessary flakiness allow a single goroutine to be in a bad state. - firsterr = true - } - for i := range seen { - if firsterr { - firsterr = false - } else if !seen[i] { + if !seen[i] { t.Fatalf("Goroutine %d not seen\n", i) } } @@ -642,51 +600,8 @@ func countOccurrences(s, needle string) int { return count } -func TestIssue387(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } - if runtime.GOOS == "freebsd" { - t.Skip("test is not valid on FreeBSD") - } - // a breakpoint triggering during a 'next' operation will interrupt it - test.AllowRecording(t) - withTestTerminal("issue387", t, func(term *FakeTerminal) { - breakpointHitCount := 0 - term.MustExec("break dostuff") - for { - outstr, err := term.Exec("continue") - breakpointHitCount += countOccurrences(outstr, "issue387.go:8") - t.Log(outstr) - if err != nil { - if !strings.Contains(err.Error(), "exited") { - t.Fatalf("Unexpected error executing 'continue': %v", err) - } - break - } - - pos := 9 - - for { - outstr = term.MustExec("next") - breakpointHitCount += countOccurrences(outstr, "issue387.go:8") - t.Log(outstr) - if countOccurrences(outstr, fmt.Sprintf("issue387.go:%d", pos)) == 0 { - t.Fatalf("did not continue to expected position %d", pos) - } - pos++ - if pos >= 11 { - break - } - } - } - if breakpointHitCount != 10 { - t.Fatalf("Breakpoint hit wrong number of times, expected 10 got %d", breakpointHitCount) - } - }) -} - func listIsAt(t *testing.T, term *FakeTerminal, listcmd string, cur, start, end int) { + t.Helper() outstr := term.MustExec(listcmd) lines := strings.Split(outstr, "\n") @@ -731,10 +646,10 @@ func TestListCmd(t *testing.T) { withTestTerminal("testvariables", t, func(term *FakeTerminal) { term.MustExec("continue") term.MustExec("continue") - listIsAt(t, term, "list", 25, 20, 30) - listIsAt(t, term, "list 69", 69, 64, 70) - listIsAt(t, term, "frame 1 list", 62, 57, 67) - listIsAt(t, term, "frame 1 list 69", 69, 64, 70) + listIsAt(t, term, "list", 27, 22, 32) + listIsAt(t, term, "list 69", 69, 64, 74) + listIsAt(t, term, "frame 1 list", 66, 61, 71) + listIsAt(t, term, "frame 1 list 69", 69, 64, 74) _, err := term.Exec("frame 50 list") if err == nil { t.Fatalf("Expected error requesting 50th frame") @@ -917,25 +832,6 @@ func TestConfig(t *testing.T) { } } -func TestDisassembleAutogenerated(t *testing.T) { - // Executing the 'disassemble' command on autogenerated code should work correctly - - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 13) { - // CL 161337 in Go 1.13 and later removes the autogenerated init function - // https://go-review.googlesource.com/c/go/+/161337 - t.Skip("no autogenerated init function in Go 1.13 or later") - } - - withTestTerminal("math", t, func(term *FakeTerminal) { - term.MustExec("break main.init") - term.MustExec("continue") - out := term.MustExec("disassemble") - if !strings.Contains(out, "TEXT main.init(SB) ") { - t.Fatalf("output of disassemble wasn't for the main.init function %q", out) - } - }) -} - func TestIssue1090(t *testing.T) { // Exit while executing 'next' should report the "Process exited" error // message instead of crashing. @@ -1025,6 +921,7 @@ func TestOptimizationCheck(t *testing.T) { } func TestTruncateStacktrace(t *testing.T) { + const stacktraceTruncatedMessage = "(truncated)" withTestTerminal("stacktraceprog", t, func(term *FakeTerminal) { term.MustExec("break main.stacktraceme") term.MustExec("continue") @@ -1042,9 +939,6 @@ func TestTruncateStacktrace(t *testing.T) { } func TestIssue1493(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("arm64 does not support FpRegs for now") - } // The 'regs' command without the '-a' option should only return // general purpose registers. withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { @@ -1065,9 +959,6 @@ func findStarFile(name string) string { } func TestIssue1598(t *testing.T) { - if runtime.GOARCH == "arm64" || runtime.GOARCH == "386" { - t.Skip(fmt.Errorf("%s does not support FunctionCall for now", runtime.GOARCH)) - } test.MustSupportFunctionCalls(t, testBackend) withTestTerminal("issue1598", t, func(term *FakeTerminal) { term.MustExec("break issue1598.go:5") @@ -1093,7 +984,7 @@ func TestExamineMemoryCmd(t *testing.T) { t.Fatalf("could convert %s into int64, err %s", addressStr, err) } - res := term.MustExec("examinemem -len 52 -fmt hex " + addressStr) + res := term.MustExec("examinemem -count 52 -fmt hex " + addressStr) t.Logf("the result of examining memory \n%s", res) // check first line firstLine := fmt.Sprintf("%#x: 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11", address) @@ -1109,7 +1000,7 @@ func TestExamineMemoryCmd(t *testing.T) { // second examining memory term.MustExec("continue") - res = term.MustExec("x -len 52 -fmt bin " + addressStr) + res = term.MustExec("x -count 52 -fmt bin " + addressStr) t.Logf("the second result of examining memory result \n%s", res) // check first line @@ -1117,6 +1008,66 @@ func TestExamineMemoryCmd(t *testing.T) { if !strings.Contains(res, firstLine) { t.Fatalf("expected first line: %s", firstLine) } + + // third examining memory: -x addr + res = term.MustExec("examinemem -x " + addressStr) + t.Logf("the third result of examining memory result \n%s", res) + firstLine = fmt.Sprintf("%#x: 0xff", address) + if !strings.Contains(res, firstLine) { + t.Fatalf("expected first line: %s", firstLine) + } + + // fourth examining memory: -x addr + offset + res = term.MustExec("examinemem -x " + addressStr + " + 8") + t.Logf("the fourth result of examining memory result \n%s", res) + firstLine = fmt.Sprintf("%#x: 0x12", address+8) + if !strings.Contains(res, firstLine) { + t.Fatalf("expected first line: %s", firstLine) + } + // fifth examining memory: -x &var + res = term.MustExec("examinemem -x &bs[0]") + t.Logf("the fifth result of examining memory result \n%s", res) + firstLine = fmt.Sprintf("%#x: 0xff", address) + if !strings.Contains(res, firstLine) { + t.Fatalf("expected first line: %s", firstLine) + } + + // sixth examining memory: -fmt and double spaces + res = term.MustExec("examinemem -fmt hex -x &bs[0]") + t.Logf("the sixth result of examining memory result \n%s", res) + firstLine = fmt.Sprintf("%#x: 0xff", address) + if !strings.Contains(res, firstLine) { + t.Fatalf("expected first line: %s", firstLine) + } + }) + + withTestTerminal("testvariables2", t, func(term *FakeTerminal) { + tests := []struct { + Expr string + Want int + }{ + {Expr: "&i1", Want: 1}, + {Expr: "&i2", Want: 2}, + {Expr: "p1", Want: 1}, + {Expr: "*pp1", Want: 1}, + {Expr: "&str1[1]", Want: '1'}, + {Expr: "c1.pb", Want: 1}, + {Expr: "&c1.pb.a", Want: 1}, + {Expr: "&c1.pb.a.A", Want: 1}, + {Expr: "&c1.pb.a.B", Want: 2}, + } + term.MustExec("continue") + for _, test := range tests { + res := term.MustExec("examinemem -fmt dec -x " + test.Expr) + // strip addr from output, e.g. "0xc0000160b8: 023" -> "023" + res = strings.TrimSpace(strings.Split(res, ":")[1]) + got, err := strconv.Atoi(res) + if err != nil { + t.Fatalf("expr=%q err=%s", test.Expr, err) + } else if got != test.Want { + t.Errorf("expr=%q got=%d want=%d", test.Expr, got, test.Want) + } + } }) } @@ -1185,3 +1136,136 @@ func TestParseNewArgv(t *testing.T) { } } } + +func TestContinueUntil(t *testing.T) { + withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { + if runtime.GOARCH != "386" { + listIsAt(t, term, "continue main.main", 16, -1, -1) + } else { + listIsAt(t, term, "continue main.main", 17, -1, -1) + } + listIsAt(t, term, "continue main.sayhi", 12, -1, -1) + }) +} + +func TestContinueUntilExistingBreakpoint(t *testing.T) { + withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { + term.MustExec("break main.main") + if runtime.GOARCH != "386" { + listIsAt(t, term, "continue main.main", 16, -1, -1) + } else { + listIsAt(t, term, "continue main.main", 17, -1, -1) + } + listIsAt(t, term, "continue main.sayhi", 12, -1, -1) + }) +} + +func TestPrintFormat(t *testing.T) { + withTestTerminal("testvariables2", t, func(term *FakeTerminal) { + term.MustExec("continue") + out := term.MustExec("print %#x m2[1].B") + if !strings.Contains(out, "0xb\n") { + t.Fatalf("output did not contain '0xb': %q", out) + } + }) +} + +func TestHitCondBreakpoint(t *testing.T) { + withTestTerminal("break", t, func(term *FakeTerminal) { + term.MustExec("break bp1 main.main:4") + term.MustExec("condition -hitcount bp1 > 2") + listIsAt(t, term, "continue", 7, -1, -1) + out := term.MustExec("print i") + t.Logf("%q", out) + if !strings.Contains(out, "3\n") { + t.Fatalf("wrong value of i") + } + }) +} + +func TestBreakpointEditing(t *testing.T) { + term := &FakeTerminal{ + t: t, + Term: New(nil, &config.Config{}), + } + _ = term + + var testCases = []struct { + inBp *api.Breakpoint + inBpStr string + edit string + outBp *api.Breakpoint + }{ + { // tracepoint -> breakpoint + &api.Breakpoint{Tracepoint: true}, + "trace", + "", + &api.Breakpoint{}}, + { // breakpoint -> tracepoint + &api.Breakpoint{Variables: []string{"a"}}, + "print a", + "print a\ntrace", + &api.Breakpoint{Tracepoint: true, Variables: []string{"a"}}}, + { // add print var + &api.Breakpoint{Variables: []string{"a"}}, + "print a", + "print b\nprint a\n", + &api.Breakpoint{Variables: []string{"b", "a"}}}, + { // add goroutine flag + &api.Breakpoint{}, + "", + "goroutine", + &api.Breakpoint{Goroutine: true}}, + { // remove goroutine flag + &api.Breakpoint{Goroutine: true}, + "goroutine", + "", + &api.Breakpoint{}}, + { // add stack directive + &api.Breakpoint{}, + "", + "stack 10", + &api.Breakpoint{Stacktrace: 10}}, + { // remove stack directive + &api.Breakpoint{Stacktrace: 20}, + "stack 20", + "print a", + &api.Breakpoint{Variables: []string{"a"}}}, + { // add condition + &api.Breakpoint{Variables: []string{"a"}}, + "print a", + "print a\ncond a < b", + &api.Breakpoint{Variables: []string{"a"}, Cond: "a < b"}}, + { // remove condition + &api.Breakpoint{Cond: "a < b"}, + "cond a < b", + "", + &api.Breakpoint{}}, + { // change condition + &api.Breakpoint{Cond: "a < b"}, + "cond a < b", + "cond a < 5", + &api.Breakpoint{Cond: "a < 5"}}, + { // change hitcount condition + &api.Breakpoint{HitCond: "% 2"}, + "cond -hitcount % 2", + "cond -hitcount = 2", + &api.Breakpoint{HitCond: "= 2"}}, + } + + for _, tc := range testCases { + bp := *tc.inBp + bpStr := strings.Join(formatBreakpointAttrs("", &bp, true), "\n") + if bpStr != tc.inBpStr { + t.Errorf("Expected %q got %q for:\n%#v", tc.inBpStr, bpStr, tc.inBp) + } + ctx := callContext{Prefix: onPrefix, Scope: api.EvalScope{GoroutineID: -1, Frame: 0, DeferredCall: 0}, Breakpoint: &bp} + err := term.cmds.parseBreakpointAttrs(nil, ctx, strings.NewReader(tc.edit)) + if err != nil { + t.Errorf("Unexpected error during edit %q", tc.edit) + } + if !reflect.DeepEqual(bp, *tc.outBp) { + t.Errorf("mismatch after edit\nexpected: %#v\ngot: %#v", tc.outBp, bp) + } + } +} diff --git a/pkg/terminal/config.go b/pkg/terminal/config.go index 8f4fa62344..a005c51aa6 100644 --- a/pkg/terminal/config.go +++ b/pkg/terminal/config.go @@ -4,8 +4,6 @@ import ( "fmt" "os" "reflect" - "strconv" - "strings" "text/tabwriter" "github.com/go-delve/delve/pkg/config" @@ -32,70 +30,15 @@ func configureCmd(t *Term, ctx callContext, args string) error { } } -type configureIterator struct { - cfgValue reflect.Value - cfgType reflect.Type - i int -} - -func iterateConfiguration(conf *config.Config) *configureIterator { - cfgValue := reflect.ValueOf(conf).Elem() - cfgType := cfgValue.Type() - - return &configureIterator{cfgValue, cfgType, -1} -} - -func (it *configureIterator) Next() bool { - it.i++ - return it.i < it.cfgValue.NumField() -} - -func (it *configureIterator) Field() (name string, field reflect.Value) { - name = it.cfgType.Field(it.i).Tag.Get("yaml") - if comma := strings.Index(name, ","); comma >= 0 { - name = name[:comma] - } - field = it.cfgValue.Field(it.i) - return -} - -func configureFindFieldByName(conf *config.Config, name string) reflect.Value { - it := iterateConfiguration(conf) - for it.Next() { - fieldName, field := it.Field() - if fieldName == name { - return field - } - } - return reflect.ValueOf(nil) -} - func configureList(t *Term) error { w := new(tabwriter.Writer) w.Init(os.Stdout, 0, 8, 1, ' ', 0) - - it := iterateConfiguration(t.conf) - for it.Next() { - fieldName, field := it.Field() - if fieldName == "" { - continue - } - - if field.Kind() == reflect.Ptr { - if !field.IsNil() { - fmt.Fprintf(w, "%s\t%v\n", fieldName, field.Elem()) - } else { - fmt.Fprintf(w, "%s\t\n", fieldName) - } - } else { - fmt.Fprintf(w, "%s\t%v\n", fieldName, field) - } - } + config.ConfigureList(w, t.conf, "yaml") return w.Flush() } func configureSet(t *Term, args string) error { - v := split2PartsBySpace(args) + v := config.Split2PartsBySpace(args) cfgname := v[0] var rest string @@ -107,7 +50,7 @@ func configureSet(t *Term, args string) error { return configureSetAlias(t, rest) } - field := configureFindFieldByName(t.conf, cfgname) + field := config.ConfigureFindFieldByName(t.conf, cfgname, "yaml") if !field.CanAddr() { return fmt.Errorf("%q is not a configuration parameter", cfgname) } @@ -116,41 +59,7 @@ func configureSet(t *Term, args string) error { return configureSetSubstitutePath(t, rest) } - simpleArg := func(typ reflect.Type) (reflect.Value, error) { - switch typ.Kind() { - case reflect.Int: - n, err := strconv.Atoi(rest) - if err != nil { - return reflect.ValueOf(nil), fmt.Errorf("argument to %q must be a number", cfgname) - } - if n < 0 { - return reflect.ValueOf(nil), fmt.Errorf("argument to %q must be a number greater than zero", cfgname) - } - return reflect.ValueOf(&n), nil - case reflect.Bool: - v := rest == "true" - return reflect.ValueOf(&v), nil - case reflect.String: - return reflect.ValueOf(&rest), nil - default: - return reflect.ValueOf(nil), fmt.Errorf("unsupported type for configuration key %q", cfgname) - } - } - - if field.Kind() == reflect.Ptr { - val, err := simpleArg(field.Type().Elem()) - if err != nil { - return err - } - field.Set(val) - } else { - val, err := simpleArg(field.Type()) - if err != nil { - return err - } - field.Set(val.Elem()) - } - return nil + return config.ConfigureSetSimple(rest, cfgname, field) } func configureSetSubstitutePath(t *Term, rest string) error { diff --git a/pkg/terminal/starbind/conv.go b/pkg/terminal/starbind/conv.go index a102300e6a..49b29b313a 100644 --- a/pkg/terminal/starbind/conv.go +++ b/pkg/terminal/starbind/conv.go @@ -240,7 +240,7 @@ func (env *Env) variableValueToStarlarkValue(v *api.Variable, top bool) (starlar case "NaN": return starlark.Float(math.NaN()), nil default: - n, _ := strconv.ParseFloat(v.Value, 0) + n, _ := strconv.ParseFloat(v.Value, 64) return starlark.Float(n), nil } case reflect.Ptr, reflect.Interface: @@ -289,7 +289,7 @@ func (v structVariableAsStarlarkValue) Hash() (uint32, error) { } func (v structVariableAsStarlarkValue) String() string { - return fmt.Sprintf("%s", v.v.SinglelineString()) + return v.v.SinglelineString() } func (v structVariableAsStarlarkValue) Truth() starlark.Bool { @@ -349,7 +349,7 @@ func (v sliceVariableAsStarlarkValue) Hash() (uint32, error) { } func (v sliceVariableAsStarlarkValue) String() string { - return fmt.Sprintf("%s", v.v.SinglelineString()) + return v.v.SinglelineString() } func (v sliceVariableAsStarlarkValue) Truth() starlark.Bool { @@ -415,7 +415,7 @@ func (v ptrVariableAsStarlarkValue) Hash() (uint32, error) { } func (v ptrVariableAsStarlarkValue) String() string { - return fmt.Sprintf("%s", v.v.SinglelineString()) + return v.v.SinglelineString() } func (v ptrVariableAsStarlarkValue) Truth() starlark.Bool { @@ -494,7 +494,7 @@ func (v mapVariableAsStarlarkValue) Hash() (uint32, error) { } func (v mapVariableAsStarlarkValue) String() string { - return fmt.Sprintf("%s", v.v.SinglelineString()) + return v.v.SinglelineString() } func (v mapVariableAsStarlarkValue) Truth() starlark.Bool { diff --git a/pkg/terminal/starbind/starlark.go b/pkg/terminal/starbind/starlark.go index 8c4414807a..f37e01a799 100644 --- a/pkg/terminal/starbind/starlark.go +++ b/pkg/terminal/starbind/starlark.go @@ -266,19 +266,6 @@ func (env *Env) callMain(thread *starlark.Thread, globals starlark.StringDict, m return starlark.Call(thread, mainfn, argtuple, nil) } -type argument struct { - name string - defaultValue defaultValue -} - -type defaultValue uint8 - -const ( - defaultNone = iota - defaultScope - defaultLoadConfig -) - func isCancelled(thread *starlark.Thread) error { if ctx, ok := thread.Local(dlvContextName).(context.Context); ok { select { diff --git a/pkg/terminal/starbind/starlark_mapping.go b/pkg/terminal/starbind/starlark_mapping.go index b4f2bff59e..ee77776889 100644 --- a/pkg/terminal/starbind/starlark_mapping.go +++ b/pkg/terminal/starbind/starlark_mapping.go @@ -313,6 +313,84 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { } return env.interfaceToStarlarkValue(rpcRet), nil }) + r["create_ebpf_tracepoint"] = starlark.NewBuiltin("create_ebpf_tracepoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + if err := isCancelled(thread); err != nil { + return starlark.None, decorateError(thread, err) + } + var rpcArgs rpc2.CreateEBPFTracepointIn + var rpcRet rpc2.CreateEBPFTracepointOut + if len(args) > 0 && args[0] != starlark.None { + err := unmarshalStarlarkValue(args[0], &rpcArgs.FunctionName, "FunctionName") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + for _, kv := range kwargs { + var err error + switch kv[0].(starlark.String) { + case "FunctionName": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.FunctionName, "FunctionName") + default: + err = fmt.Errorf("unknown argument %q", kv[0]) + } + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + err := env.ctx.Client().CallAPI("CreateEBPFTracepoint", &rpcArgs, &rpcRet) + if err != nil { + return starlark.None, err + } + return env.interfaceToStarlarkValue(rpcRet), nil + }) + r["create_watchpoint"] = starlark.NewBuiltin("create_watchpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + if err := isCancelled(thread); err != nil { + return starlark.None, decorateError(thread, err) + } + var rpcArgs rpc2.CreateWatchpointIn + var rpcRet rpc2.CreateWatchpointOut + if len(args) > 0 && args[0] != starlark.None { + err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } else { + rpcArgs.Scope = env.ctx.Scope() + } + if len(args) > 1 && args[1] != starlark.None { + err := unmarshalStarlarkValue(args[1], &rpcArgs.Expr, "Expr") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + if len(args) > 2 && args[2] != starlark.None { + err := unmarshalStarlarkValue(args[2], &rpcArgs.Type, "Type") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + for _, kv := range kwargs { + var err error + switch kv[0].(starlark.String) { + case "Scope": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope") + case "Expr": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.Expr, "Expr") + case "Type": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.Type, "Type") + default: + err = fmt.Errorf("unknown argument %q", kv[0]) + } + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + err := env.ctx.Client().CallAPI("CreateWatchpoint", &rpcArgs, &rpcRet) + if err != nil { + return starlark.None, err + } + return env.interfaceToStarlarkValue(rpcRet), nil + }) r["detach"] = starlark.NewBuiltin("detach", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { if err := isCancelled(thread); err != nil { return starlark.None, decorateError(thread, err) @@ -399,6 +477,78 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { } return env.interfaceToStarlarkValue(rpcRet), nil }) + r["dump_cancel"] = starlark.NewBuiltin("dump_cancel", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + if err := isCancelled(thread); err != nil { + return starlark.None, decorateError(thread, err) + } + var rpcArgs rpc2.DumpCancelIn + var rpcRet rpc2.DumpCancelOut + err := env.ctx.Client().CallAPI("DumpCancel", &rpcArgs, &rpcRet) + if err != nil { + return starlark.None, err + } + return env.interfaceToStarlarkValue(rpcRet), nil + }) + r["dump_start"] = starlark.NewBuiltin("dump_start", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + if err := isCancelled(thread); err != nil { + return starlark.None, decorateError(thread, err) + } + var rpcArgs rpc2.DumpStartIn + var rpcRet rpc2.DumpStartOut + if len(args) > 0 && args[0] != starlark.None { + err := unmarshalStarlarkValue(args[0], &rpcArgs.Destination, "Destination") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + for _, kv := range kwargs { + var err error + switch kv[0].(starlark.String) { + case "Destination": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.Destination, "Destination") + default: + err = fmt.Errorf("unknown argument %q", kv[0]) + } + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + err := env.ctx.Client().CallAPI("DumpStart", &rpcArgs, &rpcRet) + if err != nil { + return starlark.None, err + } + return env.interfaceToStarlarkValue(rpcRet), nil + }) + r["dump_wait"] = starlark.NewBuiltin("dump_wait", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + if err := isCancelled(thread); err != nil { + return starlark.None, decorateError(thread, err) + } + var rpcArgs rpc2.DumpWaitIn + var rpcRet rpc2.DumpWaitOut + if len(args) > 0 && args[0] != starlark.None { + err := unmarshalStarlarkValue(args[0], &rpcArgs.Wait, "Wait") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + for _, kv := range kwargs { + var err error + switch kv[0].(starlark.String) { + case "Wait": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.Wait, "Wait") + default: + err = fmt.Errorf("unknown argument %q", kv[0]) + } + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + err := env.ctx.Client().CallAPI("DumpWait", &rpcArgs, &rpcRet) + if err != nil { + return starlark.None, err + } + return env.interfaceToStarlarkValue(rpcRet), nil + }) r["eval"] = starlark.NewBuiltin("eval", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { if err := isCancelled(thread); err != nil { return starlark.None, decorateError(thread, err) @@ -514,6 +664,12 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { return starlark.None, decorateError(thread, err) } } + if len(args) > 3 && args[3] != starlark.None { + err := unmarshalStarlarkValue(args[3], &rpcArgs.SubstitutePathRules, "SubstitutePathRules") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } for _, kv := range kwargs { var err error switch kv[0].(starlark.String) { @@ -523,6 +679,8 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { err = unmarshalStarlarkValue(kv[1], &rpcArgs.Loc, "Loc") case "IncludeNonExecutableLines": err = unmarshalStarlarkValue(kv[1], &rpcArgs.IncludeNonExecutableLines, "IncludeNonExecutableLines") + case "SubstitutePathRules": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.SubstitutePathRules, "SubstitutePathRules") default: err = fmt.Errorf("unknown argument %q", kv[0]) } @@ -604,6 +762,18 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { } return env.interfaceToStarlarkValue(rpcRet), nil }) + r["get_buffered_tracepoints"] = starlark.NewBuiltin("get_buffered_tracepoints", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + if err := isCancelled(thread); err != nil { + return starlark.None, decorateError(thread, err) + } + var rpcArgs rpc2.GetBufferedTracepointsIn + var rpcRet rpc2.GetBufferedTracepointsOut + err := env.ctx.Client().CallAPI("GetBufferedTracepoints", &rpcArgs, &rpcRet) + if err != nil { + return starlark.None, err + } + return env.interfaceToStarlarkValue(rpcRet), nil + }) r["get_thread"] = starlark.NewBuiltin("get_thread", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { if err := isCancelled(thread); err != nil { return starlark.None, decorateError(thread, err) @@ -664,6 +834,24 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { } var rpcArgs rpc2.ListBreakpointsIn var rpcRet rpc2.ListBreakpointsOut + if len(args) > 0 && args[0] != starlark.None { + err := unmarshalStarlarkValue(args[0], &rpcArgs.All, "All") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + for _, kv := range kwargs { + var err error + switch kv[0].(starlark.String) { + case "All": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.All, "All") + default: + err = fmt.Errorf("unknown argument %q", kv[0]) + } + if err != nil { + return starlark.None, decorateError(thread, err) + } + } err := env.ctx.Client().CallAPI("ListBreakpoints", &rpcArgs, &rpcRet) if err != nil { return starlark.None, err @@ -784,6 +972,18 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { return starlark.None, decorateError(thread, err) } } + if len(args) > 2 && args[2] != starlark.None { + err := unmarshalStarlarkValue(args[2], &rpcArgs.Filters, "Filters") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + if len(args) > 3 && args[3] != starlark.None { + err := unmarshalStarlarkValue(args[3], &rpcArgs.GoroutineGroupingOptions, "GoroutineGroupingOptions") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } for _, kv := range kwargs { var err error switch kv[0].(starlark.String) { @@ -791,6 +991,10 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { err = unmarshalStarlarkValue(kv[1], &rpcArgs.Start, "Start") case "Count": err = unmarshalStarlarkValue(kv[1], &rpcArgs.Count, "Count") + case "Filters": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filters, "Filters") + case "GoroutineGroupingOptions": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.GoroutineGroupingOptions, "GoroutineGroupingOptions") default: err = fmt.Errorf("unknown argument %q", kv[0]) } @@ -1279,5 +1483,43 @@ func (env *Env) starlarkPredeclare() starlark.StringDict { } return env.interfaceToStarlarkValue(rpcRet), nil }) + r["toggle_breakpoint"] = starlark.NewBuiltin("toggle_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) { + if err := isCancelled(thread); err != nil { + return starlark.None, decorateError(thread, err) + } + var rpcArgs rpc2.ToggleBreakpointIn + var rpcRet rpc2.ToggleBreakpointOut + if len(args) > 0 && args[0] != starlark.None { + err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + if len(args) > 1 && args[1] != starlark.None { + err := unmarshalStarlarkValue(args[1], &rpcArgs.Name, "Name") + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + for _, kv := range kwargs { + var err error + switch kv[0].(starlark.String) { + case "Id": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id") + case "Name": + err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name") + default: + err = fmt.Errorf("unknown argument %q", kv[0]) + } + if err != nil { + return starlark.None, decorateError(thread, err) + } + } + err := env.ctx.Client().CallAPI("ToggleBreakpoint", &rpcArgs, &rpcRet) + if err != nil { + return starlark.None, err + } + return env.interfaceToStarlarkValue(rpcRet), nil + }) return r } diff --git a/pkg/terminal/starlark_test.go b/pkg/terminal/starlark_test.go index b96b5f1575..1cdee0cb07 100644 --- a/pkg/terminal/starlark_test.go +++ b/pkg/terminal/starlark_test.go @@ -2,15 +2,11 @@ package terminal import ( "fmt" - "runtime" "strings" "testing" ) func TestStarlarkExamples(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("test is not valid on ARM64") - } withTestTerminal("testvariables2", t, func(term *FakeTerminal) { term.MustExec("continue") t.Run("goroutine_start_line", func(t *testing.T) { testStarlarkExampleGoroutineStartLine(t, term) }) diff --git a/pkg/terminal/terminal.go b/pkg/terminal/terminal.go index 27f67f3796..39a0b67906 100644 --- a/pkg/terminal/terminal.go +++ b/pkg/terminal/terminal.go @@ -1,19 +1,23 @@ package terminal +//lint:file-ignore ST1005 errors here can be capitalized + import ( "fmt" "io" "net/rpc" "os" "os/signal" - "runtime" "strings" "sync" "syscall" + "github.com/derekparker/trie" "github.com/peterh/liner" "github.com/go-delve/delve/pkg/config" + "github.com/go-delve/delve/pkg/locspec" + "github.com/go-delve/delve/pkg/terminal/colorize" "github.com/go-delve/delve/pkg/terminal/starbind" "github.com/go-delve/delve/service" "github.com/go-delve/delve/service/api" @@ -46,28 +50,38 @@ const ( // Term represents the terminal running dlv. type Term struct { - client service.Client - conf *config.Config - prompt string - line *liner.State - cmds *Commands - dumb bool - stdout io.Writer - InitFile string - displays []string + client service.Client + conf *config.Config + prompt string + line *liner.State + cmds *Commands + stdout io.Writer + InitFile string + displays []displayEntry + colorEscapes map[colorize.Style]string historyFile *os.File starlarkEnv *starbind.Env + substitutePathRulesCache [][2]string + // quitContinue is set to true by exitCommand to signal that the process // should be resumed before quitting. quitContinue bool + longCommandMu sync.Mutex + longCommandCancelFlag bool + quittingMutex sync.Mutex quitting bool } +type displayEntry struct { + expr string + fmtstr string +} + // New returns a new Term. func New(client service.Client, conf *config.Config) *Term { cmds := DebugCommands(client) @@ -79,30 +93,41 @@ func New(client service.Client, conf *config.Config) *Term { conf = &config.Config{} } - var w io.Writer - - dumb := strings.ToLower(os.Getenv("TERM")) == "dumb" - if dumb { - w = os.Stdout - } else { - w = getColorableWriter() - } - - if (conf.SourceListLineColor > ansiWhite && - conf.SourceListLineColor < ansiBrBlack) || - conf.SourceListLineColor < ansiBlack || - conf.SourceListLineColor > ansiBrWhite { - conf.SourceListLineColor = ansiBlue - } - t := &Term{ client: client, conf: conf, prompt: "(dlv) ", line: liner.NewLiner(), cmds: cmds, - dumb: dumb, - stdout: w, + stdout: os.Stdout, + } + + if strings.ToLower(os.Getenv("TERM")) != "dumb" { + t.stdout = getColorableWriter() + t.colorEscapes = make(map[colorize.Style]string) + t.colorEscapes[colorize.NormalStyle] = terminalResetEscapeCode + wd := func(s string, defaultCode int) string { + if s == "" { + return fmt.Sprintf(terminalHighlightEscapeCode, defaultCode) + } + return s + } + t.colorEscapes[colorize.KeywordStyle] = conf.SourceListKeywordColor + t.colorEscapes[colorize.StringStyle] = wd(conf.SourceListStringColor, ansiGreen) + t.colorEscapes[colorize.NumberStyle] = conf.SourceListNumberColor + t.colorEscapes[colorize.CommentStyle] = wd(conf.SourceListCommentColor, ansiBrMagenta) + t.colorEscapes[colorize.ArrowStyle] = wd(conf.SourceListArrowColor, ansiYellow) + switch x := conf.SourceListLineColor.(type) { + case string: + t.colorEscapes[colorize.LineNoStyle] = x + case int: + if (x > ansiWhite && x < ansiBrBlack) || x < ansiBlack || x > ansiBrWhite { + x = ansiBlue + } + t.colorEscapes[colorize.LineNoStyle] = fmt.Sprintf(terminalHighlightEscapeCode, x) + case nil: + t.colorEscapes[colorize.LineNoStyle] = fmt.Sprintf(terminalHighlightEscapeCode, ansiBlue) + } } if client != nil { @@ -121,6 +146,7 @@ func (t *Term) Close() { func (t *Term) sigintGuard(ch <-chan os.Signal, multiClient bool) { for range ch { + t.longCommandCancel() t.starlarkEnv.Cancel() state, err := t.client.GetStateNonBlocking() if err == nil && state.Recording { @@ -131,6 +157,14 @@ func (t *Term) sigintGuard(ch <-chan os.Signal, multiClient bool) { } continue } + if err == nil && state.CoreDumping { + fmt.Printf("received SIGINT, stopping dump\n") + err := t.client.CoreDumpCancel() + if err != nil { + fmt.Fprintf(os.Stderr, "%v\n", err) + } + continue + } if multiClient { answer, err := t.line.Prompt("Would you like to [p]ause the target (returning to Delve's prompt) or [q]uit this client (leaving the target running) [p/q]? ") if err != nil { @@ -179,21 +213,32 @@ func (t *Term) Run() (int, error) { signal.Notify(ch, syscall.SIGINT) go t.sigintGuard(ch, multiClient) - t.line.SetCompleter(func(line string) (c []string) { - if strings.HasPrefix(line, "break ") || strings.HasPrefix(line, "b ") { - filter := line[strings.Index(line, " ")+1:] - funcs, _ := t.client.ListFunctions(filter) - for _, f := range funcs { - c = append(c, "break "+f) - } - return + fns := trie.New() + cmds := trie.New() + funcs, _ := t.client.ListFunctions("") + for _, fn := range funcs { + fns.Add(fn, nil) + } + for _, cmd := range t.cmds.cmds { + for _, alias := range cmd.aliases { + cmds.Add(alias, nil) } - for _, cmd := range t.cmds.cmds { - for _, alias := range cmd.aliases { - if strings.HasPrefix(alias, strings.ToLower(line)) { - c = append(c, alias) + } + + t.line.SetCompleter(func(line string) (c []string) { + cmd := t.cmds.Find(strings.Split(line, " ")[0], noPrefix) + switch cmd.aliases[0] { + case "break", "trace", "continue": + if spc := strings.LastIndex(line, " "); spc > 0 { + prefix := line[:spc] + " " + funcs := fns.FuzzySearch(line[spc+1:]) + for _, f := range funcs { + c = append(c, prefix+f) } } + case "nullcmd", "nocmd": + commands := cmds.FuzzySearch(strings.ToLower(line)) + c = append(c, commands...) } return }) @@ -267,15 +312,6 @@ func (t *Term) Run() (int, error) { } } -// Println prints a line to the terminal. -func (t *Term) Println(prefix, str string) { - if !t.dumb { - terminalColorEscapeCode := fmt.Sprintf(terminalHighlightEscapeCode, t.conf.SourceListLineColor) - prefix = fmt.Sprintf("%s%s%s", terminalColorEscapeCode, prefix, terminalResetEscapeCode) - } - fmt.Fprintf(t.stdout, "%s%s\n", prefix, str) -} - // Substitutes directory to source file. // // Ensures that only directory is substituted, for example: @@ -287,40 +323,33 @@ func (t *Term) Println(prefix, str string) { // in the order they are defined, first rule that matches is used for // substitution. func (t *Term) substitutePath(path string) string { - path = crossPlatformPath(path) if t.conf == nil { return path } + return locspec.SubstitutePath(path, t.substitutePathRules()) +} - // On windows paths returned from headless server are as c:/dir/dir - // though os.PathSeparator is '\\' - - separator := "/" //make it default - if strings.Index(path, "\\") != -1 { //dependent on the path - separator = "\\" +func (t *Term) substitutePathRules() [][2]string { + if t.substitutePathRulesCache != nil { + return t.substitutePathRulesCache + } + if t.conf == nil || t.conf.SubstitutePath == nil { + return nil } + spr := make([][2]string, 0, len(t.conf.SubstitutePath)) for _, r := range t.conf.SubstitutePath { - from := crossPlatformPath(r.From) - to := r.To - - if !strings.HasSuffix(from, separator) { - from = from + separator - } - if !strings.HasSuffix(to, separator) { - to = to + separator - } - if strings.HasPrefix(path, from) { - return strings.Replace(path, from, to, 1) - } + spr = append(spr, [2]string{r.From, r.To}) } - return path + t.substitutePathRulesCache = spr + return spr } -func crossPlatformPath(path string) string { - if runtime.GOOS == "windows" { - return strings.ToLower(path) - } - return path +// formatPath applies path substitution rules and shortens the resulting +// path by replacing the current directory with './' +func (t *Term) formatPath(path string) string { + path = t.substitutePath(path) + workingDir, _ := os.Getwd() + return strings.Replace(path, workingDir, ".", 1) } func (t *Term) promptForInput() (string, error) { @@ -446,9 +475,9 @@ func (t *Term) removeDisplay(n int) error { if n < 0 || n >= len(t.displays) { return fmt.Errorf("%d is out of range", n) } - t.displays[n] = "" + t.displays[n] = displayEntry{"", ""} for i := len(t.displays) - 1; i >= 0; i-- { - if t.displays[i] != "" { + if t.displays[i].expr != "" { t.displays = t.displays[:i+1] return nil } @@ -457,12 +486,12 @@ func (t *Term) removeDisplay(n int) error { return nil } -func (t *Term) addDisplay(expr string) { - t.displays = append(t.displays, expr) +func (t *Term) addDisplay(expr, fmtstr string) { + t.displays = append(t.displays, displayEntry{expr: expr, fmtstr: fmtstr}) } func (t *Term) printDisplay(i int) { - expr := t.displays[i] + expr, fmtstr := t.displays[i].expr, t.displays[i].fmtstr val, err := t.client.EvalVariable(api.EvalScope{GoroutineID: -1}, expr, ShortLoadConfig) if err != nil { if isErrProcessExited(err) { @@ -471,12 +500,12 @@ func (t *Term) printDisplay(i int) { fmt.Printf("%d: %s = error %v\n", i, expr, err) return } - fmt.Printf("%d: %s = %s\n", i, val.Name, val.SinglelineString()) + fmt.Printf("%d: %s = %s\n", i, val.Name, val.SinglelineStringFormatted(fmtstr)) } func (t *Term) printDisplays() { for i := range t.displays { - if t.displays[i] != "" { + if t.displays[i].expr != "" { t.printDisplay(i) } } @@ -486,6 +515,24 @@ func (t *Term) onStop() { t.printDisplays() } +func (t *Term) longCommandCancel() { + t.longCommandMu.Lock() + defer t.longCommandMu.Unlock() + t.longCommandCancelFlag = true +} + +func (t *Term) longCommandStart() { + t.longCommandMu.Lock() + defer t.longCommandMu.Unlock() + t.longCommandCancelFlag = false +} + +func (t *Term) longCommandCanceled() bool { + t.longCommandMu.Lock() + defer t.longCommandMu.Unlock() + return t.longCommandCancelFlag +} + // isErrProcessExited returns true if `err` is an RPC error equivalent of proc.ErrProcessExited func isErrProcessExited(err error) bool { rpcError, ok := err.(rpc.ServerError) diff --git a/pkg/terminal/terminal_other.go b/pkg/terminal/terminal_other.go index 70a8fee933..afdf9a0b4c 100644 --- a/pkg/terminal/terminal_other.go +++ b/pkg/terminal/terminal_other.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package terminal diff --git a/pkg/version/buildinfo.go b/pkg/version/buildinfo.go new file mode 100644 index 0000000000..a43a4e6ad6 --- /dev/null +++ b/pkg/version/buildinfo.go @@ -0,0 +1,33 @@ +//go:build go1.12 +// +build go1.12 + +package version + +import ( + "bytes" + "runtime/debug" + "text/template" +) + +func init() { + buildInfo = moduleBuildInfo +} + +var buildInfoTmpl = ` mod {{.Main.Path}} {{.Main.Version}} {{.Main.Sum}} +{{range .Deps}} dep {{.Path}} {{.Version}} {{.Sum}}{{if .Replace}} + => {{.Replace.Path}} {{.Replace.Version}} {{.Replace.Sum}}{{end}} +{{end}}` + +func moduleBuildInfo() string { + info, ok := debug.ReadBuildInfo() + if !ok { + return "not built in module mode" + } + + buf := new(bytes.Buffer) + err := template.Must(template.New("buildinfo").Parse(buildInfoTmpl)).Execute(buf, info) + if err != nil { + panic(err) + } + return buf.String() +} diff --git a/pkg/version/fixbuild.go b/pkg/version/fixbuild.go new file mode 100644 index 0000000000..e2dad6e0d9 --- /dev/null +++ b/pkg/version/fixbuild.go @@ -0,0 +1,23 @@ +//go:build go1.18 +// +build go1.18 + +package version + +import "runtime/debug" + +func init() { + fixBuild = buildInfoFixBuild +} + +func buildInfoFixBuild(v *Version) { + info, ok := debug.ReadBuildInfo() + if !ok { + return + } + for i := range info.Settings { + if info.Settings[i].Key == "gitrevision" { + v.Build = info.Settings[i].Value + break + } + } +} diff --git a/pkg/version/version.go b/pkg/version/version.go index ca53189327..6a6c9c332d 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -1,6 +1,9 @@ package version -import "fmt" +import ( + "fmt" + "runtime" +) // Version represents the current version of Delve. type Version struct { @@ -14,15 +17,29 @@ type Version struct { var ( // DelveVersion is the current version of Delve. DelveVersion = Version{ - Major: "1", Minor: "5", Patch: "0", Metadata: "", + Major: "1", Minor: "8", Patch: "0", Metadata: "", + //TODO(aarzilli): before updating this to 1.8.0 re-enable staticcheck test Build: "$Id$", } ) func (v Version) String() string { + fixBuild(&v) ver := fmt.Sprintf("Version: %s.%s.%s", v.Major, v.Minor, v.Patch) if v.Metadata != "" { ver += "-" + v.Metadata } return fmt.Sprintf("%s\nBuild: %s", ver, v.Build) } + +var buildInfo = func() string { + return "" +} + +func BuildInfo() string { + return fmt.Sprintf("%s\n%s", runtime.Version(), buildInfo()) +} + +var fixBuild = func(v *Version) { + // does nothing +} diff --git a/service/api/command.go b/service/api/command.go new file mode 100644 index 0000000000..503dc54c48 --- /dev/null +++ b/service/api/command.go @@ -0,0 +1,153 @@ +package api + +import ( + "fmt" + "strconv" + "strings" +) + +type PrintGoroutinesFlags uint8 + +const ( + PrintGoroutinesStack PrintGoroutinesFlags = 1 << iota + PrintGoroutinesLabels +) + +type FormatGoroutineLoc int + +const ( + FglRuntimeCurrent = FormatGoroutineLoc(iota) + FglUserCurrent + FglGo + FglStart +) + +const ( + maxGroupMembers = 5 + maxGoroutineGroups = 50 +) + +// The number of goroutines we're going to request on each RPC call +const goroutineBatchSize = 10000 + +func ParseGoroutineArgs(argstr string) ([]ListGoroutinesFilter, GoroutineGroupingOptions, FormatGoroutineLoc, PrintGoroutinesFlags, int, int, error) { + args := strings.Split(argstr, " ") + var filters []ListGoroutinesFilter + var group GoroutineGroupingOptions + var fgl = FglUserCurrent + var flags PrintGoroutinesFlags + var depth = 10 + var batchSize = goroutineBatchSize + + group.MaxGroupMembers = maxGroupMembers + group.MaxGroups = maxGoroutineGroups + + for i := 0; i < len(args); i++ { + arg := args[i] + switch arg { + case "-u": + fgl = FglUserCurrent + case "-r": + fgl = FglRuntimeCurrent + case "-g": + fgl = FglGo + case "-s": + fgl = FglStart + case "-l": + flags |= PrintGoroutinesLabels + case "-t": + flags |= PrintGoroutinesStack + // optional depth argument + if i+1 < len(args) && len(args[i+1]) > 0 { + n, err := strconv.Atoi(args[i+1]) + if err == nil { + depth = n + i++ + } + } + + case "-w", "-with": + filter, err := readGoroutinesFilter(args, &i) + if err != nil { + return nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, fmt.Errorf("wrong argument: '%s'", arg) + } + filters = append(filters, *filter) + + case "-wo", "-without": + filter, err := readGoroutinesFilter(args, &i) + if err != nil { + return nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, fmt.Errorf("wrong argument: '%s'", arg) + } + filter.Negated = true + filters = append(filters, *filter) + + case "-group": + var err error + group.GroupBy, err = readGoroutinesFilterKind(args, i+1) + if err != nil { + return nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, fmt.Errorf("wrong argument: '%s'", arg) + } + i++ + if group.GroupBy == GoroutineLabel { + if i+1 >= len(args) { + return nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, fmt.Errorf("wrong argument: '%s'", arg) + } + group.GroupByKey = args[i+1] + i++ + } + batchSize = 0 // grouping only works well if run on all goroutines + + case "": + // nothing to do + default: + return nil, GoroutineGroupingOptions{}, 0, 0, 0, 0, fmt.Errorf("wrong argument: '%s'", arg) + } + } + return filters, group, fgl, flags, depth, batchSize, nil +} + +func readGoroutinesFilterKind(args []string, i int) (GoroutineField, error) { + if i >= len(args) { + return GoroutineFieldNone, fmt.Errorf("%s must be followed by an argument", args[i-1]) + } + + switch args[i] { + case "curloc": + return GoroutineCurrentLoc, nil + case "userloc": + return GoroutineUserLoc, nil + case "goloc": + return GoroutineGoLoc, nil + case "startloc": + return GoroutineStartLoc, nil + case "label": + return GoroutineLabel, nil + case "running": + return GoroutineRunning, nil + case "user": + return GoroutineUser, nil + default: + return GoroutineFieldNone, fmt.Errorf("unrecognized argument to %s %s", args[i-1], args[i]) + } +} + +func readGoroutinesFilter(args []string, pi *int) (*ListGoroutinesFilter, error) { + r := new(ListGoroutinesFilter) + var err error + r.Kind, err = readGoroutinesFilterKind(args, *pi+1) + if err != nil { + return nil, err + } + *pi++ + switch r.Kind { + case GoroutineRunning, GoroutineUser: + return r, nil + } + if *pi+1 >= len(args) { + return nil, fmt.Errorf("%s %s needs to be followed by an expression", args[*pi-1], args[*pi]) + } + r.Arg = args[*pi+1] + *pi++ + + return r, nil +} diff --git a/service/api/conversions.go b/service/api/conversions.go index c22035e177..db7dd50211 100644 --- a/service/api/conversions.go +++ b/service/api/conversions.go @@ -7,7 +7,9 @@ import ( "go/printer" "go/token" "reflect" + "sort" "strconv" + "strings" "github.com/go-delve/delve/pkg/dwarf/godwarf" "github.com/go-delve/delve/pkg/dwarf/op" @@ -18,31 +20,40 @@ import ( // an api.Breakpoint. func ConvertBreakpoint(bp *proc.Breakpoint) *Breakpoint { b := &Breakpoint{ - Name: bp.Name, - ID: bp.LogicalID, - FunctionName: bp.FunctionName, - File: bp.File, - Line: bp.Line, - Addr: bp.Addr, - Tracepoint: bp.Tracepoint, - TraceReturn: bp.TraceReturn, - Stacktrace: bp.Stacktrace, - Goroutine: bp.Goroutine, - Variables: bp.Variables, - LoadArgs: LoadConfigFromProc(bp.LoadArgs), - LoadLocals: LoadConfigFromProc(bp.LoadLocals), - TotalHitCount: bp.TotalHitCount, - Addrs: []uint64{bp.Addr}, - } - - b.HitCount = map[string]uint64{} - for idx := range bp.HitCount { - b.HitCount[strconv.Itoa(idx)] = bp.HitCount[idx] - } - - var buf bytes.Buffer - printer.Fprint(&buf, token.NewFileSet(), bp.Cond) - b.Cond = buf.String() + Name: bp.Name, + ID: bp.LogicalID(), + FunctionName: bp.FunctionName, + File: bp.File, + Line: bp.Line, + Addr: bp.Addr, + Tracepoint: bp.Tracepoint, + TraceReturn: bp.TraceReturn, + Stacktrace: bp.Stacktrace, + Goroutine: bp.Goroutine, + Variables: bp.Variables, + LoadArgs: LoadConfigFromProc(bp.LoadArgs), + LoadLocals: LoadConfigFromProc(bp.LoadLocals), + WatchExpr: bp.WatchExpr, + WatchType: WatchType(bp.WatchType), + Addrs: []uint64{bp.Addr}, + UserData: bp.UserData, + } + + breaklet := bp.UserBreaklet() + if breaklet != nil { + b.TotalHitCount = breaklet.TotalHitCount + b.HitCount = map[string]uint64{} + for idx := range breaklet.HitCount { + b.HitCount[strconv.Itoa(idx)] = breaklet.HitCount[idx] + } + + var buf bytes.Buffer + printer.Fprint(&buf, token.NewFileSet(), breaklet.Cond) + b.Cond = buf.String() + if breaklet.HitCond != nil { + b.HitCond = fmt.Sprintf("%s %d", breaklet.HitCond.Op.String(), breaklet.HitCond.Val) + } + } return b } @@ -55,20 +66,37 @@ func ConvertBreakpoints(bps []*proc.Breakpoint) []*Breakpoint { return nil } r := make([]*Breakpoint, 0, len(bps)) + lg := false for _, bp := range bps { if len(r) > 0 { - if r[len(r)-1].ID == bp.LogicalID { + if r[len(r)-1].ID == bp.LogicalID() { r[len(r)-1].Addrs = append(r[len(r)-1].Addrs, bp.Addr) + if r[len(r)-1].FunctionName != bp.FunctionName && r[len(r)-1].FunctionName != "" { + if !lg { + r[len(r)-1].FunctionName = removeTypeParams(r[len(r)-1].FunctionName) + lg = true + } + fn := removeTypeParams(bp.FunctionName) + if r[len(r)-1].FunctionName != fn { + r[len(r)-1].FunctionName = "(multiple functions)" + } + } continue - } else if r[len(r)-1].ID > bp.LogicalID { + } else if r[len(r)-1].ID > bp.LogicalID() { panic("input not sorted") } } r = append(r, ConvertBreakpoint(bp)) + lg = false } return r } +func removeTypeParams(name string) string { + fn := proc.Function{Name: name} + return fn.NameWithoutTypeParams() +} + // ConvertThread converts a proc.Thread into an // api thread. func ConvertThread(th proc.Thread) *Thread { @@ -109,7 +137,16 @@ func ConvertThread(th proc.Thread) *Thread { } } -func prettyTypeName(typ godwarf.Type) string { +// ConvertThreads converts a slice of proc.Thread into a slice of api.Thread. +func ConvertThreads(threads []proc.Thread) []*Thread { + r := make([]*Thread, len(threads)) + for i := range threads { + r[i] = ConvertThread(threads[i]) + } + return r +} + +func PrettyTypeName(typ godwarf.Type) string { if typ == nil { return "" } @@ -152,29 +189,14 @@ func ConvertVar(v *proc.Variable) *Variable { DeclLine: v.DeclLine, } - r.Type = prettyTypeName(v.DwarfType) - r.RealType = prettyTypeName(v.RealType) + r.Type = PrettyTypeName(v.DwarfType) + r.RealType = PrettyTypeName(v.RealType) if v.Unreadable != nil { r.Unreadable = v.Unreadable.Error() } - if v.Value != nil { - switch v.Kind { - case reflect.Float32: - r.Value = convertFloatValue(v, 32) - case reflect.Float64: - r.Value = convertFloatValue(v, 64) - case reflect.String, reflect.Func: - r.Value = constant.StringVal(v.Value) - default: - if cd := v.ConstDescr(); cd != "" { - r.Value = fmt.Sprintf("%s (%s)", cd, v.Value.String()) - } else { - r.Value = v.Value.String() - } - } - } + r.Value = VariableValueAsString(v) switch v.Kind { case reflect.Complex64: @@ -230,6 +252,38 @@ func ConvertVar(v *proc.Variable) *Variable { return &r } +func VariableValueAsString(v *proc.Variable) string { + if v.Value == nil { + return "" + } + switch v.Kind { + case reflect.Float32: + return convertFloatValue(v, 32) + case reflect.Float64: + return convertFloatValue(v, 64) + case reflect.String, reflect.Func: + return constant.StringVal(v.Value) + default: + if cd := v.ConstDescr(); cd != "" { + return fmt.Sprintf("%s (%s)", cd, v.Value.String()) + } else { + return v.Value.String() + } + } +} + +// ConvertVars converts from []*proc.Variable to []api.Variable. +func ConvertVars(pv []*proc.Variable) []Variable { + if pv == nil { + return nil + } + vars := make([]Variable, 0, len(pv)) + for _, v := range pv { + vars = append(vars, *ConvertVar(v)) + } + return vars +} + // ConvertFunction converts from gosym.Func to // api.Function. func ConvertFunction(fn *proc.Function) *Function { @@ -251,7 +305,7 @@ func ConvertFunction(fn *proc.Function) *Function { } // ConvertGoroutine converts from proc.G to api.Goroutine. -func ConvertGoroutine(g *proc.G) *Goroutine { +func ConvertGoroutine(tgt *proc.Target, g *proc.G) *Goroutine { th := g.Thread tid := 0 if th != nil { @@ -265,12 +319,24 @@ func ConvertGoroutine(g *proc.G) *Goroutine { CurrentLoc: ConvertLocation(g.CurrentLoc), UserCurrentLoc: ConvertLocation(g.UserCurrent()), GoStatementLoc: ConvertLocation(g.Go()), - StartLoc: ConvertLocation(g.StartLoc()), + StartLoc: ConvertLocation(g.StartLoc(tgt)), ThreadID: tid, + WaitSince: g.WaitSince, + WaitReason: g.WaitReason, Labels: g.Labels(), + Status: g.Status, } } +// ConvertGoroutines converts from []*proc.G to []*api.Goroutine. +func ConvertGoroutines(tgt *proc.Target, gs []*proc.G) []*Goroutine { + goroutines := make([]*Goroutine, len(gs)) + for i := range gs { + goroutines[i] = ConvertGoroutine(tgt, gs[i]) + } + return goroutines +} + // ConvertLocation converts from proc.Location to api.Location. func ConvertLocation(loc proc.Location) Location { return Location{ @@ -327,31 +393,74 @@ func LoadConfigFromProc(cfg *proc.LoadConfig) *LoadConfig { } } +var canonicalRegisterOrder = map[string]int{ + // amd64 + "rip": 0, + "rsp": 1, + "rax": 2, + "rbx": 3, + "rcx": 4, + "rdx": 5, + + // arm64 + "pc": 0, + "sp": 1, +} + // ConvertRegisters converts proc.Register to api.Register for a slice. -func ConvertRegisters(in op.DwarfRegisters, arch *proc.Arch, floatingPoint bool) (out []Register) { - if floatingPoint { - in.Reg(^uint64(0)) // force loading all registers - } +func ConvertRegisters(in *op.DwarfRegisters, dwarfRegisterToString func(int, *op.DwarfRegister) (string, bool, string), floatingPoint bool) (out []Register) { out = make([]Register, 0, in.CurrentSize()) for i := 0; i < in.CurrentSize(); i++ { reg := in.Reg(uint64(i)) if reg == nil { continue } - name, fp, repr := arch.DwarfRegisterToString(i, reg) + name, fp, repr := dwarfRegisterToString(i, reg) if !floatingPoint && fp { continue } out = append(out, Register{name, repr, i}) } - return -} + // Sort the registers in a canonical order we prefer, this is mostly + // because the DWARF register numbering for AMD64 is weird. + sort.Slice(out, func(i, j int) bool { + a, b := out[i], out[j] + an, aok := canonicalRegisterOrder[strings.ToLower(a.Name)] + bn, bok := canonicalRegisterOrder[strings.ToLower(b.Name)] + // Registers that don't appear in canonicalRegisterOrder sort after registers that do. + if !aok { + an = 1000 + } + if !bok { + bn = 1000 + } + if an == bn { + // keep registers that don't appear in canonicalRegisterOrder in DWARF order + return a.DwarfNumber < b.DwarfNumber + } + return an < bn -// ConvertCheckpoint converts proc.Chekcpoint to api.Checkpoint. -func ConvertCheckpoint(in proc.Checkpoint) (out Checkpoint) { - return Checkpoint(in) + }) + return } func ConvertImage(image *proc.Image) Image { return Image{Path: image.Path, Address: image.StaticBase} } + +func ConvertDumpState(dumpState *proc.DumpState) *DumpState { + dumpState.Mutex.Lock() + defer dumpState.Mutex.Unlock() + r := &DumpState{ + Dumping: dumpState.Dumping, + AllDone: dumpState.AllDone, + ThreadsDone: dumpState.ThreadsDone, + ThreadsTotal: dumpState.ThreadsTotal, + MemDone: dumpState.MemDone, + MemTotal: dumpState.MemTotal, + } + if dumpState.Err != nil { + r.Err = dumpState.Err.Error() + } + return r +} diff --git a/service/api/prettyprint.go b/service/api/prettyprint.go index 45571def25..02b3ff5065 100644 --- a/service/api/prettyprint.go +++ b/service/api/prettyprint.go @@ -4,6 +4,7 @@ import ( "bytes" "fmt" "io" + "math" "reflect" "strconv" "strings" @@ -20,18 +21,25 @@ const ( // SinglelineString returns a representation of v on a single line. func (v *Variable) SinglelineString() string { var buf bytes.Buffer - v.writeTo(&buf, true, false, true, "") + v.writeTo(&buf, true, false, true, "", "") + return buf.String() +} + +// SinglelineStringFormatted returns a representation of v on a single line, using the format specified by fmtstr. +func (v *Variable) SinglelineStringFormatted(fmtstr string) string { + var buf bytes.Buffer + v.writeTo(&buf, true, false, true, "", fmtstr) return buf.String() } // MultilineString returns a representation of v on multiple lines. -func (v *Variable) MultilineString(indent string) string { +func (v *Variable) MultilineString(indent, fmtstr string) string { var buf bytes.Buffer - v.writeTo(&buf, true, true, true, indent) + v.writeTo(&buf, true, true, true, indent, fmtstr) return buf.String() } -func (v *Variable) writeTo(buf io.Writer, top, newlines, includeType bool, indent string) { +func (v *Variable) writeTo(buf io.Writer, top, newlines, includeType bool, indent, fmtstr string) { if v.Unreadable != "" { fmt.Fprintf(buf, "(unreadable %s)", v.Unreadable) return @@ -48,9 +56,9 @@ func (v *Variable) writeTo(buf io.Writer, top, newlines, includeType bool, inden switch v.Kind { case reflect.Slice: - v.writeSliceTo(buf, newlines, includeType, indent) + v.writeSliceTo(buf, newlines, includeType, indent, fmtstr) case reflect.Array: - v.writeArrayTo(buf, newlines, includeType, indent) + v.writeArrayTo(buf, newlines, includeType, indent, fmtstr) case reflect.Ptr: if v.Type == "" || len(v.Children) == 0 { fmt.Fprint(buf, "nil") @@ -62,7 +70,7 @@ func (v *Variable) writeTo(buf io.Writer, top, newlines, includeType bool, inden } } else { fmt.Fprint(buf, "*") - v.Children[0].writeTo(buf, false, newlines, includeType, indent) + v.Children[0].writeTo(buf, false, newlines, includeType, indent, fmtstr) } case reflect.UnsafePointer: if len(v.Children) == 0 { @@ -70,11 +78,9 @@ func (v *Variable) writeTo(buf io.Writer, top, newlines, includeType bool, inden } else { fmt.Fprintf(buf, "unsafe.Pointer(%#x)", v.Children[0].Addr) } - case reflect.String: - v.writeStringTo(buf) case reflect.Chan: if newlines { - v.writeStructTo(buf, newlines, includeType, indent) + v.writeStructTo(buf, newlines, includeType, indent, fmtstr) } else { if len(v.Children) == 0 { fmt.Fprintf(buf, "%s nil", v.Type) @@ -83,7 +89,7 @@ func (v *Variable) writeTo(buf io.Writer, top, newlines, includeType bool, inden } } case reflect.Struct: - v.writeStructTo(buf, newlines, includeType, indent) + v.writeStructTo(buf, newlines, includeType, indent, fmtstr) case reflect.Interface: if v.Addr == 0 { // an escaped interface variable that points to nil, this shouldn't @@ -111,7 +117,7 @@ func (v *Variable) writeTo(buf io.Writer, top, newlines, includeType bool, inden } else if data.Children[0].OnlyAddr { fmt.Fprintf(buf, "0x%x", v.Children[0].Addr) } else { - v.Children[0].writeTo(buf, false, newlines, !includeType, indent) + v.Children[0].writeTo(buf, false, newlines, !includeType, indent, fmtstr) } } else if data.OnlyAddr { if strings.Contains(v.Type, "/") { @@ -120,36 +126,84 @@ func (v *Variable) writeTo(buf io.Writer, top, newlines, includeType bool, inden fmt.Fprintf(buf, "*(*%s)(%#x)", v.Type, v.Addr) } } else { - v.Children[0].writeTo(buf, false, newlines, !includeType, indent) + v.Children[0].writeTo(buf, false, newlines, !includeType, indent, fmtstr) } case reflect.Map: - v.writeMapTo(buf, newlines, includeType, indent) + v.writeMapTo(buf, newlines, includeType, indent, fmtstr) case reflect.Func: if v.Value == "" { fmt.Fprint(buf, "nil") } else { fmt.Fprintf(buf, "%s", v.Value) } - case reflect.Complex64, reflect.Complex128: - fmt.Fprintf(buf, "(%s + %si)", v.Children[0].Value, v.Children[1].Value) default: - if v.Value != "" { - buf.Write([]byte(v.Value)) - } else { - fmt.Fprintf(buf, "(unknown %s)", v.Kind) - } + v.writeBasicType(buf, fmtstr) } } -func (v *Variable) writeStringTo(buf io.Writer) { - s := v.Value - if len(s) != int(v.Len) { - s = fmt.Sprintf("%s...+%d more", s, int(v.Len)-len(s)) +func (v *Variable) writeBasicType(buf io.Writer, fmtstr string) { + if v.Value == "" && v.Kind != reflect.String { + fmt.Fprintf(buf, "(unknown %s)", v.Kind) + return + } + + switch v.Kind { + case reflect.Bool: + if fmtstr == "" { + buf.Write([]byte(v.Value)) + return + } + var b bool = v.Value == "true" + fmt.Fprintf(buf, fmtstr, b) + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if fmtstr == "" { + buf.Write([]byte(v.Value)) + return + } + n, _ := strconv.ParseInt(v.Value, 10, 64) + fmt.Fprintf(buf, fmtstr, n) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + if fmtstr == "" { + buf.Write([]byte(v.Value)) + return + } + n, _ := strconv.ParseUint(v.Value, 10, 64) + fmt.Fprintf(buf, fmtstr, n) + + case reflect.Float32, reflect.Float64: + if fmtstr == "" { + buf.Write([]byte(v.Value)) + return + } + x, _ := strconv.ParseFloat(v.Value, 64) + fmt.Fprintf(buf, fmtstr, x) + + case reflect.Complex64, reflect.Complex128: + if fmtstr == "" { + fmt.Fprintf(buf, "(%s + %si)", v.Children[0].Value, v.Children[1].Value) + return + } + real, _ := strconv.ParseFloat(v.Children[0].Value, 64) + imag, _ := strconv.ParseFloat(v.Children[1].Value, 64) + var x complex128 = complex(real, imag) + fmt.Fprintf(buf, fmtstr, x) + + case reflect.String: + if fmtstr == "" { + s := v.Value + if len(s) != int(v.Len) { + s = fmt.Sprintf("%s...+%d more", s, int(v.Len)-len(s)) + } + fmt.Fprintf(buf, "%q", s) + return + } + fmt.Fprintf(buf, fmtstr, v.Value) } - fmt.Fprintf(buf, "%q", s) } -func (v *Variable) writeSliceTo(buf io.Writer, newlines, includeType bool, indent string) { +func (v *Variable) writeSliceTo(buf io.Writer, newlines, includeType bool, indent, fmtstr string) { if includeType { fmt.Fprintf(buf, "%s len: %d, cap: %d, ", v.Type, v.Len, v.Cap) } @@ -157,17 +211,17 @@ func (v *Variable) writeSliceTo(buf io.Writer, newlines, includeType bool, inden fmt.Fprintf(buf, "nil") return } - v.writeSliceOrArrayTo(buf, newlines, indent) + v.writeSliceOrArrayTo(buf, newlines, indent, fmtstr) } -func (v *Variable) writeArrayTo(buf io.Writer, newlines, includeType bool, indent string) { +func (v *Variable) writeArrayTo(buf io.Writer, newlines, includeType bool, indent, fmtstr string) { if includeType { fmt.Fprintf(buf, "%s ", v.Type) } - v.writeSliceOrArrayTo(buf, newlines, indent) + v.writeSliceOrArrayTo(buf, newlines, indent, fmtstr) } -func (v *Variable) writeStructTo(buf io.Writer, newlines, includeType bool, indent string) { +func (v *Variable) writeStructTo(buf io.Writer, newlines, includeType bool, indent, fmtstr string) { if int(v.Len) != len(v.Children) && len(v.Children) == 0 { if strings.Contains(v.Type, "/") { fmt.Fprintf(buf, "(*%q)(%#x)", v.Type, v.Addr) @@ -190,7 +244,7 @@ func (v *Variable) writeStructTo(buf io.Writer, newlines, includeType bool, inde fmt.Fprintf(buf, "\n%s%s", indent, indentString) } fmt.Fprintf(buf, "%s: ", v.Children[i].Name) - v.Children[i].writeTo(buf, false, nl, true, indent+indentString) + v.Children[i].writeTo(buf, false, nl, true, indent+indentString, fmtstr) if i != len(v.Children)-1 || nl { fmt.Fprint(buf, ",") if !nl { @@ -211,7 +265,7 @@ func (v *Variable) writeStructTo(buf io.Writer, newlines, includeType bool, inde fmt.Fprint(buf, "}") } -func (v *Variable) writeMapTo(buf io.Writer, newlines, includeType bool, indent string) { +func (v *Variable) writeMapTo(buf io.Writer, newlines, includeType bool, indent, fmtstr string) { if includeType { fmt.Fprintf(buf, "%s ", v.Type) } @@ -232,9 +286,9 @@ func (v *Variable) writeMapTo(buf io.Writer, newlines, includeType bool, indent fmt.Fprintf(buf, "\n%s%s", indent, indentString) } - key.writeTo(buf, false, false, false, indent+indentString) + key.writeTo(buf, false, false, false, indent+indentString, fmtstr) fmt.Fprint(buf, ": ") - value.writeTo(buf, false, nl, false, indent+indentString) + value.writeTo(buf, false, nl, false, indent+indentString, fmtstr) if i != len(v.Children)-1 || nl { fmt.Fprint(buf, ", ") } @@ -326,7 +380,7 @@ func (v *Variable) shouldNewlineStruct(newlines bool) bool { return false } -func (v *Variable) writeSliceOrArrayTo(buf io.Writer, newlines bool, indent string) { +func (v *Variable) writeSliceOrArrayTo(buf io.Writer, newlines bool, indent, fmtstr string) { nl := v.shouldNewlineArray(newlines) fmt.Fprint(buf, "[") @@ -334,7 +388,7 @@ func (v *Variable) writeSliceOrArrayTo(buf io.Writer, newlines bool, indent stri if nl { fmt.Fprintf(buf, "\n%s%s", indent, indentString) } - v.Children[i].writeTo(buf, false, nl, false, indent+indentString) + v.Children[i].writeTo(buf, false, nl, false, indent+indentString, fmtstr) if i != len(v.Children)-1 || nl { fmt.Fprint(buf, ",") } @@ -360,13 +414,19 @@ func (v *Variable) writeSliceOrArrayTo(buf io.Writer, newlines bool, indent stri fmt.Fprint(buf, "]") } -func PrettyExamineMemory(address uintptr, memArea []byte, format byte) string { +// PrettyExamineMemory examine the memory and format data +// +// `format` specifies the data format (or data type), `size` specifies size of each data, +// like 4byte integer, 1byte character, etc. `count` specifies the number of values. +func PrettyExamineMemory(address uintptr, memArea []byte, isLittleEndian bool, format byte, size int) string { var ( cols int colFormat string - addrLen int - addrFmt string + colBytes = size + + addrLen int + addrFmt string ) // Diffrent versions of golang output differently about '#'. @@ -374,24 +434,24 @@ func PrettyExamineMemory(address uintptr, memArea []byte, format byte) string { switch format { case 'b': cols = 4 // Avoid emitting rows that are too long when using binary format - colFormat = "%08b" + colFormat = fmt.Sprintf("%%0%db", colBytes*8) case 'o': cols = 8 - colFormat = "%04o" // Always keep one leading zero for octal. + colFormat = fmt.Sprintf("0%%0%do", colBytes*3) // Always keep one leading zero for octal. case 'd': cols = 8 - colFormat = "%03d" + colFormat = fmt.Sprintf("%%0%dd", colBytes*3) case 'x': cols = 8 - colFormat = "0x%02x" // Always keep one leading '0x' for hex. + colFormat = fmt.Sprintf("0x%%0%dx", colBytes*2) // Always keep one leading '0x' for hex. default: return fmt.Sprintf("not supprted format %q\n", string(format)) } colFormat += "\t" l := len(memArea) - rows := l / cols - if l%cols != 0 { + rows := l / (cols * colBytes) + if l%(cols*colBytes) != 0 { rows++ } @@ -403,14 +463,104 @@ func PrettyExamineMemory(address uintptr, memArea []byte, format byte) string { var b strings.Builder w := tabwriter.NewWriter(&b, 0, 0, 3, ' ', 0) + for i := 0; i < rows; i++ { fmt.Fprintf(w, addrFmt, address) - for j := 0; j < cols && i*cols+j < l; j++ { - fmt.Fprintf(w, colFormat, memArea[i*cols+j]) + + for j := 0; j < cols; j++ { + offset := i*(cols*colBytes) + j*colBytes + if offset+colBytes <= len(memArea) { + n := byteArrayToUInt64(memArea[offset:offset+colBytes], isLittleEndian) + fmt.Fprintf(w, colFormat, n) + } } fmt.Fprintln(w, "") - address += uintptr(cols) + address += uintptr(cols * colBytes) } w.Flush() return b.String() } + +func byteArrayToUInt64(buf []byte, isLittleEndian bool) uint64 { + var n uint64 + if isLittleEndian { + for i := len(buf) - 1; i >= 0; i-- { + n = n<<8 + uint64(buf[i]) + } + } else { + for i := 0; i < len(buf); i++ { + n = n<<8 + uint64(buf[i]) + } + } + return n +} + +const stacktraceTruncatedMessage = "(truncated)" + +func digits(n int) int { + if n <= 0 { + return 1 + } + return int(math.Floor(math.Log10(float64(n)))) + 1 +} + +func PrintStack(formatPath func(string) string, out io.Writer, stack []Stackframe, ind string, offsets bool, include func(Stackframe) bool) { + if len(stack) == 0 { + return + } + + extranl := offsets + for i := range stack { + if extranl { + break + } + extranl = extranl || (len(stack[i].Defers) > 0) || (len(stack[i].Arguments) > 0) || (len(stack[i].Locals) > 0) + } + + d := digits(len(stack) - 1) + fmtstr := "%s%" + strconv.Itoa(d) + "d 0x%016x in %s\n" + s := ind + strings.Repeat(" ", d+2+len(ind)) + + for i := range stack { + if !include(stack[i]) { + continue + } + if stack[i].Err != "" { + fmt.Fprintf(out, "%serror: %s\n", s, stack[i].Err) + continue + } + fmt.Fprintf(out, fmtstr, ind, i, stack[i].PC, stack[i].Function.Name()) + fmt.Fprintf(out, "%sat %s:%d\n", s, formatPath(stack[i].File), stack[i].Line) + + if offsets { + fmt.Fprintf(out, "%sframe: %+#x frame pointer %+#x\n", s, stack[i].FrameOffset, stack[i].FramePointerOffset) + } + + for j, d := range stack[i].Defers { + deferHeader := fmt.Sprintf("%s defer %d: ", s, j+1) + s2 := strings.Repeat(" ", len(deferHeader)) + if d.Unreadable != "" { + fmt.Fprintf(out, "%s(unreadable defer: %s)\n", deferHeader, d.Unreadable) + continue + } + fmt.Fprintf(out, "%s%#016x in %s\n", deferHeader, d.DeferredLoc.PC, d.DeferredLoc.Function.Name()) + fmt.Fprintf(out, "%sat %s:%d\n", s2, formatPath(d.DeferredLoc.File), d.DeferredLoc.Line) + fmt.Fprintf(out, "%sdeferred by %s at %s:%d\n", s2, d.DeferLoc.Function.Name(), formatPath(d.DeferLoc.File), d.DeferLoc.Line) + } + + for j := range stack[i].Arguments { + fmt.Fprintf(out, "%s %s = %s\n", s, stack[i].Arguments[j].Name, stack[i].Arguments[j].SinglelineString()) + } + for j := range stack[i].Locals { + fmt.Fprintf(out, "%s %s = %s\n", s, stack[i].Locals[j].Name, stack[i].Locals[j].SinglelineString()) + } + + if extranl { + fmt.Fprintln(out) + } + } + + if len(stack) > 0 && !stack[len(stack)-1].Bottom { + fmt.Fprintf(out, "%s"+stacktraceTruncatedMessage+"\n", ind) + } +} diff --git a/service/api/prettyprint_test.go b/service/api/prettyprint_test.go index 9ec90686f1..c4070ed14c 100644 --- a/service/api/prettyprint_test.go +++ b/service/api/prettyprint_test.go @@ -2,6 +2,7 @@ package api import ( "fmt" + "math" "strings" "testing" ) @@ -17,7 +18,7 @@ func TestPrettyExamineMemory(t *testing.T) { "0x10007: 0151 0152 0153 0154 0155 0156 0157 0160 ", "0x1000f: 0161 0162 0163 0164 0165 0166 0167 0170 ", "0x10017: 0171 0172"} - res := strings.Split(strings.TrimSpace(PrettyExamineMemory(addr, memArea, format)), "\n") + res := strings.Split(strings.TrimSpace(PrettyExamineMemory(addr, memArea, true, format, 1)), "\n") if len(display) != len(res) { t.Fatalf("wrong lines return, expected %d but got %d", len(display), len(res)) @@ -32,3 +33,27 @@ func TestPrettyExamineMemory(t *testing.T) { } } } + +func Test_byteArrayToUInt64(t *testing.T) { + tests := []struct { + name string + args []byte + want uint64 + }{ + {"case-nil", nil, 0}, + {"case-empty", []byte{}, 0}, + {"case-1", []byte{0x1}, 1}, + {"case-2", []byte{0x12}, 18}, + {"case-3", []byte{0x1, 0x2}, 513}, + {"case-4", []byte{0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x2}, 144397766876004609}, + {"case-5", []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, math.MaxUint64}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := byteArrayToUInt64(tt.args, true) + if got != tt.want { + t.Errorf("byteArrayToUInt64() got = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/service/api/types.go b/service/api/types.go index 31ccbbc5bd..276d66fcab 100644 --- a/service/api/types.go +++ b/service/api/types.go @@ -17,6 +17,8 @@ var ErrNotExecutable = errors.New("not an executable file") // DebuggerState represents the current context of the debugger. type DebuggerState struct { + // PID of the process we are debugging. + Pid int // Running is true if the process is running and no other information can be collected. Running bool // Recording is true if the process is currently being recorded and no other @@ -24,6 +26,8 @@ type DebuggerState struct { // sending a StopRecording request will halt the recording, every other // request will block until the process has been recorded. Recording bool + // Core dumping currently in progress. + CoreDumping bool // CurrentThread is the currently selected debugger thread. CurrentThread *Thread `json:"currentThread,omitempty"` // SelectedGoroutine is the currently selected goroutine @@ -35,6 +39,9 @@ type DebuggerState struct { // While NextInProgress is set further requests for next or step may be rejected. // Either execute continue until NextInProgress is false or call CancelNext NextInProgress bool + // WatchOutOfScope contains the list of watchpoints that went out of scope + // during the last continue. + WatchOutOfScope []*Breakpoint // Exited indicates whether the debugged process has exited. Exited bool `json:"exited"` ExitStatus int `json:"exitStatus"` @@ -44,6 +51,23 @@ type DebuggerState struct { Err error `json:"-"` } +type TracepointResult struct { + // Addr is the address of this tracepoint. + Addr uint64 `json:"addr"` + // File is the source file for the breakpoint. + File string `json:"file"` + // Line is a line in File for the breakpoint. + Line int `json:"line"` + // FunctionName is the name of the function at the current breakpoint, and + // may not always be available. + FunctionName string `json:"functionName,omitempty"` + + GoroutineID int `json:"goroutineID"` + + InputParams []Variable `json:"inputParams,omitempty"` + ReturnParams []Variable `json:"returnParams,omitempty"` +} + // Breakpoint addresses a set of locations at which process execution may be // suspended. type Breakpoint struct { @@ -65,6 +89,9 @@ type Breakpoint struct { // Breakpoint condition Cond string + // Breakpoint hit count condition. + // Supported hit count conditions are "NUMBER" and "OP NUMBER". + HitCond string // Tracepoint flag, signifying this is a tracepoint. Tracepoint bool `json:"continue"` @@ -81,10 +108,21 @@ type Breakpoint struct { LoadArgs *LoadConfig // LoadLocals requests loading function locals when the breakpoint is hit LoadLocals *LoadConfig + + // WatchExpr is the expression used to create this watchpoint + WatchExpr string + WatchType WatchType + + VerboseDescr []string `json:"VerboseDescr,omitempty"` + // number of times a breakpoint has been reached in a certain goroutine HitCount map[string]uint64 `json:"hitCount"` // number of times a breakpoint has been reached TotalHitCount uint64 `json:"totalHitCount"` + // Disabled flag, signifying the state of the breakpoint + Disabled bool `json:"disabled"` + + UserData interface{} `json:"-"` } // ValidBreakpointName returns an error if @@ -105,6 +143,14 @@ func ValidBreakpointName(name string) error { return nil } +// WatchType is the watchpoint type +type WatchType uint8 + +const ( + WatchRead WatchType = 1 << iota + WatchWrite +) + // Thread is a thread within the debugged process. type Thread struct { // ID is a unique identifier for the thread. @@ -128,6 +174,8 @@ type Thread struct { // ReturnValues contains the return values of the function we just stepped out of ReturnValues []Variable + // CallReturn is true if ReturnValues are the return values of an injected call. + CallReturn bool } // Location holds program location information. @@ -233,6 +281,12 @@ const ( // the variable is the return value of a function call and allocated on a // frame that no longer exists) VariableFakeAddress + + // VariableCPrt means the variable is a C pointer + VariableCPtr + + // VariableCPURegister means this variable is a CPU register. + VariableCPURegister ) // Variable describes a variable. @@ -240,7 +294,7 @@ type Variable struct { // Name of the variable or struct member Name string `json:"name"` // Address of the variable or struct member - Addr uintptr `json:"addr"` + Addr uint64 `json:"addr"` // Only the address field is filled (result of evaluating expressions like &) OnlyAddr bool `json:"onlyAddr"` // Go type of the variable @@ -272,7 +326,7 @@ type Variable struct { // Base address of the backing byte array for strings // address of the struct backing chan and map variables // address of the function entry point for function variables (0 for nil function pointers) - Base uintptr `json:"base"` + Base uint64 `json:"base"` // Unreadable addresses will have this field set Unreadable string `json:"unreadable"` @@ -312,11 +366,19 @@ type Goroutine struct { StartLoc Location `json:"startLoc"` // ID of the associated thread for running goroutines ThreadID int `json:"threadID"` + Status uint64 `json:"status"` + WaitSince int64 `json:"waitSince"` + WaitReason int64 `json:"waitReason"` Unreadable string `json:"unreadable"` // Goroutine's pprof labels Labels map[string]string `json:"labels,omitempty"` } +const ( + GoroutineWaiting = proc.Gwaiting + GoroutineSyscall = proc.Gsyscall +) + // DebuggerCommand is a command which changes the debugger's execution state. type DebuggerCommand struct { // Name is the command to run. @@ -394,6 +456,9 @@ const ( // SwitchGoroutine switches the debugger's current thread context to the thread running the specified goroutine SwitchGoroutine = "switchGoroutine" // Halt suspends the process. + // The effect of Halt while the target process is stopped, or in the + // process of stopping, is operating system and timing dependent. It will + // either have no effect or cause the following resume to stop immediately. Halt = "halt" // Call resumes process execution injecting a function call. Call = "call" @@ -528,9 +593,58 @@ const ( StacktraceG ) -// ImportPathToDirectoryPath maps an import path to a directory path. +// PackageBuildInfo maps an import path to a directory path. type PackageBuildInfo struct { ImportPath string DirectoryPath string Files []string } + +// DumpState describes the state of a core dump in progress +type DumpState struct { + Dumping bool + AllDone bool + + ThreadsDone, ThreadsTotal int + MemDone, MemTotal uint64 + + Err string +} + +// ListGoroutinesFilter describes a filtering condition for the +// ListGoroutines API call. +type ListGoroutinesFilter struct { + Kind GoroutineField + Negated bool + Arg string +} + +// GoroutineField allows referring to a field of a goroutine object. +type GoroutineField uint8 + +const ( + GoroutineFieldNone GoroutineField = iota + GoroutineCurrentLoc // the goroutine's CurrentLoc + GoroutineUserLoc // the goroutine's UserLoc + GoroutineGoLoc // the goroutine's GoStatementLoc + GoroutineStartLoc // the goroutine's StartLoc + GoroutineLabel // the goroutine's label + GoroutineRunning // the goroutine is running + GoroutineUser // the goroutine is a user goroutine +) + +// GoroutineGroup represents a group of goroutines in the return value of +// the ListGoroutines API call. +type GoroutineGroup struct { + Name string // name of this group + Offset int // start offset in the list of goroutines of this group + Count int // number of goroutines that belong to this group in the list of goroutines + Total int // total number of goroutines that belong to this group +} + +type GoroutineGroupingOptions struct { + GroupBy GoroutineField + GroupByKey string + MaxGroupMembers int + MaxGroups int +} diff --git a/service/client.go b/service/client.go index 7e6231792d..4920435e10 100644 --- a/service/client.go +++ b/service/client.go @@ -66,12 +66,18 @@ type Client interface { GetBreakpointByName(name string) (*api.Breakpoint, error) // CreateBreakpoint creates a new breakpoint. CreateBreakpoint(*api.Breakpoint) (*api.Breakpoint, error) + // CreateWatchpoint creates a new watchpoint. + CreateWatchpoint(api.EvalScope, string, api.WatchType) (*api.Breakpoint, error) // ListBreakpoints gets all breakpoints. - ListBreakpoints() ([]*api.Breakpoint, error) + ListBreakpoints(bool) ([]*api.Breakpoint, error) // ClearBreakpoint deletes a breakpoint by ID. ClearBreakpoint(id int) (*api.Breakpoint, error) // ClearBreakpointByName deletes a breakpoint by name ClearBreakpointByName(name string) (*api.Breakpoint, error) + // ToggleBreakpoint toggles on or off a breakpoint by ID. + ToggleBreakpoint(id int) (*api.Breakpoint, error) + // ToggleBreakpointByName toggles on or off a breakpoint by name. + ToggleBreakpointByName(name string) (*api.Breakpoint, error) // Allows user to update an existing breakpoint for example to change the information // retrieved when the breakpoint is hit or to change, add or remove the break condition AmendBreakpoint(*api.Breakpoint) error @@ -108,6 +114,8 @@ type Client interface { // ListGoroutines lists all goroutines. ListGoroutines(start, count int) ([]*api.Goroutine, int, error) + // ListGoroutinesWithFilter lists goroutines matching the filters + ListGoroutinesWithFilter(start, count int, filters []api.ListGoroutinesFilter, group *api.GoroutineGroupingOptions) ([]*api.Goroutine, []api.GoroutineGroup, int, bool, error) // Returns stacktrace Stacktrace(goroutineID int, depth int, opts api.StacktraceOptions, cfg *api.LoadConfig) ([]api.Stackframe, error) @@ -130,7 +138,7 @@ type Client interface { // * *
returns the location corresponding to the specified address // NOTE: this function does not actually set breakpoints. // If findInstruction is true FindLocation will only return locations that correspond to instructions. - FindLocation(scope api.EvalScope, loc string, findInstruction bool) ([]api.Location, error) + FindLocation(scope api.EvalScope, loc string, findInstruction bool, substitutePathRules [][2]string) ([]api.Location, error) // Disassemble code between startPC and endPC DisassembleRange(scope api.EvalScope, startPC, endPC uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) @@ -160,11 +168,18 @@ type Client interface { // ExamineMemory returns the raw memory stored at the given address. // The amount of data to be read is specified by length which must be less than or equal to 1000. // This function will return an error if it reads less than `length` bytes. - ExamineMemory(address uintptr, length int) ([]byte, error) + ExamineMemory(address uint64, length int) ([]byte, bool, error) // StopRecording stops a recording if one is in progress. StopRecording() error + // CoreDumpStart starts creating a core dump to the specified file + CoreDumpStart(dest string) (api.DumpState, error) + // CoreDumpWait waits for the core dump to finish, or for the specified amount of milliseconds + CoreDumpWait(msec int) api.DumpState + // CoreDumpCancel cancels a core dump in progress + CoreDumpCancel() error + // Disconnect closes the connection to the server without sending a Detach request first. // If cont is true a continue command will be sent instead. Disconnect(cont bool) error diff --git a/service/dap/command.go b/service/dap/command.go new file mode 100644 index 0000000000..ab318e095e --- /dev/null +++ b/service/dap/command.go @@ -0,0 +1,160 @@ +package dap + +import ( + "bytes" + "errors" + "fmt" + "sort" + "strings" + + "github.com/go-delve/delve/pkg/config" + "github.com/google/go-dap" +) + +func (s *Session) delveCmd(goid, frame int, cmdstr string) (string, error) { + vals := strings.SplitN(strings.TrimSpace(cmdstr), " ", 2) + cmdname := vals[0] + var args string + if len(vals) > 1 { + args = strings.TrimSpace(vals[1]) + } + for _, cmd := range debugCommands(s) { + for _, alias := range cmd.aliases { + if alias == cmdname { + return cmd.cmdFn(goid, frame, args) + } + } + } + return "", errNoCmd +} + +type cmdfunc func(goid, frame int, args string) (string, error) + +type command struct { + aliases []string + helpMsg string + cmdFn cmdfunc +} + +const ( + msgHelp = `Prints the help message. + +dlv help [command] + +Type "help" followed by the name of a command for more information about it.` + + msgConfig = `Changes configuration parameters. + + dlv config -list + + Show all configuration parameters. + + config -list + + Show value of a configuration parameter. + + dlv config + + Changes the value of a configuration parameter. + + dlv config substitutePath + dlv config substitutePath + + Adds or removes a path substitution rule.` + msgSources = `Print list of source files. + + dlv sources [] + +If regex is specified only the source files matching it will be returned.` +) + +// debugCommands returns a list of commands with default commands defined. +func debugCommands(s *Session) []command { + return []command{ + {aliases: []string{"help", "h"}, cmdFn: s.helpMessage, helpMsg: msgHelp}, + {aliases: []string{"config"}, cmdFn: s.evaluateConfig, helpMsg: msgConfig}, + {aliases: []string{"sources", "s"}, cmdFn: s.sources, helpMsg: msgSources}, + } +} + +var errNoCmd = errors.New("command not available") + +func (s *Session) helpMessage(_, _ int, args string) (string, error) { + var buf bytes.Buffer + if args != "" { + for _, cmd := range debugCommands(s) { + for _, alias := range cmd.aliases { + if alias == args { + return cmd.helpMsg, nil + } + } + } + return "", errNoCmd + } + + fmt.Fprintln(&buf, "The following commands are available:") + + for _, cmd := range debugCommands(s) { + h := cmd.helpMsg + if idx := strings.Index(h, "\n"); idx >= 0 { + h = h[:idx] + } + if len(cmd.aliases) > 1 { + fmt.Fprintf(&buf, " dlv %s (alias: %s) \t %s\n", cmd.aliases[0], strings.Join(cmd.aliases[1:], " | "), h) + } else { + fmt.Fprintf(&buf, " dlv %s \t %s\n", cmd.aliases[0], h) + } + } + + fmt.Fprintln(&buf) + fmt.Fprintln(&buf, "Type 'dlv help' followed by a command for full documentation.") + return buf.String(), nil +} + +func (s *Session) evaluateConfig(_, _ int, expr string) (string, error) { + argv := config.Split2PartsBySpace(expr) + name := argv[0] + if name == "-list" { + if len(argv) > 1 { + return config.ConfigureListByName(&s.args, argv[1], "cfgName"), nil + } + return listConfig(&s.args), nil + } + updated, res, err := configureSet(&s.args, expr) + if err != nil { + return "", err + } + + if updated { + // Send invalidated events for areas that are affected by configuration changes. + switch name { + case "showGlobalVariables", "showRegisters": + // Variable data has become invalidated. + s.send(&dap.InvalidatedEvent{ + Event: *newEvent("invalidated"), + Body: dap.InvalidatedEventBody{ + Areas: []dap.InvalidatedAreas{"variables"}, + }, + }) + case "goroutineFilters", "hideSystemGoroutines": + // Thread related data has become invalidated. + s.send(&dap.InvalidatedEvent{ + Event: *newEvent("invalidated"), + Body: dap.InvalidatedEventBody{ + Areas: []dap.InvalidatedAreas{"threads"}, + }, + }) + } + res += "\nUpdated" + } + return res, nil +} + +func (s *Session) sources(_, _ int, filter string) (string, error) { + sources, err := s.debugger.Sources(filter) + if err != nil { + return "", err + } + sort.Strings(sources) + return strings.Join(sources, "\n"), nil +} diff --git a/service/dap/config.go b/service/dap/config.go new file mode 100644 index 0000000000..3a13c12d1b --- /dev/null +++ b/service/dap/config.go @@ -0,0 +1,75 @@ +package dap + +import ( + "bytes" + "fmt" + + "github.com/go-delve/delve/pkg/config" +) + +func listConfig(args *launchAttachArgs) string { + var buf bytes.Buffer + config.ConfigureList(&buf, args, "cfgName") + return buf.String() +} + +func configureSet(sargs *launchAttachArgs, args string) (bool, string, error) { + v := config.Split2PartsBySpace(args) + + cfgname := v[0] + var rest string + if len(v) == 2 { + rest = v[1] + } + + field := config.ConfigureFindFieldByName(sargs, cfgname, "cfgName") + if !field.CanAddr() { + return false, "", fmt.Errorf("%q is not a configuration parameter", cfgname) + } + + if cfgname == "substitutePath" { + err := configureSetSubstitutePath(sargs, rest) + if err != nil { + return false, "", err + } + // Print the updated client to server and server to client maps. + return true, config.ConfigureListByName(sargs, cfgname, "cfgName"), nil + } + + err := config.ConfigureSetSimple(rest, cfgname, field) + if err != nil { + return false, "", err + } + return true, config.ConfigureListByName(sargs, cfgname, "cfgName"), nil +} + +func configureSetSubstitutePath(args *launchAttachArgs, rest string) error { + argv := config.SplitQuotedFields(rest, '"') + switch len(argv) { + case 1: // delete substitute-path rule + for i := range args.substitutePathClientToServer { + if args.substitutePathClientToServer[i][0] == argv[0] { + copy(args.substitutePathClientToServer[i:], args.substitutePathClientToServer[i+1:]) + args.substitutePathClientToServer = args.substitutePathClientToServer[:len(args.substitutePathClientToServer)-1] + copy(args.substitutePathServerToClient[i:], args.substitutePathServerToClient[i+1:]) + args.substitutePathServerToClient = args.substitutePathServerToClient[:len(args.substitutePathServerToClient)-1] + return nil + } + } + return fmt.Errorf("could not find rule for %q", argv[0]) + case 2: // add substitute-path rule + for i := range args.substitutePathClientToServer { + if args.substitutePathClientToServer[i][0] == argv[0] { + args.substitutePathClientToServer[i][1] = argv[1] + args.substitutePathServerToClient[i][0] = argv[1] + return nil + } + } + args.substitutePathClientToServer = append(args.substitutePathClientToServer, [2]string{argv[0], argv[1]}) + args.substitutePathServerToClient = append(args.substitutePathServerToClient, [2]string{argv[1], argv[0]}) + + default: + return fmt.Errorf("too many arguments to \"config substitute-path\"") + } + return nil +} diff --git a/service/dap/config_test.go b/service/dap/config_test.go new file mode 100644 index 0000000000..225d05dd5d --- /dev/null +++ b/service/dap/config_test.go @@ -0,0 +1,197 @@ +package dap + +import ( + "testing" +) + +func TestListConfig(t *testing.T) { + type args struct { + args *launchAttachArgs + } + tests := []struct { + name string + args args + want string + }{ + { + name: "empty", + args: args{ + args: &launchAttachArgs{}, + }, + want: formatConfig(0, false, false, "", false, [][2]string{}), + }, + { + name: "default values", + args: args{ + args: &defaultArgs, + }, + want: formatConfig(50, false, false, "", false, [][2]string{}), + }, + { + name: "custom values", + args: args{ + args: &launchAttachArgs{ + StackTraceDepth: 35, + ShowGlobalVariables: true, + substitutePathClientToServer: [][2]string{{"hello", "world"}}, + substitutePathServerToClient: [][2]string{{"world", "hello"}}, + }, + }, + want: formatConfig(35, true, false, "", false, [][2]string{{"hello", "world"}}), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := listConfig(tt.args.args); got != tt.want { + t.Errorf("listConfig() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestConfigureSetSubstitutePath(t *testing.T) { + type args struct { + args *launchAttachArgs + rest string + } + tests := []struct { + name string + args args + wantRules [][2]string + wantErr bool + }{ + // Test add rule. + { + name: "add rule", + args: args{ + args: &launchAttachArgs{ + substitutePathClientToServer: [][2]string{}, + substitutePathServerToClient: [][2]string{}, + }, + rest: "/path/to/client/dir /path/to/server/dir", + }, + wantRules: [][2]string{{"/path/to/client/dir", "/path/to/server/dir"}}, + wantErr: false, + }, + { + name: "add rule (multiple)", + args: args{ + args: &launchAttachArgs{ + substitutePathClientToServer: [][2]string{ + {"/path/to/client/dir/a", "/path/to/server/dir/a"}, + {"/path/to/client/dir/b", "/path/to/server/dir/b"}, + }, + substitutePathServerToClient: [][2]string{ + {"/path/to/server/dir/a", "/path/to/client/dir/a"}, + {"/path/to/server/dir/b", "/path/to/client/dir/b"}, + }, + }, + rest: "/path/to/client/dir/c /path/to/server/dir/b", + }, + wantRules: [][2]string{ + {"/path/to/client/dir/a", "/path/to/server/dir/a"}, + {"/path/to/client/dir/b", "/path/to/server/dir/b"}, + {"/path/to/client/dir/c", "/path/to/server/dir/b"}, + }, + wantErr: false, + }, + // Test modify rule. + { + name: "modify rule", + args: args{ + args: &launchAttachArgs{ + substitutePathClientToServer: [][2]string{{"/path/to/client/dir", "/path/to/server/dir"}}, + substitutePathServerToClient: [][2]string{{"/path/to/server/dir", "/path/to/client/dir"}}, + }, + rest: "/path/to/client/dir /new/path/to/server/dir", + }, + wantRules: [][2]string{{"/path/to/client/dir", "/new/path/to/server/dir"}}, + wantErr: false, + }, + { + name: "modify rule (multiple)", + args: args{ + args: &launchAttachArgs{ + substitutePathClientToServer: [][2]string{ + {"/path/to/client/dir/a", "/path/to/server/dir/a"}, + {"/path/to/client/dir/b", "/path/to/server/dir/b"}, + {"/path/to/client/dir/c", "/path/to/server/dir/b"}, + }, + substitutePathServerToClient: [][2]string{ + {"/path/to/server/dir/a", "/path/to/client/dir/a"}, + {"/path/to/server/dir/b", "/path/to/client/dir/b"}, + {"/path/to/server/dir/b", "/path/to/client/dir/c"}, + }, + }, + rest: "/path/to/client/dir/b /new/path", + }, + wantRules: [][2]string{ + {"/path/to/client/dir/a", "/path/to/server/dir/a"}, + {"/path/to/client/dir/b", "/new/path"}, + {"/path/to/client/dir/c", "/path/to/server/dir/b"}, + }, + wantErr: false, + }, + // Test delete rule. + { + name: "delete rule", + args: args{ + args: &launchAttachArgs{ + substitutePathClientToServer: [][2]string{{"/path/to/client/dir", "/path/to/server/dir"}}, + substitutePathServerToClient: [][2]string{{"/path/to/server/dir", "/path/to/client/dir"}}, + }, + rest: "/path/to/client/dir", + }, + wantRules: [][2]string{}, + wantErr: false, + }, + // Test invalid input. + { + name: "error on empty args", + args: args{ + args: &launchAttachArgs{ + substitutePathClientToServer: [][2]string{}, + substitutePathServerToClient: [][2]string{}, + }, + rest: " \n\r ", + }, + wantErr: true, + }, + { + name: "error on delete nonexistent rule", + args: args{ + args: &launchAttachArgs{ + substitutePathClientToServer: [][2]string{{"/path/to/client/dir", "/path/to/server/dir"}}, + substitutePathServerToClient: [][2]string{{"/path/to/server/dir", "/path/to/client/dir"}}, + }, + rest: "/path/to/server/dir", + }, + wantRules: [][2]string{{"/path/to/client/dir", "/path/to/server/dir"}}, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := configureSetSubstitutePath(tt.args.args, tt.args.rest) + if (err != nil) != tt.wantErr { + t.Errorf("configureSetSubstitutePath() error = %v, wantErr %v", err, tt.wantErr) + return + } + if len(tt.args.args.substitutePathClientToServer) != len(tt.wantRules) { + t.Errorf("configureSetSubstitutePath() got substitutePathClientToServer=%v, want %d rules", tt.args.args.substitutePathClientToServer, len(tt.wantRules)) + return + } + gotClient2Server := tt.args.args.substitutePathClientToServer + gotServer2Client := tt.args.args.substitutePathServerToClient + for i, rule := range tt.wantRules { + if gotClient2Server[i][0] != rule[0] || gotClient2Server[i][1] != rule[1] { + t.Errorf("configureSetSubstitutePath() got substitutePathClientToServer[%d]=%#v,\n want %#v rules", i, gotClient2Server[i], rule) + } + if gotServer2Client[i][1] != rule[0] || gotServer2Client[i][0] != rule[1] { + reverseRule := [2]string{rule[1], rule[0]} + t.Errorf("configureSetSubstitutePath() got substitutePathServerToClient[%d]=%#v,\n want %#v rules", i, gotClient2Server[i], reverseRule) + } + } + }) + } +} diff --git a/service/dap/daptest/client.go b/service/dap/daptest/client.go index e06cddbb6e..42a623ca7f 100644 --- a/service/dap/daptest/client.go +++ b/service/dap/daptest/client.go @@ -2,12 +2,17 @@ // for DAP mode testing. package daptest +//go:generate go run ./gen/main.go -o ./resp.go + import ( "bufio" + "encoding/json" "fmt" "log" "net" "path/filepath" + "reflect" + "regexp" "testing" "github.com/google/go-dap" @@ -32,6 +37,12 @@ func NewClient(addr string) *Client { if err != nil { log.Fatal("dialing:", err) } + return NewClientFromConn(conn) +} + +// NewClientFromConn creates a new Client with the given TCP connection. +// Call Close to close the connection. +func NewClientFromConn(conn net.Conn) *Client { c := &Client{conn: conn, reader: bufio.NewReader(conn)} c.seq = 1 // match VS Code numbering return c @@ -50,231 +61,144 @@ func (c *Client) ReadMessage() (dap.Message, error) { return dap.ReadProtocolMessage(c.reader) } -func (c *Client) expectReadProtocolMessage(t *testing.T) dap.Message { +func (c *Client) ExpectMessage(t *testing.T) dap.Message { t.Helper() m, err := dap.ReadProtocolMessage(c.reader) if err != nil { - t.Error(err) + t.Fatal(err) } return m } -func (c *Client) ExpectErrorResponse(t *testing.T) *dap.ErrorResponse { +func (c *Client) ExpectInvisibleErrorResponse(t *testing.T) *dap.ErrorResponse { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ErrorResponse) -} - -func (c *Client) expectErrorResponse(t *testing.T, id int, message string) *dap.ErrorResponse { - t.Helper() - er := c.expectReadProtocolMessage(t).(*dap.ErrorResponse) - if er.Body.Error.Id != id || er.Message != message { - t.Errorf("\ngot %#v\nwant Id=%d Message=%q", er, id, message) + er := c.ExpectErrorResponse(t) + if er.Body.Error.ShowUser { + t.Errorf("\ngot %#v\nwant ShowUser=false", er) } return er } -func (c *Client) ExpectNotYetImplementedErrorResponse(t *testing.T) *dap.ErrorResponse { - t.Helper() - return c.expectErrorResponse(t, 7777, "Not yet implemented") -} - -func (c *Client) ExpectUnsupportedCommandErrorResponse(t *testing.T) *dap.ErrorResponse { - t.Helper() - return c.expectErrorResponse(t, 9999, "Unsupported command") -} - -func (c *Client) ExpectDisconnectResponse(t *testing.T) *dap.DisconnectResponse { +func (c *Client) ExpectVisibleErrorResponse(t *testing.T) *dap.ErrorResponse { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.DisconnectResponse) -} - -func (c *Client) ExpectContinueResponse(t *testing.T) *dap.ContinueResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ContinueResponse) -} - -func (c *Client) ExpectNextResponse(t *testing.T) *dap.NextResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.NextResponse) -} - -func (c *Client) ExpectStepInResponse(t *testing.T) *dap.StepInResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.StepInResponse) -} - -func (c *Client) ExpectStepOutResponse(t *testing.T) *dap.StepOutResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.StepOutResponse) + er := c.ExpectErrorResponse(t) + if !er.Body.Error.ShowUser { + t.Errorf("\ngot %#v\nwant ShowUser=true", er) + } + return er } -func (c *Client) ExpectTerminatedEvent(t *testing.T) *dap.TerminatedEvent { +func (c *Client) ExpectErrorResponseWith(t *testing.T, id int, message string, showUser bool) *dap.ErrorResponse { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.TerminatedEvent) + er := c.ExpectErrorResponse(t) + if matched, _ := regexp.MatchString(message, er.Body.Error.Format); !matched || er.Body.Error.Id != id || er.Body.Error.ShowUser != showUser { + t.Errorf("got %#v, want Id=%d Format=%q ShowUser=%v", er, id, message, showUser) + } + return er } -func (c *Client) ExpectInitializeResponse(t *testing.T) *dap.InitializeResponse { - t.Helper() - initResp := c.expectReadProtocolMessage(t).(*dap.InitializeResponse) - if !initResp.Body.SupportsConfigurationDoneRequest { - t.Errorf("got %#v, want SupportsConfigurationDoneRequest=true", initResp) +func (c *Client) ExpectInitializeResponseAndCapabilities(t *testing.T) *dap.InitializeResponse { + t.Helper() + initResp := c.ExpectInitializeResponse(t) + wantCapabilities := dap.Capabilities{ + // the values set by dap.(*Server).onInitializeRequest. + SupportsConfigurationDoneRequest: true, + SupportsConditionalBreakpoints: true, + SupportsDelayedStackTraceLoading: true, + SupportTerminateDebuggee: true, + SupportsExceptionInfoRequest: true, + SupportsSetVariable: true, + SupportsFunctionBreakpoints: true, + SupportsInstructionBreakpoints: true, + SupportsEvaluateForHovers: true, + SupportsClipboardContext: true, + SupportsSteppingGranularity: true, + SupportsLogPoints: true, + SupportsDisassembleRequest: true, + } + if !reflect.DeepEqual(initResp.Body, wantCapabilities) { + t.Errorf("capabilities in initializeResponse: got %+v, want %v", pretty(initResp.Body), pretty(wantCapabilities)) } return initResp } -func (c *Client) ExpectInitializedEvent(t *testing.T) *dap.InitializedEvent { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.InitializedEvent) -} - -func (c *Client) ExpectLaunchResponse(t *testing.T) *dap.LaunchResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.LaunchResponse) -} - -func (c *Client) ExpectSetExceptionBreakpointsResponse(t *testing.T) *dap.SetExceptionBreakpointsResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.SetExceptionBreakpointsResponse) -} - -func (c *Client) ExpectSetBreakpointsResponse(t *testing.T) *dap.SetBreakpointsResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.SetBreakpointsResponse) -} - -func (c *Client) ExpectStoppedEvent(t *testing.T) *dap.StoppedEvent { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.StoppedEvent) +func pretty(v interface{}) string { + s, _ := json.MarshalIndent(v, "", "\t") + return string(s) } -func (c *Client) ExpectOutputEvent(t *testing.T) *dap.OutputEvent { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.OutputEvent) -} - -func (c *Client) ExpectConfigurationDoneResponse(t *testing.T) *dap.ConfigurationDoneResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ConfigurationDoneResponse) -} - -func (c *Client) ExpectThreadsResponse(t *testing.T) *dap.ThreadsResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ThreadsResponse) -} - -func (c *Client) ExpectStackTraceResponse(t *testing.T) *dap.StackTraceResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.StackTraceResponse) -} - -func (c *Client) ExpectScopesResponse(t *testing.T) *dap.ScopesResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ScopesResponse) -} - -func (c *Client) ExpectVariablesResponse(t *testing.T) *dap.VariablesResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.VariablesResponse) -} - -func (c *Client) ExpectTerminateResponse(t *testing.T) *dap.TerminateResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.TerminateResponse) -} - -func (c *Client) ExpectRestartResponse(t *testing.T) *dap.RestartResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.RestartResponse) -} - -func (c *Client) ExpectSetFunctionBreakpointsResponse(t *testing.T) *dap.SetFunctionBreakpointsResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.SetFunctionBreakpointsResponse) -} - -func (c *Client) ExpectStepBackResponse(t *testing.T) *dap.StepBackResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.StepBackResponse) -} - -func (c *Client) ExpectReverseContinueResponse(t *testing.T) *dap.ReverseContinueResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ReverseContinueResponse) -} - -func (c *Client) ExpectRestartFrameResponse(t *testing.T) *dap.RestartFrameResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.RestartFrameResponse) -} - -func (c *Client) ExpectSetExpressionResponse(t *testing.T) *dap.SetExpressionResponse { +func (c *Client) ExpectNotYetImplementedErrorResponse(t *testing.T) *dap.ErrorResponse { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.SetExpressionResponse) + return c.ExpectErrorResponseWith(t, 7777, "Not yet implemented", false) } -func (c *Client) ExpectTerminateThreadsResponse(t *testing.T) *dap.TerminateThreadsResponse { +func (c *Client) ExpectUnsupportedCommandErrorResponse(t *testing.T) *dap.ErrorResponse { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.TerminateThreadsResponse) + return c.ExpectErrorResponseWith(t, 9999, "Unsupported command", false) } -func (c *Client) ExpectStepInTargetsResponse(t *testing.T) *dap.StepInTargetsResponse { +func (c *Client) ExpectOutputEventRegex(t *testing.T, want string) *dap.OutputEvent { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.StepInTargetsResponse) + e := c.ExpectOutputEvent(t) + if matched, _ := regexp.MatchString(want, e.Body.Output); !matched { + t.Errorf("\ngot %#v\nwant Output=%q", e, want) + } + return e } -func (c *Client) ExpectGotoTargetsResponse(t *testing.T) *dap.GotoTargetsResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.GotoTargetsResponse) -} +const ProcessExited = `Process [0-9]+ has exited with status %s\n` -func (c *Client) ExpectCompletionsResponse(t *testing.T) *dap.CompletionsResponse { +func (c *Client) ExpectOutputEventProcessExited(t *testing.T, status int) *dap.OutputEvent { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.CompletionsResponse) + return c.ExpectOutputEventRegex(t, fmt.Sprintf(ProcessExited, fmt.Sprintf("%d", status))) } -func (c *Client) ExpectExceptionInfoResponse(t *testing.T) *dap.ExceptionInfoResponse { +func (c *Client) ExpectOutputEventProcessExitedAnyStatus(t *testing.T) *dap.OutputEvent { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ExceptionInfoResponse) + return c.ExpectOutputEventRegex(t, fmt.Sprintf(ProcessExited, `-?\d+`)) } -func (c *Client) ExpectLoadedSourcesResponse(t *testing.T) *dap.LoadedSourcesResponse { +func (c *Client) ExpectOutputEventDetaching(t *testing.T) *dap.OutputEvent { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.LoadedSourcesResponse) + return c.ExpectOutputEventRegex(t, `Detaching\n`) } -func (c *Client) ExpectDataBreakpointInfoResponse(t *testing.T) *dap.DataBreakpointInfoResponse { +func (c *Client) ExpectOutputEventDetachingKill(t *testing.T) *dap.OutputEvent { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.DataBreakpointInfoResponse) + return c.ExpectOutputEventRegex(t, `Detaching and terminating target process\n`) } -func (c *Client) ExpectSetDataBreakpointsResponse(t *testing.T) *dap.SetDataBreakpointsResponse { +func (c *Client) ExpectOutputEventDetachingNoKill(t *testing.T) *dap.OutputEvent { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.SetDataBreakpointsResponse) + return c.ExpectOutputEventRegex(t, `Detaching without terminating target process\n`) } -func (c *Client) ExpectReadMemoryResponse(t *testing.T) *dap.ReadMemoryResponse { +func (c *Client) ExpectOutputEventTerminating(t *testing.T) *dap.OutputEvent { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ReadMemoryResponse) + return c.ExpectOutputEventRegex(t, `Terminating process [0-9]+\n`) } -func (c *Client) ExpectDisassembleResponse(t *testing.T) *dap.DisassembleResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.DisassembleResponse) -} +const ClosingClient = "Closing client session, but leaving multi-client DAP server at .+:[0-9]+ with debuggee %s\n" -func (c *Client) ExpectCancelResponse(t *testing.T) *dap.CancelResponse { +func (c *Client) ExpectOutputEventClosingClient(t *testing.T, status string) *dap.OutputEvent { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.CancelResponse) + return c.ExpectOutputEventRegex(t, fmt.Sprintf(ClosingClient, status)) } -func (c *Client) ExpectBreakpointLocationsResponse(t *testing.T) *dap.BreakpointLocationsResponse { +func (c *Client) CheckStopLocation(t *testing.T, thread int, name string, line int) { t.Helper() - return c.expectReadProtocolMessage(t).(*dap.BreakpointLocationsResponse) -} - -func (c *Client) ExpectModulesResponse(t *testing.T) *dap.ModulesResponse { - t.Helper() - return c.expectReadProtocolMessage(t).(*dap.ModulesResponse) + c.StackTraceRequest(thread, 0, 20) + st := c.ExpectStackTraceResponse(t) + if len(st.Body.StackFrames) < 1 { + t.Errorf("\ngot %#v\nwant len(stackframes) => 1", st) + } else { + if line != -1 && st.Body.StackFrames[0].Line != line { + t.Errorf("\ngot %#v\nwant Line=%d", st, line) + } + if st.Body.StackFrames[0].Name != name { + t.Errorf("\ngot %#v\nwant Name=%q", st, name) + } + } } // InitializeRequest sends an 'initialize' request. @@ -293,15 +217,27 @@ func (c *Client) InitializeRequest() { c.send(request) } +// InitializeRequestWithArgs sends an 'initialize' request with specified arguments. +func (c *Client) InitializeRequestWithArgs(args dap.InitializeRequestArguments) { + request := &dap.InitializeRequest{Request: *c.newRequest("initialize")} + request.Arguments = args + c.send(request) +} + +func toRawMessage(in interface{}) json.RawMessage { + out, _ := json.Marshal(in) + return out +} + // LaunchRequest sends a 'launch' request with the specified args. -func (c *Client) LaunchRequest(mode string, program string, stopOnEntry bool) { +func (c *Client) LaunchRequest(mode, program string, stopOnEntry bool) { request := &dap.LaunchRequest{Request: *c.newRequest("launch")} - request.Arguments = map[string]interface{}{ + request.Arguments = toRawMessage(map[string]interface{}{ "request": "launch", "mode": mode, "program": program, "stopOnEntry": stopOnEntry, - } + }) c.send(request) } @@ -310,14 +246,15 @@ func (c *Client) LaunchRequest(mode string, program string, stopOnEntry bool) { // test for values of unexpected types or unspecified values. func (c *Client) LaunchRequestWithArgs(arguments map[string]interface{}) { request := &dap.LaunchRequest{Request: *c.newRequest("launch")} - request.Arguments = arguments + request.Arguments = toRawMessage(arguments) c.send(request) } -// AttachRequest sends an 'attach' request. -func (c *Client) AttachRequest() { +// AttachRequest sends an 'attach' request with the specified +// arguments. +func (c *Client) AttachRequest(arguments map[string]interface{}) { request := &dap.AttachRequest{Request: *c.newRequest("attach")} - // TODO(polina): populate meaningful arguments + request.Arguments = toRawMessage(arguments) c.send(request) } @@ -327,8 +264,22 @@ func (c *Client) DisconnectRequest() { c.send(request) } +// DisconnectRequestWithKillOption sends a 'disconnect' request with an option to specify +// `terminateDebuggee`. +func (c *Client) DisconnectRequestWithKillOption(kill bool) { + request := &dap.DisconnectRequest{Request: *c.newRequest("disconnect")} + request.Arguments.TerminateDebuggee = kill + c.send(request) +} + // SetBreakpointsRequest sends a 'setBreakpoints' request. func (c *Client) SetBreakpointsRequest(file string, lines []int) { + c.SetBreakpointsRequestWithArgs(file, lines, nil, nil, nil) +} + +// SetBreakpointsRequestWithArgs sends a 'setBreakpoints' request with an option to +// specify conditions, hit conditions, and log messages. +func (c *Client) SetBreakpointsRequestWithArgs(file string, lines []int, conditions, hitConditions, logMessages map[int]string) { request := &dap.SetBreakpointsRequest{Request: *c.newRequest("setBreakpoints")} request.Arguments = dap.SetBreakpointsArguments{ Source: dap.Source{ @@ -336,10 +287,18 @@ func (c *Client) SetBreakpointsRequest(file string, lines []int) { Path: file, }, Breakpoints: make([]dap.SourceBreakpoint, len(lines)), - //sourceModified: false, } for i, l := range lines { request.Arguments.Breakpoints[i].Line = l + if cond, ok := conditions[l]; ok { + request.Arguments.Breakpoints[i].Condition = cond + } + if hitCond, ok := hitConditions[l]; ok { + request.Arguments.Breakpoints[i].HitCondition = hitCond + } + if logMessage, ok := logMessages[l]; ok { + request.Arguments.Breakpoints[i].LogMessage = logMessage + } } c.send(request) } @@ -370,24 +329,48 @@ func (c *Client) NextRequest(thread int) { c.send(request) } +// NextInstructionRequest sends a 'next' request with granularity 'instruction'. +func (c *Client) NextInstructionRequest(thread int) { + request := &dap.NextRequest{Request: *c.newRequest("next")} + request.Arguments.ThreadId = thread + request.Arguments.Granularity = "instruction" + c.send(request) +} + // StepInRequest sends a 'stepIn' request. func (c *Client) StepInRequest(thread int) { - request := &dap.NextRequest{Request: *c.newRequest("stepIn")} + request := &dap.StepInRequest{Request: *c.newRequest("stepIn")} + request.Arguments.ThreadId = thread + c.send(request) +} + +// StepInInstructionRequest sends a 'stepIn' request with granularity 'instruction'. +func (c *Client) StepInInstructionRequest(thread int) { + request := &dap.StepInRequest{Request: *c.newRequest("stepIn")} request.Arguments.ThreadId = thread + request.Arguments.Granularity = "instruction" c.send(request) } // StepOutRequest sends a 'stepOut' request. func (c *Client) StepOutRequest(thread int) { - request := &dap.NextRequest{Request: *c.newRequest("stepOut")} + request := &dap.StepOutRequest{Request: *c.newRequest("stepOut")} request.Arguments.ThreadId = thread c.send(request) } +// StepOutInstructionRequest sends a 'stepOut' request with granularity 'instruction'. +func (c *Client) StepOutInstructionRequest(thread int) { + request := &dap.StepOutRequest{Request: *c.newRequest("stepOut")} + request.Arguments.ThreadId = thread + request.Arguments.Granularity = "instruction" + c.send(request) +} + // PauseRequest sends a 'pause' request. -func (c *Client) PauseRequest() { - request := &dap.NextRequest{Request: *c.newRequest("pause")} - // TODO(polina): arguments +func (c *Client) PauseRequest(threadId int) { + request := &dap.PauseRequest{Request: *c.newRequest("pause")} + request.Arguments.ThreadId = threadId c.send(request) } @@ -420,7 +403,25 @@ func (c *Client) VariablesRequest(variablesReference int) { c.send(request) } -// TeriminateRequest sends a 'terminate' request. +// IndexedVariablesRequest sends a 'variables' request. +func (c *Client) IndexedVariablesRequest(variablesReference, start, count int) { + request := &dap.VariablesRequest{Request: *c.newRequest("variables")} + request.Arguments.VariablesReference = variablesReference + request.Arguments.Filter = "indexed" + request.Arguments.Start = start + request.Arguments.Count = count + c.send(request) +} + +// NamedVariablesRequest sends a 'variables' request. +func (c *Client) NamedVariablesRequest(variablesReference int) { + request := &dap.VariablesRequest{Request: *c.newRequest("variables")} + request.Arguments.VariablesReference = variablesReference + request.Arguments.Filter = "named" + c.send(request) +} + +// TerminateRequest sends a 'terminate' request. func (c *Client) TerminateRequest() { c.send(&dap.TerminateRequest{Request: *c.newRequest("terminate")}) } @@ -431,8 +432,23 @@ func (c *Client) RestartRequest() { } // SetFunctionBreakpointsRequest sends a 'setFunctionBreakpoints' request. -func (c *Client) SetFunctionBreakpointsRequest() { - c.send(&dap.SetFunctionBreakpointsRequest{Request: *c.newRequest("setFunctionBreakpoints")}) +func (c *Client) SetFunctionBreakpointsRequest(breakpoints []dap.FunctionBreakpoint) { + c.send(&dap.SetFunctionBreakpointsRequest{ + Request: *c.newRequest("setFunctionBreakpoints"), + Arguments: dap.SetFunctionBreakpointsArguments{ + Breakpoints: breakpoints, + }, + }) +} + +// SetInstructionBreakpointsRequest sends a 'setInstructionBreakpoints' request. +func (c *Client) SetInstructionBreakpointsRequest(breakpoints []dap.InstructionBreakpoint) { + c.send(&dap.SetInstructionBreakpointsRequest{ + Request: *c.newRequest("setInstructionBreakpoints"), + Arguments: dap.SetInstructionBreakpointsArguments{ + Breakpoints: breakpoints, + }, + }) } // StepBackRequest sends a 'stepBack' request. @@ -446,8 +462,12 @@ func (c *Client) ReverseContinueRequest() { } // SetVariableRequest sends a 'setVariable' request. -func (c *Client) SetVariableRequest() { - c.send(&dap.ReverseContinueRequest{Request: *c.newRequest("setVariable")}) +func (c *Client) SetVariableRequest(variablesRef int, name, value string) { + request := &dap.SetVariableRequest{Request: *c.newRequest("setVariable")} + request.Arguments.VariablesReference = variablesRef + request.Arguments.Name = name + request.Arguments.Value = value + c.send(request) } // RestartFrameRequest sends a 'restartFrame' request. @@ -476,8 +496,12 @@ func (c *Client) TerminateThreadsRequest() { } // EvaluateRequest sends a 'evaluate' request. -func (c *Client) EvaluateRequest() { - c.send(&dap.EvaluateRequest{Request: *c.newRequest("evaluate")}) +func (c *Client) EvaluateRequest(expr string, fid int, context string) { + request := &dap.EvaluateRequest{Request: *c.newRequest("evaluate")} + request.Arguments.Expression = expr + request.Arguments.FrameId = fid + request.Arguments.Context = context + c.send(request) } // StepInTargetsRequest sends a 'stepInTargets' request. @@ -496,8 +520,10 @@ func (c *Client) CompletionsRequest() { } // ExceptionInfoRequest sends a 'exceptionInfo' request. -func (c *Client) ExceptionInfoRequest() { - c.send(&dap.ExceptionInfoRequest{Request: *c.newRequest("exceptionInfo")}) +func (c *Client) ExceptionInfoRequest(threadID int) { + request := &dap.ExceptionInfoRequest{Request: *c.newRequest("exceptionInfo")} + request.Arguments.ThreadId = threadID + c.send(request) } // LoadedSourcesRequest sends a 'loadedSources' request. @@ -521,8 +547,17 @@ func (c *Client) ReadMemoryRequest() { } // DisassembleRequest sends a 'disassemble' request. -func (c *Client) DisassembleRequest() { - c.send(&dap.DisassembleRequest{Request: *c.newRequest("disassemble")}) +func (c *Client) DisassembleRequest(memoryReference string, instructionOffset, inctructionCount int) { + c.send(&dap.DisassembleRequest{ + Request: *c.newRequest("disassemble"), + Arguments: dap.DisassembleArguments{ + MemoryReference: memoryReference, + Offset: 0, + InstructionOffset: instructionOffset, + InstructionCount: inctructionCount, + ResolveSymbols: false, + }, + }) } // CancelRequest sends a 'cancel' request. @@ -555,6 +590,15 @@ func (c *Client) UnknownEvent() { c.send(event) } +// BadRequest triggers an unmarshal error. +func (c *Client) BadRequest() { + content := []byte("{malformedString}") + contentLengthHeaderFmt := "Content-Length: %d\r\n\r\n" + header := fmt.Sprintf(contentLengthHeaderFmt, len(content)) + c.conn.Write([]byte(header)) + c.conn.Write(content) +} + // KnownEvent passes decode checks, but delve has no 'case' to // handle it. This behaves the same way a new request type // added to go-dap, but not to delve. diff --git a/service/dap/daptest/gen/main.go b/service/dap/daptest/gen/main.go new file mode 100644 index 0000000000..a5e3870e02 --- /dev/null +++ b/service/dap/daptest/gen/main.go @@ -0,0 +1,118 @@ +// Binary gen generates service/dap/daptest/responses.go. +package main + +import ( + "bytes" + "flag" + "fmt" + "go/format" + "go/types" + "io/ioutil" + "os" + "text/template" + + "golang.org/x/tools/go/packages" + + _ "github.com/google/go-dap" +) + +var oFlag = flag.String("o", "", "output file name") + +var tmpl = template.Must(template.New("assert").Parse(`package daptest + +// Code generated by go generate; DO NOT EDIT. +// The code generator program is in ./gen directory. + +import ( + "testing" + + "github.com/google/go-dap" +) +{{range .}} +// Expect{{.}} reads a protocol message from the connection +// and fails the test if the read message is not *{{.}}. +func (c *Client) Expect{{.}}(t *testing.T) *dap.{{.}} { + t.Helper() + m := c.ExpectMessage(t) + return c.Check{{.}}(t, m) +} + +// Check{{.}} fails the test if m is not *{{.}}. +func (c *Client) Check{{.}}(t *testing.T, m dap.Message) *dap.{{.}} { + t.Helper(){{if or (or (eq . "StepInResponse") (eq . "StepOutResponse")) (eq . "NextResponse") }} + _, ok := m.(*dap.ContinuedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ContinuedEvent", m) + } + m = c.ExpectMessage(t){{else}}{{if (eq . "ConfigurationDoneResponse") }} + oe, ok := m.(*dap.OutputEvent) + if !ok { + t.Fatalf("got %#v, want *dap.OutputEvent", m) + } + if oe.Body.Output != "Type 'dlv help' for list of commands.\n" { + t.Fatalf("got %#v, want Output=%q", m, "Type 'dlv help' for list of commands.\n") + } + m = c.ExpectMessage(t){{end}}{{end}} + r, ok := m.(*dap.{{.}}) + if !ok { + t.Fatalf("got %#v, want *dap.{{.}}", m) + } + return r +}{{end}} +`)) + +func main() { + flag.Parse() + + if *oFlag == "" { + fmt.Fprintf(os.Stderr, "-o must be provided\n") + } + + pkgs, err := packages.Load(&packages.Config{ + Mode: packages.NeedTypes, + }, "github.com/google/go-dap") + if err != nil { + fmt.Fprintf(os.Stderr, "load: %v\n", err) + os.Exit(1) + } + if len(pkgs) != 1 || pkgs[0].Types == nil { + fmt.Fprintf(os.Stderr, "invalid package was loaded: %#v\n", pkgs) + os.Exit(1) + } + + messages := []string{} + scope := pkgs[0].Types.Scope() + for _, name := range scope.Names() { + // Find only types that are embedding go-dap.Respose message. + obj := scope.Lookup(name) + if !obj.Exported() { + continue // skip unexported + } + u, ok := obj.Type().Underlying().(*types.Struct) + if !ok { + continue + } + for i := 0; i < u.NumFields(); i++ { + if f := u.Field(i); f.Embedded() && (f.Type().String() == "github.com/google/go-dap.Response" || + f.Type().String() == "github.com/google/go-dap.Event") { + messages = append(messages, obj.Name()) + break + } + } + } + + buf := &bytes.Buffer{} + if err := tmpl.Execute(buf, messages); err != nil { + fmt.Fprintf(os.Stderr, "Failed to generate: %v\n", err) + os.Exit(1) + } + formatted, err := format.Source(buf.Bytes()) + if err != nil { + fmt.Fprintf(os.Stderr, "Generated invalid go code: %v\n", err) + os.Exit(1) + } + if err := ioutil.WriteFile(*oFlag, formatted, 0644); err != nil { + fmt.Fprintf(os.Stderr, "Failed to write: %v\n", err) + os.Exit(1) + } +} diff --git a/service/dap/daptest/resp.go b/service/dap/daptest/resp.go new file mode 100644 index 0000000000..0a253299e4 --- /dev/null +++ b/service/dap/daptest/resp.go @@ -0,0 +1,1131 @@ +package daptest + +// Code generated by go generate; DO NOT EDIT. +// The code generator program is in ./gen directory. + +import ( + "testing" + + "github.com/google/go-dap" +) + +// ExpectAttachResponse reads a protocol message from the connection +// and fails the test if the read message is not *AttachResponse. +func (c *Client) ExpectAttachResponse(t *testing.T) *dap.AttachResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckAttachResponse(t, m) +} + +// CheckAttachResponse fails the test if m is not *AttachResponse. +func (c *Client) CheckAttachResponse(t *testing.T, m dap.Message) *dap.AttachResponse { + t.Helper() + r, ok := m.(*dap.AttachResponse) + if !ok { + t.Fatalf("got %#v, want *dap.AttachResponse", m) + } + return r +} + +// ExpectBreakpointEvent reads a protocol message from the connection +// and fails the test if the read message is not *BreakpointEvent. +func (c *Client) ExpectBreakpointEvent(t *testing.T) *dap.BreakpointEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckBreakpointEvent(t, m) +} + +// CheckBreakpointEvent fails the test if m is not *BreakpointEvent. +func (c *Client) CheckBreakpointEvent(t *testing.T, m dap.Message) *dap.BreakpointEvent { + t.Helper() + r, ok := m.(*dap.BreakpointEvent) + if !ok { + t.Fatalf("got %#v, want *dap.BreakpointEvent", m) + } + return r +} + +// ExpectBreakpointLocationsResponse reads a protocol message from the connection +// and fails the test if the read message is not *BreakpointLocationsResponse. +func (c *Client) ExpectBreakpointLocationsResponse(t *testing.T) *dap.BreakpointLocationsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckBreakpointLocationsResponse(t, m) +} + +// CheckBreakpointLocationsResponse fails the test if m is not *BreakpointLocationsResponse. +func (c *Client) CheckBreakpointLocationsResponse(t *testing.T, m dap.Message) *dap.BreakpointLocationsResponse { + t.Helper() + r, ok := m.(*dap.BreakpointLocationsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.BreakpointLocationsResponse", m) + } + return r +} + +// ExpectCancelResponse reads a protocol message from the connection +// and fails the test if the read message is not *CancelResponse. +func (c *Client) ExpectCancelResponse(t *testing.T) *dap.CancelResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckCancelResponse(t, m) +} + +// CheckCancelResponse fails the test if m is not *CancelResponse. +func (c *Client) CheckCancelResponse(t *testing.T, m dap.Message) *dap.CancelResponse { + t.Helper() + r, ok := m.(*dap.CancelResponse) + if !ok { + t.Fatalf("got %#v, want *dap.CancelResponse", m) + } + return r +} + +// ExpectCapabilitiesEvent reads a protocol message from the connection +// and fails the test if the read message is not *CapabilitiesEvent. +func (c *Client) ExpectCapabilitiesEvent(t *testing.T) *dap.CapabilitiesEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckCapabilitiesEvent(t, m) +} + +// CheckCapabilitiesEvent fails the test if m is not *CapabilitiesEvent. +func (c *Client) CheckCapabilitiesEvent(t *testing.T, m dap.Message) *dap.CapabilitiesEvent { + t.Helper() + r, ok := m.(*dap.CapabilitiesEvent) + if !ok { + t.Fatalf("got %#v, want *dap.CapabilitiesEvent", m) + } + return r +} + +// ExpectCompletionsResponse reads a protocol message from the connection +// and fails the test if the read message is not *CompletionsResponse. +func (c *Client) ExpectCompletionsResponse(t *testing.T) *dap.CompletionsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckCompletionsResponse(t, m) +} + +// CheckCompletionsResponse fails the test if m is not *CompletionsResponse. +func (c *Client) CheckCompletionsResponse(t *testing.T, m dap.Message) *dap.CompletionsResponse { + t.Helper() + r, ok := m.(*dap.CompletionsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.CompletionsResponse", m) + } + return r +} + +// ExpectConfigurationDoneResponse reads a protocol message from the connection +// and fails the test if the read message is not *ConfigurationDoneResponse. +func (c *Client) ExpectConfigurationDoneResponse(t *testing.T) *dap.ConfigurationDoneResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckConfigurationDoneResponse(t, m) +} + +// CheckConfigurationDoneResponse fails the test if m is not *ConfigurationDoneResponse. +func (c *Client) CheckConfigurationDoneResponse(t *testing.T, m dap.Message) *dap.ConfigurationDoneResponse { + t.Helper() + oe, ok := m.(*dap.OutputEvent) + if !ok { + t.Fatalf("got %#v, want *dap.OutputEvent", m) + } + if oe.Body.Output != "Type 'dlv help' for list of commands.\n" { + t.Fatalf("got %#v, want Output=%q", m, "Type 'dlv help' for list of commands.\n") + } + m = c.ExpectMessage(t) + r, ok := m.(*dap.ConfigurationDoneResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ConfigurationDoneResponse", m) + } + return r +} + +// ExpectContinueResponse reads a protocol message from the connection +// and fails the test if the read message is not *ContinueResponse. +func (c *Client) ExpectContinueResponse(t *testing.T) *dap.ContinueResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckContinueResponse(t, m) +} + +// CheckContinueResponse fails the test if m is not *ContinueResponse. +func (c *Client) CheckContinueResponse(t *testing.T, m dap.Message) *dap.ContinueResponse { + t.Helper() + r, ok := m.(*dap.ContinueResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ContinueResponse", m) + } + return r +} + +// ExpectContinuedEvent reads a protocol message from the connection +// and fails the test if the read message is not *ContinuedEvent. +func (c *Client) ExpectContinuedEvent(t *testing.T) *dap.ContinuedEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckContinuedEvent(t, m) +} + +// CheckContinuedEvent fails the test if m is not *ContinuedEvent. +func (c *Client) CheckContinuedEvent(t *testing.T, m dap.Message) *dap.ContinuedEvent { + t.Helper() + r, ok := m.(*dap.ContinuedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ContinuedEvent", m) + } + return r +} + +// ExpectDataBreakpointInfoResponse reads a protocol message from the connection +// and fails the test if the read message is not *DataBreakpointInfoResponse. +func (c *Client) ExpectDataBreakpointInfoResponse(t *testing.T) *dap.DataBreakpointInfoResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckDataBreakpointInfoResponse(t, m) +} + +// CheckDataBreakpointInfoResponse fails the test if m is not *DataBreakpointInfoResponse. +func (c *Client) CheckDataBreakpointInfoResponse(t *testing.T, m dap.Message) *dap.DataBreakpointInfoResponse { + t.Helper() + r, ok := m.(*dap.DataBreakpointInfoResponse) + if !ok { + t.Fatalf("got %#v, want *dap.DataBreakpointInfoResponse", m) + } + return r +} + +// ExpectDisassembleResponse reads a protocol message from the connection +// and fails the test if the read message is not *DisassembleResponse. +func (c *Client) ExpectDisassembleResponse(t *testing.T) *dap.DisassembleResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckDisassembleResponse(t, m) +} + +// CheckDisassembleResponse fails the test if m is not *DisassembleResponse. +func (c *Client) CheckDisassembleResponse(t *testing.T, m dap.Message) *dap.DisassembleResponse { + t.Helper() + r, ok := m.(*dap.DisassembleResponse) + if !ok { + t.Fatalf("got %#v, want *dap.DisassembleResponse", m) + } + return r +} + +// ExpectDisconnectResponse reads a protocol message from the connection +// and fails the test if the read message is not *DisconnectResponse. +func (c *Client) ExpectDisconnectResponse(t *testing.T) *dap.DisconnectResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckDisconnectResponse(t, m) +} + +// CheckDisconnectResponse fails the test if m is not *DisconnectResponse. +func (c *Client) CheckDisconnectResponse(t *testing.T, m dap.Message) *dap.DisconnectResponse { + t.Helper() + r, ok := m.(*dap.DisconnectResponse) + if !ok { + t.Fatalf("got %#v, want *dap.DisconnectResponse", m) + } + return r +} + +// ExpectErrorResponse reads a protocol message from the connection +// and fails the test if the read message is not *ErrorResponse. +func (c *Client) ExpectErrorResponse(t *testing.T) *dap.ErrorResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckErrorResponse(t, m) +} + +// CheckErrorResponse fails the test if m is not *ErrorResponse. +func (c *Client) CheckErrorResponse(t *testing.T, m dap.Message) *dap.ErrorResponse { + t.Helper() + r, ok := m.(*dap.ErrorResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ErrorResponse", m) + } + return r +} + +// ExpectEvaluateResponse reads a protocol message from the connection +// and fails the test if the read message is not *EvaluateResponse. +func (c *Client) ExpectEvaluateResponse(t *testing.T) *dap.EvaluateResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckEvaluateResponse(t, m) +} + +// CheckEvaluateResponse fails the test if m is not *EvaluateResponse. +func (c *Client) CheckEvaluateResponse(t *testing.T, m dap.Message) *dap.EvaluateResponse { + t.Helper() + r, ok := m.(*dap.EvaluateResponse) + if !ok { + t.Fatalf("got %#v, want *dap.EvaluateResponse", m) + } + return r +} + +// ExpectExceptionInfoResponse reads a protocol message from the connection +// and fails the test if the read message is not *ExceptionInfoResponse. +func (c *Client) ExpectExceptionInfoResponse(t *testing.T) *dap.ExceptionInfoResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckExceptionInfoResponse(t, m) +} + +// CheckExceptionInfoResponse fails the test if m is not *ExceptionInfoResponse. +func (c *Client) CheckExceptionInfoResponse(t *testing.T, m dap.Message) *dap.ExceptionInfoResponse { + t.Helper() + r, ok := m.(*dap.ExceptionInfoResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ExceptionInfoResponse", m) + } + return r +} + +// ExpectExitedEvent reads a protocol message from the connection +// and fails the test if the read message is not *ExitedEvent. +func (c *Client) ExpectExitedEvent(t *testing.T) *dap.ExitedEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckExitedEvent(t, m) +} + +// CheckExitedEvent fails the test if m is not *ExitedEvent. +func (c *Client) CheckExitedEvent(t *testing.T, m dap.Message) *dap.ExitedEvent { + t.Helper() + r, ok := m.(*dap.ExitedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ExitedEvent", m) + } + return r +} + +// ExpectGotoResponse reads a protocol message from the connection +// and fails the test if the read message is not *GotoResponse. +func (c *Client) ExpectGotoResponse(t *testing.T) *dap.GotoResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckGotoResponse(t, m) +} + +// CheckGotoResponse fails the test if m is not *GotoResponse. +func (c *Client) CheckGotoResponse(t *testing.T, m dap.Message) *dap.GotoResponse { + t.Helper() + r, ok := m.(*dap.GotoResponse) + if !ok { + t.Fatalf("got %#v, want *dap.GotoResponse", m) + } + return r +} + +// ExpectGotoTargetsResponse reads a protocol message from the connection +// and fails the test if the read message is not *GotoTargetsResponse. +func (c *Client) ExpectGotoTargetsResponse(t *testing.T) *dap.GotoTargetsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckGotoTargetsResponse(t, m) +} + +// CheckGotoTargetsResponse fails the test if m is not *GotoTargetsResponse. +func (c *Client) CheckGotoTargetsResponse(t *testing.T, m dap.Message) *dap.GotoTargetsResponse { + t.Helper() + r, ok := m.(*dap.GotoTargetsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.GotoTargetsResponse", m) + } + return r +} + +// ExpectInitializeResponse reads a protocol message from the connection +// and fails the test if the read message is not *InitializeResponse. +func (c *Client) ExpectInitializeResponse(t *testing.T) *dap.InitializeResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckInitializeResponse(t, m) +} + +// CheckInitializeResponse fails the test if m is not *InitializeResponse. +func (c *Client) CheckInitializeResponse(t *testing.T, m dap.Message) *dap.InitializeResponse { + t.Helper() + r, ok := m.(*dap.InitializeResponse) + if !ok { + t.Fatalf("got %#v, want *dap.InitializeResponse", m) + } + return r +} + +// ExpectInitializedEvent reads a protocol message from the connection +// and fails the test if the read message is not *InitializedEvent. +func (c *Client) ExpectInitializedEvent(t *testing.T) *dap.InitializedEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckInitializedEvent(t, m) +} + +// CheckInitializedEvent fails the test if m is not *InitializedEvent. +func (c *Client) CheckInitializedEvent(t *testing.T, m dap.Message) *dap.InitializedEvent { + t.Helper() + r, ok := m.(*dap.InitializedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.InitializedEvent", m) + } + return r +} + +// ExpectInvalidatedEvent reads a protocol message from the connection +// and fails the test if the read message is not *InvalidatedEvent. +func (c *Client) ExpectInvalidatedEvent(t *testing.T) *dap.InvalidatedEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckInvalidatedEvent(t, m) +} + +// CheckInvalidatedEvent fails the test if m is not *InvalidatedEvent. +func (c *Client) CheckInvalidatedEvent(t *testing.T, m dap.Message) *dap.InvalidatedEvent { + t.Helper() + r, ok := m.(*dap.InvalidatedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.InvalidatedEvent", m) + } + return r +} + +// ExpectLaunchResponse reads a protocol message from the connection +// and fails the test if the read message is not *LaunchResponse. +func (c *Client) ExpectLaunchResponse(t *testing.T) *dap.LaunchResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckLaunchResponse(t, m) +} + +// CheckLaunchResponse fails the test if m is not *LaunchResponse. +func (c *Client) CheckLaunchResponse(t *testing.T, m dap.Message) *dap.LaunchResponse { + t.Helper() + r, ok := m.(*dap.LaunchResponse) + if !ok { + t.Fatalf("got %#v, want *dap.LaunchResponse", m) + } + return r +} + +// ExpectLoadedSourceEvent reads a protocol message from the connection +// and fails the test if the read message is not *LoadedSourceEvent. +func (c *Client) ExpectLoadedSourceEvent(t *testing.T) *dap.LoadedSourceEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckLoadedSourceEvent(t, m) +} + +// CheckLoadedSourceEvent fails the test if m is not *LoadedSourceEvent. +func (c *Client) CheckLoadedSourceEvent(t *testing.T, m dap.Message) *dap.LoadedSourceEvent { + t.Helper() + r, ok := m.(*dap.LoadedSourceEvent) + if !ok { + t.Fatalf("got %#v, want *dap.LoadedSourceEvent", m) + } + return r +} + +// ExpectLoadedSourcesResponse reads a protocol message from the connection +// and fails the test if the read message is not *LoadedSourcesResponse. +func (c *Client) ExpectLoadedSourcesResponse(t *testing.T) *dap.LoadedSourcesResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckLoadedSourcesResponse(t, m) +} + +// CheckLoadedSourcesResponse fails the test if m is not *LoadedSourcesResponse. +func (c *Client) CheckLoadedSourcesResponse(t *testing.T, m dap.Message) *dap.LoadedSourcesResponse { + t.Helper() + r, ok := m.(*dap.LoadedSourcesResponse) + if !ok { + t.Fatalf("got %#v, want *dap.LoadedSourcesResponse", m) + } + return r +} + +// ExpectMemoryEvent reads a protocol message from the connection +// and fails the test if the read message is not *MemoryEvent. +func (c *Client) ExpectMemoryEvent(t *testing.T) *dap.MemoryEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckMemoryEvent(t, m) +} + +// CheckMemoryEvent fails the test if m is not *MemoryEvent. +func (c *Client) CheckMemoryEvent(t *testing.T, m dap.Message) *dap.MemoryEvent { + t.Helper() + r, ok := m.(*dap.MemoryEvent) + if !ok { + t.Fatalf("got %#v, want *dap.MemoryEvent", m) + } + return r +} + +// ExpectModuleEvent reads a protocol message from the connection +// and fails the test if the read message is not *ModuleEvent. +func (c *Client) ExpectModuleEvent(t *testing.T) *dap.ModuleEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckModuleEvent(t, m) +} + +// CheckModuleEvent fails the test if m is not *ModuleEvent. +func (c *Client) CheckModuleEvent(t *testing.T, m dap.Message) *dap.ModuleEvent { + t.Helper() + r, ok := m.(*dap.ModuleEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ModuleEvent", m) + } + return r +} + +// ExpectModulesResponse reads a protocol message from the connection +// and fails the test if the read message is not *ModulesResponse. +func (c *Client) ExpectModulesResponse(t *testing.T) *dap.ModulesResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckModulesResponse(t, m) +} + +// CheckModulesResponse fails the test if m is not *ModulesResponse. +func (c *Client) CheckModulesResponse(t *testing.T, m dap.Message) *dap.ModulesResponse { + t.Helper() + r, ok := m.(*dap.ModulesResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ModulesResponse", m) + } + return r +} + +// ExpectNextResponse reads a protocol message from the connection +// and fails the test if the read message is not *NextResponse. +func (c *Client) ExpectNextResponse(t *testing.T) *dap.NextResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckNextResponse(t, m) +} + +// CheckNextResponse fails the test if m is not *NextResponse. +func (c *Client) CheckNextResponse(t *testing.T, m dap.Message) *dap.NextResponse { + t.Helper() + _, ok := m.(*dap.ContinuedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ContinuedEvent", m) + } + m = c.ExpectMessage(t) + r, ok := m.(*dap.NextResponse) + if !ok { + t.Fatalf("got %#v, want *dap.NextResponse", m) + } + return r +} + +// ExpectOutputEvent reads a protocol message from the connection +// and fails the test if the read message is not *OutputEvent. +func (c *Client) ExpectOutputEvent(t *testing.T) *dap.OutputEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckOutputEvent(t, m) +} + +// CheckOutputEvent fails the test if m is not *OutputEvent. +func (c *Client) CheckOutputEvent(t *testing.T, m dap.Message) *dap.OutputEvent { + t.Helper() + r, ok := m.(*dap.OutputEvent) + if !ok { + t.Fatalf("got %#v, want *dap.OutputEvent", m) + } + return r +} + +// ExpectPauseResponse reads a protocol message from the connection +// and fails the test if the read message is not *PauseResponse. +func (c *Client) ExpectPauseResponse(t *testing.T) *dap.PauseResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckPauseResponse(t, m) +} + +// CheckPauseResponse fails the test if m is not *PauseResponse. +func (c *Client) CheckPauseResponse(t *testing.T, m dap.Message) *dap.PauseResponse { + t.Helper() + r, ok := m.(*dap.PauseResponse) + if !ok { + t.Fatalf("got %#v, want *dap.PauseResponse", m) + } + return r +} + +// ExpectProcessEvent reads a protocol message from the connection +// and fails the test if the read message is not *ProcessEvent. +func (c *Client) ExpectProcessEvent(t *testing.T) *dap.ProcessEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckProcessEvent(t, m) +} + +// CheckProcessEvent fails the test if m is not *ProcessEvent. +func (c *Client) CheckProcessEvent(t *testing.T, m dap.Message) *dap.ProcessEvent { + t.Helper() + r, ok := m.(*dap.ProcessEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ProcessEvent", m) + } + return r +} + +// ExpectProgressEndEvent reads a protocol message from the connection +// and fails the test if the read message is not *ProgressEndEvent. +func (c *Client) ExpectProgressEndEvent(t *testing.T) *dap.ProgressEndEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckProgressEndEvent(t, m) +} + +// CheckProgressEndEvent fails the test if m is not *ProgressEndEvent. +func (c *Client) CheckProgressEndEvent(t *testing.T, m dap.Message) *dap.ProgressEndEvent { + t.Helper() + r, ok := m.(*dap.ProgressEndEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ProgressEndEvent", m) + } + return r +} + +// ExpectProgressStartEvent reads a protocol message from the connection +// and fails the test if the read message is not *ProgressStartEvent. +func (c *Client) ExpectProgressStartEvent(t *testing.T) *dap.ProgressStartEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckProgressStartEvent(t, m) +} + +// CheckProgressStartEvent fails the test if m is not *ProgressStartEvent. +func (c *Client) CheckProgressStartEvent(t *testing.T, m dap.Message) *dap.ProgressStartEvent { + t.Helper() + r, ok := m.(*dap.ProgressStartEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ProgressStartEvent", m) + } + return r +} + +// ExpectProgressUpdateEvent reads a protocol message from the connection +// and fails the test if the read message is not *ProgressUpdateEvent. +func (c *Client) ExpectProgressUpdateEvent(t *testing.T) *dap.ProgressUpdateEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckProgressUpdateEvent(t, m) +} + +// CheckProgressUpdateEvent fails the test if m is not *ProgressUpdateEvent. +func (c *Client) CheckProgressUpdateEvent(t *testing.T, m dap.Message) *dap.ProgressUpdateEvent { + t.Helper() + r, ok := m.(*dap.ProgressUpdateEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ProgressUpdateEvent", m) + } + return r +} + +// ExpectReadMemoryResponse reads a protocol message from the connection +// and fails the test if the read message is not *ReadMemoryResponse. +func (c *Client) ExpectReadMemoryResponse(t *testing.T) *dap.ReadMemoryResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckReadMemoryResponse(t, m) +} + +// CheckReadMemoryResponse fails the test if m is not *ReadMemoryResponse. +func (c *Client) CheckReadMemoryResponse(t *testing.T, m dap.Message) *dap.ReadMemoryResponse { + t.Helper() + r, ok := m.(*dap.ReadMemoryResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ReadMemoryResponse", m) + } + return r +} + +// ExpectRestartFrameResponse reads a protocol message from the connection +// and fails the test if the read message is not *RestartFrameResponse. +func (c *Client) ExpectRestartFrameResponse(t *testing.T) *dap.RestartFrameResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckRestartFrameResponse(t, m) +} + +// CheckRestartFrameResponse fails the test if m is not *RestartFrameResponse. +func (c *Client) CheckRestartFrameResponse(t *testing.T, m dap.Message) *dap.RestartFrameResponse { + t.Helper() + r, ok := m.(*dap.RestartFrameResponse) + if !ok { + t.Fatalf("got %#v, want *dap.RestartFrameResponse", m) + } + return r +} + +// ExpectRestartResponse reads a protocol message from the connection +// and fails the test if the read message is not *RestartResponse. +func (c *Client) ExpectRestartResponse(t *testing.T) *dap.RestartResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckRestartResponse(t, m) +} + +// CheckRestartResponse fails the test if m is not *RestartResponse. +func (c *Client) CheckRestartResponse(t *testing.T, m dap.Message) *dap.RestartResponse { + t.Helper() + r, ok := m.(*dap.RestartResponse) + if !ok { + t.Fatalf("got %#v, want *dap.RestartResponse", m) + } + return r +} + +// ExpectReverseContinueResponse reads a protocol message from the connection +// and fails the test if the read message is not *ReverseContinueResponse. +func (c *Client) ExpectReverseContinueResponse(t *testing.T) *dap.ReverseContinueResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckReverseContinueResponse(t, m) +} + +// CheckReverseContinueResponse fails the test if m is not *ReverseContinueResponse. +func (c *Client) CheckReverseContinueResponse(t *testing.T, m dap.Message) *dap.ReverseContinueResponse { + t.Helper() + r, ok := m.(*dap.ReverseContinueResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ReverseContinueResponse", m) + } + return r +} + +// ExpectRunInTerminalResponse reads a protocol message from the connection +// and fails the test if the read message is not *RunInTerminalResponse. +func (c *Client) ExpectRunInTerminalResponse(t *testing.T) *dap.RunInTerminalResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckRunInTerminalResponse(t, m) +} + +// CheckRunInTerminalResponse fails the test if m is not *RunInTerminalResponse. +func (c *Client) CheckRunInTerminalResponse(t *testing.T, m dap.Message) *dap.RunInTerminalResponse { + t.Helper() + r, ok := m.(*dap.RunInTerminalResponse) + if !ok { + t.Fatalf("got %#v, want *dap.RunInTerminalResponse", m) + } + return r +} + +// ExpectScopesResponse reads a protocol message from the connection +// and fails the test if the read message is not *ScopesResponse. +func (c *Client) ExpectScopesResponse(t *testing.T) *dap.ScopesResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckScopesResponse(t, m) +} + +// CheckScopesResponse fails the test if m is not *ScopesResponse. +func (c *Client) CheckScopesResponse(t *testing.T, m dap.Message) *dap.ScopesResponse { + t.Helper() + r, ok := m.(*dap.ScopesResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ScopesResponse", m) + } + return r +} + +// ExpectSetBreakpointsResponse reads a protocol message from the connection +// and fails the test if the read message is not *SetBreakpointsResponse. +func (c *Client) ExpectSetBreakpointsResponse(t *testing.T) *dap.SetBreakpointsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckSetBreakpointsResponse(t, m) +} + +// CheckSetBreakpointsResponse fails the test if m is not *SetBreakpointsResponse. +func (c *Client) CheckSetBreakpointsResponse(t *testing.T, m dap.Message) *dap.SetBreakpointsResponse { + t.Helper() + r, ok := m.(*dap.SetBreakpointsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.SetBreakpointsResponse", m) + } + return r +} + +// ExpectSetDataBreakpointsResponse reads a protocol message from the connection +// and fails the test if the read message is not *SetDataBreakpointsResponse. +func (c *Client) ExpectSetDataBreakpointsResponse(t *testing.T) *dap.SetDataBreakpointsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckSetDataBreakpointsResponse(t, m) +} + +// CheckSetDataBreakpointsResponse fails the test if m is not *SetDataBreakpointsResponse. +func (c *Client) CheckSetDataBreakpointsResponse(t *testing.T, m dap.Message) *dap.SetDataBreakpointsResponse { + t.Helper() + r, ok := m.(*dap.SetDataBreakpointsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.SetDataBreakpointsResponse", m) + } + return r +} + +// ExpectSetExceptionBreakpointsResponse reads a protocol message from the connection +// and fails the test if the read message is not *SetExceptionBreakpointsResponse. +func (c *Client) ExpectSetExceptionBreakpointsResponse(t *testing.T) *dap.SetExceptionBreakpointsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckSetExceptionBreakpointsResponse(t, m) +} + +// CheckSetExceptionBreakpointsResponse fails the test if m is not *SetExceptionBreakpointsResponse. +func (c *Client) CheckSetExceptionBreakpointsResponse(t *testing.T, m dap.Message) *dap.SetExceptionBreakpointsResponse { + t.Helper() + r, ok := m.(*dap.SetExceptionBreakpointsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.SetExceptionBreakpointsResponse", m) + } + return r +} + +// ExpectSetExpressionResponse reads a protocol message from the connection +// and fails the test if the read message is not *SetExpressionResponse. +func (c *Client) ExpectSetExpressionResponse(t *testing.T) *dap.SetExpressionResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckSetExpressionResponse(t, m) +} + +// CheckSetExpressionResponse fails the test if m is not *SetExpressionResponse. +func (c *Client) CheckSetExpressionResponse(t *testing.T, m dap.Message) *dap.SetExpressionResponse { + t.Helper() + r, ok := m.(*dap.SetExpressionResponse) + if !ok { + t.Fatalf("got %#v, want *dap.SetExpressionResponse", m) + } + return r +} + +// ExpectSetFunctionBreakpointsResponse reads a protocol message from the connection +// and fails the test if the read message is not *SetFunctionBreakpointsResponse. +func (c *Client) ExpectSetFunctionBreakpointsResponse(t *testing.T) *dap.SetFunctionBreakpointsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckSetFunctionBreakpointsResponse(t, m) +} + +// CheckSetFunctionBreakpointsResponse fails the test if m is not *SetFunctionBreakpointsResponse. +func (c *Client) CheckSetFunctionBreakpointsResponse(t *testing.T, m dap.Message) *dap.SetFunctionBreakpointsResponse { + t.Helper() + r, ok := m.(*dap.SetFunctionBreakpointsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.SetFunctionBreakpointsResponse", m) + } + return r +} + +// ExpectSetInstructionBreakpointsResponse reads a protocol message from the connection +// and fails the test if the read message is not *SetInstructionBreakpointsResponse. +func (c *Client) ExpectSetInstructionBreakpointsResponse(t *testing.T) *dap.SetInstructionBreakpointsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckSetInstructionBreakpointsResponse(t, m) +} + +// CheckSetInstructionBreakpointsResponse fails the test if m is not *SetInstructionBreakpointsResponse. +func (c *Client) CheckSetInstructionBreakpointsResponse(t *testing.T, m dap.Message) *dap.SetInstructionBreakpointsResponse { + t.Helper() + r, ok := m.(*dap.SetInstructionBreakpointsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.SetInstructionBreakpointsResponse", m) + } + return r +} + +// ExpectSetVariableResponse reads a protocol message from the connection +// and fails the test if the read message is not *SetVariableResponse. +func (c *Client) ExpectSetVariableResponse(t *testing.T) *dap.SetVariableResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckSetVariableResponse(t, m) +} + +// CheckSetVariableResponse fails the test if m is not *SetVariableResponse. +func (c *Client) CheckSetVariableResponse(t *testing.T, m dap.Message) *dap.SetVariableResponse { + t.Helper() + r, ok := m.(*dap.SetVariableResponse) + if !ok { + t.Fatalf("got %#v, want *dap.SetVariableResponse", m) + } + return r +} + +// ExpectSourceResponse reads a protocol message from the connection +// and fails the test if the read message is not *SourceResponse. +func (c *Client) ExpectSourceResponse(t *testing.T) *dap.SourceResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckSourceResponse(t, m) +} + +// CheckSourceResponse fails the test if m is not *SourceResponse. +func (c *Client) CheckSourceResponse(t *testing.T, m dap.Message) *dap.SourceResponse { + t.Helper() + r, ok := m.(*dap.SourceResponse) + if !ok { + t.Fatalf("got %#v, want *dap.SourceResponse", m) + } + return r +} + +// ExpectStackTraceResponse reads a protocol message from the connection +// and fails the test if the read message is not *StackTraceResponse. +func (c *Client) ExpectStackTraceResponse(t *testing.T) *dap.StackTraceResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckStackTraceResponse(t, m) +} + +// CheckStackTraceResponse fails the test if m is not *StackTraceResponse. +func (c *Client) CheckStackTraceResponse(t *testing.T, m dap.Message) *dap.StackTraceResponse { + t.Helper() + r, ok := m.(*dap.StackTraceResponse) + if !ok { + t.Fatalf("got %#v, want *dap.StackTraceResponse", m) + } + return r +} + +// ExpectStepBackResponse reads a protocol message from the connection +// and fails the test if the read message is not *StepBackResponse. +func (c *Client) ExpectStepBackResponse(t *testing.T) *dap.StepBackResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckStepBackResponse(t, m) +} + +// CheckStepBackResponse fails the test if m is not *StepBackResponse. +func (c *Client) CheckStepBackResponse(t *testing.T, m dap.Message) *dap.StepBackResponse { + t.Helper() + r, ok := m.(*dap.StepBackResponse) + if !ok { + t.Fatalf("got %#v, want *dap.StepBackResponse", m) + } + return r +} + +// ExpectStepInResponse reads a protocol message from the connection +// and fails the test if the read message is not *StepInResponse. +func (c *Client) ExpectStepInResponse(t *testing.T) *dap.StepInResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckStepInResponse(t, m) +} + +// CheckStepInResponse fails the test if m is not *StepInResponse. +func (c *Client) CheckStepInResponse(t *testing.T, m dap.Message) *dap.StepInResponse { + t.Helper() + _, ok := m.(*dap.ContinuedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ContinuedEvent", m) + } + m = c.ExpectMessage(t) + r, ok := m.(*dap.StepInResponse) + if !ok { + t.Fatalf("got %#v, want *dap.StepInResponse", m) + } + return r +} + +// ExpectStepInTargetsResponse reads a protocol message from the connection +// and fails the test if the read message is not *StepInTargetsResponse. +func (c *Client) ExpectStepInTargetsResponse(t *testing.T) *dap.StepInTargetsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckStepInTargetsResponse(t, m) +} + +// CheckStepInTargetsResponse fails the test if m is not *StepInTargetsResponse. +func (c *Client) CheckStepInTargetsResponse(t *testing.T, m dap.Message) *dap.StepInTargetsResponse { + t.Helper() + r, ok := m.(*dap.StepInTargetsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.StepInTargetsResponse", m) + } + return r +} + +// ExpectStepOutResponse reads a protocol message from the connection +// and fails the test if the read message is not *StepOutResponse. +func (c *Client) ExpectStepOutResponse(t *testing.T) *dap.StepOutResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckStepOutResponse(t, m) +} + +// CheckStepOutResponse fails the test if m is not *StepOutResponse. +func (c *Client) CheckStepOutResponse(t *testing.T, m dap.Message) *dap.StepOutResponse { + t.Helper() + _, ok := m.(*dap.ContinuedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ContinuedEvent", m) + } + m = c.ExpectMessage(t) + r, ok := m.(*dap.StepOutResponse) + if !ok { + t.Fatalf("got %#v, want *dap.StepOutResponse", m) + } + return r +} + +// ExpectStoppedEvent reads a protocol message from the connection +// and fails the test if the read message is not *StoppedEvent. +func (c *Client) ExpectStoppedEvent(t *testing.T) *dap.StoppedEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckStoppedEvent(t, m) +} + +// CheckStoppedEvent fails the test if m is not *StoppedEvent. +func (c *Client) CheckStoppedEvent(t *testing.T, m dap.Message) *dap.StoppedEvent { + t.Helper() + r, ok := m.(*dap.StoppedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.StoppedEvent", m) + } + return r +} + +// ExpectTerminateResponse reads a protocol message from the connection +// and fails the test if the read message is not *TerminateResponse. +func (c *Client) ExpectTerminateResponse(t *testing.T) *dap.TerminateResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckTerminateResponse(t, m) +} + +// CheckTerminateResponse fails the test if m is not *TerminateResponse. +func (c *Client) CheckTerminateResponse(t *testing.T, m dap.Message) *dap.TerminateResponse { + t.Helper() + r, ok := m.(*dap.TerminateResponse) + if !ok { + t.Fatalf("got %#v, want *dap.TerminateResponse", m) + } + return r +} + +// ExpectTerminateThreadsResponse reads a protocol message from the connection +// and fails the test if the read message is not *TerminateThreadsResponse. +func (c *Client) ExpectTerminateThreadsResponse(t *testing.T) *dap.TerminateThreadsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckTerminateThreadsResponse(t, m) +} + +// CheckTerminateThreadsResponse fails the test if m is not *TerminateThreadsResponse. +func (c *Client) CheckTerminateThreadsResponse(t *testing.T, m dap.Message) *dap.TerminateThreadsResponse { + t.Helper() + r, ok := m.(*dap.TerminateThreadsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.TerminateThreadsResponse", m) + } + return r +} + +// ExpectTerminatedEvent reads a protocol message from the connection +// and fails the test if the read message is not *TerminatedEvent. +func (c *Client) ExpectTerminatedEvent(t *testing.T) *dap.TerminatedEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckTerminatedEvent(t, m) +} + +// CheckTerminatedEvent fails the test if m is not *TerminatedEvent. +func (c *Client) CheckTerminatedEvent(t *testing.T, m dap.Message) *dap.TerminatedEvent { + t.Helper() + r, ok := m.(*dap.TerminatedEvent) + if !ok { + t.Fatalf("got %#v, want *dap.TerminatedEvent", m) + } + return r +} + +// ExpectThreadEvent reads a protocol message from the connection +// and fails the test if the read message is not *ThreadEvent. +func (c *Client) ExpectThreadEvent(t *testing.T) *dap.ThreadEvent { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckThreadEvent(t, m) +} + +// CheckThreadEvent fails the test if m is not *ThreadEvent. +func (c *Client) CheckThreadEvent(t *testing.T, m dap.Message) *dap.ThreadEvent { + t.Helper() + r, ok := m.(*dap.ThreadEvent) + if !ok { + t.Fatalf("got %#v, want *dap.ThreadEvent", m) + } + return r +} + +// ExpectThreadsResponse reads a protocol message from the connection +// and fails the test if the read message is not *ThreadsResponse. +func (c *Client) ExpectThreadsResponse(t *testing.T) *dap.ThreadsResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckThreadsResponse(t, m) +} + +// CheckThreadsResponse fails the test if m is not *ThreadsResponse. +func (c *Client) CheckThreadsResponse(t *testing.T, m dap.Message) *dap.ThreadsResponse { + t.Helper() + r, ok := m.(*dap.ThreadsResponse) + if !ok { + t.Fatalf("got %#v, want *dap.ThreadsResponse", m) + } + return r +} + +// ExpectVariablesResponse reads a protocol message from the connection +// and fails the test if the read message is not *VariablesResponse. +func (c *Client) ExpectVariablesResponse(t *testing.T) *dap.VariablesResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckVariablesResponse(t, m) +} + +// CheckVariablesResponse fails the test if m is not *VariablesResponse. +func (c *Client) CheckVariablesResponse(t *testing.T, m dap.Message) *dap.VariablesResponse { + t.Helper() + r, ok := m.(*dap.VariablesResponse) + if !ok { + t.Fatalf("got %#v, want *dap.VariablesResponse", m) + } + return r +} + +// ExpectWriteMemoryResponse reads a protocol message from the connection +// and fails the test if the read message is not *WriteMemoryResponse. +func (c *Client) ExpectWriteMemoryResponse(t *testing.T) *dap.WriteMemoryResponse { + t.Helper() + m := c.ExpectMessage(t) + return c.CheckWriteMemoryResponse(t, m) +} + +// CheckWriteMemoryResponse fails the test if m is not *WriteMemoryResponse. +func (c *Client) CheckWriteMemoryResponse(t *testing.T, m dap.Message) *dap.WriteMemoryResponse { + t.Helper() + r, ok := m.(*dap.WriteMemoryResponse) + if !ok { + t.Fatalf("got %#v, want *dap.WriteMemoryResponse", m) + } + return r +} diff --git a/service/dap/error_ids.go b/service/dap/error_ids.go index 84903eb013..0956777622 100644 --- a/service/dap/error_ids.go +++ b/service/dap/error_ids.go @@ -10,13 +10,25 @@ const ( // Where applicable and for consistency only, // values below are inspired the original vscode-go debug adaptor. - FailedToLaunch = 3000 - FailedtoAttach = 3001 - UnableToDisplayThreads = 2003 - UnableToProduceStackTrace = 2004 - UnableToListLocals = 2005 - UnableToListArgs = 2006 - UnableToListGlobals = 2007 - UnableToLookupVariable = 2008 + FailedToLaunch = 3000 + FailedToAttach = 3001 + FailedToInitialize = 3002 + UnableToSetBreakpoints = 2002 + UnableToDisplayThreads = 2003 + UnableToProduceStackTrace = 2004 + UnableToListLocals = 2005 + UnableToListArgs = 2006 + UnableToListGlobals = 2007 + UnableToLookupVariable = 2008 + UnableToEvaluateExpression = 2009 + UnableToHalt = 2010 + UnableToGetExceptionInfo = 2011 + UnableToSetVariable = 2012 + UnableToDisassemble = 2013 + UnableToListRegisters = 2014 + UnableToRunDlvCommand = 2015 // Add more codes as we support more requests + NoDebugIsRunning = 3000 + DebuggeeIsRunning = 4000 + DisconnectError = 5000 ) diff --git a/service/dap/handles.go b/service/dap/handles.go index 05bfd3ddf0..8c1f949709 100644 --- a/service/dap/handles.go +++ b/service/dap/handles.go @@ -1,5 +1,7 @@ package dap +import "github.com/go-delve/delve/pkg/proc" + const startHandle = 1000 // handlesMap maps arbitrary values to unique sequential ids. @@ -12,6 +14,21 @@ type handlesMap struct { handleToVal map[int]interface{} } +type fullyQualifiedVariable struct { + *proc.Variable + // A way to load this variable by either using all names in the hierarchic + // sequence above this variable (most readable when referenced by the UI) + // if available or a special expression based on: + // https://github.com/go-delve/delve/blob/master/Documentation/api/ClientHowto.md#loading-more-of-a-variable + // Empty if the variable cannot or should not be reloaded. + fullyQualifiedNameOrExpr string + // True if this represents variable scope + isScope bool + // startIndex is the index of the first child for an array or slice. + // This variable represents a chunk of the array, slice or map. + startIndex int +} + func newHandlesMap() *handlesMap { return &handlesMap{startHandle, make(map[int]interface{})} } @@ -32,3 +49,27 @@ func (hs *handlesMap) get(handle int) (interface{}, bool) { v, ok := hs.handleToVal[handle] return v, ok } + +type variablesHandlesMap struct { + m *handlesMap +} + +func newVariablesHandlesMap() *variablesHandlesMap { + return &variablesHandlesMap{newHandlesMap()} +} + +func (hs *variablesHandlesMap) create(value *fullyQualifiedVariable) int { + return hs.m.create(value) +} + +func (hs *variablesHandlesMap) get(handle int) (*fullyQualifiedVariable, bool) { + v, ok := hs.m.get(handle) + if !ok { + return nil, false + } + return v.(*fullyQualifiedVariable), true +} + +func (hs *variablesHandlesMap) reset() { + hs.m.reset() +} diff --git a/service/dap/server.go b/service/dap/server.go index c87e094626..db7f1a17e4 100644 --- a/service/dap/server.go +++ b/service/dap/server.go @@ -10,143 +10,432 @@ package dap import ( "bufio" + "bytes" "encoding/json" + "errors" "fmt" + "go/constant" + "go/parser" "io" + "io/ioutil" + "math" "net" "os" + "os/exec" "path/filepath" "reflect" + "regexp" + "runtime" + "runtime/debug" + "sort" + "strconv" + "strings" + "sync" + "time" "github.com/go-delve/delve/pkg/gobuild" + "github.com/go-delve/delve/pkg/goversion" + "github.com/go-delve/delve/pkg/locspec" "github.com/go-delve/delve/pkg/logflags" "github.com/go-delve/delve/pkg/proc" + "github.com/go-delve/delve/service" "github.com/go-delve/delve/service/api" "github.com/go-delve/delve/service/debugger" + "github.com/go-delve/delve/service/internal/sameuser" "github.com/google/go-dap" + "github.com/sirupsen/logrus" ) // Server implements a DAP server that can accept a single client for -// a single debug session. It does not support restarting. -// The server operates via two goroutines: +// a single debug session (for now). It does not yet support restarting. +// That means that in addition to explicit shutdown requests, +// program termination and failed or closed client connection +// would also result in stopping this single-use server. +// +// The DAP server operates via the following goroutines: +// // (1) Main goroutine where the server is created via NewServer(), -// started via Run() and stopped via Stop(). -// (2) Run goroutine started from Run() that accepts a client connection, -// reads, decodes and processes each request, issuing commands to the -// underlying debugger and sending back events and responses. -// TODO(polina): make it asynchronous (i.e. launch goroutine per request) +// started via Run() and stopped via Stop(). Once the server is +// started, this goroutine blocks until it receives a stop-server +// signal that can come from an OS interrupt (such as Ctrl-C) or +// config.DisconnectChan (passed to NewServer()) as a result of +// client connection failure or closure or a DAP disconnect request. +// +// (2) Run goroutine started from Run() that serves as both +// a listener and a client goroutine. It accepts a client connection, +// reads, decodes and dispatches each request from the client. +// For synchronous requests, it issues commands to the +// underlying debugger and sends back events and responses. +// These requests block while the debuggee is running, so, +// where applicable, the handlers need to check if debugging +// state is running, so there is a need for a halt request or +// a dummy/error response to avoid blocking. +// +// This is the only goroutine that sends a stop-server signal +// via config.DisconnecChan when encountering a client connection +// error or responding to a (synchronous) DAP disconnect request. +// Once stop is triggered, the goroutine exits. +// +// Unlike rpccommon, there is not another layer of per-client +// goroutines here because the dap server does not support +// multiple clients. +// +// (3) Per-request goroutine is started for each asynchronous request +// that resumes execution. We check if target is running already, so +// there should be no more than one pending asynchronous request at +// a time. This goroutine issues commands to the underlying debugger +// and sends back events and responses. It takes a setup-done channel +// as an argument and temporarily blocks the request loop until setup +// for asynchronous execution is complete and targe is running. +// Once done, it unblocks processing of parallel requests unblocks +// (e.g. disconnecting while the program is running). +// +// These per-request goroutines never send a stop-server signal. +// They block on running debugger commands that are interrupted +// when halt is issued while stopping. At that point these goroutines +// wrap-up and exit. type Server struct { // config is all the information necessary to start the debugger and server. - config *service.Config + config *Config // listener is used to accept the client connection. + // When working with a predetermined client, this is nil. listener net.Listener - // conn is the accepted client connection. - conn net.Conn - // stopChan is closed when the server is Stop()-ed. This can be used to signal - // to goroutines run by the server that it's time to quit. - stopChan chan struct{} - // reader is used to read requests from the connection. - reader *bufio.Reader - // debugger is the underlying debugger service. - debugger *debugger.Debugger - // log is used for structured logging. - log *logrus.Entry - // binaryToRemove is the compiled binary to be removed on disconnect. - binaryToRemove string + // session is the debug session that comes with an client connection. + session *Session + sessionMu sync.Mutex +} + +// Session is an abstraction for serving and shutting down +// a DAP debug session with a pre-connected client. +// TODO(polina): move this to a different file/package +type Session struct { + config *Config + + id int + // stackFrameHandles maps frames of each goroutine to unique ids across all goroutines. + // Reset at every stop. stackFrameHandles *handlesMap // variableHandles maps compound variables to unique references within their stack frame. + // Reset at every stop. // See also comment for convertVariable. - variableHandles *handlesMap + variableHandles *variablesHandlesMap // args tracks special settings for handling debug session requests. args launchAttachArgs + // exceptionErr tracks the runtime error that last occurred. + exceptionErr error + // clientCapabilities tracks special settings for handling debug session requests. + clientCapabilities dapClientCapabilites + + // mu synchronizes access to objects set on start-up (from run goroutine) + // and stopped on teardown (from main goroutine) + mu sync.Mutex + + // conn is the accepted client connection. + conn *connection + // debugger is the underlying debugger service. + debugger *debugger.Debugger + // binaryToRemove is the temp compiled binary to be removed on disconnect (if any). + binaryToRemove string + // noDebugProcess is set for the noDebug launch process. + noDebugProcess *process + + // sendingMu synchronizes writing to conn + // to ensure that messages do not get interleaved + sendingMu sync.Mutex + + // runningCmd tracks whether the server is running an asyncronous + // command that resumes execution, which may not correspond to the actual + // running state of the process (e.g. if a command is temporarily interrupted). + runningCmd bool + runningMu sync.Mutex + + // haltRequested tracks whether a halt of the program has been requested, which may + // not correspond to whether a Halt Request has been sent to the target. + haltRequested bool + haltMu sync.Mutex + + // changeStateMu must be held for a request to protect itself from another goroutine + // changing the state of the running process at the same time. + changeStateMu sync.Mutex +} + +// Config is all the information needed to start the debugger, handle +// DAP connection traffic and signal to the server when it is time to stop. +type Config struct { + *service.Config + + // log is used for structured logging. + log *logrus.Entry + // StopTriggered is closed when the server is Stop()-ed. + // Can be used to safeguard against duplicate shutdown sequences. + StopTriggered chan struct{} +} + +type connection struct { + io.ReadWriteCloser + closed chan struct{} +} + +func (c *connection) Close() error { + select { + case <-c.closed: + default: + close(c.closed) + } + return c.ReadWriteCloser.Close() +} + +func (c *connection) isClosed() bool { + select { + case <-c.closed: + return true + default: + return false + } +} + +type process struct { + *exec.Cmd + exited chan struct{} } // launchAttachArgs captures arguments from launch/attach request that // impact handling of subsequent requests. +// The fields with cfgName tag can be updated through an evaluation request. type launchAttachArgs struct { // stopOnEntry is set to automatically stop the debugee after start. stopOnEntry bool - // stackTraceDepth is the maximum length of the returned list of stack frames. - stackTraceDepth int + // StackTraceDepth is the maximum length of the returned list of stack frames. + StackTraceDepth int `cfgName:"stackTraceDepth"` + // ShowGlobalVariables indicates if global package variables should be loaded. + ShowGlobalVariables bool `cfgName:"showGlobalVariables"` + // ShowRegisters indicates if register values should be loaded. + ShowRegisters bool `cfgName:"showRegisters"` + // GoroutineFilters are the filters used when loading goroutines. + GoroutineFilters string `cfgName:"goroutineFilters"` + // HideSystemGoroutines indicates if system goroutines should be removed from threads + // responses. + HideSystemGoroutines bool `cfgName:"hideSystemGoroutines"` + // substitutePathClientToServer indicates rules for converting file paths between client and debugger. + // These must be directory paths. + substitutePathClientToServer [][2]string `cfgName:"substitutePath"` + // substitutePathServerToClient indicates rules for converting file paths between debugger and client. + // These must be directory paths. + substitutePathServerToClient [][2]string } // defaultArgs borrows the defaults for the arguments from the original vscode-go adapter. +// TODO(polinasok): clean up this and its reference (Server.args) +// in favor of default*Config variables defined in types.go. var defaultArgs = launchAttachArgs{ - stopOnEntry: false, - stackTraceDepth: 50, + stopOnEntry: false, + StackTraceDepth: 50, + ShowGlobalVariables: false, + HideSystemGoroutines: false, + ShowRegisters: false, + GoroutineFilters: "", + substitutePathClientToServer: [][2]string{}, + substitutePathServerToClient: [][2]string{}, +} + +// dapClientCapabilites captures arguments from intitialize request that +// impact handling of subsequent requests. +type dapClientCapabilites struct { + supportsVariableType bool + supportsVariablePaging bool + supportsRunInTerminalRequest bool + supportsMemoryReferences bool + supportsProgressReporting bool +} + +// DefaultLoadConfig controls how variables are loaded from the target's memory. +// These limits are conservative to minimize performace overhead for bulk loading. +// With dlv-dap, users do not have a way to adjust these. +// Instead we are focusing in interacive loading with nested reloads, array/map +// paging and context-specific string limits. +var DefaultLoadConfig = proc.LoadConfig{ + FollowPointers: true, + MaxVariableRecurse: 1, + // TODO(polina): consider 1024 limit instead: + // - vscode+C appears to use 1024 as the load limit + // - vscode viewlet hover truncates at 1023 characters + MaxStringLen: 512, + MaxArrayValues: 64, + MaxStructFields: -1, } +const ( + // When a user examines a single string, we can relax the loading limit. + maxSingleStringLen = 4 << 10 // 4096 + // Results of a call are single-use and transient. We need to maximize + // what is presented. A common use case of a call injection is to + // stringify complex data conveniently. + maxStringLenInCallRetVars = 1 << 10 // 1024 +) + +var ( + // Max number of goroutines that we will return. + // This is a var for testing + maxGoroutines = 1 << 10 +) + // NewServer creates a new DAP Server. It takes an opened Listener -// via config and assumes its ownership. config.disconnectChan has to be set; -// it will be closed by the server when the client disconnects or requests -// shutdown. Once disconnectChan is closed, Server.Stop() must be called. +// via config and assumes its ownership. config.DisconnectChan has to be set; +// it will be closed by the server when the client fails to connect, +// disconnects or requests shutdown. Once config.DisconnectChan is closed, +// Server.Stop() must be called to shutdown this single-user server. +// +// NewServer can be used to create a special DAP Server that works +// only with a predetermined client. In that case, config.Listener is +// nil and its RunWithClient must be used instead of Run. func NewServer(config *service.Config) *Server { logger := logflags.DAPLogger() - logflags.WriteDAPListeningMessage(config.Listener.Addr().String()) + if config.Listener != nil { + logflags.WriteDAPListeningMessage(config.Listener.Addr()) + } else { + logger.Debug("DAP server for a predetermined client") + } logger.Debug("DAP server pid = ", os.Getpid()) + if config.AcceptMulti { + logger.Warn("DAP server does not support accept-multiclient mode") + config.AcceptMulti = false + } return &Server{ + config: &Config{ + Config: config, + log: logger, + StopTriggered: make(chan struct{}), + }, + listener: config.Listener, + } +} + +var sessionCount = 0 + +// NewSession creates a new client session that can handle DAP traffic. +// It takes an open connection and provides a Close() method to shut it +// down when the DAP session disconnects or a connection error occurs. +func NewSession(conn io.ReadWriteCloser, config *Config, debugger *debugger.Debugger) *Session { + sessionCount++ + if config.log == nil { + config.log = logflags.DAPLogger() + } + config.log.Debugf("DAP connection %d started", sessionCount) + if config.StopTriggered == nil { + config.log.Fatal("Session must be configured with StopTriggered") + } + return &Session{ config: config, - listener: config.Listener, - stopChan: make(chan struct{}), - log: logger, + id: sessionCount, + conn: &connection{conn, make(chan struct{})}, stackFrameHandles: newHandlesMap(), - variableHandles: newHandlesMap(), + variableHandles: newVariablesHandlesMap(), args: defaultArgs, + exceptionErr: nil, + debugger: debugger, + } +} + +// If user-specified options are provided via Launch/AttachRequest, +// we override the defaults for optional args. +func (s *Session) setLaunchAttachArgs(args LaunchAttachCommonConfig) error { + s.args.stopOnEntry = args.StopOnEntry + if depth := args.StackTraceDepth; depth > 0 { + s.args.StackTraceDepth = depth + } + s.args.ShowGlobalVariables = args.ShowGlobalVariables + s.args.ShowRegisters = args.ShowRegisters + s.args.HideSystemGoroutines = args.HideSystemGoroutines + s.args.GoroutineFilters = args.GoroutineFilters + if paths := args.SubstitutePath; len(paths) > 0 { + clientToServer := make([][2]string, 0, len(paths)) + serverToClient := make([][2]string, 0, len(paths)) + for _, p := range paths { + clientToServer = append(clientToServer, [2]string{p.From, p.To}) + serverToClient = append(serverToClient, [2]string{p.To, p.From}) + } + s.args.substitutePathClientToServer = clientToServer + s.args.substitutePathServerToClient = serverToClient } + return nil } // Stop stops the DAP debugger service, closes the listener and the client // connection. It shuts down the underlying debugger and kills the target -// process if it was launched by it. This method mustn't be called more than -// once. +// process if it was launched by it or stops the noDebug process. +// This method mustn't be called more than once. +// StopTriggered notifies other goroutines that stop is in progreess. func (s *Server) Stop() { - s.listener.Close() - close(s.stopChan) - if s.conn != nil { - // Unless Stop() was called after serveDAPCodec() - // returned, this will result in closed connection error - // on next read, breaking out of the read loop and - // allowing the run goroutine to exit. - s.conn.Close() + s.config.log.Debug("DAP server stopping...") + defer s.config.log.Debug("DAP server stopped") + close(s.config.StopTriggered) + + if s.listener != nil { + // If run goroutine is blocked on accept, this will unblock it. + _ = s.listener.Close() + } + + s.sessionMu.Lock() + defer s.sessionMu.Unlock() + if s.session == nil { + return } + // If run goroutine is blocked on read, this will unblock it. + s.session.Close() +} + +// Close closes the underlying debugger/process and connection. +// May be called more than once. +func (s *Session) Close() { + s.mu.Lock() + defer s.mu.Unlock() + if s.debugger != nil { - kill := s.config.Debugger.AttachPid == 0 - if err := s.debugger.Detach(kill); err != nil { - s.log.Error(err) - } + killProcess := s.config.Debugger.AttachPid == 0 + s.stopDebugSession(killProcess) + } else if s.noDebugProcess != nil { + s.stopNoDebugProcess() } + // The binary is no longer in use by the debugger. It is safe to remove it. + if s.binaryToRemove != "" { + gobuild.Remove(s.binaryToRemove) + s.binaryToRemove = "" // avoid error printed on duplicate removal + } + // Close client connection last, so other shutdown stages + // can send client notifications. + // Unless Stop() was called after read loop in ServeDAPCodec() + // returned, this will result in a closed connection error + // on next read, breaking out the read loop andd + // allowing the run goroutinee to exit. + // This connection is closed here and in serveDAPCodec(). + // If this was a forced shutdown, external stop logic can close this first. + // If this was a client loop exit (on error or disconnect), serveDAPCodec() + // will be first. + // Duplicate close calls return an error, but are not fatal. + _ = s.conn.Close() } -// signalDisconnect closes config.DisconnectChan if not nil, which -// signals that the client disconnected or there was a client -// connection failure. Since the server currently services only one -// client, this can be used as a signal to the entire server via -// Stop(). The function safeguards agaist closing the channel more +// triggerServerStop closes DisconnectChan if not nil, which +// signals that client sent a disconnect request or there was connection +// failure or closure. Since the server currently services only one +// client, this is used as a signal to stop the entire server. +// The function safeguards agaist closing the channel more // than once and can be called multiple times. It is not thread-safe // and is currently only called from the run goroutine. -// TODO(polina): lock this when we add more goroutines that could call -// this when we support asynchronous request-response communication. -func (s *Server) signalDisconnect() { +func (c *Config) triggerServerStop() { // Avoid accidentally closing the channel twice and causing a panic, when - // this function is called more than once. For example, we could have the - // following sequence of events: - // -- run goroutine: calls onDisconnectRequest() - // -- run goroutine: calls signalDisconnect() - // -- main goroutine: calls Stop() - // -- main goroutine: Stop() closes client connection - // -- run goroutine: serveDAPCodec() gets "closed network connection" - // -- run goroutine: serveDAPCodec() returns - // -- run goroutine: serveDAPCodec calls signalDisconnect() - if s.config.DisconnectChan != nil { - close(s.config.DisconnectChan) - s.config.DisconnectChan = nil - } - if s.binaryToRemove != "" { - gobuild.Remove(s.binaryToRemove) + // this function is called more than once because stop was triggered + // by multiple conditions simultenously. + if c.DisconnectChan != nil { + close(c.DisconnectChan) + c.DisconnectChan = nil } + // There should be no logic here after the stop-server + // signal that might cause everything to shutdown before this + // logic gets executed. } // Run launches a new goroutine where it accepts a client connection @@ -155,207 +444,341 @@ func (s *Server) signalDisconnect() { // The server should be restarted for every new debug session. // The debugger won't be started until launch/attach request is received. // TODO(polina): allow new client connections for new debug sessions, -// so the editor needs to launch delve only once? +// so the editor needs to launch dap server only once? Note that some requests +// may change the server's environment (e.g. see dlvCwd of launch configuration). +// So if we want to reuse this server for multiple independent debugging sessions +// we need to take that into consideration. func (s *Server) Run() { + if s.listener == nil { + s.config.log.Fatal("Misconfigured server: no Listener is configured.") + return + } + go func() { - conn, err := s.listener.Accept() + conn, err := s.listener.Accept() // listener is closed in Stop() if err != nil { select { - case <-s.stopChan: + case <-s.config.StopTriggered: default: - s.log.Errorf("Error accepting client connection: %s\n", err) + s.config.log.Errorf("Error accepting client connection: %s\n", err) + s.config.triggerServerStop() } - s.signalDisconnect() return } - s.conn = conn - s.serveDAPCodec() + if s.config.CheckLocalConnUser { + if !sameuser.CanAccept(s.listener.Addr(), conn.LocalAddr(), conn.RemoteAddr()) { + s.config.log.Error("Error accepting client connection: Only connections from the same user that started this instance of Delve are allowed to connect. See --only-same-user.") + s.config.triggerServerStop() + return + } + } + s.runSession(conn) }() } -// serveDAPCodec reads and decodes requests from the client +func (s *Server) runSession(conn io.ReadWriteCloser) { + s.sessionMu.Lock() + s.session = NewSession(conn, s.config, nil) // closed in Stop() + s.sessionMu.Unlock() + s.session.ServeDAPCodec() +} + +// RunWithClient is similar to Run but works only with an already established +// connection instead of waiting on the listener to accept a new client. +// RunWithClient takes ownership of conn. Debugger won't be started +// until a launch/attach request is received over the connection. +func (s *Server) RunWithClient(conn net.Conn) { + if s.listener != nil { + s.config.log.Fatal("RunWithClient must not be used when the Server is configured with a Listener") + return + } + s.config.log.Debugf("Connected to the client at %s", conn.RemoteAddr()) + go s.runSession(conn) +} + +func (s *Session) address() string { + if s.config.Listener != nil { + return s.config.Listener.Addr().String() + } + if netconn, ok := s.conn.ReadWriteCloser.(net.Conn); ok { + return netconn.LocalAddr().String() + } + return "" +} + +// ServeDAPCodec reads and decodes requests from the client // until it encounters an error or EOF, when it sends -// the disconnect signal and returns. -func (s *Server) serveDAPCodec() { - defer s.signalDisconnect() - s.reader = bufio.NewReader(s.conn) +// a disconnect signal and returns. +func (s *Session) ServeDAPCodec() { + // Close conn, but not the debugger in case we are in AcceptMuli mode. + // If not, debugger will be shut down in Stop(). + defer s.conn.Close() + reader := bufio.NewReader(s.conn) for { - request, err := dap.ReadProtocolMessage(s.reader) - // TODO(polina): Differentiate between errors and handle them - // gracefully. For example, + request, err := dap.ReadProtocolMessage(reader) + // Handle dap.DecodeProtocolMessageFieldError errors gracefully by responding with an ErrorResponse. + // For example: // -- "Request command 'foo' is not supported" means we // potentially got some new DAP request that we do not yet have // decoding support for, so we can respond with an ErrorResponse. - // TODO(polina): to support this add Seq to - // dap.DecodeProtocolMessageFieldError. + // + // Other errors, such as unmarshalling errors, will log the error and cause the server to trigger + // a stop. if err != nil { - stopRequested := false + s.config.log.Debug("DAP error: ", err) select { - case <-s.stopChan: - stopRequested = true + case <-s.config.StopTriggered: default: - } - if err != io.EOF && !stopRequested { - s.log.Error("DAP error: ", err) + if !s.config.AcceptMulti { + defer s.config.triggerServerStop() + } + if err != io.EOF { // EOF means client closed connection + if decodeErr, ok := err.(*dap.DecodeProtocolMessageFieldError); ok { + // Send an error response to the users if we were unable to process the message. + s.sendInternalErrorResponse(decodeErr.Seq, err.Error()) + continue + } + s.config.log.Error("DAP error: ", err) + } } return } s.handleRequest(request) + + if _, ok := request.(*dap.DisconnectRequest); ok { + // disconnect already shut things down and triggered stopping + return + } } } -func (s *Server) handleRequest(request dap.Message) { - defer func() { - // In case a handler panics, we catch the panic and send an error response - // back to the client. - if ierr := recover(); ierr != nil { - s.sendInternalErrorResponse(request.GetSeq(), fmt.Sprintf("%v", ierr)) - } - }() +// In case a handler panics, we catch the panic to avoid crashing both +// the server and the target. We send an error response back, but +// in case its a dup and ignored by the client, we also log the error. +func (s *Session) recoverPanic(request dap.Message) { + if ierr := recover(); ierr != nil { + s.config.log.Errorf("recovered panic: %s\n%s\n", ierr, debug.Stack()) + s.sendInternalErrorResponse(request.GetSeq(), fmt.Sprintf("%v", ierr)) + } +} +func (s *Session) handleRequest(request dap.Message) { + defer s.recoverPanic(request) jsonmsg, _ := json.Marshal(request) - s.log.Debug("[<- from client]", string(jsonmsg)) + s.config.log.Debug("[<- from client]", string(jsonmsg)) + + if _, ok := request.(dap.RequestMessage); !ok { + s.sendInternalErrorResponse(request.GetSeq(), fmt.Sprintf("Unable to process non-request %#v\n", request)) + return + } + if s.isNoDebug() { + switch request := request.(type) { + case *dap.DisconnectRequest: + s.onDisconnectRequest(request) + case *dap.RestartRequest: + s.sendUnsupportedErrorResponse(request.Request) + default: + r := request.(dap.RequestMessage).GetRequest() + s.sendErrorResponse(*r, NoDebugIsRunning, "noDebug mode", fmt.Sprintf("unable to process '%s' request", r.Command)) + } + return + } + + // These requests, can be handled regardless of whether the targret is running switch request := request.(type) { - case *dap.InitializeRequest: - // Required + case *dap.InitializeRequest: // Required s.onInitializeRequest(request) - case *dap.LaunchRequest: - // Required + return + case *dap.LaunchRequest: // Required s.onLaunchRequest(request) - case *dap.AttachRequest: - // Required - // TODO: implement this request in V0 + return + case *dap.AttachRequest: // Required s.onAttachRequest(request) - case *dap.DisconnectRequest: - // Required + return + case *dap.DisconnectRequest: // Required s.onDisconnectRequest(request) - case *dap.TerminateRequest: - // Optional (capability ‘supportsTerminateRequest‘) - // TODO: implement this request in V1 - s.onTerminateRequest(request) - case *dap.RestartRequest: - // Optional (capability ‘supportsRestartRequest’) - // TODO: implement this request in V1 - s.onRestartRequest(request) - case *dap.SetBreakpointsRequest: - // Required + return + case *dap.PauseRequest: // Required + s.onPauseRequest(request) + return + case *dap.TerminateRequest: // Optional (capability ‘supportsTerminateRequest‘) + /*TODO*/ s.onTerminateRequest(request) // not yet implemented + return + case *dap.RestartRequest: // Optional (capability ‘supportsRestartRequest’) + /*TODO*/ s.onRestartRequest(request) // not yet implemented + return + } + + // Most requests cannot be processed while the debuggee is running. + // We have a couple of options for handling these without blocking + // the request loop indefinitely when we are in running state. + // --1-- Return a dummy response or an error right away. + // --2-- Halt execution, process the request, maybe resume execution. + // --3-- Handle such requests asynchronously and let them block until + // the process stops or terminates (e.g. using a channel and a single + // goroutine to preserve the order). This might not be appropriate + // for requests such as continue or step because they would skip + // the stop, resuming execution right away. Other requests + // might not be relevant anymore when the stop is finally reached, and + // state changed from the previous snapshot. The user might want to + // resume execution before the backlog of buffered requests is cleared, + // so we would have to either cancel them or delay processing until + // the next stop. In addition, the editor itself might block waiting + // for these requests to return. We are not aware of any requests + // that would benefit from this approach at this time. + if s.debugger != nil && s.debugger.IsRunning() || s.isRunningCmd() { + switch request := request.(type) { + case *dap.ThreadsRequest: // Required + // On start-up, the client requests the baseline of currently existing threads + // right away as there are a number of DAP requests that require a thread id + // (pause, continue, stacktrace, etc). This can happen after the program + // continues on entry, preventing the client from handling any pause requests + // from the user. We remedy this by sending back a placeholder thread id + // for the current goroutine. + response := &dap.ThreadsResponse{ + Response: *newResponse(request.Request), + Body: dap.ThreadsResponseBody{Threads: []dap.Thread{{Id: -1, Name: "Current"}}}, + } + s.send(response) + case *dap.SetBreakpointsRequest: // Required + s.changeStateMu.Lock() + defer s.changeStateMu.Unlock() + s.config.log.Debug("halting execution to set breakpoints") + _, err := s.halt() + if err != nil { + s.sendErrorResponse(request.Request, UnableToSetBreakpoints, "Unable to set or clear breakpoints", err.Error()) + return + } + s.onSetBreakpointsRequest(request) + case *dap.SetFunctionBreakpointsRequest: // Optional (capability ‘supportsFunctionBreakpoints’) + s.changeStateMu.Lock() + defer s.changeStateMu.Unlock() + s.config.log.Debug("halting execution to set breakpoints") + _, err := s.halt() + if err != nil { + s.sendErrorResponse(request.Request, UnableToSetBreakpoints, "Unable to set or clear breakpoints", err.Error()) + return + } + s.onSetFunctionBreakpointsRequest(request) + default: + r := request.(dap.RequestMessage).GetRequest() + s.sendErrorResponse(*r, DebuggeeIsRunning, fmt.Sprintf("Unable to process `%s`", r.Command), "debuggee is running") + } + return + } + + // Requests below can only be handled while target is stopped. + // Some of them are blocking and will be handled synchronously + // on this goroutine while non-blocking requests will be dispatched + // to another goroutine. Please note that because of the running + // check above, there should be no more than one pending asynchronous + // request at a time. + + // Non-blocking request handlers will signal when they are ready + // setting up for async execution, so more requests can be processed. + resumeRequestLoop := make(chan struct{}) + + switch request := request.(type) { + //--- Asynchronous requests --- + case *dap.ConfigurationDoneRequest: // Optional (capability ‘supportsConfigurationDoneRequest’) + go func() { + defer s.recoverPanic(request) + s.onConfigurationDoneRequest(request, resumeRequestLoop) + }() + <-resumeRequestLoop + case *dap.ContinueRequest: // Required + go func() { + defer s.recoverPanic(request) + s.onContinueRequest(request, resumeRequestLoop) + }() + <-resumeRequestLoop + case *dap.NextRequest: // Required + go func() { + defer s.recoverPanic(request) + s.onNextRequest(request, resumeRequestLoop) + }() + <-resumeRequestLoop + case *dap.StepInRequest: // Required + go func() { + defer s.recoverPanic(request) + s.onStepInRequest(request, resumeRequestLoop) + }() + <-resumeRequestLoop + case *dap.StepOutRequest: // Required + go func() { + defer s.recoverPanic(request) + s.onStepOutRequest(request, resumeRequestLoop) + }() + <-resumeRequestLoop + case *dap.StepBackRequest: // Optional (capability ‘supportsStepBack’) + go func() { + defer s.recoverPanic(request) + s.onStepBackRequest(request, resumeRequestLoop) + }() + <-resumeRequestLoop + case *dap.ReverseContinueRequest: // Optional (capability ‘supportsStepBack’) + go func() { + defer s.recoverPanic(request) + s.onReverseContinueRequest(request, resumeRequestLoop) + }() + <-resumeRequestLoop + //--- Synchronous requests --- + case *dap.SetBreakpointsRequest: // Required s.onSetBreakpointsRequest(request) - case *dap.SetFunctionBreakpointsRequest: - // Optional (capability ‘supportsFunctionBreakpoints’) - // TODO: implement this request in V1 + case *dap.SetFunctionBreakpointsRequest: // Optional (capability ‘supportsFunctionBreakpoints’) s.onSetFunctionBreakpointsRequest(request) - case *dap.SetExceptionBreakpointsRequest: - // Optional (capability ‘exceptionBreakpointFilters’) + case *dap.SetInstructionBreakpointsRequest: // Optional (capability 'supportsInstructionBreakpoints') + s.onSetInstructionBreakpointsRequest(request) + case *dap.SetExceptionBreakpointsRequest: // Optional (capability ‘exceptionBreakpointFilters’) s.onSetExceptionBreakpointsRequest(request) - case *dap.ConfigurationDoneRequest: - // Optional (capability ‘supportsConfigurationDoneRequest’) - // Supported by vscode-go - s.onConfigurationDoneRequest(request) - case *dap.ContinueRequest: - // Required - s.onContinueRequest(request) - case *dap.NextRequest: - // Required - s.onNextRequest(request) - case *dap.StepInRequest: - // Required - s.onStepInRequest(request) - case *dap.StepOutRequest: - // Required - s.onStepOutRequest(request) - case *dap.StepBackRequest: - // Optional (capability ‘supportsStepBack’) - // TODO: implement this request in V1 - s.onStepBackRequest(request) - case *dap.ReverseContinueRequest: - // Optional (capability ‘supportsStepBack’) - // TODO: implement this request in V1 - s.onReverseContinueRequest(request) - case *dap.RestartFrameRequest: - // Optional (capability ’supportsRestartFrame’) - s.sendUnsupportedErrorResponse(request.Request) - case *dap.GotoRequest: - // Optional (capability ‘supportsGotoTargetsRequest’) - s.sendUnsupportedErrorResponse(request.Request) - case *dap.PauseRequest: - // Required - // TODO: implement this request in V0 - s.onPauseRequest(request) - case *dap.StackTraceRequest: - // Required + case *dap.ThreadsRequest: // Required + s.onThreadsRequest(request) + case *dap.StackTraceRequest: // Required s.onStackTraceRequest(request) - case *dap.ScopesRequest: - // Required + case *dap.ScopesRequest: // Required s.onScopesRequest(request) - case *dap.VariablesRequest: - // Required + case *dap.VariablesRequest: // Required s.onVariablesRequest(request) - case *dap.SetVariableRequest: - // Optional (capability ‘supportsSetVariable’) - // Supported by vscode-go - // TODO: implement this request in V0 + case *dap.EvaluateRequest: // Required + s.onEvaluateRequest(request) + case *dap.SetVariableRequest: // Optional (capability ‘supportsSetVariable’) s.onSetVariableRequest(request) - case *dap.SetExpressionRequest: - // Optional (capability ‘supportsSetExpression’) - // TODO: implement this request in V1 - s.onSetExpressionRequest(request) - case *dap.SourceRequest: - // Required - // This does not make sense in the context of Go as - // the source cannot be a string eval'ed at runtime. - s.sendUnsupportedErrorResponse(request.Request) - case *dap.ThreadsRequest: - // Required - s.onThreadsRequest(request) - case *dap.TerminateThreadsRequest: - // Optional (capability ‘supportsTerminateThreadsRequest’) + case *dap.ExceptionInfoRequest: // Optional (capability ‘supportsExceptionInfoRequest’) + s.onExceptionInfoRequest(request) + case *dap.DisassembleRequest: // Optional (capability ‘supportsDisassembleRequest’) + s.onDisassembleRequest(request) + //--- Requests that we may want to support --- + case *dap.SourceRequest: // Required + /*TODO*/ s.sendUnsupportedErrorResponse(request.Request) // https://github.com/go-delve/delve/issues/2851 + case *dap.SetExpressionRequest: // Optional (capability ‘supportsSetExpression’) + /*TODO*/ s.onSetExpressionRequest(request) // Not yet implemented + case *dap.LoadedSourcesRequest: // Optional (capability ‘supportsLoadedSourcesRequest’) + /*TODO*/ s.onLoadedSourcesRequest(request) // Not yet implemented + case *dap.ReadMemoryRequest: // Optional (capability ‘supportsReadMemoryRequest‘) + /*TODO*/ s.onReadMemoryRequest(request) // Not yet implemented + case *dap.CancelRequest: // Optional (capability ‘supportsCancelRequest’) + /*TODO*/ s.onCancelRequest(request) // Not yet implemented (does this make sense?) + case *dap.ModulesRequest: // Optional (capability ‘supportsModulesRequest’) + /*TODO*/ s.sendUnsupportedErrorResponse(request.Request) // Not yet implemented (does this make sense?) + //--- Requests that we do not plan to support --- + case *dap.RestartFrameRequest: // Optional (capability ’supportsRestartFrame’) s.sendUnsupportedErrorResponse(request.Request) - case *dap.EvaluateRequest: - // Required - TODO - // TODO: implement this request in V0 - s.onEvaluateRequest(request) - case *dap.StepInTargetsRequest: - // Optional (capability ‘supportsStepInTargetsRequest’) + case *dap.GotoRequest: // Optional (capability ‘supportsGotoTargetsRequest’) s.sendUnsupportedErrorResponse(request.Request) - case *dap.GotoTargetsRequest: - // Optional (capability ‘supportsGotoTargetsRequest’) + case *dap.TerminateThreadsRequest: // Optional (capability ‘supportsTerminateThreadsRequest’) s.sendUnsupportedErrorResponse(request.Request) - case *dap.CompletionsRequest: - // Optional (capability ‘supportsCompletionsRequest’) + case *dap.StepInTargetsRequest: // Optional (capability ‘supportsStepInTargetsRequest’) s.sendUnsupportedErrorResponse(request.Request) - case *dap.ExceptionInfoRequest: - // Optional (capability ‘supportsExceptionInfoRequest’) - // TODO: does this request make sense for delve? + case *dap.GotoTargetsRequest: // Optional (capability ‘supportsGotoTargetsRequest’) s.sendUnsupportedErrorResponse(request.Request) - case *dap.LoadedSourcesRequest: - // Optional (capability ‘supportsLoadedSourcesRequest’) - // TODO: implement this request in V1 - s.onLoadedSourcesRequest(request) - case *dap.DataBreakpointInfoRequest: - // Optional (capability ‘supportsDataBreakpoints’) + case *dap.CompletionsRequest: // Optional (capability ‘supportsCompletionsRequest’) s.sendUnsupportedErrorResponse(request.Request) - case *dap.SetDataBreakpointsRequest: - // Optional (capability ‘supportsDataBreakpoints’) + case *dap.DataBreakpointInfoRequest: // Optional (capability ‘supportsDataBreakpoints’) s.sendUnsupportedErrorResponse(request.Request) - case *dap.ReadMemoryRequest: - // Optional (capability ‘supportsReadMemoryRequest‘) - // TODO: implement this request in V1 - s.onReadMemoryRequest(request) - case *dap.DisassembleRequest: - // Optional (capability ‘supportsDisassembleRequest’) - // TODO: implement this request in V1 - s.onDisassembleRequest(request) - case *dap.CancelRequest: - // Optional (capability ‘supportsCancelRequest’) - // TODO: does this request make sense for delve? - s.onCancelRequest(request) - case *dap.BreakpointLocationsRequest: - // Optional (capability ‘supportsBreakpointLocationsRequest’) + case *dap.SetDataBreakpointsRequest: // Optional (capability ‘supportsDataBreakpoints’) s.sendUnsupportedErrorResponse(request.Request) - case *dap.ModulesRequest: - // Optional (capability ‘supportsModulesRequest’) - // TODO: does this request make sense for delve? + case *dap.BreakpointLocationsRequest: // Optional (capability ‘supportsBreakpointLocationsRequest’) s.sendUnsupportedErrorResponse(request.Request) default: // This is a DAP message that go-dap has a struct for, so @@ -365,136 +788,301 @@ func (s *Server) handleRequest(request dap.Message) { } } -func (s *Server) send(message dap.Message) { +func (s *Session) send(message dap.Message) { jsonmsg, _ := json.Marshal(message) - s.log.Debug("[-> to client]", string(jsonmsg)) - dap.WriteProtocolMessage(s.conn, message) + s.config.log.Debug("[-> to client]", string(jsonmsg)) + // TODO(polina): consider using a channel for all the sends and to have a dedicated + // goroutine that reads from that channel and sends over the connection. + // This will avoid blocking on slow network sends. + s.sendingMu.Lock() + defer s.sendingMu.Unlock() + err := dap.WriteProtocolMessage(s.conn, message) + if err != nil { + s.config.log.Debug(err) + } } -func (s *Server) onInitializeRequest(request *dap.InitializeRequest) { - // TODO(polina): Respond with an error if debug session is in progress? +func (s *Session) logToConsole(msg string) { + s.send(&dap.OutputEvent{ + Event: *newEvent("output"), + Body: dap.OutputEventBody{ + Output: msg + "\n", + Category: "console", + }}) +} + +func (s *Session) onInitializeRequest(request *dap.InitializeRequest) { + s.setClientCapabilities(request.Arguments) + if request.Arguments.PathFormat != "path" { + s.sendErrorResponse(request.Request, FailedToInitialize, "Failed to initialize", + fmt.Sprintf("Unsupported 'pathFormat' value '%s'.", request.Arguments.PathFormat)) + return + } + if !request.Arguments.LinesStartAt1 { + s.sendErrorResponse(request.Request, FailedToInitialize, "Failed to initialize", + "Only 1-based line numbers are supported.") + return + } + if !request.Arguments.ColumnsStartAt1 { + s.sendErrorResponse(request.Request, FailedToInitialize, "Failed to initialize", + "Only 1-based column numbers are supported.") + return + } + + // TODO(polina): Respond with an error if debug session started + // with an initialize request is in progress? response := &dap.InitializeResponse{Response: *newResponse(request.Request)} response.Body.SupportsConfigurationDoneRequest = true - // TODO(polina): support this to match vscode-go functionality - response.Body.SupportsSetVariable = false + response.Body.SupportsConditionalBreakpoints = true + response.Body.SupportsDelayedStackTraceLoading = true + response.Body.SupportTerminateDebuggee = true + response.Body.SupportsFunctionBreakpoints = true + response.Body.SupportsInstructionBreakpoints = true + response.Body.SupportsExceptionInfoRequest = true + response.Body.SupportsSetVariable = true + response.Body.SupportsEvaluateForHovers = true + response.Body.SupportsClipboardContext = true + response.Body.SupportsSteppingGranularity = true + response.Body.SupportsLogPoints = true + response.Body.SupportsDisassembleRequest = true // TODO(polina): support these requests in addition to vscode-go feature parity response.Body.SupportsTerminateRequest = false response.Body.SupportsRestartRequest = false - response.Body.SupportsFunctionBreakpoints = false - response.Body.SupportsStepBack = false + response.Body.SupportsStepBack = false // To be enabled by CapabilitiesEvent based on configuration response.Body.SupportsSetExpression = false response.Body.SupportsLoadedSourcesRequest = false response.Body.SupportsReadMemoryRequest = false - response.Body.SupportsDisassembleRequest = false response.Body.SupportsCancelRequest = false s.send(response) } -// Output path for the compiled binary in debug or test modes. -const debugBinary string = "./__debug_bin" +func (s *Session) setClientCapabilities(args dap.InitializeRequestArguments) { + s.clientCapabilities.supportsMemoryReferences = args.SupportsMemoryReferences + s.clientCapabilities.supportsProgressReporting = args.SupportsProgressReporting + s.clientCapabilities.supportsRunInTerminalRequest = args.SupportsRunInTerminalRequest + s.clientCapabilities.supportsVariablePaging = args.SupportsVariablePaging + s.clientCapabilities.supportsVariableType = args.SupportsVariableType +} -func (s *Server) onLaunchRequest(request *dap.LaunchRequest) { - // TODO(polina): Respond with an error if debug session is in progress? +// Default output file pathname for the compiled binary in debug or test modes +// when temporary debug binary creation fails. +// This is relative to the current working directory of the server. +const defaultDebugBinary string = "./__debug_bin" - program, ok := request.Arguments["program"].(string) - if !ok || program == "" { - s.sendErrorResponse(request.Request, - FailedToLaunch, "Failed to launch", - "The program attribute is missing in debug configuration.") +func (s *Session) tempDebugBinary() string { + binaryPattern := "__debug_bin" + if runtime.GOOS == "windows" { + binaryPattern = "__debug_bin*.exe" + } + f, err := ioutil.TempFile("", binaryPattern) + if err != nil { + s.config.log.Errorf("failed to create a temporary binary (%v), falling back to %q", err, defaultDebugBinary) + return cleanExeName(defaultDebugBinary) + } + name := f.Name() + if err := f.Close(); err != nil { + s.config.log.Errorf("failed to create a temporary binary (%v), falling back to %q", err, defaultDebugBinary) + return cleanExeName(defaultDebugBinary) + } + return name +} + +func cleanExeName(name string) string { + if runtime.GOOS == "windows" && filepath.Ext(name) != ".exe" { + return name + ".exe" + } + return name +} + +func (s *Session) onLaunchRequest(request *dap.LaunchRequest) { + var err error + if s.debugger != nil { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", + fmt.Sprintf("debug session already in progress at %s - use remote attach mode to connect to a server with an active debug session", s.address())) return } - mode, ok := request.Arguments["mode"] - if !ok || mode == "" { - mode = "debug" + var args = defaultLaunchConfig // narrow copy for initializing non-zero default values + if err := unmarshalLaunchAttachArgs(request.Arguments, &args); err != nil { + s.sendShowUserErrorResponse(request.Request, + FailedToLaunch, "Failed to launch", fmt.Sprintf("invalid debug configuration - %v", err)) + return } + s.config.log.Debug("parsed launch config: ", prettyPrint(args)) - if mode == "debug" || mode == "test" { - output, ok := request.Arguments["output"].(string) - if !ok || output == "" { - output = debugBinary - } - debugname, err := filepath.Abs(output) - if err != nil { - s.sendInternalErrorResponse(request.Seq, err.Error()) + if args.DlvCwd != "" { + if err := os.Chdir(args.DlvCwd); err != nil { + s.sendShowUserErrorResponse(request.Request, + FailedToLaunch, "Failed to launch", fmt.Sprintf("failed to chdir to %q - %v", args.DlvCwd, err)) return } + } - buildFlags := "" - buildFlagsArg, ok := request.Arguments["buildFlags"] - if ok { - buildFlags, ok = buildFlagsArg.(string) - if !ok { - s.sendErrorResponse(request.Request, - FailedToLaunch, "Failed to launch", - fmt.Sprintf("'buildFlags' attribute '%v' in debug configuration is not a string.", buildFlagsArg)) + for k, v := range args.Env { + if v != nil { + if err := os.Setenv(k, *v); err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", fmt.Sprintf("failed to setenv(%v) - %v", k, err)) + return + } + } else { + if err := os.Unsetenv(k); err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", fmt.Sprintf("failed to unsetenv(%v) - %v", k, err)) return } } + } + + if args.Mode == "" { + args.Mode = "debug" + } + if !isValidLaunchMode(args.Mode) { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", + fmt.Sprintf("invalid debug configuration - unsupported 'mode' attribute %q", args.Mode)) + return + } + + if args.Program == "" && args.Mode != "replay" { // Only fail on modes requiring a program + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", + "The program attribute is missing in debug configuration.") + return + } + + if args.Backend == "" { + args.Backend = "default" + } + + if args.Mode == "replay" { + // Validate trace directory + if args.TraceDirPath == "" { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", + "The 'traceDirPath' attribute is missing in debug configuration.") + return + } + + // Assign the rr trace directory path to debugger configuration + s.config.Debugger.CoreFile = args.TraceDirPath + args.Backend = "rr" + } + if args.Mode == "core" { + // Validate core dump path + if args.CoreFilePath == "" { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", + "The 'coreFilePath' attribute is missing in debug configuration.") + return + } + // Assign the non-empty core file path to debugger configuration. This will + // trigger a native core file replay instead of an rr trace replay + s.config.Debugger.CoreFile = args.CoreFilePath + args.Backend = "core" + } + + s.config.Debugger.Backend = args.Backend + + // Prepare the debug executable filename, building it if necessary + debugbinary := args.Program + if args.Mode == "debug" || args.Mode == "test" { + if args.Output == "" { + args.Output = s.tempDebugBinary() + } else { + args.Output = cleanExeName(args.Output) + } + args.Output, err = filepath.Abs(args.Output) + if err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", err.Error()) + return + } + debugbinary = args.Output - switch mode { + var cmd string + var out []byte + var err error + switch args.Mode { case "debug": - err = gobuild.GoBuild(debugname, []string{program}, buildFlags) + cmd, out, err = gobuild.GoBuildCombinedOutput(args.Output, []string{args.Program}, args.BuildFlags) case "test": - err = gobuild.GoTestBuild(debugname, []string{program}, buildFlags) + cmd, out, err = gobuild.GoTestBuildCombinedOutput(args.Output, []string{args.Program}, args.BuildFlags) } + args.DlvCwd, _ = filepath.Abs(args.DlvCwd) + s.config.log.Debugf("building from %q: [%s]", args.DlvCwd, cmd) if err != nil { - s.sendErrorResponse(request.Request, - FailedToLaunch, "Failed to launch", - fmt.Sprintf("Build error: %s", err.Error())) + s.send(&dap.OutputEvent{ + Event: *newEvent("output"), + Body: dap.OutputEventBody{ + Output: fmt.Sprintf("Build Error: %s\n%s (%s)\n", cmd, strings.TrimSpace(string(out)), err.Error()), + Category: "stderr", + }}) + // Users are used to checking the Debug Console for build errors. + // No need to bother them with a visible pop-up. + s.sendErrorResponse(request.Request, FailedToLaunch, "Failed to launch", + "Build error: Check the debug console for details.") return } - program = debugname - s.binaryToRemove = debugname + s.mu.Lock() + s.binaryToRemove = args.Output + s.mu.Unlock() } + s.config.ProcessArgs = append([]string{debugbinary}, args.Args...) - // TODO(polina): support "remote" mode - if mode != "exec" && mode != "debug" && mode != "test" { - s.sendErrorResponse(request.Request, - FailedToLaunch, "Failed to launch", - fmt.Sprintf("Unsupported 'mode' value %q in debug configuration.", mode)) + if err := s.setLaunchAttachArgs(args.LaunchAttachCommonConfig); err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", err.Error()) return } - stop, ok := request.Arguments["stopOnEntry"] - s.args.stopOnEntry = ok && stop == true - - depth, ok := request.Arguments["stackTraceDepth"].(float64) - if ok && depth > 0 { - s.args.stackTraceDepth = int(depth) + if args.Cwd == "" { + if args.Mode == "test" { + // In test mode, run the test binary from the package directory + // like in `go test` and `dlv test` by default. + args.Cwd = s.getPackageDir(args.Program) + } else { + args.Cwd = "." + } } - - var targetArgs []string - args, ok := request.Arguments["args"] - if ok { - argsParsed, ok := args.([]interface{}) - if !ok { - s.sendErrorResponse(request.Request, - FailedToLaunch, "Failed to launch", - fmt.Sprintf("'args' attribute '%v' in debug configuration is not an array.", args)) + s.config.Debugger.WorkingDir = args.Cwd + + // Backend layers will interpret paths relative to server's working directory: + // reflect that before logging. + argsToLog := args + argsToLog.Program, _ = filepath.Abs(args.Program) + argsToLog.Cwd, _ = filepath.Abs(args.Cwd) + s.config.log.Debugf("launching binary '%s' with config: %s", debugbinary, prettyPrint(argsToLog)) + + if args.NoDebug { + s.mu.Lock() + cmd, err := s.newNoDebugProcess(debugbinary, args.Args, s.config.Debugger.WorkingDir) + s.mu.Unlock() + if err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", err.Error()) return } - for _, arg := range argsParsed { - argParsed, ok := arg.(string) - if !ok { - s.sendErrorResponse(request.Request, - FailedToLaunch, "Failed to launch", - fmt.Sprintf("value '%v' in 'args' attribute in debug configuration is not a string.", arg)) - return + // Skip 'initialized' event, which will prevent the client from sending + // debug-related requests. + s.send(&dap.LaunchResponse{Response: *newResponse(request.Request)}) + + // Start the program on a different goroutine, so we can listen for disconnect request. + go func() { + if err := cmd.Wait(); err != nil { + s.config.log.Debugf("program exited with error: %v", err) } - targetArgs = append(targetArgs, argParsed) - } + close(s.noDebugProcess.exited) + s.logToConsole(proc.ErrProcessExited{Pid: cmd.ProcessState.Pid(), Status: cmd.ProcessState.ExitCode()}.Error()) + s.send(&dap.TerminatedEvent{Event: *newEvent("terminated")}) + }() + return } - s.config.ProcessArgs = append([]string{program}, targetArgs...) - s.config.Debugger.WorkingDir = filepath.Dir(program) - - var err error - if s.debugger, err = debugger.New(&s.config.Debugger, s.config.ProcessArgs); err != nil { - s.sendErrorResponse(request.Request, - FailedToLaunch, "Failed to launch", err.Error()) + func() { + s.mu.Lock() + defer s.mu.Unlock() // Make sure to unlock in case of panic that will become internal error + s.debugger, err = debugger.New(&s.config.Debugger, s.config.ProcessArgs) + }() + if err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToLaunch, "Failed to launch", err.Error()) return } + // Enable StepBack controls on supported backends + if s.config.Debugger.Backend == "rr" { + s.send(&dap.CapabilitiesEvent{Event: *newEvent("capabilities"), Body: dap.CapabilitiesEventBody{Capabilities: dap.Capabilities{SupportsStepBack: true}}}) + } // Notify the client that the debugger is ready to start accepting // configuration requests for setting breakpoints, etc. The client @@ -503,114 +1091,629 @@ func (s *Server) onLaunchRequest(request *dap.LaunchRequest) { s.send(&dap.LaunchResponse{Response: *newResponse(request.Request)}) } -// onDisconnectRequest handles the DisconnectRequest. Per the DAP spec, -// it disconnects the debuggee and signals that the debug adaptor -// (in our case this TCP server) can be terminated. -func (s *Server) onDisconnectRequest(request *dap.DisconnectRequest) { - s.send(&dap.DisconnectResponse{Response: *newResponse(request.Request)}) - if s.debugger != nil { - _, err := s.debugger.Command(&api.DebuggerCommand{Name: api.Halt}) - if err != nil { - s.log.Error(err) - } - kill := s.config.Debugger.AttachPid == 0 - err = s.debugger.Detach(kill) - if err != nil { - s.log.Error(err) - } +func (s *Session) getPackageDir(pkg string) string { + cmd := exec.Command("go", "list", "-f", "{{.Dir}}", pkg) + out, err := cmd.Output() + if err != nil { + s.config.log.Debugf("failed to determin package directory for %v: %v\n%s", pkg, err, out) + return "." } - // TODO(polina): make thread-safe when handlers become asynchronous. - s.signalDisconnect() + return string(bytes.TrimSpace(out)) } -func (s *Server) onSetBreakpointsRequest(request *dap.SetBreakpointsRequest) { - if request.Arguments.Source.Path == "" { - s.log.Error("ERROR: Unable to set breakpoint for empty file path") +// newNoDebugProcess is called from onLaunchRequest (run goroutine) and +// requires holding mu lock. It prepares process exec.Cmd to be started. +func (s *Session) newNoDebugProcess(program string, targetArgs []string, wd string) (*exec.Cmd, error) { + if s.noDebugProcess != nil { + return nil, fmt.Errorf("another launch request is in progress") } - response := &dap.SetBreakpointsResponse{Response: *newResponse(request.Request)} - response.Body.Breakpoints = make([]dap.Breakpoint, len(request.Arguments.Breakpoints)) - // Only verified breakpoints will be set and reported back in the - // response. All breakpoints resulting in errors (e.g. duplicates - // or lines that do not have statements) will be skipped. - i := 0 - for _, b := range request.Arguments.Breakpoints { - bp, err := s.debugger.CreateBreakpoint( - &api.Breakpoint{File: request.Arguments.Source.Path, Line: b.Line}) - if err != nil { - s.log.Error("ERROR:", err) - continue - } - response.Body.Breakpoints[i].Verified = true - response.Body.Breakpoints[i].Line = bp.Line - i++ + cmd := exec.Command(program, targetArgs...) + cmd.Stdout, cmd.Stderr, cmd.Stdin, cmd.Dir = os.Stdout, os.Stderr, os.Stdin, wd + if err := cmd.Start(); err != nil { + return nil, err } - response.Body.Breakpoints = response.Body.Breakpoints[:i] - s.send(response) -} - -func (s *Server) onSetExceptionBreakpointsRequest(request *dap.SetExceptionBreakpointsRequest) { - // Unlike what DAP documentation claims, this request is always sent - // even though we specified no filters at initialization. Handle as no-op. - s.send(&dap.SetExceptionBreakpointsResponse{Response: *newResponse(request.Request)}) + s.noDebugProcess = &process{Cmd: cmd, exited: make(chan struct{})} + return cmd, nil } -func (s *Server) onConfigurationDoneRequest(request *dap.ConfigurationDoneRequest) { - if s.args.stopOnEntry { - e := &dap.StoppedEvent{ - Event: *newEvent("stopped"), - Body: dap.StoppedEventBody{Reason: "entry", ThreadId: 1, AllThreadsStopped: true}, - } - s.send(e) +// stopNoDebugProcess is called from Stop (main goroutine) and +// onDisconnectRequest (run goroutine) and requires holding mu lock. +func (s *Session) stopNoDebugProcess() { + if s.noDebugProcess == nil { + // We already handled termination or there was never a process + return } - s.send(&dap.ConfigurationDoneResponse{Response: *newResponse(request.Request)}) - if !s.args.stopOnEntry { - s.doCommand(api.Continue) + select { + case <-s.noDebugProcess.exited: + s.noDebugProcess = nil + return + default: } -} -func (s *Server) onContinueRequest(request *dap.ContinueRequest) { - s.send(&dap.ContinueResponse{ - Response: *newResponse(request.Request), - Body: dap.ContinueResponseBody{AllThreadsContinued: true}}) - s.doCommand(api.Continue) + // TODO(hyangah): gracefully terminate the process and its children processes. + s.logToConsole(fmt.Sprintf("Terminating process %d", s.noDebugProcess.Process.Pid)) + s.noDebugProcess.Process.Kill() // Don't check error. Process killing and self-termination may race. + + // Wait for kill to complete or time out + select { + case <-time.After(5 * time.Second): + s.config.log.Debug("noDebug process kill timed out") + case <-s.noDebugProcess.exited: + s.config.log.Debug("noDebug process killed") + s.noDebugProcess = nil + } } -func (s *Server) onThreadsRequest(request *dap.ThreadsRequest) { - if s.debugger == nil { - s.sendErrorResponse(request.Request, UnableToDisplayThreads, "Unable to display threads", "debugger is nil") +// onDisconnectRequest handles the DisconnectRequest. Per the DAP spec, +// it disconnects the debuggee and signals that the debug adaptor +// (in our case this TCP server) can be terminated. +func (s *Session) onDisconnectRequest(request *dap.DisconnectRequest) { + s.mu.Lock() + defer s.mu.Unlock() + + if s.debugger != nil && s.config.AcceptMulti && !request.Arguments.TerminateDebuggee { + // This is a multi-use server/debugger, so a disconnect request that doesn't + // terminate the debuggee should clean up only the client connection and pointer to debugger, + // but not the entire server. + status := "halted" + if s.isRunningCmd() { + status = "running" + } else if s, err := s.debugger.State(false); processExited(s, err) { + status = "exited" + } + s.logToConsole(fmt.Sprintf("Closing client session, but leaving multi-client DAP server at %s with debuggee %s", s.config.Listener.Addr().String(), status)) + s.send(&dap.DisconnectResponse{Response: *newResponse(request.Request)}) + s.send(&dap.TerminatedEvent{Event: *newEvent("terminated")}) + s.conn.Close() + s.debugger = nil + // The target is left in whatever state it is already in - halted or running. + // The users therefore have the flexibility to choose the appropriate state + // for their case before disconnecting. This is also desirable in case of + // the client connection fails unexpectedly and the user needs to reconnect. + // TODO(polina): should we always issue a continue here if it is not running + // like is done in vscode-go legacy adapter? + // Ideally we want to use bool suspendDebuggee flag, but it is not yet + // available in vscode: https://github.com/microsoft/vscode/issues/134412 return } - gs, _, err := s.debugger.Goroutines(0, 0) - if err != nil { - switch err.(type) { - case *proc.ErrProcessExited: - // If the program exits very quickly, the initial threads request will complete after it has exited. - // A TerminatedEvent has already been sent. Ignore the err returned in this case. - s.send(&dap.ThreadsResponse{Response: *newResponse(request.Request)}) + + defer s.config.triggerServerStop() + var err error + if s.debugger != nil { + // We always kill launched programs. + // In case of attach, we leave the program + // running by default, which can be + // overridden by an explicit request to terminate. + killProcess := s.config.Debugger.AttachPid == 0 || request.Arguments.TerminateDebuggee + err = s.stopDebugSession(killProcess) + } else if s.noDebugProcess != nil { + s.stopNoDebugProcess() + } + if err != nil { + s.sendErrorResponse(request.Request, DisconnectError, "Error while disconnecting", err.Error()) + } else { + s.send(&dap.DisconnectResponse{Response: *newResponse(request.Request)}) + } + // The debugging session has ended, so we send a terminated event. + s.send(&dap.TerminatedEvent{Event: *newEvent("terminated")}) +} + +// stopDebugSession is called from Stop (main goroutine) and +// onDisconnectRequest (run goroutine) and requires holding mu lock. +// Returns any detach error other than proc.ErrProcessExited. +func (s *Session) stopDebugSession(killProcess bool) error { + s.changeStateMu.Lock() + defer func() { + // Avoid running stop sequence twice. + // It's not fatal, but will result in duplicate logging. + s.debugger = nil + s.changeStateMu.Unlock() + }() + if s.debugger == nil { + return nil + } + var err error + var exited error + // Halting will stop any debugger command that's pending on another + // per-request goroutine. Tell auto-resumer not to resume, so the + // goroutine can wrap-up and exit. + s.setHaltRequested(true) + state, err := s.halt() + if err == proc.ErrProcessDetached { + s.config.log.Debug("halt returned error: ", err) + return nil + } + if err != nil { + switch err.(type) { + case proc.ErrProcessExited: + exited = err + default: + s.config.log.Error("halt returned error: ", err) + if err.Error() == "no such process" { + exited = err + } + } + } else if state.Exited { + exited = proc.ErrProcessExited{Pid: s.debugger.ProcessPid(), Status: state.ExitStatus} + s.config.log.Debug("halt returned state: ", exited) + } + if exited != nil { + // TODO(suzmue): log exited error when the process exits, which may have been before + // halt was called. + s.logToConsole(exited.Error()) + s.logToConsole("Detaching") + } else if killProcess { + s.logToConsole("Detaching and terminating target process") + } else { + s.logToConsole("Detaching without terminating target processs") + } + err = s.debugger.Detach(killProcess) + if err != nil { + switch err.(type) { + case proc.ErrProcessExited: + s.config.log.Debug(err) + s.logToConsole(exited.Error()) + err = nil default: - s.sendErrorResponse(request.Request, UnableToDisplayThreads, "Unable to display threads", err.Error()) + s.config.log.Error("detach returned error: ", err) } + } + return err +} + +// halt sends a halt request if the debuggee is running. +// changeStateMu should be held when calling (*Server).halt. +func (s *Session) halt() (*api.DebuggerState, error) { + s.config.log.Debug("halting") + // Only send a halt request if the debuggee is running. + if s.debugger.IsRunning() { + return s.debugger.Command(&api.DebuggerCommand{Name: api.Halt}, nil) + } + s.config.log.Debug("process not running") + return s.debugger.State(false) +} + +func (s *Session) isNoDebug() bool { + s.mu.Lock() + defer s.mu.Unlock() + return s.noDebugProcess != nil +} + +func (s *Session) onSetBreakpointsRequest(request *dap.SetBreakpointsRequest) { + if request.Arguments.Source.Path == "" { + s.sendErrorResponse(request.Request, UnableToSetBreakpoints, "Unable to set or clear breakpoints", "empty file path") return } - threads := make([]dap.Thread, len(gs)) - if len(threads) == 0 { - // Depending on the debug session stage, goroutines information - // might not be available. However, the DAP spec states that - // "even if a debug adapter does not support multiple threads, - // it must implement the threads request and return a single - // (dummy) thread". + clientPath := request.Arguments.Source.Path + serverPath := s.toServerPath(clientPath) + + // Get all existing breakpoints that match for this source. + sourceRequestPrefix := fmt.Sprintf("sourceBp Path=%q ", request.Arguments.Source.Path) + + breakpoints := s.setBreakpoints(sourceRequestPrefix, len(request.Arguments.Breakpoints), func(i int) *bpMetadata { + want := request.Arguments.Breakpoints[i] + return &bpMetadata{ + name: fmt.Sprintf("%s Line=%d Column=%d", sourceRequestPrefix, want.Line, want.Column), + condition: want.Condition, + hitCondition: want.HitCondition, + logMessage: want.LogMessage, + } + }, func(i int) (*bpLocation, error) { + want := request.Arguments.Breakpoints[i] + return &bpLocation{ + file: serverPath, + line: want.Line, + }, nil + }) + + response := &dap.SetBreakpointsResponse{Response: *newResponse(request.Request)} + response.Body.Breakpoints = breakpoints + + s.send(response) +} + +type bpMetadata struct { + name string + condition string + hitCondition string + logMessage string +} + +type bpLocation struct { + file string + line int + addr uint64 + addrs []uint64 +} + +// setBreakpoints is a helper function for setting source, function and instruction +// breakpoints. It takes the prefix of the name for all breakpoints that should be +// included, the total number of breakpoints, and functions for computing the metadata +// and the location. The location is computed separately because this may be more +// expensive to compute and may not always be necessary. +func (s *Session) setBreakpoints(prefix string, totalBps int, metadataFunc func(i int) *bpMetadata, locFunc func(i int) (*bpLocation, error)) []dap.Breakpoint { + // If a breakpoint: + // -- exists and not in request => ClearBreakpoint + // -- exists and in request => AmendBreakpoint + // -- doesn't exist and in request => SetBreakpoint + + // Get all existing breakpoints matching the prefix. + existingBps := s.getMatchingBreakpoints(prefix) + + // createdBps is a set of breakpoint names that have been added + // during this request. This is used to catch duplicate set + // breakpoints requests and to track which breakpoints need to + // be deleted. + createdBps := make(map[string]struct{}, len(existingBps)) + + breakpoints := make([]dap.Breakpoint, totalBps) + // Amend existing breakpoints. + for i := 0; i < totalBps; i++ { + want := metadataFunc(i) + got, ok := existingBps[want.name] + if got == nil || !ok { + // Skip if the breakpoint does not already exist. + continue + } + + var err error + if _, ok := createdBps[want.name]; ok { + err = fmt.Errorf("breakpoint already exists") + } else { + got.Disabled = false + got.Cond = want.condition + got.HitCond = want.hitCondition + err = setLogMessage(got, want.logMessage) + if err == nil { + err = s.debugger.AmendBreakpoint(got) + } + } + createdBps[want.name] = struct{}{} + s.updateBreakpointsResponse(breakpoints, i, err, got) + } + + // Clear breakpoints. + // Any breakpoint that existed before this request but was not amended must be deleted. + s.clearBreakpoints(existingBps, createdBps) + + // Add new breakpoints. + for i := 0; i < totalBps; i++ { + want := metadataFunc(i) + if _, ok := existingBps[want.name]; ok { + continue + } + + var got *api.Breakpoint + wantLoc, err := locFunc(i) + if err == nil { + if _, ok := createdBps[want.name]; ok { + err = fmt.Errorf("breakpoint already exists") + } else { + bp := &api.Breakpoint{ + Name: want.name, + File: wantLoc.file, + Line: wantLoc.line, + Addr: wantLoc.addr, + Addrs: wantLoc.addrs, + Cond: want.condition, + HitCond: want.hitCondition, + } + err = setLogMessage(bp, want.logMessage) + if err == nil { + // Create new breakpoints. + got, err = s.debugger.CreateBreakpoint(bp) + } + } + } + createdBps[want.name] = struct{}{} + s.updateBreakpointsResponse(breakpoints, i, err, got) + } + return breakpoints +} + +func setLogMessage(bp *api.Breakpoint, msg string) error { + tracepoint, userdata, err := parseLogPoint(msg) + if err != nil { + return err + } + bp.Tracepoint = tracepoint + if userdata != nil { + bp.UserData = *userdata + } + return nil +} + +func (s *Session) updateBreakpointsResponse(breakpoints []dap.Breakpoint, i int, err error, got *api.Breakpoint) { + breakpoints[i].Verified = (err == nil) + if err != nil { + breakpoints[i].Message = err.Error() + } else { + path := s.toClientPath(got.File) + breakpoints[i].Id = got.ID + breakpoints[i].Line = got.Line + breakpoints[i].Source = dap.Source{Name: filepath.Base(path), Path: path} + } +} + +// functionBpPrefix is the prefix of bp.Name for every breakpoint bp set +// in this request. +const functionBpPrefix = "functionBreakpoint" + +func (s *Session) onSetFunctionBreakpointsRequest(request *dap.SetFunctionBreakpointsRequest) { + breakpoints := s.setBreakpoints(functionBpPrefix, len(request.Arguments.Breakpoints), func(i int) *bpMetadata { + want := request.Arguments.Breakpoints[i] + return &bpMetadata{ + name: fmt.Sprintf("%s Name=%s", functionBpPrefix, want.Name), + condition: want.Condition, + hitCondition: want.HitCondition, + logMessage: "", + } + }, func(i int) (*bpLocation, error) { + want := request.Arguments.Breakpoints[i] + // Set the function breakpoint breakpoint + spec, err := locspec.Parse(want.Name) + if err != nil { + return nil, err + } + if loc, ok := spec.(*locspec.NormalLocationSpec); !ok || loc.FuncBase == nil { + // Other locations do not make sense in the context of function breakpoints. + // Regex locations are likely to resolve to multiple places and offset locations + // are only meaningful at the time the breakpoint was created. + return nil, fmt.Errorf("breakpoint name %q could not be parsed as a function. name must be in the format 'funcName', 'funcName:line' or 'fileName:line'", want.Name) + } + + if want.Name[0] == '.' { + return nil, fmt.Errorf("breakpoint names that are relative paths are not supported") + } + // Find the location of the function name. CreateBreakpoint requires the name to include the base + // (e.g. main.functionName is supported but not functionName). + // We first find the location of the function, and then set breakpoints for that location. + var locs []api.Location + locs, err = s.debugger.FindLocationSpec(-1, 0, 0, want.Name, spec, true, s.args.substitutePathClientToServer) + if err != nil { + return nil, err + } + if len(locs) == 0 { + return nil, err + } + if len(locs) > 0 { + s.config.log.Debugf("multiple locations found for %s", want.Name) + } + + // Set breakpoint using the PCs that were found. + loc := locs[0] + return &bpLocation{addr: loc.PC, addrs: loc.PCs}, nil + }) + + response := &dap.SetFunctionBreakpointsResponse{Response: *newResponse(request.Request)} + response.Body.Breakpoints = breakpoints + + s.send(response) +} + +const instructionBpPrefix = "instructionBreakpoint" + +func (s *Session) onSetInstructionBreakpointsRequest(request *dap.SetInstructionBreakpointsRequest) { + breakpoints := s.setBreakpoints(instructionBpPrefix, len(request.Arguments.Breakpoints), func(i int) *bpMetadata { + want := request.Arguments.Breakpoints[i] + return &bpMetadata{ + name: fmt.Sprintf("%s PC=%s", instructionBpPrefix, want.InstructionReference), + condition: want.Condition, + hitCondition: want.HitCondition, + logMessage: "", + } + }, func(i int) (*bpLocation, error) { + want := request.Arguments.Breakpoints[i] + addr, err := strconv.ParseInt(want.InstructionReference, 0, 64) + if err != nil { + return nil, err + } + return &bpLocation{addr: uint64(addr)}, nil + }) + + response := &dap.SetInstructionBreakpointsResponse{Response: *newResponse(request.Request)} + response.Body.Breakpoints = breakpoints + s.send(response) +} + +func (s *Session) clearBreakpoints(existingBps map[string]*api.Breakpoint, amendedBps map[string]struct{}) error { + for req, bp := range existingBps { + if _, ok := amendedBps[req]; ok { + continue + } + _, err := s.debugger.ClearBreakpoint(bp) + if err != nil { + return err + } + } + return nil +} + +func (s *Session) getMatchingBreakpoints(prefix string) map[string]*api.Breakpoint { + existing := s.debugger.Breakpoints(false) + matchingBps := make(map[string]*api.Breakpoint, len(existing)) + for _, bp := range existing { + // Skip special breakpoints such as for panic. + if bp.ID < 0 { + continue + } + // Skip breakpoints that do not meet the condition. + if !strings.HasPrefix(bp.Name, prefix) { + continue + } + matchingBps[bp.Name] = bp + } + return matchingBps +} + +func (s *Session) onSetExceptionBreakpointsRequest(request *dap.SetExceptionBreakpointsRequest) { + // Unlike what DAP documentation claims, this request is always sent + // even though we specified no filters at initialization. Handle as no-op. + s.send(&dap.SetExceptionBreakpointsResponse{Response: *newResponse(request.Request)}) +} + +func closeIfOpen(ch chan struct{}) { + if ch != nil { + select { + case <-ch: + // already closed + default: + close(ch) + } + } +} + +// onConfigurationDoneRequest handles 'configurationDone' request. +// This is an optional request enabled by capability ‘supportsConfigurationDoneRequest’. +// It gets triggered after all the debug requests that follow initalized event, +// so the s.debugger is guaranteed to be set. Expects the target to be halted. +func (s *Session) onConfigurationDoneRequest(request *dap.ConfigurationDoneRequest, allowNextStateChange chan struct{}) { + defer closeIfOpen(allowNextStateChange) + if s.args.stopOnEntry { + e := &dap.StoppedEvent{ + Event: *newEvent("stopped"), + Body: dap.StoppedEventBody{Reason: "entry", ThreadId: 1, AllThreadsStopped: true}, + } + s.send(e) + } + s.debugger.Target().KeepSteppingBreakpoints = proc.HaltKeepsSteppingBreakpoints | proc.TracepointKeepsSteppingBreakpoints + + s.logToConsole("Type 'dlv help' for list of commands.") + s.send(&dap.ConfigurationDoneResponse{Response: *newResponse(request.Request)}) + + if !s.args.stopOnEntry { + s.runUntilStopAndNotify(api.Continue, allowNextStateChange) + } +} + +// onContinueRequest handles 'continue' request. +// This is a mandatory request to support. +func (s *Session) onContinueRequest(request *dap.ContinueRequest, allowNextStateChange chan struct{}) { + s.send(&dap.ContinueResponse{ + Response: *newResponse(request.Request), + Body: dap.ContinueResponseBody{AllThreadsContinued: true}}) + s.runUntilStopAndNotify(api.Continue, allowNextStateChange) +} + +func fnName(loc *proc.Location) string { + if loc.Fn == nil { + return "???" + } + return loc.Fn.Name +} + +func fnPackageName(loc *proc.Location) string { + if loc.Fn == nil { + // attribute unknown functions to the runtime + return "runtime" + } + return loc.Fn.PackageName() +} + +// onThreadsRequest handles 'threads' request. +// This is a mandatory request to support. +// It is sent in response to configurationDone response and stopped events. +// Depending on the debug session stage, goroutines information +// might not be available. However, the DAP spec states that +// "even if a debug adapter does not support multiple threads, +// it must implement the threads request and return a single +// (dummy) thread". Therefore, this handler never returns +// an error response. If the dummy thread is returned in its place, +// the next waterfall request for its stackTrace will return the error. +func (s *Session) onThreadsRequest(request *dap.ThreadsRequest) { + var err error + var gs []*proc.G + var next int + if s.debugger != nil { + gs, next, err = s.debugger.Goroutines(0, maxGoroutines) + if err == nil { + // Parse the goroutine arguments. + filters, _, _, _, _, _, parseErr := api.ParseGoroutineArgs(s.args.GoroutineFilters) + if parseErr != nil { + s.logToConsole(parseErr.Error()) + } + if s.args.HideSystemGoroutines { + filters = append(filters, api.ListGoroutinesFilter{ + Kind: api.GoroutineUser, + Negated: false, + }) + } + gs = s.debugger.FilterGoroutines(gs, filters) + } + } + + var threads []dap.Thread + if err != nil { + switch err.(type) { + case proc.ErrProcessExited: + // If the program exits very quickly, the initial threads request will complete after it has exited. + // A TerminatedEvent has already been sent. Ignore the err returned in this case. + s.config.log.Debug(err) + default: + s.send(&dap.OutputEvent{ + Event: *newEvent("output"), + Body: dap.OutputEventBody{ + Output: fmt.Sprintf("Unable to retrieve goroutines: %s\n", err.Error()), + Category: "stderr", + }}) + } + threads = []dap.Thread{{Id: 1, Name: "Dummy"}} + } else if len(gs) == 0 { threads = []dap.Thread{{Id: 1, Name: "Dummy"}} } else { + state, err := s.debugger.State( /*nowait*/ true) + if err != nil { + s.config.log.Debug("Unable to get debugger state: ", err) + } + + if next >= 0 { + s.logToConsole(fmt.Sprintf("Too many goroutines, only loaded %d", len(gs))) + + // Make sure the selected goroutine is included in the list of threads + // to return. + if state != nil && state.SelectedGoroutine != nil { + var selectedFound bool + for _, g := range gs { + if g.ID == state.SelectedGoroutine.ID { + selectedFound = true + break + } + } + if !selectedFound { + g, err := s.debugger.FindGoroutine(state.SelectedGoroutine.ID) + if err != nil { + s.config.log.Debug("Error getting selected goroutine: ", err) + } else { + // TODO(suzmue): Consider putting the selected goroutine at the top. + // To be consistent we may want to do this for all threads requests. + gs = append(gs, g) + } + } + } + } + + threads = make([]dap.Thread, len(gs)) + s.debugger.LockTarget() + defer s.debugger.UnlockTarget() + for i, g := range gs { - threads[i].Id = g.ID - if loc := g.UserCurrentLoc; loc.Function != nil { - threads[i].Name = loc.Function.Name() - } else { - threads[i].Name = fmt.Sprintf("%s@%d", loc.File, loc.Line) + selected := "" + if state != nil && state.SelectedGoroutine != nil && g.ID == state.SelectedGoroutine.ID { + selected = "* " } + thread := "" + if g.Thread != nil && g.Thread.ThreadID() != 0 { + thread = fmt.Sprintf(" (Thread %d)", g.Thread.ThreadID()) + } + // File name and line number are communicated via `stackTrace` + // so no need to include them here. + loc := g.UserCurrent() + threads[i].Name = fmt.Sprintf("%s[Go %d] %s%s", selected, g.ID, fnName(&loc), thread) + threads[i].Id = g.ID } } + response := &dap.ThreadsResponse{ Response: *newResponse(request.Request), Body: dap.ThreadsResponseBody{Threads: threads}, @@ -618,43 +1721,211 @@ func (s *Server) onThreadsRequest(request *dap.ThreadsRequest) { s.send(response) } -// onAttachRequest sends a not-yet-implemented error response. +// onAttachRequest handles 'attach' request. // This is a mandatory request to support. -func (s *Server) onAttachRequest(request *dap.AttachRequest) { // TODO V0 - s.sendNotYetImplementedErrorResponse(request.Request) +// Attach debug sessions support the following modes: +// -- [DEFAULT] "local" -- attaches debugger to a local running process +// Required args: processID +// -- "remote" - attaches client to a debugger already attached to a process +// Required args: none (host/port are used externally to connect) +func (s *Session) onAttachRequest(request *dap.AttachRequest) { + var args AttachConfig = defaultAttachConfig // narrow copy for initializing non-zero default values + if err := unmarshalLaunchAttachArgs(request.Arguments, &args); err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToAttach, "Failed to attach", fmt.Sprintf("invalid debug configuration - %v", err)) + return + } + s.config.log.Debug("parsed launch config: ", prettyPrint(args)) + + switch args.Mode { + case "": + args.Mode = "local" + fallthrough + case "local": + if s.debugger != nil { + s.sendShowUserErrorResponse( + request.Request, FailedToAttach, + "Failed to attach", + fmt.Sprintf("debug session already in progress at %s - use remote mode to connect to a server with an active debug session", s.address())) + return + } + if args.ProcessID == 0 { + s.sendShowUserErrorResponse(request.Request, FailedToAttach, "Failed to attach", + "The 'processId' attribute is missing in debug configuration") + return + } + s.config.Debugger.AttachPid = args.ProcessID + if args.Backend == "" { + args.Backend = "default" + } + s.config.Debugger.Backend = args.Backend + s.config.log.Debugf("attaching to pid %d", args.ProcessID) + var err error + func() { + s.mu.Lock() + defer s.mu.Unlock() // Make sure to unlock in case of panic that will become internal error + s.debugger, err = debugger.New(&s.config.Debugger, nil) + }() + if err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToAttach, "Failed to attach", err.Error()) + return + } + case "remote": + if s.debugger == nil { + s.sendShowUserErrorResponse(request.Request, FailedToAttach, "Failed to attach", "no debugger found") + return + } + s.config.log.Debug("debugger already started") + // Halt for configuration sequence. onConfigurationDone will restart + // execution if user requested !stopOnEntry. + s.changeStateMu.Lock() + defer s.changeStateMu.Unlock() + if _, err := s.halt(); err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToAttach, "Failed to attach", err.Error()) + return + } + // Enable StepBack controls on supported backends + if s.config.Debugger.Backend == "rr" { + s.send(&dap.CapabilitiesEvent{Event: *newEvent("capabilities"), Body: dap.CapabilitiesEventBody{Capabilities: dap.Capabilities{SupportsStepBack: true}}}) + } + default: + s.sendShowUserErrorResponse(request.Request, FailedToAttach, "Failed to attach", + fmt.Sprintf("invalid debug configuration - unsupported 'mode' attribute %q", args.Mode)) + return + } + + if err := s.setLaunchAttachArgs(args.LaunchAttachCommonConfig); err != nil { + s.sendShowUserErrorResponse(request.Request, FailedToAttach, "Failed to attach", err.Error()) + return + } + + // Notify the client that the debugger is ready to start accepting + // configuration requests for setting breakpoints, etc. The client + // will end the configuration sequence with 'configurationDone'. + s.send(&dap.InitializedEvent{Event: *newEvent("initialized")}) + s.send(&dap.AttachResponse{Response: *newResponse(request.Request)}) } // onNextRequest handles 'next' request. // This is a mandatory request to support. -func (s *Server) onNextRequest(request *dap.NextRequest) { - // This ingores threadId argument to match the original vscode-go implementation. - // TODO(polina): use SwitchGoroutine to change the current goroutine. - s.send(&dap.NextResponse{Response: *newResponse(request.Request)}) - s.doCommand(api.Next) +func (s *Session) onNextRequest(request *dap.NextRequest, allowNextStateChange chan struct{}) { + s.sendStepResponse(request.Arguments.ThreadId, &dap.NextResponse{Response: *newResponse(request.Request)}) + s.stepUntilStopAndNotify(api.Next, request.Arguments.ThreadId, request.Arguments.Granularity, allowNextStateChange) } // onStepInRequest handles 'stepIn' request // This is a mandatory request to support. -func (s *Server) onStepInRequest(request *dap.StepInRequest) { - // This ingores threadId argument to match the original vscode-go implementation. - // TODO(polina): use SwitchGoroutine to change the current goroutine. - s.send(&dap.StepInResponse{Response: *newResponse(request.Request)}) - s.doCommand(api.Step) +func (s *Session) onStepInRequest(request *dap.StepInRequest, allowNextStateChange chan struct{}) { + s.sendStepResponse(request.Arguments.ThreadId, &dap.StepInResponse{Response: *newResponse(request.Request)}) + s.stepUntilStopAndNotify(api.Step, request.Arguments.ThreadId, request.Arguments.Granularity, allowNextStateChange) } // onStepOutRequest handles 'stepOut' request // This is a mandatory request to support. -func (s *Server) onStepOutRequest(request *dap.StepOutRequest) { - // This ingores threadId argument to match the original vscode-go implementation. - // TODO(polina): use SwitchGoroutine to change the current goroutine. - s.send(&dap.StepOutResponse{Response: *newResponse(request.Request)}) - s.doCommand(api.StepOut) +func (s *Session) onStepOutRequest(request *dap.StepOutRequest, allowNextStateChange chan struct{}) { + s.sendStepResponse(request.Arguments.ThreadId, &dap.StepOutResponse{Response: *newResponse(request.Request)}) + s.stepUntilStopAndNotify(api.StepOut, request.Arguments.ThreadId, request.Arguments.Granularity, allowNextStateChange) +} + +func (s *Session) sendStepResponse(threadId int, message dap.Message) { + // All of the threads will be continued by this request, so we need to send + // a continued event so the UI can properly reflect the current state. + s.send(&dap.ContinuedEvent{ + Event: *newEvent("continued"), + Body: dap.ContinuedEventBody{ + ThreadId: threadId, + AllThreadsContinued: true, + }, + }) + s.send(message) +} + +func stoppedGoroutineID(state *api.DebuggerState) (id int) { + if state.SelectedGoroutine != nil { + id = state.SelectedGoroutine.ID + } else if state.CurrentThread != nil { + id = state.CurrentThread.GoroutineID + } + return id +} + +// stoppedOnBreakpointGoroutineID gets the goroutine id of the first goroutine +// that is stopped on a real breakpoint, starting with the selected goroutine. +func (s *Session) stoppedOnBreakpointGoroutineID(state *api.DebuggerState) (int, *api.Breakpoint) { + // Use the first goroutine that is stopped on a breakpoint. + gs := s.stoppedGs(state) + if len(gs) == 0 { + return 0, nil + } + goid := gs[0] + if goid == 0 { + return goid, state.CurrentThread.Breakpoint + } + g, _ := s.debugger.FindGoroutine(goid) + if g == nil || g.Thread == nil { + return goid, nil + } + bp := g.Thread.Breakpoint() + if bp == nil || bp.Breakpoint == nil { + return goid, nil + } + return goid, api.ConvertBreakpoint(bp.Breakpoint) } -// onPauseRequest sends a not-yet-implemented error response. +// stepUntilStopAndNotify is a wrapper around runUntilStopAndNotify that +// first switches selected goroutine. allowNextStateChange is +// a channel that will be closed to signal that an +// asynchornous command has completed setup or was interrupted +// due to an error, so the server is ready to receive new requests. +func (s *Session) stepUntilStopAndNotify(command string, threadId int, granularity dap.SteppingGranularity, allowNextStateChange chan struct{}) { + defer closeIfOpen(allowNextStateChange) + _, err := s.debugger.Command(&api.DebuggerCommand{Name: api.SwitchGoroutine, GoroutineID: threadId}, nil) + if err != nil { + s.config.log.Errorf("Error switching goroutines while stepping: %v", err) + // If we encounter an error, we will have to send a stopped event + // since we already sent the step response. + stopped := &dap.StoppedEvent{Event: *newEvent("stopped")} + stopped.Body.AllThreadsStopped = true + if state, err := s.debugger.State(false); err != nil { + s.config.log.Errorf("Error retrieving state: %e", err) + } else { + stopped.Body.ThreadId = stoppedGoroutineID(state) + } + stopped.Body.Reason = "error" + stopped.Body.Text = err.Error() + s.send(stopped) + return + } + + if granularity == "instruction" { + switch command { + case api.ReverseNext: + command = api.ReverseStepInstruction + default: + // TODO(suzmue): consider differentiating between next, step in, and step out. + // For example, next could step over call requests. + command = api.StepInstruction + } + } + s.runUntilStopAndNotify(command, allowNextStateChange) +} + +// onPauseRequest handles 'pause' request. // This is a mandatory request to support. -func (s *Server) onPauseRequest(request *dap.PauseRequest) { // TODO V0 - s.sendNotYetImplementedErrorResponse(request.Request) +func (s *Session) onPauseRequest(request *dap.PauseRequest) { + s.changeStateMu.Lock() + defer s.changeStateMu.Unlock() + s.setHaltRequested(true) + _, err := s.halt() + if err != nil { + s.sendErrorResponse(request.Request, UnableToHalt, "Unable to halt execution", err.Error()) + return + } + s.send(&dap.PauseResponse{Response: *newResponse(request.Request)}) + // No need to send any event here. + // If we received this request while stopped, there already was an event for the stop. + // If we received this while running, then doCommand will unblock and trigger the right + // event, using debugger.StopReason because manual stop reason always wins even if we + // simultaneously receive a manual stop request and hit a breakpoint. } // stackFrame represents the index of a frame within @@ -666,73 +1937,169 @@ type stackFrame struct { // onStackTraceRequest handles ‘stackTrace’ requests. // This is a mandatory request to support. -func (s *Server) onStackTraceRequest(request *dap.StackTraceRequest) { +// As per DAP spec, this request only gets triggered as a follow-up +// to a successful threads request as part of the "request waterfall". +func (s *Session) onStackTraceRequest(request *dap.StackTraceRequest) { + if s.debugger == nil { + s.sendErrorResponse(request.Request, UnableToProduceStackTrace, "Unable to produce stack trace", "debugger is nil") + return + } + goroutineID := request.Arguments.ThreadId - locs, err := s.debugger.Stacktrace(goroutineID, s.args.stackTraceDepth, 0, nil /*skip locals & args*/) + start := request.Arguments.StartFrame + if start < 0 { + start = 0 + } + levels := s.args.StackTraceDepth + if request.Arguments.Levels > 0 { + levels = request.Arguments.Levels + } + + // Since the backend doesn't support paging, we load all frames up to + // the requested depth and then slice them here per + // `supportsDelayedStackTraceLoading` capability. + frames, err := s.debugger.Stacktrace(goroutineID, start+levels-1, 0) if err != nil { s.sendErrorResponse(request.Request, UnableToProduceStackTrace, "Unable to produce stack trace", err.Error()) return } - stackFrames := make([]dap.StackFrame, len(locs)) - for i, loc := range locs { - uniqueStackFrameID := s.stackFrameHandles.create(stackFrame{goroutineID, i}) - stackFrames[i] = dap.StackFrame{Id: uniqueStackFrameID, Line: loc.Line} - stackFrames[i].Name = loc.Function.Name() + // Determine if the goroutine is a system goroutine. + isSystemGoroutine := true + if g, _ := s.debugger.FindGoroutine(goroutineID); g != nil { + isSystemGoroutine = g.System(s.debugger.Target()) + } + + stackFrames := []dap.StackFrame{} // initialize to empty, since nil is not an accepted response. + for i := 0; i < levels && i+start < len(frames); i++ { + frame := frames[start+i] + loc := &frame.Call + uniqueStackFrameID := s.stackFrameHandles.create(stackFrame{goroutineID, start + i}) + stackFrame := dap.StackFrame{Id: uniqueStackFrameID, Line: loc.Line, Name: fnName(loc), InstructionPointerReference: fmt.Sprintf("%#x", loc.PC)} if loc.File != "" { - stackFrames[i].Source = dap.Source{Name: filepath.Base(loc.File), Path: loc.File} + clientPath := s.toClientPath(loc.File) + stackFrame.Source = dap.Source{Name: filepath.Base(clientPath), Path: clientPath} } - stackFrames[i].Column = 0 - } - if request.Arguments.StartFrame > 0 { - stackFrames = stackFrames[min(request.Arguments.StartFrame, len(stackFrames)):] + stackFrame.Column = 0 + + packageName := fnPackageName(loc) + if !isSystemGoroutine && packageName == "runtime" { + stackFrame.PresentationHint = "subtle" + } + stackFrames = append(stackFrames, stackFrame) } - if request.Arguments.Levels > 0 { - stackFrames = stackFrames[:min(request.Arguments.Levels, len(stackFrames))] + + totalFrames := len(frames) + if len(frames) >= start+levels && !frames[len(frames)-1].Bottom { + // We don't know the exact number of available stack frames, so + // add an arbitrary number so the client knows to request additional + // frames. + totalFrames += s.args.StackTraceDepth } response := &dap.StackTraceResponse{ Response: *newResponse(request.Request), - Body: dap.StackTraceResponseBody{StackFrames: stackFrames, TotalFrames: len(locs)}, + Body: dap.StackTraceResponseBody{StackFrames: stackFrames, TotalFrames: totalFrames}, } s.send(response) } // onScopesRequest handles 'scopes' requests. // This is a mandatory request to support. -func (s *Server) onScopesRequest(request *dap.ScopesRequest) { +// It is automatically sent as part of the threads > stacktrace > scopes > variables +// "waterfall" to highlight the topmost frame at stops, after an evaluate request +// for the selected scope or when a user selects different scopes in the UI. +func (s *Session) onScopesRequest(request *dap.ScopesRequest) { sf, ok := s.stackFrameHandles.get(request.Arguments.FrameId) if !ok { s.sendErrorResponse(request.Request, UnableToListLocals, "Unable to list locals", fmt.Sprintf("unknown frame id %d", request.Arguments.FrameId)) return } - scope := api.EvalScope{GoroutineID: sf.(stackFrame).goroutineID, Frame: sf.(stackFrame).frameIndex} - // TODO(polina): Support setting config via launch/attach args - cfg := proc.LoadConfig{FollowPointers: true, MaxVariableRecurse: 1, MaxStringLen: 64, MaxArrayValues: 64, MaxStructFields: -1} + goid := sf.(stackFrame).goroutineID + frame := sf.(stackFrame).frameIndex + // Check if the function is optimized. + fn, err := s.debugger.Function(goid, frame, 0, DefaultLoadConfig) + if fn == nil || err != nil { + s.sendErrorResponse(request.Request, UnableToListArgs, "Unable to find enclosing function", err.Error()) + return + } + suffix := "" + if fn.Optimized() { + suffix = " (warning: optimized function)" + } // Retrieve arguments - args, err := s.debugger.FunctionArguments(scope, cfg) + args, err := s.debugger.FunctionArguments(goid, frame, 0, DefaultLoadConfig) if err != nil { s.sendErrorResponse(request.Request, UnableToListArgs, "Unable to list args", err.Error()) return } - argScope := api.Variable{Name: "Arguments", Children: args} // Retrieve local variables - locals, err := s.debugger.LocalVariables(scope, cfg) + locals, err := s.debugger.LocalVariables(goid, frame, 0, DefaultLoadConfig) if err != nil { - s.sendErrorResponse(request.Request, UnableToListLocals, "Unable to list local vars", err.Error()) + s.sendErrorResponse(request.Request, UnableToListLocals, "Unable to list locals", err.Error()) return } - locScope := api.Variable{Name: "Locals", Children: locals} - - // TODO(polina): Annotate shadowed variables - // TODO(polina): Retrieve global variables - - scopeArgs := dap.Scope{Name: argScope.Name, VariablesReference: s.variableHandles.create(argScope)} + locScope := &fullyQualifiedVariable{&proc.Variable{Name: fmt.Sprintf("Locals%s", suffix), Children: slicePtrVarToSliceVar(append(args, locals...))}, "", true, 0} scopeLocals := dap.Scope{Name: locScope.Name, VariablesReference: s.variableHandles.create(locScope)} - scopes := []dap.Scope{scopeArgs, scopeLocals} + scopes := []dap.Scope{scopeLocals} + + if s.args.ShowGlobalVariables { + // Limit what global variables we will return to the current package only. + // TODO(polina): This is how vscode-go currently does it to make + // the amount of the returned data manageable. In fact, this is + // considered so expensive even with the package filter, that + // the default for showGlobalVariables was recently flipped to + // not showing. If we delay loading of the globals until the corresponding + // scope is expanded, generating an explicit variable request, + // should we consider making all globals accessible with a scope per package? + // Or users can just rely on watch variables. + currPkg, err := s.debugger.CurrentPackage() + if err != nil { + s.sendErrorResponse(request.Request, UnableToListGlobals, "Unable to list globals", err.Error()) + return + } + currPkgFilter := fmt.Sprintf("^%s\\.", currPkg) + globals, err := s.debugger.PackageVariables(currPkgFilter, DefaultLoadConfig) + if err != nil { + s.sendErrorResponse(request.Request, UnableToListGlobals, "Unable to list globals", err.Error()) + return + } + // Remove package prefix from the fully-qualified variable names. + // We will include the package info once in the name of the scope instead. + for i, g := range globals { + globals[i].Name = strings.TrimPrefix(g.Name, currPkg+".") + } + + globScope := &fullyQualifiedVariable{&proc.Variable{ + Name: fmt.Sprintf("Globals (package %s)", currPkg), + Children: slicePtrVarToSliceVar(globals), + }, currPkg, true, 0} + scopeGlobals := dap.Scope{Name: globScope.Name, VariablesReference: s.variableHandles.create(globScope)} + scopes = append(scopes, scopeGlobals) + } + if s.args.ShowRegisters { + // Retrieve registers + regs, err := s.debugger.ScopeRegisters(goid, frame, 0, false) + if err != nil { + s.sendErrorResponse(request.Request, UnableToListRegisters, "Unable to list registers", err.Error()) + return + } + outRegs := api.ConvertRegisters(regs, s.debugger.DwarfRegisterToString, false) + regsVar := make([]proc.Variable, len(outRegs)) + for i, r := range outRegs { + regsVar[i] = proc.Variable{ + Name: r.Name, + Value: constant.MakeString(r.Value), + Kind: reflect.Kind(proc.VariableConstant), + } + } + regsScope := &fullyQualifiedVariable{&proc.Variable{Name: "Registers", Children: regsVar}, "", true, 0} + scopeRegisters := dap.Scope{Name: regsScope.Name, VariablesReference: s.variableHandles.create(regsScope)} + scopes = append(scopes, scopeRegisters) + } response := &dap.ScopesResponse{ Response: *newResponse(request.Request), Body: dap.ScopesResponseBody{Scopes: scopes}, @@ -740,18 +2107,90 @@ func (s *Server) onScopesRequest(request *dap.ScopesRequest) { s.send(response) } +func slicePtrVarToSliceVar(vars []*proc.Variable) []proc.Variable { + r := make([]proc.Variable, len(vars)) + for i := range vars { + r[i] = *vars[i] + } + return r +} + // onVariablesRequest handles 'variables' requests. // This is a mandatory request to support. -func (s *Server) onVariablesRequest(request *dap.VariablesRequest) { - variable, ok := s.variableHandles.get(request.Arguments.VariablesReference) +func (s *Session) onVariablesRequest(request *dap.VariablesRequest) { + ref := request.Arguments.VariablesReference + v, ok := s.variableHandles.get(ref) if !ok { - s.sendErrorResponse(request.Request, UnableToLookupVariable, "Unable to lookup variable", fmt.Sprintf("unknown reference %d", request.Arguments.VariablesReference)) + s.sendErrorResponse(request.Request, UnableToLookupVariable, "Unable to lookup variable", fmt.Sprintf("unknown reference %d", ref)) return } - v := variable.(api.Variable) - children := make([]dap.Variable, 0) - // TODO(polina): check and handle if variable loaded incompletely - // https://github.com/go-delve/delve/blob/master/Documentation/api/ClientHowto.md#looking-into-variables + + // If there is a filter applied, we will need to create a new variable that includes + // the values actually needed to load. This cannot be done when loading the parent + // node, since it is unknown at that point which children will need to be loaded. + if request.Arguments.Filter == "indexed" { + var err error + v, err = s.maybeLoadResliced(v, request.Arguments.Start, request.Arguments.Count) + if err != nil { + s.sendErrorResponse(request.Request, UnableToLookupVariable, "Unable to lookup variable", err.Error()) + return + } + } + + children := []dap.Variable{} // must return empty array, not null, if no children + if request.Arguments.Filter == "named" || request.Arguments.Filter == "" { + named, err := s.metadataToDAPVariables(v) + if err != nil { + s.sendErrorResponse(request.Request, UnableToLookupVariable, "Unable to lookup variable", err.Error()) + return + } + children = append(children, named...) + } + if request.Arguments.Filter == "indexed" || request.Arguments.Filter == "" { + indexed, err := s.childrenToDAPVariables(v) + if err != nil { + s.sendErrorResponse(request.Request, UnableToLookupVariable, "Unable to lookup variable", err.Error()) + return + } + children = append(children, indexed...) + } + response := &dap.VariablesResponse{ + Response: *newResponse(request.Request), + Body: dap.VariablesResponseBody{Variables: children}, + } + s.send(response) +} + +func (s *Session) maybeLoadResliced(v *fullyQualifiedVariable, start, count int) (*fullyQualifiedVariable, error) { + if start == 0 && count == len(v.Children) { + // If we have already loaded the correct children, + // just return the variable. + return v, nil + } + indexedLoadConfig := DefaultLoadConfig + indexedLoadConfig.MaxArrayValues = count + newV, err := s.debugger.LoadResliced(v.Variable, start, indexedLoadConfig) + if err != nil { + return nil, err + } + return &fullyQualifiedVariable{newV, v.fullyQualifiedNameOrExpr, false, start}, nil +} + +func getIndexedVariableCount(c *proc.Variable) int { + indexedVars := 0 + switch c.Kind { + case reflect.Array, reflect.Slice, reflect.Map: + indexedVars = int(c.Len) + } + return indexedVars +} + +// childrenToDAPVariables returns the DAP presentation of the referenced variable's children. +func (s *Session) childrenToDAPVariables(v *fullyQualifiedVariable) ([]dap.Variable, error) { + // TODO(polina): consider convertVariableToString instead of convertVariable + // and avoid unnecessary creation of variable handles when this is called to + // compute evaluate names when this is called from onSetVariableRequest. + children := []dap.Variable{} // must return empty array, not null, if no children switch v.Kind { case reflect.Map: @@ -759,227 +2198,1117 @@ func (s *Server) onVariablesRequest(request *dap.VariablesRequest) { // A map will have twice as many children as there are key-value elements. kvIndex := i / 2 // Process children in pairs: even indices are map keys, odd indices are values. - key, keyref := s.convertVariable(v.Children[i]) - val, valref := s.convertVariable(v.Children[i+1]) + keyv, valv := &v.Children[i], &v.Children[i+1] + keyexpr := fmt.Sprintf("(*(*%q)(%#x))", keyv.TypeString(), keyv.Addr) + valexpr := fmt.Sprintf("%s[%s]", v.fullyQualifiedNameOrExpr, keyexpr) + switch keyv.Kind { + // For value expression, use the key value, not the corresponding expression if the key is a scalar. + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + valexpr = fmt.Sprintf("%s[%s]", v.fullyQualifiedNameOrExpr, api.VariableValueAsString(keyv)) + case reflect.String: + if key := constant.StringVal(keyv.Value); keyv.Len == int64(len(key)) { // fully loaded + valexpr = fmt.Sprintf("%s[%q]", v.fullyQualifiedNameOrExpr, key) + } + } + key, keyref := s.convertVariable(keyv, keyexpr) + val, valref := s.convertVariable(valv, valexpr) + keyType := s.getTypeIfSupported(keyv) + valType := s.getTypeIfSupported(valv) // If key or value or both are scalars, we can use // a single variable to represet key:value format. // Otherwise, we must return separate variables for both. if keyref > 0 && valref > 0 { // Both are not scalars keyvar := dap.Variable{ - Name: fmt.Sprintf("[key %d]", kvIndex), + Name: fmt.Sprintf("[key %d]", v.startIndex+kvIndex), + EvaluateName: keyexpr, + Type: keyType, Value: key, VariablesReference: keyref, + IndexedVariables: getIndexedVariableCount(keyv), + NamedVariables: getNamedVariableCount(keyv), } valvar := dap.Variable{ - Name: fmt.Sprintf("[val %d]", kvIndex), + Name: fmt.Sprintf("[val %d]", v.startIndex+kvIndex), + EvaluateName: valexpr, + Type: valType, Value: val, VariablesReference: valref, + IndexedVariables: getIndexedVariableCount(valv), + NamedVariables: getNamedVariableCount(valv), } children = append(children, keyvar, valvar) } else { // At least one is a scalar + keyValType := valType + if len(keyType) > 0 && len(valType) > 0 { + keyValType = fmt.Sprintf("%s: %s", keyType, valType) + } kvvar := dap.Variable{ - Name: key, - Value: val, + Name: key, + EvaluateName: valexpr, + Type: keyValType, + Value: val, } if keyref != 0 { // key is a type to be expanded - kvvar.Name = fmt.Sprintf("%s[%d]", kvvar.Name, kvIndex) // Make the name unique + if len(key) > maxMapKeyValueLen { + // Truncate and make unique + kvvar.Name = fmt.Sprintf("%s... @ %#x", key[0:maxMapKeyValueLen], keyv.Addr) + } kvvar.VariablesReference = keyref + kvvar.IndexedVariables = getIndexedVariableCount(keyv) + kvvar.NamedVariables = getNamedVariableCount(keyv) } else if valref != 0 { // val is a type to be expanded kvvar.VariablesReference = valref + kvvar.IndexedVariables = getIndexedVariableCount(valv) + kvvar.NamedVariables = getNamedVariableCount(valv) } children = append(children, kvvar) } } case reflect.Slice, reflect.Array: children = make([]dap.Variable, len(v.Children)) - for i, c := range v.Children { - value, varref := s.convertVariable(c) + for i := range v.Children { + idx := v.startIndex + i + cfqname := fmt.Sprintf("%s[%d]", v.fullyQualifiedNameOrExpr, idx) + cvalue, cvarref := s.convertVariable(&v.Children[i], cfqname) + children[i] = dap.Variable{ + Name: fmt.Sprintf("[%d]", idx), + EvaluateName: cfqname, + Type: s.getTypeIfSupported(&v.Children[i]), + Value: cvalue, + VariablesReference: cvarref, + IndexedVariables: getIndexedVariableCount(&v.Children[i]), + NamedVariables: getNamedVariableCount(&v.Children[i]), + } + } + default: + children = make([]dap.Variable, len(v.Children)) + for i := range v.Children { + c := &v.Children[i] + cfqname := fmt.Sprintf("%s.%s", v.fullyQualifiedNameOrExpr, c.Name) + + if strings.HasPrefix(c.Name, "~") || strings.HasPrefix(c.Name, ".") { + cfqname = "" + } else if v.isScope && v.fullyQualifiedNameOrExpr == "" { + cfqname = c.Name + } else if v.fullyQualifiedNameOrExpr == "" { + cfqname = "" + } else if v.Kind == reflect.Interface { + cfqname = fmt.Sprintf("%s.(%s)", v.fullyQualifiedNameOrExpr, c.Name) // c is data + } else if v.Kind == reflect.Ptr { + cfqname = fmt.Sprintf("(*%v)", v.fullyQualifiedNameOrExpr) // c is the nameless pointer value + } else if v.Kind == reflect.Complex64 || v.Kind == reflect.Complex128 { + cfqname = "" // complex children are not struct fields and can't be accessed directly + } + cvalue, cvarref := s.convertVariable(c, cfqname) + + // Annotate any shadowed variables to "(name)" in order + // to distinguish from non-shadowed variables. + // TODO(suzmue): should we support a special evaluateName syntax that + // can access shadowed variables? + name := c.Name + if c.Flags&proc.VariableShadowed == proc.VariableShadowed { + name = fmt.Sprintf("(%s)", name) + } + + if v.isScope && v.Name == "Registers" { + // Align all of the register names. + name = fmt.Sprintf("%6s", strings.ToLower(c.Name)) + // Set the correct evaluate name for the register. + cfqname = fmt.Sprintf("_%s", strings.ToUpper(c.Name)) + // Unquote the value + if ucvalue, err := strconv.Unquote(cvalue); err == nil { + cvalue = ucvalue + } + } + children[i] = dap.Variable{ - Name: fmt.Sprintf("[%d]", i), - Value: value, - VariablesReference: varref, + Name: name, + EvaluateName: cfqname, + Type: s.getTypeIfSupported(c), + Value: cvalue, + VariablesReference: cvarref, + IndexedVariables: getIndexedVariableCount(c), + NamedVariables: getNamedVariableCount(c), + } + } + } + return children, nil +} + +func getNamedVariableCount(v *proc.Variable) int { + namedVars := 0 + if v.Kind == reflect.Map && v.Len > 0 { + // len + namedVars += 1 + } + if isListOfBytesOrRunes(v) { + // string value of array/slice of bytes and runes. + namedVars += 1 + } + + return namedVars +} + +// metadataToDAPVariables returns the DAP presentation of the referenced variable's metadata. +// These are included as named variables +func (s *Session) metadataToDAPVariables(v *fullyQualifiedVariable) ([]dap.Variable, error) { + children := []dap.Variable{} // must return empty array, not null, if no children + + if v.Kind == reflect.Map && v.Len > 0 { + children = append(children, dap.Variable{ + Name: "len()", + Value: fmt.Sprintf("%d", v.Len), + Type: "int", + EvaluateName: fmt.Sprintf("len(%s)", v.fullyQualifiedNameOrExpr), + }) + } + + if isListOfBytesOrRunes(v.Variable) { + // Return the string value of []byte or []rune. + typeName := api.PrettyTypeName(v.DwarfType) + loadExpr := fmt.Sprintf("string(*(*%q)(%#x))", typeName, v.Addr) + + s.config.log.Debugf("loading %s (type %s) with %s", v.fullyQualifiedNameOrExpr, typeName, loadExpr) + // We know that this is an array/slice of Uint8 or Int32, so we will load up to MaxStringLen. + config := DefaultLoadConfig + config.MaxArrayValues = config.MaxStringLen + vLoaded, err := s.debugger.EvalVariableInScope(-1, 0, 0, loadExpr, config) + if err == nil { + val := s.convertVariableToString(vLoaded) + // TODO(suzmue): Add evaluate name. Using string(name) will not get the same result because the + // MaxArrayValues is not auto adjusted in evaluate requests like MaxStringLen is adjusted. + children = append(children, dap.Variable{ + Name: "string()", + Value: val, + Type: "string", + }) + } else { + s.config.log.Debugf("failed to load %q: %v", v.fullyQualifiedNameOrExpr, err) + } + } + return children, nil +} + +func isListOfBytesOrRunes(v *proc.Variable) bool { + if len(v.Children) > 0 && (v.Kind == reflect.Array || v.Kind == reflect.Slice) { + childKind := v.Children[0].RealType.Common().ReflectKind + return childKind == reflect.Uint8 || childKind == reflect.Int32 + } + return false +} + +func (s *Session) getTypeIfSupported(v *proc.Variable) string { + if !s.clientCapabilities.supportsVariableType { + return "" + } + return v.TypeString() +} + +// convertVariable converts proc.Variable to dap.Variable value and reference +// while keeping track of the full qualified name or load expression. +// Variable reference is used to keep track of the children associated with each +// variable. It is shared with the host via scopes or evaluate response and is an index +// into the s.variableHandles map, used to look up variables and their children on +// subsequent variables requests. A positive reference signals the host that another +// variables request can be issued to get the elements of the compound variable. As a +// custom, a zero reference, reminiscent of a zero pointer, is used to indicate that +// a scalar variable cannot be "dereferenced" to get its elements (as there are none). +func (s *Session) convertVariable(v *proc.Variable, qualifiedNameOrExpr string) (value string, variablesReference int) { + return s.convertVariableWithOpts(v, qualifiedNameOrExpr, 0) +} + +func (s *Session) convertVariableToString(v *proc.Variable) string { + val, _ := s.convertVariableWithOpts(v, "", skipRef) + return val +} + +const ( + // Limit the length of a string representation of a compound or reference type variable. + maxVarValueLen = 1 << 8 // 256 + // Limit the length of an inlined map key. + maxMapKeyValueLen = 64 +) + +// Flags for convertVariableWithOpts option. +type convertVariableFlags uint8 + +const ( + skipRef convertVariableFlags = 1 << iota + showFullValue +) + +// convertVariableWithOpts allows to skip reference generation in case all we need is +// a string representation of the variable. When the variable is a compound or reference +// type variable and its full string representation can be larger than defaultMaxValueLen, +// this returns a truncated value unless showFull option flag is set. +func (s *Session) convertVariableWithOpts(v *proc.Variable, qualifiedNameOrExpr string, opts convertVariableFlags) (value string, variablesReference int) { + canHaveRef := false + maybeCreateVariableHandle := func(v *proc.Variable) int { + canHaveRef = true + if opts&skipRef != 0 { + return 0 + } + return s.variableHandles.create(&fullyQualifiedVariable{v, qualifiedNameOrExpr, false /*not a scope*/, 0}) + } + value = api.ConvertVar(v).SinglelineString() + if v.Unreadable != nil { + return value, 0 + } + + // Some of the types might be fully or partially not loaded based on LoadConfig. + // Those that are fully missing (e.g. due to hitting MaxVariableRecurse), can be reloaded in place. + var reloadVariable = func(v *proc.Variable, qualifiedNameOrExpr string) (value string) { + // We might be loading variables from the frame that's not topmost, so use + // frame-independent address-based expression, not fully-qualified name as per + // https://github.com/go-delve/delve/blob/master/Documentation/api/ClientHowto.md#looking-into-variables. + // TODO(polina): Get *proc.Variable object from debugger instead. Export a function to set v.loaded to false + // and call v.loadValue gain with a different load config. It's more efficient, and it's guaranteed to keep + // working with generics. + value = api.ConvertVar(v).SinglelineString() + typeName := api.PrettyTypeName(v.DwarfType) + loadExpr := fmt.Sprintf("*(*%q)(%#x)", typeName, v.Addr) + s.config.log.Debugf("loading %s (type %s) with %s", qualifiedNameOrExpr, typeName, loadExpr) + // Make sure we can load the pointers directly, not by updating just the child + // This is not really necessary now because users have no way of setting FollowPointers to false. + config := DefaultLoadConfig + config.FollowPointers = true + vLoaded, err := s.debugger.EvalVariableInScope(-1, 0, 0, loadExpr, config) + if err != nil { + value += fmt.Sprintf(" - FAILED TO LOAD: %s", err) + } else { + v.Children = vLoaded.Children + value = api.ConvertVar(v).SinglelineString() + } + return value + } + + switch v.Kind { + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + n, _ := strconv.ParseUint(api.ConvertVar(v).Value, 10, 64) + value = fmt.Sprintf("%s = %#x", value, n) + case reflect.UnsafePointer: + // Skip child reference + case reflect.Ptr: + if v.DwarfType != nil && len(v.Children) > 0 && v.Children[0].Addr != 0 && v.Children[0].Kind != reflect.Invalid { + if v.Children[0].OnlyAddr { // Not loaded + if v.Addr == 0 { + // This is equvalent to the following with the cli: + // (dlv) p &a7 + // (**main.FooBar)(0xc0000a3918) + // + // TODO(polina): what is more appropriate? + // Option 1: leave it unloaded because it is a special case + // Option 2: load it, but then we have to load the child, not the parent, unlike all others + // TODO(polina): see if reloadVariable can be reused here + cTypeName := api.PrettyTypeName(v.Children[0].DwarfType) + cLoadExpr := fmt.Sprintf("*(*%q)(%#x)", cTypeName, v.Children[0].Addr) + s.config.log.Debugf("loading *(%s) (type %s) with %s", qualifiedNameOrExpr, cTypeName, cLoadExpr) + cLoaded, err := s.debugger.EvalVariableInScope(-1, 0, 0, cLoadExpr, DefaultLoadConfig) + if err != nil { + value += fmt.Sprintf(" - FAILED TO LOAD: %s", err) + } else { + cLoaded.Name = v.Children[0].Name // otherwise, this will be the pointer expression + v.Children = []proc.Variable{*cLoaded} + value = api.ConvertVar(v).SinglelineString() + } + } else { + value = reloadVariable(v, qualifiedNameOrExpr) + } + } + if !v.Children[0].OnlyAddr { + variablesReference = maybeCreateVariableHandle(v) + } + } + case reflect.Slice, reflect.Array: + if v.Len > int64(len(v.Children)) { // Not fully loaded + if v.Base != 0 && len(v.Children) == 0 { // Fully missing + value = reloadVariable(v, qualifiedNameOrExpr) + } else if !s.clientCapabilities.supportsVariablePaging { + value = fmt.Sprintf("(loaded %d/%d) ", len(v.Children), v.Len) + value } } - default: - children = make([]dap.Variable, len(v.Children)) - for i, c := range v.Children { - value, variablesReference := s.convertVariable(c) - children[i] = dap.Variable{ - Name: c.Name, - Value: value, - VariablesReference: variablesReference, - } + if v.Base != 0 && len(v.Children) > 0 { + variablesReference = maybeCreateVariableHandle(v) + } + case reflect.Map: + if v.Len > int64(len(v.Children)/2) { // Not fully loaded + if len(v.Children) == 0 { // Fully missing + value = reloadVariable(v, qualifiedNameOrExpr) + } else if !s.clientCapabilities.supportsVariablePaging { + value = fmt.Sprintf("(loaded %d/%d) ", len(v.Children)/2, v.Len) + value + } + } + if v.Base != 0 && len(v.Children) > 0 { + variablesReference = maybeCreateVariableHandle(v) + } + case reflect.String: + // TODO(polina): implement auto-loading here. + case reflect.Interface: + if v.Addr != 0 && len(v.Children) > 0 && v.Children[0].Kind != reflect.Invalid && v.Children[0].Addr != 0 { + if v.Children[0].OnlyAddr { // Not loaded + value = reloadVariable(v, qualifiedNameOrExpr) + } + if !v.Children[0].OnlyAddr { + variablesReference = maybeCreateVariableHandle(v) + } + } + case reflect.Struct: + if v.Len > int64(len(v.Children)) { // Not fully loaded + if len(v.Children) == 0 { // Fully missing + value = reloadVariable(v, qualifiedNameOrExpr) + } else { // Partially missing (TODO) + value = fmt.Sprintf("(loaded %d/%d) ", len(v.Children), v.Len) + value + } + } + if len(v.Children) > 0 { + variablesReference = maybeCreateVariableHandle(v) + } + case reflect.Complex64, reflect.Complex128: + v.Children = make([]proc.Variable, 2) + v.Children[0].Name = "real" + v.Children[0].Value = constant.Real(v.Value) + v.Children[1].Name = "imaginary" + v.Children[1].Value = constant.Imag(v.Value) + if v.Kind == reflect.Complex64 { + v.Children[0].Kind = reflect.Float32 + v.Children[1].Kind = reflect.Float32 + } else { + v.Children[0].Kind = reflect.Float64 + v.Children[1].Kind = reflect.Float64 + } + fallthrough + default: // Complex, Scalar, Chan, Func + if len(v.Children) > 0 { + variablesReference = maybeCreateVariableHandle(v) + } + } + + // By default, only values of variables that have children can be truncated. + // If showFullValue is set, then all value strings are not truncated. + canTruncateValue := showFullValue&opts == 0 + if len(value) > maxVarValueLen && canTruncateValue && canHaveRef { + value = value[:maxVarValueLen] + "..." + } + return value, variablesReference +} + +// onEvaluateRequest handles 'evalute' requests. +// This is a mandatory request to support. +// Support the following expressions: +// -- {expression} - evaluates the expression and returns the result as a variable +// -- call {function} - injects a function call and returns the result as a variable +// -- config {expression} - updates configuration paramaters +// TODO(polina): users have complained about having to click to expand multi-level +// variables, so consider also adding the following: +// -- print {expression} - return the result as a string like from dlv cli +func (s *Session) onEvaluateRequest(request *dap.EvaluateRequest) { + showErrorToUser := request.Arguments.Context != "watch" && request.Arguments.Context != "repl" && request.Arguments.Context != "hover" + if s.debugger == nil { + s.sendErrorResponseWithOpts(request.Request, UnableToEvaluateExpression, "Unable to evaluate expression", "debugger is nil", showErrorToUser) + return + } + + // Default to the topmost stack frame of the current goroutine in case + // no frame is specified (e.g. when stopped on entry or no call stack frame is expanded) + goid, frame := -1, 0 + if sf, ok := s.stackFrameHandles.get(request.Arguments.FrameId); ok { + goid = sf.(stackFrame).goroutineID + frame = sf.(stackFrame).frameIndex + } + + response := &dap.EvaluateResponse{Response: *newResponse(request.Request)} + expr := request.Arguments.Expression + + if isConfig, err := regexp.MatchString(`^\s*dlv\s+\S+`, expr); err == nil && isConfig { // dlv {command} + expr := strings.Replace(expr, "dlv ", "", 1) + result, err := s.delveCmd(goid, frame, expr) + if err != nil { + s.sendErrorResponseWithOpts(request.Request, UnableToRunDlvCommand, "Unable to run dlv command", err.Error(), showErrorToUser) + return + } + response.Body = dap.EvaluateResponseBody{ + Result: result, + } + } else if isCall, err := regexp.MatchString(`^\s*call\s+\S+`, expr); err == nil && isCall { // call {expression} + expr := strings.Replace(expr, "call ", "", 1) + _, retVars, err := s.doCall(goid, frame, expr) + if err != nil { + s.sendErrorResponseWithOpts(request.Request, UnableToEvaluateExpression, "Unable to evaluate expression", err.Error(), showErrorToUser) + return + } + // The call completed and we can reply with its return values (if any) + if len(retVars) > 0 { + // Package one or more return values in a single scope-like nameless variable + // that preserves their names. + retVarsAsVar := &proc.Variable{Children: slicePtrVarToSliceVar(retVars)} + // As a shortcut also express the return values as a single string. + retVarsAsStr := "" + for _, v := range retVars { + retVarsAsStr += s.convertVariableToString(v) + ", " + } + response.Body = dap.EvaluateResponseBody{ + Result: strings.TrimRight(retVarsAsStr, ", "), + VariablesReference: s.variableHandles.create(&fullyQualifiedVariable{retVarsAsVar, "", false /*not a scope*/, 0}), + } + } + } else { // {expression} + exprVar, err := s.debugger.EvalVariableInScope(goid, frame, 0, expr, DefaultLoadConfig) + if err != nil { + s.sendErrorResponseWithOpts(request.Request, UnableToEvaluateExpression, "Unable to evaluate expression", err.Error(), showErrorToUser) + return + } + + ctxt := request.Arguments.Context + switch ctxt { + case "repl", "variables", "hover", "clipboard": + if exprVar.Kind == reflect.String { + if strVal := constant.StringVal(exprVar.Value); exprVar.Len > int64(len(strVal)) { + // Reload the string value with a bigger limit. + loadCfg := DefaultLoadConfig + loadCfg.MaxStringLen = maxSingleStringLen + if v, err := s.debugger.EvalVariableInScope(goid, frame, 0, request.Arguments.Expression, loadCfg); err != nil { + s.config.log.Debugf("Failed to load more for %v: %v", request.Arguments.Expression, err) + } else { + exprVar = v + } + } + } + } + var opts convertVariableFlags + // Send the full value when the context is "clipboard" or "variables" since + // these contexts are used to copy the value. + if ctxt == "clipboard" || ctxt == "variables" { + opts |= showFullValue + } + exprVal, exprRef := s.convertVariableWithOpts(exprVar, fmt.Sprintf("(%s)", request.Arguments.Expression), opts) + response.Body = dap.EvaluateResponseBody{Result: exprVal, VariablesReference: exprRef, IndexedVariables: getIndexedVariableCount(exprVar), NamedVariables: getNamedVariableCount(exprVar)} + } + s.send(response) +} + +func (s *Session) doCall(goid, frame int, expr string) (*api.DebuggerState, []*proc.Variable, error) { + // This call might be evaluated in the context of the frame that is not topmost + // if the editor is set to view the variables for one of the parent frames. + // If the call expression refers to any of these variables, unlike regular + // expressions, it will evaluate them in the context of the topmost frame, + // and the user will get an unexpected result or an unexpected symbol error. + // We prevent this but disallowing any frames other than topmost. + if frame > 0 { + return nil, nil, fmt.Errorf("call is only supported with topmost stack frame") + } + stateBeforeCall, err := s.debugger.State( /*nowait*/ true) + if err != nil { + return nil, nil, err + } + // The return values of injected function calls are volatile. + // Load as much useful data as possible. + // TODO: investigate whether we need to increase other limits. For example, + // the return value is a pointer to a temporary object, which can become + // invalid by other injected function calls. Do we care about such use cases? + loadCfg := DefaultLoadConfig + loadCfg.MaxStringLen = maxStringLenInCallRetVars + + // TODO(polina): since call will resume execution of all goroutines, + // we should do this asynchronously and send a continued event to the + // editor, followed by a stop event when the call completes. + state, err := s.debugger.Command(&api.DebuggerCommand{ + Name: api.Call, + ReturnInfoLoadConfig: api.LoadConfigFromProc(&loadCfg), + Expr: expr, + UnsafeCall: false, + GoroutineID: goid, + }, nil) + if processExited(state, err) { + e := &dap.TerminatedEvent{Event: *newEvent("terminated")} + s.send(e) + return nil, nil, errors.New("terminated") + } + if err != nil { + return nil, nil, err + } + + // After the call is done, the goroutine where we injected the call should + // return to the original stopped line with return values. However, + // it is not guaranteed to be selected due to the possibility of the + // of simultaenous breakpoints. Therefore, we check all threads. + var retVars []*proc.Variable + found := false + for _, t := range state.Threads { + if t.GoroutineID == stateBeforeCall.SelectedGoroutine.ID && + t.Line == stateBeforeCall.SelectedGoroutine.CurrentLoc.Line && t.CallReturn { + found = true + // The call completed. Get the return values. + retVars, err = s.debugger.FindThreadReturnValues(t.ID, loadCfg) + if err != nil { + return nil, nil, err + } + break + } + } + // Normal function calls expect return values, but call commands + // used for variable assignments do not return a value when they succeed. + // In go '=' is not an operator. Check if go/parser complains. + // If the above Call command passed but the expression is not a valid + // go expression, we just handled a variable assignment request. + isAssignment := false + if _, err := parser.ParseExpr(expr); err != nil { + isAssignment = true + } + + // note: as described in https://github.com/golang/go/issues/25578, function call injection + // causes to resume the entire Go process. Due to this limitation, there is no guarantee + // that the process is in the same state even after the injected call returns normally + // without any surprises such as breakpoints or panic. To handle this correctly we need + // to reset all the handles (both variables and stack frames). + // + // We considered sending a stopped event after each call unconditionally, but a stopped + // event can be expensive and can interact badly with the client-side optimization + // to refresh information. For example, VS Code reissues scopes/evaluate (for watch) after + // completing a setVariable or evaluate request for repl context. Thus, for now, we + // do not trigger a stopped event and hope editors to refetch the updated state as soon + // as the user resumes debugging. + + if !found || !isAssignment && retVars == nil { + // The call got interrupted by a stop (e.g. breakpoint in injected + // function call or in another goroutine). + s.resetHandlesForStoppedEvent() + s.sendStoppedEvent(state) + + // TODO(polina): once this is asynchronous, we could wait to reply until the user + // continues, call ends, original stop point is hit and return values are available + // instead of returning an error 'call stopped' here. + return nil, nil, errors.New("call stopped") + } + return state, retVars, nil +} + +func (s *Session) sendStoppedEvent(state *api.DebuggerState) { + stopped := &dap.StoppedEvent{Event: *newEvent("stopped")} + stopped.Body.AllThreadsStopped = true + stopped.Body.ThreadId = stoppedGoroutineID(state) + stopped.Body.Reason = s.debugger.StopReason().String() + s.send(stopped) +} + +// onTerminateRequest sends a not-yet-implemented error response. +// Capability 'supportsTerminateRequest' is not set in 'initialize' response. +func (s *Session) onTerminateRequest(request *dap.TerminateRequest) { + s.sendNotYetImplementedErrorResponse(request.Request) +} + +// onRestartRequest sends a not-yet-implemented error response +// Capability 'supportsRestartRequest' is not set in 'initialize' response. +func (s *Session) onRestartRequest(request *dap.RestartRequest) { + s.sendNotYetImplementedErrorResponse(request.Request) +} + +// onStepBackRequest handles 'stepBack' request. +// This is an optional request enabled by capability ‘supportsStepBackRequest’. +func (s *Session) onStepBackRequest(request *dap.StepBackRequest, allowNextStateChange chan struct{}) { + s.sendStepResponse(request.Arguments.ThreadId, &dap.StepBackResponse{Response: *newResponse(request.Request)}) + s.stepUntilStopAndNotify(api.ReverseNext, request.Arguments.ThreadId, request.Arguments.Granularity, allowNextStateChange) +} + +// onReverseContinueRequest performs a rewind command call up to the previous +// breakpoint or the start of the process +// This is an optional request enabled by capability ‘supportsStepBackRequest’. +func (s *Session) onReverseContinueRequest(request *dap.ReverseContinueRequest, allowNextStateChange chan struct{}) { + s.send(&dap.ReverseContinueResponse{ + Response: *newResponse(request.Request), + }) + s.runUntilStopAndNotify(api.Rewind, allowNextStateChange) +} + +// computeEvaluateName finds the named child, and computes its evaluate name. +func (s *Session) computeEvaluateName(v *fullyQualifiedVariable, cname string) (string, error) { + children, err := s.childrenToDAPVariables(v) + if err != nil { + return "", err + } + for _, c := range children { + if c.Name == cname { + if c.EvaluateName != "" { + return c.EvaluateName, nil + } + return "", errors.New("cannot set the variable without evaluate name") + } + } + return "", errors.New("failed to find the named variable") +} + +// onSetVariableRequest handles 'setVariable' requests. +func (s *Session) onSetVariableRequest(request *dap.SetVariableRequest) { + arg := request.Arguments + + v, ok := s.variableHandles.get(arg.VariablesReference) + if !ok { + s.sendErrorResponse(request.Request, UnableToSetVariable, "Unable to lookup variable", fmt.Sprintf("unknown reference %d", arg.VariablesReference)) + return + } + // We need to translate the arg.Name to its evaluateName if the name + // refers to a field or element of a variable. + // https://github.com/microsoft/vscode/issues/120774 + evaluateName, err := s.computeEvaluateName(v, arg.Name) + if err != nil { + s.sendErrorResponse(request.Request, UnableToSetVariable, "Unable to set variable", err.Error()) + return + } + + // By running EvalVariableInScope, we get the type info of the variable + // that can be accessed with the evaluateName, and ensure the variable we are + // trying to update is valid and accessible from the top most frame & the + // current goroutine. + goid, frame := -1, 0 + evaluated, err := s.debugger.EvalVariableInScope(goid, frame, 0, evaluateName, DefaultLoadConfig) + if err != nil { + s.sendErrorResponse(request.Request, UnableToSetVariable, "Unable to lookup variable", err.Error()) + return + } + + useFnCall := false + switch evaluated.Kind { + case reflect.String: + useFnCall = true + default: + // TODO(hyangah): it's possible to set a non-string variable using (`call i = fn()`) + // and we don't support it through the Set Variable request yet. + // If we want to support it for non-string types, we need to parse arg.Value. + } + + if useFnCall { + // TODO(hyangah): function call injection currentlly allows to assign return values of + // a function call to variables. So, curious users would find set variable + // on string would accept expression like `fn()`. + if state, retVals, err := s.doCall(goid, frame, fmt.Sprintf("%v=%v", evaluateName, arg.Value)); err != nil { + s.sendErrorResponse(request.Request, UnableToSetVariable, "Unable to set variable", err.Error()) + return + } else if retVals != nil { + // The assignment expression isn't supposed to return values, but we got them. + // That indicates something went wrong (e.g. panic). + // TODO: isn't it simpler to do this in s.doCall? + s.resetHandlesForStoppedEvent() + s.sendStoppedEvent(state) + + var r []string + for _, v := range retVals { + r = append(r, s.convertVariableToString(v)) + } + msg := "interrupted" + if len(r) > 0 { + msg = "interrupted:" + strings.Join(r, ", ") + } + + s.sendErrorResponse(request.Request, UnableToSetVariable, "Unable to set variable", msg) + return + } + } else { + if err := s.debugger.SetVariableInScope(goid, frame, 0, evaluateName, arg.Value); err != nil { + s.sendErrorResponse(request.Request, UnableToSetVariable, "Unable to set variable", err.Error()) + return + } + } + // * Note on inconsistent state after set variable: + // + // The variable handles may be in inconsistent state - for example, + // let's assume there are two aliased variables pointing to the same + // memory and both are already loaded and cached in the variable handle. + // VSCode tries to locally update the UI when the set variable + // request succeeds, and may issue additional scopes or evaluate requests + // to update the variable/watch sections if necessary. + // + // More complicated situation is when the set variable involves call + // injection - after the injected call is completed, the debugee can + // be in a completely different state (see the note in doCall) due to + // how the call injection is implemented. Ideally, we need to also refresh + // the stack frames but that is complicated. For now we don't try to actively + // invalidate this state hoping that the editors will refetch the state + // as soon as the user resumes debugging. + + response := &dap.SetVariableResponse{Response: *newResponse(request.Request)} + response.Body.Value = arg.Value + // TODO(hyangah): instead of arg.Value, reload the variable and return + // the presentation of the new value. + s.send(response) +} + +// onSetExpression sends a not-yet-implemented error response. +// Capability 'supportsSetExpression' is not set 'initialize' response. +func (s *Session) onSetExpressionRequest(request *dap.SetExpressionRequest) { + s.sendNotYetImplementedErrorResponse(request.Request) +} + +// onLoadedSourcesRequest sends a not-yet-implemented error response. +// Capability 'supportsLoadedSourcesRequest' is not set 'initialize' response. +func (s *Session) onLoadedSourcesRequest(request *dap.LoadedSourcesRequest) { + s.sendNotYetImplementedErrorResponse(request.Request) +} + +// onReadMemoryRequest sends a not-yet-implemented error response. +// Capability 'supportsReadMemoryRequest' is not set 'initialize' response. +func (s *Session) onReadMemoryRequest(request *dap.ReadMemoryRequest) { + s.sendNotYetImplementedErrorResponse(request.Request) +} + +var invalidInstruction = dap.DisassembledInstruction{ + Instruction: "invalid instruction", +} + +// onDisassembleRequest handles 'disassemble' requests. +// Capability 'supportsDisassembleRequest' is set in 'initialize' response. +func (s *Session) onDisassembleRequest(request *dap.DisassembleRequest) { + // TODO(suzmue): microsoft/vscode#129655 is discussing the difference between + // memory reference and instructionPointerReference, which are currently + // being used interchangeably by vscode. + addr, err := strconv.ParseUint(request.Arguments.MemoryReference, 0, 64) + if err != nil { + s.sendErrorResponse(request.Request, UnableToDisassemble, "Unable to disassemble", err.Error()) + return + } + + // If the requested memory address is an invalid location, return all invalid instructions. + // TODO(suzmue): consider adding fake addresses that would allow us to receive out of bounds + // requests that include valid instructions designated by InstructionOffset or InstructionCount. + if addr == 0 || addr == uint64(math.MaxUint64) { + instructions := make([]dap.DisassembledInstruction, request.Arguments.InstructionCount) + for i := range instructions { + instructions[i] = invalidInstruction + instructions[i].Address = request.Arguments.MemoryReference + } + response := &dap.DisassembleResponse{ + Response: *newResponse(request.Request), + Body: dap.DisassembleResponseBody{ + Instructions: instructions, + }, } + s.send(response) + return } - response := &dap.VariablesResponse{ - Response: *newResponse(request.Request), - Body: dap.VariablesResponseBody{Variables: children}, - // TODO(polina): support evaluateName field + + start := uint64(addr) + maxInstructionLength := s.debugger.Target().BinInfo().Arch.MaxInstructionLength() + byteOffset := request.Arguments.InstructionOffset * maxInstructionLength + // Adjust the offset to include instructions before the requested address. + if byteOffset < 0 { + start = uint64(int(addr) + byteOffset) } - s.send(response) -} + // Adjust the number of instructions to include enough instructions after + // the requested address. + count := request.Arguments.InstructionCount + if byteOffset > 0 { + count += byteOffset + } + end := uint64(int(addr) + count*maxInstructionLength) -// convertVariable converts api.Variable to dap.Variable value and reference. -// Variable reference is used to keep track of the children associated with each -// variable. It is shared with the host via a scopes response and is an index to -// the s.variableHandles map, so it can be referenced from a subsequent variables -// request. A positive reference signals the host that another variables request -// can be issued to get the elements of the compound variable. As a custom, a zero -// reference, reminiscent of a zero pointer, is used to indicate that a scalar -// variable cannot be "dereferenced" to get its elements (as there are none). -func (s *Server) convertVariable(v api.Variable) (value string, variablesReference int) { - if v.Unreadable != "" { - value = fmt.Sprintf("unreadable <%s>", v.Unreadable) + // Make sure the PCs are lined up with instructions. + start, end = alignPCs(s.debugger.Target().BinInfo(), start, end) + + // Disassemble the instructions + procInstructions, err := s.debugger.Disassemble(-1, start, end) + if err != nil { + s.sendErrorResponse(request.Request, UnableToDisassemble, "Unable to disassemble", err.Error()) return } - switch v.Kind { - case reflect.UnsafePointer: - if len(v.Children) == 0 { - value = "unsafe.Pointer(nil)" - } else { - value = fmt.Sprintf("unsafe.Pointer(%#x)", v.Children[0].Addr) - } - case reflect.Ptr: - if v.Type == "" || len(v.Children) == 0 { - value = "nil" - } else if v.Children[0].Addr == 0 { - value = "nil <" + v.Type + ">" - } else if v.Children[0].Type == "void" { - value = "void" - } else { - value = fmt.Sprintf("<%s>(%#x)", v.Type, v.Children[0].Addr) - variablesReference = s.variableHandles.create(v) - } - case reflect.Array: - value = "<" + v.Type + ">" - if len(v.Children) > 0 { - variablesReference = s.variableHandles.create(v) - } - case reflect.Slice: - if v.Base == 0 { - value = "nil <" + v.Type + ">" - } else { - value = fmt.Sprintf("<%s> (length: %d, cap: %d)", v.Type, v.Len, v.Cap) - if len(v.Children) > 0 { - variablesReference = s.variableHandles.create(v) - } - } - case reflect.Map: - if v.Base == 0 { - value = "nil <" + v.Type + ">" - } else { - value = fmt.Sprintf("<%s> (length: %d)", v.Type, v.Len) - if len(v.Children) > 0 { - variablesReference = s.variableHandles.create(v) - } - } - case reflect.String: - lenNotLoaded := v.Len - int64(len(v.Value)) - vvalue := v.Value - if lenNotLoaded > 0 { - vvalue += fmt.Sprintf("...+%d more", lenNotLoaded) - } - value = fmt.Sprintf("%q", vvalue) - case reflect.Chan: - if len(v.Children) == 0 { - value = "nil <" + v.Type + ">" - } else { - value = "<" + v.Type + ">" - variablesReference = s.variableHandles.create(v) + + // Find the section of instructions that were requested. + procInstructions, offset, err := findInstructions(procInstructions, addr, request.Arguments.InstructionOffset, request.Arguments.InstructionCount) + if err != nil { + s.sendErrorResponse(request.Request, UnableToDisassemble, "Unable to disassemble", err.Error()) + return + } + + // Turn the given range of instructions into dap instructions. + instructions := make([]dap.DisassembledInstruction, request.Arguments.InstructionCount) + lastFile, lastLine := "", -1 + for i := range instructions { + // i is not in a valid range, use an address that is just before or after + // the range. This ensures that it can still be parsed as an int. + if i < offset { + // i is not in a valid range. + instructions[i] = invalidInstruction + instructions[i].Address = "0x0" + continue } - case reflect.Interface: - if len(v.Children) == 0 || v.Children[0].Kind == reflect.Invalid && v.Children[0].Addr == 0 { - value = "nil <" + v.Type + ">" - } else { - value = "<" + v.Type + ">" - variablesReference = s.variableHandles.create(v) + if (i - offset) >= len(procInstructions) { + // i is not in a valid range. + instructions[i] = invalidInstruction + instructions[i].Address = fmt.Sprintf("%#x", uint64(math.MaxUint64)) + continue + } - default: // Struct, complex, scalar - if v.Value != "" { - value = v.Value - } else { - value = "<" + v.Type + ">" + instruction := api.ConvertAsmInstruction(procInstructions[i-offset], s.debugger.AsmInstructionText(&procInstructions[i-offset], proc.GoFlavour)) + instructions[i] = dap.DisassembledInstruction{ + Address: fmt.Sprintf("%#x", instruction.Loc.PC), + InstructionBytes: fmt.Sprintf("%x", instruction.Bytes), + Instruction: instruction.Text, } - if len(v.Children) > 0 { - variablesReference = s.variableHandles.create(v) + // Only set the location on the first instruction for a given line. + if instruction.Loc.File != lastFile || instruction.Loc.Line != lastLine { + instructions[i].Location = dap.Source{Path: instruction.Loc.File} + instructions[i].Line = instruction.Loc.Line + lastFile, lastLine = instruction.Loc.File, instruction.Loc.Line } } - return -} -// onEvaluateRequest sends a not-yet-implemented error response. -// This is a mandatory request to support. -func (s *Server) onEvaluateRequest(request *dap.EvaluateRequest) { // TODO V0 - s.sendNotYetImplementedErrorResponse(request.Request) + response := &dap.DisassembleResponse{ + Response: *newResponse(request.Request), + Body: dap.DisassembleResponseBody{ + Instructions: instructions, + }, + } + s.send(response) } -// onTerminateRequest sends a not-yet-implemented error response. -// Capability 'supportsTerminateRequest' is not set in 'initialize' response. -func (s *Server) onTerminateRequest(request *dap.TerminateRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) +func findInstructions(procInstructions []proc.AsmInstruction, addr uint64, instructionOffset, count int) ([]proc.AsmInstruction, int, error) { + ref := sort.Search(len(procInstructions), func(i int) bool { + return procInstructions[i].Loc.PC >= addr + }) + if ref == len(procInstructions) || procInstructions[ref].Loc.PC != uint64(addr) { + return nil, -1, fmt.Errorf("could not find memory reference") + } + // offset is the number of instructions that should appear before the first instruction + // returned by findInstructions. + offset := 0 + if ref+instructionOffset < 0 { + offset = -(ref + instructionOffset) + } + // Figure out the index to slice at. + startIdx := ref + instructionOffset + endIdx := ref + instructionOffset + count + if endIdx <= 0 || startIdx >= len(procInstructions) { + return []proc.AsmInstruction{}, 0, nil + } + // Adjust start and end to be inbounds. + if startIdx < 0 { + offset = -startIdx + startIdx = 0 + } + if endIdx > len(procInstructions) { + endIdx = len(procInstructions) + } + return procInstructions[startIdx:endIdx], offset, nil } -// onRestartRequest sends a not-yet-implemented error response -// Capability 'supportsRestartRequest' is not set in 'initialize' response. -func (s *Server) onRestartRequest(request *dap.RestartRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) +func getValidRange(bi *proc.BinaryInfo) (uint64, uint64) { + return bi.Functions[0].Entry, bi.Functions[len(bi.Functions)-1].End } -// onSetFunctionBreakpointsRequest sends a not-yet-implemented error response. -// Capability 'supportsFunctionBreakpoints' is not set 'initialize' response. -func (s *Server) onSetFunctionBreakpointsRequest(request *dap.SetFunctionBreakpointsRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) -} +func alignPCs(bi *proc.BinaryInfo, start, end uint64) (uint64, uint64) { + // We want to find the function locations position that would enclose + // the range from start to end. + // + // Example: + // + // 0x0000 instruction (func1) + // 0x0004 instruction (func1) + // 0x0008 instruction (func1) + // 0x000c nop + // 0x000e nop + // 0x0000 nop + // 0x0002 nop + // 0x0004 instruction (func2) + // 0x0008 instruction (func2) + // 0x000c instruction (func2) + // + // start values: + // < 0x0000 at func1.Entry = 0x0000 + // 0x0000-0x000b at func1.Entry = 0x0000 + // 0x000c-0x0003 at func1.End = 0x000c + // 0x0004-0x000f at func2.Entry = 0x0004 + // > 0x000f at func2.End = 0x0010 + // + // end values: + // < 0x0000 at func1.Entry = 0x0000 + // 0x0000-0x000b at func1.End = 0x0000 + // 0x000c-0x0003 at func2.Entry = 0x000c + // 0x0004-0x000f at func2.End = 0x0004 + // > 0x000f at func2.End = 0x0004 + // Handle start values: + fn := bi.PCToFunc(start) + if fn != nil { + // start is in a funcition. + start = fn.Entry + } else if b, pc := checkOutOfAddressSpace(start, bi); b { + start = pc + } else { + // Otherwise it must come after some function. + i := sort.Search(len(bi.Functions), func(i int) bool { + fn := bi.Functions[len(bi.Functions)-(i+1)] + return start >= fn.End + }) + start = bi.Functions[len(bi.Functions)-(i+1)].Entry + } -// onStepBackRequest sends a not-yet-implemented error response. -// Capability 'supportsStepBack' is not set 'initialize' response. -func (s *Server) onStepBackRequest(request *dap.StepBackRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) + // Handle end values: + if fn := bi.PCToFunc(end); fn != nil { + // end is in a funcition. + end = fn.End + } else if b, pc := checkOutOfAddressSpace(end, bi); b { + end = pc + } else { + // Otherwise it must come before some function. + i := sort.Search(len(bi.Functions), func(i int) bool { + fn := bi.Functions[i] + return end < fn.Entry + }) + end = bi.Functions[i].Entry + } + + return start, end } -// onReverseContinueRequest sends a not-yet-implemented error response. -// Capability 'supportsStepBack' is not set 'initialize' response. -func (s *Server) onReverseContinueRequest(request *dap.ReverseContinueRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) +func checkOutOfAddressSpace(pc uint64, bi *proc.BinaryInfo) (bool, uint64) { + entry, end := getValidRange(bi) + if pc < entry { + return true, entry + } + if pc >= end { + return true, end + } + return false, pc } -// onSetVariableRequest sends a not-yet-implemented error response. -// Capability 'supportsSetVariable' is not set 'initialize' response. -func (s *Server) onSetVariableRequest(request *dap.SetVariableRequest) { // TODO V0 +// onCancelRequest sends a not-yet-implemented error response. +// Capability 'supportsCancelRequest' is not set 'initialize' response. +func (s *Session) onCancelRequest(request *dap.CancelRequest) { s.sendNotYetImplementedErrorResponse(request.Request) } -// onSetExpression sends a not-yet-implemented error response. -// Capability 'supportsSetExpression' is not set 'initialize' response. -func (s *Server) onSetExpressionRequest(request *dap.SetExpressionRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) +// onExceptionInfoRequest handles 'exceptionInfo' requests. +// Capability 'supportsExceptionInfoRequest' is set in 'initialize' response. +func (s *Session) onExceptionInfoRequest(request *dap.ExceptionInfoRequest) { + goroutineID := request.Arguments.ThreadId + var body dap.ExceptionInfoResponseBody + // Get the goroutine and the current state. + g, err := s.debugger.FindGoroutine(goroutineID) + if err != nil { + s.sendErrorResponse(request.Request, UnableToGetExceptionInfo, "Unable to get exception info", err.Error()) + return + } + if g == nil { + s.sendErrorResponse(request.Request, UnableToGetExceptionInfo, "Unable to get exception info", fmt.Sprintf("could not find goroutine %d", goroutineID)) + return + } + var bpState *proc.BreakpointState + if g.Thread != nil { + bpState = g.Thread.Breakpoint() + } + // Check if this goroutine ID is stopped at a breakpoint. + includeStackTrace := true + if bpState != nil && bpState.Breakpoint != nil && (bpState.Breakpoint.Name == proc.FatalThrow || bpState.Breakpoint.Name == proc.UnrecoveredPanic) { + switch bpState.Breakpoint.Name { + case proc.FatalThrow: + body.ExceptionId = "fatal error" + body.Description, err = s.throwReason(goroutineID) + if err != nil { + body.Description = fmt.Sprintf("Error getting throw reason: %s", err.Error()) + // This is not currently working for Go 1.16. + ver := goversion.ParseProducer(s.debugger.TargetGoVersion()) + if ver.Major == 1 && ver.Minor == 16 { + body.Description = "Throw reason unavailable, see https://github.com/golang/go/issues/46425" + } + } + case proc.UnrecoveredPanic: + body.ExceptionId = "panic" + // Attempt to get the value of the panic message. + body.Description, err = s.panicReason(goroutineID) + if err != nil { + body.Description = fmt.Sprintf("Error getting panic message: %s", err.Error()) + } + } + } else { + // If this thread is not stopped on a breakpoint, then a runtime error must have occurred. + // If we do not have any error saved, or if this thread is not current thread, + // return an error. + if s.exceptionErr == nil { + s.sendErrorResponse(request.Request, UnableToGetExceptionInfo, "Unable to get exception info", "no runtime error found") + return + } + + state, err := s.debugger.State( /*nowait*/ true) + if err != nil { + s.sendErrorResponse(request.Request, UnableToGetExceptionInfo, "Unable to get exception info", err.Error()) + return + } + if s.exceptionErr.Error() != "next while nexting" && (state == nil || state.CurrentThread == nil || g.Thread == nil || state.CurrentThread.ID != g.Thread.ThreadID()) { + s.sendErrorResponse(request.Request, UnableToGetExceptionInfo, "Unable to get exception info", fmt.Sprintf("no exception found for goroutine %d", goroutineID)) + return + } + body.ExceptionId = "runtime error" + body.Description = s.exceptionErr.Error() + if body.Description == "bad access" { + body.Description = BetterBadAccessError + } + if body.Description == "next while nexting" { + body.ExceptionId = "invalid command" + body.Description = BetterNextWhileNextingError + includeStackTrace = false + } + } + + if includeStackTrace { + frames, err := s.stacktrace(goroutineID, g) + if err != nil { + body.Details.StackTrace = fmt.Sprintf("Error getting stack trace: %s", err.Error()) + } else { + body.Details.StackTrace = frames + } + } + response := &dap.ExceptionInfoResponse{ + Response: *newResponse(request.Request), + Body: body, + } + s.send(response) } -// onLoadedSourcesRequest sends a not-yet-implemented error response. -// Capability 'supportsLoadedSourcesRequest' is not set 'initialize' response. -func (s *Server) onLoadedSourcesRequest(request *dap.LoadedSourcesRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) +func (s *Session) stacktrace(goroutineID int, g *proc.G) (string, error) { + frames, err := s.debugger.Stacktrace(goroutineID, s.args.StackTraceDepth, 0) + if err != nil { + return "", err + } + apiFrames, err := s.debugger.ConvertStacktrace(frames, nil) + if err != nil { + return "", err + } + + var buf bytes.Buffer + fmt.Fprintln(&buf, "Stack:") + userLoc := g.UserCurrent() + userFuncPkg := fnPackageName(&userLoc) + api.PrintStack(s.toClientPath, &buf, apiFrames, "\t", false, func(s api.Stackframe) bool { + // Include all stack frames if the stack trace is for a system goroutine, + // otherwise, skip runtime stack frames. + if userFuncPkg == "runtime" { + return true + } + return s.Location.Function != nil && !strings.HasPrefix(s.Location.Function.Name(), "runtime.") + }) + return buf.String(), nil } -// onReadMemoryRequest sends a not-yet-implemented error response. -// Capability 'supportsReadMemoryRequest' is not set 'initialize' response. -func (s *Server) onReadMemoryRequest(request *dap.ReadMemoryRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) +func (s *Session) throwReason(goroutineID int) (string, error) { + return s.getExprString("s", goroutineID, 0) } -// onDisassembleRequest sends a not-yet-implemented error response. -// Capability 'supportsDisassembleRequest' is not set 'initialize' response. -func (s *Server) onDisassembleRequest(request *dap.DisassembleRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) +func (s *Session) panicReason(goroutineID int) (string, error) { + return s.getExprString("(*msgs).arg.(data)", goroutineID, 0) } -// onCancelRequest sends a not-yet-implemented error response. -// Capability 'supportsCancelRequest' is not set 'initialize' response. -func (s *Server) onCancelRequest(request *dap.CancelRequest) { - s.sendNotYetImplementedErrorResponse(request.Request) +func (s *Session) getExprString(expr string, goroutineID, frame int) (string, error) { + exprVar, err := s.debugger.EvalVariableInScope(goroutineID, frame, 0, expr, DefaultLoadConfig) + if err != nil { + return "", err + } + if exprVar.Value == nil { + return "", exprVar.Unreadable + } + return exprVar.Value.String(), nil } -func (s *Server) sendErrorResponse(request dap.Request, id int, summary, details string) { +// sendErrorResponseWithOpts offers configuration options. +// showUser - if true, the error will be shown to the user (e.g. via a visible pop-up) +func (s *Session) sendErrorResponseWithOpts(request dap.Request, id int, summary, details string, showUser bool) { er := &dap.ErrorResponse{} er.Type = "response" er.Command = request.Command @@ -988,14 +3317,25 @@ func (s *Server) sendErrorResponse(request dap.Request, id int, summary, details er.Message = summary er.Body.Error.Id = id er.Body.Error.Format = fmt.Sprintf("%s: %s", summary, details) - s.log.Error(er.Body.Error.Format) + er.Body.Error.ShowUser = showUser + s.config.log.Debug(er.Body.Error.Format) s.send(er) } +// sendErrorResponse sends an error response with showUser disabled (default). +func (s *Session) sendErrorResponse(request dap.Request, id int, summary, details string) { + s.sendErrorResponseWithOpts(request, id, summary, details, false /*showUser*/) +} + +// sendShowUserErrorResponse sends an error response with showUser enabled. +func (s *Session) sendShowUserErrorResponse(request dap.Request, id int, summary, details string) { + s.sendErrorResponseWithOpts(request, id, summary, details, true /*showUser*/) +} + // sendInternalErrorResponse sends an "internal error" response back to the client. // We only take a seq here because we don't want to make assumptions about the // kind of message received by the server that this error is a reply to. -func (s *Server) sendInternalErrorResponse(seq int, details string) { +func (s *Session) sendInternalErrorResponse(seq int, details string) { er := &dap.ErrorResponse{} er.Type = "response" er.RequestSeq = seq @@ -1003,18 +3343,18 @@ func (s *Server) sendInternalErrorResponse(seq int, details string) { er.Message = "Internal Error" er.Body.Error.Id = InternalError er.Body.Error.Format = fmt.Sprintf("%s: %s", er.Message, details) - s.log.Error(er.Body.Error.Format) + s.config.log.Debug(er.Body.Error.Format) s.send(er) } -func (s *Server) sendUnsupportedErrorResponse(request dap.Request) { +func (s *Session) sendUnsupportedErrorResponse(request dap.Request) { s.sendErrorResponse(request, UnsupportedCommand, "Unsupported command", - fmt.Sprintf("cannot process '%s' request", request.Command)) + fmt.Sprintf("cannot process %q request", request.Command)) } -func (s *Server) sendNotYetImplementedErrorResponse(request dap.Request) { +func (s *Session) sendNotYetImplementedErrorResponse(request dap.Request) { s.sendErrorResponse(request, NotYetImplemented, "Not yet implemented", - fmt.Sprintf("cannot process '%s' request", request.Command)) + fmt.Sprintf("cannot process %q request", request.Command)) } func newResponse(request dap.Request) *dap.Response { @@ -1040,64 +3380,389 @@ func newEvent(event string) *dap.Event { } const BetterBadAccessError = `invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation] -Unable to propogate EXC_BAD_ACCESS signal to target process and panic (see https://github.com/go-delve/delve/issues/852)` +Unable to propagate EXC_BAD_ACCESS signal to target process and panic (see https://github.com/go-delve/delve/issues/852)` +const BetterNextWhileNextingError = `Unable to step while the previous step is interrupted by a breakpoint. +Use 'Continue' to resume the original step command.` + +func (s *Session) resetHandlesForStoppedEvent() { + s.stackFrameHandles.reset() + s.variableHandles.reset() + s.exceptionErr = nil +} + +func processExited(state *api.DebuggerState, err error) bool { + _, isexited := err.(proc.ErrProcessExited) + return isexited || err == nil && state.Exited +} + +func (s *Session) setRunningCmd(running bool) { + s.runningMu.Lock() + defer s.runningMu.Unlock() + s.runningCmd = running +} + +func (s *Session) isRunningCmd() bool { + s.runningMu.Lock() + defer s.runningMu.Unlock() + return s.runningCmd +} + +func (s *Session) setHaltRequested(requested bool) { + s.haltMu.Lock() + defer s.haltMu.Unlock() + s.haltRequested = requested +} + +func (s *Session) checkHaltRequested() bool { + s.haltMu.Lock() + defer s.haltMu.Unlock() + return s.haltRequested +} -// doCommand runs a debugger command until it stops on +// resumeOnce is a helper function to resume the execution +// of the target when the program is halted. +func (s *Session) resumeOnce(command string, allowNextStateChange chan struct{}) (bool, *api.DebuggerState, error) { + // No other goroutines should be able to try to resume + // or halt execution while this goroutine is resuming + // execution, so we do not miss those events. + asyncSetupDone := make(chan struct{}, 1) + defer closeIfOpen(asyncSetupDone) + s.changeStateMu.Lock() + go func() { + defer s.changeStateMu.Unlock() + defer closeIfOpen(allowNextStateChange) + <-asyncSetupDone + }() + + // There may have been a manual halt while the program was + // stopped. If this happened, do not resume execution of + // the program. + if s.checkHaltRequested() { + state, err := s.debugger.State(false) + return false, state, err + } + state, err := s.debugger.Command(&api.DebuggerCommand{Name: command}, asyncSetupDone) + return true, state, err +} + +// runUntilStopAndNotify runs a debugger command until it stops on // termination, error, breakpoint, etc, when an appropriate -// event needs to be sent to the client. -func (s *Server) doCommand(command string) { - if s.debugger == nil { +// event needs to be sent to the client. allowNextStateChange is +// a channel that will be closed to signal that an +// asynchornous command has completed setup or was interrupted +// due to an error, so the server is ready to receive new requests. +func (s *Session) runUntilStopAndNotify(command string, allowNextStateChange chan struct{}) { + state, err := s.runUntilStop(command, allowNextStateChange) + + if s.conn.isClosed() { + s.config.log.Debugf("connection %d closed - stopping %q command", s.id, command) return } - state, err := s.debugger.Command(&api.DebuggerCommand{Name: command}) - if _, isexited := err.(proc.ErrProcessExited); isexited || err == nil && state.Exited { - e := &dap.TerminatedEvent{Event: *newEvent("terminated")} - s.send(e) + if processExited(state, err) { + s.send(&dap.TerminatedEvent{Event: *newEvent("terminated")}) return } - s.stackFrameHandles.reset() - s.variableHandles.reset() + stopReason := s.debugger.StopReason() + file, line := "?", -1 + if state != nil && state.CurrentThread != nil { + file, line = state.CurrentThread.File, state.CurrentThread.Line + } + s.config.log.Debugf("%q command stopped - reason %q, location %s:%d", command, stopReason, file, line) + s.resetHandlesForStoppedEvent() stopped := &dap.StoppedEvent{Event: *newEvent("stopped")} stopped.Body.AllThreadsStopped = true if err == nil { - stopped.Body.ThreadId = state.SelectedGoroutine.ID - switch command { - case api.Next, api.Step, api.StepOut: + if stopReason == proc.StopManual { + if err := s.debugger.CancelNext(); err != nil { + s.config.log.Error(err) + } else { + state.NextInProgress = false + } + } + stopped.Body.ThreadId = stoppedGoroutineID(state) + + switch stopReason { + case proc.StopNextFinished: stopped.Body.Reason = "step" + case proc.StopManual: // triggered by halt + stopped.Body.Reason = "pause" + case proc.StopUnknown: // can happen while terminating + stopped.Body.Reason = "unknown" + case proc.StopWatchpoint: + stopped.Body.Reason = "data breakpoint" default: stopped.Body.Reason = "breakpoint" + var bp *api.Breakpoint + if stopped.Body.ThreadId, bp = s.stoppedOnBreakpointGoroutineID(state); bp != nil { + switch bp.Name { + case proc.FatalThrow: + stopped.Body.Reason = "exception" + stopped.Body.Description = "fatal error" + stopped.Body.Text, _ = s.throwReason(stopped.Body.ThreadId) + case proc.UnrecoveredPanic: + stopped.Body.Reason = "exception" + stopped.Body.Description = "panic" + stopped.Body.Text, _ = s.panicReason(stopped.Body.ThreadId) + } + if strings.HasPrefix(bp.Name, functionBpPrefix) { + stopped.Body.Reason = "function breakpoint" + } + if strings.HasPrefix(bp.Name, instructionBpPrefix) { + stopped.Body.Reason = "instruction breakpoint" + } + stopped.Body.HitBreakpointIds = []int{bp.ID} + } } - s.send(stopped) + + // Override the stop reason if there was a manual stop request. + // TODO(suzmue): move this logic into the runUntilStop command + // so that the stop reason is determined by that function which + // has all the context. + if stopped.Body.Reason != "exception" && s.checkHaltRequested() { + s.config.log.Debugf("manual halt requested, stop reason %q converted to \"pause\"", stopped.Body.Reason) + stopped.Body.Reason = "pause" + stopped.Body.HitBreakpointIds = []int{} + } + } else { - s.log.Error("runtime error: ", err) - stopped.Body.Reason = "runtime error" + s.exceptionErr = err + s.config.log.Error("runtime error: ", err) + stopped.Body.Reason = "exception" + stopped.Body.Description = "runtime error" stopped.Body.Text = err.Error() // Special case in the spirit of https://github.com/microsoft/vscode-go/issues/1903 if stopped.Body.Text == "bad access" { stopped.Body.Text = BetterBadAccessError } + if stopped.Body.Text == "next while nexting" { + stopped.Body.Description = "invalid command" + stopped.Body.Text = BetterNextWhileNextingError + s.logToConsole(fmt.Sprintf("%s: %s", stopped.Body.Description, stopped.Body.Text)) + } + state, err := s.debugger.State( /*nowait*/ true) if err == nil { - stopped.Body.ThreadId = state.CurrentThread.GoroutineID + stopped.Body.ThreadId = stoppedGoroutineID(state) } - s.send(stopped) + } + + // NOTE: If we happen to be responding to another request with an is-running + // error while this one completes, it is possible that the error response + // will arrive after this stopped event. + s.send(stopped) + + // Send an output event with more information if next is in progress. + if state != nil && state.NextInProgress { + s.logToConsole("Step interrupted by a breakpoint. Use 'Continue' to resume the original step command.") + } +} + +func (s *Session) runUntilStop(command string, allowNextStateChange chan struct{}) (*api.DebuggerState, error) { + // Clear any manual stop requests that came in before we started running. + s.setHaltRequested(false) + + s.setRunningCmd(true) + defer s.setRunningCmd(false) + + var state *api.DebuggerState + var err error + for s.isRunningCmd() { + state, err = resumeOnceAndCheckStop(s, command, allowNextStateChange) + command = api.DirectionCongruentContinue + } + return state, err +} + +// Make this a var so it can be stubbed in testing. +var resumeOnceAndCheckStop = func(s *Session, command string, allowNextStateChange chan struct{}) (*api.DebuggerState, error) { + return s.resumeOnceAndCheckStop(command, allowNextStateChange) +} + +func (s *Session) resumeOnceAndCheckStop(command string, allowNextStateChange chan struct{}) (*api.DebuggerState, error) { + resumed, state, err := s.resumeOnce(command, allowNextStateChange) + // We should not try to process the log points if the program was not + // resumed or there was an error. + if !resumed || processExited(state, err) || state == nil || err != nil || s.conn.isClosed() { + s.setRunningCmd(false) + return state, err + } + + s.handleLogPoints(state) + gsOnBp := s.stoppedGs(state) + + switch s.debugger.StopReason() { + case proc.StopBreakpoint, proc.StopManual: + // Make sure a real manual stop was requested or a real breakpoint was hit. + if len(gsOnBp) > 0 || s.checkHaltRequested() { + s.setRunningCmd(false) + } + default: + s.setRunningCmd(false) + } + + // Stepping a single instruction will never require continuing again. + if command == api.StepInstruction || command == api.ReverseStepInstruction { + s.setRunningCmd(false) + } + + return state, err +} + +func (s *Session) handleLogPoints(state *api.DebuggerState) { + for _, th := range state.Threads { + if bp := th.Breakpoint; bp != nil { + s.logBreakpointMessage(bp, th.GoroutineID) + } + } +} + +func (s *Session) stoppedGs(state *api.DebuggerState) (gs []int) { + // Check the current thread first. There may be no selected goroutine. + if state.CurrentThread.Breakpoint != nil && !state.CurrentThread.Breakpoint.Tracepoint { + gs = append(gs, state.CurrentThread.GoroutineID) + } + if s.debugger.StopReason() == proc.StopHardcodedBreakpoint { + gs = append(gs, stoppedGoroutineID(state)) + } + for _, th := range state.Threads { + // Some threads may be stopped on a hardcoded breakpoint. + // TODO(suzmue): This is a workaround for detecting hard coded breakpoints, + // though this check is likely not sufficient. It would be better to resolve + // this in the debugger layer instead. + if th.Function.Name() == "runtime.breakpoint" { + gs = append(gs, th.GoroutineID) + continue + } + // We already added the current thread if it had a breakpoint. + if th.ID == state.CurrentThread.ID { + continue + } + if bp := th.Breakpoint; bp != nil { + if !th.Breakpoint.Tracepoint { + gs = append(gs, th.GoroutineID) + } + } + } + return gs +} - // TODO(polina): according to the spec, the extra 'text' is supposed to show up in the UI (e.g. on hover), - // but so far I am unable to get this to work in vscode - see https://github.com/microsoft/vscode/issues/104475. - // Options to explore: - // - supporting ExceptionInfo request - // - virtual variable scope for Exception that shows the message (details here: https://github.com/microsoft/vscode/issues/3101) - // In the meantime, provide the extra details by outputing an error message. - // {"body":{"category":"stdout","output":"API server listening at: 127.0.0.1:11973\n"}} +func (s *Session) logBreakpointMessage(bp *api.Breakpoint, goid int) bool { + if !bp.Tracepoint { + return false + } + if lMsg, ok := bp.UserData.(logMessage); ok { + msg := lMsg.evaluate(s, goid) s.send(&dap.OutputEvent{ Event: *newEvent("output"), Body: dap.OutputEventBody{ - Output: fmt.Sprintf("ERROR: %s\n", stopped.Body.Text), - Category: "stderr", - }}) + Category: "stdout", + Output: fmt.Sprintf("> [Go %d]: %s\n", goid, msg), + Source: dap.Source{ + Path: s.toClientPath(bp.File), + }, + Line: bp.Line, + }, + }) + } + return true +} + +func (msg *logMessage) evaluate(s *Session, goid int) string { + evaluated := make([]interface{}, len(msg.args)) + for i := range msg.args { + exprVar, err := s.debugger.EvalVariableInScope(goid, 0, 0, msg.args[i], DefaultLoadConfig) + if err != nil { + evaluated[i] = fmt.Sprintf("{eval err: %e}", err) + continue + } + evaluated[i] = s.convertVariableToString(exprVar) + } + return fmt.Sprintf(msg.format, evaluated...) +} + +func (s *Session) toClientPath(path string) string { + if len(s.args.substitutePathServerToClient) == 0 { + return path + } + clientPath := locspec.SubstitutePath(path, s.args.substitutePathServerToClient) + if clientPath != path { + s.config.log.Debugf("server path=%s converted to client path=%s\n", path, clientPath) + } + return clientPath +} + +func (s *Session) toServerPath(path string) string { + if len(s.args.substitutePathClientToServer) == 0 { + return path + } + serverPath := locspec.SubstitutePath(path, s.args.substitutePathClientToServer) + if serverPath != path { + s.config.log.Debugf("client path=%s converted to server path=%s\n", path, serverPath) + } + return serverPath +} + +type logMessage struct { + format string + args []string +} + +// parseLogPoint parses a log message according to the DAP spec: +// "Expressions within {} are interpolated." +func parseLogPoint(msg string) (bool, *logMessage, error) { + // Note: All braces *must* come in pairs, even those within an + // expression to be interpolated. + // TODO(suzmue): support individual braces in string values in + // eval expressions. + var args []string + + var isArg bool + var formatSlice, argSlice []rune + braceCount := 0 + for _, r := range msg { + if isArg { + switch r { + case '}': + if braceCount--; braceCount == 0 { + argStr := strings.TrimSpace(string(argSlice)) + if len(argStr) == 0 { + return false, nil, fmt.Errorf("empty evaluation string") + } + args = append(args, argStr) + formatSlice = append(formatSlice, '%', 's') + isArg = false + continue + } + case '{': + braceCount += 1 + } + argSlice = append(argSlice, r) + continue + } + + switch r { + case '}': + return false, nil, fmt.Errorf("invalid log point format, unexpected '}'") + case '{': + if braceCount++; braceCount == 1 { + isArg, argSlice = true, []rune{} + continue + } + } + formatSlice = append(formatSlice, r) + } + if isArg { + return false, nil, fmt.Errorf("invalid log point format") + } + if len(formatSlice) == 0 { + return false, nil, nil } + return true, &logMessage{ + format: string(formatSlice), + args: args, + }, nil } diff --git a/service/dap/server_test.go b/service/dap/server_test.go index 55ad100fbb..a89f2f6ce5 100644 --- a/service/dap/server_test.go +++ b/service/dap/server_test.go @@ -1,23 +1,31 @@ package dap import ( + "bufio" "flag" + "fmt" "io" + "io/ioutil" + "math" + "math/rand" "net" "os" + "os/exec" "path/filepath" "reflect" "regexp" "runtime" + "strconv" "strings" - "sync" "testing" "time" "github.com/go-delve/delve/pkg/goversion" "github.com/go-delve/delve/pkg/logflags" + "github.com/go-delve/delve/pkg/proc" protest "github.com/go-delve/delve/pkg/proc/test" "github.com/go-delve/delve/service" + "github.com/go-delve/delve/service/api" "github.com/go-delve/delve/service/dap/daptest" "github.com/go-delve/delve/service/debugger" "github.com/google/go-dap" @@ -27,11 +35,18 @@ const stopOnEntry bool = true const hasChildren bool = true const noChildren bool = false +const localsScope = 1000 +const globalsScope = 1001 + var testBackend string func TestMain(m *testing.M) { + logOutputVal := "" + if _, isTeamCityTest := os.LookupEnv("TEAMCITY_VERSION"); isTeamCityTest { + logOutputVal = "debugger,dap" + } var logOutput string - flag.StringVar(&logOutput, "log-output", "", "configures log output") + flag.StringVar(&logOutput, "log-output", logOutputVal, "configures log output") flag.Parse() logflags.Setup(logOutput != "", logOutput, "") protest.DefaultTestBackend(&testBackend) @@ -40,47 +55,267 @@ func TestMain(m *testing.M) { // name is for _fixtures/.go func runTest(t *testing.T, name string, test func(c *daptest.Client, f protest.Fixture)) { - var buildFlags protest.BuildFlags + runTestBuildFlags(t, name, test, protest.AllNonOptimized) +} + +// name is for _fixtures/.go +func runTestBuildFlags(t *testing.T, name string, test func(c *daptest.Client, f protest.Fixture), buildFlags protest.BuildFlags) { fixture := protest.BuildFixture(name, buildFlags) + // Start the DAP server. + serverStopped := make(chan struct{}) + client := startDAPServerWithClient(t, serverStopped) + defer client.Close() + + test(client, fixture) + <-serverStopped +} + +func startDAPServerWithClient(t *testing.T, serverStopped chan struct{}) *daptest.Client { + server, _ := startDAPServer(t, serverStopped) + client := daptest.NewClient(server.config.Listener.Addr().String()) + return client +} + +func startDAPServer(t *testing.T, serverStopped chan struct{}) (server *Server, forceStop chan struct{}) { // Start the DAP server. listener, err := net.Listen("tcp", ":0") if err != nil { t.Fatal(err) } disconnectChan := make(chan struct{}) - server := NewServer(&service.Config{ + server = NewServer(&service.Config{ Listener: listener, DisconnectChan: disconnectChan, - Debugger: debugger.Config{ - Backend: "default", - }, }) server.Run() // Give server time to start listening for clients time.Sleep(100 * time.Millisecond) - var stopOnce sync.Once // Run a goroutine that stops the server when disconnectChan is signaled. // This helps us test that certain events cause the server to stop as // expected. + forceStop = make(chan struct{}) go func() { - <-disconnectChan - stopOnce.Do(func() { server.Stop() }) + defer func() { + if serverStopped != nil { + close(serverStopped) + } + }() + select { + case <-disconnectChan: // Stop triggered internally + case <-forceStop: // Stop triggered externally + } + server.Stop() }() - client := daptest.NewClient(listener.Addr().String()) - defer client.Close() + return server, forceStop +} - defer func() { - stopOnce.Do(func() { server.Stop() }) - }() +func verifyServerStopped(t *testing.T, server *Server) { + t.Helper() + if server.listener != nil { + if server.listener.Close() == nil { + t.Error("server should have closed listener after shutdown") + } + } + verifySessionStopped(t, server.session) +} - test(client, fixture) +func verifySessionStopped(t *testing.T, session *Session) { + t.Helper() + if session == nil { + return + } + if session.conn == nil { + t.Error("session must always have a set connection") + } + verifyConnStopped(t, session.conn) + if session.debugger != nil { + t.Error("session should have no pointer to debugger after shutdown") + } + if session.binaryToRemove != "" { + t.Error("session should have no binary to remove after shutdown") + } +} + +func verifyConnStopped(t *testing.T, conn io.ReadWriteCloser) { + t.Helper() + if conn.Close() == nil { + t.Error("client connection should be closed after shutdown") + } +} + +func TestStopNoClient(t *testing.T) { + for name, triggerStop := range map[string]func(s *Server, forceStop chan struct{}){ + "force": func(s *Server, forceStop chan struct{}) { close(forceStop) }, + "accept error": func(s *Server, forceStop chan struct{}) { s.config.Listener.Close() }, + } { + t.Run(name, func(t *testing.T) { + serverStopped := make(chan struct{}) + server, forceStop := startDAPServer(t, serverStopped) + triggerStop(server, forceStop) + <-serverStopped + verifyServerStopped(t, server) + }) + } +} + +func TestStopNoTarget(t *testing.T) { + for name, triggerStop := range map[string]func(c *daptest.Client, forceStop chan struct{}){ + "force": func(c *daptest.Client, forceStop chan struct{}) { close(forceStop) }, + "read error": func(c *daptest.Client, forceStop chan struct{}) { c.Close() }, + "disconnect": func(c *daptest.Client, forceStop chan struct{}) { c.DisconnectRequest() }, + } { + t.Run(name, func(t *testing.T) { + serverStopped := make(chan struct{}) + server, forceStop := startDAPServer(t, serverStopped) + client := daptest.NewClient(server.config.Listener.Addr().String()) + defer client.Close() + + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + triggerStop(client, forceStop) + <-serverStopped + verifyServerStopped(t, server) + }) + } +} + +func TestStopWithTarget(t *testing.T) { + for name, triggerStop := range map[string]func(c *daptest.Client, forceStop chan struct{}){ + "force": func(c *daptest.Client, forceStop chan struct{}) { close(forceStop) }, + "read error": func(c *daptest.Client, forceStop chan struct{}) { c.Close() }, + "disconnect before exit": func(c *daptest.Client, forceStop chan struct{}) { c.DisconnectRequest() }, + "disconnect after exit": func(c *daptest.Client, forceStop chan struct{}) { + c.ContinueRequest(1) + c.ExpectContinueResponse(t) + c.ExpectTerminatedEvent(t) + c.DisconnectRequest() + }, + } { + t.Run(name, func(t *testing.T) { + serverStopped := make(chan struct{}) + server, forceStop := startDAPServer(t, serverStopped) + client := daptest.NewClient(server.config.Listener.Addr().String()) + defer client.Close() + + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + fixture := protest.BuildFixture("increment", protest.AllNonOptimized) + client.LaunchRequest("debug", fixture.Source, stopOnEntry) + client.ExpectInitializedEvent(t) + client.ExpectLaunchResponse(t) + triggerStop(client, forceStop) + <-serverStopped + verifyServerStopped(t, server) + }) + } +} + +func TestSessionStop(t *testing.T) { + verifySessionState := func(t *testing.T, s *Session, binaryToRemoveSet bool, debuggerSet bool, disconnectChanSet bool) { + t.Helper() + if binaryToRemoveSet && s.binaryToRemove == "" || !binaryToRemoveSet && s.binaryToRemove != "" { + t.Errorf("binaryToRemove: got %s, want set=%v", s.binaryToRemove, binaryToRemoveSet) + } + if debuggerSet && s.debugger == nil || !debuggerSet && s.debugger != nil { + t.Errorf("debugger: got %v, want set=%v", s.debugger, debuggerSet) + } + if disconnectChanSet && s.config.DisconnectChan == nil || !disconnectChanSet && s.config.DisconnectChan != nil { + t.Errorf("disconnectChan: got %v, want set=%v", s.config.DisconnectChan, disconnectChanSet) + } + } + for name, stopSession := range map[string]func(s *Session, c *daptest.Client, serveDone chan struct{}){ + "force": func(s *Session, c *daptest.Client, serveDone chan struct{}) { + s.Close() + <-serveDone + verifySessionState(t, s, false /*binaryToRemoveSet*/, false /*debuggerSet*/, false /*disconnectChanSet*/) + }, + "read error": func(s *Session, c *daptest.Client, serveDone chan struct{}) { + c.Close() + <-serveDone + verifyConnStopped(t, s.conn) + verifySessionState(t, s, true /*binaryToRemoveSet*/, true /*debuggerSet*/, false /*disconnectChanSet*/) + s.Close() + }, + "disconnect before exit": func(s *Session, c *daptest.Client, serveDone chan struct{}) { + c.DisconnectRequest() + <-serveDone + verifyConnStopped(t, s.conn) + verifySessionState(t, s, true /*binaryToRemoveSet*/, false /*debuggerSet*/, false /*disconnectChanSet*/) + s.Close() + }, + "disconnect after exit": func(s *Session, c *daptest.Client, serveDone chan struct{}) { + c.ContinueRequest(1) + c.ExpectContinueResponse(t) + c.ExpectTerminatedEvent(t) + c.DisconnectRequest() + <-serveDone + verifyConnStopped(t, s.conn) + verifySessionState(t, s, true /*binaryToRemoveSet*/, false /*debuggerSet*/, false /*disconnectChanSet*/) + s.Close() + }, + } { + t.Run(name, func(t *testing.T) { + listener, err := net.Listen("tcp", ":0") + if err != nil { + t.Fatalf("cannot setup listener required for testing: %v", err) + } + defer listener.Close() + acceptDone := make(chan struct{}) + var conn net.Conn + go func() { + conn, err = listener.Accept() + close(acceptDone) + }() + time.Sleep(10 * time.Millisecond) // give time to start listening + client := daptest.NewClient(listener.Addr().String()) + defer client.Close() + <-acceptDone + if err != nil { + t.Fatalf("cannot accept client requireed for testing: %v", err) + } + session := NewSession(conn, &Config{ + Config: &service.Config{DisconnectChan: make(chan struct{})}, + StopTriggered: make(chan struct{})}, nil) + serveDAPCodecDone := make(chan struct{}) + go func() { + session.ServeDAPCodec() + close(serveDAPCodecDone) + }() + time.Sleep(10 * time.Millisecond) // give time to start reading + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + fixture := protest.BuildFixture("increment", protest.AllNonOptimized) + client.LaunchRequest("debug", fixture.Source, stopOnEntry) + client.ExpectInitializedEvent(t) + client.ExpectLaunchResponse(t) + stopSession(session, client, serveDAPCodecDone) + verifySessionStopped(t, session) + }) + } +} + +func TestForceStopWhileStopping(t *testing.T) { + serverStopped := make(chan struct{}) + server, forceStop := startDAPServer(t, serverStopped) + client := daptest.NewClient(server.config.Listener.Addr().String()) + + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + fixture := protest.BuildFixture("increment", protest.AllNonOptimized) + client.LaunchRequest("exec", fixture.Path, stopOnEntry) + client.ExpectInitializedEvent(t) + client.Close() // depending on timing may trigger Stop() + time.Sleep(time.Microsecond) + close(forceStop) // depending on timing may trigger Stop() + <-serverStopped + verifyServerStopped(t, server) } -// TestStopOnEntry emulates the message exchange that can be observed with -// VS Code for the most basic debug session with "stopOnEntry" enabled: +// TestLaunchStopOnEntry emulates the message exchange that can be observed with +// VS Code for the most basic launch debug session with "stopOnEntry" enabled: // - User selects "Start Debugging": 1 >> initialize // : 1 << initialize // : 2 >> launch @@ -98,21 +333,27 @@ func runTest(t *testing.T, name string, test func(c *daptest.Client, f protest.F // : 7 >> threads // : 7 << threads (Dummy) // : 8 >> stackTrace -// : 8 << stackTrace (Unable to produce stack trace) +// : 8 << error (Unable to produce stack trace) // : 9 >> stackTrace -// : 9 << stackTrace (Unable to produce stack trace) -// - User selects "Continue" : 10 >> continue -// : 10 << continue +// : 9 << error (Unable to produce stack trace) +// - User evaluates bad expression : 10 >> evaluate +// : 10 << error (unable to find function context) +// - User evaluates good expression: 11 >> evaluate +// : 11 << evaluate +// - User selects "Continue" : 12 >> continue +// : 12 << continue // - Program runs to completion : << terminated event -// : 11 >> disconnect -// : 11 << disconnect +// : 13 >> disconnect +// : << output event (Process exited) +// : << output event (Detaching) +// : 13 << disconnect // This test exhaustively tests Seq and RequestSeq on all messages from the // server. Other tests do not necessarily need to repeat all these checks. -func TestStopOnEntry(t *testing.T) { +func TestLaunchStopOnEntry(t *testing.T) { runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { // 1 >> initialize, << initialize client.InitializeRequest() - initResp := client.ExpectInitializeResponse(t) + initResp := client.ExpectInitializeResponseAndCapabilities(t) if initResp.Seq != 0 || initResp.RequestSeq != 1 { t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=1", initResp) } @@ -173,37 +414,199 @@ func TestStopOnEntry(t *testing.T) { t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=7 len(Threads)=1", tResp) } - // 8 >> stackTrace, << stackTrace + // 8 >> stackTrace, << error client.StackTraceRequest(1, 0, 20) - stResp := client.ExpectErrorResponse(t) + stResp := client.ExpectInvisibleErrorResponse(t) if stResp.Seq != 0 || stResp.RequestSeq != 8 || stResp.Body.Error.Format != "Unable to produce stack trace: unknown goroutine 1" { t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=8 Format=\"Unable to produce stack trace: unknown goroutine 1\"", stResp) } - // 9 >> stackTrace, << stackTrace + // 9 >> stackTrace, << error client.StackTraceRequest(1, 0, 20) - stResp = client.ExpectErrorResponse(t) - if stResp.Seq != 0 || stResp.RequestSeq != 9 || stResp.Body.Error.Id != 2004 { - t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=9 Id=2004", stResp) + stResp = client.ExpectInvisibleErrorResponse(t) + if stResp.Seq != 0 || stResp.RequestSeq != 9 || stResp.Body.Error.Id != UnableToProduceStackTrace { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=9 Id=%d", stResp, UnableToProduceStackTrace) + } + + // 10 >> evaluate, << error + client.EvaluateRequest("foo", 0 /*no frame specified*/, "repl") + erResp := client.ExpectInvisibleErrorResponse(t) + if erResp.Seq != 0 || erResp.RequestSeq != 10 || erResp.Body.Error.Id != UnableToEvaluateExpression { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Id=%d", erResp, UnableToEvaluateExpression) } - // 10 >> continue, << continue, << terminated + // 11 >> evaluate, << evaluate + client.EvaluateRequest("1+1", 0 /*no frame specified*/, "repl") + evResp := client.ExpectEvaluateResponse(t) + if evResp.Seq != 0 || evResp.RequestSeq != 11 || evResp.Body.Result != "2" { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Result=2", evResp) + } + + // 12 >> continue, << continue, << terminated client.ContinueRequest(1) contResp := client.ExpectContinueResponse(t) - if contResp.Seq != 0 || contResp.RequestSeq != 10 || !contResp.Body.AllThreadsContinued { - t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Body.AllThreadsContinued=true", contResp) + if contResp.Seq != 0 || contResp.RequestSeq != 12 || !contResp.Body.AllThreadsContinued { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=12 Body.AllThreadsContinued=true", contResp) } termEvent := client.ExpectTerminatedEvent(t) if termEvent.Seq != 0 { t.Errorf("\ngot %#v\nwant Seq=0", termEvent) } - // 11 >> disconnect, << disconnect + // 13 >> disconnect, << disconnect client.DisconnectRequest() + oep := client.ExpectOutputEventProcessExited(t, 0) + if oep.Seq != 0 || oep.Body.Category != "console" { + t.Errorf("\ngot %#v\nwant Seq=0 Category='console'", oep) + } + oed := client.ExpectOutputEventDetaching(t) + if oed.Seq != 0 || oed.Body.Category != "console" { + t.Errorf("\ngot %#v\nwant Seq=0 Category='console'", oed) + } dResp := client.ExpectDisconnectResponse(t) - if dResp.Seq != 0 || dResp.RequestSeq != 11 { - t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=11", dResp) + if dResp.Seq != 0 || dResp.RequestSeq != 13 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=13", dResp) + } + client.ExpectTerminatedEvent(t) + }) +} + +// TestAttachStopOnEntry is like TestLaunchStopOnEntry, but with attach request. +func TestAttachStopOnEntry(t *testing.T) { + if runtime.GOOS == "freebsd" { + t.SkipNow() + } + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + // Start the program to attach to + cmd := exec.Command(fixture.Path) + stdout, err := cmd.StdoutPipe() + if err != nil { + t.Fatal(err) + } + cmd.Stderr = os.Stderr + if err := cmd.Start(); err != nil { + t.Fatal(err) + } + // Wait for output. + // This will give the target process time to initialize the runtime before we attach, + // so we can rely on having goroutines when they are requested on attach. + scanOut := bufio.NewScanner(stdout) + scanOut.Scan() + if scanOut.Text() != "past main" { + t.Errorf("expected loopprog.go to output \"past main\"") + } + + // 1 >> initialize, << initialize + client.InitializeRequest() + initResp := client.ExpectInitializeResponseAndCapabilities(t) + if initResp.Seq != 0 || initResp.RequestSeq != 1 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=1", initResp) + } + + // 2 >> attach, << initialized, << attach + client.AttachRequest( + map[string]interface{}{"mode": "local", "processId": cmd.Process.Pid, "stopOnEntry": true, "backend": "default"}) + initEvent := client.ExpectInitializedEvent(t) + if initEvent.Seq != 0 { + t.Errorf("\ngot %#v\nwant Seq=0", initEvent) + } + attachResp := client.ExpectAttachResponse(t) + if attachResp.Seq != 0 || attachResp.RequestSeq != 2 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=2", attachResp) + } + + // 3 >> setBreakpoints, << setBreakpoints + client.SetBreakpointsRequest(fixture.Source, nil) + sbpResp := client.ExpectSetBreakpointsResponse(t) + if sbpResp.Seq != 0 || sbpResp.RequestSeq != 3 || len(sbpResp.Body.Breakpoints) != 0 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=3, len(Breakpoints)=0", sbpResp) + } + + // 4 >> setExceptionBreakpoints, << setExceptionBreakpoints + client.SetExceptionBreakpointsRequest() + sebpResp := client.ExpectSetExceptionBreakpointsResponse(t) + if sebpResp.Seq != 0 || sebpResp.RequestSeq != 4 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=4", sebpResp) + } + + // 5 >> configurationDone, << stopped, << configurationDone + client.ConfigurationDoneRequest() + stopEvent := client.ExpectStoppedEvent(t) + if stopEvent.Seq != 0 || + stopEvent.Body.Reason != "entry" || + stopEvent.Body.ThreadId != 1 || + !stopEvent.Body.AllThreadsStopped { + t.Errorf("\ngot %#v\nwant Seq=0, Body={Reason=\"entry\", ThreadId=1, AllThreadsStopped=true}", stopEvent) + } + cdResp := client.ExpectConfigurationDoneResponse(t) + if cdResp.Seq != 0 || cdResp.RequestSeq != 5 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=5", cdResp) + } + + // 6 >> threads, << threads + client.ThreadsRequest() + tResp := client.ExpectThreadsResponse(t) + // Expect main goroutine plus runtime at this point. + if tResp.Seq != 0 || tResp.RequestSeq != 6 || len(tResp.Body.Threads) < 2 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=6 len(Threads)>1", tResp) + } + + // 7 >> threads, << threads + client.ThreadsRequest() + client.ExpectThreadsResponse(t) + + // 8 >> stackTrace, << response + client.StackTraceRequest(1, 0, 20) + client.ExpectStackTraceResponse(t) + + // 9 >> stackTrace, << response + client.StackTraceRequest(1, 0, 20) + client.ExpectStackTraceResponse(t) + + // 10 >> evaluate, << error + client.EvaluateRequest("foo", 0 /*no frame specified*/, "repl") + erResp := client.ExpectInvisibleErrorResponse(t) + if erResp.Seq != 0 || erResp.RequestSeq != 10 || erResp.Body.Error.Id != UnableToEvaluateExpression { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Id=%d", erResp, UnableToEvaluateExpression) + } + + // 11 >> evaluate, << evaluate + client.EvaluateRequest("1+1", 0 /*no frame specified*/, "repl") + evResp := client.ExpectEvaluateResponse(t) + if evResp.Seq != 0 || evResp.RequestSeq != 11 || evResp.Body.Result != "2" { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=10 Result=2", evResp) } + + // 12 >> continue, << continue + client.ContinueRequest(1) + cResp := client.ExpectContinueResponse(t) + if cResp.Seq != 0 || cResp.RequestSeq != 12 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=12", cResp) + } + + // TODO(polina): once https://github.com/go-delve/delve/issues/2259 is + // fixed, test with kill=false. + + // 13 >> disconnect, << disconnect + client.DisconnectRequestWithKillOption(true) + + // Disconnect consists of Halt + Detach. + // Halt interrupts command in progress, which triggers + // a stopped event in parallel with the disconnect + // sequence. It might arrive before or during the sequence + // or never if the server exits before it is sent. + msg := expectMessageFilterStopped(t, client) + client.CheckOutputEvent(t, msg) + msg = expectMessageFilterStopped(t, client) + client.CheckDisconnectResponse(t, msg) + client.ExpectTerminatedEvent(t) + + // If this call to KeepAlive isn't here there's a chance that stdout will + // be garbage collected (since it is no longer alive long before this + // point), when that happens, on unix-like OSes, the read end of the pipe + // will be closed by the finalizer and the target process will die by + // SIGPIPE, which the rest of this test does not expect. + runtime.KeepAlive(stdout) }) } @@ -212,7 +615,7 @@ func TestContinueOnEntry(t *testing.T) { runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { // 1 >> initialize, << initialize client.InitializeRequest() - client.ExpectInitializeResponse(t) + client.ExpectInitializeResponseAndCapabilities(t) // 2 >> launch, << initialized, << launch client.LaunchRequest("exec", fixture.Path, !stopOnEntry) @@ -230,56 +633,51 @@ func TestContinueOnEntry(t *testing.T) { // 5 >> configurationDone, << configurationDone client.ConfigurationDoneRequest() client.ExpectConfigurationDoneResponse(t) - // "Continue" happens behind the scenes - - // For now continue is blocking and runs until a stop or - // termination. But once we upgrade the server to be async, - // a simultaneous threads request can be made while continue - // is running. Note that vscode-go just keeps track of the - // continue state and would just return a dummy response - // without talking to debugger if continue was in progress. - // TODO(polina): test this once it is possible + // "Continue" happens behind the scenes on another goroutine client.ExpectTerminatedEvent(t) - // It is possible for the program to terminate before the initial - // threads request is processed. - // 6 >> threads, << threads client.ThreadsRequest() tResp := client.ExpectThreadsResponse(t) - if tResp.Seq != 0 || tResp.RequestSeq != 6 || len(tResp.Body.Threads) != 0 { - t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=6 len(Threads)=0", tResp) + if tResp.Seq != 0 || tResp.RequestSeq != 6 || len(tResp.Body.Threads) != 1 { + t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=6 len(Threads)=1", tResp) + } + if tResp.Body.Threads[0].Id != 1 || tResp.Body.Threads[0].Name != "Dummy" { + t.Errorf("\ngot %#v\nwant Id=1, Name=\"Dummy\"", tResp) } // 7 >> disconnect, << disconnect client.DisconnectRequest() + client.ExpectOutputEventProcessExited(t, 0) + client.ExpectOutputEventDetaching(t) dResp := client.ExpectDisconnectResponse(t) if dResp.Seq != 0 || dResp.RequestSeq != 7 { t.Errorf("\ngot %#v\nwant Seq=0, RequestSeq=7", dResp) } + client.ExpectTerminatedEvent(t) }) } -// TestSetBreakpoint corresponds to a debug session that is configured to +// TestPreSetBreakpoint corresponds to a debug session that is configured to // continue on entry with a pre-set breakpoint. -func TestSetBreakpoint(t *testing.T) { +func TestPreSetBreakpoint(t *testing.T) { runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { client.InitializeRequest() - client.ExpectInitializeResponse(t) + client.ExpectInitializeResponseAndCapabilities(t) client.LaunchRequest("exec", fixture.Path, !stopOnEntry) client.ExpectInitializedEvent(t) client.ExpectLaunchResponse(t) - client.SetBreakpointsRequest(fixture.Source, []int{8, 100}) + client.SetBreakpointsRequest(fixture.Source, []int{8}) sResp := client.ExpectSetBreakpointsResponse(t) if len(sResp.Body.Breakpoints) != 1 { t.Errorf("got %#v, want len(Breakpoints)=1", sResp) } bkpt0 := sResp.Body.Breakpoints[0] - if !bkpt0.Verified || bkpt0.Line != 8 { - t.Errorf("got breakpoints[0] = %#v, want Verified=true, Line=8", bkpt0) + if !bkpt0.Verified || bkpt0.Line != 8 || bkpt0.Id != 1 || bkpt0.Source.Name != filepath.Base(fixture.Source) || bkpt0.Source.Path != fixture.Source { + t.Errorf("got breakpoints[0] = %#v, want Verified=true, Line=8, Id=1, Path=%q", bkpt0, fixture.Source) } client.SetExceptionBreakpointsRequest() @@ -287,28 +685,42 @@ func TestSetBreakpoint(t *testing.T) { client.ConfigurationDoneRequest() client.ExpectConfigurationDoneResponse(t) - // This triggers "continue" - - // TODO(polina): add a no-op threads request - // with dummy response here once server becomes async - // to match what happens in VS Code. + // This triggers "continue" on a separate goroutine - stopEvent1 := client.ExpectStoppedEvent(t) - if stopEvent1.Body.Reason != "breakpoint" || - stopEvent1.Body.ThreadId != 1 || - !stopEvent1.Body.AllThreadsStopped { - t.Errorf("got %#v, want Body={Reason=\"breakpoint\", ThreadId=1, AllThreadsStopped=true}", stopEvent1) + client.ThreadsRequest() + // Since we are in async mode while running, we might receive messages in either order. + for i := 0; i < 2; i++ { + msg := client.ExpectMessage(t) + switch m := msg.(type) { + case *dap.ThreadsResponse: + // If the thread request arrived while the program was running, we expect to get the dummy response + // with a single goroutine "Current". + // If the thread request arrived after the stop, we should get the goroutine stopped at main.Increment. + if (len(m.Body.Threads) != 1 || m.Body.Threads[0].Id != -1 || m.Body.Threads[0].Name != "Current") && + (len(m.Body.Threads) < 1 || m.Body.Threads[0].Id != 1 || !strings.HasPrefix(m.Body.Threads[0].Name, "* [Go 1] main.Increment")) { + t.Errorf("\ngot %#v\nwant Id=-1, Name=\"Current\" or Id=1, Name=\"* [Go 1] main.Increment ...\"", m.Body.Threads) + } + case *dap.StoppedEvent: + if m.Body.Reason != "breakpoint" || m.Body.ThreadId != 1 || !m.Body.AllThreadsStopped { + t.Errorf("got %#v, want Body={Reason=\"breakpoint\", ThreadId=1, AllThreadsStopped=true}", m) + } + default: + t.Fatalf("got %#v, want ThreadsResponse or StoppedEvent", m) + } } + // Threads-StackTrace-Scopes-Variables request waterfall is + // triggered on stop event. client.ThreadsRequest() tResp := client.ExpectThreadsResponse(t) if len(tResp.Body.Threads) < 2 { // 1 main + runtime t.Errorf("\ngot %#v\nwant len(Threads)>1", tResp.Body.Threads) } - wantMain := dap.Thread{Id: 1, Name: "main.Increment"} - wantRuntime := dap.Thread{Id: 2, Name: "runtime.gopark"} + reMain, _ := regexp.Compile(`\* \[Go 1\] main.Increment \(Thread [0-9]+\)`) + wantMain := dap.Thread{Id: 1, Name: "* [Go 1] main.Increment (Thread ...)"} + wantRuntime := dap.Thread{Id: 2, Name: "[Go 2] runtime.gopark"} for _, got := range tResp.Body.Threads { - if !reflect.DeepEqual(got, wantMain) && !strings.HasPrefix(got.Name, "runtime") { + if got.Id != 1 && !reMain.MatchString(got.Name) && !(strings.Contains(got.Name, "runtime.") || strings.Contains(got.Name, "runtime/")) { t.Errorf("\ngot %#v\nwant []dap.Thread{%#v, %#v, ...}", tResp.Body.Threads, wantMain, wantRuntime) } } @@ -322,7 +734,7 @@ func TestSetBreakpoint(t *testing.T) { if len(stResp.Body.StackFrames) != 6 { t.Errorf("\ngot %#v\nwant len(StackFrames)=6", stResp.Body.StackFrames) } else { - expectFrame := func(got dap.StackFrame, id int, name string, sourceName string, line int) { + checkFrame := func(got dap.StackFrame, id int, name string, sourceName string, line int) { t.Helper() if got.Id != id || got.Name != name { t.Errorf("\ngot %#v\nwant Id=%d Name=%s", got, id, name) @@ -331,28 +743,26 @@ func TestSetBreakpoint(t *testing.T) { t.Errorf("\ngot %#v\nwant Source.Name=%s Line=%d", got, sourceName, line) } } - expectFrame(stResp.Body.StackFrames[0], 1000, "main.Increment", "increment.go", 8) - expectFrame(stResp.Body.StackFrames[1], 1001, "main.Increment", "increment.go", 11) - expectFrame(stResp.Body.StackFrames[2], 1002, "main.Increment", "increment.go", 11) - expectFrame(stResp.Body.StackFrames[3], 1003, "main.main", "increment.go", 17) - expectFrame(stResp.Body.StackFrames[4], 1004, "runtime.main", "proc.go", -1) - expectFrame(stResp.Body.StackFrames[5], 1005, "runtime.goexit", "", -1) + checkFrame(stResp.Body.StackFrames[0], 1000, "main.Increment", "increment.go", 8) + checkFrame(stResp.Body.StackFrames[1], 1001, "main.Increment", "increment.go", 11) + checkFrame(stResp.Body.StackFrames[2], 1002, "main.Increment", "increment.go", 11) + checkFrame(stResp.Body.StackFrames[3], 1003, "main.main", "increment.go", 17) + checkFrame(stResp.Body.StackFrames[4], 1004, "runtime.main", "proc.go", -1) + checkFrame(stResp.Body.StackFrames[5], 1005, "runtime.goexit", "", -1) } client.ScopesRequest(1000) scopes := client.ExpectScopesResponse(t) - expectScope(t, scopes, 0, "Arguments", 1000) - expectScope(t, scopes, 1, "Locals", 1001) + if len(scopes.Body.Scopes) > 1 { + t.Errorf("\ngot %#v\nwant len(Scopes)=1 (Locals)", scopes) + } + checkScope(t, scopes, 0, "Locals", localsScope) - client.VariablesRequest(1000) // Arguments + client.VariablesRequest(localsScope) args := client.ExpectVariablesResponse(t) - expectChildren(t, args, "Arguments", 2) - expectVarExact(t, args, 0, "y", "0", noChildren) - expectVarExact(t, args, 1, "~r1", "0", noChildren) - - client.VariablesRequest(1001) // Locals - locals := client.ExpectVariablesResponse(t) - expectChildren(t, locals, "Locals", 0) + checkChildren(t, args, "Locals", 2) + checkVarExact(t, args, 0, "y", "y", "0 = 0x0", "uint", noChildren) + checkVarExact(t, args, 1, "~r1", "", "0 = 0x0", "uint", noChildren) client.ContinueRequest(1) ctResp := client.ExpectContinueResponse(t) @@ -362,77 +772,223 @@ func TestSetBreakpoint(t *testing.T) { // "Continue" is triggered after the response is sent client.ExpectTerminatedEvent(t) + + // Pause request after termination should result in an error. + // But in certain cases this request actually succeeds. + client.PauseRequest(1) + switch r := client.ExpectMessage(t).(type) { + case *dap.ErrorResponse: + if r.Message != "Unable to halt execution" { + t.Errorf("\ngot %#v\nwant Message='Unable to halt execution'", r) + } + case *dap.PauseResponse: + default: + t.Fatalf("Unexpected response type: expect error or pause, got %#v", r) + } + client.DisconnectRequest() + client.ExpectOutputEventProcessExited(t, 0) + client.ExpectOutputEventDetaching(t) client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) }) } -// expectStackFrames is a helper for verifying the values within StackTraceResponse. -// wantStartLine - file line of the first returned frame (non-positive values are ignored). +// checkStackFramesExact is a helper for verifying the values within StackTraceResponse. +// wantStartName - name of the first returned frame (ignored if "") +// wantStartLine - file line of the first returned frame (ignored if <0). // wantStartID - id of the first frame returned (ignored if wantFrames is 0). -// wantFrames - number of frames returned. -// wantTotalFrames - total number of stack frames (StackTraceResponse.Body.TotalFrames). -func expectStackFrames(t *testing.T, got *dap.StackTraceResponse, - wantStartLine, wantStartID, wantFrames, wantTotalFrames int) { +// wantFrames - number of frames returned (length of StackTraceResponse.Body.StackFrames array). +// wantTotalFrames - total number of stack frames available (StackTraceResponse.Body.TotalFrames). +func checkStackFramesExact(t *testing.T, got *dap.StackTraceResponse, + wantStartName string, wantStartLine, wantStartID, wantFrames, wantTotalFrames int) { + t.Helper() + checkStackFramesNamed("", t, got, wantStartName, wantStartLine, wantStartID, wantFrames, wantTotalFrames, true) +} + +func TestFilterGoroutines(t *testing.T) { + tt := []struct { + name string + filter string + want []string + wantLen int + wantErr bool + }{ + { + name: "user goroutines", + filter: "-with user", + want: []string{"main.main", "main.agoroutine"}, + wantLen: 11, + }, + { + name: "filter by user loc", + filter: "-with userloc main.main", + want: []string{"main.main"}, + wantLen: 1, + }, + { + name: "multiple filters", + filter: "-with user -with userloc main.agoroutine", + want: []string{"main.agoroutine"}, + wantLen: 10, + }, + { + name: "system goroutines", + filter: "-without user", + want: []string{"runtime."}, + }, + // Filters that should return all goroutines. + { + name: "empty filter string", + filter: "", + want: []string{"main.main", "main.agoroutine", "runtime."}, + wantLen: -1, + }, + { + name: "bad filter string", + filter: "not parsable to filters", + want: []string{"main.main", "main.agoroutine", "runtime."}, + wantLen: -1, + wantErr: true, + }, + // Filters that should produce none. + { + name: "no match to user loc", + filter: "-with userloc main.NotAUserFrame", + want: []string{"Dummy"}, + wantLen: 1, + }, + { + name: "no match to user and not user", + filter: "-with user -without user", + want: []string{"Dummy"}, + wantLen: 1, + }, + } + runTest(t, "goroutinestackprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", + "program": fixture.Path, + "stopOnEntry": !stopOnEntry}) + }, + // Set breakpoints + fixture.Source, []int{30}, + []onBreakpoint{{ + // Stop at line 30 + execute: func() { + for _, tc := range tt { + command := fmt.Sprintf("dlv config goroutineFilters %s", tc.filter) + client.EvaluateRequest(command, 1000, "repl") + client.ExpectInvalidatedEvent(t) + client.ExpectEvaluateResponse(t) + + client.ThreadsRequest() + if tc.wantErr { + client.ExpectOutputEvent(t) + } + tr := client.ExpectThreadsResponse(t) + if tc.wantLen > 0 && len(tr.Body.Threads) != tc.wantLen { + t.Errorf("got Threads=%#v, want Len=%d\n", tr.Body.Threads, tc.wantLen) + } + for i, frame := range tr.Body.Threads { + var found bool + for _, wantName := range tc.want { + if strings.Contains(frame.Name, wantName) { + found = true + break + } + } + if !found { + t.Errorf("got Threads[%d]=%#v, want Name=%v\n", i, frame, tc.want) + } + } + } + }, + disconnect: false, + }}) + + }) +} + +func checkStackFramesHasMore(t *testing.T, got *dap.StackTraceResponse, + wantStartName string, wantStartLine, wantStartID, wantFrames, wantTotalFrames int) { + t.Helper() + checkStackFramesNamed("", t, got, wantStartName, wantStartLine, wantStartID, wantFrames, wantTotalFrames, false) +} +func checkStackFramesNamed(testName string, t *testing.T, got *dap.StackTraceResponse, + wantStartName string, wantStartLine, wantStartID, wantFrames, wantTotalFrames int, totalExact bool) { t.Helper() - if got.Body.TotalFrames != wantTotalFrames { - t.Errorf("\ngot %#v\nwant TotalFrames=%d", got.Body.TotalFrames, wantTotalFrames) + if totalExact && got.Body.TotalFrames != wantTotalFrames { + t.Errorf("%s\ngot %#v\nwant TotalFrames=%d", testName, got.Body.TotalFrames, wantTotalFrames) + } else if !totalExact && got.Body.TotalFrames < wantTotalFrames { + t.Errorf("%s\ngot %#v\nwant TotalFrames>=%d", testName, got.Body.TotalFrames, wantTotalFrames) } + if len(got.Body.StackFrames) != wantFrames { - t.Errorf("\ngot len(StackFrames)=%d\nwant %d", len(got.Body.StackFrames), wantFrames) + t.Errorf("%s\ngot len(StackFrames)=%d\nwant %d", testName, len(got.Body.StackFrames), wantFrames) } else { // Verify that frame ids are consecutive numbers starting at wantStartID for i := 0; i < wantFrames; i++ { if got.Body.StackFrames[i].Id != wantStartID+i { - t.Errorf("\ngot %#v\nwant Id=%d", got.Body.StackFrames[i], wantStartID+i) + t.Errorf("%s\ngot %#v\nwant Id=%d", testName, got.Body.StackFrames[i], wantStartID+i) } } - // Verify the line corresponding to the first returned frame (if any). + // Verify the name and line corresponding to the first returned frame (if any). // This is useful when the first frame is the frame corresponding to the breakpoint at - // a predefined line. Values < 0 are a signal to skip the check (which can be useful + // a predefined line. Line values < 0 are a signal to skip the check (which can be useful // for frames in the third-party code, where we do not control the lines). if wantFrames > 0 && wantStartLine > 0 && got.Body.StackFrames[0].Line != wantStartLine { - t.Errorf("\ngot Line=%d\nwant %d", got.Body.StackFrames[0].Line, wantStartLine) + t.Errorf("%s\ngot Line=%d\nwant %d", testName, got.Body.StackFrames[0].Line, wantStartLine) + } + if wantFrames > 0 && wantStartName != "" && got.Body.StackFrames[0].Name != wantStartName { + t.Errorf("%s\ngot Name=%s\nwant %s", testName, got.Body.StackFrames[0].Name, wantStartName) } } } -// expectScope is a helper for verifying the values within a ScopesResponse. +// checkScope is a helper for verifying the values within a ScopesResponse. // i - index of the scope within ScopesRespose.Body.Scopes array // name - name of the scope -// varRef - reference to retrieve variables of this scope -func expectScope(t *testing.T, got *dap.ScopesResponse, i int, name string, varRef int) { +// varRef - reference to retrieve variables of this scope. If varRef is negative, the reference is not checked. +func checkScope(t *testing.T, got *dap.ScopesResponse, i int, name string, varRef int) { t.Helper() if len(got.Body.Scopes) <= i { t.Errorf("\ngot %d\nwant len(Scopes)>%d", len(got.Body.Scopes), i) } goti := got.Body.Scopes[i] - if goti.Name != name || goti.VariablesReference != varRef || goti.Expensive { + if goti.Name != name || (varRef >= 0 && goti.VariablesReference != varRef) || goti.Expensive { t.Errorf("\ngot %#v\nwant Name=%q VariablesReference=%d Expensive=false", goti, name, varRef) } } -// expectChildren is a helper for verifying the number of variables within a VariablesResponse. -// parentName - name of the enclosing variable or scope +// checkChildren is a helper for verifying the number of variables within a VariablesResponse. +// parentName - pseudoname of the enclosing variable or scope (used for error message only) // numChildren - number of variables/fields/elements of this variable -func expectChildren(t *testing.T, got *dap.VariablesResponse, parentName string, numChildren int) { +func checkChildren(t *testing.T, got *dap.VariablesResponse, parentName string, numChildren int) { t.Helper() + if got.Body.Variables == nil { + t.Errorf("\ngot %s children=%#v want []", parentName, got.Body.Variables) + } if len(got.Body.Variables) != numChildren { - t.Errorf("\ngot len(%s)=%d\nwant %d", parentName, len(got.Body.Variables), numChildren) + t.Errorf("\ngot len(%s)=%d (children=%#v)\nwant len=%d", parentName, len(got.Body.Variables), got.Body.Variables, numChildren) } } -// expectVar is a helper for verifying the values within a VariablesResponse. +// checkVar is a helper for verifying the values within a VariablesResponse. // i - index of the variable within VariablesRespose.Body.Variables array (-1 will search all vars for a match) // name - name of the variable +// evalName - fully qualified variable name or alternative expression to load this variable // value - the value of the variable -// useExactMatch - true if value is to be compared to exactly, false if to be used as regex +// useExactMatch - true if name, evalName and value are to be compared to exactly, false if to be used as regex // hasRef - true if the variable should have children and therefore a non-0 variable reference // ref - reference to retrieve children of this variable (0 if none) -func expectVar(t *testing.T, got *dap.VariablesResponse, i int, name, value string, useExactMatch, hasRef bool) (ref int) { +func checkVar(t *testing.T, got *dap.VariablesResponse, i int, name, evalName, value, typ string, useExactMatch, hasRef bool, indexed, named int) (ref int) { t.Helper() if len(got.Body.Variables) <= i { - t.Errorf("\ngot len=%d\nwant len>%d", len(got.Body.Variables), i) + t.Errorf("\ngot len=%d (children=%#v)\nwant len>%d", len(got.Body.Variables), got.Body.Variables, i) return } if i < 0 { @@ -444,45 +1000,121 @@ func expectVar(t *testing.T, got *dap.VariablesResponse, i int, name, value stri } } if i < 0 { - t.Errorf("\ngot %#v\nwant Variables[i].Name=%q", got, name) + t.Errorf("\ngot %#v\nwant Variables[i].Name=%q (not found)", got, name) return 0 } goti := got.Body.Variables[i] - if goti.Name != name || (goti.VariablesReference > 0) != hasRef { + matchedName := false + if useExactMatch { + if strings.HasPrefix(name, "~r") { + matchedName = strings.HasPrefix(goti.Name, "~r") + } else { + matchedName = (goti.Name == name) + } + } else { + matchedName, _ = regexp.MatchString(name, goti.Name) + } + if !matchedName || (goti.VariablesReference > 0) != hasRef { t.Errorf("\ngot %#v\nwant Name=%q hasRef=%t", goti, name, hasRef) } - matched := false + matchedEvalName := false + if useExactMatch { + matchedEvalName = (goti.EvaluateName == evalName) + } else { + matchedEvalName, _ = regexp.MatchString(evalName, goti.EvaluateName) + } + if !matchedEvalName { + t.Errorf("\ngot %q\nwant EvaluateName=%q", goti.EvaluateName, evalName) + } + matchedValue := false if useExactMatch { - matched = (goti.Value == value) + matchedValue = (goti.Value == value) } else { - matched, _ = regexp.MatchString(value, goti.Value) + matchedValue, _ = regexp.MatchString(value, goti.Value) } - if !matched { + if !matchedValue { t.Errorf("\ngot %s=%q\nwant %q", name, goti.Value, value) } + matchedType := false + if useExactMatch { + matchedType = (goti.Type == typ) + } else { + matchedType, _ = regexp.MatchString(typ, goti.Type) + } + if !matchedType { + t.Errorf("\ngot %s=%q\nwant %q", name, goti.Type, typ) + } + if indexed >= 0 && goti.IndexedVariables != indexed { + t.Errorf("\ngot %s=%d indexed\nwant %d indexed", name, goti.IndexedVariables, indexed) + } + if named >= 0 && goti.NamedVariables != named { + t.Errorf("\ngot %s=%d named\nwant %d named", name, goti.NamedVariables, named) + } return goti.VariablesReference } -// expectVarExact is a helper like expectVar that matches value exactly. -func expectVarExact(t *testing.T, got *dap.VariablesResponse, i int, name, value string, hasRef bool) (ref int) { +// checkVarExact is a helper like checkVar that matches value exactly. +func checkVarExact(t *testing.T, got *dap.VariablesResponse, i int, name, evalName, value, typ string, hasRef bool) (ref int) { + t.Helper() + return checkVarExactIndexed(t, got, i, name, evalName, value, typ, hasRef, -1, -1) +} + +// checkVarExact is a helper like checkVar that matches value exactly. +func checkVarExactIndexed(t *testing.T, got *dap.VariablesResponse, i int, name, evalName, value, typ string, hasRef bool, indexed, named int) (ref int) { + t.Helper() + return checkVar(t, got, i, name, evalName, value, typ, true, hasRef, indexed, named) +} + +// checkVarRegex is a helper like checkVar that treats value, evalName or name as a regex. +func checkVarRegex(t *testing.T, got *dap.VariablesResponse, i int, name, evalName, value, typ string, hasRef bool) (ref int) { + t.Helper() + return checkVarRegexIndexed(t, got, i, name, evalName, value, typ, hasRef, -1, -1) +} + +// checkVarRegex is a helper like checkVar that treats value, evalName or name as a regex. +func checkVarRegexIndexed(t *testing.T, got *dap.VariablesResponse, i int, name, evalName, value, typ string, hasRef bool, indexed, named int) (ref int) { t.Helper() - return expectVar(t, got, i, name, value, true, hasRef) + return checkVar(t, got, i, name, evalName, value, typ, false, hasRef, indexed, named) +} + +func expectMessageFilterStopped(t *testing.T, client *daptest.Client) dap.Message { + msg := client.ExpectMessage(t) + if _, isStopped := msg.(*dap.StoppedEvent); isStopped { + msg = client.ExpectMessage(t) + } + return msg } -// expectVarRegex is a helper like expectVar that treats value as a regex. -func expectVarRegex(t *testing.T, got *dap.VariablesResponse, i int, name, value string, hasRef bool) (ref int) { +// validateEvaluateName issues an evaluate request with evaluateName of a variable and +// confirms that it succeeds and returns the same variable record as the original. +func validateEvaluateName(t *testing.T, client *daptest.Client, got *dap.VariablesResponse, i int) { t.Helper() - return expectVar(t, got, i, name, value, false, hasRef) + original := got.Body.Variables[i] + client.EvaluateRequest(original.EvaluateName, 1000, "this context will be ignored") + validated := client.ExpectEvaluateResponse(t) + if original.VariablesReference == 0 && validated.Body.VariablesReference != 0 || + original.VariablesReference != 0 && validated.Body.VariablesReference == 0 { + t.Errorf("\ngot varref=%d\nwant %d", validated.Body.VariablesReference, original.VariablesReference) + } + // The variable might not be fully loaded, and when we reload it with an expression + // more of the subvalues might be revealed, so we must match the loaded prefix only. + if strings.Contains(original.Value, "...") { + origLoaded := strings.Split(original.Value, "...")[0] + if !strings.HasPrefix(validated.Body.Result, origLoaded) { + t.Errorf("\ngot value=%q\nwant %q", validated.Body.Result, original.Value) + } + } else if original.Value != validated.Body.Result { + t.Errorf("\ngot value=%q\nwant %q", validated.Body.Result, original.Value) + } } -// TestStackTraceRequest executes to a breakpoint (similarly to TestSetBreakpoint -// that includes more thorough checking of that sequence) and tests different +// TestStackTraceRequest executes to a breakpoint and tests different // good and bad configurations of 'stackTrace' requests. func TestStackTraceRequest(t *testing.T) { runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { var stResp *dap.StackTraceResponse - runDebugSessionWithBPs(t, client, + runDebugSessionWithBPs(t, client, "launch", // Launch func() { client.LaunchRequest("exec", fixture.Path, !stopOnEntry) @@ -492,28 +1124,44 @@ func TestStackTraceRequest(t *testing.T) { []onBreakpoint{{ // Stop at line 8 execute: func() { - client.StackTraceRequest(1, 0, 0) - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 8, 1000, 6, 6) - - // Even though the stack frames are the same, - // repeated requests at the same breakpoint, - // would assign unique ids to them each time. - client.StackTraceRequest(1, -100, 0) // Negative startFrame is treated as 0 - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 8, 1006, 6, 6) - - client.StackTraceRequest(1, 3, 0) - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 17, 1015, 3, 6) - - client.StackTraceRequest(1, 6, 0) - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, -1, -1, 0, 6) + // Even though the stack frames do not change, + // repeated requests at the same breakpoint + // would assign next block of unique ids to them each time. + const NumFrames = 6 + reqIndex := 0 + frameID := func() int { + return startHandle + reqIndex + } - client.StackTraceRequest(1, 7, 0) // Out of bounds startFrame is capped at len - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, -1, -1, 0, 6) + tests := map[string]struct { + startFrame int + levels int + wantStartName string + wantStartLine int + wantStartFrame int + wantFramesReturned int + wantFramesAvailable int + exact bool + }{ + "all frame levels from 0 to NumFrames": {0, NumFrames, "main.Increment", 8, 0, NumFrames, NumFrames, true}, + "subset of frames from 1 to -1": {1, NumFrames - 1, "main.Increment", 11, 1, NumFrames - 1, NumFrames, true}, + "load stack in pages: first half": {0, NumFrames / 2, "main.Increment", 8, 0, NumFrames / 2, NumFrames, false}, + "load stack in pages: second half": {NumFrames / 2, NumFrames, "main.main", 17, NumFrames / 2, NumFrames / 2, NumFrames, true}, + "zero levels means all levels": {0, 0, "main.Increment", 8, 0, NumFrames, NumFrames, true}, + "zero levels means all remaining levels": {NumFrames / 2, 0, "main.main", 17, NumFrames / 2, NumFrames / 2, NumFrames, true}, + "negative levels treated as 0 (all)": {0, -10, "main.Increment", 8, 0, NumFrames, NumFrames, true}, + "OOB levels is capped at available len": {0, NumFrames + 1, "main.Increment", 8, 0, NumFrames, NumFrames, true}, + "OOB levels is capped at available len 1": {1, NumFrames + 1, "main.Increment", 11, 1, NumFrames - 1, NumFrames, true}, + "negative startFrame treated as 0": {-10, 0, "main.Increment", 8, 0, NumFrames, NumFrames, true}, + "OOB startFrame returns empty trace": {NumFrames, 0, "main.Increment", -1, -1, 0, NumFrames, true}, + } + for name, tc := range tests { + client.StackTraceRequest(1, tc.startFrame, tc.levels) + stResp = client.ExpectStackTraceResponse(t) + checkStackFramesNamed(name, t, stResp, + tc.wantStartName, tc.wantStartLine, frameID(), tc.wantFramesReturned, tc.wantFramesAvailable, tc.exact) + reqIndex += len(stResp.Body.StackFrames) + } }, disconnect: false, }, { @@ -522,155 +1170,319 @@ func TestStackTraceRequest(t *testing.T) { // Frame ids get reset at each breakpoint. client.StackTraceRequest(1, 0, 0) stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 18, 1000, 3, 3) - - client.StackTraceRequest(1, 0, -100) // Negative levels is treated as 0 - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 18, 1003, 3, 3) - - client.StackTraceRequest(1, 0, 2) - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 18, 1006, 2, 3) + checkStackFramesExact(t, stResp, "main.main", 18, startHandle, 3, 3) - client.StackTraceRequest(1, 0, 3) - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 18, 1009, 3, 3) - - client.StackTraceRequest(1, 0, 4) // Out of bounds levels is capped at len - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 18, 1012, 3, 3) - - client.StackTraceRequest(1, 1, 2) - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, -1, 1016, 2, 3) // Don't test for runtime line we don't control }, disconnect: false, }}) }) -} - -// TestScopesAndVariablesRequests executes to a breakpoint and tests different + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + var stResp *dap.StackTraceResponse + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{8, 18}, + []onBreakpoint{{ + // Stop at line 8 + execute: func() { + // Even though the stack frames do not change, + // repeated requests at the same breakpoint + // would assign next block of unique ids to them each time. + const NumFrames = 6 + + var frames []dap.StackFrame + + for start, levels := 0, 1; start < NumFrames; { + client.StackTraceRequest(1, start, levels) + stResp = client.ExpectStackTraceResponse(t) + frames = append(frames, stResp.Body.StackFrames...) + if stResp.Body.TotalFrames < NumFrames { + t.Errorf("got %#v\nwant TotalFrames>=%d\n", stResp.Body.TotalFrames, NumFrames) + } + + if len(stResp.Body.StackFrames) < levels { + t.Errorf("got len(StackFrames)=%d\nwant >=%d\n", len(stResp.Body.StackFrames), levels) + } + + start += len(stResp.Body.StackFrames) + } + + // TODO check all the frames. + want := []struct { + wantName string + wantLine int + }{ + {"main.Increment", 8}, + {"main.Increment", 11}, + {"main.Increment", 11}, + {"main.main", 17}, + {"runtime.main", 0}, + {"runtime.goexit", 0}, + } + for i, frame := range frames { + frameId := startHandle + i + if frame.Id != frameId { + t.Errorf("got %#v\nwant Id=%d\n", frame, frameId) + } + + // Verify the name and line corresponding to the first returned frame (if any). + // This is useful when the first frame is the frame corresponding to the breakpoint at + // a predefined line. Line values < 0 are a signal to skip the check (which can be useful + // for frames in the third-party code, where we do not control the lines). + if want[i].wantLine > 0 && frame.Line != want[i].wantLine { + t.Errorf("got Line=%d\nwant %d\n", frame.Line, want[i].wantLine) + } + if want[i].wantName != "" && frame.Name != want[i].wantName { + t.Errorf("got Name=%s\nwant %s\n", frame.Name, want[i].wantName) + } + } + }, + disconnect: false, + }, { + // Stop at line 18 + execute: func() { + // Frame ids get reset at each breakpoint. + client.StackTraceRequest(1, 0, 0) + stResp = client.ExpectStackTraceResponse(t) + checkStackFramesExact(t, stResp, "main.main", 18, startHandle, 3, 3) + }, + disconnect: false, + }}) + }) +} + +func TestSelectedThreadsRequest(t *testing.T) { + runTest(t, "goroutinestackprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{20}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 20) + + defaultMaxGoroutines := maxGoroutines + defer func() { maxGoroutines = defaultMaxGoroutines }() + + maxGoroutines = 1 + client.SetBreakpointsRequest(fixture.Source, []int{8}) + client.ExpectSetBreakpointsResponse(t) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "breakpoint" || se.Body.ThreadId == 1 { + t.Errorf("got %#v, want Reason=%q, ThreadId!=1", se, "breakpoint") + } + + client.ThreadsRequest() + oe := client.ExpectOutputEvent(t) + if !strings.HasPrefix(oe.Body.Output, "Too many goroutines") { + t.Errorf("got %#v, expected Output=\"Too many goroutines...\"\n", oe) + + } + tr := client.ExpectThreadsResponse(t) + + if len(tr.Body.Threads) != 2 { + t.Errorf("got %d threads, expected 2\n", len(tr.Body.Threads)) + } + + var selectedFound bool + for _, thread := range tr.Body.Threads { + if thread.Id == se.Body.ThreadId { + selectedFound = true + break + } + } + if !selectedFound { + t.Errorf("got %#v, want ThreadId=%d\n", tr.Body.Threads, se.Body.ThreadId) + } + }, + disconnect: true, + }}) + + }) +} + +func TestHideSystemGoroutinesRequest(t *testing.T) { + tests := []struct{ hideSystemGoroutines bool }{ + {hideSystemGoroutines: true}, + {hideSystemGoroutines: false}, + } + for _, tt := range tests { + runTest(t, "goroutinestackprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", + "program": fixture.Path, + "hideSystemGoroutines": tt.hideSystemGoroutines, + "stopOnEntry": !stopOnEntry, + }) + }, + // Set breakpoints + fixture.Source, []int{25}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 25) + + client.ThreadsRequest() + tr := client.ExpectThreadsResponse(t) + + // The user process creates 10 goroutines in addition to the + // main goroutine, for a total of 11 goroutines. + userCount := 11 + if tt.hideSystemGoroutines { + if len(tr.Body.Threads) != userCount { + t.Errorf("got %d goroutines, expected %d\n", len(tr.Body.Threads), userCount) + } + } else { + if len(tr.Body.Threads) <= userCount { + t.Errorf("got %d goroutines, expected >%d\n", len(tr.Body.Threads), userCount) + } + } + }, + disconnect: true, + }}) + }) + } +} + +// TestScopesAndVariablesRequests executes to a breakpoint and tests different // configurations of 'scopes' and 'variables' requests. func TestScopesAndVariablesRequests(t *testing.T) { runTest(t, "testvariables", func(client *daptest.Client, fixture protest.Fixture) { - runDebugSessionWithBPs(t, client, + runDebugSessionWithBPs(t, client, "launch", // Launch func() { - client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "showGlobalVariables": true, "backend": "default", + }) }, // Breakpoints are set within the program fixture.Source, []int{}, []onBreakpoint{{ - // Stop at line 62 + // Stop at first breakpoint execute: func() { client.StackTraceRequest(1, 0, 20) stack := client.ExpectStackTraceResponse(t) - startLineno := 62 + startLineno := 66 if runtime.GOOS == "windows" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { // Go1.15 on windows inserts a NOP after the call to - // runtime.Breakpoint and marks it as line 61 (same as the - // runtime.Breakpoint call). - startLineno = 61 + // runtime.Breakpoint and marks it same line as the + // runtime.Breakpoint call, making this flaky, so skip the line check. + startLineno = -1 } - expectStackFrames(t, stack, startLineno, 1000, 4, 4) + checkStackFramesExact(t, stack, "main.foobar", startLineno, 1000, 4, 4) client.ScopesRequest(1000) scopes := client.ExpectScopesResponse(t) - expectScope(t, scopes, 0, "Arguments", 1000) - expectScope(t, scopes, 1, "Locals", 1001) + checkScope(t, scopes, 0, "Locals", localsScope) + checkScope(t, scopes, 1, "Globals (package main)", globalsScope) - // Arguments + // Globals - client.VariablesRequest(1000) - args := client.ExpectVariablesResponse(t) - expectChildren(t, args, "Arguments", 2) - expectVarExact(t, args, 0, "baz", `"bazburzum"`, noChildren) - ref := expectVarExact(t, args, 1, "bar", ``, hasChildren) - if ref > 0 { - client.VariablesRequest(ref) - bar := client.ExpectVariablesResponse(t) - expectChildren(t, bar, "bar", 2) - expectVarExact(t, bar, 0, "Baz", "10", noChildren) - expectVarExact(t, bar, 1, "Bur", `"lorem"`, noChildren) - } + client.VariablesRequest(globalsScope) + globals := client.ExpectVariablesResponse(t) + checkVarExact(t, globals, 0, "p1", "main.p1", "10", "int", noChildren) // Locals - client.VariablesRequest(1001) + client.VariablesRequest(localsScope) locals := client.ExpectVariablesResponse(t) - expectChildren(t, locals, "Locals", 29) + checkChildren(t, locals, "Locals", 33) + checkVarExact(t, locals, 0, "baz", "baz", `"bazburzum"`, "string", noChildren) + ref := checkVarExact(t, locals, 1, "bar", "bar", `main.FooBar {Baz: 10, Bur: "lorem"}`, "main.FooBar", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + bar := client.ExpectVariablesResponse(t) + checkChildren(t, bar, "bar", 2) + checkVarExact(t, bar, 0, "Baz", "bar.Baz", "10", "int", noChildren) + checkVarExact(t, bar, 1, "Bur", "bar.Bur", `"lorem"`, "string", noChildren) + validateEvaluateName(t, client, bar, 0) + validateEvaluateName(t, client, bar, 1) + } // reflect.Kind == Bool - expectVarExact(t, locals, -1, "b1", "true", noChildren) - expectVarExact(t, locals, -1, "b2", "false", noChildren) + checkVarExact(t, locals, -1, "b1", "b1", "true", "bool", noChildren) + checkVarExact(t, locals, -1, "b2", "b2", "false", "bool", noChildren) // reflect.Kind == Int - expectVarExact(t, locals, -1, "a2", "6", noChildren) - expectVarExact(t, locals, -1, "neg", "-1", noChildren) + checkVarExact(t, locals, -1, "a2", "a2", "6", "int", noChildren) + checkVarExact(t, locals, -1, "neg", "neg", "-1", "int", noChildren) // reflect.Kind == Int8 - expectVarExact(t, locals, -1, "i8", "1", noChildren) + checkVarExact(t, locals, -1, "i8", "i8", "1", "int8", noChildren) // reflect.Kind == Int16 - see testvariables2 // reflect.Kind == Int32 - see testvariables2 // reflect.Kind == Int64 - see testvariables2 // reflect.Kind == Uint // reflect.Kind == Uint8 - expectVarExact(t, locals, -1, "u8", "255", noChildren) + checkVarExact(t, locals, -1, "u8", "u8", "255 = 0xff", "uint8", noChildren) // reflect.Kind == Uint16 - expectVarExact(t, locals, -1, "u16", "65535", noChildren) + checkVarExact(t, locals, -1, "u16", "u16", "65535 = 0xffff", "uint16", noChildren) // reflect.Kind == Uint32 - expectVarExact(t, locals, -1, "u32", "4294967295", noChildren) + checkVarExact(t, locals, -1, "u32", "u32", "4294967295 = 0xffffffff", "uint32", noChildren) // reflect.Kind == Uint64 - expectVarExact(t, locals, -1, "u64", "18446744073709551615", noChildren) + checkVarExact(t, locals, -1, "u64", "u64", "18446744073709551615 = 0xffffffffffffffff", "uint64", noChildren) // reflect.Kind == Uintptr - expectVarExact(t, locals, -1, "up", "5", noChildren) + checkVarExact(t, locals, -1, "up", "up", "5 = 0x5", "uintptr", noChildren) // reflect.Kind == Float32 - expectVarExact(t, locals, -1, "f32", "1.2", noChildren) + checkVarExact(t, locals, -1, "f32", "f32", "1.2", "float32", noChildren) // reflect.Kind == Float64 - expectVarExact(t, locals, -1, "a3", "7.23", noChildren) + checkVarExact(t, locals, -1, "a3", "a3", "7.23", "float64", noChildren) // reflect.Kind == Complex64 - ref = expectVarExact(t, locals, -1, "c64", "(1 + 2i)", hasChildren) + ref = checkVarExact(t, locals, -1, "c64", "c64", "(1 + 2i)", "complex64", hasChildren) if ref > 0 { client.VariablesRequest(ref) c64 := client.ExpectVariablesResponse(t) - expectChildren(t, c64, "c64", 2) - expectVarExact(t, c64, 0, "real", "1", noChildren) - expectVarExact(t, c64, 1, "imaginary", "2", noChildren) + checkChildren(t, c64, "c64", 2) + checkVarExact(t, c64, 0, "real", "", "1", "float32", noChildren) + checkVarExact(t, c64, 1, "imaginary", "", "2", "float32", noChildren) } // reflect.Kind == Complex128 - ref = expectVarExact(t, locals, -1, "c128", "(2 + 3i)", hasChildren) + ref = checkVarExact(t, locals, -1, "c128", "c128", "(2 + 3i)", "complex128", hasChildren) if ref > 0 { client.VariablesRequest(ref) c128 := client.ExpectVariablesResponse(t) - expectChildren(t, c128, "c128", 2) - expectVarExact(t, c128, 0, "real", "2", noChildren) - expectVarExact(t, c128, 1, "imaginary", "3", noChildren) + checkChildren(t, c128, "c128", 2) + checkVarExact(t, c128, 0, "real", "", "2", "float64", noChildren) + checkVarExact(t, c128, 1, "imaginary", "", "3", "float64", noChildren) } // reflect.Kind == Array - ref = expectVarExact(t, locals, -1, "a4", "<[2]int>", hasChildren) + ref = checkVarExact(t, locals, -1, "a4", "a4", "[2]int [1,2]", "[2]int", hasChildren) if ref > 0 { client.VariablesRequest(ref) a4 := client.ExpectVariablesResponse(t) - expectChildren(t, a4, "a4", 2) - expectVarExact(t, a4, 0, "[0]", "1", noChildren) - expectVarExact(t, a4, 1, "[1]", "2", noChildren) + checkChildren(t, a4, "a4", 2) + checkVarExact(t, a4, 0, "[0]", "a4[0]", "1", "int", noChildren) + checkVarExact(t, a4, 1, "[1]", "a4[1]", "2", "int", noChildren) } - ref = expectVarExact(t, locals, -1, "a11", "<[3]main.FooBar>", hasChildren) + ref = checkVarExact(t, locals, -1, "a11", "a11", `[3]main.FooBar [{Baz: 1, Bur: "a"},{Baz: 2, Bur: "b"},{Baz: 3, Bur: "c"}]`, "[3]main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a11 := client.ExpectVariablesResponse(t) - expectChildren(t, a11, "a11", 3) - expectVarExact(t, a11, 0, "[0]", "", hasChildren) - ref = expectVarExact(t, a11, 1, "[1]", "", hasChildren) + checkChildren(t, a11, "a11", 3) + checkVarExact(t, a11, 0, "[0]", "a11[0]", `main.FooBar {Baz: 1, Bur: "a"}`, "main.FooBar", hasChildren) + ref = checkVarExact(t, a11, 1, "[1]", "a11[1]", `main.FooBar {Baz: 2, Bur: "b"}`, "main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a11_1 := client.ExpectVariablesResponse(t) - expectChildren(t, a11_1, "a11[1]", 2) - expectVarExact(t, a11_1, 0, "Baz", "2", noChildren) - expectVarExact(t, a11_1, 1, "Bur", `"b"`, noChildren) - + checkChildren(t, a11_1, "a11[1]", 2) + checkVarExact(t, a11_1, 0, "Baz", "a11[1].Baz", "2", "int", noChildren) + checkVarExact(t, a11_1, 1, "Bur", "a11[1].Bur", `"b"`, "string", noChildren) + validateEvaluateName(t, client, a11_1, 0) + validateEvaluateName(t, client, a11_1, 1) } - expectVarExact(t, a11, 2, "[2]", "", hasChildren) + checkVarExact(t, a11, 2, "[2]", "a11[2]", `main.FooBar {Baz: 3, Bur: "c"}`, "main.FooBar", hasChildren) } // reflect.Kind == Chan - see testvariables2 @@ -678,121 +1490,130 @@ func TestScopesAndVariablesRequests(t *testing.T) { // reflect.Kind == Interface - see testvariables2 // reflect.Kind == Map - see testvariables2 // reflect.Kind == Ptr - ref = expectVarRegex(t, locals, -1, "a7", "<\\*main\\.FooBar>\\(0x[0-9a-f]+\\)", hasChildren) + ref = checkVarExact(t, locals, -1, "a7", "a7", `*main.FooBar {Baz: 5, Bur: "strum"}`, "*main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a7 := client.ExpectVariablesResponse(t) - expectChildren(t, a7, "a7", 1) - ref = expectVarExact(t, a7, 0, "", "", hasChildren) + checkChildren(t, a7, "a7", 1) + ref = checkVarExact(t, a7, 0, "", "(*a7)", `main.FooBar {Baz: 5, Bur: "strum"}`, "main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a7val := client.ExpectVariablesResponse(t) - expectChildren(t, a7val, "*a7", 2) - expectVarExact(t, a7val, 0, "Baz", "5", noChildren) - expectVarExact(t, a7val, 1, "Bur", `"strum"`, noChildren) + checkChildren(t, a7val, "*a7", 2) + checkVarExact(t, a7val, 0, "Baz", "(*a7).Baz", "5", "int", noChildren) + checkVarExact(t, a7val, 1, "Bur", "(*a7).Bur", `"strum"`, "string", noChildren) + validateEvaluateName(t, client, a7val, 0) + validateEvaluateName(t, client, a7val, 1) } } // TODO(polina): how to test for "nil" (without type) and "void"? - expectVarExact(t, locals, -1, "a9", "nil <*main.FooBar>", noChildren) + checkVarExact(t, locals, -1, "a9", "a9", "*main.FooBar nil", "*main.FooBar", noChildren) // reflect.Kind == Slice - ref = expectVarExact(t, locals, -1, "a5", "<[]int> (length: 5, cap: 5)", hasChildren) + ref = checkVarExact(t, locals, -1, "a5", "a5", "[]int len: 5, cap: 5, [1,2,3,4,5]", "[]int", hasChildren) if ref > 0 { client.VariablesRequest(ref) a5 := client.ExpectVariablesResponse(t) - expectChildren(t, a5, "a5", 5) - expectVarExact(t, a5, 0, "[0]", "1", noChildren) - expectVarExact(t, a5, 4, "[4]", "5", noChildren) + checkChildren(t, a5, "a5", 5) + checkVarExact(t, a5, 0, "[0]", "a5[0]", "1", "int", noChildren) + checkVarExact(t, a5, 4, "[4]", "a5[4]", "5", "int", noChildren) + validateEvaluateName(t, client, a5, 0) + validateEvaluateName(t, client, a5, 1) } - ref = expectVarExact(t, locals, -1, "a12", "<[]main.FooBar> (length: 2, cap: 2)", hasChildren) + ref = checkVarExact(t, locals, -1, "a12", "a12", `[]main.FooBar len: 2, cap: 2, [{Baz: 4, Bur: "d"},{Baz: 5, Bur: "e"}]`, "[]main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a12 := client.ExpectVariablesResponse(t) - expectChildren(t, a12, "a12", 2) - expectVarExact(t, a12, 0, "[0]", "", hasChildren) - ref = expectVarExact(t, a12, 1, "[1]", "", hasChildren) + checkChildren(t, a12, "a12", 2) + checkVarExact(t, a12, 0, "[0]", "a12[0]", `main.FooBar {Baz: 4, Bur: "d"}`, "main.FooBar", hasChildren) + ref = checkVarExact(t, a12, 1, "[1]", "a12[1]", `main.FooBar {Baz: 5, Bur: "e"}`, "main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a12_1 := client.ExpectVariablesResponse(t) - expectChildren(t, a12_1, "a12[1]", 2) - expectVarExact(t, a12_1, 0, "Baz", "5", noChildren) - expectVarExact(t, a12_1, 1, "Bur", `"e"`, noChildren) + checkChildren(t, a12_1, "a12[1]", 2) + checkVarExact(t, a12_1, 0, "Baz", "a12[1].Baz", "5", "int", noChildren) + checkVarExact(t, a12_1, 1, "Bur", "a12[1].Bur", `"e"`, "string", noChildren) + validateEvaluateName(t, client, a12_1, 0) + validateEvaluateName(t, client, a12_1, 1) } } - ref = expectVarExact(t, locals, -1, "a13", "<[]*main.FooBar> (length: 3, cap: 3)", hasChildren) + ref = checkVarExact(t, locals, -1, "a13", "a13", `[]*main.FooBar len: 3, cap: 3, [*{Baz: 6, Bur: "f"},*{Baz: 7, Bur: "g"},*{Baz: 8, Bur: "h"}]`, "[]*main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a13 := client.ExpectVariablesResponse(t) - expectChildren(t, a13, "a13", 3) - expectVarRegex(t, a13, 0, "[0]", "<\\*main\\.FooBar>\\(0x[0-9a-f]+\\)", hasChildren) - expectVarRegex(t, a13, 1, "[1]", "<\\*main\\.FooBar>\\(0x[0-9a-f]+\\)", hasChildren) - ref = expectVarRegex(t, a13, 2, "[2]", "<\\*main\\.FooBar>\\(0x[0-9a-f]+\\)", hasChildren) + checkChildren(t, a13, "a13", 3) + checkVarExact(t, a13, 0, "[0]", "a13[0]", `*main.FooBar {Baz: 6, Bur: "f"}`, "*main.FooBar", hasChildren) + checkVarExact(t, a13, 1, "[1]", "a13[1]", `*main.FooBar {Baz: 7, Bur: "g"}`, "*main.FooBar", hasChildren) + ref = checkVarExact(t, a13, 2, "[2]", "a13[2]", `*main.FooBar {Baz: 8, Bur: "h"}`, "*main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a13_2 := client.ExpectVariablesResponse(t) - expectChildren(t, a13_2, "a13[2]", 1) - ref = expectVarExact(t, a13_2, 0, "", "", hasChildren) + checkChildren(t, a13_2, "a13[2]", 1) + ref = checkVarExact(t, a13_2, 0, "", "(*a13[2])", `main.FooBar {Baz: 8, Bur: "h"}`, "main.FooBar", hasChildren) + validateEvaluateName(t, client, a13_2, 0) if ref > 0 { client.VariablesRequest(ref) val := client.ExpectVariablesResponse(t) - expectChildren(t, val, "*a13[2]", 2) - expectVarExact(t, val, 0, "Baz", "8", noChildren) - expectVarExact(t, val, 1, "Bur", `"h"`, noChildren) + checkChildren(t, val, "*a13[2]", 2) + checkVarExact(t, val, 0, "Baz", "(*a13[2]).Baz", "8", "int", noChildren) + checkVarExact(t, val, 1, "Bur", "(*a13[2]).Bur", `"h"`, "string", noChildren) + validateEvaluateName(t, client, val, 0) + validateEvaluateName(t, client, val, 1) } } } // reflect.Kind == String - expectVarExact(t, locals, -1, "a1", `"foofoofoofoofoofoo"`, noChildren) - expectVarExact(t, locals, -1, "a10", `"ofo"`, noChildren) + checkVarExact(t, locals, -1, "a1", "a1", `"foofoofoofoofoofoo"`, "string", noChildren) + checkVarExact(t, locals, -1, "a10", "a10", `"ofo"`, "string", noChildren) // reflect.Kind == Struct - ref = expectVarExact(t, locals, -1, "a6", "", hasChildren) + ref = checkVarExact(t, locals, -1, "a6", "a6", `main.FooBar {Baz: 8, Bur: "word"}`, "main.FooBar", hasChildren) if ref > 0 { client.VariablesRequest(ref) a6 := client.ExpectVariablesResponse(t) - expectChildren(t, a6, "a6", 2) - expectVarExact(t, a6, 0, "Baz", "8", noChildren) - expectVarExact(t, a6, 1, "Bur", `"word"`, noChildren) + checkChildren(t, a6, "a6", 2) + checkVarExact(t, a6, 0, "Baz", "a6.Baz", "8", "int", noChildren) + checkVarExact(t, a6, 1, "Bur", "a6.Bur", `"word"`, "string", noChildren) } - ref = expectVarExact(t, locals, -1, "a8", "", hasChildren) + ref = checkVarExact(t, locals, -1, "a8", "a8", `main.FooBar2 {Bur: 10, Baz: "feh"}`, "main.FooBar2", hasChildren) if ref > 0 { client.VariablesRequest(ref) a8 := client.ExpectVariablesResponse(t) - expectChildren(t, a8, "a8", 2) - expectVarExact(t, a8, 0, "Bur", "10", noChildren) - expectVarExact(t, a8, 1, "Baz", `"feh"`, noChildren) + checkChildren(t, a8, "a8", 2) + checkVarExact(t, a8, 0, "Bur", "a8.Bur", "10", "int", noChildren) + checkVarExact(t, a8, 1, "Baz", "a8.Baz", `"feh"`, "string", noChildren) } // reflect.Kind == UnsafePointer - see testvariables2 }, disconnect: false, }, { - // Stop at line 25 + // Stop at second breakpoint execute: func() { // Frame ids get reset at each breakpoint. client.StackTraceRequest(1, 0, 20) stack := client.ExpectStackTraceResponse(t) - expectStackFrames(t, stack, 25, 1000, 5, 5) + checkStackFramesExact(t, stack, "main.barfoo", 27, 1000, 5, 5) client.ScopesRequest(1000) scopes := client.ExpectScopesResponse(t) - expectScope(t, scopes, 0, "Arguments", 1000) - expectScope(t, scopes, 1, "Locals", 1001) + checkScope(t, scopes, 0, "Locals", localsScope) + checkScope(t, scopes, 1, "Globals (package main)", globalsScope) client.ScopesRequest(1111) - erres := client.ExpectErrorResponse(t) + erres := client.ExpectInvisibleErrorResponse(t) if erres.Body.Error.Format != "Unable to list locals: unknown frame id 1111" { t.Errorf("\ngot %#v\nwant Format=\"Unable to list locals: unknown frame id 1111\"", erres) } - client.VariablesRequest(1000) // Arguments - args := client.ExpectVariablesResponse(t) - expectChildren(t, args, "Arguments", 0) - - client.VariablesRequest(1001) // Locals + client.VariablesRequest(localsScope) locals := client.ExpectVariablesResponse(t) - expectChildren(t, locals, "Locals", 1) - expectVarExact(t, locals, -1, "a1", `"bur"`, noChildren) + checkChildren(t, locals, "Locals", 1) + checkVarExact(t, locals, -1, "a1", "a1", `"bur"`, "string", noChildren) + + client.VariablesRequest(globalsScope) + globals := client.ExpectVariablesResponse(t) + checkVarExact(t, globals, 0, "p1", "main.p1", "10", "int", noChildren) client.VariablesRequest(7777) - erres = client.ExpectErrorResponse(t) + erres = client.ExpectInvisibleErrorResponse(t) if erres.Body.Error.Format != "Unable to lookup variable: unknown reference 7777" { t.Errorf("\ngot %#v\nwant Format=\"Unable to lookup variable: unknown reference 7777\"", erres) } @@ -806,7 +1627,7 @@ func TestScopesAndVariablesRequests(t *testing.T) { // configurations of 'scopes' and 'variables' requests. func TestScopesAndVariablesRequests2(t *testing.T) { runTest(t, "testvariables2", func(client *daptest.Client, fixture protest.Fixture) { - runDebugSessionWithBPs(t, client, + runDebugSessionWithBPs(t, client, "launch", // Launch func() { client.LaunchRequest("exec", fixture.Path, !stopOnEntry) @@ -814,51 +1635,43 @@ func TestScopesAndVariablesRequests2(t *testing.T) { // Breakpoints are set within the program fixture.Source, []int{}, []onBreakpoint{{ - // Stop at line 317 execute: func() { client.StackTraceRequest(1, 0, 20) stack := client.ExpectStackTraceResponse(t) - expectStackFrames(t, stack, 317, 1000, 3, 3) + checkStackFramesExact(t, stack, "main.main", -1, 1000, 3, 3) client.ScopesRequest(1000) scopes := client.ExpectScopesResponse(t) - expectScope(t, scopes, 0, "Arguments", 1000) - expectScope(t, scopes, 1, "Locals", 1001) + checkScope(t, scopes, 0, "Locals", localsScope) }, disconnect: false, }, { - // Stop at line 322 execute: func() { client.StackTraceRequest(1, 0, 20) stack := client.ExpectStackTraceResponse(t) - expectStackFrames(t, stack, 322, 1000, 3, 3) + checkStackFramesExact(t, stack, "main.main", -1, 1000, 3, 3) client.ScopesRequest(1000) scopes := client.ExpectScopesResponse(t) - expectScope(t, scopes, 0, "Arguments", 1000) - expectScope(t, scopes, 1, "Locals", 1001) - - // Arguments - - client.VariablesRequest(1000) - args := client.ExpectVariablesResponse(t) - expectChildren(t, args, "Arguments", 0) + if len(scopes.Body.Scopes) > 1 { + t.Errorf("\ngot %#v\nwant len(scopes)=1 (Argumes & Locals)", scopes) + } + checkScope(t, scopes, 0, "Locals", localsScope) // Locals - - client.VariablesRequest(1001) + client.VariablesRequest(localsScope) locals := client.ExpectVariablesResponse(t) // reflect.Kind == Bool - see testvariables // reflect.Kind == Int - see testvariables // reflect.Kind == Int8 - expectVarExact(t, locals, -1, "ni8", "-5", noChildren) + checkVarExact(t, locals, -1, "ni8", "ni8", "-5", "int8", noChildren) // reflect.Kind == Int16 - expectVarExact(t, locals, -1, "ni16", "-5", noChildren) + checkVarExact(t, locals, -1, "ni16", "ni16", "-5", "int16", noChildren) // reflect.Kind == Int32 - expectVarExact(t, locals, -1, "ni32", "-5", noChildren) + checkVarExact(t, locals, -1, "ni32", "ni32", "-5", "int32", noChildren) // reflect.Kind == Int64 - expectVarExact(t, locals, -1, "ni64", "-5", noChildren) + checkVarExact(t, locals, -1, "ni64", "ni64", "-5", "int64", noChildren) // reflect.Kind == Uint // reflect.Kind == Uint8 - see testvariables // reflect.Kind == Uint16 - see testvariables @@ -867,152 +1680,205 @@ func TestScopesAndVariablesRequests2(t *testing.T) { // reflect.Kind == Uintptr - see testvariables // reflect.Kind == Float32 - see testvariables // reflect.Kind == Float64 - expectVarExact(t, locals, -1, "pinf", "+Inf", noChildren) - expectVarExact(t, locals, -1, "ninf", "-Inf", noChildren) - expectVarExact(t, locals, -1, "nan", "NaN", noChildren) + checkVarExact(t, locals, -1, "pinf", "pinf", "+Inf", "float64", noChildren) + checkVarExact(t, locals, -1, "ninf", "ninf", "-Inf", "float64", noChildren) + checkVarExact(t, locals, -1, "nan", "nan", "NaN", "float64", noChildren) // reflect.Kind == Complex64 - see testvariables // reflect.Kind == Complex128 - see testvariables // reflect.Kind == Array - expectVarExact(t, locals, -1, "a0", "<[0]int>", noChildren) + checkVarExact(t, locals, -1, "a0", "a0", "[0]int []", "[0]int", noChildren) // reflect.Kind == Chan - ref := expectVarExact(t, locals, -1, "ch1", "", hasChildren) + ref := checkVarExact(t, locals, -1, "ch1", "ch1", "chan int 4/11", "chan int", hasChildren) if ref > 0 { client.VariablesRequest(ref) ch1 := client.ExpectVariablesResponse(t) - expectChildren(t, ch1, "ch1", 11) - expectVarExact(t, ch1, 0, "qcount", "4", noChildren) - expectVarExact(t, ch1, 10, "lock", "", hasChildren) + checkChildren(t, ch1, "ch1", 11) + checkVarExact(t, ch1, 0, "qcount", "ch1.qcount", "4 = 0x4", "uint", noChildren) + checkVarRegex(t, ch1, 10, "lock", "ch1.lock", `runtime\.mutex {.*key: 0.*}`, `runtime\.mutex`, hasChildren) + validateEvaluateName(t, client, ch1, 0) + validateEvaluateName(t, client, ch1, 10) } - expectVarExact(t, locals, -1, "chnil", "nil ", noChildren) + checkVarExact(t, locals, -1, "chnil", "chnil", "chan int nil", "chan int", noChildren) // reflect.Kind == Func - expectVarExact(t, locals, -1, "fn1", "main.afunc", noChildren) - expectVarExact(t, locals, -1, "fn2", "", noChildren) + checkVarExact(t, locals, -1, "fn1", "fn1", "main.afunc", "main.functype", noChildren) + checkVarExact(t, locals, -1, "fn2", "fn2", "nil", "main.functype", noChildren) // reflect.Kind == Interface - expectVarExact(t, locals, -1, "ifacenil", "nil ", noChildren) - ref = expectVarExact(t, locals, -1, "iface2", "", hasChildren) + checkVarExact(t, locals, -1, "ifacenil", "ifacenil", "interface {} nil", "interface {}", noChildren) + ref = checkVarExact(t, locals, -1, "iface2", "iface2", "interface {}(string) \"test\"", "interface {}", hasChildren) if ref > 0 { client.VariablesRequest(ref) iface2 := client.ExpectVariablesResponse(t) - expectChildren(t, iface2, "iface2", 1) - expectVarExact(t, iface2, 0, "data", `"test"`, noChildren) + checkChildren(t, iface2, "iface2", 1) + checkVarExact(t, iface2, 0, "data", "iface2.(data)", `"test"`, "string", noChildren) + validateEvaluateName(t, client, iface2, 0) } - ref = expectVarExact(t, locals, -1, "iface4", "", hasChildren) + ref = checkVarExact(t, locals, -1, "iface4", "iface4", "interface {}([]go/constant.Value) [4]", "interface {}", hasChildren) if ref > 0 { client.VariablesRequest(ref) iface4 := client.ExpectVariablesResponse(t) - expectChildren(t, iface4, "iface4", 1) - ref = expectVarExact(t, iface4, 0, "data", "<[]go/constant.Value> (length: 1, cap: 1)", hasChildren) + checkChildren(t, iface4, "iface4", 1) + ref = checkVarExact(t, iface4, 0, "data", "iface4.(data)", "[]go/constant.Value len: 1, cap: 1, [4]", "[]go/constant.Value", hasChildren) if ref > 0 { client.VariablesRequest(ref) iface4data := client.ExpectVariablesResponse(t) - expectChildren(t, iface4data, "iface4.data", 1) - expectVarExact(t, iface4data, 0, "[0]", "", hasChildren) - + checkChildren(t, iface4data, "iface4.data", 1) + ref = checkVarExact(t, iface4data, 0, "[0]", "iface4.(data)[0]", "go/constant.Value(go/constant.int64Val) 4", "go/constant.Value", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + iface4data0 := client.ExpectVariablesResponse(t) + checkChildren(t, iface4data0, "iface4.data[0]", 1) + checkVarExact(t, iface4data0, 0, "data", "iface4.(data)[0].(data)", "4", "go/constant.int64Val", noChildren) + validateEvaluateName(t, client, iface4data0, 0) + } + } + } + checkVarExact(t, locals, -1, "errnil", "errnil", "error nil", "error", noChildren) + ref = checkVarExact(t, locals, -1, "err1", "err1", "error(*main.astruct) *{A: 1, B: 2}", "error", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + err1 := client.ExpectVariablesResponse(t) + checkChildren(t, err1, "err1", 1) + checkVarExact(t, err1, 0, "data", "err1.(data)", "*main.astruct {A: 1, B: 2}", "*main.astruct", hasChildren) + validateEvaluateName(t, client, err1, 0) + } + ref = checkVarExact(t, locals, -1, "ptrinf", "ptrinf", "*interface {}(**interface {}) **...", "*interface {}", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + ptrinf_val := client.ExpectVariablesResponse(t) + checkChildren(t, ptrinf_val, "*ptrinf", 1) + ref = checkVarExact(t, ptrinf_val, 0, "", "(*ptrinf)", "interface {}(**interface {}) **...", "interface {}", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + ptrinf_val_data := client.ExpectVariablesResponse(t) + checkChildren(t, ptrinf_val_data, "(*ptrinf).data", 1) + checkVarExact(t, ptrinf_val_data, 0, "data", "(*ptrinf).(data)", "**interface {}(**interface {}) ...", "**interface {}", hasChildren) + validateEvaluateName(t, client, ptrinf_val_data, 0) } } // reflect.Kind == Map - expectVarExact(t, locals, -1, "mnil", "nil ", noChildren) - ref = expectVarExact(t, locals, -1, "m2", " (length: 1)", hasChildren) + checkVarExact(t, locals, -1, "mnil", "mnil", "map[string]main.astruct nil", "map[string]main.astruct", noChildren) + // key - scalar, value - compound + ref = checkVarExact(t, locals, -1, "m2", "m2", "map[int]*main.astruct [1: *{A: 10, B: 11}, ]", "map[int]*main.astruct", hasChildren) if ref > 0 { client.VariablesRequest(ref) m2 := client.ExpectVariablesResponse(t) - expectChildren(t, m2, "m2", 1) - ref = expectVarRegex(t, m2, 0, "1", "<\\*main\\.astruct>\\(0x[0-9a-f]+\\)", hasChildren) + checkChildren(t, m2, "m2", 2) // each key-value represented by a single child + checkVarExact(t, m2, 0, "len()", "len(m2)", "1", "int", noChildren) + ref = checkVarExact(t, m2, 1, "1", "m2[1]", "*main.astruct {A: 10, B: 11}", "int: *main.astruct", hasChildren) if ref > 0 { client.VariablesRequest(ref) - m2_1 := client.ExpectVariablesResponse(t) - expectChildren(t, m2_1, "m2[1]", 1) - ref = expectVarExact(t, m2_1, 0, "", "", hasChildren) + m2kv1 := client.ExpectVariablesResponse(t) + checkChildren(t, m2kv1, "m2[1]", 1) + ref = checkVarExact(t, m2kv1, 0, "", "(*m2[1])", "main.astruct {A: 10, B: 11}", "main.astruct", hasChildren) if ref > 0 { client.VariablesRequest(ref) - m2_1val := client.ExpectVariablesResponse(t) - expectChildren(t, m2_1val, "*m2[1]", 2) - expectVarExact(t, m2_1val, 0, "A", "10", noChildren) - expectVarExact(t, m2_1val, 1, "B", "11", noChildren) + m2kv1deref := client.ExpectVariablesResponse(t) + checkChildren(t, m2kv1deref, "*m2[1]", 2) + checkVarExact(t, m2kv1deref, 0, "A", "(*m2[1]).A", "10", "int", noChildren) + checkVarExact(t, m2kv1deref, 1, "B", "(*m2[1]).B", "11", "int", noChildren) + validateEvaluateName(t, client, m2kv1deref, 0) + validateEvaluateName(t, client, m2kv1deref, 1) } } } - ref = expectVarExact(t, locals, -1, "m3", " (length: 2)", hasChildren) + // key - compound, value - scalar + ref = checkVarExact(t, locals, -1, "m3", "m3", "map[main.astruct]int [{A: 1, B: 1}: 42, {A: 2, B: 2}: 43, ]", "map[main.astruct]int", hasChildren) if ref > 0 { client.VariablesRequest(ref) m3 := client.ExpectVariablesResponse(t) - expectChildren(t, m3, "m3", 2) - ref = expectVarExact(t, m3, 0, "[0]", "42", hasChildren) + checkChildren(t, m3, "m3", 3) // each key-value represented by a single child + checkVarExact(t, m3, 0, "len()", "len(m3)", "2", "int", noChildren) + ref = checkVarRegex(t, m3, 1, `main\.astruct {A: 1, B: 1}`, `m3\[\(\*\(\*"main.astruct"\)\(0x[0-9a-f]+\)\)\]`, "42", "int", hasChildren) if ref > 0 { client.VariablesRequest(ref) - m3_0 := client.ExpectVariablesResponse(t) - expectChildren(t, m3_0, "m3[0]", 2) - expectVarExact(t, m3_0, 0, "A", "1", noChildren) - expectVarExact(t, m3_0, 1, "B", "1", noChildren) + m3kv0 := client.ExpectVariablesResponse(t) + checkChildren(t, m3kv0, "m3[0]", 2) + checkVarRegex(t, m3kv0, 0, "A", `\(*\(*"main\.astruct"\)\(0x[0-9a-f]+\)\)\.A`, "1", "int", noChildren) + validateEvaluateName(t, client, m3kv0, 0) } - ref = expectVarExact(t, m3, 1, "[1]", "43", hasChildren) - if ref > 0 { + ref = checkVarRegex(t, m3, 2, `main\.astruct {A: 2, B: 2}`, `m3\[\(\*\(\*"main.astruct"\)\(0x[0-9a-f]+\)\)\]`, "43", "", hasChildren) + if ref > 0 { // inspect another key from another key-value child client.VariablesRequest(ref) - m3_1 := client.ExpectVariablesResponse(t) - expectChildren(t, m3_1, "m3[1]", 2) - expectVarExact(t, m3_1, 0, "A", "2", noChildren) - expectVarExact(t, m3_1, 1, "B", "2", noChildren) + m3kv1 := client.ExpectVariablesResponse(t) + checkChildren(t, m3kv1, "m3[1]", 2) + checkVarRegex(t, m3kv1, 1, "B", `\(*\(*"main\.astruct"\)\(0x[0-9a-f]+\)\)\.B`, "2", "int", noChildren) + validateEvaluateName(t, client, m3kv1, 1) } } - ref = expectVarExact(t, locals, -1, "m4", " (length: 2)", hasChildren) + // key - compound, value - compound + ref = checkVarExact(t, locals, -1, "m4", "m4", "map[main.astruct]main.astruct [{A: 1, B: 1}: {A: 11, B: 11}, {A: 2, B: 2}: {A: 22, B: 22}, ]", "map[main.astruct]main.astruct", hasChildren) if ref > 0 { client.VariablesRequest(ref) m4 := client.ExpectVariablesResponse(t) - expectChildren(t, m4, "m4", 4) - expectVarExact(t, m4, 0, "[key 0]", "", hasChildren) - expectVarExact(t, m4, 1, "[val 0]", "", hasChildren) - ref = expectVarExact(t, m4, 2, "[key 1]", "", hasChildren) + checkChildren(t, m4, "m4", 5) // each key and value represented by a child, so double the key-value count + checkVarExact(t, m4, 0, "len()", "len(m4)", "2", "int", noChildren) + checkVarRegex(t, m4, 1, `\[key 0\]`, `\(\*\(\*"main\.astruct"\)\(0x[0-9a-f]+\)\)`, `main\.astruct {A: 1, B: 1}`, `main\.astruct`, hasChildren) + checkVarRegex(t, m4, 2, `\[val 0\]`, `m4\[\(\*\(\*"main\.astruct"\)\(0x[0-9a-f]+\)\)\]`, `main\.astruct {A: 11, B: 11}`, `main\.astruct`, hasChildren) + ref = checkVarRegex(t, m4, 3, `\[key 1\]`, `\(\*\(\*"main\.astruct"\)\(0x[0-9a-f]+\)\)`, `main\.astruct {A: 2, B: 2}`, `main\.astruct`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + m4Key1 := client.ExpectVariablesResponse(t) + checkChildren(t, m4Key1, "m4Key1", 2) + checkVarRegex(t, m4Key1, 0, "A", `\(\*\(\*"main\.astruct"\)\(0x[0-9a-f]+\)\)\.A`, "2", "int", noChildren) + checkVarRegex(t, m4Key1, 1, "B", `\(\*\(\*"main\.astruct"\)\(0x[0-9a-f]+\)\)\.B`, "2", "int", noChildren) + validateEvaluateName(t, client, m4Key1, 0) + validateEvaluateName(t, client, m4Key1, 1) + } + ref = checkVarRegex(t, m4, 4, `\[val 1\]`, `m4\[\(\*\(\*"main\.astruct"\)\(0x[0-9a-f]+\)\)\]`, `main\.astruct {A: 22, B: 22}`, "main.astruct", hasChildren) if ref > 0 { client.VariablesRequest(ref) - m4_key1 := client.ExpectVariablesResponse(t) - expectChildren(t, m4_key1, "m4_key1", 2) - expectVarExact(t, m4_key1, 0, "A", "2", noChildren) - expectVarExact(t, m4_key1, 1, "B", "2", noChildren) + m4Val1 := client.ExpectVariablesResponse(t) + checkChildren(t, m4Val1, "m4Val1", 2) + checkVarRegex(t, m4Val1, 0, "A", `m4\[\(\*\(\*"main\.astruct"\)\(0x[0-9a-f]+\)\)\]\.A`, "22", "int", noChildren) + checkVarRegex(t, m4Val1, 1, "B", `m4\[\(\*\(\*"main\.astruct"\)\(0x[0-9a-f]+\)\)\]\.B`, "22", "int", noChildren) + validateEvaluateName(t, client, m4Val1, 0) + validateEvaluateName(t, client, m4Val1, 1) } - ref = expectVarExact(t, m4, 3, "[val 1]", "", hasChildren) + } + checkVarExact(t, locals, -1, "emptymap", "emptymap", "map[string]string []", "map[string]string", noChildren) + // reflect.Kind == Ptr + ref = checkVarExact(t, locals, -1, "pp1", "pp1", "**1", "**int", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + pp1val := client.ExpectVariablesResponse(t) + checkChildren(t, pp1val, "*pp1", 1) + ref = checkVarExact(t, pp1val, 0, "", "(*pp1)", "*1", "*int", hasChildren) if ref > 0 { client.VariablesRequest(ref) - m4_val1 := client.ExpectVariablesResponse(t) - expectChildren(t, m4_val1, "m4_val1", 2) - expectVarExact(t, m4_val1, 0, "A", "22", noChildren) - expectVarExact(t, m4_val1, 1, "B", "22", noChildren) + pp1valval := client.ExpectVariablesResponse(t) + checkChildren(t, pp1valval, "*(*pp1)", 1) + checkVarExact(t, pp1valval, 0, "", "(*(*pp1))", "1", "int", noChildren) + validateEvaluateName(t, client, pp1valval, 0) } } - expectVarExact(t, locals, -1, "emptymap", " (length: 0)", noChildren) - // reflect.Kind == Ptr - see testvariables // reflect.Kind == Slice - ref = expectVarExact(t, locals, -1, "zsslice", "<[]struct {}> (length: 3, cap: 3)", hasChildren) + ref = checkVarExact(t, locals, -1, "zsslice", "zsslice", "[]struct {} len: 3, cap: 3, [{},{},{}]", "[]struct {}", hasChildren) if ref > 0 { client.VariablesRequest(ref) zsslice := client.ExpectVariablesResponse(t) - expectChildren(t, zsslice, "zsslice", 3) + checkChildren(t, zsslice, "zsslice", 3) + checkVarExact(t, zsslice, 2, "[2]", "zsslice[2]", "struct {} {}", "struct {}", noChildren) + validateEvaluateName(t, client, zsslice, 2) } - expectVarExact(t, locals, -1, "emptyslice", "<[]string> (length: 0, cap: 0)", noChildren) - expectVarExact(t, locals, -1, "nilslice", "nil <[]int>", noChildren) + checkVarExact(t, locals, -1, "emptyslice", "emptyslice", "[]string len: 0, cap: 0, []", "[]string", noChildren) + checkVarExact(t, locals, -1, "nilslice", "nilslice", "[]int len: 0, cap: 0, nil", "[]int", noChildren) // reflect.Kind == String - expectVarExact(t, locals, -1, "longstr", "\"very long string 0123456789a0123456789b0123456789c0123456789d012...+73 more\"", noChildren) + checkVarExact(t, locals, -1, "longstr", "longstr", longstr, "string", noChildren) // reflect.Kind == Struct - expectVarExact(t, locals, -1, "zsvar", "", noChildren) + checkVarExact(t, locals, -1, "zsvar", "zsvar", "struct {} {}", "struct {}", noChildren) // reflect.Kind == UnsafePointer // TODO(polina): how do I test for unsafe.Pointer(nil)? - expectVarRegex(t, locals, -1, "upnil", "unsafe\\.Pointer\\(0x0\\)", noChildren) - expectVarRegex(t, locals, -1, "up1", "unsafe\\.Pointer\\(0x[0-9a-f]+\\)", noChildren) + checkVarRegex(t, locals, -1, "upnil", "upnil", `unsafe\.Pointer\(0x0\)`, "int", noChildren) + checkVarRegex(t, locals, -1, "up1", "up1", `unsafe\.Pointer\(0x[0-9a-f]+\)`, "int", noChildren) // Test unreadable variable - ref = expectVarExact(t, locals, -1, "unread", "<*int>(0x3039)", hasChildren) + ref = checkVarRegex(t, locals, -1, "unread", "unread", `\*\(unreadable .+\)`, "int", hasChildren) if ref > 0 { client.VariablesRequest(ref) val := client.ExpectVariablesResponse(t) - expectChildren(t, val, "*unread", 1) - expectVarRegex(t, val, 0, "", "unreadable <.+>", noChildren) - } - - // Test that variables are not yet loaded completely. - ref = expectVarExact(t, locals, -1, "m1", " (length: 66)", hasChildren) - if ref > 0 { - client.VariablesRequest(ref) - m1 := client.ExpectVariablesResponse(t) - expectChildren(t, m1, "m1", 64) // TODO(polina): should be 66. + checkChildren(t, val, "*unread", 1) + checkVarRegex(t, val, 0, "^$", `\(\*unread\)`, `\(unreadable .+\)`, "int", noChildren) + validateEvaluateName(t, client, val, 0) } }, disconnect: true, @@ -1020,240 +1886,3607 @@ func TestScopesAndVariablesRequests2(t *testing.T) { }) } -// Tests that 'stackTraceDepth' from LaunchRequest is parsed and passed to -// stacktrace requests handlers. -func TestLaunchRequestWithStackTraceDepth(t *testing.T) { - runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { - var stResp *dap.StackTraceResponse - runDebugSessionWithBPs(t, client, +// TestScopesRequestsOptimized executes to a breakpoint and tests different +// that the name of the "Locals" scope is correctly annotated with +// a warning about debugging an optimized function. +func TestScopesRequestsOptimized(t *testing.T) { + runTestBuildFlags(t, "testvariables", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", // Launch func() { client.LaunchRequestWithArgs(map[string]interface{}{ - "mode": "exec", "program": fixture.Path, "stackTraceDepth": 1, + "mode": "exec", "program": fixture.Path, "showGlobalVariables": true, }) }, - // Set breakpoints - fixture.Source, []int{8}, - []onBreakpoint{{ // Stop at line 8 - execute: func() { - client.StackTraceRequest(1, 0, 0) - stResp = client.ExpectStackTraceResponse(t) - expectStackFrames(t, stResp, 8, 1000, 2, 2) - }, - disconnect: false, - }}) - }) -} - -func TestNextAndStep(t *testing.T) { - runTest(t, "testinline", func(client *daptest.Client, fixture protest.Fixture) { - runDebugSessionWithBPs(t, client, - // Launch - func() { - client.LaunchRequest("exec", fixture.Path, !stopOnEntry) - }, - // Set breakpoints - fixture.Source, []int{11}, - []onBreakpoint{{ // Stop at line 11 + // Breakpoints are set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + // Stop at first breakpoint execute: func() { - handleStop(t, client, 1, 11) + client.StackTraceRequest(1, 0, 20) + stack := client.ExpectStackTraceResponse(t) - expectStop := func(line int) { - t.Helper() - se := client.ExpectStoppedEvent(t) - if se.Body.Reason != "step" || se.Body.ThreadId != 1 || !se.Body.AllThreadsStopped { - t.Errorf("got %#v, want Reason=\"step\", ThreadId=1, AllThreadsStopped=true", se) - } - handleStop(t, client, 1, line) + startLineno := 66 + if runtime.GOOS == "windows" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { + // Go1.15 on windows inserts a NOP after the call to + // runtime.Breakpoint and marks it same line as the + // runtime.Breakpoint call, making this flaky, so skip the line check. + startLineno = -1 } - client.StepOutRequest(1) - client.ExpectStepOutResponse(t) - expectStop(18) - - client.NextRequest(1) - client.ExpectNextResponse(t) - expectStop(19) + checkStackFramesExact(t, stack, "main.foobar", startLineno, 1000, 4, 4) - client.StepInRequest(1) - client.ExpectStepInResponse(t) - expectStop(5) + client.ScopesRequest(1000) + scopes := client.ExpectScopesResponse(t) + checkScope(t, scopes, 0, "Locals (warning: optimized function)", localsScope) + checkScope(t, scopes, 1, "Globals (package main)", globalsScope) + }, + disconnect: false, + }, { + // Stop at second breakpoint + execute: func() { + // Frame ids get reset at each breakpoint. + client.StackTraceRequest(1, 0, 20) + stack := client.ExpectStackTraceResponse(t) + checkStackFramesExact(t, stack, "main.barfoo", 27, 1000, 5, 5) - client.NextRequest(-10000 /*this is ignored*/) - client.ExpectNextResponse(t) - expectStop(6) + client.ScopesRequest(1000) + scopes := client.ExpectScopesResponse(t) + checkScope(t, scopes, 0, "Locals (warning: optimized function)", localsScope) + checkScope(t, scopes, 1, "Globals (package main)", globalsScope) }, disconnect: false, }}) - }) + }, + protest.EnableOptimization) } -func TestBadAccess(t *testing.T) { - if runtime.GOOS != "darwin" || testBackend != "lldb" { - t.Skip("not applicable") - } - runTest(t, "issue2078", func(client *daptest.Client, fixture protest.Fixture) { - runDebugSessionWithBPs(t, client, +// TestVariablesLoading exposes test cases where variables might be partially or +// fully unloaded. +func TestVariablesLoading(t *testing.T) { + runTest(t, "testvariables2", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", // Launch func() { client.LaunchRequest("exec", fixture.Path, !stopOnEntry) }, - // Set breakpoints - fixture.Source, []int{4}, - []onBreakpoint{{ // Stop at line 4 + // Breakpoints are set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + execute: func() {}, + disconnect: false, + }, { execute: func() { - handleStop(t, client, 1, 4) - - expectStoppedOnError := func(errorPrefix string) { - t.Helper() - se := client.ExpectStoppedEvent(t) - if se.Body.ThreadId != 1 || se.Body.Reason != "runtime error" || !strings.HasPrefix(se.Body.Text, errorPrefix) { - t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"runtime error\" Text=\"%s\"", se, errorPrefix) - } - oe := client.ExpectOutputEvent(t) - if oe.Body.Category != "stderr" || !strings.HasPrefix(oe.Body.Output, "ERROR: "+errorPrefix) { - t.Errorf("\ngot %#v\nwant Category=\"stderr\" Output=\"%s ...\"", oe, errorPrefix) - } - } + // Change default config values to trigger certain unloaded corner cases + saveDefaultConfig := DefaultLoadConfig + DefaultLoadConfig.MaxStructFields = 5 + DefaultLoadConfig.MaxStringLen = 64 + defer func() { + DefaultLoadConfig = saveDefaultConfig + }() - client.ContinueRequest(1) - client.ExpectContinueResponse(t) - expectStoppedOnError("invalid memory address or nil pointer dereference") + client.StackTraceRequest(1, 0, 0) + client.ExpectStackTraceResponse(t) - client.NextRequest(1) - client.ExpectNextResponse(t) - expectStoppedOnError("invalid memory address or nil pointer dereference") + client.ScopesRequest(1000) + client.ExpectScopesResponse(t) - client.NextRequest(1) - client.ExpectNextResponse(t) - expectStoppedOnError("next while nexting") + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) - client.StepInRequest(1) - client.ExpectStepInResponse(t) - expectStoppedOnError("next while nexting") + // String partially missing based on LoadConfig.MaxStringLen + // See also TestVariableLoadingOfLongStrings + checkVarExact(t, locals, -1, "longstr", "longstr", longstrLoaded64, "string", noChildren) - client.StepOutRequest(1) - client.ExpectStepOutResponse(t) - expectStoppedOnError("next while nexting") - }, - disconnect: true, - }}) - }) -} + checkArrayChildren := func(t *testing.T, longarr *dap.VariablesResponse, parentName string, start int) { + t.Helper() + for i, child := range longarr.Body.Variables { + idx := start + i + if child.Name != fmt.Sprintf("[%d]", idx) || child.EvaluateName != fmt.Sprintf("%s[%d]", parentName, idx) { + t.Errorf("Expected %s[%d] to have Name=\"[%d]\" EvaluateName=\"%s[%d]\", got %#v", parentName, idx, idx, parentName, idx, child) + } + } + } -// handleStop covers the standard sequence of reqeusts issued by -// a client at a breakpoint or another non-terminal stop event. -// The details have been tested by other tests, -// so this is just a sanity check. -func handleStop(t *testing.T, client *daptest.Client, thread, line int) { - t.Helper() - client.ThreadsRequest() - client.ExpectThreadsResponse(t) + // Array not fully loaded based on LoadConfig.MaxArrayValues. + // Expect to be able to load array by paging. + ref := checkVarExactIndexed(t, locals, -1, "longarr", "longarr", "[100]int [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...+36 more]", "[100]int", hasChildren, 100, 0) + if ref > 0 { + client.VariablesRequest(ref) + longarr := client.ExpectVariablesResponse(t) + checkChildren(t, longarr, "longarr", 64) + checkArrayChildren(t, longarr, "longarr", 0) + + client.IndexedVariablesRequest(ref, 0, 100) + longarr = client.ExpectVariablesResponse(t) + checkChildren(t, longarr, "longarr", 100) + checkArrayChildren(t, longarr, "longarr", 0) + + client.IndexedVariablesRequest(ref, 50, 50) + longarr = client.ExpectVariablesResponse(t) + checkChildren(t, longarr, "longarr", 50) + checkArrayChildren(t, longarr, "longarr", 50) + } - client.StackTraceRequest(thread, 0, 20) - st := client.ExpectStackTraceResponse(t) - if len(st.Body.StackFrames) < 1 || st.Body.StackFrames[0].Line != line { - t.Errorf("\ngot %#v\nwant Line=%d", st, line) - } + // Slice not fully loaded based on LoadConfig.MaxArrayValues. + // Expect to be able to load slice by paging. + ref = checkVarExactIndexed(t, locals, -1, "longslice", "longslice", "[]int len: 100, cap: 100, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...+36 more]", "[]int", hasChildren, 100, 0) + if ref > 0 { + client.VariablesRequest(ref) + longarr := client.ExpectVariablesResponse(t) + checkChildren(t, longarr, "longslice", 64) + checkArrayChildren(t, longarr, "longslice", 0) + + client.IndexedVariablesRequest(ref, 0, 100) + longarr = client.ExpectVariablesResponse(t) + checkChildren(t, longarr, "longslice", 100) + checkArrayChildren(t, longarr, "longslice", 0) + + client.IndexedVariablesRequest(ref, 50, 50) + longarr = client.ExpectVariablesResponse(t) + checkChildren(t, longarr, "longslice", 50) + checkArrayChildren(t, longarr, "longslice", 50) + } - client.ScopesRequest(1000) - client.ExpectScopesResponse(t) + // Map not fully loaded based on LoadConfig.MaxArrayValues + // Expect to be able to load map by paging. + ref = checkVarRegexIndexed(t, locals, -1, "m1", "m1", `map\[string\]main\.astruct \[.+\.\.\.`, `map\[string\]main\.astruct`, hasChildren, 66, 1) + if ref > 0 { + client.VariablesRequest(ref) + m1 := client.ExpectVariablesResponse(t) + checkChildren(t, m1, "m1", 65) + + client.IndexedVariablesRequest(ref, 0, 66) + m1 = client.ExpectVariablesResponse(t) + checkChildren(t, m1, "m1", 66) + + client.IndexedVariablesRequest(ref, 0, 33) + m1part1 := client.ExpectVariablesResponse(t) + checkChildren(t, m1part1, "m1", 33) + + client.IndexedVariablesRequest(ref, 33, 33) + m1part2 := client.ExpectVariablesResponse(t) + checkChildren(t, m1part2, "m1", 33) + + if len(m1part1.Body.Variables)+len(m1part2.Body.Variables) == len(m1.Body.Variables) { + for i, got := range m1part1.Body.Variables { + want := m1.Body.Variables[i] + if got.Name != want.Name || got.Value != want.Value { + t.Errorf("got %#v, want Name=%q Value=%q", got, want.Name, want.Value) + } + } + for i, got := range m1part2.Body.Variables { + want := m1.Body.Variables[i+len(m1part1.Body.Variables)] + if got.Name != want.Name || got.Value != want.Value { + t.Errorf("got %#v, want Name=%q Value=%q", got, want.Name, want.Value) + } + } + } + client.NamedVariablesRequest(ref) + named := client.ExpectVariablesResponse(t) + checkChildren(t, named, "m1", 1) + checkVarExact(t, named, 0, "len()", "len(m1)", "66", "int", noChildren) + } - client.VariablesRequest(1000) // Arguments - client.ExpectVariablesResponse(t) - client.VariablesRequest(1001) // Locals - client.ExpectVariablesResponse(t) -} + // Struct partially missing based on LoadConfig.MaxStructFields + ref = checkVarExact(t, locals, -1, "sd", "sd", "(loaded 5/6) main.D {u1: 0, u2: 0, u3: 0, u4: 0, u5: 0,...+1 more}", "main.D", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + sd := client.ExpectVariablesResponse(t) + checkChildren(t, sd, "sd", 5) + } -// onBreakpoint specifies what the test harness should simulate at -// a stopped breakpoint. First execute() is to be called to test + // Fully missing struct auto-loaded when reaching LoadConfig.MaxVariableRecurse (also tests evaluateName corner case) + ref = checkVarRegex(t, locals, -1, "c1", "c1", `main\.cstruct {pb: \*main\.bstruct {a: \(\*main\.astruct\)\(0x[0-9a-f]+\)}, sa: []\*main\.astruct len: 3, cap: 3, [\*\(\*main\.astruct\)\(0x[0-9a-f]+\),\*\(\*main\.astruct\)\(0x[0-9a-f]+\),\*\(\*main.astruct\)\(0x[0-9a-f]+\)]}`, `main\.cstruct`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + c1 := client.ExpectVariablesResponse(t) + checkChildren(t, c1, "c1", 2) + ref = checkVarRegex(t, c1, 1, "sa", `c1\.sa`, `\[\]\*main\.astruct len: 3, cap: 3, \[\*\(\*main\.astruct\)\(0x[0-9a-f]+\),\*\(\*main\.astruct\)\(0x[0-9a-f]+\),\*\(\*main\.astruct\)\(0x[0-9a-f]+\)\]`, `\[\]\*main\.astruct`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + c1sa := client.ExpectVariablesResponse(t) + checkChildren(t, c1sa, "c1.sa", 3) + ref = checkVarRegex(t, c1sa, 0, `\[0\]`, `c1\.sa\[0\]`, `\*\(\*main\.astruct\)\(0x[0-9a-f]+\)`, `\*main\.astruct`, hasChildren) + if ref > 0 { + // Auto-loading of fully missing struc children happens here + client.VariablesRequest(ref) + c1sa0 := client.ExpectVariablesResponse(t) + checkChildren(t, c1sa0, "c1.sa[0]", 1) + // TODO(polina): there should be children here once we support auto loading + checkVarExact(t, c1sa0, 0, "", "(*c1.sa[0])", "main.astruct {A: 1, B: 2}", "main.astruct", hasChildren) + } + } + } + + // Fully missing struct auto-loaded when hitting LoadConfig.MaxVariableRecurse (also tests evaluteName corner case) + ref = checkVarRegex(t, locals, -1, "aas", "aas", `\[\]main\.a len: 1, cap: 1, \[{aas: \[\]main\.a len: 1, cap: 1, \[\(\*main\.a\)\(0x[0-9a-f]+\)\]}\]`, `\[\]main\.a`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + aas := client.ExpectVariablesResponse(t) + checkChildren(t, aas, "aas", 1) + ref = checkVarRegex(t, aas, 0, "[0]", `aas\[0\]`, `main\.a {aas: \[\]main.a len: 1, cap: 1, \[\(\*main\.a\)\(0x[0-9a-f]+\)\]}`, `main\.a`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + aas0 := client.ExpectVariablesResponse(t) + checkChildren(t, aas0, "aas[0]", 1) + ref = checkVarRegex(t, aas0, 0, "aas", `aas\[0\]\.aas`, `\[\]main\.a len: 1, cap: 1, \[\(\*main\.a\)\(0x[0-9a-f]+\)\]`, `\[\]main\.a`, hasChildren) + if ref > 0 { + // Auto-loading of fully missing struct children happens here + client.VariablesRequest(ref) + aas0aas := client.ExpectVariablesResponse(t) + checkChildren(t, aas0aas, "aas[0].aas", 1) + // TODO(polina): there should be a child here once we support auto loading - test for "aas[0].aas[0].aas" + ref = checkVarRegex(t, aas0aas, 0, "[0]", `aas\[0\]\.aas\[0\]`, `main\.a {aas: \[\]main\.a len: 1, cap: 1, \[\(\*main\.a\)\(0x[0-9a-f]+\)\]}`, "main.a", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + aas0aas0 := client.ExpectVariablesResponse(t) + checkChildren(t, aas0aas, "aas[0].aas[0]", 1) + checkVarRegex(t, aas0aas0, 0, "aas", `aas\[0\]\.aas\[0\]\.aas`, `\[\]main\.a len: 1, cap: 1, \[\(\*main\.a\)\(0x[0-9a-f]+\)\]`, `\[\]main\.a`, hasChildren) + } + } + } + } + + // Fully missing map auto-loaded when hitting LoadConfig.MaxVariableRecurse (also tests evaluateName corner case) + ref = checkVarExact(t, locals, -1, "tm", "tm", "main.truncatedMap {v: []map[string]main.astruct len: 1, cap: 1, [[...]]}", "main.truncatedMap", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + tm := client.ExpectVariablesResponse(t) + checkChildren(t, tm, "tm", 1) + ref = checkVarExact(t, tm, 0, "v", "tm.v", "[]map[string]main.astruct len: 1, cap: 1, [[...]]", "[]map[string]main.astruct", hasChildren) + if ref > 0 { + // Auto-loading of fully missing map chidlren happens here, but they get trancated at MaxArrayValuess + client.VariablesRequest(ref) + tmV := client.ExpectVariablesResponse(t) + checkChildren(t, tmV, "tm.v", 1) + ref = checkVarRegex(t, tmV, 0, `\[0\]`, `tm\.v\[0\]`, `map\[string\]main\.astruct \[.+\.\.\.`, `map\[string\]main\.astruct`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + tmV0 := client.ExpectVariablesResponse(t) + checkChildren(t, tmV0, "tm.v[0]", 65) + } + } + } + + // Auto-loading works with call return variables as well + protest.MustSupportFunctionCalls(t, testBackend) + client.EvaluateRequest("call rettm()", 1000, "repl") + got := client.ExpectEvaluateResponse(t) + ref = checkEval(t, got, "main.truncatedMap {v: []map[string]main.astruct len: 1, cap: 1, [[...]]}", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + rv := client.ExpectVariablesResponse(t) + checkChildren(t, rv, "rv", 1) + ref = checkVarExact(t, rv, 0, "~r0", "", "main.truncatedMap {v: []map[string]main.astruct len: 1, cap: 1, [[...]]}", "main.truncatedMap", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + tm := client.ExpectVariablesResponse(t) + checkChildren(t, tm, "tm", 1) + ref = checkVarExact(t, tm, 0, "v", "", "[]map[string]main.astruct len: 1, cap: 1, [[...]]", "[]map[string]main.astruct", hasChildren) + if ref > 0 { + // Auto-loading of fully missing map chidlren happens here, but they get trancated at MaxArrayValuess + client.VariablesRequest(ref) + tmV := client.ExpectVariablesResponse(t) + checkChildren(t, tmV, "tm.v", 1) + // TODO(polina): this evaluate name is not usable - it should be empty + ref = checkVarRegex(t, tmV, 0, `\[0\]`, `\[0\]`, `map\[string\]main\.astruct \[.+\.\.\.`, `map\[string\]main\.astruct`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + tmV0 := client.ExpectVariablesResponse(t) + checkChildren(t, tmV0, "tm.v[0]", 65) + } + } + } + } + + // TODO(polina): need fully missing array/slice test case + + // Zero slices, structs and maps are not treated as fully missing + // See zsvar, zsslice,, emptyslice, emptymap, a0 + }, + disconnect: true, + }}) + }) + runTest(t, "testvariables", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Breakpoints are set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + execute: func() { + DefaultLoadConfig.FollowPointers = false + defer func() { DefaultLoadConfig.FollowPointers = true }() + + client.StackTraceRequest(1, 0, 0) + client.ExpectStackTraceResponse(t) + + var loadvars = func(frame int) { + client.ScopesRequest(frame) + scopes := client.ExpectScopesResponse(t) + localsRef := 0 + for _, s := range scopes.Body.Scopes { + if s.Name == "Locals" { + localsRef = s.VariablesReference + } + } + + client.VariablesRequest(localsRef) + locals := client.ExpectVariablesResponse(t) + + // Interface auto-loaded when hitting LoadConfig.MaxVariableRecurse=1 + + ref := checkVarRegex(t, locals, -1, "ni", "ni", `\[\]interface {} len: 1, cap: 1, \[\[\]interface {} len: 1, cap: 1, \[\*\(\*interface {}\)\(0x[0-9a-f]+\)\]\]`, `\[\]interface {}`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + ni := client.ExpectVariablesResponse(t) + ref = checkVarRegex(t, ni, 0, `\[0\]`, `ni\[0\]`, `interface \{\}\(\[\]interface \{\}\) \[\*\(\*interface \{\}\)\(0x[0-9a-f]+\)\]`, "interface {}", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + niI1 := client.ExpectVariablesResponse(t) + ref = checkVarRegex(t, niI1, 0, "data", `ni\[0\]\.\(data\)`, `\[\]interface {} len: 1, cap: 1, \[\*\(\*interface {}\)\(0x[0-9a-f]+\)`, `\[\]interface {}`, hasChildren) + if ref > 0 { + // Auto-loading happens here + client.VariablesRequest(ref) + niI1Data := client.ExpectVariablesResponse(t) + ref = checkVarExact(t, niI1Data, 0, "[0]", "ni[0].(data)[0]", "interface {}(int) 123", "interface {}", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + niI1DataI2 := client.ExpectVariablesResponse(t) + checkVarExact(t, niI1DataI2, 0, "data", "ni[0].(data)[0].(data)", "123", "int", noChildren) + } + } + } + } + + // Pointer values loaded even with LoadConfig.FollowPointers=false + checkVarExact(t, locals, -1, "a7", "a7", "*main.FooBar {Baz: 5, Bur: \"strum\"}", "*main.FooBar", hasChildren) + + // Auto-loading works on results of evaluate expressions as well + client.EvaluateRequest("a7", frame, "repl") + checkEval(t, client.ExpectEvaluateResponse(t), "*main.FooBar {Baz: 5, Bur: \"strum\"}", hasChildren) + + client.EvaluateRequest("&a7", frame, "repl") + pa7 := client.ExpectEvaluateResponse(t) + ref = checkEvalRegex(t, pa7, `\*\(\*main\.FooBar\)\(0x[0-9a-f]+\)`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + a7 := client.ExpectVariablesResponse(t) + checkVarExact(t, a7, 0, "a7", "(*(&a7))", "*main.FooBar {Baz: 5, Bur: \"strum\"}", "*main.FooBar", hasChildren) + } + } + + // Frame-independent loading expressions allow us to auto-load + // variables in any frame, not just topmost. + loadvars(1000 /*first topmost frame*/) + // step into another function + client.StepInRequest(1) + client.ExpectStepInResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.barfoo", 24) + loadvars(1001 /*second frame here is same as topmost above*/) + }, + disconnect: true, + }}) + }) +} + +// TestVariablesMetadata exposes test cases where variables contain metadata that +// can be accessed by requesting named variables. +func TestVariablesMetadata(t *testing.T) { + runTest(t, "testvariables2", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Breakpoints are set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + execute: func() {}, + disconnect: false, + }, { + execute: func() { + checkStop(t, client, 1, "main.main", 372) + + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + + checkNamedChildren := func(ref int, name, typeStr string, vals []string, evaluate bool) { + // byteslice, request named variables + client.NamedVariablesRequest(ref) + named := client.ExpectVariablesResponse(t) + checkChildren(t, named, name, 1) + checkVarExact(t, named, 0, "string()", "", "\"tèst\"", "string", false) + + client.VariablesRequest(ref) + all := client.ExpectVariablesResponse(t) + checkChildren(t, all, name, len(vals)+1) + checkVarExact(t, all, 0, "string()", "", "\"tèst\"", "string", false) + for i, v := range vals { + idx := fmt.Sprintf("[%d]", i) + evalName := fmt.Sprintf("%s[%d]", name, i) + if evaluate { + evalName = fmt.Sprintf("(%s)[%d]", name, i) + } + checkVarExact(t, all, i+1, idx, evalName, v, typeStr, false) + } + } + + bytes := []string{"116 = 0x74", "195 = 0xc3", "168 = 0xa8", "115 = 0x73", "116 = 0x74"} + runes := []string{"116", "232", "115", "116"} + + // byteslice + ref := checkVarExactIndexed(t, locals, -1, "byteslice", "byteslice", "[]uint8 len: 5, cap: 5, [116,195,168,115,116]", "[]uint8", true, 5, 1) + checkNamedChildren(ref, "byteslice", "uint8", bytes, false) + + client.EvaluateRequest("byteslice", 0, "") + got := client.ExpectEvaluateResponse(t) + ref = checkEvalIndexed(t, got, "[]uint8 len: 5, cap: 5, [116,195,168,115,116]", hasChildren, 5, 1) + checkNamedChildren(ref, "byteslice", "uint8", bytes, true) + + // runeslice + ref = checkVarExactIndexed(t, locals, -1, "runeslice", "runeslice", "[]int32 len: 4, cap: 4, [116,232,115,116]", "[]int32", true, 4, 1) + checkNamedChildren(ref, "runeslice", "int32", runes, false) + + client.EvaluateRequest("runeslice", 0, "repl") + got = client.ExpectEvaluateResponse(t) + ref = checkEvalIndexed(t, got, "[]int32 len: 4, cap: 4, [116,232,115,116]", hasChildren, 4, 1) + checkNamedChildren(ref, "runeslice", "int32", runes, true) + + // bytearray + ref = checkVarExactIndexed(t, locals, -1, "bytearray", "bytearray", "[5]uint8 [116,195,168,115,116]", "[5]uint8", true, 5, 1) + checkNamedChildren(ref, "bytearray", "uint8", bytes, false) + + client.EvaluateRequest("bytearray", 0, "hover") + got = client.ExpectEvaluateResponse(t) + ref = checkEvalIndexed(t, got, "[5]uint8 [116,195,168,115,116]", hasChildren, 5, 1) + checkNamedChildren(ref, "bytearray", "uint8", bytes, true) + + // runearray + ref = checkVarExactIndexed(t, locals, -1, "runearray", "runearray", "[4]int32 [116,232,115,116]", "[4]int32", true, 4, 1) + checkNamedChildren(ref, "runearray", "int32", runes, false) + + client.EvaluateRequest("runearray", 0, "watch") + got = client.ExpectEvaluateResponse(t) + ref = checkEvalIndexed(t, got, "[4]int32 [116,232,115,116]", hasChildren, 4, 1) + checkNamedChildren(ref, "runearray", "int32", runes, true) + + // string feature is not available with user-defined byte types + ref = checkVarExactIndexed(t, locals, -1, "bytestypeslice", "bytestypeslice", "[]main.Byte len: 5, cap: 5, [116,195,168,115,116]", "[]main.Byte", true, 5, 1) + client.NamedVariablesRequest(ref) + namedchildren := client.ExpectVariablesResponse(t) + checkChildren(t, namedchildren, "bytestypeslice as string", 0) + ref = checkVarExactIndexed(t, locals, -1, "bytetypearray", "bytetypearray", "[5]main.Byte [116,195,168,115,116]", "[5]main.Byte", true, 5, 1) + client.NamedVariablesRequest(ref) + namedchildren = client.ExpectVariablesResponse(t) + checkChildren(t, namedchildren, "bytetypearray as string", 0) + }, + disconnect: true, + }}) + }) +} + +// TestGlobalScopeAndVariables launches the program with showGlobalVariables +// arg set, executes to a breakpoint in the main package and tests that global +// package main variables got loaded. It then steps into a function +// in another package and tests that globals scope got updated to those vars. +func TestGlobalScopeAndVariables(t *testing.T) { + runTest(t, "consts", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "showGlobalVariables": true, "showRegisters": true, + }) + }, + // Breakpoints are set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + // Stop at line 36 + execute: func() { + if runtime.GOARCH == "386" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) { + client.StepInRequest(1) + client.ExpectStepInResponse(t) + client.ExpectStoppedEvent(t) + } + client.StackTraceRequest(1, 0, 20) + stack := client.ExpectStackTraceResponse(t) + checkStackFramesExact(t, stack, "main.main", 36, 1000, 3, 3) + + client.ScopesRequest(1000) + scopes := client.ExpectScopesResponse(t) + checkScope(t, scopes, 0, "Locals", localsScope) + checkScope(t, scopes, 1, "Globals (package main)", globalsScope) + checkScope(t, scopes, 2, "Registers", globalsScope+1) + + client.VariablesRequest(globalsScope) + client.ExpectVariablesResponse(t) + // The program has no user-defined globals. + // Depending on the Go version, there might + // be some runtime globals (e.g. main..inittask) + // so testing for the total number is too fragile. + + // Step into pkg.AnotherMethod() + client.StepInRequest(1) + client.ExpectStepInResponse(t) + client.ExpectStoppedEvent(t) + + client.StackTraceRequest(1, 0, 20) + stack = client.ExpectStackTraceResponse(t) + checkStackFramesExact(t, stack, "", 13, 1000, 4, 4) + + client.ScopesRequest(1000) + scopes = client.ExpectScopesResponse(t) + checkScope(t, scopes, 0, "Locals", localsScope) + checkScope(t, scopes, 1, "Globals (package github.com/go-delve/delve/_fixtures/internal/dir0/pkg)", globalsScope) + + client.VariablesRequest(globalsScope) + globals := client.ExpectVariablesResponse(t) + checkChildren(t, globals, "Globals", 1) + ref := checkVarExact(t, globals, 0, "SomeVar", "github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeVar", "github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType {X: 0}", "github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeType", hasChildren) + + if ref > 0 { + client.VariablesRequest(ref) + somevar := client.ExpectVariablesResponse(t) + checkChildren(t, somevar, "SomeVar", 1) + // TODO(polina): unlike main.p, this prefix won't work + checkVarExact(t, somevar, 0, "X", "github.com/go-delve/delve/_fixtures/internal/dir0/pkg.SomeVar.X", "0", "float64", noChildren) + } + }, + disconnect: false, + }}) + }) +} + +// TestRegisterScopeAndVariables launches the program with showRegisters +// arg set, executes to a breakpoint in the main package and tests that the registers +// got loaded. It then steps into a function in another package and tests that +// the registers were updated by checking PC. +func TestRegistersScopeAndVariables(t *testing.T) { + runTest(t, "consts", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "showRegisters": true, + }) + }, + // Breakpoints are set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + // Stop at line 36 + execute: func() { + if runtime.GOARCH == "386" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) { + client.StepInRequest(1) + client.ExpectStepInResponse(t) + client.ExpectStoppedEvent(t) + } + + client.StackTraceRequest(1, 0, 20) + stack := client.ExpectStackTraceResponse(t) + checkStackFramesExact(t, stack, "main.main", 36, 1000, 3, 3) + + client.ScopesRequest(1000) + scopes := client.ExpectScopesResponse(t) + checkScope(t, scopes, 0, "Locals", localsScope) + registersScope := localsScope + 1 + checkScope(t, scopes, 1, "Registers", registersScope) + + // Check that instructionPointer points to the InstructionPointerReference. + pc, err := getPC(t, client, 1) + if err != nil { + t.Error(pc) + } + + client.VariablesRequest(registersScope) + vr := client.ExpectVariablesResponse(t) + if len(vr.Body.Variables) == 0 { + t.Fatal("no registers returned") + } + idx := findPcReg(vr.Body.Variables) + if idx < 0 { + t.Fatalf("got %#v, want a reg with instruction pointer", vr.Body.Variables) + } + pcReg := vr.Body.Variables[idx] + gotPc, err := strconv.ParseUint(pcReg.Value, 0, 64) + if err != nil { + t.Error(err) + } + name := strings.TrimSpace(pcReg.Name) + if gotPc != pc || pcReg.EvaluateName != fmt.Sprintf("_%s", strings.ToUpper(name)) { + t.Errorf("got %#v,\nwant Name=%s Value=%#x EvaluateName=%q", pcReg, name, pc, fmt.Sprintf("_%s", strings.ToUpper(name))) + } + + // The program has no user-defined globals. + // Depending on the Go version, there might + // be some runtime globals (e.g. main..inittask) + // so testing for the total number is too fragile. + + // Step into pkg.AnotherMethod() + client.StepInRequest(1) + client.ExpectStepInResponse(t) + client.ExpectStoppedEvent(t) + + client.StackTraceRequest(1, 0, 20) + stack = client.ExpectStackTraceResponse(t) + checkStackFramesExact(t, stack, "", 13, 1000, 4, 4) + + client.ScopesRequest(1000) + scopes = client.ExpectScopesResponse(t) + checkScope(t, scopes, 0, "Locals", localsScope) + checkScope(t, scopes, 1, "Registers", registersScope) + + // Check that rip points to the InstructionPointerReference. + pc, err = getPC(t, client, 1) + if err != nil { + t.Error(pc) + } + client.VariablesRequest(registersScope) + vr = client.ExpectVariablesResponse(t) + if len(vr.Body.Variables) == 0 { + t.Fatal("no registers returned") + } + + idx = findPcReg(vr.Body.Variables) + if idx < 0 { + t.Fatalf("got %#v, want a reg with instruction pointer", vr.Body.Variables) + } + pcReg = vr.Body.Variables[idx] + gotPc, err = strconv.ParseUint(pcReg.Value, 0, 64) + if err != nil { + t.Error(err) + } + + if gotPc != pc || pcReg.EvaluateName != fmt.Sprintf("_%s", strings.ToUpper(name)) { + t.Errorf("got %#v,\nwant Name=%s Value=%#x EvaluateName=%q", pcReg, name, pc, fmt.Sprintf("_%s", strings.ToUpper(name))) + } + }, + disconnect: false, + }}) + }) +} + +func findPcReg(regs []dap.Variable) int { + for i, reg := range regs { + if isPcReg(reg) { + return i + } + } + return -1 +} + +func isPcReg(reg dap.Variable) bool { + pcRegNames := []string{"rip", "pc", "eip"} + for _, name := range pcRegNames { + if name == strings.TrimSpace(reg.Name) { + return true + } + } + return false +} + +// TestShadowedVariables executes to a breakpoint and checks the shadowed +// variable is named correctly. +func TestShadowedVariables(t *testing.T) { + runTest(t, "testshadow", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "showGlobalVariables": true, + }) + }, + // Breakpoints are set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + // Stop at line 13 + execute: func() { + client.StackTraceRequest(1, 0, 20) + stack := client.ExpectStackTraceResponse(t) + checkStackFramesExact(t, stack, "main.main", 13, 1000, 3, 3) + + client.ScopesRequest(1000) + scopes := client.ExpectScopesResponse(t) + checkScope(t, scopes, 0, "Locals", localsScope) + checkScope(t, scopes, 1, "Globals (package main)", globalsScope) + + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + + checkVarExact(t, locals, 0, "(a)", "a", "0", "int", !hasChildren) + checkVarExact(t, locals, 1, "a", "a", "1", "int", !hasChildren) + + // Check that the non-shadowed of "a" is returned from evaluate request. + validateEvaluateName(t, client, locals, 1) + }, + disconnect: false, + }}) + }) +} + +// Tests that 'stackTraceDepth' from LaunchRequest is parsed and passed to +// stacktrace requests handlers. +func TestLaunchRequestWithStackTraceDepth(t *testing.T) { + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + var stResp *dap.StackTraceResponse + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "stackTraceDepth": 1, + }) + }, + // Set breakpoints + fixture.Source, []int{8}, + []onBreakpoint{{ // Stop at line 8 + execute: func() { + client.StackTraceRequest(1, 0, 0) + stResp = client.ExpectStackTraceResponse(t) + checkStackFramesHasMore(t, stResp, "main.Increment", 8, 1000, 1 /*returned*/, 2 /*available*/) + }, + disconnect: false, + }}) + }) +} + +type Breakpoint struct { + line int + path string + verified bool + msgPrefix string +} + +func expectSetBreakpointsResponse(t *testing.T, client *daptest.Client, bps []Breakpoint) { + t.Helper() + checkSetBreakpointsResponse(t, bps, client.ExpectSetBreakpointsResponse(t)) +} + +func checkSetBreakpointsResponse(t *testing.T, bps []Breakpoint, got *dap.SetBreakpointsResponse) { + t.Helper() + checkBreakpoints(t, bps, got.Body.Breakpoints) +} + +func checkBreakpoints(t *testing.T, bps []Breakpoint, breakpoints []dap.Breakpoint) { + t.Helper() + if len(breakpoints) != len(bps) { + t.Errorf("got %#v,\nwant len(Breakpoints)=%d", breakpoints, len(bps)) + return + } + for i, bp := range breakpoints { + if bps[i].line < 0 && !bps[i].verified { + if bp.Verified != bps[i].verified || !stringContainsCaseInsensitive(bp.Message, bps[i].msgPrefix) { + t.Errorf("got breakpoints[%d] = %#v, \nwant %#v", i, bp, bps[i]) + } + continue + } + if bp.Line != bps[i].line || bp.Verified != bps[i].verified || bp.Source.Path != bps[i].path || + !strings.HasPrefix(bp.Message, bps[i].msgPrefix) { + t.Errorf("got breakpoints[%d] = %#v, \nwant %#v", i, bp, bps[i]) + } + } +} + +// TestSetBreakpoint executes to a breakpoint and tests different +// configurations of setBreakpoint requests. +func TestSetBreakpoint(t *testing.T) { + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{16}, // b main.main + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 16) + + // Set two breakpoints at the next two lines in main + client.SetBreakpointsRequest(fixture.Source, []int{17, 18}) + expectSetBreakpointsResponse(t, client, []Breakpoint{{17, fixture.Source, true, ""}, {18, fixture.Source, true, ""}}) + + // Clear 17, reset 18 + client.SetBreakpointsRequest(fixture.Source, []int{18}) + expectSetBreakpointsResponse(t, client, []Breakpoint{{18, fixture.Source, true, ""}}) + + // Skip 17, continue to 18 + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.main", 18) + + // Set another breakpoint inside the loop in loop(), twice to trigger error + client.SetBreakpointsRequest(fixture.Source, []int{8, 8}) + expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}, {-1, "", false, "breakpoint already exists"}}) + + // Continue into the loop + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + checkVarExact(t, locals, 0, "i", "i", "0", "int", noChildren) // i == 0 + + // Edit the breakpoint to add a condition + client.SetBreakpointsRequestWithArgs(fixture.Source, []int{8}, map[int]string{8: "i == 3"}, nil, nil) + expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}}) + + // Continue until condition is hit + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + client.VariablesRequest(localsScope) + locals = client.ExpectVariablesResponse(t) + checkVarExact(t, locals, 0, "i", "i", "3", "int", noChildren) // i == 3 + + // Edit the breakpoint to remove a condition + client.SetBreakpointsRequestWithArgs(fixture.Source, []int{8}, map[int]string{8: ""}, nil, nil) + expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}}) + + // Continue for one more loop iteration + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + client.VariablesRequest(localsScope) + locals = client.ExpectVariablesResponse(t) + checkVarExact(t, locals, 0, "i", "i", "4", "int", noChildren) // i == 4 + + // Set at a line without a statement + client.SetBreakpointsRequest(fixture.Source, []int{1000}) + expectSetBreakpointsResponse(t, client, []Breakpoint{{-1, "", false, "could not find statement"}}) // all cleared, none set + }, + // The program has an infinite loop, so we must kill it by disconnecting. + disconnect: true, + }}) + }) +} + +// TestSetInstructionBreakpoint executes to a breakpoint and tests different +// configurations of setInstructionBreakpoint requests. +func TestSetInstructionBreakpoint(t *testing.T) { + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{16}, // b main.main + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 16) + + // Set two breakpoints in the loop + client.SetBreakpointsRequest(fixture.Source, []int{8, 9}) + expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}, {9, fixture.Source, true, ""}}) + + // Continue to the two breakpoints and get the instructionPointerReference. + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + + client.StackTraceRequest(1, 0, 1) + st := client.ExpectStackTraceResponse(t) + if len(st.Body.StackFrames) < 1 { + t.Fatalf("\ngot %#v\nwant len(stackframes) => 1", st) + } + pc8 := st.Body.StackFrames[0].InstructionPointerReference + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 9) + + client.StackTraceRequest(1, 0, 1) + st = client.ExpectStackTraceResponse(t) + if len(st.Body.StackFrames) < 1 { + t.Fatalf("\ngot %#v\nwant len(stackframes) => 1", st) + } + pc9 := st.Body.StackFrames[0].InstructionPointerReference + + // Clear the source breakpoints. + // TODO(suzmue): there is an existing issue that breakpoints with identical locations + // from different setBreakpoints, setFunctionBreakpoints, setInstructionBreakpoints + // requests will prevent subsequent ones from being set. + client.SetBreakpointsRequest(fixture.Source, []int{}) + expectSetBreakpointsResponse(t, client, []Breakpoint{}) + + // Set the breakpoints using the instruction pointer references. + client.SetInstructionBreakpointsRequest([]dap.InstructionBreakpoint{{InstructionReference: pc8}, {InstructionReference: pc9}}) + bps := client.ExpectSetInstructionBreakpointsResponse(t).Body.Breakpoints + checkBreakpoints(t, []Breakpoint{{line: 8, path: fixture.Source, verified: true}, {line: 9, path: fixture.Source, verified: true}}, bps) + + // Continue to the two breakpoints and get the instructionPointerReference. + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 9) + + // Remove the breakpoint on line 8 and continue. + client.SetInstructionBreakpointsRequest([]dap.InstructionBreakpoint{{InstructionReference: pc9}}) + bps = client.ExpectSetInstructionBreakpointsResponse(t).Body.Breakpoints + checkBreakpoints(t, []Breakpoint{{line: 9, path: fixture.Source, verified: true}}, bps) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 9) + + // Set two breakpoints and expect an error on the second one. + client.SetInstructionBreakpointsRequest([]dap.InstructionBreakpoint{{InstructionReference: pc8}, {InstructionReference: pc8}}) + bps = client.ExpectSetInstructionBreakpointsResponse(t).Body.Breakpoints + checkBreakpoints(t, []Breakpoint{{line: 8, path: fixture.Source, verified: true}, {line: -1, path: "", verified: false, msgPrefix: "breakpoint already exists"}}, bps) + + // Add a condition + client.SetInstructionBreakpointsRequest([]dap.InstructionBreakpoint{{InstructionReference: pc8, Condition: "i == 100"}}) + bps = client.ExpectSetInstructionBreakpointsResponse(t).Body.Breakpoints + checkBreakpoints(t, []Breakpoint{{line: 8, path: fixture.Source, verified: true}}, bps) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + checkVarExact(t, locals, 0, "i", "i", "100", "int", noChildren) // i == 100 + }, + // The program has an infinite loop, so we must kill it by disconnecting. + disconnect: true, + }}) + }) +} + +func TestPauseAtStop(t *testing.T) { + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{16}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 16) + + client.SetBreakpointsRequest(fixture.Source, []int{6, 8}) + expectSetBreakpointsResponse(t, client, []Breakpoint{{6, fixture.Source, true, ""}, {8, fixture.Source, true, ""}}) + + // Send a pause request while stopped on a cleared breakpoint. + client.PauseRequest(1) + client.ExpectPauseResponse(t) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 6) + + // Send a pause request while stopped on a breakpoint. + client.PauseRequest(1) + client.ExpectPauseResponse(t) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "breakpoint" { + t.Errorf("got %#v, expected breakpoint", se) + } + checkStop(t, client, 1, "main.loop", 8) + + // Send a pause request while stopped after stepping. + client.NextRequest(1) + client.ExpectNextResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 9) + + client.PauseRequest(1) + client.ExpectPauseResponse(t) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + }, + // The program has an infinite loop, so we must kill it by disconnecting. + disconnect: true, + }}) + }) +} + +func checkHitBreakpointIds(t *testing.T, se *dap.StoppedEvent, reason string, id int) { + if se.Body.ThreadId != 1 || se.Body.Reason != reason || len(se.Body.HitBreakpointIds) != 1 || se.Body.HitBreakpointIds[0] != id { + t.Errorf("got %#v, want Reason=%q, ThreadId=1, HitBreakpointIds=[]int{%d}", se, reason, id) + } +} + +// TestHitBreakpointIds executes to a breakpoint and tests that +// the breakpoint ids in the stopped event are correct. +func TestHitBreakpointIds(t *testing.T) { + runTest(t, "locationsprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{30}, // b main.main + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 30) + + // Set two source breakpoints and two function breakpoints. + client.SetBreakpointsRequest(fixture.Source, []int{23, 33}) + sourceBps := client.ExpectSetBreakpointsResponse(t).Body.Breakpoints + checkBreakpoints(t, []Breakpoint{{line: 23, path: fixture.Source, verified: true}, {line: 33, path: fixture.Source, verified: true}}, sourceBps) + + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "anotherFunction"}, + {Name: "anotherFunction:1"}, + }) + functionBps := client.ExpectSetFunctionBreakpointsResponse(t).Body.Breakpoints + checkBreakpoints(t, []Breakpoint{{line: 26, path: fixture.Source, verified: true}, {line: 27, path: fixture.Source, verified: true}}, functionBps) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se := client.ExpectStoppedEvent(t) + checkHitBreakpointIds(t, se, "breakpoint", sourceBps[1].Id) + checkStop(t, client, 1, "main.main", 33) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se = client.ExpectStoppedEvent(t) + checkHitBreakpointIds(t, se, "breakpoint", sourceBps[0].Id) + checkStop(t, client, 1, "main.(*SomeType).SomeFunction", 23) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se = client.ExpectStoppedEvent(t) + checkHitBreakpointIds(t, se, "function breakpoint", functionBps[0].Id) + checkStop(t, client, 1, "main.anotherFunction", 26) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se = client.ExpectStoppedEvent(t) + + checkHitBreakpointIds(t, se, "function breakpoint", functionBps[1].Id) + + checkStop(t, client, 1, "main.anotherFunction", 27) + }, + disconnect: true, + }}) + }) +} + +func stringContainsCaseInsensitive(got, want string) bool { + return strings.Contains(strings.ToLower(got), strings.ToLower(want)) +} + +// TestSetFunctionBreakpoints is inspired by service/test.TestClientServer_FindLocations. +func TestSetFunctionBreakpoints(t *testing.T) { + runTest(t, "locationsprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{30}, // b main.main + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 30) + + type Breakpoint struct { + line int + sourceName string + verified bool + errMsg string + } + expectSetFunctionBreakpointsResponse := func(bps []Breakpoint) { + t.Helper() + got := client.ExpectSetFunctionBreakpointsResponse(t) + if len(got.Body.Breakpoints) != len(bps) { + t.Errorf("got %#v,\nwant len(Breakpoints)=%d", got, len(bps)) + return + } + for i, bp := range got.Body.Breakpoints { + if bps[i].line < 0 && !bps[i].verified { + if bp.Verified != bps[i].verified || !stringContainsCaseInsensitive(bp.Message, bps[i].errMsg) { + t.Errorf("got breakpoints[%d] = %#v, \nwant %#v", i, bp, bps[i]) + } + continue + } + // Some function breakpoints may be in packages that have been imported and we do not control, so + // we do not always want to check breakpoint lines. + if (bps[i].line >= 0 && bp.Line != bps[i].line) || bp.Verified != bps[i].verified || bp.Source.Name != bps[i].sourceName { + t.Errorf("got breakpoints[%d] = %#v, \nwant %#v", i, bp, bps[i]) + } + } + } + + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "anotherFunction"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{26, filepath.Base(fixture.Source), true, ""}}) + + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "main.anotherFunction"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{26, filepath.Base(fixture.Source), true, ""}}) + + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "SomeType.String"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}}) + + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "(*SomeType).String"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}}) + + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "main.SomeType.String"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}}) + + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "main.(*SomeType).String"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}}) + + // Test line offsets + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "main.anotherFunction:1"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{27, filepath.Base(fixture.Source), true, ""}}) + + // Test function names in imported package. + // Issue #275 + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "io/ioutil.ReadFile"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, "ioutil.go", true, ""}}) + + // Issue #296 + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "/io/ioutil.ReadFile"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, "ioutil.go", true, ""}}) + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "ioutil.ReadFile"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, "ioutil.go", true, ""}}) + + // Function Breakpoint name also accepts breakpoints that are specified as file:line. + // TODO(suzmue): We could return an error, but it probably is not necessary since breakpoints, + // and function breakpoints come in with different requests. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: fmt.Sprintf("%s:14", fixture.Source)}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}}) + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: fmt.Sprintf("%s:14", filepath.Base(fixture.Source))}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}}) + + // Expect error for ambiguous function name. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "String"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, "", false, "Location \"String\" ambiguous"}}) + + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "main.String"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, "", false, "Location \"main.String\" ambiguous"}}) + + // Expect error for function that does not exist. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "fakeFunction"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, "", false, "location \"fakeFunction\" not found"}}) + + // Expect error for negative line number. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "main.anotherFunction:-1"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, "", false, "line offset negative or not a number"}}) + + // Expect error when function name is regex. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: `/^.*String.*$/`}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, "", false, "breakpoint name \"/^.*String.*$/\" could not be parsed as a function"}}) + + // Expect error when function name is an offset. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "+1"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, filepath.Base(fixture.Source), false, "breakpoint name \"+1\" could not be parsed as a function"}}) + + // Expect error when function name is a line number. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "14"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, filepath.Base(fixture.Source), false, "breakpoint name \"14\" could not be parsed as a function"}}) + + // Expect error when function name is an address. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "*b"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, filepath.Base(fixture.Source), false, "breakpoint name \"*b\" could not be parsed as a function"}}) + + // Expect error when function name is a relative path. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: fmt.Sprintf(".%s%s:14", string(filepath.Separator), filepath.Base(fixture.Source))}, + }) + // This relative path could also be caught by the parser, so we should not match the error message. + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, filepath.Base(fixture.Source), false, ""}}) + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: fmt.Sprintf("..%s%s:14", string(filepath.Separator), filepath.Base(fixture.Source))}, + }) + // This relative path could also be caught by the parser, so we should not match the error message. + expectSetFunctionBreakpointsResponse([]Breakpoint{{-1, filepath.Base(fixture.Source), false, ""}}) + + // Test multiple function breakpoints. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "SomeType.String"}, {Name: "anotherFunction"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}, {26, filepath.Base(fixture.Source), true, ""}}) + + // Test multiple breakpoints to the same location. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "SomeType.String"}, {Name: "(*SomeType).String"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}, {-1, "", false, "breakpoint exists"}}) + + // Set two breakpoints at SomeType.String and SomeType.SomeFunction. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "SomeType.String"}, {Name: "SomeType.SomeFunction"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{14, filepath.Base(fixture.Source), true, ""}, {22, filepath.Base(fixture.Source), true, ""}}) + + // Clear SomeType.String, reset SomeType.SomeFunction (SomeType.String is called before SomeType.SomeFunction). + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "SomeType.SomeFunction"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{22, filepath.Base(fixture.Source), true, ""}}) + + // Expect the next breakpoint to be at SomeType.SomeFunction. + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + if se := client.ExpectStoppedEvent(t); se.Body.Reason != "function breakpoint" || se.Body.ThreadId != 1 { + t.Errorf("got %#v, want Reason=\"function breakpoint\", ThreadId=1", se) + } + checkStop(t, client, 1, "main.(*SomeType).SomeFunction", 22) + + // Set a breakpoint at the next line in the program. + client.SetBreakpointsRequest(fixture.Source, []int{23}) + got := client.ExpectSetBreakpointsResponse(t) + if len(got.Body.Breakpoints) != 1 { + t.Errorf("got %#v,\nwant len(Breakpoints)=%d", got, 1) + return + } + bp := got.Body.Breakpoints[0] + if bp.Line != 23 || bp.Verified != true || bp.Source.Path != fixture.Source { + t.Errorf("got breakpoints[0] = %#v, \nwant Line=23 Verified=true Source.Path=%q", bp, fixture.Source) + } + + // Set a function breakpoint, this should not clear the breakpoint that was set in the previous setBreakpoints request. + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{ + {Name: "anotherFunction"}, + }) + expectSetFunctionBreakpointsResponse([]Breakpoint{{26, filepath.Base(fixture.Source), true, ""}}) + + // Expect the next breakpoint to be at line 23. + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + if se := client.ExpectStoppedEvent(t); se.Body.Reason != "breakpoint" || se.Body.ThreadId != 1 { + t.Errorf("got %#v, want Reason=\"breakpoint\", ThreadId=1", se) + } + checkStop(t, client, 1, "main.(*SomeType).SomeFunction", 23) + + // Set a breakpoint, this should not clear the breakpoint that was set in the previous setFunctionBreakpoints request. + client.SetBreakpointsRequest(fixture.Source, []int{37}) + got = client.ExpectSetBreakpointsResponse(t) + if len(got.Body.Breakpoints) != 1 { + t.Errorf("got %#v,\nwant len(Breakpoints)=%d", got, 1) + return + } + bp = got.Body.Breakpoints[0] + if bp.Line != 37 || bp.Verified != true || bp.Source.Path != fixture.Source { + t.Errorf("got breakpoints[0] = %#v, \nwant Line=23 Verified=true Source.Path=%q", bp, fixture.Source) + } + + // Expect the next breakpoint to be at line anotherFunction. + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + if se := client.ExpectStoppedEvent(t); se.Body.Reason != "function breakpoint" || se.Body.ThreadId != 1 { + t.Errorf("got %#v, want Reason=\"function breakpoint\", ThreadId=1", se) + } + checkStop(t, client, 1, "main.anotherFunction", 26) + + }, + disconnect: true, + }}) + }) +} + +// TestLogPoints executes to a breakpoint and tests that log points +// send OutputEvents and do not halt program execution. +func TestLogPoints(t *testing.T) { + runTest(t, "callme", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{23}, + []onBreakpoint{{ + // Stop at line 23 + execute: func() { + checkStop(t, client, 1, "main.main", 23) + bps := []int{6, 25, 27, 16} + logMessages := map[int]string{6: "{i*2}: in callme!", 16: "in callme2!"} + client.SetBreakpointsRequestWithArgs(fixture.Source, bps, nil, nil, logMessages) + client.ExpectSetBreakpointsResponse(t) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + for i := 0; i < 5; i++ { + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "breakpoint" || se.Body.ThreadId != 1 { + t.Errorf("got stopped event = %#v, \nwant Reason=\"breakpoint\" ThreadId=1", se) + } + checkStop(t, client, 1, "main.main", 25) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + checkLogMessage(t, client.ExpectOutputEvent(t), 1, fmt.Sprintf("%d: in callme!", i*2), fixture.Source, 6) + } + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "breakpoint" || se.Body.ThreadId != 1 { + t.Errorf("got stopped event = %#v, \nwant Reason=\"breakpoint\" ThreadId=1", se) + } + checkStop(t, client, 1, "main.main", 27) + + client.NextRequest(1) + client.ExpectNextResponse(t) + + checkLogMessage(t, client.ExpectOutputEvent(t), 1, "in callme2!", fixture.Source, 16) + + se = client.ExpectStoppedEvent(t) + if se.Body.Reason != "step" || se.Body.ThreadId != 1 { + t.Errorf("got stopped event = %#v, \nwant Reason=\"step\" ThreadId=1", se) + } + checkStop(t, client, 1, "main.main", 28) + }, + disconnect: true, + }}) + }) +} + +func checkLogMessage(t *testing.T, oe *dap.OutputEvent, goid int, text, path string, line int) { + t.Helper() + prefix := "> [Go " + if goid >= 0 { + prefix += strconv.Itoa(goid) + "]" + } + if oe.Body.Category != "stdout" || !strings.HasPrefix(oe.Body.Output, prefix) || !strings.HasSuffix(oe.Body.Output, text+"\n") { + t.Errorf("got output event = %#v, \nwant Category=\"stdout\" Output=\"%s: %s\\n\"", oe, prefix, text) + } + if oe.Body.Line != line || oe.Body.Source.Path != path { + t.Errorf("got output event = %#v, \nwant Line=%d Source.Path=%s", oe, line, path) + } +} + +// TestHaltPreventsAutoResume tests that a pause request issued while processing +// log messages will result in a real stop. +func TestHaltPreventsAutoResume(t *testing.T) { + runTest(t, "callme", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{23}, + []onBreakpoint{{ + execute: func() { + savedResumeOnce := resumeOnceAndCheckStop + defer func() { + resumeOnceAndCheckStop = savedResumeOnce + }() + checkStop(t, client, 1, "main.main", 23) + bps := []int{6, 25} + logMessages := map[int]string{6: "in callme!"} + client.SetBreakpointsRequestWithArgs(fixture.Source, bps, nil, nil, logMessages) + client.ExpectSetBreakpointsResponse(t) + + for i := 0; i < 5; i++ { + // Reset the handler to the default behavior. + resumeOnceAndCheckStop = savedResumeOnce + + // Expect a pause request while stopped not to interrupt continue. + client.PauseRequest(1) + client.ExpectPauseResponse(t) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "breakpoint" || se.Body.ThreadId != 1 { + t.Errorf("got stopped event = %#v, \nwant Reason=\"breakpoint\" ThreadId=1", se) + } + checkStop(t, client, 1, "main.main", 25) + + pauseDoneChan := make(chan struct{}, 1) + outputDoneChan := make(chan struct{}, 1) + // Send a halt request when trying to resume the program after being + // interrupted. This should allow the log message to be processed, + // but keep the process from continuing beyond the line. + resumeOnceAndCheckStop = func(s *Session, command string, allowNextStateChange chan struct{}) (*api.DebuggerState, error) { + // This should trigger after the log message is sent, but before + // execution is resumed. + if command == api.DirectionCongruentContinue { + go func() { + <-outputDoneChan + defer close(pauseDoneChan) + client.PauseRequest(1) + client.ExpectPauseResponse(t) + }() + // Wait for the pause to be complete. + <-pauseDoneChan + } + return s.resumeOnceAndCheckStop(command, allowNextStateChange) + } + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + checkLogMessage(t, client.ExpectOutputEvent(t), 1, "in callme!", fixture.Source, 6) + // Signal that the output event has been received. + close(outputDoneChan) + // Wait for the pause to be complete. + <-pauseDoneChan + se = client.ExpectStoppedEvent(t) + if se.Body.Reason != "pause" { + t.Errorf("got stopped event = %#v, \nwant Reason=\"pause\"", se) + } + checkStop(t, client, 1, "main.callme", 6) + } + }, + disconnect: true, + }}) + }) +} + +// TestConcurrentBreakpointsLogPoints tests that a breakpoint set in the main +// goroutine is hit the correct number of times and log points set in the +// children goroutines produce the correct number of output events. +func TestConcurrentBreakpointsLogPoints(t *testing.T) { + if runtime.GOOS == "freebsd" { + t.SkipNow() + } + tests := []struct { + name string + fixture string + start int + breakpoints []int + }{ + { + name: "source breakpoints", + fixture: "goroutinestackprog", + breakpoints: []int{23}, + }, + { + name: "hardcoded breakpoint", + fixture: "goroutinebreak", + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + runTest(t, tt.fixture, func(client *daptest.Client, fixture protest.Fixture) { + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + client.ExpectInitializedEvent(t) + client.ExpectLaunchResponse(t) + + bps := append([]int{8}, tt.breakpoints...) + logMessages := map[int]string{8: "hello"} + client.SetBreakpointsRequestWithArgs(fixture.Source, bps, nil, nil, logMessages) + client.ExpectSetBreakpointsResponse(t) + + client.ConfigurationDoneRequest() + client.ExpectConfigurationDoneResponse(t) + + // There may be up to 1 breakpoint and any number of log points that are + // hit concurrently. We should get a stopped event everytime the breakpoint + // is hit and an output event for each log point hit. + var oeCount, seCount int + for oeCount < 10 || seCount < 10 { + switch m := client.ExpectMessage(t).(type) { + case *dap.StoppedEvent: + if m.Body.Reason != "breakpoint" || !m.Body.AllThreadsStopped || m.Body.ThreadId != 1 { + t.Errorf("\ngot %#v\nwant Reason='breakpoint' AllThreadsStopped=true ThreadId=1", m) + } + seCount++ + client.ContinueRequest(1) + case *dap.OutputEvent: + checkLogMessage(t, m, -1, "hello", fixture.Source, 8) + oeCount++ + case *dap.ContinueResponse: + case *dap.TerminatedEvent: + t.Fatalf("\nexpected 10 output events and 10 stopped events, got %d output events and %d stopped events", oeCount, seCount) + default: + t.Fatalf("Unexpected message type: expect StoppedEvent, OutputEvent, or ContinueResponse, got %#v", m) + } + } + // TODO(suzmue): The dap server may identify some false + // positives for hard coded breakpoints, so there may still + // be more stopped events. + client.DisconnectRequestWithKillOption(true) + }) + }) + } +} + +func TestSetBreakpointWhileRunning(t *testing.T) { + runTest(t, "integrationprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{16}, + []onBreakpoint{{ + execute: func() { + // The program loops 3 times over lines 14-15-8-9-10-16 + checkStop(t, client, 1, "main.main", 16) // Line that sleeps for 1 second + + // We can set breakpoints while nexting + client.NextRequest(1) + client.ExpectNextResponse(t) + client.SetBreakpointsRequest(fixture.Source, []int{15}) // [16,] => [15,] + checkSetBreakpointsResponse(t, []Breakpoint{{15, fixture.Source, true, ""}}, client.ExpectSetBreakpointsResponse(t)) + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "step" || !se.Body.AllThreadsStopped || se.Body.ThreadId != 1 { + t.Errorf("\ngot %#v\nwant Reason='step' AllThreadsStopped=true ThreadId=1", se) + } + checkStop(t, client, 1, "main.main", 14) + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se = client.ExpectStoppedEvent(t) + if se.Body.Reason != "breakpoint" || !se.Body.AllThreadsStopped || se.Body.ThreadId != 1 { + t.Errorf("\ngot %#v\nwant Reason='breakpoint' AllThreadsStopped=true ThreadId=1", se) + } + checkStop(t, client, 1, "main.main", 15) + + // We can set breakpoints while continuing + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.SetBreakpointsRequest(fixture.Source, []int{9}) // [15,] => [9,] + checkSetBreakpointsResponse(t, []Breakpoint{{9, fixture.Source, true, ""}}, client.ExpectSetBreakpointsResponse(t)) + se = client.ExpectStoppedEvent(t) + if se.Body.Reason != "breakpoint" || !se.Body.AllThreadsStopped || se.Body.ThreadId != 1 { + t.Errorf("\ngot %#v\nwant Reason='breakpoint' AllThreadsStopped=true ThreadId=1", se) + } + checkStop(t, client, 1, "main.sayhi", 9) + + }, + disconnect: true, + }}) + }) +} + +func TestSetFunctionBreakpointWhileRunning(t *testing.T) { + runTest(t, "integrationprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{16}, + []onBreakpoint{{ + execute: func() { + // The program loops 3 times over lines 14-15-8-9-10-16 + checkStop(t, client, 1, "main.main", 16) // Line that sleeps for 1 second + + // We can set breakpoints while nexting + client.NextRequest(1) + client.ExpectNextResponse(t) + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{{Name: "main.sayhi"}}) // [16,] => [16, 8] + checkBreakpoints(t, []Breakpoint{{8, fixture.Source, true, ""}}, client.ExpectSetFunctionBreakpointsResponse(t).Body.Breakpoints) + client.SetBreakpointsRequest(fixture.Source, []int{}) // [16,8] => [8] + expectSetBreakpointsResponse(t, client, []Breakpoint{}) + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "step" || !se.Body.AllThreadsStopped || se.Body.ThreadId != 1 { + t.Errorf("\ngot %#v\nwant Reason='step' AllThreadsStopped=true ThreadId=1", se) + } + checkStop(t, client, 1, "main.main", 14) + + // Make sure we can hit the breakpoints. + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se = client.ExpectStoppedEvent(t) + if se.Body.Reason != "function breakpoint" || !se.Body.AllThreadsStopped || se.Body.ThreadId != 1 { + t.Errorf("\ngot %#v\nwant Reason='function breakpoint' AllThreadsStopped=true ThreadId=1", se) + } + checkStop(t, client, 1, "main.sayhi", 8) + + // We can set breakpoints while continuing + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.SetFunctionBreakpointsRequest([]dap.FunctionBreakpoint{}) // [8,] => [] + checkBreakpoints(t, []Breakpoint{}, client.ExpectSetFunctionBreakpointsResponse(t).Body.Breakpoints) + client.SetBreakpointsRequest(fixture.Source, []int{16}) // [] => [16] + expectSetBreakpointsResponse(t, client, []Breakpoint{{16, fixture.Source, true, ""}}) + se = client.ExpectStoppedEvent(t) + if se.Body.Reason != "breakpoint" || !se.Body.AllThreadsStopped || se.Body.ThreadId != 1 { + t.Errorf("\ngot %#v\nwant Reason='breakpoint' AllThreadsStopped=true ThreadId=1", se) + } + checkStop(t, client, 1, "main.main", 16) + + }, + disconnect: true, + }}) + }) +} + +func TestHitConditionBreakpoints(t *testing.T) { + runTest(t, "break", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{4}, + []onBreakpoint{{ + execute: func() { + client.SetBreakpointsRequestWithArgs(fixture.Source, []int{7}, nil, map[int]string{7: "4"}, nil) + expectSetBreakpointsResponse(t, client, []Breakpoint{{7, fixture.Source, true, ""}}) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.main", 7) + + // Check that we are stopped at the correct value of i. + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + checkVarExact(t, locals, 0, "i", "i", "4", "int", noChildren) + + // Change the hit condition. + client.SetBreakpointsRequestWithArgs(fixture.Source, []int{7}, nil, map[int]string{7: "% 2"}, nil) + expectSetBreakpointsResponse(t, client, []Breakpoint{{7, fixture.Source, true, ""}}) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.main", 7) + + // Check that we are stopped at the correct value of i. + client.VariablesRequest(localsScope) + locals = client.ExpectVariablesResponse(t) + checkVarExact(t, locals, 0, "i", "i", "6", "int", noChildren) + + // Expect an error if an assignment is passed. + client.SetBreakpointsRequestWithArgs(fixture.Source, []int{7}, nil, map[int]string{7: "= 2"}, nil) + expectSetBreakpointsResponse(t, client, []Breakpoint{{-1, "", false, ""}}) + + // Change the hit condition. + client.SetBreakpointsRequestWithArgs(fixture.Source, []int{7}, nil, map[int]string{7: "< 8"}, nil) + expectSetBreakpointsResponse(t, client, []Breakpoint{{7, fixture.Source, true, ""}}) + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.main", 7) + + // Check that we are stopped at the correct value of i. + client.VariablesRequest(localsScope) + locals = client.ExpectVariablesResponse(t) + checkVarExact(t, locals, 0, "i", "i", "7", "int", noChildren) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + client.ExpectTerminatedEvent(t) + }, + disconnect: false, + }}) + }) +} + +// TestLaunchSubstitutePath sets a breakpoint using a path +// that does not exist and expects the substitutePath attribute +// in the launch configuration to take care of the mapping. +func TestLaunchSubstitutePath(t *testing.T) { + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + substitutePathTestHelper(t, fixture, client, "launch", map[string]interface{}{"mode": "exec", "program": fixture.Path}) + }) +} + +// TestAttachSubstitutePath sets a breakpoint using a path +// that does not exist and expects the substitutePath attribute +// in the launch configuration to take care of the mapping. +func TestAttachSubstitutePath(t *testing.T) { + if runtime.GOOS == "freebsd" { + t.SkipNow() + } + if runtime.GOOS == "windows" { + t.Skip("test skipped on windows, see https://delve.beta.teamcity.com/project/Delve_windows for details") + } + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + cmd := execFixture(t, fixture) + + substitutePathTestHelper(t, fixture, client, "attach", map[string]interface{}{"mode": "local", "processId": cmd.Process.Pid}) + }) +} + +func substitutePathTestHelper(t *testing.T, fixture protest.Fixture, client *daptest.Client, request string, launchAttachConfig map[string]interface{}) { + t.Helper() + nonexistentDir := filepath.Join(string(filepath.Separator), "path", "that", "does", "not", "exist") + if runtime.GOOS == "windows" { + nonexistentDir = "C:" + nonexistentDir + } + + launchAttachConfig["stopOnEntry"] = false + // The rules in 'substitutePath' will be applied as follows: + // - mapping paths from client to server: + // The first rule["from"] to match a prefix of 'path' will be applied: + // strings.Replace(path, rule["from"], rule["to"], 1) + // - mapping paths from server to client: + // The first rule["to"] to match a prefix of 'path' will be applied: + // strings.Replace(path, rule["to"], rule["from"], 1) + launchAttachConfig["substitutePath"] = []map[string]string{ + {"from": nonexistentDir, "to": filepath.Dir(fixture.Source)}, + // Since the path mappings are ordered, when converting from client path to + // server path, this mapping will not apply, because nonexistentDir appears in + // an earlier rule. + {"from": nonexistentDir, "to": "this_is_a_bad_path"}, + // Since the path mappings are ordered, when converting from server path to + // client path, this mapping will not apply, because filepath.Dir(fixture.Source) + // appears in an earlier rule. + {"from": "this_is_a_bad_path", "to": filepath.Dir(fixture.Source)}, + } + + runDebugSessionWithBPs(t, client, request, + func() { + switch request { + case "attach": + client.AttachRequest(launchAttachConfig) + case "launch": + client.LaunchRequestWithArgs(launchAttachConfig) + default: + t.Fatalf("invalid request: %s", request) + } + }, + // Set breakpoints + filepath.Join(nonexistentDir, "loopprog.go"), []int{8}, + []onBreakpoint{{ + + execute: func() { + checkStop(t, client, 1, "main.loop", 8) + }, + disconnect: true, + }}) +} + +// execFixture runs the binary fixture.Path and hooks up stdout and stderr +// to os.Stdout and os.Stderr. +func execFixture(t *testing.T, fixture protest.Fixture) *exec.Cmd { + t.Helper() + // TODO(polina): do I need to sanity check testBackend and runtime.GOOS? + cmd := exec.Command(fixture.Path) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + if err := cmd.Start(); err != nil { + t.Fatal(err) + } + return cmd +} + +// TestWorkingDir executes to a breakpoint and tests that the specified +// working directory is the one used to run the program. +func TestWorkingDir(t *testing.T) { + runTest(t, "workdir", func(client *daptest.Client, fixture protest.Fixture) { + wd := os.TempDir() + // For Darwin `os.TempDir()` returns `/tmp` which is symlink to `/private/tmp`. + if runtime.GOOS == "darwin" { + wd = "/private/tmp" + } + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", + "program": fixture.Path, + "stopOnEntry": false, + "cwd": wd, + }) + }, + // Set breakpoints + fixture.Source, []int{10}, // b main.main + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 10) + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + checkChildren(t, locals, "Locals", 2) + for i := range locals.Body.Variables { + switch locals.Body.Variables[i].Name { + case "pwd": + checkVarExact(t, locals, i, "pwd", "pwd", fmt.Sprintf("%q", wd), "string", noChildren) + case "err": + checkVarExact(t, locals, i, "err", "err", "error nil", "error", noChildren) + } + } + }, + disconnect: false, + }}) + }) +} + +// checkEval is a helper for verifying the values within an EvaluateResponse. +// value - the value of the evaluated expression +// hasRef - true if the evaluated expression should have children and therefore a non-0 variable reference +// ref - reference to retrieve children of this evaluated expression (0 if none) +func checkEval(t *testing.T, got *dap.EvaluateResponse, value string, hasRef bool) (ref int) { + t.Helper() + if got.Body.Result != value || (got.Body.VariablesReference > 0) != hasRef { + t.Errorf("\ngot %#v\nwant Result=%q hasRef=%t", got, value, hasRef) + } + return got.Body.VariablesReference +} + +// checkEvalIndexed is a helper for verifying the values within an EvaluateResponse. +// value - the value of the evaluated expression +// hasRef - true if the evaluated expression should have children and therefore a non-0 variable reference +// ref - reference to retrieve children of this evaluated expression (0 if none) +func checkEvalIndexed(t *testing.T, got *dap.EvaluateResponse, value string, hasRef bool, indexed, named int) (ref int) { + t.Helper() + if got.Body.Result != value || (got.Body.VariablesReference > 0) != hasRef || got.Body.IndexedVariables != indexed || got.Body.NamedVariables != named { + t.Errorf("\ngot %#v\nwant Result=%q hasRef=%t IndexedVariables=%d NamedVariables=%d", got, value, hasRef, indexed, named) + } + return got.Body.VariablesReference +} + +func checkEvalRegex(t *testing.T, got *dap.EvaluateResponse, valueRegex string, hasRef bool) (ref int) { + t.Helper() + matched, _ := regexp.MatchString(valueRegex, got.Body.Result) + if !matched || (got.Body.VariablesReference > 0) != hasRef { + t.Errorf("\ngot %#v\nwant Result=%q hasRef=%t", got, valueRegex, hasRef) + } + return got.Body.VariablesReference +} + +func TestEvaluateRequest(t *testing.T) { + runTest(t, "testvariables", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + fixture.Source, []int{}, // Breakpoint set in the program + []onBreakpoint{{ // Stop at first breakpoint + execute: func() { + checkStop(t, client, 1, "main.foobar", 66) + + // Variable lookup + client.EvaluateRequest("a2", 1000, "this context will be ignored") + got := client.ExpectEvaluateResponse(t) + checkEval(t, got, "6", noChildren) + + client.EvaluateRequest("a5", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + ref := checkEval(t, got, "[]int len: 5, cap: 5, [1,2,3,4,5]", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + a5 := client.ExpectVariablesResponse(t) + checkChildren(t, a5, "a5", 5) + checkVarExact(t, a5, 0, "[0]", "(a5)[0]", "1", "int", noChildren) + checkVarExact(t, a5, 4, "[4]", "(a5)[4]", "5", "int", noChildren) + validateEvaluateName(t, client, a5, 0) + validateEvaluateName(t, client, a5, 4) + } + + // Variable lookup that's not fully loaded + client.EvaluateRequest("ba", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEvalIndexed(t, got, "[]int len: 200, cap: 200, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...+136 more]", hasChildren, 200, 0) + + // All (binary and unary) on basic types except <-, ++ and -- + client.EvaluateRequest("1+1", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "2", noChildren) + + // Comparison operators on any type + client.EvaluateRequest("1<2", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "true", noChildren) + + // Type casts between numeric types + client.EvaluateRequest("int(2.3)", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "2", noChildren) + + // Type casts of integer constants into any pointer type and vice versa + client.EvaluateRequest("(*int)(2)", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + ref = checkEvalRegex(t, got, `\*\(unreadable .+\)`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + val := client.ExpectVariablesResponse(t) + checkChildren(t, val, "*(*int)(2)", 1) + checkVarRegex(t, val, 0, "^$", `\(\*\(\(\*int\)\(2\)\)\)`, `\(unreadable .+\)`, "int", noChildren) + validateEvaluateName(t, client, val, 0) + } + + // Type casts between string, []byte and []rune + client.EvaluateRequest("[]byte(\"ABC€\")", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEvalIndexed(t, got, "[]uint8 len: 6, cap: 6, [65,66,67,226,130,172]", noChildren, 6, 0) + + // Struct member access (i.e. somevar.memberfield) + client.EvaluateRequest("ms.Nest.Level", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "1", noChildren) + + // Slicing and indexing operators on arrays, slices and strings + client.EvaluateRequest("a5[4]", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "5", noChildren) + + // Map access + client.EvaluateRequest("mp[1]", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + ref = checkEval(t, got, "interface {}(int) 42", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + expr := client.ExpectVariablesResponse(t) + checkChildren(t, expr, "mp[1]", 1) + checkVarExact(t, expr, 0, "data", "(mp[1]).(data)", "42", "int", noChildren) + validateEvaluateName(t, client, expr, 0) + } + + // Pointer dereference + client.EvaluateRequest("*ms.Nest", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + ref = checkEvalRegex(t, got, `main\.Nest {Level: 1, Nest: \*main.Nest {Level: 2, Nest: \*\(\*main\.Nest\)\(0x[0-9a-f]+\)}}`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + expr := client.ExpectVariablesResponse(t) + checkChildren(t, expr, "*ms.Nest", 2) + checkVarExact(t, expr, 0, "Level", "(*ms.Nest).Level", "1", "int", noChildren) + validateEvaluateName(t, client, expr, 0) + } + + // Calls to builtin functions: cap, len, complex, imag and real + client.EvaluateRequest("len(a5)", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "5", noChildren) + + // Type assertion on interface variables (i.e. somevar.(concretetype)) + client.EvaluateRequest("mp[1].(int)", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "42", noChildren) + }, + disconnect: false, + }, { // Stop at second breakpoint + execute: func() { + checkStop(t, client, 1, "main.barfoo", 27) + + // Top-most frame + client.EvaluateRequest("a1", 1000, "this context will be ignored") + got := client.ExpectEvaluateResponse(t) + checkEval(t, got, "\"bur\"", noChildren) + // No frame defaults to top-most frame + client.EvaluateRequest("a1", 0, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "\"bur\"", noChildren) + // Next frame + client.EvaluateRequest("a1", 1001, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "\"foofoofoofoofoofoo\"", noChildren) + // Next frame + client.EvaluateRequest("a1", 1002, "any context but watch") + erres := client.ExpectVisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: could not find symbol value for a1" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: could not find symbol value for a1\"", erres) + } + client.EvaluateRequest("a1", 1002, "watch") + erres = client.ExpectInvisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: could not find symbol value for a1" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: could not find symbol value for a1\"", erres) + } + client.EvaluateRequest("a1", 1002, "repl") + erres = client.ExpectInvisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: could not find symbol value for a1" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: could not find symbol value for a1\"", erres) + } + client.EvaluateRequest("a1", 1002, "hover") + erres = client.ExpectInvisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: could not find symbol value for a1" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: could not find symbol value for a1\"", erres) + } + client.EvaluateRequest("a1", 1002, "clipboard") + erres = client.ExpectVisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: could not find symbol value for a1" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: could not find symbol value for a1\"", erres) + } + }, + disconnect: false, + }}) + }) +} + +func formatConfig(depth int, showGlobals, showRegisters bool, goroutineFilters string, hideSystemGoroutines bool, substitutePath [][2]string) string { + formatStr := `stackTraceDepth %d +showGlobalVariables %v +showRegisters %v +goroutineFilters %q +hideSystemGoroutines %v +substitutePath %v +` + return fmt.Sprintf(formatStr, depth, showGlobals, showRegisters, goroutineFilters, hideSystemGoroutines, substitutePath) +} + +func TestEvaluateCommandRequest(t *testing.T) { + runTest(t, "testvariables", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + fixture.Source, []int{}, // Breakpoint set in the program + []onBreakpoint{{ // Stop at first breakpoint + execute: func() { + checkStop(t, client, 1, "main.foobar", 66) + + // Request help. + const dlvHelp = `The following commands are available: + dlv help (alias: h) Prints the help message. + dlv config Changes configuration parameters. + dlv sources (alias: s) Print list of source files. + +Type 'dlv help' followed by a command for full documentation. +` + client.EvaluateRequest("dlv help", 1000, "repl") + got := client.ExpectEvaluateResponse(t) + checkEval(t, got, dlvHelp, noChildren) + + client.EvaluateRequest("dlv help config", 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, msgConfig, noChildren) + + // Test config. + client.EvaluateRequest("dlv config -list", 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, formatConfig(50, false, false, "", false, [][2]string{}), noChildren) + + // Read and modify showGlobalVariables. + client.EvaluateRequest("dlv config -list showGlobalVariables", 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "showGlobalVariables\tfalse\n", noChildren) + + client.ScopesRequest(1000) + scopes := client.ExpectScopesResponse(t) + if len(scopes.Body.Scopes) > 1 { + t.Errorf("\ngot %#v\nwant len(scopes)=1 (Locals)", scopes) + } + checkScope(t, scopes, 0, "Locals", -1) + + client.EvaluateRequest("dlv config showGlobalVariables true", 1000, "repl") + client.ExpectInvalidatedEvent(t) + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "showGlobalVariables\ttrue\n\nUpdated", noChildren) + + client.EvaluateRequest("dlv config -list", 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, formatConfig(50, true, false, "", false, [][2]string{}), noChildren) + + client.ScopesRequest(1000) + scopes = client.ExpectScopesResponse(t) + if len(scopes.Body.Scopes) < 2 { + t.Errorf("\ngot %#v\nwant len(scopes)=2 (Locals & Globals)", scopes) + } + checkScope(t, scopes, 0, "Locals", -1) + checkScope(t, scopes, 1, "Globals (package main)", -1) + + // Read and modify substitutePath. + client.EvaluateRequest("dlv config -list substitutePath", 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "substitutePath\t[]\n", noChildren) + + client.EvaluateRequest(fmt.Sprintf("dlv config substitutePath %q %q", "my/client/path", "your/server/path"), 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "substitutePath\t[[my/client/path your/server/path]]\n\nUpdated", noChildren) + + client.EvaluateRequest(fmt.Sprintf("dlv config substitutePath %q %q", "my/client/path", "new/your/server/path"), 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "substitutePath\t[[my/client/path new/your/server/path]]\n\nUpdated", noChildren) + + client.EvaluateRequest(fmt.Sprintf("dlv config substitutePath %q", "my/client/path"), 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "substitutePath\t[]\n\nUpdated", noChildren) + + // Test sources. + client.EvaluateRequest("dlv sources", 1000, "repl") + got = client.ExpectEvaluateResponse(t) + if !strings.Contains(got.Body.Result, fixture.Source) { + t.Errorf("\ngot: %#v, want sources contains %s", got, fixture.Source) + } + + client.EvaluateRequest(fmt.Sprintf("dlv sources .*%s", strings.ReplaceAll(filepath.Base(fixture.Source), ".", "\\.")), 1000, "repl") + got = client.ExpectEvaluateResponse(t) + if got.Body.Result != fixture.Source { + t.Errorf("\ngot: %#v, want sources=%q", got, fixture.Source) + } + + client.EvaluateRequest("dlv sources nonexistentsource", 1000, "repl") + got = client.ExpectEvaluateResponse(t) + if got.Body.Result != "" { + t.Errorf("\ngot: %#v, want sources=\"\"", got) + } + + // Test bad inputs. + client.EvaluateRequest("dlv help bad", 1000, "repl") + client.ExpectErrorResponse(t) + + client.EvaluateRequest("dlv bad", 1000, "repl") + client.ExpectErrorResponse(t) + }, + disconnect: true, + }}) + }) +} + +// From testvariables2 fixture +const ( + // As defined in the code + longstr = `"very long string 0123456789a0123456789b0123456789c0123456789d0123456789e0123456789f0123456789g012345678h90123456789i0123456789j0123456789"` + // Loaded with MaxStringLen=64 + longstrLoaded64 = `"very long string 0123456789a0123456789b0123456789c0123456789d012...+73 more"` + longstrLoaded64re = `\"very long string 0123456789a0123456789b0123456789c0123456789d012\.\.\.\+73 more\"` +) + +// TestVariableValueTruncation tests that in certain cases +// we truncate the loaded variable values to make display more user-friendly. +func TestVariableValueTruncation(t *testing.T) { + runTest(t, "testvariables2", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Breakpoint set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", -1) + + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + + // Compound variable values may be truncated + m1Full := `map\[string\]main\.astruct \[(\"[A-Za-z]+\": {A: [0-9]+, B: [0-9]+}, )+,\.\.\.\+2 more\]` + m1Part := `map\[string\]main\.astruct \[(\"[A-Za-z]+\": {A: [0-9]+, B: [0-9]+}, )+.+\.\.\.` + + // In variable responses + checkVarRegex(t, locals, -1, "m1", "m1", m1Part, `map\[string\]main\.astruct`, hasChildren) + + // In evaluate responses (select contexts only) + tests := []struct { + context string + want string + }{ + {"", m1Part}, + {"watch", m1Part}, + {"repl", m1Part}, + {"hover", m1Part}, + {"variables", m1Full}, // used for copy + {"clipboard", m1Full}, // used for copy + {"somethingelse", m1Part}, + } + for _, tc := range tests { + t.Run(tc.context, func(t *testing.T) { + client.EvaluateRequest("m1", 0, tc.context) + checkEvalRegex(t, client.ExpectEvaluateResponse(t), tc.want, hasChildren) + }) + } + + // Compound map keys may be truncated even further + // As the keys are always inside of a map container, + // this applies to variables requests only, not evalute requests. + + // key - compound, value - scalar (inlined key:value display) => truncate key if too long + ref := checkVarExact(t, locals, -1, "m5", "m5", "map[main.C]int [{s: "+longstr+"}: 1, ]", "map[main.C]int", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + // Key format: ... @
+ checkVarRegex(t, client.ExpectVariablesResponse(t), 1, `main\.C {s: "very long string 0123456789.+\.\.\. @ 0x[0-9a-f]+`, `m5\[\(\*\(\*"main\.C"\)\(0x[0-9a-f]+\)\)\]`, "1", `int`, hasChildren) + } + // key - scalar, value - scalar (inlined key:value display) => key not truncated + ref = checkVarExact(t, locals, -1, "m6", "m6", "map[string]int ["+longstr+": 123, ]", "map[string]int", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + checkVarExact(t, client.ExpectVariablesResponse(t), 1, longstr, `m6[`+longstr+`]`, "123", "string: int", noChildren) + } + // key - compound, value - compound (array-like display) => key not truncated + ref = checkVarExact(t, locals, -1, "m7", "m7", "map[main.C]main.C [{s: "+longstr+"}: {s: \"hello\"}, ]", "map[main.C]main.C", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + m7 := client.ExpectVariablesResponse(t) + checkVarRegex(t, m7, 1, "[key 0]", `\(\*\(\*\"main\.C\"\)\(0x[0-9a-f]+\)\)`, `main\.C {s: `+longstr+`}`, `main\.C`, hasChildren) + } + }, + disconnect: true, + }}) + }) +} + +// TestVariableLoadingOfLongStrings tests that different string loading limits +// apply that depending on the context. +func TestVariableLoadingOfLongStrings(t *testing.T) { + protest.MustSupportFunctionCalls(t, testBackend) + runTest(t, "longstrings", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Breakpoint set within the program + fixture.Source, []int{}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", -1) + + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + + // Limits vary for evaluate requests with different contexts + tests := []struct { + context string + limit int + }{ + {"", DefaultLoadConfig.MaxStringLen}, + {"watch", DefaultLoadConfig.MaxStringLen}, + {"repl", maxSingleStringLen}, + {"hover", maxSingleStringLen}, + {"variables", maxSingleStringLen}, + {"clipboard", maxSingleStringLen}, + {"somethingelse", DefaultLoadConfig.MaxStringLen}, + } + for _, tc := range tests { + t.Run(tc.context, func(t *testing.T) { + // Long string by itself (limits vary) + client.EvaluateRequest("s4097", 0, tc.context) + want := fmt.Sprintf(`"x+\.\.\.\+%d more"`, 4097-tc.limit) + checkEvalRegex(t, client.ExpectEvaluateResponse(t), want, noChildren) + + // Evaluated container variables return values with minimally loaded + // strings, which are further truncated for displaying, so we + // can't test for loading limit except in contexts where an untruncated + // value is returned. + client.EvaluateRequest("&s4097", 0, tc.context) + switch tc.context { + case "variables", "clipboard": + want = fmt.Sprintf(`\*"x+\.\.\.\+%d more`, 4097-DefaultLoadConfig.MaxStringLen) + default: + want = fmt.Sprintf(`\*"x{%d}\.\.\.`, maxVarValueLen-2) + } + checkEvalRegex(t, client.ExpectEvaluateResponse(t), want, hasChildren) + }) + } + + // Long strings returned from calls are subject to a different limit, + // same limit regardless of context + for _, context := range []string{"", "watch", "repl", "variables", "hover", "clipboard", "somethingelse"} { + t.Run(context, func(t *testing.T) { + client.EvaluateRequest(`call buildString(4097)`, 1000, context) + want := fmt.Sprintf(`"x+\.\.\.\+%d more"`, 4097-maxStringLenInCallRetVars) + got := client.ExpectEvaluateResponse(t) + checkEvalRegex(t, got, want, hasChildren) + }) + } + + // Variables requests use the most conservative loading limit + checkVarRegex(t, locals, -1, "s513", "s513", `"x{512}\.\.\.\+1 more"`, "string", noChildren) + // Container variables are subject to additional stricter value truncation that drops +more part + checkVarRegex(t, locals, -1, "nested", "nested", `map\[int\]string \[513: \"x+\.\.\.`, "string", hasChildren) + }, + disconnect: true, + }}) + }) +} + +func TestEvaluateCallRequest(t *testing.T) { + protest.MustSupportFunctionCalls(t, testBackend) + runTest(t, "fncall", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + fixture.Source, []int{88}, + []onBreakpoint{{ // Stop in makeclos() + execute: func() { + checkStop(t, client, 1, "main.makeclos", 88) + + // Topmost frame: both types of expressions should work + client.EvaluateRequest("callstacktrace", 1000, "this context will be ignored") + client.ExpectEvaluateResponse(t) + client.EvaluateRequest("call callstacktrace()", 1000, "this context will be ignored") + client.ExpectEvaluateResponse(t) + + // Next frame: only non-call expressions will work + client.EvaluateRequest("callstacktrace", 1001, "this context will be ignored") + client.ExpectEvaluateResponse(t) + client.EvaluateRequest("call callstacktrace()", 1001, "not watch") + erres := client.ExpectVisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: call is only supported with topmost stack frame" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: call is only supported with topmost stack frame\"", erres) + } + + // A call can stop on a breakpoint + client.EvaluateRequest("call callbreak()", 1000, "not watch") + s := client.ExpectStoppedEvent(t) + if s.Body.Reason != "hardcoded breakpoint" { + t.Errorf("\ngot %#v\nwant Reason=\"hardcoded breakpoint\"", s) + } + erres = client.ExpectVisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: call stopped" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: call stopped\"", erres) + } + + // A call during a call causes an error + client.EvaluateRequest("call callstacktrace()", 1000, "not watch") + erres = client.ExpectVisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: cannot call function while another function call is already in progress" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: cannot call function while another function call is already in progress\"", erres) + } + + // Complete the call and get back to original breakpoint in makeclos() + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.makeclos", 88) + + // Inject a call for the same function that is stopped at breakpoint: + // it might stop at the exact same breakpoint on the same goroutine, + // but we should still detect that its an injected call that stopped + // and not the return to the original point of injection after it + // completed. + client.EvaluateRequest("call makeclos(nil)", 1000, "not watch") + stopped := client.ExpectStoppedEvent(t) + erres = client.ExpectVisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: call stopped" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: call stopped\"", erres) + } + checkStop(t, client, stopped.Body.ThreadId, "main.makeclos", 88) + + // Complete the call and get back to original breakpoint in makeclos() + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.makeclos", 88) + }, + disconnect: false, + }, { // Stop at runtime breakpoint + execute: func() { + checkStop(t, client, 1, "main.main", -1) + + // No return values + client.EvaluateRequest("call call0(1, 2)", 1000, "this context will be ignored") + got := client.ExpectEvaluateResponse(t) + checkEval(t, got, "", noChildren) + // One unnamed return value + client.EvaluateRequest("call call1(one, two)", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + ref := checkEval(t, got, "3", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + rv := client.ExpectVariablesResponse(t) + checkChildren(t, rv, "rv", 1) + checkVarExact(t, rv, 0, "~r2", "", "3", "int", noChildren) + } + // One named return value + // Panic doesn't panic, but instead returns the error as a named return variable + client.EvaluateRequest("call callpanic()", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + ref = checkEval(t, got, `interface {}(string) "callpanic panicked"`, hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + rv := client.ExpectVariablesResponse(t) + checkChildren(t, rv, "rv", 1) + ref = checkVarExact(t, rv, 0, "~panic", "", `interface {}(string) "callpanic panicked"`, "interface {}", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + p := client.ExpectVariablesResponse(t) + checkChildren(t, p, "~panic", 1) + checkVarExact(t, p, 0, "data", "", "\"callpanic panicked\"", "string", noChildren) + } + } + // Multiple return values + client.EvaluateRequest("call call2(one, two)", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + ref = checkEval(t, got, "1, 2", hasChildren) + if ref > 0 { + client.VariablesRequest(ref) + rvs := client.ExpectVariablesResponse(t) + checkChildren(t, rvs, "rvs", 2) + checkVarExact(t, rvs, 0, "~r2", "", "1", "int", noChildren) + checkVarExact(t, rvs, 1, "~r3", "", "2", "int", noChildren) + } + // No frame defaults to top-most frame + client.EvaluateRequest("call call1(one, two)", 0, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "3", hasChildren) + // Extra spaces don't matter + client.EvaluateRequest(" call call1(one, one) ", 0, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "2", hasChildren) + // Just 'call', even with extra space, is treated as {expression} + client.EvaluateRequest("call ", 1000, "watch") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "\"this is a variable named `call`\"", noChildren) + + // Call error + client.EvaluateRequest("call call1(one)", 1000, "watch") + erres := client.ExpectInvisibleErrorResponse(t) + if erres.Body.Error.Format != "Unable to evaluate expression: not enough arguments" { + t.Errorf("\ngot %#v\nwant Format=\"Unable to evaluate expression: not enough arguments\"", erres) + } + + // Assignment - expect no error, but no return value. + client.EvaluateRequest("call one = two", 1000, "this context will be ignored") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "", noChildren) + // Check one=two was applied. + client.EvaluateRequest("one", 1000, "repl") + got = client.ExpectEvaluateResponse(t) + checkEval(t, got, "2", noChildren) + + // Call can exit. + client.EvaluateRequest("call callexit()", 1000, "this context will be ignored") + client.ExpectTerminatedEvent(t) + if res := client.ExpectVisibleErrorResponse(t); !strings.Contains(res.Body.Error.Format, "terminated") { + t.Errorf("\ngot %#v\nwant Format=.*terminated.*", res) + } + }, + terminated: true, + disconnect: true, + }}) + }) +} + +func TestNextAndStep(t *testing.T) { + runTest(t, "testinline", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{11}, + []onBreakpoint{{ // Stop at line 11 + execute: func() { + checkStop(t, client, 1, "main.initialize", 11) + + expectStop := func(fun string, line int) { + t.Helper() + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "step" || se.Body.ThreadId != 1 || !se.Body.AllThreadsStopped { + t.Errorf("got %#v, want Reason=\"step\", ThreadId=1, AllThreadsStopped=true", se) + } + checkStop(t, client, 1, fun, line) + } + + client.StepOutRequest(1) + client.ExpectStepOutResponse(t) + expectStop("main.main", 18) + + client.NextRequest(1) + client.ExpectNextResponse(t) + expectStop("main.main", 19) + + client.StepInRequest(1) + client.ExpectStepInResponse(t) + expectStop("main.inlineThis", 5) + + client.NextRequest(-1000) + client.ExpectNextResponse(t) + if se := client.ExpectStoppedEvent(t); se.Body.Reason != "error" || se.Body.Text != "unknown goroutine -1000" { + t.Errorf("got %#v, want Reason=\"error\", Text=\"unknown goroutine -1000\"", se) + } + checkStop(t, client, 1, "main.inlineThis", 5) + }, + disconnect: false, + }}) + }) +} + +func TestHardCodedBreakpoints(t *testing.T) { + runTest(t, "consts", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + fixture.Source, []int{28}, + []onBreakpoint{{ // Stop at line 28 + execute: func() { + checkStop(t, client, 1, "main.main", 28) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + se := client.ExpectStoppedEvent(t) + if se.Body.ThreadId != 1 || se.Body.Reason != "breakpoint" { + t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"breakpoint\"", se) + } + }, + disconnect: false, + }}) + }) +} + +// TestStepInstruction executes to a breakpoint and tests stepping +// a single instruction +func TestStepInstruction(t *testing.T) { + runTest(t, "testvariables", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{32}, // b main.foobar + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.foobar", 32) + + pc, err := getPC(t, client, 1) + if err != nil { + t.Fatal(err) + } + + // The exact instructions may change due to compiler changes, + // but we want to make sure that all of our instructions are + // instantiating variables, since these should not include + // jumps. + verifyExpectedLocation := func() { + client.StackTraceRequest(1, 0, 20) + st := client.ExpectStackTraceResponse(t) + if len(st.Body.StackFrames) < 1 { + t.Errorf("\ngot %#v\nwant len(stackframes) => 1", st) + } else { + // There is a hardcoded breakpoint on line 32. All of the + // steps should be completed before that line. + if st.Body.StackFrames[0].Line < 32 { + t.Errorf("\ngot %#v\nwant Line<32", st) + } + if st.Body.StackFrames[0].Name != "main.foobar" { + t.Errorf("\ngot %#v\nwant Name=\"main.foobar\"", st) + } + } + } + + // Next instruction. + client.NextInstructionRequest(1) + client.ExpectNextResponse(t) + se := client.ExpectStoppedEvent(t) + if se.Body.ThreadId != 1 || se.Body.Reason != "step" { + t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"step\"", se) + } + verifyExpectedLocation() + nextPC, err := getPC(t, client, 1) + if err != nil { + t.Fatal(err) + } + if nextPC <= pc { + t.Errorf("got %#x, expected InstructionPointerReference>%#x", nextPC, pc) + } + + // StepIn instruction. + pc = nextPC + client.StepInInstructionRequest(1) + client.ExpectStepInResponse(t) + se = client.ExpectStoppedEvent(t) + if se.Body.ThreadId != 1 || se.Body.Reason != "step" { + t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"step\"", se) + } + verifyExpectedLocation() + nextPC, err = getPC(t, client, 1) + if err != nil { + t.Fatal(err) + } + if nextPC <= pc { + t.Errorf("got %#x, expected InstructionPointerReference>%#x", nextPC, pc) + } + + // StepOut Instruction. + pc = nextPC + client.StepOutInstructionRequest(1) + client.ExpectStepOutResponse(t) + se = client.ExpectStoppedEvent(t) + if se.Body.ThreadId != 1 || se.Body.Reason != "step" { + t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"step\"", se) + } + verifyExpectedLocation() + nextPC, err = getPC(t, client, 1) + if err != nil { + t.Fatal(err) + } + if nextPC <= pc { + t.Errorf("got %#x, expected InstructionPointerReference>%#x", nextPC, pc) + } + }, + disconnect: true, + }}) + }) +} + +func getPC(t *testing.T, client *daptest.Client, threadId int) (uint64, error) { + client.StackTraceRequest(threadId, 0, 1) + st := client.ExpectStackTraceResponse(t) + if len(st.Body.StackFrames) < 1 { + t.Fatalf("\ngot %#v\nwant len(stackframes) => 1", st) + } + return strconv.ParseUint(st.Body.StackFrames[0].InstructionPointerReference, 0, 64) +} + +// TestNextParked tests that we can switched selected goroutine to a parked one +// and perform next operation on it. +func TestNextParked(t *testing.T) { + if runtime.GOOS == "freebsd" { + t.SkipNow() + } + runTest(t, "parallel_next", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{15}, + []onBreakpoint{{ // Stop at line 15 + execute: func() { + if parkedGoid := testNextParkedHelper(t, client, fixture); parkedGoid >= 0 { + client.NextRequest(parkedGoid) + client.ExpectNextResponse(t) + + se := client.ExpectStoppedEvent(t) + if se.Body.ThreadId != parkedGoid { + t.Fatalf("Next did not continue on the newly selected goroutine, expected %d got %d", parkedGoid, se.Body.ThreadId) + } + } + }, + // Let the test harness continue to process termination + // if it hasn't gotten there already. + disconnect: false, + }}) + }) +} + +// Finds a goroutine other than the selected one that is parked inside of main.sayhi and therefore +// still has a line to execute if resumed with next. +func testNextParkedHelper(t *testing.T, client *daptest.Client, fixture protest.Fixture) int { + t.Helper() + // Set a breakpoint at main.sayhi + client.SetBreakpointsRequest(fixture.Source, []int{8}) + client.ExpectSetBreakpointsResponse(t) + + var parkedGoid = -1 + for parkedGoid < 0 { + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + event := client.ExpectMessage(t) + switch event.(type) { + case *dap.StoppedEvent: + // ok + case *dap.TerminatedEvent: + // This is very unlikely to happen. But in theory if all sayhi + // gouritines are run serially, there will never be a second parked + // sayhi goroutine when another breaks and we will keep trying + // until process termination. + return -1 + } + + se := event.(*dap.StoppedEvent) + + client.ThreadsRequest() + threads := client.ExpectThreadsResponse(t) + + // Search for a parked goroutine that we know for sure will have to be + // resumed before the program can exit. This is a parked goroutine that: + // 1. is executing main.sayhi + // 2. hasn't called wg.Done yet + // 3. is not the currently selected goroutine + for _, g := range threads.Body.Threads { + if g.Id == se.Body.ThreadId { // Skip selected goroutine + continue + } + client.StackTraceRequest(g.Id, 0, 5) + frames := client.ExpectStackTraceResponse(t) + for _, frame := range frames.Body.StackFrames { + // line 11 is the line where wg.Done is called + if frame.Name == "main.sayhi" && frame.Line < 11 { + parkedGoid = g.Id + break + } + } + if parkedGoid >= 0 { + break + } + } + } + + // Clear all breakpoints. + client.SetBreakpointsRequest(fixture.Source, []int{}) + client.ExpectSetBreakpointsResponse(t) + return parkedGoid +} + +// TestStepOutPreservesGoroutine is inspired by proc_test.TestStepOutPreservesGoroutine +// and checks that StepOut preserves the currently selected goroutine. +func TestStepOutPreservesGoroutine(t *testing.T) { + // Checks that StepOut preserves the currently selected goroutine. + if runtime.GOOS == "freebsd" { + t.SkipNow() + } + rand.Seed(time.Now().Unix()) + runTest(t, "issue2113", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{25}, + []onBreakpoint{{ // Stop at line 25 + execute: func() { + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + // The program contains runtime.Breakpoint() + se := client.ExpectStoppedEvent(t) + + client.ThreadsRequest() + gs := client.ExpectThreadsResponse(t) + + candg := []int{} + bestg := []int{} + for _, g := range gs.Body.Threads { + // We do not need to check the thread that the program + // is currently stopped on. + if g.Id == se.Body.ThreadId { + continue + } + + client.StackTraceRequest(g.Id, 0, 20) + frames := client.ExpectStackTraceResponse(t) + for _, frame := range frames.Body.StackFrames { + if frame.Name == "main.coroutine" { + candg = append(candg, g.Id) + if strings.HasPrefix(frames.Body.StackFrames[0].Name, "runtime.") { + bestg = append(bestg, g.Id) + } + break + } + } + } + var goroutineId int + if len(bestg) > 0 { + goroutineId = bestg[rand.Intn(len(bestg))] + t.Logf("selected goroutine %d (best)\n", goroutineId) + } else if len(candg) > 0 { + goroutineId = candg[rand.Intn(len(candg))] + t.Logf("selected goroutine %d\n", goroutineId) + + } + + if goroutineId != 0 { + client.StepOutRequest(goroutineId) + client.ExpectStepOutResponse(t) + } else { + client.ContinueRequest(-1) + client.ExpectContinueResponse(t) + } + + switch e := client.ExpectMessage(t).(type) { + case *dap.StoppedEvent: + if e.Body.ThreadId != goroutineId { + t.Fatalf("StepOut did not continue on the selected goroutine, expected %d got %d", goroutineId, e.Body.ThreadId) + } + case *dap.TerminatedEvent: + t.Logf("program terminated") + default: + t.Fatalf("Unexpected event type: expect stopped or terminated event, got %#v", e) + } + }, + disconnect: false, + }}) + }) +} +func checkStopOnNextWhileNextingError(t *testing.T, client *daptest.Client, threadID int) { + t.Helper() + oe := client.ExpectOutputEvent(t) + if oe.Body.Category != "console" || oe.Body.Output != fmt.Sprintf("invalid command: %s\n", BetterNextWhileNextingError) { + t.Errorf("\ngot %#v\nwant Category=\"console\" Output=\"invalid command: %s\\n\"", oe, BetterNextWhileNextingError) + } + se := client.ExpectStoppedEvent(t) + if se.Body.ThreadId != threadID || se.Body.Reason != "exception" || se.Body.Description != "invalid command" || se.Body.Text != BetterNextWhileNextingError { + t.Errorf("\ngot %#v\nwant ThreadId=%d Reason=\"exception\" Description=\"invalid command\" Text=\"%s\"", se, threadID, BetterNextWhileNextingError) + } + client.ExceptionInfoRequest(1) + eInfo := client.ExpectExceptionInfoResponse(t) + if eInfo.Body.ExceptionId != "invalid command" || eInfo.Body.Description != BetterNextWhileNextingError { + t.Errorf("\ngot %#v\nwant ExceptionId=\"invalid command\" Text=\"%s\"", eInfo, BetterNextWhileNextingError) + } +} + +func TestBadAccess(t *testing.T) { + if runtime.GOOS != "darwin" || testBackend != "lldb" { + t.Skip("not applicable") + } + runTest(t, "issue2078", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{4}, + []onBreakpoint{{ // Stop at line 4 + execute: func() { + checkStop(t, client, 1, "main.main", 4) + + expectStoppedOnError := func(errorPrefix string) { + t.Helper() + se := client.ExpectStoppedEvent(t) + if se.Body.ThreadId != 1 || se.Body.Reason != "exception" || se.Body.Description != "runtime error" || !strings.HasPrefix(se.Body.Text, errorPrefix) { + t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"exception\" Description=\"runtime error\" Text=\"%s\"", se, errorPrefix) + } + client.ExceptionInfoRequest(1) + eInfo := client.ExpectExceptionInfoResponse(t) + if eInfo.Body.ExceptionId != "runtime error" || !strings.HasPrefix(eInfo.Body.Description, errorPrefix) { + t.Errorf("\ngot %#v\nwant ExceptionId=\"runtime error\" Text=\"%s\"", eInfo, errorPrefix) + } + } + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + expectStoppedOnError("invalid memory address or nil pointer dereference") + + client.NextRequest(1) + client.ExpectNextResponse(t) + expectStoppedOnError("invalid memory address or nil pointer dereference") + + client.NextRequest(1) + client.ExpectNextResponse(t) + checkStopOnNextWhileNextingError(t, client, 1) + + client.StepInRequest(1) + client.ExpectStepInResponse(t) + checkStopOnNextWhileNextingError(t, client, 1) + + client.StepOutRequest(1) + client.ExpectStepOutResponse(t) + checkStopOnNextWhileNextingError(t, client, 1) + }, + disconnect: true, + }}) + }) +} + +// TestNextWhileNexting is inspired by command_test.TestIssue387 and tests +// that when 'next' is interrupted by a 'breakpoint', calling 'next' +// again will produce an error with a helpful message, and 'continue' +// will resume the program. +func TestNextWhileNexting(t *testing.T) { + if runtime.GOOS == "freebsd" { + t.Skip("test is not valid on FreeBSD") + } + // a breakpoint triggering during a 'next' operation will interrupt 'next'' + // Unlike the test for the terminal package, we cannot be certain + // of the number of breakpoints we expect to hit, since multiple + // breakpoints being hit at the same time is not supported in DAP stopped + // events. + runTest(t, "issue387", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{15}, + []onBreakpoint{{ // Stop at line 15 + execute: func() { + checkStop(t, client, 1, "main.main", 15) + + client.SetBreakpointsRequest(fixture.Source, []int{8}) + client.ExpectSetBreakpointsResponse(t) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + bpSe := client.ExpectStoppedEvent(t) + threadID := bpSe.Body.ThreadId + checkStop(t, client, threadID, "main.dostuff", 8) + + for pos := 9; pos < 11; pos++ { + client.NextRequest(threadID) + client.ExpectNextResponse(t) + + stepInProgress := true + for stepInProgress { + m := client.ExpectStoppedEvent(t) + switch m.Body.Reason { + case "step": + if !m.Body.AllThreadsStopped { + t.Errorf("got %#v, want Reason=\"step\", AllThreadsStopped=true", m) + } + checkStop(t, client, m.Body.ThreadId, "main.dostuff", pos) + stepInProgress = false + case "breakpoint": + if !m.Body.AllThreadsStopped { + t.Errorf("got %#v, want Reason=\"breakpoint\", AllThreadsStopped=true", m) + } + + if stepInProgress { + // We encountered a breakpoint on a different thread. We should have to resume execution + // using continue. + oe := client.ExpectOutputEvent(t) + if oe.Body.Category != "console" || !strings.Contains(oe.Body.Output, "Step interrupted by a breakpoint.") { + t.Errorf("\ngot %#v\nwant Category=\"console\" Output=\"Step interrupted by a breakpoint.\"", oe) + } + client.NextRequest(m.Body.ThreadId) + client.ExpectNextResponse(t) + checkStopOnNextWhileNextingError(t, client, m.Body.ThreadId) + // Continue since we have not finished the step request. + client.ContinueRequest(threadID) + client.ExpectContinueResponse(t) + } else { + checkStop(t, client, m.Body.ThreadId, "main.dostuff", 8) + // Switch to stepping on this thread instead. + pos = 8 + threadID = m.Body.ThreadId + } + default: + t.Fatalf("got %#v, want StoppedEvent on step or breakpoint", m) + } + } + } + }, + disconnect: true, + }}) + }) +} + +func TestPanicBreakpointOnContinue(t *testing.T) { + runTest(t, "panic", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{5}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 5) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + text := "\"BOOM!\"" + se := client.ExpectStoppedEvent(t) + if se.Body.ThreadId != 1 || se.Body.Reason != "exception" || se.Body.Description != "panic" || se.Body.Text != text { + t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"exception\" Description=\"panic\" Text=%q", se, text) + } + + client.ExceptionInfoRequest(1) + eInfo := client.ExpectExceptionInfoResponse(t) + if eInfo.Body.ExceptionId != "panic" || eInfo.Body.Description != text { + t.Errorf("\ngot %#v\nwant ExceptionId=\"panic\" Description=%q", eInfo, text) + } + + client.StackTraceRequest(se.Body.ThreadId, 0, 20) + st := client.ExpectStackTraceResponse(t) + for i, frame := range st.Body.StackFrames { + if strings.HasPrefix(frame.Name, "runtime.") { + if frame.PresentationHint != "subtle" { + t.Errorf("\ngot Body.StackFrames[%d]=%#v\nwant Source.PresentationHint=\"subtle\"", i, frame) + } + } else if frame.Source.PresentationHint != "" { + t.Errorf("\ngot Body.StackFrames[%d]=%#v\nwant Source.PresentationHint=\"\"", i, frame) + } + + } + }, + disconnect: true, + }}) + }) +} + +func TestPanicBreakpointOnNext(t *testing.T) { + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { + // In Go 1.13, 'next' will step into the defer in the runtime + // main function, instead of the next line in the main program. + t.SkipNow() + } + + runTest(t, "panic", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{5}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 5) + + client.NextRequest(1) + client.ExpectNextResponse(t) + + text := "\"BOOM!\"" + se := client.ExpectStoppedEvent(t) + if se.Body.ThreadId != 1 || se.Body.Reason != "exception" || se.Body.Description != "panic" || se.Body.Text != text { + t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"exception\" Description=\"panic\" Text=%q", se, text) + } + + client.ExceptionInfoRequest(1) + eInfo := client.ExpectExceptionInfoResponse(t) + if eInfo.Body.ExceptionId != "panic" || eInfo.Body.Description != text { + t.Errorf("\ngot %#v\nwant ExceptionId=\"panic\" Description=%q", eInfo, text) + } + }, + disconnect: true, + }}) + }) +} + +func TestFatalThrowBreakpoint(t *testing.T) { + runTest(t, "fatalerror", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{3}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 3) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + var text string + // This does not work for Go 1.16. + ver, _ := goversion.Parse(runtime.Version()) + if ver.Major != 1 || ver.Minor != 16 { + text = "\"go of nil func value\"" + } + + se := client.ExpectStoppedEvent(t) + if se.Body.ThreadId != 1 || se.Body.Reason != "exception" || se.Body.Description != "fatal error" || se.Body.Text != text { + t.Errorf("\ngot %#v\nwant ThreadId=1 Reason=\"exception\" Description=\"fatal error\" Text=%q", se, text) + } + + // This does not work for Go 1.16. + errorPrefix := text + if errorPrefix == "" { + errorPrefix = "Throw reason unavailable, see https://github.com/golang/go/issues/46425" + } + client.ExceptionInfoRequest(1) + eInfo := client.ExpectExceptionInfoResponse(t) + if eInfo.Body.ExceptionId != "fatal error" || !strings.HasPrefix(eInfo.Body.Description, errorPrefix) { + t.Errorf("\ngot %#v\nwant ExceptionId=\"runtime error\" Text=%s", eInfo, errorPrefix) + } + + }, + disconnect: true, + }}) + }) + runTest(t, "testdeadlock", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{3}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 3) + + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + + // This does not work for Go 1.16 so skip by detecting versions before or after 1.16. + var text string + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 16) || goversion.VersionAfterOrEqual(runtime.Version(), 1, 17) { + text = "\"all goroutines are asleep - deadlock!\"" + } + se := client.ExpectStoppedEvent(t) + if se.Body.Reason != "exception" || se.Body.Description != "fatal error" || se.Body.Text != text { + t.Errorf("\ngot %#v\nwant Reason=\"exception\" Description=\"fatal error\" Text=%q", se, text) + } + + // TODO(suzmue): Get the exception info for the thread and check the description + // includes "all goroutines are asleep - deadlock!". + // Stopped events with no selected goroutines need to be supported to test deadlock. + }, + disconnect: true, + }}) + }) +} + +// checkStop covers the standard sequence of requests issued by +// a client at a breakpoint or another non-terminal stop event. +// The details have been tested by other tests, +// so this is just a sanity check. +// Skips line check if line is -1. +func checkStop(t *testing.T, client *daptest.Client, thread int, fname string, line int) { + t.Helper() + client.ThreadsRequest() + client.ExpectThreadsResponse(t) + + client.CheckStopLocation(t, thread, fname, line) + + client.ScopesRequest(1000) + client.ExpectScopesResponse(t) + + client.VariablesRequest(localsScope) + client.ExpectVariablesResponse(t) +} + +// onBreakpoint specifies what the test harness should simulate at +// a stopped breakpoint. First execute() is to be called to test // specified editor-driven or user-driven requests. Then if // disconnect is true, the test harness will abort the program // execution. Otherwise, a continue will be issued and the // program will continue to the next breakpoint or termination. +// If terminated is true, we expect requests at this breakpoint +// to result in termination. type onBreakpoint struct { execute func() disconnect bool + terminated bool +} + +// runDebugSessionWithBPs is a helper for executing the common init and shutdown +// sequences for a program that does not stop on entry +// while specifying breakpoints and unique launch/attach criteria via parameters. +// cmd - "launch" or "attach" +// cmdRequest - a function that sends a launch or attach request, +// so the test author has full control of its arguments. +// Note that he rest of the test sequence assumes that +// stopOnEntry is false. +// source - source file path, needed to set breakpoints, "" if none to be set. +// breakpoints - list of lines, where breakpoints are to be set +// onBPs - list of test sequences to execute at each of the set breakpoints. +func runDebugSessionWithBPs(t *testing.T, client *daptest.Client, cmd string, cmdRequest func(), source string, breakpoints []int, onBPs []onBreakpoint) { + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + + cmdRequest() + client.ExpectInitializedEvent(t) + if cmd == "launch" { + client.ExpectLaunchResponse(t) + } else if cmd == "attach" { + client.ExpectAttachResponse(t) + } else { + panic("expected launch or attach command") + } + + if source != "" { + client.SetBreakpointsRequest(source, breakpoints) + client.ExpectSetBreakpointsResponse(t) + } + + // Skip no-op setExceptionBreakpoints + + client.ConfigurationDoneRequest() + client.ExpectConfigurationDoneResponse(t) + + // Program automatically continues to breakpoint or completion + + // TODO(polina): See if we can make this more like withTestProcessArgs in proc_test: + // a single function pointer gets called here and then if it wants to continue it calls + // client.ContinueRequest/client.ExpectContinueResponse/client.ExpectStoppedEvent + // (possibly using a helper function). + for _, onBP := range onBPs { + client.ExpectStoppedEvent(t) + onBP.execute() + if onBP.disconnect { + client.DisconnectRequestWithKillOption(true) + if onBP.terminated { + client.ExpectOutputEventProcessExitedAnyStatus(t) + client.ExpectOutputEventDetaching(t) + } else { + client.ExpectOutputEventDetachingKill(t) + } + client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) + return + } + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + // "Continue" is triggered after the response is sent + } + + if cmd == "launch" { // Let the program run to completion + client.ExpectTerminatedEvent(t) + } + client.DisconnectRequestWithKillOption(true) + if cmd == "launch" { + client.ExpectOutputEventProcessExitedAnyStatus(t) + client.ExpectOutputEventDetaching(t) + } else if cmd == "attach" { + client.ExpectOutputEventDetachingKill(t) + } + client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) +} + +// runDebugSession is a helper for executing the standard init and shutdown +// sequences for a program that does not stop on entry +// while specifying unique launch criteria via parameters. +func runDebugSession(t *testing.T, client *daptest.Client, cmd string, cmdRequest func()) { + runDebugSessionWithBPs(t, client, cmd, cmdRequest, "", nil, nil) +} + +func TestLaunchDebugRequest(t *testing.T) { + rescueStderr := os.Stderr + r, w, _ := os.Pipe() + os.Stderr = w + done := make(chan struct{}) + + var err []byte + + go func() { + err, _ = ioutil.ReadAll(r) + t.Log(string(err)) + close(done) + }() + + tmpBin := "__tmpBin" + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + // We reuse the harness that builds, but ignore the built binary, + // only relying on the source to be built in response to LaunchRequest. + runDebugSession(t, client, "launch", func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "debug", "program": fixture.Source, "output": tmpBin}) + }) + }) + // Wait for the test to finish to capture all stderr + time.Sleep(100 * time.Millisecond) + + w.Close() + <-done + os.Stderr = rescueStderr + + rmErrRe, _ := regexp.Compile(`could not remove .*\n`) + rmErr := rmErrRe.FindString(string(err)) + if rmErr != "" { + // On Windows, a file in use cannot be removed, resulting in "Access is denied". + // When the process exits, Delve releases the binary by calling + // BinaryInfo.Close(), but it appears that it is still in use (by Windows?) + // shortly after. gobuild.Remove has a delay to address this, but + // to avoid any test flakiness we guard against this failure here as well. + if runtime.GOOS != "windows" || !stringContainsCaseInsensitive(rmErr, "Access is denied") { + t.Fatalf("Binary removal failure:\n%s\n", rmErr) + } + } else { + tmpBin = cleanExeName(tmpBin) + // We did not get a removal error, but did we even try to remove before exiting? + // Confirm that the binary did get removed. + if _, err := os.Stat(tmpBin); err == nil || os.IsExist(err) { + t.Fatal("Failed to remove temp binary", tmpBin) + } + } +} + +// TestLaunchRequestDefaults tests defaults for launch attribute that are explicit in other tests. +func TestLaunchRequestDefaults(t *testing.T) { + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSession(t, client, "launch", func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "" /*"debug" by default*/, "program": fixture.Source, "output": "__mybin"}) + }) + }) + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSession(t, client, "launch", func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + /*"mode":"debug" by default*/ "program": fixture.Source, "output": "__mybin"}) + }) + }) + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSession(t, client, "launch", func() { + // Use the temporary output binary. + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "debug", "program": fixture.Source}) + }) + }) +} + +// TestLaunchRequestOutputPath verifies that relative output binary path +// is mapped to server's, not target's, working directory. +func TestLaunchRequestOutputPath(t *testing.T) { + runTest(t, "testargs", func(client *daptest.Client, fixture protest.Fixture) { + inrel := "__somebin" + wd, _ := os.Getwd() + outabs := cleanExeName(filepath.Join(wd, inrel)) + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "debug", "program": fixture.Source, "output": inrel, + "cwd": filepath.Dir(wd)}) + }, + // Set breakpoints + fixture.Source, []int{12}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, 1, "main.main", 12) + client.EvaluateRequest("os.Args[0]", 1000, "repl") + checkEval(t, client.ExpectEvaluateResponse(t), fmt.Sprintf("%q", outabs), noChildren) + }, + disconnect: true, + }}) + }) +} + +func TestExitNonZeroStatus(t *testing.T) { + runTest(t, "pr1055", func(client *daptest.Client, fixture protest.Fixture) { + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + client.ExpectInitializedEvent(t) + client.ExpectLaunchResponse(t) + + client.ConfigurationDoneRequest() + client.ExpectConfigurationDoneResponse(t) + + client.ExpectTerminatedEvent(t) + + client.DisconnectRequest() + // Check that the process exit status is 2. + oep := client.ExpectOutputEventProcessExited(t, 2) + if oep.Body.Category != "console" { + t.Errorf("\ngot %#v\nwant Category='console'", oep) + } + oed := client.ExpectOutputEventDetaching(t) + if oed.Body.Category != "console" { + t.Errorf("\ngot %#v\nwant Category='console'", oed) + } + client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) + }) } -// runDebugSessionWithBPs is a helper for executing the common init and shutdown -// sequences for a program that does not stop on entry -// while specifying breakpoints and unique launch criteria via parameters. -// launchRequest - a function that sends a launch request, so the test author -// has full control of its arguments. Note that he rest of -// the test sequence assumes that stopOneEntry is false. -// breakpoints - list of lines, where breakpoints are to be set -// onBreakpoints - list of test sequences to execute at each of the set breakpoints. -func runDebugSessionWithBPs(t *testing.T, client *daptest.Client, launchRequest func(), source string, breakpoints []int, onBPs []onBreakpoint) { +func TestNoDebug_GoodExitStatus(t *testing.T) { + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + runNoDebugSession(t, client, func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "noDebug": true, "mode": "debug", "program": fixture.Source, "output": "__mybin"}) + }, 0) + }) +} + +func TestNoDebug_BadExitStatus(t *testing.T) { + runTest(t, "issue1101", func(client *daptest.Client, fixture protest.Fixture) { + runNoDebugSession(t, client, func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "noDebug": true, "mode": "exec", "program": fixture.Path}) + }, 2) + }) +} + +// runNoDebugSession tests the session started with noDebug=true runs +// to completion and logs termination status. +func runNoDebugSession(t *testing.T, client *daptest.Client, launchRequest func(), exitStatus int) { client.InitializeRequest() - client.ExpectInitializeResponse(t) + client.ExpectInitializeResponseAndCapabilities(t) launchRequest() - client.ExpectInitializedEvent(t) + // no initialized event. + // noDebug mode applies only to "launch" requests. client.ExpectLaunchResponse(t) - client.SetBreakpointsRequest(source, breakpoints) - client.ExpectSetBreakpointsResponse(t) - - // Skip no-op setExceptionBreakpoints - - client.ConfigurationDoneRequest() - client.ExpectConfigurationDoneResponse(t) + client.ExpectOutputEventProcessExited(t, exitStatus) + client.ExpectTerminatedEvent(t) + client.DisconnectRequestWithKillOption(true) + client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) +} - // Program automatically continues to breakpoint or completion +func TestNoDebug_AcceptNoRequestsButDisconnect(t *testing.T) { + runTest(t, "http_server", func(client *daptest.Client, fixture protest.Fixture) { + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + client.LaunchRequestWithArgs(map[string]interface{}{ + "noDebug": true, "mode": "exec", "program": fixture.Path}) + client.ExpectLaunchResponse(t) - // TODO(polina): See if we can make this more like withTestProcessArgs in proc_test: - // a single function pointer gets called here and then if it wants to continue it calls - // client.ContinueRequest/client.ExpectContinueResponse/client.ExpectStoppedEvent - // (possibly using a helper function). - for _, onBP := range onBPs { - client.ExpectStoppedEvent(t) - onBP.execute() - if onBP.disconnect { - client.DisconnectRequest() - client.ExpectDisconnectResponse(t) - return + // Anything other than disconnect should get rejected + var ExpectNoDebugError = func(cmd string) { + er := client.ExpectErrorResponse(t) + if er.Body.Error.Format != fmt.Sprintf("noDebug mode: unable to process '%s' request", cmd) { + t.Errorf("\ngot %#v\nwant 'noDebug mode: unable to process '%s' request'", er, cmd) + } } - client.ContinueRequest(1) - client.ExpectContinueResponse(t) - // "Continue" is triggered after the response is sent - } + client.SetBreakpointsRequest(fixture.Source, []int{8}) + ExpectNoDebugError("setBreakpoints") + client.SetFunctionBreakpointsRequest(nil) + ExpectNoDebugError("setFunctionBreakpoints") + client.PauseRequest(1) + ExpectNoDebugError("pause") + client.RestartRequest() + client.ExpectUnsupportedCommandErrorResponse(t) - client.ExpectTerminatedEvent(t) - client.DisconnectRequest() - client.ExpectDisconnectResponse(t) + // Disconnect request is ok + client.DisconnectRequestWithKillOption(true) + client.ExpectOutputEventTerminating(t) + client.ExpectOutputEventRegex(t, fmt.Sprintf(daptest.ProcessExited, "(-1|1)")) + client.ExpectTerminatedEvent(t) + client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) + }) } -// runDebugSesion is a helper for executing the standard init and shutdown -// sequences for a program that does not stop on entry -// while specifying unique launch criteria via parameters. -func runDebugSession(t *testing.T, client *daptest.Client, launchRequest func()) { - runDebugSessionWithBPs(t, client, launchRequest, "", nil, nil) +func TestLaunchRequestWithRelativeBuildPath(t *testing.T) { + serverStopped := make(chan struct{}) + client := startDAPServerWithClient(t, serverStopped) + defer client.Close() + + fixdir := protest.FindFixturesDir() + if filepath.IsAbs(fixdir) { + t.Fatal("this test requires relative program path") + } + program := filepath.Join(protest.FindFixturesDir(), "buildtest") + + // Use different working dir for target than dlv. + // Program path will be interpreted relative to dlv's. + dlvwd, _ := os.Getwd() + runDebugSession(t, client, "launch", func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "debug", "program": program, "cwd": filepath.Dir(dlvwd)}) + }) + <-serverStopped } -func TestLaunchDebugRequest(t *testing.T) { +func TestLaunchRequestWithRelativeExecPath(t *testing.T) { runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { - // We reuse the harness that builds, but ignore the built binary, - // only relying on the source to be built in response to LaunchRequest. - runDebugSession(t, client, func() { - // Use the default output directory. + symlink := "./__thisexe" + err := os.Symlink(fixture.Path, symlink) + defer os.Remove(symlink) + if err != nil { + t.Fatal("unable to create relative symlink:", err) + } + runDebugSession(t, client, "launch", func() { client.LaunchRequestWithArgs(map[string]interface{}{ - "mode": "debug", "program": fixture.Source}) + "mode": "exec", "program": symlink}) }) }) } func TestLaunchTestRequest(t *testing.T) { - runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { - runDebugSession(t, client, func() { - // We reuse the harness that builds, but ignore the built binary, - // only relying on the source to be built in response to LaunchRequest. - fixtures := protest.FindFixturesDir() - testdir, _ := filepath.Abs(filepath.Join(fixtures, "buildtest")) - client.LaunchRequestWithArgs(map[string]interface{}{ - "mode": "test", "program": testdir, "output": "__mytestdir"}) + orgWD, _ := os.Getwd() + fixtures := protest.FindFixturesDir() // relative to current working directory. + absoluteFixturesDir, _ := filepath.Abs(fixtures) + absolutePkgDir, _ := filepath.Abs(filepath.Join(fixtures, "buildtest")) + testFile := filepath.Join(absolutePkgDir, "main_test.go") + + for _, tc := range []struct { + name string + dlvWD string + launchArgs map[string]interface{} + wantWD string + }{{ + name: "default", + launchArgs: map[string]interface{}{ + "mode": "test", "program": absolutePkgDir, + }, + wantWD: absolutePkgDir, + }, { + name: "output", + launchArgs: map[string]interface{}{ + "mode": "test", "program": absolutePkgDir, "output": "test.out", + }, + wantWD: absolutePkgDir, + }, { + name: "dlvCwd", + launchArgs: map[string]interface{}{ + "mode": "test", "program": absolutePkgDir, "dlvCwd": ".", + }, + wantWD: absolutePkgDir, + }, { + name: "dlvCwd2", + launchArgs: map[string]interface{}{ + "mode": "test", "program": ".", "dlvCwd": absolutePkgDir, + }, + wantWD: absolutePkgDir, + }, { + name: "cwd", + launchArgs: map[string]interface{}{ + "mode": "test", "program": absolutePkgDir, "cwd": fixtures, // fixtures is relative to the current working directory. + }, + wantWD: absoluteFixturesDir, + }, { + name: "dlv runs outside of module", + dlvWD: os.TempDir(), + launchArgs: map[string]interface{}{ + "mode": "test", "program": absolutePkgDir, "dlvCwd": absoluteFixturesDir, + }, + wantWD: absolutePkgDir, + }, { + name: "dlv builds in dlvCwd but runs in cwd", + dlvWD: fixtures, + launchArgs: map[string]interface{}{ + "mode": "test", "program": absolutePkgDir, "dlvCwd": absolutePkgDir, "cwd": "..", // relative to dlvCwd. + }, + wantWD: absoluteFixturesDir, + }} { + t.Run(tc.name, func(t *testing.T) { + // Some test cases with dlvCwd or dlvWD change process working directory. + defer os.Chdir(orgWD) + if tc.dlvWD != "" { + os.Chdir(tc.dlvWD) + defer os.Chdir(orgWD) + } + serverStopped := make(chan struct{}) + client := startDAPServerWithClient(t, serverStopped) + defer client.Close() + + runDebugSessionWithBPs(t, client, "launch", + func() { // Launch + client.LaunchRequestWithArgs(tc.launchArgs) + }, + testFile, []int{14}, + []onBreakpoint{{ + execute: func() { + checkStop(t, client, -1, "github.com/go-delve/delve/_fixtures/buildtest.TestCurrentDirectory", 14) + client.VariablesRequest(1001) // Locals + locals := client.ExpectVariablesResponse(t) + checkChildren(t, locals, "Locals", 1) + for i := range locals.Body.Variables { + switch locals.Body.Variables[i].Name { + case "wd": // The test's working directory is the package directory by default. + checkVarExact(t, locals, i, "wd", "wd", fmt.Sprintf("%q", tc.wantWD), "string", noChildren) + } + } + }}}) + + <-serverStopped }) - }) + } } // Tests that 'args' from LaunchRequest are parsed and passed to the target @@ -1262,7 +5495,7 @@ func TestLaunchTestRequest(t *testing.T) { // Terminated Event. func TestLaunchRequestWithArgs(t *testing.T) { runTest(t, "testargs", func(client *daptest.Client, fixture protest.Fixture) { - runDebugSession(t, client, func() { + runDebugSession(t, client, "launch", func() { client.LaunchRequestWithArgs(map[string]interface{}{ "mode": "exec", "program": fixture.Path, "args": []string{"test", "pass flag"}}) @@ -1276,16 +5509,200 @@ func TestLaunchRequestWithArgs(t *testing.T) { // TerminatedEvent. func TestLaunchRequestWithBuildFlags(t *testing.T) { runTest(t, "buildflagtest", func(client *daptest.Client, fixture protest.Fixture) { - runDebugSession(t, client, func() { + runDebugSession(t, client, "launch", func() { // We reuse the harness that builds, but ignore the built binary, // only relying on the source to be built in response to LaunchRequest. client.LaunchRequestWithArgs(map[string]interface{}{ - "mode": "debug", "program": fixture.Source, + "mode": "debug", "program": fixture.Source, "output": "__mybin", "buildFlags": "-ldflags '-X main.Hello=World'"}) }) }) } +func TestLaunchRequestWithEnv(t *testing.T) { + // testenv fixture will lookup SOMEVAR with + // x, y := os.Lookup("SOMEVAR") + // before stopping at runtime.Breakpoint. + + type envMap map[string]*string + strVar := func(s string) *string { return &s } + + fixtures := protest.FindFixturesDir() // relative to current working directory. + testFile, _ := filepath.Abs(filepath.Join(fixtures, "testenv.go")) + for _, tc := range []struct { + name string + initEnv envMap + launchEnv envMap + wantX string + wantY bool + }{ + { + name: "no env", + initEnv: envMap{"SOMEVAR": strVar("baz")}, + wantX: "baz", + wantY: true, + }, + { + name: "overwrite", + initEnv: envMap{"SOMEVAR": strVar("baz")}, + launchEnv: envMap{"SOMEVAR": strVar("bar")}, + wantX: "bar", + wantY: true, + }, + { + name: "unset", + initEnv: envMap{"SOMEVAR": strVar("baz")}, + launchEnv: envMap{"SOMEVAR": nil}, + wantX: "", + wantY: false, + }, + { + name: "empty value", + initEnv: envMap{"SOMEVAR": strVar("baz")}, + launchEnv: envMap{"SOMEVAR": strVar("")}, + wantX: "", + wantY: true, + }, + { + name: "set", + launchEnv: envMap{"SOMEVAR": strVar("foo")}, + wantX: "foo", + wantY: true, + }, + { + name: "untouched", + initEnv: envMap{"SOMEVAR": strVar("baz")}, + launchEnv: envMap{"SOMEVAR2": nil, "SOMEVAR3": strVar("foo")}, + wantX: "baz", + wantY: true, + }, + } { + + t.Run(tc.name, func(t *testing.T) { + // cleanup + defer func() { + os.Unsetenv("SOMEVAR") + os.Unsetenv("SOMEVAR2") + os.Unsetenv("SOMEVAR3") + }() + + for k, v := range tc.initEnv { + if v != nil { + os.Setenv(k, *v) + } + } + + serverStopped := make(chan struct{}) + client := startDAPServerWithClient(t, serverStopped) + defer client.Close() + + runDebugSessionWithBPs(t, client, "launch", func() { // launch + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "debug", + "program": testFile, + "env": tc.launchEnv, + }) + }, testFile, nil, // runtime.Breakpoint + []onBreakpoint{{ + execute: func() { + client.EvaluateRequest("x", 1000, "whatever") + gotX := client.ExpectEvaluateResponse(t) + checkEval(t, gotX, fmt.Sprintf("%q", tc.wantX), false) + client.EvaluateRequest("y", 1000, "whatever") + gotY := client.ExpectEvaluateResponse(t) + checkEval(t, gotY, fmt.Sprintf("%v", tc.wantY), false) + }, + disconnect: true, + }}) + <-serverStopped + }) + } +} + +func TestAttachRequest(t *testing.T) { + if runtime.GOOS == "freebsd" { + t.SkipNow() + } + if runtime.GOOS == "windows" { + t.Skip("test skipped on windows, see https://delve.beta.teamcity.com/project/Delve_windows for details") + } + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + // Start the program to attach to + cmd := execFixture(t, fixture) + + runDebugSessionWithBPs(t, client, "attach", + // Attach + func() { + client.AttachRequest(map[string]interface{}{ + /*"mode": "local" by default*/ "processId": cmd.Process.Pid, "stopOnEntry": false}) + }, + // Set breakpoints + fixture.Source, []int{8}, + []onBreakpoint{{ + // Stop at line 8 + execute: func() { + checkStop(t, client, 1, "main.loop", 8) + client.VariablesRequest(localsScope) + locals := client.ExpectVariablesResponse(t) + checkChildren(t, locals, "Locals", 1) + checkVarRegex(t, locals, 0, "i", "i", "[0-9]+", "int", noChildren) + }, + disconnect: true, + }}) + }) +} + +// Since we are in async mode while running, we might receive thee messages after pause request +// in either order. +func expectPauseResponseAndStoppedEvent(t *testing.T, client *daptest.Client) { + t.Helper() + for i := 0; i < 2; i++ { + msg := client.ExpectMessage(t) + switch m := msg.(type) { + case *dap.StoppedEvent: + if m.Body.Reason != "pause" || m.Body.ThreadId != 0 && m.Body.ThreadId != 1 { + t.Errorf("\ngot %#v\nwant ThreadId=0/1 Reason='pause'", m) + } + case *dap.PauseResponse: + default: + t.Fatalf("got %#v, want StoppedEvent or PauseResponse", m) + } + } +} + +func TestPauseAndContinue(t *testing.T) { + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{6}, + []onBreakpoint{{ + execute: func() { + client.CheckStopLocation(t, 1, "main.loop", 6) + + // Continue resumes all goroutines, so thread id is ignored + client.ContinueRequest(12345) + client.ExpectContinueResponse(t) + + time.Sleep(time.Second) + + // Halt pauses all goroutines, so thread id is ignored + client.PauseRequest(56789) + expectPauseResponseAndStoppedEvent(t, client) + + // Pause will be a no-op at a pause: there will be no additional stopped events + client.PauseRequest(1) + client.ExpectPauseResponse(t) + }, + // The program has an infinite loop, so we must kill it by disconnecting. + disconnect: true, + }}) + }) +} + func TestUnupportedCommandResponses(t *testing.T) { var got *dap.ErrorResponse runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { @@ -1320,9 +5737,6 @@ func TestUnupportedCommandResponses(t *testing.T) { client.CompletionsRequest() expectUnsupportedCommand("completions") - client.ExceptionInfoRequest() - expectUnsupportedCommand("exceptionInfo") - client.DataBreakpointInfoRequest() expectUnsupportedCommand("dataBreakpointInfo") @@ -1334,30 +5748,372 @@ func TestUnupportedCommandResponses(t *testing.T) { client.ModulesRequest() expectUnsupportedCommand("modules") + + client.DisconnectRequest() + client.ExpectDisconnectResponse(t) }) } -func TestRequiredNotYetImplementedResponses(t *testing.T) { - var got *dap.ErrorResponse - runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { - seqCnt := 1 - expectNotYetImplemented := func(cmd string) { - t.Helper() - got = client.ExpectNotYetImplementedErrorResponse(t) - if got.RequestSeq != seqCnt || got.Command != cmd { - t.Errorf("\ngot %#v\nwant RequestSeq=%d Command=%s", got, seqCnt, cmd) - } - seqCnt++ - } +type helperForSetVariable struct { + t *testing.T + c *daptest.Client +} + +func (h *helperForSetVariable) expectSetVariable(ref int, name, value string) { + h.t.Helper() + h.expectSetVariable0(ref, name, value, false) +} + +func (h *helperForSetVariable) failSetVariable(ref int, name, value, wantErrInfo string) { + h.t.Helper() + h.failSetVariable0(ref, name, value, wantErrInfo, false) +} + +func (h *helperForSetVariable) failSetVariableAndStop(ref int, name, value, wantErrInfo string) { + h.t.Helper() + h.failSetVariable0(ref, name, value, wantErrInfo, true) +} + +func (h *helperForSetVariable) evaluate(expr, want string, hasRef bool) { + h.t.Helper() + h.c.EvaluateRequest(expr, 1000, "whatever") + got := h.c.ExpectEvaluateResponse(h.t) + checkEval(h.t, got, want, hasRef) +} + +func (h *helperForSetVariable) evaluateRegex(expr, want string, hasRef bool) { + h.t.Helper() + h.c.EvaluateRequest(expr, 1000, "whatever") + got := h.c.ExpectEvaluateResponse(h.t) + checkEvalRegex(h.t, got, want, hasRef) +} + +func (h *helperForSetVariable) expectSetVariable0(ref int, name, value string, wantStop bool) { + h.t.Helper() + + h.c.SetVariableRequest(ref, name, value) + if wantStop { + h.c.ExpectStoppedEvent(h.t) + } + if got, want := h.c.ExpectSetVariableResponse(h.t), value; got.Success != true || got.Body.Value != want { + h.t.Errorf("SetVariableRequest(%v, %v)=%#v, want {Success=true, Body.Value=%q", name, value, got, want) + } +} + +func (h *helperForSetVariable) failSetVariable0(ref int, name, value, wantErrInfo string, wantStop bool) { + h.t.Helper() + + h.c.SetVariableRequest(ref, name, value) + if wantStop { + h.c.ExpectStoppedEvent(h.t) + } + resp := h.c.ExpectErrorResponse(h.t) + if got := resp.Body.Error.Format; !stringContainsCaseInsensitive(got, wantErrInfo) { + h.t.Errorf("got %#v, want error string containing %v", got, wantErrInfo) + } +} + +func (h *helperForSetVariable) variables(ref int) *dap.VariablesResponse { + h.t.Helper() + h.c.VariablesRequest(ref) + return h.c.ExpectVariablesResponse(h.t) +} + +// TestSetVariable tests SetVariable features that do not need function call support. +func TestSetVariable(t *testing.T) { + runTest(t, "testvariables", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "showGlobalVariables": true, + }) + }, + fixture.Source, []int{}, // breakpoints are set within the program. + []onBreakpoint{{ + execute: func() { + tester := &helperForSetVariable{t, client} + + startLineno := 66 // after runtime.Breakpoint + if runtime.GOOS == "windows" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { + // Go1.15 on windows inserts a NOP after the call to + // runtime.Breakpoint and marks it same line as the + // runtime.Breakpoint call, making this flaky, so skip the line check. + startLineno = -1 + } + + checkStop(t, client, 1, "main.foobar", startLineno) + + // Local variables + locals := tester.variables(localsScope) + + // Args of foobar(baz string, bar FooBar) + checkVarExact(t, locals, 1, "bar", "bar", `main.FooBar {Baz: 10, Bur: "lorem"}`, "main.FooBar", hasChildren) + tester.failSetVariable(localsScope, "bar", `main.FooBar {Baz: 42, Bur: "ipsum"}`, "*ast.CompositeLit not implemented") + + // Nested field. + barRef := checkVarExact(t, locals, 1, "bar", "bar", `main.FooBar {Baz: 10, Bur: "lorem"}`, "main.FooBar", hasChildren) + tester.expectSetVariable(barRef, "Baz", "42") + tester.evaluate("bar", `main.FooBar {Baz: 42, Bur: "lorem"}`, hasChildren) + + tester.failSetVariable(barRef, "Baz", `"string"`, "can not convert") + + // int + checkVarExact(t, locals, -1, "a2", "a2", "6", "int", noChildren) + tester.expectSetVariable(localsScope, "a2", "42") + tester.evaluate("a2", "42", noChildren) + + tester.failSetVariable(localsScope, "a2", "false", "can not convert") + + // float + checkVarExact(t, locals, -1, "a3", "a3", "7.23", "float64", noChildren) + tester.expectSetVariable(localsScope, "a3", "-0.1") + tester.evaluate("a3", "-0.1", noChildren) + + // array of int + a4Ref := checkVarExact(t, locals, -1, "a4", "a4", "[2]int [1,2]", "[2]int", hasChildren) + tester.expectSetVariable(a4Ref, "[1]", "-7") + tester.evaluate("a4", "[2]int [1,-7]", hasChildren) + + tester.failSetVariable(localsScope, "a4", "[2]int{3, 4}", "not implemented") + + // slice of int + a5Ref := checkVarExact(t, locals, -1, "a5", "a5", "[]int len: 5, cap: 5, [1,2,3,4,5]", "[]int", hasChildren) + tester.expectSetVariable(a5Ref, "[3]", "100") + tester.evaluate("a5", "[]int len: 5, cap: 5, [1,2,3,100,5]", hasChildren) + + // composite literal and its nested fields. + a7Ref := checkVarExact(t, locals, -1, "a7", "a7", `*main.FooBar {Baz: 5, Bur: "strum"}`, "*main.FooBar", hasChildren) + a7Val := tester.variables(a7Ref) + a7ValRef := checkVarExact(t, a7Val, -1, "", "(*a7)", `main.FooBar {Baz: 5, Bur: "strum"}`, "main.FooBar", hasChildren) + tester.expectSetVariable(a7ValRef, "Baz", "7") + tester.evaluate("(*a7)", `main.FooBar {Baz: 7, Bur: "strum"}`, hasChildren) + + // pointer + checkVarExact(t, locals, -1, "a9", "a9", `*main.FooBar nil`, "*main.FooBar", noChildren) + tester.expectSetVariable(localsScope, "a9", "&a6") + tester.evaluate("a9", `*main.FooBar {Baz: 8, Bur: "word"}`, hasChildren) + + // slice of pointers + a13Ref := checkVarExact(t, locals, -1, "a13", "a13", `[]*main.FooBar len: 3, cap: 3, [*{Baz: 6, Bur: "f"},*{Baz: 7, Bur: "g"},*{Baz: 8, Bur: "h"}]`, "[]*main.FooBar", hasChildren) + a13 := tester.variables(a13Ref) + a13c0Ref := checkVarExact(t, a13, -1, "[0]", "a13[0]", `*main.FooBar {Baz: 6, Bur: "f"}`, "*main.FooBar", hasChildren) + a13c0 := tester.variables(a13c0Ref) + a13c0valRef := checkVarExact(t, a13c0, -1, "", "(*a13[0])", `main.FooBar {Baz: 6, Bur: "f"}`, "main.FooBar", hasChildren) + tester.expectSetVariable(a13c0valRef, "Baz", "777") + tester.evaluate("a13[0]", `*main.FooBar {Baz: 777, Bur: "f"}`, hasChildren) + + // complex + tester.evaluate("c64", `(1 + 2i)`, hasChildren) + tester.expectSetVariable(localsScope, "c64", "(2 + 3i)") + tester.evaluate("c64", `(2 + 3i)`, hasChildren) + // note: complex's real, imaginary part can't be directly mutable. + + // + // Global variables + // p1 = 10 + client.VariablesRequest(globalsScope) + globals := client.ExpectVariablesResponse(t) + + checkVarExact(t, globals, -1, "p1", "main.p1", "10", "int", noChildren) + tester.expectSetVariable(globalsScope, "p1", "-10") + tester.evaluate("p1", "-10", noChildren) + tester.failSetVariable(globalsScope, "p1", "0.1", "can not convert") + }, + disconnect: true, + }}) + }) + + runTest(t, "testvariables2", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "showGlobalVariables": true, + }) + }, + fixture.Source, []int{}, // breakpoints are set within the program. + []onBreakpoint{{ + execute: func() { + tester := &helperForSetVariable{t, client} + + startLineno := 364 // after runtime.Breakpoint + if runtime.GOOS == "windows" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { + startLineno = -1 + } + + checkStop(t, client, 1, "main.main", startLineno) + locals := tester.variables(localsScope) + + // channel + tester.evaluate("chnil", "chan int nil", noChildren) + tester.expectSetVariable(localsScope, "chnil", "ch1") + tester.evaluate("chnil", "chan int 4/11", hasChildren) + + // func + tester.evaluate("fn2", "nil", noChildren) + tester.expectSetVariable(localsScope, "fn2", "fn1") + tester.evaluate("fn2", "main.afunc", noChildren) + + // interface + tester.evaluate("ifacenil", "interface {} nil", noChildren) + tester.expectSetVariable(localsScope, "ifacenil", "iface1") + tester.evaluate("ifacenil", "interface {}(*main.astruct) *{A: 1, B: 2}", hasChildren) + + // interface.(data) + iface1Ref := checkVarExact(t, locals, -1, "iface1", "iface1", "interface {}(*main.astruct) *{A: 1, B: 2}", "interface {}", hasChildren) + iface1 := tester.variables(iface1Ref) + iface1DataRef := checkVarExact(t, iface1, -1, "data", "iface1.(data)", "*main.astruct {A: 1, B: 2}", "*main.astruct", hasChildren) + iface1Data := tester.variables(iface1DataRef) + iface1DataValueRef := checkVarExact(t, iface1Data, -1, "", "(*iface1.(data))", "main.astruct {A: 1, B: 2}", "main.astruct", hasChildren) + tester.expectSetVariable(iface1DataValueRef, "A", "2021") + tester.evaluate("iface1", "interface {}(*main.astruct) *{A: 2021, B: 2}", hasChildren) + + // map: string -> struct + tester.evaluate(`m1["Malone"]`, "main.astruct {A: 2, B: 3}", hasChildren) + m1Ref := checkVarRegex(t, locals, -1, "m1", "m1", `.*map\[string\]main\.astruct.*`, `map\[string\]main\.astruct`, hasChildren) + m1 := tester.variables(m1Ref) + elem1 := m1.Body.Variables[1] + tester.expectSetVariable(elem1.VariablesReference, "A", "-9999") + tester.expectSetVariable(elem1.VariablesReference, "B", "10000") + tester.evaluate(elem1.EvaluateName, "main.astruct {A: -9999, B: 10000}", hasChildren) + + // map: struct -> int + m3Ref := checkVarExact(t, locals, -1, "m3", "m3", "map[main.astruct]int [{A: 1, B: 1}: 42, {A: 2, B: 2}: 43, ]", "map[main.astruct]int", hasChildren) + tester.expectSetVariable(m3Ref, "main.astruct {A: 1, B: 1}", "8888") + // note: updating keys is possible, but let's not promise anything. + tester.evaluateRegex("m3", `.*\[\{A: 1, B: 1\}: 8888,.*`, hasChildren) + + // map: struct -> struct + m4Ref := checkVarRegex(t, locals, -1, "m4", "m4", `map\[main\.astruct]main\.astruct.*\[\{A: 1, B: 1\}: \{A: 11, B: 11\}.*`, `map\[main\.astruct\]main\.astruct`, hasChildren) + m4 := tester.variables(m4Ref) + m4Val1Ref := checkVarRegex(t, m4, -1, "[val 0]", `.*0x[0-9a-f]+.*`, `main.astruct.*`, `main\.astruct`, hasChildren) + tester.expectSetVariable(m4Val1Ref, "A", "-9999") + tester.evaluateRegex("m4", `.*A: -9999,.*`, hasChildren) + + // unsigned pointer + checkVarRegex(t, locals, -1, "up1", "up1", `unsafe\.Pointer\(0x[0-9a-f]+\)`, "unsafe.Pointer", noChildren) + tester.expectSetVariable(localsScope, "up1", "unsafe.Pointer(0x0)") + tester.evaluate("up1", "unsafe.Pointer(0x0)", noChildren) + + // val := A{val: 1} + valRef := checkVarExact(t, locals, -1, "val", "val", `main.A {val: 1}`, "main.A", hasChildren) + tester.expectSetVariable(valRef, "val", "3") + tester.evaluate("val", `main.A {val: 3}`, hasChildren) + }, + disconnect: true, + }}) + }) +} + +// TestSetVariableWithCall tests SetVariable features that do not depend on function calls support. +func TestSetVariableWithCall(t *testing.T) { + protest.MustSupportFunctionCalls(t, testBackend) + + runTest(t, "testvariables", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "showGlobalVariables": true, + }) + }, + fixture.Source, []int{66, 67}, + []onBreakpoint{{ + execute: func() { + tester := &helperForSetVariable{t, client} + + startLineno := 66 + if runtime.GOOS == "windows" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { + // Go1.15 on windows inserts a NOP after the call to + // runtime.Breakpoint and marks it same line as the + // runtime.Breakpoint call, making this flaky, so skip the line check. + startLineno = -1 + } + + checkStop(t, client, 1, "main.foobar", startLineno) + + // Local variables + locals := tester.variables(localsScope) + + // Args of foobar(baz string, bar FooBar) + checkVarExact(t, locals, 0, "baz", "baz", `"bazburzum"`, "string", noChildren) + tester.expectSetVariable(localsScope, "baz", `"BazBurZum"`) + tester.evaluate("baz", `"BazBurZum"`, noChildren) + + barRef := checkVarExact(t, locals, 1, "bar", "bar", `main.FooBar {Baz: 10, Bur: "lorem"}`, "main.FooBar", hasChildren) + tester.expectSetVariable(barRef, "Bur", `"ipsum"`) + tester.evaluate("bar", `main.FooBar {Baz: 10, Bur: "ipsum"}`, hasChildren) + + checkVarExact(t, locals, -1, "a1", "a1", `"foofoofoofoofoofoo"`, "string", noChildren) + tester.expectSetVariable(localsScope, "a1", `"barbarbar"`) + tester.evaluate("a1", `"barbarbar"`, noChildren) + + a6Ref := checkVarExact(t, locals, -1, "a6", "a6", `main.FooBar {Baz: 8, Bur: "word"}`, "main.FooBar", hasChildren) + tester.failSetVariable(a6Ref, "Bur", "false", "can not convert") + + tester.expectSetVariable(a6Ref, "Bur", `"sentence"`) + tester.evaluate("a6", `main.FooBar {Baz: 8, Bur: "sentence"}`, hasChildren) + }, + }, { + // Stop at second breakpoint and set a1. + execute: func() { + tester := &helperForSetVariable{t, client} + + checkStop(t, client, 1, "main.barfoo", -1) + // Test: set string 'a1' in main.barfoo. + // This shouldn't affect 'a1' in main.foobar - we will check that in the next breakpoint. + locals := tester.variables(localsScope) + checkVarExact(t, locals, -1, "a1", "a1", `"bur"`, "string", noChildren) + tester.expectSetVariable(localsScope, "a1", `"fur"`) + tester.evaluate("a1", `"fur"`, noChildren) + // We will check a1 in main.foobar isn't affected from the next breakpoint. + + client.StackTraceRequest(1, 1, 20) + res := client.ExpectStackTraceResponse(t) + if len(res.Body.StackFrames) < 1 { + t.Fatalf("stack trace response = %#v, wanted at least one stack frame", res) + } + outerFrame := res.Body.StackFrames[0].Id + client.EvaluateRequest("a1", outerFrame, "whatever_context") + evalRes := client.ExpectEvaluateResponse(t) + checkEval(t, evalRes, `"barbarbar"`, noChildren) + }, + disconnect: true, + }}) + }) + + runTest(t, "fncall", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + func() { + client.LaunchRequestWithArgs(map[string]interface{}{ + "mode": "exec", "program": fixture.Path, "showGlobalVariables": true, + }) + }, + fixture.Source, []int{}, // breakpoints are set within the program. + []onBreakpoint{{ + // Stop at second breakpoint and set a1. + execute: func() { + tester := &helperForSetVariable{t, client} + + checkStop(t, client, 1, "main.main", -1) - client.AttachRequest() - expectNotYetImplemented("attach") + _ = tester.variables(localsScope) - client.PauseRequest() - expectNotYetImplemented("pause") + // successful variable set using a function call. + tester.expectSetVariable(localsScope, "str", `callstacktrace()`) + tester.evaluateRegex("str", `.*in main.callstacktrace at.*`, noChildren) - client.EvaluateRequest() - expectNotYetImplemented("evaluate") + tester.failSetVariableAndStop(localsScope, "str", `callpanic()`, `callpanic panicked`) + checkStop(t, client, 1, "main.main", -1) + + // breakpoint during a function call. + tester.failSetVariableAndStop(localsScope, "str", `callbreak()`, "call stopped") + + // TODO(hyangah): continue after this causes runtime error while resuming + // unfinished injected call. + // runtime error: can not convert %!s() constant to string + // This can be reproducible with dlv cli. (`call str = callbreak(); continue`) + }, + disconnect: true, + }}) }) } @@ -1380,18 +6136,6 @@ func TestOptionalNotYetImplementedResponses(t *testing.T) { client.RestartRequest() expectNotYetImplemented("restart") - client.SetFunctionBreakpointsRequest() - expectNotYetImplemented("setFunctionBreakpoints") - - client.StepBackRequest() - expectNotYetImplemented("stepBack") - - client.ReverseContinueRequest() - expectNotYetImplemented("reverseContinue") - - client.SetVariableRequest() - expectNotYetImplemented("setVariable") - client.SetExpressionRequest() expectNotYetImplemented("setExpression") @@ -1401,18 +6145,18 @@ func TestOptionalNotYetImplementedResponses(t *testing.T) { client.ReadMemoryRequest() expectNotYetImplemented("readMemory") - client.DisassembleRequest() - expectNotYetImplemented("disassemble") - client.CancelRequest() expectNotYetImplemented("cancel") + + client.DisconnectRequest() + client.ExpectDisconnectResponse(t) }) } func TestBadLaunchRequests(t *testing.T) { runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { seqCnt := 1 - expectFailedToLaunch := func(response *dap.ErrorResponse) { + checkFailedToLaunch := func(response *dap.ErrorResponse) { t.Helper() if response.RequestSeq != seqCnt { t.Errorf("RequestSeq got %d, want %d", seqCnt, response.RequestSeq) @@ -1423,15 +6167,15 @@ func TestBadLaunchRequests(t *testing.T) { if response.Message != "Failed to launch" { t.Errorf("Message got %q, want \"Failed to launch\"", response.Message) } - if response.Body.Error.Id != 3000 { - t.Errorf("Id got %d, want 3000", response.Body.Error.Id) + if response.Body.Error.Id != FailedToLaunch { + t.Errorf("Id got %d, want %d", response.Body.Error.Id, FailedToLaunch) } seqCnt++ } - expectFailedToLaunchWithMessage := func(response *dap.ErrorResponse, errmsg string) { + checkFailedToLaunchWithMessage := func(response *dap.ErrorResponse, errmsg string) { t.Helper() - expectFailedToLaunch(response) + checkFailedToLaunch(response) if response.Body.Error.Format != errmsg { t.Errorf("\ngot %q\nwant %q", response.Body.Error.Format, errmsg) } @@ -1439,61 +6183,167 @@ func TestBadLaunchRequests(t *testing.T) { // Test for the DAP-specific detailed error message. client.LaunchRequest("exec", "", stopOnEntry) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), "Failed to launch: The program attribute is missing in debug configuration.") - client.LaunchRequestWithArgs(map[string]interface{}{"program": 12345}) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), - "Failed to launch: The program attribute is missing in debug configuration.") + // Bad "program" + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": 12345}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal number into \"program\" of type string") - client.LaunchRequestWithArgs(map[string]interface{}{"program": nil}) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": nil}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), "Failed to launch: The program attribute is missing in debug configuration.") - client.LaunchRequestWithArgs(map[string]interface{}{}) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug"}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), "Failed to launch: The program attribute is missing in debug configuration.") + // Bad "mode" client.LaunchRequest("remote", fixture.Path, stopOnEntry) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), - "Failed to launch: Unsupported 'mode' value \"remote\" in debug configuration.") + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - unsupported 'mode' attribute \"remote\"") client.LaunchRequest("notamode", fixture.Path, stopOnEntry) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), - "Failed to launch: Unsupported 'mode' value \"notamode\" in debug configuration.") + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - unsupported 'mode' attribute \"notamode\"") client.LaunchRequestWithArgs(map[string]interface{}{"mode": 12345, "program": fixture.Path}) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), - "Failed to launch: Unsupported 'mode' value %!q(float64=12345) in debug configuration.") + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal number into \"mode\" of type string") + + client.LaunchRequestWithArgs(map[string]interface{}{"mode": ""}) // empty mode defaults to "debug" (not an error) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: The program attribute is missing in debug configuration.") - client.LaunchRequestWithArgs(map[string]interface{}{"mode": "exec", "program": fixture.Path, "args": nil}) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), - "Failed to launch: 'args' attribute '' in debug configuration is not an array.") + client.LaunchRequestWithArgs(map[string]interface{}{}) // missing mode defaults to "debug" (not an error) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: The program attribute is missing in debug configuration.") + + // Bad "args" + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "exec", "program": fixture.Path, "args": "foobar"}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal string into \"args\" of type []string") client.LaunchRequestWithArgs(map[string]interface{}{"mode": "exec", "program": fixture.Path, "args": 12345}) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), - "Failed to launch: 'args' attribute '12345' in debug configuration is not an array.") + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal number into \"args\" of type []string") client.LaunchRequestWithArgs(map[string]interface{}{"mode": "exec", "program": fixture.Path, "args": []int{1, 2}}) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), - "Failed to launch: value '1' in 'args' attribute in debug configuration is not a string.") + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal number into \"args\" of type string") + // Bad "buildFlags" client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "buildFlags": 123}) - expectFailedToLaunchWithMessage(client.ExpectErrorResponse(t), - "Failed to launch: 'buildFlags' attribute '123' in debug configuration is not a string.") + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal number into \"buildFlags\" of type string") + + // Bad "backend" + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "backend": 123}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal number into \"backend\" of type string") + + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "backend": "foo"}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: could not launch process: unknown backend \"foo\"") + + // Bad "substitutePath" + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "substitutePath": 123}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal number into \"substitutePath\" of type {\"from\":string, \"to\":string}") + + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "substitutePath": []interface{}{123}}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot use 123 as 'substitutePath' of type {\"from\":string, \"to\":string}") + + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "substitutePath": []interface{}{map[string]interface{}{"to": "path2"}}}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - 'substitutePath' requires both 'from' and 'to' entries") + + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "substitutePath": []interface{}{map[string]interface{}{"from": "path1", "to": 123}}}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot use {\"from\":\"path1\",\"to\":123} as 'substitutePath' of type {\"from\":string, \"to\":string}") + // Bad "cwd" + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "cwd": 123}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: invalid debug configuration - cannot unmarshal number into \"cwd\" of type string") // Skip detailed message checks for potentially different OS-specific errors. client.LaunchRequest("exec", fixture.Path+"_does_not_exist", stopOnEntry) - expectFailedToLaunch(client.ExpectErrorResponse(t)) + checkFailedToLaunch(client.ExpectVisibleErrorResponse(t)) // No such file or directory client.LaunchRequest("debug", fixture.Path+"_does_not_exist", stopOnEntry) - expectFailedToLaunch(client.ExpectErrorResponse(t)) // Build error + oe := client.ExpectOutputEvent(t) + if !strings.HasPrefix(oe.Body.Output, "Build Error: ") || oe.Body.Category != "stderr" { + t.Errorf("got %#v, want Category=\"stderr\" Output=\"Build Error: ...\"", oe) + } + checkFailedToLaunch(client.ExpectInvisibleErrorResponse(t)) + + client.LaunchRequestWithArgs(map[string]interface{}{ + "request": "launch", + /* mode: debug by default*/ + "program": fixture.Path + "_does_not_exist", + "stopOnEntry": stopOnEntry, + }) + oe = client.ExpectOutputEvent(t) + if !strings.HasPrefix(oe.Body.Output, "Build Error: ") || oe.Body.Category != "stderr" { + t.Errorf("got %#v, want Category=\"stderr\" Output=\"Build Error: ...\"", oe) + } + checkFailedToLaunch(client.ExpectInvisibleErrorResponse(t)) client.LaunchRequest("exec", fixture.Source, stopOnEntry) - expectFailedToLaunch(client.ExpectErrorResponse(t)) // Not an executable + checkFailedToLaunch(client.ExpectVisibleErrorResponse(t)) // Not an executable + + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "buildFlags": "-bad -flags"}) + oe = client.ExpectOutputEvent(t) + if !strings.HasPrefix(oe.Body.Output, "Build Error: ") || oe.Body.Category != "stderr" { + t.Errorf("got %#v, want Category=\"stderr\" Output=\"Build Error: ...\"", oe) + } + checkFailedToLaunchWithMessage(client.ExpectInvisibleErrorResponse(t), "Failed to launch: Build error: Check the debug console for details.") + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "noDebug": true, "buildFlags": "-bad -flags"}) + oe = client.ExpectOutputEvent(t) + if !strings.HasPrefix(oe.Body.Output, "Build Error: ") || oe.Body.Category != "stderr" { + t.Errorf("got %#v, want Category=\"stderr\" Output=\"Build Error: ...\"", oe) + } + checkFailedToLaunchWithMessage(client.ExpectInvisibleErrorResponse(t), "Failed to launch: Build error: Check the debug console for details.") + + // Bad "cwd" + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "noDebug": false, "cwd": "dir/invalid"}) + checkFailedToLaunch(client.ExpectVisibleErrorResponse(t)) // invalid directory, the error message is system-dependent. + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "noDebug": true, "cwd": "dir/invalid"}) + checkFailedToLaunch(client.ExpectVisibleErrorResponse(t)) // invalid directory, the error message is system-dependent. + + // Bad "noDebug" + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "noDebug": "true"}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), "Failed to launch: invalid debug configuration - cannot unmarshal string into \"noDebug\" of type bool") + + // Bad "replay" parameters + // These errors come from dap layer + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "replay", "traceDirPath": ""}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: The 'traceDirPath' attribute is missing in debug configuration.") + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "replay", "program": fixture.Source, "traceDirPath": ""}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: The 'traceDirPath' attribute is missing in debug configuration.") + // These errors come from debugger layer + if _, err := exec.LookPath("rr"); err != nil { + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "replay", "backend": "ignored", "traceDirPath": ".."}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: backend unavailable") + } - client.LaunchRequestWithArgs(map[string]interface{}{"mode": "debug", "program": fixture.Source, "buildFlags": "123"}) - expectFailedToLaunch(client.ExpectErrorResponse(t)) // Build error + // Bad "core" parameters + // These errors come from dap layer + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "core", "coreFilePath": ""}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: The program attribute is missing in debug configuration.") + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "core", "program": fixture.Source, "coreFilePath": ""}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: The 'coreFilePath' attribute is missing in debug configuration.") + // These errors come from debugger layer + client.LaunchRequestWithArgs(map[string]interface{}{"mode": "core", "backend": "ignored", "program": fixture.Source, "coreFilePath": fixture.Source}) + checkFailedToLaunchWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to launch: unrecognized core format") // We failed to launch the program. Make sure shutdown still works. client.DisconnectRequest() @@ -1504,11 +6354,411 @@ func TestBadLaunchRequests(t *testing.T) { }) } +func TestBadAttachRequest(t *testing.T) { + runTest(t, "loopprog", func(client *daptest.Client, fixture protest.Fixture) { + seqCnt := 1 + checkFailedToAttach := func(response *dap.ErrorResponse) { + t.Helper() + if response.RequestSeq != seqCnt { + t.Errorf("RequestSeq got %d, want %d", seqCnt, response.RequestSeq) + } + if response.Command != "attach" { + t.Errorf("Command got %q, want \"attach\"", response.Command) + } + if response.Message != "Failed to attach" { + t.Errorf("Message got %q, want \"Failed to attach\"", response.Message) + } + if response.Body.Error.Id != FailedToAttach { + t.Errorf("Id got %d, want %d", response.Body.Error.Id, FailedToAttach) + } + seqCnt++ + } + + checkFailedToAttachWithMessage := func(response *dap.ErrorResponse, errmsg string) { + t.Helper() + checkFailedToAttach(response) + if response.Body.Error.Format != errmsg { + t.Errorf("\ngot %q\nwant %q", response.Body.Error.Format, errmsg) + } + } + + // Bad "mode" + client.AttachRequest(map[string]interface{}{"mode": "blah blah blah"}) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: invalid debug configuration - unsupported 'mode' attribute \"blah blah blah\"") + + client.AttachRequest(map[string]interface{}{"mode": 123}) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: invalid debug configuration - cannot unmarshal number into \"mode\" of type string") + + client.AttachRequest(map[string]interface{}{"mode": ""}) // empty mode defaults to "local" (not an error) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: The 'processId' attribute is missing in debug configuration") + + client.AttachRequest(map[string]interface{}{}) // no mode defaults to "local" (not an error) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: The 'processId' attribute is missing in debug configuration") + + // Bad "processId" + client.AttachRequest(map[string]interface{}{"mode": "local"}) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: The 'processId' attribute is missing in debug configuration") + + client.AttachRequest(map[string]interface{}{"mode": "local", "processId": nil}) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: The 'processId' attribute is missing in debug configuration") + + client.AttachRequest(map[string]interface{}{"mode": "local", "processId": 0}) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: The 'processId' attribute is missing in debug configuration") + + client.AttachRequest(map[string]interface{}{"mode": "local", "processId": "1"}) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: invalid debug configuration - cannot unmarshal string into \"processId\" of type int") + + client.AttachRequest(map[string]interface{}{"mode": "local", "processId": 1}) + // The exact message varies on different systems, so skip that check + checkFailedToAttach(client.ExpectVisibleErrorResponse(t)) // could not attach to pid 1 + + // This will make debugger.(*Debugger) panic, which we will catch as an internal error. + client.AttachRequest(map[string]interface{}{"mode": "local", "processId": -1}) + er := client.ExpectInvisibleErrorResponse(t) + if er.RequestSeq != seqCnt { + t.Errorf("RequestSeq got %d, want %d", seqCnt, er.RequestSeq) + } + seqCnt++ + if er.Command != "" { + t.Errorf("Command got %q, want \"attach\"", er.Command) + } + if er.Body.Error.Format != "Internal Error: runtime error: index out of range [0] with length 0" { + t.Errorf("Message got %q, want \"Internal Error: runtime error: index out of range [0] with length 0\"", er.Message) + } + if er.Body.Error.Id != InternalError { + t.Errorf("Id got %d, want %d", er.Body.Error.Id, InternalError) + } + + // Bad "backend" + client.AttachRequest(map[string]interface{}{"mode": "local", "processId": 1, "backend": 123}) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: invalid debug configuration - cannot unmarshal number into \"backend\" of type string") + + client.AttachRequest(map[string]interface{}{"mode": "local", "processId": 1, "backend": "foo"}) + checkFailedToAttachWithMessage(client.ExpectVisibleErrorResponse(t), + "Failed to attach: could not attach to pid 1: unknown backend \"foo\"") + + // We failed to attach to the program. Make sure shutdown still works. + client.DisconnectRequest() + dresp := client.ExpectDisconnectResponse(t) + if dresp.RequestSeq != seqCnt { + t.Errorf("got %#v, want RequestSeq=%d", dresp, seqCnt) + } + }) +} + +func launchDebuggerWithTargetRunning(t *testing.T, fixture string) (*protest.Fixture, *debugger.Debugger) { + t.Helper() + fixbin, dbg := launchDebuggerWithTargetHalted(t, fixture) + running := make(chan struct{}) + var err error + go func() { + t.Helper() + _, err = dbg.Command(&api.DebuggerCommand{Name: api.Continue}, running) + select { + case <-running: + default: + close(running) + } + }() + <-running + if err != nil { + t.Fatal("failed to continue on launch", err) + } + return fixbin, dbg +} + +func launchDebuggerWithTargetHalted(t *testing.T, fixture string) (*protest.Fixture, *debugger.Debugger) { + t.Helper() + fixbin := protest.BuildFixture(fixture, protest.AllNonOptimized) + cfg := service.Config{ + ProcessArgs: []string{fixbin.Path}, + Debugger: debugger.Config{Backend: "default"}, + } + dbg, err := debugger.New(&cfg.Debugger, cfg.ProcessArgs) // debugger halts process on entry + if err != nil { + t.Fatal("failed to start debugger:", err) + } + return &fixbin, dbg +} + +// runTestWithDebugger starts the server and sets its debugger, initializes a debug session, +// runs test, then disconnects. Expects no running async handler at the end of test() (either +// process is halted or debug session never launched.) +func runTestWithDebugger(t *testing.T, dbg *debugger.Debugger, test func(c *daptest.Client)) { + serverStopped := make(chan struct{}) + server, _ := startDAPServer(t, serverStopped) + client := daptest.NewClient(server.listener.Addr().String()) + time.Sleep(100 * time.Millisecond) // Give time for connection to be set as dap.Session + server.sessionMu.Lock() + if server.session == nil { + t.Fatal("DAP session is not ready") + } + server.session.debugger = dbg + server.sessionMu.Unlock() + defer client.Close() + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + + test(client) + + client.DisconnectRequest() + if server.config.Debugger.AttachPid == 0 { // launched target + client.ExpectOutputEventDetachingKill(t) + } else { // attached to target + client.ExpectOutputEventDetachingNoKill(t) + } + client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) + + <-serverStopped +} + +func TestAttachRemoteToHaltedTargetStopOnEntry(t *testing.T) { + // Halted + stop on entry + _, dbg := launchDebuggerWithTargetHalted(t, "increment") + runTestWithDebugger(t, dbg, func(client *daptest.Client) { + client.AttachRequest(map[string]interface{}{"mode": "remote", "stopOnEntry": true}) + client.ExpectInitializedEvent(t) + client.ExpectAttachResponse(t) + client.ConfigurationDoneRequest() + client.ExpectStoppedEvent(t) + client.ExpectConfigurationDoneResponse(t) + }) +} + +func TestAttachRemoteToHaltedTargetContinueOnEntry(t *testing.T) { + // Halted + continue on entry + _, dbg := launchDebuggerWithTargetHalted(t, "http_server") + runTestWithDebugger(t, dbg, func(client *daptest.Client) { + client.AttachRequest(map[string]interface{}{"mode": "remote", "stopOnEntry": false}) + client.ExpectInitializedEvent(t) + client.ExpectAttachResponse(t) + client.ConfigurationDoneRequest() + client.ExpectConfigurationDoneResponse(t) + // Continuing + time.Sleep(time.Second) + // Halt to make the disconnect sequence more predictable. + client.PauseRequest(1) + expectPauseResponseAndStoppedEvent(t, client) + }) +} + +func TestAttachRemoteToRunningTargetStopOnEntry(t *testing.T) { + fixture, dbg := launchDebuggerWithTargetRunning(t, "loopprog") + runTestWithDebugger(t, dbg, func(client *daptest.Client) { + client.AttachRequest(map[string]interface{}{"mode": "remote", "stopOnEntry": true}) + client.ExpectInitializedEvent(t) + client.ExpectAttachResponse(t) + // Target is halted here + client.SetBreakpointsRequest(fixture.Source, []int{8}) + expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}}) + client.ConfigurationDoneRequest() + client.ExpectStoppedEvent(t) + client.ExpectConfigurationDoneResponse(t) + client.ContinueRequest(1) + client.ExpectContinueResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + }) +} + +func TestAttachRemoteToRunningTargetContinueOnEntry(t *testing.T) { + fixture, dbg := launchDebuggerWithTargetRunning(t, "loopprog") + runTestWithDebugger(t, dbg, func(client *daptest.Client) { + client.AttachRequest(map[string]interface{}{"mode": "remote", "stopOnEntry": false}) + client.ExpectInitializedEvent(t) + client.ExpectAttachResponse(t) + // Target is halted here + client.SetBreakpointsRequest(fixture.Source, []int{8}) + expectSetBreakpointsResponse(t, client, []Breakpoint{{8, fixture.Source, true, ""}}) + client.ConfigurationDoneRequest() + // Target is restarted here + client.ExpectConfigurationDoneResponse(t) + client.ExpectStoppedEvent(t) + checkStop(t, client, 1, "main.loop", 8) + }) +} + +// TestAttachRemoteMultiClientDisconnect tests that that remote attach doesn't take down +// the server in multi-client mode unless terminateDebugee is explicitely set. +func TestAttachRemoteMultiClientDisconnect(t *testing.T) { + closingClientSessionOnly := fmt.Sprintf(daptest.ClosingClient, "halted") + detachingAndTerminating := "Detaching and terminating target process" + tests := []struct { + name string + disconnectRequest func(client *daptest.Client) + expect string + }{ + {"default", func(c *daptest.Client) { c.DisconnectRequest() }, closingClientSessionOnly}, + {"terminate=true", func(c *daptest.Client) { c.DisconnectRequestWithKillOption(true) }, detachingAndTerminating}, + {"terminate=false", func(c *daptest.Client) { c.DisconnectRequestWithKillOption(false) }, closingClientSessionOnly}, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + serverStopped := make(chan struct{}) + server, forceStop := startDAPServer(t, serverStopped) + client := daptest.NewClient(server.listener.Addr().String()) + defer client.Close() + time.Sleep(100 * time.Millisecond) // Give time for connection to be set as dap.Session + server.sessionMu.Lock() + if server.session == nil { + t.Fatal("dap session is not ready") + } + // DAP server doesn't support accept-multiclient, but we can use this + // hack to test the inner connection logic that can be used by a server that does. + server.session.config.AcceptMulti = true + _, server.session.debugger = launchDebuggerWithTargetHalted(t, "increment") + server.sessionMu.Unlock() + + client.InitializeRequest() + client.ExpectInitializeResponseAndCapabilities(t) + + client.AttachRequest(map[string]interface{}{"mode": "remote", "stopOnEntry": true}) + client.ExpectInitializedEvent(t) + client.ExpectAttachResponse(t) + client.ConfigurationDoneRequest() + client.ExpectStoppedEvent(t) + client.ExpectConfigurationDoneResponse(t) + + tc.disconnectRequest(client) + e := client.ExpectOutputEvent(t) + if matched, _ := regexp.MatchString(tc.expect, e.Body.Output); !matched { + t.Errorf("\ngot %#v\nwant Output=%q", e, tc.expect) + } + client.ExpectDisconnectResponse(t) + client.ExpectTerminatedEvent(t) + time.Sleep(10 * time.Millisecond) // give time for things to shut down + + if tc.expect == closingClientSessionOnly { + // At this point a multi-client server is still running. + verifySessionStopped(t, server.session) + // Since it is a dap server, it cannot accept another client, so the only + // way to take down the server is to force-kill it. + close(forceStop) + } + <-serverStopped + }) + } +} + +func TestLaunchAttachErrorWhenDebugInProgress(t *testing.T) { + tests := []struct { + name string + dbg func() *debugger.Debugger + }{ + {"halted", func() *debugger.Debugger { _, dbg := launchDebuggerWithTargetHalted(t, "increment"); return dbg }}, + {"running", func() *debugger.Debugger { _, dbg := launchDebuggerWithTargetRunning(t, "loopprog"); return dbg }}, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + runTestWithDebugger(t, tc.dbg(), func(client *daptest.Client) { + client.EvaluateRequest("1==1", 0 /*no frame specified*/, "repl") + if tc.name == "running" { + client.ExpectInvisibleErrorResponse(t) + } else { + client.ExpectEvaluateResponse(t) + } + + // Both launch and attach requests should go through for additional error checking + client.AttachRequest(map[string]interface{}{"mode": "local", "processId": 100}) + er := client.ExpectVisibleErrorResponse(t) + msgRe, _ := regexp.Compile("Failed to attach: debug session already in progress at [0-9]+:[0-9]+ - use remote mode to connect to a server with an active debug session") + if er.Body.Error.Id != FailedToAttach || msgRe.MatchString(er.Body.Error.Format) { + t.Errorf("got %#v, want Id=%d Format=%q", er, FailedToAttach, msgRe) + } + tests := []string{"debug", "test", "exec", "replay", "core"} + for _, mode := range tests { + t.Run(mode, func(t *testing.T) { + client.LaunchRequestWithArgs(map[string]interface{}{"mode": mode}) + er := client.ExpectVisibleErrorResponse(t) + msgRe, _ := regexp.Compile("Failed to launch: debug session already in progress at [0-9]+:[0-9]+ - use remote attach mode to connect to a server with an active debug session") + if er.Body.Error.Id != FailedToLaunch || msgRe.MatchString(er.Body.Error.Format) { + t.Errorf("got %#v, want Id=%d Format=%q", er, FailedToLaunch, msgRe) + } + }) + } + }) + }) + } +} + +func TestBadInitializeRequest(t *testing.T) { + runInitializeTest := func(args dap.InitializeRequestArguments, err string) { + t.Helper() + // Only one initialize request is allowed, so use a new server + // for each test. + serverStopped := make(chan struct{}) + client := startDAPServerWithClient(t, serverStopped) + defer client.Close() + + client.InitializeRequestWithArgs(args) + response := client.ExpectErrorResponse(t) + if response.Command != "initialize" { + t.Errorf("Command got %q, want \"launch\"", response.Command) + } + if response.Message != "Failed to initialize" { + t.Errorf("Message got %q, want \"Failed to launch\"", response.Message) + } + if response.Body.Error.Id != FailedToInitialize { + t.Errorf("Id got %d, want %d", response.Body.Error.Id, FailedToInitialize) + } + if response.Body.Error.Format != err { + t.Errorf("\ngot %q\nwant %q", response.Body.Error.Format, err) + } + + client.DisconnectRequest() + client.ExpectDisconnectResponse(t) + <-serverStopped + } + + // Bad path format. + runInitializeTest(dap.InitializeRequestArguments{ + AdapterID: "go", + PathFormat: "url", // unsupported 'pathFormat' + LinesStartAt1: true, + ColumnsStartAt1: true, + Locale: "en-us", + }, + "Failed to initialize: Unsupported 'pathFormat' value 'url'.", + ) + + // LinesStartAt1 must be true. + runInitializeTest(dap.InitializeRequestArguments{ + AdapterID: "go", + PathFormat: "path", + LinesStartAt1: false, // only 1-based line numbers are supported + ColumnsStartAt1: true, + Locale: "en-us", + }, + "Failed to initialize: Only 1-based line numbers are supported.", + ) + + // ColumnsStartAt1 must be true. + runInitializeTest(dap.InitializeRequestArguments{ + AdapterID: "go", + PathFormat: "path", + LinesStartAt1: true, + ColumnsStartAt1: false, // only 1-based column numbers are supported + Locale: "en-us", + }, + "Failed to initialize: Only 1-based column numbers are supported.", + ) +} + func TestBadlyFormattedMessageToServer(t *testing.T) { runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { // Send a badly formatted message to the server, and expect it to close the // connection. - client.UnknownRequest() + client.BadRequest() time.Sleep(100 * time.Millisecond) _, err := client.ReadMessage() @@ -1517,4 +6767,426 @@ func TestBadlyFormattedMessageToServer(t *testing.T) { t.Errorf("got err=%v, want io.EOF", err) } }) + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + // Send an unknown request message to the server, and expect it to send + // an error response. + client.UnknownRequest() + err := client.ExpectErrorResponse(t) + if err.Body.Error.Format != "Internal Error: Request command 'unknown' is not supported (seq: 1)" || err.RequestSeq != 1 { + t.Errorf("got %v, want RequestSeq=1 Error=\"Internal Error: Request command 'unknown' is not supported (seq: 1)\"", err) + } + + // Make sure that the unknown request did not kill the server. + client.InitializeRequest() + client.ExpectInitializeResponse(t) + + client.DisconnectRequest() + client.ExpectDisconnectResponse(t) + }) +} + +func TestParseLogPoint(t *testing.T) { + tests := []struct { + name string + msg string + wantTracepoint bool + wantFormat string + wantArgs []string + wantErr bool + }{ + // Test simple log messages. + {name: "simple string", msg: "hello, world!", wantTracepoint: true, wantFormat: "hello, world!"}, + {name: "empty string", msg: "", wantTracepoint: false, wantErr: false}, + // Test parse eval expressions. + { + name: "simple eval", + msg: "{x}", + wantTracepoint: true, + wantFormat: "%s", + wantArgs: []string{"x"}, + }, + { + name: "type cast", + msg: "hello {string(x)}", + wantTracepoint: true, + wantFormat: "hello %s", + wantArgs: []string{"string(x)"}, + }, + { + name: "multiple eval", + msg: "{x} {y} {z}", + wantTracepoint: true, + wantFormat: "%s %s %s", + wantArgs: []string{"x", "y", "z"}, + }, + { + name: "eval expressions contain braces", + msg: "{interface{}(x)} {myType{y}} {[]myType{{z}}}", + wantTracepoint: true, + wantFormat: "%s %s %s", + wantArgs: []string{"interface{}(x)", "myType{y}", "[]myType{{z}}"}, + }, + // Test parse errors. + {name: "empty evaluation", msg: "{}", wantErr: true}, + {name: "empty space evaluation", msg: "{ \n}", wantErr: true}, + {name: "open brace missing closed", msg: "{", wantErr: true}, + {name: "closed brace missing open", msg: "}", wantErr: true}, + {name: "open brace in expression", msg: `{m["{"]}`, wantErr: true}, + {name: "closed brace in expression", msg: `{m["}"]}`, wantErr: true}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gotTracepoint, gotLogMessage, err := parseLogPoint(tt.msg) + if gotTracepoint != tt.wantTracepoint { + t.Errorf("parseLogPoint() tracepoint = %v, wantTracepoint %v", gotTracepoint, tt.wantTracepoint) + return + } + if (err != nil) != tt.wantErr { + t.Errorf("parseLogPoint() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !tt.wantTracepoint { + return + } + if gotLogMessage == nil { + t.Errorf("parseLogPoint() gotLogMessage = nil, want log message") + return + } + if gotLogMessage.format != tt.wantFormat { + t.Errorf("parseLogPoint() gotFormat = %v, want %v", gotLogMessage.format, tt.wantFormat) + } + if !reflect.DeepEqual(gotLogMessage.args, tt.wantArgs) { + t.Errorf("parseLogPoint() gotArgs = %v, want %v", gotLogMessage.args, tt.wantArgs) + } + }) + } +} + +func TestDisassemble(t *testing.T) { + runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) { + runDebugSessionWithBPs(t, client, "launch", + // Launch + func() { + client.LaunchRequest("exec", fixture.Path, !stopOnEntry) + }, + // Set breakpoints + fixture.Source, []int{17}, + []onBreakpoint{{ + // Stop at line 17 + execute: func() { + checkStop(t, client, 1, "main.main", 17) + + client.StackTraceRequest(1, 0, 1) + st := client.ExpectStackTraceResponse(t) + if len(st.Body.StackFrames) < 1 { + t.Fatalf("\ngot %#v\nwant len(stackframes) => 1", st) + } + // Request the single instruction that the program is stopped at. + pc := st.Body.StackFrames[0].InstructionPointerReference + client.DisassembleRequest(pc, 0, 1) + dr := client.ExpectDisassembleResponse(t) + if len(dr.Body.Instructions) != 1 { + t.Errorf("\ngot %#v\nwant len(instructions) = 1", dr) + } else if dr.Body.Instructions[0].Address != pc { + t.Errorf("\ngot %#v\nwant instructions[0].Address = %s", dr, pc) + } + + // Request the instruction that the program is stopped at, and the two + // surrounding it. + client.DisassembleRequest(pc, -1, 3) + dr = client.ExpectDisassembleResponse(t) + if len(dr.Body.Instructions) != 3 { + t.Errorf("\ngot %#v\nwant len(instructions) = 3", dr) + } else if dr.Body.Instructions[1].Address != pc { + t.Errorf("\ngot %#v\nwant instructions[1].Address = %s", dr, pc) + } + + // Request zero instrutions. + client.DisassembleRequest(pc, 0, 0) + dr = client.ExpectDisassembleResponse(t) + if len(dr.Body.Instructions) != 0 { + t.Errorf("\ngot %#v\nwant len(instructions) = 0", dr) + } + + // Request invalid instructions. + var checkInvalidInstruction = func(instructions []dap.DisassembledInstruction, count int, address uint64) { + if len(instructions) != count { + t.Errorf("\ngot %#v\nwant len(instructions) = %d", dr, count) + } + for i, got := range instructions { + if got.Instruction != invalidInstruction.Instruction { + t.Errorf("\ngot [%d].Instruction=%q\nwant = %#v", i, got.Instruction, invalidInstruction.Address) + } + addr, err := strconv.ParseUint(got.Address, 0, 64) + if err != nil { + t.Error(err) + continue + } + if addr != address { + t.Errorf("\ngot [%d].Address=%s\nwant = %#x", i, got.Address, address) + } + } + } + client.DisassembleRequest("0x0", 0, 10) + checkInvalidInstruction(client.ExpectDisassembleResponse(t).Body.Instructions, 10, 0) + + client.DisassembleRequest(fmt.Sprintf("%#x", uint64(math.MaxUint64)), 0, 10) + checkInvalidInstruction(client.ExpectDisassembleResponse(t).Body.Instructions, 10, uint64(math.MaxUint64)) + + // Bad request, not a number. + client.DisassembleRequest("hello, world!", 0, 1) + client.ExpectErrorResponse(t) + + // Bad request, not an address in program. + client.DisassembleRequest("0x5", 0, 100) + client.ExpectErrorResponse(t) + }, + disconnect: true, + }}, + ) + }) +} + +func TestAlignPCs(t *testing.T) { + NUM_FUNCS := 10 + // Create fake functions to test align PCs. + funcs := make([]proc.Function, NUM_FUNCS) + for i := 0; i < len(funcs); i++ { + funcs[i] = proc.Function{ + Entry: uint64(100 + i*10), + End: uint64(100 + i*10 + 5), + } + } + bi := &proc.BinaryInfo{ + Functions: funcs, + } + type args struct { + start uint64 + end uint64 + } + tests := []struct { + name string + args args + wantStart uint64 + wantEnd uint64 + }{ + { + name: "out of bounds", + args: args{ + start: funcs[0].Entry - 5, + end: funcs[NUM_FUNCS-1].End + 5, + }, + wantStart: funcs[0].Entry, // start of first function + wantEnd: funcs[NUM_FUNCS-1].End, // end of last function + }, + { + name: "same function", + args: args{ + start: funcs[1].Entry + 1, + end: funcs[1].Entry + 2, + }, + wantStart: funcs[1].Entry, // start of containing function + wantEnd: funcs[1].End, // end of containing function + }, + { + name: "between functions", + args: args{ + start: funcs[1].End + 1, + end: funcs[1].End + 2, + }, + wantStart: funcs[1].Entry, // start of function before + wantEnd: funcs[2].Entry, // start of function after + }, + { + name: "start of function", + args: args{ + start: funcs[2].Entry, + end: funcs[5].Entry, + }, + wantStart: funcs[2].Entry, // start of current function + wantEnd: funcs[5].End, // end of current function + }, + { + name: "end of function", + args: args{ + start: funcs[4].End, + end: funcs[8].End, + }, + wantStart: funcs[4].Entry, // start of current function + wantEnd: funcs[9].Entry, // start of next function + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gotStart, gotEnd := alignPCs(bi, tt.args.start, tt.args.end) + if gotStart != tt.wantStart { + t.Errorf("alignPCs() got start = %v, want %v", gotStart, tt.wantStart) + } + if gotEnd != tt.wantEnd { + t.Errorf("alignPCs() got end = %v, want %v", gotEnd, tt.wantEnd) + } + }) + } +} + +func TestFindInstructions(t *testing.T) { + numInstructions := 100 + startPC := 0x1000 + procInstructions := make([]proc.AsmInstruction, numInstructions) + for i := 0; i < len(procInstructions); i++ { + procInstructions[i] = proc.AsmInstruction{ + Loc: proc.Location{ + PC: uint64(startPC + 2*i), + }, + } + } + type args struct { + addr uint64 + offset int + count int + } + tests := []struct { + name string + args args + wantInstructions []proc.AsmInstruction + wantOffset int + wantErr bool + }{ + { + name: "request all", + args: args{ + addr: uint64(startPC), + offset: 0, + count: 100, + }, + wantInstructions: procInstructions, + wantOffset: 0, + wantErr: false, + }, + { + name: "request all (with offset)", + args: args{ + addr: uint64(startPC + numInstructions), // the instruction addr at numInstructions/2 + offset: -numInstructions / 2, + count: numInstructions, + }, + wantInstructions: procInstructions, + wantOffset: 0, + wantErr: false, + }, + { + name: "request half (with offset)", + args: args{ + addr: uint64(startPC), + offset: 0, + count: numInstructions / 2, + }, + wantInstructions: procInstructions[:numInstructions/2], + wantOffset: 0, + wantErr: false, + }, + { + name: "request half (with offset)", + args: args{ + addr: uint64(startPC), + offset: numInstructions / 2, + count: numInstructions / 2, + }, + wantInstructions: procInstructions[numInstructions/2:], + wantOffset: 0, + wantErr: false, + }, + { + name: "request too many", + args: args{ + addr: uint64(startPC), + offset: 0, + count: numInstructions * 2, + }, + wantInstructions: procInstructions, + wantOffset: 0, + wantErr: false, + }, + { + name: "request too many with offset", + args: args{ + addr: uint64(startPC), + offset: -numInstructions, + count: numInstructions * 2, + }, + wantInstructions: procInstructions, + wantOffset: numInstructions, + wantErr: false, + }, + { + name: "request out of bounds", + args: args{ + addr: uint64(startPC), + offset: -numInstructions, + count: numInstructions, + }, + wantInstructions: []proc.AsmInstruction{}, + wantOffset: 0, + wantErr: false, + }, + { + name: "request out of bounds", + args: args{ + addr: uint64(uint64(startPC + 2*(numInstructions-1))), + offset: 1, + count: numInstructions, + }, + wantInstructions: []proc.AsmInstruction{}, + wantOffset: 0, + wantErr: false, + }, + { + name: "addr out of bounds (low)", + args: args{ + addr: 0, + offset: 0, + count: 100, + }, + wantInstructions: nil, + wantOffset: -1, + wantErr: true, + }, + { + name: "addr out of bounds (high)", + args: args{ + addr: uint64(startPC + 2*(numInstructions+1)), + offset: -10, + count: 20, + }, + wantInstructions: nil, + wantOffset: -1, + wantErr: true, + }, + { + name: "addr not aligned", + args: args{ + addr: uint64(startPC + 1), + offset: 0, + count: 20, + }, + wantInstructions: nil, + wantOffset: -1, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + gotInstructions, gotOffset, err := findInstructions(procInstructions, tt.args.addr, tt.args.offset, tt.args.count) + if (err != nil) != tt.wantErr { + t.Errorf("findInstructions() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(gotInstructions, tt.wantInstructions) { + t.Errorf("findInstructions() got instructions = %v, want %v", gotInstructions, tt.wantInstructions) + } + if gotOffset != tt.wantOffset { + t.Errorf("findInstructions() got offset = %v, want %v", gotOffset, tt.wantOffset) + } + }) + } } diff --git a/service/dap/types.go b/service/dap/types.go new file mode 100644 index 0000000000..e078b50024 --- /dev/null +++ b/service/dap/types.go @@ -0,0 +1,251 @@ +package dap + +import ( + "encoding/json" + "errors" + "fmt" +) + +// Launch debug sessions support the following modes: +// -- [DEFAULT] "debug" - builds and launches debugger for specified program (similar to 'dlv debug') +// Required args: program +// Optional args with default: output, cwd, noDebug +// Optional args: buildFlags, args +// -- "test" - builds and launches debugger for specified test (similar to 'dlv test') +// same args as above +// -- "exec" - launches debugger for precompiled binary (similar to 'dlv exec') +// Required args: program +// Optional args with default: cwd, noDebug +// Optional args: args +// -- "replay" - replays a trace generated by mozilla rr. Mozilla rr must be installed. +// Required args: traceDirPath +// Optional args: args +// -- "core" - examines a core dump (only supports linux and windows core dumps). +// Required args: program, coreFilePath +// Optional args: args +// +// TODO(hyangah): change this to 'validateLaunchMode' that checks +// all the required/optional fields mentioned above. +func isValidLaunchMode(mode string) bool { + switch mode { + case "exec", "debug", "test", "replay", "core": + return true + } + return false +} + +// Default values for Launch/Attach configs. +// Used to initialize configuration variables before decoding +// arguments in launch/attach requests. +var ( + defaultLaunchAttachCommonConfig = LaunchAttachCommonConfig{ + Backend: "default", + StackTraceDepth: 50, + } + defaultLaunchConfig = LaunchConfig{ + Mode: "debug", + LaunchAttachCommonConfig: defaultLaunchAttachCommonConfig, + } + defaultAttachConfig = AttachConfig{ + Mode: "local", + LaunchAttachCommonConfig: defaultLaunchAttachCommonConfig, + } +) + +// LaunchConfig is the collection of launch request attributes recognized by DAP implementation. +type LaunchConfig struct { + // Acceptable values are: + // "debug": compiles your program with optimizations disabled, starts and attaches to it. + // "test": compiles your unit test program with optimizations disabled, starts and attaches to it. + // "exec": executes a precompiled binary and begins a debug session. + // "replay": replays an rr trace. + // "core": examines a core dump. + // + // Default is "debug". + Mode string `json:"mode,omitempty"` + + // Path to the program folder (or any go file within that folder) + // when in `debug` or `test` mode, and to the pre-built binary file + // to debug in `exec` mode. + // If it is not an absolute path, it will be interpreted as a path + // relative to Delve's working directory. + // Required when mode is `debug`, `test`, `exec`, and `core`. + Program string `json:"program,omitempty"` + + // Command line arguments passed to the debugged program. + // Relative paths used in Args will be interpreted as paths relative + // to `cwd`. + Args []string `json:"args,omitempty"` + + // Working directory of the program being debugged. + // If a relative path is provided, it will be interpreted as + // a relative path to Delve's working directory. This is + // similar to `dlv --wd` flag. + // + // If not specified or empty, Delve's working directory is + // used by default. But for `test` mode, Delve tries to find + // the test's package source directory and run tests from there. + // This matches the behavior of `dlv test` and `go test`. + Cwd string `json:"cwd,omitempty"` + + // Build flags, to be passed to the Go compiler. + // Relative paths used in BuildFlags will be interpreted as paths + // relative to Delve's current working directory. + // + // It is like `dlv --build-flags`. For example, + // "buildFlags": "-tags=integration -mod=vendor -cover -v" + BuildFlags string `json:"buildFlags,omitempty"` + + // Output path for the binary of the debugee. + // Relative path is interpreted as the path relative to + // the Delve's current working directory. + // This is deleted after the debug session ends. + Output string `json:"output,omitempty"` + + // NoDebug is used to run the program without debugging. + NoDebug bool `json:"noDebug,omitempty"` + + // TraceDirPath is the trace directory path for replay mode. + // Relative path is interpreted as a path relative to Delve's + // current working directory. + // This is required for "replay" mode but unused in other modes. + TraceDirPath string `json:"traceDirPath,omitempty"` + + // CoreFilePath is the core file path for core mode. + // + // This is required for "core" mode but unused in other modes. + CoreFilePath string `json:"coreFilePath,omitempty"` + + // DlvCwd is the new working directory for Delve server. + // If specified, the server will change its working + // directory to the specified directory using os.Chdir. + // Any other launch attributes with relative paths interpreted + // using Delve's working directory will use this new directory. + // When Delve needs to build the program (in debug/test modes), + // it will run the go command from this directory as well. + // + // If a relative path is provided as DlvCwd, it will be + // interpreted as a path relative to Delve's current working + // directory. + DlvCwd string `json:"dlvCwd,omitempty"` + + // Env specifies optional environment variables for Delve server + // in addition to the environment variables Delve initially + // started with. + // Variables with 'nil' values can be used to unset the named + // environment variables. + // Values are interpreted verbatim. Variable substitution or + // reference to other environment variables is not supported. + Env map[string]*string `json:"env,omitempty"` + + LaunchAttachCommonConfig +} + +// LaunchAttachCommonConfig is the attributes common in both launch/attach requests. +type LaunchAttachCommonConfig struct { + // Automatically stop program after launch or attach. + StopOnEntry bool `json:"stopOnEntry,omitempty"` + + // Backend used for debugging. See `dlv backend` for allowed values. + // Default is "default". + Backend string `json:"backend,omitempty"` + + // Maximum depth of stack trace to return. + // Default is 50. + StackTraceDepth int `json:"stackTraceDepth,omitempty"` + + // Boolean value to indicate whether global package variables + // should be shown in the variables pane or not. + ShowGlobalVariables bool `json:"showGlobalVariables,omitempty"` + + // Boolean value to indicate whether registers should be shown + // in the variables pane or not. + ShowRegisters bool `json:"showRegisters,omitempty"` + + // Boolean value to indicate whether system goroutines + // should be hidden from the call stack view. + HideSystemGoroutines bool `json:"hideSystemGoroutines,omitempty"` + + // String value to indicate which system goroutines should be + // shown in the call stack view. See filtering documentation: + // https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md#goroutines + GoroutineFilters string `json:"goroutineFilters,omitempty"` + + // An array of mappings from a local path (client) to the remote path (debugger). + // This setting is useful when working in a file system with symbolic links, + // running remote debugging, or debugging an executable compiled externally. + // The debug adapter will replace the local path with the remote path in all of the calls. + SubstitutePath []SubstitutePath `json:"substitutePath,omitempty"` +} + +// SubstitutePath defines a mapping from a local path to the remote path. +// Both 'from' and 'to' must be specified and non-empty. +type SubstitutePath struct { + // The local path to be replaced when passing paths to the debugger. + From string `json:"from,omitempty"` + // The remote path to be replaced when passing paths back to the client. + To string `json:"to,omitempty"` +} + +func (m *SubstitutePath) UnmarshalJSON(data []byte) error { + // use custom unmarshal to check if both from/to are set. + type tmpType SubstitutePath + var tmp tmpType + + if err := json.Unmarshal(data, &tmp); err != nil { + if _, ok := err.(*json.UnmarshalTypeError); ok { + return fmt.Errorf(`cannot use %s as 'substitutePath' of type {"from":string, "to":string}`, data) + } + return err + } + if tmp.From == "" || tmp.To == "" { + return errors.New("'substitutePath' requires both 'from' and 'to' entries") + } + *m = SubstitutePath(tmp) + return nil +} + +// AttachConfig is the collection of attach request attributes recognized by DAP implementation. +type AttachConfig struct { + // Acceptable values are: + // "local": attaches to the local process with the given ProcessID. + // "remote": expects the debugger to already be running to "attach" to an in-progress debug session. + // + // Default is "local". + Mode string `json:"mode"` + + // The numeric ID of the process to be debugged. Required and must not be 0. + ProcessID int `json:"processId,omitempty"` + + LaunchAttachCommonConfig +} + +// unmarshalLaunchAttachArgs wraps unmarshalling of launch/attach request's +// arguments attribute. Upon unmarshal failure, it returns an error massaged +// to be suitable for end-users. +func unmarshalLaunchAttachArgs(input json.RawMessage, config interface{}) error { + if err := json.Unmarshal(input, config); err != nil { + if uerr, ok := err.(*json.UnmarshalTypeError); ok { + // Format json.UnmarshalTypeError error string in our own way. E.g., + // "json: cannot unmarshal number into Go struct field LaunchArgs.substitutePath of type dap.SubstitutePath" + // => "cannot unmarshal number into 'substitutePath' of type {from:string, to:string}" + // "json: cannot unmarshal number into Go struct field LaunchArgs.program of type string" (go1.16) + // => "cannot unmarshal number into 'program' of type string" + typ := uerr.Type.String() + if uerr.Field == "substitutePath" { + typ = `{"from":string, "to":string}` + } + return fmt.Errorf("cannot unmarshal %v into %q of type %v", uerr.Value, uerr.Field, typ) + } + return err + } + return nil +} + +func prettyPrint(config interface{}) string { + pretty, err := json.MarshalIndent(config, "", "\t") + if err != nil { + return fmt.Sprintf("%#v", config) + } + return string(pretty) +} diff --git a/service/dap/utils.go b/service/dap/utils.go deleted file mode 100644 index 5b4ff3b48e..0000000000 --- a/service/dap/utils.go +++ /dev/null @@ -1,10 +0,0 @@ -package dap - -// min returns the lowest-valued integer -// between the two passed into it. -func min(i, j int) int { - if i < j { - return i - } - return j -} diff --git a/service/debugger/debugger.go b/service/debugger/debugger.go index 08c465d31e..17c562bac1 100644 --- a/service/debugger/debugger.go +++ b/service/debugger/debugger.go @@ -6,11 +6,13 @@ import ( "errors" "fmt" "go/parser" + "go/token" "os" "path/filepath" "regexp" "runtime" "sort" + "strconv" "strings" "sync" "time" @@ -37,6 +39,12 @@ var ( // ErrNotRecording is returned when StopRecording is called while the // debugger is not recording the target. ErrNotRecording = errors.New("debugger is not recording") + + // ErrCoreDumpInProgress is returned when a core dump is already in progress. + ErrCoreDumpInProgress = errors.New("core dump in progress") + + // ErrCoreDumpNotSupported is returned when core dumping is not supported + ErrCoreDumpNotSupported = errors.New("core dumping not supported") ) // Debugger service. @@ -62,6 +70,12 @@ type Debugger struct { stopRecording func() error recordMutex sync.Mutex + + dumpState proc.DumpState + // Debugger keeps a map of disabled breakpoints + // so lower layers like proc doesn't need to deal + // with them + disabledBreakpoints map[int]*api.Breakpoint } type ExecuteKind int @@ -120,6 +134,9 @@ type Config struct { // Redirects specifies redirect rules for stdin, stdout and stderr Redirects [3]string + + // DisableASLR disables ASLR + DisableASLR bool } // New creates a new Debugger. ProcessArgs specify the commandline arguments for the @@ -187,6 +204,9 @@ func New(config *Config, processArgs []string) (*Debugger, error) { return nil, err } } + + d.disabledBreakpoints = make(map[int]*api.Breakpoint) + return d, nil } @@ -203,9 +223,6 @@ func (d *Debugger) canRestart() bool { } func (d *Debugger) checkGoVersion() error { - if !d.config.CheckGoVersion { - return nil - } if d.isRecording() { // do not do anything if we are still recording return nil @@ -214,7 +231,13 @@ func (d *Debugger) checkGoVersion() error { if producer == "" { return nil } - return goversion.Compatible(producer) + return goversion.Compatible(producer, !d.config.CheckGoVersion) +} + +func (d *Debugger) TargetGoVersion() string { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + return d.target.BinInfo().Producer() } // Launch will start a process with the given args and working directory. @@ -222,11 +245,20 @@ func (d *Debugger) Launch(processArgs []string, wd string) (*proc.Target, error) if err := verifyBinaryFormat(processArgs[0]); err != nil { return nil, err } + + launchFlags := proc.LaunchFlags(0) + if d.config.Foreground { + launchFlags |= proc.LaunchForeground + } + if d.config.DisableASLR { + launchFlags |= proc.LaunchDisableASLR + } + switch d.config.Backend { case "native": - return native.Launch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories, d.config.TTY, d.config.Redirects) + return native.Launch(processArgs, wd, launchFlags, d.config.DebugInfoDirectories, d.config.TTY, d.config.Redirects) case "lldb": - return betterGdbserialLaunchError(gdbserial.LLDBLaunch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories, d.config.TTY, d.config.Redirects)) + return betterGdbserialLaunchError(gdbserial.LLDBLaunch(processArgs, wd, launchFlags, d.config.DebugInfoDirectories, d.config.TTY, d.config.Redirects)) case "rr": if d.target != nil { // restart should not call us if the backend is 'rr' @@ -268,9 +300,9 @@ func (d *Debugger) Launch(processArgs []string, wd string) (*proc.Target, error) case "default": if runtime.GOOS == "darwin" { - return betterGdbserialLaunchError(gdbserial.LLDBLaunch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories, d.config.TTY, d.config.Redirects)) + return betterGdbserialLaunchError(gdbserial.LLDBLaunch(processArgs, wd, launchFlags, d.config.DebugInfoDirectories, d.config.TTY, d.config.Redirects)) } - return native.Launch(processArgs, wd, d.config.Foreground, d.config.DebugInfoDirectories, d.config.TTY, d.config.Redirects) + return native.Launch(processArgs, wd, launchFlags, d.config.DebugInfoDirectories, d.config.TTY, d.config.Redirects) default: return nil, fmt.Errorf("unknown backend %q", d.config.Backend) } @@ -349,8 +381,6 @@ func (d *Debugger) LastModified() time.Time { return d.target.BinInfo().LastModified() } -const deferReturn = "runtime.deferreturn" - // FunctionReturnLocations returns all return locations // for the given function, a list of addresses corresponding // to 'ret' or 'call runtime.deferreturn'. @@ -363,29 +393,31 @@ func (d *Debugger) FunctionReturnLocations(fnName string) ([]uint64, error) { g = p.SelectedGoroutine() ) - fn, ok := p.BinInfo().LookupFunc[fnName] - if !ok { - return nil, fmt.Errorf("unable to find function %s", fnName) - } - - var regs proc.Registers - var mem proc.MemoryReadWriter = p.CurrentThread() - if g != nil && g.Thread != nil { - mem = g.Thread - regs, _ = g.Thread.Registers() - } - instructions, err := proc.Disassemble(mem, regs, p.Breakpoints(), p.BinInfo(), fn.Entry, fn.End) + fns, err := p.BinInfo().FindFunction(fnName) if err != nil { return nil, err } var addrs []uint64 - for _, instruction := range instructions { - if instruction.IsRet() { - addrs = append(addrs, instruction.Loc.PC) + + for _, fn := range fns { + var regs proc.Registers + mem := p.Memory() + if g != nil && g.Thread != nil { + regs, _ = g.Thread.Registers() } + instructions, err := proc.Disassemble(mem, regs, p.Breakpoints(), p.BinInfo(), fn.Entry, fn.End) + if err != nil { + return nil, err + } + + for _, instruction := range instructions { + if instruction.IsRet() { + addrs = append(addrs, instruction.Loc.PC) + } + } + addrs = append(addrs, proc.FindDeferReturnCalls(instructions)...) } - addrs = append(addrs, proc.FindDeferReturnCalls(instructions)...) return addrs, nil } @@ -394,9 +426,12 @@ func (d *Debugger) FunctionReturnLocations(fnName string) ([]uint64, error) { // If `kill` is true we will kill the process after // detaching. func (d *Debugger) Detach(kill bool) error { + d.log.Debug("detaching") d.targetMutex.Lock() defer d.targetMutex.Unlock() - + if ok, _ := d.target.Valid(); !ok { + return nil + } return d.detach(kill) } @@ -418,6 +453,7 @@ func (d *Debugger) Restart(rerecord bool, pos string, resetArgs bool, newArgs [] recorded, _ := d.target.Recorded() if recorded && !rerecord { + d.target.ResumeNotify(nil) return nil, d.target.Restart(pos) } @@ -480,23 +516,32 @@ func (d *Debugger) Restart(rerecord bool, pos string, resetArgs bool, newArgs [] } discarded := []api.DiscardedBreakpoint{} - for _, oldBp := range api.ConvertBreakpoints(d.breakpoints()) { + breakpoints := api.ConvertBreakpoints(d.breakpoints()) + d.target = p + maxID := 0 + for _, oldBp := range breakpoints { if oldBp.ID < 0 { continue } - if len(oldBp.File) > 0 { + if oldBp.ID > maxID { + maxID = oldBp.ID + } + if oldBp.WatchExpr != "" { + discarded = append(discarded, api.DiscardedBreakpoint{Breakpoint: oldBp, Reason: "can not recreate watchpoints on restart"}) + } else if len(oldBp.File) > 0 { addrs, err := proc.FindFileLocation(p, oldBp.File, oldBp.Line) if err != nil { discarded = append(discarded, api.DiscardedBreakpoint{Breakpoint: oldBp, Reason: err.Error()}) continue } - createLogicalBreakpoint(p, addrs, oldBp) + createLogicalBreakpoint(d, addrs, oldBp, oldBp.ID) } else { // Avoid setting a breakpoint based on address when rebuilding if rebuild { + discarded = append(discarded, api.DiscardedBreakpoint{Breakpoint: oldBp, Reason: "can not recreate address breakpoints on restart"}) continue } - newBp, err := p.SetBreakpoint(oldBp.Addr, proc.UserBreakpoint, nil) + newBp, err := p.SetBreakpointWithID(oldBp.ID, oldBp.Addr) if err != nil { return nil, err } @@ -505,13 +550,18 @@ func (d *Debugger) Restart(rerecord bool, pos string, resetArgs bool, newArgs [] } } } - d.target = p + for _, bp := range d.disabledBreakpoints { + if bp.ID > maxID { + maxID = bp.ID + } + } + d.target.SetNextBreakpointID(maxID) return discarded, nil } // State returns the current state of the debugger. func (d *Debugger) State(nowait bool) (*api.DebuggerState, error) { - if d.isRunning() && nowait { + if d.IsRunning() && nowait { return &api.DebuggerState{Running: true}, nil } @@ -519,6 +569,12 @@ func (d *Debugger) State(nowait bool) (*api.DebuggerState, error) { return &api.DebuggerState{Recording: true}, nil } + d.dumpState.Mutex.Lock() + if d.dumpState.Dumping && nowait { + return &api.DebuggerState{CoreDumping: true}, nil + } + d.dumpState.Mutex.Unlock() + d.targetMutex.Lock() defer d.targetMutex.Unlock() return d.state(nil) @@ -535,12 +591,12 @@ func (d *Debugger) state(retLoadCfg *proc.LoadConfig) (*api.DebuggerState, error ) if d.target.SelectedGoroutine() != nil { - goroutine = api.ConvertGoroutine(d.target.SelectedGoroutine()) + goroutine = api.ConvertGoroutine(d.target, d.target.SelectedGoroutine()) } exited := false if _, err := d.target.Valid(); err != nil { - _, exited = err.(*proc.ErrProcessExited) + _, exited = err.(proc.ErrProcessExited) } state = &api.DebuggerState{ @@ -551,8 +607,9 @@ func (d *Debugger) state(retLoadCfg *proc.LoadConfig) (*api.DebuggerState, error for _, thread := range d.target.ThreadList() { th := api.ConvertThread(thread) + th.CallReturn = thread.Common().CallReturn if retLoadCfg != nil { - th.ReturnValues = convertVars(thread.Common().ReturnValues(*retLoadCfg)) + th.ReturnValues = api.ConvertVars(thread.Common().ReturnValues(*retLoadCfg)) } state.Threads = append(state.Threads, th) @@ -561,16 +618,47 @@ func (d *Debugger) state(retLoadCfg *proc.LoadConfig) (*api.DebuggerState, error } } - state.NextInProgress = d.target.Breakpoints().HasInternalBreakpoints() + state.NextInProgress = d.target.Breakpoints().HasSteppingBreakpoints() if recorded, _ := d.target.Recorded(); recorded { state.When, _ = d.target.When() } + state.WatchOutOfScope = make([]*api.Breakpoint, 0, len(d.target.Breakpoints().WatchOutOfScope)) + for _, bp := range d.target.Breakpoints().WatchOutOfScope { + state.WatchOutOfScope = append(state.WatchOutOfScope, api.ConvertBreakpoint(bp)) + } + return state, nil } -// CreateBreakpoint creates a breakpoint. +// CreateBreakpoint creates a breakpoint using information from the provided `requestedBp`. +// This function accepts several different ways of specifying where and how to create the +// breakpoint that has been requested. Any error encountered during the attempt to set the +// breakpoint will be returned to the caller. +// +// The ways of specifying a breakpoint are listed below in the order they are considered by +// this function: +// +// - If requestedBp.TraceReturn is true then it is expected that +// requestedBp.Addrs will contain the list of return addresses +// supplied by the caller. +// +// - If requestedBp.File is not an empty string the breakpoint +// will be created on the specified file:line location +// +// - If requestedBp.FunctionName is not an empty string +// the breakpoint will be created on the specified function:line +// location. +// +// - If requestedBp.Addrs is filled it will create a logical breakpoint +// corresponding to all specified addresses. +// +// - Otherwise the value specified by arg.Breakpoint.Addr will be used. +// +// Note that this method will use the first successful method in order to +// create a breakpoint, so mixing different fields will not result is multiple +// breakpoints being set. func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() @@ -581,10 +669,7 @@ func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoin ) if requestedBp.Name != "" { - if err = api.ValidBreakpointName(requestedBp.Name); err != nil { - return nil, err - } - if d.findBreakpointByName(requestedBp.Name) != nil { + if (d.findBreakpointByName(requestedBp.Name) != nil) || (d.findDisabledBreakpointByName(requestedBp.Name) != nil) { return nil, errors.New("breakpoint name already exists") } } @@ -617,7 +702,7 @@ func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoin return nil, err } - createdBp, err := createLogicalBreakpoint(d.target, addrs, requestedBp) + createdBp, err := createLogicalBreakpoint(d, addrs, requestedBp, 0) if err != nil { return nil, err } @@ -627,17 +712,27 @@ func (d *Debugger) CreateBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoin // createLogicalBreakpoint creates one physical breakpoint for each address // in addrs and associates all of them with the same logical breakpoint. -func createLogicalBreakpoint(p *proc.Target, addrs []uint64, requestedBp *api.Breakpoint) (*api.Breakpoint, error) { +func createLogicalBreakpoint(d *Debugger, addrs []uint64, requestedBp *api.Breakpoint, id int) (*api.Breakpoint, error) { + p := d.target + + if dbp, ok := d.disabledBreakpoints[requestedBp.ID]; ok { + return dbp, proc.BreakpointExistsError{File: dbp.File, Line: dbp.Line, Addr: dbp.Addr} + } + bps := make([]*proc.Breakpoint, len(addrs)) var err error for i := range addrs { - bps[i], err = p.SetBreakpoint(addrs[i], proc.UserBreakpoint, nil) + if id > 0 { + bps[i], err = p.SetBreakpointWithID(id, addrs[i]) + } else { + bps[i], err = p.SetBreakpoint(addrs[i], proc.UserBreakpoint, nil) + if err == nil { + id = bps[i].LogicalID() + } + } if err != nil { break } - if i > 0 { - bps[i].LogicalID = bps[0].LogicalID - } err = copyBreakpointInfo(bps[i], requestedBp) if err != nil { break @@ -651,13 +746,14 @@ func createLogicalBreakpoint(p *proc.Target, addrs []uint64, requestedBp *api.Br if bp == nil { continue } - if _, err1 := p.ClearBreakpoint(bp.Addr); err1 != nil { + if err1 := p.ClearBreakpoint(bp.Addr); err1 != nil { err = fmt.Errorf("error while creating breakpoint: %v, additionally the breakpoint could not be properly rolled back: %v", err, err1) return nil, err } } return nil, err } + createdBp := api.ConvertBreakpoints(bps) return createdBp[0], nil // we created a single logical breakpoint, the slice here will always have len == 1 } @@ -667,32 +763,76 @@ func isBreakpointExistsErr(err error) bool { return r } -// AmendBreakpoint will update the breakpoint with the matching ID. -func (d *Debugger) AmendBreakpoint(amend *api.Breakpoint) error { +func (d *Debugger) CreateEBPFTracepoint(fnName string) error { d.targetMutex.Lock() defer d.targetMutex.Unlock() + return d.target.SetEBPFTracepoint(fnName) +} + +// amendBreakpoint will update the breakpoint with the matching ID. +// It also enables or disables the breakpoint. +// We can consume this function to avoid locking a goroutine. +func (d *Debugger) amendBreakpoint(amend *api.Breakpoint) error { originals := d.findBreakpoint(amend.ID) - if originals == nil { + + if len(originals) > 0 && originals[0].WatchExpr != "" && amend.Disabled { + return errors.New("can not disable watchpoints") + } + + _, disabled := d.disabledBreakpoints[amend.ID] + if originals == nil && !disabled { return fmt.Errorf("no breakpoint with ID %d", amend.ID) } - if err := api.ValidBreakpointName(amend.Name); err != nil { - return err + if !amend.Disabled && disabled { // enable the breakpoint + bp, err := d.target.SetBreakpointWithID(amend.ID, amend.Addr) + if err != nil { + return err + } + copyBreakpointInfo(bp, amend) + if breaklet := bp.UserBreaklet(); breaklet != nil { + breaklet.TotalHitCount = amend.TotalHitCount + breaklet.HitCount = map[int]uint64{} + for idx := range amend.HitCount { + i, err := strconv.Atoi(idx) + if err != nil { + return fmt.Errorf("can't convert goroutine ID: %w", err) + } + breaklet.HitCount[i] = amend.HitCount[idx] + } + } + delete(d.disabledBreakpoints, amend.ID) + } + if amend.Disabled && !disabled { // disable the breakpoint + if _, err := d.clearBreakpoint(amend); err != nil { + return err + } + d.disabledBreakpoints[amend.ID] = amend } for _, original := range originals { if err := copyBreakpointInfo(original, amend); err != nil { return err } } + return nil } +// AmendBreakpoint will update the breakpoint with the matching ID. +// It also enables or disables the breakpoint. +func (d *Debugger) AmendBreakpoint(amend *api.Breakpoint) error { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + + return d.amendBreakpoint(amend) +} + // CancelNext will clear internal breakpoints, thus cancelling the 'next', // 'step' or 'stepout' operation. func (d *Debugger) CancelNext() error { d.targetMutex.Lock() defer d.targetMutex.Unlock() - return d.target.ClearInternalBreakpoints() + return d.target.ClearSteppingBreakpoints() } func copyBreakpointInfo(bp *proc.Breakpoint, requested *api.Breakpoint) (err error) { @@ -702,30 +842,93 @@ func copyBreakpointInfo(bp *proc.Breakpoint, requested *api.Breakpoint) (err err bp.Goroutine = requested.Goroutine bp.Stacktrace = requested.Stacktrace bp.Variables = requested.Variables + bp.UserData = requested.UserData bp.LoadArgs = api.LoadConfigToProc(requested.LoadArgs) bp.LoadLocals = api.LoadConfigToProc(requested.LoadLocals) - bp.Cond = nil - if requested.Cond != "" { - bp.Cond, err = parser.ParseExpr(requested.Cond) + breaklet := bp.UserBreaklet() + if breaklet != nil { + breaklet.Cond = nil + if requested.Cond != "" { + breaklet.Cond, err = parser.ParseExpr(requested.Cond) + } + breaklet.HitCond = nil + if requested.HitCond != "" { + opTok, val, parseErr := parseHitCondition(requested.HitCond) + if err == nil { + err = parseErr + } + if parseErr == nil { + breaklet.HitCond = &struct { + Op token.Token + Val int + }{opTok, val} + } + } } return err } +func parseHitCondition(hitCond string) (token.Token, int, error) { + // A hit condition can be in the following formats: + // - "number" + // - "OP number" + hitConditionRegex := regexp.MustCompile(`((=|>|<|%|!)+|)( |)((\d|_)+)`) + + match := hitConditionRegex.FindStringSubmatch(strings.TrimSpace(hitCond)) + if match == nil || len(match) != 6 { + return 0, 0, fmt.Errorf("unable to parse breakpoint hit condition: %q\nhit conditions should be of the form \"number\" or \"OP number\"", hitCond) + } + + opStr := match[1] + var opTok token.Token + switch opStr { + case "==", "": + opTok = token.EQL + case ">=": + opTok = token.GEQ + case "<=": + opTok = token.LEQ + case ">": + opTok = token.GTR + case "<": + opTok = token.LSS + case "%": + opTok = token.REM + case "!=": + opTok = token.NEQ + default: + return 0, 0, fmt.Errorf("unable to parse breakpoint hit condition: %q\ninvalid operator: %q", hitCond, opStr) + } + + numStr := match[4] + val, parseErr := strconv.Atoi(numStr) + if parseErr != nil { + return 0, 0, fmt.Errorf("unable to parse breakpoint hit condition: %q\ninvalid number: %q", hitCond, numStr) + } + + return opTok, val, nil +} + // ClearBreakpoint clears a breakpoint. func (d *Debugger) ClearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() + return d.clearBreakpoint(requestedBp) +} - var bps []*proc.Breakpoint - var errs []error +// clearBreakpoint clears a breakpoint, we can consume this function to avoid locking a goroutine +func (d *Debugger) clearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint, error) { + if bp, ok := d.disabledBreakpoints[requestedBp.ID]; ok { + delete(d.disabledBreakpoints, bp.ID) + return bp, nil + } - clear := func(addr uint64) { - bp, err := d.target.ClearBreakpoint(addr) - if err != nil { - errs = append(errs, fmt.Errorf("address %#x: %v", addr, err)) - } + var clearBps []*proc.Breakpoint + + toclear := func(addr uint64) { + bp := d.target.Breakpoints().M[addr] if bp != nil { - bps = append(bps, bp) + clearBps = append(clearBps, bp) } } @@ -734,10 +937,23 @@ func (d *Debugger) ClearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint if addr == requestedBp.Addr { clearAddr = false } - clear(addr) + toclear(addr) } if clearAddr { - clear(requestedBp.Addr) + toclear(requestedBp.Addr) + } + + // Breakpoints need to be converted before clearing them or they won't have + // an ID anymore. + sort.Sort(breakpointsByLogicalID(clearBps)) + clearedBp := api.ConvertBreakpoints(clearBps)[0] + + var errs []error + for _, bp := range clearBps { + err := d.target.ClearBreakpoint(bp.Addr) + if err != nil { + errs = append(errs, fmt.Errorf("address %#x: %v", bp.Addr, err)) + } } if len(errs) > 0 { @@ -749,25 +965,65 @@ func (d *Debugger) ClearBreakpoint(requestedBp *api.Breakpoint) (*api.Breakpoint } } - if len(bps) == 0 { + if len(errs) == len(clearBps) { return nil, fmt.Errorf("unable to clear breakpoint %d: %v", requestedBp.ID, buf.String()) } return nil, fmt.Errorf("unable to clear breakpoint %d (partial): %s", requestedBp.ID, buf.String()) } - clearedBp := api.ConvertBreakpoints(bps) - if len(clearedBp) < 0 { - return nil, nil - } d.log.Infof("cleared breakpoint: %#v", clearedBp) - return clearedBp[0], nil + return clearedBp, nil +} + +// isBpHitCondNotSatisfiable returns true if the breakpoint bp has a hit +// condition that is no more satisfiable. +// The hit condition is considered no more satisfiable if it can no longer be +// hit again, for example with {Op: "==", Val: 1} and TotalHitCount == 1. +func isBpHitCondNotSatisfiable(bp *api.Breakpoint) bool { + if bp.HitCond == "" { + return false + } + + tok, val, err := parseHitCondition(bp.HitCond) + if err != nil { + return false + } + switch tok { + case token.EQL, token.LEQ: + if int(bp.TotalHitCount) >= val { + return true + } + case token.LSS: + if int(bp.TotalHitCount) >= val-1 { + return true + } + } + + return false } // Breakpoints returns the list of current breakpoints. -func (d *Debugger) Breakpoints() []*api.Breakpoint { +func (d *Debugger) Breakpoints(all bool) []*api.Breakpoint { d.targetMutex.Lock() defer d.targetMutex.Unlock() - return api.ConvertBreakpoints(d.breakpoints()) + + var bps []*api.Breakpoint + + if !all { + bps = api.ConvertBreakpoints(d.breakpoints()) + } else { + for _, bp := range d.target.Breakpoints().M { + abp := api.ConvertBreakpoint(bp) + abp.VerboseDescr = bp.VerboseDescr() + bps = append(bps, abp) + } + } + + for _, bp := range d.disabledBreakpoints { + bps = append(bps, bp) + } + + return bps } func (d *Debugger) breakpoints() []*proc.Breakpoint { @@ -786,6 +1042,7 @@ func (d *Debugger) FindBreakpoint(id int) *api.Breakpoint { d.targetMutex.Lock() defer d.targetMutex.Unlock() bps := api.ConvertBreakpoints(d.findBreakpoint(id)) + bps = append(bps, d.findDisabledBreakpoint(id)...) if len(bps) <= 0 { return nil } @@ -795,18 +1052,33 @@ func (d *Debugger) FindBreakpoint(id int) *api.Breakpoint { func (d *Debugger) findBreakpoint(id int) []*proc.Breakpoint { var bps []*proc.Breakpoint for _, bp := range d.target.Breakpoints().M { - if bp.LogicalID == id { + if bp.LogicalID() == id { bps = append(bps, bp) } } return bps } +func (d *Debugger) findDisabledBreakpoint(id int) []*api.Breakpoint { + var bps []*api.Breakpoint + for _, dbp := range d.disabledBreakpoints { + if dbp.ID == id { + bps = append(bps, dbp) + } + } + return bps +} + // FindBreakpointByName returns the breakpoint specified by 'name' func (d *Debugger) FindBreakpointByName(name string) *api.Breakpoint { d.targetMutex.Lock() defer d.targetMutex.Unlock() - return d.findBreakpointByName(name) + + bp := d.findBreakpointByName(name) + if bp == nil { + bp = d.findDisabledBreakpointByName(name) + } + return bp } func (d *Debugger) findBreakpointByName(name string) *api.Breakpoint { @@ -824,8 +1096,33 @@ func (d *Debugger) findBreakpointByName(name string) *api.Breakpoint { return r[0] // there can only be one logical breakpoint with the same name } +func (d *Debugger) findDisabledBreakpointByName(name string) *api.Breakpoint { + for _, dbp := range d.disabledBreakpoints { + if dbp.Name == name { + return dbp + } + } + return nil +} + +// CreateWatchpoint creates a watchpoint on the specified expression. +func (d *Debugger) CreateWatchpoint(goid, frame, deferredCall int, expr string, wtype api.WatchType) (*api.Breakpoint, error) { + s, err := proc.ConvertEvalScope(d.target, goid, frame, deferredCall) + if err != nil { + return nil, err + } + bp, err := d.target.SetWatchpoint(s, expr, proc.WatchType(wtype), nil) + if err != nil { + return nil, err + } + if d.findBreakpointByName(expr) == nil { + bp.Name = expr + } + return api.ConvertBreakpoint(bp), nil +} + // Threads returns the threads of the target process. -func (d *Debugger) Threads() ([]*api.Thread, error) { +func (d *Debugger) Threads() ([]proc.Thread, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() @@ -833,15 +1130,11 @@ func (d *Debugger) Threads() ([]*api.Thread, error) { return nil, err } - threads := []*api.Thread{} - for _, th := range d.target.ThreadList() { - threads = append(threads, api.ConvertThread(th)) - } - return threads, nil + return d.target.ThreadList(), nil } // FindThread returns the thread for the given 'id'. -func (d *Debugger) FindThread(id int) (*api.Thread, error) { +func (d *Debugger) FindThread(id int) (proc.Thread, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() @@ -851,26 +1144,34 @@ func (d *Debugger) FindThread(id int) (*api.Thread, error) { for _, th := range d.target.ThreadList() { if th.ThreadID() == id { - return api.ConvertThread(th), nil + return th, nil } } return nil, nil } +// FindGoroutine returns the goroutine for the given 'id'. +func (d *Debugger) FindGoroutine(id int) (*proc.G, error) { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + + return proc.FindGoroutine(d.target, id) +} + func (d *Debugger) setRunning(running bool) { d.runningMutex.Lock() d.running = running d.runningMutex.Unlock() } -func (d *Debugger) isRunning() bool { +func (d *Debugger) IsRunning() bool { d.runningMutex.Lock() defer d.runningMutex.Unlock() return d.running } // Command handles commands which control the debugger lifecycle -func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, error) { +func (d *Debugger) Command(command *api.DebuggerCommand, resumeNotify chan struct{}) (*api.DebuggerState, error) { var err error if command.Name == api.Halt { @@ -881,6 +1182,11 @@ func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, er d.recordMutex.Lock() if d.stopRecording == nil { err = d.target.RequestManualStop() + // The error returned from d.target.Valid will have more context + // about the exited process. + if _, valErr := d.target.Valid(); valErr != nil { + err = valErr + } } d.recordMutex.Unlock() } @@ -893,6 +1199,12 @@ func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, er d.setRunning(true) defer d.setRunning(false) + if command.Name != api.SwitchGoroutine && command.Name != api.SwitchThread && command.Name != api.Halt { + d.target.ResumeNotify(resumeNotify) + } else if resumeNotify != nil { + close(resumeNotify) + } + switch command.Name { case api.Continue: d.log.Debug("continuing") @@ -979,7 +1291,8 @@ func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, er withBreakpointInfo = false case api.SwitchGoroutine: d.log.Debugf("switching to goroutine %d", command.GoroutineID) - g, err := proc.FindGoroutine(d.target, command.GoroutineID) + var g *proc.G + g, err = proc.FindGoroutine(d.target, command.GoroutineID) if err == nil { err = d.target.SwitchGoroutine(g) } @@ -990,11 +1303,12 @@ func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, er } if err != nil { - if exitedErr, exited := err.(proc.ErrProcessExited); command.Name != api.SwitchGoroutine && command.Name != api.SwitchThread && exited { + if pe, ok := err.(proc.ErrProcessExited); ok && command.Name != api.SwitchGoroutine && command.Name != api.SwitchThread { state := &api.DebuggerState{} + state.Pid = d.target.Pid() state.Exited = true - state.ExitStatus = exitedErr.Status - state.Err = errors.New(exitedErr.Error()) + state.ExitStatus = pe.Status + state.Err = pe return state, nil } return nil, err @@ -1015,6 +1329,10 @@ func (d *Debugger) Command(command *api.DebuggerCommand) (*api.DebuggerState, er } } } + if bp := state.CurrentThread.Breakpoint; bp != nil && isBpHitCondNotSatisfiable(bp) { + bp.Disabled = true + d.amendBreakpoint(bp) + } return state, err } @@ -1037,7 +1355,7 @@ func (d *Debugger) collectBreakpointInformation(state *api.DebuggerState) error if err != nil { return err } - bpi.Goroutine = api.ConvertGoroutine(g) + bpi.Goroutine = api.ConvertGoroutine(d.target, g) } if bp.Stacktrace > 0 { @@ -1061,7 +1379,7 @@ func (d *Debugger) collectBreakpointInformation(state *api.DebuggerState) error continue } - s, err := proc.GoroutineScope(thread) + s, err := proc.GoroutineScope(d.target, thread) if err != nil { return err } @@ -1070,7 +1388,7 @@ func (d *Debugger) collectBreakpointInformation(state *api.DebuggerState) error bpi.Variables = make([]api.Variable, len(bp.Variables)) } for i := range bp.Variables { - v, err := s.EvalVariable(bp.Variables[i], proc.LoadConfig{FollowPointers: true, MaxVariableRecurse: 1, MaxStringLen: 64, MaxArrayValues: 64, MaxStructFields: -1}) + v, err := s.EvalExpression(bp.Variables[i], proc.LoadConfig{FollowPointers: true, MaxVariableRecurse: 1, MaxStringLen: 64, MaxArrayValues: 64, MaxStructFields: -1}) if err != nil { bpi.Variables[i] = api.Variable{Name: bp.Variables[i], Unreadable: fmt.Sprintf("eval error: %v", err)} } else { @@ -1079,12 +1397,12 @@ func (d *Debugger) collectBreakpointInformation(state *api.DebuggerState) error } if bp.LoadArgs != nil { if vars, err := s.FunctionArguments(*api.LoadConfigToProc(bp.LoadArgs)); err == nil { - bpi.Arguments = convertVars(vars) + bpi.Arguments = api.ConvertVars(vars) } } if bp.LoadLocals != nil { if locals, err := s.LocalVariables(*api.LoadConfigToProc(bp.LoadLocals)); err == nil { - bpi.Locals = convertVars(locals) + bpi.Locals = api.ConvertVars(locals) } } } @@ -1157,7 +1475,7 @@ func (d *Debugger) Types(filter string) ([]string, error) { // PackageVariables returns a list of package variables for the thread, // optionally regexp filtered using regexp described in 'filter'. -func (d *Debugger) PackageVariables(threadID int, filter string, cfg proc.LoadConfig) ([]api.Variable, error) { +func (d *Debugger) PackageVariables(filter string, cfg proc.LoadConfig) ([]*proc.Variable, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() @@ -1166,12 +1484,7 @@ func (d *Debugger) PackageVariables(threadID int, filter string, cfg proc.LoadCo return nil, fmt.Errorf("invalid filter argument: %s", err.Error()) } - vars := []api.Variable{} - thread, found := d.target.FindThread(threadID) - if !found { - return nil, fmt.Errorf("couldn't find thread %d", threadID) - } - scope, err := proc.ThreadScope(thread) + scope, err := proc.ThreadScope(d.target, d.target.CurrentThread()) if err != nil { return nil, err } @@ -1179,146 +1492,112 @@ func (d *Debugger) PackageVariables(threadID int, filter string, cfg proc.LoadCo if err != nil { return nil, err } - for _, v := range pv { - if regex.Match([]byte(v.Name)) { - vars = append(vars, *api.ConvertVar(v)) + pvr := pv[:0] + for i := range pv { + if regex.Match([]byte(pv[i].Name)) { + pvr = append(pvr, pv[i]) } } - return vars, err + return pvr, nil } -// Registers returns string representation of the CPU registers. -func (d *Debugger) Registers(threadID int, scope *api.EvalScope, floatingPoint bool) (api.Registers, error) { +// ThreadRegisters returns registers of the specified thread. +func (d *Debugger) ThreadRegisters(threadID int, floatingPoint bool) (*op.DwarfRegisters, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() - var dregs op.DwarfRegisters - - if scope != nil { - s, err := proc.ConvertEvalScope(d.target, scope.GoroutineID, scope.Frame, scope.DeferredCall) - if err != nil { - return nil, err - } - dregs = s.Regs - } else { - thread, found := d.target.FindThread(threadID) - if !found { - return nil, fmt.Errorf("couldn't find thread %d", threadID) - } - regs, err := thread.Registers() - if err != nil { - return nil, err - } - dregs = d.target.BinInfo().Arch.RegistersToDwarfRegisters(0, regs) + thread, found := d.target.FindThread(threadID) + if !found { + return nil, fmt.Errorf("couldn't find thread %d", threadID) } - r := api.ConvertRegisters(dregs, d.target.BinInfo().Arch, floatingPoint) - if floatingPoint && dregs.FloatLoadError != nil { - return nil, dregs.FloatLoadError + regs, err := thread.Registers() + if err != nil { + return nil, err } - // Sort the registers in a canonical order we prefer, this is mostly - // because the DWARF register numbering for AMD64 is weird. - sort.Slice(r, func(i, j int) bool { - a, b := r[i], r[j] - an, aok := canonicalRegisterOrder[strings.ToLower(a.Name)] - bn, bok := canonicalRegisterOrder[strings.ToLower(b.Name)] - // Registers that don't appear in canonicalRegisterOrder sort after registers that do. - if !aok { - an = 1000 - } - if !bok { - bn = 1000 - } - if an == bn { - // keep registers that don't appear in canonicalRegisterOrder in DWARF order - return a.DwarfNumber < b.DwarfNumber - } - return an < bn - - }) - return r, nil + return d.target.BinInfo().Arch.RegistersToDwarfRegisters(0, regs), nil } -var canonicalRegisterOrder = map[string]int{ - // amd64 - "rip": 0, - "rsp": 1, - "rax": 2, - "rbx": 3, - "rcx": 4, - "rdx": 5, +// ScopeRegisters returns registers for the specified scope. +func (d *Debugger) ScopeRegisters(goid, frame, deferredCall int, floatingPoint bool) (*op.DwarfRegisters, error) { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() - // arm64 - "pc": 0, - "sp": 1, + s, err := proc.ConvertEvalScope(d.target, goid, frame, deferredCall) + if err != nil { + return nil, err + } + return &s.Regs, nil } -func convertVars(pv []*proc.Variable) []api.Variable { - if pv == nil { - return nil - } - vars := make([]api.Variable, 0, len(pv)) - for _, v := range pv { - vars = append(vars, *api.ConvertVar(v)) - } - return vars +// DwarfRegisterToString returns the name and value representation of the given register. +func (d *Debugger) DwarfRegisterToString(i int, reg *op.DwarfRegister) (string, bool, string) { + return d.target.BinInfo().Arch.DwarfRegisterToString(i, reg) } // LocalVariables returns a list of the local variables. -func (d *Debugger) LocalVariables(scope api.EvalScope, cfg proc.LoadConfig) ([]api.Variable, error) { +func (d *Debugger) LocalVariables(goid, frame, deferredCall int, cfg proc.LoadConfig) ([]*proc.Variable, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() - s, err := proc.ConvertEvalScope(d.target, scope.GoroutineID, scope.Frame, scope.DeferredCall) + s, err := proc.ConvertEvalScope(d.target, goid, frame, deferredCall) if err != nil { return nil, err } - pv, err := s.LocalVariables(cfg) - if err != nil { - return nil, err - } - return convertVars(pv), err + return s.LocalVariables(cfg) } // FunctionArguments returns the arguments to the current function. -func (d *Debugger) FunctionArguments(scope api.EvalScope, cfg proc.LoadConfig) ([]api.Variable, error) { +func (d *Debugger) FunctionArguments(goid, frame, deferredCall int, cfg proc.LoadConfig) ([]*proc.Variable, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() - s, err := proc.ConvertEvalScope(d.target, scope.GoroutineID, scope.Frame, scope.DeferredCall) + s, err := proc.ConvertEvalScope(d.target, goid, frame, deferredCall) if err != nil { return nil, err } - pv, err := s.FunctionArguments(cfg) + return s.FunctionArguments(cfg) +} + +// Function returns the current function. +func (d *Debugger) Function(goid, frame, deferredCall int, cfg proc.LoadConfig) (*proc.Function, error) { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + + s, err := proc.ConvertEvalScope(d.target, goid, frame, deferredCall) if err != nil { return nil, err } - return convertVars(pv), nil + return s.Fn, nil } // EvalVariableInScope will attempt to evaluate the variable represented by 'symbol' // in the scope provided. -func (d *Debugger) EvalVariableInScope(scope api.EvalScope, symbol string, cfg proc.LoadConfig) (*api.Variable, error) { +func (d *Debugger) EvalVariableInScope(goid, frame, deferredCall int, expr string, cfg proc.LoadConfig) (*proc.Variable, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() - s, err := proc.ConvertEvalScope(d.target, scope.GoroutineID, scope.Frame, scope.DeferredCall) + s, err := proc.ConvertEvalScope(d.target, goid, frame, deferredCall) if err != nil { return nil, err } - v, err := s.EvalVariable(symbol, cfg) - if err != nil { - return nil, err - } - return api.ConvertVar(v), err + return s.EvalExpression(expr, cfg) +} + +// LoadResliced will attempt to 'reslice' a map, array or slice so that the values +// up to cfg.MaxArrayValues children are loaded starting from index start. +func (d *Debugger) LoadResliced(v *proc.Variable, start int, cfg proc.LoadConfig) (*proc.Variable, error) { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + return v.LoadResliced(start, cfg) } // SetVariableInScope will set the value of the variable represented by // 'symbol' to the value given, in the given scope. -func (d *Debugger) SetVariableInScope(scope api.EvalScope, symbol, value string) error { +func (d *Debugger) SetVariableInScope(goid, frame, deferredCall int, symbol, value string) error { d.targetMutex.Lock() defer d.targetMutex.Unlock() - s, err := proc.ConvertEvalScope(d.target, scope.GoroutineID, scope.Frame, scope.DeferredCall) + s, err := proc.ConvertEvalScope(d.target, goid, frame, deferredCall) if err != nil { return err } @@ -1326,25 +1605,141 @@ func (d *Debugger) SetVariableInScope(scope api.EvalScope, symbol, value string) } // Goroutines will return a list of goroutines in the target process. -func (d *Debugger) Goroutines(start, count int) ([]*api.Goroutine, int, error) { +func (d *Debugger) Goroutines(start, count int) ([]*proc.G, int, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() + return proc.GoroutinesInfo(d.target, start, count) +} - goroutines := []*api.Goroutine{} - gs, nextg, err := proc.GoroutinesInfo(d.target, start, count) - if err != nil { - return nil, 0, err +// FilterGoroutines returns the goroutines in gs that satisfy the specified filters. +func (d *Debugger) FilterGoroutines(gs []*proc.G, filters []api.ListGoroutinesFilter) []*proc.G { + if len(filters) == 0 { + return gs + } + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + r := []*proc.G{} + for _, g := range gs { + ok := true + for i := range filters { + if !matchGoroutineFilter(d.target, g, &filters[i]) { + ok = false + break + } + } + if ok { + r = append(r, g) + } + } + return r +} + +func matchGoroutineFilter(tgt *proc.Target, g *proc.G, filter *api.ListGoroutinesFilter) bool { + var val bool + switch filter.Kind { + default: + fallthrough + case api.GoroutineFieldNone: + val = true + case api.GoroutineCurrentLoc: + val = matchGoroutineLocFilter(g.CurrentLoc, filter.Arg) + case api.GoroutineUserLoc: + val = matchGoroutineLocFilter(g.UserCurrent(), filter.Arg) + case api.GoroutineGoLoc: + val = matchGoroutineLocFilter(g.Go(), filter.Arg) + case api.GoroutineStartLoc: + val = matchGoroutineLocFilter(g.StartLoc(tgt), filter.Arg) + case api.GoroutineLabel: + idx := strings.Index(filter.Arg, "=") + if idx >= 0 { + val = g.Labels()[filter.Arg[:idx]] == filter.Arg[idx+1:] + } else { + _, val = g.Labels()[filter.Arg] + } + case api.GoroutineRunning: + val = g.Thread != nil + case api.GoroutineUser: + val = !g.System(tgt) + } + if filter.Negated { + val = !val + } + return val +} + +func matchGoroutineLocFilter(loc proc.Location, arg string) bool { + return strings.Contains(formatLoc(loc), arg) +} + +func formatLoc(loc proc.Location) string { + fnname := "?" + if loc.Fn != nil { + fnname = loc.Fn.Name } + return fmt.Sprintf("%s:%d in %s", loc.File, loc.Line, fnname) +} + +// GroupGoroutines divides goroutines in gs into groups as specified by groupBy and groupByArg. +// A maximum of maxGoroutinesPerGroup are saved in each group, but the total +// number of goroutines in each group is recorded. +func (d *Debugger) GroupGoroutines(gs []*proc.G, group *api.GoroutineGroupingOptions) ([]*proc.G, []api.GoroutineGroup, bool) { + if group.GroupBy == api.GoroutineFieldNone { + return gs, nil, false + } + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + + groupMembers := map[string][]*proc.G{} + totals := map[string]int{} + for _, g := range gs { - goroutines = append(goroutines, api.ConvertGoroutine(g)) + var key string + switch group.GroupBy { + case api.GoroutineCurrentLoc: + key = formatLoc(g.CurrentLoc) + case api.GoroutineUserLoc: + key = formatLoc(g.UserCurrent()) + case api.GoroutineGoLoc: + key = formatLoc(g.Go()) + case api.GoroutineStartLoc: + key = formatLoc(g.StartLoc(d.target)) + case api.GoroutineLabel: + key = fmt.Sprintf("%s=%s", group.GroupByKey, g.Labels()[group.GroupByKey]) + case api.GoroutineRunning: + key = fmt.Sprintf("running=%v", g.Thread != nil) + case api.GoroutineUser: + key = fmt.Sprintf("user=%v", !g.System(d.target)) + } + if len(groupMembers[key]) < group.MaxGroupMembers { + groupMembers[key] = append(groupMembers[key], g) + } + totals[key]++ + } + + keys := make([]string, 0, len(groupMembers)) + for key := range groupMembers { + keys = append(keys, key) + } + sort.Strings(keys) + + tooManyGroups := false + gsout := []*proc.G{} + groups := []api.GoroutineGroup{} + for _, key := range keys { + if group.MaxGroups > 0 && len(groups) >= group.MaxGroups { + tooManyGroups = true + break + } + groups = append(groups, api.GoroutineGroup{Name: key, Offset: len(gsout), Count: len(groupMembers[key]), Total: totals[key]}) + gsout = append(gsout, groupMembers[key]...) } - return goroutines, nextg, err + return gsout, groups, tooManyGroups } // Stacktrace returns a list of Stackframes for the given goroutine. The // length of the returned list will be min(stack_len, depth). // If 'full' is true, then local vars, function args, etc will be returned as well. -func (d *Debugger) Stacktrace(goroutineID, depth int, opts api.StacktraceOptions, cfg *proc.LoadConfig) ([]api.Stackframe, error) { +func (d *Debugger) Stacktrace(goroutineID, depth int, opts api.StacktraceOptions) ([]proc.Stackframe, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() @@ -1352,23 +1747,16 @@ func (d *Debugger) Stacktrace(goroutineID, depth int, opts api.StacktraceOptions return nil, err } - var rawlocs []proc.Stackframe - g, err := proc.FindGoroutine(d.target, goroutineID) if err != nil { return nil, err } if g == nil { - rawlocs, err = proc.ThreadStacktrace(d.target.CurrentThread(), depth) + return proc.ThreadStacktrace(d.target.CurrentThread(), depth) } else { - rawlocs, err = g.Stacktrace(depth, proc.StacktraceOptions(opts)) - } - if err != nil { - return nil, err + return g.Stacktrace(depth, proc.StacktraceOptions(opts)) } - - return d.convertStacktrace(rawlocs, cfg) } // Ancestors returns the stacktraces for the ancestors of a goroutine. @@ -1413,6 +1801,15 @@ func (d *Debugger) Ancestors(goroutineID, numAncestors, depth int) ([]api.Ancest return r, nil } +// ConvertStacktrace converts a slice of proc.Stackframe into a slice of +// api.Stackframe, loading local variables and arguments of each frame if +// cfg is not nil. +func (d *Debugger) ConvertStacktrace(rawlocs []proc.Stackframe, cfg *proc.LoadConfig) ([]api.Stackframe, error) { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + return d.convertStacktrace(rawlocs, cfg) +} + func (d *Debugger) convertStacktrace(rawlocs []proc.Stackframe, cfg *proc.LoadConfig) ([]api.Stackframe, error) { locations := make([]api.Stackframe, 0, len(rawlocs)) for i := range rawlocs { @@ -1431,7 +1828,7 @@ func (d *Debugger) convertStacktrace(rawlocs []proc.Stackframe, cfg *proc.LoadCo } if cfg != nil && rawlocs[i].Current.Fn != nil { var err error - scope := proc.FrameToScope(d.target.BinInfo(), d.target.CurrentThread(), nil, rawlocs[i:]...) + scope := proc.FrameToScope(d.target, d.target.Memory(), nil, rawlocs[i:]...) locals, err := scope.LocalVariables(*cfg) if err != nil { return nil, err @@ -1441,8 +1838,8 @@ func (d *Debugger) convertStacktrace(rawlocs []proc.Stackframe, cfg *proc.LoadCo return nil, err } - frame.Locals = convertVars(locals) - frame.Arguments = convertVars(arguments) + frame.Locals = api.ConvertVars(locals) + frame.Arguments = api.ConvertVars(arguments) } locations = append(locations, frame) } @@ -1453,12 +1850,12 @@ func (d *Debugger) convertStacktrace(rawlocs []proc.Stackframe, cfg *proc.LoadCo func (d *Debugger) convertDefers(defers []*proc.Defer) []api.Defer { r := make([]api.Defer, len(defers)) for i := range defers { - ddf, ddl, ddfn := d.target.BinInfo().PCToLine(defers[i].DeferredPC) + ddf, ddl, ddfn := defers[i].DeferredFunc(d.target) drf, drl, drfn := d.target.BinInfo().PCToLine(defers[i].DeferPC) r[i] = api.Defer{ DeferredLoc: api.ConvertLocation(proc.Location{ - PC: defers[i].DeferredPC, + PC: ddfn.Entry, File: ddf, Line: ddl, Fn: ddfn, @@ -1480,8 +1877,28 @@ func (d *Debugger) convertDefers(defers []*proc.Defer) []api.Defer { return r } +// CurrentPackage returns the fully qualified name of the +// package corresponding to the function location of the +// current thread. +func (d *Debugger) CurrentPackage() (string, error) { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + + if _, err := d.target.Valid(); err != nil { + return "", err + } + loc, err := d.target.CurrentThread().Location() + if err != nil { + return "", err + } + if loc.Fn == nil { + return "", fmt.Errorf("unable to determine current package due to unspecified function location") + } + return loc.Fn.PackageName(), nil +} + // FindLocation will find the location specified by 'locStr'. -func (d *Debugger) FindLocation(scope api.EvalScope, locStr string, includeNonExecutableLines bool) ([]api.Location, error) { +func (d *Debugger) FindLocation(goid, frame, deferredCall int, locStr string, includeNonExecutableLines bool, substitutePathRules [][2]string) ([]api.Location, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() @@ -1494,9 +1911,28 @@ func (d *Debugger) FindLocation(scope api.EvalScope, locStr string, includeNonEx return nil, err } - s, _ := proc.ConvertEvalScope(d.target, scope.GoroutineID, scope.Frame, scope.DeferredCall) + return d.findLocation(goid, frame, deferredCall, locStr, loc, includeNonExecutableLines, substitutePathRules) +} + +// FindLocationSpec will find the location specified by 'locStr' and 'locSpec'. +// 'locSpec' should be the result of calling 'locspec.Parse(locStr)'. 'locStr' +// is also passed, because it made be used to broaden the search criteria, if +// the parsed result did not find anything. +func (d *Debugger) FindLocationSpec(goid, frame, deferredCall int, locStr string, locSpec locspec.LocationSpec, includeNonExecutableLines bool, substitutePathRules [][2]string) ([]api.Location, error) { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + + if _, err := d.target.Valid(); err != nil { + return nil, err + } + + return d.findLocation(goid, frame, deferredCall, locStr, locSpec, includeNonExecutableLines, substitutePathRules) +} + +func (d *Debugger) findLocation(goid, frame, deferredCall int, locStr string, locSpec locspec.LocationSpec, includeNonExecutableLines bool, substitutePathRules [][2]string) ([]api.Location, error) { + s, _ := proc.ConvertEvalScope(d.target, goid, frame, deferredCall) - locs, err := loc.Find(d.target, d.processArgs, s, locStr, includeNonExecutableLines) + locs, err := locSpec.Find(d.target, d.processArgs, s, locStr, includeNonExecutableLines, substitutePathRules) for i := range locs { if locs[i].PC == 0 { continue @@ -1511,7 +1947,7 @@ func (d *Debugger) FindLocation(scope api.EvalScope, locStr string, includeNonEx // Disassemble code between startPC and endPC. // if endPC == 0 it will find the function containing startPC and disassemble the whole function. -func (d *Debugger) Disassemble(goroutineID int, addr1, addr2 uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) { +func (d *Debugger) Disassemble(goroutineID int, addr1, addr2 uint64) ([]proc.AsmInstruction, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() @@ -1539,17 +1975,13 @@ func (d *Debugger) Disassemble(goroutineID int, addr1, addr2 uint64, flavour api } regs, _ := curthread.Registers() - insts, err := proc.Disassemble(curthread, regs, d.target.Breakpoints(), d.target.BinInfo(), addr1, addr2) - if err != nil { - return nil, err - } - disass := make(api.AsmInstructions, len(insts)) - - for i := range insts { - disass[i] = api.ConvertAsmInstruction(insts[i], insts[i].Text(proc.AssemblyFlavour(flavour), d.target.BinInfo())) - } + return proc.Disassemble(d.target.Memory(), regs, d.target.Breakpoints(), d.target.BinInfo(), addr1, addr2) +} - return disass, nil +func (d *Debugger) AsmInstructionText(inst *proc.AsmInstruction, flavour proc.AssemblyFlavour) string { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + return inst.Text(flavour, d.target.BinInfo()) } // Recorded returns true if the target is a recording. @@ -1559,6 +1991,24 @@ func (d *Debugger) Recorded() (recorded bool, tracedir string) { return d.target.Recorded() } +// FindThreadReturnValues returns the return values of the function that +// the thread of the given 'id' just stepped out of. +func (d *Debugger) FindThreadReturnValues(id int, cfg proc.LoadConfig) ([]*proc.Variable, error) { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + + if _, err := d.target.Valid(); err != nil { + return nil, err + } + + thread, found := d.target.FindThread(id) + if !found { + return nil, fmt.Errorf("could not find thread %d", id) + } + + return thread.Common().ReturnValues(cfg), nil +} + // Checkpoint will set a checkpoint specified by the locspec. func (d *Debugger) Checkpoint(where string) (int, error) { d.targetMutex.Lock() @@ -1567,18 +2017,10 @@ func (d *Debugger) Checkpoint(where string) (int, error) { } // Checkpoints will return a list of checkpoints. -func (d *Debugger) Checkpoints() ([]api.Checkpoint, error) { +func (d *Debugger) Checkpoints() ([]proc.Checkpoint, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() - cps, err := d.target.Checkpoints() - if err != nil { - return nil, err - } - r := make([]api.Checkpoint, len(cps)) - for i := range cps { - r[i] = api.ConvertCheckpoint(cps[i]) - } - return r, nil + return d.target.Checkpoints() } // ClearCheckpoint will clear the checkpoint of the given ID. @@ -1589,28 +2031,23 @@ func (d *Debugger) ClearCheckpoint(id int) error { } // ListDynamicLibraries returns a list of loaded dynamic libraries. -func (d *Debugger) ListDynamicLibraries() []api.Image { +func (d *Debugger) ListDynamicLibraries() []*proc.Image { d.targetMutex.Lock() defer d.targetMutex.Unlock() - bi := d.target.BinInfo() - r := make([]api.Image, 0, len(bi.Images)-1) - // skips the first image because it's the executable file - for i := range bi.Images[1:] { - r = append(r, api.ConvertImage(bi.Images[i+1])) - } - return r + return d.target.BinInfo().Images[1:] // skips the first image because it's the executable file + } // ExamineMemory returns the raw memory stored at the given address. // The amount of data to be read is specified by length. // This function will return an error if it reads less than `length` bytes. -func (d *Debugger) ExamineMemory(address uintptr, length int) ([]byte, error) { +func (d *Debugger) ExamineMemory(address uint64, length int) ([]byte, error) { d.targetMutex.Lock() defer d.targetMutex.Unlock() - thread := d.target.CurrentThread() + mem := d.target.Memory() data := make([]byte, length) - n, err := thread.ReadMemory(data, address) + n, err := mem.ReadMemory(data, address) if err != nil { return nil, err } @@ -1639,7 +2076,7 @@ func (d *Debugger) GetVersion(out *api.GetVersionOut) error { } } - if !d.isRecording() && !d.isRunning() { + if !d.isRecording() && !d.IsRunning() { out.TargetGoVersion = d.target.BinInfo().Producer() } @@ -1652,30 +2089,10 @@ func (d *Debugger) GetVersion(out *api.GetVersionOut) error { // ListPackagesBuildInfo returns the list of packages used by the program along with // the directory where each package was compiled and optionally the list of // files constituting the package. -func (d *Debugger) ListPackagesBuildInfo(includeFiles bool) []api.PackageBuildInfo { +func (d *Debugger) ListPackagesBuildInfo(includeFiles bool) []*proc.PackageBuildInfo { d.targetMutex.Lock() defer d.targetMutex.Unlock() - pkgs := d.target.BinInfo().ListPackagesBuildInfo(includeFiles) - r := make([]api.PackageBuildInfo, 0, len(pkgs)) - for _, pkg := range pkgs { - var files []string - - if len(pkg.Files) > 0 { - files = make([]string, 0, len(pkg.Files)) - for file := range pkg.Files { - files = append(files, file) - } - } - - sort.Strings(files) - - r = append(r, api.PackageBuildInfo{ - ImportPath: pkg.ImportPath, - DirectoryPath: pkg.DirectoryPath, - Files: files, - }) - } - return r + return d.target.BinInfo().ListPackagesBuildInfo(includeFiles) } // StopRecording stops a recording (if one is in progress) @@ -1688,6 +2105,124 @@ func (d *Debugger) StopRecording() error { return d.stopRecording() } +// StopReason returns the reason the reason why the target process is stopped. +// A process could be stopped for multiple simultaneous reasons, in which +// case only one will be reported. +func (d *Debugger) StopReason() proc.StopReason { + d.targetMutex.Lock() + defer d.targetMutex.Unlock() + return d.target.StopReason +} + +// LockTarget acquires the target mutex. +func (d *Debugger) LockTarget() { + d.targetMutex.Lock() +} + +// UnlockTarget releases the target mutex. +func (d *Debugger) UnlockTarget() { + d.targetMutex.Unlock() +} + +// DumpStart starts a core dump to dest. +func (d *Debugger) DumpStart(dest string) error { + d.targetMutex.Lock() + // targetMutex will only be unlocked when the dump is done + + if !d.target.CanDump { + d.targetMutex.Unlock() + return ErrCoreDumpNotSupported + } + + d.dumpState.Mutex.Lock() + defer d.dumpState.Mutex.Unlock() + + if d.dumpState.Dumping { + d.targetMutex.Unlock() + return ErrCoreDumpInProgress + } + + fh, err := os.Create(dest) + if err != nil { + d.targetMutex.Unlock() + return err + } + + d.dumpState.Dumping = true + d.dumpState.AllDone = false + d.dumpState.Canceled = false + d.dumpState.DoneChan = make(chan struct{}) + d.dumpState.ThreadsDone = 0 + d.dumpState.ThreadsTotal = 0 + d.dumpState.MemDone = 0 + d.dumpState.MemTotal = 0 + d.dumpState.Err = nil + go func() { + defer d.targetMutex.Unlock() + d.target.Dump(fh, 0, &d.dumpState) + }() + + return nil +} + +// DumpWait waits for the dump to finish, or for the duration of wait. +// Returns the state of the dump. +// If wait == 0 returns immediately. +func (d *Debugger) DumpWait(wait time.Duration) *proc.DumpState { + d.dumpState.Mutex.Lock() + if !d.dumpState.Dumping { + d.dumpState.Mutex.Unlock() + return &d.dumpState + } + d.dumpState.Mutex.Unlock() + + if wait > 0 { + alarm := time.After(wait) + select { + case <-alarm: + case <-d.dumpState.DoneChan: + } + } + + return &d.dumpState +} + +// DumpCancel canels a dump in progress +func (d *Debugger) DumpCancel() error { + d.dumpState.Mutex.Lock() + d.dumpState.Canceled = true + d.dumpState.Mutex.Unlock() + return nil +} + +func (d *Debugger) Target() *proc.Target { + return d.target +} + +func (d *Debugger) GetBufferedTracepoints() []api.TracepointResult { + traces := d.target.GetBufferedTracepoints() + if traces == nil { + return nil + } + results := make([]api.TracepointResult, len(traces)) + for i, trace := range traces { + f, l, fn := d.target.BinInfo().PCToLine(uint64(trace.FnAddr)) + + results[i].FunctionName = fn.Name + results[i].Line = l + results[i].File = f + results[i].GoroutineID = trace.GoroutineID + + for _, p := range trace.InputParams { + results[i].InputParams = append(results[i].InputParams, *api.ConvertVar(p)) + } + for _, p := range trace.ReturnParams { + results[i].ReturnParams = append(results[i].ReturnParams, *api.ConvertVar(p)) + } + } + return results +} + func go11DecodeErrorCheck(err error) error { if _, isdecodeerr := err.(dwarf.DecodeError); !isdecodeerr { return err @@ -1707,8 +2242,11 @@ func (v breakpointsByLogicalID) Len() int { return len(v) } func (v breakpointsByLogicalID) Swap(i, j int) { v[i], v[j] = v[j], v[i] } func (v breakpointsByLogicalID) Less(i, j int) bool { - if v[i].LogicalID == v[j].LogicalID { + if v[i].LogicalID() == v[j].LogicalID() { + if v[i].WatchType != v[j].WatchType { + return v[i].WatchType > v[j].WatchType // if a logical breakpoint contains a watchpoint let the watchpoint sort first + } return v[i].Addr < v[j].Addr } - return v[i].LogicalID < v[j].LogicalID + return v[i].LogicalID() < v[j].LogicalID() } diff --git a/service/debugger/debugger_linux.go b/service/debugger/debugger_linux.go index 8550185c25..0f65c83eef 100644 --- a/service/debugger/debugger_linux.go +++ b/service/debugger/debugger_linux.go @@ -9,6 +9,8 @@ import ( sys "golang.org/x/sys/unix" ) +//lint:file-ignore ST1005 errors here can be capitalized + func attachErrorMessage(pid int, err error) error { fallbackerr := fmt.Errorf("could not attach to pid %d: %s", pid, err) if serr, ok := err.(syscall.Errno); ok { diff --git a/service/debugger/debugger_unix.go b/service/debugger/debugger_unix.go index c6b58df408..6ef61293c5 100644 --- a/service/debugger/debugger_unix.go +++ b/service/debugger/debugger_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package debugger diff --git a/service/debugger/debugger_unix_test.go b/service/debugger/debugger_unix_test.go index 8592968c90..975f85523a 100644 --- a/service/debugger/debugger_unix_test.go +++ b/service/debugger/debugger_unix_test.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package debugger diff --git a/service/internal/sameuser/doc.go b/service/internal/sameuser/doc.go new file mode 100644 index 0000000000..b6fc8fd14b --- /dev/null +++ b/service/internal/sameuser/doc.go @@ -0,0 +1,3 @@ +// Package sameuser provides utilities for checking users of a local connection. +// Only works in Linux. +package sameuser diff --git a/service/internal/sameuser/sameuser.go b/service/internal/sameuser/sameuser.go new file mode 100644 index 0000000000..76d44b0705 --- /dev/null +++ b/service/internal/sameuser/sameuser.go @@ -0,0 +1,10 @@ +//go:build !linux +// +build !linux + +package sameuser + +import "net" + +func CanAccept(_, _, _ net.Addr) bool { + return true +} diff --git a/service/internal/sameuser/sameuser_linux.go b/service/internal/sameuser/sameuser_linux.go new file mode 100644 index 0000000000..4aeeb5e442 --- /dev/null +++ b/service/internal/sameuser/sameuser_linux.go @@ -0,0 +1,134 @@ +//go:build linux +// +build linux + +package sameuser + +import ( + "bytes" + "encoding/binary" + "fmt" + "io/ioutil" + "log" + "net" + "os" + "strings" + + "github.com/go-delve/delve/pkg/logflags" +) + +// for testing +var ( + uid = os.Getuid() + readFile = ioutil.ReadFile +) + +type errConnectionNotFound struct { + filename string +} + +func (e *errConnectionNotFound) Error() string { + return fmt.Sprintf("connection not found in %s", e.filename) +} + +func sameUserForHexLocalAddr(filename, localAddr, remoteAddr string) (bool, error) { + b, err := readFile(filename) + if err != nil { + return false, err + } + for _, line := range strings.Split(strings.TrimSpace(string(b)), "\n") { + // The format contains whitespace padding (%4d, %5u), so we use + // fmt.Sscanf instead of splitting on whitespace. + var ( + sl int + readLocalAddr, readRemoteAddr string + state int + queue, timer string + retransmit int + remoteUID uint + ) + // Note that we must use %d where the kernel format uses %5u: + // %u is not understood by the fmt package (%U is something else), + // %5d cuts off longer uids (e.g. 149098 on gLinux). + n, err := fmt.Sscanf(line, "%4d: %s %s %02X %s %s %08X %d", + &sl, &readLocalAddr, &readRemoteAddr, &state, &queue, &timer, &retransmit, &remoteUID) + if n != 8 || err != nil { + continue // invalid line (e.g. header line) + } + if readLocalAddr != remoteAddr || readRemoteAddr != localAddr { + // this check is deliberately crossed, the (readLocalAddr, + // readRemoteAddr) pair is from the point of view of the client, the + // (localAddr, remoteAddr) is from the point of view of the server. + continue + } + same := uid == int(remoteUID) + if !same && logflags.Any() { + log.Printf("connection from different user (remote: %d, local: %d) detected: %v", remoteUID, uid, line) + } + return same, nil + } + return false, &errConnectionNotFound{filename} +} + +func addrToHex4(addr *net.TCPAddr) string { + // For details about the format, see the kernel side implementation: + // https://elixir.bootlin.com/linux/v5.2.2/source/net/ipv4/tcp_ipv4.c#L2375 + b := addr.IP.To4() + return fmt.Sprintf("%02X%02X%02X%02X:%04X", b[3], b[2], b[1], b[0], addr.Port) +} + +func addrToHex6(addr *net.TCPAddr) string { + a16 := addr.IP.To16() + // For details about the format, see the kernel side implementation: + // https://elixir.bootlin.com/linux/v5.2.2/source/net/ipv6/tcp_ipv6.c#L1792 + words := make([]uint32, 4) + if err := binary.Read(bytes.NewReader(a16), binary.LittleEndian, words); err != nil { + panic(err) + } + return fmt.Sprintf("%08X%08X%08X%08X:%04X", words[0], words[1], words[2], words[3], addr.Port) +} + +func sameUserForRemoteAddr4(localAddr, remoteAddr *net.TCPAddr) (bool, error) { + r, err := sameUserForHexLocalAddr("/proc/net/tcp", addrToHex4(localAddr), addrToHex4(remoteAddr)) + if _, isNotFound := err.(*errConnectionNotFound); isNotFound { + // See Issue #1835 + r, err2 := sameUserForHexLocalAddr("/proc/net/tcp6", "0000000000000000FFFF0000"+addrToHex4(localAddr), "0000000000000000FFFF0000"+addrToHex4(remoteAddr)) + if err2 == nil { + return r, nil + } + } + return r, err +} + +func sameUserForRemoteAddr6(localAddr, remoteAddr *net.TCPAddr) (bool, error) { + return sameUserForHexLocalAddr("/proc/net/tcp6", addrToHex6(localAddr), addrToHex6(remoteAddr)) +} + +func sameUserForRemoteAddr(localAddr, remoteAddr *net.TCPAddr) (bool, error) { + if remoteAddr.IP.To4() == nil { + return sameUserForRemoteAddr6(localAddr, remoteAddr) + } + return sameUserForRemoteAddr4(localAddr, remoteAddr) +} + +func CanAccept(listenAddr, localAddr, remoteAddr net.Addr) bool { + laddr, ok := listenAddr.(*net.TCPAddr) + if !ok || !laddr.IP.IsLoopback() { + return true + } + remoteaAddrTCP := remoteAddr.(*net.TCPAddr) + localAddrTCP := localAddr.(*net.TCPAddr) + + same, err := sameUserForRemoteAddr(localAddrTCP, remoteaAddrTCP) + if err != nil { + log.Printf("cannot check remote address: %v", err) + } + if !same { + if logflags.Any() { + log.Printf("closing connection from different user (%v): connections to localhost are only accepted from the same UNIX user for security reasons", remoteaAddrTCP) + } else { + fmt.Fprintf(os.Stderr, "closing connection from different user (%v): connections to localhost are only accepted from the same UNIX user for security reasons\n", remoteaAddrTCP) + } + return false + } + return true +} diff --git a/service/rpccommon/sameuser_linux_test.go b/service/internal/sameuser/sameuser_linux_test.go similarity index 64% rename from service/rpccommon/sameuser_linux_test.go rename to service/internal/sameuser/sameuser_linux_test.go index 9fd2bd4a9e..9eb5cb2266 100644 --- a/service/rpccommon/sameuser_linux_test.go +++ b/service/internal/sameuser/sameuser_linux_test.go @@ -1,6 +1,7 @@ -//+build linux +//go:build linux +// +build linux -package rpccommon +package sameuser import ( "net" @@ -14,33 +15,36 @@ func TestSameUserForRemoteAddr(t *testing.T) { return []byte(proc), nil } for _, tt := range []struct { - name string - proc string - addr *net.TCPAddr - want bool + name string + proc string + localAddr, remoteAddr *net.TCPAddr + want bool }{ { name: "ipv4-same", proc: ` sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode 21: 0100007F:E682 0100007F:0FC8 01 00000000:00000000 00:00000000 00000000 149098 0 8420541 2 0000000000000000 20 0 0 10 -1 `, - addr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 59010}, - want: true, + localAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 4040}, + remoteAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 59010}, + want: true, }, { name: "ipv4-not-found", proc: ` sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode 21: 0100007F:E682 0100007F:0FC8 01 00000000:00000000 00:00000000 00000000 149098 0 8420541 2 0000000000000000 20 0 0 10 -1 `, - addr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 2342}, - want: false, + localAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 4040}, + remoteAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 2342}, + want: false, }, { name: "ipv4-different-uid", proc: ` sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode 21: 0100007F:E682 0100007F:0FC8 01 00000000:00000000 00:00000000 00000000 149097 0 8420541 2 0000000000000000 20 0 0 10 -1 `, - addr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 59010}, - want: false, + localAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 4040}, + remoteAddr: &net.TCPAddr{IP: net.ParseIP("127.0.0.1"), Port: 59010}, + want: false, }, { @@ -48,16 +52,17 @@ func TestSameUserForRemoteAddr(t *testing.T) { proc: ` sl local_address remote_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode 5: 00000000000000000000000001000000:D3E4 00000000000000000000000001000000:0FC8 01 00000000:00000000 00:00000000 00000000 149098 0 8425526 2 0000000000000000 20 0 0 10 -1 6: 00000000000000000000000001000000:0FC8 00000000000000000000000001000000:D3E4 01 00000000:00000000 00:00000000 00000000 149098 0 8424744 1 0000000000000000 20 0 0 10 -1`, - addr: &net.TCPAddr{IP: net.ParseIP("::1"), Port: 54244}, - want: true, + localAddr: &net.TCPAddr{IP: net.ParseIP("::1"), Port: 4040}, + remoteAddr: &net.TCPAddr{IP: net.ParseIP("::1"), Port: 54244}, + want: true, }, } { t.Run(tt.name, func(t *testing.T) { proc = tt.proc // The returned error is for reporting only. - same, _ := sameUserForRemoteAddr(tt.addr) + same, _ := sameUserForRemoteAddr(tt.localAddr, tt.remoteAddr) if got, want := same, tt.want; got != want { - t.Errorf("sameUserForRemoteAddr(%v) = %v, want %v", tt.addr, got, want) + t.Errorf("sameUserForRemoteAddr(%v, %v) = %v, want %v", tt.localAddr, tt.remoteAddr, got, want) } }) } diff --git a/service/rpc1/client.go b/service/rpc1/client.go index 410f60ece8..9c24e7eb96 100644 --- a/service/rpc1/client.go +++ b/service/rpc1/client.go @@ -12,7 +12,7 @@ import ( "github.com/go-delve/delve/service/api" ) -// Client is a RPC service.Client. +// RPCClient is a RPC service.Client. type RPCClient struct { addr string client *rpc.Client @@ -20,7 +20,7 @@ type RPCClient struct { haltReq bool } -var unsupportedApiError = errors.New("unsupported") +var errAPIUnsupported = errors.New("unsupported") // NewClient creates a new RPCClient. func NewClient(addr string) *RPCClient { @@ -75,6 +75,7 @@ func (c *RPCClient) Continue() <-chan *api.DebuggerState { } if state.Exited { // Error types apparently cannot be marshalled by Go correctly. Must reset error here. + //lint:ignore ST1005 backwards compatibility state.Err = fmt.Errorf("Process %d has exited with status %d", c.ProcessPid(), state.ExitStatus) } ch <- state @@ -202,7 +203,7 @@ func (c *RPCClient) AmendBreakpoint(bp *api.Breakpoint) error { } func (c *RPCClient) CancelNext() error { - return unsupportedApiError + return errAPIUnsupported } func (c *RPCClient) ListThreads() ([]*api.Thread, error) { @@ -300,14 +301,14 @@ func (c *RPCClient) FindLocation(scope api.EvalScope, loc string) ([]api.Locatio return answer, err } -// Disassemble code between startPC and endPC +// DisassembleRange disassembles code between startPC and endPC func (c *RPCClient) DisassembleRange(scope api.EvalScope, startPC, endPC uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) { var r api.AsmInstructions err := c.call("Disassemble", DisassembleRequest{scope, startPC, endPC, flavour}, &r) return r, err } -// Disassemble function containing pc +// DisassemblePC disassembles function containing pc func (c *RPCClient) DisassemblePC(scope api.EvalScope, pc uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) { var r api.AsmInstructions err := c.call("Disassemble", DisassembleRequest{scope, pc, 0, flavour}, &r) diff --git a/service/rpc1/server.go b/service/rpc1/server.go index 128e79035a..7ed452b225 100644 --- a/service/rpc1/server.go +++ b/service/rpc1/server.go @@ -35,11 +35,7 @@ func (s *RPCServer) ProcessPid(arg1 interface{}, pid *int) error { } func (s *RPCServer) Detach(kill bool, ret *int) error { - err := s.debugger.Detach(kill) - if s.config.DisconnectChan != nil { - close(s.config.DisconnectChan) - } - return err + return s.debugger.Detach(kill) } func (s *RPCServer) Restart(arg1 interface{}, arg2 *int) error { @@ -60,7 +56,7 @@ func (s *RPCServer) State(arg interface{}, state *api.DebuggerState) error { } func (s *RPCServer) Command(command *api.DebuggerCommand, cb service.RPCCallback) { - st, err := s.debugger.Command(command) + st, err := s.debugger.Command(command, cb.SetupDoneChan()) cb.Return(st, err) } @@ -93,20 +89,23 @@ func (s *RPCServer) StacktraceGoroutine(args *StacktraceGoroutineArgs, locations if args.Full { loadcfg = &defaultLoadConfig } - locs, err := s.debugger.Stacktrace(args.Id, args.Depth, 0, loadcfg) + locs, err := s.debugger.Stacktrace(args.Id, args.Depth, 0) if err != nil { return err } - *locations = locs - return nil + *locations, err = s.debugger.ConvertStacktrace(locs, loadcfg) + return err } func (s *RPCServer) ListBreakpoints(arg interface{}, breakpoints *[]*api.Breakpoint) error { - *breakpoints = s.debugger.Breakpoints() + *breakpoints = s.debugger.Breakpoints(false) return nil } func (s *RPCServer) CreateBreakpoint(bp, newBreakpoint *api.Breakpoint) error { + if err := api.ValidBreakpointName(bp.Name); err != nil { + return err + } createdbp, err := s.debugger.CreateBreakpoint(bp) if err != nil { return err @@ -143,12 +142,21 @@ func (s *RPCServer) ClearBreakpointByName(name string, breakpoint *api.Breakpoin func (s *RPCServer) AmendBreakpoint(amend *api.Breakpoint, unused *int) error { *unused = 0 + if err := api.ValidBreakpointName(amend.Name); err != nil { + return err + } return s.debugger.AmendBreakpoint(amend) } func (s *RPCServer) ListThreads(arg interface{}, threads *[]*api.Thread) (err error) { - *threads, err = s.debugger.Threads() - return err + pthreads, err := s.debugger.Threads() + if err != nil { + return err + } + s.debugger.LockTarget() + defer s.debugger.UnlockTarget() + *threads = api.ConvertThreads(pthreads) + return nil } func (s *RPCServer) GetThread(id int, thread *api.Thread) error { @@ -159,26 +167,18 @@ func (s *RPCServer) GetThread(id int, thread *api.Thread) error { if t == nil { return fmt.Errorf("no thread with id %d", id) } - *thread = *t + s.debugger.LockTarget() + defer s.debugger.UnlockTarget() + *thread = *api.ConvertThread(t) return nil } func (s *RPCServer) ListPackageVars(filter string, variables *[]api.Variable) error { - state, err := s.debugger.State(false) + vars, err := s.debugger.PackageVariables(filter, defaultLoadConfig) if err != nil { return err } - - current := state.CurrentThread - if current == nil { - return fmt.Errorf("no current thread") - } - - vars, err := s.debugger.PackageVariables(current.ID, filter, defaultLoadConfig) - if err != nil { - return err - } - *variables = vars + *variables = api.ConvertVars(vars) return nil } @@ -188,19 +188,11 @@ type ThreadListArgs struct { } func (s *RPCServer) ListThreadPackageVars(args *ThreadListArgs, variables *[]api.Variable) error { - thread, err := s.debugger.FindThread(args.Id) + vars, err := s.debugger.PackageVariables(args.Filter, defaultLoadConfig) if err != nil { return err } - if thread == nil { - return fmt.Errorf("no thread with id %d", args.Id) - } - - vars, err := s.debugger.PackageVariables(args.Id, args.Filter, defaultLoadConfig) - if err != nil { - return err - } - *variables = vars + *variables = api.ConvertVars(vars) return nil } @@ -210,29 +202,30 @@ func (s *RPCServer) ListRegisters(arg interface{}, registers *string) error { return err } - regs, err := s.debugger.Registers(state.CurrentThread.ID, nil, false) + dregs, err := s.debugger.ThreadRegisters(state.CurrentThread.ID, false) if err != nil { return err } + regs := api.Registers(api.ConvertRegisters(dregs, s.debugger.DwarfRegisterToString, false)) *registers = regs.String() return nil } func (s *RPCServer) ListLocalVars(scope api.EvalScope, variables *[]api.Variable) error { - vars, err := s.debugger.LocalVariables(scope, defaultLoadConfig) + vars, err := s.debugger.LocalVariables(scope.GoroutineID, scope.Frame, scope.DeferredCall, defaultLoadConfig) if err != nil { return err } - *variables = vars + *variables = api.ConvertVars(vars) return nil } func (s *RPCServer) ListFunctionArgs(scope api.EvalScope, variables *[]api.Variable) error { - vars, err := s.debugger.FunctionArguments(scope, defaultLoadConfig) + vars, err := s.debugger.FunctionArguments(scope.GoroutineID, scope.Frame, scope.DeferredCall, defaultLoadConfig) if err != nil { return err } - *variables = vars + *variables = api.ConvertVars(vars) return nil } @@ -242,11 +235,11 @@ type EvalSymbolArgs struct { } func (s *RPCServer) EvalSymbol(args EvalSymbolArgs, variable *api.Variable) error { - v, err := s.debugger.EvalVariableInScope(args.Scope, args.Symbol, defaultLoadConfig) + v, err := s.debugger.EvalVariableInScope(args.Scope.GoroutineID, args.Scope.Frame, args.Scope.DeferredCall, args.Symbol, defaultLoadConfig) if err != nil { return err } - *variable = *v + *variable = *api.ConvertVar(v) return nil } @@ -258,7 +251,7 @@ type SetSymbolArgs struct { func (s *RPCServer) SetSymbol(args SetSymbolArgs, unused *int) error { *unused = 0 - return s.debugger.SetVariableInScope(args.Scope, args.Symbol, args.Value) + return s.debugger.SetVariableInScope(args.Scope.GoroutineID, args.Scope.Frame, args.Scope.DeferredCall, args.Symbol, args.Value) } func (s *RPCServer) ListSources(filter string, sources *[]string) error { @@ -293,7 +286,9 @@ func (s *RPCServer) ListGoroutines(arg interface{}, goroutines *[]*api.Goroutine if err != nil { return err } - *goroutines = gs + s.debugger.LockTarget() + s.debugger.UnlockTarget() + *goroutines = api.ConvertGoroutines(s.debugger.Target(), gs) return nil } @@ -311,7 +306,7 @@ type FindLocationArgs struct { func (c *RPCServer) FindLocation(args FindLocationArgs, answer *[]api.Location) error { var err error - *answer, err = c.debugger.FindLocation(args.Scope, args.Loc, false) + *answer, err = c.debugger.FindLocation(args.Scope.GoroutineID, args.Scope.Frame, args.Scope.DeferredCall, args.Loc, false, nil) return err } @@ -323,6 +318,13 @@ type DisassembleRequest struct { func (c *RPCServer) Disassemble(args DisassembleRequest, answer *api.AsmInstructions) error { var err error - *answer, err = c.debugger.Disassemble(args.Scope.GoroutineID, args.StartPC, args.EndPC, args.Flavour) - return err + insts, err := c.debugger.Disassemble(args.Scope.GoroutineID, args.StartPC, args.EndPC) + if err != nil { + return err + } + *answer = make(api.AsmInstructions, len(insts)) + for i := range insts { + (*answer)[i] = api.ConvertAsmInstruction(insts[i], c.debugger.AsmInstructionText(&insts[i], proc.AssemblyFlavour(args.Flavour))) + } + return nil } diff --git a/service/rpc2/client.go b/service/rpc2/client.go index 7c6924f06a..0e3489702a 100644 --- a/service/rpc2/client.go +++ b/service/rpc2/client.go @@ -12,7 +12,7 @@ import ( "github.com/go-delve/delve/service/api" ) -// Client is a RPC service.Client. +// RPCClient is a RPC service.Client. type RPCClient struct { client *rpc.Client @@ -108,6 +108,7 @@ func (c *RPCClient) continueDir(cmd string) <-chan *api.DebuggerState { } if state.Exited { // Error types apparently cannot be marshalled by Go correctly. Must reset error here. + //lint:ignore ST1005 backwards compatibility state.Err = fmt.Errorf("Process %d has exited with status %d", c.ProcessPid(), state.ExitStatus) } ch <- &state @@ -214,6 +215,12 @@ func (c *RPCClient) Halt() (*api.DebuggerState, error) { return &out.State, err } +func (c *RPCClient) GetBufferedTracepoints() ([]api.TracepointResult, error) { + var out GetBufferedTracepointsOut + err := c.call("GetBufferedTracepoints", GetBufferedTracepointsIn{}, &out) + return out.TracepointResults, err +} + func (c *RPCClient) GetBreakpoint(id int) (*api.Breakpoint, error) { var out GetBreakpointOut err := c.call("GetBreakpoint", GetBreakpointIn{id, ""}, &out) @@ -226,15 +233,30 @@ func (c *RPCClient) GetBreakpointByName(name string) (*api.Breakpoint, error) { return &out.Breakpoint, err } +// CreateBreakpoint will send a request to the RPC server to create a breakpoint. +// Please refer to the documentation for `Debugger.CreateBreakpoint` for a description of how +// the requested breakpoint parameters are interpreted and used: +// https://pkg.go.dev/github.com/go-delve/delve/service/debugger#Debugger.CreateBreakpoint func (c *RPCClient) CreateBreakpoint(breakPoint *api.Breakpoint) (*api.Breakpoint, error) { var out CreateBreakpointOut err := c.call("CreateBreakpoint", CreateBreakpointIn{*breakPoint}, &out) return &out.Breakpoint, err } -func (c *RPCClient) ListBreakpoints() ([]*api.Breakpoint, error) { +func (c *RPCClient) CreateEBPFTracepoint(fnName string) error { + var out CreateEBPFTracepointOut + return c.call("CreateEBPFTracepoint", CreateEBPFTracepointIn{FunctionName: fnName}, &out) +} + +func (c *RPCClient) CreateWatchpoint(scope api.EvalScope, expr string, wtype api.WatchType) (*api.Breakpoint, error) { + var out CreateWatchpointOut + err := c.call("CreateWatchpoint", CreateWatchpointIn{scope, expr, wtype}, &out) + return out.Breakpoint, err +} + +func (c *RPCClient) ListBreakpoints(all bool) ([]*api.Breakpoint, error) { var out ListBreakpointsOut - err := c.call("ListBreakpoints", ListBreakpointsIn{}, &out) + err := c.call("ListBreakpoints", ListBreakpointsIn{all}, &out) return out.Breakpoints, err } @@ -250,6 +272,18 @@ func (c *RPCClient) ClearBreakpointByName(name string) (*api.Breakpoint, error) return out.Breakpoint, err } +func (c *RPCClient) ToggleBreakpoint(id int) (*api.Breakpoint, error) { + var out ToggleBreakpointOut + err := c.call("ToggleBreakpoint", ToggleBreakpointIn{id, ""}, &out) + return out.Breakpoint, err +} + +func (c *RPCClient) ToggleBreakpointByName(name string) (*api.Breakpoint, error) { + var out ToggleBreakpointOut + err := c.call("ToggleBreakpoint", ToggleBreakpointIn{0, name}, &out) + return out.Breakpoint, err +} + func (c *RPCClient) AmendBreakpoint(bp *api.Breakpoint) error { out := new(AmendBreakpointOut) err := c.call("AmendBreakpoint", AmendBreakpointIn{*bp}, out) @@ -334,10 +368,19 @@ func (c *RPCClient) ListFunctionArgs(scope api.EvalScope, cfg api.LoadConfig) ([ func (c *RPCClient) ListGoroutines(start, count int) ([]*api.Goroutine, int, error) { var out ListGoroutinesOut - err := c.call("ListGoroutines", ListGoroutinesIn{start, count}, &out) + err := c.call("ListGoroutines", ListGoroutinesIn{start, count, nil, api.GoroutineGroupingOptions{}}, &out) return out.Goroutines, out.Nextg, err } +func (c *RPCClient) ListGoroutinesWithFilter(start, count int, filters []api.ListGoroutinesFilter, group *api.GoroutineGroupingOptions) ([]*api.Goroutine, []api.GoroutineGroup, int, bool, error) { + if group == nil { + group = &api.GoroutineGroupingOptions{} + } + var out ListGoroutinesOut + err := c.call("ListGoroutines", ListGoroutinesIn{start, count, filters, *group}, &out) + return out.Goroutines, out.Groups, out.Nextg, out.TooManyGroups, err +} + func (c *RPCClient) Stacktrace(goroutineId, depth int, opts api.StacktraceOptions, cfg *api.LoadConfig) ([]api.Stackframe, error) { var out StacktraceOut err := c.call("Stacktrace", StacktraceIn{goroutineId, depth, false, false, opts, cfg}, &out) @@ -356,20 +399,20 @@ func (c *RPCClient) AttachedToExistingProcess() bool { return out.Answer } -func (c *RPCClient) FindLocation(scope api.EvalScope, loc string, findInstructions bool) ([]api.Location, error) { +func (c *RPCClient) FindLocation(scope api.EvalScope, loc string, findInstructions bool, substitutePathRules [][2]string) ([]api.Location, error) { var out FindLocationOut - err := c.call("FindLocation", FindLocationIn{scope, loc, !findInstructions}, &out) + err := c.call("FindLocation", FindLocationIn{scope, loc, !findInstructions, substitutePathRules}, &out) return out.Locations, err } -// Disassemble code between startPC and endPC +// DisassembleRange disassembles code between startPC and endPC func (c *RPCClient) DisassembleRange(scope api.EvalScope, startPC, endPC uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) { var out DisassembleOut err := c.call("Disassemble", DisassembleIn{scope, startPC, endPC, flavour}, &out) return out.Disassemble, err } -// Disassemble function containing pc +// DisassemblePC disassembles function containing pc func (c *RPCClient) DisassemblePC(scope api.EvalScope, pc uint64, flavour api.AssemblyFlavour) (api.AsmInstructions, error) { var out DisassembleOut err := c.call("Disassemble", DisassembleIn{scope, pc, 0, flavour}, &out) @@ -441,21 +484,37 @@ func (c *RPCClient) ListDynamicLibraries() ([]api.Image, error) { return out.List, nil } -func (c *RPCClient) ExamineMemory(address uintptr, count int) ([]byte, error) { +func (c *RPCClient) ExamineMemory(address uint64, count int) ([]byte, bool, error) { out := &ExaminedMemoryOut{} err := c.call("ExamineMemory", ExamineMemoryIn{Length: count, Address: address}, out) if err != nil { - return nil, err + return nil, false, err } - - return out.Mem, nil + return out.Mem, out.IsLittleEndian, nil } func (c *RPCClient) StopRecording() error { return c.call("StopRecording", StopRecordingIn{}, &StopRecordingOut{}) } +func (c *RPCClient) CoreDumpStart(dest string) (api.DumpState, error) { + out := &DumpStartOut{} + err := c.call("DumpStart", DumpStartIn{Destination: dest}, out) + return out.State, err +} + +func (c *RPCClient) CoreDumpWait(msec int) api.DumpState { + out := &DumpWaitOut{} + _ = c.call("DumpWait", DumpWaitIn{Wait: msec}, out) + return out.State +} + +func (c *RPCClient) CoreDumpCancel() error { + out := &DumpCancelOut{} + return c.call("DumpCancel", DumpCancelIn{}, out) +} + func (c *RPCClient) call(method string, args, reply interface{}) error { return c.client.Call("RPCServer."+method, args, reply) } diff --git a/service/rpc2/server.go b/service/rpc2/server.go index 024bd29daf..afcc164ac9 100644 --- a/service/rpc2/server.go +++ b/service/rpc2/server.go @@ -3,8 +3,11 @@ package rpc2 import ( "errors" "fmt" + "sort" "time" + "github.com/go-delve/delve/pkg/dwarf/op" + "github.com/go-delve/delve/pkg/proc" "github.com/go-delve/delve/service" "github.com/go-delve/delve/service/api" "github.com/go-delve/delve/service/debugger" @@ -55,12 +58,7 @@ type DetachOut struct { // Detach detaches the debugger, optionally killing the process. func (s *RPCServer) Detach(arg DetachIn, out *DetachOut) error { - err := s.debugger.Detach(arg.Kill) - if s.config.DisconnectChan != nil { - close(s.config.DisconnectChan) - s.config.DisconnectChan = nil - } - return err + return s.debugger.Detach(arg.Kill) } type RestartIn struct { @@ -89,6 +87,7 @@ type RestartOut struct { // Restart restarts program. func (s *RPCServer) Restart(arg RestartIn, cb service.RPCCallback) { + close(cb.SetupDoneChan()) if s.config.Debugger.AttachPid != 0 { cb.Return(nil, errors.New("cannot restart process Delve did not create")) return @@ -110,6 +109,7 @@ type StateOut struct { // State returns the current debugger state. func (s *RPCServer) State(arg StateIn, cb service.RPCCallback) { + close(cb.SetupDoneChan()) var out StateOut st, err := s.debugger.State(arg.NonBlocking) if err != nil { @@ -126,7 +126,7 @@ type CommandOut struct { // Command interrupts, continues and steps through the program. func (s *RPCServer) Command(command api.DebuggerCommand, cb service.RPCCallback) { - st, err := s.debugger.Command(&command) + st, err := s.debugger.Command(&command, cb.SetupDoneChan()) if err != nil { cb.Return(nil, err) return @@ -136,6 +136,18 @@ func (s *RPCServer) Command(command api.DebuggerCommand, cb service.RPCCallback) cb.Return(out, nil) } +type GetBufferedTracepointsIn struct { +} + +type GetBufferedTracepointsOut struct { + TracepointResults []api.TracepointResult +} + +func (s *RPCServer) GetBufferedTracepoints(arg GetBufferedTracepointsIn, out *GetBufferedTracepointsOut) error { + out.TracepointResults = s.debugger.GetBufferedTracepoints() + return nil +} + type GetBreakpointIn struct { Id int Name string @@ -189,7 +201,11 @@ func (s *RPCServer) Stacktrace(arg StacktraceIn, out *StacktraceOut) error { arg.Opts |= api.StacktraceReadDefers } var err error - out.Locations, err = s.debugger.Stacktrace(arg.Id, arg.Depth, arg.Opts, api.LoadConfigToProc(cfg)) + rawlocs, err := s.debugger.Stacktrace(arg.Id, arg.Depth, arg.Opts) + if err != nil { + return err + } + out.Locations, err = s.debugger.ConvertStacktrace(rawlocs, api.LoadConfigToProc(cfg)) return err } @@ -211,6 +227,7 @@ func (s *RPCServer) Ancestors(arg AncestorsIn, out *AncestorsOut) error { } type ListBreakpointsIn struct { + All bool } type ListBreakpointsOut struct { @@ -219,7 +236,7 @@ type ListBreakpointsOut struct { // ListBreakpoints gets all breakpoints. func (s *RPCServer) ListBreakpoints(arg ListBreakpointsIn, out *ListBreakpointsOut) error { - out.Breakpoints = s.debugger.Breakpoints() + out.Breakpoints = s.debugger.Breakpoints(arg.All) return nil } @@ -231,20 +248,14 @@ type CreateBreakpointOut struct { Breakpoint api.Breakpoint } -// CreateBreakpoint creates a new breakpoint. -// -// - If arg.Breakpoint.File is not an empty string the breakpoint -// will be created on the specified file:line location -// -// - If arg.Breakpoint.FunctionName is not an empty string -// the breakpoint will be created on the specified function:line -// location. -// -// - If arg.Breakpoint.Addrs is filled it will create a logical breakpoint -// corresponding to all specified addresses. -// -// - Otherwise the value specified by arg.Breakpoint.Addr will be used. +// CreateBreakpoint creates a new breakpoint. The client is expected to populate `CreateBreakpointIn` +// with an `api.Breakpoint` struct describing where to set the breakpoing. For more information on +// how to properly request a breakpoint via the `api.Breakpoint` struct see the documentation for +// `debugger.CreateBreakpoint` here: https://pkg.go.dev/github.com/go-delve/delve/service/debugger#Debugger.CreateBreakpoint. func (s *RPCServer) CreateBreakpoint(arg CreateBreakpointIn, out *CreateBreakpointOut) error { + if err := api.ValidBreakpointName(arg.Breakpoint.Name); err != nil { + return err + } createdbp, err := s.debugger.CreateBreakpoint(&arg.Breakpoint) if err != nil { return err @@ -253,6 +264,18 @@ func (s *RPCServer) CreateBreakpoint(arg CreateBreakpointIn, out *CreateBreakpoi return nil } +type CreateEBPFTracepointIn struct { + FunctionName string +} + +type CreateEBPFTracepointOut struct { + Breakpoint api.Breakpoint +} + +func (s *RPCServer) CreateEBPFTracepoint(arg CreateEBPFTracepointIn, out *CreateEBPFTracepointOut) error { + return s.debugger.CreateEBPFTracepoint(arg.FunctionName) +} + type ClearBreakpointIn struct { Id int Name string @@ -285,6 +308,41 @@ func (s *RPCServer) ClearBreakpoint(arg ClearBreakpointIn, out *ClearBreakpointO return nil } +type ToggleBreakpointIn struct { + Id int + Name string +} + +type ToggleBreakpointOut struct { + Breakpoint *api.Breakpoint +} + +// ToggleBreakpoint toggles on or off a breakpoint by Name (if Name is not an +// empty string) or by ID. +func (s *RPCServer) ToggleBreakpoint(arg ToggleBreakpointIn, out *ToggleBreakpointOut) error { + var bp *api.Breakpoint + if arg.Name != "" { + bp = s.debugger.FindBreakpointByName(arg.Name) + if bp == nil { + return fmt.Errorf("no breakpoint with name %s", arg.Name) + } + } else { + bp = s.debugger.FindBreakpoint(arg.Id) + if bp == nil { + return fmt.Errorf("no breakpoint with id %d", arg.Id) + } + } + bp.Disabled = !bp.Disabled + if err := api.ValidBreakpointName(bp.Name); err != nil { + return err + } + if err := s.debugger.AmendBreakpoint(bp); err != nil { + return err + } + out.Breakpoint = bp + return nil +} + type AmendBreakpointIn struct { Breakpoint api.Breakpoint } @@ -298,6 +356,9 @@ type AmendBreakpointOut struct { // // arg.Breakpoint.ID must be a valid breakpoint ID func (s *RPCServer) AmendBreakpoint(arg AmendBreakpointIn, out *AmendBreakpointOut) error { + if err := api.ValidBreakpointName(arg.Breakpoint.Name); err != nil { + return err + } return s.debugger.AmendBreakpoint(&arg.Breakpoint) } @@ -320,8 +381,14 @@ type ListThreadsOut struct { // ListThreads lists all threads. func (s *RPCServer) ListThreads(arg ListThreadsIn, out *ListThreadsOut) (err error) { - out.Threads, err = s.debugger.Threads() - return err + threads, err := s.debugger.Threads() + if err != nil { + return err + } + s.debugger.LockTarget() + defer s.debugger.UnlockTarget() + out.Threads = api.ConvertThreads(threads) + return nil } type GetThreadIn struct { @@ -341,7 +408,9 @@ func (s *RPCServer) GetThread(arg GetThreadIn, out *GetThreadOut) error { if t == nil { return fmt.Errorf("no thread with id %d", arg.Id) } - out.Thread = t + s.debugger.LockTarget() + defer s.debugger.UnlockTarget() + out.Thread = api.ConvertThread(t) return nil } @@ -356,21 +425,11 @@ type ListPackageVarsOut struct { // ListPackageVars lists all package variables in the context of the current thread. func (s *RPCServer) ListPackageVars(arg ListPackageVarsIn, out *ListPackageVarsOut) error { - state, err := s.debugger.State(false) + vars, err := s.debugger.PackageVariables(arg.Filter, *api.LoadConfigToProc(&arg.Cfg)) if err != nil { return err } - - current := state.CurrentThread - if current == nil { - return fmt.Errorf("no current thread") - } - - vars, err := s.debugger.PackageVariables(current.ID, arg.Filter, *api.LoadConfigToProc(&arg.Cfg)) - if err != nil { - return err - } - out.Variables = vars + out.Variables = api.ConvertVars(vars) return nil } @@ -397,11 +456,18 @@ func (s *RPCServer) ListRegisters(arg ListRegistersIn, out *ListRegistersOut) er arg.ThreadID = state.CurrentThread.ID } - regs, err := s.debugger.Registers(arg.ThreadID, arg.Scope, arg.IncludeFp) + var regs *op.DwarfRegisters + var err error + + if arg.Scope != nil { + regs, err = s.debugger.ScopeRegisters(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, arg.IncludeFp) + } else { + regs, err = s.debugger.ThreadRegisters(arg.ThreadID, arg.IncludeFp) + } if err != nil { return err } - out.Regs = regs + out.Regs = api.ConvertRegisters(regs, s.debugger.DwarfRegisterToString, arg.IncludeFp) out.Registers = out.Regs.String() return nil @@ -418,11 +484,11 @@ type ListLocalVarsOut struct { // ListLocalVars lists all local variables in scope. func (s *RPCServer) ListLocalVars(arg ListLocalVarsIn, out *ListLocalVarsOut) error { - vars, err := s.debugger.LocalVariables(arg.Scope, *api.LoadConfigToProc(&arg.Cfg)) + vars, err := s.debugger.LocalVariables(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, *api.LoadConfigToProc(&arg.Cfg)) if err != nil { return err } - out.Variables = vars + out.Variables = api.ConvertVars(vars) return nil } @@ -437,11 +503,11 @@ type ListFunctionArgsOut struct { // ListFunctionArgs lists all arguments to the current function func (s *RPCServer) ListFunctionArgs(arg ListFunctionArgsIn, out *ListFunctionArgsOut) error { - vars, err := s.debugger.FunctionArguments(arg.Scope, *api.LoadConfigToProc(&arg.Cfg)) + vars, err := s.debugger.FunctionArguments(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, *api.LoadConfigToProc(&arg.Cfg)) if err != nil { return err } - out.Args = vars + out.Args = api.ConvertVars(vars) return nil } @@ -455,20 +521,20 @@ type EvalOut struct { Variable *api.Variable } -// EvalVariable returns a variable in the specified context. +// Eval returns a variable in the specified context. // -// See https://github.com/go-delve/delve/wiki/Expressions for -// a description of acceptable values of arg.Expr. +// See https://github.com/go-delve/delve/blob/master/Documentation/cli/expr.md +// for a description of acceptable values of arg.Expr. func (s *RPCServer) Eval(arg EvalIn, out *EvalOut) error { cfg := arg.Cfg if cfg == nil { cfg = &api.LoadConfig{FollowPointers: true, MaxVariableRecurse: 1, MaxStringLen: 64, MaxArrayValues: 64, MaxStructFields: -1} } - v, err := s.debugger.EvalVariableInScope(arg.Scope, arg.Expr, *api.LoadConfigToProc(cfg)) + v, err := s.debugger.EvalVariableInScope(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, arg.Expr, *api.LoadConfigToProc(cfg)) if err != nil { return err } - out.Variable = v + out.Variable = api.ConvertVar(v) return nil } @@ -484,7 +550,7 @@ type SetOut struct { // Set sets the value of a variable. Only numerical types and // pointers are currently supported. func (s *RPCServer) Set(arg SetIn, out *SetOut) error { - return s.debugger.SetVariableInScope(arg.Scope, arg.Symbol, arg.Value) + return s.debugger.SetVariableInScope(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, arg.Symbol, arg.Value) } type ListSourcesIn struct { @@ -544,11 +610,16 @@ func (s *RPCServer) ListTypes(arg ListTypesIn, out *ListTypesOut) error { type ListGoroutinesIn struct { Start int Count int + + Filters []api.ListGoroutinesFilter + api.GoroutineGroupingOptions } type ListGoroutinesOut struct { - Goroutines []*api.Goroutine - Nextg int + Goroutines []*api.Goroutine + Nextg int + Groups []api.GoroutineGroup + TooManyGroups bool } // ListGoroutines lists all goroutines. @@ -557,12 +628,40 @@ type ListGoroutinesOut struct { // parameter, to get more goroutines from ListGoroutines. // Passing a value of Start that wasn't returned by ListGoroutines will skip // an undefined number of goroutines. +// +// If arg.Filters are specified the list of returned goroutines is filtered +// applying the specified filters. +// For example: +// ListGoroutinesFilter{ Kind: ListGoroutinesFilterUserLoc, Negated: false, Arg: "afile.go" } +// will only return goroutines whose UserLoc contains "afile.go" as a substring. +// More specifically a goroutine matches a location filter if the specified +// location, formatted like this: +// filename:lineno in function +// contains Arg[0] as a substring. +// +// Filters can also be applied to goroutine labels: +// ListGoroutineFilter{ Kind: ListGoroutinesFilterLabel, Negated: false, Arg: "key=value" } +// this filter will only return goroutines that have a key=value label. +// +// If arg.GroupBy is not GoroutineFieldNone then the goroutines will +// be grouped with the specified criterion. +// If the value of arg.GroupBy is GoroutineLabel goroutines will +// be grouped by the value of the label with key GroupByKey. +// For each group a maximum of MaxExamples example goroutines are +// returned, as well as the total number of goroutines in the group. func (s *RPCServer) ListGoroutines(arg ListGoroutinesIn, out *ListGoroutinesOut) error { + //TODO(aarzilli): if arg contains a running goroutines filter (not negated) + // and start == 0 and count == 0 then we can optimize this by just looking + // at threads directly. gs, nextg, err := s.debugger.Goroutines(arg.Start, arg.Count) if err != nil { return err } - out.Goroutines = gs + gs = s.debugger.FilterGoroutines(gs, arg.Filters) + gs, out.Groups, out.TooManyGroups = s.debugger.GroupGoroutines(gs, &arg.GoroutineGroupingOptions) + s.debugger.LockTarget() + defer s.debugger.UnlockTarget() + out.Goroutines = api.ConvertGoroutines(s.debugger.Target(), gs) out.Nextg = nextg return nil } @@ -586,6 +685,13 @@ type FindLocationIn struct { Scope api.EvalScope Loc string IncludeNonExecutableLines bool + + // SubstitutePathRules is a slice of source code path substitution rules, + // the first entry of each pair is the path of a directory as it appears in + // the executable file (i.e. the location of a source file when the program + // was compiled), the second entry of each pair is the location of the same + // directory on the client system. + SubstitutePathRules [][2]string } type FindLocationOut struct { @@ -607,7 +713,7 @@ type FindLocationOut struct { // NOTE: this function does not actually set breakpoints. func (c *RPCServer) FindLocation(arg FindLocationIn, out *FindLocationOut) error { var err error - out.Locations, err = c.debugger.FindLocation(arg.Scope, arg.Loc, arg.IncludeNonExecutableLines) + out.Locations, err = c.debugger.FindLocation(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, arg.Loc, arg.IncludeNonExecutableLines, arg.SubstitutePathRules) return err } @@ -630,8 +736,15 @@ type DisassembleOut struct { // Disassemble will also try to calculate the destination address of an absolute indirect CALL if it happens to be the instruction the selected goroutine is stopped at. func (c *RPCServer) Disassemble(arg DisassembleIn, out *DisassembleOut) error { var err error - out.Disassemble, err = c.debugger.Disassemble(arg.Scope.GoroutineID, arg.StartPC, arg.EndPC, arg.Flavour) - return err + insts, err := c.debugger.Disassemble(arg.Scope.GoroutineID, arg.StartPC, arg.EndPC) + if err != nil { + return err + } + out.Disassemble = make(api.AsmInstructions, len(insts)) + for i := range insts { + out.Disassemble[i] = api.ConvertAsmInstruction(insts[i], c.debugger.AsmInstructionText(&insts[i], proc.AssemblyFlavour(arg.Flavour))) + } + return nil } type RecordedIn struct { @@ -670,8 +783,15 @@ type ListCheckpointsOut struct { func (s *RPCServer) ListCheckpoints(arg ListCheckpointsIn, out *ListCheckpointsOut) error { var err error - out.Checkpoints, err = s.debugger.Checkpoints() - return err + cps, err := s.debugger.Checkpoints() + if err != nil { + return err + } + out.Checkpoints = make([]api.Checkpoint, len(cps)) + for i := range cps { + out.Checkpoints[i] = api.Checkpoint(cps[i]) + } + return nil } type ClearCheckpointIn struct { @@ -740,7 +860,11 @@ type ListDynamicLibrariesOut struct { } func (s *RPCServer) ListDynamicLibraries(in ListDynamicLibrariesIn, out *ListDynamicLibrariesOut) error { - out.List = s.debugger.ListDynamicLibraries() + imgs := s.debugger.ListDynamicLibraries() + out.List = make([]api.Image, 0, len(imgs)) + for i := range imgs { + out.List = append(out.List, api.ConvertImage(imgs[i])) + } return nil } @@ -760,19 +884,39 @@ type ListPackagesBuildInfoOut struct { // Note that the directory path is a best guess and may be wrong is a tool // other than cmd/go is used to perform the build. func (s *RPCServer) ListPackagesBuildInfo(in ListPackagesBuildInfoIn, out *ListPackagesBuildInfoOut) error { - out.List = s.debugger.ListPackagesBuildInfo(in.IncludeFiles) + pkgs := s.debugger.ListPackagesBuildInfo(in.IncludeFiles) + out.List = make([]api.PackageBuildInfo, 0, len(pkgs)) + for _, pkg := range pkgs { + var files []string + + if len(pkg.Files) > 0 { + files = make([]string, 0, len(pkg.Files)) + for file := range pkg.Files { + files = append(files, file) + } + } + + sort.Strings(files) + + out.List = append(out.List, api.PackageBuildInfo{ + ImportPath: pkg.ImportPath, + DirectoryPath: pkg.DirectoryPath, + Files: files, + }) + } return nil } // ExamineMemoryIn holds the arguments of ExamineMemory type ExamineMemoryIn struct { - Address uintptr + Address uint64 Length int } // ExaminedMemoryOut holds the return values of ExamineMemory type ExaminedMemoryOut struct { - Mem []byte + Mem []byte + IsLittleEndian bool } func (s *RPCServer) ExamineMemory(arg ExamineMemoryIn, out *ExaminedMemoryOut) error { @@ -785,6 +929,8 @@ func (s *RPCServer) ExamineMemory(arg ExamineMemoryIn, out *ExaminedMemoryOut) e } out.Mem = Mem + out.IsLittleEndian = true //TODO: get byte order from debugger.target.BinInfo().Arch + return nil } @@ -795,6 +941,7 @@ type StopRecordingOut struct { } func (s *RPCServer) StopRecording(arg StopRecordingIn, cb service.RPCCallback) { + close(cb.SetupDoneChan()) var out StopRecordingOut err := s.debugger.StopRecording() if err != nil { @@ -803,3 +950,64 @@ func (s *RPCServer) StopRecording(arg StopRecordingIn, cb service.RPCCallback) { } cb.Return(out, nil) } + +type DumpStartIn struct { + Destination string +} + +type DumpStartOut struct { + State api.DumpState +} + +// DumpStart starts a core dump to arg.Destination. +func (s *RPCServer) DumpStart(arg DumpStartIn, out *DumpStartOut) error { + err := s.debugger.DumpStart(arg.Destination) + if err != nil { + return err + } + out.State = *api.ConvertDumpState(s.debugger.DumpWait(0)) + return nil +} + +type DumpWaitIn struct { + Wait int +} + +type DumpWaitOut struct { + State api.DumpState +} + +// DumpWait waits for the core dump to finish or for arg.Wait milliseconds. +// Wait == 0 means return immediately. +// Returns the core dump status +func (s *RPCServer) DumpWait(arg DumpWaitIn, out *DumpWaitOut) error { + out.State = *api.ConvertDumpState(s.debugger.DumpWait(time.Duration(arg.Wait) * time.Millisecond)) + return nil +} + +type DumpCancelIn struct { +} + +type DumpCancelOut struct { +} + +// DumpCancel cancels the core dump. +func (s *RPCServer) DumpCancel(arg DumpCancelIn, out *DumpCancelOut) error { + return s.debugger.DumpCancel() +} + +type CreateWatchpointIn struct { + Scope api.EvalScope + Expr string + Type api.WatchType +} + +type CreateWatchpointOut struct { + *api.Breakpoint +} + +func (s *RPCServer) CreateWatchpoint(arg CreateWatchpointIn, out *CreateWatchpointOut) error { + var err error + out.Breakpoint, err = s.debugger.CreateWatchpoint(arg.Scope.GoroutineID, arg.Scope.Frame, arg.Scope.DeferredCall, arg.Expr, arg.Type) + return err +} diff --git a/service/rpccallback.go b/service/rpccallback.go index 9b047826f6..224dd6c985 100644 --- a/service/rpccallback.go +++ b/service/rpccallback.go @@ -3,4 +3,9 @@ package service // RPCCallback is used by RPC methods to return their result asynchronously. type RPCCallback interface { Return(out interface{}, err error) + + // SetupDone returns a channel that should be closed to signal that the + // asynchornous method has completed setup and the server is ready to + // receive other requests. + SetupDoneChan() chan struct{} } diff --git a/service/rpccommon/sameuser.go b/service/rpccommon/sameuser.go deleted file mode 100644 index b2d6e1cc28..0000000000 --- a/service/rpccommon/sameuser.go +++ /dev/null @@ -1,9 +0,0 @@ -//+build !linux - -package rpccommon - -import "net" - -func canAccept(_, _ net.Addr) bool { - return true -} diff --git a/service/rpccommon/sameuser_linux.go b/service/rpccommon/sameuser_linux.go deleted file mode 100644 index 3b20a31108..0000000000 --- a/service/rpccommon/sameuser_linux.go +++ /dev/null @@ -1,115 +0,0 @@ -//+build linux - -package rpccommon - -import ( - "bytes" - "encoding/binary" - "fmt" - "io/ioutil" - "log" - "net" - "os" - "strings" -) - -// for testing -var ( - uid = os.Getuid() - readFile = ioutil.ReadFile -) - -type errConnectionNotFound struct { - filename string -} - -func (e *errConnectionNotFound) Error() string { - return fmt.Sprintf("connection not found in %s", e.filename) -} - -func sameUserForHexLocalAddr(filename, hexaddr string) (bool, error) { - b, err := readFile(filename) - if err != nil { - return false, err - } - for _, line := range strings.Split(strings.TrimSpace(string(b)), "\n") { - // The format contains whitespace padding (%4d, %5u), so we use - // fmt.Sscanf instead of splitting on whitespace. - var ( - sl int - localAddr, remoteAddr string - state int - queue, timer string - retransmit int - remoteUID uint - ) - // Note that we must use %d where the kernel format uses %5u: - // %u is not understood by the fmt package (%U is something else), - // %5d cuts off longer uids (e.g. 149098 on gLinux). - n, err := fmt.Sscanf(line, "%4d: %s %s %02X %s %s %08X %d", - &sl, &localAddr, &remoteAddr, &state, &queue, &timer, &retransmit, &remoteUID) - if n != 8 || err != nil { - continue // invalid line (e.g. header line) - } - if localAddr != hexaddr { - continue - } - return uid == int(remoteUID), nil - } - return false, &errConnectionNotFound{filename} -} - -func sameUserForRemoteAddr4(remoteAddr *net.TCPAddr) (bool, error) { - // For details about the format, see the kernel side implementation: - // https://elixir.bootlin.com/linux/v5.2.2/source/net/ipv4/tcp_ipv4.c#L2375 - b := remoteAddr.IP.To4() - hexaddr := fmt.Sprintf("%02X%02X%02X%02X:%04X", b[3], b[2], b[1], b[0], remoteAddr.Port) - r, err := sameUserForHexLocalAddr("/proc/net/tcp", hexaddr) - if _, isNotFound := err.(*errConnectionNotFound); isNotFound { - // See Issue #1835 - r, err2 := sameUserForHexLocalAddr("/proc/net/tcp6", "0000000000000000FFFF0000"+hexaddr) - if err2 == nil { - return r, nil - } - } - return r, err -} - -func sameUserForRemoteAddr6(remoteAddr *net.TCPAddr) (bool, error) { - a16 := remoteAddr.IP.To16() - // For details about the format, see the kernel side implementation: - // https://elixir.bootlin.com/linux/v5.2.2/source/net/ipv6/tcp_ipv6.c#L1792 - words := make([]uint32, 4) - if err := binary.Read(bytes.NewReader(a16), binary.LittleEndian, words); err != nil { - return false, err - } - hexaddr := fmt.Sprintf("%08X%08X%08X%08X:%04X", words[0], words[1], words[2], words[3], remoteAddr.Port) - return sameUserForHexLocalAddr("/proc/net/tcp6", hexaddr) -} - -func sameUserForRemoteAddr(remoteAddr *net.TCPAddr) (bool, error) { - if remoteAddr.IP.To4() == nil { - return sameUserForRemoteAddr6(remoteAddr) - } - return sameUserForRemoteAddr4(remoteAddr) -} - -func canAccept(listenAddr, remoteAddr net.Addr) bool { - laddr, ok := listenAddr.(*net.TCPAddr) - if !ok || !laddr.IP.IsLoopback() { - return true - } - addr, ok := remoteAddr.(*net.TCPAddr) - if !ok { - panic(fmt.Sprintf("BUG: conn.RemoteAddr is %T, want *net.TCPAddr", remoteAddr)) - } - same, err := sameUserForRemoteAddr(addr) - if err != nil { - log.Printf("cannot check remote address: %v", err) - } - if !same { - log.Printf("closing connection from different user (%v): connections to localhost are only accepted from the same UNIX user for security reasons", addr) - return false - } - return true -} diff --git a/service/rpccommon/server.go b/service/rpccommon/server.go index 887540c417..328885fc09 100644 --- a/service/rpccommon/server.go +++ b/service/rpccommon/server.go @@ -1,6 +1,7 @@ package rpccommon import ( + "bufio" "bytes" "encoding/json" "fmt" @@ -19,7 +20,9 @@ import ( "github.com/go-delve/delve/pkg/version" "github.com/go-delve/delve/service" "github.com/go-delve/delve/service/api" + "github.com/go-delve/delve/service/dap" "github.com/go-delve/delve/service/debugger" + "github.com/go-delve/delve/service/internal/sameuser" "github.com/go-delve/delve/service/rpc1" "github.com/go-delve/delve/service/rpc2" "github.com/sirupsen/logrus" @@ -46,12 +49,15 @@ type ServerImpl struct { } type RPCCallback struct { - s *ServerImpl - sending *sync.Mutex - codec rpc.ServerCodec - req rpc.Request + s *ServerImpl + sending *sync.Mutex + codec rpc.ServerCodec + req rpc.Request + setupDone chan struct{} } +var _ service.RPCCallback = &RPCCallback{} + // RPCServer implements the RPC method calls common to all versions of the API. type RPCServer struct { s *ServerImpl @@ -73,7 +79,7 @@ func NewServer(config *service.Config) *ServerImpl { } if config.Debugger.Foreground { // Print listener address - logflags.WriteAPIListeningMessage(config.Listener.Addr().String()) + logflags.WriteAPIListeningMessage(config.Listener.Addr()) logger.Debug("API server pid = ", os.Getpid()) } return &ServerImpl{ @@ -86,10 +92,14 @@ func NewServer(config *service.Config) *ServerImpl { // Stop stops the JSON-RPC server. func (s *ServerImpl) Stop() error { + s.log.Debug("stopping") + close(s.stopChan) if s.config.AcceptMulti { - close(s.stopChan) s.listener.Close() } + if s.debugger.IsRunning() { + s.debugger.Command(&api.DebuggerCommand{Name: api.Halt}, nil) + } kill := s.config.Debugger.AttachPid == 0 return s.debugger.Detach(kill) } @@ -142,13 +152,13 @@ func (s *ServerImpl) Run() error { } if s.config.CheckLocalConnUser { - if !canAccept(s.listener.Addr(), c.RemoteAddr()) { + if !sameuser.CanAccept(s.listener.Addr(), c.LocalAddr(), c.RemoteAddr()) { c.Close() continue } } - go s.serveJSONCodec(c) + go s.serveConnectionDemux(c) if !s.config.AcceptMulti { break } @@ -157,14 +167,36 @@ func (s *ServerImpl) Run() error { return nil } +type bufReadWriteCloser struct { + *bufio.Reader + io.WriteCloser +} + +func (s *ServerImpl) serveConnectionDemux(c io.ReadWriteCloser) { + conn := &bufReadWriteCloser{bufio.NewReader(c), c} + b, err := conn.Peek(1) + if err != nil { + s.log.Warnf("error determining new connection protocol: %v", err) + return + } + if b[0] == 'C' { // C is for DAP's Content-Length + s.log.Debugf("serving DAP on new connection") + ds := dap.NewSession(conn, &dap.Config{Config: s.config, StopTriggered: s.stopChan}, s.debugger) + go ds.ServeDAPCodec() + } else { + s.log.Debugf("serving JSON-RPC on new connection") + go s.serveJSONCodec(conn) + } +} + // Precompute the reflect type for error. Can't use error directly // because Typeof takes an empty interface value. This is annoying. var typeOfError = reflect.TypeOf((*error)(nil)).Elem() // Is this an exported - upper case - name? func isExported(name string) bool { - rune, _ := utf8.DecodeRuneInString(name) - return unicode.IsUpper(rune) + ch, _ := utf8.DecodeRuneInString(name) + return unicode.IsUpper(ch) } // Is this type exported or a builtin? @@ -236,12 +268,10 @@ func suitableMethods(rcvr interface{}, methods map[string]*methodType, log *logr log.Warn("method", mname, "returns", returnType.String(), "not error") continue } - } else { + } else if mtype.NumOut() != 0 { // Method needs zero outs. - if mtype.NumOut() != 0 { - log.Warn("method", mname, "has wrong number of outs:", mtype.NumOut()) - continue - } + log.Warn("method", mname, "has wrong number of outs:", mtype.NumOut()) + continue } methods[sname+"."+mname] = &methodType{method: method, ArgType: argType, ReplyType: replyType, Synchronous: synchronous, Rcvr: rcvrv} } @@ -322,13 +352,17 @@ func (s *ServerImpl) serveJSONCodec(conn io.ReadWriteCloser) { s.log.Debugf("-> %T%s error: %q", replyv.Interface(), replyvbytes, errmsg) } s.sendResponse(sending, &req, &resp, replyv.Interface(), codec, errmsg) + if req.ServiceMethod == "RPCServer.Detach" && s.config.DisconnectChan != nil { + close(s.config.DisconnectChan) + s.config.DisconnectChan = nil + } } else { if logflags.RPC() { argvbytes, _ := json.Marshal(argv.Interface()) s.log.Debugf("(async %d) <- %s(%T%s)", req.Seq, req.ServiceMethod, argv.Interface(), argvbytes) } function := mtype.method.Func - ctl := &RPCCallback{s, sending, codec, req} + ctl := &RPCCallback{s, sending, codec, req, make(chan struct{})} go func() { defer func() { if ierr := recover(); ierr != nil { @@ -337,6 +371,7 @@ func (s *ServerImpl) serveJSONCodec(conn io.ReadWriteCloser) { }() function.Call([]reflect.Value{mtype.Rcvr, argv, reflect.ValueOf(ctl)}) }() + <-ctl.setupDone } } codec.Close() @@ -363,6 +398,12 @@ func (s *ServerImpl) sendResponse(sending *sync.Mutex, req *rpc.Request, resp *r } func (cb *RPCCallback) Return(out interface{}, err error) { + select { + case <-cb.setupDone: + // already closed + default: + close(cb.setupDone) + } errmsg := "" if err != nil { errmsg = err.Error() @@ -375,6 +416,10 @@ func (cb *RPCCallback) Return(out interface{}, err error) { cb.s.sendResponse(cb.sending, &cb.req, &resp, out, cb.codec, errmsg) } +func (cb *RPCCallback) SetupDoneChan() chan struct{} { + return cb.setupDone +} + // GetVersion returns the version of delve as well as the API version // currently served. func (s *RPCServer) GetVersion(args api.GetVersionIn, out *api.GetVersionOut) error { @@ -383,7 +428,7 @@ func (s *RPCServer) GetVersion(args api.GetVersionIn, out *api.GetVersionOut) er return s.s.debugger.GetVersion(out) } -// Changes version of the API being served. +// SetApiVersion changes version of the API being served. func (s *RPCServer) SetApiVersion(args api.SetAPIVersionIn, out *api.SetAPIVersionOut) error { if args.APIVersion < 2 { args.APIVersion = 1 diff --git a/service/test/common_test.go b/service/test/common_test.go index 1e217e1e39..473e3cc62b 100644 --- a/service/test/common_test.go +++ b/service/test/common_test.go @@ -9,6 +9,8 @@ import ( "testing" "github.com/go-delve/delve/service/api" + "github.com/go-delve/delve/service/rpc1" + "github.com/go-delve/delve/service/rpc2" ) func assertNoError(err error, t *testing.T, s string) { @@ -63,8 +65,15 @@ type BreakpointLister interface { ListBreakpoints() ([]*api.Breakpoint, error) } -func countBreakpoints(t *testing.T, c BreakpointLister) int { - bps, err := c.ListBreakpoints() +func countBreakpoints(t *testing.T, c interface{}) int { + var bps []*api.Breakpoint + var err error + switch c := c.(type) { + case *rpc2.RPCClient: + bps, err = c.ListBreakpoints(false) + case *rpc1.RPCClient: + bps, err = c.ListBreakpoints() + } assertNoError(err, t, "ListBreakpoints()") bpcount := 0 for _, bp := range bps { @@ -80,7 +89,7 @@ type locationFinder1 interface { } type locationFinder2 interface { - FindLocation(api.EvalScope, string, bool) ([]api.Location, error) + FindLocation(api.EvalScope, string, bool, [][2]string) ([]api.Location, error) } func findLocationHelper(t *testing.T, c interface{}, loc string, shouldErr bool, count int, checkAddr uint64) []uint64 { @@ -91,7 +100,7 @@ func findLocationHelper(t *testing.T, c interface{}, loc string, shouldErr bool, case locationFinder1: locs, err = c.FindLocation(api.EvalScope{GoroutineID: -1}, loc) case locationFinder2: - locs, err = c.FindLocation(api.EvalScope{GoroutineID: -1}, loc, false) + locs, err = c.FindLocation(api.EvalScope{GoroutineID: -1}, loc, false, nil) default: t.Errorf("unexpected type %T passed to findLocationHelper", c) } diff --git a/service/test/integration1_test.go b/service/test/integration1_test.go index 89b5f413df..c3d46dce03 100644 --- a/service/test/integration1_test.go +++ b/service/test/integration1_test.go @@ -716,6 +716,15 @@ func Test1ClientServer_SetVariable(t *testing.T) { } func Test1ClientServer_FullStacktrace(t *testing.T) { + if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { + t.Skip("cgo doesn't work on darwin/arm64") + } + + lenient := false + if runtime.GOOS == "windows" { + lenient = true + } + withTestClient1("goroutinestackprog", t, func(c *rpc1.RPCClient) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.stacktraceme", Line: -1}) assertNoError(err, t, "CreateBreakpoint()") @@ -728,21 +737,22 @@ func Test1ClientServer_FullStacktrace(t *testing.T) { assertNoError(err, t, "GoroutinesInfo()") found := make([]bool, 10) for _, g := range gs { - frames, err := c.Stacktrace(g.ID, 10, true) + frames, err := c.Stacktrace(g.ID, 40, true) assertNoError(err, t, fmt.Sprintf("Stacktrace(%d)", g.ID)) + t.Logf("goroutine %d", g.ID) for i, frame := range frames { + t.Logf("\tframe %d off=%#x bpoff=%#x pc=%#x %s:%d %s", i, frame.FrameOffset, frame.FramePointerOffset, frame.PC, frame.File, frame.Line, frame.Function.Name()) if frame.Function == nil { continue } if frame.Function.Name() != "main.agoroutine" { continue } - t.Logf("frame %d: %v", i, frame) for _, arg := range frame.Arguments { if arg.Name != "i" { continue } - t.Logf("frame %d, variable i is %v\n", i, arg) + t.Logf("\tvariable i is %+v\n", arg) argn, err := strconv.Atoi(arg.Value) if err == nil { found[argn] = true @@ -751,26 +761,18 @@ func Test1ClientServer_FullStacktrace(t *testing.T) { } } - firsterr := false - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { - // We try to make sure that all goroutines are stopped at a sensible place - // before reading their stacktrace, but due to the nature of the test - // program there is no guarantee that we always find them in a reasonable - // state. - // Asynchronous preemption in Go 1.14 exacerbates this problem, to avoid - // unnecessary flakiness allow a single goroutine to be in a bad state. - firsterr = true - } for i := range found { if !found[i] { - if firsterr { - firsterr = false + if lenient { + lenient = false } else { t.Fatalf("Goroutine %d not found", i) } } } + t.Logf("continue") + state = <-c.Continue() if state.Err != nil { t.Fatalf("Continue(): %v\n", state.Err) @@ -781,10 +783,10 @@ func Test1ClientServer_FullStacktrace(t *testing.T) { cur := 3 for i, frame := range frames { + t.Logf("\tframe %d off=%#x bpoff=%#x pc=%#x %s:%d %s", i, frame.FrameOffset, frame.FramePointerOffset, frame.PC, frame.File, frame.Line, frame.Function.Name()) if i == 0 { continue } - t.Logf("frame %d: %v", i, frame) v := frame.Var("n") if v == nil { t.Fatalf("Could not find value of variable n in frame %d", i) @@ -821,18 +823,18 @@ func Test1Issue355(t *testing.T) { state = <-ch assertError(state.Err, t, "Continue()") - _, err = c.Next() - assertError(err, t, "Next()") - _, err = c.Step() - assertError(err, t, "Step()") - _, err = c.StepInstruction() - assertError(err, t, "StepInstruction()") - _, err = c.SwitchThread(tid) - assertError(err, t, "SwitchThread()") - _, err = c.SwitchGoroutine(gid) - assertError(err, t, "SwitchGoroutine()") - _, err = c.Halt() - assertError(err, t, "Halt()") + s, err := c.Next() + assertErrorOrExited(s, err, t, "Next()") + s, err = c.Step() + assertErrorOrExited(s, err, t, "Step()") + s, err = c.StepInstruction() + assertErrorOrExited(s, err, t, "StepInstruction()") + s, err = c.SwitchThread(tid) + assertErrorOrExited(s, err, t, "SwitchThread()") + s, err = c.SwitchGoroutine(gid) + assertErrorOrExited(s, err, t, "SwitchGoroutine()") + s, err = c.Halt() + assertErrorOrExited(s, err, t, "Halt()") _, err = c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: -1}) assertError(err, t, "CreateBreakpoint()") _, err = c.ClearBreakpoint(bp.ID) @@ -1069,7 +1071,7 @@ func Test1Issue406(t *testing.T) { assertNoError(state.Err, t, "Continue()") v, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, "cfgtree") assertNoError(err, t, "EvalVariable()") - vs := v.MultilineString("") + vs := v.MultilineString("", "") t.Logf("cfgtree formats to: %s\n", vs) }) } diff --git a/service/test/integration2_test.go b/service/test/integration2_test.go index 3bacc717bd..26fc6480ce 100644 --- a/service/test/integration2_test.go +++ b/service/test/integration2_test.go @@ -9,6 +9,7 @@ import ( "net/rpc" "net/rpc/jsonrpc" "os" + "os/exec" "path/filepath" "reflect" "runtime" @@ -195,7 +196,7 @@ func TestRestart_duringStop(t *testing.T) { if c.ProcessPid() == origPid { t.Fatal("did not spawn new process, has same PID") } - bps, err := c.ListBreakpoints() + bps, err := c.ListBreakpoints(false) if err != nil { t.Fatal(err) } @@ -506,6 +507,229 @@ func TestClientServer_clearBreakpoint(t *testing.T) { }) } +func TestClientServer_toggleBreakpoint(t *testing.T) { + withTestClient2("testtoggle", t, func(c service.Client) { + toggle := func(bp *api.Breakpoint) { + t.Helper() + dbp, err := c.ToggleBreakpoint(bp.ID) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if dbp.ID != bp.ID { + t.Fatalf("The IDs don't match") + } + } + + // This one is toggled twice + bp1, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.lineOne", Tracepoint: true}) + if err != nil { + t.Fatalf("Unexpected error: %v\n", err) + } + + toggle(bp1) + toggle(bp1) + + // This one is toggled once + bp2, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.lineTwo", Tracepoint: true}) + if err != nil { + t.Fatalf("Unexpected error: %v\n", err) + } + + toggle(bp2) + + // This one is never toggled + bp3, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.lineThree", Tracepoint: true}) + if err != nil { + t.Fatalf("Unexpected error: %v\n", err) + } + + if e, a := 3, countBreakpoints(t, c); e != a { + t.Fatalf("Expected breakpoint count %d, got %d", e, a) + } + + enableCount := 0 + disabledCount := 0 + + contChan := c.Continue() + for state := range contChan { + if state.CurrentThread != nil && state.CurrentThread.Breakpoint != nil { + switch state.CurrentThread.Breakpoint.ID { + case bp1.ID, bp3.ID: + enableCount++ + case bp2.ID: + disabledCount++ + } + + t.Logf("%v", state) + } + if state.Exited { + continue + } + if state.Err != nil { + t.Fatalf("Unexpected error during continue: %v\n", state.Err) + } + } + + if enableCount != 2 { + t.Fatalf("Wrong number of enabled hits: %d\n", enableCount) + } + + if disabledCount != 0 { + t.Fatalf("A disabled breakpoint was hit: %d\n", disabledCount) + } + }) +} + +func TestClientServer_toggleAmendedBreakpoint(t *testing.T) { + withTestClient2("testtoggle", t, func(c service.Client) { + toggle := func(bp *api.Breakpoint) { + dbp, err := c.ToggleBreakpoint(bp.ID) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if dbp.ID != bp.ID { + t.Fatalf("The IDs don't match") + } + } + + // This one is toggled twice + bp, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.lineOne", Tracepoint: true}) + if err != nil { + t.Fatalf("Unexpected error: %v\n", err) + } + bp.Cond = "n == 7" + assertNoError(c.AmendBreakpoint(bp), t, "AmendBreakpoint() 1") + + // Toggle off. + toggle(bp) + // Toggle on. + toggle(bp) + + amended, err := c.GetBreakpoint(bp.ID) + if err != nil { + t.Fatal(err) + } + if amended.Cond == "" { + t.Fatal("breakpoint amendedments not preserved after toggle") + } + }) +} + +func TestClientServer_disableHitCondLSSBreakpoint(t *testing.T) { + withTestClient2("break", t, func(c service.Client) { + fp := testProgPath(t, "break") + hitCondBp, err := c.CreateBreakpoint(&api.Breakpoint{ + File: fp, + Line: 7, + HitCond: "< 3", + }) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + + state := <-c.Continue() + if state.Err != nil { + t.Fatalf("Unexpected error: %v, state: %#v", state.Err, state) + } + + f, l := state.CurrentThread.File, state.CurrentThread.Line + if f != "break.go" && l != 7 { + t.Fatal("Program did not hit breakpoint") + } + + ivar, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, "i", normalLoadConfig) + assertNoError(err, t, "EvalVariable") + + t.Logf("ivar: %s", ivar.SinglelineString()) + + if ivar.Value != "1" { + t.Fatalf("Wrong variable value: %s", ivar.Value) + } + + bp, err := c.GetBreakpoint(hitCondBp.ID) + assertNoError(err, t, "GetBreakpoint()") + + if bp.Disabled { + t.Fatalf( + "Hit condition %s is still satisfiable but breakpoint has been disabled", + bp.HitCond, + ) + } + + state = <-c.Continue() + if state.Err != nil { + t.Fatalf("Unexpected error: %v, state: %#v", state.Err, state) + } + + f, l = state.CurrentThread.File, state.CurrentThread.Line + if f != "break.go" && l != 7 { + t.Fatal("Program did not hit breakpoint") + } + + ivar, err = c.EvalVariable(api.EvalScope{GoroutineID: -1}, "i", normalLoadConfig) + assertNoError(err, t, "EvalVariable") + + t.Logf("ivar: %s", ivar.SinglelineString()) + + if ivar.Value != "2" { + t.Fatalf("Wrong variable value: %s", ivar.Value) + } + + bp, err = c.GetBreakpoint(hitCondBp.ID) + assertNoError(err, t, "GetBreakpoint()") + + if !bp.Disabled { + t.Fatalf( + "Hit condition %s is no more satisfiable but breakpoint has not been disabled", + bp.HitCond, + ) + } + }) +} + +func TestClientServer_disableHitEQLCondBreakpoint(t *testing.T) { + withTestClient2("break", t, func(c service.Client) { + fp := testProgPath(t, "break") + hitCondBp, err := c.CreateBreakpoint(&api.Breakpoint{ + File: fp, + Line: 7, + HitCond: "== 3", + }) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + + state := <-c.Continue() + if state.Err != nil { + t.Fatalf("Unexpected error: %v, state: %#v", state.Err, state) + } + + f, l := state.CurrentThread.File, state.CurrentThread.Line + if f != "break.go" && l != 7 { + t.Fatal("Program did not hit breakpoint") + } + + ivar, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, "i", normalLoadConfig) + assertNoError(err, t, "EvalVariable") + + t.Logf("ivar: %s", ivar.SinglelineString()) + + if ivar.Value != "3" { + t.Fatalf("Wrong variable value: %s", ivar.Value) + } + + bp, err := c.GetBreakpoint(hitCondBp.ID) + assertNoError(err, t, "GetBreakpoint()") + + if !bp.Disabled { + t.Fatalf( + "Hit condition %s is no more satisfiable but breakpoint has not been disabled", + bp.HitCond, + ) + } + }) +} + func TestClientServer_switchThread(t *testing.T) { protest.AllowRecording(t) withTestClient2("testnextprog", t, func(c service.Client) { @@ -766,6 +990,23 @@ func TestClientServer_FindLocations(t *testing.T) { findLocationHelper(t, c, "-1", false, 1, findLocationHelper(t, c, "locationsprog.go:33", false, 1, 0)[0]) findLocationHelper(t, c, `*amap["k"]`, false, 1, findLocationHelper(t, c, `amap["k"]`, false, 1, 0)[0]) + + locsNoSubst, _ := c.FindLocation(api.EvalScope{GoroutineID: -1}, "_fixtures/locationsprog.go:35", false, nil) + sep := "/" + if strings.Contains(locsNoSubst[0].File, "\\") { + sep = "\\" + } + substRules := [][2]string{[2]string{strings.Replace(locsNoSubst[0].File, "locationsprog.go", "", 1), strings.Replace(locsNoSubst[0].File, "_fixtures"+sep+"locationsprog.go", "nonexistent", 1)}} + t.Logf("substitute rules: %q -> %q", substRules[0][0], substRules[0][1]) + locsSubst, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "nonexistent/locationsprog.go:35", false, substRules) + if err != nil { + t.Fatalf("FindLocation(locationsprog.go:35) with substitute rules: %v", err) + } + t.Logf("FindLocation(\"/nonexistent/path/locationsprog.go:35\") -> %#v", locsSubst) + if locsNoSubst[0].PC != locsSubst[0].PC { + t.Fatalf("FindLocation with substitute rules mismatch %#v %#v", locsNoSubst[0], locsSubst[0]) + } + }) withTestClient2("testnextdefer", t, func(c service.Client) { @@ -821,6 +1062,76 @@ func TestClientServer_FindLocations(t *testing.T) { findLocationHelper(t, c, "dirio.SomeFunction:0", false, 1, someFuncLoc) }) } + + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) { + withTestClient2("locationsprog_generic", t, func(c service.Client) { + const ( + methodLine = "locationsprog_generic.go:9" + funcLine = "locationsprog_generic.go:13" + funcLine2 = "locationsprog_generic.go:14" + ) + methodLoc := findLocationHelper2(t, c, methodLine, nil) + if len(methodLoc.PCs) != 2 { + // we didn't get both instantiations of the method + t.Errorf("wrong number of PCs for %s: %#x", methodLine, methodLoc.PCs) + } + + funcLoc := findLocationHelper2(t, c, funcLine, nil) + if len(funcLoc.PCs) != 2 { + // we didn't get both instantiations of the function + t.Errorf("wrong number of PCs for %s: %#x", funcLine, funcLoc.PCs) + } + + funcLoc2 := findLocationHelper2(t, c, funcLine2, nil) + if len(funcLoc2.PCs) != 2 { + t.Errorf("wrong number of PCs for %s: %#x", funcLine2, funcLoc2.PCs) + } + + findLocationHelper2(t, c, "main.ParamFunc", funcLoc) + + findLocationHelper2(t, c, "ParamFunc", funcLoc) + + findLocationHelper2(t, c, "main.ParamReceiver.Amethod", methodLoc) + findLocationHelper2(t, c, "main.Amethod", methodLoc) + findLocationHelper2(t, c, "ParamReceiver.Amethod", methodLoc) + findLocationHelper2(t, c, "Amethod", methodLoc) + + findLocationHelper2(t, c, "main.(*ParamReceiver).Amethod", methodLoc) + findLocationHelper2(t, c, "(*ParamReceiver).Amethod", methodLoc) + + findLocationHelper2(t, c, "main.(*ParamReceiver).Amethod", methodLoc) + findLocationHelper2(t, c, "(*ParamReceiver).Amethod", methodLoc) + + findLocationHelper2(t, c, "main.ParamFunc:1", funcLoc2) + }) + } +} + +func findLocationHelper2(t *testing.T, c service.Client, loc string, checkLoc *api.Location) *api.Location { + locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, loc, false, nil) + if err != nil { + t.Fatalf("FindLocation(%q) -> error %v", loc, err) + } + t.Logf("FindLocation(%q) → %v\n", loc, locs) + if len(locs) != 1 { + t.Logf("Wrong number of locations returned for location %q (got %d expected 1)", loc, len(locs)) + } + + if checkLoc == nil { + return &locs[0] + } + + if len(checkLoc.PCs) != len(locs[0].PCs) { + t.Fatalf("Wrong number of PCs returned (got %#x expected %#x)", locs[0].PCs, checkLoc.PCs) + } + + for i := range checkLoc.PCs { + if checkLoc.PCs[i] != locs[0].PCs[i] { + t.Fatalf("Wrong PCs returned (got %#x expected %#x)", locs[0].PCs, checkLoc.PCs) + } + } + + return &locs[0] } func TestClientServer_FindLocationsAddr(t *testing.T) { @@ -893,6 +1204,15 @@ func TestClientServer_SetVariable(t *testing.T) { func TestClientServer_FullStacktrace(t *testing.T) { protest.AllowRecording(t) + if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { + t.Skip("cgo doesn't work on darwin/arm64") + } + + lenient := false + if runtime.GOOS == "windows" { + lenient = true + } + withTestClient2("goroutinestackprog", t, func(c service.Client) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.stacktraceme", Line: -1}) assertNoError(err, t, "CreateBreakpoint()") @@ -905,21 +1225,22 @@ func TestClientServer_FullStacktrace(t *testing.T) { assertNoError(err, t, "GoroutinesInfo()") found := make([]bool, 10) for _, g := range gs { - frames, err := c.Stacktrace(g.ID, 10, 0, &normalLoadConfig) + frames, err := c.Stacktrace(g.ID, 40, 0, &normalLoadConfig) assertNoError(err, t, fmt.Sprintf("Stacktrace(%d)", g.ID)) + t.Logf("goroutine %d", g.ID) for i, frame := range frames { + t.Logf("\tframe %d off=%#x bpoff=%#x pc=%#x %s:%d %s", i, frame.FrameOffset, frame.FramePointerOffset, frame.PC, frame.File, frame.Line, frame.Function.Name()) if frame.Function == nil { continue } if frame.Function.Name() != "main.agoroutine" { continue } - t.Logf("frame %d: %v", i, frame) for _, arg := range frame.Arguments { if arg.Name != "i" { continue } - t.Logf("frame %v, variable i is %v\n", frame, arg) + t.Logf("\tvariable i is %+v\n", arg) argn, err := strconv.Atoi(arg.Value) if err == nil { found[argn] = true @@ -928,26 +1249,18 @@ func TestClientServer_FullStacktrace(t *testing.T) { } } - firsterr := false - if goversion.VersionAfterOrEqual(runtime.Version(), 1, 14) { - // We try to make sure that all goroutines are stopped at a sensible place - // before reading their stacktrace, but due to the nature of the test - // program there is no guarantee that we always find them in a reasonable - // state. - // Asynchronous preemption in Go 1.14 exacerbates this problem, to avoid - // unnecessary flakiness allow a single goroutine to be in a bad state. - firsterr = true - } for i := range found { if !found[i] { - if firsterr { - firsterr = false + if lenient { + lenient = false } else { t.Fatalf("Goroutine %d not found", i) } } } + t.Logf("continue") + state = <-c.Continue() if state.Err != nil { t.Fatalf("Continue(): %v\n", state.Err) @@ -958,10 +1271,10 @@ func TestClientServer_FullStacktrace(t *testing.T) { cur := 3 for i, frame := range frames { + t.Logf("\tframe %d off=%#x bpoff=%#x pc=%#x %s:%d %s", i, frame.FrameOffset, frame.FramePointerOffset, frame.PC, frame.File, frame.Line, frame.Function.Name()) if i == 0 { continue } - t.Logf("frame %d: %v", i, frame) v := frame.Var("n") if v == nil { t.Fatalf("Could not find value of variable n in frame %d", i) @@ -978,6 +1291,16 @@ func TestClientServer_FullStacktrace(t *testing.T) { }) } +func assertErrorOrExited(s *api.DebuggerState, err error, t *testing.T, reason string) { + if err != nil { + return + } + if s != nil && s.Exited { + return + } + t.Fatalf("%s (no error and no exited status)", reason) +} + func TestIssue355(t *testing.T) { // After the target process has terminated should return an error but not crash protest.AllowRecording(t) @@ -999,18 +1322,18 @@ func TestIssue355(t *testing.T) { state = <-ch assertError(state.Err, t, "Continue()") - _, err = c.Next() - assertError(err, t, "Next()") - _, err = c.Step() - assertError(err, t, "Step()") - _, err = c.StepInstruction() - assertError(err, t, "StepInstruction()") - _, err = c.SwitchThread(tid) - assertError(err, t, "SwitchThread()") - _, err = c.SwitchGoroutine(gid) - assertError(err, t, "SwitchGoroutine()") - _, err = c.Halt() - assertError(err, t, "Halt()") + s, err := c.Next() + assertErrorOrExited(s, err, t, "Next()") + s, err = c.Step() + assertErrorOrExited(s, err, t, "Step()") + s, err = c.StepInstruction() + assertErrorOrExited(s, err, t, "StepInstruction()") + s, err = c.SwitchThread(tid) + assertErrorOrExited(s, err, t, "SwitchThread()") + s, err = c.SwitchGoroutine(gid) + assertErrorOrExited(s, err, t, "SwitchGoroutine()") + s, err = c.Halt() + assertErrorOrExited(s, err, t, "Halt()") _, err = c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: -1}) if testBackend != "rr" { assertError(err, t, "CreateBreakpoint()") @@ -1036,7 +1359,7 @@ func TestIssue355(t *testing.T) { assertError(err, t, "ListGoroutines()") _, err = c.Stacktrace(gid, 10, 0, &normalLoadConfig) assertError(err, t, "Stacktrace()") - _, err = c.FindLocation(api.EvalScope{GoroutineID: gid}, "+1", false) + _, err = c.FindLocation(api.EvalScope{GoroutineID: gid}, "+1", false, nil) assertError(err, t, "FindLocation()") _, err = c.DisassemblePC(api.EvalScope{GoroutineID: -1}, 0x40100, api.IntelFlavour) assertError(err, t, "DisassemblePC()") @@ -1053,7 +1376,7 @@ func TestDisasm(t *testing.T) { state := <-ch assertNoError(state.Err, t, "Continue()") - locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "main.main", false) + locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "main.main", false, nil) assertNoError(err, t, "FindLocation()") if len(locs) != 1 { t.Fatalf("wrong number of locations for main.main: %d", len(locs)) @@ -1315,7 +1638,7 @@ func TestTypesCommand(t *testing.T) { func TestIssue406(t *testing.T) { protest.AllowRecording(t) withTestClient2("issue406", t, func(c service.Client) { - locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "issue406.go:146", false) + locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "issue406.go:146", false, nil) assertNoError(err, t, "FindLocation()") _, err = c.CreateBreakpoint(&api.Breakpoint{Addr: locs[0].PC}) assertNoError(err, t, "CreateBreakpoint()") @@ -1324,7 +1647,7 @@ func TestIssue406(t *testing.T) { assertNoError(state.Err, t, "Continue()") v, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, "cfgtree", normalLoadConfig) assertNoError(err, t, "EvalVariable()") - vs := v.MultilineString("") + vs := v.MultilineString("", "") t.Logf("cfgtree formats to: %s\n", vs) }) } @@ -1401,15 +1724,16 @@ func TestClientServer_FpRegisters(t *testing.T) { {"XMM12", "…[ZMM12hh] 0x3ff66666666666663ff4cccccccccccd"}, } protest.AllowRecording(t) - withTestClient2("fputest/", t, func(c service.Client) { + withTestClient2Extended("fputest/", t, 0, [3]string{}, func(c service.Client, fixture protest.Fixture) { + _, err := c.CreateBreakpoint(&api.Breakpoint{File: filepath.Join(fixture.BuildDir, "fputest.go"), Line: 25}) + assertNoError(err, t, "CreateBreakpoint") + state := <-c.Continue() t.Logf("state after continue: %#v", state) + scope := api.EvalScope{GoroutineID: -1} + boolvar := func(name string) bool { - scope := api.EvalScope{GoroutineID: -1} - if testBackend == "rr" { - scope.Frame = 2 - } v, err := c.EvalVariable(scope, name, normalLoadConfig) if err != nil { t.Fatalf("could not read %s variable", name) @@ -1427,16 +1751,17 @@ func TestClientServer_FpRegisters(t *testing.T) { avx512 = false } + state = <-c.Continue() + t.Logf("state after continue: %#v", state) + regs, err := c.ListThreadRegisters(0, true) assertNoError(err, t, "ListThreadRegisters()") - t.Logf("%s", regs.String()) - for _, regtest := range regtests { if regtest.name == "XMM11" && !avx2 { continue } - if regtest.name == "XMM12" && !avx512 { + if regtest.name == "XMM12" && (!avx512 || testBackend == "rr") { continue } found := false @@ -1458,12 +1783,35 @@ func TestClientServer_FpRegisters(t *testing.T) { t.Fatalf("register %s not found: %v", regtest.name, regs) } } + + // Test register expressions + + for _, tc := range []struct{ expr, tgt string }{ + {"XMM1[:32]", `"cdccccccccccf43f666666666666f63f"`}, + {"_XMM1[:32]", `"cdccccccccccf43f666666666666f63f"`}, + {"__XMM1[:32]", `"cdccccccccccf43f666666666666f63f"`}, + {"XMM1.int8[0]", `-51`}, + {"XMM1.uint16[0]", `52429`}, + {"XMM1.float32[0]", `-107374184`}, + {"XMM1.float64[0]", `1.3`}, + {"RAX.uint8[0]", "42"}, + } { + v, err := c.EvalVariable(scope, tc.expr, normalLoadConfig) + if err != nil { + t.Fatalf("could not evalue expression %s: %v", tc.expr, err) + } + out := v.SinglelineString() + + if out != tc.tgt { + t.Fatalf("for %q expected %q got %q\n", tc.expr, tc.tgt, out) + } + } }) } func TestClientServer_RestartBreakpointPosition(t *testing.T) { protest.AllowRecording(t) - if buildMode == "pie" { + if buildMode == "pie" || (runtime.GOOS == "darwin" && runtime.GOARCH == "arm64") { t.Skip("not meaningful in PIE mode") } withTestClient2("locationsprog2", t, func(c service.Client) { @@ -1478,7 +1826,7 @@ func TestClientServer_RestartBreakpointPosition(t *testing.T) { assertNoError(err, t, "Halt") _, err = c.Restart(false) assertNoError(err, t, "Restart") - bps, err := c.ListBreakpoints() + bps, err := c.ListBreakpoints(false) assertNoError(err, t, "ListBreakpoints") for _, bp := range bps { if bp.Name == bpBefore.Name { @@ -1621,6 +1969,23 @@ func TestClientServerConsistentExit(t *testing.T) { if state.ExitStatus != 2 { t.Fatalf("Process exit status is not 2, got: %v", state.ExitStatus) } + + // Ensure future commands also return the correct exit status. + // Previously there was a bug where the command which prompted the + // process to exit (continue, next, etc...) would return the corrent + // exit status but subsequent commands would return an incorrect exit + // status of 0. To test this we simply repeat the 'next' command and + // ensure we get the correct response again. + state, err = c.Next() + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + if !state.Exited { + t.Fatal("Second process state is not exited") + } + if state.ExitStatus != 2 { + t.Fatalf("Second process exit status is not 2, got: %v", state.ExitStatus) + } }) } @@ -1705,7 +2070,7 @@ func TestAcceptMulticlient(t *testing.T) { }, }) if err := server.Run(); err != nil { - t.Fatal(err) + panic(err) } <-disconnectChan server.Stop() @@ -1722,20 +2087,42 @@ func TestAcceptMulticlient(t *testing.T) { <-serverDone } -func mustHaveDebugCalls(t *testing.T, c service.Client) { - locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "runtime.debugCallV1", false) - if len(locs) == 0 || err != nil { - t.Skip("function calls not supported on this version of go") +func TestForceStopWhileContinue(t *testing.T) { + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatalf("couldn't start listener: %s\n", err) } + serverStopped := make(chan struct{}) + disconnectChan := make(chan struct{}) + go func() { + defer close(serverStopped) + defer listener.Close() + server := rpccommon.NewServer(&service.Config{ + Listener: listener, + ProcessArgs: []string{protest.BuildFixture("http_server", protest.AllNonOptimized).Path}, + AcceptMulti: true, + DisconnectChan: disconnectChan, + Debugger: debugger.Config{ + Backend: "default", + }, + }) + if err := server.Run(); err != nil { + panic(err) + } + <-disconnectChan + server.Stop() + }() + + client := rpc2.NewClient(listener.Addr().String()) + client.Disconnect(true /*continue*/) + time.Sleep(10 * time.Millisecond) // give server time to start running + close(disconnectChan) // stop the server + <-serverStopped // Stop() didn't block on detach because we halted first } func TestClientServerFunctionCall(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("arm64 does not support FunctionCall for now") - } protest.MustSupportFunctionCalls(t, testBackend) withTestClient2("fncall", t, func(c service.Client) { - mustHaveDebugCalls(t, c) c.SetReturnValuesLoadConfig(&normalLoadConfig) state := <-c.Continue() assertNoError(state.Err, t, "Continue()") @@ -1764,16 +2151,12 @@ func TestClientServerFunctionCall(t *testing.T) { } func TestClientServerFunctionCallBadPos(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("arm64 does not support FunctionCall for now") - } protest.MustSupportFunctionCalls(t, testBackend) if goversion.VersionAfterOrEqual(runtime.Version(), 1, 12) { t.Skip("this is a safe point for Go 1.12") } withTestClient2("fncall", t, func(c service.Client) { - mustHaveDebugCalls(t, c) - loc, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "fmt/print.go:649", false) + loc, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "fmt/print.go:649", false, nil) assertNoError(err, t, "could not find location") _, err = c.CreateBreakpoint(&api.Breakpoint{File: loc[0].File, Line: loc[0].Line}) @@ -1794,12 +2177,8 @@ func TestClientServerFunctionCallBadPos(t *testing.T) { } func TestClientServerFunctionCallPanic(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("arm64 does not support FunctionCall for now") - } protest.MustSupportFunctionCalls(t, testBackend) withTestClient2("fncall", t, func(c service.Client) { - mustHaveDebugCalls(t, c) c.SetReturnValuesLoadConfig(&normalLoadConfig) state := <-c.Continue() assertNoError(state.Err, t, "Continue()") @@ -1823,15 +2202,11 @@ func TestClientServerFunctionCallPanic(t *testing.T) { } func TestClientServerFunctionCallStacktrace(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("arm64 does not support FunctionCall for now") - } if goversion.VersionAfterOrEqual(runtime.Version(), 1, 15) { t.Skip("Go 1.15 executes function calls in a different goroutine so the stack trace will not contain main.main or runtime.main") } protest.MustSupportFunctionCalls(t, testBackend) withTestClient2("fncall", t, func(c service.Client) { - mustHaveDebugCalls(t, c) c.SetReturnValuesLoadConfig(&api.LoadConfig{FollowPointers: false, MaxStringLen: 2048}) state := <-c.Continue() assertNoError(state.Err, t, "Continue()") @@ -1916,7 +2291,7 @@ func TestUnknownMethodCall(t *testing.T) { func TestIssue1703(t *testing.T) { // Calling Disassemble when there is no current goroutine should work. withTestClient2("testnextprog", t, func(c service.Client) { - locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "main.main", true) + locs, err := c.FindLocation(api.EvalScope{GoroutineID: -1}, "main.main", true, nil) assertNoError(err, t, "FindLocation") t.Logf("FindLocation: %#v", locs) text, err := c.DisassemblePC(api.EvalScope{GoroutineID: -1}, locs[0].PC, api.IntelFlavour) @@ -1991,7 +2366,7 @@ func TestDoubleCreateBreakpoint(t *testing.T) { _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 1, Name: "firstbreakpoint", Tracepoint: true}) assertNoError(err, t, "CreateBreakpoint 1") - bps, err := c.ListBreakpoints() + bps, err := c.ListBreakpoints(false) assertNoError(err, t, "ListBreakpoints 1") t.Logf("breakpoints before second call:") @@ -2004,7 +2379,7 @@ func TestDoubleCreateBreakpoint(t *testing.T) { _, err = c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 1, Name: "secondbreakpoint", Tracepoint: true}) assertError(err, t, "CreateBreakpoint 2") // breakpoint exists - bps, err = c.ListBreakpoints() + bps, err = c.ListBreakpoints(false) assertNoError(err, t, "ListBreakpoints 2") t.Logf("breakpoints after second call:") @@ -2054,7 +2429,7 @@ func TestClearLogicalBreakpoint(t *testing.T) { } _, err = c.ClearBreakpoint(bp.ID) assertNoError(err, t, "ClearBreakpoint()") - bps, err := c.ListBreakpoints() + bps, err := c.ListBreakpoints(false) assertNoError(err, t, "ListBreakpoints()") for _, curbp := range bps { if curbp.ID == bp.ID { @@ -2098,3 +2473,297 @@ func TestRedirects(t *testing.T) { } }) } + +func TestIssue2162(t *testing.T) { + if buildMode == "pie" || runtime.GOOS == "windows" { + t.Skip("skip it for stepping into one place where no source for pc when on pie mode or windows") + } + withTestClient2("issue2162", t, func(c service.Client) { + state, err := c.GetState() + assertNoError(err, t, "GetState()") + if state.CurrentThread.Function == nil { + // Can't call Step if we don't have the source code of the current function + return + } + + _, err = c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main"}) + if err != nil { + t.Fatalf("Unexpected error: %v", err) + } + + _, err = c.Step() + assertNoError(err, t, "Step()") + }) +} + +func TestDetachLeaveRunning(t *testing.T) { + // See https://github.com/go-delve/delve/issues/2259 + if testBackend == "rr" { + return + } + + listener, clientConn := service.ListenerPipe() + defer listener.Close() + var buildFlags protest.BuildFlags + if buildMode == "pie" { + buildFlags |= protest.BuildModePIE + } + fixture := protest.BuildFixture("testnextnethttp", buildFlags) + + cmd := exec.Command(fixture.Path) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + assertNoError(cmd.Start(), t, "starting fixture") + defer cmd.Process.Kill() + + // wait for testnextnethttp to start listening + t0 := time.Now() + for { + conn, err := net.Dial("tcp", "127.0.0.1:9191") + if err == nil { + conn.Close() + break + } + time.Sleep(50 * time.Millisecond) + if time.Since(t0) > 10*time.Second { + t.Fatal("fixture did not start") + } + } + + server := rpccommon.NewServer(&service.Config{ + Listener: listener, + APIVersion: 2, + Debugger: debugger.Config{ + AttachPid: cmd.Process.Pid, + WorkingDir: ".", + Backend: testBackend, + }, + }) + if err := server.Run(); err != nil { + t.Fatal(err) + } + + client := rpc2.NewClientFromConn(clientConn) + defer server.Stop() + assertNoError(client.Detach(false), t, "Detach") +} + +func assertNoDuplicateBreakpoints(t *testing.T, c service.Client) { + t.Helper() + bps, _ := c.ListBreakpoints(false) + seen := make(map[int]bool) + for _, bp := range bps { + t.Logf("%#v\n", bp) + if seen[bp.ID] { + t.Fatalf("duplicate breakpoint ID %d", bp.ID) + } + seen[bp.ID] = true + } +} + +func TestToggleBreakpointRestart(t *testing.T) { + // Checks that breakpoints IDs do not overlap after Restart if there are disabled breakpoints. + withTestClient2("testtoggle", t, func(c service.Client) { + bp1, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 1, Name: "firstbreakpoint"}) + assertNoError(err, t, "CreateBreakpoint 1") + _, err = c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 2, Name: "secondbreakpoint"}) + assertNoError(err, t, "CreateBreakpoint 2") + _, err = c.ToggleBreakpoint(bp1.ID) + assertNoError(err, t, "ToggleBreakpoint") + _, err = c.Restart(false) + assertNoError(err, t, "Restart") + assertNoDuplicateBreakpoints(t, c) + _, err = c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 3, Name: "thirdbreakpoint"}) + assertNoError(err, t, "CreateBreakpoint 3") + assertNoDuplicateBreakpoints(t, c) + }) +} + +func TestStopServerWithClosedListener(t *testing.T) { + // Checks that the error erturned by listener.Accept() is ignored when we + // are trying to shutdown. See issue #1633. + if testBackend == "rr" || buildMode == "pie" { + t.Skip("N/A") + } + listener, err := net.Listen("tcp", "localhost:0") + assertNoError(err, t, "listener") + fixture := protest.BuildFixture("math", 0) + server := rpccommon.NewServer(&service.Config{ + Listener: listener, + AcceptMulti: false, + APIVersion: 2, + CheckLocalConnUser: true, + DisconnectChan: make(chan struct{}), + ProcessArgs: []string{fixture.Path}, + Debugger: debugger.Config{ + WorkingDir: ".", + Backend: "default", + Foreground: false, + BuildFlags: "", + ExecuteKind: debugger.ExecutingGeneratedFile, + }, + }) + assertNoError(server.Run(), t, "blah") + time.Sleep(1 * time.Second) // let server start + server.Stop() + listener.Close() + time.Sleep(1 * time.Second) // give time to server to panic +} + +func TestGoroutinesGrouping(t *testing.T) { + // Tests the goroutine grouping and filtering feature + withTestClient2("goroutinegroup", t, func(c service.Client) { + state := <-c.Continue() + assertNoError(state.Err, t, "Continue") + _, ggrp, _, _, err := c.ListGoroutinesWithFilter(0, 0, nil, &api.GoroutineGroupingOptions{GroupBy: api.GoroutineLabel, GroupByKey: "name", MaxGroupMembers: 5, MaxGroups: 10}) + assertNoError(err, t, "ListGoroutinesWithFilter (group by label)") + t.Logf("%#v\n", ggrp) + if len(ggrp) < 5 { + t.Errorf("not enough groups %d\n", len(ggrp)) + } + var unnamedCount int + for i := range ggrp { + if ggrp[i].Name == "name=" { + unnamedCount = ggrp[i].Total + break + } + } + gs, _, _, _, err := c.ListGoroutinesWithFilter(0, 0, []api.ListGoroutinesFilter{{Kind: api.GoroutineLabel, Arg: "name="}}, nil) + assertNoError(err, t, "ListGoroutinesWithFilter (filter unnamed)") + if len(gs) != unnamedCount { + t.Errorf("wrong number of goroutines returned by filter: %d (expected %d)\n", len(gs), unnamedCount) + } + }) +} + +func TestLongStringArg(t *testing.T) { + // Test the ability to load more elements of a string argument, this could + // be broken if registerized variables are not handled correctly. + withTestClient2("morestringarg", t, func(c service.Client) { + _, err := c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.f"}) + assertNoError(err, t, "CreateBreakpoint") + state := <-c.Continue() + assertNoError(state.Err, t, "Continue") + + test := func(name, val1, val2 string) uint64 { + var1, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, name, normalLoadConfig) + assertNoError(err, t, "EvalVariable") + t.Logf("%#v\n", var1) + if var1.Value != val1 { + t.Fatalf("wrong value for variable: %q", var1.Value) + } + var2, err := c.EvalVariable(api.EvalScope{GoroutineID: -1}, fmt.Sprintf("(*(*%q)(%#x))[64:]", var1.Type, var1.Addr), normalLoadConfig) + assertNoError(err, t, "EvalVariable") + t.Logf("%#v\n", var2) + if var2.Value != val2 { + t.Fatalf("wrong value for variable: %q", var2.Value) + + } + return var1.Addr + } + + saddr := test("s", "very long string 01234567890123456789012345678901234567890123456", "7890123456789012345678901234567890123456789X") + test("q", "very long string B 012345678901234567890123456789012345678901234", "567890123456789012345678901234567890123456789X2") + saddr2 := test("s", "very long string 01234567890123456789012345678901234567890123456", "7890123456789012345678901234567890123456789X") + if saddr != saddr2 { + t.Fatalf("address of s changed (%#x %#x)", saddr, saddr2) + } + }) +} + +func TestGenericsBreakpoint(t *testing.T) { + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) { + t.Skip("generics") + } + // Tests that setting breakpoints inside a generic function with multiple + // instantiations results in a single logical breakpoint with N physical + // breakpoints (N = number of instantiations). + withTestClient2("genericbp", t, func(c service.Client) { + fp := testProgPath(t, "genericbp") + bp, err := c.CreateBreakpoint(&api.Breakpoint{File: fp, Line: 6}) + assertNoError(err, t, "CreateBreakpoint") + if len(bp.Addrs) != 2 { + t.Fatalf("wrong number of physical breakpoints: %d", len(bp.Addrs)) + } + + frame1Line := func() int { + frames, err := c.Stacktrace(-1, 10, 0, nil) + assertNoError(err, t, "Stacktrace") + return frames[1].Line + } + + state := <-c.Continue() + assertNoError(state.Err, t, "Continue") + if line := frame1Line(); line != 10 { + t.Errorf("wrong line after first continue, expected 10, got %d", line) + } + + state = <-c.Continue() + assertNoError(state.Err, t, "Continue") + if line := frame1Line(); line != 11 { + t.Errorf("wrong line after first continue, expected 11, got %d", line) + } + + if bp.FunctionName != "main.testfn" { + t.Errorf("wrong name for breakpoint (CreateBreakpoint): %q", bp.FunctionName) + } + + bps, err := c.ListBreakpoints(false) + assertNoError(err, t, "ListBreakpoints") + + for _, bp := range bps { + if bp.ID > 0 { + if bp.FunctionName != "main.testfn" { + t.Errorf("wrong name for breakpoint (ListBreakpoints): %q", bp.FunctionName) + } + break + } + } + + rmbp, err := c.ClearBreakpoint(bp.ID) + assertNoError(err, t, "ClearBreakpoint") + if rmbp.FunctionName != "main.testfn" { + t.Errorf("wrong name for breakpoint (ClearBreakpoint): %q", rmbp.FunctionName) + } + }) +} + +func TestRestartRewindAfterEnd(t *testing.T) { + if testBackend != "rr" { + t.Skip("not relevant") + } + // Check that Restart works after the program has terminated, even if a + // Continue is requested just before it. + // Also check that Rewind can be used after the program has terminated. + protest.AllowRecording(t) + withTestClient2("math", t, func(c service.Client) { + state := <-c.Continue() + if !state.Exited { + t.Fatalf("program did not exit") + } + state = <-c.Continue() + if !state.Exited { + t.Errorf("bad Continue return state: %v", state) + } + time.Sleep(1 * time.Second) // bug only happens if there is some time for the server to close the notify channel + _, err := c.Restart(false) + if err != nil { + t.Fatalf("Restart: %v", err) + } + state = <-c.Continue() + if !state.Exited { + t.Fatalf("program did not exit exited") + } + _, err = c.CreateBreakpoint(&api.Breakpoint{FunctionName: "main.main", Line: 0}) + if err != nil { + t.Fatalf("CreateBreakpoint: %v", err) + } + state = <-c.Rewind() + if state.Exited || state.Err != nil { + t.Errorf("bad Rewind return state: %v", state) + } + if state.CurrentThread.Line != 7 { + t.Errorf("wrong stop location %s:%d", state.CurrentThread.File, state.CurrentThread.Line) + } + }) +} diff --git a/service/test/variables_test.go b/service/test/variables_test.go index a20cbfba53..caffbf6e5f 100644 --- a/service/test/variables_test.go +++ b/service/test/variables_test.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "go/constant" + "io/ioutil" "path/filepath" "runtime" "sort" @@ -85,13 +86,13 @@ func findFirstNonRuntimeFrame(p *proc.Target) (proc.Stackframe, error) { func evalScope(p *proc.Target) (*proc.EvalScope, error) { if testBackend != "rr" { - return proc.GoroutineScope(p.CurrentThread()) + return proc.GoroutineScope(p, p.CurrentThread()) } frame, err := findFirstNonRuntimeFrame(p) if err != nil { return nil, err } - return proc.FrameToScope(p.BinInfo(), p.CurrentThread(), nil, frame), nil + return proc.FrameToScope(p, p.Memory(), nil, frame), nil } func evalVariable(p *proc.Target, symbol string, cfg proc.LoadConfig) (*proc.Variable, error) { @@ -100,7 +101,7 @@ func evalVariable(p *proc.Target, symbol string, cfg proc.LoadConfig) (*proc.Var return nil, err } - return scope.EvalVariable(symbol, cfg) + return scope.EvalExpression(symbol, cfg) } func (tc *varTest) alternateVarTest() varTest { @@ -110,7 +111,7 @@ func (tc *varTest) alternateVarTest() varTest { } func setVariable(p *proc.Target, symbol, value string) error { - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) if err != nil { return err } @@ -131,9 +132,9 @@ func withTestProcessArgs(name string, t *testing.T, wd string, args []string, bu var tracedir string switch testBackend { case "native": - p, err = native.Launch(append([]string{fixture.Path}, args...), wd, false, []string{}, "", [3]string{}) + p, err = native.Launch(append([]string{fixture.Path}, args...), wd, 0, []string{}, "", [3]string{}) case "lldb": - p, err = gdbserial.LLDBLaunch(append([]string{fixture.Path}, args...), wd, false, []string{}, "", [3]string{}) + p, err = gdbserial.LLDBLaunch(append([]string{fixture.Path}, args...), wd, 0, []string{}, "", [3]string{}) case "rr": protest.MustHaveRecordingAllowed(t) t.Log("recording") @@ -389,7 +390,7 @@ func TestMultilineVariableEvaluation(t *testing.T) { for _, tc := range testcases { variable, err := evalVariable(p, tc.name, pnormalLoadConfig) assertNoError(err, t, "EvalVariable() returned an error") - if ms := api.ConvertVar(variable).MultilineString(""); !matchStringOrPrefix(ms, tc.value) { + if ms := api.ConvertVar(variable).MultilineString("", ""); !matchStringOrPrefix(ms, tc.value) { t.Fatalf("Expected %s got %s (variable %s)\n", tc.value, ms, variable.Name) } } @@ -442,8 +443,10 @@ func TestLocalVariables(t *testing.T) { {"f32", true, "1.2", "", "float32", nil}, {"i32", true, "[2]int32 [1,2]", "", "[2]int32", nil}, {"i8", true, "1", "", "int8", nil}, + {"mp", true, "map[int]interface {} [1: 42, 2: 43, ]", "", "map[int]interface {}", nil}, {"ms", true, "main.Nest {Level: 0, Nest: *main.Nest {Level: 1, Nest: *(*main.Nest)…", "", "main.Nest", nil}, {"neg", true, "-1", "", "int", nil}, + {"ni", true, "[]interface {} len: 1, cap: 1, [[]interface {} len: 1, cap: 1, [*(*interface {})…", "", "[]interface {}", nil}, {"u16", true, "65535", "", "uint16", nil}, {"u32", true, "4294967295", "", "uint32", nil}, {"u64", true, "18446744073709551615", "", "uint64", nil}, @@ -468,10 +471,10 @@ func TestLocalVariables(t *testing.T) { var frame proc.Stackframe frame, err = findFirstNonRuntimeFrame(p) if err == nil { - scope = proc.FrameToScope(p.BinInfo(), p.CurrentThread(), nil, frame) + scope = proc.FrameToScope(p, p.Memory(), nil, frame) } } else { - scope, err = proc.GoroutineScope(p.CurrentThread()) + scope, err = proc.GoroutineScope(p, p.CurrentThread()) } assertNoError(err, t, "scope") @@ -502,6 +505,20 @@ func TestEmbeddedStruct(t *testing.T) { {"b.C.s", true, "\"hello\"", "\"hello\"", "string", nil}, {"b.s", true, "\"hello\"", "\"hello\"", "string", nil}, {"b2", true, "main.B {A: main.A {val: 42}, C: *main.C nil, a: main.A {val: 47}, ptr: *main.A nil}", "main.B {A: (*main.A)(0x…", "main.B", nil}, + + // Issue 2316: field promotion is breadth first and embedded interfaces never get promoted + {"w2.W1.T.F", true, `"T-inside-W1"`, `"T-inside-W1"`, "string", nil}, + {"w2.W1.F", true, `"T-inside-W1"`, `"T-inside-W1"`, "string", nil}, + {"w2.T.F", true, `"T-inside-W2"`, `"T-inside-W2"`, "string", nil}, + {"w2.F", true, `"T-inside-W2"`, `"T-inside-W2"`, "string", nil}, + {"w3.I.T.F", false, `"T-inside-W1"`, `"T-inside-W1"`, "string", nil}, + {"w3.I.F", false, `"T-inside-W1"`, `"T-inside-W1"`, "string", nil}, + {"w3.T.F", true, `"T-inside-W3"`, `"T-inside-W3"`, "string", nil}, + {"w3.F", true, `"T-inside-W3"`, `"T-inside-W3"`, "string", nil}, + {"w4.I.T.F", false, `"T-inside-W1"`, `"T-inside-W1"`, "string", nil}, + {"w4.I.F", false, `"T-inside-W1"`, `"T-inside-W1"`, "string", nil}, + {"w4.F", false, ``, ``, "", errors.New("w4 has no member F")}, + {"w5.F", false, ``, ``, "", errors.New("w5 has no member F")}, } assertNoError(p.Continue(), t, "Continue()") @@ -819,6 +836,10 @@ func TestEvalExpression(t *testing.T) { {`iface2map.(data)`, false, "…", "…", "map[string]interface {}", nil}, {"issue1578", false, "main.Block {cache: *main.Cache nil}", "main.Block {cache: *main.Cache nil}", "main.Block", nil}, + {"ni8 << 2", false, "-20", "-20", "int8", nil}, + {"ni8 << 8", false, "0", "0", "int8", nil}, + {"ni8 >> 1", false, "-3", "-3", "int8", nil}, + {"bytearray[0] * bytearray[0]", false, "144", "144", "uint8", nil}, } ver, _ := goversion.Parse(runtime.Version()) @@ -854,7 +875,6 @@ func TestEvalExpression(t *testing.T) { t.Fatalf("Unexpected error. Expected %s got %s", tc.err.Error(), err.Error()) } } - } }) } @@ -893,7 +913,7 @@ func TestMapEvaluation(t *testing.T) { m1v, err := evalVariable(p, "m1", pnormalLoadConfig) assertNoError(err, t, "EvalVariable()") m1 := api.ConvertVar(m1v) - t.Logf("m1 = %v", m1.MultilineString("")) + t.Logf("m1 = %v", m1.MultilineString("", "")) if m1.Type != "map[string]main.astruct" { t.Fatalf("Wrong type: %s", m1.Type) @@ -1132,7 +1152,7 @@ func TestIssue1075(t *testing.T) { setFunctionBreakpoint(p, t, "net/http.(*Client).Do") assertNoError(p.Continue(), t, "Continue()") for i := 0; i < 10; i++ { - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, fmt.Sprintf("GoroutineScope (%d)", i)) vars, err := scope.LocalVariables(pnormalLoadConfig) assertNoError(err, t, fmt.Sprintf("LocalVariables (%d)", i)) @@ -1150,10 +1170,8 @@ type testCaseCallFunction struct { } func TestCallFunction(t *testing.T) { - if runtime.GOARCH == "arm64" { - t.Skip("arm64 does not support CallFunction for now") - } protest.MustSupportFunctionCalls(t, testBackend) + protest.AllowRecording(t) var testcases = []testCaseCallFunction{ // Basic function call injection tests @@ -1266,11 +1284,15 @@ func TestCallFunction(t *testing.T) { {`strings.Join(s1, comma)`, nil, errors.New(`error evaluating "s1" as argument elems in function strings.Join: could not find symbol value for s1`)}, } - withTestProcess("fncall", t, func(p *proc.Target, fixture protest.Fixture) { - _, err := proc.FindFunctionLocation(p, "runtime.debugCallV1", 0) - if err != nil { - t.Skip("function calls not supported on this version of go") - } + var testcases117 = []testCaseCallFunction{ + {`regabistacktest("one", "two", "three", "four", "five", 4)`, []string{`:string:"onetwo"`, `:string:"twothree"`, `:string:"threefour"`, `:string:"fourfive"`, `:string:"fiveone"`, ":uint8:8"}, nil}, + {`regabistacktest2(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)`, []string{":int:3", ":int:5", ":int:7", ":int:9", ":int:11", ":int:13", ":int:15", ":int:17", ":int:19", ":int:11"}, nil}, + {`issue2698.String()`, []string{`:string:"1 2 3 4"`}, nil}, + } + + withTestProcessArgs("fncall", t, ".", nil, protest.AllNonOptimized, func(p *proc.Target, fixture protest.Fixture) { + testCallFunctionSetBreakpoint(t, p, fixture) + assertNoError(p.Continue(), t, "Continue()") for _, tc := range testcases { testCallFunction(t, p, tc) @@ -1299,11 +1321,28 @@ func TestCallFunction(t *testing.T) { } } + if goversion.VersionAfterOrEqual(runtime.Version(), 1, 17) { + for _, tc := range testcases117 { + testCallFunction(t, p, tc) + } + } + // LEAVE THIS AS THE LAST ITEM, IT BREAKS THE TARGET PROCESS!!! testCallFunction(t, p, testCaseCallFunction{"-unsafe escapeArg(&a2)", nil, nil}) }) } +func testCallFunctionSetBreakpoint(t *testing.T, p *proc.Target, fixture protest.Fixture) { + buf, err := ioutil.ReadFile(fixture.Source) + assertNoError(err, t, "ReadFile") + for i, line := range strings.Split(string(buf), "\n") { + if strings.Contains(line, "// breakpoint here") { + setFileBreakpoint(p, t, fixture, i+1) + return + } + } +} + func testCallFunction(t *testing.T, p *proc.Target, tc testCaseCallFunction) { const unsafePrefix = "-unsafe " @@ -1346,7 +1385,7 @@ func testCallFunction(t *testing.T, p *proc.Target, tc testCaseCallFunction) { } if varExpr != "" { - scope, err := proc.GoroutineScope(p.CurrentThread()) + scope, err := proc.GoroutineScope(p, p.CurrentThread()) assertNoError(err, t, "GoroutineScope") v, err := scope.EvalExpression(varExpr, pnormalLoadConfig) assertNoError(err, t, fmt.Sprintf("EvalExpression(%s)", varExpr)) @@ -1358,7 +1397,7 @@ func testCallFunction(t *testing.T, p *proc.Target, tc testCaseCallFunction) { } if len(retvals) != len(tc.outs) { - t.Fatalf("call %q: wrong number of return parameters", tc.expr) + t.Fatalf("call %q: wrong number of return parameters (%#v)", tc.expr, retvals) } for i := range retvals { @@ -1521,6 +1560,8 @@ func TestPluginVariables(t *testing.T) { } func TestCgoEval(t *testing.T) { + protest.MustHaveCgo(t) + testcases := []varTest{ {"s", true, `"a string"`, `"a string"`, "*char", nil}, {"longstring", true, `"averylongstring0123456789a0123456789b0123456789c0123456789d01234...+1 more"`, `"averylongstring0123456789a0123456789b0123456789c0123456789d01234...+1 more"`, "*const char", nil}, @@ -1535,6 +1576,10 @@ func TestCgoEval(t *testing.T) { {"v_align_check[90]", false, "align_check {a: 90, b: 90}", "align_check {a: 90, b: 90}", "align_check", nil}, } + if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { + t.Skip("cgo doesn't work on darwin/arm64") + } + protest.AllowRecording(t) withTestProcess("testvariablescgo/", t, func(p *proc.Target, fixture protest.Fixture) { assertNoError(p.Continue(), t, "Continue() returned an error") @@ -1558,7 +1603,48 @@ func TestCgoEval(t *testing.T) { t.Fatalf("Unexpected error. Expected %s got %s", tc.err.Error(), err.Error()) } } + } + }) +} + +func TestEvalExpressionGenerics(t *testing.T) { + if !goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) { + t.Skip("generics not supported") + } + testcases := [][]varTest{ + // testfn[int, float32] + []varTest{ + {"arg1", true, "3", "", "int", nil}, + {"arg2", true, "2.1", "", "float32", nil}, + {"m", true, "map[float32]int [2.1: 3, ]", "", "map[float32]int", nil}, + }, + + // testfn[*astruct, astruct] + []varTest{ + {"arg1", true, "*main.astruct {x: 0, y: 1}", "", "*main.astruct", nil}, + {"arg2", true, "main.astruct {x: 2, y: 3}", "", "main.astruct", nil}, + {"m", true, "map[main.astruct]*main.astruct [{x: 2, y: 3}: *{x: 0, y: 1}, ]", "", "map[main.astruct]*main.astruct", nil}, + }, + } + + withTestProcess("testvariables_generic", t, func(p *proc.Target, fixture protest.Fixture) { + for i, tcs := range testcases { + assertNoError(p.Continue(), t, fmt.Sprintf("Continue() returned an error (%d)", i)) + for _, tc := range tcs { + variable, err := evalVariable(p, tc.name, pnormalLoadConfig) + if tc.err == nil { + assertNoError(err, t, fmt.Sprintf("EvalExpression(%s) returned an error", tc.name)) + assertVariable(t, variable, tc) + } else { + if err == nil { + t.Fatalf("Expected error %s, got no error (%s)", tc.err.Error(), tc.name) + } + if tc.err.Error() != err.Error() { + t.Fatalf("Unexpected error. Expected %s got %s", tc.err.Error(), err.Error()) + } + } + } } }) } diff --git a/vendor/github.com/cilium/ebpf/.clang-format b/vendor/github.com/cilium/ebpf/.clang-format new file mode 100644 index 0000000000..4eb94b1baa --- /dev/null +++ b/vendor/github.com/cilium/ebpf/.clang-format @@ -0,0 +1,17 @@ +--- +Language: Cpp +BasedOnStyle: LLVM +AlignAfterOpenBracket: DontAlign +AlignConsecutiveAssignments: true +AlignEscapedNewlines: DontAlign +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortFunctionsOnASingleLine: false +BreakBeforeBraces: Attach +IndentWidth: 4 +KeepEmptyLinesAtTheStartOfBlocks: false +TabWidth: 4 +UseTab: ForContinuationAndIndentation +ColumnLimit: 1000 +... diff --git a/vendor/github.com/cilium/ebpf/.gitignore b/vendor/github.com/cilium/ebpf/.gitignore new file mode 100644 index 0000000000..b46162b8ec --- /dev/null +++ b/vendor/github.com/cilium/ebpf/.gitignore @@ -0,0 +1,14 @@ +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +*.o +!*_bpf*.o + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out diff --git a/vendor/github.com/cilium/ebpf/.golangci.yaml b/vendor/github.com/cilium/ebpf/.golangci.yaml new file mode 100644 index 0000000000..dc62dd6d0f --- /dev/null +++ b/vendor/github.com/cilium/ebpf/.golangci.yaml @@ -0,0 +1,28 @@ +--- +issues: + exclude-rules: + # syscall param structs will have unused fields in Go code. + - path: syscall.*.go + linters: + - structcheck + +linters: + disable-all: true + enable: + - deadcode + - errcheck + - goimports + - gosimple + - govet + - ineffassign + - misspell + - staticcheck + - structcheck + - typecheck + - unused + - varcheck + + # Could be enabled later: + # - gocyclo + # - maligned + # - gosec diff --git a/vendor/github.com/cilium/ebpf/ARCHITECTURE.md b/vendor/github.com/cilium/ebpf/ARCHITECTURE.md new file mode 100644 index 0000000000..6cbb31b648 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/ARCHITECTURE.md @@ -0,0 +1,80 @@ +Architecture of the library +=== + + ELF -> Specifications -> Objects -> Links + +ELF +--- + +BPF is usually produced by using Clang to compile a subset of C. Clang outputs +an ELF file which contains program byte code (aka BPF), but also metadata for +maps used by the program. The metadata follows the conventions set by libbpf +shipped with the kernel. Certain ELF sections have special meaning +and contain structures defined by libbpf. Newer versions of clang emit +additional metadata in BPF Type Format (aka BTF). + +The library aims to be compatible with libbpf so that moving from a C toolchain +to a Go one creates little friction. To that end, the [ELF reader](elf_reader.go) +is tested against the Linux selftests and avoids introducing custom behaviour +if possible. + +The output of the ELF reader is a `CollectionSpec` which encodes +all of the information contained in the ELF in a form that is easy to work with +in Go. + +### BTF + +The BPF Type Format describes more than just the types used by a BPF program. It +includes debug aids like which source line corresponds to which instructions and +what global variables are used. + +[BTF parsing](internal/btf/) lives in a separate internal package since exposing +it would mean an additional maintenance burden, and because the API still +has sharp corners. The most important concept is the `btf.Type` interface, which +also describes things that aren't really types like `.rodata` or `.bss` sections. +`btf.Type`s can form cyclical graphs, which can easily lead to infinite loops if +one is not careful. Hopefully a safe pattern to work with `btf.Type` emerges as +we write more code that deals with it. + +Specifications +--- + +`CollectionSpec`, `ProgramSpec` and `MapSpec` are blueprints for in-kernel +objects and contain everything necessary to execute the relevant `bpf(2)` +syscalls. Since the ELF reader outputs a `CollectionSpec` it's possible to +modify clang-compiled BPF code, for example to rewrite constants. At the same +time the [asm](asm/) package provides an assembler that can be used to generate +`ProgramSpec` on the fly. + +Creating a spec should never require any privileges or be restricted in any way, +for example by only allowing programs in native endianness. This ensures that +the library stays flexible. + +Objects +--- + +`Program` and `Map` are the result of loading specs into the kernel. Sometimes +loading a spec will fail because the kernel is too old, or a feature is not +enabled. There are multiple ways the library deals with that: + +* Fallback: older kernels don't allow naming programs and maps. The library + automatically detects support for names, and omits them during load if + necessary. This works since name is primarily a debug aid. + +* Sentinel error: sometimes it's possible to detect that a feature isn't available. + In that case the library will return an error wrapping `ErrNotSupported`. + This is also useful to skip tests that can't run on the current kernel. + +Once program and map objects are loaded they expose the kernel's low-level API, +e.g. `NextKey`. Often this API is awkward to use in Go, so there are safer +wrappers on top of the low-level API, like `MapIterator`. The low-level API is +useful when our higher-level API doesn't support a particular use case. + +Links +--- + +BPF can be attached to many different points in the kernel and newer BPF hooks +tend to use bpf_link to do so. Older hooks unfortunately use a combination of +syscalls, netlink messages, etc. Adding support for a new link type should not +pull in large dependencies like netlink, so XDP programs or tracepoints are +out of scope. diff --git a/vendor/github.com/cilium/ebpf/CODE_OF_CONDUCT.md b/vendor/github.com/cilium/ebpf/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..8e42838c5a --- /dev/null +++ b/vendor/github.com/cilium/ebpf/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at nathanjsweet at gmail dot com or i at lmb dot io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/cilium/ebpf/CONTRIBUTING.md b/vendor/github.com/cilium/ebpf/CONTRIBUTING.md new file mode 100644 index 0000000000..0d29eae81e --- /dev/null +++ b/vendor/github.com/cilium/ebpf/CONTRIBUTING.md @@ -0,0 +1,40 @@ +# How to contribute + +Development is on [GitHub](https://github.com/cilium/ebpf) and contributions in +the form of pull requests and issues reporting bugs or suggesting new features +are welcome. Please take a look at [the architecture](ARCHITECTURE.md) to get +a better understanding for the high-level goals. + +New features must be accompanied by tests. Before starting work on any large +feature, please [join](https://ebpf.io/slack) the +[#ebpf-go](https://cilium.slack.com/messages/ebpf-go) channel on Slack to +discuss the design first. + +When submitting pull requests, consider writing details about what problem you +are solving and why the proposed approach solves that problem in commit messages +and/or pull request description to help future library users and maintainers to +reason about the proposed changes. + +## Running the tests + +Many of the tests require privileges to set resource limits and load eBPF code. +The easiest way to obtain these is to run the tests with `sudo`. + +To test the current package with your local kernel you can simply run: +``` +go test -exec sudo ./... +``` + +To test the current package with a different kernel version you can use the [run-tests.sh](run-tests.sh) script. +It requires [virtme](https://github.com/amluto/virtme) and qemu to be installed. + +Examples: + +```bash +# Run all tests on a 5.4 kernel +./run-tests.sh 5.4 + +# Run a subset of tests: +./run-tests.sh 5.4 go test ./link +``` + diff --git a/vendor/github.com/cilium/ebpf/LICENSE b/vendor/github.com/cilium/ebpf/LICENSE new file mode 100644 index 0000000000..c637ae99c2 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/LICENSE @@ -0,0 +1,23 @@ +MIT License + +Copyright (c) 2017 Nathan Sweet +Copyright (c) 2018, 2019 Cloudflare +Copyright (c) 2019 Authors of Cilium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/cilium/ebpf/Makefile b/vendor/github.com/cilium/ebpf/Makefile new file mode 100644 index 0000000000..0bc15c0810 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/Makefile @@ -0,0 +1,73 @@ +# The development version of clang is distributed as the 'clang' binary, +# while stable/released versions have a version number attached. +# Pin the default clang to a stable version. +CLANG ?= clang-12 +CFLAGS := -target bpf -O2 -g -Wall -Werror $(CFLAGS) + +# Obtain an absolute path to the directory of the Makefile. +# Assume the Makefile is in the root of the repository. +REPODIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +UIDGID := $(shell stat -c '%u:%g' ${REPODIR}) + +IMAGE := $(shell cat ${REPODIR}/testdata/docker/IMAGE) +VERSION := $(shell cat ${REPODIR}/testdata/docker/VERSION) + +# clang <8 doesn't tag relocs properly (STT_NOTYPE) +# clang 9 is the first version emitting BTF +TARGETS := \ + testdata/loader-clang-7 \ + testdata/loader-clang-9 \ + testdata/loader-$(CLANG) \ + testdata/btf_map_init \ + testdata/invalid_map \ + testdata/raw_tracepoint \ + testdata/invalid_map_static \ + testdata/invalid_btf_map_init \ + testdata/strings \ + testdata/freplace \ + testdata/iproute2_map_compat \ + internal/btf/testdata/relocs + +.PHONY: all clean docker-all docker-shell + +.DEFAULT_TARGET = docker-all + +# Build all ELF binaries using a Dockerized LLVM toolchain. +docker-all: + docker run --rm --user "${UIDGID}" \ + -v "${REPODIR}":/ebpf -w /ebpf --env MAKEFLAGS \ + --env CFLAGS="-fdebug-prefix-map=/ebpf=." \ + "${IMAGE}:${VERSION}" \ + make all + +# (debug) Drop the user into a shell inside the Docker container as root. +docker-shell: + docker run --rm -ti \ + -v "${REPODIR}":/ebpf -w /ebpf \ + "${IMAGE}:${VERSION}" + +clean: + -$(RM) testdata/*.elf + -$(RM) internal/btf/testdata/*.elf + +all: $(addsuffix -el.elf,$(TARGETS)) $(addsuffix -eb.elf,$(TARGETS)) + ln -srf testdata/loader-$(CLANG)-el.elf testdata/loader-el.elf + ln -srf testdata/loader-$(CLANG)-eb.elf testdata/loader-eb.elf + +testdata/loader-%-el.elf: testdata/loader.c + $* $(CFLAGS) -mlittle-endian -c $< -o $@ + +testdata/loader-%-eb.elf: testdata/loader.c + $* $(CFLAGS) -mbig-endian -c $< -o $@ + +%-el.elf: %.c + $(CLANG) $(CFLAGS) -mlittle-endian -c $< -o $@ + +%-eb.elf : %.c + $(CLANG) $(CFLAGS) -mbig-endian -c $< -o $@ + +# Usage: make VMLINUX=/path/to/vmlinux vmlinux-btf +.PHONY: vmlinux-btf +vmlinux-btf: internal/btf/testdata/vmlinux-btf.gz +internal/btf/testdata/vmlinux-btf.gz: $(VMLINUX) + objcopy --dump-section .BTF=/dev/stdout "$<" /dev/null | gzip > "$@" diff --git a/vendor/github.com/cilium/ebpf/README.md b/vendor/github.com/cilium/ebpf/README.md new file mode 100644 index 0000000000..01e2fff92b --- /dev/null +++ b/vendor/github.com/cilium/ebpf/README.md @@ -0,0 +1,70 @@ +# eBPF + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/cilium/ebpf)](https://pkg.go.dev/github.com/cilium/ebpf) + +![HoneyGopher](.github/images/cilium-ebpf.png) + +eBPF is a pure Go library that provides utilities for loading, compiling, and +debugging eBPF programs. It has minimal external dependencies and is intended to +be used in long running processes. + +The library is maintained by [Cloudflare](https://www.cloudflare.com) and +[Cilium](https://www.cilium.io). + +See [ebpf.io](https://ebpf.io) for other projects from the eBPF ecosystem. + +## Getting Started + +A small collection of Go and eBPF programs that serve as examples for building +your own tools can be found under [examples/](examples/). + +Contributions are highly encouraged, as they highlight certain use cases of +eBPF and the library, and help shape the future of the project. + +## Getting Help + +Please +[join](https://ebpf.io/slack) the +[#ebpf-go](https://cilium.slack.com/messages/ebpf-go) channel on Slack if you +have questions regarding the library. + +## Packages + +This library includes the following packages: + +* [asm](https://pkg.go.dev/github.com/cilium/ebpf/asm) contains a basic + assembler, allowing you to write eBPF assembly instructions directly + within your Go code. (You don't need to use this if you prefer to write your eBPF program in C.) +* [cmd/bpf2go](https://pkg.go.dev/github.com/cilium/ebpf/cmd/bpf2go) allows + compiling and embedding eBPF programs written in C within Go code. As well as + compiling the C code, it auto-generates Go code for loading and manipulating + the eBPF program and map objects. +* [link](https://pkg.go.dev/github.com/cilium/ebpf/link) allows attaching eBPF + to various hooks +* [perf](https://pkg.go.dev/github.com/cilium/ebpf/perf) allows reading from a + `PERF_EVENT_ARRAY` +* [ringbuf](https://pkg.go.dev/github.com/cilium/ebpf/ringbuf) allows reading from a + `BPF_MAP_TYPE_RINGBUF` map + + +## Requirements + +* A version of Go that is [supported by + upstream](https://golang.org/doc/devel/release.html#policy) +* Linux >= 4.9. CI is run against LTS releases. + +## Regenerating Testdata + +Run `make` in the root of this repository to rebuild testdata in all +subpackages. This requires Docker, as it relies on a standardized build +environment to keep the build output stable. + +The toolchain image build files are kept in [testdata/docker/](testdata/docker/). + +## License + +MIT + +### eBPF Gopher + +The eBPF honeygopher is based on the Go gopher designed by Renee French. diff --git a/vendor/github.com/cilium/ebpf/asm/alu.go b/vendor/github.com/cilium/ebpf/asm/alu.go new file mode 100644 index 0000000000..70ccc4d151 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/alu.go @@ -0,0 +1,149 @@ +package asm + +//go:generate stringer -output alu_string.go -type=Source,Endianness,ALUOp + +// Source of ALU / ALU64 / Branch operations +// +// msb lsb +// +----+-+---+ +// |op |S|cls| +// +----+-+---+ +type Source uint8 + +const sourceMask OpCode = 0x08 + +// Source bitmask +const ( + // InvalidSource is returned by getters when invoked + // on non ALU / branch OpCodes. + InvalidSource Source = 0xff + // ImmSource src is from constant + ImmSource Source = 0x00 + // RegSource src is from register + RegSource Source = 0x08 +) + +// The Endianness of a byte swap instruction. +type Endianness uint8 + +const endianMask = sourceMask + +// Endian flags +const ( + InvalidEndian Endianness = 0xff + // Convert to little endian + LE Endianness = 0x00 + // Convert to big endian + BE Endianness = 0x08 +) + +// ALUOp are ALU / ALU64 operations +// +// msb lsb +// +----+-+---+ +// |OP |s|cls| +// +----+-+---+ +type ALUOp uint8 + +const aluMask OpCode = 0xf0 + +const ( + // InvalidALUOp is returned by getters when invoked + // on non ALU OpCodes + InvalidALUOp ALUOp = 0xff + // Add - addition + Add ALUOp = 0x00 + // Sub - subtraction + Sub ALUOp = 0x10 + // Mul - multiplication + Mul ALUOp = 0x20 + // Div - division + Div ALUOp = 0x30 + // Or - bitwise or + Or ALUOp = 0x40 + // And - bitwise and + And ALUOp = 0x50 + // LSh - bitwise shift left + LSh ALUOp = 0x60 + // RSh - bitwise shift right + RSh ALUOp = 0x70 + // Neg - sign/unsign signing bit + Neg ALUOp = 0x80 + // Mod - modulo + Mod ALUOp = 0x90 + // Xor - bitwise xor + Xor ALUOp = 0xa0 + // Mov - move value from one place to another + Mov ALUOp = 0xb0 + // ArSh - arithmatic shift + ArSh ALUOp = 0xc0 + // Swap - endian conversions + Swap ALUOp = 0xd0 +) + +// HostTo converts from host to another endianness. +func HostTo(endian Endianness, dst Register, size Size) Instruction { + var imm int64 + switch size { + case Half: + imm = 16 + case Word: + imm = 32 + case DWord: + imm = 64 + default: + return Instruction{OpCode: InvalidOpCode} + } + + return Instruction{ + OpCode: OpCode(ALUClass).SetALUOp(Swap).SetSource(Source(endian)), + Dst: dst, + Constant: imm, + } +} + +// Op returns the OpCode for an ALU operation with a given source. +func (op ALUOp) Op(source Source) OpCode { + return OpCode(ALU64Class).SetALUOp(op).SetSource(source) +} + +// Reg emits `dst (op) src`. +func (op ALUOp) Reg(dst, src Register) Instruction { + return Instruction{ + OpCode: op.Op(RegSource), + Dst: dst, + Src: src, + } +} + +// Imm emits `dst (op) value`. +func (op ALUOp) Imm(dst Register, value int32) Instruction { + return Instruction{ + OpCode: op.Op(ImmSource), + Dst: dst, + Constant: int64(value), + } +} + +// Op32 returns the OpCode for a 32-bit ALU operation with a given source. +func (op ALUOp) Op32(source Source) OpCode { + return OpCode(ALUClass).SetALUOp(op).SetSource(source) +} + +// Reg32 emits `dst (op) src`, zeroing the upper 32 bit of dst. +func (op ALUOp) Reg32(dst, src Register) Instruction { + return Instruction{ + OpCode: op.Op32(RegSource), + Dst: dst, + Src: src, + } +} + +// Imm32 emits `dst (op) value`, zeroing the upper 32 bit of dst. +func (op ALUOp) Imm32(dst Register, value int32) Instruction { + return Instruction{ + OpCode: op.Op32(ImmSource), + Dst: dst, + Constant: int64(value), + } +} diff --git a/vendor/github.com/cilium/ebpf/asm/alu_string.go b/vendor/github.com/cilium/ebpf/asm/alu_string.go new file mode 100644 index 0000000000..72d3fe6292 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/alu_string.go @@ -0,0 +1,107 @@ +// Code generated by "stringer -output alu_string.go -type=Source,Endianness,ALUOp"; DO NOT EDIT. + +package asm + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[InvalidSource-255] + _ = x[ImmSource-0] + _ = x[RegSource-8] +} + +const ( + _Source_name_0 = "ImmSource" + _Source_name_1 = "RegSource" + _Source_name_2 = "InvalidSource" +) + +func (i Source) String() string { + switch { + case i == 0: + return _Source_name_0 + case i == 8: + return _Source_name_1 + case i == 255: + return _Source_name_2 + default: + return "Source(" + strconv.FormatInt(int64(i), 10) + ")" + } +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[InvalidEndian-255] + _ = x[LE-0] + _ = x[BE-8] +} + +const ( + _Endianness_name_0 = "LE" + _Endianness_name_1 = "BE" + _Endianness_name_2 = "InvalidEndian" +) + +func (i Endianness) String() string { + switch { + case i == 0: + return _Endianness_name_0 + case i == 8: + return _Endianness_name_1 + case i == 255: + return _Endianness_name_2 + default: + return "Endianness(" + strconv.FormatInt(int64(i), 10) + ")" + } +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[InvalidALUOp-255] + _ = x[Add-0] + _ = x[Sub-16] + _ = x[Mul-32] + _ = x[Div-48] + _ = x[Or-64] + _ = x[And-80] + _ = x[LSh-96] + _ = x[RSh-112] + _ = x[Neg-128] + _ = x[Mod-144] + _ = x[Xor-160] + _ = x[Mov-176] + _ = x[ArSh-192] + _ = x[Swap-208] +} + +const _ALUOp_name = "AddSubMulDivOrAndLShRShNegModXorMovArShSwapInvalidALUOp" + +var _ALUOp_map = map[ALUOp]string{ + 0: _ALUOp_name[0:3], + 16: _ALUOp_name[3:6], + 32: _ALUOp_name[6:9], + 48: _ALUOp_name[9:12], + 64: _ALUOp_name[12:14], + 80: _ALUOp_name[14:17], + 96: _ALUOp_name[17:20], + 112: _ALUOp_name[20:23], + 128: _ALUOp_name[23:26], + 144: _ALUOp_name[26:29], + 160: _ALUOp_name[29:32], + 176: _ALUOp_name[32:35], + 192: _ALUOp_name[35:39], + 208: _ALUOp_name[39:43], + 255: _ALUOp_name[43:55], +} + +func (i ALUOp) String() string { + if str, ok := _ALUOp_map[i]; ok { + return str + } + return "ALUOp(" + strconv.FormatInt(int64(i), 10) + ")" +} diff --git a/vendor/github.com/cilium/ebpf/asm/doc.go b/vendor/github.com/cilium/ebpf/asm/doc.go new file mode 100644 index 0000000000..7031bdc276 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/doc.go @@ -0,0 +1,2 @@ +// Package asm is an assembler for eBPF bytecode. +package asm diff --git a/vendor/github.com/cilium/ebpf/asm/func.go b/vendor/github.com/cilium/ebpf/asm/func.go new file mode 100644 index 0000000000..bfa5d59c97 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/func.go @@ -0,0 +1,201 @@ +package asm + +//go:generate stringer -output func_string.go -type=BuiltinFunc + +// BuiltinFunc is a built-in eBPF function. +type BuiltinFunc int32 + +// eBPF built-in functions +// +// You can regenerate this list using the following gawk script: +// +// /FN\(.+\),/ { +// match($1, /\((.+)\)/, r) +// split(r[1], p, "_") +// printf "Fn" +// for (i in p) { +// printf "%s%s", toupper(substr(p[i], 1, 1)), substr(p[i], 2) +// } +// print "" +// } +// +// The script expects include/uapi/linux/bpf.h as it's input. +const ( + FnUnspec BuiltinFunc = iota + FnMapLookupElem + FnMapUpdateElem + FnMapDeleteElem + FnProbeRead + FnKtimeGetNs + FnTracePrintk + FnGetPrandomU32 + FnGetSmpProcessorId + FnSkbStoreBytes + FnL3CsumReplace + FnL4CsumReplace + FnTailCall + FnCloneRedirect + FnGetCurrentPidTgid + FnGetCurrentUidGid + FnGetCurrentComm + FnGetCgroupClassid + FnSkbVlanPush + FnSkbVlanPop + FnSkbGetTunnelKey + FnSkbSetTunnelKey + FnPerfEventRead + FnRedirect + FnGetRouteRealm + FnPerfEventOutput + FnSkbLoadBytes + FnGetStackid + FnCsumDiff + FnSkbGetTunnelOpt + FnSkbSetTunnelOpt + FnSkbChangeProto + FnSkbChangeType + FnSkbUnderCgroup + FnGetHashRecalc + FnGetCurrentTask + FnProbeWriteUser + FnCurrentTaskUnderCgroup + FnSkbChangeTail + FnSkbPullData + FnCsumUpdate + FnSetHashInvalid + FnGetNumaNodeId + FnSkbChangeHead + FnXdpAdjustHead + FnProbeReadStr + FnGetSocketCookie + FnGetSocketUid + FnSetHash + FnSetsockopt + FnSkbAdjustRoom + FnRedirectMap + FnSkRedirectMap + FnSockMapUpdate + FnXdpAdjustMeta + FnPerfEventReadValue + FnPerfProgReadValue + FnGetsockopt + FnOverrideReturn + FnSockOpsCbFlagsSet + FnMsgRedirectMap + FnMsgApplyBytes + FnMsgCorkBytes + FnMsgPullData + FnBind + FnXdpAdjustTail + FnSkbGetXfrmState + FnGetStack + FnSkbLoadBytesRelative + FnFibLookup + FnSockHashUpdate + FnMsgRedirectHash + FnSkRedirectHash + FnLwtPushEncap + FnLwtSeg6StoreBytes + FnLwtSeg6AdjustSrh + FnLwtSeg6Action + FnRcRepeat + FnRcKeydown + FnSkbCgroupId + FnGetCurrentCgroupId + FnGetLocalStorage + FnSkSelectReuseport + FnSkbAncestorCgroupId + FnSkLookupTcp + FnSkLookupUdp + FnSkRelease + FnMapPushElem + FnMapPopElem + FnMapPeekElem + FnMsgPushData + FnMsgPopData + FnRcPointerRel + FnSpinLock + FnSpinUnlock + FnSkFullsock + FnTcpSock + FnSkbEcnSetCe + FnGetListenerSock + FnSkcLookupTcp + FnTcpCheckSyncookie + FnSysctlGetName + FnSysctlGetCurrentValue + FnSysctlGetNewValue + FnSysctlSetNewValue + FnStrtol + FnStrtoul + FnSkStorageGet + FnSkStorageDelete + FnSendSignal + FnTcpGenSyncookie + FnSkbOutput + FnProbeReadUser + FnProbeReadKernel + FnProbeReadUserStr + FnProbeReadKernelStr + FnTcpSendAck + FnSendSignalThread + FnJiffies64 + FnReadBranchRecords + FnGetNsCurrentPidTgid + FnXdpOutput + FnGetNetnsCookie + FnGetCurrentAncestorCgroupId + FnSkAssign + FnKtimeGetBootNs + FnSeqPrintf + FnSeqWrite + FnSkCgroupId + FnSkAncestorCgroupId + FnRingbufOutput + FnRingbufReserve + FnRingbufSubmit + FnRingbufDiscard + FnRingbufQuery + FnCsumLevel + FnSkcToTcp6Sock + FnSkcToTcpSock + FnSkcToTcpTimewaitSock + FnSkcToTcpRequestSock + FnSkcToUdp6Sock + FnGetTaskStack + FnLoadHdrOpt + FnStoreHdrOpt + FnReserveHdrOpt + FnInodeStorageGet + FnInodeStorageDelete + FnDPath + FnCopyFromUser + FnSnprintfBtf + FnSeqPrintfBtf + FnSkbCgroupClassid + FnRedirectNeigh + FnPerCpuPtr + FnThisCpuPtr + FnRedirectPeer + FnTaskStorageGet + FnTaskStorageDelete + FnGetCurrentTaskBtf + FnBprmOptsSet + FnKtimeGetCoarseNs + FnImaInodeHash + FnSockFromFile + FnCheckMtu + FnForEachMapElem + FnSnprintf + FnSysBpf + FnBtfFindByNameKind + FnSysClose +) + +// Call emits a function call. +func (fn BuiltinFunc) Call() Instruction { + return Instruction{ + OpCode: OpCode(JumpClass).SetJumpOp(Call), + Constant: int64(fn), + } +} diff --git a/vendor/github.com/cilium/ebpf/asm/func_string.go b/vendor/github.com/cilium/ebpf/asm/func_string.go new file mode 100644 index 0000000000..5a0e333639 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/func_string.go @@ -0,0 +1,191 @@ +// Code generated by "stringer -output func_string.go -type=BuiltinFunc"; DO NOT EDIT. + +package asm + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[FnUnspec-0] + _ = x[FnMapLookupElem-1] + _ = x[FnMapUpdateElem-2] + _ = x[FnMapDeleteElem-3] + _ = x[FnProbeRead-4] + _ = x[FnKtimeGetNs-5] + _ = x[FnTracePrintk-6] + _ = x[FnGetPrandomU32-7] + _ = x[FnGetSmpProcessorId-8] + _ = x[FnSkbStoreBytes-9] + _ = x[FnL3CsumReplace-10] + _ = x[FnL4CsumReplace-11] + _ = x[FnTailCall-12] + _ = x[FnCloneRedirect-13] + _ = x[FnGetCurrentPidTgid-14] + _ = x[FnGetCurrentUidGid-15] + _ = x[FnGetCurrentComm-16] + _ = x[FnGetCgroupClassid-17] + _ = x[FnSkbVlanPush-18] + _ = x[FnSkbVlanPop-19] + _ = x[FnSkbGetTunnelKey-20] + _ = x[FnSkbSetTunnelKey-21] + _ = x[FnPerfEventRead-22] + _ = x[FnRedirect-23] + _ = x[FnGetRouteRealm-24] + _ = x[FnPerfEventOutput-25] + _ = x[FnSkbLoadBytes-26] + _ = x[FnGetStackid-27] + _ = x[FnCsumDiff-28] + _ = x[FnSkbGetTunnelOpt-29] + _ = x[FnSkbSetTunnelOpt-30] + _ = x[FnSkbChangeProto-31] + _ = x[FnSkbChangeType-32] + _ = x[FnSkbUnderCgroup-33] + _ = x[FnGetHashRecalc-34] + _ = x[FnGetCurrentTask-35] + _ = x[FnProbeWriteUser-36] + _ = x[FnCurrentTaskUnderCgroup-37] + _ = x[FnSkbChangeTail-38] + _ = x[FnSkbPullData-39] + _ = x[FnCsumUpdate-40] + _ = x[FnSetHashInvalid-41] + _ = x[FnGetNumaNodeId-42] + _ = x[FnSkbChangeHead-43] + _ = x[FnXdpAdjustHead-44] + _ = x[FnProbeReadStr-45] + _ = x[FnGetSocketCookie-46] + _ = x[FnGetSocketUid-47] + _ = x[FnSetHash-48] + _ = x[FnSetsockopt-49] + _ = x[FnSkbAdjustRoom-50] + _ = x[FnRedirectMap-51] + _ = x[FnSkRedirectMap-52] + _ = x[FnSockMapUpdate-53] + _ = x[FnXdpAdjustMeta-54] + _ = x[FnPerfEventReadValue-55] + _ = x[FnPerfProgReadValue-56] + _ = x[FnGetsockopt-57] + _ = x[FnOverrideReturn-58] + _ = x[FnSockOpsCbFlagsSet-59] + _ = x[FnMsgRedirectMap-60] + _ = x[FnMsgApplyBytes-61] + _ = x[FnMsgCorkBytes-62] + _ = x[FnMsgPullData-63] + _ = x[FnBind-64] + _ = x[FnXdpAdjustTail-65] + _ = x[FnSkbGetXfrmState-66] + _ = x[FnGetStack-67] + _ = x[FnSkbLoadBytesRelative-68] + _ = x[FnFibLookup-69] + _ = x[FnSockHashUpdate-70] + _ = x[FnMsgRedirectHash-71] + _ = x[FnSkRedirectHash-72] + _ = x[FnLwtPushEncap-73] + _ = x[FnLwtSeg6StoreBytes-74] + _ = x[FnLwtSeg6AdjustSrh-75] + _ = x[FnLwtSeg6Action-76] + _ = x[FnRcRepeat-77] + _ = x[FnRcKeydown-78] + _ = x[FnSkbCgroupId-79] + _ = x[FnGetCurrentCgroupId-80] + _ = x[FnGetLocalStorage-81] + _ = x[FnSkSelectReuseport-82] + _ = x[FnSkbAncestorCgroupId-83] + _ = x[FnSkLookupTcp-84] + _ = x[FnSkLookupUdp-85] + _ = x[FnSkRelease-86] + _ = x[FnMapPushElem-87] + _ = x[FnMapPopElem-88] + _ = x[FnMapPeekElem-89] + _ = x[FnMsgPushData-90] + _ = x[FnMsgPopData-91] + _ = x[FnRcPointerRel-92] + _ = x[FnSpinLock-93] + _ = x[FnSpinUnlock-94] + _ = x[FnSkFullsock-95] + _ = x[FnTcpSock-96] + _ = x[FnSkbEcnSetCe-97] + _ = x[FnGetListenerSock-98] + _ = x[FnSkcLookupTcp-99] + _ = x[FnTcpCheckSyncookie-100] + _ = x[FnSysctlGetName-101] + _ = x[FnSysctlGetCurrentValue-102] + _ = x[FnSysctlGetNewValue-103] + _ = x[FnSysctlSetNewValue-104] + _ = x[FnStrtol-105] + _ = x[FnStrtoul-106] + _ = x[FnSkStorageGet-107] + _ = x[FnSkStorageDelete-108] + _ = x[FnSendSignal-109] + _ = x[FnTcpGenSyncookie-110] + _ = x[FnSkbOutput-111] + _ = x[FnProbeReadUser-112] + _ = x[FnProbeReadKernel-113] + _ = x[FnProbeReadUserStr-114] + _ = x[FnProbeReadKernelStr-115] + _ = x[FnTcpSendAck-116] + _ = x[FnSendSignalThread-117] + _ = x[FnJiffies64-118] + _ = x[FnReadBranchRecords-119] + _ = x[FnGetNsCurrentPidTgid-120] + _ = x[FnXdpOutput-121] + _ = x[FnGetNetnsCookie-122] + _ = x[FnGetCurrentAncestorCgroupId-123] + _ = x[FnSkAssign-124] + _ = x[FnKtimeGetBootNs-125] + _ = x[FnSeqPrintf-126] + _ = x[FnSeqWrite-127] + _ = x[FnSkCgroupId-128] + _ = x[FnSkAncestorCgroupId-129] + _ = x[FnRingbufOutput-130] + _ = x[FnRingbufReserve-131] + _ = x[FnRingbufSubmit-132] + _ = x[FnRingbufDiscard-133] + _ = x[FnRingbufQuery-134] + _ = x[FnCsumLevel-135] + _ = x[FnSkcToTcp6Sock-136] + _ = x[FnSkcToTcpSock-137] + _ = x[FnSkcToTcpTimewaitSock-138] + _ = x[FnSkcToTcpRequestSock-139] + _ = x[FnSkcToUdp6Sock-140] + _ = x[FnGetTaskStack-141] + _ = x[FnLoadHdrOpt-142] + _ = x[FnStoreHdrOpt-143] + _ = x[FnReserveHdrOpt-144] + _ = x[FnInodeStorageGet-145] + _ = x[FnInodeStorageDelete-146] + _ = x[FnDPath-147] + _ = x[FnCopyFromUser-148] + _ = x[FnSnprintfBtf-149] + _ = x[FnSeqPrintfBtf-150] + _ = x[FnSkbCgroupClassid-151] + _ = x[FnRedirectNeigh-152] + _ = x[FnPerCpuPtr-153] + _ = x[FnThisCpuPtr-154] + _ = x[FnRedirectPeer-155] + _ = x[FnTaskStorageGet-156] + _ = x[FnTaskStorageDelete-157] + _ = x[FnGetCurrentTaskBtf-158] + _ = x[FnBprmOptsSet-159] + _ = x[FnKtimeGetCoarseNs-160] + _ = x[FnImaInodeHash-161] + _ = x[FnSockFromFile-162] + _ = x[FnCheckMtu-163] + _ = x[FnForEachMapElem-164] + _ = x[FnSnprintf-165] + _ = x[FnSysBpf-166] + _ = x[FnBtfFindByNameKind-167] + _ = x[FnSysClose-168] +} + +const _BuiltinFunc_name = "FnUnspecFnMapLookupElemFnMapUpdateElemFnMapDeleteElemFnProbeReadFnKtimeGetNsFnTracePrintkFnGetPrandomU32FnGetSmpProcessorIdFnSkbStoreBytesFnL3CsumReplaceFnL4CsumReplaceFnTailCallFnCloneRedirectFnGetCurrentPidTgidFnGetCurrentUidGidFnGetCurrentCommFnGetCgroupClassidFnSkbVlanPushFnSkbVlanPopFnSkbGetTunnelKeyFnSkbSetTunnelKeyFnPerfEventReadFnRedirectFnGetRouteRealmFnPerfEventOutputFnSkbLoadBytesFnGetStackidFnCsumDiffFnSkbGetTunnelOptFnSkbSetTunnelOptFnSkbChangeProtoFnSkbChangeTypeFnSkbUnderCgroupFnGetHashRecalcFnGetCurrentTaskFnProbeWriteUserFnCurrentTaskUnderCgroupFnSkbChangeTailFnSkbPullDataFnCsumUpdateFnSetHashInvalidFnGetNumaNodeIdFnSkbChangeHeadFnXdpAdjustHeadFnProbeReadStrFnGetSocketCookieFnGetSocketUidFnSetHashFnSetsockoptFnSkbAdjustRoomFnRedirectMapFnSkRedirectMapFnSockMapUpdateFnXdpAdjustMetaFnPerfEventReadValueFnPerfProgReadValueFnGetsockoptFnOverrideReturnFnSockOpsCbFlagsSetFnMsgRedirectMapFnMsgApplyBytesFnMsgCorkBytesFnMsgPullDataFnBindFnXdpAdjustTailFnSkbGetXfrmStateFnGetStackFnSkbLoadBytesRelativeFnFibLookupFnSockHashUpdateFnMsgRedirectHashFnSkRedirectHashFnLwtPushEncapFnLwtSeg6StoreBytesFnLwtSeg6AdjustSrhFnLwtSeg6ActionFnRcRepeatFnRcKeydownFnSkbCgroupIdFnGetCurrentCgroupIdFnGetLocalStorageFnSkSelectReuseportFnSkbAncestorCgroupIdFnSkLookupTcpFnSkLookupUdpFnSkReleaseFnMapPushElemFnMapPopElemFnMapPeekElemFnMsgPushDataFnMsgPopDataFnRcPointerRelFnSpinLockFnSpinUnlockFnSkFullsockFnTcpSockFnSkbEcnSetCeFnGetListenerSockFnSkcLookupTcpFnTcpCheckSyncookieFnSysctlGetNameFnSysctlGetCurrentValueFnSysctlGetNewValueFnSysctlSetNewValueFnStrtolFnStrtoulFnSkStorageGetFnSkStorageDeleteFnSendSignalFnTcpGenSyncookieFnSkbOutputFnProbeReadUserFnProbeReadKernelFnProbeReadUserStrFnProbeReadKernelStrFnTcpSendAckFnSendSignalThreadFnJiffies64FnReadBranchRecordsFnGetNsCurrentPidTgidFnXdpOutputFnGetNetnsCookieFnGetCurrentAncestorCgroupIdFnSkAssignFnKtimeGetBootNsFnSeqPrintfFnSeqWriteFnSkCgroupIdFnSkAncestorCgroupIdFnRingbufOutputFnRingbufReserveFnRingbufSubmitFnRingbufDiscardFnRingbufQueryFnCsumLevelFnSkcToTcp6SockFnSkcToTcpSockFnSkcToTcpTimewaitSockFnSkcToTcpRequestSockFnSkcToUdp6SockFnGetTaskStackFnLoadHdrOptFnStoreHdrOptFnReserveHdrOptFnInodeStorageGetFnInodeStorageDeleteFnDPathFnCopyFromUserFnSnprintfBtfFnSeqPrintfBtfFnSkbCgroupClassidFnRedirectNeighFnPerCpuPtrFnThisCpuPtrFnRedirectPeerFnTaskStorageGetFnTaskStorageDeleteFnGetCurrentTaskBtfFnBprmOptsSetFnKtimeGetCoarseNsFnImaInodeHashFnSockFromFileFnCheckMtuFnForEachMapElemFnSnprintfFnSysBpfFnBtfFindByNameKindFnSysClose" + +var _BuiltinFunc_index = [...]uint16{0, 8, 23, 38, 53, 64, 76, 89, 104, 123, 138, 153, 168, 178, 193, 212, 230, 246, 264, 277, 289, 306, 323, 338, 348, 363, 380, 394, 406, 416, 433, 450, 466, 481, 497, 512, 528, 544, 568, 583, 596, 608, 624, 639, 654, 669, 683, 700, 714, 723, 735, 750, 763, 778, 793, 808, 828, 847, 859, 875, 894, 910, 925, 939, 952, 958, 973, 990, 1000, 1022, 1033, 1049, 1066, 1082, 1096, 1115, 1133, 1148, 1158, 1169, 1182, 1202, 1219, 1238, 1259, 1272, 1285, 1296, 1309, 1321, 1334, 1347, 1359, 1373, 1383, 1395, 1407, 1416, 1429, 1446, 1460, 1479, 1494, 1517, 1536, 1555, 1563, 1572, 1586, 1603, 1615, 1632, 1643, 1658, 1675, 1693, 1713, 1725, 1743, 1754, 1773, 1794, 1805, 1821, 1849, 1859, 1875, 1886, 1896, 1908, 1928, 1943, 1959, 1974, 1990, 2004, 2015, 2030, 2044, 2066, 2087, 2102, 2116, 2128, 2141, 2156, 2173, 2193, 2200, 2214, 2227, 2241, 2259, 2274, 2285, 2297, 2311, 2327, 2346, 2365, 2378, 2396, 2410, 2424, 2434, 2450, 2460, 2468, 2487, 2497} + +func (i BuiltinFunc) String() string { + if i < 0 || i >= BuiltinFunc(len(_BuiltinFunc_index)-1) { + return "BuiltinFunc(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _BuiltinFunc_name[_BuiltinFunc_index[i]:_BuiltinFunc_index[i+1]] +} diff --git a/vendor/github.com/cilium/ebpf/asm/instruction.go b/vendor/github.com/cilium/ebpf/asm/instruction.go new file mode 100644 index 0000000000..64d717d156 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/instruction.go @@ -0,0 +1,511 @@ +package asm + +import ( + "crypto/sha1" + "encoding/binary" + "encoding/hex" + "errors" + "fmt" + "io" + "math" + "strings" + + "github.com/cilium/ebpf/internal/unix" +) + +// InstructionSize is the size of a BPF instruction in bytes +const InstructionSize = 8 + +// RawInstructionOffset is an offset in units of raw BPF instructions. +type RawInstructionOffset uint64 + +// Bytes returns the offset of an instruction in bytes. +func (rio RawInstructionOffset) Bytes() uint64 { + return uint64(rio) * InstructionSize +} + +// Instruction is a single eBPF instruction. +type Instruction struct { + OpCode OpCode + Dst Register + Src Register + Offset int16 + Constant int64 + Reference string + Symbol string +} + +// Sym creates a symbol. +func (ins Instruction) Sym(name string) Instruction { + ins.Symbol = name + return ins +} + +// Unmarshal decodes a BPF instruction. +func (ins *Instruction) Unmarshal(r io.Reader, bo binary.ByteOrder) (uint64, error) { + var bi bpfInstruction + err := binary.Read(r, bo, &bi) + if err != nil { + return 0, err + } + + ins.OpCode = bi.OpCode + ins.Offset = bi.Offset + ins.Constant = int64(bi.Constant) + ins.Dst, ins.Src, err = bi.Registers.Unmarshal(bo) + if err != nil { + return 0, fmt.Errorf("can't unmarshal registers: %s", err) + } + + if !bi.OpCode.IsDWordLoad() { + return InstructionSize, nil + } + + var bi2 bpfInstruction + if err := binary.Read(r, bo, &bi2); err != nil { + // No Wrap, to avoid io.EOF clash + return 0, errors.New("64bit immediate is missing second half") + } + if bi2.OpCode != 0 || bi2.Offset != 0 || bi2.Registers != 0 { + return 0, errors.New("64bit immediate has non-zero fields") + } + ins.Constant = int64(uint64(uint32(bi2.Constant))<<32 | uint64(uint32(bi.Constant))) + + return 2 * InstructionSize, nil +} + +// Marshal encodes a BPF instruction. +func (ins Instruction) Marshal(w io.Writer, bo binary.ByteOrder) (uint64, error) { + if ins.OpCode == InvalidOpCode { + return 0, errors.New("invalid opcode") + } + + isDWordLoad := ins.OpCode.IsDWordLoad() + + cons := int32(ins.Constant) + if isDWordLoad { + // Encode least significant 32bit first for 64bit operations. + cons = int32(uint32(ins.Constant)) + } + + regs, err := newBPFRegisters(ins.Dst, ins.Src, bo) + if err != nil { + return 0, fmt.Errorf("can't marshal registers: %s", err) + } + + bpfi := bpfInstruction{ + ins.OpCode, + regs, + ins.Offset, + cons, + } + + if err := binary.Write(w, bo, &bpfi); err != nil { + return 0, err + } + + if !isDWordLoad { + return InstructionSize, nil + } + + bpfi = bpfInstruction{ + Constant: int32(ins.Constant >> 32), + } + + if err := binary.Write(w, bo, &bpfi); err != nil { + return 0, err + } + + return 2 * InstructionSize, nil +} + +// RewriteMapPtr changes an instruction to use a new map fd. +// +// Returns an error if the instruction doesn't load a map. +func (ins *Instruction) RewriteMapPtr(fd int) error { + if !ins.OpCode.IsDWordLoad() { + return fmt.Errorf("%s is not a 64 bit load", ins.OpCode) + } + + if ins.Src != PseudoMapFD && ins.Src != PseudoMapValue { + return errors.New("not a load from a map") + } + + // Preserve the offset value for direct map loads. + offset := uint64(ins.Constant) & (math.MaxUint32 << 32) + rawFd := uint64(uint32(fd)) + ins.Constant = int64(offset | rawFd) + return nil +} + +// MapPtr returns the map fd for this instruction. +// +// The result is undefined if the instruction is not a load from a map, +// see IsLoadFromMap. +func (ins *Instruction) MapPtr() int { + return int(int32(uint64(ins.Constant) & math.MaxUint32)) +} + +// RewriteMapOffset changes the offset of a direct load from a map. +// +// Returns an error if the instruction is not a direct load. +func (ins *Instruction) RewriteMapOffset(offset uint32) error { + if !ins.OpCode.IsDWordLoad() { + return fmt.Errorf("%s is not a 64 bit load", ins.OpCode) + } + + if ins.Src != PseudoMapValue { + return errors.New("not a direct load from a map") + } + + fd := uint64(ins.Constant) & math.MaxUint32 + ins.Constant = int64(uint64(offset)<<32 | fd) + return nil +} + +func (ins *Instruction) mapOffset() uint32 { + return uint32(uint64(ins.Constant) >> 32) +} + +// IsLoadFromMap returns true if the instruction loads from a map. +// +// This covers both loading the map pointer and direct map value loads. +func (ins *Instruction) IsLoadFromMap() bool { + return ins.OpCode == LoadImmOp(DWord) && (ins.Src == PseudoMapFD || ins.Src == PseudoMapValue) +} + +// IsFunctionCall returns true if the instruction calls another BPF function. +// +// This is not the same thing as a BPF helper call. +func (ins *Instruction) IsFunctionCall() bool { + return ins.OpCode.JumpOp() == Call && ins.Src == PseudoCall +} + +// IsBuiltinCall returns true if the instruction is a built-in call, i.e. BPF helper call. +func (ins *Instruction) IsBuiltinCall() bool { + return ins.OpCode.JumpOp() == Call && ins.Src == R0 && ins.Dst == R0 +} + +// IsConstantLoad returns true if the instruction loads a constant of the +// given size. +func (ins *Instruction) IsConstantLoad(size Size) bool { + return ins.OpCode == LoadImmOp(size) && ins.Src == R0 && ins.Offset == 0 +} + +// Format implements fmt.Formatter. +func (ins Instruction) Format(f fmt.State, c rune) { + if c != 'v' { + fmt.Fprintf(f, "{UNRECOGNIZED: %c}", c) + return + } + + op := ins.OpCode + + if op == InvalidOpCode { + fmt.Fprint(f, "INVALID") + return + } + + // Omit trailing space for Exit + if op.JumpOp() == Exit { + fmt.Fprint(f, op) + return + } + + if ins.IsLoadFromMap() { + fd := ins.MapPtr() + switch ins.Src { + case PseudoMapFD: + fmt.Fprintf(f, "LoadMapPtr dst: %s fd: %d", ins.Dst, fd) + + case PseudoMapValue: + fmt.Fprintf(f, "LoadMapValue dst: %s, fd: %d off: %d", ins.Dst, fd, ins.mapOffset()) + } + + goto ref + } + + fmt.Fprintf(f, "%v ", op) + switch cls := op.Class(); cls { + case LdClass, LdXClass, StClass, StXClass: + switch op.Mode() { + case ImmMode: + fmt.Fprintf(f, "dst: %s imm: %d", ins.Dst, ins.Constant) + case AbsMode: + fmt.Fprintf(f, "imm: %d", ins.Constant) + case IndMode: + fmt.Fprintf(f, "dst: %s src: %s imm: %d", ins.Dst, ins.Src, ins.Constant) + case MemMode: + fmt.Fprintf(f, "dst: %s src: %s off: %d imm: %d", ins.Dst, ins.Src, ins.Offset, ins.Constant) + case XAddMode: + fmt.Fprintf(f, "dst: %s src: %s", ins.Dst, ins.Src) + } + + case ALU64Class, ALUClass: + fmt.Fprintf(f, "dst: %s ", ins.Dst) + if op.ALUOp() == Swap || op.Source() == ImmSource { + fmt.Fprintf(f, "imm: %d", ins.Constant) + } else { + fmt.Fprintf(f, "src: %s", ins.Src) + } + + case JumpClass: + switch jop := op.JumpOp(); jop { + case Call: + if ins.Src == PseudoCall { + // bpf-to-bpf call + fmt.Fprint(f, ins.Constant) + } else { + fmt.Fprint(f, BuiltinFunc(ins.Constant)) + } + + default: + fmt.Fprintf(f, "dst: %s off: %d ", ins.Dst, ins.Offset) + if op.Source() == ImmSource { + fmt.Fprintf(f, "imm: %d", ins.Constant) + } else { + fmt.Fprintf(f, "src: %s", ins.Src) + } + } + } + +ref: + if ins.Reference != "" { + fmt.Fprintf(f, " <%s>", ins.Reference) + } +} + +// Instructions is an eBPF program. +type Instructions []Instruction + +func (insns Instructions) String() string { + return fmt.Sprint(insns) +} + +// RewriteMapPtr rewrites all loads of a specific map pointer to a new fd. +// +// Returns an error if the symbol isn't used, see IsUnreferencedSymbol. +func (insns Instructions) RewriteMapPtr(symbol string, fd int) error { + if symbol == "" { + return errors.New("empty symbol") + } + + found := false + for i := range insns { + ins := &insns[i] + if ins.Reference != symbol { + continue + } + + if err := ins.RewriteMapPtr(fd); err != nil { + return err + } + + found = true + } + + if !found { + return &unreferencedSymbolError{symbol} + } + + return nil +} + +// SymbolOffsets returns the set of symbols and their offset in +// the instructions. +func (insns Instructions) SymbolOffsets() (map[string]int, error) { + offsets := make(map[string]int) + + for i, ins := range insns { + if ins.Symbol == "" { + continue + } + + if _, ok := offsets[ins.Symbol]; ok { + return nil, fmt.Errorf("duplicate symbol %s", ins.Symbol) + } + + offsets[ins.Symbol] = i + } + + return offsets, nil +} + +// ReferenceOffsets returns the set of references and their offset in +// the instructions. +func (insns Instructions) ReferenceOffsets() map[string][]int { + offsets := make(map[string][]int) + + for i, ins := range insns { + if ins.Reference == "" { + continue + } + + offsets[ins.Reference] = append(offsets[ins.Reference], i) + } + + return offsets +} + +// Format implements fmt.Formatter. +// +// You can control indentation of symbols by +// specifying a width. Setting a precision controls the indentation of +// instructions. +// The default character is a tab, which can be overridden by specifying +// the ' ' space flag. +func (insns Instructions) Format(f fmt.State, c rune) { + if c != 's' && c != 'v' { + fmt.Fprintf(f, "{UNKNOWN FORMAT '%c'}", c) + return + } + + // Precision is better in this case, because it allows + // specifying 0 padding easily. + padding, ok := f.Precision() + if !ok { + padding = 1 + } + + indent := strings.Repeat("\t", padding) + if f.Flag(' ') { + indent = strings.Repeat(" ", padding) + } + + symPadding, ok := f.Width() + if !ok { + symPadding = padding - 1 + } + if symPadding < 0 { + symPadding = 0 + } + + symIndent := strings.Repeat("\t", symPadding) + if f.Flag(' ') { + symIndent = strings.Repeat(" ", symPadding) + } + + // Guess how many digits we need at most, by assuming that all instructions + // are double wide. + highestOffset := len(insns) * 2 + offsetWidth := int(math.Ceil(math.Log10(float64(highestOffset)))) + + iter := insns.Iterate() + for iter.Next() { + if iter.Ins.Symbol != "" { + fmt.Fprintf(f, "%s%s:\n", symIndent, iter.Ins.Symbol) + } + fmt.Fprintf(f, "%s%*d: %v\n", indent, offsetWidth, iter.Offset, iter.Ins) + } +} + +// Marshal encodes a BPF program into the kernel format. +func (insns Instructions) Marshal(w io.Writer, bo binary.ByteOrder) error { + for i, ins := range insns { + _, err := ins.Marshal(w, bo) + if err != nil { + return fmt.Errorf("instruction %d: %w", i, err) + } + } + return nil +} + +// Tag calculates the kernel tag for a series of instructions. +// +// It mirrors bpf_prog_calc_tag in the kernel and so can be compared +// to ProgramInfo.Tag to figure out whether a loaded program matches +// certain instructions. +func (insns Instructions) Tag(bo binary.ByteOrder) (string, error) { + h := sha1.New() + for i, ins := range insns { + if ins.IsLoadFromMap() { + ins.Constant = 0 + } + _, err := ins.Marshal(h, bo) + if err != nil { + return "", fmt.Errorf("instruction %d: %w", i, err) + } + } + return hex.EncodeToString(h.Sum(nil)[:unix.BPF_TAG_SIZE]), nil +} + +// Iterate allows iterating a BPF program while keeping track of +// various offsets. +// +// Modifying the instruction slice will lead to undefined behaviour. +func (insns Instructions) Iterate() *InstructionIterator { + return &InstructionIterator{insns: insns} +} + +// InstructionIterator iterates over a BPF program. +type InstructionIterator struct { + insns Instructions + // The instruction in question. + Ins *Instruction + // The index of the instruction in the original instruction slice. + Index int + // The offset of the instruction in raw BPF instructions. This accounts + // for double-wide instructions. + Offset RawInstructionOffset +} + +// Next returns true as long as there are any instructions remaining. +func (iter *InstructionIterator) Next() bool { + if len(iter.insns) == 0 { + return false + } + + if iter.Ins != nil { + iter.Index++ + iter.Offset += RawInstructionOffset(iter.Ins.OpCode.rawInstructions()) + } + iter.Ins = &iter.insns[0] + iter.insns = iter.insns[1:] + return true +} + +type bpfInstruction struct { + OpCode OpCode + Registers bpfRegisters + Offset int16 + Constant int32 +} + +type bpfRegisters uint8 + +func newBPFRegisters(dst, src Register, bo binary.ByteOrder) (bpfRegisters, error) { + switch bo { + case binary.LittleEndian: + return bpfRegisters((src << 4) | (dst & 0xF)), nil + case binary.BigEndian: + return bpfRegisters((dst << 4) | (src & 0xF)), nil + default: + return 0, fmt.Errorf("unrecognized ByteOrder %T", bo) + } +} + +func (r bpfRegisters) Unmarshal(bo binary.ByteOrder) (dst, src Register, err error) { + switch bo { + case binary.LittleEndian: + return Register(r & 0xF), Register(r >> 4), nil + case binary.BigEndian: + return Register(r >> 4), Register(r & 0xf), nil + default: + return 0, 0, fmt.Errorf("unrecognized ByteOrder %T", bo) + } +} + +type unreferencedSymbolError struct { + symbol string +} + +func (use *unreferencedSymbolError) Error() string { + return fmt.Sprintf("unreferenced symbol %s", use.symbol) +} + +// IsUnreferencedSymbol returns true if err was caused by +// an unreferenced symbol. +func IsUnreferencedSymbol(err error) bool { + _, ok := err.(*unreferencedSymbolError) + return ok +} diff --git a/vendor/github.com/cilium/ebpf/asm/jump.go b/vendor/github.com/cilium/ebpf/asm/jump.go new file mode 100644 index 0000000000..7757179de6 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/jump.go @@ -0,0 +1,109 @@ +package asm + +//go:generate stringer -output jump_string.go -type=JumpOp + +// JumpOp affect control flow. +// +// msb lsb +// +----+-+---+ +// |OP |s|cls| +// +----+-+---+ +type JumpOp uint8 + +const jumpMask OpCode = aluMask + +const ( + // InvalidJumpOp is returned by getters when invoked + // on non branch OpCodes + InvalidJumpOp JumpOp = 0xff + // Ja jumps by offset unconditionally + Ja JumpOp = 0x00 + // JEq jumps by offset if r == imm + JEq JumpOp = 0x10 + // JGT jumps by offset if r > imm + JGT JumpOp = 0x20 + // JGE jumps by offset if r >= imm + JGE JumpOp = 0x30 + // JSet jumps by offset if r & imm + JSet JumpOp = 0x40 + // JNE jumps by offset if r != imm + JNE JumpOp = 0x50 + // JSGT jumps by offset if signed r > signed imm + JSGT JumpOp = 0x60 + // JSGE jumps by offset if signed r >= signed imm + JSGE JumpOp = 0x70 + // Call builtin or user defined function from imm + Call JumpOp = 0x80 + // Exit ends execution, with value in r0 + Exit JumpOp = 0x90 + // JLT jumps by offset if r < imm + JLT JumpOp = 0xa0 + // JLE jumps by offset if r <= imm + JLE JumpOp = 0xb0 + // JSLT jumps by offset if signed r < signed imm + JSLT JumpOp = 0xc0 + // JSLE jumps by offset if signed r <= signed imm + JSLE JumpOp = 0xd0 +) + +// Return emits an exit instruction. +// +// Requires a return value in R0. +func Return() Instruction { + return Instruction{ + OpCode: OpCode(JumpClass).SetJumpOp(Exit), + } +} + +// Op returns the OpCode for a given jump source. +func (op JumpOp) Op(source Source) OpCode { + return OpCode(JumpClass).SetJumpOp(op).SetSource(source) +} + +// Imm compares dst to value, and adjusts PC by offset if the condition is fulfilled. +func (op JumpOp) Imm(dst Register, value int32, label string) Instruction { + if op == Exit || op == Call || op == Ja { + return Instruction{OpCode: InvalidOpCode} + } + + return Instruction{ + OpCode: OpCode(JumpClass).SetJumpOp(op).SetSource(ImmSource), + Dst: dst, + Offset: -1, + Constant: int64(value), + Reference: label, + } +} + +// Reg compares dst to src, and adjusts PC by offset if the condition is fulfilled. +func (op JumpOp) Reg(dst, src Register, label string) Instruction { + if op == Exit || op == Call || op == Ja { + return Instruction{OpCode: InvalidOpCode} + } + + return Instruction{ + OpCode: OpCode(JumpClass).SetJumpOp(op).SetSource(RegSource), + Dst: dst, + Src: src, + Offset: -1, + Reference: label, + } +} + +// Label adjusts PC to the address of the label. +func (op JumpOp) Label(label string) Instruction { + if op == Call { + return Instruction{ + OpCode: OpCode(JumpClass).SetJumpOp(Call), + Src: PseudoCall, + Constant: -1, + Reference: label, + } + } + + return Instruction{ + OpCode: OpCode(JumpClass).SetJumpOp(op), + Offset: -1, + Reference: label, + } +} diff --git a/vendor/github.com/cilium/ebpf/asm/jump_string.go b/vendor/github.com/cilium/ebpf/asm/jump_string.go new file mode 100644 index 0000000000..85a4aaffa5 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/jump_string.go @@ -0,0 +1,53 @@ +// Code generated by "stringer -output jump_string.go -type=JumpOp"; DO NOT EDIT. + +package asm + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[InvalidJumpOp-255] + _ = x[Ja-0] + _ = x[JEq-16] + _ = x[JGT-32] + _ = x[JGE-48] + _ = x[JSet-64] + _ = x[JNE-80] + _ = x[JSGT-96] + _ = x[JSGE-112] + _ = x[Call-128] + _ = x[Exit-144] + _ = x[JLT-160] + _ = x[JLE-176] + _ = x[JSLT-192] + _ = x[JSLE-208] +} + +const _JumpOp_name = "JaJEqJGTJGEJSetJNEJSGTJSGECallExitJLTJLEJSLTJSLEInvalidJumpOp" + +var _JumpOp_map = map[JumpOp]string{ + 0: _JumpOp_name[0:2], + 16: _JumpOp_name[2:5], + 32: _JumpOp_name[5:8], + 48: _JumpOp_name[8:11], + 64: _JumpOp_name[11:15], + 80: _JumpOp_name[15:18], + 96: _JumpOp_name[18:22], + 112: _JumpOp_name[22:26], + 128: _JumpOp_name[26:30], + 144: _JumpOp_name[30:34], + 160: _JumpOp_name[34:37], + 176: _JumpOp_name[37:40], + 192: _JumpOp_name[40:44], + 208: _JumpOp_name[44:48], + 255: _JumpOp_name[48:61], +} + +func (i JumpOp) String() string { + if str, ok := _JumpOp_map[i]; ok { + return str + } + return "JumpOp(" + strconv.FormatInt(int64(i), 10) + ")" +} diff --git a/vendor/github.com/cilium/ebpf/asm/load_store.go b/vendor/github.com/cilium/ebpf/asm/load_store.go new file mode 100644 index 0000000000..85ed286b02 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/load_store.go @@ -0,0 +1,204 @@ +package asm + +//go:generate stringer -output load_store_string.go -type=Mode,Size + +// Mode for load and store operations +// +// msb lsb +// +---+--+---+ +// |MDE|sz|cls| +// +---+--+---+ +type Mode uint8 + +const modeMask OpCode = 0xe0 + +const ( + // InvalidMode is returned by getters when invoked + // on non load / store OpCodes + InvalidMode Mode = 0xff + // ImmMode - immediate value + ImmMode Mode = 0x00 + // AbsMode - immediate value + offset + AbsMode Mode = 0x20 + // IndMode - indirect (imm+src) + IndMode Mode = 0x40 + // MemMode - load from memory + MemMode Mode = 0x60 + // XAddMode - add atomically across processors. + XAddMode Mode = 0xc0 +) + +// Size of load and store operations +// +// msb lsb +// +---+--+---+ +// |mde|SZ|cls| +// +---+--+---+ +type Size uint8 + +const sizeMask OpCode = 0x18 + +const ( + // InvalidSize is returned by getters when invoked + // on non load / store OpCodes + InvalidSize Size = 0xff + // DWord - double word; 64 bits + DWord Size = 0x18 + // Word - word; 32 bits + Word Size = 0x00 + // Half - half-word; 16 bits + Half Size = 0x08 + // Byte - byte; 8 bits + Byte Size = 0x10 +) + +// Sizeof returns the size in bytes. +func (s Size) Sizeof() int { + switch s { + case DWord: + return 8 + case Word: + return 4 + case Half: + return 2 + case Byte: + return 1 + default: + return -1 + } +} + +// LoadMemOp returns the OpCode to load a value of given size from memory. +func LoadMemOp(size Size) OpCode { + return OpCode(LdXClass).SetMode(MemMode).SetSize(size) +} + +// LoadMem emits `dst = *(size *)(src + offset)`. +func LoadMem(dst, src Register, offset int16, size Size) Instruction { + return Instruction{ + OpCode: LoadMemOp(size), + Dst: dst, + Src: src, + Offset: offset, + } +} + +// LoadImmOp returns the OpCode to load an immediate of given size. +// +// As of kernel 4.20, only DWord size is accepted. +func LoadImmOp(size Size) OpCode { + return OpCode(LdClass).SetMode(ImmMode).SetSize(size) +} + +// LoadImm emits `dst = (size)value`. +// +// As of kernel 4.20, only DWord size is accepted. +func LoadImm(dst Register, value int64, size Size) Instruction { + return Instruction{ + OpCode: LoadImmOp(size), + Dst: dst, + Constant: value, + } +} + +// LoadMapPtr stores a pointer to a map in dst. +func LoadMapPtr(dst Register, fd int) Instruction { + if fd < 0 { + return Instruction{OpCode: InvalidOpCode} + } + + return Instruction{ + OpCode: LoadImmOp(DWord), + Dst: dst, + Src: PseudoMapFD, + Constant: int64(uint32(fd)), + } +} + +// LoadMapValue stores a pointer to the value at a certain offset of a map. +func LoadMapValue(dst Register, fd int, offset uint32) Instruction { + if fd < 0 { + return Instruction{OpCode: InvalidOpCode} + } + + fdAndOffset := (uint64(offset) << 32) | uint64(uint32(fd)) + return Instruction{ + OpCode: LoadImmOp(DWord), + Dst: dst, + Src: PseudoMapValue, + Constant: int64(fdAndOffset), + } +} + +// LoadIndOp returns the OpCode for loading a value of given size from an sk_buff. +func LoadIndOp(size Size) OpCode { + return OpCode(LdClass).SetMode(IndMode).SetSize(size) +} + +// LoadInd emits `dst = ntoh(*(size *)(((sk_buff *)R6)->data + src + offset))`. +func LoadInd(dst, src Register, offset int32, size Size) Instruction { + return Instruction{ + OpCode: LoadIndOp(size), + Dst: dst, + Src: src, + Constant: int64(offset), + } +} + +// LoadAbsOp returns the OpCode for loading a value of given size from an sk_buff. +func LoadAbsOp(size Size) OpCode { + return OpCode(LdClass).SetMode(AbsMode).SetSize(size) +} + +// LoadAbs emits `r0 = ntoh(*(size *)(((sk_buff *)R6)->data + offset))`. +func LoadAbs(offset int32, size Size) Instruction { + return Instruction{ + OpCode: LoadAbsOp(size), + Dst: R0, + Constant: int64(offset), + } +} + +// StoreMemOp returns the OpCode for storing a register of given size in memory. +func StoreMemOp(size Size) OpCode { + return OpCode(StXClass).SetMode(MemMode).SetSize(size) +} + +// StoreMem emits `*(size *)(dst + offset) = src` +func StoreMem(dst Register, offset int16, src Register, size Size) Instruction { + return Instruction{ + OpCode: StoreMemOp(size), + Dst: dst, + Src: src, + Offset: offset, + } +} + +// StoreImmOp returns the OpCode for storing an immediate of given size in memory. +func StoreImmOp(size Size) OpCode { + return OpCode(StClass).SetMode(MemMode).SetSize(size) +} + +// StoreImm emits `*(size *)(dst + offset) = value`. +func StoreImm(dst Register, offset int16, value int64, size Size) Instruction { + return Instruction{ + OpCode: StoreImmOp(size), + Dst: dst, + Offset: offset, + Constant: value, + } +} + +// StoreXAddOp returns the OpCode to atomically add a register to a value in memory. +func StoreXAddOp(size Size) OpCode { + return OpCode(StXClass).SetMode(XAddMode).SetSize(size) +} + +// StoreXAdd atomically adds src to *dst. +func StoreXAdd(dst, src Register, size Size) Instruction { + return Instruction{ + OpCode: StoreXAddOp(size), + Dst: dst, + Src: src, + } +} diff --git a/vendor/github.com/cilium/ebpf/asm/load_store_string.go b/vendor/github.com/cilium/ebpf/asm/load_store_string.go new file mode 100644 index 0000000000..76d29a0756 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/load_store_string.go @@ -0,0 +1,80 @@ +// Code generated by "stringer -output load_store_string.go -type=Mode,Size"; DO NOT EDIT. + +package asm + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[InvalidMode-255] + _ = x[ImmMode-0] + _ = x[AbsMode-32] + _ = x[IndMode-64] + _ = x[MemMode-96] + _ = x[XAddMode-192] +} + +const ( + _Mode_name_0 = "ImmMode" + _Mode_name_1 = "AbsMode" + _Mode_name_2 = "IndMode" + _Mode_name_3 = "MemMode" + _Mode_name_4 = "XAddMode" + _Mode_name_5 = "InvalidMode" +) + +func (i Mode) String() string { + switch { + case i == 0: + return _Mode_name_0 + case i == 32: + return _Mode_name_1 + case i == 64: + return _Mode_name_2 + case i == 96: + return _Mode_name_3 + case i == 192: + return _Mode_name_4 + case i == 255: + return _Mode_name_5 + default: + return "Mode(" + strconv.FormatInt(int64(i), 10) + ")" + } +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[InvalidSize-255] + _ = x[DWord-24] + _ = x[Word-0] + _ = x[Half-8] + _ = x[Byte-16] +} + +const ( + _Size_name_0 = "Word" + _Size_name_1 = "Half" + _Size_name_2 = "Byte" + _Size_name_3 = "DWord" + _Size_name_4 = "InvalidSize" +) + +func (i Size) String() string { + switch { + case i == 0: + return _Size_name_0 + case i == 8: + return _Size_name_1 + case i == 16: + return _Size_name_2 + case i == 24: + return _Size_name_3 + case i == 255: + return _Size_name_4 + default: + return "Size(" + strconv.FormatInt(int64(i), 10) + ")" + } +} diff --git a/vendor/github.com/cilium/ebpf/asm/opcode.go b/vendor/github.com/cilium/ebpf/asm/opcode.go new file mode 100644 index 0000000000..6edc3cf591 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/opcode.go @@ -0,0 +1,237 @@ +package asm + +import ( + "fmt" + "strings" +) + +//go:generate stringer -output opcode_string.go -type=Class + +type encoding int + +const ( + unknownEncoding encoding = iota + loadOrStore + jumpOrALU +) + +// Class of operations +// +// msb lsb +// +---+--+---+ +// | ?? |CLS| +// +---+--+---+ +type Class uint8 + +const classMask OpCode = 0x07 + +const ( + // LdClass load memory + LdClass Class = 0x00 + // LdXClass load memory from constant + LdXClass Class = 0x01 + // StClass load register from memory + StClass Class = 0x02 + // StXClass load register from constant + StXClass Class = 0x03 + // ALUClass arithmetic operators + ALUClass Class = 0x04 + // JumpClass jump operators + JumpClass Class = 0x05 + // ALU64Class arithmetic in 64 bit mode + ALU64Class Class = 0x07 +) + +func (cls Class) encoding() encoding { + switch cls { + case LdClass, LdXClass, StClass, StXClass: + return loadOrStore + case ALU64Class, ALUClass, JumpClass: + return jumpOrALU + default: + return unknownEncoding + } +} + +// OpCode is a packed eBPF opcode. +// +// Its encoding is defined by a Class value: +// +// msb lsb +// +----+-+---+ +// | ???? |CLS| +// +----+-+---+ +type OpCode uint8 + +// InvalidOpCode is returned by setters on OpCode +const InvalidOpCode OpCode = 0xff + +// rawInstructions returns the number of BPF instructions required +// to encode this opcode. +func (op OpCode) rawInstructions() int { + if op.IsDWordLoad() { + return 2 + } + return 1 +} + +func (op OpCode) IsDWordLoad() bool { + return op == LoadImmOp(DWord) +} + +// Class returns the class of operation. +func (op OpCode) Class() Class { + return Class(op & classMask) +} + +// Mode returns the mode for load and store operations. +func (op OpCode) Mode() Mode { + if op.Class().encoding() != loadOrStore { + return InvalidMode + } + return Mode(op & modeMask) +} + +// Size returns the size for load and store operations. +func (op OpCode) Size() Size { + if op.Class().encoding() != loadOrStore { + return InvalidSize + } + return Size(op & sizeMask) +} + +// Source returns the source for branch and ALU operations. +func (op OpCode) Source() Source { + if op.Class().encoding() != jumpOrALU || op.ALUOp() == Swap { + return InvalidSource + } + return Source(op & sourceMask) +} + +// ALUOp returns the ALUOp. +func (op OpCode) ALUOp() ALUOp { + if op.Class().encoding() != jumpOrALU { + return InvalidALUOp + } + return ALUOp(op & aluMask) +} + +// Endianness returns the Endianness for a byte swap instruction. +func (op OpCode) Endianness() Endianness { + if op.ALUOp() != Swap { + return InvalidEndian + } + return Endianness(op & endianMask) +} + +// JumpOp returns the JumpOp. +func (op OpCode) JumpOp() JumpOp { + if op.Class().encoding() != jumpOrALU { + return InvalidJumpOp + } + return JumpOp(op & jumpMask) +} + +// SetMode sets the mode on load and store operations. +// +// Returns InvalidOpCode if op is of the wrong class. +func (op OpCode) SetMode(mode Mode) OpCode { + if op.Class().encoding() != loadOrStore || !valid(OpCode(mode), modeMask) { + return InvalidOpCode + } + return (op & ^modeMask) | OpCode(mode) +} + +// SetSize sets the size on load and store operations. +// +// Returns InvalidOpCode if op is of the wrong class. +func (op OpCode) SetSize(size Size) OpCode { + if op.Class().encoding() != loadOrStore || !valid(OpCode(size), sizeMask) { + return InvalidOpCode + } + return (op & ^sizeMask) | OpCode(size) +} + +// SetSource sets the source on jump and ALU operations. +// +// Returns InvalidOpCode if op is of the wrong class. +func (op OpCode) SetSource(source Source) OpCode { + if op.Class().encoding() != jumpOrALU || !valid(OpCode(source), sourceMask) { + return InvalidOpCode + } + return (op & ^sourceMask) | OpCode(source) +} + +// SetALUOp sets the ALUOp on ALU operations. +// +// Returns InvalidOpCode if op is of the wrong class. +func (op OpCode) SetALUOp(alu ALUOp) OpCode { + class := op.Class() + if (class != ALUClass && class != ALU64Class) || !valid(OpCode(alu), aluMask) { + return InvalidOpCode + } + return (op & ^aluMask) | OpCode(alu) +} + +// SetJumpOp sets the JumpOp on jump operations. +// +// Returns InvalidOpCode if op is of the wrong class. +func (op OpCode) SetJumpOp(jump JumpOp) OpCode { + if op.Class() != JumpClass || !valid(OpCode(jump), jumpMask) { + return InvalidOpCode + } + return (op & ^jumpMask) | OpCode(jump) +} + +func (op OpCode) String() string { + var f strings.Builder + + switch class := op.Class(); class { + case LdClass, LdXClass, StClass, StXClass: + f.WriteString(strings.TrimSuffix(class.String(), "Class")) + + mode := op.Mode() + f.WriteString(strings.TrimSuffix(mode.String(), "Mode")) + + switch op.Size() { + case DWord: + f.WriteString("DW") + case Word: + f.WriteString("W") + case Half: + f.WriteString("H") + case Byte: + f.WriteString("B") + } + + case ALU64Class, ALUClass: + f.WriteString(op.ALUOp().String()) + + if op.ALUOp() == Swap { + // Width for Endian is controlled by Constant + f.WriteString(op.Endianness().String()) + } else { + if class == ALUClass { + f.WriteString("32") + } + + f.WriteString(strings.TrimSuffix(op.Source().String(), "Source")) + } + + case JumpClass: + f.WriteString(op.JumpOp().String()) + if jop := op.JumpOp(); jop != Exit && jop != Call { + f.WriteString(strings.TrimSuffix(op.Source().String(), "Source")) + } + + default: + fmt.Fprintf(&f, "OpCode(%#x)", uint8(op)) + } + + return f.String() +} + +// valid returns true if all bits in value are covered by mask. +func valid(value, mask OpCode) bool { + return value & ^mask == 0 +} diff --git a/vendor/github.com/cilium/ebpf/asm/opcode_string.go b/vendor/github.com/cilium/ebpf/asm/opcode_string.go new file mode 100644 index 0000000000..079ce1db0b --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/opcode_string.go @@ -0,0 +1,38 @@ +// Code generated by "stringer -output opcode_string.go -type=Class"; DO NOT EDIT. + +package asm + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[LdClass-0] + _ = x[LdXClass-1] + _ = x[StClass-2] + _ = x[StXClass-3] + _ = x[ALUClass-4] + _ = x[JumpClass-5] + _ = x[ALU64Class-7] +} + +const ( + _Class_name_0 = "LdClassLdXClassStClassStXClassALUClassJumpClass" + _Class_name_1 = "ALU64Class" +) + +var ( + _Class_index_0 = [...]uint8{0, 7, 15, 22, 30, 38, 47} +) + +func (i Class) String() string { + switch { + case 0 <= i && i <= 5: + return _Class_name_0[_Class_index_0[i]:_Class_index_0[i+1]] + case i == 7: + return _Class_name_1 + default: + return "Class(" + strconv.FormatInt(int64(i), 10) + ")" + } +} diff --git a/vendor/github.com/cilium/ebpf/asm/register.go b/vendor/github.com/cilium/ebpf/asm/register.go new file mode 100644 index 0000000000..76cb44bffc --- /dev/null +++ b/vendor/github.com/cilium/ebpf/asm/register.go @@ -0,0 +1,49 @@ +package asm + +import ( + "fmt" +) + +// Register is the source or destination of most operations. +type Register uint8 + +// R0 contains return values. +const R0 Register = 0 + +// Registers for function arguments. +const ( + R1 Register = R0 + 1 + iota + R2 + R3 + R4 + R5 +) + +// Callee saved registers preserved by function calls. +const ( + R6 Register = R5 + 1 + iota + R7 + R8 + R9 +) + +// Read-only frame pointer to access stack. +const ( + R10 Register = R9 + 1 + RFP = R10 +) + +// Pseudo registers used by 64bit loads and jumps +const ( + PseudoMapFD = R1 // BPF_PSEUDO_MAP_FD + PseudoMapValue = R2 // BPF_PSEUDO_MAP_VALUE + PseudoCall = R1 // BPF_PSEUDO_CALL +) + +func (r Register) String() string { + v := uint8(r) + if v == 10 { + return "rfp" + } + return fmt.Sprintf("r%d", v) +} diff --git a/vendor/github.com/cilium/ebpf/attachtype_string.go b/vendor/github.com/cilium/ebpf/attachtype_string.go new file mode 100644 index 0000000000..de355ed909 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/attachtype_string.go @@ -0,0 +1,65 @@ +// Code generated by "stringer -type AttachType -trimprefix Attach"; DO NOT EDIT. + +package ebpf + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[AttachNone-0] + _ = x[AttachCGroupInetIngress-0] + _ = x[AttachCGroupInetEgress-1] + _ = x[AttachCGroupInetSockCreate-2] + _ = x[AttachCGroupSockOps-3] + _ = x[AttachSkSKBStreamParser-4] + _ = x[AttachSkSKBStreamVerdict-5] + _ = x[AttachCGroupDevice-6] + _ = x[AttachSkMsgVerdict-7] + _ = x[AttachCGroupInet4Bind-8] + _ = x[AttachCGroupInet6Bind-9] + _ = x[AttachCGroupInet4Connect-10] + _ = x[AttachCGroupInet6Connect-11] + _ = x[AttachCGroupInet4PostBind-12] + _ = x[AttachCGroupInet6PostBind-13] + _ = x[AttachCGroupUDP4Sendmsg-14] + _ = x[AttachCGroupUDP6Sendmsg-15] + _ = x[AttachLircMode2-16] + _ = x[AttachFlowDissector-17] + _ = x[AttachCGroupSysctl-18] + _ = x[AttachCGroupUDP4Recvmsg-19] + _ = x[AttachCGroupUDP6Recvmsg-20] + _ = x[AttachCGroupGetsockopt-21] + _ = x[AttachCGroupSetsockopt-22] + _ = x[AttachTraceRawTp-23] + _ = x[AttachTraceFEntry-24] + _ = x[AttachTraceFExit-25] + _ = x[AttachModifyReturn-26] + _ = x[AttachLSMMac-27] + _ = x[AttachTraceIter-28] + _ = x[AttachCgroupInet4GetPeername-29] + _ = x[AttachCgroupInet6GetPeername-30] + _ = x[AttachCgroupInet4GetSockname-31] + _ = x[AttachCgroupInet6GetSockname-32] + _ = x[AttachXDPDevMap-33] + _ = x[AttachCgroupInetSockRelease-34] + _ = x[AttachXDPCPUMap-35] + _ = x[AttachSkLookup-36] + _ = x[AttachXDP-37] + _ = x[AttachSkSKBVerdict-38] + _ = x[AttachSkReuseportSelect-39] + _ = x[AttachSkReuseportSelectOrMigrate-40] + _ = x[AttachPerfEvent-41] +} + +const _AttachType_name = "NoneCGroupInetEgressCGroupInetSockCreateCGroupSockOpsSkSKBStreamParserSkSKBStreamVerdictCGroupDeviceSkMsgVerdictCGroupInet4BindCGroupInet6BindCGroupInet4ConnectCGroupInet6ConnectCGroupInet4PostBindCGroupInet6PostBindCGroupUDP4SendmsgCGroupUDP6SendmsgLircMode2FlowDissectorCGroupSysctlCGroupUDP4RecvmsgCGroupUDP6RecvmsgCGroupGetsockoptCGroupSetsockoptTraceRawTpTraceFEntryTraceFExitModifyReturnLSMMacTraceIterCgroupInet4GetPeernameCgroupInet6GetPeernameCgroupInet4GetSocknameCgroupInet6GetSocknameXDPDevMapCgroupInetSockReleaseXDPCPUMapSkLookupXDPSkSKBVerdictSkReuseportSelectSkReuseportSelectOrMigratePerfEvent" + +var _AttachType_index = [...]uint16{0, 4, 20, 40, 53, 70, 88, 100, 112, 127, 142, 160, 178, 197, 216, 233, 250, 259, 272, 284, 301, 318, 334, 350, 360, 371, 381, 393, 399, 408, 430, 452, 474, 496, 505, 526, 535, 543, 546, 558, 575, 601, 610} + +func (i AttachType) String() string { + if i >= AttachType(len(_AttachType_index)-1) { + return "AttachType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _AttachType_name[_AttachType_index[i]:_AttachType_index[i+1]] +} diff --git a/vendor/github.com/cilium/ebpf/collection.go b/vendor/github.com/cilium/ebpf/collection.go new file mode 100644 index 0000000000..2ededc87a0 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/collection.go @@ -0,0 +1,668 @@ +package ebpf + +import ( + "encoding/binary" + "errors" + "fmt" + "io" + "math" + "reflect" + "strings" + + "github.com/cilium/ebpf/asm" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/btf" +) + +// CollectionOptions control loading a collection into the kernel. +// +// Maps and Programs are passed to NewMapWithOptions and NewProgramsWithOptions. +type CollectionOptions struct { + Maps MapOptions + Programs ProgramOptions +} + +// CollectionSpec describes a collection. +type CollectionSpec struct { + Maps map[string]*MapSpec + Programs map[string]*ProgramSpec + + // ByteOrder specifies whether the ELF was compiled for + // big-endian or little-endian architectures. + ByteOrder binary.ByteOrder +} + +// Copy returns a recursive copy of the spec. +func (cs *CollectionSpec) Copy() *CollectionSpec { + if cs == nil { + return nil + } + + cpy := CollectionSpec{ + Maps: make(map[string]*MapSpec, len(cs.Maps)), + Programs: make(map[string]*ProgramSpec, len(cs.Programs)), + ByteOrder: cs.ByteOrder, + } + + for name, spec := range cs.Maps { + cpy.Maps[name] = spec.Copy() + } + + for name, spec := range cs.Programs { + cpy.Programs[name] = spec.Copy() + } + + return &cpy +} + +// RewriteMaps replaces all references to specific maps. +// +// Use this function to use pre-existing maps instead of creating new ones +// when calling NewCollection. Any named maps are removed from CollectionSpec.Maps. +// +// Returns an error if a named map isn't used in at least one program. +func (cs *CollectionSpec) RewriteMaps(maps map[string]*Map) error { + for symbol, m := range maps { + // have we seen a program that uses this symbol / map + seen := false + fd := m.FD() + for progName, progSpec := range cs.Programs { + err := progSpec.Instructions.RewriteMapPtr(symbol, fd) + + switch { + case err == nil: + seen = true + + case asm.IsUnreferencedSymbol(err): + // Not all programs need to use the map + + default: + return fmt.Errorf("program %s: %w", progName, err) + } + } + + if !seen { + return fmt.Errorf("map %s not referenced by any programs", symbol) + } + + // Prevent NewCollection from creating rewritten maps + delete(cs.Maps, symbol) + } + + return nil +} + +// RewriteConstants replaces the value of multiple constants. +// +// The constant must be defined like so in the C program: +// +// volatile const type foobar; +// volatile const type foobar = default; +// +// Replacement values must be of the same length as the C sizeof(type). +// If necessary, they are marshalled according to the same rules as +// map values. +// +// From Linux 5.5 the verifier will use constants to eliminate dead code. +// +// Returns an error if a constant doesn't exist. +func (cs *CollectionSpec) RewriteConstants(consts map[string]interface{}) error { + rodata := cs.Maps[".rodata"] + if rodata == nil { + return errors.New("missing .rodata section") + } + + if rodata.BTF == nil { + return errors.New(".rodata section has no BTF") + } + + if n := len(rodata.Contents); n != 1 { + return fmt.Errorf("expected one key in .rodata, found %d", n) + } + + kv := rodata.Contents[0] + value, ok := kv.Value.([]byte) + if !ok { + return fmt.Errorf("first value in .rodata is %T not []byte", kv.Value) + } + + buf := make([]byte, len(value)) + copy(buf, value) + + err := patchValue(buf, rodata.BTF.Value, consts) + if err != nil { + return err + } + + rodata.Contents[0] = MapKV{kv.Key, buf} + return nil +} + +// Assign the contents of a CollectionSpec to a struct. +// +// This function is a shortcut to manually checking the presence +// of maps and programs in a CollectionSpec. Consider using bpf2go +// if this sounds useful. +// +// 'to' must be a pointer to a struct. A field of the +// struct is updated with values from Programs or Maps if it +// has an `ebpf` tag and its type is *ProgramSpec or *MapSpec. +// The tag's value specifies the name of the program or map as +// found in the CollectionSpec. +// +// struct { +// Foo *ebpf.ProgramSpec `ebpf:"xdp_foo"` +// Bar *ebpf.MapSpec `ebpf:"bar_map"` +// Ignored int +// } +// +// Returns an error if any of the eBPF objects can't be found, or +// if the same MapSpec or ProgramSpec is assigned multiple times. +func (cs *CollectionSpec) Assign(to interface{}) error { + // Assign() only supports assigning ProgramSpecs and MapSpecs, + // so doesn't load any resources into the kernel. + getValue := func(typ reflect.Type, name string) (interface{}, error) { + switch typ { + + case reflect.TypeOf((*ProgramSpec)(nil)): + if p := cs.Programs[name]; p != nil { + return p, nil + } + return nil, fmt.Errorf("missing program %q", name) + + case reflect.TypeOf((*MapSpec)(nil)): + if m := cs.Maps[name]; m != nil { + return m, nil + } + return nil, fmt.Errorf("missing map %q", name) + + default: + return nil, fmt.Errorf("unsupported type %s", typ) + } + } + + return assignValues(to, getValue) +} + +// LoadAndAssign loads Maps and Programs into the kernel and assigns them +// to a struct. +// +// This function is a shortcut to manually checking the presence +// of maps and programs in a CollectionSpec. Consider using bpf2go +// if this sounds useful. +// +// 'to' must be a pointer to a struct. A field of the struct is updated with +// a Program or Map if it has an `ebpf` tag and its type is *Program or *Map. +// The tag's value specifies the name of the program or map as found in the +// CollectionSpec. Before updating the struct, the requested objects and their +// dependent resources are loaded into the kernel and populated with values if +// specified. +// +// struct { +// Foo *ebpf.Program `ebpf:"xdp_foo"` +// Bar *ebpf.Map `ebpf:"bar_map"` +// Ignored int +// } +// +// opts may be nil. +// +// Returns an error if any of the fields can't be found, or +// if the same Map or Program is assigned multiple times. +func (cs *CollectionSpec) LoadAndAssign(to interface{}, opts *CollectionOptions) error { + loader := newCollectionLoader(cs, opts) + defer loader.cleanup() + + // Support assigning Programs and Maps, lazy-loading the required objects. + assignedMaps := make(map[string]bool) + getValue := func(typ reflect.Type, name string) (interface{}, error) { + switch typ { + + case reflect.TypeOf((*Program)(nil)): + return loader.loadProgram(name) + + case reflect.TypeOf((*Map)(nil)): + assignedMaps[name] = true + return loader.loadMap(name) + + default: + return nil, fmt.Errorf("unsupported type %s", typ) + } + } + + // Load the Maps and Programs requested by the annotated struct. + if err := assignValues(to, getValue); err != nil { + return err + } + + // Populate the requested maps. Has a chance of lazy-loading other dependent maps. + if err := loader.populateMaps(); err != nil { + return err + } + + // Evaluate the loader's objects after all (lazy)loading has taken place. + for n, m := range loader.maps { + switch m.typ { + case ProgramArray: + // Require all lazy-loaded ProgramArrays to be assigned to the given object. + // Without any references, they will be closed on the first GC and all tail + // calls into them will miss. + if !assignedMaps[n] { + return fmt.Errorf("ProgramArray %s must be assigned to prevent missed tail calls", n) + } + } + } + + loader.finalize() + + return nil +} + +// Collection is a collection of Programs and Maps associated +// with their symbols +type Collection struct { + Programs map[string]*Program + Maps map[string]*Map +} + +// NewCollection creates a Collection from a specification. +func NewCollection(spec *CollectionSpec) (*Collection, error) { + return NewCollectionWithOptions(spec, CollectionOptions{}) +} + +// NewCollectionWithOptions creates a Collection from a specification. +func NewCollectionWithOptions(spec *CollectionSpec, opts CollectionOptions) (*Collection, error) { + loader := newCollectionLoader(spec, &opts) + defer loader.cleanup() + + // Create maps first, as their fds need to be linked into programs. + for mapName := range spec.Maps { + if _, err := loader.loadMap(mapName); err != nil { + return nil, err + } + } + + for progName := range spec.Programs { + if _, err := loader.loadProgram(progName); err != nil { + return nil, err + } + } + + // Maps can contain Program and Map stubs, so populate them after + // all Maps and Programs have been successfully loaded. + if err := loader.populateMaps(); err != nil { + return nil, err + } + + maps, progs := loader.maps, loader.programs + + loader.finalize() + + return &Collection{ + progs, + maps, + }, nil +} + +type handleCache struct { + btfHandles map[*btf.Spec]*btf.Handle + btfSpecs map[io.ReaderAt]*btf.Spec +} + +func newHandleCache() *handleCache { + return &handleCache{ + btfHandles: make(map[*btf.Spec]*btf.Handle), + btfSpecs: make(map[io.ReaderAt]*btf.Spec), + } +} + +func (hc handleCache) btfHandle(spec *btf.Spec) (*btf.Handle, error) { + if hc.btfHandles[spec] != nil { + return hc.btfHandles[spec], nil + } + + handle, err := btf.NewHandle(spec) + if err != nil { + return nil, err + } + + hc.btfHandles[spec] = handle + return handle, nil +} + +func (hc handleCache) btfSpec(rd io.ReaderAt) (*btf.Spec, error) { + if hc.btfSpecs[rd] != nil { + return hc.btfSpecs[rd], nil + } + + spec, err := btf.LoadSpecFromReader(rd) + if err != nil { + return nil, err + } + + hc.btfSpecs[rd] = spec + return spec, nil +} + +func (hc handleCache) close() { + for _, handle := range hc.btfHandles { + handle.Close() + } +} + +type collectionLoader struct { + coll *CollectionSpec + opts *CollectionOptions + maps map[string]*Map + programs map[string]*Program + handles *handleCache +} + +func newCollectionLoader(coll *CollectionSpec, opts *CollectionOptions) *collectionLoader { + if opts == nil { + opts = &CollectionOptions{} + } + + return &collectionLoader{ + coll, + opts, + make(map[string]*Map), + make(map[string]*Program), + newHandleCache(), + } +} + +// finalize should be called when all the collectionLoader's resources +// have been successfully loaded into the kernel and populated with values. +func (cl *collectionLoader) finalize() { + cl.maps, cl.programs = nil, nil +} + +// cleanup cleans up all resources left over in the collectionLoader. +// Call finalize() when Map and Program creation/population is successful +// to prevent them from getting closed. +func (cl *collectionLoader) cleanup() { + cl.handles.close() + for _, m := range cl.maps { + m.Close() + } + for _, p := range cl.programs { + p.Close() + } +} + +func (cl *collectionLoader) loadMap(mapName string) (*Map, error) { + if m := cl.maps[mapName]; m != nil { + return m, nil + } + + mapSpec := cl.coll.Maps[mapName] + if mapSpec == nil { + return nil, fmt.Errorf("missing map %s", mapName) + } + + m, err := newMapWithOptions(mapSpec, cl.opts.Maps, cl.handles) + if err != nil { + return nil, fmt.Errorf("map %s: %w", mapName, err) + } + + cl.maps[mapName] = m + return m, nil +} + +func (cl *collectionLoader) loadProgram(progName string) (*Program, error) { + if prog := cl.programs[progName]; prog != nil { + return prog, nil + } + + progSpec := cl.coll.Programs[progName] + if progSpec == nil { + return nil, fmt.Errorf("unknown program %s", progName) + } + + progSpec = progSpec.Copy() + + // Rewrite any reference to a valid map. + for i := range progSpec.Instructions { + ins := &progSpec.Instructions[i] + + if !ins.IsLoadFromMap() || ins.Reference == "" { + continue + } + + if uint32(ins.Constant) != math.MaxUint32 { + // Don't overwrite maps already rewritten, users can + // rewrite programs in the spec themselves + continue + } + + m, err := cl.loadMap(ins.Reference) + if err != nil { + return nil, fmt.Errorf("program %s: %w", progName, err) + } + + fd := m.FD() + if fd < 0 { + return nil, fmt.Errorf("map %s: %w", ins.Reference, internal.ErrClosedFd) + } + if err := ins.RewriteMapPtr(m.FD()); err != nil { + return nil, fmt.Errorf("program %s: map %s: %w", progName, ins.Reference, err) + } + } + + prog, err := newProgramWithOptions(progSpec, cl.opts.Programs, cl.handles) + if err != nil { + return nil, fmt.Errorf("program %s: %w", progName, err) + } + + cl.programs[progName] = prog + return prog, nil +} + +func (cl *collectionLoader) populateMaps() error { + for mapName, m := range cl.maps { + mapSpec, ok := cl.coll.Maps[mapName] + if !ok { + return fmt.Errorf("missing map spec %s", mapName) + } + + mapSpec = mapSpec.Copy() + + // Replace any object stubs with loaded objects. + for i, kv := range mapSpec.Contents { + switch v := kv.Value.(type) { + case programStub: + // loadProgram is idempotent and could return an existing Program. + prog, err := cl.loadProgram(string(v)) + if err != nil { + return fmt.Errorf("loading program %s, for map %s: %w", v, mapName, err) + } + mapSpec.Contents[i] = MapKV{kv.Key, prog} + + case mapStub: + // loadMap is idempotent and could return an existing Map. + innerMap, err := cl.loadMap(string(v)) + if err != nil { + return fmt.Errorf("loading inner map %s, for map %s: %w", v, mapName, err) + } + mapSpec.Contents[i] = MapKV{kv.Key, innerMap} + } + } + + // Populate and freeze the map if specified. + if err := m.finalize(mapSpec); err != nil { + return fmt.Errorf("populating map %s: %w", mapName, err) + } + } + + return nil +} + +// LoadCollection parses an object file and converts it to a collection. +func LoadCollection(file string) (*Collection, error) { + spec, err := LoadCollectionSpec(file) + if err != nil { + return nil, err + } + return NewCollection(spec) +} + +// Close frees all maps and programs associated with the collection. +// +// The collection mustn't be used afterwards. +func (coll *Collection) Close() { + for _, prog := range coll.Programs { + prog.Close() + } + for _, m := range coll.Maps { + m.Close() + } +} + +// DetachMap removes the named map from the Collection. +// +// This means that a later call to Close() will not affect this map. +// +// Returns nil if no map of that name exists. +func (coll *Collection) DetachMap(name string) *Map { + m := coll.Maps[name] + delete(coll.Maps, name) + return m +} + +// DetachProgram removes the named program from the Collection. +// +// This means that a later call to Close() will not affect this program. +// +// Returns nil if no program of that name exists. +func (coll *Collection) DetachProgram(name string) *Program { + p := coll.Programs[name] + delete(coll.Programs, name) + return p +} + +// structField represents a struct field containing the ebpf struct tag. +type structField struct { + reflect.StructField + value reflect.Value +} + +// ebpfFields extracts field names tagged with 'ebpf' from a struct type. +// Keep track of visited types to avoid infinite recursion. +func ebpfFields(structVal reflect.Value, visited map[reflect.Type]bool) ([]structField, error) { + if visited == nil { + visited = make(map[reflect.Type]bool) + } + + structType := structVal.Type() + if structType.Kind() != reflect.Struct { + return nil, fmt.Errorf("%s is not a struct", structType) + } + + if visited[structType] { + return nil, fmt.Errorf("recursion on type %s", structType) + } + + fields := make([]structField, 0, structType.NumField()) + for i := 0; i < structType.NumField(); i++ { + field := structField{structType.Field(i), structVal.Field(i)} + + // If the field is tagged, gather it and move on. + name := field.Tag.Get("ebpf") + if name != "" { + fields = append(fields, field) + continue + } + + // If the field does not have an ebpf tag, but is a struct or a pointer + // to a struct, attempt to gather its fields as well. + var v reflect.Value + switch field.Type.Kind() { + case reflect.Ptr: + if field.Type.Elem().Kind() != reflect.Struct { + continue + } + + if field.value.IsNil() { + return nil, fmt.Errorf("nil pointer to %s", structType) + } + + // Obtain the destination type of the pointer. + v = field.value.Elem() + + case reflect.Struct: + // Reference the value's type directly. + v = field.value + + default: + continue + } + + inner, err := ebpfFields(v, visited) + if err != nil { + return nil, fmt.Errorf("field %s: %w", field.Name, err) + } + + fields = append(fields, inner...) + } + + return fields, nil +} + +// assignValues attempts to populate all fields of 'to' tagged with 'ebpf'. +// +// getValue is called for every tagged field of 'to' and must return the value +// to be assigned to the field with the given typ and name. +func assignValues(to interface{}, + getValue func(typ reflect.Type, name string) (interface{}, error)) error { + + toValue := reflect.ValueOf(to) + if toValue.Type().Kind() != reflect.Ptr { + return fmt.Errorf("%T is not a pointer to struct", to) + } + + if toValue.IsNil() { + return fmt.Errorf("nil pointer to %T", to) + } + + fields, err := ebpfFields(toValue.Elem(), nil) + if err != nil { + return err + } + + type elem struct { + // Either *Map or *Program + typ reflect.Type + name string + } + + assigned := make(map[elem]string) + for _, field := range fields { + // Get string value the field is tagged with. + tag := field.Tag.Get("ebpf") + if strings.Contains(tag, ",") { + return fmt.Errorf("field %s: ebpf tag contains a comma", field.Name) + } + + // Check if the eBPF object with the requested + // type and tag was already assigned elsewhere. + e := elem{field.Type, tag} + if af := assigned[e]; af != "" { + return fmt.Errorf("field %s: object %q was already assigned to %s", field.Name, tag, af) + } + + // Get the eBPF object referred to by the tag. + value, err := getValue(field.Type, tag) + if err != nil { + return fmt.Errorf("field %s: %w", field.Name, err) + } + + if !field.value.CanSet() { + return fmt.Errorf("field %s: can't set value", field.Name) + } + field.value.Set(reflect.ValueOf(value)) + + assigned[e] = field.Name + } + + return nil +} diff --git a/vendor/github.com/cilium/ebpf/doc.go b/vendor/github.com/cilium/ebpf/doc.go new file mode 100644 index 0000000000..f7f34da8f4 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/doc.go @@ -0,0 +1,16 @@ +// Package ebpf is a toolkit for working with eBPF programs. +// +// eBPF programs are small snippets of code which are executed directly +// in a VM in the Linux kernel, which makes them very fast and flexible. +// Many Linux subsystems now accept eBPF programs. This makes it possible +// to implement highly application specific logic inside the kernel, +// without having to modify the actual kernel itself. +// +// This package is designed for long-running processes which +// want to use eBPF to implement part of their application logic. It has no +// run-time dependencies outside of the library and the Linux kernel itself. +// eBPF code should be compiled ahead of time using clang, and shipped with +// your application as any other resource. +// +// Use the link subpackage to attach a loaded program to a hook in the kernel. +package ebpf diff --git a/vendor/github.com/cilium/ebpf/elf_reader.go b/vendor/github.com/cilium/ebpf/elf_reader.go new file mode 100644 index 0000000000..42010f43e5 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/elf_reader.go @@ -0,0 +1,1077 @@ +package ebpf + +import ( + "bufio" + "bytes" + "debug/elf" + "encoding/binary" + "errors" + "fmt" + "io" + "math" + "os" + "strings" + + "github.com/cilium/ebpf/asm" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/btf" + "github.com/cilium/ebpf/internal/unix" +) + +// elfCode is a convenience to reduce the amount of arguments that have to +// be passed around explicitly. You should treat its contents as immutable. +type elfCode struct { + *internal.SafeELFFile + sections map[elf.SectionIndex]*elfSection + license string + version uint32 + btf *btf.Spec +} + +// LoadCollectionSpec parses an ELF file into a CollectionSpec. +func LoadCollectionSpec(file string) (*CollectionSpec, error) { + f, err := os.Open(file) + if err != nil { + return nil, err + } + defer f.Close() + + spec, err := LoadCollectionSpecFromReader(f) + if err != nil { + return nil, fmt.Errorf("file %s: %w", file, err) + } + return spec, nil +} + +// LoadCollectionSpecFromReader parses an ELF file into a CollectionSpec. +func LoadCollectionSpecFromReader(rd io.ReaderAt) (*CollectionSpec, error) { + f, err := internal.NewSafeELFFile(rd) + if err != nil { + return nil, err + } + defer f.Close() + + var ( + licenseSection *elf.Section + versionSection *elf.Section + sections = make(map[elf.SectionIndex]*elfSection) + relSections = make(map[elf.SectionIndex]*elf.Section) + ) + + // This is the target of relocations generated by inline assembly. + sections[elf.SHN_UNDEF] = newElfSection(new(elf.Section), undefSection) + + // Collect all the sections we're interested in. This includes relocations + // which we parse later. + for i, sec := range f.Sections { + idx := elf.SectionIndex(i) + + switch { + case strings.HasPrefix(sec.Name, "license"): + licenseSection = sec + case strings.HasPrefix(sec.Name, "version"): + versionSection = sec + case strings.HasPrefix(sec.Name, "maps"): + sections[idx] = newElfSection(sec, mapSection) + case sec.Name == ".maps": + sections[idx] = newElfSection(sec, btfMapSection) + case sec.Name == ".bss" || sec.Name == ".data" || strings.HasPrefix(sec.Name, ".rodata"): + sections[idx] = newElfSection(sec, dataSection) + case sec.Type == elf.SHT_REL: + // Store relocations under the section index of the target + relSections[elf.SectionIndex(sec.Info)] = sec + case sec.Type == elf.SHT_PROGBITS && (sec.Flags&elf.SHF_EXECINSTR) != 0 && sec.Size > 0: + sections[idx] = newElfSection(sec, programSection) + } + } + + license, err := loadLicense(licenseSection) + if err != nil { + return nil, fmt.Errorf("load license: %w", err) + } + + version, err := loadVersion(versionSection, f.ByteOrder) + if err != nil { + return nil, fmt.Errorf("load version: %w", err) + } + + btfSpec, err := btf.LoadSpecFromReader(rd) + if err != nil && !errors.Is(err, btf.ErrNotFound) { + return nil, fmt.Errorf("load BTF: %w", err) + } + + // Assign symbols to all the sections we're interested in. + symbols, err := f.Symbols() + if err != nil { + return nil, fmt.Errorf("load symbols: %v", err) + } + + for _, symbol := range symbols { + idx := symbol.Section + symType := elf.ST_TYPE(symbol.Info) + + section := sections[idx] + if section == nil { + continue + } + + // Older versions of LLVM don't tag symbols correctly, so keep + // all NOTYPE ones. + keep := symType == elf.STT_NOTYPE + switch section.kind { + case mapSection, btfMapSection, dataSection: + keep = keep || symType == elf.STT_OBJECT + case programSection: + keep = keep || symType == elf.STT_FUNC + } + if !keep || symbol.Name == "" { + continue + } + + section.symbols[symbol.Value] = symbol + } + + ec := &elfCode{ + SafeELFFile: f, + sections: sections, + license: license, + version: version, + btf: btfSpec, + } + + // Go through relocation sections, and parse the ones for sections we're + // interested in. Make sure that relocations point at valid sections. + for idx, relSection := range relSections { + section := sections[idx] + if section == nil { + continue + } + + rels, err := ec.loadRelocations(relSection, symbols) + if err != nil { + return nil, fmt.Errorf("relocation for section %q: %w", section.Name, err) + } + + for _, rel := range rels { + target := sections[rel.Section] + if target == nil { + return nil, fmt.Errorf("section %q: reference to %q in section %s: %w", section.Name, rel.Name, rel.Section, ErrNotSupported) + } + + if target.Flags&elf.SHF_STRINGS > 0 { + return nil, fmt.Errorf("section %q: string is not stack allocated: %w", section.Name, ErrNotSupported) + } + + target.references++ + } + + section.relocations = rels + } + + // Collect all the various ways to define maps. + maps := make(map[string]*MapSpec) + if err := ec.loadMaps(maps); err != nil { + return nil, fmt.Errorf("load maps: %w", err) + } + + if err := ec.loadBTFMaps(maps); err != nil { + return nil, fmt.Errorf("load BTF maps: %w", err) + } + + if err := ec.loadDataSections(maps); err != nil { + return nil, fmt.Errorf("load data sections: %w", err) + } + + // Finally, collect programs and link them. + progs, err := ec.loadPrograms() + if err != nil { + return nil, fmt.Errorf("load programs: %w", err) + } + + return &CollectionSpec{maps, progs, ec.ByteOrder}, nil +} + +func loadLicense(sec *elf.Section) (string, error) { + if sec == nil { + return "", nil + } + + data, err := sec.Data() + if err != nil { + return "", fmt.Errorf("section %s: %v", sec.Name, err) + } + return string(bytes.TrimRight(data, "\000")), nil +} + +func loadVersion(sec *elf.Section, bo binary.ByteOrder) (uint32, error) { + if sec == nil { + return 0, nil + } + + var version uint32 + if err := binary.Read(sec.Open(), bo, &version); err != nil { + return 0, fmt.Errorf("section %s: %v", sec.Name, err) + } + return version, nil +} + +type elfSectionKind int + +const ( + undefSection elfSectionKind = iota + mapSection + btfMapSection + programSection + dataSection +) + +type elfSection struct { + *elf.Section + kind elfSectionKind + // Offset from the start of the section to a symbol + symbols map[uint64]elf.Symbol + // Offset from the start of the section to a relocation, which points at + // a symbol in another section. + relocations map[uint64]elf.Symbol + // The number of relocations pointing at this section. + references int +} + +func newElfSection(section *elf.Section, kind elfSectionKind) *elfSection { + return &elfSection{ + section, + kind, + make(map[uint64]elf.Symbol), + make(map[uint64]elf.Symbol), + 0, + } +} + +func (ec *elfCode) loadPrograms() (map[string]*ProgramSpec, error) { + var ( + progs []*ProgramSpec + libs []*ProgramSpec + ) + + for _, sec := range ec.sections { + if sec.kind != programSection { + continue + } + + if len(sec.symbols) == 0 { + return nil, fmt.Errorf("section %v: missing symbols", sec.Name) + } + + funcSym, ok := sec.symbols[0] + if !ok { + return nil, fmt.Errorf("section %v: no label at start", sec.Name) + } + + insns, length, err := ec.loadInstructions(sec) + if err != nil { + return nil, fmt.Errorf("program %s: %w", funcSym.Name, err) + } + + progType, attachType, progFlags, attachTo := getProgType(sec.Name) + + spec := &ProgramSpec{ + Name: funcSym.Name, + Type: progType, + Flags: progFlags, + AttachType: attachType, + AttachTo: attachTo, + License: ec.license, + KernelVersion: ec.version, + Instructions: insns, + ByteOrder: ec.ByteOrder, + } + + if ec.btf != nil { + spec.BTF, err = ec.btf.Program(sec.Name, length) + if err != nil && !errors.Is(err, btf.ErrNoExtendedInfo) { + return nil, fmt.Errorf("program %s: %w", funcSym.Name, err) + } + } + + if spec.Type == UnspecifiedProgram { + // There is no single name we can use for "library" sections, + // since they may contain multiple functions. We'll decode the + // labels they contain later on, and then link sections that way. + libs = append(libs, spec) + } else { + progs = append(progs, spec) + } + } + + res := make(map[string]*ProgramSpec, len(progs)) + for _, prog := range progs { + err := link(prog, libs) + if err != nil { + return nil, fmt.Errorf("program %s: %w", prog.Name, err) + } + res[prog.Name] = prog + } + + return res, nil +} + +func (ec *elfCode) loadInstructions(section *elfSection) (asm.Instructions, uint64, error) { + var ( + r = bufio.NewReader(section.Open()) + insns asm.Instructions + offset uint64 + ) + for { + var ins asm.Instruction + n, err := ins.Unmarshal(r, ec.ByteOrder) + if err == io.EOF { + return insns, offset, nil + } + if err != nil { + return nil, 0, fmt.Errorf("offset %d: %w", offset, err) + } + + ins.Symbol = section.symbols[offset].Name + + if rel, ok := section.relocations[offset]; ok { + if err = ec.relocateInstruction(&ins, rel); err != nil { + return nil, 0, fmt.Errorf("offset %d: relocate instruction: %w", offset, err) + } + } + + insns = append(insns, ins) + offset += n + } +} + +func (ec *elfCode) relocateInstruction(ins *asm.Instruction, rel elf.Symbol) error { + var ( + typ = elf.ST_TYPE(rel.Info) + bind = elf.ST_BIND(rel.Info) + name = rel.Name + ) + + target := ec.sections[rel.Section] + + switch target.kind { + case mapSection, btfMapSection: + if bind != elf.STB_GLOBAL { + return fmt.Errorf("possible erroneous static qualifier on map definition: found reference to %q", name) + } + + if typ != elf.STT_OBJECT && typ != elf.STT_NOTYPE { + // STT_NOTYPE is generated on clang < 8 which doesn't tag + // relocations appropriately. + return fmt.Errorf("map load: incorrect relocation type %v", typ) + } + + ins.Src = asm.PseudoMapFD + + // Mark the instruction as needing an update when creating the + // collection. + if err := ins.RewriteMapPtr(-1); err != nil { + return err + } + + case dataSection: + var offset uint32 + switch typ { + case elf.STT_SECTION: + if bind != elf.STB_LOCAL { + return fmt.Errorf("direct load: %s: unsupported relocation %s", name, bind) + } + + // This is really a reference to a static symbol, which clang doesn't + // emit a symbol table entry for. Instead it encodes the offset in + // the instruction itself. + offset = uint32(uint64(ins.Constant)) + + case elf.STT_OBJECT: + if bind != elf.STB_GLOBAL { + return fmt.Errorf("direct load: %s: unsupported relocation %s", name, bind) + } + + offset = uint32(rel.Value) + + default: + return fmt.Errorf("incorrect relocation type %v for direct map load", typ) + } + + // We rely on using the name of the data section as the reference. It + // would be nicer to keep the real name in case of an STT_OBJECT, but + // it's not clear how to encode that into Instruction. + name = target.Name + + // The kernel expects the offset in the second basic BPF instruction. + ins.Constant = int64(uint64(offset) << 32) + ins.Src = asm.PseudoMapValue + + // Mark the instruction as needing an update when creating the + // collection. + if err := ins.RewriteMapPtr(-1); err != nil { + return err + } + + case programSection: + if ins.OpCode.JumpOp() != asm.Call { + return fmt.Errorf("not a call instruction: %s", ins) + } + + if ins.Src != asm.PseudoCall { + return fmt.Errorf("call: %s: incorrect source register", name) + } + + switch typ { + case elf.STT_NOTYPE, elf.STT_FUNC: + if bind != elf.STB_GLOBAL { + return fmt.Errorf("call: %s: unsupported binding: %s", name, bind) + } + + case elf.STT_SECTION: + if bind != elf.STB_LOCAL { + return fmt.Errorf("call: %s: unsupported binding: %s", name, bind) + } + + // The function we want to call is in the indicated section, + // at the offset encoded in the instruction itself. Reverse + // the calculation to find the real function we're looking for. + // A value of -1 references the first instruction in the section. + offset := int64(int32(ins.Constant)+1) * asm.InstructionSize + if offset < 0 { + return fmt.Errorf("call: %s: invalid offset %d", name, offset) + } + + sym, ok := target.symbols[uint64(offset)] + if !ok { + return fmt.Errorf("call: %s: no symbol at offset %d", name, offset) + } + + ins.Constant = -1 + name = sym.Name + + default: + return fmt.Errorf("call: %s: invalid symbol type %s", name, typ) + } + + case undefSection: + if bind != elf.STB_GLOBAL { + return fmt.Errorf("asm relocation: %s: unsupported binding: %s", name, bind) + } + + if typ != elf.STT_NOTYPE { + return fmt.Errorf("asm relocation: %s: unsupported type %s", name, typ) + } + + // There is nothing to do here but set ins.Reference. + + default: + return fmt.Errorf("relocation to %q: %w", target.Name, ErrNotSupported) + } + + ins.Reference = name + return nil +} + +func (ec *elfCode) loadMaps(maps map[string]*MapSpec) error { + for _, sec := range ec.sections { + if sec.kind != mapSection { + continue + } + + nSym := len(sec.symbols) + if nSym == 0 { + return fmt.Errorf("section %v: no symbols", sec.Name) + } + + if sec.Size%uint64(nSym) != 0 { + return fmt.Errorf("section %v: map descriptors are not of equal size", sec.Name) + } + + var ( + r = bufio.NewReader(sec.Open()) + size = sec.Size / uint64(nSym) + ) + for i, offset := 0, uint64(0); i < nSym; i, offset = i+1, offset+size { + mapSym, ok := sec.symbols[offset] + if !ok { + return fmt.Errorf("section %s: missing symbol for map at offset %d", sec.Name, offset) + } + + mapName := mapSym.Name + if maps[mapName] != nil { + return fmt.Errorf("section %v: map %v already exists", sec.Name, mapSym) + } + + lr := io.LimitReader(r, int64(size)) + + spec := MapSpec{ + Name: SanitizeName(mapName, -1), + } + switch { + case binary.Read(lr, ec.ByteOrder, &spec.Type) != nil: + return fmt.Errorf("map %s: missing type", mapName) + case binary.Read(lr, ec.ByteOrder, &spec.KeySize) != nil: + return fmt.Errorf("map %s: missing key size", mapName) + case binary.Read(lr, ec.ByteOrder, &spec.ValueSize) != nil: + return fmt.Errorf("map %s: missing value size", mapName) + case binary.Read(lr, ec.ByteOrder, &spec.MaxEntries) != nil: + return fmt.Errorf("map %s: missing max entries", mapName) + case binary.Read(lr, ec.ByteOrder, &spec.Flags) != nil: + return fmt.Errorf("map %s: missing flags", mapName) + } + + extra, err := io.ReadAll(lr) + if err != nil { + return fmt.Errorf("map %s: reading map tail: %w", mapName, err) + } + if len(extra) > 0 { + spec.Extra = *bytes.NewReader(extra) + } + + if err := spec.clampPerfEventArraySize(); err != nil { + return fmt.Errorf("map %s: %w", mapName, err) + } + + maps[mapName] = &spec + } + } + + return nil +} + +// loadBTFMaps iterates over all ELF sections marked as BTF map sections +// (like .maps) and parses them into MapSpecs. Dump the .maps section and +// any relocations with `readelf -x .maps -r `. +func (ec *elfCode) loadBTFMaps(maps map[string]*MapSpec) error { + for _, sec := range ec.sections { + if sec.kind != btfMapSection { + continue + } + + if ec.btf == nil { + return fmt.Errorf("missing BTF") + } + + // Each section must appear as a DataSec in the ELF's BTF blob. + var ds *btf.Datasec + if err := ec.btf.FindType(sec.Name, &ds); err != nil { + return fmt.Errorf("cannot find section '%s' in BTF: %w", sec.Name, err) + } + + // Open a Reader to the ELF's raw section bytes so we can assert that all + // of them are zero on a per-map (per-Var) basis. For now, the section's + // sole purpose is to receive relocations, so all must be zero. + rs := sec.Open() + + for _, vs := range ds.Vars { + // BPF maps are declared as and assigned to global variables, + // so iterate over each Var in the DataSec and validate their types. + v, ok := vs.Type.(*btf.Var) + if !ok { + return fmt.Errorf("section %v: unexpected type %s", sec.Name, vs.Type) + } + name := string(v.Name) + + // The BTF metadata for each Var contains the full length of the map + // declaration, so read the corresponding amount of bytes from the ELF. + // This way, we can pinpoint which map declaration contains unexpected + // (and therefore unsupported) data. + _, err := io.Copy(internal.DiscardZeroes{}, io.LimitReader(rs, int64(vs.Size))) + if err != nil { + return fmt.Errorf("section %v: map %s: initializing BTF map definitions: %w", sec.Name, name, internal.ErrNotSupported) + } + + if maps[name] != nil { + return fmt.Errorf("section %v: map %s already exists", sec.Name, name) + } + + // Each Var representing a BTF map definition contains a Struct. + mapStruct, ok := v.Type.(*btf.Struct) + if !ok { + return fmt.Errorf("expected struct, got %s", v.Type) + } + + mapSpec, err := mapSpecFromBTF(sec, &vs, mapStruct, ec.btf, name, false) + if err != nil { + return fmt.Errorf("map %v: %w", name, err) + } + + if err := mapSpec.clampPerfEventArraySize(); err != nil { + return fmt.Errorf("map %v: %w", name, err) + } + + maps[name] = mapSpec + } + + // Drain the ELF section reader to make sure all bytes are accounted for + // with BTF metadata. + i, err := io.Copy(io.Discard, rs) + if err != nil { + return fmt.Errorf("section %v: unexpected error reading remainder of ELF section: %w", sec.Name, err) + } + if i > 0 { + return fmt.Errorf("section %v: %d unexpected remaining bytes in ELF section, invalid BTF?", sec.Name, i) + } + } + + return nil +} + +// A programStub is a placeholder for a Program to be inserted at a certain map key. +// It needs to be resolved into a Program later on in the loader process. +type programStub string + +// A mapStub is a placeholder for a Map to be inserted at a certain map key. +// It needs to be resolved into a Map later on in the loader process. +type mapStub string + +// mapSpecFromBTF produces a MapSpec based on a btf.Struct def representing +// a BTF map definition. The name and spec arguments will be copied to the +// resulting MapSpec, and inner must be true on any resursive invocations. +func mapSpecFromBTF(es *elfSection, vs *btf.VarSecinfo, def *btf.Struct, spec *btf.Spec, name string, inner bool) (*MapSpec, error) { + var ( + key, value btf.Type + keySize, valueSize uint32 + mapType MapType + flags, maxEntries uint32 + pinType PinType + innerMapSpec *MapSpec + contents []MapKV + err error + ) + + for i, member := range def.Members { + switch member.Name { + case "type": + mt, err := uintFromBTF(member.Type) + if err != nil { + return nil, fmt.Errorf("can't get type: %w", err) + } + mapType = MapType(mt) + + case "map_flags": + flags, err = uintFromBTF(member.Type) + if err != nil { + return nil, fmt.Errorf("can't get BTF map flags: %w", err) + } + + case "max_entries": + maxEntries, err = uintFromBTF(member.Type) + if err != nil { + return nil, fmt.Errorf("can't get BTF map max entries: %w", err) + } + + case "key": + if keySize != 0 { + return nil, errors.New("both key and key_size given") + } + + pk, ok := member.Type.(*btf.Pointer) + if !ok { + return nil, fmt.Errorf("key type is not a pointer: %T", member.Type) + } + + key = pk.Target + + size, err := btf.Sizeof(pk.Target) + if err != nil { + return nil, fmt.Errorf("can't get size of BTF key: %w", err) + } + + keySize = uint32(size) + + case "value": + if valueSize != 0 { + return nil, errors.New("both value and value_size given") + } + + vk, ok := member.Type.(*btf.Pointer) + if !ok { + return nil, fmt.Errorf("value type is not a pointer: %T", member.Type) + } + + value = vk.Target + + size, err := btf.Sizeof(vk.Target) + if err != nil { + return nil, fmt.Errorf("can't get size of BTF value: %w", err) + } + + valueSize = uint32(size) + + case "key_size": + // Key needs to be nil and keySize needs to be 0 for key_size to be + // considered a valid member. + if key != nil || keySize != 0 { + return nil, errors.New("both key and key_size given") + } + + keySize, err = uintFromBTF(member.Type) + if err != nil { + return nil, fmt.Errorf("can't get BTF key size: %w", err) + } + + case "value_size": + // Value needs to be nil and valueSize needs to be 0 for value_size to be + // considered a valid member. + if value != nil || valueSize != 0 { + return nil, errors.New("both value and value_size given") + } + + valueSize, err = uintFromBTF(member.Type) + if err != nil { + return nil, fmt.Errorf("can't get BTF value size: %w", err) + } + + case "pinning": + if inner { + return nil, errors.New("inner maps can't be pinned") + } + + pinning, err := uintFromBTF(member.Type) + if err != nil { + return nil, fmt.Errorf("can't get pinning: %w", err) + } + + pinType = PinType(pinning) + + case "values": + // The 'values' field in BTF map definitions is used for declaring map + // value types that are references to other BPF objects, like other maps + // or programs. It is always expected to be an array of pointers. + if i != len(def.Members)-1 { + return nil, errors.New("'values' must be the last member in a BTF map definition") + } + + if valueSize != 0 && valueSize != 4 { + return nil, errors.New("value_size must be 0 or 4") + } + valueSize = 4 + + valueType, err := resolveBTFArrayMacro(member.Type) + if err != nil { + return nil, fmt.Errorf("can't resolve type of member 'values': %w", err) + } + + switch t := valueType.(type) { + case *btf.Struct: + // The values member pointing to an array of structs means we're expecting + // a map-in-map declaration. + if mapType != ArrayOfMaps && mapType != HashOfMaps { + return nil, errors.New("outer map needs to be an array or a hash of maps") + } + if inner { + return nil, fmt.Errorf("nested inner maps are not supported") + } + + // This inner map spec is used as a map template, but it needs to be + // created as a traditional map before it can be used to do so. + // libbpf names the inner map template '.inner', but we + // opted for _inner to simplify validation logic. (dots only supported + // on kernels 5.2 and up) + // Pass the BTF spec from the parent object, since both parent and + // child must be created from the same BTF blob (on kernels that support BTF). + innerMapSpec, err = mapSpecFromBTF(es, vs, t, spec, name+"_inner", true) + if err != nil { + return nil, fmt.Errorf("can't parse BTF map definition of inner map: %w", err) + } + + case *btf.FuncProto: + // The values member contains an array of function pointers, meaning an + // autopopulated PROG_ARRAY. + if mapType != ProgramArray { + return nil, errors.New("map needs to be a program array") + } + + default: + return nil, fmt.Errorf("unsupported value type %q in 'values' field", t) + } + + contents, err = resolveBTFValuesContents(es, vs, member) + if err != nil { + return nil, fmt.Errorf("resolving values contents: %w", err) + } + + default: + return nil, fmt.Errorf("unrecognized field %s in BTF map definition", member.Name) + } + } + + if key == nil { + key = &btf.Void{} + } + if value == nil { + value = &btf.Void{} + } + + return &MapSpec{ + Name: SanitizeName(name, -1), + Type: MapType(mapType), + KeySize: keySize, + ValueSize: valueSize, + MaxEntries: maxEntries, + Flags: flags, + BTF: &btf.Map{Spec: spec, Key: key, Value: value}, + Pinning: pinType, + InnerMap: innerMapSpec, + Contents: contents, + }, nil +} + +// uintFromBTF resolves the __uint macro, which is a pointer to a sized +// array, e.g. for int (*foo)[10], this function will return 10. +func uintFromBTF(typ btf.Type) (uint32, error) { + ptr, ok := typ.(*btf.Pointer) + if !ok { + return 0, fmt.Errorf("not a pointer: %v", typ) + } + + arr, ok := ptr.Target.(*btf.Array) + if !ok { + return 0, fmt.Errorf("not a pointer to array: %v", typ) + } + + return arr.Nelems, nil +} + +// resolveBTFArrayMacro resolves the __array macro, which declares an array +// of pointers to a given type. This function returns the target Type of +// the pointers in the array. +func resolveBTFArrayMacro(typ btf.Type) (btf.Type, error) { + arr, ok := typ.(*btf.Array) + if !ok { + return nil, fmt.Errorf("not an array: %v", typ) + } + + ptr, ok := arr.Type.(*btf.Pointer) + if !ok { + return nil, fmt.Errorf("not an array of pointers: %v", typ) + } + + return ptr.Target, nil +} + +// resolveBTFValuesContents resolves relocations into ELF sections belonging +// to btf.VarSecinfo's. This can be used on the 'values' member in BTF map +// definitions to extract static declarations of map contents. +func resolveBTFValuesContents(es *elfSection, vs *btf.VarSecinfo, member btf.Member) ([]MapKV, error) { + // The elements of a .values pointer array are not encoded in BTF. + // Instead, relocations are generated into each array index. + // However, it's possible to leave certain array indices empty, so all + // indices' offsets need to be checked for emitted relocations. + + // The offset of the 'values' member within the _struct_ (in bits) + // is the starting point of the array. Convert to bytes. Add VarSecinfo + // offset to get the absolute position in the ELF blob. + start := (member.OffsetBits / 8) + vs.Offset + // 'values' is encoded in BTF as a zero (variable) length struct + // member, and its contents run until the end of the VarSecinfo. + // Add VarSecinfo offset to get the absolute position in the ELF blob. + end := vs.Size + vs.Offset + // The size of an address in this section. This determines the width of + // an index in the array. + align := uint32(es.SectionHeader.Addralign) + + // Check if variable-length section is aligned. + if (end-start)%align != 0 { + return nil, errors.New("unaligned static values section") + } + elems := (end - start) / align + + if elems == 0 { + return nil, nil + } + + contents := make([]MapKV, 0, elems) + + // k is the array index, off is its corresponding ELF section offset. + for k, off := uint32(0), start; k < elems; k, off = k+1, off+align { + r, ok := es.relocations[uint64(off)] + if !ok { + continue + } + + // Relocation exists for the current offset in the ELF section. + // Emit a value stub based on the type of relocation to be replaced by + // a real fd later in the pipeline before populating the map. + // Map keys are encoded in MapKV entries, so empty array indices are + // skipped here. + switch t := elf.ST_TYPE(r.Info); t { + case elf.STT_FUNC: + contents = append(contents, MapKV{uint32(k), programStub(r.Name)}) + case elf.STT_OBJECT: + contents = append(contents, MapKV{uint32(k), mapStub(r.Name)}) + default: + return nil, fmt.Errorf("unknown relocation type %v", t) + } + } + + return contents, nil +} + +func (ec *elfCode) loadDataSections(maps map[string]*MapSpec) error { + for _, sec := range ec.sections { + if sec.kind != dataSection { + continue + } + + if sec.references == 0 { + // Prune data sections which are not referenced by any + // instructions. + continue + } + + if ec.btf == nil { + return errors.New("data sections require BTF, make sure all consts are marked as static") + } + + var datasec *btf.Datasec + if err := ec.btf.FindType(sec.Name, &datasec); err != nil { + return fmt.Errorf("data section %s: can't get BTF: %w", sec.Name, err) + } + + data, err := sec.Data() + if err != nil { + return fmt.Errorf("data section %s: can't get contents: %w", sec.Name, err) + } + + if uint64(len(data)) > math.MaxUint32 { + return fmt.Errorf("data section %s: contents exceed maximum size", sec.Name) + } + + mapSpec := &MapSpec{ + Name: SanitizeName(sec.Name, -1), + Type: Array, + KeySize: 4, + ValueSize: uint32(len(data)), + MaxEntries: 1, + Contents: []MapKV{{uint32(0), data}}, + BTF: &btf.Map{Spec: ec.btf, Key: &btf.Void{}, Value: datasec}, + } + + switch sec.Name { + case ".rodata": + mapSpec.Flags = unix.BPF_F_RDONLY_PROG + mapSpec.Freeze = true + case ".bss": + // The kernel already zero-initializes the map + mapSpec.Contents = nil + } + + maps[sec.Name] = mapSpec + } + return nil +} + +func getProgType(sectionName string) (ProgramType, AttachType, uint32, string) { + types := map[string]struct { + progType ProgramType + attachType AttachType + progFlags uint32 + }{ + // From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/bpf/libbpf.c + "socket": {SocketFilter, AttachNone, 0}, + "sk_reuseport/migrate": {SkReuseport, AttachSkReuseportSelectOrMigrate, 0}, + "sk_reuseport": {SkReuseport, AttachSkReuseportSelect, 0}, + "seccomp": {SocketFilter, AttachNone, 0}, + "kprobe/": {Kprobe, AttachNone, 0}, + "uprobe/": {Kprobe, AttachNone, 0}, + "kretprobe/": {Kprobe, AttachNone, 0}, + "uretprobe/": {Kprobe, AttachNone, 0}, + "tracepoint/": {TracePoint, AttachNone, 0}, + "raw_tracepoint/": {RawTracepoint, AttachNone, 0}, + "raw_tp/": {RawTracepoint, AttachNone, 0}, + "tp_btf/": {Tracing, AttachTraceRawTp, 0}, + "xdp": {XDP, AttachNone, 0}, + "perf_event": {PerfEvent, AttachNone, 0}, + "lwt_in": {LWTIn, AttachNone, 0}, + "lwt_out": {LWTOut, AttachNone, 0}, + "lwt_xmit": {LWTXmit, AttachNone, 0}, + "lwt_seg6local": {LWTSeg6Local, AttachNone, 0}, + "sockops": {SockOps, AttachCGroupSockOps, 0}, + "sk_skb/stream_parser": {SkSKB, AttachSkSKBStreamParser, 0}, + "sk_skb/stream_verdict": {SkSKB, AttachSkSKBStreamParser, 0}, + "sk_msg": {SkMsg, AttachSkSKBStreamVerdict, 0}, + "lirc_mode2": {LircMode2, AttachLircMode2, 0}, + "flow_dissector": {FlowDissector, AttachFlowDissector, 0}, + "iter/": {Tracing, AttachTraceIter, 0}, + "fentry/": {Tracing, AttachTraceFEntry, 0}, + "fmod_ret/": {Tracing, AttachModifyReturn, 0}, + "fexit/": {Tracing, AttachTraceFExit, 0}, + "fentry.s/": {Tracing, AttachTraceFEntry, unix.BPF_F_SLEEPABLE}, + "fmod_ret.s/": {Tracing, AttachModifyReturn, unix.BPF_F_SLEEPABLE}, + "fexit.s/": {Tracing, AttachTraceFExit, unix.BPF_F_SLEEPABLE}, + "sk_lookup/": {SkLookup, AttachSkLookup, 0}, + "freplace/": {Extension, AttachNone, 0}, + "lsm/": {LSM, AttachLSMMac, 0}, + "lsm.s/": {LSM, AttachLSMMac, unix.BPF_F_SLEEPABLE}, + + "cgroup_skb/ingress": {CGroupSKB, AttachCGroupInetIngress, 0}, + "cgroup_skb/egress": {CGroupSKB, AttachCGroupInetEgress, 0}, + "cgroup/dev": {CGroupDevice, AttachCGroupDevice, 0}, + "cgroup/skb": {CGroupSKB, AttachNone, 0}, + "cgroup/sock": {CGroupSock, AttachCGroupInetSockCreate, 0}, + "cgroup/post_bind4": {CGroupSock, AttachCGroupInet4PostBind, 0}, + "cgroup/post_bind6": {CGroupSock, AttachCGroupInet6PostBind, 0}, + "cgroup/bind4": {CGroupSockAddr, AttachCGroupInet4Bind, 0}, + "cgroup/bind6": {CGroupSockAddr, AttachCGroupInet6Bind, 0}, + "cgroup/connect4": {CGroupSockAddr, AttachCGroupInet4Connect, 0}, + "cgroup/connect6": {CGroupSockAddr, AttachCGroupInet6Connect, 0}, + "cgroup/sendmsg4": {CGroupSockAddr, AttachCGroupUDP4Sendmsg, 0}, + "cgroup/sendmsg6": {CGroupSockAddr, AttachCGroupUDP6Sendmsg, 0}, + "cgroup/recvmsg4": {CGroupSockAddr, AttachCGroupUDP4Recvmsg, 0}, + "cgroup/recvmsg6": {CGroupSockAddr, AttachCGroupUDP6Recvmsg, 0}, + "cgroup/sysctl": {CGroupSysctl, AttachCGroupSysctl, 0}, + "cgroup/getsockopt": {CGroupSockopt, AttachCGroupGetsockopt, 0}, + "cgroup/setsockopt": {CGroupSockopt, AttachCGroupSetsockopt, 0}, + "classifier": {SchedCLS, AttachNone, 0}, + "action": {SchedACT, AttachNone, 0}, + + "cgroup/getsockname4": {CGroupSockAddr, AttachCgroupInet4GetSockname, 0}, + "cgroup/getsockname6": {CGroupSockAddr, AttachCgroupInet6GetSockname, 0}, + "cgroup/getpeername4": {CGroupSockAddr, AttachCgroupInet4GetPeername, 0}, + "cgroup/getpeername6": {CGroupSockAddr, AttachCgroupInet6GetPeername, 0}, + } + + for prefix, t := range types { + if !strings.HasPrefix(sectionName, prefix) { + continue + } + + if !strings.HasSuffix(prefix, "/") { + return t.progType, t.attachType, t.progFlags, "" + } + + return t.progType, t.attachType, t.progFlags, sectionName[len(prefix):] + } + + return UnspecifiedProgram, AttachNone, 0, "" +} + +func (ec *elfCode) loadRelocations(sec *elf.Section, symbols []elf.Symbol) (map[uint64]elf.Symbol, error) { + rels := make(map[uint64]elf.Symbol) + + if sec.Entsize < 16 { + return nil, fmt.Errorf("section %s: relocations are less than 16 bytes", sec.Name) + } + + r := bufio.NewReader(sec.Open()) + for off := uint64(0); off < sec.Size; off += sec.Entsize { + ent := io.LimitReader(r, int64(sec.Entsize)) + + var rel elf.Rel64 + if binary.Read(ent, ec.ByteOrder, &rel) != nil { + return nil, fmt.Errorf("can't parse relocation at offset %v", off) + } + + symNo := int(elf.R_SYM64(rel.Info) - 1) + if symNo >= len(symbols) { + return nil, fmt.Errorf("offset %d: symbol %d doesn't exist", off, symNo) + } + + symbol := symbols[symNo] + rels[rel.Off] = symbol + } + + return rels, nil +} diff --git a/vendor/github.com/cilium/ebpf/elf_reader_fuzz.go b/vendor/github.com/cilium/ebpf/elf_reader_fuzz.go new file mode 100644 index 0000000000..5f4e0a0ad0 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/elf_reader_fuzz.go @@ -0,0 +1,22 @@ +//go:build gofuzz +// +build gofuzz + +// Use with https://github.com/dvyukov/go-fuzz + +package ebpf + +import "bytes" + +func FuzzLoadCollectionSpec(data []byte) int { + spec, err := LoadCollectionSpecFromReader(bytes.NewReader(data)) + if err != nil { + if spec != nil { + panic("spec is not nil") + } + return 0 + } + if spec == nil { + panic("spec is nil") + } + return 1 +} diff --git a/vendor/github.com/cilium/ebpf/go.mod b/vendor/github.com/cilium/ebpf/go.mod new file mode 100644 index 0000000000..f5edf690ab --- /dev/null +++ b/vendor/github.com/cilium/ebpf/go.mod @@ -0,0 +1,9 @@ +module github.com/cilium/ebpf + +go 1.16 + +require ( + github.com/frankban/quicktest v1.11.3 + github.com/google/go-cmp v0.5.4 + golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34 +) diff --git a/vendor/github.com/cilium/ebpf/go.sum b/vendor/github.com/cilium/ebpf/go.sum new file mode 100644 index 0000000000..1ef5a4767e --- /dev/null +++ b/vendor/github.com/cilium/ebpf/go.sum @@ -0,0 +1,13 @@ +github.com/frankban/quicktest v1.11.3 h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY= +github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34 h1:GkvMjFtXUmahfDtashnc1mnrCtuBVcwse5QV2lUk/tI= +golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/vendor/github.com/cilium/ebpf/info.go b/vendor/github.com/cilium/ebpf/info.go new file mode 100644 index 0000000000..65fa4d7d85 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/info.go @@ -0,0 +1,273 @@ +package ebpf + +import ( + "bufio" + "encoding/hex" + "errors" + "fmt" + "io" + "os" + "strings" + "syscall" + "time" + + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/btf" +) + +// MapInfo describes a map. +type MapInfo struct { + Type MapType + id MapID + KeySize uint32 + ValueSize uint32 + MaxEntries uint32 + Flags uint32 + // Name as supplied by user space at load time. + Name string +} + +func newMapInfoFromFd(fd *internal.FD) (*MapInfo, error) { + info, err := bpfGetMapInfoByFD(fd) + if errors.Is(err, syscall.EINVAL) { + return newMapInfoFromProc(fd) + } + if err != nil { + return nil, err + } + + return &MapInfo{ + MapType(info.map_type), + MapID(info.id), + info.key_size, + info.value_size, + info.max_entries, + info.map_flags, + // name is available from 4.15. + internal.CString(info.name[:]), + }, nil +} + +func newMapInfoFromProc(fd *internal.FD) (*MapInfo, error) { + var mi MapInfo + err := scanFdInfo(fd, map[string]interface{}{ + "map_type": &mi.Type, + "key_size": &mi.KeySize, + "value_size": &mi.ValueSize, + "max_entries": &mi.MaxEntries, + "map_flags": &mi.Flags, + }) + if err != nil { + return nil, err + } + return &mi, nil +} + +// ID returns the map ID. +// +// Available from 4.13. +// +// The bool return value indicates whether this optional field is available. +func (mi *MapInfo) ID() (MapID, bool) { + return mi.id, mi.id > 0 +} + +// programStats holds statistics of a program. +type programStats struct { + // Total accumulated runtime of the program ins ns. + runtime time.Duration + // Total number of times the program was called. + runCount uint64 +} + +// ProgramInfo describes a program. +type ProgramInfo struct { + Type ProgramType + id ProgramID + // Truncated hash of the BPF bytecode. + Tag string + // Name as supplied by user space at load time. + Name string + // BTF for the program. + btf btf.ID + // IDS map ids related to program. + ids []MapID + + stats *programStats +} + +func newProgramInfoFromFd(fd *internal.FD) (*ProgramInfo, error) { + info, err := bpfGetProgInfoByFD(fd, nil) + if errors.Is(err, syscall.EINVAL) { + return newProgramInfoFromProc(fd) + } + if err != nil { + return nil, err + } + + var mapIDs []MapID + if info.nr_map_ids > 0 { + mapIDs = make([]MapID, info.nr_map_ids) + info, err = bpfGetProgInfoByFD(fd, mapIDs) + if err != nil { + return nil, err + } + } + + return &ProgramInfo{ + Type: ProgramType(info.prog_type), + id: ProgramID(info.id), + // tag is available if the kernel supports BPF_PROG_GET_INFO_BY_FD. + Tag: hex.EncodeToString(info.tag[:]), + // name is available from 4.15. + Name: internal.CString(info.name[:]), + btf: btf.ID(info.btf_id), + ids: mapIDs, + stats: &programStats{ + runtime: time.Duration(info.run_time_ns), + runCount: info.run_cnt, + }, + }, nil +} + +func newProgramInfoFromProc(fd *internal.FD) (*ProgramInfo, error) { + var info ProgramInfo + err := scanFdInfo(fd, map[string]interface{}{ + "prog_type": &info.Type, + "prog_tag": &info.Tag, + }) + if errors.Is(err, errMissingFields) { + return nil, &internal.UnsupportedFeatureError{ + Name: "reading program info from /proc/self/fdinfo", + MinimumVersion: internal.Version{4, 10, 0}, + } + } + if err != nil { + return nil, err + } + + return &info, nil +} + +// ID returns the program ID. +// +// Available from 4.13. +// +// The bool return value indicates whether this optional field is available. +func (pi *ProgramInfo) ID() (ProgramID, bool) { + return pi.id, pi.id > 0 +} + +// BTFID returns the BTF ID associated with the program. +// +// Available from 5.0. +// +// The bool return value indicates whether this optional field is available and +// populated. (The field may be available but not populated if the kernel +// supports the field but the program was loaded without BTF information.) +func (pi *ProgramInfo) BTFID() (btf.ID, bool) { + return pi.btf, pi.btf > 0 +} + +// RunCount returns the total number of times the program was called. +// +// Can return 0 if the collection of statistics is not enabled. See EnableStats(). +// The bool return value indicates whether this optional field is available. +func (pi *ProgramInfo) RunCount() (uint64, bool) { + if pi.stats != nil { + return pi.stats.runCount, true + } + return 0, false +} + +// Runtime returns the total accumulated runtime of the program. +// +// Can return 0 if the collection of statistics is not enabled. See EnableStats(). +// The bool return value indicates whether this optional field is available. +func (pi *ProgramInfo) Runtime() (time.Duration, bool) { + if pi.stats != nil { + return pi.stats.runtime, true + } + return time.Duration(0), false +} + +// MapIDs returns the maps related to the program. +// +// The bool return value indicates whether this optional field is available. +func (pi *ProgramInfo) MapIDs() ([]MapID, bool) { + return pi.ids, pi.ids != nil +} + +func scanFdInfo(fd *internal.FD, fields map[string]interface{}) error { + raw, err := fd.Value() + if err != nil { + return err + } + + fh, err := os.Open(fmt.Sprintf("/proc/self/fdinfo/%d", raw)) + if err != nil { + return err + } + defer fh.Close() + + if err := scanFdInfoReader(fh, fields); err != nil { + return fmt.Errorf("%s: %w", fh.Name(), err) + } + return nil +} + +var errMissingFields = errors.New("missing fields") + +func scanFdInfoReader(r io.Reader, fields map[string]interface{}) error { + var ( + scanner = bufio.NewScanner(r) + scanned int + ) + + for scanner.Scan() { + parts := strings.SplitN(scanner.Text(), "\t", 2) + if len(parts) != 2 { + continue + } + + name := strings.TrimSuffix(parts[0], ":") + field, ok := fields[string(name)] + if !ok { + continue + } + + if n, err := fmt.Sscanln(parts[1], field); err != nil || n != 1 { + return fmt.Errorf("can't parse field %s: %v", name, err) + } + + scanned++ + } + + if err := scanner.Err(); err != nil { + return err + } + + if scanned != len(fields) { + return errMissingFields + } + + return nil +} + +// EnableStats starts the measuring of the runtime +// and run counts of eBPF programs. +// +// Collecting statistics can have an impact on the performance. +// +// Requires at least 5.8. +func EnableStats(which uint32) (io.Closer, error) { + attr := internal.BPFEnableStatsAttr{ + StatsType: which, + } + + fd, err := internal.BPFEnableStats(&attr) + if err != nil { + return nil, err + } + return fd, nil +} diff --git a/vendor/github.com/cilium/ebpf/internal/align.go b/vendor/github.com/cilium/ebpf/internal/align.go new file mode 100644 index 0000000000..8b4f2658ea --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/align.go @@ -0,0 +1,6 @@ +package internal + +// Align returns 'n' updated to 'alignment' boundary. +func Align(n, alignment int) int { + return (int(n) + alignment - 1) / alignment * alignment +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/btf.go b/vendor/github.com/cilium/ebpf/internal/btf/btf.go new file mode 100644 index 0000000000..2b5f6d226a --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/btf.go @@ -0,0 +1,798 @@ +package btf + +import ( + "bytes" + "debug/elf" + "encoding/binary" + "errors" + "fmt" + "io" + "math" + "os" + "reflect" + "sync" + "unsafe" + + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/unix" +) + +const btfMagic = 0xeB9F + +// Errors returned by BTF functions. +var ( + ErrNotSupported = internal.ErrNotSupported + ErrNotFound = errors.New("not found") + ErrNoExtendedInfo = errors.New("no extended info") +) + +// ID represents the unique ID of a BTF object. +type ID uint32 + +// Spec represents decoded BTF. +type Spec struct { + rawTypes []rawType + strings stringTable + types []Type + namedTypes map[string][]NamedType + funcInfos map[string]extInfo + lineInfos map[string]extInfo + coreRelos map[string]coreRelos + byteOrder binary.ByteOrder +} + +type btfHeader struct { + Magic uint16 + Version uint8 + Flags uint8 + HdrLen uint32 + + TypeOff uint32 + TypeLen uint32 + StringOff uint32 + StringLen uint32 +} + +// LoadSpecFromReader reads BTF sections from an ELF. +// +// Returns ErrNotFound if the reader contains no BTF. +func LoadSpecFromReader(rd io.ReaderAt) (*Spec, error) { + file, err := internal.NewSafeELFFile(rd) + if err != nil { + return nil, err + } + defer file.Close() + + symbols, err := file.Symbols() + if err != nil { + return nil, fmt.Errorf("can't read symbols: %v", err) + } + + variableOffsets := make(map[variable]uint32) + for _, symbol := range symbols { + if idx := symbol.Section; idx >= elf.SHN_LORESERVE && idx <= elf.SHN_HIRESERVE { + // Ignore things like SHN_ABS + continue + } + + if int(symbol.Section) >= len(file.Sections) { + return nil, fmt.Errorf("symbol %s: invalid section %d", symbol.Name, symbol.Section) + } + + secName := file.Sections[symbol.Section].Name + if symbol.Value > math.MaxUint32 { + return nil, fmt.Errorf("section %s: symbol %s: size exceeds maximum", secName, symbol.Name) + } + + variableOffsets[variable{secName, symbol.Name}] = uint32(symbol.Value) + } + + return loadSpecFromELF(file, variableOffsets) +} + +func loadSpecFromELF(file *internal.SafeELFFile, variableOffsets map[variable]uint32) (*Spec, error) { + var ( + btfSection *elf.Section + btfExtSection *elf.Section + sectionSizes = make(map[string]uint32) + ) + + for _, sec := range file.Sections { + switch sec.Name { + case ".BTF": + btfSection = sec + case ".BTF.ext": + btfExtSection = sec + default: + if sec.Type != elf.SHT_PROGBITS && sec.Type != elf.SHT_NOBITS { + break + } + + if sec.Size > math.MaxUint32 { + return nil, fmt.Errorf("section %s exceeds maximum size", sec.Name) + } + + sectionSizes[sec.Name] = uint32(sec.Size) + } + } + + if btfSection == nil { + return nil, fmt.Errorf("btf: %w", ErrNotFound) + } + + spec, err := loadRawSpec(btfSection.Open(), file.ByteOrder, sectionSizes, variableOffsets) + if err != nil { + return nil, err + } + + if btfExtSection == nil { + return spec, nil + } + + spec.funcInfos, spec.lineInfos, spec.coreRelos, err = parseExtInfos(btfExtSection.Open(), file.ByteOrder, spec.strings) + if err != nil { + return nil, fmt.Errorf("can't read ext info: %w", err) + } + + return spec, nil +} + +// LoadRawSpec reads a blob of BTF data that isn't wrapped in an ELF file. +// +// Prefer using LoadSpecFromReader, since this function only supports a subset +// of BTF. +func LoadRawSpec(btf io.Reader, bo binary.ByteOrder) (*Spec, error) { + // This will return an error if we encounter a Datasec, since we can't fix + // it up. + return loadRawSpec(btf, bo, nil, nil) +} + +func loadRawSpec(btf io.Reader, bo binary.ByteOrder, sectionSizes map[string]uint32, variableOffsets map[variable]uint32) (*Spec, error) { + rawTypes, rawStrings, err := parseBTF(btf, bo) + if err != nil { + return nil, err + } + + err = fixupDatasec(rawTypes, rawStrings, sectionSizes, variableOffsets) + if err != nil { + return nil, err + } + + types, typesByName, err := inflateRawTypes(rawTypes, rawStrings) + if err != nil { + return nil, err + } + + return &Spec{ + rawTypes: rawTypes, + namedTypes: typesByName, + types: types, + strings: rawStrings, + byteOrder: bo, + }, nil +} + +var kernelBTF struct { + sync.Mutex + *Spec +} + +// LoadKernelSpec returns the current kernel's BTF information. +// +// Requires a >= 5.5 kernel with CONFIG_DEBUG_INFO_BTF enabled. Returns +// ErrNotSupported if BTF is not enabled. +func LoadKernelSpec() (*Spec, error) { + kernelBTF.Lock() + defer kernelBTF.Unlock() + + if kernelBTF.Spec != nil { + return kernelBTF.Spec, nil + } + + var err error + kernelBTF.Spec, err = loadKernelSpec() + return kernelBTF.Spec, err +} + +func loadKernelSpec() (*Spec, error) { + release, err := unix.KernelRelease() + if err != nil { + return nil, fmt.Errorf("can't read kernel release number: %w", err) + } + + fh, err := os.Open("/sys/kernel/btf/vmlinux") + if err == nil { + defer fh.Close() + + return LoadRawSpec(fh, internal.NativeEndian) + } + + // use same list of locations as libbpf + // https://github.com/libbpf/libbpf/blob/9a3a42608dbe3731256a5682a125ac1e23bced8f/src/btf.c#L3114-L3122 + locations := []string{ + "/boot/vmlinux-%s", + "/lib/modules/%s/vmlinux-%[1]s", + "/lib/modules/%s/build/vmlinux", + "/usr/lib/modules/%s/kernel/vmlinux", + "/usr/lib/debug/boot/vmlinux-%s", + "/usr/lib/debug/boot/vmlinux-%s.debug", + "/usr/lib/debug/lib/modules/%s/vmlinux", + } + + for _, loc := range locations { + path := fmt.Sprintf(loc, release) + + fh, err := os.Open(path) + if err != nil { + continue + } + defer fh.Close() + + file, err := internal.NewSafeELFFile(fh) + if err != nil { + return nil, err + } + defer file.Close() + + return loadSpecFromELF(file, nil) + } + + return nil, fmt.Errorf("no BTF for kernel version %s: %w", release, internal.ErrNotSupported) +} + +func parseBTF(btf io.Reader, bo binary.ByteOrder) ([]rawType, stringTable, error) { + rawBTF, err := io.ReadAll(btf) + if err != nil { + return nil, nil, fmt.Errorf("can't read BTF: %v", err) + } + + rd := bytes.NewReader(rawBTF) + + var header btfHeader + if err := binary.Read(rd, bo, &header); err != nil { + return nil, nil, fmt.Errorf("can't read header: %v", err) + } + + if header.Magic != btfMagic { + return nil, nil, fmt.Errorf("incorrect magic value %v", header.Magic) + } + + if header.Version != 1 { + return nil, nil, fmt.Errorf("unexpected version %v", header.Version) + } + + if header.Flags != 0 { + return nil, nil, fmt.Errorf("unsupported flags %v", header.Flags) + } + + remainder := int64(header.HdrLen) - int64(binary.Size(&header)) + if remainder < 0 { + return nil, nil, errors.New("header is too short") + } + + if _, err := io.CopyN(internal.DiscardZeroes{}, rd, remainder); err != nil { + return nil, nil, fmt.Errorf("header padding: %v", err) + } + + if _, err := rd.Seek(int64(header.HdrLen+header.StringOff), io.SeekStart); err != nil { + return nil, nil, fmt.Errorf("can't seek to start of string section: %v", err) + } + + rawStrings, err := readStringTable(io.LimitReader(rd, int64(header.StringLen))) + if err != nil { + return nil, nil, fmt.Errorf("can't read type names: %w", err) + } + + if _, err := rd.Seek(int64(header.HdrLen+header.TypeOff), io.SeekStart); err != nil { + return nil, nil, fmt.Errorf("can't seek to start of type section: %v", err) + } + + rawTypes, err := readTypes(io.LimitReader(rd, int64(header.TypeLen)), bo) + if err != nil { + return nil, nil, fmt.Errorf("can't read types: %w", err) + } + + return rawTypes, rawStrings, nil +} + +type variable struct { + section string + name string +} + +func fixupDatasec(rawTypes []rawType, rawStrings stringTable, sectionSizes map[string]uint32, variableOffsets map[variable]uint32) error { + for i, rawType := range rawTypes { + if rawType.Kind() != kindDatasec { + continue + } + + name, err := rawStrings.Lookup(rawType.NameOff) + if err != nil { + return err + } + + if name == ".kconfig" || name == ".ksyms" { + return fmt.Errorf("reference to %s: %w", name, ErrNotSupported) + } + + if rawTypes[i].SizeType != 0 { + continue + } + + size, ok := sectionSizes[name] + if !ok { + return fmt.Errorf("data section %s: missing size", name) + } + + rawTypes[i].SizeType = size + + secinfos := rawType.data.([]btfVarSecinfo) + for j, secInfo := range secinfos { + id := int(secInfo.Type - 1) + if id >= len(rawTypes) { + return fmt.Errorf("data section %s: invalid type id %d for variable %d", name, id, j) + } + + varName, err := rawStrings.Lookup(rawTypes[id].NameOff) + if err != nil { + return fmt.Errorf("data section %s: can't get name for type %d: %w", name, id, err) + } + + offset, ok := variableOffsets[variable{name, varName}] + if !ok { + return fmt.Errorf("data section %s: missing offset for variable %s", name, varName) + } + + secinfos[j].Offset = offset + } + } + + return nil +} + +// Copy creates a copy of Spec. +func (s *Spec) Copy() *Spec { + types, _ := copyTypes(s.types, nil) + namedTypes := make(map[string][]NamedType) + for _, typ := range types { + if named, ok := typ.(NamedType); ok { + name := essentialName(named.TypeName()) + namedTypes[name] = append(namedTypes[name], named) + } + } + + // NB: Other parts of spec are not copied since they are immutable. + return &Spec{ + s.rawTypes, + s.strings, + types, + namedTypes, + s.funcInfos, + s.lineInfos, + s.coreRelos, + s.byteOrder, + } +} + +type marshalOpts struct { + ByteOrder binary.ByteOrder + StripFuncLinkage bool +} + +func (s *Spec) marshal(opts marshalOpts) ([]byte, error) { + var ( + buf bytes.Buffer + header = new(btfHeader) + headerLen = binary.Size(header) + ) + + // Reserve space for the header. We have to write it last since + // we don't know the size of the type section yet. + _, _ = buf.Write(make([]byte, headerLen)) + + // Write type section, just after the header. + for _, raw := range s.rawTypes { + switch { + case opts.StripFuncLinkage && raw.Kind() == kindFunc: + raw.SetLinkage(StaticFunc) + } + + if err := raw.Marshal(&buf, opts.ByteOrder); err != nil { + return nil, fmt.Errorf("can't marshal BTF: %w", err) + } + } + + typeLen := uint32(buf.Len() - headerLen) + + // Write string section after type section. + _, _ = buf.Write(s.strings) + + // Fill out the header, and write it out. + header = &btfHeader{ + Magic: btfMagic, + Version: 1, + Flags: 0, + HdrLen: uint32(headerLen), + TypeOff: 0, + TypeLen: typeLen, + StringOff: typeLen, + StringLen: uint32(len(s.strings)), + } + + raw := buf.Bytes() + err := binary.Write(sliceWriter(raw[:headerLen]), opts.ByteOrder, header) + if err != nil { + return nil, fmt.Errorf("can't write header: %v", err) + } + + return raw, nil +} + +type sliceWriter []byte + +func (sw sliceWriter) Write(p []byte) (int, error) { + if len(p) != len(sw) { + return 0, errors.New("size doesn't match") + } + + return copy(sw, p), nil +} + +// Program finds the BTF for a specific section. +// +// Length is the number of bytes in the raw BPF instruction stream. +// +// Returns an error which may wrap ErrNoExtendedInfo if the Spec doesn't +// contain extended BTF info. +func (s *Spec) Program(name string, length uint64) (*Program, error) { + if length == 0 { + return nil, errors.New("length musn't be zero") + } + + if s.funcInfos == nil && s.lineInfos == nil && s.coreRelos == nil { + return nil, fmt.Errorf("BTF for section %s: %w", name, ErrNoExtendedInfo) + } + + funcInfos, funcOK := s.funcInfos[name] + lineInfos, lineOK := s.lineInfos[name] + relos, coreOK := s.coreRelos[name] + + if !funcOK && !lineOK && !coreOK { + return nil, fmt.Errorf("no extended BTF info for section %s", name) + } + + return &Program{s, length, funcInfos, lineInfos, relos}, nil +} + +// FindType searches for a type with a specific name. +// +// Called T a type that satisfies Type, typ must be a non-nil **T. +// On success, the address of the found type will be copied in typ. +// +// Returns an error wrapping ErrNotFound if no matching +// type exists in spec. +func (s *Spec) FindType(name string, typ interface{}) error { + typValue := reflect.ValueOf(typ) + if typValue.Kind() != reflect.Ptr { + return fmt.Errorf("%T is not a pointer", typ) + } + + typPtr := typValue.Elem() + if !typPtr.CanSet() { + return fmt.Errorf("%T cannot be set", typ) + } + + wanted := typPtr.Type() + if !wanted.AssignableTo(reflect.TypeOf((*Type)(nil)).Elem()) { + return fmt.Errorf("%T does not satisfy Type interface", typ) + } + + var candidate Type + for _, typ := range s.namedTypes[essentialName(name)] { + if reflect.TypeOf(typ) != wanted { + continue + } + + // Match against the full name, not just the essential one. + if typ.TypeName() != name { + continue + } + + if candidate != nil { + return fmt.Errorf("type %s: multiple candidates for %T", name, typ) + } + + candidate = typ + } + + if candidate == nil { + return fmt.Errorf("type %s: %w", name, ErrNotFound) + } + + typPtr.Set(reflect.ValueOf(candidate)) + + return nil +} + +// Handle is a reference to BTF loaded into the kernel. +type Handle struct { + spec *Spec + fd *internal.FD +} + +// NewHandle loads BTF into the kernel. +// +// Returns ErrNotSupported if BTF is not supported. +func NewHandle(spec *Spec) (*Handle, error) { + if err := haveBTF(); err != nil { + return nil, err + } + + if spec.byteOrder != internal.NativeEndian { + return nil, fmt.Errorf("can't load %s BTF on %s", spec.byteOrder, internal.NativeEndian) + } + + btf, err := spec.marshal(marshalOpts{ + ByteOrder: internal.NativeEndian, + StripFuncLinkage: haveFuncLinkage() != nil, + }) + if err != nil { + return nil, fmt.Errorf("can't marshal BTF: %w", err) + } + + if uint64(len(btf)) > math.MaxUint32 { + return nil, errors.New("BTF exceeds the maximum size") + } + + attr := &bpfLoadBTFAttr{ + btf: internal.NewSlicePointer(btf), + btfSize: uint32(len(btf)), + } + + fd, err := bpfLoadBTF(attr) + if err != nil { + logBuf := make([]byte, 64*1024) + attr.logBuf = internal.NewSlicePointer(logBuf) + attr.btfLogSize = uint32(len(logBuf)) + attr.btfLogLevel = 1 + _, logErr := bpfLoadBTF(attr) + return nil, internal.ErrorWithLog(err, logBuf, logErr) + } + + return &Handle{spec.Copy(), fd}, nil +} + +// NewHandleFromID returns the BTF handle for a given id. +// +// Returns ErrNotExist, if there is no BTF with the given id. +// +// Requires CAP_SYS_ADMIN. +func NewHandleFromID(id ID) (*Handle, error) { + fd, err := internal.BPFObjGetFDByID(internal.BPF_BTF_GET_FD_BY_ID, uint32(id)) + if err != nil { + return nil, fmt.Errorf("get BTF by id: %w", err) + } + + info, err := newInfoFromFd(fd) + if err != nil { + _ = fd.Close() + return nil, fmt.Errorf("get BTF spec for handle: %w", err) + } + + return &Handle{info.BTF, fd}, nil +} + +// Spec returns the Spec that defined the BTF loaded into the kernel. +func (h *Handle) Spec() *Spec { + return h.spec +} + +// Close destroys the handle. +// +// Subsequent calls to FD will return an invalid value. +func (h *Handle) Close() error { + return h.fd.Close() +} + +// FD returns the file descriptor for the handle. +func (h *Handle) FD() int { + value, err := h.fd.Value() + if err != nil { + return -1 + } + + return int(value) +} + +// Map is the BTF for a map. +type Map struct { + Spec *Spec + Key, Value Type +} + +// Program is the BTF information for a stream of instructions. +type Program struct { + spec *Spec + length uint64 + funcInfos, lineInfos extInfo + coreRelos coreRelos +} + +// Spec returns the BTF spec of this program. +func (p *Program) Spec() *Spec { + return p.spec +} + +// Append the information from other to the Program. +func (p *Program) Append(other *Program) error { + if other.spec != p.spec { + return fmt.Errorf("can't append program with different BTF specs") + } + + funcInfos, err := p.funcInfos.append(other.funcInfos, p.length) + if err != nil { + return fmt.Errorf("func infos: %w", err) + } + + lineInfos, err := p.lineInfos.append(other.lineInfos, p.length) + if err != nil { + return fmt.Errorf("line infos: %w", err) + } + + p.funcInfos = funcInfos + p.lineInfos = lineInfos + p.coreRelos = p.coreRelos.append(other.coreRelos, p.length) + p.length += other.length + return nil +} + +// FuncInfos returns the binary form of BTF function infos. +func (p *Program) FuncInfos() (recordSize uint32, bytes []byte, err error) { + bytes, err = p.funcInfos.MarshalBinary() + if err != nil { + return 0, nil, fmt.Errorf("func infos: %w", err) + } + + return p.funcInfos.recordSize, bytes, nil +} + +// LineInfos returns the binary form of BTF line infos. +func (p *Program) LineInfos() (recordSize uint32, bytes []byte, err error) { + bytes, err = p.lineInfos.MarshalBinary() + if err != nil { + return 0, nil, fmt.Errorf("line infos: %w", err) + } + + return p.lineInfos.recordSize, bytes, nil +} + +// Fixups returns the changes required to adjust the program to the target. +// +// Passing a nil target will relocate against the running kernel. +func (p *Program) Fixups(target *Spec) (COREFixups, error) { + if len(p.coreRelos) == 0 { + return nil, nil + } + + if target == nil { + var err error + target, err = LoadKernelSpec() + if err != nil { + return nil, err + } + } + + return coreRelocate(p.spec, target, p.coreRelos) +} + +type bpfLoadBTFAttr struct { + btf internal.Pointer + logBuf internal.Pointer + btfSize uint32 + btfLogSize uint32 + btfLogLevel uint32 +} + +func bpfLoadBTF(attr *bpfLoadBTFAttr) (*internal.FD, error) { + fd, err := internal.BPF(internal.BPF_BTF_LOAD, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + if err != nil { + return nil, err + } + + return internal.NewFD(uint32(fd)), nil +} + +func marshalBTF(types interface{}, strings []byte, bo binary.ByteOrder) []byte { + const minHeaderLength = 24 + + typesLen := uint32(binary.Size(types)) + header := btfHeader{ + Magic: btfMagic, + Version: 1, + HdrLen: minHeaderLength, + TypeOff: 0, + TypeLen: typesLen, + StringOff: typesLen, + StringLen: uint32(len(strings)), + } + + buf := new(bytes.Buffer) + _ = binary.Write(buf, bo, &header) + _ = binary.Write(buf, bo, types) + buf.Write(strings) + + return buf.Bytes() +} + +var haveBTF = internal.FeatureTest("BTF", "5.1", func() error { + var ( + types struct { + Integer btfType + Var btfType + btfVar struct{ Linkage uint32 } + } + strings = []byte{0, 'a', 0} + ) + + // We use a BTF_KIND_VAR here, to make sure that + // the kernel understands BTF at least as well as we + // do. BTF_KIND_VAR was introduced ~5.1. + types.Integer.SetKind(kindPointer) + types.Var.NameOff = 1 + types.Var.SetKind(kindVar) + types.Var.SizeType = 1 + + btf := marshalBTF(&types, strings, internal.NativeEndian) + + fd, err := bpfLoadBTF(&bpfLoadBTFAttr{ + btf: internal.NewSlicePointer(btf), + btfSize: uint32(len(btf)), + }) + if errors.Is(err, unix.EINVAL) || errors.Is(err, unix.EPERM) { + // Treat both EINVAL and EPERM as not supported: loading the program + // might still succeed without BTF. + return internal.ErrNotSupported + } + if err != nil { + return err + } + + fd.Close() + return nil +}) + +var haveFuncLinkage = internal.FeatureTest("BTF func linkage", "5.6", func() error { + if err := haveBTF(); err != nil { + return err + } + + var ( + types struct { + FuncProto btfType + Func btfType + } + strings = []byte{0, 'a', 0} + ) + + types.FuncProto.SetKind(kindFuncProto) + types.Func.SetKind(kindFunc) + types.Func.SizeType = 1 // aka FuncProto + types.Func.NameOff = 1 + types.Func.SetLinkage(GlobalFunc) + + btf := marshalBTF(&types, strings, internal.NativeEndian) + + fd, err := bpfLoadBTF(&bpfLoadBTFAttr{ + btf: internal.NewSlicePointer(btf), + btfSize: uint32(len(btf)), + }) + if errors.Is(err, unix.EINVAL) { + return internal.ErrNotSupported + } + if err != nil { + return err + } + + fd.Close() + return nil +}) diff --git a/vendor/github.com/cilium/ebpf/internal/btf/btf_types.go b/vendor/github.com/cilium/ebpf/internal/btf/btf_types.go new file mode 100644 index 0000000000..d98c73ca59 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/btf_types.go @@ -0,0 +1,287 @@ +package btf + +import ( + "encoding/binary" + "fmt" + "io" +) + +//go:generate stringer -linecomment -output=btf_types_string.go -type=FuncLinkage,VarLinkage + +// btfKind describes a Type. +type btfKind uint8 + +// Equivalents of the BTF_KIND_* constants. +const ( + kindUnknown btfKind = iota + kindInt + kindPointer + kindArray + kindStruct + kindUnion + kindEnum + kindForward + kindTypedef + kindVolatile + kindConst + kindRestrict + // Added ~4.20 + kindFunc + kindFuncProto + // Added ~5.1 + kindVar + kindDatasec + // Added ~5.13 + kindFloat +) + +// FuncLinkage describes BTF function linkage metadata. +type FuncLinkage int + +// Equivalent of enum btf_func_linkage. +const ( + StaticFunc FuncLinkage = iota // static + GlobalFunc // global + ExternFunc // extern +) + +// VarLinkage describes BTF variable linkage metadata. +type VarLinkage int + +const ( + StaticVar VarLinkage = iota // static + GlobalVar // global + ExternVar // extern +) + +const ( + btfTypeKindShift = 24 + btfTypeKindLen = 5 + btfTypeVlenShift = 0 + btfTypeVlenMask = 16 + btfTypeKindFlagShift = 31 + btfTypeKindFlagMask = 1 +) + +// btfType is equivalent to struct btf_type in Documentation/bpf/btf.rst. +type btfType struct { + NameOff uint32 + /* "info" bits arrangement + * bits 0-15: vlen (e.g. # of struct's members), linkage + * bits 16-23: unused + * bits 24-28: kind (e.g. int, ptr, array...etc) + * bits 29-30: unused + * bit 31: kind_flag, currently used by + * struct, union and fwd + */ + Info uint32 + /* "size" is used by INT, ENUM, STRUCT and UNION. + * "size" tells the size of the type it is describing. + * + * "type" is used by PTR, TYPEDEF, VOLATILE, CONST, RESTRICT, + * FUNC and FUNC_PROTO. + * "type" is a type_id referring to another type. + */ + SizeType uint32 +} + +func (k btfKind) String() string { + switch k { + case kindUnknown: + return "Unknown" + case kindInt: + return "Integer" + case kindPointer: + return "Pointer" + case kindArray: + return "Array" + case kindStruct: + return "Struct" + case kindUnion: + return "Union" + case kindEnum: + return "Enumeration" + case kindForward: + return "Forward" + case kindTypedef: + return "Typedef" + case kindVolatile: + return "Volatile" + case kindConst: + return "Const" + case kindRestrict: + return "Restrict" + case kindFunc: + return "Function" + case kindFuncProto: + return "Function Proto" + case kindVar: + return "Variable" + case kindDatasec: + return "Section" + case kindFloat: + return "Float" + default: + return fmt.Sprintf("Unknown (%d)", k) + } +} + +func mask(len uint32) uint32 { + return (1 << len) - 1 +} + +func (bt *btfType) info(len, shift uint32) uint32 { + return (bt.Info >> shift) & mask(len) +} + +func (bt *btfType) setInfo(value, len, shift uint32) { + bt.Info &^= mask(len) << shift + bt.Info |= (value & mask(len)) << shift +} + +func (bt *btfType) Kind() btfKind { + return btfKind(bt.info(btfTypeKindLen, btfTypeKindShift)) +} + +func (bt *btfType) SetKind(kind btfKind) { + bt.setInfo(uint32(kind), btfTypeKindLen, btfTypeKindShift) +} + +func (bt *btfType) Vlen() int { + return int(bt.info(btfTypeVlenMask, btfTypeVlenShift)) +} + +func (bt *btfType) SetVlen(vlen int) { + bt.setInfo(uint32(vlen), btfTypeVlenMask, btfTypeVlenShift) +} + +func (bt *btfType) KindFlag() bool { + return bt.info(btfTypeKindFlagMask, btfTypeKindFlagShift) == 1 +} + +func (bt *btfType) Linkage() FuncLinkage { + return FuncLinkage(bt.info(btfTypeVlenMask, btfTypeVlenShift)) +} + +func (bt *btfType) SetLinkage(linkage FuncLinkage) { + bt.setInfo(uint32(linkage), btfTypeVlenMask, btfTypeVlenShift) +} + +func (bt *btfType) Type() TypeID { + // TODO: Panic here if wrong kind? + return TypeID(bt.SizeType) +} + +func (bt *btfType) Size() uint32 { + // TODO: Panic here if wrong kind? + return bt.SizeType +} + +type rawType struct { + btfType + data interface{} +} + +func (rt *rawType) Marshal(w io.Writer, bo binary.ByteOrder) error { + if err := binary.Write(w, bo, &rt.btfType); err != nil { + return err + } + + if rt.data == nil { + return nil + } + + return binary.Write(w, bo, rt.data) +} + +type btfArray struct { + Type TypeID + IndexType TypeID + Nelems uint32 +} + +type btfMember struct { + NameOff uint32 + Type TypeID + Offset uint32 +} + +type btfVarSecinfo struct { + Type TypeID + Offset uint32 + Size uint32 +} + +type btfVariable struct { + Linkage uint32 +} + +type btfEnum struct { + NameOff uint32 + Val int32 +} + +type btfParam struct { + NameOff uint32 + Type TypeID +} + +func readTypes(r io.Reader, bo binary.ByteOrder) ([]rawType, error) { + var ( + header btfType + types []rawType + ) + + for id := TypeID(1); ; id++ { + if err := binary.Read(r, bo, &header); err == io.EOF { + return types, nil + } else if err != nil { + return nil, fmt.Errorf("can't read type info for id %v: %v", id, err) + } + + var data interface{} + switch header.Kind() { + case kindInt: + data = new(uint32) + case kindPointer: + case kindArray: + data = new(btfArray) + case kindStruct: + fallthrough + case kindUnion: + data = make([]btfMember, header.Vlen()) + case kindEnum: + data = make([]btfEnum, header.Vlen()) + case kindForward: + case kindTypedef: + case kindVolatile: + case kindConst: + case kindRestrict: + case kindFunc: + case kindFuncProto: + data = make([]btfParam, header.Vlen()) + case kindVar: + data = new(btfVariable) + case kindDatasec: + data = make([]btfVarSecinfo, header.Vlen()) + case kindFloat: + default: + return nil, fmt.Errorf("type id %v: unknown kind: %v", id, header.Kind()) + } + + if data == nil { + types = append(types, rawType{header, nil}) + continue + } + + if err := binary.Read(r, bo, data); err != nil { + return nil, fmt.Errorf("type id %d: kind %v: can't read %T: %v", id, header.Kind(), data, err) + } + + types = append(types, rawType{header, data}) + } +} + +func intEncoding(raw uint32) (IntEncoding, uint32, byte) { + return IntEncoding((raw & 0x0f000000) >> 24), (raw & 0x00ff0000) >> 16, byte(raw & 0x000000ff) +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/btf_types_string.go b/vendor/github.com/cilium/ebpf/internal/btf/btf_types_string.go new file mode 100644 index 0000000000..0e0c17d68b --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/btf_types_string.go @@ -0,0 +1,44 @@ +// Code generated by "stringer -linecomment -output=btf_types_string.go -type=FuncLinkage,VarLinkage"; DO NOT EDIT. + +package btf + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[StaticFunc-0] + _ = x[GlobalFunc-1] + _ = x[ExternFunc-2] +} + +const _FuncLinkage_name = "staticglobalextern" + +var _FuncLinkage_index = [...]uint8{0, 6, 12, 18} + +func (i FuncLinkage) String() string { + if i < 0 || i >= FuncLinkage(len(_FuncLinkage_index)-1) { + return "FuncLinkage(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _FuncLinkage_name[_FuncLinkage_index[i]:_FuncLinkage_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[StaticVar-0] + _ = x[GlobalVar-1] + _ = x[ExternVar-2] +} + +const _VarLinkage_name = "staticglobalextern" + +var _VarLinkage_index = [...]uint8{0, 6, 12, 18} + +func (i VarLinkage) String() string { + if i < 0 || i >= VarLinkage(len(_VarLinkage_index)-1) { + return "VarLinkage(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _VarLinkage_name[_VarLinkage_index[i]:_VarLinkage_index[i+1]] +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/core.go b/vendor/github.com/cilium/ebpf/internal/btf/core.go new file mode 100644 index 0000000000..d02df9d50b --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/core.go @@ -0,0 +1,888 @@ +package btf + +import ( + "errors" + "fmt" + "math" + "reflect" + "sort" + "strconv" + "strings" + + "github.com/cilium/ebpf/asm" +) + +// Code in this file is derived from libbpf, which is available under a BSD +// 2-Clause license. + +// COREFixup is the result of computing a CO-RE relocation for a target. +type COREFixup struct { + Kind COREKind + Local uint32 + Target uint32 + Poison bool +} + +func (f COREFixup) equal(other COREFixup) bool { + return f.Local == other.Local && f.Target == other.Target +} + +func (f COREFixup) String() string { + if f.Poison { + return fmt.Sprintf("%s=poison", f.Kind) + } + return fmt.Sprintf("%s=%d->%d", f.Kind, f.Local, f.Target) +} + +func (f COREFixup) apply(ins *asm.Instruction) error { + if f.Poison { + return errors.New("can't poison individual instruction") + } + + switch class := ins.OpCode.Class(); class { + case asm.LdXClass, asm.StClass, asm.StXClass: + if want := int16(f.Local); want != ins.Offset { + return fmt.Errorf("invalid offset %d, expected %d", ins.Offset, want) + } + + if f.Target > math.MaxInt16 { + return fmt.Errorf("offset %d exceeds MaxInt16", f.Target) + } + + ins.Offset = int16(f.Target) + + case asm.LdClass: + if !ins.IsConstantLoad(asm.DWord) { + return fmt.Errorf("not a dword-sized immediate load") + } + + if want := int64(f.Local); want != ins.Constant { + return fmt.Errorf("invalid immediate %d, expected %d", ins.Constant, want) + } + + ins.Constant = int64(f.Target) + + case asm.ALUClass: + if ins.OpCode.ALUOp() == asm.Swap { + return fmt.Errorf("relocation against swap") + } + + fallthrough + + case asm.ALU64Class: + if src := ins.OpCode.Source(); src != asm.ImmSource { + return fmt.Errorf("invalid source %s", src) + } + + if want := int64(f.Local); want != ins.Constant { + return fmt.Errorf("invalid immediate %d, expected %d", ins.Constant, want) + } + + if f.Target > math.MaxInt32 { + return fmt.Errorf("immediate %d exceeds MaxInt32", f.Target) + } + + ins.Constant = int64(f.Target) + + default: + return fmt.Errorf("invalid class %s", class) + } + + return nil +} + +func (f COREFixup) isNonExistant() bool { + return f.Kind.checksForExistence() && f.Target == 0 +} + +type COREFixups map[uint64]COREFixup + +// Apply a set of CO-RE relocations to a BPF program. +func (fs COREFixups) Apply(insns asm.Instructions) (asm.Instructions, error) { + if len(fs) == 0 { + cpy := make(asm.Instructions, len(insns)) + copy(cpy, insns) + return insns, nil + } + + cpy := make(asm.Instructions, 0, len(insns)) + iter := insns.Iterate() + for iter.Next() { + fixup, ok := fs[iter.Offset.Bytes()] + if !ok { + cpy = append(cpy, *iter.Ins) + continue + } + + ins := *iter.Ins + if fixup.Poison { + const badRelo = asm.BuiltinFunc(0xbad2310) + + cpy = append(cpy, badRelo.Call()) + if ins.OpCode.IsDWordLoad() { + // 64 bit constant loads occupy two raw bpf instructions, so + // we need to add another instruction as padding. + cpy = append(cpy, badRelo.Call()) + } + + continue + } + + if err := fixup.apply(&ins); err != nil { + return nil, fmt.Errorf("instruction %d, offset %d: %s: %w", iter.Index, iter.Offset.Bytes(), fixup.Kind, err) + } + + cpy = append(cpy, ins) + } + + return cpy, nil +} + +// COREKind is the type of CO-RE relocation +type COREKind uint32 + +const ( + reloFieldByteOffset COREKind = iota /* field byte offset */ + reloFieldByteSize /* field size in bytes */ + reloFieldExists /* field existence in target kernel */ + reloFieldSigned /* field signedness (0 - unsigned, 1 - signed) */ + reloFieldLShiftU64 /* bitfield-specific left bitshift */ + reloFieldRShiftU64 /* bitfield-specific right bitshift */ + reloTypeIDLocal /* type ID in local BPF object */ + reloTypeIDTarget /* type ID in target kernel */ + reloTypeExists /* type existence in target kernel */ + reloTypeSize /* type size in bytes */ + reloEnumvalExists /* enum value existence in target kernel */ + reloEnumvalValue /* enum value integer value */ +) + +func (k COREKind) String() string { + switch k { + case reloFieldByteOffset: + return "byte_off" + case reloFieldByteSize: + return "byte_sz" + case reloFieldExists: + return "field_exists" + case reloFieldSigned: + return "signed" + case reloFieldLShiftU64: + return "lshift_u64" + case reloFieldRShiftU64: + return "rshift_u64" + case reloTypeIDLocal: + return "local_type_id" + case reloTypeIDTarget: + return "target_type_id" + case reloTypeExists: + return "type_exists" + case reloTypeSize: + return "type_size" + case reloEnumvalExists: + return "enumval_exists" + case reloEnumvalValue: + return "enumval_value" + default: + return "unknown" + } +} + +func (k COREKind) checksForExistence() bool { + return k == reloEnumvalExists || k == reloTypeExists || k == reloFieldExists +} + +func coreRelocate(local, target *Spec, relos coreRelos) (COREFixups, error) { + if local.byteOrder != target.byteOrder { + return nil, fmt.Errorf("can't relocate %s against %s", local.byteOrder, target.byteOrder) + } + + var ids []TypeID + relosByID := make(map[TypeID]coreRelos) + result := make(COREFixups, len(relos)) + for _, relo := range relos { + if relo.kind == reloTypeIDLocal { + // Filtering out reloTypeIDLocal here makes our lives a lot easier + // down the line, since it doesn't have a target at all. + if len(relo.accessor) > 1 || relo.accessor[0] != 0 { + return nil, fmt.Errorf("%s: unexpected accessor %v", relo.kind, relo.accessor) + } + + result[uint64(relo.insnOff)] = COREFixup{ + relo.kind, + uint32(relo.typeID), + uint32(relo.typeID), + false, + } + continue + } + + relos, ok := relosByID[relo.typeID] + if !ok { + ids = append(ids, relo.typeID) + } + relosByID[relo.typeID] = append(relos, relo) + } + + // Ensure we work on relocations in a deterministic order. + sort.Slice(ids, func(i, j int) bool { + return ids[i] < ids[j] + }) + + for _, id := range ids { + if int(id) >= len(local.types) { + return nil, fmt.Errorf("invalid type id %d", id) + } + + localType := local.types[id] + named, ok := localType.(NamedType) + if !ok || named.TypeName() == "" { + return nil, fmt.Errorf("relocate unnamed or anonymous type %s: %w", localType, ErrNotSupported) + } + + relos := relosByID[id] + targets := target.namedTypes[essentialName(named.TypeName())] + fixups, err := coreCalculateFixups(localType, targets, relos) + if err != nil { + return nil, fmt.Errorf("relocate %s: %w", localType, err) + } + + for i, relo := range relos { + result[uint64(relo.insnOff)] = fixups[i] + } + } + + return result, nil +} + +var errAmbiguousRelocation = errors.New("ambiguous relocation") +var errImpossibleRelocation = errors.New("impossible relocation") + +// coreCalculateFixups calculates the fixups for the given relocations using +// the "best" target. +// +// The best target is determined by scoring: the less poisoning we have to do +// the better the target is. +func coreCalculateFixups(local Type, targets []NamedType, relos coreRelos) ([]COREFixup, error) { + localID := local.ID() + local, err := copyType(local, skipQualifierAndTypedef) + if err != nil { + return nil, err + } + + bestScore := len(relos) + var bestFixups []COREFixup + for i := range targets { + targetID := targets[i].ID() + target, err := copyType(targets[i], skipQualifierAndTypedef) + if err != nil { + return nil, err + } + + score := 0 // lower is better + fixups := make([]COREFixup, 0, len(relos)) + for _, relo := range relos { + fixup, err := coreCalculateFixup(local, localID, target, targetID, relo) + if err != nil { + return nil, fmt.Errorf("target %s: %w", target, err) + } + if fixup.Poison || fixup.isNonExistant() { + score++ + } + fixups = append(fixups, fixup) + } + + if score > bestScore { + // We have a better target already, ignore this one. + continue + } + + if score < bestScore { + // This is the best target yet, use it. + bestScore = score + bestFixups = fixups + continue + } + + // Some other target has the same score as the current one. Make sure + // the fixups agree with each other. + for i, fixup := range bestFixups { + if !fixup.equal(fixups[i]) { + return nil, fmt.Errorf("%s: multiple types match: %w", fixup.Kind, errAmbiguousRelocation) + } + } + } + + if bestFixups == nil { + // Nothing at all matched, probably because there are no suitable + // targets at all. Poison everything! + bestFixups = make([]COREFixup, len(relos)) + for i, relo := range relos { + bestFixups[i] = COREFixup{Kind: relo.kind, Poison: true} + } + } + + return bestFixups, nil +} + +// coreCalculateFixup calculates the fixup for a single local type, target type +// and relocation. +func coreCalculateFixup(local Type, localID TypeID, target Type, targetID TypeID, relo coreRelo) (COREFixup, error) { + fixup := func(local, target uint32) (COREFixup, error) { + return COREFixup{relo.kind, local, target, false}, nil + } + poison := func() (COREFixup, error) { + if relo.kind.checksForExistence() { + return fixup(1, 0) + } + return COREFixup{relo.kind, 0, 0, true}, nil + } + zero := COREFixup{} + + switch relo.kind { + case reloTypeIDTarget, reloTypeSize, reloTypeExists: + if len(relo.accessor) > 1 || relo.accessor[0] != 0 { + return zero, fmt.Errorf("%s: unexpected accessor %v", relo.kind, relo.accessor) + } + + err := coreAreTypesCompatible(local, target) + if errors.Is(err, errImpossibleRelocation) { + return poison() + } + if err != nil { + return zero, fmt.Errorf("relocation %s: %w", relo.kind, err) + } + + switch relo.kind { + case reloTypeExists: + return fixup(1, 1) + + case reloTypeIDTarget: + return fixup(uint32(localID), uint32(targetID)) + + case reloTypeSize: + localSize, err := Sizeof(local) + if err != nil { + return zero, err + } + + targetSize, err := Sizeof(target) + if err != nil { + return zero, err + } + + return fixup(uint32(localSize), uint32(targetSize)) + } + + case reloEnumvalValue, reloEnumvalExists: + localValue, targetValue, err := coreFindEnumValue(local, relo.accessor, target) + if errors.Is(err, errImpossibleRelocation) { + return poison() + } + if err != nil { + return zero, fmt.Errorf("relocation %s: %w", relo.kind, err) + } + + switch relo.kind { + case reloEnumvalExists: + return fixup(1, 1) + + case reloEnumvalValue: + return fixup(uint32(localValue.Value), uint32(targetValue.Value)) + } + + case reloFieldByteOffset, reloFieldByteSize, reloFieldExists: + if _, ok := target.(*Fwd); ok { + // We can't relocate fields using a forward declaration, so + // skip it. If a non-forward declaration is present in the BTF + // we'll find it in one of the other iterations. + return poison() + } + + localField, targetField, err := coreFindField(local, relo.accessor, target) + if errors.Is(err, errImpossibleRelocation) { + return poison() + } + if err != nil { + return zero, fmt.Errorf("target %s: %w", target, err) + } + + switch relo.kind { + case reloFieldExists: + return fixup(1, 1) + + case reloFieldByteOffset: + return fixup(localField.offset/8, targetField.offset/8) + + case reloFieldByteSize: + localSize, err := Sizeof(localField.Type) + if err != nil { + return zero, err + } + + targetSize, err := Sizeof(targetField.Type) + if err != nil { + return zero, err + } + + return fixup(uint32(localSize), uint32(targetSize)) + + } + } + + return zero, fmt.Errorf("relocation %s: %w", relo.kind, ErrNotSupported) +} + +/* coreAccessor contains a path through a struct. It contains at least one index. + * + * The interpretation depends on the kind of the relocation. The following is + * taken from struct bpf_core_relo in libbpf_internal.h: + * + * - for field-based relocations, string encodes an accessed field using + * a sequence of field and array indices, separated by colon (:). It's + * conceptually very close to LLVM's getelementptr ([0]) instruction's + * arguments for identifying offset to a field. + * - for type-based relocations, strings is expected to be just "0"; + * - for enum value-based relocations, string contains an index of enum + * value within its enum type; + * + * Example to provide a better feel. + * + * struct sample { + * int a; + * struct { + * int b[10]; + * }; + * }; + * + * struct sample s = ...; + * int x = &s->a; // encoded as "0:0" (a is field #0) + * int y = &s->b[5]; // encoded as "0:1:0:5" (anon struct is field #1, + * // b is field #0 inside anon struct, accessing elem #5) + * int z = &s[10]->b; // encoded as "10:1" (ptr is used as an array) + */ +type coreAccessor []int + +func parseCoreAccessor(accessor string) (coreAccessor, error) { + if accessor == "" { + return nil, fmt.Errorf("empty accessor") + } + + parts := strings.Split(accessor, ":") + result := make(coreAccessor, 0, len(parts)) + for _, part := range parts { + // 31 bits to avoid overflowing int on 32 bit platforms. + index, err := strconv.ParseUint(part, 10, 31) + if err != nil { + return nil, fmt.Errorf("accessor index %q: %s", part, err) + } + + result = append(result, int(index)) + } + + return result, nil +} + +func (ca coreAccessor) String() string { + strs := make([]string, 0, len(ca)) + for _, i := range ca { + strs = append(strs, strconv.Itoa(i)) + } + return strings.Join(strs, ":") +} + +func (ca coreAccessor) enumValue(t Type) (*EnumValue, error) { + e, ok := t.(*Enum) + if !ok { + return nil, fmt.Errorf("not an enum: %s", t) + } + + if len(ca) > 1 { + return nil, fmt.Errorf("invalid accessor %s for enum", ca) + } + + i := ca[0] + if i >= len(e.Values) { + return nil, fmt.Errorf("invalid index %d for %s", i, e) + } + + return &e.Values[i], nil +} + +type coreField struct { + Type Type + offset uint32 +} + +func adjustOffset(base uint32, t Type, n int) (uint32, error) { + size, err := Sizeof(t) + if err != nil { + return 0, err + } + + return base + (uint32(n) * uint32(size) * 8), nil +} + +// coreFindField descends into the local type using the accessor and tries to +// find an equivalent field in target at each step. +// +// Returns the field and the offset of the field from the start of +// target in bits. +func coreFindField(local Type, localAcc coreAccessor, target Type) (_, _ coreField, _ error) { + // The first index is used to offset a pointer of the base type like + // when accessing an array. + localOffset, err := adjustOffset(0, local, localAcc[0]) + if err != nil { + return coreField{}, coreField{}, err + } + + targetOffset, err := adjustOffset(0, target, localAcc[0]) + if err != nil { + return coreField{}, coreField{}, err + } + + if err := coreAreMembersCompatible(local, target); err != nil { + return coreField{}, coreField{}, fmt.Errorf("fields: %w", err) + } + + var localMaybeFlex, targetMaybeFlex bool + for _, acc := range localAcc[1:] { + switch localType := local.(type) { + case composite: + // For composite types acc is used to find the field in the local type, + // and then we try to find a field in target with the same name. + localMembers := localType.members() + if acc >= len(localMembers) { + return coreField{}, coreField{}, fmt.Errorf("invalid accessor %d for %s", acc, local) + } + + localMember := localMembers[acc] + if localMember.Name == "" { + _, ok := localMember.Type.(composite) + if !ok { + return coreField{}, coreField{}, fmt.Errorf("unnamed field with type %s: %s", localMember.Type, ErrNotSupported) + } + + // This is an anonymous struct or union, ignore it. + local = localMember.Type + localOffset += localMember.OffsetBits + localMaybeFlex = false + continue + } + + targetType, ok := target.(composite) + if !ok { + return coreField{}, coreField{}, fmt.Errorf("target not composite: %w", errImpossibleRelocation) + } + + targetMember, last, err := coreFindMember(targetType, localMember.Name) + if err != nil { + return coreField{}, coreField{}, err + } + + if targetMember.BitfieldSize > 0 { + return coreField{}, coreField{}, fmt.Errorf("field %q is a bitfield: %w", targetMember.Name, ErrNotSupported) + } + + local = localMember.Type + localMaybeFlex = acc == len(localMembers)-1 + localOffset += localMember.OffsetBits + target = targetMember.Type + targetMaybeFlex = last + targetOffset += targetMember.OffsetBits + + case *Array: + // For arrays, acc is the index in the target. + targetType, ok := target.(*Array) + if !ok { + return coreField{}, coreField{}, fmt.Errorf("target not array: %w", errImpossibleRelocation) + } + + if localType.Nelems == 0 && !localMaybeFlex { + return coreField{}, coreField{}, fmt.Errorf("local type has invalid flexible array") + } + if targetType.Nelems == 0 && !targetMaybeFlex { + return coreField{}, coreField{}, fmt.Errorf("target type has invalid flexible array") + } + + if localType.Nelems > 0 && acc >= int(localType.Nelems) { + return coreField{}, coreField{}, fmt.Errorf("invalid access of %s at index %d", localType, acc) + } + if targetType.Nelems > 0 && acc >= int(targetType.Nelems) { + return coreField{}, coreField{}, fmt.Errorf("out of bounds access of target: %w", errImpossibleRelocation) + } + + local = localType.Type + localMaybeFlex = false + localOffset, err = adjustOffset(localOffset, local, acc) + if err != nil { + return coreField{}, coreField{}, err + } + + target = targetType.Type + targetMaybeFlex = false + targetOffset, err = adjustOffset(targetOffset, target, acc) + if err != nil { + return coreField{}, coreField{}, err + } + + default: + return coreField{}, coreField{}, fmt.Errorf("relocate field of %T: %w", localType, ErrNotSupported) + } + + if err := coreAreMembersCompatible(local, target); err != nil { + return coreField{}, coreField{}, err + } + } + + return coreField{local, localOffset}, coreField{target, targetOffset}, nil +} + +// coreFindMember finds a member in a composite type while handling anonymous +// structs and unions. +func coreFindMember(typ composite, name string) (Member, bool, error) { + if name == "" { + return Member{}, false, errors.New("can't search for anonymous member") + } + + type offsetTarget struct { + composite + offset uint32 + } + + targets := []offsetTarget{{typ, 0}} + visited := make(map[composite]bool) + + for i := 0; i < len(targets); i++ { + target := targets[i] + + // Only visit targets once to prevent infinite recursion. + if visited[target] { + continue + } + if len(visited) >= maxTypeDepth { + // This check is different than libbpf, which restricts the entire + // path to BPF_CORE_SPEC_MAX_LEN items. + return Member{}, false, fmt.Errorf("type is nested too deep") + } + visited[target] = true + + members := target.members() + for j, member := range members { + if member.Name == name { + // NB: This is safe because member is a copy. + member.OffsetBits += target.offset + return member, j == len(members)-1, nil + } + + // The names don't match, but this member could be an anonymous struct + // or union. + if member.Name != "" { + continue + } + + comp, ok := member.Type.(composite) + if !ok { + return Member{}, false, fmt.Errorf("anonymous non-composite type %T not allowed", member.Type) + } + + targets = append(targets, offsetTarget{comp, target.offset + member.OffsetBits}) + } + } + + return Member{}, false, fmt.Errorf("no matching member: %w", errImpossibleRelocation) +} + +// coreFindEnumValue follows localAcc to find the equivalent enum value in target. +func coreFindEnumValue(local Type, localAcc coreAccessor, target Type) (localValue, targetValue *EnumValue, _ error) { + localValue, err := localAcc.enumValue(local) + if err != nil { + return nil, nil, err + } + + targetEnum, ok := target.(*Enum) + if !ok { + return nil, nil, errImpossibleRelocation + } + + localName := essentialName(localValue.Name) + for i, targetValue := range targetEnum.Values { + if essentialName(targetValue.Name) != localName { + continue + } + + return localValue, &targetEnum.Values[i], nil + } + + return nil, nil, errImpossibleRelocation +} + +/* The comment below is from bpf_core_types_are_compat in libbpf.c: + * + * Check local and target types for compatibility. This check is used for + * type-based CO-RE relocations and follow slightly different rules than + * field-based relocations. This function assumes that root types were already + * checked for name match. Beyond that initial root-level name check, names + * are completely ignored. Compatibility rules are as follows: + * - any two STRUCTs/UNIONs/FWDs/ENUMs/INTs are considered compatible, but + * kind should match for local and target types (i.e., STRUCT is not + * compatible with UNION); + * - for ENUMs, the size is ignored; + * - for INT, size and signedness are ignored; + * - for ARRAY, dimensionality is ignored, element types are checked for + * compatibility recursively; + * - CONST/VOLATILE/RESTRICT modifiers are ignored; + * - TYPEDEFs/PTRs are compatible if types they pointing to are compatible; + * - FUNC_PROTOs are compatible if they have compatible signature: same + * number of input args and compatible return and argument types. + * These rules are not set in stone and probably will be adjusted as we get + * more experience with using BPF CO-RE relocations. + * + * Returns errImpossibleRelocation if types are not compatible. + */ +func coreAreTypesCompatible(localType Type, targetType Type) error { + var ( + localTs, targetTs typeDeque + l, t = &localType, &targetType + depth = 0 + ) + + for ; l != nil && t != nil; l, t = localTs.shift(), targetTs.shift() { + if depth >= maxTypeDepth { + return errors.New("types are nested too deep") + } + + localType = *l + targetType = *t + + if reflect.TypeOf(localType) != reflect.TypeOf(targetType) { + return fmt.Errorf("type mismatch: %w", errImpossibleRelocation) + } + + switch lv := (localType).(type) { + case *Void, *Struct, *Union, *Enum, *Fwd: + // Nothing to do here + + case *Int: + tv := targetType.(*Int) + if lv.isBitfield() || tv.isBitfield() { + return fmt.Errorf("bitfield: %w", errImpossibleRelocation) + } + + case *Pointer, *Array: + depth++ + localType.walk(&localTs) + targetType.walk(&targetTs) + + case *FuncProto: + tv := targetType.(*FuncProto) + if len(lv.Params) != len(tv.Params) { + return fmt.Errorf("function param mismatch: %w", errImpossibleRelocation) + } + + depth++ + localType.walk(&localTs) + targetType.walk(&targetTs) + + default: + return fmt.Errorf("unsupported type %T", localType) + } + } + + if l != nil { + return fmt.Errorf("dangling local type %T", *l) + } + + if t != nil { + return fmt.Errorf("dangling target type %T", *t) + } + + return nil +} + +/* coreAreMembersCompatible checks two types for field-based relocation compatibility. + * + * The comment below is from bpf_core_fields_are_compat in libbpf.c: + * + * Check two types for compatibility for the purpose of field access + * relocation. const/volatile/restrict and typedefs are skipped to ensure we + * are relocating semantically compatible entities: + * - any two STRUCTs/UNIONs are compatible and can be mixed; + * - any two FWDs are compatible, if their names match (modulo flavor suffix); + * - any two PTRs are always compatible; + * - for ENUMs, names should be the same (ignoring flavor suffix) or at + * least one of enums should be anonymous; + * - for ENUMs, check sizes, names are ignored; + * - for INT, size and signedness are ignored; + * - any two FLOATs are always compatible; + * - for ARRAY, dimensionality is ignored, element types are checked for + * compatibility recursively; + * [ NB: coreAreMembersCompatible doesn't recurse, this check is done + * by coreFindField. ] + * - everything else shouldn't be ever a target of relocation. + * These rules are not set in stone and probably will be adjusted as we get + * more experience with using BPF CO-RE relocations. + * + * Returns errImpossibleRelocation if the members are not compatible. + */ +func coreAreMembersCompatible(localType Type, targetType Type) error { + doNamesMatch := func(a, b string) error { + if a == "" || b == "" { + // allow anonymous and named type to match + return nil + } + + if essentialName(a) == essentialName(b) { + return nil + } + + return fmt.Errorf("names don't match: %w", errImpossibleRelocation) + } + + _, lok := localType.(composite) + _, tok := targetType.(composite) + if lok && tok { + return nil + } + + if reflect.TypeOf(localType) != reflect.TypeOf(targetType) { + return fmt.Errorf("type mismatch: %w", errImpossibleRelocation) + } + + switch lv := localType.(type) { + case *Array, *Pointer, *Float: + return nil + + case *Enum: + tv := targetType.(*Enum) + return doNamesMatch(lv.Name, tv.Name) + + case *Fwd: + tv := targetType.(*Fwd) + return doNamesMatch(lv.Name, tv.Name) + + case *Int: + tv := targetType.(*Int) + if lv.isBitfield() || tv.isBitfield() { + return fmt.Errorf("bitfield: %w", errImpossibleRelocation) + } + return nil + + default: + return fmt.Errorf("type %s: %w", localType, ErrNotSupported) + } +} + +func skipQualifierAndTypedef(typ Type) (Type, error) { + result := typ + for depth := 0; depth <= maxTypeDepth; depth++ { + switch v := (result).(type) { + case qualifier: + result = v.qualify() + case *Typedef: + result = v.Type + default: + return result, nil + } + } + return nil, errors.New("exceeded type depth") +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/doc.go b/vendor/github.com/cilium/ebpf/internal/btf/doc.go new file mode 100644 index 0000000000..ad2576cb23 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/doc.go @@ -0,0 +1,8 @@ +// Package btf handles data encoded according to the BPF Type Format. +// +// The canonical documentation lives in the Linux kernel repository and is +// available at https://www.kernel.org/doc/html/latest/bpf/btf.html +// +// The API is very much unstable. You should only use this via the main +// ebpf library. +package btf diff --git a/vendor/github.com/cilium/ebpf/internal/btf/ext_info.go b/vendor/github.com/cilium/ebpf/internal/btf/ext_info.go new file mode 100644 index 0000000000..cdae2ec408 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/ext_info.go @@ -0,0 +1,312 @@ +package btf + +import ( + "bufio" + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + + "github.com/cilium/ebpf/asm" + "github.com/cilium/ebpf/internal" +) + +type btfExtHeader struct { + Magic uint16 + Version uint8 + Flags uint8 + HdrLen uint32 + + FuncInfoOff uint32 + FuncInfoLen uint32 + LineInfoOff uint32 + LineInfoLen uint32 +} + +type btfExtCoreHeader struct { + CoreReloOff uint32 + CoreReloLen uint32 +} + +func parseExtInfos(r io.ReadSeeker, bo binary.ByteOrder, strings stringTable) (funcInfo, lineInfo map[string]extInfo, relos map[string]coreRelos, err error) { + var header btfExtHeader + var coreHeader btfExtCoreHeader + if err := binary.Read(r, bo, &header); err != nil { + return nil, nil, nil, fmt.Errorf("can't read header: %v", err) + } + + if header.Magic != btfMagic { + return nil, nil, nil, fmt.Errorf("incorrect magic value %v", header.Magic) + } + + if header.Version != 1 { + return nil, nil, nil, fmt.Errorf("unexpected version %v", header.Version) + } + + if header.Flags != 0 { + return nil, nil, nil, fmt.Errorf("unsupported flags %v", header.Flags) + } + + remainder := int64(header.HdrLen) - int64(binary.Size(&header)) + if remainder < 0 { + return nil, nil, nil, errors.New("header is too short") + } + + coreHdrSize := int64(binary.Size(&coreHeader)) + if remainder >= coreHdrSize { + if err := binary.Read(r, bo, &coreHeader); err != nil { + return nil, nil, nil, fmt.Errorf("can't read CO-RE relocation header: %v", err) + } + remainder -= coreHdrSize + } + + // Of course, the .BTF.ext header has different semantics than the + // .BTF ext header. We need to ignore non-null values. + _, err = io.CopyN(io.Discard, r, remainder) + if err != nil { + return nil, nil, nil, fmt.Errorf("header padding: %v", err) + } + + if _, err := r.Seek(int64(header.HdrLen+header.FuncInfoOff), io.SeekStart); err != nil { + return nil, nil, nil, fmt.Errorf("can't seek to function info section: %v", err) + } + + buf := bufio.NewReader(io.LimitReader(r, int64(header.FuncInfoLen))) + funcInfo, err = parseExtInfo(buf, bo, strings) + if err != nil { + return nil, nil, nil, fmt.Errorf("function info: %w", err) + } + + if _, err := r.Seek(int64(header.HdrLen+header.LineInfoOff), io.SeekStart); err != nil { + return nil, nil, nil, fmt.Errorf("can't seek to line info section: %v", err) + } + + buf = bufio.NewReader(io.LimitReader(r, int64(header.LineInfoLen))) + lineInfo, err = parseExtInfo(buf, bo, strings) + if err != nil { + return nil, nil, nil, fmt.Errorf("line info: %w", err) + } + + if coreHeader.CoreReloOff > 0 && coreHeader.CoreReloLen > 0 { + if _, err := r.Seek(int64(header.HdrLen+coreHeader.CoreReloOff), io.SeekStart); err != nil { + return nil, nil, nil, fmt.Errorf("can't seek to CO-RE relocation section: %v", err) + } + + relos, err = parseExtInfoRelos(io.LimitReader(r, int64(coreHeader.CoreReloLen)), bo, strings) + if err != nil { + return nil, nil, nil, fmt.Errorf("CO-RE relocation info: %w", err) + } + } + + return funcInfo, lineInfo, relos, nil +} + +type btfExtInfoSec struct { + SecNameOff uint32 + NumInfo uint32 +} + +type extInfoRecord struct { + InsnOff uint64 + Opaque []byte +} + +type extInfo struct { + byteOrder binary.ByteOrder + recordSize uint32 + records []extInfoRecord +} + +func (ei extInfo) append(other extInfo, offset uint64) (extInfo, error) { + if other.byteOrder != ei.byteOrder { + return extInfo{}, fmt.Errorf("ext_info byte order mismatch, want %v (got %v)", ei.byteOrder, other.byteOrder) + } + + if other.recordSize != ei.recordSize { + return extInfo{}, fmt.Errorf("ext_info record size mismatch, want %d (got %d)", ei.recordSize, other.recordSize) + } + + records := make([]extInfoRecord, 0, len(ei.records)+len(other.records)) + records = append(records, ei.records...) + for _, info := range other.records { + records = append(records, extInfoRecord{ + InsnOff: info.InsnOff + offset, + Opaque: info.Opaque, + }) + } + return extInfo{ei.byteOrder, ei.recordSize, records}, nil +} + +func (ei extInfo) MarshalBinary() ([]byte, error) { + if ei.byteOrder != internal.NativeEndian { + return nil, fmt.Errorf("%s is not the native byte order", ei.byteOrder) + } + + if len(ei.records) == 0 { + return nil, nil + } + + buf := bytes.NewBuffer(make([]byte, 0, int(ei.recordSize)*len(ei.records))) + for _, info := range ei.records { + // The kernel expects offsets in number of raw bpf instructions, + // while the ELF tracks it in bytes. + insnOff := uint32(info.InsnOff / asm.InstructionSize) + if err := binary.Write(buf, internal.NativeEndian, insnOff); err != nil { + return nil, fmt.Errorf("can't write instruction offset: %v", err) + } + + buf.Write(info.Opaque) + } + + return buf.Bytes(), nil +} + +func parseExtInfo(r io.Reader, bo binary.ByteOrder, strings stringTable) (map[string]extInfo, error) { + const maxRecordSize = 256 + + var recordSize uint32 + if err := binary.Read(r, bo, &recordSize); err != nil { + return nil, fmt.Errorf("can't read record size: %v", err) + } + + if recordSize < 4 { + // Need at least insnOff + return nil, errors.New("record size too short") + } + if recordSize > maxRecordSize { + return nil, fmt.Errorf("record size %v exceeds %v", recordSize, maxRecordSize) + } + + result := make(map[string]extInfo) + for { + secName, infoHeader, err := parseExtInfoHeader(r, bo, strings) + if errors.Is(err, io.EOF) { + return result, nil + } + + var records []extInfoRecord + for i := uint32(0); i < infoHeader.NumInfo; i++ { + var byteOff uint32 + if err := binary.Read(r, bo, &byteOff); err != nil { + return nil, fmt.Errorf("section %v: can't read extended info offset: %v", secName, err) + } + + buf := make([]byte, int(recordSize-4)) + if _, err := io.ReadFull(r, buf); err != nil { + return nil, fmt.Errorf("section %v: can't read record: %v", secName, err) + } + + if byteOff%asm.InstructionSize != 0 { + return nil, fmt.Errorf("section %v: offset %v is not aligned with instruction size", secName, byteOff) + } + + records = append(records, extInfoRecord{uint64(byteOff), buf}) + } + + result[secName] = extInfo{ + bo, + recordSize, + records, + } + } +} + +// bpfCoreRelo matches `struct bpf_core_relo` from the kernel +type bpfCoreRelo struct { + InsnOff uint32 + TypeID TypeID + AccessStrOff uint32 + Kind COREKind +} + +type coreRelo struct { + insnOff uint32 + typeID TypeID + accessor coreAccessor + kind COREKind +} + +type coreRelos []coreRelo + +// append two slices of extInfoRelo to each other. The InsnOff of b are adjusted +// by offset. +func (r coreRelos) append(other coreRelos, offset uint64) coreRelos { + result := make([]coreRelo, 0, len(r)+len(other)) + result = append(result, r...) + for _, relo := range other { + relo.insnOff += uint32(offset) + result = append(result, relo) + } + return result +} + +var extInfoReloSize = binary.Size(bpfCoreRelo{}) + +func parseExtInfoRelos(r io.Reader, bo binary.ByteOrder, strings stringTable) (map[string]coreRelos, error) { + var recordSize uint32 + if err := binary.Read(r, bo, &recordSize); err != nil { + return nil, fmt.Errorf("read record size: %v", err) + } + + if recordSize != uint32(extInfoReloSize) { + return nil, fmt.Errorf("expected record size %d, got %d", extInfoReloSize, recordSize) + } + + result := make(map[string]coreRelos) + for { + secName, infoHeader, err := parseExtInfoHeader(r, bo, strings) + if errors.Is(err, io.EOF) { + return result, nil + } + + var relos coreRelos + for i := uint32(0); i < infoHeader.NumInfo; i++ { + var relo bpfCoreRelo + if err := binary.Read(r, bo, &relo); err != nil { + return nil, fmt.Errorf("section %v: read record: %v", secName, err) + } + + if relo.InsnOff%asm.InstructionSize != 0 { + return nil, fmt.Errorf("section %v: offset %v is not aligned with instruction size", secName, relo.InsnOff) + } + + accessorStr, err := strings.Lookup(relo.AccessStrOff) + if err != nil { + return nil, err + } + + accessor, err := parseCoreAccessor(accessorStr) + if err != nil { + return nil, fmt.Errorf("accessor %q: %s", accessorStr, err) + } + + relos = append(relos, coreRelo{ + relo.InsnOff, + relo.TypeID, + accessor, + relo.Kind, + }) + } + + result[secName] = relos + } +} + +func parseExtInfoHeader(r io.Reader, bo binary.ByteOrder, strings stringTable) (string, *btfExtInfoSec, error) { + var infoHeader btfExtInfoSec + if err := binary.Read(r, bo, &infoHeader); err != nil { + return "", nil, fmt.Errorf("read ext info header: %w", err) + } + + secName, err := strings.Lookup(infoHeader.SecNameOff) + if err != nil { + return "", nil, fmt.Errorf("get section name: %w", err) + } + + if infoHeader.NumInfo == 0 { + return "", nil, fmt.Errorf("section %s has zero records", secName) + } + + return secName, &infoHeader, nil +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/fuzz.go b/vendor/github.com/cilium/ebpf/internal/btf/fuzz.go new file mode 100644 index 0000000000..220b285afe --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/fuzz.go @@ -0,0 +1,50 @@ +//go:build gofuzz +// +build gofuzz + +// Use with https://github.com/dvyukov/go-fuzz + +package btf + +import ( + "bytes" + "encoding/binary" + + "github.com/cilium/ebpf/internal" +) + +func FuzzSpec(data []byte) int { + if len(data) < binary.Size(btfHeader{}) { + return -1 + } + + spec, err := loadNakedSpec(bytes.NewReader(data), internal.NativeEndian, nil, nil) + if err != nil { + if spec != nil { + panic("spec is not nil") + } + return 0 + } + if spec == nil { + panic("spec is nil") + } + return 1 +} + +func FuzzExtInfo(data []byte) int { + if len(data) < binary.Size(btfExtHeader{}) { + return -1 + } + + table := stringTable("\x00foo\x00barfoo\x00") + info, err := parseExtInfo(bytes.NewReader(data), internal.NativeEndian, table) + if err != nil { + if info != nil { + panic("info is not nil") + } + return 0 + } + if info == nil { + panic("info is nil") + } + return 1 +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/info.go b/vendor/github.com/cilium/ebpf/internal/btf/info.go new file mode 100644 index 0000000000..6a9b5d2e0b --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/info.go @@ -0,0 +1,48 @@ +package btf + +import ( + "bytes" + + "github.com/cilium/ebpf/internal" +) + +// info describes a BTF object. +type info struct { + BTF *Spec + ID ID + // Name is an identifying name for the BTF, currently only used by the + // kernel. + Name string + // KernelBTF is true if the BTf originated with the kernel and not + // userspace. + KernelBTF bool +} + +func newInfoFromFd(fd *internal.FD) (*info, error) { + // We invoke the syscall once with a empty BTF and name buffers to get size + // information to allocate buffers. Then we invoke it a second time with + // buffers to receive the data. + bpfInfo, err := bpfGetBTFInfoByFD(fd, nil, nil) + if err != nil { + return nil, err + } + + btfBuffer := make([]byte, bpfInfo.btfSize) + nameBuffer := make([]byte, bpfInfo.nameLen) + bpfInfo, err = bpfGetBTFInfoByFD(fd, btfBuffer, nameBuffer) + if err != nil { + return nil, err + } + + spec, err := loadRawSpec(bytes.NewReader(btfBuffer), internal.NativeEndian, nil, nil) + if err != nil { + return nil, err + } + + return &info{ + BTF: spec, + ID: ID(bpfInfo.id), + Name: internal.CString(nameBuffer), + KernelBTF: bpfInfo.kernelBTF != 0, + }, nil +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/strings.go b/vendor/github.com/cilium/ebpf/internal/btf/strings.go new file mode 100644 index 0000000000..9876aa227c --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/strings.go @@ -0,0 +1,54 @@ +package btf + +import ( + "bytes" + "errors" + "fmt" + "io" +) + +type stringTable []byte + +func readStringTable(r io.Reader) (stringTable, error) { + contents, err := io.ReadAll(r) + if err != nil { + return nil, fmt.Errorf("can't read string table: %v", err) + } + + if len(contents) < 1 { + return nil, errors.New("string table is empty") + } + + if contents[0] != '\x00' { + return nil, errors.New("first item in string table is non-empty") + } + + if contents[len(contents)-1] != '\x00' { + return nil, errors.New("string table isn't null terminated") + } + + return stringTable(contents), nil +} + +func (st stringTable) Lookup(offset uint32) (string, error) { + if int64(offset) > int64(^uint(0)>>1) { + return "", fmt.Errorf("offset %d overflows int", offset) + } + + pos := int(offset) + if pos >= len(st) { + return "", fmt.Errorf("offset %d is out of bounds", offset) + } + + if pos > 0 && st[pos-1] != '\x00' { + return "", fmt.Errorf("offset %d isn't start of a string", offset) + } + + str := st[pos:] + end := bytes.IndexByte(str, '\x00') + if end == -1 { + return "", fmt.Errorf("offset %d isn't null terminated", offset) + } + + return string(str[:end]), nil +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/syscalls.go b/vendor/github.com/cilium/ebpf/internal/btf/syscalls.go new file mode 100644 index 0000000000..a4f80abd01 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/syscalls.go @@ -0,0 +1,31 @@ +package btf + +import ( + "fmt" + "unsafe" + + "github.com/cilium/ebpf/internal" +) + +type bpfBTFInfo struct { + btf internal.Pointer + btfSize uint32 + id uint32 + name internal.Pointer + nameLen uint32 + kernelBTF uint32 +} + +func bpfGetBTFInfoByFD(fd *internal.FD, btf, name []byte) (*bpfBTFInfo, error) { + info := bpfBTFInfo{ + btf: internal.NewSlicePointer(btf), + btfSize: uint32(len(btf)), + name: internal.NewSlicePointer(name), + nameLen: uint32(len(name)), + } + if err := internal.BPFObjGetInfoByFD(fd, unsafe.Pointer(&info), unsafe.Sizeof(info)); err != nil { + return nil, fmt.Errorf("can't get program info: %w", err) + } + + return &info, nil +} diff --git a/vendor/github.com/cilium/ebpf/internal/btf/types.go b/vendor/github.com/cilium/ebpf/internal/btf/types.go new file mode 100644 index 0000000000..5c8e7c6e59 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/btf/types.go @@ -0,0 +1,957 @@ +package btf + +import ( + "fmt" + "math" + "strings" +) + +const maxTypeDepth = 32 + +// TypeID identifies a type in a BTF section. +type TypeID uint32 + +// ID implements part of the Type interface. +func (tid TypeID) ID() TypeID { + return tid +} + +// Type represents a type described by BTF. +type Type interface { + ID() TypeID + + String() string + + // Make a copy of the type, without copying Type members. + copy() Type + + // Enumerate all nested Types. Repeated calls must visit nested + // types in the same order. + walk(*typeDeque) +} + +// NamedType is a type with a name. +type NamedType interface { + Type + + // Name of the type, empty for anonymous types. + TypeName() string +} + +var ( + _ NamedType = (*Int)(nil) + _ NamedType = (*Struct)(nil) + _ NamedType = (*Union)(nil) + _ NamedType = (*Enum)(nil) + _ NamedType = (*Fwd)(nil) + _ NamedType = (*Func)(nil) + _ NamedType = (*Typedef)(nil) + _ NamedType = (*Var)(nil) + _ NamedType = (*Datasec)(nil) + _ NamedType = (*Float)(nil) +) + +// Void is the unit type of BTF. +type Void struct{} + +func (v *Void) ID() TypeID { return 0 } +func (v *Void) String() string { return "void#0" } +func (v *Void) size() uint32 { return 0 } +func (v *Void) copy() Type { return (*Void)(nil) } +func (v *Void) walk(*typeDeque) {} + +type IntEncoding byte + +const ( + Signed IntEncoding = 1 << iota + Char + Bool +) + +// Int is an integer of a given length. +type Int struct { + TypeID + Name string + + // The size of the integer in bytes. + Size uint32 + Encoding IntEncoding + // OffsetBits is the starting bit offset. Currently always 0. + // See https://www.kernel.org/doc/html/latest/bpf/btf.html#btf-kind-int + OffsetBits uint32 + Bits byte +} + +func (i *Int) String() string { + var s strings.Builder + + switch { + case i.Encoding&Char != 0: + s.WriteString("char") + case i.Encoding&Bool != 0: + s.WriteString("bool") + default: + if i.Encoding&Signed == 0 { + s.WriteRune('u') + } + s.WriteString("int") + fmt.Fprintf(&s, "%d", i.Size*8) + } + + fmt.Fprintf(&s, "#%d", i.TypeID) + + if i.Bits > 0 { + fmt.Fprintf(&s, "[bits=%d]", i.Bits) + } + + return s.String() +} + +func (i *Int) TypeName() string { return i.Name } +func (i *Int) size() uint32 { return i.Size } +func (i *Int) walk(*typeDeque) {} +func (i *Int) copy() Type { + cpy := *i + return &cpy +} + +func (i *Int) isBitfield() bool { + return i.OffsetBits > 0 +} + +// Pointer is a pointer to another type. +type Pointer struct { + TypeID + Target Type +} + +func (p *Pointer) String() string { + return fmt.Sprintf("pointer#%d[target=#%d]", p.TypeID, p.Target.ID()) +} + +func (p *Pointer) size() uint32 { return 8 } +func (p *Pointer) walk(tdq *typeDeque) { tdq.push(&p.Target) } +func (p *Pointer) copy() Type { + cpy := *p + return &cpy +} + +// Array is an array with a fixed number of elements. +type Array struct { + TypeID + Type Type + Nelems uint32 +} + +func (arr *Array) String() string { + return fmt.Sprintf("array#%d[type=#%d n=%d]", arr.TypeID, arr.Type.ID(), arr.Nelems) +} + +func (arr *Array) walk(tdq *typeDeque) { tdq.push(&arr.Type) } +func (arr *Array) copy() Type { + cpy := *arr + return &cpy +} + +// Struct is a compound type of consecutive members. +type Struct struct { + TypeID + Name string + // The size of the struct including padding, in bytes + Size uint32 + Members []Member +} + +func (s *Struct) String() string { + return fmt.Sprintf("struct#%d[%q]", s.TypeID, s.Name) +} + +func (s *Struct) TypeName() string { return s.Name } + +func (s *Struct) size() uint32 { return s.Size } + +func (s *Struct) walk(tdq *typeDeque) { + for i := range s.Members { + tdq.push(&s.Members[i].Type) + } +} + +func (s *Struct) copy() Type { + cpy := *s + cpy.Members = copyMembers(s.Members) + return &cpy +} + +func (s *Struct) members() []Member { + return s.Members +} + +// Union is a compound type where members occupy the same memory. +type Union struct { + TypeID + Name string + // The size of the union including padding, in bytes. + Size uint32 + Members []Member +} + +func (u *Union) String() string { + return fmt.Sprintf("union#%d[%q]", u.TypeID, u.Name) +} + +func (u *Union) TypeName() string { return u.Name } + +func (u *Union) size() uint32 { return u.Size } + +func (u *Union) walk(tdq *typeDeque) { + for i := range u.Members { + tdq.push(&u.Members[i].Type) + } +} + +func (u *Union) copy() Type { + cpy := *u + cpy.Members = copyMembers(u.Members) + return &cpy +} + +func (u *Union) members() []Member { + return u.Members +} + +func copyMembers(orig []Member) []Member { + cpy := make([]Member, len(orig)) + copy(cpy, orig) + return cpy +} + +type composite interface { + members() []Member +} + +var ( + _ composite = (*Struct)(nil) + _ composite = (*Union)(nil) +) + +// Member is part of a Struct or Union. +// +// It is not a valid Type. +type Member struct { + Name string + Type Type + // OffsetBits is the bit offset of this member. + OffsetBits uint32 + BitfieldSize uint32 +} + +// Enum lists possible values. +type Enum struct { + TypeID + Name string + Values []EnumValue +} + +func (e *Enum) String() string { + return fmt.Sprintf("enum#%d[%q]", e.TypeID, e.Name) +} + +func (e *Enum) TypeName() string { return e.Name } + +// EnumValue is part of an Enum +// +// Is is not a valid Type +type EnumValue struct { + Name string + Value int32 +} + +func (e *Enum) size() uint32 { return 4 } +func (e *Enum) walk(*typeDeque) {} +func (e *Enum) copy() Type { + cpy := *e + cpy.Values = make([]EnumValue, len(e.Values)) + copy(cpy.Values, e.Values) + return &cpy +} + +// FwdKind is the type of forward declaration. +type FwdKind int + +// Valid types of forward declaration. +const ( + FwdStruct FwdKind = iota + FwdUnion +) + +func (fk FwdKind) String() string { + switch fk { + case FwdStruct: + return "struct" + case FwdUnion: + return "union" + default: + return fmt.Sprintf("%T(%d)", fk, int(fk)) + } +} + +// Fwd is a forward declaration of a Type. +type Fwd struct { + TypeID + Name string + Kind FwdKind +} + +func (f *Fwd) String() string { + return fmt.Sprintf("fwd#%d[%s %q]", f.TypeID, f.Kind, f.Name) +} + +func (f *Fwd) TypeName() string { return f.Name } + +func (f *Fwd) walk(*typeDeque) {} +func (f *Fwd) copy() Type { + cpy := *f + return &cpy +} + +// Typedef is an alias of a Type. +type Typedef struct { + TypeID + Name string + Type Type +} + +func (td *Typedef) String() string { + return fmt.Sprintf("typedef#%d[%q #%d]", td.TypeID, td.Name, td.Type.ID()) +} + +func (td *Typedef) TypeName() string { return td.Name } + +func (td *Typedef) walk(tdq *typeDeque) { tdq.push(&td.Type) } +func (td *Typedef) copy() Type { + cpy := *td + return &cpy +} + +// Volatile is a qualifier. +type Volatile struct { + TypeID + Type Type +} + +func (v *Volatile) String() string { + return fmt.Sprintf("volatile#%d[#%d]", v.TypeID, v.Type.ID()) +} + +func (v *Volatile) qualify() Type { return v.Type } +func (v *Volatile) walk(tdq *typeDeque) { tdq.push(&v.Type) } +func (v *Volatile) copy() Type { + cpy := *v + return &cpy +} + +// Const is a qualifier. +type Const struct { + TypeID + Type Type +} + +func (c *Const) String() string { + return fmt.Sprintf("const#%d[#%d]", c.TypeID, c.Type.ID()) +} + +func (c *Const) qualify() Type { return c.Type } +func (c *Const) walk(tdq *typeDeque) { tdq.push(&c.Type) } +func (c *Const) copy() Type { + cpy := *c + return &cpy +} + +// Restrict is a qualifier. +type Restrict struct { + TypeID + Type Type +} + +func (r *Restrict) String() string { + return fmt.Sprintf("restrict#%d[#%d]", r.TypeID, r.Type.ID()) +} + +func (r *Restrict) qualify() Type { return r.Type } +func (r *Restrict) walk(tdq *typeDeque) { tdq.push(&r.Type) } +func (r *Restrict) copy() Type { + cpy := *r + return &cpy +} + +// Func is a function definition. +type Func struct { + TypeID + Name string + Type Type + Linkage FuncLinkage +} + +func (f *Func) String() string { + return fmt.Sprintf("func#%d[%s %q proto=#%d]", f.TypeID, f.Linkage, f.Name, f.Type.ID()) +} + +func (f *Func) TypeName() string { return f.Name } + +func (f *Func) walk(tdq *typeDeque) { tdq.push(&f.Type) } +func (f *Func) copy() Type { + cpy := *f + return &cpy +} + +// FuncProto is a function declaration. +type FuncProto struct { + TypeID + Return Type + Params []FuncParam +} + +func (fp *FuncProto) String() string { + var s strings.Builder + fmt.Fprintf(&s, "proto#%d[", fp.TypeID) + for _, param := range fp.Params { + fmt.Fprintf(&s, "%q=#%d, ", param.Name, param.Type.ID()) + } + fmt.Fprintf(&s, "return=#%d]", fp.Return.ID()) + return s.String() +} + +func (fp *FuncProto) walk(tdq *typeDeque) { + tdq.push(&fp.Return) + for i := range fp.Params { + tdq.push(&fp.Params[i].Type) + } +} + +func (fp *FuncProto) copy() Type { + cpy := *fp + cpy.Params = make([]FuncParam, len(fp.Params)) + copy(cpy.Params, fp.Params) + return &cpy +} + +type FuncParam struct { + Name string + Type Type +} + +// Var is a global variable. +type Var struct { + TypeID + Name string + Type Type + Linkage VarLinkage +} + +func (v *Var) String() string { + return fmt.Sprintf("var#%d[%s %q]", v.TypeID, v.Linkage, v.Name) +} + +func (v *Var) TypeName() string { return v.Name } + +func (v *Var) walk(tdq *typeDeque) { tdq.push(&v.Type) } +func (v *Var) copy() Type { + cpy := *v + return &cpy +} + +// Datasec is a global program section containing data. +type Datasec struct { + TypeID + Name string + Size uint32 + Vars []VarSecinfo +} + +func (ds *Datasec) String() string { + return fmt.Sprintf("section#%d[%q]", ds.TypeID, ds.Name) +} + +func (ds *Datasec) TypeName() string { return ds.Name } + +func (ds *Datasec) size() uint32 { return ds.Size } + +func (ds *Datasec) walk(tdq *typeDeque) { + for i := range ds.Vars { + tdq.push(&ds.Vars[i].Type) + } +} + +func (ds *Datasec) copy() Type { + cpy := *ds + cpy.Vars = make([]VarSecinfo, len(ds.Vars)) + copy(cpy.Vars, ds.Vars) + return &cpy +} + +// VarSecinfo describes variable in a Datasec. +// +// It is not a valid Type. +type VarSecinfo struct { + Type Type + Offset uint32 + Size uint32 +} + +// Float is a float of a given length. +type Float struct { + TypeID + Name string + + // The size of the float in bytes. + Size uint32 +} + +func (f *Float) String() string { + return fmt.Sprintf("float%d#%d[%q]", f.Size*8, f.TypeID, f.Name) +} + +func (f *Float) TypeName() string { return f.Name } +func (f *Float) size() uint32 { return f.Size } +func (f *Float) walk(*typeDeque) {} +func (f *Float) copy() Type { + cpy := *f + return &cpy +} + +type sizer interface { + size() uint32 +} + +var ( + _ sizer = (*Int)(nil) + _ sizer = (*Pointer)(nil) + _ sizer = (*Struct)(nil) + _ sizer = (*Union)(nil) + _ sizer = (*Enum)(nil) + _ sizer = (*Datasec)(nil) +) + +type qualifier interface { + qualify() Type +} + +var ( + _ qualifier = (*Const)(nil) + _ qualifier = (*Restrict)(nil) + _ qualifier = (*Volatile)(nil) +) + +// Sizeof returns the size of a type in bytes. +// +// Returns an error if the size can't be computed. +func Sizeof(typ Type) (int, error) { + var ( + n = int64(1) + elem int64 + ) + + for i := 0; i < maxTypeDepth; i++ { + switch v := typ.(type) { + case *Array: + if n > 0 && int64(v.Nelems) > math.MaxInt64/n { + return 0, fmt.Errorf("type %s: overflow", typ) + } + + // Arrays may be of zero length, which allows + // n to be zero as well. + n *= int64(v.Nelems) + typ = v.Type + continue + + case sizer: + elem = int64(v.size()) + + case *Typedef: + typ = v.Type + continue + + case qualifier: + typ = v.qualify() + continue + + default: + return 0, fmt.Errorf("unsized type %T", typ) + } + + if n > 0 && elem > math.MaxInt64/n { + return 0, fmt.Errorf("type %s: overflow", typ) + } + + size := n * elem + if int64(int(size)) != size { + return 0, fmt.Errorf("type %s: overflow", typ) + } + + return int(size), nil + } + + return 0, fmt.Errorf("type %s: exceeded type depth", typ) +} + +// copy a Type recursively. +// +// typ may form a cycle. +// +// Returns any errors from transform verbatim. +func copyType(typ Type, transform func(Type) (Type, error)) (Type, error) { + copies := make(copier) + return typ, copies.copy(&typ, transform) +} + +// copy a slice of Types recursively. +// +// Types may form a cycle. +// +// Returns any errors from transform verbatim. +func copyTypes(types []Type, transform func(Type) (Type, error)) ([]Type, error) { + result := make([]Type, len(types)) + copy(result, types) + + copies := make(copier) + for i := range result { + if err := copies.copy(&result[i], transform); err != nil { + return nil, err + } + } + + return result, nil +} + +type copier map[Type]Type + +func (c copier) copy(typ *Type, transform func(Type) (Type, error)) error { + var work typeDeque + for t := typ; t != nil; t = work.pop() { + // *t is the identity of the type. + if cpy := c[*t]; cpy != nil { + *t = cpy + continue + } + + var cpy Type + if transform != nil { + tf, err := transform(*t) + if err != nil { + return fmt.Errorf("copy %s: %w", *t, err) + } + cpy = tf.copy() + } else { + cpy = (*t).copy() + } + + c[*t] = cpy + *t = cpy + + // Mark any nested types for copying. + cpy.walk(&work) + } + + return nil +} + +// typeDeque keeps track of pointers to types which still +// need to be visited. +type typeDeque struct { + types []*Type + read, write uint64 + mask uint64 +} + +func (dq *typeDeque) empty() bool { + return dq.read == dq.write +} + +// push adds a type to the stack. +func (dq *typeDeque) push(t *Type) { + if dq.write-dq.read < uint64(len(dq.types)) { + dq.types[dq.write&dq.mask] = t + dq.write++ + return + } + + new := len(dq.types) * 2 + if new == 0 { + new = 8 + } + + types := make([]*Type, new) + pivot := dq.read & dq.mask + n := copy(types, dq.types[pivot:]) + n += copy(types[n:], dq.types[:pivot]) + types[n] = t + + dq.types = types + dq.mask = uint64(new) - 1 + dq.read, dq.write = 0, uint64(n+1) +} + +// shift returns the first element or null. +func (dq *typeDeque) shift() *Type { + if dq.empty() { + return nil + } + + index := dq.read & dq.mask + t := dq.types[index] + dq.types[index] = nil + dq.read++ + return t +} + +// pop returns the last element or null. +func (dq *typeDeque) pop() *Type { + if dq.empty() { + return nil + } + + dq.write-- + index := dq.write & dq.mask + t := dq.types[index] + dq.types[index] = nil + return t +} + +// all returns all elements. +// +// The deque is empty after calling this method. +func (dq *typeDeque) all() []*Type { + length := dq.write - dq.read + types := make([]*Type, 0, length) + for t := dq.shift(); t != nil; t = dq.shift() { + types = append(types, t) + } + return types +} + +// inflateRawTypes takes a list of raw btf types linked via type IDs, and turns +// it into a graph of Types connected via pointers. +// +// Returns a map of named types (so, where NameOff is non-zero) and a slice of types +// indexed by TypeID. Since BTF ignores compilation units, multiple types may share +// the same name. A Type may form a cyclic graph by pointing at itself. +func inflateRawTypes(rawTypes []rawType, rawStrings stringTable) (types []Type, namedTypes map[string][]NamedType, err error) { + type fixupDef struct { + id TypeID + expectedKind btfKind + typ *Type + } + + var fixups []fixupDef + fixup := func(id TypeID, expectedKind btfKind, typ *Type) { + fixups = append(fixups, fixupDef{id, expectedKind, typ}) + } + + convertMembers := func(raw []btfMember, kindFlag bool) ([]Member, error) { + // NB: The fixup below relies on pre-allocating this array to + // work, since otherwise append might re-allocate members. + members := make([]Member, 0, len(raw)) + for i, btfMember := range raw { + name, err := rawStrings.Lookup(btfMember.NameOff) + if err != nil { + return nil, fmt.Errorf("can't get name for member %d: %w", i, err) + } + m := Member{ + Name: name, + OffsetBits: btfMember.Offset, + } + if kindFlag { + m.BitfieldSize = btfMember.Offset >> 24 + m.OffsetBits &= 0xffffff + } + members = append(members, m) + } + for i := range members { + fixup(raw[i].Type, kindUnknown, &members[i].Type) + } + return members, nil + } + + types = make([]Type, 0, len(rawTypes)) + types = append(types, (*Void)(nil)) + namedTypes = make(map[string][]NamedType) + + for i, raw := range rawTypes { + var ( + // Void is defined to always be type ID 0, and is thus + // omitted from BTF. + id = TypeID(i + 1) + typ Type + ) + + name, err := rawStrings.Lookup(raw.NameOff) + if err != nil { + return nil, nil, fmt.Errorf("get name for type id %d: %w", id, err) + } + + switch raw.Kind() { + case kindInt: + encoding, offset, bits := intEncoding(*raw.data.(*uint32)) + typ = &Int{id, name, raw.Size(), encoding, offset, bits} + + case kindPointer: + ptr := &Pointer{id, nil} + fixup(raw.Type(), kindUnknown, &ptr.Target) + typ = ptr + + case kindArray: + btfArr := raw.data.(*btfArray) + + // IndexType is unused according to btf.rst. + // Don't make it available right now. + arr := &Array{id, nil, btfArr.Nelems} + fixup(btfArr.Type, kindUnknown, &arr.Type) + typ = arr + + case kindStruct: + members, err := convertMembers(raw.data.([]btfMember), raw.KindFlag()) + if err != nil { + return nil, nil, fmt.Errorf("struct %s (id %d): %w", name, id, err) + } + typ = &Struct{id, name, raw.Size(), members} + + case kindUnion: + members, err := convertMembers(raw.data.([]btfMember), raw.KindFlag()) + if err != nil { + return nil, nil, fmt.Errorf("union %s (id %d): %w", name, id, err) + } + typ = &Union{id, name, raw.Size(), members} + + case kindEnum: + rawvals := raw.data.([]btfEnum) + vals := make([]EnumValue, 0, len(rawvals)) + for i, btfVal := range rawvals { + name, err := rawStrings.Lookup(btfVal.NameOff) + if err != nil { + return nil, nil, fmt.Errorf("get name for enum value %d: %s", i, err) + } + vals = append(vals, EnumValue{ + Name: name, + Value: btfVal.Val, + }) + } + typ = &Enum{id, name, vals} + + case kindForward: + if raw.KindFlag() { + typ = &Fwd{id, name, FwdUnion} + } else { + typ = &Fwd{id, name, FwdStruct} + } + + case kindTypedef: + typedef := &Typedef{id, name, nil} + fixup(raw.Type(), kindUnknown, &typedef.Type) + typ = typedef + + case kindVolatile: + volatile := &Volatile{id, nil} + fixup(raw.Type(), kindUnknown, &volatile.Type) + typ = volatile + + case kindConst: + cnst := &Const{id, nil} + fixup(raw.Type(), kindUnknown, &cnst.Type) + typ = cnst + + case kindRestrict: + restrict := &Restrict{id, nil} + fixup(raw.Type(), kindUnknown, &restrict.Type) + typ = restrict + + case kindFunc: + fn := &Func{id, name, nil, raw.Linkage()} + fixup(raw.Type(), kindFuncProto, &fn.Type) + typ = fn + + case kindFuncProto: + rawparams := raw.data.([]btfParam) + params := make([]FuncParam, 0, len(rawparams)) + for i, param := range rawparams { + name, err := rawStrings.Lookup(param.NameOff) + if err != nil { + return nil, nil, fmt.Errorf("get name for func proto parameter %d: %s", i, err) + } + params = append(params, FuncParam{ + Name: name, + }) + } + for i := range params { + fixup(rawparams[i].Type, kindUnknown, ¶ms[i].Type) + } + + fp := &FuncProto{id, nil, params} + fixup(raw.Type(), kindUnknown, &fp.Return) + typ = fp + + case kindVar: + variable := raw.data.(*btfVariable) + v := &Var{id, name, nil, VarLinkage(variable.Linkage)} + fixup(raw.Type(), kindUnknown, &v.Type) + typ = v + + case kindDatasec: + btfVars := raw.data.([]btfVarSecinfo) + vars := make([]VarSecinfo, 0, len(btfVars)) + for _, btfVar := range btfVars { + vars = append(vars, VarSecinfo{ + Offset: btfVar.Offset, + Size: btfVar.Size, + }) + } + for i := range vars { + fixup(btfVars[i].Type, kindVar, &vars[i].Type) + } + typ = &Datasec{id, name, raw.SizeType, vars} + + case kindFloat: + typ = &Float{id, name, raw.Size()} + + default: + return nil, nil, fmt.Errorf("type id %d: unknown kind: %v", id, raw.Kind()) + } + + types = append(types, typ) + + if named, ok := typ.(NamedType); ok { + if name := essentialName(named.TypeName()); name != "" { + namedTypes[name] = append(namedTypes[name], named) + } + } + } + + for _, fixup := range fixups { + i := int(fixup.id) + if i >= len(types) { + return nil, nil, fmt.Errorf("reference to invalid type id: %d", fixup.id) + } + + // Default void (id 0) to unknown + rawKind := kindUnknown + if i > 0 { + rawKind = rawTypes[i-1].Kind() + } + + if expected := fixup.expectedKind; expected != kindUnknown && rawKind != expected { + return nil, nil, fmt.Errorf("expected type id %d to have kind %s, found %s", fixup.id, expected, rawKind) + } + + *fixup.typ = types[i] + } + + return types, namedTypes, nil +} + +// essentialName returns name without a ___ suffix. +func essentialName(name string) string { + lastIdx := strings.LastIndex(name, "___") + if lastIdx > 0 { + return name[:lastIdx] + } + return name +} diff --git a/vendor/github.com/cilium/ebpf/internal/cpu.go b/vendor/github.com/cilium/ebpf/internal/cpu.go new file mode 100644 index 0000000000..3affa1efb9 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/cpu.go @@ -0,0 +1,62 @@ +package internal + +import ( + "fmt" + "os" + "strings" + "sync" +) + +var sysCPU struct { + once sync.Once + err error + num int +} + +// PossibleCPUs returns the max number of CPUs a system may possibly have +// Logical CPU numbers must be of the form 0-n +func PossibleCPUs() (int, error) { + sysCPU.once.Do(func() { + sysCPU.num, sysCPU.err = parseCPUsFromFile("/sys/devices/system/cpu/possible") + }) + + return sysCPU.num, sysCPU.err +} + +func parseCPUsFromFile(path string) (int, error) { + spec, err := os.ReadFile(path) + if err != nil { + return 0, err + } + + n, err := parseCPUs(string(spec)) + if err != nil { + return 0, fmt.Errorf("can't parse %s: %v", path, err) + } + + return n, nil +} + +// parseCPUs parses the number of cpus from a string produced +// by bitmap_list_string() in the Linux kernel. +// Multiple ranges are rejected, since they can't be unified +// into a single number. +// This is the format of /sys/devices/system/cpu/possible, it +// is not suitable for /sys/devices/system/cpu/online, etc. +func parseCPUs(spec string) (int, error) { + if strings.Trim(spec, "\n") == "0" { + return 1, nil + } + + var low, high int + n, err := fmt.Sscanf(spec, "%d-%d\n", &low, &high) + if n != 2 || err != nil { + return 0, fmt.Errorf("invalid format: %s", spec) + } + if low != 0 { + return 0, fmt.Errorf("CPU spec doesn't start at zero: %s", spec) + } + + // cpus is 0 indexed + return high + 1, nil +} diff --git a/vendor/github.com/cilium/ebpf/internal/elf.go b/vendor/github.com/cilium/ebpf/internal/elf.go new file mode 100644 index 0000000000..54a4313130 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/elf.go @@ -0,0 +1,68 @@ +package internal + +import ( + "debug/elf" + "fmt" + "io" +) + +type SafeELFFile struct { + *elf.File +} + +// NewSafeELFFile reads an ELF safely. +// +// Any panic during parsing is turned into an error. This is necessary since +// there are a bunch of unfixed bugs in debug/elf. +// +// https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+debug%2Felf+in%3Atitle +func NewSafeELFFile(r io.ReaderAt) (safe *SafeELFFile, err error) { + defer func() { + r := recover() + if r == nil { + return + } + + safe = nil + err = fmt.Errorf("reading ELF file panicked: %s", r) + }() + + file, err := elf.NewFile(r) + if err != nil { + return nil, err + } + + return &SafeELFFile{file}, nil +} + +// Symbols is the safe version of elf.File.Symbols. +func (se *SafeELFFile) Symbols() (syms []elf.Symbol, err error) { + defer func() { + r := recover() + if r == nil { + return + } + + syms = nil + err = fmt.Errorf("reading ELF symbols panicked: %s", r) + }() + + syms, err = se.File.Symbols() + return +} + +// DynamicSymbols is the safe version of elf.File.DynamicSymbols. +func (se *SafeELFFile) DynamicSymbols() (syms []elf.Symbol, err error) { + defer func() { + r := recover() + if r == nil { + return + } + + syms = nil + err = fmt.Errorf("reading ELF dynamic symbols panicked: %s", r) + }() + + syms, err = se.File.DynamicSymbols() + return +} diff --git a/vendor/github.com/cilium/ebpf/internal/endian.go b/vendor/github.com/cilium/ebpf/internal/endian.go new file mode 100644 index 0000000000..6ae99fcd5f --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/endian.go @@ -0,0 +1,29 @@ +package internal + +import ( + "encoding/binary" + "unsafe" +) + +// NativeEndian is set to either binary.BigEndian or binary.LittleEndian, +// depending on the host's endianness. +var NativeEndian binary.ByteOrder + +// Clang is set to either "el" or "eb" depending on the host's endianness. +var ClangEndian string + +func init() { + if isBigEndian() { + NativeEndian = binary.BigEndian + ClangEndian = "eb" + } else { + NativeEndian = binary.LittleEndian + ClangEndian = "el" + } +} + +func isBigEndian() (ret bool) { + i := int(0x1) + bs := (*[int(unsafe.Sizeof(i))]byte)(unsafe.Pointer(&i)) + return bs[0] == 0 +} diff --git a/vendor/github.com/cilium/ebpf/internal/errors.go b/vendor/github.com/cilium/ebpf/internal/errors.go new file mode 100644 index 0000000000..877bd72ee2 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/errors.go @@ -0,0 +1,51 @@ +package internal + +import ( + "bytes" + "errors" + "fmt" + "strings" + + "github.com/cilium/ebpf/internal/unix" +) + +// ErrorWithLog returns an error that includes logs from the +// kernel verifier. +// +// logErr should be the error returned by the syscall that generated +// the log. It is used to check for truncation of the output. +func ErrorWithLog(err error, log []byte, logErr error) error { + logStr := strings.Trim(CString(log), "\t\r\n ") + if errors.Is(logErr, unix.ENOSPC) { + logStr += " (truncated...)" + } + + return &VerifierError{err, logStr} +} + +// VerifierError includes information from the eBPF verifier. +type VerifierError struct { + cause error + log string +} + +func (le *VerifierError) Unwrap() error { + return le.cause +} + +func (le *VerifierError) Error() string { + if le.log == "" { + return le.cause.Error() + } + + return fmt.Sprintf("%s: %s", le.cause, le.log) +} + +// CString turns a NUL / zero terminated byte buffer into a string. +func CString(in []byte) string { + inLen := bytes.IndexByte(in, 0) + if inLen == -1 { + return "" + } + return string(in[:inLen]) +} diff --git a/vendor/github.com/cilium/ebpf/internal/fd.go b/vendor/github.com/cilium/ebpf/internal/fd.go new file mode 100644 index 0000000000..af04955bd5 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/fd.go @@ -0,0 +1,69 @@ +package internal + +import ( + "errors" + "fmt" + "os" + "runtime" + "strconv" + + "github.com/cilium/ebpf/internal/unix" +) + +var ErrClosedFd = errors.New("use of closed file descriptor") + +type FD struct { + raw int64 +} + +func NewFD(value uint32) *FD { + fd := &FD{int64(value)} + runtime.SetFinalizer(fd, (*FD).Close) + return fd +} + +func (fd *FD) String() string { + return strconv.FormatInt(fd.raw, 10) +} + +func (fd *FD) Value() (uint32, error) { + if fd.raw < 0 { + return 0, ErrClosedFd + } + + return uint32(fd.raw), nil +} + +func (fd *FD) Close() error { + if fd.raw < 0 { + return nil + } + + value := int(fd.raw) + fd.raw = -1 + + fd.Forget() + return unix.Close(value) +} + +func (fd *FD) Forget() { + runtime.SetFinalizer(fd, nil) +} + +func (fd *FD) Dup() (*FD, error) { + if fd.raw < 0 { + return nil, ErrClosedFd + } + + dup, err := unix.FcntlInt(uintptr(fd.raw), unix.F_DUPFD_CLOEXEC, 0) + if err != nil { + return nil, fmt.Errorf("can't dup fd: %v", err) + } + + return NewFD(uint32(dup)), nil +} + +func (fd *FD) File(name string) *os.File { + fd.Forget() + return os.NewFile(uintptr(fd.raw), name) +} diff --git a/vendor/github.com/cilium/ebpf/internal/feature.go b/vendor/github.com/cilium/ebpf/internal/feature.go new file mode 100644 index 0000000000..c94a2e1ee0 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/feature.go @@ -0,0 +1,100 @@ +package internal + +import ( + "errors" + "fmt" + "sync" +) + +// ErrNotSupported indicates that a feature is not supported by the current kernel. +var ErrNotSupported = errors.New("not supported") + +// UnsupportedFeatureError is returned by FeatureTest() functions. +type UnsupportedFeatureError struct { + // The minimum Linux mainline version required for this feature. + // Used for the error string, and for sanity checking during testing. + MinimumVersion Version + + // The name of the feature that isn't supported. + Name string +} + +func (ufe *UnsupportedFeatureError) Error() string { + if ufe.MinimumVersion.Unspecified() { + return fmt.Sprintf("%s not supported", ufe.Name) + } + return fmt.Sprintf("%s not supported (requires >= %s)", ufe.Name, ufe.MinimumVersion) +} + +// Is indicates that UnsupportedFeatureError is ErrNotSupported. +func (ufe *UnsupportedFeatureError) Is(target error) bool { + return target == ErrNotSupported +} + +type featureTest struct { + sync.RWMutex + successful bool + result error +} + +// FeatureTestFn is used to determine whether the kernel supports +// a certain feature. +// +// The return values have the following semantics: +// +// err == ErrNotSupported: the feature is not available +// err == nil: the feature is available +// err != nil: the test couldn't be executed +type FeatureTestFn func() error + +// FeatureTest wraps a function so that it is run at most once. +// +// name should identify the tested feature, while version must be in the +// form Major.Minor[.Patch]. +// +// Returns an error wrapping ErrNotSupported if the feature is not supported. +func FeatureTest(name, version string, fn FeatureTestFn) func() error { + v, err := NewVersion(version) + if err != nil { + return func() error { return err } + } + + ft := new(featureTest) + return func() error { + ft.RLock() + if ft.successful { + defer ft.RUnlock() + return ft.result + } + ft.RUnlock() + ft.Lock() + defer ft.Unlock() + // check one more time on the off + // chance that two go routines + // were able to call into the write + // lock + if ft.successful { + return ft.result + } + err := fn() + switch { + case errors.Is(err, ErrNotSupported): + ft.result = &UnsupportedFeatureError{ + MinimumVersion: v, + Name: name, + } + fallthrough + + case err == nil: + ft.successful = true + + default: + // We couldn't execute the feature test to a point + // where it could make a determination. + // Don't cache the result, just return it. + return fmt.Errorf("detect support for %s: %w", name, err) + } + + return ft.result + } +} diff --git a/vendor/github.com/cilium/ebpf/internal/io.go b/vendor/github.com/cilium/ebpf/internal/io.go new file mode 100644 index 0000000000..fa7402782d --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/io.go @@ -0,0 +1,16 @@ +package internal + +import "errors" + +// DiscardZeroes makes sure that all written bytes are zero +// before discarding them. +type DiscardZeroes struct{} + +func (DiscardZeroes) Write(p []byte) (int, error) { + for _, b := range p { + if b != 0 { + return 0, errors.New("encountered non-zero byte") + } + } + return len(p), nil +} diff --git a/vendor/github.com/cilium/ebpf/internal/pinning.go b/vendor/github.com/cilium/ebpf/internal/pinning.go new file mode 100644 index 0000000000..5329b432d7 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/pinning.go @@ -0,0 +1,44 @@ +package internal + +import ( + "errors" + "fmt" + "os" + + "github.com/cilium/ebpf/internal/unix" +) + +func Pin(currentPath, newPath string, fd *FD) error { + if newPath == "" { + return errors.New("given pinning path cannot be empty") + } + if currentPath == newPath { + return nil + } + if currentPath == "" { + return BPFObjPin(newPath, fd) + } + var err error + // Renameat2 is used instead of os.Rename to disallow the new path replacing + // an existing path. + if err = unix.Renameat2(unix.AT_FDCWD, currentPath, unix.AT_FDCWD, newPath, unix.RENAME_NOREPLACE); err == nil { + // Object is now moved to the new pinning path. + return nil + } + if !os.IsNotExist(err) { + return fmt.Errorf("unable to move pinned object to new path %v: %w", newPath, err) + } + // Internal state not in sync with the file system so let's fix it. + return BPFObjPin(newPath, fd) +} + +func Unpin(pinnedPath string) error { + if pinnedPath == "" { + return nil + } + err := os.Remove(pinnedPath) + if err == nil || os.IsNotExist(err) { + return nil + } + return err +} diff --git a/vendor/github.com/cilium/ebpf/internal/ptr.go b/vendor/github.com/cilium/ebpf/internal/ptr.go new file mode 100644 index 0000000000..f295de72cf --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/ptr.go @@ -0,0 +1,31 @@ +package internal + +import ( + "unsafe" + + "github.com/cilium/ebpf/internal/unix" +) + +// NewPointer creates a 64-bit pointer from an unsafe Pointer. +func NewPointer(ptr unsafe.Pointer) Pointer { + return Pointer{ptr: ptr} +} + +// NewSlicePointer creates a 64-bit pointer from a byte slice. +func NewSlicePointer(buf []byte) Pointer { + if len(buf) == 0 { + return Pointer{} + } + + return Pointer{ptr: unsafe.Pointer(&buf[0])} +} + +// NewStringPointer creates a 64-bit pointer from a string. +func NewStringPointer(str string) Pointer { + p, err := unix.BytePtrFromString(str) + if err != nil { + return Pointer{} + } + + return Pointer{ptr: unsafe.Pointer(p)} +} diff --git a/vendor/github.com/cilium/ebpf/internal/ptr_32_be.go b/vendor/github.com/cilium/ebpf/internal/ptr_32_be.go new file mode 100644 index 0000000000..8c114ddf47 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/ptr_32_be.go @@ -0,0 +1,15 @@ +//go:build armbe || mips || mips64p32 +// +build armbe mips mips64p32 + +package internal + +import ( + "unsafe" +) + +// Pointer wraps an unsafe.Pointer to be 64bit to +// conform to the syscall specification. +type Pointer struct { + pad uint32 + ptr unsafe.Pointer +} diff --git a/vendor/github.com/cilium/ebpf/internal/ptr_32_le.go b/vendor/github.com/cilium/ebpf/internal/ptr_32_le.go new file mode 100644 index 0000000000..e65a61e45d --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/ptr_32_le.go @@ -0,0 +1,15 @@ +//go:build 386 || amd64p32 || arm || mipsle || mips64p32le +// +build 386 amd64p32 arm mipsle mips64p32le + +package internal + +import ( + "unsafe" +) + +// Pointer wraps an unsafe.Pointer to be 64bit to +// conform to the syscall specification. +type Pointer struct { + ptr unsafe.Pointer + pad uint32 +} diff --git a/vendor/github.com/cilium/ebpf/internal/ptr_64.go b/vendor/github.com/cilium/ebpf/internal/ptr_64.go new file mode 100644 index 0000000000..71a3afe307 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/ptr_64.go @@ -0,0 +1,14 @@ +//go:build !386 && !amd64p32 && !arm && !mipsle && !mips64p32le && !armbe && !mips && !mips64p32 +// +build !386,!amd64p32,!arm,!mipsle,!mips64p32le,!armbe,!mips,!mips64p32 + +package internal + +import ( + "unsafe" +) + +// Pointer wraps an unsafe.Pointer to be 64bit to +// conform to the syscall specification. +type Pointer struct { + ptr unsafe.Pointer +} diff --git a/vendor/github.com/cilium/ebpf/internal/syscall.go b/vendor/github.com/cilium/ebpf/internal/syscall.go new file mode 100644 index 0000000000..b75037bb9d --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/syscall.go @@ -0,0 +1,304 @@ +package internal + +import ( + "errors" + "fmt" + "path/filepath" + "runtime" + "syscall" + "unsafe" + + "github.com/cilium/ebpf/internal/unix" +) + +//go:generate stringer -output syscall_string.go -type=BPFCmd + +// BPFCmd identifies a subcommand of the bpf syscall. +type BPFCmd int + +// Well known BPF commands. +const ( + BPF_MAP_CREATE BPFCmd = iota + BPF_MAP_LOOKUP_ELEM + BPF_MAP_UPDATE_ELEM + BPF_MAP_DELETE_ELEM + BPF_MAP_GET_NEXT_KEY + BPF_PROG_LOAD + BPF_OBJ_PIN + BPF_OBJ_GET + BPF_PROG_ATTACH + BPF_PROG_DETACH + BPF_PROG_TEST_RUN + BPF_PROG_GET_NEXT_ID + BPF_MAP_GET_NEXT_ID + BPF_PROG_GET_FD_BY_ID + BPF_MAP_GET_FD_BY_ID + BPF_OBJ_GET_INFO_BY_FD + BPF_PROG_QUERY + BPF_RAW_TRACEPOINT_OPEN + BPF_BTF_LOAD + BPF_BTF_GET_FD_BY_ID + BPF_TASK_FD_QUERY + BPF_MAP_LOOKUP_AND_DELETE_ELEM + BPF_MAP_FREEZE + BPF_BTF_GET_NEXT_ID + BPF_MAP_LOOKUP_BATCH + BPF_MAP_LOOKUP_AND_DELETE_BATCH + BPF_MAP_UPDATE_BATCH + BPF_MAP_DELETE_BATCH + BPF_LINK_CREATE + BPF_LINK_UPDATE + BPF_LINK_GET_FD_BY_ID + BPF_LINK_GET_NEXT_ID + BPF_ENABLE_STATS + BPF_ITER_CREATE +) + +// BPF wraps SYS_BPF. +// +// Any pointers contained in attr must use the Pointer type from this package. +func BPF(cmd BPFCmd, attr unsafe.Pointer, size uintptr) (uintptr, error) { + r1, _, errNo := unix.Syscall(unix.SYS_BPF, uintptr(cmd), uintptr(attr), size) + runtime.KeepAlive(attr) + + var err error + if errNo != 0 { + err = wrappedErrno{errNo} + } + + return r1, err +} + +type BPFProgLoadAttr struct { + ProgType uint32 + InsCount uint32 + Instructions Pointer + License Pointer + LogLevel uint32 + LogSize uint32 + LogBuf Pointer + KernelVersion uint32 // since 4.1 2541517c32be + ProgFlags uint32 // since 4.11 e07b98d9bffe + ProgName BPFObjName // since 4.15 067cae47771c + ProgIfIndex uint32 // since 4.15 1f6f4cb7ba21 + ExpectedAttachType uint32 // since 4.17 5e43f899b03a + ProgBTFFd uint32 + FuncInfoRecSize uint32 + FuncInfo Pointer + FuncInfoCnt uint32 + LineInfoRecSize uint32 + LineInfo Pointer + LineInfoCnt uint32 + AttachBTFID uint32 + AttachProgFd uint32 +} + +// BPFProgLoad wraps BPF_PROG_LOAD. +func BPFProgLoad(attr *BPFProgLoadAttr) (*FD, error) { + for { + fd, err := BPF(BPF_PROG_LOAD, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + // As of ~4.20 the verifier can be interrupted by a signal, + // and returns EAGAIN in that case. + if errors.Is(err, unix.EAGAIN) { + continue + } + + if err != nil { + return nil, err + } + + return NewFD(uint32(fd)), nil + } +} + +type BPFProgAttachAttr struct { + TargetFd uint32 + AttachBpfFd uint32 + AttachType uint32 + AttachFlags uint32 + ReplaceBpfFd uint32 +} + +func BPFProgAttach(attr *BPFProgAttachAttr) error { + _, err := BPF(BPF_PROG_ATTACH, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + return err +} + +type BPFProgDetachAttr struct { + TargetFd uint32 + AttachBpfFd uint32 + AttachType uint32 +} + +func BPFProgDetach(attr *BPFProgDetachAttr) error { + _, err := BPF(BPF_PROG_DETACH, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + return err +} + +type BPFEnableStatsAttr struct { + StatsType uint32 +} + +func BPFEnableStats(attr *BPFEnableStatsAttr) (*FD, error) { + ptr, err := BPF(BPF_ENABLE_STATS, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + if err != nil { + return nil, fmt.Errorf("enable stats: %w", err) + } + return NewFD(uint32(ptr)), nil + +} + +type bpfObjAttr struct { + fileName Pointer + fd uint32 + fileFlags uint32 +} + +const bpfFSType = 0xcafe4a11 + +// BPFObjPin wraps BPF_OBJ_PIN. +func BPFObjPin(fileName string, fd *FD) error { + dirName := filepath.Dir(fileName) + var statfs unix.Statfs_t + if err := unix.Statfs(dirName, &statfs); err != nil { + return err + } + if uint64(statfs.Type) != bpfFSType { + return fmt.Errorf("%s is not on a bpf filesystem", fileName) + } + + value, err := fd.Value() + if err != nil { + return err + } + + attr := bpfObjAttr{ + fileName: NewStringPointer(fileName), + fd: value, + } + _, err = BPF(BPF_OBJ_PIN, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + if err != nil { + return fmt.Errorf("pin object %s: %w", fileName, err) + } + return nil +} + +// BPFObjGet wraps BPF_OBJ_GET. +func BPFObjGet(fileName string, flags uint32) (*FD, error) { + attr := bpfObjAttr{ + fileName: NewStringPointer(fileName), + fileFlags: flags, + } + ptr, err := BPF(BPF_OBJ_GET, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + if err != nil { + return nil, fmt.Errorf("get object %s: %w", fileName, err) + } + return NewFD(uint32(ptr)), nil +} + +type bpfObjGetInfoByFDAttr struct { + fd uint32 + infoLen uint32 + info Pointer +} + +// BPFObjGetInfoByFD wraps BPF_OBJ_GET_INFO_BY_FD. +// +// Available from 4.13. +func BPFObjGetInfoByFD(fd *FD, info unsafe.Pointer, size uintptr) error { + value, err := fd.Value() + if err != nil { + return err + } + + attr := bpfObjGetInfoByFDAttr{ + fd: value, + infoLen: uint32(size), + info: NewPointer(info), + } + _, err = BPF(BPF_OBJ_GET_INFO_BY_FD, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + if err != nil { + return fmt.Errorf("fd %v: %w", fd, err) + } + return nil +} + +type bpfGetFDByIDAttr struct { + id uint32 + next uint32 +} + +// BPFObjGetInfoByFD wraps BPF_*_GET_FD_BY_ID. +// +// Available from 4.13. +func BPFObjGetFDByID(cmd BPFCmd, id uint32) (*FD, error) { + attr := bpfGetFDByIDAttr{ + id: id, + } + ptr, err := BPF(cmd, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + return NewFD(uint32(ptr)), err +} + +// BPFObjName is a null-terminated string made up of +// 'A-Za-z0-9_' characters. +type BPFObjName [unix.BPF_OBJ_NAME_LEN]byte + +// NewBPFObjName truncates the result if it is too long. +func NewBPFObjName(name string) BPFObjName { + var result BPFObjName + copy(result[:unix.BPF_OBJ_NAME_LEN-1], name) + return result +} + +type BPFMapCreateAttr struct { + MapType uint32 + KeySize uint32 + ValueSize uint32 + MaxEntries uint32 + Flags uint32 + InnerMapFd uint32 // since 4.12 56f668dfe00d + NumaNode uint32 // since 4.14 96eabe7a40aa + MapName BPFObjName // since 4.15 ad5b177bd73f + MapIfIndex uint32 + BTFFd uint32 + BTFKeyTypeID uint32 + BTFValueTypeID uint32 +} + +func BPFMapCreate(attr *BPFMapCreateAttr) (*FD, error) { + fd, err := BPF(BPF_MAP_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + if err != nil { + return nil, err + } + + return NewFD(uint32(fd)), nil +} + +// wrappedErrno wraps syscall.Errno to prevent direct comparisons with +// syscall.E* or unix.E* constants. +// +// You should never export an error of this type. +type wrappedErrno struct { + syscall.Errno +} + +func (we wrappedErrno) Unwrap() error { + return we.Errno +} + +type syscallError struct { + error + errno syscall.Errno +} + +func SyscallError(err error, errno syscall.Errno) error { + return &syscallError{err, errno} +} + +func (se *syscallError) Is(target error) bool { + return target == se.error +} + +func (se *syscallError) Unwrap() error { + return se.errno +} diff --git a/vendor/github.com/cilium/ebpf/internal/syscall_string.go b/vendor/github.com/cilium/ebpf/internal/syscall_string.go new file mode 100644 index 0000000000..85df047797 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/syscall_string.go @@ -0,0 +1,56 @@ +// Code generated by "stringer -output syscall_string.go -type=BPFCmd"; DO NOT EDIT. + +package internal + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[BPF_MAP_CREATE-0] + _ = x[BPF_MAP_LOOKUP_ELEM-1] + _ = x[BPF_MAP_UPDATE_ELEM-2] + _ = x[BPF_MAP_DELETE_ELEM-3] + _ = x[BPF_MAP_GET_NEXT_KEY-4] + _ = x[BPF_PROG_LOAD-5] + _ = x[BPF_OBJ_PIN-6] + _ = x[BPF_OBJ_GET-7] + _ = x[BPF_PROG_ATTACH-8] + _ = x[BPF_PROG_DETACH-9] + _ = x[BPF_PROG_TEST_RUN-10] + _ = x[BPF_PROG_GET_NEXT_ID-11] + _ = x[BPF_MAP_GET_NEXT_ID-12] + _ = x[BPF_PROG_GET_FD_BY_ID-13] + _ = x[BPF_MAP_GET_FD_BY_ID-14] + _ = x[BPF_OBJ_GET_INFO_BY_FD-15] + _ = x[BPF_PROG_QUERY-16] + _ = x[BPF_RAW_TRACEPOINT_OPEN-17] + _ = x[BPF_BTF_LOAD-18] + _ = x[BPF_BTF_GET_FD_BY_ID-19] + _ = x[BPF_TASK_FD_QUERY-20] + _ = x[BPF_MAP_LOOKUP_AND_DELETE_ELEM-21] + _ = x[BPF_MAP_FREEZE-22] + _ = x[BPF_BTF_GET_NEXT_ID-23] + _ = x[BPF_MAP_LOOKUP_BATCH-24] + _ = x[BPF_MAP_LOOKUP_AND_DELETE_BATCH-25] + _ = x[BPF_MAP_UPDATE_BATCH-26] + _ = x[BPF_MAP_DELETE_BATCH-27] + _ = x[BPF_LINK_CREATE-28] + _ = x[BPF_LINK_UPDATE-29] + _ = x[BPF_LINK_GET_FD_BY_ID-30] + _ = x[BPF_LINK_GET_NEXT_ID-31] + _ = x[BPF_ENABLE_STATS-32] + _ = x[BPF_ITER_CREATE-33] +} + +const _BPFCmd_name = "BPF_MAP_CREATEBPF_MAP_LOOKUP_ELEMBPF_MAP_UPDATE_ELEMBPF_MAP_DELETE_ELEMBPF_MAP_GET_NEXT_KEYBPF_PROG_LOADBPF_OBJ_PINBPF_OBJ_GETBPF_PROG_ATTACHBPF_PROG_DETACHBPF_PROG_TEST_RUNBPF_PROG_GET_NEXT_IDBPF_MAP_GET_NEXT_IDBPF_PROG_GET_FD_BY_IDBPF_MAP_GET_FD_BY_IDBPF_OBJ_GET_INFO_BY_FDBPF_PROG_QUERYBPF_RAW_TRACEPOINT_OPENBPF_BTF_LOADBPF_BTF_GET_FD_BY_IDBPF_TASK_FD_QUERYBPF_MAP_LOOKUP_AND_DELETE_ELEMBPF_MAP_FREEZEBPF_BTF_GET_NEXT_IDBPF_MAP_LOOKUP_BATCHBPF_MAP_LOOKUP_AND_DELETE_BATCHBPF_MAP_UPDATE_BATCHBPF_MAP_DELETE_BATCHBPF_LINK_CREATEBPF_LINK_UPDATEBPF_LINK_GET_FD_BY_IDBPF_LINK_GET_NEXT_IDBPF_ENABLE_STATSBPF_ITER_CREATE" + +var _BPFCmd_index = [...]uint16{0, 14, 33, 52, 71, 91, 104, 115, 126, 141, 156, 173, 193, 212, 233, 253, 275, 289, 312, 324, 344, 361, 391, 405, 424, 444, 475, 495, 515, 530, 545, 566, 586, 602, 617} + +func (i BPFCmd) String() string { + if i < 0 || i >= BPFCmd(len(_BPFCmd_index)-1) { + return "BPFCmd(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _BPFCmd_name[_BPFCmd_index[i]:_BPFCmd_index[i+1]] +} diff --git a/vendor/github.com/cilium/ebpf/internal/unix/types_linux.go b/vendor/github.com/cilium/ebpf/internal/unix/types_linux.go new file mode 100644 index 0000000000..9aa70fa78c --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/unix/types_linux.go @@ -0,0 +1,208 @@ +//go:build linux +// +build linux + +package unix + +import ( + "bytes" + "syscall" + + linux "golang.org/x/sys/unix" +) + +const ( + ENOENT = linux.ENOENT + EEXIST = linux.EEXIST + EAGAIN = linux.EAGAIN + ENOSPC = linux.ENOSPC + EINVAL = linux.EINVAL + EPOLLIN = linux.EPOLLIN + EINTR = linux.EINTR + EPERM = linux.EPERM + ESRCH = linux.ESRCH + ENODEV = linux.ENODEV + EBADF = linux.EBADF + E2BIG = linux.E2BIG + // ENOTSUPP is not the same as ENOTSUP or EOPNOTSUP + ENOTSUPP = syscall.Errno(0x20c) + + BPF_F_NO_PREALLOC = linux.BPF_F_NO_PREALLOC + BPF_F_NUMA_NODE = linux.BPF_F_NUMA_NODE + BPF_F_RDONLY = linux.BPF_F_RDONLY + BPF_F_WRONLY = linux.BPF_F_WRONLY + BPF_F_RDONLY_PROG = linux.BPF_F_RDONLY_PROG + BPF_F_WRONLY_PROG = linux.BPF_F_WRONLY_PROG + BPF_F_SLEEPABLE = linux.BPF_F_SLEEPABLE + BPF_F_MMAPABLE = linux.BPF_F_MMAPABLE + BPF_F_INNER_MAP = linux.BPF_F_INNER_MAP + BPF_OBJ_NAME_LEN = linux.BPF_OBJ_NAME_LEN + BPF_TAG_SIZE = linux.BPF_TAG_SIZE + BPF_RINGBUF_BUSY_BIT = linux.BPF_RINGBUF_BUSY_BIT + BPF_RINGBUF_DISCARD_BIT = linux.BPF_RINGBUF_DISCARD_BIT + BPF_RINGBUF_HDR_SZ = linux.BPF_RINGBUF_HDR_SZ + SYS_BPF = linux.SYS_BPF + F_DUPFD_CLOEXEC = linux.F_DUPFD_CLOEXEC + EPOLL_CTL_ADD = linux.EPOLL_CTL_ADD + EPOLL_CLOEXEC = linux.EPOLL_CLOEXEC + O_CLOEXEC = linux.O_CLOEXEC + O_NONBLOCK = linux.O_NONBLOCK + PROT_READ = linux.PROT_READ + PROT_WRITE = linux.PROT_WRITE + MAP_SHARED = linux.MAP_SHARED + PERF_ATTR_SIZE_VER1 = linux.PERF_ATTR_SIZE_VER1 + PERF_TYPE_SOFTWARE = linux.PERF_TYPE_SOFTWARE + PERF_TYPE_TRACEPOINT = linux.PERF_TYPE_TRACEPOINT + PERF_COUNT_SW_BPF_OUTPUT = linux.PERF_COUNT_SW_BPF_OUTPUT + PERF_EVENT_IOC_DISABLE = linux.PERF_EVENT_IOC_DISABLE + PERF_EVENT_IOC_ENABLE = linux.PERF_EVENT_IOC_ENABLE + PERF_EVENT_IOC_SET_BPF = linux.PERF_EVENT_IOC_SET_BPF + PerfBitWatermark = linux.PerfBitWatermark + PERF_SAMPLE_RAW = linux.PERF_SAMPLE_RAW + PERF_FLAG_FD_CLOEXEC = linux.PERF_FLAG_FD_CLOEXEC + RLIM_INFINITY = linux.RLIM_INFINITY + RLIMIT_MEMLOCK = linux.RLIMIT_MEMLOCK + BPF_STATS_RUN_TIME = linux.BPF_STATS_RUN_TIME + PERF_RECORD_LOST = linux.PERF_RECORD_LOST + PERF_RECORD_SAMPLE = linux.PERF_RECORD_SAMPLE + AT_FDCWD = linux.AT_FDCWD + RENAME_NOREPLACE = linux.RENAME_NOREPLACE +) + +// Statfs_t is a wrapper +type Statfs_t = linux.Statfs_t + +// Rlimit is a wrapper +type Rlimit = linux.Rlimit + +// Syscall is a wrapper +func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { + return linux.Syscall(trap, a1, a2, a3) +} + +// FcntlInt is a wrapper +func FcntlInt(fd uintptr, cmd, arg int) (int, error) { + return linux.FcntlInt(fd, cmd, arg) +} + +// IoctlSetInt is a wrapper +func IoctlSetInt(fd int, req uint, value int) error { + return linux.IoctlSetInt(fd, req, value) +} + +// Statfs is a wrapper +func Statfs(path string, buf *Statfs_t) (err error) { + return linux.Statfs(path, buf) +} + +// Close is a wrapper +func Close(fd int) (err error) { + return linux.Close(fd) +} + +// EpollEvent is a wrapper +type EpollEvent = linux.EpollEvent + +// EpollWait is a wrapper +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + return linux.EpollWait(epfd, events, msec) +} + +// EpollCtl is a wrapper +func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { + return linux.EpollCtl(epfd, op, fd, event) +} + +// Eventfd is a wrapper +func Eventfd(initval uint, flags int) (fd int, err error) { + return linux.Eventfd(initval, flags) +} + +// Write is a wrapper +func Write(fd int, p []byte) (n int, err error) { + return linux.Write(fd, p) +} + +// EpollCreate1 is a wrapper +func EpollCreate1(flag int) (fd int, err error) { + return linux.EpollCreate1(flag) +} + +// PerfEventMmapPage is a wrapper +type PerfEventMmapPage linux.PerfEventMmapPage + +// SetNonblock is a wrapper +func SetNonblock(fd int, nonblocking bool) (err error) { + return linux.SetNonblock(fd, nonblocking) +} + +// Mmap is a wrapper +func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { + return linux.Mmap(fd, offset, length, prot, flags) +} + +// Munmap is a wrapper +func Munmap(b []byte) (err error) { + return linux.Munmap(b) +} + +// PerfEventAttr is a wrapper +type PerfEventAttr = linux.PerfEventAttr + +// PerfEventOpen is a wrapper +func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) { + return linux.PerfEventOpen(attr, pid, cpu, groupFd, flags) +} + +// Utsname is a wrapper +type Utsname = linux.Utsname + +// Uname is a wrapper +func Uname(buf *Utsname) (err error) { + return linux.Uname(buf) +} + +// Getpid is a wrapper +func Getpid() int { + return linux.Getpid() +} + +// Gettid is a wrapper +func Gettid() int { + return linux.Gettid() +} + +// Tgkill is a wrapper +func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { + return linux.Tgkill(tgid, tid, sig) +} + +// BytePtrFromString is a wrapper +func BytePtrFromString(s string) (*byte, error) { + return linux.BytePtrFromString(s) +} + +// ByteSliceToString is a wrapper +func ByteSliceToString(s []byte) string { + return linux.ByteSliceToString(s) +} + +// Renameat2 is a wrapper +func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error { + return linux.Renameat2(olddirfd, oldpath, newdirfd, newpath, flags) +} + +func KernelRelease() (string, error) { + var uname Utsname + err := Uname(&uname) + if err != nil { + return "", err + } + + end := bytes.IndexByte(uname.Release[:], 0) + release := string(uname.Release[:end]) + return release, nil +} + +func Prlimit(pid, resource int, new, old *Rlimit) error { + return linux.Prlimit(pid, resource, new, old) +} diff --git a/vendor/github.com/cilium/ebpf/internal/unix/types_other.go b/vendor/github.com/cilium/ebpf/internal/unix/types_other.go new file mode 100644 index 0000000000..4f50d896eb --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/unix/types_other.go @@ -0,0 +1,267 @@ +//go:build !linux +// +build !linux + +package unix + +import ( + "fmt" + "runtime" + "syscall" +) + +var errNonLinux = fmt.Errorf("unsupported platform %s/%s", runtime.GOOS, runtime.GOARCH) + +const ( + ENOENT = syscall.ENOENT + EEXIST = syscall.EEXIST + EAGAIN = syscall.EAGAIN + ENOSPC = syscall.ENOSPC + EINVAL = syscall.EINVAL + EINTR = syscall.EINTR + EPERM = syscall.EPERM + ESRCH = syscall.ESRCH + ENODEV = syscall.ENODEV + EBADF = syscall.Errno(0) + E2BIG = syscall.Errno(0) + // ENOTSUPP is not the same as ENOTSUP or EOPNOTSUP + ENOTSUPP = syscall.Errno(0x20c) + + BPF_F_NO_PREALLOC = 0 + BPF_F_NUMA_NODE = 0 + BPF_F_RDONLY = 0 + BPF_F_WRONLY = 0 + BPF_F_RDONLY_PROG = 0 + BPF_F_WRONLY_PROG = 0 + BPF_F_SLEEPABLE = 0 + BPF_F_MMAPABLE = 0 + BPF_F_INNER_MAP = 0 + BPF_OBJ_NAME_LEN = 0x10 + BPF_TAG_SIZE = 0x8 + BPF_RINGBUF_BUSY_BIT = 0 + BPF_RINGBUF_DISCARD_BIT = 0 + BPF_RINGBUF_HDR_SZ = 0 + SYS_BPF = 321 + F_DUPFD_CLOEXEC = 0x406 + EPOLLIN = 0x1 + EPOLL_CTL_ADD = 0x1 + EPOLL_CLOEXEC = 0x80000 + O_CLOEXEC = 0x80000 + O_NONBLOCK = 0x800 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + MAP_SHARED = 0x1 + PERF_ATTR_SIZE_VER1 = 0 + PERF_TYPE_SOFTWARE = 0x1 + PERF_TYPE_TRACEPOINT = 0 + PERF_COUNT_SW_BPF_OUTPUT = 0xa + PERF_EVENT_IOC_DISABLE = 0 + PERF_EVENT_IOC_ENABLE = 0 + PERF_EVENT_IOC_SET_BPF = 0 + PerfBitWatermark = 0x4000 + PERF_SAMPLE_RAW = 0x400 + PERF_FLAG_FD_CLOEXEC = 0x8 + RLIM_INFINITY = 0x7fffffffffffffff + RLIMIT_MEMLOCK = 8 + BPF_STATS_RUN_TIME = 0 + PERF_RECORD_LOST = 2 + PERF_RECORD_SAMPLE = 9 + AT_FDCWD = -0x2 + RENAME_NOREPLACE = 0x1 +) + +// Statfs_t is a wrapper +type Statfs_t struct { + Type int64 + Bsize int64 + Blocks uint64 + Bfree uint64 + Bavail uint64 + Files uint64 + Ffree uint64 + Fsid [2]int32 + Namelen int64 + Frsize int64 + Flags int64 + Spare [4]int64 +} + +// Rlimit is a wrapper +type Rlimit struct { + Cur uint64 + Max uint64 +} + +// Syscall is a wrapper +func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.Errno) { + return 0, 0, syscall.Errno(1) +} + +// FcntlInt is a wrapper +func FcntlInt(fd uintptr, cmd, arg int) (int, error) { + return -1, errNonLinux +} + +// IoctlSetInt is a wrapper +func IoctlSetInt(fd int, req uint, value int) error { + return errNonLinux +} + +// Statfs is a wrapper +func Statfs(path string, buf *Statfs_t) error { + return errNonLinux +} + +// Close is a wrapper +func Close(fd int) (err error) { + return errNonLinux +} + +// EpollEvent is a wrapper +type EpollEvent struct { + Events uint32 + Fd int32 + Pad int32 +} + +// EpollWait is a wrapper +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + return 0, errNonLinux +} + +// EpollCtl is a wrapper +func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { + return errNonLinux +} + +// Eventfd is a wrapper +func Eventfd(initval uint, flags int) (fd int, err error) { + return 0, errNonLinux +} + +// Write is a wrapper +func Write(fd int, p []byte) (n int, err error) { + return 0, errNonLinux +} + +// EpollCreate1 is a wrapper +func EpollCreate1(flag int) (fd int, err error) { + return 0, errNonLinux +} + +// PerfEventMmapPage is a wrapper +type PerfEventMmapPage struct { + Version uint32 + Compat_version uint32 + Lock uint32 + Index uint32 + Offset int64 + Time_enabled uint64 + Time_running uint64 + Capabilities uint64 + Pmc_width uint16 + Time_shift uint16 + Time_mult uint32 + Time_offset uint64 + Time_zero uint64 + Size uint32 + + Data_head uint64 + Data_tail uint64 + Data_offset uint64 + Data_size uint64 + Aux_head uint64 + Aux_tail uint64 + Aux_offset uint64 + Aux_size uint64 +} + +// SetNonblock is a wrapper +func SetNonblock(fd int, nonblocking bool) (err error) { + return errNonLinux +} + +// Mmap is a wrapper +func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { + return []byte{}, errNonLinux +} + +// Munmap is a wrapper +func Munmap(b []byte) (err error) { + return errNonLinux +} + +// PerfEventAttr is a wrapper +type PerfEventAttr struct { + Type uint32 + Size uint32 + Config uint64 + Sample uint64 + Sample_type uint64 + Read_format uint64 + Bits uint64 + Wakeup uint32 + Bp_type uint32 + Ext1 uint64 + Ext2 uint64 + Branch_sample_type uint64 + Sample_regs_user uint64 + Sample_stack_user uint32 + Clockid int32 + Sample_regs_intr uint64 + Aux_watermark uint32 + Sample_max_stack uint16 +} + +// PerfEventOpen is a wrapper +func PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) { + return 0, errNonLinux +} + +// Utsname is a wrapper +type Utsname struct { + Release [65]byte + Version [65]byte +} + +// Uname is a wrapper +func Uname(buf *Utsname) (err error) { + return errNonLinux +} + +// Getpid is a wrapper +func Getpid() int { + return -1 +} + +// Gettid is a wrapper +func Gettid() int { + return -1 +} + +// Tgkill is a wrapper +func Tgkill(tgid int, tid int, sig syscall.Signal) (err error) { + return errNonLinux +} + +// BytePtrFromString is a wrapper +func BytePtrFromString(s string) (*byte, error) { + return nil, errNonLinux +} + +// ByteSliceToString is a wrapper +func ByteSliceToString(s []byte) string { + return "" +} + +// Renameat2 is a wrapper +func Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) error { + return errNonLinux +} + +func KernelRelease() (string, error) { + return "", errNonLinux +} + +func Prlimit(pid, resource int, new, old *Rlimit) error { + return errNonLinux +} diff --git a/vendor/github.com/cilium/ebpf/internal/version.go b/vendor/github.com/cilium/ebpf/internal/version.go new file mode 100644 index 0000000000..4915e58376 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/internal/version.go @@ -0,0 +1,163 @@ +package internal + +import ( + "fmt" + "os" + "regexp" + "sync" + + "github.com/cilium/ebpf/internal/unix" +) + +const ( + // Version constant used in ELF binaries indicating that the loader needs to + // substitute the eBPF program's version with the value of the kernel's + // KERNEL_VERSION compile-time macro. Used for compatibility with BCC, gobpf + // and RedSift. + MagicKernelVersion = 0xFFFFFFFE +) + +var ( + // Match between one and three decimals separated by dots, with the last + // segment (patch level) being optional on some kernels. + // The x.y.z string must appear at the start of a string or right after + // whitespace to prevent sequences like 'x.y.z-a.b.c' from matching 'a.b.c'. + rgxKernelVersion = regexp.MustCompile(`(?:\A|\s)\d{1,3}\.\d{1,3}(?:\.\d{1,3})?`) + + kernelVersion = struct { + once sync.Once + version Version + err error + }{} +) + +// A Version in the form Major.Minor.Patch. +type Version [3]uint16 + +// NewVersion creates a version from a string like "Major.Minor.Patch". +// +// Patch is optional. +func NewVersion(ver string) (Version, error) { + var major, minor, patch uint16 + n, _ := fmt.Sscanf(ver, "%d.%d.%d", &major, &minor, &patch) + if n < 2 { + return Version{}, fmt.Errorf("invalid version: %s", ver) + } + return Version{major, minor, patch}, nil +} + +func (v Version) String() string { + if v[2] == 0 { + return fmt.Sprintf("v%d.%d", v[0], v[1]) + } + return fmt.Sprintf("v%d.%d.%d", v[0], v[1], v[2]) +} + +// Less returns true if the version is less than another version. +func (v Version) Less(other Version) bool { + for i, a := range v { + if a == other[i] { + continue + } + return a < other[i] + } + return false +} + +// Unspecified returns true if the version is all zero. +func (v Version) Unspecified() bool { + return v[0] == 0 && v[1] == 0 && v[2] == 0 +} + +// Kernel implements the kernel's KERNEL_VERSION macro from linux/version.h. +// It represents the kernel version and patch level as a single value. +func (v Version) Kernel() uint32 { + + // Kernels 4.4 and 4.9 have their SUBLEVEL clamped to 255 to avoid + // overflowing into PATCHLEVEL. + // See kernel commit 9b82f13e7ef3 ("kbuild: clamp SUBLEVEL to 255"). + s := v[2] + if s > 255 { + s = 255 + } + + // Truncate members to uint8 to prevent them from spilling over into + // each other when overflowing 8 bits. + return uint32(uint8(v[0]))<<16 | uint32(uint8(v[1]))<<8 | uint32(uint8(s)) +} + +// KernelVersion returns the version of the currently running kernel. +func KernelVersion() (Version, error) { + kernelVersion.once.Do(func() { + kernelVersion.version, kernelVersion.err = detectKernelVersion() + }) + + if kernelVersion.err != nil { + return Version{}, kernelVersion.err + } + return kernelVersion.version, nil +} + +// detectKernelVersion returns the version of the running kernel. It scans the +// following sources in order: /proc/version_signature, uname -v, uname -r. +// In each of those locations, the last-appearing x.y(.z) value is selected +// for parsing. The first location that yields a usable version number is +// returned. +func detectKernelVersion() (Version, error) { + + // Try reading /proc/version_signature for Ubuntu compatibility. + // Example format: Ubuntu 4.15.0-91.92-generic 4.15.18 + // This method exists in the kernel itself, see d18acd15c + // ("perf tools: Fix kernel version error in ubuntu"). + if pvs, err := os.ReadFile("/proc/version_signature"); err == nil { + // If /proc/version_signature exists, failing to parse it is an error. + // It only exists on Ubuntu, where the real patch level is not obtainable + // through any other method. + v, err := findKernelVersion(string(pvs)) + if err != nil { + return Version{}, err + } + return v, nil + } + + var uname unix.Utsname + if err := unix.Uname(&uname); err != nil { + return Version{}, fmt.Errorf("calling uname: %w", err) + } + + // Debian puts the version including the patch level in uname.Version. + // It is not an error if there's no version number in uname.Version, + // as most distributions don't use it. Parsing can continue on uname.Release. + // Example format: #1 SMP Debian 4.19.37-5+deb10u2 (2019-08-08) + if v, err := findKernelVersion(unix.ByteSliceToString(uname.Version[:])); err == nil { + return v, nil + } + + // Most other distributions have the full kernel version including patch + // level in uname.Release. + // Example format: 4.19.0-5-amd64, 5.5.10-arch1-1 + v, err := findKernelVersion(unix.ByteSliceToString(uname.Release[:])) + if err != nil { + return Version{}, err + } + + return v, nil +} + +// findKernelVersion matches s against rgxKernelVersion and parses the result +// into a Version. If s contains multiple matches, the last entry is selected. +func findKernelVersion(s string) (Version, error) { + m := rgxKernelVersion.FindAllString(s, -1) + if m == nil { + return Version{}, fmt.Errorf("no kernel version in string: %s", s) + } + // Pick the last match of the string in case there are multiple. + s = m[len(m)-1] + + v, err := NewVersion(s) + if err != nil { + return Version{}, fmt.Errorf("parsing version string %s: %w", s, err) + } + + return v, nil +} diff --git a/vendor/github.com/cilium/ebpf/link/cgroup.go b/vendor/github.com/cilium/ebpf/link/cgroup.go new file mode 100644 index 0000000000..5540bb068c --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/cgroup.go @@ -0,0 +1,171 @@ +package link + +import ( + "errors" + "fmt" + "os" + + "github.com/cilium/ebpf" +) + +type cgroupAttachFlags uint32 + +// cgroup attach flags +const ( + flagAllowOverride cgroupAttachFlags = 1 << iota + flagAllowMulti + flagReplace +) + +type CgroupOptions struct { + // Path to a cgroupv2 folder. + Path string + // One of the AttachCgroup* constants + Attach ebpf.AttachType + // Program must be of type CGroup*, and the attach type must match Attach. + Program *ebpf.Program +} + +// AttachCgroup links a BPF program to a cgroup. +func AttachCgroup(opts CgroupOptions) (Link, error) { + cgroup, err := os.Open(opts.Path) + if err != nil { + return nil, fmt.Errorf("can't open cgroup: %s", err) + } + + clone, err := opts.Program.Clone() + if err != nil { + cgroup.Close() + return nil, err + } + + var cg Link + cg, err = newLinkCgroup(cgroup, opts.Attach, clone) + if errors.Is(err, ErrNotSupported) { + cg, err = newProgAttachCgroup(cgroup, opts.Attach, clone, flagAllowMulti) + } + if errors.Is(err, ErrNotSupported) { + cg, err = newProgAttachCgroup(cgroup, opts.Attach, clone, flagAllowOverride) + } + if err != nil { + cgroup.Close() + clone.Close() + return nil, err + } + + return cg, nil +} + +// LoadPinnedCgroup loads a pinned cgroup from a bpffs. +func LoadPinnedCgroup(fileName string, opts *ebpf.LoadPinOptions) (Link, error) { + link, err := LoadPinnedRawLink(fileName, CgroupType, opts) + if err != nil { + return nil, err + } + + return &linkCgroup{*link}, nil +} + +type progAttachCgroup struct { + cgroup *os.File + current *ebpf.Program + attachType ebpf.AttachType + flags cgroupAttachFlags +} + +var _ Link = (*progAttachCgroup)(nil) + +func (cg *progAttachCgroup) isLink() {} + +func newProgAttachCgroup(cgroup *os.File, attach ebpf.AttachType, prog *ebpf.Program, flags cgroupAttachFlags) (*progAttachCgroup, error) { + if flags&flagAllowMulti > 0 { + if err := haveProgAttachReplace(); err != nil { + return nil, fmt.Errorf("can't support multiple programs: %w", err) + } + } + + err := RawAttachProgram(RawAttachProgramOptions{ + Target: int(cgroup.Fd()), + Program: prog, + Flags: uint32(flags), + Attach: attach, + }) + if err != nil { + return nil, fmt.Errorf("cgroup: %w", err) + } + + return &progAttachCgroup{cgroup, prog, attach, flags}, nil +} + +func (cg *progAttachCgroup) Close() error { + defer cg.cgroup.Close() + defer cg.current.Close() + + err := RawDetachProgram(RawDetachProgramOptions{ + Target: int(cg.cgroup.Fd()), + Program: cg.current, + Attach: cg.attachType, + }) + if err != nil { + return fmt.Errorf("close cgroup: %s", err) + } + return nil +} + +func (cg *progAttachCgroup) Update(prog *ebpf.Program) error { + new, err := prog.Clone() + if err != nil { + return err + } + + args := RawAttachProgramOptions{ + Target: int(cg.cgroup.Fd()), + Program: prog, + Attach: cg.attachType, + Flags: uint32(cg.flags), + } + + if cg.flags&flagAllowMulti > 0 { + // Atomically replacing multiple programs requires at least + // 5.5 (commit 7dd68b3279f17921 "bpf: Support replacing cgroup-bpf + // program in MULTI mode") + args.Flags |= uint32(flagReplace) + args.Replace = cg.current + } + + if err := RawAttachProgram(args); err != nil { + new.Close() + return fmt.Errorf("can't update cgroup: %s", err) + } + + cg.current.Close() + cg.current = new + return nil +} + +func (cg *progAttachCgroup) Pin(string) error { + return fmt.Errorf("can't pin cgroup: %w", ErrNotSupported) +} + +func (cg *progAttachCgroup) Unpin() error { + return fmt.Errorf("can't pin cgroup: %w", ErrNotSupported) +} + +type linkCgroup struct { + RawLink +} + +var _ Link = (*linkCgroup)(nil) + +func newLinkCgroup(cgroup *os.File, attach ebpf.AttachType, prog *ebpf.Program) (*linkCgroup, error) { + link, err := AttachRawLink(RawLinkOptions{ + Target: int(cgroup.Fd()), + Program: prog, + Attach: attach, + }) + if err != nil { + return nil, err + } + + return &linkCgroup{*link}, err +} diff --git a/vendor/github.com/cilium/ebpf/link/doc.go b/vendor/github.com/cilium/ebpf/link/doc.go new file mode 100644 index 0000000000..2bde35ed7a --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/doc.go @@ -0,0 +1,2 @@ +// Package link allows attaching eBPF programs to various kernel hooks. +package link diff --git a/vendor/github.com/cilium/ebpf/link/freplace.go b/vendor/github.com/cilium/ebpf/link/freplace.go new file mode 100644 index 0000000000..a698e1a9d3 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/freplace.go @@ -0,0 +1,88 @@ +package link + +import ( + "fmt" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal/btf" +) + +type FreplaceLink struct { + RawLink +} + +// AttachFreplace attaches the given eBPF program to the function it replaces. +// +// The program and name can either be provided at link time, or can be provided +// at program load time. If they were provided at load time, they should be nil +// and empty respectively here, as they will be ignored by the kernel. +// Examples: +// +// AttachFreplace(dispatcher, "function", replacement) +// AttachFreplace(nil, "", replacement) +func AttachFreplace(targetProg *ebpf.Program, name string, prog *ebpf.Program) (*FreplaceLink, error) { + if (name == "") != (targetProg == nil) { + return nil, fmt.Errorf("must provide both or neither of name and targetProg: %w", errInvalidInput) + } + if prog == nil { + return nil, fmt.Errorf("prog cannot be nil: %w", errInvalidInput) + } + if prog.Type() != ebpf.Extension { + return nil, fmt.Errorf("eBPF program type %s is not an Extension: %w", prog.Type(), errInvalidInput) + } + + var ( + target int + typeID btf.TypeID + ) + if targetProg != nil { + info, err := targetProg.Info() + if err != nil { + return nil, err + } + btfID, ok := info.BTFID() + if !ok { + return nil, fmt.Errorf("could not get BTF ID for program %s: %w", info.Name, errInvalidInput) + } + btfHandle, err := btf.NewHandleFromID(btfID) + if err != nil { + return nil, err + } + defer btfHandle.Close() + + var function *btf.Func + if err := btfHandle.Spec().FindType(name, &function); err != nil { + return nil, err + } + + target = targetProg.FD() + typeID = function.ID() + } + + link, err := AttachRawLink(RawLinkOptions{ + Target: target, + Program: prog, + Attach: ebpf.AttachNone, + BTF: typeID, + }) + if err != nil { + return nil, err + } + + return &FreplaceLink{*link}, nil +} + +// Update implements the Link interface. +func (f *FreplaceLink) Update(new *ebpf.Program) error { + return fmt.Errorf("freplace update: %w", ErrNotSupported) +} + +// LoadPinnedFreplace loads a pinned iterator from a bpffs. +func LoadPinnedFreplace(fileName string, opts *ebpf.LoadPinOptions) (*FreplaceLink, error) { + link, err := LoadPinnedRawLink(fileName, TracingType, opts) + if err != nil { + return nil, err + } + + return &FreplaceLink{*link}, err +} diff --git a/vendor/github.com/cilium/ebpf/link/iter.go b/vendor/github.com/cilium/ebpf/link/iter.go new file mode 100644 index 0000000000..654d34ef84 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/iter.go @@ -0,0 +1,100 @@ +package link + +import ( + "fmt" + "io" + "unsafe" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal" +) + +type IterOptions struct { + // Program must be of type Tracing with attach type + // AttachTraceIter. The kind of iterator to attach to is + // determined at load time via the AttachTo field. + // + // AttachTo requires the kernel to include BTF of itself, + // and it to be compiled with a recent pahole (>= 1.16). + Program *ebpf.Program + + // Map specifies the target map for bpf_map_elem and sockmap iterators. + // It may be nil. + Map *ebpf.Map +} + +// AttachIter attaches a BPF seq_file iterator. +func AttachIter(opts IterOptions) (*Iter, error) { + if err := haveBPFLink(); err != nil { + return nil, err + } + + progFd := opts.Program.FD() + if progFd < 0 { + return nil, fmt.Errorf("invalid program: %s", internal.ErrClosedFd) + } + + var info bpfIterLinkInfoMap + if opts.Map != nil { + mapFd := opts.Map.FD() + if mapFd < 0 { + return nil, fmt.Errorf("invalid map: %w", internal.ErrClosedFd) + } + info.map_fd = uint32(mapFd) + } + + attr := bpfLinkCreateIterAttr{ + prog_fd: uint32(progFd), + attach_type: ebpf.AttachTraceIter, + iter_info: internal.NewPointer(unsafe.Pointer(&info)), + iter_info_len: uint32(unsafe.Sizeof(info)), + } + + fd, err := bpfLinkCreateIter(&attr) + if err != nil { + return nil, fmt.Errorf("can't link iterator: %w", err) + } + + return &Iter{RawLink{fd, ""}}, err +} + +// LoadPinnedIter loads a pinned iterator from a bpffs. +func LoadPinnedIter(fileName string, opts *ebpf.LoadPinOptions) (*Iter, error) { + link, err := LoadPinnedRawLink(fileName, IterType, opts) + if err != nil { + return nil, err + } + + return &Iter{*link}, err +} + +// Iter represents an attached bpf_iter. +type Iter struct { + RawLink +} + +// Open creates a new instance of the iterator. +// +// Reading from the returned reader triggers the BPF program. +func (it *Iter) Open() (io.ReadCloser, error) { + linkFd, err := it.fd.Value() + if err != nil { + return nil, err + } + + attr := &bpfIterCreateAttr{ + linkFd: linkFd, + } + + fd, err := bpfIterCreate(attr) + if err != nil { + return nil, fmt.Errorf("can't create iterator: %w", err) + } + + return fd.File("bpf_iter"), nil +} + +// union bpf_iter_link_info.map +type bpfIterLinkInfoMap struct { + map_fd uint32 +} diff --git a/vendor/github.com/cilium/ebpf/link/kprobe.go b/vendor/github.com/cilium/ebpf/link/kprobe.go new file mode 100644 index 0000000000..b6577b5a99 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/kprobe.go @@ -0,0 +1,444 @@ +package link + +import ( + "bytes" + "crypto/rand" + "errors" + "fmt" + "os" + "path/filepath" + "runtime" + "sync" + "unsafe" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/unix" +) + +var ( + kprobeEventsPath = filepath.Join(tracefsPath, "kprobe_events") + + kprobeRetprobeBit = struct { + once sync.Once + value uint64 + err error + }{} +) + +type probeType uint8 + +const ( + kprobeType probeType = iota + uprobeType +) + +func (pt probeType) String() string { + if pt == kprobeType { + return "kprobe" + } + return "uprobe" +} + +func (pt probeType) EventsPath() string { + if pt == kprobeType { + return kprobeEventsPath + } + return uprobeEventsPath +} + +func (pt probeType) PerfEventType(ret bool) perfEventType { + if pt == kprobeType { + if ret { + return kretprobeEvent + } + return kprobeEvent + } + if ret { + return uretprobeEvent + } + return uprobeEvent +} + +func (pt probeType) RetprobeBit() (uint64, error) { + if pt == kprobeType { + return kretprobeBit() + } + return uretprobeBit() +} + +// Kprobe attaches the given eBPF program to a perf event that fires when the +// given kernel symbol starts executing. See /proc/kallsyms for available +// symbols. For example, printk(): +// +// kp, err := Kprobe("printk", prog) +// +// Losing the reference to the resulting Link (kp) will close the Kprobe +// and prevent further execution of prog. The Link must be Closed during +// program shutdown to avoid leaking system resources. +func Kprobe(symbol string, prog *ebpf.Program) (Link, error) { + k, err := kprobe(symbol, prog, false) + if err != nil { + return nil, err + } + + err = k.attach(prog) + if err != nil { + k.Close() + return nil, err + } + + return k, nil +} + +// Kretprobe attaches the given eBPF program to a perf event that fires right +// before the given kernel symbol exits, with the function stack left intact. +// See /proc/kallsyms for available symbols. For example, printk(): +// +// kp, err := Kretprobe("printk", prog) +// +// Losing the reference to the resulting Link (kp) will close the Kretprobe +// and prevent further execution of prog. The Link must be Closed during +// program shutdown to avoid leaking system resources. +func Kretprobe(symbol string, prog *ebpf.Program) (Link, error) { + k, err := kprobe(symbol, prog, true) + if err != nil { + return nil, err + } + + err = k.attach(prog) + if err != nil { + k.Close() + return nil, err + } + + return k, nil +} + +// kprobe opens a perf event on the given symbol and attaches prog to it. +// If ret is true, create a kretprobe. +func kprobe(symbol string, prog *ebpf.Program, ret bool) (*perfEvent, error) { + if symbol == "" { + return nil, fmt.Errorf("symbol name cannot be empty: %w", errInvalidInput) + } + if prog == nil { + return nil, fmt.Errorf("prog cannot be nil: %w", errInvalidInput) + } + if !rgxTraceEvent.MatchString(symbol) { + return nil, fmt.Errorf("symbol '%s' must be alphanumeric or underscore: %w", symbol, errInvalidInput) + } + if prog.Type() != ebpf.Kprobe { + return nil, fmt.Errorf("eBPF program type %s is not a Kprobe: %w", prog.Type(), errInvalidInput) + } + + // Use kprobe PMU if the kernel has it available. + tp, err := pmuKprobe(platformPrefix(symbol), ret) + if errors.Is(err, os.ErrNotExist) { + tp, err = pmuKprobe(symbol, ret) + } + if err == nil { + return tp, nil + } + if err != nil && !errors.Is(err, ErrNotSupported) { + return nil, fmt.Errorf("creating perf_kprobe PMU: %w", err) + } + + // Use tracefs if kprobe PMU is missing. + tp, err = tracefsKprobe(platformPrefix(symbol), ret) + if errors.Is(err, os.ErrNotExist) { + tp, err = tracefsKprobe(symbol, ret) + } + if err != nil { + return nil, fmt.Errorf("creating trace event '%s' in tracefs: %w", symbol, err) + } + + return tp, nil +} + +// pmuKprobe opens a perf event based on the kprobe PMU. +// Returns os.ErrNotExist if the given symbol does not exist in the kernel. +func pmuKprobe(symbol string, ret bool) (*perfEvent, error) { + return pmuProbe(kprobeType, symbol, "", 0, perfAllThreads, ret) +} + +// pmuProbe opens a perf event based on a Performance Monitoring Unit. +// +// Requires at least a 4.17 kernel. +// e12f03d7031a "perf/core: Implement the 'perf_kprobe' PMU" +// 33ea4b24277b "perf/core: Implement the 'perf_uprobe' PMU" +// +// Returns ErrNotSupported if the kernel doesn't support perf_[k,u]probe PMU +func pmuProbe(typ probeType, symbol, path string, offset uint64, pid int, ret bool) (*perfEvent, error) { + // Getting the PMU type will fail if the kernel doesn't support + // the perf_[k,u]probe PMU. + et, err := getPMUEventType(typ) + if err != nil { + return nil, err + } + + var config uint64 + if ret { + bit, err := typ.RetprobeBit() + if err != nil { + return nil, err + } + config |= 1 << bit + } + + var ( + attr unix.PerfEventAttr + sp unsafe.Pointer + ) + switch typ { + case kprobeType: + // Create a pointer to a NUL-terminated string for the kernel. + sp, err = unsafeStringPtr(symbol) + if err != nil { + return nil, err + } + + attr = unix.PerfEventAttr{ + Type: uint32(et), // PMU event type read from sysfs + Ext1: uint64(uintptr(sp)), // Kernel symbol to trace + Config: config, // Retprobe flag + } + case uprobeType: + sp, err = unsafeStringPtr(path) + if err != nil { + return nil, err + } + + attr = unix.PerfEventAttr{ + // The minimum size required for PMU uprobes is PERF_ATTR_SIZE_VER1, + // since it added the config2 (Ext2) field. The Size field controls the + // size of the internal buffer the kernel allocates for reading the + // perf_event_attr argument from userspace. + Size: unix.PERF_ATTR_SIZE_VER1, + Type: uint32(et), // PMU event type read from sysfs + Ext1: uint64(uintptr(sp)), // Uprobe path + Ext2: offset, // Uprobe offset + Config: config, // Retprobe flag + } + } + + fd, err := unix.PerfEventOpen(&attr, pid, 0, -1, unix.PERF_FLAG_FD_CLOEXEC) + + // Since commit 97c753e62e6c, ENOENT is correctly returned instead of EINVAL + // when trying to create a kretprobe for a missing symbol. Make sure ENOENT + // is returned to the caller. + if errors.Is(err, os.ErrNotExist) || errors.Is(err, unix.EINVAL) { + return nil, fmt.Errorf("symbol '%s' not found: %w", symbol, os.ErrNotExist) + } + // Since at least commit cb9a19fe4aa51, ENOTSUPP is returned + // when attempting to set a uprobe on a trap instruction. + if errors.Is(err, unix.ENOTSUPP) { + return nil, fmt.Errorf("failed setting uprobe on offset %#x (possible trap insn): %w", offset, err) + } + if err != nil { + return nil, fmt.Errorf("opening perf event: %w", err) + } + + // Ensure the string pointer is not collected before PerfEventOpen returns. + runtime.KeepAlive(sp) + + // Kernel has perf_[k,u]probe PMU available, initialize perf event. + return &perfEvent{ + fd: internal.NewFD(uint32(fd)), + pmuID: et, + name: symbol, + typ: typ.PerfEventType(ret), + }, nil +} + +// tracefsKprobe creates a Kprobe tracefs entry. +func tracefsKprobe(symbol string, ret bool) (*perfEvent, error) { + return tracefsProbe(kprobeType, symbol, "", 0, perfAllThreads, ret) +} + +// tracefsProbe creates a trace event by writing an entry to /[k,u]probe_events. +// A new trace event group name is generated on every call to support creating +// multiple trace events for the same kernel or userspace symbol. +// Path and offset are only set in the case of uprobe(s) and are used to set +// the executable/library path on the filesystem and the offset where the probe is inserted. +// A perf event is then opened on the newly-created trace event and returned to the caller. +func tracefsProbe(typ probeType, symbol, path string, offset uint64, pid int, ret bool) (*perfEvent, error) { + // Generate a random string for each trace event we attempt to create. + // This value is used as the 'group' token in tracefs to allow creating + // multiple kprobe trace events with the same name. + group, err := randomGroup("ebpf") + if err != nil { + return nil, fmt.Errorf("randomizing group name: %w", err) + } + + // Before attempting to create a trace event through tracefs, + // check if an event with the same group and name already exists. + // Kernels 4.x and earlier don't return os.ErrExist on writing a duplicate + // entry, so we need to rely on reads for detecting uniqueness. + _, err = getTraceEventID(group, symbol) + if err == nil { + return nil, fmt.Errorf("trace event already exists: %s/%s", group, symbol) + } + if err != nil && !errors.Is(err, os.ErrNotExist) { + return nil, fmt.Errorf("checking trace event %s/%s: %w", group, symbol, err) + } + + // Create the [k,u]probe trace event using tracefs. + if err := createTraceFSProbeEvent(typ, group, symbol, path, offset, ret); err != nil { + return nil, fmt.Errorf("creating probe entry on tracefs: %w", err) + } + + // Get the newly-created trace event's id. + tid, err := getTraceEventID(group, symbol) + if err != nil { + return nil, fmt.Errorf("getting trace event id: %w", err) + } + + // Kprobes are ephemeral tracepoints and share the same perf event type. + fd, err := openTracepointPerfEvent(tid, pid) + if err != nil { + return nil, err + } + + return &perfEvent{ + fd: fd, + group: group, + name: symbol, + tracefsID: tid, + typ: typ.PerfEventType(ret), + }, nil +} + +// createTraceFSProbeEvent creates a new ephemeral trace event by writing to +// /[k,u]probe_events. Returns os.ErrNotExist if symbol is not a valid +// kernel symbol, or if it is not traceable with kprobes. Returns os.ErrExist +// if a probe with the same group and symbol already exists. +func createTraceFSProbeEvent(typ probeType, group, symbol, path string, offset uint64, ret bool) error { + // Open the kprobe_events file in tracefs. + f, err := os.OpenFile(typ.EventsPath(), os.O_APPEND|os.O_WRONLY, 0666) + if err != nil { + return fmt.Errorf("error opening '%s': %w", typ.EventsPath(), err) + } + defer f.Close() + + var pe string + switch typ { + case kprobeType: + // The kprobe_events syntax is as follows (see Documentation/trace/kprobetrace.txt): + // p[:[GRP/]EVENT] [MOD:]SYM[+offs]|MEMADDR [FETCHARGS] : Set a probe + // r[MAXACTIVE][:[GRP/]EVENT] [MOD:]SYM[+0] [FETCHARGS] : Set a return probe + // -:[GRP/]EVENT : Clear a probe + // + // Some examples: + // r:ebpf_1234/r_my_kretprobe nf_conntrack_destroy + // p:ebpf_5678/p_my_kprobe __x64_sys_execve + // + // Leaving the kretprobe's MAXACTIVE set to 0 (or absent) will make the + // kernel default to NR_CPUS. This is desired in most eBPF cases since + // subsampling or rate limiting logic can be more accurately implemented in + // the eBPF program itself. + // See Documentation/kprobes.txt for more details. + pe = fmt.Sprintf("%s:%s/%s %s", probePrefix(ret), group, symbol, symbol) + case uprobeType: + // The uprobe_events syntax is as follows: + // p[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] : Set a probe + // r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] : Set a return probe + // -:[GRP/]EVENT : Clear a probe + // + // Some examples: + // r:ebpf_1234/readline /bin/bash:0x12345 + // p:ebpf_5678/main_mySymbol /bin/mybin:0x12345 + // + // See Documentation/trace/uprobetracer.txt for more details. + pathOffset := uprobePathOffset(path, offset) + pe = fmt.Sprintf("%s:%s/%s %s", probePrefix(ret), group, symbol, pathOffset) + } + _, err = f.WriteString(pe) + // Since commit 97c753e62e6c, ENOENT is correctly returned instead of EINVAL + // when trying to create a kretprobe for a missing symbol. Make sure ENOENT + // is returned to the caller. + if errors.Is(err, os.ErrNotExist) || errors.Is(err, unix.EINVAL) { + return fmt.Errorf("symbol %s not found: %w", symbol, os.ErrNotExist) + } + if err != nil { + return fmt.Errorf("writing '%s' to '%s': %w", pe, typ.EventsPath(), err) + } + + return nil +} + +// closeTraceFSProbeEvent removes the [k,u]probe with the given type, group and symbol +// from /[k,u]probe_events. +func closeTraceFSProbeEvent(typ probeType, group, symbol string) error { + f, err := os.OpenFile(typ.EventsPath(), os.O_APPEND|os.O_WRONLY, 0666) + if err != nil { + return fmt.Errorf("error opening %s: %w", typ.EventsPath(), err) + } + defer f.Close() + + // See [k,u]probe_events syntax above. The probe type does not need to be specified + // for removals. + pe := fmt.Sprintf("-:%s/%s", group, symbol) + if _, err = f.WriteString(pe); err != nil { + return fmt.Errorf("writing '%s' to '%s': %w", pe, typ.EventsPath(), err) + } + + return nil +} + +// randomGroup generates a pseudorandom string for use as a tracefs group name. +// Returns an error when the output string would exceed 63 characters (kernel +// limitation), when rand.Read() fails or when prefix contains characters not +// allowed by rgxTraceEvent. +func randomGroup(prefix string) (string, error) { + if !rgxTraceEvent.MatchString(prefix) { + return "", fmt.Errorf("prefix '%s' must be alphanumeric or underscore: %w", prefix, errInvalidInput) + } + + b := make([]byte, 8) + if _, err := rand.Read(b); err != nil { + return "", fmt.Errorf("reading random bytes: %w", err) + } + + group := fmt.Sprintf("%s_%x", prefix, b) + if len(group) > 63 { + return "", fmt.Errorf("group name '%s' cannot be longer than 63 characters: %w", group, errInvalidInput) + } + + return group, nil +} + +func probePrefix(ret bool) string { + if ret { + return "r" + } + return "p" +} + +// determineRetprobeBit reads a Performance Monitoring Unit's retprobe bit +// from /sys/bus/event_source/devices//format/retprobe. +func determineRetprobeBit(typ probeType) (uint64, error) { + p := filepath.Join("/sys/bus/event_source/devices/", typ.String(), "/format/retprobe") + + data, err := os.ReadFile(p) + if err != nil { + return 0, err + } + + var rp uint64 + n, err := fmt.Sscanf(string(bytes.TrimSpace(data)), "config:%d", &rp) + if err != nil { + return 0, fmt.Errorf("parse retprobe bit: %w", err) + } + if n != 1 { + return 0, fmt.Errorf("parse retprobe bit: expected 1 item, got %d", n) + } + + return rp, nil +} + +func kretprobeBit() (uint64, error) { + kprobeRetprobeBit.once.Do(func() { + kprobeRetprobeBit.value, kprobeRetprobeBit.err = determineRetprobeBit(kprobeType) + }) + return kprobeRetprobeBit.value, kprobeRetprobeBit.err +} diff --git a/vendor/github.com/cilium/ebpf/link/link.go b/vendor/github.com/cilium/ebpf/link/link.go new file mode 100644 index 0000000000..4926584696 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/link.go @@ -0,0 +1,233 @@ +package link + +import ( + "fmt" + "unsafe" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/btf" +) + +var ErrNotSupported = internal.ErrNotSupported + +// Link represents a Program attached to a BPF hook. +type Link interface { + // Replace the current program with a new program. + // + // Passing a nil program is an error. May return an error wrapping ErrNotSupported. + Update(*ebpf.Program) error + + // Persist a link by pinning it into a bpffs. + // + // May return an error wrapping ErrNotSupported. + Pin(string) error + + // Undo a previous call to Pin. + // + // May return an error wrapping ErrNotSupported. + Unpin() error + + // Close frees resources. + // + // The link will be broken unless it has been successfully pinned. + // A link may continue past the lifetime of the process if Close is + // not called. + Close() error + + // Prevent external users from implementing this interface. + isLink() +} + +// ID uniquely identifies a BPF link. +type ID uint32 + +// RawLinkOptions control the creation of a raw link. +type RawLinkOptions struct { + // File descriptor to attach to. This differs for each attach type. + Target int + // Program to attach. + Program *ebpf.Program + // Attach must match the attach type of Program. + Attach ebpf.AttachType + // BTF is the BTF of the attachment target. + BTF btf.TypeID +} + +// RawLinkInfo contains metadata on a link. +type RawLinkInfo struct { + Type Type + ID ID + Program ebpf.ProgramID +} + +// RawLink is the low-level API to bpf_link. +// +// You should consider using the higher level interfaces in this +// package instead. +type RawLink struct { + fd *internal.FD + pinnedPath string +} + +// AttachRawLink creates a raw link. +func AttachRawLink(opts RawLinkOptions) (*RawLink, error) { + if err := haveBPFLink(); err != nil { + return nil, err + } + + if opts.Target < 0 { + return nil, fmt.Errorf("invalid target: %s", internal.ErrClosedFd) + } + + progFd := opts.Program.FD() + if progFd < 0 { + return nil, fmt.Errorf("invalid program: %s", internal.ErrClosedFd) + } + + attr := bpfLinkCreateAttr{ + targetFd: uint32(opts.Target), + progFd: uint32(progFd), + attachType: opts.Attach, + targetBTFID: uint32(opts.BTF), + } + fd, err := bpfLinkCreate(&attr) + if err != nil { + return nil, fmt.Errorf("can't create link: %s", err) + } + + return &RawLink{fd, ""}, nil +} + +// LoadPinnedRawLink loads a persisted link from a bpffs. +// +// Returns an error if the pinned link type doesn't match linkType. Pass +// UnspecifiedType to disable this behaviour. +func LoadPinnedRawLink(fileName string, linkType Type, opts *ebpf.LoadPinOptions) (*RawLink, error) { + fd, err := internal.BPFObjGet(fileName, opts.Marshal()) + if err != nil { + return nil, fmt.Errorf("load pinned link: %w", err) + } + + link := &RawLink{fd, fileName} + if linkType == UnspecifiedType { + return link, nil + } + + info, err := link.Info() + if err != nil { + link.Close() + return nil, fmt.Errorf("get pinned link info: %s", err) + } + + if info.Type != linkType { + link.Close() + return nil, fmt.Errorf("link type %v doesn't match %v", info.Type, linkType) + } + + return link, nil +} + +func (l *RawLink) isLink() {} + +// FD returns the raw file descriptor. +func (l *RawLink) FD() int { + fd, err := l.fd.Value() + if err != nil { + return -1 + } + return int(fd) +} + +// Close breaks the link. +// +// Use Pin if you want to make the link persistent. +func (l *RawLink) Close() error { + return l.fd.Close() +} + +// Pin persists a link past the lifetime of the process. +// +// Calling Close on a pinned Link will not break the link +// until the pin is removed. +func (l *RawLink) Pin(fileName string) error { + if err := internal.Pin(l.pinnedPath, fileName, l.fd); err != nil { + return err + } + l.pinnedPath = fileName + return nil +} + +// Unpin implements the Link interface. +func (l *RawLink) Unpin() error { + if err := internal.Unpin(l.pinnedPath); err != nil { + return err + } + l.pinnedPath = "" + return nil +} + +// Update implements the Link interface. +func (l *RawLink) Update(new *ebpf.Program) error { + return l.UpdateArgs(RawLinkUpdateOptions{ + New: new, + }) +} + +// RawLinkUpdateOptions control the behaviour of RawLink.UpdateArgs. +type RawLinkUpdateOptions struct { + New *ebpf.Program + Old *ebpf.Program + Flags uint32 +} + +// UpdateArgs updates a link based on args. +func (l *RawLink) UpdateArgs(opts RawLinkUpdateOptions) error { + newFd := opts.New.FD() + if newFd < 0 { + return fmt.Errorf("invalid program: %s", internal.ErrClosedFd) + } + + var oldFd int + if opts.Old != nil { + oldFd = opts.Old.FD() + if oldFd < 0 { + return fmt.Errorf("invalid replacement program: %s", internal.ErrClosedFd) + } + } + + linkFd, err := l.fd.Value() + if err != nil { + return fmt.Errorf("can't update link: %s", err) + } + + attr := bpfLinkUpdateAttr{ + linkFd: linkFd, + newProgFd: uint32(newFd), + oldProgFd: uint32(oldFd), + flags: opts.Flags, + } + return bpfLinkUpdate(&attr) +} + +// struct bpf_link_info +type bpfLinkInfo struct { + typ uint32 + id uint32 + prog_id uint32 +} + +// Info returns metadata about the link. +func (l *RawLink) Info() (*RawLinkInfo, error) { + var info bpfLinkInfo + err := internal.BPFObjGetInfoByFD(l.fd, unsafe.Pointer(&info), unsafe.Sizeof(info)) + if err != nil { + return nil, fmt.Errorf("link info: %s", err) + } + + return &RawLinkInfo{ + Type(info.typ), + ID(info.id), + ebpf.ProgramID(info.prog_id), + }, nil +} diff --git a/vendor/github.com/cilium/ebpf/link/netns.go b/vendor/github.com/cilium/ebpf/link/netns.go new file mode 100644 index 0000000000..37e5b84c4d --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/netns.go @@ -0,0 +1,60 @@ +package link + +import ( + "fmt" + + "github.com/cilium/ebpf" +) + +// NetNsInfo contains metadata about a network namespace link. +type NetNsInfo struct { + RawLinkInfo +} + +// NetNsLink is a program attached to a network namespace. +type NetNsLink struct { + *RawLink +} + +// AttachNetNs attaches a program to a network namespace. +func AttachNetNs(ns int, prog *ebpf.Program) (*NetNsLink, error) { + var attach ebpf.AttachType + switch t := prog.Type(); t { + case ebpf.FlowDissector: + attach = ebpf.AttachFlowDissector + case ebpf.SkLookup: + attach = ebpf.AttachSkLookup + default: + return nil, fmt.Errorf("can't attach %v to network namespace", t) + } + + link, err := AttachRawLink(RawLinkOptions{ + Target: ns, + Program: prog, + Attach: attach, + }) + if err != nil { + return nil, err + } + + return &NetNsLink{link}, nil +} + +// LoadPinnedNetNs loads a network namespace link from bpffs. +func LoadPinnedNetNs(fileName string, opts *ebpf.LoadPinOptions) (*NetNsLink, error) { + link, err := LoadPinnedRawLink(fileName, NetNsType, opts) + if err != nil { + return nil, err + } + + return &NetNsLink{link}, nil +} + +// Info returns information about the link. +func (nns *NetNsLink) Info() (*NetNsInfo, error) { + info, err := nns.RawLink.Info() + if err != nil { + return nil, err + } + return &NetNsInfo{*info}, nil +} diff --git a/vendor/github.com/cilium/ebpf/link/perf_event.go b/vendor/github.com/cilium/ebpf/link/perf_event.go new file mode 100644 index 0000000000..7e0443a75c --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/perf_event.go @@ -0,0 +1,272 @@ +package link + +import ( + "bytes" + "errors" + "fmt" + "os" + "path/filepath" + "regexp" + "runtime" + "strconv" + "strings" + "unsafe" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/unix" +) + +// Getting the terminology right is usually the hardest part. For posterity and +// for staying sane during implementation: +// +// - trace event: Representation of a kernel runtime hook. Filesystem entries +// under /events. Can be tracepoints (static), kprobes or uprobes. +// Can be instantiated into perf events (see below). +// - tracepoint: A predetermined hook point in the kernel. Exposed as trace +// events in (sub)directories under /events. Cannot be closed or +// removed, they are static. +// - k(ret)probe: Ephemeral trace events based on entry or exit points of +// exported kernel symbols. kprobe-based (tracefs) trace events can be +// created system-wide by writing to the /kprobe_events file, or +// they can be scoped to the current process by creating PMU perf events. +// - u(ret)probe: Ephemeral trace events based on user provides ELF binaries +// and offsets. uprobe-based (tracefs) trace events can be +// created system-wide by writing to the /uprobe_events file, or +// they can be scoped to the current process by creating PMU perf events. +// - perf event: An object instantiated based on an existing trace event or +// kernel symbol. Referred to by fd in userspace. +// Exactly one eBPF program can be attached to a perf event. Multiple perf +// events can be created from a single trace event. Closing a perf event +// stops any further invocations of the attached eBPF program. + +var ( + tracefsPath = "/sys/kernel/debug/tracing" + + // Trace event groups, names and kernel symbols must adhere to this set + // of characters. Non-empty, first character must not be a number, all + // characters must be alphanumeric or underscore. + rgxTraceEvent = regexp.MustCompile("^[a-zA-Z_][0-9a-zA-Z_]*$") + + errInvalidInput = errors.New("invalid input") +) + +const ( + perfAllThreads = -1 +) + +type perfEventType uint8 + +const ( + tracepointEvent perfEventType = iota + kprobeEvent + kretprobeEvent + uprobeEvent + uretprobeEvent +) + +// A perfEvent represents a perf event kernel object. Exactly one eBPF program +// can be attached to it. It is created based on a tracefs trace event or a +// Performance Monitoring Unit (PMU). +type perfEvent struct { + + // Group and name of the tracepoint/kprobe/uprobe. + group string + name string + + // PMU event ID read from sysfs. Valid IDs are non-zero. + pmuID uint64 + // ID of the trace event read from tracefs. Valid IDs are non-zero. + tracefsID uint64 + + // The event type determines the types of programs that can be attached. + typ perfEventType + + fd *internal.FD +} + +func (pe *perfEvent) isLink() {} + +func (pe *perfEvent) Pin(string) error { + return fmt.Errorf("pin perf event: %w", ErrNotSupported) +} + +func (pe *perfEvent) Unpin() error { + return fmt.Errorf("unpin perf event: %w", ErrNotSupported) +} + +// Since 4.15 (e87c6bc3852b "bpf: permit multiple bpf attachments for a single perf event"), +// calling PERF_EVENT_IOC_SET_BPF appends the given program to a prog_array +// owned by the perf event, which means multiple programs can be attached +// simultaneously. +// +// Before 4.15, calling PERF_EVENT_IOC_SET_BPF more than once on a perf event +// returns EEXIST. +// +// Detaching a program from a perf event is currently not possible, so a +// program replacement mechanism cannot be implemented for perf events. +func (pe *perfEvent) Update(prog *ebpf.Program) error { + return fmt.Errorf("can't replace eBPF program in perf event: %w", ErrNotSupported) +} + +func (pe *perfEvent) Close() error { + if pe.fd == nil { + return nil + } + + pfd, err := pe.fd.Value() + if err != nil { + return fmt.Errorf("getting perf event fd: %w", err) + } + + err = unix.IoctlSetInt(int(pfd), unix.PERF_EVENT_IOC_DISABLE, 0) + if err != nil { + return fmt.Errorf("disabling perf event: %w", err) + } + + err = pe.fd.Close() + if err != nil { + return fmt.Errorf("closing perf event fd: %w", err) + } + + switch pe.typ { + case kprobeEvent, kretprobeEvent: + // Clean up kprobe tracefs entry. + if pe.tracefsID != 0 { + return closeTraceFSProbeEvent(kprobeType, pe.group, pe.name) + } + case uprobeEvent, uretprobeEvent: + // Clean up uprobe tracefs entry. + if pe.tracefsID != 0 { + return closeTraceFSProbeEvent(uprobeType, pe.group, pe.name) + } + case tracepointEvent: + // Tracepoint trace events don't hold any extra resources. + return nil + } + + return nil +} + +// attach the given eBPF prog to the perf event stored in pe. +// pe must contain a valid perf event fd. +// prog's type must match the program type stored in pe. +func (pe *perfEvent) attach(prog *ebpf.Program) error { + if prog == nil { + return errors.New("cannot attach a nil program") + } + if pe.fd == nil { + return errors.New("cannot attach to nil perf event") + } + if prog.FD() < 0 { + return fmt.Errorf("invalid program: %w", internal.ErrClosedFd) + } + switch pe.typ { + case kprobeEvent, kretprobeEvent, uprobeEvent, uretprobeEvent: + if t := prog.Type(); t != ebpf.Kprobe { + return fmt.Errorf("invalid program type (expected %s): %s", ebpf.Kprobe, t) + } + case tracepointEvent: + if t := prog.Type(); t != ebpf.TracePoint { + return fmt.Errorf("invalid program type (expected %s): %s", ebpf.TracePoint, t) + } + default: + return fmt.Errorf("unknown perf event type: %d", pe.typ) + } + + // The ioctl below will fail when the fd is invalid. + kfd, _ := pe.fd.Value() + + // Assign the eBPF program to the perf event. + err := unix.IoctlSetInt(int(kfd), unix.PERF_EVENT_IOC_SET_BPF, prog.FD()) + if err != nil { + return fmt.Errorf("setting perf event bpf program: %w", err) + } + + // PERF_EVENT_IOC_ENABLE and _DISABLE ignore their given values. + if err := unix.IoctlSetInt(int(kfd), unix.PERF_EVENT_IOC_ENABLE, 0); err != nil { + return fmt.Errorf("enable perf event: %s", err) + } + + // Close the perf event when its reference is lost to avoid leaking system resources. + runtime.SetFinalizer(pe, (*perfEvent).Close) + return nil +} + +// unsafeStringPtr returns an unsafe.Pointer to a NUL-terminated copy of str. +func unsafeStringPtr(str string) (unsafe.Pointer, error) { + p, err := unix.BytePtrFromString(str) + if err != nil { + return nil, err + } + return unsafe.Pointer(p), nil +} + +// getTraceEventID reads a trace event's ID from tracefs given its group and name. +// group and name must be alphanumeric or underscore, as required by the kernel. +func getTraceEventID(group, name string) (uint64, error) { + tid, err := uint64FromFile(tracefsPath, "events", group, name, "id") + if errors.Is(err, os.ErrNotExist) { + return 0, fmt.Errorf("trace event %s/%s: %w", group, name, os.ErrNotExist) + } + if err != nil { + return 0, fmt.Errorf("reading trace event ID of %s/%s: %w", group, name, err) + } + + return tid, nil +} + +// getPMUEventType reads a Performance Monitoring Unit's type (numeric identifier) +// from /sys/bus/event_source/devices//type. +// +// Returns ErrNotSupported if the pmu type is not supported. +func getPMUEventType(typ probeType) (uint64, error) { + et, err := uint64FromFile("/sys/bus/event_source/devices", typ.String(), "type") + if errors.Is(err, os.ErrNotExist) { + return 0, fmt.Errorf("pmu type %s: %w", typ, ErrNotSupported) + } + if err != nil { + return 0, fmt.Errorf("reading pmu type %s: %w", typ, err) + } + + return et, nil +} + +// openTracepointPerfEvent opens a tracepoint-type perf event. System-wide +// [k,u]probes created by writing to /[k,u]probe_events are tracepoints +// behind the scenes, and can be attached to using these perf events. +func openTracepointPerfEvent(tid uint64, pid int) (*internal.FD, error) { + attr := unix.PerfEventAttr{ + Type: unix.PERF_TYPE_TRACEPOINT, + Config: tid, + Sample_type: unix.PERF_SAMPLE_RAW, + Sample: 1, + Wakeup: 1, + } + + fd, err := unix.PerfEventOpen(&attr, pid, 0, -1, unix.PERF_FLAG_FD_CLOEXEC) + if err != nil { + return nil, fmt.Errorf("opening tracepoint perf event: %w", err) + } + + return internal.NewFD(uint32(fd)), nil +} + +// uint64FromFile reads a uint64 from a file. All elements of path are sanitized +// and joined onto base. Returns error if base no longer prefixes the path after +// joining all components. +func uint64FromFile(base string, path ...string) (uint64, error) { + l := filepath.Join(path...) + p := filepath.Join(base, l) + if !strings.HasPrefix(p, base) { + return 0, fmt.Errorf("path '%s' attempts to escape base path '%s': %w", l, base, errInvalidInput) + } + + data, err := os.ReadFile(p) + if err != nil { + return 0, fmt.Errorf("reading file %s: %w", p, err) + } + + et := bytes.TrimSpace(data) + return strconv.ParseUint(string(et), 10, 64) +} diff --git a/vendor/github.com/cilium/ebpf/link/platform.go b/vendor/github.com/cilium/ebpf/link/platform.go new file mode 100644 index 0000000000..eb6f7b7a37 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/platform.go @@ -0,0 +1,25 @@ +package link + +import ( + "fmt" + "runtime" +) + +func platformPrefix(symbol string) string { + + prefix := runtime.GOARCH + + // per https://github.com/golang/go/blob/master/src/go/build/syslist.go + switch prefix { + case "386": + prefix = "ia32" + case "amd64", "amd64p32": + prefix = "x64" + case "arm64", "arm64be": + prefix = "arm64" + default: + return symbol + } + + return fmt.Sprintf("__%s_%s", prefix, symbol) +} diff --git a/vendor/github.com/cilium/ebpf/link/program.go b/vendor/github.com/cilium/ebpf/link/program.go new file mode 100644 index 0000000000..b90c457467 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/program.go @@ -0,0 +1,76 @@ +package link + +import ( + "fmt" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal" +) + +type RawAttachProgramOptions struct { + // File descriptor to attach to. This differs for each attach type. + Target int + // Program to attach. + Program *ebpf.Program + // Program to replace (cgroups). + Replace *ebpf.Program + // Attach must match the attach type of Program (and Replace). + Attach ebpf.AttachType + // Flags control the attach behaviour. This differs for each attach type. + Flags uint32 +} + +// RawAttachProgram is a low level wrapper around BPF_PROG_ATTACH. +// +// You should use one of the higher level abstractions available in this +// package if possible. +func RawAttachProgram(opts RawAttachProgramOptions) error { + if err := haveProgAttach(); err != nil { + return err + } + + var replaceFd uint32 + if opts.Replace != nil { + replaceFd = uint32(opts.Replace.FD()) + } + + attr := internal.BPFProgAttachAttr{ + TargetFd: uint32(opts.Target), + AttachBpfFd: uint32(opts.Program.FD()), + ReplaceBpfFd: replaceFd, + AttachType: uint32(opts.Attach), + AttachFlags: uint32(opts.Flags), + } + + if err := internal.BPFProgAttach(&attr); err != nil { + return fmt.Errorf("can't attach program: %w", err) + } + return nil +} + +type RawDetachProgramOptions struct { + Target int + Program *ebpf.Program + Attach ebpf.AttachType +} + +// RawDetachProgram is a low level wrapper around BPF_PROG_DETACH. +// +// You should use one of the higher level abstractions available in this +// package if possible. +func RawDetachProgram(opts RawDetachProgramOptions) error { + if err := haveProgAttach(); err != nil { + return err + } + + attr := internal.BPFProgDetachAttr{ + TargetFd: uint32(opts.Target), + AttachBpfFd: uint32(opts.Program.FD()), + AttachType: uint32(opts.Attach), + } + if err := internal.BPFProgDetach(&attr); err != nil { + return fmt.Errorf("can't detach program: %w", err) + } + + return nil +} diff --git a/vendor/github.com/cilium/ebpf/link/raw_tracepoint.go b/vendor/github.com/cilium/ebpf/link/raw_tracepoint.go new file mode 100644 index 0000000000..f4beb1e078 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/raw_tracepoint.go @@ -0,0 +1,61 @@ +package link + +import ( + "fmt" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal" +) + +type RawTracepointOptions struct { + // Tracepoint name. + Name string + // Program must be of type RawTracepoint* + Program *ebpf.Program +} + +// AttachRawTracepoint links a BPF program to a raw_tracepoint. +// +// Requires at least Linux 4.17. +func AttachRawTracepoint(opts RawTracepointOptions) (Link, error) { + if t := opts.Program.Type(); t != ebpf.RawTracepoint && t != ebpf.RawTracepointWritable { + return nil, fmt.Errorf("invalid program type %s, expected RawTracepoint(Writable)", t) + } + if opts.Program.FD() < 0 { + return nil, fmt.Errorf("invalid program: %w", internal.ErrClosedFd) + } + + fd, err := bpfRawTracepointOpen(&bpfRawTracepointOpenAttr{ + name: internal.NewStringPointer(opts.Name), + fd: uint32(opts.Program.FD()), + }) + if err != nil { + return nil, err + } + + return &progAttachRawTracepoint{fd: fd}, nil +} + +type progAttachRawTracepoint struct { + fd *internal.FD +} + +var _ Link = (*progAttachRawTracepoint)(nil) + +func (rt *progAttachRawTracepoint) isLink() {} + +func (rt *progAttachRawTracepoint) Close() error { + return rt.fd.Close() +} + +func (rt *progAttachRawTracepoint) Update(_ *ebpf.Program) error { + return fmt.Errorf("can't update raw_tracepoint: %w", ErrNotSupported) +} + +func (rt *progAttachRawTracepoint) Pin(_ string) error { + return fmt.Errorf("can't pin raw_tracepoint: %w", ErrNotSupported) +} + +func (rt *progAttachRawTracepoint) Unpin() error { + return fmt.Errorf("unpin raw_tracepoint: %w", ErrNotSupported) +} diff --git a/vendor/github.com/cilium/ebpf/link/syscalls.go b/vendor/github.com/cilium/ebpf/link/syscalls.go new file mode 100644 index 0000000000..a61499438b --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/syscalls.go @@ -0,0 +1,191 @@ +package link + +import ( + "errors" + "unsafe" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/asm" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/unix" +) + +// Type is the kind of link. +type Type uint32 + +// Valid link types. +// +// Equivalent to enum bpf_link_type. +const ( + UnspecifiedType Type = iota + RawTracepointType + TracingType + CgroupType + IterType + NetNsType + XDPType +) + +var haveProgAttach = internal.FeatureTest("BPF_PROG_ATTACH", "4.10", func() error { + prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ + Type: ebpf.CGroupSKB, + AttachType: ebpf.AttachCGroupInetIngress, + License: "MIT", + Instructions: asm.Instructions{ + asm.Mov.Imm(asm.R0, 0), + asm.Return(), + }, + }) + if err != nil { + return internal.ErrNotSupported + } + + // BPF_PROG_ATTACH was introduced at the same time as CGgroupSKB, + // so being able to load the program is enough to infer that we + // have the syscall. + prog.Close() + return nil +}) + +var haveProgAttachReplace = internal.FeatureTest("BPF_PROG_ATTACH atomic replacement", "5.5", func() error { + if err := haveProgAttach(); err != nil { + return err + } + + prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ + Type: ebpf.CGroupSKB, + AttachType: ebpf.AttachCGroupInetIngress, + License: "MIT", + Instructions: asm.Instructions{ + asm.Mov.Imm(asm.R0, 0), + asm.Return(), + }, + }) + if err != nil { + return internal.ErrNotSupported + } + defer prog.Close() + + // We know that we have BPF_PROG_ATTACH since we can load CGroupSKB programs. + // If passing BPF_F_REPLACE gives us EINVAL we know that the feature isn't + // present. + attr := internal.BPFProgAttachAttr{ + // We rely on this being checked after attachFlags. + TargetFd: ^uint32(0), + AttachBpfFd: uint32(prog.FD()), + AttachType: uint32(ebpf.AttachCGroupInetIngress), + AttachFlags: uint32(flagReplace), + } + + err = internal.BPFProgAttach(&attr) + if errors.Is(err, unix.EINVAL) { + return internal.ErrNotSupported + } + if errors.Is(err, unix.EBADF) { + return nil + } + return err +}) + +type bpfLinkCreateAttr struct { + progFd uint32 + targetFd uint32 + attachType ebpf.AttachType + flags uint32 + targetBTFID uint32 +} + +func bpfLinkCreate(attr *bpfLinkCreateAttr) (*internal.FD, error) { + ptr, err := internal.BPF(internal.BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + if err != nil { + return nil, err + } + return internal.NewFD(uint32(ptr)), nil +} + +type bpfLinkCreateIterAttr struct { + prog_fd uint32 + target_fd uint32 + attach_type ebpf.AttachType + flags uint32 + iter_info internal.Pointer + iter_info_len uint32 +} + +func bpfLinkCreateIter(attr *bpfLinkCreateIterAttr) (*internal.FD, error) { + ptr, err := internal.BPF(internal.BPF_LINK_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + if err != nil { + return nil, err + } + return internal.NewFD(uint32(ptr)), nil +} + +type bpfLinkUpdateAttr struct { + linkFd uint32 + newProgFd uint32 + flags uint32 + oldProgFd uint32 +} + +func bpfLinkUpdate(attr *bpfLinkUpdateAttr) error { + _, err := internal.BPF(internal.BPF_LINK_UPDATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + return err +} + +var haveBPFLink = internal.FeatureTest("bpf_link", "5.7", func() error { + prog, err := ebpf.NewProgram(&ebpf.ProgramSpec{ + Type: ebpf.CGroupSKB, + AttachType: ebpf.AttachCGroupInetIngress, + License: "MIT", + Instructions: asm.Instructions{ + asm.Mov.Imm(asm.R0, 0), + asm.Return(), + }, + }) + if err != nil { + return internal.ErrNotSupported + } + defer prog.Close() + + attr := bpfLinkCreateAttr{ + // This is a hopefully invalid file descriptor, which triggers EBADF. + targetFd: ^uint32(0), + progFd: uint32(prog.FD()), + attachType: ebpf.AttachCGroupInetIngress, + } + _, err = bpfLinkCreate(&attr) + if errors.Is(err, unix.EINVAL) { + return internal.ErrNotSupported + } + if errors.Is(err, unix.EBADF) { + return nil + } + return err +}) + +type bpfIterCreateAttr struct { + linkFd uint32 + flags uint32 +} + +func bpfIterCreate(attr *bpfIterCreateAttr) (*internal.FD, error) { + ptr, err := internal.BPF(internal.BPF_ITER_CREATE, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + if err == nil { + return internal.NewFD(uint32(ptr)), nil + } + return nil, err +} + +type bpfRawTracepointOpenAttr struct { + name internal.Pointer + fd uint32 + _ uint32 +} + +func bpfRawTracepointOpen(attr *bpfRawTracepointOpenAttr) (*internal.FD, error) { + ptr, err := internal.BPF(internal.BPF_RAW_TRACEPOINT_OPEN, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + if err == nil { + return internal.NewFD(uint32(ptr)), nil + } + return nil, err +} diff --git a/vendor/github.com/cilium/ebpf/link/tracepoint.go b/vendor/github.com/cilium/ebpf/link/tracepoint.go new file mode 100644 index 0000000000..7423df86b1 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/tracepoint.go @@ -0,0 +1,60 @@ +package link + +import ( + "fmt" + + "github.com/cilium/ebpf" +) + +// Tracepoint attaches the given eBPF program to the tracepoint with the given +// group and name. See /sys/kernel/debug/tracing/events to find available +// tracepoints. The top-level directory is the group, the event's subdirectory +// is the name. Example: +// +// tp, err := Tracepoint("syscalls", "sys_enter_fork", prog) +// +// Losing the reference to the resulting Link (tp) will close the Tracepoint +// and prevent further execution of prog. The Link must be Closed during +// program shutdown to avoid leaking system resources. +// +// Note that attaching eBPF programs to syscalls (sys_enter_*/sys_exit_*) is +// only possible as of kernel 4.14 (commit cf5f5ce). +func Tracepoint(group, name string, prog *ebpf.Program) (Link, error) { + if group == "" || name == "" { + return nil, fmt.Errorf("group and name cannot be empty: %w", errInvalidInput) + } + if prog == nil { + return nil, fmt.Errorf("prog cannot be nil: %w", errInvalidInput) + } + if !rgxTraceEvent.MatchString(group) || !rgxTraceEvent.MatchString(name) { + return nil, fmt.Errorf("group and name '%s/%s' must be alphanumeric or underscore: %w", group, name, errInvalidInput) + } + if prog.Type() != ebpf.TracePoint { + return nil, fmt.Errorf("eBPF program type %s is not a Tracepoint: %w", prog.Type(), errInvalidInput) + } + + tid, err := getTraceEventID(group, name) + if err != nil { + return nil, err + } + + fd, err := openTracepointPerfEvent(tid, perfAllThreads) + if err != nil { + return nil, err + } + + pe := &perfEvent{ + fd: fd, + tracefsID: tid, + group: group, + name: name, + typ: tracepointEvent, + } + + if err := pe.attach(prog); err != nil { + pe.Close() + return nil, err + } + + return pe, nil +} diff --git a/vendor/github.com/cilium/ebpf/link/uprobe.go b/vendor/github.com/cilium/ebpf/link/uprobe.go new file mode 100644 index 0000000000..59170ce046 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/link/uprobe.go @@ -0,0 +1,288 @@ +package link + +import ( + "debug/elf" + "errors" + "fmt" + "os" + "path/filepath" + "regexp" + "sync" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal" +) + +var ( + uprobeEventsPath = filepath.Join(tracefsPath, "uprobe_events") + + // rgxUprobeSymbol is used to strip invalid characters from the uprobe symbol + // as they are not allowed to be used as the EVENT token in tracefs. + rgxUprobeSymbol = regexp.MustCompile("[^a-zA-Z0-9]+") + + uprobeRetprobeBit = struct { + once sync.Once + value uint64 + err error + }{} + + // ErrNoSymbol indicates that the given symbol was not found + // in the ELF symbols table. + ErrNoSymbol = errors.New("not found") +) + +// Executable defines an executable program on the filesystem. +type Executable struct { + // Path of the executable on the filesystem. + path string + // Parsed ELF symbols and dynamic symbols offsets. + offsets map[string]uint64 +} + +// UprobeOptions defines additional parameters that will be used +// when loading Uprobes. +type UprobeOptions struct { + // Symbol offset. Must be provided in case of external symbols (shared libs). + // If set, overrides the offset eventually parsed from the executable. + Offset uint64 + // Only set the uprobe on the given process ID. Useful when tracing + // shared library calls or programs that have many running instances. + PID int +} + +// To open a new Executable, use: +// +// OpenExecutable("/bin/bash") +// +// The returned value can then be used to open Uprobe(s). +func OpenExecutable(path string) (*Executable, error) { + if path == "" { + return nil, fmt.Errorf("path cannot be empty") + } + + f, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("open file '%s': %w", path, err) + } + defer f.Close() + + se, err := internal.NewSafeELFFile(f) + if err != nil { + return nil, fmt.Errorf("parse ELF file: %w", err) + } + + if se.Type != elf.ET_EXEC && se.Type != elf.ET_DYN { + // ELF is not an executable or a shared object. + return nil, errors.New("the given file is not an executable or a shared object") + } + + ex := Executable{ + path: path, + offsets: make(map[string]uint64), + } + + if err := ex.load(se); err != nil { + return nil, err + } + + return &ex, nil +} + +func (ex *Executable) load(f *internal.SafeELFFile) error { + syms, err := f.Symbols() + if err != nil && !errors.Is(err, elf.ErrNoSymbols) { + return err + } + + dynsyms, err := f.DynamicSymbols() + if err != nil && !errors.Is(err, elf.ErrNoSymbols) { + return err + } + + syms = append(syms, dynsyms...) + + for _, s := range syms { + if elf.ST_TYPE(s.Info) != elf.STT_FUNC { + // Symbol not associated with a function or other executable code. + continue + } + + off := s.Value + + // Loop over ELF segments. + for _, prog := range f.Progs { + // Skip uninteresting segments. + if prog.Type != elf.PT_LOAD || (prog.Flags&elf.PF_X) == 0 { + continue + } + + if prog.Vaddr <= s.Value && s.Value < (prog.Vaddr+prog.Memsz) { + // If the symbol value is contained in the segment, calculate + // the symbol offset. + // + // fn symbol offset = fn symbol VA - .text VA + .text offset + // + // stackoverflow.com/a/40249502 + off = s.Value - prog.Vaddr + prog.Off + break + } + } + + ex.offsets[s.Name] = off + } + + return nil +} + +func (ex *Executable) offset(symbol string) (uint64, error) { + if off, ok := ex.offsets[symbol]; ok { + // Symbols with location 0 from section undef are shared library calls and + // are relocated before the binary is executed. Dynamic linking is not + // implemented by the library, so mark this as unsupported for now. + // + // Since only offset values are stored and not elf.Symbol, if the value is 0, + // assume it's an external symbol. + if off == 0 { + return 0, fmt.Errorf("cannot resolve %s library call '%s', "+ + "consider providing the offset via options: %w", ex.path, symbol, ErrNotSupported) + } + return off, nil + } + return 0, fmt.Errorf("symbol %s: %w", symbol, ErrNoSymbol) +} + +// Uprobe attaches the given eBPF program to a perf event that fires when the +// given symbol starts executing in the given Executable. +// For example, /bin/bash::main(): +// +// ex, _ = OpenExecutable("/bin/bash") +// ex.Uprobe("main", prog, nil) +// +// When using symbols which belongs to shared libraries, +// an offset must be provided via options: +// +// up, err := ex.Uprobe("main", prog, &UprobeOptions{Offset: 0x123}) +// +// Losing the reference to the resulting Link (up) will close the Uprobe +// and prevent further execution of prog. The Link must be Closed during +// program shutdown to avoid leaking system resources. +// +// Functions provided by shared libraries can currently not be traced and +// will result in an ErrNotSupported. +func (ex *Executable) Uprobe(symbol string, prog *ebpf.Program, opts *UprobeOptions) (Link, error) { + u, err := ex.uprobe(symbol, prog, opts, false) + if err != nil { + return nil, err + } + + err = u.attach(prog) + if err != nil { + u.Close() + return nil, err + } + + return u, nil +} + +// Uretprobe attaches the given eBPF program to a perf event that fires right +// before the given symbol exits. For example, /bin/bash::main(): +// +// ex, _ = OpenExecutable("/bin/bash") +// ex.Uretprobe("main", prog, nil) +// +// When using symbols which belongs to shared libraries, +// an offset must be provided via options: +// +// up, err := ex.Uretprobe("main", prog, &UprobeOptions{Offset: 0x123}) +// +// Losing the reference to the resulting Link (up) will close the Uprobe +// and prevent further execution of prog. The Link must be Closed during +// program shutdown to avoid leaking system resources. +// +// Functions provided by shared libraries can currently not be traced and +// will result in an ErrNotSupported. +func (ex *Executable) Uretprobe(symbol string, prog *ebpf.Program, opts *UprobeOptions) (Link, error) { + u, err := ex.uprobe(symbol, prog, opts, true) + if err != nil { + return nil, err + } + + err = u.attach(prog) + if err != nil { + u.Close() + return nil, err + } + + return u, nil +} + +// uprobe opens a perf event for the given binary/symbol and attaches prog to it. +// If ret is true, create a uretprobe. +func (ex *Executable) uprobe(symbol string, prog *ebpf.Program, opts *UprobeOptions, ret bool) (*perfEvent, error) { + if prog == nil { + return nil, fmt.Errorf("prog cannot be nil: %w", errInvalidInput) + } + if prog.Type() != ebpf.Kprobe { + return nil, fmt.Errorf("eBPF program type %s is not Kprobe: %w", prog.Type(), errInvalidInput) + } + + var offset uint64 + if opts != nil && opts.Offset != 0 { + offset = opts.Offset + } else { + off, err := ex.offset(symbol) + if err != nil { + return nil, err + } + offset = off + } + + pid := perfAllThreads + if opts != nil && opts.PID != 0 { + pid = opts.PID + } + + // Use uprobe PMU if the kernel has it available. + tp, err := pmuUprobe(symbol, ex.path, offset, pid, ret) + if err == nil { + return tp, nil + } + if err != nil && !errors.Is(err, ErrNotSupported) { + return nil, fmt.Errorf("creating perf_uprobe PMU: %w", err) + } + + // Use tracefs if uprobe PMU is missing. + tp, err = tracefsUprobe(uprobeSanitizedSymbol(symbol), ex.path, offset, pid, ret) + if err != nil { + return nil, fmt.Errorf("creating trace event '%s:%s' in tracefs: %w", ex.path, symbol, err) + } + + return tp, nil +} + +// pmuUprobe opens a perf event based on the uprobe PMU. +func pmuUprobe(symbol, path string, offset uint64, pid int, ret bool) (*perfEvent, error) { + return pmuProbe(uprobeType, symbol, path, offset, pid, ret) +} + +// tracefsUprobe creates a Uprobe tracefs entry. +func tracefsUprobe(symbol, path string, offset uint64, pid int, ret bool) (*perfEvent, error) { + return tracefsProbe(uprobeType, symbol, path, offset, pid, ret) +} + +// uprobeSanitizedSymbol replaces every invalid characted for the tracefs api with an underscore. +func uprobeSanitizedSymbol(symbol string) string { + return rgxUprobeSymbol.ReplaceAllString(symbol, "_") +} + +// uprobePathOffset creates the PATH:OFFSET token for the tracefs api. +func uprobePathOffset(path string, offset uint64) string { + return fmt.Sprintf("%s:%#x", path, offset) +} + +func uretprobeBit() (uint64, error) { + uprobeRetprobeBit.once.Do(func() { + uprobeRetprobeBit.value, uprobeRetprobeBit.err = determineRetprobeBit(uprobeType) + }) + return uprobeRetprobeBit.value, uprobeRetprobeBit.err +} diff --git a/vendor/github.com/cilium/ebpf/linker.go b/vendor/github.com/cilium/ebpf/linker.go new file mode 100644 index 0000000000..f3b1629e70 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/linker.go @@ -0,0 +1,159 @@ +package ebpf + +import ( + "fmt" + + "github.com/cilium/ebpf/asm" +) + +// link resolves bpf-to-bpf calls. +// +// Each library may contain multiple functions / labels, and is only linked +// if prog references one of these functions. +// +// Libraries also linked. +func link(prog *ProgramSpec, libs []*ProgramSpec) error { + var ( + linked = make(map[*ProgramSpec]bool) + pending = []asm.Instructions{prog.Instructions} + insns asm.Instructions + ) + for len(pending) > 0 { + insns, pending = pending[0], pending[1:] + for _, lib := range libs { + if linked[lib] { + continue + } + + needed, err := needSection(insns, lib.Instructions) + if err != nil { + return fmt.Errorf("linking %s: %w", lib.Name, err) + } + + if !needed { + continue + } + + linked[lib] = true + prog.Instructions = append(prog.Instructions, lib.Instructions...) + pending = append(pending, lib.Instructions) + + if prog.BTF != nil && lib.BTF != nil { + if err := prog.BTF.Append(lib.BTF); err != nil { + return fmt.Errorf("linking BTF of %s: %w", lib.Name, err) + } + } + } + } + + return nil +} + +func needSection(insns, section asm.Instructions) (bool, error) { + // A map of symbols to the libraries which contain them. + symbols, err := section.SymbolOffsets() + if err != nil { + return false, err + } + + for _, ins := range insns { + if ins.Reference == "" { + continue + } + + if ins.OpCode.JumpOp() != asm.Call || ins.Src != asm.PseudoCall { + continue + } + + if ins.Constant != -1 { + // This is already a valid call, no need to link again. + continue + } + + if _, ok := symbols[ins.Reference]; !ok { + // Symbol isn't available in this section + continue + } + + // At this point we know that at least one function in the + // library is called from insns, so we have to link it. + return true, nil + } + + // None of the functions in the section are called. + return false, nil +} + +func fixupJumpsAndCalls(insns asm.Instructions) error { + symbolOffsets := make(map[string]asm.RawInstructionOffset) + iter := insns.Iterate() + for iter.Next() { + ins := iter.Ins + + if ins.Symbol == "" { + continue + } + + if _, ok := symbolOffsets[ins.Symbol]; ok { + return fmt.Errorf("duplicate symbol %s", ins.Symbol) + } + + symbolOffsets[ins.Symbol] = iter.Offset + } + + iter = insns.Iterate() + for iter.Next() { + i := iter.Index + offset := iter.Offset + ins := iter.Ins + + if ins.Reference == "" { + continue + } + + switch { + case ins.IsFunctionCall() && ins.Constant == -1: + // Rewrite bpf to bpf call + callOffset, ok := symbolOffsets[ins.Reference] + if !ok { + return fmt.Errorf("call at %d: reference to missing symbol %q", i, ins.Reference) + } + + ins.Constant = int64(callOffset - offset - 1) + + case ins.OpCode.Class() == asm.JumpClass && ins.Offset == -1: + // Rewrite jump to label + jumpOffset, ok := symbolOffsets[ins.Reference] + if !ok { + return fmt.Errorf("jump at %d: reference to missing symbol %q", i, ins.Reference) + } + + ins.Offset = int16(jumpOffset - offset - 1) + + case ins.IsLoadFromMap() && ins.MapPtr() == -1: + return fmt.Errorf("map %s: %w", ins.Reference, errUnsatisfiedReference) + } + } + + // fixupBPFCalls replaces bpf_probe_read_{kernel,user}[_str] with bpf_probe_read[_str] on older kernels + // https://github.com/libbpf/libbpf/blob/master/src/libbpf.c#L6009 + iter = insns.Iterate() + for iter.Next() { + ins := iter.Ins + if !ins.IsBuiltinCall() { + continue + } + switch asm.BuiltinFunc(ins.Constant) { + case asm.FnProbeReadKernel, asm.FnProbeReadUser: + if err := haveProbeReadKernel(); err != nil { + ins.Constant = int64(asm.FnProbeRead) + } + case asm.FnProbeReadKernelStr, asm.FnProbeReadUserStr: + if err := haveProbeReadKernel(); err != nil { + ins.Constant = int64(asm.FnProbeReadStr) + } + } + } + + return nil +} diff --git a/vendor/github.com/cilium/ebpf/map.go b/vendor/github.com/cilium/ebpf/map.go new file mode 100644 index 0000000000..cca387ead0 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/map.go @@ -0,0 +1,1267 @@ +package ebpf + +import ( + "bytes" + "errors" + "fmt" + "io" + "path/filepath" + "reflect" + "strings" + + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/btf" + "github.com/cilium/ebpf/internal/unix" +) + +// Errors returned by Map and MapIterator methods. +var ( + ErrKeyNotExist = errors.New("key does not exist") + ErrKeyExist = errors.New("key already exists") + ErrIterationAborted = errors.New("iteration aborted") + ErrMapIncompatible = errors.New("map's spec is incompatible with pinned map") +) + +// MapOptions control loading a map into the kernel. +type MapOptions struct { + // The base path to pin maps in if requested via PinByName. + // Existing maps will be re-used if they are compatible, otherwise an + // error is returned. + PinPath string + LoadPinOptions LoadPinOptions +} + +// MapID represents the unique ID of an eBPF map +type MapID uint32 + +// MapSpec defines a Map. +type MapSpec struct { + // Name is passed to the kernel as a debug aid. Must only contain + // alpha numeric and '_' characters. + Name string + Type MapType + KeySize uint32 + ValueSize uint32 + MaxEntries uint32 + + // Flags is passed to the kernel and specifies additional map + // creation attributes. + Flags uint32 + + // Automatically pin and load a map from MapOptions.PinPath. + // Generates an error if an existing pinned map is incompatible with the MapSpec. + Pinning PinType + + // Specify numa node during map creation + // (effective only if unix.BPF_F_NUMA_NODE flag is set, + // which can be imported from golang.org/x/sys/unix) + NumaNode uint32 + + // The initial contents of the map. May be nil. + Contents []MapKV + + // Whether to freeze a map after setting its initial contents. + Freeze bool + + // InnerMap is used as a template for ArrayOfMaps and HashOfMaps + InnerMap *MapSpec + + // Extra trailing bytes found in the ELF map definition when using structs + // larger than libbpf's bpf_map_def. Must be empty before instantiating + // the MapSpec into a Map. + Extra bytes.Reader + + // The BTF associated with this map. + BTF *btf.Map +} + +func (ms *MapSpec) String() string { + return fmt.Sprintf("%s(keySize=%d, valueSize=%d, maxEntries=%d, flags=%d)", ms.Type, ms.KeySize, ms.ValueSize, ms.MaxEntries, ms.Flags) +} + +// Copy returns a copy of the spec. +// +// MapSpec.Contents is a shallow copy. +func (ms *MapSpec) Copy() *MapSpec { + if ms == nil { + return nil + } + + cpy := *ms + + cpy.Contents = make([]MapKV, len(ms.Contents)) + copy(cpy.Contents, ms.Contents) + + cpy.InnerMap = ms.InnerMap.Copy() + + return &cpy +} + +func (ms *MapSpec) clampPerfEventArraySize() error { + if ms.Type != PerfEventArray { + return nil + } + + n, err := internal.PossibleCPUs() + if err != nil { + return fmt.Errorf("perf event array: %w", err) + } + + if n := uint32(n); ms.MaxEntries > n { + ms.MaxEntries = n + } + + return nil +} + +// MapKV is used to initialize the contents of a Map. +type MapKV struct { + Key interface{} + Value interface{} +} + +func (ms *MapSpec) checkCompatibility(m *Map) error { + switch { + case m.typ != ms.Type: + return fmt.Errorf("expected type %v, got %v: %w", ms.Type, m.typ, ErrMapIncompatible) + + case m.keySize != ms.KeySize: + return fmt.Errorf("expected key size %v, got %v: %w", ms.KeySize, m.keySize, ErrMapIncompatible) + + case m.valueSize != ms.ValueSize: + return fmt.Errorf("expected value size %v, got %v: %w", ms.ValueSize, m.valueSize, ErrMapIncompatible) + + case m.maxEntries != ms.MaxEntries: + return fmt.Errorf("expected max entries %v, got %v: %w", ms.MaxEntries, m.maxEntries, ErrMapIncompatible) + + case m.flags != ms.Flags: + return fmt.Errorf("expected flags %v, got %v: %w", ms.Flags, m.flags, ErrMapIncompatible) + } + return nil +} + +// Map represents a Map file descriptor. +// +// It is not safe to close a map which is used by other goroutines. +// +// Methods which take interface{} arguments by default encode +// them using binary.Read/Write in the machine's native endianness. +// +// Implement encoding.BinaryMarshaler or encoding.BinaryUnmarshaler +// if you require custom encoding. +type Map struct { + name string + fd *internal.FD + typ MapType + keySize uint32 + valueSize uint32 + maxEntries uint32 + flags uint32 + pinnedPath string + // Per CPU maps return values larger than the size in the spec + fullValueSize int +} + +// NewMapFromFD creates a map from a raw fd. +// +// You should not use fd after calling this function. +func NewMapFromFD(fd int) (*Map, error) { + if fd < 0 { + return nil, errors.New("invalid fd") + } + + return newMapFromFD(internal.NewFD(uint32(fd))) +} + +func newMapFromFD(fd *internal.FD) (*Map, error) { + info, err := newMapInfoFromFd(fd) + if err != nil { + fd.Close() + return nil, fmt.Errorf("get map info: %s", err) + } + + return newMap(fd, info.Name, info.Type, info.KeySize, info.ValueSize, info.MaxEntries, info.Flags) +} + +// NewMap creates a new Map. +// +// It's equivalent to calling NewMapWithOptions with default options. +func NewMap(spec *MapSpec) (*Map, error) { + return NewMapWithOptions(spec, MapOptions{}) +} + +// NewMapWithOptions creates a new Map. +// +// Creating a map for the first time will perform feature detection +// by creating small, temporary maps. +// +// The caller is responsible for ensuring the process' rlimit is set +// sufficiently high for locking memory during map creation. This can be done +// by calling rlimit.RemoveMemlock() prior to calling NewMapWithOptions. +// +// May return an error wrapping ErrMapIncompatible. +func NewMapWithOptions(spec *MapSpec, opts MapOptions) (*Map, error) { + handles := newHandleCache() + defer handles.close() + + m, err := newMapWithOptions(spec, opts, handles) + if err != nil { + return nil, fmt.Errorf("creating map: %w", err) + } + + err = m.finalize(spec) + if err != nil { + return nil, fmt.Errorf("populating map: %w", err) + } + + return m, nil +} + +func newMapWithOptions(spec *MapSpec, opts MapOptions, handles *handleCache) (_ *Map, err error) { + closeOnError := func(c io.Closer) { + if err != nil { + c.Close() + } + } + + switch spec.Pinning { + case PinByName: + if spec.Name == "" { + return nil, fmt.Errorf("pin by name: missing Name") + } + + if opts.PinPath == "" { + return nil, fmt.Errorf("pin by name: missing MapOptions.PinPath") + } + + path := filepath.Join(opts.PinPath, spec.Name) + m, err := LoadPinnedMap(path, &opts.LoadPinOptions) + if errors.Is(err, unix.ENOENT) { + break + } + if err != nil { + return nil, fmt.Errorf("load pinned map: %w", err) + } + defer closeOnError(m) + + if err := spec.checkCompatibility(m); err != nil { + return nil, fmt.Errorf("use pinned map %s: %w", spec.Name, err) + } + + return m, nil + + case PinNone: + // Nothing to do here + + default: + return nil, fmt.Errorf("pin type %d: %w", int(spec.Pinning), ErrNotSupported) + } + + var innerFd *internal.FD + if spec.Type == ArrayOfMaps || spec.Type == HashOfMaps { + if spec.InnerMap == nil { + return nil, fmt.Errorf("%s requires InnerMap", spec.Type) + } + + if spec.InnerMap.Pinning != PinNone { + return nil, errors.New("inner maps cannot be pinned") + } + + template, err := spec.InnerMap.createMap(nil, opts, handles) + if err != nil { + return nil, fmt.Errorf("inner map: %w", err) + } + defer template.Close() + + // Intentionally skip populating and freezing (finalizing) + // the inner map template since it will be removed shortly. + + innerFd = template.fd + } + + m, err := spec.createMap(innerFd, opts, handles) + if err != nil { + return nil, err + } + defer closeOnError(m) + + if spec.Pinning == PinByName { + path := filepath.Join(opts.PinPath, spec.Name) + if err := m.Pin(path); err != nil { + return nil, fmt.Errorf("pin map: %s", err) + } + } + + return m, nil +} + +// createMap validates the spec's properties and creates the map in the kernel +// using the given opts. It does not populate or freeze the map. +func (spec *MapSpec) createMap(inner *internal.FD, opts MapOptions, handles *handleCache) (_ *Map, err error) { + closeOnError := func(closer io.Closer) { + if err != nil { + closer.Close() + } + } + + spec = spec.Copy() + + // Kernels 4.13 through 5.4 used a struct bpf_map_def that contained + // additional 'inner_map_idx' and later 'numa_node' fields. + // In order to support loading these definitions, tolerate the presence of + // extra bytes, but require them to be zeroes. + if _, err := io.Copy(internal.DiscardZeroes{}, &spec.Extra); err != nil { + return nil, errors.New("extra contains unhandled non-zero bytes, drain before creating map") + } + + switch spec.Type { + case ArrayOfMaps, HashOfMaps: + if err := haveNestedMaps(); err != nil { + return nil, err + } + + if spec.ValueSize != 0 && spec.ValueSize != 4 { + return nil, errors.New("ValueSize must be zero or four for map of map") + } + spec.ValueSize = 4 + + case PerfEventArray: + if spec.KeySize != 0 && spec.KeySize != 4 { + return nil, errors.New("KeySize must be zero or four for perf event array") + } + spec.KeySize = 4 + + if spec.ValueSize != 0 && spec.ValueSize != 4 { + return nil, errors.New("ValueSize must be zero or four for perf event array") + } + spec.ValueSize = 4 + + if spec.MaxEntries == 0 { + n, err := internal.PossibleCPUs() + if err != nil { + return nil, fmt.Errorf("perf event array: %w", err) + } + spec.MaxEntries = uint32(n) + } + } + + if spec.Flags&(unix.BPF_F_RDONLY_PROG|unix.BPF_F_WRONLY_PROG) > 0 || spec.Freeze { + if err := haveMapMutabilityModifiers(); err != nil { + return nil, fmt.Errorf("map create: %w", err) + } + } + if spec.Flags&unix.BPF_F_MMAPABLE > 0 { + if err := haveMmapableMaps(); err != nil { + return nil, fmt.Errorf("map create: %w", err) + } + } + if spec.Flags&unix.BPF_F_INNER_MAP > 0 { + if err := haveInnerMaps(); err != nil { + return nil, fmt.Errorf("map create: %w", err) + } + } + + attr := internal.BPFMapCreateAttr{ + MapType: uint32(spec.Type), + KeySize: spec.KeySize, + ValueSize: spec.ValueSize, + MaxEntries: spec.MaxEntries, + Flags: spec.Flags, + NumaNode: spec.NumaNode, + } + + if inner != nil { + var err error + attr.InnerMapFd, err = inner.Value() + if err != nil { + return nil, fmt.Errorf("map create: %w", err) + } + } + + if haveObjName() == nil { + attr.MapName = internal.NewBPFObjName(spec.Name) + } + + var btfDisabled bool + if spec.BTF != nil { + handle, err := handles.btfHandle(spec.BTF.Spec) + btfDisabled = errors.Is(err, btf.ErrNotSupported) + if err != nil && !btfDisabled { + return nil, fmt.Errorf("load BTF: %w", err) + } + + if handle != nil { + attr.BTFFd = uint32(handle.FD()) + attr.BTFKeyTypeID = uint32(spec.BTF.Key.ID()) + attr.BTFValueTypeID = uint32(spec.BTF.Value.ID()) + } + } + + fd, err := internal.BPFMapCreate(&attr) + if err != nil { + if errors.Is(err, unix.EPERM) { + return nil, fmt.Errorf("map create: %w (MEMLOCK bay be too low, consider rlimit.RemoveMemlock)", err) + } + if btfDisabled { + return nil, fmt.Errorf("map create without BTF: %w", err) + } + return nil, fmt.Errorf("map create: %w", err) + } + defer closeOnError(fd) + + m, err := newMap(fd, spec.Name, spec.Type, spec.KeySize, spec.ValueSize, spec.MaxEntries, spec.Flags) + if err != nil { + return nil, fmt.Errorf("map create: %w", err) + } + + return m, nil +} + +// newMap allocates and returns a new Map structure. +// Sets the fullValueSize on per-CPU maps. +func newMap(fd *internal.FD, name string, typ MapType, keySize, valueSize, maxEntries, flags uint32) (*Map, error) { + m := &Map{ + name, + fd, + typ, + keySize, + valueSize, + maxEntries, + flags, + "", + int(valueSize), + } + + if !typ.hasPerCPUValue() { + return m, nil + } + + possibleCPUs, err := internal.PossibleCPUs() + if err != nil { + return nil, err + } + + m.fullValueSize = internal.Align(int(valueSize), 8) * possibleCPUs + return m, nil +} + +func (m *Map) String() string { + if m.name != "" { + return fmt.Sprintf("%s(%s)#%v", m.typ, m.name, m.fd) + } + return fmt.Sprintf("%s#%v", m.typ, m.fd) +} + +// Type returns the underlying type of the map. +func (m *Map) Type() MapType { + return m.typ +} + +// KeySize returns the size of the map key in bytes. +func (m *Map) KeySize() uint32 { + return m.keySize +} + +// ValueSize returns the size of the map value in bytes. +func (m *Map) ValueSize() uint32 { + return m.valueSize +} + +// MaxEntries returns the maximum number of elements the map can hold. +func (m *Map) MaxEntries() uint32 { + return m.maxEntries +} + +// Flags returns the flags of the map. +func (m *Map) Flags() uint32 { + return m.flags +} + +// Info returns metadata about the map. +func (m *Map) Info() (*MapInfo, error) { + return newMapInfoFromFd(m.fd) +} + +// Lookup retrieves a value from a Map. +// +// Calls Close() on valueOut if it is of type **Map or **Program, +// and *valueOut is not nil. +// +// Returns an error if the key doesn't exist, see ErrKeyNotExist. +func (m *Map) Lookup(key, valueOut interface{}) error { + valuePtr, valueBytes := makeBuffer(valueOut, m.fullValueSize) + if err := m.lookup(key, valuePtr); err != nil { + return err + } + + return m.unmarshalValue(valueOut, valueBytes) +} + +// LookupAndDelete retrieves and deletes a value from a Map. +// +// Returns ErrKeyNotExist if the key doesn't exist. +func (m *Map) LookupAndDelete(key, valueOut interface{}) error { + valuePtr, valueBytes := makeBuffer(valueOut, m.fullValueSize) + + keyPtr, err := m.marshalKey(key) + if err != nil { + return fmt.Errorf("can't marshal key: %w", err) + } + + if err := bpfMapLookupAndDelete(m.fd, keyPtr, valuePtr); err != nil { + return fmt.Errorf("lookup and delete failed: %w", err) + } + + return m.unmarshalValue(valueOut, valueBytes) +} + +// LookupBytes gets a value from Map. +// +// Returns a nil value if a key doesn't exist. +func (m *Map) LookupBytes(key interface{}) ([]byte, error) { + valueBytes := make([]byte, m.fullValueSize) + valuePtr := internal.NewSlicePointer(valueBytes) + + err := m.lookup(key, valuePtr) + if errors.Is(err, ErrKeyNotExist) { + return nil, nil + } + + return valueBytes, err +} + +func (m *Map) lookup(key interface{}, valueOut internal.Pointer) error { + keyPtr, err := m.marshalKey(key) + if err != nil { + return fmt.Errorf("can't marshal key: %w", err) + } + + if err = bpfMapLookupElem(m.fd, keyPtr, valueOut); err != nil { + return fmt.Errorf("lookup failed: %w", err) + } + return nil +} + +// MapUpdateFlags controls the behaviour of the Map.Update call. +// +// The exact semantics depend on the specific MapType. +type MapUpdateFlags uint64 + +const ( + // UpdateAny creates a new element or update an existing one. + UpdateAny MapUpdateFlags = iota + // UpdateNoExist creates a new element. + UpdateNoExist MapUpdateFlags = 1 << (iota - 1) + // UpdateExist updates an existing element. + UpdateExist +) + +// Put replaces or creates a value in map. +// +// It is equivalent to calling Update with UpdateAny. +func (m *Map) Put(key, value interface{}) error { + return m.Update(key, value, UpdateAny) +} + +// Update changes the value of a key. +func (m *Map) Update(key, value interface{}, flags MapUpdateFlags) error { + keyPtr, err := m.marshalKey(key) + if err != nil { + return fmt.Errorf("can't marshal key: %w", err) + } + + valuePtr, err := m.marshalValue(value) + if err != nil { + return fmt.Errorf("can't marshal value: %w", err) + } + + if err = bpfMapUpdateElem(m.fd, keyPtr, valuePtr, uint64(flags)); err != nil { + return fmt.Errorf("update failed: %w", err) + } + + return nil +} + +// Delete removes a value. +// +// Returns ErrKeyNotExist if the key does not exist. +func (m *Map) Delete(key interface{}) error { + keyPtr, err := m.marshalKey(key) + if err != nil { + return fmt.Errorf("can't marshal key: %w", err) + } + + if err = bpfMapDeleteElem(m.fd, keyPtr); err != nil { + return fmt.Errorf("delete failed: %w", err) + } + return nil +} + +// NextKey finds the key following an initial key. +// +// See NextKeyBytes for details. +// +// Returns ErrKeyNotExist if there is no next key. +func (m *Map) NextKey(key, nextKeyOut interface{}) error { + nextKeyPtr, nextKeyBytes := makeBuffer(nextKeyOut, int(m.keySize)) + + if err := m.nextKey(key, nextKeyPtr); err != nil { + return err + } + + if err := m.unmarshalKey(nextKeyOut, nextKeyBytes); err != nil { + return fmt.Errorf("can't unmarshal next key: %w", err) + } + return nil +} + +// NextKeyBytes returns the key following an initial key as a byte slice. +// +// Passing nil will return the first key. +// +// Use Iterate if you want to traverse all entries in the map. +// +// Returns nil if there are no more keys. +func (m *Map) NextKeyBytes(key interface{}) ([]byte, error) { + nextKey := make([]byte, m.keySize) + nextKeyPtr := internal.NewSlicePointer(nextKey) + + err := m.nextKey(key, nextKeyPtr) + if errors.Is(err, ErrKeyNotExist) { + return nil, nil + } + + return nextKey, err +} + +func (m *Map) nextKey(key interface{}, nextKeyOut internal.Pointer) error { + var ( + keyPtr internal.Pointer + err error + ) + + if key != nil { + keyPtr, err = m.marshalKey(key) + if err != nil { + return fmt.Errorf("can't marshal key: %w", err) + } + } + + if err = bpfMapGetNextKey(m.fd, keyPtr, nextKeyOut); err != nil { + return fmt.Errorf("next key failed: %w", err) + } + return nil +} + +// BatchLookup looks up many elements in a map at once. +// +// "keysOut" and "valuesOut" must be of type slice, a pointer +// to a slice or buffer will not work. +// "prevKey" is the key to start the batch lookup from, it will +// *not* be included in the results. Use nil to start at the first key. +// +// ErrKeyNotExist is returned when the batch lookup has reached +// the end of all possible results, even when partial results +// are returned. It should be used to evaluate when lookup is "done". +func (m *Map) BatchLookup(prevKey, nextKeyOut, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) { + return m.batchLookup(internal.BPF_MAP_LOOKUP_BATCH, prevKey, nextKeyOut, keysOut, valuesOut, opts) +} + +// BatchLookupAndDelete looks up many elements in a map at once, +// +// It then deletes all those elements. +// "keysOut" and "valuesOut" must be of type slice, a pointer +// to a slice or buffer will not work. +// "prevKey" is the key to start the batch lookup from, it will +// *not* be included in the results. Use nil to start at the first key. +// +// ErrKeyNotExist is returned when the batch lookup has reached +// the end of all possible results, even when partial results +// are returned. It should be used to evaluate when lookup is "done". +func (m *Map) BatchLookupAndDelete(prevKey, nextKeyOut, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) { + return m.batchLookup(internal.BPF_MAP_LOOKUP_AND_DELETE_BATCH, prevKey, nextKeyOut, keysOut, valuesOut, opts) +} + +func (m *Map) batchLookup(cmd internal.BPFCmd, startKey, nextKeyOut, keysOut, valuesOut interface{}, opts *BatchOptions) (int, error) { + if err := haveBatchAPI(); err != nil { + return 0, err + } + if m.typ.hasPerCPUValue() { + return 0, ErrNotSupported + } + keysValue := reflect.ValueOf(keysOut) + if keysValue.Kind() != reflect.Slice { + return 0, fmt.Errorf("keys must be a slice") + } + valuesValue := reflect.ValueOf(valuesOut) + if valuesValue.Kind() != reflect.Slice { + return 0, fmt.Errorf("valuesOut must be a slice") + } + count := keysValue.Len() + if count != valuesValue.Len() { + return 0, fmt.Errorf("keysOut and valuesOut must be the same length") + } + keyBuf := make([]byte, count*int(m.keySize)) + keyPtr := internal.NewSlicePointer(keyBuf) + valueBuf := make([]byte, count*int(m.fullValueSize)) + valuePtr := internal.NewSlicePointer(valueBuf) + + var ( + startPtr internal.Pointer + err error + retErr error + ) + if startKey != nil { + startPtr, err = marshalPtr(startKey, int(m.keySize)) + if err != nil { + return 0, err + } + } + nextPtr, nextBuf := makeBuffer(nextKeyOut, int(m.keySize)) + + ct, err := bpfMapBatch(cmd, m.fd, startPtr, nextPtr, keyPtr, valuePtr, uint32(count), opts) + if err != nil { + if !errors.Is(err, ErrKeyNotExist) { + return 0, err + } + retErr = ErrKeyNotExist + } + + err = m.unmarshalKey(nextKeyOut, nextBuf) + if err != nil { + return 0, err + } + err = unmarshalBytes(keysOut, keyBuf) + if err != nil { + return 0, err + } + err = unmarshalBytes(valuesOut, valueBuf) + if err != nil { + retErr = err + } + return int(ct), retErr +} + +// BatchUpdate updates the map with multiple keys and values +// simultaneously. +// "keys" and "values" must be of type slice, a pointer +// to a slice or buffer will not work. +func (m *Map) BatchUpdate(keys, values interface{}, opts *BatchOptions) (int, error) { + if err := haveBatchAPI(); err != nil { + return 0, err + } + if m.typ.hasPerCPUValue() { + return 0, ErrNotSupported + } + keysValue := reflect.ValueOf(keys) + if keysValue.Kind() != reflect.Slice { + return 0, fmt.Errorf("keys must be a slice") + } + valuesValue := reflect.ValueOf(values) + if valuesValue.Kind() != reflect.Slice { + return 0, fmt.Errorf("values must be a slice") + } + var ( + count = keysValue.Len() + valuePtr internal.Pointer + err error + ) + if count != valuesValue.Len() { + return 0, fmt.Errorf("keys and values must be the same length") + } + keyPtr, err := marshalPtr(keys, count*int(m.keySize)) + if err != nil { + return 0, err + } + valuePtr, err = marshalPtr(values, count*int(m.valueSize)) + if err != nil { + return 0, err + } + var nilPtr internal.Pointer + ct, err := bpfMapBatch(internal.BPF_MAP_UPDATE_BATCH, m.fd, nilPtr, nilPtr, keyPtr, valuePtr, uint32(count), opts) + return int(ct), err +} + +// BatchDelete batch deletes entries in the map by keys. +// "keys" must be of type slice, a pointer to a slice or buffer will not work. +func (m *Map) BatchDelete(keys interface{}, opts *BatchOptions) (int, error) { + if err := haveBatchAPI(); err != nil { + return 0, err + } + if m.typ.hasPerCPUValue() { + return 0, ErrNotSupported + } + keysValue := reflect.ValueOf(keys) + if keysValue.Kind() != reflect.Slice { + return 0, fmt.Errorf("keys must be a slice") + } + count := keysValue.Len() + keyPtr, err := marshalPtr(keys, count*int(m.keySize)) + if err != nil { + return 0, fmt.Errorf("cannot marshal keys: %v", err) + } + var nilPtr internal.Pointer + ct, err := bpfMapBatch(internal.BPF_MAP_DELETE_BATCH, m.fd, nilPtr, nilPtr, keyPtr, nilPtr, uint32(count), opts) + return int(ct), err +} + +// Iterate traverses a map. +// +// It's safe to create multiple iterators at the same time. +// +// It's not possible to guarantee that all keys in a map will be +// returned if there are concurrent modifications to the map. +func (m *Map) Iterate() *MapIterator { + return newMapIterator(m) +} + +// Close removes a Map +func (m *Map) Close() error { + if m == nil { + // This makes it easier to clean up when iterating maps + // of maps / programs. + return nil + } + + return m.fd.Close() +} + +// FD gets the file descriptor of the Map. +// +// Calling this function is invalid after Close has been called. +func (m *Map) FD() int { + fd, err := m.fd.Value() + if err != nil { + // Best effort: -1 is the number most likely to be an + // invalid file descriptor. + return -1 + } + + return int(fd) +} + +// Clone creates a duplicate of the Map. +// +// Closing the duplicate does not affect the original, and vice versa. +// Changes made to the map are reflected by both instances however. +// If the original map was pinned, the cloned map will not be pinned by default. +// +// Cloning a nil Map returns nil. +func (m *Map) Clone() (*Map, error) { + if m == nil { + return nil, nil + } + + dup, err := m.fd.Dup() + if err != nil { + return nil, fmt.Errorf("can't clone map: %w", err) + } + + return &Map{ + m.name, + dup, + m.typ, + m.keySize, + m.valueSize, + m.maxEntries, + m.flags, + "", + m.fullValueSize, + }, nil +} + +// Pin persists the map on the BPF virtual file system past the lifetime of +// the process that created it . +// +// Calling Pin on a previously pinned map will overwrite the path, except when +// the new path already exists. Re-pinning across filesystems is not supported. +// You can Clone a map to pin it to a different path. +// +// This requires bpffs to be mounted above fileName. See https://docs.cilium.io/en/k8s-doc/admin/#admin-mount-bpffs +func (m *Map) Pin(fileName string) error { + if err := internal.Pin(m.pinnedPath, fileName, m.fd); err != nil { + return err + } + m.pinnedPath = fileName + return nil +} + +// Unpin removes the persisted state for the map from the BPF virtual filesystem. +// +// Failed calls to Unpin will not alter the state returned by IsPinned. +// +// Unpinning an unpinned Map returns nil. +func (m *Map) Unpin() error { + if err := internal.Unpin(m.pinnedPath); err != nil { + return err + } + m.pinnedPath = "" + return nil +} + +// IsPinned returns true if the map has a non-empty pinned path. +func (m *Map) IsPinned() bool { + return m.pinnedPath != "" +} + +// Freeze prevents a map to be modified from user space. +// +// It makes no changes to kernel-side restrictions. +func (m *Map) Freeze() error { + if err := haveMapMutabilityModifiers(); err != nil { + return fmt.Errorf("can't freeze map: %w", err) + } + + if err := bpfMapFreeze(m.fd); err != nil { + return fmt.Errorf("can't freeze map: %w", err) + } + return nil +} + +// finalize populates the Map according to the Contents specified +// in spec and freezes the Map if requested by spec. +func (m *Map) finalize(spec *MapSpec) error { + for _, kv := range spec.Contents { + if err := m.Put(kv.Key, kv.Value); err != nil { + return fmt.Errorf("putting value: key %v: %w", kv.Key, err) + } + } + + if spec.Freeze { + if err := m.Freeze(); err != nil { + return fmt.Errorf("freezing map: %w", err) + } + } + + return nil +} + +func (m *Map) marshalKey(data interface{}) (internal.Pointer, error) { + if data == nil { + if m.keySize == 0 { + // Queues have a key length of zero, so passing nil here is valid. + return internal.NewPointer(nil), nil + } + return internal.Pointer{}, errors.New("can't use nil as key of map") + } + + return marshalPtr(data, int(m.keySize)) +} + +func (m *Map) unmarshalKey(data interface{}, buf []byte) error { + if buf == nil { + // This is from a makeBuffer call, nothing do do here. + return nil + } + + return unmarshalBytes(data, buf) +} + +func (m *Map) marshalValue(data interface{}) (internal.Pointer, error) { + if m.typ.hasPerCPUValue() { + return marshalPerCPUValue(data, int(m.valueSize)) + } + + var ( + buf []byte + err error + ) + + switch value := data.(type) { + case *Map: + if !m.typ.canStoreMap() { + return internal.Pointer{}, fmt.Errorf("can't store map in %s", m.typ) + } + buf, err = marshalMap(value, int(m.valueSize)) + + case *Program: + if !m.typ.canStoreProgram() { + return internal.Pointer{}, fmt.Errorf("can't store program in %s", m.typ) + } + buf, err = marshalProgram(value, int(m.valueSize)) + + default: + return marshalPtr(data, int(m.valueSize)) + } + + if err != nil { + return internal.Pointer{}, err + } + + return internal.NewSlicePointer(buf), nil +} + +func (m *Map) unmarshalValue(value interface{}, buf []byte) error { + if buf == nil { + // This is from a makeBuffer call, nothing do do here. + return nil + } + + if m.typ.hasPerCPUValue() { + return unmarshalPerCPUValue(value, int(m.valueSize), buf) + } + + switch value := value.(type) { + case **Map: + if !m.typ.canStoreMap() { + return fmt.Errorf("can't read a map from %s", m.typ) + } + + other, err := unmarshalMap(buf) + if err != nil { + return err + } + + // The caller might close the map externally, so ignore errors. + _ = (*value).Close() + + *value = other + return nil + + case *Map: + if !m.typ.canStoreMap() { + return fmt.Errorf("can't read a map from %s", m.typ) + } + return errors.New("require pointer to *Map") + + case **Program: + if !m.typ.canStoreProgram() { + return fmt.Errorf("can't read a program from %s", m.typ) + } + + other, err := unmarshalProgram(buf) + if err != nil { + return err + } + + // The caller might close the program externally, so ignore errors. + _ = (*value).Close() + + *value = other + return nil + + case *Program: + if !m.typ.canStoreProgram() { + return fmt.Errorf("can't read a program from %s", m.typ) + } + return errors.New("require pointer to *Program") + } + + return unmarshalBytes(value, buf) +} + +// LoadPinnedMap loads a Map from a BPF file. +func LoadPinnedMap(fileName string, opts *LoadPinOptions) (*Map, error) { + fd, err := internal.BPFObjGet(fileName, opts.Marshal()) + if err != nil { + return nil, err + } + + m, err := newMapFromFD(fd) + if err == nil { + m.pinnedPath = fileName + } + + return m, err +} + +// unmarshalMap creates a map from a map ID encoded in host endianness. +func unmarshalMap(buf []byte) (*Map, error) { + if len(buf) != 4 { + return nil, errors.New("map id requires 4 byte value") + } + + id := internal.NativeEndian.Uint32(buf) + return NewMapFromID(MapID(id)) +} + +// marshalMap marshals the fd of a map into a buffer in host endianness. +func marshalMap(m *Map, length int) ([]byte, error) { + if length != 4 { + return nil, fmt.Errorf("can't marshal map to %d bytes", length) + } + + fd, err := m.fd.Value() + if err != nil { + return nil, err + } + + buf := make([]byte, 4) + internal.NativeEndian.PutUint32(buf, fd) + return buf, nil +} + +func patchValue(value []byte, typ btf.Type, replacements map[string]interface{}) error { + replaced := make(map[string]bool) + replace := func(name string, offset, size int, replacement interface{}) error { + if offset+size > len(value) { + return fmt.Errorf("%s: offset %d(+%d) is out of bounds", name, offset, size) + } + + buf, err := marshalBytes(replacement, size) + if err != nil { + return fmt.Errorf("marshal %s: %w", name, err) + } + + copy(value[offset:offset+size], buf) + replaced[name] = true + return nil + } + + switch parent := typ.(type) { + case *btf.Datasec: + for _, secinfo := range parent.Vars { + name := string(secinfo.Type.(*btf.Var).Name) + replacement, ok := replacements[name] + if !ok { + continue + } + + err := replace(name, int(secinfo.Offset), int(secinfo.Size), replacement) + if err != nil { + return err + } + } + + default: + return fmt.Errorf("patching %T is not supported", typ) + } + + if len(replaced) == len(replacements) { + return nil + } + + var missing []string + for name := range replacements { + if !replaced[name] { + missing = append(missing, name) + } + } + + if len(missing) == 1 { + return fmt.Errorf("unknown field: %s", missing[0]) + } + + return fmt.Errorf("unknown fields: %s", strings.Join(missing, ",")) +} + +// MapIterator iterates a Map. +// +// See Map.Iterate. +type MapIterator struct { + target *Map + prevKey interface{} + prevBytes []byte + count, maxEntries uint32 + done bool + err error +} + +func newMapIterator(target *Map) *MapIterator { + return &MapIterator{ + target: target, + maxEntries: target.maxEntries, + prevBytes: make([]byte, target.keySize), + } +} + +// Next decodes the next key and value. +// +// Iterating a hash map from which keys are being deleted is not +// safe. You may see the same key multiple times. Iteration may +// also abort with an error, see IsIterationAborted. +// +// Returns false if there are no more entries. You must check +// the result of Err afterwards. +// +// See Map.Get for further caveats around valueOut. +func (mi *MapIterator) Next(keyOut, valueOut interface{}) bool { + if mi.err != nil || mi.done { + return false + } + + // For array-like maps NextKeyBytes returns nil only on after maxEntries + // iterations. + for mi.count <= mi.maxEntries { + var nextBytes []byte + nextBytes, mi.err = mi.target.NextKeyBytes(mi.prevKey) + if mi.err != nil { + return false + } + + if nextBytes == nil { + mi.done = true + return false + } + + // The user can get access to nextBytes since unmarshalBytes + // does not copy when unmarshaling into a []byte. + // Make a copy to prevent accidental corruption of + // iterator state. + copy(mi.prevBytes, nextBytes) + mi.prevKey = mi.prevBytes + + mi.count++ + mi.err = mi.target.Lookup(nextBytes, valueOut) + if errors.Is(mi.err, ErrKeyNotExist) { + // Even though the key should be valid, we couldn't look up + // its value. If we're iterating a hash map this is probably + // because a concurrent delete removed the value before we + // could get it. This means that the next call to NextKeyBytes + // is very likely to restart iteration. + // If we're iterating one of the fd maps like + // ProgramArray it means that a given slot doesn't have + // a valid fd associated. It's OK to continue to the next slot. + continue + } + if mi.err != nil { + return false + } + + mi.err = mi.target.unmarshalKey(keyOut, nextBytes) + return mi.err == nil + } + + mi.err = fmt.Errorf("%w", ErrIterationAborted) + return false +} + +// Err returns any encountered error. +// +// The method must be called after Next returns nil. +// +// Returns ErrIterationAborted if it wasn't possible to do a full iteration. +func (mi *MapIterator) Err() error { + return mi.err +} + +// MapGetNextID returns the ID of the next eBPF map. +// +// Returns ErrNotExist, if there is no next eBPF map. +func MapGetNextID(startID MapID) (MapID, error) { + id, err := objGetNextID(internal.BPF_MAP_GET_NEXT_ID, uint32(startID)) + return MapID(id), err +} + +// NewMapFromID returns the map for a given id. +// +// Returns ErrNotExist, if there is no eBPF map with the given id. +func NewMapFromID(id MapID) (*Map, error) { + fd, err := internal.BPFObjGetFDByID(internal.BPF_MAP_GET_FD_BY_ID, uint32(id)) + if err != nil { + return nil, err + } + + return newMapFromFD(fd) +} + +// ID returns the systemwide unique ID of the map. +// +// Deprecated: use MapInfo.ID() instead. +func (m *Map) ID() (MapID, error) { + info, err := bpfGetMapInfoByFD(m.fd) + if err != nil { + return MapID(0), err + } + return MapID(info.id), nil +} diff --git a/vendor/github.com/cilium/ebpf/marshalers.go b/vendor/github.com/cilium/ebpf/marshalers.go new file mode 100644 index 0000000000..e461d673d7 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/marshalers.go @@ -0,0 +1,253 @@ +package ebpf + +import ( + "bytes" + "encoding" + "encoding/binary" + "errors" + "fmt" + "reflect" + "runtime" + "sync" + "unsafe" + + "github.com/cilium/ebpf/internal" +) + +// marshalPtr converts an arbitrary value into a pointer suitable +// to be passed to the kernel. +// +// As an optimization, it returns the original value if it is an +// unsafe.Pointer. +func marshalPtr(data interface{}, length int) (internal.Pointer, error) { + if ptr, ok := data.(unsafe.Pointer); ok { + return internal.NewPointer(ptr), nil + } + + buf, err := marshalBytes(data, length) + if err != nil { + return internal.Pointer{}, err + } + + return internal.NewSlicePointer(buf), nil +} + +// marshalBytes converts an arbitrary value into a byte buffer. +// +// Prefer using Map.marshalKey and Map.marshalValue if possible, since +// those have special cases that allow more types to be encoded. +// +// Returns an error if the given value isn't representable in exactly +// length bytes. +func marshalBytes(data interface{}, length int) (buf []byte, err error) { + if data == nil { + return nil, errors.New("can't marshal a nil value") + } + + switch value := data.(type) { + case encoding.BinaryMarshaler: + buf, err = value.MarshalBinary() + case string: + buf = []byte(value) + case []byte: + buf = value + case unsafe.Pointer: + err = errors.New("can't marshal from unsafe.Pointer") + case Map, *Map, Program, *Program: + err = fmt.Errorf("can't marshal %T", value) + default: + var wr bytes.Buffer + err = binary.Write(&wr, internal.NativeEndian, value) + if err != nil { + err = fmt.Errorf("encoding %T: %v", value, err) + } + buf = wr.Bytes() + } + if err != nil { + return nil, err + } + + if len(buf) != length { + return nil, fmt.Errorf("%T doesn't marshal to %d bytes", data, length) + } + return buf, nil +} + +func makeBuffer(dst interface{}, length int) (internal.Pointer, []byte) { + if ptr, ok := dst.(unsafe.Pointer); ok { + return internal.NewPointer(ptr), nil + } + + buf := make([]byte, length) + return internal.NewSlicePointer(buf), buf +} + +var bytesReaderPool = sync.Pool{ + New: func() interface{} { + return new(bytes.Reader) + }, +} + +// unmarshalBytes converts a byte buffer into an arbitrary value. +// +// Prefer using Map.unmarshalKey and Map.unmarshalValue if possible, since +// those have special cases that allow more types to be encoded. +// +// The common int32 and int64 types are directly handled to avoid +// unnecessary heap allocations as happening in the default case. +func unmarshalBytes(data interface{}, buf []byte) error { + switch value := data.(type) { + case unsafe.Pointer: + var dst []byte + // Use unsafe.Slice when we drop support for pre1.17 (https://github.com/golang/go/issues/19367) + // We could opt for removing unsafe.Pointer support in the lib as well + sh := (*reflect.SliceHeader)(unsafe.Pointer(&dst)) + sh.Data = uintptr(value) + sh.Len = len(buf) + sh.Cap = len(buf) + + copy(dst, buf) + runtime.KeepAlive(value) + return nil + case Map, *Map, Program, *Program: + return fmt.Errorf("can't unmarshal into %T", value) + case encoding.BinaryUnmarshaler: + return value.UnmarshalBinary(buf) + case *string: + *value = string(buf) + return nil + case *[]byte: + *value = buf + return nil + case *int32: + if len(buf) < 4 { + return errors.New("int32 requires 4 bytes") + } + *value = int32(internal.NativeEndian.Uint32(buf)) + return nil + case *uint32: + if len(buf) < 4 { + return errors.New("uint32 requires 4 bytes") + } + *value = internal.NativeEndian.Uint32(buf) + return nil + case *int64: + if len(buf) < 8 { + return errors.New("int64 requires 8 bytes") + } + *value = int64(internal.NativeEndian.Uint64(buf)) + return nil + case *uint64: + if len(buf) < 8 { + return errors.New("uint64 requires 8 bytes") + } + *value = internal.NativeEndian.Uint64(buf) + return nil + case string: + return errors.New("require pointer to string") + case []byte: + return errors.New("require pointer to []byte") + default: + rd := bytesReaderPool.Get().(*bytes.Reader) + rd.Reset(buf) + defer bytesReaderPool.Put(rd) + if err := binary.Read(rd, internal.NativeEndian, value); err != nil { + return fmt.Errorf("decoding %T: %v", value, err) + } + return nil + } +} + +// marshalPerCPUValue encodes a slice containing one value per +// possible CPU into a buffer of bytes. +// +// Values are initialized to zero if the slice has less elements than CPUs. +// +// slice must have a type like []elementType. +func marshalPerCPUValue(slice interface{}, elemLength int) (internal.Pointer, error) { + sliceType := reflect.TypeOf(slice) + if sliceType.Kind() != reflect.Slice { + return internal.Pointer{}, errors.New("per-CPU value requires slice") + } + + possibleCPUs, err := internal.PossibleCPUs() + if err != nil { + return internal.Pointer{}, err + } + + sliceValue := reflect.ValueOf(slice) + sliceLen := sliceValue.Len() + if sliceLen > possibleCPUs { + return internal.Pointer{}, fmt.Errorf("per-CPU value exceeds number of CPUs") + } + + alignedElemLength := internal.Align(elemLength, 8) + buf := make([]byte, alignedElemLength*possibleCPUs) + + for i := 0; i < sliceLen; i++ { + elem := sliceValue.Index(i).Interface() + elemBytes, err := marshalBytes(elem, elemLength) + if err != nil { + return internal.Pointer{}, err + } + + offset := i * alignedElemLength + copy(buf[offset:offset+elemLength], elemBytes) + } + + return internal.NewSlicePointer(buf), nil +} + +// unmarshalPerCPUValue decodes a buffer into a slice containing one value per +// possible CPU. +// +// valueOut must have a type like *[]elementType +func unmarshalPerCPUValue(slicePtr interface{}, elemLength int, buf []byte) error { + slicePtrType := reflect.TypeOf(slicePtr) + if slicePtrType.Kind() != reflect.Ptr || slicePtrType.Elem().Kind() != reflect.Slice { + return fmt.Errorf("per-cpu value requires pointer to slice") + } + + possibleCPUs, err := internal.PossibleCPUs() + if err != nil { + return err + } + + sliceType := slicePtrType.Elem() + slice := reflect.MakeSlice(sliceType, possibleCPUs, possibleCPUs) + + sliceElemType := sliceType.Elem() + sliceElemIsPointer := sliceElemType.Kind() == reflect.Ptr + if sliceElemIsPointer { + sliceElemType = sliceElemType.Elem() + } + + step := len(buf) / possibleCPUs + if step < elemLength { + return fmt.Errorf("per-cpu element length is larger than available data") + } + for i := 0; i < possibleCPUs; i++ { + var elem interface{} + if sliceElemIsPointer { + newElem := reflect.New(sliceElemType) + slice.Index(i).Set(newElem) + elem = newElem.Interface() + } else { + elem = slice.Index(i).Addr().Interface() + } + + // Make a copy, since unmarshal can hold on to itemBytes + elemBytes := make([]byte, elemLength) + copy(elemBytes, buf[:elemLength]) + + err := unmarshalBytes(elem, elemBytes) + if err != nil { + return fmt.Errorf("cpu %d: %w", i, err) + } + + buf = buf[step:] + } + + reflect.ValueOf(slicePtr).Elem().Set(slice) + return nil +} diff --git a/vendor/github.com/cilium/ebpf/prog.go b/vendor/github.com/cilium/ebpf/prog.go new file mode 100644 index 0000000000..3549a3fe3f --- /dev/null +++ b/vendor/github.com/cilium/ebpf/prog.go @@ -0,0 +1,761 @@ +package ebpf + +import ( + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + "math" + "path/filepath" + "strings" + "time" + + "github.com/cilium/ebpf/asm" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/btf" + "github.com/cilium/ebpf/internal/unix" +) + +// ErrNotSupported is returned whenever the kernel doesn't support a feature. +var ErrNotSupported = internal.ErrNotSupported + +var errUnsatisfiedReference = errors.New("unsatisfied reference") + +// ProgramID represents the unique ID of an eBPF program. +type ProgramID uint32 + +const ( + // Number of bytes to pad the output buffer for BPF_PROG_TEST_RUN. + // This is currently the maximum of spare space allocated for SKB + // and XDP programs, and equal to XDP_PACKET_HEADROOM + NET_IP_ALIGN. + outputPad = 256 + 2 +) + +// DefaultVerifierLogSize is the default number of bytes allocated for the +// verifier log. +const DefaultVerifierLogSize = 64 * 1024 + +// ProgramOptions control loading a program into the kernel. +type ProgramOptions struct { + // Controls the detail emitted by the kernel verifier. Set to non-zero + // to enable logging. + LogLevel uint32 + // Controls the output buffer size for the verifier. Defaults to + // DefaultVerifierLogSize. + LogSize int + // An ELF containing the target BTF for this program. It is used both to + // find the correct function to trace and to apply CO-RE relocations. + // This is useful in environments where the kernel BTF is not available + // (containers) or where it is in a non-standard location. Defaults to + // use the kernel BTF from a well-known location. + TargetBTF io.ReaderAt +} + +// ProgramSpec defines a Program. +type ProgramSpec struct { + // Name is passed to the kernel as a debug aid. Must only contain + // alpha numeric and '_' characters. + Name string + + // Type determines at which hook in the kernel a program will run. + Type ProgramType + AttachType AttachType + // Name of a kernel data structure or function to attach to. Its + // interpretation depends on Type and AttachType. + AttachTo string + // The program to attach to. Must be provided manually. + AttachTarget *Program + Instructions asm.Instructions + + // Flags is passed to the kernel and specifies additional program + // load attributes. + Flags uint32 + + // License of the program. Some helpers are only available if + // the license is deemed compatible with the GPL. + // + // See https://www.kernel.org/doc/html/latest/process/license-rules.html#id1 + License string + + // Version used by Kprobe programs. + // + // Deprecated on kernels 5.0 and later. Leave empty to let the library + // detect this value automatically. + KernelVersion uint32 + + // The BTF associated with this program. Changing Instructions + // will most likely invalidate the contained data, and may + // result in errors when attempting to load it into the kernel. + BTF *btf.Program + + // The byte order this program was compiled for, may be nil. + ByteOrder binary.ByteOrder +} + +// Copy returns a copy of the spec. +func (ps *ProgramSpec) Copy() *ProgramSpec { + if ps == nil { + return nil + } + + cpy := *ps + cpy.Instructions = make(asm.Instructions, len(ps.Instructions)) + copy(cpy.Instructions, ps.Instructions) + return &cpy +} + +// Tag calculates the kernel tag for a series of instructions. +// +// Use asm.Instructions.Tag if you need to calculate for non-native endianness. +func (ps *ProgramSpec) Tag() (string, error) { + return ps.Instructions.Tag(internal.NativeEndian) +} + +// Program represents BPF program loaded into the kernel. +// +// It is not safe to close a Program which is used by other goroutines. +type Program struct { + // Contains the output of the kernel verifier if enabled, + // otherwise it is empty. + VerifierLog string + + fd *internal.FD + name string + pinnedPath string + typ ProgramType +} + +// NewProgram creates a new Program. +// +// Loading a program for the first time will perform +// feature detection by loading small, temporary programs. +func NewProgram(spec *ProgramSpec) (*Program, error) { + return NewProgramWithOptions(spec, ProgramOptions{}) +} + +// NewProgramWithOptions creates a new Program. +// +// Loading a program for the first time will perform +// feature detection by loading small, temporary programs. +func NewProgramWithOptions(spec *ProgramSpec, opts ProgramOptions) (*Program, error) { + handles := newHandleCache() + defer handles.close() + + prog, err := newProgramWithOptions(spec, opts, handles) + if errors.Is(err, errUnsatisfiedReference) { + return nil, fmt.Errorf("cannot load program without loading its whole collection: %w", err) + } + return prog, err +} + +func newProgramWithOptions(spec *ProgramSpec, opts ProgramOptions, handles *handleCache) (*Program, error) { + if len(spec.Instructions) == 0 { + return nil, errors.New("instructions cannot be empty") + } + + if spec.ByteOrder != nil && spec.ByteOrder != internal.NativeEndian { + return nil, fmt.Errorf("can't load %s program on %s", spec.ByteOrder, internal.NativeEndian) + } + + // Kernels before 5.0 (6c4fc209fcf9 "bpf: remove useless version check for prog load") + // require the version field to be set to the value of the KERNEL_VERSION + // macro for kprobe-type programs. + // Overwrite Kprobe program version if set to zero or the magic version constant. + kv := spec.KernelVersion + if spec.Type == Kprobe && (kv == 0 || kv == internal.MagicKernelVersion) { + v, err := internal.KernelVersion() + if err != nil { + return nil, fmt.Errorf("detecting kernel version: %w", err) + } + kv = v.Kernel() + } + + attr := &internal.BPFProgLoadAttr{ + ProgType: uint32(spec.Type), + ProgFlags: spec.Flags, + ExpectedAttachType: uint32(spec.AttachType), + License: internal.NewStringPointer(spec.License), + KernelVersion: kv, + } + + if haveObjName() == nil { + attr.ProgName = internal.NewBPFObjName(spec.Name) + } + + var err error + var targetBTF *btf.Spec + if opts.TargetBTF != nil { + targetBTF, err = handles.btfSpec(opts.TargetBTF) + if err != nil { + return nil, fmt.Errorf("load target BTF: %w", err) + } + } + + var btfDisabled bool + var core btf.COREFixups + if spec.BTF != nil { + core, err = spec.BTF.Fixups(targetBTF) + if err != nil { + return nil, fmt.Errorf("CO-RE relocations: %w", err) + } + + handle, err := handles.btfHandle(spec.BTF.Spec()) + btfDisabled = errors.Is(err, btf.ErrNotSupported) + if err != nil && !btfDisabled { + return nil, fmt.Errorf("load BTF: %w", err) + } + + if handle != nil { + attr.ProgBTFFd = uint32(handle.FD()) + + recSize, bytes, err := spec.BTF.LineInfos() + if err != nil { + return nil, fmt.Errorf("get BTF line infos: %w", err) + } + attr.LineInfoRecSize = recSize + attr.LineInfoCnt = uint32(uint64(len(bytes)) / uint64(recSize)) + attr.LineInfo = internal.NewSlicePointer(bytes) + + recSize, bytes, err = spec.BTF.FuncInfos() + if err != nil { + return nil, fmt.Errorf("get BTF function infos: %w", err) + } + attr.FuncInfoRecSize = recSize + attr.FuncInfoCnt = uint32(uint64(len(bytes)) / uint64(recSize)) + attr.FuncInfo = internal.NewSlicePointer(bytes) + } + } + + insns, err := core.Apply(spec.Instructions) + if err != nil { + return nil, fmt.Errorf("CO-RE fixup: %w", err) + } + + if err := fixupJumpsAndCalls(insns); err != nil { + return nil, err + } + + buf := bytes.NewBuffer(make([]byte, 0, len(spec.Instructions)*asm.InstructionSize)) + err = insns.Marshal(buf, internal.NativeEndian) + if err != nil { + return nil, err + } + + bytecode := buf.Bytes() + attr.Instructions = internal.NewSlicePointer(bytecode) + attr.InsCount = uint32(len(bytecode) / asm.InstructionSize) + + if spec.AttachTo != "" { + if spec.AttachTarget != nil { + info, err := spec.AttachTarget.Info() + if err != nil { + return nil, fmt.Errorf("load target BTF: %w", err) + } + + btfID, ok := info.BTFID() + if !ok { + return nil, fmt.Errorf("load target BTF: no BTF info available") + } + btfHandle, err := btf.NewHandleFromID(btfID) + if err != nil { + return nil, fmt.Errorf("load target BTF: %w", err) + } + defer btfHandle.Close() + + targetBTF = btfHandle.Spec() + if err != nil { + return nil, fmt.Errorf("load target BTF: %w", err) + } + } + + target, err := resolveBTFType(targetBTF, spec.AttachTo, spec.Type, spec.AttachType) + if err != nil { + return nil, err + } + if target != nil { + attr.AttachBTFID = uint32(target.ID()) + } + if spec.AttachTarget != nil { + attr.AttachProgFd = uint32(spec.AttachTarget.FD()) + } + } + + logSize := DefaultVerifierLogSize + if opts.LogSize > 0 { + logSize = opts.LogSize + } + + var logBuf []byte + if opts.LogLevel > 0 { + logBuf = make([]byte, logSize) + attr.LogLevel = opts.LogLevel + attr.LogSize = uint32(len(logBuf)) + attr.LogBuf = internal.NewSlicePointer(logBuf) + } + + fd, err := internal.BPFProgLoad(attr) + if err == nil { + return &Program{internal.CString(logBuf), fd, spec.Name, "", spec.Type}, nil + } + + logErr := err + if opts.LogLevel == 0 && opts.LogSize >= 0 { + // Re-run with the verifier enabled to get better error messages. + logBuf = make([]byte, logSize) + attr.LogLevel = 1 + attr.LogSize = uint32(len(logBuf)) + attr.LogBuf = internal.NewSlicePointer(logBuf) + + fd, logErr = internal.BPFProgLoad(attr) + if logErr == nil { + fd.Close() + } + } + + if errors.Is(logErr, unix.EPERM) && logBuf[0] == 0 { + // EPERM due to RLIMIT_MEMLOCK happens before the verifier, so we can + // check that the log is empty to reduce false positives. + return nil, fmt.Errorf("load program: %w (MEMLOCK bay be too low, consider rlimit.RemoveMemlock)", logErr) + } + + err = internal.ErrorWithLog(err, logBuf, logErr) + if btfDisabled { + return nil, fmt.Errorf("load program without BTF: %w", err) + } + return nil, fmt.Errorf("load program: %w", err) +} + +// NewProgramFromFD creates a program from a raw fd. +// +// You should not use fd after calling this function. +// +// Requires at least Linux 4.10. +func NewProgramFromFD(fd int) (*Program, error) { + if fd < 0 { + return nil, errors.New("invalid fd") + } + + return newProgramFromFD(internal.NewFD(uint32(fd))) +} + +// NewProgramFromID returns the program for a given id. +// +// Returns ErrNotExist, if there is no eBPF program with the given id. +func NewProgramFromID(id ProgramID) (*Program, error) { + fd, err := internal.BPFObjGetFDByID(internal.BPF_PROG_GET_FD_BY_ID, uint32(id)) + if err != nil { + return nil, fmt.Errorf("get program by id: %w", err) + } + + return newProgramFromFD(fd) +} + +func newProgramFromFD(fd *internal.FD) (*Program, error) { + info, err := newProgramInfoFromFd(fd) + if err != nil { + fd.Close() + return nil, fmt.Errorf("discover program type: %w", err) + } + + return &Program{"", fd, "", "", info.Type}, nil +} + +func (p *Program) String() string { + if p.name != "" { + return fmt.Sprintf("%s(%s)#%v", p.typ, p.name, p.fd) + } + return fmt.Sprintf("%s(%v)", p.typ, p.fd) +} + +// Type returns the underlying type of the program. +func (p *Program) Type() ProgramType { + return p.typ +} + +// Info returns metadata about the program. +// +// Requires at least 4.10. +func (p *Program) Info() (*ProgramInfo, error) { + return newProgramInfoFromFd(p.fd) +} + +// FD gets the file descriptor of the Program. +// +// It is invalid to call this function after Close has been called. +func (p *Program) FD() int { + fd, err := p.fd.Value() + if err != nil { + // Best effort: -1 is the number most likely to be an + // invalid file descriptor. + return -1 + } + + return int(fd) +} + +// Clone creates a duplicate of the Program. +// +// Closing the duplicate does not affect the original, and vice versa. +// +// Cloning a nil Program returns nil. +func (p *Program) Clone() (*Program, error) { + if p == nil { + return nil, nil + } + + dup, err := p.fd.Dup() + if err != nil { + return nil, fmt.Errorf("can't clone program: %w", err) + } + + return &Program{p.VerifierLog, dup, p.name, "", p.typ}, nil +} + +// Pin persists the Program on the BPF virtual file system past the lifetime of +// the process that created it +// +// Calling Pin on a previously pinned program will overwrite the path, except when +// the new path already exists. Re-pinning across filesystems is not supported. +// +// This requires bpffs to be mounted above fileName. See https://docs.cilium.io/en/k8s-doc/admin/#admin-mount-bpffs +func (p *Program) Pin(fileName string) error { + if err := internal.Pin(p.pinnedPath, fileName, p.fd); err != nil { + return err + } + p.pinnedPath = fileName + return nil +} + +// Unpin removes the persisted state for the Program from the BPF virtual filesystem. +// +// Failed calls to Unpin will not alter the state returned by IsPinned. +// +// Unpinning an unpinned Program returns nil. +func (p *Program) Unpin() error { + if err := internal.Unpin(p.pinnedPath); err != nil { + return err + } + p.pinnedPath = "" + return nil +} + +// IsPinned returns true if the Program has a non-empty pinned path. +func (p *Program) IsPinned() bool { + return p.pinnedPath != "" +} + +// Close unloads the program from the kernel. +func (p *Program) Close() error { + if p == nil { + return nil + } + + return p.fd.Close() +} + +// Test runs the Program in the kernel with the given input and returns the +// value returned by the eBPF program. outLen may be zero. +// +// Note: the kernel expects at least 14 bytes input for an ethernet header for +// XDP and SKB programs. +// +// This function requires at least Linux 4.12. +func (p *Program) Test(in []byte) (uint32, []byte, error) { + ret, out, _, err := p.testRun(in, 1, nil) + if err != nil { + return ret, nil, fmt.Errorf("can't test program: %w", err) + } + return ret, out, nil +} + +// Benchmark runs the Program with the given input for a number of times +// and returns the time taken per iteration. +// +// Returns the result of the last execution of the program and the time per +// run or an error. reset is called whenever the benchmark syscall is +// interrupted, and should be set to testing.B.ResetTimer or similar. +// +// Note: profiling a call to this function will skew it's results, see +// https://github.com/cilium/ebpf/issues/24 +// +// This function requires at least Linux 4.12. +func (p *Program) Benchmark(in []byte, repeat int, reset func()) (uint32, time.Duration, error) { + ret, _, total, err := p.testRun(in, repeat, reset) + if err != nil { + return ret, total, fmt.Errorf("can't benchmark program: %w", err) + } + return ret, total, nil +} + +var haveProgTestRun = internal.FeatureTest("BPF_PROG_TEST_RUN", "4.12", func() error { + prog, err := NewProgram(&ProgramSpec{ + Type: SocketFilter, + Instructions: asm.Instructions{ + asm.LoadImm(asm.R0, 0, asm.DWord), + asm.Return(), + }, + License: "MIT", + }) + if err != nil { + // This may be because we lack sufficient permissions, etc. + return err + } + defer prog.Close() + + // Programs require at least 14 bytes input + in := make([]byte, 14) + attr := bpfProgTestRunAttr{ + fd: uint32(prog.FD()), + dataSizeIn: uint32(len(in)), + dataIn: internal.NewSlicePointer(in), + } + + err = bpfProgTestRun(&attr) + if errors.Is(err, unix.EINVAL) { + // Check for EINVAL specifically, rather than err != nil since we + // otherwise misdetect due to insufficient permissions. + return internal.ErrNotSupported + } + if errors.Is(err, unix.EINTR) { + // We know that PROG_TEST_RUN is supported if we get EINTR. + return nil + } + return err +}) + +func (p *Program) testRun(in []byte, repeat int, reset func()) (uint32, []byte, time.Duration, error) { + if uint(repeat) > math.MaxUint32 { + return 0, nil, 0, fmt.Errorf("repeat is too high") + } + + if len(in) == 0 { + return 0, nil, 0, fmt.Errorf("missing input") + } + + if uint(len(in)) > math.MaxUint32 { + return 0, nil, 0, fmt.Errorf("input is too long") + } + + if err := haveProgTestRun(); err != nil { + return 0, nil, 0, err + } + + // Older kernels ignore the dataSizeOut argument when copying to user space. + // Combined with things like bpf_xdp_adjust_head() we don't really know what the final + // size will be. Hence we allocate an output buffer which we hope will always be large + // enough, and panic if the kernel wrote past the end of the allocation. + // See https://patchwork.ozlabs.org/cover/1006822/ + out := make([]byte, len(in)+outputPad) + + fd, err := p.fd.Value() + if err != nil { + return 0, nil, 0, err + } + + attr := bpfProgTestRunAttr{ + fd: fd, + dataSizeIn: uint32(len(in)), + dataSizeOut: uint32(len(out)), + dataIn: internal.NewSlicePointer(in), + dataOut: internal.NewSlicePointer(out), + repeat: uint32(repeat), + } + + for { + err = bpfProgTestRun(&attr) + if err == nil { + break + } + + if errors.Is(err, unix.EINTR) { + if reset != nil { + reset() + } + continue + } + + return 0, nil, 0, fmt.Errorf("can't run test: %w", err) + } + + if int(attr.dataSizeOut) > cap(out) { + // Houston, we have a problem. The program created more data than we allocated, + // and the kernel wrote past the end of our buffer. + panic("kernel wrote past end of output buffer") + } + out = out[:int(attr.dataSizeOut)] + + total := time.Duration(attr.duration) * time.Nanosecond + return attr.retval, out, total, nil +} + +func unmarshalProgram(buf []byte) (*Program, error) { + if len(buf) != 4 { + return nil, errors.New("program id requires 4 byte value") + } + + // Looking up an entry in a nested map or prog array returns an id, + // not an fd. + id := internal.NativeEndian.Uint32(buf) + return NewProgramFromID(ProgramID(id)) +} + +func marshalProgram(p *Program, length int) ([]byte, error) { + if length != 4 { + return nil, fmt.Errorf("can't marshal program to %d bytes", length) + } + + value, err := p.fd.Value() + if err != nil { + return nil, err + } + + buf := make([]byte, 4) + internal.NativeEndian.PutUint32(buf, value) + return buf, nil +} + +// Attach a Program. +// +// Deprecated: use link.RawAttachProgram instead. +func (p *Program) Attach(fd int, typ AttachType, flags AttachFlags) error { + if fd < 0 { + return errors.New("invalid fd") + } + + pfd, err := p.fd.Value() + if err != nil { + return err + } + + attr := internal.BPFProgAttachAttr{ + TargetFd: uint32(fd), + AttachBpfFd: pfd, + AttachType: uint32(typ), + AttachFlags: uint32(flags), + } + + return internal.BPFProgAttach(&attr) +} + +// Detach a Program. +// +// Deprecated: use link.RawDetachProgram instead. +func (p *Program) Detach(fd int, typ AttachType, flags AttachFlags) error { + if fd < 0 { + return errors.New("invalid fd") + } + + if flags != 0 { + return errors.New("flags must be zero") + } + + pfd, err := p.fd.Value() + if err != nil { + return err + } + + attr := internal.BPFProgDetachAttr{ + TargetFd: uint32(fd), + AttachBpfFd: pfd, + AttachType: uint32(typ), + } + + return internal.BPFProgDetach(&attr) +} + +// LoadPinnedProgram loads a Program from a BPF file. +// +// Requires at least Linux 4.11. +func LoadPinnedProgram(fileName string, opts *LoadPinOptions) (*Program, error) { + fd, err := internal.BPFObjGet(fileName, opts.Marshal()) + if err != nil { + return nil, err + } + + info, err := newProgramInfoFromFd(fd) + if err != nil { + _ = fd.Close() + return nil, fmt.Errorf("info for %s: %w", fileName, err) + } + + return &Program{"", fd, filepath.Base(fileName), fileName, info.Type}, nil +} + +// SanitizeName replaces all invalid characters in name with replacement. +// Passing a negative value for replacement will delete characters instead +// of replacing them. Use this to automatically generate valid names for maps +// and programs at runtime. +// +// The set of allowed characters depends on the running kernel version. +// Dots are only allowed as of kernel 5.2. +func SanitizeName(name string, replacement rune) string { + return strings.Map(func(char rune) rune { + if invalidBPFObjNameChar(char) { + return replacement + } + return char + }, name) +} + +// ProgramGetNextID returns the ID of the next eBPF program. +// +// Returns ErrNotExist, if there is no next eBPF program. +func ProgramGetNextID(startID ProgramID) (ProgramID, error) { + id, err := objGetNextID(internal.BPF_PROG_GET_NEXT_ID, uint32(startID)) + return ProgramID(id), err +} + +// ID returns the systemwide unique ID of the program. +// +// Deprecated: use ProgramInfo.ID() instead. +func (p *Program) ID() (ProgramID, error) { + info, err := bpfGetProgInfoByFD(p.fd, nil) + if err != nil { + return ProgramID(0), err + } + return ProgramID(info.id), nil +} + +func resolveBTFType(spec *btf.Spec, name string, progType ProgramType, attachType AttachType) (btf.Type, error) { + type match struct { + p ProgramType + a AttachType + } + + var typeName, featureName string + switch (match{progType, attachType}) { + case match{LSM, AttachLSMMac}: + typeName = "bpf_lsm_" + name + featureName = name + " LSM hook" + case match{Tracing, AttachTraceIter}: + typeName = "bpf_iter_" + name + featureName = name + " iterator" + case match{Extension, AttachNone}: + typeName = name + featureName = fmt.Sprintf("freplace %s", name) + default: + return nil, nil + } + + if spec == nil { + var err error + spec, err = btf.LoadKernelSpec() + if err != nil { + return nil, fmt.Errorf("load kernel spec: %w", err) + } + } + + var target *btf.Func + err := spec.FindType(typeName, &target) + if errors.Is(err, btf.ErrNotFound) { + return nil, &internal.UnsupportedFeatureError{ + Name: featureName, + } + } + if err != nil { + return nil, fmt.Errorf("resolve BTF for %s: %w", featureName, err) + } + + return target, nil +} diff --git a/vendor/github.com/cilium/ebpf/ringbuf/doc.go b/vendor/github.com/cilium/ebpf/ringbuf/doc.go new file mode 100644 index 0000000000..9e45012187 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/ringbuf/doc.go @@ -0,0 +1,6 @@ +// Package ringbuf allows interacting with Linux BPF ring buffer. +// +// BPF allows submitting custom events to a BPF ring buffer map set up +// by userspace. This is very useful to push things like packet samples +// from BPF to a daemon running in user space. +package ringbuf diff --git a/vendor/github.com/cilium/ebpf/ringbuf/reader.go b/vendor/github.com/cilium/ebpf/ringbuf/reader.go new file mode 100644 index 0000000000..6efec763c3 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/ringbuf/reader.go @@ -0,0 +1,258 @@ +package ringbuf + +import ( + "encoding/binary" + "errors" + "fmt" + "io" + "runtime" + "sync" + + "github.com/cilium/ebpf" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/unix" +) + +var ( + ErrClosed = errors.New("ringbuf reader was closed") + errDiscard = errors.New("sample discarded") + errBusy = errors.New("sample not committed yet") +) + +func addToEpoll(epollfd, fd int) error { + + event := unix.EpollEvent{ + Events: unix.EPOLLIN, + Fd: int32(fd), + } + + if err := unix.EpollCtl(epollfd, unix.EPOLL_CTL_ADD, fd, &event); err != nil { + return fmt.Errorf("can't add fd to epoll: %w", err) + } + return nil +} + +// ringbufHeader from 'struct bpf_ringbuf_hdr' in kernel/bpf/ringbuf.c +type ringbufHeader struct { + Len uint32 + PgOff uint32 +} + +func (rh *ringbufHeader) isBusy() bool { + return rh.Len&unix.BPF_RINGBUF_BUSY_BIT != 0 +} + +func (rh *ringbufHeader) isDiscard() bool { + return rh.Len&unix.BPF_RINGBUF_DISCARD_BIT != 0 +} + +func (rh *ringbufHeader) dataLen() int { + return int(rh.Len & ^uint32(unix.BPF_RINGBUF_BUSY_BIT|unix.BPF_RINGBUF_DISCARD_BIT)) +} + +type Record struct { + RawSample []byte +} + +func readRecord(rd *ringbufEventRing) (r Record, err error) { + rd.loadConsumer() + var header ringbufHeader + err = binary.Read(rd, internal.NativeEndian, &header) + if err == io.EOF { + return Record{}, err + } + + if err != nil { + return Record{}, fmt.Errorf("can't read event header: %w", err) + } + + if header.isBusy() { + // the next sample in the ring is not committed yet so we + // exit without storing the reader/consumer position + // and start again from the same position. + return Record{}, fmt.Errorf("%w", errBusy) + } + + /* read up to 8 byte alignment */ + dataLenAligned := uint64(internal.Align(header.dataLen(), 8)) + + if header.isDiscard() { + // when the record header indicates that the data should be + // discarded, we skip it by just updating the consumer position + // to the next record instead of normal Read() to avoid allocating data + // and reading/copying from the ring (which normally keeps track of the + // consumer position). + rd.skipRead(dataLenAligned) + rd.storeConsumer() + + return Record{}, fmt.Errorf("%w", errDiscard) + } + + data := make([]byte, dataLenAligned) + + if _, err := io.ReadFull(rd, data); err != nil { + return Record{}, fmt.Errorf("can't read sample: %w", err) + } + + rd.storeConsumer() + + return Record{RawSample: data[:header.dataLen()]}, nil +} + +// Reader allows reading bpf_ringbuf_output +// from user space. +type Reader struct { + // mu protects read/write access to the Reader structure + mu sync.Mutex + + ring *ringbufEventRing + + epollFd int + epollEvents []unix.EpollEvent + + closeFd int + // Ensure we only close once + closeOnce sync.Once +} + +// NewReader creates a new BPF ringbuf reader. +func NewReader(ringbufMap *ebpf.Map) (r *Reader, err error) { + if ringbufMap.Type() != ebpf.RingBuf { + return nil, fmt.Errorf("invalid Map type: %s", ringbufMap.Type()) + } + + maxEntries := int(ringbufMap.MaxEntries()) + if maxEntries == 0 || (maxEntries&(maxEntries-1)) != 0 { + return nil, fmt.Errorf("Ringbuffer map size %d is zero or not a power of two", maxEntries) + } + + epollFd, err := unix.EpollCreate1(unix.EPOLL_CLOEXEC) + if err != nil { + return nil, fmt.Errorf("can't create epoll fd: %w", err) + } + + var ( + fds = []int{epollFd} + ring *ringbufEventRing + ) + + defer func() { + if err != nil { + // close epollFd and closeFd + for _, fd := range fds { + unix.Close(fd) + } + if ring != nil { + ring.Close() + } + } + }() + + ring, err = newRingBufEventRing(ringbufMap.FD(), maxEntries) + if err != nil { + return nil, fmt.Errorf("failed to create ringbuf ring: %w", err) + } + + if err := addToEpoll(epollFd, ringbufMap.FD()); err != nil { + return nil, err + } + + closeFd, err := unix.Eventfd(0, unix.O_CLOEXEC|unix.O_NONBLOCK) + if err != nil { + return nil, err + } + fds = append(fds, closeFd) + + if err := addToEpoll(epollFd, closeFd); err != nil { + return nil, err + } + + r = &Reader{ + ring: ring, + epollFd: epollFd, + // Allocate extra event for closeFd + epollEvents: make([]unix.EpollEvent, 2), + closeFd: closeFd, + } + runtime.SetFinalizer(r, (*Reader).Close) + return r, nil +} + +// Close frees resources used by the reader. +// +// It interrupts calls to Read. +func (r *Reader) Close() error { + var err error + r.closeOnce.Do(func() { + runtime.SetFinalizer(r, nil) + + // Interrupt Read() via the closeFd event fd. + var value [8]byte + internal.NativeEndian.PutUint64(value[:], 1) + + if _, err = unix.Write(r.closeFd, value[:]); err != nil { + err = fmt.Errorf("can't write event fd: %w", err) + return + } + + // Acquire the lock. This ensures that Read isn't running. + r.mu.Lock() + defer r.mu.Unlock() + + unix.Close(r.epollFd) + unix.Close(r.closeFd) + r.epollFd, r.closeFd = -1, -1 + + if r.ring != nil { + r.ring.Close() + } + r.ring = nil + + }) + if err != nil { + return fmt.Errorf("close Reader: %w", err) + } + return nil +} + +// Read the next record from the BPF ringbuf. +// +// Calling Close interrupts the function. +func (r *Reader) Read() (Record, error) { + r.mu.Lock() + defer r.mu.Unlock() + + if r.epollFd == -1 { + return Record{}, fmt.Errorf("%w", ErrClosed) + } + + for { + nEvents, err := unix.EpollWait(r.epollFd, r.epollEvents, -1) + if temp, ok := err.(temporaryError); ok && temp.Temporary() { + // Retry the syscall if we we're interrupted, see https://github.com/golang/go/issues/20400 + continue + } + + if err != nil { + return Record{}, err + } + + for _, event := range r.epollEvents[:nEvents] { + if int(event.Fd) == r.closeFd { + return Record{}, fmt.Errorf("%w", ErrClosed) + } + } + + record, err := readRecord(r.ring) + + if errors.Is(err, errBusy) || errors.Is(err, errDiscard) { + continue + } + + return record, err + } +} + +type temporaryError interface { + Temporary() bool +} diff --git a/vendor/github.com/cilium/ebpf/ringbuf/ring.go b/vendor/github.com/cilium/ebpf/ringbuf/ring.go new file mode 100644 index 0000000000..b3eeb66997 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/ringbuf/ring.go @@ -0,0 +1,109 @@ +package ringbuf + +import ( + "fmt" + "io" + "os" + "runtime" + "sync/atomic" + "unsafe" + + "github.com/cilium/ebpf/internal/unix" +) + +type ringbufEventRing struct { + prod []byte + cons []byte + *ringReader +} + +func newRingBufEventRing(mapFD, size int) (*ringbufEventRing, error) { + cons, err := unix.Mmap(mapFD, 0, os.Getpagesize(), unix.PROT_READ|unix.PROT_WRITE, unix.MAP_SHARED) + if err != nil { + return nil, fmt.Errorf("can't mmap consumer page: %w", err) + } + + prod, err := unix.Mmap(mapFD, (int64)(os.Getpagesize()), os.Getpagesize()+2*size, unix.PROT_READ, unix.MAP_SHARED) + if err != nil { + _ = unix.Munmap(cons) + return nil, fmt.Errorf("can't mmap data pages: %w", err) + } + + cons_pos := (*uint64)(unsafe.Pointer(&cons[0])) + prod_pos := (*uint64)(unsafe.Pointer(&prod[0])) + + ring := &ringbufEventRing{ + prod: prod, + cons: cons, + ringReader: newRingReader(cons_pos, prod_pos, prod[os.Getpagesize():]), + } + runtime.SetFinalizer(ring, (*ringbufEventRing).Close) + + return ring, nil +} + +func (ring *ringbufEventRing) Close() { + runtime.SetFinalizer(ring, nil) + + _ = unix.Munmap(ring.prod) + _ = unix.Munmap(ring.cons) + + ring.prod = nil + ring.cons = nil +} + +type ringReader struct { + // These point into mmap'ed memory and must be accessed atomically. + prod_pos, cons_pos *uint64 + cons uint64 + mask uint64 + ring []byte +} + +func newRingReader(cons_ptr, prod_ptr *uint64, ring []byte) *ringReader { + return &ringReader{ + prod_pos: prod_ptr, + cons_pos: cons_ptr, + cons: atomic.LoadUint64(cons_ptr), + // cap is always a power of two + mask: uint64(cap(ring)/2 - 1), + ring: ring, + } +} + +func (rr *ringReader) loadConsumer() { + rr.cons = atomic.LoadUint64(rr.cons_pos) +} + +func (rr *ringReader) storeConsumer() { + atomic.StoreUint64(rr.cons_pos, rr.cons) +} + +// clamp delta to 'end' if 'start+delta' is beyond 'end' +func clamp(start, end, delta uint64) uint64 { + if remainder := end - start; delta > remainder { + return remainder + } + return delta +} + +func (rr *ringReader) skipRead(skipBytes uint64) { + rr.cons += clamp(rr.cons, atomic.LoadUint64(rr.prod_pos), skipBytes) +} + +func (rr *ringReader) Read(p []byte) (int, error) { + prod := atomic.LoadUint64(rr.prod_pos) + + n := clamp(rr.cons, prod, uint64(len(p))) + + start := rr.cons & rr.mask + + copy(p, rr.ring[start:start+n]) + rr.cons += n + + if prod == rr.cons { + return int(n), io.EOF + } + + return int(n), nil +} diff --git a/vendor/github.com/cilium/ebpf/run-tests.sh b/vendor/github.com/cilium/ebpf/run-tests.sh new file mode 100644 index 0000000000..a079edc7e1 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/run-tests.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# Test the current package under a different kernel. +# Requires virtme and qemu to be installed. +# Examples: +# Run all tests on a 5.4 kernel +# $ ./run-tests.sh 5.4 +# Run a subset of tests: +# $ ./run-tests.sh 5.4 ./link + +set -euo pipefail + +script="$(realpath "$0")" +readonly script + +# This script is a bit like a Matryoshka doll since it keeps re-executing itself +# in various different contexts: +# +# 1. invoked by the user like run-tests.sh 5.4 +# 2. invoked by go test like run-tests.sh --exec-vm +# 3. invoked by init in the vm like run-tests.sh --exec-test +# +# This allows us to use all available CPU on the host machine to compile our +# code, and then only use the VM to execute the test. This is because the VM +# is usually slower at compiling than the host. +if [[ "${1:-}" = "--exec-vm" ]]; then + shift + + input="$1" + shift + + # Use sudo if /dev/kvm isn't accessible by the current user. + sudo="" + if [[ ! -r /dev/kvm || ! -w /dev/kvm ]]; then + sudo="sudo" + fi + readonly sudo + + testdir="$(dirname "$1")" + output="$(mktemp -d)" + printf -v cmd "%q " "$@" + + if [[ "$(stat -c '%t:%T' -L /proc/$$/fd/0)" == "1:3" ]]; then + # stdin is /dev/null, which doesn't play well with qemu. Use a fifo as a + # blocking substitute. + mkfifo "${output}/fake-stdin" + # Open for reading and writing to avoid blocking. + exec 0<> "${output}/fake-stdin" + rm "${output}/fake-stdin" + fi + + if ! $sudo virtme-run --kimg "${input}/bzImage" --memory 768M --pwd \ + --rwdir="${testdir}=${testdir}" \ + --rodir=/run/input="${input}" \ + --rwdir=/run/output="${output}" \ + --script-sh "PATH=\"$PATH\" \"$script\" --exec-test $cmd" \ + --kopt possible_cpus=2; then # need at least two CPUs for some tests + exit 23 + fi + + if [[ ! -e "${output}/success" ]]; then + exit 42 + fi + + $sudo rm -r "$output" + exit 0 +elif [[ "${1:-}" = "--exec-test" ]]; then + shift + + mount -t bpf bpf /sys/fs/bpf + mount -t tracefs tracefs /sys/kernel/debug/tracing + + if [[ -d "/run/input/bpf" ]]; then + export KERNEL_SELFTESTS="/run/input/bpf" + fi + + dmesg -C + if ! "$@"; then + dmesg + exit 1 # this return code is "swallowed" by qemu + fi + touch "/run/output/success" + exit 0 +fi + +readonly kernel_version="${1:-}" +if [[ -z "${kernel_version}" ]]; then + echo "Expecting kernel version as first argument" + exit 1 +fi +shift + +readonly kernel="linux-${kernel_version}.bz" +readonly selftests="linux-${kernel_version}-selftests-bpf.bz" +readonly input="$(mktemp -d)" +readonly tmp_dir="${TMPDIR:-/tmp}" +readonly branch="${BRANCH:-master}" + +fetch() { + echo Fetching "${1}" + wget -nv -N -P "${tmp_dir}" "https://github.com/cilium/ci-kernels/raw/${branch}/${1}" +} + +fetch "${kernel}" +cp "${tmp_dir}/${kernel}" "${input}/bzImage" + +if fetch "${selftests}"; then + mkdir "${input}/bpf" + tar --strip-components=4 -xjf "${tmp_dir}/${selftests}" -C "${input}/bpf" +else + echo "No selftests found, disabling" +fi + +args=(-short -coverpkg=./... -coverprofile=coverage.out -count 1 ./...) +if (( $# > 0 )); then + args=("$@") +fi + +export GOFLAGS=-mod=readonly +export CGO_ENABLED=0 + +echo Testing on "${kernel_version}" +go test -exec "$script --exec-vm $input" "${args[@]}" +echo "Test successful on ${kernel_version}" + +rm -r "${input}" diff --git a/vendor/github.com/cilium/ebpf/syscalls.go b/vendor/github.com/cilium/ebpf/syscalls.go new file mode 100644 index 0000000000..f8cb5f0e0c --- /dev/null +++ b/vendor/github.com/cilium/ebpf/syscalls.go @@ -0,0 +1,464 @@ +package ebpf + +import ( + "bytes" + "errors" + "fmt" + "os" + "unsafe" + + "github.com/cilium/ebpf/asm" + "github.com/cilium/ebpf/internal" + "github.com/cilium/ebpf/internal/unix" +) + +// ErrNotExist is returned when loading a non-existing map or program. +// +// Deprecated: use os.ErrNotExist instead. +var ErrNotExist = os.ErrNotExist + +// invalidBPFObjNameChar returns true if char may not appear in +// a BPF object name. +func invalidBPFObjNameChar(char rune) bool { + dotAllowed := objNameAllowsDot() == nil + + switch { + case char >= 'A' && char <= 'Z': + return false + case char >= 'a' && char <= 'z': + return false + case char >= '0' && char <= '9': + return false + case dotAllowed && char == '.': + return false + case char == '_': + return false + default: + return true + } +} + +type bpfMapOpAttr struct { + mapFd uint32 + padding uint32 + key internal.Pointer + value internal.Pointer + flags uint64 +} + +type bpfBatchMapOpAttr struct { + inBatch internal.Pointer + outBatch internal.Pointer + keys internal.Pointer + values internal.Pointer + count uint32 + mapFd uint32 + elemFlags uint64 + flags uint64 +} + +type bpfMapInfo struct { + map_type uint32 // since 4.12 1e2709769086 + id uint32 + key_size uint32 + value_size uint32 + max_entries uint32 + map_flags uint32 + name internal.BPFObjName // since 4.15 ad5b177bd73f + ifindex uint32 // since 4.16 52775b33bb50 + btf_vmlinux_value_type_id uint32 // since 5.6 85d33df357b6 + netns_dev uint64 // since 4.16 52775b33bb50 + netns_ino uint64 + btf_id uint32 // since 4.18 78958fca7ead + btf_key_type_id uint32 // since 4.18 9b2cf328b2ec + btf_value_type_id uint32 +} + +type bpfProgInfo struct { + prog_type uint32 + id uint32 + tag [unix.BPF_TAG_SIZE]byte + jited_prog_len uint32 + xlated_prog_len uint32 + jited_prog_insns internal.Pointer + xlated_prog_insns internal.Pointer + load_time uint64 // since 4.15 cb4d2b3f03d8 + created_by_uid uint32 + nr_map_ids uint32 // since 4.15 cb4d2b3f03d8 + map_ids internal.Pointer + name internal.BPFObjName // since 4.15 067cae47771c + ifindex uint32 + gpl_compatible uint32 + netns_dev uint64 + netns_ino uint64 + nr_jited_ksyms uint32 + nr_jited_func_lens uint32 + jited_ksyms internal.Pointer + jited_func_lens internal.Pointer + btf_id uint32 + func_info_rec_size uint32 + func_info internal.Pointer + nr_func_info uint32 + nr_line_info uint32 + line_info internal.Pointer + jited_line_info internal.Pointer + nr_jited_line_info uint32 + line_info_rec_size uint32 + jited_line_info_rec_size uint32 + nr_prog_tags uint32 + prog_tags internal.Pointer + run_time_ns uint64 + run_cnt uint64 +} + +type bpfProgTestRunAttr struct { + fd uint32 + retval uint32 + dataSizeIn uint32 + dataSizeOut uint32 + dataIn internal.Pointer + dataOut internal.Pointer + repeat uint32 + duration uint32 +} + +type bpfMapFreezeAttr struct { + mapFd uint32 +} + +type bpfObjGetNextIDAttr struct { + startID uint32 + nextID uint32 + openFlags uint32 +} + +func bpfProgTestRun(attr *bpfProgTestRunAttr) error { + _, err := internal.BPF(internal.BPF_PROG_TEST_RUN, unsafe.Pointer(attr), unsafe.Sizeof(*attr)) + return err +} + +var haveNestedMaps = internal.FeatureTest("nested maps", "4.12", func() error { + _, err := internal.BPFMapCreate(&internal.BPFMapCreateAttr{ + MapType: uint32(ArrayOfMaps), + KeySize: 4, + ValueSize: 4, + MaxEntries: 1, + // Invalid file descriptor. + InnerMapFd: ^uint32(0), + }) + if errors.Is(err, unix.EINVAL) { + return internal.ErrNotSupported + } + if errors.Is(err, unix.EBADF) { + return nil + } + return err +}) + +var haveMapMutabilityModifiers = internal.FeatureTest("read- and write-only maps", "5.2", func() error { + // This checks BPF_F_RDONLY_PROG and BPF_F_WRONLY_PROG. Since + // BPF_MAP_FREEZE appeared in 5.2 as well we don't do a separate check. + m, err := internal.BPFMapCreate(&internal.BPFMapCreateAttr{ + MapType: uint32(Array), + KeySize: 4, + ValueSize: 4, + MaxEntries: 1, + Flags: unix.BPF_F_RDONLY_PROG, + }) + if err != nil { + return internal.ErrNotSupported + } + _ = m.Close() + return nil +}) + +var haveMmapableMaps = internal.FeatureTest("mmapable maps", "5.5", func() error { + // This checks BPF_F_MMAPABLE, which appeared in 5.5 for array maps. + m, err := internal.BPFMapCreate(&internal.BPFMapCreateAttr{ + MapType: uint32(Array), + KeySize: 4, + ValueSize: 4, + MaxEntries: 1, + Flags: unix.BPF_F_MMAPABLE, + }) + if err != nil { + return internal.ErrNotSupported + } + _ = m.Close() + return nil +}) + +var haveInnerMaps = internal.FeatureTest("inner maps", "5.10", func() error { + // This checks BPF_F_INNER_MAP, which appeared in 5.10. + m, err := internal.BPFMapCreate(&internal.BPFMapCreateAttr{ + MapType: uint32(Array), + KeySize: 4, + ValueSize: 4, + MaxEntries: 1, + Flags: unix.BPF_F_INNER_MAP, + }) + if err != nil { + return internal.ErrNotSupported + } + _ = m.Close() + return nil +}) + +func bpfMapLookupElem(m *internal.FD, key, valueOut internal.Pointer) error { + fd, err := m.Value() + if err != nil { + return err + } + + attr := bpfMapOpAttr{ + mapFd: fd, + key: key, + value: valueOut, + } + _, err = internal.BPF(internal.BPF_MAP_LOOKUP_ELEM, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + return wrapMapError(err) +} + +func bpfMapLookupAndDelete(m *internal.FD, key, valueOut internal.Pointer) error { + fd, err := m.Value() + if err != nil { + return err + } + + attr := bpfMapOpAttr{ + mapFd: fd, + key: key, + value: valueOut, + } + _, err = internal.BPF(internal.BPF_MAP_LOOKUP_AND_DELETE_ELEM, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + return wrapMapError(err) +} + +func bpfMapUpdateElem(m *internal.FD, key, valueOut internal.Pointer, flags uint64) error { + fd, err := m.Value() + if err != nil { + return err + } + + attr := bpfMapOpAttr{ + mapFd: fd, + key: key, + value: valueOut, + flags: flags, + } + _, err = internal.BPF(internal.BPF_MAP_UPDATE_ELEM, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + return wrapMapError(err) +} + +func bpfMapDeleteElem(m *internal.FD, key internal.Pointer) error { + fd, err := m.Value() + if err != nil { + return err + } + + attr := bpfMapOpAttr{ + mapFd: fd, + key: key, + } + _, err = internal.BPF(internal.BPF_MAP_DELETE_ELEM, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + return wrapMapError(err) +} + +func bpfMapGetNextKey(m *internal.FD, key, nextKeyOut internal.Pointer) error { + fd, err := m.Value() + if err != nil { + return err + } + + attr := bpfMapOpAttr{ + mapFd: fd, + key: key, + value: nextKeyOut, + } + _, err = internal.BPF(internal.BPF_MAP_GET_NEXT_KEY, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + return wrapMapError(err) +} + +func objGetNextID(cmd internal.BPFCmd, start uint32) (uint32, error) { + attr := bpfObjGetNextIDAttr{ + startID: start, + } + _, err := internal.BPF(cmd, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + return attr.nextID, err +} + +func bpfMapBatch(cmd internal.BPFCmd, m *internal.FD, inBatch, outBatch, keys, values internal.Pointer, count uint32, opts *BatchOptions) (uint32, error) { + fd, err := m.Value() + if err != nil { + return 0, err + } + + attr := bpfBatchMapOpAttr{ + inBatch: inBatch, + outBatch: outBatch, + keys: keys, + values: values, + count: count, + mapFd: fd, + } + if opts != nil { + attr.elemFlags = opts.ElemFlags + attr.flags = opts.Flags + } + _, err = internal.BPF(cmd, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + // always return count even on an error, as things like update might partially be fulfilled. + return attr.count, wrapMapError(err) +} + +func wrapMapError(err error) error { + if err == nil { + return nil + } + + if errors.Is(err, unix.ENOENT) { + return internal.SyscallError(ErrKeyNotExist, unix.ENOENT) + } + + if errors.Is(err, unix.EEXIST) { + return internal.SyscallError(ErrKeyExist, unix.EEXIST) + } + + if errors.Is(err, unix.ENOTSUPP) { + return internal.SyscallError(ErrNotSupported, unix.ENOTSUPP) + } + + if errors.Is(err, unix.E2BIG) { + return fmt.Errorf("key too big for map: %w", err) + } + + return err +} + +func bpfMapFreeze(m *internal.FD) error { + fd, err := m.Value() + if err != nil { + return err + } + + attr := bpfMapFreezeAttr{ + mapFd: fd, + } + _, err = internal.BPF(internal.BPF_MAP_FREEZE, unsafe.Pointer(&attr), unsafe.Sizeof(attr)) + return err +} + +func bpfGetProgInfoByFD(fd *internal.FD, ids []MapID) (*bpfProgInfo, error) { + var info bpfProgInfo + if len(ids) > 0 { + info.nr_map_ids = uint32(len(ids)) + info.map_ids = internal.NewPointer(unsafe.Pointer(&ids[0])) + } + + if err := internal.BPFObjGetInfoByFD(fd, unsafe.Pointer(&info), unsafe.Sizeof(info)); err != nil { + return nil, fmt.Errorf("can't get program info: %w", err) + } + return &info, nil +} + +func bpfGetMapInfoByFD(fd *internal.FD) (*bpfMapInfo, error) { + var info bpfMapInfo + err := internal.BPFObjGetInfoByFD(fd, unsafe.Pointer(&info), unsafe.Sizeof(info)) + if err != nil { + return nil, fmt.Errorf("can't get map info: %w", err) + } + return &info, nil +} + +var haveObjName = internal.FeatureTest("object names", "4.15", func() error { + attr := internal.BPFMapCreateAttr{ + MapType: uint32(Array), + KeySize: 4, + ValueSize: 4, + MaxEntries: 1, + MapName: internal.NewBPFObjName("feature_test"), + } + + fd, err := internal.BPFMapCreate(&attr) + if err != nil { + return internal.ErrNotSupported + } + + _ = fd.Close() + return nil +}) + +var objNameAllowsDot = internal.FeatureTest("dot in object names", "5.2", func() error { + if err := haveObjName(); err != nil { + return err + } + + attr := internal.BPFMapCreateAttr{ + MapType: uint32(Array), + KeySize: 4, + ValueSize: 4, + MaxEntries: 1, + MapName: internal.NewBPFObjName(".test"), + } + + fd, err := internal.BPFMapCreate(&attr) + if err != nil { + return internal.ErrNotSupported + } + + _ = fd.Close() + return nil +}) + +var haveBatchAPI = internal.FeatureTest("map batch api", "5.6", func() error { + var maxEntries uint32 = 2 + attr := internal.BPFMapCreateAttr{ + MapType: uint32(Hash), + KeySize: 4, + ValueSize: 4, + MaxEntries: maxEntries, + } + + fd, err := internal.BPFMapCreate(&attr) + if err != nil { + return internal.ErrNotSupported + } + defer fd.Close() + keys := []uint32{1, 2} + values := []uint32{3, 4} + kp, _ := marshalPtr(keys, 8) + vp, _ := marshalPtr(values, 8) + nilPtr := internal.NewPointer(nil) + _, err = bpfMapBatch(internal.BPF_MAP_UPDATE_BATCH, fd, nilPtr, nilPtr, kp, vp, maxEntries, nil) + if err != nil { + return internal.ErrNotSupported + } + return nil +}) + +var haveProbeReadKernel = internal.FeatureTest("bpf_probe_read_kernel", "5.5", func() error { + insns := asm.Instructions{ + asm.Mov.Reg(asm.R1, asm.R10), + asm.Add.Imm(asm.R1, -8), + asm.Mov.Imm(asm.R2, 8), + asm.Mov.Imm(asm.R3, 0), + asm.FnProbeReadKernel.Call(), + asm.Return(), + } + buf := bytes.NewBuffer(make([]byte, 0, len(insns)*asm.InstructionSize)) + if err := insns.Marshal(buf, internal.NativeEndian); err != nil { + return err + } + bytecode := buf.Bytes() + + fd, err := internal.BPFProgLoad(&internal.BPFProgLoadAttr{ + ProgType: uint32(Kprobe), + License: internal.NewStringPointer("GPL"), + Instructions: internal.NewSlicePointer(bytecode), + InsCount: uint32(len(bytecode) / asm.InstructionSize), + }) + if err != nil { + return internal.ErrNotSupported + } + _ = fd.Close() + return nil +}) diff --git a/vendor/github.com/cilium/ebpf/types.go b/vendor/github.com/cilium/ebpf/types.go new file mode 100644 index 0000000000..84b83f9f98 --- /dev/null +++ b/vendor/github.com/cilium/ebpf/types.go @@ -0,0 +1,278 @@ +package ebpf + +import ( + "github.com/cilium/ebpf/internal/unix" +) + +//go:generate stringer -output types_string.go -type=MapType,ProgramType,PinType + +// MapType indicates the type map structure +// that will be initialized in the kernel. +type MapType uint32 + +// Max returns the latest supported MapType. +func (_ MapType) Max() MapType { + return maxMapType - 1 +} + +// All the various map types that can be created +const ( + UnspecifiedMap MapType = iota + // Hash is a hash map + Hash + // Array is an array map + Array + // ProgramArray - A program array map is a special kind of array map whose map + // values contain only file descriptors referring to other eBPF + // programs. Thus, both the key_size and value_size must be + // exactly four bytes. This map is used in conjunction with the + // TailCall helper. + ProgramArray + // PerfEventArray - A perf event array is used in conjunction with PerfEventRead + // and PerfEventOutput calls, to read the raw bpf_perf_data from the registers. + PerfEventArray + // PerCPUHash - This data structure is useful for people who have high performance + // network needs and can reconcile adds at the end of some cycle, so that + // hashes can be lock free without the use of XAdd, which can be costly. + PerCPUHash + // PerCPUArray - This data structure is useful for people who have high performance + // network needs and can reconcile adds at the end of some cycle, so that + // hashes can be lock free without the use of XAdd, which can be costly. + // Each CPU gets a copy of this hash, the contents of all of which can be reconciled + // later. + PerCPUArray + // StackTrace - This holds whole user and kernel stack traces, it can be retrieved with + // GetStackID + StackTrace + // CGroupArray - This is a very niche structure used to help SKBInCGroup determine + // if an skb is from a socket belonging to a specific cgroup + CGroupArray + // LRUHash - This allows you to create a small hash structure that will purge the + // least recently used items rather than thow an error when you run out of memory + LRUHash + // LRUCPUHash - This is NOT like PerCPUHash, this structure is shared among the CPUs, + // it has more to do with including the CPU id with the LRU calculation so that if a + // particular CPU is using a value over-and-over again, then it will be saved, but if + // a value is being retrieved a lot but sparsely across CPUs it is not as important, basically + // giving weight to CPU locality over overall usage. + LRUCPUHash + // LPMTrie - This is an implementation of Longest-Prefix-Match Trie structure. It is useful, + // for storing things like IP addresses which can be bit masked allowing for keys of differing + // values to refer to the same reference based on their masks. See wikipedia for more details. + LPMTrie + // ArrayOfMaps - Each item in the array is another map. The inner map mustn't be a map of maps + // itself. + ArrayOfMaps + // HashOfMaps - Each item in the hash map is another map. The inner map mustn't be a map of maps + // itself. + HashOfMaps + // DevMap - Specialized map to store references to network devices. + DevMap + // SockMap - Specialized map to store references to sockets. + SockMap + // CPUMap - Specialized map to store references to CPUs. + CPUMap + // XSKMap - Specialized map for XDP programs to store references to open sockets. + XSKMap + // SockHash - Specialized hash to store references to sockets. + SockHash + // CGroupStorage - Special map for CGroups. + CGroupStorage + // ReusePortSockArray - Specialized map to store references to sockets that can be reused. + ReusePortSockArray + // PerCPUCGroupStorage - Special per CPU map for CGroups. + PerCPUCGroupStorage + // Queue - FIFO storage for BPF programs. + Queue + // Stack - LIFO storage for BPF programs. + Stack + // SkStorage - Specialized map for local storage at SK for BPF programs. + SkStorage + // DevMapHash - Hash-based indexing scheme for references to network devices. + DevMapHash + // StructOpsMap - This map holds a kernel struct with its function pointer implemented in a BPF + // program. + StructOpsMap + // RingBuf - Similar to PerfEventArray, but shared across all CPUs. + RingBuf + // InodeStorage - Specialized local storage map for inodes. + InodeStorage + // TaskStorage - Specialized local storage map for task_struct. + TaskStorage + // maxMapType - Bound enum of MapTypes, has to be last in enum. + maxMapType +) + +// Deprecated: StructOpts was a typo, use StructOpsMap instead. +// +// Declared as a variable to prevent stringer from picking it up +// as an enum value. +var StructOpts MapType = StructOpsMap + +// hasPerCPUValue returns true if the Map stores a value per CPU. +func (mt MapType) hasPerCPUValue() bool { + return mt == PerCPUHash || mt == PerCPUArray || mt == LRUCPUHash || mt == PerCPUCGroupStorage +} + +// canStoreMap returns true if the map type accepts a map fd +// for update and returns a map id for lookup. +func (mt MapType) canStoreMap() bool { + return mt == ArrayOfMaps || mt == HashOfMaps +} + +// canStoreProgram returns true if the map type accepts a program fd +// for update and returns a program id for lookup. +func (mt MapType) canStoreProgram() bool { + return mt == ProgramArray +} + +// ProgramType of the eBPF program +type ProgramType uint32 + +// Max return the latest supported ProgramType. +func (_ ProgramType) Max() ProgramType { + return maxProgramType - 1 +} + +// eBPF program types +const ( + UnspecifiedProgram ProgramType = iota + SocketFilter + Kprobe + SchedCLS + SchedACT + TracePoint + XDP + PerfEvent + CGroupSKB + CGroupSock + LWTIn + LWTOut + LWTXmit + SockOps + SkSKB + CGroupDevice + SkMsg + RawTracepoint + CGroupSockAddr + LWTSeg6Local + LircMode2 + SkReuseport + FlowDissector + CGroupSysctl + RawTracepointWritable + CGroupSockopt + Tracing + StructOps + Extension + LSM + SkLookup + maxProgramType +) + +// AttachType of the eBPF program, needed to differentiate allowed context accesses in +// some newer program types like CGroupSockAddr. Should be set to AttachNone if not required. +// Will cause invalid argument (EINVAL) at program load time if set incorrectly. +type AttachType uint32 + +//go:generate stringer -type AttachType -trimprefix Attach + +// AttachNone is an alias for AttachCGroupInetIngress for readability reasons. +const AttachNone AttachType = 0 + +const ( + AttachCGroupInetIngress AttachType = iota + AttachCGroupInetEgress + AttachCGroupInetSockCreate + AttachCGroupSockOps + AttachSkSKBStreamParser + AttachSkSKBStreamVerdict + AttachCGroupDevice + AttachSkMsgVerdict + AttachCGroupInet4Bind + AttachCGroupInet6Bind + AttachCGroupInet4Connect + AttachCGroupInet6Connect + AttachCGroupInet4PostBind + AttachCGroupInet6PostBind + AttachCGroupUDP4Sendmsg + AttachCGroupUDP6Sendmsg + AttachLircMode2 + AttachFlowDissector + AttachCGroupSysctl + AttachCGroupUDP4Recvmsg + AttachCGroupUDP6Recvmsg + AttachCGroupGetsockopt + AttachCGroupSetsockopt + AttachTraceRawTp + AttachTraceFEntry + AttachTraceFExit + AttachModifyReturn + AttachLSMMac + AttachTraceIter + AttachCgroupInet4GetPeername + AttachCgroupInet6GetPeername + AttachCgroupInet4GetSockname + AttachCgroupInet6GetSockname + AttachXDPDevMap + AttachCgroupInetSockRelease + AttachXDPCPUMap + AttachSkLookup + AttachXDP + AttachSkSKBVerdict + AttachSkReuseportSelect + AttachSkReuseportSelectOrMigrate + AttachPerfEvent +) + +// AttachFlags of the eBPF program used in BPF_PROG_ATTACH command +type AttachFlags uint32 + +// PinType determines whether a map is pinned into a BPFFS. +type PinType int + +// Valid pin types. +// +// Mirrors enum libbpf_pin_type. +const ( + PinNone PinType = iota + // Pin an object by using its name as the filename. + PinByName +) + +// LoadPinOptions control how a pinned object is loaded. +type LoadPinOptions struct { + // Request a read-only or write-only object. The default is a read-write + // object. Only one of the flags may be set. + ReadOnly bool + WriteOnly bool + + // Raw flags for the syscall. Other fields of this struct take precedence. + Flags uint32 +} + +// Marshal returns a value suitable for BPF_OBJ_GET syscall file_flags parameter. +func (lpo *LoadPinOptions) Marshal() uint32 { + if lpo == nil { + return 0 + } + + flags := lpo.Flags + if lpo.ReadOnly { + flags |= unix.BPF_F_RDONLY + } + if lpo.WriteOnly { + flags |= unix.BPF_F_WRONLY + } + return flags +} + +// BatchOptions batch map operations options +// +// Mirrors libbpf struct bpf_map_batch_opts +// Currently BPF_F_FLAG is the only supported +// flag (for ElemFlags). +type BatchOptions struct { + ElemFlags uint64 + Flags uint64 +} diff --git a/vendor/github.com/cilium/ebpf/types_string.go b/vendor/github.com/cilium/ebpf/types_string.go new file mode 100644 index 0000000000..81cbc9efde --- /dev/null +++ b/vendor/github.com/cilium/ebpf/types_string.go @@ -0,0 +1,119 @@ +// Code generated by "stringer -output types_string.go -type=MapType,ProgramType,PinType"; DO NOT EDIT. + +package ebpf + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[UnspecifiedMap-0] + _ = x[Hash-1] + _ = x[Array-2] + _ = x[ProgramArray-3] + _ = x[PerfEventArray-4] + _ = x[PerCPUHash-5] + _ = x[PerCPUArray-6] + _ = x[StackTrace-7] + _ = x[CGroupArray-8] + _ = x[LRUHash-9] + _ = x[LRUCPUHash-10] + _ = x[LPMTrie-11] + _ = x[ArrayOfMaps-12] + _ = x[HashOfMaps-13] + _ = x[DevMap-14] + _ = x[SockMap-15] + _ = x[CPUMap-16] + _ = x[XSKMap-17] + _ = x[SockHash-18] + _ = x[CGroupStorage-19] + _ = x[ReusePortSockArray-20] + _ = x[PerCPUCGroupStorage-21] + _ = x[Queue-22] + _ = x[Stack-23] + _ = x[SkStorage-24] + _ = x[DevMapHash-25] + _ = x[StructOpsMap-26] + _ = x[RingBuf-27] + _ = x[InodeStorage-28] + _ = x[TaskStorage-29] + _ = x[maxMapType-30] +} + +const _MapType_name = "UnspecifiedMapHashArrayProgramArrayPerfEventArrayPerCPUHashPerCPUArrayStackTraceCGroupArrayLRUHashLRUCPUHashLPMTrieArrayOfMapsHashOfMapsDevMapSockMapCPUMapXSKMapSockHashCGroupStorageReusePortSockArrayPerCPUCGroupStorageQueueStackSkStorageDevMapHashStructOpsMapRingBufInodeStorageTaskStoragemaxMapType" + +var _MapType_index = [...]uint16{0, 14, 18, 23, 35, 49, 59, 70, 80, 91, 98, 108, 115, 126, 136, 142, 149, 155, 161, 169, 182, 200, 219, 224, 229, 238, 248, 260, 267, 279, 290, 300} + +func (i MapType) String() string { + if i >= MapType(len(_MapType_index)-1) { + return "MapType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _MapType_name[_MapType_index[i]:_MapType_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[UnspecifiedProgram-0] + _ = x[SocketFilter-1] + _ = x[Kprobe-2] + _ = x[SchedCLS-3] + _ = x[SchedACT-4] + _ = x[TracePoint-5] + _ = x[XDP-6] + _ = x[PerfEvent-7] + _ = x[CGroupSKB-8] + _ = x[CGroupSock-9] + _ = x[LWTIn-10] + _ = x[LWTOut-11] + _ = x[LWTXmit-12] + _ = x[SockOps-13] + _ = x[SkSKB-14] + _ = x[CGroupDevice-15] + _ = x[SkMsg-16] + _ = x[RawTracepoint-17] + _ = x[CGroupSockAddr-18] + _ = x[LWTSeg6Local-19] + _ = x[LircMode2-20] + _ = x[SkReuseport-21] + _ = x[FlowDissector-22] + _ = x[CGroupSysctl-23] + _ = x[RawTracepointWritable-24] + _ = x[CGroupSockopt-25] + _ = x[Tracing-26] + _ = x[StructOps-27] + _ = x[Extension-28] + _ = x[LSM-29] + _ = x[SkLookup-30] + _ = x[maxProgramType-31] +} + +const _ProgramType_name = "UnspecifiedProgramSocketFilterKprobeSchedCLSSchedACTTracePointXDPPerfEventCGroupSKBCGroupSockLWTInLWTOutLWTXmitSockOpsSkSKBCGroupDeviceSkMsgRawTracepointCGroupSockAddrLWTSeg6LocalLircMode2SkReuseportFlowDissectorCGroupSysctlRawTracepointWritableCGroupSockoptTracingStructOpsExtensionLSMSkLookupmaxProgramType" + +var _ProgramType_index = [...]uint16{0, 18, 30, 36, 44, 52, 62, 65, 74, 83, 93, 98, 104, 111, 118, 123, 135, 140, 153, 167, 179, 188, 199, 212, 224, 245, 258, 265, 274, 283, 286, 294, 308} + +func (i ProgramType) String() string { + if i >= ProgramType(len(_ProgramType_index)-1) { + return "ProgramType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _ProgramType_name[_ProgramType_index[i]:_ProgramType_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[PinNone-0] + _ = x[PinByName-1] +} + +const _PinType_name = "PinNonePinByName" + +var _PinType_index = [...]uint8{0, 7, 16} + +func (i PinType) String() string { + if i < 0 || i >= PinType(len(_PinType_index)-1) { + return "PinType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _PinType_name[_PinType_index[i]:_PinType_index[i+1]] +} diff --git a/vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go b/vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go deleted file mode 100644 index af62279a61..0000000000 --- a/vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go +++ /dev/null @@ -1,20 +0,0 @@ -package md2man - -import ( - "github.com/russross/blackfriday" -) - -// Render converts a markdown document into a roff formatted document. -func Render(doc []byte) []byte { - renderer := RoffRenderer(0) - extensions := 0 - extensions |= blackfriday.EXTENSION_NO_INTRA_EMPHASIS - extensions |= blackfriday.EXTENSION_TABLES - extensions |= blackfriday.EXTENSION_FENCED_CODE - extensions |= blackfriday.EXTENSION_AUTOLINK - extensions |= blackfriday.EXTENSION_SPACE_HEADERS - extensions |= blackfriday.EXTENSION_FOOTNOTES - extensions |= blackfriday.EXTENSION_TITLEBLOCK - - return blackfriday.Markdown(doc, renderer, extensions) -} diff --git a/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go b/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go deleted file mode 100644 index 8c29ec6873..0000000000 --- a/vendor/github.com/cpuguy83/go-md2man/md2man/roff.go +++ /dev/null @@ -1,285 +0,0 @@ -package md2man - -import ( - "bytes" - "fmt" - "html" - "strings" - - "github.com/russross/blackfriday" -) - -type roffRenderer struct { - ListCounters []int -} - -// RoffRenderer creates a new blackfriday Renderer for generating roff documents -// from markdown -func RoffRenderer(flags int) blackfriday.Renderer { - return &roffRenderer{} -} - -func (r *roffRenderer) GetFlags() int { - return 0 -} - -func (r *roffRenderer) TitleBlock(out *bytes.Buffer, text []byte) { - out.WriteString(".TH ") - - splitText := bytes.Split(text, []byte("\n")) - for i, line := range splitText { - line = bytes.TrimPrefix(line, []byte("% ")) - if i == 0 { - line = bytes.Replace(line, []byte("("), []byte("\" \""), 1) - line = bytes.Replace(line, []byte(")"), []byte("\" \""), 1) - } - line = append([]byte("\""), line...) - line = append(line, []byte("\" ")...) - out.Write(line) - } - out.WriteString("\n") - - // disable hyphenation - out.WriteString(".nh\n") - // disable justification (adjust text to left margin only) - out.WriteString(".ad l\n") -} - -func (r *roffRenderer) BlockCode(out *bytes.Buffer, text []byte, lang string) { - out.WriteString("\n.PP\n.RS\n\n.nf\n") - escapeSpecialChars(out, text) - out.WriteString("\n.fi\n.RE\n") -} - -func (r *roffRenderer) BlockQuote(out *bytes.Buffer, text []byte) { - out.WriteString("\n.PP\n.RS\n") - out.Write(text) - out.WriteString("\n.RE\n") -} - -func (r *roffRenderer) BlockHtml(out *bytes.Buffer, text []byte) { // nolint: golint - out.Write(text) -} - -func (r *roffRenderer) Header(out *bytes.Buffer, text func() bool, level int, id string) { - marker := out.Len() - - switch { - case marker == 0: - // This is the doc header - out.WriteString(".TH ") - case level == 1: - out.WriteString("\n\n.SH ") - case level == 2: - out.WriteString("\n.SH ") - default: - out.WriteString("\n.SS ") - } - - if !text() { - out.Truncate(marker) - return - } -} - -func (r *roffRenderer) HRule(out *bytes.Buffer) { - out.WriteString("\n.ti 0\n\\l'\\n(.lu'\n") -} - -func (r *roffRenderer) List(out *bytes.Buffer, text func() bool, flags int) { - marker := out.Len() - r.ListCounters = append(r.ListCounters, 1) - out.WriteString("\n.RS\n") - if !text() { - out.Truncate(marker) - return - } - r.ListCounters = r.ListCounters[:len(r.ListCounters)-1] - out.WriteString("\n.RE\n") -} - -func (r *roffRenderer) ListItem(out *bytes.Buffer, text []byte, flags int) { - if flags&blackfriday.LIST_TYPE_ORDERED != 0 { - out.WriteString(fmt.Sprintf(".IP \"%3d.\" 5\n", r.ListCounters[len(r.ListCounters)-1])) - r.ListCounters[len(r.ListCounters)-1]++ - } else { - out.WriteString(".IP \\(bu 2\n") - } - out.Write(text) - out.WriteString("\n") -} - -func (r *roffRenderer) Paragraph(out *bytes.Buffer, text func() bool) { - marker := out.Len() - out.WriteString("\n.PP\n") - if !text() { - out.Truncate(marker) - return - } - if marker != 0 { - out.WriteString("\n") - } -} - -func (r *roffRenderer) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) { - out.WriteString("\n.TS\nallbox;\n") - - maxDelims := 0 - lines := strings.Split(strings.TrimRight(string(header), "\n")+"\n"+strings.TrimRight(string(body), "\n"), "\n") - for _, w := range lines { - curDelims := strings.Count(w, "\t") - if curDelims > maxDelims { - maxDelims = curDelims - } - } - out.Write([]byte(strings.Repeat("l ", maxDelims+1) + "\n")) - out.Write([]byte(strings.Repeat("l ", maxDelims+1) + ".\n")) - out.Write(header) - if len(header) > 0 { - out.Write([]byte("\n")) - } - - out.Write(body) - out.WriteString("\n.TE\n") -} - -func (r *roffRenderer) TableRow(out *bytes.Buffer, text []byte) { - if out.Len() > 0 { - out.WriteString("\n") - } - out.Write(text) -} - -func (r *roffRenderer) TableHeaderCell(out *bytes.Buffer, text []byte, align int) { - if out.Len() > 0 { - out.WriteString("\t") - } - if len(text) == 0 { - text = []byte{' '} - } - out.Write([]byte("\\fB\\fC" + string(text) + "\\fR")) -} - -func (r *roffRenderer) TableCell(out *bytes.Buffer, text []byte, align int) { - if out.Len() > 0 { - out.WriteString("\t") - } - if len(text) > 30 { - text = append([]byte("T{\n"), text...) - text = append(text, []byte("\nT}")...) - } - if len(text) == 0 { - text = []byte{' '} - } - out.Write(text) -} - -func (r *roffRenderer) Footnotes(out *bytes.Buffer, text func() bool) { - -} - -func (r *roffRenderer) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) { - -} - -func (r *roffRenderer) AutoLink(out *bytes.Buffer, link []byte, kind int) { - out.WriteString("\n\\[la]") - out.Write(link) - out.WriteString("\\[ra]") -} - -func (r *roffRenderer) CodeSpan(out *bytes.Buffer, text []byte) { - out.WriteString("\\fB\\fC") - escapeSpecialChars(out, text) - out.WriteString("\\fR") -} - -func (r *roffRenderer) DoubleEmphasis(out *bytes.Buffer, text []byte) { - out.WriteString("\\fB") - out.Write(text) - out.WriteString("\\fP") -} - -func (r *roffRenderer) Emphasis(out *bytes.Buffer, text []byte) { - out.WriteString("\\fI") - out.Write(text) - out.WriteString("\\fP") -} - -func (r *roffRenderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) { -} - -func (r *roffRenderer) LineBreak(out *bytes.Buffer) { - out.WriteString("\n.br\n") -} - -func (r *roffRenderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { - out.Write(content) - r.AutoLink(out, link, 0) -} - -func (r *roffRenderer) RawHtmlTag(out *bytes.Buffer, tag []byte) { // nolint: golint - out.Write(tag) -} - -func (r *roffRenderer) TripleEmphasis(out *bytes.Buffer, text []byte) { - out.WriteString("\\s+2") - out.Write(text) - out.WriteString("\\s-2") -} - -func (r *roffRenderer) StrikeThrough(out *bytes.Buffer, text []byte) { -} - -func (r *roffRenderer) FootnoteRef(out *bytes.Buffer, ref []byte, id int) { - -} - -func (r *roffRenderer) Entity(out *bytes.Buffer, entity []byte) { - out.WriteString(html.UnescapeString(string(entity))) -} - -func (r *roffRenderer) NormalText(out *bytes.Buffer, text []byte) { - escapeSpecialChars(out, text) -} - -func (r *roffRenderer) DocumentHeader(out *bytes.Buffer) { -} - -func (r *roffRenderer) DocumentFooter(out *bytes.Buffer) { -} - -func needsBackslash(c byte) bool { - for _, r := range []byte("-_&\\~") { - if c == r { - return true - } - } - return false -} - -func escapeSpecialChars(out *bytes.Buffer, text []byte) { - for i := 0; i < len(text); i++ { - // escape initial apostrophe or period - if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') { - out.WriteString("\\&") - } - - // directly copy normal characters - org := i - - for i < len(text) && !needsBackslash(text[i]) { - i++ - } - if i > org { - out.Write(text[org:i]) - } - - // escape a character - if i >= len(text) { - break - } - out.WriteByte('\\') - out.WriteByte(text[i]) - } -} diff --git a/vendor/github.com/cpuguy83/go-md2man/LICENSE.md b/vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md similarity index 100% rename from vendor/github.com/cpuguy83/go-md2man/LICENSE.md rename to vendor/github.com/cpuguy83/go-md2man/v2/LICENSE.md diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go new file mode 100644 index 0000000000..b480056734 --- /dev/null +++ b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/md2man.go @@ -0,0 +1,14 @@ +package md2man + +import ( + "github.com/russross/blackfriday/v2" +) + +// Render converts a markdown document into a roff formatted document. +func Render(doc []byte) []byte { + renderer := NewRoffRenderer() + + return blackfriday.Run(doc, + []blackfriday.Option{blackfriday.WithRenderer(renderer), + blackfriday.WithExtensions(renderer.GetExtensions())}...) +} diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go new file mode 100644 index 0000000000..0668a66cf7 --- /dev/null +++ b/vendor/github.com/cpuguy83/go-md2man/v2/md2man/roff.go @@ -0,0 +1,345 @@ +package md2man + +import ( + "fmt" + "io" + "os" + "strings" + + "github.com/russross/blackfriday/v2" +) + +// roffRenderer implements the blackfriday.Renderer interface for creating +// roff format (manpages) from markdown text +type roffRenderer struct { + extensions blackfriday.Extensions + listCounters []int + firstHeader bool + defineTerm bool + listDepth int +} + +const ( + titleHeader = ".TH " + topLevelHeader = "\n\n.SH " + secondLevelHdr = "\n.SH " + otherHeader = "\n.SS " + crTag = "\n" + emphTag = "\\fI" + emphCloseTag = "\\fP" + strongTag = "\\fB" + strongCloseTag = "\\fP" + breakTag = "\n.br\n" + paraTag = "\n.PP\n" + hruleTag = "\n.ti 0\n\\l'\\n(.lu'\n" + linkTag = "\n\\[la]" + linkCloseTag = "\\[ra]" + codespanTag = "\\fB\\fC" + codespanCloseTag = "\\fR" + codeTag = "\n.PP\n.RS\n\n.nf\n" + codeCloseTag = "\n.fi\n.RE\n" + quoteTag = "\n.PP\n.RS\n" + quoteCloseTag = "\n.RE\n" + listTag = "\n.RS\n" + listCloseTag = "\n.RE\n" + arglistTag = "\n.TP\n" + tableStart = "\n.TS\nallbox;\n" + tableEnd = ".TE\n" + tableCellStart = "T{\n" + tableCellEnd = "\nT}\n" +) + +// NewRoffRenderer creates a new blackfriday Renderer for generating roff documents +// from markdown +func NewRoffRenderer() *roffRenderer { // nolint: golint + var extensions blackfriday.Extensions + + extensions |= blackfriday.NoIntraEmphasis + extensions |= blackfriday.Tables + extensions |= blackfriday.FencedCode + extensions |= blackfriday.SpaceHeadings + extensions |= blackfriday.Footnotes + extensions |= blackfriday.Titleblock + extensions |= blackfriday.DefinitionLists + return &roffRenderer{ + extensions: extensions, + } +} + +// GetExtensions returns the list of extensions used by this renderer implementation +func (r *roffRenderer) GetExtensions() blackfriday.Extensions { + return r.extensions +} + +// RenderHeader handles outputting the header at document start +func (r *roffRenderer) RenderHeader(w io.Writer, ast *blackfriday.Node) { + // disable hyphenation + out(w, ".nh\n") +} + +// RenderFooter handles outputting the footer at the document end; the roff +// renderer has no footer information +func (r *roffRenderer) RenderFooter(w io.Writer, ast *blackfriday.Node) { +} + +// RenderNode is called for each node in a markdown document; based on the node +// type the equivalent roff output is sent to the writer +func (r *roffRenderer) RenderNode(w io.Writer, node *blackfriday.Node, entering bool) blackfriday.WalkStatus { + + var walkAction = blackfriday.GoToNext + + switch node.Type { + case blackfriday.Text: + r.handleText(w, node, entering) + case blackfriday.Softbreak: + out(w, crTag) + case blackfriday.Hardbreak: + out(w, breakTag) + case blackfriday.Emph: + if entering { + out(w, emphTag) + } else { + out(w, emphCloseTag) + } + case blackfriday.Strong: + if entering { + out(w, strongTag) + } else { + out(w, strongCloseTag) + } + case blackfriday.Link: + if !entering { + out(w, linkTag+string(node.LinkData.Destination)+linkCloseTag) + } + case blackfriday.Image: + // ignore images + walkAction = blackfriday.SkipChildren + case blackfriday.Code: + out(w, codespanTag) + escapeSpecialChars(w, node.Literal) + out(w, codespanCloseTag) + case blackfriday.Document: + break + case blackfriday.Paragraph: + // roff .PP markers break lists + if r.listDepth > 0 { + return blackfriday.GoToNext + } + if entering { + out(w, paraTag) + } else { + out(w, crTag) + } + case blackfriday.BlockQuote: + if entering { + out(w, quoteTag) + } else { + out(w, quoteCloseTag) + } + case blackfriday.Heading: + r.handleHeading(w, node, entering) + case blackfriday.HorizontalRule: + out(w, hruleTag) + case blackfriday.List: + r.handleList(w, node, entering) + case blackfriday.Item: + r.handleItem(w, node, entering) + case blackfriday.CodeBlock: + out(w, codeTag) + escapeSpecialChars(w, node.Literal) + out(w, codeCloseTag) + case blackfriday.Table: + r.handleTable(w, node, entering) + case blackfriday.TableCell: + r.handleTableCell(w, node, entering) + case blackfriday.TableHead: + case blackfriday.TableBody: + case blackfriday.TableRow: + // no action as cell entries do all the nroff formatting + return blackfriday.GoToNext + default: + fmt.Fprintln(os.Stderr, "WARNING: go-md2man does not handle node type "+node.Type.String()) + } + return walkAction +} + +func (r *roffRenderer) handleText(w io.Writer, node *blackfriday.Node, entering bool) { + var ( + start, end string + ) + // handle special roff table cell text encapsulation + if node.Parent.Type == blackfriday.TableCell { + if len(node.Literal) > 30 { + start = tableCellStart + end = tableCellEnd + } else { + // end rows that aren't terminated by "tableCellEnd" with a cr if end of row + if node.Parent.Next == nil && !node.Parent.IsHeader { + end = crTag + } + } + } + out(w, start) + escapeSpecialChars(w, node.Literal) + out(w, end) +} + +func (r *roffRenderer) handleHeading(w io.Writer, node *blackfriday.Node, entering bool) { + if entering { + switch node.Level { + case 1: + if !r.firstHeader { + out(w, titleHeader) + r.firstHeader = true + break + } + out(w, topLevelHeader) + case 2: + out(w, secondLevelHdr) + default: + out(w, otherHeader) + } + } +} + +func (r *roffRenderer) handleList(w io.Writer, node *blackfriday.Node, entering bool) { + openTag := listTag + closeTag := listCloseTag + if node.ListFlags&blackfriday.ListTypeDefinition != 0 { + // tags for definition lists handled within Item node + openTag = "" + closeTag = "" + } + if entering { + r.listDepth++ + if node.ListFlags&blackfriday.ListTypeOrdered != 0 { + r.listCounters = append(r.listCounters, 1) + } + out(w, openTag) + } else { + if node.ListFlags&blackfriday.ListTypeOrdered != 0 { + r.listCounters = r.listCounters[:len(r.listCounters)-1] + } + out(w, closeTag) + r.listDepth-- + } +} + +func (r *roffRenderer) handleItem(w io.Writer, node *blackfriday.Node, entering bool) { + if entering { + if node.ListFlags&blackfriday.ListTypeOrdered != 0 { + out(w, fmt.Sprintf(".IP \"%3d.\" 5\n", r.listCounters[len(r.listCounters)-1])) + r.listCounters[len(r.listCounters)-1]++ + } else if node.ListFlags&blackfriday.ListTypeDefinition != 0 { + // state machine for handling terms and following definitions + // since blackfriday does not distinguish them properly, nor + // does it seperate them into separate lists as it should + if !r.defineTerm { + out(w, arglistTag) + r.defineTerm = true + } else { + r.defineTerm = false + } + } else { + out(w, ".IP \\(bu 2\n") + } + } else { + out(w, "\n") + } +} + +func (r *roffRenderer) handleTable(w io.Writer, node *blackfriday.Node, entering bool) { + if entering { + out(w, tableStart) + //call walker to count cells (and rows?) so format section can be produced + columns := countColumns(node) + out(w, strings.Repeat("l ", columns)+"\n") + out(w, strings.Repeat("l ", columns)+".\n") + } else { + out(w, tableEnd) + } +} + +func (r *roffRenderer) handleTableCell(w io.Writer, node *blackfriday.Node, entering bool) { + var ( + start, end string + ) + if node.IsHeader { + start = codespanTag + end = codespanCloseTag + } + if entering { + if node.Prev != nil && node.Prev.Type == blackfriday.TableCell { + out(w, "\t"+start) + } else { + out(w, start) + } + } else { + // need to carriage return if we are at the end of the header row + if node.IsHeader && node.Next == nil { + end = end + crTag + } + out(w, end) + } +} + +// because roff format requires knowing the column count before outputting any table +// data we need to walk a table tree and count the columns +func countColumns(node *blackfriday.Node) int { + var columns int + + node.Walk(func(node *blackfriday.Node, entering bool) blackfriday.WalkStatus { + switch node.Type { + case blackfriday.TableRow: + if !entering { + return blackfriday.Terminate + } + case blackfriday.TableCell: + if entering { + columns++ + } + default: + } + return blackfriday.GoToNext + }) + return columns +} + +func out(w io.Writer, output string) { + io.WriteString(w, output) // nolint: errcheck +} + +func needsBackslash(c byte) bool { + for _, r := range []byte("-_&\\~") { + if c == r { + return true + } + } + return false +} + +func escapeSpecialChars(w io.Writer, text []byte) { + for i := 0; i < len(text); i++ { + // escape initial apostrophe or period + if len(text) >= 1 && (text[0] == '\'' || text[0] == '.') { + out(w, "\\&") + } + + // directly copy normal characters + org := i + + for i < len(text) && !needsBackslash(text[i]) { + i++ + } + if i > org { + w.Write(text[org:i]) // nolint: errcheck + } + + // escape a character + if i >= len(text) { + break + } + + w.Write([]byte{'\\', text[i]}) // nolint: errcheck + } +} diff --git a/vendor/github.com/derekparker/trie/.deepsource.toml b/vendor/github.com/derekparker/trie/.deepsource.toml new file mode 100644 index 0000000000..3af3d2df09 --- /dev/null +++ b/vendor/github.com/derekparker/trie/.deepsource.toml @@ -0,0 +1,13 @@ +version = 1 + +test_patterns = ["*_test.go"] + +exclude_patterns = ["vendor/*"] + +[[analyzers]] +name = "go" +enabled = true + + [analyzers.meta] + import_path = "github.com/derekparker/trie" + dependencies_vendored = true \ No newline at end of file diff --git a/vendor/github.com/derekparker/trie/.gitignore b/vendor/github.com/derekparker/trie/.gitignore new file mode 100644 index 0000000000..9ed3b07cef --- /dev/null +++ b/vendor/github.com/derekparker/trie/.gitignore @@ -0,0 +1 @@ +*.test diff --git a/vendor/github.com/derekparker/trie/LICENSE b/vendor/github.com/derekparker/trie/LICENSE new file mode 100644 index 0000000000..5ee9d2f1c3 --- /dev/null +++ b/vendor/github.com/derekparker/trie/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Derek Parker + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/derekparker/trie/README.md b/vendor/github.com/derekparker/trie/README.md new file mode 100644 index 0000000000..03e765d0be --- /dev/null +++ b/vendor/github.com/derekparker/trie/README.md @@ -0,0 +1,62 @@ +[![GoDoc](https://godoc.org/github.com/derekparker/trie?status.svg)](https://godoc.org/github.com/derekparker/trie) + +# Trie +Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching. + +## Usage + +Create a Trie with: + +```Go +t := trie.New() +``` + +Add Keys with: + +```Go +// Add can take in meta information which can be stored with the key. +// i.e. you could store any information you would like to associate with +// this particular key. +t.Add("foobar", 1) +``` + +Find a key with: + +```Go +node, ok := t.Find("foobar") +meta := node.Meta() +// use meta with meta.(type) +``` + +Remove Keys with: + +```Go +t.Remove("foobar") +``` + +Prefix search with: + +```Go +t.PrefixSearch("foo") +``` + +Fast test for valid prefix: +```Go +t.HasKeysWithPrefix("foo") +``` + +Fuzzy search with: + +```Go +t.FuzzySearch("fb") +``` + +## Contributing +Fork this repo and run tests with: + + go test + +Create a feature branch, write your tests and code and submit a pull request. + +## License +MIT diff --git a/vendor/github.com/derekparker/trie/trie.go b/vendor/github.com/derekparker/trie/trie.go new file mode 100644 index 0000000000..2837c64864 --- /dev/null +++ b/vendor/github.com/derekparker/trie/trie.go @@ -0,0 +1,306 @@ +// Implementation of an R-Way Trie data structure. +// +// A Trie has a root Node which is the base of the tree. +// Each subsequent Node has a letter and children, which are +// nodes that have letter values associated with them. +package trie + +import ( + "sort" + "sync" +) + +type Node struct { + val rune + path string + term bool + depth int + meta interface{} + mask uint64 + parent *Node + children map[rune]*Node + termCount int +} + +type Trie struct { + mu sync.Mutex + root *Node + size int +} + +type ByKeys []string + +func (a ByKeys) Len() int { return len(a) } +func (a ByKeys) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a ByKeys) Less(i, j int) bool { return len(a[i]) < len(a[j]) } + +const nul = 0x0 + +// Creates a new Trie with an initialized root Node. +func New() *Trie { + return &Trie{ + root: &Node{children: make(map[rune]*Node), depth: 0}, + size: 0, + } +} + +// Returns the root node for the Trie. +func (t *Trie) Root() *Node { + return t.root +} + +// Adds the key to the Trie, including meta data. Meta data +// is stored as `interface{}` and must be type cast by +// the caller. +func (t *Trie) Add(key string, meta interface{}) *Node { + t.mu.Lock() + + t.size++ + runes := []rune(key) + bitmask := maskruneslice(runes) + node := t.root + node.mask |= bitmask + node.termCount++ + for i := range runes { + r := runes[i] + bitmask = maskruneslice(runes[i:]) + if n, ok := node.children[r]; ok { + node = n + node.mask |= bitmask + } else { + node = node.NewChild(r, "", bitmask, nil, false) + } + node.termCount++ + } + node = node.NewChild(nul, key, 0, meta, true) + t.mu.Unlock() + + return node +} + +// Finds and returns meta data associated +// with `key`. +func (t *Trie) Find(key string) (*Node, bool) { + node := findNode(t.Root(), []rune(key)) + if node == nil { + return nil, false + } + + node, ok := node.Children()[nul] + if !ok || !node.term { + return nil, false + } + + return node, true +} + +func (t *Trie) HasKeysWithPrefix(key string) bool { + node := findNode(t.Root(), []rune(key)) + return node != nil +} + +// Removes a key from the trie, ensuring that +// all bitmasks up to root are appropriately recalculated. +func (t *Trie) Remove(key string) { + var ( + i int + rs = []rune(key) + node = findNode(t.Root(), []rune(key)) + ) + t.mu.Lock() + + t.size-- + for n := node.Parent(); n != nil; n = n.Parent() { + i++ + if len(n.Children()) > 1 { + r := rs[len(rs)-i] + n.RemoveChild(r) + break + } + } + t.mu.Unlock() +} + +// Returns all the keys currently stored in the trie. +func (t *Trie) Keys() []string { + if t.size == 0 { + return []string{} + } + + return t.PrefixSearch("") +} + +// Performs a fuzzy search against the keys in the trie. +func (t Trie) FuzzySearch(pre string) []string { + keys := fuzzycollect(t.Root(), []rune(pre)) + sort.Sort(ByKeys(keys)) + return keys +} + +// Performs a prefix search against the keys in the trie. +func (t Trie) PrefixSearch(pre string) []string { + node := findNode(t.Root(), []rune(pre)) + if node == nil { + return nil + } + + return collect(node) +} + +// Creates and returns a pointer to a new child for the node. +func (parent *Node) NewChild(val rune, path string, bitmask uint64, meta interface{}, term bool) *Node { + node := &Node{ + val: val, + path: path, + mask: bitmask, + term: term, + meta: meta, + parent: parent, + children: make(map[rune]*Node), + depth: parent.depth + 1, + } + parent.children[node.val] = node + parent.mask |= bitmask + return node +} + +func (n *Node) RemoveChild(r rune) { + delete(n.children, r) + for nd := n.parent; nd != nil; nd = nd.parent { + nd.mask ^= nd.mask + nd.mask |= uint64(1) << uint64(nd.val-'a') + for _, c := range nd.children { + nd.mask |= c.mask + } + } +} + +// Returns the parent of this node. +func (n Node) Parent() *Node { + return n.parent +} + +// Returns the meta information of this node. +func (n Node) Meta() interface{} { + return n.meta +} + +// Returns the children of this node. +func (n Node) Children() map[rune]*Node { + return n.children +} + +func (n Node) Terminating() bool { + return n.term +} + +func (n Node) Val() rune { + return n.val +} + +func (n Node) Depth() int { + return n.depth +} + +// Returns a uint64 representing the current +// mask of this node. +func (n Node) Mask() uint64 { + return n.mask +} + +func findNode(node *Node, runes []rune) *Node { + if node == nil { + return nil + } + + if len(runes) == 0 { + return node + } + + n, ok := node.Children()[runes[0]] + if !ok { + return nil + } + + var nrunes []rune + if len(runes) > 1 { + nrunes = runes[1:] + } else { + nrunes = runes[0:0] + } + + return findNode(n, nrunes) +} + +func maskruneslice(rs []rune) uint64 { + var m uint64 + for _, r := range rs { + m |= uint64(1) << uint64(r-'a') + } + return m +} + +func collect(node *Node) []string { + var ( + n *Node + i int + ) + keys := make([]string, 0, node.termCount) + nodes := make([]*Node, 1, len(node.children)) + nodes[0] = node + for l := len(nodes); l != 0; l = len(nodes) { + i = l - 1 + n = nodes[i] + nodes = nodes[:i] + for _, c := range n.children { + nodes = append(nodes, c) + } + if n.term { + word := n.path + keys = append(keys, word) + } + } + return keys +} + +type potentialSubtree struct { + idx int + node *Node +} + +func fuzzycollect(node *Node, partial []rune) []string { + if len(partial) == 0 { + return collect(node) + } + + var ( + m uint64 + i int + p potentialSubtree + keys []string + ) + + potential := []potentialSubtree{potentialSubtree{node: node, idx: 0}} + for l := len(potential); l > 0; l = len(potential) { + i = l - 1 + p = potential[i] + potential = potential[:i] + m = maskruneslice(partial[p.idx:]) + if (p.node.mask & m) != m { + continue + } + + if p.node.val == partial[p.idx] { + p.idx++ + if p.idx == len(partial) { + keys = append(keys, collect(p.node)...) + continue + } + } + + for _, c := range p.node.children { + potential = append(potential, potentialSubtree{node: c, idx: p.idx}) + } + } + return keys +} diff --git a/vendor/github.com/google/go-dap/.travis.yml b/vendor/github.com/google/go-dap/.travis.yml deleted file mode 100644 index 54bc099dd3..0000000000 --- a/vendor/github.com/google/go-dap/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go - -go: -- 1.13.x - -env: - global: - - GOPROXY=https://proxy.golang.org - - GO111MODULE=on - -script: - - 'internal/test.sh' diff --git a/vendor/github.com/google/go-dap/README.md b/vendor/github.com/google/go-dap/README.md index bfec6168ec..fbbe01e68e 100644 --- a/vendor/github.com/google/go-dap/README.md +++ b/vendor/github.com/google/go-dap/README.md @@ -1,6 +1,7 @@ # go-dap: Go implementation of the Debug Adapter Protocol -[![Build Status](https://travis-ci.org/google/go-dap.svg?branch=master)](https://travis-ci.org/google/go-dap) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/google/go-dap)](https://pkg.go.dev/github.com/google/go-dap) +[![Build Status](https://github.com/google/go-dap/actions/workflows/go.yml/badge.svg?branch=master)](https://github.com/google/go-dap/actions) [![Go Report Card](https://goreportcard.com/badge/github.com/google/go-dap)](https://goreportcard.com/report/github.com/google/go-dap) For an overview of DAP, see diff --git a/vendor/github.com/google/go-dap/codec.go b/vendor/github.com/google/go-dap/codec.go index d0443b1d5f..50b14a5018 100644 --- a/vendor/github.com/google/go-dap/codec.go +++ b/vendor/github.com/google/go-dap/codec.go @@ -24,13 +24,14 @@ import ( // DecodeProtocolMessageFieldError describes which JSON attribute // has an unsupported value that the decoding cannot handle. type DecodeProtocolMessageFieldError struct { + Seq int SubType string FieldName string FieldValue string } func (e *DecodeProtocolMessageFieldError) Error() string { - return fmt.Sprintf("%s %s '%s' is not supported", e.SubType, e.FieldName, e.FieldValue) + return fmt.Sprintf("%s %s '%s' is not supported (seq: %d)", e.SubType, e.FieldName, e.FieldValue, e.Seq) } // DecodeProtocolMessage parses the JSON-encoded data and returns the result of @@ -50,7 +51,7 @@ func DecodeProtocolMessage(data []byte) (Message, error) { case "event": return decodeEvent(data) default: - return nil, &DecodeProtocolMessageFieldError{"ProtocolMessage", "type", protomsg.Type} + return nil, &DecodeProtocolMessageFieldError{protomsg.GetSeq(), "ProtocolMessage", "type", protomsg.Type} } } @@ -69,53 +70,7 @@ func decodeRequest(data []byte) (Message, error) { err := json.Unmarshal(data, requestPtr) return requestPtr, err } - return nil, &DecodeProtocolMessageFieldError{"Request", "command", r.Command} -} - -// Mapping of request commands and corresponding struct constructors that -// can be passed to json.Unmarshal. -var requestCtor = map[string]messageCtor{ - "cancel": func() Message { return &CancelRequest{} }, - "runInTerminal": func() Message { return &RunInTerminalRequest{} }, - "initialize": func() Message { return &InitializeRequest{} }, - "configurationDone": func() Message { return &ConfigurationDoneRequest{} }, - "launch": func() Message { return &LaunchRequest{} }, - "attach": func() Message { return &AttachRequest{} }, - "restart": func() Message { return &RestartRequest{} }, - "disconnect": func() Message { return &DisconnectRequest{} }, - "terminate": func() Message { return &TerminateRequest{} }, - "breakpointLocations": func() Message { return &BreakpointLocationsRequest{} }, - "setBreakpoints": func() Message { return &SetBreakpointsRequest{} }, - "setFunctionBreakpoints": func() Message { return &SetFunctionBreakpointsRequest{} }, - "setExceptionBreakpoints": func() Message { return &SetExceptionBreakpointsRequest{} }, - "dataBreakpointInfo": func() Message { return &DataBreakpointInfoRequest{} }, - "setDataBreakpoints": func() Message { return &SetDataBreakpointsRequest{} }, - "continue": func() Message { return &ContinueRequest{} }, - "next": func() Message { return &NextRequest{} }, - "stepIn": func() Message { return &StepInRequest{} }, - "stepOut": func() Message { return &StepOutRequest{} }, - "stepBack": func() Message { return &StepBackRequest{} }, - "reverseContinue": func() Message { return &ReverseContinueRequest{} }, - "restartFrame": func() Message { return &RestartFrameRequest{} }, - "goto": func() Message { return &GotoRequest{} }, - "pause": func() Message { return &PauseRequest{} }, - "stackTrace": func() Message { return &StackTraceRequest{} }, - "scopes": func() Message { return &ScopesRequest{} }, - "variables": func() Message { return &VariablesRequest{} }, - "setVariable": func() Message { return &SetVariableRequest{} }, - "source": func() Message { return &SourceRequest{} }, - "threads": func() Message { return &ThreadsRequest{} }, - "terminateThreads": func() Message { return &TerminateThreadsRequest{} }, - "modules": func() Message { return &ModulesRequest{} }, - "loadedSources": func() Message { return &LoadedSourcesRequest{} }, - "evaluate": func() Message { return &EvaluateRequest{} }, - "setExpression": func() Message { return &SetExpressionRequest{} }, - "stepInTargets": func() Message { return &StepInTargetsRequest{} }, - "gotoTargets": func() Message { return &GotoTargetsRequest{} }, - "completions": func() Message { return &CompletionsRequest{} }, - "exceptionInfo": func() Message { return &ExceptionInfoRequest{} }, - "readMemory": func() Message { return &ReadMemoryRequest{} }, - "disassemble": func() Message { return &DisassembleRequest{} }, + return nil, &DecodeProtocolMessageFieldError{r.GetSeq(), "Request", "command", r.Command} } // decodeResponse determines what response type in the ProtocolMessage hierarchy @@ -136,53 +91,7 @@ func decodeResponse(data []byte) (Message, error) { err := json.Unmarshal(data, responsePtr) return responsePtr, err } - return nil, &DecodeProtocolMessageFieldError{"Response", "command", r.Command} -} - -// Mapping of response commands and corresponding struct constructors that -// can be passed to json.Unmarshal. -var responseCtor = map[string]messageCtor{ - "cancel": func() Message { return &CancelResponse{} }, - "runInTerminal": func() Message { return &RunInTerminalResponse{} }, - "initialize": func() Message { return &InitializeResponse{} }, - "configurationDone": func() Message { return &ConfigurationDoneResponse{} }, - "launch": func() Message { return &LaunchResponse{} }, - "attach": func() Message { return &AttachResponse{} }, - "restart": func() Message { return &RestartResponse{} }, - "disconnect": func() Message { return &DisconnectResponse{} }, - "terminate": func() Message { return &TerminateResponse{} }, - "breakpointLocations": func() Message { return &BreakpointLocationsResponse{} }, - "setBreakpoints": func() Message { return &SetBreakpointsResponse{} }, - "setFunctionBreakpoints": func() Message { return &SetFunctionBreakpointsResponse{} }, - "setExceptionBreakpoints": func() Message { return &SetExceptionBreakpointsResponse{} }, - "dataBreakpointInfo": func() Message { return &DataBreakpointInfoResponse{} }, - "setDataBreakpoints": func() Message { return &SetDataBreakpointsResponse{} }, - "continue": func() Message { return &ContinueResponse{} }, - "next": func() Message { return &NextResponse{} }, - "stepIn": func() Message { return &StepInResponse{} }, - "stepOut": func() Message { return &StepOutResponse{} }, - "stepBack": func() Message { return &StepBackResponse{} }, - "reverseContinue": func() Message { return &ReverseContinueResponse{} }, - "restartFrame": func() Message { return &RestartFrameResponse{} }, - "goto": func() Message { return &GotoResponse{} }, - "pause": func() Message { return &PauseResponse{} }, - "stackTrace": func() Message { return &StackTraceResponse{} }, - "scopes": func() Message { return &ScopesResponse{} }, - "variables": func() Message { return &VariablesResponse{} }, - "setVariable": func() Message { return &SetVariableResponse{} }, - "source": func() Message { return &SourceResponse{} }, - "threads": func() Message { return &ThreadsResponse{} }, - "terminateThreads": func() Message { return &TerminateThreadsResponse{} }, - "modules": func() Message { return &ModulesResponse{} }, - "loadedSources": func() Message { return &LoadedSourcesResponse{} }, - "evaluate": func() Message { return &EvaluateResponse{} }, - "setExpression": func() Message { return &SetExpressionResponse{} }, - "stepInTargets": func() Message { return &StepInTargetsResponse{} }, - "gotoTargets": func() Message { return &GotoTargetsResponse{} }, - "completions": func() Message { return &CompletionsResponse{} }, - "exceptionInfo": func() Message { return &ExceptionInfoResponse{} }, - "readMemory": func() Message { return &ReadMemoryResponse{} }, - "disassemble": func() Message { return &DisassembleResponse{} }, + return nil, &DecodeProtocolMessageFieldError{r.GetSeq(), "Response", "command", r.Command} } // decodeEvent determines what event type in the ProtocolMessage hierarchy @@ -198,22 +107,5 @@ func decodeEvent(data []byte) (Message, error) { err := json.Unmarshal(data, eventPtr) return eventPtr, err } - return nil, &DecodeProtocolMessageFieldError{"Event", "event", e.Event} -} - -// Mapping of event ids and corresponding struct constructors that -// can be passed to json.Unmarshal. -var eventCtor = map[string]messageCtor{ - "initialized": func() Message { return &InitializedEvent{} }, - "stopped": func() Message { return &StoppedEvent{} }, - "continued": func() Message { return &ContinuedEvent{} }, - "exited": func() Message { return &ExitedEvent{} }, - "terminated": func() Message { return &TerminatedEvent{} }, - "thread": func() Message { return &ThreadEvent{} }, - "output": func() Message { return &OutputEvent{} }, - "breakpoint": func() Message { return &BreakpointEvent{} }, - "module": func() Message { return &ModuleEvent{} }, - "loadedSource": func() Message { return &LoadedSourceEvent{} }, - "process": func() Message { return &ProcessEvent{} }, - "capabilities": func() Message { return &CapabilitiesEvent{} }, + return nil, &DecodeProtocolMessageFieldError{e.GetSeq(), "Event", "event", e.Event} } diff --git a/vendor/github.com/google/go-dap/doc.go b/vendor/github.com/google/go-dap/doc.go new file mode 100644 index 0000000000..95cb28f9ca --- /dev/null +++ b/vendor/github.com/google/go-dap/doc.go @@ -0,0 +1,20 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package dap contains data types and code for Debug Adapter Protocol (DAP) specification. +// https://github.com/microsoft/vscode-debugadapter-node/blob/main/debugProtocol.json +package dap + +//go:generate go run ./cmd/gentypes/gentypes.go -o schematypes.go -u cmd/gentypes/debugProtocol.json + diff --git a/vendor/github.com/google/go-dap/io.go b/vendor/github.com/google/go-dap/io.go index 5b85851b5b..87125ef24f 100644 --- a/vendor/github.com/google/go-dap/io.go +++ b/vendor/github.com/google/go-dap/io.go @@ -95,7 +95,7 @@ func ReadBaseMessage(r *bufio.Reader) ([]byte, error) { // and required: // Content-Length: [0-9]+\r\n\r\n // Extracts and returns the content length. -func readContentLengthHeader(r *bufio.Reader) (contentLength int, err error) { +func readContentLengthHeader(r *bufio.Reader) (contentLength int64, err error) { // Look for \r\n\r\n headerWithCr, err := r.ReadString('\r') if err != nil { @@ -115,7 +115,7 @@ func readContentLengthHeader(r *bufio.Reader) (contentLength int, err error) { if len(headerAndLength) < 2 { return 0, ErrHeaderNotContentLength } - return strconv.Atoi(headerAndLength[1]) + return strconv.ParseInt(headerAndLength[1], 10, 64) } // WriteProtocolMessage encodes message and writes it to w. diff --git a/vendor/github.com/google/go-dap/schematypes.go b/vendor/github.com/google/go-dap/schematypes.go index 597903af57..1d93058f24 100644 --- a/vendor/github.com/google/go-dap/schematypes.go +++ b/vendor/github.com/google/go-dap/schematypes.go @@ -12,12 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// DO NOT EDIT: This file is auto-generated. +// Code generated by "cmd/gentypes/gentypes.go"; DO NOT EDIT. // DAP spec: https://microsoft.github.io/debug-adapter-protocol/specification // See cmd/gentypes/README.md for additional details. package dap +import "encoding/json" + // Message is an interface that all DAP message types implement with pointer // receivers. It's not part of the protocol but is used to enforce static // typing in Go code and provide some common accessors. @@ -28,12 +30,45 @@ type Message interface { GetSeq() int } +// RequestMessage is an interface implemented by all Request-types. +type RequestMessage interface { + Message + // GetRequest provides access to the embedded Request. + GetRequest() *Request +} + +// ResponseMessage is an interface implemented by all Response-types. +type ResponseMessage interface { + Message + // GetResponse provides access to the embedded Response. + GetResponse() *Response +} + +// EventMessage is an interface implemented by all Event-types. +type EventMessage interface { + Message + // GetEvent provides access to the embedded Event. + GetEvent() *Event +} + +// LaunchAttachRequest is an interface implemented by +// LaunchRequest and AttachRequest as they contain shared +// implementation specific arguments that are not part of +// the specification. +type LaunchAttachRequest interface { + RequestMessage + // GetArguments provides access to the Arguments map. + GetArguments() json.RawMessage +} + // ProtocolMessage: Base class of requests, responses, and events. type ProtocolMessage struct { Seq int `json:"seq"` Type string `json:"type"` } +func (m *ProtocolMessage) GetSeq() int { return m.Seq } + // Request: A client or debug adapter initiated request. type Request struct { ProtocolMessage @@ -69,22 +104,31 @@ type ErrorResponseBody struct { Error ErrorMessage `json:"error,omitempty"` } -// CancelRequest: The 'cancel' request is used by the frontend to indicate that it is no longer interested in the result produced by a specific request issued earlier. +func (r *ErrorResponse) GetResponse() *Response { return &r.Response } + +// CancelRequest: The 'cancel' request is used by the frontend in two situations: +// - to indicate that it is no longer interested in the result produced by a specific request issued earlier +// - to cancel a progress sequence. Clients should only call this request if the capability 'supportsCancelRequest' is true. // This request has a hint characteristic: a debug adapter can only be expected to make a 'best effort' in honouring this request but there are no guarantees. // The 'cancel' request may return an error if it could not cancel an operation but a frontend should refrain from presenting this error to end users. // A frontend client should only call this request if the capability 'supportsCancelRequest' is true. -// The request that got canceled still needs to send a response back. -// This can either be a normal result ('success' attribute true) or an error response ('success' attribute false and the 'message' set to 'cancelled'). +// The request that got canceled still needs to send a response back. This can either be a normal result ('success' attribute true) +// or an error response ('success' attribute false and the 'message' set to 'cancelled'). // Returning partial results from a cancelled request is possible but please note that a frontend client has no generic way for detecting that a response is partial or not. +// The progress that got cancelled still needs to send a 'progressEnd' event back. +// A client should not assume that progress just got cancelled after sending the 'cancel' request. type CancelRequest struct { Request Arguments CancelArguments `json:"arguments,omitempty"` } +func (r *CancelRequest) GetRequest() *Request { return &r.Request } + // CancelArguments: Arguments for 'cancel' request. type CancelArguments struct { - RequestId int `json:"requestId,omitempty"` + RequestId int `json:"requestId,omitempty"` + ProgressId string `json:"progressId,omitempty"` } // CancelResponse: Response to 'cancel' request. This is just an acknowledgement, so no body field is required. @@ -92,12 +136,14 @@ type CancelResponse struct { Response } +func (r *CancelResponse) GetResponse() *Response { return &r.Response } + // InitializedEvent: This event indicates that the debug adapter is ready to accept configuration requests (e.g. SetBreakpointsRequest, SetExceptionBreakpointsRequest). // A debug adapter is expected to send this event when it is ready to accept configuration requests (but not before the 'initialize' request has finished). // The sequence of events/requests is as follows: // - adapters sends 'initialized' event (after the 'initialize' request has returned) // - frontend sends zero or more 'setBreakpoints' requests -// - frontend sends one 'setFunctionBreakpoints' request +// - frontend sends one 'setFunctionBreakpoints' request (if capability 'supportsFunctionBreakpoints' is true) // - frontend sends a 'setExceptionBreakpoints' request if one or more 'exceptionBreakpointFilters' have been defined (or if 'supportsConfigurationDoneRequest' is not defined or false) // - frontend sends other future configuration requests // - frontend sends one 'configurationDone' request to indicate the end of the configuration. @@ -105,8 +151,10 @@ type InitializedEvent struct { Event } +func (e *InitializedEvent) GetEvent() *Event { return &e.Event } + // StoppedEvent: The event indicates that the execution of the debuggee has stopped due to some condition. -// This can be caused by a break point previously set, a stepping action has completed, by executing a debugger statement etc. +// This can be caused by a break point previously set, a stepping request has completed, by executing a debugger statement etc. type StoppedEvent struct { Event @@ -120,8 +168,11 @@ type StoppedEventBody struct { PreserveFocusHint bool `json:"preserveFocusHint,omitempty"` Text string `json:"text,omitempty"` AllThreadsStopped bool `json:"allThreadsStopped,omitempty"` + HitBreakpointIds []int `json:"hitBreakpointIds,omitempty"` } +func (e *StoppedEvent) GetEvent() *Event { return &e.Event } + // ContinuedEvent: The event indicates that the execution of the debuggee has continued. // Please note: a debug adapter is not expected to send this event in response to a request that implies that execution continues, e.g. 'launch' or 'continue'. // It is only necessary to send a 'continued' event if there was no previous request that implied this. @@ -136,6 +187,8 @@ type ContinuedEventBody struct { AllThreadsContinued bool `json:"allThreadsContinued,omitempty"` } +func (e *ContinuedEvent) GetEvent() *Event { return &e.Event } + // ExitedEvent: The event indicates that the debuggee has exited and returns its exit code. type ExitedEvent struct { Event @@ -147,6 +200,8 @@ type ExitedEventBody struct { ExitCode int `json:"exitCode"` } +func (e *ExitedEvent) GetEvent() *Event { return &e.Event } + // TerminatedEvent: The event indicates that debugging of the debuggee has terminated. This does **not** mean that the debuggee itself has exited. type TerminatedEvent struct { Event @@ -158,6 +213,8 @@ type TerminatedEventBody struct { Restart interface{} `json:"restart,omitempty"` } +func (e *TerminatedEvent) GetEvent() *Event { return &e.Event } + // ThreadEvent: The event indicates that a thread has started or exited. type ThreadEvent struct { Event @@ -170,6 +227,8 @@ type ThreadEventBody struct { ThreadId int `json:"threadId"` } +func (e *ThreadEvent) GetEvent() *Event { return &e.Event } + // OutputEvent: The event indicates that the target has produced some output. type OutputEvent struct { Event @@ -180,6 +239,7 @@ type OutputEvent struct { type OutputEventBody struct { Category string `json:"category,omitempty"` Output string `json:"output"` + Group string `json:"group,omitempty"` VariablesReference int `json:"variablesReference,omitempty"` Source Source `json:"source,omitempty"` Line int `json:"line,omitempty"` @@ -187,6 +247,8 @@ type OutputEventBody struct { Data interface{} `json:"data,omitempty"` } +func (e *OutputEvent) GetEvent() *Event { return &e.Event } + // BreakpointEvent: The event indicates that some information about a breakpoint has changed. type BreakpointEvent struct { Event @@ -199,6 +261,8 @@ type BreakpointEventBody struct { Breakpoint Breakpoint `json:"breakpoint"` } +func (e *BreakpointEvent) GetEvent() *Event { return &e.Event } + // ModuleEvent: The event indicates that some information about a module has changed. type ModuleEvent struct { Event @@ -211,6 +275,8 @@ type ModuleEventBody struct { Module Module `json:"module"` } +func (e *ModuleEvent) GetEvent() *Event { return &e.Event } + // LoadedSourceEvent: The event indicates that some source has been added, changed, or removed from the set of all loaded sources. type LoadedSourceEvent struct { Event @@ -223,6 +289,8 @@ type LoadedSourceEventBody struct { Source Source `json:"source"` } +func (e *LoadedSourceEvent) GetEvent() *Event { return &e.Event } + // ProcessEvent: The event indicates that the debugger has begun debugging a new process. Either one that it has launched, or one that it has attached to. type ProcessEvent struct { Event @@ -238,6 +306,8 @@ type ProcessEventBody struct { PointerSize int `json:"pointerSize,omitempty"` } +func (e *ProcessEvent) GetEvent() *Event { return &e.Event } + // CapabilitiesEvent: The event indicates that one or more capabilities have changed. // Since the capabilities are dependent on the frontend and its UI, it might not be possible to change that at random times (or too late). // Consequently this event has a hint characteristic: a frontend can only be expected to make a 'best effort' in honouring individual capabilities but there are no guarantees. @@ -252,13 +322,106 @@ type CapabilitiesEventBody struct { Capabilities Capabilities `json:"capabilities"` } -// RunInTerminalRequest: This request is sent from the debug adapter to the client to run a command in a terminal. This is typically used to launch the debuggee in a terminal provided by the client. +func (e *CapabilitiesEvent) GetEvent() *Event { return &e.Event } + +// ProgressStartEvent: The event signals that a long running operation is about to start and +// provides additional information for the client to set up a corresponding progress and cancellation UI. +// The client is free to delay the showing of the UI in order to reduce flicker. +// This event should only be sent if the client has passed the value true for the 'supportsProgressReporting' capability of the 'initialize' request. +type ProgressStartEvent struct { + Event + + Body ProgressStartEventBody `json:"body"` +} + +type ProgressStartEventBody struct { + ProgressId string `json:"progressId"` + Title string `json:"title"` + RequestId int `json:"requestId,omitempty"` + Cancellable bool `json:"cancellable,omitempty"` + Message string `json:"message,omitempty"` + Percentage int `json:"percentage,omitempty"` +} + +func (e *ProgressStartEvent) GetEvent() *Event { return &e.Event } + +// ProgressUpdateEvent: The event signals that the progress reporting needs to updated with a new message and/or percentage. +// The client does not have to update the UI immediately, but the clients needs to keep track of the message and/or percentage values. +// This event should only be sent if the client has passed the value true for the 'supportsProgressReporting' capability of the 'initialize' request. +type ProgressUpdateEvent struct { + Event + + Body ProgressUpdateEventBody `json:"body"` +} + +type ProgressUpdateEventBody struct { + ProgressId string `json:"progressId"` + Message string `json:"message,omitempty"` + Percentage int `json:"percentage,omitempty"` +} + +func (e *ProgressUpdateEvent) GetEvent() *Event { return &e.Event } + +// ProgressEndEvent: The event signals the end of the progress reporting with an optional final message. +// This event should only be sent if the client has passed the value true for the 'supportsProgressReporting' capability of the 'initialize' request. +type ProgressEndEvent struct { + Event + + Body ProgressEndEventBody `json:"body"` +} + +type ProgressEndEventBody struct { + ProgressId string `json:"progressId"` + Message string `json:"message,omitempty"` +} + +func (e *ProgressEndEvent) GetEvent() *Event { return &e.Event } + +// InvalidatedEvent: This event signals that some state in the debug adapter has changed and requires that the client needs to re-render the data snapshot previously requested. +// Debug adapters do not have to emit this event for runtime changes like stopped or thread events because in that case the client refetches the new state anyway. But the event can be used for example to refresh the UI after rendering formatting has changed in the debug adapter. +// This event should only be sent if the debug adapter has received a value true for the 'supportsInvalidatedEvent' capability of the 'initialize' request. +type InvalidatedEvent struct { + Event + + Body InvalidatedEventBody `json:"body"` +} + +type InvalidatedEventBody struct { + Areas []InvalidatedAreas `json:"areas,omitempty"` + ThreadId int `json:"threadId,omitempty"` + StackFrameId int `json:"stackFrameId,omitempty"` +} + +func (e *InvalidatedEvent) GetEvent() *Event { return &e.Event } + +// MemoryEvent: This event indicates that some memory range has been updated. It should only be sent if the debug adapter has received a value true for the `supportsMemoryEvent` capability of the `initialize` request. +// Clients typically react to the event by re-issuing a `readMemory` request if they show the memory identified by the `memoryReference` and if the updated memory range overlaps the displayed range. Clients should not make assumptions how individual memory references relate to each other, so they should not assume that they are part of a single continuous address range and might overlap. +// Debug adapters can use this event to indicate that the contents of a memory range has changed due to some other DAP request like `setVariable` or `setExpression`. Debug adapters are not expected to emit this event for each and every memory change of a running program, because that information is typically not available from debuggers and it would flood clients with too many events. +type MemoryEvent struct { + Event + + Body MemoryEventBody `json:"body"` +} + +type MemoryEventBody struct { + MemoryReference string `json:"memoryReference"` + Offset int `json:"offset"` + Count int `json:"count"` +} + +func (e *MemoryEvent) GetEvent() *Event { return &e.Event } + +// RunInTerminalRequest: This optional request is sent from the debug adapter to the client to run a command in a terminal. +// This is typically used to launch the debuggee in a terminal provided by the client. +// This request should only be called if the client has passed the value true for the 'supportsRunInTerminalRequest' capability of the 'initialize' request. type RunInTerminalRequest struct { Request Arguments RunInTerminalRequestArguments `json:"arguments"` } +func (r *RunInTerminalRequest) GetRequest() *Request { return &r.Request } + // RunInTerminalRequestArguments: Arguments for 'runInTerminal' request. type RunInTerminalRequestArguments struct { Kind string `json:"kind,omitempty"` @@ -280,8 +443,12 @@ type RunInTerminalResponseBody struct { ShellProcessId int `json:"shellProcessId,omitempty"` } -// InitializeRequest: The 'initialize' request is sent as the first request from the client to the debug adapter in order to configure it with client capabilities and to retrieve capabilities from the debug adapter. -// Until the debug adapter has responded to with an 'initialize' response, the client must not send any additional requests or events to the debug adapter. In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an 'initialize' response. +func (r *RunInTerminalResponse) GetResponse() *Response { return &r.Response } + +// InitializeRequest: The 'initialize' request is sent as the first request from the client to the debug adapter +// in order to configure it with client capabilities and to retrieve capabilities from the debug adapter. +// Until the debug adapter has responded to with an 'initialize' response, the client must not send any additional requests or events to the debug adapter. +// In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an 'initialize' response. // The 'initialize' request may only be sent once. type InitializeRequest struct { Request @@ -289,19 +456,24 @@ type InitializeRequest struct { Arguments InitializeRequestArguments `json:"arguments"` } +func (r *InitializeRequest) GetRequest() *Request { return &r.Request } + // InitializeRequestArguments: Arguments for 'initialize' request. type InitializeRequestArguments struct { ClientID string `json:"clientID,omitempty"` ClientName string `json:"clientName,omitempty"` AdapterID string `json:"adapterID"` Locale string `json:"locale,omitempty"` - LinesStartAt1 bool `json:"linesStartAt1,omitempty"` - ColumnsStartAt1 bool `json:"columnsStartAt1,omitempty"` + LinesStartAt1 bool `json:"linesStartAt1"` + ColumnsStartAt1 bool `json:"columnsStartAt1"` PathFormat string `json:"pathFormat,omitempty"` SupportsVariableType bool `json:"supportsVariableType,omitempty"` SupportsVariablePaging bool `json:"supportsVariablePaging,omitempty"` SupportsRunInTerminalRequest bool `json:"supportsRunInTerminalRequest,omitempty"` SupportsMemoryReferences bool `json:"supportsMemoryReferences,omitempty"` + SupportsProgressReporting bool `json:"supportsProgressReporting,omitempty"` + SupportsInvalidatedEvent bool `json:"supportsInvalidatedEvent,omitempty"` + SupportsMemoryEvent bool `json:"supportsMemoryEvent,omitempty"` } // InitializeResponse: Response to 'initialize' request. @@ -311,13 +483,19 @@ type InitializeResponse struct { Body Capabilities `json:"body,omitempty"` } -// ConfigurationDoneRequest: The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the 'initialized' event). +func (r *InitializeResponse) GetResponse() *Response { return &r.Response } + +// ConfigurationDoneRequest: This optional request indicates that the client has finished initialization of the debug adapter. +// So it is the last request in the sequence of configuration requests (which was started by the 'initialized' event). +// Clients should only call this request if the capability 'supportsConfigurationDoneRequest' is true. type ConfigurationDoneRequest struct { Request Arguments ConfigurationDoneArguments `json:"arguments,omitempty"` } +func (r *ConfigurationDoneRequest) GetRequest() *Request { return &r.Request } + // ConfigurationDoneArguments: Arguments for 'configurationDone' request. type ConfigurationDoneArguments struct { } @@ -327,47 +505,57 @@ type ConfigurationDoneResponse struct { Response } -// LaunchRequest: The launch request is sent from the client to the debug adapter to start the debuggee with or without debugging (if 'noDebug' is true). Since launching is debugger/runtime specific, the arguments for this request are not part of this specification. +func (r *ConfigurationDoneResponse) GetResponse() *Response { return &r.Response } + +// LaunchRequest: This launch request is sent from the client to the debug adapter to start the debuggee with or without debugging (if 'noDebug' is true). +// Since launching is debugger/runtime specific, the arguments for this request are not part of this specification. type LaunchRequest struct { Request - Arguments map[string]interface{} `json:"arguments"` + Arguments json.RawMessage `json:"arguments"` } +func (r *LaunchRequest) GetRequest() *Request { return &r.Request } +func (r *LaunchRequest) GetArguments() json.RawMessage { return r.Arguments } + // LaunchResponse: Response to 'launch' request. This is just an acknowledgement, so no body field is required. type LaunchResponse struct { Response } -// AttachRequest: The attach request is sent from the client to the debug adapter to attach to a debuggee that is already running. Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification. +func (r *LaunchResponse) GetResponse() *Response { return &r.Response } + +// AttachRequest: The attach request is sent from the client to the debug adapter to attach to a debuggee that is already running. +// Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification. type AttachRequest struct { Request - Arguments AttachRequestArguments `json:"arguments"` + Arguments json.RawMessage `json:"arguments"` } -// AttachRequestArguments: Arguments for 'attach' request. Additional attributes are implementation specific. -type AttachRequestArguments struct { - Restart interface{} `json:"__restart,omitempty"` -} +func (r *AttachRequest) GetRequest() *Request { return &r.Request } +func (r *AttachRequest) GetArguments() json.RawMessage { return r.Arguments } // AttachResponse: Response to 'attach' request. This is just an acknowledgement, so no body field is required. type AttachResponse struct { Response } -// RestartRequest: Restarts a debug session. If the capability 'supportsRestartRequest' is missing or has the value false, -// the client will implement 'restart' by terminating the debug adapter first and then launching it anew. -// A debug adapter can override this default behaviour by implementing a restart request -// and setting the capability 'supportsRestartRequest' to true. +func (r *AttachResponse) GetResponse() *Response { return &r.Response } + +// RestartRequest: Restarts a debug session. Clients should only call this request if the capability 'supportsRestartRequest' is true. +// If the capability is missing or has the value false, a typical client will emulate 'restart' by terminating the debug adapter first and then launching it anew. type RestartRequest struct { Request Arguments RestartArguments `json:"arguments,omitempty"` } +func (r *RestartRequest) GetRequest() *Request { return &r.Request } + // RestartArguments: Arguments for 'restart' request. type RestartArguments struct { + Arguments interface{} `json:"arguments,omitempty"` } // RestartResponse: Response to 'restart' request. This is just an acknowledgement, so no body field is required. @@ -375,17 +563,26 @@ type RestartResponse struct { Response } -// DisconnectRequest: The 'disconnect' request is sent from the client to the debug adapter in order to stop debugging. It asks the debug adapter to disconnect from the debuggee and to terminate the debug adapter. If the debuggee has been started with the 'launch' request, the 'disconnect' request terminates the debuggee. If the 'attach' request was used to connect to the debuggee, 'disconnect' does not terminate the debuggee. This behavior can be controlled with the 'terminateDebuggee' argument (if supported by the debug adapter). +func (r *RestartResponse) GetResponse() *Response { return &r.Response } + +// DisconnectRequest: The 'disconnect' request is sent from the client to the debug adapter in order to stop debugging. +// It asks the debug adapter to disconnect from the debuggee and to terminate the debug adapter. +// If the debuggee has been started with the 'launch' request, the 'disconnect' request terminates the debuggee. +// If the 'attach' request was used to connect to the debuggee, 'disconnect' does not terminate the debuggee. +// This behavior can be controlled with the 'terminateDebuggee' argument (if supported by the debug adapter). type DisconnectRequest struct { Request Arguments DisconnectArguments `json:"arguments,omitempty"` } +func (r *DisconnectRequest) GetRequest() *Request { return &r.Request } + // DisconnectArguments: Arguments for 'disconnect' request. type DisconnectArguments struct { Restart bool `json:"restart,omitempty"` TerminateDebuggee bool `json:"terminateDebuggee,omitempty"` + SuspendDebuggee bool `json:"suspendDebuggee,omitempty"` } // DisconnectResponse: Response to 'disconnect' request. This is just an acknowledgement, so no body field is required. @@ -393,13 +590,18 @@ type DisconnectResponse struct { Response } +func (r *DisconnectResponse) GetResponse() *Response { return &r.Response } + // TerminateRequest: The 'terminate' request is sent from the client to the debug adapter in order to give the debuggee a chance for terminating itself. +// Clients should only call this request if the capability 'supportsTerminateRequest' is true. type TerminateRequest struct { Request Arguments TerminateArguments `json:"arguments,omitempty"` } +func (r *TerminateRequest) GetRequest() *Request { return &r.Request } + // TerminateArguments: Arguments for 'terminate' request. type TerminateArguments struct { Restart bool `json:"restart,omitempty"` @@ -410,13 +612,18 @@ type TerminateResponse struct { Response } +func (r *TerminateResponse) GetResponse() *Response { return &r.Response } + // BreakpointLocationsRequest: The 'breakpointLocations' request returns all possible locations for source breakpoints in a given range. +// Clients should only call this request if the capability 'supportsBreakpointLocationsRequest' is true. type BreakpointLocationsRequest struct { Request Arguments BreakpointLocationsArguments `json:"arguments,omitempty"` } +func (r *BreakpointLocationsRequest) GetRequest() *Request { return &r.Request } + // BreakpointLocationsArguments: Arguments for 'breakpointLocations' request. type BreakpointLocationsArguments struct { Source Source `json:"source"` @@ -438,6 +645,8 @@ type BreakpointLocationsResponseBody struct { Breakpoints []BreakpointLocation `json:"breakpoints"` } +func (r *BreakpointLocationsResponse) GetResponse() *Response { return &r.Response } + // SetBreakpointsRequest: Sets multiple breakpoints for a single source and clears all previous breakpoints in that source. // To clear all breakpoint for a source, specify an empty array. // When a breakpoint is hit, a 'stopped' event (with reason 'breakpoint') is generated. @@ -447,6 +656,8 @@ type SetBreakpointsRequest struct { Arguments SetBreakpointsArguments `json:"arguments"` } +func (r *SetBreakpointsRequest) GetRequest() *Request { return &r.Request } + // SetBreakpointsArguments: Arguments for 'setBreakpoints' request. type SetBreakpointsArguments struct { Source Source `json:"source"` @@ -470,15 +681,20 @@ type SetBreakpointsResponseBody struct { Breakpoints []Breakpoint `json:"breakpoints"` } +func (r *SetBreakpointsResponse) GetResponse() *Response { return &r.Response } + // SetFunctionBreakpointsRequest: Replaces all existing function breakpoints with new function breakpoints. // To clear all function breakpoints, specify an empty array. // When a function breakpoint is hit, a 'stopped' event (with reason 'function breakpoint') is generated. +// Clients should only call this request if the capability 'supportsFunctionBreakpoints' is true. type SetFunctionBreakpointsRequest struct { Request Arguments SetFunctionBreakpointsArguments `json:"arguments"` } +func (r *SetFunctionBreakpointsRequest) GetRequest() *Request { return &r.Request } + // SetFunctionBreakpointsArguments: Arguments for 'setFunctionBreakpoints' request. type SetFunctionBreakpointsArguments struct { Breakpoints []FunctionBreakpoint `json:"breakpoints"` @@ -496,31 +712,52 @@ type SetFunctionBreakpointsResponseBody struct { Breakpoints []Breakpoint `json:"breakpoints"` } -// SetExceptionBreakpointsRequest: The request configures the debuggers response to thrown exceptions. If an exception is configured to break, a 'stopped' event is fired (with reason 'exception'). +func (r *SetFunctionBreakpointsResponse) GetResponse() *Response { return &r.Response } + +// SetExceptionBreakpointsRequest: The request configures the debuggers response to thrown exceptions. +// If an exception is configured to break, a 'stopped' event is fired (with reason 'exception'). +// Clients should only call this request if the capability 'exceptionBreakpointFilters' returns one or more filters. type SetExceptionBreakpointsRequest struct { Request Arguments SetExceptionBreakpointsArguments `json:"arguments"` } +func (r *SetExceptionBreakpointsRequest) GetRequest() *Request { return &r.Request } + // SetExceptionBreakpointsArguments: Arguments for 'setExceptionBreakpoints' request. type SetExceptionBreakpointsArguments struct { - Filters []string `json:"filters"` - ExceptionOptions []ExceptionOptions `json:"exceptionOptions,omitempty"` + Filters []string `json:"filters"` + FilterOptions []ExceptionFilterOptions `json:"filterOptions,omitempty"` + ExceptionOptions []ExceptionOptions `json:"exceptionOptions,omitempty"` } -// SetExceptionBreakpointsResponse: Response to 'setExceptionBreakpoints' request. This is just an acknowledgement, so no body field is required. +// SetExceptionBreakpointsResponse: Response to 'setExceptionBreakpoints' request. +// The response contains an array of Breakpoint objects with information about each exception breakpoint or filter. The Breakpoint objects are in the same order as the elements of the 'filters', 'filterOptions', 'exceptionOptions' arrays given as arguments. If both 'filters' and 'filterOptions' are given, the returned array must start with 'filters' information first, followed by 'filterOptions' information. +// The mandatory 'verified' property of a Breakpoint object signals whether the exception breakpoint or filter could be successfully created and whether the optional condition or hit count expressions are valid. In case of an error the 'message' property explains the problem. An optional 'id' property can be used to introduce a unique ID for the exception breakpoint or filter so that it can be updated subsequently by sending breakpoint events. +// For backward compatibility both the 'breakpoints' array and the enclosing 'body' are optional. If these elements are missing a client will not be able to show problems for individual exception breakpoints or filters. type SetExceptionBreakpointsResponse struct { Response + + Body SetExceptionBreakpointsResponseBody `json:"body,omitempty"` } +type SetExceptionBreakpointsResponseBody struct { + Breakpoints []Breakpoint `json:"breakpoints,omitempty"` +} + +func (r *SetExceptionBreakpointsResponse) GetResponse() *Response { return &r.Response } + // DataBreakpointInfoRequest: Obtains information on a possible data breakpoint that could be set on an expression or variable. +// Clients should only call this request if the capability 'supportsDataBreakpoints' is true. type DataBreakpointInfoRequest struct { Request Arguments DataBreakpointInfoArguments `json:"arguments"` } +func (r *DataBreakpointInfoRequest) GetRequest() *Request { return &r.Request } + // DataBreakpointInfoArguments: Arguments for 'dataBreakpointInfo' request. type DataBreakpointInfoArguments struct { VariablesReference int `json:"variablesReference,omitempty"` @@ -541,15 +778,20 @@ type DataBreakpointInfoResponseBody struct { CanPersist bool `json:"canPersist,omitempty"` } +func (r *DataBreakpointInfoResponse) GetResponse() *Response { return &r.Response } + // SetDataBreakpointsRequest: Replaces all existing data breakpoints with new data breakpoints. // To clear all data breakpoints, specify an empty array. // When a data breakpoint is hit, a 'stopped' event (with reason 'data breakpoint') is generated. +// Clients should only call this request if the capability 'supportsDataBreakpoints' is true. type SetDataBreakpointsRequest struct { Request Arguments SetDataBreakpointsArguments `json:"arguments"` } +func (r *SetDataBreakpointsRequest) GetRequest() *Request { return &r.Request } + // SetDataBreakpointsArguments: Arguments for 'setDataBreakpoints' request. type SetDataBreakpointsArguments struct { Breakpoints []DataBreakpoint `json:"breakpoints"` @@ -567,6 +809,38 @@ type SetDataBreakpointsResponseBody struct { Breakpoints []Breakpoint `json:"breakpoints"` } +func (r *SetDataBreakpointsResponse) GetResponse() *Response { return &r.Response } + +// SetInstructionBreakpointsRequest: Replaces all existing instruction breakpoints. Typically, instruction breakpoints would be set from a diassembly window. +// To clear all instruction breakpoints, specify an empty array. +// When an instruction breakpoint is hit, a 'stopped' event (with reason 'instruction breakpoint') is generated. +// Clients should only call this request if the capability 'supportsInstructionBreakpoints' is true. +type SetInstructionBreakpointsRequest struct { + Request + + Arguments SetInstructionBreakpointsArguments `json:"arguments"` +} + +func (r *SetInstructionBreakpointsRequest) GetRequest() *Request { return &r.Request } + +// SetInstructionBreakpointsArguments: Arguments for 'setInstructionBreakpoints' request +type SetInstructionBreakpointsArguments struct { + Breakpoints []InstructionBreakpoint `json:"breakpoints"` +} + +// SetInstructionBreakpointsResponse: Response to 'setInstructionBreakpoints' request +type SetInstructionBreakpointsResponse struct { + Response + + Body SetInstructionBreakpointsResponseBody `json:"body"` +} + +type SetInstructionBreakpointsResponseBody struct { + Breakpoints []Breakpoint `json:"breakpoints"` +} + +func (r *SetInstructionBreakpointsResponse) GetResponse() *Response { return &r.Response } + // ContinueRequest: The request starts the debuggee to run again. type ContinueRequest struct { Request @@ -574,6 +848,8 @@ type ContinueRequest struct { Arguments ContinueArguments `json:"arguments"` } +func (r *ContinueRequest) GetRequest() *Request { return &r.Request } + // ContinueArguments: Arguments for 'continue' request. type ContinueArguments struct { ThreadId int `json:"threadId"` @@ -587,9 +863,11 @@ type ContinueResponse struct { } type ContinueResponseBody struct { - AllThreadsContinued bool `json:"allThreadsContinued,omitempty"` + AllThreadsContinued bool `json:"allThreadsContinued"` } +func (r *ContinueResponse) GetResponse() *Response { return &r.Response } + // NextRequest: The request starts the debuggee to run again for one step. // The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. type NextRequest struct { @@ -598,9 +876,12 @@ type NextRequest struct { Arguments NextArguments `json:"arguments"` } +func (r *NextRequest) GetRequest() *Request { return &r.Request } + // NextArguments: Arguments for 'next' request. type NextArguments struct { - ThreadId int `json:"threadId"` + ThreadId int `json:"threadId"` + Granularity SteppingGranularity `json:"granularity,omitempty"` } // NextResponse: Response to 'next' request. This is just an acknowledgement, so no body field is required. @@ -608,6 +889,8 @@ type NextResponse struct { Response } +func (r *NextResponse) GetResponse() *Response { return &r.Response } + // StepInRequest: The request starts the debuggee to step into a function/method if possible. // If it cannot step into a target, 'stepIn' behaves like 'next'. // The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. @@ -620,10 +903,13 @@ type StepInRequest struct { Arguments StepInArguments `json:"arguments"` } +func (r *StepInRequest) GetRequest() *Request { return &r.Request } + // StepInArguments: Arguments for 'stepIn' request. type StepInArguments struct { - ThreadId int `json:"threadId"` - TargetId int `json:"targetId,omitempty"` + ThreadId int `json:"threadId"` + TargetId int `json:"targetId,omitempty"` + Granularity SteppingGranularity `json:"granularity,omitempty"` } // StepInResponse: Response to 'stepIn' request. This is just an acknowledgement, so no body field is required. @@ -631,6 +917,8 @@ type StepInResponse struct { Response } +func (r *StepInResponse) GetResponse() *Response { return &r.Response } + // StepOutRequest: The request starts the debuggee to run again for one step. // The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. type StepOutRequest struct { @@ -639,9 +927,12 @@ type StepOutRequest struct { Arguments StepOutArguments `json:"arguments"` } +func (r *StepOutRequest) GetRequest() *Request { return &r.Request } + // StepOutArguments: Arguments for 'stepOut' request. type StepOutArguments struct { - ThreadId int `json:"threadId"` + ThreadId int `json:"threadId"` + Granularity SteppingGranularity `json:"granularity,omitempty"` } // StepOutResponse: Response to 'stepOut' request. This is just an acknowledgement, so no body field is required. @@ -649,17 +940,23 @@ type StepOutResponse struct { Response } +func (r *StepOutResponse) GetResponse() *Response { return &r.Response } + // StepBackRequest: The request starts the debuggee to run one step backwards. -// The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. Clients should only call this request if the capability 'supportsStepBack' is true. +// The debug adapter first sends the response and then a 'stopped' event (with reason 'step') after the step has completed. +// Clients should only call this request if the capability 'supportsStepBack' is true. type StepBackRequest struct { Request Arguments StepBackArguments `json:"arguments"` } +func (r *StepBackRequest) GetRequest() *Request { return &r.Request } + // StepBackArguments: Arguments for 'stepBack' request. type StepBackArguments struct { - ThreadId int `json:"threadId"` + ThreadId int `json:"threadId"` + Granularity SteppingGranularity `json:"granularity,omitempty"` } // StepBackResponse: Response to 'stepBack' request. This is just an acknowledgement, so no body field is required. @@ -667,13 +964,18 @@ type StepBackResponse struct { Response } -// ReverseContinueRequest: The request starts the debuggee to run backward. Clients should only call this request if the capability 'supportsStepBack' is true. +func (r *StepBackResponse) GetResponse() *Response { return &r.Response } + +// ReverseContinueRequest: The request starts the debuggee to run backward. +// Clients should only call this request if the capability 'supportsStepBack' is true. type ReverseContinueRequest struct { Request Arguments ReverseContinueArguments `json:"arguments"` } +func (r *ReverseContinueRequest) GetRequest() *Request { return &r.Request } + // ReverseContinueArguments: Arguments for 'reverseContinue' request. type ReverseContinueArguments struct { ThreadId int `json:"threadId"` @@ -684,14 +986,19 @@ type ReverseContinueResponse struct { Response } +func (r *ReverseContinueResponse) GetResponse() *Response { return &r.Response } + // RestartFrameRequest: The request restarts execution of the specified stackframe. // The debug adapter first sends the response and then a 'stopped' event (with reason 'restart') after the restart has completed. +// Clients should only call this request if the capability 'supportsRestartFrame' is true. type RestartFrameRequest struct { Request Arguments RestartFrameArguments `json:"arguments"` } +func (r *RestartFrameRequest) GetRequest() *Request { return &r.Request } + // RestartFrameArguments: Arguments for 'restartFrame' request. type RestartFrameArguments struct { FrameId int `json:"frameId"` @@ -702,16 +1009,21 @@ type RestartFrameResponse struct { Response } +func (r *RestartFrameResponse) GetResponse() *Response { return &r.Response } + // GotoRequest: The request sets the location where the debuggee will continue to run. // This makes it possible to skip the execution of code or to executed code again. // The code between the current location and the goto target is not executed but skipped. // The debug adapter first sends the response and then a 'stopped' event with reason 'goto'. +// Clients should only call this request if the capability 'supportsGotoTargetsRequest' is true (because only then goto targets exist that can be passed as arguments). type GotoRequest struct { Request Arguments GotoArguments `json:"arguments"` } +func (r *GotoRequest) GetRequest() *Request { return &r.Request } + // GotoArguments: Arguments for 'goto' request. type GotoArguments struct { ThreadId int `json:"threadId"` @@ -723,6 +1035,8 @@ type GotoResponse struct { Response } +func (r *GotoResponse) GetResponse() *Response { return &r.Response } + // PauseRequest: The request suspends the debuggee. // The debug adapter first sends the response and then a 'stopped' event (with reason 'pause') after the thread has been paused successfully. type PauseRequest struct { @@ -731,6 +1045,8 @@ type PauseRequest struct { Arguments PauseArguments `json:"arguments"` } +func (r *PauseRequest) GetRequest() *Request { return &r.Request } + // PauseArguments: Arguments for 'pause' request. type PauseArguments struct { ThreadId int `json:"threadId"` @@ -741,13 +1057,18 @@ type PauseResponse struct { Response } -// StackTraceRequest: The request returns a stacktrace from the current execution state. +func (r *PauseResponse) GetResponse() *Response { return &r.Response } + +// StackTraceRequest: The request returns a stacktrace from the current execution state of a given thread. +// A client can request all stack frames by omitting the startFrame and levels arguments. For performance conscious clients and if the debug adapter's 'supportsDelayedStackTraceLoading' capability is true, stack frames can be retrieved in a piecemeal way with the startFrame and levels arguments. The response of the stackTrace request may contain a totalFrames property that hints at the total number of frames in the stack. If a client needs this total number upfront, it can issue a request for a single (first) frame and depending on the value of totalFrames decide how to proceed. In any case a client should be prepared to receive less frames than requested, which is an indication that the end of the stack has been reached. type StackTraceRequest struct { Request Arguments StackTraceArguments `json:"arguments"` } +func (r *StackTraceRequest) GetRequest() *Request { return &r.Request } + // StackTraceArguments: Arguments for 'stackTrace' request. type StackTraceArguments struct { ThreadId int `json:"threadId"` @@ -768,6 +1089,8 @@ type StackTraceResponseBody struct { TotalFrames int `json:"totalFrames,omitempty"` } +func (r *StackTraceResponse) GetResponse() *Response { return &r.Response } + // ScopesRequest: The request returns the variable scopes for a given stackframe ID. type ScopesRequest struct { Request @@ -775,6 +1098,8 @@ type ScopesRequest struct { Arguments ScopesArguments `json:"arguments"` } +func (r *ScopesRequest) GetRequest() *Request { return &r.Request } + // ScopesArguments: Arguments for 'scopes' request. type ScopesArguments struct { FrameId int `json:"frameId"` @@ -791,6 +1116,8 @@ type ScopesResponseBody struct { Scopes []Scope `json:"scopes"` } +func (r *ScopesResponse) GetResponse() *Response { return &r.Response } + // VariablesRequest: Retrieves all child variables for the given variable reference. // An optional filter can be used to limit the fetched children to either named or indexed children. type VariablesRequest struct { @@ -799,6 +1126,8 @@ type VariablesRequest struct { Arguments VariablesArguments `json:"arguments"` } +func (r *VariablesRequest) GetRequest() *Request { return &r.Request } + // VariablesArguments: Arguments for 'variables' request. type VariablesArguments struct { VariablesReference int `json:"variablesReference"` @@ -819,13 +1148,18 @@ type VariablesResponseBody struct { Variables []Variable `json:"variables"` } -// SetVariableRequest: Set the variable with the given name in the variable container to a new value. +func (r *VariablesResponse) GetResponse() *Response { return &r.Response } + +// SetVariableRequest: Set the variable with the given name in the variable container to a new value. Clients should only call this request if the capability 'supportsSetVariable' is true. +// If a debug adapter implements both setVariable and setExpression, a client will only use setExpression if the variable has an evaluateName property. type SetVariableRequest struct { Request Arguments SetVariableArguments `json:"arguments"` } +func (r *SetVariableRequest) GetRequest() *Request { return &r.Request } + // SetVariableArguments: Arguments for 'setVariable' request. type SetVariableArguments struct { VariablesReference int `json:"variablesReference"` @@ -849,6 +1183,8 @@ type SetVariableResponseBody struct { IndexedVariables int `json:"indexedVariables,omitempty"` } +func (r *SetVariableResponse) GetResponse() *Response { return &r.Response } + // SourceRequest: The request retrieves the source code for a given source reference. type SourceRequest struct { Request @@ -856,6 +1192,8 @@ type SourceRequest struct { Arguments SourceArguments `json:"arguments"` } +func (r *SourceRequest) GetRequest() *Request { return &r.Request } + // SourceArguments: Arguments for 'source' request. type SourceArguments struct { Source Source `json:"source,omitempty"` @@ -874,11 +1212,15 @@ type SourceResponseBody struct { MimeType string `json:"mimeType,omitempty"` } +func (r *SourceResponse) GetResponse() *Response { return &r.Response } + // ThreadsRequest: The request retrieves a list of all threads. type ThreadsRequest struct { Request } +func (r *ThreadsRequest) GetRequest() *Request { return &r.Request } + // ThreadsResponse: Response to 'threads' request. type ThreadsResponse struct { Response @@ -890,13 +1232,18 @@ type ThreadsResponseBody struct { Threads []Thread `json:"threads"` } +func (r *ThreadsResponse) GetResponse() *Response { return &r.Response } + // TerminateThreadsRequest: The request terminates the threads with the given ids. +// Clients should only call this request if the capability 'supportsTerminateThreadsRequest' is true. type TerminateThreadsRequest struct { Request Arguments TerminateThreadsArguments `json:"arguments"` } +func (r *TerminateThreadsRequest) GetRequest() *Request { return &r.Request } + // TerminateThreadsArguments: Arguments for 'terminateThreads' request. type TerminateThreadsArguments struct { ThreadIds []int `json:"threadIds,omitempty"` @@ -907,13 +1254,18 @@ type TerminateThreadsResponse struct { Response } -// ModulesRequest: Modules can be retrieved from the debug adapter with the ModulesRequest which can either return all modules or a range of modules to support paging. +func (r *TerminateThreadsResponse) GetResponse() *Response { return &r.Response } + +// ModulesRequest: Modules can be retrieved from the debug adapter with this request which can either return all modules or a range of modules to support paging. +// Clients should only call this request if the capability 'supportsModulesRequest' is true. type ModulesRequest struct { Request Arguments ModulesArguments `json:"arguments"` } +func (r *ModulesRequest) GetRequest() *Request { return &r.Request } + // ModulesArguments: Arguments for 'modules' request. type ModulesArguments struct { StartModule int `json:"startModule,omitempty"` @@ -932,13 +1284,18 @@ type ModulesResponseBody struct { TotalModules int `json:"totalModules,omitempty"` } +func (r *ModulesResponse) GetResponse() *Response { return &r.Response } + // LoadedSourcesRequest: Retrieves the set of all sources currently loaded by the debugged process. +// Clients should only call this request if the capability 'supportsLoadedSourcesRequest' is true. type LoadedSourcesRequest struct { Request Arguments LoadedSourcesArguments `json:"arguments,omitempty"` } +func (r *LoadedSourcesRequest) GetRequest() *Request { return &r.Request } + // LoadedSourcesArguments: Arguments for 'loadedSources' request. type LoadedSourcesArguments struct { } @@ -954,6 +1311,8 @@ type LoadedSourcesResponseBody struct { Sources []Source `json:"sources"` } +func (r *LoadedSourcesResponse) GetResponse() *Response { return &r.Response } + // EvaluateRequest: Evaluates the given expression in the context of the top most stack frame. // The expression has access to any variables and arguments that are in scope. type EvaluateRequest struct { @@ -962,6 +1321,8 @@ type EvaluateRequest struct { Arguments EvaluateArguments `json:"arguments"` } +func (r *EvaluateRequest) GetRequest() *Request { return &r.Request } + // EvaluateArguments: Arguments for 'evaluate' request. type EvaluateArguments struct { Expression string `json:"expression"` @@ -987,14 +1348,20 @@ type EvaluateResponseBody struct { MemoryReference string `json:"memoryReference,omitempty"` } +func (r *EvaluateResponse) GetResponse() *Response { return &r.Response } + // SetExpressionRequest: Evaluates the given 'value' expression and assigns it to the 'expression' which must be a modifiable l-value. // The expressions have access to any variables and arguments that are in scope of the specified frame. +// Clients should only call this request if the capability 'supportsSetExpression' is true. +// If a debug adapter implements both setExpression and setVariable, a client will only use setExpression if the variable has an evaluateName property. type SetExpressionRequest struct { Request Arguments SetExpressionArguments `json:"arguments"` } +func (r *SetExpressionRequest) GetRequest() *Request { return &r.Request } + // SetExpressionArguments: Arguments for 'setExpression' request. type SetExpressionArguments struct { Expression string `json:"expression"` @@ -1019,15 +1386,20 @@ type SetExpressionResponseBody struct { IndexedVariables int `json:"indexedVariables,omitempty"` } +func (r *SetExpressionResponse) GetResponse() *Response { return &r.Response } + // StepInTargetsRequest: This request retrieves the possible stepIn targets for the specified stack frame. // These targets can be used in the 'stepIn' request. // The StepInTargets may only be called if the 'supportsStepInTargetsRequest' capability exists and is true. +// Clients should only call this request if the capability 'supportsStepInTargetsRequest' is true. type StepInTargetsRequest struct { Request Arguments StepInTargetsArguments `json:"arguments"` } +func (r *StepInTargetsRequest) GetRequest() *Request { return &r.Request } + // StepInTargetsArguments: Arguments for 'stepInTargets' request. type StepInTargetsArguments struct { FrameId int `json:"frameId"` @@ -1044,15 +1416,19 @@ type StepInTargetsResponseBody struct { Targets []StepInTarget `json:"targets"` } +func (r *StepInTargetsResponse) GetResponse() *Response { return &r.Response } + // GotoTargetsRequest: This request retrieves the possible goto targets for the specified source location. // These targets can be used in the 'goto' request. -// The GotoTargets request may only be called if the 'supportsGotoTargetsRequest' capability exists and is true. +// Clients should only call this request if the capability 'supportsGotoTargetsRequest' is true. type GotoTargetsRequest struct { Request Arguments GotoTargetsArguments `json:"arguments"` } +func (r *GotoTargetsRequest) GetRequest() *Request { return &r.Request } + // GotoTargetsArguments: Arguments for 'gotoTargets' request. type GotoTargetsArguments struct { Source Source `json:"source"` @@ -1071,14 +1447,18 @@ type GotoTargetsResponseBody struct { Targets []GotoTarget `json:"targets"` } +func (r *GotoTargetsResponse) GetResponse() *Response { return &r.Response } + // CompletionsRequest: Returns a list of possible completions for a given caret position and text. -// The CompletionsRequest may only be called if the 'supportsCompletionsRequest' capability exists and is true. +// Clients should only call this request if the capability 'supportsCompletionsRequest' is true. type CompletionsRequest struct { Request Arguments CompletionsArguments `json:"arguments"` } +func (r *CompletionsRequest) GetRequest() *Request { return &r.Request } + // CompletionsArguments: Arguments for 'completions' request. type CompletionsArguments struct { FrameId int `json:"frameId,omitempty"` @@ -1098,13 +1478,18 @@ type CompletionsResponseBody struct { Targets []CompletionItem `json:"targets"` } +func (r *CompletionsResponse) GetResponse() *Response { return &r.Response } + // ExceptionInfoRequest: Retrieves the details of the exception that caused this event to be raised. +// Clients should only call this request if the capability 'supportsExceptionInfoRequest' is true. type ExceptionInfoRequest struct { Request Arguments ExceptionInfoArguments `json:"arguments"` } +func (r *ExceptionInfoRequest) GetRequest() *Request { return &r.Request } + // ExceptionInfoArguments: Arguments for 'exceptionInfo' request. type ExceptionInfoArguments struct { ThreadId int `json:"threadId"` @@ -1124,13 +1509,18 @@ type ExceptionInfoResponseBody struct { Details ExceptionDetails `json:"details,omitempty"` } +func (r *ExceptionInfoResponse) GetResponse() *Response { return &r.Response } + // ReadMemoryRequest: Reads bytes from memory at the provided location. +// Clients should only call this request if the capability 'supportsReadMemoryRequest' is true. type ReadMemoryRequest struct { Request Arguments ReadMemoryArguments `json:"arguments"` } +func (r *ReadMemoryRequest) GetRequest() *Request { return &r.Request } + // ReadMemoryArguments: Arguments for 'readMemory' request. type ReadMemoryArguments struct { MemoryReference string `json:"memoryReference"` @@ -1151,13 +1541,50 @@ type ReadMemoryResponseBody struct { Data string `json:"data,omitempty"` } +func (r *ReadMemoryResponse) GetResponse() *Response { return &r.Response } + +// WriteMemoryRequest: Writes bytes to memory at the provided location. +// Clients should only call this request if the capability 'supportsWriteMemoryRequest' is true. +type WriteMemoryRequest struct { + Request + + Arguments WriteMemoryArguments `json:"arguments"` +} + +func (r *WriteMemoryRequest) GetRequest() *Request { return &r.Request } + +// WriteMemoryArguments: Arguments for 'writeMemory' request. +type WriteMemoryArguments struct { + MemoryReference string `json:"memoryReference"` + Offset int `json:"offset,omitempty"` + AllowPartial bool `json:"allowPartial,omitempty"` + Data string `json:"data"` +} + +// WriteMemoryResponse: Response to 'writeMemory' request. +type WriteMemoryResponse struct { + Response + + Body WriteMemoryResponseBody `json:"body,omitempty"` +} + +type WriteMemoryResponseBody struct { + Offset int `json:"offset,omitempty"` + BytesWritten int `json:"bytesWritten,omitempty"` +} + +func (r *WriteMemoryResponse) GetResponse() *Response { return &r.Response } + // DisassembleRequest: Disassembles code stored at the provided location. +// Clients should only call this request if the capability 'supportsDisassembleRequest' is true. type DisassembleRequest struct { Request Arguments DisassembleArguments `json:"arguments"` } +func (r *DisassembleRequest) GetRequest() *Request { return &r.Request } + // DisassembleArguments: Arguments for 'disassemble' request. type DisassembleArguments struct { MemoryReference string `json:"memoryReference"` @@ -1178,6 +1605,8 @@ type DisassembleResponseBody struct { Instructions []DisassembledInstruction `json:"instructions"` } +func (r *DisassembleResponse) GetResponse() *Response { return &r.Response } + // Capabilities: Information about the capabilities of a debug adapter. type Capabilities struct { SupportsConfigurationDoneRequest bool `json:"supportsConfigurationDoneRequest,omitempty"` @@ -1201,6 +1630,7 @@ type Capabilities struct { SupportsValueFormattingOptions bool `json:"supportsValueFormattingOptions,omitempty"` SupportsExceptionInfoRequest bool `json:"supportsExceptionInfoRequest,omitempty"` SupportTerminateDebuggee bool `json:"supportTerminateDebuggee,omitempty"` + SupportSuspendDebuggee bool `json:"supportSuspendDebuggee,omitempty"` SupportsDelayedStackTraceLoading bool `json:"supportsDelayedStackTraceLoading,omitempty"` SupportsLoadedSourcesRequest bool `json:"supportsLoadedSourcesRequest,omitempty"` SupportsLogPoints bool `json:"supportsLogPoints,omitempty"` @@ -1209,16 +1639,24 @@ type Capabilities struct { SupportsTerminateRequest bool `json:"supportsTerminateRequest,omitempty"` SupportsDataBreakpoints bool `json:"supportsDataBreakpoints,omitempty"` SupportsReadMemoryRequest bool `json:"supportsReadMemoryRequest,omitempty"` + SupportsWriteMemoryRequest bool `json:"supportsWriteMemoryRequest,omitempty"` SupportsDisassembleRequest bool `json:"supportsDisassembleRequest,omitempty"` SupportsCancelRequest bool `json:"supportsCancelRequest,omitempty"` SupportsBreakpointLocationsRequest bool `json:"supportsBreakpointLocationsRequest,omitempty"` + SupportsClipboardContext bool `json:"supportsClipboardContext,omitempty"` + SupportsSteppingGranularity bool `json:"supportsSteppingGranularity,omitempty"` + SupportsInstructionBreakpoints bool `json:"supportsInstructionBreakpoints,omitempty"` + SupportsExceptionFilterOptions bool `json:"supportsExceptionFilterOptions,omitempty"` } -// ExceptionBreakpointsFilter: An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. +// ExceptionBreakpointsFilter: An ExceptionBreakpointsFilter is shown in the UI as an filter option for configuring how exceptions are dealt with. type ExceptionBreakpointsFilter struct { - Filter string `json:"filter"` - Label string `json:"label"` - Default bool `json:"default,omitempty"` + Filter string `json:"filter"` + Label string `json:"label"` + Description string `json:"description,omitempty"` + Default bool `json:"default,omitempty"` + SupportsCondition bool `json:"supportsCondition,omitempty"` + ConditionDescription string `json:"conditionDescription,omitempty"` } // ErrorMessage: A structured message object. Used to return errors from requests. @@ -1227,7 +1665,7 @@ type ErrorMessage struct { Format string `json:"format"` Variables map[string]string `json:"variables,omitempty"` SendTelemetry bool `json:"sendTelemetry,omitempty"` - ShowUser bool `json:"showUser,omitempty"` + ShowUser bool `json:"showUser"` Url string `json:"url,omitempty"` UrlLabel string `json:"urlLabel,omitempty"` } @@ -1253,7 +1691,8 @@ type Module struct { AddressRange string `json:"addressRange,omitempty"` } -// ColumnDescriptor: A ColumnDescriptor specifies what module attribute to show in a column of the ModulesView, how to format it, and what the column's label should be. +// ColumnDescriptor: A ColumnDescriptor specifies what module attribute to show in a column of the ModulesView, how to format it, +// and what the column's label should be. // It is only used if the underlying UI actually supports this level of customization. type ColumnDescriptor struct { AttributeName string `json:"attributeName"` @@ -1275,7 +1714,8 @@ type Thread struct { Name string `json:"name"` } -// Source: A Source is a descriptor for source code. It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. +// Source: A Source is a descriptor for source code. +// It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. type Source struct { Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` @@ -1296,6 +1736,7 @@ type StackFrame struct { Column int `json:"column"` EndLine int `json:"endLine,omitempty"` EndColumn int `json:"endColumn,omitempty"` + CanRestart bool `json:"canRestart,omitempty"` InstructionPointerReference string `json:"instructionPointerReference,omitempty"` ModuleId interface{} `json:"moduleId,omitempty"` PresentationHint string `json:"presentationHint,omitempty"` @@ -1376,18 +1817,31 @@ type DataBreakpoint struct { HitCondition string `json:"hitCondition,omitempty"` } -// Breakpoint: Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints. +// InstructionBreakpoint: Properties of a breakpoint passed to the setInstructionBreakpoints request +type InstructionBreakpoint struct { + InstructionReference string `json:"instructionReference"` + Offset int `json:"offset,omitempty"` + Condition string `json:"condition,omitempty"` + HitCondition string `json:"hitCondition,omitempty"` +} + +// Breakpoint: Information about a Breakpoint created in setBreakpoints, setFunctionBreakpoints, setInstructionBreakpoints, or setDataBreakpoints. type Breakpoint struct { - Id int `json:"id,omitempty"` - Verified bool `json:"verified"` - Message string `json:"message,omitempty"` - Source Source `json:"source,omitempty"` - Line int `json:"line,omitempty"` - Column int `json:"column,omitempty"` - EndLine int `json:"endLine,omitempty"` - EndColumn int `json:"endColumn,omitempty"` + Id int `json:"id,omitempty"` + Verified bool `json:"verified"` + Message string `json:"message,omitempty"` + Source Source `json:"source,omitempty"` + Line int `json:"line,omitempty"` + Column int `json:"column,omitempty"` + EndLine int `json:"endLine,omitempty"` + EndColumn int `json:"endColumn,omitempty"` + InstructionReference string `json:"instructionReference,omitempty"` + Offset int `json:"offset,omitempty"` } +// SteppingGranularity: The granularity of one 'step' in the stepping requests 'next', 'stepIn', 'stepOut', and 'stepBack'. +type SteppingGranularity string + // StepInTarget: A StepInTarget can be used in the 'stepIn' request and determines into which single target the stepIn request should step. type StepInTarget struct { Id int `json:"id"` @@ -1408,12 +1862,14 @@ type GotoTarget struct { // CompletionItem: CompletionItems are the suggestions returned from the CompletionsRequest. type CompletionItem struct { - Label string `json:"label"` - Text string `json:"text,omitempty"` - SortText string `json:"sortText,omitempty"` - Type CompletionItemType `json:"type,omitempty"` - Start int `json:"start,omitempty"` - Length int `json:"length,omitempty"` + Label string `json:"label"` + Text string `json:"text,omitempty"` + SortText string `json:"sortText,omitempty"` + Type CompletionItemType `json:"type,omitempty"` + Start int `json:"start,omitempty"` + Length int `json:"length,omitempty"` + SelectionStart int `json:"selectionStart,omitempty"` + SelectionLength int `json:"selectionLength,omitempty"` } // CompletionItemType: Some predefined types for the CompletionItem. Please note that not all clients have specific icons for all of them. @@ -1446,6 +1902,12 @@ type StackFrameFormat struct { IncludeAll bool `json:"includeAll,omitempty"` } +// ExceptionFilterOptions: An ExceptionFilterOptions is used to specify an exception filter together with a condition for the setExceptionsFilter request. +type ExceptionFilterOptions struct { + FilterId string `json:"filterId"` + Condition string `json:"condition,omitempty"` +} + // ExceptionOptions: An ExceptionOptions assigns configuration options to a set of exceptions. type ExceptionOptions struct { Path []ExceptionPathSegment `json:"path,omitempty"` @@ -1459,7 +1921,9 @@ type ExceptionOptions struct { // userUnhandled: breaks if the exception is not handled by user code. type ExceptionBreakMode string -// ExceptionPathSegment: An ExceptionPathSegment represents a segment in a path that is used to match leafs or nodes in a tree of exceptions. If a segment consists of more than one name, it matches the names provided if 'negate' is false or missing or it matches anything except the names provided if 'negate' is true. +// ExceptionPathSegment: An ExceptionPathSegment represents a segment in a path that is used to match leafs or nodes in a tree of exceptions. +// If a segment consists of more than one name, it matches the names provided if 'negate' is false or missing or +// it matches anything except the names provided if 'negate' is true. type ExceptionPathSegment struct { Negate bool `json:"negate,omitempty"` Names []string `json:"names"` @@ -1488,101 +1952,132 @@ type DisassembledInstruction struct { EndColumn int `json:"endColumn,omitempty"` } -func (m *Request) GetSeq() int { return m.Seq } -func (m *Event) GetSeq() int { return m.Seq } -func (m *Response) GetSeq() int { return m.Seq } -func (m *ErrorResponse) GetSeq() int { return m.Seq } -func (m *CancelRequest) GetSeq() int { return m.Seq } -func (m *CancelResponse) GetSeq() int { return m.Seq } -func (m *InitializedEvent) GetSeq() int { return m.Seq } -func (m *StoppedEvent) GetSeq() int { return m.Seq } -func (m *ContinuedEvent) GetSeq() int { return m.Seq } -func (m *ExitedEvent) GetSeq() int { return m.Seq } -func (m *TerminatedEvent) GetSeq() int { return m.Seq } -func (m *ThreadEvent) GetSeq() int { return m.Seq } -func (m *OutputEvent) GetSeq() int { return m.Seq } -func (m *BreakpointEvent) GetSeq() int { return m.Seq } -func (m *ModuleEvent) GetSeq() int { return m.Seq } -func (m *LoadedSourceEvent) GetSeq() int { return m.Seq } -func (m *ProcessEvent) GetSeq() int { return m.Seq } -func (m *CapabilitiesEvent) GetSeq() int { return m.Seq } -func (m *RunInTerminalRequest) GetSeq() int { return m.Seq } -func (m *RunInTerminalResponse) GetSeq() int { return m.Seq } -func (m *InitializeRequest) GetSeq() int { return m.Seq } -func (m *InitializeResponse) GetSeq() int { return m.Seq } -func (m *ConfigurationDoneRequest) GetSeq() int { return m.Seq } -func (m *ConfigurationDoneResponse) GetSeq() int { return m.Seq } -func (m *LaunchRequest) GetSeq() int { return m.Seq } -func (m *LaunchResponse) GetSeq() int { return m.Seq } -func (m *AttachRequest) GetSeq() int { return m.Seq } -func (m *AttachResponse) GetSeq() int { return m.Seq } -func (m *RestartRequest) GetSeq() int { return m.Seq } -func (m *RestartResponse) GetSeq() int { return m.Seq } -func (m *DisconnectRequest) GetSeq() int { return m.Seq } -func (m *DisconnectResponse) GetSeq() int { return m.Seq } -func (m *TerminateRequest) GetSeq() int { return m.Seq } -func (m *TerminateResponse) GetSeq() int { return m.Seq } -func (m *BreakpointLocationsRequest) GetSeq() int { return m.Seq } -func (m *BreakpointLocationsResponse) GetSeq() int { return m.Seq } -func (m *SetBreakpointsRequest) GetSeq() int { return m.Seq } -func (m *SetBreakpointsResponse) GetSeq() int { return m.Seq } -func (m *SetFunctionBreakpointsRequest) GetSeq() int { return m.Seq } -func (m *SetFunctionBreakpointsResponse) GetSeq() int { return m.Seq } -func (m *SetExceptionBreakpointsRequest) GetSeq() int { return m.Seq } -func (m *SetExceptionBreakpointsResponse) GetSeq() int { return m.Seq } -func (m *DataBreakpointInfoRequest) GetSeq() int { return m.Seq } -func (m *DataBreakpointInfoResponse) GetSeq() int { return m.Seq } -func (m *SetDataBreakpointsRequest) GetSeq() int { return m.Seq } -func (m *SetDataBreakpointsResponse) GetSeq() int { return m.Seq } -func (m *ContinueRequest) GetSeq() int { return m.Seq } -func (m *ContinueResponse) GetSeq() int { return m.Seq } -func (m *NextRequest) GetSeq() int { return m.Seq } -func (m *NextResponse) GetSeq() int { return m.Seq } -func (m *StepInRequest) GetSeq() int { return m.Seq } -func (m *StepInResponse) GetSeq() int { return m.Seq } -func (m *StepOutRequest) GetSeq() int { return m.Seq } -func (m *StepOutResponse) GetSeq() int { return m.Seq } -func (m *StepBackRequest) GetSeq() int { return m.Seq } -func (m *StepBackResponse) GetSeq() int { return m.Seq } -func (m *ReverseContinueRequest) GetSeq() int { return m.Seq } -func (m *ReverseContinueResponse) GetSeq() int { return m.Seq } -func (m *RestartFrameRequest) GetSeq() int { return m.Seq } -func (m *RestartFrameResponse) GetSeq() int { return m.Seq } -func (m *GotoRequest) GetSeq() int { return m.Seq } -func (m *GotoResponse) GetSeq() int { return m.Seq } -func (m *PauseRequest) GetSeq() int { return m.Seq } -func (m *PauseResponse) GetSeq() int { return m.Seq } -func (m *StackTraceRequest) GetSeq() int { return m.Seq } -func (m *StackTraceResponse) GetSeq() int { return m.Seq } -func (m *ScopesRequest) GetSeq() int { return m.Seq } -func (m *ScopesResponse) GetSeq() int { return m.Seq } -func (m *VariablesRequest) GetSeq() int { return m.Seq } -func (m *VariablesResponse) GetSeq() int { return m.Seq } -func (m *SetVariableRequest) GetSeq() int { return m.Seq } -func (m *SetVariableResponse) GetSeq() int { return m.Seq } -func (m *SourceRequest) GetSeq() int { return m.Seq } -func (m *SourceResponse) GetSeq() int { return m.Seq } -func (m *ThreadsRequest) GetSeq() int { return m.Seq } -func (m *ThreadsResponse) GetSeq() int { return m.Seq } -func (m *TerminateThreadsRequest) GetSeq() int { return m.Seq } -func (m *TerminateThreadsResponse) GetSeq() int { return m.Seq } -func (m *ModulesRequest) GetSeq() int { return m.Seq } -func (m *ModulesResponse) GetSeq() int { return m.Seq } -func (m *LoadedSourcesRequest) GetSeq() int { return m.Seq } -func (m *LoadedSourcesResponse) GetSeq() int { return m.Seq } -func (m *EvaluateRequest) GetSeq() int { return m.Seq } -func (m *EvaluateResponse) GetSeq() int { return m.Seq } -func (m *SetExpressionRequest) GetSeq() int { return m.Seq } -func (m *SetExpressionResponse) GetSeq() int { return m.Seq } -func (m *StepInTargetsRequest) GetSeq() int { return m.Seq } -func (m *StepInTargetsResponse) GetSeq() int { return m.Seq } -func (m *GotoTargetsRequest) GetSeq() int { return m.Seq } -func (m *GotoTargetsResponse) GetSeq() int { return m.Seq } -func (m *CompletionsRequest) GetSeq() int { return m.Seq } -func (m *CompletionsResponse) GetSeq() int { return m.Seq } -func (m *ExceptionInfoRequest) GetSeq() int { return m.Seq } -func (m *ExceptionInfoResponse) GetSeq() int { return m.Seq } -func (m *ReadMemoryRequest) GetSeq() int { return m.Seq } -func (m *ReadMemoryResponse) GetSeq() int { return m.Seq } -func (m *DisassembleRequest) GetSeq() int { return m.Seq } -func (m *DisassembleResponse) GetSeq() int { return m.Seq } +// InvalidatedAreas: Logical areas that can be invalidated by the 'invalidated' event. +type InvalidatedAreas string + +// Mapping of request commands and corresponding struct constructors that +// can be passed to json.Unmarshal. +var requestCtor = map[string]messageCtor{ + "cancel": func() Message { return &CancelRequest{} }, + "runInTerminal": func() Message { return &RunInTerminalRequest{} }, + "initialize": func() Message { + return &InitializeRequest{ + Arguments: InitializeRequestArguments{ + // Set the default values specified here: https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Initialize. + LinesStartAt1: true, + ColumnsStartAt1: true, + PathFormat: "path", + }, + } + }, + "configurationDone": func() Message { return &ConfigurationDoneRequest{} }, + "launch": func() Message { return &LaunchRequest{} }, + "attach": func() Message { return &AttachRequest{} }, + "restart": func() Message { return &RestartRequest{} }, + "disconnect": func() Message { return &DisconnectRequest{} }, + "terminate": func() Message { return &TerminateRequest{} }, + "breakpointLocations": func() Message { return &BreakpointLocationsRequest{} }, + "setBreakpoints": func() Message { return &SetBreakpointsRequest{} }, + "setFunctionBreakpoints": func() Message { return &SetFunctionBreakpointsRequest{} }, + "setExceptionBreakpoints": func() Message { return &SetExceptionBreakpointsRequest{} }, + "dataBreakpointInfo": func() Message { return &DataBreakpointInfoRequest{} }, + "setDataBreakpoints": func() Message { return &SetDataBreakpointsRequest{} }, + "setInstructionBreakpoints": func() Message { return &SetInstructionBreakpointsRequest{} }, + "continue": func() Message { return &ContinueRequest{} }, + "next": func() Message { return &NextRequest{} }, + "stepIn": func() Message { return &StepInRequest{} }, + "stepOut": func() Message { return &StepOutRequest{} }, + "stepBack": func() Message { return &StepBackRequest{} }, + "reverseContinue": func() Message { return &ReverseContinueRequest{} }, + "restartFrame": func() Message { return &RestartFrameRequest{} }, + "goto": func() Message { return &GotoRequest{} }, + "pause": func() Message { return &PauseRequest{} }, + "stackTrace": func() Message { return &StackTraceRequest{} }, + "scopes": func() Message { return &ScopesRequest{} }, + "variables": func() Message { return &VariablesRequest{} }, + "setVariable": func() Message { return &SetVariableRequest{} }, + "source": func() Message { return &SourceRequest{} }, + "threads": func() Message { return &ThreadsRequest{} }, + "terminateThreads": func() Message { return &TerminateThreadsRequest{} }, + "modules": func() Message { return &ModulesRequest{} }, + "loadedSources": func() Message { return &LoadedSourcesRequest{} }, + "evaluate": func() Message { return &EvaluateRequest{} }, + "setExpression": func() Message { return &SetExpressionRequest{} }, + "stepInTargets": func() Message { return &StepInTargetsRequest{} }, + "gotoTargets": func() Message { return &GotoTargetsRequest{} }, + "completions": func() Message { return &CompletionsRequest{} }, + "exceptionInfo": func() Message { return &ExceptionInfoRequest{} }, + "readMemory": func() Message { return &ReadMemoryRequest{} }, + "writeMemory": func() Message { return &WriteMemoryRequest{} }, + "disassemble": func() Message { return &DisassembleRequest{} }, +} + +// Mapping of response commands and corresponding struct constructors that +// can be passed to json.Unmarshal. +var responseCtor = map[string]messageCtor{ + "cancel": func() Message { return &CancelResponse{} }, + "runInTerminal": func() Message { return &RunInTerminalResponse{} }, + "initialize": func() Message { return &InitializeResponse{} }, + "configurationDone": func() Message { return &ConfigurationDoneResponse{} }, + "launch": func() Message { return &LaunchResponse{} }, + "attach": func() Message { return &AttachResponse{} }, + "restart": func() Message { return &RestartResponse{} }, + "disconnect": func() Message { return &DisconnectResponse{} }, + "terminate": func() Message { return &TerminateResponse{} }, + "breakpointLocations": func() Message { return &BreakpointLocationsResponse{} }, + "setBreakpoints": func() Message { return &SetBreakpointsResponse{} }, + "setFunctionBreakpoints": func() Message { return &SetFunctionBreakpointsResponse{} }, + "setExceptionBreakpoints": func() Message { return &SetExceptionBreakpointsResponse{} }, + "dataBreakpointInfo": func() Message { return &DataBreakpointInfoResponse{} }, + "setDataBreakpoints": func() Message { return &SetDataBreakpointsResponse{} }, + "setInstructionBreakpoints": func() Message { return &SetInstructionBreakpointsResponse{} }, + "continue": func() Message { return &ContinueResponse{} }, + "next": func() Message { return &NextResponse{} }, + "stepIn": func() Message { return &StepInResponse{} }, + "stepOut": func() Message { return &StepOutResponse{} }, + "stepBack": func() Message { return &StepBackResponse{} }, + "reverseContinue": func() Message { return &ReverseContinueResponse{} }, + "restartFrame": func() Message { return &RestartFrameResponse{} }, + "goto": func() Message { return &GotoResponse{} }, + "pause": func() Message { return &PauseResponse{} }, + "stackTrace": func() Message { return &StackTraceResponse{} }, + "scopes": func() Message { return &ScopesResponse{} }, + "variables": func() Message { return &VariablesResponse{} }, + "setVariable": func() Message { return &SetVariableResponse{} }, + "source": func() Message { return &SourceResponse{} }, + "threads": func() Message { return &ThreadsResponse{} }, + "terminateThreads": func() Message { return &TerminateThreadsResponse{} }, + "modules": func() Message { return &ModulesResponse{} }, + "loadedSources": func() Message { return &LoadedSourcesResponse{} }, + "evaluate": func() Message { return &EvaluateResponse{} }, + "setExpression": func() Message { return &SetExpressionResponse{} }, + "stepInTargets": func() Message { return &StepInTargetsResponse{} }, + "gotoTargets": func() Message { return &GotoTargetsResponse{} }, + "completions": func() Message { return &CompletionsResponse{} }, + "exceptionInfo": func() Message { return &ExceptionInfoResponse{} }, + "readMemory": func() Message { return &ReadMemoryResponse{} }, + "writeMemory": func() Message { return &WriteMemoryResponse{} }, + "disassemble": func() Message { return &DisassembleResponse{} }, +} + +// Mapping of event ids and corresponding struct constructors that +// can be passed to json.Unmarshal. +var eventCtor = map[string]messageCtor{ + "initialized": func() Message { return &InitializedEvent{} }, + "stopped": func() Message { return &StoppedEvent{} }, + "continued": func() Message { return &ContinuedEvent{} }, + "exited": func() Message { return &ExitedEvent{} }, + "terminated": func() Message { return &TerminatedEvent{} }, + "thread": func() Message { return &ThreadEvent{} }, + "output": func() Message { return &OutputEvent{} }, + "breakpoint": func() Message { return &BreakpointEvent{} }, + "module": func() Message { return &ModuleEvent{} }, + "loadedSource": func() Message { return &LoadedSourceEvent{} }, + "process": func() Message { return &ProcessEvent{} }, + "capabilities": func() Message { return &CapabilitiesEvent{} }, + "progressStart": func() Message { return &ProgressStartEvent{} }, + "progressUpdate": func() Message { return &ProgressUpdateEvent{} }, + "progressEnd": func() Message { return &ProgressEndEvent{} }, + "invalidated": func() Message { return &InvalidatedEvent{} }, + "memory": func() Message { return &MemoryEvent{} }, +} diff --git a/vendor/github.com/mattn/go-colorable/colorable_appengine.go b/vendor/github.com/mattn/go-colorable/colorable_appengine.go index 49343e5f60..1f28d773d7 100644 --- a/vendor/github.com/mattn/go-colorable/colorable_appengine.go +++ b/vendor/github.com/mattn/go-colorable/colorable_appengine.go @@ -5,6 +5,8 @@ package colorable import ( "io" "os" + + _ "github.com/mattn/go-isatty" ) // NewColorable return new instance of Writer which handle escape sequence. diff --git a/vendor/github.com/mattn/go-colorable/colorable_others.go b/vendor/github.com/mattn/go-colorable/colorable_others.go index d28f5429da..887f203dc7 100644 --- a/vendor/github.com/mattn/go-colorable/colorable_others.go +++ b/vendor/github.com/mattn/go-colorable/colorable_others.go @@ -6,6 +6,8 @@ package colorable import ( "io" "os" + + _ "github.com/mattn/go-isatty" ) // NewColorable return new instance of Writer which handle escape sequence. diff --git a/vendor/github.com/mattn/go-colorable/colorable_windows.go b/vendor/github.com/mattn/go-colorable/colorable_windows.go index 6194eb92d2..e17a5474e9 100644 --- a/vendor/github.com/mattn/go-colorable/colorable_windows.go +++ b/vendor/github.com/mattn/go-colorable/colorable_windows.go @@ -411,11 +411,6 @@ func (w *Writer) Write(data []byte) (n int, err error) { var bw [1]byte loop: for { - r1, _, err := procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) - if r1 == 0 { - break loop - } - c1, err := er.ReadByte() if err != nil { break loop @@ -460,6 +455,7 @@ loop: if err != nil { continue } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.y -= short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'B': @@ -467,6 +463,7 @@ loop: if err != nil { continue } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.y += short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'C': @@ -474,23 +471,23 @@ loop: if err != nil { continue } - csbi.cursorPosition.x -= short(n) + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.x += short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'D': n, err = strconv.Atoi(buf.String()) if err != nil { continue } - if n, err = strconv.Atoi(buf.String()); err == nil { - var csbi consoleScreenBufferInfo - csbi.cursorPosition.x += short(n) - procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) + csbi.cursorPosition.x -= short(n) + procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'E': n, err = strconv.Atoi(buf.String()) if err != nil { continue } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = 0 csbi.cursorPosition.y += short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) @@ -499,6 +496,7 @@ loop: if err != nil { continue } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = 0 csbi.cursorPosition.y -= short(n) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) @@ -507,9 +505,11 @@ loop: if err != nil { continue } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = short(n - 1) procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) - case 'H': + case 'H', 'f': + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) if buf.Len() > 0 { token := strings.Split(buf.String(), ";") switch len(token) { @@ -545,6 +545,7 @@ loop: } var count, written dword var cursor coord + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) switch n { case 0: cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} @@ -566,20 +567,24 @@ loop: continue } } + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) var cursor coord + var count, written dword switch n { case 0: - cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} + cursor = coord{x: csbi.cursorPosition.x + 1, y: csbi.cursorPosition.y} + count = dword(csbi.size.x - csbi.cursorPosition.x - 1) case 1: cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y} + count = dword(csbi.size.x - csbi.cursorPosition.x) case 2: cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y} + count = dword(csbi.size.x) } - var count, written dword - count = dword(csbi.size.x - csbi.cursorPosition.x) procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) case 'm': + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) attr := csbi.attributes cs := buf.String() if cs == "" { @@ -684,22 +689,31 @@ loop: } } case 'h': + var ci consoleCursorInfo cs := buf.String() - if cs == "?25" { - var ci consoleCursorInfo + if cs == "5>" { + procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) + ci.visible = 0 + procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) + } else if cs == "?25" { procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) ci.visible = 1 procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) } case 'l': + var ci consoleCursorInfo cs := buf.String() - if cs == "?25" { - var ci consoleCursorInfo + if cs == "5>" { + procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) + ci.visible = 1 + procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) + } else if cs == "?25" { procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) ci.visible = 0 procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci))) } case 's': + procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) w.oldpos = csbi.cursorPosition case 'u': procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&w.oldpos))) diff --git a/vendor/github.com/mattn/go-runewidth/.travis.yml b/vendor/github.com/mattn/go-runewidth/.travis.yml new file mode 100644 index 0000000000..5c9c2a30f0 --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/.travis.yml @@ -0,0 +1,8 @@ +language: go +go: + - tip +before_install: + - go get github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover +script: + - $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL diff --git a/vendor/github.com/mattn/go-runewidth/LICENSE b/vendor/github.com/mattn/go-runewidth/LICENSE new file mode 100644 index 0000000000..91b5cef30e --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Yasuhiro Matsumoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/mattn/go-runewidth/README.mkd b/vendor/github.com/mattn/go-runewidth/README.mkd new file mode 100644 index 0000000000..66663a94b0 --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/README.mkd @@ -0,0 +1,27 @@ +go-runewidth +============ + +[![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth) +[![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD) +[![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth) +[![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth) + +Provides functions to get fixed width of the character or string. + +Usage +----- + +```go +runewidth.StringWidth("つのだ☆HIRO") == 12 +``` + + +Author +------ + +Yasuhiro Matsumoto + +License +------- + +under the MIT License: http://mattn.mit-license.org/2013 diff --git a/vendor/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go new file mode 100644 index 0000000000..82568a1bb9 --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/runewidth.go @@ -0,0 +1,1235 @@ +package runewidth + +import "os" + +var ( + // EastAsianWidth will be set true if the current locale is CJK + EastAsianWidth bool + + // DefaultCondition is a condition in current locale + DefaultCondition = &Condition{EastAsianWidth} +) + +func init() { + env := os.Getenv("RUNEWIDTH_EASTASIAN") + if env == "" { + EastAsianWidth = IsEastAsian() + } else { + EastAsianWidth = env == "1" + } +} + +type interval struct { + first rune + last rune +} + +type table []interval + +func inTables(r rune, ts ...table) bool { + for _, t := range ts { + if inTable(r, t) { + return true + } + } + return false +} + +func inTable(r rune, t table) bool { + // func (t table) IncludesRune(r rune) bool { + if r < t[0].first { + return false + } + + bot := 0 + top := len(t) - 1 + for top >= bot { + mid := (bot + top) / 2 + + switch { + case t[mid].last < r: + bot = mid + 1 + case t[mid].first > r: + top = mid - 1 + default: + return true + } + } + + return false +} + +var private = table{ + {0x00E000, 0x00F8FF}, {0x0F0000, 0x0FFFFD}, {0x100000, 0x10FFFD}, +} + +var nonprint = table{ + {0x0000, 0x001F}, {0x007F, 0x009F}, {0x00AD, 0x00AD}, + {0x070F, 0x070F}, {0x180B, 0x180E}, {0x200B, 0x200F}, + {0x2028, 0x2029}, + {0x202A, 0x202E}, {0x206A, 0x206F}, {0xD800, 0xDFFF}, + {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFE, 0xFFFF}, +} + +var combining = table{ + {0x0300, 0x036F}, {0x0483, 0x0489}, {0x0591, 0x05BD}, + {0x05BF, 0x05BF}, {0x05C1, 0x05C2}, {0x05C4, 0x05C5}, + {0x05C7, 0x05C7}, {0x0610, 0x061A}, {0x064B, 0x065F}, + {0x0670, 0x0670}, {0x06D6, 0x06DC}, {0x06DF, 0x06E4}, + {0x06E7, 0x06E8}, {0x06EA, 0x06ED}, {0x0711, 0x0711}, + {0x0730, 0x074A}, {0x07A6, 0x07B0}, {0x07EB, 0x07F3}, + {0x0816, 0x0819}, {0x081B, 0x0823}, {0x0825, 0x0827}, + {0x0829, 0x082D}, {0x0859, 0x085B}, {0x08D4, 0x08E1}, + {0x08E3, 0x0903}, {0x093A, 0x093C}, {0x093E, 0x094F}, + {0x0951, 0x0957}, {0x0962, 0x0963}, {0x0981, 0x0983}, + {0x09BC, 0x09BC}, {0x09BE, 0x09C4}, {0x09C7, 0x09C8}, + {0x09CB, 0x09CD}, {0x09D7, 0x09D7}, {0x09E2, 0x09E3}, + {0x0A01, 0x0A03}, {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A42}, + {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51}, + {0x0A70, 0x0A71}, {0x0A75, 0x0A75}, {0x0A81, 0x0A83}, + {0x0ABC, 0x0ABC}, {0x0ABE, 0x0AC5}, {0x0AC7, 0x0AC9}, + {0x0ACB, 0x0ACD}, {0x0AE2, 0x0AE3}, {0x0B01, 0x0B03}, + {0x0B3C, 0x0B3C}, {0x0B3E, 0x0B44}, {0x0B47, 0x0B48}, + {0x0B4B, 0x0B4D}, {0x0B56, 0x0B57}, {0x0B62, 0x0B63}, + {0x0B82, 0x0B82}, {0x0BBE, 0x0BC2}, {0x0BC6, 0x0BC8}, + {0x0BCA, 0x0BCD}, {0x0BD7, 0x0BD7}, {0x0C00, 0x0C03}, + {0x0C3E, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, + {0x0C55, 0x0C56}, {0x0C62, 0x0C63}, {0x0C81, 0x0C83}, + {0x0CBC, 0x0CBC}, {0x0CBE, 0x0CC4}, {0x0CC6, 0x0CC8}, + {0x0CCA, 0x0CCD}, {0x0CD5, 0x0CD6}, {0x0CE2, 0x0CE3}, + {0x0D01, 0x0D03}, {0x0D3E, 0x0D44}, {0x0D46, 0x0D48}, + {0x0D4A, 0x0D4D}, {0x0D57, 0x0D57}, {0x0D62, 0x0D63}, + {0x0D82, 0x0D83}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD4}, + {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF}, {0x0DF2, 0x0DF3}, + {0x0E31, 0x0E31}, {0x0E34, 0x0E3A}, {0x0E47, 0x0E4E}, + {0x0EB1, 0x0EB1}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC}, + {0x0EC8, 0x0ECD}, {0x0F18, 0x0F19}, {0x0F35, 0x0F35}, + {0x0F37, 0x0F37}, {0x0F39, 0x0F39}, {0x0F3E, 0x0F3F}, + {0x0F71, 0x0F84}, {0x0F86, 0x0F87}, {0x0F8D, 0x0F97}, + {0x0F99, 0x0FBC}, {0x0FC6, 0x0FC6}, {0x102B, 0x103E}, + {0x1056, 0x1059}, {0x105E, 0x1060}, {0x1062, 0x1064}, + {0x1067, 0x106D}, {0x1071, 0x1074}, {0x1082, 0x108D}, + {0x108F, 0x108F}, {0x109A, 0x109D}, {0x135D, 0x135F}, + {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753}, + {0x1772, 0x1773}, {0x17B4, 0x17D3}, {0x17DD, 0x17DD}, + {0x180B, 0x180D}, {0x1885, 0x1886}, {0x18A9, 0x18A9}, + {0x1920, 0x192B}, {0x1930, 0x193B}, {0x1A17, 0x1A1B}, + {0x1A55, 0x1A5E}, {0x1A60, 0x1A7C}, {0x1A7F, 0x1A7F}, + {0x1AB0, 0x1ABE}, {0x1B00, 0x1B04}, {0x1B34, 0x1B44}, + {0x1B6B, 0x1B73}, {0x1B80, 0x1B82}, {0x1BA1, 0x1BAD}, + {0x1BE6, 0x1BF3}, {0x1C24, 0x1C37}, {0x1CD0, 0x1CD2}, + {0x1CD4, 0x1CE8}, {0x1CED, 0x1CED}, {0x1CF2, 0x1CF4}, + {0x1CF8, 0x1CF9}, {0x1DC0, 0x1DF5}, {0x1DFB, 0x1DFF}, + {0x20D0, 0x20F0}, {0x2CEF, 0x2CF1}, {0x2D7F, 0x2D7F}, + {0x2DE0, 0x2DFF}, {0x302A, 0x302F}, {0x3099, 0x309A}, + {0xA66F, 0xA672}, {0xA674, 0xA67D}, {0xA69E, 0xA69F}, + {0xA6F0, 0xA6F1}, {0xA802, 0xA802}, {0xA806, 0xA806}, + {0xA80B, 0xA80B}, {0xA823, 0xA827}, {0xA880, 0xA881}, + {0xA8B4, 0xA8C5}, {0xA8E0, 0xA8F1}, {0xA926, 0xA92D}, + {0xA947, 0xA953}, {0xA980, 0xA983}, {0xA9B3, 0xA9C0}, + {0xA9E5, 0xA9E5}, {0xAA29, 0xAA36}, {0xAA43, 0xAA43}, + {0xAA4C, 0xAA4D}, {0xAA7B, 0xAA7D}, {0xAAB0, 0xAAB0}, + {0xAAB2, 0xAAB4}, {0xAAB7, 0xAAB8}, {0xAABE, 0xAABF}, + {0xAAC1, 0xAAC1}, {0xAAEB, 0xAAEF}, {0xAAF5, 0xAAF6}, + {0xABE3, 0xABEA}, {0xABEC, 0xABED}, {0xFB1E, 0xFB1E}, + {0xFE00, 0xFE0F}, {0xFE20, 0xFE2F}, {0x101FD, 0x101FD}, + {0x102E0, 0x102E0}, {0x10376, 0x1037A}, {0x10A01, 0x10A03}, + {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F}, {0x10A38, 0x10A3A}, + {0x10A3F, 0x10A3F}, {0x10AE5, 0x10AE6}, {0x11000, 0x11002}, + {0x11038, 0x11046}, {0x1107F, 0x11082}, {0x110B0, 0x110BA}, + {0x11100, 0x11102}, {0x11127, 0x11134}, {0x11173, 0x11173}, + {0x11180, 0x11182}, {0x111B3, 0x111C0}, {0x111CA, 0x111CC}, + {0x1122C, 0x11237}, {0x1123E, 0x1123E}, {0x112DF, 0x112EA}, + {0x11300, 0x11303}, {0x1133C, 0x1133C}, {0x1133E, 0x11344}, + {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11357, 0x11357}, + {0x11362, 0x11363}, {0x11366, 0x1136C}, {0x11370, 0x11374}, + {0x11435, 0x11446}, {0x114B0, 0x114C3}, {0x115AF, 0x115B5}, + {0x115B8, 0x115C0}, {0x115DC, 0x115DD}, {0x11630, 0x11640}, + {0x116AB, 0x116B7}, {0x1171D, 0x1172B}, {0x11C2F, 0x11C36}, + {0x11C38, 0x11C3F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CB6}, + {0x16AF0, 0x16AF4}, {0x16B30, 0x16B36}, {0x16F51, 0x16F7E}, + {0x16F8F, 0x16F92}, {0x1BC9D, 0x1BC9E}, {0x1D165, 0x1D169}, + {0x1D16D, 0x1D172}, {0x1D17B, 0x1D182}, {0x1D185, 0x1D18B}, + {0x1D1AA, 0x1D1AD}, {0x1D242, 0x1D244}, {0x1DA00, 0x1DA36}, + {0x1DA3B, 0x1DA6C}, {0x1DA75, 0x1DA75}, {0x1DA84, 0x1DA84}, + {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, {0x1E000, 0x1E006}, + {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024}, + {0x1E026, 0x1E02A}, {0x1E8D0, 0x1E8D6}, {0x1E944, 0x1E94A}, + {0xE0100, 0xE01EF}, +} + +var doublewidth = table{ + {0x1100, 0x115F}, {0x231A, 0x231B}, {0x2329, 0x232A}, + {0x23E9, 0x23EC}, {0x23F0, 0x23F0}, {0x23F3, 0x23F3}, + {0x25FD, 0x25FE}, {0x2614, 0x2615}, {0x2648, 0x2653}, + {0x267F, 0x267F}, {0x2693, 0x2693}, {0x26A1, 0x26A1}, + {0x26AA, 0x26AB}, {0x26BD, 0x26BE}, {0x26C4, 0x26C5}, + {0x26CE, 0x26CE}, {0x26D4, 0x26D4}, {0x26EA, 0x26EA}, + {0x26F2, 0x26F3}, {0x26F5, 0x26F5}, {0x26FA, 0x26FA}, + {0x26FD, 0x26FD}, {0x2705, 0x2705}, {0x270A, 0x270B}, + {0x2728, 0x2728}, {0x274C, 0x274C}, {0x274E, 0x274E}, + {0x2753, 0x2755}, {0x2757, 0x2757}, {0x2795, 0x2797}, + {0x27B0, 0x27B0}, {0x27BF, 0x27BF}, {0x2B1B, 0x2B1C}, + {0x2B50, 0x2B50}, {0x2B55, 0x2B55}, {0x2E80, 0x2E99}, + {0x2E9B, 0x2EF3}, {0x2F00, 0x2FD5}, {0x2FF0, 0x2FFB}, + {0x3000, 0x303E}, {0x3041, 0x3096}, {0x3099, 0x30FF}, + {0x3105, 0x312D}, {0x3131, 0x318E}, {0x3190, 0x31BA}, + {0x31C0, 0x31E3}, {0x31F0, 0x321E}, {0x3220, 0x3247}, + {0x3250, 0x32FE}, {0x3300, 0x4DBF}, {0x4E00, 0xA48C}, + {0xA490, 0xA4C6}, {0xA960, 0xA97C}, {0xAC00, 0xD7A3}, + {0xF900, 0xFAFF}, {0xFE10, 0xFE19}, {0xFE30, 0xFE52}, + {0xFE54, 0xFE66}, {0xFE68, 0xFE6B}, {0xFF01, 0xFF60}, + {0xFFE0, 0xFFE6}, {0x16FE0, 0x16FE0}, {0x17000, 0x187EC}, + {0x18800, 0x18AF2}, {0x1B000, 0x1B001}, {0x1F004, 0x1F004}, + {0x1F0CF, 0x1F0CF}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A}, + {0x1F200, 0x1F202}, {0x1F210, 0x1F23B}, {0x1F240, 0x1F248}, + {0x1F250, 0x1F251}, {0x1F300, 0x1F320}, {0x1F32D, 0x1F335}, + {0x1F337, 0x1F37C}, {0x1F37E, 0x1F393}, {0x1F3A0, 0x1F3CA}, + {0x1F3CF, 0x1F3D3}, {0x1F3E0, 0x1F3F0}, {0x1F3F4, 0x1F3F4}, + {0x1F3F8, 0x1F43E}, {0x1F440, 0x1F440}, {0x1F442, 0x1F4FC}, + {0x1F4FF, 0x1F53D}, {0x1F54B, 0x1F54E}, {0x1F550, 0x1F567}, + {0x1F57A, 0x1F57A}, {0x1F595, 0x1F596}, {0x1F5A4, 0x1F5A4}, + {0x1F5FB, 0x1F64F}, {0x1F680, 0x1F6C5}, {0x1F6CC, 0x1F6CC}, + {0x1F6D0, 0x1F6D2}, {0x1F6EB, 0x1F6EC}, {0x1F6F4, 0x1F6F6}, + {0x1F910, 0x1F91E}, {0x1F920, 0x1F927}, {0x1F930, 0x1F930}, + {0x1F933, 0x1F93E}, {0x1F940, 0x1F94B}, {0x1F950, 0x1F95E}, + {0x1F980, 0x1F991}, {0x1F9C0, 0x1F9C0}, {0x20000, 0x2FFFD}, + {0x30000, 0x3FFFD}, +} + +var ambiguous = table{ + {0x00A1, 0x00A1}, {0x00A4, 0x00A4}, {0x00A7, 0x00A8}, + {0x00AA, 0x00AA}, {0x00AD, 0x00AE}, {0x00B0, 0x00B4}, + {0x00B6, 0x00BA}, {0x00BC, 0x00BF}, {0x00C6, 0x00C6}, + {0x00D0, 0x00D0}, {0x00D7, 0x00D8}, {0x00DE, 0x00E1}, + {0x00E6, 0x00E6}, {0x00E8, 0x00EA}, {0x00EC, 0x00ED}, + {0x00F0, 0x00F0}, {0x00F2, 0x00F3}, {0x00F7, 0x00FA}, + {0x00FC, 0x00FC}, {0x00FE, 0x00FE}, {0x0101, 0x0101}, + {0x0111, 0x0111}, {0x0113, 0x0113}, {0x011B, 0x011B}, + {0x0126, 0x0127}, {0x012B, 0x012B}, {0x0131, 0x0133}, + {0x0138, 0x0138}, {0x013F, 0x0142}, {0x0144, 0x0144}, + {0x0148, 0x014B}, {0x014D, 0x014D}, {0x0152, 0x0153}, + {0x0166, 0x0167}, {0x016B, 0x016B}, {0x01CE, 0x01CE}, + {0x01D0, 0x01D0}, {0x01D2, 0x01D2}, {0x01D4, 0x01D4}, + {0x01D6, 0x01D6}, {0x01D8, 0x01D8}, {0x01DA, 0x01DA}, + {0x01DC, 0x01DC}, {0x0251, 0x0251}, {0x0261, 0x0261}, + {0x02C4, 0x02C4}, {0x02C7, 0x02C7}, {0x02C9, 0x02CB}, + {0x02CD, 0x02CD}, {0x02D0, 0x02D0}, {0x02D8, 0x02DB}, + {0x02DD, 0x02DD}, {0x02DF, 0x02DF}, {0x0300, 0x036F}, + {0x0391, 0x03A1}, {0x03A3, 0x03A9}, {0x03B1, 0x03C1}, + {0x03C3, 0x03C9}, {0x0401, 0x0401}, {0x0410, 0x044F}, + {0x0451, 0x0451}, {0x2010, 0x2010}, {0x2013, 0x2016}, + {0x2018, 0x2019}, {0x201C, 0x201D}, {0x2020, 0x2022}, + {0x2024, 0x2027}, {0x2030, 0x2030}, {0x2032, 0x2033}, + {0x2035, 0x2035}, {0x203B, 0x203B}, {0x203E, 0x203E}, + {0x2074, 0x2074}, {0x207F, 0x207F}, {0x2081, 0x2084}, + {0x20AC, 0x20AC}, {0x2103, 0x2103}, {0x2105, 0x2105}, + {0x2109, 0x2109}, {0x2113, 0x2113}, {0x2116, 0x2116}, + {0x2121, 0x2122}, {0x2126, 0x2126}, {0x212B, 0x212B}, + {0x2153, 0x2154}, {0x215B, 0x215E}, {0x2160, 0x216B}, + {0x2170, 0x2179}, {0x2189, 0x2189}, {0x2190, 0x2199}, + {0x21B8, 0x21B9}, {0x21D2, 0x21D2}, {0x21D4, 0x21D4}, + {0x21E7, 0x21E7}, {0x2200, 0x2200}, {0x2202, 0x2203}, + {0x2207, 0x2208}, {0x220B, 0x220B}, {0x220F, 0x220F}, + {0x2211, 0x2211}, {0x2215, 0x2215}, {0x221A, 0x221A}, + {0x221D, 0x2220}, {0x2223, 0x2223}, {0x2225, 0x2225}, + {0x2227, 0x222C}, {0x222E, 0x222E}, {0x2234, 0x2237}, + {0x223C, 0x223D}, {0x2248, 0x2248}, {0x224C, 0x224C}, + {0x2252, 0x2252}, {0x2260, 0x2261}, {0x2264, 0x2267}, + {0x226A, 0x226B}, {0x226E, 0x226F}, {0x2282, 0x2283}, + {0x2286, 0x2287}, {0x2295, 0x2295}, {0x2299, 0x2299}, + {0x22A5, 0x22A5}, {0x22BF, 0x22BF}, {0x2312, 0x2312}, + {0x2460, 0x24E9}, {0x24EB, 0x254B}, {0x2550, 0x2573}, + {0x2580, 0x258F}, {0x2592, 0x2595}, {0x25A0, 0x25A1}, + {0x25A3, 0x25A9}, {0x25B2, 0x25B3}, {0x25B6, 0x25B7}, + {0x25BC, 0x25BD}, {0x25C0, 0x25C1}, {0x25C6, 0x25C8}, + {0x25CB, 0x25CB}, {0x25CE, 0x25D1}, {0x25E2, 0x25E5}, + {0x25EF, 0x25EF}, {0x2605, 0x2606}, {0x2609, 0x2609}, + {0x260E, 0x260F}, {0x261C, 0x261C}, {0x261E, 0x261E}, + {0x2640, 0x2640}, {0x2642, 0x2642}, {0x2660, 0x2661}, + {0x2663, 0x2665}, {0x2667, 0x266A}, {0x266C, 0x266D}, + {0x266F, 0x266F}, {0x269E, 0x269F}, {0x26BF, 0x26BF}, + {0x26C6, 0x26CD}, {0x26CF, 0x26D3}, {0x26D5, 0x26E1}, + {0x26E3, 0x26E3}, {0x26E8, 0x26E9}, {0x26EB, 0x26F1}, + {0x26F4, 0x26F4}, {0x26F6, 0x26F9}, {0x26FB, 0x26FC}, + {0x26FE, 0x26FF}, {0x273D, 0x273D}, {0x2776, 0x277F}, + {0x2B56, 0x2B59}, {0x3248, 0x324F}, {0xE000, 0xF8FF}, + {0xFE00, 0xFE0F}, {0xFFFD, 0xFFFD}, {0x1F100, 0x1F10A}, + {0x1F110, 0x1F12D}, {0x1F130, 0x1F169}, {0x1F170, 0x1F18D}, + {0x1F18F, 0x1F190}, {0x1F19B, 0x1F1AC}, {0xE0100, 0xE01EF}, + {0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD}, +} + +var emoji = table{ + {0x1F1E6, 0x1F1FF}, {0x1F321, 0x1F321}, {0x1F324, 0x1F32C}, + {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D}, {0x1F396, 0x1F397}, + {0x1F399, 0x1F39B}, {0x1F39E, 0x1F39F}, {0x1F3CB, 0x1F3CE}, + {0x1F3D4, 0x1F3DF}, {0x1F3F3, 0x1F3F5}, {0x1F3F7, 0x1F3F7}, + {0x1F43F, 0x1F43F}, {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FD}, + {0x1F549, 0x1F54A}, {0x1F56F, 0x1F570}, {0x1F573, 0x1F579}, + {0x1F587, 0x1F587}, {0x1F58A, 0x1F58D}, {0x1F590, 0x1F590}, + {0x1F5A5, 0x1F5A5}, {0x1F5A8, 0x1F5A8}, {0x1F5B1, 0x1F5B2}, + {0x1F5BC, 0x1F5BC}, {0x1F5C2, 0x1F5C4}, {0x1F5D1, 0x1F5D3}, + {0x1F5DC, 0x1F5DE}, {0x1F5E1, 0x1F5E1}, {0x1F5E3, 0x1F5E3}, + {0x1F5E8, 0x1F5E8}, {0x1F5EF, 0x1F5EF}, {0x1F5F3, 0x1F5F3}, + {0x1F5FA, 0x1F5FA}, {0x1F6CB, 0x1F6CF}, {0x1F6E0, 0x1F6E5}, + {0x1F6E9, 0x1F6E9}, {0x1F6F0, 0x1F6F0}, {0x1F6F3, 0x1F6F3}, +} + +var notassigned = table{ + {0x0378, 0x0379}, {0x0380, 0x0383}, {0x038B, 0x038B}, + {0x038D, 0x038D}, {0x03A2, 0x03A2}, {0x0530, 0x0530}, + {0x0557, 0x0558}, {0x0560, 0x0560}, {0x0588, 0x0588}, + {0x058B, 0x058C}, {0x0590, 0x0590}, {0x05C8, 0x05CF}, + {0x05EB, 0x05EF}, {0x05F5, 0x05FF}, {0x061D, 0x061D}, + {0x070E, 0x070E}, {0x074B, 0x074C}, {0x07B2, 0x07BF}, + {0x07FB, 0x07FF}, {0x082E, 0x082F}, {0x083F, 0x083F}, + {0x085C, 0x085D}, {0x085F, 0x089F}, {0x08B5, 0x08B5}, + {0x08BE, 0x08D3}, {0x0984, 0x0984}, {0x098D, 0x098E}, + {0x0991, 0x0992}, {0x09A9, 0x09A9}, {0x09B1, 0x09B1}, + {0x09B3, 0x09B5}, {0x09BA, 0x09BB}, {0x09C5, 0x09C6}, + {0x09C9, 0x09CA}, {0x09CF, 0x09D6}, {0x09D8, 0x09DB}, + {0x09DE, 0x09DE}, {0x09E4, 0x09E5}, {0x09FC, 0x0A00}, + {0x0A04, 0x0A04}, {0x0A0B, 0x0A0E}, {0x0A11, 0x0A12}, + {0x0A29, 0x0A29}, {0x0A31, 0x0A31}, {0x0A34, 0x0A34}, + {0x0A37, 0x0A37}, {0x0A3A, 0x0A3B}, {0x0A3D, 0x0A3D}, + {0x0A43, 0x0A46}, {0x0A49, 0x0A4A}, {0x0A4E, 0x0A50}, + {0x0A52, 0x0A58}, {0x0A5D, 0x0A5D}, {0x0A5F, 0x0A65}, + {0x0A76, 0x0A80}, {0x0A84, 0x0A84}, {0x0A8E, 0x0A8E}, + {0x0A92, 0x0A92}, {0x0AA9, 0x0AA9}, {0x0AB1, 0x0AB1}, + {0x0AB4, 0x0AB4}, {0x0ABA, 0x0ABB}, {0x0AC6, 0x0AC6}, + {0x0ACA, 0x0ACA}, {0x0ACE, 0x0ACF}, {0x0AD1, 0x0ADF}, + {0x0AE4, 0x0AE5}, {0x0AF2, 0x0AF8}, {0x0AFA, 0x0B00}, + {0x0B04, 0x0B04}, {0x0B0D, 0x0B0E}, {0x0B11, 0x0B12}, + {0x0B29, 0x0B29}, {0x0B31, 0x0B31}, {0x0B34, 0x0B34}, + {0x0B3A, 0x0B3B}, {0x0B45, 0x0B46}, {0x0B49, 0x0B4A}, + {0x0B4E, 0x0B55}, {0x0B58, 0x0B5B}, {0x0B5E, 0x0B5E}, + {0x0B64, 0x0B65}, {0x0B78, 0x0B81}, {0x0B84, 0x0B84}, + {0x0B8B, 0x0B8D}, {0x0B91, 0x0B91}, {0x0B96, 0x0B98}, + {0x0B9B, 0x0B9B}, {0x0B9D, 0x0B9D}, {0x0BA0, 0x0BA2}, + {0x0BA5, 0x0BA7}, {0x0BAB, 0x0BAD}, {0x0BBA, 0x0BBD}, + {0x0BC3, 0x0BC5}, {0x0BC9, 0x0BC9}, {0x0BCE, 0x0BCF}, + {0x0BD1, 0x0BD6}, {0x0BD8, 0x0BE5}, {0x0BFB, 0x0BFF}, + {0x0C04, 0x0C04}, {0x0C0D, 0x0C0D}, {0x0C11, 0x0C11}, + {0x0C29, 0x0C29}, {0x0C3A, 0x0C3C}, {0x0C45, 0x0C45}, + {0x0C49, 0x0C49}, {0x0C4E, 0x0C54}, {0x0C57, 0x0C57}, + {0x0C5B, 0x0C5F}, {0x0C64, 0x0C65}, {0x0C70, 0x0C77}, + {0x0C84, 0x0C84}, {0x0C8D, 0x0C8D}, {0x0C91, 0x0C91}, + {0x0CA9, 0x0CA9}, {0x0CB4, 0x0CB4}, {0x0CBA, 0x0CBB}, + {0x0CC5, 0x0CC5}, {0x0CC9, 0x0CC9}, {0x0CCE, 0x0CD4}, + {0x0CD7, 0x0CDD}, {0x0CDF, 0x0CDF}, {0x0CE4, 0x0CE5}, + {0x0CF0, 0x0CF0}, {0x0CF3, 0x0D00}, {0x0D04, 0x0D04}, + {0x0D0D, 0x0D0D}, {0x0D11, 0x0D11}, {0x0D3B, 0x0D3C}, + {0x0D45, 0x0D45}, {0x0D49, 0x0D49}, {0x0D50, 0x0D53}, + {0x0D64, 0x0D65}, {0x0D80, 0x0D81}, {0x0D84, 0x0D84}, + {0x0D97, 0x0D99}, {0x0DB2, 0x0DB2}, {0x0DBC, 0x0DBC}, + {0x0DBE, 0x0DBF}, {0x0DC7, 0x0DC9}, {0x0DCB, 0x0DCE}, + {0x0DD5, 0x0DD5}, {0x0DD7, 0x0DD7}, {0x0DE0, 0x0DE5}, + {0x0DF0, 0x0DF1}, {0x0DF5, 0x0E00}, {0x0E3B, 0x0E3E}, + {0x0E5C, 0x0E80}, {0x0E83, 0x0E83}, {0x0E85, 0x0E86}, + {0x0E89, 0x0E89}, {0x0E8B, 0x0E8C}, {0x0E8E, 0x0E93}, + {0x0E98, 0x0E98}, {0x0EA0, 0x0EA0}, {0x0EA4, 0x0EA4}, + {0x0EA6, 0x0EA6}, {0x0EA8, 0x0EA9}, {0x0EAC, 0x0EAC}, + {0x0EBA, 0x0EBA}, {0x0EBE, 0x0EBF}, {0x0EC5, 0x0EC5}, + {0x0EC7, 0x0EC7}, {0x0ECE, 0x0ECF}, {0x0EDA, 0x0EDB}, + {0x0EE0, 0x0EFF}, {0x0F48, 0x0F48}, {0x0F6D, 0x0F70}, + {0x0F98, 0x0F98}, {0x0FBD, 0x0FBD}, {0x0FCD, 0x0FCD}, + {0x0FDB, 0x0FFF}, {0x10C6, 0x10C6}, {0x10C8, 0x10CC}, + {0x10CE, 0x10CF}, {0x1249, 0x1249}, {0x124E, 0x124F}, + {0x1257, 0x1257}, {0x1259, 0x1259}, {0x125E, 0x125F}, + {0x1289, 0x1289}, {0x128E, 0x128F}, {0x12B1, 0x12B1}, + {0x12B6, 0x12B7}, {0x12BF, 0x12BF}, {0x12C1, 0x12C1}, + {0x12C6, 0x12C7}, {0x12D7, 0x12D7}, {0x1311, 0x1311}, + {0x1316, 0x1317}, {0x135B, 0x135C}, {0x137D, 0x137F}, + {0x139A, 0x139F}, {0x13F6, 0x13F7}, {0x13FE, 0x13FF}, + {0x169D, 0x169F}, {0x16F9, 0x16FF}, {0x170D, 0x170D}, + {0x1715, 0x171F}, {0x1737, 0x173F}, {0x1754, 0x175F}, + {0x176D, 0x176D}, {0x1771, 0x1771}, {0x1774, 0x177F}, + {0x17DE, 0x17DF}, {0x17EA, 0x17EF}, {0x17FA, 0x17FF}, + {0x180F, 0x180F}, {0x181A, 0x181F}, {0x1878, 0x187F}, + {0x18AB, 0x18AF}, {0x18F6, 0x18FF}, {0x191F, 0x191F}, + {0x192C, 0x192F}, {0x193C, 0x193F}, {0x1941, 0x1943}, + {0x196E, 0x196F}, {0x1975, 0x197F}, {0x19AC, 0x19AF}, + {0x19CA, 0x19CF}, {0x19DB, 0x19DD}, {0x1A1C, 0x1A1D}, + {0x1A5F, 0x1A5F}, {0x1A7D, 0x1A7E}, {0x1A8A, 0x1A8F}, + {0x1A9A, 0x1A9F}, {0x1AAE, 0x1AAF}, {0x1ABF, 0x1AFF}, + {0x1B4C, 0x1B4F}, {0x1B7D, 0x1B7F}, {0x1BF4, 0x1BFB}, + {0x1C38, 0x1C3A}, {0x1C4A, 0x1C4C}, {0x1C89, 0x1CBF}, + {0x1CC8, 0x1CCF}, {0x1CF7, 0x1CF7}, {0x1CFA, 0x1CFF}, + {0x1DF6, 0x1DFA}, {0x1F16, 0x1F17}, {0x1F1E, 0x1F1F}, + {0x1F46, 0x1F47}, {0x1F4E, 0x1F4F}, {0x1F58, 0x1F58}, + {0x1F5A, 0x1F5A}, {0x1F5C, 0x1F5C}, {0x1F5E, 0x1F5E}, + {0x1F7E, 0x1F7F}, {0x1FB5, 0x1FB5}, {0x1FC5, 0x1FC5}, + {0x1FD4, 0x1FD5}, {0x1FDC, 0x1FDC}, {0x1FF0, 0x1FF1}, + {0x1FF5, 0x1FF5}, {0x1FFF, 0x1FFF}, {0x2065, 0x2065}, + {0x2072, 0x2073}, {0x208F, 0x208F}, {0x209D, 0x209F}, + {0x20BF, 0x20CF}, {0x20F1, 0x20FF}, {0x218C, 0x218F}, + {0x23FF, 0x23FF}, {0x2427, 0x243F}, {0x244B, 0x245F}, + {0x2B74, 0x2B75}, {0x2B96, 0x2B97}, {0x2BBA, 0x2BBC}, + {0x2BC9, 0x2BC9}, {0x2BD2, 0x2BEB}, {0x2BF0, 0x2BFF}, + {0x2C2F, 0x2C2F}, {0x2C5F, 0x2C5F}, {0x2CF4, 0x2CF8}, + {0x2D26, 0x2D26}, {0x2D28, 0x2D2C}, {0x2D2E, 0x2D2F}, + {0x2D68, 0x2D6E}, {0x2D71, 0x2D7E}, {0x2D97, 0x2D9F}, + {0x2DA7, 0x2DA7}, {0x2DAF, 0x2DAF}, {0x2DB7, 0x2DB7}, + {0x2DBF, 0x2DBF}, {0x2DC7, 0x2DC7}, {0x2DCF, 0x2DCF}, + {0x2DD7, 0x2DD7}, {0x2DDF, 0x2DDF}, {0x2E45, 0x2E7F}, + {0x2E9A, 0x2E9A}, {0x2EF4, 0x2EFF}, {0x2FD6, 0x2FEF}, + {0x2FFC, 0x2FFF}, {0x3040, 0x3040}, {0x3097, 0x3098}, + {0x3100, 0x3104}, {0x312E, 0x3130}, {0x318F, 0x318F}, + {0x31BB, 0x31BF}, {0x31E4, 0x31EF}, {0x321F, 0x321F}, + {0x32FF, 0x32FF}, {0x4DB6, 0x4DBF}, {0x9FD6, 0x9FFF}, + {0xA48D, 0xA48F}, {0xA4C7, 0xA4CF}, {0xA62C, 0xA63F}, + {0xA6F8, 0xA6FF}, {0xA7AF, 0xA7AF}, {0xA7B8, 0xA7F6}, + {0xA82C, 0xA82F}, {0xA83A, 0xA83F}, {0xA878, 0xA87F}, + {0xA8C6, 0xA8CD}, {0xA8DA, 0xA8DF}, {0xA8FE, 0xA8FF}, + {0xA954, 0xA95E}, {0xA97D, 0xA97F}, {0xA9CE, 0xA9CE}, + {0xA9DA, 0xA9DD}, {0xA9FF, 0xA9FF}, {0xAA37, 0xAA3F}, + {0xAA4E, 0xAA4F}, {0xAA5A, 0xAA5B}, {0xAAC3, 0xAADA}, + {0xAAF7, 0xAB00}, {0xAB07, 0xAB08}, {0xAB0F, 0xAB10}, + {0xAB17, 0xAB1F}, {0xAB27, 0xAB27}, {0xAB2F, 0xAB2F}, + {0xAB66, 0xAB6F}, {0xABEE, 0xABEF}, {0xABFA, 0xABFF}, + {0xD7A4, 0xD7AF}, {0xD7C7, 0xD7CA}, {0xD7FC, 0xD7FF}, + {0xFA6E, 0xFA6F}, {0xFADA, 0xFAFF}, {0xFB07, 0xFB12}, + {0xFB18, 0xFB1C}, {0xFB37, 0xFB37}, {0xFB3D, 0xFB3D}, + {0xFB3F, 0xFB3F}, {0xFB42, 0xFB42}, {0xFB45, 0xFB45}, + {0xFBC2, 0xFBD2}, {0xFD40, 0xFD4F}, {0xFD90, 0xFD91}, + {0xFDC8, 0xFDEF}, {0xFDFE, 0xFDFF}, {0xFE1A, 0xFE1F}, + {0xFE53, 0xFE53}, {0xFE67, 0xFE67}, {0xFE6C, 0xFE6F}, + {0xFE75, 0xFE75}, {0xFEFD, 0xFEFE}, {0xFF00, 0xFF00}, + {0xFFBF, 0xFFC1}, {0xFFC8, 0xFFC9}, {0xFFD0, 0xFFD1}, + {0xFFD8, 0xFFD9}, {0xFFDD, 0xFFDF}, {0xFFE7, 0xFFE7}, + {0xFFEF, 0xFFF8}, {0xFFFE, 0xFFFF}, {0x1000C, 0x1000C}, + {0x10027, 0x10027}, {0x1003B, 0x1003B}, {0x1003E, 0x1003E}, + {0x1004E, 0x1004F}, {0x1005E, 0x1007F}, {0x100FB, 0x100FF}, + {0x10103, 0x10106}, {0x10134, 0x10136}, {0x1018F, 0x1018F}, + {0x1019C, 0x1019F}, {0x101A1, 0x101CF}, {0x101FE, 0x1027F}, + {0x1029D, 0x1029F}, {0x102D1, 0x102DF}, {0x102FC, 0x102FF}, + {0x10324, 0x1032F}, {0x1034B, 0x1034F}, {0x1037B, 0x1037F}, + {0x1039E, 0x1039E}, {0x103C4, 0x103C7}, {0x103D6, 0x103FF}, + {0x1049E, 0x1049F}, {0x104AA, 0x104AF}, {0x104D4, 0x104D7}, + {0x104FC, 0x104FF}, {0x10528, 0x1052F}, {0x10564, 0x1056E}, + {0x10570, 0x105FF}, {0x10737, 0x1073F}, {0x10756, 0x1075F}, + {0x10768, 0x107FF}, {0x10806, 0x10807}, {0x10809, 0x10809}, + {0x10836, 0x10836}, {0x10839, 0x1083B}, {0x1083D, 0x1083E}, + {0x10856, 0x10856}, {0x1089F, 0x108A6}, {0x108B0, 0x108DF}, + {0x108F3, 0x108F3}, {0x108F6, 0x108FA}, {0x1091C, 0x1091E}, + {0x1093A, 0x1093E}, {0x10940, 0x1097F}, {0x109B8, 0x109BB}, + {0x109D0, 0x109D1}, {0x10A04, 0x10A04}, {0x10A07, 0x10A0B}, + {0x10A14, 0x10A14}, {0x10A18, 0x10A18}, {0x10A34, 0x10A37}, + {0x10A3B, 0x10A3E}, {0x10A48, 0x10A4F}, {0x10A59, 0x10A5F}, + {0x10AA0, 0x10ABF}, {0x10AE7, 0x10AEA}, {0x10AF7, 0x10AFF}, + {0x10B36, 0x10B38}, {0x10B56, 0x10B57}, {0x10B73, 0x10B77}, + {0x10B92, 0x10B98}, {0x10B9D, 0x10BA8}, {0x10BB0, 0x10BFF}, + {0x10C49, 0x10C7F}, {0x10CB3, 0x10CBF}, {0x10CF3, 0x10CF9}, + {0x10D00, 0x10E5F}, {0x10E7F, 0x10FFF}, {0x1104E, 0x11051}, + {0x11070, 0x1107E}, {0x110C2, 0x110CF}, {0x110E9, 0x110EF}, + {0x110FA, 0x110FF}, {0x11135, 0x11135}, {0x11144, 0x1114F}, + {0x11177, 0x1117F}, {0x111CE, 0x111CF}, {0x111E0, 0x111E0}, + {0x111F5, 0x111FF}, {0x11212, 0x11212}, {0x1123F, 0x1127F}, + {0x11287, 0x11287}, {0x11289, 0x11289}, {0x1128E, 0x1128E}, + {0x1129E, 0x1129E}, {0x112AA, 0x112AF}, {0x112EB, 0x112EF}, + {0x112FA, 0x112FF}, {0x11304, 0x11304}, {0x1130D, 0x1130E}, + {0x11311, 0x11312}, {0x11329, 0x11329}, {0x11331, 0x11331}, + {0x11334, 0x11334}, {0x1133A, 0x1133B}, {0x11345, 0x11346}, + {0x11349, 0x1134A}, {0x1134E, 0x1134F}, {0x11351, 0x11356}, + {0x11358, 0x1135C}, {0x11364, 0x11365}, {0x1136D, 0x1136F}, + {0x11375, 0x113FF}, {0x1145A, 0x1145A}, {0x1145C, 0x1145C}, + {0x1145E, 0x1147F}, {0x114C8, 0x114CF}, {0x114DA, 0x1157F}, + {0x115B6, 0x115B7}, {0x115DE, 0x115FF}, {0x11645, 0x1164F}, + {0x1165A, 0x1165F}, {0x1166D, 0x1167F}, {0x116B8, 0x116BF}, + {0x116CA, 0x116FF}, {0x1171A, 0x1171C}, {0x1172C, 0x1172F}, + {0x11740, 0x1189F}, {0x118F3, 0x118FE}, {0x11900, 0x11ABF}, + {0x11AF9, 0x11BFF}, {0x11C09, 0x11C09}, {0x11C37, 0x11C37}, + {0x11C46, 0x11C4F}, {0x11C6D, 0x11C6F}, {0x11C90, 0x11C91}, + {0x11CA8, 0x11CA8}, {0x11CB7, 0x11FFF}, {0x1239A, 0x123FF}, + {0x1246F, 0x1246F}, {0x12475, 0x1247F}, {0x12544, 0x12FFF}, + {0x1342F, 0x143FF}, {0x14647, 0x167FF}, {0x16A39, 0x16A3F}, + {0x16A5F, 0x16A5F}, {0x16A6A, 0x16A6D}, {0x16A70, 0x16ACF}, + {0x16AEE, 0x16AEF}, {0x16AF6, 0x16AFF}, {0x16B46, 0x16B4F}, + {0x16B5A, 0x16B5A}, {0x16B62, 0x16B62}, {0x16B78, 0x16B7C}, + {0x16B90, 0x16EFF}, {0x16F45, 0x16F4F}, {0x16F7F, 0x16F8E}, + {0x16FA0, 0x16FDF}, {0x16FE1, 0x16FFF}, {0x187ED, 0x187FF}, + {0x18AF3, 0x1AFFF}, {0x1B002, 0x1BBFF}, {0x1BC6B, 0x1BC6F}, + {0x1BC7D, 0x1BC7F}, {0x1BC89, 0x1BC8F}, {0x1BC9A, 0x1BC9B}, + {0x1BCA4, 0x1CFFF}, {0x1D0F6, 0x1D0FF}, {0x1D127, 0x1D128}, + {0x1D1E9, 0x1D1FF}, {0x1D246, 0x1D2FF}, {0x1D357, 0x1D35F}, + {0x1D372, 0x1D3FF}, {0x1D455, 0x1D455}, {0x1D49D, 0x1D49D}, + {0x1D4A0, 0x1D4A1}, {0x1D4A3, 0x1D4A4}, {0x1D4A7, 0x1D4A8}, + {0x1D4AD, 0x1D4AD}, {0x1D4BA, 0x1D4BA}, {0x1D4BC, 0x1D4BC}, + {0x1D4C4, 0x1D4C4}, {0x1D506, 0x1D506}, {0x1D50B, 0x1D50C}, + {0x1D515, 0x1D515}, {0x1D51D, 0x1D51D}, {0x1D53A, 0x1D53A}, + {0x1D53F, 0x1D53F}, {0x1D545, 0x1D545}, {0x1D547, 0x1D549}, + {0x1D551, 0x1D551}, {0x1D6A6, 0x1D6A7}, {0x1D7CC, 0x1D7CD}, + {0x1DA8C, 0x1DA9A}, {0x1DAA0, 0x1DAA0}, {0x1DAB0, 0x1DFFF}, + {0x1E007, 0x1E007}, {0x1E019, 0x1E01A}, {0x1E022, 0x1E022}, + {0x1E025, 0x1E025}, {0x1E02B, 0x1E7FF}, {0x1E8C5, 0x1E8C6}, + {0x1E8D7, 0x1E8FF}, {0x1E94B, 0x1E94F}, {0x1E95A, 0x1E95D}, + {0x1E960, 0x1EDFF}, {0x1EE04, 0x1EE04}, {0x1EE20, 0x1EE20}, + {0x1EE23, 0x1EE23}, {0x1EE25, 0x1EE26}, {0x1EE28, 0x1EE28}, + {0x1EE33, 0x1EE33}, {0x1EE38, 0x1EE38}, {0x1EE3A, 0x1EE3A}, + {0x1EE3C, 0x1EE41}, {0x1EE43, 0x1EE46}, {0x1EE48, 0x1EE48}, + {0x1EE4A, 0x1EE4A}, {0x1EE4C, 0x1EE4C}, {0x1EE50, 0x1EE50}, + {0x1EE53, 0x1EE53}, {0x1EE55, 0x1EE56}, {0x1EE58, 0x1EE58}, + {0x1EE5A, 0x1EE5A}, {0x1EE5C, 0x1EE5C}, {0x1EE5E, 0x1EE5E}, + {0x1EE60, 0x1EE60}, {0x1EE63, 0x1EE63}, {0x1EE65, 0x1EE66}, + {0x1EE6B, 0x1EE6B}, {0x1EE73, 0x1EE73}, {0x1EE78, 0x1EE78}, + {0x1EE7D, 0x1EE7D}, {0x1EE7F, 0x1EE7F}, {0x1EE8A, 0x1EE8A}, + {0x1EE9C, 0x1EEA0}, {0x1EEA4, 0x1EEA4}, {0x1EEAA, 0x1EEAA}, + {0x1EEBC, 0x1EEEF}, {0x1EEF2, 0x1EFFF}, {0x1F02C, 0x1F02F}, + {0x1F094, 0x1F09F}, {0x1F0AF, 0x1F0B0}, {0x1F0C0, 0x1F0C0}, + {0x1F0D0, 0x1F0D0}, {0x1F0F6, 0x1F0FF}, {0x1F10D, 0x1F10F}, + {0x1F12F, 0x1F12F}, {0x1F16C, 0x1F16F}, {0x1F1AD, 0x1F1E5}, + {0x1F203, 0x1F20F}, {0x1F23C, 0x1F23F}, {0x1F249, 0x1F24F}, + {0x1F252, 0x1F2FF}, {0x1F6D3, 0x1F6DF}, {0x1F6ED, 0x1F6EF}, + {0x1F6F7, 0x1F6FF}, {0x1F774, 0x1F77F}, {0x1F7D5, 0x1F7FF}, + {0x1F80C, 0x1F80F}, {0x1F848, 0x1F84F}, {0x1F85A, 0x1F85F}, + {0x1F888, 0x1F88F}, {0x1F8AE, 0x1F90F}, {0x1F91F, 0x1F91F}, + {0x1F928, 0x1F92F}, {0x1F931, 0x1F932}, {0x1F93F, 0x1F93F}, + {0x1F94C, 0x1F94F}, {0x1F95F, 0x1F97F}, {0x1F992, 0x1F9BF}, + {0x1F9C1, 0x1FFFF}, {0x2A6D7, 0x2A6FF}, {0x2B735, 0x2B73F}, + {0x2B81E, 0x2B81F}, {0x2CEA2, 0x2F7FF}, {0x2FA1E, 0xE0000}, + {0xE0002, 0xE001F}, {0xE0080, 0xE00FF}, {0xE01F0, 0xEFFFF}, + {0xFFFFE, 0xFFFFF}, +} + +var neutral = table{ + {0x0000, 0x001F}, {0x007F, 0x007F}, {0x0080, 0x009F}, + {0x00A0, 0x00A0}, {0x00A9, 0x00A9}, {0x00AB, 0x00AB}, + {0x00B5, 0x00B5}, {0x00BB, 0x00BB}, {0x00C0, 0x00C5}, + {0x00C7, 0x00CF}, {0x00D1, 0x00D6}, {0x00D9, 0x00DD}, + {0x00E2, 0x00E5}, {0x00E7, 0x00E7}, {0x00EB, 0x00EB}, + {0x00EE, 0x00EF}, {0x00F1, 0x00F1}, {0x00F4, 0x00F6}, + {0x00FB, 0x00FB}, {0x00FD, 0x00FD}, {0x00FF, 0x00FF}, + {0x0100, 0x0100}, {0x0102, 0x0110}, {0x0112, 0x0112}, + {0x0114, 0x011A}, {0x011C, 0x0125}, {0x0128, 0x012A}, + {0x012C, 0x0130}, {0x0134, 0x0137}, {0x0139, 0x013E}, + {0x0143, 0x0143}, {0x0145, 0x0147}, {0x014C, 0x014C}, + {0x014E, 0x0151}, {0x0154, 0x0165}, {0x0168, 0x016A}, + {0x016C, 0x017F}, {0x0180, 0x01BA}, {0x01BB, 0x01BB}, + {0x01BC, 0x01BF}, {0x01C0, 0x01C3}, {0x01C4, 0x01CD}, + {0x01CF, 0x01CF}, {0x01D1, 0x01D1}, {0x01D3, 0x01D3}, + {0x01D5, 0x01D5}, {0x01D7, 0x01D7}, {0x01D9, 0x01D9}, + {0x01DB, 0x01DB}, {0x01DD, 0x024F}, {0x0250, 0x0250}, + {0x0252, 0x0260}, {0x0262, 0x0293}, {0x0294, 0x0294}, + {0x0295, 0x02AF}, {0x02B0, 0x02C1}, {0x02C2, 0x02C3}, + {0x02C5, 0x02C5}, {0x02C6, 0x02C6}, {0x02C8, 0x02C8}, + {0x02CC, 0x02CC}, {0x02CE, 0x02CF}, {0x02D1, 0x02D1}, + {0x02D2, 0x02D7}, {0x02DC, 0x02DC}, {0x02DE, 0x02DE}, + {0x02E0, 0x02E4}, {0x02E5, 0x02EB}, {0x02EC, 0x02EC}, + {0x02ED, 0x02ED}, {0x02EE, 0x02EE}, {0x02EF, 0x02FF}, + {0x0370, 0x0373}, {0x0374, 0x0374}, {0x0375, 0x0375}, + {0x0376, 0x0377}, {0x037A, 0x037A}, {0x037B, 0x037D}, + {0x037E, 0x037E}, {0x037F, 0x037F}, {0x0384, 0x0385}, + {0x0386, 0x0386}, {0x0387, 0x0387}, {0x0388, 0x038A}, + {0x038C, 0x038C}, {0x038E, 0x0390}, {0x03AA, 0x03B0}, + {0x03C2, 0x03C2}, {0x03CA, 0x03F5}, {0x03F6, 0x03F6}, + {0x03F7, 0x03FF}, {0x0400, 0x0400}, {0x0402, 0x040F}, + {0x0450, 0x0450}, {0x0452, 0x0481}, {0x0482, 0x0482}, + {0x0483, 0x0487}, {0x0488, 0x0489}, {0x048A, 0x04FF}, + {0x0500, 0x052F}, {0x0531, 0x0556}, {0x0559, 0x0559}, + {0x055A, 0x055F}, {0x0561, 0x0587}, {0x0589, 0x0589}, + {0x058A, 0x058A}, {0x058D, 0x058E}, {0x058F, 0x058F}, + {0x0591, 0x05BD}, {0x05BE, 0x05BE}, {0x05BF, 0x05BF}, + {0x05C0, 0x05C0}, {0x05C1, 0x05C2}, {0x05C3, 0x05C3}, + {0x05C4, 0x05C5}, {0x05C6, 0x05C6}, {0x05C7, 0x05C7}, + {0x05D0, 0x05EA}, {0x05F0, 0x05F2}, {0x05F3, 0x05F4}, + {0x0600, 0x0605}, {0x0606, 0x0608}, {0x0609, 0x060A}, + {0x060B, 0x060B}, {0x060C, 0x060D}, {0x060E, 0x060F}, + {0x0610, 0x061A}, {0x061B, 0x061B}, {0x061C, 0x061C}, + {0x061E, 0x061F}, {0x0620, 0x063F}, {0x0640, 0x0640}, + {0x0641, 0x064A}, {0x064B, 0x065F}, {0x0660, 0x0669}, + {0x066A, 0x066D}, {0x066E, 0x066F}, {0x0670, 0x0670}, + {0x0671, 0x06D3}, {0x06D4, 0x06D4}, {0x06D5, 0x06D5}, + {0x06D6, 0x06DC}, {0x06DD, 0x06DD}, {0x06DE, 0x06DE}, + {0x06DF, 0x06E4}, {0x06E5, 0x06E6}, {0x06E7, 0x06E8}, + {0x06E9, 0x06E9}, {0x06EA, 0x06ED}, {0x06EE, 0x06EF}, + {0x06F0, 0x06F9}, {0x06FA, 0x06FC}, {0x06FD, 0x06FE}, + {0x06FF, 0x06FF}, {0x0700, 0x070D}, {0x070F, 0x070F}, + {0x0710, 0x0710}, {0x0711, 0x0711}, {0x0712, 0x072F}, + {0x0730, 0x074A}, {0x074D, 0x074F}, {0x0750, 0x077F}, + {0x0780, 0x07A5}, {0x07A6, 0x07B0}, {0x07B1, 0x07B1}, + {0x07C0, 0x07C9}, {0x07CA, 0x07EA}, {0x07EB, 0x07F3}, + {0x07F4, 0x07F5}, {0x07F6, 0x07F6}, {0x07F7, 0x07F9}, + {0x07FA, 0x07FA}, {0x0800, 0x0815}, {0x0816, 0x0819}, + {0x081A, 0x081A}, {0x081B, 0x0823}, {0x0824, 0x0824}, + {0x0825, 0x0827}, {0x0828, 0x0828}, {0x0829, 0x082D}, + {0x0830, 0x083E}, {0x0840, 0x0858}, {0x0859, 0x085B}, + {0x085E, 0x085E}, {0x08A0, 0x08B4}, {0x08B6, 0x08BD}, + {0x08D4, 0x08E1}, {0x08E2, 0x08E2}, {0x08E3, 0x08FF}, + {0x0900, 0x0902}, {0x0903, 0x0903}, {0x0904, 0x0939}, + {0x093A, 0x093A}, {0x093B, 0x093B}, {0x093C, 0x093C}, + {0x093D, 0x093D}, {0x093E, 0x0940}, {0x0941, 0x0948}, + {0x0949, 0x094C}, {0x094D, 0x094D}, {0x094E, 0x094F}, + {0x0950, 0x0950}, {0x0951, 0x0957}, {0x0958, 0x0961}, + {0x0962, 0x0963}, {0x0964, 0x0965}, {0x0966, 0x096F}, + {0x0970, 0x0970}, {0x0971, 0x0971}, {0x0972, 0x097F}, + {0x0980, 0x0980}, {0x0981, 0x0981}, {0x0982, 0x0983}, + {0x0985, 0x098C}, {0x098F, 0x0990}, {0x0993, 0x09A8}, + {0x09AA, 0x09B0}, {0x09B2, 0x09B2}, {0x09B6, 0x09B9}, + {0x09BC, 0x09BC}, {0x09BD, 0x09BD}, {0x09BE, 0x09C0}, + {0x09C1, 0x09C4}, {0x09C7, 0x09C8}, {0x09CB, 0x09CC}, + {0x09CD, 0x09CD}, {0x09CE, 0x09CE}, {0x09D7, 0x09D7}, + {0x09DC, 0x09DD}, {0x09DF, 0x09E1}, {0x09E2, 0x09E3}, + {0x09E6, 0x09EF}, {0x09F0, 0x09F1}, {0x09F2, 0x09F3}, + {0x09F4, 0x09F9}, {0x09FA, 0x09FA}, {0x09FB, 0x09FB}, + {0x0A01, 0x0A02}, {0x0A03, 0x0A03}, {0x0A05, 0x0A0A}, + {0x0A0F, 0x0A10}, {0x0A13, 0x0A28}, {0x0A2A, 0x0A30}, + {0x0A32, 0x0A33}, {0x0A35, 0x0A36}, {0x0A38, 0x0A39}, + {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A40}, {0x0A41, 0x0A42}, + {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51}, + {0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E}, {0x0A66, 0x0A6F}, + {0x0A70, 0x0A71}, {0x0A72, 0x0A74}, {0x0A75, 0x0A75}, + {0x0A81, 0x0A82}, {0x0A83, 0x0A83}, {0x0A85, 0x0A8D}, + {0x0A8F, 0x0A91}, {0x0A93, 0x0AA8}, {0x0AAA, 0x0AB0}, + {0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, {0x0ABC, 0x0ABC}, + {0x0ABD, 0x0ABD}, {0x0ABE, 0x0AC0}, {0x0AC1, 0x0AC5}, + {0x0AC7, 0x0AC8}, {0x0AC9, 0x0AC9}, {0x0ACB, 0x0ACC}, + {0x0ACD, 0x0ACD}, {0x0AD0, 0x0AD0}, {0x0AE0, 0x0AE1}, + {0x0AE2, 0x0AE3}, {0x0AE6, 0x0AEF}, {0x0AF0, 0x0AF0}, + {0x0AF1, 0x0AF1}, {0x0AF9, 0x0AF9}, {0x0B01, 0x0B01}, + {0x0B02, 0x0B03}, {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10}, + {0x0B13, 0x0B28}, {0x0B2A, 0x0B30}, {0x0B32, 0x0B33}, + {0x0B35, 0x0B39}, {0x0B3C, 0x0B3C}, {0x0B3D, 0x0B3D}, + {0x0B3E, 0x0B3E}, {0x0B3F, 0x0B3F}, {0x0B40, 0x0B40}, + {0x0B41, 0x0B44}, {0x0B47, 0x0B48}, {0x0B4B, 0x0B4C}, + {0x0B4D, 0x0B4D}, {0x0B56, 0x0B56}, {0x0B57, 0x0B57}, + {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B61}, {0x0B62, 0x0B63}, + {0x0B66, 0x0B6F}, {0x0B70, 0x0B70}, {0x0B71, 0x0B71}, + {0x0B72, 0x0B77}, {0x0B82, 0x0B82}, {0x0B83, 0x0B83}, + {0x0B85, 0x0B8A}, {0x0B8E, 0x0B90}, {0x0B92, 0x0B95}, + {0x0B99, 0x0B9A}, {0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F}, + {0x0BA3, 0x0BA4}, {0x0BA8, 0x0BAA}, {0x0BAE, 0x0BB9}, + {0x0BBE, 0x0BBF}, {0x0BC0, 0x0BC0}, {0x0BC1, 0x0BC2}, + {0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCC}, {0x0BCD, 0x0BCD}, + {0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, {0x0BE6, 0x0BEF}, + {0x0BF0, 0x0BF2}, {0x0BF3, 0x0BF8}, {0x0BF9, 0x0BF9}, + {0x0BFA, 0x0BFA}, {0x0C00, 0x0C00}, {0x0C01, 0x0C03}, + {0x0C05, 0x0C0C}, {0x0C0E, 0x0C10}, {0x0C12, 0x0C28}, + {0x0C2A, 0x0C39}, {0x0C3D, 0x0C3D}, {0x0C3E, 0x0C40}, + {0x0C41, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, + {0x0C55, 0x0C56}, {0x0C58, 0x0C5A}, {0x0C60, 0x0C61}, + {0x0C62, 0x0C63}, {0x0C66, 0x0C6F}, {0x0C78, 0x0C7E}, + {0x0C7F, 0x0C7F}, {0x0C80, 0x0C80}, {0x0C81, 0x0C81}, + {0x0C82, 0x0C83}, {0x0C85, 0x0C8C}, {0x0C8E, 0x0C90}, + {0x0C92, 0x0CA8}, {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9}, + {0x0CBC, 0x0CBC}, {0x0CBD, 0x0CBD}, {0x0CBE, 0x0CBE}, + {0x0CBF, 0x0CBF}, {0x0CC0, 0x0CC4}, {0x0CC6, 0x0CC6}, + {0x0CC7, 0x0CC8}, {0x0CCA, 0x0CCB}, {0x0CCC, 0x0CCD}, + {0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE1}, + {0x0CE2, 0x0CE3}, {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2}, + {0x0D01, 0x0D01}, {0x0D02, 0x0D03}, {0x0D05, 0x0D0C}, + {0x0D0E, 0x0D10}, {0x0D12, 0x0D3A}, {0x0D3D, 0x0D3D}, + {0x0D3E, 0x0D40}, {0x0D41, 0x0D44}, {0x0D46, 0x0D48}, + {0x0D4A, 0x0D4C}, {0x0D4D, 0x0D4D}, {0x0D4E, 0x0D4E}, + {0x0D4F, 0x0D4F}, {0x0D54, 0x0D56}, {0x0D57, 0x0D57}, + {0x0D58, 0x0D5E}, {0x0D5F, 0x0D61}, {0x0D62, 0x0D63}, + {0x0D66, 0x0D6F}, {0x0D70, 0x0D78}, {0x0D79, 0x0D79}, + {0x0D7A, 0x0D7F}, {0x0D82, 0x0D83}, {0x0D85, 0x0D96}, + {0x0D9A, 0x0DB1}, {0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD}, + {0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD1}, + {0x0DD2, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF}, + {0x0DE6, 0x0DEF}, {0x0DF2, 0x0DF3}, {0x0DF4, 0x0DF4}, + {0x0E01, 0x0E30}, {0x0E31, 0x0E31}, {0x0E32, 0x0E33}, + {0x0E34, 0x0E3A}, {0x0E3F, 0x0E3F}, {0x0E40, 0x0E45}, + {0x0E46, 0x0E46}, {0x0E47, 0x0E4E}, {0x0E4F, 0x0E4F}, + {0x0E50, 0x0E59}, {0x0E5A, 0x0E5B}, {0x0E81, 0x0E82}, + {0x0E84, 0x0E84}, {0x0E87, 0x0E88}, {0x0E8A, 0x0E8A}, + {0x0E8D, 0x0E8D}, {0x0E94, 0x0E97}, {0x0E99, 0x0E9F}, + {0x0EA1, 0x0EA3}, {0x0EA5, 0x0EA5}, {0x0EA7, 0x0EA7}, + {0x0EAA, 0x0EAB}, {0x0EAD, 0x0EB0}, {0x0EB1, 0x0EB1}, + {0x0EB2, 0x0EB3}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC}, + {0x0EBD, 0x0EBD}, {0x0EC0, 0x0EC4}, {0x0EC6, 0x0EC6}, + {0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF}, + {0x0F00, 0x0F00}, {0x0F01, 0x0F03}, {0x0F04, 0x0F12}, + {0x0F13, 0x0F13}, {0x0F14, 0x0F14}, {0x0F15, 0x0F17}, + {0x0F18, 0x0F19}, {0x0F1A, 0x0F1F}, {0x0F20, 0x0F29}, + {0x0F2A, 0x0F33}, {0x0F34, 0x0F34}, {0x0F35, 0x0F35}, + {0x0F36, 0x0F36}, {0x0F37, 0x0F37}, {0x0F38, 0x0F38}, + {0x0F39, 0x0F39}, {0x0F3A, 0x0F3A}, {0x0F3B, 0x0F3B}, + {0x0F3C, 0x0F3C}, {0x0F3D, 0x0F3D}, {0x0F3E, 0x0F3F}, + {0x0F40, 0x0F47}, {0x0F49, 0x0F6C}, {0x0F71, 0x0F7E}, + {0x0F7F, 0x0F7F}, {0x0F80, 0x0F84}, {0x0F85, 0x0F85}, + {0x0F86, 0x0F87}, {0x0F88, 0x0F8C}, {0x0F8D, 0x0F97}, + {0x0F99, 0x0FBC}, {0x0FBE, 0x0FC5}, {0x0FC6, 0x0FC6}, + {0x0FC7, 0x0FCC}, {0x0FCE, 0x0FCF}, {0x0FD0, 0x0FD4}, + {0x0FD5, 0x0FD8}, {0x0FD9, 0x0FDA}, {0x1000, 0x102A}, + {0x102B, 0x102C}, {0x102D, 0x1030}, {0x1031, 0x1031}, + {0x1032, 0x1037}, {0x1038, 0x1038}, {0x1039, 0x103A}, + {0x103B, 0x103C}, {0x103D, 0x103E}, {0x103F, 0x103F}, + {0x1040, 0x1049}, {0x104A, 0x104F}, {0x1050, 0x1055}, + {0x1056, 0x1057}, {0x1058, 0x1059}, {0x105A, 0x105D}, + {0x105E, 0x1060}, {0x1061, 0x1061}, {0x1062, 0x1064}, + {0x1065, 0x1066}, {0x1067, 0x106D}, {0x106E, 0x1070}, + {0x1071, 0x1074}, {0x1075, 0x1081}, {0x1082, 0x1082}, + {0x1083, 0x1084}, {0x1085, 0x1086}, {0x1087, 0x108C}, + {0x108D, 0x108D}, {0x108E, 0x108E}, {0x108F, 0x108F}, + {0x1090, 0x1099}, {0x109A, 0x109C}, {0x109D, 0x109D}, + {0x109E, 0x109F}, {0x10A0, 0x10C5}, {0x10C7, 0x10C7}, + {0x10CD, 0x10CD}, {0x10D0, 0x10FA}, {0x10FB, 0x10FB}, + {0x10FC, 0x10FC}, {0x10FD, 0x10FF}, {0x1160, 0x11FF}, + {0x1200, 0x1248}, {0x124A, 0x124D}, {0x1250, 0x1256}, + {0x1258, 0x1258}, {0x125A, 0x125D}, {0x1260, 0x1288}, + {0x128A, 0x128D}, {0x1290, 0x12B0}, {0x12B2, 0x12B5}, + {0x12B8, 0x12BE}, {0x12C0, 0x12C0}, {0x12C2, 0x12C5}, + {0x12C8, 0x12D6}, {0x12D8, 0x1310}, {0x1312, 0x1315}, + {0x1318, 0x135A}, {0x135D, 0x135F}, {0x1360, 0x1368}, + {0x1369, 0x137C}, {0x1380, 0x138F}, {0x1390, 0x1399}, + {0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x1400}, + {0x1401, 0x166C}, {0x166D, 0x166E}, {0x166F, 0x167F}, + {0x1680, 0x1680}, {0x1681, 0x169A}, {0x169B, 0x169B}, + {0x169C, 0x169C}, {0x16A0, 0x16EA}, {0x16EB, 0x16ED}, + {0x16EE, 0x16F0}, {0x16F1, 0x16F8}, {0x1700, 0x170C}, + {0x170E, 0x1711}, {0x1712, 0x1714}, {0x1720, 0x1731}, + {0x1732, 0x1734}, {0x1735, 0x1736}, {0x1740, 0x1751}, + {0x1752, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770}, + {0x1772, 0x1773}, {0x1780, 0x17B3}, {0x17B4, 0x17B5}, + {0x17B6, 0x17B6}, {0x17B7, 0x17BD}, {0x17BE, 0x17C5}, + {0x17C6, 0x17C6}, {0x17C7, 0x17C8}, {0x17C9, 0x17D3}, + {0x17D4, 0x17D6}, {0x17D7, 0x17D7}, {0x17D8, 0x17DA}, + {0x17DB, 0x17DB}, {0x17DC, 0x17DC}, {0x17DD, 0x17DD}, + {0x17E0, 0x17E9}, {0x17F0, 0x17F9}, {0x1800, 0x1805}, + {0x1806, 0x1806}, {0x1807, 0x180A}, {0x180B, 0x180D}, + {0x180E, 0x180E}, {0x1810, 0x1819}, {0x1820, 0x1842}, + {0x1843, 0x1843}, {0x1844, 0x1877}, {0x1880, 0x1884}, + {0x1885, 0x1886}, {0x1887, 0x18A8}, {0x18A9, 0x18A9}, + {0x18AA, 0x18AA}, {0x18B0, 0x18F5}, {0x1900, 0x191E}, + {0x1920, 0x1922}, {0x1923, 0x1926}, {0x1927, 0x1928}, + {0x1929, 0x192B}, {0x1930, 0x1931}, {0x1932, 0x1932}, + {0x1933, 0x1938}, {0x1939, 0x193B}, {0x1940, 0x1940}, + {0x1944, 0x1945}, {0x1946, 0x194F}, {0x1950, 0x196D}, + {0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9}, + {0x19D0, 0x19D9}, {0x19DA, 0x19DA}, {0x19DE, 0x19DF}, + {0x19E0, 0x19FF}, {0x1A00, 0x1A16}, {0x1A17, 0x1A18}, + {0x1A19, 0x1A1A}, {0x1A1B, 0x1A1B}, {0x1A1E, 0x1A1F}, + {0x1A20, 0x1A54}, {0x1A55, 0x1A55}, {0x1A56, 0x1A56}, + {0x1A57, 0x1A57}, {0x1A58, 0x1A5E}, {0x1A60, 0x1A60}, + {0x1A61, 0x1A61}, {0x1A62, 0x1A62}, {0x1A63, 0x1A64}, + {0x1A65, 0x1A6C}, {0x1A6D, 0x1A72}, {0x1A73, 0x1A7C}, + {0x1A7F, 0x1A7F}, {0x1A80, 0x1A89}, {0x1A90, 0x1A99}, + {0x1AA0, 0x1AA6}, {0x1AA7, 0x1AA7}, {0x1AA8, 0x1AAD}, + {0x1AB0, 0x1ABD}, {0x1ABE, 0x1ABE}, {0x1B00, 0x1B03}, + {0x1B04, 0x1B04}, {0x1B05, 0x1B33}, {0x1B34, 0x1B34}, + {0x1B35, 0x1B35}, {0x1B36, 0x1B3A}, {0x1B3B, 0x1B3B}, + {0x1B3C, 0x1B3C}, {0x1B3D, 0x1B41}, {0x1B42, 0x1B42}, + {0x1B43, 0x1B44}, {0x1B45, 0x1B4B}, {0x1B50, 0x1B59}, + {0x1B5A, 0x1B60}, {0x1B61, 0x1B6A}, {0x1B6B, 0x1B73}, + {0x1B74, 0x1B7C}, {0x1B80, 0x1B81}, {0x1B82, 0x1B82}, + {0x1B83, 0x1BA0}, {0x1BA1, 0x1BA1}, {0x1BA2, 0x1BA5}, + {0x1BA6, 0x1BA7}, {0x1BA8, 0x1BA9}, {0x1BAA, 0x1BAA}, + {0x1BAB, 0x1BAD}, {0x1BAE, 0x1BAF}, {0x1BB0, 0x1BB9}, + {0x1BBA, 0x1BBF}, {0x1BC0, 0x1BE5}, {0x1BE6, 0x1BE6}, + {0x1BE7, 0x1BE7}, {0x1BE8, 0x1BE9}, {0x1BEA, 0x1BEC}, + {0x1BED, 0x1BED}, {0x1BEE, 0x1BEE}, {0x1BEF, 0x1BF1}, + {0x1BF2, 0x1BF3}, {0x1BFC, 0x1BFF}, {0x1C00, 0x1C23}, + {0x1C24, 0x1C2B}, {0x1C2C, 0x1C33}, {0x1C34, 0x1C35}, + {0x1C36, 0x1C37}, {0x1C3B, 0x1C3F}, {0x1C40, 0x1C49}, + {0x1C4D, 0x1C4F}, {0x1C50, 0x1C59}, {0x1C5A, 0x1C77}, + {0x1C78, 0x1C7D}, {0x1C7E, 0x1C7F}, {0x1C80, 0x1C88}, + {0x1CC0, 0x1CC7}, {0x1CD0, 0x1CD2}, {0x1CD3, 0x1CD3}, + {0x1CD4, 0x1CE0}, {0x1CE1, 0x1CE1}, {0x1CE2, 0x1CE8}, + {0x1CE9, 0x1CEC}, {0x1CED, 0x1CED}, {0x1CEE, 0x1CF1}, + {0x1CF2, 0x1CF3}, {0x1CF4, 0x1CF4}, {0x1CF5, 0x1CF6}, + {0x1CF8, 0x1CF9}, {0x1D00, 0x1D2B}, {0x1D2C, 0x1D6A}, + {0x1D6B, 0x1D77}, {0x1D78, 0x1D78}, {0x1D79, 0x1D7F}, + {0x1D80, 0x1D9A}, {0x1D9B, 0x1DBF}, {0x1DC0, 0x1DF5}, + {0x1DFB, 0x1DFF}, {0x1E00, 0x1EFF}, {0x1F00, 0x1F15}, + {0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D}, + {0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B}, + {0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4}, + {0x1FB6, 0x1FBC}, {0x1FBD, 0x1FBD}, {0x1FBE, 0x1FBE}, + {0x1FBF, 0x1FC1}, {0x1FC2, 0x1FC4}, {0x1FC6, 0x1FCC}, + {0x1FCD, 0x1FCF}, {0x1FD0, 0x1FD3}, {0x1FD6, 0x1FDB}, + {0x1FDD, 0x1FDF}, {0x1FE0, 0x1FEC}, {0x1FED, 0x1FEF}, + {0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFC}, {0x1FFD, 0x1FFE}, + {0x2000, 0x200A}, {0x200B, 0x200F}, {0x2011, 0x2012}, + {0x2017, 0x2017}, {0x201A, 0x201A}, {0x201B, 0x201B}, + {0x201E, 0x201E}, {0x201F, 0x201F}, {0x2023, 0x2023}, + {0x2028, 0x2028}, {0x2029, 0x2029}, {0x202A, 0x202E}, + {0x202F, 0x202F}, {0x2031, 0x2031}, {0x2034, 0x2034}, + {0x2036, 0x2038}, {0x2039, 0x2039}, {0x203A, 0x203A}, + {0x203C, 0x203D}, {0x203F, 0x2040}, {0x2041, 0x2043}, + {0x2044, 0x2044}, {0x2045, 0x2045}, {0x2046, 0x2046}, + {0x2047, 0x2051}, {0x2052, 0x2052}, {0x2053, 0x2053}, + {0x2054, 0x2054}, {0x2055, 0x205E}, {0x205F, 0x205F}, + {0x2060, 0x2064}, {0x2066, 0x206F}, {0x2070, 0x2070}, + {0x2071, 0x2071}, {0x2075, 0x2079}, {0x207A, 0x207C}, + {0x207D, 0x207D}, {0x207E, 0x207E}, {0x2080, 0x2080}, + {0x2085, 0x2089}, {0x208A, 0x208C}, {0x208D, 0x208D}, + {0x208E, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8}, + {0x20AA, 0x20AB}, {0x20AD, 0x20BE}, {0x20D0, 0x20DC}, + {0x20DD, 0x20E0}, {0x20E1, 0x20E1}, {0x20E2, 0x20E4}, + {0x20E5, 0x20F0}, {0x2100, 0x2101}, {0x2102, 0x2102}, + {0x2104, 0x2104}, {0x2106, 0x2106}, {0x2107, 0x2107}, + {0x2108, 0x2108}, {0x210A, 0x2112}, {0x2114, 0x2114}, + {0x2115, 0x2115}, {0x2117, 0x2117}, {0x2118, 0x2118}, + {0x2119, 0x211D}, {0x211E, 0x2120}, {0x2123, 0x2123}, + {0x2124, 0x2124}, {0x2125, 0x2125}, {0x2127, 0x2127}, + {0x2128, 0x2128}, {0x2129, 0x2129}, {0x212A, 0x212A}, + {0x212C, 0x212D}, {0x212E, 0x212E}, {0x212F, 0x2134}, + {0x2135, 0x2138}, {0x2139, 0x2139}, {0x213A, 0x213B}, + {0x213C, 0x213F}, {0x2140, 0x2144}, {0x2145, 0x2149}, + {0x214A, 0x214A}, {0x214B, 0x214B}, {0x214C, 0x214D}, + {0x214E, 0x214E}, {0x214F, 0x214F}, {0x2150, 0x2152}, + {0x2155, 0x215A}, {0x215F, 0x215F}, {0x216C, 0x216F}, + {0x217A, 0x2182}, {0x2183, 0x2184}, {0x2185, 0x2188}, + {0x218A, 0x218B}, {0x219A, 0x219B}, {0x219C, 0x219F}, + {0x21A0, 0x21A0}, {0x21A1, 0x21A2}, {0x21A3, 0x21A3}, + {0x21A4, 0x21A5}, {0x21A6, 0x21A6}, {0x21A7, 0x21AD}, + {0x21AE, 0x21AE}, {0x21AF, 0x21B7}, {0x21BA, 0x21CD}, + {0x21CE, 0x21CF}, {0x21D0, 0x21D1}, {0x21D3, 0x21D3}, + {0x21D5, 0x21E6}, {0x21E8, 0x21F3}, {0x21F4, 0x21FF}, + {0x2201, 0x2201}, {0x2204, 0x2206}, {0x2209, 0x220A}, + {0x220C, 0x220E}, {0x2210, 0x2210}, {0x2212, 0x2214}, + {0x2216, 0x2219}, {0x221B, 0x221C}, {0x2221, 0x2222}, + {0x2224, 0x2224}, {0x2226, 0x2226}, {0x222D, 0x222D}, + {0x222F, 0x2233}, {0x2238, 0x223B}, {0x223E, 0x2247}, + {0x2249, 0x224B}, {0x224D, 0x2251}, {0x2253, 0x225F}, + {0x2262, 0x2263}, {0x2268, 0x2269}, {0x226C, 0x226D}, + {0x2270, 0x2281}, {0x2284, 0x2285}, {0x2288, 0x2294}, + {0x2296, 0x2298}, {0x229A, 0x22A4}, {0x22A6, 0x22BE}, + {0x22C0, 0x22FF}, {0x2300, 0x2307}, {0x2308, 0x2308}, + {0x2309, 0x2309}, {0x230A, 0x230A}, {0x230B, 0x230B}, + {0x230C, 0x2311}, {0x2313, 0x2319}, {0x231C, 0x231F}, + {0x2320, 0x2321}, {0x2322, 0x2328}, {0x232B, 0x237B}, + {0x237C, 0x237C}, {0x237D, 0x239A}, {0x239B, 0x23B3}, + {0x23B4, 0x23DB}, {0x23DC, 0x23E1}, {0x23E2, 0x23E8}, + {0x23ED, 0x23EF}, {0x23F1, 0x23F2}, {0x23F4, 0x23FE}, + {0x2400, 0x2426}, {0x2440, 0x244A}, {0x24EA, 0x24EA}, + {0x254C, 0x254F}, {0x2574, 0x257F}, {0x2590, 0x2591}, + {0x2596, 0x259F}, {0x25A2, 0x25A2}, {0x25AA, 0x25B1}, + {0x25B4, 0x25B5}, {0x25B8, 0x25BB}, {0x25BE, 0x25BF}, + {0x25C2, 0x25C5}, {0x25C9, 0x25CA}, {0x25CC, 0x25CD}, + {0x25D2, 0x25E1}, {0x25E6, 0x25EE}, {0x25F0, 0x25F7}, + {0x25F8, 0x25FC}, {0x25FF, 0x25FF}, {0x2600, 0x2604}, + {0x2607, 0x2608}, {0x260A, 0x260D}, {0x2610, 0x2613}, + {0x2616, 0x261B}, {0x261D, 0x261D}, {0x261F, 0x263F}, + {0x2641, 0x2641}, {0x2643, 0x2647}, {0x2654, 0x265F}, + {0x2662, 0x2662}, {0x2666, 0x2666}, {0x266B, 0x266B}, + {0x266E, 0x266E}, {0x2670, 0x267E}, {0x2680, 0x2692}, + {0x2694, 0x269D}, {0x26A0, 0x26A0}, {0x26A2, 0x26A9}, + {0x26AC, 0x26BC}, {0x26C0, 0x26C3}, {0x26E2, 0x26E2}, + {0x26E4, 0x26E7}, {0x2700, 0x2704}, {0x2706, 0x2709}, + {0x270C, 0x2727}, {0x2729, 0x273C}, {0x273E, 0x274B}, + {0x274D, 0x274D}, {0x274F, 0x2752}, {0x2756, 0x2756}, + {0x2758, 0x2767}, {0x2768, 0x2768}, {0x2769, 0x2769}, + {0x276A, 0x276A}, {0x276B, 0x276B}, {0x276C, 0x276C}, + {0x276D, 0x276D}, {0x276E, 0x276E}, {0x276F, 0x276F}, + {0x2770, 0x2770}, {0x2771, 0x2771}, {0x2772, 0x2772}, + {0x2773, 0x2773}, {0x2774, 0x2774}, {0x2775, 0x2775}, + {0x2780, 0x2793}, {0x2794, 0x2794}, {0x2798, 0x27AF}, + {0x27B1, 0x27BE}, {0x27C0, 0x27C4}, {0x27C5, 0x27C5}, + {0x27C6, 0x27C6}, {0x27C7, 0x27E5}, {0x27EE, 0x27EE}, + {0x27EF, 0x27EF}, {0x27F0, 0x27FF}, {0x2800, 0x28FF}, + {0x2900, 0x297F}, {0x2980, 0x2982}, {0x2983, 0x2983}, + {0x2984, 0x2984}, {0x2987, 0x2987}, {0x2988, 0x2988}, + {0x2989, 0x2989}, {0x298A, 0x298A}, {0x298B, 0x298B}, + {0x298C, 0x298C}, {0x298D, 0x298D}, {0x298E, 0x298E}, + {0x298F, 0x298F}, {0x2990, 0x2990}, {0x2991, 0x2991}, + {0x2992, 0x2992}, {0x2993, 0x2993}, {0x2994, 0x2994}, + {0x2995, 0x2995}, {0x2996, 0x2996}, {0x2997, 0x2997}, + {0x2998, 0x2998}, {0x2999, 0x29D7}, {0x29D8, 0x29D8}, + {0x29D9, 0x29D9}, {0x29DA, 0x29DA}, {0x29DB, 0x29DB}, + {0x29DC, 0x29FB}, {0x29FC, 0x29FC}, {0x29FD, 0x29FD}, + {0x29FE, 0x29FF}, {0x2A00, 0x2AFF}, {0x2B00, 0x2B1A}, + {0x2B1D, 0x2B2F}, {0x2B30, 0x2B44}, {0x2B45, 0x2B46}, + {0x2B47, 0x2B4C}, {0x2B4D, 0x2B4F}, {0x2B51, 0x2B54}, + {0x2B5A, 0x2B73}, {0x2B76, 0x2B95}, {0x2B98, 0x2BB9}, + {0x2BBD, 0x2BC8}, {0x2BCA, 0x2BD1}, {0x2BEC, 0x2BEF}, + {0x2C00, 0x2C2E}, {0x2C30, 0x2C5E}, {0x2C60, 0x2C7B}, + {0x2C7C, 0x2C7D}, {0x2C7E, 0x2C7F}, {0x2C80, 0x2CE4}, + {0x2CE5, 0x2CEA}, {0x2CEB, 0x2CEE}, {0x2CEF, 0x2CF1}, + {0x2CF2, 0x2CF3}, {0x2CF9, 0x2CFC}, {0x2CFD, 0x2CFD}, + {0x2CFE, 0x2CFF}, {0x2D00, 0x2D25}, {0x2D27, 0x2D27}, + {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D6F}, + {0x2D70, 0x2D70}, {0x2D7F, 0x2D7F}, {0x2D80, 0x2D96}, + {0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6}, + {0x2DB8, 0x2DBE}, {0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE}, + {0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, {0x2DE0, 0x2DFF}, + {0x2E00, 0x2E01}, {0x2E02, 0x2E02}, {0x2E03, 0x2E03}, + {0x2E04, 0x2E04}, {0x2E05, 0x2E05}, {0x2E06, 0x2E08}, + {0x2E09, 0x2E09}, {0x2E0A, 0x2E0A}, {0x2E0B, 0x2E0B}, + {0x2E0C, 0x2E0C}, {0x2E0D, 0x2E0D}, {0x2E0E, 0x2E16}, + {0x2E17, 0x2E17}, {0x2E18, 0x2E19}, {0x2E1A, 0x2E1A}, + {0x2E1B, 0x2E1B}, {0x2E1C, 0x2E1C}, {0x2E1D, 0x2E1D}, + {0x2E1E, 0x2E1F}, {0x2E20, 0x2E20}, {0x2E21, 0x2E21}, + {0x2E22, 0x2E22}, {0x2E23, 0x2E23}, {0x2E24, 0x2E24}, + {0x2E25, 0x2E25}, {0x2E26, 0x2E26}, {0x2E27, 0x2E27}, + {0x2E28, 0x2E28}, {0x2E29, 0x2E29}, {0x2E2A, 0x2E2E}, + {0x2E2F, 0x2E2F}, {0x2E30, 0x2E39}, {0x2E3A, 0x2E3B}, + {0x2E3C, 0x2E3F}, {0x2E40, 0x2E40}, {0x2E41, 0x2E41}, + {0x2E42, 0x2E42}, {0x2E43, 0x2E44}, {0x303F, 0x303F}, + {0x4DC0, 0x4DFF}, {0xA4D0, 0xA4F7}, {0xA4F8, 0xA4FD}, + {0xA4FE, 0xA4FF}, {0xA500, 0xA60B}, {0xA60C, 0xA60C}, + {0xA60D, 0xA60F}, {0xA610, 0xA61F}, {0xA620, 0xA629}, + {0xA62A, 0xA62B}, {0xA640, 0xA66D}, {0xA66E, 0xA66E}, + {0xA66F, 0xA66F}, {0xA670, 0xA672}, {0xA673, 0xA673}, + {0xA674, 0xA67D}, {0xA67E, 0xA67E}, {0xA67F, 0xA67F}, + {0xA680, 0xA69B}, {0xA69C, 0xA69D}, {0xA69E, 0xA69F}, + {0xA6A0, 0xA6E5}, {0xA6E6, 0xA6EF}, {0xA6F0, 0xA6F1}, + {0xA6F2, 0xA6F7}, {0xA700, 0xA716}, {0xA717, 0xA71F}, + {0xA720, 0xA721}, {0xA722, 0xA76F}, {0xA770, 0xA770}, + {0xA771, 0xA787}, {0xA788, 0xA788}, {0xA789, 0xA78A}, + {0xA78B, 0xA78E}, {0xA78F, 0xA78F}, {0xA790, 0xA7AE}, + {0xA7B0, 0xA7B7}, {0xA7F7, 0xA7F7}, {0xA7F8, 0xA7F9}, + {0xA7FA, 0xA7FA}, {0xA7FB, 0xA7FF}, {0xA800, 0xA801}, + {0xA802, 0xA802}, {0xA803, 0xA805}, {0xA806, 0xA806}, + {0xA807, 0xA80A}, {0xA80B, 0xA80B}, {0xA80C, 0xA822}, + {0xA823, 0xA824}, {0xA825, 0xA826}, {0xA827, 0xA827}, + {0xA828, 0xA82B}, {0xA830, 0xA835}, {0xA836, 0xA837}, + {0xA838, 0xA838}, {0xA839, 0xA839}, {0xA840, 0xA873}, + {0xA874, 0xA877}, {0xA880, 0xA881}, {0xA882, 0xA8B3}, + {0xA8B4, 0xA8C3}, {0xA8C4, 0xA8C5}, {0xA8CE, 0xA8CF}, + {0xA8D0, 0xA8D9}, {0xA8E0, 0xA8F1}, {0xA8F2, 0xA8F7}, + {0xA8F8, 0xA8FA}, {0xA8FB, 0xA8FB}, {0xA8FC, 0xA8FC}, + {0xA8FD, 0xA8FD}, {0xA900, 0xA909}, {0xA90A, 0xA925}, + {0xA926, 0xA92D}, {0xA92E, 0xA92F}, {0xA930, 0xA946}, + {0xA947, 0xA951}, {0xA952, 0xA953}, {0xA95F, 0xA95F}, + {0xA980, 0xA982}, {0xA983, 0xA983}, {0xA984, 0xA9B2}, + {0xA9B3, 0xA9B3}, {0xA9B4, 0xA9B5}, {0xA9B6, 0xA9B9}, + {0xA9BA, 0xA9BB}, {0xA9BC, 0xA9BC}, {0xA9BD, 0xA9C0}, + {0xA9C1, 0xA9CD}, {0xA9CF, 0xA9CF}, {0xA9D0, 0xA9D9}, + {0xA9DE, 0xA9DF}, {0xA9E0, 0xA9E4}, {0xA9E5, 0xA9E5}, + {0xA9E6, 0xA9E6}, {0xA9E7, 0xA9EF}, {0xA9F0, 0xA9F9}, + {0xA9FA, 0xA9FE}, {0xAA00, 0xAA28}, {0xAA29, 0xAA2E}, + {0xAA2F, 0xAA30}, {0xAA31, 0xAA32}, {0xAA33, 0xAA34}, + {0xAA35, 0xAA36}, {0xAA40, 0xAA42}, {0xAA43, 0xAA43}, + {0xAA44, 0xAA4B}, {0xAA4C, 0xAA4C}, {0xAA4D, 0xAA4D}, + {0xAA50, 0xAA59}, {0xAA5C, 0xAA5F}, {0xAA60, 0xAA6F}, + {0xAA70, 0xAA70}, {0xAA71, 0xAA76}, {0xAA77, 0xAA79}, + {0xAA7A, 0xAA7A}, {0xAA7B, 0xAA7B}, {0xAA7C, 0xAA7C}, + {0xAA7D, 0xAA7D}, {0xAA7E, 0xAA7F}, {0xAA80, 0xAAAF}, + {0xAAB0, 0xAAB0}, {0xAAB1, 0xAAB1}, {0xAAB2, 0xAAB4}, + {0xAAB5, 0xAAB6}, {0xAAB7, 0xAAB8}, {0xAAB9, 0xAABD}, + {0xAABE, 0xAABF}, {0xAAC0, 0xAAC0}, {0xAAC1, 0xAAC1}, + {0xAAC2, 0xAAC2}, {0xAADB, 0xAADC}, {0xAADD, 0xAADD}, + {0xAADE, 0xAADF}, {0xAAE0, 0xAAEA}, {0xAAEB, 0xAAEB}, + {0xAAEC, 0xAAED}, {0xAAEE, 0xAAEF}, {0xAAF0, 0xAAF1}, + {0xAAF2, 0xAAF2}, {0xAAF3, 0xAAF4}, {0xAAF5, 0xAAF5}, + {0xAAF6, 0xAAF6}, {0xAB01, 0xAB06}, {0xAB09, 0xAB0E}, + {0xAB11, 0xAB16}, {0xAB20, 0xAB26}, {0xAB28, 0xAB2E}, + {0xAB30, 0xAB5A}, {0xAB5B, 0xAB5B}, {0xAB5C, 0xAB5F}, + {0xAB60, 0xAB65}, {0xAB70, 0xABBF}, {0xABC0, 0xABE2}, + {0xABE3, 0xABE4}, {0xABE5, 0xABE5}, {0xABE6, 0xABE7}, + {0xABE8, 0xABE8}, {0xABE9, 0xABEA}, {0xABEB, 0xABEB}, + {0xABEC, 0xABEC}, {0xABED, 0xABED}, {0xABF0, 0xABF9}, + {0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDB7F}, + {0xDB80, 0xDBFF}, {0xDC00, 0xDFFF}, {0xFB00, 0xFB06}, + {0xFB13, 0xFB17}, {0xFB1D, 0xFB1D}, {0xFB1E, 0xFB1E}, + {0xFB1F, 0xFB28}, {0xFB29, 0xFB29}, {0xFB2A, 0xFB36}, + {0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41}, + {0xFB43, 0xFB44}, {0xFB46, 0xFB4F}, {0xFB50, 0xFBB1}, + {0xFBB2, 0xFBC1}, {0xFBD3, 0xFD3D}, {0xFD3E, 0xFD3E}, + {0xFD3F, 0xFD3F}, {0xFD50, 0xFD8F}, {0xFD92, 0xFDC7}, + {0xFDF0, 0xFDFB}, {0xFDFC, 0xFDFC}, {0xFDFD, 0xFDFD}, + {0xFE20, 0xFE2F}, {0xFE70, 0xFE74}, {0xFE76, 0xFEFC}, + {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFC, 0xFFFC}, + {0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A}, + {0x1003C, 0x1003D}, {0x1003F, 0x1004D}, {0x10050, 0x1005D}, + {0x10080, 0x100FA}, {0x10100, 0x10102}, {0x10107, 0x10133}, + {0x10137, 0x1013F}, {0x10140, 0x10174}, {0x10175, 0x10178}, + {0x10179, 0x10189}, {0x1018A, 0x1018B}, {0x1018C, 0x1018E}, + {0x10190, 0x1019B}, {0x101A0, 0x101A0}, {0x101D0, 0x101FC}, + {0x101FD, 0x101FD}, {0x10280, 0x1029C}, {0x102A0, 0x102D0}, + {0x102E0, 0x102E0}, {0x102E1, 0x102FB}, {0x10300, 0x1031F}, + {0x10320, 0x10323}, {0x10330, 0x10340}, {0x10341, 0x10341}, + {0x10342, 0x10349}, {0x1034A, 0x1034A}, {0x10350, 0x10375}, + {0x10376, 0x1037A}, {0x10380, 0x1039D}, {0x1039F, 0x1039F}, + {0x103A0, 0x103C3}, {0x103C8, 0x103CF}, {0x103D0, 0x103D0}, + {0x103D1, 0x103D5}, {0x10400, 0x1044F}, {0x10450, 0x1047F}, + {0x10480, 0x1049D}, {0x104A0, 0x104A9}, {0x104B0, 0x104D3}, + {0x104D8, 0x104FB}, {0x10500, 0x10527}, {0x10530, 0x10563}, + {0x1056F, 0x1056F}, {0x10600, 0x10736}, {0x10740, 0x10755}, + {0x10760, 0x10767}, {0x10800, 0x10805}, {0x10808, 0x10808}, + {0x1080A, 0x10835}, {0x10837, 0x10838}, {0x1083C, 0x1083C}, + {0x1083F, 0x1083F}, {0x10840, 0x10855}, {0x10857, 0x10857}, + {0x10858, 0x1085F}, {0x10860, 0x10876}, {0x10877, 0x10878}, + {0x10879, 0x1087F}, {0x10880, 0x1089E}, {0x108A7, 0x108AF}, + {0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x108FF}, + {0x10900, 0x10915}, {0x10916, 0x1091B}, {0x1091F, 0x1091F}, + {0x10920, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x1099F}, + {0x109A0, 0x109B7}, {0x109BC, 0x109BD}, {0x109BE, 0x109BF}, + {0x109C0, 0x109CF}, {0x109D2, 0x109FF}, {0x10A00, 0x10A00}, + {0x10A01, 0x10A03}, {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F}, + {0x10A10, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A33}, + {0x10A38, 0x10A3A}, {0x10A3F, 0x10A3F}, {0x10A40, 0x10A47}, + {0x10A50, 0x10A58}, {0x10A60, 0x10A7C}, {0x10A7D, 0x10A7E}, + {0x10A7F, 0x10A7F}, {0x10A80, 0x10A9C}, {0x10A9D, 0x10A9F}, + {0x10AC0, 0x10AC7}, {0x10AC8, 0x10AC8}, {0x10AC9, 0x10AE4}, + {0x10AE5, 0x10AE6}, {0x10AEB, 0x10AEF}, {0x10AF0, 0x10AF6}, + {0x10B00, 0x10B35}, {0x10B39, 0x10B3F}, {0x10B40, 0x10B55}, + {0x10B58, 0x10B5F}, {0x10B60, 0x10B72}, {0x10B78, 0x10B7F}, + {0x10B80, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF}, + {0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2}, + {0x10CFA, 0x10CFF}, {0x10E60, 0x10E7E}, {0x11000, 0x11000}, + {0x11001, 0x11001}, {0x11002, 0x11002}, {0x11003, 0x11037}, + {0x11038, 0x11046}, {0x11047, 0x1104D}, {0x11052, 0x11065}, + {0x11066, 0x1106F}, {0x1107F, 0x1107F}, {0x11080, 0x11081}, + {0x11082, 0x11082}, {0x11083, 0x110AF}, {0x110B0, 0x110B2}, + {0x110B3, 0x110B6}, {0x110B7, 0x110B8}, {0x110B9, 0x110BA}, + {0x110BB, 0x110BC}, {0x110BD, 0x110BD}, {0x110BE, 0x110C1}, + {0x110D0, 0x110E8}, {0x110F0, 0x110F9}, {0x11100, 0x11102}, + {0x11103, 0x11126}, {0x11127, 0x1112B}, {0x1112C, 0x1112C}, + {0x1112D, 0x11134}, {0x11136, 0x1113F}, {0x11140, 0x11143}, + {0x11150, 0x11172}, {0x11173, 0x11173}, {0x11174, 0x11175}, + {0x11176, 0x11176}, {0x11180, 0x11181}, {0x11182, 0x11182}, + {0x11183, 0x111B2}, {0x111B3, 0x111B5}, {0x111B6, 0x111BE}, + {0x111BF, 0x111C0}, {0x111C1, 0x111C4}, {0x111C5, 0x111C9}, + {0x111CA, 0x111CC}, {0x111CD, 0x111CD}, {0x111D0, 0x111D9}, + {0x111DA, 0x111DA}, {0x111DB, 0x111DB}, {0x111DC, 0x111DC}, + {0x111DD, 0x111DF}, {0x111E1, 0x111F4}, {0x11200, 0x11211}, + {0x11213, 0x1122B}, {0x1122C, 0x1122E}, {0x1122F, 0x11231}, + {0x11232, 0x11233}, {0x11234, 0x11234}, {0x11235, 0x11235}, + {0x11236, 0x11237}, {0x11238, 0x1123D}, {0x1123E, 0x1123E}, + {0x11280, 0x11286}, {0x11288, 0x11288}, {0x1128A, 0x1128D}, + {0x1128F, 0x1129D}, {0x1129F, 0x112A8}, {0x112A9, 0x112A9}, + {0x112B0, 0x112DE}, {0x112DF, 0x112DF}, {0x112E0, 0x112E2}, + {0x112E3, 0x112EA}, {0x112F0, 0x112F9}, {0x11300, 0x11301}, + {0x11302, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310}, + {0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333}, + {0x11335, 0x11339}, {0x1133C, 0x1133C}, {0x1133D, 0x1133D}, + {0x1133E, 0x1133F}, {0x11340, 0x11340}, {0x11341, 0x11344}, + {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11350, 0x11350}, + {0x11357, 0x11357}, {0x1135D, 0x11361}, {0x11362, 0x11363}, + {0x11366, 0x1136C}, {0x11370, 0x11374}, {0x11400, 0x11434}, + {0x11435, 0x11437}, {0x11438, 0x1143F}, {0x11440, 0x11441}, + {0x11442, 0x11444}, {0x11445, 0x11445}, {0x11446, 0x11446}, + {0x11447, 0x1144A}, {0x1144B, 0x1144F}, {0x11450, 0x11459}, + {0x1145B, 0x1145B}, {0x1145D, 0x1145D}, {0x11480, 0x114AF}, + {0x114B0, 0x114B2}, {0x114B3, 0x114B8}, {0x114B9, 0x114B9}, + {0x114BA, 0x114BA}, {0x114BB, 0x114BE}, {0x114BF, 0x114C0}, + {0x114C1, 0x114C1}, {0x114C2, 0x114C3}, {0x114C4, 0x114C5}, + {0x114C6, 0x114C6}, {0x114C7, 0x114C7}, {0x114D0, 0x114D9}, + {0x11580, 0x115AE}, {0x115AF, 0x115B1}, {0x115B2, 0x115B5}, + {0x115B8, 0x115BB}, {0x115BC, 0x115BD}, {0x115BE, 0x115BE}, + {0x115BF, 0x115C0}, {0x115C1, 0x115D7}, {0x115D8, 0x115DB}, + {0x115DC, 0x115DD}, {0x11600, 0x1162F}, {0x11630, 0x11632}, + {0x11633, 0x1163A}, {0x1163B, 0x1163C}, {0x1163D, 0x1163D}, + {0x1163E, 0x1163E}, {0x1163F, 0x11640}, {0x11641, 0x11643}, + {0x11644, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166C}, + {0x11680, 0x116AA}, {0x116AB, 0x116AB}, {0x116AC, 0x116AC}, + {0x116AD, 0x116AD}, {0x116AE, 0x116AF}, {0x116B0, 0x116B5}, + {0x116B6, 0x116B6}, {0x116B7, 0x116B7}, {0x116C0, 0x116C9}, + {0x11700, 0x11719}, {0x1171D, 0x1171F}, {0x11720, 0x11721}, + {0x11722, 0x11725}, {0x11726, 0x11726}, {0x11727, 0x1172B}, + {0x11730, 0x11739}, {0x1173A, 0x1173B}, {0x1173C, 0x1173E}, + {0x1173F, 0x1173F}, {0x118A0, 0x118DF}, {0x118E0, 0x118E9}, + {0x118EA, 0x118F2}, {0x118FF, 0x118FF}, {0x11AC0, 0x11AF8}, + {0x11C00, 0x11C08}, {0x11C0A, 0x11C2E}, {0x11C2F, 0x11C2F}, + {0x11C30, 0x11C36}, {0x11C38, 0x11C3D}, {0x11C3E, 0x11C3E}, + {0x11C3F, 0x11C3F}, {0x11C40, 0x11C40}, {0x11C41, 0x11C45}, + {0x11C50, 0x11C59}, {0x11C5A, 0x11C6C}, {0x11C70, 0x11C71}, + {0x11C72, 0x11C8F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CA9}, + {0x11CAA, 0x11CB0}, {0x11CB1, 0x11CB1}, {0x11CB2, 0x11CB3}, + {0x11CB4, 0x11CB4}, {0x11CB5, 0x11CB6}, {0x12000, 0x12399}, + {0x12400, 0x1246E}, {0x12470, 0x12474}, {0x12480, 0x12543}, + {0x13000, 0x1342E}, {0x14400, 0x14646}, {0x16800, 0x16A38}, + {0x16A40, 0x16A5E}, {0x16A60, 0x16A69}, {0x16A6E, 0x16A6F}, + {0x16AD0, 0x16AED}, {0x16AF0, 0x16AF4}, {0x16AF5, 0x16AF5}, + {0x16B00, 0x16B2F}, {0x16B30, 0x16B36}, {0x16B37, 0x16B3B}, + {0x16B3C, 0x16B3F}, {0x16B40, 0x16B43}, {0x16B44, 0x16B44}, + {0x16B45, 0x16B45}, {0x16B50, 0x16B59}, {0x16B5B, 0x16B61}, + {0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, {0x16F00, 0x16F44}, + {0x16F50, 0x16F50}, {0x16F51, 0x16F7E}, {0x16F8F, 0x16F92}, + {0x16F93, 0x16F9F}, {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C}, + {0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BC9C}, + {0x1BC9D, 0x1BC9E}, {0x1BC9F, 0x1BC9F}, {0x1BCA0, 0x1BCA3}, + {0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D164}, + {0x1D165, 0x1D166}, {0x1D167, 0x1D169}, {0x1D16A, 0x1D16C}, + {0x1D16D, 0x1D172}, {0x1D173, 0x1D17A}, {0x1D17B, 0x1D182}, + {0x1D183, 0x1D184}, {0x1D185, 0x1D18B}, {0x1D18C, 0x1D1A9}, + {0x1D1AA, 0x1D1AD}, {0x1D1AE, 0x1D1E8}, {0x1D200, 0x1D241}, + {0x1D242, 0x1D244}, {0x1D245, 0x1D245}, {0x1D300, 0x1D356}, + {0x1D360, 0x1D371}, {0x1D400, 0x1D454}, {0x1D456, 0x1D49C}, + {0x1D49E, 0x1D49F}, {0x1D4A2, 0x1D4A2}, {0x1D4A5, 0x1D4A6}, + {0x1D4A9, 0x1D4AC}, {0x1D4AE, 0x1D4B9}, {0x1D4BB, 0x1D4BB}, + {0x1D4BD, 0x1D4C3}, {0x1D4C5, 0x1D505}, {0x1D507, 0x1D50A}, + {0x1D50D, 0x1D514}, {0x1D516, 0x1D51C}, {0x1D51E, 0x1D539}, + {0x1D53B, 0x1D53E}, {0x1D540, 0x1D544}, {0x1D546, 0x1D546}, + {0x1D54A, 0x1D550}, {0x1D552, 0x1D6A5}, {0x1D6A8, 0x1D6C0}, + {0x1D6C1, 0x1D6C1}, {0x1D6C2, 0x1D6DA}, {0x1D6DB, 0x1D6DB}, + {0x1D6DC, 0x1D6FA}, {0x1D6FB, 0x1D6FB}, {0x1D6FC, 0x1D714}, + {0x1D715, 0x1D715}, {0x1D716, 0x1D734}, {0x1D735, 0x1D735}, + {0x1D736, 0x1D74E}, {0x1D74F, 0x1D74F}, {0x1D750, 0x1D76E}, + {0x1D76F, 0x1D76F}, {0x1D770, 0x1D788}, {0x1D789, 0x1D789}, + {0x1D78A, 0x1D7A8}, {0x1D7A9, 0x1D7A9}, {0x1D7AA, 0x1D7C2}, + {0x1D7C3, 0x1D7C3}, {0x1D7C4, 0x1D7CB}, {0x1D7CE, 0x1D7FF}, + {0x1D800, 0x1D9FF}, {0x1DA00, 0x1DA36}, {0x1DA37, 0x1DA3A}, + {0x1DA3B, 0x1DA6C}, {0x1DA6D, 0x1DA74}, {0x1DA75, 0x1DA75}, + {0x1DA76, 0x1DA83}, {0x1DA84, 0x1DA84}, {0x1DA85, 0x1DA86}, + {0x1DA87, 0x1DA8B}, {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, + {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, + {0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E800, 0x1E8C4}, + {0x1E8C7, 0x1E8CF}, {0x1E8D0, 0x1E8D6}, {0x1E900, 0x1E943}, + {0x1E944, 0x1E94A}, {0x1E950, 0x1E959}, {0x1E95E, 0x1E95F}, + {0x1EE00, 0x1EE03}, {0x1EE05, 0x1EE1F}, {0x1EE21, 0x1EE22}, + {0x1EE24, 0x1EE24}, {0x1EE27, 0x1EE27}, {0x1EE29, 0x1EE32}, + {0x1EE34, 0x1EE37}, {0x1EE39, 0x1EE39}, {0x1EE3B, 0x1EE3B}, + {0x1EE42, 0x1EE42}, {0x1EE47, 0x1EE47}, {0x1EE49, 0x1EE49}, + {0x1EE4B, 0x1EE4B}, {0x1EE4D, 0x1EE4F}, {0x1EE51, 0x1EE52}, + {0x1EE54, 0x1EE54}, {0x1EE57, 0x1EE57}, {0x1EE59, 0x1EE59}, + {0x1EE5B, 0x1EE5B}, {0x1EE5D, 0x1EE5D}, {0x1EE5F, 0x1EE5F}, + {0x1EE61, 0x1EE62}, {0x1EE64, 0x1EE64}, {0x1EE67, 0x1EE6A}, + {0x1EE6C, 0x1EE72}, {0x1EE74, 0x1EE77}, {0x1EE79, 0x1EE7C}, + {0x1EE7E, 0x1EE7E}, {0x1EE80, 0x1EE89}, {0x1EE8B, 0x1EE9B}, + {0x1EEA1, 0x1EEA3}, {0x1EEA5, 0x1EEA9}, {0x1EEAB, 0x1EEBB}, + {0x1EEF0, 0x1EEF1}, {0x1F000, 0x1F003}, {0x1F005, 0x1F02B}, + {0x1F030, 0x1F093}, {0x1F0A0, 0x1F0AE}, {0x1F0B1, 0x1F0BF}, + {0x1F0C1, 0x1F0CE}, {0x1F0D1, 0x1F0F5}, {0x1F10B, 0x1F10C}, + {0x1F12E, 0x1F12E}, {0x1F16A, 0x1F16B}, {0x1F1E6, 0x1F1FF}, + {0x1F321, 0x1F32C}, {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D}, + {0x1F394, 0x1F39F}, {0x1F3CB, 0x1F3CE}, {0x1F3D4, 0x1F3DF}, + {0x1F3F1, 0x1F3F3}, {0x1F3F5, 0x1F3F7}, {0x1F43F, 0x1F43F}, + {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FE}, {0x1F53E, 0x1F54A}, + {0x1F54F, 0x1F54F}, {0x1F568, 0x1F579}, {0x1F57B, 0x1F594}, + {0x1F597, 0x1F5A3}, {0x1F5A5, 0x1F5FA}, {0x1F650, 0x1F67F}, + {0x1F6C6, 0x1F6CB}, {0x1F6CD, 0x1F6CF}, {0x1F6E0, 0x1F6EA}, + {0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F773}, {0x1F780, 0x1F7D4}, + {0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, {0x1F850, 0x1F859}, + {0x1F860, 0x1F887}, {0x1F890, 0x1F8AD}, {0xE0001, 0xE0001}, + {0xE0020, 0xE007F}, +} + +// Condition have flag EastAsianWidth whether the current locale is CJK or not. +type Condition struct { + EastAsianWidth bool +} + +// NewCondition return new instance of Condition which is current locale. +func NewCondition() *Condition { + return &Condition{EastAsianWidth} +} + +// RuneWidth returns the number of cells in r. +// See http://www.unicode.org/reports/tr11/ +func (c *Condition) RuneWidth(r rune) int { + switch { + case r < 0 || r > 0x10FFFF || + inTables(r, nonprint, combining, notassigned): + return 0 + case (c.EastAsianWidth && IsAmbiguousWidth(r)) || + inTables(r, doublewidth, emoji): + return 2 + default: + return 1 + } +} + +// StringWidth return width as you can see +func (c *Condition) StringWidth(s string) (width int) { + for _, r := range []rune(s) { + width += c.RuneWidth(r) + } + return width +} + +// Truncate return string truncated with w cells +func (c *Condition) Truncate(s string, w int, tail string) string { + if c.StringWidth(s) <= w { + return s + } + r := []rune(s) + tw := c.StringWidth(tail) + w -= tw + width := 0 + i := 0 + for ; i < len(r); i++ { + cw := c.RuneWidth(r[i]) + if width+cw > w { + break + } + width += cw + } + return string(r[0:i]) + tail +} + +// Wrap return string wrapped with w cells +func (c *Condition) Wrap(s string, w int) string { + width := 0 + out := "" + for _, r := range []rune(s) { + cw := RuneWidth(r) + if r == '\n' { + out += string(r) + width = 0 + continue + } else if width+cw > w { + out += "\n" + width = 0 + out += string(r) + width += cw + continue + } + out += string(r) + width += cw + } + return out +} + +// FillLeft return string filled in left by spaces in w cells +func (c *Condition) FillLeft(s string, w int) string { + width := c.StringWidth(s) + count := w - width + if count > 0 { + b := make([]byte, count) + for i := range b { + b[i] = ' ' + } + return string(b) + s + } + return s +} + +// FillRight return string filled in left by spaces in w cells +func (c *Condition) FillRight(s string, w int) string { + width := c.StringWidth(s) + count := w - width + if count > 0 { + b := make([]byte, count) + for i := range b { + b[i] = ' ' + } + return s + string(b) + } + return s +} + +// RuneWidth returns the number of cells in r. +// See http://www.unicode.org/reports/tr11/ +func RuneWidth(r rune) int { + return DefaultCondition.RuneWidth(r) +} + +// IsAmbiguousWidth returns whether is ambiguous width or not. +func IsAmbiguousWidth(r rune) bool { + return inTables(r, private, ambiguous) +} + +// IsNeutralWidth returns whether is neutral width or not. +func IsNeutralWidth(r rune) bool { + return inTable(r, neutral) +} + +// StringWidth return width as you can see +func StringWidth(s string) (width int) { + return DefaultCondition.StringWidth(s) +} + +// Truncate return string truncated with w cells +func Truncate(s string, w int, tail string) string { + return DefaultCondition.Truncate(s, w, tail) +} + +// Wrap return string wrapped with w cells +func Wrap(s string, w int) string { + return DefaultCondition.Wrap(s, w) +} + +// FillLeft return string filled in left by spaces in w cells +func FillLeft(s string, w int) string { + return DefaultCondition.FillLeft(s, w) +} + +// FillRight return string filled in left by spaces in w cells +func FillRight(s string, w int) string { + return DefaultCondition.FillRight(s, w) +} diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_js.go b/vendor/github.com/mattn/go-runewidth/runewidth_js.go new file mode 100644 index 0000000000..0ce32c5e7b --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/runewidth_js.go @@ -0,0 +1,8 @@ +// +build js + +package runewidth + +func IsEastAsian() bool { + // TODO: Implement this for the web. Detect east asian in a compatible way, and return true. + return false +} diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go new file mode 100644 index 0000000000..c579e9a314 --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go @@ -0,0 +1,77 @@ +// +build !windows,!js + +package runewidth + +import ( + "os" + "regexp" + "strings" +) + +var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`) + +var mblenTable = map[string]int{ + "utf-8": 6, + "utf8": 6, + "jis": 8, + "eucjp": 3, + "euckr": 2, + "euccn": 2, + "sjis": 2, + "cp932": 2, + "cp51932": 2, + "cp936": 2, + "cp949": 2, + "cp950": 2, + "big5": 2, + "gbk": 2, + "gb2312": 2, +} + +func isEastAsian(locale string) bool { + charset := strings.ToLower(locale) + r := reLoc.FindStringSubmatch(locale) + if len(r) == 2 { + charset = strings.ToLower(r[1]) + } + + if strings.HasSuffix(charset, "@cjk_narrow") { + return false + } + + for pos, b := range []byte(charset) { + if b == '@' { + charset = charset[:pos] + break + } + } + max := 1 + if m, ok := mblenTable[charset]; ok { + max = m + } + if max > 1 && (charset[0] != 'u' || + strings.HasPrefix(locale, "ja") || + strings.HasPrefix(locale, "ko") || + strings.HasPrefix(locale, "zh")) { + return true + } + return false +} + +// IsEastAsian return true if the current locale is CJK +func IsEastAsian() bool { + locale := os.Getenv("LC_CTYPE") + if locale == "" { + locale = os.Getenv("LANG") + } + + // ignore C locale + if locale == "POSIX" || locale == "C" { + return false + } + if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') { + return false + } + + return isEastAsian(locale) +} diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go new file mode 100644 index 0000000000..0258876b99 --- /dev/null +++ b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go @@ -0,0 +1,25 @@ +package runewidth + +import ( + "syscall" +) + +var ( + kernel32 = syscall.NewLazyDLL("kernel32") + procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP") +) + +// IsEastAsian return true if the current locale is CJK +func IsEastAsian() bool { + r1, _, _ := procGetConsoleOutputCP.Call() + if r1 == 0 { + return false + } + + switch int(r1) { + case 932, 51932, 936, 949, 950: + return true + } + + return false +} diff --git a/vendor/github.com/peterh/liner/README.md b/vendor/github.com/peterh/liner/README.md index 9148b24929..8df46ec2be 100644 --- a/vendor/github.com/peterh/liner/README.md +++ b/vendor/github.com/peterh/liner/README.md @@ -29,7 +29,8 @@ Ctrl-C | Reset input (create new empty prompt) Ctrl-L | Clear screen (line is unmodified) Ctrl-T | Transpose previous character with current character Ctrl-H, BackSpace | Delete character before cursor -Ctrl-W | Delete word leading up to cursor +Ctrl-W, Alt-BackSpace | Delete word leading up to cursor +Alt-D | Delete word following cursor Ctrl-K | Delete from cursor to end of line Ctrl-U | Delete from start of line to cursor Ctrl-P, Up | Previous match from history diff --git a/vendor/github.com/peterh/liner/common.go b/vendor/github.com/peterh/liner/common.go index 7923c38472..a85b025b4f 100644 --- a/vendor/github.com/peterh/liner/common.go +++ b/vendor/github.com/peterh/liner/common.go @@ -32,6 +32,7 @@ type commonState struct { cursorRows int maxRows int shouldRestart ShouldRestart + noBeep bool needRefresh bool } @@ -144,7 +145,7 @@ func (s *State) AppendHistory(item string) { } } -// ClearHistory clears the scroollback history. +// ClearHistory clears the scrollback history. func (s *State) ClearHistory() { s.historyMutex.Lock() defer s.historyMutex.Unlock() @@ -161,7 +162,7 @@ func (s *State) getHistoryByPrefix(prefix string) (ph []string) { return } -// Returns the history lines matching the inteligent search +// Returns the history lines matching the intelligent search func (s *State) getHistoryByPattern(pattern string) (ph []string, pos []int) { if pattern == "" { return @@ -243,6 +244,12 @@ func (s *State) SetShouldRestart(f ShouldRestart) { s.shouldRestart = f } +// SetBeep sets whether liner should beep the terminal at various times (output +// ASCII BEL, 0x07). Default is true (will beep). +func (s *State) SetBeep(beep bool) { + s.noBeep = !beep +} + func (s *State) promptUnsupported(p string) (string, error) { if !s.inputRedirected || !s.terminalSupported { fmt.Print(p) diff --git a/vendor/github.com/peterh/liner/fallbackinput.go b/vendor/github.com/peterh/liner/fallbackinput.go index d9eb79d9e0..043fb33218 100644 --- a/vendor/github.com/peterh/liner/fallbackinput.go +++ b/vendor/github.com/peterh/liner/fallbackinput.go @@ -55,3 +55,5 @@ func (n noopMode) ApplyMode() error { func TerminalMode() (ModeApplier, error) { return noopMode{}, nil } + +const cursorColumn = true diff --git a/vendor/github.com/peterh/liner/go.mod b/vendor/github.com/peterh/liner/go.mod new file mode 100644 index 0000000000..6804de36f5 --- /dev/null +++ b/vendor/github.com/peterh/liner/go.mod @@ -0,0 +1,3 @@ +module github.com/peterh/liner + +require github.com/mattn/go-runewidth v0.0.3 diff --git a/vendor/github.com/peterh/liner/go.sum b/vendor/github.com/peterh/liner/go.sum new file mode 100644 index 0000000000..1c1891604c --- /dev/null +++ b/vendor/github.com/peterh/liner/go.sum @@ -0,0 +1,2 @@ +github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4= +github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= diff --git a/vendor/github.com/peterh/liner/input.go b/vendor/github.com/peterh/liner/input.go index 95dd5d1435..b7c1453baa 100644 --- a/vendor/github.com/peterh/liner/input.go +++ b/vendor/github.com/peterh/liner/input.go @@ -264,9 +264,9 @@ func (s *State) readNext() (interface{}, error) { return pageUp, nil case 6: return pageDown, nil - case 7: + case 1, 7: return home, nil - case 8: + case 4, 8: return end, nil case 15: return f5, nil @@ -328,6 +328,12 @@ func (s *State) readNext() (interface{}, error) { case 'b': s.pending = s.pending[:0] // escape code complete return altB, nil + case 'd': + s.pending = s.pending[:0] // escape code complete + return altD, nil + case bs: + s.pending = s.pending[:0] // escape code complete + return altBs, nil case 'f': s.pending = s.pending[:0] // escape code complete return altF, nil diff --git a/vendor/github.com/peterh/liner/input_windows.go b/vendor/github.com/peterh/liner/input_windows.go index a48eb0f1d2..541ad51426 100644 --- a/vendor/github.com/peterh/liner/input_windows.go +++ b/vendor/github.com/peterh/liner/input_windows.go @@ -4,6 +4,7 @@ import ( "bufio" "os" "syscall" + "unicode/utf16" "unsafe" ) @@ -103,14 +104,16 @@ type key_event_record struct { RepeatCount uint16 VirtualKeyCode uint16 VirtualScanCode uint16 - Char int16 + Char uint16 ControlKeyState uint32 } // These names are from the Win32 api, so they use underscores (contrary to // what golint suggests) const ( + vk_back = 0x08 vk_tab = 0x09 + vk_menu = 0x12 // ALT key vk_prior = 0x21 vk_next = 0x22 vk_end = 0x23 @@ -134,6 +137,7 @@ const ( vk_f11 = 0x7a vk_f12 = 0x7b bKey = 0x42 + dKey = 0x44 fKey = 0x46 yKey = 0x59 ) @@ -174,6 +178,8 @@ func (s *State) readNext() (interface{}, error) { var rv uint32 prv := uintptr(unsafe.Pointer(&rv)) + var surrogate uint16 + for { ok, _, err := procReadConsoleInput.Call(uintptr(s.handle), pbuf, 1, prv) @@ -184,9 +190,6 @@ func (s *State) readNext() (interface{}, error) { if input.eventType == window_buffer_size_event { xy := (*coord)(unsafe.Pointer(&input.blob[0])) s.columns = int(xy.x) - if s.columns > 1 { - s.columns-- - } return winch, nil } if input.eventType != key_event { @@ -194,14 +197,31 @@ func (s *State) readNext() (interface{}, error) { } ke := (*key_event_record)(unsafe.Pointer(&input.blob[0])) if ke.KeyDown == 0 { + if ke.VirtualKeyCode == vk_menu && ke.Char > 0 { + // paste of unicode (eg. via ALT-numpad) + if surrogate > 0 { + return utf16.DecodeRune(rune(surrogate), rune(ke.Char)), nil + } else if utf16.IsSurrogate(rune(ke.Char)) { + surrogate = ke.Char + continue + } else { + return rune(ke.Char), nil + } + } continue } if ke.VirtualKeyCode == vk_tab && ke.ControlKeyState&modKeys == shiftPressed { s.key = shiftTab + } else if ke.VirtualKeyCode == vk_back && (ke.ControlKeyState&modKeys == leftAltPressed || + ke.ControlKeyState&modKeys == rightAltPressed) { + s.key = altBs } else if ke.VirtualKeyCode == bKey && (ke.ControlKeyState&modKeys == leftAltPressed || ke.ControlKeyState&modKeys == rightAltPressed) { s.key = altB + } else if ke.VirtualKeyCode == dKey && (ke.ControlKeyState&modKeys == leftAltPressed || + ke.ControlKeyState&modKeys == rightAltPressed) { + s.key = altD } else if ke.VirtualKeyCode == fKey && (ke.ControlKeyState&modKeys == leftAltPressed || ke.ControlKeyState&modKeys == rightAltPressed) { s.key = altF @@ -209,7 +229,14 @@ func (s *State) readNext() (interface{}, error) { ke.ControlKeyState&modKeys == rightAltPressed) { s.key = altY } else if ke.Char > 0 { - s.key = rune(ke.Char) + if surrogate > 0 { + s.key = utf16.DecodeRune(rune(surrogate), rune(ke.Char)) + } else if utf16.IsSurrogate(rune(ke.Char)) { + surrogate = ke.Char + continue + } else { + s.key = rune(ke.Char) + } } else { switch ke.VirtualKeyCode { case vk_prior: @@ -337,3 +364,5 @@ func TerminalMode() (ModeApplier, error) { } return mode, err } + +const cursorColumn = true diff --git a/vendor/github.com/peterh/liner/line.go b/vendor/github.com/peterh/liner/line.go index d61f0696b0..05a94beb96 100644 --- a/vendor/github.com/peterh/liner/line.go +++ b/vendor/github.com/peterh/liner/line.go @@ -40,6 +40,8 @@ const ( f11 f12 altB + altBs // Alt+Backspace + altD altF altY shiftTab @@ -112,6 +114,10 @@ func (s *State) refreshSingleLine(prompt []rune, buf []rune, pos int) error { pLen := countGlyphs(prompt) bLen := countGlyphs(buf) + // on some OS / terminals extra column is needed to place the cursor char + if cursorColumn { + bLen++ + } pos = countGlyphs(buf[:pos]) if pLen+bLen < s.columns { _, err = fmt.Print(string(buf)) @@ -162,6 +168,14 @@ func (s *State) refreshSingleLine(prompt []rune, buf []rune, pos int) error { func (s *State) refreshMultiLine(prompt []rune, buf []rune, pos int) error { promptColumns := countMultiLineGlyphs(prompt, s.columns, 0) totalColumns := countMultiLineGlyphs(buf, s.columns, promptColumns) + // on some OS / terminals extra column is needed to place the cursor char + // if cursorColumn { + // totalColumns++ + // } + + // it looks like Multiline mode always assume that a cursor need an extra column, + // and always emit a newline if we are at the screen end, so no worarounds needed there + totalRows := (totalColumns + s.columns - 1) / s.columns maxRows := s.maxRows if totalRows > s.maxRows { @@ -435,7 +449,7 @@ func (s *State) reverseISearch(origLine []rune, origPos int) ([]rune, int, inter foundLine = history[historyPos] foundPos = positions[historyPos] } else { - fmt.Print(beep) + s.doBeep() } case ctrlS: // Search forward if historyPos < len(history)-1 && historyPos >= 0 { @@ -443,11 +457,11 @@ func (s *State) reverseISearch(origLine []rune, origPos int) ([]rune, int, inter foundLine = history[historyPos] foundPos = positions[historyPos] } else { - fmt.Print(beep) + s.doBeep() } case ctrlH, bs: // Backspace if pos <= 0 { - fmt.Print(beep) + s.doBeep() } else { n := len(getSuffixGlyphs(line[:pos], 1)) line = append(line[:pos-n], line[pos:]...) @@ -583,7 +597,7 @@ func (s *State) Prompt(prompt string) (string, error) { // PromptWithSuggestion displays prompt and an editable text with cursor at // given position. The cursor will be set to the end of the line if given position -// is negative or greater than length of text. Returns a line of user input, not +// is negative or greater than length of text (in runes). Returns a line of user input, not // including a trailing newline character. An io.EOF error is returned if the user // signals end-of-file by pressing Ctrl-D. func (s *State) PromptWithSuggestion(prompt string, text string, pos int) (string, error) { @@ -618,8 +632,8 @@ func (s *State) PromptWithSuggestion(prompt string, text string, pos int) (strin defer s.stopPrompt() - if pos < 0 || len(text) < pos { - pos = len(text) + if pos < 0 || len(line) < pos { + pos = len(line) } if len(line) > 0 { err := s.refresh(p, line, pos) @@ -670,14 +684,14 @@ mainLoop: pos -= len(getSuffixGlyphs(line[:pos], 1)) s.needRefresh = true } else { - fmt.Print(beep) + s.doBeep() } case ctrlF: // right if pos < len(line) { pos += len(getPrefixGlyphs(line[pos:], 1)) s.needRefresh = true } else { - fmt.Print(beep) + s.doBeep() } case ctrlD: // del if pos == 0 && len(line) == 0 { @@ -690,7 +704,7 @@ mainLoop: s.restartPrompt() if pos >= len(line) { - fmt.Print(beep) + s.doBeep() } else { n := len(getPrefixGlyphs(line[pos:], 1)) line = append(line[:pos], line[pos+n:]...) @@ -698,7 +712,7 @@ mainLoop: } case ctrlK: // delete remainder of line if pos >= len(line) { - fmt.Print(beep) + s.doBeep() } else { if killAction > 0 { s.addToKillRing(line[pos:], 1) // Add in apend mode @@ -726,7 +740,7 @@ mainLoop: pos = len(line) s.needRefresh = true } else { - fmt.Print(beep) + s.doBeep() } case ctrlN: // down historyAction = true @@ -745,11 +759,11 @@ mainLoop: pos = len(line) s.needRefresh = true } else { - fmt.Print(beep) + s.doBeep() } case ctrlT: // transpose prev glyph with glyph under cursor if len(line) < 2 || pos < 1 { - fmt.Print(beep) + s.doBeep() } else { if pos == len(line) { pos -= len(getSuffixGlyphs(line, 1)) @@ -780,7 +794,7 @@ mainLoop: s.restartPrompt() case ctrlH, bs: // Backspace if pos <= 0 { - fmt.Print(beep) + s.doBeep() } else { n := len(getSuffixGlyphs(line[:pos], 1)) line = append(line[:pos-n], line[pos:]...) @@ -799,42 +813,7 @@ mainLoop: pos = 0 s.needRefresh = true case ctrlW: // Erase word - if pos == 0 { - fmt.Print(beep) - break - } - // Remove whitespace to the left - var buf []rune // Store the deleted chars in a buffer - for { - if pos == 0 || !unicode.IsSpace(line[pos-1]) { - break - } - buf = append(buf, line[pos-1]) - line = append(line[:pos-1], line[pos:]...) - pos-- - } - // Remove non-whitespace to the left - for { - if pos == 0 || unicode.IsSpace(line[pos-1]) { - break - } - buf = append(buf, line[pos-1]) - line = append(line[:pos-1], line[pos:]...) - pos-- - } - // Invert the buffer and save the result on the killRing - var newBuf []rune - for i := len(buf) - 1; i >= 0; i-- { - newBuf = append(newBuf, buf[i]) - } - if killAction > 0 { - s.addToKillRing(newBuf, 2) // Add in prepend mode - } else { - s.addToKillRing(newBuf, 0) // Add in normal mode - } - killAction = 2 // Mark that there was some killing - - s.needRefresh = true + pos, line, killAction = s.eraseWord(pos, line, killAction) case ctrlY: // Paste from Yank buffer line, pos, next, err = s.yank(p, line, pos) goto haveNext @@ -853,7 +832,7 @@ mainLoop: fallthrough // Catch unhandled control codes (anything <= 31) case 0, 28, 29, 30, 31: - fmt.Print(beep) + s.doBeep() default: if pos == len(line) && !s.multiLineMode && len(p)+len(line) < s.columns*4 && // Avoid countGlyphs on large lines @@ -871,7 +850,7 @@ mainLoop: switch v { case del: if pos >= len(line) { - fmt.Print(beep) + s.doBeep() } else { n := len(getPrefixGlyphs(line[pos:], 1)) line = append(line[:pos], line[pos+n:]...) @@ -880,7 +859,7 @@ mainLoop: if pos > 0 { pos -= len(getSuffixGlyphs(line[:pos], 1)) } else { - fmt.Print(beep) + s.doBeep() } case wordLeft, altB: if pos > 0 { @@ -901,13 +880,13 @@ mainLoop: } } } else { - fmt.Print(beep) + s.doBeep() } case right: if pos < len(line) { pos += len(getPrefixGlyphs(line[pos:], 1)) } else { - fmt.Print(beep) + s.doBeep() } case wordRight, altF: if pos < len(line) { @@ -928,7 +907,7 @@ mainLoop: } } } else { - fmt.Print(beep) + s.doBeep() } case up: historyAction = true @@ -945,7 +924,7 @@ mainLoop: line = []rune(historyPrefix[historyPos]) pos = len(line) } else { - fmt.Print(beep) + s.doBeep() } case down: historyAction = true @@ -963,12 +942,43 @@ mainLoop: } pos = len(line) } else { - fmt.Print(beep) + s.doBeep() } case home: // Start of line pos = 0 case end: // End of line pos = len(line) + case altD: // Delete next word + if pos == len(line) { + s.doBeep() + break + } + // Remove whitespace to the right + var buf []rune // Store the deleted chars in a buffer + for { + if pos == len(line) || !unicode.IsSpace(line[pos]) { + break + } + buf = append(buf, line[pos]) + line = append(line[:pos], line[pos+1:]...) + } + // Remove non-whitespace to the right + for { + if pos == len(line) || unicode.IsSpace(line[pos]) { + break + } + buf = append(buf, line[pos]) + line = append(line[:pos], line[pos+1:]...) + } + // Save the result on the killRing + if killAction > 0 { + s.addToKillRing(buf, 2) // Add in prepend mode + } else { + s.addToKillRing(buf, 0) // Add in normal mode + } + killAction = 2 // Mark that there was some killing + case altBs: // Erase word + pos, line, killAction = s.eraseWord(pos, line, killAction) case winch: // Window change if s.multiLineMode { if s.maxRows-s.cursorRows > 0 { @@ -1020,10 +1030,6 @@ func (s *State) PasswordPrompt(prompt string) (string, error) { } p := []rune(prompt) - const minWorkingSpace = 1 - if s.columns < countGlyphs(p)+minWorkingSpace { - return s.tooNarrow(prompt) - } defer s.stopPrompt() @@ -1049,15 +1055,6 @@ mainLoop: case rune: switch v { case cr, lf: - if s.needRefresh { - err := s.refresh(p, line, pos) - if err != nil { - return "", err - } - } - if s.multiLineMode { - s.resetMultiLine(p, line, pos) - } fmt.Println() break mainLoop case ctrlD: // del @@ -1077,7 +1074,7 @@ mainLoop: } case ctrlH, bs: // Backspace if pos <= 0 { - fmt.Print(beep) + s.doBeep() } else { n := len(getSuffixGlyphs(line[:pos], 1)) line = append(line[:pos-n], line[pos:]...) @@ -1085,9 +1082,6 @@ mainLoop: } case ctrlC: fmt.Println("^C") - if s.multiLineMode { - s.resetMultiLine(p, line, pos) - } if s.ctrlCAborts { return "", ErrPromptAborted } @@ -1101,7 +1095,7 @@ mainLoop: fallthrough // Catch unhandled control codes (anything <= 31) case 0, 28, 29, 30, 31: - fmt.Print(beep) + s.doBeep() default: line = append(line[:pos], append([]rune{v}, line[pos:]...)...) pos++ @@ -1127,3 +1121,49 @@ func (s *State) tooNarrow(prompt string) (string, error) { } return s.promptUnsupported(prompt) } + +func (s *State) eraseWord(pos int, line []rune, killAction int) (int, []rune, int) { + if pos == 0 { + s.doBeep() + return pos, line, killAction + } + // Remove whitespace to the left + var buf []rune // Store the deleted chars in a buffer + for { + if pos == 0 || !unicode.IsSpace(line[pos-1]) { + break + } + buf = append(buf, line[pos-1]) + line = append(line[:pos-1], line[pos:]...) + pos-- + } + // Remove non-whitespace to the left + for { + if pos == 0 || unicode.IsSpace(line[pos-1]) { + break + } + buf = append(buf, line[pos-1]) + line = append(line[:pos-1], line[pos:]...) + pos-- + } + // Invert the buffer and save the result on the killRing + var newBuf []rune + for i := len(buf) - 1; i >= 0; i-- { + newBuf = append(newBuf, buf[i]) + } + if killAction > 0 { + s.addToKillRing(newBuf, 2) // Add in prepend mode + } else { + s.addToKillRing(newBuf, 0) // Add in normal mode + } + killAction = 2 // Mark that there was some killing + + s.needRefresh = true + return pos, line, killAction +} + +func (s *State) doBeep() { + if !s.noBeep { + fmt.Print(beep) + } +} diff --git a/vendor/github.com/peterh/liner/output.go b/vendor/github.com/peterh/liner/output.go index 6d83d4ebfd..db0641cfe0 100644 --- a/vendor/github.com/peterh/liner/output.go +++ b/vendor/github.com/peterh/liner/output.go @@ -56,9 +56,6 @@ func (s *State) getColumns() bool { return false } s.columns = int(ws.col) - if cursorColumn && s.columns > 1 { - s.columns-- - } return true } diff --git a/vendor/github.com/peterh/liner/output_windows.go b/vendor/github.com/peterh/liner/output_windows.go index 63c9c5d757..45cd978c96 100644 --- a/vendor/github.com/peterh/liner/output_windows.go +++ b/vendor/github.com/peterh/liner/output_windows.go @@ -69,8 +69,4 @@ func (s *State) getColumns() { var sbi consoleScreenBufferInfo procGetConsoleScreenBufferInfo.Call(uintptr(s.hOut), uintptr(unsafe.Pointer(&sbi))) s.columns = int(sbi.dwSize.x) - if s.columns > 1 { - // Windows 10 needs a spare column for the cursor - s.columns-- - } } diff --git a/vendor/github.com/peterh/liner/width.go b/vendor/github.com/peterh/liner/width.go index 42e8999834..0395f3a8be 100644 --- a/vendor/github.com/peterh/liner/width.go +++ b/vendor/github.com/peterh/liner/width.go @@ -1,6 +1,10 @@ package liner -import "unicode" +import ( + "unicode" + + "github.com/mattn/go-runewidth" +) // These character classes are mostly zero width (when combined). // A few might not be, depending on the user's font. Fixing this @@ -13,13 +17,6 @@ var zeroWidth = []*unicode.RangeTable{ unicode.Cf, } -var doubleWidth = []*unicode.RangeTable{ - unicode.Han, - unicode.Hangul, - unicode.Hiragana, - unicode.Katakana, -} - // countGlyphs considers zero-width characters to be zero glyphs wide, // and members of Chinese, Japanese, and Korean scripts to be 2 glyphs wide. func countGlyphs(s []rune) int { @@ -31,13 +28,7 @@ func countGlyphs(s []rune) int { continue } - switch { - case unicode.IsOneOf(zeroWidth, r): - case unicode.IsOneOf(doubleWidth, r): - n += 2 - default: - n++ - } + n += runewidth.RuneWidth(r) } return n } @@ -49,17 +40,17 @@ func countMultiLineGlyphs(s []rune, columns int, start int) int { n++ continue } - switch { - case unicode.IsOneOf(zeroWidth, r): - case unicode.IsOneOf(doubleWidth, r): + switch runewidth.RuneWidth(r) { + case 0: + case 1: + n++ + case 2: n += 2 // no room for a 2-glyphs-wide char in the ending // so skip a column and display it at the beginning if n%columns == 1 { n++ } - default: - n++ } } return n diff --git a/vendor/github.com/russross/blackfriday/doc.go b/vendor/github.com/russross/blackfriday/doc.go deleted file mode 100644 index 9656c42a19..0000000000 --- a/vendor/github.com/russross/blackfriday/doc.go +++ /dev/null @@ -1,32 +0,0 @@ -// Package blackfriday is a Markdown processor. -// -// It translates plain text with simple formatting rules into HTML or LaTeX. -// -// Sanitized Anchor Names -// -// Blackfriday includes an algorithm for creating sanitized anchor names -// corresponding to a given input text. This algorithm is used to create -// anchors for headings when EXTENSION_AUTO_HEADER_IDS is enabled. The -// algorithm is specified below, so that other packages can create -// compatible anchor names and links to those anchors. -// -// The algorithm iterates over the input text, interpreted as UTF-8, -// one Unicode code point (rune) at a time. All runes that are letters (category L) -// or numbers (category N) are considered valid characters. They are mapped to -// lower case, and included in the output. All other runes are considered -// invalid characters. Invalid characters that preceed the first valid character, -// as well as invalid character that follow the last valid character -// are dropped completely. All other sequences of invalid characters -// between two valid characters are replaced with a single dash character '-'. -// -// SanitizedAnchorName exposes this functionality, and can be used to -// create compatible links to the anchor names generated by blackfriday. -// This algorithm is also implemented in a small standalone package at -// github.com/shurcooL/sanitized_anchor_name. It can be useful for clients -// that want a small package and don't need full functionality of blackfriday. -package blackfriday - -// NOTE: Keep Sanitized Anchor Name algorithm in sync with package -// github.com/shurcooL/sanitized_anchor_name. -// Otherwise, users of sanitized_anchor_name will get anchor names -// that are incompatible with those generated by blackfriday. diff --git a/vendor/github.com/russross/blackfriday/go.mod b/vendor/github.com/russross/blackfriday/go.mod deleted file mode 100644 index b05561a066..0000000000 --- a/vendor/github.com/russross/blackfriday/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/russross/blackfriday diff --git a/vendor/github.com/russross/blackfriday/html.go b/vendor/github.com/russross/blackfriday/html.go deleted file mode 100644 index e0a6c69c96..0000000000 --- a/vendor/github.com/russross/blackfriday/html.go +++ /dev/null @@ -1,938 +0,0 @@ -// -// Blackfriday Markdown Processor -// Available at http://github.com/russross/blackfriday -// -// Copyright © 2011 Russ Ross . -// Distributed under the Simplified BSD License. -// See README.md for details. -// - -// -// -// HTML rendering backend -// -// - -package blackfriday - -import ( - "bytes" - "fmt" - "regexp" - "strconv" - "strings" -) - -// Html renderer configuration options. -const ( - HTML_SKIP_HTML = 1 << iota // skip preformatted HTML blocks - HTML_SKIP_STYLE // skip embedded \n") - out.WriteString("\n") - - options.tocMarker = out.Len() -} - -func (options *Html) DocumentFooter(out *bytes.Buffer) { - // finalize and insert the table of contents - if options.flags&HTML_TOC != 0 { - options.TocFinalize() - - // now we have to insert the table of contents into the document - var temp bytes.Buffer - - // start by making a copy of everything after the document header - temp.Write(out.Bytes()[options.tocMarker:]) - - // now clear the copied material from the main output buffer - out.Truncate(options.tocMarker) - - // corner case spacing issue - if options.flags&HTML_COMPLETE_PAGE != 0 { - out.WriteByte('\n') - } - - // insert the table of contents - out.WriteString("\n") - - // corner case spacing issue - if options.flags&HTML_COMPLETE_PAGE == 0 && options.flags&HTML_OMIT_CONTENTS == 0 { - out.WriteByte('\n') - } - - // write out everything that came after it - if options.flags&HTML_OMIT_CONTENTS == 0 { - out.Write(temp.Bytes()) - } - } - - if options.flags&HTML_COMPLETE_PAGE != 0 { - out.WriteString("\n\n") - out.WriteString("\n") - } - -} - -func (options *Html) TocHeaderWithAnchor(text []byte, level int, anchor string) { - for level > options.currentLevel { - switch { - case bytes.HasSuffix(options.toc.Bytes(), []byte("\n")): - // this sublist can nest underneath a header - size := options.toc.Len() - options.toc.Truncate(size - len("\n")) - - case options.currentLevel > 0: - options.toc.WriteString("
  • ") - } - if options.toc.Len() > 0 { - options.toc.WriteByte('\n') - } - options.toc.WriteString("
      \n") - options.currentLevel++ - } - - for level < options.currentLevel { - options.toc.WriteString("
    ") - if options.currentLevel > 1 { - options.toc.WriteString("
  • \n") - } - options.currentLevel-- - } - - options.toc.WriteString("
  • ") - options.headerCount++ - - options.toc.Write(text) - - options.toc.WriteString("
  • \n") -} - -func (options *Html) TocHeader(text []byte, level int) { - options.TocHeaderWithAnchor(text, level, "") -} - -func (options *Html) TocFinalize() { - for options.currentLevel > 1 { - options.toc.WriteString("\n") - options.currentLevel-- - } - - if options.currentLevel > 0 { - options.toc.WriteString("\n") - } -} - -func isHtmlTag(tag []byte, tagname string) bool { - found, _ := findHtmlTagPos(tag, tagname) - return found -} - -// Look for a character, but ignore it when it's in any kind of quotes, it -// might be JavaScript -func skipUntilCharIgnoreQuotes(html []byte, start int, char byte) int { - inSingleQuote := false - inDoubleQuote := false - inGraveQuote := false - i := start - for i < len(html) { - switch { - case html[i] == char && !inSingleQuote && !inDoubleQuote && !inGraveQuote: - return i - case html[i] == '\'': - inSingleQuote = !inSingleQuote - case html[i] == '"': - inDoubleQuote = !inDoubleQuote - case html[i] == '`': - inGraveQuote = !inGraveQuote - } - i++ - } - return start -} - -func findHtmlTagPos(tag []byte, tagname string) (bool, int) { - i := 0 - if i < len(tag) && tag[0] != '<' { - return false, -1 - } - i++ - i = skipSpace(tag, i) - - if i < len(tag) && tag[i] == '/' { - i++ - } - - i = skipSpace(tag, i) - j := 0 - for ; i < len(tag); i, j = i+1, j+1 { - if j >= len(tagname) { - break - } - - if strings.ToLower(string(tag[i]))[0] != tagname[j] { - return false, -1 - } - } - - if i == len(tag) { - return false, -1 - } - - rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>') - if rightAngle > i { - return true, rightAngle - } - - return false, -1 -} - -func skipUntilChar(text []byte, start int, char byte) int { - i := start - for i < len(text) && text[i] != char { - i++ - } - return i -} - -func skipSpace(tag []byte, i int) int { - for i < len(tag) && isspace(tag[i]) { - i++ - } - return i -} - -func skipChar(data []byte, start int, char byte) int { - i := start - for i < len(data) && data[i] == char { - i++ - } - return i -} - -func doubleSpace(out *bytes.Buffer) { - if out.Len() > 0 { - out.WriteByte('\n') - } -} - -func isRelativeLink(link []byte) (yes bool) { - // a tag begin with '#' - if link[0] == '#' { - return true - } - - // link begin with '/' but not '//', the second maybe a protocol relative link - if len(link) >= 2 && link[0] == '/' && link[1] != '/' { - return true - } - - // only the root '/' - if len(link) == 1 && link[0] == '/' { - return true - } - - // current directory : begin with "./" - if bytes.HasPrefix(link, []byte("./")) { - return true - } - - // parent directory : begin with "../" - if bytes.HasPrefix(link, []byte("../")) { - return true - } - - return false -} - -func (options *Html) ensureUniqueHeaderID(id string) string { - for count, found := options.headerIDs[id]; found; count, found = options.headerIDs[id] { - tmp := fmt.Sprintf("%s-%d", id, count+1) - - if _, tmpFound := options.headerIDs[tmp]; !tmpFound { - options.headerIDs[id] = count + 1 - id = tmp - } else { - id = id + "-1" - } - } - - if _, found := options.headerIDs[id]; !found { - options.headerIDs[id] = 0 - } - - return id -} diff --git a/vendor/github.com/russross/blackfriday/latex.go b/vendor/github.com/russross/blackfriday/latex.go deleted file mode 100644 index 3d30d09474..0000000000 --- a/vendor/github.com/russross/blackfriday/latex.go +++ /dev/null @@ -1,334 +0,0 @@ -// -// Blackfriday Markdown Processor -// Available at http://github.com/russross/blackfriday -// -// Copyright © 2011 Russ Ross . -// Distributed under the Simplified BSD License. -// See README.md for details. -// - -// -// -// LaTeX rendering backend -// -// - -package blackfriday - -import ( - "bytes" - "strings" -) - -// Latex is a type that implements the Renderer interface for LaTeX output. -// -// Do not create this directly, instead use the LatexRenderer function. -type Latex struct { -} - -// LatexRenderer creates and configures a Latex object, which -// satisfies the Renderer interface. -// -// flags is a set of LATEX_* options ORed together (currently no such options -// are defined). -func LatexRenderer(flags int) Renderer { - return &Latex{} -} - -func (options *Latex) GetFlags() int { - return 0 -} - -// render code chunks using verbatim, or listings if we have a language -func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, info string) { - if info == "" { - out.WriteString("\n\\begin{verbatim}\n") - } else { - lang := strings.Fields(info)[0] - out.WriteString("\n\\begin{lstlisting}[language=") - out.WriteString(lang) - out.WriteString("]\n") - } - out.Write(text) - if info == "" { - out.WriteString("\n\\end{verbatim}\n") - } else { - out.WriteString("\n\\end{lstlisting}\n") - } -} - -func (options *Latex) TitleBlock(out *bytes.Buffer, text []byte) { - -} - -func (options *Latex) BlockQuote(out *bytes.Buffer, text []byte) { - out.WriteString("\n\\begin{quotation}\n") - out.Write(text) - out.WriteString("\n\\end{quotation}\n") -} - -func (options *Latex) BlockHtml(out *bytes.Buffer, text []byte) { - // a pretty lame thing to do... - out.WriteString("\n\\begin{verbatim}\n") - out.Write(text) - out.WriteString("\n\\end{verbatim}\n") -} - -func (options *Latex) Header(out *bytes.Buffer, text func() bool, level int, id string) { - marker := out.Len() - - switch level { - case 1: - out.WriteString("\n\\section{") - case 2: - out.WriteString("\n\\subsection{") - case 3: - out.WriteString("\n\\subsubsection{") - case 4: - out.WriteString("\n\\paragraph{") - case 5: - out.WriteString("\n\\subparagraph{") - case 6: - out.WriteString("\n\\textbf{") - } - if !text() { - out.Truncate(marker) - return - } - out.WriteString("}\n") -} - -func (options *Latex) HRule(out *bytes.Buffer) { - out.WriteString("\n\\HRule\n") -} - -func (options *Latex) List(out *bytes.Buffer, text func() bool, flags int) { - marker := out.Len() - if flags&LIST_TYPE_ORDERED != 0 { - out.WriteString("\n\\begin{enumerate}\n") - } else { - out.WriteString("\n\\begin{itemize}\n") - } - if !text() { - out.Truncate(marker) - return - } - if flags&LIST_TYPE_ORDERED != 0 { - out.WriteString("\n\\end{enumerate}\n") - } else { - out.WriteString("\n\\end{itemize}\n") - } -} - -func (options *Latex) ListItem(out *bytes.Buffer, text []byte, flags int) { - out.WriteString("\n\\item ") - out.Write(text) -} - -func (options *Latex) Paragraph(out *bytes.Buffer, text func() bool) { - marker := out.Len() - out.WriteString("\n") - if !text() { - out.Truncate(marker) - return - } - out.WriteString("\n") -} - -func (options *Latex) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) { - out.WriteString("\n\\begin{tabular}{") - for _, elt := range columnData { - switch elt { - case TABLE_ALIGNMENT_LEFT: - out.WriteByte('l') - case TABLE_ALIGNMENT_RIGHT: - out.WriteByte('r') - default: - out.WriteByte('c') - } - } - out.WriteString("}\n") - out.Write(header) - out.WriteString(" \\\\\n\\hline\n") - out.Write(body) - out.WriteString("\n\\end{tabular}\n") -} - -func (options *Latex) TableRow(out *bytes.Buffer, text []byte) { - if out.Len() > 0 { - out.WriteString(" \\\\\n") - } - out.Write(text) -} - -func (options *Latex) TableHeaderCell(out *bytes.Buffer, text []byte, align int) { - if out.Len() > 0 { - out.WriteString(" & ") - } - out.Write(text) -} - -func (options *Latex) TableCell(out *bytes.Buffer, text []byte, align int) { - if out.Len() > 0 { - out.WriteString(" & ") - } - out.Write(text) -} - -// TODO: this -func (options *Latex) Footnotes(out *bytes.Buffer, text func() bool) { - -} - -func (options *Latex) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) { - -} - -func (options *Latex) AutoLink(out *bytes.Buffer, link []byte, kind int) { - out.WriteString("\\href{") - if kind == LINK_TYPE_EMAIL { - out.WriteString("mailto:") - } - out.Write(link) - out.WriteString("}{") - out.Write(link) - out.WriteString("}") -} - -func (options *Latex) CodeSpan(out *bytes.Buffer, text []byte) { - out.WriteString("\\texttt{") - escapeSpecialChars(out, text) - out.WriteString("}") -} - -func (options *Latex) DoubleEmphasis(out *bytes.Buffer, text []byte) { - out.WriteString("\\textbf{") - out.Write(text) - out.WriteString("}") -} - -func (options *Latex) Emphasis(out *bytes.Buffer, text []byte) { - out.WriteString("\\textit{") - out.Write(text) - out.WriteString("}") -} - -func (options *Latex) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) { - if bytes.HasPrefix(link, []byte("http://")) || bytes.HasPrefix(link, []byte("https://")) { - // treat it like a link - out.WriteString("\\href{") - out.Write(link) - out.WriteString("}{") - out.Write(alt) - out.WriteString("}") - } else { - out.WriteString("\\includegraphics{") - out.Write(link) - out.WriteString("}") - } -} - -func (options *Latex) LineBreak(out *bytes.Buffer) { - out.WriteString(" \\\\\n") -} - -func (options *Latex) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) { - out.WriteString("\\href{") - out.Write(link) - out.WriteString("}{") - out.Write(content) - out.WriteString("}") -} - -func (options *Latex) RawHtmlTag(out *bytes.Buffer, tag []byte) { -} - -func (options *Latex) TripleEmphasis(out *bytes.Buffer, text []byte) { - out.WriteString("\\textbf{\\textit{") - out.Write(text) - out.WriteString("}}") -} - -func (options *Latex) StrikeThrough(out *bytes.Buffer, text []byte) { - out.WriteString("\\sout{") - out.Write(text) - out.WriteString("}") -} - -// TODO: this -func (options *Latex) FootnoteRef(out *bytes.Buffer, ref []byte, id int) { - -} - -func needsBackslash(c byte) bool { - for _, r := range []byte("_{}%$&\\~#") { - if c == r { - return true - } - } - return false -} - -func escapeSpecialChars(out *bytes.Buffer, text []byte) { - for i := 0; i < len(text); i++ { - // directly copy normal characters - org := i - - for i < len(text) && !needsBackslash(text[i]) { - i++ - } - if i > org { - out.Write(text[org:i]) - } - - // escape a character - if i >= len(text) { - break - } - out.WriteByte('\\') - out.WriteByte(text[i]) - } -} - -func (options *Latex) Entity(out *bytes.Buffer, entity []byte) { - // TODO: convert this into a unicode character or something - out.Write(entity) -} - -func (options *Latex) NormalText(out *bytes.Buffer, text []byte) { - escapeSpecialChars(out, text) -} - -// header and footer -func (options *Latex) DocumentHeader(out *bytes.Buffer) { - out.WriteString("\\documentclass{article}\n") - out.WriteString("\n") - out.WriteString("\\usepackage{graphicx}\n") - out.WriteString("\\usepackage{listings}\n") - out.WriteString("\\usepackage[margin=1in]{geometry}\n") - out.WriteString("\\usepackage[utf8]{inputenc}\n") - out.WriteString("\\usepackage{verbatim}\n") - out.WriteString("\\usepackage[normalem]{ulem}\n") - out.WriteString("\\usepackage{hyperref}\n") - out.WriteString("\n") - out.WriteString("\\hypersetup{colorlinks,%\n") - out.WriteString(" citecolor=black,%\n") - out.WriteString(" filecolor=black,%\n") - out.WriteString(" linkcolor=black,%\n") - out.WriteString(" urlcolor=black,%\n") - out.WriteString(" pdfstartview=FitH,%\n") - out.WriteString(" breaklinks=true,%\n") - out.WriteString(" pdfauthor={Blackfriday Markdown Processor v") - out.WriteString(VERSION) - out.WriteString("}}\n") - out.WriteString("\n") - out.WriteString("\\newcommand{\\HRule}{\\rule{\\linewidth}{0.5mm}}\n") - out.WriteString("\\addtolength{\\parskip}{0.5\\baselineskip}\n") - out.WriteString("\\parindent=0pt\n") - out.WriteString("\n") - out.WriteString("\\begin{document}\n") -} - -func (options *Latex) DocumentFooter(out *bytes.Buffer) { - out.WriteString("\n\\end{document}\n") -} diff --git a/vendor/github.com/russross/blackfriday/.gitignore b/vendor/github.com/russross/blackfriday/v2/.gitignore similarity index 100% rename from vendor/github.com/russross/blackfriday/.gitignore rename to vendor/github.com/russross/blackfriday/v2/.gitignore diff --git a/vendor/github.com/russross/blackfriday/.travis.yml b/vendor/github.com/russross/blackfriday/v2/.travis.yml similarity index 90% rename from vendor/github.com/russross/blackfriday/.travis.yml rename to vendor/github.com/russross/blackfriday/v2/.travis.yml index 2f3351d7ae..b0b525a5a8 100644 --- a/vendor/github.com/russross/blackfriday/.travis.yml +++ b/vendor/github.com/russross/blackfriday/v2/.travis.yml @@ -1,8 +1,8 @@ sudo: false language: go go: - - "1.9.x" - "1.10.x" + - "1.11.x" - tip matrix: fast_finish: true @@ -14,4 +14,4 @@ script: - go get -t -v ./... - diff -u <(echo -n) <(gofmt -d -s .) - go tool vet . - - go test -v -race ./... + - go test -v ./... diff --git a/vendor/github.com/russross/blackfriday/LICENSE.txt b/vendor/github.com/russross/blackfriday/v2/LICENSE.txt similarity index 100% rename from vendor/github.com/russross/blackfriday/LICENSE.txt rename to vendor/github.com/russross/blackfriday/v2/LICENSE.txt diff --git a/vendor/github.com/russross/blackfriday/README.md b/vendor/github.com/russross/blackfriday/v2/README.md similarity index 67% rename from vendor/github.com/russross/blackfriday/README.md rename to vendor/github.com/russross/blackfriday/v2/README.md index 3c62e13753..d5a8649bd5 100644 --- a/vendor/github.com/russross/blackfriday/README.md +++ b/vendor/github.com/russross/blackfriday/v2/README.md @@ -1,6 +1,4 @@ -Blackfriday -[![Build Status][BuildSVG]][BuildURL] -[![Godoc][GodocV2SVG]][GodocV2URL] +Blackfriday [![Build Status](https://travis-ci.org/russross/blackfriday.svg?branch=master)](https://travis-ci.org/russross/blackfriday) =========== Blackfriday is a [Markdown][1] processor implemented in [Go][2]. It @@ -18,12 +16,18 @@ It started as a translation from C of [Sundown][3]. Installation ------------ -Blackfriday is compatible with any modern Go release. With Go and git installed: +Blackfriday is compatible with any modern Go release. With Go 1.7 and git +installed: - go get -u gopkg.in/russross/blackfriday.v2 + go get gopkg.in/russross/blackfriday.v2 -will download, compile, and install the package into your `$GOPATH` directory -hierarchy. +will download, compile, and install the package into your `$GOPATH` +directory hierarchy. Alternatively, you can achieve the same if you +import it into a project: + + import "gopkg.in/russross/blackfriday.v2" + +and `go get` without parameters. Versions @@ -34,7 +38,7 @@ developed on its own branch: https://github.com/russross/blackfriday/tree/v2 and documentation is available at https://godoc.org/gopkg.in/russross/blackfriday.v2. -It is `go get`-able via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`, +It is `go get`-able via via [gopkg.in][6] at `gopkg.in/russross/blackfriday.v2`, but we highly recommend using package management tool like [dep][7] or [Glide][8] and make use of semantic versioning. With package management you should import `github.com/russross/blackfriday` and specify that you're using @@ -58,43 +62,9 @@ Potential drawbacks: v2. See issue [#348](https://github.com/russross/blackfriday/issues/348) for tracking. -If you are still interested in the legacy `v1`, you can import it from -`github.com/russross/blackfriday`. Documentation for the legacy v1 can be found -here: https://godoc.org/github.com/russross/blackfriday - -### Known issue with `dep` - -There is a known problem with using Blackfriday v1 _transitively_ and `dep`. -Currently `dep` prioritizes semver versions over anything else, and picks the -latest one, plus it does not apply a `[[constraint]]` specifier to transitively -pulled in packages. So if you're using something that uses Blackfriday v1, but -that something does not use `dep` yet, you will get Blackfriday v2 pulled in and -your first dependency will fail to build. - -There are couple of fixes for it, documented here: -https://github.com/golang/dep/blob/master/docs/FAQ.md#how-do-i-constrain-a-transitive-dependencys-version - -Meanwhile, `dep` team is working on a more general solution to the constraints -on transitive dependencies problem: https://github.com/golang/dep/issues/1124. - - Usage ----- -### v1 - -For basic usage, it is as simple as getting your input into a byte -slice and calling: - - output := blackfriday.MarkdownBasic(input) - -This renders it with no extensions enabled. To get a more useful -feature set, use this instead: - - output := blackfriday.MarkdownCommon(input) - -### v2 - For the most sensible markdown processing, it is as simple as getting your input into a byte slice and calling: @@ -121,7 +91,7 @@ Here's an example of simple usage of Blackfriday together with Bluemonday: ```go import ( "github.com/microcosm-cc/bluemonday" - "gopkg.in/russross/blackfriday.v2" + "github.com/russross/blackfriday" ) // ... @@ -129,21 +99,11 @@ unsafe := blackfriday.Run(input) html := bluemonday.UGCPolicy().SanitizeBytes(unsafe) ``` -### Custom options, v1 - -If you want to customize the set of options, first get a renderer -(currently only the HTML output engine), then use it to -call the more general `Markdown` function. For examples, see the -implementations of `MarkdownBasic` and `MarkdownCommon` in -`markdown.go`. - -### Custom options, v2 +### Custom options If you want to customize the set of options, use `blackfriday.WithExtensions`, `blackfriday.WithRenderer` and `blackfriday.WithRefOverride`. -### `blackfriday-tool` - You can also check out `blackfriday-tool` for a more complete example of how to use it. Download and install it using: @@ -163,22 +123,6 @@ installed in `$GOPATH/bin`. This is a statically-linked binary that can be copied to wherever you need it without worrying about dependencies and library versions. -### Sanitized anchor names - -Blackfriday includes an algorithm for creating sanitized anchor names -corresponding to a given input text. This algorithm is used to create -anchors for headings when `EXTENSION_AUTO_HEADER_IDS` is enabled. The -algorithm has a specification, so that other packages can create -compatible anchor names and links to those anchors. - -The specification is located at https://godoc.org/github.com/russross/blackfriday#hdr-Sanitized_Anchor_Names. - -[`SanitizedAnchorName`](https://godoc.org/github.com/russross/blackfriday#SanitizedAnchorName) exposes this functionality, and can be used to -create compatible links to the anchor names generated by blackfriday. -This algorithm is also implemented in a small standalone package at -[`github.com/shurcooL/sanitized_anchor_name`](https://godoc.org/github.com/shurcooL/sanitized_anchor_name). It can be useful for clients -that want a small package and don't need full functionality of blackfriday. - Features -------- @@ -246,7 +190,7 @@ implements the following extensions: and supply a language (to make syntax highlighting simple). Just mark it like this: - ``` go + ```go func getTrue() bool { return true } @@ -255,21 +199,12 @@ implements the following extensions: You can use 3 or more backticks to mark the beginning of the block, and the same number to mark the end of the block. - To preserve classes of fenced code blocks while using the bluemonday - HTML sanitizer, use the following policy: - - ``` go - p := bluemonday.UGCPolicy() - p.AllowAttrs("class").Matching(regexp.MustCompile("^language-[a-zA-Z0-9]+$")).OnElements("code") - html := p.SanitizeBytes(unsafe) - ``` - * **Definition lists**. A simple definition list is made of a single-line term followed by a colon and the definition for that term. Cat : Fluffy animal everyone likes - + Internet : Vector of transmission for pictures of cats @@ -280,7 +215,7 @@ implements the following extensions: end of the document. A footnote looks like this: This is a footnote.[^1] - + [^1]: the footnote text. * **Autolinking**. Blackfriday can find URLs that have not been @@ -289,10 +224,8 @@ implements the following extensions: * **Strikethrough**. Use two tildes (`~~`) to mark text that should be crossed out. -* **Hard line breaks**. With this extension enabled (it is off by - default in the `MarkdownBasic` and `MarkdownCommon` convenience - functions), newlines in the input translate into line breaks in - the output. +* **Hard line breaks**. With this extension enabled newlines in the input + translate into line breaks in the output. This extension is off by default. * **Smart quotes**. Smartypants-style punctuation substitution is supported, turning normal double- and single-quote marks into @@ -328,24 +261,20 @@ are a few of note: * [markdownfmt](https://github.com/shurcooL/markdownfmt): like gofmt, but for markdown. -* [LaTeX output](https://bitbucket.org/ambrevar/blackfriday-latex): +* [LaTeX output](https://github.com/Ambrevar/Blackfriday-LaTeX): renders output as LaTeX. -* [bfchroma](https://github.com/Depado/bfchroma/): provides convenience - integration with the [Chroma](https://github.com/alecthomas/chroma) code - highlighting library. bfchroma is only compatible with v2 of Blackfriday and - provides a drop-in renderer ready to use with Blackfriday, as well as - options and means for further customization. +* [Blackfriday-Confluence](https://github.com/kentaro-m/blackfriday-confluence): provides a [Confluence Wiki Markup](https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html) renderer. -TODO +Todo ---- * More unit testing -* Improve Unicode support. It does not understand all Unicode +* Improve unicode support. It does not understand all unicode rules (about what constitutes a letter, a punctuation symbol, etc.), so it may fail to detect word boundaries correctly in - some instances. It is safe on all UTF-8 input. + some instances. It is safe on all utf-8 input. License @@ -360,10 +289,3 @@ License [4]: https://godoc.org/gopkg.in/russross/blackfriday.v2#Parse "Parse func" [5]: https://github.com/microcosm-cc/bluemonday "Bluemonday" [6]: https://labix.org/gopkg.in "gopkg.in" - [7]: https://github.com/golang/dep/ "dep" - [8]: https://github.com/Masterminds/glide "Glide" - - [BuildSVG]: https://travis-ci.org/russross/blackfriday.svg?branch=master - [BuildURL]: https://travis-ci.org/russross/blackfriday - [GodocV2SVG]: https://godoc.org/gopkg.in/russross/blackfriday.v2?status.svg - [GodocV2URL]: https://godoc.org/gopkg.in/russross/blackfriday.v2 diff --git a/vendor/github.com/russross/blackfriday/block.go b/vendor/github.com/russross/blackfriday/v2/block.go similarity index 56% rename from vendor/github.com/russross/blackfriday/block.go rename to vendor/github.com/russross/blackfriday/v2/block.go index 45c21a6c26..b8607474e5 100644 --- a/vendor/github.com/russross/blackfriday/block.go +++ b/vendor/github.com/russross/blackfriday/v2/block.go @@ -15,18 +15,27 @@ package blackfriday import ( "bytes" + "html" + "regexp" "strings" - "unicode" + + "github.com/shurcooL/sanitized_anchor_name" +) + +const ( + charEntity = "&(?:#x[a-f0-9]{1,8}|#[0-9]{1,8}|[a-z][a-z0-9]{1,31});" + escapable = "[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]" +) + +var ( + reBackslashOrAmp = regexp.MustCompile("[\\&]") + reEntityOrEscapedChar = regexp.MustCompile("(?i)\\\\" + escapable + "|" + charEntity) ) // Parse block-level data. // Note: this function and many that it calls assume that // the input buffer ends with a newline. -func (p *parser) block(out *bytes.Buffer, data []byte) { - if len(data) == 0 || data[len(data)-1] != '\n' { - panic("block input is missing terminating newline") - } - +func (p *Markdown) block(data []byte) { // this is called recursively: enforce a maximum depth if p.nesting >= p.maxNesting { return @@ -35,14 +44,14 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // parse out one block-level construct at a time for len(data) > 0 { - // prefixed header: + // prefixed heading: // - // # Header 1 - // ## Header 2 + // # Heading 1 + // ## Heading 2 // ... - // ###### Header 6 - if p.isPrefixHeader(data) { - data = data[p.prefixHeader(out, data):] + // ###### Heading 6 + if p.isPrefixHeading(data) { + data = data[p.prefixHeading(data):] continue } @@ -52,7 +61,7 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // ... // if data[0] == '<' { - if i := p.html(out, data, true); i > 0 { + if i := p.html(data, true); i > 0 { data = data[i:] continue } @@ -63,9 +72,9 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // % stuff // % more stuff // % even more stuff - if p.flags&EXTENSION_TITLEBLOCK != 0 { + if p.extensions&Titleblock != 0 { if data[0] == '%' { - if i := p.titleBlock(out, data, true); i > 0 { + if i := p.titleBlock(data, true); i > 0 { data = data[i:] continue } @@ -87,13 +96,13 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // return b // } if p.codePrefix(data) > 0 { - data = data[p.code(out, data):] + data = data[p.code(data):] continue } // fenced code block: // - // ``` go info string here + // ``` go // func fact(n int) int { // if n <= 1 { // return n @@ -101,8 +110,8 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // return n * fact(n-1) // } // ``` - if p.flags&EXTENSION_FENCED_CODE != 0 { - if i := p.fencedCodeBlock(out, data, true); i > 0 { + if p.extensions&FencedCode != 0 { + if i := p.fencedCodeBlock(data, true); i > 0 { data = data[i:] continue } @@ -116,9 +125,9 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // or // ______ if p.isHRule(data) { - p.r.HRule(out) + p.addBlock(HorizontalRule, nil) var i int - for i = 0; data[i] != '\n'; i++ { + for i = 0; i < len(data) && data[i] != '\n'; i++ { } data = data[i:] continue @@ -129,7 +138,7 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // > A big quote I found somewhere // > on the web if p.quotePrefix(data) > 0 { - data = data[p.quote(out, data):] + data = data[p.quote(data):] continue } @@ -139,8 +148,8 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // ------|-----|--------- // Bob | 31 | 555-1234 // Alice | 27 | 555-4321 - if p.flags&EXTENSION_TABLES != 0 { - if i := p.table(out, data); i > 0 { + if p.extensions&Tables != 0 { + if i := p.table(data); i > 0 { data = data[i:] continue } @@ -153,7 +162,7 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // // also works with + or - if p.uliPrefix(data) > 0 { - data = data[p.list(out, data, 0):] + data = data[p.list(data, 0):] continue } @@ -162,7 +171,7 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // 1. Item 1 // 2. Item 2 if p.oliPrefix(data) > 0 { - data = data[p.list(out, data, LIST_TYPE_ORDERED):] + data = data[p.list(data, ListTypeOrdered):] continue } @@ -174,55 +183,62 @@ func (p *parser) block(out *bytes.Buffer, data []byte) { // // Term 2 // : Definition c - if p.flags&EXTENSION_DEFINITION_LISTS != 0 { + if p.extensions&DefinitionLists != 0 { if p.dliPrefix(data) > 0 { - data = data[p.list(out, data, LIST_TYPE_DEFINITION):] + data = data[p.list(data, ListTypeDefinition):] continue } } // anything else must look like a normal paragraph - // note: this finds underlined headers, too - data = data[p.paragraph(out, data):] + // note: this finds underlined headings, too + data = data[p.paragraph(data):] } p.nesting-- } -func (p *parser) isPrefixHeader(data []byte) bool { +func (p *Markdown) addBlock(typ NodeType, content []byte) *Node { + p.closeUnmatchedBlocks() + container := p.addChild(typ, 0) + container.content = content + return container +} + +func (p *Markdown) isPrefixHeading(data []byte) bool { if data[0] != '#' { return false } - if p.flags&EXTENSION_SPACE_HEADERS != 0 { + if p.extensions&SpaceHeadings != 0 { level := 0 - for level < 6 && data[level] == '#' { + for level < 6 && level < len(data) && data[level] == '#' { level++ } - if data[level] != ' ' { + if level == len(data) || data[level] != ' ' { return false } } return true } -func (p *parser) prefixHeader(out *bytes.Buffer, data []byte) int { +func (p *Markdown) prefixHeading(data []byte) int { level := 0 - for level < 6 && data[level] == '#' { + for level < 6 && level < len(data) && data[level] == '#' { level++ } i := skipChar(data, level, ' ') end := skipUntilChar(data, i, '\n') skip := end id := "" - if p.flags&EXTENSION_HEADER_IDS != 0 { + if p.extensions&HeadingIDs != 0 { j, k := 0, 0 - // find start/end of header id + // find start/end of heading id for j = i; j < end-1 && (data[j] != '{' || data[j+1] != '#'); j++ { } for k = j + 1; k < end && data[k] != '}'; k++ { } - // extract header id iff found + // extract heading id iff found if j < end && k < end { id = string(data[j+2 : k]) end = j @@ -242,45 +258,41 @@ func (p *parser) prefixHeader(out *bytes.Buffer, data []byte) int { end-- } if end > i { - if id == "" && p.flags&EXTENSION_AUTO_HEADER_IDS != 0 { - id = SanitizedAnchorName(string(data[i:end])) + if id == "" && p.extensions&AutoHeadingIDs != 0 { + id = sanitized_anchor_name.Create(string(data[i:end])) } - work := func() bool { - p.inline(out, data[i:end]) - return true - } - p.r.Header(out, work, level, id) + block := p.addBlock(Heading, data[i:end]) + block.HeadingID = id + block.Level = level } return skip } -func (p *parser) isUnderlinedHeader(data []byte) int { - // test of level 1 header +func (p *Markdown) isUnderlinedHeading(data []byte) int { + // test of level 1 heading if data[0] == '=' { i := skipChar(data, 1, '=') i = skipChar(data, i, ' ') - if data[i] == '\n' { + if i < len(data) && data[i] == '\n' { return 1 - } else { - return 0 } + return 0 } - // test of level 2 header + // test of level 2 heading if data[0] == '-' { i := skipChar(data, 1, '-') i = skipChar(data, i, ' ') - if data[i] == '\n' { + if i < len(data) && data[i] == '\n' { return 2 - } else { - return 0 } + return 0 } return 0 } -func (p *parser) titleBlock(out *bytes.Buffer, data []byte, doRender bool) int { +func (p *Markdown) titleBlock(data []byte, doRender bool) int { if data[0] != '%' { return 0 } @@ -294,12 +306,17 @@ func (p *parser) titleBlock(out *bytes.Buffer, data []byte, doRender bool) int { } data = bytes.Join(splitData[0:i], []byte("\n")) - p.r.TitleBlock(out, data) - - return len(data) + consumed := len(data) + data = bytes.TrimPrefix(data, []byte("% ")) + data = bytes.Replace(data, []byte("\n% "), []byte("\n"), -1) + block := p.addBlock(Heading, data) + block.Level = 1 + block.IsTitleblock = true + + return consumed } -func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int { +func (p *Markdown) html(data []byte, doRender bool) int { var i, j int // identify the opening tag @@ -311,17 +328,12 @@ func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int { // handle special cases if !tagfound { // check for an HTML comment - if size := p.htmlComment(out, data, doRender); size > 0 { + if size := p.htmlComment(data, doRender); size > 0 { return size } // check for an
    tag - if size := p.htmlHr(out, data, doRender); size > 0 { - return size - } - - // check for HTML CDATA - if size := p.htmlCDATA(out, data, doRender); size > 0 { + if size := p.htmlHr(data, doRender); size > 0 { return size } @@ -396,60 +408,42 @@ func (p *parser) html(out *bytes.Buffer, data []byte, doRender bool) int { for end > 0 && data[end-1] == '\n' { end-- } - p.r.BlockHtml(out, data[:end]) + finalizeHTMLBlock(p.addBlock(HTMLBlock, data[:end])) } return i } -func (p *parser) renderHTMLBlock(out *bytes.Buffer, data []byte, start int, doRender bool) int { - // html block needs to end with a blank line - if i := p.isEmpty(data[start:]); i > 0 { - size := start + i +func finalizeHTMLBlock(block *Node) { + block.Literal = block.content + block.content = nil +} + +// HTML comment, lax form +func (p *Markdown) htmlComment(data []byte, doRender bool) int { + i := p.inlineHTMLComment(data) + // needs to end with a blank line + if j := p.isEmpty(data[i:]); j > 0 { + size := i + j if doRender { // trim trailing newlines end := size for end > 0 && data[end-1] == '\n' { end-- } - p.r.BlockHtml(out, data[:end]) + block := p.addBlock(HTMLBlock, data[:end]) + finalizeHTMLBlock(block) } return size } return 0 } -// HTML comment, lax form -func (p *parser) htmlComment(out *bytes.Buffer, data []byte, doRender bool) int { - i := p.inlineHTMLComment(out, data) - return p.renderHTMLBlock(out, data, i, doRender) -} - -// HTML CDATA section -func (p *parser) htmlCDATA(out *bytes.Buffer, data []byte, doRender bool) int { - const cdataTag = "') { - i++ - } - i++ - // no end-of-comment marker - if i >= len(data) { +// HR, which is the only self-closing block tag considered +func (p *Markdown) htmlHr(data []byte, doRender bool) int { + if len(data) < 4 { return 0 } - return p.renderHTMLBlock(out, data, i, doRender) -} - -// HR, which is the only self-closing block tag considered -func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int { if data[0] != '<' || (data[1] != 'h' && data[1] != 'H') || (data[2] != 'r' && data[2] != 'R') { return 0 } @@ -457,22 +451,31 @@ func (p *parser) htmlHr(out *bytes.Buffer, data []byte, doRender bool) int { // not an
    tag after all; at least not a valid one return 0 } - i := 3 - for data[i] != '>' && data[i] != '\n' { + for i < len(data) && data[i] != '>' && data[i] != '\n' { i++ } - - if data[i] == '>' { - return p.renderHTMLBlock(out, data, i+1, doRender) + if i < len(data) && data[i] == '>' { + i++ + if j := p.isEmpty(data[i:]); j > 0 { + size := i + j + if doRender { + // trim newlines + end := size + for end > 0 && data[end-1] == '\n' { + end-- + } + finalizeHTMLBlock(p.addBlock(HTMLBlock, data[:end])) + } + return size + } } - return 0 } -func (p *parser) htmlFindTag(data []byte) (string, bool) { +func (p *Markdown) htmlFindTag(data []byte) (string, bool) { i := 0 - for isalnum(data[i]) { + for i < len(data) && isalnum(data[i]) { i++ } key := string(data[:i]) @@ -482,9 +485,11 @@ func (p *parser) htmlFindTag(data []byte) (string, bool) { return "", false } -func (p *parser) htmlFindEnd(tag string, data []byte) int { +func (p *Markdown) htmlFindEnd(tag string, data []byte) int { // assume data[0] == '<' && data[1] == '/' already tested - + if tag == "hr" { + return 2 + } // check if tag is a match closetag := []byte("") if !bytes.HasPrefix(data, closetag) { @@ -504,7 +509,7 @@ func (p *parser) htmlFindEnd(tag string, data []byte) int { return i } - if p.flags&EXTENSION_LAX_HTML_BLOCKS != 0 { + if p.extensions&LaxHTMLBlocks != 0 { return i } if skip = p.isEmpty(data[i:]); skip == 0 { @@ -515,7 +520,7 @@ func (p *parser) htmlFindEnd(tag string, data []byte) int { return i + skip } -func (*parser) isEmpty(data []byte) int { +func (*Markdown) isEmpty(data []byte) int { // it is okay to call isEmpty on an empty buffer if len(data) == 0 { return 0 @@ -527,10 +532,13 @@ func (*parser) isEmpty(data []byte) int { return 0 } } - return i + 1 + if i < len(data) && data[i] == '\n' { + i++ + } + return i } -func (*parser) isHRule(data []byte) bool { +func (*Markdown) isHRule(data []byte) bool { i := 0 // skip up to three spaces @@ -546,7 +554,7 @@ func (*parser) isHRule(data []byte) bool { // the whole line must be the char or whitespace n := 0 - for data[i] != '\n' { + for i < len(data) && data[i] != '\n' { switch { case data[i] == c: n++ @@ -561,9 +569,8 @@ func (*parser) isHRule(data []byte) bool { // isFenceLine checks if there's a fence line (e.g., ``` or ``` go) at the beginning of data, // and returns the end index if so, or 0 otherwise. It also returns the marker found. -// If syntax is not nil, it gets set to the syntax specified in the fence line. -// A final newline is mandatory to recognize the fence line, unless newlineOptional is true. -func isFenceLine(data []byte, info *string, oldmarker string, newlineOptional bool) (end int, marker string) { +// If info is not nil, it gets set to the syntax specified in the fence line. +func isFenceLine(data []byte, info *string, oldmarker string) (end int, marker string) { i, size := 0, 0 // skip up to three spaces @@ -605,7 +612,7 @@ func isFenceLine(data []byte, info *string, oldmarker string, newlineOptional bo i = skipChar(data, i, ' ') if i >= len(data) { - if newlineOptional && i == len(data) { + if i == len(data) { return i, marker } return 0, "" @@ -636,8 +643,8 @@ func isFenceLine(data []byte, info *string, oldmarker string, newlineOptional bo for infoLength > 0 && isspace(data[infoStart+infoLength-1]) { infoLength-- } - i++ + i = skipChar(data, i, ' ') } else { for i < len(data) && !isverticalspace(data[i]) { infoLength++ @@ -648,35 +655,34 @@ func isFenceLine(data []byte, info *string, oldmarker string, newlineOptional bo *info = strings.TrimSpace(string(data[infoStart : infoStart+infoLength])) } - i = skipChar(data, i, ' ') - if i >= len(data) || data[i] != '\n' { - if newlineOptional && i == len(data) { - return i, marker - } + if i == len(data) { + return i, marker + } + if i > len(data) || data[i] != '\n' { return 0, "" } - return i + 1, marker // Take newline into account. } // fencedCodeBlock returns the end index if data contains a fenced code block at the beginning, // or 0 otherwise. It writes to out if doRender is true, otherwise it has no side effects. // If doRender is true, a final newline is mandatory to recognize the fenced code block. -func (p *parser) fencedCodeBlock(out *bytes.Buffer, data []byte, doRender bool) int { - var infoString string - beg, marker := isFenceLine(data, &infoString, "", false) +func (p *Markdown) fencedCodeBlock(data []byte, doRender bool) int { + var info string + beg, marker := isFenceLine(data, &info, "") if beg == 0 || beg >= len(data) { return 0 } var work bytes.Buffer + work.Write([]byte(info)) + work.WriteByte('\n') for { // safe to assume beg < len(data) // check for the end of the code block - newlineOptional := !doRender - fenceEnd, _ := isFenceLine(data[beg:], nil, marker, newlineOptional) + fenceEnd, _ := isFenceLine(data[beg:], nil, marker) if fenceEnd != 0 { beg += fenceEnd break @@ -698,24 +704,55 @@ func (p *parser) fencedCodeBlock(out *bytes.Buffer, data []byte, doRender bool) } if doRender { - p.r.BlockCode(out, work.Bytes(), infoString) + block := p.addBlock(CodeBlock, work.Bytes()) // TODO: get rid of temp buffer + block.IsFenced = true + finalizeCodeBlock(block) } return beg } -func (p *parser) table(out *bytes.Buffer, data []byte) int { - var header bytes.Buffer - i, columns := p.tableHeader(&header, data) +func unescapeChar(str []byte) []byte { + if str[0] == '\\' { + return []byte{str[1]} + } + return []byte(html.UnescapeString(string(str))) +} + +func unescapeString(str []byte) []byte { + if reBackslashOrAmp.Match(str) { + return reEntityOrEscapedChar.ReplaceAllFunc(str, unescapeChar) + } + return str +} + +func finalizeCodeBlock(block *Node) { + if block.IsFenced { + newlinePos := bytes.IndexByte(block.content, '\n') + firstLine := block.content[:newlinePos] + rest := block.content[newlinePos+1:] + block.Info = unescapeString(bytes.Trim(firstLine, "\n")) + block.Literal = rest + } else { + block.Literal = block.content + } + block.content = nil +} + +func (p *Markdown) table(data []byte) int { + table := p.addBlock(Table, nil) + i, columns := p.tableHeader(data) if i == 0 { + p.tip = table.Parent + table.Unlink() return 0 } - var body bytes.Buffer + p.addBlock(TableBody, nil) for i < len(data) { pipes, rowStart := 0, i - for ; data[i] != '\n'; i++ { + for ; i < len(data) && data[i] != '\n'; i++ { if data[i] == '|' { pipes++ } @@ -727,12 +764,12 @@ func (p *parser) table(out *bytes.Buffer, data []byte) int { } // include the newline in data sent to tableRow - i++ - p.tableRow(&body, data[rowStart:i], columns, false) + if i < len(data) && data[i] == '\n' { + i++ + } + p.tableRow(data[rowStart:i], columns, false) } - p.r.Table(out, header.Bytes(), body.Bytes(), columns) - return i } @@ -745,10 +782,10 @@ func isBackslashEscaped(data []byte, i int) bool { return backslashes&1 == 1 } -func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns []int) { +func (p *Markdown) tableHeader(data []byte) (size int, columns []CellAlignFlags) { i := 0 colCount := 1 - for i = 0; data[i] != '\n'; i++ { + for i = 0; i < len(data) && data[i] != '\n'; i++ { if data[i] == '|' && !isBackslashEscaped(data, i) { colCount++ } @@ -760,7 +797,11 @@ func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns } // include the newline in the data sent to tableRow - header := data[:i+1] + j := i + if j < len(data) && data[j] == '\n' { + j++ + } + header := data[:j] // column count ignores pipes at beginning or end of line if data[0] == '|' { @@ -770,7 +811,7 @@ func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns colCount-- } - columns = make([]int, colCount) + columns = make([]CellAlignFlags, colCount) // move on to the header underline i++ @@ -786,27 +827,29 @@ func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns // each column header is of form: / *:?-+:? *|/ with # dashes + # colons >= 3 // and trailing | optional on last column col := 0 - for data[i] != '\n' { + for i < len(data) && data[i] != '\n' { dashes := 0 if data[i] == ':' { i++ - columns[col] |= TABLE_ALIGNMENT_LEFT + columns[col] |= TableAlignmentLeft dashes++ } - for data[i] == '-' { + for i < len(data) && data[i] == '-' { i++ dashes++ } - if data[i] == ':' { + if i < len(data) && data[i] == ':' { i++ - columns[col] |= TABLE_ALIGNMENT_RIGHT + columns[col] |= TableAlignmentRight dashes++ } - for data[i] == ' ' { + for i < len(data) && data[i] == ' ' { i++ } - + if i == len(data) { + return + } // end of column test is messy switch { case dashes < 3: @@ -817,12 +860,12 @@ func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns // marker found, now skip past trailing whitespace col++ i++ - for data[i] == ' ' { + for i < len(data) && data[i] == ' ' { i++ } // trailing junk found after last column - if col >= colCount && data[i] != '\n' { + if col >= colCount && i < len(data) && data[i] != '\n' { return } @@ -843,27 +886,31 @@ func (p *parser) tableHeader(out *bytes.Buffer, data []byte) (size int, columns return } - p.tableRow(out, header, columns, true) - size = i + 1 + p.addBlock(TableHead, nil) + p.tableRow(header, columns, true) + size = i + if size < len(data) && data[size] == '\n' { + size++ + } return } -func (p *parser) tableRow(out *bytes.Buffer, data []byte, columns []int, header bool) { +func (p *Markdown) tableRow(data []byte, columns []CellAlignFlags, header bool) { + p.addBlock(TableRow, nil) i, col := 0, 0 - var rowWork bytes.Buffer if data[i] == '|' && !isBackslashEscaped(data, i) { i++ } for col = 0; col < len(columns) && i < len(data); col++ { - for data[i] == ' ' { + for i < len(data) && data[i] == ' ' { i++ } cellStart := i - for (data[i] != '|' || isBackslashEscaped(data, i)) && data[i] != '\n' { + for i < len(data) && (data[i] != '|' || isBackslashEscaped(data, i)) && data[i] != '\n' { i++ } @@ -872,42 +919,33 @@ func (p *parser) tableRow(out *bytes.Buffer, data []byte, columns []int, header // skip the end-of-cell marker, possibly taking us past end of buffer i++ - for cellEnd > cellStart && data[cellEnd-1] == ' ' { + for cellEnd > cellStart && cellEnd-1 < len(data) && data[cellEnd-1] == ' ' { cellEnd-- } - var cellWork bytes.Buffer - p.inline(&cellWork, data[cellStart:cellEnd]) - - if header { - p.r.TableHeaderCell(&rowWork, cellWork.Bytes(), columns[col]) - } else { - p.r.TableCell(&rowWork, cellWork.Bytes(), columns[col]) - } + cell := p.addBlock(TableCell, data[cellStart:cellEnd]) + cell.IsHeader = header + cell.Align = columns[col] } // pad it out with empty columns to get the right number for ; col < len(columns); col++ { - if header { - p.r.TableHeaderCell(&rowWork, nil, columns[col]) - } else { - p.r.TableCell(&rowWork, nil, columns[col]) - } + cell := p.addBlock(TableCell, nil) + cell.IsHeader = header + cell.Align = columns[col] } // silently ignore rows with too many cells - - p.r.TableRow(out, rowWork.Bytes()) } // returns blockquote prefix length -func (p *parser) quotePrefix(data []byte) int { +func (p *Markdown) quotePrefix(data []byte) int { i := 0 - for i < 3 && data[i] == ' ' { + for i < 3 && i < len(data) && data[i] == ' ' { i++ } - if data[i] == '>' { - if data[i+1] == ' ' { + if i < len(data) && data[i] == '>' { + if i+1 < len(data) && data[i+1] == ' ' { return i + 2 } return i + 1 @@ -917,7 +955,7 @@ func (p *parser) quotePrefix(data []byte) int { // blockquote ends with at least one blank line // followed by something without a blockquote prefix -func (p *parser) terminateBlockquote(data []byte, beg, end int) bool { +func (p *Markdown) terminateBlockquote(data []byte, beg, end int) bool { if p.isEmpty(data[beg:]) <= 0 { return false } @@ -928,7 +966,8 @@ func (p *parser) terminateBlockquote(data []byte, beg, end int) bool { } // parse a blockquote fragment -func (p *parser) quote(out *bytes.Buffer, data []byte) int { +func (p *Markdown) quote(data []byte) int { + block := p.addBlock(BlockQuote, nil) var raw bytes.Buffer beg, end := 0, 0 for beg < len(data) { @@ -936,9 +975,9 @@ func (p *parser) quote(out *bytes.Buffer, data []byte) int { // Step over whole lines, collecting them. While doing that, check for // fenced code and if one's found, incorporate it altogether, // irregardless of any contents inside it - for data[end] != '\n' { - if p.flags&EXTENSION_FENCED_CODE != 0 { - if i := p.fencedCodeBlock(out, data[end:], false); i > 0 { + for end < len(data) && data[end] != '\n' { + if p.extensions&FencedCode != 0 { + if i := p.fencedCodeBlock(data[end:], false); i > 0 { // -1 to compensate for the extra end++ after the loop: end += i - 1 break @@ -946,44 +985,47 @@ func (p *parser) quote(out *bytes.Buffer, data []byte) int { } end++ } - end++ - + if end < len(data) && data[end] == '\n' { + end++ + } if pre := p.quotePrefix(data[beg:]); pre > 0 { // skip the prefix beg += pre } else if p.terminateBlockquote(data, beg, end) { break } - // this line is part of the blockquote raw.Write(data[beg:end]) beg = end } - - var cooked bytes.Buffer - p.block(&cooked, raw.Bytes()) - p.r.BlockQuote(out, cooked.Bytes()) + p.block(raw.Bytes()) + p.finalize(block) return end } // returns prefix length for block code -func (p *parser) codePrefix(data []byte) int { - if data[0] == ' ' && data[1] == ' ' && data[2] == ' ' && data[3] == ' ' { +func (p *Markdown) codePrefix(data []byte) int { + if len(data) >= 1 && data[0] == '\t' { + return 1 + } + if len(data) >= 4 && data[0] == ' ' && data[1] == ' ' && data[2] == ' ' && data[3] == ' ' { return 4 } return 0 } -func (p *parser) code(out *bytes.Buffer, data []byte) int { +func (p *Markdown) code(data []byte) int { var work bytes.Buffer i := 0 for i < len(data) { beg := i - for data[i] != '\n' { + for i < len(data) && data[i] != '\n' { + i++ + } + if i < len(data) && data[i] == '\n' { i++ } - i++ blankline := p.isEmpty(data[beg:i]) > 0 if pre := p.codePrefix(data[beg:i]); pre > 0 { @@ -994,7 +1036,7 @@ func (p *parser) code(out *bytes.Buffer, data []byte) int { break } - // verbatim copy to the working buffeu + // verbatim copy to the working buffer if blankline { work.WriteByte('\n') } else { @@ -1014,122 +1056,195 @@ func (p *parser) code(out *bytes.Buffer, data []byte) int { work.WriteByte('\n') - p.r.BlockCode(out, work.Bytes(), "") + block := p.addBlock(CodeBlock, work.Bytes()) // TODO: get rid of temp buffer + block.IsFenced = false + finalizeCodeBlock(block) return i } // returns unordered list item prefix -func (p *parser) uliPrefix(data []byte) int { +func (p *Markdown) uliPrefix(data []byte) int { i := 0 - // start with up to 3 spaces - for i < 3 && data[i] == ' ' { + for i < len(data) && i < 3 && data[i] == ' ' { i++ } - - // need a *, +, or - followed by a space + if i >= len(data)-1 { + return 0 + } + // need one of {'*', '+', '-'} followed by a space or a tab if (data[i] != '*' && data[i] != '+' && data[i] != '-') || - data[i+1] != ' ' { + (data[i+1] != ' ' && data[i+1] != '\t') { return 0 } return i + 2 } // returns ordered list item prefix -func (p *parser) oliPrefix(data []byte) int { +func (p *Markdown) oliPrefix(data []byte) int { i := 0 // start with up to 3 spaces - for i < 3 && data[i] == ' ' { + for i < 3 && i < len(data) && data[i] == ' ' { i++ } // count the digits start := i - for data[i] >= '0' && data[i] <= '9' { + for i < len(data) && data[i] >= '0' && data[i] <= '9' { i++ } + if start == i || i >= len(data)-1 { + return 0 + } - // we need >= 1 digits followed by a dot and a space - if start == i || data[i] != '.' || data[i+1] != ' ' { + // we need >= 1 digits followed by a dot and a space or a tab + if data[i] != '.' || !(data[i+1] == ' ' || data[i+1] == '\t') { return 0 } return i + 2 } // returns definition list item prefix -func (p *parser) dliPrefix(data []byte) int { +func (p *Markdown) dliPrefix(data []byte) int { + if len(data) < 2 { + return 0 + } i := 0 - - // need a : followed by a spaces - if data[i] != ':' || data[i+1] != ' ' { + // need a ':' followed by a space or a tab + if data[i] != ':' || !(data[i+1] == ' ' || data[i+1] == '\t') { return 0 } - for data[i] == ' ' { + for i < len(data) && data[i] == ' ' { i++ } return i + 2 } // parse ordered or unordered list block -func (p *parser) list(out *bytes.Buffer, data []byte, flags int) int { +func (p *Markdown) list(data []byte, flags ListType) int { i := 0 - flags |= LIST_ITEM_BEGINNING_OF_LIST - work := func() bool { - for i < len(data) { - skip := p.listItem(out, data[i:], &flags) - i += skip + flags |= ListItemBeginningOfList + block := p.addBlock(List, nil) + block.ListFlags = flags + block.Tight = true - if skip == 0 || flags&LIST_ITEM_END_OF_LIST != 0 { - break - } - flags &= ^LIST_ITEM_BEGINNING_OF_LIST + for i < len(data) { + skip := p.listItem(data[i:], &flags) + if flags&ListItemContainsBlock != 0 { + block.ListData.Tight = false } - return true + i += skip + if skip == 0 || flags&ListItemEndOfList != 0 { + break + } + flags &= ^ListItemBeginningOfList } - p.r.List(out, work, flags) + above := block.Parent + finalizeList(block) + p.tip = above return i } +// Returns true if the list item is not the same type as its parent list +func (p *Markdown) listTypeChanged(data []byte, flags *ListType) bool { + if p.dliPrefix(data) > 0 && *flags&ListTypeDefinition == 0 { + return true + } else if p.oliPrefix(data) > 0 && *flags&ListTypeOrdered == 0 { + return true + } else if p.uliPrefix(data) > 0 && (*flags&ListTypeOrdered != 0 || *flags&ListTypeDefinition != 0) { + return true + } + return false +} + +// Returns true if block ends with a blank line, descending if needed +// into lists and sublists. +func endsWithBlankLine(block *Node) bool { + // TODO: figure this out. Always false now. + for block != nil { + //if block.lastLineBlank { + //return true + //} + t := block.Type + if t == List || t == Item { + block = block.LastChild + } else { + break + } + } + return false +} + +func finalizeList(block *Node) { + block.open = false + item := block.FirstChild + for item != nil { + // check for non-final list item ending with blank line: + if endsWithBlankLine(item) && item.Next != nil { + block.ListData.Tight = false + break + } + // recurse into children of list item, to see if there are spaces + // between any of them: + subItem := item.FirstChild + for subItem != nil { + if endsWithBlankLine(subItem) && (item.Next != nil || subItem.Next != nil) { + block.ListData.Tight = false + break + } + subItem = subItem.Next + } + item = item.Next + } +} + // Parse a single list item. // Assumes initial prefix is already removed if this is a sublist. -func (p *parser) listItem(out *bytes.Buffer, data []byte, flags *int) int { +func (p *Markdown) listItem(data []byte, flags *ListType) int { // keep track of the indentation of the first line itemIndent := 0 - for itemIndent < 3 && data[itemIndent] == ' ' { - itemIndent++ + if data[0] == '\t' { + itemIndent += 4 + } else { + for itemIndent < 3 && data[itemIndent] == ' ' { + itemIndent++ + } } + var bulletChar byte = '*' i := p.uliPrefix(data) if i == 0 { i = p.oliPrefix(data) + } else { + bulletChar = data[i-2] } if i == 0 { i = p.dliPrefix(data) // reset definition term flag if i > 0 { - *flags &= ^LIST_TYPE_TERM + *flags &= ^ListTypeTerm } } if i == 0 { - // if in defnition list, set term flag and continue - if *flags&LIST_TYPE_DEFINITION != 0 { - *flags |= LIST_TYPE_TERM + // if in definition list, set term flag and continue + if *flags&ListTypeDefinition != 0 { + *flags |= ListTypeTerm } else { return 0 } } // skip leading whitespace on first line - for data[i] == ' ' { + for i < len(data) && data[i] == ' ' { i++ } // find the end of the line line := i - for i > 0 && data[i-1] != '\n' { + for i > 0 && i < len(data) && data[i-1] != '\n' { i++ } @@ -1150,7 +1265,7 @@ gatherlines: i++ // find the end of this line - for data[i-1] != '\n' { + for i < len(data) && data[i-1] != '\n' { i++ } @@ -1158,36 +1273,41 @@ gatherlines: // and move on to the next line if p.isEmpty(data[line:i]) > 0 { containsBlankLine = true - raw.Write(data[line:i]) line = i continue } // calculate the indentation indent := 0 - for indent < 4 && line+indent < i && data[line+indent] == ' ' { - indent++ + indentIndex := 0 + if data[line] == '\t' { + indentIndex++ + indent += 4 + } else { + for indent < 4 && line+indent < i && data[line+indent] == ' ' { + indent++ + indentIndex++ + } } - chunk := data[line+indent : i] + chunk := data[line+indentIndex : i] - if p.flags&EXTENSION_FENCED_CODE != 0 { + if p.extensions&FencedCode != 0 { // determine if in or out of codeblock // if in codeblock, ignore normal list processing - _, marker := isFenceLine(chunk, nil, codeBlockMarker, false) + _, marker := isFenceLine(chunk, nil, codeBlockMarker) if marker != "" { if codeBlockMarker == "" { // start of codeblock codeBlockMarker = marker } else { // end of codeblock. - *flags |= LIST_ITEM_CONTAINS_BLOCK codeBlockMarker = "" } } // we are in a codeblock, write line, and continue if codeBlockMarker != "" || marker != "" { - raw.Write(data[line+indent : i]) + raw.Write(data[line+indentIndex : i]) line = i continue gatherlines } @@ -1200,116 +1320,111 @@ gatherlines: p.oliPrefix(chunk) > 0 || p.dliPrefix(chunk) > 0: - if containsBlankLine { - // end the list if the type changed after a blank line - if indent <= itemIndent && - ((*flags&LIST_TYPE_ORDERED != 0 && p.uliPrefix(chunk) > 0) || - (*flags&LIST_TYPE_ORDERED == 0 && p.oliPrefix(chunk) > 0)) { - - *flags |= LIST_ITEM_END_OF_LIST - break gatherlines - } - *flags |= LIST_ITEM_CONTAINS_BLOCK - } - // to be a nested list, it must be indented more - // if not, it is the next item in the same list + // if not, it is either a different kind of list + // or the next item in the same list if indent <= itemIndent { + if p.listTypeChanged(chunk, flags) { + *flags |= ListItemEndOfList + } else if containsBlankLine { + *flags |= ListItemContainsBlock + } + break gatherlines } + if containsBlankLine { + *flags |= ListItemContainsBlock + } + // is this the first item in the nested list? if sublist == 0 { sublist = raw.Len() } - // is this a nested prefix header? - case p.isPrefixHeader(chunk): - // if the header is not indented, it is not nested in the list + // is this a nested prefix heading? + case p.isPrefixHeading(chunk): + // if the heading is not indented, it is not nested in the list // and thus ends the list if containsBlankLine && indent < 4 { - *flags |= LIST_ITEM_END_OF_LIST + *flags |= ListItemEndOfList break gatherlines } - *flags |= LIST_ITEM_CONTAINS_BLOCK + *flags |= ListItemContainsBlock // anything following an empty line is only part // of this item if it is indented 4 spaces // (regardless of the indentation of the beginning of the item) case containsBlankLine && indent < 4: - if *flags&LIST_TYPE_DEFINITION != 0 && i < len(data)-1 { + if *flags&ListTypeDefinition != 0 && i < len(data)-1 { // is the next item still a part of this list? next := i - for data[next] != '\n' { + for next < len(data) && data[next] != '\n' { next++ } for next < len(data)-1 && data[next] == '\n' { next++ } if i < len(data)-1 && data[i] != ':' && data[next] != ':' { - *flags |= LIST_ITEM_END_OF_LIST + *flags |= ListItemEndOfList } } else { - *flags |= LIST_ITEM_END_OF_LIST + *flags |= ListItemEndOfList } break gatherlines // a blank line means this should be parsed as a block case containsBlankLine: - *flags |= LIST_ITEM_CONTAINS_BLOCK + raw.WriteByte('\n') + *flags |= ListItemContainsBlock } - containsBlankLine = false + // if this line was preceded by one or more blanks, + // re-introduce the blank into the buffer + if containsBlankLine { + containsBlankLine = false + raw.WriteByte('\n') + } // add the line into the working buffer without prefix - raw.Write(data[line+indent : i]) + raw.Write(data[line+indentIndex : i]) line = i } - // If reached end of data, the Renderer.ListItem call we're going to make below - // is definitely the last in the list. - if line >= len(data) { - *flags |= LIST_ITEM_END_OF_LIST - } - rawBytes := raw.Bytes() + block := p.addBlock(Item, nil) + block.ListFlags = *flags + block.Tight = false + block.BulletChar = bulletChar + block.Delimiter = '.' // Only '.' is possible in Markdown, but ')' will also be possible in CommonMark + // render the contents of the list item - var cooked bytes.Buffer - if *flags&LIST_ITEM_CONTAINS_BLOCK != 0 && *flags&LIST_TYPE_TERM == 0 { + if *flags&ListItemContainsBlock != 0 && *flags&ListTypeTerm == 0 { // intermediate render of block item, except for definition term if sublist > 0 { - p.block(&cooked, rawBytes[:sublist]) - p.block(&cooked, rawBytes[sublist:]) + p.block(rawBytes[:sublist]) + p.block(rawBytes[sublist:]) } else { - p.block(&cooked, rawBytes) + p.block(rawBytes) } } else { // intermediate render of inline item if sublist > 0 { - p.inline(&cooked, rawBytes[:sublist]) - p.block(&cooked, rawBytes[sublist:]) + child := p.addChild(Paragraph, 0) + child.content = rawBytes[:sublist] + p.block(rawBytes[sublist:]) } else { - p.inline(&cooked, rawBytes) + child := p.addChild(Paragraph, 0) + child.content = rawBytes } } - - // render the actual list item - cookedBytes := cooked.Bytes() - parsedEnd := len(cookedBytes) - - // strip trailing newlines - for parsedEnd > 0 && cookedBytes[parsedEnd-1] == '\n' { - parsedEnd-- - } - p.r.ListItem(out, cookedBytes[:parsedEnd], *flags) - return line } // render a single paragraph that has already been parsed out -func (p *parser) renderParagraph(out *bytes.Buffer, data []byte) { +func (p *Markdown) renderParagraph(data []byte) { if len(data) == 0 { return } @@ -1320,27 +1435,29 @@ func (p *parser) renderParagraph(out *bytes.Buffer, data []byte) { beg++ } + end := len(data) // trim trailing newline - end := len(data) - 1 + if data[len(data)-1] == '\n' { + end-- + } // trim trailing spaces for end > beg && data[end-1] == ' ' { end-- } - work := func() bool { - p.inline(out, data[beg:end]) - return true - } - p.r.Paragraph(out, work) + p.addBlock(Paragraph, data[beg:end]) } -func (p *parser) paragraph(out *bytes.Buffer, data []byte) int { +func (p *Markdown) paragraph(data []byte) int { // prev: index of 1st char of previous line // line: index of 1st char of current line // i: index of cursor/end of current line var prev, line, i int - + tabSize := TabSizeDefault + if p.extensions&TabSizeEight != 0 { + tabSize = TabSizeDouble + } // keep going until we find something to mark the end of the paragraph for i < len(data) { // mark the beginning of the current line @@ -1348,24 +1465,32 @@ func (p *parser) paragraph(out *bytes.Buffer, data []byte) int { current := data[i:] line = i + // did we find a reference or a footnote? If so, end a paragraph + // preceding it and report that we have consumed up to the end of that + // reference: + if refEnd := isReference(p, current, tabSize); refEnd > 0 { + p.renderParagraph(data[:i]) + return i + refEnd + } + // did we find a blank line marking the end of the paragraph? if n := p.isEmpty(current); n > 0 { // did this blank line followed by a definition list item? - if p.flags&EXTENSION_DEFINITION_LISTS != 0 { + if p.extensions&DefinitionLists != 0 { if i < len(data)-1 && data[i+1] == ':' { - return p.list(out, data[prev:], LIST_TYPE_DEFINITION) + return p.list(data[prev:], ListTypeDefinition) } } - p.renderParagraph(out, data[:i]) + p.renderParagraph(data[:i]) return i + n } - // an underline under some text marks a header, so our paragraph ended on prev line + // an underline under some text marks a heading, so our paragraph ended on prev line if i > 0 { - if level := p.isUnderlinedHeader(current); level > 0 { + if level := p.isUnderlinedHeading(current); level > 0 { // render the paragraph - p.renderParagraph(out, data[:prev]) + p.renderParagraph(data[:prev]) // ignore leading and trailing whitespace eol := i - 1 @@ -1376,24 +1501,17 @@ func (p *parser) paragraph(out *bytes.Buffer, data []byte) int { eol-- } - // render the header - // this ugly double closure avoids forcing variables onto the heap - work := func(o *bytes.Buffer, pp *parser, d []byte) func() bool { - return func() bool { - pp.inline(o, d) - return true - } - }(out, p, data[prev:eol]) - id := "" - if p.flags&EXTENSION_AUTO_HEADER_IDS != 0 { - id = SanitizedAnchorName(string(data[prev:eol])) + if p.extensions&AutoHeadingIDs != 0 { + id = sanitized_anchor_name.Create(string(data[prev:eol])) } - p.r.Header(out, work, level, id) + block := p.addBlock(Heading, data[prev:eol]) + block.Level = level + block.HeadingID = id // find the end of the underline - for data[i] != '\n' { + for i < len(data) && data[i] != '\n' { i++ } return i @@ -1401,74 +1519,72 @@ func (p *parser) paragraph(out *bytes.Buffer, data []byte) int { } // if the next line starts a block of HTML, then the paragraph ends here - if p.flags&EXTENSION_LAX_HTML_BLOCKS != 0 { - if data[i] == '<' && p.html(out, current, false) > 0 { + if p.extensions&LaxHTMLBlocks != 0 { + if data[i] == '<' && p.html(current, false) > 0 { // rewind to before the HTML block - p.renderParagraph(out, data[:i]) + p.renderParagraph(data[:i]) return i } } - // if there's a prefixed header or a horizontal rule after this, paragraph is over - if p.isPrefixHeader(current) || p.isHRule(current) { - p.renderParagraph(out, data[:i]) + // if there's a prefixed heading or a horizontal rule after this, paragraph is over + if p.isPrefixHeading(current) || p.isHRule(current) { + p.renderParagraph(data[:i]) return i } // if there's a fenced code block, paragraph is over - if p.flags&EXTENSION_FENCED_CODE != 0 { - if p.fencedCodeBlock(out, current, false) > 0 { - p.renderParagraph(out, data[:i]) + if p.extensions&FencedCode != 0 { + if p.fencedCodeBlock(current, false) > 0 { + p.renderParagraph(data[:i]) return i } } // if there's a definition list item, prev line is a definition term - if p.flags&EXTENSION_DEFINITION_LISTS != 0 { + if p.extensions&DefinitionLists != 0 { if p.dliPrefix(current) != 0 { - return p.list(out, data[prev:], LIST_TYPE_DEFINITION) + ret := p.list(data[prev:], ListTypeDefinition) + return ret } } // if there's a list after this, paragraph is over - if p.flags&EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK != 0 { + if p.extensions&NoEmptyLineBeforeBlock != 0 { if p.uliPrefix(current) != 0 || p.oliPrefix(current) != 0 || p.quotePrefix(current) != 0 || p.codePrefix(current) != 0 { - p.renderParagraph(out, data[:i]) + p.renderParagraph(data[:i]) return i } } // otherwise, scan to the beginning of the next line - for data[i] != '\n' { - i++ + nl := bytes.IndexByte(data[i:], '\n') + if nl >= 0 { + i += nl + 1 + } else { + i += len(data[i:]) } - i++ } - p.renderParagraph(out, data[:i]) + p.renderParagraph(data[:i]) return i } -// SanitizedAnchorName returns a sanitized anchor name for the given text. -// -// It implements the algorithm specified in the package comment. -func SanitizedAnchorName(text string) string { - var anchorName []rune - futureDash := false - for _, r := range text { - switch { - case unicode.IsLetter(r) || unicode.IsNumber(r): - if futureDash && len(anchorName) > 0 { - anchorName = append(anchorName, '-') - } - futureDash = false - anchorName = append(anchorName, unicode.ToLower(r)) - default: - futureDash = true - } +func skipChar(data []byte, start int, char byte) int { + i := start + for i < len(data) && data[i] == char { + i++ } - return string(anchorName) + return i +} + +func skipUntilChar(text []byte, start int, char byte) int { + i := start + for i < len(text) && text[i] != char { + i++ + } + return i } diff --git a/vendor/github.com/russross/blackfriday/v2/doc.go b/vendor/github.com/russross/blackfriday/v2/doc.go new file mode 100644 index 0000000000..5b3fa9876a --- /dev/null +++ b/vendor/github.com/russross/blackfriday/v2/doc.go @@ -0,0 +1,18 @@ +// Package blackfriday is a markdown processor. +// +// It translates plain text with simple formatting rules into an AST, which can +// then be further processed to HTML (provided by Blackfriday itself) or other +// formats (provided by the community). +// +// The simplest way to invoke Blackfriday is to call the Run function. It will +// take a text input and produce a text output in HTML (or other format). +// +// A slightly more sophisticated way to use Blackfriday is to create a Markdown +// processor and to call Parse, which returns a syntax tree for the input +// document. You can leverage Blackfriday's parsing for content extraction from +// markdown documents. You can assign a custom renderer and set various options +// to the Markdown processor. +// +// If you're interested in calling Blackfriday from command line, see +// https://github.com/russross/blackfriday-tool. +package blackfriday diff --git a/vendor/github.com/russross/blackfriday/v2/esc.go b/vendor/github.com/russross/blackfriday/v2/esc.go new file mode 100644 index 0000000000..6385f27cb6 --- /dev/null +++ b/vendor/github.com/russross/blackfriday/v2/esc.go @@ -0,0 +1,34 @@ +package blackfriday + +import ( + "html" + "io" +) + +var htmlEscaper = [256][]byte{ + '&': []byte("&"), + '<': []byte("<"), + '>': []byte(">"), + '"': []byte("""), +} + +func escapeHTML(w io.Writer, s []byte) { + var start, end int + for end < len(s) { + escSeq := htmlEscaper[s[end]] + if escSeq != nil { + w.Write(s[start:end]) + w.Write(escSeq) + start = end + 1 + } + end++ + } + if start < len(s) && end <= len(s) { + w.Write(s[start:end]) + } +} + +func escLink(w io.Writer, text []byte) { + unesc := html.UnescapeString(string(text)) + escapeHTML(w, []byte(unesc)) +} diff --git a/vendor/github.com/russross/blackfriday/v2/go.mod b/vendor/github.com/russross/blackfriday/v2/go.mod new file mode 100644 index 0000000000..620b74e0ac --- /dev/null +++ b/vendor/github.com/russross/blackfriday/v2/go.mod @@ -0,0 +1 @@ +module github.com/russross/blackfriday/v2 diff --git a/vendor/github.com/russross/blackfriday/v2/html.go b/vendor/github.com/russross/blackfriday/v2/html.go new file mode 100644 index 0000000000..284c87184f --- /dev/null +++ b/vendor/github.com/russross/blackfriday/v2/html.go @@ -0,0 +1,949 @@ +// +// Blackfriday Markdown Processor +// Available at http://github.com/russross/blackfriday +// +// Copyright © 2011 Russ Ross . +// Distributed under the Simplified BSD License. +// See README.md for details. +// + +// +// +// HTML rendering backend +// +// + +package blackfriday + +import ( + "bytes" + "fmt" + "io" + "regexp" + "strings" +) + +// HTMLFlags control optional behavior of HTML renderer. +type HTMLFlags int + +// HTML renderer configuration options. +const ( + HTMLFlagsNone HTMLFlags = 0 + SkipHTML HTMLFlags = 1 << iota // Skip preformatted HTML blocks + SkipImages // Skip embedded images + SkipLinks // Skip all links + Safelink // Only link to trusted protocols + NofollowLinks // Only link with rel="nofollow" + NoreferrerLinks // Only link with rel="noreferrer" + NoopenerLinks // Only link with rel="noopener" + HrefTargetBlank // Add a blank target + CompletePage // Generate a complete HTML page + UseXHTML // Generate XHTML output instead of HTML + FootnoteReturnLinks // Generate a link at the end of a footnote to return to the source + Smartypants // Enable smart punctuation substitutions + SmartypantsFractions // Enable smart fractions (with Smartypants) + SmartypantsDashes // Enable smart dashes (with Smartypants) + SmartypantsLatexDashes // Enable LaTeX-style dashes (with Smartypants) + SmartypantsAngledQuotes // Enable angled double quotes (with Smartypants) for double quotes rendering + SmartypantsQuotesNBSP // Enable « French guillemets » (with Smartypants) + TOC // Generate a table of contents +) + +var ( + htmlTagRe = regexp.MustCompile("(?i)^" + htmlTag) +) + +const ( + htmlTag = "(?:" + openTag + "|" + closeTag + "|" + htmlComment + "|" + + processingInstruction + "|" + declaration + "|" + cdata + ")" + closeTag = "]" + openTag = "<" + tagName + attribute + "*" + "\\s*/?>" + attribute = "(?:" + "\\s+" + attributeName + attributeValueSpec + "?)" + attributeValue = "(?:" + unquotedValue + "|" + singleQuotedValue + "|" + doubleQuotedValue + ")" + attributeValueSpec = "(?:" + "\\s*=" + "\\s*" + attributeValue + ")" + attributeName = "[a-zA-Z_:][a-zA-Z0-9:._-]*" + cdata = "" + declaration = "]*>" + doubleQuotedValue = "\"[^\"]*\"" + htmlComment = "|" + processingInstruction = "[<][?].*?[?][>]" + singleQuotedValue = "'[^']*'" + tagName = "[A-Za-z][A-Za-z0-9-]*" + unquotedValue = "[^\"'=<>`\\x00-\\x20]+" +) + +// HTMLRendererParameters is a collection of supplementary parameters tweaking +// the behavior of various parts of HTML renderer. +type HTMLRendererParameters struct { + // Prepend this text to each relative URL. + AbsolutePrefix string + // Add this text to each footnote anchor, to ensure uniqueness. + FootnoteAnchorPrefix string + // Show this text inside the tag for a footnote return link, if the + // HTML_FOOTNOTE_RETURN_LINKS flag is enabled. If blank, the string + // [return] is used. + FootnoteReturnLinkContents string + // If set, add this text to the front of each Heading ID, to ensure + // uniqueness. + HeadingIDPrefix string + // If set, add this text to the back of each Heading ID, to ensure uniqueness. + HeadingIDSuffix string + // Increase heading levels: if the offset is 1,

    becomes

    etc. + // Negative offset is also valid. + // Resulting levels are clipped between 1 and 6. + HeadingLevelOffset int + + Title string // Document title (used if CompletePage is set) + CSS string // Optional CSS file URL (used if CompletePage is set) + Icon string // Optional icon file URL (used if CompletePage is set) + + Flags HTMLFlags // Flags allow customizing this renderer's behavior +} + +// HTMLRenderer is a type that implements the Renderer interface for HTML output. +// +// Do not create this directly, instead use the NewHTMLRenderer function. +type HTMLRenderer struct { + HTMLRendererParameters + + closeTag string // how to end singleton tags: either " />" or ">" + + // Track heading IDs to prevent ID collision in a single generation. + headingIDs map[string]int + + lastOutputLen int + disableTags int + + sr *SPRenderer +} + +const ( + xhtmlClose = " />" + htmlClose = ">" +) + +// NewHTMLRenderer creates and configures an HTMLRenderer object, which +// satisfies the Renderer interface. +func NewHTMLRenderer(params HTMLRendererParameters) *HTMLRenderer { + // configure the rendering engine + closeTag := htmlClose + if params.Flags&UseXHTML != 0 { + closeTag = xhtmlClose + } + + if params.FootnoteReturnLinkContents == "" { + params.FootnoteReturnLinkContents = `[return]` + } + + return &HTMLRenderer{ + HTMLRendererParameters: params, + + closeTag: closeTag, + headingIDs: make(map[string]int), + + sr: NewSmartypantsRenderer(params.Flags), + } +} + +func isHTMLTag(tag []byte, tagname string) bool { + found, _ := findHTMLTagPos(tag, tagname) + return found +} + +// Look for a character, but ignore it when it's in any kind of quotes, it +// might be JavaScript +func skipUntilCharIgnoreQuotes(html []byte, start int, char byte) int { + inSingleQuote := false + inDoubleQuote := false + inGraveQuote := false + i := start + for i < len(html) { + switch { + case html[i] == char && !inSingleQuote && !inDoubleQuote && !inGraveQuote: + return i + case html[i] == '\'': + inSingleQuote = !inSingleQuote + case html[i] == '"': + inDoubleQuote = !inDoubleQuote + case html[i] == '`': + inGraveQuote = !inGraveQuote + } + i++ + } + return start +} + +func findHTMLTagPos(tag []byte, tagname string) (bool, int) { + i := 0 + if i < len(tag) && tag[0] != '<' { + return false, -1 + } + i++ + i = skipSpace(tag, i) + + if i < len(tag) && tag[i] == '/' { + i++ + } + + i = skipSpace(tag, i) + j := 0 + for ; i < len(tag); i, j = i+1, j+1 { + if j >= len(tagname) { + break + } + + if strings.ToLower(string(tag[i]))[0] != tagname[j] { + return false, -1 + } + } + + if i == len(tag) { + return false, -1 + } + + rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>') + if rightAngle >= i { + return true, rightAngle + } + + return false, -1 +} + +func skipSpace(tag []byte, i int) int { + for i < len(tag) && isspace(tag[i]) { + i++ + } + return i +} + +func isRelativeLink(link []byte) (yes bool) { + // a tag begin with '#' + if link[0] == '#' { + return true + } + + // link begin with '/' but not '//', the second maybe a protocol relative link + if len(link) >= 2 && link[0] == '/' && link[1] != '/' { + return true + } + + // only the root '/' + if len(link) == 1 && link[0] == '/' { + return true + } + + // current directory : begin with "./" + if bytes.HasPrefix(link, []byte("./")) { + return true + } + + // parent directory : begin with "../" + if bytes.HasPrefix(link, []byte("../")) { + return true + } + + return false +} + +func (r *HTMLRenderer) ensureUniqueHeadingID(id string) string { + for count, found := r.headingIDs[id]; found; count, found = r.headingIDs[id] { + tmp := fmt.Sprintf("%s-%d", id, count+1) + + if _, tmpFound := r.headingIDs[tmp]; !tmpFound { + r.headingIDs[id] = count + 1 + id = tmp + } else { + id = id + "-1" + } + } + + if _, found := r.headingIDs[id]; !found { + r.headingIDs[id] = 0 + } + + return id +} + +func (r *HTMLRenderer) addAbsPrefix(link []byte) []byte { + if r.AbsolutePrefix != "" && isRelativeLink(link) && link[0] != '.' { + newDest := r.AbsolutePrefix + if link[0] != '/' { + newDest += "/" + } + newDest += string(link) + return []byte(newDest) + } + return link +} + +func appendLinkAttrs(attrs []string, flags HTMLFlags, link []byte) []string { + if isRelativeLink(link) { + return attrs + } + val := []string{} + if flags&NofollowLinks != 0 { + val = append(val, "nofollow") + } + if flags&NoreferrerLinks != 0 { + val = append(val, "noreferrer") + } + if flags&NoopenerLinks != 0 { + val = append(val, "noopener") + } + if flags&HrefTargetBlank != 0 { + attrs = append(attrs, "target=\"_blank\"") + } + if len(val) == 0 { + return attrs + } + attr := fmt.Sprintf("rel=%q", strings.Join(val, " ")) + return append(attrs, attr) +} + +func isMailto(link []byte) bool { + return bytes.HasPrefix(link, []byte("mailto:")) +} + +func needSkipLink(flags HTMLFlags, dest []byte) bool { + if flags&SkipLinks != 0 { + return true + } + return flags&Safelink != 0 && !isSafeLink(dest) && !isMailto(dest) +} + +func isSmartypantable(node *Node) bool { + pt := node.Parent.Type + return pt != Link && pt != CodeBlock && pt != Code +} + +func appendLanguageAttr(attrs []string, info []byte) []string { + if len(info) == 0 { + return attrs + } + endOfLang := bytes.IndexAny(info, "\t ") + if endOfLang < 0 { + endOfLang = len(info) + } + return append(attrs, fmt.Sprintf("class=\"language-%s\"", info[:endOfLang])) +} + +func (r *HTMLRenderer) tag(w io.Writer, name []byte, attrs []string) { + w.Write(name) + if len(attrs) > 0 { + w.Write(spaceBytes) + w.Write([]byte(strings.Join(attrs, " "))) + } + w.Write(gtBytes) + r.lastOutputLen = 1 +} + +func footnoteRef(prefix string, node *Node) []byte { + urlFrag := prefix + string(slugify(node.Destination)) + anchor := fmt.Sprintf(`%d`, urlFrag, node.NoteID) + return []byte(fmt.Sprintf(`%s`, urlFrag, anchor)) +} + +func footnoteItem(prefix string, slug []byte) []byte { + return []byte(fmt.Sprintf(`
  • `, prefix, slug)) +} + +func footnoteReturnLink(prefix, returnLink string, slug []byte) []byte { + const format = ` %s` + return []byte(fmt.Sprintf(format, prefix, slug, returnLink)) +} + +func itemOpenCR(node *Node) bool { + if node.Prev == nil { + return false + } + ld := node.Parent.ListData + return !ld.Tight && ld.ListFlags&ListTypeDefinition == 0 +} + +func skipParagraphTags(node *Node) bool { + grandparent := node.Parent.Parent + if grandparent == nil || grandparent.Type != List { + return false + } + tightOrTerm := grandparent.Tight || node.Parent.ListFlags&ListTypeTerm != 0 + return grandparent.Type == List && tightOrTerm +} + +func cellAlignment(align CellAlignFlags) string { + switch align { + case TableAlignmentLeft: + return "left" + case TableAlignmentRight: + return "right" + case TableAlignmentCenter: + return "center" + default: + return "" + } +} + +func (r *HTMLRenderer) out(w io.Writer, text []byte) { + if r.disableTags > 0 { + w.Write(htmlTagRe.ReplaceAll(text, []byte{})) + } else { + w.Write(text) + } + r.lastOutputLen = len(text) +} + +func (r *HTMLRenderer) cr(w io.Writer) { + if r.lastOutputLen > 0 { + r.out(w, nlBytes) + } +} + +var ( + nlBytes = []byte{'\n'} + gtBytes = []byte{'>'} + spaceBytes = []byte{' '} +) + +var ( + brTag = []byte("
    ") + brXHTMLTag = []byte("
    ") + emTag = []byte("") + emCloseTag = []byte("") + strongTag = []byte("") + strongCloseTag = []byte("") + delTag = []byte("") + delCloseTag = []byte("") + ttTag = []byte("") + ttCloseTag = []byte("") + aTag = []byte("") + preTag = []byte("
    ")
    +	preCloseTag        = []byte("
    ") + codeTag = []byte("") + codeCloseTag = []byte("") + pTag = []byte("

    ") + pCloseTag = []byte("

    ") + blockquoteTag = []byte("
    ") + blockquoteCloseTag = []byte("
    ") + hrTag = []byte("
    ") + hrXHTMLTag = []byte("
    ") + ulTag = []byte("
      ") + ulCloseTag = []byte("
    ") + olTag = []byte("
      ") + olCloseTag = []byte("
    ") + dlTag = []byte("
    ") + dlCloseTag = []byte("
    ") + liTag = []byte("
  • ") + liCloseTag = []byte("
  • ") + ddTag = []byte("
    ") + ddCloseTag = []byte("
    ") + dtTag = []byte("
    ") + dtCloseTag = []byte("
    ") + tableTag = []byte("") + tableCloseTag = []byte("
    ") + tdTag = []byte("") + thTag = []byte("") + theadTag = []byte("") + theadCloseTag = []byte("") + tbodyTag = []byte("") + tbodyCloseTag = []byte("") + trTag = []byte("") + trCloseTag = []byte("") + h1Tag = []byte("") + h2Tag = []byte("") + h3Tag = []byte("") + h4Tag = []byte("") + h5Tag = []byte("") + h6Tag = []byte("") + + footnotesDivBytes = []byte("\n
    \n\n") + footnotesCloseDivBytes = []byte("\n
    \n") +) + +func headingTagsFromLevel(level int) ([]byte, []byte) { + if level <= 1 { + return h1Tag, h1CloseTag + } + switch level { + case 2: + return h2Tag, h2CloseTag + case 3: + return h3Tag, h3CloseTag + case 4: + return h4Tag, h4CloseTag + case 5: + return h5Tag, h5CloseTag + } + return h6Tag, h6CloseTag +} + +func (r *HTMLRenderer) outHRTag(w io.Writer) { + if r.Flags&UseXHTML == 0 { + r.out(w, hrTag) + } else { + r.out(w, hrXHTMLTag) + } +} + +// RenderNode is a default renderer of a single node of a syntax tree. For +// block nodes it will be called twice: first time with entering=true, second +// time with entering=false, so that it could know when it's working on an open +// tag and when on close. It writes the result to w. +// +// The return value is a way to tell the calling walker to adjust its walk +// pattern: e.g. it can terminate the traversal by returning Terminate. Or it +// can ask the walker to skip a subtree of this node by returning SkipChildren. +// The typical behavior is to return GoToNext, which asks for the usual +// traversal to the next node. +func (r *HTMLRenderer) RenderNode(w io.Writer, node *Node, entering bool) WalkStatus { + attrs := []string{} + switch node.Type { + case Text: + if r.Flags&Smartypants != 0 { + var tmp bytes.Buffer + escapeHTML(&tmp, node.Literal) + r.sr.Process(w, tmp.Bytes()) + } else { + if node.Parent.Type == Link { + escLink(w, node.Literal) + } else { + escapeHTML(w, node.Literal) + } + } + case Softbreak: + r.cr(w) + // TODO: make it configurable via out(renderer.softbreak) + case Hardbreak: + if r.Flags&UseXHTML == 0 { + r.out(w, brTag) + } else { + r.out(w, brXHTMLTag) + } + r.cr(w) + case Emph: + if entering { + r.out(w, emTag) + } else { + r.out(w, emCloseTag) + } + case Strong: + if entering { + r.out(w, strongTag) + } else { + r.out(w, strongCloseTag) + } + case Del: + if entering { + r.out(w, delTag) + } else { + r.out(w, delCloseTag) + } + case HTMLSpan: + if r.Flags&SkipHTML != 0 { + break + } + r.out(w, node.Literal) + case Link: + // mark it but don't link it if it is not a safe link: no smartypants + dest := node.LinkData.Destination + if needSkipLink(r.Flags, dest) { + if entering { + r.out(w, ttTag) + } else { + r.out(w, ttCloseTag) + } + } else { + if entering { + dest = r.addAbsPrefix(dest) + var hrefBuf bytes.Buffer + hrefBuf.WriteString("href=\"") + escLink(&hrefBuf, dest) + hrefBuf.WriteByte('"') + attrs = append(attrs, hrefBuf.String()) + if node.NoteID != 0 { + r.out(w, footnoteRef(r.FootnoteAnchorPrefix, node)) + break + } + attrs = appendLinkAttrs(attrs, r.Flags, dest) + if len(node.LinkData.Title) > 0 { + var titleBuff bytes.Buffer + titleBuff.WriteString("title=\"") + escapeHTML(&titleBuff, node.LinkData.Title) + titleBuff.WriteByte('"') + attrs = append(attrs, titleBuff.String()) + } + r.tag(w, aTag, attrs) + } else { + if node.NoteID != 0 { + break + } + r.out(w, aCloseTag) + } + } + case Image: + if r.Flags&SkipImages != 0 { + return SkipChildren + } + if entering { + dest := node.LinkData.Destination + dest = r.addAbsPrefix(dest) + if r.disableTags == 0 { + //if options.safe && potentiallyUnsafe(dest) { + //out(w, ``)
+				//} else {
+				r.out(w, []byte(`<img src=`)) + } + } + case Code: + r.out(w, codeTag) + escapeHTML(w, node.Literal) + r.out(w, codeCloseTag) + case Document: + break + case Paragraph: + if skipParagraphTags(node) { + break + } + if entering { + // TODO: untangle this clusterfuck about when the newlines need + // to be added and when not. + if node.Prev != nil { + switch node.Prev.Type { + case HTMLBlock, List, Paragraph, Heading, CodeBlock, BlockQuote, HorizontalRule: + r.cr(w) + } + } + if node.Parent.Type == BlockQuote && node.Prev == nil { + r.cr(w) + } + r.out(w, pTag) + } else { + r.out(w, pCloseTag) + if !(node.Parent.Type == Item && node.Next == nil) { + r.cr(w) + } + } + case BlockQuote: + if entering { + r.cr(w) + r.out(w, blockquoteTag) + } else { + r.out(w, blockquoteCloseTag) + r.cr(w) + } + case HTMLBlock: + if r.Flags&SkipHTML != 0 { + break + } + r.cr(w) + r.out(w, node.Literal) + r.cr(w) + case Heading: + headingLevel := r.HTMLRendererParameters.HeadingLevelOffset + node.Level + openTag, closeTag := headingTagsFromLevel(headingLevel) + if entering { + if node.IsTitleblock { + attrs = append(attrs, `class="title"`) + } + if node.HeadingID != "" { + id := r.ensureUniqueHeadingID(node.HeadingID) + if r.HeadingIDPrefix != "" { + id = r.HeadingIDPrefix + id + } + if r.HeadingIDSuffix != "" { + id = id + r.HeadingIDSuffix + } + attrs = append(attrs, fmt.Sprintf(`id="%s"`, id)) + } + r.cr(w) + r.tag(w, openTag, attrs) + } else { + r.out(w, closeTag) + if !(node.Parent.Type == Item && node.Next == nil) { + r.cr(w) + } + } + case HorizontalRule: + r.cr(w) + r.outHRTag(w) + r.cr(w) + case List: + openTag := ulTag + closeTag := ulCloseTag + if node.ListFlags&ListTypeOrdered != 0 { + openTag = olTag + closeTag = olCloseTag + } + if node.ListFlags&ListTypeDefinition != 0 { + openTag = dlTag + closeTag = dlCloseTag + } + if entering { + if node.IsFootnotesList { + r.out(w, footnotesDivBytes) + r.outHRTag(w) + r.cr(w) + } + r.cr(w) + if node.Parent.Type == Item && node.Parent.Parent.Tight { + r.cr(w) + } + r.tag(w, openTag[:len(openTag)-1], attrs) + r.cr(w) + } else { + r.out(w, closeTag) + //cr(w) + //if node.parent.Type != Item { + // cr(w) + //} + if node.Parent.Type == Item && node.Next != nil { + r.cr(w) + } + if node.Parent.Type == Document || node.Parent.Type == BlockQuote { + r.cr(w) + } + if node.IsFootnotesList { + r.out(w, footnotesCloseDivBytes) + } + } + case Item: + openTag := liTag + closeTag := liCloseTag + if node.ListFlags&ListTypeDefinition != 0 { + openTag = ddTag + closeTag = ddCloseTag + } + if node.ListFlags&ListTypeTerm != 0 { + openTag = dtTag + closeTag = dtCloseTag + } + if entering { + if itemOpenCR(node) { + r.cr(w) + } + if node.ListData.RefLink != nil { + slug := slugify(node.ListData.RefLink) + r.out(w, footnoteItem(r.FootnoteAnchorPrefix, slug)) + break + } + r.out(w, openTag) + } else { + if node.ListData.RefLink != nil { + slug := slugify(node.ListData.RefLink) + if r.Flags&FootnoteReturnLinks != 0 { + r.out(w, footnoteReturnLink(r.FootnoteAnchorPrefix, r.FootnoteReturnLinkContents, slug)) + } + } + r.out(w, closeTag) + r.cr(w) + } + case CodeBlock: + attrs = appendLanguageAttr(attrs, node.Info) + r.cr(w) + r.out(w, preTag) + r.tag(w, codeTag[:len(codeTag)-1], attrs) + escapeHTML(w, node.Literal) + r.out(w, codeCloseTag) + r.out(w, preCloseTag) + if node.Parent.Type != Item { + r.cr(w) + } + case Table: + if entering { + r.cr(w) + r.out(w, tableTag) + } else { + r.out(w, tableCloseTag) + r.cr(w) + } + case TableCell: + openTag := tdTag + closeTag := tdCloseTag + if node.IsHeader { + openTag = thTag + closeTag = thCloseTag + } + if entering { + align := cellAlignment(node.Align) + if align != "" { + attrs = append(attrs, fmt.Sprintf(`align="%s"`, align)) + } + if node.Prev == nil { + r.cr(w) + } + r.tag(w, openTag, attrs) + } else { + r.out(w, closeTag) + r.cr(w) + } + case TableHead: + if entering { + r.cr(w) + r.out(w, theadTag) + } else { + r.out(w, theadCloseTag) + r.cr(w) + } + case TableBody: + if entering { + r.cr(w) + r.out(w, tbodyTag) + // XXX: this is to adhere to a rather silly test. Should fix test. + if node.FirstChild == nil { + r.cr(w) + } + } else { + r.out(w, tbodyCloseTag) + r.cr(w) + } + case TableRow: + if entering { + r.cr(w) + r.out(w, trTag) + } else { + r.out(w, trCloseTag) + r.cr(w) + } + default: + panic("Unknown node type " + node.Type.String()) + } + return GoToNext +} + +// RenderHeader writes HTML document preamble and TOC if requested. +func (r *HTMLRenderer) RenderHeader(w io.Writer, ast *Node) { + r.writeDocumentHeader(w) + if r.Flags&TOC != 0 { + r.writeTOC(w, ast) + } +} + +// RenderFooter writes HTML document footer. +func (r *HTMLRenderer) RenderFooter(w io.Writer, ast *Node) { + if r.Flags&CompletePage == 0 { + return + } + io.WriteString(w, "\n\n\n") +} + +func (r *HTMLRenderer) writeDocumentHeader(w io.Writer) { + if r.Flags&CompletePage == 0 { + return + } + ending := "" + if r.Flags&UseXHTML != 0 { + io.WriteString(w, "\n") + io.WriteString(w, "\n") + ending = " /" + } else { + io.WriteString(w, "\n") + io.WriteString(w, "\n") + } + io.WriteString(w, "\n") + io.WriteString(w, " ") + if r.Flags&Smartypants != 0 { + r.sr.Process(w, []byte(r.Title)) + } else { + escapeHTML(w, []byte(r.Title)) + } + io.WriteString(w, "\n") + io.WriteString(w, " \n") + io.WriteString(w, " \n") + if r.CSS != "" { + io.WriteString(w, " \n") + } + if r.Icon != "" { + io.WriteString(w, " \n") + } + io.WriteString(w, " \n") + io.WriteString(w, "\n\n") +} + +func (r *HTMLRenderer) writeTOC(w io.Writer, ast *Node) { + buf := bytes.Buffer{} + + inHeading := false + tocLevel := 0 + headingCount := 0 + + ast.Walk(func(node *Node, entering bool) WalkStatus { + if node.Type == Heading && !node.HeadingData.IsTitleblock { + inHeading = entering + if entering { + node.HeadingID = fmt.Sprintf("toc_%d", headingCount) + if node.Level == tocLevel { + buf.WriteString("\n\n
  • ") + } else if node.Level < tocLevel { + for node.Level < tocLevel { + tocLevel-- + buf.WriteString("
  • \n") + } + buf.WriteString("\n\n
  • ") + } else { + for node.Level > tocLevel { + tocLevel++ + buf.WriteString("\n") + } + + if buf.Len() > 0 { + io.WriteString(w, "\n") + } + r.lastOutputLen = buf.Len() +} diff --git a/vendor/github.com/russross/blackfriday/inline.go b/vendor/github.com/russross/blackfriday/v2/inline.go similarity index 63% rename from vendor/github.com/russross/blackfriday/inline.go rename to vendor/github.com/russross/blackfriday/v2/inline.go index 4483b8f19f..4ed2907921 100644 --- a/vendor/github.com/russross/blackfriday/inline.go +++ b/vendor/github.com/russross/blackfriday/v2/inline.go @@ -22,6 +22,23 @@ import ( var ( urlRe = `((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+` anchorRe = regexp.MustCompile(`^(]+")?\s?>` + urlRe + `<\/a>)`) + + // https://www.w3.org/TR/html5/syntax.html#character-references + // highest unicode code point in 17 planes (2^20): 1,114,112d = + // 7 dec digits or 6 hex digits + // named entity references can be 2-31 characters with stuff like < + // at one end and ∳ at the other. There + // are also sometimes numbers at the end, although this isn't inherent + // in the specification; there are never numbers anywhere else in + // current character references, though; see ¾ and ▒, etc. + // https://www.w3.org/TR/html5/syntax.html#named-character-references + // + // entity := "&" (named group | number ref) ";" + // named group := [a-zA-Z]{2,31}[0-9]{0,2} + // number ref := "#" (dec ref | hex ref) + // dec ref := [0-9]{1,7} + // hex ref := ("x" | "X") [0-9a-fA-F]{1,6} + htmlEntityRe = regexp.MustCompile(`&([a-zA-Z]{2,31}[0-9]{0,2}|#([0-9]{1,7}|[xX][0-9a-fA-F]{1,6}));`) ) // Functions to parse text within a block @@ -29,87 +46,89 @@ var ( // data is the complete block being rendered // offset is the number of valid chars before the current cursor -func (p *parser) inline(out *bytes.Buffer, data []byte) { - // this is called recursively: enforce a maximum depth - if p.nesting >= p.maxNesting { +func (p *Markdown) inline(currBlock *Node, data []byte) { + // handlers might call us recursively: enforce a maximum depth + if p.nesting >= p.maxNesting || len(data) == 0 { return } p.nesting++ - - i, end := 0, 0 - for i < len(data) { - // copy inactive chars into the output - for end < len(data) && p.inlineCallback[data[end]] == nil { - end++ - } - - p.r.NormalText(out, data[i:end]) - - if end >= len(data) { - break - } - i = end - - // call the trigger + beg, end := 0, 0 + for end < len(data) { handler := p.inlineCallback[data[end]] - if consumed := handler(p, out, data, i); consumed == 0 { - // no action from the callback; buffer the byte for later - end = i + 1 + if handler != nil { + if consumed, node := handler(p, data, end); consumed == 0 { + // No action from the callback. + end++ + } else { + // Copy inactive chars into the output. + currBlock.AppendChild(text(data[beg:end])) + if node != nil { + currBlock.AppendChild(node) + } + // Skip past whatever the callback used. + beg = end + consumed + end = beg + } } else { - // skip past whatever the callback used - i += consumed - end = i + end++ } } - + if beg < len(data) { + if data[end-1] == '\n' { + end-- + } + currBlock.AppendChild(text(data[beg:end])) + } p.nesting-- } // single and double emphasis parsing -func emphasis(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func emphasis(p *Markdown, data []byte, offset int) (int, *Node) { data = data[offset:] c := data[0] - ret := 0 if len(data) > 2 && data[1] != c { // whitespace cannot follow an opening emphasis; // strikethrough only takes two characters '~~' if c == '~' || isspace(data[1]) { - return 0 + return 0, nil } - if ret = helperEmphasis(p, out, data[1:], c); ret == 0 { - return 0 + ret, node := helperEmphasis(p, data[1:], c) + if ret == 0 { + return 0, nil } - return ret + 1 + return ret + 1, node } if len(data) > 3 && data[1] == c && data[2] != c { if isspace(data[2]) { - return 0 + return 0, nil } - if ret = helperDoubleEmphasis(p, out, data[2:], c); ret == 0 { - return 0 + ret, node := helperDoubleEmphasis(p, data[2:], c) + if ret == 0 { + return 0, nil } - return ret + 2 + return ret + 2, node } if len(data) > 4 && data[1] == c && data[2] == c && data[3] != c { if c == '~' || isspace(data[3]) { - return 0 + return 0, nil } - if ret = helperTripleEmphasis(p, out, data, 3, c); ret == 0 { - return 0 + ret, node := helperTripleEmphasis(p, data, 3, c) + if ret == 0 { + return 0, nil } - return ret + 3 + return ret + 3, node } - return 0 + return 0, nil } -func codeSpan(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func codeSpan(p *Markdown, data []byte, offset int) (int, *Node) { data = data[offset:] nb := 0 @@ -131,7 +150,7 @@ func codeSpan(p *parser, out *bytes.Buffer, data []byte, offset int) int { // no matching delimiter? if i < nb && end >= len(data) { - return 0 + return 0, nil } // trim outside whitespace @@ -147,43 +166,36 @@ func codeSpan(p *parser, out *bytes.Buffer, data []byte, offset int) int { // render the code span if fBegin != fEnd { - p.r.CodeSpan(out, data[fBegin:fEnd]) + code := NewNode(Code) + code.Literal = data[fBegin:fEnd] + return end, code } - return end - + return end, nil } // newline preceded by two spaces becomes
    -// newline without two spaces works when EXTENSION_HARD_LINE_BREAK is enabled -func lineBreak(p *parser, out *bytes.Buffer, data []byte, offset int) int { - // remove trailing spaces from out - outBytes := out.Bytes() - end := len(outBytes) - eol := end - for eol > 0 && outBytes[eol-1] == ' ' { - eol-- - } - out.Truncate(eol) - - precededByTwoSpaces := offset >= 2 && data[offset-2] == ' ' && data[offset-1] == ' ' - precededByBackslash := offset >= 1 && data[offset-1] == '\\' // see http://spec.commonmark.org/0.18/#example-527 - precededByBackslash = precededByBackslash && p.flags&EXTENSION_BACKSLASH_LINE_BREAK != 0 - - if p.flags&EXTENSION_JOIN_LINES != 0 { - return 1 +func maybeLineBreak(p *Markdown, data []byte, offset int) (int, *Node) { + origOffset := offset + for offset < len(data) && data[offset] == ' ' { + offset++ } - // should there be a hard line break here? - if p.flags&EXTENSION_HARD_LINE_BREAK == 0 && !precededByTwoSpaces && !precededByBackslash { - return 0 + if offset < len(data) && data[offset] == '\n' { + if offset-origOffset >= 2 { + return offset - origOffset + 1, NewNode(Hardbreak) + } + return offset - origOffset, nil } + return 0, nil +} - if precededByBackslash && eol > 0 { - out.Truncate(eol - 1) +// newline without two spaces works when HardLineBreak is enabled +func lineBreak(p *Markdown, data []byte, offset int) (int, *Node) { + if p.extensions&HardLineBreak != 0 { + return 1, NewNode(Hardbreak) } - p.r.LineBreak(out) - return 1 + return 0, nil } type linkType int @@ -202,27 +214,43 @@ func isReferenceStyleLink(data []byte, pos int, t linkType) bool { return pos < len(data)-1 && data[pos] == '[' && data[pos+1] != '^' } +func maybeImage(p *Markdown, data []byte, offset int) (int, *Node) { + if offset < len(data)-1 && data[offset+1] == '[' { + return link(p, data, offset) + } + return 0, nil +} + +func maybeInlineFootnote(p *Markdown, data []byte, offset int) (int, *Node) { + if offset < len(data)-1 && data[offset+1] == '[' { + return link(p, data, offset) + } + return 0, nil +} + // '[': parse a link or an image or a footnote -func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func link(p *Markdown, data []byte, offset int) (int, *Node) { // no links allowed inside regular links, footnote, and deferred footnotes if p.insideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') { - return 0 + return 0, nil } var t linkType switch { // special case: ![^text] == deferred footnote (that follows something with // an exclamation point) - case p.flags&EXTENSION_FOOTNOTES != 0 && len(data)-1 > offset && data[offset+1] == '^': + case p.extensions&Footnotes != 0 && len(data)-1 > offset && data[offset+1] == '^': t = linkDeferredFootnote // ![alt] == image - case offset > 0 && data[offset-1] == '!': + case offset >= 0 && data[offset] == '!': t = linkImg + offset++ // ^[text] == inline footnote // [^refId] == deferred footnote - case p.flags&EXTENSION_FOOTNOTES != 0: - if offset > 0 && data[offset-1] == '^' { + case p.extensions&Footnotes != 0: + if offset >= 0 && data[offset] == '^' { t = linkInlineFootnote + offset++ } else if len(data)-1 > offset && data[offset+1] == '^' { t = linkDeferredFootnote } @@ -235,7 +263,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { var ( i = 1 - noteId int + noteID int title, link, altContent []byte textHasNl = false ) @@ -244,8 +272,6 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { i++ } - brace := 0 - // look for the matching closing bracket for level := 1; level > 0 && i < len(data); i++ { switch { @@ -267,11 +293,12 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { } if i >= len(data) { - return 0 + return 0, nil } txtE := i i++ + var footnoteNode *Node // skip any amount of whitespace or newline // (this is much more lax than original markdown syntax) @@ -279,8 +306,8 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { i++ } - switch { // inline style link + switch { case i < len(data) && data[i] == '(': // skip initial whitespace i++ @@ -291,27 +318,14 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { linkB := i - // look for link end: ' " ), check for new opening braces and take this - // into account, this may lead for overshooting and probably will require - // some fine-tuning. + // look for link end: ' " ) findlinkend: for i < len(data) { switch { case data[i] == '\\': i += 2 - case data[i] == '(': - brace++ - i++ - - case data[i] == ')': - if brace <= 0 { - break findlinkend - } - brace-- - i++ - - case data[i] == '\'' || data[i] == '"': + case data[i] == ')' || data[i] == '\'' || data[i] == '"': break findlinkend default: @@ -320,7 +334,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { } if i >= len(data) { - return 0 + return 0, nil } linkE := i @@ -345,7 +359,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { } if i >= len(data) { - return 0 + return 0, nil } // skip whitespace after title @@ -397,7 +411,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { i++ } if i >= len(data) { - return 0 + return 0, nil } linkE := i @@ -427,7 +441,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { // find the reference with matching id lr, ok := p.getRef(string(id)) if !ok { - return 0 + return 0, nil } // keep link and title from reference @@ -464,9 +478,10 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { } } + footnoteNode = NewNode(Item) if t == linkInlineFootnote { // create a new reference - noteId = len(p.notes) + 1 + noteID = len(p.notes) + 1 var fragment []byte if len(id) > 0 { @@ -477,18 +492,18 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { } copy(fragment, slugify(id)) } else { - fragment = append([]byte("footnote-"), []byte(strconv.Itoa(noteId))...) + fragment = append([]byte("footnote-"), []byte(strconv.Itoa(noteID))...) } ref := &reference{ - noteId: noteId, + noteID: noteID, hasBlock: false, link: fragment, title: id, + footnote: footnoteNode, } p.notes = append(p.notes, ref) - p.notesRecord[string(ref.link)] = struct{}{} link = ref.link title = ref.title @@ -496,40 +511,26 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { // find the reference with matching id lr, ok := p.getRef(string(id)) if !ok { - return 0 + return 0, nil } - if t == linkDeferredFootnote && !p.isFootnote(lr) { - lr.noteId = len(p.notes) + 1 + if t == linkDeferredFootnote { + lr.noteID = len(p.notes) + 1 + lr.footnote = footnoteNode p.notes = append(p.notes, lr) - p.notesRecord[string(lr.link)] = struct{}{} } // keep link and title from reference link = lr.link // if inline footnote, title == footnote contents title = lr.title - noteId = lr.noteId + noteID = lr.noteID } // rewind the whitespace i = txtE + 1 } - // build content: img alt is escaped, link content is parsed - var content bytes.Buffer - if txtE > 1 { - if t == linkImg { - content.Write(data[1:txtE]) - } else { - // links cannot contain other links, so turn off link parsing temporarily - insideLink := p.insideLink - p.insideLink = true - p.inline(&content, data[1:txtE]) - p.insideLink = insideLink - } - } - var uLink []byte if t == linkNormal || t == linkImg { if len(link) > 0 { @@ -539,49 +540,54 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { } // links need something to click on and somewhere to go - if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) { - return 0 + if len(uLink) == 0 || (t == linkNormal && txtE <= 1) { + return 0, nil } } // call the relevant rendering function + var linkNode *Node switch t { case linkNormal: + linkNode = NewNode(Link) + linkNode.Destination = normalizeURI(uLink) + linkNode.Title = title if len(altContent) > 0 { - p.r.Link(out, uLink, title, altContent) + linkNode.AppendChild(text(altContent)) } else { - p.r.Link(out, uLink, title, content.Bytes()) + // links cannot contain other links, so turn off link parsing + // temporarily and recurse + insideLink := p.insideLink + p.insideLink = true + p.inline(linkNode, data[1:txtE]) + p.insideLink = insideLink } case linkImg: - outSize := out.Len() - outBytes := out.Bytes() - if outSize > 0 && outBytes[outSize-1] == '!' { - out.Truncate(outSize - 1) - } - - p.r.Image(out, uLink, title, content.Bytes()) + linkNode = NewNode(Image) + linkNode.Destination = uLink + linkNode.Title = title + linkNode.AppendChild(text(data[1:txtE])) + i++ - case linkInlineFootnote: - outSize := out.Len() - outBytes := out.Bytes() - if outSize > 0 && outBytes[outSize-1] == '^' { - out.Truncate(outSize - 1) + case linkInlineFootnote, linkDeferredFootnote: + linkNode = NewNode(Link) + linkNode.Destination = link + linkNode.Title = title + linkNode.NoteID = noteID + linkNode.Footnote = footnoteNode + if t == linkInlineFootnote { + i++ } - p.r.FootnoteRef(out, link, noteId) - - case linkDeferredFootnote: - p.r.FootnoteRef(out, link, noteId) - default: - return 0 + return 0, nil } - return i + return i, linkNode } -func (p *parser) inlineHTMLComment(out *bytes.Buffer, data []byte) int { +func (p *Markdown) inlineHTMLComment(data []byte) int { if len(data) < 5 { return 0 } @@ -600,44 +606,75 @@ func (p *parser) inlineHTMLComment(out *bytes.Buffer, data []byte) int { return i + 1 } +func stripMailto(link []byte) []byte { + if bytes.HasPrefix(link, []byte("mailto://")) { + return link[9:] + } else if bytes.HasPrefix(link, []byte("mailto:")) { + return link[7:] + } else { + return link + } +} + +// autolinkType specifies a kind of autolink that gets detected. +type autolinkType int + +// These are the possible flag values for the autolink renderer. +const ( + notAutolink autolinkType = iota + normalAutolink + emailAutolink +) + // '<' when tags or autolinks are allowed -func leftAngle(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func leftAngle(p *Markdown, data []byte, offset int) (int, *Node) { data = data[offset:] - altype := LINK_TYPE_NOT_AUTOLINK - end := tagLength(data, &altype) - if size := p.inlineHTMLComment(out, data); size > 0 { + altype, end := tagLength(data) + if size := p.inlineHTMLComment(data); size > 0 { end = size } if end > 2 { - if altype != LINK_TYPE_NOT_AUTOLINK { + if altype != notAutolink { var uLink bytes.Buffer unescapeText(&uLink, data[1:end+1-2]) if uLink.Len() > 0 { - p.r.AutoLink(out, uLink.Bytes(), altype) + link := uLink.Bytes() + node := NewNode(Link) + node.Destination = link + if altype == emailAutolink { + node.Destination = append([]byte("mailto:"), link...) + } + node.AppendChild(text(stripMailto(link))) + return end, node } } else { - p.r.RawHtmlTag(out, data[:end]) + htmlTag := NewNode(HTMLSpan) + htmlTag.Literal = data[:end] + return end, htmlTag } } - return end + return end, nil } // '\\' backslash escape var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~") -func escape(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func escape(p *Markdown, data []byte, offset int) (int, *Node) { data = data[offset:] if len(data) > 1 { + if p.extensions&BackslashLineBreak != 0 && data[1] == '\n' { + return 2, NewNode(Hardbreak) + } if bytes.IndexByte(escapeChars, data[1]) < 0 { - return 0 + return 0, nil } - p.r.NormalText(out, data[1:2]) + return 2, text(data[1:2]) } - return 2 + return 2, nil } func unescapeText(ob *bytes.Buffer, src []byte) { @@ -663,7 +700,7 @@ func unescapeText(ob *bytes.Buffer, src []byte) { // '&' escaped when it doesn't belong to an entity // valid entities are assumed to be anything matching &#?[A-Za-z0-9]+; -func entity(p *parser, out *bytes.Buffer, data []byte, offset int) int { +func entity(p *Markdown, data []byte, offset int) (int, *Node) { data = data[offset:] end := 1 @@ -679,25 +716,70 @@ func entity(p *parser, out *bytes.Buffer, data []byte, offset int) int { if end < len(data) && data[end] == ';' { end++ // real entity } else { - return 0 // lone '&' + return 0, nil // lone '&' } - p.r.Entity(out, data[:end]) + ent := data[:end] + // undo & escaping or it will be converted to &amp; by another + // escaper in the renderer + if bytes.Equal(ent, []byte("&")) { + ent = []byte{'&'} + } - return end + return end, text(ent) } func linkEndsWithEntity(data []byte, linkEnd int) bool { - entityRanges := htmlEntity.FindAllIndex(data[:linkEnd], -1) + entityRanges := htmlEntityRe.FindAllIndex(data[:linkEnd], -1) return entityRanges != nil && entityRanges[len(entityRanges)-1][1] == linkEnd } -func autoLink(p *parser, out *bytes.Buffer, data []byte, offset int) int { - // quick check to rule out most false hits on ':' - if p.insideLink || len(data) < offset+3 || data[offset+1] != '/' || data[offset+2] != '/' { - return 0 +// hasPrefixCaseInsensitive is a custom implementation of +// strings.HasPrefix(strings.ToLower(s), prefix) +// we rolled our own because ToLower pulls in a huge machinery of lowercasing +// anything from Unicode and that's very slow. Since this func will only be +// used on ASCII protocol prefixes, we can take shortcuts. +func hasPrefixCaseInsensitive(s, prefix []byte) bool { + if len(s) < len(prefix) { + return false + } + delta := byte('a' - 'A') + for i, b := range prefix { + if b != s[i] && b != s[i]+delta { + return false + } } + return true +} +var protocolPrefixes = [][]byte{ + []byte("http://"), + []byte("https://"), + []byte("ftp://"), + []byte("file://"), + []byte("mailto:"), +} + +const shortestPrefix = 6 // len("ftp://"), the shortest of the above + +func maybeAutoLink(p *Markdown, data []byte, offset int) (int, *Node) { + // quick check to rule out most false hits + if p.insideLink || len(data) < offset+shortestPrefix { + return 0, nil + } + for _, prefix := range protocolPrefixes { + endOfHead := offset + 8 // 8 is the len() of the longest prefix + if endOfHead > len(data) { + endOfHead = len(data) + } + if hasPrefixCaseInsensitive(data[offset:endOfHead], prefix) { + return autoLink(p, data, offset) + } + } + return 0, nil +} + +func autoLink(p *Markdown, data []byte, offset int) (int, *Node) { // Now a more expensive check to see if we're not inside an anchor element anchorStart := offset offsetFromAnchor := 0 @@ -708,8 +790,9 @@ func autoLink(p *parser, out *bytes.Buffer, data []byte, offset int) int { anchorStr := anchorRe.Find(data[anchorStart:]) if anchorStr != nil { - out.Write(anchorStr[offsetFromAnchor:]) - return len(anchorStr) - offsetFromAnchor + anchorClose := NewNode(HTMLSpan) + anchorClose.Literal = anchorStr[offsetFromAnchor:] + return len(anchorStr) - offsetFromAnchor, anchorClose } // scan backward for a word boundary @@ -718,14 +801,14 @@ func autoLink(p *parser, out *bytes.Buffer, data []byte, offset int) int { rewind++ } if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters - return 0 + return 0, nil } origData := data data = data[offset-rewind:] if !isSafeLink(data) { - return 0 + return 0, nil } linkEnd := 0 @@ -802,19 +885,17 @@ func autoLink(p *parser, out *bytes.Buffer, data []byte, offset int) int { } } - // we were triggered on the ':', so we need to rewind the output a bit - if out.Len() >= rewind { - out.Truncate(len(out.Bytes()) - rewind) - } - var uLink bytes.Buffer unescapeText(&uLink, data[:linkEnd]) if uLink.Len() > 0 { - p.r.AutoLink(out, uLink.Bytes(), LINK_TYPE_NORMAL) + node := NewNode(Link) + node.Destination = uLink.Bytes() + node.AppendChild(text(uLink.Bytes())) + return linkEnd, node } - return linkEnd - rewind + return linkEnd, nil } func isEndOfLink(char byte) bool { @@ -847,17 +928,17 @@ func isSafeLink(link []byte) bool { } // return the length of the given tag, or 0 is it's not valid -func tagLength(data []byte, autolink *int) int { +func tagLength(data []byte) (autolink autolinkType, end int) { var i, j int // a valid tag can't be shorter than 3 chars if len(data) < 3 { - return 0 + return notAutolink, 0 } // begins with a '<' optionally followed by '/', followed by letter or number if data[0] != '<' { - return 0 + return notAutolink, 0 } if data[1] == '/' { i = 2 @@ -866,11 +947,11 @@ func tagLength(data []byte, autolink *int) int { } if !isalnum(data[i]) { - return 0 + return notAutolink, 0 } // scheme test - *autolink = LINK_TYPE_NOT_AUTOLINK + autolink = notAutolink // try to find the beginning of an URI for i < len(data) && (isalnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-') { @@ -879,21 +960,20 @@ func tagLength(data []byte, autolink *int) int { if i > 1 && i < len(data) && data[i] == '@' { if j = isMailtoAutoLink(data[i:]); j != 0 { - *autolink = LINK_TYPE_EMAIL - return i + j + return emailAutolink, i + j } } if i > 2 && i < len(data) && data[i] == ':' { - *autolink = LINK_TYPE_NORMAL + autolink = normalAutolink i++ } // complete autolink test: no whitespace or ' or " switch { case i >= len(data): - *autolink = LINK_TYPE_NOT_AUTOLINK - case *autolink != 0: + autolink = notAutolink + case autolink != notAutolink: j = i for i < len(data) { @@ -908,24 +988,20 @@ func tagLength(data []byte, autolink *int) int { } if i >= len(data) { - return 0 + return autolink, 0 } if i > j && data[i] == '>' { - return i + 1 + return autolink, i + 1 } // one of the forbidden chars has been found - *autolink = LINK_TYPE_NOT_AUTOLINK + autolink = notAutolink } - - // look for something looking like a tag end - for i < len(data) && data[i] != '>' { - i++ - } - if i >= len(data) { - return 0 + i += bytes.IndexByte(data[i:], '>') + if i < 0 { + return autolink, 0 } - return i + 1 + return autolink, i + 1 } // look for the address part of a mail autolink and '>' @@ -944,14 +1020,13 @@ func isMailtoAutoLink(data []byte) int { nb++ case '-', '.', '_': - // Do nothing. + break case '>': if nb == 1 { return i + 1 - } else { - return 0 } + return 0 default: return 0 } @@ -1014,9 +1089,8 @@ func helperFindEmphChar(data []byte, c byte) int { if data[i] != '[' && data[i] != '(' { // not a link if tmpI > 0 { return tmpI - } else { - continue } + continue } cc := data[i] i++ @@ -1035,7 +1109,7 @@ func helperFindEmphChar(data []byte, c byte) int { return 0 } -func helperEmphasis(p *parser, out *bytes.Buffer, data []byte, c byte) int { +func helperEmphasis(p *Markdown, data []byte, c byte) (int, *Node) { i := 0 // skip one symbol if coming from emph3 @@ -1046,11 +1120,11 @@ func helperEmphasis(p *parser, out *bytes.Buffer, data []byte, c byte) int { for i < len(data) { length := helperFindEmphChar(data[i:], c) if length == 0 { - return 0 + return 0, nil } i += length if i >= len(data) { - return 0 + return 0, nil } if i+1 < len(data) && data[i+1] == c { @@ -1060,52 +1134,46 @@ func helperEmphasis(p *parser, out *bytes.Buffer, data []byte, c byte) int { if data[i] == c && !isspace(data[i-1]) { - if p.flags&EXTENSION_NO_INTRA_EMPHASIS != 0 { + if p.extensions&NoIntraEmphasis != 0 { if !(i+1 == len(data) || isspace(data[i+1]) || ispunct(data[i+1])) { continue } } - var work bytes.Buffer - p.inline(&work, data[:i]) - p.r.Emphasis(out, work.Bytes()) - return i + 1 + emph := NewNode(Emph) + p.inline(emph, data[:i]) + return i + 1, emph } } - return 0 + return 0, nil } -func helperDoubleEmphasis(p *parser, out *bytes.Buffer, data []byte, c byte) int { +func helperDoubleEmphasis(p *Markdown, data []byte, c byte) (int, *Node) { i := 0 for i < len(data) { length := helperFindEmphChar(data[i:], c) if length == 0 { - return 0 + return 0, nil } i += length if i+1 < len(data) && data[i] == c && data[i+1] == c && i > 0 && !isspace(data[i-1]) { - var work bytes.Buffer - p.inline(&work, data[:i]) - - if work.Len() > 0 { - // pick the right renderer - if c == '~' { - p.r.StrikeThrough(out, work.Bytes()) - } else { - p.r.DoubleEmphasis(out, work.Bytes()) - } + nodeType := Strong + if c == '~' { + nodeType = Del } - return i + 2 + node := NewNode(nodeType) + p.inline(node, data[:i]) + return i + 2, node } i++ } - return 0 + return 0, nil } -func helperTripleEmphasis(p *parser, out *bytes.Buffer, data []byte, offset int, c byte) int { +func helperTripleEmphasis(p *Markdown, data []byte, offset int, c byte) (int, *Node) { i := 0 origData := data data = data[offset:] @@ -1113,7 +1181,7 @@ func helperTripleEmphasis(p *parser, out *bytes.Buffer, data []byte, offset int, for i < len(data) { length := helperFindEmphChar(data[i:], c) if length == 0 { - return 0 + return 0, nil } i += length @@ -1125,30 +1193,36 @@ func helperTripleEmphasis(p *parser, out *bytes.Buffer, data []byte, offset int, switch { case i+2 < len(data) && data[i+1] == c && data[i+2] == c: // triple symbol found - var work bytes.Buffer - - p.inline(&work, data[:i]) - if work.Len() > 0 { - p.r.TripleEmphasis(out, work.Bytes()) - } - return i + 3 + strong := NewNode(Strong) + em := NewNode(Emph) + strong.AppendChild(em) + p.inline(em, data[:i]) + return i + 3, strong case (i+1 < len(data) && data[i+1] == c): // double symbol found, hand over to emph1 - length = helperEmphasis(p, out, origData[offset-2:], c) + length, node := helperEmphasis(p, origData[offset-2:], c) if length == 0 { - return 0 - } else { - return length - 2 + return 0, nil } + return length - 2, node default: // single symbol found, hand over to emph2 - length = helperDoubleEmphasis(p, out, origData[offset-1:], c) + length, node := helperDoubleEmphasis(p, origData[offset-1:], c) if length == 0 { - return 0 - } else { - return length - 1 + return 0, nil } + return length - 1, node } } - return 0 + return 0, nil +} + +func text(s []byte) *Node { + node := NewNode(Text) + node.Literal = s + return node +} + +func normalizeURI(s []byte) []byte { + return s // TODO: implement } diff --git a/vendor/github.com/russross/blackfriday/markdown.go b/vendor/github.com/russross/blackfriday/v2/markdown.go similarity index 50% rename from vendor/github.com/russross/blackfriday/markdown.go rename to vendor/github.com/russross/blackfriday/v2/markdown.go index 41595d62d0..58d2e4538c 100644 --- a/vendor/github.com/russross/blackfriday/markdown.go +++ b/vendor/github.com/russross/blackfriday/v2/markdown.go @@ -1,103 +1,93 @@ -// // Blackfriday Markdown Processor // Available at http://github.com/russross/blackfriday // // Copyright © 2011 Russ Ross . // Distributed under the Simplified BSD License. // See README.md for details. -// - -// -// -// Markdown parsing and processing -// -// package blackfriday import ( "bytes" "fmt" + "io" "strings" "unicode/utf8" ) -const VERSION = "1.5" +// +// Markdown parsing and processing +// + +// Version string of the package. Appears in the rendered document when +// CompletePage flag is on. +const Version = "2.0" + +// Extensions is a bitwise or'ed collection of enabled Blackfriday's +// extensions. +type Extensions int // These are the supported markdown parsing extensions. // OR these values together to select multiple extensions. const ( - EXTENSION_NO_INTRA_EMPHASIS = 1 << iota // ignore emphasis markers inside words - EXTENSION_TABLES // render tables - EXTENSION_FENCED_CODE // render fenced code blocks - EXTENSION_AUTOLINK // detect embedded URLs that are not explicitly marked - EXTENSION_STRIKETHROUGH // strikethrough text using ~~test~~ - EXTENSION_LAX_HTML_BLOCKS // loosen up HTML block parsing rules - EXTENSION_SPACE_HEADERS // be strict about prefix header rules - EXTENSION_HARD_LINE_BREAK // translate newlines into line breaks - EXTENSION_TAB_SIZE_EIGHT // expand tabs to eight spaces instead of four - EXTENSION_FOOTNOTES // Pandoc-style footnotes - EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK // No need to insert an empty line to start a (code, quote, ordered list, unordered list) block - EXTENSION_HEADER_IDS // specify header IDs with {#id} - EXTENSION_TITLEBLOCK // Titleblock ala pandoc - EXTENSION_AUTO_HEADER_IDS // Create the header ID from the text - EXTENSION_BACKSLASH_LINE_BREAK // translate trailing backslashes into line breaks - EXTENSION_DEFINITION_LISTS // render definition lists - EXTENSION_JOIN_LINES // delete newline and join lines - - commonHtmlFlags = 0 | - HTML_USE_XHTML | - HTML_USE_SMARTYPANTS | - HTML_SMARTYPANTS_FRACTIONS | - HTML_SMARTYPANTS_DASHES | - HTML_SMARTYPANTS_LATEX_DASHES - - commonExtensions = 0 | - EXTENSION_NO_INTRA_EMPHASIS | - EXTENSION_TABLES | - EXTENSION_FENCED_CODE | - EXTENSION_AUTOLINK | - EXTENSION_STRIKETHROUGH | - EXTENSION_SPACE_HEADERS | - EXTENSION_HEADER_IDS | - EXTENSION_BACKSLASH_LINE_BREAK | - EXTENSION_DEFINITION_LISTS + NoExtensions Extensions = 0 + NoIntraEmphasis Extensions = 1 << iota // Ignore emphasis markers inside words + Tables // Render tables + FencedCode // Render fenced code blocks + Autolink // Detect embedded URLs that are not explicitly marked + Strikethrough // Strikethrough text using ~~test~~ + LaxHTMLBlocks // Loosen up HTML block parsing rules + SpaceHeadings // Be strict about prefix heading rules + HardLineBreak // Translate newlines into line breaks + TabSizeEight // Expand tabs to eight spaces instead of four + Footnotes // Pandoc-style footnotes + NoEmptyLineBeforeBlock // No need to insert an empty line to start a (code, quote, ordered list, unordered list) block + HeadingIDs // specify heading IDs with {#id} + Titleblock // Titleblock ala pandoc + AutoHeadingIDs // Create the heading ID from the text + BackslashLineBreak // Translate trailing backslashes into line breaks + DefinitionLists // Render definition lists + + CommonHTMLFlags HTMLFlags = UseXHTML | Smartypants | + SmartypantsFractions | SmartypantsDashes | SmartypantsLatexDashes + + CommonExtensions Extensions = NoIntraEmphasis | Tables | FencedCode | + Autolink | Strikethrough | SpaceHeadings | HeadingIDs | + BackslashLineBreak | DefinitionLists ) -// These are the possible flag values for the link renderer. -// Only a single one of these values will be used; they are not ORed together. -// These are mostly of interest if you are writing a new output format. -const ( - LINK_TYPE_NOT_AUTOLINK = iota - LINK_TYPE_NORMAL - LINK_TYPE_EMAIL -) +// ListType contains bitwise or'ed flags for list and list item objects. +type ListType int // These are the possible flag values for the ListItem renderer. // Multiple flag values may be ORed together. // These are mostly of interest if you are writing a new output format. const ( - LIST_TYPE_ORDERED = 1 << iota - LIST_TYPE_DEFINITION - LIST_TYPE_TERM - LIST_ITEM_CONTAINS_BLOCK - LIST_ITEM_BEGINNING_OF_LIST - LIST_ITEM_END_OF_LIST + ListTypeOrdered ListType = 1 << iota + ListTypeDefinition + ListTypeTerm + + ListItemContainsBlock + ListItemBeginningOfList // TODO: figure out if this is of any use now + ListItemEndOfList ) +// CellAlignFlags holds a type of alignment in a table cell. +type CellAlignFlags int + // These are the possible flag values for the table cell renderer. // Only a single one of these values will be used; they are not ORed together. // These are mostly of interest if you are writing a new output format. const ( - TABLE_ALIGNMENT_LEFT = 1 << iota - TABLE_ALIGNMENT_RIGHT - TABLE_ALIGNMENT_CENTER = (TABLE_ALIGNMENT_LEFT | TABLE_ALIGNMENT_RIGHT) + TableAlignmentLeft CellAlignFlags = 1 << iota + TableAlignmentRight + TableAlignmentCenter = (TableAlignmentLeft | TableAlignmentRight) ) // The size of a tab stop. const ( - TAB_SIZE_DEFAULT = 4 - TAB_SIZE_EIGHT = 8 + TabSizeDefault = 4 + TabSizeDouble = 8 ) // blockTags is a set of tags that are recognized as HTML block tags. @@ -145,86 +135,66 @@ var blockTags = map[string]struct{}{ "video": {}, } -// Renderer is the rendering interface. -// This is mostly of interest if you are implementing a new rendering format. +// Renderer is the rendering interface. This is mostly of interest if you are +// implementing a new rendering format. // -// When a byte slice is provided, it contains the (rendered) contents of the -// element. -// -// When a callback is provided instead, it will write the contents of the -// respective element directly to the output buffer and return true on success. -// If the callback returns false, the rendering function should reset the -// output buffer as though it had never been called. -// -// Currently Html and Latex implementations are provided +// Only an HTML implementation is provided in this repository, see the README +// for external implementations. type Renderer interface { - // block-level callbacks - BlockCode(out *bytes.Buffer, text []byte, infoString string) - BlockQuote(out *bytes.Buffer, text []byte) - BlockHtml(out *bytes.Buffer, text []byte) - Header(out *bytes.Buffer, text func() bool, level int, id string) - HRule(out *bytes.Buffer) - List(out *bytes.Buffer, text func() bool, flags int) - ListItem(out *bytes.Buffer, text []byte, flags int) - Paragraph(out *bytes.Buffer, text func() bool) - Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) - TableRow(out *bytes.Buffer, text []byte) - TableHeaderCell(out *bytes.Buffer, text []byte, flags int) - TableCell(out *bytes.Buffer, text []byte, flags int) - Footnotes(out *bytes.Buffer, text func() bool) - FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) - TitleBlock(out *bytes.Buffer, text []byte) - - // Span-level callbacks - AutoLink(out *bytes.Buffer, link []byte, kind int) - CodeSpan(out *bytes.Buffer, text []byte) - DoubleEmphasis(out *bytes.Buffer, text []byte) - Emphasis(out *bytes.Buffer, text []byte) - Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) - LineBreak(out *bytes.Buffer) - Link(out *bytes.Buffer, link []byte, title []byte, content []byte) - RawHtmlTag(out *bytes.Buffer, tag []byte) - TripleEmphasis(out *bytes.Buffer, text []byte) - StrikeThrough(out *bytes.Buffer, text []byte) - FootnoteRef(out *bytes.Buffer, ref []byte, id int) - - // Low-level callbacks - Entity(out *bytes.Buffer, entity []byte) - NormalText(out *bytes.Buffer, text []byte) - - // Header and footer - DocumentHeader(out *bytes.Buffer) - DocumentFooter(out *bytes.Buffer) - - GetFlags() int + // RenderNode is the main rendering method. It will be called once for + // every leaf node and twice for every non-leaf node (first with + // entering=true, then with entering=false). The method should write its + // rendition of the node to the supplied writer w. + RenderNode(w io.Writer, node *Node, entering bool) WalkStatus + + // RenderHeader is a method that allows the renderer to produce some + // content preceding the main body of the output document. The header is + // understood in the broad sense here. For example, the default HTML + // renderer will write not only the HTML document preamble, but also the + // table of contents if it was requested. + // + // The method will be passed an entire document tree, in case a particular + // implementation needs to inspect it to produce output. + // + // The output should be written to the supplied writer w. If your + // implementation has no header to write, supply an empty implementation. + RenderHeader(w io.Writer, ast *Node) + + // RenderFooter is a symmetric counterpart of RenderHeader. + RenderFooter(w io.Writer, ast *Node) } // Callback functions for inline parsing. One such function is defined // for each character that triggers a response when parsing inline data. -type inlineParser func(p *parser, out *bytes.Buffer, data []byte, offset int) int - -// Parser holds runtime state used by the parser. -// This is constructed by the Markdown function. -type parser struct { - r Renderer - refOverride ReferenceOverrideFunc - refs map[string]*reference - inlineCallback [256]inlineParser - flags int - nesting int - maxNesting int - insideLink bool +type inlineParser func(p *Markdown, data []byte, offset int) (int, *Node) + +// Markdown is a type that holds extensions and the runtime state used by +// Parse, and the renderer. You can not use it directly, construct it with New. +type Markdown struct { + renderer Renderer + referenceOverride ReferenceOverrideFunc + refs map[string]*reference + inlineCallback [256]inlineParser + extensions Extensions + nesting int + maxNesting int + insideLink bool // Footnotes need to be ordered as well as available to quickly check for // presence. If a ref is also a footnote, it's stored both in refs and here // in notes. Slice is nil if footnotes not enabled. - notes []*reference - notesRecord map[string]struct{} + notes []*reference + + doc *Node + tip *Node // = doc + oldTip *Node + lastMatchedContainer *Node // = doc + allClosed bool } -func (p *parser) getRef(refid string) (ref *reference, found bool) { - if p.refOverride != nil { - r, overridden := p.refOverride(refid) +func (p *Markdown) getRef(refid string) (ref *reference, found bool) { + if p.referenceOverride != nil { + r, overridden := p.referenceOverride(refid) if overridden { if r == nil { return nil, false @@ -232,7 +202,7 @@ func (p *parser) getRef(refid string) (ref *reference, found bool) { return &reference{ link: []byte(r.Link), title: []byte(r.Title), - noteId: 0, + noteID: 0, hasBlock: false, text: []byte(r.Text)}, true } @@ -242,9 +212,34 @@ func (p *parser) getRef(refid string) (ref *reference, found bool) { return ref, found } -func (p *parser) isFootnote(ref *reference) bool { - _, ok := p.notesRecord[string(ref.link)] - return ok +func (p *Markdown) finalize(block *Node) { + above := block.Parent + block.open = false + p.tip = above +} + +func (p *Markdown) addChild(node NodeType, offset uint32) *Node { + return p.addExistingChild(NewNode(node), offset) +} + +func (p *Markdown) addExistingChild(node *Node, offset uint32) *Node { + for !p.tip.canContain(node.Type) { + p.finalize(p.tip) + } + p.tip.AppendChild(node) + p.tip = node + return node +} + +func (p *Markdown) closeUnmatchedBlocks() { + if !p.allClosed { + for p.oldTip != p.lastMatchedContainer { + parent := p.oldTip.Parent + p.finalize(p.oldTip) + p.oldTip = parent + } + p.allClosed = true + } } // @@ -271,102 +266,27 @@ type Reference struct { // See the documentation in Options for more details on use-case. type ReferenceOverrideFunc func(reference string) (ref *Reference, overridden bool) -// Options represents configurable overrides and callbacks (in addition to the -// extension flag set) for configuring a Markdown parse. -type Options struct { - // Extensions is a flag set of bit-wise ORed extension bits. See the - // EXTENSION_* flags defined in this package. - Extensions int - - // ReferenceOverride is an optional function callback that is called every - // time a reference is resolved. - // - // In Markdown, the link reference syntax can be made to resolve a link to - // a reference instead of an inline URL, in one of the following ways: - // - // * [link text][refid] - // * [refid][] - // - // Usually, the refid is defined at the bottom of the Markdown document. If - // this override function is provided, the refid is passed to the override - // function first, before consulting the defined refids at the bottom. If - // the override function indicates an override did not occur, the refids at - // the bottom will be used to fill in the link details. - ReferenceOverride ReferenceOverrideFunc -} - -// MarkdownBasic is a convenience function for simple rendering. -// It processes markdown input with no extensions enabled. -func MarkdownBasic(input []byte) []byte { - // set up the HTML renderer - htmlFlags := HTML_USE_XHTML - renderer := HtmlRenderer(htmlFlags, "", "") - - // set up the parser - return MarkdownOptions(input, renderer, Options{Extensions: 0}) -} - -// Call Markdown with most useful extensions enabled -// MarkdownCommon is a convenience function for simple rendering. -// It processes markdown input with common extensions enabled, including: -// -// * Smartypants processing with smart fractions and LaTeX dashes -// -// * Intra-word emphasis suppression -// -// * Tables -// -// * Fenced code blocks -// -// * Autolinking -// -// * Strikethrough support -// -// * Strict header parsing -// -// * Custom Header IDs -func MarkdownCommon(input []byte) []byte { - // set up the HTML renderer - renderer := HtmlRenderer(commonHtmlFlags, "", "") - return MarkdownOptions(input, renderer, Options{ - Extensions: commonExtensions}) -} - -// Markdown is the main rendering function. -// It parses and renders a block of markdown-encoded text. -// The supplied Renderer is used to format the output, and extensions dictates -// which non-standard extensions are enabled. -// -// To use the supplied Html or LaTeX renderers, see HtmlRenderer and -// LatexRenderer, respectively. -func Markdown(input []byte, renderer Renderer, extensions int) []byte { - return MarkdownOptions(input, renderer, Options{ - Extensions: extensions}) -} - -// MarkdownOptions is just like Markdown but takes additional options through -// the Options struct. -func MarkdownOptions(input []byte, renderer Renderer, opts Options) []byte { - // no point in parsing if we can't render - if renderer == nil { - return nil +// New constructs a Markdown processor. You can use the same With* functions as +// for Run() to customize parser's behavior and the renderer. +func New(opts ...Option) *Markdown { + var p Markdown + for _, opt := range opts { + opt(&p) } - - extensions := opts.Extensions - - // fill in the render structure - p := new(parser) - p.r = renderer - p.flags = extensions - p.refOverride = opts.ReferenceOverride p.refs = make(map[string]*reference) p.maxNesting = 16 p.insideLink = false - + docNode := NewNode(Document) + p.doc = docNode + p.tip = docNode + p.oldTip = docNode + p.lastMatchedContainer = docNode + p.allClosed = true // register inline parsers + p.inlineCallback[' '] = maybeLineBreak p.inlineCallback['*'] = emphasis p.inlineCallback['_'] = emphasis - if extensions&EXTENSION_STRIKETHROUGH != 0 { + if p.extensions&Strikethrough != 0 { p.inlineCallback['~'] = emphasis } p.inlineCallback['`'] = codeSpan @@ -375,116 +295,166 @@ func MarkdownOptions(input []byte, renderer Renderer, opts Options) []byte { p.inlineCallback['<'] = leftAngle p.inlineCallback['\\'] = escape p.inlineCallback['&'] = entity - - if extensions&EXTENSION_AUTOLINK != 0 { - p.inlineCallback[':'] = autoLink - } - - if extensions&EXTENSION_FOOTNOTES != 0 { + p.inlineCallback['!'] = maybeImage + p.inlineCallback['^'] = maybeInlineFootnote + if p.extensions&Autolink != 0 { + p.inlineCallback['h'] = maybeAutoLink + p.inlineCallback['m'] = maybeAutoLink + p.inlineCallback['f'] = maybeAutoLink + p.inlineCallback['H'] = maybeAutoLink + p.inlineCallback['M'] = maybeAutoLink + p.inlineCallback['F'] = maybeAutoLink + } + if p.extensions&Footnotes != 0 { p.notes = make([]*reference, 0) - p.notesRecord = make(map[string]struct{}) } - - first := firstPass(p, input) - second := secondPass(p, first) - return second + return &p } -// first pass: -// - normalize newlines -// - extract references (outside of fenced code blocks) -// - expand tabs (outside of fenced code blocks) -// - copy everything else -func firstPass(p *parser, input []byte) []byte { - var out bytes.Buffer - tabSize := TAB_SIZE_DEFAULT - if p.flags&EXTENSION_TAB_SIZE_EIGHT != 0 { - tabSize = TAB_SIZE_EIGHT - } - beg := 0 - lastFencedCodeBlockEnd := 0 - for beg < len(input) { - // Find end of this line, then process the line. - end := beg - for end < len(input) && input[end] != '\n' && input[end] != '\r' { - end++ - } +// Option customizes the Markdown processor's default behavior. +type Option func(*Markdown) - if p.flags&EXTENSION_FENCED_CODE != 0 { - // track fenced code block boundaries to suppress tab expansion - // and reference extraction inside them: - if beg >= lastFencedCodeBlockEnd { - if i := p.fencedCodeBlock(&out, input[beg:], false); i > 0 { - lastFencedCodeBlockEnd = beg + i - } - } - } - - // add the line body if present - if end > beg { - if end < lastFencedCodeBlockEnd { // Do not expand tabs while inside fenced code blocks. - out.Write(input[beg:end]) - } else if refEnd := isReference(p, input[beg:], tabSize); refEnd > 0 { - beg += refEnd - continue - } else { - expandTabs(&out, input[beg:end], tabSize) - } - } - - if end < len(input) && input[end] == '\r' { - end++ - } - if end < len(input) && input[end] == '\n' { - end++ - } - out.WriteByte('\n') - - beg = end +// WithRenderer allows you to override the default renderer. +func WithRenderer(r Renderer) Option { + return func(p *Markdown) { + p.renderer = r } +} - // empty input? - if out.Len() == 0 { - out.WriteByte('\n') +// WithExtensions allows you to pick some of the many extensions provided by +// Blackfriday. You can bitwise OR them. +func WithExtensions(e Extensions) Option { + return func(p *Markdown) { + p.extensions = e } - - return out.Bytes() } -// second pass: actual rendering -func secondPass(p *parser, input []byte) []byte { - var output bytes.Buffer - - p.r.DocumentHeader(&output) - p.block(&output, input) - - if p.flags&EXTENSION_FOOTNOTES != 0 && len(p.notes) > 0 { - p.r.Footnotes(&output, func() bool { - flags := LIST_ITEM_BEGINNING_OF_LIST - for i := 0; i < len(p.notes); i += 1 { - ref := p.notes[i] - var buf bytes.Buffer - if ref.hasBlock { - flags |= LIST_ITEM_CONTAINS_BLOCK - p.block(&buf, ref.title) - } else { - p.inline(&buf, ref.title) - } - p.r.FootnoteItem(&output, ref.link, buf.Bytes(), flags) - flags &^= LIST_ITEM_BEGINNING_OF_LIST | LIST_ITEM_CONTAINS_BLOCK - } - - return true +// WithNoExtensions turns off all extensions and custom behavior. +func WithNoExtensions() Option { + return func(p *Markdown) { + p.extensions = NoExtensions + p.renderer = NewHTMLRenderer(HTMLRendererParameters{ + Flags: HTMLFlagsNone, }) } +} - p.r.DocumentFooter(&output) - - if p.nesting != 0 { - panic("Nesting level did not end at zero") +// WithRefOverride sets an optional function callback that is called every +// time a reference is resolved. +// +// In Markdown, the link reference syntax can be made to resolve a link to +// a reference instead of an inline URL, in one of the following ways: +// +// * [link text][refid] +// * [refid][] +// +// Usually, the refid is defined at the bottom of the Markdown document. If +// this override function is provided, the refid is passed to the override +// function first, before consulting the defined refids at the bottom. If +// the override function indicates an override did not occur, the refids at +// the bottom will be used to fill in the link details. +func WithRefOverride(o ReferenceOverrideFunc) Option { + return func(p *Markdown) { + p.referenceOverride = o } +} - return output.Bytes() +// Run is the main entry point to Blackfriday. It parses and renders a +// block of markdown-encoded text. +// +// The simplest invocation of Run takes one argument, input: +// output := Run(input) +// This will parse the input with CommonExtensions enabled and render it with +// the default HTMLRenderer (with CommonHTMLFlags). +// +// Variadic arguments opts can customize the default behavior. Since Markdown +// type does not contain exported fields, you can not use it directly. Instead, +// use the With* functions. For example, this will call the most basic +// functionality, with no extensions: +// output := Run(input, WithNoExtensions()) +// +// You can use any number of With* arguments, even contradicting ones. They +// will be applied in order of appearance and the latter will override the +// former: +// output := Run(input, WithNoExtensions(), WithExtensions(exts), +// WithRenderer(yourRenderer)) +func Run(input []byte, opts ...Option) []byte { + r := NewHTMLRenderer(HTMLRendererParameters{ + Flags: CommonHTMLFlags, + }) + optList := []Option{WithRenderer(r), WithExtensions(CommonExtensions)} + optList = append(optList, opts...) + parser := New(optList...) + ast := parser.Parse(input) + var buf bytes.Buffer + parser.renderer.RenderHeader(&buf, ast) + ast.Walk(func(node *Node, entering bool) WalkStatus { + return parser.renderer.RenderNode(&buf, node, entering) + }) + parser.renderer.RenderFooter(&buf, ast) + return buf.Bytes() +} + +// Parse is an entry point to the parsing part of Blackfriday. It takes an +// input markdown document and produces a syntax tree for its contents. This +// tree can then be rendered with a default or custom renderer, or +// analyzed/transformed by the caller to whatever non-standard needs they have. +// The return value is the root node of the syntax tree. +func (p *Markdown) Parse(input []byte) *Node { + p.block(input) + // Walk the tree and finish up some of unfinished blocks + for p.tip != nil { + p.finalize(p.tip) + } + // Walk the tree again and process inline markdown in each block + p.doc.Walk(func(node *Node, entering bool) WalkStatus { + if node.Type == Paragraph || node.Type == Heading || node.Type == TableCell { + p.inline(node, node.content) + node.content = nil + } + return GoToNext + }) + p.parseRefsToAST() + return p.doc +} + +func (p *Markdown) parseRefsToAST() { + if p.extensions&Footnotes == 0 || len(p.notes) == 0 { + return + } + p.tip = p.doc + block := p.addBlock(List, nil) + block.IsFootnotesList = true + block.ListFlags = ListTypeOrdered + flags := ListItemBeginningOfList + // Note: this loop is intentionally explicit, not range-form. This is + // because the body of the loop will append nested footnotes to p.notes and + // we need to process those late additions. Range form would only walk over + // the fixed initial set. + for i := 0; i < len(p.notes); i++ { + ref := p.notes[i] + p.addExistingChild(ref.footnote, 0) + block := ref.footnote + block.ListFlags = flags | ListTypeOrdered + block.RefLink = ref.link + if ref.hasBlock { + flags |= ListItemContainsBlock + p.block(ref.title) + } else { + p.inline(block, ref.title) + } + flags &^= ListItemBeginningOfList | ListItemContainsBlock + } + above := block.Parent + finalizeList(block) + p.tip = above + block.Walk(func(node *Node, entering bool) WalkStatus { + if node.Type == Paragraph || node.Type == Heading { + p.inline(node, node.content) + node.content = nil + } + return GoToNext + }) } // @@ -510,24 +480,62 @@ func secondPass(p *parser, input []byte) []byte { // [^note]: This is the explanation. // // Footnotes should be placed at the end of the document in an ordered list. -// Inline footnotes such as: +// Finally, there are inline footnotes such as: // -// Inline footnotes^[Not supported.] also exist. +// Inline footnotes^[Also supported.] provide a quick inline explanation, +// but are rendered at the bottom of the document. // -// are not yet supported. -// References are parsed and stored in this struct. +// reference holds all information necessary for a reference-style links or +// footnotes. +// +// Consider this markdown with reference-style links: +// +// [link][ref] +// +// [ref]: /url/ "tooltip title" +// +// It will be ultimately converted to this HTML: +// +//

    link

    +// +// And a reference structure will be populated as follows: +// +// p.refs["ref"] = &reference{ +// link: "/url/", +// title: "tooltip title", +// } +// +// Alternatively, reference can contain information about a footnote. Consider +// this markdown: +// +// Text needing a footnote.[^a] +// +// [^a]: This is the note +// +// A reference structure will be populated as follows: +// +// p.refs["a"] = &reference{ +// link: "a", +// title: "This is the note", +// noteID: , +// } +// +// TODO: As you can see, it begs for splitting into two dedicated structures +// for refs and for footnotes. type reference struct { link []byte title []byte - noteId int // 0 if not a footnote ref + noteID int // 0 if not a footnote ref hasBlock bool - text []byte + footnote *Node // a link to the Item node within a list of footnotes + + text []byte // only gets populated by refOverride feature with Reference.Text } func (r *reference) String() string { - return fmt.Sprintf("{link: %q, title: %q, text: %q, noteId: %d, hasBlock: %v}", - r.link, r.title, r.text, r.noteId, r.hasBlock) + return fmt.Sprintf("{link: %q, title: %q, text: %q, noteID: %d, hasBlock: %v}", + r.link, r.title, r.text, r.noteID, r.hasBlock) } // Check whether or not data starts with a reference link. @@ -535,7 +543,7 @@ func (r *reference) String() string { // (in the render struct). // Returns the number of bytes to skip to move past it, // or zero if the first line is not a reference. -func isReference(p *parser, data []byte, tabSize int) int { +func isReference(p *Markdown, data []byte, tabSize int) int { // up to 3 optional leading spaces if len(data) < 4 { return 0 @@ -545,18 +553,18 @@ func isReference(p *parser, data []byte, tabSize int) int { i++ } - noteId := 0 + noteID := 0 // id part: anything but a newline between brackets if data[i] != '[' { return 0 } i++ - if p.flags&EXTENSION_FOOTNOTES != 0 { + if p.extensions&Footnotes != 0 { if i < len(data) && data[i] == '^' { // we can set it to anything here because the proper noteIds will // be assigned later during the second pass. It just has to be != 0 - noteId = 1 + noteID = 1 i++ } } @@ -568,7 +576,11 @@ func isReference(p *parser, data []byte, tabSize int) int { return 0 } idEnd := i - + // footnotes can have empty ID, like this: [^], but a reference can not be + // empty like this: []. Break early if it's not a footnote and there's no ID + if noteID == 0 && idOffset == idEnd { + return 0 + } // spacer: colon (space | tab)* newline? (space | tab)* i++ if i >= len(data) || data[i] != ':' { @@ -599,7 +611,7 @@ func isReference(p *parser, data []byte, tabSize int) int { hasBlock bool ) - if p.flags&EXTENSION_FOOTNOTES != 0 && noteId != 0 { + if p.extensions&Footnotes != 0 && noteID != 0 { linkOffset, linkEnd, raw, hasBlock = scanFootnote(p, data, i, tabSize) lineEnd = linkEnd } else { @@ -612,11 +624,11 @@ func isReference(p *parser, data []byte, tabSize int) int { // a valid ref has been found ref := &reference{ - noteId: noteId, + noteID: noteID, hasBlock: hasBlock, } - if noteId > 0 { + if noteID > 0 { // reusing the link field for the id since footnotes don't have links ref.link = data[idOffset:idEnd] // if footnote, it's not really a title, it's the contained text @@ -634,15 +646,12 @@ func isReference(p *parser, data []byte, tabSize int) int { return lineEnd } -func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffset, titleEnd, lineEnd int) { +func scanLinkRef(p *Markdown, data []byte, i int) (linkOffset, linkEnd, titleOffset, titleEnd, lineEnd int) { // link: whitespace-free sequence, optionally between angle brackets if data[i] == '<' { i++ } linkOffset = i - if i == len(data) { - return - } for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' { i++ } @@ -705,13 +714,13 @@ func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffse return } -// The first bit of this logic is the same as (*parser).listItem, but the rest +// The first bit of this logic is the same as Parser.listItem, but the rest // is much simpler. This function simply finds the entire block and shifts it // over by one tab if it is indeed a block (just returns the line if it's not). // blockEnd is the end of the section in the input buffer, and contents is the // extracted text that was shifted over one tab. It will need to be rendered at // the end of the document. -func scanFootnote(p *parser, data []byte, i, indentSize int) (blockStart, blockEnd int, contents []byte, hasBlock bool) { +func scanFootnote(p *Markdown, data []byte, i, indentSize int) (blockStart, blockEnd int, contents []byte, hasBlock bool) { if i == 0 || len(data) == 0 { return } @@ -812,7 +821,7 @@ func ishorizontalspace(c byte) bool { return c == ' ' || c == '\t' } -// Test if a character is a vertical whitespace character. +// Test if a character is a vertical character. func isverticalspace(c byte) bool { return c == '\n' || c == '\r' || c == '\f' || c == '\v' } diff --git a/vendor/github.com/russross/blackfriday/v2/node.go b/vendor/github.com/russross/blackfriday/v2/node.go new file mode 100644 index 0000000000..51b9e8c1b5 --- /dev/null +++ b/vendor/github.com/russross/blackfriday/v2/node.go @@ -0,0 +1,354 @@ +package blackfriday + +import ( + "bytes" + "fmt" +) + +// NodeType specifies a type of a single node of a syntax tree. Usually one +// node (and its type) corresponds to a single markdown feature, e.g. emphasis +// or code block. +type NodeType int + +// Constants for identifying different types of nodes. See NodeType. +const ( + Document NodeType = iota + BlockQuote + List + Item + Paragraph + Heading + HorizontalRule + Emph + Strong + Del + Link + Image + Text + HTMLBlock + CodeBlock + Softbreak + Hardbreak + Code + HTMLSpan + Table + TableCell + TableHead + TableBody + TableRow +) + +var nodeTypeNames = []string{ + Document: "Document", + BlockQuote: "BlockQuote", + List: "List", + Item: "Item", + Paragraph: "Paragraph", + Heading: "Heading", + HorizontalRule: "HorizontalRule", + Emph: "Emph", + Strong: "Strong", + Del: "Del", + Link: "Link", + Image: "Image", + Text: "Text", + HTMLBlock: "HTMLBlock", + CodeBlock: "CodeBlock", + Softbreak: "Softbreak", + Hardbreak: "Hardbreak", + Code: "Code", + HTMLSpan: "HTMLSpan", + Table: "Table", + TableCell: "TableCell", + TableHead: "TableHead", + TableBody: "TableBody", + TableRow: "TableRow", +} + +func (t NodeType) String() string { + return nodeTypeNames[t] +} + +// ListData contains fields relevant to a List and Item node type. +type ListData struct { + ListFlags ListType + Tight bool // Skip

    s around list item data if true + BulletChar byte // '*', '+' or '-' in bullet lists + Delimiter byte // '.' or ')' after the number in ordered lists + RefLink []byte // If not nil, turns this list item into a footnote item and triggers different rendering + IsFootnotesList bool // This is a list of footnotes +} + +// LinkData contains fields relevant to a Link node type. +type LinkData struct { + Destination []byte // Destination is what goes into a href + Title []byte // Title is the tooltip thing that goes in a title attribute + NoteID int // NoteID contains a serial number of a footnote, zero if it's not a footnote + Footnote *Node // If it's a footnote, this is a direct link to the footnote Node. Otherwise nil. +} + +// CodeBlockData contains fields relevant to a CodeBlock node type. +type CodeBlockData struct { + IsFenced bool // Specifies whether it's a fenced code block or an indented one + Info []byte // This holds the info string + FenceChar byte + FenceLength int + FenceOffset int +} + +// TableCellData contains fields relevant to a TableCell node type. +type TableCellData struct { + IsHeader bool // This tells if it's under the header row + Align CellAlignFlags // This holds the value for align attribute +} + +// HeadingData contains fields relevant to a Heading node type. +type HeadingData struct { + Level int // This holds the heading level number + HeadingID string // This might hold heading ID, if present + IsTitleblock bool // Specifies whether it's a title block +} + +// Node is a single element in the abstract syntax tree of the parsed document. +// It holds connections to the structurally neighboring nodes and, for certain +// types of nodes, additional information that might be needed when rendering. +type Node struct { + Type NodeType // Determines the type of the node + Parent *Node // Points to the parent + FirstChild *Node // Points to the first child, if any + LastChild *Node // Points to the last child, if any + Prev *Node // Previous sibling; nil if it's the first child + Next *Node // Next sibling; nil if it's the last child + + Literal []byte // Text contents of the leaf nodes + + HeadingData // Populated if Type is Heading + ListData // Populated if Type is List + CodeBlockData // Populated if Type is CodeBlock + LinkData // Populated if Type is Link + TableCellData // Populated if Type is TableCell + + content []byte // Markdown content of the block nodes + open bool // Specifies an open block node that has not been finished to process yet +} + +// NewNode allocates a node of a specified type. +func NewNode(typ NodeType) *Node { + return &Node{ + Type: typ, + open: true, + } +} + +func (n *Node) String() string { + ellipsis := "" + snippet := n.Literal + if len(snippet) > 16 { + snippet = snippet[:16] + ellipsis = "..." + } + return fmt.Sprintf("%s: '%s%s'", n.Type, snippet, ellipsis) +} + +// Unlink removes node 'n' from the tree. +// It panics if the node is nil. +func (n *Node) Unlink() { + if n.Prev != nil { + n.Prev.Next = n.Next + } else if n.Parent != nil { + n.Parent.FirstChild = n.Next + } + if n.Next != nil { + n.Next.Prev = n.Prev + } else if n.Parent != nil { + n.Parent.LastChild = n.Prev + } + n.Parent = nil + n.Next = nil + n.Prev = nil +} + +// AppendChild adds a node 'child' as a child of 'n'. +// It panics if either node is nil. +func (n *Node) AppendChild(child *Node) { + child.Unlink() + child.Parent = n + if n.LastChild != nil { + n.LastChild.Next = child + child.Prev = n.LastChild + n.LastChild = child + } else { + n.FirstChild = child + n.LastChild = child + } +} + +// InsertBefore inserts 'sibling' immediately before 'n'. +// It panics if either node is nil. +func (n *Node) InsertBefore(sibling *Node) { + sibling.Unlink() + sibling.Prev = n.Prev + if sibling.Prev != nil { + sibling.Prev.Next = sibling + } + sibling.Next = n + n.Prev = sibling + sibling.Parent = n.Parent + if sibling.Prev == nil { + sibling.Parent.FirstChild = sibling + } +} + +func (n *Node) isContainer() bool { + switch n.Type { + case Document: + fallthrough + case BlockQuote: + fallthrough + case List: + fallthrough + case Item: + fallthrough + case Paragraph: + fallthrough + case Heading: + fallthrough + case Emph: + fallthrough + case Strong: + fallthrough + case Del: + fallthrough + case Link: + fallthrough + case Image: + fallthrough + case Table: + fallthrough + case TableHead: + fallthrough + case TableBody: + fallthrough + case TableRow: + fallthrough + case TableCell: + return true + default: + return false + } +} + +func (n *Node) canContain(t NodeType) bool { + if n.Type == List { + return t == Item + } + if n.Type == Document || n.Type == BlockQuote || n.Type == Item { + return t != Item + } + if n.Type == Table { + return t == TableHead || t == TableBody + } + if n.Type == TableHead || n.Type == TableBody { + return t == TableRow + } + if n.Type == TableRow { + return t == TableCell + } + return false +} + +// WalkStatus allows NodeVisitor to have some control over the tree traversal. +// It is returned from NodeVisitor and different values allow Node.Walk to +// decide which node to go to next. +type WalkStatus int + +const ( + // GoToNext is the default traversal of every node. + GoToNext WalkStatus = iota + // SkipChildren tells walker to skip all children of current node. + SkipChildren + // Terminate tells walker to terminate the traversal. + Terminate +) + +// NodeVisitor is a callback to be called when traversing the syntax tree. +// Called twice for every node: once with entering=true when the branch is +// first visited, then with entering=false after all the children are done. +type NodeVisitor func(node *Node, entering bool) WalkStatus + +// Walk is a convenience method that instantiates a walker and starts a +// traversal of subtree rooted at n. +func (n *Node) Walk(visitor NodeVisitor) { + w := newNodeWalker(n) + for w.current != nil { + status := visitor(w.current, w.entering) + switch status { + case GoToNext: + w.next() + case SkipChildren: + w.entering = false + w.next() + case Terminate: + return + } + } +} + +type nodeWalker struct { + current *Node + root *Node + entering bool +} + +func newNodeWalker(root *Node) *nodeWalker { + return &nodeWalker{ + current: root, + root: root, + entering: true, + } +} + +func (nw *nodeWalker) next() { + if (!nw.current.isContainer() || !nw.entering) && nw.current == nw.root { + nw.current = nil + return + } + if nw.entering && nw.current.isContainer() { + if nw.current.FirstChild != nil { + nw.current = nw.current.FirstChild + nw.entering = true + } else { + nw.entering = false + } + } else if nw.current.Next == nil { + nw.current = nw.current.Parent + nw.entering = false + } else { + nw.current = nw.current.Next + nw.entering = true + } +} + +func dump(ast *Node) { + fmt.Println(dumpString(ast)) +} + +func dumpR(ast *Node, depth int) string { + if ast == nil { + return "" + } + indent := bytes.Repeat([]byte("\t"), depth) + content := ast.Literal + if content == nil { + content = ast.content + } + result := fmt.Sprintf("%s%s(%q)\n", indent, ast.Type, content) + for n := ast.FirstChild; n != nil; n = n.Next { + result += dumpR(n, depth+1) + } + return result +} + +func dumpString(ast *Node) string { + return dumpR(ast, 0) +} diff --git a/vendor/github.com/russross/blackfriday/smartypants.go b/vendor/github.com/russross/blackfriday/v2/smartypants.go similarity index 66% rename from vendor/github.com/russross/blackfriday/smartypants.go rename to vendor/github.com/russross/blackfriday/v2/smartypants.go index f25bd07d95..3a220e9424 100644 --- a/vendor/github.com/russross/blackfriday/smartypants.go +++ b/vendor/github.com/russross/blackfriday/v2/smartypants.go @@ -17,11 +17,14 @@ package blackfriday import ( "bytes" + "io" ) -type smartypantsData struct { +// SPRenderer is a struct containing state of a Smartypants renderer. +type SPRenderer struct { inSingleQuote bool inDoubleQuote bool + callbacks [256]smartCallback } func wordBoundary(c byte) bool { @@ -118,7 +121,7 @@ func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote return true } -func smartSingleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartSingleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { if len(text) >= 2 { t1 := tolower(text[1]) @@ -127,7 +130,7 @@ func smartSingleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byt if len(text) >= 3 { nextChar = text[2] } - if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote, false) { + if smartQuoteHelper(out, previousChar, nextChar, 'd', &r.inDoubleQuote, false) { return 1 } } @@ -152,7 +155,7 @@ func smartSingleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byt if len(text) > 1 { nextChar = text[1] } - if smartQuoteHelper(out, previousChar, nextChar, 's', &smrt.inSingleQuote, false) { + if smartQuoteHelper(out, previousChar, nextChar, 's', &r.inSingleQuote, false) { return 0 } @@ -160,7 +163,7 @@ func smartSingleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byt return 0 } -func smartParens(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartParens(out *bytes.Buffer, previousChar byte, text []byte) int { if len(text) >= 3 { t1 := tolower(text[1]) t2 := tolower(text[2]) @@ -185,7 +188,7 @@ func smartParens(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, te return 0 } -func smartDash(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartDash(out *bytes.Buffer, previousChar byte, text []byte) int { if len(text) >= 2 { if text[1] == '-' { out.WriteString("—") @@ -202,7 +205,7 @@ func smartDash(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text return 0 } -func smartDashLatex(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartDashLatex(out *bytes.Buffer, previousChar byte, text []byte) int { if len(text) >= 3 && text[1] == '-' && text[2] == '-' { out.WriteString("—") return 2 @@ -216,13 +219,13 @@ func smartDashLatex(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, return 0 } -func smartAmpVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte, quote byte, addNBSP bool) int { +func (r *SPRenderer) smartAmpVariant(out *bytes.Buffer, previousChar byte, text []byte, quote byte, addNBSP bool) int { if bytes.HasPrefix(text, []byte(""")) { nextChar := byte(0) if len(text) >= 7 { nextChar = text[6] } - if smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote, addNBSP) { + if smartQuoteHelper(out, previousChar, nextChar, quote, &r.inDoubleQuote, addNBSP) { return 5 } } @@ -235,18 +238,18 @@ func smartAmpVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte return 0 } -func smartAmp(angledQuotes, addNBSP bool) func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartAmp(angledQuotes, addNBSP bool) func(*bytes.Buffer, byte, []byte) int { var quote byte = 'd' if angledQuotes { quote = 'a' } - return func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { - return smartAmpVariant(out, smrt, previousChar, text, quote, addNBSP) + return func(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartAmpVariant(out, previousChar, text, quote, addNBSP) } } -func smartPeriod(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartPeriod(out *bytes.Buffer, previousChar byte, text []byte) int { if len(text) >= 3 && text[1] == '.' && text[2] == '.' { out.WriteString("…") return 2 @@ -261,13 +264,13 @@ func smartPeriod(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, te return 0 } -func smartBacktick(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartBacktick(out *bytes.Buffer, previousChar byte, text []byte) int { if len(text) >= 2 && text[1] == '`' { nextChar := byte(0) if len(text) >= 3 { nextChar = text[2] } - if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote, false) { + if smartQuoteHelper(out, previousChar, nextChar, 'd', &r.inDoubleQuote, false) { return 1 } } @@ -276,7 +279,7 @@ func smartBacktick(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, return 0 } -func smartNumberGeneric(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartNumberGeneric(out *bytes.Buffer, previousChar byte, text []byte) int { if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 { // is it of the form digits/digits(word boundary)?, i.e., \d+/\d+\b // note: check for regular slash (/) or fraction slash (⁄, 0x2044, or 0xe2 81 84 in utf-8) @@ -318,7 +321,7 @@ func smartNumberGeneric(out *bytes.Buffer, smrt *smartypantsData, previousChar b return 0 } -func smartNumber(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartNumber(out *bytes.Buffer, previousChar byte, text []byte) int { if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 { if text[0] == '1' && text[1] == '/' && text[2] == '2' { if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' { @@ -346,27 +349,27 @@ func smartNumber(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, te return 0 } -func smartDoubleQuoteVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte, quote byte) int { +func (r *SPRenderer) smartDoubleQuoteVariant(out *bytes.Buffer, previousChar byte, text []byte, quote byte) int { nextChar := byte(0) if len(text) > 1 { nextChar = text[1] } - if !smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote, false) { + if !smartQuoteHelper(out, previousChar, nextChar, quote, &r.inDoubleQuote, false) { out.WriteString(""") } return 0 } -func smartDoubleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { - return smartDoubleQuoteVariant(out, smrt, previousChar, text, 'd') +func (r *SPRenderer) smartDoubleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartDoubleQuoteVariant(out, previousChar, text, 'd') } -func smartAngledDoubleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { - return smartDoubleQuoteVariant(out, smrt, previousChar, text, 'a') +func (r *SPRenderer) smartAngledDoubleQuote(out *bytes.Buffer, previousChar byte, text []byte) int { + return r.smartDoubleQuoteVariant(out, previousChar, text, 'a') } -func smartLeftAngle(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int { +func (r *SPRenderer) smartLeftAngle(out *bytes.Buffer, previousChar byte, text []byte) int { i := 0 for i < len(text) && text[i] != '>' { @@ -377,54 +380,78 @@ func smartLeftAngle(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, return i } -type smartCallback func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int +type smartCallback func(out *bytes.Buffer, previousChar byte, text []byte) int -type smartypantsRenderer [256]smartCallback +// NewSmartypantsRenderer constructs a Smartypants renderer object. +func NewSmartypantsRenderer(flags HTMLFlags) *SPRenderer { + var ( + r SPRenderer -var ( - smartAmpAngled = smartAmp(true, false) - smartAmpAngledNBSP = smartAmp(true, true) - smartAmpRegular = smartAmp(false, false) - smartAmpRegularNBSP = smartAmp(false, true) -) + smartAmpAngled = r.smartAmp(true, false) + smartAmpAngledNBSP = r.smartAmp(true, true) + smartAmpRegular = r.smartAmp(false, false) + smartAmpRegularNBSP = r.smartAmp(false, true) + + addNBSP = flags&SmartypantsQuotesNBSP != 0 + ) -func smartypants(flags int) *smartypantsRenderer { - r := new(smartypantsRenderer) - addNBSP := flags&HTML_SMARTYPANTS_QUOTES_NBSP != 0 - if flags&HTML_SMARTYPANTS_ANGLED_QUOTES == 0 { - r['"'] = smartDoubleQuote + if flags&SmartypantsAngledQuotes == 0 { + r.callbacks['"'] = r.smartDoubleQuote if !addNBSP { - r['&'] = smartAmpRegular + r.callbacks['&'] = smartAmpRegular } else { - r['&'] = smartAmpRegularNBSP + r.callbacks['&'] = smartAmpRegularNBSP } } else { - r['"'] = smartAngledDoubleQuote + r.callbacks['"'] = r.smartAngledDoubleQuote if !addNBSP { - r['&'] = smartAmpAngled + r.callbacks['&'] = smartAmpAngled } else { - r['&'] = smartAmpAngledNBSP + r.callbacks['&'] = smartAmpAngledNBSP } } - r['\''] = smartSingleQuote - r['('] = smartParens - if flags&HTML_SMARTYPANTS_DASHES != 0 { - if flags&HTML_SMARTYPANTS_LATEX_DASHES == 0 { - r['-'] = smartDash + r.callbacks['\''] = r.smartSingleQuote + r.callbacks['('] = r.smartParens + if flags&SmartypantsDashes != 0 { + if flags&SmartypantsLatexDashes == 0 { + r.callbacks['-'] = r.smartDash } else { - r['-'] = smartDashLatex + r.callbacks['-'] = r.smartDashLatex } } - r['.'] = smartPeriod - if flags&HTML_SMARTYPANTS_FRACTIONS == 0 { - r['1'] = smartNumber - r['3'] = smartNumber + r.callbacks['.'] = r.smartPeriod + if flags&SmartypantsFractions == 0 { + r.callbacks['1'] = r.smartNumber + r.callbacks['3'] = r.smartNumber } else { for ch := '1'; ch <= '9'; ch++ { - r[ch] = smartNumberGeneric + r.callbacks[ch] = r.smartNumberGeneric } } - r['<'] = smartLeftAngle - r['`'] = smartBacktick - return r + r.callbacks['<'] = r.smartLeftAngle + r.callbacks['`'] = r.smartBacktick + return &r +} + +// Process is the entry point of the Smartypants renderer. +func (r *SPRenderer) Process(w io.Writer, text []byte) { + mark := 0 + for i := 0; i < len(text); i++ { + if action := r.callbacks[text[i]]; action != nil { + if i > mark { + w.Write(text[mark:i]) + } + previousChar := byte(0) + if i > 0 { + previousChar = text[i-1] + } + var tmp bytes.Buffer + i += action(&tmp, previousChar, text[i:]) + w.Write(tmp.Bytes()) + mark = i + 1 + } + } + if mark < len(text) { + w.Write(text[mark:]) + } } diff --git a/vendor/github.com/shurcooL/sanitized_anchor_name/.travis.yml b/vendor/github.com/shurcooL/sanitized_anchor_name/.travis.yml new file mode 100644 index 0000000000..93b1fcdb31 --- /dev/null +++ b/vendor/github.com/shurcooL/sanitized_anchor_name/.travis.yml @@ -0,0 +1,16 @@ +sudo: false +language: go +go: + - 1.x + - master +matrix: + allow_failures: + - go: master + fast_finish: true +install: + - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). +script: + - go get -t -v ./... + - diff -u <(echo -n) <(gofmt -d -s .) + - go tool vet . + - go test -v -race ./... diff --git a/vendor/github.com/shurcooL/sanitized_anchor_name/LICENSE b/vendor/github.com/shurcooL/sanitized_anchor_name/LICENSE new file mode 100644 index 0000000000..c35c17af98 --- /dev/null +++ b/vendor/github.com/shurcooL/sanitized_anchor_name/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2015 Dmitri Shuralyov + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/shurcooL/sanitized_anchor_name/README.md b/vendor/github.com/shurcooL/sanitized_anchor_name/README.md new file mode 100644 index 0000000000..670bf0fe6c --- /dev/null +++ b/vendor/github.com/shurcooL/sanitized_anchor_name/README.md @@ -0,0 +1,36 @@ +sanitized_anchor_name +===================== + +[![Build Status](https://travis-ci.org/shurcooL/sanitized_anchor_name.svg?branch=master)](https://travis-ci.org/shurcooL/sanitized_anchor_name) [![GoDoc](https://godoc.org/github.com/shurcooL/sanitized_anchor_name?status.svg)](https://godoc.org/github.com/shurcooL/sanitized_anchor_name) + +Package sanitized_anchor_name provides a func to create sanitized anchor names. + +Its logic can be reused by multiple packages to create interoperable anchor names +and links to those anchors. + +At this time, it does not try to ensure that generated anchor names +are unique, that responsibility falls on the caller. + +Installation +------------ + +```bash +go get -u github.com/shurcooL/sanitized_anchor_name +``` + +Example +------- + +```Go +anchorName := sanitized_anchor_name.Create("This is a header") + +fmt.Println(anchorName) + +// Output: +// this-is-a-header +``` + +License +------- + +- [MIT License](LICENSE) diff --git a/vendor/github.com/shurcooL/sanitized_anchor_name/go.mod b/vendor/github.com/shurcooL/sanitized_anchor_name/go.mod new file mode 100644 index 0000000000..1e25534759 --- /dev/null +++ b/vendor/github.com/shurcooL/sanitized_anchor_name/go.mod @@ -0,0 +1 @@ +module github.com/shurcooL/sanitized_anchor_name diff --git a/vendor/github.com/shurcooL/sanitized_anchor_name/main.go b/vendor/github.com/shurcooL/sanitized_anchor_name/main.go new file mode 100644 index 0000000000..6a77d12431 --- /dev/null +++ b/vendor/github.com/shurcooL/sanitized_anchor_name/main.go @@ -0,0 +1,29 @@ +// Package sanitized_anchor_name provides a func to create sanitized anchor names. +// +// Its logic can be reused by multiple packages to create interoperable anchor names +// and links to those anchors. +// +// At this time, it does not try to ensure that generated anchor names +// are unique, that responsibility falls on the caller. +package sanitized_anchor_name // import "github.com/shurcooL/sanitized_anchor_name" + +import "unicode" + +// Create returns a sanitized anchor name for the given text. +func Create(text string) string { + var anchorName []rune + var futureDash = false + for _, r := range text { + switch { + case unicode.IsLetter(r) || unicode.IsNumber(r): + if futureDash && len(anchorName) > 0 { + anchorName = append(anchorName, '-') + } + futureDash = false + anchorName = append(anchorName, unicode.ToLower(r)) + default: + futureDash = true + } + } + return string(anchorName) +} diff --git a/vendor/github.com/spf13/cobra/.gitignore b/vendor/github.com/spf13/cobra/.gitignore index 1b8c7c2611..c7b459e4dd 100644 --- a/vendor/github.com/spf13/cobra/.gitignore +++ b/vendor/github.com/spf13/cobra/.gitignore @@ -32,5 +32,8 @@ Session.vim tags *.exe - cobra.test +bin + +.idea/ +*.iml diff --git a/vendor/github.com/spf13/cobra/.golangci.yml b/vendor/github.com/spf13/cobra/.golangci.yml new file mode 100644 index 0000000000..0d6e61793a --- /dev/null +++ b/vendor/github.com/spf13/cobra/.golangci.yml @@ -0,0 +1,48 @@ +run: + deadline: 5m + +linters: + disable-all: true + enable: + #- bodyclose + - deadcode + #- depguard + #- dogsled + #- dupl + - errcheck + #- exhaustive + #- funlen + - gas + #- gochecknoinits + - goconst + #- gocritic + #- gocyclo + #- gofmt + - goimports + - golint + #- gomnd + #- goprintffuncname + #- gosec + #- gosimple + - govet + - ineffassign + - interfacer + #- lll + - maligned + - megacheck + #- misspell + #- nakedret + #- noctx + #- nolintlint + #- rowserrcheck + #- scopelint + #- staticcheck + - structcheck + #- stylecheck + #- typecheck + - unconvert + #- unparam + #- unused + - varcheck + #- whitespace + fast: false diff --git a/vendor/github.com/spf13/cobra/.travis.yml b/vendor/github.com/spf13/cobra/.travis.yml index 42d1f57d30..e0a3b50043 100644 --- a/vendor/github.com/spf13/cobra/.travis.yml +++ b/vendor/github.com/spf13/cobra/.travis.yml @@ -1,25 +1,28 @@ language: go +stages: + - test + - build + +go: + - 1.12.x + - 1.13.x + - tip + +env: GO111MODULE=on + +before_install: + - go get -u github.com/kyoh86/richgo + - go get -u github.com/mitchellh/gox + - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin latest + matrix: - include: - - go: 1.4.3 - env: NOVET=true # No bundled vet. - - go: 1.5.4 - - go: 1.6.4 - - go: 1.7.5 - - go: 1.8 - - go: tip allow_failures: - go: tip + include: + - stage: build + go: 1.13.x + script: make cobra_generator -before_install: - - mkdir -p bin - - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.4.3/shellcheck - - chmod +x bin/shellcheck script: - - PATH=$PATH:$PWD/bin go test -v ./... - - go build - - diff -u <(echo -n) <(gofmt -d -s .) - - if [ -z $NOVET ]; then - diff -u <(echo -n) <(go tool vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint'); - fi + - make test diff --git a/vendor/github.com/spf13/cobra/CHANGELOG.md b/vendor/github.com/spf13/cobra/CHANGELOG.md new file mode 100644 index 0000000000..8a23b4f851 --- /dev/null +++ b/vendor/github.com/spf13/cobra/CHANGELOG.md @@ -0,0 +1,51 @@ +# Cobra Changelog + +## v1.1.3 + +* **Fix:** release-branch.cobra1.1 only: Revert "Deprecate Go < 1.14" to maintain backward compatibility + +## v1.1.2 + +### Notable Changes + +* Bump license year to 2021 in golden files (#1309) @Bowbaq +* Enhance PowerShell completion with custom comp (#1208) @Luap99 +* Update gopkg.in/yaml.v2 to v2.4.0: The previous breaking change in yaml.v2 v2.3.0 has been reverted, see go-yaml/yaml#670 +* Documentation readability improvements (#1228 etc.) @zaataylor etc. +* Use golangci-lint: Repair warnings and errors resulting from linting (#1044) @umarcor + +## v1.1.1 + +* **Fix:** yaml.v2 2.3.0 contained a unintended breaking change. This release reverts to yaml.v2 v2.2.8 which has recent critical CVE fixes, but does not have the breaking changes. See https://github.com/spf13/cobra/pull/1259 for context. +* **Fix:** correct internal formatting for go-md2man v2 (which caused man page generation to be broken). See https://github.com/spf13/cobra/issues/1049 for context. + +## v1.1.0 + +### Notable Changes + +* Extend Go completions and revamp zsh comp (#1070) +* Fix man page doc generation - no auto generated tag when `cmd.DisableAutoGenTag = true` (#1104) @jpmcb +* Add completion for help command (#1136) +* Complete subcommands when TraverseChildren is set (#1171) +* Fix stderr printing functions (#894) +* fix: fish output redirection (#1247) + +## v1.0.0 + +Announcing v1.0.0 of Cobra. 🎉 + +### Notable Changes +* Fish completion (including support for Go custom completion) @marckhouzam +* API (urgent): Rename BashCompDirectives to ShellCompDirectives @marckhouzam +* Remove/replace SetOutput on Command - deprecated @jpmcb +* add support for autolabel stale PR @xchapter7x +* Add Labeler Actions @xchapter7x +* Custom completions coded in Go (instead of Bash) @marckhouzam +* Partial Revert of #922 @jharshman +* Add Makefile to project @jharshman +* Correct documentation for InOrStdin @desponda +* Apply formatting to templates @jharshman +* Revert change so help is printed on stdout again @marckhouzam +* Update md2man to v2.0.0 @pdf +* update viper to v1.4.0 @umarcor +* Update cmd/root.go example in README.md @jharshman diff --git a/vendor/github.com/spf13/cobra/CONDUCT.md b/vendor/github.com/spf13/cobra/CONDUCT.md new file mode 100644 index 0000000000..9d16f88fd1 --- /dev/null +++ b/vendor/github.com/spf13/cobra/CONDUCT.md @@ -0,0 +1,37 @@ +## Cobra User Contract + +### Versioning +Cobra will follow a steady release cadence. Non breaking changes will be released as minor versions quarterly. Patch bug releases are at the discretion of the maintainers. Users can expect security patch fixes to be released within relatively short order of a CVE becoming known. For more information on security patch fixes see the CVE section below. Releases will follow [Semantic Versioning](https://semver.org/). Users tracking the Master branch should expect unpredictable breaking changes as the project continues to move forward. For stability, it is highly recommended to use a release. + +### Backward Compatibility +We will maintain two major releases in a moving window. The N-1 release will only receive bug fixes and security updates and will be dropped once N+1 is released. + +### Deprecation +Deprecation of Go versions or dependent packages will only occur in major releases. To reduce the change of this taking users by surprise, any large deprecation will be preceded by an announcement in the [#cobra slack channel](https://gophers.slack.com/archives/CD3LP1199) and an Issue on Github. + +### CVE +Maintainers will make every effort to release security patches in the case of a medium to high severity CVE directly impacting the library. The speed in which these patches reach a release is up to the discretion of the maintainers. A low severity CVE may be a lower priority than a high severity one. + +### Communication +Cobra maintainers will use GitHub issues and the [#cobra slack channel](https://gophers.slack.com/archives/CD3LP1199) as the primary means of communication with the community. This is to foster open communication with all users and contributors. + +### Breaking Changes +Breaking changes are generally allowed in the master branch, as this is the branch used to develop the next release of Cobra. + +There may be times, however, when master is closed for breaking changes. This is likely to happen as we near the release of a new version. + +Breaking changes are not allowed in release branches, as these represent minor versions that have already been released. These version have consumers who expect the APIs, behaviors, etc, to remain stable during the lifetime of the patch stream for the minor release. + +Examples of breaking changes include: +- Removing or renaming exported constant, variable, type, or function. +- Updating the version of critical libraries such as `spf13/pflag`, `spf13/viper` etc... + - Some version updates may be acceptable for picking up bug fixes, but maintainers must exercise caution when reviewing. + +There may, at times, need to be exceptions where breaking changes are allowed in release branches. These are at the discretion of the project's maintainers, and must be carefully considered before merging. + +### CI Testing +Maintainers will ensure the Cobra test suite utilizes the current supported versions of Golang. + +### Disclaimer +Changes to this document and the contents therein are at the discretion of the maintainers. +None of the contents of this document are legally binding in any way to the maintainers or the users. diff --git a/vendor/github.com/spf13/cobra/CONTRIBUTING.md b/vendor/github.com/spf13/cobra/CONTRIBUTING.md new file mode 100644 index 0000000000..6f356e6a82 --- /dev/null +++ b/vendor/github.com/spf13/cobra/CONTRIBUTING.md @@ -0,0 +1,50 @@ +# Contributing to Cobra + +Thank you so much for contributing to Cobra. We appreciate your time and help. +Here are some guidelines to help you get started. + +## Code of Conduct + +Be kind and respectful to the members of the community. Take time to educate +others who are seeking help. Harassment of any kind will not be tolerated. + +## Questions + +If you have questions regarding Cobra, feel free to ask it in the community +[#cobra Slack channel][cobra-slack] + +## Filing a bug or feature + +1. Before filing an issue, please check the existing issues to see if a + similar one was already opened. If there is one already opened, feel free + to comment on it. +1. If you believe you've found a bug, please provide detailed steps of + reproduction, the version of Cobra and anything else you believe will be + useful to help troubleshoot it (e.g. OS environment, environment variables, + etc...). Also state the current behavior vs. the expected behavior. +1. If you'd like to see a feature or an enhancement please open an issue with + a clear title and description of what the feature is and why it would be + beneficial to the project and its users. + +## Submitting changes + +1. CLA: Upon submitting a Pull Request (PR), contributors will be prompted to + sign a CLA. Please sign the CLA :slightly_smiling_face: +1. Tests: If you are submitting code, please ensure you have adequate tests + for the feature. Tests can be run via `go test ./...` or `make test`. +1. Since this is golang project, ensure the new code is properly formatted to + ensure code consistency. Run `make all`. + +### Quick steps to contribute + +1. Fork the project. +1. Download your fork to your PC (`git clone https://github.com/your_username/cobra && cd cobra`) +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Make changes and run tests (`make test`) +1. Add them to staging (`git add .`) +1. Commit your changes (`git commit -m 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new pull request + + +[cobra-slack]: https://gophers.slack.com/archives/CD3LP1199 diff --git a/vendor/github.com/spf13/cobra/Makefile b/vendor/github.com/spf13/cobra/Makefile new file mode 100644 index 0000000000..472c73bf16 --- /dev/null +++ b/vendor/github.com/spf13/cobra/Makefile @@ -0,0 +1,40 @@ +BIN="./bin" +SRC=$(shell find . -name "*.go") + +ifeq (, $(shell which golangci-lint)) +$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh") +endif + +ifeq (, $(shell which richgo)) +$(warning "could not find richgo in $(PATH), run: go get github.com/kyoh86/richgo") +endif + +.PHONY: fmt lint test cobra_generator install_deps clean + +default: all + +all: fmt test cobra_generator + +fmt: + $(info ******************** checking formatting ********************) + @test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1) + +lint: + $(info ******************** running lint tools ********************) + golangci-lint run -v + +test: install_deps lint + $(info ******************** running tests ********************) + richgo test -v ./... + +cobra_generator: install_deps + $(info ******************** building generator ********************) + mkdir -p $(BIN) + make -C cobra all + +install_deps: + $(info ******************** downloading dependencies ********************) + go get -v ./... + +clean: + rm -rf $(BIN) diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md index 0d5bbfb1f9..a1b13ddda6 100644 --- a/vendor/github.com/spf13/cobra/README.md +++ b/vendor/github.com/spf13/cobra/README.md @@ -2,30 +2,37 @@ Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files. -Many of the most widely used Go projects are built using Cobra including: - -* [Kubernetes](http://kubernetes.io/) -* [Hugo](http://gohugo.io) -* [rkt](https://github.com/coreos/rkt) -* [etcd](https://github.com/coreos/etcd) -* [Docker](https://github.com/docker/docker) -* [Docker (distribution)](https://github.com/docker/distribution) -* [OpenShift](https://www.openshift.com/) -* [Delve](https://github.com/derekparker/delve) -* [GopherJS](http://www.gopherjs.org/) -* [CockroachDB](http://www.cockroachlabs.com/) -* [Bleve](http://www.blevesearch.com/) -* [ProjectAtomic (enterprise)](http://www.projectatomic.io/) -* [Parse (CLI)](https://parse.com/) -* [GiantSwarm's swarm](https://github.com/giantswarm/cli) -* [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack) - +Cobra is used in many Go projects such as [Kubernetes](http://kubernetes.io/), +[Hugo](https://gohugo.io), and [Github CLI](https://github.com/cli/cli) to +name a few. [This list](./projects_using_cobra.md) contains a more extensive list of projects using Cobra. +[![](https://img.shields.io/github/workflow/status/spf13/cobra/Test?longCache=tru&label=Test&logo=github%20actions&logoColor=fff)](https://github.com/spf13/cobra/actions?query=workflow%3ATest) [![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra) -[![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra) -[![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra) - -![cobra](https://cloud.githubusercontent.com/assets/173412/10911369/84832a8e-8212-11e5-9f82-cc96660a4794.gif) +[![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra) +[![Go Report Card](https://goreportcard.com/badge/github.com/spf13/cobra)](https://goreportcard.com/report/github.com/spf13/cobra) +[![Slack](https://img.shields.io/badge/Slack-cobra-brightgreen)](https://gophers.slack.com/archives/CD3LP1199) + +# Table of Contents + +- [Overview](#overview) +- [Concepts](#concepts) + * [Commands](#commands) + * [Flags](#flags) +- [Installing](#installing) +- [Getting Started](#getting-started) + * [Using the Cobra Generator](#using-the-cobra-generator) + * [Using the Cobra Library](#using-the-cobra-library) + * [Working with Flags](#working-with-flags) + * [Positional and Custom Arguments](#positional-and-custom-arguments) + * [Example](#example) + * [Help Command](#help-command) + * [Usage Message](#usage-message) + * [PreRun and PostRun Hooks](#prerun-and-postrun-hooks) + * [Suggestions when "unknown command" happens](#suggestions-when-unknown-command-happens) + * [Generating documentation for your command](#generating-documentation-for-your-command) + * [Generating shell completions](#generating-shell-completions) +- [Contributing](CONTRIBUTING.md) +- [License](#license) # Overview @@ -40,35 +47,24 @@ Cobra provides: * Fully POSIX-compliant flags (including short & long versions) * Nested subcommands * Global, local and cascading flags -* Easy generation of applications & commands with `cobra create appname` & `cobra add cmdname` +* Easy generation of applications & commands with `cobra init appname` & `cobra add cmdname` * Intelligent suggestions (`app srver`... did you mean `app server`?) * Automatic help generation for commands and flags -* Automatic detailed help for `app help [command]` * Automatic help flag recognition of `-h`, `--help`, etc. -* Automatically generated bash autocomplete for your application +* Automatically generated shell autocomplete for your application (bash, zsh, fish, powershell) * Automatically generated man pages for your application * Command aliases so you can change things without breaking them -* The flexibilty to define your own help, usage, etc. +* The flexibility to define your own help, usage, etc. * Optional tight integration with [viper](http://github.com/spf13/viper) for 12-factor apps -Cobra has an exceptionally clean interface and simple design without needless -constructors or initialization methods. - -Applications built with Cobra commands are designed to be as user-friendly as -possible. Flags can be placed before or after the command (as long as a -confusing space isn’t provided). Both short and long flags can be used. A -command need not even be fully typed. Help is automatically generated and -available for the application or for a specific command using either the help -command or the `--help` flag. - # Concepts Cobra is built on a structure of commands, arguments & flags. **Commands** represent actions, **Args** are things and **Flags** are modifiers for those actions. -The best applications will read like sentences when used. Users will know how -to use the application because they will natively understand how to use it. +The best applications read like sentences when used, and as a result, users +intuitively know how to interact with them. The pattern to follow is `APPNAME VERB NOUN --ADJECTIVE.` @@ -79,11 +75,11 @@ A few good real world examples may better illustrate this point. In the following example, 'server' is a command, and 'port' is a flag: - > hugo server --port=1313 + hugo server --port=1313 In this command we are telling Git to clone the url bare. - > git clone URL --bare + git clone URL --bare ## Commands @@ -93,20 +89,11 @@ have children commands and optionally run an action. In the example above, 'server' is the command. -A Command has the following structure: - -```go -type Command struct { - Use string // The one-line usage message. - Short string // The short description shown in the 'help' output. - Long string // The long message shown in the 'help ' output. - Run func(cmd *Command, args []string) // Run runs the command. -} -``` +[More about cobra.Command](https://godoc.org/github.com/spf13/cobra#Command) ## Flags -A Flag is a way to modify the behavior of a command. Cobra supports +A flag is a way to modify the behavior of a command. Cobra supports fully POSIX-compliant flags as well as the Go [flag package](https://golang.org/pkg/flag/). A Cobra command can define flags that persist through to children commands and flags that are only available to that command. @@ -114,23 +101,15 @@ and flags that are only available to that command. In the example above, 'port' is the flag. Flag functionality is provided by the [pflag -library](https://github.com/ogier/pflag), a fork of the flag standard library +library](https://github.com/spf13/pflag), a fork of the flag standard library which maintains the same interface while adding POSIX compliance. -## Usage - -Cobra works by creating a set of commands and then organizing them into a tree. -The tree defines the structure of the application. - -Once each command is defined with its corresponding flags, then the -tree is assigned to the commander which is finally executed. - # Installing Using Cobra is easy. First, use `go get` to install the latest version -of the library. This command will install the `cobra` generator executible -along with the library: +of the library. This command will install the `cobra` generator executable +along with the library and its dependencies: - > go get -v github.com/spf13/cobra/cobra + go get -u github.com/spf13/cobra Next, include Cobra in your application: @@ -140,8 +119,8 @@ import "github.com/spf13/cobra" # Getting Started -While you are welcome to provide your own organization, typically a Cobra based -application will follow the following organizational structure. +While you are welcome to provide your own organization, typically a Cobra-based +application will follow the following organizational structure: ``` ▾ appName/ @@ -153,23 +132,17 @@ application will follow the following organizational structure. main.go ``` -In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra. +In a Cobra app, typically the main.go file is very bare. It serves one purpose: initializing Cobra. ```go package main import ( - "fmt" - "os" - - "{pathToYourApp}/cmd" + "{pathToYourApp}/cmd" ) func main() { - if err := cmd.RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } + cmd.Execute() } ``` @@ -178,134 +151,109 @@ func main() { Cobra provides its own program that will create your application and add any commands you want. It's the easiest way to incorporate Cobra into your application. -In order to use the cobra command, compile it using the following command: - - > go install github.com/spf13/cobra/cobra - -This will create the cobra executable under your go path bin directory! - -### cobra init - -The `cobra init [yourApp]` command will create your initial application code -for you. It is a very powerful application that will populate your program with -the right structure so you can immediately enjoy all the benefits of Cobra. It -will also automatically apply the license you specify to your application. - -Cobra init is pretty smart. You can provide it a full path, or simply a path -similar to what is expected in the import. - -``` -cobra init github.com/spf13/newAppName -``` - -### cobra add - -Once an application is initialized Cobra can create additional commands for you. -Let's say you created an app and you wanted the following commands for it: +[Here](https://github.com/spf13/cobra/blob/master/cobra/README.md) you can find more information about it. -* app serve -* app config -* app config create +## Using the Cobra Library -In your project directory (where your main.go file is) you would run the following: - -``` -cobra add serve -cobra add config -cobra add create -p 'configCmd' -``` - -Once you have run these three commands you would have an app structure that would look like: - -``` - ▾ app/ - ▾ cmd/ - serve.go - config.go - create.go - main.go -``` - -at this point you can run `go run main.go` and it would run your app. `go run -main.go serve`, `go run main.go config`, `go run main.go config create` along -with `go run main.go help serve`, etc would all work. - -Obviously you haven't added your own code to these yet, the commands are ready -for you to give them their tasks. Have fun. - -### Configuring the cobra generator - -The cobra generator will be easier to use if you provide a simple configuration -file which will help you eliminate providing a bunch of repeated information in -flags over and over. - -An example ~/.cobra.yaml file: - -```yaml -author: Steve Francia -license: MIT -``` - -You can specify no license by setting `license` to `none` or you can specify -a custom license: - -```yaml -license: - header: This file is part of {{ .appName }}. - text: | - {{ .copyright }} - - This is my license. There are many like it, but this one is mine. - My license is my best friend. It is my life. I must master it as I must - master my life. -``` - -## Manually implementing Cobra - -To manually implement cobra you need to create a bare main.go file and a RootCmd file. +To manually implement Cobra you need to create a bare main.go file and a rootCmd file. You will optionally provide additional commands as you see fit. -### Create the root command - -The root command represents your binary itself. - - -#### Manually create rootCmd +### Create rootCmd Cobra doesn't require any special constructors. Simply create your commands. Ideally you place this in app/cmd/root.go: ```go -var RootCmd = &cobra.Command{ - Use: "hugo", - Short: "Hugo is a very fast static site generator", - Long: `A Fast and Flexible Static Site Generator built with +var rootCmd = &cobra.Command{ + Use: "hugo", + Short: "Hugo is a very fast static site generator", + Long: `A Fast and Flexible Static Site Generator built with love by spf13 and friends in Go. Complete documentation is available at http://hugo.spf13.com`, - Run: func(cmd *cobra.Command, args []string) { - // Do Stuff Here - }, + Run: func(cmd *cobra.Command, args []string) { + // Do Stuff Here + }, +} + +func Execute() { + if err := rootCmd.Execute(); err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) + } } ``` You will additionally define flags and handle configuration in your init() function. -for example cmd/root.go: +For example cmd/root.go: ```go +package cmd + +import ( + "fmt" + "os" + + homedir "github.com/mitchellh/go-homedir" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +var ( + // Used for flags. + cfgFile string + userLicense string + + rootCmd = &cobra.Command{ + Use: "cobra", + Short: "A generator for Cobra based Applications", + Long: `Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + } +) + +// Execute executes the root command. +func Execute() error { + return rootCmd.Execute() +} + func init() { cobra.OnInitialize(initConfig) - RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") - RootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory eg. github.com/spf13/") - RootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution") - RootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `licensetext` in config)") - RootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration") - viper.BindPFlag("author", RootCmd.PersistentFlags().Lookup("author")) - viper.BindPFlag("projectbase", RootCmd.PersistentFlags().Lookup("projectbase")) - viper.BindPFlag("useViper", RootCmd.PersistentFlags().Lookup("viper")) + + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)") + rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "author name for copyright attribution") + rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "name of license for the project") + rootCmd.PersistentFlags().Bool("viper", true, "use Viper for configuration") + viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) + viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper")) viper.SetDefault("author", "NAME HERE ") viper.SetDefault("license", "apache") + + rootCmd.AddCommand(addCmd) + rootCmd.AddCommand(initCmd) +} + +func initConfig() { + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + // Find home directory. + home, err := homedir.Dir() + cobra.CheckErr(err) + + // Search config in home directory with name ".cobra" (without extension). + viper.AddConfigPath(home) + viper.SetConfigName(".cobra") + } + + viper.AutomaticEnv() + + if err := viper.ReadInConfig(); err == nil { + fmt.Println("Using config file:", viper.ConfigFileUsed()) + } } ``` @@ -314,27 +262,20 @@ func init() { With the root command you need to have your main function execute it. Execute should be run on the root for clarity, though it can be called on any command. -In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra. +In a Cobra app, typically the main.go file is very bare. It serves one purpose: to initialize Cobra. ```go package main import ( - "fmt" - "os" - - "{pathToYourApp}/cmd" + "{pathToYourApp}/cmd" ) func main() { - if err := cmd.RootCmd.Execute(); err != nil { - fmt.Println(err) - os.Exit(1) - } + cmd.Execute() } ``` - ### Create additional commands Additional commands can be defined and typically are each given their own file @@ -347,48 +288,56 @@ populate it with the following: package cmd import ( - "github.com/spf13/cobra" - "fmt" + "fmt" + + "github.com/spf13/cobra" ) func init() { - RootCmd.AddCommand(versionCmd) + rootCmd.AddCommand(versionCmd) } var versionCmd = &cobra.Command{ - Use: "version", - Short: "Print the version number of Hugo", - Long: `All software has versions. This is Hugo's`, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Hugo Static Site Generator v0.9 -- HEAD") - }, + Use: "version", + Short: "Print the version number of Hugo", + Long: `All software has versions. This is Hugo's`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Hugo Static Site Generator v0.9 -- HEAD") + }, } ``` -### Attach command to its parent +### Returning and handling errors - -If you notice in the above example we attach the command to its parent. In -this case the parent is the rootCmd. In this example we are attaching it to the -root, but commands can be attached at any level. +If you wish to return an error to the caller of a command, `RunE` can be used. ```go -RootCmd.AddCommand(versionCmd) -``` +package cmd -### Remove a command from its parent +import ( + "fmt" -Removing a command is not a common action in simple programs, but it allows 3rd -parties to customize an existing command tree. + "github.com/spf13/cobra" +) -In this example, we remove the existing `VersionCmd` command of an existing -root command, and we replace it with our own version: +func init() { + rootCmd.AddCommand(tryCmd) +} -```go -mainlib.RootCmd.RemoveCommand(mainlib.VersionCmd) -mainlib.RootCmd.AddCommand(versionCmd) +var tryCmd = &cobra.Command{ + Use: "try", + Short: "Try and possibly fail at something", + RunE: func(cmd *cobra.Command, args []string) error { + if err := someFunc(); err != nil { + return err + } + return nil + }, +} ``` +The error can then be caught at the execute function call. + ## Working with Flags Flags provide modifiers to control how the action command operates. @@ -408,28 +357,109 @@ There are two different approaches to assign a flag. ### Persistent Flags -A flag can be 'persistent' meaning that this flag will be available to the +A flag can be 'persistent', meaning that this flag will be available to the command it's assigned to as well as every command under that command. For global flags, assign a flag as a persistent flag on the root. ```go -RootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output") +rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output") ``` ### Local Flags -A flag can also be assigned locally which will only apply to that specific command. +A flag can also be assigned locally, which will only apply to that specific command. ```go -RootCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from") +localCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from") ``` +### Local Flag on Parent Commands + +By default, Cobra only parses local flags on the target command, and any local flags on +parent commands are ignored. By enabling `Command.TraverseChildren`, Cobra will +parse local flags on each command before executing the target command. + +```go +command := cobra.Command{ + Use: "print [OPTIONS] [COMMANDS]", + TraverseChildren: true, +} +``` + +### Bind Flags with Config + +You can also bind your flags with [viper](https://github.com/spf13/viper): +```go +var author string + +func init() { + rootCmd.PersistentFlags().StringVar(&author, "author", "YOUR NAME", "Author name for copyright attribution") + viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author")) +} +``` + +In this example, the persistent flag `author` is bound with `viper`. +**Note**: the variable `author` will not be set to the value from config, +when the `--author` flag is not provided by user. + +More in [viper documentation](https://github.com/spf13/viper#working-with-flags). + +### Required flags + +Flags are optional by default. If instead you wish your command to report an error +when a flag has not been set, mark it as required: +```go +rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)") +rootCmd.MarkFlagRequired("region") +``` + +Or, for persistent flags: +```go +rootCmd.PersistentFlags().StringVarP(&Region, "region", "r", "", "AWS region (required)") +rootCmd.MarkPersistentFlagRequired("region") +``` + +## Positional and Custom Arguments + +Validation of positional arguments can be specified using the `Args` field +of `Command`. + +The following validators are built in: + +- `NoArgs` - the command will report an error if there are any positional args. +- `ArbitraryArgs` - the command will accept any args. +- `OnlyValidArgs` - the command will report an error if there are any positional args that are not in the `ValidArgs` field of `Command`. +- `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args. +- `MaximumNArgs(int)` - the command will report an error if there are more than N positional args. +- `ExactArgs(int)` - the command will report an error if there are not exactly N positional args. +- `ExactValidArgs(int)` - the command will report an error if there are not exactly N positional args OR if there are any positional args that are not in the `ValidArgs` field of `Command` +- `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args. + +An example of setting the custom validator: + +```go +var cmd = &cobra.Command{ + Short: "hello", + Args: func(cmd *cobra.Command, args []string) error { + if len(args) < 1 { + return errors.New("requires a color argument") + } + if myapp.IsValidColor(args[0]) { + return nil + } + return fmt.Errorf("invalid color specified: %s", args[0]) + }, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Hello, World!") + }, +} +``` ## Example In the example below, we have defined three commands. Two are at the top level and one (cmdTimes) is a child of one of the top commands. In this case the root -is not executable meaning that a subcommand is required. This is accomplished +is not executable, meaning that a subcommand is required. This is accomplished by not providing a 'Run' for the 'rootCmd'. We have only defined one flag for a single command. @@ -440,62 +470,62 @@ More documentation about flags is available at https://github.com/spf13/pflag package main import ( - "fmt" - "strings" + "fmt" + "strings" - "github.com/spf13/cobra" + "github.com/spf13/cobra" ) func main() { - - var echoTimes int - - var cmdPrint = &cobra.Command{ - Use: "print [string to print]", - Short: "Print anything to the screen", - Long: `print is for printing anything back to the screen. - For many years people have printed back to the screen. - `, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Print: " + strings.Join(args, " ")) - }, - } - - var cmdEcho = &cobra.Command{ - Use: "echo [string to echo]", - Short: "Echo anything to the screen", - Long: `echo is for echoing anything back. - Echo works a lot like print, except it has a child command. - `, - Run: func(cmd *cobra.Command, args []string) { - fmt.Println("Print: " + strings.Join(args, " ")) - }, - } - - var cmdTimes = &cobra.Command{ - Use: "times [# times] [string to echo]", - Short: "Echo anything to the screen more times", - Long: `echo things multiple times back to the user by providing - a count and a string.`, - Run: func(cmd *cobra.Command, args []string) { - for i := 0; i < echoTimes; i++ { - fmt.Println("Echo: " + strings.Join(args, " ")) - } - }, - } - - cmdTimes.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input") - - var rootCmd = &cobra.Command{Use: "app"} - rootCmd.AddCommand(cmdPrint, cmdEcho) - cmdEcho.AddCommand(cmdTimes) - rootCmd.Execute() + var echoTimes int + + var cmdPrint = &cobra.Command{ + Use: "print [string to print]", + Short: "Print anything to the screen", + Long: `print is for printing anything back to the screen. +For many years people have printed back to the screen.`, + Args: cobra.MinimumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Print: " + strings.Join(args, " ")) + }, + } + + var cmdEcho = &cobra.Command{ + Use: "echo [string to echo]", + Short: "Echo anything to the screen", + Long: `echo is for echoing anything back. +Echo works a lot like print, except it has a child command.`, + Args: cobra.MinimumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Echo: " + strings.Join(args, " ")) + }, + } + + var cmdTimes = &cobra.Command{ + Use: "times [string to echo]", + Short: "Echo anything to the screen more times", + Long: `echo things multiple times back to the user by providing +a count and a string.`, + Args: cobra.MinimumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + for i := 0; i < echoTimes; i++ { + fmt.Println("Echo: " + strings.Join(args, " ")) + } + }, + } + + cmdTimes.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input") + + var rootCmd = &cobra.Command{Use: "app"} + rootCmd.AddCommand(cmdPrint, cmdEcho) + cmdEcho.AddCommand(cmdTimes) + rootCmd.Execute() } ``` For a more complete example of a larger application, please checkout [Hugo](http://gohugo.io/). -## The Help Command +## Help Command Cobra automatically adds a help command to your application when you have subcommands. This will be called when a user runs 'app help'. Additionally, help will also @@ -508,60 +538,28 @@ create' is called. Every command will automatically have the '--help' flag adde The following output is automatically generated by Cobra. Nothing beyond the command and flag definitions are needed. - > hugo help + $ cobra help - hugo is the main command, used to build your Hugo site. - - Hugo is a Fast and Flexible Static Site Generator - built with love by spf13 and friends in Go. - - Complete documentation is available at http://gohugo.io/. + Cobra is a CLI library for Go that empowers applications. + This application is a tool to generate the needed files + to quickly create a Cobra application. Usage: - hugo [flags] - hugo [command] + cobra [command] Available Commands: - server Hugo runs its own webserver to render the files - version Print the version number of Hugo - config Print the site configuration - check Check content in the source directory - benchmark Benchmark hugo by building a site a number of times. - convert Convert your content to different formats - new Create new content for your site - list Listing out various types of content - undraft Undraft changes the content's draft status from 'True' to 'False' - genautocomplete Generate shell autocompletion script for Hugo - gendoc Generate Markdown documentation for the Hugo CLI. - genman Generate man page for Hugo - import Import your site from others. + add Add a command to a Cobra Application + help Help about any command + init Initialize a Cobra Application Flags: - -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/ - -D, --buildDrafts[=false]: include content marked as draft - -F, --buildFuture[=false]: include content with publishdate in the future - --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ - --canonifyURLs[=false]: if true, all relative URLs will be canonicalized using baseURL - --config="": config file (default is path/config.yaml|json|toml) - -d, --destination="": filesystem path to write files to - --disableRSS[=false]: Do not build RSS files - --disableSitemap[=false]: Do not build Sitemap file - --editor="": edit new content with this editor, if provided - --ignoreCache[=false]: Ignores the cache directory for reading but still writes to it - --log[=false]: Enable Logging - --logFile="": Log File path (if set, logging enabled automatically) - --noTimes[=false]: Don't sync modification time of files - --pluralizeListTitles[=true]: Pluralize titles in lists using inflect - --preserveTaxonomyNames[=false]: Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") - -s, --source="": filesystem path to read files relative from - --stepAnalysis[=false]: display memory and timing of different steps of the program - -t, --theme="": theme to use (located in /themes/THEMENAME/) - --uglyURLs[=false]: if true, use /filename.html instead of /filename/ - -v, --verbose[=false]: verbose output - --verboseLog[=false]: verbose logging - -w, --watch[=false]: watch filesystem for changes and recreate as needed - - Use "hugo [command] --help" for more information about a command. + -a, --author string author name for copyright attribution (default "YOUR NAME") + --config string config file (default is $HOME/.cobra.yaml) + -h, --help help for cobra + -l, --license string name of license for the project + --viper use Viper for configuration (default true) + + Use "cobra [command] --help" for more information about a command. Help is just a command like any other. There is no special logic or behavior @@ -569,38 +567,18 @@ around it. In fact, you can provide your own if you want. ### Defining your own help -You can provide your own Help command or your own template for the default command to use. - -The default help command is - -```go -func (c *Command) initHelp() { - if c.helpCommand == nil { - c.helpCommand = &Command{ - Use: "help [command]", - Short: "Help about any command", - Long: `Help provides help for any command in the application. - Simply type ` + c.Name() + ` help [path to command] for full details.`, - Run: c.HelpFunc(), - } - } - c.AddCommand(c.helpCommand) -} -``` - -You can provide your own command, function or template through the following methods: +You can provide your own Help command or your own template for the default command to use +with following functions: ```go -command.SetHelpCommand(cmd *Command) - -command.SetHelpFunc(f func(*Command, []string)) - -command.SetHelpTemplate(s string) +cmd.SetHelpCommand(cmd *Command) +cmd.SetHelpFunc(f func(*Command, []string)) +cmd.SetHelpTemplate(s string) ``` The latter two will also apply to any children commands. -## Usage +## Usage Message When the user provides an invalid flag or invalid command, Cobra responds by showing the user the 'usage'. @@ -609,71 +587,42 @@ showing the user the 'usage'. You may recognize this from the help above. That's because the default help embeds the usage as part of its output. + $ cobra --invalid + Error: unknown flag: --invalid Usage: - hugo [flags] - hugo [command] + cobra [command] Available Commands: - server Hugo runs its own webserver to render the files - version Print the version number of Hugo - config Print the site configuration - check Check content in the source directory - benchmark Benchmark hugo by building a site a number of times. - convert Convert your content to different formats - new Create new content for your site - list Listing out various types of content - undraft Undraft changes the content's draft status from 'True' to 'False' - genautocomplete Generate shell autocompletion script for Hugo - gendoc Generate Markdown documentation for the Hugo CLI. - genman Generate man page for Hugo - import Import your site from others. + add Add a command to a Cobra Application + help Help about any command + init Initialize a Cobra Application Flags: - -b, --baseURL="": hostname (and path) to the root, e.g. http://spf13.com/ - -D, --buildDrafts[=false]: include content marked as draft - -F, --buildFuture[=false]: include content with publishdate in the future - --cacheDir="": filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/ - --canonifyURLs[=false]: if true, all relative URLs will be canonicalized using baseURL - --config="": config file (default is path/config.yaml|json|toml) - -d, --destination="": filesystem path to write files to - --disableRSS[=false]: Do not build RSS files - --disableSitemap[=false]: Do not build Sitemap file - --editor="": edit new content with this editor, if provided - --ignoreCache[=false]: Ignores the cache directory for reading but still writes to it - --log[=false]: Enable Logging - --logFile="": Log File path (if set, logging enabled automatically) - --noTimes[=false]: Don't sync modification time of files - --pluralizeListTitles[=true]: Pluralize titles in lists using inflect - --preserveTaxonomyNames[=false]: Preserve taxonomy names as written ("Gérard Depardieu" vs "gerard-depardieu") - -s, --source="": filesystem path to read files relative from - --stepAnalysis[=false]: display memory and timing of different steps of the program - -t, --theme="": theme to use (located in /themes/THEMENAME/) - --uglyURLs[=false]: if true, use /filename.html instead of /filename/ - -v, --verbose[=false]: verbose output - --verboseLog[=false]: verbose logging - -w, --watch[=false]: watch filesystem for changes and recreate as needed + -a, --author string author name for copyright attribution (default "YOUR NAME") + --config string config file (default is $HOME/.cobra.yaml) + -h, --help help for cobra + -l, --license string name of license for the project + --viper use Viper for configuration (default true) + + Use "cobra [command] --help" for more information about a command. ### Defining your own usage You can provide your own usage function or template for Cobra to use. - -The default usage function is: +Like help, the function and template are overridable through public methods: ```go -return func(c *Command) error { - err := tmpl(c.Out(), c.UsageTemplate(), c) - return err -} +cmd.SetUsageFunc(f func(*Command) error) +cmd.SetUsageTemplate(s string) ``` -Like help, the function and template are overridable through public methods: - -```go -command.SetUsageFunc(f func(*Command) error) +## Version Flag -command.SetUsageTemplate(s string) -``` +Cobra adds a top-level '--version' flag if the Version field is set on the root command. +Running an application with the '--version' flag will print the version to stdout using +the version template. The template can be customized using the +`cmd.SetVersionTemplate(s string)` function. -## PreRun or PostRun Hooks +## PreRun and PostRun Hooks It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order: @@ -689,105 +638,73 @@ An example of two commands which use all of these features is below. When the s package main import ( - "fmt" + "fmt" - "github.com/spf13/cobra" + "github.com/spf13/cobra" ) func main() { - var rootCmd = &cobra.Command{ - Use: "root [sub]", - Short: "My root command", - PersistentPreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PersistentPreRun with args: %v\n", args) - }, - PreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PreRun with args: %v\n", args) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd Run with args: %v\n", args) - }, - PostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PostRun with args: %v\n", args) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside rootCmd PersistentPostRun with args: %v\n", args) - }, - } - - var subCmd = &cobra.Command{ - Use: "sub [no options!]", - Short: "My subcommand", - PreRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PreRun with args: %v\n", args) - }, - Run: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd Run with args: %v\n", args) - }, - PostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PostRun with args: %v\n", args) - }, - PersistentPostRun: func(cmd *cobra.Command, args []string) { - fmt.Printf("Inside subCmd PersistentPostRun with args: %v\n", args) - }, - } - - rootCmd.AddCommand(subCmd) - - rootCmd.SetArgs([]string{""}) - _ = rootCmd.Execute() - fmt.Print("\n") - rootCmd.SetArgs([]string{"sub", "arg1", "arg2"}) - _ = rootCmd.Execute() + var rootCmd = &cobra.Command{ + Use: "root [sub]", + Short: "My root command", + PersistentPreRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd PersistentPreRun with args: %v\n", args) + }, + PreRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd PreRun with args: %v\n", args) + }, + Run: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd Run with args: %v\n", args) + }, + PostRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd PostRun with args: %v\n", args) + }, + PersistentPostRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside rootCmd PersistentPostRun with args: %v\n", args) + }, + } + + var subCmd = &cobra.Command{ + Use: "sub [no options!]", + Short: "My subcommand", + PreRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside subCmd PreRun with args: %v\n", args) + }, + Run: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside subCmd Run with args: %v\n", args) + }, + PostRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside subCmd PostRun with args: %v\n", args) + }, + PersistentPostRun: func(cmd *cobra.Command, args []string) { + fmt.Printf("Inside subCmd PersistentPostRun with args: %v\n", args) + }, + } + + rootCmd.AddCommand(subCmd) + + rootCmd.SetArgs([]string{""}) + rootCmd.Execute() + fmt.Println() + rootCmd.SetArgs([]string{"sub", "arg1", "arg2"}) + rootCmd.Execute() } ``` +Output: +``` +Inside rootCmd PersistentPreRun with args: [] +Inside rootCmd PreRun with args: [] +Inside rootCmd Run with args: [] +Inside rootCmd PostRun with args: [] +Inside rootCmd PersistentPostRun with args: [] -## Alternative Error Handling - -Cobra also has functions where the return signature is an error. This allows for errors to bubble up to the top, -providing a way to handle the errors in one location. The current list of functions that return an error is: - -* PersistentPreRunE -* PreRunE -* RunE -* PostRunE -* PersistentPostRunE - -If you would like to silence the default `error` and `usage` output in favor of your own, you can set `SilenceUsage` -and `SilenceErrors` to `true` on the command. A child command respects these flags if they are set on the parent -command. - -**Example Usage using RunE:** - -```go -package main - -import ( - "errors" - "log" - - "github.com/spf13/cobra" -) - -func main() { - var rootCmd = &cobra.Command{ - Use: "hugo", - Short: "Hugo is a very fast static site generator", - Long: `A Fast and Flexible Static Site Generator built with - love by spf13 and friends in Go. - Complete documentation is available at http://hugo.spf13.com`, - RunE: func(cmd *cobra.Command, args []string) error { - // Do Stuff Here - return errors.New("some random error") - }, - } - - if err := rootCmd.Execute(); err != nil { - log.Fatal(err) - } -} +Inside rootCmd PersistentPreRun with args: [arg1 arg2] +Inside subCmd PreRun with args: [arg1 arg2] +Inside subCmd Run with args: [arg1 arg2] +Inside subCmd PostRun with args: [arg1 arg2] +Inside subCmd PersistentPostRun with args: [arg1 arg2] ``` ## Suggestions when "unknown command" happens @@ -830,81 +747,14 @@ Did you mean this? Run 'kubectl help' for usage. ``` -## Generating Markdown-formatted documentation for your command - -Cobra can generate a Markdown-formatted document based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Markdown Docs](doc/md_docs.md). - -## Generating man pages for your command - -Cobra can generate a man page based on the subcommands, flags, etc. A simple example of how to do this for your command can be found in [Man Docs](doc/man_docs.md). - -## Generating bash completions for your command - -Cobra can generate a bash-completion file. If you add more information to your command, these completions can be amazingly powerful and flexible. Read more about it in [Bash Completions](bash_completions.md). +## Generating documentation for your command -## Debugging +Cobra can generate documentation based on subcommands, flags, etc. Read more about it in the [docs generation documentation](doc/README.md). -Cobra provides a ‘DebugFlags’ method on a command which, when called, will print -out everything Cobra knows about the flags for each command. +## Generating shell completions -### Example - -```go -command.DebugFlags() -``` +Cobra can generate a shell-completion file for the following shells: bash, zsh, fish, PowerShell. If you add more information to your commands, these completions can be amazingly powerful and flexible. Read more about it in [Shell Completions](shell_completions.md). -## Release Notes -* **0.9.0** June 17, 2014 - * flags can appears anywhere in the args (provided they are unambiguous) - * --help prints usage screen for app or command - * Prefix matching for commands - * Cleaner looking help and usage output - * Extensive test suite -* **0.8.0** Nov 5, 2013 - * Reworked interface to remove commander completely - * Command now primary structure - * No initialization needed - * Usage & Help templates & functions definable at any level - * Updated Readme -* **0.7.0** Sept 24, 2013 - * Needs more eyes - * Test suite - * Support for automatic error messages - * Support for help command - * Support for printing to any io.Writer instead of os.Stderr - * Support for persistent flags which cascade down tree - * Ready for integration into Hugo -* **0.1.0** Sept 3, 2013 - * Implement first draft - -## Extensions - -Libraries for extending Cobra: - -* [cmdns](https://github.com/gosuri/cmdns): Enables name spacing a command's immediate children. It provides an alternative way to structure subcommands, similar to `heroku apps:create` and `ovrclk clusters:launch`. - -## ToDo -* Launch proper documentation site - -## Contributing - -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request - -## Contributors - -Names in no particular order: - -* [spf13](https://github.com/spf13), -[eparis](https://github.com/eparis), -[bep](https://github.com/bep), and many more! - -## License +# License Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt) - - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/spf13/cobra/trend.png)](https://bitdeli.com/free "Bitdeli Badge") diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go new file mode 100644 index 0000000000..70e9b26291 --- /dev/null +++ b/vendor/github.com/spf13/cobra/args.go @@ -0,0 +1,109 @@ +package cobra + +import ( + "fmt" + "strings" +) + +type PositionalArgs func(cmd *Command, args []string) error + +// Legacy arg validation has the following behaviour: +// - root commands with no subcommands can take arbitrary arguments +// - root commands with subcommands will do subcommand validity checking +// - subcommands will always accept arbitrary arguments +func legacyArgs(cmd *Command, args []string) error { + // no subcommand, always take args + if !cmd.HasSubCommands() { + return nil + } + + // root command with subcommands, do subcommand checking. + if !cmd.HasParent() && len(args) > 0 { + return fmt.Errorf("unknown command %q for %q%s", args[0], cmd.CommandPath(), cmd.findSuggestions(args[0])) + } + return nil +} + +// NoArgs returns an error if any args are included. +func NoArgs(cmd *Command, args []string) error { + if len(args) > 0 { + return fmt.Errorf("unknown command %q for %q", args[0], cmd.CommandPath()) + } + return nil +} + +// OnlyValidArgs returns an error if any args are not in the list of ValidArgs. +func OnlyValidArgs(cmd *Command, args []string) error { + if len(cmd.ValidArgs) > 0 { + // Remove any description that may be included in ValidArgs. + // A description is following a tab character. + var validArgs []string + for _, v := range cmd.ValidArgs { + validArgs = append(validArgs, strings.Split(v, "\t")[0]) + } + + for _, v := range args { + if !stringInSlice(v, validArgs) { + return fmt.Errorf("invalid argument %q for %q%s", v, cmd.CommandPath(), cmd.findSuggestions(args[0])) + } + } + } + return nil +} + +// ArbitraryArgs never returns an error. +func ArbitraryArgs(cmd *Command, args []string) error { + return nil +} + +// MinimumNArgs returns an error if there is not at least N args. +func MinimumNArgs(n int) PositionalArgs { + return func(cmd *Command, args []string) error { + if len(args) < n { + return fmt.Errorf("requires at least %d arg(s), only received %d", n, len(args)) + } + return nil + } +} + +// MaximumNArgs returns an error if there are more than N args. +func MaximumNArgs(n int) PositionalArgs { + return func(cmd *Command, args []string) error { + if len(args) > n { + return fmt.Errorf("accepts at most %d arg(s), received %d", n, len(args)) + } + return nil + } +} + +// ExactArgs returns an error if there are not exactly n args. +func ExactArgs(n int) PositionalArgs { + return func(cmd *Command, args []string) error { + if len(args) != n { + return fmt.Errorf("accepts %d arg(s), received %d", n, len(args)) + } + return nil + } +} + +// ExactValidArgs returns an error if +// there are not exactly N positional args OR +// there are any positional args that are not in the `ValidArgs` field of `Command` +func ExactValidArgs(n int) PositionalArgs { + return func(cmd *Command, args []string) error { + if err := ExactArgs(n)(cmd, args); err != nil { + return err + } + return OnlyValidArgs(cmd, args) + } +} + +// RangeArgs returns an error if the number of args is not within the expected range. +func RangeArgs(min int, max int) PositionalArgs { + return func(cmd *Command, args []string) error { + if len(args) < min || len(args) > max { + return fmt.Errorf("accepts between %d and %d arg(s), received %d", min, max, len(args)) + } + return nil + } +} diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go index a0d0402795..7106147937 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.go +++ b/vendor/github.com/spf13/cobra/bash_completions.go @@ -1,6 +1,7 @@ package cobra import ( + "bytes" "fmt" "io" "os" @@ -18,13 +19,10 @@ const ( BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir" ) -func preamble(out io.Writer, name string) error { - _, err := fmt.Fprintf(out, "# bash completion for %-36s -*- shell-script -*-\n", name) - if err != nil { - return err - } - preamStr := ` -__debug() +func writePreamble(buf io.StringWriter, name string) { + WriteStringAndCheck(buf, fmt.Sprintf("# bash completion for %-36s -*- shell-script -*-\n", name)) + WriteStringAndCheck(buf, fmt.Sprintf(` +__%[1]s_debug() { if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then echo "$*" >> "${BASH_COMP_DEBUG_FILE}" @@ -33,13 +31,13 @@ __debug() # Homebrew on Macs have version 1.3 of bash-completion which doesn't include # _init_completion. This is a very minimal version of that function. -__my_init_completion() +__%[1]s_init_completion() { COMPREPLY=() _get_comp_words_by_ref "$@" cur prev words cword } -__index_of_word() +__%[1]s_index_of_word() { local w word=$1 shift @@ -51,7 +49,7 @@ __index_of_word() index=-1 } -__contains_word() +__%[1]s_contains_word() { local w word=$1; shift for w in "$@"; do @@ -60,9 +58,103 @@ __contains_word() return 1 } -__handle_reply() +__%[1]s_handle_go_custom_completion() +{ + __%[1]s_debug "${FUNCNAME[0]}: cur is ${cur}, words[*] is ${words[*]}, #words[@] is ${#words[@]}" + + local shellCompDirectiveError=%[3]d + local shellCompDirectiveNoSpace=%[4]d + local shellCompDirectiveNoFileComp=%[5]d + local shellCompDirectiveFilterFileExt=%[6]d + local shellCompDirectiveFilterDirs=%[7]d + + local out requestComp lastParam lastChar comp directive args + + # Prepare the command to request completions for the program. + # Calling ${words[0]} instead of directly %[1]s allows to handle aliases + args=("${words[@]:1}") + requestComp="${words[0]} %[2]s ${args[*]}" + + lastParam=${words[$((${#words[@]}-1))]} + lastChar=${lastParam:$((${#lastParam}-1)):1} + __%[1]s_debug "${FUNCNAME[0]}: lastParam ${lastParam}, lastChar ${lastChar}" + + if [ -z "${cur}" ] && [ "${lastChar}" != "=" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go method. + __%[1]s_debug "${FUNCNAME[0]}: Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __%[1]s_debug "${FUNCNAME[0]}: calling ${requestComp}" + # Use eval to handle any environment variables and such + out=$(eval "${requestComp}" 2>/dev/null) + + # Extract the directive integer at the very end of the output following a colon (:) + directive=${out##*:} + # Remove the directive + out=${out%%:*} + if [ "${directive}" = "${out}" ]; then + # There is not directive specified + directive=0 + fi + __%[1]s_debug "${FUNCNAME[0]}: the completion directive is: ${directive}" + __%[1]s_debug "${FUNCNAME[0]}: the completions are: ${out[*]}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + # Error code. No completion. + __%[1]s_debug "${FUNCNAME[0]}: received error from custom completion go code" + return + else + if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then + if [[ $(type -t compopt) = "builtin" ]]; then + __%[1]s_debug "${FUNCNAME[0]}: activating no space" + compopt -o nospace + fi + fi + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + if [[ $(type -t compopt) = "builtin" ]]; then + __%[1]s_debug "${FUNCNAME[0]}: activating no file completion" + compopt +o default + fi + fi + fi + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local fullFilter filter filteringCmd + # Do not use quotes around the $out variable or else newline + # characters will be kept. + for filter in ${out[*]}; do + fullFilter+="$filter|" + done + + filteringCmd="_filedir $fullFilter" + __%[1]s_debug "File filtering command: $filteringCmd" + $filteringCmd + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subDir + # Use printf to strip any trailing newline + subdir=$(printf "%%s" "${out[0]}") + if [ -n "$subdir" ]; then + __%[1]s_debug "Listing directories in $subdir" + __%[1]s_handle_subdirs_in_dir_flag "$subdir" + else + __%[1]s_debug "Listing directories in ." + _filedir -d + fi + else + while IFS='' read -r comp; do + COMPREPLY+=("$comp") + done < <(compgen -W "${out[*]}" -- "$cur") + fi +} + +__%[1]s_handle_reply() { - __debug "${FUNCNAME[0]}" + __%[1]s_debug "${FUNCNAME[0]}" + local comp case $cur in -*) if [[ $(type -t compopt) = "builtin" ]]; then @@ -74,7 +166,9 @@ __handle_reply() else allflags=("${flags[*]} ${two_word_flags[*]}") fi - COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") ) + while IFS='' read -r comp; do + COMPREPLY+=("$comp") + done < <(compgen -W "${allflags[*]}" -- "$cur") if [[ $(type -t compopt) = "builtin" ]]; then [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace fi @@ -87,14 +181,14 @@ __handle_reply() local index flag flag="${cur%%=*}" - __index_of_word "${flag}" "${flags_with_completion[@]}" + __%[1]s_index_of_word "${flag}" "${flags_with_completion[@]}" COMPREPLY=() if [[ ${index} -ge 0 ]]; then PREFIX="" cur="${cur#*=}" ${flags_completion[${index}]} if [ -n "${ZSH_VERSION}" ]; then - # zfs completion needs --flag= prefix + # zsh completion needs --flag= prefix eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )" fi fi @@ -105,7 +199,7 @@ __handle_reply() # check if we are handling a flag with special work handling local index - __index_of_word "${prev}" "${flags_with_completion[@]}" + __%[1]s_index_of_word "${prev}" "${flags_with_completion[@]}" if [[ ${index} -ge 0 ]]; then ${flags_completion[${index}]} return @@ -119,40 +213,62 @@ __handle_reply() local completions completions=("${commands[@]}") if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then - completions=("${must_have_one_noun[@]}") + completions+=("${must_have_one_noun[@]}") + elif [[ -n "${has_completion_function}" ]]; then + # if a go completion function is provided, defer to that function + __%[1]s_handle_go_custom_completion fi if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then completions+=("${must_have_one_flag[@]}") fi - COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") ) + while IFS='' read -r comp; do + COMPREPLY+=("$comp") + done < <(compgen -W "${completions[*]}" -- "$cur") if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then - COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") ) + while IFS='' read -r comp; do + COMPREPLY+=("$comp") + done < <(compgen -W "${noun_aliases[*]}" -- "$cur") fi if [[ ${#COMPREPLY[@]} -eq 0 ]]; then - declare -F __custom_func >/dev/null && __custom_func + if declare -F __%[1]s_custom_func >/dev/null; then + # try command name qualified custom func + __%[1]s_custom_func + else + # otherwise fall back to unqualified for compatibility + declare -F __custom_func >/dev/null && __custom_func + fi fi - __ltrim_colon_completions "$cur" + # available in bash-completion >= 2, not always present on macOS + if declare -F __ltrim_colon_completions >/dev/null; then + __ltrim_colon_completions "$cur" + fi + + # If there is only 1 completion and it is a flag with an = it will be completed + # but we don't want a space after the = + if [[ "${#COMPREPLY[@]}" -eq "1" ]] && [[ $(type -t compopt) = "builtin" ]] && [[ "${COMPREPLY[0]}" == --*= ]]; then + compopt -o nospace + fi } # The arguments should be in the form "ext1|ext2|extn" -__handle_filename_extension_flag() +__%[1]s_handle_filename_extension_flag() { local ext="$1" _filedir "@(${ext})" } -__handle_subdirs_in_dir_flag() +__%[1]s_handle_subdirs_in_dir_flag() { local dir="$1" - pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 + pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1 || return } -__handle_flag() +__%[1]s_handle_flag() { - __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" # if a command required a flag, and we found it, unset must_have_one_flag() local flagname=${words[c]} @@ -163,27 +279,31 @@ __handle_flag() flagname=${flagname%%=*} # strip everything after the = flagname="${flagname}=" # but put the = back fi - __debug "${FUNCNAME[0]}: looking for ${flagname}" - if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then + __%[1]s_debug "${FUNCNAME[0]}: looking for ${flagname}" + if __%[1]s_contains_word "${flagname}" "${must_have_one_flag[@]}"; then must_have_one_flag=() fi # if you set a flag which only applies to this command, don't show subcommands - if __contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then + if __%[1]s_contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then commands=() fi # keep flag value with flagname as flaghash - if [ -n "${flagvalue}" ] ; then - flaghash[${flagname}]=${flagvalue} - elif [ -n "${words[ $((c+1)) ]}" ] ; then - flaghash[${flagname}]=${words[ $((c+1)) ]} - else - flaghash[${flagname}]="true" # pad "true" for bool flag + # flaghash variable is an associative array which is only supported in bash > 3. + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + if [ -n "${flagvalue}" ] ; then + flaghash[${flagname}]=${flagvalue} + elif [ -n "${words[ $((c+1)) ]}" ] ; then + flaghash[${flagname}]=${words[ $((c+1)) ]} + else + flaghash[${flagname}]="true" # pad "true" for bool flag + fi fi # skip the argument to a two word flag - if __contains_word "${words[c]}" "${two_word_flags[@]}"; then + if [[ ${words[c]} != *"="* ]] && __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then + __%[1]s_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument" c=$((c+1)) # if we are looking for a flags value, don't show commands if [[ $c -eq $cword ]]; then @@ -195,13 +315,13 @@ __handle_flag() } -__handle_noun() +__%[1]s_handle_noun() { - __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" - if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then + if __%[1]s_contains_word "${words[c]}" "${must_have_one_noun[@]}"; then must_have_one_noun=() - elif __contains_word "${words[c]}" "${noun_aliases[@]}"; then + elif __%[1]s_contains_word "${words[c]}" "${noun_aliases[@]}"; then must_have_one_noun=() fi @@ -209,62 +329,68 @@ __handle_noun() c=$((c+1)) } -__handle_command() +__%[1]s_handle_command() { - __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" local next_command if [[ -n ${last_command} ]]; then next_command="_${last_command}_${words[c]//:/__}" else if [[ $c -eq 0 ]]; then - next_command="_$(basename "${words[c]//:/__}")" + next_command="_%[1]s_root_command" else next_command="_${words[c]//:/__}" fi fi c=$((c+1)) - __debug "${FUNCNAME[0]}: looking for ${next_command}" + __%[1]s_debug "${FUNCNAME[0]}: looking for ${next_command}" declare -F "$next_command" >/dev/null && $next_command } -__handle_word() +__%[1]s_handle_word() { if [[ $c -ge $cword ]]; then - __handle_reply + __%[1]s_handle_reply return fi - __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" + __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" if [[ "${words[c]}" == -* ]]; then - __handle_flag - elif __contains_word "${words[c]}" "${commands[@]}"; then - __handle_command - elif [[ $c -eq 0 ]] && __contains_word "$(basename "${words[c]}")" "${commands[@]}"; then - __handle_command + __%[1]s_handle_flag + elif __%[1]s_contains_word "${words[c]}" "${commands[@]}"; then + __%[1]s_handle_command + elif [[ $c -eq 0 ]]; then + __%[1]s_handle_command + elif __%[1]s_contains_word "${words[c]}" "${command_aliases[@]}"; then + # aliashash variable is an associative array which is only supported in bash > 3. + if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then + words[c]=${aliashash[${words[c]}]} + __%[1]s_handle_command + else + __%[1]s_handle_noun + fi else - __handle_noun + __%[1]s_handle_noun fi - __handle_word + __%[1]s_handle_word } -` - _, err = fmt.Fprint(out, preamStr) - return err +`, name, ShellCompNoDescRequestCmd, + ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, + ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs)) } -func postscript(w io.Writer, name string) error { +func writePostscript(buf io.StringWriter, name string) { name = strings.Replace(name, ":", "__", -1) - _, err := fmt.Fprintf(w, "__start_%s()\n", name) - if err != nil { - return err - } - _, err = fmt.Fprintf(w, `{ + WriteStringAndCheck(buf, fmt.Sprintf("__start_%s()\n", name)) + WriteStringAndCheck(buf, fmt.Sprintf(`{ local cur prev words cword declare -A flaghash 2>/dev/null || : + declare -A aliashash 2>/dev/null || : if declare -F _init_completion >/dev/null 2>&1; then _init_completion -s || return else - __my_init_completion -n "=" || return + __%[1]s_init_completion -n "=" || return fi local c=0 @@ -273,206 +399,169 @@ func postscript(w io.Writer, name string) error { local local_nonpersistent_flags=() local flags_with_completion=() local flags_completion=() - local commands=("%s") + local commands=("%[1]s") local must_have_one_flag=() local must_have_one_noun=() + local has_completion_function local last_command local nouns=() - __handle_word + __%[1]s_handle_word } -`, name) - if err != nil { - return err - } - _, err = fmt.Fprintf(w, `if [[ $(type -t compopt) = "builtin" ]]; then +`, name)) + WriteStringAndCheck(buf, fmt.Sprintf(`if [[ $(type -t compopt) = "builtin" ]]; then complete -o default -F __start_%s %s else complete -o default -o nospace -F __start_%s %s fi -`, name, name, name, name) - if err != nil { - return err - } - _, err = fmt.Fprintf(w, "# ex: ts=4 sw=4 et filetype=sh\n") - return err +`, name, name, name, name)) + WriteStringAndCheck(buf, "# ex: ts=4 sw=4 et filetype=sh\n") } -func writeCommands(cmd *Command, w io.Writer) error { - if _, err := fmt.Fprintf(w, " commands=()\n"); err != nil { - return err - } +func writeCommands(buf io.StringWriter, cmd *Command) { + WriteStringAndCheck(buf, " commands=()\n") for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c == cmd.helpCommand { + if !c.IsAvailableCommand() && c != cmd.helpCommand { continue } - if _, err := fmt.Fprintf(w, " commands+=(%q)\n", c.Name()); err != nil { - return err - } + WriteStringAndCheck(buf, fmt.Sprintf(" commands+=(%q)\n", c.Name())) + writeCmdAliases(buf, c) } - _, err := fmt.Fprintf(w, "\n") - return err + WriteStringAndCheck(buf, "\n") } -func writeFlagHandler(name string, annotations map[string][]string, w io.Writer) error { +func writeFlagHandler(buf io.StringWriter, name string, annotations map[string][]string, cmd *Command) { for key, value := range annotations { switch key { case BashCompFilenameExt: - _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) - if err != nil { - return err - } + WriteStringAndCheck(buf, fmt.Sprintf(" flags_with_completion+=(%q)\n", name)) + var ext string if len(value) > 0 { - ext := "__handle_filename_extension_flag " + strings.Join(value, "|") - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) + ext = fmt.Sprintf("__%s_handle_filename_extension_flag ", cmd.Root().Name()) + strings.Join(value, "|") } else { - ext := "_filedir" - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) - } - if err != nil { - return err + ext = "_filedir" } + WriteStringAndCheck(buf, fmt.Sprintf(" flags_completion+=(%q)\n", ext)) case BashCompCustom: - _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) - if err != nil { - return err - } + WriteStringAndCheck(buf, fmt.Sprintf(" flags_with_completion+=(%q)\n", name)) + if len(value) > 0 { handlers := strings.Join(value, "; ") - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", handlers) + WriteStringAndCheck(buf, fmt.Sprintf(" flags_completion+=(%q)\n", handlers)) } else { - _, err = fmt.Fprintf(w, " flags_completion+=(:)\n") - } - if err != nil { - return err + WriteStringAndCheck(buf, " flags_completion+=(:)\n") } case BashCompSubdirsInDir: - _, err := fmt.Fprintf(w, " flags_with_completion+=(%q)\n", name) + WriteStringAndCheck(buf, fmt.Sprintf(" flags_with_completion+=(%q)\n", name)) + var ext string if len(value) == 1 { - ext := "__handle_subdirs_in_dir_flag " + value[0] - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) + ext = fmt.Sprintf("__%s_handle_subdirs_in_dir_flag ", cmd.Root().Name()) + value[0] } else { - ext := "_filedir -d" - _, err = fmt.Fprintf(w, " flags_completion+=(%q)\n", ext) - } - if err != nil { - return err + ext = "_filedir -d" } + WriteStringAndCheck(buf, fmt.Sprintf(" flags_completion+=(%q)\n", ext)) } } - return nil } -func writeShortFlag(flag *pflag.Flag, w io.Writer) error { - b := (len(flag.NoOptDefVal) > 0) +const cbn = "\")\n" + +func writeShortFlag(buf io.StringWriter, flag *pflag.Flag, cmd *Command) { name := flag.Shorthand format := " " - if !b { + if len(flag.NoOptDefVal) == 0 { format += "two_word_" } - format += "flags+=(\"-%s\")\n" - if _, err := fmt.Fprintf(w, format, name); err != nil { - return err - } - return writeFlagHandler("-"+name, flag.Annotations, w) + format += "flags+=(\"-%s" + cbn + WriteStringAndCheck(buf, fmt.Sprintf(format, name)) + writeFlagHandler(buf, "-"+name, flag.Annotations, cmd) } -func writeFlag(flag *pflag.Flag, w io.Writer) error { - b := (len(flag.NoOptDefVal) > 0) +func writeFlag(buf io.StringWriter, flag *pflag.Flag, cmd *Command) { name := flag.Name format := " flags+=(\"--%s" - if !b { + if len(flag.NoOptDefVal) == 0 { format += "=" } - format += "\")\n" - if _, err := fmt.Fprintf(w, format, name); err != nil { - return err + format += cbn + WriteStringAndCheck(buf, fmt.Sprintf(format, name)) + if len(flag.NoOptDefVal) == 0 { + format = " two_word_flags+=(\"--%s" + cbn + WriteStringAndCheck(buf, fmt.Sprintf(format, name)) } - return writeFlagHandler("--"+name, flag.Annotations, w) + writeFlagHandler(buf, "--"+name, flag.Annotations, cmd) } -func writeLocalNonPersistentFlag(flag *pflag.Flag, w io.Writer) error { - b := (len(flag.NoOptDefVal) > 0) +func writeLocalNonPersistentFlag(buf io.StringWriter, flag *pflag.Flag) { name := flag.Name - format := " local_nonpersistent_flags+=(\"--%s" - if !b { - format += "=" + format := " local_nonpersistent_flags+=(\"--%[1]s" + cbn + if len(flag.NoOptDefVal) == 0 { + format += " local_nonpersistent_flags+=(\"--%[1]s=" + cbn + } + WriteStringAndCheck(buf, fmt.Sprintf(format, name)) + if len(flag.Shorthand) > 0 { + WriteStringAndCheck(buf, fmt.Sprintf(" local_nonpersistent_flags+=(\"-%s\")\n", flag.Shorthand)) + } +} + +// Setup annotations for go completions for registered flags +func prepareCustomAnnotationsForFlags(cmd *Command) { + for flag := range flagCompletionFunctions { + // Make sure the completion script calls the __*_go_custom_completion function for + // every registered flag. We need to do this here (and not when the flag was registered + // for completion) so that we can know the root command name for the prefix + // of ___go_custom_completion + if flag.Annotations == nil { + flag.Annotations = map[string][]string{} + } + flag.Annotations[BashCompCustom] = []string{fmt.Sprintf("__%[1]s_handle_go_custom_completion", cmd.Root().Name())} } - format += "\")\n" - _, err := fmt.Fprintf(w, format, name) - return err } -func writeFlags(cmd *Command, w io.Writer) error { - _, err := fmt.Fprintf(w, ` flags=() +func writeFlags(buf io.StringWriter, cmd *Command) { + prepareCustomAnnotationsForFlags(cmd) + WriteStringAndCheck(buf, ` flags=() two_word_flags=() local_nonpersistent_flags=() flags_with_completion=() flags_completion=() `) - if err != nil { - return err - } localNonPersistentFlags := cmd.LocalNonPersistentFlags() - var visitErr error cmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) { if nonCompletableFlag(flag) { return } - if err := writeFlag(flag, w); err != nil { - visitErr = err - return - } + writeFlag(buf, flag, cmd) if len(flag.Shorthand) > 0 { - if err := writeShortFlag(flag, w); err != nil { - visitErr = err - return - } + writeShortFlag(buf, flag, cmd) } - if localNonPersistentFlags.Lookup(flag.Name) != nil { - if err := writeLocalNonPersistentFlag(flag, w); err != nil { - visitErr = err - return - } + // localNonPersistentFlags are used to stop the completion of subcommands when one is set + // if TraverseChildren is true we should allow to complete subcommands + if localNonPersistentFlags.Lookup(flag.Name) != nil && !cmd.Root().TraverseChildren { + writeLocalNonPersistentFlag(buf, flag) } }) - if visitErr != nil { - return visitErr - } cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) { if nonCompletableFlag(flag) { return } - if err := writeFlag(flag, w); err != nil { - visitErr = err - return - } + writeFlag(buf, flag, cmd) if len(flag.Shorthand) > 0 { - if err := writeShortFlag(flag, w); err != nil { - visitErr = err - return - } + writeShortFlag(buf, flag, cmd) } }) - if visitErr != nil { - return visitErr - } - _, err = fmt.Fprintf(w, "\n") - return err + WriteStringAndCheck(buf, "\n") } -func writeRequiredFlag(cmd *Command, w io.Writer) error { - if _, err := fmt.Fprintf(w, " must_have_one_flag=()\n"); err != nil { - return err - } +func writeRequiredFlag(buf io.StringWriter, cmd *Command) { + WriteStringAndCheck(buf, " must_have_one_flag=()\n") flags := cmd.NonInheritedFlags() - var visitErr error flags.VisitAll(func(flag *pflag.Flag) { if nonCompletableFlag(flag) { return @@ -481,107 +570,99 @@ func writeRequiredFlag(cmd *Command, w io.Writer) error { switch key { case BashCompOneRequiredFlag: format := " must_have_one_flag+=(\"--%s" - b := (flag.Value.Type() == "bool") - if !b { + if flag.Value.Type() != "bool" { format += "=" } - format += "\")\n" - if _, err := fmt.Fprintf(w, format, flag.Name); err != nil { - visitErr = err - return - } + format += cbn + WriteStringAndCheck(buf, fmt.Sprintf(format, flag.Name)) if len(flag.Shorthand) > 0 { - if _, err := fmt.Fprintf(w, " must_have_one_flag+=(\"-%s\")\n", flag.Shorthand); err != nil { - visitErr = err - return - } + WriteStringAndCheck(buf, fmt.Sprintf(" must_have_one_flag+=(\"-%s"+cbn, flag.Shorthand)) } } } }) - return visitErr } -func writeRequiredNouns(cmd *Command, w io.Writer) error { - if _, err := fmt.Fprintf(w, " must_have_one_noun=()\n"); err != nil { - return err - } - sort.Sort(sort.StringSlice(cmd.ValidArgs)) +func writeRequiredNouns(buf io.StringWriter, cmd *Command) { + WriteStringAndCheck(buf, " must_have_one_noun=()\n") + sort.Strings(cmd.ValidArgs) for _, value := range cmd.ValidArgs { - if _, err := fmt.Fprintf(w, " must_have_one_noun+=(%q)\n", value); err != nil { - return err - } + // Remove any description that may be included following a tab character. + // Descriptions are not supported by bash completion. + value = strings.Split(value, "\t")[0] + WriteStringAndCheck(buf, fmt.Sprintf(" must_have_one_noun+=(%q)\n", value)) + } + if cmd.ValidArgsFunction != nil { + WriteStringAndCheck(buf, " has_completion_function=1\n") } - return nil } -func writeArgAliases(cmd *Command, w io.Writer) error { - if _, err := fmt.Fprintf(w, " noun_aliases=()\n"); err != nil { - return err +func writeCmdAliases(buf io.StringWriter, cmd *Command) { + if len(cmd.Aliases) == 0 { + return + } + + sort.Strings(cmd.Aliases) + + WriteStringAndCheck(buf, fmt.Sprint(` if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then`, "\n")) + for _, value := range cmd.Aliases { + WriteStringAndCheck(buf, fmt.Sprintf(" command_aliases+=(%q)\n", value)) + WriteStringAndCheck(buf, fmt.Sprintf(" aliashash[%q]=%q\n", value, cmd.Name())) } - sort.Sort(sort.StringSlice(cmd.ArgAliases)) + WriteStringAndCheck(buf, ` fi`) + WriteStringAndCheck(buf, "\n") +} +func writeArgAliases(buf io.StringWriter, cmd *Command) { + WriteStringAndCheck(buf, " noun_aliases=()\n") + sort.Strings(cmd.ArgAliases) for _, value := range cmd.ArgAliases { - if _, err := fmt.Fprintf(w, " noun_aliases+=(%q)\n", value); err != nil { - return err - } + WriteStringAndCheck(buf, fmt.Sprintf(" noun_aliases+=(%q)\n", value)) } - return nil } -func gen(cmd *Command, w io.Writer) error { +func gen(buf io.StringWriter, cmd *Command) { for _, c := range cmd.Commands() { - if !c.IsAvailableCommand() || c == cmd.helpCommand { + if !c.IsAvailableCommand() && c != cmd.helpCommand { continue } - if err := gen(c, w); err != nil { - return err - } + gen(buf, c) } commandName := cmd.CommandPath() commandName = strings.Replace(commandName, " ", "_", -1) commandName = strings.Replace(commandName, ":", "__", -1) - if _, err := fmt.Fprintf(w, "_%s()\n{\n", commandName); err != nil { - return err - } - if _, err := fmt.Fprintf(w, " last_command=%q\n", commandName); err != nil { - return err - } - if err := writeCommands(cmd, w); err != nil { - return err - } - if err := writeFlags(cmd, w); err != nil { - return err - } - if err := writeRequiredFlag(cmd, w); err != nil { - return err - } - if err := writeRequiredNouns(cmd, w); err != nil { - return err - } - if err := writeArgAliases(cmd, w); err != nil { - return err - } - if _, err := fmt.Fprintf(w, "}\n\n"); err != nil { - return err + + if cmd.Root() == cmd { + WriteStringAndCheck(buf, fmt.Sprintf("_%s_root_command()\n{\n", commandName)) + } else { + WriteStringAndCheck(buf, fmt.Sprintf("_%s()\n{\n", commandName)) } - return nil + + WriteStringAndCheck(buf, fmt.Sprintf(" last_command=%q\n", commandName)) + WriteStringAndCheck(buf, "\n") + WriteStringAndCheck(buf, " command_aliases=()\n") + WriteStringAndCheck(buf, "\n") + + writeCommands(buf, cmd) + writeFlags(buf, cmd) + writeRequiredFlag(buf, cmd) + writeRequiredNouns(buf, cmd) + writeArgAliases(buf, cmd) + WriteStringAndCheck(buf, "}\n\n") } // GenBashCompletion generates bash completion file and writes to the passed writer. -func (cmd *Command) GenBashCompletion(w io.Writer) error { - if err := preamble(w, cmd.Name()); err != nil { - return err - } - if len(cmd.BashCompletionFunction) > 0 { - if _, err := fmt.Fprintf(w, "%s\n", cmd.BashCompletionFunction); err != nil { - return err - } +func (c *Command) GenBashCompletion(w io.Writer) error { + buf := new(bytes.Buffer) + writePreamble(buf, c.Name()) + if len(c.BashCompletionFunction) > 0 { + buf.WriteString(c.BashCompletionFunction + "\n") } - if err := gen(cmd, w); err != nil { - return err - } - return postscript(w, cmd.Name()) + gen(buf, c) + writePostscript(buf, c.Name()) + + _, err := buf.WriteTo(w) + return err } func nonCompletableFlag(flag *pflag.Flag) bool { @@ -589,57 +670,12 @@ func nonCompletableFlag(flag *pflag.Flag) bool { } // GenBashCompletionFile generates bash completion file. -func (cmd *Command) GenBashCompletionFile(filename string) error { +func (c *Command) GenBashCompletionFile(filename string) error { outFile, err := os.Create(filename) if err != nil { return err } defer outFile.Close() - return cmd.GenBashCompletion(outFile) -} - -// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag, if it exists. -func (cmd *Command) MarkFlagRequired(name string) error { - return MarkFlagRequired(cmd.Flags(), name) -} - -// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag, if it exists. -func (cmd *Command) MarkPersistentFlagRequired(name string) error { - return MarkFlagRequired(cmd.PersistentFlags(), name) -} - -// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag in the flag set, if it exists. -func MarkFlagRequired(flags *pflag.FlagSet, name string) error { - return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"}) -} - -// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists. -// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. -func (cmd *Command) MarkFlagFilename(name string, extensions ...string) error { - return MarkFlagFilename(cmd.Flags(), name, extensions...) -} - -// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. -// Generated bash autocompletion will call the bash function f for the flag. -func (cmd *Command) MarkFlagCustom(name string, f string) error { - return MarkFlagCustom(cmd.Flags(), name, f) -} - -// MarkPersistentFlagFilename adds the BashCompFilenameExt annotation to the named persistent flag, if it exists. -// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. -func (cmd *Command) MarkPersistentFlagFilename(name string, extensions ...string) error { - return MarkFlagFilename(cmd.PersistentFlags(), name, extensions...) -} - -// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag in the flag set, if it exists. -// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided. -func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error { - return flags.SetAnnotation(name, BashCompFilenameExt, extensions) -} - -// MarkFlagCustom adds the BashCompCustom annotation to the named flag in the flag set, if it exists. -// Generated bash autocompletion will call the bash function f for the flag. -func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error { - return flags.SetAnnotation(name, BashCompCustom, []string{f}) + return c.GenBashCompletion(outFile) } diff --git a/vendor/github.com/spf13/cobra/bash_completions.md b/vendor/github.com/spf13/cobra/bash_completions.md index 7fa970fa20..130f99b923 100644 --- a/vendor/github.com/spf13/cobra/bash_completions.md +++ b/vendor/github.com/spf13/cobra/bash_completions.md @@ -1,28 +1,14 @@ -# Generating Bash Completions For Your Own cobra.Command +# Generating Bash Completions For Your cobra.Command -Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows: +Please refer to [Shell Completions](shell_completions.md) for details. -```go -package main - -import ( - "io/ioutil" - "os" +## Bash legacy dynamic completions - "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd" -) +For backward compatibility, Cobra still supports its legacy dynamic completion solution (described below). Unlike the `ValidArgsFunction` solution, the legacy solution will only work for Bash shell-completion and not for other shells. This legacy solution can be used along-side `ValidArgsFunction` and `RegisterFlagCompletionFunc()`, as long as both solutions are not used for the same command. This provides a path to gradually migrate from the legacy solution to the new solution. -func main() { - kubectl := cmd.NewFactory(nil).NewKubectlCommand(os.Stdin, ioutil.Discard, ioutil.Discard) - kubectl.GenBashCompletionFile("out.sh") -} -``` +The legacy solution allows you to inject bash functions into the bash completion script. Those bash functions are responsible for providing the completion choices for your own completions. -`out.sh` will get you completions of subcommands and flags. Copy it to `/etc/bash_completion.d/` as described [here](https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1) and reset your terminal to use autocompletion. If you make additional annotations to your code, you can get even more intelligent and flexible behavior. - -## Creating your own custom functions - -Some more actual code that works in kubernetes: +Some code that works in kubernetes: ```bash const ( @@ -46,7 +32,7 @@ __kubectl_get_resource() fi } -__custom_func() { +__kubectl_custom_func() { case ${last_command} in kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop) __kubectl_get_resource @@ -73,114 +59,13 @@ Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`, } ``` -The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__custom_func()` to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! - -## Have the completions code complete your 'nouns' - -In the above example "pod" was assumed to already be typed. But if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. Simplified code from `kubectl get` looks like: - -```go -validArgs []string = { "pod", "node", "service", "replicationcontroller" } - -cmd := &cobra.Command{ - Use: "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)", - Short: "Display one or many resources", - Long: get_long, - Example: get_example, - Run: func(cmd *cobra.Command, args []string) { - err := RunGet(f, out, cmd, args) - util.CheckErr(err) - }, - ValidArgs: validArgs, -} -``` - -Notice we put the "ValidArgs" on the "get" subcommand. Doing so will give results like - -```bash -# kubectl get [tab][tab] -node pod replicationcontroller service -``` - -## Plural form and shortcuts for nouns - -If your nouns have a number of aliases, you can define them alongside `ValidArgs` using `ArgAliases`: - -```go` -argAliases []string = { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" } - -cmd := &cobra.Command{ - ... - ValidArgs: validArgs, - ArgAliases: argAliases -} -``` - -The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by -the completion algorithm if entered manually, e.g. in: - -```bash -# kubectl get rc [tab][tab] -backend frontend database -``` - -Note that without declaring `rc` as an alias, the completion algorithm would show the list of nouns -in this example again instead of the replication controllers. - -## Mark flags as required - -Most of the time completions will only show subcommands. But if a flag is required to make a subcommand work, you probably want it to show up when the user types [tab][tab]. Marking a flag as 'Required' is incredibly easy. - -```go -cmd.MarkFlagRequired("pod") -cmd.MarkFlagRequired("container") -``` - -and you'll get something like - -```bash -# kubectl exec [tab][tab][tab] --c --container= -p --pod= -``` - -# Specify valid filename extensions for flags that take a filename - -In this example we use --filename= and expect to get a json or yaml file as the argument. To make this easier we annotate the --filename flag with valid filename extensions. - -```go - annotations := []string{"json", "yaml", "yml"} - annotation := make(map[string][]string) - annotation[cobra.BashCompFilenameExt] = annotations - - flag := &pflag.Flag{ - Name: "filename", - Shorthand: "f", - Usage: usage, - Value: value, - DefValue: value.String(), - Annotations: annotation, - } - cmd.Flags().AddFlag(flag) -``` - -Now when you run a command with this filename flag you'll get something like - -```bash -# kubectl create -f -test/ example/ rpmbuild/ -hello.yml test.json -``` - -So while there are many other files in the CWD it only shows me subdirs and those with valid extensions. - -# Specifiy custom flag completion +The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__kubectl_custom_func()` (`___custom_func()`) to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__kubectl_customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__kubectl_custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods! -Similar to the filename completion and filtering using cobra.BashCompFilenameExt, you can specifiy -a custom flag completion function with cobra.BashCompCustom: +Similarly, for flags: ```go annotation := make(map[string][]string) - annotation[cobra.BashCompFilenameExt] = []string{"__kubectl_get_namespaces"} + annotation[cobra.BashCompCustom] = []string{"__kubectl_get_namespaces"} flag := &pflag.Flag{ Name: "namespace", @@ -190,7 +75,7 @@ a custom flag completion function with cobra.BashCompCustom: cmd.Flags().AddFlag(flag) ``` -In addition add the `__handle_namespace_flag` implementation in the `BashCompletionFunction` +In addition add the `__kubectl_get_namespaces` implementation in the `BashCompletionFunction` value, e.g.: ```bash diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go index 25473a7068..d6cbfd7198 100644 --- a/vendor/github.com/spf13/cobra/cobra.go +++ b/vendor/github.com/spf13/cobra/cobra.go @@ -19,20 +19,23 @@ package cobra import ( "fmt" "io" + "os" "reflect" "strconv" "strings" "text/template" + "time" "unicode" ) var templateFuncs = template.FuncMap{ - "trim": strings.TrimSpace, - "trimRightSpace": trimRightSpace, - "appendIfNotPresent": appendIfNotPresent, - "rpad": rpad, - "gt": Gt, - "eq": Eq, + "trim": strings.TrimSpace, + "trimRightSpace": trimRightSpace, + "trimTrailingWhitespaces": trimRightSpace, + "appendIfNotPresent": appendIfNotPresent, + "rpad": rpad, + "gt": Gt, + "eq": Eq, } var initializers []func() @@ -46,6 +49,21 @@ var EnablePrefixMatching = false // To disable sorting, set it to false. var EnableCommandSorting = true +// MousetrapHelpText enables an information splash screen on Windows +// if the CLI is started from explorer.exe. +// To disable the mousetrap, just set this variable to blank string (""). +// Works only on Microsoft Windows. +var MousetrapHelpText = `This is a command line tool. + +You need to open cmd.exe and run it from there. +` + +// MousetrapDisplayDuration controls how long the MousetrapHelpText message is displayed on Windows +// if the CLI is started from explorer.exe. Set to 0 to wait for the return key to be pressed. +// To disable the mousetrap, just set MousetrapHelpText to blank string (""). +// Works only on Microsoft Windows. +var MousetrapDisplayDuration = 5 * time.Second + // AddTemplateFunc adds a template function that's available to Usage and Help // template generation. func AddTemplateFunc(name string, tmplFunc interface{}) { @@ -60,11 +78,14 @@ func AddTemplateFuncs(tmplFuncs template.FuncMap) { } } -// OnInitialize takes a series of func() arguments and appends them to a slice of func(). +// OnInitialize sets the passed functions to be run when each command's +// Execute method is called. func OnInitialize(y ...func()) { initializers = append(initializers, y...) } +// FIXME Gt is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. + // Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans, // Maps and Slices, Gt will compare their lengths. Ints are compared directly while strings are first parsed as // ints and then compared. @@ -95,6 +116,8 @@ func Gt(a interface{}, b interface{}) bool { return left > right } +// FIXME Eq is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. + // Eq takes two types and checks whether they are equal. Supported types are int and string. Unsupported types will panic. func Eq(a interface{}, b interface{}) bool { av := reflect.ValueOf(a) @@ -115,6 +138,8 @@ func trimRightSpace(s string) string { return strings.TrimRightFunc(s, unicode.IsSpace) } +// FIXME appendIfNotPresent is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra. + // appendIfNotPresent will append stringToAppend to the end of s, but only if it's not yet present in s. func appendIfNotPresent(s, stringToAppend string) string { if strings.Contains(s, stringToAppend) { @@ -172,3 +197,26 @@ func ld(s, t string, ignoreCase bool) int { } return d[len(s)][len(t)] } + +func stringInSlice(a string, list []string) bool { + for _, b := range list { + if b == a { + return true + } + } + return false +} + +// CheckErr prints the msg with the prefix 'Error:' and exits with error code 1. If the msg is nil, it does nothing. +func CheckErr(msg interface{}) { + if msg != nil { + fmt.Fprintln(os.Stderr, "Error:", msg) + os.Exit(1) + } +} + +// WriteStringAndCheck writes a string into a buffer, and checks if the error is not nil. +func WriteStringAndCheck(b io.StringWriter, s string) { + _, err := b.WriteString(s) + CheckErr(err) +} diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index f4cd95ca7f..d6732ad115 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -11,12 +11,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -//Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces. -//In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code. +// Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces. +// In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code. package cobra import ( "bytes" + "context" "fmt" "io" "os" @@ -27,109 +28,202 @@ import ( flag "github.com/spf13/pflag" ) +// FParseErrWhitelist configures Flag parse errors to be ignored +type FParseErrWhitelist flag.ParseErrorsWhitelist + // Command is just that, a command for your application. -// eg. 'go run' ... 'run' is the command. Cobra requires +// E.g. 'go run ...' - 'run' is the command. Cobra requires // you to define the usage and description as part of your command // definition to ensure usability. type Command struct { - // Name is the command name, usually the executable's name. - name string - // The one-line usage message. + // Use is the one-line usage message. + // Recommended syntax is as follow: + // [ ] identifies an optional argument. Arguments that are not enclosed in brackets are required. + // ... indicates that you can specify multiple values for the previous argument. + // | indicates mutually exclusive information. You can use the argument to the left of the separator or the + // argument to the right of the separator. You cannot use both arguments in a single use of the command. + // { } delimits a set of mutually exclusive arguments when one of the arguments is required. If the arguments are + // optional, they are enclosed in brackets ([ ]). + // Example: add [-F file | -D dir]... [-f format] profile Use string - // An array of aliases that can be used instead of the first word in Use. + + // Aliases is an array of aliases that can be used instead of the first word in Use. Aliases []string - // An array of command names for which this command will be suggested - similar to aliases but only suggests. + + // SuggestFor is an array of command names for which this command will be suggested - + // similar to aliases but only suggests. SuggestFor []string - // The short description shown in the 'help' output. + + // Short is the short description shown in the 'help' output. Short string - // The long message shown in the 'help ' output. + + // Long is the long message shown in the 'help ' output. Long string - // Examples of how to use the command + + // Example is examples of how to use the command. Example string - // List of all valid non-flag arguments that are accepted in bash completions + + // ValidArgs is list of all valid non-flag arguments that are accepted in bash completions ValidArgs []string - // List of aliases for ValidArgs. These are not suggested to the user in the bash - // completion, but accepted if entered manually. + // ValidArgsFunction is an optional function that provides valid non-flag arguments for bash completion. + // It is a dynamic version of using ValidArgs. + // Only one of ValidArgs and ValidArgsFunction can be used for a command. + ValidArgsFunction func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective) + + // Expected arguments + Args PositionalArgs + + // ArgAliases is List of aliases for ValidArgs. + // These are not suggested to the user in the bash completion, + // but accepted if entered manually. ArgAliases []string - // Custom functions used by the bash autocompletion generator + + // BashCompletionFunction is custom functions used by the bash autocompletion generator. BashCompletionFunction string - // Is this command deprecated and should print this string when used? + + // Deprecated defines, if this command is deprecated and should print this string when used. Deprecated string - // Is this command hidden and should NOT show up in the list of available commands? - Hidden bool + // Annotations are key/value pairs that can be used by applications to identify or - // group commands + // group commands. Annotations map[string]string - // Full set of flags - flags *flag.FlagSet - // Set of flags childrens of this command will inherit - pflags *flag.FlagSet - // Flags that are declared specifically by this command (not inherited). - lflags *flag.FlagSet - // SilenceErrors is an option to quiet errors down stream - SilenceErrors bool - // Silence Usage is an option to silence usage when an error occurs. - SilenceUsage bool + + // Version defines the version for this command. If this value is non-empty and the command does not + // define a "version" flag, a "version" boolean flag will be added to the command and, if specified, + // will print content of the "Version" variable. A shorthand "v" flag will also be added if the + // command does not define one. + Version string + // The *Run functions are executed in the following order: // * PersistentPreRun() // * PreRun() // * Run() // * PostRun() // * PersistentPostRun() - // All functions get the same args, the arguments after the command name - // PersistentPreRun: children of this command will inherit and execute + // All functions get the same args, the arguments after the command name. + // + // PersistentPreRun: children of this command will inherit and execute. PersistentPreRun func(cmd *Command, args []string) - // PersistentPreRunE: PersistentPreRun but returns an error + // PersistentPreRunE: PersistentPreRun but returns an error. PersistentPreRunE func(cmd *Command, args []string) error // PreRun: children of this command will not inherit. PreRun func(cmd *Command, args []string) - // PreRunE: PreRun but returns an error + // PreRunE: PreRun but returns an error. PreRunE func(cmd *Command, args []string) error - // Run: Typically the actual work function. Most commands will only implement this + // Run: Typically the actual work function. Most commands will only implement this. Run func(cmd *Command, args []string) - // RunE: Run but returns an error + // RunE: Run but returns an error. RunE func(cmd *Command, args []string) error // PostRun: run after the Run command. PostRun func(cmd *Command, args []string) - // PostRunE: PostRun but returns an error + // PostRunE: PostRun but returns an error. PostRunE func(cmd *Command, args []string) error - // PersistentPostRun: children of this command will inherit and execute after PostRun + // PersistentPostRun: children of this command will inherit and execute after PostRun. PersistentPostRun func(cmd *Command, args []string) - // PersistentPostRunE: PersistentPostRun but returns an error + // PersistentPostRunE: PersistentPostRun but returns an error. PersistentPostRunE func(cmd *Command, args []string) error - // DisableAutoGenTag remove - DisableAutoGenTag bool - // Commands is the list of commands supported by this program. + + // args is actual args parsed from flags. + args []string + // flagErrorBuf contains all error messages from pflag. + flagErrorBuf *bytes.Buffer + // flags is full set of flags. + flags *flag.FlagSet + // pflags contains persistent flags. + pflags *flag.FlagSet + // lflags contains local flags. + lflags *flag.FlagSet + // iflags contains inherited flags. + iflags *flag.FlagSet + // parentsPflags is all persistent flags of cmd's parents. + parentsPflags *flag.FlagSet + // globNormFunc is the global normalization function + // that we can use on every pflag set and children commands + globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName + + // usageFunc is usage func defined by user. + usageFunc func(*Command) error + // usageTemplate is usage template defined by user. + usageTemplate string + // flagErrorFunc is func defined by user and it's called when the parsing of + // flags returns an error. + flagErrorFunc func(*Command, error) error + // helpTemplate is help template defined by user. + helpTemplate string + // helpFunc is help func defined by user. + helpFunc func(*Command, []string) + // helpCommand is command with usage 'help'. If it's not defined by user, + // cobra uses default help command. + helpCommand *Command + // versionTemplate is the version template defined by user. + versionTemplate string + + // inReader is a reader defined by the user that replaces stdin + inReader io.Reader + // outWriter is a writer defined by the user that replaces stdout + outWriter io.Writer + // errWriter is a writer defined by the user that replaces stderr + errWriter io.Writer + + //FParseErrWhitelist flag parse errors to be ignored + FParseErrWhitelist FParseErrWhitelist + + // commandsAreSorted defines, if command slice are sorted or not. + commandsAreSorted bool + // commandCalledAs is the name or alias value used to call this command. + commandCalledAs struct { + name string + called bool + } + + ctx context.Context + + // commands is the list of commands supported by this program. commands []*Command - // Parent Command for this command + // parent is a parent command for this command. parent *Command - // max lengths of commands' string lengths for use in padding + // Max lengths of commands' string lengths for use in padding. commandsMaxUseLen int commandsMaxCommandPathLen int commandsMaxNameLen int - // is commands slice are sorted or not - commandsAreSorted bool - flagErrorBuf *bytes.Buffer + // TraverseChildren parses flags on all parents before executing child command. + TraverseChildren bool - args []string // actual args parsed from flags - output io.Writer // out writer if set in SetOutput(w) - usageFunc func(*Command) error // Usage can be defined by application - usageTemplate string // Can be defined by Application - flagErrorFunc func(*Command, error) error - helpTemplate string // Can be defined by Application - helpFunc func(*Command, []string) // Help can be defined by application - helpCommand *Command // The help command - // The global normalization function that we can use on every pFlag set and children commands - globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName + // Hidden defines, if this command is hidden and should NOT show up in the list of available commands. + Hidden bool - // Disable the suggestions based on Levenshtein distance that go along with 'unknown command' messages + // SilenceErrors is an option to quiet errors down stream. + SilenceErrors bool + + // SilenceUsage is an option to silence usage when an error occurs. + SilenceUsage bool + + // DisableFlagParsing disables the flag parsing. + // If this is true all flags will be passed to the command as arguments. + DisableFlagParsing bool + + // DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...") + // will be printed by generating docs for this command. + DisableAutoGenTag bool + + // DisableFlagsInUseLine will disable the addition of [flags] to the usage + // line of a command when printing help or generating docs + DisableFlagsInUseLine bool + + // DisableSuggestions disables the suggestions based on Levenshtein distance + // that go along with 'unknown command' messages. DisableSuggestions bool - // If displaying suggestions, allows to set the minimum levenshtein distance to display, must be > 0 + + // SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions. + // Must be > 0. SuggestionsMinimumDistance int +} - // Disable the flag parsing. If this is true all flags will be passed to the command as arguments. - DisableFlagParsing bool +// Context returns underlying command context. If command wasn't +// executed with ExecuteContext Context returns Background context. +func (c *Command) Context() context.Context { + return c.ctx } // SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden @@ -140,8 +234,28 @@ func (c *Command) SetArgs(a []string) { // SetOutput sets the destination for usage and error messages. // If output is nil, os.Stderr is used. +// Deprecated: Use SetOut and/or SetErr instead func (c *Command) SetOutput(output io.Writer) { - c.output = output + c.outWriter = output + c.errWriter = output +} + +// SetOut sets the destination for usage messages. +// If newOut is nil, os.Stdout is used. +func (c *Command) SetOut(newOut io.Writer) { + c.outWriter = newOut +} + +// SetErr sets the destination for error messages. +// If newErr is nil, os.Stderr is used. +func (c *Command) SetErr(newErr io.Writer) { + c.errWriter = newErr +} + +// SetIn sets the source for input data +// If newIn is nil, os.Stdin is used. +func (c *Command) SetIn(newIn io.Reader) { + c.inReader = newIn } // SetUsageFunc sets usage function. Usage can be defined by application. @@ -175,6 +289,11 @@ func (c *Command) SetHelpTemplate(s string) { c.helpTemplate = s } +// SetVersionTemplate sets version template to be used. Application can use it to set custom template. +func (c *Command) SetVersionTemplate(s string) { + c.versionTemplate = s +} + // SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands. // The user should not have a cyclic dependency on commands. func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string) flag.NormalizedName) { @@ -197,9 +316,19 @@ func (c *Command) OutOrStderr() io.Writer { return c.getOut(os.Stderr) } +// ErrOrStderr returns output to stderr +func (c *Command) ErrOrStderr() io.Writer { + return c.getErr(os.Stderr) +} + +// InOrStdin returns input to stdin +func (c *Command) InOrStdin() io.Reader { + return c.getIn(os.Stdin) +} + func (c *Command) getOut(def io.Writer) io.Writer { - if c.output != nil { - return c.output + if c.outWriter != nil { + return c.outWriter } if c.HasParent() { return c.parent.getOut(def) @@ -207,21 +336,40 @@ func (c *Command) getOut(def io.Writer) io.Writer { return def } +func (c *Command) getErr(def io.Writer) io.Writer { + if c.errWriter != nil { + return c.errWriter + } + if c.HasParent() { + return c.parent.getErr(def) + } + return def +} + +func (c *Command) getIn(def io.Reader) io.Reader { + if c.inReader != nil { + return c.inReader + } + if c.HasParent() { + return c.parent.getIn(def) + } + return def +} + // UsageFunc returns either the function set by SetUsageFunc for this command // or a parent, or it returns a default usage function. func (c *Command) UsageFunc() (f func(*Command) error) { if c.usageFunc != nil { return c.usageFunc } - if c.HasParent() { - return c.parent.UsageFunc() + return c.Parent().UsageFunc() } return func(c *Command) error { c.mergePersistentFlags() err := tmpl(c.OutOrStderr(), c.UsageTemplate(), c) if err != nil { - c.Println(err) + c.PrintErrln(err) } return err } @@ -237,32 +385,23 @@ func (c *Command) Usage() error { // HelpFunc returns either the function set by SetHelpFunc for this command // or a parent, or it returns a function with default help behavior. func (c *Command) HelpFunc() func(*Command, []string) { - if helpFunc := c.checkHelpFunc(); helpFunc != nil { - return helpFunc + if c.helpFunc != nil { + return c.helpFunc } - return func(*Command, []string) { + if c.HasParent() { + return c.Parent().HelpFunc() + } + return func(c *Command, a []string) { c.mergePersistentFlags() + // The help should be sent to stdout + // See https://github.com/spf13/cobra/issues/1002 err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c) if err != nil { - c.Println(err) + c.PrintErrln(err) } } } -// checkHelpFunc checks if there is helpFunc in ancestors of c. -func (c *Command) checkHelpFunc() func(*Command, []string) { - if c == nil { - return nil - } - if c.helpFunc != nil { - return c.helpFunc - } - if c.HasParent() { - return c.parent.checkHelpFunc() - } - return nil -} - // Help puts out the help for the command. // Used when a user calls help [command]. // Can be defined by user by overriding HelpFunc. @@ -271,13 +410,22 @@ func (c *Command) Help() error { return nil } -// UsageString return usage string. +// UsageString returns usage string. func (c *Command) UsageString() string { - tmpOutput := c.output + // Storing normal writers + tmpOutput := c.outWriter + tmpErr := c.errWriter + bb := new(bytes.Buffer) - c.SetOutput(bb) - c.Usage() - c.output = tmpOutput + c.outWriter = bb + c.errWriter = bb + + CheckErr(c.Usage()) + + // Setting things back to normal + c.outWriter = tmpOutput + c.errWriter = tmpErr + return bb.String() } @@ -337,23 +485,23 @@ func (c *Command) UsageTemplate() string { return c.parent.UsageTemplate() } return `Usage:{{if .Runnable}} - {{if .HasAvailableFlags}}{{appendIfNotPresent .UseLine "[flags]"}}{{else}}{{.UseLine}}{{end}}{{end}}{{if .HasAvailableSubCommands}} - {{ .CommandPath}} [command]{{end}}{{if gt .Aliases 0}} + {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}} + {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}} Aliases: {{.NameAndAliases}}{{end}}{{if .HasExample}} Examples: -{{ .Example }}{{end}}{{if .HasAvailableSubCommands}} +{{.Example}}{{end}}{{if .HasAvailableSubCommands}} Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}} {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}} Flags: -{{.LocalFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasAvailableInheritedFlags}} +{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}} Global Flags: -{{.InheritedFlags.FlagUsages | trimRightSpace}}{{end}}{{if .HasHelpSubCommands}} +{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}} Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}} {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}} @@ -371,70 +519,76 @@ func (c *Command) HelpTemplate() string { if c.HasParent() { return c.parent.HelpTemplate() } - return `{{with or .Long .Short }}{{. | trim}} + return `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}} {{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}` } -// Really only used when casting a command to a commander. -func (c *Command) resetChildrensParents() { - for _, x := range c.commands { - x.parent = c +// VersionTemplate return version template for the command. +func (c *Command) VersionTemplate() string { + if c.versionTemplate != "" { + return c.versionTemplate + } + + if c.HasParent() { + return c.parent.VersionTemplate() } + return `{{with .Name}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}} +` } -func hasNoOptDefVal(name string, f *flag.FlagSet) bool { - flag := f.Lookup(name) +func hasNoOptDefVal(name string, fs *flag.FlagSet) bool { + flag := fs.Lookup(name) if flag == nil { return false } - return len(flag.NoOptDefVal) > 0 + return flag.NoOptDefVal != "" } func shortHasNoOptDefVal(name string, fs *flag.FlagSet) bool { - result := false - fs.VisitAll(func(flag *flag.Flag) { - if flag.Shorthand == name && len(flag.NoOptDefVal) > 0 { - result = true - } - }) - return result + if len(name) == 0 { + return false + } + + flag := fs.ShorthandLookup(name[:1]) + if flag == nil { + return false + } + return flag.NoOptDefVal != "" } func stripFlags(args []string, c *Command) []string { - if len(args) < 1 { + if len(args) == 0 { return args } c.mergePersistentFlags() commands := []string{} - - inQuote := false - inFlag := false - for _, y := range args { - if !inQuote { - switch { - case strings.HasPrefix(y, "\""): - inQuote = true - case strings.Contains(y, "=\""): - inQuote = true - case strings.HasPrefix(y, "--") && !strings.Contains(y, "="): - // TODO: this isn't quite right, we should really check ahead for 'true' or 'false' - inFlag = !hasNoOptDefVal(y[2:], c.Flags()) - case strings.HasPrefix(y, "-") && !strings.Contains(y, "=") && len(y) == 2 && !shortHasNoOptDefVal(y[1:], c.Flags()): - inFlag = true - case inFlag: - inFlag = false - case y == "": - // strip empty commands, as the go tests expect this to be ok.... - case !strings.HasPrefix(y, "-"): - commands = append(commands, y) - inFlag = false + flags := c.Flags() + +Loop: + for len(args) > 0 { + s := args[0] + args = args[1:] + switch { + case s == "--": + // "--" terminates the flags + break Loop + case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags): + // If '--flag arg' then + // delete arg from args. + fallthrough // (do the same as below) + case strings.HasPrefix(s, "-") && !strings.Contains(s, "=") && len(s) == 2 && !shortHasNoOptDefVal(s[1:], flags): + // If '-f arg' then + // delete 'arg' from args or break the loop if len(args) <= 1. + if len(args) <= 1 { + break Loop + } else { + args = args[1:] + continue } - } - - if strings.HasSuffix(y, "\"") && !strings.HasSuffix(y, "\\\"") { - inQuote = false + case s != "" && !strings.HasPrefix(s, "-"): + commands = append(commands, s) } } @@ -455,13 +609,14 @@ func argsMinusFirstX(args []string, x string) []string { return args } +func isFlagArg(arg string) bool { + return ((len(arg) >= 3 && arg[1] == '-') || + (len(arg) >= 2 && arg[0] == '-' && arg[1] != '-')) +} + // Find the target command given the args and command tree // Meant to be run on the highest node. Only searches down. func (c *Command) Find(args []string) (*Command, []string, error) { - if c == nil { - return nil, nil, fmt.Errorf("Called find() on a nil Command") - } - var innerfind func(*Command, []string) (*Command, []string) innerfind = func(c *Command, innerArgs []string) (*Command, []string) { @@ -470,57 +625,98 @@ func (c *Command) Find(args []string) (*Command, []string, error) { return c, innerArgs } nextSubCmd := argsWOflags[0] - matches := make([]*Command, 0) - for _, cmd := range c.commands { - if cmd.Name() == nextSubCmd || cmd.HasAlias(nextSubCmd) { // exact name or alias match - return innerfind(cmd, argsMinusFirstX(innerArgs, nextSubCmd)) - } - if EnablePrefixMatching { - if strings.HasPrefix(cmd.Name(), nextSubCmd) { // prefix match - matches = append(matches, cmd) - } - for _, x := range cmd.Aliases { - if strings.HasPrefix(x, nextSubCmd) { - matches = append(matches, cmd) - } - } - } - } - // only accept a single prefix match - multiple matches would be ambiguous - if len(matches) == 1 { - return innerfind(matches[0], argsMinusFirstX(innerArgs, argsWOflags[0])) + cmd := c.findNext(nextSubCmd) + if cmd != nil { + return innerfind(cmd, argsMinusFirstX(innerArgs, nextSubCmd)) } - return c, innerArgs } commandFound, a := innerfind(c, args) - argsWOflags := stripFlags(a, commandFound) + if commandFound.Args == nil { + return commandFound, a, legacyArgs(commandFound, stripFlags(a, commandFound)) + } + return commandFound, a, nil +} - // no subcommand, always take args - if !commandFound.HasSubCommands() { - return commandFound, a, nil +func (c *Command) findSuggestions(arg string) string { + if c.DisableSuggestions { + return "" } + if c.SuggestionsMinimumDistance <= 0 { + c.SuggestionsMinimumDistance = 2 + } + suggestionsString := "" + if suggestions := c.SuggestionsFor(arg); len(suggestions) > 0 { + suggestionsString += "\n\nDid you mean this?\n" + for _, s := range suggestions { + suggestionsString += fmt.Sprintf("\t%v\n", s) + } + } + return suggestionsString +} - // root command with subcommands, do subcommand checking - if commandFound == c && len(argsWOflags) > 0 { - suggestionsString := "" - if !c.DisableSuggestions { - if c.SuggestionsMinimumDistance <= 0 { - c.SuggestionsMinimumDistance = 2 - } - if suggestions := c.SuggestionsFor(argsWOflags[0]); len(suggestions) > 0 { - suggestionsString += "\n\nDid you mean this?\n" - for _, s := range suggestions { - suggestionsString += fmt.Sprintf("\t%v\n", s) - } - } +func (c *Command) findNext(next string) *Command { + matches := make([]*Command, 0) + for _, cmd := range c.commands { + if cmd.Name() == next || cmd.HasAlias(next) { + cmd.commandCalledAs.name = next + return cmd + } + if EnablePrefixMatching && cmd.hasNameOrAliasPrefix(next) { + matches = append(matches, cmd) } - return commandFound, a, fmt.Errorf("unknown command %q for %q%s", argsWOflags[0], commandFound.CommandPath(), suggestionsString) } - return commandFound, a, nil + if len(matches) == 1 { + return matches[0] + } + + return nil +} + +// Traverse the command tree to find the command, and parse args for +// each parent. +func (c *Command) Traverse(args []string) (*Command, []string, error) { + flags := []string{} + inFlag := false + + for i, arg := range args { + switch { + // A long flag with a space separated value + case strings.HasPrefix(arg, "--") && !strings.Contains(arg, "="): + // TODO: this isn't quite right, we should really check ahead for 'true' or 'false' + inFlag = !hasNoOptDefVal(arg[2:], c.Flags()) + flags = append(flags, arg) + continue + // A short flag with a space separated value + case strings.HasPrefix(arg, "-") && !strings.Contains(arg, "=") && len(arg) == 2 && !shortHasNoOptDefVal(arg[1:], c.Flags()): + inFlag = true + flags = append(flags, arg) + continue + // The value for a flag + case inFlag: + inFlag = false + flags = append(flags, arg) + continue + // A flag without a value, or with an `=` separated value + case isFlagArg(arg): + flags = append(flags, arg) + continue + } + + cmd := c.findNext(arg) + if cmd == nil { + return c, args, nil + } + + if err := c.ParseFlags(flags); err != nil { + return nil, args, err + } + return cmd.Traverse(args[i+1:]) + } + return c, args, nil } // SuggestionsFor provides suggestions for the typedName. @@ -546,38 +742,22 @@ func (c *Command) SuggestionsFor(typedName string) []string { // VisitParents visits all parents of the command and invokes fn on each parent. func (c *Command) VisitParents(fn func(*Command)) { - var traverse func(*Command) *Command - - traverse = func(x *Command) *Command { - if x != c { - fn(x) - } - if x.HasParent() { - return traverse(x.parent) - } - return x + if c.HasParent() { + fn(c.Parent()) + c.Parent().VisitParents(fn) } - traverse(c) } // Root finds root command. func (c *Command) Root() *Command { - var findRoot func(*Command) *Command - - findRoot = func(x *Command) *Command { - if x.HasParent() { - return findRoot(x.parent) - } - return x + if c.HasParent() { + return c.Parent().Root() } - - return findRoot(c) + return c } -// ArgsLenAtDash will return the length of f.Args at the moment when a -- was -// found during arg parsing. This allows your program to know which args were -// before the -- and which came after. (Description from -// https://godoc.org/github.com/spf13/pflag#FlagSet.ArgsLenAtDash). +// ArgsLenAtDash will return the length of c.Flags().Args at the moment +// when a -- was found during args parsing. func (c *Command) ArgsLenAtDash() int { return c.Flags().ArgsLenAtDash() } @@ -591,25 +771,47 @@ func (c *Command) execute(a []string) (err error) { c.Printf("Command %q is deprecated, %s\n", c.Name(), c.Deprecated) } - // initialize help flag as the last point possible to allow for user + // initialize help and version flag at the last point possible to allow for user // overriding - c.initHelpFlag() + c.InitDefaultHelpFlag() + c.InitDefaultVersionFlag() err = c.ParseFlags(a) if err != nil { return c.FlagErrorFunc()(c, err) } - // If help is called, regardless of other flags, return we want help + + // If help is called, regardless of other flags, return we want help. // Also say we need help if the command isn't runnable. helpVal, err := c.Flags().GetBool("help") if err != nil { // should be impossible to get here as we always declare a help - // flag in initHelpFlag() + // flag in InitDefaultHelpFlag() c.Println("\"help\" flag declared as non-bool. Please correct your code") return err } - if helpVal || !c.Runnable() { + if helpVal { + return flag.ErrHelp + } + + // for back-compat, only add version flag behavior if version is defined + if c.Version != "" { + versionVal, err := c.Flags().GetBool("version") + if err != nil { + c.Println("\"version\" flag declared as non-bool. Please correct your code") + return err + } + if versionVal { + err := tmpl(c.OutOrStdout(), c.VersionTemplate(), c) + if err != nil { + c.Println(err) + } + return err + } + } + + if !c.Runnable() { return flag.ErrHelp } @@ -620,6 +822,10 @@ func (c *Command) execute(a []string) (err error) { argWoFlags = a } + if err := c.ValidateArgs(argWoFlags); err != nil { + return err + } + for p := c; p != nil; p = p.Parent() { if p.PersistentPreRunE != nil { if err := p.PersistentPreRunE(c, argWoFlags); err != nil { @@ -639,6 +845,9 @@ func (c *Command) execute(a []string) (err error) { c.PreRun(c, argWoFlags) } + if err := c.validateRequiredFlags(); err != nil { + return err + } if c.RunE != nil { if err := c.RunE(c, argWoFlags); err != nil { return err @@ -674,18 +883,14 @@ func (c *Command) preRun() { } } -func (c *Command) errorMsgFromParse() string { - s := c.flagErrorBuf.String() - - x := strings.Split(s, "\n") - - if len(x) > 0 { - return x[0] - } - return "" +// ExecuteContext is the same as Execute(), but sets the ctx on the command. +// Retrieve ctx by calling cmd.Context() inside your *Run lifecycle functions. +func (c *Command) ExecuteContext(ctx context.Context) error { + c.ctx = ctx + return c.Execute() } -// Execute Call execute to use the args (os.Args[1:] by default) +// Execute uses the args (os.Args[1:] by default) // and run through the command tree finding appropriate matches // for commands and then corresponding flags. func (c *Command) Execute() error { @@ -695,6 +900,10 @@ func (c *Command) Execute() error { // ExecuteC executes the command. func (c *Command) ExecuteC() (cmd *Command, err error) { + if c.ctx == nil { + c.ctx = context.Background() + } + // Regardless of what command execute is called on, run on Root only if c.HasParent() { return c.Root().ExecuteC() @@ -707,29 +916,47 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { // initialize help as the last point possible to allow for user // overriding - c.initHelpCmd() + c.InitDefaultHelpCmd() - var args []string + args := c.args // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155 if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" { args = os.Args[1:] - } else { - args = c.args } - cmd, flags, err := c.Find(args) + // initialize the hidden command to be used for bash completion + c.initCompleteCmd(args) + + var flags []string + if c.TraverseChildren { + cmd, flags, err = c.Traverse(args) + } else { + cmd, flags, err = c.Find(args) + } if err != nil { // If found parse to a subcommand and then failed, talk about the subcommand if cmd != nil { c = cmd } if !c.SilenceErrors { - c.Println("Error:", err.Error()) - c.Printf("Run '%v --help' for usage.\n", c.CommandPath()) + c.PrintErrln("Error:", err.Error()) + c.PrintErrf("Run '%v --help' for usage.\n", c.CommandPath()) } return c, err } + + cmd.commandCalledAs.called = true + if cmd.commandCalledAs.name == "" { + cmd.commandCalledAs.name = cmd.Name() + } + + // We have to pass global context to children command + // if context is present on the parent command. + if cmd.ctx == nil { + cmd.ctx = c.ctx + } + err = cmd.execute(flags) if err != nil { // Always show help if requested, even if SilenceErrors is in @@ -739,50 +966,133 @@ func (c *Command) ExecuteC() (cmd *Command, err error) { return cmd, nil } - // If root command has SilentErrors flagged, + // If root command has SilenceErrors flagged, // all subcommands should respect it if !cmd.SilenceErrors && !c.SilenceErrors { - c.Println("Error:", err.Error()) + c.PrintErrln("Error:", err.Error()) } - // If root command has SilentUsage flagged, + // If root command has SilenceUsage flagged, // all subcommands should respect it if !cmd.SilenceUsage && !c.SilenceUsage { c.Println(cmd.UsageString()) } - return cmd, err } - return cmd, nil + return cmd, err +} + +func (c *Command) ValidateArgs(args []string) error { + if c.Args == nil { + return nil + } + return c.Args(c, args) } -func (c *Command) initHelpFlag() { +func (c *Command) validateRequiredFlags() error { + if c.DisableFlagParsing { + return nil + } + + flags := c.Flags() + missingFlagNames := []string{} + flags.VisitAll(func(pflag *flag.Flag) { + requiredAnnotation, found := pflag.Annotations[BashCompOneRequiredFlag] + if !found { + return + } + if (requiredAnnotation[0] == "true") && !pflag.Changed { + missingFlagNames = append(missingFlagNames, pflag.Name) + } + }) + + if len(missingFlagNames) > 0 { + return fmt.Errorf(`required flag(s) "%s" not set`, strings.Join(missingFlagNames, `", "`)) + } + return nil +} + +// InitDefaultHelpFlag adds default help flag to c. +// It is called automatically by executing the c or by calling help and usage. +// If c already has help flag, it will do nothing. +func (c *Command) InitDefaultHelpFlag() { c.mergePersistentFlags() if c.Flags().Lookup("help") == nil { - c.Flags().BoolP("help", "h", false, "help for "+c.Name()) + usage := "help for " + if c.Name() == "" { + usage += "this command" + } else { + usage += c.Name() + } + c.Flags().BoolP("help", "h", false, usage) } } -func (c *Command) initHelpCmd() { - if c.helpCommand == nil { - if !c.HasSubCommands() { - return +// InitDefaultVersionFlag adds default version flag to c. +// It is called automatically by executing the c. +// If c already has a version flag, it will do nothing. +// If c.Version is empty, it will do nothing. +func (c *Command) InitDefaultVersionFlag() { + if c.Version == "" { + return + } + + c.mergePersistentFlags() + if c.Flags().Lookup("version") == nil { + usage := "version for " + if c.Name() == "" { + usage += "this command" + } else { + usage += c.Name() } + if c.Flags().ShorthandLookup("v") == nil { + c.Flags().BoolP("version", "v", false, usage) + } else { + c.Flags().Bool("version", false, usage) + } + } +} + +// InitDefaultHelpCmd adds default help command to c. +// It is called automatically by executing the c or by calling help and usage. +// If c already has help command or c has no subcommands, it will do nothing. +func (c *Command) InitDefaultHelpCmd() { + if !c.HasSubCommands() { + return + } + if c.helpCommand == nil { c.helpCommand = &Command{ Use: "help [command]", Short: "Help about any command", Long: `Help provides help for any command in the application. - Simply type ` + c.Name() + ` help [path to command] for full details.`, - PersistentPreRun: func(cmd *Command, args []string) {}, - PersistentPostRun: func(cmd *Command, args []string) {}, - +Simply type ` + c.Name() + ` help [path to command] for full details.`, + ValidArgsFunction: func(c *Command, args []string, toComplete string) ([]string, ShellCompDirective) { + var completions []string + cmd, _, e := c.Root().Find(args) + if e != nil { + return nil, ShellCompDirectiveNoFileComp + } + if cmd == nil { + // Root help command. + cmd = c.Root() + } + for _, subCmd := range cmd.Commands() { + if subCmd.IsAvailableCommand() || subCmd == cmd.helpCommand { + if strings.HasPrefix(subCmd.Name(), toComplete) { + completions = append(completions, fmt.Sprintf("%s\t%s", subCmd.Name(), subCmd.Short)) + } + } + } + return completions, ShellCompDirectiveNoFileComp + }, Run: func(c *Command, args []string) { cmd, _, e := c.Root().Find(args) if cmd == nil || e != nil { c.Printf("Unknown help topic %#q\n", args) - c.Root().Usage() + CheckErr(c.Root().Usage()) } else { - cmd.Help() + cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown + CheckErr(cmd.Help()) } }, } @@ -791,10 +1101,12 @@ func (c *Command) initHelpCmd() { c.AddCommand(c.helpCommand) } -// ResetCommands used for testing. +// ResetCommands delete parent, subcommand and help command from c. func (c *Command) ResetCommands() { + c.parent = nil c.commands = nil c.helpCommand = nil + c.parentsPflags = nil } // Sorts commands by their names. @@ -884,34 +1196,52 @@ func (c *Command) Print(i ...interface{}) { // Println is a convenience method to Println to the defined output, fallback to Stderr if not set. func (c *Command) Println(i ...interface{}) { - str := fmt.Sprintln(i...) - c.Print(str) + c.Print(fmt.Sprintln(i...)) } // Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set. func (c *Command) Printf(format string, i ...interface{}) { - str := fmt.Sprintf(format, i...) - c.Print(str) + c.Print(fmt.Sprintf(format, i...)) +} + +// PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set. +func (c *Command) PrintErr(i ...interface{}) { + fmt.Fprint(c.ErrOrStderr(), i...) +} + +// PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set. +func (c *Command) PrintErrln(i ...interface{}) { + c.PrintErr(fmt.Sprintln(i...)) +} + +// PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set. +func (c *Command) PrintErrf(format string, i ...interface{}) { + c.PrintErr(fmt.Sprintf(format, i...)) } // CommandPath returns the full path to this command. func (c *Command) CommandPath() string { - str := c.Name() - x := c - for x.HasParent() { - str = x.parent.Name() + " " + str - x = x.parent + if c.HasParent() { + return c.Parent().CommandPath() + " " + c.Name() } - return str + return c.Name() } // UseLine puts out the full usage for a given command (including parents). func (c *Command) UseLine() string { - str := "" + var useline string if c.HasParent() { - str = c.parent.CommandPath() + " " + useline = c.parent.CommandPath() + " " + c.Use + } else { + useline = c.Use + } + if c.DisableFlagsInUseLine { + return useline } - return str + c.Use + if c.HasAvailableFlags() && !strings.Contains(useline, "[flags]") { + useline += " [flags]" + } + return useline } // DebugFlags used to determine which flags have been assigned to which commands @@ -926,12 +1256,8 @@ func (c *Command) DebugFlags() { } if x.HasFlags() { x.flags.VisitAll(func(f *flag.Flag) { - if x.HasPersistentFlags() { - if x.persistentFlag(f.Name) == nil { - c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [L]") - } else { - c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [LP]") - } + if x.HasPersistentFlags() && x.persistentFlag(f.Name) != nil { + c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [LP]") } else { c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [L]") } @@ -961,16 +1287,12 @@ func (c *Command) DebugFlags() { // Name returns the command's name: the first word in the use line. func (c *Command) Name() string { - if c.name != "" { - return c.name - } name := c.Use i := strings.Index(name, " ") if i >= 0 { name = name[:i] } - c.name = name - return c.name + return name } // HasAlias determines if a given string is an alias of the command. @@ -983,7 +1305,32 @@ func (c *Command) HasAlias(s string) bool { return false } -// NameAndAliases returns string containing name and all aliases +// CalledAs returns the command name or alias that was used to invoke +// this command or an empty string if the command has not been called. +func (c *Command) CalledAs() string { + if c.commandCalledAs.called { + return c.commandCalledAs.name + } + return "" +} + +// hasNameOrAliasPrefix returns true if the Name or any of aliases start +// with prefix +func (c *Command) hasNameOrAliasPrefix(prefix string) bool { + if strings.HasPrefix(c.Name(), prefix) { + c.commandCalledAs.name = c.Name() + return true + } + for _, alias := range c.Aliases { + if strings.HasPrefix(alias, prefix) { + c.commandCalledAs.name = alias + return true + } + } + return false +} + +// NameAndAliases returns a list of the command name and all aliases func (c *Command) NameAndAliases() string { return strings.Join(append([]string{c.Name()}, c.Aliases...), ", ") } @@ -1069,7 +1416,7 @@ func (c *Command) HasAvailableSubCommands() bool { } } - // the command either has no sub comamnds, or no available (non deprecated/help/hidden) + // the command either has no sub commands, or no available (non deprecated/help/hidden) // sub commands return false } @@ -1079,7 +1426,7 @@ func (c *Command) HasParent() bool { return c.parent != nil } -// GlobalNormalizationFunc returns the global normalization function or nil if doesn't exists. +// GlobalNormalizationFunc returns the global normalization function or nil if it doesn't exist. func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName { return c.globNormFunc } @@ -1094,6 +1441,7 @@ func (c *Command) Flags() *flag.FlagSet { } c.flags.SetOutput(c.flagErrorBuf) } + return c.flags } @@ -1114,47 +1462,51 @@ func (c *Command) LocalNonPersistentFlags() *flag.FlagSet { func (c *Command) LocalFlags() *flag.FlagSet { c.mergePersistentFlags() - local := flag.NewFlagSet(c.Name(), flag.ContinueOnError) - c.lflags.VisitAll(func(f *flag.Flag) { - local.AddFlag(f) - }) - if !c.HasParent() { - flag.CommandLine.VisitAll(func(f *flag.Flag) { - if local.Lookup(f.Name) == nil { - local.AddFlag(f) - } - }) + if c.lflags == nil { + c.lflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + if c.flagErrorBuf == nil { + c.flagErrorBuf = new(bytes.Buffer) + } + c.lflags.SetOutput(c.flagErrorBuf) } - return local + c.lflags.SortFlags = c.Flags().SortFlags + if c.globNormFunc != nil { + c.lflags.SetNormalizeFunc(c.globNormFunc) + } + + addToLocal := func(f *flag.Flag) { + if c.lflags.Lookup(f.Name) == nil && c.parentsPflags.Lookup(f.Name) == nil { + c.lflags.AddFlag(f) + } + } + c.Flags().VisitAll(addToLocal) + c.PersistentFlags().VisitAll(addToLocal) + return c.lflags } -// InheritedFlags returns all flags which were inherited from parents commands. +// InheritedFlags returns all flags which were inherited from parent commands. func (c *Command) InheritedFlags() *flag.FlagSet { c.mergePersistentFlags() - inherited := flag.NewFlagSet(c.Name(), flag.ContinueOnError) - local := c.LocalFlags() - - var rmerge func(x *Command) - - rmerge = func(x *Command) { - if x.HasPersistentFlags() { - x.PersistentFlags().VisitAll(func(f *flag.Flag) { - if inherited.Lookup(f.Name) == nil && local.Lookup(f.Name) == nil { - inherited.AddFlag(f) - } - }) - } - if x.HasParent() { - rmerge(x.parent) + if c.iflags == nil { + c.iflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + if c.flagErrorBuf == nil { + c.flagErrorBuf = new(bytes.Buffer) } + c.iflags.SetOutput(c.flagErrorBuf) } - if c.HasParent() { - rmerge(c.parent) + local := c.LocalFlags() + if c.globNormFunc != nil { + c.iflags.SetNormalizeFunc(c.globNormFunc) } - return inherited + c.parentsPflags.VisitAll(func(f *flag.Flag) { + if c.iflags.Lookup(f.Name) == nil && local.Lookup(f.Name) == nil { + c.iflags.AddFlag(f) + } + }) + return c.iflags } // NonInheritedFlags returns all flags which were not inherited from parent commands. @@ -1174,7 +1526,7 @@ func (c *Command) PersistentFlags() *flag.FlagSet { return c.pflags } -// ResetFlags is used in testing. +// ResetFlags deletes all flags from command. func (c *Command) ResetFlags() { c.flagErrorBuf = new(bytes.Buffer) c.flagErrorBuf.Reset() @@ -1182,6 +1534,10 @@ func (c *Command) ResetFlags() { c.flags.SetOutput(c.flagErrorBuf) c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) c.pflags.SetOutput(c.flagErrorBuf) + + c.lflags = nil + c.iflags = nil + c.parentsPflags = nil } // HasFlags checks if the command contains any flags (local plus persistent from the entire structure). @@ -1244,20 +1600,35 @@ func (c *Command) persistentFlag(name string) (flag *flag.Flag) { flag = c.PersistentFlags().Lookup(name) } - if flag == nil && c.HasParent() { - flag = c.parent.persistentFlag(name) + if flag == nil { + c.updateParentsPflags() + flag = c.parentsPflags.Lookup(name) } return } // ParseFlags parses persistent flag tree and local flags. -func (c *Command) ParseFlags(args []string) (err error) { +func (c *Command) ParseFlags(args []string) error { if c.DisableFlagParsing { return nil } + + if c.flagErrorBuf == nil { + c.flagErrorBuf = new(bytes.Buffer) + } + beforeErrorBufLen := c.flagErrorBuf.Len() c.mergePersistentFlags() - err = c.Flags().Parse(args) - return + + // do it here after merging all flags and just before parse + c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist) + + err := c.Flags().Parse(args) + // Print warnings if they occurred (e.g. deprecated flag messages). + if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil { + c.Print(c.flagErrorBuf.String()) + } + + return err } // Parent returns a commands parent command. @@ -1265,41 +1636,31 @@ func (c *Command) Parent() *Command { return c.parent } +// mergePersistentFlags merges c.PersistentFlags() to c.Flags() +// and adds missing persistent flags of all parents. func (c *Command) mergePersistentFlags() { - var rmerge func(x *Command) + c.updateParentsPflags() + c.Flags().AddFlagSet(c.PersistentFlags()) + c.Flags().AddFlagSet(c.parentsPflags) +} - // Save the set of local flags - if c.lflags == nil { - c.lflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) - if c.flagErrorBuf == nil { - c.flagErrorBuf = new(bytes.Buffer) - } - c.lflags.SetOutput(c.flagErrorBuf) - addtolocal := func(f *flag.Flag) { - c.lflags.AddFlag(f) - } - c.Flags().VisitAll(addtolocal) - c.PersistentFlags().VisitAll(addtolocal) - } - rmerge = func(x *Command) { - if !x.HasParent() { - flag.CommandLine.VisitAll(func(f *flag.Flag) { - if x.PersistentFlags().Lookup(f.Name) == nil { - x.PersistentFlags().AddFlag(f) - } - }) - } - if x.HasPersistentFlags() { - x.PersistentFlags().VisitAll(func(f *flag.Flag) { - if c.Flags().Lookup(f.Name) == nil { - c.Flags().AddFlag(f) - } - }) - } - if x.HasParent() { - rmerge(x.parent) - } +// updateParentsPflags updates c.parentsPflags by adding +// new persistent flags of all parents. +// If c.parentsPflags == nil, it makes new. +func (c *Command) updateParentsPflags() { + if c.parentsPflags == nil { + c.parentsPflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError) + c.parentsPflags.SetOutput(c.flagErrorBuf) + c.parentsPflags.SortFlags = false } - rmerge(c) + if c.globNormFunc != nil { + c.parentsPflags.SetNormalizeFunc(c.globNormFunc) + } + + c.Root().PersistentFlags().AddFlagSet(flag.CommandLine) + + c.VisitParents(func(parent *Command) { + c.parentsPflags.AddFlagSet(parent.PersistentFlags()) + }) } diff --git a/vendor/github.com/spf13/cobra/command_win.go b/vendor/github.com/spf13/cobra/command_win.go index 4b0eaa1b6b..8768b1736d 100644 --- a/vendor/github.com/spf13/cobra/command_win.go +++ b/vendor/github.com/spf13/cobra/command_win.go @@ -3,6 +3,7 @@ package cobra import ( + "fmt" "os" "time" @@ -11,16 +12,15 @@ import ( var preExecHookFn = preExecHook -// enables an information splash screen on Windows if the CLI is started from explorer.exe. -var MousetrapHelpText string = `This is a command line tool - -You need to open cmd.exe and run it from there. -` - func preExecHook(c *Command) { - if mousetrap.StartedByExplorer() { + if MousetrapHelpText != "" && mousetrap.StartedByExplorer() { c.Print(MousetrapHelpText) - time.Sleep(5 * time.Second) + if MousetrapDisplayDuration > 0 { + time.Sleep(MousetrapDisplayDuration) + } else { + c.Println("Press return to continue...") + fmt.Scanln() + } os.Exit(1) } } diff --git a/vendor/github.com/spf13/cobra/custom_completions.go b/vendor/github.com/spf13/cobra/custom_completions.go new file mode 100644 index 0000000000..fa060c147b --- /dev/null +++ b/vendor/github.com/spf13/cobra/custom_completions.go @@ -0,0 +1,557 @@ +package cobra + +import ( + "fmt" + "os" + "strings" + + "github.com/spf13/pflag" +) + +const ( + // ShellCompRequestCmd is the name of the hidden command that is used to request + // completion results from the program. It is used by the shell completion scripts. + ShellCompRequestCmd = "__complete" + // ShellCompNoDescRequestCmd is the name of the hidden command that is used to request + // completion results without their description. It is used by the shell completion scripts. + ShellCompNoDescRequestCmd = "__completeNoDesc" +) + +// Global map of flag completion functions. +var flagCompletionFunctions = map[*pflag.Flag]func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective){} + +// ShellCompDirective is a bit map representing the different behaviors the shell +// can be instructed to have once completions have been provided. +type ShellCompDirective int + +const ( + // ShellCompDirectiveError indicates an error occurred and completions should be ignored. + ShellCompDirectiveError ShellCompDirective = 1 << iota + + // ShellCompDirectiveNoSpace indicates that the shell should not add a space + // after the completion even if there is a single completion provided. + ShellCompDirectiveNoSpace + + // ShellCompDirectiveNoFileComp indicates that the shell should not provide + // file completion even when no completion is provided. + // This currently does not work for zsh or bash < 4 + ShellCompDirectiveNoFileComp + + // ShellCompDirectiveFilterFileExt indicates that the provided completions + // should be used as file extension filters. + // For flags, using Command.MarkFlagFilename() and Command.MarkPersistentFlagFilename() + // is a shortcut to using this directive explicitly. The BashCompFilenameExt + // annotation can also be used to obtain the same behavior for flags. + ShellCompDirectiveFilterFileExt + + // ShellCompDirectiveFilterDirs indicates that only directory names should + // be provided in file completion. To request directory names within another + // directory, the returned completions should specify the directory within + // which to search. The BashCompSubdirsInDir annotation can be used to + // obtain the same behavior but only for flags. + ShellCompDirectiveFilterDirs + + // =========================================================================== + + // All directives using iota should be above this one. + // For internal use. + shellCompDirectiveMaxValue + + // ShellCompDirectiveDefault indicates to let the shell perform its default + // behavior after completions have been provided. + // This one must be last to avoid messing up the iota count. + ShellCompDirectiveDefault ShellCompDirective = 0 +) + +// RegisterFlagCompletionFunc should be called to register a function to provide completion for a flag. +func (c *Command) RegisterFlagCompletionFunc(flagName string, f func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective)) error { + flag := c.Flag(flagName) + if flag == nil { + return fmt.Errorf("RegisterFlagCompletionFunc: flag '%s' does not exist", flagName) + } + if _, exists := flagCompletionFunctions[flag]; exists { + return fmt.Errorf("RegisterFlagCompletionFunc: flag '%s' already registered", flagName) + } + flagCompletionFunctions[flag] = f + return nil +} + +// Returns a string listing the different directive enabled in the specified parameter +func (d ShellCompDirective) string() string { + var directives []string + if d&ShellCompDirectiveError != 0 { + directives = append(directives, "ShellCompDirectiveError") + } + if d&ShellCompDirectiveNoSpace != 0 { + directives = append(directives, "ShellCompDirectiveNoSpace") + } + if d&ShellCompDirectiveNoFileComp != 0 { + directives = append(directives, "ShellCompDirectiveNoFileComp") + } + if d&ShellCompDirectiveFilterFileExt != 0 { + directives = append(directives, "ShellCompDirectiveFilterFileExt") + } + if d&ShellCompDirectiveFilterDirs != 0 { + directives = append(directives, "ShellCompDirectiveFilterDirs") + } + if len(directives) == 0 { + directives = append(directives, "ShellCompDirectiveDefault") + } + + if d >= shellCompDirectiveMaxValue { + return fmt.Sprintf("ERROR: unexpected ShellCompDirective value: %d", d) + } + return strings.Join(directives, ", ") +} + +// Adds a special hidden command that can be used to request custom completions. +func (c *Command) initCompleteCmd(args []string) { + completeCmd := &Command{ + Use: fmt.Sprintf("%s [command-line]", ShellCompRequestCmd), + Aliases: []string{ShellCompNoDescRequestCmd}, + DisableFlagsInUseLine: true, + Hidden: true, + DisableFlagParsing: true, + Args: MinimumNArgs(1), + Short: "Request shell completion choices for the specified command-line", + Long: fmt.Sprintf("%[2]s is a special command that is used by the shell completion logic\n%[1]s", + "to request completion choices for the specified command-line.", ShellCompRequestCmd), + Run: func(cmd *Command, args []string) { + finalCmd, completions, directive, err := cmd.getCompletions(args) + if err != nil { + CompErrorln(err.Error()) + // Keep going for multiple reasons: + // 1- There could be some valid completions even though there was an error + // 2- Even without completions, we need to print the directive + } + + noDescriptions := (cmd.CalledAs() == ShellCompNoDescRequestCmd) + for _, comp := range completions { + if noDescriptions { + // Remove any description that may be included following a tab character. + comp = strings.Split(comp, "\t")[0] + } + + // Make sure we only write the first line to the output. + // This is needed if a description contains a linebreak. + // Otherwise the shell scripts will interpret the other lines as new flags + // and could therefore provide a wrong completion. + comp = strings.Split(comp, "\n")[0] + + // Finally trim the completion. This is especially important to get rid + // of a trailing tab when there are no description following it. + // For example, a sub-command without a description should not be completed + // with a tab at the end (or else zsh will show a -- following it + // although there is no description). + comp = strings.TrimSpace(comp) + + // Print each possible completion to stdout for the completion script to consume. + fmt.Fprintln(finalCmd.OutOrStdout(), comp) + } + + if directive >= shellCompDirectiveMaxValue { + directive = ShellCompDirectiveDefault + } + + // As the last printout, print the completion directive for the completion script to parse. + // The directive integer must be that last character following a single colon (:). + // The completion script expects : + fmt.Fprintf(finalCmd.OutOrStdout(), ":%d\n", directive) + + // Print some helpful info to stderr for the user to understand. + // Output from stderr must be ignored by the completion script. + fmt.Fprintf(finalCmd.ErrOrStderr(), "Completion ended with directive: %s\n", directive.string()) + }, + } + c.AddCommand(completeCmd) + subCmd, _, err := c.Find(args) + if err != nil || subCmd.Name() != ShellCompRequestCmd { + // Only create this special command if it is actually being called. + // This reduces possible side-effects of creating such a command; + // for example, having this command would cause problems to a + // cobra program that only consists of the root command, since this + // command would cause the root command to suddenly have a subcommand. + c.RemoveCommand(completeCmd) + } +} + +func (c *Command) getCompletions(args []string) (*Command, []string, ShellCompDirective, error) { + // The last argument, which is not completely typed by the user, + // should not be part of the list of arguments + toComplete := args[len(args)-1] + trimmedArgs := args[:len(args)-1] + + var finalCmd *Command + var finalArgs []string + var err error + // Find the real command for which completion must be performed + // check if we need to traverse here to parse local flags on parent commands + if c.Root().TraverseChildren { + finalCmd, finalArgs, err = c.Root().Traverse(trimmedArgs) + } else { + finalCmd, finalArgs, err = c.Root().Find(trimmedArgs) + } + if err != nil { + // Unable to find the real command. E.g., someInvalidCmd + return c, []string{}, ShellCompDirectiveDefault, fmt.Errorf("Unable to find a command for arguments: %v", trimmedArgs) + } + + // Check if we are doing flag value completion before parsing the flags. + // This is important because if we are completing a flag value, we need to also + // remove the flag name argument from the list of finalArgs or else the parsing + // could fail due to an invalid value (incomplete) for the flag. + flag, finalArgs, toComplete, err := checkIfFlagCompletion(finalCmd, finalArgs, toComplete) + if err != nil { + // Error while attempting to parse flags + return finalCmd, []string{}, ShellCompDirectiveDefault, err + } + + // Parse the flags early so we can check if required flags are set + if err = finalCmd.ParseFlags(finalArgs); err != nil { + return finalCmd, []string{}, ShellCompDirectiveDefault, fmt.Errorf("Error while parsing flags from args %v: %s", finalArgs, err.Error()) + } + + if flag != nil { + // Check if we are completing a flag value subject to annotations + if validExts, present := flag.Annotations[BashCompFilenameExt]; present { + if len(validExts) != 0 { + // File completion filtered by extensions + return finalCmd, validExts, ShellCompDirectiveFilterFileExt, nil + } + + // The annotation requests simple file completion. There is no reason to do + // that since it is the default behavior anyway. Let's ignore this annotation + // in case the program also registered a completion function for this flag. + // Even though it is a mistake on the program's side, let's be nice when we can. + } + + if subDir, present := flag.Annotations[BashCompSubdirsInDir]; present { + if len(subDir) == 1 { + // Directory completion from within a directory + return finalCmd, subDir, ShellCompDirectiveFilterDirs, nil + } + // Directory completion + return finalCmd, []string{}, ShellCompDirectiveFilterDirs, nil + } + } + + // When doing completion of a flag name, as soon as an argument starts with + // a '-' we know it is a flag. We cannot use isFlagArg() here as it requires + // the flag name to be complete + if flag == nil && len(toComplete) > 0 && toComplete[0] == '-' && !strings.Contains(toComplete, "=") { + var completions []string + + // First check for required flags + completions = completeRequireFlags(finalCmd, toComplete) + + // If we have not found any required flags, only then can we show regular flags + if len(completions) == 0 { + doCompleteFlags := func(flag *pflag.Flag) { + if !flag.Changed || + strings.Contains(flag.Value.Type(), "Slice") || + strings.Contains(flag.Value.Type(), "Array") { + // If the flag is not already present, or if it can be specified multiple times (Array or Slice) + // we suggest it as a completion + completions = append(completions, getFlagNameCompletions(flag, toComplete)...) + } + } + + // We cannot use finalCmd.Flags() because we may not have called ParsedFlags() for commands + // that have set DisableFlagParsing; it is ParseFlags() that merges the inherited and + // non-inherited flags. + finalCmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) { + doCompleteFlags(flag) + }) + finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) { + doCompleteFlags(flag) + }) + } + + directive := ShellCompDirectiveNoFileComp + if len(completions) == 1 && strings.HasSuffix(completions[0], "=") { + // If there is a single completion, the shell usually adds a space + // after the completion. We don't want that if the flag ends with an = + directive = ShellCompDirectiveNoSpace + } + return finalCmd, completions, directive, nil + } + + // We only remove the flags from the arguments if DisableFlagParsing is not set. + // This is important for commands which have requested to do their own flag completion. + if !finalCmd.DisableFlagParsing { + finalArgs = finalCmd.Flags().Args() + } + + var completions []string + directive := ShellCompDirectiveDefault + if flag == nil { + foundLocalNonPersistentFlag := false + // If TraverseChildren is true on the root command we don't check for + // local flags because we can use a local flag on a parent command + if !finalCmd.Root().TraverseChildren { + // Check if there are any local, non-persistent flags on the command-line + localNonPersistentFlags := finalCmd.LocalNonPersistentFlags() + finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) { + if localNonPersistentFlags.Lookup(flag.Name) != nil && flag.Changed { + foundLocalNonPersistentFlag = true + } + }) + } + + // Complete subcommand names, including the help command + if len(finalArgs) == 0 && !foundLocalNonPersistentFlag { + // We only complete sub-commands if: + // - there are no arguments on the command-line and + // - there are no local, non-peristent flag on the command-line or TraverseChildren is true + for _, subCmd := range finalCmd.Commands() { + if subCmd.IsAvailableCommand() || subCmd == finalCmd.helpCommand { + if strings.HasPrefix(subCmd.Name(), toComplete) { + completions = append(completions, fmt.Sprintf("%s\t%s", subCmd.Name(), subCmd.Short)) + } + directive = ShellCompDirectiveNoFileComp + } + } + } + + // Complete required flags even without the '-' prefix + completions = append(completions, completeRequireFlags(finalCmd, toComplete)...) + + // Always complete ValidArgs, even if we are completing a subcommand name. + // This is for commands that have both subcommands and ValidArgs. + if len(finalCmd.ValidArgs) > 0 { + if len(finalArgs) == 0 { + // ValidArgs are only for the first argument + for _, validArg := range finalCmd.ValidArgs { + if strings.HasPrefix(validArg, toComplete) { + completions = append(completions, validArg) + } + } + directive = ShellCompDirectiveNoFileComp + + // If no completions were found within commands or ValidArgs, + // see if there are any ArgAliases that should be completed. + if len(completions) == 0 { + for _, argAlias := range finalCmd.ArgAliases { + if strings.HasPrefix(argAlias, toComplete) { + completions = append(completions, argAlias) + } + } + } + } + + // If there are ValidArgs specified (even if they don't match), we stop completion. + // Only one of ValidArgs or ValidArgsFunction can be used for a single command. + return finalCmd, completions, directive, nil + } + + // Let the logic continue so as to add any ValidArgsFunction completions, + // even if we already found sub-commands. + // This is for commands that have subcommands but also specify a ValidArgsFunction. + } + + // Find the completion function for the flag or command + var completionFn func(cmd *Command, args []string, toComplete string) ([]string, ShellCompDirective) + if flag != nil { + completionFn = flagCompletionFunctions[flag] + } else { + completionFn = finalCmd.ValidArgsFunction + } + if completionFn != nil { + // Go custom completion defined for this flag or command. + // Call the registered completion function to get the completions. + var comps []string + comps, directive = completionFn(finalCmd, finalArgs, toComplete) + completions = append(completions, comps...) + } + + return finalCmd, completions, directive, nil +} + +func getFlagNameCompletions(flag *pflag.Flag, toComplete string) []string { + if nonCompletableFlag(flag) { + return []string{} + } + + var completions []string + flagName := "--" + flag.Name + if strings.HasPrefix(flagName, toComplete) { + // Flag without the = + completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage)) + + // Why suggest both long forms: --flag and --flag= ? + // This forces the user to *always* have to type either an = or a space after the flag name. + // Let's be nice and avoid making users have to do that. + // Since boolean flags and shortname flags don't show the = form, let's go that route and never show it. + // The = form will still work, we just won't suggest it. + // This also makes the list of suggested flags shorter as we avoid all the = forms. + // + // if len(flag.NoOptDefVal) == 0 { + // // Flag requires a value, so it can be suffixed with = + // flagName += "=" + // completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage)) + // } + } + + flagName = "-" + flag.Shorthand + if len(flag.Shorthand) > 0 && strings.HasPrefix(flagName, toComplete) { + completions = append(completions, fmt.Sprintf("%s\t%s", flagName, flag.Usage)) + } + + return completions +} + +func completeRequireFlags(finalCmd *Command, toComplete string) []string { + var completions []string + + doCompleteRequiredFlags := func(flag *pflag.Flag) { + if _, present := flag.Annotations[BashCompOneRequiredFlag]; present { + if !flag.Changed { + // If the flag is not already present, we suggest it as a completion + completions = append(completions, getFlagNameCompletions(flag, toComplete)...) + } + } + } + + // We cannot use finalCmd.Flags() because we may not have called ParsedFlags() for commands + // that have set DisableFlagParsing; it is ParseFlags() that merges the inherited and + // non-inherited flags. + finalCmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) { + doCompleteRequiredFlags(flag) + }) + finalCmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) { + doCompleteRequiredFlags(flag) + }) + + return completions +} + +func checkIfFlagCompletion(finalCmd *Command, args []string, lastArg string) (*pflag.Flag, []string, string, error) { + if finalCmd.DisableFlagParsing { + // We only do flag completion if we are allowed to parse flags + // This is important for commands which have requested to do their own flag completion. + return nil, args, lastArg, nil + } + + var flagName string + trimmedArgs := args + flagWithEqual := false + + // When doing completion of a flag name, as soon as an argument starts with + // a '-' we know it is a flag. We cannot use isFlagArg() here as that function + // requires the flag name to be complete + if len(lastArg) > 0 && lastArg[0] == '-' { + if index := strings.Index(lastArg, "="); index >= 0 { + // Flag with an = + flagName = strings.TrimLeft(lastArg[:index], "-") + lastArg = lastArg[index+1:] + flagWithEqual = true + } else { + // Normal flag completion + return nil, args, lastArg, nil + } + } + + if len(flagName) == 0 { + if len(args) > 0 { + prevArg := args[len(args)-1] + if isFlagArg(prevArg) { + // Only consider the case where the flag does not contain an =. + // If the flag contains an = it means it has already been fully processed, + // so we don't need to deal with it here. + if index := strings.Index(prevArg, "="); index < 0 { + flagName = strings.TrimLeft(prevArg, "-") + + // Remove the uncompleted flag or else there could be an error created + // for an invalid value for that flag + trimmedArgs = args[:len(args)-1] + } + } + } + } + + if len(flagName) == 0 { + // Not doing flag completion + return nil, trimmedArgs, lastArg, nil + } + + flag := findFlag(finalCmd, flagName) + if flag == nil { + // Flag not supported by this command, nothing to complete + err := fmt.Errorf("Subcommand '%s' does not support flag '%s'", finalCmd.Name(), flagName) + return nil, nil, "", err + } + + if !flagWithEqual { + if len(flag.NoOptDefVal) != 0 { + // We had assumed dealing with a two-word flag but the flag is a boolean flag. + // In that case, there is no value following it, so we are not really doing flag completion. + // Reset everything to do noun completion. + trimmedArgs = args + flag = nil + } + } + + return flag, trimmedArgs, lastArg, nil +} + +func findFlag(cmd *Command, name string) *pflag.Flag { + flagSet := cmd.Flags() + if len(name) == 1 { + // First convert the short flag into a long flag + // as the cmd.Flag() search only accepts long flags + if short := flagSet.ShorthandLookup(name); short != nil { + name = short.Name + } else { + set := cmd.InheritedFlags() + if short = set.ShorthandLookup(name); short != nil { + name = short.Name + } else { + return nil + } + } + } + return cmd.Flag(name) +} + +// CompDebug prints the specified string to the same file as where the +// completion script prints its logs. +// Note that completion printouts should never be on stdout as they would +// be wrongly interpreted as actual completion choices by the completion script. +func CompDebug(msg string, printToStdErr bool) { + msg = fmt.Sprintf("[Debug] %s", msg) + + // Such logs are only printed when the user has set the environment + // variable BASH_COMP_DEBUG_FILE to the path of some file to be used. + if path := os.Getenv("BASH_COMP_DEBUG_FILE"); path != "" { + f, err := os.OpenFile(path, + os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) + if err == nil { + defer f.Close() + WriteStringAndCheck(f, msg) + } + } + + if printToStdErr { + // Must print to stderr for this not to be read by the completion script. + fmt.Fprint(os.Stderr, msg) + } +} + +// CompDebugln prints the specified string with a newline at the end +// to the same file as where the completion script prints its logs. +// Such logs are only printed when the user has set the environment +// variable BASH_COMP_DEBUG_FILE to the path of some file to be used. +func CompDebugln(msg string, printToStdErr bool) { + CompDebug(fmt.Sprintf("%s\n", msg), printToStdErr) +} + +// CompError prints the specified completion message to stderr. +func CompError(msg string) { + msg = fmt.Sprintf("[Error] %s", msg) + CompDebug(msg, true) +} + +// CompErrorln prints the specified completion message to stderr with a newline at the end. +func CompErrorln(msg string) { + CompError(fmt.Sprintf("%s\n", msg)) +} diff --git a/vendor/github.com/spf13/cobra/doc/README.md b/vendor/github.com/spf13/cobra/doc/README.md new file mode 100644 index 0000000000..6ea4eb6623 --- /dev/null +++ b/vendor/github.com/spf13/cobra/doc/README.md @@ -0,0 +1,12 @@ +# Documentation generation + +- [Man page docs](./man_docs.md) +- [Markdown docs](./md_docs.md) +- [Rest docs](./rest_docs.md) +- [Yaml docs](./yaml_docs.md) + +## Options +### `DisableAutoGenTag` +You may set `cmd.DisableAutoGenTag = true` +to _entirely_ remove the auto generated string "Auto generated by spf13/cobra..." +from any documentation source. diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.go b/vendor/github.com/spf13/cobra/doc/man_docs.go index b9266c367c..916e36144d 100644 --- a/vendor/github.com/spf13/cobra/doc/man_docs.go +++ b/vendor/github.com/spf13/cobra/doc/man_docs.go @@ -20,18 +20,19 @@ import ( "os" "path/filepath" "sort" + "strconv" "strings" "time" - mangen "github.com/cpuguy83/go-md2man/md2man" + "github.com/cpuguy83/go-md2man/v2/md2man" "github.com/spf13/cobra" "github.com/spf13/pflag" ) // GenManTree will generate a man page for this command and all descendants // in the directory given. The header may be nil. This function may not work -// correctly if your command names have - in them. If you have `cmd` with two -// subcmds, `sub` and `sub-third`. And `sub` has a subcommand called `third` +// correctly if your command names have `-` in them. If you have `cmd` with two +// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` // it is undefined which help output will be in the file `cmd-sub-third.1`. func GenManTree(cmd *cobra.Command, header *GenManHeader, dir string) error { return GenManTreeFromOpts(cmd, GenManTreeOptions{ @@ -77,6 +78,8 @@ func GenManTreeFromOpts(cmd *cobra.Command, opts GenManTreeOptions) error { return GenMan(cmd, &headerCopy, f) } +// GenManTreeOptions is the options for generating the man pages. +// Used only in GenManTreeFromOpts. type GenManTreeOptions struct { Header *GenManHeader Path string @@ -85,7 +88,7 @@ type GenManTreeOptions struct { // GenManHeader is a lot like the .TH header at the start of man pages. These // include the title, section, date, source, and manual. We will use the -// current time if Date if unset and will use "Auto generated by spf13/cobra" +// current time if Date is unset and will use "Auto generated by spf13/cobra" // if the Source is unset. type GenManHeader struct { Title string @@ -102,14 +105,16 @@ func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error { if header == nil { header = &GenManHeader{} } - fillHeader(header, cmd.CommandPath()) + if err := fillHeader(header, cmd.CommandPath(), cmd.DisableAutoGenTag); err != nil { + return err + } b := genMan(cmd, header) - _, err := w.Write(mangen.Render(b)) + _, err := w.Write(md2man.Render(b)) return err } -func fillHeader(header *GenManHeader, name string) { +func fillHeader(header *GenManHeader, name string, disableAutoGen bool) error { if header.Title == "" { header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1)) } @@ -118,33 +123,39 @@ func fillHeader(header *GenManHeader, name string) { } if header.Date == nil { now := time.Now() + if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" { + unixEpoch, err := strconv.ParseInt(epoch, 10, 64) + if err != nil { + return fmt.Errorf("invalid SOURCE_DATE_EPOCH: %v", err) + } + now = time.Unix(unixEpoch, 0) + } header.Date = &now } header.date = (*header.Date).Format("Jan 2006") - if header.Source == "" { + if header.Source == "" && !disableAutoGen { header.Source = "Auto generated by spf13/cobra" } + return nil } -func manPreamble(out io.Writer, header *GenManHeader, cmd *cobra.Command, dashedName string) { +func manPreamble(buf io.StringWriter, header *GenManHeader, cmd *cobra.Command, dashedName string) { description := cmd.Long if len(description) == 0 { description = cmd.Short } - fmt.Fprintf(out, `%% %s(%s)%s -%% %s -%% %s + cobra.WriteStringAndCheck(buf, fmt.Sprintf(`%% "%s" "%s" "%s" "%s" "%s" # NAME -`, header.Title, header.Section, header.date, header.Source, header.Manual) - fmt.Fprintf(out, "%s \\- %s\n\n", dashedName, cmd.Short) - fmt.Fprintf(out, "# SYNOPSIS\n") - fmt.Fprintf(out, "**%s**\n\n", cmd.UseLine()) - fmt.Fprintf(out, "# DESCRIPTION\n") - fmt.Fprintf(out, "%s\n\n", description) +`, header.Title, header.Section, header.date, header.Source, header.Manual)) + cobra.WriteStringAndCheck(buf, fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short)) + cobra.WriteStringAndCheck(buf, "# SYNOPSIS\n") + cobra.WriteStringAndCheck(buf, fmt.Sprintf("**%s**\n\n", cmd.UseLine())) + cobra.WriteStringAndCheck(buf, "# DESCRIPTION\n") + cobra.WriteStringAndCheck(buf, description+"\n\n") } -func manPrintFlags(out io.Writer, flags *pflag.FlagSet) { +func manPrintFlags(buf io.StringWriter, flags *pflag.FlagSet) { flags.VisitAll(func(flag *pflag.Flag) { if len(flag.Deprecated) > 0 || flag.Hidden { return @@ -156,38 +167,41 @@ func manPrintFlags(out io.Writer, flags *pflag.FlagSet) { format = fmt.Sprintf("**--%s**", flag.Name) } if len(flag.NoOptDefVal) > 0 { - format = format + "[" + format += "[" } if flag.Value.Type() == "string" { // put quotes on the value - format = format + "=%q" + format += "=%q" } else { - format = format + "=%s" + format += "=%s" } if len(flag.NoOptDefVal) > 0 { - format = format + "]" + format += "]" } - format = format + "\n\t%s\n\n" - fmt.Fprintf(out, format, flag.DefValue, flag.Usage) + format += "\n\t%s\n\n" + cobra.WriteStringAndCheck(buf, fmt.Sprintf(format, flag.DefValue, flag.Usage)) }) } -func manPrintOptions(out io.Writer, command *cobra.Command) { +func manPrintOptions(buf io.StringWriter, command *cobra.Command) { flags := command.NonInheritedFlags() - if flags.HasFlags() { - fmt.Fprintf(out, "# OPTIONS\n") - manPrintFlags(out, flags) - fmt.Fprintf(out, "\n") + if flags.HasAvailableFlags() { + cobra.WriteStringAndCheck(buf, "# OPTIONS\n") + manPrintFlags(buf, flags) + cobra.WriteStringAndCheck(buf, "\n") } flags = command.InheritedFlags() - if flags.HasFlags() { - fmt.Fprintf(out, "# OPTIONS INHERITED FROM PARENT COMMANDS\n") - manPrintFlags(out, flags) - fmt.Fprintf(out, "\n") + if flags.HasAvailableFlags() { + cobra.WriteStringAndCheck(buf, "# OPTIONS INHERITED FROM PARENT COMMANDS\n") + manPrintFlags(buf, flags) + cobra.WriteStringAndCheck(buf, "\n") } } func genMan(cmd *cobra.Command, header *GenManHeader) []byte { + cmd.InitDefaultHelpCmd() + cmd.InitDefaultHelpFlag() + // something like `rootcmd-subcmd1-subcmd2` dashCommandName := strings.Replace(cmd.CommandPath(), " ", "-", -1) @@ -196,11 +210,11 @@ func genMan(cmd *cobra.Command, header *GenManHeader) []byte { manPreamble(buf, header, cmd, dashCommandName) manPrintOptions(buf, cmd) if len(cmd.Example) > 0 { - fmt.Fprintf(buf, "# EXAMPLE\n") - fmt.Fprintf(buf, "```\n%s\n```\n", cmd.Example) + buf.WriteString("# EXAMPLE\n") + buf.WriteString(fmt.Sprintf("```\n%s\n```\n", cmd.Example)) } if hasSeeAlso(cmd) { - fmt.Fprintf(buf, "# SEE ALSO\n") + buf.WriteString("# SEE ALSO\n") seealsos := make([]string, 0) if cmd.HasParent() { parentPath := cmd.Parent().CommandPath() @@ -222,10 +236,10 @@ func genMan(cmd *cobra.Command, header *GenManHeader) []byte { seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section) seealsos = append(seealsos, seealso) } - fmt.Fprintf(buf, "%s\n", strings.Join(seealsos, ", ")) + buf.WriteString(strings.Join(seealsos, ", ") + "\n") } if !cmd.DisableAutoGenTag { - fmt.Fprintf(buf, "# HISTORY\n%s Auto generated by spf13/cobra\n", header.Date.Format("2-Jan-2006")) + buf.WriteString(fmt.Sprintf("# HISTORY\n%s Auto generated by spf13/cobra\n", header.Date.Format("2-Jan-2006"))) } return buf.Bytes() } diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.md b/vendor/github.com/spf13/cobra/doc/man_docs.md index d568d9a038..3709160f34 100644 --- a/vendor/github.com/spf13/cobra/doc/man_docs.md +++ b/vendor/github.com/spf13/cobra/doc/man_docs.md @@ -6,6 +6,8 @@ Generating man pages from a cobra command is incredibly easy. An example is as f package main import ( + "log" + "github.com/spf13/cobra" "github.com/spf13/cobra/doc" ) @@ -19,7 +21,10 @@ func main() { Title: "MINE", Section: "3", } - doc.GenManTree(cmd, header, "/tmp") + err := doc.GenManTree(cmd, header, "/tmp") + if err != nil { + log.Fatal(err) + } } ``` diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.go b/vendor/github.com/spf13/cobra/doc/md_docs.go index 8d159c1d73..5181af8dc2 100644 --- a/vendor/github.com/spf13/cobra/doc/md_docs.go +++ b/vendor/github.com/spf13/cobra/doc/md_docs.go @@ -14,6 +14,7 @@ package doc import ( + "bytes" "fmt" "io" "os" @@ -25,89 +26,65 @@ import ( "github.com/spf13/cobra" ) -func printOptions(w io.Writer, cmd *cobra.Command, name string) error { +func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { flags := cmd.NonInheritedFlags() - flags.SetOutput(w) - if flags.HasFlags() { - if _, err := fmt.Fprintf(w, "### Options\n\n```\n"); err != nil { - return err - } + flags.SetOutput(buf) + if flags.HasAvailableFlags() { + buf.WriteString("### Options\n\n```\n") flags.PrintDefaults() - if _, err := fmt.Fprintf(w, "```\n\n"); err != nil { - return err - } + buf.WriteString("```\n\n") } parentFlags := cmd.InheritedFlags() - parentFlags.SetOutput(w) - if parentFlags.HasFlags() { - if _, err := fmt.Fprintf(w, "### Options inherited from parent commands\n\n```\n"); err != nil { - return err - } + parentFlags.SetOutput(buf) + if parentFlags.HasAvailableFlags() { + buf.WriteString("### Options inherited from parent commands\n\n```\n") parentFlags.PrintDefaults() - if _, err := fmt.Fprintf(w, "```\n\n"); err != nil { - return err - } + buf.WriteString("```\n\n") } return nil } +// GenMarkdown creates markdown output. func GenMarkdown(cmd *cobra.Command, w io.Writer) error { return GenMarkdownCustom(cmd, w, func(s string) string { return s }) } +// GenMarkdownCustom creates custom markdown output. func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { + cmd.InitDefaultHelpCmd() + cmd.InitDefaultHelpFlag() + + buf := new(bytes.Buffer) name := cmd.CommandPath() - short := cmd.Short - long := cmd.Long - if len(long) == 0 { - long = short - } - - if _, err := fmt.Fprintf(w, "## %s\n\n", name); err != nil { - return err - } - if _, err := fmt.Fprintf(w, "%s\n\n", short); err != nil { - return err - } - if _, err := fmt.Fprintf(w, "### Synopsis\n\n"); err != nil { - return err - } - if _, err := fmt.Fprintf(w, "\n%s\n\n", long); err != nil { - return err + buf.WriteString("## " + name + "\n\n") + buf.WriteString(cmd.Short + "\n\n") + if len(cmd.Long) > 0 { + buf.WriteString("### Synopsis\n\n") + buf.WriteString(cmd.Long + "\n\n") } if cmd.Runnable() { - if _, err := fmt.Fprintf(w, "```\n%s\n```\n\n", cmd.UseLine()); err != nil { - return err - } + buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.UseLine())) } if len(cmd.Example) > 0 { - if _, err := fmt.Fprintf(w, "### Examples\n\n"); err != nil { - return err - } - if _, err := fmt.Fprintf(w, "```\n%s\n```\n\n", cmd.Example); err != nil { - return err - } + buf.WriteString("### Examples\n\n") + buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.Example)) } - if err := printOptions(w, cmd, name); err != nil { + if err := printOptions(buf, cmd, name); err != nil { return err } if hasSeeAlso(cmd) { - if _, err := fmt.Fprintf(w, "### SEE ALSO\n"); err != nil { - return err - } + buf.WriteString("### SEE ALSO\n\n") if cmd.HasParent() { parent := cmd.Parent() pname := parent.CommandPath() link := pname + ".md" link = strings.Replace(link, " ", "_", -1) - if _, err := fmt.Fprintf(w, "* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short); err != nil { - return err - } + buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short)) cmd.VisitParents(func(c *cobra.Command) { if c.DisableAutoGenTag { cmd.DisableAutoGenTag = c.DisableAutoGenTag @@ -125,28 +102,31 @@ func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) cname := name + " " + child.Name() link := cname + ".md" link = strings.Replace(link, " ", "_", -1) - if _, err := fmt.Fprintf(w, "* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short); err != nil { - return err - } - } - if _, err := fmt.Fprintf(w, "\n"); err != nil { - return err + buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short)) } + buf.WriteString("\n") } if !cmd.DisableAutoGenTag { - if _, err := fmt.Fprintf(w, "###### Auto generated by spf13/cobra on %s\n", time.Now().Format("2-Jan-2006")); err != nil { - return err - } + buf.WriteString("###### Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "\n") } - return nil + _, err := buf.WriteTo(w) + return err } +// GenMarkdownTree will generate a markdown page for this command and all +// descendants in the directory given. The header may be nil. +// This function may not work correctly if your command names have `-` in them. +// If you have `cmd` with two subcmds, `sub` and `sub-third`, +// and `sub` has a subcommand called `third`, it is undefined which +// help output will be in the file `cmd-sub-third.1`. func GenMarkdownTree(cmd *cobra.Command, dir string) error { identity := func(s string) string { return s } emptyStr := func(s string) string { return "" } return GenMarkdownTreeCustom(cmd, dir, emptyStr, identity) } +// GenMarkdownTreeCustom is the the same as GenMarkdownTree, but +// with custom filePrepender and linkHandler. func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error { for _, c := range cmd.Commands() { if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.md b/vendor/github.com/spf13/cobra/doc/md_docs.md index beec3e0e8d..5c870625f7 100644 --- a/vendor/github.com/spf13/cobra/doc/md_docs.md +++ b/vendor/github.com/spf13/cobra/doc/md_docs.md @@ -1,11 +1,13 @@ # Generating Markdown Docs For Your Own cobra.Command -Generating man pages from a cobra command is incredibly easy. An example is as follows: +Generating Markdown pages from a cobra command is incredibly easy. An example is as follows: ```go package main import ( + "log" + "github.com/spf13/cobra" "github.com/spf13/cobra/doc" ) @@ -15,7 +17,10 @@ func main() { Use: "test", Short: "my test program", } - doc.GenMarkdownTree(cmd, "/tmp") + err := doc.GenMarkdownTree(cmd, "/tmp") + if err != nil { + log.Fatal(err) + } } ``` @@ -29,6 +34,7 @@ This program can actually generate docs for the kubectl command in the kubernete package main import ( + "log" "io/ioutil" "os" @@ -40,7 +46,10 @@ import ( func main() { kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) - doc.GenMarkdownTree(kubectl, "./") + err := doc.GenMarkdownTree(kubectl, "./") + if err != nil { + log.Fatal(err) + } } ``` @@ -52,7 +61,10 @@ You may wish to have more control over the output, or only generate for a single ```go out := new(bytes.Buffer) - doc.GenMarkdown(cmd, out) + err := doc.GenMarkdown(cmd, out) + if err != nil { + log.Fatal(err) + } ``` This will write the markdown doc for ONLY "cmd" into the out, buffer. diff --git a/vendor/github.com/spf13/cobra/doc/rest_docs.go b/vendor/github.com/spf13/cobra/doc/rest_docs.go new file mode 100644 index 0000000000..051d8dc832 --- /dev/null +++ b/vendor/github.com/spf13/cobra/doc/rest_docs.go @@ -0,0 +1,185 @@ +//Copyright 2015 Red Hat Inc. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package doc + +import ( + "bytes" + "fmt" + "io" + "os" + "path/filepath" + "sort" + "strings" + "time" + + "github.com/spf13/cobra" +) + +func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error { + flags := cmd.NonInheritedFlags() + flags.SetOutput(buf) + if flags.HasAvailableFlags() { + buf.WriteString("Options\n") + buf.WriteString("~~~~~~~\n\n::\n\n") + flags.PrintDefaults() + buf.WriteString("\n") + } + + parentFlags := cmd.InheritedFlags() + parentFlags.SetOutput(buf) + if parentFlags.HasAvailableFlags() { + buf.WriteString("Options inherited from parent commands\n") + buf.WriteString("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n") + parentFlags.PrintDefaults() + buf.WriteString("\n") + } + return nil +} + +// linkHandler for default ReST hyperlink markup +func defaultLinkHandler(name, ref string) string { + return fmt.Sprintf("`%s <%s.rst>`_", name, ref) +} + +// GenReST creates reStructured Text output. +func GenReST(cmd *cobra.Command, w io.Writer) error { + return GenReSTCustom(cmd, w, defaultLinkHandler) +} + +// GenReSTCustom creates custom reStructured Text output. +func GenReSTCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string, string) string) error { + cmd.InitDefaultHelpCmd() + cmd.InitDefaultHelpFlag() + + buf := new(bytes.Buffer) + name := cmd.CommandPath() + + short := cmd.Short + long := cmd.Long + if len(long) == 0 { + long = short + } + ref := strings.Replace(name, " ", "_", -1) + + buf.WriteString(".. _" + ref + ":\n\n") + buf.WriteString(name + "\n") + buf.WriteString(strings.Repeat("-", len(name)) + "\n\n") + buf.WriteString(short + "\n\n") + buf.WriteString("Synopsis\n") + buf.WriteString("~~~~~~~~\n\n") + buf.WriteString("\n" + long + "\n\n") + + if cmd.Runnable() { + buf.WriteString(fmt.Sprintf("::\n\n %s\n\n", cmd.UseLine())) + } + + if len(cmd.Example) > 0 { + buf.WriteString("Examples\n") + buf.WriteString("~~~~~~~~\n\n") + buf.WriteString(fmt.Sprintf("::\n\n%s\n\n", indentString(cmd.Example, " "))) + } + + if err := printOptionsReST(buf, cmd, name); err != nil { + return err + } + if hasSeeAlso(cmd) { + buf.WriteString("SEE ALSO\n") + buf.WriteString("~~~~~~~~\n\n") + if cmd.HasParent() { + parent := cmd.Parent() + pname := parent.CommandPath() + ref = strings.Replace(pname, " ", "_", -1) + buf.WriteString(fmt.Sprintf("* %s \t - %s\n", linkHandler(pname, ref), parent.Short)) + cmd.VisitParents(func(c *cobra.Command) { + if c.DisableAutoGenTag { + cmd.DisableAutoGenTag = c.DisableAutoGenTag + } + }) + } + + children := cmd.Commands() + sort.Sort(byName(children)) + + for _, child := range children { + if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() { + continue + } + cname := name + " " + child.Name() + ref = strings.Replace(cname, " ", "_", -1) + buf.WriteString(fmt.Sprintf("* %s \t - %s\n", linkHandler(cname, ref), child.Short)) + } + buf.WriteString("\n") + } + if !cmd.DisableAutoGenTag { + buf.WriteString("*Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "*\n") + } + _, err := buf.WriteTo(w) + return err +} + +// GenReSTTree will generate a ReST page for this command and all +// descendants in the directory given. +// This function may not work correctly if your command names have `-` in them. +// If you have `cmd` with two subcmds, `sub` and `sub-third`, +// and `sub` has a subcommand called `third`, it is undefined which +// help output will be in the file `cmd-sub-third.1`. +func GenReSTTree(cmd *cobra.Command, dir string) error { + emptyStr := func(s string) string { return "" } + return GenReSTTreeCustom(cmd, dir, emptyStr, defaultLinkHandler) +} + +// GenReSTTreeCustom is the the same as GenReSTTree, but +// with custom filePrepender and linkHandler. +func GenReSTTreeCustom(cmd *cobra.Command, dir string, filePrepender func(string) string, linkHandler func(string, string) string) error { + for _, c := range cmd.Commands() { + if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { + continue + } + if err := GenReSTTreeCustom(c, dir, filePrepender, linkHandler); err != nil { + return err + } + } + + basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".rst" + filename := filepath.Join(dir, basename) + f, err := os.Create(filename) + if err != nil { + return err + } + defer f.Close() + + if _, err := io.WriteString(f, filePrepender(filename)); err != nil { + return err + } + if err := GenReSTCustom(cmd, f, linkHandler); err != nil { + return err + } + return nil +} + +// adapted from: https://github.com/kr/text/blob/main/indent.go +func indentString(s, p string) string { + var res []byte + b := []byte(s) + prefix := []byte(p) + bol := true + for _, c := range b { + if bol && c != '\n' { + res = append(res, prefix...) + } + res = append(res, c) + bol = c == '\n' + } + return string(res) +} diff --git a/vendor/github.com/spf13/cobra/doc/rest_docs.md b/vendor/github.com/spf13/cobra/doc/rest_docs.md new file mode 100644 index 0000000000..6098430eff --- /dev/null +++ b/vendor/github.com/spf13/cobra/doc/rest_docs.md @@ -0,0 +1,114 @@ +# Generating ReStructured Text Docs For Your Own cobra.Command + +Generating ReST pages from a cobra command is incredibly easy. An example is as follows: + +```go +package main + +import ( + "log" + + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" +) + +func main() { + cmd := &cobra.Command{ + Use: "test", + Short: "my test program", + } + err := doc.GenReSTTree(cmd, "/tmp") + if err != nil { + log.Fatal(err) + } +} +``` + +That will get you a ReST document `/tmp/test.rst` + +## Generate ReST docs for the entire command tree + +This program can actually generate docs for the kubectl command in the kubernetes project + +```go +package main + +import ( + "log" + "io/ioutil" + "os" + + "k8s.io/kubernetes/pkg/kubectl/cmd" + cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" + + "github.com/spf13/cobra/doc" +) + +func main() { + kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) + err := doc.GenReSTTree(kubectl, "./") + if err != nil { + log.Fatal(err) + } +} +``` + +This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./") + +## Generate ReST docs for a single command + +You may wish to have more control over the output, or only generate for a single command, instead of the entire command tree. If this is the case you may prefer to `GenReST` instead of `GenReSTTree` + +```go + out := new(bytes.Buffer) + err := doc.GenReST(cmd, out) + if err != nil { + log.Fatal(err) + } +``` + +This will write the ReST doc for ONLY "cmd" into the out, buffer. + +## Customize the output + +Both `GenReST` and `GenReSTTree` have alternate versions with callbacks to get some control of the output: + +```go +func GenReSTTreeCustom(cmd *Command, dir string, filePrepender func(string) string, linkHandler func(string, string) string) error { + //... +} +``` + +```go +func GenReSTCustom(cmd *Command, out *bytes.Buffer, linkHandler func(string, string) string) error { + //... +} +``` + +The `filePrepender` will prepend the return value given the full filepath to the rendered ReST file. A common use case is to add front matter to use the generated documentation with [Hugo](http://gohugo.io/): + +```go +const fmTemplate = `--- +date: %s +title: "%s" +slug: %s +url: %s +--- +` +filePrepender := func(filename string) string { + now := time.Now().Format(time.RFC3339) + name := filepath.Base(filename) + base := strings.TrimSuffix(name, path.Ext(name)) + url := "/commands/" + strings.ToLower(base) + "/" + return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1), base, url) +} +``` + +The `linkHandler` can be used to customize the rendered links to the commands, given a command name and reference. This is useful while converting rst to html or while generating documentation with tools like Sphinx where `:ref:` is used: + +```go +// Sphinx cross-referencing format +linkHandler := func(name, ref string) string { + return fmt.Sprintf(":ref:`%s <%s>`", name, ref) +} +``` diff --git a/vendor/github.com/spf13/cobra/doc/util.go b/vendor/github.com/spf13/cobra/doc/util.go index 8d3dbecec8..bffde94d50 100644 --- a/vendor/github.com/spf13/cobra/doc/util.go +++ b/vendor/github.com/spf13/cobra/doc/util.go @@ -20,7 +20,7 @@ import ( ) // Test to see if we have a reason to print See Also information in docs -// Basically this is a test for a parent commend or a subcommand which is +// Basically this is a test for a parent command or a subcommand which is // both not deprecated and not the autogenerated help command. func hasSeeAlso(cmd *cobra.Command) bool { if cmd.HasParent() { diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs.go b/vendor/github.com/spf13/cobra/doc/yaml_docs.go index ac8db89ebe..96e6ad721e 100644 --- a/vendor/github.com/spf13/cobra/doc/yaml_docs.go +++ b/vendor/github.com/spf13/cobra/doc/yaml_docs.go @@ -37,6 +37,7 @@ type cmdDoc struct { Name string Synopsis string `yaml:",omitempty"` Description string `yaml:",omitempty"` + Usage string `yaml:",omitempty"` Options []cmdOption `yaml:",omitempty"` InheritedOptions []cmdOption `yaml:"inherited_options,omitempty"` Example string `yaml:",omitempty"` @@ -45,8 +46,8 @@ type cmdDoc struct { // GenYamlTree creates yaml structured ref files for this command and all descendants // in the directory given. This function may not work -// correctly if your command names have - in them. If you have `cmd` with two -// subcmds, `sub` and `sub-third`. And `sub` has a subcommand called `third` +// correctly if your command names have `-` in them. If you have `cmd` with two +// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third` // it is undefined which help output will be in the file `cmd-sub-third.1`. func GenYamlTree(cmd *cobra.Command, dir string) error { identity := func(s string) string { return s } @@ -54,7 +55,7 @@ func GenYamlTree(cmd *cobra.Command, dir string) error { return GenYamlTreeCustom(cmd, dir, emptyStr, identity) } -// GenYamlTreeCustom creates yaml structured ref files +// GenYamlTreeCustom creates yaml structured ref files. func GenYamlTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error { for _, c := range cmd.Commands() { if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() { @@ -82,19 +83,26 @@ func GenYamlTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandle return nil } -// GenYaml creates yaml output +// GenYaml creates yaml output. func GenYaml(cmd *cobra.Command, w io.Writer) error { return GenYamlCustom(cmd, w, func(s string) string { return s }) } -// GenYamlCustom creates custom yaml output +// GenYamlCustom creates custom yaml output. func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error { + cmd.InitDefaultHelpCmd() + cmd.InitDefaultHelpFlag() + yamlDoc := cmdDoc{} yamlDoc.Name = cmd.CommandPath() yamlDoc.Synopsis = forceMultiLine(cmd.Short) yamlDoc.Description = forceMultiLine(cmd.Long) + if cmd.Runnable() { + yamlDoc.Usage = cmd.UseLine() + } + if len(cmd.Example) > 0 { yamlDoc.Example = cmd.Example } @@ -130,7 +138,8 @@ func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) str fmt.Println(err) os.Exit(1) } - if _, err := fmt.Fprintf(w, string(final)); err != nil { + + if _, err := w.Write(final); err != nil { return err } return nil diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs.md b/vendor/github.com/spf13/cobra/doc/yaml_docs.md index 4d0c75a127..1a9b7c6a3c 100644 --- a/vendor/github.com/spf13/cobra/doc/yaml_docs.md +++ b/vendor/github.com/spf13/cobra/doc/yaml_docs.md @@ -6,6 +6,8 @@ Generating yaml files from a cobra command is incredibly easy. An example is as package main import ( + "log" + "github.com/spf13/cobra" "github.com/spf13/cobra/doc" ) @@ -15,7 +17,10 @@ func main() { Use: "test", Short: "my test program", } - doc.GenYamlTree(cmd, "/tmp") + err := doc.GenYamlTree(cmd, "/tmp") + if err != nil { + log.Fatal(err) + } } ``` @@ -30,6 +35,7 @@ package main import ( "io/ioutil" + "log" "os" "k8s.io/kubernetes/pkg/kubectl/cmd" @@ -40,7 +46,10 @@ import ( func main() { kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard) - doc.GenYamlTree(kubectl, "./") + err := doc.GenYamlTree(kubectl, "./") + if err != nil { + log.Fatal(err) + } } ``` diff --git a/vendor/github.com/spf13/cobra/fish_completions.go b/vendor/github.com/spf13/cobra/fish_completions.go new file mode 100644 index 0000000000..3e112347d7 --- /dev/null +++ b/vendor/github.com/spf13/cobra/fish_completions.go @@ -0,0 +1,207 @@ +package cobra + +import ( + "bytes" + "fmt" + "io" + "os" + "strings" +) + +func genFishComp(buf io.StringWriter, name string, includeDesc bool) { + // Variables should not contain a '-' or ':' character + nameForVar := name + nameForVar = strings.Replace(nameForVar, "-", "_", -1) + nameForVar = strings.Replace(nameForVar, ":", "_", -1) + + compCmd := ShellCompRequestCmd + if !includeDesc { + compCmd = ShellCompNoDescRequestCmd + } + WriteStringAndCheck(buf, fmt.Sprintf("# fish completion for %-36s -*- shell-script -*-\n", name)) + WriteStringAndCheck(buf, fmt.Sprintf(` +function __%[1]s_debug + set file "$BASH_COMP_DEBUG_FILE" + if test -n "$file" + echo "$argv" >> $file + end +end + +function __%[1]s_perform_completion + __%[1]s_debug "Starting __%[1]s_perform_completion with: $argv" + + set args (string split -- " " "$argv") + set lastArg "$args[-1]" + + __%[1]s_debug "args: $args" + __%[1]s_debug "last arg: $lastArg" + + set emptyArg "" + if test -z "$lastArg" + __%[1]s_debug "Setting emptyArg" + set emptyArg \"\" + end + __%[1]s_debug "emptyArg: $emptyArg" + + if not type -q "$args[1]" + # This can happen when "complete --do-complete %[2]s" is called when running this script. + __%[1]s_debug "Cannot find $args[1]. No completions." + return + end + + set requestComp "$args[1] %[3]s $args[2..-1] $emptyArg" + __%[1]s_debug "Calling $requestComp" + + set results (eval $requestComp 2> /dev/null) + set comps $results[1..-2] + set directiveLine $results[-1] + + # For Fish, when completing a flag with an = (e.g., -n=) + # completions must be prefixed with the flag + set flagPrefix (string match -r -- '-.*=' "$lastArg") + + __%[1]s_debug "Comps: $comps" + __%[1]s_debug "DirectiveLine: $directiveLine" + __%[1]s_debug "flagPrefix: $flagPrefix" + + for comp in $comps + printf "%%s%%s\n" "$flagPrefix" "$comp" + end + + printf "%%s\n" "$directiveLine" +end + +# This function does three things: +# 1- Obtain the completions and store them in the global __%[1]s_comp_results +# 2- Set the __%[1]s_comp_do_file_comp flag if file completion should be performed +# and unset it otherwise +# 3- Return true if the completion results are not empty +function __%[1]s_prepare_completions + # Start fresh + set --erase __%[1]s_comp_do_file_comp + set --erase __%[1]s_comp_results + + # Check if the command-line is already provided. This is useful for testing. + if not set --query __%[1]s_comp_commandLine + # Use the -c flag to allow for completion in the middle of the line + set __%[1]s_comp_commandLine (commandline -c) + end + __%[1]s_debug "commandLine is: $__%[1]s_comp_commandLine" + + set results (__%[1]s_perform_completion "$__%[1]s_comp_commandLine") + set --erase __%[1]s_comp_commandLine + __%[1]s_debug "Completion results: $results" + + if test -z "$results" + __%[1]s_debug "No completion, probably due to a failure" + # Might as well do file completion, in case it helps + set --global __%[1]s_comp_do_file_comp 1 + return 1 + end + + set directive (string sub --start 2 $results[-1]) + set --global __%[1]s_comp_results $results[1..-2] + + __%[1]s_debug "Completions are: $__%[1]s_comp_results" + __%[1]s_debug "Directive is: $directive" + + set shellCompDirectiveError %[4]d + set shellCompDirectiveNoSpace %[5]d + set shellCompDirectiveNoFileComp %[6]d + set shellCompDirectiveFilterFileExt %[7]d + set shellCompDirectiveFilterDirs %[8]d + + if test -z "$directive" + set directive 0 + end + + set compErr (math (math --scale 0 $directive / $shellCompDirectiveError) %% 2) + if test $compErr -eq 1 + __%[1]s_debug "Received error directive: aborting." + # Might as well do file completion, in case it helps + set --global __%[1]s_comp_do_file_comp 1 + return 1 + end + + set filefilter (math (math --scale 0 $directive / $shellCompDirectiveFilterFileExt) %% 2) + set dirfilter (math (math --scale 0 $directive / $shellCompDirectiveFilterDirs) %% 2) + if test $filefilter -eq 1; or test $dirfilter -eq 1 + __%[1]s_debug "File extension filtering or directory filtering not supported" + # Do full file completion instead + set --global __%[1]s_comp_do_file_comp 1 + return 1 + end + + set nospace (math (math --scale 0 $directive / $shellCompDirectiveNoSpace) %% 2) + set nofiles (math (math --scale 0 $directive / $shellCompDirectiveNoFileComp) %% 2) + + __%[1]s_debug "nospace: $nospace, nofiles: $nofiles" + + # Important not to quote the variable for count to work + set numComps (count $__%[1]s_comp_results) + __%[1]s_debug "numComps: $numComps" + + if test $numComps -eq 1; and test $nospace -ne 0 + # To support the "nospace" directive we trick the shell + # by outputting an extra, longer completion. + __%[1]s_debug "Adding second completion to perform nospace directive" + set --append __%[1]s_comp_results $__%[1]s_comp_results[1]. + end + + if test $numComps -eq 0; and test $nofiles -eq 0 + __%[1]s_debug "Requesting file completion" + set --global __%[1]s_comp_do_file_comp 1 + end + + # If we don't want file completion, we must return true even if there + # are no completions found. This is because fish will perform the last + # completion command, even if its condition is false, if no other + # completion command was triggered + return (not set --query __%[1]s_comp_do_file_comp) +end + +# Since Fish completions are only loaded once the user triggers them, we trigger them ourselves +# so we can properly delete any completions provided by another script. +# The space after the the program name is essential to trigger completion for the program +# and not completion of the program name itself. +complete --do-complete "%[2]s " > /dev/null 2>&1 +# Using '> /dev/null 2>&1' since '&>' is not supported in older versions of fish. + +# Remove any pre-existing completions for the program since we will be handling all of them. +complete -c %[2]s -e + +# The order in which the below two lines are defined is very important so that __%[1]s_prepare_completions +# is called first. It is __%[1]s_prepare_completions that sets up the __%[1]s_comp_do_file_comp variable. +# +# This completion will be run second as complete commands are added FILO. +# It triggers file completion choices when __%[1]s_comp_do_file_comp is set. +complete -c %[2]s -n 'set --query __%[1]s_comp_do_file_comp' + +# This completion will be run first as complete commands are added FILO. +# The call to __%[1]s_prepare_completions will setup both __%[1]s_comp_results and __%[1]s_comp_do_file_comp. +# It provides the program's completion choices. +complete -c %[2]s -n '__%[1]s_prepare_completions' -f -a '$__%[1]s_comp_results' + +`, nameForVar, name, compCmd, + ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, + ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs)) +} + +// GenFishCompletion generates fish completion file and writes to the passed writer. +func (c *Command) GenFishCompletion(w io.Writer, includeDesc bool) error { + buf := new(bytes.Buffer) + genFishComp(buf, c.Name(), includeDesc) + _, err := buf.WriteTo(w) + return err +} + +// GenFishCompletionFile generates fish completion file. +func (c *Command) GenFishCompletionFile(filename string, includeDesc bool) error { + outFile, err := os.Create(filename) + if err != nil { + return err + } + defer outFile.Close() + + return c.GenFishCompletion(outFile, includeDesc) +} diff --git a/vendor/github.com/spf13/cobra/fish_completions.md b/vendor/github.com/spf13/cobra/fish_completions.md new file mode 100644 index 0000000000..19b2ed1293 --- /dev/null +++ b/vendor/github.com/spf13/cobra/fish_completions.md @@ -0,0 +1,4 @@ +## Generating Fish Completions For Your cobra.Command + +Please refer to [Shell Completions](shell_completions.md) for details. + diff --git a/vendor/github.com/spf13/cobra/go.mod b/vendor/github.com/spf13/cobra/go.mod new file mode 100644 index 0000000000..ff56144056 --- /dev/null +++ b/vendor/github.com/spf13/cobra/go.mod @@ -0,0 +1,12 @@ +module github.com/spf13/cobra + +go 1.12 + +require ( + github.com/cpuguy83/go-md2man/v2 v2.0.0 + github.com/inconshreveable/mousetrap v1.0.0 + github.com/mitchellh/go-homedir v1.1.0 + github.com/spf13/pflag v1.0.5 + github.com/spf13/viper v1.7.0 + gopkg.in/yaml.v2 v2.4.0 +) diff --git a/vendor/github.com/spf13/cobra/go.sum b/vendor/github.com/spf13/cobra/go.sum new file mode 100644 index 0000000000..9328ee3ee7 --- /dev/null +++ b/vendor/github.com/spf13/cobra/go.sum @@ -0,0 +1,313 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= +github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= +github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/github.com/spf13/cobra/powershell_completions.go b/vendor/github.com/spf13/cobra/powershell_completions.go new file mode 100644 index 0000000000..c55be71cd1 --- /dev/null +++ b/vendor/github.com/spf13/cobra/powershell_completions.go @@ -0,0 +1,285 @@ +// The generated scripts require PowerShell v5.0+ (which comes Windows 10, but +// can be downloaded separately for windows 7 or 8.1). + +package cobra + +import ( + "bytes" + "fmt" + "io" + "os" +) + +func genPowerShellComp(buf io.StringWriter, name string, includeDesc bool) { + compCmd := ShellCompRequestCmd + if !includeDesc { + compCmd = ShellCompNoDescRequestCmd + } + WriteStringAndCheck(buf, fmt.Sprintf(`# powershell completion for %-36[1]s -*- shell-script -*- + +function __%[1]s_debug { + if ($env:BASH_COMP_DEBUG_FILE) { + "$args" | Out-File -Append -FilePath "$env:BASH_COMP_DEBUG_FILE" + } +} + +filter __%[1]s_escapeStringWithSpecialChars { +`+" $_ -replace '\\s|#|@|\\$|;|,|''|\\{|\\}|\\(|\\)|\"|`|\\||<|>|&','`$&'"+` +} + +Register-ArgumentCompleter -CommandName '%[1]s' -ScriptBlock { + param( + $WordToComplete, + $CommandAst, + $CursorPosition + ) + + # Get the current command line and convert into a string + $Command = $CommandAst.CommandElements + $Command = "$Command" + + __%[1]s_debug "" + __%[1]s_debug "========= starting completion logic ==========" + __%[1]s_debug "WordToComplete: $WordToComplete Command: $Command CursorPosition: $CursorPosition" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CursorPosition location, so we need + # to truncate the command-line ($Command) up to the $CursorPosition location. + # Make sure the $Command is longer then the $CursorPosition before we truncate. + # This happens because the $Command does not include the last space. + if ($Command.Length -gt $CursorPosition) { + $Command=$Command.Substring(0,$CursorPosition) + } + __%[1]s_debug "Truncated command: $Command" + + $ShellCompDirectiveError=%[3]d + $ShellCompDirectiveNoSpace=%[4]d + $ShellCompDirectiveNoFileComp=%[5]d + $ShellCompDirectiveFilterFileExt=%[6]d + $ShellCompDirectiveFilterDirs=%[7]d + + # Prepare the command to request completions for the program. + # Split the command at the first space to separate the program and arguments. + $Program,$Arguments = $Command.Split(" ",2) + $RequestComp="$Program %[2]s $Arguments" + __%[1]s_debug "RequestComp: $RequestComp" + + # we cannot use $WordToComplete because it + # has the wrong values if the cursor was moved + # so use the last argument + if ($WordToComplete -ne "" ) { + $WordToComplete = $Arguments.Split(" ")[-1] + } + __%[1]s_debug "New WordToComplete: $WordToComplete" + + + # Check for flag with equal sign + $IsEqualFlag = ($WordToComplete -Like "--*=*" ) + if ( $IsEqualFlag ) { + __%[1]s_debug "Completing equal sign flag" + # Remove the flag part + $Flag,$WordToComplete = $WordToComplete.Split("=",2) + } + + if ( $WordToComplete -eq "" -And ( -Not $IsEqualFlag )) { + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go method. + __%[1]s_debug "Adding extra empty parameter" +`+" # We need to use `\"`\" to pass an empty argument a \"\" or '' does not work!!!"+` +`+" $RequestComp=\"$RequestComp\" + ' `\"`\"' "+` + } + + __%[1]s_debug "Calling $RequestComp" + #call the command store the output in $out and redirect stderr and stdout to null + # $Out is an array contains each line per element + Invoke-Expression -OutVariable out "$RequestComp" 2>&1 | Out-Null + + + # get directive from last line + [int]$Directive = $Out[-1].TrimStart(':') + if ($Directive -eq "") { + # There is no directive specified + $Directive = 0 + } + __%[1]s_debug "The completion directive is: $Directive" + + # remove directive (last element) from out + $Out = $Out | Where-Object { $_ -ne $Out[-1] } + __%[1]s_debug "The completions are: $Out" + + if (($Directive -band $ShellCompDirectiveError) -ne 0 ) { + # Error code. No completion. + __%[1]s_debug "Received error from custom completion go code" + return + } + + $Longest = 0 + $Values = $Out | ForEach-Object { + #Split the output in name and description +`+" $Name, $Description = $_.Split(\"`t\",2)"+` + __%[1]s_debug "Name: $Name Description: $Description" + + # Look for the longest completion so that we can format things nicely + if ($Longest -lt $Name.Length) { + $Longest = $Name.Length + } + + # Set the description to a one space string if there is none set. + # This is needed because the CompletionResult does not accept an empty string as argument + if (-Not $Description) { + $Description = " " + } + @{Name="$Name";Description="$Description"} + } + + + $Space = " " + if (($Directive -band $ShellCompDirectiveNoSpace) -ne 0 ) { + # remove the space here + __%[1]s_debug "ShellCompDirectiveNoSpace is called" + $Space = "" + } + + if (($Directive -band $ShellCompDirectiveNoFileComp) -ne 0 ) { + __%[1]s_debug "ShellCompDirectiveNoFileComp is called" + + if ($Values.Length -eq 0) { + # Just print an empty string here so the + # shell does not start to complete paths. + # We cannot use CompletionResult here because + # it does not accept an empty string as argument. + "" + return + } + } + + if ((($Directive -band $ShellCompDirectiveFilterFileExt) -ne 0 ) -or + (($Directive -band $ShellCompDirectiveFilterDirs) -ne 0 )) { + __%[1]s_debug "ShellCompDirectiveFilterFileExt ShellCompDirectiveFilterDirs are not supported" + + # return here to prevent the completion of the extensions + return + } + + $Values = $Values | Where-Object { + # filter the result + $_.Name -like "$WordToComplete*" + + # Join the flag back if we have a equal sign flag + if ( $IsEqualFlag ) { + __%[1]s_debug "Join the equal sign flag back to the completion value" + $_.Name = $Flag + "=" + $_.Name + } + } + + # Get the current mode + $Mode = (Get-PSReadLineKeyHandler | Where-Object {$_.Key -eq "Tab" }).Function + __%[1]s_debug "Mode: $Mode" + + $Values | ForEach-Object { + + # store temporay because switch will overwrite $_ + $comp = $_ + + # PowerShell supports three different completion modes + # - TabCompleteNext (default windows style - on each key press the next option is displayed) + # - Complete (works like bash) + # - MenuComplete (works like zsh) + # You set the mode with Set-PSReadLineKeyHandler -Key Tab -Function + + # CompletionResult Arguments: + # 1) CompletionText text to be used as the auto completion result + # 2) ListItemText text to be displayed in the suggestion list + # 3) ResultType type of completion result + # 4) ToolTip text for the tooltip with details about the object + + switch ($Mode) { + + # bash like + "Complete" { + + if ($Values.Length -eq 1) { + __%[1]s_debug "Only one completion left" + + # insert space after value + [System.Management.Automation.CompletionResult]::new($($comp.Name | __%[1]s_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)") + + } else { + # Add the proper number of spaces to align the descriptions + while($comp.Name.Length -lt $Longest) { + $comp.Name = $comp.Name + " " + } + + # Check for empty description and only add parentheses if needed + if ($($comp.Description) -eq " " ) { + $Description = "" + } else { + $Description = " ($($comp.Description))" + } + + [System.Management.Automation.CompletionResult]::new("$($comp.Name)$Description", "$($comp.Name)$Description", 'ParameterValue', "$($comp.Description)") + } + } + + # zsh like + "MenuComplete" { + # insert space after value + # MenuComplete will automatically show the ToolTip of + # the highlighted value at the bottom of the suggestions. + [System.Management.Automation.CompletionResult]::new($($comp.Name | __%[1]s_escapeStringWithSpecialChars) + $Space, "$($comp.Name)", 'ParameterValue', "$($comp.Description)") + } + + # TabCompleteNext and in case we get something unknown + Default { + # Like MenuComplete but we don't want to add a space here because + # the user need to press space anyway to get the completion. + # Description will not be shown because thats not possible with TabCompleteNext + [System.Management.Automation.CompletionResult]::new($($comp.Name | __%[1]s_escapeStringWithSpecialChars), "$($comp.Name)", 'ParameterValue', "$($comp.Description)") + } + } + + } +} +`, name, compCmd, + ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, + ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs)) +} + +func (c *Command) genPowerShellCompletion(w io.Writer, includeDesc bool) error { + buf := new(bytes.Buffer) + genPowerShellComp(buf, c.Name(), includeDesc) + _, err := buf.WriteTo(w) + return err +} + +func (c *Command) genPowerShellCompletionFile(filename string, includeDesc bool) error { + outFile, err := os.Create(filename) + if err != nil { + return err + } + defer outFile.Close() + + return c.genPowerShellCompletion(outFile, includeDesc) +} + +// GenPowerShellCompletionFile generates powershell completion file without descriptions. +func (c *Command) GenPowerShellCompletionFile(filename string) error { + return c.genPowerShellCompletionFile(filename, false) +} + +// GenPowerShellCompletion generates powershell completion file without descriptions +// and writes it to the passed writer. +func (c *Command) GenPowerShellCompletion(w io.Writer) error { + return c.genPowerShellCompletion(w, false) +} + +// GenPowerShellCompletionFileWithDesc generates powershell completion file with descriptions. +func (c *Command) GenPowerShellCompletionFileWithDesc(filename string) error { + return c.genPowerShellCompletionFile(filename, true) +} + +// GenPowerShellCompletionWithDesc generates powershell completion file with descriptions +// and writes it to the passed writer. +func (c *Command) GenPowerShellCompletionWithDesc(w io.Writer) error { + return c.genPowerShellCompletion(w, true) +} diff --git a/vendor/github.com/spf13/cobra/powershell_completions.md b/vendor/github.com/spf13/cobra/powershell_completions.md new file mode 100644 index 0000000000..c449f1e5c0 --- /dev/null +++ b/vendor/github.com/spf13/cobra/powershell_completions.md @@ -0,0 +1,3 @@ +# Generating PowerShell Completions For Your Own cobra.Command + +Please refer to [Shell Completions](shell_completions.md#powershell-completions) for details. diff --git a/vendor/github.com/spf13/cobra/projects_using_cobra.md b/vendor/github.com/spf13/cobra/projects_using_cobra.md new file mode 100644 index 0000000000..d98a71e36f --- /dev/null +++ b/vendor/github.com/spf13/cobra/projects_using_cobra.md @@ -0,0 +1,38 @@ +## Projects using Cobra + +- [Arduino CLI](https://github.com/arduino/arduino-cli) +- [Bleve](http://www.blevesearch.com/) +- [CockroachDB](http://www.cockroachlabs.com/) +- [Cosmos SDK](https://github.com/cosmos/cosmos-sdk) +- [Delve](https://github.com/derekparker/delve) +- [Docker (distribution)](https://github.com/docker/distribution) +- [Etcd](https://etcd.io/) +- [Gardener](https://github.com/gardener/gardenctl) +- [Giant Swarm's gsctl](https://github.com/giantswarm/gsctl) +- [Git Bump](https://github.com/erdaltsksn/git-bump) +- [Github CLI](https://github.com/cli/cli) +- [GitHub Labeler](https://github.com/erdaltsksn/gh-label) +- [Golangci-lint](https://golangci-lint.run) +- [GopherJS](http://www.gopherjs.org/) +- [Helm](https://helm.sh) +- [Hugo](https://gohugo.io) +- [Istio](https://istio.io) +- [Kool](https://github.com/kool-dev/kool) +- [Kubernetes](http://kubernetes.io/) +- [Linkerd](https://linkerd.io/) +- [Mattermost-server](https://github.com/mattermost/mattermost-server) +- [Metal Stack CLI](https://github.com/metal-stack/metalctl) +- [Moby (former Docker)](https://github.com/moby/moby) +- [Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack) +- [OpenShift](https://www.openshift.com/) +- [Ory Hydra](https://github.com/ory/hydra) +- [Ory Kratos](https://github.com/ory/kratos) +- [Pouch](https://github.com/alibaba/pouch) +- [ProjectAtomic (enterprise)](http://www.projectatomic.io/) +- [Prototool](https://github.com/uber/prototool) +- [Random](https://github.com/erdaltsksn/random) +- [Rclone](https://rclone.org/) +- [Skaffold](https://skaffold.dev/) +- [Tendermint](https://github.com/tendermint/tendermint) +- [Twitch CLI](https://github.com/twitchdev/twitch-cli) +- [Werf](https://werf.io/) diff --git a/vendor/github.com/spf13/cobra/shell_completions.go b/vendor/github.com/spf13/cobra/shell_completions.go new file mode 100644 index 0000000000..d99bf91e5f --- /dev/null +++ b/vendor/github.com/spf13/cobra/shell_completions.go @@ -0,0 +1,84 @@ +package cobra + +import ( + "github.com/spf13/pflag" +) + +// MarkFlagRequired instructs the various shell completion implementations to +// prioritize the named flag when performing completion, +// and causes your command to report an error if invoked without the flag. +func (c *Command) MarkFlagRequired(name string) error { + return MarkFlagRequired(c.Flags(), name) +} + +// MarkPersistentFlagRequired instructs the various shell completion implementations to +// prioritize the named persistent flag when performing completion, +// and causes your command to report an error if invoked without the flag. +func (c *Command) MarkPersistentFlagRequired(name string) error { + return MarkFlagRequired(c.PersistentFlags(), name) +} + +// MarkFlagRequired instructs the various shell completion implementations to +// prioritize the named flag when performing completion, +// and causes your command to report an error if invoked without the flag. +func MarkFlagRequired(flags *pflag.FlagSet, name string) error { + return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"}) +} + +// MarkFlagFilename instructs the various shell completion implementations to +// limit completions for the named flag to the specified file extensions. +func (c *Command) MarkFlagFilename(name string, extensions ...string) error { + return MarkFlagFilename(c.Flags(), name, extensions...) +} + +// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. +// The bash completion script will call the bash function f for the flag. +// +// This will only work for bash completion. +// It is recommended to instead use c.RegisterFlagCompletionFunc(...) which allows +// to register a Go function which will work across all shells. +func (c *Command) MarkFlagCustom(name string, f string) error { + return MarkFlagCustom(c.Flags(), name, f) +} + +// MarkPersistentFlagFilename instructs the various shell completion +// implementations to limit completions for the named persistent flag to the +// specified file extensions. +func (c *Command) MarkPersistentFlagFilename(name string, extensions ...string) error { + return MarkFlagFilename(c.PersistentFlags(), name, extensions...) +} + +// MarkFlagFilename instructs the various shell completion implementations to +// limit completions for the named flag to the specified file extensions. +func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error { + return flags.SetAnnotation(name, BashCompFilenameExt, extensions) +} + +// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists. +// The bash completion script will call the bash function f for the flag. +// +// This will only work for bash completion. +// It is recommended to instead use c.RegisterFlagCompletionFunc(...) which allows +// to register a Go function which will work across all shells. +func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error { + return flags.SetAnnotation(name, BashCompCustom, []string{f}) +} + +// MarkFlagDirname instructs the various shell completion implementations to +// limit completions for the named flag to directory names. +func (c *Command) MarkFlagDirname(name string) error { + return MarkFlagDirname(c.Flags(), name) +} + +// MarkPersistentFlagDirname instructs the various shell completion +// implementations to limit completions for the named persistent flag to +// directory names. +func (c *Command) MarkPersistentFlagDirname(name string) error { + return MarkFlagDirname(c.PersistentFlags(), name) +} + +// MarkFlagDirname instructs the various shell completion implementations to +// limit completions for the named flag to directory names. +func MarkFlagDirname(flags *pflag.FlagSet, name string) error { + return flags.SetAnnotation(name, BashCompSubdirsInDir, []string{}) +} diff --git a/vendor/github.com/spf13/cobra/shell_completions.md b/vendor/github.com/spf13/cobra/shell_completions.md new file mode 100644 index 0000000000..cd533ac3d4 --- /dev/null +++ b/vendor/github.com/spf13/cobra/shell_completions.md @@ -0,0 +1,483 @@ +# Generating shell completions + +Cobra can generate shell completions for multiple shells. +The currently supported shells are: +- Bash +- Zsh +- fish +- PowerShell + +If you are using the generator, you can create a completion command by running + +```bash +cobra add completion +``` +and then modifying the generated `cmd/completion.go` file to look something like this +(writing the shell script to stdout allows the most flexible use): + +```go +var completionCmd = &cobra.Command{ + Use: "completion [bash|zsh|fish|powershell]", + Short: "Generate completion script", + Long: `To load completions: + +Bash: + + $ source <(yourprogram completion bash) + + # To load completions for each session, execute once: + # Linux: + $ yourprogram completion bash > /etc/bash_completion.d/yourprogram + # macOS: + $ yourprogram completion bash > /usr/local/etc/bash_completion.d/yourprogram + +Zsh: + + # If shell completion is not already enabled in your environment, + # you will need to enable it. You can execute the following once: + + $ echo "autoload -U compinit; compinit" >> ~/.zshrc + + # To load completions for each session, execute once: + $ yourprogram completion zsh > "${fpath[1]}/_yourprogram" + + # You will need to start a new shell for this setup to take effect. + +fish: + + $ yourprogram completion fish | source + + # To load completions for each session, execute once: + $ yourprogram completion fish > ~/.config/fish/completions/yourprogram.fish + +PowerShell: + + PS> yourprogram completion powershell | Out-String | Invoke-Expression + + # To load completions for every new session, run: + PS> yourprogram completion powershell > yourprogram.ps1 + # and source this file from your PowerShell profile. +`, + DisableFlagsInUseLine: true, + ValidArgs: []string{"bash", "zsh", "fish", "powershell"}, + Args: cobra.ExactValidArgs(1), + Run: func(cmd *cobra.Command, args []string) { + switch args[0] { + case "bash": + cmd.Root().GenBashCompletion(os.Stdout) + case "zsh": + cmd.Root().GenZshCompletion(os.Stdout) + case "fish": + cmd.Root().GenFishCompletion(os.Stdout, true) + case "powershell": + cmd.Root().GenPowerShellCompletion(os.Stdout) + } + }, +} +``` + +**Note:** The cobra generator may include messages printed to stdout, for example, if the config file is loaded; this will break the auto-completion script so must be removed. + +# Customizing completions + +The generated completion scripts will automatically handle completing commands and flags. However, you can make your completions much more powerful by providing information to complete your program's nouns and flag values. + +## Completion of nouns + +### Static completion of nouns + +Cobra allows you to provide a pre-defined list of completion choices for your nouns using the `ValidArgs` field. +For example, if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. +Some simplified code from `kubectl get` looks like: + +```go +validArgs []string = { "pod", "node", "service", "replicationcontroller" } + +cmd := &cobra.Command{ + Use: "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)", + Short: "Display one or many resources", + Long: get_long, + Example: get_example, + Run: func(cmd *cobra.Command, args []string) { + cobra.CheckErr(RunGet(f, out, cmd, args)) + }, + ValidArgs: validArgs, +} +``` + +Notice we put the `ValidArgs` field on the `get` sub-command. Doing so will give results like: + +```bash +$ kubectl get [tab][tab] +node pod replicationcontroller service +``` + +#### Aliases for nouns + +If your nouns have aliases, you can define them alongside `ValidArgs` using `ArgAliases`: + +```go +argAliases []string = { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" } + +cmd := &cobra.Command{ + ... + ValidArgs: validArgs, + ArgAliases: argAliases +} +``` + +The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by +the completion algorithm if entered manually, e.g. in: + +```bash +$ kubectl get rc [tab][tab] +backend frontend database +``` + +Note that without declaring `rc` as an alias, the completion algorithm would not know to show the list of +replication controllers following `rc`. + +### Dynamic completion of nouns + +In some cases it is not possible to provide a list of completions in advance. Instead, the list of completions must be determined at execution-time. In a similar fashion as for static completions, you can use the `ValidArgsFunction` field to provide a Go function that Cobra will execute when it needs the list of completion choices for the nouns of a command. Note that either `ValidArgs` or `ValidArgsFunction` can be used for a single cobra command, but not both. +Simplified code from `helm status` looks like: + +```go +cmd := &cobra.Command{ + Use: "status RELEASE_NAME", + Short: "Display the status of the named release", + Long: status_long, + RunE: func(cmd *cobra.Command, args []string) { + RunGet(args[0]) + }, + ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + if len(args) != 0 { + return nil, cobra.ShellCompDirectiveNoFileComp + } + return getReleasesFromCluster(toComplete), cobra.ShellCompDirectiveNoFileComp + }, +} +``` +Where `getReleasesFromCluster()` is a Go function that obtains the list of current Helm releases running on the Kubernetes cluster. +Notice we put the `ValidArgsFunction` on the `status` sub-command. Let's assume the Helm releases on the cluster are: `harbor`, `notary`, `rook` and `thanos` then this dynamic completion will give results like: + +```bash +$ helm status [tab][tab] +harbor notary rook thanos +``` +You may have noticed the use of `cobra.ShellCompDirective`. These directives are bit fields allowing to control some shell completion behaviors for your particular completion. You can combine them with the bit-or operator such as `cobra.ShellCompDirectiveNoSpace | cobra.ShellCompDirectiveNoFileComp` +```go +// Indicates that the shell will perform its default behavior after completions +// have been provided (this implies none of the other directives). +ShellCompDirectiveDefault + +// Indicates an error occurred and completions should be ignored. +ShellCompDirectiveError + +// Indicates that the shell should not add a space after the completion, +// even if there is a single completion provided. +ShellCompDirectiveNoSpace + +// Indicates that the shell should not provide file completion even when +// no completion is provided. +ShellCompDirectiveNoFileComp + +// Indicates that the returned completions should be used as file extension filters. +// For example, to complete only files of the form *.json or *.yaml: +// return []string{"yaml", "json"}, ShellCompDirectiveFilterFileExt +// For flags, using MarkFlagFilename() and MarkPersistentFlagFilename() +// is a shortcut to using this directive explicitly. +// +ShellCompDirectiveFilterFileExt + +// Indicates that only directory names should be provided in file completion. +// For example: +// return nil, ShellCompDirectiveFilterDirs +// For flags, using MarkFlagDirname() is a shortcut to using this directive explicitly. +// +// To request directory names within another directory, the returned completions +// should specify a single directory name within which to search. For example, +// to complete directories within "themes/": +// return []string{"themes"}, ShellCompDirectiveFilterDirs +// +ShellCompDirectiveFilterDirs +``` + +***Note***: When using the `ValidArgsFunction`, Cobra will call your registered function after having parsed all flags and arguments provided in the command-line. You therefore don't need to do this parsing yourself. For example, when a user calls `helm status --namespace my-rook-ns [tab][tab]`, Cobra will call your registered `ValidArgsFunction` after having parsed the `--namespace` flag, as it would have done when calling the `RunE` function. + +#### Debugging + +Cobra achieves dynamic completion through the use of a hidden command called by the completion script. To debug your Go completion code, you can call this hidden command directly: +```bash +$ helm __complete status har +harbor +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr +``` +***Important:*** If the noun to complete is empty (when the user has not yet typed any letters of that noun), you must pass an empty parameter to the `__complete` command: +```bash +$ helm __complete status "" +harbor +notary +rook +thanos +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr +``` +Calling the `__complete` command directly allows you to run the Go debugger to troubleshoot your code. You can also add printouts to your code; Cobra provides the following functions to use for printouts in Go completion code: +```go +// Prints to the completion script debug file (if BASH_COMP_DEBUG_FILE +// is set to a file path) and optionally prints to stderr. +cobra.CompDebug(msg string, printToStdErr bool) { +cobra.CompDebugln(msg string, printToStdErr bool) + +// Prints to the completion script debug file (if BASH_COMP_DEBUG_FILE +// is set to a file path) and to stderr. +cobra.CompError(msg string) +cobra.CompErrorln(msg string) +``` +***Important:*** You should **not** leave traces that print directly to stdout in your completion code as they will be interpreted as completion choices by the completion script. Instead, use the cobra-provided debugging traces functions mentioned above. + +## Completions for flags + +### Mark flags as required + +Most of the time completions will only show sub-commands. But if a flag is required to make a sub-command work, you probably want it to show up when the user types [tab][tab]. You can mark a flag as 'Required' like so: + +```go +cmd.MarkFlagRequired("pod") +cmd.MarkFlagRequired("container") +``` + +and you'll get something like + +```bash +$ kubectl exec [tab][tab] +-c --container= -p --pod= +``` + +### Specify dynamic flag completion + +As for nouns, Cobra provides a way of defining dynamic completion of flags. To provide a Go function that Cobra will execute when it needs the list of completion choices for a flag, you must register the function using the `command.RegisterFlagCompletionFunc()` function. + +```go +flagName := "output" +cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"json", "table", "yaml"}, cobra.ShellCompDirectiveDefault +}) +``` +Notice that calling `RegisterFlagCompletionFunc()` is done through the `command` with which the flag is associated. In our example this dynamic completion will give results like so: + +```bash +$ helm status --output [tab][tab] +json table yaml +``` + +#### Debugging + +You can also easily debug your Go completion code for flags: +```bash +$ helm __complete status --output "" +json +table +yaml +:4 +Completion ended with directive: ShellCompDirectiveNoFileComp # This is on stderr +``` +***Important:*** You should **not** leave traces that print to stdout in your completion code as they will be interpreted as completion choices by the completion script. Instead, use the cobra-provided debugging traces functions mentioned further above. + +### Specify valid filename extensions for flags that take a filename + +To limit completions of flag values to file names with certain extensions you can either use the different `MarkFlagFilename()` functions or a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterFileExt`, like so: +```go +flagName := "output" +cmd.MarkFlagFilename(flagName, "yaml", "json") +``` +or +```go +flagName := "output" +cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"yaml", "json"}, ShellCompDirectiveFilterFileExt}) +``` + +### Limit flag completions to directory names + +To limit completions of flag values to directory names you can either use the `MarkFlagDirname()` functions or a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterDirs`, like so: +```go +flagName := "output" +cmd.MarkFlagDirname(flagName) +``` +or +```go +flagName := "output" +cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return nil, cobra.ShellCompDirectiveFilterDirs +}) +``` +To limit completions of flag values to directory names *within another directory* you can use a combination of `RegisterFlagCompletionFunc()` and `ShellCompDirectiveFilterDirs` like so: +```go +flagName := "output" +cmd.RegisterFlagCompletionFunc(flagName, func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"themes"}, cobra.ShellCompDirectiveFilterDirs +}) +``` +### Descriptions for completions + +`zsh`, `fish` and `powershell` allow for descriptions to annotate completion choices. For commands and flags, Cobra will provide the descriptions automatically, based on usage information. For example, using zsh: +``` +$ helm s[tab] +search -- search for a keyword in charts +show -- show information of a chart +status -- displays the status of the named release +``` +while using fish: +``` +$ helm s[tab] +search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) +``` + +Cobra allows you to add annotations to your own completions. Simply add the annotation text after each completion, following a `\t` separator. This technique applies to completions returned by `ValidArgs`, `ValidArgsFunction` and `RegisterFlagCompletionFunc()`. For example: +```go +ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { + return []string{"harbor\tAn image registry", "thanos\tLong-term metrics"}, cobra.ShellCompDirectiveNoFileComp +}} +``` +or +```go +ValidArgs: []string{"bash\tCompletions for bash", "zsh\tCompletions for zsh"} +``` +## Bash completions + +### Dependencies + +The bash completion script generated by Cobra requires the `bash_completion` package. You should update the help text of your completion command to show how to install the `bash_completion` package ([Kubectl docs](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion)) + +### Aliases + +You can also configure `bash` aliases for your program and they will also support completions. + +```bash +alias aliasname=origcommand +complete -o default -F __start_origcommand aliasname + +# and now when you run `aliasname` completion will make +# suggestions as it did for `origcommand`. + +$ aliasname +completion firstcommand secondcommand +``` +### Bash legacy dynamic completions + +For backward compatibility, Cobra still supports its bash legacy dynamic completion solution. +Please refer to [Bash Completions](bash_completions.md) for details. + +## Zsh completions + +Cobra supports native zsh completion generated from the root `cobra.Command`. +The generated completion script should be put somewhere in your `$fpath` and be named +`_`. You will need to start a new shell for the completions to become available. + +Zsh supports descriptions for completions. Cobra will provide the description automatically, +based on usage information. Cobra provides a way to completely disable such descriptions by +using `GenZshCompletionNoDesc()` or `GenZshCompletionFileNoDesc()`. You can choose to make +this a configurable option to your users. +``` +# With descriptions +$ helm s[tab] +search -- search for a keyword in charts +show -- show information of a chart +status -- displays the status of the named release + +# Without descriptions +$ helm s[tab] +search show status +``` +*Note*: Because of backward-compatibility requirements, we were forced to have a different API to disable completion descriptions between `zsh` and `fish`. + +### Limitations + +* Custom completions implemented in Bash scripting (legacy) are not supported and will be ignored for `zsh` (including the use of the `BashCompCustom` flag annotation). + * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). +* The function `MarkFlagCustom()` is not supported and will be ignored for `zsh`. + * You should instead use `RegisterFlagCompletionFunc()`. + +### Zsh completions standardization + +Cobra 1.1 standardized its zsh completion support to align it with its other shell completions. Although the API was kept backward-compatible, some small changes in behavior were introduced. +Please refer to [Zsh Completions](zsh_completions.md) for details. + +## fish completions + +Cobra supports native fish completions generated from the root `cobra.Command`. You can use the `command.GenFishCompletion()` or `command.GenFishCompletionFile()` functions. You must provide these functions with a parameter indicating if the completions should be annotated with a description; Cobra will provide the description automatically based on usage information. You can choose to make this option configurable by your users. +``` +# With descriptions +$ helm s[tab] +search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) + +# Without descriptions +$ helm s[tab] +search show status +``` +*Note*: Because of backward-compatibility requirements, we were forced to have a different API to disable completion descriptions between `zsh` and `fish`. + +### Limitations + +* Custom completions implemented in bash scripting (legacy) are not supported and will be ignored for `fish` (including the use of the `BashCompCustom` flag annotation). + * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). +* The function `MarkFlagCustom()` is not supported and will be ignored for `fish`. + * You should instead use `RegisterFlagCompletionFunc()`. +* The following flag completion annotations are not supported and will be ignored for `fish`: + * `BashCompFilenameExt` (filtering by file extension) + * `BashCompSubdirsInDir` (filtering by directory) +* The functions corresponding to the above annotations are consequently not supported and will be ignored for `fish`: + * `MarkFlagFilename()` and `MarkPersistentFlagFilename()` (filtering by file extension) + * `MarkFlagDirname()` and `MarkPersistentFlagDirname()` (filtering by directory) +* Similarly, the following completion directives are not supported and will be ignored for `fish`: + * `ShellCompDirectiveFilterFileExt` (filtering by file extension) + * `ShellCompDirectiveFilterDirs` (filtering by directory) + +## PowerShell completions + +Cobra supports native PowerShell completions generated from the root `cobra.Command`. You can use the `command.GenPowerShellCompletion()` or `command.GenPowerShellCompletionFile()` functions. To include descriptions use `command.GenPowerShellCompletionWithDesc()` and `command.GenPowerShellCompletionFileWithDesc()`. Cobra will provide the description automatically based on usage information. You can choose to make this option configurable by your users. + +The script is designed to support all three PowerShell completion modes: + +* TabCompleteNext (default windows style - on each key press the next option is displayed) +* Complete (works like bash) +* MenuComplete (works like zsh) + +You set the mode with `Set-PSReadLineKeyHandler -Key Tab -Function `. Descriptions are only displayed when using the `Complete` or `MenuComplete` mode. + +Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the `$Profile` environment variable. See `Get-Help about_Profiles` for more info about PowerShell profiles. + +``` +# With descriptions and Mode 'Complete' +$ helm s[tab] +search (search for a keyword in charts) show (show information of a chart) status (displays the status of the named release) + +# With descriptions and Mode 'MenuComplete' The description of the current selected value will be displayed below the suggestions. +$ helm s[tab] +search show status + +search for a keyword in charts + +# Without descriptions +$ helm s[tab] +search show status +``` + +### Limitations + +* Custom completions implemented in bash scripting (legacy) are not supported and will be ignored for `powershell` (including the use of the `BashCompCustom` flag annotation). + * You should instead use `ValidArgsFunction` and `RegisterFlagCompletionFunc()` which are portable to the different shells (`bash`, `zsh`, `fish`, `powershell`). +* The function `MarkFlagCustom()` is not supported and will be ignored for `powershell`. + * You should instead use `RegisterFlagCompletionFunc()`. +* The following flag completion annotations are not supported and will be ignored for `powershell`: + * `BashCompFilenameExt` (filtering by file extension) + * `BashCompSubdirsInDir` (filtering by directory) +* The functions corresponding to the above annotations are consequently not supported and will be ignored for `powershell`: + * `MarkFlagFilename()` and `MarkPersistentFlagFilename()` (filtering by file extension) + * `MarkFlagDirname()` and `MarkPersistentFlagDirname()` (filtering by directory) +* Similarly, the following completion directives are not supported and will be ignored for `powershell`: + * `ShellCompDirectiveFilterFileExt` (filtering by file extension) + * `ShellCompDirectiveFilterDirs` (filtering by directory) diff --git a/vendor/github.com/spf13/cobra/zsh_completions.go b/vendor/github.com/spf13/cobra/zsh_completions.go new file mode 100644 index 0000000000..2e840285f3 --- /dev/null +++ b/vendor/github.com/spf13/cobra/zsh_completions.go @@ -0,0 +1,240 @@ +package cobra + +import ( + "bytes" + "fmt" + "io" + "os" +) + +// GenZshCompletionFile generates zsh completion file including descriptions. +func (c *Command) GenZshCompletionFile(filename string) error { + return c.genZshCompletionFile(filename, true) +} + +// GenZshCompletion generates zsh completion file including descriptions +// and writes it to the passed writer. +func (c *Command) GenZshCompletion(w io.Writer) error { + return c.genZshCompletion(w, true) +} + +// GenZshCompletionFileNoDesc generates zsh completion file without descriptions. +func (c *Command) GenZshCompletionFileNoDesc(filename string) error { + return c.genZshCompletionFile(filename, false) +} + +// GenZshCompletionNoDesc generates zsh completion file without descriptions +// and writes it to the passed writer. +func (c *Command) GenZshCompletionNoDesc(w io.Writer) error { + return c.genZshCompletion(w, false) +} + +// MarkZshCompPositionalArgumentFile only worked for zsh and its behavior was +// not consistent with Bash completion. It has therefore been disabled. +// Instead, when no other completion is specified, file completion is done by +// default for every argument. One can disable file completion on a per-argument +// basis by using ValidArgsFunction and ShellCompDirectiveNoFileComp. +// To achieve file extension filtering, one can use ValidArgsFunction and +// ShellCompDirectiveFilterFileExt. +// +// Deprecated +func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ...string) error { + return nil +} + +// MarkZshCompPositionalArgumentWords only worked for zsh. It has therefore +// been disabled. +// To achieve the same behavior across all shells, one can use +// ValidArgs (for the first argument only) or ValidArgsFunction for +// any argument (can include the first one also). +// +// Deprecated +func (c *Command) MarkZshCompPositionalArgumentWords(argPosition int, words ...string) error { + return nil +} + +func (c *Command) genZshCompletionFile(filename string, includeDesc bool) error { + outFile, err := os.Create(filename) + if err != nil { + return err + } + defer outFile.Close() + + return c.genZshCompletion(outFile, includeDesc) +} + +func (c *Command) genZshCompletion(w io.Writer, includeDesc bool) error { + buf := new(bytes.Buffer) + genZshComp(buf, c.Name(), includeDesc) + _, err := buf.WriteTo(w) + return err +} + +func genZshComp(buf io.StringWriter, name string, includeDesc bool) { + compCmd := ShellCompRequestCmd + if !includeDesc { + compCmd = ShellCompNoDescRequestCmd + } + WriteStringAndCheck(buf, fmt.Sprintf(`#compdef _%[1]s %[1]s + +# zsh completion for %-36[1]s -*- shell-script -*- + +__%[1]s_debug() +{ + local file="$BASH_COMP_DEBUG_FILE" + if [[ -n ${file} ]]; then + echo "$*" >> "${file}" + fi +} + +_%[1]s() +{ + local shellCompDirectiveError=%[3]d + local shellCompDirectiveNoSpace=%[4]d + local shellCompDirectiveNoFileComp=%[5]d + local shellCompDirectiveFilterFileExt=%[6]d + local shellCompDirectiveFilterDirs=%[7]d + + local lastParam lastChar flagPrefix requestComp out directive compCount comp lastComp + local -a completions + + __%[1]s_debug "\n========= starting completion logic ==========" + __%[1]s_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}" + + # The user could have moved the cursor backwards on the command-line. + # We need to trigger completion from the $CURRENT location, so we need + # to truncate the command-line ($words) up to the $CURRENT location. + # (We cannot use $CURSOR as its value does not work when a command is an alias.) + words=("${=words[1,CURRENT]}") + __%[1]s_debug "Truncated words[*]: ${words[*]}," + + lastParam=${words[-1]} + lastChar=${lastParam[-1]} + __%[1]s_debug "lastParam: ${lastParam}, lastChar: ${lastChar}" + + # For zsh, when completing a flag with an = (e.g., %[1]s -n=) + # completions must be prefixed with the flag + setopt local_options BASH_REMATCH + if [[ "${lastParam}" =~ '-.*=' ]]; then + # We are dealing with a flag with an = + flagPrefix="-P ${BASH_REMATCH}" + fi + + # Prepare the command to obtain completions + requestComp="${words[1]} %[2]s ${words[2,-1]}" + if [ "${lastChar}" = "" ]; then + # If the last parameter is complete (there is a space following it) + # We add an extra empty parameter so we can indicate this to the go completion code. + __%[1]s_debug "Adding extra empty parameter" + requestComp="${requestComp} \"\"" + fi + + __%[1]s_debug "About to call: eval ${requestComp}" + + # Use eval to handle any environment variables and such + out=$(eval ${requestComp} 2>/dev/null) + __%[1]s_debug "completion output: ${out}" + + # Extract the directive integer following a : from the last line + local lastLine + while IFS='\n' read -r line; do + lastLine=${line} + done < <(printf "%%s\n" "${out[@]}") + __%[1]s_debug "last line: ${lastLine}" + + if [ "${lastLine[1]}" = : ]; then + directive=${lastLine[2,-1]} + # Remove the directive including the : and the newline + local suffix + (( suffix=${#lastLine}+2)) + out=${out[1,-$suffix]} + else + # There is no directive specified. Leave $out as is. + __%[1]s_debug "No directive found. Setting do default" + directive=0 + fi + + __%[1]s_debug "directive: ${directive}" + __%[1]s_debug "completions: ${out}" + __%[1]s_debug "flagPrefix: ${flagPrefix}" + + if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then + __%[1]s_debug "Completion received error. Ignoring completions." + return + fi + + compCount=0 + while IFS='\n' read -r comp; do + if [ -n "$comp" ]; then + # If requested, completions are returned with a description. + # The description is preceded by a TAB character. + # For zsh's _describe, we need to use a : instead of a TAB. + # We first need to escape any : as part of the completion itself. + comp=${comp//:/\\:} + + local tab=$(printf '\t') + comp=${comp//$tab/:} + + ((compCount++)) + __%[1]s_debug "Adding completion: ${comp}" + completions+=${comp} + lastComp=$comp + fi + done < <(printf "%%s\n" "${out[@]}") + + if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then + # File extension filtering + local filteringCmd + filteringCmd='_files' + for filter in ${completions[@]}; do + if [ ${filter[1]} != '*' ]; then + # zsh requires a glob pattern to do file filtering + filter="\*.$filter" + fi + filteringCmd+=" -g $filter" + done + filteringCmd+=" ${flagPrefix}" + + __%[1]s_debug "File filtering command: $filteringCmd" + _arguments '*:filename:'"$filteringCmd" + elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then + # File completion for directories only + local subDir + subdir="${completions[1]}" + if [ -n "$subdir" ]; then + __%[1]s_debug "Listing directories in $subdir" + pushd "${subdir}" >/dev/null 2>&1 + else + __%[1]s_debug "Listing directories in ." + fi + + _arguments '*:dirname:_files -/'" ${flagPrefix}" + if [ -n "$subdir" ]; then + popd >/dev/null 2>&1 + fi + elif [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ] && [ ${compCount} -eq 1 ]; then + __%[1]s_debug "Activating nospace." + # We can use compadd here as there is no description when + # there is only one completion. + compadd -S '' "${lastComp}" + elif [ ${compCount} -eq 0 ]; then + if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then + __%[1]s_debug "deactivating file completion" + else + # Perform file completion + __%[1]s_debug "activating file completion" + _arguments '*:filename:_files'" ${flagPrefix}" + fi + else + _describe "completions" completions $(echo $flagPrefix) + fi +} + +# don't run the completion function when being source-ed or eval-ed +if [ "$funcstack[1]" = "_%[1]s" ]; then + _%[1]s +fi +`, name, compCmd, + ShellCompDirectiveError, ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp, + ShellCompDirectiveFilterFileExt, ShellCompDirectiveFilterDirs)) +} diff --git a/vendor/github.com/spf13/cobra/zsh_completions.md b/vendor/github.com/spf13/cobra/zsh_completions.md new file mode 100644 index 0000000000..7cff61787f --- /dev/null +++ b/vendor/github.com/spf13/cobra/zsh_completions.md @@ -0,0 +1,48 @@ +## Generating Zsh Completion For Your cobra.Command + +Please refer to [Shell Completions](shell_completions.md) for details. + +## Zsh completions standardization + +Cobra 1.1 standardized its zsh completion support to align it with its other shell completions. Although the API was kept backwards-compatible, some small changes in behavior were introduced. + +### Deprecation summary + +See further below for more details on these deprecations. + +* `cmd.MarkZshCompPositionalArgumentFile(pos, []string{})` is no longer needed. It is therefore **deprecated** and silently ignored. +* `cmd.MarkZshCompPositionalArgumentFile(pos, glob[])` is **deprecated** and silently ignored. + * Instead use `ValidArgsFunction` with `ShellCompDirectiveFilterFileExt`. +* `cmd.MarkZshCompPositionalArgumentWords()` is **deprecated** and silently ignored. + * Instead use `ValidArgsFunction`. + +### Behavioral changes + +**Noun completion** +|Old behavior|New behavior| +|---|---| +|No file completion by default (opposite of bash)|File completion by default; use `ValidArgsFunction` with `ShellCompDirectiveNoFileComp` to turn off file completion on a per-argument basis| +|Completion of flag names without the `-` prefix having been typed|Flag names are only completed if the user has typed the first `-`| +`cmd.MarkZshCompPositionalArgumentFile(pos, []string{})` used to turn on file completion on a per-argument position basis|File completion for all arguments by default; `cmd.MarkZshCompPositionalArgumentFile()` is **deprecated** and silently ignored| +|`cmd.MarkZshCompPositionalArgumentFile(pos, glob[])` used to turn on file completion **with glob filtering** on a per-argument position basis (zsh-specific)|`cmd.MarkZshCompPositionalArgumentFile()` is **deprecated** and silently ignored; use `ValidArgsFunction` with `ShellCompDirectiveFilterFileExt` for file **extension** filtering (not full glob filtering)| +|`cmd.MarkZshCompPositionalArgumentWords(pos, words[])` used to provide completion choices on a per-argument position basis (zsh-specific)|`cmd.MarkZshCompPositionalArgumentWords()` is **deprecated** and silently ignored; use `ValidArgsFunction` to achieve the same behavior| + +**Flag-value completion** + +|Old behavior|New behavior| +|---|---| +|No file completion by default (opposite of bash)|File completion by default; use `RegisterFlagCompletionFunc()` with `ShellCompDirectiveNoFileComp` to turn off file completion| +|`cmd.MarkFlagFilename(flag, []string{})` and similar used to turn on file completion|File completion by default; `cmd.MarkFlagFilename(flag, []string{})` no longer needed in this context and silently ignored| +|`cmd.MarkFlagFilename(flag, glob[])` used to turn on file completion **with glob filtering** (syntax of `[]string{"*.yaml", "*.yml"}` incompatible with bash)|Will continue to work, however, support for bash syntax is added and should be used instead so as to work for all shells (`[]string{"yaml", "yml"}`)| +|`cmd.MarkFlagDirname(flag)` only completes directories (zsh-specific)|Has been added for all shells| +|Completion of a flag name does not repeat, unless flag is of type `*Array` or `*Slice` (not supported by bash)|Retained for `zsh` and added to `fish`| +|Completion of a flag name does not provide the `=` form (unlike bash)|Retained for `zsh` and added to `fish`| + +**Improvements** + +* Custom completion support (`ValidArgsFunction` and `RegisterFlagCompletionFunc()`) +* File completion by default if no other completions found +* Handling of required flags +* File extension filtering no longer mutually exclusive with bash usage +* Completion of directory names *within* another directory +* Support for `=` form of flags diff --git a/vendor/github.com/spf13/pflag/.travis.yml b/vendor/github.com/spf13/pflag/.travis.yml index 707bdc39a7..00d04cb9b0 100644 --- a/vendor/github.com/spf13/pflag/.travis.yml +++ b/vendor/github.com/spf13/pflag/.travis.yml @@ -3,18 +3,20 @@ sudo: false language: go go: - - 1.6.3 - - 1.7.3 - - tip + - 1.9.x + - 1.10.x + - 1.11.x + - tip matrix: - allow_failures: - - go: tip + allow_failures: + - go: tip + install: - - go get github.com/golang/lint/golint - - export PATH=$GOPATH/bin:$PATH - - go install ./... + - go get golang.org/x/lint/golint + - export PATH=$GOPATH/bin:$PATH + - go install ./... script: - - verify/all.sh -v - - go test ./... + - verify/all.sh -v + - go test ./... diff --git a/vendor/github.com/spf13/pflag/README.md b/vendor/github.com/spf13/pflag/README.md index 3001fcd2ba..7eacc5bdbe 100644 --- a/vendor/github.com/spf13/pflag/README.md +++ b/vendor/github.com/spf13/pflag/README.md @@ -86,8 +86,8 @@ fmt.Println("ip has value ", *ip) fmt.Println("flagvar has value ", flagvar) ``` -There are helpers function to get values later if you have the FlagSet but -it was difficult to keep up with all of the flag pointers in your code. +There are helper functions available to get the value stored in a Flag if you have a FlagSet but find +it difficult to keep up with all of the pointers in your code. If you have a pflag.FlagSet with a flag called 'flagname' of type int you can use GetInt() to get the int value. But notice that 'flagname' must exist and it must be an int. GetString("flagname") will fail. @@ -246,6 +246,25 @@ It is possible to mark a flag as hidden, meaning it will still function as norma flags.MarkHidden("secretFlag") ``` +## Disable sorting of flags +`pflag` allows you to disable sorting of flags for help and usage message. + +**Example**: +```go +flags.BoolP("verbose", "v", false, "verbose output") +flags.String("coolflag", "yeaah", "it's really cool flag") +flags.Int("usefulflag", 777, "sometimes it's very useful") +flags.SortFlags = false +flags.PrintDefaults() +``` +**Output**: +``` + -v, --verbose verbose output + --coolflag string it's really cool flag (default "yeaah") + --usefulflag int sometimes it's very useful (default 777) +``` + + ## Supporting Go flags when using pflag In order to support flags defined using Go's `flag` package, they must be added to the `pflag` flagset. This is usually necessary to support flags defined by third-party dependencies (e.g. `golang/glog`). diff --git a/vendor/github.com/spf13/pflag/bool_slice.go b/vendor/github.com/spf13/pflag/bool_slice.go index 5af02f1a75..3731370d6a 100644 --- a/vendor/github.com/spf13/pflag/bool_slice.go +++ b/vendor/github.com/spf13/pflag/bool_slice.go @@ -71,6 +71,44 @@ func (s *boolSliceValue) String() string { return "[" + out + "]" } +func (s *boolSliceValue) fromString(val string) (bool, error) { + return strconv.ParseBool(val) +} + +func (s *boolSliceValue) toString(val bool) string { + return strconv.FormatBool(val) +} + +func (s *boolSliceValue) Append(val string) error { + i, err := s.fromString(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *boolSliceValue) Replace(val []string) error { + out := make([]bool, len(val)) + for i, d := range val { + var err error + out[i], err = s.fromString(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *boolSliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = s.toString(d) + } + return out +} + func boolSliceConv(val string) (interface{}, error) { val = strings.Trim(val, "[]") // Empty string would cause a slice with one (empty) entry diff --git a/vendor/github.com/spf13/pflag/bytes.go b/vendor/github.com/spf13/pflag/bytes.go new file mode 100644 index 0000000000..67d5304570 --- /dev/null +++ b/vendor/github.com/spf13/pflag/bytes.go @@ -0,0 +1,209 @@ +package pflag + +import ( + "encoding/base64" + "encoding/hex" + "fmt" + "strings" +) + +// BytesHex adapts []byte for use as a flag. Value of flag is HEX encoded +type bytesHexValue []byte + +// String implements pflag.Value.String. +func (bytesHex bytesHexValue) String() string { + return fmt.Sprintf("%X", []byte(bytesHex)) +} + +// Set implements pflag.Value.Set. +func (bytesHex *bytesHexValue) Set(value string) error { + bin, err := hex.DecodeString(strings.TrimSpace(value)) + + if err != nil { + return err + } + + *bytesHex = bin + + return nil +} + +// Type implements pflag.Value.Type. +func (*bytesHexValue) Type() string { + return "bytesHex" +} + +func newBytesHexValue(val []byte, p *[]byte) *bytesHexValue { + *p = val + return (*bytesHexValue)(p) +} + +func bytesHexConv(sval string) (interface{}, error) { + + bin, err := hex.DecodeString(sval) + + if err == nil { + return bin, nil + } + + return nil, fmt.Errorf("invalid string being converted to Bytes: %s %s", sval, err) +} + +// GetBytesHex return the []byte value of a flag with the given name +func (f *FlagSet) GetBytesHex(name string) ([]byte, error) { + val, err := f.getFlagType(name, "bytesHex", bytesHexConv) + + if err != nil { + return []byte{}, err + } + + return val.([]byte), nil +} + +// BytesHexVar defines an []byte flag with specified name, default value, and usage string. +// The argument p points to an []byte variable in which to store the value of the flag. +func (f *FlagSet) BytesHexVar(p *[]byte, name string, value []byte, usage string) { + f.VarP(newBytesHexValue(value, p), name, "", usage) +} + +// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) { + f.VarP(newBytesHexValue(value, p), name, shorthand, usage) +} + +// BytesHexVar defines an []byte flag with specified name, default value, and usage string. +// The argument p points to an []byte variable in which to store the value of the flag. +func BytesHexVar(p *[]byte, name string, value []byte, usage string) { + CommandLine.VarP(newBytesHexValue(value, p), name, "", usage) +} + +// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash. +func BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) { + CommandLine.VarP(newBytesHexValue(value, p), name, shorthand, usage) +} + +// BytesHex defines an []byte flag with specified name, default value, and usage string. +// The return value is the address of an []byte variable that stores the value of the flag. +func (f *FlagSet) BytesHex(name string, value []byte, usage string) *[]byte { + p := new([]byte) + f.BytesHexVarP(p, name, "", value, usage) + return p +} + +// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) BytesHexP(name, shorthand string, value []byte, usage string) *[]byte { + p := new([]byte) + f.BytesHexVarP(p, name, shorthand, value, usage) + return p +} + +// BytesHex defines an []byte flag with specified name, default value, and usage string. +// The return value is the address of an []byte variable that stores the value of the flag. +func BytesHex(name string, value []byte, usage string) *[]byte { + return CommandLine.BytesHexP(name, "", value, usage) +} + +// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash. +func BytesHexP(name, shorthand string, value []byte, usage string) *[]byte { + return CommandLine.BytesHexP(name, shorthand, value, usage) +} + +// BytesBase64 adapts []byte for use as a flag. Value of flag is Base64 encoded +type bytesBase64Value []byte + +// String implements pflag.Value.String. +func (bytesBase64 bytesBase64Value) String() string { + return base64.StdEncoding.EncodeToString([]byte(bytesBase64)) +} + +// Set implements pflag.Value.Set. +func (bytesBase64 *bytesBase64Value) Set(value string) error { + bin, err := base64.StdEncoding.DecodeString(strings.TrimSpace(value)) + + if err != nil { + return err + } + + *bytesBase64 = bin + + return nil +} + +// Type implements pflag.Value.Type. +func (*bytesBase64Value) Type() string { + return "bytesBase64" +} + +func newBytesBase64Value(val []byte, p *[]byte) *bytesBase64Value { + *p = val + return (*bytesBase64Value)(p) +} + +func bytesBase64ValueConv(sval string) (interface{}, error) { + + bin, err := base64.StdEncoding.DecodeString(sval) + if err == nil { + return bin, nil + } + + return nil, fmt.Errorf("invalid string being converted to Bytes: %s %s", sval, err) +} + +// GetBytesBase64 return the []byte value of a flag with the given name +func (f *FlagSet) GetBytesBase64(name string) ([]byte, error) { + val, err := f.getFlagType(name, "bytesBase64", bytesBase64ValueConv) + + if err != nil { + return []byte{}, err + } + + return val.([]byte), nil +} + +// BytesBase64Var defines an []byte flag with specified name, default value, and usage string. +// The argument p points to an []byte variable in which to store the value of the flag. +func (f *FlagSet) BytesBase64Var(p *[]byte, name string, value []byte, usage string) { + f.VarP(newBytesBase64Value(value, p), name, "", usage) +} + +// BytesBase64VarP is like BytesBase64Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) BytesBase64VarP(p *[]byte, name, shorthand string, value []byte, usage string) { + f.VarP(newBytesBase64Value(value, p), name, shorthand, usage) +} + +// BytesBase64Var defines an []byte flag with specified name, default value, and usage string. +// The argument p points to an []byte variable in which to store the value of the flag. +func BytesBase64Var(p *[]byte, name string, value []byte, usage string) { + CommandLine.VarP(newBytesBase64Value(value, p), name, "", usage) +} + +// BytesBase64VarP is like BytesBase64Var, but accepts a shorthand letter that can be used after a single dash. +func BytesBase64VarP(p *[]byte, name, shorthand string, value []byte, usage string) { + CommandLine.VarP(newBytesBase64Value(value, p), name, shorthand, usage) +} + +// BytesBase64 defines an []byte flag with specified name, default value, and usage string. +// The return value is the address of an []byte variable that stores the value of the flag. +func (f *FlagSet) BytesBase64(name string, value []byte, usage string) *[]byte { + p := new([]byte) + f.BytesBase64VarP(p, name, "", value, usage) + return p +} + +// BytesBase64P is like BytesBase64, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) BytesBase64P(name, shorthand string, value []byte, usage string) *[]byte { + p := new([]byte) + f.BytesBase64VarP(p, name, shorthand, value, usage) + return p +} + +// BytesBase64 defines an []byte flag with specified name, default value, and usage string. +// The return value is the address of an []byte variable that stores the value of the flag. +func BytesBase64(name string, value []byte, usage string) *[]byte { + return CommandLine.BytesBase64P(name, "", value, usage) +} + +// BytesBase64P is like BytesBase64, but accepts a shorthand letter that can be used after a single dash. +func BytesBase64P(name, shorthand string, value []byte, usage string) *[]byte { + return CommandLine.BytesBase64P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/count.go b/vendor/github.com/spf13/pflag/count.go index d22be41f29..a0b2679f71 100644 --- a/vendor/github.com/spf13/pflag/count.go +++ b/vendor/github.com/spf13/pflag/count.go @@ -11,13 +11,13 @@ func newCountValue(val int, p *int) *countValue { } func (i *countValue) Set(s string) error { - v, err := strconv.ParseInt(s, 0, 64) - // -1 means that no specific value was passed, so increment - if v == -1 { + // "+1" means that no specific value was passed, so increment + if s == "+1" { *i = countValue(*i + 1) - } else { - *i = countValue(v) + return nil } + v, err := strconv.ParseInt(s, 0, 0) + *i = countValue(v) return err } @@ -46,7 +46,7 @@ func (f *FlagSet) GetCount(name string) (int, error) { // CountVar defines a count flag with specified name, default value, and usage string. // The argument p points to an int variable in which to store the value of the flag. -// A count flag will add 1 to its value evey time it is found on the command line +// A count flag will add 1 to its value every time it is found on the command line func (f *FlagSet) CountVar(p *int, name string, usage string) { f.CountVarP(p, name, "", usage) } @@ -54,7 +54,7 @@ func (f *FlagSet) CountVar(p *int, name string, usage string) { // CountVarP is like CountVar only take a shorthand for the flag name. func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) { flag := f.VarPF(newCountValue(0, p), name, shorthand, usage) - flag.NoOptDefVal = "-1" + flag.NoOptDefVal = "+1" } // CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set @@ -69,7 +69,7 @@ func CountVarP(p *int, name, shorthand string, usage string) { // Count defines a count flag with specified name, default value, and usage string. // The return value is the address of an int variable that stores the value of the flag. -// A count flag will add 1 to its value evey time it is found on the command line +// A count flag will add 1 to its value every time it is found on the command line func (f *FlagSet) Count(name string, usage string) *int { p := new(int) f.CountVarP(p, name, "", usage) @@ -83,7 +83,9 @@ func (f *FlagSet) CountP(name, shorthand string, usage string) *int { return p } -// Count like Count only the flag is placed on the CommandLine isntead of a given flag set +// Count defines a count flag with specified name, default value, and usage string. +// The return value is the address of an int variable that stores the value of the flag. +// A count flag will add 1 to its value evey time it is found on the command line func Count(name string, usage string) *int { return CommandLine.CountP(name, "", usage) } diff --git a/vendor/github.com/spf13/pflag/duration_slice.go b/vendor/github.com/spf13/pflag/duration_slice.go new file mode 100644 index 0000000000..badadda53f --- /dev/null +++ b/vendor/github.com/spf13/pflag/duration_slice.go @@ -0,0 +1,166 @@ +package pflag + +import ( + "fmt" + "strings" + "time" +) + +// -- durationSlice Value +type durationSliceValue struct { + value *[]time.Duration + changed bool +} + +func newDurationSliceValue(val []time.Duration, p *[]time.Duration) *durationSliceValue { + dsv := new(durationSliceValue) + dsv.value = p + *dsv.value = val + return dsv +} + +func (s *durationSliceValue) Set(val string) error { + ss := strings.Split(val, ",") + out := make([]time.Duration, len(ss)) + for i, d := range ss { + var err error + out[i], err = time.ParseDuration(d) + if err != nil { + return err + } + + } + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + s.changed = true + return nil +} + +func (s *durationSliceValue) Type() string { + return "durationSlice" +} + +func (s *durationSliceValue) String() string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = fmt.Sprintf("%s", d) + } + return "[" + strings.Join(out, ",") + "]" +} + +func (s *durationSliceValue) fromString(val string) (time.Duration, error) { + return time.ParseDuration(val) +} + +func (s *durationSliceValue) toString(val time.Duration) string { + return fmt.Sprintf("%s", val) +} + +func (s *durationSliceValue) Append(val string) error { + i, err := s.fromString(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *durationSliceValue) Replace(val []string) error { + out := make([]time.Duration, len(val)) + for i, d := range val { + var err error + out[i], err = s.fromString(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *durationSliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = s.toString(d) + } + return out +} + +func durationSliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Empty string would cause a slice with one (empty) entry + if len(val) == 0 { + return []time.Duration{}, nil + } + ss := strings.Split(val, ",") + out := make([]time.Duration, len(ss)) + for i, d := range ss { + var err error + out[i], err = time.ParseDuration(d) + if err != nil { + return nil, err + } + + } + return out, nil +} + +// GetDurationSlice returns the []time.Duration value of a flag with the given name +func (f *FlagSet) GetDurationSlice(name string) ([]time.Duration, error) { + val, err := f.getFlagType(name, "durationSlice", durationSliceConv) + if err != nil { + return []time.Duration{}, err + } + return val.([]time.Duration), nil +} + +// DurationSliceVar defines a durationSlice flag with specified name, default value, and usage string. +// The argument p points to a []time.Duration variable in which to store the value of the flag. +func (f *FlagSet) DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) { + f.VarP(newDurationSliceValue(value, p), name, "", usage) +} + +// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) { + f.VarP(newDurationSliceValue(value, p), name, shorthand, usage) +} + +// DurationSliceVar defines a duration[] flag with specified name, default value, and usage string. +// The argument p points to a duration[] variable in which to store the value of the flag. +func DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) { + CommandLine.VarP(newDurationSliceValue(value, p), name, "", usage) +} + +// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash. +func DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) { + CommandLine.VarP(newDurationSliceValue(value, p), name, shorthand, usage) +} + +// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string. +// The return value is the address of a []time.Duration variable that stores the value of the flag. +func (f *FlagSet) DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration { + p := []time.Duration{} + f.DurationSliceVarP(&p, name, "", value, usage) + return &p +} + +// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration { + p := []time.Duration{} + f.DurationSliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string. +// The return value is the address of a []time.Duration variable that stores the value of the flag. +func DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration { + return CommandLine.DurationSliceP(name, "", value, usage) +} + +// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash. +func DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration { + return CommandLine.DurationSliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go index b9e10c57c2..24a5036e95 100644 --- a/vendor/github.com/spf13/pflag/flag.go +++ b/vendor/github.com/spf13/pflag/flag.go @@ -57,9 +57,9 @@ that give one-letter shorthands for flags. You can use these by appending var ip = flag.IntP("flagname", "f", 1234, "help message") var flagvar bool func init() { - flag.BoolVarP("boolname", "b", true, "help message") + flag.BoolVarP(&flagvar, "boolname", "b", true, "help message") } - flag.VarP(&flagVar, "varname", "v", 1234, "help message") + flag.VarP(&flagval, "varname", "v", "help message") Shorthand letters can be used with single dashes on the command line. Boolean shorthand flags can be combined with other shorthand flags. @@ -101,6 +101,7 @@ package pflag import ( "bytes" "errors" + goflag "flag" "fmt" "io" "os" @@ -123,6 +124,12 @@ const ( PanicOnError ) +// ParseErrorsWhitelist defines the parsing errors that can be ignored +type ParseErrorsWhitelist struct { + // UnknownFlags will ignore unknown flags errors and continue parsing rest of the flags + UnknownFlags bool +} + // NormalizedName is a flag name that has been normalized according to rules // for the FlagSet (e.g. making '-' and '_' equivalent). type NormalizedName string @@ -138,12 +145,17 @@ type FlagSet struct { // help/usage messages. SortFlags bool + // ParseErrorsWhitelist is used to configure a whitelist of errors + ParseErrorsWhitelist ParseErrorsWhitelist + name string parsed bool actual map[NormalizedName]*Flag orderedActual []*Flag + sortedActual []*Flag formal map[NormalizedName]*Flag orderedFormal []*Flag + sortedFormal []*Flag shorthands map[byte]*Flag args []string // arguments after flags argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no -- @@ -151,6 +163,8 @@ type FlagSet struct { output io.Writer // nil means stderr; use out() accessor interspersed bool // allow interspersed option/non-option args normalizeNameFunc func(f *FlagSet, name string) NormalizedName + + addedGoFlagSets []*goflag.FlagSet } // A Flag represents the state of a flag. @@ -176,6 +190,18 @@ type Value interface { Type() string } +// SliceValue is a secondary interface to all flags which hold a list +// of values. This allows full control over the value of list flags, +// and avoids complicated marshalling and unmarshalling to csv. +type SliceValue interface { + // Append adds the specified value to the end of the flag value list. + Append(string) error + // Replace will fully overwrite any data currently in the flag value list. + Replace([]string) error + // GetSlice returns the flag value list as an array of strings. + GetSlice() []string +} + // sortFlags returns the flags as a slice in lexicographical sorted order. func sortFlags(flags map[NormalizedName]*Flag) []*Flag { list := make(sort.StringSlice, len(flags)) @@ -199,12 +225,19 @@ func sortFlags(flags map[NormalizedName]*Flag) []*Flag { // "--getUrl" which may also be translated to "geturl" and everything will work. func (f *FlagSet) SetNormalizeFunc(n func(f *FlagSet, name string) NormalizedName) { f.normalizeNameFunc = n - for k, v := range f.orderedFormal { - delete(f.formal, NormalizedName(v.Name)) - nname := f.normalizeFlagName(v.Name) - v.Name = string(nname) - f.formal[nname] = v - f.orderedFormal[k] = v + f.sortedFormal = f.sortedFormal[:0] + for fname, flag := range f.formal { + nname := f.normalizeFlagName(flag.Name) + if fname == nname { + continue + } + flag.Name = string(nname) + delete(f.formal, fname) + f.formal[nname] = flag + if _, set := f.actual[fname]; set { + delete(f.actual, fname) + f.actual[nname] = flag + } } } @@ -239,9 +272,16 @@ func (f *FlagSet) SetOutput(output io.Writer) { // in primordial order if f.SortFlags is false, calling fn for each. // It visits all flags, even those not set. func (f *FlagSet) VisitAll(fn func(*Flag)) { + if len(f.formal) == 0 { + return + } + var flags []*Flag if f.SortFlags { - flags = sortFlags(f.formal) + if len(f.formal) != len(f.sortedFormal) { + f.sortedFormal = sortFlags(f.formal) + } + flags = f.sortedFormal } else { flags = f.orderedFormal } @@ -251,16 +291,16 @@ func (f *FlagSet) VisitAll(fn func(*Flag)) { } } -// HasFlags returns a bool to indicate if the FlagSet has any flags definied. +// HasFlags returns a bool to indicate if the FlagSet has any flags defined. func (f *FlagSet) HasFlags() bool { return len(f.formal) > 0 } // HasAvailableFlags returns a bool to indicate if the FlagSet has any flags -// definied that are not hidden or deprecated. +// that are not hidden. func (f *FlagSet) HasAvailableFlags() bool { for _, flag := range f.formal { - if !flag.Hidden && len(flag.Deprecated) == 0 { + if !flag.Hidden { return true } } @@ -278,9 +318,16 @@ func VisitAll(fn func(*Flag)) { // in primordial order if f.SortFlags is false, calling fn for each. // It visits only those flags that have been set. func (f *FlagSet) Visit(fn func(*Flag)) { + if len(f.actual) == 0 { + return + } + var flags []*Flag if f.SortFlags { - flags = sortFlags(f.actual) + if len(f.actual) != len(f.sortedActual) { + f.sortedActual = sortFlags(f.actual) + } + flags = f.sortedActual } else { flags = f.orderedActual } @@ -302,6 +349,22 @@ func (f *FlagSet) Lookup(name string) *Flag { return f.lookup(f.normalizeFlagName(name)) } +// ShorthandLookup returns the Flag structure of the short handed flag, +// returning nil if none exists. +// It panics, if len(name) > 1. +func (f *FlagSet) ShorthandLookup(name string) *Flag { + if name == "" { + return nil + } + if len(name) > 1 { + msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name) + fmt.Fprintf(f.out(), msg) + panic(msg) + } + c := name[0] + return f.shorthands[c] +} + // lookup returns the Flag structure of the named flag, returning nil if none exists. func (f *FlagSet) lookup(name NormalizedName) *Flag { return f.formal[name] @@ -343,10 +406,11 @@ func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error { if flag == nil { return fmt.Errorf("flag %q does not exist", name) } - if len(usageMessage) == 0 { + if usageMessage == "" { return fmt.Errorf("deprecated message for flag %q must be set", name) } flag.Deprecated = usageMessage + flag.Hidden = true return nil } @@ -358,7 +422,7 @@ func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) erro if flag == nil { return fmt.Errorf("flag %q does not exist", name) } - if len(usageMessage) == 0 { + if usageMessage == "" { return fmt.Errorf("deprecated message for flag %q must be set", name) } flag.ShorthandDeprecated = usageMessage @@ -382,6 +446,12 @@ func Lookup(name string) *Flag { return CommandLine.Lookup(name) } +// ShorthandLookup returns the Flag structure of the short handed flag, +// returning nil if none exists. +func ShorthandLookup(name string) *Flag { + return CommandLine.ShorthandLookup(name) +} + // Set sets the value of the named flag. func (f *FlagSet) Set(name, value string) error { normalName := f.normalizeFlagName(name) @@ -389,18 +459,30 @@ func (f *FlagSet) Set(name, value string) error { if !ok { return fmt.Errorf("no such flag -%v", name) } + err := flag.Value.Set(value) if err != nil { - return err + var flagName string + if flag.Shorthand != "" && flag.ShorthandDeprecated == "" { + flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name) + } else { + flagName = fmt.Sprintf("--%s", flag.Name) + } + return fmt.Errorf("invalid argument %q for %q flag: %v", value, flagName, err) } - if f.actual == nil { - f.actual = make(map[NormalizedName]*Flag) + + if !flag.Changed { + if f.actual == nil { + f.actual = make(map[NormalizedName]*Flag) + } + f.actual[normalName] = flag + f.orderedActual = append(f.orderedActual, flag) + + flag.Changed = true } - f.actual[normalName] = flag - f.orderedActual = append(f.orderedActual, flag) - flag.Changed = true - if len(flag.Deprecated) > 0 { - fmt.Fprintf(os.Stderr, "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) + + if flag.Deprecated != "" { + fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) } return nil } @@ -507,6 +589,14 @@ func UnquoteUsage(flag *Flag) (name string, usage string) { name = "int" case "uint64": name = "uint" + case "stringSlice": + name = "strings" + case "intSlice": + name = "ints" + case "uintSlice": + name = "uints" + case "boolSlice": + name = "bools" } return @@ -521,11 +611,14 @@ func wrapN(i, slop int, s string) (string, string) { return s, "" } - w := strings.LastIndexAny(s[:i], " \t") + w := strings.LastIndexAny(s[:i], " \t\n") if w <= 0 { return s, "" } - + nlPos := strings.LastIndex(s[:i], "\n") + if nlPos > 0 && nlPos < w { + return s[:nlPos], s[nlPos+1:] + } return s[:w], s[w+1:] } @@ -534,7 +627,7 @@ func wrapN(i, slop int, s string) (string, string) { // caller). Pass `w` == 0 to do no wrapping func wrap(i, w int, s string) string { if w == 0 { - return s + return strings.Replace(s, "\n", "\n"+strings.Repeat(" ", i), -1) } // space between indent i and end of line width w into which @@ -552,7 +645,7 @@ func wrap(i, w int, s string) string { } // If still not enough space then don't even try to wrap. if wrap < 24 { - return s + return strings.Replace(s, "\n", r, -1) } // Try to avoid short orphan words on the final line, by @@ -564,14 +657,14 @@ func wrap(i, w int, s string) string { // Handle first line, which is indented by the caller (or the // special case above) l, s = wrapN(wrap, slop, s) - r = r + l + r = r + strings.Replace(l, "\n", "\n"+strings.Repeat(" ", i), -1) // Now wrap the rest for s != "" { var t string t, s = wrapN(wrap, slop, s) - r = r + "\n" + strings.Repeat(" ", i) + t + r = r + "\n" + strings.Repeat(" ", i) + strings.Replace(t, "\n", "\n"+strings.Repeat(" ", i), -1) } return r @@ -582,28 +675,28 @@ func wrap(i, w int, s string) string { // for all flags in the FlagSet. Wrapped to `cols` columns (0 for no // wrapping) func (f *FlagSet) FlagUsagesWrapped(cols int) string { - x := new(bytes.Buffer) + buf := new(bytes.Buffer) lines := make([]string, 0, len(f.formal)) maxlen := 0 f.VisitAll(func(flag *Flag) { - if len(flag.Deprecated) > 0 || flag.Hidden { + if flag.Hidden { return } line := "" - if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 { + if flag.Shorthand != "" && flag.ShorthandDeprecated == "" { line = fmt.Sprintf(" -%s, --%s", flag.Shorthand, flag.Name) } else { line = fmt.Sprintf(" --%s", flag.Name) } varname, usage := UnquoteUsage(flag) - if len(varname) > 0 { + if varname != "" { line += " " + varname } - if len(flag.NoOptDefVal) > 0 { + if flag.NoOptDefVal != "" { switch flag.Value.Type() { case "string": line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal) @@ -611,6 +704,10 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string { if flag.NoOptDefVal != "true" { line += fmt.Sprintf("[=%s]", flag.NoOptDefVal) } + case "count": + if flag.NoOptDefVal != "+1" { + line += fmt.Sprintf("[=%s]", flag.NoOptDefVal) + } default: line += fmt.Sprintf("[=%s]", flag.NoOptDefVal) } @@ -631,6 +728,9 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string { line += fmt.Sprintf(" (default %s)", flag.DefValue) } } + if len(flag.Deprecated) != 0 { + line += fmt.Sprintf(" (DEPRECATED: %s)", flag.Deprecated) + } lines = append(lines, line) }) @@ -639,10 +739,10 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string { sidx := strings.Index(line, "\x00") spacing := strings.Repeat(" ", maxlen-sidx) // maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx - fmt.Fprintln(x, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:])) + fmt.Fprintln(buf, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:])) } - return x.String() + return buf.String() } // FlagUsages returns a string containing the usage information for all flags in @@ -739,11 +839,10 @@ func (f *FlagSet) VarP(value Value, name, shorthand, usage string) { // AddFlag will add the flag to the FlagSet func (f *FlagSet) AddFlag(flag *Flag) { - // Call normalizeFlagName function only once normalizedFlagName := f.normalizeFlagName(flag.Name) - _, alreadythere := f.formal[normalizedFlagName] - if alreadythere { + _, alreadyThere := f.formal[normalizedFlagName] + if alreadyThere { msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name) fmt.Fprintln(f.out(), msg) panic(msg) // Happens only if flags are declared with identical names @@ -756,27 +855,29 @@ func (f *FlagSet) AddFlag(flag *Flag) { f.formal[normalizedFlagName] = flag f.orderedFormal = append(f.orderedFormal, flag) - if len(flag.Shorthand) == 0 { + if flag.Shorthand == "" { return } if len(flag.Shorthand) > 1 { - fmt.Fprintf(f.out(), "%s shorthand more than ASCII character: %s\n", f.name, flag.Shorthand) - panic("shorthand is more than one character") + msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand) + fmt.Fprintf(f.out(), msg) + panic(msg) } if f.shorthands == nil { f.shorthands = make(map[byte]*Flag) } c := flag.Shorthand[0] - old, alreadythere := f.shorthands[c] - if alreadythere { - fmt.Fprintf(f.out(), "%s shorthand reused: %q for %s already used for %s\n", f.name, c, flag.Name, old.Name) - panic("shorthand redefinition") + used, alreadyThere := f.shorthands[c] + if alreadyThere { + msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name) + fmt.Fprintf(f.out(), msg) + panic(msg) } f.shorthands[c] = flag } // AddFlagSet adds one FlagSet to another. If a flag is already present in f -// the flag from newSet will be ignored +// the flag from newSet will be ignored. func (f *FlagSet) AddFlagSet(newSet *FlagSet) { if newSet == nil { return @@ -807,8 +908,10 @@ func VarP(value Value, name, shorthand, usage string) { // returns the error. func (f *FlagSet) failf(format string, a ...interface{}) error { err := fmt.Errorf(format, a...) - fmt.Fprintln(f.out(), err) - f.usage() + if f.errorHandling != ContinueOnError { + fmt.Fprintln(f.out(), err) + f.usage() + } return err } @@ -824,33 +927,26 @@ func (f *FlagSet) usage() { } } -func (f *FlagSet) setFlag(flag *Flag, value string, origArg string) error { - if err := flag.Value.Set(value); err != nil { - return f.failf("invalid argument %q for %s: %v", value, origArg, err) +//--unknown (args will be empty) +//--unknown --next-flag ... (args will be --next-flag ...) +//--unknown arg ... (args will be arg ...) +func stripUnknownFlagValue(args []string) []string { + if len(args) == 0 { + //--unknown + return args } - // mark as visited for Visit() - if f.actual == nil { - f.actual = make(map[NormalizedName]*Flag) - } - f.actual[f.normalizeFlagName(flag.Name)] = flag - f.orderedActual = append(f.orderedActual, flag) - flag.Changed = true - if len(flag.Deprecated) > 0 { - fmt.Fprintf(os.Stderr, "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated) - } - if len(flag.ShorthandDeprecated) > 0 && containsShorthand(origArg, flag.Shorthand) { - fmt.Fprintf(os.Stderr, "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated) + + first := args[0] + if len(first) > 0 && first[0] == '-' { + //--unknown --next-flag ... + return args } - return nil -} -func containsShorthand(arg, shorthand string) bool { - // filter out flags -- - if strings.HasPrefix(arg, "-") { - return false + //--unknown arg ... (args will be arg ...) + if len(args) > 1 { + return args[1:] } - arg = strings.SplitN(arg, "=", 2)[0] - return strings.Contains(arg, shorthand) + return nil } func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) { @@ -860,22 +956,35 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin err = f.failf("bad flag syntax: %s", s) return } + split := strings.SplitN(name, "=", 2) name = split[0] - flag, alreadythere := f.formal[f.normalizeFlagName(name)] - if !alreadythere { - if name == "help" { // special case for nice help message. + flag, exists := f.formal[f.normalizeFlagName(name)] + + if !exists { + switch { + case name == "help": f.usage() return a, ErrHelp + case f.ParseErrorsWhitelist.UnknownFlags: + // --unknown=unknownval arg ... + // we do not want to lose arg in this case + if len(split) >= 2 { + return a, nil + } + + return stripUnknownFlagValue(a), nil + default: + err = f.failf("unknown flag: --%s", name) + return } - err = f.failf("unknown flag: --%s", name) - return } + var value string if len(split) == 2 { // '--flag=arg' value = split[1] - } else if len(flag.NoOptDefVal) > 0 { + } else if flag.NoOptDefVal != "" { // '--flag' (arg was optional) value = flag.NoOptDefVal } else if len(a) > 0 { @@ -887,46 +996,77 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin err = f.failf("flag needs an argument: %s", s) return } - err = fn(flag, value, s) + + err = fn(flag, value) + if err != nil { + f.failf(err.Error()) + } return } func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) { + outArgs = args + if strings.HasPrefix(shorthands, "test.") { return } - outArgs = args + outShorts = shorthands[1:] c := shorthands[0] - flag, alreadythere := f.shorthands[c] - if !alreadythere { - if c == 'h' { // special case for nice help message. + flag, exists := f.shorthands[c] + if !exists { + switch { + case c == 'h': f.usage() err = ErrHelp return + case f.ParseErrorsWhitelist.UnknownFlags: + // '-f=arg arg ...' + // we do not want to lose arg in this case + if len(shorthands) > 2 && shorthands[1] == '=' { + outShorts = "" + return + } + + outArgs = stripUnknownFlagValue(outArgs) + return + default: + err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands) + return } - //TODO continue on error - err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands) - return } + var value string if len(shorthands) > 2 && shorthands[1] == '=' { + // '-f=arg' value = shorthands[2:] outShorts = "" - } else if len(flag.NoOptDefVal) > 0 { + } else if flag.NoOptDefVal != "" { + // '-f' (arg was optional) value = flag.NoOptDefVal } else if len(shorthands) > 1 { + // '-farg' value = shorthands[1:] outShorts = "" } else if len(args) > 0 { + // '-f arg' value = args[0] outArgs = args[1:] } else { + // '-f' (arg was required) err = f.failf("flag needs an argument: %q in -%s", c, shorthands) return } - err = fn(flag, value, shorthands) + + if flag.ShorthandDeprecated != "" { + fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated) + } + + err = fn(flag, value) + if err != nil { + f.failf(err.Error()) + } return } @@ -934,6 +1074,7 @@ func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []stri a = args shorthands := s[1:] + // "shorthands" can be a series of shorthand letters of flags (e.g. "-vvv"). for len(shorthands) > 0 { shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn) if err != nil { @@ -980,19 +1121,30 @@ func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) { // are defined and before flags are accessed by the program. // The return value will be ErrHelp if -help was set but not defined. func (f *FlagSet) Parse(arguments []string) error { + if f.addedGoFlagSets != nil { + for _, goFlagSet := range f.addedGoFlagSets { + goFlagSet.Parse(nil) + } + } f.parsed = true + + if len(arguments) < 0 { + return nil + } + f.args = make([]string, 0, len(arguments)) - assign := func(flag *Flag, value, origArg string) error { - return f.setFlag(flag, value, origArg) + set := func(flag *Flag, value string) error { + return f.Set(flag.Name, value) } - err := f.parseArgs(arguments, assign) + err := f.parseArgs(arguments, set) if err != nil { switch f.errorHandling { case ContinueOnError: return err case ExitOnError: + fmt.Println(err) os.Exit(2) case PanicOnError: panic(err) @@ -1001,7 +1153,7 @@ func (f *FlagSet) Parse(arguments []string) error { return nil } -type parseFunc func(flag *Flag, value, origArg string) error +type parseFunc func(flag *Flag, value string) error // ParseAll parses flag definitions from the argument list, which should not // include the command name. The arguments for fn are flag and value. Must be @@ -1012,11 +1164,7 @@ func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string) f.parsed = true f.args = make([]string, 0, len(arguments)) - assign := func(flag *Flag, value, origArg string) error { - return fn(flag, value) - } - - err := f.parseArgs(arguments, assign) + err := f.parseArgs(arguments, fn) if err != nil { switch f.errorHandling { case ContinueOnError: diff --git a/vendor/github.com/spf13/pflag/float32_slice.go b/vendor/github.com/spf13/pflag/float32_slice.go new file mode 100644 index 0000000000..caa352741a --- /dev/null +++ b/vendor/github.com/spf13/pflag/float32_slice.go @@ -0,0 +1,174 @@ +package pflag + +import ( + "fmt" + "strconv" + "strings" +) + +// -- float32Slice Value +type float32SliceValue struct { + value *[]float32 + changed bool +} + +func newFloat32SliceValue(val []float32, p *[]float32) *float32SliceValue { + isv := new(float32SliceValue) + isv.value = p + *isv.value = val + return isv +} + +func (s *float32SliceValue) Set(val string) error { + ss := strings.Split(val, ",") + out := make([]float32, len(ss)) + for i, d := range ss { + var err error + var temp64 float64 + temp64, err = strconv.ParseFloat(d, 32) + if err != nil { + return err + } + out[i] = float32(temp64) + + } + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + s.changed = true + return nil +} + +func (s *float32SliceValue) Type() string { + return "float32Slice" +} + +func (s *float32SliceValue) String() string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = fmt.Sprintf("%f", d) + } + return "[" + strings.Join(out, ",") + "]" +} + +func (s *float32SliceValue) fromString(val string) (float32, error) { + t64, err := strconv.ParseFloat(val, 32) + if err != nil { + return 0, err + } + return float32(t64), nil +} + +func (s *float32SliceValue) toString(val float32) string { + return fmt.Sprintf("%f", val) +} + +func (s *float32SliceValue) Append(val string) error { + i, err := s.fromString(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *float32SliceValue) Replace(val []string) error { + out := make([]float32, len(val)) + for i, d := range val { + var err error + out[i], err = s.fromString(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *float32SliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = s.toString(d) + } + return out +} + +func float32SliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Empty string would cause a slice with one (empty) entry + if len(val) == 0 { + return []float32{}, nil + } + ss := strings.Split(val, ",") + out := make([]float32, len(ss)) + for i, d := range ss { + var err error + var temp64 float64 + temp64, err = strconv.ParseFloat(d, 32) + if err != nil { + return nil, err + } + out[i] = float32(temp64) + + } + return out, nil +} + +// GetFloat32Slice return the []float32 value of a flag with the given name +func (f *FlagSet) GetFloat32Slice(name string) ([]float32, error) { + val, err := f.getFlagType(name, "float32Slice", float32SliceConv) + if err != nil { + return []float32{}, err + } + return val.([]float32), nil +} + +// Float32SliceVar defines a float32Slice flag with specified name, default value, and usage string. +// The argument p points to a []float32 variable in which to store the value of the flag. +func (f *FlagSet) Float32SliceVar(p *[]float32, name string, value []float32, usage string) { + f.VarP(newFloat32SliceValue(value, p), name, "", usage) +} + +// Float32SliceVarP is like Float32SliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Float32SliceVarP(p *[]float32, name, shorthand string, value []float32, usage string) { + f.VarP(newFloat32SliceValue(value, p), name, shorthand, usage) +} + +// Float32SliceVar defines a float32[] flag with specified name, default value, and usage string. +// The argument p points to a float32[] variable in which to store the value of the flag. +func Float32SliceVar(p *[]float32, name string, value []float32, usage string) { + CommandLine.VarP(newFloat32SliceValue(value, p), name, "", usage) +} + +// Float32SliceVarP is like Float32SliceVar, but accepts a shorthand letter that can be used after a single dash. +func Float32SliceVarP(p *[]float32, name, shorthand string, value []float32, usage string) { + CommandLine.VarP(newFloat32SliceValue(value, p), name, shorthand, usage) +} + +// Float32Slice defines a []float32 flag with specified name, default value, and usage string. +// The return value is the address of a []float32 variable that stores the value of the flag. +func (f *FlagSet) Float32Slice(name string, value []float32, usage string) *[]float32 { + p := []float32{} + f.Float32SliceVarP(&p, name, "", value, usage) + return &p +} + +// Float32SliceP is like Float32Slice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Float32SliceP(name, shorthand string, value []float32, usage string) *[]float32 { + p := []float32{} + f.Float32SliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// Float32Slice defines a []float32 flag with specified name, default value, and usage string. +// The return value is the address of a []float32 variable that stores the value of the flag. +func Float32Slice(name string, value []float32, usage string) *[]float32 { + return CommandLine.Float32SliceP(name, "", value, usage) +} + +// Float32SliceP is like Float32Slice, but accepts a shorthand letter that can be used after a single dash. +func Float32SliceP(name, shorthand string, value []float32, usage string) *[]float32 { + return CommandLine.Float32SliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/float64_slice.go b/vendor/github.com/spf13/pflag/float64_slice.go new file mode 100644 index 0000000000..85bf3073d5 --- /dev/null +++ b/vendor/github.com/spf13/pflag/float64_slice.go @@ -0,0 +1,166 @@ +package pflag + +import ( + "fmt" + "strconv" + "strings" +) + +// -- float64Slice Value +type float64SliceValue struct { + value *[]float64 + changed bool +} + +func newFloat64SliceValue(val []float64, p *[]float64) *float64SliceValue { + isv := new(float64SliceValue) + isv.value = p + *isv.value = val + return isv +} + +func (s *float64SliceValue) Set(val string) error { + ss := strings.Split(val, ",") + out := make([]float64, len(ss)) + for i, d := range ss { + var err error + out[i], err = strconv.ParseFloat(d, 64) + if err != nil { + return err + } + + } + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + s.changed = true + return nil +} + +func (s *float64SliceValue) Type() string { + return "float64Slice" +} + +func (s *float64SliceValue) String() string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = fmt.Sprintf("%f", d) + } + return "[" + strings.Join(out, ",") + "]" +} + +func (s *float64SliceValue) fromString(val string) (float64, error) { + return strconv.ParseFloat(val, 64) +} + +func (s *float64SliceValue) toString(val float64) string { + return fmt.Sprintf("%f", val) +} + +func (s *float64SliceValue) Append(val string) error { + i, err := s.fromString(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *float64SliceValue) Replace(val []string) error { + out := make([]float64, len(val)) + for i, d := range val { + var err error + out[i], err = s.fromString(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *float64SliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = s.toString(d) + } + return out +} + +func float64SliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Empty string would cause a slice with one (empty) entry + if len(val) == 0 { + return []float64{}, nil + } + ss := strings.Split(val, ",") + out := make([]float64, len(ss)) + for i, d := range ss { + var err error + out[i], err = strconv.ParseFloat(d, 64) + if err != nil { + return nil, err + } + + } + return out, nil +} + +// GetFloat64Slice return the []float64 value of a flag with the given name +func (f *FlagSet) GetFloat64Slice(name string) ([]float64, error) { + val, err := f.getFlagType(name, "float64Slice", float64SliceConv) + if err != nil { + return []float64{}, err + } + return val.([]float64), nil +} + +// Float64SliceVar defines a float64Slice flag with specified name, default value, and usage string. +// The argument p points to a []float64 variable in which to store the value of the flag. +func (f *FlagSet) Float64SliceVar(p *[]float64, name string, value []float64, usage string) { + f.VarP(newFloat64SliceValue(value, p), name, "", usage) +} + +// Float64SliceVarP is like Float64SliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Float64SliceVarP(p *[]float64, name, shorthand string, value []float64, usage string) { + f.VarP(newFloat64SliceValue(value, p), name, shorthand, usage) +} + +// Float64SliceVar defines a float64[] flag with specified name, default value, and usage string. +// The argument p points to a float64[] variable in which to store the value of the flag. +func Float64SliceVar(p *[]float64, name string, value []float64, usage string) { + CommandLine.VarP(newFloat64SliceValue(value, p), name, "", usage) +} + +// Float64SliceVarP is like Float64SliceVar, but accepts a shorthand letter that can be used after a single dash. +func Float64SliceVarP(p *[]float64, name, shorthand string, value []float64, usage string) { + CommandLine.VarP(newFloat64SliceValue(value, p), name, shorthand, usage) +} + +// Float64Slice defines a []float64 flag with specified name, default value, and usage string. +// The return value is the address of a []float64 variable that stores the value of the flag. +func (f *FlagSet) Float64Slice(name string, value []float64, usage string) *[]float64 { + p := []float64{} + f.Float64SliceVarP(&p, name, "", value, usage) + return &p +} + +// Float64SliceP is like Float64Slice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Float64SliceP(name, shorthand string, value []float64, usage string) *[]float64 { + p := []float64{} + f.Float64SliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// Float64Slice defines a []float64 flag with specified name, default value, and usage string. +// The return value is the address of a []float64 variable that stores the value of the flag. +func Float64Slice(name string, value []float64, usage string) *[]float64 { + return CommandLine.Float64SliceP(name, "", value, usage) +} + +// Float64SliceP is like Float64Slice, but accepts a shorthand letter that can be used after a single dash. +func Float64SliceP(name, shorthand string, value []float64, usage string) *[]float64 { + return CommandLine.Float64SliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/go.mod b/vendor/github.com/spf13/pflag/go.mod new file mode 100644 index 0000000000..b2287eec13 --- /dev/null +++ b/vendor/github.com/spf13/pflag/go.mod @@ -0,0 +1,3 @@ +module github.com/spf13/pflag + +go 1.12 diff --git a/vendor/github.com/spf13/pflag/go.sum b/vendor/github.com/spf13/pflag/go.sum new file mode 100644 index 0000000000..e69de29bb2 diff --git a/vendor/github.com/spf13/pflag/golangflag.go b/vendor/github.com/spf13/pflag/golangflag.go index c4f47ebe59..d3dd72b7fe 100644 --- a/vendor/github.com/spf13/pflag/golangflag.go +++ b/vendor/github.com/spf13/pflag/golangflag.go @@ -98,4 +98,8 @@ func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) { newSet.VisitAll(func(goflag *goflag.Flag) { f.AddGoFlag(goflag) }) + if f.addedGoFlagSets == nil { + f.addedGoFlagSets = make([]*goflag.FlagSet, 0) + } + f.addedGoFlagSets = append(f.addedGoFlagSets, newSet) } diff --git a/vendor/github.com/spf13/pflag/int16.go b/vendor/github.com/spf13/pflag/int16.go new file mode 100644 index 0000000000..f1a01d05e6 --- /dev/null +++ b/vendor/github.com/spf13/pflag/int16.go @@ -0,0 +1,88 @@ +package pflag + +import "strconv" + +// -- int16 Value +type int16Value int16 + +func newInt16Value(val int16, p *int16) *int16Value { + *p = val + return (*int16Value)(p) +} + +func (i *int16Value) Set(s string) error { + v, err := strconv.ParseInt(s, 0, 16) + *i = int16Value(v) + return err +} + +func (i *int16Value) Type() string { + return "int16" +} + +func (i *int16Value) String() string { return strconv.FormatInt(int64(*i), 10) } + +func int16Conv(sval string) (interface{}, error) { + v, err := strconv.ParseInt(sval, 0, 16) + if err != nil { + return 0, err + } + return int16(v), nil +} + +// GetInt16 returns the int16 value of a flag with the given name +func (f *FlagSet) GetInt16(name string) (int16, error) { + val, err := f.getFlagType(name, "int16", int16Conv) + if err != nil { + return 0, err + } + return val.(int16), nil +} + +// Int16Var defines an int16 flag with specified name, default value, and usage string. +// The argument p points to an int16 variable in which to store the value of the flag. +func (f *FlagSet) Int16Var(p *int16, name string, value int16, usage string) { + f.VarP(newInt16Value(value, p), name, "", usage) +} + +// Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int16VarP(p *int16, name, shorthand string, value int16, usage string) { + f.VarP(newInt16Value(value, p), name, shorthand, usage) +} + +// Int16Var defines an int16 flag with specified name, default value, and usage string. +// The argument p points to an int16 variable in which to store the value of the flag. +func Int16Var(p *int16, name string, value int16, usage string) { + CommandLine.VarP(newInt16Value(value, p), name, "", usage) +} + +// Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash. +func Int16VarP(p *int16, name, shorthand string, value int16, usage string) { + CommandLine.VarP(newInt16Value(value, p), name, shorthand, usage) +} + +// Int16 defines an int16 flag with specified name, default value, and usage string. +// The return value is the address of an int16 variable that stores the value of the flag. +func (f *FlagSet) Int16(name string, value int16, usage string) *int16 { + p := new(int16) + f.Int16VarP(p, name, "", value, usage) + return p +} + +// Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int16P(name, shorthand string, value int16, usage string) *int16 { + p := new(int16) + f.Int16VarP(p, name, shorthand, value, usage) + return p +} + +// Int16 defines an int16 flag with specified name, default value, and usage string. +// The return value is the address of an int16 variable that stores the value of the flag. +func Int16(name string, value int16, usage string) *int16 { + return CommandLine.Int16P(name, "", value, usage) +} + +// Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash. +func Int16P(name, shorthand string, value int16, usage string) *int16 { + return CommandLine.Int16P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/int32_slice.go b/vendor/github.com/spf13/pflag/int32_slice.go new file mode 100644 index 0000000000..ff128ff06d --- /dev/null +++ b/vendor/github.com/spf13/pflag/int32_slice.go @@ -0,0 +1,174 @@ +package pflag + +import ( + "fmt" + "strconv" + "strings" +) + +// -- int32Slice Value +type int32SliceValue struct { + value *[]int32 + changed bool +} + +func newInt32SliceValue(val []int32, p *[]int32) *int32SliceValue { + isv := new(int32SliceValue) + isv.value = p + *isv.value = val + return isv +} + +func (s *int32SliceValue) Set(val string) error { + ss := strings.Split(val, ",") + out := make([]int32, len(ss)) + for i, d := range ss { + var err error + var temp64 int64 + temp64, err = strconv.ParseInt(d, 0, 32) + if err != nil { + return err + } + out[i] = int32(temp64) + + } + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + s.changed = true + return nil +} + +func (s *int32SliceValue) Type() string { + return "int32Slice" +} + +func (s *int32SliceValue) String() string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = fmt.Sprintf("%d", d) + } + return "[" + strings.Join(out, ",") + "]" +} + +func (s *int32SliceValue) fromString(val string) (int32, error) { + t64, err := strconv.ParseInt(val, 0, 32) + if err != nil { + return 0, err + } + return int32(t64), nil +} + +func (s *int32SliceValue) toString(val int32) string { + return fmt.Sprintf("%d", val) +} + +func (s *int32SliceValue) Append(val string) error { + i, err := s.fromString(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *int32SliceValue) Replace(val []string) error { + out := make([]int32, len(val)) + for i, d := range val { + var err error + out[i], err = s.fromString(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *int32SliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = s.toString(d) + } + return out +} + +func int32SliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Empty string would cause a slice with one (empty) entry + if len(val) == 0 { + return []int32{}, nil + } + ss := strings.Split(val, ",") + out := make([]int32, len(ss)) + for i, d := range ss { + var err error + var temp64 int64 + temp64, err = strconv.ParseInt(d, 0, 32) + if err != nil { + return nil, err + } + out[i] = int32(temp64) + + } + return out, nil +} + +// GetInt32Slice return the []int32 value of a flag with the given name +func (f *FlagSet) GetInt32Slice(name string) ([]int32, error) { + val, err := f.getFlagType(name, "int32Slice", int32SliceConv) + if err != nil { + return []int32{}, err + } + return val.([]int32), nil +} + +// Int32SliceVar defines a int32Slice flag with specified name, default value, and usage string. +// The argument p points to a []int32 variable in which to store the value of the flag. +func (f *FlagSet) Int32SliceVar(p *[]int32, name string, value []int32, usage string) { + f.VarP(newInt32SliceValue(value, p), name, "", usage) +} + +// Int32SliceVarP is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int32SliceVarP(p *[]int32, name, shorthand string, value []int32, usage string) { + f.VarP(newInt32SliceValue(value, p), name, shorthand, usage) +} + +// Int32SliceVar defines a int32[] flag with specified name, default value, and usage string. +// The argument p points to a int32[] variable in which to store the value of the flag. +func Int32SliceVar(p *[]int32, name string, value []int32, usage string) { + CommandLine.VarP(newInt32SliceValue(value, p), name, "", usage) +} + +// Int32SliceVarP is like Int32SliceVar, but accepts a shorthand letter that can be used after a single dash. +func Int32SliceVarP(p *[]int32, name, shorthand string, value []int32, usage string) { + CommandLine.VarP(newInt32SliceValue(value, p), name, shorthand, usage) +} + +// Int32Slice defines a []int32 flag with specified name, default value, and usage string. +// The return value is the address of a []int32 variable that stores the value of the flag. +func (f *FlagSet) Int32Slice(name string, value []int32, usage string) *[]int32 { + p := []int32{} + f.Int32SliceVarP(&p, name, "", value, usage) + return &p +} + +// Int32SliceP is like Int32Slice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int32SliceP(name, shorthand string, value []int32, usage string) *[]int32 { + p := []int32{} + f.Int32SliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// Int32Slice defines a []int32 flag with specified name, default value, and usage string. +// The return value is the address of a []int32 variable that stores the value of the flag. +func Int32Slice(name string, value []int32, usage string) *[]int32 { + return CommandLine.Int32SliceP(name, "", value, usage) +} + +// Int32SliceP is like Int32Slice, but accepts a shorthand letter that can be used after a single dash. +func Int32SliceP(name, shorthand string, value []int32, usage string) *[]int32 { + return CommandLine.Int32SliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/int64_slice.go b/vendor/github.com/spf13/pflag/int64_slice.go new file mode 100644 index 0000000000..25464638f3 --- /dev/null +++ b/vendor/github.com/spf13/pflag/int64_slice.go @@ -0,0 +1,166 @@ +package pflag + +import ( + "fmt" + "strconv" + "strings" +) + +// -- int64Slice Value +type int64SliceValue struct { + value *[]int64 + changed bool +} + +func newInt64SliceValue(val []int64, p *[]int64) *int64SliceValue { + isv := new(int64SliceValue) + isv.value = p + *isv.value = val + return isv +} + +func (s *int64SliceValue) Set(val string) error { + ss := strings.Split(val, ",") + out := make([]int64, len(ss)) + for i, d := range ss { + var err error + out[i], err = strconv.ParseInt(d, 0, 64) + if err != nil { + return err + } + + } + if !s.changed { + *s.value = out + } else { + *s.value = append(*s.value, out...) + } + s.changed = true + return nil +} + +func (s *int64SliceValue) Type() string { + return "int64Slice" +} + +func (s *int64SliceValue) String() string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = fmt.Sprintf("%d", d) + } + return "[" + strings.Join(out, ",") + "]" +} + +func (s *int64SliceValue) fromString(val string) (int64, error) { + return strconv.ParseInt(val, 0, 64) +} + +func (s *int64SliceValue) toString(val int64) string { + return fmt.Sprintf("%d", val) +} + +func (s *int64SliceValue) Append(val string) error { + i, err := s.fromString(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *int64SliceValue) Replace(val []string) error { + out := make([]int64, len(val)) + for i, d := range val { + var err error + out[i], err = s.fromString(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *int64SliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = s.toString(d) + } + return out +} + +func int64SliceConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // Empty string would cause a slice with one (empty) entry + if len(val) == 0 { + return []int64{}, nil + } + ss := strings.Split(val, ",") + out := make([]int64, len(ss)) + for i, d := range ss { + var err error + out[i], err = strconv.ParseInt(d, 0, 64) + if err != nil { + return nil, err + } + + } + return out, nil +} + +// GetInt64Slice return the []int64 value of a flag with the given name +func (f *FlagSet) GetInt64Slice(name string) ([]int64, error) { + val, err := f.getFlagType(name, "int64Slice", int64SliceConv) + if err != nil { + return []int64{}, err + } + return val.([]int64), nil +} + +// Int64SliceVar defines a int64Slice flag with specified name, default value, and usage string. +// The argument p points to a []int64 variable in which to store the value of the flag. +func (f *FlagSet) Int64SliceVar(p *[]int64, name string, value []int64, usage string) { + f.VarP(newInt64SliceValue(value, p), name, "", usage) +} + +// Int64SliceVarP is like Int64SliceVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int64SliceVarP(p *[]int64, name, shorthand string, value []int64, usage string) { + f.VarP(newInt64SliceValue(value, p), name, shorthand, usage) +} + +// Int64SliceVar defines a int64[] flag with specified name, default value, and usage string. +// The argument p points to a int64[] variable in which to store the value of the flag. +func Int64SliceVar(p *[]int64, name string, value []int64, usage string) { + CommandLine.VarP(newInt64SliceValue(value, p), name, "", usage) +} + +// Int64SliceVarP is like Int64SliceVar, but accepts a shorthand letter that can be used after a single dash. +func Int64SliceVarP(p *[]int64, name, shorthand string, value []int64, usage string) { + CommandLine.VarP(newInt64SliceValue(value, p), name, shorthand, usage) +} + +// Int64Slice defines a []int64 flag with specified name, default value, and usage string. +// The return value is the address of a []int64 variable that stores the value of the flag. +func (f *FlagSet) Int64Slice(name string, value []int64, usage string) *[]int64 { + p := []int64{} + f.Int64SliceVarP(&p, name, "", value, usage) + return &p +} + +// Int64SliceP is like Int64Slice, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) Int64SliceP(name, shorthand string, value []int64, usage string) *[]int64 { + p := []int64{} + f.Int64SliceVarP(&p, name, shorthand, value, usage) + return &p +} + +// Int64Slice defines a []int64 flag with specified name, default value, and usage string. +// The return value is the address of a []int64 variable that stores the value of the flag. +func Int64Slice(name string, value []int64, usage string) *[]int64 { + return CommandLine.Int64SliceP(name, "", value, usage) +} + +// Int64SliceP is like Int64Slice, but accepts a shorthand letter that can be used after a single dash. +func Int64SliceP(name, shorthand string, value []int64, usage string) *[]int64 { + return CommandLine.Int64SliceP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/int_slice.go b/vendor/github.com/spf13/pflag/int_slice.go index 1e7c9edde9..e71c39d91a 100644 --- a/vendor/github.com/spf13/pflag/int_slice.go +++ b/vendor/github.com/spf13/pflag/int_slice.go @@ -51,6 +51,36 @@ func (s *intSliceValue) String() string { return "[" + strings.Join(out, ",") + "]" } +func (s *intSliceValue) Append(val string) error { + i, err := strconv.Atoi(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *intSliceValue) Replace(val []string) error { + out := make([]int, len(val)) + for i, d := range val { + var err error + out[i], err = strconv.Atoi(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *intSliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = strconv.Itoa(d) + } + return out +} + func intSliceConv(val string) (interface{}, error) { val = strings.Trim(val, "[]") // Empty string would cause a slice with one (empty) entry diff --git a/vendor/github.com/spf13/pflag/ip_slice.go b/vendor/github.com/spf13/pflag/ip_slice.go index 7dd196fe3f..775faae4fd 100644 --- a/vendor/github.com/spf13/pflag/ip_slice.go +++ b/vendor/github.com/spf13/pflag/ip_slice.go @@ -72,9 +72,47 @@ func (s *ipSliceValue) String() string { return "[" + out + "]" } +func (s *ipSliceValue) fromString(val string) (net.IP, error) { + return net.ParseIP(strings.TrimSpace(val)), nil +} + +func (s *ipSliceValue) toString(val net.IP) string { + return val.String() +} + +func (s *ipSliceValue) Append(val string) error { + i, err := s.fromString(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *ipSliceValue) Replace(val []string) error { + out := make([]net.IP, len(val)) + for i, d := range val { + var err error + out[i], err = s.fromString(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *ipSliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = s.toString(d) + } + return out +} + func ipSliceConv(val string) (interface{}, error) { val = strings.Trim(val, "[]") - // Emtpy string would cause a slice with one (empty) entry + // Empty string would cause a slice with one (empty) entry if len(val) == 0 { return []net.IP{}, nil } diff --git a/vendor/github.com/spf13/pflag/string_array.go b/vendor/github.com/spf13/pflag/string_array.go index 276b7ed49e..4894af8180 100644 --- a/vendor/github.com/spf13/pflag/string_array.go +++ b/vendor/github.com/spf13/pflag/string_array.go @@ -23,6 +23,32 @@ func (s *stringArrayValue) Set(val string) error { return nil } +func (s *stringArrayValue) Append(val string) error { + *s.value = append(*s.value, val) + return nil +} + +func (s *stringArrayValue) Replace(val []string) error { + out := make([]string, len(val)) + for i, d := range val { + var err error + out[i] = d + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *stringArrayValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = d + } + return out +} + func (s *stringArrayValue) Type() string { return "stringArray" } @@ -52,7 +78,7 @@ func (f *FlagSet) GetStringArray(name string) ([]string, error) { // StringArrayVar defines a string flag with specified name, default value, and usage string. // The argument p points to a []string variable in which to store the values of the multiple flags. -// The value of each argument will not try to be separated by comma +// The value of each argument will not try to be separated by comma. Use a StringSlice for that. func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) { f.VarP(newStringArrayValue(value, p), name, "", usage) } @@ -64,7 +90,7 @@ func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []s // StringArrayVar defines a string flag with specified name, default value, and usage string. // The argument p points to a []string variable in which to store the value of the flag. -// The value of each argument will not try to be separated by comma +// The value of each argument will not try to be separated by comma. Use a StringSlice for that. func StringArrayVar(p *[]string, name string, value []string, usage string) { CommandLine.VarP(newStringArrayValue(value, p), name, "", usage) } @@ -76,7 +102,7 @@ func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage // StringArray defines a string flag with specified name, default value, and usage string. // The return value is the address of a []string variable that stores the value of the flag. -// The value of each argument will not try to be separated by comma +// The value of each argument will not try to be separated by comma. Use a StringSlice for that. func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string { p := []string{} f.StringArrayVarP(&p, name, "", value, usage) @@ -92,7 +118,7 @@ func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage str // StringArray defines a string flag with specified name, default value, and usage string. // The return value is the address of a []string variable that stores the value of the flag. -// The value of each argument will not try to be separated by comma +// The value of each argument will not try to be separated by comma. Use a StringSlice for that. func StringArray(name string, value []string, usage string) *[]string { return CommandLine.StringArrayP(name, "", value, usage) } diff --git a/vendor/github.com/spf13/pflag/string_slice.go b/vendor/github.com/spf13/pflag/string_slice.go index 05eee75438..3cb2e69dba 100644 --- a/vendor/github.com/spf13/pflag/string_slice.go +++ b/vendor/github.com/spf13/pflag/string_slice.go @@ -62,6 +62,20 @@ func (s *stringSliceValue) String() string { return "[" + str + "]" } +func (s *stringSliceValue) Append(val string) error { + *s.value = append(*s.value, val) + return nil +} + +func (s *stringSliceValue) Replace(val []string) error { + *s.value = val + return nil +} + +func (s *stringSliceValue) GetSlice() []string { + return *s.value +} + func stringSliceConv(sval string) (interface{}, error) { sval = sval[1 : len(sval)-1] // An empty string would cause a slice with one (empty) string @@ -82,6 +96,11 @@ func (f *FlagSet) GetStringSlice(name string) ([]string, error) { // StringSliceVar defines a string flag with specified name, default value, and usage string. // The argument p points to a []string variable in which to store the value of the flag. +// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. +// For example: +// --ss="v1,v2" --ss="v3" +// will result in +// []string{"v1", "v2", "v3"} func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) { f.VarP(newStringSliceValue(value, p), name, "", usage) } @@ -93,6 +112,11 @@ func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []s // StringSliceVar defines a string flag with specified name, default value, and usage string. // The argument p points to a []string variable in which to store the value of the flag. +// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. +// For example: +// --ss="v1,v2" --ss="v3" +// will result in +// []string{"v1", "v2", "v3"} func StringSliceVar(p *[]string, name string, value []string, usage string) { CommandLine.VarP(newStringSliceValue(value, p), name, "", usage) } @@ -104,6 +128,11 @@ func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage // StringSlice defines a string flag with specified name, default value, and usage string. // The return value is the address of a []string variable that stores the value of the flag. +// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. +// For example: +// --ss="v1,v2" --ss="v3" +// will result in +// []string{"v1", "v2", "v3"} func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string { p := []string{} f.StringSliceVarP(&p, name, "", value, usage) @@ -119,6 +148,11 @@ func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage str // StringSlice defines a string flag with specified name, default value, and usage string. // The return value is the address of a []string variable that stores the value of the flag. +// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly. +// For example: +// --ss="v1,v2" --ss="v3" +// will result in +// []string{"v1", "v2", "v3"} func StringSlice(name string, value []string, usage string) *[]string { return CommandLine.StringSliceP(name, "", value, usage) } diff --git a/vendor/github.com/spf13/pflag/string_to_int.go b/vendor/github.com/spf13/pflag/string_to_int.go new file mode 100644 index 0000000000..5ceda3965d --- /dev/null +++ b/vendor/github.com/spf13/pflag/string_to_int.go @@ -0,0 +1,149 @@ +package pflag + +import ( + "bytes" + "fmt" + "strconv" + "strings" +) + +// -- stringToInt Value +type stringToIntValue struct { + value *map[string]int + changed bool +} + +func newStringToIntValue(val map[string]int, p *map[string]int) *stringToIntValue { + ssv := new(stringToIntValue) + ssv.value = p + *ssv.value = val + return ssv +} + +// Format: a=1,b=2 +func (s *stringToIntValue) Set(val string) error { + ss := strings.Split(val, ",") + out := make(map[string]int, len(ss)) + for _, pair := range ss { + kv := strings.SplitN(pair, "=", 2) + if len(kv) != 2 { + return fmt.Errorf("%s must be formatted as key=value", pair) + } + var err error + out[kv[0]], err = strconv.Atoi(kv[1]) + if err != nil { + return err + } + } + if !s.changed { + *s.value = out + } else { + for k, v := range out { + (*s.value)[k] = v + } + } + s.changed = true + return nil +} + +func (s *stringToIntValue) Type() string { + return "stringToInt" +} + +func (s *stringToIntValue) String() string { + var buf bytes.Buffer + i := 0 + for k, v := range *s.value { + if i > 0 { + buf.WriteRune(',') + } + buf.WriteString(k) + buf.WriteRune('=') + buf.WriteString(strconv.Itoa(v)) + i++ + } + return "[" + buf.String() + "]" +} + +func stringToIntConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // An empty string would cause an empty map + if len(val) == 0 { + return map[string]int{}, nil + } + ss := strings.Split(val, ",") + out := make(map[string]int, len(ss)) + for _, pair := range ss { + kv := strings.SplitN(pair, "=", 2) + if len(kv) != 2 { + return nil, fmt.Errorf("%s must be formatted as key=value", pair) + } + var err error + out[kv[0]], err = strconv.Atoi(kv[1]) + if err != nil { + return nil, err + } + } + return out, nil +} + +// GetStringToInt return the map[string]int value of a flag with the given name +func (f *FlagSet) GetStringToInt(name string) (map[string]int, error) { + val, err := f.getFlagType(name, "stringToInt", stringToIntConv) + if err != nil { + return map[string]int{}, err + } + return val.(map[string]int), nil +} + +// StringToIntVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a map[string]int variable in which to store the values of the multiple flags. +// The value of each argument will not try to be separated by comma +func (f *FlagSet) StringToIntVar(p *map[string]int, name string, value map[string]int, usage string) { + f.VarP(newStringToIntValue(value, p), name, "", usage) +} + +// StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringToIntVarP(p *map[string]int, name, shorthand string, value map[string]int, usage string) { + f.VarP(newStringToIntValue(value, p), name, shorthand, usage) +} + +// StringToIntVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a map[string]int variable in which to store the value of the flag. +// The value of each argument will not try to be separated by comma +func StringToIntVar(p *map[string]int, name string, value map[string]int, usage string) { + CommandLine.VarP(newStringToIntValue(value, p), name, "", usage) +} + +// StringToIntVarP is like StringToIntVar, but accepts a shorthand letter that can be used after a single dash. +func StringToIntVarP(p *map[string]int, name, shorthand string, value map[string]int, usage string) { + CommandLine.VarP(newStringToIntValue(value, p), name, shorthand, usage) +} + +// StringToInt defines a string flag with specified name, default value, and usage string. +// The return value is the address of a map[string]int variable that stores the value of the flag. +// The value of each argument will not try to be separated by comma +func (f *FlagSet) StringToInt(name string, value map[string]int, usage string) *map[string]int { + p := map[string]int{} + f.StringToIntVarP(&p, name, "", value, usage) + return &p +} + +// StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringToIntP(name, shorthand string, value map[string]int, usage string) *map[string]int { + p := map[string]int{} + f.StringToIntVarP(&p, name, shorthand, value, usage) + return &p +} + +// StringToInt defines a string flag with specified name, default value, and usage string. +// The return value is the address of a map[string]int variable that stores the value of the flag. +// The value of each argument will not try to be separated by comma +func StringToInt(name string, value map[string]int, usage string) *map[string]int { + return CommandLine.StringToIntP(name, "", value, usage) +} + +// StringToIntP is like StringToInt, but accepts a shorthand letter that can be used after a single dash. +func StringToIntP(name, shorthand string, value map[string]int, usage string) *map[string]int { + return CommandLine.StringToIntP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/string_to_int64.go b/vendor/github.com/spf13/pflag/string_to_int64.go new file mode 100644 index 0000000000..a807a04a0b --- /dev/null +++ b/vendor/github.com/spf13/pflag/string_to_int64.go @@ -0,0 +1,149 @@ +package pflag + +import ( + "bytes" + "fmt" + "strconv" + "strings" +) + +// -- stringToInt64 Value +type stringToInt64Value struct { + value *map[string]int64 + changed bool +} + +func newStringToInt64Value(val map[string]int64, p *map[string]int64) *stringToInt64Value { + ssv := new(stringToInt64Value) + ssv.value = p + *ssv.value = val + return ssv +} + +// Format: a=1,b=2 +func (s *stringToInt64Value) Set(val string) error { + ss := strings.Split(val, ",") + out := make(map[string]int64, len(ss)) + for _, pair := range ss { + kv := strings.SplitN(pair, "=", 2) + if len(kv) != 2 { + return fmt.Errorf("%s must be formatted as key=value", pair) + } + var err error + out[kv[0]], err = strconv.ParseInt(kv[1], 10, 64) + if err != nil { + return err + } + } + if !s.changed { + *s.value = out + } else { + for k, v := range out { + (*s.value)[k] = v + } + } + s.changed = true + return nil +} + +func (s *stringToInt64Value) Type() string { + return "stringToInt64" +} + +func (s *stringToInt64Value) String() string { + var buf bytes.Buffer + i := 0 + for k, v := range *s.value { + if i > 0 { + buf.WriteRune(',') + } + buf.WriteString(k) + buf.WriteRune('=') + buf.WriteString(strconv.FormatInt(v, 10)) + i++ + } + return "[" + buf.String() + "]" +} + +func stringToInt64Conv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // An empty string would cause an empty map + if len(val) == 0 { + return map[string]int64{}, nil + } + ss := strings.Split(val, ",") + out := make(map[string]int64, len(ss)) + for _, pair := range ss { + kv := strings.SplitN(pair, "=", 2) + if len(kv) != 2 { + return nil, fmt.Errorf("%s must be formatted as key=value", pair) + } + var err error + out[kv[0]], err = strconv.ParseInt(kv[1], 10, 64) + if err != nil { + return nil, err + } + } + return out, nil +} + +// GetStringToInt64 return the map[string]int64 value of a flag with the given name +func (f *FlagSet) GetStringToInt64(name string) (map[string]int64, error) { + val, err := f.getFlagType(name, "stringToInt64", stringToInt64Conv) + if err != nil { + return map[string]int64{}, err + } + return val.(map[string]int64), nil +} + +// StringToInt64Var defines a string flag with specified name, default value, and usage string. +// The argument p point64s to a map[string]int64 variable in which to store the values of the multiple flags. +// The value of each argument will not try to be separated by comma +func (f *FlagSet) StringToInt64Var(p *map[string]int64, name string, value map[string]int64, usage string) { + f.VarP(newStringToInt64Value(value, p), name, "", usage) +} + +// StringToInt64VarP is like StringToInt64Var, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringToInt64VarP(p *map[string]int64, name, shorthand string, value map[string]int64, usage string) { + f.VarP(newStringToInt64Value(value, p), name, shorthand, usage) +} + +// StringToInt64Var defines a string flag with specified name, default value, and usage string. +// The argument p point64s to a map[string]int64 variable in which to store the value of the flag. +// The value of each argument will not try to be separated by comma +func StringToInt64Var(p *map[string]int64, name string, value map[string]int64, usage string) { + CommandLine.VarP(newStringToInt64Value(value, p), name, "", usage) +} + +// StringToInt64VarP is like StringToInt64Var, but accepts a shorthand letter that can be used after a single dash. +func StringToInt64VarP(p *map[string]int64, name, shorthand string, value map[string]int64, usage string) { + CommandLine.VarP(newStringToInt64Value(value, p), name, shorthand, usage) +} + +// StringToInt64 defines a string flag with specified name, default value, and usage string. +// The return value is the address of a map[string]int64 variable that stores the value of the flag. +// The value of each argument will not try to be separated by comma +func (f *FlagSet) StringToInt64(name string, value map[string]int64, usage string) *map[string]int64 { + p := map[string]int64{} + f.StringToInt64VarP(&p, name, "", value, usage) + return &p +} + +// StringToInt64P is like StringToInt64, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringToInt64P(name, shorthand string, value map[string]int64, usage string) *map[string]int64 { + p := map[string]int64{} + f.StringToInt64VarP(&p, name, shorthand, value, usage) + return &p +} + +// StringToInt64 defines a string flag with specified name, default value, and usage string. +// The return value is the address of a map[string]int64 variable that stores the value of the flag. +// The value of each argument will not try to be separated by comma +func StringToInt64(name string, value map[string]int64, usage string) *map[string]int64 { + return CommandLine.StringToInt64P(name, "", value, usage) +} + +// StringToInt64P is like StringToInt64, but accepts a shorthand letter that can be used after a single dash. +func StringToInt64P(name, shorthand string, value map[string]int64, usage string) *map[string]int64 { + return CommandLine.StringToInt64P(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/string_to_string.go b/vendor/github.com/spf13/pflag/string_to_string.go new file mode 100644 index 0000000000..890a01afc0 --- /dev/null +++ b/vendor/github.com/spf13/pflag/string_to_string.go @@ -0,0 +1,160 @@ +package pflag + +import ( + "bytes" + "encoding/csv" + "fmt" + "strings" +) + +// -- stringToString Value +type stringToStringValue struct { + value *map[string]string + changed bool +} + +func newStringToStringValue(val map[string]string, p *map[string]string) *stringToStringValue { + ssv := new(stringToStringValue) + ssv.value = p + *ssv.value = val + return ssv +} + +// Format: a=1,b=2 +func (s *stringToStringValue) Set(val string) error { + var ss []string + n := strings.Count(val, "=") + switch n { + case 0: + return fmt.Errorf("%s must be formatted as key=value", val) + case 1: + ss = append(ss, strings.Trim(val, `"`)) + default: + r := csv.NewReader(strings.NewReader(val)) + var err error + ss, err = r.Read() + if err != nil { + return err + } + } + + out := make(map[string]string, len(ss)) + for _, pair := range ss { + kv := strings.SplitN(pair, "=", 2) + if len(kv) != 2 { + return fmt.Errorf("%s must be formatted as key=value", pair) + } + out[kv[0]] = kv[1] + } + if !s.changed { + *s.value = out + } else { + for k, v := range out { + (*s.value)[k] = v + } + } + s.changed = true + return nil +} + +func (s *stringToStringValue) Type() string { + return "stringToString" +} + +func (s *stringToStringValue) String() string { + records := make([]string, 0, len(*s.value)>>1) + for k, v := range *s.value { + records = append(records, k+"="+v) + } + + var buf bytes.Buffer + w := csv.NewWriter(&buf) + if err := w.Write(records); err != nil { + panic(err) + } + w.Flush() + return "[" + strings.TrimSpace(buf.String()) + "]" +} + +func stringToStringConv(val string) (interface{}, error) { + val = strings.Trim(val, "[]") + // An empty string would cause an empty map + if len(val) == 0 { + return map[string]string{}, nil + } + r := csv.NewReader(strings.NewReader(val)) + ss, err := r.Read() + if err != nil { + return nil, err + } + out := make(map[string]string, len(ss)) + for _, pair := range ss { + kv := strings.SplitN(pair, "=", 2) + if len(kv) != 2 { + return nil, fmt.Errorf("%s must be formatted as key=value", pair) + } + out[kv[0]] = kv[1] + } + return out, nil +} + +// GetStringToString return the map[string]string value of a flag with the given name +func (f *FlagSet) GetStringToString(name string) (map[string]string, error) { + val, err := f.getFlagType(name, "stringToString", stringToStringConv) + if err != nil { + return map[string]string{}, err + } + return val.(map[string]string), nil +} + +// StringToStringVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a map[string]string variable in which to store the values of the multiple flags. +// The value of each argument will not try to be separated by comma +func (f *FlagSet) StringToStringVar(p *map[string]string, name string, value map[string]string, usage string) { + f.VarP(newStringToStringValue(value, p), name, "", usage) +} + +// StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringToStringVarP(p *map[string]string, name, shorthand string, value map[string]string, usage string) { + f.VarP(newStringToStringValue(value, p), name, shorthand, usage) +} + +// StringToStringVar defines a string flag with specified name, default value, and usage string. +// The argument p points to a map[string]string variable in which to store the value of the flag. +// The value of each argument will not try to be separated by comma +func StringToStringVar(p *map[string]string, name string, value map[string]string, usage string) { + CommandLine.VarP(newStringToStringValue(value, p), name, "", usage) +} + +// StringToStringVarP is like StringToStringVar, but accepts a shorthand letter that can be used after a single dash. +func StringToStringVarP(p *map[string]string, name, shorthand string, value map[string]string, usage string) { + CommandLine.VarP(newStringToStringValue(value, p), name, shorthand, usage) +} + +// StringToString defines a string flag with specified name, default value, and usage string. +// The return value is the address of a map[string]string variable that stores the value of the flag. +// The value of each argument will not try to be separated by comma +func (f *FlagSet) StringToString(name string, value map[string]string, usage string) *map[string]string { + p := map[string]string{} + f.StringToStringVarP(&p, name, "", value, usage) + return &p +} + +// StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash. +func (f *FlagSet) StringToStringP(name, shorthand string, value map[string]string, usage string) *map[string]string { + p := map[string]string{} + f.StringToStringVarP(&p, name, shorthand, value, usage) + return &p +} + +// StringToString defines a string flag with specified name, default value, and usage string. +// The return value is the address of a map[string]string variable that stores the value of the flag. +// The value of each argument will not try to be separated by comma +func StringToString(name string, value map[string]string, usage string) *map[string]string { + return CommandLine.StringToStringP(name, "", value, usage) +} + +// StringToStringP is like StringToString, but accepts a shorthand letter that can be used after a single dash. +func StringToStringP(name, shorthand string, value map[string]string, usage string) *map[string]string { + return CommandLine.StringToStringP(name, shorthand, value, usage) +} diff --git a/vendor/github.com/spf13/pflag/uint_slice.go b/vendor/github.com/spf13/pflag/uint_slice.go index edd94c600a..5fa924835e 100644 --- a/vendor/github.com/spf13/pflag/uint_slice.go +++ b/vendor/github.com/spf13/pflag/uint_slice.go @@ -50,6 +50,48 @@ func (s *uintSliceValue) String() string { return "[" + strings.Join(out, ",") + "]" } +func (s *uintSliceValue) fromString(val string) (uint, error) { + t, err := strconv.ParseUint(val, 10, 0) + if err != nil { + return 0, err + } + return uint(t), nil +} + +func (s *uintSliceValue) toString(val uint) string { + return fmt.Sprintf("%d", val) +} + +func (s *uintSliceValue) Append(val string) error { + i, err := s.fromString(val) + if err != nil { + return err + } + *s.value = append(*s.value, i) + return nil +} + +func (s *uintSliceValue) Replace(val []string) error { + out := make([]uint, len(val)) + for i, d := range val { + var err error + out[i], err = s.fromString(d) + if err != nil { + return err + } + } + *s.value = out + return nil +} + +func (s *uintSliceValue) GetSlice() []string { + out := make([]string, len(*s.value)) + for i, d := range *s.value { + out[i] = s.toString(d) + } + return out +} + func uintSliceConv(val string) (interface{}, error) { val = strings.Trim(val, "[]") // Empty string would cause a slice with one (empty) entry diff --git a/vendor/golang.org/x/mod/LICENSE b/vendor/golang.org/x/mod/LICENSE new file mode 100644 index 0000000000..6a66aea5ea --- /dev/null +++ b/vendor/golang.org/x/mod/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/mod/PATENTS b/vendor/golang.org/x/mod/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/golang.org/x/mod/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/tools/internal/semver/semver.go b/vendor/golang.org/x/mod/semver/semver.go similarity index 92% rename from vendor/golang.org/x/tools/internal/semver/semver.go rename to vendor/golang.org/x/mod/semver/semver.go index 4af7118e55..7be398f80d 100644 --- a/vendor/golang.org/x/tools/internal/semver/semver.go +++ b/vendor/golang.org/x/mod/semver/semver.go @@ -22,6 +22,8 @@ // as shorthands for vMAJOR.0.0 and vMAJOR.MINOR.0. package semver +import "sort" + // parsed returns the parsed form of a semantic version string. type parsed struct { major string @@ -107,7 +109,7 @@ func Build(v string) string { } // Compare returns an integer comparing two versions according to -// according to semantic version precedence. +// semantic version precedence. // The result will be 0 if v == w, -1 if v < w, or +1 if v > w. // // An invalid semantic version string is considered less than a valid one. @@ -138,6 +140,9 @@ func Compare(v, w string) int { // Max canonicalizes its arguments and then returns the version string // that compares greater. +// +// Deprecated: use Compare instead. In most cases, returning a canonicalized +// version is not expected or desired. func Max(v, w string) string { v = Canonical(v) w = Canonical(w) @@ -147,6 +152,24 @@ func Max(v, w string) string { return w } +// ByVersion implements sort.Interface for sorting semantic version strings. +type ByVersion []string + +func (vs ByVersion) Len() int { return len(vs) } +func (vs ByVersion) Swap(i, j int) { vs[i], vs[j] = vs[j], vs[i] } +func (vs ByVersion) Less(i, j int) bool { + cmp := Compare(vs[i], vs[j]) + if cmp != 0 { + return cmp < 0 + } + return vs[i] < vs[j] +} + +// Sort sorts a list of semantic version strings using ByVersion. +func Sort(list []string) { + sort.Sort(ByVersion(list)) +} + func parse(v string) (p parsed, ok bool) { if v == "" || v[0] != 'v' { p.err = "missing v prefix" @@ -263,7 +286,7 @@ func parseBuild(v string) (t, rest string, ok bool) { i := 1 start := 1 for i < len(v) { - if !isIdentChar(v[i]) { + if !isIdentChar(v[i]) && v[i] != '.' { return } if v[i] == '.' { diff --git a/vendor/golang.org/x/sys/execabs/execabs.go b/vendor/golang.org/x/sys/execabs/execabs.go new file mode 100644 index 0000000000..78192498db --- /dev/null +++ b/vendor/golang.org/x/sys/execabs/execabs.go @@ -0,0 +1,102 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package execabs is a drop-in replacement for os/exec +// that requires PATH lookups to find absolute paths. +// That is, execabs.Command("cmd") runs the same PATH lookup +// as exec.Command("cmd"), but if the result is a path +// which is relative, the Run and Start methods will report +// an error instead of running the executable. +// +// See https://blog.golang.org/path-security for more information +// about when it may be necessary or appropriate to use this package. +package execabs + +import ( + "context" + "fmt" + "os/exec" + "path/filepath" + "reflect" + "unsafe" +) + +// ErrNotFound is the error resulting if a path search failed to find an executable file. +// It is an alias for exec.ErrNotFound. +var ErrNotFound = exec.ErrNotFound + +// Cmd represents an external command being prepared or run. +// It is an alias for exec.Cmd. +type Cmd = exec.Cmd + +// Error is returned by LookPath when it fails to classify a file as an executable. +// It is an alias for exec.Error. +type Error = exec.Error + +// An ExitError reports an unsuccessful exit by a command. +// It is an alias for exec.ExitError. +type ExitError = exec.ExitError + +func relError(file, path string) error { + return fmt.Errorf("%s resolves to executable in current directory (.%c%s)", file, filepath.Separator, path) +} + +// LookPath searches for an executable named file in the directories +// named by the PATH environment variable. If file contains a slash, +// it is tried directly and the PATH is not consulted. The result will be +// an absolute path. +// +// LookPath differs from exec.LookPath in its handling of PATH lookups, +// which are used for file names without slashes. If exec.LookPath's +// PATH lookup would have returned an executable from the current directory, +// LookPath instead returns an error. +func LookPath(file string) (string, error) { + path, err := exec.LookPath(file) + if err != nil { + return "", err + } + if filepath.Base(file) == file && !filepath.IsAbs(path) { + return "", relError(file, path) + } + return path, nil +} + +func fixCmd(name string, cmd *exec.Cmd) { + if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) { + // exec.Command was called with a bare binary name and + // exec.LookPath returned a path which is not absolute. + // Set cmd.lookPathErr and clear cmd.Path so that it + // cannot be run. + lookPathErr := (*error)(unsafe.Pointer(reflect.ValueOf(cmd).Elem().FieldByName("lookPathErr").Addr().Pointer())) + if *lookPathErr == nil { + *lookPathErr = relError(name, cmd.Path) + } + cmd.Path = "" + } +} + +// CommandContext is like Command but includes a context. +// +// The provided context is used to kill the process (by calling os.Process.Kill) +// if the context becomes done before the command completes on its own. +func CommandContext(ctx context.Context, name string, arg ...string) *exec.Cmd { + cmd := exec.CommandContext(ctx, name, arg...) + fixCmd(name, cmd) + return cmd + +} + +// Command returns the Cmd struct to execute the named program with the given arguments. +// See exec.Command for most details. +// +// Command differs from exec.Command in its handling of PATH lookups, +// which are used when the program name contains no slashes. +// If exec.Command would have returned an exec.Cmd configured to run an +// executable from the current directory, Command instead +// returns an exec.Cmd that will return an error from Start or Run. +func Command(name string, arg ...string) *exec.Cmd { + cmd := exec.Command(name, arg...) + fixCmd(name, cmd) + return cmd +} diff --git a/vendor/golang.org/x/sys/unix/README.md b/vendor/golang.org/x/sys/unix/README.md index 579d2d7355..474efad0e0 100644 --- a/vendor/golang.org/x/sys/unix/README.md +++ b/vendor/golang.org/x/sys/unix/README.md @@ -76,7 +76,7 @@ arguments can be passed to the kernel. The third is for low-level use by the ForkExec wrapper. Unlike the first two, it does not call into the scheduler to let it know that a system call is running. -When porting Go to an new architecture/OS, this file must be implemented for +When porting Go to a new architecture/OS, this file must be implemented for each GOOS/GOARCH pair. ### mksysnum @@ -107,7 +107,7 @@ prototype can be exported (capitalized) or not. Adding a new syscall often just requires adding a new `//sys` function prototype with the desired arguments and a capitalized name so it is exported. However, if you want the interface to the syscall to be different, often one will make an -unexported `//sys` prototype, an then write a custom wrapper in +unexported `//sys` prototype, and then write a custom wrapper in `syscall_${GOOS}.go`. ### types files @@ -137,7 +137,7 @@ some `#if/#elif` macros in your include statements. This script is used to generate the system's various constants. This doesn't just include the error numbers and error strings, but also the signal numbers -an a wide variety of miscellaneous constants. The constants come from the list +and a wide variety of miscellaneous constants. The constants come from the list of include files in the `includes_${uname}` variable. A regex then picks out the desired `#define` statements, and generates the corresponding Go constants. The error numbers and strings are generated from `#include `, and the diff --git a/vendor/golang.org/x/sys/unix/aliases.go b/vendor/golang.org/x/sys/unix/aliases.go index 951fce4d0d..abc89c104a 100644 --- a/vendor/golang.org/x/sys/unix/aliases.go +++ b/vendor/golang.org/x/sys/unix/aliases.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9 +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // +build go1.9 package unix diff --git a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s index 06f84b8555..db9171c2e4 100644 --- a/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s +++ b/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build gc +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s b/vendor/golang.org/x/sys/unix/asm_bsd_386.s similarity index 70% rename from vendor/golang.org/x/sys/unix/asm_freebsd_386.s rename to vendor/golang.org/x/sys/unix/asm_bsd_386.s index c9a0a26015..e0fcd9b3de 100644 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_386.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_386.s @@ -1,14 +1,14 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build (freebsd || netbsd || openbsd) && gc +// +build freebsd netbsd openbsd +// +build gc #include "textflag.h" -// -// System call support for 386, FreeBSD -// +// System call support for 386 BSD // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. @@ -22,7 +22,7 @@ TEXT ·Syscall6(SB),NOSPLIT,$0-40 TEXT ·Syscall9(SB),NOSPLIT,$0-52 JMP syscall·Syscall9(SB) -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 +TEXT ·RawSyscall(SB),NOSPLIT,$0-28 JMP syscall·RawSyscall(SB) TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s similarity index 71% rename from vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s rename to vendor/golang.org/x/sys/unix/asm_bsd_amd64.s index 2ede05c72f..2b99c349a2 100644 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_amd64.s @@ -1,14 +1,14 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build (darwin || dragonfly || freebsd || netbsd || openbsd) && gc +// +build darwin dragonfly freebsd netbsd openbsd +// +build gc #include "textflag.h" -// -// System call support for AMD64, NetBSD -// +// System call support for AMD64 BSD // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s similarity index 74% rename from vendor/golang.org/x/sys/unix/asm_netbsd_arm.s rename to vendor/golang.org/x/sys/unix/asm_bsd_arm.s index e8928571c4..d702d4adc7 100644 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm.s @@ -1,14 +1,14 @@ -// Copyright 2013 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build (freebsd || netbsd || openbsd) && gc +// +build freebsd netbsd openbsd +// +build gc #include "textflag.h" -// -// System call support for ARM, NetBSD -// +// System call support for ARM BSD // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s similarity index 73% rename from vendor/golang.org/x/sys/unix/asm_darwin_amd64.s rename to vendor/golang.org/x/sys/unix/asm_bsd_arm64.s index 6321421f27..fe36a7391a 100644 --- a/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_bsd_arm64.s @@ -1,14 +1,14 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build (darwin || freebsd || netbsd || openbsd) && gc +// +build darwin freebsd netbsd openbsd +// +build gc #include "textflag.h" -// -// System call support for AMD64, Darwin -// +// System call support for ARM64 BSD // Just jump to package syscall's implementation for all these functions. // The runtime may know about them. diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_386.s b/vendor/golang.org/x/sys/unix/asm_darwin_386.s deleted file mode 100644 index 8a7278319e..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_386.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for 386, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm.s deleted file mode 100644 index 333242d506..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_arm.s +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo -// +build arm,darwin - -#include "textflag.h" - -// -// System call support for ARM, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s b/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s deleted file mode 100644 index 97e0174371..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo -// +build arm64,darwin - -#include "textflag.h" - -// -// System call support for AMD64, Darwin -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s b/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s deleted file mode 100644 index 603dd5728c..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for AMD64, DragonFly -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s deleted file mode 100644 index 35172477c8..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for AMD64, FreeBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s deleted file mode 100644 index 9227c875bf..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for ARM, FreeBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s deleted file mode 100644 index d9318cbf03..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for ARM64, FreeBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_linux_386.s b/vendor/golang.org/x/sys/unix/asm_linux_386.s index 448bebbb59..8fd101d071 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_386.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_386.s @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build gc +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s index c6468a9588..7ed38e43c6 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_amd64.s @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build gc +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm.s b/vendor/golang.org/x/sys/unix/asm_linux_arm.s index cf0f3575c1..8ef1d51402 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm.s @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build gc +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s index afe6fdf6b1..98ae02760d 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_arm64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_arm64.s @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && arm64 && gc // +build linux // +build arm64 -// +build !gccgo +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s index ab9d63831a..21231d2ce1 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (mips64 || mips64le) && gc // +build linux // +build mips64 mips64le -// +build !gccgo +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s index 99e5399045..6783b26c60 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (mips || mipsle) && gc // +build linux // +build mips mipsle -// +build !gccgo +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s index 88f7125578..19d4989344 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (ppc64 || ppc64le) && gc // +build linux // +build ppc64 ppc64le -// +build !gccgo +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s index 3cfefed2ec..e42eb81d58 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_riscv64.s @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build riscv64,!gccgo +//go:build riscv64 && gc +// +build riscv64 +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s index a5a863c6bd..c46aab3395 100644 --- a/vendor/golang.org/x/sys/unix/asm_linux_s390x.s +++ b/vendor/golang.org/x/sys/unix/asm_linux_s390x.s @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build s390x +//go:build linux && s390x && gc // +build linux -// +build !gccgo +// +build s390x +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s b/vendor/golang.org/x/sys/unix/asm_netbsd_386.s deleted file mode 100644 index 48bdcd7632..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_386.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for 386, NetBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s deleted file mode 100644 index 6f98ba5a37..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for ARM64, NetBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s b/vendor/golang.org/x/sys/unix/asm_openbsd_386.s deleted file mode 100644 index 00576f3c83..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_386.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for 386, OpenBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s deleted file mode 100644 index 790ef77f86..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for AMD64, OpenBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-56 - JMP syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-80 - JMP syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-104 - JMP syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-56 - JMP syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 - JMP syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s b/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s deleted file mode 100644 index 469bfa1003..0000000000 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !gccgo - -#include "textflag.h" - -// -// System call support for ARM, OpenBSD -// - -// Just jump to package syscall's implementation for all these functions. -// The runtime may know about them. - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - B syscall·Syscall(SB) - -TEXT ·Syscall6(SB),NOSPLIT,$0-40 - B syscall·Syscall6(SB) - -TEXT ·Syscall9(SB),NOSPLIT,$0-52 - B syscall·Syscall9(SB) - -TEXT ·RawSyscall(SB),NOSPLIT,$0-28 - B syscall·RawSyscall(SB) - -TEXT ·RawSyscall6(SB),NOSPLIT,$0-40 - B syscall·RawSyscall6(SB) diff --git a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s similarity index 89% rename from vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s rename to vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s index 0cedea3d39..5e7a1169c0 100644 --- a/vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s +++ b/vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build gc +// +build gc #include "textflag.h" // -// System call support for arm64, OpenBSD +// System call support for mips64, OpenBSD // // Just jump to package syscall's implementation for all these functions. diff --git a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s index ded8260f3e..f8c5394c1a 100644 --- a/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s +++ b/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !gccgo +//go:build gc +// +build gc #include "textflag.h" diff --git a/vendor/golang.org/x/sys/unix/asm_zos_s390x.s b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s new file mode 100644 index 0000000000..3b54e18581 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/asm_zos_s390x.s @@ -0,0 +1,426 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x && gc +// +build zos +// +build s390x +// +build gc + +#include "textflag.h" + +#define PSALAA 1208(R0) +#define GTAB64(x) 80(x) +#define LCA64(x) 88(x) +#define CAA(x) 8(x) +#define EDCHPXV(x) 1016(x) // in the CAA +#define SAVSTACK_ASYNC(x) 336(x) // in the LCA + +// SS_*, where x=SAVSTACK_ASYNC +#define SS_LE(x) 0(x) +#define SS_GO(x) 8(x) +#define SS_ERRNO(x) 16(x) +#define SS_ERRNOJR(x) 20(x) + +#define LE_CALL BYTE $0x0D; BYTE $0x76; // BL R7, R6 + +TEXT ·clearErrno(SB),NOSPLIT,$0-0 + BL addrerrno<>(SB) + MOVD $0, 0(R3) + RET + +// Returns the address of errno in R3. +TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0 + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get __errno FuncDesc. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + ADD $(0x156*16), R9 + LMG 0(R9), R5, R6 + + // Switch to saved LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Call __errno function. + LE_CALL + NOPH + + // Switch back to Go stack. + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + RET + +TEXT ·syscall_syscall(SB),NOSPLIT,$0-56 + BL runtime·entersyscall(SB) + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+32(FP) + MOVD R0, r2+40(FP) + MOVD R0, err+48(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+48(FP) +done: + BL runtime·exitsyscall(SB) + RET + +TEXT ·syscall_rawsyscall(SB),NOSPLIT,$0-56 + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+32(FP) + MOVD R0, r2+40(FP) + MOVD R0, err+48(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+48(FP) +done: + RET + +TEXT ·syscall_syscall6(SB),NOSPLIT,$0-80 + BL runtime·entersyscall(SB) + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Fill in parameter list. + MOVD a4+32(FP), R12 + MOVD R12, (2176+24)(R4) + MOVD a5+40(FP), R12 + MOVD R12, (2176+32)(R4) + MOVD a6+48(FP), R12 + MOVD R12, (2176+40)(R4) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+56(FP) + MOVD R0, r2+64(FP) + MOVD R0, err+72(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+72(FP) +done: + BL runtime·exitsyscall(SB) + RET + +TEXT ·syscall_rawsyscall6(SB),NOSPLIT,$0-80 + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Fill in parameter list. + MOVD a4+32(FP), R12 + MOVD R12, (2176+24)(R4) + MOVD a5+40(FP), R12 + MOVD R12, (2176+32)(R4) + MOVD a6+48(FP), R12 + MOVD R12, (2176+40)(R4) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+56(FP) + MOVD R0, r2+64(FP) + MOVD R0, err+72(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL ·rrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+72(FP) +done: + RET + +TEXT ·syscall_syscall9(SB),NOSPLIT,$0 + BL runtime·entersyscall(SB) + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Fill in parameter list. + MOVD a4+32(FP), R12 + MOVD R12, (2176+24)(R4) + MOVD a5+40(FP), R12 + MOVD R12, (2176+32)(R4) + MOVD a6+48(FP), R12 + MOVD R12, (2176+40)(R4) + MOVD a7+56(FP), R12 + MOVD R12, (2176+48)(R4) + MOVD a8+64(FP), R12 + MOVD R12, (2176+56)(R4) + MOVD a9+72(FP), R12 + MOVD R12, (2176+64)(R4) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+80(FP) + MOVD R0, r2+88(FP) + MOVD R0, err+96(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+96(FP) +done: + BL runtime·exitsyscall(SB) + RET + +TEXT ·syscall_rawsyscall9(SB),NOSPLIT,$0 + MOVD a1+8(FP), R1 + MOVD a2+16(FP), R2 + MOVD a3+24(FP), R3 + + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get function. + MOVD CAA(R8), R9 + MOVD EDCHPXV(R9), R9 + MOVD trap+0(FP), R5 + SLD $4, R5 + ADD R5, R9 + LMG 0(R9), R5, R6 + + // Restore LE stack. + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R4 + MOVD $0, 0(R9) + + // Fill in parameter list. + MOVD a4+32(FP), R12 + MOVD R12, (2176+24)(R4) + MOVD a5+40(FP), R12 + MOVD R12, (2176+32)(R4) + MOVD a6+48(FP), R12 + MOVD R12, (2176+40)(R4) + MOVD a7+56(FP), R12 + MOVD R12, (2176+48)(R4) + MOVD a8+64(FP), R12 + MOVD R12, (2176+56)(R4) + MOVD a9+72(FP), R12 + MOVD R12, (2176+64)(R4) + + // Call function. + LE_CALL + NOPH + XOR R0, R0 // Restore R0 to $0. + MOVD R4, 0(R9) // Save stack pointer. + + MOVD R3, r1+80(FP) + MOVD R0, r2+88(FP) + MOVD R0, err+96(FP) + MOVW R3, R4 + CMP R4, $-1 + BNE done + BL addrerrno<>(SB) + MOVWZ 0(R3), R3 + MOVD R3, err+96(FP) +done: + RET + +// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64) +TEXT ·svcCall(SB),NOSPLIT,$0 + BL runtime·save_g(SB) // Save g and stack pointer + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD R15, 0(R9) + + MOVD argv+8(FP), R1 // Move function arguments into registers + MOVD dsa+16(FP), g + MOVD fnptr+0(FP), R15 + + BYTE $0x0D // Branch to function + BYTE $0xEF + + BL runtime·load_g(SB) // Restore g and stack pointer + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + MOVD SAVSTACK_ASYNC(R8), R9 + MOVD 0(R9), R15 + + RET + +// func svcLoad(name *byte) unsafe.Pointer +TEXT ·svcLoad(SB),NOSPLIT,$0 + MOVD R15, R2 // Save go stack pointer + MOVD name+0(FP), R0 // Move SVC args into registers + MOVD $0x80000000, R1 + MOVD $0, R15 + BYTE $0x0A // SVC 08 LOAD + BYTE $0x08 + MOVW R15, R3 // Save return code from SVC + MOVD R2, R15 // Restore go stack pointer + CMP R3, $0 // Check SVC return code + BNE error + + MOVD $-2, R3 // Reset last bit of entry point to zero + AND R0, R3 + MOVD R3, addr+8(FP) // Return entry point returned by SVC + CMP R0, R3 // Check if last bit of entry point was set + BNE done + + MOVD R15, R2 // Save go stack pointer + MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08) + BYTE $0x0A // SVC 09 DELETE + BYTE $0x09 + MOVD R2, R15 // Restore go stack pointer + +error: + MOVD $0, addr+8(FP) // Return 0 on failure +done: + XOR R0, R0 // Reset r0 to 0 + RET + +// func svcUnload(name *byte, fnptr unsafe.Pointer) int64 +TEXT ·svcUnload(SB),NOSPLIT,$0 + MOVD R15, R2 // Save go stack pointer + MOVD name+0(FP), R0 // Move SVC args into registers + MOVD addr+8(FP), R15 + BYTE $0x0A // SVC 09 + BYTE $0x09 + XOR R0, R0 // Reset r0 to 0 + MOVD R15, R1 // Save SVC return code + MOVD R2, R15 // Restore go stack pointer + MOVD R1, rc+0(FP) // Return SVC return code + RET + +// func gettid() uint64 +TEXT ·gettid(SB), NOSPLIT, $0 + // Get library control area (LCA). + MOVW PSALAA, R8 + MOVD LCA64(R8), R8 + + // Get CEECAATHDID + MOVD CAA(R8), R9 + MOVD 0x3D0(R9), R9 + MOVD R9, ret+0(FP) + + RET diff --git a/vendor/golang.org/x/sys/unix/cap_freebsd.go b/vendor/golang.org/x/sys/unix/cap_freebsd.go index df52048773..0b7c6adb86 100644 --- a/vendor/golang.org/x/sys/unix/cap_freebsd.go +++ b/vendor/golang.org/x/sys/unix/cap_freebsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build freebsd // +build freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/constants.go b/vendor/golang.org/x/sys/unix/constants.go index 3a6ac648dd..394a3965b6 100644 --- a/vendor/golang.org/x/sys/unix/constants.go +++ b/vendor/golang.org/x/sys/unix/constants.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go index 5e5fb45104..65a998508d 100644 --- a/vendor/golang.org/x/sys/unix/dev_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix -// +build ppc +//go:build aix && ppc +// +build aix,ppc // Functions to access/create device major and minor numbers matching the // encoding used by AIX. diff --git a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go index 8b401244c4..8fc08ad0aa 100644 --- a/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix -// +build ppc64 +//go:build aix && ppc64 +// +build aix,ppc64 // Functions to access/create device major and minor numbers matching the // encoding used AIX. diff --git a/vendor/golang.org/x/sys/unix/dev_zos.go b/vendor/golang.org/x/sys/unix/dev_zos.go new file mode 100644 index 0000000000..a388e59a0e --- /dev/null +++ b/vendor/golang.org/x/sys/unix/dev_zos.go @@ -0,0 +1,29 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +// Functions to access/create device major and minor numbers matching the +// encoding used by z/OS. +// +// The information below is extracted and adapted from macros. + +package unix + +// Major returns the major component of a z/OS device number. +func Major(dev uint64) uint32 { + return uint32((dev >> 16) & 0x0000FFFF) +} + +// Minor returns the minor component of a z/OS device number. +func Minor(dev uint64) uint32 { + return uint32(dev & 0x0000FFFF) +} + +// Mkdev returns a z/OS device number generated from the given major and minor +// components. +func Mkdev(major, minor uint32) uint64 { + return (uint64(major) << 16) | uint64(minor) +} diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go index 304016b688..e74e5eaa3b 100644 --- a/vendor/golang.org/x/sys/unix/dirent.go +++ b/vendor/golang.org/x/sys/unix/dirent.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/endian_big.go b/vendor/golang.org/x/sys/unix/endian_big.go index 5e9269063f..a520265576 100644 --- a/vendor/golang.org/x/sys/unix/endian_big.go +++ b/vendor/golang.org/x/sys/unix/endian_big.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // -// +build ppc64 s390x mips mips64 +//go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 +// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64 package unix diff --git a/vendor/golang.org/x/sys/unix/endian_little.go b/vendor/golang.org/x/sys/unix/endian_little.go index bcdb5d30eb..4362f47e2c 100644 --- a/vendor/golang.org/x/sys/unix/endian_little.go +++ b/vendor/golang.org/x/sys/unix/endian_little.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // -// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le riscv64 +//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh +// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh package unix diff --git a/vendor/golang.org/x/sys/unix/env_unix.go b/vendor/golang.org/x/sys/unix/env_unix.go index 84178b0a13..29ccc4d133 100644 --- a/vendor/golang.org/x/sys/unix/env_unix.go +++ b/vendor/golang.org/x/sys/unix/env_unix.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Unix environment variables. diff --git a/vendor/golang.org/x/sys/unix/epoll_zos.go b/vendor/golang.org/x/sys/unix/epoll_zos.go new file mode 100644 index 0000000000..cedaf7e024 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/epoll_zos.go @@ -0,0 +1,221 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "sync" +) + +// This file simulates epoll on z/OS using poll. + +// Analogous to epoll_event on Linux. +// TODO(neeilan): Pad is because the Linux kernel expects a 96-bit struct. We never pass this to the kernel; remove? +type EpollEvent struct { + Events uint32 + Fd int32 + Pad int32 +} + +const ( + EPOLLERR = 0x8 + EPOLLHUP = 0x10 + EPOLLIN = 0x1 + EPOLLMSG = 0x400 + EPOLLOUT = 0x4 + EPOLLPRI = 0x2 + EPOLLRDBAND = 0x80 + EPOLLRDNORM = 0x40 + EPOLLWRBAND = 0x200 + EPOLLWRNORM = 0x100 + EPOLL_CTL_ADD = 0x1 + EPOLL_CTL_DEL = 0x2 + EPOLL_CTL_MOD = 0x3 + // The following constants are part of the epoll API, but represent + // currently unsupported functionality on z/OS. + // EPOLL_CLOEXEC = 0x80000 + // EPOLLET = 0x80000000 + // EPOLLONESHOT = 0x40000000 + // EPOLLRDHUP = 0x2000 // Typically used with edge-triggered notis + // EPOLLEXCLUSIVE = 0x10000000 // Exclusive wake-up mode + // EPOLLWAKEUP = 0x20000000 // Relies on Linux's BLOCK_SUSPEND capability +) + +// TODO(neeilan): We can eliminate these epToPoll / pToEpoll calls by using identical mask values for POLL/EPOLL +// constants where possible The lower 16 bits of epoll events (uint32) can fit any system poll event (int16). + +// epToPollEvt converts epoll event field to poll equivalent. +// In epoll, Events is a 32-bit field, while poll uses 16 bits. +func epToPollEvt(events uint32) int16 { + var ep2p = map[uint32]int16{ + EPOLLIN: POLLIN, + EPOLLOUT: POLLOUT, + EPOLLHUP: POLLHUP, + EPOLLPRI: POLLPRI, + EPOLLERR: POLLERR, + } + + var pollEvts int16 = 0 + for epEvt, pEvt := range ep2p { + if (events & epEvt) != 0 { + pollEvts |= pEvt + } + } + + return pollEvts +} + +// pToEpollEvt converts 16 bit poll event bitfields to 32-bit epoll event fields. +func pToEpollEvt(revents int16) uint32 { + var p2ep = map[int16]uint32{ + POLLIN: EPOLLIN, + POLLOUT: EPOLLOUT, + POLLHUP: EPOLLHUP, + POLLPRI: EPOLLPRI, + POLLERR: EPOLLERR, + } + + var epollEvts uint32 = 0 + for pEvt, epEvt := range p2ep { + if (revents & pEvt) != 0 { + epollEvts |= epEvt + } + } + + return epollEvts +} + +// Per-process epoll implementation. +type epollImpl struct { + mu sync.Mutex + epfd2ep map[int]*eventPoll + nextEpfd int +} + +// eventPoll holds a set of file descriptors being watched by the process. A process can have multiple epoll instances. +// On Linux, this is an in-kernel data structure accessed through a fd. +type eventPoll struct { + mu sync.Mutex + fds map[int]*EpollEvent +} + +// epoll impl for this process. +var impl epollImpl = epollImpl{ + epfd2ep: make(map[int]*eventPoll), + nextEpfd: 0, +} + +func (e *epollImpl) epollcreate(size int) (epfd int, err error) { + e.mu.Lock() + defer e.mu.Unlock() + epfd = e.nextEpfd + e.nextEpfd++ + + e.epfd2ep[epfd] = &eventPoll{ + fds: make(map[int]*EpollEvent), + } + return epfd, nil +} + +func (e *epollImpl) epollcreate1(flag int) (fd int, err error) { + return e.epollcreate(4) +} + +func (e *epollImpl) epollctl(epfd int, op int, fd int, event *EpollEvent) (err error) { + e.mu.Lock() + defer e.mu.Unlock() + + ep, ok := e.epfd2ep[epfd] + if !ok { + + return EBADF + } + + switch op { + case EPOLL_CTL_ADD: + // TODO(neeilan): When we make epfds and fds disjoint, detect epoll + // loops here (instances watching each other) and return ELOOP. + if _, ok := ep.fds[fd]; ok { + return EEXIST + } + ep.fds[fd] = event + case EPOLL_CTL_MOD: + if _, ok := ep.fds[fd]; !ok { + return ENOENT + } + ep.fds[fd] = event + case EPOLL_CTL_DEL: + if _, ok := ep.fds[fd]; !ok { + return ENOENT + } + delete(ep.fds, fd) + + } + return nil +} + +// Must be called while holding ep.mu +func (ep *eventPoll) getFds() []int { + fds := make([]int, len(ep.fds)) + for fd := range ep.fds { + fds = append(fds, fd) + } + return fds +} + +func (e *epollImpl) epollwait(epfd int, events []EpollEvent, msec int) (n int, err error) { + e.mu.Lock() // in [rare] case of concurrent epollcreate + epollwait + ep, ok := e.epfd2ep[epfd] + + if !ok { + e.mu.Unlock() + return 0, EBADF + } + + pollfds := make([]PollFd, 4) + for fd, epollevt := range ep.fds { + pollfds = append(pollfds, PollFd{Fd: int32(fd), Events: epToPollEvt(epollevt.Events)}) + } + e.mu.Unlock() + + n, err = Poll(pollfds, msec) + if err != nil { + return n, err + } + + i := 0 + for _, pFd := range pollfds { + if pFd.Revents != 0 { + events[i] = EpollEvent{Fd: pFd.Fd, Events: pToEpollEvt(pFd.Revents)} + i++ + } + + if i == n { + break + } + } + + return n, nil +} + +func EpollCreate(size int) (fd int, err error) { + return impl.epollcreate(size) +} + +func EpollCreate1(flag int) (fd int, err error) { + return impl.epollcreate1(flag) +} + +func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) { + return impl.epollctl(epfd, op, fd, event) +} + +// Because EpollWait mutates events, the caller is expected to coordinate +// concurrent access if calling with the same epfd from multiple goroutines. +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + return impl.epollwait(epfd, events, msec) +} diff --git a/vendor/golang.org/x/sys/unix/fcntl.go b/vendor/golang.org/x/sys/unix/fcntl.go index 4dc5348643..e9b991258c 100644 --- a/vendor/golang.org/x/sys/unix/fcntl.go +++ b/vendor/golang.org/x/sys/unix/fcntl.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build dragonfly || freebsd || linux || netbsd || openbsd // +build dragonfly freebsd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/fcntl_darwin.go b/vendor/golang.org/x/sys/unix/fcntl_darwin.go index 5868a4a47b..a9911c7c1d 100644 --- a/vendor/golang.org/x/sys/unix/fcntl_darwin.go +++ b/vendor/golang.org/x/sys/unix/fcntl_darwin.go @@ -16,3 +16,9 @@ func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk)))) return err } + +// FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command. +func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error { + _, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore)))) + return err +} diff --git a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go index fc0e50e037..29d44808b1 100644 --- a/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go +++ b/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go @@ -1,9 +1,10 @@ -// +build linux,386 linux,arm linux,mips linux,mipsle - // Copyright 2014 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc) +// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc + package unix func init() { diff --git a/vendor/golang.org/x/sys/unix/fdset.go b/vendor/golang.org/x/sys/unix/fdset.go index b27be0a014..a8068f94f2 100644 --- a/vendor/golang.org/x/sys/unix/fdset.go +++ b/vendor/golang.org/x/sys/unix/fdset.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix diff --git a/vendor/golang.org/x/sys/unix/fstatfs_zos.go b/vendor/golang.org/x/sys/unix/fstatfs_zos.go new file mode 100644 index 0000000000..e377cc9f49 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/fstatfs_zos.go @@ -0,0 +1,164 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "unsafe" +) + +// This file simulates fstatfs on z/OS using fstatvfs and w_getmntent. + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + var stat_v Statvfs_t + err = Fstatvfs(fd, &stat_v) + if err == nil { + // populate stat + stat.Type = 0 + stat.Bsize = stat_v.Bsize + stat.Blocks = stat_v.Blocks + stat.Bfree = stat_v.Bfree + stat.Bavail = stat_v.Bavail + stat.Files = stat_v.Files + stat.Ffree = stat_v.Ffree + stat.Fsid = stat_v.Fsid + stat.Namelen = stat_v.Namemax + stat.Frsize = stat_v.Frsize + stat.Flags = stat_v.Flag + for passn := 0; passn < 5; passn++ { + switch passn { + case 0: + err = tryGetmntent64(stat) + break + case 1: + err = tryGetmntent128(stat) + break + case 2: + err = tryGetmntent256(stat) + break + case 3: + err = tryGetmntent512(stat) + break + case 4: + err = tryGetmntent1024(stat) + break + default: + break + } + //proceed to return if: err is nil (found), err is nonnil but not ERANGE (another error occurred) + if err == nil || err != nil && err != ERANGE { + break + } + } + } + return err +} + +func tryGetmntent64(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [64]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} + +func tryGetmntent128(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [128]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} + +func tryGetmntent256(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [256]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} + +func tryGetmntent512(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [512]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} + +func tryGetmntent1024(stat *Statfs_t) (err error) { + var mnt_ent_buffer struct { + header W_Mnth + filesys_info [1024]W_Mntent + } + var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer)) + fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size) + if err != nil { + return err + } + err = ERANGE //return ERANGE if no match is found in this batch + for i := 0; i < fs_count; i++ { + if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) { + stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0]) + err = nil + break + } + } + return err +} diff --git a/vendor/golang.org/x/sys/unix/gccgo.go b/vendor/golang.org/x/sys/unix/gccgo.go index cd6f5a6133..0dee23222c 100644 --- a/vendor/golang.org/x/sys/unix/gccgo.go +++ b/vendor/golang.org/x/sys/unix/gccgo.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build gccgo -// +build !aix +//go:build gccgo && !aix +// +build gccgo,!aix package unix @@ -12,10 +12,8 @@ import "syscall" // We can't use the gc-syntax .s files for gccgo. On the plus side // much of the functionality can be written directly in Go. -//extern gccgoRealSyscallNoError func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr) -//extern gccgoRealSyscall func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr) func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) { diff --git a/vendor/golang.org/x/sys/unix/gccgo_c.c b/vendor/golang.org/x/sys/unix/gccgo_c.c index c44730c5e9..2cb1fefac6 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_c.c +++ b/vendor/golang.org/x/sys/unix/gccgo_c.c @@ -21,6 +21,9 @@ struct ret { uintptr_t err; }; +struct ret gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) + __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscall"); + struct ret gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) { @@ -32,6 +35,9 @@ gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintp return r; } +uintptr_t gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) + __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscallNoError"); + uintptr_t gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9) { diff --git a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go index 251a977a81..e60e49a3d9 100644 --- a/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build gccgo && linux && amd64 // +build gccgo,linux,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/ifreq_linux.go b/vendor/golang.org/x/sys/unix/ifreq_linux.go new file mode 100644 index 0000000000..934af313c3 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -0,0 +1,149 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux +// +build linux + +package unix + +import ( + "bytes" + "unsafe" +) + +// Helpers for dealing with ifreq since it contains a union and thus requires a +// lot of unsafe.Pointer casts to use properly. + +// An Ifreq is a type-safe wrapper around the raw ifreq struct. An Ifreq +// contains an interface name and a union of arbitrary data which can be +// accessed using the Ifreq's methods. To create an Ifreq, use the NewIfreq +// function. +// +// Use the Name method to access the stored interface name. The union data +// fields can be get and set using the following methods: +// - Uint16/SetUint16: flags +// - Uint32/SetUint32: ifindex, metric, mtu +type Ifreq struct{ raw ifreq } + +// NewIfreq creates an Ifreq with the input network interface name after +// validating the name does not exceed IFNAMSIZ-1 (trailing NULL required) +// bytes. +func NewIfreq(name string) (*Ifreq, error) { + // Leave room for terminating NULL byte. + if len(name) >= IFNAMSIZ { + return nil, EINVAL + } + + var ifr ifreq + copy(ifr.Ifrn[:], name) + + return &Ifreq{raw: ifr}, nil +} + +// TODO(mdlayher): get/set methods for hardware address sockaddr, char array, etc. + +// Name returns the interface name associated with the Ifreq. +func (ifr *Ifreq) Name() string { + // BytePtrToString requires a NULL terminator or the program may crash. If + // one is not present, just return the empty string. + if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) { + return "" + } + + return BytePtrToString(&ifr.raw.Ifrn[0]) +} + +// According to netdevice(7), only AF_INET addresses are returned for numerous +// sockaddr ioctls. For convenience, we expose these as Inet4Addr since the Port +// field and other data is always empty. + +// Inet4Addr returns the Ifreq union data from an embedded sockaddr as a C +// in_addr/Go []byte (4-byte IPv4 address) value. If the sockaddr family is not +// AF_INET, an error is returned. +func (ifr *Ifreq) Inet4Addr() ([]byte, error) { + raw := *(*RawSockaddrInet4)(unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0])) + if raw.Family != AF_INET { + // Cannot safely interpret raw.Addr bytes as an IPv4 address. + return nil, EINVAL + } + + return raw.Addr[:], nil +} + +// SetInet4Addr sets a C in_addr/Go []byte (4-byte IPv4 address) value in an +// embedded sockaddr within the Ifreq's union data. v must be 4 bytes in length +// or an error will be returned. +func (ifr *Ifreq) SetInet4Addr(v []byte) error { + if len(v) != 4 { + return EINVAL + } + + var addr [4]byte + copy(addr[:], v) + + ifr.clear() + *(*RawSockaddrInet4)( + unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]), + ) = RawSockaddrInet4{ + // Always set IP family as ioctls would require it anyway. + Family: AF_INET, + Addr: addr, + } + + return nil +} + +// Uint16 returns the Ifreq union data as a C short/Go uint16 value. +func (ifr *Ifreq) Uint16() uint16 { + return *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) +} + +// SetUint16 sets a C short/Go uint16 value as the Ifreq's union data. +func (ifr *Ifreq) SetUint16(v uint16) { + ifr.clear() + *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) = v +} + +// Uint32 returns the Ifreq union data as a C int/Go uint32 value. +func (ifr *Ifreq) Uint32() uint32 { + return *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) +} + +// SetUint32 sets a C int/Go uint32 value as the Ifreq's union data. +func (ifr *Ifreq) SetUint32(v uint32) { + ifr.clear() + *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) = v +} + +// clear zeroes the ifreq's union field to prevent trailing garbage data from +// being sent to the kernel if an ifreq is reused. +func (ifr *Ifreq) clear() { + for i := range ifr.raw.Ifru { + ifr.raw.Ifru[i] = 0 + } +} + +// TODO(mdlayher): export as IfreqData? For now we can provide helpers such as +// IoctlGetEthtoolDrvinfo which use these APIs under the hood. + +// An ifreqData is an Ifreq which carries pointer data. To produce an ifreqData, +// use the Ifreq.withData method. +type ifreqData struct { + name [IFNAMSIZ]byte + // A type separate from ifreq is required in order to comply with the + // unsafe.Pointer rules since the "pointer-ness" of data would not be + // preserved if it were cast into the byte array of a raw ifreq. + data unsafe.Pointer + // Pad to the same size as ifreq. + _ [len(ifreq{}.Ifru) - SizeofPtr]byte +} + +// withData produces an ifreqData with the pointer p set for ioctls which require +// arbitrary pointer data. +func (ifr Ifreq) withData(p unsafe.Pointer) ifreqData { + return ifreqData{ + name: ifr.raw.Ifrn, + data: p, + } +} diff --git a/vendor/golang.org/x/sys/unix/ioctl.go b/vendor/golang.org/x/sys/unix/ioctl.go index 3559e5dcb2..6c7ad052e6 100644 --- a/vendor/golang.org/x/sys/unix/ioctl.go +++ b/vendor/golang.org/x/sys/unix/ioctl.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix @@ -20,6 +21,15 @@ func IoctlSetInt(fd int, req uint, value int) error { return ioctl(fd, req, uintptr(value)) } +// IoctlSetPointerInt performs an ioctl operation which sets an +// integer value on fd, using the specified request number. The ioctl +// argument is called with a pointer to the integer value, rather than +// passing the integer value directly. +func IoctlSetPointerInt(fd int, req uint, value int) error { + v := int32(value) + return ioctl(fd, req, uintptr(unsafe.Pointer(&v))) +} + // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. // // To change fd's window size, the req argument should be TIOCSWINSZ. diff --git a/vendor/golang.org/x/sys/unix/ioctl_linux.go b/vendor/golang.org/x/sys/unix/ioctl_linux.go new file mode 100644 index 0000000000..1dadead21e --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ioctl_linux.go @@ -0,0 +1,196 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package unix + +import ( + "unsafe" +) + +// IoctlRetInt performs an ioctl operation specified by req on a device +// associated with opened file descriptor fd, and returns a non-negative +// integer that is returned by the ioctl syscall. +func IoctlRetInt(fd int, req uint) (int, error) { + ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0) + if err != 0 { + return 0, err + } + return int(ret), nil +} + +func IoctlGetUint32(fd int, req uint) (uint32, error) { + var value uint32 + err := ioctlPtr(fd, req, unsafe.Pointer(&value)) + return value, err +} + +func IoctlGetRTCTime(fd int) (*RTCTime, error) { + var value RTCTime + err := ioctlPtr(fd, RTC_RD_TIME, unsafe.Pointer(&value)) + return &value, err +} + +func IoctlSetRTCTime(fd int, value *RTCTime) error { + return ioctlPtr(fd, RTC_SET_TIME, unsafe.Pointer(value)) +} + +func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) { + var value RTCWkAlrm + err := ioctlPtr(fd, RTC_WKALM_RD, unsafe.Pointer(&value)) + return &value, err +} + +func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error { + return ioctlPtr(fd, RTC_WKALM_SET, unsafe.Pointer(value)) +} + +// IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network +// device specified by ifname. +func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) { + ifr, err := NewIfreq(ifname) + if err != nil { + return nil, err + } + + value := EthtoolDrvinfo{Cmd: ETHTOOL_GDRVINFO} + ifrd := ifr.withData(unsafe.Pointer(&value)) + + err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd) + return &value, err +} + +// IoctlGetWatchdogInfo fetches information about a watchdog device from the +// Linux watchdog API. For more information, see: +// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. +func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) { + var value WatchdogInfo + err := ioctlPtr(fd, WDIOC_GETSUPPORT, unsafe.Pointer(&value)) + return &value, err +} + +// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For +// more information, see: +// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html. +func IoctlWatchdogKeepalive(fd int) error { + // arg is ignored and not a pointer, so ioctl is fine instead of ioctlPtr. + return ioctl(fd, WDIOC_KEEPALIVE, 0) +} + +// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the +// range of data conveyed in value to the file associated with the file +// descriptor destFd. See the ioctl_ficlonerange(2) man page for details. +func IoctlFileCloneRange(destFd int, value *FileCloneRange) error { + return ioctlPtr(destFd, FICLONERANGE, unsafe.Pointer(value)) +} + +// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file +// associated with the file description srcFd to the file associated with the +// file descriptor destFd. See the ioctl_ficlone(2) man page for details. +func IoctlFileClone(destFd, srcFd int) error { + return ioctl(destFd, FICLONE, uintptr(srcFd)) +} + +type FileDedupeRange struct { + Src_offset uint64 + Src_length uint64 + Reserved1 uint16 + Reserved2 uint32 + Info []FileDedupeRangeInfo +} + +type FileDedupeRangeInfo struct { + Dest_fd int64 + Dest_offset uint64 + Bytes_deduped uint64 + Status int32 + Reserved uint32 +} + +// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the +// range of data conveyed in value from the file associated with the file +// descriptor srcFd to the value.Info destinations. See the +// ioctl_fideduperange(2) man page for details. +func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error { + buf := make([]byte, SizeofRawFileDedupeRange+ + len(value.Info)*SizeofRawFileDedupeRangeInfo) + rawrange := (*RawFileDedupeRange)(unsafe.Pointer(&buf[0])) + rawrange.Src_offset = value.Src_offset + rawrange.Src_length = value.Src_length + rawrange.Dest_count = uint16(len(value.Info)) + rawrange.Reserved1 = value.Reserved1 + rawrange.Reserved2 = value.Reserved2 + + for i := range value.Info { + rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer( + uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) + + uintptr(i*SizeofRawFileDedupeRangeInfo))) + rawinfo.Dest_fd = value.Info[i].Dest_fd + rawinfo.Dest_offset = value.Info[i].Dest_offset + rawinfo.Bytes_deduped = value.Info[i].Bytes_deduped + rawinfo.Status = value.Info[i].Status + rawinfo.Reserved = value.Info[i].Reserved + } + + err := ioctlPtr(srcFd, FIDEDUPERANGE, unsafe.Pointer(&buf[0])) + + // Output + for i := range value.Info { + rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer( + uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) + + uintptr(i*SizeofRawFileDedupeRangeInfo))) + value.Info[i].Dest_fd = rawinfo.Dest_fd + value.Info[i].Dest_offset = rawinfo.Dest_offset + value.Info[i].Bytes_deduped = rawinfo.Bytes_deduped + value.Info[i].Status = rawinfo.Status + value.Info[i].Reserved = rawinfo.Reserved + } + + return err +} + +func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error { + return ioctlPtr(fd, HIDIOCGRDESC, unsafe.Pointer(value)) +} + +func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) { + var value HIDRawDevInfo + err := ioctlPtr(fd, HIDIOCGRAWINFO, unsafe.Pointer(&value)) + return &value, err +} + +func IoctlHIDGetRawName(fd int) (string, error) { + var value [_HIDIOCGRAWNAME_LEN]byte + err := ioctlPtr(fd, _HIDIOCGRAWNAME, unsafe.Pointer(&value[0])) + return ByteSliceToString(value[:]), err +} + +func IoctlHIDGetRawPhys(fd int) (string, error) { + var value [_HIDIOCGRAWPHYS_LEN]byte + err := ioctlPtr(fd, _HIDIOCGRAWPHYS, unsafe.Pointer(&value[0])) + return ByteSliceToString(value[:]), err +} + +func IoctlHIDGetRawUniq(fd int) (string, error) { + var value [_HIDIOCGRAWUNIQ_LEN]byte + err := ioctlPtr(fd, _HIDIOCGRAWUNIQ, unsafe.Pointer(&value[0])) + return ByteSliceToString(value[:]), err +} + +// IoctlIfreq performs an ioctl using an Ifreq structure for input and/or +// output. See the netdevice(7) man page for details. +func IoctlIfreq(fd int, req uint, value *Ifreq) error { + // It is possible we will add more fields to *Ifreq itself later to prevent + // misuse, so pass the raw *ifreq directly. + return ioctlPtr(fd, req, unsafe.Pointer(&value.raw)) +} + +// TODO(mdlayher): export if and when IfreqData is exported. + +// ioctlIfreqData performs an ioctl using an ifreqData structure for input +// and/or output. See the netdevice(7) man page for details. +func ioctlIfreqData(fd int, req uint, value *ifreqData) error { + // The memory layout of IfreqData (type-safe) and ifreq (not type-safe) are + // identical so pass *IfreqData directly. + return ioctlPtr(fd, req, unsafe.Pointer(value)) +} diff --git a/vendor/golang.org/x/sys/unix/ioctl_zos.go b/vendor/golang.org/x/sys/unix/ioctl_zos.go new file mode 100644 index 0000000000..5384e7d91d --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ioctl_zos.go @@ -0,0 +1,74 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "runtime" + "unsafe" +) + +// ioctl itself should not be exposed directly, but additional get/set +// functions for specific types are permissible. + +// IoctlSetInt performs an ioctl operation which sets an integer value +// on fd, using the specified request number. +func IoctlSetInt(fd int, req uint, value int) error { + return ioctl(fd, req, uintptr(value)) +} + +// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument. +// +// To change fd's window size, the req argument should be TIOCSWINSZ. +func IoctlSetWinsize(fd int, req uint, value *Winsize) error { + // TODO: if we get the chance, remove the req parameter and + // hardcode TIOCSWINSZ. + err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) + runtime.KeepAlive(value) + return err +} + +// IoctlSetTermios performs an ioctl on fd with a *Termios. +// +// The req value is expected to be TCSETS, TCSETSW, or TCSETSF +func IoctlSetTermios(fd int, req uint, value *Termios) error { + if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) { + return ENOSYS + } + err := Tcsetattr(fd, int(req), value) + runtime.KeepAlive(value) + return err +} + +// IoctlGetInt performs an ioctl operation which gets an integer value +// from fd, using the specified request number. +// +// A few ioctl requests use the return value as an output parameter; +// for those, IoctlRetInt should be used instead of this function. +func IoctlGetInt(fd int, req uint) (int, error) { + var value int + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return value, err +} + +func IoctlGetWinsize(fd int, req uint) (*Winsize, error) { + var value Winsize + err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) + return &value, err +} + +// IoctlGetTermios performs an ioctl on fd with a *Termios. +// +// The req value is expected to be TCGETS +func IoctlGetTermios(fd int, req uint) (*Termios, error) { + var value Termios + if req != TCGETS { + return &value, ENOSYS + } + err := Tcgetattr(fd, &value) + return &value, err +} diff --git a/vendor/golang.org/x/sys/unix/mkall.sh b/vendor/golang.org/x/sys/unix/mkall.sh index ece31e9dcd..396aadf86d 100644 --- a/vendor/golang.org/x/sys/unix/mkall.sh +++ b/vendor/golang.org/x/sys/unix/mkall.sh @@ -70,29 +70,13 @@ aix_ppc64) mksyscall="go run mksyscall_aix_ppc64.go -aix" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; -darwin_386) - mkerrors="$mkerrors -m32" - mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" - ;; darwin_amd64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h" - mktypes="GOARCH=$GOARCH go tool cgo -godefs" - mkasm="go run mkasm_darwin.go" - ;; -darwin_arm) - mkerrors="$mkerrors" - mksyscall="go run mksyscall.go -l32" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" mkasm="go run mkasm_darwin.go" ;; darwin_arm64) mkerrors="$mkerrors -m64" - mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" mkasm="go run mkasm_darwin.go" ;; @@ -184,6 +168,15 @@ openbsd_arm64) # API consistent across platforms. mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" ;; +openbsd_mips64) + mkerrors="$mkerrors -m64" + mksyscall="go run mksyscall.go -openbsd" + mksysctl="go run mksysctl_openbsd.go" + mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'" + # Let the type of C char be signed for making the bare syscall + # API consistent across platforms. + mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char" + ;; solaris_amd64) mksyscall="go run mksyscall_solaris.go" mkerrors="$mkerrors -m64" @@ -194,7 +187,7 @@ illumos_amd64) mksyscall="go run mksyscall_solaris.go" mkerrors= mksysnum= - mktypes= + mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; *) echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2 @@ -217,8 +210,6 @@ esac # aix/ppc64 script generates files instead of writing to stdin. echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ; elif [ "$GOOS" == "darwin" ]; then - # pre-1.12, direct syscalls - echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos syscall_darwin_${GOARCH}.1_11.go $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go"; # 1.12 and later, syscalls via libSystem echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; # 1.13 and later, syscalls via libSystem (including syscallPtr) diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index 08f8230d6d..a74ef58f8c 100644 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -54,22 +54,28 @@ includes_AIX=' includes_Darwin=' #define _DARWIN_C_SOURCE -#define KERNEL +#define KERNEL 1 #define _DARWIN_USE_64_BIT_INODE +#define __APPLE_USE_RFC_3542 #include #include +#include +#include #include #include #include #include #include +#include #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -77,6 +83,9 @@ includes_Darwin=' #include #include #include + +// for backwards compatibility because moved TIOCREMOTE to Kernel.framework after MacOSX12.0.sdk. +#define TIOCREMOTE 0x80047469 ' includes_DragonFly=' @@ -93,6 +102,7 @@ includes_DragonFly=' #include #include #include +#include #include #include #include @@ -107,8 +117,10 @@ includes_FreeBSD=' #include #include #include +#include #include #include +#include #include #include #include @@ -192,10 +204,14 @@ struct ltchars { #include #include #include +#include +#include #include #include #include +#include #include +#include #include #include #include @@ -204,7 +220,7 @@ struct ltchars { #include #include #include -#include +#include #include #include #include @@ -214,17 +230,22 @@ struct ltchars { #include #include #include +#include #include #include +#include #include +#include #include #include #include #include #include #include +#include #include #include +#include #include #include #include @@ -241,6 +262,7 @@ struct ltchars { #include #include +#include #include #if defined(__sparc__) @@ -288,6 +310,17 @@ struct ltchars { // Including linux/l2tp.h here causes conflicts between linux/in.h // and netinet/in.h included via net/route.h above. #define IPPROTO_L2TP 115 + +// Copied from linux/hid.h. +// Keep in sync with the size of the referenced fields. +#define _HIDIOCGRAWNAME_LEN 128 // sizeof_field(struct hid_device, name) +#define _HIDIOCGRAWPHYS_LEN 64 // sizeof_field(struct hid_device, phys) +#define _HIDIOCGRAWUNIQ_LEN 64 // sizeof_field(struct hid_device, uniq) + +#define _HIDIOCGRAWNAME HIDIOCGRAWNAME(_HIDIOCGRAWNAME_LEN) +#define _HIDIOCGRAWPHYS HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN) +#define _HIDIOCGRAWUNIQ HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN) + ' includes_NetBSD=' @@ -297,6 +330,7 @@ includes_NetBSD=' #include #include #include +#include #include #include #include @@ -325,6 +359,7 @@ includes_OpenBSD=' #include #include #include +#include #include #include #include @@ -365,6 +400,7 @@ includes_SunOS=' #include #include #include +#include #include #include #include @@ -374,10 +410,11 @@ includes_SunOS=' #include #include #include +#include #include -#include #include #include +#include ' @@ -432,6 +469,7 @@ ccflags="$@" $2 !~ /^EPROC_/ && $2 !~ /^EQUIV_/ && $2 !~ /^EXPR_/ && + $2 !~ /^EVIOC/ && $2 ~ /^E[A-Z0-9_]+$/ || $2 ~ /^B[0-9_]+$/ || $2 ~ /^(OLD|NEW)DEV$/ || @@ -463,13 +501,17 @@ ccflags="$@" $2 ~ /^O?XTABS$/ || $2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^IN_/ || + $2 ~ /^LANDLOCK_/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LO_(KEY|NAME)_SIZE$/ || $2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ || - $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || + $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ || + $2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ || + $2 ~ /^NFC_.*_(MAX)?SIZE$/ || + $2 ~ /^RAW_PAYLOAD_/ || $2 ~ /^TP_STATUS_/ || $2 ~ /^FALLOC_/ || - $2 == "ICMPV6_FILTER" || + $2 ~ /^ICMPV?6?_(FILTER|SEC)/ || $2 == "SOMAXCONN" || $2 == "NAME_MAX" || $2 == "IFNAMSIZ" || @@ -489,6 +531,7 @@ ccflags="$@" $2 !~ "NLA_TYPE_MASK" && $2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ && $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ || + $2 ~ /^FIORDCHK$/ || $2 ~ /^SIOC/ || $2 ~ /^TIOC/ || $2 ~ /^TCGET/ || @@ -507,17 +550,23 @@ ccflags="$@" $2 ~ /^(CLOCK|TIMER)_/ || $2 ~ /^CAN_/ || $2 ~ /^CAP_/ || + $2 ~ /^CP_/ || + $2 ~ /^CPUSTATES$/ || + $2 ~ /^CTLIOCGINFO$/ || $2 ~ /^ALG_/ || + $2 ~ /^FI(CLONE|DEDUPERANGE)/ || $2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE)/ || $2 ~ /^FS_IOC_.*(ENCRYPTION|VERITY|[GS]ETFLAGS)/ || $2 ~ /^FS_VERITY_/ || $2 ~ /^FSCRYPT_/ || + $2 ~ /^DM_/ || $2 ~ /^GRND_/ || $2 ~ /^RND/ || $2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ || $2 ~ /^KEYCTL_/ || - $2 ~ /^PERF_EVENT_IOC_/ || + $2 ~ /^PERF_/ || $2 ~ /^SECCOMP_MODE_/ || + $2 ~ /^SEEK_/ || $2 ~ /^SPLICE_/ || $2 ~ /^SYNC_FILE_RANGE_/ || $2 !~ /^AUDIT_RECORD_MAGIC/ && @@ -535,18 +584,27 @@ ccflags="$@" $2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ || $2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ || $2 ~ /^FSOPT_/ || - $2 ~ /^WDIOC_/ || + $2 ~ /^WDIO[CFS]_/ || $2 ~ /^NFN/ || $2 ~ /^XDP_/ || $2 ~ /^RWF_/ || $2 ~ /^(HDIO|WIN|SMART)_/ || $2 ~ /^CRYPTO_/ || $2 ~ /^TIPC_/ || + $2 !~ "DEVLINK_RELOAD_LIMITS_VALID_MASK" && $2 ~ /^DEVLINK_/ || + $2 ~ /^ETHTOOL_/ || + $2 ~ /^LWTUNNEL_IP/ || $2 !~ "WMESGLEN" && $2 ~ /^W[A-Z0-9]+$/ || $2 ~/^PPPIOC/ || $2 ~ /^FAN_|FANOTIFY_/ || + $2 == "HID_MAX_DESCRIPTOR_SIZE" || + $2 ~ /^_?HIDIOC/ || + $2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ || + $2 ~ /^MTD/ || + $2 ~ /^OTP/ || + $2 ~ /^MEM/ || $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^__WCOREFLAG$/ {next} $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)} @@ -584,6 +642,7 @@ echo '#include ' | $CC -x c - -E -dM $ccflags | echo '// mkerrors.sh' "$@" echo '// Code generated by the command above; see README.md. DO NOT EDIT.' echo +echo "//go:build ${GOARCH} && ${GOOS}" echo "// +build ${GOARCH},${GOOS}" echo go tool cgo -godefs -- "$@" _const.go >_error.out diff --git a/vendor/golang.org/x/sys/unix/pagesize_unix.go b/vendor/golang.org/x/sys/unix/pagesize_unix.go index bc2f3629a7..53f1b4c5b8 100644 --- a/vendor/golang.org/x/sys/unix/pagesize_unix.go +++ b/vendor/golang.org/x/sys/unix/pagesize_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris // For Unix, get the pagesize from the runtime. diff --git a/vendor/golang.org/x/sys/unix/ptrace_darwin.go b/vendor/golang.org/x/sys/unix/ptrace_darwin.go new file mode 100644 index 0000000000..463c3eff7f --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ptrace_darwin.go @@ -0,0 +1,12 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin && !ios +// +build darwin,!ios + +package unix + +func ptrace(request int, pid int, addr uintptr, data uintptr) error { + return ptrace1(request, pid, addr, data) +} diff --git a/vendor/golang.org/x/sys/unix/ptrace_ios.go b/vendor/golang.org/x/sys/unix/ptrace_ios.go new file mode 100644 index 0000000000..ed0509a011 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ptrace_ios.go @@ -0,0 +1,12 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build ios +// +build ios + +package unix + +func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { + return ENOTSUP +} diff --git a/vendor/golang.org/x/sys/unix/race.go b/vendor/golang.org/x/sys/unix/race.go index 61712b51c9..6f6c5fec5a 100644 --- a/vendor/golang.org/x/sys/unix/race.go +++ b/vendor/golang.org/x/sys/unix/race.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (darwin && race) || (linux && race) || (freebsd && race) // +build darwin,race linux,race freebsd,race package unix diff --git a/vendor/golang.org/x/sys/unix/race0.go b/vendor/golang.org/x/sys/unix/race0.go index ad026678c7..706e1322ae 100644 --- a/vendor/golang.org/x/sys/unix/race0.go +++ b/vendor/golang.org/x/sys/unix/race0.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly +//go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos +// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos package unix diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdents.go b/vendor/golang.org/x/sys/unix/readdirent_getdents.go index 3a90aa6dfa..4d6257569e 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdents.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdents.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd // +build aix dragonfly freebsd linux netbsd openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go index 5fdae40b3a..2a4ba47c45 100644 --- a/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go +++ b/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin // +build darwin package unix diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go index 003916ed7a..453a942c5d 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Socket control messages diff --git a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go index 7d08dae5ba..0840fe4a57 100644 --- a/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go +++ b/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin freebsd linux netbsd openbsd solaris +//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin freebsd linux netbsd openbsd solaris zos package unix @@ -20,7 +21,7 @@ func cmsgAlignOf(salen int) int { case "aix": // There is no alignment on AIX. salign = 1 - case "darwin", "illumos", "solaris": + case "darwin", "ios", "illumos", "solaris": // NOTE: It seems like 64-bit Darwin, Illumos and Solaris // kernels still require 32-bit aligned access to network // subsystem. @@ -32,6 +33,14 @@ func cmsgAlignOf(salen int) int { if runtime.GOARCH == "arm" { salign = 8 } + // NetBSD aarch64 requires 128-bit alignment. + if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" { + salign = 16 + } + case "zos": + // z/OS socket macros use [32-bit] sizeof(int) alignment, + // not pointer width. + salign = SizeofInt } return (salen + salign - 1) & ^(salign - 1) diff --git a/vendor/golang.org/x/sys/unix/str.go b/vendor/golang.org/x/sys/unix/str.go index 17fb698683..8ba89ed869 100644 --- a/vendor/golang.org/x/sys/unix/str.go +++ b/vendor/golang.org/x/sys/unix/str.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix diff --git a/vendor/golang.org/x/sys/unix/syscall.go b/vendor/golang.org/x/sys/unix/syscall.go index fd4ee8ebeb..649fa87405 100644 --- a/vendor/golang.org/x/sys/unix/syscall.go +++ b/vendor/golang.org/x/sys/unix/syscall.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos // Package unix contains an interface to the low-level operating system // primitives. OS details vary depending on the underlying system, and @@ -24,7 +25,13 @@ // holds a value of type syscall.Errno. package unix // import "golang.org/x/sys/unix" -import "strings" +import ( + "bytes" + "strings" + "unsafe" + + "golang.org/x/sys/internal/unsafeheader" +) // ByteSliceFromString returns a NUL-terminated slice of bytes // containing the text of s. If s contains a NUL byte at any @@ -49,5 +56,40 @@ func BytePtrFromString(s string) (*byte, error) { return &a[0], nil } +// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any +// bytes after the NUL removed. +func ByteSliceToString(s []byte) string { + if i := bytes.IndexByte(s, 0); i != -1 { + s = s[:i] + } + return string(s) +} + +// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string. +// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated +// at a zero byte; if the zero byte is not present, the program may crash. +func BytePtrToString(p *byte) string { + if p == nil { + return "" + } + if *p == 0 { + return "" + } + + // Find NUL terminator. + n := 0 + for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ { + ptr = unsafe.Pointer(uintptr(ptr) + 1) + } + + var s []byte + h := (*unsafeheader.Slice)(unsafe.Pointer(&s)) + h.Data = unsafe.Pointer(p) + h.Len = n + h.Cap = n + + return string(s) +} + // Single-word zero for use when we need a valid pointer to 0 bytes. var _zero uintptr diff --git a/vendor/golang.org/x/sys/unix/syscall_aix.go b/vendor/golang.org/x/sys/unix/syscall_aix.go index 9ad8a0d4a5..d8efb715ff 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix // +build aix // Aix system calls. @@ -19,6 +20,22 @@ import "unsafe" * Wrapped */ +func Access(path string, mode uint32) (err error) { + return Faccessat(AT_FDCWD, path, mode, 0) +} + +func Chmod(path string, mode uint32) (err error) { + return Fchmodat(AT_FDCWD, path, mode, 0) +} + +func Chown(path string, uid int, gid int) (err error) { + return Fchownat(AT_FDCWD, path, uid, gid, 0) +} + +func Creat(path string, mode uint32) (fd int, err error) { + return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode) +} + //sys utimes(path string, times *[2]Timeval) (err error) func Utimes(path string, tv []Timeval) error { if len(tv) != 2 { @@ -235,7 +252,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } } - bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] + bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] sa.Name = string(bytes) return sa, nil @@ -403,8 +420,8 @@ func (w WaitStatus) TrapCause() int { return -1 } //sys Mknod(path string, mode uint32, dev int) (err error) //sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error) //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) -//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64 -//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) +//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64 +//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) //sys read(fd int, p []byte) (n int, err error) //sys Readlink(path string, buf []byte) (n int, err error) //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) @@ -423,8 +440,8 @@ func (w WaitStatus) TrapCause() int { return -1 } //sysnb Times(tms *Tms) (ticks uintptr, err error) //sysnb Umask(mask int) (oldmask int) //sysnb Uname(buf *Utsname) (err error) -//sys Unlink(path string) (err error) -//sys Unlinkat(dirfd int, path string, flags int) (err error) +//sys Unlink(path string) (err error) +//sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Ustat(dev int, ubuf *Ustat_t) (err error) //sys write(fd int, p []byte) (n int, err error) //sys readlen(fd int, p *byte, np int) (n int, err error) = read @@ -498,7 +515,7 @@ func Munmap(b []byte) (err error) { //sys Munlock(b []byte) (err error) //sys Munlockall() (err error) -//sysnb pipe(p *[2]_C_int) (err error) +//sysnb pipe(p *[2]_C_int) (err error) func Pipe(p []int) (err error) { if len(p) != 2 { diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go index b3c8e3301c..e92a0be163 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix -// +build ppc +//go:build aix && ppc +// +build aix,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go index 9a6e024179..16eed17098 100644 --- a/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix -// +build ppc64 +//go:build aix && ppc64 +// +build aix,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_bsd.go b/vendor/golang.org/x/sys/unix/syscall_bsd.go index 68605db624..95ac3946b5 100644 --- a/vendor/golang.org/x/sys/unix/syscall_bsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin || dragonfly || freebsd || netbsd || openbsd // +build darwin dragonfly freebsd netbsd openbsd // BSD system call wrappers shared by *BSD based systems @@ -18,6 +19,21 @@ import ( "unsafe" ) +const ImplementsGetwd = true + +func Getwd() (string, error) { + var buf [PathMax]byte + _, err := Getcwd(buf[0:]) + if err != nil { + return "", err + } + n := clen(buf[:]) + if n < 1 { + return "", EINVAL + } + return string(buf[:n]), nil +} + /* * Wrapped */ @@ -262,7 +278,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } return sa, nil } - return nil, EAFNOSUPPORT + return anyToSockaddrGOOS(fd, rsa) } func Accept(fd int) (nfd int, sa Sockaddr, err error) { @@ -272,7 +288,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) { if err != nil { return } - if runtime.GOOS == "darwin" && len == 0 { + if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && len == 0 { // Accepted socket has no address. // This is likely due to a bug in xnu kernels, // where instead of ECONNABORTED error socket @@ -303,7 +319,7 @@ func Getsockname(fd int) (sa Sockaddr, err error) { return anyToSockaddr(fd, &rsa) } -//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) +//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) // GetsockoptString returns the string value of the socket option opt for the // socket associated with fd at the given socket level. @@ -317,8 +333,8 @@ func GetsockoptString(fd, level, opt int) (string, error) { return string(buf[:vallen-1]), nil } -//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) -//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) +//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) +//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { @@ -527,6 +543,23 @@ func SysctlClockinfo(name string) (*Clockinfo, error) { return &ci, nil } +func SysctlTimeval(name string) (*Timeval, error) { + mib, err := sysctlmib(name) + if err != nil { + return nil, err + } + + var tv Timeval + n := uintptr(unsafe.Sizeof(tv)) + if err := sysctl(mib, (*byte)(unsafe.Pointer(&tv)), &n, nil, 0); err != nil { + return nil, err + } + if n != unsafe.Sizeof(tv) { + return nil, EIO + } + return &tv, nil +} + //sys utimes(path string, timeval *[2]Timeval) (err error) func Utimes(path string, tv []Timeval) error { @@ -594,7 +627,7 @@ func Futimes(fd int, tv []Timeval) error { return futimes(fd, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) +//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) func Poll(fds []PollFd, timeout int) (n int, err error) { if len(fds) == 0 { diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go b/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go index 6a15cba611..b0098607c7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin && go1.12 && !go1.13 // +build darwin,go1.12,!go1.13 package unix @@ -10,6 +11,8 @@ import ( "unsafe" ) +const _SYS_GETDIRENTRIES64 = 344 + func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { // To implement this using libSystem we'd need syscall_syscallPtr for // fdopendir. However, syscallPtr was only added in Go 1.13, so we fall @@ -20,7 +23,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { } else { p = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) + r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) n = int(r0) if e1 != 0 { return n, errnoErr(e1) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go b/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go index dc0befee37..1596426b1e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin && go1.13 // +build darwin,go1.13 package unix @@ -16,7 +17,7 @@ import ( //sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) func fdopendir(fd int) (dir uintptr, err error) { - r0, _, e1 := syscall_syscallPtr(funcPC(libc_fdopendir_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscallPtr(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0) dir = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -24,9 +25,8 @@ func fdopendir(fd int) (dir uintptr, err error) { return } -func libc_fdopendir_trampoline() +var libc_fdopendir_trampoline_addr uintptr -//go:linkname libc_fdopendir libc_fdopendir //go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib" func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 0cf31acf02..a8c13317d7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -13,29 +13,12 @@ package unix import ( - "errors" + "fmt" + "runtime" "syscall" "unsafe" ) -const ImplementsGetwd = true - -func Getwd() (string, error) { - buf := make([]byte, 2048) - attrs, err := getAttrList(".", attrList{CommonAttr: attrCmnFullpath}, buf, 0) - if err == nil && len(attrs) == 1 && len(attrs[0]) >= 2 { - wd := string(attrs[0]) - // Sanity check that it's an absolute path and ends - // in a null byte, which we then strip. - if wd[0] == '/' && wd[len(wd)-1] == 0 { - return wd[:len(wd)-1], nil - } - } - // If pkg/os/getwd.go gets ENOTSUP, it will fall back to the - // slow algorithm. - return "", ENOTSUP -} - // SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 @@ -49,6 +32,72 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } +// SockaddrCtl implements the Sockaddr interface for AF_SYSTEM type sockets. +type SockaddrCtl struct { + ID uint32 + Unit uint32 + raw RawSockaddrCtl +} + +func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Sc_len = SizeofSockaddrCtl + sa.raw.Sc_family = AF_SYSTEM + sa.raw.Ss_sysaddr = AF_SYS_CONTROL + sa.raw.Sc_id = sa.ID + sa.raw.Sc_unit = sa.Unit + return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil +} + +// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets. +// SockaddrVM provides access to Darwin VM sockets: a mechanism that enables +// bidirectional communication between a hypervisor and its guest virtual +// machines. +type SockaddrVM struct { + // CID and Port specify a context ID and port address for a VM socket. + // Guests have a unique CID, and hosts may have a well-known CID of: + // - VMADDR_CID_HYPERVISOR: refers to the hypervisor process. + // - VMADDR_CID_LOCAL: refers to local communication (loopback). + // - VMADDR_CID_HOST: refers to other processes on the host. + CID uint32 + Port uint32 + raw RawSockaddrVM +} + +func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Len = SizeofSockaddrVM + sa.raw.Family = AF_VSOCK + sa.raw.Port = sa.Port + sa.raw.Cid = sa.CID + + return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil +} + +func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { + switch rsa.Addr.Family { + case AF_SYSTEM: + pp := (*RawSockaddrCtl)(unsafe.Pointer(rsa)) + if pp.Ss_sysaddr == AF_SYS_CONTROL { + sa := new(SockaddrCtl) + sa.ID = pp.Sc_id + sa.Unit = pp.Sc_unit + return sa, nil + } + case AF_VSOCK: + pp := (*RawSockaddrVM)(unsafe.Pointer(rsa)) + sa := &SockaddrVM{ + CID: pp.Cid, + Port: pp.Port, + } + return sa, nil + } + return nil, EAFNOSUPPORT +} + +// Some external packages rely on SYS___SYSCTL being defined to implement their +// own sysctl wrappers. Provide it here, even though direct syscalls are no +// longer supported on darwin. +const SYS___SYSCTL = SYS_SYSCTL + // Translate "kern.hostname" to []_C_int{0,1,2,3}. func nametomib(name string) (mib []_C_int, err error) { const siz = unsafe.Sizeof(mib[0]) @@ -92,11 +141,6 @@ func direntNamlen(buf []byte) (uint64, bool) { func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) } func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) } -const ( - attrBitMapCount = 5 - attrCmnFullpath = 0x08000000 -) - type attrList struct { bitmapCount uint16 _ uint16 @@ -107,61 +151,16 @@ type attrList struct { Forkattr uint32 } -func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (attrs [][]byte, err error) { - if len(attrBuf) < 4 { - return nil, errors.New("attrBuf too small") - } - attrList.bitmapCount = attrBitMapCount - - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return nil, err - } - - if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil { - return nil, err - } - size := *(*uint32)(unsafe.Pointer(&attrBuf[0])) - - // dat is the section of attrBuf that contains valid data, - // without the 4 byte length header. All attribute offsets - // are relative to dat. - dat := attrBuf - if int(size) < len(attrBuf) { - dat = dat[:size] - } - dat = dat[4:] // remove length prefix - - for i := uint32(0); int(i) < len(dat); { - header := dat[i:] - if len(header) < 8 { - return attrs, errors.New("truncated attribute header") - } - datOff := *(*int32)(unsafe.Pointer(&header[0])) - attrLen := *(*uint32)(unsafe.Pointer(&header[4])) - if datOff < 0 || uint32(datOff)+attrLen > uint32(len(dat)) { - return attrs, errors.New("truncated results; attrBuf too small") - } - end := uint32(datOff) + attrLen - attrs = append(attrs, dat[datOff:end]) - i = end - if r := i % 4; r != 0 { - i += (4 - r) - } - } - return -} - -//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) - -//sysnb pipe() (r int, w int, err error) +//sysnb pipe(p *[2]int32) (err error) func Pipe(p []int) (err error) { if len(p) != 2 { return EINVAL } - p[0], p[1], err = pipe() + var x [2]int32 + err = pipe(&x) + p[0] = int(x[0]) + p[1] = int(x[1]) return } @@ -305,7 +304,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { options) } -//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) +//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error { // Darwin doesn't support SYS_UTIMENSAT @@ -324,7 +323,36 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig //sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL +func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error { + err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo))) + runtime.KeepAlive(ctlInfo) + return err +} + +// IfreqMTU is struct ifreq used to get or set a network device's MTU. +type IfreqMTU struct { + Name [IFNAMSIZ]byte + MTU int32 +} + +// IoctlGetIfreqMTU performs the SIOCGIFMTU ioctl operation on fd to get the MTU +// of the network device specified by ifname. +func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) { + var ifreq IfreqMTU + copy(ifreq.Name[:], ifname) + err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq))) + return &ifreq, err +} + +// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU +// of the network device specified by ifreq.Name. +func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error { + err := ioctl(fd, SIOCSIFMTU, uintptr(unsafe.Pointer(ifreq))) + runtime.KeepAlive(ifreq) + return err +} + +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL func Uname(uname *Utsname) error { mib := []_C_int{CTL_KERN, KERN_OSTYPE} @@ -382,8 +410,65 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e return } +func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) { + var value IPMreqn + vallen := _Socklen(SizeofIPMreqn) + errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, errno +} + +func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) +} + +// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct. +// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively. +func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { + x := new(Xucred) + vallen := _Socklen(SizeofXucred) + err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen) + return x, err +} + +func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) { + mib, err := sysctlmib(name) + if err != nil { + return nil, err + } + + // Find size. + n := uintptr(0) + if err := sysctl(mib, nil, &n, nil, 0); err != nil { + return nil, err + } + if n == 0 { + return nil, nil + } + if n%SizeofKinfoProc != 0 { + return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) + } + + // Read into buffer of that size. + buf := make([]KinfoProc, n/SizeofKinfoProc) + if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil { + return nil, err + } + if n%SizeofKinfoProc != 0 { + return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc) + } + + // The actual call may return less than the original reported required + // size so ensure we deal with that. + return buf[:n/SizeofKinfoProc], nil +} + //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) +//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) +//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) +//sys shmdt(addr uintptr) (err error) +//sys shmget(key int, size int, flag int) (id int, err error) + /* * Exposed directly */ @@ -396,6 +481,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Chroot(path string) (err error) //sys ClockGettime(clockid int32, time *Timespec) (err error) //sys Close(fd int) (err error) +//sys Clonefile(src string, dst string, flags int) (err error) +//sys Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) //sys Dup(fd int) (nfd int, err error) //sys Dup2(from int, to int) (err error) //sys Exchangedata(path1 string, path2 string, options int) (err error) @@ -407,10 +494,12 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) +//sys Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) //sys Flock(fd int, how int) (err error) //sys Fpathconf(fd int, name int) (val int, err error) //sys Fsync(fd int) (err error) //sys Ftruncate(fd int, length int64) (err error) +//sys Getcwd(buf []byte) (n int, err error) //sys Getdtablesize() (size int) //sysnb Getegid() (egid int) //sysnb Geteuid() (uid int) @@ -472,8 +561,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) -//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) -//sys munmap(addr uintptr, length uintptr) (err error) +//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) +//sys munmap(addr uintptr, length uintptr) (err error) //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE @@ -537,10 +626,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e // Msgget // Msgsnd // Msgrcv -// Shmat -// Shmctl -// Shmdt -// Shmget // Shm_open // Shm_unlink // Sem_open diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go b/vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go deleted file mode 100644 index 6b223f91a5..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin,386,!go1.12 - -package unix - -//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go b/vendor/golang.org/x/sys/unix/syscall_darwin_386.go deleted file mode 100644 index 2724e3a512..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_386.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build 386,darwin - -package unix - -import ( - "syscall" -) - -//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: int32(sec), Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: int32(sec), Usec: int32(usec)} -} - -func SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint32(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint32(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (msghdr *Msghdr) SetIovlen(length int) { - msghdr.Iovlen = int32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} - -func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) - -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/386 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL - -//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 -//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 -//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 -//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 -//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 -//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 -//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go deleted file mode 100644 index 68ebd6fab2..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin,amd64,!go1.12 - -package unix - -//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go index ce2e0d2497..b37310ce9b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go @@ -2,15 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && darwin // +build amd64,darwin package unix -import ( - "syscall" -) - -//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) +import "syscall" func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: nsec} @@ -44,14 +41,11 @@ func (cmsg *Cmsghdr) SetLen(length int) { func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/amd64 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL - //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 //sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64 //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64 //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 +//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace //sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 //sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64 diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go deleted file mode 100644 index fc17a3f232..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package unix - -import ( - "syscall" -) - -func ptrace(request int, pid int, addr uintptr, data uintptr) error { - return ENOTSUP -} - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: int32(sec), Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: int32(sec), Usec: int32(usec)} -} - -func SetKevent(k *Kevent_t, fd, mode, flags int) { - k.Ident = uint32(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) -} - -func (iov *Iovec) SetLen(length int) { - iov.Len = uint32(length) -} - -func (msghdr *Msghdr) SetControllen(length int) { - msghdr.Controllen = uint32(length) -} - -func (msghdr *Msghdr) SetIovlen(length int) { - msghdr.Iovlen = int32(length) -} - -func (cmsg *Cmsghdr) SetLen(length int) { - cmsg.Len = uint32(length) -} - -func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic - -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/arm the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL - -//sys Fstat(fd int, stat *Stat_t) (err error) -//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) -//sys Fstatfs(fd int, stat *Statfs_t) (err error) -//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT -//sys Lstat(path string, stat *Stat_t) (err error) -//sys Stat(path string, stat *Stat_t) (err error) -//sys Statfs(path string, stat *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go deleted file mode 100644 index 01d450406b..0000000000 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build darwin,arm64,!go1.12 - -package unix - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - return 0, ENOSYS -} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go index 1e91ddf325..d51ec99630 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go @@ -2,17 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && darwin // +build arm64,darwin package unix -import ( - "syscall" -) - -func ptrace(request int, pid int, addr uintptr, data uintptr) error { - return ENOTSUP -} +import "syscall" func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: nsec} @@ -46,14 +41,11 @@ func (cmsg *Cmsghdr) SetLen(length int) { func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic -// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions -// of darwin/arm64 the syscall is called sysctl instead of __sysctl. -const SYS___SYSCTL = SYS_SYSCTL - //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) //sys Fstatfs(fd int, stat *Statfs_t) (err error) //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT //sys Lstat(path string, stat *Stat_t) (err error) +//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace //sys Stat(path string, stat *Stat_t) (err error) //sys Statfs(path string, stat *Statfs_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go index f34c86c899..53c96641f8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build darwin && go1.12 // +build darwin,go1.12 package unix -import "unsafe" +import _ "unsafe" // Implemented in the runtime package (runtime/sys_darwin.go) func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) @@ -24,10 +25,3 @@ func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) //go:linkname syscall_rawSyscall syscall.rawSyscall //go:linkname syscall_rawSyscall6 syscall.rawSyscall6 //go:linkname syscall_syscallPtr syscall.syscallPtr - -// Find the entry point for f. See comments in runtime/proc.go for the -// function of the same name. -//go:nosplit -func funcPC(f func()) uintptr { - return **(**uintptr)(unsafe.Pointer(&f)) -} diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 8a195ae586..5af108a503 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -47,6 +47,10 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } +func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { + return nil, EAFNOSUPPORT +} + // Translate "kern.hostname" to []_C_int{0,1,2,3}. func nametomib(name string) (mib []_C_int, err error) { const siz = unsafe.Sizeof(mib[0]) @@ -91,7 +95,7 @@ func direntNamlen(buf []byte) (uint64, bool) { return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) } -//sysnb pipe() (r int, w int, err error) +//sysnb pipe() (r int, w int, err error) func Pipe(p []int) (err error) { if len(p) != 2 { @@ -101,6 +105,19 @@ func Pipe(p []int) (err error) { return } +//sysnb pipe2(p *[2]_C_int, flags int) (r int, w int, err error) + +func Pipe2(p []int, flags int) (err error) { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + // pipe2 on dragonfly takes an fds array as an argument, but still + // returns the file descriptors. + p[0], p[1], err = pipe2(&pp, flags) + return err +} + //sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error) func Pread(fd int, p []byte, offset int64) (n int, err error) { return extpread(fd, p, 0, offset) @@ -129,23 +146,8 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { return } -const ImplementsGetwd = true - //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD -func Getwd() (string, error) { - var buf [PathMax]byte - _, err := Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} - func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { var _p0 unsafe.Pointer var bufsize uintptr @@ -168,7 +170,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { //sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL func sysctlUname(mib []_C_int, old *byte, oldlen *uintptr) error { err := sysctl(mib, old, oldlen, nil, 0) @@ -335,8 +337,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) -//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) -//sys munmap(addr uintptr, length uintptr) (err error) +//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) +//sys munmap(addr uintptr, length uintptr) (err error) //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go index a6b4830ac8..4e2d32120a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && dragonfly // +build amd64,dragonfly package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 6932e7c2c1..18c392cf36 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -54,6 +54,10 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } +func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { + return nil, EAFNOSUPPORT +} + // Translate "kern.hostname" to []_C_int{0,1,2,3}. func nametomib(name string) (mib []_C_int, err error) { const siz = unsafe.Sizeof(mib[0]) @@ -122,6 +126,15 @@ func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) { return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq)) } +// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct. +// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively. +func GetsockoptXucred(fd, level, opt int) (*Xucred, error) { + x := new(Xucred) + vallen := _Socklen(SizeofXucred) + err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen) + return x, err +} + func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny @@ -140,23 +153,8 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) { return } -const ImplementsGetwd = true - //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD -func Getwd() (string, error) { - var buf [PathMax]byte - _, err := Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} - func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { var ( _p0 unsafe.Pointer @@ -199,9 +197,9 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { return ENOSYS } -//sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL func Uname(uname *Utsname) error { mib := []_C_int{CTL_KERN, KERN_OSTYPE} @@ -676,8 +674,8 @@ func PtraceSingleStep(pid int) (err error) { //sys Unlinkat(dirfd int, path string, flags int) (err error) //sys Unmount(path string, flags int) (err error) //sys write(fd int, p []byte) (n int, err error) -//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) -//sys munmap(addr uintptr, length uintptr) (err error) +//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) +//sys munmap(addr uintptr, length uintptr) (err error) //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go index 72a506ddcb..342fc32b16 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 && freebsd // +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go index d5e376acae..a32d5aa4ae 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && freebsd // +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go index 4ea45bce52..1e36d39abe 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && freebsd // +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go index aa5326db19..a09a1537bd 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && freebsd // +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_illumos.go b/vendor/golang.org/x/sys/unix/syscall_illumos.go index 99e62dcd82..8d5f294c42 100644 --- a/vendor/golang.org/x/sys/unix/syscall_illumos.go +++ b/vendor/golang.org/x/sys/unix/syscall_illumos.go @@ -1,14 +1,19 @@ -// Copyright 2009 The Go Authors. All rights reserved. +// Copyright 2021 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // illumos system calls not present on Solaris. +//go:build amd64 && illumos // +build amd64,illumos package unix -import "unsafe" +import ( + "fmt" + "runtime" + "unsafe" +) func bytes2iovec(bs [][]byte) []Iovec { iovecs := make([]Iovec, len(bs)) @@ -24,7 +29,7 @@ func bytes2iovec(bs [][]byte) []Iovec { return iovecs } -//sys readv(fd int, iovs []Iovec) (n int, err error) +//sys readv(fd int, iovs []Iovec) (n int, err error) func Readv(fd int, iovs [][]byte) (n int, err error) { iovecs := bytes2iovec(iovs) @@ -32,7 +37,7 @@ func Readv(fd int, iovs [][]byte) (n int, err error) { return n, err } -//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error) +//sys preadv(fd int, iovs []Iovec, off int64) (n int, err error) func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) { iovecs := bytes2iovec(iovs) @@ -40,7 +45,7 @@ func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) { return n, err } -//sys writev(fd int, iovs []Iovec) (n int, err error) +//sys writev(fd int, iovs []Iovec) (n int, err error) func Writev(fd int, iovs [][]byte) (n int, err error) { iovecs := bytes2iovec(iovs) @@ -48,10 +53,134 @@ func Writev(fd int, iovs [][]byte) (n int, err error) { return n, err } -//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error) +//sys pwritev(fd int, iovs []Iovec, off int64) (n int, err error) func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) { iovecs := bytes2iovec(iovs) n, err = pwritev(fd, iovecs, off) return n, err } + +//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) = libsocket.accept4 + +func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + nfd, err = accept4(fd, &rsa, &len, flags) + if err != nil { + return + } + if len > SizeofSockaddrAny { + panic("RawSockaddrAny too small") + } + sa, err = anyToSockaddr(fd, &rsa) + if err != nil { + Close(nfd) + nfd = 0 + } + return +} + +//sys putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) + +func Putmsg(fd int, cl []byte, data []byte, flags int) (err error) { + var clp, datap *strbuf + if len(cl) > 0 { + clp = &strbuf{ + Len: int32(len(cl)), + Buf: (*int8)(unsafe.Pointer(&cl[0])), + } + } + if len(data) > 0 { + datap = &strbuf{ + Len: int32(len(data)), + Buf: (*int8)(unsafe.Pointer(&data[0])), + } + } + return putmsg(fd, clp, datap, flags) +} + +//sys getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) + +func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags int, err error) { + var clp, datap *strbuf + if len(cl) > 0 { + clp = &strbuf{ + Maxlen: int32(len(cl)), + Buf: (*int8)(unsafe.Pointer(&cl[0])), + } + } + if len(data) > 0 { + datap = &strbuf{ + Maxlen: int32(len(data)), + Buf: (*int8)(unsafe.Pointer(&data[0])), + } + } + + if err = getmsg(fd, clp, datap, &flags); err != nil { + return nil, nil, 0, err + } + + if len(cl) > 0 { + retCl = cl[:clp.Len] + } + if len(data) > 0 { + retData = data[:datap.Len] + } + return retCl, retData, flags, nil +} + +func IoctlSetIntRetInt(fd int, req uint, arg int) (int, error) { + return ioctlRet(fd, req, uintptr(arg)) +} + +func IoctlSetString(fd int, req uint, val string) error { + bs := make([]byte, len(val)+1) + copy(bs[:len(bs)-1], val) + err := ioctl(fd, req, uintptr(unsafe.Pointer(&bs[0]))) + runtime.KeepAlive(&bs[0]) + return err +} + +// Lifreq Helpers + +func (l *Lifreq) SetName(name string) error { + if len(name) >= len(l.Name) { + return fmt.Errorf("name cannot be more than %d characters", len(l.Name)-1) + } + for i := range name { + l.Name[i] = int8(name[i]) + } + return nil +} + +func (l *Lifreq) SetLifruInt(d int) { + *(*int)(unsafe.Pointer(&l.Lifru[0])) = d +} + +func (l *Lifreq) GetLifruInt() int { + return *(*int)(unsafe.Pointer(&l.Lifru[0])) +} + +func (l *Lifreq) SetLifruUint(d uint) { + *(*uint)(unsafe.Pointer(&l.Lifru[0])) = d +} + +func (l *Lifreq) GetLifruUint() uint { + return *(*uint)(unsafe.Pointer(&l.Lifru[0])) +} + +func IoctlLifreq(fd int, req uint, l *Lifreq) error { + return ioctl(fd, req, uintptr(unsafe.Pointer(l))) +} + +// Strioctl Helpers + +func (s *Strioctl) SetInt(i int) { + s.Len = int32(unsafe.Sizeof(i)) + s.Dp = (*int8)(unsafe.Pointer(&i)) +} + +func IoctlSetStrioctlRetInt(fd int, req uint, s *Strioctl) (int, error) { + return ioctlRet(fd, req, uintptr(unsafe.Pointer(s))) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index e50e4cb276..fff38a84c9 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -13,7 +13,6 @@ package unix import ( "encoding/binary" - "runtime" "syscall" "unsafe" ) @@ -38,6 +37,13 @@ func Creat(path string, mode uint32) (fd int, err error) { return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode) } +func EpollCreate(size int) (fd int, err error) { + if size <= 0 { + return -1, EINVAL + } + return EpollCreate1(0) +} + //sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error) //sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) @@ -66,60 +72,22 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { return fchmodat(dirfd, path, mode) } -//sys ioctl(fd int, req uint, arg uintptr) (err error) - -// ioctl itself should not be exposed directly, but additional get/set -// functions for specific types are permissible. - -// IoctlRetInt performs an ioctl operation specified by req on a device -// associated with opened file descriptor fd, and returns a non-negative -// integer that is returned by the ioctl syscall. -func IoctlRetInt(fd int, req uint) (int, error) { - ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0) - if err != 0 { - return 0, err - } - return int(ret), nil +func InotifyInit() (fd int, err error) { + return InotifyInit1(0) } -// IoctlSetPointerInt performs an ioctl operation which sets an -// integer value on fd, using the specified request number. The ioctl -// argument is called with a pointer to the integer value, rather than -// passing the integer value directly. -func IoctlSetPointerInt(fd int, req uint, value int) error { - v := int32(value) - return ioctl(fd, req, uintptr(unsafe.Pointer(&v))) -} +//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL +//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL -func IoctlSetRTCTime(fd int, value *RTCTime) error { - err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err -} - -func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error { - err := ioctl(fd, RTC_WKALM_SET, uintptr(unsafe.Pointer(value))) - runtime.KeepAlive(value) - return err -} - -func IoctlGetUint32(fd int, req uint) (uint32, error) { - var value uint32 - err := ioctl(fd, req, uintptr(unsafe.Pointer(&value))) - return value, err -} - -func IoctlGetRTCTime(fd int) (*RTCTime, error) { - var value RTCTime - err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value))) - return &value, err -} - -func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) { - var value RTCWkAlrm - err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value))) - return &value, err -} +// ioctl itself should not be exposed directly, but additional get/set functions +// for specific types are permissible. These are defined in ioctl.go and +// ioctl_linux.go. +// +// The third argument to ioctl is often a pointer but sometimes an integer. +// Callers should use ioctlPtr when the third argument is a pointer and ioctl +// when the third argument is an integer. +// +// TODO: some existing code incorrectly uses ioctl when it should use ioctlPtr. //sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) @@ -145,6 +113,29 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) return openat(dirfd, path, flags|O_LARGEFILE, mode) } +//sys openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) + +func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) { + return openat2(dirfd, path, how, SizeofOpenHow) +} + +func Pipe(p []int) error { + return Pipe2(p, 0) +} + +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) error { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err := pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return err +} + //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { @@ -154,6 +145,15 @@ func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error return ppoll(&fds[0], len(fds), timeout, sigmask) } +func Poll(fds []PollFd, timeout int) (n int, err error) { + var ts *Timespec + if timeout >= 0 { + ts = new(Timespec) + *ts = NsecToTimespec(int64(timeout) * 1e6) + } + return Ppoll(fds, ts, nil) +} + //sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error) func Readlink(path string, buf []byte) (n int, err error) { @@ -204,27 +204,7 @@ func Utimes(path string, tv []Timeval) error { //sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) func UtimesNano(path string, ts []Timespec) error { - if ts == nil { - err := utimensat(AT_FDCWD, path, nil, 0) - if err != ENOSYS { - return err - } - return utimes(path, nil) - } - if len(ts) != 2 { - return EINVAL - } - err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) - if err != ENOSYS { - return err - } - // If the utimensat syscall isn't available (utimensat was added to Linux - // in 2.6.22, Released, 8 July 2007) then fall back to utimes - var tv [2]Timeval - for i := 0; i < 2; i++ { - tv[i] = NsecToTimeval(TimespecToNsec(ts[i])) - } - return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) + return UtimesNanoAt(AT_FDCWD, path, ts, 0) } func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error { @@ -603,6 +583,36 @@ func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil } +// SockaddrCANJ1939 implements the Sockaddr interface for AF_CAN using J1939 +// protocol (https://en.wikipedia.org/wiki/SAE_J1939). For more information +// on the purposes of the fields, check the official linux kernel documentation +// available here: https://www.kernel.org/doc/Documentation/networking/j1939.rst +type SockaddrCANJ1939 struct { + Ifindex int + Name uint64 + PGN uint32 + Addr uint8 + raw RawSockaddrCAN +} + +func (sa *SockaddrCANJ1939) sockaddr() (unsafe.Pointer, _Socklen, error) { + if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff { + return nil, 0, EINVAL + } + sa.raw.Family = AF_CAN + sa.raw.Ifindex = int32(sa.Ifindex) + n := (*[8]byte)(unsafe.Pointer(&sa.Name)) + for i := 0; i < 8; i++ { + sa.raw.Addr[i] = n[i] + } + p := (*[4]byte)(unsafe.Pointer(&sa.PGN)) + for i := 0; i < 4; i++ { + sa.raw.Addr[i+8] = p[i] + } + sa.raw.Addr[12] = sa.Addr + return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil +} + // SockaddrALG implements the Sockaddr interface for AF_ALG type sockets. // SockaddrALG enables userspace access to the Linux kernel's cryptography // subsystem. The Type and Name fields specify which type of hash or cipher @@ -710,16 +720,19 @@ type SockaddrVM struct { // CID and Port specify a context ID and port address for a VM socket. // Guests have a unique CID, and hosts may have a well-known CID of: // - VMADDR_CID_HYPERVISOR: refers to the hypervisor process. + // - VMADDR_CID_LOCAL: refers to local communication (loopback). // - VMADDR_CID_HOST: refers to other processes on the host. - CID uint32 - Port uint32 - raw RawSockaddrVM + CID uint32 + Port uint32 + Flags uint8 + raw RawSockaddrVM } func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) { sa.raw.Family = AF_VSOCK sa.raw.Port = sa.Port sa.raw.Cid = sa.CID + sa.raw.Flags = sa.Flags return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil } @@ -885,6 +898,79 @@ func (sa *SockaddrL2TPIP6) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP6, nil } +// SockaddrIUCV implements the Sockaddr interface for AF_IUCV sockets. +type SockaddrIUCV struct { + UserID string + Name string + raw RawSockaddrIUCV +} + +func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Family = AF_IUCV + // These are EBCDIC encoded by the kernel, but we still need to pad them + // with blanks. Initializing with blanks allows the caller to feed in either + // a padded or an unpadded string. + for i := 0; i < 8; i++ { + sa.raw.Nodeid[i] = ' ' + sa.raw.User_id[i] = ' ' + sa.raw.Name[i] = ' ' + } + if len(sa.UserID) > 8 || len(sa.Name) > 8 { + return nil, 0, EINVAL + } + for i, b := range []byte(sa.UserID[:]) { + sa.raw.User_id[i] = int8(b) + } + for i, b := range []byte(sa.Name[:]) { + sa.raw.Name[i] = int8(b) + } + return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil +} + +type SockaddrNFC struct { + DeviceIdx uint32 + TargetIdx uint32 + NFCProtocol uint32 + raw RawSockaddrNFC +} + +func (sa *SockaddrNFC) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Sa_family = AF_NFC + sa.raw.Dev_idx = sa.DeviceIdx + sa.raw.Target_idx = sa.TargetIdx + sa.raw.Nfc_protocol = sa.NFCProtocol + return unsafe.Pointer(&sa.raw), SizeofSockaddrNFC, nil +} + +type SockaddrNFCLLCP struct { + DeviceIdx uint32 + TargetIdx uint32 + NFCProtocol uint32 + DestinationSAP uint8 + SourceSAP uint8 + ServiceName string + raw RawSockaddrNFCLLCP +} + +func (sa *SockaddrNFCLLCP) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Sa_family = AF_NFC + sa.raw.Dev_idx = sa.DeviceIdx + sa.raw.Target_idx = sa.TargetIdx + sa.raw.Nfc_protocol = sa.NFCProtocol + sa.raw.Dsap = sa.DestinationSAP + sa.raw.Ssap = sa.SourceSAP + if len(sa.ServiceName) > len(sa.raw.Service_name) { + return nil, 0, EINVAL + } + copy(sa.raw.Service_name[:], sa.ServiceName) + sa.raw.SetServiceNameLen(len(sa.ServiceName)) + return unsafe.Pointer(&sa.raw), SizeofSockaddrNFCLLCP, nil +} + +var socketProtocol = func(fd int) (int, error) { + return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL) +} + func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { switch rsa.Addr.Family { case AF_NETLINK: @@ -935,7 +1021,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { return sa, nil case AF_INET: - proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL) + proto, err := socketProtocol(fd) if err != nil { return nil, err } @@ -961,7 +1047,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } case AF_INET6: - proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL) + proto, err := socketProtocol(fd) if err != nil { return nil, err } @@ -991,12 +1077,13 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { case AF_VSOCK: pp := (*RawSockaddrVM)(unsafe.Pointer(rsa)) sa := &SockaddrVM{ - CID: pp.Cid, - Port: pp.Port, + CID: pp.Cid, + Port: pp.Port, + Flags: pp.Flags, } return sa, nil case AF_BLUETOOTH: - proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL) + proto, err := socketProtocol(fd) if err != nil { return nil, err } @@ -1065,6 +1152,92 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { } return sa, nil + case AF_IUCV: + pp := (*RawSockaddrIUCV)(unsafe.Pointer(rsa)) + + var user [8]byte + var name [8]byte + + for i := 0; i < 8; i++ { + user[i] = byte(pp.User_id[i]) + name[i] = byte(pp.Name[i]) + } + + sa := &SockaddrIUCV{ + UserID: string(user[:]), + Name: string(name[:]), + } + return sa, nil + + case AF_CAN: + proto, err := socketProtocol(fd) + if err != nil { + return nil, err + } + + pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa)) + + switch proto { + case CAN_J1939: + sa := &SockaddrCANJ1939{ + Ifindex: int(pp.Ifindex), + } + name := (*[8]byte)(unsafe.Pointer(&sa.Name)) + for i := 0; i < 8; i++ { + name[i] = pp.Addr[i] + } + pgn := (*[4]byte)(unsafe.Pointer(&sa.PGN)) + for i := 0; i < 4; i++ { + pgn[i] = pp.Addr[i+8] + } + addr := (*[1]byte)(unsafe.Pointer(&sa.Addr)) + addr[0] = pp.Addr[12] + return sa, nil + default: + sa := &SockaddrCAN{ + Ifindex: int(pp.Ifindex), + } + rx := (*[4]byte)(unsafe.Pointer(&sa.RxID)) + for i := 0; i < 4; i++ { + rx[i] = pp.Addr[i] + } + tx := (*[4]byte)(unsafe.Pointer(&sa.TxID)) + for i := 0; i < 4; i++ { + tx[i] = pp.Addr[i+4] + } + return sa, nil + } + case AF_NFC: + proto, err := socketProtocol(fd) + if err != nil { + return nil, err + } + switch proto { + case NFC_SOCKPROTO_RAW: + pp := (*RawSockaddrNFC)(unsafe.Pointer(rsa)) + sa := &SockaddrNFC{ + DeviceIdx: pp.Dev_idx, + TargetIdx: pp.Target_idx, + NFCProtocol: pp.Nfc_protocol, + } + return sa, nil + case NFC_SOCKPROTO_LLCP: + pp := (*RawSockaddrNFCLLCP)(unsafe.Pointer(rsa)) + if uint64(pp.Service_name_len) > uint64(len(pp.Service_name)) { + return nil, EINVAL + } + sa := &SockaddrNFCLLCP{ + DeviceIdx: pp.Dev_idx, + TargetIdx: pp.Target_idx, + NFCProtocol: pp.Nfc_protocol, + DestinationSAP: pp.Dsap, + SourceSAP: pp.Ssap, + ServiceName: string(pp.Service_name[:pp.Service_name_len]), + } + return sa, nil + default: + return nil, EINVAL + } } return nil, EAFNOSUPPORT } @@ -1072,7 +1245,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { func Accept(fd int) (nfd int, sa Sockaddr, err error) { var rsa RawSockaddrAny var len _Socklen = SizeofSockaddrAny - nfd, err = accept(fd, &rsa, &len) + nfd, err = accept4(fd, &rsa, &len, 0) if err != nil { return } @@ -1194,6 +1367,13 @@ func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error { return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp)) } +func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) { + if len(o) == 0 { + return EINVAL + } + return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o))) +} + // Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html) // KeyctlInt calls keyctl commands in which each argument is an int. @@ -1326,8 +1506,8 @@ func KeyctlRestrictKeyring(ringid int, keyType string, restriction string) error return keyctlRestrictKeyringByType(KEYCTL_RESTRICT_KEYRING, ringid, keyType, restriction) } -//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL -//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL +//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL +//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { var msg Msghdr @@ -1642,16 +1822,13 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys ClockGettime(clockid int32, time *Timespec) (err error) //sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) //sys Close(fd int) (err error) +//sys CloseRange(first uint, last uint, flags uint) (err error) //sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys DeleteModule(name string, flags int) (err error) //sys Dup(oldfd int) (fd int, err error) func Dup2(oldfd, newfd int) error { - // Android O and newer blocks dup2; riscv and arm64 don't implement dup2. - if runtime.GOOS == "android" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "arm64" { - return Dup3(oldfd, newfd, 0) - } - return dup2(oldfd, newfd) + return Dup3(oldfd, newfd, 0) } //sys Dup3(oldfd int, newfd int, flags int) (err error) @@ -1704,8 +1881,8 @@ func Getpgrp() (pid int) { //sys Nanosleep(time *Timespec, leftover *Timespec) (err error) //sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error) //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT -//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 -//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) +//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 +//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) //sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 //sys read(fd int, p []byte) (n int, err error) //sys Removexattr(path string, attr string) (err error) @@ -1778,9 +1955,9 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) { //sys Syncfs(fd int) (err error) //sysnb Sysinfo(info *Sysinfo_t) (err error) //sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error) -//sysnb TimerfdCreate(clockid int, flags int) (fd int, err error) -//sysnb TimerfdGettime(fd int, currValue *ItimerSpec) (err error) -//sysnb TimerfdSettime(fd int, flags int, newValue *ItimerSpec, oldValue *ItimerSpec) (err error) +//sysnb TimerfdCreate(clockid int, flags int) (fd int, err error) +//sysnb TimerfdGettime(fd int, currValue *ItimerSpec) (err error) +//sysnb TimerfdSettime(fd int, flags int, newValue *ItimerSpec, oldValue *ItimerSpec) (err error) //sysnb Tgkill(tgid int, tid int, sig syscall.Signal) (err error) //sysnb Times(tms *Tms) (ticks uintptr, err error) //sysnb Umask(mask int) (oldmask int) @@ -1965,10 +2142,15 @@ func isGroupMember(gid int) bool { } //sys faccessat(dirfd int, path string, mode uint32) (err error) +//sys Faccessat2(dirfd int, path string, mode uint32, flags int) (err error) func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - if flags & ^(AT_SYMLINK_NOFOLLOW|AT_EACCESS) != 0 { - return EINVAL + if flags == 0 { + return faccessat(dirfd, path, mode) + } + + if err := Faccessat2(dirfd, path, mode, flags); err != ENOSYS && err != EPERM { + return err } // The Linux kernel faccessat system call does not take any flags. @@ -1977,8 +2159,8 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { // Because people naturally expect syscall.Faccessat to act // like C faccessat, we do the same. - if flags == 0 { - return faccessat(dirfd, path, mode) + if flags & ^(AT_SYMLINK_NOFOLLOW|AT_EACCESS) != 0 { + return EINVAL } var st Stat_t @@ -2035,8 +2217,8 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { return EACCES } -//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT -//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT +//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT +//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT // fileHandle is the argument to nameToHandleAt and openByHandleAt. We // originally tried to generate it via unix/linux/types.go with "type @@ -2122,6 +2304,26 @@ func Klogset(typ int, arg int) (err error) { return nil } +// RemoteIovec is Iovec with the pointer replaced with an integer. +// It is used for ProcessVMReadv and ProcessVMWritev, where the pointer +// refers to a location in a different process' address space, which +// would confuse the Go garbage collector. +type RemoteIovec struct { + Base uintptr + Len int +} + +//sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV +//sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV + +//sys PidfdOpen(pid int, flags int) (fd int, err error) = SYS_PIDFD_OPEN +//sys PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) = SYS_PIDFD_GETFD + +//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) +//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) +//sys shmdt(addr uintptr) (err error) +//sys shmget(key int, size int, flag int) (id int, err error) + /* * Unimplemented */ @@ -2203,10 +2405,6 @@ func Klogset(typ int, arg int) (err error) { // SetRobustList // SetThreadArea // SetTidAddress -// Shmat -// Shmctl -// Shmdt -// Shmget // Sigaltstack // Swapoff // Swapon diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_386.go index 048d18e3c8..5f757e8aa7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_386.go @@ -2,9 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP) -// so that go vet can check that they are correct. - +//go:build 386 && linux // +build 386,linux package unix @@ -21,36 +19,8 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - // 64-bit file system and 32-bit uid calls // (386 default is 32-bit file system and 16-bit uid). -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64 //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 @@ -61,7 +31,6 @@ func Pipe2(p []int, flags int) (err error) { //sysnb Geteuid() (euid int) = SYS_GETEUID32 //sysnb Getgid() (gid int) = SYS_GETGID32 //sysnb Getuid() (uid int) = SYS_GETUID32 -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 @@ -101,13 +70,13 @@ type rlimit32 struct { Max uint32 } -//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT +//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT const rlimInf32 = ^uint32(0) const rlimInf64 = ^uint64(0) func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -132,10 +101,10 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT +//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -380,11 +349,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint32(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go index 72efe86ed4..4299125aa7 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && linux // +build amd64,linux package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -20,17 +19,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb inotifyInit() (fd int, err error) - -func InotifyInit() (fd int, err error) { - // First try inotify_init1, because Android's seccomp policy blocks the latter. - fd, err = InotifyInit1(0) - if err == ENOSYS { - fd, err = inotifyInit() - } - return -} - //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) @@ -125,32 +113,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func (r *PtraceRegs) PC() uint64 { return r.Rip } func (r *PtraceRegs) SetPC(pc uint64) { r.Rip = pc } @@ -171,13 +133,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go index 21a4946ba5..8b0f0f3aa5 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build amd64,linux -// +build !gccgo +//go:build amd64 && linux && gc +// +build amd64,linux,gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go index e1913e2c93..79edeb9cb1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm.go @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && linux // +build arm,linux package unix import ( - "syscall" "unsafe" ) @@ -19,40 +19,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - // Try pipe2 first for Android O, then try pipe for kernel 2.6.23. - err = pipe2(&pp, 0) - if err == ENOSYS { - err = pipe(&pp) - } - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -// Underlying system call writes to newoffset via pointer. -// Implemented in assembly to avoid allocation. -func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) - func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { newoffset, errno := seek(fd, offset, whence) if errno != 0 { @@ -80,8 +46,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { // 64-bit file system and 32-bit uid calls // (16-bit uid calls are not always supported in newer kernels) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 @@ -90,7 +54,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { //sysnb Geteuid() (euid int) = SYS_GETEUID32 //sysnb Getgid() (gid int) = SYS_GETGID32 //sysnb Getuid() (uid int) = SYS_GETUID32 -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32 //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 @@ -134,8 +97,8 @@ func Utime(path string, buf *Utimbuf) error { //sys utimes(path string, times *[2]Timeval) (err error) -//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 -//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 +//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 //sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64 @@ -182,13 +145,13 @@ type rlimit32 struct { Max uint32 } -//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT +//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT const rlimInf32 = ^uint32(0) const rlimInf64 = ^uint64(0) func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -213,10 +176,10 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT +//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -260,13 +223,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint32(length) } //sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index c6de6b9134..862890de29 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -2,19 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && linux // +build arm64,linux package unix import "unsafe" -func EpollCreate(size int) (fd int, err error) { - if size <= 0 { - return -1, EINVAL - } - return EpollCreate1(0) -} - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -144,33 +138,9 @@ func utimes(path string, tv *[2]Timeval) (err error) { return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - // Getrlimit prefers the prlimit64 system call. See issue 38604. func Getrlimit(resource int, rlim *Rlimit) error { - err := prlimit(0, resource, nil, rlim) + err := Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -179,7 +149,7 @@ func Getrlimit(resource int, rlim *Rlimit) error { // Setrlimit prefers the prlimit64 system call. See issue 38604. func Setrlimit(resource int, rlim *Rlimit) error { - err := prlimit(0, resource, rlim, nil) + err := Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -206,31 +176,15 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } -// dup2 exists because func Dup3 in syscall_linux.go references -// it in an unreachable path. dup2 isn't available on arm64. -func dup2(oldfd int, newfd int) error - func Pause() error { _, err := ppoll(nil, 0, nil, nil) return err } -func Poll(fds []PollFd, timeout int) (n int, err error) { - var ts *Timespec - if timeout >= 0 { - ts = new(Timespec) - *ts = NsecToTimespec(int64(timeout) * 1e6) - } - if len(fds) == 0 { - return ppoll(nil, 0, ts, nil) - } - return ppoll(&fds[0], len(fds), ts, nil) -} - //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go index c26e6ec231..2b1168d7d1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux,!gccgo +//go:build linux && gc +// +build linux,gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go index 070bd38994..9843fb4896 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go @@ -2,7 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux,!gccgo,386 +//go:build linux && gc && 386 +// +build linux,gc,386 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go new file mode 100644 index 0000000000..a6008fccd5 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go @@ -0,0 +1,14 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build arm && gc && linux +// +build arm,gc,linux + +package unix + +import "syscall" + +// Underlying system call writes to newoffset via pointer. +// Implemented in assembly to avoid allocation. +func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go index 308eb7aecf..7740af2428 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && gccgo && 386 // +build linux,gccgo,386 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go index aa7fc9e199..e16a12299a 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && gccgo && arm // +build linux,gccgo,arm package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index f0287476cd..8932e34ad2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (mips64 || mips64le) // +build linux // +build mips64 mips64le package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -93,30 +92,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func Ioperm(from int, num int, on int) (err error) { return ENOSYS } @@ -216,15 +191,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go index c11328111d..7821c25d9f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (mips || mipsle) // +build linux // +build mips mipsle @@ -14,8 +15,6 @@ import ( func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -59,7 +58,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, //sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) //sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) @@ -112,29 +110,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: int32(sec), Usec: int32(usec)} } -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe() (p1 int, p2 int, err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - p[0], p[1], err = pipe() - return -} - //sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { @@ -153,10 +128,10 @@ type rlimit32 struct { Max uint32 } -//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT +//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT func Getrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, nil, rlim) + err = Prlimit(0, resource, nil, rlim) if err != ENOSYS { return err } @@ -181,10 +156,10 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) { return } -//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT +//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT func Setrlimit(resource int, rlim *Rlimit) (err error) { - err = prlimit(0, resource, rlim, nil) + err = Prlimit(0, resource, rlim, nil) if err != ENOSYS { return err } @@ -228,11 +203,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint32(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go new file mode 100644 index 0000000000..c5053a0f03 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc.go @@ -0,0 +1,237 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux && ppc +// +build linux,ppc + +package unix + +import ( + "syscall" + "unsafe" +) + +//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) +//sys Fchown(fd int, uid int, gid int) (err error) +//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 +//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 +//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64 +//sysnb Getegid() (egid int) +//sysnb Geteuid() (euid int) +//sysnb Getgid() (gid int) +//sysnb Getuid() (uid int) +//sys Ioperm(from int, num int, on int) (err error) +//sys Iopl(level int) (err error) +//sys Lchown(path string, uid int, gid int) (err error) +//sys Listen(s int, n int) (err error) +//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64 +//sys Pause() (err error) +//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 +//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 +//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) +//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT +//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64 +//sys setfsgid(gid int) (prev int, err error) +//sys setfsuid(uid int) (prev int, err error) +//sysnb Setregid(rgid int, egid int) (err error) +//sysnb Setresgid(rgid int, egid int, sgid int) (err error) +//sysnb Setresuid(ruid int, euid int, suid int) (err error) +//sysnb Setreuid(ruid int, euid int) (err error) +//sys Shutdown(fd int, how int) (err error) +//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) +//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64 +//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64 +//sys Ustat(dev int, ubuf *Ustat_t) (err error) +//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) +//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) +//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) +//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) +//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) +//sysnb setgroups(n int, list *_Gid_t) (err error) +//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) +//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) +//sysnb socket(domain int, typ int, proto int) (fd int, err error) +//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) +//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) +//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) +//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) +//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) +//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) +//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) + +//sys futimesat(dirfd int, path string, times *[2]Timeval) (err error) +//sysnb Gettimeofday(tv *Timeval) (err error) +//sysnb Time(t *Time_t) (tt Time_t, err error) +//sys Utime(path string, buf *Utimbuf) (err error) +//sys utimes(path string, times *[2]Timeval) (err error) + +func Fadvise(fd int, offset int64, length int64, advice int) (err error) { + _, _, e1 := Syscall6(SYS_FADVISE64_64, uintptr(fd), uintptr(advice), uintptr(offset>>32), uintptr(offset), uintptr(length>>32), uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func seek(fd int, offset int64, whence int) (int64, syscall.Errno) { + var newoffset int64 + offsetLow := uint32(offset & 0xffffffff) + offsetHigh := uint32((offset >> 32) & 0xffffffff) + _, _, err := Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) + return newoffset, err +} + +func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { + newoffset, errno := seek(fd, offset, whence) + if errno != 0 { + return 0, errno + } + return newoffset, nil +} + +func Fstatfs(fd int, buf *Statfs_t) (err error) { + _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) + if e != 0 { + err = e + } + return +} + +func Statfs(path string, buf *Statfs_t) (err error) { + pathp, err := BytePtrFromString(path) + if err != nil { + return err + } + _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(pathp)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) + if e != 0 { + err = e + } + return +} + +//sys mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) + +func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { + page := uintptr(offset / 4096) + if offset != int64(page)*4096 { + return 0, EINVAL + } + return mmap2(addr, length, prot, flags, fd, page) +} + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: int32(sec), Nsec: int32(nsec)} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: int32(sec), Usec: int32(usec)} +} + +type rlimit32 struct { + Cur uint32 + Max uint32 +} + +//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT + +const rlimInf32 = ^uint32(0) +const rlimInf64 = ^uint64(0) + +func Getrlimit(resource int, rlim *Rlimit) (err error) { + err = Prlimit(0, resource, nil, rlim) + if err != ENOSYS { + return err + } + + rl := rlimit32{} + err = getrlimit(resource, &rl) + if err != nil { + return + } + + if rl.Cur == rlimInf32 { + rlim.Cur = rlimInf64 + } else { + rlim.Cur = uint64(rl.Cur) + } + + if rl.Max == rlimInf32 { + rlim.Max = rlimInf64 + } else { + rlim.Max = uint64(rl.Max) + } + return +} + +//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT + +func Setrlimit(resource int, rlim *Rlimit) (err error) { + err = Prlimit(0, resource, rlim, nil) + if err != ENOSYS { + return err + } + + rl := rlimit32{} + if rlim.Cur == rlimInf64 { + rl.Cur = rlimInf32 + } else if rlim.Cur < uint64(rlimInf32) { + rl.Cur = uint32(rlim.Cur) + } else { + return EINVAL + } + if rlim.Max == rlimInf64 { + rl.Max = rlimInf32 + } else if rlim.Max < uint64(rlimInf32) { + rl.Max = uint32(rlim.Max) + } else { + return EINVAL + } + + return setrlimit(resource, &rl) +} + +func (r *PtraceRegs) PC() uint32 { return r.Nip } + +func (r *PtraceRegs) SetPC(pc uint32) { r.Nip = pc } + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint32(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (msghdr *Msghdr) SetIovlen(length int) { + msghdr.Iovlen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint32(length) +} + +//sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2 + +func SyncFileRange(fd int, off int64, n int64, flags int) error { + // The sync_file_range and sync_file_range2 syscalls differ only in the + // order of their arguments. + return syncFileRange2(fd, flags, off, n) +} + +//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) + +func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { + cmdlineLen := len(cmdline) + if cmdlineLen > 0 { + // Account for the additional NULL byte added by + // BytePtrFromString in kexecFileLoad. The kexec_file_load + // syscall expects a NULL-terminated string. + cmdlineLen++ + } + return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go index 349374409b..25786c4216 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go @@ -2,13 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (ppc64 || ppc64le) // +build linux // +build ppc64 ppc64le package unix -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -21,7 +20,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_UGETRLIMIT //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Ioperm(from int, num int, on int) (err error) //sys Iopl(level int) (err error) //sys Lchown(path string, uid int, gid int) (err error) @@ -99,39 +97,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } //sys syncFileRange2(fd int, flags int, off int64, n int64) (err error) = SYS_SYNC_FILE_RANGE2 diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go index b0b1505565..6f9f710414 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go @@ -2,19 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build riscv64 && linux // +build riscv64,linux package unix import "unsafe" -func EpollCreate(size int) (fd int, err error) { - if size <= 0 { - return -1, EINVAL - } - return EpollCreate1(0) -} - //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -143,30 +137,6 @@ func utimes(path string, tv *[2]Timeval) (err error) { return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0) } -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func (r *PtraceRegs) PC() uint64 { return r.Pc } func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc } @@ -187,8 +157,8 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -func InotifyInit() (fd int, err error) { - return InotifyInit1(0) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } func Pause() error { @@ -196,18 +166,6 @@ func Pause() error { return err } -func Poll(fds []PollFd, timeout int) (n int, err error) { - var ts *Timespec - if timeout >= 0 { - ts = new(Timespec) - *ts = NsecToTimespec(int64(timeout) * 1e6) - } - if len(fds) == 0 { - return ppoll(nil, 0, ts, nil) - } - return ppoll(&fds[0], len(fds), ts, nil) -} - func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0) } @@ -224,7 +182,3 @@ func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error } return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags) } - -// dup2 exists because func Dup3 in syscall_linux.go references -// it in an unreachable path. dup2 isn't available on arm64. -func dup2(oldfd int, newfd int) error diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go index 2363f74991..6aa59cb270 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build s390x && linux // +build s390x,linux package unix @@ -10,8 +11,6 @@ import ( "unsafe" ) -//sys dup2(oldfd int, newfd int) (err error) -//sysnb EpollCreate(size int) (fd int, err error) //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 //sys Fchown(fd int, uid int, gid int) (err error) @@ -24,7 +23,6 @@ import ( //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) //sys Pause() (err error) @@ -76,30 +74,6 @@ func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: usec} } -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, 0) // pipe2 is the same as pipe when flags are set to 0. - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - func Ioperm(from int, num int, on int) (err error) { return ENOSYS } @@ -128,6 +102,10 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) +} + // Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct. // mmap2 also requires arguments to be passed in a struct; it is currently not exposed in . func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { @@ -249,7 +227,7 @@ func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen } func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error { - args := [4]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val)} + args := [5]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen} _, _, err := Syscall(SYS_SOCKETCALL, netSetSockOpt, uintptr(unsafe.Pointer(&args)), 0) if err != 0 { return err @@ -319,15 +297,6 @@ func Shutdown(s, how int) error { return nil } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) -} - //sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go index d389f1518f..bbe8d174f8 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build sparc64 && linux // +build sparc64,linux package unix //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64 -//sys dup2(oldfd int, newfd int) (err error) //sys Fchown(fd int, uid int, gid int) (err error) //sys Fstat(fd int, stat *Stat_t) (err error) //sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64 @@ -19,7 +19,6 @@ package unix //sysnb Getgid() (gid int) //sysnb Getrlimit(resource int, rlim *Rlimit) (err error) //sysnb Getuid() (uid int) -//sysnb InotifyInit() (fd int, err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Listen(s int, n int) (err error) //sys Lstat(path string, stat *Stat_t) (err error) @@ -115,37 +114,6 @@ func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint64(length) } -//sysnb pipe(p *[2]_C_int) (err error) - -func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sysnb pipe2(p *[2]_C_int, flags int) (err error) - -func Pipe2(p []int, flags int) (err error) { - if len(p) != 2 { - return EINVAL - } - var pp [2]_C_int - err = pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) - return -} - -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) - -func Poll(fds []PollFd, timeout int) (n int, err error) { - if len(fds) == 0 { - return poll(nil, 0, timeout) - } - return poll(&fds[0], len(fds), timeout) +func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { + rsa.Service_name_len = uint64(length) } diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 45b50a6105..853d5f0f43 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -31,6 +31,10 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } +func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { + return nil, EAFNOSUPPORT +} + func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func sysctlNodes(mib []_C_int) (nodes []Sysctlnode, err error) { @@ -106,7 +110,8 @@ func direntNamlen(buf []byte) (uint64, bool) { return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) } -//sysnb pipe() (fd1 int, fd2 int, err error) +//sysnb pipe() (fd1 int, fd2 int, err error) + func Pipe(p []int) (err error) { if len(p) != 2 { return EINVAL @@ -115,7 +120,21 @@ func Pipe(p []int) (err error) { return } -//sys Getdents(fd int, buf []byte) (n int, err error) +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) error { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err := pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return err +} + +//sys Getdents(fd int, buf []byte) (n int, err error) + func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { n, err = Getdents(fd, buf) if err != nil || basep == nil { @@ -141,23 +160,8 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { return } -const ImplementsGetwd = true - //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD -func Getwd() (string, error) { - var buf [PathMax]byte - _, err := Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} - // TODO func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { return -1, ENOSYS @@ -170,7 +174,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { //sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) { var value Ptmget diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go index 24da8b5245..5199d282fd 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 && netbsd // +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go index 25a0ac8258..70a9c52e98 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && netbsd // +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go index 21591ecd4d..3eb5942f93 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && netbsd // +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go index 8047496350..fc6ccfd810 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && netbsd // +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index a266e92a9b..22b5503850 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -31,6 +31,10 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } +func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) { + return nil, EAFNOSUPPORT +} + func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) func nametomib(name string) (mib []_C_int, err error) { @@ -88,7 +92,7 @@ func Pipe2(p []int, flags int) error { return err } -//sys Getdents(fd int, buf []byte) (n int, err error) +//sys Getdents(fd int, buf []byte) (n int, err error) func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { n, err = Getdents(fd, buf) if err != nil || basep == nil { @@ -114,23 +118,8 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { return } -const ImplementsGetwd = true - //sys Getcwd(buf []byte) (n int, err error) = SYS___GETCWD -func Getwd() (string, error) { - var buf [PathMax]byte - _, err := Getcwd(buf[0:]) - if err != nil { - return "", err - } - n := clen(buf[:]) - if n < 1 { - return "", EINVAL - } - return string(buf[:n]), nil -} - func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { if raceenabled { raceReleaseMerge(unsafe.Pointer(&ioSync)) @@ -165,7 +154,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error { //sys ioctl(fd int, req uint, arg uintptr) (err error) -//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL +//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL //sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go index 42b5a0e51e..6baabcdcb0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build 386 && openbsd // +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go index 6ea4b48831..bab25360ea 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && openbsd // +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go index 1c3d26fa2c..8eed3c4d4e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm && openbsd // +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go index a8c458cb03..483dde99d4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build arm64 && openbsd // +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go new file mode 100644 index 0000000000..30f285343e --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go @@ -0,0 +1,35 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package unix + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { + return Timeval{Sec: sec, Usec: usec} +} + +func SetKevent(k *Kevent_t, fd, mode, flags int) { + k.Ident = uint64(fd) + k.Filter = int16(mode) + k.Flags = uint16(flags) +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + +// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions +// of OpenBSD the syscall is called sysctl instead of __sysctl. +const SYS___SYSCTL = SYS_SYSCTL diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 0e2a696ad3..d2a6495c7e 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -13,6 +13,10 @@ package unix import ( + "fmt" + "os" + "runtime" + "sync" "syscall" "unsafe" ) @@ -67,6 +71,19 @@ func Pipe(p []int) (err error) { return nil } +//sysnb pipe2(p *[2]_C_int, flags int) (err error) + +func Pipe2(p []int, flags int) error { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err := pipe2(&pp, flags) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return err +} + func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { if sa.Port < 0 || sa.Port > 0xFFFF { return nil, 0, EINVAL @@ -551,10 +568,17 @@ func Minor(dev uint64) uint32 { * Expose the ioctl function */ -//sys ioctl(fd int, req uint, arg uintptr) (err error) +//sys ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) = libc.ioctl + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, err = ioctlRet(fd, req, arg) + return err +} -func IoctlSetTermio(fd int, req uint, value *Termio) (err error) { - return ioctl(fd, req, uintptr(unsafe.Pointer(value))) +func IoctlSetTermio(fd int, req uint, value *Termio) error { + err := ioctl(fd, req, uintptr(unsafe.Pointer(value))) + runtime.KeepAlive(value) + return err } func IoctlGetTermio(fd int, req uint) (*Termio, error) { @@ -563,7 +587,7 @@ func IoctlGetTermio(fd int, req uint) (*Termio, error) { return &value, err } -//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) +//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) func Poll(fds []PollFd, timeout int) (n int, err error) { if len(fds) == 0 { @@ -666,6 +690,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Statvfs(path string, vfsstat *Statvfs_t) (err error) //sys Symlink(path string, link string) (err error) //sys Sync() (err error) +//sys Sysconf(which int) (n int64, err error) //sysnb Times(tms *Tms) (ticks uintptr, err error) //sys Truncate(path string, length int64) (err error) //sys Fsync(fd int) (err error) @@ -722,3 +747,240 @@ func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, e func Munmap(b []byte) (err error) { return mapper.Munmap(b) } + +// Event Ports + +type fileObjCookie struct { + fobj *fileObj + cookie interface{} +} + +// EventPort provides a safe abstraction on top of Solaris/illumos Event Ports. +type EventPort struct { + port int + mu sync.Mutex + fds map[uintptr]interface{} + paths map[string]*fileObjCookie +} + +// PortEvent is an abstraction of the port_event C struct. +// Compare Source against PORT_SOURCE_FILE or PORT_SOURCE_FD +// to see if Path or Fd was the event source. The other will be +// uninitialized. +type PortEvent struct { + Cookie interface{} + Events int32 + Fd uintptr + Path string + Source uint16 + fobj *fileObj +} + +// NewEventPort creates a new EventPort including the +// underlying call to port_create(3c). +func NewEventPort() (*EventPort, error) { + port, err := port_create() + if err != nil { + return nil, err + } + e := &EventPort{ + port: port, + fds: make(map[uintptr]interface{}), + paths: make(map[string]*fileObjCookie), + } + return e, nil +} + +//sys port_create() (n int, err error) +//sys port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error) +//sys port_dissociate(port int, source int, object uintptr) (n int, err error) +//sys port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) +//sys port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error) + +// Close closes the event port. +func (e *EventPort) Close() error { + e.mu.Lock() + defer e.mu.Unlock() + e.fds = nil + e.paths = nil + return Close(e.port) +} + +// PathIsWatched checks to see if path is associated with this EventPort. +func (e *EventPort) PathIsWatched(path string) bool { + e.mu.Lock() + defer e.mu.Unlock() + _, found := e.paths[path] + return found +} + +// FdIsWatched checks to see if fd is associated with this EventPort. +func (e *EventPort) FdIsWatched(fd uintptr) bool { + e.mu.Lock() + defer e.mu.Unlock() + _, found := e.fds[fd] + return found +} + +// AssociatePath wraps port_associate(3c) for a filesystem path including +// creating the necessary file_obj from the provided stat information. +func (e *EventPort) AssociatePath(path string, stat os.FileInfo, events int, cookie interface{}) error { + e.mu.Lock() + defer e.mu.Unlock() + if _, found := e.paths[path]; found { + return fmt.Errorf("%v is already associated with this Event Port", path) + } + fobj, err := createFileObj(path, stat) + if err != nil { + return err + } + fCookie := &fileObjCookie{fobj, cookie} + _, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fobj)), events, (*byte)(unsafe.Pointer(&fCookie.cookie))) + if err != nil { + return err + } + e.paths[path] = fCookie + return nil +} + +// DissociatePath wraps port_dissociate(3c) for a filesystem path. +func (e *EventPort) DissociatePath(path string) error { + e.mu.Lock() + defer e.mu.Unlock() + f, ok := e.paths[path] + if !ok { + return fmt.Errorf("%v is not associated with this Event Port", path) + } + _, err := port_dissociate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(f.fobj))) + if err != nil { + return err + } + delete(e.paths, path) + return nil +} + +// AssociateFd wraps calls to port_associate(3c) on file descriptors. +func (e *EventPort) AssociateFd(fd uintptr, events int, cookie interface{}) error { + e.mu.Lock() + defer e.mu.Unlock() + if _, found := e.fds[fd]; found { + return fmt.Errorf("%v is already associated with this Event Port", fd) + } + pcookie := &cookie + _, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(pcookie))) + if err != nil { + return err + } + e.fds[fd] = pcookie + return nil +} + +// DissociateFd wraps calls to port_dissociate(3c) on file descriptors. +func (e *EventPort) DissociateFd(fd uintptr) error { + e.mu.Lock() + defer e.mu.Unlock() + _, ok := e.fds[fd] + if !ok { + return fmt.Errorf("%v is not associated with this Event Port", fd) + } + _, err := port_dissociate(e.port, PORT_SOURCE_FD, fd) + if err != nil { + return err + } + delete(e.fds, fd) + return nil +} + +func createFileObj(name string, stat os.FileInfo) (*fileObj, error) { + fobj := new(fileObj) + bs, err := ByteSliceFromString(name) + if err != nil { + return nil, err + } + fobj.Name = (*int8)(unsafe.Pointer(&bs[0])) + s := stat.Sys().(*syscall.Stat_t) + fobj.Atim.Sec = s.Atim.Sec + fobj.Atim.Nsec = s.Atim.Nsec + fobj.Mtim.Sec = s.Mtim.Sec + fobj.Mtim.Nsec = s.Mtim.Nsec + fobj.Ctim.Sec = s.Ctim.Sec + fobj.Ctim.Nsec = s.Ctim.Nsec + return fobj, nil +} + +// GetOne wraps port_get(3c) and returns a single PortEvent. +func (e *EventPort) GetOne(t *Timespec) (*PortEvent, error) { + pe := new(portEvent) + _, err := port_get(e.port, pe, t) + if err != nil { + return nil, err + } + p := new(PortEvent) + p.Events = pe.Events + p.Source = pe.Source + e.mu.Lock() + defer e.mu.Unlock() + switch pe.Source { + case PORT_SOURCE_FD: + p.Fd = uintptr(pe.Object) + cookie := (*interface{})(unsafe.Pointer(pe.User)) + p.Cookie = *cookie + delete(e.fds, p.Fd) + case PORT_SOURCE_FILE: + p.fobj = (*fileObj)(unsafe.Pointer(uintptr(pe.Object))) + p.Path = BytePtrToString((*byte)(unsafe.Pointer(p.fobj.Name))) + cookie := (*interface{})(unsafe.Pointer(pe.User)) + p.Cookie = *cookie + delete(e.paths, p.Path) + } + return p, nil +} + +// Pending wraps port_getn(3c) and returns how many events are pending. +func (e *EventPort) Pending() (int, error) { + var n uint32 = 0 + _, err := port_getn(e.port, nil, 0, &n, nil) + return int(n), err +} + +// Get wraps port_getn(3c) and fills a slice of PortEvent. +// It will block until either min events have been received +// or the timeout has been exceeded. It will return how many +// events were actually received along with any error information. +func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error) { + if min == 0 { + return 0, fmt.Errorf("need to request at least one event or use Pending() instead") + } + if len(s) < min { + return 0, fmt.Errorf("len(s) (%d) is less than min events requested (%d)", len(s), min) + } + got := uint32(min) + max := uint32(len(s)) + var err error + ps := make([]portEvent, max, max) + _, err = port_getn(e.port, &ps[0], max, &got, timeout) + // got will be trustworthy with ETIME, but not any other error. + if err != nil && err != ETIME { + return 0, err + } + e.mu.Lock() + defer e.mu.Unlock() + for i := 0; i < int(got); i++ { + s[i].Events = ps[i].Events + s[i].Source = ps[i].Source + switch ps[i].Source { + case PORT_SOURCE_FD: + s[i].Fd = uintptr(ps[i].Object) + cookie := (*interface{})(unsafe.Pointer(ps[i].User)) + s[i].Cookie = *cookie + delete(e.fds, s[i].Fd) + case PORT_SOURCE_FILE: + s[i].fobj = (*fileObj)(unsafe.Pointer(uintptr(ps[i].Object))) + s[i].Path = BytePtrToString((*byte)(unsafe.Pointer(s[i].fobj.Name))) + cookie := (*interface{})(unsafe.Pointer(ps[i].User)) + s[i].Cookie = *cookie + delete(e.paths, s[i].Path) + } + } + return int(got), err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go index b22a34d7ae..0bd25ef81f 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build amd64 && solaris // +build amd64,solaris package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 400ba9fbc9..cf296a2433 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package unix @@ -312,6 +313,10 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { return } +func Send(s int, buf []byte, flags int) (err error) { + return sendto(s, buf, flags, nil, 0) +} + func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) { ptr, n, err := to.sockaddr() if err != nil { diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go index 1c70d1b690..5898e9a52b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc.go @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && gc && !ppc64le && !ppc64 // +build darwin dragonfly freebsd linux netbsd openbsd solaris -// +build !gccgo,!ppc64le,!ppc64 +// +build gc +// +build !ppc64le +// +build !ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go index 86dc765aba..f6f707acf2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build linux && (ppc64le || ppc64) && gc // +build linux // +build ppc64le ppc64 -// +build !gccgo +// +build gc package unix diff --git a/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go new file mode 100644 index 0000000000..1ffd8bfcfb --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -0,0 +1,1829 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "bytes" + "runtime" + "sort" + "sync" + "syscall" + "unsafe" +) + +const ( + O_CLOEXEC = 0 // Dummy value (not supported). + AF_LOCAL = AF_UNIX // AF_LOCAL is an alias for AF_UNIX +) + +func syscall_syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func syscall_rawsyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) +func syscall_syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func syscall_rawsyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) +func syscall_syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) +func syscall_rawsyscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) + +func copyStat(stat *Stat_t, statLE *Stat_LE_t) { + stat.Dev = uint64(statLE.Dev) + stat.Ino = uint64(statLE.Ino) + stat.Nlink = uint64(statLE.Nlink) + stat.Mode = uint32(statLE.Mode) + stat.Uid = uint32(statLE.Uid) + stat.Gid = uint32(statLE.Gid) + stat.Rdev = uint64(statLE.Rdev) + stat.Size = statLE.Size + stat.Atim.Sec = int64(statLE.Atim) + stat.Atim.Nsec = 0 //zos doesn't return nanoseconds + stat.Mtim.Sec = int64(statLE.Mtim) + stat.Mtim.Nsec = 0 //zos doesn't return nanoseconds + stat.Ctim.Sec = int64(statLE.Ctim) + stat.Ctim.Nsec = 0 //zos doesn't return nanoseconds + stat.Blksize = int64(statLE.Blksize) + stat.Blocks = statLE.Blocks +} + +func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64) +func svcLoad(name *byte) unsafe.Pointer +func svcUnload(name *byte, fnptr unsafe.Pointer) int64 + +func (d *Dirent) NameString() string { + if d == nil { + return "" + } + return string(d.Name[:d.Namlen]) +} + +func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) { + if sa.Port < 0 || sa.Port > 0xFFFF { + return nil, 0, EINVAL + } + sa.raw.Len = SizeofSockaddrInet4 + sa.raw.Family = AF_INET + p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) + p[0] = byte(sa.Port >> 8) + p[1] = byte(sa.Port) + for i := 0; i < len(sa.Addr); i++ { + sa.raw.Addr[i] = sa.Addr[i] + } + return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil +} + +func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) { + if sa.Port < 0 || sa.Port > 0xFFFF { + return nil, 0, EINVAL + } + sa.raw.Len = SizeofSockaddrInet6 + sa.raw.Family = AF_INET6 + p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) + p[0] = byte(sa.Port >> 8) + p[1] = byte(sa.Port) + sa.raw.Scope_id = sa.ZoneId + for i := 0; i < len(sa.Addr); i++ { + sa.raw.Addr[i] = sa.Addr[i] + } + return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil +} + +func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { + name := sa.Name + n := len(name) + if n >= len(sa.raw.Path) || n == 0 { + return nil, 0, EINVAL + } + sa.raw.Len = byte(3 + n) // 2 for Family, Len; 1 for NUL + sa.raw.Family = AF_UNIX + for i := 0; i < n; i++ { + sa.raw.Path[i] = int8(name[i]) + } + return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil +} + +func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) { + // TODO(neeilan): Implement use of first param (fd) + switch rsa.Addr.Family { + case AF_UNIX: + pp := (*RawSockaddrUnix)(unsafe.Pointer(rsa)) + sa := new(SockaddrUnix) + // For z/OS, only replace NUL with @ when the + // length is not zero. + if pp.Len != 0 && pp.Path[0] == 0 { + // "Abstract" Unix domain socket. + // Rewrite leading NUL as @ for textual display. + // (This is the standard convention.) + // Not friendly to overwrite in place, + // but the callers below don't care. + pp.Path[0] = '@' + } + + // Assume path ends at NUL. + // + // For z/OS, the length of the name is a field + // in the structure. To be on the safe side, we + // will still scan the name for a NUL but only + // to the length provided in the structure. + // + // This is not technically the Linux semantics for + // abstract Unix domain sockets--they are supposed + // to be uninterpreted fixed-size binary blobs--but + // everyone uses this convention. + n := 0 + for n < int(pp.Len) && pp.Path[n] != 0 { + n++ + } + bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n] + sa.Name = string(bytes) + return sa, nil + + case AF_INET: + pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa)) + sa := new(SockaddrInet4) + p := (*[2]byte)(unsafe.Pointer(&pp.Port)) + sa.Port = int(p[0])<<8 + int(p[1]) + for i := 0; i < len(sa.Addr); i++ { + sa.Addr[i] = pp.Addr[i] + } + return sa, nil + + case AF_INET6: + pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa)) + sa := new(SockaddrInet6) + p := (*[2]byte)(unsafe.Pointer(&pp.Port)) + sa.Port = int(p[0])<<8 + int(p[1]) + sa.ZoneId = pp.Scope_id + for i := 0; i < len(sa.Addr); i++ { + sa.Addr[i] = pp.Addr[i] + } + return sa, nil + } + return nil, EAFNOSUPPORT +} + +func Accept(fd int) (nfd int, sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + nfd, err = accept(fd, &rsa, &len) + if err != nil { + return + } + // TODO(neeilan): Remove 0 in call + sa, err = anyToSockaddr(0, &rsa) + if err != nil { + Close(nfd) + nfd = 0 + } + return +} + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = int32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = int32(length) +} + +//sys fcntl(fd int, cmd int, arg int) (val int, err error) +//sys read(fd int, p []byte) (n int, err error) +//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ +//sys write(fd int, p []byte) (n int, err error) + +//sys accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) = SYS___ACCEPT_A +//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = SYS___BIND_A +//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = SYS___CONNECT_A +//sysnb getgroups(n int, list *_Gid_t) (nn int, err error) +//sysnb setgroups(n int, list *_Gid_t) (err error) +//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) +//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) +//sysnb socket(domain int, typ int, proto int) (fd int, err error) +//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) +//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = SYS___GETPEERNAME_A +//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = SYS___GETSOCKNAME_A +//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = SYS___RECVFROM_A +//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) = SYS___SENDTO_A +//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = SYS___RECVMSG_A +//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = SYS___SENDMSG_A +//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) = SYS_MMAP +//sys munmap(addr uintptr, length uintptr) (err error) = SYS_MUNMAP +//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL + +//sys Access(path string, mode uint32) (err error) = SYS___ACCESS_A +//sys Chdir(path string) (err error) = SYS___CHDIR_A +//sys Chown(path string, uid int, gid int) (err error) = SYS___CHOWN_A +//sys Chmod(path string, mode uint32) (err error) = SYS___CHMOD_A +//sys Creat(path string, mode uint32) (fd int, err error) = SYS___CREAT_A +//sys Dup(oldfd int) (fd int, err error) +//sys Dup2(oldfd int, newfd int) (err error) +//sys Errno2() (er2 int) = SYS___ERRNO2 +//sys Err2ad() (eadd *int) = SYS___ERR2AD +//sys Exit(code int) +//sys Fchdir(fd int) (err error) +//sys Fchmod(fd int, mode uint32) (err error) +//sys Fchown(fd int, uid int, gid int) (err error) +//sys FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) = SYS_FCNTL +//sys fstat(fd int, stat *Stat_LE_t) (err error) + +func Fstat(fd int, stat *Stat_t) (err error) { + var statLE Stat_LE_t + err = fstat(fd, &statLE) + copyStat(stat, &statLE) + return +} + +//sys Fstatvfs(fd int, stat *Statvfs_t) (err error) = SYS_FSTATVFS +//sys Fsync(fd int) (err error) +//sys Ftruncate(fd int, length int64) (err error) +//sys Getpagesize() (pgsize int) = SYS_GETPAGESIZE +//sys Mprotect(b []byte, prot int) (err error) = SYS_MPROTECT +//sys Msync(b []byte, flags int) (err error) = SYS_MSYNC +//sys Poll(fds []PollFd, timeout int) (n int, err error) = SYS_POLL +//sys Times(tms *Tms) (ticks uintptr, err error) = SYS_TIMES +//sys W_Getmntent(buff *byte, size int) (lastsys int, err error) = SYS_W_GETMNTENT +//sys W_Getmntent_A(buff *byte, size int) (lastsys int, err error) = SYS___W_GETMNTENT_A + +//sys mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) = SYS___MOUNT_A +//sys unmount(filesystem string, mtm int) (err error) = SYS___UMOUNT_A +//sys Chroot(path string) (err error) = SYS___CHROOT_A +//sys Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) = SYS_SELECT +//sysnb Uname(buf *Utsname) (err error) = SYS___UNAME_A + +func Ptsname(fd int) (name string, err error) { + r0, _, e1 := syscall_syscall(SYS___PTSNAME_A, uintptr(fd), 0, 0) + name = u2s(unsafe.Pointer(r0)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func u2s(cstr unsafe.Pointer) string { + str := (*[1024]uint8)(cstr) + i := 0 + for str[i] != 0 { + i++ + } + return string(str[:i]) +} + +func Close(fd int) (err error) { + _, _, e1 := syscall_syscall(SYS_CLOSE, uintptr(fd), 0, 0) + for i := 0; e1 == EAGAIN && i < 10; i++ { + _, _, _ = syscall_syscall(SYS_USLEEP, uintptr(10), 0, 0) + _, _, e1 = syscall_syscall(SYS_CLOSE, uintptr(fd), 0, 0) + } + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var mapper = &mmapper{ + active: make(map[*byte][]byte), + mmap: mmap, + munmap: munmap, +} + +// Dummy function: there are no semantics for Madvise on z/OS +func Madvise(b []byte, advice int) (err error) { + return +} + +func Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { + return mapper.Mmap(fd, offset, length, prot, flags) +} + +func Munmap(b []byte) (err error) { + return mapper.Munmap(b) +} + +//sys Gethostname(buf []byte) (err error) = SYS___GETHOSTNAME_A +//sysnb Getegid() (egid int) +//sysnb Geteuid() (uid int) +//sysnb Getgid() (gid int) +//sysnb Getpid() (pid int) +//sysnb Getpgid(pid int) (pgid int, err error) = SYS_GETPGID + +func Getpgrp() (pid int) { + pid, _ = Getpgid(0) + return +} + +//sysnb Getppid() (pid int) +//sys Getpriority(which int, who int) (prio int, err error) +//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = SYS_GETRLIMIT + +//sysnb getrusage(who int, rusage *rusage_zos) (err error) = SYS_GETRUSAGE + +func Getrusage(who int, rusage *Rusage) (err error) { + var ruz rusage_zos + err = getrusage(who, &ruz) + //Only the first two fields of Rusage are set + rusage.Utime.Sec = ruz.Utime.Sec + rusage.Utime.Usec = int64(ruz.Utime.Usec) + rusage.Stime.Sec = ruz.Stime.Sec + rusage.Stime.Usec = int64(ruz.Stime.Usec) + return +} + +//sysnb Getsid(pid int) (sid int, err error) = SYS_GETSID +//sysnb Getuid() (uid int) +//sysnb Kill(pid int, sig Signal) (err error) +//sys Lchown(path string, uid int, gid int) (err error) = SYS___LCHOWN_A +//sys Link(path string, link string) (err error) = SYS___LINK_A +//sys Listen(s int, n int) (err error) +//sys lstat(path string, stat *Stat_LE_t) (err error) = SYS___LSTAT_A + +func Lstat(path string, stat *Stat_t) (err error) { + var statLE Stat_LE_t + err = lstat(path, &statLE) + copyStat(stat, &statLE) + return +} + +//sys Mkdir(path string, mode uint32) (err error) = SYS___MKDIR_A +//sys Mkfifo(path string, mode uint32) (err error) = SYS___MKFIFO_A +//sys Mknod(path string, mode uint32, dev int) (err error) = SYS___MKNOD_A +//sys Pread(fd int, p []byte, offset int64) (n int, err error) +//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) +//sys Readlink(path string, buf []byte) (n int, err error) = SYS___READLINK_A +//sys Rename(from string, to string) (err error) = SYS___RENAME_A +//sys Rmdir(path string) (err error) = SYS___RMDIR_A +//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK +//sys Setpriority(which int, who int, prio int) (err error) +//sysnb Setpgid(pid int, pgid int) (err error) = SYS_SETPGID +//sysnb Setrlimit(resource int, lim *Rlimit) (err error) +//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID +//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID +//sysnb Setsid() (pid int, err error) = SYS_SETSID +//sys Setuid(uid int) (err error) = SYS_SETUID +//sys Setgid(uid int) (err error) = SYS_SETGID +//sys Shutdown(fd int, how int) (err error) +//sys stat(path string, statLE *Stat_LE_t) (err error) = SYS___STAT_A + +func Stat(path string, sta *Stat_t) (err error) { + var statLE Stat_LE_t + err = stat(path, &statLE) + copyStat(sta, &statLE) + return +} + +//sys Symlink(path string, link string) (err error) = SYS___SYMLINK_A +//sys Sync() = SYS_SYNC +//sys Truncate(path string, length int64) (err error) = SYS___TRUNCATE_A +//sys Tcgetattr(fildes int, termptr *Termios) (err error) = SYS_TCGETATTR +//sys Tcsetattr(fildes int, when int, termptr *Termios) (err error) = SYS_TCSETATTR +//sys Umask(mask int) (oldmask int) +//sys Unlink(path string) (err error) = SYS___UNLINK_A +//sys Utime(path string, utim *Utimbuf) (err error) = SYS___UTIME_A + +//sys open(path string, mode int, perm uint32) (fd int, err error) = SYS___OPEN_A + +func Open(path string, mode int, perm uint32) (fd int, err error) { + return open(path, mode, perm) +} + +func Mkfifoat(dirfd int, path string, mode uint32) (err error) { + wd, err := Getwd() + if err != nil { + return err + } + + if err := Fchdir(dirfd); err != nil { + return err + } + defer Chdir(wd) + + return Mkfifo(path, mode) +} + +//sys remove(path string) (err error) + +func Remove(path string) error { + return remove(path) +} + +const ImplementsGetwd = true + +func Getcwd(buf []byte) (n int, err error) { + var p unsafe.Pointer + if len(buf) > 0 { + p = unsafe.Pointer(&buf[0]) + } else { + p = unsafe.Pointer(&_zero) + } + _, _, e := syscall_syscall(SYS___GETCWD_A, uintptr(p), uintptr(len(buf)), 0) + n = clen(buf) + 1 + if e != 0 { + err = errnoErr(e) + } + return +} + +func Getwd() (wd string, err error) { + var buf [PathMax]byte + n, err := Getcwd(buf[0:]) + if err != nil { + return "", err + } + // Getcwd returns the number of bytes written to buf, including the NUL. + if n < 1 || n > len(buf) || buf[n-1] != 0 { + return "", EINVAL + } + return string(buf[0 : n-1]), nil +} + +func Getgroups() (gids []int, err error) { + n, err := getgroups(0, nil) + if err != nil { + return nil, err + } + if n == 0 { + return nil, nil + } + + // Sanity check group count. Max is 1<<16 on Linux. + if n < 0 || n > 1<<20 { + return nil, EINVAL + } + + a := make([]_Gid_t, n) + n, err = getgroups(n, &a[0]) + if err != nil { + return nil, err + } + gids = make([]int, n) + for i, v := range a[0:n] { + gids[i] = int(v) + } + return +} + +func Setgroups(gids []int) (err error) { + if len(gids) == 0 { + return setgroups(0, nil) + } + + a := make([]_Gid_t, len(gids)) + for i, v := range gids { + a[i] = _Gid_t(v) + } + return setgroups(len(a), &a[0]) +} + +func gettid() uint64 + +func Gettid() (tid int) { + return int(gettid()) +} + +type WaitStatus uint32 + +// Wait status is 7 bits at bottom, either 0 (exited), +// 0x7F (stopped), or a signal number that caused an exit. +// The 0x80 bit is whether there was a core dump. +// An extra number (exit code, signal causing a stop) +// is in the high bits. At least that's the idea. +// There are various irregularities. For example, the +// "continued" status is 0xFFFF, distinguishing itself +// from stopped via the core dump bit. + +const ( + mask = 0x7F + core = 0x80 + exited = 0x00 + stopped = 0x7F + shift = 8 +) + +func (w WaitStatus) Exited() bool { return w&mask == exited } + +func (w WaitStatus) Signaled() bool { return w&mask != stopped && w&mask != exited } + +func (w WaitStatus) Stopped() bool { return w&0xFF == stopped } + +func (w WaitStatus) Continued() bool { return w == 0xFFFF } + +func (w WaitStatus) CoreDump() bool { return w.Signaled() && w&core != 0 } + +func (w WaitStatus) ExitStatus() int { + if !w.Exited() { + return -1 + } + return int(w>>shift) & 0xFF +} + +func (w WaitStatus) Signal() Signal { + if !w.Signaled() { + return -1 + } + return Signal(w & mask) +} + +func (w WaitStatus) StopSignal() Signal { + if !w.Stopped() { + return -1 + } + return Signal(w>>shift) & 0xFF +} + +func (w WaitStatus) TrapCause() int { return -1 } + +//sys waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) + +func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { + // TODO(mundaym): z/OS doesn't have wait4. I don't think getrusage does what we want. + // At the moment rusage will not be touched. + var status _C_int + wpid, err = waitpid(pid, &status, options) + if wstatus != nil { + *wstatus = WaitStatus(status) + } + return +} + +//sysnb gettimeofday(tv *timeval_zos) (err error) + +func Gettimeofday(tv *Timeval) (err error) { + var tvz timeval_zos + err = gettimeofday(&tvz) + tv.Sec = tvz.Sec + tv.Usec = int64(tvz.Usec) + return +} + +func Time(t *Time_t) (tt Time_t, err error) { + var tv Timeval + err = Gettimeofday(&tv) + if err != nil { + return 0, err + } + if t != nil { + *t = Time_t(tv.Sec) + } + return Time_t(tv.Sec), nil +} + +func setTimespec(sec, nsec int64) Timespec { + return Timespec{Sec: sec, Nsec: nsec} +} + +func setTimeval(sec, usec int64) Timeval { //fix + return Timeval{Sec: sec, Usec: usec} +} + +//sysnb pipe(p *[2]_C_int) (err error) + +func Pipe(p []int) (err error) { + if len(p) != 2 { + return EINVAL + } + var pp [2]_C_int + err = pipe(&pp) + p[0] = int(pp[0]) + p[1] = int(pp[1]) + return +} + +//sys utimes(path string, timeval *[2]Timeval) (err error) = SYS___UTIMES_A + +func Utimes(path string, tv []Timeval) (err error) { + if len(tv) != 2 { + return EINVAL + } + return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) +} + +func UtimesNano(path string, ts []Timespec) error { + if len(ts) != 2 { + return EINVAL + } + // Not as efficient as it could be because Timespec and + // Timeval have different types in the different OSes + tv := [2]Timeval{ + NsecToTimeval(TimespecToNsec(ts[0])), + NsecToTimeval(TimespecToNsec(ts[1])), + } + return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0]))) +} + +func Getsockname(fd int) (sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + if err = getsockname(fd, &rsa, &len); err != nil { + return + } + // TODO(neeilan) : Remove this 0 ( added to get sys/unix compiling on z/OS ) + return anyToSockaddr(0, &rsa) +} + +const ( + // identifier constants + nwmHeaderIdentifier = 0xd5e6d4c8 + nwmFilterIdentifier = 0xd5e6d4c6 + nwmTCPConnIdentifier = 0xd5e6d4c3 + nwmRecHeaderIdentifier = 0xd5e6d4d9 + nwmIPStatsIdentifier = 0xd5e6d4c9d7e2e340 + nwmIPGStatsIdentifier = 0xd5e6d4c9d7c7e2e3 + nwmTCPStatsIdentifier = 0xd5e6d4e3c3d7e2e3 + nwmUDPStatsIdentifier = 0xd5e6d4e4c4d7e2e3 + nwmICMPGStatsEntry = 0xd5e6d4c9c3d4d7c7 + nwmICMPTStatsEntry = 0xd5e6d4c9c3d4d7e3 + + // nwmHeader constants + nwmVersion1 = 1 + nwmVersion2 = 2 + nwmCurrentVer = 2 + + nwmTCPConnType = 1 + nwmGlobalStatsType = 14 + + // nwmFilter constants + nwmFilterLclAddrMask = 0x20000000 // Local address + nwmFilterSrcAddrMask = 0x20000000 // Source address + nwmFilterLclPortMask = 0x10000000 // Local port + nwmFilterSrcPortMask = 0x10000000 // Source port + + // nwmConnEntry constants + nwmTCPStateClosed = 1 + nwmTCPStateListen = 2 + nwmTCPStateSynSent = 3 + nwmTCPStateSynRcvd = 4 + nwmTCPStateEstab = 5 + nwmTCPStateFinWait1 = 6 + nwmTCPStateFinWait2 = 7 + nwmTCPStateClosWait = 8 + nwmTCPStateLastAck = 9 + nwmTCPStateClosing = 10 + nwmTCPStateTimeWait = 11 + nwmTCPStateDeletTCB = 12 + + // Existing constants on linux + BPF_TCP_CLOSE = 1 + BPF_TCP_LISTEN = 2 + BPF_TCP_SYN_SENT = 3 + BPF_TCP_SYN_RECV = 4 + BPF_TCP_ESTABLISHED = 5 + BPF_TCP_FIN_WAIT1 = 6 + BPF_TCP_FIN_WAIT2 = 7 + BPF_TCP_CLOSE_WAIT = 8 + BPF_TCP_LAST_ACK = 9 + BPF_TCP_CLOSING = 10 + BPF_TCP_TIME_WAIT = 11 + BPF_TCP_NEW_SYN_RECV = -1 + BPF_TCP_MAX_STATES = -2 +) + +type nwmTriplet struct { + offset uint32 + length uint32 + number uint32 +} + +type nwmQuadruplet struct { + offset uint32 + length uint32 + number uint32 + match uint32 +} + +type nwmHeader struct { + ident uint32 + length uint32 + version uint16 + nwmType uint16 + bytesNeeded uint32 + options uint32 + _ [16]byte + inputDesc nwmTriplet + outputDesc nwmQuadruplet +} + +type nwmFilter struct { + ident uint32 + flags uint32 + resourceName [8]byte + resourceId uint32 + listenerId uint32 + local [28]byte // union of sockaddr4 and sockaddr6 + remote [28]byte // union of sockaddr4 and sockaddr6 + _ uint16 + _ uint16 + asid uint16 + _ [2]byte + tnLuName [8]byte + tnMonGrp uint32 + tnAppl [8]byte + applData [40]byte + nInterface [16]byte + dVipa [16]byte + dVipaPfx uint16 + dVipaPort uint16 + dVipaFamily byte + _ [3]byte + destXCF [16]byte + destXCFPfx uint16 + destXCFFamily byte + _ [1]byte + targIP [16]byte + targIPPfx uint16 + targIPFamily byte + _ [1]byte + _ [20]byte +} + +type nwmRecHeader struct { + ident uint32 + length uint32 + number byte + _ [3]byte +} + +type nwmTCPStatsEntry struct { + ident uint64 + currEstab uint32 + activeOpened uint32 + passiveOpened uint32 + connClosed uint32 + estabResets uint32 + attemptFails uint32 + passiveDrops uint32 + timeWaitReused uint32 + inSegs uint64 + predictAck uint32 + predictData uint32 + inDupAck uint32 + inBadSum uint32 + inBadLen uint32 + inShort uint32 + inDiscOldTime uint32 + inAllBeforeWin uint32 + inSomeBeforeWin uint32 + inAllAfterWin uint32 + inSomeAfterWin uint32 + inOutOfOrder uint32 + inAfterClose uint32 + inWinProbes uint32 + inWinUpdates uint32 + outWinUpdates uint32 + outSegs uint64 + outDelayAcks uint32 + outRsts uint32 + retransSegs uint32 + retransTimeouts uint32 + retransDrops uint32 + pmtuRetrans uint32 + pmtuErrors uint32 + outWinProbes uint32 + probeDrops uint32 + keepAliveProbes uint32 + keepAliveDrops uint32 + finwait2Drops uint32 + acceptCount uint64 + inBulkQSegs uint64 + inDiscards uint64 + connFloods uint32 + connStalls uint32 + cfgEphemDef uint16 + ephemInUse uint16 + ephemHiWater uint16 + flags byte + _ [1]byte + ephemExhaust uint32 + smcRCurrEstabLnks uint32 + smcRLnkActTimeOut uint32 + smcRActLnkOpened uint32 + smcRPasLnkOpened uint32 + smcRLnksClosed uint32 + smcRCurrEstab uint32 + smcRActiveOpened uint32 + smcRPassiveOpened uint32 + smcRConnClosed uint32 + smcRInSegs uint64 + smcROutSegs uint64 + smcRInRsts uint32 + smcROutRsts uint32 + smcDCurrEstabLnks uint32 + smcDActLnkOpened uint32 + smcDPasLnkOpened uint32 + smcDLnksClosed uint32 + smcDCurrEstab uint32 + smcDActiveOpened uint32 + smcDPassiveOpened uint32 + smcDConnClosed uint32 + smcDInSegs uint64 + smcDOutSegs uint64 + smcDInRsts uint32 + smcDOutRsts uint32 +} + +type nwmConnEntry struct { + ident uint32 + local [28]byte // union of sockaddr4 and sockaddr6 + remote [28]byte // union of sockaddr4 and sockaddr6 + startTime [8]byte // uint64, changed to prevent padding from being inserted + lastActivity [8]byte // uint64 + bytesIn [8]byte // uint64 + bytesOut [8]byte // uint64 + inSegs [8]byte // uint64 + outSegs [8]byte // uint64 + state uint16 + activeOpen byte + flag01 byte + outBuffered uint32 + inBuffered uint32 + maxSndWnd uint32 + reXmtCount uint32 + congestionWnd uint32 + ssThresh uint32 + roundTripTime uint32 + roundTripVar uint32 + sendMSS uint32 + sndWnd uint32 + rcvBufSize uint32 + sndBufSize uint32 + outOfOrderCount uint32 + lcl0WindowCount uint32 + rmt0WindowCount uint32 + dupacks uint32 + flag02 byte + sockOpt6Cont byte + asid uint16 + resourceName [8]byte + resourceId uint32 + subtask uint32 + sockOpt byte + sockOpt6 byte + clusterConnFlag byte + proto byte + targetAppl [8]byte + luName [8]byte + clientUserId [8]byte + logMode [8]byte + timeStamp uint32 + timeStampAge uint32 + serverResourceId uint32 + intfName [16]byte + ttlsStatPol byte + ttlsStatConn byte + ttlsSSLProt uint16 + ttlsNegCiph [2]byte + ttlsSecType byte + ttlsFIPS140Mode byte + ttlsUserID [8]byte + applData [40]byte + inOldestTime [8]byte // uint64 + outOldestTime [8]byte // uint64 + tcpTrustedPartner byte + _ [3]byte + bulkDataIntfName [16]byte + ttlsNegCiph4 [4]byte + smcReason uint32 + lclSMCLinkId uint32 + rmtSMCLinkId uint32 + smcStatus byte + smcFlags byte + _ [2]byte + rcvWnd uint32 + lclSMCBufSz uint32 + rmtSMCBufSz uint32 + ttlsSessID [32]byte + ttlsSessIDLen int16 + _ [1]byte + smcDStatus byte + smcDReason uint32 +} + +var svcNameTable [][]byte = [][]byte{ + []byte("\xc5\xe9\xc2\xd5\xd4\xc9\xc6\xf4"), // svc_EZBNMIF4 +} + +const ( + svc_EZBNMIF4 = 0 +) + +func GetsockoptTCPInfo(fd, level, opt int) (*TCPInfo, error) { + jobname := []byte("\x5c\x40\x40\x40\x40\x40\x40\x40") // "*" + responseBuffer := [4096]byte{0} + var bufferAlet, reasonCode uint32 = 0, 0 + var bufferLen, returnValue, returnCode int32 = 4096, 0, 0 + + dsa := [18]uint64{0} + var argv [7]unsafe.Pointer + argv[0] = unsafe.Pointer(&jobname[0]) + argv[1] = unsafe.Pointer(&responseBuffer[0]) + argv[2] = unsafe.Pointer(&bufferAlet) + argv[3] = unsafe.Pointer(&bufferLen) + argv[4] = unsafe.Pointer(&returnValue) + argv[5] = unsafe.Pointer(&returnCode) + argv[6] = unsafe.Pointer(&reasonCode) + + request := (*struct { + header nwmHeader + filter nwmFilter + })(unsafe.Pointer(&responseBuffer[0])) + + EZBNMIF4 := svcLoad(&svcNameTable[svc_EZBNMIF4][0]) + if EZBNMIF4 == nil { + return nil, errnoErr(EINVAL) + } + + // GetGlobalStats EZBNMIF4 call + request.header.ident = nwmHeaderIdentifier + request.header.length = uint32(unsafe.Sizeof(request.header)) + request.header.version = nwmCurrentVer + request.header.nwmType = nwmGlobalStatsType + request.header.options = 0x80000000 + + svcCall(EZBNMIF4, &argv[0], &dsa[0]) + + // outputDesc field is filled by EZBNMIF4 on success + if returnCode != 0 || request.header.outputDesc.offset == 0 { + return nil, errnoErr(EINVAL) + } + + // Check that EZBNMIF4 returned a nwmRecHeader + recHeader := (*nwmRecHeader)(unsafe.Pointer(&responseBuffer[request.header.outputDesc.offset])) + if recHeader.ident != nwmRecHeaderIdentifier { + return nil, errnoErr(EINVAL) + } + + // Parse nwmTriplets to get offsets of returned entries + var sections []*uint64 + var sectionDesc *nwmTriplet = (*nwmTriplet)(unsafe.Pointer(&responseBuffer[0])) + for i := uint32(0); i < uint32(recHeader.number); i++ { + offset := request.header.outputDesc.offset + uint32(unsafe.Sizeof(*recHeader)) + i*uint32(unsafe.Sizeof(*sectionDesc)) + sectionDesc = (*nwmTriplet)(unsafe.Pointer(&responseBuffer[offset])) + for j := uint32(0); j < sectionDesc.number; j++ { + offset = request.header.outputDesc.offset + sectionDesc.offset + j*sectionDesc.length + sections = append(sections, (*uint64)(unsafe.Pointer(&responseBuffer[offset]))) + } + } + + // Find nwmTCPStatsEntry in returned entries + var tcpStats *nwmTCPStatsEntry = nil + for _, ptr := range sections { + switch *ptr { + case nwmTCPStatsIdentifier: + if tcpStats != nil { + return nil, errnoErr(EINVAL) + } + tcpStats = (*nwmTCPStatsEntry)(unsafe.Pointer(ptr)) + case nwmIPStatsIdentifier: + case nwmIPGStatsIdentifier: + case nwmUDPStatsIdentifier: + case nwmICMPGStatsEntry: + case nwmICMPTStatsEntry: + default: + return nil, errnoErr(EINVAL) + } + } + if tcpStats == nil { + return nil, errnoErr(EINVAL) + } + + // GetConnectionDetail EZBNMIF4 call + responseBuffer = [4096]byte{0} + dsa = [18]uint64{0} + bufferAlet, reasonCode = 0, 0 + bufferLen, returnValue, returnCode = 4096, 0, 0 + nameptr := (*uint32)(unsafe.Pointer(uintptr(0x21c))) // Get jobname of current process + nameptr = (*uint32)(unsafe.Pointer(uintptr(*nameptr + 12))) + argv[0] = unsafe.Pointer(uintptr(*nameptr)) + + request.header.ident = nwmHeaderIdentifier + request.header.length = uint32(unsafe.Sizeof(request.header)) + request.header.version = nwmCurrentVer + request.header.nwmType = nwmTCPConnType + request.header.options = 0x80000000 + + request.filter.ident = nwmFilterIdentifier + + var localSockaddr RawSockaddrAny + socklen := _Socklen(SizeofSockaddrAny) + err := getsockname(fd, &localSockaddr, &socklen) + if err != nil { + return nil, errnoErr(EINVAL) + } + if localSockaddr.Addr.Family == AF_INET { + localSockaddr := (*RawSockaddrInet4)(unsafe.Pointer(&localSockaddr.Addr)) + localSockFilter := (*RawSockaddrInet4)(unsafe.Pointer(&request.filter.local[0])) + localSockFilter.Family = AF_INET + var i int + for i = 0; i < 4; i++ { + if localSockaddr.Addr[i] != 0 { + break + } + } + if i != 4 { + request.filter.flags |= nwmFilterLclAddrMask + for i = 0; i < 4; i++ { + localSockFilter.Addr[i] = localSockaddr.Addr[i] + } + } + if localSockaddr.Port != 0 { + request.filter.flags |= nwmFilterLclPortMask + localSockFilter.Port = localSockaddr.Port + } + } else if localSockaddr.Addr.Family == AF_INET6 { + localSockaddr := (*RawSockaddrInet6)(unsafe.Pointer(&localSockaddr.Addr)) + localSockFilter := (*RawSockaddrInet6)(unsafe.Pointer(&request.filter.local[0])) + localSockFilter.Family = AF_INET6 + var i int + for i = 0; i < 16; i++ { + if localSockaddr.Addr[i] != 0 { + break + } + } + if i != 16 { + request.filter.flags |= nwmFilterLclAddrMask + for i = 0; i < 16; i++ { + localSockFilter.Addr[i] = localSockaddr.Addr[i] + } + } + if localSockaddr.Port != 0 { + request.filter.flags |= nwmFilterLclPortMask + localSockFilter.Port = localSockaddr.Port + } + } + + svcCall(EZBNMIF4, &argv[0], &dsa[0]) + + // outputDesc field is filled by EZBNMIF4 on success + if returnCode != 0 || request.header.outputDesc.offset == 0 { + return nil, errnoErr(EINVAL) + } + + // Check that EZBNMIF4 returned a nwmConnEntry + conn := (*nwmConnEntry)(unsafe.Pointer(&responseBuffer[request.header.outputDesc.offset])) + if conn.ident != nwmTCPConnIdentifier { + return nil, errnoErr(EINVAL) + } + + // Copy data from the returned data structures into tcpInfo + // Stats from nwmConnEntry are specific to that connection. + // Stats from nwmTCPStatsEntry are global (to the interface?) + // Fields may not be an exact match. Some fields have no equivalent. + var tcpinfo TCPInfo + tcpinfo.State = uint8(conn.state) + tcpinfo.Ca_state = 0 // dummy + tcpinfo.Retransmits = uint8(tcpStats.retransSegs) + tcpinfo.Probes = uint8(tcpStats.outWinProbes) + tcpinfo.Backoff = 0 // dummy + tcpinfo.Options = 0 // dummy + tcpinfo.Rto = tcpStats.retransTimeouts + tcpinfo.Ato = tcpStats.outDelayAcks + tcpinfo.Snd_mss = conn.sendMSS + tcpinfo.Rcv_mss = conn.sendMSS // dummy + tcpinfo.Unacked = 0 // dummy + tcpinfo.Sacked = 0 // dummy + tcpinfo.Lost = 0 // dummy + tcpinfo.Retrans = conn.reXmtCount + tcpinfo.Fackets = 0 // dummy + tcpinfo.Last_data_sent = uint32(*(*uint64)(unsafe.Pointer(&conn.lastActivity[0]))) + tcpinfo.Last_ack_sent = uint32(*(*uint64)(unsafe.Pointer(&conn.outOldestTime[0]))) + tcpinfo.Last_data_recv = uint32(*(*uint64)(unsafe.Pointer(&conn.inOldestTime[0]))) + tcpinfo.Last_ack_recv = uint32(*(*uint64)(unsafe.Pointer(&conn.inOldestTime[0]))) + tcpinfo.Pmtu = conn.sendMSS // dummy, NWMIfRouteMtu is a candidate + tcpinfo.Rcv_ssthresh = conn.ssThresh + tcpinfo.Rtt = conn.roundTripTime + tcpinfo.Rttvar = conn.roundTripVar + tcpinfo.Snd_ssthresh = conn.ssThresh // dummy + tcpinfo.Snd_cwnd = conn.congestionWnd + tcpinfo.Advmss = conn.sendMSS // dummy + tcpinfo.Reordering = 0 // dummy + tcpinfo.Rcv_rtt = conn.roundTripTime // dummy + tcpinfo.Rcv_space = conn.sendMSS // dummy + tcpinfo.Total_retrans = conn.reXmtCount + + svcUnload(&svcNameTable[svc_EZBNMIF4][0], EZBNMIF4) + + return &tcpinfo, nil +} + +// GetsockoptString returns the string value of the socket option opt for the +// socket associated with fd at the given socket level. +func GetsockoptString(fd, level, opt int) (string, error) { + buf := make([]byte, 256) + vallen := _Socklen(len(buf)) + err := getsockopt(fd, level, opt, unsafe.Pointer(&buf[0]), &vallen) + if err != nil { + return "", err + } + + return string(buf[:vallen-1]), nil +} + +func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) { + var msg Msghdr + var rsa RawSockaddrAny + msg.Name = (*byte)(unsafe.Pointer(&rsa)) + msg.Namelen = SizeofSockaddrAny + var iov Iovec + if len(p) > 0 { + iov.Base = (*byte)(unsafe.Pointer(&p[0])) + iov.SetLen(len(p)) + } + var dummy byte + if len(oob) > 0 { + // receive at least one normal byte + if len(p) == 0 { + iov.Base = &dummy + iov.SetLen(1) + } + msg.Control = (*byte)(unsafe.Pointer(&oob[0])) + msg.SetControllen(len(oob)) + } + msg.Iov = &iov + msg.Iovlen = 1 + if n, err = recvmsg(fd, &msg, flags); err != nil { + return + } + oobn = int(msg.Controllen) + recvflags = int(msg.Flags) + // source address is only specified if the socket is unconnected + if rsa.Addr.Family != AF_UNSPEC { + // TODO(neeilan): Remove 0 arg added to get this compiling on z/OS + from, err = anyToSockaddr(0, &rsa) + } + return +} + +func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) { + _, err = SendmsgN(fd, p, oob, to, flags) + return +} + +func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) { + var ptr unsafe.Pointer + var salen _Socklen + if to != nil { + var err error + ptr, salen, err = to.sockaddr() + if err != nil { + return 0, err + } + } + var msg Msghdr + msg.Name = (*byte)(unsafe.Pointer(ptr)) + msg.Namelen = int32(salen) + var iov Iovec + if len(p) > 0 { + iov.Base = (*byte)(unsafe.Pointer(&p[0])) + iov.SetLen(len(p)) + } + var dummy byte + if len(oob) > 0 { + // send at least one normal byte + if len(p) == 0 { + iov.Base = &dummy + iov.SetLen(1) + } + msg.Control = (*byte)(unsafe.Pointer(&oob[0])) + msg.SetControllen(len(oob)) + } + msg.Iov = &iov + msg.Iovlen = 1 + if n, err = sendmsg(fd, &msg, flags); err != nil { + return 0, err + } + if len(oob) > 0 && len(p) == 0 { + n = 0 + } + return n, nil +} + +func Opendir(name string) (uintptr, error) { + p, err := BytePtrFromString(name) + if err != nil { + return 0, err + } + dir, _, e := syscall_syscall(SYS___OPENDIR_A, uintptr(unsafe.Pointer(p)), 0, 0) + runtime.KeepAlive(unsafe.Pointer(p)) + if e != 0 { + err = errnoErr(e) + } + return dir, err +} + +// clearsyscall.Errno resets the errno value to 0. +func clearErrno() + +func Readdir(dir uintptr) (*Dirent, error) { + var ent Dirent + var res uintptr + // __readdir_r_a returns errno at the end of the directory stream, rather than 0. + // Therefore to avoid false positives we clear errno before calling it. + + // TODO(neeilan): Commented this out to get sys/unix compiling on z/OS. Uncomment and fix. Error: "undefined: clearsyscall" + //clearsyscall.Errno() // TODO(mundaym): check pre-emption rules. + + e, _, _ := syscall_syscall(SYS___READDIR_R_A, dir, uintptr(unsafe.Pointer(&ent)), uintptr(unsafe.Pointer(&res))) + var err error + if e != 0 { + err = errnoErr(Errno(e)) + } + if res == 0 { + return nil, err + } + return &ent, err +} + +func Closedir(dir uintptr) error { + _, _, e := syscall_syscall(SYS_CLOSEDIR, dir, 0, 0) + if e != 0 { + return errnoErr(e) + } + return nil +} + +func Seekdir(dir uintptr, pos int) { + _, _, _ = syscall_syscall(SYS_SEEKDIR, dir, uintptr(pos), 0) +} + +func Telldir(dir uintptr) (int, error) { + p, _, e := syscall_syscall(SYS_TELLDIR, dir, 0, 0) + pos := int(p) + if pos == -1 { + return pos, errnoErr(e) + } + return pos, nil +} + +// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command. +func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error { + // struct flock is packed on z/OS. We can't emulate that in Go so + // instead we pack it here. + var flock [24]byte + *(*int16)(unsafe.Pointer(&flock[0])) = lk.Type + *(*int16)(unsafe.Pointer(&flock[2])) = lk.Whence + *(*int64)(unsafe.Pointer(&flock[4])) = lk.Start + *(*int64)(unsafe.Pointer(&flock[12])) = lk.Len + *(*int32)(unsafe.Pointer(&flock[20])) = lk.Pid + _, _, errno := syscall_syscall(SYS_FCNTL, fd, uintptr(cmd), uintptr(unsafe.Pointer(&flock))) + lk.Type = *(*int16)(unsafe.Pointer(&flock[0])) + lk.Whence = *(*int16)(unsafe.Pointer(&flock[2])) + lk.Start = *(*int64)(unsafe.Pointer(&flock[4])) + lk.Len = *(*int64)(unsafe.Pointer(&flock[12])) + lk.Pid = *(*int32)(unsafe.Pointer(&flock[20])) + if errno == 0 { + return nil + } + return errno +} + +func Flock(fd int, how int) error { + + var flock_type int16 + var fcntl_cmd int + + switch how { + case LOCK_SH | LOCK_NB: + flock_type = F_RDLCK + fcntl_cmd = F_SETLK + case LOCK_EX | LOCK_NB: + flock_type = F_WRLCK + fcntl_cmd = F_SETLK + case LOCK_EX: + flock_type = F_WRLCK + fcntl_cmd = F_SETLKW + case LOCK_UN: + flock_type = F_UNLCK + fcntl_cmd = F_SETLKW + default: + } + + flock := Flock_t{ + Type: int16(flock_type), + Whence: int16(0), + Start: int64(0), + Len: int64(0), + Pid: int32(Getppid()), + } + + err := FcntlFlock(uintptr(fd), fcntl_cmd, &flock) + return err +} + +func Mlock(b []byte) (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func Mlock2(b []byte, flags int) (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func Mlockall(flags int) (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_NONSWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func Munlock(b []byte) (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_SWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func Munlockall() (err error) { + _, _, e1 := syscall_syscall(SYS___MLOCKALL, _BPX_SWAP, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +func ClockGettime(clockid int32, ts *Timespec) error { + + var ticks_per_sec uint32 = 100 //TODO(kenan): value is currently hardcoded; need sysconf() call otherwise + var nsec_per_sec int64 = 1000000000 + + if ts == nil { + return EFAULT + } + if clockid == CLOCK_REALTIME || clockid == CLOCK_MONOTONIC { + var nanotime int64 = runtime.Nanotime1() + ts.Sec = nanotime / nsec_per_sec + ts.Nsec = nanotime % nsec_per_sec + } else if clockid == CLOCK_PROCESS_CPUTIME_ID || clockid == CLOCK_THREAD_CPUTIME_ID { + var tm Tms + _, err := Times(&tm) + if err != nil { + return EFAULT + } + ts.Sec = int64(tm.Utime / ticks_per_sec) + ts.Nsec = int64(tm.Utime) * nsec_per_sec / int64(ticks_per_sec) + } else { + return EINVAL + } + return nil +} + +func Statfs(path string, stat *Statfs_t) (err error) { + fd, err := open(path, O_RDONLY, 0) + defer Close(fd) + if err != nil { + return err + } + return Fstatfs(fd, stat) +} + +var ( + Stdin = 0 + Stdout = 1 + Stderr = 2 +) + +// Do the interface allocations only once for common +// Errno values. +var ( + errEAGAIN error = syscall.EAGAIN + errEINVAL error = syscall.EINVAL + errENOENT error = syscall.ENOENT +) + +var ( + signalNameMapOnce sync.Once + signalNameMap map[string]syscall.Signal +) + +// errnoErr returns common boxed Errno values, to prevent +// allocations at runtime. +func errnoErr(e Errno) error { + switch e { + case 0: + return nil + case EAGAIN: + return errEAGAIN + case EINVAL: + return errEINVAL + case ENOENT: + return errENOENT + } + return e +} + +// ErrnoName returns the error name for error number e. +func ErrnoName(e Errno) string { + i := sort.Search(len(errorList), func(i int) bool { + return errorList[i].num >= e + }) + if i < len(errorList) && errorList[i].num == e { + return errorList[i].name + } + return "" +} + +// SignalName returns the signal name for signal number s. +func SignalName(s syscall.Signal) string { + i := sort.Search(len(signalList), func(i int) bool { + return signalList[i].num >= s + }) + if i < len(signalList) && signalList[i].num == s { + return signalList[i].name + } + return "" +} + +// SignalNum returns the syscall.Signal for signal named s, +// or 0 if a signal with such name is not found. +// The signal name should start with "SIG". +func SignalNum(s string) syscall.Signal { + signalNameMapOnce.Do(func() { + signalNameMap = make(map[string]syscall.Signal, len(signalList)) + for _, signal := range signalList { + signalNameMap[signal.name] = signal.num + } + }) + return signalNameMap[s] +} + +// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte. +func clen(n []byte) int { + i := bytes.IndexByte(n, 0) + if i == -1 { + i = len(n) + } + return i +} + +// Mmap manager, for use by operating system-specific implementations. + +type mmapper struct { + sync.Mutex + active map[*byte][]byte // active mappings; key is last byte in mapping + mmap func(addr, length uintptr, prot, flags, fd int, offset int64) (uintptr, error) + munmap func(addr uintptr, length uintptr) error +} + +func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, err error) { + if length <= 0 { + return nil, EINVAL + } + + // Map the requested memory. + addr, errno := m.mmap(0, uintptr(length), prot, flags, fd, offset) + if errno != nil { + return nil, errno + } + + // Slice memory layout + var sl = struct { + addr uintptr + len int + cap int + }{addr, length, length} + + // Use unsafe to turn sl into a []byte. + b := *(*[]byte)(unsafe.Pointer(&sl)) + + // Register mapping in m and return it. + p := &b[cap(b)-1] + m.Lock() + defer m.Unlock() + m.active[p] = b + return b, nil +} + +func (m *mmapper) Munmap(data []byte) (err error) { + if len(data) == 0 || len(data) != cap(data) { + return EINVAL + } + + // Find the base of the mapping. + p := &data[cap(data)-1] + m.Lock() + defer m.Unlock() + b := m.active[p] + if b == nil || &b[0] != &data[0] { + return EINVAL + } + + // Unmap the memory and update m. + if errno := m.munmap(uintptr(unsafe.Pointer(&b[0])), uintptr(len(b))); errno != nil { + return errno + } + delete(m.active, p) + return nil +} + +func Read(fd int, p []byte) (n int, err error) { + n, err = read(fd, p) + if raceenabled { + if n > 0 { + raceWriteRange(unsafe.Pointer(&p[0]), n) + } + if err == nil { + raceAcquire(unsafe.Pointer(&ioSync)) + } + } + return +} + +func Write(fd int, p []byte) (n int, err error) { + if raceenabled { + raceReleaseMerge(unsafe.Pointer(&ioSync)) + } + n, err = write(fd, p) + if raceenabled && n > 0 { + raceReadRange(unsafe.Pointer(&p[0]), n) + } + return +} + +// For testing: clients can set this flag to force +// creation of IPv6 sockets to return EAFNOSUPPORT. +var SocketDisableIPv6 bool + +// Sockaddr represents a socket address. +type Sockaddr interface { + sockaddr() (ptr unsafe.Pointer, len _Socklen, err error) // lowercase; only we can define Sockaddrs +} + +// SockaddrInet4 implements the Sockaddr interface for AF_INET type sockets. +type SockaddrInet4 struct { + Port int + Addr [4]byte + raw RawSockaddrInet4 +} + +// SockaddrInet6 implements the Sockaddr interface for AF_INET6 type sockets. +type SockaddrInet6 struct { + Port int + ZoneId uint32 + Addr [16]byte + raw RawSockaddrInet6 +} + +// SockaddrUnix implements the Sockaddr interface for AF_UNIX type sockets. +type SockaddrUnix struct { + Name string + raw RawSockaddrUnix +} + +func Bind(fd int, sa Sockaddr) (err error) { + ptr, n, err := sa.sockaddr() + if err != nil { + return err + } + return bind(fd, ptr, n) +} + +func Connect(fd int, sa Sockaddr) (err error) { + ptr, n, err := sa.sockaddr() + if err != nil { + return err + } + return connect(fd, ptr, n) +} + +func Getpeername(fd int) (sa Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + if err = getpeername(fd, &rsa, &len); err != nil { + return + } + return anyToSockaddr(fd, &rsa) +} + +func GetsockoptByte(fd, level, opt int) (value byte, err error) { + var n byte + vallen := _Socklen(1) + err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen) + return n, err +} + +func GetsockoptInt(fd, level, opt int) (value int, err error) { + var n int32 + vallen := _Socklen(4) + err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen) + return int(n), err +} + +func GetsockoptInet4Addr(fd, level, opt int) (value [4]byte, err error) { + vallen := _Socklen(4) + err = getsockopt(fd, level, opt, unsafe.Pointer(&value[0]), &vallen) + return value, err +} + +func GetsockoptIPMreq(fd, level, opt int) (*IPMreq, error) { + var value IPMreq + vallen := _Socklen(SizeofIPMreq) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + +func GetsockoptIPv6Mreq(fd, level, opt int) (*IPv6Mreq, error) { + var value IPv6Mreq + vallen := _Socklen(SizeofIPv6Mreq) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + +func GetsockoptIPv6MTUInfo(fd, level, opt int) (*IPv6MTUInfo, error) { + var value IPv6MTUInfo + vallen := _Socklen(SizeofIPv6MTUInfo) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + +func GetsockoptICMPv6Filter(fd, level, opt int) (*ICMPv6Filter, error) { + var value ICMPv6Filter + vallen := _Socklen(SizeofICMPv6Filter) + err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen) + return &value, err +} + +func GetsockoptLinger(fd, level, opt int) (*Linger, error) { + var linger Linger + vallen := _Socklen(SizeofLinger) + err := getsockopt(fd, level, opt, unsafe.Pointer(&linger), &vallen) + return &linger, err +} + +func GetsockoptTimeval(fd, level, opt int) (*Timeval, error) { + var tv Timeval + vallen := _Socklen(unsafe.Sizeof(tv)) + err := getsockopt(fd, level, opt, unsafe.Pointer(&tv), &vallen) + return &tv, err +} + +func GetsockoptUint64(fd, level, opt int) (value uint64, err error) { + var n uint64 + vallen := _Socklen(8) + err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen) + return n, err +} + +func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { + var rsa RawSockaddrAny + var len _Socklen = SizeofSockaddrAny + if n, err = recvfrom(fd, p, flags, &rsa, &len); err != nil { + return + } + if rsa.Addr.Family != AF_UNSPEC { + from, err = anyToSockaddr(fd, &rsa) + } + return +} + +func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) { + ptr, n, err := to.sockaddr() + if err != nil { + return err + } + return sendto(fd, p, flags, ptr, n) +} + +func SetsockoptByte(fd, level, opt int, value byte) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(&value), 1) +} + +func SetsockoptInt(fd, level, opt int, value int) (err error) { + var n = int32(value) + return setsockopt(fd, level, opt, unsafe.Pointer(&n), 4) +} + +func SetsockoptInet4Addr(fd, level, opt int, value [4]byte) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(&value[0]), 4) +} + +func SetsockoptIPMreq(fd, level, opt int, mreq *IPMreq) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(mreq), SizeofIPMreq) +} + +func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(mreq), SizeofIPv6Mreq) +} + +func SetsockoptICMPv6Filter(fd, level, opt int, filter *ICMPv6Filter) error { + return setsockopt(fd, level, opt, unsafe.Pointer(filter), SizeofICMPv6Filter) +} + +func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(l), SizeofLinger) +} + +func SetsockoptString(fd, level, opt int, s string) (err error) { + var p unsafe.Pointer + if len(s) > 0 { + p = unsafe.Pointer(&[]byte(s)[0]) + } + return setsockopt(fd, level, opt, p, uintptr(len(s))) +} + +func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv)) +} + +func SetsockoptUint64(fd, level, opt int, value uint64) (err error) { + return setsockopt(fd, level, opt, unsafe.Pointer(&value), 8) +} + +func Socket(domain, typ, proto int) (fd int, err error) { + if domain == AF_INET6 && SocketDisableIPv6 { + return -1, EAFNOSUPPORT + } + fd, err = socket(domain, typ, proto) + return +} + +func Socketpair(domain, typ, proto int) (fd [2]int, err error) { + var fdx [2]int32 + err = socketpair(domain, typ, proto, &fdx) + if err == nil { + fd[0] = int(fdx[0]) + fd[1] = int(fdx[1]) + } + return +} + +var ioSync int64 + +func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) } + +func SetNonblock(fd int, nonblocking bool) (err error) { + flag, err := fcntl(fd, F_GETFL, 0) + if err != nil { + return err + } + if nonblocking { + flag |= O_NONBLOCK + } else { + flag &= ^O_NONBLOCK + } + _, err = fcntl(fd, F_SETFL, flag) + return err +} + +// Exec calls execve(2), which replaces the calling executable in the process +// tree. argv0 should be the full path to an executable ("/bin/ls") and the +// executable name should also be the first argument in argv (["ls", "-l"]). +// envv are the environment variables that should be passed to the new +// process (["USER=go", "PWD=/tmp"]). +func Exec(argv0 string, argv []string, envv []string) error { + return syscall.Exec(argv0, argv, envv) +} + +func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) { + if needspace := 8 - len(fstype); needspace <= 0 { + fstype = fstype[:8] + } else { + fstype += " "[:needspace] + } + return mount_LE(target, source, fstype, uint32(flags), int32(len(data)), data) +} + +func Unmount(name string, mtm int) (err error) { + // mountpoint is always a full path and starts with a '/' + // check if input string is not a mountpoint but a filesystem name + if name[0] != '/' { + return unmount(name, mtm) + } + // treat name as mountpoint + b2s := func(arr []byte) string { + nulli := bytes.IndexByte(arr, 0) + if nulli == -1 { + return string(arr) + } else { + return string(arr[:nulli]) + } + } + var buffer struct { + header W_Mnth + fsinfo [64]W_Mntent + } + fsCount, err := W_Getmntent_A((*byte)(unsafe.Pointer(&buffer)), int(unsafe.Sizeof(buffer))) + if err != nil { + return err + } + if fsCount == 0 { + return EINVAL + } + for i := 0; i < fsCount; i++ { + if b2s(buffer.fsinfo[i].Mountpoint[:]) == name { + err = unmount(b2s(buffer.fsinfo[i].Fsname[:]), mtm) + break + } + } + return err +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_linux.go b/vendor/golang.org/x/sys/unix/sysvshm_linux.go new file mode 100644 index 0000000000..2c3a4437f0 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_linux.go @@ -0,0 +1,21 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build linux +// +build linux + +package unix + +import "runtime" + +// SysvShmCtl performs control operations on the shared memory segment +// specified by id. +func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { + if runtime.GOARCH == "arm" || + runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { + cmd |= ipc_64 + } + + return shmctl(id, cmd, desc) +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go new file mode 100644 index 0000000000..0bb4c8de55 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix.go @@ -0,0 +1,61 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build (darwin && !ios) || linux +// +build darwin,!ios linux + +package unix + +import ( + "unsafe" + + "golang.org/x/sys/internal/unsafeheader" +) + +// SysvShmAttach attaches the Sysv shared memory segment associated with the +// shared memory identifier id. +func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) { + addr, errno := shmat(id, addr, flag) + if errno != nil { + return nil, errno + } + + // Retrieve the size of the shared memory to enable slice creation + var info SysvShmDesc + + _, err := SysvShmCtl(id, IPC_STAT, &info) + if err != nil { + // release the shared memory if we can't find the size + + // ignoring error from shmdt as there's nothing sensible to return here + shmdt(addr) + return nil, err + } + + // Use unsafe to convert addr into a []byte. + // TODO: convert to unsafe.Slice once we can assume Go 1.17 + var b []byte + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b)) + hdr.Data = unsafe.Pointer(addr) + hdr.Cap = int(info.Segsz) + hdr.Len = int(info.Segsz) + return b, nil +} + +// SysvShmDetach unmaps the shared memory slice returned from SysvShmAttach. +// +// It is not safe to use the slice after calling this function. +func SysvShmDetach(data []byte) error { + if len(data) == 0 { + return EINVAL + } + + return shmdt(uintptr(unsafe.Pointer(&data[0]))) +} + +// SysvShmGet returns the Sysv shared memory identifier associated with key. +// If the IPC_CREAT flag is specified a new segment is created. +func SysvShmGet(key, size, flag int) (id int, err error) { + return shmget(key, size, flag) +} diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go new file mode 100644 index 0000000000..71bddefdb8 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/sysvshm_unix_other.go @@ -0,0 +1,14 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build darwin && !ios +// +build darwin,!ios + +package unix + +// SysvShmCtl performs control operations on the shared memory segment +// specified by id. +func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { + return shmctl(id, cmd, desc) +} diff --git a/vendor/golang.org/x/sys/unix/timestruct.go b/vendor/golang.org/x/sys/unix/timestruct.go index 4a672f5694..3d89304055 100644 --- a/vendor/golang.org/x/sys/unix/timestruct.go +++ b/vendor/golang.org/x/sys/unix/timestruct.go @@ -2,18 +2,17 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris +//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos package unix import "time" -// TimespecToNsec converts a Timespec value into a number of -// nanoseconds since the Unix epoch. -func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } +// TimespecToNSec returns the time stored in ts as nanoseconds. +func TimespecToNsec(ts Timespec) int64 { return ts.Nano() } -// NsecToTimespec takes a number of nanoseconds since the Unix epoch -// and returns the corresponding Timespec value. +// NsecToTimespec converts a number of nanoseconds into a Timespec. func NsecToTimespec(nsec int64) Timespec { sec := nsec / 1e9 nsec = nsec % 1e9 @@ -42,12 +41,10 @@ func TimeToTimespec(t time.Time) (Timespec, error) { return ts, nil } -// TimevalToNsec converts a Timeval value into a number of nanoseconds -// since the Unix epoch. -func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } +// TimevalToNsec returns the time stored in tv as nanoseconds. +func TimevalToNsec(tv Timeval) int64 { return tv.Nano() } -// NsecToTimeval takes a number of nanoseconds since the Unix epoch -// and returns the corresponding Timeval value. +// NsecToTimeval converts a number of nanoseconds into a Timeval. func NsecToTimeval(nsec int64) Timeval { nsec += 999 // round up to microsecond usec := nsec % 1e9 / 1e3 @@ -59,24 +56,22 @@ func NsecToTimeval(nsec int64) Timeval { return setTimeval(sec, usec) } -// Unix returns ts as the number of seconds and nanoseconds elapsed since the -// Unix epoch. +// Unix returns the time stored in ts as seconds plus nanoseconds. func (ts *Timespec) Unix() (sec int64, nsec int64) { return int64(ts.Sec), int64(ts.Nsec) } -// Unix returns tv as the number of seconds and nanoseconds elapsed since the -// Unix epoch. +// Unix returns the time stored in tv as seconds plus nanoseconds. func (tv *Timeval) Unix() (sec int64, nsec int64) { return int64(tv.Sec), int64(tv.Usec) * 1000 } -// Nano returns ts as the number of nanoseconds elapsed since the Unix epoch. +// Nano returns the time stored in ts as nanoseconds. func (ts *Timespec) Nano() int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } -// Nano returns tv as the number of nanoseconds elapsed since the Unix epoch. +// Nano returns the time stored in tv as nanoseconds. func (tv *Timeval) Nano() int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 } diff --git a/vendor/golang.org/x/sys/unix/xattr_bsd.go b/vendor/golang.org/x/sys/unix/xattr_bsd.go index 30c1d71f4e..25df1e3780 100644 --- a/vendor/golang.org/x/sys/unix/xattr_bsd.go +++ b/vendor/golang.org/x/sys/unix/xattr_bsd.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build freebsd || netbsd // +build freebsd netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go index 104994bc6a..ca9799b79e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go @@ -1,6 +1,7 @@ // mkerrors.sh -maix32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc && aix // +build ppc,aix // Created by cgo -godefs - DO NOT EDIT diff --git a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go index 4fc8d30649..200c8c26fe 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go @@ -1,6 +1,7 @@ // mkerrors.sh -maix64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && aix // +build ppc64,aix // Code generated by cmd/cgo -godefs; DO NOT EDIT. diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go index e3ff2ee3d4..476a1c7e77 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && darwin // +build amd64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -11,1475 +12,1582 @@ package unix import "syscall" const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x28 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - ALTWERASE = 0x200 - ATTR_BIT_MAP_COUNT = 0x5 - ATTR_CMN_ACCESSMASK = 0x20000 - ATTR_CMN_ACCTIME = 0x1000 - ATTR_CMN_ADDEDTIME = 0x10000000 - ATTR_CMN_BKUPTIME = 0x2000 - ATTR_CMN_CHGTIME = 0x800 - ATTR_CMN_CRTIME = 0x200 - ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 - ATTR_CMN_DEVID = 0x2 - ATTR_CMN_DOCUMENT_ID = 0x100000 - ATTR_CMN_ERROR = 0x20000000 - ATTR_CMN_EXTENDED_SECURITY = 0x400000 - ATTR_CMN_FILEID = 0x2000000 - ATTR_CMN_FLAGS = 0x40000 - ATTR_CMN_FNDRINFO = 0x4000 - ATTR_CMN_FSID = 0x4 - ATTR_CMN_FULLPATH = 0x8000000 - ATTR_CMN_GEN_COUNT = 0x80000 - ATTR_CMN_GRPID = 0x10000 - ATTR_CMN_GRPUUID = 0x1000000 - ATTR_CMN_MODTIME = 0x400 - ATTR_CMN_NAME = 0x1 - ATTR_CMN_NAMEDATTRCOUNT = 0x80000 - ATTR_CMN_NAMEDATTRLIST = 0x100000 - ATTR_CMN_OBJID = 0x20 - ATTR_CMN_OBJPERMANENTID = 0x40 - ATTR_CMN_OBJTAG = 0x10 - ATTR_CMN_OBJTYPE = 0x8 - ATTR_CMN_OWNERID = 0x8000 - ATTR_CMN_PARENTID = 0x4000000 - ATTR_CMN_PAROBJID = 0x80 - ATTR_CMN_RETURNED_ATTRS = 0x80000000 - ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x41c7ff00 - ATTR_CMN_USERACCESS = 0x200000 - ATTR_CMN_UUID = 0x800000 - ATTR_CMN_VALIDMASK = 0xffffffff - ATTR_CMN_VOLSETMASK = 0x6700 - ATTR_FILE_ALLOCSIZE = 0x4 - ATTR_FILE_CLUMPSIZE = 0x10 - ATTR_FILE_DATAALLOCSIZE = 0x400 - ATTR_FILE_DATAEXTENTS = 0x800 - ATTR_FILE_DATALENGTH = 0x200 - ATTR_FILE_DEVTYPE = 0x20 - ATTR_FILE_FILETYPE = 0x40 - ATTR_FILE_FORKCOUNT = 0x80 - ATTR_FILE_FORKLIST = 0x100 - ATTR_FILE_IOBLOCKSIZE = 0x8 - ATTR_FILE_LINKCOUNT = 0x1 - ATTR_FILE_RSRCALLOCSIZE = 0x2000 - ATTR_FILE_RSRCEXTENTS = 0x4000 - ATTR_FILE_RSRCLENGTH = 0x1000 - ATTR_FILE_SETMASK = 0x20 - ATTR_FILE_TOTALSIZE = 0x2 - ATTR_FILE_VALIDMASK = 0x37ff - ATTR_VOL_ALLOCATIONCLUMP = 0x40 - ATTR_VOL_ATTRIBUTES = 0x40000000 - ATTR_VOL_CAPABILITIES = 0x20000 - ATTR_VOL_DIRCOUNT = 0x400 - ATTR_VOL_ENCODINGSUSED = 0x10000 - ATTR_VOL_FILECOUNT = 0x200 - ATTR_VOL_FSTYPE = 0x1 - ATTR_VOL_INFO = 0x80000000 - ATTR_VOL_IOBLOCKSIZE = 0x80 - ATTR_VOL_MAXOBJCOUNT = 0x800 - ATTR_VOL_MINALLOCATION = 0x20 - ATTR_VOL_MOUNTEDDEVICE = 0x8000 - ATTR_VOL_MOUNTFLAGS = 0x4000 - ATTR_VOL_MOUNTPOINT = 0x1000 - ATTR_VOL_NAME = 0x2000 - ATTR_VOL_OBJCOUNT = 0x100 - ATTR_VOL_QUOTA_SIZE = 0x10000000 - ATTR_VOL_RESERVED_SIZE = 0x20000000 - ATTR_VOL_SETMASK = 0x80002000 - ATTR_VOL_SIGNATURE = 0x2 - ATTR_VOL_SIZE = 0x4 - ATTR_VOL_SPACEAVAIL = 0x10 - ATTR_VOL_SPACEFREE = 0x8 - ATTR_VOL_UUID = 0x40000 - ATTR_VOL_VALIDMASK = 0xf007ffff - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80104267 - BIOCSETFNR = 0x8010427e - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_MONOTONIC_RAW_APPROX = 0x5 - CLOCK_PROCESS_CPUTIME_ID = 0xc - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x10 - CLOCK_UPTIME_RAW = 0x8 - CLOCK_UPTIME_RAW_APPROX = 0x9 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x30000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_EXCEPT = -0xf - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xf - EVFILT_THREADMARKER = 0xf - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_DISPATCH2 = 0x180 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EV_UDATA_SPECIFIC = 0x100 - EV_VANISHED = 0x200 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - FSOPT_ATTR_CMN_EXTENDED = 0x20 - FSOPT_NOFOLLOW = 0x1 - FSOPT_NOINMEMUPDATE = 0x2 - FSOPT_PACK_INVAL_ATTRS = 0x8 - FSOPT_REPORT_FULLSIZE = 0x4 - F_ADDFILESIGS = 0x3d - F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 - F_ADDFILESIGS_RETURN = 0x61 - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_BARRIERFSYNC = 0x55 - F_CHECK_LV = 0x62 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_PUNCHHOLE = 0x63 - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_TRIM_ACTIVE_FILE = 0x64 - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x300 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTOS = 0x1b - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_PAGEOUT = 0xa - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_RESILIENT_CODESIGN = 0x2000 - MAP_RESILIENT_MEDIA = 0x4000 - MAP_SHARED = 0x1 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x400000 - MNT_CMDFLAGS = 0xf0000 - MNT_CPROTECT = 0x80 - MNT_DEFWRITE = 0x2000000 - MNT_DONTBROWSE = 0x100000 - MNT_DOVOLFS = 0x8000 - MNT_DWAIT = 0x4 - MNT_EXPORTED = 0x100 - MNT_FORCE = 0x80000 - MNT_IGNORE_OWNERSHIP = 0x200000 - MNT_JOURNALED = 0x800000 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NOATIME = 0x10000000 - MNT_NOBLOCK = 0x20000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOUSERXATTR = 0x1000000 - MNT_NOWAIT = 0x2 - MNT_QUARANTINE = 0x400 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UNKNOWNPERMISSIONS = 0x200000 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x17f0f5ff - MNT_WAIT = 0x1 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NFDBITS = 0x20 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLDLY = 0x300 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_FUNLOCK = 0x100 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_MACH_CONTINUOUS_TIME = 0x80 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_OOB = 0x2 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DP_GETRAWUNENCRYPTED = 0x2 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc028697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc00c6924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc02c6938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106981 - SIOCRSLVMULTI = 0xc010693b - SIOCSDRVSPEC = 0x8028697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NETSVC_MARKING_LEVEL = 0x1119 - SO_NET_SERVICE_TYPE = 0x1116 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0x4 - TABDLY = 0xc04 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_CONNECTION_INFO = 0x106 - TCP_ENABLE_ECN = 0x104 - TCP_FASTOPEN = 0x105 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x40487413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x80487414 - TIOCSETAF = 0x80487416 - TIOCSETAW = 0x80487415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VM_LOADAVG = 0x2 - VM_MACHFACTOR = 0x4 - VM_MAXID = 0x6 - VM_METER = 0x1 - VM_SWAPUSAGE = 0x5 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x40 - WSTOPPED = 0x8 - WUNTRACED = 0x2 - XATTR_CREATE = 0x2 - XATTR_NODEFAULT = 0x10 - XATTR_NOFOLLOW = 0x1 - XATTR_NOSECURITY = 0x8 - XATTR_REPLACE = 0x4 - XATTR_SHOWCOMPRESSION = 0x20 + AF_APPLETALK = 0x10 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1c + AF_ECMA = 0x8 + AF_HYLINK = 0xf + AF_IEEE80211 = 0x25 + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x1e + AF_IPX = 0x17 + AF_ISDN = 0x1c + AF_ISO = 0x7 + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x29 + AF_NATM = 0x1f + AF_NDRV = 0x1b + AF_NETBIOS = 0x21 + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PPP = 0x22 + AF_PUP = 0x4 + AF_RESERVED_36 = 0x24 + AF_ROUTE = 0x11 + AF_SIP = 0x18 + AF_SNA = 0xb + AF_SYSTEM = 0x20 + AF_SYS_CONTROL = 0x2 + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + AF_UTUN = 0x26 + AF_VSOCK = 0x28 + ALTWERASE = 0x200 + ATTR_BIT_MAP_COUNT = 0x5 + ATTR_CMN_ACCESSMASK = 0x20000 + ATTR_CMN_ACCTIME = 0x1000 + ATTR_CMN_ADDEDTIME = 0x10000000 + ATTR_CMN_BKUPTIME = 0x2000 + ATTR_CMN_CHGTIME = 0x800 + ATTR_CMN_CRTIME = 0x200 + ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 + ATTR_CMN_DEVID = 0x2 + ATTR_CMN_DOCUMENT_ID = 0x100000 + ATTR_CMN_ERROR = 0x20000000 + ATTR_CMN_EXTENDED_SECURITY = 0x400000 + ATTR_CMN_FILEID = 0x2000000 + ATTR_CMN_FLAGS = 0x40000 + ATTR_CMN_FNDRINFO = 0x4000 + ATTR_CMN_FSID = 0x4 + ATTR_CMN_FULLPATH = 0x8000000 + ATTR_CMN_GEN_COUNT = 0x80000 + ATTR_CMN_GRPID = 0x10000 + ATTR_CMN_GRPUUID = 0x1000000 + ATTR_CMN_MODTIME = 0x400 + ATTR_CMN_NAME = 0x1 + ATTR_CMN_NAMEDATTRCOUNT = 0x80000 + ATTR_CMN_NAMEDATTRLIST = 0x100000 + ATTR_CMN_OBJID = 0x20 + ATTR_CMN_OBJPERMANENTID = 0x40 + ATTR_CMN_OBJTAG = 0x10 + ATTR_CMN_OBJTYPE = 0x8 + ATTR_CMN_OWNERID = 0x8000 + ATTR_CMN_PARENTID = 0x4000000 + ATTR_CMN_PAROBJID = 0x80 + ATTR_CMN_RETURNED_ATTRS = 0x80000000 + ATTR_CMN_SCRIPT = 0x100 + ATTR_CMN_SETMASK = 0x51c7ff00 + ATTR_CMN_USERACCESS = 0x200000 + ATTR_CMN_UUID = 0x800000 + ATTR_CMN_VALIDMASK = 0xffffffff + ATTR_CMN_VOLSETMASK = 0x6700 + ATTR_FILE_ALLOCSIZE = 0x4 + ATTR_FILE_CLUMPSIZE = 0x10 + ATTR_FILE_DATAALLOCSIZE = 0x400 + ATTR_FILE_DATAEXTENTS = 0x800 + ATTR_FILE_DATALENGTH = 0x200 + ATTR_FILE_DEVTYPE = 0x20 + ATTR_FILE_FILETYPE = 0x40 + ATTR_FILE_FORKCOUNT = 0x80 + ATTR_FILE_FORKLIST = 0x100 + ATTR_FILE_IOBLOCKSIZE = 0x8 + ATTR_FILE_LINKCOUNT = 0x1 + ATTR_FILE_RSRCALLOCSIZE = 0x2000 + ATTR_FILE_RSRCEXTENTS = 0x4000 + ATTR_FILE_RSRCLENGTH = 0x1000 + ATTR_FILE_SETMASK = 0x20 + ATTR_FILE_TOTALSIZE = 0x2 + ATTR_FILE_VALIDMASK = 0x37ff + ATTR_VOL_ALLOCATIONCLUMP = 0x40 + ATTR_VOL_ATTRIBUTES = 0x40000000 + ATTR_VOL_CAPABILITIES = 0x20000 + ATTR_VOL_DIRCOUNT = 0x400 + ATTR_VOL_ENCODINGSUSED = 0x10000 + ATTR_VOL_FILECOUNT = 0x200 + ATTR_VOL_FSTYPE = 0x1 + ATTR_VOL_INFO = 0x80000000 + ATTR_VOL_IOBLOCKSIZE = 0x80 + ATTR_VOL_MAXOBJCOUNT = 0x800 + ATTR_VOL_MINALLOCATION = 0x20 + ATTR_VOL_MOUNTEDDEVICE = 0x8000 + ATTR_VOL_MOUNTFLAGS = 0x4000 + ATTR_VOL_MOUNTPOINT = 0x1000 + ATTR_VOL_NAME = 0x2000 + ATTR_VOL_OBJCOUNT = 0x100 + ATTR_VOL_QUOTA_SIZE = 0x10000000 + ATTR_VOL_RESERVED_SIZE = 0x20000000 + ATTR_VOL_SETMASK = 0x80002000 + ATTR_VOL_SIGNATURE = 0x2 + ATTR_VOL_SIZE = 0x4 + ATTR_VOL_SPACEAVAIL = 0x10 + ATTR_VOL_SPACEFREE = 0x8 + ATTR_VOL_SPACEUSED = 0x800000 + ATTR_VOL_UUID = 0x40000 + ATTR_VOL_VALIDMASK = 0xf087ffff + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc00c4279 + BIOCGETIF = 0x4020426b + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044272 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSEESENT = 0x40044276 + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDLT = 0x80044278 + BIOCSETF = 0x80104267 + BIOCSETFNR = 0x8010427e + BIOCSETIF = 0x8020426c + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044273 + BIOCSRTIMEOUT = 0x8010426d + BIOCSSEESENT = 0x80044277 + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x80000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + BS0 = 0x0 + BS1 = 0x8000 + BSDLY = 0x8000 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_MONOTONIC = 0x6 + CLOCK_MONOTONIC_RAW = 0x4 + CLOCK_MONOTONIC_RAW_APPROX = 0x5 + CLOCK_PROCESS_CPUTIME_ID = 0xc + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x10 + CLOCK_UPTIME_RAW = 0x8 + CLOCK_UPTIME_RAW_APPROX = 0x9 + CLONE_NOFOLLOW = 0x1 + CLONE_NOOWNERCOPY = 0x2 + CR0 = 0x0 + CR1 = 0x1000 + CR2 = 0x2000 + CR3 = 0x3000 + CRDLY = 0x3000 + CREAD = 0x800 + CRTSCTS = 0x30000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0x14 + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTLIOCGINFO = 0xc0644e03 + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DLT_A429 = 0xb8 + DLT_A653_ICM = 0xb9 + DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde + DLT_APPLE_IP_OVER_IEEE1394 = 0x8a + DLT_ARCNET = 0x7 + DLT_ARCNET_LINUX = 0x81 + DLT_ATM_CLIP = 0x13 + DLT_ATM_RFC1483 = 0xb + DLT_AURORA = 0x7e + DLT_AX25 = 0x3 + DLT_AX25_KISS = 0xca + DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_HCI_H4 = 0xbb + DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 + DLT_CHAOS = 0x5 + DLT_CHDLC = 0x68 + DLT_CISCO_IOS = 0x76 + DLT_C_HDLC = 0x68 + DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DBUS = 0xe7 + DLT_DECT = 0xdd + DLT_DOCSIS = 0x8f + DLT_DVB_CI = 0xeb + DLT_ECONET = 0x73 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0x6d + DLT_ERF = 0xc5 + DLT_ERF_ETH = 0xaf + DLT_ERF_POS = 0xb0 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 + DLT_FDDI = 0xa + DLT_FLEXRAY = 0xd2 + DLT_FRELAY = 0x6b + DLT_FRELAY_WITH_DIR = 0xce + DLT_GCOM_SERIAL = 0xad + DLT_GCOM_T1E1 = 0xac + DLT_GPF_F = 0xab + DLT_GPF_T = 0xaa + DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 + DLT_HHDLC = 0x79 + DLT_IBM_SN = 0x92 + DLT_IBM_SP = 0x91 + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_IEEE802_11_RADIO_AVS = 0xa3 + DLT_IEEE802_15_4 = 0xc3 + DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NOFCS = 0xe6 + DLT_IEEE802_15_4_NONASK_PHY = 0xd7 + DLT_IEEE802_16_MAC_CPS = 0xbc + DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_IPFILTER = 0x74 + DLT_IPMB = 0xc7 + DLT_IPMB_LINUX = 0xd1 + DLT_IPNET = 0xe2 + DLT_IPOIB = 0xf2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 + DLT_IP_OVER_FC = 0x7a + DLT_JUNIPER_ATM1 = 0x89 + DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_ATM_CEMIC = 0xee + DLT_JUNIPER_CHDLC = 0xb5 + DLT_JUNIPER_ES = 0x84 + DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FIBRECHANNEL = 0xea + DLT_JUNIPER_FRELAY = 0xb4 + DLT_JUNIPER_GGSN = 0x85 + DLT_JUNIPER_ISM = 0xc2 + DLT_JUNIPER_MFR = 0x86 + DLT_JUNIPER_MLFR = 0x83 + DLT_JUNIPER_MLPPP = 0x82 + DLT_JUNIPER_MONITOR = 0xa4 + DLT_JUNIPER_PIC_PEER = 0xae + DLT_JUNIPER_PPP = 0xb3 + DLT_JUNIPER_PPPOE = 0xa7 + DLT_JUNIPER_PPPOE_ATM = 0xa8 + DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_SRX_E2E = 0xe9 + DLT_JUNIPER_ST = 0xc8 + DLT_JUNIPER_VP = 0xb7 + DLT_JUNIPER_VS = 0xe8 + DLT_LAPB_WITH_DIR = 0xcf + DLT_LAPD = 0xcb + DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 + DLT_LINUX_IRDA = 0x90 + DLT_LINUX_LAPD = 0xb1 + DLT_LINUX_PPP_WITHDIRECTION = 0xa6 + DLT_LINUX_SLL = 0x71 + DLT_LOOP = 0x6c + DLT_LTALK = 0x72 + DLT_MATCHING_MAX = 0x10a + DLT_MATCHING_MIN = 0x68 + DLT_MFR = 0xb6 + DLT_MOST = 0xd3 + DLT_MPEG_2_TS = 0xf3 + DLT_MPLS = 0xdb + DLT_MTP2 = 0x8c + DLT_MTP2_WITH_PHDR = 0x8b + DLT_MTP3 = 0x8d + DLT_MUX27010 = 0xec + DLT_NETANALYZER = 0xf0 + DLT_NETANALYZER_TRANSPARENT = 0xf1 + DLT_NFC_LLCP = 0xf5 + DLT_NFLOG = 0xef + DLT_NG40 = 0xf4 + DLT_NULL = 0x0 + DLT_PCI_EXP = 0x7d + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPI = 0xc0 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_PPPD = 0xa6 + DLT_PPP_SERIAL = 0x32 + DLT_PPP_WITH_DIR = 0xcc + DLT_PPP_WITH_DIRECTION = 0xa6 + DLT_PRISM_HEADER = 0x77 + DLT_PRONET = 0x4 + DLT_RAIF1 = 0xc6 + DLT_RAW = 0xc + DLT_RIO = 0x7c + DLT_SCCP = 0x8e + DLT_SITA = 0xc4 + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_STANAG_5066_D_PDU = 0xed + DLT_SUNATM = 0x7b + DLT_SYMANTEC_FIREWALL = 0x63 + DLT_TZSP = 0x80 + DLT_USB = 0xba + DLT_USB_DARWIN = 0x10a + DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DLT_WIHART = 0xdf + DLT_X2E_SERIAL = 0xd5 + DLT_X2E_XORAYA = 0xd6 + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EVFILT_AIO = -0x3 + EVFILT_EXCEPT = -0xf + EVFILT_FS = -0x9 + EVFILT_MACHPORT = -0x8 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x11 + EVFILT_THREADMARKER = 0x11 + EVFILT_TIMER = -0x7 + EVFILT_USER = -0xa + EVFILT_VM = -0xc + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_DISPATCH2 = 0x180 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG0 = 0x1000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_OOBAND = 0x2000 + EV_POLL = 0x1000 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf000 + EV_UDATA_SPECIFIC = 0x100 + EV_VANISHED = 0x200 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FF0 = 0x0 + FF1 = 0x4000 + FFDLY = 0x4000 + FLUSHO = 0x800000 + FSOPT_ATTR_CMN_EXTENDED = 0x20 + FSOPT_NOFOLLOW = 0x1 + FSOPT_NOINMEMUPDATE = 0x2 + FSOPT_PACK_INVAL_ATTRS = 0x8 + FSOPT_REPORT_FULLSIZE = 0x4 + FSOPT_RETURN_REALDEV = 0x200 + F_ADDFILESIGS = 0x3d + F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 + F_ADDFILESIGS_INFO = 0x67 + F_ADDFILESIGS_RETURN = 0x61 + F_ADDFILESUPPL = 0x68 + F_ADDSIGS = 0x3b + F_ALLOCATEALL = 0x4 + F_ALLOCATECONTIG = 0x2 + F_BARRIERFSYNC = 0x55 + F_CHECK_LV = 0x62 + F_CHKCLEAN = 0x29 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0x43 + F_FINDSIGS = 0x4e + F_FLUSH_DATA = 0x28 + F_FREEZE_FS = 0x35 + F_FULLFSYNC = 0x33 + F_GETCODEDIR = 0x48 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETLKPID = 0x42 + F_GETNOSIGPIPE = 0x4a + F_GETOWN = 0x5 + F_GETPATH = 0x32 + F_GETPATH_MTMINFO = 0x47 + F_GETPATH_NOFIRMLINK = 0x66 + F_GETPROTECTIONCLASS = 0x3f + F_GETPROTECTIONLEVEL = 0x4d + F_GETSIGSINFO = 0x69 + F_GLOBAL_NOCACHE = 0x37 + F_LOG2PHYS = 0x31 + F_LOG2PHYS_EXT = 0x41 + F_NOCACHE = 0x30 + F_NODIRECT = 0x3e + F_OK = 0x0 + F_PATHPKG_CHECK = 0x34 + F_PEOFPOSMODE = 0x3 + F_PREALLOCATE = 0x2a + F_PUNCHHOLE = 0x63 + F_RDADVISE = 0x2c + F_RDAHEAD = 0x2d + F_RDLCK = 0x1 + F_SETBACKINGSTORE = 0x46 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETLKWTIMEOUT = 0xa + F_SETNOSIGPIPE = 0x49 + F_SETOWN = 0x6 + F_SETPROTECTIONCLASS = 0x40 + F_SETSIZE = 0x2b + F_SINGLE_WRITER = 0x4c + F_SPECULATIVE_READ = 0x65 + F_THAW_FS = 0x36 + F_TRANSCODEKEY = 0x4b + F_TRIM_ACTIVE_FILE = 0x64 + F_UNLCK = 0x2 + F_VOLPOSMODE = 0x4 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFF_ALLMULTI = 0x200 + IFF_ALTPHYS = 0x4000 + IFF_BROADCAST = 0x2 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_NOTRAILERS = 0x20 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_6LOWPAN = 0x40 + IFT_AAL5 = 0x31 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ATM = 0x25 + IFT_BRIDGE = 0xd1 + IFT_CARP = 0xf8 + IFT_CELLULAR = 0xff + IFT_CEPT = 0x13 + IFT_DS3 = 0x1e + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_ETHER = 0x6 + IFT_FAITH = 0x38 + IFT_FDDI = 0xf + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_GIF = 0x37 + IFT_HDH1822 = 0x3 + IFT_HIPPI = 0x2f + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IEEE1394 = 0x90 + IFT_IEEE8023ADLAG = 0x88 + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88026 = 0xa + IFT_L2VLAN = 0x87 + IFT_LAPB = 0x10 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_NSIP = 0x1b + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PDP = 0xff + IFT_PFLOG = 0xf5 + IFT_PFSYNC = 0xf6 + IFT_PKTAP = 0xfe + IFT_PPP = 0x17 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PTPSERIAL = 0x16 + IFT_RS232 = 0x21 + IFT_SDLC = 0x11 + IFT_SIP = 0x1f + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_STARLAN = 0xb + IFT_STF = 0x39 + IFT_T1 = 0x12 + IFT_ULTRA = 0x1d + IFT_V35 = 0x2d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LINKLOCALNETNUM = 0xa9fe0000 + IN_LOOPBACKNET = 0x7f + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x400473d1 + IPPROTO_3PC = 0x22 + IPPROTO_ADFS = 0x44 + IPPROTO_AH = 0x33 + IPPROTO_AHIP = 0x3d + IPPROTO_APES = 0x63 + IPPROTO_ARGUS = 0xd + IPPROTO_AX25 = 0x5d + IPPROTO_BHA = 0x31 + IPPROTO_BLT = 0x1e + IPPROTO_BRSATMON = 0x4c + IPPROTO_CFTP = 0x3e + IPPROTO_CHAOS = 0x10 + IPPROTO_CMTP = 0x26 + IPPROTO_CPHB = 0x49 + IPPROTO_CPNX = 0x48 + IPPROTO_DDP = 0x25 + IPPROTO_DGP = 0x56 + IPPROTO_DIVERT = 0xfe + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_EMCON = 0xe + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GMTP = 0x64 + IPPROTO_GRE = 0x2f + IPPROTO_HELLO = 0x3f + IPPROTO_HMP = 0x14 + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IDPR = 0x23 + IPPROTO_IDRP = 0x2d + IPPROTO_IGMP = 0x2 + IPPROTO_IGP = 0x55 + IPPROTO_IGRP = 0x58 + IPPROTO_IL = 0x28 + IPPROTO_INLSP = 0x34 + IPPROTO_INP = 0x20 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPCV = 0x47 + IPPROTO_IPEIP = 0x5e + IPPROTO_IPIP = 0x4 + IPPROTO_IPPC = 0x43 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_IRTP = 0x1c + IPPROTO_KRYPTOLAN = 0x41 + IPPROTO_LARP = 0x5b + IPPROTO_LEAF1 = 0x19 + IPPROTO_LEAF2 = 0x1a + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x34 + IPPROTO_MEAS = 0x13 + IPPROTO_MHRP = 0x30 + IPPROTO_MICP = 0x5f + IPPROTO_MTP = 0x5c + IPPROTO_MUX = 0x12 + IPPROTO_ND = 0x4d + IPPROTO_NHRP = 0x36 + IPPROTO_NONE = 0x3b + IPPROTO_NSP = 0x1f + IPPROTO_NVPII = 0xb + IPPROTO_OSPFIGP = 0x59 + IPPROTO_PGM = 0x71 + IPPROTO_PIGP = 0x9 + IPPROTO_PIM = 0x67 + IPPROTO_PRM = 0x15 + IPPROTO_PUP = 0xc + IPPROTO_PVP = 0x4b + IPPROTO_RAW = 0xff + IPPROTO_RCCMON = 0xa + IPPROTO_RDP = 0x1b + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_RVD = 0x42 + IPPROTO_SATEXPAK = 0x40 + IPPROTO_SATMON = 0x45 + IPPROTO_SCCSP = 0x60 + IPPROTO_SCTP = 0x84 + IPPROTO_SDRP = 0x2a + IPPROTO_SEP = 0x21 + IPPROTO_SRPC = 0x5a + IPPROTO_ST = 0x7 + IPPROTO_SVMTP = 0x52 + IPPROTO_SWIPE = 0x35 + IPPROTO_TCF = 0x57 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_TPXX = 0x27 + IPPROTO_TRUNK1 = 0x17 + IPPROTO_TRUNK2 = 0x18 + IPPROTO_TTP = 0x54 + IPPROTO_UDP = 0x11 + IPPROTO_VINES = 0x53 + IPPROTO_VISA = 0x46 + IPPROTO_VMTP = 0x51 + IPPROTO_WBEXPAK = 0x4f + IPPROTO_WBMON = 0x4e + IPPROTO_WSN = 0x4a + IPPROTO_XNET = 0xf + IPPROTO_XTP = 0x24 + IPV6_2292DSTOPTS = 0x17 + IPV6_2292HOPLIMIT = 0x14 + IPV6_2292HOPOPTS = 0x16 + IPV6_2292NEXTHOP = 0x15 + IPV6_2292PKTINFO = 0x13 + IPV6_2292PKTOPTIONS = 0x19 + IPV6_2292RTHDR = 0x18 + IPV6_3542DSTOPTS = 0x32 + IPV6_3542HOPLIMIT = 0x2f + IPV6_3542HOPOPTS = 0x31 + IPV6_3542NEXTHOP = 0x30 + IPV6_3542PKTINFO = 0x2e + IPV6_3542RTHDR = 0x33 + IPV6_ADDR_MC_FLAGS_PREFIX = 0x20 + IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10 + IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_BINDV6ONLY = 0x1b + IPV6_BOUND_IF = 0x7d + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOW_ECN_MASK = 0x3000 + IPV6_FRAGTTL = 0x3c + IPV6_FW_ADD = 0x1e + IPV6_FW_DEL = 0x1f + IPV6_FW_FLUSH = 0x20 + IPV6_FW_GET = 0x22 + IPV6_FW_ZERO = 0x21 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPSEC_POLICY = 0x1c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXOPTHDR = 0x800 + IPV6_MAXPACKET = 0xffff + IPV6_MAX_GROUP_SRC_FILTER = 0x200 + IPV6_MAX_MEMBERSHIPS = 0xfff + IPV6_MAX_SOCK_SRC_FILTER = 0x80 + IPV6_MIN_MEMBERSHIPS = 0x1f + IPV6_MMTU = 0x500 + IPV6_MSFILTER = 0x4a + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_PREFER_TEMPADDR = 0x3f + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x3d + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x23 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x39 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x24 + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_ADD_SOURCE_MEMBERSHIP = 0x46 + IP_BLOCK_SOURCE = 0x48 + IP_BOUND_IF = 0x19 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DONTFRAG = 0x1c + IP_DROP_MEMBERSHIP = 0xd + IP_DROP_SOURCE_MEMBERSHIP = 0x47 + IP_DUMMYNET_CONFIGURE = 0x3c + IP_DUMMYNET_DEL = 0x3d + IP_DUMMYNET_FLUSH = 0x3e + IP_DUMMYNET_GET = 0x40 + IP_FAITH = 0x16 + IP_FW_ADD = 0x28 + IP_FW_DEL = 0x29 + IP_FW_FLUSH = 0x2a + IP_FW_GET = 0x2c + IP_FW_RESETLOG = 0x2d + IP_FW_ZERO = 0x2b + IP_HDRINCL = 0x2 + IP_IPSEC_POLICY = 0x15 + IP_MAXPACKET = 0xffff + IP_MAX_GROUP_SRC_FILTER = 0x200 + IP_MAX_MEMBERSHIPS = 0xfff + IP_MAX_SOCK_MUTE_FILTER = 0x80 + IP_MAX_SOCK_SRC_FILTER = 0x80 + IP_MF = 0x2000 + IP_MIN_MEMBERSHIPS = 0x1f + IP_MSFILTER = 0x4a + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_IFINDEX = 0x42 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_MULTICAST_VIF = 0xe + IP_NAT__XXX = 0x37 + IP_OFFMASK = 0x1fff + IP_OLD_FW_ADD = 0x32 + IP_OLD_FW_DEL = 0x33 + IP_OLD_FW_FLUSH = 0x34 + IP_OLD_FW_GET = 0x36 + IP_OLD_FW_RESETLOG = 0x38 + IP_OLD_FW_ZERO = 0x35 + IP_OPTIONS = 0x1 + IP_PKTINFO = 0x1a + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVIF = 0x14 + IP_RECVOPTS = 0x5 + IP_RECVPKTINFO = 0x1a + IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x1b + IP_RECVTTL = 0x18 + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RSVP_OFF = 0x10 + IP_RSVP_ON = 0xf + IP_RSVP_VIF_OFF = 0x12 + IP_RSVP_VIF_ON = 0x11 + IP_STRIPHDR = 0x17 + IP_TOS = 0x3 + IP_TRAFFIC_MGT_BACKGROUND = 0x41 + IP_TTL = 0x4 + IP_UNBLOCK_SOURCE = 0x49 + ISIG = 0x80 + ISTRIP = 0x20 + IUTF8 = 0x4000 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LOCAL_PEERCRED = 0x1 + LOCAL_PEEREPID = 0x3 + LOCAL_PEEREUUID = 0x5 + LOCAL_PEERPID = 0x2 + LOCAL_PEERTOKEN = 0x6 + LOCAL_PEERUUID = 0x4 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_CAN_REUSE = 0x9 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x5 + MADV_FREE_REUSABLE = 0x7 + MADV_FREE_REUSE = 0x8 + MADV_NORMAL = 0x0 + MADV_PAGEOUT = 0xa + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_WILLNEED = 0x3 + MADV_ZERO_WIRED_PAGES = 0x6 + MAP_32BIT = 0x8000 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_HASSEMAPHORE = 0x200 + MAP_JIT = 0x800 + MAP_NOCACHE = 0x400 + MAP_NOEXTEND = 0x100 + MAP_NORESERVE = 0x40 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x20 + MAP_RESERVED0080 = 0x80 + MAP_RESILIENT_CODESIGN = 0x2000 + MAP_RESILIENT_MEDIA = 0x4000 + MAP_SHARED = 0x1 + MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000 + MAP_UNIX03 = 0x40000 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_AUTOMOUNTED = 0x400000 + MNT_CMDFLAGS = 0xf0000 + MNT_CPROTECT = 0x80 + MNT_DEFWRITE = 0x2000000 + MNT_DONTBROWSE = 0x100000 + MNT_DOVOLFS = 0x8000 + MNT_DWAIT = 0x4 + MNT_EXPORTED = 0x100 + MNT_EXT_ROOT_DATA_VOL = 0x1 + MNT_FORCE = 0x80000 + MNT_IGNORE_OWNERSHIP = 0x200000 + MNT_JOURNALED = 0x800000 + MNT_LOCAL = 0x1000 + MNT_MULTILABEL = 0x4000000 + MNT_NOATIME = 0x10000000 + MNT_NOBLOCK = 0x20000 + MNT_NODEV = 0x10 + MNT_NOEXEC = 0x4 + MNT_NOSUID = 0x8 + MNT_NOUSERXATTR = 0x1000000 + MNT_NOWAIT = 0x2 + MNT_QUARANTINE = 0x400 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_REMOVABLE = 0x200 + MNT_ROOTFS = 0x4000 + MNT_SNAPSHOT = 0x40000000 + MNT_STRICTATIME = 0x80000000 + MNT_SYNCHRONOUS = 0x2 + MNT_UNION = 0x20 + MNT_UNKNOWNPERMISSIONS = 0x200000 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0xd7f0f7ff + MNT_WAIT = 0x1 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOF = 0x100 + MSG_EOR = 0x8 + MSG_FLUSH = 0x400 + MSG_HAVEMORE = 0x2000 + MSG_HOLD = 0x800 + MSG_NEEDSA = 0x10000 + MSG_NOSIGNAL = 0x80000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_RCVMORE = 0x4000 + MSG_SEND = 0x1000 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MSG_WAITSTREAM = 0x200 + MS_ASYNC = 0x1 + MS_DEACTIVATE = 0x8 + MS_INVALIDATE = 0x2 + MS_KILLPAGES = 0x4 + MS_SYNC = 0x10 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_DUMP2 = 0x7 + NET_RT_FLAGS = 0x2 + NET_RT_FLAGS_PRIV = 0xa + NET_RT_IFLIST = 0x3 + NET_RT_IFLIST2 = 0x6 + NET_RT_MAXID = 0xb + NET_RT_STAT = 0x4 + NET_RT_TRASH = 0x5 + NFDBITS = 0x20 + NL0 = 0x0 + NL1 = 0x100 + NL2 = 0x200 + NL3 = 0x300 + NLDLY = 0x300 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ABSOLUTE = 0x8 + NOTE_ATTRIB = 0x8 + NOTE_BACKGROUND = 0x40 + NOTE_CHILD = 0x4 + NOTE_CRITICAL = 0x20 + NOTE_DELETE = 0x1 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXITSTATUS = 0x4000000 + NOTE_EXIT_CSERROR = 0x40000 + NOTE_EXIT_DECRYPTFAIL = 0x10000 + NOTE_EXIT_DETAIL = 0x2000000 + NOTE_EXIT_DETAIL_MASK = 0x70000 + NOTE_EXIT_MEMORY = 0x20000 + NOTE_EXIT_REPARENTED = 0x80000 + NOTE_EXTEND = 0x4 + NOTE_FFAND = 0x40000000 + NOTE_FFCOPY = 0xc0000000 + NOTE_FFCTRLMASK = 0xc0000000 + NOTE_FFLAGSMASK = 0xffffff + NOTE_FFNOP = 0x0 + NOTE_FFOR = 0x80000000 + NOTE_FORK = 0x40000000 + NOTE_FUNLOCK = 0x100 + NOTE_LEEWAY = 0x10 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_MACHTIME = 0x100 + NOTE_MACH_CONTINUOUS_TIME = 0x80 + NOTE_NONE = 0x80 + NOTE_NSECONDS = 0x4 + NOTE_OOB = 0x2 + NOTE_PCTRLMASK = -0x100000 + NOTE_PDATAMASK = 0xfffff + NOTE_REAP = 0x10000000 + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_SECONDS = 0x1 + NOTE_SIGNAL = 0x8000000 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRIGGER = 0x1000000 + NOTE_USECONDS = 0x2 + NOTE_VM_ERROR = 0x10000000 + NOTE_VM_PRESSURE = 0x80000000 + NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 + NOTE_VM_PRESSURE_TERMINATE = 0x40000000 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OFDEL = 0x20000 + OFILL = 0x80 + ONLCR = 0x2 + ONLRET = 0x40 + ONOCR = 0x20 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_ALERT = 0x20000000 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x1000000 + O_CREAT = 0x200 + O_DIRECTORY = 0x100000 + O_DP_GETRAWENCRYPTED = 0x1 + O_DP_GETRAWUNENCRYPTED = 0x2 + O_DSYNC = 0x400000 + O_EVTONLY = 0x8000 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x20000 + O_NOFOLLOW = 0x100 + O_NOFOLLOW_ANY = 0x20000000 + O_NONBLOCK = 0x4 + O_POPUP = 0x80000000 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_SHLOCK = 0x10 + O_SYMLINK = 0x200000 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + PT_ATTACH = 0xa + PT_ATTACHEXC = 0xe + PT_CONTINUE = 0x7 + PT_DENY_ATTACH = 0x1f + PT_DETACH = 0xb + PT_FIRSTMACH = 0x20 + PT_FORCEQUOTA = 0x1e + PT_KILL = 0x8 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_READ_U = 0x3 + PT_SIGEXC = 0xc + PT_STEP = 0x9 + PT_THUPDATE = 0xd + PT_TRACE_ME = 0x0 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + PT_WRITE_U = 0x6 + RLIMIT_AS = 0x5 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_CPU_USAGE_MONITOR = 0x2 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BRD = 0x7 + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_MAX = 0x8 + RTAX_NETMASK = 0x2 + RTA_AUTHOR = 0x40 + RTA_BRD = 0x80 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_NETMASK = 0x4 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CLONING = 0x100 + RTF_CONDEMNED = 0x2000000 + RTF_DEAD = 0x20000000 + RTF_DELCLONE = 0x80 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_GATEWAY = 0x2 + RTF_GLOBAL = 0x40000000 + RTF_HOST = 0x4 + RTF_IFREF = 0x4000000 + RTF_IFSCOPE = 0x1000000 + RTF_LLDATA = 0x400 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MULTICAST = 0x800000 + RTF_NOIFREF = 0x2000 + RTF_PINNED = 0x100000 + RTF_PRCLONING = 0x10000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x40000 + RTF_PROXY = 0x8000000 + RTF_REJECT = 0x8 + RTF_ROUTER = 0x10000000 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_WASCLONED = 0x20000 + RTF_XRESOLVE = 0x200 + RTM_ADD = 0x1 + RTM_CHANGE = 0x3 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DELMADDR = 0x10 + RTM_GET = 0x4 + RTM_GET2 = 0x14 + RTM_IFINFO = 0xe + RTM_IFINFO2 = 0x12 + RTM_LOCK = 0x8 + RTM_LOSING = 0x5 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_NEWMADDR = 0xf + RTM_NEWMADDR2 = 0x13 + RTM_OLDADD = 0x9 + RTM_OLDDEL = 0xa + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + SCM_CREDS = 0x3 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x2 + SCM_TIMESTAMP_MONOTONIC = 0x4 + SEEK_CUR = 0x1 + SEEK_DATA = 0x4 + SEEK_END = 0x2 + SEEK_HOLE = 0x3 + SEEK_SET = 0x0 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCARPIPLL = 0xc0206928 + SIOCATMARK = 0x40047307 + SIOCAUTOADDR = 0xc0206926 + SIOCAUTONETMASK = 0x80206927 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFPHYADDR = 0x80206941 + SIOCGDRVSPEC = 0xc028697b + SIOCGETVLAN = 0xc020697f + SIOCGHIWAT = 0x40047301 + SIOCGIF6LOWPAN = 0xc02069c5 + SIOCGIFADDR = 0xc0206921 + SIOCGIFALTMTU = 0xc0206948 + SIOCGIFASYNCMAP = 0xc020697c + SIOCGIFBOND = 0xc0206947 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCAP = 0xc020695b + SIOCGIFCONF = 0xc00c6924 + SIOCGIFDEVMTU = 0xc0206944 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFFUNCTIONALTYPE = 0xc02069ad + SIOCGIFGENERIC = 0xc020693a + SIOCGIFKPI = 0xc0206987 + SIOCGIFMAC = 0xc0206982 + SIOCGIFMEDIA = 0xc02c6938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc0206933 + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPDSTADDR = 0xc0206940 + SIOCGIFPHYS = 0xc0206935 + SIOCGIFPSRCADDR = 0xc020693f + SIOCGIFSTATUS = 0xc331693d + SIOCGIFVLAN = 0xc020697f + SIOCGIFWAKEFLAGS = 0xc0206988 + SIOCGIFXMEDIA = 0xc02c6948 + SIOCGLOWAT = 0x40047303 + SIOCGPGRP = 0x40047309 + SIOCIFCREATE = 0xc0206978 + SIOCIFCREATE2 = 0xc020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106981 + SIOCRSLVMULTI = 0xc010693b + SIOCSDRVSPEC = 0x8028697b + SIOCSETVLAN = 0x8020697e + SIOCSHIWAT = 0x80047300 + SIOCSIF6LOWPAN = 0x802069c4 + SIOCSIFADDR = 0x8020690c + SIOCSIFALTMTU = 0x80206945 + SIOCSIFASYNCMAP = 0x8020697d + SIOCSIFBOND = 0x80206946 + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFCAP = 0x8020695a + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGENERIC = 0x80206939 + SIOCSIFKPI = 0x80206986 + SIOCSIFLLADDR = 0x8020693c + SIOCSIFMAC = 0x80206983 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x80206934 + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPHYADDR = 0x8040693e + SIOCSIFPHYS = 0x80206936 + SIOCSIFVLAN = 0x8020697e + SIOCSLOWAT = 0x80047302 + SIOCSPGRP = 0x80047308 + SOCK_DGRAM = 0x2 + SOCK_MAXADDRLEN = 0xff + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DONTROUTE = 0x10 + SO_DONTTRUNC = 0x2000 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LABEL = 0x1010 + SO_LINGER = 0x80 + SO_LINGER_SEC = 0x1080 + SO_NETSVC_MARKING_LEVEL = 0x1119 + SO_NET_SERVICE_TYPE = 0x1116 + SO_NKE = 0x1021 + SO_NOADDRERR = 0x1023 + SO_NOSIGPIPE = 0x1022 + SO_NOTIFYCONFLICT = 0x1026 + SO_NP_EXTENSIONS = 0x1083 + SO_NREAD = 0x1020 + SO_NUMRCVPKT = 0x1112 + SO_NWRITE = 0x1024 + SO_OOBINLINE = 0x100 + SO_PEERLABEL = 0x1011 + SO_RANDOMPORT = 0x1082 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_REUSESHAREUID = 0x1025 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TIMESTAMP = 0x400 + SO_TIMESTAMP_MONOTONIC = 0x800 + SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED = 0x1 + SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT = 0x4 + SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER = 0x2 + SO_TRACKER_TRANSPARENCY_VERSION = 0x3 + SO_TYPE = 0x1008 + SO_UPCALLCLOSEWAIT = 0x1027 + SO_USELOOPBACK = 0x40 + SO_WANTMORE = 0x4000 + SO_WANTOOBFLAG = 0x8000 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IFWHT = 0xe000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TAB0 = 0x0 + TAB1 = 0x400 + TAB2 = 0x800 + TAB3 = 0x4 + TABDLY = 0xc04 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_CC = 0xb + TCPOPT_CCECHO = 0xd + TCPOPT_CCNEW = 0xc + TCPOPT_EOL = 0x0 + TCPOPT_FASTOPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_CONNECTIONTIMEOUT = 0x20 + TCP_CONNECTION_INFO = 0x106 + TCP_ENABLE_ECN = 0x104 + TCP_FASTOPEN = 0x105 + TCP_KEEPALIVE = 0x10 + TCP_KEEPCNT = 0x102 + TCP_KEEPINTVL = 0x101 + TCP_MAXHLEN = 0x3c + TCP_MAXOLEN = 0x28 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x4 + TCP_MAX_WINSHIFT = 0xe + TCP_MINMSS = 0xd8 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOOPT = 0x8 + TCP_NOPUSH = 0x4 + TCP_NOTSENT_LOWAT = 0x201 + TCP_RXT_CONNDROPTIME = 0x80 + TCP_RXT_FINDROP = 0x100 + TCP_SENDMOREACKS = 0x103 + TCSAFLUSH = 0x2 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDCDTIMESTAMP = 0x40107458 + TIOCDRAIN = 0x2000745e + TIOCDSIMICROCODE = 0x20007455 + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x40487413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGWINSZ = 0x40087468 + TIOCIXOFF = 0x20007480 + TIOCIXON = 0x20007481 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMODG = 0x40047403 + TIOCMODS = 0x80047404 + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTYGNAME = 0x40807453 + TIOCPTYGRANT = 0x20007454 + TIOCPTYUNLK = 0x20007452 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCONS = 0x20007463 + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x80487414 + TIOCSETAF = 0x80487416 + TIOCSETAW = 0x80487415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2000745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40107459 + TIOCUCNTL = 0x80047466 + TOSTOP = 0x400000 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMADDR_CID_ANY = 0xffffffff + VMADDR_CID_HOST = 0x2 + VMADDR_CID_HYPERVISOR = 0x0 + VMADDR_CID_RESERVED = 0x1 + VMADDR_PORT_ANY = 0xffffffff + VMIN = 0x10 + VM_LOADAVG = 0x2 + VM_MACHFACTOR = 0x4 + VM_MAXID = 0x6 + VM_METER = 0x1 + VM_SWAPUSAGE = 0x5 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VT0 = 0x0 + VT1 = 0x10000 + VTDLY = 0x10000 + VTIME = 0x11 + VWERASE = 0x4 + WCONTINUED = 0x10 + WCOREFLAG = 0x80 + WEXITED = 0x4 + WNOHANG = 0x1 + WNOWAIT = 0x20 + WORDSIZE = 0x40 + WSTOPPED = 0x8 + WUNTRACED = 0x2 + XATTR_CREATE = 0x2 + XATTR_NODEFAULT = 0x10 + XATTR_NOFOLLOW = 0x1 + XATTR_NOSECURITY = 0x8 + XATTR_REPLACE = 0x4 + XATTR_SHOWCOMPRESSION = 0x20 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go deleted file mode 100644 index 3e417571a9..0000000000 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go +++ /dev/null @@ -1,1784 +0,0 @@ -// mkerrors.sh -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm,darwin - -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- _const.go - -package unix - -import "syscall" - -const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x28 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - ALTWERASE = 0x200 - ATTR_BIT_MAP_COUNT = 0x5 - ATTR_CMN_ACCESSMASK = 0x20000 - ATTR_CMN_ACCTIME = 0x1000 - ATTR_CMN_ADDEDTIME = 0x10000000 - ATTR_CMN_BKUPTIME = 0x2000 - ATTR_CMN_CHGTIME = 0x800 - ATTR_CMN_CRTIME = 0x200 - ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 - ATTR_CMN_DEVID = 0x2 - ATTR_CMN_DOCUMENT_ID = 0x100000 - ATTR_CMN_ERROR = 0x20000000 - ATTR_CMN_EXTENDED_SECURITY = 0x400000 - ATTR_CMN_FILEID = 0x2000000 - ATTR_CMN_FLAGS = 0x40000 - ATTR_CMN_FNDRINFO = 0x4000 - ATTR_CMN_FSID = 0x4 - ATTR_CMN_FULLPATH = 0x8000000 - ATTR_CMN_GEN_COUNT = 0x80000 - ATTR_CMN_GRPID = 0x10000 - ATTR_CMN_GRPUUID = 0x1000000 - ATTR_CMN_MODTIME = 0x400 - ATTR_CMN_NAME = 0x1 - ATTR_CMN_NAMEDATTRCOUNT = 0x80000 - ATTR_CMN_NAMEDATTRLIST = 0x100000 - ATTR_CMN_OBJID = 0x20 - ATTR_CMN_OBJPERMANENTID = 0x40 - ATTR_CMN_OBJTAG = 0x10 - ATTR_CMN_OBJTYPE = 0x8 - ATTR_CMN_OWNERID = 0x8000 - ATTR_CMN_PARENTID = 0x4000000 - ATTR_CMN_PAROBJID = 0x80 - ATTR_CMN_RETURNED_ATTRS = 0x80000000 - ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x41c7ff00 - ATTR_CMN_USERACCESS = 0x200000 - ATTR_CMN_UUID = 0x800000 - ATTR_CMN_VALIDMASK = 0xffffffff - ATTR_CMN_VOLSETMASK = 0x6700 - ATTR_FILE_ALLOCSIZE = 0x4 - ATTR_FILE_CLUMPSIZE = 0x10 - ATTR_FILE_DATAALLOCSIZE = 0x400 - ATTR_FILE_DATAEXTENTS = 0x800 - ATTR_FILE_DATALENGTH = 0x200 - ATTR_FILE_DEVTYPE = 0x20 - ATTR_FILE_FILETYPE = 0x40 - ATTR_FILE_FORKCOUNT = 0x80 - ATTR_FILE_FORKLIST = 0x100 - ATTR_FILE_IOBLOCKSIZE = 0x8 - ATTR_FILE_LINKCOUNT = 0x1 - ATTR_FILE_RSRCALLOCSIZE = 0x2000 - ATTR_FILE_RSRCEXTENTS = 0x4000 - ATTR_FILE_RSRCLENGTH = 0x1000 - ATTR_FILE_SETMASK = 0x20 - ATTR_FILE_TOTALSIZE = 0x2 - ATTR_FILE_VALIDMASK = 0x37ff - ATTR_VOL_ALLOCATIONCLUMP = 0x40 - ATTR_VOL_ATTRIBUTES = 0x40000000 - ATTR_VOL_CAPABILITIES = 0x20000 - ATTR_VOL_DIRCOUNT = 0x400 - ATTR_VOL_ENCODINGSUSED = 0x10000 - ATTR_VOL_FILECOUNT = 0x200 - ATTR_VOL_FSTYPE = 0x1 - ATTR_VOL_INFO = 0x80000000 - ATTR_VOL_IOBLOCKSIZE = 0x80 - ATTR_VOL_MAXOBJCOUNT = 0x800 - ATTR_VOL_MINALLOCATION = 0x20 - ATTR_VOL_MOUNTEDDEVICE = 0x8000 - ATTR_VOL_MOUNTFLAGS = 0x4000 - ATTR_VOL_MOUNTPOINT = 0x1000 - ATTR_VOL_NAME = 0x2000 - ATTR_VOL_OBJCOUNT = 0x100 - ATTR_VOL_QUOTA_SIZE = 0x10000000 - ATTR_VOL_RESERVED_SIZE = 0x20000000 - ATTR_VOL_SETMASK = 0x80002000 - ATTR_VOL_SIGNATURE = 0x2 - ATTR_VOL_SIZE = 0x4 - ATTR_VOL_SPACEAVAIL = 0x10 - ATTR_VOL_SPACEFREE = 0x8 - ATTR_VOL_UUID = 0x40000 - ATTR_VOL_VALIDMASK = 0xf007ffff - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80104267 - BIOCSETFNR = 0x8010427e - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_MONOTONIC_RAW_APPROX = 0x5 - CLOCK_PROCESS_CPUTIME_ID = 0xc - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x10 - CLOCK_UPTIME_RAW = 0x8 - CLOCK_UPTIME_RAW_APPROX = 0x9 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x30000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_EXCEPT = -0xf - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xf - EVFILT_THREADMARKER = 0xf - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_DISPATCH2 = 0x180 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EV_UDATA_SPECIFIC = 0x100 - EV_VANISHED = 0x200 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - FSOPT_ATTR_CMN_EXTENDED = 0x20 - FSOPT_NOFOLLOW = 0x1 - FSOPT_NOINMEMUPDATE = 0x2 - FSOPT_PACK_INVAL_ATTRS = 0x8 - FSOPT_REPORT_FULLSIZE = 0x4 - F_ADDFILESIGS = 0x3d - F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 - F_ADDFILESIGS_RETURN = 0x61 - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_BARRIERFSYNC = 0x55 - F_CHECK_LV = 0x62 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_PUNCHHOLE = 0x63 - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_TRIM_ACTIVE_FILE = 0x64 - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x300 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTOS = 0x1b - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_PAGEOUT = 0xa - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_RESILIENT_CODESIGN = 0x2000 - MAP_RESILIENT_MEDIA = 0x4000 - MAP_SHARED = 0x1 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x400000 - MNT_CMDFLAGS = 0xf0000 - MNT_CPROTECT = 0x80 - MNT_DEFWRITE = 0x2000000 - MNT_DONTBROWSE = 0x100000 - MNT_DOVOLFS = 0x8000 - MNT_DWAIT = 0x4 - MNT_EXPORTED = 0x100 - MNT_FORCE = 0x80000 - MNT_IGNORE_OWNERSHIP = 0x200000 - MNT_JOURNALED = 0x800000 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NOATIME = 0x10000000 - MNT_NOBLOCK = 0x20000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOUSERXATTR = 0x1000000 - MNT_NOWAIT = 0x2 - MNT_QUARANTINE = 0x400 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UNKNOWNPERMISSIONS = 0x200000 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x17f0f5ff - MNT_WAIT = 0x1 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NFDBITS = 0x20 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLDLY = 0x300 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_FUNLOCK = 0x100 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_MACH_CONTINUOUS_TIME = 0x80 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_OOB = 0x2 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DP_GETRAWUNENCRYPTED = 0x2 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc028697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc00c6924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc02c6938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106981 - SIOCRSLVMULTI = 0xc010693b - SIOCSDRVSPEC = 0x8028697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NETSVC_MARKING_LEVEL = 0x1119 - SO_NET_SERVICE_TYPE = 0x1116 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0x4 - TABDLY = 0xc04 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_CONNECTION_INFO = 0x106 - TCP_ENABLE_ECN = 0x104 - TCP_FASTOPEN = 0x105 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x40487413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x80487414 - TIOCSETAF = 0x80487416 - TIOCSETAW = 0x80487415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VM_LOADAVG = 0x2 - VM_MACHFACTOR = 0x4 - VM_MAXID = 0x6 - VM_METER = 0x1 - VM_SWAPUSAGE = 0x5 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x40 - WSTOPPED = 0x8 - WUNTRACED = 0x2 - XATTR_CREATE = 0x2 - XATTR_NODEFAULT = 0x10 - XATTR_NOFOLLOW = 0x1 - XATTR_NOSECURITY = 0x8 - XATTR_REPLACE = 0x4 - XATTR_SHOWCOMPRESSION = 0x20 -) - -// Errors -const ( - E2BIG = syscall.Errno(0x7) - EACCES = syscall.Errno(0xd) - EADDRINUSE = syscall.Errno(0x30) - EADDRNOTAVAIL = syscall.Errno(0x31) - EAFNOSUPPORT = syscall.Errno(0x2f) - EAGAIN = syscall.Errno(0x23) - EALREADY = syscall.Errno(0x25) - EAUTH = syscall.Errno(0x50) - EBADARCH = syscall.Errno(0x56) - EBADEXEC = syscall.Errno(0x55) - EBADF = syscall.Errno(0x9) - EBADMACHO = syscall.Errno(0x58) - EBADMSG = syscall.Errno(0x5e) - EBADRPC = syscall.Errno(0x48) - EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x59) - ECHILD = syscall.Errno(0xa) - ECONNABORTED = syscall.Errno(0x35) - ECONNREFUSED = syscall.Errno(0x3d) - ECONNRESET = syscall.Errno(0x36) - EDEADLK = syscall.Errno(0xb) - EDESTADDRREQ = syscall.Errno(0x27) - EDEVERR = syscall.Errno(0x53) - EDOM = syscall.Errno(0x21) - EDQUOT = syscall.Errno(0x45) - EEXIST = syscall.Errno(0x11) - EFAULT = syscall.Errno(0xe) - EFBIG = syscall.Errno(0x1b) - EFTYPE = syscall.Errno(0x4f) - EHOSTDOWN = syscall.Errno(0x40) - EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x5a) - EILSEQ = syscall.Errno(0x5c) - EINPROGRESS = syscall.Errno(0x24) - EINTR = syscall.Errno(0x4) - EINVAL = syscall.Errno(0x16) - EIO = syscall.Errno(0x5) - EISCONN = syscall.Errno(0x38) - EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x6a) - ELOOP = syscall.Errno(0x3e) - EMFILE = syscall.Errno(0x18) - EMLINK = syscall.Errno(0x1f) - EMSGSIZE = syscall.Errno(0x28) - EMULTIHOP = syscall.Errno(0x5f) - ENAMETOOLONG = syscall.Errno(0x3f) - ENEEDAUTH = syscall.Errno(0x51) - ENETDOWN = syscall.Errno(0x32) - ENETRESET = syscall.Errno(0x34) - ENETUNREACH = syscall.Errno(0x33) - ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x5d) - ENOBUFS = syscall.Errno(0x37) - ENODATA = syscall.Errno(0x60) - ENODEV = syscall.Errno(0x13) - ENOENT = syscall.Errno(0x2) - ENOEXEC = syscall.Errno(0x8) - ENOLCK = syscall.Errno(0x4d) - ENOLINK = syscall.Errno(0x61) - ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x5b) - ENOPOLICY = syscall.Errno(0x67) - ENOPROTOOPT = syscall.Errno(0x2a) - ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x62) - ENOSTR = syscall.Errno(0x63) - ENOSYS = syscall.Errno(0x4e) - ENOTBLK = syscall.Errno(0xf) - ENOTCONN = syscall.Errno(0x39) - ENOTDIR = syscall.Errno(0x14) - ENOTEMPTY = syscall.Errno(0x42) - ENOTRECOVERABLE = syscall.Errno(0x68) - ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x2d) - ENOTTY = syscall.Errno(0x19) - ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x66) - EOVERFLOW = syscall.Errno(0x54) - EOWNERDEAD = syscall.Errno(0x69) - EPERM = syscall.Errno(0x1) - EPFNOSUPPORT = syscall.Errno(0x2e) - EPIPE = syscall.Errno(0x20) - EPROCLIM = syscall.Errno(0x43) - EPROCUNAVAIL = syscall.Errno(0x4c) - EPROGMISMATCH = syscall.Errno(0x4b) - EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x64) - EPROTONOSUPPORT = syscall.Errno(0x2b) - EPROTOTYPE = syscall.Errno(0x29) - EPWROFF = syscall.Errno(0x52) - EQFULL = syscall.Errno(0x6a) - ERANGE = syscall.Errno(0x22) - EREMOTE = syscall.Errno(0x47) - EROFS = syscall.Errno(0x1e) - ERPCMISMATCH = syscall.Errno(0x49) - ESHLIBVERS = syscall.Errno(0x57) - ESHUTDOWN = syscall.Errno(0x3a) - ESOCKTNOSUPPORT = syscall.Errno(0x2c) - ESPIPE = syscall.Errno(0x1d) - ESRCH = syscall.Errno(0x3) - ESTALE = syscall.Errno(0x46) - ETIME = syscall.Errno(0x65) - ETIMEDOUT = syscall.Errno(0x3c) - ETOOMANYREFS = syscall.Errno(0x3b) - ETXTBSY = syscall.Errno(0x1a) - EUSERS = syscall.Errno(0x44) - EWOULDBLOCK = syscall.Errno(0x23) - EXDEV = syscall.Errno(0x12) -) - -// Signals -const ( - SIGABRT = syscall.Signal(0x6) - SIGALRM = syscall.Signal(0xe) - SIGBUS = syscall.Signal(0xa) - SIGCHLD = syscall.Signal(0x14) - SIGCONT = syscall.Signal(0x13) - SIGEMT = syscall.Signal(0x7) - SIGFPE = syscall.Signal(0x8) - SIGHUP = syscall.Signal(0x1) - SIGILL = syscall.Signal(0x4) - SIGINFO = syscall.Signal(0x1d) - SIGINT = syscall.Signal(0x2) - SIGIO = syscall.Signal(0x17) - SIGIOT = syscall.Signal(0x6) - SIGKILL = syscall.Signal(0x9) - SIGPIPE = syscall.Signal(0xd) - SIGPROF = syscall.Signal(0x1b) - SIGQUIT = syscall.Signal(0x3) - SIGSEGV = syscall.Signal(0xb) - SIGSTOP = syscall.Signal(0x11) - SIGSYS = syscall.Signal(0xc) - SIGTERM = syscall.Signal(0xf) - SIGTRAP = syscall.Signal(0x5) - SIGTSTP = syscall.Signal(0x12) - SIGTTIN = syscall.Signal(0x15) - SIGTTOU = syscall.Signal(0x16) - SIGURG = syscall.Signal(0x10) - SIGUSR1 = syscall.Signal(0x1e) - SIGUSR2 = syscall.Signal(0x1f) - SIGVTALRM = syscall.Signal(0x1a) - SIGWINCH = syscall.Signal(0x1c) - SIGXCPU = syscall.Signal(0x18) - SIGXFSZ = syscall.Signal(0x19) -) - -// Error table -var errorList = [...]struct { - num syscall.Errno - name string - desc string -}{ - {1, "EPERM", "operation not permitted"}, - {2, "ENOENT", "no such file or directory"}, - {3, "ESRCH", "no such process"}, - {4, "EINTR", "interrupted system call"}, - {5, "EIO", "input/output error"}, - {6, "ENXIO", "device not configured"}, - {7, "E2BIG", "argument list too long"}, - {8, "ENOEXEC", "exec format error"}, - {9, "EBADF", "bad file descriptor"}, - {10, "ECHILD", "no child processes"}, - {11, "EDEADLK", "resource deadlock avoided"}, - {12, "ENOMEM", "cannot allocate memory"}, - {13, "EACCES", "permission denied"}, - {14, "EFAULT", "bad address"}, - {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "resource busy"}, - {17, "EEXIST", "file exists"}, - {18, "EXDEV", "cross-device link"}, - {19, "ENODEV", "operation not supported by device"}, - {20, "ENOTDIR", "not a directory"}, - {21, "EISDIR", "is a directory"}, - {22, "EINVAL", "invalid argument"}, - {23, "ENFILE", "too many open files in system"}, - {24, "EMFILE", "too many open files"}, - {25, "ENOTTY", "inappropriate ioctl for device"}, - {26, "ETXTBSY", "text file busy"}, - {27, "EFBIG", "file too large"}, - {28, "ENOSPC", "no space left on device"}, - {29, "ESPIPE", "illegal seek"}, - {30, "EROFS", "read-only file system"}, - {31, "EMLINK", "too many links"}, - {32, "EPIPE", "broken pipe"}, - {33, "EDOM", "numerical argument out of domain"}, - {34, "ERANGE", "result too large"}, - {35, "EAGAIN", "resource temporarily unavailable"}, - {36, "EINPROGRESS", "operation now in progress"}, - {37, "EALREADY", "operation already in progress"}, - {38, "ENOTSOCK", "socket operation on non-socket"}, - {39, "EDESTADDRREQ", "destination address required"}, - {40, "EMSGSIZE", "message too long"}, - {41, "EPROTOTYPE", "protocol wrong type for socket"}, - {42, "ENOPROTOOPT", "protocol not available"}, - {43, "EPROTONOSUPPORT", "protocol not supported"}, - {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "ENOTSUP", "operation not supported"}, - {46, "EPFNOSUPPORT", "protocol family not supported"}, - {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, - {48, "EADDRINUSE", "address already in use"}, - {49, "EADDRNOTAVAIL", "can't assign requested address"}, - {50, "ENETDOWN", "network is down"}, - {51, "ENETUNREACH", "network is unreachable"}, - {52, "ENETRESET", "network dropped connection on reset"}, - {53, "ECONNABORTED", "software caused connection abort"}, - {54, "ECONNRESET", "connection reset by peer"}, - {55, "ENOBUFS", "no buffer space available"}, - {56, "EISCONN", "socket is already connected"}, - {57, "ENOTCONN", "socket is not connected"}, - {58, "ESHUTDOWN", "can't send after socket shutdown"}, - {59, "ETOOMANYREFS", "too many references: can't splice"}, - {60, "ETIMEDOUT", "operation timed out"}, - {61, "ECONNREFUSED", "connection refused"}, - {62, "ELOOP", "too many levels of symbolic links"}, - {63, "ENAMETOOLONG", "file name too long"}, - {64, "EHOSTDOWN", "host is down"}, - {65, "EHOSTUNREACH", "no route to host"}, - {66, "ENOTEMPTY", "directory not empty"}, - {67, "EPROCLIM", "too many processes"}, - {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disc quota exceeded"}, - {70, "ESTALE", "stale NFS file handle"}, - {71, "EREMOTE", "too many levels of remote in path"}, - {72, "EBADRPC", "RPC struct is bad"}, - {73, "ERPCMISMATCH", "RPC version wrong"}, - {74, "EPROGUNAVAIL", "RPC prog. not avail"}, - {75, "EPROGMISMATCH", "program version wrong"}, - {76, "EPROCUNAVAIL", "bad procedure for program"}, - {77, "ENOLCK", "no locks available"}, - {78, "ENOSYS", "function not implemented"}, - {79, "EFTYPE", "inappropriate file type or format"}, - {80, "EAUTH", "authentication error"}, - {81, "ENEEDAUTH", "need authenticator"}, - {82, "EPWROFF", "device power is off"}, - {83, "EDEVERR", "device error"}, - {84, "EOVERFLOW", "value too large to be stored in data type"}, - {85, "EBADEXEC", "bad executable (or shared library)"}, - {86, "EBADARCH", "bad CPU type in executable"}, - {87, "ESHLIBVERS", "shared library version mismatch"}, - {88, "EBADMACHO", "malformed Mach-o file"}, - {89, "ECANCELED", "operation canceled"}, - {90, "EIDRM", "identifier removed"}, - {91, "ENOMSG", "no message of desired type"}, - {92, "EILSEQ", "illegal byte sequence"}, - {93, "ENOATTR", "attribute not found"}, - {94, "EBADMSG", "bad message"}, - {95, "EMULTIHOP", "EMULTIHOP (Reserved)"}, - {96, "ENODATA", "no message available on STREAM"}, - {97, "ENOLINK", "ENOLINK (Reserved)"}, - {98, "ENOSR", "no STREAM resources"}, - {99, "ENOSTR", "not a STREAM"}, - {100, "EPROTO", "protocol error"}, - {101, "ETIME", "STREAM ioctl timeout"}, - {102, "EOPNOTSUPP", "operation not supported on socket"}, - {103, "ENOPOLICY", "policy not found"}, - {104, "ENOTRECOVERABLE", "state not recoverable"}, - {105, "EOWNERDEAD", "previous owner died"}, - {106, "EQFULL", "interface output queue is full"}, -} - -// Signal table -var signalList = [...]struct { - num syscall.Signal - name string - desc string -}{ - {1, "SIGHUP", "hangup"}, - {2, "SIGINT", "interrupt"}, - {3, "SIGQUIT", "quit"}, - {4, "SIGILL", "illegal instruction"}, - {5, "SIGTRAP", "trace/BPT trap"}, - {6, "SIGABRT", "abort trap"}, - {7, "SIGEMT", "EMT trap"}, - {8, "SIGFPE", "floating point exception"}, - {9, "SIGKILL", "killed"}, - {10, "SIGBUS", "bus error"}, - {11, "SIGSEGV", "segmentation fault"}, - {12, "SIGSYS", "bad system call"}, - {13, "SIGPIPE", "broken pipe"}, - {14, "SIGALRM", "alarm clock"}, - {15, "SIGTERM", "terminated"}, - {16, "SIGURG", "urgent I/O condition"}, - {17, "SIGSTOP", "suspended (signal)"}, - {18, "SIGTSTP", "suspended"}, - {19, "SIGCONT", "continued"}, - {20, "SIGCHLD", "child exited"}, - {21, "SIGTTIN", "stopped (tty input)"}, - {22, "SIGTTOU", "stopped (tty output)"}, - {23, "SIGIO", "I/O possible"}, - {24, "SIGXCPU", "cputime limit exceeded"}, - {25, "SIGXFSZ", "filesize limit exceeded"}, - {26, "SIGVTALRM", "virtual timer expired"}, - {27, "SIGPROF", "profiling timer expired"}, - {28, "SIGWINCH", "window size changes"}, - {29, "SIGINFO", "information request"}, - {30, "SIGUSR1", "user defined signal 1"}, - {31, "SIGUSR2", "user defined signal 2"}, -} diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go index cbd8ed18b9..e36f5178d6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && darwin // +build arm64,darwin // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -11,1475 +12,1582 @@ package unix import "syscall" const ( - AF_APPLETALK = 0x10 - AF_CCITT = 0xa - AF_CHAOS = 0x5 - AF_CNT = 0x15 - AF_COIP = 0x14 - AF_DATAKIT = 0x9 - AF_DECnet = 0xc - AF_DLI = 0xd - AF_E164 = 0x1c - AF_ECMA = 0x8 - AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 - AF_IMPLINK = 0x3 - AF_INET = 0x2 - AF_INET6 = 0x1e - AF_IPX = 0x17 - AF_ISDN = 0x1c - AF_ISO = 0x7 - AF_LAT = 0xe - AF_LINK = 0x12 - AF_LOCAL = 0x1 - AF_MAX = 0x28 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 - AF_NS = 0x6 - AF_OSI = 0x7 - AF_PPP = 0x22 - AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 - AF_ROUTE = 0x11 - AF_SIP = 0x18 - AF_SNA = 0xb - AF_SYSTEM = 0x20 - AF_UNIX = 0x1 - AF_UNSPEC = 0x0 - AF_UTUN = 0x26 - ALTWERASE = 0x200 - ATTR_BIT_MAP_COUNT = 0x5 - ATTR_CMN_ACCESSMASK = 0x20000 - ATTR_CMN_ACCTIME = 0x1000 - ATTR_CMN_ADDEDTIME = 0x10000000 - ATTR_CMN_BKUPTIME = 0x2000 - ATTR_CMN_CHGTIME = 0x800 - ATTR_CMN_CRTIME = 0x200 - ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 - ATTR_CMN_DEVID = 0x2 - ATTR_CMN_DOCUMENT_ID = 0x100000 - ATTR_CMN_ERROR = 0x20000000 - ATTR_CMN_EXTENDED_SECURITY = 0x400000 - ATTR_CMN_FILEID = 0x2000000 - ATTR_CMN_FLAGS = 0x40000 - ATTR_CMN_FNDRINFO = 0x4000 - ATTR_CMN_FSID = 0x4 - ATTR_CMN_FULLPATH = 0x8000000 - ATTR_CMN_GEN_COUNT = 0x80000 - ATTR_CMN_GRPID = 0x10000 - ATTR_CMN_GRPUUID = 0x1000000 - ATTR_CMN_MODTIME = 0x400 - ATTR_CMN_NAME = 0x1 - ATTR_CMN_NAMEDATTRCOUNT = 0x80000 - ATTR_CMN_NAMEDATTRLIST = 0x100000 - ATTR_CMN_OBJID = 0x20 - ATTR_CMN_OBJPERMANENTID = 0x40 - ATTR_CMN_OBJTAG = 0x10 - ATTR_CMN_OBJTYPE = 0x8 - ATTR_CMN_OWNERID = 0x8000 - ATTR_CMN_PARENTID = 0x4000000 - ATTR_CMN_PAROBJID = 0x80 - ATTR_CMN_RETURNED_ATTRS = 0x80000000 - ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x41c7ff00 - ATTR_CMN_USERACCESS = 0x200000 - ATTR_CMN_UUID = 0x800000 - ATTR_CMN_VALIDMASK = 0xffffffff - ATTR_CMN_VOLSETMASK = 0x6700 - ATTR_FILE_ALLOCSIZE = 0x4 - ATTR_FILE_CLUMPSIZE = 0x10 - ATTR_FILE_DATAALLOCSIZE = 0x400 - ATTR_FILE_DATAEXTENTS = 0x800 - ATTR_FILE_DATALENGTH = 0x200 - ATTR_FILE_DEVTYPE = 0x20 - ATTR_FILE_FILETYPE = 0x40 - ATTR_FILE_FORKCOUNT = 0x80 - ATTR_FILE_FORKLIST = 0x100 - ATTR_FILE_IOBLOCKSIZE = 0x8 - ATTR_FILE_LINKCOUNT = 0x1 - ATTR_FILE_RSRCALLOCSIZE = 0x2000 - ATTR_FILE_RSRCEXTENTS = 0x4000 - ATTR_FILE_RSRCLENGTH = 0x1000 - ATTR_FILE_SETMASK = 0x20 - ATTR_FILE_TOTALSIZE = 0x2 - ATTR_FILE_VALIDMASK = 0x37ff - ATTR_VOL_ALLOCATIONCLUMP = 0x40 - ATTR_VOL_ATTRIBUTES = 0x40000000 - ATTR_VOL_CAPABILITIES = 0x20000 - ATTR_VOL_DIRCOUNT = 0x400 - ATTR_VOL_ENCODINGSUSED = 0x10000 - ATTR_VOL_FILECOUNT = 0x200 - ATTR_VOL_FSTYPE = 0x1 - ATTR_VOL_INFO = 0x80000000 - ATTR_VOL_IOBLOCKSIZE = 0x80 - ATTR_VOL_MAXOBJCOUNT = 0x800 - ATTR_VOL_MINALLOCATION = 0x20 - ATTR_VOL_MOUNTEDDEVICE = 0x8000 - ATTR_VOL_MOUNTFLAGS = 0x4000 - ATTR_VOL_MOUNTPOINT = 0x1000 - ATTR_VOL_NAME = 0x2000 - ATTR_VOL_OBJCOUNT = 0x100 - ATTR_VOL_QUOTA_SIZE = 0x10000000 - ATTR_VOL_RESERVED_SIZE = 0x20000000 - ATTR_VOL_SETMASK = 0x80002000 - ATTR_VOL_SIGNATURE = 0x2 - ATTR_VOL_SIZE = 0x4 - ATTR_VOL_SPACEAVAIL = 0x10 - ATTR_VOL_SPACEFREE = 0x8 - ATTR_VOL_UUID = 0x40000 - ATTR_VOL_VALIDMASK = 0xf007ffff - B0 = 0x0 - B110 = 0x6e - B115200 = 0x1c200 - B1200 = 0x4b0 - B134 = 0x86 - B14400 = 0x3840 - B150 = 0x96 - B1800 = 0x708 - B19200 = 0x4b00 - B200 = 0xc8 - B230400 = 0x38400 - B2400 = 0x960 - B28800 = 0x7080 - B300 = 0x12c - B38400 = 0x9600 - B4800 = 0x12c0 - B50 = 0x32 - B57600 = 0xe100 - B600 = 0x258 - B7200 = 0x1c20 - B75 = 0x4b - B76800 = 0x12c00 - B9600 = 0x2580 - BIOCFLUSH = 0x20004268 - BIOCGBLEN = 0x40044266 - BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 - BIOCGETIF = 0x4020426b - BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4010426e - BIOCGSEESENT = 0x40044276 - BIOCGSTATS = 0x4008426f - BIOCIMMEDIATE = 0x80044270 - BIOCPROMISC = 0x20004269 - BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80104267 - BIOCSETFNR = 0x8010427e - BIOCSETIF = 0x8020426c - BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8010426d - BIOCSSEESENT = 0x80044277 - BIOCVERSION = 0x40044271 - BPF_A = 0x10 - BPF_ABS = 0x20 - BPF_ADD = 0x0 - BPF_ALIGNMENT = 0x4 - BPF_ALU = 0x4 - BPF_AND = 0x50 - BPF_B = 0x10 - BPF_DIV = 0x30 - BPF_H = 0x8 - BPF_IMM = 0x0 - BPF_IND = 0x40 - BPF_JA = 0x0 - BPF_JEQ = 0x10 - BPF_JGE = 0x30 - BPF_JGT = 0x20 - BPF_JMP = 0x5 - BPF_JSET = 0x40 - BPF_K = 0x0 - BPF_LD = 0x0 - BPF_LDX = 0x1 - BPF_LEN = 0x80 - BPF_LSH = 0x60 - BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 - BPF_MAXINSNS = 0x200 - BPF_MEM = 0x60 - BPF_MEMWORDS = 0x10 - BPF_MINBUFSIZE = 0x20 - BPF_MINOR_VERSION = 0x1 - BPF_MISC = 0x7 - BPF_MSH = 0xa0 - BPF_MUL = 0x20 - BPF_NEG = 0x80 - BPF_OR = 0x40 - BPF_RELEASE = 0x30bb6 - BPF_RET = 0x6 - BPF_RSH = 0x70 - BPF_ST = 0x2 - BPF_STX = 0x3 - BPF_SUB = 0x10 - BPF_TAX = 0x0 - BPF_TXA = 0x80 - BPF_W = 0x0 - BPF_X = 0x8 - BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 - CFLUSH = 0xf - CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_MONOTONIC_RAW_APPROX = 0x5 - CLOCK_PROCESS_CPUTIME_ID = 0xc - CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x10 - CLOCK_UPTIME_RAW = 0x8 - CLOCK_UPTIME_RAW_APPROX = 0x9 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 - CREAD = 0x800 - CRTSCTS = 0x30000 - CS5 = 0x0 - CS6 = 0x100 - CS7 = 0x200 - CS8 = 0x300 - CSIZE = 0x300 - CSTART = 0x11 - CSTATUS = 0x14 - CSTOP = 0x13 - CSTOPB = 0x400 - CSUSP = 0x1a - CTL_HW = 0x6 - CTL_KERN = 0x1 - CTL_MAXNAME = 0xc - CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a - DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 - DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e - DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 - DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 - DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 - DLT_EN10MB = 0x1 - DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 - DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 - DLT_IEEE802 = 0x6 - DLT_IEEE802_11 = 0x69 - DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 - DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 - DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d - DLT_PFLOG = 0x75 - DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 - DLT_PPP = 0x9 - DLT_PPP_BSDOS = 0x10 - DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 - DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 - DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 - DLT_SLIP = 0x8 - DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc - DLT_USER0 = 0x93 - DLT_USER1 = 0x94 - DLT_USER10 = 0x9d - DLT_USER11 = 0x9e - DLT_USER12 = 0x9f - DLT_USER13 = 0xa0 - DLT_USER14 = 0xa1 - DLT_USER15 = 0xa2 - DLT_USER2 = 0x95 - DLT_USER3 = 0x96 - DLT_USER4 = 0x97 - DLT_USER5 = 0x98 - DLT_USER6 = 0x99 - DLT_USER7 = 0x9a - DLT_USER8 = 0x9b - DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 - DT_BLK = 0x6 - DT_CHR = 0x2 - DT_DIR = 0x4 - DT_FIFO = 0x1 - DT_LNK = 0xa - DT_REG = 0x8 - DT_SOCK = 0xc - DT_UNKNOWN = 0x0 - DT_WHT = 0xe - ECHO = 0x8 - ECHOCTL = 0x40 - ECHOE = 0x2 - ECHOK = 0x4 - ECHOKE = 0x1 - ECHONL = 0x10 - ECHOPRT = 0x20 - EVFILT_AIO = -0x3 - EVFILT_EXCEPT = -0xf - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 - EVFILT_PROC = -0x5 - EVFILT_READ = -0x1 - EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xf - EVFILT_THREADMARKER = 0xf - EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc - EVFILT_VNODE = -0x4 - EVFILT_WRITE = -0x2 - EV_ADD = 0x1 - EV_CLEAR = 0x20 - EV_DELETE = 0x2 - EV_DISABLE = 0x8 - EV_DISPATCH = 0x80 - EV_DISPATCH2 = 0x180 - EV_ENABLE = 0x4 - EV_EOF = 0x8000 - EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 - EV_FLAG1 = 0x2000 - EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 - EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 - EV_UDATA_SPECIFIC = 0x100 - EV_VANISHED = 0x200 - EXTA = 0x4b00 - EXTB = 0x9600 - EXTPROC = 0x800 - FD_CLOEXEC = 0x1 - FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 - FLUSHO = 0x800000 - FSOPT_ATTR_CMN_EXTENDED = 0x20 - FSOPT_NOFOLLOW = 0x1 - FSOPT_NOINMEMUPDATE = 0x2 - FSOPT_PACK_INVAL_ATTRS = 0x8 - FSOPT_REPORT_FULLSIZE = 0x4 - F_ADDFILESIGS = 0x3d - F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 - F_ADDFILESIGS_RETURN = 0x61 - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_BARRIERFSYNC = 0x55 - F_CHECK_LV = 0x62 - F_CHKCLEAN = 0x29 - F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 - F_GETFD = 0x1 - F_GETFL = 0x3 - F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a - F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e - F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_PUNCHHOLE = 0x63 - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d - F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 - F_SETFD = 0x2 - F_SETFL = 0x4 - F_SETLK = 0x8 - F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 - F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_TRIM_ACTIVE_FILE = 0x64 - F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 - F_WRLCK = 0x3 - HUPCL = 0x4000 - HW_MACHINE = 0x1 - ICANON = 0x100 - ICMP6_FILTER = 0x12 - ICRNL = 0x100 - IEXTEN = 0x400 - IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 - IFF_BROADCAST = 0x2 - IFF_DEBUG = 0x4 - IFF_LINK0 = 0x1000 - IFF_LINK1 = 0x2000 - IFF_LINK2 = 0x4000 - IFF_LOOPBACK = 0x8 - IFF_MULTICAST = 0x8000 - IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 - IFF_OACTIVE = 0x400 - IFF_POINTOPOINT = 0x10 - IFF_PROMISC = 0x100 - IFF_RUNNING = 0x40 - IFF_SIMPLEX = 0x800 - IFF_UP = 0x1 - IFNAMSIZ = 0x10 - IFT_1822 = 0x2 - IFT_AAL5 = 0x31 - IFT_ARCNET = 0x23 - IFT_ARCNETPLUS = 0x24 - IFT_ATM = 0x25 - IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff - IFT_CEPT = 0x13 - IFT_DS3 = 0x1e - IFT_ENC = 0xf4 - IFT_EON = 0x19 - IFT_ETHER = 0x6 - IFT_FAITH = 0x38 - IFT_FDDI = 0xf - IFT_FRELAY = 0x20 - IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 - IFT_HDH1822 = 0x3 - IFT_HIPPI = 0x2f - IFT_HSSI = 0x2e - IFT_HY = 0xe - IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 - IFT_ISDNBASIC = 0x14 - IFT_ISDNPRIMARY = 0x15 - IFT_ISO88022LLC = 0x29 - IFT_ISO88023 = 0x7 - IFT_ISO88024 = 0x8 - IFT_ISO88025 = 0x9 - IFT_ISO88026 = 0xa - IFT_L2VLAN = 0x87 - IFT_LAPB = 0x10 - IFT_LOCALTALK = 0x2a - IFT_LOOP = 0x18 - IFT_MIOX25 = 0x26 - IFT_MODEM = 0x30 - IFT_NSIP = 0x1b - IFT_OTHER = 0x1 - IFT_P10 = 0xc - IFT_P80 = 0xd - IFT_PARA = 0x22 - IFT_PDP = 0xff - IFT_PFLOG = 0xf5 - IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe - IFT_PPP = 0x17 - IFT_PROPMUX = 0x36 - IFT_PROPVIRTUAL = 0x35 - IFT_PTPSERIAL = 0x16 - IFT_RS232 = 0x21 - IFT_SDLC = 0x11 - IFT_SIP = 0x1f - IFT_SLIP = 0x1c - IFT_SMDSDXI = 0x2b - IFT_SMDSICIP = 0x34 - IFT_SONET = 0x27 - IFT_SONETPATH = 0x32 - IFT_SONETVT = 0x33 - IFT_STARLAN = 0xb - IFT_STF = 0x39 - IFT_T1 = 0x12 - IFT_ULTRA = 0x1d - IFT_V35 = 0x2d - IFT_X25 = 0x5 - IFT_X25DDN = 0x4 - IFT_X25PLE = 0x28 - IFT_XETHER = 0x1a - IGNBRK = 0x1 - IGNCR = 0x80 - IGNPAR = 0x4 - IMAXBEL = 0x2000 - INLCR = 0x40 - INPCK = 0x10 - IN_CLASSA_HOST = 0xffffff - IN_CLASSA_MAX = 0x80 - IN_CLASSA_NET = 0xff000000 - IN_CLASSA_NSHIFT = 0x18 - IN_CLASSB_HOST = 0xffff - IN_CLASSB_MAX = 0x10000 - IN_CLASSB_NET = 0xffff0000 - IN_CLASSB_NSHIFT = 0x10 - IN_CLASSC_HOST = 0xff - IN_CLASSC_NET = 0xffffff00 - IN_CLASSC_NSHIFT = 0x8 - IN_CLASSD_HOST = 0xfffffff - IN_CLASSD_NET = 0xf0000000 - IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 - IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 - IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe - IPPROTO_DONE = 0x101 - IPPROTO_DSTOPTS = 0x3c - IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe - IPPROTO_ENCAP = 0x62 - IPPROTO_EON = 0x50 - IPPROTO_ESP = 0x32 - IPPROTO_ETHERIP = 0x61 - IPPROTO_FRAGMENT = 0x2c - IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 - IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 - IPPROTO_HOPOPTS = 0x0 - IPPROTO_ICMP = 0x1 - IPPROTO_ICMPV6 = 0x3a - IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d - IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 - IPPROTO_IP = 0x0 - IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e - IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 - IPPROTO_IPV4 = 0x4 - IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a - IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 - IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 - IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 - IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b - IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b - IPPROTO_ROUTING = 0x2b - IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 - IPPROTO_TCP = 0x6 - IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 - IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d - IPV6_CHECKSUM = 0x1a - IPV6_DEFAULT_MULTICAST_HOPS = 0x1 - IPV6_DEFAULT_MULTICAST_LOOP = 0x1 - IPV6_DEFHLIM = 0x40 - IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x300 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 - IPV6_HLIMDEC = 0x1 - IPV6_IPSEC_POLICY = 0x1c - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 - IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f - IPV6_MMTU = 0x500 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_LOOP = 0xb - IPV6_PORTRANGE = 0xe - IPV6_PORTRANGE_DEFAULT = 0x0 - IPV6_PORTRANGE_HIGH = 0x1 - IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVTCLASS = 0x23 - IPV6_RTHDR_LOOSE = 0x0 - IPV6_RTHDR_STRICT = 0x1 - IPV6_RTHDR_TYPE_0 = 0x0 - IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 - IPV6_UNICAST_HOPS = 0x4 - IPV6_V6ONLY = 0x1b - IPV6_VERSION = 0x60 - IPV6_VERSION_MASK = 0xf0 - IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 - IP_DEFAULT_MULTICAST_LOOP = 0x1 - IP_DEFAULT_MULTICAST_TTL = 0x1 - IP_DF = 0x4000 - IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b - IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 - IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 - IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 - IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a - IP_MSS = 0x240 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 - IP_MULTICAST_LOOP = 0xb - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 - IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 - IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a - IP_PORTRANGE = 0x13 - IP_PORTRANGE_DEFAULT = 0x0 - IP_PORTRANGE_HIGH = 0x1 - IP_PORTRANGE_LOW = 0x2 - IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 - IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a - IP_RECVRETOPTS = 0x6 - IP_RECVTOS = 0x1b - IP_RECVTTL = 0x18 - IP_RETOPTS = 0x8 - IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 - IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 - IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 - ISIG = 0x80 - ISTRIP = 0x20 - IUTF8 = 0x4000 - IXANY = 0x800 - IXOFF = 0x400 - IXON = 0x200 - KERN_HOSTNAME = 0xa - KERN_OSRELEASE = 0x2 - KERN_OSTYPE = 0x1 - KERN_VERSION = 0x4 - LOCK_EX = 0x2 - LOCK_NB = 0x4 - LOCK_SH = 0x1 - LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 - MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 - MADV_NORMAL = 0x0 - MADV_PAGEOUT = 0xa - MADV_RANDOM = 0x1 - MADV_SEQUENTIAL = 0x2 - MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 - MAP_ANON = 0x1000 - MAP_ANONYMOUS = 0x1000 - MAP_COPY = 0x2 - MAP_FILE = 0x0 - MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 - MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_RESILIENT_CODESIGN = 0x2000 - MAP_RESILIENT_MEDIA = 0x4000 - MAP_SHARED = 0x1 - MCL_CURRENT = 0x1 - MCL_FUTURE = 0x2 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x400000 - MNT_CMDFLAGS = 0xf0000 - MNT_CPROTECT = 0x80 - MNT_DEFWRITE = 0x2000000 - MNT_DONTBROWSE = 0x100000 - MNT_DOVOLFS = 0x8000 - MNT_DWAIT = 0x4 - MNT_EXPORTED = 0x100 - MNT_FORCE = 0x80000 - MNT_IGNORE_OWNERSHIP = 0x200000 - MNT_JOURNALED = 0x800000 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NOATIME = 0x10000000 - MNT_NOBLOCK = 0x20000 - MNT_NODEV = 0x10 - MNT_NOEXEC = 0x4 - MNT_NOSUID = 0x8 - MNT_NOUSERXATTR = 0x1000000 - MNT_NOWAIT = 0x2 - MNT_QUARANTINE = 0x400 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UNKNOWNPERMISSIONS = 0x200000 - MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x17f0f5ff - MNT_WAIT = 0x1 - MSG_CTRUNC = 0x20 - MSG_DONTROUTE = 0x4 - MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 - MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 - MSG_TRUNC = 0x10 - MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 - MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 - NAME_MAX = 0xff - NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 - NET_RT_FLAGS = 0x2 - NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 - NFDBITS = 0x20 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLDLY = 0x300 - NOFLSH = 0x80000000 - NOKERNINFO = 0x2000000 - NOTE_ABSOLUTE = 0x8 - NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 - NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 - NOTE_DELETE = 0x1 - NOTE_EXEC = 0x20000000 - NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 - NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 - NOTE_FORK = 0x40000000 - NOTE_FUNLOCK = 0x100 - NOTE_LEEWAY = 0x10 - NOTE_LINK = 0x10 - NOTE_LOWAT = 0x1 - NOTE_MACH_CONTINUOUS_TIME = 0x80 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_OOB = 0x2 - NOTE_PCTRLMASK = -0x100000 - NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 - NOTE_RENAME = 0x20 - NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 - NOTE_TRACK = 0x1 - NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 - NOTE_WRITE = 0x2 - OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 - ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 - ONOEOT = 0x8 - OPOST = 0x1 - OXTABS = 0x4 - O_ACCMODE = 0x3 - O_ALERT = 0x20000000 - O_APPEND = 0x8 - O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 - O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DP_GETRAWUNENCRYPTED = 0x2 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 - O_EXCL = 0x800 - O_EXLOCK = 0x20 - O_FSYNC = 0x80 - O_NDELAY = 0x4 - O_NOCTTY = 0x20000 - O_NOFOLLOW = 0x100 - O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 - O_RDONLY = 0x0 - O_RDWR = 0x2 - O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 - O_SYNC = 0x80 - O_TRUNC = 0x400 - O_WRONLY = 0x1 - PARENB = 0x1000 - PARMRK = 0x8 - PARODD = 0x2000 - PENDIN = 0x20000000 - PRIO_PGRP = 0x1 - PRIO_PROCESS = 0x0 - PRIO_USER = 0x2 - PROT_EXEC = 0x4 - PROT_NONE = 0x0 - PROT_READ = 0x1 - PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 - RLIMIT_CORE = 0x4 - RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 - RLIMIT_DATA = 0x2 - RLIMIT_FSIZE = 0x1 - RLIMIT_MEMLOCK = 0x6 - RLIMIT_NOFILE = 0x8 - RLIMIT_NPROC = 0x7 - RLIMIT_RSS = 0x5 - RLIMIT_STACK = 0x3 - RLIM_INFINITY = 0x7fffffffffffffff - RTAX_AUTHOR = 0x6 - RTAX_BRD = 0x7 - RTAX_DST = 0x0 - RTAX_GATEWAY = 0x1 - RTAX_GENMASK = 0x3 - RTAX_IFA = 0x5 - RTAX_IFP = 0x4 - RTAX_MAX = 0x8 - RTAX_NETMASK = 0x2 - RTA_AUTHOR = 0x40 - RTA_BRD = 0x80 - RTA_DST = 0x1 - RTA_GATEWAY = 0x2 - RTA_GENMASK = 0x8 - RTA_IFA = 0x20 - RTA_IFP = 0x10 - RTA_NETMASK = 0x4 - RTF_BLACKHOLE = 0x1000 - RTF_BROADCAST = 0x400000 - RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DELCLONE = 0x80 - RTF_DONE = 0x40 - RTF_DYNAMIC = 0x10 - RTF_GATEWAY = 0x2 - RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 - RTF_LLINFO = 0x400 - RTF_LOCAL = 0x200000 - RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 - RTF_PROTO1 = 0x8000 - RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 - RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 - RTF_STATIC = 0x800 - RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 - RTM_ADD = 0x1 - RTM_CHANGE = 0x3 - RTM_DELADDR = 0xd - RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 - RTM_GET = 0x4 - RTM_GET2 = 0x14 - RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 - RTM_LOSING = 0x5 - RTM_MISS = 0x7 - RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa - RTM_REDIRECT = 0x6 - RTM_RESOLVE = 0xb - RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x5 - RTV_EXPIRE = 0x4 - RTV_HOPCOUNT = 0x2 - RTV_MTU = 0x1 - RTV_RPIPE = 0x8 - RTV_RTT = 0x40 - RTV_RTTVAR = 0x80 - RTV_SPIPE = 0x10 - RTV_SSTHRESH = 0x20 - RUSAGE_CHILDREN = -0x1 - RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 - SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 - SHUT_RD = 0x0 - SHUT_RDWR = 0x2 - SHUT_WR = 0x1 - SIOCADDMULTI = 0x80206931 - SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 - SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 - SIOCDELMULTI = 0x80206932 - SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc028697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 - SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 - SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc00c6924 - SIOCGIFDEVMTU = 0xc0206944 - SIOCGIFDSTADDR = 0xc0206922 - SIOCGIFFLAGS = 0xc0206911 - SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc02c6938 - SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 - SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGLOWAT = 0x40047303 - SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a - SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc0106981 - SIOCRSLVMULTI = 0xc010693b - SIOCSDRVSPEC = 0x8028697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 - SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 - SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a - SIOCSIFDSTADDR = 0x8020690e - SIOCSIFFLAGS = 0x80206910 - SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 - SIOCSIFMEDIA = 0xc0206937 - SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 - SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 - SIOCSPGRP = 0x80047308 - SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff - SOCK_RAW = 0x3 - SOCK_RDM = 0x4 - SOCK_SEQPACKET = 0x5 - SOCK_STREAM = 0x1 - SOL_SOCKET = 0xffff - SOMAXCONN = 0x80 - SO_ACCEPTCONN = 0x2 - SO_BROADCAST = 0x20 - SO_DEBUG = 0x1 - SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 - SO_ERROR = 0x1007 - SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 - SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NETSVC_MARKING_LEVEL = 0x1119 - SO_NET_SERVICE_TYPE = 0x1116 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 - SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 - SO_RCVBUF = 0x1002 - SO_RCVLOWAT = 0x1004 - SO_RCVTIMEO = 0x1006 - SO_REUSEADDR = 0x4 - SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 - SO_SNDBUF = 0x1001 - SO_SNDLOWAT = 0x1003 - SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 - SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 - SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 - S_IEXEC = 0x40 - S_IFBLK = 0x6000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFIFO = 0x1000 - S_IFLNK = 0xa000 - S_IFMT = 0xf000 - S_IFREG = 0x8000 - S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 - S_IREAD = 0x100 - S_IRGRP = 0x20 - S_IROTH = 0x4 - S_IRUSR = 0x100 - S_IRWXG = 0x38 - S_IRWXO = 0x7 - S_IRWXU = 0x1c0 - S_ISGID = 0x400 - S_ISTXT = 0x200 - S_ISUID = 0x800 - S_ISVTX = 0x200 - S_IWGRP = 0x10 - S_IWOTH = 0x2 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXGRP = 0x8 - S_IXOTH = 0x1 - S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0x4 - TABDLY = 0xc04 - TCIFLUSH = 0x1 - TCIOFF = 0x3 - TCIOFLUSH = 0x3 - TCION = 0x4 - TCOFLUSH = 0x2 - TCOOFF = 0x1 - TCOON = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_CONNECTION_INFO = 0x106 - TCP_ENABLE_ECN = 0x104 - TCP_FASTOPEN = 0x105 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 - TCP_MAXSEG = 0x2 - TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 - TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 - TCP_MSS = 0x200 - TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 - TCSAFLUSH = 0x2 - TIOCCBRK = 0x2000747a - TIOCCDTR = 0x20007478 - TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40107458 - TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 - TIOCEXCL = 0x2000740d - TIOCEXT = 0x80047460 - TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 - TIOCGETA = 0x40487413 - TIOCGETD = 0x4004741a - TIOCGPGRP = 0x40047477 - TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 - TIOCMBIC = 0x8004746b - TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a - TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b - TIOCMSET = 0x8004746d - TIOCM_CAR = 0x40 - TIOCM_CD = 0x40 - TIOCM_CTS = 0x20 - TIOCM_DSR = 0x100 - TIOCM_DTR = 0x2 - TIOCM_LE = 0x1 - TIOCM_RI = 0x80 - TIOCM_RNG = 0x80 - TIOCM_RTS = 0x4 - TIOCM_SR = 0x10 - TIOCM_ST = 0x8 - TIOCNOTTY = 0x20007471 - TIOCNXCL = 0x2000740e - TIOCOUTQ = 0x40047473 - TIOCPKT = 0x80047470 - TIOCPKT_DATA = 0x0 - TIOCPKT_DOSTOP = 0x20 - TIOCPKT_FLUSHREAD = 0x1 - TIOCPKT_FLUSHWRITE = 0x2 - TIOCPKT_IOCTL = 0x40 - TIOCPKT_NOSTOP = 0x10 - TIOCPKT_START = 0x8 - TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 - TIOCREMOTE = 0x80047469 - TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 - TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 - TIOCSDTR = 0x20007479 - TIOCSETA = 0x80487414 - TIOCSETAF = 0x80487416 - TIOCSETAW = 0x80487415 - TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f - TIOCSPGRP = 0x80047476 - TIOCSTART = 0x2000746e - TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 - TIOCSTOP = 0x2000746f - TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40107459 - TIOCUCNTL = 0x80047466 - TOSTOP = 0x400000 - VDISCARD = 0xf - VDSUSP = 0xb - VEOF = 0x0 - VEOL = 0x1 - VEOL2 = 0x2 - VERASE = 0x3 - VINTR = 0x8 - VKILL = 0x5 - VLNEXT = 0xe - VMIN = 0x10 - VM_LOADAVG = 0x2 - VM_MACHFACTOR = 0x4 - VM_MAXID = 0x6 - VM_METER = 0x1 - VM_SWAPUSAGE = 0x5 - VQUIT = 0x9 - VREPRINT = 0x6 - VSTART = 0xc - VSTATUS = 0x12 - VSTOP = 0xd - VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 - VTIME = 0x11 - VWERASE = 0x4 - WCONTINUED = 0x10 - WCOREFLAG = 0x80 - WEXITED = 0x4 - WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x40 - WSTOPPED = 0x8 - WUNTRACED = 0x2 - XATTR_CREATE = 0x2 - XATTR_NODEFAULT = 0x10 - XATTR_NOFOLLOW = 0x1 - XATTR_NOSECURITY = 0x8 - XATTR_REPLACE = 0x4 - XATTR_SHOWCOMPRESSION = 0x20 + AF_APPLETALK = 0x10 + AF_CCITT = 0xa + AF_CHAOS = 0x5 + AF_CNT = 0x15 + AF_COIP = 0x14 + AF_DATAKIT = 0x9 + AF_DECnet = 0xc + AF_DLI = 0xd + AF_E164 = 0x1c + AF_ECMA = 0x8 + AF_HYLINK = 0xf + AF_IEEE80211 = 0x25 + AF_IMPLINK = 0x3 + AF_INET = 0x2 + AF_INET6 = 0x1e + AF_IPX = 0x17 + AF_ISDN = 0x1c + AF_ISO = 0x7 + AF_LAT = 0xe + AF_LINK = 0x12 + AF_LOCAL = 0x1 + AF_MAX = 0x29 + AF_NATM = 0x1f + AF_NDRV = 0x1b + AF_NETBIOS = 0x21 + AF_NS = 0x6 + AF_OSI = 0x7 + AF_PPP = 0x22 + AF_PUP = 0x4 + AF_RESERVED_36 = 0x24 + AF_ROUTE = 0x11 + AF_SIP = 0x18 + AF_SNA = 0xb + AF_SYSTEM = 0x20 + AF_SYS_CONTROL = 0x2 + AF_UNIX = 0x1 + AF_UNSPEC = 0x0 + AF_UTUN = 0x26 + AF_VSOCK = 0x28 + ALTWERASE = 0x200 + ATTR_BIT_MAP_COUNT = 0x5 + ATTR_CMN_ACCESSMASK = 0x20000 + ATTR_CMN_ACCTIME = 0x1000 + ATTR_CMN_ADDEDTIME = 0x10000000 + ATTR_CMN_BKUPTIME = 0x2000 + ATTR_CMN_CHGTIME = 0x800 + ATTR_CMN_CRTIME = 0x200 + ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 + ATTR_CMN_DEVID = 0x2 + ATTR_CMN_DOCUMENT_ID = 0x100000 + ATTR_CMN_ERROR = 0x20000000 + ATTR_CMN_EXTENDED_SECURITY = 0x400000 + ATTR_CMN_FILEID = 0x2000000 + ATTR_CMN_FLAGS = 0x40000 + ATTR_CMN_FNDRINFO = 0x4000 + ATTR_CMN_FSID = 0x4 + ATTR_CMN_FULLPATH = 0x8000000 + ATTR_CMN_GEN_COUNT = 0x80000 + ATTR_CMN_GRPID = 0x10000 + ATTR_CMN_GRPUUID = 0x1000000 + ATTR_CMN_MODTIME = 0x400 + ATTR_CMN_NAME = 0x1 + ATTR_CMN_NAMEDATTRCOUNT = 0x80000 + ATTR_CMN_NAMEDATTRLIST = 0x100000 + ATTR_CMN_OBJID = 0x20 + ATTR_CMN_OBJPERMANENTID = 0x40 + ATTR_CMN_OBJTAG = 0x10 + ATTR_CMN_OBJTYPE = 0x8 + ATTR_CMN_OWNERID = 0x8000 + ATTR_CMN_PARENTID = 0x4000000 + ATTR_CMN_PAROBJID = 0x80 + ATTR_CMN_RETURNED_ATTRS = 0x80000000 + ATTR_CMN_SCRIPT = 0x100 + ATTR_CMN_SETMASK = 0x51c7ff00 + ATTR_CMN_USERACCESS = 0x200000 + ATTR_CMN_UUID = 0x800000 + ATTR_CMN_VALIDMASK = 0xffffffff + ATTR_CMN_VOLSETMASK = 0x6700 + ATTR_FILE_ALLOCSIZE = 0x4 + ATTR_FILE_CLUMPSIZE = 0x10 + ATTR_FILE_DATAALLOCSIZE = 0x400 + ATTR_FILE_DATAEXTENTS = 0x800 + ATTR_FILE_DATALENGTH = 0x200 + ATTR_FILE_DEVTYPE = 0x20 + ATTR_FILE_FILETYPE = 0x40 + ATTR_FILE_FORKCOUNT = 0x80 + ATTR_FILE_FORKLIST = 0x100 + ATTR_FILE_IOBLOCKSIZE = 0x8 + ATTR_FILE_LINKCOUNT = 0x1 + ATTR_FILE_RSRCALLOCSIZE = 0x2000 + ATTR_FILE_RSRCEXTENTS = 0x4000 + ATTR_FILE_RSRCLENGTH = 0x1000 + ATTR_FILE_SETMASK = 0x20 + ATTR_FILE_TOTALSIZE = 0x2 + ATTR_FILE_VALIDMASK = 0x37ff + ATTR_VOL_ALLOCATIONCLUMP = 0x40 + ATTR_VOL_ATTRIBUTES = 0x40000000 + ATTR_VOL_CAPABILITIES = 0x20000 + ATTR_VOL_DIRCOUNT = 0x400 + ATTR_VOL_ENCODINGSUSED = 0x10000 + ATTR_VOL_FILECOUNT = 0x200 + ATTR_VOL_FSTYPE = 0x1 + ATTR_VOL_INFO = 0x80000000 + ATTR_VOL_IOBLOCKSIZE = 0x80 + ATTR_VOL_MAXOBJCOUNT = 0x800 + ATTR_VOL_MINALLOCATION = 0x20 + ATTR_VOL_MOUNTEDDEVICE = 0x8000 + ATTR_VOL_MOUNTFLAGS = 0x4000 + ATTR_VOL_MOUNTPOINT = 0x1000 + ATTR_VOL_NAME = 0x2000 + ATTR_VOL_OBJCOUNT = 0x100 + ATTR_VOL_QUOTA_SIZE = 0x10000000 + ATTR_VOL_RESERVED_SIZE = 0x20000000 + ATTR_VOL_SETMASK = 0x80002000 + ATTR_VOL_SIGNATURE = 0x2 + ATTR_VOL_SIZE = 0x4 + ATTR_VOL_SPACEAVAIL = 0x10 + ATTR_VOL_SPACEFREE = 0x8 + ATTR_VOL_SPACEUSED = 0x800000 + ATTR_VOL_UUID = 0x40000 + ATTR_VOL_VALIDMASK = 0xf087ffff + B0 = 0x0 + B110 = 0x6e + B115200 = 0x1c200 + B1200 = 0x4b0 + B134 = 0x86 + B14400 = 0x3840 + B150 = 0x96 + B1800 = 0x708 + B19200 = 0x4b00 + B200 = 0xc8 + B230400 = 0x38400 + B2400 = 0x960 + B28800 = 0x7080 + B300 = 0x12c + B38400 = 0x9600 + B4800 = 0x12c0 + B50 = 0x32 + B57600 = 0xe100 + B600 = 0x258 + B7200 = 0x1c20 + B75 = 0x4b + B76800 = 0x12c00 + B9600 = 0x2580 + BIOCFLUSH = 0x20004268 + BIOCGBLEN = 0x40044266 + BIOCGDLT = 0x4004426a + BIOCGDLTLIST = 0xc00c4279 + BIOCGETIF = 0x4020426b + BIOCGHDRCMPLT = 0x40044274 + BIOCGRSIG = 0x40044272 + BIOCGRTIMEOUT = 0x4010426e + BIOCGSEESENT = 0x40044276 + BIOCGSTATS = 0x4008426f + BIOCIMMEDIATE = 0x80044270 + BIOCPROMISC = 0x20004269 + BIOCSBLEN = 0xc0044266 + BIOCSDLT = 0x80044278 + BIOCSETF = 0x80104267 + BIOCSETFNR = 0x8010427e + BIOCSETIF = 0x8020426c + BIOCSHDRCMPLT = 0x80044275 + BIOCSRSIG = 0x80044273 + BIOCSRTIMEOUT = 0x8010426d + BIOCSSEESENT = 0x80044277 + BIOCVERSION = 0x40044271 + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0x0 + BPF_ALIGNMENT = 0x4 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0x0 + BPF_IND = 0x40 + BPF_JA = 0x0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0x0 + BPF_LD = 0x0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXBUFSIZE = 0x80000 + BPF_MAXINSNS = 0x200 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINBUFSIZE = 0x20 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RELEASE = 0x30bb6 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0x0 + BPF_TXA = 0x80 + BPF_W = 0x0 + BPF_X = 0x8 + BRKINT = 0x2 + BS0 = 0x0 + BS1 = 0x8000 + BSDLY = 0x8000 + CFLUSH = 0xf + CLOCAL = 0x8000 + CLOCK_MONOTONIC = 0x6 + CLOCK_MONOTONIC_RAW = 0x4 + CLOCK_MONOTONIC_RAW_APPROX = 0x5 + CLOCK_PROCESS_CPUTIME_ID = 0xc + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x10 + CLOCK_UPTIME_RAW = 0x8 + CLOCK_UPTIME_RAW_APPROX = 0x9 + CLONE_NOFOLLOW = 0x1 + CLONE_NOOWNERCOPY = 0x2 + CR0 = 0x0 + CR1 = 0x1000 + CR2 = 0x2000 + CR3 = 0x3000 + CRDLY = 0x3000 + CREAD = 0x800 + CRTSCTS = 0x30000 + CS5 = 0x0 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTART = 0x11 + CSTATUS = 0x14 + CSTOP = 0x13 + CSTOPB = 0x400 + CSUSP = 0x1a + CTLIOCGINFO = 0xc0644e03 + CTL_HW = 0x6 + CTL_KERN = 0x1 + CTL_MAXNAME = 0xc + CTL_NET = 0x4 + DLT_A429 = 0xb8 + DLT_A653_ICM = 0xb9 + DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde + DLT_APPLE_IP_OVER_IEEE1394 = 0x8a + DLT_ARCNET = 0x7 + DLT_ARCNET_LINUX = 0x81 + DLT_ATM_CLIP = 0x13 + DLT_ATM_RFC1483 = 0xb + DLT_AURORA = 0x7e + DLT_AX25 = 0x3 + DLT_AX25_KISS = 0xca + DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_HCI_H4 = 0xbb + DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 + DLT_CHAOS = 0x5 + DLT_CHDLC = 0x68 + DLT_CISCO_IOS = 0x76 + DLT_C_HDLC = 0x68 + DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DBUS = 0xe7 + DLT_DECT = 0xdd + DLT_DOCSIS = 0x8f + DLT_DVB_CI = 0xeb + DLT_ECONET = 0x73 + DLT_EN10MB = 0x1 + DLT_EN3MB = 0x2 + DLT_ENC = 0x6d + DLT_ERF = 0xc5 + DLT_ERF_ETH = 0xaf + DLT_ERF_POS = 0xb0 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 + DLT_FDDI = 0xa + DLT_FLEXRAY = 0xd2 + DLT_FRELAY = 0x6b + DLT_FRELAY_WITH_DIR = 0xce + DLT_GCOM_SERIAL = 0xad + DLT_GCOM_T1E1 = 0xac + DLT_GPF_F = 0xab + DLT_GPF_T = 0xaa + DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 + DLT_HHDLC = 0x79 + DLT_IBM_SN = 0x92 + DLT_IBM_SP = 0x91 + DLT_IEEE802 = 0x6 + DLT_IEEE802_11 = 0x69 + DLT_IEEE802_11_RADIO = 0x7f + DLT_IEEE802_11_RADIO_AVS = 0xa3 + DLT_IEEE802_15_4 = 0xc3 + DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NOFCS = 0xe6 + DLT_IEEE802_15_4_NONASK_PHY = 0xd7 + DLT_IEEE802_16_MAC_CPS = 0xbc + DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_IPFILTER = 0x74 + DLT_IPMB = 0xc7 + DLT_IPMB_LINUX = 0xd1 + DLT_IPNET = 0xe2 + DLT_IPOIB = 0xf2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 + DLT_IP_OVER_FC = 0x7a + DLT_JUNIPER_ATM1 = 0x89 + DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_ATM_CEMIC = 0xee + DLT_JUNIPER_CHDLC = 0xb5 + DLT_JUNIPER_ES = 0x84 + DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FIBRECHANNEL = 0xea + DLT_JUNIPER_FRELAY = 0xb4 + DLT_JUNIPER_GGSN = 0x85 + DLT_JUNIPER_ISM = 0xc2 + DLT_JUNIPER_MFR = 0x86 + DLT_JUNIPER_MLFR = 0x83 + DLT_JUNIPER_MLPPP = 0x82 + DLT_JUNIPER_MONITOR = 0xa4 + DLT_JUNIPER_PIC_PEER = 0xae + DLT_JUNIPER_PPP = 0xb3 + DLT_JUNIPER_PPPOE = 0xa7 + DLT_JUNIPER_PPPOE_ATM = 0xa8 + DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_SRX_E2E = 0xe9 + DLT_JUNIPER_ST = 0xc8 + DLT_JUNIPER_VP = 0xb7 + DLT_JUNIPER_VS = 0xe8 + DLT_LAPB_WITH_DIR = 0xcf + DLT_LAPD = 0xcb + DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 + DLT_LINUX_IRDA = 0x90 + DLT_LINUX_LAPD = 0xb1 + DLT_LINUX_PPP_WITHDIRECTION = 0xa6 + DLT_LINUX_SLL = 0x71 + DLT_LOOP = 0x6c + DLT_LTALK = 0x72 + DLT_MATCHING_MAX = 0x10a + DLT_MATCHING_MIN = 0x68 + DLT_MFR = 0xb6 + DLT_MOST = 0xd3 + DLT_MPEG_2_TS = 0xf3 + DLT_MPLS = 0xdb + DLT_MTP2 = 0x8c + DLT_MTP2_WITH_PHDR = 0x8b + DLT_MTP3 = 0x8d + DLT_MUX27010 = 0xec + DLT_NETANALYZER = 0xf0 + DLT_NETANALYZER_TRANSPARENT = 0xf1 + DLT_NFC_LLCP = 0xf5 + DLT_NFLOG = 0xef + DLT_NG40 = 0xf4 + DLT_NULL = 0x0 + DLT_PCI_EXP = 0x7d + DLT_PFLOG = 0x75 + DLT_PFSYNC = 0x12 + DLT_PPI = 0xc0 + DLT_PPP = 0x9 + DLT_PPP_BSDOS = 0x10 + DLT_PPP_ETHER = 0x33 + DLT_PPP_PPPD = 0xa6 + DLT_PPP_SERIAL = 0x32 + DLT_PPP_WITH_DIR = 0xcc + DLT_PPP_WITH_DIRECTION = 0xa6 + DLT_PRISM_HEADER = 0x77 + DLT_PRONET = 0x4 + DLT_RAIF1 = 0xc6 + DLT_RAW = 0xc + DLT_RIO = 0x7c + DLT_SCCP = 0x8e + DLT_SITA = 0xc4 + DLT_SLIP = 0x8 + DLT_SLIP_BSDOS = 0xf + DLT_STANAG_5066_D_PDU = 0xed + DLT_SUNATM = 0x7b + DLT_SYMANTEC_FIREWALL = 0x63 + DLT_TZSP = 0x80 + DLT_USB = 0xba + DLT_USB_DARWIN = 0x10a + DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DLT_WIHART = 0xdf + DLT_X2E_SERIAL = 0xd5 + DLT_X2E_XORAYA = 0xd6 + DT_BLK = 0x6 + DT_CHR = 0x2 + DT_DIR = 0x4 + DT_FIFO = 0x1 + DT_LNK = 0xa + DT_REG = 0x8 + DT_SOCK = 0xc + DT_UNKNOWN = 0x0 + DT_WHT = 0xe + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EVFILT_AIO = -0x3 + EVFILT_EXCEPT = -0xf + EVFILT_FS = -0x9 + EVFILT_MACHPORT = -0x8 + EVFILT_PROC = -0x5 + EVFILT_READ = -0x1 + EVFILT_SIGNAL = -0x6 + EVFILT_SYSCOUNT = 0x11 + EVFILT_THREADMARKER = 0x11 + EVFILT_TIMER = -0x7 + EVFILT_USER = -0xa + EVFILT_VM = -0xc + EVFILT_VNODE = -0x4 + EVFILT_WRITE = -0x2 + EV_ADD = 0x1 + EV_CLEAR = 0x20 + EV_DELETE = 0x2 + EV_DISABLE = 0x8 + EV_DISPATCH = 0x80 + EV_DISPATCH2 = 0x180 + EV_ENABLE = 0x4 + EV_EOF = 0x8000 + EV_ERROR = 0x4000 + EV_FLAG0 = 0x1000 + EV_FLAG1 = 0x2000 + EV_ONESHOT = 0x10 + EV_OOBAND = 0x2000 + EV_POLL = 0x1000 + EV_RECEIPT = 0x40 + EV_SYSFLAGS = 0xf000 + EV_UDATA_SPECIFIC = 0x100 + EV_VANISHED = 0x200 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 + FD_CLOEXEC = 0x1 + FD_SETSIZE = 0x400 + FF0 = 0x0 + FF1 = 0x4000 + FFDLY = 0x4000 + FLUSHO = 0x800000 + FSOPT_ATTR_CMN_EXTENDED = 0x20 + FSOPT_NOFOLLOW = 0x1 + FSOPT_NOINMEMUPDATE = 0x2 + FSOPT_PACK_INVAL_ATTRS = 0x8 + FSOPT_REPORT_FULLSIZE = 0x4 + FSOPT_RETURN_REALDEV = 0x200 + F_ADDFILESIGS = 0x3d + F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 + F_ADDFILESIGS_INFO = 0x67 + F_ADDFILESIGS_RETURN = 0x61 + F_ADDFILESUPPL = 0x68 + F_ADDSIGS = 0x3b + F_ALLOCATEALL = 0x4 + F_ALLOCATECONTIG = 0x2 + F_BARRIERFSYNC = 0x55 + F_CHECK_LV = 0x62 + F_CHKCLEAN = 0x29 + F_DUPFD = 0x0 + F_DUPFD_CLOEXEC = 0x43 + F_FINDSIGS = 0x4e + F_FLUSH_DATA = 0x28 + F_FREEZE_FS = 0x35 + F_FULLFSYNC = 0x33 + F_GETCODEDIR = 0x48 + F_GETFD = 0x1 + F_GETFL = 0x3 + F_GETLK = 0x7 + F_GETLKPID = 0x42 + F_GETNOSIGPIPE = 0x4a + F_GETOWN = 0x5 + F_GETPATH = 0x32 + F_GETPATH_MTMINFO = 0x47 + F_GETPATH_NOFIRMLINK = 0x66 + F_GETPROTECTIONCLASS = 0x3f + F_GETPROTECTIONLEVEL = 0x4d + F_GETSIGSINFO = 0x69 + F_GLOBAL_NOCACHE = 0x37 + F_LOG2PHYS = 0x31 + F_LOG2PHYS_EXT = 0x41 + F_NOCACHE = 0x30 + F_NODIRECT = 0x3e + F_OK = 0x0 + F_PATHPKG_CHECK = 0x34 + F_PEOFPOSMODE = 0x3 + F_PREALLOCATE = 0x2a + F_PUNCHHOLE = 0x63 + F_RDADVISE = 0x2c + F_RDAHEAD = 0x2d + F_RDLCK = 0x1 + F_SETBACKINGSTORE = 0x46 + F_SETFD = 0x2 + F_SETFL = 0x4 + F_SETLK = 0x8 + F_SETLKW = 0x9 + F_SETLKWTIMEOUT = 0xa + F_SETNOSIGPIPE = 0x49 + F_SETOWN = 0x6 + F_SETPROTECTIONCLASS = 0x40 + F_SETSIZE = 0x2b + F_SINGLE_WRITER = 0x4c + F_SPECULATIVE_READ = 0x65 + F_THAW_FS = 0x36 + F_TRANSCODEKEY = 0x4b + F_TRIM_ACTIVE_FILE = 0x64 + F_UNLCK = 0x2 + F_VOLPOSMODE = 0x4 + F_WRLCK = 0x3 + HUPCL = 0x4000 + HW_MACHINE = 0x1 + ICANON = 0x100 + ICMP6_FILTER = 0x12 + ICRNL = 0x100 + IEXTEN = 0x400 + IFF_ALLMULTI = 0x200 + IFF_ALTPHYS = 0x4000 + IFF_BROADCAST = 0x2 + IFF_DEBUG = 0x4 + IFF_LINK0 = 0x1000 + IFF_LINK1 = 0x2000 + IFF_LINK2 = 0x4000 + IFF_LOOPBACK = 0x8 + IFF_MULTICAST = 0x8000 + IFF_NOARP = 0x80 + IFF_NOTRAILERS = 0x20 + IFF_OACTIVE = 0x400 + IFF_POINTOPOINT = 0x10 + IFF_PROMISC = 0x100 + IFF_RUNNING = 0x40 + IFF_SIMPLEX = 0x800 + IFF_UP = 0x1 + IFNAMSIZ = 0x10 + IFT_1822 = 0x2 + IFT_6LOWPAN = 0x40 + IFT_AAL5 = 0x31 + IFT_ARCNET = 0x23 + IFT_ARCNETPLUS = 0x24 + IFT_ATM = 0x25 + IFT_BRIDGE = 0xd1 + IFT_CARP = 0xf8 + IFT_CELLULAR = 0xff + IFT_CEPT = 0x13 + IFT_DS3 = 0x1e + IFT_ENC = 0xf4 + IFT_EON = 0x19 + IFT_ETHER = 0x6 + IFT_FAITH = 0x38 + IFT_FDDI = 0xf + IFT_FRELAY = 0x20 + IFT_FRELAYDCE = 0x2c + IFT_GIF = 0x37 + IFT_HDH1822 = 0x3 + IFT_HIPPI = 0x2f + IFT_HSSI = 0x2e + IFT_HY = 0xe + IFT_IEEE1394 = 0x90 + IFT_IEEE8023ADLAG = 0x88 + IFT_ISDNBASIC = 0x14 + IFT_ISDNPRIMARY = 0x15 + IFT_ISO88022LLC = 0x29 + IFT_ISO88023 = 0x7 + IFT_ISO88024 = 0x8 + IFT_ISO88025 = 0x9 + IFT_ISO88026 = 0xa + IFT_L2VLAN = 0x87 + IFT_LAPB = 0x10 + IFT_LOCALTALK = 0x2a + IFT_LOOP = 0x18 + IFT_MIOX25 = 0x26 + IFT_MODEM = 0x30 + IFT_NSIP = 0x1b + IFT_OTHER = 0x1 + IFT_P10 = 0xc + IFT_P80 = 0xd + IFT_PARA = 0x22 + IFT_PDP = 0xff + IFT_PFLOG = 0xf5 + IFT_PFSYNC = 0xf6 + IFT_PKTAP = 0xfe + IFT_PPP = 0x17 + IFT_PROPMUX = 0x36 + IFT_PROPVIRTUAL = 0x35 + IFT_PTPSERIAL = 0x16 + IFT_RS232 = 0x21 + IFT_SDLC = 0x11 + IFT_SIP = 0x1f + IFT_SLIP = 0x1c + IFT_SMDSDXI = 0x2b + IFT_SMDSICIP = 0x34 + IFT_SONET = 0x27 + IFT_SONETPATH = 0x32 + IFT_SONETVT = 0x33 + IFT_STARLAN = 0xb + IFT_STF = 0x39 + IFT_T1 = 0x12 + IFT_ULTRA = 0x1d + IFT_V35 = 0x2d + IFT_X25 = 0x5 + IFT_X25DDN = 0x4 + IFT_X25PLE = 0x28 + IFT_XETHER = 0x1a + IGNBRK = 0x1 + IGNCR = 0x80 + IGNPAR = 0x4 + IMAXBEL = 0x2000 + INLCR = 0x40 + INPCK = 0x10 + IN_CLASSA_HOST = 0xffffff + IN_CLASSA_MAX = 0x80 + IN_CLASSA_NET = 0xff000000 + IN_CLASSA_NSHIFT = 0x18 + IN_CLASSB_HOST = 0xffff + IN_CLASSB_MAX = 0x10000 + IN_CLASSB_NET = 0xffff0000 + IN_CLASSB_NSHIFT = 0x10 + IN_CLASSC_HOST = 0xff + IN_CLASSC_NET = 0xffffff00 + IN_CLASSC_NSHIFT = 0x8 + IN_CLASSD_HOST = 0xfffffff + IN_CLASSD_NET = 0xf0000000 + IN_CLASSD_NSHIFT = 0x1c + IN_LINKLOCALNETNUM = 0xa9fe0000 + IN_LOOPBACKNET = 0x7f + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x400473d1 + IPPROTO_3PC = 0x22 + IPPROTO_ADFS = 0x44 + IPPROTO_AH = 0x33 + IPPROTO_AHIP = 0x3d + IPPROTO_APES = 0x63 + IPPROTO_ARGUS = 0xd + IPPROTO_AX25 = 0x5d + IPPROTO_BHA = 0x31 + IPPROTO_BLT = 0x1e + IPPROTO_BRSATMON = 0x4c + IPPROTO_CFTP = 0x3e + IPPROTO_CHAOS = 0x10 + IPPROTO_CMTP = 0x26 + IPPROTO_CPHB = 0x49 + IPPROTO_CPNX = 0x48 + IPPROTO_DDP = 0x25 + IPPROTO_DGP = 0x56 + IPPROTO_DIVERT = 0xfe + IPPROTO_DONE = 0x101 + IPPROTO_DSTOPTS = 0x3c + IPPROTO_EGP = 0x8 + IPPROTO_EMCON = 0xe + IPPROTO_ENCAP = 0x62 + IPPROTO_EON = 0x50 + IPPROTO_ESP = 0x32 + IPPROTO_ETHERIP = 0x61 + IPPROTO_FRAGMENT = 0x2c + IPPROTO_GGP = 0x3 + IPPROTO_GMTP = 0x64 + IPPROTO_GRE = 0x2f + IPPROTO_HELLO = 0x3f + IPPROTO_HMP = 0x14 + IPPROTO_HOPOPTS = 0x0 + IPPROTO_ICMP = 0x1 + IPPROTO_ICMPV6 = 0x3a + IPPROTO_IDP = 0x16 + IPPROTO_IDPR = 0x23 + IPPROTO_IDRP = 0x2d + IPPROTO_IGMP = 0x2 + IPPROTO_IGP = 0x55 + IPPROTO_IGRP = 0x58 + IPPROTO_IL = 0x28 + IPPROTO_INLSP = 0x34 + IPPROTO_INP = 0x20 + IPPROTO_IP = 0x0 + IPPROTO_IPCOMP = 0x6c + IPPROTO_IPCV = 0x47 + IPPROTO_IPEIP = 0x5e + IPPROTO_IPIP = 0x4 + IPPROTO_IPPC = 0x43 + IPPROTO_IPV4 = 0x4 + IPPROTO_IPV6 = 0x29 + IPPROTO_IRTP = 0x1c + IPPROTO_KRYPTOLAN = 0x41 + IPPROTO_LARP = 0x5b + IPPROTO_LEAF1 = 0x19 + IPPROTO_LEAF2 = 0x1a + IPPROTO_MAX = 0x100 + IPPROTO_MAXID = 0x34 + IPPROTO_MEAS = 0x13 + IPPROTO_MHRP = 0x30 + IPPROTO_MICP = 0x5f + IPPROTO_MTP = 0x5c + IPPROTO_MUX = 0x12 + IPPROTO_ND = 0x4d + IPPROTO_NHRP = 0x36 + IPPROTO_NONE = 0x3b + IPPROTO_NSP = 0x1f + IPPROTO_NVPII = 0xb + IPPROTO_OSPFIGP = 0x59 + IPPROTO_PGM = 0x71 + IPPROTO_PIGP = 0x9 + IPPROTO_PIM = 0x67 + IPPROTO_PRM = 0x15 + IPPROTO_PUP = 0xc + IPPROTO_PVP = 0x4b + IPPROTO_RAW = 0xff + IPPROTO_RCCMON = 0xa + IPPROTO_RDP = 0x1b + IPPROTO_ROUTING = 0x2b + IPPROTO_RSVP = 0x2e + IPPROTO_RVD = 0x42 + IPPROTO_SATEXPAK = 0x40 + IPPROTO_SATMON = 0x45 + IPPROTO_SCCSP = 0x60 + IPPROTO_SCTP = 0x84 + IPPROTO_SDRP = 0x2a + IPPROTO_SEP = 0x21 + IPPROTO_SRPC = 0x5a + IPPROTO_ST = 0x7 + IPPROTO_SVMTP = 0x52 + IPPROTO_SWIPE = 0x35 + IPPROTO_TCF = 0x57 + IPPROTO_TCP = 0x6 + IPPROTO_TP = 0x1d + IPPROTO_TPXX = 0x27 + IPPROTO_TRUNK1 = 0x17 + IPPROTO_TRUNK2 = 0x18 + IPPROTO_TTP = 0x54 + IPPROTO_UDP = 0x11 + IPPROTO_VINES = 0x53 + IPPROTO_VISA = 0x46 + IPPROTO_VMTP = 0x51 + IPPROTO_WBEXPAK = 0x4f + IPPROTO_WBMON = 0x4e + IPPROTO_WSN = 0x4a + IPPROTO_XNET = 0xf + IPPROTO_XTP = 0x24 + IPV6_2292DSTOPTS = 0x17 + IPV6_2292HOPLIMIT = 0x14 + IPV6_2292HOPOPTS = 0x16 + IPV6_2292NEXTHOP = 0x15 + IPV6_2292PKTINFO = 0x13 + IPV6_2292PKTOPTIONS = 0x19 + IPV6_2292RTHDR = 0x18 + IPV6_3542DSTOPTS = 0x32 + IPV6_3542HOPLIMIT = 0x2f + IPV6_3542HOPOPTS = 0x31 + IPV6_3542NEXTHOP = 0x30 + IPV6_3542PKTINFO = 0x2e + IPV6_3542RTHDR = 0x33 + IPV6_ADDR_MC_FLAGS_PREFIX = 0x20 + IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10 + IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30 + IPV6_AUTOFLOWLABEL = 0x3b + IPV6_BINDV6ONLY = 0x1b + IPV6_BOUND_IF = 0x7d + IPV6_CHECKSUM = 0x1a + IPV6_DEFAULT_MULTICAST_HOPS = 0x1 + IPV6_DEFAULT_MULTICAST_LOOP = 0x1 + IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_FAITH = 0x1d + IPV6_FLOWINFO_MASK = 0xffffff0f + IPV6_FLOWLABEL_MASK = 0xffff0f00 + IPV6_FLOW_ECN_MASK = 0x3000 + IPV6_FRAGTTL = 0x3c + IPV6_FW_ADD = 0x1e + IPV6_FW_DEL = 0x1f + IPV6_FW_FLUSH = 0x20 + IPV6_FW_GET = 0x22 + IPV6_FW_ZERO = 0x21 + IPV6_HLIMDEC = 0x1 + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPSEC_POLICY = 0x1c + IPV6_JOIN_GROUP = 0xc + IPV6_LEAVE_GROUP = 0xd + IPV6_MAXHLIM = 0xff + IPV6_MAXOPTHDR = 0x800 + IPV6_MAXPACKET = 0xffff + IPV6_MAX_GROUP_SRC_FILTER = 0x200 + IPV6_MAX_MEMBERSHIPS = 0xfff + IPV6_MAX_SOCK_SRC_FILTER = 0x80 + IPV6_MIN_MEMBERSHIPS = 0x1f + IPV6_MMTU = 0x500 + IPV6_MSFILTER = 0x4a + IPV6_MULTICAST_HOPS = 0xa + IPV6_MULTICAST_IF = 0x9 + IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_PATHMTU = 0x2c + IPV6_PKTINFO = 0x2e + IPV6_PORTRANGE = 0xe + IPV6_PORTRANGE_DEFAULT = 0x0 + IPV6_PORTRANGE_HIGH = 0x1 + IPV6_PORTRANGE_LOW = 0x2 + IPV6_PREFER_TEMPADDR = 0x3f + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x3d + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x23 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x39 + IPV6_RTHDR_LOOSE = 0x0 + IPV6_RTHDR_STRICT = 0x1 + IPV6_RTHDR_TYPE_0 = 0x0 + IPV6_SOCKOPT_RESERVED1 = 0x3 + IPV6_TCLASS = 0x24 + IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a + IPV6_V6ONLY = 0x1b + IPV6_VERSION = 0x60 + IPV6_VERSION_MASK = 0xf0 + IP_ADD_MEMBERSHIP = 0xc + IP_ADD_SOURCE_MEMBERSHIP = 0x46 + IP_BLOCK_SOURCE = 0x48 + IP_BOUND_IF = 0x19 + IP_DEFAULT_MULTICAST_LOOP = 0x1 + IP_DEFAULT_MULTICAST_TTL = 0x1 + IP_DF = 0x4000 + IP_DONTFRAG = 0x1c + IP_DROP_MEMBERSHIP = 0xd + IP_DROP_SOURCE_MEMBERSHIP = 0x47 + IP_DUMMYNET_CONFIGURE = 0x3c + IP_DUMMYNET_DEL = 0x3d + IP_DUMMYNET_FLUSH = 0x3e + IP_DUMMYNET_GET = 0x40 + IP_FAITH = 0x16 + IP_FW_ADD = 0x28 + IP_FW_DEL = 0x29 + IP_FW_FLUSH = 0x2a + IP_FW_GET = 0x2c + IP_FW_RESETLOG = 0x2d + IP_FW_ZERO = 0x2b + IP_HDRINCL = 0x2 + IP_IPSEC_POLICY = 0x15 + IP_MAXPACKET = 0xffff + IP_MAX_GROUP_SRC_FILTER = 0x200 + IP_MAX_MEMBERSHIPS = 0xfff + IP_MAX_SOCK_MUTE_FILTER = 0x80 + IP_MAX_SOCK_SRC_FILTER = 0x80 + IP_MF = 0x2000 + IP_MIN_MEMBERSHIPS = 0x1f + IP_MSFILTER = 0x4a + IP_MSS = 0x240 + IP_MULTICAST_IF = 0x9 + IP_MULTICAST_IFINDEX = 0x42 + IP_MULTICAST_LOOP = 0xb + IP_MULTICAST_TTL = 0xa + IP_MULTICAST_VIF = 0xe + IP_NAT__XXX = 0x37 + IP_OFFMASK = 0x1fff + IP_OLD_FW_ADD = 0x32 + IP_OLD_FW_DEL = 0x33 + IP_OLD_FW_FLUSH = 0x34 + IP_OLD_FW_GET = 0x36 + IP_OLD_FW_RESETLOG = 0x38 + IP_OLD_FW_ZERO = 0x35 + IP_OPTIONS = 0x1 + IP_PKTINFO = 0x1a + IP_PORTRANGE = 0x13 + IP_PORTRANGE_DEFAULT = 0x0 + IP_PORTRANGE_HIGH = 0x1 + IP_PORTRANGE_LOW = 0x2 + IP_RECVDSTADDR = 0x7 + IP_RECVIF = 0x14 + IP_RECVOPTS = 0x5 + IP_RECVPKTINFO = 0x1a + IP_RECVRETOPTS = 0x6 + IP_RECVTOS = 0x1b + IP_RECVTTL = 0x18 + IP_RETOPTS = 0x8 + IP_RF = 0x8000 + IP_RSVP_OFF = 0x10 + IP_RSVP_ON = 0xf + IP_RSVP_VIF_OFF = 0x12 + IP_RSVP_VIF_ON = 0x11 + IP_STRIPHDR = 0x17 + IP_TOS = 0x3 + IP_TRAFFIC_MGT_BACKGROUND = 0x41 + IP_TTL = 0x4 + IP_UNBLOCK_SOURCE = 0x49 + ISIG = 0x80 + ISTRIP = 0x20 + IUTF8 = 0x4000 + IXANY = 0x800 + IXOFF = 0x400 + IXON = 0x200 + KERN_HOSTNAME = 0xa + KERN_OSRELEASE = 0x2 + KERN_OSTYPE = 0x1 + KERN_VERSION = 0x4 + LOCAL_PEERCRED = 0x1 + LOCAL_PEEREPID = 0x3 + LOCAL_PEEREUUID = 0x5 + LOCAL_PEERPID = 0x2 + LOCAL_PEERTOKEN = 0x6 + LOCAL_PEERUUID = 0x4 + LOCK_EX = 0x2 + LOCK_NB = 0x4 + LOCK_SH = 0x1 + LOCK_UN = 0x8 + MADV_CAN_REUSE = 0x9 + MADV_DONTNEED = 0x4 + MADV_FREE = 0x5 + MADV_FREE_REUSABLE = 0x7 + MADV_FREE_REUSE = 0x8 + MADV_NORMAL = 0x0 + MADV_PAGEOUT = 0xa + MADV_RANDOM = 0x1 + MADV_SEQUENTIAL = 0x2 + MADV_WILLNEED = 0x3 + MADV_ZERO_WIRED_PAGES = 0x6 + MAP_32BIT = 0x8000 + MAP_ANON = 0x1000 + MAP_ANONYMOUS = 0x1000 + MAP_COPY = 0x2 + MAP_FILE = 0x0 + MAP_FIXED = 0x10 + MAP_HASSEMAPHORE = 0x200 + MAP_JIT = 0x800 + MAP_NOCACHE = 0x400 + MAP_NOEXTEND = 0x100 + MAP_NORESERVE = 0x40 + MAP_PRIVATE = 0x2 + MAP_RENAME = 0x20 + MAP_RESERVED0080 = 0x80 + MAP_RESILIENT_CODESIGN = 0x2000 + MAP_RESILIENT_MEDIA = 0x4000 + MAP_SHARED = 0x1 + MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000 + MAP_UNIX03 = 0x40000 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 + MCL_CURRENT = 0x1 + MCL_FUTURE = 0x2 + MNT_ASYNC = 0x40 + MNT_AUTOMOUNTED = 0x400000 + MNT_CMDFLAGS = 0xf0000 + MNT_CPROTECT = 0x80 + MNT_DEFWRITE = 0x2000000 + MNT_DONTBROWSE = 0x100000 + MNT_DOVOLFS = 0x8000 + MNT_DWAIT = 0x4 + MNT_EXPORTED = 0x100 + MNT_EXT_ROOT_DATA_VOL = 0x1 + MNT_FORCE = 0x80000 + MNT_IGNORE_OWNERSHIP = 0x200000 + MNT_JOURNALED = 0x800000 + MNT_LOCAL = 0x1000 + MNT_MULTILABEL = 0x4000000 + MNT_NOATIME = 0x10000000 + MNT_NOBLOCK = 0x20000 + MNT_NODEV = 0x10 + MNT_NOEXEC = 0x4 + MNT_NOSUID = 0x8 + MNT_NOUSERXATTR = 0x1000000 + MNT_NOWAIT = 0x2 + MNT_QUARANTINE = 0x400 + MNT_QUOTA = 0x2000 + MNT_RDONLY = 0x1 + MNT_RELOAD = 0x40000 + MNT_REMOVABLE = 0x200 + MNT_ROOTFS = 0x4000 + MNT_SNAPSHOT = 0x40000000 + MNT_STRICTATIME = 0x80000000 + MNT_SYNCHRONOUS = 0x2 + MNT_UNION = 0x20 + MNT_UNKNOWNPERMISSIONS = 0x200000 + MNT_UPDATE = 0x10000 + MNT_VISFLAGMASK = 0xd7f0f7ff + MNT_WAIT = 0x1 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_DONTWAIT = 0x80 + MSG_EOF = 0x100 + MSG_EOR = 0x8 + MSG_FLUSH = 0x400 + MSG_HAVEMORE = 0x2000 + MSG_HOLD = 0x800 + MSG_NEEDSA = 0x10000 + MSG_NOSIGNAL = 0x80000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_RCVMORE = 0x4000 + MSG_SEND = 0x1000 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + MSG_WAITSTREAM = 0x200 + MS_ASYNC = 0x1 + MS_DEACTIVATE = 0x8 + MS_INVALIDATE = 0x2 + MS_KILLPAGES = 0x4 + MS_SYNC = 0x10 + NAME_MAX = 0xff + NET_RT_DUMP = 0x1 + NET_RT_DUMP2 = 0x7 + NET_RT_FLAGS = 0x2 + NET_RT_FLAGS_PRIV = 0xa + NET_RT_IFLIST = 0x3 + NET_RT_IFLIST2 = 0x6 + NET_RT_MAXID = 0xb + NET_RT_STAT = 0x4 + NET_RT_TRASH = 0x5 + NFDBITS = 0x20 + NL0 = 0x0 + NL1 = 0x100 + NL2 = 0x200 + NL3 = 0x300 + NLDLY = 0x300 + NOFLSH = 0x80000000 + NOKERNINFO = 0x2000000 + NOTE_ABSOLUTE = 0x8 + NOTE_ATTRIB = 0x8 + NOTE_BACKGROUND = 0x40 + NOTE_CHILD = 0x4 + NOTE_CRITICAL = 0x20 + NOTE_DELETE = 0x1 + NOTE_EXEC = 0x20000000 + NOTE_EXIT = 0x80000000 + NOTE_EXITSTATUS = 0x4000000 + NOTE_EXIT_CSERROR = 0x40000 + NOTE_EXIT_DECRYPTFAIL = 0x10000 + NOTE_EXIT_DETAIL = 0x2000000 + NOTE_EXIT_DETAIL_MASK = 0x70000 + NOTE_EXIT_MEMORY = 0x20000 + NOTE_EXIT_REPARENTED = 0x80000 + NOTE_EXTEND = 0x4 + NOTE_FFAND = 0x40000000 + NOTE_FFCOPY = 0xc0000000 + NOTE_FFCTRLMASK = 0xc0000000 + NOTE_FFLAGSMASK = 0xffffff + NOTE_FFNOP = 0x0 + NOTE_FFOR = 0x80000000 + NOTE_FORK = 0x40000000 + NOTE_FUNLOCK = 0x100 + NOTE_LEEWAY = 0x10 + NOTE_LINK = 0x10 + NOTE_LOWAT = 0x1 + NOTE_MACHTIME = 0x100 + NOTE_MACH_CONTINUOUS_TIME = 0x80 + NOTE_NONE = 0x80 + NOTE_NSECONDS = 0x4 + NOTE_OOB = 0x2 + NOTE_PCTRLMASK = -0x100000 + NOTE_PDATAMASK = 0xfffff + NOTE_REAP = 0x10000000 + NOTE_RENAME = 0x20 + NOTE_REVOKE = 0x40 + NOTE_SECONDS = 0x1 + NOTE_SIGNAL = 0x8000000 + NOTE_TRACK = 0x1 + NOTE_TRACKERR = 0x2 + NOTE_TRIGGER = 0x1000000 + NOTE_USECONDS = 0x2 + NOTE_VM_ERROR = 0x10000000 + NOTE_VM_PRESSURE = 0x80000000 + NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 + NOTE_VM_PRESSURE_TERMINATE = 0x40000000 + NOTE_WRITE = 0x2 + OCRNL = 0x10 + OFDEL = 0x20000 + OFILL = 0x80 + ONLCR = 0x2 + ONLRET = 0x40 + ONOCR = 0x20 + ONOEOT = 0x8 + OPOST = 0x1 + OXTABS = 0x4 + O_ACCMODE = 0x3 + O_ALERT = 0x20000000 + O_APPEND = 0x8 + O_ASYNC = 0x40 + O_CLOEXEC = 0x1000000 + O_CREAT = 0x200 + O_DIRECTORY = 0x100000 + O_DP_GETRAWENCRYPTED = 0x1 + O_DP_GETRAWUNENCRYPTED = 0x2 + O_DSYNC = 0x400000 + O_EVTONLY = 0x8000 + O_EXCL = 0x800 + O_EXLOCK = 0x20 + O_FSYNC = 0x80 + O_NDELAY = 0x4 + O_NOCTTY = 0x20000 + O_NOFOLLOW = 0x100 + O_NOFOLLOW_ANY = 0x20000000 + O_NONBLOCK = 0x4 + O_POPUP = 0x80000000 + O_RDONLY = 0x0 + O_RDWR = 0x2 + O_SHLOCK = 0x10 + O_SYMLINK = 0x200000 + O_SYNC = 0x80 + O_TRUNC = 0x400 + O_WRONLY = 0x1 + PARENB = 0x1000 + PARMRK = 0x8 + PARODD = 0x2000 + PENDIN = 0x20000000 + PRIO_PGRP = 0x1 + PRIO_PROCESS = 0x0 + PRIO_USER = 0x2 + PROT_EXEC = 0x4 + PROT_NONE = 0x0 + PROT_READ = 0x1 + PROT_WRITE = 0x2 + PT_ATTACH = 0xa + PT_ATTACHEXC = 0xe + PT_CONTINUE = 0x7 + PT_DENY_ATTACH = 0x1f + PT_DETACH = 0xb + PT_FIRSTMACH = 0x20 + PT_FORCEQUOTA = 0x1e + PT_KILL = 0x8 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_READ_U = 0x3 + PT_SIGEXC = 0xc + PT_STEP = 0x9 + PT_THUPDATE = 0xd + PT_TRACE_ME = 0x0 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + PT_WRITE_U = 0x6 + RLIMIT_AS = 0x5 + RLIMIT_CORE = 0x4 + RLIMIT_CPU = 0x0 + RLIMIT_CPU_USAGE_MONITOR = 0x2 + RLIMIT_DATA = 0x2 + RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 + RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 + RLIMIT_STACK = 0x3 + RLIM_INFINITY = 0x7fffffffffffffff + RTAX_AUTHOR = 0x6 + RTAX_BRD = 0x7 + RTAX_DST = 0x0 + RTAX_GATEWAY = 0x1 + RTAX_GENMASK = 0x3 + RTAX_IFA = 0x5 + RTAX_IFP = 0x4 + RTAX_MAX = 0x8 + RTAX_NETMASK = 0x2 + RTA_AUTHOR = 0x40 + RTA_BRD = 0x80 + RTA_DST = 0x1 + RTA_GATEWAY = 0x2 + RTA_GENMASK = 0x8 + RTA_IFA = 0x20 + RTA_IFP = 0x10 + RTA_NETMASK = 0x4 + RTF_BLACKHOLE = 0x1000 + RTF_BROADCAST = 0x400000 + RTF_CLONING = 0x100 + RTF_CONDEMNED = 0x2000000 + RTF_DEAD = 0x20000000 + RTF_DELCLONE = 0x80 + RTF_DONE = 0x40 + RTF_DYNAMIC = 0x10 + RTF_GATEWAY = 0x2 + RTF_GLOBAL = 0x40000000 + RTF_HOST = 0x4 + RTF_IFREF = 0x4000000 + RTF_IFSCOPE = 0x1000000 + RTF_LLDATA = 0x400 + RTF_LLINFO = 0x400 + RTF_LOCAL = 0x200000 + RTF_MODIFIED = 0x20 + RTF_MULTICAST = 0x800000 + RTF_NOIFREF = 0x2000 + RTF_PINNED = 0x100000 + RTF_PRCLONING = 0x10000 + RTF_PROTO1 = 0x8000 + RTF_PROTO2 = 0x4000 + RTF_PROTO3 = 0x40000 + RTF_PROXY = 0x8000000 + RTF_REJECT = 0x8 + RTF_ROUTER = 0x10000000 + RTF_STATIC = 0x800 + RTF_UP = 0x1 + RTF_WASCLONED = 0x20000 + RTF_XRESOLVE = 0x200 + RTM_ADD = 0x1 + RTM_CHANGE = 0x3 + RTM_DELADDR = 0xd + RTM_DELETE = 0x2 + RTM_DELMADDR = 0x10 + RTM_GET = 0x4 + RTM_GET2 = 0x14 + RTM_IFINFO = 0xe + RTM_IFINFO2 = 0x12 + RTM_LOCK = 0x8 + RTM_LOSING = 0x5 + RTM_MISS = 0x7 + RTM_NEWADDR = 0xc + RTM_NEWMADDR = 0xf + RTM_NEWMADDR2 = 0x13 + RTM_OLDADD = 0x9 + RTM_OLDDEL = 0xa + RTM_REDIRECT = 0x6 + RTM_RESOLVE = 0xb + RTM_RTTUNIT = 0xf4240 + RTM_VERSION = 0x5 + RTV_EXPIRE = 0x4 + RTV_HOPCOUNT = 0x2 + RTV_MTU = 0x1 + RTV_RPIPE = 0x8 + RTV_RTT = 0x40 + RTV_RTTVAR = 0x80 + RTV_SPIPE = 0x10 + RTV_SSTHRESH = 0x20 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 + SCM_CREDS = 0x3 + SCM_RIGHTS = 0x1 + SCM_TIMESTAMP = 0x2 + SCM_TIMESTAMP_MONOTONIC = 0x4 + SEEK_CUR = 0x1 + SEEK_DATA = 0x4 + SEEK_END = 0x2 + SEEK_HOLE = 0x3 + SEEK_SET = 0x0 + SHUT_RD = 0x0 + SHUT_RDWR = 0x2 + SHUT_WR = 0x1 + SIOCADDMULTI = 0x80206931 + SIOCAIFADDR = 0x8040691a + SIOCARPIPLL = 0xc0206928 + SIOCATMARK = 0x40047307 + SIOCAUTOADDR = 0xc0206926 + SIOCAUTONETMASK = 0x80206927 + SIOCDELMULTI = 0x80206932 + SIOCDIFADDR = 0x80206919 + SIOCDIFPHYADDR = 0x80206941 + SIOCGDRVSPEC = 0xc028697b + SIOCGETVLAN = 0xc020697f + SIOCGHIWAT = 0x40047301 + SIOCGIF6LOWPAN = 0xc02069c5 + SIOCGIFADDR = 0xc0206921 + SIOCGIFALTMTU = 0xc0206948 + SIOCGIFASYNCMAP = 0xc020697c + SIOCGIFBOND = 0xc0206947 + SIOCGIFBRDADDR = 0xc0206923 + SIOCGIFCAP = 0xc020695b + SIOCGIFCONF = 0xc00c6924 + SIOCGIFDEVMTU = 0xc0206944 + SIOCGIFDSTADDR = 0xc0206922 + SIOCGIFFLAGS = 0xc0206911 + SIOCGIFFUNCTIONALTYPE = 0xc02069ad + SIOCGIFGENERIC = 0xc020693a + SIOCGIFKPI = 0xc0206987 + SIOCGIFMAC = 0xc0206982 + SIOCGIFMEDIA = 0xc02c6938 + SIOCGIFMETRIC = 0xc0206917 + SIOCGIFMTU = 0xc0206933 + SIOCGIFNETMASK = 0xc0206925 + SIOCGIFPDSTADDR = 0xc0206940 + SIOCGIFPHYS = 0xc0206935 + SIOCGIFPSRCADDR = 0xc020693f + SIOCGIFSTATUS = 0xc331693d + SIOCGIFVLAN = 0xc020697f + SIOCGIFWAKEFLAGS = 0xc0206988 + SIOCGIFXMEDIA = 0xc02c6948 + SIOCGLOWAT = 0x40047303 + SIOCGPGRP = 0x40047309 + SIOCIFCREATE = 0xc0206978 + SIOCIFCREATE2 = 0xc020697a + SIOCIFDESTROY = 0x80206979 + SIOCIFGCLONERS = 0xc0106981 + SIOCRSLVMULTI = 0xc010693b + SIOCSDRVSPEC = 0x8028697b + SIOCSETVLAN = 0x8020697e + SIOCSHIWAT = 0x80047300 + SIOCSIF6LOWPAN = 0x802069c4 + SIOCSIFADDR = 0x8020690c + SIOCSIFALTMTU = 0x80206945 + SIOCSIFASYNCMAP = 0x8020697d + SIOCSIFBOND = 0x80206946 + SIOCSIFBRDADDR = 0x80206913 + SIOCSIFCAP = 0x8020695a + SIOCSIFDSTADDR = 0x8020690e + SIOCSIFFLAGS = 0x80206910 + SIOCSIFGENERIC = 0x80206939 + SIOCSIFKPI = 0x80206986 + SIOCSIFLLADDR = 0x8020693c + SIOCSIFMAC = 0x80206983 + SIOCSIFMEDIA = 0xc0206937 + SIOCSIFMETRIC = 0x80206918 + SIOCSIFMTU = 0x80206934 + SIOCSIFNETMASK = 0x80206916 + SIOCSIFPHYADDR = 0x8040693e + SIOCSIFPHYS = 0x80206936 + SIOCSIFVLAN = 0x8020697e + SIOCSLOWAT = 0x80047302 + SIOCSPGRP = 0x80047308 + SOCK_DGRAM = 0x2 + SOCK_MAXADDRLEN = 0xff + SOCK_RAW = 0x3 + SOCK_RDM = 0x4 + SOCK_SEQPACKET = 0x5 + SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 + SOL_SOCKET = 0xffff + SOMAXCONN = 0x80 + SO_ACCEPTCONN = 0x2 + SO_BROADCAST = 0x20 + SO_DEBUG = 0x1 + SO_DONTROUTE = 0x10 + SO_DONTTRUNC = 0x2000 + SO_ERROR = 0x1007 + SO_KEEPALIVE = 0x8 + SO_LABEL = 0x1010 + SO_LINGER = 0x80 + SO_LINGER_SEC = 0x1080 + SO_NETSVC_MARKING_LEVEL = 0x1119 + SO_NET_SERVICE_TYPE = 0x1116 + SO_NKE = 0x1021 + SO_NOADDRERR = 0x1023 + SO_NOSIGPIPE = 0x1022 + SO_NOTIFYCONFLICT = 0x1026 + SO_NP_EXTENSIONS = 0x1083 + SO_NREAD = 0x1020 + SO_NUMRCVPKT = 0x1112 + SO_NWRITE = 0x1024 + SO_OOBINLINE = 0x100 + SO_PEERLABEL = 0x1011 + SO_RANDOMPORT = 0x1082 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x4 + SO_REUSEPORT = 0x200 + SO_REUSESHAREUID = 0x1025 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TIMESTAMP = 0x400 + SO_TIMESTAMP_MONOTONIC = 0x800 + SO_TRACKER_ATTRIBUTE_FLAGS_APP_APPROVED = 0x1 + SO_TRACKER_ATTRIBUTE_FLAGS_DOMAIN_SHORT = 0x4 + SO_TRACKER_ATTRIBUTE_FLAGS_TRACKER = 0x2 + SO_TRACKER_TRANSPARENCY_VERSION = 0x3 + SO_TYPE = 0x1008 + SO_UPCALLCLOSEWAIT = 0x1027 + SO_USELOOPBACK = 0x40 + SO_WANTMORE = 0x4000 + SO_WANTOOBFLAG = 0x8000 + S_IEXEC = 0x40 + S_IFBLK = 0x6000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFIFO = 0x1000 + S_IFLNK = 0xa000 + S_IFMT = 0xf000 + S_IFREG = 0x8000 + S_IFSOCK = 0xc000 + S_IFWHT = 0xe000 + S_IREAD = 0x100 + S_IRGRP = 0x20 + S_IROTH = 0x4 + S_IRUSR = 0x100 + S_IRWXG = 0x38 + S_IRWXO = 0x7 + S_IRWXU = 0x1c0 + S_ISGID = 0x400 + S_ISTXT = 0x200 + S_ISUID = 0x800 + S_ISVTX = 0x200 + S_IWGRP = 0x10 + S_IWOTH = 0x2 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXGRP = 0x8 + S_IXOTH = 0x1 + S_IXUSR = 0x40 + TAB0 = 0x0 + TAB1 = 0x400 + TAB2 = 0x800 + TAB3 = 0x4 + TABDLY = 0xc04 + TCIFLUSH = 0x1 + TCIOFF = 0x3 + TCIOFLUSH = 0x3 + TCION = 0x4 + TCOFLUSH = 0x2 + TCOOFF = 0x1 + TCOON = 0x2 + TCPOPT_CC = 0xb + TCPOPT_CCECHO = 0xd + TCPOPT_CCNEW = 0xc + TCPOPT_EOL = 0x0 + TCPOPT_FASTOPEN = 0x22 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_HDR = 0x1010500 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_SACK_PERMIT_HDR = 0x1010402 + TCPOPT_SIGNATURE = 0x13 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 + TCP_CONNECTIONTIMEOUT = 0x20 + TCP_CONNECTION_INFO = 0x106 + TCP_ENABLE_ECN = 0x104 + TCP_FASTOPEN = 0x105 + TCP_KEEPALIVE = 0x10 + TCP_KEEPCNT = 0x102 + TCP_KEEPINTVL = 0x101 + TCP_MAXHLEN = 0x3c + TCP_MAXOLEN = 0x28 + TCP_MAXSEG = 0x2 + TCP_MAXWIN = 0xffff + TCP_MAX_SACK = 0x4 + TCP_MAX_WINSHIFT = 0xe + TCP_MINMSS = 0xd8 + TCP_MSS = 0x200 + TCP_NODELAY = 0x1 + TCP_NOOPT = 0x8 + TCP_NOPUSH = 0x4 + TCP_NOTSENT_LOWAT = 0x201 + TCP_RXT_CONNDROPTIME = 0x80 + TCP_RXT_FINDROP = 0x100 + TCP_SENDMOREACKS = 0x103 + TCSAFLUSH = 0x2 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDCDTIMESTAMP = 0x40107458 + TIOCDRAIN = 0x2000745e + TIOCDSIMICROCODE = 0x20007455 + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x40487413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGWINSZ = 0x40087468 + TIOCIXOFF = 0x20007480 + TIOCIXON = 0x20007481 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMODG = 0x40047403 + TIOCMODS = 0x80047404 + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0x0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTYGNAME = 0x40807453 + TIOCPTYGRANT = 0x20007454 + TIOCPTYUNLK = 0x20007452 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCONS = 0x20007463 + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x80487414 + TIOCSETAF = 0x80487416 + TIOCSETAW = 0x80487415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2000745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40107459 + TIOCUCNTL = 0x80047466 + TOSTOP = 0x400000 + VDISCARD = 0xf + VDSUSP = 0xb + VEOF = 0x0 + VEOL = 0x1 + VEOL2 = 0x2 + VERASE = 0x3 + VINTR = 0x8 + VKILL = 0x5 + VLNEXT = 0xe + VMADDR_CID_ANY = 0xffffffff + VMADDR_CID_HOST = 0x2 + VMADDR_CID_HYPERVISOR = 0x0 + VMADDR_CID_RESERVED = 0x1 + VMADDR_PORT_ANY = 0xffffffff + VMIN = 0x10 + VM_LOADAVG = 0x2 + VM_MACHFACTOR = 0x4 + VM_MAXID = 0x6 + VM_METER = 0x1 + VM_SWAPUSAGE = 0x5 + VQUIT = 0x9 + VREPRINT = 0x6 + VSTART = 0xc + VSTATUS = 0x12 + VSTOP = 0xd + VSUSP = 0xa + VT0 = 0x0 + VT1 = 0x10000 + VTDLY = 0x10000 + VTIME = 0x11 + VWERASE = 0x4 + WCONTINUED = 0x10 + WCOREFLAG = 0x80 + WEXITED = 0x4 + WNOHANG = 0x1 + WNOWAIT = 0x20 + WORDSIZE = 0x40 + WSTOPPED = 0x8 + WUNTRACED = 0x2 + XATTR_CREATE = 0x2 + XATTR_NODEFAULT = 0x10 + XATTR_NOFOLLOW = 0x1 + XATTR_NOSECURITY = 0x8 + XATTR_REPLACE = 0x4 + XATTR_SHOWCOMPRESSION = 0x20 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go index 6130471748..17bba0e44f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && dragonfly // +build amd64,dragonfly // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -62,6 +63,7 @@ const ( B28800 = 0x7080 B300 = 0x12c B38400 = 0x9600 + B460800 = 0x70800 B4800 = 0x12c0 B50 = 0x32 B57600 = 0xe100 @@ -69,12 +71,15 @@ const ( B7200 = 0x1c20 B75 = 0x4b B76800 = 0x12c00 + B921600 = 0xe1000 B9600 = 0x2580 + BIOCFEEDBACK = 0x8004427d BIOCFLUSH = 0x20004268 BIOCGBLEN = 0x40044266 BIOCGDLT = 0x4004426a BIOCGDLTLIST = 0xc0104279 BIOCGETIF = 0x4020426b + BIOCGFEEDBACK = 0x4004427c BIOCGHDRCMPLT = 0x40044274 BIOCGRSIG = 0x40044272 BIOCGRTIMEOUT = 0x4010426e @@ -88,6 +93,7 @@ const ( BIOCSETF = 0x80104267 BIOCSETIF = 0x8020426c BIOCSETWF = 0x8010427b + BIOCSFEEDBACK = 0x8004427d BIOCSHDRCMPLT = 0x80044275 BIOCSRSIG = 0x80044273 BIOCSRTIMEOUT = 0x8010426d @@ -125,6 +131,7 @@ const ( BPF_MINBUFSIZE = 0x20 BPF_MINOR_VERSION = 0x1 BPF_MISC = 0x7 + BPF_MOD = 0x90 BPF_MSH = 0xa0 BPF_MUL = 0x20 BPF_NEG = 0x80 @@ -139,6 +146,7 @@ const ( BPF_TXA = 0x80 BPF_W = 0x0 BPF_X = 0x8 + BPF_XOR = 0xa0 BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 @@ -156,6 +164,12 @@ const ( CLOCK_UPTIME_FAST = 0x8 CLOCK_UPTIME_PRECISE = 0x7 CLOCK_VIRTUAL = 0x1 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 @@ -175,6 +189,7 @@ const ( DLT_A429 = 0xb8 DLT_A653_ICM = 0xb9 DLT_AIRONET_HEADER = 0x78 + DLT_AOS = 0xde DLT_APPLE_IP_OVER_IEEE1394 = 0x8a DLT_ARCNET = 0x7 DLT_ARCNET_LINUX = 0x81 @@ -184,22 +199,33 @@ const ( DLT_AX25 = 0x3 DLT_AX25_KISS = 0xca DLT_BACNET_MS_TP = 0xa5 + DLT_BLUETOOTH_BREDR_BB = 0xff DLT_BLUETOOTH_HCI_H4 = 0xbb DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 + DLT_BLUETOOTH_LE_LL = 0xfb + DLT_BLUETOOTH_LE_LL_WITH_PHDR = 0x100 + DLT_BLUETOOTH_LINUX_MONITOR = 0xfe DLT_CAN20B = 0xbe + DLT_CAN_SOCKETCAN = 0xe3 DLT_CHAOS = 0x5 DLT_CHDLC = 0x68 DLT_CISCO_IOS = 0x76 DLT_C_HDLC = 0x68 DLT_C_HDLC_WITH_DIR = 0xcd + DLT_DBUS = 0xe7 + DLT_DECT = 0xdd DLT_DOCSIS = 0x8f + DLT_DVB_CI = 0xeb DLT_ECONET = 0x73 DLT_EN10MB = 0x1 DLT_EN3MB = 0x2 DLT_ENC = 0x6d + DLT_EPON = 0x103 DLT_ERF = 0xc5 DLT_ERF_ETH = 0xaf DLT_ERF_POS = 0xb0 + DLT_FC_2 = 0xe0 + DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 DLT_FDDI = 0xa DLT_FLEXRAY = 0xd2 DLT_FRELAY = 0x6b @@ -209,6 +235,8 @@ const ( DLT_GPF_F = 0xab DLT_GPF_T = 0xaa DLT_GPRS_LLC = 0xa9 + DLT_GSMTAP_ABIS = 0xda + DLT_GSMTAP_UM = 0xd9 DLT_HHDLC = 0x79 DLT_IBM_SN = 0x92 DLT_IBM_SP = 0x91 @@ -218,18 +246,28 @@ const ( DLT_IEEE802_11_RADIO_AVS = 0xa3 DLT_IEEE802_15_4 = 0xc3 DLT_IEEE802_15_4_LINUX = 0xbf + DLT_IEEE802_15_4_NOFCS = 0xe6 DLT_IEEE802_15_4_NONASK_PHY = 0xd7 DLT_IEEE802_16_MAC_CPS = 0xbc DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 + DLT_INFINIBAND = 0xf7 DLT_IPFILTER = 0x74 DLT_IPMB = 0xc7 DLT_IPMB_LINUX = 0xd1 + DLT_IPMI_HPM_2 = 0x104 + DLT_IPNET = 0xe2 + DLT_IPOIB = 0xf2 + DLT_IPV4 = 0xe4 + DLT_IPV6 = 0xe5 DLT_IP_OVER_FC = 0x7a + DLT_ISO_14443 = 0x108 DLT_JUNIPER_ATM1 = 0x89 DLT_JUNIPER_ATM2 = 0x87 + DLT_JUNIPER_ATM_CEMIC = 0xee DLT_JUNIPER_CHDLC = 0xb5 DLT_JUNIPER_ES = 0x84 DLT_JUNIPER_ETHER = 0xb2 + DLT_JUNIPER_FIBRECHANNEL = 0xea DLT_JUNIPER_FRELAY = 0xb4 DLT_JUNIPER_GGSN = 0x85 DLT_JUNIPER_ISM = 0xc2 @@ -242,25 +280,40 @@ const ( DLT_JUNIPER_PPPOE = 0xa7 DLT_JUNIPER_PPPOE_ATM = 0xa8 DLT_JUNIPER_SERVICES = 0x88 + DLT_JUNIPER_SRX_E2E = 0xe9 DLT_JUNIPER_ST = 0xc8 DLT_JUNIPER_VP = 0xb7 + DLT_JUNIPER_VS = 0xe8 DLT_LAPB_WITH_DIR = 0xcf DLT_LAPD = 0xcb DLT_LIN = 0xd4 + DLT_LINUX_EVDEV = 0xd8 DLT_LINUX_IRDA = 0x90 DLT_LINUX_LAPD = 0xb1 DLT_LINUX_SLL = 0x71 DLT_LOOP = 0x6c DLT_LTALK = 0x72 + DLT_MATCHING_MAX = 0x109 + DLT_MATCHING_MIN = 0x68 DLT_MFR = 0xb6 DLT_MOST = 0xd3 + DLT_MPEG_2_TS = 0xf3 + DLT_MPLS = 0xdb DLT_MTP2 = 0x8c DLT_MTP2_WITH_PHDR = 0x8b DLT_MTP3 = 0x8d + DLT_MUX27010 = 0xec + DLT_NETANALYZER = 0xf0 + DLT_NETANALYZER_TRANSPARENT = 0xf1 + DLT_NETLINK = 0xfd + DLT_NFC_LLCP = 0xf5 + DLT_NFLOG = 0xef + DLT_NG40 = 0xf4 DLT_NULL = 0x0 DLT_PCI_EXP = 0x7d DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 + DLT_PKTAP = 0x102 DLT_PPI = 0xc0 DLT_PPP = 0x9 DLT_PPP_BSDOS = 0x10 @@ -269,22 +322,51 @@ const ( DLT_PPP_SERIAL = 0x32 DLT_PPP_WITH_DIR = 0xcc DLT_PRISM_HEADER = 0x77 + DLT_PROFIBUS_DL = 0x101 DLT_PRONET = 0x4 DLT_RAIF1 = 0xc6 DLT_RAW = 0xc + DLT_RDS = 0x109 DLT_REDBACK_SMARTEDGE = 0x20 DLT_RIO = 0x7c + DLT_RTAC_SERIAL = 0xfa DLT_SCCP = 0x8e + DLT_SCTP = 0xf8 DLT_SITA = 0xc4 DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf + DLT_STANAG_5066_D_PDU = 0xed DLT_SUNATM = 0x7b DLT_SYMANTEC_FIREWALL = 0x63 DLT_TZSP = 0x80 DLT_USB = 0xba + DLT_USBPCAP = 0xf9 + DLT_USB_FREEBSD = 0xba DLT_USB_LINUX = 0xbd + DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USER0 = 0x93 + DLT_USER1 = 0x94 + DLT_USER10 = 0x9d + DLT_USER11 = 0x9e + DLT_USER12 = 0x9f + DLT_USER13 = 0xa0 + DLT_USER14 = 0xa1 + DLT_USER15 = 0xa2 + DLT_USER2 = 0x95 + DLT_USER3 = 0x96 + DLT_USER4 = 0x97 + DLT_USER5 = 0x98 + DLT_USER6 = 0x99 + DLT_USER7 = 0x9a + DLT_USER8 = 0x9b + DLT_USER9 = 0x9c + DLT_WATTSTOPPER_DLM = 0x107 + DLT_WIHART = 0xdf + DLT_WIRESHARK_UPPER_PDU = 0xfc DLT_X2E_SERIAL = 0xd5 DLT_X2E_XORAYA = 0xd6 + DLT_ZWAVE_R1_R2 = 0x105 + DLT_ZWAVE_R3 = 0x106 DT_BLK = 0x6 DT_CHR = 0x2 DT_DBF = 0xf @@ -323,10 +405,11 @@ const ( EV_EOF = 0x8000 EV_ERROR = 0x4000 EV_FLAG1 = 0x2000 + EV_HUP = 0x800 EV_NODATA = 0x1000 EV_ONESHOT = 0x10 EV_RECEIPT = 0x40 - EV_SYSFLAGS = 0xf000 + EV_SYSFLAGS = 0xf800 EXTA = 0x4b00 EXTB = 0x9600 EXTEXIT_LWP = 0x10000 @@ -365,8 +448,9 @@ const ( IFF_ALLMULTI = 0x200 IFF_ALTPHYS = 0x4000 IFF_BROADCAST = 0x2 - IFF_CANTCHANGE = 0x118e72 + IFF_CANTCHANGE = 0x318e72 IFF_DEBUG = 0x4 + IFF_IDIRECT = 0x200000 IFF_LINK0 = 0x1000 IFF_LINK1 = 0x2000 IFF_LINK2 = 0x4000 @@ -441,7 +525,6 @@ const ( IFT_EPLRS = 0x57 IFT_ESCON = 0x49 IFT_ETHER = 0x6 - IFT_FAITH = 0xf2 IFT_FAST = 0x7d IFT_FASTETHER = 0x3e IFT_FASTETHERFX = 0x45 @@ -614,6 +697,7 @@ const ( IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 0x1c IN_LOOPBACKNET = 0x7f + IN_RFC3021_MASK = 0xfffffffe IPPROTO_3PC = 0x22 IPPROTO_ADFS = 0x44 IPPROTO_AH = 0x33 @@ -735,7 +819,6 @@ const ( IPV6_DEFHLIM = 0x40 IPV6_DONTFRAG = 0x3e IPV6_DSTOPTS = 0x32 - IPV6_FAITH = 0x1d IPV6_FLOWINFO_MASK = 0xffffff0f IPV6_FLOWLABEL_MASK = 0xffff0f00 IPV6_FRAGTTL = 0x78 @@ -747,7 +830,6 @@ const ( IPV6_HLIMDEC = 0x1 IPV6_HOPLIMIT = 0x2f IPV6_HOPOPTS = 0x31 - IPV6_IPSEC_POLICY = 0x1c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff @@ -795,16 +877,22 @@ const ( IP_DUMMYNET_DEL = 0x3d IP_DUMMYNET_FLUSH = 0x3e IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 IP_FW_ADD = 0x32 IP_FW_DEL = 0x33 IP_FW_FLUSH = 0x34 IP_FW_GET = 0x36 IP_FW_RESETLOG = 0x37 + IP_FW_TBL_ADD = 0x2a + IP_FW_TBL_CREATE = 0x28 + IP_FW_TBL_DEL = 0x2b + IP_FW_TBL_DESTROY = 0x29 + IP_FW_TBL_EXPIRE = 0x2f + IP_FW_TBL_FLUSH = 0x2c + IP_FW_TBL_GET = 0x2d + IP_FW_TBL_ZERO = 0x2e IP_FW_X = 0x31 IP_FW_ZERO = 0x35 IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 IP_MAXPACKET = 0xffff IP_MAX_MEMBERSHIPS = 0x14 IP_MF = 0x2000 @@ -1080,12 +1168,10 @@ const ( RTM_MISS = 0x7 RTM_NEWADDR = 0xc RTM_NEWMADDR = 0xf - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTTUNIT = 0xf4240 - RTM_VERSION = 0x6 + RTM_VERSION = 0x7 RTV_EXPIRE = 0x4 RTV_HOPCOUNT = 0x2 RTV_IWCAPSEGS = 0x400 @@ -1106,13 +1192,13 @@ const ( SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 - SIOCADDRT = 0x8040720a SIOCAIFADDR = 0x8040691a + SIOCAIFGROUP = 0x80286987 SIOCALIFADDR = 0x8118691b SIOCATMARK = 0x40047307 SIOCDELMULTI = 0x80206932 - SIOCDELRT = 0x8040720b SIOCDIFADDR = 0x80206919 + SIOCDIFGROUP = 0x80286989 SIOCDIFPHYADDR = 0x80206949 SIOCDLIFADDR = 0x8118691d SIOCGDRVSPEC = 0xc028697b @@ -1120,6 +1206,7 @@ const ( SIOCGETVIFCNT = 0xc028720f SIOCGHIWAT = 0x40047301 SIOCGIFADDR = 0xc0206921 + SIOCGIFALIAS = 0xc0406929 SIOCGIFBRDADDR = 0xc0206923 SIOCGIFCAP = 0xc020691f SIOCGIFCONF = 0xc0106924 @@ -1128,6 +1215,7 @@ const ( SIOCGIFFLAGS = 0xc0206911 SIOCGIFGENERIC = 0xc020693a SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 SIOCGIFINDEX = 0xc0206920 SIOCGIFMEDIA = 0xc0306938 SIOCGIFMETRIC = 0xc0206917 @@ -1194,6 +1282,7 @@ const ( SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 + SO_RERROR = 0x2000 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_SNDBUF = 0x1001 @@ -1233,6 +1322,9 @@ const ( S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 + TAB0 = 0x0 + TAB3 = 0x4 + TABDLY = 0x4 TCIFLUSH = 0x1 TCIOFF = 0x3 TCIOFLUSH = 0x3 @@ -1259,6 +1351,8 @@ const ( TCP_NOPUSH = 0x4 TCP_SIGNATURE_ENABLE = 0x10 TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 TIOCCONS = 0x80047462 @@ -1272,7 +1366,6 @@ const ( TIOCGETD = 0x4004741a TIOCGPGRP = 0x40047477 TIOCGSID = 0x40047463 - TIOCGSIZE = 0x40087468 TIOCGWINSZ = 0x40087468 TIOCISPTMASTER = 0x20007455 TIOCMBIC = 0x8004746b @@ -1317,7 +1410,6 @@ const ( TIOCSETD = 0x8004741b TIOCSIG = 0x2000745f TIOCSPGRP = 0x80047476 - TIOCSSIZE = 0x80087467 TIOCSTART = 0x2000746e TIOCSTAT = 0x20007465 TIOCSTI = 0x80017472 @@ -1326,6 +1418,8 @@ const ( TIOCTIMESTAMP = 0x40107459 TIOCUCNTL = 0x80047466 TOSTOP = 0x400000 + UTIME_NOW = -0x1 + UTIME_OMIT = -0x2 VCHECKPT = 0x13 VDISCARD = 0xf VDSUSP = 0xb @@ -1350,9 +1444,12 @@ const ( VWERASE = 0x4 WCONTINUED = 0x4 WCOREFLAG = 0x80 + WEXITED = 0x10 WLINUXCLONE = 0x80000000 WNOHANG = 0x1 - WSTOPPED = 0x7f + WNOWAIT = 0x8 + WSTOPPED = 0x2 + WTRAPPED = 0x20 WUNTRACED = 0x2 ) @@ -1452,11 +1549,6 @@ const ( ETIMEDOUT = syscall.Errno(0x3c) ETOOMANYREFS = syscall.Errno(0x3b) ETXTBSY = syscall.Errno(0x1a) - EUNUSED94 = syscall.Errno(0x5e) - EUNUSED95 = syscall.Errno(0x5f) - EUNUSED96 = syscall.Errno(0x60) - EUNUSED97 = syscall.Errno(0x61) - EUNUSED98 = syscall.Errno(0x62) EUSERS = syscall.Errno(0x44) EWOULDBLOCK = syscall.Errno(0x23) EXDEV = syscall.Errno(0x12) @@ -1600,12 +1692,7 @@ var errorList = [...]struct { {91, "ENOLINK", "link has been severed"}, {92, "EPROTO", "protocol error"}, {93, "ENOMEDIUM", "no medium found"}, - {94, "EUNUSED94", "unknown error: 94"}, - {95, "EUNUSED95", "unknown error: 95"}, - {96, "EUNUSED96", "unknown error: 96"}, - {97, "EUNUSED97", "unknown error: 97"}, - {98, "EUNUSED98", "unknown error: 98"}, - {99, "ELAST", "unknown error: 99"}, + {99, "EASYNC", "unknown error: 99"}, } // Signal table diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index 8482458734..440900112c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -1,6 +1,7 @@ // mkerrors.sh -m32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && freebsd // +build 386,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -339,6 +340,12 @@ const ( CLOCK_UPTIME_FAST = 0x8 CLOCK_UPTIME_PRECISE = 0x7 CLOCK_VIRTUAL = 0x1 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 @@ -991,6 +998,11 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -1285,6 +1297,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1369,6 +1386,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index 4acd101c3e..64520d3122 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && freebsd // +build amd64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -339,6 +340,12 @@ const ( CLOCK_UPTIME_FAST = 0x8 CLOCK_UPTIME_PRECISE = 0x7 CLOCK_VIRTUAL = 0x1 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 @@ -991,6 +998,11 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -1286,6 +1298,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1370,6 +1387,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index e4719873b9..99e9a0e06e 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -1,6 +1,7 @@ // mkerrors.sh // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && freebsd // +build arm,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -339,6 +340,12 @@ const ( CLOCK_UPTIME_FAST = 0x8 CLOCK_UPTIME_PRECISE = 0x7 CLOCK_VIRTUAL = 0x1 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 @@ -974,6 +981,11 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -1010,6 +1022,15 @@ const ( MAP_RESERVED0100 = 0x100 MAP_SHARED = 0x1 MAP_STACK = 0x400 + MCAST_BLOCK_SOURCE = 0x54 + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x50 + MCAST_JOIN_SOURCE_GROUP = 0x52 + MCAST_LEAVE_GROUP = 0x51 + MCAST_LEAVE_SOURCE_GROUP = 0x53 + MCAST_UNBLOCK_SOURCE = 0x55 + MCAST_UNDEFINED = 0x0 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MNT_ACLS = 0x8000000 @@ -1255,6 +1276,11 @@ const ( SCM_CREDS = 0x3 SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1335,6 +1361,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go index 5e49769d96..4c83771149 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && freebsd // +build arm64,freebsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -339,6 +340,12 @@ const ( CLOCK_UPTIME_FAST = 0x8 CLOCK_UPTIME_PRECISE = 0x7 CLOCK_VIRTUAL = 0x1 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x30000 CS5 = 0x0 @@ -991,6 +998,11 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LOCAL_CONNWAIT = 0x4 + LOCAL_CREDS = 0x2 + LOCAL_CREDS_PERSISTENT = 0x3 + LOCAL_PEERCRED = 0x1 + LOCAL_VENDOR = 0x80000000 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 @@ -1286,6 +1298,11 @@ const ( SCM_RIGHTS = 0x1 SCM_TIMESTAMP = 0x2 SCM_TIME_INFO = 0x7 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_SET = 0x0 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -1370,6 +1387,7 @@ const ( SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 SOCK_STREAM = 0x1 + SOL_LOCAL = 0x0 SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux.go b/vendor/golang.org/x/sys/unix/zerrors_linux.go index f8bd50c11b..78d4b85ece 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1,5 +1,6 @@ // Code generated by mkmerge.go; DO NOT EDIT. +//go:build linux // +build linux package unix @@ -65,6 +66,7 @@ const ( ALG_OP_ENCRYPT = 0x1 ALG_SET_AEAD_ASSOCLEN = 0x4 ALG_SET_AEAD_AUTHSIZE = 0x5 + ALG_SET_DRBG_ENTROPY = 0x6 ALG_SET_IV = 0x2 ALG_SET_KEY = 0x1 ALG_SET_OP = 0x3 @@ -164,13 +166,16 @@ const ( BPF_ALU64 = 0x7 BPF_AND = 0x50 BPF_ARSH = 0xc0 + BPF_ATOMIC = 0xc0 BPF_B = 0x10 BPF_BUILD_ID_SIZE = 0x14 BPF_CALL = 0x80 + BPF_CMPXCHG = 0xf1 BPF_DIV = 0x30 BPF_DW = 0x18 BPF_END = 0xd0 BPF_EXIT = 0x90 + BPF_FETCH = 0x1 BPF_FROM_BE = 0x8 BPF_FROM_LE = 0x0 BPF_FS_MAGIC = 0xcafe4a11 @@ -179,8 +184,10 @@ const ( BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REPLACE = 0x4 + BPF_F_SLEEPABLE = 0x10 BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_TEST_RND_HI32 = 0x4 + BPF_F_TEST_RUN_ON_CPU = 0x1 BPF_F_TEST_STATE_FREQ = 0x8 BPF_H = 0x8 BPF_IMM = 0x0 @@ -219,8 +226,13 @@ const ( BPF_NET_OFF = -0x100000 BPF_OBJ_NAME_LEN = 0x10 BPF_OR = 0x40 + BPF_PSEUDO_BTF_ID = 0x3 BPF_PSEUDO_CALL = 0x1 + BPF_PSEUDO_FUNC = 0x4 + BPF_PSEUDO_KFUNC_CALL = 0x2 BPF_PSEUDO_MAP_FD = 0x1 + BPF_PSEUDO_MAP_IDX = 0x5 + BPF_PSEUDO_MAP_IDX_VALUE = 0x6 BPF_PSEUDO_MAP_VALUE = 0x2 BPF_RET = 0x6 BPF_RSH = 0x70 @@ -235,22 +247,86 @@ const ( BPF_W = 0x0 BPF_X = 0x8 BPF_XADD = 0xc0 + BPF_XCHG = 0xe1 BPF_XOR = 0xa0 BRKINT = 0x2 BS0 = 0x0 BTRFS_SUPER_MAGIC = 0x9123683e BTRFS_TEST_MAGIC = 0x73727279 + BUS_BLUETOOTH = 0x5 + BUS_HIL = 0x4 + BUS_USB = 0x3 + BUS_VIRTUAL = 0x6 CAN_BCM = 0x2 CAN_EFF_FLAG = 0x80000000 CAN_EFF_ID_BITS = 0x1d CAN_EFF_MASK = 0x1fffffff + CAN_ERR_ACK = 0x20 + CAN_ERR_BUSERROR = 0x80 + CAN_ERR_BUSOFF = 0x40 + CAN_ERR_CRTL = 0x4 + CAN_ERR_CRTL_ACTIVE = 0x40 + CAN_ERR_CRTL_RX_OVERFLOW = 0x1 + CAN_ERR_CRTL_RX_PASSIVE = 0x10 + CAN_ERR_CRTL_RX_WARNING = 0x4 + CAN_ERR_CRTL_TX_OVERFLOW = 0x2 + CAN_ERR_CRTL_TX_PASSIVE = 0x20 + CAN_ERR_CRTL_TX_WARNING = 0x8 + CAN_ERR_CRTL_UNSPEC = 0x0 + CAN_ERR_DLC = 0x8 CAN_ERR_FLAG = 0x20000000 + CAN_ERR_LOSTARB = 0x2 + CAN_ERR_LOSTARB_UNSPEC = 0x0 CAN_ERR_MASK = 0x1fffffff + CAN_ERR_PROT = 0x8 + CAN_ERR_PROT_ACTIVE = 0x40 + CAN_ERR_PROT_BIT = 0x1 + CAN_ERR_PROT_BIT0 = 0x8 + CAN_ERR_PROT_BIT1 = 0x10 + CAN_ERR_PROT_FORM = 0x2 + CAN_ERR_PROT_LOC_ACK = 0x19 + CAN_ERR_PROT_LOC_ACK_DEL = 0x1b + CAN_ERR_PROT_LOC_CRC_DEL = 0x18 + CAN_ERR_PROT_LOC_CRC_SEQ = 0x8 + CAN_ERR_PROT_LOC_DATA = 0xa + CAN_ERR_PROT_LOC_DLC = 0xb + CAN_ERR_PROT_LOC_EOF = 0x1a + CAN_ERR_PROT_LOC_ID04_00 = 0xe + CAN_ERR_PROT_LOC_ID12_05 = 0xf + CAN_ERR_PROT_LOC_ID17_13 = 0x7 + CAN_ERR_PROT_LOC_ID20_18 = 0x6 + CAN_ERR_PROT_LOC_ID28_21 = 0x2 + CAN_ERR_PROT_LOC_IDE = 0x5 + CAN_ERR_PROT_LOC_INTERM = 0x12 + CAN_ERR_PROT_LOC_RES0 = 0x9 + CAN_ERR_PROT_LOC_RES1 = 0xd + CAN_ERR_PROT_LOC_RTR = 0xc + CAN_ERR_PROT_LOC_SOF = 0x3 + CAN_ERR_PROT_LOC_SRTR = 0x4 + CAN_ERR_PROT_LOC_UNSPEC = 0x0 + CAN_ERR_PROT_OVERLOAD = 0x20 + CAN_ERR_PROT_STUFF = 0x4 + CAN_ERR_PROT_TX = 0x80 + CAN_ERR_PROT_UNSPEC = 0x0 + CAN_ERR_RESTARTED = 0x100 + CAN_ERR_TRX = 0x10 + CAN_ERR_TRX_CANH_NO_WIRE = 0x4 + CAN_ERR_TRX_CANH_SHORT_TO_BAT = 0x5 + CAN_ERR_TRX_CANH_SHORT_TO_GND = 0x7 + CAN_ERR_TRX_CANH_SHORT_TO_VCC = 0x6 + CAN_ERR_TRX_CANL_NO_WIRE = 0x40 + CAN_ERR_TRX_CANL_SHORT_TO_BAT = 0x50 + CAN_ERR_TRX_CANL_SHORT_TO_CANH = 0x80 + CAN_ERR_TRX_CANL_SHORT_TO_GND = 0x70 + CAN_ERR_TRX_CANL_SHORT_TO_VCC = 0x60 + CAN_ERR_TRX_UNSPEC = 0x0 + CAN_ERR_TX_TIMEOUT = 0x1 CAN_INV_FILTER = 0x20000000 CAN_ISOTP = 0x6 CAN_J1939 = 0x7 CAN_MAX_DLC = 0x8 CAN_MAX_DLEN = 0x8 + CAN_MAX_RAW_DLC = 0xf CAN_MCNET = 0x5 CAN_MTU = 0x10 CAN_NPROTO = 0x8 @@ -265,6 +341,8 @@ const ( CAP_AUDIT_READ = 0x25 CAP_AUDIT_WRITE = 0x1d CAP_BLOCK_SUSPEND = 0x24 + CAP_BPF = 0x27 + CAP_CHECKPOINT_RESTORE = 0x28 CAP_CHOWN = 0x0 CAP_DAC_OVERRIDE = 0x1 CAP_DAC_READ_SEARCH = 0x2 @@ -273,7 +351,7 @@ const ( CAP_IPC_LOCK = 0xe CAP_IPC_OWNER = 0xf CAP_KILL = 0x5 - CAP_LAST_CAP = 0x25 + CAP_LAST_CAP = 0x28 CAP_LEASE = 0x1c CAP_LINUX_IMMUTABLE = 0x9 CAP_MAC_ADMIN = 0x21 @@ -283,6 +361,7 @@ const ( CAP_NET_BIND_SERVICE = 0xa CAP_NET_BROADCAST = 0xb CAP_NET_RAW = 0xd + CAP_PERFMON = 0x26 CAP_SETFCAP = 0x1f CAP_SETGID = 0x6 CAP_SETPCAP = 0x8 @@ -368,12 +447,63 @@ const ( DEBUGFS_MAGIC = 0x64626720 DEVLINK_CMD_ESWITCH_MODE_GET = 0x1d DEVLINK_CMD_ESWITCH_MODE_SET = 0x1e + DEVLINK_FLASH_OVERWRITE_IDENTIFIERS = 0x2 + DEVLINK_FLASH_OVERWRITE_SETTINGS = 0x1 DEVLINK_GENL_MCGRP_CONFIG_NAME = "config" DEVLINK_GENL_NAME = "devlink" DEVLINK_GENL_VERSION = 0x1 DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14 + DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS = 0x3 + DEVMEM_MAGIC = 0x454d444d DEVPTS_SUPER_MAGIC = 0x1cd1 DMA_BUF_MAGIC = 0x444d4142 + DM_ACTIVE_PRESENT_FLAG = 0x20 + DM_BUFFER_FULL_FLAG = 0x100 + DM_CONTROL_NODE = "control" + DM_DATA_OUT_FLAG = 0x10000 + DM_DEFERRED_REMOVE = 0x20000 + DM_DEV_ARM_POLL = 0xc138fd10 + DM_DEV_CREATE = 0xc138fd03 + DM_DEV_REMOVE = 0xc138fd04 + DM_DEV_RENAME = 0xc138fd05 + DM_DEV_SET_GEOMETRY = 0xc138fd0f + DM_DEV_STATUS = 0xc138fd07 + DM_DEV_SUSPEND = 0xc138fd06 + DM_DEV_WAIT = 0xc138fd08 + DM_DIR = "mapper" + DM_GET_TARGET_VERSION = 0xc138fd11 + DM_INACTIVE_PRESENT_FLAG = 0x40 + DM_INTERNAL_SUSPEND_FLAG = 0x40000 + DM_IOCTL = 0xfd + DM_LIST_DEVICES = 0xc138fd02 + DM_LIST_VERSIONS = 0xc138fd0d + DM_MAX_TYPE_NAME = 0x10 + DM_NAME_LEN = 0x80 + DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID = 0x2 + DM_NAME_LIST_FLAG_HAS_UUID = 0x1 + DM_NOFLUSH_FLAG = 0x800 + DM_PERSISTENT_DEV_FLAG = 0x8 + DM_QUERY_INACTIVE_TABLE_FLAG = 0x1000 + DM_READONLY_FLAG = 0x1 + DM_REMOVE_ALL = 0xc138fd01 + DM_SECURE_DATA_FLAG = 0x8000 + DM_SKIP_BDGET_FLAG = 0x200 + DM_SKIP_LOCKFS_FLAG = 0x400 + DM_STATUS_TABLE_FLAG = 0x10 + DM_SUSPEND_FLAG = 0x2 + DM_TABLE_CLEAR = 0xc138fd0a + DM_TABLE_DEPS = 0xc138fd0b + DM_TABLE_LOAD = 0xc138fd09 + DM_TABLE_STATUS = 0xc138fd0c + DM_TARGET_MSG = 0xc138fd0e + DM_UEVENT_GENERATED_FLAG = 0x2000 + DM_UUID_FLAG = 0x4000 + DM_UUID_LEN = 0x81 + DM_VERSION = 0xc138fd00 + DM_VERSION_EXTRA = "-ioctl (2021-03-22)" + DM_VERSION_MAJOR = 0x4 + DM_VERSION_MINOR = 0x2d + DM_VERSION_PATCHLEVEL = 0x0 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -413,6 +543,119 @@ const ( EPOLL_CTL_DEL = 0x2 EPOLL_CTL_MOD = 0x3 EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 + ESP_V4_FLOW = 0xa + ESP_V6_FLOW = 0xc + ETHER_FLOW = 0x12 + ETHTOOL_BUSINFO_LEN = 0x20 + ETHTOOL_EROMVERS_LEN = 0x20 + ETHTOOL_FEC_AUTO = 0x2 + ETHTOOL_FEC_BASER = 0x10 + ETHTOOL_FEC_LLRS = 0x20 + ETHTOOL_FEC_NONE = 0x1 + ETHTOOL_FEC_OFF = 0x4 + ETHTOOL_FEC_RS = 0x8 + ETHTOOL_FLAG_ALL = 0x7 + ETHTOOL_FLAG_COMPACT_BITSETS = 0x1 + ETHTOOL_FLAG_OMIT_REPLY = 0x2 + ETHTOOL_FLAG_STATS = 0x4 + ETHTOOL_FLASHDEV = 0x33 + ETHTOOL_FLASH_MAX_FILENAME = 0x80 + ETHTOOL_FWVERS_LEN = 0x20 + ETHTOOL_F_COMPAT = 0x4 + ETHTOOL_F_UNSUPPORTED = 0x1 + ETHTOOL_F_WISH = 0x2 + ETHTOOL_GCHANNELS = 0x3c + ETHTOOL_GCOALESCE = 0xe + ETHTOOL_GDRVINFO = 0x3 + ETHTOOL_GEEE = 0x44 + ETHTOOL_GEEPROM = 0xb + ETHTOOL_GENL_NAME = "ethtool" + ETHTOOL_GENL_VERSION = 0x1 + ETHTOOL_GET_DUMP_DATA = 0x40 + ETHTOOL_GET_DUMP_FLAG = 0x3f + ETHTOOL_GET_TS_INFO = 0x41 + ETHTOOL_GFEATURES = 0x3a + ETHTOOL_GFECPARAM = 0x50 + ETHTOOL_GFLAGS = 0x25 + ETHTOOL_GGRO = 0x2b + ETHTOOL_GGSO = 0x23 + ETHTOOL_GLINK = 0xa + ETHTOOL_GLINKSETTINGS = 0x4c + ETHTOOL_GMODULEEEPROM = 0x43 + ETHTOOL_GMODULEINFO = 0x42 + ETHTOOL_GMSGLVL = 0x7 + ETHTOOL_GPAUSEPARAM = 0x12 + ETHTOOL_GPERMADDR = 0x20 + ETHTOOL_GPFLAGS = 0x27 + ETHTOOL_GPHYSTATS = 0x4a + ETHTOOL_GREGS = 0x4 + ETHTOOL_GRINGPARAM = 0x10 + ETHTOOL_GRSSH = 0x46 + ETHTOOL_GRXCLSRLALL = 0x30 + ETHTOOL_GRXCLSRLCNT = 0x2e + ETHTOOL_GRXCLSRULE = 0x2f + ETHTOOL_GRXCSUM = 0x14 + ETHTOOL_GRXFH = 0x29 + ETHTOOL_GRXFHINDIR = 0x38 + ETHTOOL_GRXNTUPLE = 0x36 + ETHTOOL_GRXRINGS = 0x2d + ETHTOOL_GSET = 0x1 + ETHTOOL_GSG = 0x18 + ETHTOOL_GSSET_INFO = 0x37 + ETHTOOL_GSTATS = 0x1d + ETHTOOL_GSTRINGS = 0x1b + ETHTOOL_GTSO = 0x1e + ETHTOOL_GTUNABLE = 0x48 + ETHTOOL_GTXCSUM = 0x16 + ETHTOOL_GUFO = 0x21 + ETHTOOL_GWOL = 0x5 + ETHTOOL_MCGRP_MONITOR_NAME = "monitor" + ETHTOOL_NWAY_RST = 0x9 + ETHTOOL_PERQUEUE = 0x4b + ETHTOOL_PHYS_ID = 0x1c + ETHTOOL_PHY_EDPD_DFLT_TX_MSECS = 0xffff + ETHTOOL_PHY_EDPD_DISABLE = 0x0 + ETHTOOL_PHY_EDPD_NO_TX = 0xfffe + ETHTOOL_PHY_FAST_LINK_DOWN_OFF = 0xff + ETHTOOL_PHY_FAST_LINK_DOWN_ON = 0x0 + ETHTOOL_PHY_GTUNABLE = 0x4e + ETHTOOL_PHY_STUNABLE = 0x4f + ETHTOOL_RESET = 0x34 + ETHTOOL_RXNTUPLE_ACTION_CLEAR = -0x2 + ETHTOOL_RXNTUPLE_ACTION_DROP = -0x1 + ETHTOOL_RX_FLOW_SPEC_RING = 0xffffffff + ETHTOOL_RX_FLOW_SPEC_RING_VF = 0xff00000000 + ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF = 0x20 + ETHTOOL_SCHANNELS = 0x3d + ETHTOOL_SCOALESCE = 0xf + ETHTOOL_SEEE = 0x45 + ETHTOOL_SEEPROM = 0xc + ETHTOOL_SET_DUMP = 0x3e + ETHTOOL_SFEATURES = 0x3b + ETHTOOL_SFECPARAM = 0x51 + ETHTOOL_SFLAGS = 0x26 + ETHTOOL_SGRO = 0x2c + ETHTOOL_SGSO = 0x24 + ETHTOOL_SLINKSETTINGS = 0x4d + ETHTOOL_SMSGLVL = 0x8 + ETHTOOL_SPAUSEPARAM = 0x13 + ETHTOOL_SPFLAGS = 0x28 + ETHTOOL_SRINGPARAM = 0x11 + ETHTOOL_SRSSH = 0x47 + ETHTOOL_SRXCLSRLDEL = 0x31 + ETHTOOL_SRXCLSRLINS = 0x32 + ETHTOOL_SRXCSUM = 0x15 + ETHTOOL_SRXFH = 0x2a + ETHTOOL_SRXFHINDIR = 0x39 + ETHTOOL_SRXNTUPLE = 0x35 + ETHTOOL_SSET = 0x2 + ETHTOOL_SSG = 0x19 + ETHTOOL_STSO = 0x1f + ETHTOOL_STUNABLE = 0x49 + ETHTOOL_STXCSUM = 0x17 + ETHTOOL_SUFO = 0x22 + ETHTOOL_SWOL = 0x6 + ETHTOOL_TEST = 0x1a ETH_P_1588 = 0x88f7 ETH_P_8021AD = 0x88a8 ETH_P_8021AH = 0x88e7 @@ -437,6 +680,7 @@ const ( ETH_P_CAIF = 0xf7 ETH_P_CAN = 0xc ETH_P_CANFD = 0xd + ETH_P_CFM = 0x8902 ETH_P_CONTROL = 0x16 ETH_P_CUST = 0x6006 ETH_P_DDCMP = 0x6 @@ -475,6 +719,7 @@ const ( ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 + ETH_P_MRP = 0x88e3 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 ETH_P_NSH = 0x894f @@ -543,8 +788,8 @@ const ( FAN_DELETE = 0x200 FAN_DELETE_SELF = 0x400 FAN_DENY = 0x2 - FAN_DIR_MODIFY = 0x80000 FAN_ENABLE_AUDIT = 0x40 + FAN_EVENT_INFO_TYPE_DFID = 0x3 FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2 FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_METADATA_LEN = 0x18 @@ -572,13 +817,17 @@ const ( FAN_OPEN_EXEC_PERM = 0x40000 FAN_OPEN_PERM = 0x10000 FAN_Q_OVERFLOW = 0x4000 + FAN_REPORT_DFID_NAME = 0xc00 + FAN_REPORT_DIR_FID = 0x400 FAN_REPORT_FID = 0x200 + FAN_REPORT_NAME = 0x800 FAN_REPORT_TID = 0x100 FAN_UNLIMITED_MARKS = 0x20 FAN_UNLIMITED_QUEUE = 0x10 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 FF0 = 0x0 + FIDEDUPERANGE = 0xc0189436 FSCRYPT_KEY_DESCRIPTOR_SIZE = 0x8 FSCRYPT_KEY_DESC_PREFIX = "fscrypt:" FSCRYPT_KEY_DESC_PREFIX_SIZE = 0x8 @@ -602,8 +851,8 @@ const ( FSCRYPT_POLICY_FLAGS_PAD_4 = 0x0 FSCRYPT_POLICY_FLAGS_PAD_8 = 0x1 FSCRYPT_POLICY_FLAGS_PAD_MASK = 0x3 - FSCRYPT_POLICY_FLAGS_VALID = 0xf FSCRYPT_POLICY_FLAG_DIRECT_KEY = 0x4 + FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 = 0x10 FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 = 0x8 FSCRYPT_POLICY_V1 = 0x0 FSCRYPT_POLICY_V2 = 0x2 @@ -621,6 +870,7 @@ const ( FS_IOC_GET_ENCRYPTION_KEY_STATUS = 0xc080661a FS_IOC_GET_ENCRYPTION_POLICY_EX = 0xc0096616 FS_IOC_MEASURE_VERITY = 0xc0046686 + FS_IOC_READ_VERITY_METADATA = 0xc0286687 FS_IOC_REMOVE_ENCRYPTION_KEY = 0xc0406618 FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS = 0xc0406619 FS_KEY_DESCRIPTOR_SIZE = 0x8 @@ -632,10 +882,13 @@ const ( FS_POLICY_FLAGS_PAD_4 = 0x0 FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 - FS_POLICY_FLAGS_VALID = 0xf + FS_POLICY_FLAGS_VALID = 0x7 FS_VERITY_FL = 0x100000 FS_VERITY_HASH_ALG_SHA256 = 0x1 FS_VERITY_HASH_ALG_SHA512 = 0x2 + FS_VERITY_METADATA_TYPE_DESCRIPTOR = 0x2 + FS_VERITY_METADATA_TYPE_MERKLE_TREE = 0x1 + FS_VERITY_METADATA_TYPE_SIGNATURE = 0x3 FUTEXFS_SUPER_MAGIC = 0xbad1dea F_ADD_SEALS = 0x409 F_DUPFD = 0x0 @@ -729,11 +982,11 @@ const ( HDIO_SET_XFER = 0x306 HDIO_TRISTATE_HWIF = 0x31b HDIO_UNREGISTER_HWIF = 0x32a + HID_MAX_DESCRIPTOR_SIZE = 0x1000 HOSTFS_SUPER_MAGIC = 0xc0ffee HPFS_SUPER_MAGIC = 0xf995e849 HUGETLBFS_MAGIC = 0x958458f6 IBSHIFT = 0x10 - ICMPV6_FILTER = 0x1 ICRNL = 0x100 IFA_F_DADFAILED = 0x8 IFA_F_DEPRECATED = 0x20 @@ -834,6 +1087,7 @@ const ( IPPROTO_EGP = 0x8 IPPROTO_ENCAP = 0x62 IPPROTO_ESP = 0x32 + IPPROTO_ETHERNET = 0x8f IPPROTO_FRAGMENT = 0x2c IPPROTO_GRE = 0x2f IPPROTO_HOPOPTS = 0x0 @@ -847,6 +1101,7 @@ const ( IPPROTO_L2TP = 0x73 IPPROTO_MH = 0x87 IPPROTO_MPLS = 0x89 + IPPROTO_MPTCP = 0x106 IPPROTO_MTP = 0x5c IPPROTO_NONE = 0x3b IPPROTO_PIM = 0x67 @@ -874,6 +1129,7 @@ const ( IPV6_DONTFRAG = 0x3e IPV6_DROP_MEMBERSHIP = 0x15 IPV6_DSTOPTS = 0x3b + IPV6_FLOW = 0x11 IPV6_FREEBIND = 0x4e IPV6_HDRINCL = 0x24 IPV6_HOPLIMIT = 0x34 @@ -902,6 +1158,7 @@ const ( IPV6_PMTUDISC_WANT = 0x1 IPV6_RECVDSTOPTS = 0x3a IPV6_RECVERR = 0x19 + IPV6_RECVERR_RFC4884 = 0x1f IPV6_RECVFRAGSIZE = 0x4d IPV6_RECVHOPLIMIT = 0x33 IPV6_RECVHOPOPTS = 0x35 @@ -923,6 +1180,7 @@ const ( IPV6_TRANSPARENT = 0x4b IPV6_UNICAST_HOPS = 0x10 IPV6_UNICAST_IF = 0x4c + IPV6_USER_FLOW = 0xe IPV6_V6ONLY = 0x1a IPV6_XFRM_POLICY = 0x23 IP_ADD_MEMBERSHIP = 0x23 @@ -965,6 +1223,7 @@ const ( IP_PMTUDISC_PROBE = 0x3 IP_PMTUDISC_WANT = 0x1 IP_RECVERR = 0xb + IP_RECVERR_RFC4884 = 0x1a IP_RECVFRAGSIZE = 0x19 IP_RECVOPTS = 0x6 IP_RECVORIGDSTADDR = 0x14 @@ -979,6 +1238,7 @@ const ( IP_TTL = 0x2 IP_UNBLOCK_SOURCE = 0x25 IP_UNICAST_IF = 0x32 + IP_USER_FLOW = 0xd IP_XFRM_POLICY = 0x11 ISOFS_SUPER_MAGIC = 0x9660 ISTRIP = 0x20 @@ -997,6 +1257,7 @@ const ( KEXEC_ARCH_PARISC = 0xf0000 KEXEC_ARCH_PPC = 0x140000 KEXEC_ARCH_PPC64 = 0x150000 + KEXEC_ARCH_RISCV = 0xf30000 KEXEC_ARCH_S390 = 0x160000 KEXEC_ARCH_SH = 0x2a0000 KEXEC_ARCH_X86_64 = 0x3e0000 @@ -1016,6 +1277,7 @@ const ( KEYCTL_CAPS0_PERSISTENT_KEYRINGS = 0x2 KEYCTL_CAPS0_PUBLIC_KEY = 0x8 KEYCTL_CAPS0_RESTRICT_KEYRING = 0x40 + KEYCTL_CAPS1_NOTIFICATIONS = 0x4 KEYCTL_CAPS1_NS_KEYRING_NAME = 0x1 KEYCTL_CAPS1_NS_KEY_TAG = 0x2 KEYCTL_CHOWN = 0x4 @@ -1053,6 +1315,7 @@ const ( KEYCTL_SUPPORTS_VERIFY = 0x8 KEYCTL_UNLINK = 0x9 KEYCTL_UPDATE = 0x2 + KEYCTL_WATCH_KEY = 0x20 KEY_REQKEY_DEFL_DEFAULT = 0x0 KEY_REQKEY_DEFL_GROUP_KEYRING = 0x6 KEY_REQKEY_DEFL_NO_CHANGE = -0x1 @@ -1070,6 +1333,20 @@ const ( KEY_SPEC_THREAD_KEYRING = -0x1 KEY_SPEC_USER_KEYRING = -0x4 KEY_SPEC_USER_SESSION_KEYRING = -0x5 + LANDLOCK_ACCESS_FS_EXECUTE = 0x1 + LANDLOCK_ACCESS_FS_MAKE_BLOCK = 0x800 + LANDLOCK_ACCESS_FS_MAKE_CHAR = 0x40 + LANDLOCK_ACCESS_FS_MAKE_DIR = 0x80 + LANDLOCK_ACCESS_FS_MAKE_FIFO = 0x400 + LANDLOCK_ACCESS_FS_MAKE_REG = 0x100 + LANDLOCK_ACCESS_FS_MAKE_SOCK = 0x200 + LANDLOCK_ACCESS_FS_MAKE_SYM = 0x1000 + LANDLOCK_ACCESS_FS_READ_DIR = 0x8 + LANDLOCK_ACCESS_FS_READ_FILE = 0x4 + LANDLOCK_ACCESS_FS_REMOVE_DIR = 0x10 + LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20 + LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 + LANDLOCK_CREATE_RULESET_VERSION = 0x1 LINUX_REBOOT_CMD_CAD_OFF = 0x0 LINUX_REBOOT_CMD_CAD_ON = 0x89abcdef LINUX_REBOOT_CMD_HALT = 0xcdef0123 @@ -1096,8 +1373,16 @@ const ( LOOP_SET_FD = 0x4c00 LOOP_SET_STATUS = 0x4c02 LOOP_SET_STATUS64 = 0x4c04 + LOOP_SET_STATUS_CLEARABLE_FLAGS = 0x4 + LOOP_SET_STATUS_SETTABLE_FLAGS = 0xc LO_KEY_SIZE = 0x20 LO_NAME_SIZE = 0x40 + LWTUNNEL_IP6_MAX = 0x8 + LWTUNNEL_IP_MAX = 0x8 + LWTUNNEL_IP_OPTS_MAX = 0x3 + LWTUNNEL_IP_OPT_ERSPAN_MAX = 0x4 + LWTUNNEL_IP_OPT_GENEVE_MAX = 0x3 + LWTUNNEL_IP_OPT_VXLAN_MAX = 0x1 MADV_COLD = 0x14 MADV_DODUMP = 0x11 MADV_DOFORK = 0xb @@ -1112,6 +1397,8 @@ const ( MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 MADV_PAGEOUT = 0x15 + MADV_POPULATE_READ = 0x16 + MADV_POPULATE_WRITE = 0x17 MADV_RANDOM = 0x1 MADV_REMOVE = 0x9 MADV_SEQUENTIAL = 0x2 @@ -1136,6 +1423,10 @@ const ( MCAST_LEAVE_SOURCE_GROUP = 0x2f MCAST_MSFILTER = 0x30 MCAST_UNBLOCK_SOURCE = 0x2c + MEMGETREGIONINFO = 0xc0104d08 + MEMREADOOB64 = 0xc0184d16 + MEMWRITE = 0xc0304d18 + MEMWRITEOOB64 = 0xc0184d15 MFD_ALLOW_SEALING = 0x2 MFD_CLOEXEC = 0x1 MFD_HUGETLB = 0x4 @@ -1206,6 +1497,7 @@ const ( MS_NOREMOTELOCK = 0x8000000 MS_NOSEC = 0x10000000 MS_NOSUID = 0x2 + MS_NOSYMFOLLOW = 0x100 MS_NOUSER = -0x80000000 MS_POSIXACL = 0x10000 MS_PRIVATE = 0x40000 @@ -1223,7 +1515,35 @@ const ( MS_SYNCHRONOUS = 0x10 MS_UNBINDABLE = 0x20000 MS_VERBOSE = 0x8000 + MTD_ABSENT = 0x0 + MTD_BIT_WRITEABLE = 0x800 + MTD_CAP_NANDFLASH = 0x400 + MTD_CAP_NORFLASH = 0xc00 + MTD_CAP_NVRAM = 0x1c00 + MTD_CAP_RAM = 0x1c00 + MTD_CAP_ROM = 0x0 + MTD_DATAFLASH = 0x6 MTD_INODE_FS_MAGIC = 0x11307854 + MTD_MAX_ECCPOS_ENTRIES = 0x40 + MTD_MAX_OOBFREE_ENTRIES = 0x8 + MTD_MLCNANDFLASH = 0x8 + MTD_NANDECC_AUTOPLACE = 0x2 + MTD_NANDECC_AUTOPL_USR = 0x4 + MTD_NANDECC_OFF = 0x0 + MTD_NANDECC_PLACE = 0x1 + MTD_NANDECC_PLACEONLY = 0x3 + MTD_NANDFLASH = 0x4 + MTD_NORFLASH = 0x3 + MTD_NO_ERASE = 0x1000 + MTD_OTP_FACTORY = 0x1 + MTD_OTP_OFF = 0x0 + MTD_OTP_USER = 0x2 + MTD_POWERUP_LOCK = 0x2000 + MTD_RAM = 0x1 + MTD_ROM = 0x2 + MTD_SLC_ON_MLC_EMULATION = 0x4000 + MTD_UBIVOLUME = 0x7 + MTD_WRITEABLE = 0x400 NAME_MAX = 0xff NCP_SUPER_MAGIC = 0x564c NETLINK_ADD_MEMBERSHIP = 0x1 @@ -1263,6 +1583,59 @@ const ( NETLINK_XFRM = 0x6 NETNSA_MAX = 0x5 NETNSA_NSID_NOT_ASSIGNED = -0x1 + NFC_ATR_REQ_GB_MAXSIZE = 0x30 + NFC_ATR_REQ_MAXSIZE = 0x40 + NFC_ATR_RES_GB_MAXSIZE = 0x2f + NFC_ATR_RES_MAXSIZE = 0x40 + NFC_COMM_ACTIVE = 0x0 + NFC_COMM_PASSIVE = 0x1 + NFC_DEVICE_NAME_MAXSIZE = 0x8 + NFC_DIRECTION_RX = 0x0 + NFC_DIRECTION_TX = 0x1 + NFC_FIRMWARE_NAME_MAXSIZE = 0x20 + NFC_GB_MAXSIZE = 0x30 + NFC_GENL_MCAST_EVENT_NAME = "events" + NFC_GENL_NAME = "nfc" + NFC_GENL_VERSION = 0x1 + NFC_HEADER_SIZE = 0x1 + NFC_ISO15693_UID_MAXSIZE = 0x8 + NFC_LLCP_MAX_SERVICE_NAME = 0x3f + NFC_LLCP_MIUX = 0x1 + NFC_LLCP_REMOTE_LTO = 0x3 + NFC_LLCP_REMOTE_MIU = 0x2 + NFC_LLCP_REMOTE_RW = 0x4 + NFC_LLCP_RW = 0x0 + NFC_NFCID1_MAXSIZE = 0xa + NFC_NFCID2_MAXSIZE = 0x8 + NFC_NFCID3_MAXSIZE = 0xa + NFC_PROTO_FELICA = 0x3 + NFC_PROTO_FELICA_MASK = 0x8 + NFC_PROTO_ISO14443 = 0x4 + NFC_PROTO_ISO14443_B = 0x6 + NFC_PROTO_ISO14443_B_MASK = 0x40 + NFC_PROTO_ISO14443_MASK = 0x10 + NFC_PROTO_ISO15693 = 0x7 + NFC_PROTO_ISO15693_MASK = 0x80 + NFC_PROTO_JEWEL = 0x1 + NFC_PROTO_JEWEL_MASK = 0x2 + NFC_PROTO_MAX = 0x8 + NFC_PROTO_MIFARE = 0x2 + NFC_PROTO_MIFARE_MASK = 0x4 + NFC_PROTO_NFC_DEP = 0x5 + NFC_PROTO_NFC_DEP_MASK = 0x20 + NFC_RAW_HEADER_SIZE = 0x2 + NFC_RF_INITIATOR = 0x0 + NFC_RF_NONE = 0x2 + NFC_RF_TARGET = 0x1 + NFC_SENSB_RES_MAXSIZE = 0xc + NFC_SENSF_RES_MAXSIZE = 0x12 + NFC_SE_DISABLED = 0x0 + NFC_SE_EMBEDDED = 0x2 + NFC_SE_ENABLED = 0x1 + NFC_SE_UICC = 0x1 + NFC_SOCKPROTO_LLCP = 0x1 + NFC_SOCKPROTO_MAX = 0x2 + NFC_SOCKPROTO_RAW = 0x0 NFNETLINK_V0 = 0x0 NFNLGRP_ACCT_QUOTA = 0x8 NFNLGRP_CONNTRACK_DESTROY = 0x3 @@ -1280,11 +1653,12 @@ const ( NFNL_MSG_BATCH_END = 0x11 NFNL_NFA_NEST = 0x8000 NFNL_SUBSYS_ACCT = 0x7 - NFNL_SUBSYS_COUNT = 0xc + NFNL_SUBSYS_COUNT = 0xd NFNL_SUBSYS_CTHELPER = 0x9 NFNL_SUBSYS_CTNETLINK = 0x1 NFNL_SUBSYS_CTNETLINK_EXP = 0x2 NFNL_SUBSYS_CTNETLINK_TIMEOUT = 0x8 + NFNL_SUBSYS_HOOK = 0xc NFNL_SUBSYS_IPSET = 0x6 NFNL_SUBSYS_NFTABLES = 0xa NFNL_SUBSYS_NFT_COMPAT = 0xb @@ -1393,6 +1767,104 @@ const ( PARITY_DEFAULT = 0x0 PARITY_NONE = 0x1 PARMRK = 0x8 + PERF_ATTR_SIZE_VER0 = 0x40 + PERF_ATTR_SIZE_VER1 = 0x48 + PERF_ATTR_SIZE_VER2 = 0x50 + PERF_ATTR_SIZE_VER3 = 0x60 + PERF_ATTR_SIZE_VER4 = 0x68 + PERF_ATTR_SIZE_VER5 = 0x70 + PERF_ATTR_SIZE_VER6 = 0x78 + PERF_ATTR_SIZE_VER7 = 0x80 + PERF_AUX_FLAG_COLLISION = 0x8 + PERF_AUX_FLAG_CORESIGHT_FORMAT_CORESIGHT = 0x0 + PERF_AUX_FLAG_CORESIGHT_FORMAT_RAW = 0x100 + PERF_AUX_FLAG_OVERWRITE = 0x2 + PERF_AUX_FLAG_PARTIAL = 0x4 + PERF_AUX_FLAG_PMU_FORMAT_TYPE_MASK = 0xff00 + PERF_AUX_FLAG_TRUNCATED = 0x1 + PERF_FLAG_FD_CLOEXEC = 0x8 + PERF_FLAG_FD_NO_GROUP = 0x1 + PERF_FLAG_FD_OUTPUT = 0x2 + PERF_FLAG_PID_CGROUP = 0x4 + PERF_HW_EVENT_MASK = 0xffffffff + PERF_MAX_CONTEXTS_PER_STACK = 0x8 + PERF_MAX_STACK_DEPTH = 0x7f + PERF_MEM_BLK_ADDR = 0x4 + PERF_MEM_BLK_DATA = 0x2 + PERF_MEM_BLK_NA = 0x1 + PERF_MEM_BLK_SHIFT = 0x28 + PERF_MEM_LOCK_LOCKED = 0x2 + PERF_MEM_LOCK_NA = 0x1 + PERF_MEM_LOCK_SHIFT = 0x18 + PERF_MEM_LVLNUM_ANY_CACHE = 0xb + PERF_MEM_LVLNUM_L1 = 0x1 + PERF_MEM_LVLNUM_L2 = 0x2 + PERF_MEM_LVLNUM_L3 = 0x3 + PERF_MEM_LVLNUM_L4 = 0x4 + PERF_MEM_LVLNUM_LFB = 0xc + PERF_MEM_LVLNUM_NA = 0xf + PERF_MEM_LVLNUM_PMEM = 0xe + PERF_MEM_LVLNUM_RAM = 0xd + PERF_MEM_LVLNUM_SHIFT = 0x21 + PERF_MEM_LVL_HIT = 0x2 + PERF_MEM_LVL_IO = 0x1000 + PERF_MEM_LVL_L1 = 0x8 + PERF_MEM_LVL_L2 = 0x20 + PERF_MEM_LVL_L3 = 0x40 + PERF_MEM_LVL_LFB = 0x10 + PERF_MEM_LVL_LOC_RAM = 0x80 + PERF_MEM_LVL_MISS = 0x4 + PERF_MEM_LVL_NA = 0x1 + PERF_MEM_LVL_REM_CCE1 = 0x400 + PERF_MEM_LVL_REM_CCE2 = 0x800 + PERF_MEM_LVL_REM_RAM1 = 0x100 + PERF_MEM_LVL_REM_RAM2 = 0x200 + PERF_MEM_LVL_SHIFT = 0x5 + PERF_MEM_LVL_UNC = 0x2000 + PERF_MEM_OP_EXEC = 0x10 + PERF_MEM_OP_LOAD = 0x2 + PERF_MEM_OP_NA = 0x1 + PERF_MEM_OP_PFETCH = 0x8 + PERF_MEM_OP_SHIFT = 0x0 + PERF_MEM_OP_STORE = 0x4 + PERF_MEM_REMOTE_REMOTE = 0x1 + PERF_MEM_REMOTE_SHIFT = 0x25 + PERF_MEM_SNOOPX_FWD = 0x1 + PERF_MEM_SNOOPX_SHIFT = 0x26 + PERF_MEM_SNOOP_HIT = 0x4 + PERF_MEM_SNOOP_HITM = 0x10 + PERF_MEM_SNOOP_MISS = 0x8 + PERF_MEM_SNOOP_NA = 0x1 + PERF_MEM_SNOOP_NONE = 0x2 + PERF_MEM_SNOOP_SHIFT = 0x13 + PERF_MEM_TLB_HIT = 0x2 + PERF_MEM_TLB_L1 = 0x8 + PERF_MEM_TLB_L2 = 0x10 + PERF_MEM_TLB_MISS = 0x4 + PERF_MEM_TLB_NA = 0x1 + PERF_MEM_TLB_OS = 0x40 + PERF_MEM_TLB_SHIFT = 0x1a + PERF_MEM_TLB_WK = 0x20 + PERF_PMU_TYPE_SHIFT = 0x20 + PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER = 0x1 + PERF_RECORD_MISC_COMM_EXEC = 0x2000 + PERF_RECORD_MISC_CPUMODE_MASK = 0x7 + PERF_RECORD_MISC_CPUMODE_UNKNOWN = 0x0 + PERF_RECORD_MISC_EXACT_IP = 0x4000 + PERF_RECORD_MISC_EXT_RESERVED = 0x8000 + PERF_RECORD_MISC_FORK_EXEC = 0x2000 + PERF_RECORD_MISC_GUEST_KERNEL = 0x4 + PERF_RECORD_MISC_GUEST_USER = 0x5 + PERF_RECORD_MISC_HYPERVISOR = 0x3 + PERF_RECORD_MISC_KERNEL = 0x1 + PERF_RECORD_MISC_MMAP_BUILD_ID = 0x4000 + PERF_RECORD_MISC_MMAP_DATA = 0x2000 + PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT = 0x1000 + PERF_RECORD_MISC_SWITCH_OUT = 0x2000 + PERF_RECORD_MISC_SWITCH_OUT_PREEMPT = 0x4000 + PERF_RECORD_MISC_USER = 0x2 + PERF_SAMPLE_BRANCH_PLM_ALL = 0x7 + PERF_SAMPLE_WEIGHT_TYPE = 0x1004000 PIPEFS_MAGIC = 0x50495045 PPC_CMM_MAGIC = 0xc7571590 PPPIOCGNPMODE = 0xc008744c @@ -1461,12 +1933,27 @@ const ( PR_MCE_KILL_SET = 0x1 PR_MPX_DISABLE_MANAGEMENT = 0x2c PR_MPX_ENABLE_MANAGEMENT = 0x2b + PR_MTE_TAG_MASK = 0x7fff8 + PR_MTE_TAG_SHIFT = 0x3 + PR_MTE_TCF_ASYNC = 0x4 + PR_MTE_TCF_MASK = 0x6 + PR_MTE_TCF_NONE = 0x0 + PR_MTE_TCF_SHIFT = 0x1 + PR_MTE_TCF_SYNC = 0x2 PR_PAC_APDAKEY = 0x4 PR_PAC_APDBKEY = 0x8 PR_PAC_APGAKEY = 0x10 PR_PAC_APIAKEY = 0x1 PR_PAC_APIBKEY = 0x2 + PR_PAC_GET_ENABLED_KEYS = 0x3d PR_PAC_RESET_KEYS = 0x36 + PR_PAC_SET_ENABLED_KEYS = 0x3c + PR_SCHED_CORE = 0x3e + PR_SCHED_CORE_CREATE = 0x1 + PR_SCHED_CORE_GET = 0x0 + PR_SCHED_CORE_MAX = 0x4 + PR_SCHED_CORE_SHARE_FROM = 0x3 + PR_SCHED_CORE_SHARE_TO = 0x2 PR_SET_CHILD_SUBREAPER = 0x24 PR_SET_DUMPABLE = 0x4 PR_SET_ENDIAN = 0x14 @@ -1498,6 +1985,7 @@ const ( PR_SET_SECCOMP = 0x16 PR_SET_SECUREBITS = 0x1c PR_SET_SPECULATION_CTRL = 0x35 + PR_SET_SYSCALL_USER_DISPATCH = 0x3b PR_SET_TAGGED_ADDR_CTRL = 0x37 PR_SET_THP_DISABLE = 0x29 PR_SET_TIMERSLACK = 0x1d @@ -1517,6 +2005,8 @@ const ( PR_SVE_SET_VL_ONEXEC = 0x40000 PR_SVE_VL_INHERIT = 0x20000 PR_SVE_VL_LEN_MASK = 0xffff + PR_SYS_DISPATCH_OFF = 0x0 + PR_SYS_DISPATCH_ON = 0x1 PR_TAGGED_ADDR_ENABLE = 0x1 PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 @@ -1545,6 +2035,7 @@ const ( PTRACE_GETREGSET = 0x4204 PTRACE_GETSIGINFO = 0x4202 PTRACE_GETSIGMASK = 0x420a + PTRACE_GET_RSEQ_CONFIGURATION = 0x420f PTRACE_GET_SYSCALL_INFO = 0x420e PTRACE_INTERRUPT = 0x4207 PTRACE_KILL = 0x8 @@ -1586,6 +2077,11 @@ const ( QNX4_SUPER_MAGIC = 0x2f QNX6_SUPER_MAGIC = 0x68191122 RAMFS_MAGIC = 0x858458f6 + RAW_PAYLOAD_DIGITAL = 0x3 + RAW_PAYLOAD_HCI = 0x2 + RAW_PAYLOAD_LLCP = 0x0 + RAW_PAYLOAD_NCI = 0x1 + RAW_PAYLOAD_PROPRIETARY = 0x4 RDTGROUP_SUPER_MAGIC = 0x7655821 REISERFS_SUPER_MAGIC = 0x52654973 RENAME_EXCHANGE = 0x2 @@ -1636,6 +2132,10 @@ const ( RTCF_NAT = 0x800000 RTCF_VALVE = 0x200000 RTC_AF = 0x20 + RTC_FEATURE_ALARM = 0x0 + RTC_FEATURE_ALARM_RES_MINUTE = 0x1 + RTC_FEATURE_CNT = 0x3 + RTC_FEATURE_NEED_WEEK_DAY = 0x2 RTC_IRQF = 0x80 RTC_MAX_FREQ = 0x2000 RTC_PF = 0x40 @@ -1696,6 +2196,7 @@ const ( RTM_DELNEIGH = 0x1d RTM_DELNETCONF = 0x51 RTM_DELNEXTHOP = 0x69 + RTM_DELNEXTHOPBUCKET = 0x75 RTM_DELNSID = 0x59 RTM_DELQDISC = 0x25 RTM_DELROUTE = 0x19 @@ -1709,6 +2210,7 @@ const ( RTM_F_LOOKUP_TABLE = 0x1000 RTM_F_NOTIFY = 0x100 RTM_F_OFFLOAD = 0x4000 + RTM_F_OFFLOAD_FAILED = 0x20000000 RTM_F_PREFIX = 0x800 RTM_F_TRAP = 0x8000 RTM_GETACTION = 0x32 @@ -1725,6 +2227,7 @@ const ( RTM_GETNEIGHTBL = 0x42 RTM_GETNETCONF = 0x52 RTM_GETNEXTHOP = 0x6a + RTM_GETNEXTHOPBUCKET = 0x76 RTM_GETNSID = 0x5a RTM_GETQDISC = 0x26 RTM_GETROUTE = 0x1a @@ -1733,7 +2236,7 @@ const ( RTM_GETTCLASS = 0x2a RTM_GETTFILTER = 0x2e RTM_GETVLAN = 0x72 - RTM_MAX = 0x73 + RTM_MAX = 0x77 RTM_NEWACTION = 0x30 RTM_NEWADDR = 0x14 RTM_NEWADDRLABEL = 0x48 @@ -1747,6 +2250,7 @@ const ( RTM_NEWNEIGHTBL = 0x40 RTM_NEWNETCONF = 0x50 RTM_NEWNEXTHOP = 0x68 + RTM_NEWNEXTHOPBUCKET = 0x74 RTM_NEWNSID = 0x58 RTM_NEWNVLAN = 0x70 RTM_NEWPREFIX = 0x34 @@ -1756,18 +2260,19 @@ const ( RTM_NEWSTATS = 0x5c RTM_NEWTCLASS = 0x28 RTM_NEWTFILTER = 0x2c - RTM_NR_FAMILIES = 0x19 - RTM_NR_MSGTYPES = 0x64 + RTM_NR_FAMILIES = 0x1a + RTM_NR_MSGTYPES = 0x68 RTM_SETDCB = 0x4f RTM_SETLINK = 0x13 RTM_SETNEIGHTBL = 0x43 RTNH_ALIGNTO = 0x4 - RTNH_COMPARE_MASK = 0x19 + RTNH_COMPARE_MASK = 0x59 RTNH_F_DEAD = 0x1 RTNH_F_LINKDOWN = 0x10 RTNH_F_OFFLOAD = 0x8 RTNH_F_ONLINK = 0x4 RTNH_F_PERVASIVE = 0x2 + RTNH_F_TRAP = 0x40 RTNH_F_UNRESOLVED = 0x20 RTN_MAX = 0xb RTPROT_BABEL = 0x2a @@ -1779,10 +2284,12 @@ const ( RTPROT_EIGRP = 0xc0 RTPROT_GATED = 0x8 RTPROT_ISIS = 0xbb + RTPROT_KEEPALIVED = 0x12 RTPROT_KERNEL = 0x2 RTPROT_MROUTED = 0x11 RTPROT_MRT = 0xa RTPROT_NTK = 0xf + RTPROT_OPENR = 0x63 RTPROT_OSPF = 0xbc RTPROT_RA = 0x9 RTPROT_REDIRECT = 0x1 @@ -1813,7 +2320,14 @@ const ( SECCOMP_MODE_DISABLED = 0x0 SECCOMP_MODE_FILTER = 0x2 SECCOMP_MODE_STRICT = 0x1 + SECRETMEM_MAGIC = 0x5345434d SECURITYFS_MAGIC = 0x73636673 + SEEK_CUR = 0x1 + SEEK_DATA = 0x3 + SEEK_END = 0x2 + SEEK_HOLE = 0x4 + SEEK_MAX = 0x4 + SEEK_SET = 0x0 SELINUX_MAGIC = 0xf97cff8c SHUT_RD = 0x0 SHUT_RDWR = 0x2 @@ -1929,6 +2443,7 @@ const ( SOL_ATM = 0x108 SOL_CAIF = 0x116 SOL_CAN_BASE = 0x64 + SOL_CAN_RAW = 0x65 SOL_DCCP = 0x10d SOL_DECNET = 0x105 SOL_ICMPV6 = 0x3a @@ -1968,6 +2483,7 @@ const ( SO_EE_ORIGIN_TXSTATUS = 0x4 SO_EE_ORIGIN_TXTIME = 0x6 SO_EE_ORIGIN_ZEROCOPY = 0x5 + SO_EE_RFC4884_FLAG_INVALID = 0x1 SO_GET_FILTER = 0x1a SO_NO_CHECK = 0xb SO_PEERNAME = 0x1c @@ -1992,8 +2508,10 @@ const ( STATX_ATTR_APPEND = 0x20 STATX_ATTR_AUTOMOUNT = 0x1000 STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_DAX = 0x200000 STATX_ATTR_ENCRYPTED = 0x800 STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_MOUNT_ROOT = 0x2000 STATX_ATTR_NODUMP = 0x40 STATX_ATTR_VERITY = 0x100000 STATX_BASIC_STATS = 0x7ff @@ -2002,6 +2520,7 @@ const ( STATX_CTIME = 0x80 STATX_GID = 0x10 STATX_INO = 0x100 + STATX_MNT_ID = 0x1000 STATX_MODE = 0x2 STATX_MTIME = 0x40 STATX_NLINK = 0x4 @@ -2055,6 +2574,14 @@ const ( TCOFLUSH = 0x1 TCOOFF = 0x0 TCOON = 0x1 + TCPOPT_EOL = 0x0 + TCPOPT_MAXSEG = 0x2 + TCPOPT_NOP = 0x1 + TCPOPT_SACK = 0x5 + TCPOPT_SACK_PERMITTED = 0x4 + TCPOPT_TIMESTAMP = 0x8 + TCPOPT_TSTAMP_HDR = 0x101080a + TCPOPT_WINDOW = 0x3 TCP_CC_INFO = 0x1a TCP_CM_INQ = 0x24 TCP_CONGESTION = 0xd @@ -2108,6 +2635,8 @@ const ( TCP_TX_DELAY = 0x25 TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 + TCP_V4_FLOW = 0x1 + TCP_V6_FLOW = 0x5 TCP_WINDOW_CLAMP = 0xa TCP_ZEROCOPY_RECEIVE = 0x23 TFD_TIMER_ABSTIME = 0x1 @@ -2173,6 +2702,7 @@ const ( TIPC_NODE_STATE = 0x0 TIPC_OK = 0x0 TIPC_PUBLISHED = 0x1 + TIPC_REKEYING_NOW = 0xffffffff TIPC_RESERVED_TYPES = 0x40 TIPC_RETDATA = 0x2 TIPC_SERVICE_ADDR = 0x2 @@ -2229,15 +2759,34 @@ const ( VMADDR_CID_HOST = 0x2 VMADDR_CID_HYPERVISOR = 0x0 VMADDR_CID_LOCAL = 0x1 + VMADDR_FLAG_TO_HOST = 0x1 VMADDR_PORT_ANY = 0xffffffff VM_SOCKETS_INVALID_VERSION = 0xffffffff VQUIT = 0x1 VT0 = 0x0 + WAKE_MAGIC = 0x20 WALL = 0x40000000 WCLONE = 0x80000000 WCONTINUED = 0x8 WDIOC_SETPRETIMEOUT = 0xc0045708 WDIOC_SETTIMEOUT = 0xc0045706 + WDIOF_ALARMONLY = 0x400 + WDIOF_CARDRESET = 0x20 + WDIOF_EXTERN1 = 0x4 + WDIOF_EXTERN2 = 0x8 + WDIOF_FANFAULT = 0x2 + WDIOF_KEEPALIVEPING = 0x8000 + WDIOF_MAGICCLOSE = 0x100 + WDIOF_OVERHEAT = 0x1 + WDIOF_POWEROVER = 0x40 + WDIOF_POWERUNDER = 0x10 + WDIOF_PRETIMEOUT = 0x200 + WDIOF_SETTIMEOUT = 0x80 + WDIOF_UNKNOWN = -0x1 + WDIOS_DISABLECARD = 0x1 + WDIOS_ENABLECARD = 0x2 + WDIOS_TEMPPANIC = 0x4 + WDIOS_UNKNOWN = -0x1 WEXITED = 0x4 WIN_ACKMEDIACHANGE = 0xdb WIN_CHECKPOWERMODE1 = 0xe5 @@ -2358,6 +2907,9 @@ const ( Z3FOLD_MAGIC = 0x33 ZONEFS_MAGIC = 0x5a4f4653 ZSMALLOC_MAGIC = 0x58295829 + _HIDIOCGRAWNAME_LEN = 0x80 + _HIDIOCGRAWPHYS_LEN = 0x40 + _HIDIOCGRAWUNIQ_LEN = 0x40 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 11b25f68c2..697811a460 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include -m32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && linux // +build 386,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FP_XSTATE_MAGIC2 = 0x46505845 FS_IOC_ENABLE_VERITY = 0x40806685 @@ -91,6 +96,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -117,6 +125,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +147,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -163,6 +189,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -190,6 +217,7 @@ const ( PPPIOCSPASS = 0x40087447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffff PTRACE_GETFPREGS = 0xe @@ -266,6 +294,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -280,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -288,6 +318,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -479,6 +510,9 @@ const ( X86_FXSR_MAGIC = 0x0 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index f92cff6ea0..7d8d93bfc4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && linux // +build amd64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FP_XSTATE_MAGIC2 = 0x46505845 FS_IOC_ENABLE_VERITY = 0x40806685 @@ -91,6 +96,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -117,6 +125,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -126,6 +147,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -163,6 +189,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -190,6 +217,7 @@ const ( PPPIOCSPASS = 0x40107447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_ARCH_PRCTL = 0x1e @@ -267,6 +295,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -281,6 +310,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -289,6 +319,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -479,6 +510,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 12bcbf88d6..f707d50894 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && linux // +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FS_IOC_ENABLE_VERITY = 0x40806685 FS_IOC_GETFLAGS = 0x80046601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -124,6 +145,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -161,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -188,6 +215,7 @@ const ( PPPIOCSPASS = 0x40087447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffff PTRACE_GETCRUNCHREGS = 0x19 @@ -273,6 +301,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -287,6 +316,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -295,6 +325,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -485,6 +516,9 @@ const ( WORDSIZE = 0x20 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 8b0e024b94..3a67a9c852 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && linux // +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -73,6 +76,8 @@ const ( EXTRA_MAGIC = 0x45585401 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FPSIMD_MAGIC = 0x46508001 FS_IOC_ENABLE_VERITY = 0x40806685 @@ -93,6 +98,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -118,6 +126,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -127,6 +148,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -164,6 +190,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -191,8 +218,13 @@ const ( PPPIOCSPASS = 0x40107447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e + PROT_BTI = 0x10 + PROT_MTE = 0x20 PR_SET_PTRACER_ANY = 0xffffffffffffffff + PTRACE_PEEKMTETAGS = 0x21 + PTRACE_POKEMTETAGS = 0x22 PTRACE_SYSEMU = 0x1f PTRACE_SYSEMU_SINGLESTEP = 0x20 RLIMIT_AS = 0x9 @@ -259,6 +291,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -273,6 +306,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -281,6 +315,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -472,6 +507,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index eeadea943f..a7ccef56c5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips && linux // +build mips,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x2000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40046601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x18 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x100 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -124,6 +145,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 @@ -161,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -188,6 +215,7 @@ const ( PPPIOCSPASS = 0x80087447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffff PTRACE_GETFPREGS = 0xe @@ -266,6 +294,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -280,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 @@ -288,6 +318,7 @@ const ( SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 @@ -481,6 +512,9 @@ const ( WORDSIZE = 0x20 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 0be6c4ccc0..f7b7cec910 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && linux // +build mips64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x2000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x18 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x100 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -124,6 +145,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 @@ -161,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -188,6 +215,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_GETFPREGS = 0xe @@ -266,6 +294,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -280,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 @@ -288,6 +318,7 @@ const ( SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 @@ -481,6 +512,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 0880b745c1..4fcacf9584 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64le && linux // +build mips64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x2000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x18 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x100 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -124,6 +145,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 @@ -161,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -188,6 +215,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_GETFPREGS = 0xe @@ -266,6 +294,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -280,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 @@ -288,6 +318,7 @@ const ( SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 @@ -481,6 +512,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index c8a66627aa..6f6c223a2c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mipsle && linux // +build mipsle,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x2000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40046601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x18 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x100 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x20 NLDLY = 0x100 NOFLSH = 0x80 @@ -124,6 +145,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x1000 O_CLOEXEC = 0x80000 @@ -161,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -188,6 +215,7 @@ const ( PPPIOCSPASS = 0x80087447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffff PTRACE_GETFPREGS = 0xe @@ -266,6 +294,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -280,6 +309,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 @@ -288,6 +318,7 @@ const ( SO_PEERCRED = 0x12 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x21 @@ -481,6 +512,9 @@ const ( WORDSIZE = 0x20 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go new file mode 100644 index 0000000000..59e522bcf4 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -0,0 +1,881 @@ +// mkerrors.sh -Wall -Werror -static -I/tmp/include +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc && linux +// +build ppc,linux + +// Code generated by cmd/cgo -godefs; DO NOT EDIT. +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go + +package unix + +import "syscall" + +const ( + B1000000 = 0x17 + B115200 = 0x11 + B1152000 = 0x18 + B1500000 = 0x19 + B2000000 = 0x1a + B230400 = 0x12 + B2500000 = 0x1b + B3000000 = 0x1c + B3500000 = 0x1d + B4000000 = 0x1e + B460800 = 0x13 + B500000 = 0x14 + B57600 = 0x10 + B576000 = 0x15 + B921600 = 0x16 + BLKBSZGET = 0x40041270 + BLKBSZSET = 0x80041271 + BLKFLSBUF = 0x20001261 + BLKFRAGET = 0x20001265 + BLKFRASET = 0x20001264 + BLKGETSIZE = 0x20001260 + BLKGETSIZE64 = 0x40041272 + BLKPBSZGET = 0x2000127b + BLKRAGET = 0x20001263 + BLKRASET = 0x20001262 + BLKROGET = 0x2000125e + BLKROSET = 0x2000125d + BLKRRPART = 0x2000125f + BLKSECTGET = 0x20001267 + BLKSECTSET = 0x20001266 + BLKSSZGET = 0x20001268 + BOTHER = 0x1f + BS1 = 0x8000 + BSDLY = 0x8000 + CBAUD = 0xff + CBAUDEX = 0x0 + CIBAUD = 0xff0000 + CLOCAL = 0x8000 + CR1 = 0x1000 + CR2 = 0x2000 + CR3 = 0x3000 + CRDLY = 0x3000 + CREAD = 0x800 + CS6 = 0x100 + CS7 = 0x200 + CS8 = 0x300 + CSIZE = 0x300 + CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 + EFD_CLOEXEC = 0x80000 + EFD_NONBLOCK = 0x800 + EPOLL_CLOEXEC = 0x80000 + EXTPROC = 0x10000000 + FF1 = 0x4000 + FFDLY = 0x4000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d + FLUSHO = 0x800000 + FS_IOC_ENABLE_VERITY = 0x80806685 + FS_IOC_GETFLAGS = 0x40046601 + FS_IOC_GET_ENCRYPTION_NONCE = 0x4010661b + FS_IOC_GET_ENCRYPTION_POLICY = 0x800c6615 + FS_IOC_GET_ENCRYPTION_PWSALT = 0x80106614 + FS_IOC_SETFLAGS = 0x80046602 + FS_IOC_SET_ENCRYPTION_POLICY = 0x400c6613 + F_GETLK = 0xc + F_GETLK64 = 0xc + F_GETOWN = 0x9 + F_RDLCK = 0x0 + F_SETLK = 0xd + F_SETLK64 = 0xd + F_SETLKW = 0xe + F_SETLKW64 = 0xe + F_SETOWN = 0x8 + F_UNLCK = 0x2 + F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 + HUPCL = 0x4000 + ICANON = 0x100 + IEXTEN = 0x400 + IN_CLOEXEC = 0x80000 + IN_NONBLOCK = 0x800 + IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x200007b9 + ISIG = 0x80 + IUCLC = 0x1000 + IXOFF = 0x400 + IXON = 0x200 + MAP_ANON = 0x20 + MAP_ANONYMOUS = 0x20 + MAP_DENYWRITE = 0x800 + MAP_EXECUTABLE = 0x1000 + MAP_GROWSDOWN = 0x100 + MAP_HUGETLB = 0x40000 + MAP_LOCKED = 0x80 + MAP_NONBLOCK = 0x10000 + MAP_NORESERVE = 0x40 + MAP_POPULATE = 0x8000 + MAP_STACK = 0x20000 + MAP_SYNC = 0x80000 + MCL_CURRENT = 0x2000 + MCL_FUTURE = 0x4000 + MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc00c4d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc00c4d03 + MTDFILEMODE = 0x20004d13 + NFDBITS = 0x20 + NL2 = 0x200 + NL3 = 0x300 + NLDLY = 0x300 + NOFLSH = 0x80000000 + NS_GET_NSTYPE = 0x2000b703 + NS_GET_OWNER_UID = 0x2000b704 + NS_GET_PARENT = 0x2000b702 + NS_GET_USERNS = 0x2000b701 + OLCUC = 0x4 + ONLCR = 0x2 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d + O_APPEND = 0x400 + O_ASYNC = 0x2000 + O_CLOEXEC = 0x80000 + O_CREAT = 0x40 + O_DIRECT = 0x20000 + O_DIRECTORY = 0x4000 + O_DSYNC = 0x1000 + O_EXCL = 0x80 + O_FSYNC = 0x101000 + O_LARGEFILE = 0x10000 + O_NDELAY = 0x800 + O_NOATIME = 0x40000 + O_NOCTTY = 0x100 + O_NOFOLLOW = 0x8000 + O_NONBLOCK = 0x800 + O_PATH = 0x200000 + O_RSYNC = 0x101000 + O_SYNC = 0x101000 + O_TMPFILE = 0x404000 + O_TRUNC = 0x200 + PARENB = 0x1000 + PARODD = 0x2000 + PENDIN = 0x20000000 + PERF_EVENT_IOC_DISABLE = 0x20002401 + PERF_EVENT_IOC_ENABLE = 0x20002400 + PERF_EVENT_IOC_ID = 0x40042407 + PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x8004240b + PERF_EVENT_IOC_PAUSE_OUTPUT = 0x80042409 + PERF_EVENT_IOC_PERIOD = 0x80082404 + PERF_EVENT_IOC_QUERY_BPF = 0xc004240a + PERF_EVENT_IOC_REFRESH = 0x20002402 + PERF_EVENT_IOC_RESET = 0x20002403 + PERF_EVENT_IOC_SET_BPF = 0x80042408 + PERF_EVENT_IOC_SET_FILTER = 0x80042406 + PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 + PPPIOCATTACH = 0x8004743d + PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 + PPPIOCCONNECT = 0x8004743a + PPPIOCDETACH = 0x8004743c + PPPIOCDISCONN = 0x20007439 + PPPIOCGASYNCMAP = 0x40047458 + PPPIOCGCHAN = 0x40047437 + PPPIOCGDEBUG = 0x40047441 + PPPIOCGFLAGS = 0x4004745a + PPPIOCGIDLE = 0x4008743f + PPPIOCGIDLE32 = 0x4008743f + PPPIOCGIDLE64 = 0x4010743f + PPPIOCGL2TPSTATS = 0x40487436 + PPPIOCGMRU = 0x40047453 + PPPIOCGRASYNCMAP = 0x40047455 + PPPIOCGUNIT = 0x40047456 + PPPIOCGXASYNCMAP = 0x40207450 + PPPIOCSACTIVE = 0x80087446 + PPPIOCSASYNCMAP = 0x80047457 + PPPIOCSCOMPRESS = 0x800c744d + PPPIOCSDEBUG = 0x80047440 + PPPIOCSFLAGS = 0x80047459 + PPPIOCSMAXCID = 0x80047451 + PPPIOCSMRRU = 0x8004743b + PPPIOCSMRU = 0x80047452 + PPPIOCSNPMODE = 0x8008744b + PPPIOCSPASS = 0x80087447 + PPPIOCSRASYNCMAP = 0x80047454 + PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 + PPPIOCXFERUNIT = 0x2000744e + PROT_SAO = 0x10 + PR_SET_PTRACER_ANY = 0xffffffff + PTRACE_GETEVRREGS = 0x14 + PTRACE_GETFPREGS = 0xe + PTRACE_GETREGS64 = 0x16 + PTRACE_GETVRREGS = 0x12 + PTRACE_GETVSRREGS = 0x1b + PTRACE_GET_DEBUGREG = 0x19 + PTRACE_SETEVRREGS = 0x15 + PTRACE_SETFPREGS = 0xf + PTRACE_SETREGS64 = 0x17 + PTRACE_SETVRREGS = 0x13 + PTRACE_SETVSRREGS = 0x1c + PTRACE_SET_DEBUGREG = 0x1a + PTRACE_SINGLEBLOCK = 0x100 + PTRACE_SYSEMU = 0x1d + PTRACE_SYSEMU_SINGLESTEP = 0x1e + PT_CCR = 0x26 + PT_CTR = 0x23 + PT_DAR = 0x29 + PT_DSCR = 0x2c + PT_DSISR = 0x2a + PT_FPR0 = 0x30 + PT_FPR31 = 0x6e + PT_FPSCR = 0x71 + PT_LNK = 0x24 + PT_MQ = 0x27 + PT_MSR = 0x21 + PT_NIP = 0x20 + PT_ORIG_R3 = 0x22 + PT_R0 = 0x0 + PT_R1 = 0x1 + PT_R10 = 0xa + PT_R11 = 0xb + PT_R12 = 0xc + PT_R13 = 0xd + PT_R14 = 0xe + PT_R15 = 0xf + PT_R16 = 0x10 + PT_R17 = 0x11 + PT_R18 = 0x12 + PT_R19 = 0x13 + PT_R2 = 0x2 + PT_R20 = 0x14 + PT_R21 = 0x15 + PT_R22 = 0x16 + PT_R23 = 0x17 + PT_R24 = 0x18 + PT_R25 = 0x19 + PT_R26 = 0x1a + PT_R27 = 0x1b + PT_R28 = 0x1c + PT_R29 = 0x1d + PT_R3 = 0x3 + PT_R30 = 0x1e + PT_R31 = 0x1f + PT_R4 = 0x4 + PT_R5 = 0x5 + PT_R6 = 0x6 + PT_R7 = 0x7 + PT_R8 = 0x8 + PT_R9 = 0x9 + PT_REGS_COUNT = 0x2c + PT_RESULT = 0x2b + PT_TRAP = 0x28 + PT_XER = 0x25 + RLIMIT_AS = 0x9 + RLIMIT_MEMLOCK = 0x8 + RLIMIT_NOFILE = 0x7 + RLIMIT_NPROC = 0x6 + RLIMIT_RSS = 0x5 + RNDADDENTROPY = 0x80085203 + RNDADDTOENTCNT = 0x80045201 + RNDCLEARPOOL = 0x20005206 + RNDGETENTCNT = 0x40045200 + RNDGETPOOL = 0x40085202 + RNDRESEEDCRNG = 0x20005207 + RNDZAPENTCNT = 0x20005204 + RTC_AIE_OFF = 0x20007002 + RTC_AIE_ON = 0x20007001 + RTC_ALM_READ = 0x40247008 + RTC_ALM_SET = 0x80247007 + RTC_EPOCH_READ = 0x4004700d + RTC_EPOCH_SET = 0x8004700e + RTC_IRQP_READ = 0x4004700b + RTC_IRQP_SET = 0x8004700c + RTC_PIE_OFF = 0x20007006 + RTC_PIE_ON = 0x20007005 + RTC_PLL_GET = 0x401c7011 + RTC_PLL_SET = 0x801c7012 + RTC_RD_TIME = 0x40247009 + RTC_SET_TIME = 0x8024700a + RTC_UIE_OFF = 0x20007004 + RTC_UIE_ON = 0x20007003 + RTC_VL_CLR = 0x20007014 + RTC_VL_READ = 0x40047013 + RTC_WIE_OFF = 0x20007010 + RTC_WIE_ON = 0x2000700f + RTC_WKALM_RD = 0x40287010 + RTC_WKALM_SET = 0x8028700f + SCM_TIMESTAMPING = 0x25 + SCM_TIMESTAMPING_OPT_STATS = 0x36 + SCM_TIMESTAMPING_PKTINFO = 0x3a + SCM_TIMESTAMPNS = 0x23 + SCM_TXTIME = 0x3d + SCM_WIFI_STATUS = 0x29 + SFD_CLOEXEC = 0x80000 + SFD_NONBLOCK = 0x800 + SIOCATMARK = 0x8905 + SIOCGPGRP = 0x8904 + SIOCGSTAMPNS_NEW = 0x40108907 + SIOCGSTAMP_NEW = 0x40108906 + SIOCINQ = 0x4004667f + SIOCOUTQ = 0x40047473 + SIOCSPGRP = 0x8902 + SOCK_CLOEXEC = 0x80000 + SOCK_DGRAM = 0x2 + SOCK_NONBLOCK = 0x800 + SOCK_STREAM = 0x1 + SOL_SOCKET = 0x1 + SO_ACCEPTCONN = 0x1e + SO_ATTACH_BPF = 0x32 + SO_ATTACH_REUSEPORT_CBPF = 0x33 + SO_ATTACH_REUSEPORT_EBPF = 0x34 + SO_BINDTODEVICE = 0x19 + SO_BINDTOIFINDEX = 0x3e + SO_BPF_EXTENSIONS = 0x30 + SO_BROADCAST = 0x6 + SO_BSDCOMPAT = 0xe + SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 + SO_CNX_ADVICE = 0x35 + SO_COOKIE = 0x39 + SO_DETACH_REUSEPORT_BPF = 0x44 + SO_DOMAIN = 0x27 + SO_DONTROUTE = 0x5 + SO_ERROR = 0x4 + SO_INCOMING_CPU = 0x31 + SO_INCOMING_NAPI_ID = 0x38 + SO_KEEPALIVE = 0x9 + SO_LINGER = 0xd + SO_LOCK_FILTER = 0x2c + SO_MARK = 0x24 + SO_MAX_PACING_RATE = 0x2f + SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 + SO_NOFCS = 0x2b + SO_OOBINLINE = 0xa + SO_PASSCRED = 0x14 + SO_PASSSEC = 0x22 + SO_PEEK_OFF = 0x2a + SO_PEERCRED = 0x15 + SO_PEERGROUPS = 0x3b + SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 + SO_PROTOCOL = 0x26 + SO_RCVBUF = 0x8 + SO_RCVBUFFORCE = 0x21 + SO_RCVLOWAT = 0x10 + SO_RCVTIMEO = 0x12 + SO_RCVTIMEO_NEW = 0x42 + SO_RCVTIMEO_OLD = 0x12 + SO_REUSEADDR = 0x2 + SO_REUSEPORT = 0xf + SO_RXQ_OVFL = 0x28 + SO_SECURITY_AUTHENTICATION = 0x16 + SO_SECURITY_ENCRYPTION_NETWORK = 0x18 + SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17 + SO_SELECT_ERR_QUEUE = 0x2d + SO_SNDBUF = 0x7 + SO_SNDBUFFORCE = 0x20 + SO_SNDLOWAT = 0x11 + SO_SNDTIMEO = 0x13 + SO_SNDTIMEO_NEW = 0x43 + SO_SNDTIMEO_OLD = 0x13 + SO_TIMESTAMPING = 0x25 + SO_TIMESTAMPING_NEW = 0x41 + SO_TIMESTAMPING_OLD = 0x25 + SO_TIMESTAMPNS = 0x23 + SO_TIMESTAMPNS_NEW = 0x40 + SO_TIMESTAMPNS_OLD = 0x23 + SO_TIMESTAMP_NEW = 0x3f + SO_TXTIME = 0x3d + SO_TYPE = 0x3 + SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c + TAB1 = 0x400 + TAB2 = 0x800 + TAB3 = 0xc00 + TABDLY = 0xc00 + TCFLSH = 0x2000741f + TCGETA = 0x40147417 + TCGETS = 0x402c7413 + TCSAFLUSH = 0x2 + TCSBRK = 0x2000741d + TCSBRKP = 0x5425 + TCSETA = 0x80147418 + TCSETAF = 0x8014741c + TCSETAW = 0x80147419 + TCSETS = 0x802c7414 + TCSETSF = 0x802c7416 + TCSETSW = 0x802c7415 + TCXONC = 0x2000741e + TFD_CLOEXEC = 0x80000 + TFD_NONBLOCK = 0x800 + TIOCCBRK = 0x5428 + TIOCCONS = 0x541d + TIOCEXCL = 0x540c + TIOCGDEV = 0x40045432 + TIOCGETC = 0x40067412 + TIOCGETD = 0x5424 + TIOCGETP = 0x40067408 + TIOCGEXCL = 0x40045440 + TIOCGICOUNT = 0x545d + TIOCGISO7816 = 0x40285442 + TIOCGLCKTRMIOS = 0x5456 + TIOCGLTC = 0x40067474 + TIOCGPGRP = 0x40047477 + TIOCGPKT = 0x40045438 + TIOCGPTLCK = 0x40045439 + TIOCGPTN = 0x40045430 + TIOCGPTPEER = 0x20005441 + TIOCGRS485 = 0x542e + TIOCGSERIAL = 0x541e + TIOCGSID = 0x5429 + TIOCGSOFTCAR = 0x5419 + TIOCGWINSZ = 0x40087468 + TIOCINQ = 0x4004667f + TIOCLINUX = 0x541c + TIOCMBIC = 0x5417 + TIOCMBIS = 0x5416 + TIOCMGET = 0x5415 + TIOCMIWAIT = 0x545c + TIOCMSET = 0x5418 + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_LOOP = 0x8000 + TIOCM_OUT1 = 0x2000 + TIOCM_OUT2 = 0x4000 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x5422 + TIOCNXCL = 0x540d + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x5420 + TIOCSBRK = 0x5427 + TIOCSCTTY = 0x540e + TIOCSERCONFIG = 0x5453 + TIOCSERGETLSR = 0x5459 + TIOCSERGETMULTI = 0x545a + TIOCSERGSTRUCT = 0x5458 + TIOCSERGWILD = 0x5454 + TIOCSERSETMULTI = 0x545b + TIOCSERSWILD = 0x5455 + TIOCSER_TEMT = 0x1 + TIOCSETC = 0x80067411 + TIOCSETD = 0x5423 + TIOCSETN = 0x8006740a + TIOCSETP = 0x80067409 + TIOCSIG = 0x80045436 + TIOCSISO7816 = 0xc0285443 + TIOCSLCKTRMIOS = 0x5457 + TIOCSLTC = 0x80067475 + TIOCSPGRP = 0x80047476 + TIOCSPTLCK = 0x80045431 + TIOCSRS485 = 0x542f + TIOCSSERIAL = 0x541f + TIOCSSOFTCAR = 0x541a + TIOCSTART = 0x2000746e + TIOCSTI = 0x5412 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCVHANGUP = 0x5437 + TOSTOP = 0x400000 + TUNATTACHFILTER = 0x800854d5 + TUNDETACHFILTER = 0x800854d6 + TUNGETDEVNETNS = 0x200054e3 + TUNGETFEATURES = 0x400454cf + TUNGETFILTER = 0x400854db + TUNGETIFF = 0x400454d2 + TUNGETSNDBUF = 0x400454d3 + TUNGETVNETBE = 0x400454df + TUNGETVNETHDRSZ = 0x400454d7 + TUNGETVNETLE = 0x400454dd + TUNSETCARRIER = 0x800454e2 + TUNSETDEBUG = 0x800454c9 + TUNSETFILTEREBPF = 0x400454e1 + TUNSETGROUP = 0x800454ce + TUNSETIFF = 0x800454ca + TUNSETIFINDEX = 0x800454da + TUNSETLINK = 0x800454cd + TUNSETNOCSUM = 0x800454c8 + TUNSETOFFLOAD = 0x800454d0 + TUNSETOWNER = 0x800454cc + TUNSETPERSIST = 0x800454cb + TUNSETQUEUE = 0x800454d9 + TUNSETSNDBUF = 0x800454d4 + TUNSETSTEERINGEBPF = 0x400454e0 + TUNSETTXFILTER = 0x800454d1 + TUNSETVNETBE = 0x800454de + TUNSETVNETHDRSZ = 0x800454d8 + TUNSETVNETLE = 0x800454dc + UBI_IOCATT = 0x80186f40 + UBI_IOCDET = 0x80046f41 + UBI_IOCEBCH = 0x80044f02 + UBI_IOCEBER = 0x80044f01 + UBI_IOCEBISMAP = 0x40044f05 + UBI_IOCEBMAP = 0x80084f03 + UBI_IOCEBUNMAP = 0x80044f04 + UBI_IOCMKVOL = 0x80986f00 + UBI_IOCRMVOL = 0x80046f01 + UBI_IOCRNVOL = 0x91106f03 + UBI_IOCRPEB = 0x80046f04 + UBI_IOCRSVOL = 0x800c6f02 + UBI_IOCSETVOLPROP = 0x80104f06 + UBI_IOCSPEB = 0x80046f05 + UBI_IOCVOLCRBLK = 0x80804f07 + UBI_IOCVOLRMBLK = 0x20004f08 + UBI_IOCVOLUP = 0x80084f00 + VDISCARD = 0x10 + VEOF = 0x4 + VEOL = 0x6 + VEOL2 = 0x8 + VMIN = 0x5 + VREPRINT = 0xb + VSTART = 0xd + VSTOP = 0xe + VSUSP = 0xc + VSWTC = 0x9 + VT1 = 0x10000 + VTDLY = 0x10000 + VTIME = 0x7 + VWERASE = 0xa + WDIOC_GETBOOTSTATUS = 0x40045702 + WDIOC_GETPRETIMEOUT = 0x40045709 + WDIOC_GETSTATUS = 0x40045701 + WDIOC_GETSUPPORT = 0x40285700 + WDIOC_GETTEMP = 0x40045703 + WDIOC_GETTIMELEFT = 0x4004570a + WDIOC_GETTIMEOUT = 0x40045707 + WDIOC_KEEPALIVE = 0x40045705 + WDIOC_SETOPTIONS = 0x40045704 + WORDSIZE = 0x20 + XCASE = 0x4000 + XTABS = 0xc00 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 +) + +// Errors +const ( + EADDRINUSE = syscall.Errno(0x62) + EADDRNOTAVAIL = syscall.Errno(0x63) + EADV = syscall.Errno(0x44) + EAFNOSUPPORT = syscall.Errno(0x61) + EALREADY = syscall.Errno(0x72) + EBADE = syscall.Errno(0x34) + EBADFD = syscall.Errno(0x4d) + EBADMSG = syscall.Errno(0x4a) + EBADR = syscall.Errno(0x35) + EBADRQC = syscall.Errno(0x38) + EBADSLT = syscall.Errno(0x39) + EBFONT = syscall.Errno(0x3b) + ECANCELED = syscall.Errno(0x7d) + ECHRNG = syscall.Errno(0x2c) + ECOMM = syscall.Errno(0x46) + ECONNABORTED = syscall.Errno(0x67) + ECONNREFUSED = syscall.Errno(0x6f) + ECONNRESET = syscall.Errno(0x68) + EDEADLK = syscall.Errno(0x23) + EDEADLOCK = syscall.Errno(0x3a) + EDESTADDRREQ = syscall.Errno(0x59) + EDOTDOT = syscall.Errno(0x49) + EDQUOT = syscall.Errno(0x7a) + EHOSTDOWN = syscall.Errno(0x70) + EHOSTUNREACH = syscall.Errno(0x71) + EHWPOISON = syscall.Errno(0x85) + EIDRM = syscall.Errno(0x2b) + EILSEQ = syscall.Errno(0x54) + EINPROGRESS = syscall.Errno(0x73) + EISCONN = syscall.Errno(0x6a) + EISNAM = syscall.Errno(0x78) + EKEYEXPIRED = syscall.Errno(0x7f) + EKEYREJECTED = syscall.Errno(0x81) + EKEYREVOKED = syscall.Errno(0x80) + EL2HLT = syscall.Errno(0x33) + EL2NSYNC = syscall.Errno(0x2d) + EL3HLT = syscall.Errno(0x2e) + EL3RST = syscall.Errno(0x2f) + ELIBACC = syscall.Errno(0x4f) + ELIBBAD = syscall.Errno(0x50) + ELIBEXEC = syscall.Errno(0x53) + ELIBMAX = syscall.Errno(0x52) + ELIBSCN = syscall.Errno(0x51) + ELNRNG = syscall.Errno(0x30) + ELOOP = syscall.Errno(0x28) + EMEDIUMTYPE = syscall.Errno(0x7c) + EMSGSIZE = syscall.Errno(0x5a) + EMULTIHOP = syscall.Errno(0x48) + ENAMETOOLONG = syscall.Errno(0x24) + ENAVAIL = syscall.Errno(0x77) + ENETDOWN = syscall.Errno(0x64) + ENETRESET = syscall.Errno(0x66) + ENETUNREACH = syscall.Errno(0x65) + ENOANO = syscall.Errno(0x37) + ENOBUFS = syscall.Errno(0x69) + ENOCSI = syscall.Errno(0x32) + ENODATA = syscall.Errno(0x3d) + ENOKEY = syscall.Errno(0x7e) + ENOLCK = syscall.Errno(0x25) + ENOLINK = syscall.Errno(0x43) + ENOMEDIUM = syscall.Errno(0x7b) + ENOMSG = syscall.Errno(0x2a) + ENONET = syscall.Errno(0x40) + ENOPKG = syscall.Errno(0x41) + ENOPROTOOPT = syscall.Errno(0x5c) + ENOSR = syscall.Errno(0x3f) + ENOSTR = syscall.Errno(0x3c) + ENOSYS = syscall.Errno(0x26) + ENOTCONN = syscall.Errno(0x6b) + ENOTEMPTY = syscall.Errno(0x27) + ENOTNAM = syscall.Errno(0x76) + ENOTRECOVERABLE = syscall.Errno(0x83) + ENOTSOCK = syscall.Errno(0x58) + ENOTSUP = syscall.Errno(0x5f) + ENOTUNIQ = syscall.Errno(0x4c) + EOPNOTSUPP = syscall.Errno(0x5f) + EOVERFLOW = syscall.Errno(0x4b) + EOWNERDEAD = syscall.Errno(0x82) + EPFNOSUPPORT = syscall.Errno(0x60) + EPROTO = syscall.Errno(0x47) + EPROTONOSUPPORT = syscall.Errno(0x5d) + EPROTOTYPE = syscall.Errno(0x5b) + EREMCHG = syscall.Errno(0x4e) + EREMOTE = syscall.Errno(0x42) + EREMOTEIO = syscall.Errno(0x79) + ERESTART = syscall.Errno(0x55) + ERFKILL = syscall.Errno(0x84) + ESHUTDOWN = syscall.Errno(0x6c) + ESOCKTNOSUPPORT = syscall.Errno(0x5e) + ESRMNT = syscall.Errno(0x45) + ESTALE = syscall.Errno(0x74) + ESTRPIPE = syscall.Errno(0x56) + ETIME = syscall.Errno(0x3e) + ETIMEDOUT = syscall.Errno(0x6e) + ETOOMANYREFS = syscall.Errno(0x6d) + EUCLEAN = syscall.Errno(0x75) + EUNATCH = syscall.Errno(0x31) + EUSERS = syscall.Errno(0x57) + EXFULL = syscall.Errno(0x36) +) + +// Signals +const ( + SIGBUS = syscall.Signal(0x7) + SIGCHLD = syscall.Signal(0x11) + SIGCLD = syscall.Signal(0x11) + SIGCONT = syscall.Signal(0x12) + SIGIO = syscall.Signal(0x1d) + SIGPOLL = syscall.Signal(0x1d) + SIGPROF = syscall.Signal(0x1b) + SIGPWR = syscall.Signal(0x1e) + SIGSTKFLT = syscall.Signal(0x10) + SIGSTOP = syscall.Signal(0x13) + SIGSYS = syscall.Signal(0x1f) + SIGTSTP = syscall.Signal(0x14) + SIGTTIN = syscall.Signal(0x15) + SIGTTOU = syscall.Signal(0x16) + SIGURG = syscall.Signal(0x17) + SIGUSR1 = syscall.Signal(0xa) + SIGUSR2 = syscall.Signal(0xc) + SIGVTALRM = syscall.Signal(0x1a) + SIGWINCH = syscall.Signal(0x1c) + SIGXCPU = syscall.Signal(0x18) + SIGXFSZ = syscall.Signal(0x19) +) + +// Error table +var errorList = [...]struct { + num syscall.Errno + name string + desc string +}{ + {1, "EPERM", "operation not permitted"}, + {2, "ENOENT", "no such file or directory"}, + {3, "ESRCH", "no such process"}, + {4, "EINTR", "interrupted system call"}, + {5, "EIO", "input/output error"}, + {6, "ENXIO", "no such device or address"}, + {7, "E2BIG", "argument list too long"}, + {8, "ENOEXEC", "exec format error"}, + {9, "EBADF", "bad file descriptor"}, + {10, "ECHILD", "no child processes"}, + {11, "EAGAIN", "resource temporarily unavailable"}, + {12, "ENOMEM", "cannot allocate memory"}, + {13, "EACCES", "permission denied"}, + {14, "EFAULT", "bad address"}, + {15, "ENOTBLK", "block device required"}, + {16, "EBUSY", "device or resource busy"}, + {17, "EEXIST", "file exists"}, + {18, "EXDEV", "invalid cross-device link"}, + {19, "ENODEV", "no such device"}, + {20, "ENOTDIR", "not a directory"}, + {21, "EISDIR", "is a directory"}, + {22, "EINVAL", "invalid argument"}, + {23, "ENFILE", "too many open files in system"}, + {24, "EMFILE", "too many open files"}, + {25, "ENOTTY", "inappropriate ioctl for device"}, + {26, "ETXTBSY", "text file busy"}, + {27, "EFBIG", "file too large"}, + {28, "ENOSPC", "no space left on device"}, + {29, "ESPIPE", "illegal seek"}, + {30, "EROFS", "read-only file system"}, + {31, "EMLINK", "too many links"}, + {32, "EPIPE", "broken pipe"}, + {33, "EDOM", "numerical argument out of domain"}, + {34, "ERANGE", "numerical result out of range"}, + {35, "EDEADLK", "resource deadlock avoided"}, + {36, "ENAMETOOLONG", "file name too long"}, + {37, "ENOLCK", "no locks available"}, + {38, "ENOSYS", "function not implemented"}, + {39, "ENOTEMPTY", "directory not empty"}, + {40, "ELOOP", "too many levels of symbolic links"}, + {42, "ENOMSG", "no message of desired type"}, + {43, "EIDRM", "identifier removed"}, + {44, "ECHRNG", "channel number out of range"}, + {45, "EL2NSYNC", "level 2 not synchronized"}, + {46, "EL3HLT", "level 3 halted"}, + {47, "EL3RST", "level 3 reset"}, + {48, "ELNRNG", "link number out of range"}, + {49, "EUNATCH", "protocol driver not attached"}, + {50, "ENOCSI", "no CSI structure available"}, + {51, "EL2HLT", "level 2 halted"}, + {52, "EBADE", "invalid exchange"}, + {53, "EBADR", "invalid request descriptor"}, + {54, "EXFULL", "exchange full"}, + {55, "ENOANO", "no anode"}, + {56, "EBADRQC", "invalid request code"}, + {57, "EBADSLT", "invalid slot"}, + {58, "EDEADLOCK", "file locking deadlock error"}, + {59, "EBFONT", "bad font file format"}, + {60, "ENOSTR", "device not a stream"}, + {61, "ENODATA", "no data available"}, + {62, "ETIME", "timer expired"}, + {63, "ENOSR", "out of streams resources"}, + {64, "ENONET", "machine is not on the network"}, + {65, "ENOPKG", "package not installed"}, + {66, "EREMOTE", "object is remote"}, + {67, "ENOLINK", "link has been severed"}, + {68, "EADV", "advertise error"}, + {69, "ESRMNT", "srmount error"}, + {70, "ECOMM", "communication error on send"}, + {71, "EPROTO", "protocol error"}, + {72, "EMULTIHOP", "multihop attempted"}, + {73, "EDOTDOT", "RFS specific error"}, + {74, "EBADMSG", "bad message"}, + {75, "EOVERFLOW", "value too large for defined data type"}, + {76, "ENOTUNIQ", "name not unique on network"}, + {77, "EBADFD", "file descriptor in bad state"}, + {78, "EREMCHG", "remote address changed"}, + {79, "ELIBACC", "can not access a needed shared library"}, + {80, "ELIBBAD", "accessing a corrupted shared library"}, + {81, "ELIBSCN", ".lib section in a.out corrupted"}, + {82, "ELIBMAX", "attempting to link in too many shared libraries"}, + {83, "ELIBEXEC", "cannot exec a shared library directly"}, + {84, "EILSEQ", "invalid or incomplete multibyte or wide character"}, + {85, "ERESTART", "interrupted system call should be restarted"}, + {86, "ESTRPIPE", "streams pipe error"}, + {87, "EUSERS", "too many users"}, + {88, "ENOTSOCK", "socket operation on non-socket"}, + {89, "EDESTADDRREQ", "destination address required"}, + {90, "EMSGSIZE", "message too long"}, + {91, "EPROTOTYPE", "protocol wrong type for socket"}, + {92, "ENOPROTOOPT", "protocol not available"}, + {93, "EPROTONOSUPPORT", "protocol not supported"}, + {94, "ESOCKTNOSUPPORT", "socket type not supported"}, + {95, "ENOTSUP", "operation not supported"}, + {96, "EPFNOSUPPORT", "protocol family not supported"}, + {97, "EAFNOSUPPORT", "address family not supported by protocol"}, + {98, "EADDRINUSE", "address already in use"}, + {99, "EADDRNOTAVAIL", "cannot assign requested address"}, + {100, "ENETDOWN", "network is down"}, + {101, "ENETUNREACH", "network is unreachable"}, + {102, "ENETRESET", "network dropped connection on reset"}, + {103, "ECONNABORTED", "software caused connection abort"}, + {104, "ECONNRESET", "connection reset by peer"}, + {105, "ENOBUFS", "no buffer space available"}, + {106, "EISCONN", "transport endpoint is already connected"}, + {107, "ENOTCONN", "transport endpoint is not connected"}, + {108, "ESHUTDOWN", "cannot send after transport endpoint shutdown"}, + {109, "ETOOMANYREFS", "too many references: cannot splice"}, + {110, "ETIMEDOUT", "connection timed out"}, + {111, "ECONNREFUSED", "connection refused"}, + {112, "EHOSTDOWN", "host is down"}, + {113, "EHOSTUNREACH", "no route to host"}, + {114, "EALREADY", "operation already in progress"}, + {115, "EINPROGRESS", "operation now in progress"}, + {116, "ESTALE", "stale file handle"}, + {117, "EUCLEAN", "structure needs cleaning"}, + {118, "ENOTNAM", "not a XENIX named type file"}, + {119, "ENAVAIL", "no XENIX semaphores available"}, + {120, "EISNAM", "is a named type file"}, + {121, "EREMOTEIO", "remote I/O error"}, + {122, "EDQUOT", "disk quota exceeded"}, + {123, "ENOMEDIUM", "no medium found"}, + {124, "EMEDIUMTYPE", "wrong medium type"}, + {125, "ECANCELED", "operation canceled"}, + {126, "ENOKEY", "required key not available"}, + {127, "EKEYEXPIRED", "key has expired"}, + {128, "EKEYREVOKED", "key has been revoked"}, + {129, "EKEYREJECTED", "key was rejected by service"}, + {130, "EOWNERDEAD", "owner died"}, + {131, "ENOTRECOVERABLE", "state not recoverable"}, + {132, "ERFKILL", "operation not possible due to RF-kill"}, + {133, "EHWPOISON", "memory page has hardware error"}, +} + +// Signal table +var signalList = [...]struct { + num syscall.Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGQUIT", "quit"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGTRAP", "trace/breakpoint trap"}, + {6, "SIGABRT", "aborted"}, + {7, "SIGBUS", "bus error"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGUSR1", "user defined signal 1"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGUSR2", "user defined signal 2"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGSTKFLT", "stack fault"}, + {17, "SIGCHLD", "child exited"}, + {18, "SIGCONT", "continued"}, + {19, "SIGSTOP", "stopped (signal)"}, + {20, "SIGTSTP", "stopped"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGURG", "urgent I/O condition"}, + {24, "SIGXCPU", "CPU time limit exceeded"}, + {25, "SIGXFSZ", "file size limit exceeded"}, + {26, "SIGVTALRM", "virtual timer expired"}, + {27, "SIGPROF", "profiling timer expired"}, + {28, "SIGWINCH", "window changed"}, + {29, "SIGIO", "I/O possible"}, + {30, "SIGPWR", "power failure"}, + {31, "SIGSYS", "bad system call"}, +} diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 97aae63f16..d4264a0f73 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && linux // +build ppc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000000 FF1 = 0x4000 FFDLY = 0x4000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x800000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x4000 ICANON = 0x100 IEXTEN = 0x400 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NL2 = 0x200 NL3 = 0x300 @@ -126,6 +147,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -163,6 +189,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -190,6 +217,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PROT_SAO = 0x10 PR_SET_PTRACER_ANY = 0xffffffffffffffff @@ -325,6 +353,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -339,6 +368,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 @@ -347,6 +377,7 @@ const ( SO_PEERCRED = 0x15 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -541,6 +572,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4000 XTABS = 0xc00 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index b0c3b0664f..21cbec1dd3 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64le && linux // +build ppc64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 ECHOE = 0x2 ECHOK = 0x4 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000000 FF1 = 0x4000 FFDLY = 0x4000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x800000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x4000 ICANON = 0x100 IEXTEN = 0x400 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NL2 = 0x200 NL3 = 0x300 @@ -126,6 +147,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x4 ONLCR = 0x2 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -163,6 +189,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -190,6 +217,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PROT_SAO = 0x10 PR_SET_PTRACER_ANY = 0xffffffffffffffff @@ -325,6 +353,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -339,6 +368,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 @@ -347,6 +377,7 @@ const ( SO_PEERCRED = 0x15 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -541,6 +572,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4000 XTABS = 0xc00 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 0c05181935..9b05bf12fc 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build riscv64 && linux // +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FS_IOC_ENABLE_VERITY = 0x40806685 FS_IOC_GETFLAGS = 0x80086601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -124,6 +145,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -161,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -188,6 +215,7 @@ const ( PPPIOCSPASS = 0x40107447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff RLIMIT_AS = 0x9 @@ -254,6 +282,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -268,6 +297,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -276,6 +306,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -466,6 +497,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 0b96bd462e..bd82ace09a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build s390x && linux // +build s390x,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go package unix @@ -59,6 +60,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x81484d11 + ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -71,6 +74,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x40049409 + FICLONERANGE = 0x4020940d FLUSHO = 0x1000 FS_IOC_ENABLE_VERITY = 0x40806685 FS_IOC_GETFLAGS = 0x80086601 @@ -90,6 +95,9 @@ const ( F_SETOWN = 0x8 F_UNLCK = 0x2 F_WRLCK = 0x1 + HIDIOCGRAWINFO = 0x80084803 + HIDIOCGRDESC = 0x90044802 + HIDIOCGRDESCSIZE = 0x80044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -115,6 +123,19 @@ const ( MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MCL_ONFAULT = 0x4 + MEMERASE = 0x40084d02 + MEMERASE64 = 0x40104d14 + MEMGETBADBLOCK = 0x40084d0b + MEMGETINFO = 0x80204d01 + MEMGETOOBSEL = 0x80c84d0a + MEMGETREGIONCOUNT = 0x80044d07 + MEMISLOCKED = 0x80084d17 + MEMLOCK = 0x40084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x40084d0c + MEMUNLOCK = 0x40084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x4d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -124,6 +145,11 @@ const ( NS_GET_USERNS = 0xb701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x400c4d19 + OTPGETREGIONCOUNT = 0x40044d0e + OTPGETREGIONINFO = 0x400c4d0f + OTPLOCK = 0x800c4d10 + OTPSELECT = 0x80044d0d O_APPEND = 0x400 O_ASYNC = 0x2000 O_CLOEXEC = 0x80000 @@ -161,6 +187,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x2405 PPPIOCATTACH = 0x4004743d PPPIOCATTCHAN = 0x40047438 + PPPIOCBRIDGECHAN = 0x40047435 PPPIOCCONNECT = 0x4004743a PPPIOCDETACH = 0x4004743c PPPIOCDISCONN = 0x7439 @@ -188,6 +215,7 @@ const ( PPPIOCSPASS = 0x40107447 PPPIOCSRASYNCMAP = 0x40047454 PPPIOCSXASYNCMAP = 0x4020744f + PPPIOCUNBRIDGECHAN = 0x7434 PPPIOCXFERUNIT = 0x744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_DISABLE_TE = 0x5010 @@ -204,6 +232,8 @@ const ( PTRACE_POKE_SYSTEM_CALL = 0x5008 PTRACE_PROT = 0x15 PTRACE_SINGLEBLOCK = 0xc + PTRACE_SYSEMU = 0x1f + PTRACE_SYSEMU_SINGLESTEP = 0x20 PTRACE_TE_ABORT_RAND = 0x5011 PT_ACR0 = 0x90 PT_ACR1 = 0x94 @@ -327,6 +357,7 @@ const ( SO_BROADCAST = 0x6 SO_BSDCOMPAT = 0xe SO_BUSY_POLL = 0x2e + SO_BUSY_POLL_BUDGET = 0x46 SO_CNX_ADVICE = 0x35 SO_COOKIE = 0x39 SO_DETACH_REUSEPORT_BPF = 0x44 @@ -341,6 +372,7 @@ const ( SO_MARK = 0x24 SO_MAX_PACING_RATE = 0x2f SO_MEMINFO = 0x37 + SO_NETNS_COOKIE = 0x47 SO_NOFCS = 0x2b SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 @@ -349,6 +381,7 @@ const ( SO_PEERCRED = 0x11 SO_PEERGROUPS = 0x3b SO_PEERSEC = 0x1f + SO_PREFER_BUSY_POLL = 0x45 SO_PROTOCOL = 0x26 SO_RCVBUF = 0x8 SO_RCVBUFFORCE = 0x21 @@ -539,6 +572,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x80804804 + _HIDIOCGRAWPHYS = 0x80404805 + _HIDIOCGRAWUNIQ = 0x80404808 ) // Errors diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index bd5c305779..1f8bded56b 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -1,10 +1,11 @@ // mkerrors.sh -Wall -Werror -static -I/tmp/include // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build sparc64 && linux // +build sparc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go package unix @@ -62,6 +63,8 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 + ECCGETLAYOUT = 0x41484d11 + ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 ECHOE = 0x10 ECHOK = 0x20 @@ -75,6 +78,8 @@ const ( EXTPROC = 0x10000 FF1 = 0x8000 FFDLY = 0x8000 + FICLONE = 0x80049409 + FICLONERANGE = 0x8020940d FLUSHO = 0x1000 FS_IOC_ENABLE_VERITY = 0x80806685 FS_IOC_GETFLAGS = 0x40086601 @@ -94,6 +99,9 @@ const ( F_SETOWN = 0x6 F_UNLCK = 0x3 F_WRLCK = 0x2 + HIDIOCGRAWINFO = 0x40084803 + HIDIOCGRDESC = 0x50044802 + HIDIOCGRDESCSIZE = 0x40044801 HUPCL = 0x400 ICANON = 0x2 IEXTEN = 0x8000 @@ -120,6 +128,19 @@ const ( MCL_CURRENT = 0x2000 MCL_FUTURE = 0x4000 MCL_ONFAULT = 0x8000 + MEMERASE = 0x80084d02 + MEMERASE64 = 0x80104d14 + MEMGETBADBLOCK = 0x80084d0b + MEMGETINFO = 0x40204d01 + MEMGETOOBSEL = 0x40c84d0a + MEMGETREGIONCOUNT = 0x40044d07 + MEMISLOCKED = 0x40084d17 + MEMLOCK = 0x80084d05 + MEMREADOOB = 0xc0104d04 + MEMSETBADBLOCK = 0x80084d0c + MEMUNLOCK = 0x80084d06 + MEMWRITEOOB = 0xc0104d03 + MTDFILEMODE = 0x20004d13 NFDBITS = 0x40 NLDLY = 0x100 NOFLSH = 0x80 @@ -129,6 +150,11 @@ const ( NS_GET_USERNS = 0x2000b701 OLCUC = 0x2 ONLCR = 0x4 + OTPERASE = 0x800c4d19 + OTPGETREGIONCOUNT = 0x80044d0e + OTPGETREGIONINFO = 0x800c4d0f + OTPLOCK = 0x400c4d10 + OTPSELECT = 0x40044d0d O_APPEND = 0x8 O_ASYNC = 0x40 O_CLOEXEC = 0x400000 @@ -166,6 +192,7 @@ const ( PERF_EVENT_IOC_SET_OUTPUT = 0x20002405 PPPIOCATTACH = 0x8004743d PPPIOCATTCHAN = 0x80047438 + PPPIOCBRIDGECHAN = 0x80047435 PPPIOCCONNECT = 0x8004743a PPPIOCDETACH = 0x8004743c PPPIOCDISCONN = 0x20007439 @@ -193,6 +220,7 @@ const ( PPPIOCSPASS = 0x80107447 PPPIOCSRASYNCMAP = 0x80047454 PPPIOCSXASYNCMAP = 0x8020744f + PPPIOCUNBRIDGECHAN = 0x20007434 PPPIOCXFERUNIT = 0x2000744e PR_SET_PTRACER_ANY = 0xffffffffffffffff PTRACE_GETFPAREGS = 0x14 @@ -320,6 +348,7 @@ const ( SO_BROADCAST = 0x20 SO_BSDCOMPAT = 0x400 SO_BUSY_POLL = 0x30 + SO_BUSY_POLL_BUDGET = 0x49 SO_CNX_ADVICE = 0x37 SO_COOKIE = 0x3b SO_DETACH_REUSEPORT_BPF = 0x47 @@ -334,6 +363,7 @@ const ( SO_MARK = 0x22 SO_MAX_PACING_RATE = 0x31 SO_MEMINFO = 0x39 + SO_NETNS_COOKIE = 0x50 SO_NOFCS = 0x27 SO_OOBINLINE = 0x100 SO_PASSCRED = 0x2 @@ -342,6 +372,7 @@ const ( SO_PEERCRED = 0x40 SO_PEERGROUPS = 0x3d SO_PEERSEC = 0x1e + SO_PREFER_BUSY_POLL = 0x48 SO_PROTOCOL = 0x1028 SO_RCVBUF = 0x1002 SO_RCVBUFFORCE = 0x100b @@ -529,6 +560,9 @@ const ( WORDSIZE = 0x40 XCASE = 0x4 XTABS = 0x1800 + _HIDIOCGRAWNAME = 0x40804804 + _HIDIOCGRAWPHYS = 0x40404805 + _HIDIOCGRAWUNIQ = 0x40404808 __TIOCFLUSH = 0x80047410 ) diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go index 96b9b8ab30..72f7420d20 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go @@ -1,6 +1,7 @@ // mkerrors.sh -m32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && netbsd // +build 386,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -158,6 +159,12 @@ const ( CLONE_SIGHAND = 0x800 CLONE_VFORK = 0x4000 CLONE_VM = 0x100 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go index ed522a84e8..8d4eb0c080 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && netbsd // +build amd64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -158,6 +159,12 @@ const ( CLONE_SIGHAND = 0x800 CLONE_VFORK = 0x4000 CLONE_VM = 0x100 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go index c8d36fe998..9eef9749f6 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go @@ -1,6 +1,7 @@ // mkerrors.sh -marm // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && netbsd // +build arm,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -150,6 +151,12 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go index f1c146a74c..3b62ba192c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && netbsd // +build arm64,netbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -158,6 +159,12 @@ const ( CLONE_SIGHAND = 0x800 CLONE_VFORK = 0x4000 CLONE_VM = 0x100 + CPUSTATES = 0x5 + CP_IDLE = 0x4 + CP_INTR = 0x3 + CP_NICE = 0x1 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go index 5402bd55ce..6d56edc05a 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go @@ -1,6 +1,7 @@ // mkerrors.sh -m32 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && openbsd // +build 386,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -146,6 +147,13 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 + CPUSTATES = 0x6 + CP_IDLE = 0x5 + CP_INTR = 0x4 + CP_NICE = 0x1 + CP_SPIN = 0x3 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 @@ -1012,7 +1020,10 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go index ffaf2d2f9f..25cb609481 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && openbsd // +build amd64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -153,6 +154,13 @@ const ( CLOCK_REALTIME = 0x0 CLOCK_THREAD_CPUTIME_ID = 0x4 CLOCK_UPTIME = 0x5 + CPUSTATES = 0x6 + CP_IDLE = 0x5 + CP_INTR = 0x4 + CP_NICE = 0x1 + CP_SPIN = 0x3 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go index 7aa796a642..aef6c08560 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go @@ -1,6 +1,7 @@ // mkerrors.sh // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && openbsd // +build arm,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -146,6 +147,13 @@ const ( BRKINT = 0x2 CFLUSH = 0xf CLOCAL = 0x8000 + CPUSTATES = 0x6 + CP_IDLE = 0x5 + CP_INTR = 0x4 + CP_NICE = 0x1 + CP_SPIN = 0x3 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 @@ -1012,7 +1020,10 @@ const ( RLIMIT_CPU = 0x0 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 + RLIMIT_MEMLOCK = 0x6 RLIMIT_NOFILE = 0x8 + RLIMIT_NPROC = 0x7 + RLIMIT_RSS = 0x5 RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 diff --git a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go index 1792d3f13e..90de7dfc33 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && openbsd // +build arm64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -156,6 +157,13 @@ const ( CLOCK_REALTIME = 0x0 CLOCK_THREAD_CPUTIME_ID = 0x4 CLOCK_UPTIME = 0x5 + CPUSTATES = 0x6 + CP_IDLE = 0x5 + CP_INTR = 0x4 + CP_NICE = 0x1 + CP_SPIN = 0x3 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 CRTSCTS = 0x10000 CS5 = 0x0 diff --git a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go similarity index 52% rename from vendor/golang.org/x/sys/unix/zerrors_darwin_386.go rename to vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go index 6217cdba57..f1154ff56f 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go @@ -1,10 +1,11 @@ -// mkerrors.sh -m32 +// mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. -// +build 386,darwin +//go:build mips64 && openbsd +// +build mips64,openbsd // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -m32 _const.go +// cgo -godefs -- -m64 _const.go package unix @@ -12,6 +13,7 @@ import "syscall" const ( AF_APPLETALK = 0x10 + AF_BLUETOOTH = 0x20 AF_CCITT = 0xa AF_CHAOS = 0x5 AF_CNT = 0x15 @@ -19,116 +21,36 @@ const ( AF_DATAKIT = 0x9 AF_DECnet = 0xc AF_DLI = 0xd - AF_E164 = 0x1c + AF_E164 = 0x1a AF_ECMA = 0x8 + AF_ENCAP = 0x1c AF_HYLINK = 0xf - AF_IEEE80211 = 0x25 AF_IMPLINK = 0x3 AF_INET = 0x2 - AF_INET6 = 0x1e + AF_INET6 = 0x18 AF_IPX = 0x17 - AF_ISDN = 0x1c + AF_ISDN = 0x1a AF_ISO = 0x7 + AF_KEY = 0x1e AF_LAT = 0xe AF_LINK = 0x12 AF_LOCAL = 0x1 - AF_MAX = 0x28 - AF_NATM = 0x1f - AF_NDRV = 0x1b - AF_NETBIOS = 0x21 + AF_MAX = 0x24 + AF_MPLS = 0x21 + AF_NATM = 0x1b AF_NS = 0x6 AF_OSI = 0x7 - AF_PPP = 0x22 AF_PUP = 0x4 - AF_RESERVED_36 = 0x24 AF_ROUTE = 0x11 - AF_SIP = 0x18 + AF_SIP = 0x1d AF_SNA = 0xb - AF_SYSTEM = 0x20 AF_UNIX = 0x1 AF_UNSPEC = 0x0 - AF_UTUN = 0x26 ALTWERASE = 0x200 - ATTR_BIT_MAP_COUNT = 0x5 - ATTR_CMN_ACCESSMASK = 0x20000 - ATTR_CMN_ACCTIME = 0x1000 - ATTR_CMN_ADDEDTIME = 0x10000000 - ATTR_CMN_BKUPTIME = 0x2000 - ATTR_CMN_CHGTIME = 0x800 - ATTR_CMN_CRTIME = 0x200 - ATTR_CMN_DATA_PROTECT_FLAGS = 0x40000000 - ATTR_CMN_DEVID = 0x2 - ATTR_CMN_DOCUMENT_ID = 0x100000 - ATTR_CMN_ERROR = 0x20000000 - ATTR_CMN_EXTENDED_SECURITY = 0x400000 - ATTR_CMN_FILEID = 0x2000000 - ATTR_CMN_FLAGS = 0x40000 - ATTR_CMN_FNDRINFO = 0x4000 - ATTR_CMN_FSID = 0x4 - ATTR_CMN_FULLPATH = 0x8000000 - ATTR_CMN_GEN_COUNT = 0x80000 - ATTR_CMN_GRPID = 0x10000 - ATTR_CMN_GRPUUID = 0x1000000 - ATTR_CMN_MODTIME = 0x400 - ATTR_CMN_NAME = 0x1 - ATTR_CMN_NAMEDATTRCOUNT = 0x80000 - ATTR_CMN_NAMEDATTRLIST = 0x100000 - ATTR_CMN_OBJID = 0x20 - ATTR_CMN_OBJPERMANENTID = 0x40 - ATTR_CMN_OBJTAG = 0x10 - ATTR_CMN_OBJTYPE = 0x8 - ATTR_CMN_OWNERID = 0x8000 - ATTR_CMN_PARENTID = 0x4000000 - ATTR_CMN_PAROBJID = 0x80 - ATTR_CMN_RETURNED_ATTRS = 0x80000000 - ATTR_CMN_SCRIPT = 0x100 - ATTR_CMN_SETMASK = 0x41c7ff00 - ATTR_CMN_USERACCESS = 0x200000 - ATTR_CMN_UUID = 0x800000 - ATTR_CMN_VALIDMASK = 0xffffffff - ATTR_CMN_VOLSETMASK = 0x6700 - ATTR_FILE_ALLOCSIZE = 0x4 - ATTR_FILE_CLUMPSIZE = 0x10 - ATTR_FILE_DATAALLOCSIZE = 0x400 - ATTR_FILE_DATAEXTENTS = 0x800 - ATTR_FILE_DATALENGTH = 0x200 - ATTR_FILE_DEVTYPE = 0x20 - ATTR_FILE_FILETYPE = 0x40 - ATTR_FILE_FORKCOUNT = 0x80 - ATTR_FILE_FORKLIST = 0x100 - ATTR_FILE_IOBLOCKSIZE = 0x8 - ATTR_FILE_LINKCOUNT = 0x1 - ATTR_FILE_RSRCALLOCSIZE = 0x2000 - ATTR_FILE_RSRCEXTENTS = 0x4000 - ATTR_FILE_RSRCLENGTH = 0x1000 - ATTR_FILE_SETMASK = 0x20 - ATTR_FILE_TOTALSIZE = 0x2 - ATTR_FILE_VALIDMASK = 0x37ff - ATTR_VOL_ALLOCATIONCLUMP = 0x40 - ATTR_VOL_ATTRIBUTES = 0x40000000 - ATTR_VOL_CAPABILITIES = 0x20000 - ATTR_VOL_DIRCOUNT = 0x400 - ATTR_VOL_ENCODINGSUSED = 0x10000 - ATTR_VOL_FILECOUNT = 0x200 - ATTR_VOL_FSTYPE = 0x1 - ATTR_VOL_INFO = 0x80000000 - ATTR_VOL_IOBLOCKSIZE = 0x80 - ATTR_VOL_MAXOBJCOUNT = 0x800 - ATTR_VOL_MINALLOCATION = 0x20 - ATTR_VOL_MOUNTEDDEVICE = 0x8000 - ATTR_VOL_MOUNTFLAGS = 0x4000 - ATTR_VOL_MOUNTPOINT = 0x1000 - ATTR_VOL_NAME = 0x2000 - ATTR_VOL_OBJCOUNT = 0x100 - ATTR_VOL_QUOTA_SIZE = 0x10000000 - ATTR_VOL_RESERVED_SIZE = 0x20000000 - ATTR_VOL_SETMASK = 0x80002000 - ATTR_VOL_SIGNATURE = 0x2 - ATTR_VOL_SIZE = 0x4 - ATTR_VOL_SPACEAVAIL = 0x10 - ATTR_VOL_SPACEFREE = 0x8 - ATTR_VOL_UUID = 0x40000 - ATTR_VOL_VALIDMASK = 0xf007ffff + ARPHRD_ETHER = 0x1 + ARPHRD_FRELAY = 0xf + ARPHRD_IEEE1394 = 0x18 + ARPHRD_IEEE802 = 0x6 B0 = 0x0 B110 = 0x6e B115200 = 0x1c200 @@ -154,25 +76,28 @@ const ( B9600 = 0x2580 BIOCFLUSH = 0x20004268 BIOCGBLEN = 0x40044266 + BIOCGDIRFILT = 0x4004427c BIOCGDLT = 0x4004426a - BIOCGDLTLIST = 0xc00c4279 + BIOCGDLTLIST = 0xc010427b BIOCGETIF = 0x4020426b + BIOCGFILDROP = 0x40044278 BIOCGHDRCMPLT = 0x40044274 - BIOCGRSIG = 0x40044272 - BIOCGRTIMEOUT = 0x4008426e - BIOCGSEESENT = 0x40044276 + BIOCGRSIG = 0x40044273 + BIOCGRTIMEOUT = 0x4010426e BIOCGSTATS = 0x4008426f BIOCIMMEDIATE = 0x80044270 + BIOCLOCK = 0x20004276 BIOCPROMISC = 0x20004269 BIOCSBLEN = 0xc0044266 - BIOCSDLT = 0x80044278 - BIOCSETF = 0x80084267 - BIOCSETFNR = 0x8008427e + BIOCSDIRFILT = 0x8004427d + BIOCSDLT = 0x8004427a + BIOCSETF = 0x80104267 BIOCSETIF = 0x8020426c + BIOCSETWF = 0x80104277 + BIOCSFILDROP = 0x80044279 BIOCSHDRCMPLT = 0x80044275 - BIOCSRSIG = 0x80044273 - BIOCSRTIMEOUT = 0x8008426d - BIOCSSEESENT = 0x80044277 + BIOCSRSIG = 0x80044272 + BIOCSRTIMEOUT = 0x8010426d BIOCVERSION = 0x40044271 BPF_A = 0x10 BPF_ABS = 0x20 @@ -181,7 +106,12 @@ const ( BPF_ALU = 0x4 BPF_AND = 0x50 BPF_B = 0x10 + BPF_DIRECTION_IN = 0x1 + BPF_DIRECTION_OUT = 0x2 BPF_DIV = 0x30 + BPF_FILDROP_CAPTURE = 0x1 + BPF_FILDROP_DROP = 0x2 + BPF_FILDROP_PASS = 0x0 BPF_H = 0x8 BPF_IMM = 0x0 BPF_IND = 0x40 @@ -197,7 +127,7 @@ const ( BPF_LEN = 0x80 BPF_LSH = 0x60 BPF_MAJOR_VERSION = 0x1 - BPF_MAXBUFSIZE = 0x80000 + BPF_MAXBUFSIZE = 0x200000 BPF_MAXINSNS = 0x200 BPF_MEM = 0x60 BPF_MEMWORDS = 0x10 @@ -219,33 +149,30 @@ const ( BPF_W = 0x0 BPF_X = 0x8 BRKINT = 0x2 - BS0 = 0x0 - BS1 = 0x8000 - BSDLY = 0x8000 CFLUSH = 0xf CLOCAL = 0x8000 - CLOCK_MONOTONIC = 0x6 - CLOCK_MONOTONIC_RAW = 0x4 - CLOCK_MONOTONIC_RAW_APPROX = 0x5 - CLOCK_PROCESS_CPUTIME_ID = 0xc + CLOCK_BOOTTIME = 0x6 + CLOCK_MONOTONIC = 0x3 + CLOCK_PROCESS_CPUTIME_ID = 0x2 CLOCK_REALTIME = 0x0 - CLOCK_THREAD_CPUTIME_ID = 0x10 - CLOCK_UPTIME_RAW = 0x8 - CLOCK_UPTIME_RAW_APPROX = 0x9 - CR0 = 0x0 - CR1 = 0x1000 - CR2 = 0x2000 - CR3 = 0x3000 - CRDLY = 0x3000 + CLOCK_THREAD_CPUTIME_ID = 0x4 + CLOCK_UPTIME = 0x5 + CPUSTATES = 0x6 + CP_IDLE = 0x5 + CP_INTR = 0x4 + CP_NICE = 0x1 + CP_SPIN = 0x3 + CP_SYS = 0x2 + CP_USER = 0x0 CREAD = 0x800 - CRTSCTS = 0x30000 + CRTSCTS = 0x10000 CS5 = 0x0 CS6 = 0x100 CS7 = 0x200 CS8 = 0x300 CSIZE = 0x300 CSTART = 0x11 - CSTATUS = 0x14 + CSTATUS = 0xff CSTOP = 0x13 CSTOPB = 0x400 CSUSP = 0x1a @@ -253,149 +180,92 @@ const ( CTL_KERN = 0x1 CTL_MAXNAME = 0xc CTL_NET = 0x4 - DLT_A429 = 0xb8 - DLT_A653_ICM = 0xb9 - DLT_AIRONET_HEADER = 0x78 - DLT_AOS = 0xde - DLT_APPLE_IP_OVER_IEEE1394 = 0x8a + DIOCADDQUEUE = 0xc110445d + DIOCADDRULE = 0xcd604404 + DIOCADDSTATE = 0xc1084425 + DIOCCHANGERULE = 0xcd60441a + DIOCCLRIFFLAG = 0xc028445a + DIOCCLRSRCNODES = 0x20004455 + DIOCCLRSTATES = 0xc0e04412 + DIOCCLRSTATUS = 0xc0284416 + DIOCGETLIMIT = 0xc0084427 + DIOCGETQSTATS = 0xc1204460 + DIOCGETQUEUE = 0xc110445f + DIOCGETQUEUES = 0xc110445e + DIOCGETRULE = 0xcd604407 + DIOCGETRULES = 0xcd604406 + DIOCGETRULESET = 0xc444443b + DIOCGETRULESETS = 0xc444443a + DIOCGETSRCNODES = 0xc0104454 + DIOCGETSTATE = 0xc1084413 + DIOCGETSTATES = 0xc0104419 + DIOCGETSTATUS = 0xc1e84415 + DIOCGETSYNFLWATS = 0xc0084463 + DIOCGETTIMEOUT = 0xc008441e + DIOCIGETIFACES = 0xc0284457 + DIOCKILLSRCNODES = 0xc080445b + DIOCKILLSTATES = 0xc0e04429 + DIOCNATLOOK = 0xc0504417 + DIOCOSFPADD = 0xc088444f + DIOCOSFPFLUSH = 0x2000444e + DIOCOSFPGET = 0xc0884450 + DIOCRADDADDRS = 0xc4504443 + DIOCRADDTABLES = 0xc450443d + DIOCRCLRADDRS = 0xc4504442 + DIOCRCLRASTATS = 0xc4504448 + DIOCRCLRTABLES = 0xc450443c + DIOCRCLRTSTATS = 0xc4504441 + DIOCRDELADDRS = 0xc4504444 + DIOCRDELTABLES = 0xc450443e + DIOCRGETADDRS = 0xc4504446 + DIOCRGETASTATS = 0xc4504447 + DIOCRGETTABLES = 0xc450443f + DIOCRGETTSTATS = 0xc4504440 + DIOCRINADEFINE = 0xc450444d + DIOCRSETADDRS = 0xc4504445 + DIOCRSETTFLAGS = 0xc450444a + DIOCRTSTADDRS = 0xc4504449 + DIOCSETDEBUG = 0xc0044418 + DIOCSETHOSTID = 0xc0044456 + DIOCSETIFFLAG = 0xc0284459 + DIOCSETLIMIT = 0xc0084428 + DIOCSETREASS = 0xc004445c + DIOCSETSTATUSIF = 0xc0284414 + DIOCSETSYNCOOKIES = 0xc0014462 + DIOCSETSYNFLWATS = 0xc0084461 + DIOCSETTIMEOUT = 0xc008441d + DIOCSTART = 0x20004401 + DIOCSTOP = 0x20004402 + DIOCXBEGIN = 0xc0104451 + DIOCXCOMMIT = 0xc0104452 + DIOCXROLLBACK = 0xc0104453 DLT_ARCNET = 0x7 - DLT_ARCNET_LINUX = 0x81 - DLT_ATM_CLIP = 0x13 DLT_ATM_RFC1483 = 0xb - DLT_AURORA = 0x7e DLT_AX25 = 0x3 - DLT_AX25_KISS = 0xca - DLT_BACNET_MS_TP = 0xa5 - DLT_BLUETOOTH_HCI_H4 = 0xbb - DLT_BLUETOOTH_HCI_H4_WITH_PHDR = 0xc9 - DLT_CAN20B = 0xbe - DLT_CAN_SOCKETCAN = 0xe3 DLT_CHAOS = 0x5 - DLT_CHDLC = 0x68 - DLT_CISCO_IOS = 0x76 DLT_C_HDLC = 0x68 - DLT_C_HDLC_WITH_DIR = 0xcd - DLT_DBUS = 0xe7 - DLT_DECT = 0xdd - DLT_DOCSIS = 0x8f - DLT_DVB_CI = 0xeb - DLT_ECONET = 0x73 DLT_EN10MB = 0x1 DLT_EN3MB = 0x2 - DLT_ENC = 0x6d - DLT_ERF = 0xc5 - DLT_ERF_ETH = 0xaf - DLT_ERF_POS = 0xb0 - DLT_FC_2 = 0xe0 - DLT_FC_2_WITH_FRAME_DELIMS = 0xe1 + DLT_ENC = 0xd DLT_FDDI = 0xa - DLT_FLEXRAY = 0xd2 - DLT_FRELAY = 0x6b - DLT_FRELAY_WITH_DIR = 0xce - DLT_GCOM_SERIAL = 0xad - DLT_GCOM_T1E1 = 0xac - DLT_GPF_F = 0xab - DLT_GPF_T = 0xaa - DLT_GPRS_LLC = 0xa9 - DLT_GSMTAP_ABIS = 0xda - DLT_GSMTAP_UM = 0xd9 - DLT_HHDLC = 0x79 - DLT_IBM_SN = 0x92 - DLT_IBM_SP = 0x91 DLT_IEEE802 = 0x6 DLT_IEEE802_11 = 0x69 DLT_IEEE802_11_RADIO = 0x7f - DLT_IEEE802_11_RADIO_AVS = 0xa3 - DLT_IEEE802_15_4 = 0xc3 - DLT_IEEE802_15_4_LINUX = 0xbf - DLT_IEEE802_15_4_NOFCS = 0xe6 - DLT_IEEE802_15_4_NONASK_PHY = 0xd7 - DLT_IEEE802_16_MAC_CPS = 0xbc - DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1 - DLT_IPFILTER = 0x74 - DLT_IPMB = 0xc7 - DLT_IPMB_LINUX = 0xd1 - DLT_IPNET = 0xe2 - DLT_IPOIB = 0xf2 - DLT_IPV4 = 0xe4 - DLT_IPV6 = 0xe5 - DLT_IP_OVER_FC = 0x7a - DLT_JUNIPER_ATM1 = 0x89 - DLT_JUNIPER_ATM2 = 0x87 - DLT_JUNIPER_ATM_CEMIC = 0xee - DLT_JUNIPER_CHDLC = 0xb5 - DLT_JUNIPER_ES = 0x84 - DLT_JUNIPER_ETHER = 0xb2 - DLT_JUNIPER_FIBRECHANNEL = 0xea - DLT_JUNIPER_FRELAY = 0xb4 - DLT_JUNIPER_GGSN = 0x85 - DLT_JUNIPER_ISM = 0xc2 - DLT_JUNIPER_MFR = 0x86 - DLT_JUNIPER_MLFR = 0x83 - DLT_JUNIPER_MLPPP = 0x82 - DLT_JUNIPER_MONITOR = 0xa4 - DLT_JUNIPER_PIC_PEER = 0xae - DLT_JUNIPER_PPP = 0xb3 - DLT_JUNIPER_PPPOE = 0xa7 - DLT_JUNIPER_PPPOE_ATM = 0xa8 - DLT_JUNIPER_SERVICES = 0x88 - DLT_JUNIPER_SRX_E2E = 0xe9 - DLT_JUNIPER_ST = 0xc8 - DLT_JUNIPER_VP = 0xb7 - DLT_JUNIPER_VS = 0xe8 - DLT_LAPB_WITH_DIR = 0xcf - DLT_LAPD = 0xcb - DLT_LIN = 0xd4 - DLT_LINUX_EVDEV = 0xd8 - DLT_LINUX_IRDA = 0x90 - DLT_LINUX_LAPD = 0xb1 - DLT_LINUX_PPP_WITHDIRECTION = 0xa6 - DLT_LINUX_SLL = 0x71 - DLT_LOOP = 0x6c - DLT_LTALK = 0x72 - DLT_MATCHING_MAX = 0xf5 - DLT_MATCHING_MIN = 0x68 - DLT_MFR = 0xb6 - DLT_MOST = 0xd3 - DLT_MPEG_2_TS = 0xf3 + DLT_LOOP = 0xc DLT_MPLS = 0xdb - DLT_MTP2 = 0x8c - DLT_MTP2_WITH_PHDR = 0x8b - DLT_MTP3 = 0x8d - DLT_MUX27010 = 0xec - DLT_NETANALYZER = 0xf0 - DLT_NETANALYZER_TRANSPARENT = 0xf1 - DLT_NFC_LLCP = 0xf5 - DLT_NFLOG = 0xef - DLT_NG40 = 0xf4 DLT_NULL = 0x0 - DLT_PCI_EXP = 0x7d + DLT_OPENFLOW = 0x10b DLT_PFLOG = 0x75 DLT_PFSYNC = 0x12 - DLT_PPI = 0xc0 DLT_PPP = 0x9 DLT_PPP_BSDOS = 0x10 DLT_PPP_ETHER = 0x33 - DLT_PPP_PPPD = 0xa6 DLT_PPP_SERIAL = 0x32 - DLT_PPP_WITH_DIR = 0xcc - DLT_PPP_WITH_DIRECTION = 0xa6 - DLT_PRISM_HEADER = 0x77 DLT_PRONET = 0x4 - DLT_RAIF1 = 0xc6 - DLT_RAW = 0xc - DLT_RIO = 0x7c - DLT_SCCP = 0x8e - DLT_SITA = 0xc4 + DLT_RAW = 0xe DLT_SLIP = 0x8 DLT_SLIP_BSDOS = 0xf - DLT_STANAG_5066_D_PDU = 0xed - DLT_SUNATM = 0x7b - DLT_SYMANTEC_FIREWALL = 0x63 - DLT_TZSP = 0x80 - DLT_USB = 0xba - DLT_USB_LINUX = 0xbd - DLT_USB_LINUX_MMAPPED = 0xdc + DLT_USBPCAP = 0xf9 DLT_USER0 = 0x93 DLT_USER1 = 0x94 DLT_USER10 = 0x9d @@ -412,9 +282,6 @@ const ( DLT_USER7 = 0x9a DLT_USER8 = 0x9b DLT_USER9 = 0x9c - DLT_WIHART = 0xdf - DLT_X2E_SERIAL = 0xd5 - DLT_X2E_XORAYA = 0xd6 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -423,7 +290,6 @@ const ( DT_REG = 0x8 DT_SOCK = 0xc DT_UNKNOWN = 0x0 - DT_WHT = 0xe ECHO = 0x8 ECHOCTL = 0x40 ECHOE = 0x2 @@ -431,107 +297,260 @@ const ( ECHOKE = 0x1 ECHONL = 0x10 ECHOPRT = 0x20 + EMT_TAGOVF = 0x1 + EMUL_ENABLED = 0x1 + EMUL_NATIVE = 0x2 + ENDRUNDISC = 0x9 + ETHERMIN = 0x2e + ETHERMTU = 0x5dc + ETHERTYPE_8023 = 0x4 + ETHERTYPE_AARP = 0x80f3 + ETHERTYPE_ACCTON = 0x8390 + ETHERTYPE_AEONIC = 0x8036 + ETHERTYPE_ALPHA = 0x814a + ETHERTYPE_AMBER = 0x6008 + ETHERTYPE_AMOEBA = 0x8145 + ETHERTYPE_AOE = 0x88a2 + ETHERTYPE_APOLLO = 0x80f7 + ETHERTYPE_APOLLODOMAIN = 0x8019 + ETHERTYPE_APPLETALK = 0x809b + ETHERTYPE_APPLITEK = 0x80c7 + ETHERTYPE_ARGONAUT = 0x803a + ETHERTYPE_ARP = 0x806 + ETHERTYPE_AT = 0x809b + ETHERTYPE_ATALK = 0x809b + ETHERTYPE_ATOMIC = 0x86df + ETHERTYPE_ATT = 0x8069 + ETHERTYPE_ATTSTANFORD = 0x8008 + ETHERTYPE_AUTOPHON = 0x806a + ETHERTYPE_AXIS = 0x8856 + ETHERTYPE_BCLOOP = 0x9003 + ETHERTYPE_BOFL = 0x8102 + ETHERTYPE_CABLETRON = 0x7034 + ETHERTYPE_CHAOS = 0x804 + ETHERTYPE_COMDESIGN = 0x806c + ETHERTYPE_COMPUGRAPHIC = 0x806d + ETHERTYPE_COUNTERPOINT = 0x8062 + ETHERTYPE_CRONUS = 0x8004 + ETHERTYPE_CRONUSVLN = 0x8003 + ETHERTYPE_DCA = 0x1234 + ETHERTYPE_DDE = 0x807b + ETHERTYPE_DEBNI = 0xaaaa + ETHERTYPE_DECAM = 0x8048 + ETHERTYPE_DECCUST = 0x6006 + ETHERTYPE_DECDIAG = 0x6005 + ETHERTYPE_DECDNS = 0x803c + ETHERTYPE_DECDTS = 0x803e + ETHERTYPE_DECEXPER = 0x6000 + ETHERTYPE_DECLAST = 0x8041 + ETHERTYPE_DECLTM = 0x803f + ETHERTYPE_DECMUMPS = 0x6009 + ETHERTYPE_DECNETBIOS = 0x8040 + ETHERTYPE_DELTACON = 0x86de + ETHERTYPE_DIDDLE = 0x4321 + ETHERTYPE_DLOG1 = 0x660 + ETHERTYPE_DLOG2 = 0x661 + ETHERTYPE_DN = 0x6003 + ETHERTYPE_DOGFIGHT = 0x1989 + ETHERTYPE_DSMD = 0x8039 + ETHERTYPE_ECMA = 0x803 + ETHERTYPE_ENCRYPT = 0x803d + ETHERTYPE_ES = 0x805d + ETHERTYPE_EXCELAN = 0x8010 + ETHERTYPE_EXPERDATA = 0x8049 + ETHERTYPE_FLIP = 0x8146 + ETHERTYPE_FLOWCONTROL = 0x8808 + ETHERTYPE_FRARP = 0x808 + ETHERTYPE_GENDYN = 0x8068 + ETHERTYPE_HAYES = 0x8130 + ETHERTYPE_HIPPI_FP = 0x8180 + ETHERTYPE_HITACHI = 0x8820 + ETHERTYPE_HP = 0x8005 + ETHERTYPE_IEEEPUP = 0xa00 + ETHERTYPE_IEEEPUPAT = 0xa01 + ETHERTYPE_IMLBL = 0x4c42 + ETHERTYPE_IMLBLDIAG = 0x424c + ETHERTYPE_IP = 0x800 + ETHERTYPE_IPAS = 0x876c + ETHERTYPE_IPV6 = 0x86dd + ETHERTYPE_IPX = 0x8137 + ETHERTYPE_IPXNEW = 0x8037 + ETHERTYPE_KALPANA = 0x8582 + ETHERTYPE_LANBRIDGE = 0x8038 + ETHERTYPE_LANPROBE = 0x8888 + ETHERTYPE_LAT = 0x6004 + ETHERTYPE_LBACK = 0x9000 + ETHERTYPE_LITTLE = 0x8060 + ETHERTYPE_LLDP = 0x88cc + ETHERTYPE_LOGICRAFT = 0x8148 + ETHERTYPE_LOOPBACK = 0x9000 + ETHERTYPE_MACSEC = 0x88e5 + ETHERTYPE_MATRA = 0x807a + ETHERTYPE_MAX = 0xffff + ETHERTYPE_MERIT = 0x807c + ETHERTYPE_MICP = 0x873a + ETHERTYPE_MOPDL = 0x6001 + ETHERTYPE_MOPRC = 0x6002 + ETHERTYPE_MOTOROLA = 0x818d + ETHERTYPE_MPLS = 0x8847 + ETHERTYPE_MPLS_MCAST = 0x8848 + ETHERTYPE_MUMPS = 0x813f + ETHERTYPE_NBPCC = 0x3c04 + ETHERTYPE_NBPCLAIM = 0x3c09 + ETHERTYPE_NBPCLREQ = 0x3c05 + ETHERTYPE_NBPCLRSP = 0x3c06 + ETHERTYPE_NBPCREQ = 0x3c02 + ETHERTYPE_NBPCRSP = 0x3c03 + ETHERTYPE_NBPDG = 0x3c07 + ETHERTYPE_NBPDGB = 0x3c08 + ETHERTYPE_NBPDLTE = 0x3c0a + ETHERTYPE_NBPRAR = 0x3c0c + ETHERTYPE_NBPRAS = 0x3c0b + ETHERTYPE_NBPRST = 0x3c0d + ETHERTYPE_NBPSCD = 0x3c01 + ETHERTYPE_NBPVCD = 0x3c00 + ETHERTYPE_NBS = 0x802 + ETHERTYPE_NCD = 0x8149 + ETHERTYPE_NESTAR = 0x8006 + ETHERTYPE_NETBEUI = 0x8191 + ETHERTYPE_NOVELL = 0x8138 + ETHERTYPE_NS = 0x600 + ETHERTYPE_NSAT = 0x601 + ETHERTYPE_NSCOMPAT = 0x807 + ETHERTYPE_NTRAILER = 0x10 + ETHERTYPE_OS9 = 0x7007 + ETHERTYPE_OS9NET = 0x7009 + ETHERTYPE_PACER = 0x80c6 + ETHERTYPE_PAE = 0x888e + ETHERTYPE_PBB = 0x88e7 + ETHERTYPE_PCS = 0x4242 + ETHERTYPE_PLANNING = 0x8044 + ETHERTYPE_PPP = 0x880b + ETHERTYPE_PPPOE = 0x8864 + ETHERTYPE_PPPOEDISC = 0x8863 + ETHERTYPE_PRIMENTS = 0x7031 + ETHERTYPE_PUP = 0x200 + ETHERTYPE_PUPAT = 0x200 + ETHERTYPE_QINQ = 0x88a8 + ETHERTYPE_RACAL = 0x7030 + ETHERTYPE_RATIONAL = 0x8150 + ETHERTYPE_RAWFR = 0x6559 + ETHERTYPE_RCL = 0x1995 + ETHERTYPE_RDP = 0x8739 + ETHERTYPE_RETIX = 0x80f2 + ETHERTYPE_REVARP = 0x8035 + ETHERTYPE_SCA = 0x6007 + ETHERTYPE_SECTRA = 0x86db + ETHERTYPE_SECUREDATA = 0x876d + ETHERTYPE_SGITW = 0x817e + ETHERTYPE_SG_BOUNCE = 0x8016 + ETHERTYPE_SG_DIAG = 0x8013 + ETHERTYPE_SG_NETGAMES = 0x8014 + ETHERTYPE_SG_RESV = 0x8015 + ETHERTYPE_SIMNET = 0x5208 + ETHERTYPE_SLOW = 0x8809 + ETHERTYPE_SNA = 0x80d5 + ETHERTYPE_SNMP = 0x814c + ETHERTYPE_SONIX = 0xfaf5 + ETHERTYPE_SPIDER = 0x809f + ETHERTYPE_SPRITE = 0x500 + ETHERTYPE_STP = 0x8181 + ETHERTYPE_TALARIS = 0x812b + ETHERTYPE_TALARISMC = 0x852b + ETHERTYPE_TCPCOMP = 0x876b + ETHERTYPE_TCPSM = 0x9002 + ETHERTYPE_TEC = 0x814f + ETHERTYPE_TIGAN = 0x802f + ETHERTYPE_TRAIL = 0x1000 + ETHERTYPE_TRANSETHER = 0x6558 + ETHERTYPE_TYMSHARE = 0x802e + ETHERTYPE_UBBST = 0x7005 + ETHERTYPE_UBDEBUG = 0x900 + ETHERTYPE_UBDIAGLOOP = 0x7002 + ETHERTYPE_UBDL = 0x7000 + ETHERTYPE_UBNIU = 0x7001 + ETHERTYPE_UBNMC = 0x7003 + ETHERTYPE_VALID = 0x1600 + ETHERTYPE_VARIAN = 0x80dd + ETHERTYPE_VAXELN = 0x803b + ETHERTYPE_VEECO = 0x8067 + ETHERTYPE_VEXP = 0x805b + ETHERTYPE_VGLAB = 0x8131 + ETHERTYPE_VINES = 0xbad + ETHERTYPE_VINESECHO = 0xbaf + ETHERTYPE_VINESLOOP = 0xbae + ETHERTYPE_VITAL = 0xff00 + ETHERTYPE_VLAN = 0x8100 + ETHERTYPE_VLTLMAN = 0x8080 + ETHERTYPE_VPROD = 0x805c + ETHERTYPE_VURESERVED = 0x8147 + ETHERTYPE_WATERLOO = 0x8130 + ETHERTYPE_WELLFLEET = 0x8103 + ETHERTYPE_X25 = 0x805 + ETHERTYPE_X75 = 0x801 + ETHERTYPE_XNSSM = 0x9001 + ETHERTYPE_XTP = 0x817d + ETHER_ADDR_LEN = 0x6 + ETHER_ALIGN = 0x2 + ETHER_CRC_LEN = 0x4 + ETHER_CRC_POLY_BE = 0x4c11db6 + ETHER_CRC_POLY_LE = 0xedb88320 + ETHER_HDR_LEN = 0xe + ETHER_MAX_DIX_LEN = 0x600 + ETHER_MAX_HARDMTU_LEN = 0xff9b + ETHER_MAX_LEN = 0x5ee + ETHER_MIN_LEN = 0x40 + ETHER_TYPE_LEN = 0x2 + ETHER_VLAN_ENCAP_LEN = 0x4 EVFILT_AIO = -0x3 - EVFILT_EXCEPT = -0xf - EVFILT_FS = -0x9 - EVFILT_MACHPORT = -0x8 + EVFILT_DEVICE = -0x8 EVFILT_PROC = -0x5 EVFILT_READ = -0x1 EVFILT_SIGNAL = -0x6 - EVFILT_SYSCOUNT = 0xf - EVFILT_THREADMARKER = 0xf + EVFILT_SYSCOUNT = 0x8 EVFILT_TIMER = -0x7 - EVFILT_USER = -0xa - EVFILT_VM = -0xc EVFILT_VNODE = -0x4 EVFILT_WRITE = -0x2 + EVL_ENCAPLEN = 0x4 + EVL_PRIO_BITS = 0xd + EVL_PRIO_MAX = 0x7 + EVL_VLID_MASK = 0xfff + EVL_VLID_MAX = 0xffe + EVL_VLID_MIN = 0x1 + EVL_VLID_NULL = 0x0 EV_ADD = 0x1 EV_CLEAR = 0x20 EV_DELETE = 0x2 EV_DISABLE = 0x8 EV_DISPATCH = 0x80 - EV_DISPATCH2 = 0x180 EV_ENABLE = 0x4 EV_EOF = 0x8000 EV_ERROR = 0x4000 - EV_FLAG0 = 0x1000 EV_FLAG1 = 0x2000 EV_ONESHOT = 0x10 - EV_OOBAND = 0x2000 - EV_POLL = 0x1000 EV_RECEIPT = 0x40 EV_SYSFLAGS = 0xf000 - EV_UDATA_SPECIFIC = 0x100 - EV_VANISHED = 0x200 EXTA = 0x4b00 EXTB = 0x9600 EXTPROC = 0x800 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 - FF0 = 0x0 - FF1 = 0x4000 - FFDLY = 0x4000 FLUSHO = 0x800000 - FSOPT_ATTR_CMN_EXTENDED = 0x20 - FSOPT_NOFOLLOW = 0x1 - FSOPT_NOINMEMUPDATE = 0x2 - FSOPT_PACK_INVAL_ATTRS = 0x8 - FSOPT_REPORT_FULLSIZE = 0x4 - F_ADDFILESIGS = 0x3d - F_ADDFILESIGS_FOR_DYLD_SIM = 0x53 - F_ADDFILESIGS_RETURN = 0x61 - F_ADDSIGS = 0x3b - F_ALLOCATEALL = 0x4 - F_ALLOCATECONTIG = 0x2 - F_BARRIERFSYNC = 0x55 - F_CHECK_LV = 0x62 - F_CHKCLEAN = 0x29 F_DUPFD = 0x0 - F_DUPFD_CLOEXEC = 0x43 - F_FINDSIGS = 0x4e - F_FLUSH_DATA = 0x28 - F_FREEZE_FS = 0x35 - F_FULLFSYNC = 0x33 - F_GETCODEDIR = 0x48 + F_DUPFD_CLOEXEC = 0xa F_GETFD = 0x1 F_GETFL = 0x3 F_GETLK = 0x7 - F_GETLKPID = 0x42 - F_GETNOSIGPIPE = 0x4a F_GETOWN = 0x5 - F_GETPATH = 0x32 - F_GETPATH_MTMINFO = 0x47 - F_GETPROTECTIONCLASS = 0x3f - F_GETPROTECTIONLEVEL = 0x4d - F_GLOBAL_NOCACHE = 0x37 - F_LOG2PHYS = 0x31 - F_LOG2PHYS_EXT = 0x41 - F_NOCACHE = 0x30 - F_NODIRECT = 0x3e + F_ISATTY = 0xb F_OK = 0x0 - F_PATHPKG_CHECK = 0x34 - F_PEOFPOSMODE = 0x3 - F_PREALLOCATE = 0x2a - F_PUNCHHOLE = 0x63 - F_RDADVISE = 0x2c - F_RDAHEAD = 0x2d F_RDLCK = 0x1 - F_SETBACKINGSTORE = 0x46 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLK = 0x8 F_SETLKW = 0x9 - F_SETLKWTIMEOUT = 0xa - F_SETNOSIGPIPE = 0x49 F_SETOWN = 0x6 - F_SETPROTECTIONCLASS = 0x40 - F_SETSIZE = 0x2b - F_SINGLE_WRITER = 0x4c - F_THAW_FS = 0x36 - F_TRANSCODEKEY = 0x4b - F_TRIM_ACTIVE_FILE = 0x64 F_UNLCK = 0x2 - F_VOLPOSMODE = 0x4 F_WRLCK = 0x3 HUPCL = 0x4000 HW_MACHINE = 0x1 @@ -539,9 +558,11 @@ const ( ICMP6_FILTER = 0x12 ICRNL = 0x100 IEXTEN = 0x400 + IFAN_ARRIVAL = 0x0 + IFAN_DEPARTURE = 0x1 IFF_ALLMULTI = 0x200 - IFF_ALTPHYS = 0x4000 IFF_BROADCAST = 0x2 + IFF_CANTCHANGE = 0x8e52 IFF_DEBUG = 0x4 IFF_LINK0 = 0x1000 IFF_LINK1 = 0x2000 @@ -549,80 +570,236 @@ const ( IFF_LOOPBACK = 0x8 IFF_MULTICAST = 0x8000 IFF_NOARP = 0x80 - IFF_NOTRAILERS = 0x20 IFF_OACTIVE = 0x400 IFF_POINTOPOINT = 0x10 IFF_PROMISC = 0x100 IFF_RUNNING = 0x40 IFF_SIMPLEX = 0x800 + IFF_STATICARP = 0x20 IFF_UP = 0x1 IFNAMSIZ = 0x10 IFT_1822 = 0x2 + IFT_A12MPPSWITCH = 0x82 + IFT_AAL2 = 0xbb IFT_AAL5 = 0x31 + IFT_ADSL = 0x5e + IFT_AFLANE8023 = 0x3b + IFT_AFLANE8025 = 0x3c + IFT_ARAP = 0x58 IFT_ARCNET = 0x23 IFT_ARCNETPLUS = 0x24 + IFT_ASYNC = 0x54 IFT_ATM = 0x25 + IFT_ATMDXI = 0x69 + IFT_ATMFUNI = 0x6a + IFT_ATMIMA = 0x6b + IFT_ATMLOGICAL = 0x50 + IFT_ATMRADIO = 0xbd + IFT_ATMSUBINTERFACE = 0x86 + IFT_ATMVCIENDPT = 0xc2 + IFT_ATMVIRTUAL = 0x95 + IFT_BGPPOLICYACCOUNTING = 0xa2 + IFT_BLUETOOTH = 0xf8 IFT_BRIDGE = 0xd1 - IFT_CARP = 0xf8 - IFT_CELLULAR = 0xff + IFT_BSC = 0x53 + IFT_CARP = 0xf7 + IFT_CCTEMUL = 0x3d IFT_CEPT = 0x13 + IFT_CES = 0x85 + IFT_CHANNEL = 0x46 + IFT_CNR = 0x55 + IFT_COFFEE = 0x84 + IFT_COMPOSITELINK = 0x9b + IFT_DCN = 0x8d + IFT_DIGITALPOWERLINE = 0x8a + IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba + IFT_DLSW = 0x4a + IFT_DOCSCABLEDOWNSTREAM = 0x80 + IFT_DOCSCABLEMACLAYER = 0x7f + IFT_DOCSCABLEUPSTREAM = 0x81 + IFT_DOCSCABLEUPSTREAMCHANNEL = 0xcd + IFT_DS0 = 0x51 + IFT_DS0BUNDLE = 0x52 + IFT_DS1FDL = 0xaa IFT_DS3 = 0x1e + IFT_DTM = 0x8c + IFT_DUMMY = 0xf1 + IFT_DVBASILN = 0xac + IFT_DVBASIOUT = 0xad + IFT_DVBRCCDOWNSTREAM = 0x93 + IFT_DVBRCCMACLAYER = 0x92 + IFT_DVBRCCUPSTREAM = 0x94 + IFT_ECONET = 0xce IFT_ENC = 0xf4 IFT_EON = 0x19 + IFT_EPLRS = 0x57 + IFT_ESCON = 0x49 IFT_ETHER = 0x6 - IFT_FAITH = 0x38 + IFT_FAITH = 0xf3 + IFT_FAST = 0x7d + IFT_FASTETHER = 0x3e + IFT_FASTETHERFX = 0x45 IFT_FDDI = 0xf + IFT_FIBRECHANNEL = 0x38 + IFT_FRAMERELAYINTERCONNECT = 0x3a + IFT_FRAMERELAYMPI = 0x5c + IFT_FRDLCIENDPT = 0xc1 IFT_FRELAY = 0x20 IFT_FRELAYDCE = 0x2c - IFT_GIF = 0x37 + IFT_FRF16MFRBUNDLE = 0xa3 + IFT_FRFORWARD = 0x9e + IFT_G703AT2MB = 0x43 + IFT_G703AT64K = 0x42 + IFT_GIF = 0xf0 + IFT_GIGABITETHERNET = 0x75 + IFT_GR303IDT = 0xb2 + IFT_GR303RDT = 0xb1 + IFT_H323GATEKEEPER = 0xa4 + IFT_H323PROXY = 0xa5 IFT_HDH1822 = 0x3 + IFT_HDLC = 0x76 + IFT_HDSL2 = 0xa8 + IFT_HIPERLAN2 = 0xb7 IFT_HIPPI = 0x2f + IFT_HIPPIINTERFACE = 0x39 + IFT_HOSTPAD = 0x5a IFT_HSSI = 0x2e IFT_HY = 0xe + IFT_IBM370PARCHAN = 0x48 + IFT_IDSL = 0x9a IFT_IEEE1394 = 0x90 - IFT_IEEE8023ADLAG = 0x88 + IFT_IEEE80211 = 0x47 + IFT_IEEE80212 = 0x37 + IFT_IEEE8023ADLAG = 0xa1 + IFT_IFGSN = 0x91 + IFT_IMT = 0xbe + IFT_INFINIBAND = 0xc7 + IFT_INTERLEAVE = 0x7c + IFT_IP = 0x7e + IFT_IPFORWARD = 0x8e + IFT_IPOVERATM = 0x72 + IFT_IPOVERCDLC = 0x6d + IFT_IPOVERCLAW = 0x6e + IFT_IPSWITCH = 0x4e + IFT_ISDN = 0x3f IFT_ISDNBASIC = 0x14 IFT_ISDNPRIMARY = 0x15 + IFT_ISDNS = 0x4b + IFT_ISDNU = 0x4c IFT_ISO88022LLC = 0x29 IFT_ISO88023 = 0x7 IFT_ISO88024 = 0x8 IFT_ISO88025 = 0x9 + IFT_ISO88025CRFPINT = 0x62 + IFT_ISO88025DTR = 0x56 + IFT_ISO88025FIBER = 0x73 IFT_ISO88026 = 0xa + IFT_ISUP = 0xb3 IFT_L2VLAN = 0x87 + IFT_L3IPVLAN = 0x88 + IFT_L3IPXVLAN = 0x89 IFT_LAPB = 0x10 + IFT_LAPD = 0x4d + IFT_LAPF = 0x77 + IFT_LINEGROUP = 0xd2 IFT_LOCALTALK = 0x2a IFT_LOOP = 0x18 + IFT_MBIM = 0xfa + IFT_MEDIAMAILOVERIP = 0x8b + IFT_MFSIGLINK = 0xa7 IFT_MIOX25 = 0x26 IFT_MODEM = 0x30 + IFT_MPC = 0x71 + IFT_MPLS = 0xa6 + IFT_MPLSTUNNEL = 0x96 + IFT_MSDSL = 0x8f + IFT_MVL = 0xbf + IFT_MYRINET = 0x63 + IFT_NFAS = 0xaf IFT_NSIP = 0x1b + IFT_OPTICALCHANNEL = 0xc3 + IFT_OPTICALTRANSPORT = 0xc4 IFT_OTHER = 0x1 IFT_P10 = 0xc IFT_P80 = 0xd IFT_PARA = 0x22 - IFT_PDP = 0xff IFT_PFLOG = 0xf5 + IFT_PFLOW = 0xf9 IFT_PFSYNC = 0xf6 - IFT_PKTAP = 0xfe + IFT_PLC = 0xae + IFT_PON155 = 0xcf + IFT_PON622 = 0xd0 + IFT_POS = 0xab IFT_PPP = 0x17 + IFT_PPPMULTILINKBUNDLE = 0x6c + IFT_PROPATM = 0xc5 + IFT_PROPBWAP2MP = 0xb8 + IFT_PROPCNLS = 0x59 + IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5 + IFT_PROPDOCSWIRELESSMACLAYER = 0xb4 + IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6 IFT_PROPMUX = 0x36 IFT_PROPVIRTUAL = 0x35 + IFT_PROPWIRELESSP2P = 0x9d IFT_PTPSERIAL = 0x16 + IFT_PVC = 0xf2 + IFT_Q2931 = 0xc9 + IFT_QLLC = 0x44 + IFT_RADIOMAC = 0xbc + IFT_RADSL = 0x5f + IFT_REACHDSL = 0xc0 + IFT_RFC1483 = 0x9f IFT_RS232 = 0x21 + IFT_RSRB = 0x4f IFT_SDLC = 0x11 + IFT_SDSL = 0x60 + IFT_SHDSL = 0xa9 IFT_SIP = 0x1f + IFT_SIPSIG = 0xcc + IFT_SIPTG = 0xcb IFT_SLIP = 0x1c IFT_SMDSDXI = 0x2b IFT_SMDSICIP = 0x34 IFT_SONET = 0x27 + IFT_SONETOVERHEADCHANNEL = 0xb9 IFT_SONETPATH = 0x32 IFT_SONETVT = 0x33 + IFT_SRP = 0x97 + IFT_SS7SIGLINK = 0x9c + IFT_STACKTOSTACK = 0x6f IFT_STARLAN = 0xb - IFT_STF = 0x39 IFT_T1 = 0x12 + IFT_TDLC = 0x74 + IFT_TELINK = 0xc8 + IFT_TERMPAD = 0x5b + IFT_TR008 = 0xb0 + IFT_TRANSPHDLC = 0x7b + IFT_TUNNEL = 0x83 IFT_ULTRA = 0x1d + IFT_USB = 0xa0 + IFT_V11 = 0x40 IFT_V35 = 0x2d + IFT_V36 = 0x41 + IFT_V37 = 0x78 + IFT_VDSL = 0x61 + IFT_VIRTUALIPADDRESS = 0x70 + IFT_VIRTUALTG = 0xca + IFT_VOICEDID = 0xd5 + IFT_VOICEEM = 0x64 + IFT_VOICEEMFGD = 0xd3 + IFT_VOICEENCAP = 0x67 + IFT_VOICEFGDEANA = 0xd4 + IFT_VOICEFXO = 0x65 + IFT_VOICEFXS = 0x66 + IFT_VOICEOVERATM = 0x98 + IFT_VOICEOVERCABLE = 0xc6 + IFT_VOICEOVERFRAMERELAY = 0x99 + IFT_VOICEOVERIP = 0x68 + IFT_X213 = 0x5d IFT_X25 = 0x5 IFT_X25DDN = 0x4 + IFT_X25HUNTGROUP = 0x7a + IFT_X25MLP = 0x79 IFT_X25PLE = 0x28 IFT_XETHER = 0x1a IGNBRK = 0x1 @@ -645,239 +822,155 @@ const ( IN_CLASSD_HOST = 0xfffffff IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 0x1c - IN_LINKLOCALNETNUM = 0xa9fe0000 IN_LOOPBACKNET = 0x7f - IPPROTO_3PC = 0x22 - IPPROTO_ADFS = 0x44 + IN_RFC3021_HOST = 0x1 + IN_RFC3021_NET = 0xfffffffe + IN_RFC3021_NSHIFT = 0x1f IPPROTO_AH = 0x33 - IPPROTO_AHIP = 0x3d - IPPROTO_APES = 0x63 - IPPROTO_ARGUS = 0xd - IPPROTO_AX25 = 0x5d - IPPROTO_BHA = 0x31 - IPPROTO_BLT = 0x1e - IPPROTO_BRSATMON = 0x4c - IPPROTO_CFTP = 0x3e - IPPROTO_CHAOS = 0x10 - IPPROTO_CMTP = 0x26 - IPPROTO_CPHB = 0x49 - IPPROTO_CPNX = 0x48 - IPPROTO_DDP = 0x25 - IPPROTO_DGP = 0x56 - IPPROTO_DIVERT = 0xfe + IPPROTO_CARP = 0x70 + IPPROTO_DIVERT = 0x102 IPPROTO_DONE = 0x101 IPPROTO_DSTOPTS = 0x3c IPPROTO_EGP = 0x8 - IPPROTO_EMCON = 0xe IPPROTO_ENCAP = 0x62 IPPROTO_EON = 0x50 IPPROTO_ESP = 0x32 IPPROTO_ETHERIP = 0x61 IPPROTO_FRAGMENT = 0x2c IPPROTO_GGP = 0x3 - IPPROTO_GMTP = 0x64 IPPROTO_GRE = 0x2f - IPPROTO_HELLO = 0x3f - IPPROTO_HMP = 0x14 IPPROTO_HOPOPTS = 0x0 IPPROTO_ICMP = 0x1 IPPROTO_ICMPV6 = 0x3a IPPROTO_IDP = 0x16 - IPPROTO_IDPR = 0x23 - IPPROTO_IDRP = 0x2d IPPROTO_IGMP = 0x2 - IPPROTO_IGP = 0x55 - IPPROTO_IGRP = 0x58 - IPPROTO_IL = 0x28 - IPPROTO_INLSP = 0x34 - IPPROTO_INP = 0x20 IPPROTO_IP = 0x0 IPPROTO_IPCOMP = 0x6c - IPPROTO_IPCV = 0x47 - IPPROTO_IPEIP = 0x5e IPPROTO_IPIP = 0x4 - IPPROTO_IPPC = 0x43 IPPROTO_IPV4 = 0x4 IPPROTO_IPV6 = 0x29 - IPPROTO_IRTP = 0x1c - IPPROTO_KRYPTOLAN = 0x41 - IPPROTO_LARP = 0x5b - IPPROTO_LEAF1 = 0x19 - IPPROTO_LEAF2 = 0x1a IPPROTO_MAX = 0x100 - IPPROTO_MAXID = 0x34 - IPPROTO_MEAS = 0x13 - IPPROTO_MHRP = 0x30 - IPPROTO_MICP = 0x5f - IPPROTO_MTP = 0x5c - IPPROTO_MUX = 0x12 - IPPROTO_ND = 0x4d - IPPROTO_NHRP = 0x36 + IPPROTO_MAXID = 0x103 + IPPROTO_MOBILE = 0x37 + IPPROTO_MPLS = 0x89 IPPROTO_NONE = 0x3b - IPPROTO_NSP = 0x1f - IPPROTO_NVPII = 0xb - IPPROTO_OSPFIGP = 0x59 - IPPROTO_PGM = 0x71 - IPPROTO_PIGP = 0x9 + IPPROTO_PFSYNC = 0xf0 IPPROTO_PIM = 0x67 - IPPROTO_PRM = 0x15 IPPROTO_PUP = 0xc - IPPROTO_PVP = 0x4b IPPROTO_RAW = 0xff - IPPROTO_RCCMON = 0xa - IPPROTO_RDP = 0x1b IPPROTO_ROUTING = 0x2b IPPROTO_RSVP = 0x2e - IPPROTO_RVD = 0x42 - IPPROTO_SATEXPAK = 0x40 - IPPROTO_SATMON = 0x45 - IPPROTO_SCCSP = 0x60 - IPPROTO_SCTP = 0x84 - IPPROTO_SDRP = 0x2a - IPPROTO_SEP = 0x21 - IPPROTO_SRPC = 0x5a - IPPROTO_ST = 0x7 - IPPROTO_SVMTP = 0x52 - IPPROTO_SWIPE = 0x35 - IPPROTO_TCF = 0x57 IPPROTO_TCP = 0x6 IPPROTO_TP = 0x1d - IPPROTO_TPXX = 0x27 - IPPROTO_TRUNK1 = 0x17 - IPPROTO_TRUNK2 = 0x18 - IPPROTO_TTP = 0x54 IPPROTO_UDP = 0x11 - IPPROTO_VINES = 0x53 - IPPROTO_VISA = 0x46 - IPPROTO_VMTP = 0x51 - IPPROTO_WBEXPAK = 0x4f - IPPROTO_WBMON = 0x4e - IPPROTO_WSN = 0x4a - IPPROTO_XNET = 0xf - IPPROTO_XTP = 0x24 - IPV6_2292DSTOPTS = 0x17 - IPV6_2292HOPLIMIT = 0x14 - IPV6_2292HOPOPTS = 0x16 - IPV6_2292NEXTHOP = 0x15 - IPV6_2292PKTINFO = 0x13 - IPV6_2292PKTOPTIONS = 0x19 - IPV6_2292RTHDR = 0x18 - IPV6_BINDV6ONLY = 0x1b - IPV6_BOUND_IF = 0x7d + IPPROTO_UDPLITE = 0x88 + IPV6_AUTH_LEVEL = 0x35 + IPV6_AUTOFLOWLABEL = 0x3b IPV6_CHECKSUM = 0x1a IPV6_DEFAULT_MULTICAST_HOPS = 0x1 IPV6_DEFAULT_MULTICAST_LOOP = 0x1 IPV6_DEFHLIM = 0x40 + IPV6_DONTFRAG = 0x3e + IPV6_DSTOPTS = 0x32 + IPV6_ESP_NETWORK_LEVEL = 0x37 + IPV6_ESP_TRANS_LEVEL = 0x36 IPV6_FAITH = 0x1d - IPV6_FLOWINFO_MASK = 0xffffff0f - IPV6_FLOWLABEL_MASK = 0xffff0f00 - IPV6_FLOW_ECN_MASK = 0x300 - IPV6_FRAGTTL = 0x3c - IPV6_FW_ADD = 0x1e - IPV6_FW_DEL = 0x1f - IPV6_FW_FLUSH = 0x20 - IPV6_FW_GET = 0x22 - IPV6_FW_ZERO = 0x21 + IPV6_FLOWINFO_MASK = 0xfffffff + IPV6_FLOWLABEL_MASK = 0xfffff + IPV6_FRAGTTL = 0x78 IPV6_HLIMDEC = 0x1 - IPV6_IPSEC_POLICY = 0x1c + IPV6_HOPLIMIT = 0x2f + IPV6_HOPOPTS = 0x31 + IPV6_IPCOMP_LEVEL = 0x3c IPV6_JOIN_GROUP = 0xc IPV6_LEAVE_GROUP = 0xd IPV6_MAXHLIM = 0xff - IPV6_MAXOPTHDR = 0x800 IPV6_MAXPACKET = 0xffff - IPV6_MAX_GROUP_SRC_FILTER = 0x200 - IPV6_MAX_MEMBERSHIPS = 0xfff - IPV6_MAX_SOCK_SRC_FILTER = 0x80 - IPV6_MIN_MEMBERSHIPS = 0x1f + IPV6_MINHOPCOUNT = 0x41 IPV6_MMTU = 0x500 IPV6_MULTICAST_HOPS = 0xa IPV6_MULTICAST_IF = 0x9 IPV6_MULTICAST_LOOP = 0xb + IPV6_NEXTHOP = 0x30 + IPV6_OPTIONS = 0x1 + IPV6_PATHMTU = 0x2c + IPV6_PIPEX = 0x3f + IPV6_PKTINFO = 0x2e IPV6_PORTRANGE = 0xe IPV6_PORTRANGE_DEFAULT = 0x0 IPV6_PORTRANGE_HIGH = 0x1 IPV6_PORTRANGE_LOW = 0x2 - IPV6_RECVTCLASS = 0x23 + IPV6_RECVDSTOPTS = 0x28 + IPV6_RECVDSTPORT = 0x40 + IPV6_RECVHOPLIMIT = 0x25 + IPV6_RECVHOPOPTS = 0x27 + IPV6_RECVPATHMTU = 0x2b + IPV6_RECVPKTINFO = 0x24 + IPV6_RECVRTHDR = 0x26 + IPV6_RECVTCLASS = 0x39 + IPV6_RTABLE = 0x1021 + IPV6_RTHDR = 0x33 + IPV6_RTHDRDSTOPTS = 0x23 IPV6_RTHDR_LOOSE = 0x0 IPV6_RTHDR_STRICT = 0x1 IPV6_RTHDR_TYPE_0 = 0x0 IPV6_SOCKOPT_RESERVED1 = 0x3 - IPV6_TCLASS = 0x24 + IPV6_TCLASS = 0x3d IPV6_UNICAST_HOPS = 0x4 + IPV6_USE_MIN_MTU = 0x2a IPV6_V6ONLY = 0x1b IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 IP_ADD_MEMBERSHIP = 0xc - IP_ADD_SOURCE_MEMBERSHIP = 0x46 - IP_BLOCK_SOURCE = 0x48 - IP_BOUND_IF = 0x19 + IP_AUTH_LEVEL = 0x14 IP_DEFAULT_MULTICAST_LOOP = 0x1 IP_DEFAULT_MULTICAST_TTL = 0x1 IP_DF = 0x4000 IP_DROP_MEMBERSHIP = 0xd - IP_DROP_SOURCE_MEMBERSHIP = 0x47 - IP_DUMMYNET_CONFIGURE = 0x3c - IP_DUMMYNET_DEL = 0x3d - IP_DUMMYNET_FLUSH = 0x3e - IP_DUMMYNET_GET = 0x40 - IP_FAITH = 0x16 - IP_FW_ADD = 0x28 - IP_FW_DEL = 0x29 - IP_FW_FLUSH = 0x2a - IP_FW_GET = 0x2c - IP_FW_RESETLOG = 0x2d - IP_FW_ZERO = 0x2b + IP_ESP_NETWORK_LEVEL = 0x16 + IP_ESP_TRANS_LEVEL = 0x15 IP_HDRINCL = 0x2 - IP_IPSEC_POLICY = 0x15 + IP_IPCOMP_LEVEL = 0x1d + IP_IPDEFTTL = 0x25 + IP_IPSECFLOWINFO = 0x24 + IP_IPSEC_LOCAL_AUTH = 0x1b + IP_IPSEC_LOCAL_CRED = 0x19 + IP_IPSEC_LOCAL_ID = 0x17 + IP_IPSEC_REMOTE_AUTH = 0x1c + IP_IPSEC_REMOTE_CRED = 0x1a + IP_IPSEC_REMOTE_ID = 0x18 IP_MAXPACKET = 0xffff - IP_MAX_GROUP_SRC_FILTER = 0x200 IP_MAX_MEMBERSHIPS = 0xfff - IP_MAX_SOCK_MUTE_FILTER = 0x80 - IP_MAX_SOCK_SRC_FILTER = 0x80 IP_MF = 0x2000 - IP_MIN_MEMBERSHIPS = 0x1f - IP_MSFILTER = 0x4a + IP_MINTTL = 0x20 + IP_MIN_MEMBERSHIPS = 0xf IP_MSS = 0x240 IP_MULTICAST_IF = 0x9 - IP_MULTICAST_IFINDEX = 0x42 IP_MULTICAST_LOOP = 0xb IP_MULTICAST_TTL = 0xa - IP_MULTICAST_VIF = 0xe - IP_NAT__XXX = 0x37 IP_OFFMASK = 0x1fff - IP_OLD_FW_ADD = 0x32 - IP_OLD_FW_DEL = 0x33 - IP_OLD_FW_FLUSH = 0x34 - IP_OLD_FW_GET = 0x36 - IP_OLD_FW_RESETLOG = 0x38 - IP_OLD_FW_ZERO = 0x35 IP_OPTIONS = 0x1 - IP_PKTINFO = 0x1a + IP_PIPEX = 0x22 IP_PORTRANGE = 0x13 IP_PORTRANGE_DEFAULT = 0x0 IP_PORTRANGE_HIGH = 0x1 IP_PORTRANGE_LOW = 0x2 IP_RECVDSTADDR = 0x7 - IP_RECVIF = 0x14 + IP_RECVDSTPORT = 0x21 + IP_RECVIF = 0x1e IP_RECVOPTS = 0x5 - IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 - IP_RECVTOS = 0x1b - IP_RECVTTL = 0x18 + IP_RECVRTABLE = 0x23 + IP_RECVTTL = 0x1f IP_RETOPTS = 0x8 IP_RF = 0x8000 - IP_RSVP_OFF = 0x10 - IP_RSVP_ON = 0xf - IP_RSVP_VIF_OFF = 0x12 - IP_RSVP_VIF_ON = 0x11 - IP_STRIPHDR = 0x17 + IP_RTABLE = 0x1021 + IP_SENDSRCADDR = 0x7 IP_TOS = 0x3 - IP_TRAFFIC_MGT_BACKGROUND = 0x41 IP_TTL = 0x4 - IP_UNBLOCK_SOURCE = 0x49 ISIG = 0x80 ISTRIP = 0x20 - IUTF8 = 0x4000 + IUCLC = 0x1000 IXANY = 0x800 IXOFF = 0x400 IXON = 0x200 @@ -885,188 +978,140 @@ const ( KERN_OSRELEASE = 0x2 KERN_OSTYPE = 0x1 KERN_VERSION = 0x4 + LCNT_OVERLOAD_FLUSH = 0x6 LOCK_EX = 0x2 LOCK_NB = 0x4 LOCK_SH = 0x1 LOCK_UN = 0x8 - MADV_CAN_REUSE = 0x9 MADV_DONTNEED = 0x4 - MADV_FREE = 0x5 - MADV_FREE_REUSABLE = 0x7 - MADV_FREE_REUSE = 0x8 + MADV_FREE = 0x6 MADV_NORMAL = 0x0 - MADV_PAGEOUT = 0xa MADV_RANDOM = 0x1 MADV_SEQUENTIAL = 0x2 + MADV_SPACEAVAIL = 0x5 MADV_WILLNEED = 0x3 - MADV_ZERO_WIRED_PAGES = 0x6 MAP_ANON = 0x1000 MAP_ANONYMOUS = 0x1000 + MAP_CONCEAL = 0x8000 MAP_COPY = 0x2 MAP_FILE = 0x0 MAP_FIXED = 0x10 - MAP_HASSEMAPHORE = 0x200 - MAP_JIT = 0x800 - MAP_NOCACHE = 0x400 - MAP_NOEXTEND = 0x100 - MAP_NORESERVE = 0x40 + MAP_FLAGMASK = 0xfff7 + MAP_HASSEMAPHORE = 0x0 + MAP_INHERIT = 0x0 + MAP_INHERIT_COPY = 0x1 + MAP_INHERIT_NONE = 0x2 + MAP_INHERIT_SHARE = 0x0 + MAP_INHERIT_ZERO = 0x3 + MAP_NOEXTEND = 0x0 + MAP_NORESERVE = 0x0 MAP_PRIVATE = 0x2 - MAP_RENAME = 0x20 - MAP_RESERVED0080 = 0x80 - MAP_RESILIENT_CODESIGN = 0x2000 - MAP_RESILIENT_MEDIA = 0x4000 + MAP_RENAME = 0x0 MAP_SHARED = 0x1 + MAP_STACK = 0x4000 + MAP_TRYFIXED = 0x0 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x400000 - MNT_CMDFLAGS = 0xf0000 - MNT_CPROTECT = 0x80 - MNT_DEFWRITE = 0x2000000 - MNT_DONTBROWSE = 0x100000 - MNT_DOVOLFS = 0x8000 - MNT_DWAIT = 0x4 + MNT_DEFEXPORTED = 0x200 + MNT_DELEXPORT = 0x20000 + MNT_DOOMED = 0x8000000 + MNT_EXPORTANON = 0x400 MNT_EXPORTED = 0x100 + MNT_EXRDONLY = 0x80 MNT_FORCE = 0x80000 - MNT_IGNORE_OWNERSHIP = 0x200000 - MNT_JOURNALED = 0x800000 + MNT_LAZY = 0x3 MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NOATIME = 0x10000000 - MNT_NOBLOCK = 0x20000 + MNT_NOATIME = 0x8000 MNT_NODEV = 0x10 MNT_NOEXEC = 0x4 + MNT_NOPERM = 0x20 MNT_NOSUID = 0x8 - MNT_NOUSERXATTR = 0x1000000 MNT_NOWAIT = 0x2 - MNT_QUARANTINE = 0x400 MNT_QUOTA = 0x2000 MNT_RDONLY = 0x1 MNT_RELOAD = 0x40000 MNT_ROOTFS = 0x4000 + MNT_SOFTDEP = 0x4000000 + MNT_STALLED = 0x100000 + MNT_SWAPPABLE = 0x200000 MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UNKNOWNPERMISSIONS = 0x200000 MNT_UPDATE = 0x10000 - MNT_VISFLAGMASK = 0x17f0f5ff + MNT_VISFLAGMASK = 0x400ffff MNT_WAIT = 0x1 + MNT_WANTRDWR = 0x2000000 + MNT_WXALLOWED = 0x800 + MSG_BCAST = 0x100 + MSG_CMSG_CLOEXEC = 0x800 MSG_CTRUNC = 0x20 MSG_DONTROUTE = 0x4 MSG_DONTWAIT = 0x80 - MSG_EOF = 0x100 MSG_EOR = 0x8 - MSG_FLUSH = 0x400 - MSG_HAVEMORE = 0x2000 - MSG_HOLD = 0x800 - MSG_NEEDSA = 0x10000 + MSG_MCAST = 0x200 + MSG_NOSIGNAL = 0x400 MSG_OOB = 0x1 MSG_PEEK = 0x2 - MSG_RCVMORE = 0x4000 - MSG_SEND = 0x1000 MSG_TRUNC = 0x10 MSG_WAITALL = 0x40 - MSG_WAITSTREAM = 0x200 MS_ASYNC = 0x1 - MS_DEACTIVATE = 0x8 - MS_INVALIDATE = 0x2 - MS_KILLPAGES = 0x4 - MS_SYNC = 0x10 + MS_INVALIDATE = 0x4 + MS_SYNC = 0x2 NAME_MAX = 0xff NET_RT_DUMP = 0x1 - NET_RT_DUMP2 = 0x7 NET_RT_FLAGS = 0x2 NET_RT_IFLIST = 0x3 - NET_RT_IFLIST2 = 0x6 - NET_RT_MAXID = 0xa - NET_RT_STAT = 0x4 - NET_RT_TRASH = 0x5 + NET_RT_IFNAMES = 0x6 + NET_RT_MAXID = 0x7 + NET_RT_STATS = 0x4 + NET_RT_TABLE = 0x5 NFDBITS = 0x20 - NL0 = 0x0 - NL1 = 0x100 - NL2 = 0x200 - NL3 = 0x300 - NLDLY = 0x300 NOFLSH = 0x80000000 NOKERNINFO = 0x2000000 - NOTE_ABSOLUTE = 0x8 NOTE_ATTRIB = 0x8 - NOTE_BACKGROUND = 0x40 + NOTE_CHANGE = 0x1 NOTE_CHILD = 0x4 - NOTE_CRITICAL = 0x20 NOTE_DELETE = 0x1 + NOTE_EOF = 0x2 NOTE_EXEC = 0x20000000 NOTE_EXIT = 0x80000000 - NOTE_EXITSTATUS = 0x4000000 - NOTE_EXIT_CSERROR = 0x40000 - NOTE_EXIT_DECRYPTFAIL = 0x10000 - NOTE_EXIT_DETAIL = 0x2000000 - NOTE_EXIT_DETAIL_MASK = 0x70000 - NOTE_EXIT_MEMORY = 0x20000 - NOTE_EXIT_REPARENTED = 0x80000 NOTE_EXTEND = 0x4 - NOTE_FFAND = 0x40000000 - NOTE_FFCOPY = 0xc0000000 - NOTE_FFCTRLMASK = 0xc0000000 - NOTE_FFLAGSMASK = 0xffffff - NOTE_FFNOP = 0x0 - NOTE_FFOR = 0x80000000 NOTE_FORK = 0x40000000 - NOTE_FUNLOCK = 0x100 - NOTE_LEEWAY = 0x10 NOTE_LINK = 0x10 NOTE_LOWAT = 0x1 - NOTE_MACH_CONTINUOUS_TIME = 0x80 - NOTE_NONE = 0x80 - NOTE_NSECONDS = 0x4 - NOTE_OOB = 0x2 - NOTE_PCTRLMASK = -0x100000 + NOTE_PCTRLMASK = 0xf0000000 NOTE_PDATAMASK = 0xfffff - NOTE_REAP = 0x10000000 NOTE_RENAME = 0x20 NOTE_REVOKE = 0x40 - NOTE_SECONDS = 0x1 - NOTE_SIGNAL = 0x8000000 NOTE_TRACK = 0x1 NOTE_TRACKERR = 0x2 - NOTE_TRIGGER = 0x1000000 - NOTE_USECONDS = 0x2 - NOTE_VM_ERROR = 0x10000000 - NOTE_VM_PRESSURE = 0x80000000 - NOTE_VM_PRESSURE_SUDDEN_TERMINATE = 0x20000000 - NOTE_VM_PRESSURE_TERMINATE = 0x40000000 + NOTE_TRUNCATE = 0x80 NOTE_WRITE = 0x2 OCRNL = 0x10 - OFDEL = 0x20000 - OFILL = 0x80 + OLCUC = 0x20 ONLCR = 0x2 - ONLRET = 0x40 - ONOCR = 0x20 + ONLRET = 0x80 + ONOCR = 0x40 ONOEOT = 0x8 OPOST = 0x1 OXTABS = 0x4 O_ACCMODE = 0x3 - O_ALERT = 0x20000000 O_APPEND = 0x8 O_ASYNC = 0x40 - O_CLOEXEC = 0x1000000 + O_CLOEXEC = 0x10000 O_CREAT = 0x200 - O_DIRECTORY = 0x100000 - O_DP_GETRAWENCRYPTED = 0x1 - O_DP_GETRAWUNENCRYPTED = 0x2 - O_DSYNC = 0x400000 - O_EVTONLY = 0x8000 + O_DIRECTORY = 0x20000 + O_DSYNC = 0x80 O_EXCL = 0x800 O_EXLOCK = 0x20 O_FSYNC = 0x80 O_NDELAY = 0x4 - O_NOCTTY = 0x20000 + O_NOCTTY = 0x8000 O_NOFOLLOW = 0x100 O_NONBLOCK = 0x4 - O_POPUP = 0x80000000 O_RDONLY = 0x0 O_RDWR = 0x2 + O_RSYNC = 0x80 O_SHLOCK = 0x10 - O_SYMLINK = 0x200000 O_SYNC = 0x80 O_TRUNC = 0x400 O_WRONLY = 0x1 @@ -1074,6 +1119,7 @@ const ( PARMRK = 0x8 PARODD = 0x2000 PENDIN = 0x20000000 + PF_FLUSH = 0x1 PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 PRIO_USER = 0x2 @@ -1081,28 +1127,8 @@ const ( PROT_NONE = 0x0 PROT_READ = 0x1 PROT_WRITE = 0x2 - PT_ATTACH = 0xa - PT_ATTACHEXC = 0xe - PT_CONTINUE = 0x7 - PT_DENY_ATTACH = 0x1f - PT_DETACH = 0xb - PT_FIRSTMACH = 0x20 - PT_FORCEQUOTA = 0x1e - PT_KILL = 0x8 - PT_READ_D = 0x2 - PT_READ_I = 0x1 - PT_READ_U = 0x3 - PT_SIGEXC = 0xc - PT_STEP = 0x9 - PT_THUPDATE = 0xd - PT_TRACE_ME = 0x0 - PT_WRITE_D = 0x5 - PT_WRITE_I = 0x4 - PT_WRITE_U = 0x6 - RLIMIT_AS = 0x5 RLIMIT_CORE = 0x4 RLIMIT_CPU = 0x0 - RLIMIT_CPU_USAGE_MONITOR = 0x2 RLIMIT_DATA = 0x2 RLIMIT_FSIZE = 0x1 RLIMIT_MEMLOCK = 0x6 @@ -1112,67 +1138,80 @@ const ( RLIMIT_STACK = 0x3 RLIM_INFINITY = 0x7fffffffffffffff RTAX_AUTHOR = 0x6 + RTAX_BFD = 0xb RTAX_BRD = 0x7 + RTAX_DNS = 0xc RTAX_DST = 0x0 RTAX_GATEWAY = 0x1 RTAX_GENMASK = 0x3 RTAX_IFA = 0x5 RTAX_IFP = 0x4 - RTAX_MAX = 0x8 + RTAX_LABEL = 0xa + RTAX_MAX = 0xf RTAX_NETMASK = 0x2 + RTAX_SEARCH = 0xe + RTAX_SRC = 0x8 + RTAX_SRCMASK = 0x9 + RTAX_STATIC = 0xd RTA_AUTHOR = 0x40 + RTA_BFD = 0x800 RTA_BRD = 0x80 + RTA_DNS = 0x1000 RTA_DST = 0x1 RTA_GATEWAY = 0x2 RTA_GENMASK = 0x8 RTA_IFA = 0x20 RTA_IFP = 0x10 + RTA_LABEL = 0x400 RTA_NETMASK = 0x4 + RTA_SEARCH = 0x4000 + RTA_SRC = 0x100 + RTA_SRCMASK = 0x200 + RTA_STATIC = 0x2000 + RTF_ANNOUNCE = 0x4000 + RTF_BFD = 0x1000000 RTF_BLACKHOLE = 0x1000 RTF_BROADCAST = 0x400000 + RTF_CACHED = 0x20000 + RTF_CLONED = 0x10000 RTF_CLONING = 0x100 - RTF_CONDEMNED = 0x2000000 - RTF_DELCLONE = 0x80 + RTF_CONNECTED = 0x800000 RTF_DONE = 0x40 RTF_DYNAMIC = 0x10 + RTF_FMASK = 0x110fc08 RTF_GATEWAY = 0x2 RTF_HOST = 0x4 - RTF_IFREF = 0x4000000 - RTF_IFSCOPE = 0x1000000 RTF_LLINFO = 0x400 RTF_LOCAL = 0x200000 RTF_MODIFIED = 0x20 - RTF_MULTICAST = 0x800000 - RTF_NOIFREF = 0x2000 - RTF_PINNED = 0x100000 - RTF_PRCLONING = 0x10000 + RTF_MPATH = 0x40000 + RTF_MPLS = 0x100000 + RTF_MULTICAST = 0x200 + RTF_PERMANENT_ARP = 0x2000 RTF_PROTO1 = 0x8000 RTF_PROTO2 = 0x4000 - RTF_PROTO3 = 0x40000 - RTF_PROXY = 0x8000000 + RTF_PROTO3 = 0x2000 RTF_REJECT = 0x8 - RTF_ROUTER = 0x10000000 RTF_STATIC = 0x800 RTF_UP = 0x1 - RTF_WASCLONED = 0x20000 - RTF_XRESOLVE = 0x200 + RTF_USETRAILERS = 0x8000 + RTM_80211INFO = 0x15 RTM_ADD = 0x1 + RTM_BFD = 0x12 RTM_CHANGE = 0x3 + RTM_CHGADDRATTR = 0x14 RTM_DELADDR = 0xd RTM_DELETE = 0x2 - RTM_DELMADDR = 0x10 + RTM_DESYNC = 0x10 RTM_GET = 0x4 - RTM_GET2 = 0x14 + RTM_IFANNOUNCE = 0xf RTM_IFINFO = 0xe - RTM_IFINFO2 = 0x12 - RTM_LOCK = 0x8 + RTM_INVALIDATE = 0x11 RTM_LOSING = 0x5 + RTM_MAXSIZE = 0x800 RTM_MISS = 0x7 RTM_NEWADDR = 0xc - RTM_NEWMADDR = 0xf - RTM_NEWMADDR2 = 0x13 - RTM_OLDADD = 0x9 - RTM_OLDDEL = 0xa + RTM_PROPOSAL = 0x13 RTM_REDIRECT = 0x6 RTM_RESOLVE = 0xb RTM_RTTUNIT = 0xf4240 @@ -1185,83 +1224,169 @@ const ( RTV_RTTVAR = 0x80 RTV_SPIPE = 0x10 RTV_SSTHRESH = 0x20 + RT_TABLEID_BITS = 0x8 + RT_TABLEID_MASK = 0xff + RT_TABLEID_MAX = 0xff RUSAGE_CHILDREN = -0x1 RUSAGE_SELF = 0x0 - SCM_CREDS = 0x3 + RUSAGE_THREAD = 0x1 SCM_RIGHTS = 0x1 - SCM_TIMESTAMP = 0x2 - SCM_TIMESTAMP_MONOTONIC = 0x4 + SCM_TIMESTAMP = 0x4 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 SIOCADDMULTI = 0x80206931 SIOCAIFADDR = 0x8040691a - SIOCARPIPLL = 0xc0206928 + SIOCAIFGROUP = 0x80286987 SIOCATMARK = 0x40047307 - SIOCAUTOADDR = 0xc0206926 - SIOCAUTONETMASK = 0x80206927 + SIOCBRDGADD = 0x8060693c + SIOCBRDGADDL = 0x80606949 + SIOCBRDGADDS = 0x80606941 + SIOCBRDGARL = 0x808c694d + SIOCBRDGDADDR = 0x81286947 + SIOCBRDGDEL = 0x8060693d + SIOCBRDGDELS = 0x80606942 + SIOCBRDGFLUSH = 0x80606948 + SIOCBRDGFRL = 0x808c694e + SIOCBRDGGCACHE = 0xc0186941 + SIOCBRDGGFD = 0xc0186952 + SIOCBRDGGHT = 0xc0186951 + SIOCBRDGGIFFLGS = 0xc060693e + SIOCBRDGGMA = 0xc0186953 + SIOCBRDGGPARAM = 0xc0406958 + SIOCBRDGGPRI = 0xc0186950 + SIOCBRDGGRL = 0xc030694f + SIOCBRDGGTO = 0xc0186946 + SIOCBRDGIFS = 0xc0606942 + SIOCBRDGRTS = 0xc0206943 + SIOCBRDGSADDR = 0xc1286944 + SIOCBRDGSCACHE = 0x80186940 + SIOCBRDGSFD = 0x80186952 + SIOCBRDGSHT = 0x80186951 + SIOCBRDGSIFCOST = 0x80606955 + SIOCBRDGSIFFLGS = 0x8060693f + SIOCBRDGSIFPRIO = 0x80606954 + SIOCBRDGSIFPROT = 0x8060694a + SIOCBRDGSMA = 0x80186953 + SIOCBRDGSPRI = 0x80186950 + SIOCBRDGSPROTO = 0x8018695a + SIOCBRDGSTO = 0x80186945 + SIOCBRDGSTXHC = 0x80186959 + SIOCDELLABEL = 0x80206997 SIOCDELMULTI = 0x80206932 SIOCDIFADDR = 0x80206919 - SIOCDIFPHYADDR = 0x80206941 - SIOCGDRVSPEC = 0xc01c697b - SIOCGETVLAN = 0xc020697f - SIOCGHIWAT = 0x40047301 + SIOCDIFGROUP = 0x80286989 + SIOCDIFPARENT = 0x802069b4 + SIOCDIFPHYADDR = 0x80206949 + SIOCDPWE3NEIGHBOR = 0x802069de + SIOCDVNETID = 0x802069af + SIOCGETKALIVE = 0xc01869a4 + SIOCGETLABEL = 0x8020699a + SIOCGETMPWCFG = 0xc02069ae + SIOCGETPFLOW = 0xc02069fe + SIOCGETPFSYNC = 0xc02069f8 + SIOCGETSGCNT = 0xc0207534 + SIOCGETVIFCNT = 0xc0287533 + SIOCGETVLAN = 0xc0206990 SIOCGIFADDR = 0xc0206921 - SIOCGIFALTMTU = 0xc0206948 - SIOCGIFASYNCMAP = 0xc020697c - SIOCGIFBOND = 0xc0206947 SIOCGIFBRDADDR = 0xc0206923 - SIOCGIFCAP = 0xc020695b - SIOCGIFCONF = 0xc0086924 - SIOCGIFDEVMTU = 0xc0206944 + SIOCGIFCONF = 0xc0106924 + SIOCGIFDATA = 0xc020691b + SIOCGIFDESCR = 0xc0206981 SIOCGIFDSTADDR = 0xc0206922 SIOCGIFFLAGS = 0xc0206911 + SIOCGIFGATTR = 0xc028698b SIOCGIFGENERIC = 0xc020693a - SIOCGIFKPI = 0xc0206987 - SIOCGIFMAC = 0xc0206982 - SIOCGIFMEDIA = 0xc0286938 + SIOCGIFGLIST = 0xc028698d + SIOCGIFGMEMB = 0xc028698a + SIOCGIFGROUP = 0xc0286988 + SIOCGIFHARDMTU = 0xc02069a5 + SIOCGIFLLPRIO = 0xc02069b6 + SIOCGIFMEDIA = 0xc0406938 SIOCGIFMETRIC = 0xc0206917 - SIOCGIFMTU = 0xc0206933 + SIOCGIFMTU = 0xc020697e SIOCGIFNETMASK = 0xc0206925 - SIOCGIFPDSTADDR = 0xc0206940 - SIOCGIFPHYS = 0xc0206935 - SIOCGIFPSRCADDR = 0xc020693f - SIOCGIFSTATUS = 0xc331693d - SIOCGIFVLAN = 0xc020697f - SIOCGIFWAKEFLAGS = 0xc0206988 - SIOCGLOWAT = 0x40047303 + SIOCGIFPAIR = 0xc02069b1 + SIOCGIFPARENT = 0xc02069b3 + SIOCGIFPRIORITY = 0xc020699c + SIOCGIFRDOMAIN = 0xc02069a0 + SIOCGIFRTLABEL = 0xc0206983 + SIOCGIFRXR = 0x802069aa + SIOCGIFSFFPAGE = 0xc1126939 + SIOCGIFXFLAGS = 0xc020699e + SIOCGLIFPHYADDR = 0xc218694b + SIOCGLIFPHYDF = 0xc02069c2 + SIOCGLIFPHYECN = 0xc02069c8 + SIOCGLIFPHYRTABLE = 0xc02069a2 + SIOCGLIFPHYTTL = 0xc02069a9 SIOCGPGRP = 0x40047309 - SIOCIFCREATE = 0xc0206978 - SIOCIFCREATE2 = 0xc020697a + SIOCGPWE3 = 0xc0206998 + SIOCGPWE3CTRLWORD = 0xc02069dc + SIOCGPWE3FAT = 0xc02069dd + SIOCGPWE3NEIGHBOR = 0xc21869de + SIOCGRXHPRIO = 0xc02069db + SIOCGSPPPPARAMS = 0xc0206994 + SIOCGTXHPRIO = 0xc02069c6 + SIOCGUMBINFO = 0xc02069be + SIOCGUMBPARAM = 0xc02069c0 + SIOCGVH = 0xc02069f6 + SIOCGVNETFLOWID = 0xc02069c4 + SIOCGVNETID = 0xc02069a7 + SIOCIFAFATTACH = 0x801169ab + SIOCIFAFDETACH = 0x801169ac + SIOCIFCREATE = 0x8020697a SIOCIFDESTROY = 0x80206979 - SIOCIFGCLONERS = 0xc00c6981 - SIOCRSLVMULTI = 0xc008693b - SIOCSDRVSPEC = 0x801c697b - SIOCSETVLAN = 0x8020697e - SIOCSHIWAT = 0x80047300 + SIOCIFGCLONERS = 0xc0106978 + SIOCSETKALIVE = 0x801869a3 + SIOCSETLABEL = 0x80206999 + SIOCSETMPWCFG = 0x802069ad + SIOCSETPFLOW = 0x802069fd + SIOCSETPFSYNC = 0x802069f7 + SIOCSETVLAN = 0x8020698f SIOCSIFADDR = 0x8020690c - SIOCSIFALTMTU = 0x80206945 - SIOCSIFASYNCMAP = 0x8020697d - SIOCSIFBOND = 0x80206946 SIOCSIFBRDADDR = 0x80206913 - SIOCSIFCAP = 0x8020695a + SIOCSIFDESCR = 0x80206980 SIOCSIFDSTADDR = 0x8020690e SIOCSIFFLAGS = 0x80206910 + SIOCSIFGATTR = 0x8028698c SIOCSIFGENERIC = 0x80206939 - SIOCSIFKPI = 0x80206986 - SIOCSIFLLADDR = 0x8020693c - SIOCSIFMAC = 0x80206983 + SIOCSIFLLADDR = 0x8020691f + SIOCSIFLLPRIO = 0x802069b5 SIOCSIFMEDIA = 0xc0206937 SIOCSIFMETRIC = 0x80206918 - SIOCSIFMTU = 0x80206934 + SIOCSIFMTU = 0x8020697f SIOCSIFNETMASK = 0x80206916 - SIOCSIFPHYADDR = 0x8040693e - SIOCSIFPHYS = 0x80206936 - SIOCSIFVLAN = 0x8020697e - SIOCSLOWAT = 0x80047302 + SIOCSIFPAIR = 0x802069b0 + SIOCSIFPARENT = 0x802069b2 + SIOCSIFPRIORITY = 0x8020699b + SIOCSIFRDOMAIN = 0x8020699f + SIOCSIFRTLABEL = 0x80206982 + SIOCSIFXFLAGS = 0x8020699d + SIOCSLIFPHYADDR = 0x8218694a + SIOCSLIFPHYDF = 0x802069c1 + SIOCSLIFPHYECN = 0x802069c7 + SIOCSLIFPHYRTABLE = 0x802069a1 + SIOCSLIFPHYTTL = 0x802069a8 SIOCSPGRP = 0x80047308 + SIOCSPWE3CTRLWORD = 0x802069dc + SIOCSPWE3FAT = 0x802069dd + SIOCSPWE3NEIGHBOR = 0x821869de + SIOCSRXHPRIO = 0x802069db + SIOCSSPPPPARAMS = 0x80206993 + SIOCSTXHPRIO = 0x802069c5 + SIOCSUMBPARAM = 0x802069bf + SIOCSVH = 0xc02069f5 + SIOCSVNETFLOWID = 0x802069c3 + SIOCSVNETID = 0x802069a6 + SIOCSWGDPID = 0xc018695b + SIOCSWGMAXFLOW = 0xc0186960 + SIOCSWGMAXGROUP = 0xc018695d + SIOCSWSDPID = 0x8018695c + SIOCSWSPORTNO = 0xc060695f + SOCK_CLOEXEC = 0x8000 SOCK_DGRAM = 0x2 - SOCK_MAXADDRLEN = 0xff + SOCK_DNS = 0x1000 + SOCK_NONBLOCK = 0x4000 SOCK_RAW = 0x3 SOCK_RDM = 0x4 SOCK_SEQPACKET = 0x5 @@ -1269,44 +1394,33 @@ const ( SOL_SOCKET = 0xffff SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x2 + SO_BINDANY = 0x1000 SO_BROADCAST = 0x20 SO_DEBUG = 0x1 + SO_DOMAIN = 0x1024 SO_DONTROUTE = 0x10 - SO_DONTTRUNC = 0x2000 SO_ERROR = 0x1007 SO_KEEPALIVE = 0x8 - SO_LABEL = 0x1010 SO_LINGER = 0x80 - SO_LINGER_SEC = 0x1080 - SO_NETSVC_MARKING_LEVEL = 0x1119 - SO_NET_SERVICE_TYPE = 0x1116 - SO_NKE = 0x1021 - SO_NOADDRERR = 0x1023 - SO_NOSIGPIPE = 0x1022 - SO_NOTIFYCONFLICT = 0x1026 - SO_NP_EXTENSIONS = 0x1083 - SO_NREAD = 0x1020 - SO_NUMRCVPKT = 0x1112 - SO_NWRITE = 0x1024 + SO_NETPROC = 0x1020 SO_OOBINLINE = 0x100 - SO_PEERLABEL = 0x1011 - SO_RANDOMPORT = 0x1082 + SO_PEERCRED = 0x1022 + SO_PROTOCOL = 0x1025 SO_RCVBUF = 0x1002 SO_RCVLOWAT = 0x1004 SO_RCVTIMEO = 0x1006 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 - SO_REUSESHAREUID = 0x1025 + SO_RTABLE = 0x1021 SO_SNDBUF = 0x1001 SO_SNDLOWAT = 0x1003 SO_SNDTIMEO = 0x1005 - SO_TIMESTAMP = 0x400 - SO_TIMESTAMP_MONOTONIC = 0x800 + SO_SPLICE = 0x1023 + SO_TIMESTAMP = 0x800 SO_TYPE = 0x1008 - SO_UPCALLCLOSEWAIT = 0x1027 SO_USELOOPBACK = 0x40 - SO_WANTMORE = 0x4000 - SO_WANTOOBFLAG = 0x8000 + SO_ZEROIZE = 0x2000 + S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 S_IFCHR = 0x2000 @@ -1316,7 +1430,6 @@ const ( S_IFMT = 0xf000 S_IFREG = 0x8000 S_IFSOCK = 0xc000 - S_IFWHT = 0xe000 S_IREAD = 0x100 S_IRGRP = 0x20 S_IROTH = 0x4 @@ -1335,11 +1448,6 @@ const ( S_IXGRP = 0x8 S_IXOTH = 0x1 S_IXUSR = 0x40 - TAB0 = 0x0 - TAB1 = 0x400 - TAB2 = 0x800 - TAB3 = 0x4 - TABDLY = 0xc04 TCIFLUSH = 0x1 TCIOFF = 0x3 TCIOFLUSH = 0x3 @@ -1347,52 +1455,46 @@ const ( TCOFLUSH = 0x2 TCOOFF = 0x1 TCOON = 0x2 - TCP_CONNECTIONTIMEOUT = 0x20 - TCP_CONNECTION_INFO = 0x106 - TCP_ENABLE_ECN = 0x104 - TCP_FASTOPEN = 0x105 - TCP_KEEPALIVE = 0x10 - TCP_KEEPCNT = 0x102 - TCP_KEEPINTVL = 0x101 - TCP_MAXHLEN = 0x3c - TCP_MAXOLEN = 0x28 + TCP_MAXBURST = 0x4 TCP_MAXSEG = 0x2 TCP_MAXWIN = 0xffff - TCP_MAX_SACK = 0x4 + TCP_MAX_SACK = 0x3 TCP_MAX_WINSHIFT = 0xe - TCP_MINMSS = 0xd8 + TCP_MD5SIG = 0x4 TCP_MSS = 0x200 TCP_NODELAY = 0x1 - TCP_NOOPT = 0x8 - TCP_NOPUSH = 0x4 - TCP_NOTSENT_LOWAT = 0x201 - TCP_RXT_CONNDROPTIME = 0x80 - TCP_RXT_FINDROP = 0x100 - TCP_SENDMOREACKS = 0x103 + TCP_NOPUSH = 0x10 + TCP_SACKHOLE_LIMIT = 0x80 + TCP_SACK_ENABLE = 0x8 TCSAFLUSH = 0x2 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 TIOCCBRK = 0x2000747a TIOCCDTR = 0x20007478 + TIOCCHKVERAUTH = 0x2000741e + TIOCCLRVERAUTH = 0x2000741d TIOCCONS = 0x80047462 - TIOCDCDTIMESTAMP = 0x40087458 TIOCDRAIN = 0x2000745e - TIOCDSIMICROCODE = 0x20007455 TIOCEXCL = 0x2000740d TIOCEXT = 0x80047460 + TIOCFLAG_CLOCAL = 0x2 + TIOCFLAG_CRTSCTS = 0x4 + TIOCFLAG_MDMBUF = 0x8 + TIOCFLAG_PPS = 0x10 + TIOCFLAG_SOFTCAR = 0x1 TIOCFLUSH = 0x80047410 - TIOCGDRAINWAIT = 0x40047456 TIOCGETA = 0x402c7413 TIOCGETD = 0x4004741a + TIOCGFLAGS = 0x4004745d TIOCGPGRP = 0x40047477 + TIOCGSID = 0x40047463 + TIOCGTSTAMP = 0x4010745b TIOCGWINSZ = 0x40087468 - TIOCIXOFF = 0x20007480 - TIOCIXON = 0x20007481 TIOCMBIC = 0x8004746b TIOCMBIS = 0x8004746c - TIOCMGDTRWAIT = 0x4004745a TIOCMGET = 0x4004746a - TIOCMODG = 0x40047403 - TIOCMODS = 0x80047404 - TIOCMSDTRWAIT = 0x8004745b + TIOCMODG = 0x4004746a + TIOCMODS = 0x8004746d TIOCMSET = 0x8004746d TIOCM_CAR = 0x40 TIOCM_CD = 0x40 @@ -1417,29 +1519,29 @@ const ( TIOCPKT_NOSTOP = 0x10 TIOCPKT_START = 0x8 TIOCPKT_STOP = 0x4 - TIOCPTYGNAME = 0x40807453 - TIOCPTYGRANT = 0x20007454 - TIOCPTYUNLK = 0x20007452 TIOCREMOTE = 0x80047469 TIOCSBRK = 0x2000747b - TIOCSCONS = 0x20007463 TIOCSCTTY = 0x20007461 - TIOCSDRAINWAIT = 0x80047457 TIOCSDTR = 0x20007479 TIOCSETA = 0x802c7414 TIOCSETAF = 0x802c7416 TIOCSETAW = 0x802c7415 TIOCSETD = 0x8004741b - TIOCSIG = 0x2000745f + TIOCSETVERAUTH = 0x8004741c + TIOCSFLAGS = 0x8004745c + TIOCSIG = 0x8004745f TIOCSPGRP = 0x80047476 TIOCSTART = 0x2000746e TIOCSTAT = 0x20007465 - TIOCSTI = 0x80017472 TIOCSTOP = 0x2000746f + TIOCSTSTAMP = 0x8008745a TIOCSWINSZ = 0x80087467 - TIOCTIMESTAMP = 0x40087459 TIOCUCNTL = 0x80047466 + TIOCUCNTL_CBRK = 0x7a + TIOCUCNTL_SBRK = 0x7b TOSTOP = 0x400000 + UTIME_NOW = -0x2 + UTIME_OMIT = -0x1 VDISCARD = 0xf VDSUSP = 0xb VEOF = 0x0 @@ -1450,36 +1552,33 @@ const ( VKILL = 0x5 VLNEXT = 0xe VMIN = 0x10 + VM_ANONMIN = 0x7 VM_LOADAVG = 0x2 - VM_MACHFACTOR = 0x4 - VM_MAXID = 0x6 + VM_MALLOC_CONF = 0xc + VM_MAXID = 0xd + VM_MAXSLP = 0xa VM_METER = 0x1 - VM_SWAPUSAGE = 0x5 + VM_NKMEMPAGES = 0x6 + VM_PSSTRINGS = 0x3 + VM_SWAPENCRYPT = 0x5 + VM_USPACE = 0xb + VM_UVMEXP = 0x4 + VM_VNODEMIN = 0x9 + VM_VTEXTMIN = 0x8 VQUIT = 0x9 VREPRINT = 0x6 VSTART = 0xc VSTATUS = 0x12 VSTOP = 0xd VSUSP = 0xa - VT0 = 0x0 - VT1 = 0x10000 - VTDLY = 0x10000 VTIME = 0x11 VWERASE = 0x4 - WCONTINUED = 0x10 + WALTSIG = 0x4 + WCONTINUED = 0x8 WCOREFLAG = 0x80 - WEXITED = 0x4 WNOHANG = 0x1 - WNOWAIT = 0x20 - WORDSIZE = 0x20 - WSTOPPED = 0x8 WUNTRACED = 0x2 - XATTR_CREATE = 0x2 - XATTR_NODEFAULT = 0x10 - XATTR_NOFOLLOW = 0x1 - XATTR_NOSECURITY = 0x8 - XATTR_REPLACE = 0x4 - XATTR_SHOWCOMPRESSION = 0x20 + XCASE = 0x1000000 ) // Errors @@ -1492,21 +1591,17 @@ const ( EAGAIN = syscall.Errno(0x23) EALREADY = syscall.Errno(0x25) EAUTH = syscall.Errno(0x50) - EBADARCH = syscall.Errno(0x56) - EBADEXEC = syscall.Errno(0x55) EBADF = syscall.Errno(0x9) - EBADMACHO = syscall.Errno(0x58) - EBADMSG = syscall.Errno(0x5e) + EBADMSG = syscall.Errno(0x5c) EBADRPC = syscall.Errno(0x48) EBUSY = syscall.Errno(0x10) - ECANCELED = syscall.Errno(0x59) + ECANCELED = syscall.Errno(0x58) ECHILD = syscall.Errno(0xa) ECONNABORTED = syscall.Errno(0x35) ECONNREFUSED = syscall.Errno(0x3d) ECONNRESET = syscall.Errno(0x36) EDEADLK = syscall.Errno(0xb) EDESTADDRREQ = syscall.Errno(0x27) - EDEVERR = syscall.Errno(0x53) EDOM = syscall.Errno(0x21) EDQUOT = syscall.Errno(0x45) EEXIST = syscall.Errno(0x11) @@ -1515,54 +1610,51 @@ const ( EFTYPE = syscall.Errno(0x4f) EHOSTDOWN = syscall.Errno(0x40) EHOSTUNREACH = syscall.Errno(0x41) - EIDRM = syscall.Errno(0x5a) - EILSEQ = syscall.Errno(0x5c) + EIDRM = syscall.Errno(0x59) + EILSEQ = syscall.Errno(0x54) EINPROGRESS = syscall.Errno(0x24) EINTR = syscall.Errno(0x4) EINVAL = syscall.Errno(0x16) EIO = syscall.Errno(0x5) + EIPSEC = syscall.Errno(0x52) EISCONN = syscall.Errno(0x38) EISDIR = syscall.Errno(0x15) - ELAST = syscall.Errno(0x6a) + ELAST = syscall.Errno(0x5f) ELOOP = syscall.Errno(0x3e) + EMEDIUMTYPE = syscall.Errno(0x56) EMFILE = syscall.Errno(0x18) EMLINK = syscall.Errno(0x1f) EMSGSIZE = syscall.Errno(0x28) - EMULTIHOP = syscall.Errno(0x5f) ENAMETOOLONG = syscall.Errno(0x3f) ENEEDAUTH = syscall.Errno(0x51) ENETDOWN = syscall.Errno(0x32) ENETRESET = syscall.Errno(0x34) ENETUNREACH = syscall.Errno(0x33) ENFILE = syscall.Errno(0x17) - ENOATTR = syscall.Errno(0x5d) + ENOATTR = syscall.Errno(0x53) ENOBUFS = syscall.Errno(0x37) - ENODATA = syscall.Errno(0x60) ENODEV = syscall.Errno(0x13) ENOENT = syscall.Errno(0x2) ENOEXEC = syscall.Errno(0x8) ENOLCK = syscall.Errno(0x4d) - ENOLINK = syscall.Errno(0x61) + ENOMEDIUM = syscall.Errno(0x55) ENOMEM = syscall.Errno(0xc) - ENOMSG = syscall.Errno(0x5b) - ENOPOLICY = syscall.Errno(0x67) + ENOMSG = syscall.Errno(0x5a) ENOPROTOOPT = syscall.Errno(0x2a) ENOSPC = syscall.Errno(0x1c) - ENOSR = syscall.Errno(0x62) - ENOSTR = syscall.Errno(0x63) ENOSYS = syscall.Errno(0x4e) ENOTBLK = syscall.Errno(0xf) ENOTCONN = syscall.Errno(0x39) ENOTDIR = syscall.Errno(0x14) ENOTEMPTY = syscall.Errno(0x42) - ENOTRECOVERABLE = syscall.Errno(0x68) + ENOTRECOVERABLE = syscall.Errno(0x5d) ENOTSOCK = syscall.Errno(0x26) - ENOTSUP = syscall.Errno(0x2d) + ENOTSUP = syscall.Errno(0x5b) ENOTTY = syscall.Errno(0x19) ENXIO = syscall.Errno(0x6) - EOPNOTSUPP = syscall.Errno(0x66) - EOVERFLOW = syscall.Errno(0x54) - EOWNERDEAD = syscall.Errno(0x69) + EOPNOTSUPP = syscall.Errno(0x2d) + EOVERFLOW = syscall.Errno(0x57) + EOWNERDEAD = syscall.Errno(0x5e) EPERM = syscall.Errno(0x1) EPFNOSUPPORT = syscall.Errno(0x2e) EPIPE = syscall.Errno(0x20) @@ -1570,22 +1662,18 @@ const ( EPROCUNAVAIL = syscall.Errno(0x4c) EPROGMISMATCH = syscall.Errno(0x4b) EPROGUNAVAIL = syscall.Errno(0x4a) - EPROTO = syscall.Errno(0x64) + EPROTO = syscall.Errno(0x5f) EPROTONOSUPPORT = syscall.Errno(0x2b) EPROTOTYPE = syscall.Errno(0x29) - EPWROFF = syscall.Errno(0x52) - EQFULL = syscall.Errno(0x6a) ERANGE = syscall.Errno(0x22) EREMOTE = syscall.Errno(0x47) EROFS = syscall.Errno(0x1e) ERPCMISMATCH = syscall.Errno(0x49) - ESHLIBVERS = syscall.Errno(0x57) ESHUTDOWN = syscall.Errno(0x3a) ESOCKTNOSUPPORT = syscall.Errno(0x2c) ESPIPE = syscall.Errno(0x1d) ESRCH = syscall.Errno(0x3) ESTALE = syscall.Errno(0x46) - ETIME = syscall.Errno(0x65) ETIMEDOUT = syscall.Errno(0x3c) ETOOMANYREFS = syscall.Errno(0x3b) ETXTBSY = syscall.Errno(0x1a) @@ -1617,6 +1705,7 @@ const ( SIGSTOP = syscall.Signal(0x11) SIGSYS = syscall.Signal(0xc) SIGTERM = syscall.Signal(0xf) + SIGTHR = syscall.Signal(0x20) SIGTRAP = syscall.Signal(0x5) SIGTSTP = syscall.Signal(0x12) SIGTTIN = syscall.Signal(0x15) @@ -1651,7 +1740,7 @@ var errorList = [...]struct { {13, "EACCES", "permission denied"}, {14, "EFAULT", "bad address"}, {15, "ENOTBLK", "block device required"}, - {16, "EBUSY", "resource busy"}, + {16, "EBUSY", "device busy"}, {17, "EEXIST", "file exists"}, {18, "EXDEV", "cross-device link"}, {19, "ENODEV", "operation not supported by device"}, @@ -1680,7 +1769,7 @@ var errorList = [...]struct { {42, "ENOPROTOOPT", "protocol not available"}, {43, "EPROTONOSUPPORT", "protocol not supported"}, {44, "ESOCKTNOSUPPORT", "socket type not supported"}, - {45, "ENOTSUP", "operation not supported"}, + {45, "EOPNOTSUPP", "operation not supported"}, {46, "EPFNOSUPPORT", "protocol family not supported"}, {47, "EAFNOSUPPORT", "address family not supported by protocol family"}, {48, "EADDRINUSE", "address already in use"}, @@ -1704,12 +1793,12 @@ var errorList = [...]struct { {66, "ENOTEMPTY", "directory not empty"}, {67, "EPROCLIM", "too many processes"}, {68, "EUSERS", "too many users"}, - {69, "EDQUOT", "disc quota exceeded"}, + {69, "EDQUOT", "disk quota exceeded"}, {70, "ESTALE", "stale NFS file handle"}, {71, "EREMOTE", "too many levels of remote in path"}, {72, "EBADRPC", "RPC struct is bad"}, {73, "ERPCMISMATCH", "RPC version wrong"}, - {74, "EPROGUNAVAIL", "RPC prog. not avail"}, + {74, "EPROGUNAVAIL", "RPC program not available"}, {75, "EPROGMISMATCH", "program version wrong"}, {76, "EPROCUNAVAIL", "bad procedure for program"}, {77, "ENOLCK", "no locks available"}, @@ -1717,31 +1806,20 @@ var errorList = [...]struct { {79, "EFTYPE", "inappropriate file type or format"}, {80, "EAUTH", "authentication error"}, {81, "ENEEDAUTH", "need authenticator"}, - {82, "EPWROFF", "device power is off"}, - {83, "EDEVERR", "device error"}, - {84, "EOVERFLOW", "value too large to be stored in data type"}, - {85, "EBADEXEC", "bad executable (or shared library)"}, - {86, "EBADARCH", "bad CPU type in executable"}, - {87, "ESHLIBVERS", "shared library version mismatch"}, - {88, "EBADMACHO", "malformed Mach-o file"}, - {89, "ECANCELED", "operation canceled"}, - {90, "EIDRM", "identifier removed"}, - {91, "ENOMSG", "no message of desired type"}, - {92, "EILSEQ", "illegal byte sequence"}, - {93, "ENOATTR", "attribute not found"}, - {94, "EBADMSG", "bad message"}, - {95, "EMULTIHOP", "EMULTIHOP (Reserved)"}, - {96, "ENODATA", "no message available on STREAM"}, - {97, "ENOLINK", "ENOLINK (Reserved)"}, - {98, "ENOSR", "no STREAM resources"}, - {99, "ENOSTR", "not a STREAM"}, - {100, "EPROTO", "protocol error"}, - {101, "ETIME", "STREAM ioctl timeout"}, - {102, "EOPNOTSUPP", "operation not supported on socket"}, - {103, "ENOPOLICY", "policy not found"}, - {104, "ENOTRECOVERABLE", "state not recoverable"}, - {105, "EOWNERDEAD", "previous owner died"}, - {106, "EQFULL", "interface output queue is full"}, + {82, "EIPSEC", "IPsec processing failure"}, + {83, "ENOATTR", "attribute not found"}, + {84, "EILSEQ", "illegal byte sequence"}, + {85, "ENOMEDIUM", "no medium found"}, + {86, "EMEDIUMTYPE", "wrong medium type"}, + {87, "EOVERFLOW", "value too large to be stored in data type"}, + {88, "ECANCELED", "operation canceled"}, + {89, "EIDRM", "identifier removed"}, + {90, "ENOMSG", "no message of desired type"}, + {91, "ENOTSUP", "not supported"}, + {92, "EBADMSG", "bad message"}, + {93, "ENOTRECOVERABLE", "state not recoverable"}, + {94, "EOWNERDEAD", "previous owner died"}, + {95, "ELAST", "protocol error"}, } // Signal table @@ -1781,4 +1859,5 @@ var signalList = [...]struct { {29, "SIGINFO", "information request"}, {30, "SIGUSR1", "user defined signal 1"}, {31, "SIGUSR2", "user defined signal 2"}, + {32, "SIGTHR", "thread AST"}, } diff --git a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go index 46e054ccb0..1afee6a089 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go @@ -1,6 +1,7 @@ // mkerrors.sh -m64 // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && solaris // +build amd64,solaris // Code generated by cmd/cgo -godefs; DO NOT EDIT. @@ -192,6 +193,12 @@ const ( CSTOPB = 0x40 CSUSP = 0x1a CSWTCH = 0x1a + DIOC = 0x6400 + DIOCGETB = 0x6402 + DIOCGETC = 0x6401 + DIOCGETP = 0x6408 + DIOCSETE = 0x6403 + DIOCSETP = 0x6409 DLT_AIRONET_HEADER = 0x78 DLT_APPLE_IP_OVER_IEEE1394 = 0x8a DLT_ARCNET = 0x7 @@ -290,6 +297,7 @@ const ( FF0 = 0x0 FF1 = 0x8000 FFDLY = 0x8000 + FIORDCHK = 0x6603 FLUSHALL = 0x1 FLUSHDATA = 0x0 FLUSHO = 0x2000 @@ -358,6 +366,7 @@ const ( HUPCL = 0x400 IBSHIFT = 0x10 ICANON = 0x2 + ICMP6_FILTER = 0x1 ICRNL = 0x100 IEXTEN = 0x8000 IFF_ADDRCONF = 0x80000 @@ -604,6 +613,7 @@ const ( IP_RECVPKTINFO = 0x1a IP_RECVRETOPTS = 0x6 IP_RECVSLLA = 0xa + IP_RECVTOS = 0xc IP_RECVTTL = 0xb IP_RETOPTS = 0x8 IP_REUSEADDR = 0x104 @@ -645,6 +655,14 @@ const ( MAP_SHARED = 0x1 MAP_TEXT = 0x400 MAP_TYPE = 0xf + MCAST_BLOCK_SOURCE = 0x2b + MCAST_EXCLUDE = 0x2 + MCAST_INCLUDE = 0x1 + MCAST_JOIN_GROUP = 0x29 + MCAST_JOIN_SOURCE_GROUP = 0x2d + MCAST_LEAVE_GROUP = 0x2a + MCAST_LEAVE_SOURCE_GROUP = 0x2e + MCAST_UNBLOCK_SOURCE = 0x2c MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 MSG_CTRUNC = 0x10 @@ -653,6 +671,7 @@ const ( MSG_DUPCTRL = 0x800 MSG_EOR = 0x8 MSG_MAXIOVLEN = 0x10 + MSG_NOSIGNAL = 0x200 MSG_NOTIFICATION = 0x100 MSG_OOB = 0x1 MSG_PEEK = 0x2 @@ -687,6 +706,8 @@ const ( O_APPEND = 0x8 O_CLOEXEC = 0x800000 O_CREAT = 0x100 + O_DIRECT = 0x2000000 + O_DIRECTORY = 0x1000000 O_DSYNC = 0x40 O_EXCL = 0x400 O_EXEC = 0x400000 @@ -725,7 +746,7 @@ const ( RLIMIT_FSIZE = 0x1 RLIMIT_NOFILE = 0x5 RLIMIT_STACK = 0x3 - RLIM_INFINITY = -0x3 + RLIM_INFINITY = 0xfffffffffffffffd RTAX_AUTHOR = 0x6 RTAX_BRD = 0x7 RTAX_DST = 0x0 @@ -1047,6 +1068,7 @@ const ( TCOON = 0x1 TCP_ABORT_THRESHOLD = 0x11 TCP_ANONPRIVBIND = 0x20 + TCP_CONGESTION = 0x25 TCP_CONN_ABORT_THRESHOLD = 0x13 TCP_CONN_NOTIFY_THRESHOLD = 0x12 TCP_CORK = 0x18 @@ -1076,6 +1098,8 @@ const ( TCSETSF = 0x5410 TCSETSW = 0x540f TCXONC = 0x5406 + TIMER_ABSTIME = 0x1 + TIMER_RELTIME = 0x0 TIOC = 0x5400 TIOCCBRK = 0x747a TIOCCDTR = 0x7478 diff --git a/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go new file mode 100644 index 0000000000..fc7d0506f6 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zerrors_zos_s390x.go @@ -0,0 +1,860 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +// Hand edited based on zerrors_linux_s390x.go +// TODO: auto-generate. + +package unix + +const ( + BRKINT = 0x0001 + CLOCK_MONOTONIC = 0x1 + CLOCK_PROCESS_CPUTIME_ID = 0x2 + CLOCK_REALTIME = 0x0 + CLOCK_THREAD_CPUTIME_ID = 0x3 + CS8 = 0x0030 + CSIZE = 0x0030 + ECHO = 0x00000008 + ECHONL = 0x00000001 + FD_CLOEXEC = 0x01 + FD_CLOFORK = 0x02 + FNDELAY = 0x04 + F_CLOSFD = 9 + F_CONTROL_CVT = 13 + F_DUPFD = 0 + F_DUPFD2 = 8 + F_GETFD = 1 + F_GETFL = 259 + F_GETLK = 5 + F_GETOWN = 10 + F_OK = 0x0 + F_RDLCK = 1 + F_SETFD = 2 + F_SETFL = 4 + F_SETLK = 6 + F_SETLKW = 7 + F_SETOWN = 11 + F_SETTAG = 12 + F_UNLCK = 3 + F_WRLCK = 2 + FSTYPE_ZFS = 0xe9 //"Z" + FSTYPE_HFS = 0xc8 //"H" + FSTYPE_NFS = 0xd5 //"N" + FSTYPE_TFS = 0xe3 //"T" + FSTYPE_AUTOMOUNT = 0xc1 //"A" + IP6F_MORE_FRAG = 0x0001 + IP6F_OFF_MASK = 0xfff8 + IP6F_RESERVED_MASK = 0x0006 + IP6OPT_JUMBO = 0xc2 + IP6OPT_JUMBO_LEN = 6 + IP6OPT_MUTABLE = 0x20 + IP6OPT_NSAP_ADDR = 0xc3 + IP6OPT_PAD1 = 0x00 + IP6OPT_PADN = 0x01 + IP6OPT_ROUTER_ALERT = 0x05 + IP6OPT_TUNNEL_LIMIT = 0x04 + IP6OPT_TYPE_DISCARD = 0x40 + IP6OPT_TYPE_FORCEICMP = 0x80 + IP6OPT_TYPE_ICMP = 0xc0 + IP6OPT_TYPE_SKIP = 0x00 + IP6_ALERT_AN = 0x0002 + IP6_ALERT_MLD = 0x0000 + IP6_ALERT_RSVP = 0x0001 + IPPORT_RESERVED = 1024 + IPPORT_USERRESERVED = 5000 + IPPROTO_AH = 51 + SOL_AH = 51 + IPPROTO_DSTOPTS = 60 + SOL_DSTOPTS = 60 + IPPROTO_EGP = 8 + SOL_EGP = 8 + IPPROTO_ESP = 50 + SOL_ESP = 50 + IPPROTO_FRAGMENT = 44 + SOL_FRAGMENT = 44 + IPPROTO_GGP = 2 + SOL_GGP = 2 + IPPROTO_HOPOPTS = 0 + SOL_HOPOPTS = 0 + IPPROTO_ICMP = 1 + SOL_ICMP = 1 + IPPROTO_ICMPV6 = 58 + SOL_ICMPV6 = 58 + IPPROTO_IDP = 22 + SOL_IDP = 22 + IPPROTO_IP = 0 + SOL_IP = 0 + IPPROTO_IPV6 = 41 + SOL_IPV6 = 41 + IPPROTO_MAX = 256 + SOL_MAX = 256 + IPPROTO_NONE = 59 + SOL_NONE = 59 + IPPROTO_PUP = 12 + SOL_PUP = 12 + IPPROTO_RAW = 255 + SOL_RAW = 255 + IPPROTO_ROUTING = 43 + SOL_ROUTING = 43 + IPPROTO_TCP = 6 + SOL_TCP = 6 + IPPROTO_UDP = 17 + SOL_UDP = 17 + IPV6_ADDR_PREFERENCES = 32 + IPV6_CHECKSUM = 19 + IPV6_DONTFRAG = 29 + IPV6_DSTOPTS = 23 + IPV6_HOPLIMIT = 11 + IPV6_HOPOPTS = 22 + IPV6_JOIN_GROUP = 5 + IPV6_LEAVE_GROUP = 6 + IPV6_MULTICAST_HOPS = 9 + IPV6_MULTICAST_IF = 7 + IPV6_MULTICAST_LOOP = 4 + IPV6_NEXTHOP = 20 + IPV6_PATHMTU = 12 + IPV6_PKTINFO = 13 + IPV6_PREFER_SRC_CGA = 0x10 + IPV6_PREFER_SRC_COA = 0x02 + IPV6_PREFER_SRC_HOME = 0x01 + IPV6_PREFER_SRC_NONCGA = 0x20 + IPV6_PREFER_SRC_PUBLIC = 0x08 + IPV6_PREFER_SRC_TMP = 0x04 + IPV6_RECVDSTOPTS = 28 + IPV6_RECVHOPLIMIT = 14 + IPV6_RECVHOPOPTS = 26 + IPV6_RECVPATHMTU = 16 + IPV6_RECVPKTINFO = 15 + IPV6_RECVRTHDR = 25 + IPV6_RECVTCLASS = 31 + IPV6_RTHDR = 21 + IPV6_RTHDRDSTOPTS = 24 + IPV6_RTHDR_TYPE_0 = 0 + IPV6_TCLASS = 30 + IPV6_UNICAST_HOPS = 3 + IPV6_USE_MIN_MTU = 18 + IPV6_V6ONLY = 10 + IP_ADD_MEMBERSHIP = 5 + IP_ADD_SOURCE_MEMBERSHIP = 12 + IP_BLOCK_SOURCE = 10 + IP_DEFAULT_MULTICAST_LOOP = 1 + IP_DEFAULT_MULTICAST_TTL = 1 + IP_DROP_MEMBERSHIP = 6 + IP_DROP_SOURCE_MEMBERSHIP = 13 + IP_MAX_MEMBERSHIPS = 20 + IP_MULTICAST_IF = 7 + IP_MULTICAST_LOOP = 4 + IP_MULTICAST_TTL = 3 + IP_OPTIONS = 1 + IP_PKTINFO = 101 + IP_RECVPKTINFO = 102 + IP_TOS = 2 + IP_TTL = 3 + IP_UNBLOCK_SOURCE = 11 + ICANON = 0x0010 + ICMP6_FILTER = 0x26 + ICRNL = 0x0002 + IEXTEN = 0x0020 + IGNBRK = 0x0004 + IGNCR = 0x0008 + INLCR = 0x0020 + ISIG = 0x0040 + ISTRIP = 0x0080 + IXON = 0x0200 + IXOFF = 0x0100 + LOCK_SH = 0x1 // Not exist on zOS + LOCK_EX = 0x2 // Not exist on zOS + LOCK_NB = 0x4 // Not exist on zOS + LOCK_UN = 0x8 // Not exist on zOS + POLLIN = 0x0003 + POLLOUT = 0x0004 + POLLPRI = 0x0010 + POLLERR = 0x0020 + POLLHUP = 0x0040 + POLLNVAL = 0x0080 + PROT_READ = 0x1 // mmap - page can be read + PROT_WRITE = 0x2 // page can be written + PROT_NONE = 0x4 // can't be accessed + PROT_EXEC = 0x8 // can be executed + MAP_PRIVATE = 0x1 // changes are private + MAP_SHARED = 0x2 // changes are shared + MAP_FIXED = 0x4 // place exactly + MCAST_JOIN_GROUP = 40 + MCAST_LEAVE_GROUP = 41 + MCAST_JOIN_SOURCE_GROUP = 42 + MCAST_LEAVE_SOURCE_GROUP = 43 + MCAST_BLOCK_SOURCE = 44 + MCAST_UNBLOCK_SOURCE = 45 + MS_SYNC = 0x1 // msync - synchronous writes + MS_ASYNC = 0x2 // asynchronous writes + MS_INVALIDATE = 0x4 // invalidate mappings + MTM_RDONLY = 0x80000000 + MTM_RDWR = 0x40000000 + MTM_UMOUNT = 0x10000000 + MTM_IMMED = 0x08000000 + MTM_FORCE = 0x04000000 + MTM_DRAIN = 0x02000000 + MTM_RESET = 0x01000000 + MTM_SAMEMODE = 0x00100000 + MTM_UNQSEFORCE = 0x00040000 + MTM_NOSUID = 0x00000400 + MTM_SYNCHONLY = 0x00000200 + MTM_REMOUNT = 0x00000100 + MTM_NOSECURITY = 0x00000080 + NFDBITS = 0x20 + O_ACCMODE = 0x03 + O_APPEND = 0x08 + O_ASYNCSIG = 0x0200 + O_CREAT = 0x80 + O_EXCL = 0x40 + O_GETFL = 0x0F + O_LARGEFILE = 0x0400 + O_NONBLOCK = 0x04 + O_RDONLY = 0x02 + O_RDWR = 0x03 + O_SYNC = 0x0100 + O_TRUNC = 0x10 + O_WRONLY = 0x01 + O_NOCTTY = 0x20 + OPOST = 0x0001 + ONLCR = 0x0004 + PARENB = 0x0200 + PARMRK = 0x0400 + QUERYCVT = 3 + RUSAGE_CHILDREN = -0x1 + RUSAGE_SELF = 0x0 // RUSAGE_THREAD unsupported on z/OS + SEEK_CUR = 1 + SEEK_END = 2 + SEEK_SET = 0 + SETAUTOCVTALL = 5 + SETAUTOCVTON = 2 + SETCVTALL = 4 + SETCVTOFF = 0 + SETCVTON = 1 + AF_APPLETALK = 16 + AF_CCITT = 10 + AF_CHAOS = 5 + AF_DATAKIT = 9 + AF_DLI = 13 + AF_ECMA = 8 + AF_HYLINK = 15 + AF_IMPLINK = 3 + AF_INET = 2 + AF_INET6 = 19 + AF_INTF = 20 + AF_IUCV = 17 + AF_LAT = 14 + AF_LINK = 18 + AF_MAX = 30 + AF_NBS = 7 + AF_NDD = 23 + AF_NETWARE = 22 + AF_NS = 6 + AF_PUP = 4 + AF_RIF = 21 + AF_ROUTE = 20 + AF_SNA = 11 + AF_UNIX = 1 + AF_UNSPEC = 0 + IBMTCP_IMAGE = 1 + MSG_ACK_EXPECTED = 0x10 + MSG_ACK_GEN = 0x40 + MSG_ACK_TIMEOUT = 0x20 + MSG_CONNTERM = 0x80 + MSG_CTRUNC = 0x20 + MSG_DONTROUTE = 0x4 + MSG_EOF = 0x8000 + MSG_EOR = 0x8 + MSG_MAXIOVLEN = 16 + MSG_NONBLOCK = 0x4000 + MSG_OOB = 0x1 + MSG_PEEK = 0x2 + MSG_TRUNC = 0x10 + MSG_WAITALL = 0x40 + PRIO_PROCESS = 1 + PRIO_PGRP = 2 + PRIO_USER = 3 + RLIMIT_CPU = 0 + RLIMIT_FSIZE = 1 + RLIMIT_DATA = 2 + RLIMIT_STACK = 3 + RLIMIT_CORE = 4 + RLIMIT_AS = 5 + RLIMIT_NOFILE = 6 + RLIMIT_MEMLIMIT = 7 + RLIM_INFINITY = 2147483647 + SCM_RIGHTS = 0x01 + SF_CLOSE = 0x00000002 + SF_REUSE = 0x00000001 + SHUT_RD = 0 + SHUT_RDWR = 2 + SHUT_WR = 1 + SOCK_CONN_DGRAM = 6 + SOCK_DGRAM = 2 + SOCK_RAW = 3 + SOCK_RDM = 4 + SOCK_SEQPACKET = 5 + SOCK_STREAM = 1 + SOL_SOCKET = 0xffff + SOMAXCONN = 10 + SO_ACCEPTCONN = 0x0002 + SO_ACCEPTECONNABORTED = 0x0006 + SO_ACKNOW = 0x7700 + SO_BROADCAST = 0x0020 + SO_BULKMODE = 0x8000 + SO_CKSUMRECV = 0x0800 + SO_CLOSE = 0x01 + SO_CLUSTERCONNTYPE = 0x00004001 + SO_CLUSTERCONNTYPE_INTERNAL = 8 + SO_CLUSTERCONNTYPE_NOCONN = 0 + SO_CLUSTERCONNTYPE_NONE = 1 + SO_CLUSTERCONNTYPE_SAME_CLUSTER = 2 + SO_CLUSTERCONNTYPE_SAME_IMAGE = 4 + SO_DEBUG = 0x0001 + SO_DONTROUTE = 0x0010 + SO_ERROR = 0x1007 + SO_IGNOREINCOMINGPUSH = 0x1 + SO_IGNORESOURCEVIPA = 0x0002 + SO_KEEPALIVE = 0x0008 + SO_LINGER = 0x0080 + SO_NONBLOCKLOCAL = 0x8001 + SO_NOREUSEADDR = 0x1000 + SO_OOBINLINE = 0x0100 + SO_OPTACK = 0x8004 + SO_OPTMSS = 0x8003 + SO_RCVBUF = 0x1002 + SO_RCVLOWAT = 0x1004 + SO_RCVTIMEO = 0x1006 + SO_REUSEADDR = 0x0004 + SO_REUSEPORT = 0x0200 + SO_SECINFO = 0x00004002 + SO_SET = 0x0200 + SO_SNDBUF = 0x1001 + SO_SNDLOWAT = 0x1003 + SO_SNDTIMEO = 0x1005 + SO_TYPE = 0x1008 + SO_UNSET = 0x0400 + SO_USELOOPBACK = 0x0040 + SO_USE_IFBUFS = 0x0400 + S_ISUID = 0x0800 + S_ISGID = 0x0400 + S_ISVTX = 0x0200 + S_IRUSR = 0x0100 + S_IWUSR = 0x0080 + S_IXUSR = 0x0040 + S_IRWXU = 0x01C0 + S_IRGRP = 0x0020 + S_IWGRP = 0x0010 + S_IXGRP = 0x0008 + S_IRWXG = 0x0038 + S_IROTH = 0x0004 + S_IWOTH = 0x0002 + S_IXOTH = 0x0001 + S_IRWXO = 0x0007 + S_IREAD = S_IRUSR + S_IWRITE = S_IWUSR + S_IEXEC = S_IXUSR + S_IFDIR = 0x01000000 + S_IFCHR = 0x02000000 + S_IFREG = 0x03000000 + S_IFFIFO = 0x04000000 + S_IFIFO = 0x04000000 + S_IFLNK = 0x05000000 + S_IFBLK = 0x06000000 + S_IFSOCK = 0x07000000 + S_IFVMEXTL = 0xFE000000 + S_IFVMEXTL_EXEC = 0x00010000 + S_IFVMEXTL_DATA = 0x00020000 + S_IFVMEXTL_MEL = 0x00030000 + S_IFEXTL = 0x00000001 + S_IFPROGCTL = 0x00000002 + S_IFAPFCTL = 0x00000004 + S_IFNOSHARE = 0x00000008 + S_IFSHARELIB = 0x00000010 + S_IFMT = 0xFF000000 + S_IFMST = 0x00FF0000 + TCP_KEEPALIVE = 0x8 + TCP_NODELAY = 0x1 + TCP_INFO = 0xb + TCP_USER_TIMEOUT = 0x1 + TIOCGWINSZ = 0x4008a368 + TIOCSWINSZ = 0x8008a367 + TIOCSBRK = 0x2000a77b + TIOCCBRK = 0x2000a77a + TIOCSTI = 0x8001a772 + TIOCGPGRP = 0x4004a777 // _IOR(167, 119, int) + TCSANOW = 0 + TCSETS = 0 // equivalent to TCSANOW for tcsetattr + TCSADRAIN = 1 + TCSETSW = 1 // equivalent to TCSADRAIN for tcsetattr + TCSAFLUSH = 2 + TCSETSF = 2 // equivalent to TCSAFLUSH for tcsetattr + TCGETS = 3 // not defined in ioctl.h -- zos golang only + TCIFLUSH = 0 + TCOFLUSH = 1 + TCIOFLUSH = 2 + TCOOFF = 0 + TCOON = 1 + TCIOFF = 2 + TCION = 3 + TIOCSPGRP = 0x8004a776 + TIOCNOTTY = 0x2000a771 + TIOCEXCL = 0x2000a70d + TIOCNXCL = 0x2000a70e + TIOCGETD = 0x4004a700 + TIOCSETD = 0x8004a701 + TIOCPKT = 0x8004a770 + TIOCSTOP = 0x2000a76f + TIOCSTART = 0x2000a76e + TIOCUCNTL = 0x8004a766 + TIOCREMOTE = 0x8004a769 + TIOCMGET = 0x4004a76a + TIOCMSET = 0x8004a76d + TIOCMBIC = 0x8004a76b + TIOCMBIS = 0x8004a76c + VINTR = 0 + VQUIT = 1 + VERASE = 2 + VKILL = 3 + VEOF = 4 + VEOL = 5 + VMIN = 6 + VSTART = 7 + VSTOP = 8 + VSUSP = 9 + VTIME = 10 + WCONTINUED = 0x4 + WNOHANG = 0x1 + WUNTRACED = 0x2 + _BPX_SWAP = 1 + _BPX_NONSWAP = 2 + MCL_CURRENT = 1 // for Linux compatibility -- no zos semantics + MCL_FUTURE = 2 // for Linux compatibility -- no zos semantics + MCL_ONFAULT = 3 // for Linux compatibility -- no zos semantics + MADV_NORMAL = 0 // for Linux compatibility -- no zos semantics + MADV_RANDOM = 1 // for Linux compatibility -- no zos semantics + MADV_SEQUENTIAL = 2 // for Linux compatibility -- no zos semantics + MADV_WILLNEED = 3 // for Linux compatibility -- no zos semantics + MADV_REMOVE = 4 // for Linux compatibility -- no zos semantics + MADV_DONTFORK = 5 // for Linux compatibility -- no zos semantics + MADV_DOFORK = 6 // for Linux compatibility -- no zos semantics + MADV_HWPOISON = 7 // for Linux compatibility -- no zos semantics + MADV_MERGEABLE = 8 // for Linux compatibility -- no zos semantics + MADV_UNMERGEABLE = 9 // for Linux compatibility -- no zos semantics + MADV_SOFT_OFFLINE = 10 // for Linux compatibility -- no zos semantics + MADV_HUGEPAGE = 11 // for Linux compatibility -- no zos semantics + MADV_NOHUGEPAGE = 12 // for Linux compatibility -- no zos semantics + MADV_DONTDUMP = 13 // for Linux compatibility -- no zos semantics + MADV_DODUMP = 14 // for Linux compatibility -- no zos semantics + MADV_FREE = 15 // for Linux compatibility -- no zos semantics + MADV_WIPEONFORK = 16 // for Linux compatibility -- no zos semantics + MADV_KEEPONFORK = 17 // for Linux compatibility -- no zos semantics + AT_SYMLINK_NOFOLLOW = 1 // for Unix compatibility -- no zos semantics + AT_FDCWD = 2 // for Unix compatibility -- no zos semantics +) + +const ( + EDOM = Errno(1) + ERANGE = Errno(2) + EACCES = Errno(111) + EAGAIN = Errno(112) + EBADF = Errno(113) + EBUSY = Errno(114) + ECHILD = Errno(115) + EDEADLK = Errno(116) + EEXIST = Errno(117) + EFAULT = Errno(118) + EFBIG = Errno(119) + EINTR = Errno(120) + EINVAL = Errno(121) + EIO = Errno(122) + EISDIR = Errno(123) + EMFILE = Errno(124) + EMLINK = Errno(125) + ENAMETOOLONG = Errno(126) + ENFILE = Errno(127) + ENODEV = Errno(128) + ENOENT = Errno(129) + ENOEXEC = Errno(130) + ENOLCK = Errno(131) + ENOMEM = Errno(132) + ENOSPC = Errno(133) + ENOSYS = Errno(134) + ENOTDIR = Errno(135) + ENOTEMPTY = Errno(136) + ENOTTY = Errno(137) + ENXIO = Errno(138) + EPERM = Errno(139) + EPIPE = Errno(140) + EROFS = Errno(141) + ESPIPE = Errno(142) + ESRCH = Errno(143) + EXDEV = Errno(144) + E2BIG = Errno(145) + ELOOP = Errno(146) + EILSEQ = Errno(147) + ENODATA = Errno(148) + EOVERFLOW = Errno(149) + EMVSNOTUP = Errno(150) + ECMSSTORAGE = Errno(151) + EMVSDYNALC = Errno(151) + EMVSCVAF = Errno(152) + EMVSCATLG = Errno(153) + ECMSINITIAL = Errno(156) + EMVSINITIAL = Errno(156) + ECMSERR = Errno(157) + EMVSERR = Errno(157) + EMVSPARM = Errno(158) + ECMSPFSFILE = Errno(159) + EMVSPFSFILE = Errno(159) + EMVSBADCHAR = Errno(160) + ECMSPFSPERM = Errno(162) + EMVSPFSPERM = Errno(162) + EMVSSAFEXTRERR = Errno(163) + EMVSSAF2ERR = Errno(164) + EMVSTODNOTSET = Errno(165) + EMVSPATHOPTS = Errno(166) + EMVSNORTL = Errno(167) + EMVSEXPIRE = Errno(168) + EMVSPASSWORD = Errno(169) + EMVSWLMERROR = Errno(170) + EMVSCPLERROR = Errno(171) + EMVSARMERROR = Errno(172) + ELENOFORK = Errno(200) + ELEMSGERR = Errno(201) + EFPMASKINV = Errno(202) + EFPMODEINV = Errno(203) + EBUFLEN = Errno(227) + EEXTLINK = Errno(228) + ENODD = Errno(229) + ECMSESMERR = Errno(230) + ECPERR = Errno(231) + ELEMULTITHREAD = Errno(232) + ELEFENCE = Errno(244) + EBADDATA = Errno(245) + EUNKNOWN = Errno(246) + ENOTSUP = Errno(247) + EBADNAME = Errno(248) + ENOTSAFE = Errno(249) + ELEMULTITHREADFORK = Errno(257) + ECUNNOENV = Errno(258) + ECUNNOCONV = Errno(259) + ECUNNOTALIGNED = Errno(260) + ECUNERR = Errno(262) + EIBMBADCALL = Errno(1000) + EIBMBADPARM = Errno(1001) + EIBMSOCKOUTOFRANGE = Errno(1002) + EIBMSOCKINUSE = Errno(1003) + EIBMIUCVERR = Errno(1004) + EOFFLOADboxERROR = Errno(1005) + EOFFLOADboxRESTART = Errno(1006) + EOFFLOADboxDOWN = Errno(1007) + EIBMCONFLICT = Errno(1008) + EIBMCANCELLED = Errno(1009) + EIBMBADTCPNAME = Errno(1011) + ENOTBLK = Errno(1100) + ETXTBSY = Errno(1101) + EWOULDBLOCK = Errno(1102) + EINPROGRESS = Errno(1103) + EALREADY = Errno(1104) + ENOTSOCK = Errno(1105) + EDESTADDRREQ = Errno(1106) + EMSGSIZE = Errno(1107) + EPROTOTYPE = Errno(1108) + ENOPROTOOPT = Errno(1109) + EPROTONOSUPPORT = Errno(1110) + ESOCKTNOSUPPORT = Errno(1111) + EOPNOTSUPP = Errno(1112) + EPFNOSUPPORT = Errno(1113) + EAFNOSUPPORT = Errno(1114) + EADDRINUSE = Errno(1115) + EADDRNOTAVAIL = Errno(1116) + ENETDOWN = Errno(1117) + ENETUNREACH = Errno(1118) + ENETRESET = Errno(1119) + ECONNABORTED = Errno(1120) + ECONNRESET = Errno(1121) + ENOBUFS = Errno(1122) + EISCONN = Errno(1123) + ENOTCONN = Errno(1124) + ESHUTDOWN = Errno(1125) + ETOOMANYREFS = Errno(1126) + ETIMEDOUT = Errno(1127) + ECONNREFUSED = Errno(1128) + EHOSTDOWN = Errno(1129) + EHOSTUNREACH = Errno(1130) + EPROCLIM = Errno(1131) + EUSERS = Errno(1132) + EDQUOT = Errno(1133) + ESTALE = Errno(1134) + EREMOTE = Errno(1135) + ENOSTR = Errno(1136) + ETIME = Errno(1137) + ENOSR = Errno(1138) + ENOMSG = Errno(1139) + EBADMSG = Errno(1140) + EIDRM = Errno(1141) + ENONET = Errno(1142) + ERREMOTE = Errno(1143) + ENOLINK = Errno(1144) + EADV = Errno(1145) + ESRMNT = Errno(1146) + ECOMM = Errno(1147) + EPROTO = Errno(1148) + EMULTIHOP = Errno(1149) + EDOTDOT = Errno(1150) + EREMCHG = Errno(1151) + ECANCELED = Errno(1152) + EINTRNODATA = Errno(1159) + ENOREUSE = Errno(1160) + ENOMOVE = Errno(1161) +) + +// Signals +const ( + SIGHUP = Signal(1) + SIGINT = Signal(2) + SIGABRT = Signal(3) + SIGILL = Signal(4) + SIGPOLL = Signal(5) + SIGURG = Signal(6) + SIGSTOP = Signal(7) + SIGFPE = Signal(8) + SIGKILL = Signal(9) + SIGBUS = Signal(10) + SIGSEGV = Signal(11) + SIGSYS = Signal(12) + SIGPIPE = Signal(13) + SIGALRM = Signal(14) + SIGTERM = Signal(15) + SIGUSR1 = Signal(16) + SIGUSR2 = Signal(17) + SIGABND = Signal(18) + SIGCONT = Signal(19) + SIGCHLD = Signal(20) + SIGTTIN = Signal(21) + SIGTTOU = Signal(22) + SIGIO = Signal(23) + SIGQUIT = Signal(24) + SIGTSTP = Signal(25) + SIGTRAP = Signal(26) + SIGIOERR = Signal(27) + SIGWINCH = Signal(28) + SIGXCPU = Signal(29) + SIGXFSZ = Signal(30) + SIGVTALRM = Signal(31) + SIGPROF = Signal(32) + SIGDANGER = Signal(33) + SIGTHSTOP = Signal(34) + SIGTHCONT = Signal(35) + SIGTRACE = Signal(37) + SIGDCE = Signal(38) + SIGDUMP = Signal(39) +) + +// Error table +var errorList = [...]struct { + num Errno + name string + desc string +}{ + {1, "EDC5001I", "A domain error occurred."}, + {2, "EDC5002I", "A range error occurred."}, + {111, "EDC5111I", "Permission denied."}, + {112, "EDC5112I", "Resource temporarily unavailable."}, + {113, "EDC5113I", "Bad file descriptor."}, + {114, "EDC5114I", "Resource busy."}, + {115, "EDC5115I", "No child processes."}, + {116, "EDC5116I", "Resource deadlock avoided."}, + {117, "EDC5117I", "File exists."}, + {118, "EDC5118I", "Incorrect address."}, + {119, "EDC5119I", "File too large."}, + {120, "EDC5120I", "Interrupted function call."}, + {121, "EDC5121I", "Invalid argument."}, + {122, "EDC5122I", "Input/output error."}, + {123, "EDC5123I", "Is a directory."}, + {124, "EDC5124I", "Too many open files."}, + {125, "EDC5125I", "Too many links."}, + {126, "EDC5126I", "Filename too long."}, + {127, "EDC5127I", "Too many open files in system."}, + {128, "EDC5128I", "No such device."}, + {129, "EDC5129I", "No such file or directory."}, + {130, "EDC5130I", "Exec format error."}, + {131, "EDC5131I", "No locks available."}, + {132, "EDC5132I", "Not enough memory."}, + {133, "EDC5133I", "No space left on device."}, + {134, "EDC5134I", "Function not implemented."}, + {135, "EDC5135I", "Not a directory."}, + {136, "EDC5136I", "Directory not empty."}, + {137, "EDC5137I", "Inappropriate I/O control operation."}, + {138, "EDC5138I", "No such device or address."}, + {139, "EDC5139I", "Operation not permitted."}, + {140, "EDC5140I", "Broken pipe."}, + {141, "EDC5141I", "Read-only file system."}, + {142, "EDC5142I", "Invalid seek."}, + {143, "EDC5143I", "No such process."}, + {144, "EDC5144I", "Improper link."}, + {145, "EDC5145I", "The parameter list is too long, or the message to receive was too large for the buffer."}, + {146, "EDC5146I", "Too many levels of symbolic links."}, + {147, "EDC5147I", "Illegal byte sequence."}, + {148, "", ""}, + {149, "EDC5149I", "Value Overflow Error."}, + {150, "EDC5150I", "UNIX System Services is not active."}, + {151, "EDC5151I", "Dynamic allocation error."}, + {152, "EDC5152I", "Common VTOC access facility (CVAF) error."}, + {153, "EDC5153I", "Catalog obtain error."}, + {156, "EDC5156I", "Process initialization error."}, + {157, "EDC5157I", "An internal error has occurred."}, + {158, "EDC5158I", "Bad parameters were passed to the service."}, + {159, "EDC5159I", "The Physical File System encountered a permanent file error."}, + {160, "EDC5160I", "Bad character in environment variable name."}, + {162, "EDC5162I", "The Physical File System encountered a system error."}, + {163, "EDC5163I", "SAF/RACF extract error."}, + {164, "EDC5164I", "SAF/RACF error."}, + {165, "EDC5165I", "System TOD clock not set."}, + {166, "EDC5166I", "Access mode argument on function call conflicts with PATHOPTS parameter on JCL DD statement."}, + {167, "EDC5167I", "Access to the UNIX System Services version of the C RTL is denied."}, + {168, "EDC5168I", "Password has expired."}, + {169, "EDC5169I", "Password is invalid."}, + {170, "EDC5170I", "An error was encountered with WLM."}, + {171, "EDC5171I", "An error was encountered with CPL."}, + {172, "EDC5172I", "An error was encountered with Application Response Measurement (ARM) component."}, + {200, "EDC5200I", "The application contains a Language Environment member language that cannot tolerate a fork()."}, + {201, "EDC5201I", "The Language Environment message file was not found in the hierarchical file system."}, + {202, "EDC5202E", "DLL facilities are not supported under SPC environment."}, + {203, "EDC5203E", "DLL facilities are not supported under POSIX environment."}, + {227, "EDC5227I", "Buffer is not long enough to contain a path definition"}, + {228, "EDC5228I", "The file referred to is an external link"}, + {229, "EDC5229I", "No path definition for ddname in effect"}, + {230, "EDC5230I", "ESM error."}, + {231, "EDC5231I", "CP or the external security manager had an error"}, + {232, "EDC5232I", "The function failed because it was invoked from a multithread environment."}, + {244, "EDC5244I", "The program, module or DLL is not supported in this environment."}, + {245, "EDC5245I", "Data is not valid."}, + {246, "EDC5246I", "Unknown system state."}, + {247, "EDC5247I", "Operation not supported."}, + {248, "EDC5248I", "The object name specified is not correct."}, + {249, "EDC5249I", "The function is not allowed."}, + {257, "EDC5257I", "Function cannot be called in the child process of a fork() from a multithreaded process until exec() is called."}, + {258, "EDC5258I", "A CUN_RS_NO_UNI_ENV error was issued by Unicode Services."}, + {259, "EDC5259I", "A CUN_RS_NO_CONVERSION error was issued by Unicode Services."}, + {260, "EDC5260I", "A CUN_RS_TABLE_NOT_ALIGNED error was issued by Unicode Services."}, + {262, "EDC5262I", "An iconv() function encountered an unexpected error while using Unicode Services."}, + {1000, "EDC8000I", "A bad socket-call constant was found in the IUCV header."}, + {1001, "EDC8001I", "An error was found in the IUCV header."}, + {1002, "EDC8002I", "A socket descriptor is out of range."}, + {1003, "EDC8003I", "A socket descriptor is in use."}, + {1004, "EDC8004I", "Request failed because of an IUCV error."}, + {1005, "EDC8005I", "Offload box error."}, + {1006, "EDC8006I", "Offload box restarted."}, + {1007, "EDC8007I", "Offload box down."}, + {1008, "EDC8008I", "Already a conflicting call outstanding on socket."}, + {1009, "EDC8009I", "Request cancelled using a SOCKcallCANCEL request."}, + {1011, "EDC8011I", "A name of a PFS was specified that either is not configured or is not a Sockets PFS."}, + {1100, "EDC8100I", "Block device required."}, + {1101, "EDC8101I", "Text file busy."}, + {1102, "EDC8102I", "Operation would block."}, + {1103, "EDC8103I", "Operation now in progress."}, + {1104, "EDC8104I", "Connection already in progress."}, + {1105, "EDC8105I", "Socket operation on non-socket."}, + {1106, "EDC8106I", "Destination address required."}, + {1107, "EDC8107I", "Message too long."}, + {1108, "EDC8108I", "Protocol wrong type for socket."}, + {1109, "EDC8109I", "Protocol not available."}, + {1110, "EDC8110I", "Protocol not supported."}, + {1111, "EDC8111I", "Socket type not supported."}, + {1112, "EDC8112I", "Operation not supported on socket."}, + {1113, "EDC8113I", "Protocol family not supported."}, + {1114, "EDC8114I", "Address family not supported."}, + {1115, "EDC8115I", "Address already in use."}, + {1116, "EDC8116I", "Address not available."}, + {1117, "EDC8117I", "Network is down."}, + {1118, "EDC8118I", "Network is unreachable."}, + {1119, "EDC8119I", "Network dropped connection on reset."}, + {1120, "EDC8120I", "Connection ended abnormally."}, + {1121, "EDC8121I", "Connection reset."}, + {1122, "EDC8122I", "No buffer space available."}, + {1123, "EDC8123I", "Socket already connected."}, + {1124, "EDC8124I", "Socket not connected."}, + {1125, "EDC8125I", "Can't send after socket shutdown."}, + {1126, "EDC8126I", "Too many references; can't splice."}, + {1127, "EDC8127I", "Connection timed out."}, + {1128, "EDC8128I", "Connection refused."}, + {1129, "EDC8129I", "Host is not available."}, + {1130, "EDC8130I", "Host cannot be reached."}, + {1131, "EDC8131I", "Too many processes."}, + {1132, "EDC8132I", "Too many users."}, + {1133, "EDC8133I", "Disk quota exceeded."}, + {1134, "EDC8134I", "Stale file handle."}, + {1135, "", ""}, + {1136, "EDC8136I", "File is not a STREAM."}, + {1137, "EDC8137I", "STREAMS ioctl() timeout."}, + {1138, "EDC8138I", "No STREAMS resources."}, + {1139, "EDC8139I", "The message identified by set_id and msg_id is not in the message catalog."}, + {1140, "EDC8140I", "Bad message."}, + {1141, "EDC8141I", "Identifier removed."}, + {1142, "", ""}, + {1143, "", ""}, + {1144, "EDC8144I", "The link has been severed."}, + {1145, "", ""}, + {1146, "", ""}, + {1147, "", ""}, + {1148, "EDC8148I", "Protocol error."}, + {1149, "EDC8149I", "Multihop not allowed."}, + {1150, "", ""}, + {1151, "", ""}, + {1152, "EDC8152I", "The asynchronous I/O request has been canceled."}, + {1159, "EDC8159I", "Function call was interrupted before any data was received."}, + {1160, "EDC8160I", "Socket reuse is not supported."}, + {1161, "EDC8161I", "The file system cannot currently be moved."}, +} + +// Signal table +var signalList = [...]struct { + num Signal + name string + desc string +}{ + {1, "SIGHUP", "hangup"}, + {2, "SIGINT", "interrupt"}, + {3, "SIGABT", "aborted"}, + {4, "SIGILL", "illegal instruction"}, + {5, "SIGPOLL", "pollable event"}, + {6, "SIGURG", "urgent I/O condition"}, + {7, "SIGSTOP", "stop process"}, + {8, "SIGFPE", "floating point exception"}, + {9, "SIGKILL", "killed"}, + {10, "SIGBUS", "bus error"}, + {11, "SIGSEGV", "segmentation fault"}, + {12, "SIGSYS", "bad argument to routine"}, + {13, "SIGPIPE", "broken pipe"}, + {14, "SIGALRM", "alarm clock"}, + {15, "SIGTERM", "terminated"}, + {16, "SIGUSR1", "user defined signal 1"}, + {17, "SIGUSR2", "user defined signal 2"}, + {18, "SIGABND", "abend"}, + {19, "SIGCONT", "continued"}, + {20, "SIGCHLD", "child exited"}, + {21, "SIGTTIN", "stopped (tty input)"}, + {22, "SIGTTOU", "stopped (tty output)"}, + {23, "SIGIO", "I/O possible"}, + {24, "SIGQUIT", "quit"}, + {25, "SIGTSTP", "stopped"}, + {26, "SIGTRAP", "trace/breakpoint trap"}, + {27, "SIGIOER", "I/O error"}, + {28, "SIGWINCH", "window changed"}, + {29, "SIGXCPU", "CPU time limit exceeded"}, + {30, "SIGXFSZ", "file size limit exceeded"}, + {31, "SIGVTALRM", "virtual timer expired"}, + {32, "SIGPROF", "profiling timer expired"}, + {33, "SIGDANGER", "danger"}, + {34, "SIGTHSTOP", "stop thread"}, + {35, "SIGTHCONT", "continue thread"}, + {37, "SIGTRACE", "trace"}, + {38, "", "DCE"}, + {39, "SIGDUMP", "dump"}, +} diff --git a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go index 89c5920e0c..bd001a6e1c 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_armnn_linux.go @@ -1,5 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("arm", "arm64"). DO NOT EDIT. +//go:build linux && (arm || arm64) // +build linux // +build arm arm64 diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go index 24b841eec5..c34d0639be 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go @@ -1,5 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mips", "mips64"). DO NOT EDIT. +//go:build linux && (mips || mips64) // +build linux // +build mips mips64 diff --git a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go index 47b0489565..3ccf0c0c4a 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go @@ -1,5 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("mipsle", "mips64le"). DO NOT EDIT. +//go:build linux && (mipsle || mips64le) // +build linux // +build mipsle mips64le diff --git a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go index ea5d9cb536..7d65857004 100644 --- a/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go +++ b/vendor/golang.org/x/sys/unix/zptrace_x86_linux.go @@ -1,5 +1,6 @@ // Code generated by linux/mkall.go generatePtracePair("386", "amd64"). DO NOT EDIT. +//go:build linux && (386 || amd64) // +build linux // +build 386 amd64 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index ed657ff1bc..91a23cc728 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -1,6 +1,7 @@ // go run mksyscall_aix_ppc.go -aix -tags aix,ppc syscall_aix.go syscall_aix_ppc.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build aix && ppc // +build aix,ppc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index 664b293b43..33c2609b8b 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -1,6 +1,7 @@ // go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build aix && ppc64 // +build aix,ppc64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index 4b3a8ad7be..8b737fa971 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -1,8 +1,8 @@ // go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build aix,ppc64 -// +build !gccgo +//go:build aix && ppc64 && gc +// +build aix,ppc64,gc package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index cde4dbc5f5..3c260917ed 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -1,8 +1,8 @@ // go run mksyscall_aix_ppc64.go -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build aix,ppc64 -// +build gccgo +//go:build aix && ppc64 && gccgo +// +build aix,ppc64,gccgo package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go deleted file mode 100644 index 23e94d3663..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_11.go +++ /dev/null @@ -1,1809 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,386,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_386.1_11.go syscall_darwin_386.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,386,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go deleted file mode 100644 index e263fbdb8b..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.go +++ /dev/null @@ -1,41 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,386,go1.13 syscall_darwin.1_13.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,386,go1.13 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_closedir_trampoline() - -//go:linkname libc_closedir libc_closedir -//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) - res = Errno(r0) - return -} - -func libc_readdir_r_trampoline() - -//go:linkname libc_readdir_r libc_readdir_r -//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s deleted file mode 100644 index 00da1ebfca..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.1_13.s +++ /dev/null @@ -1,12 +0,0 @@ -// go run mkasm_darwin.go 386 -// Code generated by the command above; DO NOT EDIT. - -// +build go1.13 - -#include "textflag.h" -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fdopendir(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_closedir(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readdir_r(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go deleted file mode 100644 index e2ffb3bed3..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go +++ /dev/null @@ -1,2497 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,386,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_386.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,386,go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getgroups_trampoline() - -//go:linkname libc_getgroups libc_getgroups -//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setgroups_trampoline() - -//go:linkname libc_setgroups libc_setgroups -//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_wait4_trampoline() - -//go:linkname libc_wait4 libc_wait4 -//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_accept_trampoline() - -//go:linkname libc_accept libc_accept -//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_bind_trampoline() - -//go:linkname libc_bind libc_bind -//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_connect_trampoline() - -//go:linkname libc_connect libc_connect -//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_socket_trampoline() - -//go:linkname libc_socket libc_socket -//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsockopt_trampoline() - -//go:linkname libc_getsockopt libc_getsockopt -//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setsockopt_trampoline() - -//go:linkname libc_setsockopt libc_setsockopt -//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpeername_trampoline() - -//go:linkname libc_getpeername libc_getpeername -//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsockname_trampoline() - -//go:linkname libc_getsockname libc_getsockname -//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_shutdown_trampoline() - -//go:linkname libc_shutdown libc_shutdown -//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_socketpair_trampoline() - -//go:linkname libc_socketpair libc_socketpair -//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_recvfrom_trampoline() - -//go:linkname libc_recvfrom libc_recvfrom -//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendto_trampoline() - -//go:linkname libc_sendto libc_sendto -//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_recvmsg_trampoline() - -//go:linkname libc_recvmsg libc_recvmsg -//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendmsg_trampoline() - -//go:linkname libc_sendmsg libc_sendmsg -//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kevent_trampoline() - -//go:linkname libc_kevent libc_kevent -//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_utimes_trampoline() - -//go:linkname libc_utimes libc_utimes -//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_futimes_trampoline() - -//go:linkname libc_futimes libc_futimes -//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_poll_trampoline() - -//go:linkname libc_poll libc_poll -//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_madvise_trampoline() - -//go:linkname libc_madvise libc_madvise -//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mlock_trampoline() - -//go:linkname libc_mlock libc_mlock -//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mlockall_trampoline() - -//go:linkname libc_mlockall libc_mlockall -//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mprotect_trampoline() - -//go:linkname libc_mprotect libc_mprotect -//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_msync_trampoline() - -//go:linkname libc_msync libc_msync -//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munlock_trampoline() - -//go:linkname libc_munlock libc_munlock -//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munlockall_trampoline() - -//go:linkname libc_munlockall libc_munlockall -//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pipe_trampoline() - -//go:linkname libc_pipe libc_pipe -//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getxattr_trampoline() - -//go:linkname libc_getxattr libc_getxattr -//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fgetxattr_trampoline() - -//go:linkname libc_fgetxattr libc_fgetxattr -//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setxattr_trampoline() - -//go:linkname libc_setxattr libc_setxattr -//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fsetxattr_trampoline() - -//go:linkname libc_fsetxattr libc_fsetxattr -//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_removexattr_trampoline() - -//go:linkname libc_removexattr libc_removexattr -//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fremovexattr_trampoline() - -//go:linkname libc_fremovexattr libc_fremovexattr -//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_listxattr_trampoline() - -//go:linkname libc_listxattr libc_listxattr -//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_flistxattr_trampoline() - -//go:linkname libc_flistxattr libc_flistxattr -//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setattrlist_trampoline() - -//go:linkname libc_setattrlist libc_setattrlist -//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fcntl_trampoline() - -//go:linkname libc_fcntl libc_fcntl -//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kill_trampoline() - -//go:linkname libc_kill libc_kill -//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ioctl_trampoline() - -//go:linkname libc_ioctl libc_ioctl -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sysctl_trampoline() - -//go:linkname libc_sysctl libc_sysctl -//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall9(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendfile_trampoline() - -//go:linkname libc_sendfile libc_sendfile -//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_access_trampoline() - -//go:linkname libc_access libc_access -//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_adjtime_trampoline() - -//go:linkname libc_adjtime libc_adjtime -//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chdir_trampoline() - -//go:linkname libc_chdir libc_chdir -//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chflags_trampoline() - -//go:linkname libc_chflags libc_chflags -//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chmod_trampoline() - -//go:linkname libc_chmod libc_chmod -//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chown_trampoline() - -//go:linkname libc_chown libc_chown -//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chroot_trampoline() - -//go:linkname libc_chroot libc_chroot -//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clock_gettime_trampoline() - -//go:linkname libc_clock_gettime libc_clock_gettime -//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_close_trampoline() - -//go:linkname libc_close libc_close -//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_dup_trampoline() - -//go:linkname libc_dup libc_dup -//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_dup2_trampoline() - -//go:linkname libc_dup2 libc_dup2 -//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_exchangedata_trampoline() - -//go:linkname libc_exchangedata libc_exchangedata -//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) - return -} - -func libc_exit_trampoline() - -//go:linkname libc_exit libc_exit -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_faccessat_trampoline() - -//go:linkname libc_faccessat libc_faccessat -//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchdir_trampoline() - -//go:linkname libc_fchdir libc_fchdir -//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchflags_trampoline() - -//go:linkname libc_fchflags libc_fchflags -//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchmod_trampoline() - -//go:linkname libc_fchmod libc_fchmod -//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchmodat_trampoline() - -//go:linkname libc_fchmodat libc_fchmodat -//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchown_trampoline() - -//go:linkname libc_fchown libc_fchown -//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchownat_trampoline() - -//go:linkname libc_fchownat libc_fchownat -//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_flock_trampoline() - -//go:linkname libc_flock libc_flock -//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fpathconf_trampoline() - -//go:linkname libc_fpathconf libc_fpathconf -//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fsync_trampoline() - -//go:linkname libc_fsync libc_fsync -//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ftruncate_trampoline() - -//go:linkname libc_ftruncate libc_ftruncate -//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) - size = int(r0) - return -} - -func libc_getdtablesize_trampoline() - -//go:linkname libc_getdtablesize libc_getdtablesize -//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) - egid = int(r0) - return -} - -func libc_getegid_trampoline() - -//go:linkname libc_getegid libc_getegid -//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) - uid = int(r0) - return -} - -func libc_geteuid_trampoline() - -//go:linkname libc_geteuid libc_geteuid -//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) - gid = int(r0) - return -} - -func libc_getgid_trampoline() - -//go:linkname libc_getgid libc_getgid -//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpgid_trampoline() - -//go:linkname libc_getpgid libc_getpgid -//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) - pgrp = int(r0) - return -} - -func libc_getpgrp_trampoline() - -//go:linkname libc_getpgrp libc_getpgrp -//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) - pid = int(r0) - return -} - -func libc_getpid_trampoline() - -//go:linkname libc_getpid libc_getpid -//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) - ppid = int(r0) - return -} - -func libc_getppid_trampoline() - -//go:linkname libc_getppid libc_getppid -//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpriority_trampoline() - -//go:linkname libc_getpriority libc_getpriority -//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getrlimit_trampoline() - -//go:linkname libc_getrlimit libc_getrlimit -//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getrusage_trampoline() - -//go:linkname libc_getrusage libc_getrusage -//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsid_trampoline() - -//go:linkname libc_getsid libc_getsid -//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_gettimeofday_trampoline() - -//go:linkname libc_gettimeofday libc_gettimeofday -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) - uid = int(r0) - return -} - -func libc_getuid_trampoline() - -//go:linkname libc_getuid libc_getuid -//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -func libc_issetugid_trampoline() - -//go:linkname libc_issetugid libc_issetugid -//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kqueue_trampoline() - -//go:linkname libc_kqueue libc_kqueue -//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lchown_trampoline() - -//go:linkname libc_lchown libc_lchown -//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_link_trampoline() - -//go:linkname libc_link libc_link -//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_linkat_trampoline() - -//go:linkname libc_linkat libc_linkat -//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_listen_trampoline() - -//go:linkname libc_listen libc_listen -//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkdir_trampoline() - -//go:linkname libc_mkdir libc_mkdir -//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkdirat_trampoline() - -//go:linkname libc_mkdirat libc_mkdirat -//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkfifo_trampoline() - -//go:linkname libc_mkfifo libc_mkfifo -//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mknod_trampoline() - -//go:linkname libc_mknod libc_mknod -//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_open_trampoline() - -//go:linkname libc_open libc_open -//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_openat_trampoline() - -//go:linkname libc_openat libc_openat -//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pathconf_trampoline() - -//go:linkname libc_pathconf libc_pathconf -//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pread_trampoline() - -//go:linkname libc_pread libc_pread -//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pwrite_trampoline() - -//go:linkname libc_pwrite libc_pwrite -//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_read_trampoline() - -//go:linkname libc_read libc_read -//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_readlink_trampoline() - -//go:linkname libc_readlink libc_readlink -//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_readlinkat_trampoline() - -//go:linkname libc_readlinkat libc_readlinkat -//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_rename_trampoline() - -//go:linkname libc_rename libc_rename -//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_renameat_trampoline() - -//go:linkname libc_renameat libc_renameat -//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_revoke_trampoline() - -//go:linkname libc_revoke libc_revoke -//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_rmdir_trampoline() - -//go:linkname libc_rmdir libc_rmdir -//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := syscall_syscall6(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lseek_trampoline() - -//go:linkname libc_lseek libc_lseek -//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_select_trampoline() - -//go:linkname libc_select libc_select -//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setegid_trampoline() - -//go:linkname libc_setegid libc_setegid -//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_seteuid_trampoline() - -//go:linkname libc_seteuid libc_seteuid -//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setgid_trampoline() - -//go:linkname libc_setgid libc_setgid -//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setlogin_trampoline() - -//go:linkname libc_setlogin libc_setlogin -//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setpgid_trampoline() - -//go:linkname libc_setpgid libc_setpgid -//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setpriority_trampoline() - -//go:linkname libc_setpriority libc_setpriority -//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setprivexec_trampoline() - -//go:linkname libc_setprivexec libc_setprivexec -//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setregid_trampoline() - -//go:linkname libc_setregid libc_setregid -//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setreuid_trampoline() - -//go:linkname libc_setreuid libc_setreuid -//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setrlimit_trampoline() - -//go:linkname libc_setrlimit libc_setrlimit -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setsid_trampoline() - -//go:linkname libc_setsid libc_setsid -//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_settimeofday_trampoline() - -//go:linkname libc_settimeofday libc_settimeofday -//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setuid_trampoline() - -//go:linkname libc_setuid libc_setuid -//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_symlink_trampoline() - -//go:linkname libc_symlink libc_symlink -//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_symlinkat_trampoline() - -//go:linkname libc_symlinkat libc_symlinkat -//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sync_trampoline() - -//go:linkname libc_sync libc_sync -//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_truncate_trampoline() - -//go:linkname libc_truncate libc_truncate -//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -func libc_umask_trampoline() - -//go:linkname libc_umask libc_umask -//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_undelete_trampoline() - -//go:linkname libc_undelete libc_undelete -//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unlink_trampoline() - -//go:linkname libc_unlink libc_unlink -//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unlinkat_trampoline() - -//go:linkname libc_unlinkat libc_unlinkat -//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unmount_trampoline() - -//go:linkname libc_unmount libc_unmount -//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_write_trampoline() - -//go:linkname libc_write libc_write -//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall9(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mmap_trampoline() - -//go:linkname libc_mmap libc_mmap -//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munmap_trampoline() - -//go:linkname libc_munmap libc_munmap -//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ptrace_trampoline() - -//go:linkname libc_ptrace libc_ptrace -//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstat64_trampoline() - -//go:linkname libc_fstat64 libc_fstat64 -//go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatat64_trampoline() - -//go:linkname libc_fstatat64 libc_fstatat64 -//go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatfs64_trampoline() - -//go:linkname libc_fstatfs64 libc_fstatfs64 -//go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat64_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getfsstat64_trampoline() - -//go:linkname libc_getfsstat64 libc_getfsstat64 -//go:cgo_import_dynamic libc_getfsstat64 getfsstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lstat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lstat64_trampoline() - -//go:linkname libc_lstat64 libc_lstat64 -//go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_stat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_stat64_trampoline() - -//go:linkname libc_stat64 libc_stat64 -//go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_statfs64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_statfs64_trampoline() - -//go:linkname libc_statfs64 libc_statfs64 -//go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s deleted file mode 100644 index 6836a41290..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.s +++ /dev/null @@ -1,284 +0,0 @@ -// go run mkasm_darwin.go 386 -// Code generated by the command above; DO NOT EDIT. - -// +build go1.12 - -#include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 - JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 - JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 - JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_futimes(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 - JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 - JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlockall(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setattrlist(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fcntl(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ioctl(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sysctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 - JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 - JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchownat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 - JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 - JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 - JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 - JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 - JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 - JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 - JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 - JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munmap(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ptrace(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstat64(SB) -TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatat64(SB) -TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatfs64(SB) -TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getfsstat64(SB) -TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lstat64(SB) -TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_stat64(SB) -TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0 - JMP libc_statfs64(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go deleted file mode 100644 index 102561730a..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_11.go +++ /dev/null @@ -1,1809 +0,0 @@ -// go run mksyscall.go -tags darwin,amd64,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.1_11.go syscall_darwin_amd64.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,amd64,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) - newoffset = int64(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(_p0), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go index 314042a9d4..a06eb09324 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags darwin,amd64,go1.13 syscall_darwin.1_13.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build darwin && amd64 && go1.13 // +build darwin,amd64,go1.13 package unix @@ -15,27 +16,25 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) + _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_closedir_trampoline() +var libc_closedir_trampoline_addr uintptr -//go:linkname libc_closedir libc_closedir //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) + r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) res = Errno(r0) return } -func libc_readdir_r_trampoline() +var libc_readdir_r_trampoline_addr uintptr -//go:linkname libc_readdir_r libc_readdir_r //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s index d671e8311f..d6c3e25c01 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.1_13.s @@ -1,12 +1,25 @@ // go run mkasm_darwin.go amd64 // Code generated by the command above; DO NOT EDIT. +//go:build go1.13 // +build go1.13 #include "textflag.h" -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 + +TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fdopendir(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) + +TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_closedir(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) + +TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readdir_r(SB) + +GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index c67e336e2a..0ae0ed4cb8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags darwin,amd64,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build darwin && amd64 && go1.12 // +build darwin,amd64,go1.12 package unix @@ -15,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -23,30 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -func libc_getgroups_trampoline() +var libc_getgroups_trampoline_addr uintptr -//go:linkname libc_getgroups libc_getgroups //go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgroups_trampoline() +var libc_setgroups_trampoline_addr uintptr -//go:linkname libc_setgroups libc_setgroups //go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -54,15 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } -func libc_wait4_trampoline() +var libc_wait4_trampoline_addr uintptr -//go:linkname libc_wait4 libc_wait4 //go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -70,45 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func libc_accept_trampoline() +var libc_accept_trampoline_addr uintptr -//go:linkname libc_accept libc_accept //go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_bind_trampoline() +var libc_bind_trampoline_addr uintptr -//go:linkname libc_bind libc_bind //go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_connect_trampoline() +var libc_connect_trampoline_addr uintptr -//go:linkname libc_connect libc_connect //go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -116,99 +111,92 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -func libc_socket_trampoline() +var libc_socket_trampoline_addr uintptr -//go:linkname libc_socket libc_socket //go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockopt_trampoline() +var libc_getsockopt_trampoline_addr uintptr -//go:linkname libc_getsockopt libc_getsockopt //go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setsockopt_trampoline() +var libc_setsockopt_trampoline_addr uintptr -//go:linkname libc_setsockopt libc_setsockopt //go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getpeername_trampoline() +var libc_getpeername_trampoline_addr uintptr -//go:linkname libc_getpeername libc_getpeername //go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockname_trampoline() +var libc_getsockname_trampoline_addr uintptr -//go:linkname libc_getsockname libc_getsockname //go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_shutdown_trampoline() +var libc_shutdown_trampoline_addr uintptr -//go:linkname libc_shutdown libc_shutdown //go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_socketpair_trampoline() +var libc_socketpair_trampoline_addr uintptr -//go:linkname libc_socketpair libc_socketpair //go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -220,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -228,9 +216,8 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func libc_recvfrom_trampoline() +var libc_recvfrom_trampoline_addr uintptr -//go:linkname libc_recvfrom libc_recvfrom //go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -242,22 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendto_trampoline() +var libc_sendto_trampoline_addr uintptr -//go:linkname libc_sendto libc_sendto //go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -265,15 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_recvmsg_trampoline() +var libc_recvmsg_trampoline_addr uintptr -//go:linkname libc_recvmsg libc_recvmsg //go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -281,15 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_sendmsg_trampoline() +var libc_sendmsg_trampoline_addr uintptr -//go:linkname libc_sendmsg libc_sendmsg //go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -297,9 +281,8 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -func libc_kevent_trampoline() +var libc_kevent_trampoline_addr uintptr -//go:linkname libc_kevent libc_kevent //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -310,37 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_utimes_trampoline() +var libc_utimes_trampoline_addr uintptr -//go:linkname libc_utimes libc_utimes //go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_futimes_trampoline() +var libc_futimes_trampoline_addr uintptr -//go:linkname libc_futimes libc_futimes //go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -348,9 +329,8 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -func libc_poll_trampoline() +var libc_poll_trampoline_addr uintptr -//go:linkname libc_poll libc_poll //go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -362,16 +342,15 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_madvise_trampoline() +var libc_madvise_trampoline_addr uintptr -//go:linkname libc_madvise libc_madvise //go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -383,31 +362,29 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlock_trampoline() +var libc_mlock_trampoline_addr uintptr -//go:linkname libc_mlock libc_mlock //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlockall_trampoline() +var libc_mlockall_trampoline_addr uintptr -//go:linkname libc_mlockall libc_mlockall //go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -419,16 +396,15 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mprotect_trampoline() +var libc_mprotect_trampoline_addr uintptr -//go:linkname libc_mprotect libc_mprotect //go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -440,16 +416,15 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_msync_trampoline() +var libc_msync_trampoline_addr uintptr -//go:linkname libc_msync libc_msync //go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -461,63 +436,43 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlock_trampoline() +var libc_munlock_trampoline_addr uintptr -//go:linkname libc_munlock libc_munlock //go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlockall_trampoline() +var libc_munlockall_trampoline_addr uintptr -//go:linkname libc_munlockall libc_munlockall //go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) +func pipe(p *[2]int32) (err error) { + _, _, e1 := syscall_rawSyscall(libc_pipe_trampoline_addr, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getattrlist_trampoline() +var libc_pipe_trampoline_addr uintptr -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pipe_trampoline() - -//go:linkname libc_pipe libc_pipe //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -533,7 +488,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := syscall_syscall6(libc_getxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -541,9 +496,8 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o return } -func libc_getxattr_trampoline() +var libc_getxattr_trampoline_addr uintptr -//go:linkname libc_getxattr libc_getxattr //go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -554,7 +508,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := syscall_syscall6(libc_fgetxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -562,9 +516,8 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio return } -func libc_fgetxattr_trampoline() +var libc_fgetxattr_trampoline_addr uintptr -//go:linkname libc_fgetxattr libc_fgetxattr //go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -580,16 +533,15 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := syscall_syscall6(libc_setxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setxattr_trampoline() +var libc_setxattr_trampoline_addr uintptr -//go:linkname libc_setxattr libc_setxattr //go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -600,16 +552,15 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := syscall_syscall6(libc_fsetxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsetxattr_trampoline() +var libc_fsetxattr_trampoline_addr uintptr -//go:linkname libc_fsetxattr libc_fsetxattr //go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -625,16 +576,15 @@ func removexattr(path string, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_removexattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_removexattr_trampoline() +var libc_removexattr_trampoline_addr uintptr -//go:linkname libc_removexattr libc_removexattr //go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -645,16 +595,15 @@ func fremovexattr(fd int, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_fremovexattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fremovexattr_trampoline() +var libc_fremovexattr_trampoline_addr uintptr -//go:linkname libc_fremovexattr libc_fremovexattr //go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -665,7 +614,7 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := syscall_syscall6(libc_listxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -673,15 +622,14 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro return } -func libc_listxattr_trampoline() +var libc_listxattr_trampoline_addr uintptr -//go:linkname libc_listxattr libc_listxattr //go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := syscall_syscall6(libc_flistxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -689,30 +637,28 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { return } -func libc_flistxattr_trampoline() +var libc_flistxattr_trampoline_addr uintptr -//go:linkname libc_flistxattr libc_flistxattr //go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) + _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setattrlist_trampoline() +var libc_setattrlist_trampoline_addr uintptr -//go:linkname libc_setattrlist libc_setattrlist //go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -720,39 +666,36 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func libc_fcntl_trampoline() +var libc_fcntl_trampoline_addr uintptr -//go:linkname libc_fcntl libc_fcntl //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_kill_trampoline() +var libc_kill_trampoline_addr uintptr -//go:linkname libc_kill libc_kill //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ioctl_trampoline() +var libc_ioctl_trampoline_addr uintptr -//go:linkname libc_ioctl libc_ioctl //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -764,66 +707,121 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sysctl_trampoline() +var libc_sysctl_trampoline_addr uintptr -//go:linkname libc_sysctl libc_sysctl //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) + _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendfile_trampoline() +var libc_sendfile_trampoline_addr uintptr -//go:linkname libc_sendfile libc_sendfile //go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmdt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmget_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_access_trampoline() +var libc_access_trampoline_addr uintptr -//go:linkname libc_access libc_access //go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_adjtime_trampoline() +var libc_adjtime_trampoline_addr uintptr -//go:linkname libc_adjtime libc_adjtime //go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -834,16 +832,15 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chdir_trampoline() +var libc_chdir_trampoline_addr uintptr -//go:linkname libc_chdir libc_chdir //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -854,16 +851,15 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chflags_trampoline() +var libc_chflags_trampoline_addr uintptr -//go:linkname libc_chflags libc_chflags //go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -874,16 +870,15 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chmod_trampoline() +var libc_chmod_trampoline_addr uintptr -//go:linkname libc_chmod libc_chmod //go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -894,16 +889,15 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chown_trampoline() +var libc_chown_trampoline_addr uintptr -//go:linkname libc_chown libc_chown //go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -914,52 +908,97 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chroot_trampoline() +var libc_chroot_trampoline_addr uintptr -//go:linkname libc_chroot libc_chroot //go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_clock_gettime_trampoline() +var libc_clock_gettime_trampoline_addr uintptr -//go:linkname libc_clock_gettime libc_clock_gettime //go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_close_trampoline() +var libc_close_trampoline_addr uintptr -//go:linkname libc_close libc_close //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Clonefile(src string, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_clonefile_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_clonefile_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_clonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_clonefileat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -967,24 +1006,22 @@ func Dup(fd int) (nfd int, err error) { return } -func libc_dup_trampoline() +var libc_dup_trampoline_addr uintptr -//go:linkname libc_dup libc_dup //go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_dup2_trampoline() +var libc_dup2_trampoline_addr uintptr -//go:linkname libc_dup2 libc_dup2 //go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1000,28 +1037,26 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_exchangedata_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_exchangedata_trampoline() +var libc_exchangedata_trampoline_addr uintptr -//go:linkname libc_exchangedata libc_exchangedata //go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } -func libc_exit_trampoline() +var libc_exit_trampoline_addr uintptr -//go:linkname libc_exit libc_exit //go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1032,61 +1067,57 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_faccessat_trampoline() +var libc_faccessat_trampoline_addr uintptr -//go:linkname libc_faccessat libc_faccessat //go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchdir_trampoline() +var libc_fchdir_trampoline_addr uintptr -//go:linkname libc_fchdir libc_fchdir //go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchflags_trampoline() +var libc_fchflags_trampoline_addr uintptr -//go:linkname libc_fchflags libc_fchflags //go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmod_trampoline() +var libc_fchmod_trampoline_addr uintptr -//go:linkname libc_fchmod libc_fchmod //go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1097,31 +1128,29 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmodat_trampoline() +var libc_fchmodat_trampoline_addr uintptr -//go:linkname libc_fchmodat libc_fchmodat //go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchown_trampoline() +var libc_fchown_trampoline_addr uintptr -//go:linkname libc_fchown libc_fchown //go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1132,37 +1161,54 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchownat_trampoline() +var libc_fchownat_trampoline_addr uintptr -//go:linkname libc_fchownat libc_fchownat //go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_fclonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fclonefileat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_flock_trampoline() +var libc_flock_trampoline_addr uintptr -//go:linkname libc_flock libc_flock //go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1170,97 +1216,111 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -func libc_fpathconf_trampoline() +var libc_fpathconf_trampoline_addr uintptr -//go:linkname libc_fpathconf libc_fpathconf //go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsync_trampoline() +var libc_fsync_trampoline_addr uintptr -//go:linkname libc_fsync libc_fsync //go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ftruncate_trampoline() +var libc_ftruncate_trampoline_addr uintptr -//go:linkname libc_ftruncate libc_ftruncate //go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) + r0, _, _ := syscall_syscall(libc_getdtablesize_trampoline_addr, 0, 0, 0) size = int(r0) return } -func libc_getdtablesize_trampoline() +var libc_getdtablesize_trampoline_addr uintptr -//go:linkname libc_getdtablesize libc_getdtablesize //go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } -func libc_getegid_trampoline() +var libc_getegid_trampoline_addr uintptr -//go:linkname libc_getegid libc_getegid //go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } -func libc_geteuid_trampoline() +var libc_geteuid_trampoline_addr uintptr -//go:linkname libc_geteuid libc_geteuid //go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } -func libc_getgid_trampoline() +var libc_getgid_trampoline_addr uintptr -//go:linkname libc_getgid libc_getgid //go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1268,54 +1328,50 @@ func Getpgid(pid int) (pgid int, err error) { return } -func libc_getpgid_trampoline() +var libc_getpgid_trampoline_addr uintptr -//go:linkname libc_getpgid libc_getpgid //go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } -func libc_getpgrp_trampoline() +var libc_getpgrp_trampoline_addr uintptr -//go:linkname libc_getpgrp libc_getpgrp //go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } -func libc_getpid_trampoline() +var libc_getpid_trampoline_addr uintptr -//go:linkname libc_getpid libc_getpid //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } -func libc_getppid_trampoline() +var libc_getppid_trampoline_addr uintptr -//go:linkname libc_getppid libc_getppid //go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1323,45 +1379,42 @@ func Getpriority(which int, who int) (prio int, err error) { return } -func libc_getpriority_trampoline() +var libc_getpriority_trampoline_addr uintptr -//go:linkname libc_getpriority libc_getpriority //go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrlimit_trampoline() +var libc_getrlimit_trampoline_addr uintptr -//go:linkname libc_getrlimit libc_getrlimit //go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrusage_trampoline() +var libc_getrusage_trampoline_addr uintptr -//go:linkname libc_getrusage libc_getrusage //go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1369,56 +1422,52 @@ func Getsid(pid int) (sid int, err error) { return } -func libc_getsid_trampoline() +var libc_getsid_trampoline_addr uintptr -//go:linkname libc_getsid libc_getsid //go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_gettimeofday_trampoline() +var libc_gettimeofday_trampoline_addr uintptr -//go:linkname libc_gettimeofday libc_gettimeofday //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } -func libc_getuid_trampoline() +var libc_getuid_trampoline_addr uintptr -//go:linkname libc_getuid libc_getuid //go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } -func libc_issetugid_trampoline() +var libc_issetugid_trampoline_addr uintptr -//go:linkname libc_issetugid libc_issetugid //go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1426,9 +1475,8 @@ func Kqueue() (fd int, err error) { return } -func libc_kqueue_trampoline() +var libc_kqueue_trampoline_addr uintptr -//go:linkname libc_kqueue libc_kqueue //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1439,16 +1487,15 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lchown_trampoline() +var libc_lchown_trampoline_addr uintptr -//go:linkname libc_lchown libc_lchown //go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1464,16 +1511,15 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_link_trampoline() +var libc_link_trampoline_addr uintptr -//go:linkname libc_link libc_link //go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1489,31 +1535,29 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_linkat_trampoline() +var libc_linkat_trampoline_addr uintptr -//go:linkname libc_linkat libc_linkat //go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_listen_trampoline() +var libc_listen_trampoline_addr uintptr -//go:linkname libc_listen libc_listen //go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1524,16 +1568,15 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdir_trampoline() +var libc_mkdir_trampoline_addr uintptr -//go:linkname libc_mkdir libc_mkdir //go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1544,16 +1587,15 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdirat_trampoline() +var libc_mkdirat_trampoline_addr uintptr -//go:linkname libc_mkdirat libc_mkdirat //go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1564,16 +1606,15 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkfifo_trampoline() +var libc_mkfifo_trampoline_addr uintptr -//go:linkname libc_mkfifo libc_mkfifo //go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1584,16 +1625,15 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mknod_trampoline() +var libc_mknod_trampoline_addr uintptr -//go:linkname libc_mknod libc_mknod //go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1604,7 +1644,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1612,9 +1652,8 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -func libc_open_trampoline() +var libc_open_trampoline_addr uintptr -//go:linkname libc_open libc_open //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1625,7 +1664,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1633,9 +1672,8 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } -func libc_openat_trampoline() +var libc_openat_trampoline_addr uintptr -//go:linkname libc_openat libc_openat //go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1646,7 +1684,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1654,9 +1692,8 @@ func Pathconf(path string, name int) (val int, err error) { return } -func libc_pathconf_trampoline() +var libc_pathconf_trampoline_addr uintptr -//go:linkname libc_pathconf libc_pathconf //go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1668,7 +1705,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1676,9 +1713,8 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pread_trampoline() +var libc_pread_trampoline_addr uintptr -//go:linkname libc_pread libc_pread //go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1690,7 +1726,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1698,9 +1734,8 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pwrite_trampoline() +var libc_pwrite_trampoline_addr uintptr -//go:linkname libc_pwrite libc_pwrite //go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1712,7 +1747,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1720,9 +1755,8 @@ func read(fd int, p []byte) (n int, err error) { return } -func libc_read_trampoline() +var libc_read_trampoline_addr uintptr -//go:linkname libc_read libc_read //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1739,7 +1773,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1747,9 +1781,8 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -func libc_readlink_trampoline() +var libc_readlink_trampoline_addr uintptr -//go:linkname libc_readlink libc_readlink //go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1766,7 +1799,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1774,9 +1807,8 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } -func libc_readlinkat_trampoline() +var libc_readlinkat_trampoline_addr uintptr -//go:linkname libc_readlinkat libc_readlinkat //go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1792,16 +1824,15 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rename_trampoline() +var libc_rename_trampoline_addr uintptr -//go:linkname libc_rename libc_rename //go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1817,16 +1848,15 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_renameat_trampoline() +var libc_renameat_trampoline_addr uintptr -//go:linkname libc_renameat libc_renameat //go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1837,16 +1867,15 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_revoke_trampoline() +var libc_revoke_trampoline_addr uintptr -//go:linkname libc_revoke libc_revoke //go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1857,22 +1886,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rmdir_trampoline() +var libc_rmdir_trampoline_addr uintptr -//go:linkname libc_rmdir libc_rmdir //go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(whence)) + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1880,15 +1908,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -func libc_lseek_trampoline() +var libc_lseek_trampoline_addr uintptr -//go:linkname libc_lseek libc_lseek //go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1896,54 +1923,50 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } -func libc_select_trampoline() +var libc_select_trampoline_addr uintptr -//go:linkname libc_select libc_select //go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) + _, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setegid_trampoline() +var libc_setegid_trampoline_addr uintptr -//go:linkname libc_setegid libc_setegid //go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_seteuid_trampoline() +var libc_seteuid_trampoline_addr uintptr -//go:linkname libc_seteuid libc_seteuid //go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgid_trampoline() +var libc_setgid_trampoline_addr uintptr -//go:linkname libc_setgid libc_setgid //go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1954,112 +1977,105 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setlogin_trampoline() +var libc_setlogin_trampoline_addr uintptr -//go:linkname libc_setlogin libc_setlogin //go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpgid_trampoline() +var libc_setpgid_trampoline_addr uintptr -//go:linkname libc_setpgid libc_setpgid //go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpriority_trampoline() +var libc_setpriority_trampoline_addr uintptr -//go:linkname libc_setpriority libc_setpriority //go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) + _, _, e1 := syscall_syscall(libc_setprivexec_trampoline_addr, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setprivexec_trampoline() +var libc_setprivexec_trampoline_addr uintptr -//go:linkname libc_setprivexec libc_setprivexec //go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setregid_trampoline() +var libc_setregid_trampoline_addr uintptr -//go:linkname libc_setregid libc_setregid //go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setreuid_trampoline() +var libc_setreuid_trampoline_addr uintptr -//go:linkname libc_setreuid libc_setreuid //go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setrlimit_trampoline() +var libc_setrlimit_trampoline_addr uintptr -//go:linkname libc_setrlimit libc_setrlimit //go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2067,39 +2083,36 @@ func Setsid() (pid int, err error) { return } -func libc_setsid_trampoline() +var libc_setsid_trampoline_addr uintptr -//go:linkname libc_setsid libc_setsid //go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_settimeofday_trampoline() +var libc_settimeofday_trampoline_addr uintptr -//go:linkname libc_settimeofday libc_settimeofday //go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setuid_trampoline() +var libc_setuid_trampoline_addr uintptr -//go:linkname libc_setuid libc_setuid //go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2115,16 +2128,15 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlink_trampoline() +var libc_symlink_trampoline_addr uintptr -//go:linkname libc_symlink libc_symlink //go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2140,31 +2152,29 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlinkat_trampoline() +var libc_symlinkat_trampoline_addr uintptr -//go:linkname libc_symlinkat libc_symlinkat //go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sync_trampoline() +var libc_sync_trampoline_addr uintptr -//go:linkname libc_sync libc_sync //go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2175,29 +2185,27 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_truncate_trampoline() +var libc_truncate_trampoline_addr uintptr -//go:linkname libc_truncate libc_truncate //go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } -func libc_umask_trampoline() +var libc_umask_trampoline_addr uintptr -//go:linkname libc_umask libc_umask //go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2208,16 +2216,15 @@ func Undelete(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_undelete_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_undelete_trampoline() +var libc_undelete_trampoline_addr uintptr -//go:linkname libc_undelete libc_undelete //go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2228,16 +2235,15 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlink_trampoline() +var libc_unlink_trampoline_addr uintptr -//go:linkname libc_unlink libc_unlink //go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2248,16 +2254,15 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlinkat_trampoline() +var libc_unlinkat_trampoline_addr uintptr -//go:linkname libc_unlinkat libc_unlinkat //go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2268,16 +2273,15 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unmount_trampoline() +var libc_unmount_trampoline_addr uintptr -//go:linkname libc_unmount libc_unmount //go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2289,7 +2293,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2297,15 +2301,14 @@ func write(fd int, p []byte) (n int, err error) { return } -func libc_write_trampoline() +var libc_write_trampoline_addr uintptr -//go:linkname libc_write libc_write //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -2313,30 +2316,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -func libc_mmap_trampoline() +var libc_mmap_trampoline_addr uintptr -//go:linkname libc_mmap libc_mmap //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munmap_trampoline() +var libc_munmap_trampoline_addr uintptr -//go:linkname libc_munmap libc_munmap //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2347,7 +2348,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2357,32 +2358,16 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ptrace_trampoline() - -//go:linkname libc_ptrace libc_ptrace -//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstat64_trampoline() +var libc_fstat64_trampoline_addr uintptr -//go:linkname libc_fstat64 libc_fstat64 //go:cgo_import_dynamic libc_fstat64 fstat64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2393,37 +2378,35 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstatat64_trampoline() +var libc_fstatat64_trampoline_addr uintptr -//go:linkname libc_fstatat64 libc_fstatat64 //go:cgo_import_dynamic libc_fstatat64 fstatat64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs64_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs64_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstatfs64_trampoline() +var libc_fstatfs64_trampoline_addr uintptr -//go:linkname libc_fstatfs64 libc_fstatfs64 //go:cgo_import_dynamic libc_fstatfs64 fstatfs64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat64_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_getfsstat64_trampoline_addr, uintptr(buf), uintptr(size), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2431,9 +2414,8 @@ func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { return } -func libc_getfsstat64_trampoline() +var libc_getfsstat64_trampoline_addr uintptr -//go:linkname libc_getfsstat64 libc_getfsstat64 //go:cgo_import_dynamic libc_getfsstat64 getfsstat64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2444,36 +2426,48 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lstat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat64_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lstat64_trampoline() +var libc_lstat64_trampoline_addr uintptr -//go:linkname libc_lstat64 libc_lstat64 //go:cgo_import_dynamic libc_lstat64 lstat64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { + _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_ptrace_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_stat64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat64_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_stat64_trampoline() +var libc_stat64_trampoline_addr uintptr -//go:linkname libc_stat64 libc_stat64 //go:cgo_import_dynamic libc_stat64 stat64 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2484,14 +2478,13 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_statfs64_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs64_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_statfs64_trampoline() +var libc_statfs64_trampoline_addr uintptr -//go:linkname libc_statfs64 libc_statfs64 //go:cgo_import_dynamic libc_statfs64 statfs64 "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index a3fdf099d0..eac6ca806f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -1,284 +1,883 @@ // go run mkasm_darwin.go amd64 // Code generated by the command above; DO NOT EDIT. +//go:build go1.12 // +build go1.12 #include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pipe_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe_trampoline_addr(SB)/8, $libc_pipe_trampoline<>(SB) + +TEXT libc_getxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getxattr_trampoline_addr(SB)/8, $libc_getxattr_trampoline<>(SB) + +TEXT libc_fgetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fgetxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fgetxattr_trampoline_addr(SB)/8, $libc_fgetxattr_trampoline<>(SB) + +TEXT libc_setxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setxattr_trampoline_addr(SB)/8, $libc_setxattr_trampoline<>(SB) + +TEXT libc_fsetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fsetxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsetxattr_trampoline_addr(SB)/8, $libc_fsetxattr_trampoline<>(SB) + +TEXT libc_removexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_removexattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_removexattr_trampoline_addr(SB)/8, $libc_removexattr_trampoline<>(SB) + +TEXT libc_fremovexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fremovexattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fremovexattr_trampoline_addr(SB)/8, $libc_fremovexattr_trampoline<>(SB) + +TEXT libc_listxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_listxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listxattr_trampoline_addr(SB)/8, $libc_listxattr_trampoline<>(SB) + +TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB) + +TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setattrlist(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB) + +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) + +TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmat(SB) + +GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB) + +TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmctl(SB) + +GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB) + +TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmdt(SB) + +GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB) + +TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmget(SB) + +GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_clonefile_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clonefile(SB) + +GLOBL ·libc_clonefile_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clonefile_trampoline_addr(SB)/8, $libc_clonefile_trampoline<>(SB) + +TEXT libc_clonefileat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clonefileat(SB) + +GLOBL ·libc_clonefileat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clonefileat_trampoline_addr(SB)/8, $libc_clonefileat_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_exchangedata_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_exchangedata_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exchangedata_trampoline_addr(SB)/8, $libc_exchangedata_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_fclonefileat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fclonefileat(SB) + +GLOBL ·libc_fclonefileat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fclonefileat_trampoline_addr(SB)/8, $libc_fclonefileat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) + +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_getdtablesize_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getdtablesize_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdtablesize_trampoline_addr(SB)/8, $libc_getdtablesize_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) + +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setprivexec_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setprivexec_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setprivexec_trampoline_addr(SB)/8, $libc_setprivexec_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_undelete_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_undelete_trampoline_addr(SB), RODATA, $8 +DATA ·libc_undelete_trampoline_addr(SB)/8, $libc_undelete_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ptrace(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_fstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstat64(SB) -TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat64_trampoline_addr(SB)/8, $libc_fstat64_trampoline<>(SB) + +TEXT libc_fstatat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatat64(SB) -TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstatat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat64_trampoline_addr(SB)/8, $libc_fstatat64_trampoline<>(SB) + +TEXT libc_fstatfs64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatfs64(SB) -TEXT ·libc_getfsstat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstatfs64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs64_trampoline_addr(SB)/8, $libc_fstatfs64_trampoline<>(SB) + +TEXT libc_getfsstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getfsstat64(SB) -TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getfsstat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat64_trampoline_addr(SB)/8, $libc_getfsstat64_trampoline<>(SB) + +TEXT libc_lstat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lstat64(SB) -TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lstat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat64_trampoline_addr(SB)/8, $libc_lstat64_trampoline<>(SB) + +TEXT libc_ptrace_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ptrace(SB) + +GLOBL ·libc_ptrace_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ptrace_trampoline_addr(SB)/8, $libc_ptrace_trampoline<>(SB) + +TEXT libc_stat64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_stat64(SB) -TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_stat64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat64_trampoline_addr(SB)/8, $libc_stat64_trampoline<>(SB) + +TEXT libc_statfs64_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_statfs64(SB) + +GLOBL ·libc_statfs64_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs64_trampoline_addr(SB)/8, $libc_statfs64_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go deleted file mode 100644 index d34e6df2fe..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_11.go +++ /dev/null @@ -1,1782 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,arm,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm.1_11.go syscall_darwin_arm.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,arm,!go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := Syscall6(SYS_WAIT4, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := Syscall(SYS_FUTIMES, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MADVISE, uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := Syscall(SYS_MLOCKALL, uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(SYS_MUNLOCK, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := Syscall(SYS_MUNLOCKALL, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_ACCESS, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := Syscall(SYS_ADJTIME, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHMOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_CHROOT, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := Syscall(SYS_DUP, uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - Syscall(SYS_EXIT, uintptr(code), 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FACCESSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := Syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHMODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FCHOWNAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := Syscall(SYS_FLOCK, uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FPATHCONF, uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0) - egid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0) - gid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETPGID, uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := RawSyscall(SYS_GETPGRP, 0, 0, 0) - pgrp = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0) - pid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0) - ppid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := Syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := RawSyscall(SYS_GETSID, uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0) - uid = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_LINKAT, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIR, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKDIRAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKFIFO, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_MKNOD, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall(SYS_PATHCONF, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_READLINK, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall6(SYS_READLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RENAME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REVOKE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_RMDIR, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := Syscall6(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := Syscall6(SYS_SELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETEUID, uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETGID, uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SETLOGIN, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_SETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETUID, uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINK, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_SYMLINKAT, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := Syscall(SYS_SYNC, 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := Syscall(SYS_UMASK, uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINK, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNLINKAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := Syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := Syscall(SYS_WRITE, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go deleted file mode 100644 index f519ce9afb..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.go +++ /dev/null @@ -1,41 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,arm,go1.13 syscall_darwin.1_13.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,arm,go1.13 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_closedir_trampoline() - -//go:linkname libc_closedir libc_closedir -//go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) - res = Errno(r0) - return -} - -func libc_readdir_r_trampoline() - -//go:linkname libc_readdir_r libc_readdir_r -//go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s deleted file mode 100644 index 488e55707a..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.1_13.s +++ /dev/null @@ -1,12 +0,0 @@ -// go run mkasm_darwin.go arm -// Code generated by the command above; DO NOT EDIT. - -// +build go1.13 - -#include "textflag.h" -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fdopendir(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_closedir(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readdir_r(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go deleted file mode 100644 index b759757a77..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go +++ /dev/null @@ -1,2482 +0,0 @@ -// go run mksyscall.go -l32 -tags darwin,arm,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build darwin,arm,go1.12 - -package unix - -import ( - "syscall" - "unsafe" -) - -var _ syscall.Errno - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getgroups_trampoline() - -//go:linkname libc_getgroups libc_getgroups -//go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setgroups_trampoline() - -//go:linkname libc_setgroups libc_setgroups -//go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) - wpid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_wait4_trampoline() - -//go:linkname libc_wait4 libc_wait4 -//go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_accept_trampoline() - -//go:linkname libc_accept libc_accept -//go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_bind_trampoline() - -//go:linkname libc_bind libc_bind -//go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_connect_trampoline() - -//go:linkname libc_connect libc_connect -//go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_socket_trampoline() - -//go:linkname libc_socket libc_socket -//go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsockopt_trampoline() - -//go:linkname libc_getsockopt libc_getsockopt -//go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setsockopt_trampoline() - -//go:linkname libc_setsockopt libc_setsockopt -//go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpeername_trampoline() - -//go:linkname libc_getpeername libc_getpeername -//go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsockname_trampoline() - -//go:linkname libc_getsockname libc_getsockname -//go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_shutdown_trampoline() - -//go:linkname libc_shutdown libc_shutdown -//go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_socketpair_trampoline() - -//go:linkname libc_socketpair libc_socketpair -//go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_recvfrom_trampoline() - -//go:linkname libc_recvfrom libc_recvfrom -//go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { - var _p0 unsafe.Pointer - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendto_trampoline() - -//go:linkname libc_sendto libc_sendto -//go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_recvmsg_trampoline() - -//go:linkname libc_recvmsg libc_recvmsg -//go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendmsg_trampoline() - -//go:linkname libc_sendmsg libc_sendmsg -//go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kevent_trampoline() - -//go:linkname libc_kevent libc_kevent -//go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func utimes(path string, timeval *[2]Timeval) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_utimes_trampoline() - -//go:linkname libc_utimes libc_utimes -//go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_futimes_trampoline() - -//go:linkname libc_futimes libc_futimes -//go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_poll_trampoline() - -//go:linkname libc_poll libc_poll -//go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Madvise(b []byte, behav int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_madvise_trampoline() - -//go:linkname libc_madvise libc_madvise -//go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mlock_trampoline() - -//go:linkname libc_mlock libc_mlock -//go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mlockall_trampoline() - -//go:linkname libc_mlockall libc_mlockall -//go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mprotect(b []byte, prot int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mprotect_trampoline() - -//go:linkname libc_mprotect libc_mprotect -//go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Msync(b []byte, flags int) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_msync_trampoline() - -//go:linkname libc_msync libc_msync -//go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlock(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munlock_trampoline() - -//go:linkname libc_munlock libc_munlock -//go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munlockall_trampoline() - -//go:linkname libc_munlockall libc_munlockall -//go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getattrlist_trampoline() - -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pipe_trampoline() - -//go:linkname libc_pipe libc_pipe -//go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getxattr_trampoline() - -//go:linkname libc_getxattr libc_getxattr -//go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fgetxattr_trampoline() - -//go:linkname libc_fgetxattr libc_fgetxattr -//go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setxattr_trampoline() - -//go:linkname libc_setxattr libc_setxattr -//go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fsetxattr_trampoline() - -//go:linkname libc_fsetxattr libc_fsetxattr -//go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_removexattr_trampoline() - -//go:linkname libc_removexattr libc_removexattr -//go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fremovexattr_trampoline() - -//go:linkname libc_fremovexattr libc_fremovexattr -//go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_listxattr_trampoline() - -//go:linkname libc_listxattr libc_listxattr -//go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_flistxattr_trampoline() - -//go:linkname libc_flistxattr libc_flistxattr -//go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setattrlist_trampoline() - -//go:linkname libc_setattrlist libc_setattrlist -//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fcntl_trampoline() - -//go:linkname libc_fcntl libc_fcntl -//go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kill_trampoline() - -//go:linkname libc_kill libc_kill -//go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ioctl_trampoline() - -//go:linkname libc_ioctl libc_ioctl -//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := syscall_syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sysctl_trampoline() - -//go:linkname libc_sysctl libc_sysctl -//go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall9(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(offset>>32), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sendfile_trampoline() - -//go:linkname libc_sendfile libc_sendfile -//go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Access(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_access_trampoline() - -//go:linkname libc_access libc_access -//go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_adjtime_trampoline() - -//go:linkname libc_adjtime libc_adjtime -//go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chdir_trampoline() - -//go:linkname libc_chdir libc_chdir -//go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chflags(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chflags_trampoline() - -//go:linkname libc_chflags libc_chflags -//go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chmod(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chmod_trampoline() - -//go:linkname libc_chmod libc_chmod -//go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chown_trampoline() - -//go:linkname libc_chown libc_chown -//go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Chroot(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_chroot_trampoline() - -//go:linkname libc_chroot libc_chroot -//go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_clock_gettime_trampoline() - -//go:linkname libc_clock_gettime libc_clock_gettime -//go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_close_trampoline() - -//go:linkname libc_close libc_close -//go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) - nfd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_dup_trampoline() - -//go:linkname libc_dup libc_dup -//go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_dup2_trampoline() - -//go:linkname libc_dup2 libc_dup2 -//go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_exchangedata_trampoline() - -//go:linkname libc_exchangedata libc_exchangedata -//go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) - return -} - -func libc_exit_trampoline() - -//go:linkname libc_exit libc_exit -//go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_faccessat_trampoline() - -//go:linkname libc_faccessat libc_faccessat -//go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchdir_trampoline() - -//go:linkname libc_fchdir libc_fchdir -//go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchflags_trampoline() - -//go:linkname libc_fchflags libc_fchflags -//go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchmod_trampoline() - -//go:linkname libc_fchmod libc_fchmod -//go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchmodat_trampoline() - -//go:linkname libc_fchmodat libc_fchmodat -//go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchown_trampoline() - -//go:linkname libc_fchown libc_fchown -//go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fchownat_trampoline() - -//go:linkname libc_fchownat libc_fchownat -//go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_flock_trampoline() - -//go:linkname libc_flock libc_flock -//go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fpathconf_trampoline() - -//go:linkname libc_fpathconf libc_fpathconf -//go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fsync_trampoline() - -//go:linkname libc_fsync libc_fsync -//go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_ftruncate_trampoline() - -//go:linkname libc_ftruncate libc_ftruncate -//go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) - size = int(r0) - return -} - -func libc_getdtablesize_trampoline() - -//go:linkname libc_getdtablesize libc_getdtablesize -//go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) - egid = int(r0) - return -} - -func libc_getegid_trampoline() - -//go:linkname libc_getegid libc_getegid -//go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) - uid = int(r0) - return -} - -func libc_geteuid_trampoline() - -//go:linkname libc_geteuid libc_geteuid -//go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) - gid = int(r0) - return -} - -func libc_getgid_trampoline() - -//go:linkname libc_getgid libc_getgid -//go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) - pgid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpgid_trampoline() - -//go:linkname libc_getpgid libc_getpgid -//go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) - pgrp = int(r0) - return -} - -func libc_getpgrp_trampoline() - -//go:linkname libc_getpgrp libc_getpgrp -//go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) - pid = int(r0) - return -} - -func libc_getpid_trampoline() - -//go:linkname libc_getpid libc_getpid -//go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) - ppid = int(r0) - return -} - -func libc_getppid_trampoline() - -//go:linkname libc_getppid libc_getppid -//go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) - prio = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getpriority_trampoline() - -//go:linkname libc_getpriority libc_getpriority -//go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getrlimit_trampoline() - -//go:linkname libc_getrlimit libc_getrlimit -//go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getrusage_trampoline() - -//go:linkname libc_getrusage libc_getrusage -//go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) - sid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getsid_trampoline() - -//go:linkname libc_getsid libc_getsid -//go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_gettimeofday_trampoline() - -//go:linkname libc_gettimeofday libc_gettimeofday -//go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) - uid = int(r0) - return -} - -func libc_getuid_trampoline() - -//go:linkname libc_getuid libc_getuid -//go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) - tainted = bool(r0 != 0) - return -} - -func libc_issetugid_trampoline() - -//go:linkname libc_issetugid libc_issetugid -//go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_kqueue_trampoline() - -//go:linkname libc_kqueue libc_kqueue -//go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lchown(path string, uid int, gid int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lchown_trampoline() - -//go:linkname libc_lchown libc_lchown -//go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Link(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_link_trampoline() - -//go:linkname libc_link libc_link -//go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_linkat_trampoline() - -//go:linkname libc_linkat libc_linkat -//go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_listen_trampoline() - -//go:linkname libc_listen libc_listen -//go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdir(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkdir_trampoline() - -//go:linkname libc_mkdir libc_mkdir -//go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkdirat(dirfd int, path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkdirat_trampoline() - -//go:linkname libc_mkdirat libc_mkdirat -//go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mkfifo(path string, mode uint32) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mkfifo_trampoline() - -//go:linkname libc_mkfifo libc_mkfifo -//go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Mknod(path string, mode uint32, dev int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mknod_trampoline() - -//go:linkname libc_mknod libc_mknod -//go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Open(path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_open_trampoline() - -//go:linkname libc_open libc_open -//go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_openat_trampoline() - -//go:linkname libc_openat libc_openat -//go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pathconf(path string, name int) (val int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pathconf_trampoline() - -//go:linkname libc_pathconf libc_pathconf -//go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pread(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pread_trampoline() - -//go:linkname libc_pread libc_pread -//go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Pwrite(fd int, p []byte, offset int64) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pwrite_trampoline() - -//go:linkname libc_pwrite libc_pwrite -//go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func read(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_read_trampoline() - -//go:linkname libc_read libc_read -//go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlink(path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_readlink_trampoline() - -//go:linkname libc_readlink libc_readlink -//go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 unsafe.Pointer - if len(buf) > 0 { - _p1 = unsafe.Pointer(&buf[0]) - } else { - _p1 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_readlinkat_trampoline() - -//go:linkname libc_readlinkat libc_readlinkat -//go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rename(from string, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_rename_trampoline() - -//go:linkname libc_rename libc_rename -//go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Renameat(fromfd int, from string, tofd int, to string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(from) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(to) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_renameat_trampoline() - -//go:linkname libc_renameat libc_renameat -//go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Revoke(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_revoke_trampoline() - -//go:linkname libc_revoke libc_revoke -//go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Rmdir(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_rmdir_trampoline() - -//go:linkname libc_rmdir libc_rmdir -//go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, r1, e1 := syscall_syscall6(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(whence), 0, 0) - newoffset = int64(int64(r1)<<32 | int64(r0)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lseek_trampoline() - -//go:linkname libc_lseek libc_lseek -//go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_select_trampoline() - -//go:linkname libc_select libc_select -//go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setegid_trampoline() - -//go:linkname libc_setegid libc_setegid -//go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_seteuid_trampoline() - -//go:linkname libc_seteuid libc_seteuid -//go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setgid_trampoline() - -//go:linkname libc_setgid libc_setgid -//go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setlogin(name string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(name) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setlogin_trampoline() - -//go:linkname libc_setlogin libc_setlogin -//go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setpgid_trampoline() - -//go:linkname libc_setpgid libc_setpgid -//go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setpriority_trampoline() - -//go:linkname libc_setpriority libc_setpriority -//go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setprivexec_trampoline() - -//go:linkname libc_setprivexec libc_setprivexec -//go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setregid_trampoline() - -//go:linkname libc_setregid libc_setregid -//go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setreuid_trampoline() - -//go:linkname libc_setreuid libc_setreuid -//go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setrlimit_trampoline() - -//go:linkname libc_setrlimit libc_setrlimit -//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) - pid = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setsid_trampoline() - -//go:linkname libc_setsid libc_setsid -//go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_settimeofday_trampoline() - -//go:linkname libc_settimeofday libc_settimeofday -//go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_setuid_trampoline() - -//go:linkname libc_setuid libc_setuid -//go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlink(path string, link string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(link) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_symlink_trampoline() - -//go:linkname libc_symlink libc_symlink -//go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(oldpath) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(newpath) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_symlinkat_trampoline() - -//go:linkname libc_symlinkat libc_symlinkat -//go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_sync_trampoline() - -//go:linkname libc_sync libc_sync -//go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Truncate(path string, length int64) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_truncate_trampoline() - -//go:linkname libc_truncate libc_truncate -//go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) - oldmask = int(r0) - return -} - -func libc_umask_trampoline() - -//go:linkname libc_umask libc_umask -//go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_undelete_trampoline() - -//go:linkname libc_undelete libc_undelete -//go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlink(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unlink_trampoline() - -//go:linkname libc_unlink libc_unlink -//go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unlinkat(dirfd int, path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unlinkat_trampoline() - -//go:linkname libc_unlinkat libc_unlinkat -//go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Unmount(path string, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_unmount_trampoline() - -//go:linkname libc_unmount libc_unmount -//go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func write(fd int, p []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(p) > 0 { - _p0 = unsafe.Pointer(&p[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_write_trampoline() - -//go:linkname libc_write libc_write -//go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall9(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_mmap_trampoline() - -//go:linkname libc_mmap libc_mmap -//go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_munmap_trampoline() - -//go:linkname libc_munmap libc_munmap -//go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstat_trampoline() - -//go:linkname libc_fstat libc_fstat -//go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatat_trampoline() - -//go:linkname libc_fstatat libc_fstatat -//go:cgo_import_dynamic libc_fstatat fstatat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_fstatfs_trampoline() - -//go:linkname libc_fstatfs libc_fstatfs -//go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_getfsstat_trampoline() - -//go:linkname libc_getfsstat libc_getfsstat -//go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_lstat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_lstat_trampoline() - -//go:linkname libc_lstat libc_lstat -//go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_stat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_stat_trampoline() - -//go:linkname libc_stat libc_stat -//go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := syscall_syscall(funcPC(libc_statfs_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_statfs_trampoline() - -//go:linkname libc_statfs libc_statfs -//go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s deleted file mode 100644 index b67f518fa3..0000000000 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.s +++ /dev/null @@ -1,282 +0,0 @@ -// go run mkasm_darwin.go arm -// Code generated by the command above; DO NOT EDIT. - -// +build go1.12 - -#include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 - JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 - JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 - JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 - JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 - JMP libc_futimes(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 - JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 - JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munlockall(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setattrlist(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fcntl(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ioctl(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sysctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 - JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 - JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 - JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 - JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 - JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fchownat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 - JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 - JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 - JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 - JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 - JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 - JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 - JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 - JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 - JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 - JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 - JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 - JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 - JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 - JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 - JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 - JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 - JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 - JMP libc_munmap(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstat(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 - JMP libc_fstatfs(SB) -TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getfsstat(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_lstat(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 - JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 - JMP libc_statfs(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go index d64e6c806f..cec595d553 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags darwin,arm64,go1.13 syscall_darwin.1_13.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build darwin && arm64 && go1.13 // +build darwin,arm64,go1.13 package unix @@ -15,27 +16,25 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func closedir(dir uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_closedir_trampoline), uintptr(dir), 0, 0) + _, _, e1 := syscall_syscall(libc_closedir_trampoline_addr, uintptr(dir), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_closedir_trampoline() +var libc_closedir_trampoline_addr uintptr -//go:linkname libc_closedir libc_closedir //go:cgo_import_dynamic libc_closedir closedir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno) { - r0, _, _ := syscall_syscall(funcPC(libc_readdir_r_trampoline), uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) + r0, _, _ := syscall_syscall(libc_readdir_r_trampoline_addr, uintptr(dir), uintptr(unsafe.Pointer(entry)), uintptr(unsafe.Pointer(result))) res = Errno(r0) return } -func libc_readdir_r_trampoline() +var libc_readdir_r_trampoline_addr uintptr -//go:linkname libc_readdir_r libc_readdir_r //go:cgo_import_dynamic libc_readdir_r readdir_r "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s index b29dabb0f0..357989722c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_13.s @@ -1,12 +1,25 @@ // go run mkasm_darwin.go arm64 // Code generated by the command above; DO NOT EDIT. +//go:build go1.13 // +build go1.13 #include "textflag.h" -TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0 + +TEXT libc_fdopendir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fdopendir(SB) -TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fdopendir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fdopendir_trampoline_addr(SB)/8, $libc_fdopendir_trampoline<>(SB) + +TEXT libc_closedir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_closedir(SB) -TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_closedir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_closedir_trampoline_addr(SB)/8, $libc_closedir_trampoline<>(SB) + +TEXT libc_readdir_r_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readdir_r(SB) + +GLOBL ·libc_readdir_r_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readdir_r_trampoline_addr(SB)/8, $libc_readdir_r_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index b288612600..cf71be3edb 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags darwin,arm64,go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build darwin && arm64 && go1.12 // +build darwin,arm64,go1.12 package unix @@ -15,7 +16,7 @@ var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(ngid int, gid *_Gid_t) (n int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + r0, _, e1 := syscall_rawSyscall(libc_getgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -23,30 +24,28 @@ func getgroups(ngid int, gid *_Gid_t) (n int, err error) { return } -func libc_getgroups_trampoline() +var libc_getgroups_trampoline_addr uintptr -//go:linkname libc_getgroups libc_getgroups //go:cgo_import_dynamic libc_getgroups getgroups "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(ngid int, gid *_Gid_t) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgroups_trampoline), uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) + _, _, e1 := syscall_rawSyscall(libc_setgroups_trampoline_addr, uintptr(ngid), uintptr(unsafe.Pointer(gid)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgroups_trampoline() +var libc_setgroups_trampoline_addr uintptr -//go:linkname libc_setgroups libc_setgroups //go:cgo_import_dynamic libc_setgroups setgroups "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_wait4_trampoline), uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_wait4_trampoline_addr, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options), uintptr(unsafe.Pointer(rusage)), 0, 0) wpid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -54,15 +53,14 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err return } -func libc_wait4_trampoline() +var libc_wait4_trampoline_addr uintptr -//go:linkname libc_wait4 libc_wait4 //go:cgo_import_dynamic libc_wait4 wait4 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_accept_trampoline), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r0, _, e1 := syscall_syscall(libc_accept_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -70,45 +68,42 @@ func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { return } -func libc_accept_trampoline() +var libc_accept_trampoline_addr uintptr -//go:linkname libc_accept libc_accept //go:cgo_import_dynamic libc_accept accept "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_bind_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_bind_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_bind_trampoline() +var libc_bind_trampoline_addr uintptr -//go:linkname libc_bind libc_bind //go:cgo_import_dynamic libc_bind bind "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_connect_trampoline), uintptr(s), uintptr(addr), uintptr(addrlen)) + _, _, e1 := syscall_syscall(libc_connect_trampoline_addr, uintptr(s), uintptr(addr), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_connect_trampoline() +var libc_connect_trampoline_addr uintptr -//go:linkname libc_connect libc_connect //go:cgo_import_dynamic libc_connect connect "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socket(domain int, typ int, proto int) (fd int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_socket_trampoline), uintptr(domain), uintptr(typ), uintptr(proto)) + r0, _, e1 := syscall_rawSyscall(libc_socket_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -116,99 +111,92 @@ func socket(domain int, typ int, proto int) (fd int, err error) { return } -func libc_socket_trampoline() +var libc_socket_trampoline_addr uintptr -//go:linkname libc_socket libc_socket //go:cgo_import_dynamic libc_socket socket "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + _, _, e1 := syscall_syscall6(libc_getsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockopt_trampoline() +var libc_getsockopt_trampoline_addr uintptr -//go:linkname libc_getsockopt libc_getsockopt //go:cgo_import_dynamic libc_getsockopt getsockopt "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setsockopt_trampoline), uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + _, _, e1 := syscall_syscall6(libc_setsockopt_trampoline_addr, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setsockopt_trampoline() +var libc_setsockopt_trampoline_addr uintptr -//go:linkname libc_setsockopt libc_setsockopt //go:cgo_import_dynamic libc_setsockopt setsockopt "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getpeername_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getpeername_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getpeername_trampoline() +var libc_getpeername_trampoline_addr uintptr -//go:linkname libc_getpeername libc_getpeername //go:cgo_import_dynamic libc_getpeername getpeername "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getsockname_trampoline), uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + _, _, e1 := syscall_rawSyscall(libc_getsockname_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getsockname_trampoline() +var libc_getsockname_trampoline_addr uintptr -//go:linkname libc_getsockname libc_getsockname //go:cgo_import_dynamic libc_getsockname getsockname "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Shutdown(s int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_shutdown_trampoline), uintptr(s), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_shutdown_trampoline_addr, uintptr(s), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_shutdown_trampoline() +var libc_shutdown_trampoline_addr uintptr -//go:linkname libc_shutdown libc_shutdown //go:cgo_import_dynamic libc_shutdown shutdown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { - _, _, e1 := syscall_rawSyscall6(funcPC(libc_socketpair_trampoline), uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + _, _, e1 := syscall_rawSyscall6(libc_socketpair_trampoline_addr, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_socketpair_trampoline() +var libc_socketpair_trampoline_addr uintptr -//go:linkname libc_socketpair libc_socketpair //go:cgo_import_dynamic libc_socketpair socketpair "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -220,7 +208,7 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_recvfrom_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall_syscall6(libc_recvfrom_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -228,9 +216,8 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl return } -func libc_recvfrom_trampoline() +var libc_recvfrom_trampoline_addr uintptr -//go:linkname libc_recvfrom libc_recvfrom //go:cgo_import_dynamic libc_recvfrom recvfrom "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -242,22 +229,21 @@ func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) ( } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sendto_trampoline), uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + _, _, e1 := syscall_syscall6(libc_sendto_trampoline_addr, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendto_trampoline() +var libc_sendto_trampoline_addr uintptr -//go:linkname libc_sendto libc_sendto //go:cgo_import_dynamic libc_sendto sendto "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_recvmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_recvmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -265,15 +251,14 @@ func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_recvmsg_trampoline() +var libc_recvmsg_trampoline_addr uintptr -//go:linkname libc_recvmsg libc_recvmsg //go:cgo_import_dynamic libc_recvmsg recvmsg "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_sendmsg_trampoline), uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_sendmsg_trampoline_addr, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -281,15 +266,14 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { return } -func libc_sendmsg_trampoline() +var libc_sendmsg_trampoline_addr uintptr -//go:linkname libc_sendmsg libc_sendmsg //go:cgo_import_dynamic libc_sendmsg sendmsg "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, nevent int, timeout *Timespec) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_kevent_trampoline), uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) + r0, _, e1 := syscall_syscall6(libc_kevent_trampoline_addr, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -297,9 +281,8 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne return } -func libc_kevent_trampoline() +var libc_kevent_trampoline_addr uintptr -//go:linkname libc_kevent libc_kevent //go:cgo_import_dynamic libc_kevent kevent "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -310,37 +293,35 @@ func utimes(path string, timeval *[2]Timeval) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_utimes_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_utimes_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_utimes_trampoline() +var libc_utimes_trampoline_addr uintptr -//go:linkname libc_utimes libc_utimes //go:cgo_import_dynamic libc_utimes utimes "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimes(fd int, timeval *[2]Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_futimes_trampoline), uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) + _, _, e1 := syscall_syscall(libc_futimes_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(timeval)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_futimes_trampoline() +var libc_futimes_trampoline_addr uintptr -//go:linkname libc_futimes libc_futimes //go:cgo_import_dynamic libc_futimes futimes "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_poll_trampoline), uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) + r0, _, e1 := syscall_syscall(libc_poll_trampoline_addr, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -348,9 +329,8 @@ func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { return } -func libc_poll_trampoline() +var libc_poll_trampoline_addr uintptr -//go:linkname libc_poll libc_poll //go:cgo_import_dynamic libc_poll poll "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -362,16 +342,15 @@ func Madvise(b []byte, behav int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_madvise_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(behav)) + _, _, e1 := syscall_syscall(libc_madvise_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(behav)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_madvise_trampoline() +var libc_madvise_trampoline_addr uintptr -//go:linkname libc_madvise libc_madvise //go:cgo_import_dynamic libc_madvise madvise "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -383,31 +362,29 @@ func Mlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_mlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlock_trampoline() +var libc_mlock_trampoline_addr uintptr -//go:linkname libc_mlock libc_mlock //go:cgo_import_dynamic libc_mlock mlock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Mlockall(flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_mlockall_trampoline), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall(libc_mlockall_trampoline_addr, uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mlockall_trampoline() +var libc_mlockall_trampoline_addr uintptr -//go:linkname libc_mlockall libc_mlockall //go:cgo_import_dynamic libc_mlockall mlockall "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -419,16 +396,15 @@ func Mprotect(b []byte, prot int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_mprotect_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(prot)) + _, _, e1 := syscall_syscall(libc_mprotect_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(prot)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mprotect_trampoline() +var libc_mprotect_trampoline_addr uintptr -//go:linkname libc_mprotect libc_mprotect //go:cgo_import_dynamic libc_mprotect mprotect "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -440,16 +416,15 @@ func Msync(b []byte, flags int) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_msync_trampoline), uintptr(_p0), uintptr(len(b)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_msync_trampoline_addr, uintptr(_p0), uintptr(len(b)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_msync_trampoline() +var libc_msync_trampoline_addr uintptr -//go:linkname libc_msync libc_msync //go:cgo_import_dynamic libc_msync msync "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -461,63 +436,43 @@ func Munlock(b []byte) (err error) { } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall(funcPC(libc_munlock_trampoline), uintptr(_p0), uintptr(len(b)), 0) + _, _, e1 := syscall_syscall(libc_munlock_trampoline_addr, uintptr(_p0), uintptr(len(b)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlock_trampoline() +var libc_munlock_trampoline_addr uintptr -//go:linkname libc_munlock libc_munlock //go:cgo_import_dynamic libc_munlock munlock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Munlockall() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munlockall_trampoline), 0, 0, 0) + _, _, e1 := syscall_syscall(libc_munlockall_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munlockall_trampoline() +var libc_munlockall_trampoline_addr uintptr -//go:linkname libc_munlockall libc_munlockall //go:cgo_import_dynamic libc_munlockall munlockall "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_getattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) +func pipe(p *[2]int32) (err error) { + _, _, e1 := syscall_rawSyscall(libc_pipe_trampoline_addr, uintptr(unsafe.Pointer(p)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getattrlist_trampoline() +var libc_pipe_trampoline_addr uintptr -//go:linkname libc_getattrlist libc_getattrlist -//go:cgo_import_dynamic libc_getattrlist getattrlist "/usr/lib/libSystem.B.dylib" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe() (r int, w int, err error) { - r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -func libc_pipe_trampoline() - -//go:linkname libc_pipe libc_pipe //go:cgo_import_dynamic libc_pipe pipe "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -533,7 +488,7 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_getxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := syscall_syscall6(libc_getxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -541,9 +496,8 @@ func getxattr(path string, attr string, dest *byte, size int, position uint32, o return } -func libc_getxattr_trampoline() +var libc_getxattr_trampoline_addr uintptr -//go:linkname libc_getxattr libc_getxattr //go:cgo_import_dynamic libc_getxattr getxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -554,7 +508,7 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_fgetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) + r0, _, e1 := syscall_syscall6(libc_fgetxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -562,9 +516,8 @@ func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, optio return } -func libc_fgetxattr_trampoline() +var libc_fgetxattr_trampoline_addr uintptr -//go:linkname libc_fgetxattr libc_fgetxattr //go:cgo_import_dynamic libc_fgetxattr fgetxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -580,16 +533,15 @@ func setxattr(path string, attr string, data *byte, size int, position uint32, o if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_setxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := syscall_syscall6(libc_setxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setxattr_trampoline() +var libc_setxattr_trampoline_addr uintptr -//go:linkname libc_setxattr libc_setxattr //go:cgo_import_dynamic libc_setxattr setxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -600,16 +552,15 @@ func fsetxattr(fd int, attr string, data *byte, size int, position uint32, optio if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fsetxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) + _, _, e1 := syscall_syscall6(libc_fsetxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsetxattr_trampoline() +var libc_fsetxattr_trampoline_addr uintptr -//go:linkname libc_fsetxattr libc_fsetxattr //go:cgo_import_dynamic libc_fsetxattr fsetxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -625,16 +576,15 @@ func removexattr(path string, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_removexattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_removexattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_removexattr_trampoline() +var libc_removexattr_trampoline_addr uintptr -//go:linkname libc_removexattr libc_removexattr //go:cgo_import_dynamic libc_removexattr removexattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -645,16 +595,15 @@ func fremovexattr(fd int, attr string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_fremovexattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_fremovexattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fremovexattr_trampoline() +var libc_fremovexattr_trampoline_addr uintptr -//go:linkname libc_fremovexattr libc_fremovexattr //go:cgo_import_dynamic libc_fremovexattr fremovexattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -665,7 +614,7 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_listxattr_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := syscall_syscall6(libc_listxattr_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -673,15 +622,14 @@ func listxattr(path string, dest *byte, size int, options int) (sz int, err erro return } -func libc_listxattr_trampoline() +var libc_listxattr_trampoline_addr uintptr -//go:linkname libc_listxattr libc_listxattr //go:cgo_import_dynamic libc_listxattr listxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_flistxattr_trampoline), uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) + r0, _, e1 := syscall_syscall6(libc_flistxattr_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) sz = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -689,30 +637,28 @@ func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { return } -func libc_flistxattr_trampoline() +var libc_flistxattr_trampoline_addr uintptr -//go:linkname libc_flistxattr libc_flistxattr //go:cgo_import_dynamic libc_flistxattr flistxattr "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_setattrlist_trampoline), uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) + _, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setattrlist_trampoline() +var libc_setattrlist_trampoline_addr uintptr -//go:linkname libc_setattrlist libc_setattrlist //go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fcntl_trampoline), uintptr(fd), uintptr(cmd), uintptr(arg)) + r0, _, e1 := syscall_syscall(libc_fcntl_trampoline_addr, uintptr(fd), uintptr(cmd), uintptr(arg)) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -720,39 +666,36 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { return } -func libc_fcntl_trampoline() +var libc_fcntl_trampoline_addr uintptr -//go:linkname libc_fcntl libc_fcntl //go:cgo_import_dynamic libc_fcntl fcntl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_kill_trampoline), uintptr(pid), uintptr(signum), uintptr(posix)) + _, _, e1 := syscall_syscall(libc_kill_trampoline_addr, uintptr(pid), uintptr(signum), uintptr(posix)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_kill_trampoline() +var libc_kill_trampoline_addr uintptr -//go:linkname libc_kill libc_kill //go:cgo_import_dynamic libc_kill kill "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ioctl_trampoline), uintptr(fd), uintptr(req), uintptr(arg)) + _, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ioctl_trampoline() +var libc_ioctl_trampoline_addr uintptr -//go:linkname libc_ioctl libc_ioctl //go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -764,66 +707,121 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := syscall_syscall6(funcPC(libc_sysctl_trampoline), uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sysctl_trampoline() +var libc_sysctl_trampoline_addr uintptr -//go:linkname libc_sysctl libc_sysctl //go:cgo_import_dynamic libc_sysctl sysctl "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := syscall_syscall6(funcPC(libc_sendfile_trampoline), uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) + _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sendfile_trampoline() +var libc_sendfile_trampoline_addr uintptr -//go:linkname libc_sendfile libc_sendfile //go:cgo_import_dynamic libc_sendfile sendfile "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmdt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmget_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_access_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_access_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_access_trampoline() +var libc_access_trampoline_addr uintptr -//go:linkname libc_access libc_access //go:cgo_import_dynamic libc_access access "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Adjtime(delta *Timeval, olddelta *Timeval) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_adjtime_trampoline), uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) + _, _, e1 := syscall_syscall(libc_adjtime_trampoline_addr, uintptr(unsafe.Pointer(delta)), uintptr(unsafe.Pointer(olddelta)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_adjtime_trampoline() +var libc_adjtime_trampoline_addr uintptr -//go:linkname libc_adjtime libc_adjtime //go:cgo_import_dynamic libc_adjtime adjtime "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -834,16 +832,15 @@ func Chdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chdir_trampoline() +var libc_chdir_trampoline_addr uintptr -//go:linkname libc_chdir libc_chdir //go:cgo_import_dynamic libc_chdir chdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -854,16 +851,15 @@ func Chflags(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chflags_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_chflags_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chflags_trampoline() +var libc_chflags_trampoline_addr uintptr -//go:linkname libc_chflags libc_chflags //go:cgo_import_dynamic libc_chflags chflags "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -874,16 +870,15 @@ func Chmod(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chmod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_chmod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chmod_trampoline() +var libc_chmod_trampoline_addr uintptr -//go:linkname libc_chmod libc_chmod //go:cgo_import_dynamic libc_chmod chmod "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -894,16 +889,15 @@ func Chown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_chown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chown_trampoline() +var libc_chown_trampoline_addr uintptr -//go:linkname libc_chown libc_chown //go:cgo_import_dynamic libc_chown chown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -914,52 +908,97 @@ func Chroot(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_chroot_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_chroot_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_chroot_trampoline() +var libc_chroot_trampoline_addr uintptr -//go:linkname libc_chroot libc_chroot //go:cgo_import_dynamic libc_chroot chroot "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func ClockGettime(clockid int32, time *Timespec) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_clock_gettime_trampoline), uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) + _, _, e1 := syscall_syscall(libc_clock_gettime_trampoline_addr, uintptr(clockid), uintptr(unsafe.Pointer(time)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_clock_gettime_trampoline() +var libc_clock_gettime_trampoline_addr uintptr -//go:linkname libc_clock_gettime libc_clock_gettime //go:cgo_import_dynamic libc_clock_gettime clock_gettime "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Close(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_close_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_close_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_close_trampoline() +var libc_close_trampoline_addr uintptr -//go:linkname libc_close libc_close //go:cgo_import_dynamic libc_close close "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Clonefile(src string, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_clonefile_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_clonefile_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clonefile clonefile "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(src) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_clonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_clonefileat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_clonefileat clonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Dup(fd int) (nfd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_dup_trampoline), uintptr(fd), 0, 0) + r0, _, e1 := syscall_syscall(libc_dup_trampoline_addr, uintptr(fd), 0, 0) nfd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -967,24 +1006,22 @@ func Dup(fd int) (nfd int, err error) { return } -func libc_dup_trampoline() +var libc_dup_trampoline_addr uintptr -//go:linkname libc_dup libc_dup //go:cgo_import_dynamic libc_dup dup "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Dup2(from int, to int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_dup2_trampoline), uintptr(from), uintptr(to), 0) + _, _, e1 := syscall_syscall(libc_dup2_trampoline_addr, uintptr(from), uintptr(to), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_dup2_trampoline() +var libc_dup2_trampoline_addr uintptr -//go:linkname libc_dup2 libc_dup2 //go:cgo_import_dynamic libc_dup2 dup2 "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1000,28 +1037,26 @@ func Exchangedata(path1 string, path2 string, options int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_exchangedata_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) + _, _, e1 := syscall_syscall(libc_exchangedata_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_exchangedata_trampoline() +var libc_exchangedata_trampoline_addr uintptr -//go:linkname libc_exchangedata libc_exchangedata //go:cgo_import_dynamic libc_exchangedata exchangedata "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Exit(code int) { - syscall_syscall(funcPC(libc_exit_trampoline), uintptr(code), 0, 0) + syscall_syscall(libc_exit_trampoline_addr, uintptr(code), 0, 0) return } -func libc_exit_trampoline() +var libc_exit_trampoline_addr uintptr -//go:linkname libc_exit libc_exit //go:cgo_import_dynamic libc_exit exit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1032,61 +1067,57 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_faccessat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_faccessat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_faccessat_trampoline() +var libc_faccessat_trampoline_addr uintptr -//go:linkname libc_faccessat libc_faccessat //go:cgo_import_dynamic libc_faccessat faccessat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchdir(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchdir_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fchdir_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchdir_trampoline() +var libc_fchdir_trampoline_addr uintptr -//go:linkname libc_fchdir libc_fchdir //go:cgo_import_dynamic libc_fchdir fchdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchflags(fd int, flags int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchflags_trampoline), uintptr(fd), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_fchflags_trampoline_addr, uintptr(fd), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchflags_trampoline() +var libc_fchflags_trampoline_addr uintptr -//go:linkname libc_fchflags libc_fchflags //go:cgo_import_dynamic libc_fchflags fchflags "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchmod(fd int, mode uint32) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchmod_trampoline), uintptr(fd), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_fchmod_trampoline_addr, uintptr(fd), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmod_trampoline() +var libc_fchmod_trampoline_addr uintptr -//go:linkname libc_fchmod libc_fchmod //go:cgo_import_dynamic libc_fchmod fchmod "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1097,31 +1128,29 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchmodat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fchmodat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchmodat_trampoline() +var libc_fchmodat_trampoline_addr uintptr -//go:linkname libc_fchmodat libc_fchmodat //go:cgo_import_dynamic libc_fchmodat fchmodat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fchown_trampoline), uintptr(fd), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_fchown_trampoline_addr, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchown_trampoline() +var libc_fchown_trampoline_addr uintptr -//go:linkname libc_fchown libc_fchown //go:cgo_import_dynamic libc_fchown fchown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1132,37 +1161,54 @@ func Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fchownat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_fchownat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fchownat_trampoline() +var libc_fchownat_trampoline_addr uintptr -//go:linkname libc_fchownat libc_fchownat //go:cgo_import_dynamic libc_fchownat fchownat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(dst) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(libc_fclonefileat_trampoline_addr, uintptr(srcDirfd), uintptr(dstDirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_fclonefileat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_fclonefileat fclonefileat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Flock(fd int, how int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_flock_trampoline), uintptr(fd), uintptr(how), 0) + _, _, e1 := syscall_syscall(libc_flock_trampoline_addr, uintptr(fd), uintptr(how), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_flock_trampoline() +var libc_flock_trampoline_addr uintptr -//go:linkname libc_flock libc_flock //go:cgo_import_dynamic libc_flock flock "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fpathconf(fd int, name int) (val int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_fpathconf_trampoline), uintptr(fd), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_fpathconf_trampoline_addr, uintptr(fd), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1170,97 +1216,111 @@ func Fpathconf(fd int, name int) (val int, err error) { return } -func libc_fpathconf_trampoline() +var libc_fpathconf_trampoline_addr uintptr -//go:linkname libc_fpathconf libc_fpathconf //go:cgo_import_dynamic libc_fpathconf fpathconf "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fsync(fd int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fsync_trampoline), uintptr(fd), 0, 0) + _, _, e1 := syscall_syscall(libc_fsync_trampoline_addr, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fsync_trampoline() +var libc_fsync_trampoline_addr uintptr -//go:linkname libc_fsync libc_fsync //go:cgo_import_dynamic libc_fsync fsync "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_ftruncate_trampoline), uintptr(fd), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_ftruncate_trampoline_addr, uintptr(fd), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_ftruncate_trampoline() +var libc_ftruncate_trampoline_addr uintptr -//go:linkname libc_ftruncate libc_ftruncate //go:cgo_import_dynamic libc_ftruncate ftruncate "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(libc_getcwd_trampoline_addr, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_getcwd_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_getcwd getcwd "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdtablesize() (size int) { - r0, _, _ := syscall_syscall(funcPC(libc_getdtablesize_trampoline), 0, 0, 0) + r0, _, _ := syscall_syscall(libc_getdtablesize_trampoline_addr, 0, 0, 0) size = int(r0) return } -func libc_getdtablesize_trampoline() +var libc_getdtablesize_trampoline_addr uintptr -//go:linkname libc_getdtablesize libc_getdtablesize //go:cgo_import_dynamic libc_getdtablesize getdtablesize "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getegid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getegid_trampoline_addr, 0, 0, 0) egid = int(r0) return } -func libc_getegid_trampoline() +var libc_getegid_trampoline_addr uintptr -//go:linkname libc_getegid libc_getegid //go:cgo_import_dynamic libc_getegid getegid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_geteuid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_geteuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } -func libc_geteuid_trampoline() +var libc_geteuid_trampoline_addr uintptr -//go:linkname libc_geteuid libc_geteuid //go:cgo_import_dynamic libc_geteuid geteuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getgid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getgid_trampoline_addr, 0, 0, 0) gid = int(r0) return } -func libc_getgid_trampoline() +var libc_getgid_trampoline_addr uintptr -//go:linkname libc_getgid libc_getgid //go:cgo_import_dynamic libc_getgid getgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgid(pid int) (pgid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getpgid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getpgid_trampoline_addr, uintptr(pid), 0, 0) pgid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1268,54 +1328,50 @@ func Getpgid(pid int) (pgid int, err error) { return } -func libc_getpgid_trampoline() +var libc_getpgid_trampoline_addr uintptr -//go:linkname libc_getpgid libc_getpgid //go:cgo_import_dynamic libc_getpgid getpgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpgrp() (pgrp int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpgrp_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpgrp_trampoline_addr, 0, 0, 0) pgrp = int(r0) return } -func libc_getpgrp_trampoline() +var libc_getpgrp_trampoline_addr uintptr -//go:linkname libc_getpgrp libc_getpgrp //go:cgo_import_dynamic libc_getpgrp getpgrp "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpid() (pid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getpid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getpid_trampoline_addr, 0, 0, 0) pid = int(r0) return } -func libc_getpid_trampoline() +var libc_getpid_trampoline_addr uintptr -//go:linkname libc_getpid libc_getpid //go:cgo_import_dynamic libc_getpid getpid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getppid() (ppid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getppid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getppid_trampoline_addr, 0, 0, 0) ppid = int(r0) return } -func libc_getppid_trampoline() +var libc_getppid_trampoline_addr uintptr -//go:linkname libc_getppid libc_getppid //go:cgo_import_dynamic libc_getppid getppid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getpriority(which int, who int) (prio int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getpriority_trampoline), uintptr(which), uintptr(who), 0) + r0, _, e1 := syscall_syscall(libc_getpriority_trampoline_addr, uintptr(which), uintptr(who), 0) prio = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1323,45 +1379,42 @@ func Getpriority(which int, who int) (prio int, err error) { return } -func libc_getpriority_trampoline() +var libc_getpriority_trampoline_addr uintptr -//go:linkname libc_getpriority libc_getpriority //go:cgo_import_dynamic libc_getpriority getpriority "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrlimit_trampoline() +var libc_getrlimit_trampoline_addr uintptr -//go:linkname libc_getrlimit libc_getrlimit //go:cgo_import_dynamic libc_getrlimit getrlimit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getrusage(who int, rusage *Rusage) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_getrusage_trampoline), uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + _, _, e1 := syscall_rawSyscall(libc_getrusage_trampoline_addr, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_getrusage_trampoline() +var libc_getrusage_trampoline_addr uintptr -//go:linkname libc_getrusage libc_getrusage //go:cgo_import_dynamic libc_getrusage getrusage "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getsid(pid int) (sid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_getsid_trampoline), uintptr(pid), 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_getsid_trampoline_addr, uintptr(pid), 0, 0) sid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1369,56 +1422,52 @@ func Getsid(pid int) (sid int, err error) { return } -func libc_getsid_trampoline() +var libc_getsid_trampoline_addr uintptr -//go:linkname libc_getsid libc_getsid //go:cgo_import_dynamic libc_getsid getsid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_gettimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_gettimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_gettimeofday_trampoline() +var libc_gettimeofday_trampoline_addr uintptr -//go:linkname libc_gettimeofday libc_gettimeofday //go:cgo_import_dynamic libc_gettimeofday gettimeofday "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_getuid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_getuid_trampoline_addr, 0, 0, 0) uid = int(r0) return } -func libc_getuid_trampoline() +var libc_getuid_trampoline_addr uintptr -//go:linkname libc_getuid libc_getuid //go:cgo_import_dynamic libc_getuid getuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := syscall_rawSyscall(funcPC(libc_issetugid_trampoline), 0, 0, 0) + r0, _, _ := syscall_rawSyscall(libc_issetugid_trampoline_addr, 0, 0, 0) tainted = bool(r0 != 0) return } -func libc_issetugid_trampoline() +var libc_issetugid_trampoline_addr uintptr -//go:linkname libc_issetugid libc_issetugid //go:cgo_import_dynamic libc_issetugid issetugid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Kqueue() (fd int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_kqueue_trampoline), 0, 0, 0) + r0, _, e1 := syscall_syscall(libc_kqueue_trampoline_addr, 0, 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1426,9 +1475,8 @@ func Kqueue() (fd int, err error) { return } -func libc_kqueue_trampoline() +var libc_kqueue_trampoline_addr uintptr -//go:linkname libc_kqueue libc_kqueue //go:cgo_import_dynamic libc_kqueue kqueue "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1439,16 +1487,15 @@ func Lchown(path string, uid int, gid int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lchown_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + _, _, e1 := syscall_syscall(libc_lchown_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lchown_trampoline() +var libc_lchown_trampoline_addr uintptr -//go:linkname libc_lchown libc_lchown //go:cgo_import_dynamic libc_lchown lchown "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1464,16 +1511,15 @@ func Link(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_link_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_link_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_link_trampoline() +var libc_link_trampoline_addr uintptr -//go:linkname libc_link libc_link //go:cgo_import_dynamic libc_link link "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1489,31 +1535,29 @@ func Linkat(pathfd int, path string, linkfd int, link string, flags int) (err er if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_linkat_trampoline), uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) + _, _, e1 := syscall_syscall6(libc_linkat_trampoline_addr, uintptr(pathfd), uintptr(unsafe.Pointer(_p0)), uintptr(linkfd), uintptr(unsafe.Pointer(_p1)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_linkat_trampoline() +var libc_linkat_trampoline_addr uintptr -//go:linkname libc_linkat libc_linkat //go:cgo_import_dynamic libc_linkat linkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_listen_trampoline), uintptr(s), uintptr(backlog), 0) + _, _, e1 := syscall_syscall(libc_listen_trampoline_addr, uintptr(s), uintptr(backlog), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_listen_trampoline() +var libc_listen_trampoline_addr uintptr -//go:linkname libc_listen libc_listen //go:cgo_import_dynamic libc_listen listen "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1524,16 +1568,15 @@ func Mkdir(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdir_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdir_trampoline() +var libc_mkdir_trampoline_addr uintptr -//go:linkname libc_mkdir libc_mkdir //go:cgo_import_dynamic libc_mkdir mkdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1544,16 +1587,15 @@ func Mkdirat(dirfd int, path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkdirat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + _, _, e1 := syscall_syscall(libc_mkdirat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkdirat_trampoline() +var libc_mkdirat_trampoline_addr uintptr -//go:linkname libc_mkdirat libc_mkdirat //go:cgo_import_dynamic libc_mkdirat mkdirat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1564,16 +1606,15 @@ func Mkfifo(path string, mode uint32) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mkfifo_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + _, _, e1 := syscall_syscall(libc_mkfifo_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mkfifo_trampoline() +var libc_mkfifo_trampoline_addr uintptr -//go:linkname libc_mkfifo libc_mkfifo //go:cgo_import_dynamic libc_mkfifo mkfifo "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1584,16 +1625,15 @@ func Mknod(path string, mode uint32, dev int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_mknod_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + _, _, e1 := syscall_syscall(libc_mknod_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_mknod_trampoline() +var libc_mknod_trampoline_addr uintptr -//go:linkname libc_mknod libc_mknod //go:cgo_import_dynamic libc_mknod mknod "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1604,7 +1644,7 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_open_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + r0, _, e1 := syscall_syscall(libc_open_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1612,9 +1652,8 @@ func Open(path string, mode int, perm uint32) (fd int, err error) { return } -func libc_open_trampoline() +var libc_open_trampoline_addr uintptr -//go:linkname libc_open libc_open //go:cgo_import_dynamic libc_open open "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1625,7 +1664,7 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall6(funcPC(libc_openat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) + r0, _, e1 := syscall_syscall6(libc_openat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm), 0, 0) fd = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1633,9 +1672,8 @@ func Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error) { return } -func libc_openat_trampoline() +var libc_openat_trampoline_addr uintptr -//go:linkname libc_openat libc_openat //go:cgo_import_dynamic libc_openat openat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1646,7 +1684,7 @@ func Pathconf(path string, name int) (val int, err error) { if err != nil { return } - r0, _, e1 := syscall_syscall(funcPC(libc_pathconf_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) + r0, _, e1 := syscall_syscall(libc_pathconf_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(name), 0) val = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1654,9 +1692,8 @@ func Pathconf(path string, name int) (val int, err error) { return } -func libc_pathconf_trampoline() +var libc_pathconf_trampoline_addr uintptr -//go:linkname libc_pathconf libc_pathconf //go:cgo_import_dynamic libc_pathconf pathconf "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1668,7 +1705,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pread_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := syscall_syscall6(libc_pread_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1676,9 +1713,8 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pread_trampoline() +var libc_pread_trampoline_addr uintptr -//go:linkname libc_pread libc_pread //go:cgo_import_dynamic libc_pread pread "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1690,7 +1726,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_pwrite_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := syscall_syscall6(libc_pwrite_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1698,9 +1734,8 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { return } -func libc_pwrite_trampoline() +var libc_pwrite_trampoline_addr uintptr -//go:linkname libc_pwrite libc_pwrite //go:cgo_import_dynamic libc_pwrite pwrite "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1712,7 +1747,7 @@ func read(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1720,9 +1755,8 @@ func read(fd int, p []byte) (n int, err error) { return } -func libc_read_trampoline() +var libc_read_trampoline_addr uintptr -//go:linkname libc_read libc_read //go:cgo_import_dynamic libc_read read "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1739,7 +1773,7 @@ func Readlink(path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_readlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + r0, _, e1 := syscall_syscall(libc_readlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1747,9 +1781,8 @@ func Readlink(path string, buf []byte) (n int, err error) { return } -func libc_readlink_trampoline() +var libc_readlink_trampoline_addr uintptr -//go:linkname libc_readlink libc_readlink //go:cgo_import_dynamic libc_readlink readlink "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1766,7 +1799,7 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { } else { _p1 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall6(funcPC(libc_readlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) + r0, _, e1 := syscall_syscall6(libc_readlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf)), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1774,9 +1807,8 @@ func Readlinkat(dirfd int, path string, buf []byte) (n int, err error) { return } -func libc_readlinkat_trampoline() +var libc_readlinkat_trampoline_addr uintptr -//go:linkname libc_readlinkat libc_readlinkat //go:cgo_import_dynamic libc_readlinkat readlinkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1792,16 +1824,15 @@ func Rename(from string, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rename_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_rename_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rename_trampoline() +var libc_rename_trampoline_addr uintptr -//go:linkname libc_rename libc_rename //go:cgo_import_dynamic libc_rename rename "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1817,16 +1848,15 @@ func Renameat(fromfd int, from string, tofd int, to string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_renameat_trampoline), uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) + _, _, e1 := syscall_syscall6(libc_renameat_trampoline_addr, uintptr(fromfd), uintptr(unsafe.Pointer(_p0)), uintptr(tofd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_renameat_trampoline() +var libc_renameat_trampoline_addr uintptr -//go:linkname libc_renameat libc_renameat //go:cgo_import_dynamic libc_renameat renameat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1837,16 +1867,15 @@ func Revoke(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_revoke_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_revoke_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_revoke_trampoline() +var libc_revoke_trampoline_addr uintptr -//go:linkname libc_revoke libc_revoke //go:cgo_import_dynamic libc_revoke revoke "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1857,22 +1886,21 @@ func Rmdir(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_rmdir_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_rmdir_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_rmdir_trampoline() +var libc_rmdir_trampoline_addr uintptr -//go:linkname libc_rmdir libc_rmdir //go:cgo_import_dynamic libc_rmdir rmdir "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_lseek_trampoline), uintptr(fd), uintptr(offset), uintptr(whence)) + r0, _, e1 := syscall_syscall(libc_lseek_trampoline_addr, uintptr(fd), uintptr(offset), uintptr(whence)) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1880,15 +1908,14 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { return } -func libc_lseek_trampoline() +var libc_lseek_trampoline_addr uintptr -//go:linkname libc_lseek libc_lseek //go:cgo_import_dynamic libc_lseek lseek "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_select_trampoline), uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + r0, _, e1 := syscall_syscall6(libc_select_trampoline_addr, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1896,54 +1923,50 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err return } -func libc_select_trampoline() +var libc_select_trampoline_addr uintptr -//go:linkname libc_select libc_select //go:cgo_import_dynamic libc_select select "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setegid_trampoline), uintptr(egid), 0, 0) + _, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setegid_trampoline() +var libc_setegid_trampoline_addr uintptr -//go:linkname libc_setegid libc_setegid //go:cgo_import_dynamic libc_setegid setegid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seteuid(euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_seteuid_trampoline), uintptr(euid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_seteuid_trampoline_addr, uintptr(euid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_seteuid_trampoline() +var libc_seteuid_trampoline_addr uintptr -//go:linkname libc_seteuid libc_seteuid //go:cgo_import_dynamic libc_seteuid seteuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setgid(gid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setgid_trampoline), uintptr(gid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setgid_trampoline_addr, uintptr(gid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setgid_trampoline() +var libc_setgid_trampoline_addr uintptr -//go:linkname libc_setgid libc_setgid //go:cgo_import_dynamic libc_setgid setgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -1954,112 +1977,105 @@ func Setlogin(name string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_setlogin_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_setlogin_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setlogin_trampoline() +var libc_setlogin_trampoline_addr uintptr -//go:linkname libc_setlogin libc_setlogin //go:cgo_import_dynamic libc_setlogin setlogin "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpgid(pid int, pgid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setpgid_trampoline), uintptr(pid), uintptr(pgid), 0) + _, _, e1 := syscall_rawSyscall(libc_setpgid_trampoline_addr, uintptr(pid), uintptr(pgid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpgid_trampoline() +var libc_setpgid_trampoline_addr uintptr -//go:linkname libc_setpgid libc_setpgid //go:cgo_import_dynamic libc_setpgid setpgid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setpriority(which int, who int, prio int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setpriority_trampoline), uintptr(which), uintptr(who), uintptr(prio)) + _, _, e1 := syscall_syscall(libc_setpriority_trampoline_addr, uintptr(which), uintptr(who), uintptr(prio)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setpriority_trampoline() +var libc_setpriority_trampoline_addr uintptr -//go:linkname libc_setpriority libc_setpriority //go:cgo_import_dynamic libc_setpriority setpriority "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setprivexec(flag int) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_setprivexec_trampoline), uintptr(flag), 0, 0) + _, _, e1 := syscall_syscall(libc_setprivexec_trampoline_addr, uintptr(flag), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setprivexec_trampoline() +var libc_setprivexec_trampoline_addr uintptr -//go:linkname libc_setprivexec libc_setprivexec //go:cgo_import_dynamic libc_setprivexec setprivexec "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setregid(rgid int, egid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setregid_trampoline), uintptr(rgid), uintptr(egid), 0) + _, _, e1 := syscall_rawSyscall(libc_setregid_trampoline_addr, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setregid_trampoline() +var libc_setregid_trampoline_addr uintptr -//go:linkname libc_setregid libc_setregid //go:cgo_import_dynamic libc_setregid setregid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setreuid_trampoline), uintptr(ruid), uintptr(euid), 0) + _, _, e1 := syscall_rawSyscall(libc_setreuid_trampoline_addr, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setreuid_trampoline() +var libc_setreuid_trampoline_addr uintptr -//go:linkname libc_setreuid libc_setreuid //go:cgo_import_dynamic libc_setreuid setreuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setrlimit(which int, lim *Rlimit) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setrlimit_trampoline), uintptr(which), uintptr(unsafe.Pointer(lim)), 0) + _, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setrlimit_trampoline() +var libc_setrlimit_trampoline_addr uintptr -//go:linkname libc_setrlimit libc_setrlimit //go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setsid() (pid int, err error) { - r0, _, e1 := syscall_rawSyscall(funcPC(libc_setsid_trampoline), 0, 0, 0) + r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0) pid = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2067,39 +2083,36 @@ func Setsid() (pid int, err error) { return } -func libc_setsid_trampoline() +var libc_setsid_trampoline_addr uintptr -//go:linkname libc_setsid libc_setsid //go:cgo_import_dynamic libc_setsid setsid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Settimeofday(tp *Timeval) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_settimeofday_trampoline), uintptr(unsafe.Pointer(tp)), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_settimeofday_trampoline_addr, uintptr(unsafe.Pointer(tp)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_settimeofday_trampoline() +var libc_settimeofday_trampoline_addr uintptr -//go:linkname libc_settimeofday libc_settimeofday //go:cgo_import_dynamic libc_settimeofday settimeofday "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setuid(uid int) (err error) { - _, _, e1 := syscall_rawSyscall(funcPC(libc_setuid_trampoline), uintptr(uid), 0, 0) + _, _, e1 := syscall_rawSyscall(libc_setuid_trampoline_addr, uintptr(uid), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_setuid_trampoline() +var libc_setuid_trampoline_addr uintptr -//go:linkname libc_setuid libc_setuid //go:cgo_import_dynamic libc_setuid setuid "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2115,16 +2128,15 @@ func Symlink(path string, link string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlink_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + _, _, e1 := syscall_syscall(libc_symlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlink_trampoline() +var libc_symlink_trampoline_addr uintptr -//go:linkname libc_symlink libc_symlink //go:cgo_import_dynamic libc_symlink symlink "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2140,31 +2152,29 @@ func Symlinkat(oldpath string, newdirfd int, newpath string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_symlinkat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) + _, _, e1 := syscall_syscall(libc_symlinkat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1))) if e1 != 0 { err = errnoErr(e1) } return } -func libc_symlinkat_trampoline() +var libc_symlinkat_trampoline_addr uintptr -//go:linkname libc_symlinkat libc_symlinkat //go:cgo_import_dynamic libc_symlinkat symlinkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Sync() (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_sync_trampoline), 0, 0, 0) + _, _, e1 := syscall_syscall(libc_sync_trampoline_addr, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_sync_trampoline() +var libc_sync_trampoline_addr uintptr -//go:linkname libc_sync libc_sync //go:cgo_import_dynamic libc_sync sync "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2175,29 +2185,27 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_truncate_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_truncate_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_truncate_trampoline() +var libc_truncate_trampoline_addr uintptr -//go:linkname libc_truncate libc_truncate //go:cgo_import_dynamic libc_truncate truncate "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Umask(newmask int) (oldmask int) { - r0, _, _ := syscall_syscall(funcPC(libc_umask_trampoline), uintptr(newmask), 0, 0) + r0, _, _ := syscall_syscall(libc_umask_trampoline_addr, uintptr(newmask), 0, 0) oldmask = int(r0) return } -func libc_umask_trampoline() +var libc_umask_trampoline_addr uintptr -//go:linkname libc_umask libc_umask //go:cgo_import_dynamic libc_umask umask "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2208,16 +2216,15 @@ func Undelete(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_undelete_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_undelete_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_undelete_trampoline() +var libc_undelete_trampoline_addr uintptr -//go:linkname libc_undelete libc_undelete //go:cgo_import_dynamic libc_undelete undelete "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2228,16 +2235,15 @@ func Unlink(path string) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlink_trampoline), uintptr(unsafe.Pointer(_p0)), 0, 0) + _, _, e1 := syscall_syscall(libc_unlink_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlink_trampoline() +var libc_unlink_trampoline_addr uintptr -//go:linkname libc_unlink libc_unlink //go:cgo_import_dynamic libc_unlink unlink "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2248,16 +2254,15 @@ func Unlinkat(dirfd int, path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unlinkat_trampoline), uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) + _, _, e1 := syscall_syscall(libc_unlinkat_trampoline_addr, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unlinkat_trampoline() +var libc_unlinkat_trampoline_addr uintptr -//go:linkname libc_unlinkat libc_unlinkat //go:cgo_import_dynamic libc_unlinkat unlinkat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2268,16 +2273,15 @@ func Unmount(path string, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_unmount_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + _, _, e1 := syscall_syscall(libc_unmount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_unmount_trampoline() +var libc_unmount_trampoline_addr uintptr -//go:linkname libc_unmount libc_unmount //go:cgo_import_dynamic libc_unmount unmount "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2289,7 +2293,7 @@ func write(fd int, p []byte) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(_p0), uintptr(len(p))) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(_p0), uintptr(len(p))) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2297,15 +2301,14 @@ func write(fd int, p []byte) (n int, err error) { return } -func libc_write_trampoline() +var libc_write_trampoline_addr uintptr -//go:linkname libc_write libc_write //go:cgo_import_dynamic libc_write write "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall_syscall6(funcPC(libc_mmap_trampoline), uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := syscall_syscall6(libc_mmap_trampoline_addr, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -2313,30 +2316,28 @@ func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) ( return } -func libc_mmap_trampoline() +var libc_mmap_trampoline_addr uintptr -//go:linkname libc_mmap libc_mmap //go:cgo_import_dynamic libc_mmap mmap "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func munmap(addr uintptr, length uintptr) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_munmap_trampoline), uintptr(addr), uintptr(length), 0) + _, _, e1 := syscall_syscall(libc_munmap_trampoline_addr, uintptr(addr), uintptr(length), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_munmap_trampoline() +var libc_munmap_trampoline_addr uintptr -//go:linkname libc_munmap libc_munmap //go:cgo_import_dynamic libc_munmap munmap "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func readlen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_read_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_read_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2347,7 +2348,7 @@ func readlen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func writelen(fd int, buf *byte, nbuf int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_write_trampoline), uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + r0, _, e1 := syscall_syscall(libc_write_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2358,16 +2359,15 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstat_trampoline() +var libc_fstat_trampoline_addr uintptr -//go:linkname libc_fstat libc_fstat //go:cgo_import_dynamic libc_fstat fstat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2378,37 +2378,35 @@ func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall6(funcPC(libc_fstatat_trampoline), uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + _, _, e1 := syscall_syscall6(libc_fstatat_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstatat_trampoline() +var libc_fstatat_trampoline_addr uintptr -//go:linkname libc_fstatat libc_fstatat //go:cgo_import_dynamic libc_fstatat fstatat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := syscall_syscall(funcPC(libc_fstatfs_trampoline), uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_fstatfs_trampoline_addr, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_fstatfs_trampoline() +var libc_fstatfs_trampoline_addr uintptr -//go:linkname libc_fstatfs libc_fstatfs //go:cgo_import_dynamic libc_fstatfs fstatfs "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := syscall_syscall(funcPC(libc_getfsstat_trampoline), uintptr(buf), uintptr(size), uintptr(flags)) + r0, _, e1 := syscall_syscall(libc_getfsstat_trampoline_addr, uintptr(buf), uintptr(size), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -2416,9 +2414,8 @@ func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { return } -func libc_getfsstat_trampoline() +var libc_getfsstat_trampoline_addr uintptr -//go:linkname libc_getfsstat libc_getfsstat //go:cgo_import_dynamic libc_getfsstat getfsstat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2429,36 +2426,48 @@ func Lstat(path string, stat *Stat_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_lstat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_lstat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_lstat_trampoline() +var libc_lstat_trampoline_addr uintptr -//go:linkname libc_lstat libc_lstat //go:cgo_import_dynamic libc_lstat lstat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) { + _, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_ptrace_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_stat_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_stat_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_stat_trampoline() +var libc_stat_trampoline_addr uintptr -//go:linkname libc_stat libc_stat //go:cgo_import_dynamic libc_stat stat "/usr/lib/libSystem.B.dylib" // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -2469,14 +2478,13 @@ func Statfs(path string, stat *Statfs_t) (err error) { if err != nil { return } - _, _, e1 := syscall_syscall(funcPC(libc_statfs_trampoline), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := syscall_syscall(libc_statfs_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } -func libc_statfs_trampoline() +var libc_statfs_trampoline_addr uintptr -//go:linkname libc_statfs libc_statfs //go:cgo_import_dynamic libc_statfs statfs "/usr/lib/libSystem.B.dylib" diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 40cce1bb28..4ebcf21758 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -1,282 +1,883 @@ // go run mkasm_darwin.go arm64 // Code generated by the command above; DO NOT EDIT. +//go:build go1.12 // +build go1.12 #include "textflag.h" -TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0 + +TEXT libc_getgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgroups(SB) -TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgroups_trampoline_addr(SB)/8, $libc_getgroups_trampoline<>(SB) + +TEXT libc_setgroups_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgroups(SB) -TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setgroups_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgroups_trampoline_addr(SB)/8, $libc_setgroups_trampoline<>(SB) + +TEXT libc_wait4_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_wait4(SB) -TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_wait4_trampoline_addr(SB), RODATA, $8 +DATA ·libc_wait4_trampoline_addr(SB)/8, $libc_wait4_trampoline<>(SB) + +TEXT libc_accept_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_accept(SB) -TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_accept_trampoline_addr(SB), RODATA, $8 +DATA ·libc_accept_trampoline_addr(SB)/8, $libc_accept_trampoline<>(SB) + +TEXT libc_bind_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_bind(SB) -TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_bind_trampoline_addr(SB), RODATA, $8 +DATA ·libc_bind_trampoline_addr(SB)/8, $libc_bind_trampoline<>(SB) + +TEXT libc_connect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_connect(SB) -TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_connect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_connect_trampoline_addr(SB)/8, $libc_connect_trampoline<>(SB) + +TEXT libc_socket_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socket(SB) -TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_socket_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socket_trampoline_addr(SB)/8, $libc_socket_trampoline<>(SB) + +TEXT libc_getsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockopt(SB) -TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockopt_trampoline_addr(SB)/8, $libc_getsockopt_trampoline<>(SB) + +TEXT libc_setsockopt_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsockopt(SB) -TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setsockopt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsockopt_trampoline_addr(SB)/8, $libc_setsockopt_trampoline<>(SB) + +TEXT libc_getpeername_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpeername(SB) -TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpeername_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpeername_trampoline_addr(SB)/8, $libc_getpeername_trampoline<>(SB) + +TEXT libc_getsockname_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsockname(SB) -TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsockname_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsockname_trampoline_addr(SB)/8, $libc_getsockname_trampoline<>(SB) + +TEXT libc_shutdown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_shutdown(SB) -TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_shutdown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shutdown_trampoline_addr(SB)/8, $libc_shutdown_trampoline<>(SB) + +TEXT libc_socketpair_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_socketpair(SB) -TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_socketpair_trampoline_addr(SB), RODATA, $8 +DATA ·libc_socketpair_trampoline_addr(SB)/8, $libc_socketpair_trampoline<>(SB) + +TEXT libc_recvfrom_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvfrom(SB) -TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_recvfrom_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvfrom_trampoline_addr(SB)/8, $libc_recvfrom_trampoline<>(SB) + +TEXT libc_sendto_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendto(SB) -TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendto_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendto_trampoline_addr(SB)/8, $libc_sendto_trampoline<>(SB) + +TEXT libc_recvmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_recvmsg(SB) -TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_recvmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_recvmsg_trampoline_addr(SB)/8, $libc_recvmsg_trampoline<>(SB) + +TEXT libc_sendmsg_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendmsg(SB) -TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendmsg_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendmsg_trampoline_addr(SB)/8, $libc_sendmsg_trampoline<>(SB) + +TEXT libc_kevent_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kevent(SB) -TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kevent_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kevent_trampoline_addr(SB)/8, $libc_kevent_trampoline<>(SB) + +TEXT libc_utimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_utimes(SB) -TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_utimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_utimes_trampoline_addr(SB)/8, $libc_utimes_trampoline<>(SB) + +TEXT libc_futimes_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_futimes(SB) -TEXT ·libc_poll_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_futimes_trampoline_addr(SB), RODATA, $8 +DATA ·libc_futimes_trampoline_addr(SB)/8, $libc_futimes_trampoline<>(SB) + +TEXT libc_poll_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_poll(SB) -TEXT ·libc_madvise_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_poll_trampoline_addr(SB), RODATA, $8 +DATA ·libc_poll_trampoline_addr(SB)/8, $libc_poll_trampoline<>(SB) + +TEXT libc_madvise_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_madvise(SB) -TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_madvise_trampoline_addr(SB), RODATA, $8 +DATA ·libc_madvise_trampoline_addr(SB)/8, $libc_madvise_trampoline<>(SB) + +TEXT libc_mlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlock(SB) -TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlock_trampoline_addr(SB)/8, $libc_mlock_trampoline<>(SB) + +TEXT libc_mlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mlockall(SB) -TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mlockall_trampoline_addr(SB)/8, $libc_mlockall_trampoline<>(SB) + +TEXT libc_mprotect_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mprotect(SB) -TEXT ·libc_msync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mprotect_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mprotect_trampoline_addr(SB)/8, $libc_mprotect_trampoline<>(SB) + +TEXT libc_msync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_msync(SB) -TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_msync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_msync_trampoline_addr(SB)/8, $libc_msync_trampoline<>(SB) + +TEXT libc_munlock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlock(SB) -TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munlock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlock_trampoline_addr(SB)/8, $libc_munlock_trampoline<>(SB) + +TEXT libc_munlockall_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munlockall(SB) -TEXT ·libc_getattrlist_trampoline(SB),NOSPLIT,$0-0 - JMP libc_getattrlist(SB) -TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munlockall_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munlockall_trampoline_addr(SB)/8, $libc_munlockall_trampoline<>(SB) + +TEXT libc_pipe_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pipe(SB) -TEXT ·libc_getxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pipe_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pipe_trampoline_addr(SB)/8, $libc_pipe_trampoline<>(SB) + +TEXT libc_getxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getxattr(SB) -TEXT ·libc_fgetxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getxattr_trampoline_addr(SB)/8, $libc_getxattr_trampoline<>(SB) + +TEXT libc_fgetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fgetxattr(SB) -TEXT ·libc_setxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fgetxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fgetxattr_trampoline_addr(SB)/8, $libc_fgetxattr_trampoline<>(SB) + +TEXT libc_setxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setxattr(SB) -TEXT ·libc_fsetxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setxattr_trampoline_addr(SB)/8, $libc_setxattr_trampoline<>(SB) + +TEXT libc_fsetxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsetxattr(SB) -TEXT ·libc_removexattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fsetxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsetxattr_trampoline_addr(SB)/8, $libc_fsetxattr_trampoline<>(SB) + +TEXT libc_removexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_removexattr(SB) -TEXT ·libc_fremovexattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_removexattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_removexattr_trampoline_addr(SB)/8, $libc_removexattr_trampoline<>(SB) + +TEXT libc_fremovexattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fremovexattr(SB) -TEXT ·libc_listxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fremovexattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fremovexattr_trampoline_addr(SB)/8, $libc_fremovexattr_trampoline<>(SB) + +TEXT libc_listxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listxattr(SB) -TEXT ·libc_flistxattr_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_listxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listxattr_trampoline_addr(SB)/8, $libc_listxattr_trampoline<>(SB) + +TEXT libc_flistxattr_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flistxattr(SB) -TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_flistxattr_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flistxattr_trampoline_addr(SB)/8, $libc_flistxattr_trampoline<>(SB) + +TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setattrlist(SB) -TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB) + +TEXT libc_fcntl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fcntl(SB) -TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fcntl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fcntl_trampoline_addr(SB)/8, $libc_fcntl_trampoline<>(SB) + +TEXT libc_kill_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kill(SB) -TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kill_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kill_trampoline_addr(SB)/8, $libc_kill_trampoline<>(SB) + +TEXT libc_ioctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ioctl(SB) -TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ioctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ioctl_trampoline_addr(SB)/8, $libc_ioctl_trampoline<>(SB) + +TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) -TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) + +TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) -TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) + +TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmat(SB) + +GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB) + +TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmctl(SB) + +GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB) + +TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmdt(SB) + +GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB) + +TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmget(SB) + +GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB) + +TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) -TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_access_trampoline_addr(SB), RODATA, $8 +DATA ·libc_access_trampoline_addr(SB)/8, $libc_access_trampoline<>(SB) + +TEXT libc_adjtime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_adjtime(SB) -TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_adjtime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_adjtime_trampoline_addr(SB)/8, $libc_adjtime_trampoline<>(SB) + +TEXT libc_chdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chdir(SB) -TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chdir_trampoline_addr(SB)/8, $libc_chdir_trampoline<>(SB) + +TEXT libc_chflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chflags(SB) -TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chflags_trampoline_addr(SB)/8, $libc_chflags_trampoline<>(SB) + +TEXT libc_chmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chmod(SB) -TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chmod_trampoline_addr(SB)/8, $libc_chmod_trampoline<>(SB) + +TEXT libc_chown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chown(SB) -TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chown_trampoline_addr(SB)/8, $libc_chown_trampoline<>(SB) + +TEXT libc_chroot_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_chroot(SB) -TEXT ·libc_clock_gettime_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_chroot_trampoline_addr(SB), RODATA, $8 +DATA ·libc_chroot_trampoline_addr(SB)/8, $libc_chroot_trampoline<>(SB) + +TEXT libc_clock_gettime_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_clock_gettime(SB) -TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_clock_gettime_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clock_gettime_trampoline_addr(SB)/8, $libc_clock_gettime_trampoline<>(SB) + +TEXT libc_close_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_close(SB) -TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_close_trampoline_addr(SB), RODATA, $8 +DATA ·libc_close_trampoline_addr(SB)/8, $libc_close_trampoline<>(SB) + +TEXT libc_clonefile_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clonefile(SB) + +GLOBL ·libc_clonefile_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clonefile_trampoline_addr(SB)/8, $libc_clonefile_trampoline<>(SB) + +TEXT libc_clonefileat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_clonefileat(SB) + +GLOBL ·libc_clonefileat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_clonefileat_trampoline_addr(SB)/8, $libc_clonefileat_trampoline<>(SB) + +TEXT libc_dup_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup(SB) -TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_dup_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup_trampoline_addr(SB)/8, $libc_dup_trampoline<>(SB) + +TEXT libc_dup2_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_dup2(SB) -TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_dup2_trampoline_addr(SB), RODATA, $8 +DATA ·libc_dup2_trampoline_addr(SB)/8, $libc_dup2_trampoline<>(SB) + +TEXT libc_exchangedata_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exchangedata(SB) -TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_exchangedata_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exchangedata_trampoline_addr(SB)/8, $libc_exchangedata_trampoline<>(SB) + +TEXT libc_exit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_exit(SB) -TEXT ·libc_faccessat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_exit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_exit_trampoline_addr(SB)/8, $libc_exit_trampoline<>(SB) + +TEXT libc_faccessat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_faccessat(SB) -TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_faccessat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_faccessat_trampoline_addr(SB)/8, $libc_faccessat_trampoline<>(SB) + +TEXT libc_fchdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchdir(SB) -TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchdir_trampoline_addr(SB)/8, $libc_fchdir_trampoline<>(SB) + +TEXT libc_fchflags_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchflags(SB) -TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchflags_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchflags_trampoline_addr(SB)/8, $libc_fchflags_trampoline<>(SB) + +TEXT libc_fchmod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmod(SB) -TEXT ·libc_fchmodat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchmod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmod_trampoline_addr(SB)/8, $libc_fchmod_trampoline<>(SB) + +TEXT libc_fchmodat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchmodat(SB) -TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchmodat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchmodat_trampoline_addr(SB)/8, $libc_fchmodat_trampoline<>(SB) + +TEXT libc_fchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchown(SB) -TEXT ·libc_fchownat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchown_trampoline_addr(SB)/8, $libc_fchown_trampoline<>(SB) + +TEXT libc_fchownat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fchownat(SB) -TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fchownat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fchownat_trampoline_addr(SB)/8, $libc_fchownat_trampoline<>(SB) + +TEXT libc_fclonefileat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_fclonefileat(SB) + +GLOBL ·libc_fclonefileat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fclonefileat_trampoline_addr(SB)/8, $libc_fclonefileat_trampoline<>(SB) + +TEXT libc_flock_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_flock(SB) -TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_flock_trampoline_addr(SB), RODATA, $8 +DATA ·libc_flock_trampoline_addr(SB)/8, $libc_flock_trampoline<>(SB) + +TEXT libc_fpathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fpathconf(SB) -TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fpathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fpathconf_trampoline_addr(SB)/8, $libc_fpathconf_trampoline<>(SB) + +TEXT libc_fsync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fsync(SB) -TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fsync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fsync_trampoline_addr(SB)/8, $libc_fsync_trampoline<>(SB) + +TEXT libc_ftruncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_ftruncate(SB) -TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_ftruncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ftruncate_trampoline_addr(SB)/8, $libc_ftruncate_trampoline<>(SB) + +TEXT libc_getcwd_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_getcwd(SB) + +GLOBL ·libc_getcwd_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getcwd_trampoline_addr(SB)/8, $libc_getcwd_trampoline<>(SB) + +TEXT libc_getdtablesize_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getdtablesize(SB) -TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getdtablesize_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getdtablesize_trampoline_addr(SB)/8, $libc_getdtablesize_trampoline<>(SB) + +TEXT libc_getegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getegid(SB) -TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getegid_trampoline_addr(SB)/8, $libc_getegid_trampoline<>(SB) + +TEXT libc_geteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_geteuid(SB) -TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_geteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_geteuid_trampoline_addr(SB)/8, $libc_geteuid_trampoline<>(SB) + +TEXT libc_getgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getgid(SB) -TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getgid_trampoline_addr(SB)/8, $libc_getgid_trampoline<>(SB) + +TEXT libc_getpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgid(SB) -TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgid_trampoline_addr(SB)/8, $libc_getpgid_trampoline<>(SB) + +TEXT libc_getpgrp_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpgrp(SB) -TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpgrp_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpgrp_trampoline_addr(SB)/8, $libc_getpgrp_trampoline<>(SB) + +TEXT libc_getpid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpid(SB) -TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpid_trampoline_addr(SB)/8, $libc_getpid_trampoline<>(SB) + +TEXT libc_getppid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getppid(SB) -TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getppid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getppid_trampoline_addr(SB)/8, $libc_getppid_trampoline<>(SB) + +TEXT libc_getpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getpriority(SB) -TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getpriority_trampoline_addr(SB)/8, $libc_getpriority_trampoline<>(SB) + +TEXT libc_getrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrlimit(SB) -TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrlimit_trampoline_addr(SB)/8, $libc_getrlimit_trampoline<>(SB) + +TEXT libc_getrusage_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getrusage(SB) -TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getrusage_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getrusage_trampoline_addr(SB)/8, $libc_getrusage_trampoline<>(SB) + +TEXT libc_getsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getsid(SB) -TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getsid_trampoline_addr(SB)/8, $libc_getsid_trampoline<>(SB) + +TEXT libc_gettimeofday_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_gettimeofday(SB) + +GLOBL ·libc_gettimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_gettimeofday_trampoline_addr(SB)/8, $libc_gettimeofday_trampoline<>(SB) + +TEXT libc_getuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getuid(SB) -TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getuid_trampoline_addr(SB)/8, $libc_getuid_trampoline<>(SB) + +TEXT libc_issetugid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_issetugid(SB) -TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_issetugid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_issetugid_trampoline_addr(SB)/8, $libc_issetugid_trampoline<>(SB) + +TEXT libc_kqueue_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_kqueue(SB) -TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_kqueue_trampoline_addr(SB), RODATA, $8 +DATA ·libc_kqueue_trampoline_addr(SB)/8, $libc_kqueue_trampoline<>(SB) + +TEXT libc_lchown_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lchown(SB) -TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lchown_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lchown_trampoline_addr(SB)/8, $libc_lchown_trampoline<>(SB) + +TEXT libc_link_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_link(SB) -TEXT ·libc_linkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_link_trampoline_addr(SB), RODATA, $8 +DATA ·libc_link_trampoline_addr(SB)/8, $libc_link_trampoline<>(SB) + +TEXT libc_linkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_linkat(SB) -TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_linkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_linkat_trampoline_addr(SB)/8, $libc_linkat_trampoline<>(SB) + +TEXT libc_listen_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_listen(SB) -TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_listen_trampoline_addr(SB), RODATA, $8 +DATA ·libc_listen_trampoline_addr(SB)/8, $libc_listen_trampoline<>(SB) + +TEXT libc_mkdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdir(SB) -TEXT ·libc_mkdirat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdir_trampoline_addr(SB)/8, $libc_mkdir_trampoline<>(SB) + +TEXT libc_mkdirat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkdirat(SB) -TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkdirat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkdirat_trampoline_addr(SB)/8, $libc_mkdirat_trampoline<>(SB) + +TEXT libc_mkfifo_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mkfifo(SB) -TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mkfifo_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mkfifo_trampoline_addr(SB)/8, $libc_mkfifo_trampoline<>(SB) + +TEXT libc_mknod_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mknod(SB) -TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mknod_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mknod_trampoline_addr(SB)/8, $libc_mknod_trampoline<>(SB) + +TEXT libc_open_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_open(SB) -TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_open_trampoline_addr(SB), RODATA, $8 +DATA ·libc_open_trampoline_addr(SB)/8, $libc_open_trampoline<>(SB) + +TEXT libc_openat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_openat(SB) -TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_openat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_openat_trampoline_addr(SB)/8, $libc_openat_trampoline<>(SB) + +TEXT libc_pathconf_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pathconf(SB) -TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pathconf_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pathconf_trampoline_addr(SB)/8, $libc_pathconf_trampoline<>(SB) + +TEXT libc_pread_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pread(SB) -TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pread_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pread_trampoline_addr(SB)/8, $libc_pread_trampoline<>(SB) + +TEXT libc_pwrite_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_pwrite(SB) -TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_pwrite_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pwrite_trampoline_addr(SB)/8, $libc_pwrite_trampoline<>(SB) + +TEXT libc_read_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_read(SB) -TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_read_trampoline_addr(SB), RODATA, $8 +DATA ·libc_read_trampoline_addr(SB)/8, $libc_read_trampoline<>(SB) + +TEXT libc_readlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlink(SB) -TEXT ·libc_readlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_readlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlink_trampoline_addr(SB)/8, $libc_readlink_trampoline<>(SB) + +TEXT libc_readlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_readlinkat(SB) -TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_readlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_readlinkat_trampoline_addr(SB)/8, $libc_readlinkat_trampoline<>(SB) + +TEXT libc_rename_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rename(SB) -TEXT ·libc_renameat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_rename_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rename_trampoline_addr(SB)/8, $libc_rename_trampoline<>(SB) + +TEXT libc_renameat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_renameat(SB) -TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_renameat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_renameat_trampoline_addr(SB)/8, $libc_renameat_trampoline<>(SB) + +TEXT libc_revoke_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_revoke(SB) -TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_revoke_trampoline_addr(SB), RODATA, $8 +DATA ·libc_revoke_trampoline_addr(SB)/8, $libc_revoke_trampoline<>(SB) + +TEXT libc_rmdir_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_rmdir(SB) -TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_rmdir_trampoline_addr(SB), RODATA, $8 +DATA ·libc_rmdir_trampoline_addr(SB)/8, $libc_rmdir_trampoline<>(SB) + +TEXT libc_lseek_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lseek(SB) -TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lseek_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lseek_trampoline_addr(SB)/8, $libc_lseek_trampoline<>(SB) + +TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_select(SB) -TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8 +DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB) + +TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setegid(SB) -TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setegid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setegid_trampoline_addr(SB)/8, $libc_setegid_trampoline<>(SB) + +TEXT libc_seteuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_seteuid(SB) -TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_seteuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_seteuid_trampoline_addr(SB)/8, $libc_seteuid_trampoline<>(SB) + +TEXT libc_setgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setgid(SB) -TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setgid_trampoline_addr(SB)/8, $libc_setgid_trampoline<>(SB) + +TEXT libc_setlogin_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setlogin(SB) -TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setlogin_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setlogin_trampoline_addr(SB)/8, $libc_setlogin_trampoline<>(SB) + +TEXT libc_setpgid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpgid(SB) -TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setpgid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpgid_trampoline_addr(SB)/8, $libc_setpgid_trampoline<>(SB) + +TEXT libc_setpriority_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setpriority(SB) -TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setpriority_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setpriority_trampoline_addr(SB)/8, $libc_setpriority_trampoline<>(SB) + +TEXT libc_setprivexec_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setprivexec(SB) -TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setprivexec_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setprivexec_trampoline_addr(SB)/8, $libc_setprivexec_trampoline<>(SB) + +TEXT libc_setregid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setregid(SB) -TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setregid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setregid_trampoline_addr(SB)/8, $libc_setregid_trampoline<>(SB) + +TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setreuid(SB) -TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB) + +TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setrlimit(SB) -TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB) + +TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setsid(SB) -TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setsid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setsid_trampoline_addr(SB)/8, $libc_setsid_trampoline<>(SB) + +TEXT libc_settimeofday_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_settimeofday(SB) -TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_settimeofday_trampoline_addr(SB), RODATA, $8 +DATA ·libc_settimeofday_trampoline_addr(SB)/8, $libc_settimeofday_trampoline<>(SB) + +TEXT libc_setuid_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_setuid(SB) -TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_setuid_trampoline_addr(SB), RODATA, $8 +DATA ·libc_setuid_trampoline_addr(SB)/8, $libc_setuid_trampoline<>(SB) + +TEXT libc_symlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlink(SB) -TEXT ·libc_symlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_symlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlink_trampoline_addr(SB)/8, $libc_symlink_trampoline<>(SB) + +TEXT libc_symlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_symlinkat(SB) -TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_symlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_symlinkat_trampoline_addr(SB)/8, $libc_symlinkat_trampoline<>(SB) + +TEXT libc_sync_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sync(SB) -TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_sync_trampoline_addr(SB), RODATA, $8 +DATA ·libc_sync_trampoline_addr(SB)/8, $libc_sync_trampoline<>(SB) + +TEXT libc_truncate_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_truncate(SB) -TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_truncate_trampoline_addr(SB), RODATA, $8 +DATA ·libc_truncate_trampoline_addr(SB)/8, $libc_truncate_trampoline<>(SB) + +TEXT libc_umask_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_umask(SB) -TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_umask_trampoline_addr(SB), RODATA, $8 +DATA ·libc_umask_trampoline_addr(SB)/8, $libc_umask_trampoline<>(SB) + +TEXT libc_undelete_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_undelete(SB) -TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_undelete_trampoline_addr(SB), RODATA, $8 +DATA ·libc_undelete_trampoline_addr(SB)/8, $libc_undelete_trampoline<>(SB) + +TEXT libc_unlink_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlink(SB) -TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unlink_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlink_trampoline_addr(SB)/8, $libc_unlink_trampoline<>(SB) + +TEXT libc_unlinkat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unlinkat(SB) -TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unlinkat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unlinkat_trampoline_addr(SB)/8, $libc_unlinkat_trampoline<>(SB) + +TEXT libc_unmount_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_unmount(SB) -TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_unmount_trampoline_addr(SB), RODATA, $8 +DATA ·libc_unmount_trampoline_addr(SB)/8, $libc_unmount_trampoline<>(SB) + +TEXT libc_write_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_write(SB) -TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_write_trampoline_addr(SB), RODATA, $8 +DATA ·libc_write_trampoline_addr(SB)/8, $libc_write_trampoline<>(SB) + +TEXT libc_mmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_mmap(SB) -TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_mmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_mmap_trampoline_addr(SB)/8, $libc_mmap_trampoline<>(SB) + +TEXT libc_munmap_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_munmap(SB) -TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0 - JMP libc_gettimeofday(SB) -TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_munmap_trampoline_addr(SB), RODATA, $8 +DATA ·libc_munmap_trampoline_addr(SB)/8, $libc_munmap_trampoline<>(SB) + +TEXT libc_fstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstat(SB) -TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstat_trampoline_addr(SB)/8, $libc_fstat_trampoline<>(SB) + +TEXT libc_fstatat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatat(SB) -TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstatat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatat_trampoline_addr(SB)/8, $libc_fstatat_trampoline<>(SB) + +TEXT libc_fstatfs_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_fstatfs(SB) -TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_fstatfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_fstatfs_trampoline_addr(SB)/8, $libc_fstatfs_trampoline<>(SB) + +TEXT libc_getfsstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_getfsstat(SB) -TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_getfsstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_getfsstat_trampoline_addr(SB)/8, $libc_getfsstat_trampoline<>(SB) + +TEXT libc_lstat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_lstat(SB) -TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_lstat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_lstat_trampoline_addr(SB)/8, $libc_lstat_trampoline<>(SB) + +TEXT libc_ptrace_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_ptrace(SB) + +GLOBL ·libc_ptrace_trampoline_addr(SB), RODATA, $8 +DATA ·libc_ptrace_trampoline_addr(SB)/8, $libc_ptrace_trampoline<>(SB) + +TEXT libc_stat_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_stat(SB) -TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0 + +GLOBL ·libc_stat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_stat_trampoline_addr(SB)/8, $libc_stat_trampoline<>(SB) + +TEXT libc_statfs_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_statfs(SB) + +GLOBL ·libc_statfs_trampoline_addr(SB), RODATA, $8 +DATA ·libc_statfs_trampoline_addr(SB)/8, $libc_statfs_trampoline<>(SB) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go index fe1fdd78d7..1b6eedfa61 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -dragonfly -tags dragonfly,amd64 syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build dragonfly && amd64 // +build dragonfly,amd64 package unix @@ -214,22 +215,6 @@ func kevent(kq int, change unsafe.Pointer, nchange int, event unsafe.Pointer, ne // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { - var _p0 unsafe.Pointer - if len(mib) > 0 { - _p0 = unsafe.Pointer(&mib[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func utimes(path string, timeval *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -378,6 +363,18 @@ func pipe() (r int, w int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (r int, w int, err error) { + r0, r1, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + r = int(r0) + w = int(r1) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func extpread(fd int, p []byte, flags int, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -439,6 +436,22 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { + var _p0 unsafe.Pointer + if len(mib) > 0 { + _p0 = unsafe.Pointer(&mib[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go index 600f1d26d2..3e9bddb7b2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -tags freebsd,386 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build freebsd && 386 // +build freebsd,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go index 064934b0d1..c72a462b91 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags freebsd,amd64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build freebsd && amd64 // +build freebsd,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go index 31d2c46165..530d5df90c 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -arm -tags freebsd,arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build freebsd && arm // +build freebsd,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go index 4adaaa5618..71e7df9e85 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags freebsd,arm64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build freebsd && arm64 // +build freebsd,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go index 92efa1da3c..af5cb064ec 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall_solaris.go -illumos -tags illumos,amd64 syscall_illumos.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build illumos && amd64 // +build illumos,amd64 package unix @@ -13,17 +14,26 @@ import ( //go:cgo_import_dynamic libc_preadv preadv "libc.so" //go:cgo_import_dynamic libc_writev writev "libc.so" //go:cgo_import_dynamic libc_pwritev pwritev "libc.so" +//go:cgo_import_dynamic libc_accept4 accept4 "libsocket.so" +//go:cgo_import_dynamic libc_putmsg putmsg "libc.so" +//go:cgo_import_dynamic libc_getmsg getmsg "libc.so" //go:linkname procreadv libc_readv //go:linkname procpreadv libc_preadv //go:linkname procwritev libc_writev //go:linkname procpwritev libc_pwritev +//go:linkname procaccept4 libc_accept4 +//go:linkname procputmsg libc_putmsg +//go:linkname procgetmsg libc_getmsg var ( procreadv, procpreadv, procwritev, - procpwritev syscallFunc + procpwritev, + procaccept4, + procputmsg, + procgetmsg syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -85,3 +95,34 @@ func pwritev(fd int, iovs []Iovec, off int64) (n int, err error) { } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procaccept4)), 4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + fd = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error) { + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procputmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(flags), 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error) { + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetmsg)), 4, uintptr(fd), uintptr(unsafe.Pointer(clptr)), uintptr(unsafe.Pointer(dataptr)), uintptr(unsafe.Pointer(flags)), 0, 0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go index df217825f0..4f5da1f54f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1,5 +1,6 @@ // Code generated by mkmerge.go; DO NOT EDIT. +//go:build linux // +build linux package unix @@ -47,6 +48,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) { + _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) @@ -83,6 +94,32 @@ func openat(dirfd int, path string, flags int, mode uint32) (fd int, err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := Syscall6(SYS_OPENAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(open_how)), uintptr(size), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) n = int(r0) @@ -515,6 +552,16 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func CloseRange(first uint, last uint, flags uint) (err error) { + _, _, e1 := Syscall(SYS_CLOSE_RANGE, uintptr(first), uintptr(last), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int(r0) @@ -1174,7 +1221,7 @@ func PivotRoot(newroot string, putold string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { +func Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) { _, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0) if e1 != 0 { err = errnoErr(e1) @@ -1821,6 +1868,21 @@ func faccessat(dirfd int, path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Faccessat2(dirfd int, path string, mode uint32, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FACCESSAT2, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(pathname) @@ -1847,8 +1909,109 @@ func openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe2(p *[2]_C_int, flags int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) +func ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) { + var _p0 unsafe.Pointer + if len(localIov) > 0 { + _p0 = unsafe.Pointer(&localIov[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + var _p1 unsafe.Pointer + if len(remoteIov) > 0 { + _p1 = unsafe.Pointer(&remoteIov[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PROCESS_VM_READV, uintptr(pid), uintptr(_p0), uintptr(len(localIov)), uintptr(_p1), uintptr(len(remoteIov)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) { + var _p0 unsafe.Pointer + if len(localIov) > 0 { + _p0 = unsafe.Pointer(&localIov[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + var _p1 unsafe.Pointer + if len(remoteIov) > 0 { + _p1 = unsafe.Pointer(&remoteIov[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PROCESS_VM_WRITEV, uintptr(pid), uintptr(_p0), uintptr(len(localIov)), uintptr(_p1), uintptr(len(remoteIov)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func PidfdOpen(pid int, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_PIDFD_OPEN, uintptr(pid), uintptr(flags), 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_PIDFD_GETFD, uintptr(pidfd), uintptr(targetfd), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := Syscall(SYS_SHMAT, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := Syscall(SYS_SHMCTL, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := Syscall(SYS_SHMDT, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := Syscall(SYS_SHMGET, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) if e1 != 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 19ebd3ff75..ff90c81e73 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -tags linux,386 syscall_linux.go syscall_linux_386.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && 386 // +build linux,386 package unix @@ -45,37 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -180,17 +150,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -565,14 +524,3 @@ func utimes(path string, times *[2]Timeval) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 5c562182a1..fa7d3dbe4e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,amd64 syscall_linux.go syscall_linux_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && amd64 // +build linux,amd64 package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -190,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func inotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -710,27 +679,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(cmdline) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index dc69d99c61..654f91530f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && arm // +build linux,arm package unix @@ -45,16 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) fd = int(r0) @@ -234,27 +225,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -339,17 +309,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -680,17 +639,6 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index 1b897dee05..e893f987f9 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,arm64 syscall_linux.go syscall_linux_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && arm64 // +build linux,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 49186843ae..6d15528853 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -1,6 +1,7 @@ // go run mksyscall.go -b32 -arm -tags linux,mips syscall_linux.go syscall_linux_mipsx.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && mips // +build linux,mips package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -543,17 +523,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -705,18 +674,6 @@ func Pause() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (p1 int, p2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - p1 = int(r0) - p2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) @@ -745,14 +702,3 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index 9171d3bd2a..1e20d72df2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,mips64 syscall_linux.go syscall_linux_mips64x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && mips64 // +build linux,mips64 package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -716,14 +696,3 @@ func stat(path string, st *stat_t) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index 82286f04f9..82b5e2d9ed 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,mips64le syscall_linux.go syscall_linux_mips64x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && mips64le // +build linux,mips64le package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -716,14 +696,3 @@ func stat(path string, st *stat_t) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index 15920621c4..a0440c1d43 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -arm -tags linux,mipsle syscall_linux.go syscall_linux_mipsx.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && mipsle // +build linux,mipsle package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -543,17 +523,6 @@ func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -705,18 +674,6 @@ func Pause() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (p1 int, p2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - p1 = int(r0) - p2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) @@ -745,14 +702,3 @@ func setrlimit(resource int, rlim *rlimit32) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go new file mode 100644 index 0000000000..5864b9ca64 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go @@ -0,0 +1,709 @@ +// go run mksyscall.go -b32 -tags linux,ppc syscall_linux.go syscall_linux_ppc.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build linux && ppc +// +build linux,ppc + +package unix + +import ( + "syscall" + "unsafe" +) + +var _ syscall.Errno + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { + _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask>>32), uintptr(mask), uintptr(dirFd), uintptr(unsafe.Pointer(pathname))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { + _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off>>32), uintptr(off), uintptr(len>>32), uintptr(len)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { + r0, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) + n = int64(int64(r0)<<32 | int64(r1)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { + var _p0 unsafe.Pointer + if len(events) > 0 { + _p0 = unsafe.Pointer(&events[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := Syscall(SYS_FTRUNCATE64, uintptr(fd), uintptr(length>>32), uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _ := RawSyscallNoError(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (euid int) { + r0, _ := RawSyscallNoError(SYS_GETEUID, 0, 0, 0) + euid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _ := RawSyscallNoError(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _ := RawSyscallNoError(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ioperm(from int, num int, on int) (err error) { + _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Iopl(level int) (err error) { + _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LCHOWN, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, n int) (err error) { + _, _, e1 := Syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pause() (err error) { + _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset>>32), uintptr(offset), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset>>32), uintptr(offset), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(oldpath) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(newpath) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { + r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) + written = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setfsgid(gid int) (prev int, err error) { + r0, _, e1 := Syscall(SYS_SETFSGID, uintptr(gid), 0, 0) + prev = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setfsuid(uid int) (prev int, err error) { + r0, _, e1 := Syscall(SYS_SETFSUID, uintptr(uid), 0, 0) + prev = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(fd int, how int) (err error) { + _, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { + r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), uintptr(length>>32), uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ustat(dev int, ubuf *Ustat_t) (err error) { + _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := Syscall(SYS_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) { + r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_BIND, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := Syscall(SYS_CONNECT, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(n int, list *_Gid_t) (nn int, err error) { + r0, _, e1 := RawSyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + nn = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(n int, list *_Gid_t) (err error) { + _, _, e1 := RawSyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := Syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := RawSyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := RawSyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETPEERNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := RawSyscall(SYS_GETSOCKNAME, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := Syscall6(SYS_RECVFROM, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := Syscall6(SYS_SENDTO, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Time(t *Time_t) (tt Time_t, err error) { + r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) + tt = Time_t(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Utime(path string, buf *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, times *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { + r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) + xaddr = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getrlimit(resource int, rlim *rlimit32) (err error) { + _, _, e1 := RawSyscall(SYS_UGETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setrlimit(resource int, rlim *rlimit32) (err error) { + _, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { + _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off>>32), uintptr(off), uintptr(n>>32), uintptr(n)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(cmdline) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_KEXEC_FILE_LOAD, uintptr(kernelFd), uintptr(initrdFd), uintptr(cmdlineLen), uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index 73a42e2ccb..beeb49e342 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,ppc64 syscall_linux.go syscall_linux_ppc64x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && ppc64 // +build linux,ppc64 package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -190,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -762,27 +731,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off), uintptr(n), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 6b85595366..53139b82c7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,ppc64le syscall_linux.go syscall_linux_ppc64x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && ppc64le // +build linux,ppc64le package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -190,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { @@ -762,27 +731,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func syncFileRange2(fd int, flags int, off int64, n int64) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE2, uintptr(fd), uintptr(flags), uintptr(off), uintptr(n), 0, 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go index b76133447e..63b393b802 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,riscv64 syscall_linux.go syscall_linux_riscv64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && riscv64 // +build linux,riscv64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index d7032ab1e4..202add37d1 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,s390x syscall_linux.go syscall_linux_s390x.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && s390x // +build linux,s390x package unix @@ -45,27 +46,6 @@ func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func EpollCreate(size int) (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_EPOLL_CREATE, uintptr(size), 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { @@ -190,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -552,17 +521,6 @@ func utimes(path string, times *[2]Timeval) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(cmdline) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go index bcbbdd906e..2ab268c343 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -tags linux,sparc64 syscall_linux.go syscall_linux_sparc64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build linux && sparc64 // +build linux,sparc64 package unix @@ -72,16 +73,6 @@ func Fadvise(fd int, offset int64, length int64, advice int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func dup2(oldfd int, newfd int) (err error) { - _, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { @@ -179,17 +170,6 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func InotifyInit() (fd int, err error) { - r0, _, e1 := RawSyscall(SYS_INOTIFY_INIT, 0, 0, 0) - fd = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -717,24 +697,3 @@ func utimes(path string, times *[2]Timeval) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func pipe(p *[2]_C_int) (err error) { - _, _, e1 := RawSyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func poll(fds *PollFd, nfds int, timeout int) (n int, err error) { - r0, _, e1 := Syscall(SYS_POLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(timeout)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 3bbd9e39cd..4726ab30a8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -netbsd -tags netbsd,386 syscall_bsd.go syscall_netbsd.go syscall_netbsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build netbsd && 386 // +build netbsd,386 package unix @@ -362,6 +363,16 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index d8cf5012c2..fe71456dbc 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -netbsd -tags netbsd,amd64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build netbsd && amd64 // +build netbsd,amd64 package unix @@ -362,6 +363,16 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 1153fe69b8..0b5b2f0143 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -netbsd -arm -tags netbsd,arm syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build netbsd && arm // +build netbsd,arm package unix @@ -362,6 +363,16 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index 24b4ebb41f..bfca28648f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -netbsd -tags netbsd,arm64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build netbsd && arm64 // +build netbsd,arm64 package unix @@ -362,6 +363,16 @@ func pipe() (fd1 int, fd2 int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getdents(fd int, buf []byte) (n int, err error) { var _p0 unsafe.Pointer if len(buf) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go index b44b31aeb1..8f80f4ade5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -openbsd -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && 386 // +build openbsd,386 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go index 67f93ee76d..3a47aca7bf 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -openbsd -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && amd64 // +build openbsd,amd64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go index d7c878b1d0..883a9b45e8 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go @@ -1,6 +1,7 @@ // go run mksyscall.go -l32 -openbsd -arm -tags openbsd,arm syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && arm // +build openbsd,arm package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go index 8facd695d5..aac7fdc95e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksyscall.go -openbsd -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build openbsd && arm64 // +build openbsd,arm64 package unix diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go similarity index 86% rename from vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go rename to vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go index 8d39a09f72..8776187462 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.1_11.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go @@ -1,7 +1,8 @@ -// go run mksyscall.go -tags darwin,arm64,!go1.12 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.1_11.go syscall_darwin_arm64.go +// go run mksyscall.go -openbsd -tags openbsd,mips64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_mips64.go // Code generated by the command above; see README.md. DO NOT EDIT. -// +build darwin,arm64,!go1.12 +//go:build openbsd && mips64 +// +build openbsd,mips64 package unix @@ -350,8 +351,8 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_GETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { err = errnoErr(e1) } @@ -360,154 +361,15 @@ func getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintp // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (r int, w int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - r = int(r0) - w = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getxattr(path string, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fgetxattr(fd int, attr string, dest *byte, size int, position uint32, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_FGETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(position), uintptr(options)) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setxattr(path string, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_SETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fsetxattr(fd int, attr string, data *byte, size int, position uint32, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall6(SYS_FSETXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(data)), uintptr(size), uintptr(position), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func removexattr(path string, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_REMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func fremovexattr(fd int, attr string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(attr) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_FREMOVEXATTR, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(options)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func listxattr(path string, dest *byte, size int, options int) (sz int, err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - r0, _, e1 := Syscall6(SYS_LISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func flistxattr(fd int, dest *byte, size int, options int) (sz int, err error) { - r0, _, e1 := Syscall6(SYS_FLISTXATTR, uintptr(fd), uintptr(unsafe.Pointer(dest)), uintptr(size), uintptr(options), 0, 0) - sz = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func Getdents(fd int, buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error) { - _, _, e1 := Syscall6(SYS_SETATTRLIST, uintptr(unsafe.Pointer(path)), uintptr(list), uintptr(buf), uintptr(size), uintptr(options), 0) + r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf))) + n = int(r0) if e1 != 0 { err = errnoErr(e1) } @@ -516,19 +378,15 @@ func setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintp // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func fcntl(fd int, cmd int, arg int) (val int, err error) { - r0, _, e1 := Syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) - val = int(r0) - if e1 != 0 { - err = errnoErr(e1) +func Getcwd(buf []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func kill(pid int, signum int, posix int) (err error) { - _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) + r0, _, e1 := Syscall(SYS___GETCWD, uintptr(_p0), uintptr(len(buf)), 0) + n = int(r0) if e1 != 0 { err = errnoErr(e1) } @@ -554,7 +412,7 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) } else { _p0 = unsafe.Pointer(&_zero) } - _, _, e1 := Syscall6(SYS_SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) + _, _, e1 := Syscall6(SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if e1 != 0 { err = errnoErr(e1) } @@ -563,8 +421,9 @@ func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { - _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) +func ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { + r0, _, e1 := Syscall6(SYS_PPOLL, uintptr(unsafe.Pointer(fds)), uintptr(nfds), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask)), 0, 0) + n = int(r0) if e1 != 0 { err = errnoErr(e1) } @@ -704,18 +563,8 @@ func Dup2(from int, to int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Exchangedata(path1 string, path2 string, options int) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path1) - if err != nil { - return - } - var _p1 *byte - _p1, err = BytePtrFromString(path2) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_EXCHANGEDATA, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(options)) +func Dup3(from int, to int, flags int) (err error) { + _, _, e1 := Syscall(SYS_DUP3, uintptr(from), uintptr(to), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } @@ -837,8 +686,8 @@ func Fpathconf(fd int, name int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fsync(fd int) (err error) { - _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) +func Fstat(fd int, stat *Stat_t) (err error) { + _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } @@ -847,8 +696,33 @@ func Fsync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Ftruncate(fd int, length int64) (err error) { - _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) +func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatfs(fd int, stat *Statfs_t) (err error) { + _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := Syscall(SYS_FSYNC, uintptr(fd), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -857,9 +731,11 @@ func Ftruncate(fd int, length int64) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Getdtablesize() (size int) { - r0, _, _ := Syscall(SYS_GETDTABLESIZE, 0, 0, 0) - size = int(r0) +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := Syscall(SYS_FTRUNCATE, uintptr(fd), 0, uintptr(length)) + if e1 != 0 { + err = errnoErr(e1) + } return } @@ -945,6 +821,17 @@ func Getrlimit(which int, lim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Getrtable() (rtable int, err error) { + r0, _, e1 := RawSyscall(SYS_GETRTABLE, 0, 0, 0) + rtable = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Getrusage(who int, rusage *Rusage) (err error) { _, _, e1 := RawSyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) if e1 != 0 { @@ -966,8 +853,8 @@ func Getsid(pid int) (sid int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Gettimeofday(tp *Timeval) (err error) { - _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tp)), 0, 0) +func Gettimeofday(tv *Timeval) (err error) { + _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -985,13 +872,23 @@ func Getuid() (uid int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Issetugid() (tainted bool) { - r0, _, _ := RawSyscall(SYS_ISSETUGID, 0, 0, 0) + r0, _, _ := Syscall(SYS_ISSETUGID, 0, 0, 0) tainted = bool(r0 != 0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Kill(pid int, signum syscall.Signal) (err error) { + _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Kqueue() (fd int, err error) { r0, _, e1 := Syscall(SYS_KQUEUE, 0, 0, 0) fd = int(r0) @@ -1068,6 +965,21 @@ func Listen(s int, backlog int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Lstat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Mkdir(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1113,6 +1025,21 @@ func Mkfifo(path string, mode uint32) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mkfifoat(dirfd int, path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_MKFIFOAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Mknod(path string, mode uint32, dev int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1128,6 +1055,31 @@ func Mknod(path string, mode uint32, dev int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Mknodat(dirfd int, path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MKNODAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Nanosleep(time *Timespec, leftover *Timespec) (err error) { + _, _, e1 := Syscall(SYS_NANOSLEEP, uintptr(unsafe.Pointer(time)), uintptr(unsafe.Pointer(leftover)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Open(path string, mode int, perm uint32) (fd int, err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1183,7 +1135,7 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1200,7 +1152,7 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { } else { _p0 = unsafe.Pointer(&_zero) } - r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), 0, uintptr(offset), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) @@ -1342,7 +1294,7 @@ func Rmdir(path string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { - r0, _, e1 := Syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) + r0, _, e1 := Syscall6(SYS_LSEEK, uintptr(fd), 0, uintptr(offset), uintptr(whence), 0, 0) newoffset = int64(r0) if e1 != 0 { err = errnoErr(e1) @@ -1364,7 +1316,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Setegid(egid int) (err error) { - _, _, e1 := Syscall(SYS_SETEGID, uintptr(egid), 0, 0) + _, _, e1 := RawSyscall(SYS_SETEGID, uintptr(egid), 0, 0) if e1 != 0 { err = errnoErr(e1) } @@ -1428,8 +1380,8 @@ func Setpriority(which int, who int, prio int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setprivexec(flag int) (err error) { - _, _, e1 := Syscall(SYS_SETPRIVEXEC, uintptr(flag), 0, 0) +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) if e1 != 0 { err = errnoErr(e1) } @@ -1438,8 +1390,8 @@ func Setprivexec(flag int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setregid(rgid int, egid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) if e1 != 0 { err = errnoErr(e1) } @@ -1448,8 +1400,18 @@ func Setregid(rgid int, egid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Setreuid(ruid int, euid int) (err error) { - _, _, e1 := RawSyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) +func Setresgid(rgid int, egid int, sgid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESGID, uintptr(rgid), uintptr(egid), uintptr(sgid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setresuid(ruid int, euid int, suid int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRESUID, uintptr(ruid), uintptr(euid), uintptr(suid)) if e1 != 0 { err = errnoErr(e1) } @@ -1468,6 +1430,16 @@ func Setrlimit(which int, lim *Rlimit) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Setrtable(rtable int) (err error) { + _, _, e1 := RawSyscall(SYS_SETRTABLE, uintptr(rtable), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Setsid() (pid int, err error) { r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0) pid = int(r0) @@ -1499,6 +1471,36 @@ func Setuid(uid int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Stat(path string, stat *Stat_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Statfs(path string, stat *Statfs_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Symlink(path string, link string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1555,7 +1557,7 @@ func Truncate(path string, length int64) (err error) { if err != nil { return } - _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + _, _, e1 := Syscall(SYS_TRUNCATE, uintptr(unsafe.Pointer(_p0)), 0, uintptr(length)) if e1 != 0 { err = errnoErr(e1) } @@ -1572,21 +1574,6 @@ func Umask(newmask int) (oldmask int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Undelete(path string) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_UNDELETE, uintptr(unsafe.Pointer(_p0)), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Unlink(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -1650,7 +1637,7 @@ func write(fd int, p []byte) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := Syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + r0, _, e1 := Syscall9(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) ret = uintptr(r0) if e1 != 0 { err = errnoErr(e1) @@ -1692,89 +1679,13 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) { +func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } - _, _, e1 := Syscall6(SYS_FSTATAT, uintptr(fd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Fstatfs(fd int, stat *Statfs_t) (err error) { - _, _, e1 := Syscall(SYS_FSTATFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) { - r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(buf), uintptr(size), uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Lstat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_LSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Stat(path string, stat *Stat_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func Statfs(path string, stat *Statfs_t) (err error) { - var _p0 *byte - _p0, err = BytePtrFromString(path) - if err != nil { - return - } - _, _, e1 := Syscall(SYS_STATFS, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + _, _, e1 := Syscall6(SYS_UTIMENSAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index a96165d4bf..b5f926cee2 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -1,6 +1,7 @@ // go run mksyscall_solaris.go -tags solaris,amd64 syscall_solaris.go syscall_solaris_amd64.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build solaris && amd64 // +build solaris,amd64 package unix @@ -11,6 +12,7 @@ import ( ) //go:cgo_import_dynamic libc_pipe pipe "libc.so" +//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so" //go:cgo_import_dynamic libc_getsockname getsockname "libsocket.so" //go:cgo_import_dynamic libc_getcwd getcwd "libc.so" //go:cgo_import_dynamic libc_getgroups getgroups "libc.so" @@ -114,6 +116,7 @@ import ( //go:cgo_import_dynamic libc_statvfs statvfs "libc.so" //go:cgo_import_dynamic libc_symlink symlink "libc.so" //go:cgo_import_dynamic libc_sync sync "libc.so" +//go:cgo_import_dynamic libc_sysconf sysconf "libc.so" //go:cgo_import_dynamic libc_times times "libc.so" //go:cgo_import_dynamic libc_truncate truncate "libc.so" //go:cgo_import_dynamic libc_fsync fsync "libc.so" @@ -138,8 +141,14 @@ import ( //go:cgo_import_dynamic libc_getpeername getpeername "libsocket.so" //go:cgo_import_dynamic libc_setsockopt setsockopt "libsocket.so" //go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so" +//go:cgo_import_dynamic libc_port_create port_create "libc.so" +//go:cgo_import_dynamic libc_port_associate port_associate "libc.so" +//go:cgo_import_dynamic libc_port_dissociate port_dissociate "libc.so" +//go:cgo_import_dynamic libc_port_get port_get "libc.so" +//go:cgo_import_dynamic libc_port_getn port_getn "libc.so" //go:linkname procpipe libc_pipe +//go:linkname procpipe2 libc_pipe2 //go:linkname procgetsockname libc_getsockname //go:linkname procGetcwd libc_getcwd //go:linkname procgetgroups libc_getgroups @@ -243,6 +252,7 @@ import ( //go:linkname procStatvfs libc_statvfs //go:linkname procSymlink libc_symlink //go:linkname procSync libc_sync +//go:linkname procSysconf libc_sysconf //go:linkname procTimes libc_times //go:linkname procTruncate libc_truncate //go:linkname procFsync libc_fsync @@ -267,9 +277,15 @@ import ( //go:linkname procgetpeername libc_getpeername //go:linkname procsetsockopt libc_setsockopt //go:linkname procrecvfrom libc_recvfrom +//go:linkname procport_create libc_port_create +//go:linkname procport_associate libc_port_associate +//go:linkname procport_dissociate libc_port_dissociate +//go:linkname procport_get libc_port_get +//go:linkname procport_getn libc_port_getn var ( procpipe, + procpipe2, procgetsockname, procGetcwd, procgetgroups, @@ -373,6 +389,7 @@ var ( procStatvfs, procSymlink, procSync, + procSysconf, procTimes, procTruncate, procFsync, @@ -396,7 +413,12 @@ var ( proc__xnet_getsockopt, procgetpeername, procsetsockopt, - procrecvfrom syscallFunc + procrecvfrom, + procport_create, + procport_associate, + procport_dissociate, + procport_get, + procport_getn syscallFunc ) // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT @@ -412,6 +434,16 @@ func pipe(p *[2]_C_int) (n int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pipe2(p *[2]_C_int, flags int) (err error) { + _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0, 0, 0, 0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0) if e1 != 0 { @@ -602,8 +634,9 @@ func __minor(version int, dev uint64) (val uint) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func ioctl(fd int, req uint, arg uintptr) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) +func ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0) + ret = int(r0) if e1 != 0 { err = e1 } @@ -1674,6 +1707,17 @@ func Sync() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Sysconf(which int) (n int64, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSysconf)), 1, uintptr(which), 0, 0, 0, 0, 0) + n = int64(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Times(tms *Tms) (ticks uintptr, err error) { r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0) ticks = uintptr(r0) @@ -1952,3 +1996,58 @@ func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Sockl } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_create() (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_create)), 0, 0, 0, 0, 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_associate(port int, source int, object uintptr, events int, user *byte) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_associate)), 5, uintptr(port), uintptr(source), uintptr(object), uintptr(events), uintptr(unsafe.Pointer(user)), 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_dissociate(port int, source int, object uintptr) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_dissociate)), 3, uintptr(port), uintptr(source), uintptr(object), 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_get(port int, pe *portEvent, timeout *Timespec) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_get)), 3, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(unsafe.Pointer(timeout)), 0, 0, 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func port_getn(port int, pe *portEvent, max uint32, nget *uint32, timeout *Timespec) (n int, err error) { + r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procport_getn)), 5, uintptr(port), uintptr(unsafe.Pointer(pe)), uintptr(max), uintptr(unsafe.Pointer(nget)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = e1 + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go new file mode 100644 index 0000000000..f2079457c6 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go @@ -0,0 +1,1255 @@ +// go run mksyscall.go -tags zos,s390x syscall_zos_s390x.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +import ( + "unsafe" +) + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fcntl(fd int, cmd int, arg int) (val int, err error) { + r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + val = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func read(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func readlen(fd int, buf *byte, nbuf int) (n int, err error) { + r0, _, e1 := syscall_syscall(SYS_READ, uintptr(fd), uintptr(unsafe.Pointer(buf)), uintptr(nbuf)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func write(fd int, p []byte) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(SYS_WRITE, uintptr(fd), uintptr(_p0), uintptr(len(p))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) { + r0, _, e1 := syscall_syscall(SYS___ACCEPT_A, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := syscall_syscall(SYS___BIND_A, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) { + _, _, e1 := syscall_syscall(SYS___CONNECT_A, uintptr(s), uintptr(addr), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getgroups(n int, list *_Gid_t) (nn int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_GETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + nn = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setgroups(n int, list *_Gid_t) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETGROUPS, uintptr(n), uintptr(unsafe.Pointer(list)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) { + _, _, e1 := syscall_syscall6(SYS_GETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(unsafe.Pointer(vallen)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) { + _, _, e1 := syscall_syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socket(domain int, typ int, proto int) (fd int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_SOCKET, uintptr(domain), uintptr(typ), uintptr(proto)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) { + _, _, e1 := syscall_rawsyscall6(SYS_SOCKETPAIR, uintptr(domain), uintptr(typ), uintptr(proto), uintptr(unsafe.Pointer(fd)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := syscall_rawsyscall(SYS___GETPEERNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) { + _, _, e1 := syscall_rawsyscall(SYS___GETSOCKNAME_A, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(SYS___RECVFROM_A, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall6(SYS___SENDTO_A, uintptr(s), uintptr(_p0), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(addrlen)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func recvmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(SYS___RECVMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (n int, err error) { + r0, _, e1 := syscall_syscall(SYS___SENDMSG_A, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall6(SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func munmap(addr uintptr, length uintptr) (err error) { + _, _, e1 := syscall_syscall(SYS_MUNMAP, uintptr(addr), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func ioctl(fd int, req uint, arg uintptr) (err error) { + _, _, e1 := syscall_syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Access(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___ACCESS_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___CHDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___CHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chmod(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___CHMOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Creat(path string, mode uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall(SYS___CREAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup(oldfd int) (fd int, err error) { + r0, _, e1 := syscall_syscall(SYS_DUP, uintptr(oldfd), 0, 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Dup2(oldfd int, newfd int) (err error) { + _, _, e1 := syscall_syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Errno2() (er2 int) { + uer2, _, _ := syscall_syscall(SYS___ERRNO2, 0, 0, 0) + er2 = int(uer2) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Err2ad() (eadd *int) { + ueadd, _, _ := syscall_syscall(SYS___ERR2AD, 0, 0, 0) + eadd = (*int)(unsafe.Pointer(ueadd)) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Exit(code int) { + syscall_syscall(SYS_EXIT, uintptr(code), 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchdir(fd int) (err error) { + _, _, e1 := syscall_syscall(SYS_FCHDIR, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchmod(fd int, mode uint32) (err error) { + _, _, e1 := syscall_syscall(SYS_FCHMOD, uintptr(fd), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fchown(fd int, uid int, gid int) (err error) { + _, _, e1 := syscall_syscall(SYS_FCHOWN, uintptr(fd), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func FcntlInt(fd uintptr, cmd int, arg int) (retval int, err error) { + r0, _, e1 := syscall_syscall(SYS_FCNTL, uintptr(fd), uintptr(cmd), uintptr(arg)) + retval = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func fstat(fd int, stat *Stat_LE_t) (err error) { + _, _, e1 := syscall_syscall(SYS_FSTAT, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fstatvfs(fd int, stat *Statvfs_t) (err error) { + _, _, e1 := syscall_syscall(SYS_FSTATVFS, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Fsync(fd int) (err error) { + _, _, e1 := syscall_syscall(SYS_FSYNC, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Ftruncate(fd int, length int64) (err error) { + _, _, e1 := syscall_syscall(SYS_FTRUNCATE, uintptr(fd), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpagesize() (pgsize int) { + r0, _, _ := syscall_syscall(SYS_GETPAGESIZE, 0, 0, 0) + pgsize = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mprotect(b []byte, prot int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Msync(b []byte, flags int) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Poll(fds []PollFd, timeout int) (n int, err error) { + var _p0 unsafe.Pointer + if len(fds) > 0 { + _p0 = unsafe.Pointer(&fds[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(SYS_POLL, uintptr(_p0), uintptr(len(fds)), uintptr(timeout)) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Times(tms *Tms) (ticks uintptr, err error) { + r0, _, e1 := syscall_syscall(SYS_TIMES, uintptr(unsafe.Pointer(tms)), 0, 0) + ticks = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func W_Getmntent(buff *byte, size int) (lastsys int, err error) { + r0, _, e1 := syscall_syscall(SYS_W_GETMNTENT, uintptr(unsafe.Pointer(buff)), uintptr(size), 0) + lastsys = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func W_Getmntent_A(buff *byte, size int) (lastsys int, err error) { + r0, _, e1 := syscall_syscall(SYS___W_GETMNTENT_A, uintptr(unsafe.Pointer(buff)), uintptr(size), 0) + lastsys = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func mount_LE(path string, filesystem string, fstype string, mtm uint32, parmlen int32, parm string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(filesystem) + if err != nil { + return + } + var _p2 *byte + _p2, err = BytePtrFromString(fstype) + if err != nil { + return + } + var _p3 *byte + _p3, err = BytePtrFromString(parm) + if err != nil { + return + } + _, _, e1 := syscall_syscall6(SYS___MOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(mtm), uintptr(parmlen), uintptr(unsafe.Pointer(_p3))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func unmount(filesystem string, mtm int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(filesystem) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___UMOUNT_A, uintptr(unsafe.Pointer(_p0)), uintptr(mtm), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Chroot(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___CHROOT_A, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Uname(buf *Utsname) (err error) { + _, _, e1 := syscall_rawsyscall(SYS___UNAME_A, uintptr(unsafe.Pointer(buf)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Gethostname(buf []byte) (err error) { + var _p0 unsafe.Pointer + if len(buf) > 0 { + _p0 = unsafe.Pointer(&buf[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + _, _, e1 := syscall_syscall(SYS___GETHOSTNAME_A, uintptr(_p0), uintptr(len(buf)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getegid() (egid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETEGID, 0, 0, 0) + egid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Geteuid() (uid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETEUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getgid() (gid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETGID, 0, 0, 0) + gid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpid() (pid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpgid(pid int) (pgid int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_GETPGID, uintptr(pid), 0, 0) + pgid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getppid() (pid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETPPID, 0, 0, 0) + pid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getpriority(which int, who int) (prio int, err error) { + r0, _, e1 := syscall_syscall(SYS_GETPRIORITY, uintptr(which), uintptr(who), 0) + prio = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getrlimit(resource int, rlim *Rlimit) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func getrusage(who int, rusage *rusage_zos) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_GETRUSAGE, uintptr(who), uintptr(unsafe.Pointer(rusage)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getsid(pid int) (sid int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_GETSID, uintptr(pid), 0, 0) + sid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Getuid() (uid int) { + r0, _, _ := syscall_rawsyscall(SYS_GETUID, 0, 0, 0) + uid = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Kill(pid int, sig Signal) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_KILL, uintptr(pid), uintptr(sig), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Lchown(path string, uid int, gid int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___LCHOWN_A, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Link(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___LINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Listen(s int, n int) (err error) { + _, _, e1 := syscall_syscall(SYS_LISTEN, uintptr(s), uintptr(n), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func lstat(path string, stat *Stat_LE_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___LSTAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkdir(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___MKDIR_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mkfifo(path string, mode uint32) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___MKFIFO_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Mknod(path string, mode uint32, dev int) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___MKNOD_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(dev)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pread(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Pwrite(fd int, p []byte, offset int64) (n int, err error) { + var _p0 unsafe.Pointer + if len(p) > 0 { + _p0 = unsafe.Pointer(&p[0]) + } else { + _p0 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), 0, 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Readlink(path string, buf []byte) (n int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 unsafe.Pointer + if len(buf) > 0 { + _p1 = unsafe.Pointer(&buf[0]) + } else { + _p1 = unsafe.Pointer(&_zero) + } + r0, _, e1 := syscall_syscall(SYS___READLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(buf))) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rename(from string, to string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(from) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(to) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___RENAME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Rmdir(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___RMDIR_A, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Seek(fd int, offset int64, whence int) (off int64, err error) { + r0, _, e1 := syscall_syscall(SYS_LSEEK, uintptr(fd), uintptr(offset), uintptr(whence)) + off = int64(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpriority(which int, who int, prio int) (err error) { + _, _, e1 := syscall_syscall(SYS_SETPRIORITY, uintptr(which), uintptr(who), uintptr(prio)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setpgid(pid int, pgid int) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETPGID, uintptr(pid), uintptr(pgid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setrlimit(resource int, lim *Rlimit) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(lim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setregid(rgid int, egid int) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETREGID, uintptr(rgid), uintptr(egid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setreuid(ruid int, euid int) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_SETREUID, uintptr(ruid), uintptr(euid), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setsid() (pid int, err error) { + r0, _, e1 := syscall_rawsyscall(SYS_SETSID, 0, 0, 0) + pid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setuid(uid int) (err error) { + _, _, e1 := syscall_syscall(SYS_SETUID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Setgid(uid int) (err error) { + _, _, e1 := syscall_syscall(SYS_SETGID, uintptr(uid), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Shutdown(fd int, how int) (err error) { + _, _, e1 := syscall_syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func stat(path string, statLE *Stat_LE_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___STAT_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(statLE)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Symlink(path string, link string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + var _p1 *byte + _p1, err = BytePtrFromString(link) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___SYMLINK_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Sync() { + syscall_syscall(SYS_SYNC, 0, 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Truncate(path string, length int64) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___TRUNCATE_A, uintptr(unsafe.Pointer(_p0)), uintptr(length), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tcgetattr(fildes int, termptr *Termios) (err error) { + _, _, e1 := syscall_syscall(SYS_TCGETATTR, uintptr(fildes), uintptr(unsafe.Pointer(termptr)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Tcsetattr(fildes int, when int, termptr *Termios) (err error) { + _, _, e1 := syscall_syscall(SYS_TCSETATTR, uintptr(fildes), uintptr(when), uintptr(unsafe.Pointer(termptr))) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Umask(mask int) (oldmask int) { + r0, _, _ := syscall_syscall(SYS_UMASK, uintptr(mask), 0, 0) + oldmask = int(r0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Unlink(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___UNLINK_A, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Utime(path string, utim *Utimbuf) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___UTIME_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(utim)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func open(path string, mode int, perm uint32) (fd int, err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + r0, _, e1 := syscall_syscall(SYS___OPEN_A, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func remove(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func waitpid(pid int, wstatus *_C_int, options int) (wpid int, err error) { + r0, _, e1 := syscall_syscall(SYS_WAITPID, uintptr(pid), uintptr(unsafe.Pointer(wstatus)), uintptr(options)) + wpid = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func gettimeofday(tv *timeval_zos) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pipe(p *[2]_C_int) (err error) { + _, _, e1 := syscall_rawsyscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func utimes(path string, timeval *[2]Timeval) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(SYS___UTIMES_A, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(timeval)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func Select(nmsgsfds int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (ret int, err error) { + r0, _, e1 := syscall_syscall6(SYS_SELECT, uintptr(nmsgsfds), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + ret = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go index 102f1ab475..9e9d0b2a9c 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build 386 && openbsd // +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go index 4866fced8a..adecd09667 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build amd64 && openbsd // +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go index d3801eb24b..8ea52a4a18 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build arm && openbsd // +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go index ba4304fd23..154b57ae3e 100644 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksysctl_openbsd.go // Code generated by the command above; DO NOT EDIT. +//go:build arm64 && openbsd // +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go new file mode 100644 index 0000000000..d96bb2ba4d --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go @@ -0,0 +1,280 @@ +// go run mksysctl_openbsd.go +// Code generated by the command above; DO NOT EDIT. + +//go:build mips64 && openbsd +// +build mips64,openbsd + +package unix + +type mibentry struct { + ctlname string + ctloid []_C_int +} + +var sysctlMib = []mibentry{ + {"ddb.console", []_C_int{9, 6}}, + {"ddb.log", []_C_int{9, 7}}, + {"ddb.max_line", []_C_int{9, 3}}, + {"ddb.max_width", []_C_int{9, 2}}, + {"ddb.panic", []_C_int{9, 5}}, + {"ddb.profile", []_C_int{9, 9}}, + {"ddb.radix", []_C_int{9, 1}}, + {"ddb.tab_stop_width", []_C_int{9, 4}}, + {"ddb.trigger", []_C_int{9, 8}}, + {"fs.posix.setuid", []_C_int{3, 1, 1}}, + {"hw.allowpowerdown", []_C_int{6, 22}}, + {"hw.byteorder", []_C_int{6, 4}}, + {"hw.cpuspeed", []_C_int{6, 12}}, + {"hw.diskcount", []_C_int{6, 10}}, + {"hw.disknames", []_C_int{6, 8}}, + {"hw.diskstats", []_C_int{6, 9}}, + {"hw.machine", []_C_int{6, 1}}, + {"hw.model", []_C_int{6, 2}}, + {"hw.ncpu", []_C_int{6, 3}}, + {"hw.ncpufound", []_C_int{6, 21}}, + {"hw.ncpuonline", []_C_int{6, 25}}, + {"hw.pagesize", []_C_int{6, 7}}, + {"hw.perfpolicy", []_C_int{6, 23}}, + {"hw.physmem", []_C_int{6, 19}}, + {"hw.product", []_C_int{6, 15}}, + {"hw.serialno", []_C_int{6, 17}}, + {"hw.setperf", []_C_int{6, 13}}, + {"hw.smt", []_C_int{6, 24}}, + {"hw.usermem", []_C_int{6, 20}}, + {"hw.uuid", []_C_int{6, 18}}, + {"hw.vendor", []_C_int{6, 14}}, + {"hw.version", []_C_int{6, 16}}, + {"kern.allowdt", []_C_int{1, 65}}, + {"kern.allowkmem", []_C_int{1, 52}}, + {"kern.argmax", []_C_int{1, 8}}, + {"kern.audio", []_C_int{1, 84}}, + {"kern.boottime", []_C_int{1, 21}}, + {"kern.bufcachepercent", []_C_int{1, 72}}, + {"kern.ccpu", []_C_int{1, 45}}, + {"kern.clockrate", []_C_int{1, 12}}, + {"kern.consbuf", []_C_int{1, 83}}, + {"kern.consbufsize", []_C_int{1, 82}}, + {"kern.consdev", []_C_int{1, 75}}, + {"kern.cp_time", []_C_int{1, 40}}, + {"kern.cp_time2", []_C_int{1, 71}}, + {"kern.cpustats", []_C_int{1, 85}}, + {"kern.domainname", []_C_int{1, 22}}, + {"kern.file", []_C_int{1, 73}}, + {"kern.forkstat", []_C_int{1, 42}}, + {"kern.fscale", []_C_int{1, 46}}, + {"kern.fsync", []_C_int{1, 33}}, + {"kern.global_ptrace", []_C_int{1, 81}}, + {"kern.hostid", []_C_int{1, 11}}, + {"kern.hostname", []_C_int{1, 10}}, + {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, + {"kern.job_control", []_C_int{1, 19}}, + {"kern.malloc.buckets", []_C_int{1, 39, 1}}, + {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, + {"kern.maxclusters", []_C_int{1, 67}}, + {"kern.maxfiles", []_C_int{1, 7}}, + {"kern.maxlocksperuid", []_C_int{1, 70}}, + {"kern.maxpartitions", []_C_int{1, 23}}, + {"kern.maxproc", []_C_int{1, 6}}, + {"kern.maxthread", []_C_int{1, 25}}, + {"kern.maxvnodes", []_C_int{1, 5}}, + {"kern.mbstat", []_C_int{1, 59}}, + {"kern.msgbuf", []_C_int{1, 48}}, + {"kern.msgbufsize", []_C_int{1, 38}}, + {"kern.nchstats", []_C_int{1, 41}}, + {"kern.netlivelocks", []_C_int{1, 76}}, + {"kern.nfiles", []_C_int{1, 56}}, + {"kern.ngroups", []_C_int{1, 18}}, + {"kern.nosuidcoredump", []_C_int{1, 32}}, + {"kern.nprocs", []_C_int{1, 47}}, + {"kern.nselcoll", []_C_int{1, 43}}, + {"kern.nthreads", []_C_int{1, 26}}, + {"kern.numvnodes", []_C_int{1, 58}}, + {"kern.osrelease", []_C_int{1, 2}}, + {"kern.osrevision", []_C_int{1, 3}}, + {"kern.ostype", []_C_int{1, 1}}, + {"kern.osversion", []_C_int{1, 27}}, + {"kern.pfstatus", []_C_int{1, 86}}, + {"kern.pool_debug", []_C_int{1, 77}}, + {"kern.posix1version", []_C_int{1, 17}}, + {"kern.proc", []_C_int{1, 66}}, + {"kern.rawpartition", []_C_int{1, 24}}, + {"kern.saved_ids", []_C_int{1, 20}}, + {"kern.securelevel", []_C_int{1, 9}}, + {"kern.seminfo", []_C_int{1, 61}}, + {"kern.shminfo", []_C_int{1, 62}}, + {"kern.somaxconn", []_C_int{1, 28}}, + {"kern.sominconn", []_C_int{1, 29}}, + {"kern.splassert", []_C_int{1, 54}}, + {"kern.stackgap_random", []_C_int{1, 50}}, + {"kern.sysvipc_info", []_C_int{1, 51}}, + {"kern.sysvmsg", []_C_int{1, 34}}, + {"kern.sysvsem", []_C_int{1, 35}}, + {"kern.sysvshm", []_C_int{1, 36}}, + {"kern.timecounter.choice", []_C_int{1, 69, 4}}, + {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, + {"kern.timecounter.tick", []_C_int{1, 69, 1}}, + {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, + {"kern.timeout_stats", []_C_int{1, 87}}, + {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, + {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, + {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, + {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, + {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, + {"kern.ttycount", []_C_int{1, 57}}, + {"kern.utc_offset", []_C_int{1, 88}}, + {"kern.version", []_C_int{1, 4}}, + {"kern.watchdog.auto", []_C_int{1, 64, 2}}, + {"kern.watchdog.period", []_C_int{1, 64, 1}}, + {"kern.witnesswatch", []_C_int{1, 53}}, + {"kern.wxabort", []_C_int{1, 74}}, + {"net.bpf.bufsize", []_C_int{4, 31, 1}}, + {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, + {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, + {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, + {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, + {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, + {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, + {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, + {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, + {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, + {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, + {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, + {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, + {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, + {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, + {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, + {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, + {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, + {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, + {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, + {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, + {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, + {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, + {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, + {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, + {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, + {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, + {"net.inet.ip.arpdown", []_C_int{4, 2, 0, 40}}, + {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, + {"net.inet.ip.arptimeout", []_C_int{4, 2, 0, 39}}, + {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, + {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, + {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, + {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, + {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, + {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, + {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, + {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, + {"net.inet.ip.mrtmfc", []_C_int{4, 2, 0, 37}}, + {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, + {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, + {"net.inet.ip.mrtvif", []_C_int{4, 2, 0, 38}}, + {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, + {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, + {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, + {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, + {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, + {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, + {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, + {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, + {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, + {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, + {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, + {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, + {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, + {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, + {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, + {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, + {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, + {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, + {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, + {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, + {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, + {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, + {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, + {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, + {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, + {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, + {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, + {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, + {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, + {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, + {"net.inet.tcp.rootonly", []_C_int{4, 2, 6, 24}}, + {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, + {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, + {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, + {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, + {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, + {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, + {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, + {"net.inet.tcp.synhashsize", []_C_int{4, 2, 6, 25}}, + {"net.inet.tcp.synuselimit", []_C_int{4, 2, 6, 23}}, + {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, + {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, + {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, + {"net.inet.udp.rootonly", []_C_int{4, 2, 17, 6}}, + {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, + {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, + {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, + {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, + {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, + {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, + {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, + {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, + {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, + {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, + {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, + {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, + {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, + {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, + {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, + {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, + {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, + {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, + {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, + {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, + {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, + {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, + {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, + {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, + {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, + {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, + {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, + {"net.inet6.ip6.mrtmfc", []_C_int{4, 24, 17, 53}}, + {"net.inet6.ip6.mrtmif", []_C_int{4, 24, 17, 52}}, + {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, + {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, + {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, + {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, + {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, + {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, + {"net.inet6.ip6.soiikey", []_C_int{4, 24, 17, 54}}, + {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, + {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, + {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, + {"net.key.sadb_dump", []_C_int{4, 30, 1}}, + {"net.key.spd_dump", []_C_int{4, 30, 2}}, + {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, + {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, + {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, + {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, + {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, + {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, + {"net.mpls.ttl", []_C_int{4, 33, 2}}, + {"net.pflow.stats", []_C_int{4, 34, 1}}, + {"net.pipex.enable", []_C_int{4, 35, 1}}, + {"vm.anonmin", []_C_int{2, 7}}, + {"vm.loadavg", []_C_int{2, 2}}, + {"vm.malloc_conf", []_C_int{2, 12}}, + {"vm.maxslp", []_C_int{2, 10}}, + {"vm.nkmempages", []_C_int{2, 6}}, + {"vm.psstrings", []_C_int{2, 3}}, + {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, + {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, + {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, + {"vm.uspace", []_C_int{2, 11}}, + {"vm.uvmexp", []_C_int{2, 4}}, + {"vm.vmmeter", []_C_int{2, 1}}, + {"vm.vnodemin", []_C_int{2, 9}}, + {"vm.vtextmin", []_C_int{2, 8}}, +} diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go deleted file mode 100644 index f33614532f..0000000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go +++ /dev/null @@ -1,436 +0,0 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/sys/syscall.h -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build 386,darwin - -package unix - -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TYPEFILTER = 177 - SYS_KDEBUG_TRACE_STRING = 178 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_THREAD_SELFCOUNTS = 186 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS_KEVENT_QOS = 374 - SYS_KEVENT_ID = 375 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS_PSELECT = 394 - SYS_PSELECT_NOCANCEL = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_USRCTL = 445 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_CLONEFILEAT = 462 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAMEATX_NP = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_NETAGENT_TRIGGER = 490 - SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 - SYS_MICROSTACKSHOT = 492 - SYS_GRAB_PGO_DATA = 493 - SYS_PERSONA = 494 - SYS_WORK_INTERVAL_CTL = 499 - SYS_GETENTROPY = 500 - SYS_NECP_OPEN = 501 - SYS_NECP_CLIENT_ACTION = 502 - SYS___NEXUS_OPEN = 503 - SYS___NEXUS_REGISTER = 504 - SYS___NEXUS_DEREGISTER = 505 - SYS___NEXUS_CREATE = 506 - SYS___NEXUS_DESTROY = 507 - SYS___NEXUS_GET_OPT = 508 - SYS___NEXUS_SET_OPT = 509 - SYS___CHANNEL_OPEN = 510 - SYS___CHANNEL_GET_INFO = 511 - SYS___CHANNEL_SYNC = 512 - SYS___CHANNEL_GET_OPT = 513 - SYS___CHANNEL_SET_OPT = 514 - SYS_ULOCK_WAIT = 515 - SYS_ULOCK_WAKE = 516 - SYS_FCLONEFILEAT = 517 - SYS_FS_SNAPSHOT = 518 - SYS_TERMINATE_WITH_PAYLOAD = 520 - SYS_ABORT_WITH_PAYLOAD = 521 - SYS_NECP_SESSION_OPEN = 522 - SYS_NECP_SESSION_ACTION = 523 - SYS_SETATTRLISTAT = 524 - SYS_NET_QOS_GUIDELINE = 525 - SYS_FMOUNT = 526 - SYS_NTP_ADJTIME = 527 - SYS_NTP_GETTIME = 528 - SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_MAXSYSCALL = 530 - SYS_INVALID = 63 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go index 654dd3da3b..f8298ff9b5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go @@ -1,10 +1,12 @@ // go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && darwin // +build amd64,darwin package unix +// Deprecated: Use libSystem wrappers instead of direct syscalls. const ( SYS_SYSCALL = 0 SYS_EXIT = 1 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go deleted file mode 100644 index 103a72ed1c..0000000000 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go +++ /dev/null @@ -1,436 +0,0 @@ -// go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build arm,darwin - -package unix - -const ( - SYS_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_CHDIR = 12 - SYS_FCHDIR = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_CHOWN = 16 - SYS_GETFSSTAT = 18 - SYS_GETPID = 20 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_GETEUID = 25 - SYS_PTRACE = 26 - SYS_RECVMSG = 27 - SYS_SENDMSG = 28 - SYS_RECVFROM = 29 - SYS_ACCEPT = 30 - SYS_GETPEERNAME = 31 - SYS_GETSOCKNAME = 32 - SYS_ACCESS = 33 - SYS_CHFLAGS = 34 - SYS_FCHFLAGS = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_GETPPID = 39 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_GETEGID = 43 - SYS_SIGACTION = 46 - SYS_GETGID = 47 - SYS_SIGPROCMASK = 48 - SYS_GETLOGIN = 49 - SYS_SETLOGIN = 50 - SYS_ACCT = 51 - SYS_SIGPENDING = 52 - SYS_SIGALTSTACK = 53 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_REVOKE = 56 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETPGID = 82 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_GETDTABLESIZE = 89 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_GETPRIORITY = 100 - SYS_BIND = 104 - SYS_SETSOCKOPT = 105 - SYS_LISTEN = 106 - SYS_SIGSUSPEND = 111 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_FLOCK = 131 - SYS_MKFIFO = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_FUTIMES = 139 - SYS_ADJTIME = 140 - SYS_GETHOSTUUID = 142 - SYS_SETSID = 147 - SYS_GETPGID = 151 - SYS_SETPRIVEXEC = 152 - SYS_PREAD = 153 - SYS_PWRITE = 154 - SYS_NFSSVC = 155 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UNMOUNT = 159 - SYS_GETFH = 161 - SYS_QUOTACTL = 165 - SYS_MOUNT = 167 - SYS_CSOPS = 169 - SYS_CSOPS_AUDITTOKEN = 170 - SYS_WAITID = 173 - SYS_KDEBUG_TYPEFILTER = 177 - SYS_KDEBUG_TRACE_STRING = 178 - SYS_KDEBUG_TRACE64 = 179 - SYS_KDEBUG_TRACE = 180 - SYS_SETGID = 181 - SYS_SETEGID = 182 - SYS_SETEUID = 183 - SYS_SIGRETURN = 184 - SYS_THREAD_SELFCOUNTS = 186 - SYS_FDATASYNC = 187 - SYS_STAT = 188 - SYS_FSTAT = 189 - SYS_LSTAT = 190 - SYS_PATHCONF = 191 - SYS_FPATHCONF = 192 - SYS_GETRLIMIT = 194 - SYS_SETRLIMIT = 195 - SYS_GETDIRENTRIES = 196 - SYS_MMAP = 197 - SYS_LSEEK = 199 - SYS_TRUNCATE = 200 - SYS_FTRUNCATE = 201 - SYS_SYSCTL = 202 - SYS_MLOCK = 203 - SYS_MUNLOCK = 204 - SYS_UNDELETE = 205 - SYS_OPEN_DPROTECTED_NP = 216 - SYS_GETATTRLIST = 220 - SYS_SETATTRLIST = 221 - SYS_GETDIRENTRIESATTR = 222 - SYS_EXCHANGEDATA = 223 - SYS_SEARCHFS = 225 - SYS_DELETE = 226 - SYS_COPYFILE = 227 - SYS_FGETATTRLIST = 228 - SYS_FSETATTRLIST = 229 - SYS_POLL = 230 - SYS_WATCHEVENT = 231 - SYS_WAITEVENT = 232 - SYS_MODWATCH = 233 - SYS_GETXATTR = 234 - SYS_FGETXATTR = 235 - SYS_SETXATTR = 236 - SYS_FSETXATTR = 237 - SYS_REMOVEXATTR = 238 - SYS_FREMOVEXATTR = 239 - SYS_LISTXATTR = 240 - SYS_FLISTXATTR = 241 - SYS_FSCTL = 242 - SYS_INITGROUPS = 243 - SYS_POSIX_SPAWN = 244 - SYS_FFSCTL = 245 - SYS_NFSCLNT = 247 - SYS_FHOPEN = 248 - SYS_MINHERIT = 250 - SYS_SEMSYS = 251 - SYS_MSGSYS = 252 - SYS_SHMSYS = 253 - SYS_SEMCTL = 254 - SYS_SEMGET = 255 - SYS_SEMOP = 256 - SYS_MSGCTL = 258 - SYS_MSGGET = 259 - SYS_MSGSND = 260 - SYS_MSGRCV = 261 - SYS_SHMAT = 262 - SYS_SHMCTL = 263 - SYS_SHMDT = 264 - SYS_SHMGET = 265 - SYS_SHM_OPEN = 266 - SYS_SHM_UNLINK = 267 - SYS_SEM_OPEN = 268 - SYS_SEM_CLOSE = 269 - SYS_SEM_UNLINK = 270 - SYS_SEM_WAIT = 271 - SYS_SEM_TRYWAIT = 272 - SYS_SEM_POST = 273 - SYS_SYSCTLBYNAME = 274 - SYS_OPEN_EXTENDED = 277 - SYS_UMASK_EXTENDED = 278 - SYS_STAT_EXTENDED = 279 - SYS_LSTAT_EXTENDED = 280 - SYS_FSTAT_EXTENDED = 281 - SYS_CHMOD_EXTENDED = 282 - SYS_FCHMOD_EXTENDED = 283 - SYS_ACCESS_EXTENDED = 284 - SYS_SETTID = 285 - SYS_GETTID = 286 - SYS_SETSGROUPS = 287 - SYS_GETSGROUPS = 288 - SYS_SETWGROUPS = 289 - SYS_GETWGROUPS = 290 - SYS_MKFIFO_EXTENDED = 291 - SYS_MKDIR_EXTENDED = 292 - SYS_IDENTITYSVC = 293 - SYS_SHARED_REGION_CHECK_NP = 294 - SYS_VM_PRESSURE_MONITOR = 296 - SYS_PSYNCH_RW_LONGRDLOCK = 297 - SYS_PSYNCH_RW_YIELDWRLOCK = 298 - SYS_PSYNCH_RW_DOWNGRADE = 299 - SYS_PSYNCH_RW_UPGRADE = 300 - SYS_PSYNCH_MUTEXWAIT = 301 - SYS_PSYNCH_MUTEXDROP = 302 - SYS_PSYNCH_CVBROAD = 303 - SYS_PSYNCH_CVSIGNAL = 304 - SYS_PSYNCH_CVWAIT = 305 - SYS_PSYNCH_RW_RDLOCK = 306 - SYS_PSYNCH_RW_WRLOCK = 307 - SYS_PSYNCH_RW_UNLOCK = 308 - SYS_PSYNCH_RW_UNLOCK2 = 309 - SYS_GETSID = 310 - SYS_SETTID_WITH_PID = 311 - SYS_PSYNCH_CVCLRPREPOST = 312 - SYS_AIO_FSYNC = 313 - SYS_AIO_RETURN = 314 - SYS_AIO_SUSPEND = 315 - SYS_AIO_CANCEL = 316 - SYS_AIO_ERROR = 317 - SYS_AIO_READ = 318 - SYS_AIO_WRITE = 319 - SYS_LIO_LISTIO = 320 - SYS_IOPOLICYSYS = 322 - SYS_PROCESS_POLICY = 323 - SYS_MLOCKALL = 324 - SYS_MUNLOCKALL = 325 - SYS_ISSETUGID = 327 - SYS___PTHREAD_KILL = 328 - SYS___PTHREAD_SIGMASK = 329 - SYS___SIGWAIT = 330 - SYS___DISABLE_THREADSIGNAL = 331 - SYS___PTHREAD_MARKCANCEL = 332 - SYS___PTHREAD_CANCELED = 333 - SYS___SEMWAIT_SIGNAL = 334 - SYS_PROC_INFO = 336 - SYS_SENDFILE = 337 - SYS_STAT64 = 338 - SYS_FSTAT64 = 339 - SYS_LSTAT64 = 340 - SYS_STAT64_EXTENDED = 341 - SYS_LSTAT64_EXTENDED = 342 - SYS_FSTAT64_EXTENDED = 343 - SYS_GETDIRENTRIES64 = 344 - SYS_STATFS64 = 345 - SYS_FSTATFS64 = 346 - SYS_GETFSSTAT64 = 347 - SYS___PTHREAD_CHDIR = 348 - SYS___PTHREAD_FCHDIR = 349 - SYS_AUDIT = 350 - SYS_AUDITON = 351 - SYS_GETAUID = 353 - SYS_SETAUID = 354 - SYS_GETAUDIT_ADDR = 357 - SYS_SETAUDIT_ADDR = 358 - SYS_AUDITCTL = 359 - SYS_BSDTHREAD_CREATE = 360 - SYS_BSDTHREAD_TERMINATE = 361 - SYS_KQUEUE = 362 - SYS_KEVENT = 363 - SYS_LCHOWN = 364 - SYS_BSDTHREAD_REGISTER = 366 - SYS_WORKQ_OPEN = 367 - SYS_WORKQ_KERNRETURN = 368 - SYS_KEVENT64 = 369 - SYS___OLD_SEMWAIT_SIGNAL = 370 - SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 - SYS_THREAD_SELFID = 372 - SYS_LEDGER = 373 - SYS_KEVENT_QOS = 374 - SYS_KEVENT_ID = 375 - SYS___MAC_EXECVE = 380 - SYS___MAC_SYSCALL = 381 - SYS___MAC_GET_FILE = 382 - SYS___MAC_SET_FILE = 383 - SYS___MAC_GET_LINK = 384 - SYS___MAC_SET_LINK = 385 - SYS___MAC_GET_PROC = 386 - SYS___MAC_SET_PROC = 387 - SYS___MAC_GET_FD = 388 - SYS___MAC_SET_FD = 389 - SYS___MAC_GET_PID = 390 - SYS_PSELECT = 394 - SYS_PSELECT_NOCANCEL = 395 - SYS_READ_NOCANCEL = 396 - SYS_WRITE_NOCANCEL = 397 - SYS_OPEN_NOCANCEL = 398 - SYS_CLOSE_NOCANCEL = 399 - SYS_WAIT4_NOCANCEL = 400 - SYS_RECVMSG_NOCANCEL = 401 - SYS_SENDMSG_NOCANCEL = 402 - SYS_RECVFROM_NOCANCEL = 403 - SYS_ACCEPT_NOCANCEL = 404 - SYS_MSYNC_NOCANCEL = 405 - SYS_FCNTL_NOCANCEL = 406 - SYS_SELECT_NOCANCEL = 407 - SYS_FSYNC_NOCANCEL = 408 - SYS_CONNECT_NOCANCEL = 409 - SYS_SIGSUSPEND_NOCANCEL = 410 - SYS_READV_NOCANCEL = 411 - SYS_WRITEV_NOCANCEL = 412 - SYS_SENDTO_NOCANCEL = 413 - SYS_PREAD_NOCANCEL = 414 - SYS_PWRITE_NOCANCEL = 415 - SYS_WAITID_NOCANCEL = 416 - SYS_POLL_NOCANCEL = 417 - SYS_MSGSND_NOCANCEL = 418 - SYS_MSGRCV_NOCANCEL = 419 - SYS_SEM_WAIT_NOCANCEL = 420 - SYS_AIO_SUSPEND_NOCANCEL = 421 - SYS___SIGWAIT_NOCANCEL = 422 - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 - SYS___MAC_MOUNT = 424 - SYS___MAC_GET_MOUNT = 425 - SYS___MAC_GETFSSTAT = 426 - SYS_FSGETPATH = 427 - SYS_AUDIT_SESSION_SELF = 428 - SYS_AUDIT_SESSION_JOIN = 429 - SYS_FILEPORT_MAKEPORT = 430 - SYS_FILEPORT_MAKEFD = 431 - SYS_AUDIT_SESSION_PORT = 432 - SYS_PID_SUSPEND = 433 - SYS_PID_RESUME = 434 - SYS_PID_HIBERNATE = 435 - SYS_PID_SHUTDOWN_SOCKETS = 436 - SYS_SHARED_REGION_MAP_AND_SLIDE_NP = 438 - SYS_KAS_INFO = 439 - SYS_MEMORYSTATUS_CONTROL = 440 - SYS_GUARDED_OPEN_NP = 441 - SYS_GUARDED_CLOSE_NP = 442 - SYS_GUARDED_KQUEUE_NP = 443 - SYS_CHANGE_FDGUARD_NP = 444 - SYS_USRCTL = 445 - SYS_PROC_RLIMIT_CONTROL = 446 - SYS_CONNECTX = 447 - SYS_DISCONNECTX = 448 - SYS_PEELOFF = 449 - SYS_SOCKET_DELEGATE = 450 - SYS_TELEMETRY = 451 - SYS_PROC_UUID_POLICY = 452 - SYS_MEMORYSTATUS_GET_LEVEL = 453 - SYS_SYSTEM_OVERRIDE = 454 - SYS_VFS_PURGE = 455 - SYS_SFI_CTL = 456 - SYS_SFI_PIDCTL = 457 - SYS_COALITION = 458 - SYS_COALITION_INFO = 459 - SYS_NECP_MATCH_POLICY = 460 - SYS_GETATTRLISTBULK = 461 - SYS_CLONEFILEAT = 462 - SYS_OPENAT = 463 - SYS_OPENAT_NOCANCEL = 464 - SYS_RENAMEAT = 465 - SYS_FACCESSAT = 466 - SYS_FCHMODAT = 467 - SYS_FCHOWNAT = 468 - SYS_FSTATAT = 469 - SYS_FSTATAT64 = 470 - SYS_LINKAT = 471 - SYS_UNLINKAT = 472 - SYS_READLINKAT = 473 - SYS_SYMLINKAT = 474 - SYS_MKDIRAT = 475 - SYS_GETATTRLISTAT = 476 - SYS_PROC_TRACE_LOG = 477 - SYS_BSDTHREAD_CTL = 478 - SYS_OPENBYID_NP = 479 - SYS_RECVMSG_X = 480 - SYS_SENDMSG_X = 481 - SYS_THREAD_SELFUSAGE = 482 - SYS_CSRCTL = 483 - SYS_GUARDED_OPEN_DPROTECTED_NP = 484 - SYS_GUARDED_WRITE_NP = 485 - SYS_GUARDED_PWRITE_NP = 486 - SYS_GUARDED_WRITEV_NP = 487 - SYS_RENAMEATX_NP = 488 - SYS_MREMAP_ENCRYPTED = 489 - SYS_NETAGENT_TRIGGER = 490 - SYS_STACK_SNAPSHOT_WITH_CONFIG = 491 - SYS_MICROSTACKSHOT = 492 - SYS_GRAB_PGO_DATA = 493 - SYS_PERSONA = 494 - SYS_WORK_INTERVAL_CTL = 499 - SYS_GETENTROPY = 500 - SYS_NECP_OPEN = 501 - SYS_NECP_CLIENT_ACTION = 502 - SYS___NEXUS_OPEN = 503 - SYS___NEXUS_REGISTER = 504 - SYS___NEXUS_DEREGISTER = 505 - SYS___NEXUS_CREATE = 506 - SYS___NEXUS_DESTROY = 507 - SYS___NEXUS_GET_OPT = 508 - SYS___NEXUS_SET_OPT = 509 - SYS___CHANNEL_OPEN = 510 - SYS___CHANNEL_GET_INFO = 511 - SYS___CHANNEL_SYNC = 512 - SYS___CHANNEL_GET_OPT = 513 - SYS___CHANNEL_SET_OPT = 514 - SYS_ULOCK_WAIT = 515 - SYS_ULOCK_WAKE = 516 - SYS_FCLONEFILEAT = 517 - SYS_FS_SNAPSHOT = 518 - SYS_TERMINATE_WITH_PAYLOAD = 520 - SYS_ABORT_WITH_PAYLOAD = 521 - SYS_NECP_SESSION_OPEN = 522 - SYS_NECP_SESSION_ACTION = 523 - SYS_SETATTRLISTAT = 524 - SYS_NET_QOS_GUIDELINE = 525 - SYS_FMOUNT = 526 - SYS_NTP_ADJTIME = 527 - SYS_NTP_GETTIME = 528 - SYS_OS_FAULT_WITH_PAYLOAD = 529 - SYS_MAXSYSCALL = 530 - SYS_INVALID = 63 -) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go index 7ab2130b96..5eb433bbf0 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go @@ -1,10 +1,12 @@ // go run mksysnum.go /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk/usr/include/sys/syscall.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && darwin // +build arm64,darwin package unix +// Deprecated: Use libSystem wrappers instead of direct syscalls. const ( SYS_SYSCALL = 0 SYS_EXIT = 1 diff --git a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go index 464c9a9832..703675c0c4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go @@ -1,134 +1,131 @@ // go run mksysnum.go https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && dragonfly // +build amd64,dragonfly package unix const ( - // SYS_NOSYS = 0; // { int nosys(void); } syscall nosys_args int - SYS_EXIT = 1 // { void exit(int rval); } - SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } - SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } - SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } - SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int - SYS_LINK = 9 // { int link(char *path, char *link); } - SYS_UNLINK = 10 // { int unlink(char *path); } - SYS_CHDIR = 12 // { int chdir(char *path); } - SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } - SYS_CHMOD = 15 // { int chmod(char *path, int mode); } - SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } - SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int - SYS_GETFSSTAT = 18 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } - SYS_GETPID = 20 // { pid_t getpid(void); } - SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } - SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } - SYS_SETUID = 23 // { int setuid(uid_t uid); } - SYS_GETUID = 24 // { uid_t getuid(void); } - SYS_GETEUID = 25 // { uid_t geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, int *anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, int *alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, int *alen); } - SYS_ACCESS = 33 // { int access(char *path, int flags); } - SYS_CHFLAGS = 34 // { int chflags(char *path, int flags); } - SYS_FCHFLAGS = 35 // { int fchflags(int fd, int flags); } - SYS_SYNC = 36 // { int sync(void); } - SYS_KILL = 37 // { int kill(int pid, int signum); } - SYS_GETPPID = 39 // { pid_t getppid(void); } - SYS_DUP = 41 // { int dup(int fd); } - SYS_PIPE = 42 // { int pipe(void); } - SYS_GETEGID = 43 // { gid_t getegid(void); } - SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, size_t offset, u_int scale); } - SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } - SYS_GETGID = 47 // { gid_t getgid(void); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } - SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } - SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } - SYS_REBOOT = 55 // { int reboot(int opt); } - SYS_REVOKE = 56 // { int revoke(char *path); } - SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { int readlink(char *path, char *buf, int count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } - SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int - SYS_CHROOT = 61 // { int chroot(char *path); } - SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } - SYS_VFORK = 66 // { pid_t vfork(void); } - SYS_SBRK = 69 // { int sbrk(int incr); } - SYS_SSTK = 70 // { int sstk(int incr); } - SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } - SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } - SYS_GETPGRP = 81 // { int getpgrp(void); } - SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } - SYS_SWAPON = 85 // { int swapon(char *name); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } - SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } - SYS_DUP2 = 90 // { int dup2(int from, int to); } - SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } - SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } - SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } - SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } - SYS_LISTEN = 106 // { int listen(int s, int backlog); } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } - SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } - SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } - SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } - SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } - SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } - SYS_RENAME = 128 // { int rename(char *from, char *to); } - SYS_FLOCK = 131 // { int flock(int fd, int how); } - SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } - SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } - SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } - SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } - SYS_SETSID = 147 // { int setsid(void); } - SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } - SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } - SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } - SYS_GETDOMAINNAME = 162 // { int getdomainname(char *domainname, int len); } - SYS_SETDOMAINNAME = 163 // { int setdomainname(char *domainname, int len); } - SYS_UNAME = 164 // { int uname(struct utsname *name); } - SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } - SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } - SYS_EXTPREAD = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); } - SYS_EXTPWRITE = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); } - SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } - SYS_SETGID = 181 // { int setgid(gid_t gid); } - SYS_SETEGID = 182 // { int setegid(gid_t egid); } - SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } - SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int - SYS_MMAP = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } - // SYS_NOSYS = 198; // { int nosys(void); } __syscall __syscall_args int + SYS_EXIT = 1 // { void exit(int rval); } + SYS_FORK = 2 // { int fork(void); } + SYS_READ = 3 // { ssize_t read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int open(char *path, int flags, int mode); } + SYS_CLOSE = 6 // { int close(int fd); } + SYS_WAIT4 = 7 // { int wait4(int pid, int *status, int options, struct rusage *rusage); } wait4 wait_args int + // SYS_NOSYS = 8; // { int nosys(void); } __nosys nosys_args int + SYS_LINK = 9 // { int link(char *path, char *link); } + SYS_UNLINK = 10 // { int unlink(char *path); } + SYS_CHDIR = 12 // { int chdir(char *path); } + SYS_FCHDIR = 13 // { int fchdir(int fd); } + SYS_MKNOD = 14 // { int mknod(char *path, int mode, int dev); } + SYS_CHMOD = 15 // { int chmod(char *path, int mode); } + SYS_CHOWN = 16 // { int chown(char *path, int uid, int gid); } + SYS_OBREAK = 17 // { int obreak(char *nsize); } break obreak_args int + SYS_GETFSSTAT = 18 // { int getfsstat(struct statfs *buf, long bufsize, int flags); } + SYS_GETPID = 20 // { pid_t getpid(void); } + SYS_MOUNT = 21 // { int mount(char *type, char *path, int flags, caddr_t data); } + SYS_UNMOUNT = 22 // { int unmount(char *path, int flags); } + SYS_SETUID = 23 // { int setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t getuid(void); } + SYS_GETEUID = 25 // { uid_t geteuid(void); } + SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } + SYS_RECVFROM = 29 // { int recvfrom(int s, caddr_t buf, size_t len, int flags, caddr_t from, int *fromlenaddr); } + SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, int *anamelen); } + SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, int *alen); } + SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, int *alen); } + SYS_ACCESS = 33 // { int access(char *path, int flags); } + SYS_CHFLAGS = 34 // { int chflags(const char *path, u_long flags); } + SYS_FCHFLAGS = 35 // { int fchflags(int fd, u_long flags); } + SYS_SYNC = 36 // { int sync(void); } + SYS_KILL = 37 // { int kill(int pid, int signum); } + SYS_GETPPID = 39 // { pid_t getppid(void); } + SYS_DUP = 41 // { int dup(int fd); } + SYS_PIPE = 42 // { int pipe(void); } + SYS_GETEGID = 43 // { gid_t getegid(void); } + SYS_PROFIL = 44 // { int profil(caddr_t samples, size_t size, u_long offset, u_int scale); } + SYS_KTRACE = 45 // { int ktrace(const char *fname, int ops, int facs, int pid); } + SYS_GETGID = 47 // { gid_t getgid(void); } + SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, size_t namelen); } + SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } + SYS_ACCT = 51 // { int acct(char *path); } + SYS_SIGALTSTACK = 53 // { int sigaltstack(stack_t *ss, stack_t *oss); } + SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } + SYS_REBOOT = 55 // { int reboot(int opt); } + SYS_REVOKE = 56 // { int revoke(char *path); } + SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } + SYS_READLINK = 58 // { int readlink(char *path, char *buf, int count); } + SYS_EXECVE = 59 // { int execve(char *fname, char **argv, char **envv); } + SYS_UMASK = 60 // { int umask(int newmask); } umask umask_args int + SYS_CHROOT = 61 // { int chroot(char *path); } + SYS_MSYNC = 65 // { int msync(void *addr, size_t len, int flags); } + SYS_VFORK = 66 // { pid_t vfork(void); } + SYS_SBRK = 69 // { caddr_t sbrk(size_t incr); } + SYS_SSTK = 70 // { int sstk(size_t incr); } + SYS_MUNMAP = 73 // { int munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int madvise(void *addr, size_t len, int behav); } + SYS_MINCORE = 78 // { int mincore(const void *addr, size_t len, char *vec); } + SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } + SYS_GETPGRP = 81 // { int getpgrp(void); } + SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } + SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } + SYS_SWAPON = 85 // { int swapon(char *name); } + SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } + SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } + SYS_DUP2 = 90 // { int dup2(int from, int to); } + SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } + SYS_SELECT = 93 // { int select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_FSYNC = 95 // { int fsync(int fd); } + SYS_SETPRIORITY = 96 // { int setpriority(int which, int who, int prio); } + SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int connect(int s, caddr_t name, int namelen); } + SYS_GETPRIORITY = 100 // { int getpriority(int which, int who); } + SYS_BIND = 104 // { int bind(int s, caddr_t name, int namelen); } + SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, int valsize); } + SYS_LISTEN = 106 // { int listen(int s, int backlog); } + SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } + SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, int *avalsize); } + SYS_READV = 120 // { int readv(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_WRITEV = 121 // { int writev(int fd, struct iovec *iovp, u_int iovcnt); } + SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } + SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } + SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } + SYS_SETREUID = 126 // { int setreuid(int ruid, int euid); } + SYS_SETREGID = 127 // { int setregid(int rgid, int egid); } + SYS_RENAME = 128 // { int rename(char *from, char *to); } + SYS_FLOCK = 131 // { int flock(int fd, int how); } + SYS_MKFIFO = 132 // { int mkfifo(char *path, int mode); } + SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, int tolen); } + SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int mkdir(char *path, int mode); } + SYS_RMDIR = 137 // { int rmdir(char *path); } + SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } + SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } + SYS_SETSID = 147 // { int setsid(void); } + SYS_QUOTACTL = 148 // { int quotactl(char *path, int cmd, int uid, caddr_t arg); } + SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } + SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } + SYS_GETFH = 161 // { int getfh(char *fname, struct fhandle *fhp); } + SYS_SYSARCH = 165 // { int sysarch(int op, char *parms); } + SYS_RTPRIO = 166 // { int rtprio(int function, pid_t pid, struct rtprio *rtp); } + SYS_EXTPREAD = 173 // { ssize_t extpread(int fd, void *buf, size_t nbyte, int flags, off_t offset); } + SYS_EXTPWRITE = 174 // { ssize_t extpwrite(int fd, const void *buf, size_t nbyte, int flags, off_t offset); } + SYS_NTP_ADJTIME = 176 // { int ntp_adjtime(struct timex *tp); } + SYS_SETGID = 181 // { int setgid(gid_t gid); } + SYS_SETEGID = 182 // { int setegid(gid_t egid); } + SYS_SETEUID = 183 // { int seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } + SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } + SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } getrlimit __getrlimit_args int + SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } setrlimit __setrlimit_args int + SYS_MMAP = 197 // { caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, int pad, off_t pos); } SYS_LSEEK = 199 // { off_t lseek(int fd, int pad, off_t offset, int whence); } SYS_TRUNCATE = 200 // { int truncate(char *path, int pad, off_t length); } SYS_FTRUNCATE = 201 // { int ftruncate(int fd, int pad, off_t length); } @@ -161,8 +158,8 @@ const ( SYS_LCHOWN = 254 // { int lchown(char *path, int uid, int gid); } SYS_LCHMOD = 274 // { int lchmod(char *path, mode_t mode); } SYS_LUTIMES = 276 // { int lutimes(char *path, struct timeval *tptr); } - SYS_EXTPREADV = 289 // { ssize_t extpreadv(int fd, struct iovec *iovp, u_int iovcnt, int flags, off_t offset); } - SYS_EXTPWRITEV = 290 // { ssize_t extpwritev(int fd, struct iovec *iovp,u_int iovcnt, int flags, off_t offset); } + SYS_EXTPREADV = 289 // { ssize_t extpreadv(int fd, const struct iovec *iovp, int iovcnt, int flags, off_t offset); } + SYS_EXTPWRITEV = 290 // { ssize_t extpwritev(int fd, const struct iovec *iovp, int iovcnt, int flags, off_t offset); } SYS_FHSTATFS = 297 // { int fhstatfs(const struct fhandle *u_fhp, struct statfs *buf); } SYS_FHOPEN = 298 // { int fhopen(const struct fhandle *u_fhp, int flags); } SYS_MODNEXT = 300 // { int modnext(int modid); } @@ -225,7 +222,7 @@ const ( SYS_KQUEUE = 362 // { int kqueue(void); } SYS_KEVENT = 363 // { int kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } SYS_KENV = 390 // { int kenv(int what, const char *name, char *value, int len); } - SYS_LCHFLAGS = 391 // { int lchflags(char *path, int flags); } + SYS_LCHFLAGS = 391 // { int lchflags(const char *path, u_long flags); } SYS_UUIDGEN = 392 // { int uuidgen(struct uuid *store, int count); } SYS_SENDFILE = 393 // { int sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr *hdtr, off_t *sbytes, int flags); } SYS_VARSYM_SET = 450 // { int varsym_set(int level, const char *name, const char *data); } @@ -302,7 +299,7 @@ const ( SYS_VMM_GUEST_CTL = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); } SYS_VMM_GUEST_SYNC_ADDR = 535 // { int vmm_guest_sync_addr(long *dstaddr, long *srcaddr); } SYS_PROCCTL = 536 // { int procctl(idtype_t idtype, id_t id, int cmd, void *data); } - SYS_CHFLAGSAT = 537 // { int chflagsat(int fd, const char *path, int flags, int atflags);} + SYS_CHFLAGSAT = 537 // { int chflagsat(int fd, const char *path, u_long flags, int atflags);} SYS_PIPE2 = 538 // { int pipe2(int *fildes, int flags); } SYS_UTIMENSAT = 539 // { int utimensat(int fd, const char *path, const struct timespec *ts, int flags); } SYS_FUTIMENS = 540 // { int futimens(int fd, const struct timespec *ts); } @@ -312,4 +309,9 @@ const ( SYS_LWP_SETAFFINITY = 544 // { int lwp_setaffinity(pid_t pid, lwpid_t tid, const cpumask_t *mask); } SYS_LWP_GETAFFINITY = 545 // { int lwp_getaffinity(pid_t pid, lwpid_t tid, cpumask_t *mask); } SYS_LWP_CREATE2 = 546 // { int lwp_create2(struct lwp_params *params, const cpumask_t *mask); } + SYS_GETCPUCLOCKID = 547 // { int getcpuclockid(pid_t pid, lwpid_t lwp_id, clockid_t *clock_id); } + SYS_WAIT6 = 548 // { int wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *wrusage, siginfo_t *info); } + SYS_LWP_GETNAME = 549 // { int lwp_getname(lwpid_t tid, char *name, size_t len); } + SYS_GETRANDOM = 550 // { ssize_t getrandom(void *buf, size_t len, unsigned flags); } + SYS___REALPATH = 551 // { ssize_t __realpath(const char *path, char *buf, size_t len); } ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go index 9474974b65..59d5dfc209 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && freebsd // +build 386,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go index 48a7beae7b..342d471d2e 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && freebsd // +build amd64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go index 4a6dfd4a74..e2e3d72c5b 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && freebsd // +build arm,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go index 3e51af8edd..61ad5ca3c1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && freebsd // +build arm64,freebsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 54559a8956..aa7ce85d15 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -1,6 +1,7 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m32 /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && linux // +build 386,linux package unix @@ -431,6 +432,16 @@ const ( SYS_FSPICK = 433 SYS_PIDFD_OPEN = 434 SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 SYS_OPENAT2 = 437 SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 054a741b7f..b830326386 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -1,358 +1,369 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -m64 /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && linux // +build amd64,linux package unix const ( - SYS_READ = 0 - SYS_WRITE = 1 - SYS_OPEN = 2 - SYS_CLOSE = 3 - SYS_STAT = 4 - SYS_FSTAT = 5 - SYS_LSTAT = 6 - SYS_POLL = 7 - SYS_LSEEK = 8 - SYS_MMAP = 9 - SYS_MPROTECT = 10 - SYS_MUNMAP = 11 - SYS_BRK = 12 - SYS_RT_SIGACTION = 13 - SYS_RT_SIGPROCMASK = 14 - SYS_RT_SIGRETURN = 15 - SYS_IOCTL = 16 - SYS_PREAD64 = 17 - SYS_PWRITE64 = 18 - SYS_READV = 19 - SYS_WRITEV = 20 - SYS_ACCESS = 21 - SYS_PIPE = 22 - SYS_SELECT = 23 - SYS_SCHED_YIELD = 24 - SYS_MREMAP = 25 - SYS_MSYNC = 26 - SYS_MINCORE = 27 - SYS_MADVISE = 28 - SYS_SHMGET = 29 - SYS_SHMAT = 30 - SYS_SHMCTL = 31 - SYS_DUP = 32 - SYS_DUP2 = 33 - SYS_PAUSE = 34 - SYS_NANOSLEEP = 35 - SYS_GETITIMER = 36 - SYS_ALARM = 37 - SYS_SETITIMER = 38 - SYS_GETPID = 39 - SYS_SENDFILE = 40 - SYS_SOCKET = 41 - SYS_CONNECT = 42 - SYS_ACCEPT = 43 - SYS_SENDTO = 44 - SYS_RECVFROM = 45 - SYS_SENDMSG = 46 - SYS_RECVMSG = 47 - SYS_SHUTDOWN = 48 - SYS_BIND = 49 - SYS_LISTEN = 50 - SYS_GETSOCKNAME = 51 - SYS_GETPEERNAME = 52 - SYS_SOCKETPAIR = 53 - SYS_SETSOCKOPT = 54 - SYS_GETSOCKOPT = 55 - SYS_CLONE = 56 - SYS_FORK = 57 - SYS_VFORK = 58 - SYS_EXECVE = 59 - SYS_EXIT = 60 - SYS_WAIT4 = 61 - SYS_KILL = 62 - SYS_UNAME = 63 - SYS_SEMGET = 64 - SYS_SEMOP = 65 - SYS_SEMCTL = 66 - SYS_SHMDT = 67 - SYS_MSGGET = 68 - SYS_MSGSND = 69 - SYS_MSGRCV = 70 - SYS_MSGCTL = 71 - SYS_FCNTL = 72 - SYS_FLOCK = 73 - SYS_FSYNC = 74 - SYS_FDATASYNC = 75 - SYS_TRUNCATE = 76 - SYS_FTRUNCATE = 77 - SYS_GETDENTS = 78 - SYS_GETCWD = 79 - SYS_CHDIR = 80 - SYS_FCHDIR = 81 - SYS_RENAME = 82 - SYS_MKDIR = 83 - SYS_RMDIR = 84 - SYS_CREAT = 85 - SYS_LINK = 86 - SYS_UNLINK = 87 - SYS_SYMLINK = 88 - SYS_READLINK = 89 - SYS_CHMOD = 90 - SYS_FCHMOD = 91 - SYS_CHOWN = 92 - SYS_FCHOWN = 93 - SYS_LCHOWN = 94 - SYS_UMASK = 95 - SYS_GETTIMEOFDAY = 96 - SYS_GETRLIMIT = 97 - SYS_GETRUSAGE = 98 - SYS_SYSINFO = 99 - SYS_TIMES = 100 - SYS_PTRACE = 101 - SYS_GETUID = 102 - SYS_SYSLOG = 103 - SYS_GETGID = 104 - SYS_SETUID = 105 - SYS_SETGID = 106 - SYS_GETEUID = 107 - SYS_GETEGID = 108 - SYS_SETPGID = 109 - SYS_GETPPID = 110 - SYS_GETPGRP = 111 - SYS_SETSID = 112 - SYS_SETREUID = 113 - SYS_SETREGID = 114 - SYS_GETGROUPS = 115 - SYS_SETGROUPS = 116 - SYS_SETRESUID = 117 - SYS_GETRESUID = 118 - SYS_SETRESGID = 119 - SYS_GETRESGID = 120 - SYS_GETPGID = 121 - SYS_SETFSUID = 122 - SYS_SETFSGID = 123 - SYS_GETSID = 124 - SYS_CAPGET = 125 - SYS_CAPSET = 126 - SYS_RT_SIGPENDING = 127 - SYS_RT_SIGTIMEDWAIT = 128 - SYS_RT_SIGQUEUEINFO = 129 - SYS_RT_SIGSUSPEND = 130 - SYS_SIGALTSTACK = 131 - SYS_UTIME = 132 - SYS_MKNOD = 133 - SYS_USELIB = 134 - SYS_PERSONALITY = 135 - SYS_USTAT = 136 - SYS_STATFS = 137 - SYS_FSTATFS = 138 - SYS_SYSFS = 139 - SYS_GETPRIORITY = 140 - SYS_SETPRIORITY = 141 - SYS_SCHED_SETPARAM = 142 - SYS_SCHED_GETPARAM = 143 - SYS_SCHED_SETSCHEDULER = 144 - SYS_SCHED_GETSCHEDULER = 145 - SYS_SCHED_GET_PRIORITY_MAX = 146 - SYS_SCHED_GET_PRIORITY_MIN = 147 - SYS_SCHED_RR_GET_INTERVAL = 148 - SYS_MLOCK = 149 - SYS_MUNLOCK = 150 - SYS_MLOCKALL = 151 - SYS_MUNLOCKALL = 152 - SYS_VHANGUP = 153 - SYS_MODIFY_LDT = 154 - SYS_PIVOT_ROOT = 155 - SYS__SYSCTL = 156 - SYS_PRCTL = 157 - SYS_ARCH_PRCTL = 158 - SYS_ADJTIMEX = 159 - SYS_SETRLIMIT = 160 - SYS_CHROOT = 161 - SYS_SYNC = 162 - SYS_ACCT = 163 - SYS_SETTIMEOFDAY = 164 - SYS_MOUNT = 165 - SYS_UMOUNT2 = 166 - SYS_SWAPON = 167 - SYS_SWAPOFF = 168 - SYS_REBOOT = 169 - SYS_SETHOSTNAME = 170 - SYS_SETDOMAINNAME = 171 - SYS_IOPL = 172 - SYS_IOPERM = 173 - SYS_CREATE_MODULE = 174 - SYS_INIT_MODULE = 175 - SYS_DELETE_MODULE = 176 - SYS_GET_KERNEL_SYMS = 177 - SYS_QUERY_MODULE = 178 - SYS_QUOTACTL = 179 - SYS_NFSSERVCTL = 180 - SYS_GETPMSG = 181 - SYS_PUTPMSG = 182 - SYS_AFS_SYSCALL = 183 - SYS_TUXCALL = 184 - SYS_SECURITY = 185 - SYS_GETTID = 186 - SYS_READAHEAD = 187 - SYS_SETXATTR = 188 - SYS_LSETXATTR = 189 - SYS_FSETXATTR = 190 - SYS_GETXATTR = 191 - SYS_LGETXATTR = 192 - SYS_FGETXATTR = 193 - SYS_LISTXATTR = 194 - SYS_LLISTXATTR = 195 - SYS_FLISTXATTR = 196 - SYS_REMOVEXATTR = 197 - SYS_LREMOVEXATTR = 198 - SYS_FREMOVEXATTR = 199 - SYS_TKILL = 200 - SYS_TIME = 201 - SYS_FUTEX = 202 - SYS_SCHED_SETAFFINITY = 203 - SYS_SCHED_GETAFFINITY = 204 - SYS_SET_THREAD_AREA = 205 - SYS_IO_SETUP = 206 - SYS_IO_DESTROY = 207 - SYS_IO_GETEVENTS = 208 - SYS_IO_SUBMIT = 209 - SYS_IO_CANCEL = 210 - SYS_GET_THREAD_AREA = 211 - SYS_LOOKUP_DCOOKIE = 212 - SYS_EPOLL_CREATE = 213 - SYS_EPOLL_CTL_OLD = 214 - SYS_EPOLL_WAIT_OLD = 215 - SYS_REMAP_FILE_PAGES = 216 - SYS_GETDENTS64 = 217 - SYS_SET_TID_ADDRESS = 218 - SYS_RESTART_SYSCALL = 219 - SYS_SEMTIMEDOP = 220 - SYS_FADVISE64 = 221 - SYS_TIMER_CREATE = 222 - SYS_TIMER_SETTIME = 223 - SYS_TIMER_GETTIME = 224 - SYS_TIMER_GETOVERRUN = 225 - SYS_TIMER_DELETE = 226 - SYS_CLOCK_SETTIME = 227 - SYS_CLOCK_GETTIME = 228 - SYS_CLOCK_GETRES = 229 - SYS_CLOCK_NANOSLEEP = 230 - SYS_EXIT_GROUP = 231 - SYS_EPOLL_WAIT = 232 - SYS_EPOLL_CTL = 233 - SYS_TGKILL = 234 - SYS_UTIMES = 235 - SYS_VSERVER = 236 - SYS_MBIND = 237 - SYS_SET_MEMPOLICY = 238 - SYS_GET_MEMPOLICY = 239 - SYS_MQ_OPEN = 240 - SYS_MQ_UNLINK = 241 - SYS_MQ_TIMEDSEND = 242 - SYS_MQ_TIMEDRECEIVE = 243 - SYS_MQ_NOTIFY = 244 - SYS_MQ_GETSETATTR = 245 - SYS_KEXEC_LOAD = 246 - SYS_WAITID = 247 - SYS_ADD_KEY = 248 - SYS_REQUEST_KEY = 249 - SYS_KEYCTL = 250 - SYS_IOPRIO_SET = 251 - SYS_IOPRIO_GET = 252 - SYS_INOTIFY_INIT = 253 - SYS_INOTIFY_ADD_WATCH = 254 - SYS_INOTIFY_RM_WATCH = 255 - SYS_MIGRATE_PAGES = 256 - SYS_OPENAT = 257 - SYS_MKDIRAT = 258 - SYS_MKNODAT = 259 - SYS_FCHOWNAT = 260 - SYS_FUTIMESAT = 261 - SYS_NEWFSTATAT = 262 - SYS_UNLINKAT = 263 - SYS_RENAMEAT = 264 - SYS_LINKAT = 265 - SYS_SYMLINKAT = 266 - SYS_READLINKAT = 267 - SYS_FCHMODAT = 268 - SYS_FACCESSAT = 269 - SYS_PSELECT6 = 270 - SYS_PPOLL = 271 - SYS_UNSHARE = 272 - SYS_SET_ROBUST_LIST = 273 - SYS_GET_ROBUST_LIST = 274 - SYS_SPLICE = 275 - SYS_TEE = 276 - SYS_SYNC_FILE_RANGE = 277 - SYS_VMSPLICE = 278 - SYS_MOVE_PAGES = 279 - SYS_UTIMENSAT = 280 - SYS_EPOLL_PWAIT = 281 - SYS_SIGNALFD = 282 - SYS_TIMERFD_CREATE = 283 - SYS_EVENTFD = 284 - SYS_FALLOCATE = 285 - SYS_TIMERFD_SETTIME = 286 - SYS_TIMERFD_GETTIME = 287 - SYS_ACCEPT4 = 288 - SYS_SIGNALFD4 = 289 - SYS_EVENTFD2 = 290 - SYS_EPOLL_CREATE1 = 291 - SYS_DUP3 = 292 - SYS_PIPE2 = 293 - SYS_INOTIFY_INIT1 = 294 - SYS_PREADV = 295 - SYS_PWRITEV = 296 - SYS_RT_TGSIGQUEUEINFO = 297 - SYS_PERF_EVENT_OPEN = 298 - SYS_RECVMMSG = 299 - SYS_FANOTIFY_INIT = 300 - SYS_FANOTIFY_MARK = 301 - SYS_PRLIMIT64 = 302 - SYS_NAME_TO_HANDLE_AT = 303 - SYS_OPEN_BY_HANDLE_AT = 304 - SYS_CLOCK_ADJTIME = 305 - SYS_SYNCFS = 306 - SYS_SENDMMSG = 307 - SYS_SETNS = 308 - SYS_GETCPU = 309 - SYS_PROCESS_VM_READV = 310 - SYS_PROCESS_VM_WRITEV = 311 - SYS_KCMP = 312 - SYS_FINIT_MODULE = 313 - SYS_SCHED_SETATTR = 314 - SYS_SCHED_GETATTR = 315 - SYS_RENAMEAT2 = 316 - SYS_SECCOMP = 317 - SYS_GETRANDOM = 318 - SYS_MEMFD_CREATE = 319 - SYS_KEXEC_FILE_LOAD = 320 - SYS_BPF = 321 - SYS_EXECVEAT = 322 - SYS_USERFAULTFD = 323 - SYS_MEMBARRIER = 324 - SYS_MLOCK2 = 325 - SYS_COPY_FILE_RANGE = 326 - SYS_PREADV2 = 327 - SYS_PWRITEV2 = 328 - SYS_PKEY_MPROTECT = 329 - SYS_PKEY_ALLOC = 330 - SYS_PKEY_FREE = 331 - SYS_STATX = 332 - SYS_IO_PGETEVENTS = 333 - SYS_RSEQ = 334 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 + SYS_READ = 0 + SYS_WRITE = 1 + SYS_OPEN = 2 + SYS_CLOSE = 3 + SYS_STAT = 4 + SYS_FSTAT = 5 + SYS_LSTAT = 6 + SYS_POLL = 7 + SYS_LSEEK = 8 + SYS_MMAP = 9 + SYS_MPROTECT = 10 + SYS_MUNMAP = 11 + SYS_BRK = 12 + SYS_RT_SIGACTION = 13 + SYS_RT_SIGPROCMASK = 14 + SYS_RT_SIGRETURN = 15 + SYS_IOCTL = 16 + SYS_PREAD64 = 17 + SYS_PWRITE64 = 18 + SYS_READV = 19 + SYS_WRITEV = 20 + SYS_ACCESS = 21 + SYS_PIPE = 22 + SYS_SELECT = 23 + SYS_SCHED_YIELD = 24 + SYS_MREMAP = 25 + SYS_MSYNC = 26 + SYS_MINCORE = 27 + SYS_MADVISE = 28 + SYS_SHMGET = 29 + SYS_SHMAT = 30 + SYS_SHMCTL = 31 + SYS_DUP = 32 + SYS_DUP2 = 33 + SYS_PAUSE = 34 + SYS_NANOSLEEP = 35 + SYS_GETITIMER = 36 + SYS_ALARM = 37 + SYS_SETITIMER = 38 + SYS_GETPID = 39 + SYS_SENDFILE = 40 + SYS_SOCKET = 41 + SYS_CONNECT = 42 + SYS_ACCEPT = 43 + SYS_SENDTO = 44 + SYS_RECVFROM = 45 + SYS_SENDMSG = 46 + SYS_RECVMSG = 47 + SYS_SHUTDOWN = 48 + SYS_BIND = 49 + SYS_LISTEN = 50 + SYS_GETSOCKNAME = 51 + SYS_GETPEERNAME = 52 + SYS_SOCKETPAIR = 53 + SYS_SETSOCKOPT = 54 + SYS_GETSOCKOPT = 55 + SYS_CLONE = 56 + SYS_FORK = 57 + SYS_VFORK = 58 + SYS_EXECVE = 59 + SYS_EXIT = 60 + SYS_WAIT4 = 61 + SYS_KILL = 62 + SYS_UNAME = 63 + SYS_SEMGET = 64 + SYS_SEMOP = 65 + SYS_SEMCTL = 66 + SYS_SHMDT = 67 + SYS_MSGGET = 68 + SYS_MSGSND = 69 + SYS_MSGRCV = 70 + SYS_MSGCTL = 71 + SYS_FCNTL = 72 + SYS_FLOCK = 73 + SYS_FSYNC = 74 + SYS_FDATASYNC = 75 + SYS_TRUNCATE = 76 + SYS_FTRUNCATE = 77 + SYS_GETDENTS = 78 + SYS_GETCWD = 79 + SYS_CHDIR = 80 + SYS_FCHDIR = 81 + SYS_RENAME = 82 + SYS_MKDIR = 83 + SYS_RMDIR = 84 + SYS_CREAT = 85 + SYS_LINK = 86 + SYS_UNLINK = 87 + SYS_SYMLINK = 88 + SYS_READLINK = 89 + SYS_CHMOD = 90 + SYS_FCHMOD = 91 + SYS_CHOWN = 92 + SYS_FCHOWN = 93 + SYS_LCHOWN = 94 + SYS_UMASK = 95 + SYS_GETTIMEOFDAY = 96 + SYS_GETRLIMIT = 97 + SYS_GETRUSAGE = 98 + SYS_SYSINFO = 99 + SYS_TIMES = 100 + SYS_PTRACE = 101 + SYS_GETUID = 102 + SYS_SYSLOG = 103 + SYS_GETGID = 104 + SYS_SETUID = 105 + SYS_SETGID = 106 + SYS_GETEUID = 107 + SYS_GETEGID = 108 + SYS_SETPGID = 109 + SYS_GETPPID = 110 + SYS_GETPGRP = 111 + SYS_SETSID = 112 + SYS_SETREUID = 113 + SYS_SETREGID = 114 + SYS_GETGROUPS = 115 + SYS_SETGROUPS = 116 + SYS_SETRESUID = 117 + SYS_GETRESUID = 118 + SYS_SETRESGID = 119 + SYS_GETRESGID = 120 + SYS_GETPGID = 121 + SYS_SETFSUID = 122 + SYS_SETFSGID = 123 + SYS_GETSID = 124 + SYS_CAPGET = 125 + SYS_CAPSET = 126 + SYS_RT_SIGPENDING = 127 + SYS_RT_SIGTIMEDWAIT = 128 + SYS_RT_SIGQUEUEINFO = 129 + SYS_RT_SIGSUSPEND = 130 + SYS_SIGALTSTACK = 131 + SYS_UTIME = 132 + SYS_MKNOD = 133 + SYS_USELIB = 134 + SYS_PERSONALITY = 135 + SYS_USTAT = 136 + SYS_STATFS = 137 + SYS_FSTATFS = 138 + SYS_SYSFS = 139 + SYS_GETPRIORITY = 140 + SYS_SETPRIORITY = 141 + SYS_SCHED_SETPARAM = 142 + SYS_SCHED_GETPARAM = 143 + SYS_SCHED_SETSCHEDULER = 144 + SYS_SCHED_GETSCHEDULER = 145 + SYS_SCHED_GET_PRIORITY_MAX = 146 + SYS_SCHED_GET_PRIORITY_MIN = 147 + SYS_SCHED_RR_GET_INTERVAL = 148 + SYS_MLOCK = 149 + SYS_MUNLOCK = 150 + SYS_MLOCKALL = 151 + SYS_MUNLOCKALL = 152 + SYS_VHANGUP = 153 + SYS_MODIFY_LDT = 154 + SYS_PIVOT_ROOT = 155 + SYS__SYSCTL = 156 + SYS_PRCTL = 157 + SYS_ARCH_PRCTL = 158 + SYS_ADJTIMEX = 159 + SYS_SETRLIMIT = 160 + SYS_CHROOT = 161 + SYS_SYNC = 162 + SYS_ACCT = 163 + SYS_SETTIMEOFDAY = 164 + SYS_MOUNT = 165 + SYS_UMOUNT2 = 166 + SYS_SWAPON = 167 + SYS_SWAPOFF = 168 + SYS_REBOOT = 169 + SYS_SETHOSTNAME = 170 + SYS_SETDOMAINNAME = 171 + SYS_IOPL = 172 + SYS_IOPERM = 173 + SYS_CREATE_MODULE = 174 + SYS_INIT_MODULE = 175 + SYS_DELETE_MODULE = 176 + SYS_GET_KERNEL_SYMS = 177 + SYS_QUERY_MODULE = 178 + SYS_QUOTACTL = 179 + SYS_NFSSERVCTL = 180 + SYS_GETPMSG = 181 + SYS_PUTPMSG = 182 + SYS_AFS_SYSCALL = 183 + SYS_TUXCALL = 184 + SYS_SECURITY = 185 + SYS_GETTID = 186 + SYS_READAHEAD = 187 + SYS_SETXATTR = 188 + SYS_LSETXATTR = 189 + SYS_FSETXATTR = 190 + SYS_GETXATTR = 191 + SYS_LGETXATTR = 192 + SYS_FGETXATTR = 193 + SYS_LISTXATTR = 194 + SYS_LLISTXATTR = 195 + SYS_FLISTXATTR = 196 + SYS_REMOVEXATTR = 197 + SYS_LREMOVEXATTR = 198 + SYS_FREMOVEXATTR = 199 + SYS_TKILL = 200 + SYS_TIME = 201 + SYS_FUTEX = 202 + SYS_SCHED_SETAFFINITY = 203 + SYS_SCHED_GETAFFINITY = 204 + SYS_SET_THREAD_AREA = 205 + SYS_IO_SETUP = 206 + SYS_IO_DESTROY = 207 + SYS_IO_GETEVENTS = 208 + SYS_IO_SUBMIT = 209 + SYS_IO_CANCEL = 210 + SYS_GET_THREAD_AREA = 211 + SYS_LOOKUP_DCOOKIE = 212 + SYS_EPOLL_CREATE = 213 + SYS_EPOLL_CTL_OLD = 214 + SYS_EPOLL_WAIT_OLD = 215 + SYS_REMAP_FILE_PAGES = 216 + SYS_GETDENTS64 = 217 + SYS_SET_TID_ADDRESS = 218 + SYS_RESTART_SYSCALL = 219 + SYS_SEMTIMEDOP = 220 + SYS_FADVISE64 = 221 + SYS_TIMER_CREATE = 222 + SYS_TIMER_SETTIME = 223 + SYS_TIMER_GETTIME = 224 + SYS_TIMER_GETOVERRUN = 225 + SYS_TIMER_DELETE = 226 + SYS_CLOCK_SETTIME = 227 + SYS_CLOCK_GETTIME = 228 + SYS_CLOCK_GETRES = 229 + SYS_CLOCK_NANOSLEEP = 230 + SYS_EXIT_GROUP = 231 + SYS_EPOLL_WAIT = 232 + SYS_EPOLL_CTL = 233 + SYS_TGKILL = 234 + SYS_UTIMES = 235 + SYS_VSERVER = 236 + SYS_MBIND = 237 + SYS_SET_MEMPOLICY = 238 + SYS_GET_MEMPOLICY = 239 + SYS_MQ_OPEN = 240 + SYS_MQ_UNLINK = 241 + SYS_MQ_TIMEDSEND = 242 + SYS_MQ_TIMEDRECEIVE = 243 + SYS_MQ_NOTIFY = 244 + SYS_MQ_GETSETATTR = 245 + SYS_KEXEC_LOAD = 246 + SYS_WAITID = 247 + SYS_ADD_KEY = 248 + SYS_REQUEST_KEY = 249 + SYS_KEYCTL = 250 + SYS_IOPRIO_SET = 251 + SYS_IOPRIO_GET = 252 + SYS_INOTIFY_INIT = 253 + SYS_INOTIFY_ADD_WATCH = 254 + SYS_INOTIFY_RM_WATCH = 255 + SYS_MIGRATE_PAGES = 256 + SYS_OPENAT = 257 + SYS_MKDIRAT = 258 + SYS_MKNODAT = 259 + SYS_FCHOWNAT = 260 + SYS_FUTIMESAT = 261 + SYS_NEWFSTATAT = 262 + SYS_UNLINKAT = 263 + SYS_RENAMEAT = 264 + SYS_LINKAT = 265 + SYS_SYMLINKAT = 266 + SYS_READLINKAT = 267 + SYS_FCHMODAT = 268 + SYS_FACCESSAT = 269 + SYS_PSELECT6 = 270 + SYS_PPOLL = 271 + SYS_UNSHARE = 272 + SYS_SET_ROBUST_LIST = 273 + SYS_GET_ROBUST_LIST = 274 + SYS_SPLICE = 275 + SYS_TEE = 276 + SYS_SYNC_FILE_RANGE = 277 + SYS_VMSPLICE = 278 + SYS_MOVE_PAGES = 279 + SYS_UTIMENSAT = 280 + SYS_EPOLL_PWAIT = 281 + SYS_SIGNALFD = 282 + SYS_TIMERFD_CREATE = 283 + SYS_EVENTFD = 284 + SYS_FALLOCATE = 285 + SYS_TIMERFD_SETTIME = 286 + SYS_TIMERFD_GETTIME = 287 + SYS_ACCEPT4 = 288 + SYS_SIGNALFD4 = 289 + SYS_EVENTFD2 = 290 + SYS_EPOLL_CREATE1 = 291 + SYS_DUP3 = 292 + SYS_PIPE2 = 293 + SYS_INOTIFY_INIT1 = 294 + SYS_PREADV = 295 + SYS_PWRITEV = 296 + SYS_RT_TGSIGQUEUEINFO = 297 + SYS_PERF_EVENT_OPEN = 298 + SYS_RECVMMSG = 299 + SYS_FANOTIFY_INIT = 300 + SYS_FANOTIFY_MARK = 301 + SYS_PRLIMIT64 = 302 + SYS_NAME_TO_HANDLE_AT = 303 + SYS_OPEN_BY_HANDLE_AT = 304 + SYS_CLOCK_ADJTIME = 305 + SYS_SYNCFS = 306 + SYS_SENDMMSG = 307 + SYS_SETNS = 308 + SYS_GETCPU = 309 + SYS_PROCESS_VM_READV = 310 + SYS_PROCESS_VM_WRITEV = 311 + SYS_KCMP = 312 + SYS_FINIT_MODULE = 313 + SYS_SCHED_SETATTR = 314 + SYS_SCHED_GETATTR = 315 + SYS_RENAMEAT2 = 316 + SYS_SECCOMP = 317 + SYS_GETRANDOM = 318 + SYS_MEMFD_CREATE = 319 + SYS_KEXEC_FILE_LOAD = 320 + SYS_BPF = 321 + SYS_EXECVEAT = 322 + SYS_USERFAULTFD = 323 + SYS_MEMBARRIER = 324 + SYS_MLOCK2 = 325 + SYS_COPY_FILE_RANGE = 326 + SYS_PREADV2 = 327 + SYS_PWRITEV2 = 328 + SYS_PKEY_MPROTECT = 329 + SYS_PKEY_ALLOC = 330 + SYS_PKEY_FREE = 331 + SYS_STATX = 332 + SYS_IO_PGETEVENTS = 333 + SYS_RSEQ = 334 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 307f2ba12e..d75f65a0aa 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -1,6 +1,7 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && linux // +build arm,linux package unix @@ -395,6 +396,15 @@ const ( SYS_FSPICK = 433 SYS_PIDFD_OPEN = 434 SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 SYS_OPENAT2 = 437 SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index e9404dd545..8b02f09e9b 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -1,303 +1,314 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && linux // +build arm64,linux package unix const ( - SYS_IO_SETUP = 0 - SYS_IO_DESTROY = 1 - SYS_IO_SUBMIT = 2 - SYS_IO_CANCEL = 3 - SYS_IO_GETEVENTS = 4 - SYS_SETXATTR = 5 - SYS_LSETXATTR = 6 - SYS_FSETXATTR = 7 - SYS_GETXATTR = 8 - SYS_LGETXATTR = 9 - SYS_FGETXATTR = 10 - SYS_LISTXATTR = 11 - SYS_LLISTXATTR = 12 - SYS_FLISTXATTR = 13 - SYS_REMOVEXATTR = 14 - SYS_LREMOVEXATTR = 15 - SYS_FREMOVEXATTR = 16 - SYS_GETCWD = 17 - SYS_LOOKUP_DCOOKIE = 18 - SYS_EVENTFD2 = 19 - SYS_EPOLL_CREATE1 = 20 - SYS_EPOLL_CTL = 21 - SYS_EPOLL_PWAIT = 22 - SYS_DUP = 23 - SYS_DUP3 = 24 - SYS_FCNTL = 25 - SYS_INOTIFY_INIT1 = 26 - SYS_INOTIFY_ADD_WATCH = 27 - SYS_INOTIFY_RM_WATCH = 28 - SYS_IOCTL = 29 - SYS_IOPRIO_SET = 30 - SYS_IOPRIO_GET = 31 - SYS_FLOCK = 32 - SYS_MKNODAT = 33 - SYS_MKDIRAT = 34 - SYS_UNLINKAT = 35 - SYS_SYMLINKAT = 36 - SYS_LINKAT = 37 - SYS_RENAMEAT = 38 - SYS_UMOUNT2 = 39 - SYS_MOUNT = 40 - SYS_PIVOT_ROOT = 41 - SYS_NFSSERVCTL = 42 - SYS_STATFS = 43 - SYS_FSTATFS = 44 - SYS_TRUNCATE = 45 - SYS_FTRUNCATE = 46 - SYS_FALLOCATE = 47 - SYS_FACCESSAT = 48 - SYS_CHDIR = 49 - SYS_FCHDIR = 50 - SYS_CHROOT = 51 - SYS_FCHMOD = 52 - SYS_FCHMODAT = 53 - SYS_FCHOWNAT = 54 - SYS_FCHOWN = 55 - SYS_OPENAT = 56 - SYS_CLOSE = 57 - SYS_VHANGUP = 58 - SYS_PIPE2 = 59 - SYS_QUOTACTL = 60 - SYS_GETDENTS64 = 61 - SYS_LSEEK = 62 - SYS_READ = 63 - SYS_WRITE = 64 - SYS_READV = 65 - SYS_WRITEV = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_PREADV = 69 - SYS_PWRITEV = 70 - SYS_SENDFILE = 71 - SYS_PSELECT6 = 72 - SYS_PPOLL = 73 - SYS_SIGNALFD4 = 74 - SYS_VMSPLICE = 75 - SYS_SPLICE = 76 - SYS_TEE = 77 - SYS_READLINKAT = 78 - SYS_FSTATAT = 79 - SYS_FSTAT = 80 - SYS_SYNC = 81 - SYS_FSYNC = 82 - SYS_FDATASYNC = 83 - SYS_SYNC_FILE_RANGE = 84 - SYS_TIMERFD_CREATE = 85 - SYS_TIMERFD_SETTIME = 86 - SYS_TIMERFD_GETTIME = 87 - SYS_UTIMENSAT = 88 - SYS_ACCT = 89 - SYS_CAPGET = 90 - SYS_CAPSET = 91 - SYS_PERSONALITY = 92 - SYS_EXIT = 93 - SYS_EXIT_GROUP = 94 - SYS_WAITID = 95 - SYS_SET_TID_ADDRESS = 96 - SYS_UNSHARE = 97 - SYS_FUTEX = 98 - SYS_SET_ROBUST_LIST = 99 - SYS_GET_ROBUST_LIST = 100 - SYS_NANOSLEEP = 101 - SYS_GETITIMER = 102 - SYS_SETITIMER = 103 - SYS_KEXEC_LOAD = 104 - SYS_INIT_MODULE = 105 - SYS_DELETE_MODULE = 106 - SYS_TIMER_CREATE = 107 - SYS_TIMER_GETTIME = 108 - SYS_TIMER_GETOVERRUN = 109 - SYS_TIMER_SETTIME = 110 - SYS_TIMER_DELETE = 111 - SYS_CLOCK_SETTIME = 112 - SYS_CLOCK_GETTIME = 113 - SYS_CLOCK_GETRES = 114 - SYS_CLOCK_NANOSLEEP = 115 - SYS_SYSLOG = 116 - SYS_PTRACE = 117 - SYS_SCHED_SETPARAM = 118 - SYS_SCHED_SETSCHEDULER = 119 - SYS_SCHED_GETSCHEDULER = 120 - SYS_SCHED_GETPARAM = 121 - SYS_SCHED_SETAFFINITY = 122 - SYS_SCHED_GETAFFINITY = 123 - SYS_SCHED_YIELD = 124 - SYS_SCHED_GET_PRIORITY_MAX = 125 - SYS_SCHED_GET_PRIORITY_MIN = 126 - SYS_SCHED_RR_GET_INTERVAL = 127 - SYS_RESTART_SYSCALL = 128 - SYS_KILL = 129 - SYS_TKILL = 130 - SYS_TGKILL = 131 - SYS_SIGALTSTACK = 132 - SYS_RT_SIGSUSPEND = 133 - SYS_RT_SIGACTION = 134 - SYS_RT_SIGPROCMASK = 135 - SYS_RT_SIGPENDING = 136 - SYS_RT_SIGTIMEDWAIT = 137 - SYS_RT_SIGQUEUEINFO = 138 - SYS_RT_SIGRETURN = 139 - SYS_SETPRIORITY = 140 - SYS_GETPRIORITY = 141 - SYS_REBOOT = 142 - SYS_SETREGID = 143 - SYS_SETGID = 144 - SYS_SETREUID = 145 - SYS_SETUID = 146 - SYS_SETRESUID = 147 - SYS_GETRESUID = 148 - SYS_SETRESGID = 149 - SYS_GETRESGID = 150 - SYS_SETFSUID = 151 - SYS_SETFSGID = 152 - SYS_TIMES = 153 - SYS_SETPGID = 154 - SYS_GETPGID = 155 - SYS_GETSID = 156 - SYS_SETSID = 157 - SYS_GETGROUPS = 158 - SYS_SETGROUPS = 159 - SYS_UNAME = 160 - SYS_SETHOSTNAME = 161 - SYS_SETDOMAINNAME = 162 - SYS_GETRLIMIT = 163 - SYS_SETRLIMIT = 164 - SYS_GETRUSAGE = 165 - SYS_UMASK = 166 - SYS_PRCTL = 167 - SYS_GETCPU = 168 - SYS_GETTIMEOFDAY = 169 - SYS_SETTIMEOFDAY = 170 - SYS_ADJTIMEX = 171 - SYS_GETPID = 172 - SYS_GETPPID = 173 - SYS_GETUID = 174 - SYS_GETEUID = 175 - SYS_GETGID = 176 - SYS_GETEGID = 177 - SYS_GETTID = 178 - SYS_SYSINFO = 179 - SYS_MQ_OPEN = 180 - SYS_MQ_UNLINK = 181 - SYS_MQ_TIMEDSEND = 182 - SYS_MQ_TIMEDRECEIVE = 183 - SYS_MQ_NOTIFY = 184 - SYS_MQ_GETSETATTR = 185 - SYS_MSGGET = 186 - SYS_MSGCTL = 187 - SYS_MSGRCV = 188 - SYS_MSGSND = 189 - SYS_SEMGET = 190 - SYS_SEMCTL = 191 - SYS_SEMTIMEDOP = 192 - SYS_SEMOP = 193 - SYS_SHMGET = 194 - SYS_SHMCTL = 195 - SYS_SHMAT = 196 - SYS_SHMDT = 197 - SYS_SOCKET = 198 - SYS_SOCKETPAIR = 199 - SYS_BIND = 200 - SYS_LISTEN = 201 - SYS_ACCEPT = 202 - SYS_CONNECT = 203 - SYS_GETSOCKNAME = 204 - SYS_GETPEERNAME = 205 - SYS_SENDTO = 206 - SYS_RECVFROM = 207 - SYS_SETSOCKOPT = 208 - SYS_GETSOCKOPT = 209 - SYS_SHUTDOWN = 210 - SYS_SENDMSG = 211 - SYS_RECVMSG = 212 - SYS_READAHEAD = 213 - SYS_BRK = 214 - SYS_MUNMAP = 215 - SYS_MREMAP = 216 - SYS_ADD_KEY = 217 - SYS_REQUEST_KEY = 218 - SYS_KEYCTL = 219 - SYS_CLONE = 220 - SYS_EXECVE = 221 - SYS_MMAP = 222 - SYS_FADVISE64 = 223 - SYS_SWAPON = 224 - SYS_SWAPOFF = 225 - SYS_MPROTECT = 226 - SYS_MSYNC = 227 - SYS_MLOCK = 228 - SYS_MUNLOCK = 229 - SYS_MLOCKALL = 230 - SYS_MUNLOCKALL = 231 - SYS_MINCORE = 232 - SYS_MADVISE = 233 - SYS_REMAP_FILE_PAGES = 234 - SYS_MBIND = 235 - SYS_GET_MEMPOLICY = 236 - SYS_SET_MEMPOLICY = 237 - SYS_MIGRATE_PAGES = 238 - SYS_MOVE_PAGES = 239 - SYS_RT_TGSIGQUEUEINFO = 240 - SYS_PERF_EVENT_OPEN = 241 - SYS_ACCEPT4 = 242 - SYS_RECVMMSG = 243 - SYS_ARCH_SPECIFIC_SYSCALL = 244 - SYS_WAIT4 = 260 - SYS_PRLIMIT64 = 261 - SYS_FANOTIFY_INIT = 262 - SYS_FANOTIFY_MARK = 263 - SYS_NAME_TO_HANDLE_AT = 264 - SYS_OPEN_BY_HANDLE_AT = 265 - SYS_CLOCK_ADJTIME = 266 - SYS_SYNCFS = 267 - SYS_SETNS = 268 - SYS_SENDMMSG = 269 - SYS_PROCESS_VM_READV = 270 - SYS_PROCESS_VM_WRITEV = 271 - SYS_KCMP = 272 - SYS_FINIT_MODULE = 273 - SYS_SCHED_SETATTR = 274 - SYS_SCHED_GETATTR = 275 - SYS_RENAMEAT2 = 276 - SYS_SECCOMP = 277 - SYS_GETRANDOM = 278 - SYS_MEMFD_CREATE = 279 - SYS_BPF = 280 - SYS_EXECVEAT = 281 - SYS_USERFAULTFD = 282 - SYS_MEMBARRIER = 283 - SYS_MLOCK2 = 284 - SYS_COPY_FILE_RANGE = 285 - SYS_PREADV2 = 286 - SYS_PWRITEV2 = 287 - SYS_PKEY_MPROTECT = 288 - SYS_PKEY_ALLOC = 289 - SYS_PKEY_FREE = 290 - SYS_STATX = 291 - SYS_IO_PGETEVENTS = 292 - SYS_RSEQ = 293 - SYS_KEXEC_FILE_LOAD = 294 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 + SYS_IO_SETUP = 0 + SYS_IO_DESTROY = 1 + SYS_IO_SUBMIT = 2 + SYS_IO_CANCEL = 3 + SYS_IO_GETEVENTS = 4 + SYS_SETXATTR = 5 + SYS_LSETXATTR = 6 + SYS_FSETXATTR = 7 + SYS_GETXATTR = 8 + SYS_LGETXATTR = 9 + SYS_FGETXATTR = 10 + SYS_LISTXATTR = 11 + SYS_LLISTXATTR = 12 + SYS_FLISTXATTR = 13 + SYS_REMOVEXATTR = 14 + SYS_LREMOVEXATTR = 15 + SYS_FREMOVEXATTR = 16 + SYS_GETCWD = 17 + SYS_LOOKUP_DCOOKIE = 18 + SYS_EVENTFD2 = 19 + SYS_EPOLL_CREATE1 = 20 + SYS_EPOLL_CTL = 21 + SYS_EPOLL_PWAIT = 22 + SYS_DUP = 23 + SYS_DUP3 = 24 + SYS_FCNTL = 25 + SYS_INOTIFY_INIT1 = 26 + SYS_INOTIFY_ADD_WATCH = 27 + SYS_INOTIFY_RM_WATCH = 28 + SYS_IOCTL = 29 + SYS_IOPRIO_SET = 30 + SYS_IOPRIO_GET = 31 + SYS_FLOCK = 32 + SYS_MKNODAT = 33 + SYS_MKDIRAT = 34 + SYS_UNLINKAT = 35 + SYS_SYMLINKAT = 36 + SYS_LINKAT = 37 + SYS_RENAMEAT = 38 + SYS_UMOUNT2 = 39 + SYS_MOUNT = 40 + SYS_PIVOT_ROOT = 41 + SYS_NFSSERVCTL = 42 + SYS_STATFS = 43 + SYS_FSTATFS = 44 + SYS_TRUNCATE = 45 + SYS_FTRUNCATE = 46 + SYS_FALLOCATE = 47 + SYS_FACCESSAT = 48 + SYS_CHDIR = 49 + SYS_FCHDIR = 50 + SYS_CHROOT = 51 + SYS_FCHMOD = 52 + SYS_FCHMODAT = 53 + SYS_FCHOWNAT = 54 + SYS_FCHOWN = 55 + SYS_OPENAT = 56 + SYS_CLOSE = 57 + SYS_VHANGUP = 58 + SYS_PIPE2 = 59 + SYS_QUOTACTL = 60 + SYS_GETDENTS64 = 61 + SYS_LSEEK = 62 + SYS_READ = 63 + SYS_WRITE = 64 + SYS_READV = 65 + SYS_WRITEV = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_PREADV = 69 + SYS_PWRITEV = 70 + SYS_SENDFILE = 71 + SYS_PSELECT6 = 72 + SYS_PPOLL = 73 + SYS_SIGNALFD4 = 74 + SYS_VMSPLICE = 75 + SYS_SPLICE = 76 + SYS_TEE = 77 + SYS_READLINKAT = 78 + SYS_FSTATAT = 79 + SYS_FSTAT = 80 + SYS_SYNC = 81 + SYS_FSYNC = 82 + SYS_FDATASYNC = 83 + SYS_SYNC_FILE_RANGE = 84 + SYS_TIMERFD_CREATE = 85 + SYS_TIMERFD_SETTIME = 86 + SYS_TIMERFD_GETTIME = 87 + SYS_UTIMENSAT = 88 + SYS_ACCT = 89 + SYS_CAPGET = 90 + SYS_CAPSET = 91 + SYS_PERSONALITY = 92 + SYS_EXIT = 93 + SYS_EXIT_GROUP = 94 + SYS_WAITID = 95 + SYS_SET_TID_ADDRESS = 96 + SYS_UNSHARE = 97 + SYS_FUTEX = 98 + SYS_SET_ROBUST_LIST = 99 + SYS_GET_ROBUST_LIST = 100 + SYS_NANOSLEEP = 101 + SYS_GETITIMER = 102 + SYS_SETITIMER = 103 + SYS_KEXEC_LOAD = 104 + SYS_INIT_MODULE = 105 + SYS_DELETE_MODULE = 106 + SYS_TIMER_CREATE = 107 + SYS_TIMER_GETTIME = 108 + SYS_TIMER_GETOVERRUN = 109 + SYS_TIMER_SETTIME = 110 + SYS_TIMER_DELETE = 111 + SYS_CLOCK_SETTIME = 112 + SYS_CLOCK_GETTIME = 113 + SYS_CLOCK_GETRES = 114 + SYS_CLOCK_NANOSLEEP = 115 + SYS_SYSLOG = 116 + SYS_PTRACE = 117 + SYS_SCHED_SETPARAM = 118 + SYS_SCHED_SETSCHEDULER = 119 + SYS_SCHED_GETSCHEDULER = 120 + SYS_SCHED_GETPARAM = 121 + SYS_SCHED_SETAFFINITY = 122 + SYS_SCHED_GETAFFINITY = 123 + SYS_SCHED_YIELD = 124 + SYS_SCHED_GET_PRIORITY_MAX = 125 + SYS_SCHED_GET_PRIORITY_MIN = 126 + SYS_SCHED_RR_GET_INTERVAL = 127 + SYS_RESTART_SYSCALL = 128 + SYS_KILL = 129 + SYS_TKILL = 130 + SYS_TGKILL = 131 + SYS_SIGALTSTACK = 132 + SYS_RT_SIGSUSPEND = 133 + SYS_RT_SIGACTION = 134 + SYS_RT_SIGPROCMASK = 135 + SYS_RT_SIGPENDING = 136 + SYS_RT_SIGTIMEDWAIT = 137 + SYS_RT_SIGQUEUEINFO = 138 + SYS_RT_SIGRETURN = 139 + SYS_SETPRIORITY = 140 + SYS_GETPRIORITY = 141 + SYS_REBOOT = 142 + SYS_SETREGID = 143 + SYS_SETGID = 144 + SYS_SETREUID = 145 + SYS_SETUID = 146 + SYS_SETRESUID = 147 + SYS_GETRESUID = 148 + SYS_SETRESGID = 149 + SYS_GETRESGID = 150 + SYS_SETFSUID = 151 + SYS_SETFSGID = 152 + SYS_TIMES = 153 + SYS_SETPGID = 154 + SYS_GETPGID = 155 + SYS_GETSID = 156 + SYS_SETSID = 157 + SYS_GETGROUPS = 158 + SYS_SETGROUPS = 159 + SYS_UNAME = 160 + SYS_SETHOSTNAME = 161 + SYS_SETDOMAINNAME = 162 + SYS_GETRLIMIT = 163 + SYS_SETRLIMIT = 164 + SYS_GETRUSAGE = 165 + SYS_UMASK = 166 + SYS_PRCTL = 167 + SYS_GETCPU = 168 + SYS_GETTIMEOFDAY = 169 + SYS_SETTIMEOFDAY = 170 + SYS_ADJTIMEX = 171 + SYS_GETPID = 172 + SYS_GETPPID = 173 + SYS_GETUID = 174 + SYS_GETEUID = 175 + SYS_GETGID = 176 + SYS_GETEGID = 177 + SYS_GETTID = 178 + SYS_SYSINFO = 179 + SYS_MQ_OPEN = 180 + SYS_MQ_UNLINK = 181 + SYS_MQ_TIMEDSEND = 182 + SYS_MQ_TIMEDRECEIVE = 183 + SYS_MQ_NOTIFY = 184 + SYS_MQ_GETSETATTR = 185 + SYS_MSGGET = 186 + SYS_MSGCTL = 187 + SYS_MSGRCV = 188 + SYS_MSGSND = 189 + SYS_SEMGET = 190 + SYS_SEMCTL = 191 + SYS_SEMTIMEDOP = 192 + SYS_SEMOP = 193 + SYS_SHMGET = 194 + SYS_SHMCTL = 195 + SYS_SHMAT = 196 + SYS_SHMDT = 197 + SYS_SOCKET = 198 + SYS_SOCKETPAIR = 199 + SYS_BIND = 200 + SYS_LISTEN = 201 + SYS_ACCEPT = 202 + SYS_CONNECT = 203 + SYS_GETSOCKNAME = 204 + SYS_GETPEERNAME = 205 + SYS_SENDTO = 206 + SYS_RECVFROM = 207 + SYS_SETSOCKOPT = 208 + SYS_GETSOCKOPT = 209 + SYS_SHUTDOWN = 210 + SYS_SENDMSG = 211 + SYS_RECVMSG = 212 + SYS_READAHEAD = 213 + SYS_BRK = 214 + SYS_MUNMAP = 215 + SYS_MREMAP = 216 + SYS_ADD_KEY = 217 + SYS_REQUEST_KEY = 218 + SYS_KEYCTL = 219 + SYS_CLONE = 220 + SYS_EXECVE = 221 + SYS_MMAP = 222 + SYS_FADVISE64 = 223 + SYS_SWAPON = 224 + SYS_SWAPOFF = 225 + SYS_MPROTECT = 226 + SYS_MSYNC = 227 + SYS_MLOCK = 228 + SYS_MUNLOCK = 229 + SYS_MLOCKALL = 230 + SYS_MUNLOCKALL = 231 + SYS_MINCORE = 232 + SYS_MADVISE = 233 + SYS_REMAP_FILE_PAGES = 234 + SYS_MBIND = 235 + SYS_GET_MEMPOLICY = 236 + SYS_SET_MEMPOLICY = 237 + SYS_MIGRATE_PAGES = 238 + SYS_MOVE_PAGES = 239 + SYS_RT_TGSIGQUEUEINFO = 240 + SYS_PERF_EVENT_OPEN = 241 + SYS_ACCEPT4 = 242 + SYS_RECVMMSG = 243 + SYS_ARCH_SPECIFIC_SYSCALL = 244 + SYS_WAIT4 = 260 + SYS_PRLIMIT64 = 261 + SYS_FANOTIFY_INIT = 262 + SYS_FANOTIFY_MARK = 263 + SYS_NAME_TO_HANDLE_AT = 264 + SYS_OPEN_BY_HANDLE_AT = 265 + SYS_CLOCK_ADJTIME = 266 + SYS_SYNCFS = 267 + SYS_SETNS = 268 + SYS_SENDMMSG = 269 + SYS_PROCESS_VM_READV = 270 + SYS_PROCESS_VM_WRITEV = 271 + SYS_KCMP = 272 + SYS_FINIT_MODULE = 273 + SYS_SCHED_SETATTR = 274 + SYS_SCHED_GETATTR = 275 + SYS_RENAMEAT2 = 276 + SYS_SECCOMP = 277 + SYS_GETRANDOM = 278 + SYS_MEMFD_CREATE = 279 + SYS_BPF = 280 + SYS_EXECVEAT = 281 + SYS_USERFAULTFD = 282 + SYS_MEMBARRIER = 283 + SYS_MLOCK2 = 284 + SYS_COPY_FILE_RANGE = 285 + SYS_PREADV2 = 286 + SYS_PWRITEV2 = 287 + SYS_PKEY_MPROTECT = 288 + SYS_PKEY_ALLOC = 289 + SYS_PKEY_FREE = 290 + SYS_STATX = 291 + SYS_IO_PGETEVENTS = 292 + SYS_RSEQ = 293 + SYS_KEXEC_FILE_LOAD = 294 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 + SYS_MEMFD_SECRET = 447 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 68bb6d29b8..026695abb1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -1,6 +1,7 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips && linux // +build mips,linux package unix @@ -416,6 +417,15 @@ const ( SYS_FSPICK = 4433 SYS_PIDFD_OPEN = 4434 SYS_CLONE3 = 4435 + SYS_CLOSE_RANGE = 4436 SYS_OPENAT2 = 4437 SYS_PIDFD_GETFD = 4438 + SYS_FACCESSAT2 = 4439 + SYS_PROCESS_MADVISE = 4440 + SYS_EPOLL_PWAIT2 = 4441 + SYS_MOUNT_SETATTR = 4442 + SYS_QUOTACTL_FD = 4443 + SYS_LANDLOCK_CREATE_RULESET = 4444 + SYS_LANDLOCK_ADD_RULE = 4445 + SYS_LANDLOCK_RESTRICT_SELF = 4446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 4e5251185f..7320ba9583 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -1,351 +1,361 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && linux // +build mips64,linux package unix const ( - SYS_READ = 5000 - SYS_WRITE = 5001 - SYS_OPEN = 5002 - SYS_CLOSE = 5003 - SYS_STAT = 5004 - SYS_FSTAT = 5005 - SYS_LSTAT = 5006 - SYS_POLL = 5007 - SYS_LSEEK = 5008 - SYS_MMAP = 5009 - SYS_MPROTECT = 5010 - SYS_MUNMAP = 5011 - SYS_BRK = 5012 - SYS_RT_SIGACTION = 5013 - SYS_RT_SIGPROCMASK = 5014 - SYS_IOCTL = 5015 - SYS_PREAD64 = 5016 - SYS_PWRITE64 = 5017 - SYS_READV = 5018 - SYS_WRITEV = 5019 - SYS_ACCESS = 5020 - SYS_PIPE = 5021 - SYS__NEWSELECT = 5022 - SYS_SCHED_YIELD = 5023 - SYS_MREMAP = 5024 - SYS_MSYNC = 5025 - SYS_MINCORE = 5026 - SYS_MADVISE = 5027 - SYS_SHMGET = 5028 - SYS_SHMAT = 5029 - SYS_SHMCTL = 5030 - SYS_DUP = 5031 - SYS_DUP2 = 5032 - SYS_PAUSE = 5033 - SYS_NANOSLEEP = 5034 - SYS_GETITIMER = 5035 - SYS_SETITIMER = 5036 - SYS_ALARM = 5037 - SYS_GETPID = 5038 - SYS_SENDFILE = 5039 - SYS_SOCKET = 5040 - SYS_CONNECT = 5041 - SYS_ACCEPT = 5042 - SYS_SENDTO = 5043 - SYS_RECVFROM = 5044 - SYS_SENDMSG = 5045 - SYS_RECVMSG = 5046 - SYS_SHUTDOWN = 5047 - SYS_BIND = 5048 - SYS_LISTEN = 5049 - SYS_GETSOCKNAME = 5050 - SYS_GETPEERNAME = 5051 - SYS_SOCKETPAIR = 5052 - SYS_SETSOCKOPT = 5053 - SYS_GETSOCKOPT = 5054 - SYS_CLONE = 5055 - SYS_FORK = 5056 - SYS_EXECVE = 5057 - SYS_EXIT = 5058 - SYS_WAIT4 = 5059 - SYS_KILL = 5060 - SYS_UNAME = 5061 - SYS_SEMGET = 5062 - SYS_SEMOP = 5063 - SYS_SEMCTL = 5064 - SYS_SHMDT = 5065 - SYS_MSGGET = 5066 - SYS_MSGSND = 5067 - SYS_MSGRCV = 5068 - SYS_MSGCTL = 5069 - SYS_FCNTL = 5070 - SYS_FLOCK = 5071 - SYS_FSYNC = 5072 - SYS_FDATASYNC = 5073 - SYS_TRUNCATE = 5074 - SYS_FTRUNCATE = 5075 - SYS_GETDENTS = 5076 - SYS_GETCWD = 5077 - SYS_CHDIR = 5078 - SYS_FCHDIR = 5079 - SYS_RENAME = 5080 - SYS_MKDIR = 5081 - SYS_RMDIR = 5082 - SYS_CREAT = 5083 - SYS_LINK = 5084 - SYS_UNLINK = 5085 - SYS_SYMLINK = 5086 - SYS_READLINK = 5087 - SYS_CHMOD = 5088 - SYS_FCHMOD = 5089 - SYS_CHOWN = 5090 - SYS_FCHOWN = 5091 - SYS_LCHOWN = 5092 - SYS_UMASK = 5093 - SYS_GETTIMEOFDAY = 5094 - SYS_GETRLIMIT = 5095 - SYS_GETRUSAGE = 5096 - SYS_SYSINFO = 5097 - SYS_TIMES = 5098 - SYS_PTRACE = 5099 - SYS_GETUID = 5100 - SYS_SYSLOG = 5101 - SYS_GETGID = 5102 - SYS_SETUID = 5103 - SYS_SETGID = 5104 - SYS_GETEUID = 5105 - SYS_GETEGID = 5106 - SYS_SETPGID = 5107 - SYS_GETPPID = 5108 - SYS_GETPGRP = 5109 - SYS_SETSID = 5110 - SYS_SETREUID = 5111 - SYS_SETREGID = 5112 - SYS_GETGROUPS = 5113 - SYS_SETGROUPS = 5114 - SYS_SETRESUID = 5115 - SYS_GETRESUID = 5116 - SYS_SETRESGID = 5117 - SYS_GETRESGID = 5118 - SYS_GETPGID = 5119 - SYS_SETFSUID = 5120 - SYS_SETFSGID = 5121 - SYS_GETSID = 5122 - SYS_CAPGET = 5123 - SYS_CAPSET = 5124 - SYS_RT_SIGPENDING = 5125 - SYS_RT_SIGTIMEDWAIT = 5126 - SYS_RT_SIGQUEUEINFO = 5127 - SYS_RT_SIGSUSPEND = 5128 - SYS_SIGALTSTACK = 5129 - SYS_UTIME = 5130 - SYS_MKNOD = 5131 - SYS_PERSONALITY = 5132 - SYS_USTAT = 5133 - SYS_STATFS = 5134 - SYS_FSTATFS = 5135 - SYS_SYSFS = 5136 - SYS_GETPRIORITY = 5137 - SYS_SETPRIORITY = 5138 - SYS_SCHED_SETPARAM = 5139 - SYS_SCHED_GETPARAM = 5140 - SYS_SCHED_SETSCHEDULER = 5141 - SYS_SCHED_GETSCHEDULER = 5142 - SYS_SCHED_GET_PRIORITY_MAX = 5143 - SYS_SCHED_GET_PRIORITY_MIN = 5144 - SYS_SCHED_RR_GET_INTERVAL = 5145 - SYS_MLOCK = 5146 - SYS_MUNLOCK = 5147 - SYS_MLOCKALL = 5148 - SYS_MUNLOCKALL = 5149 - SYS_VHANGUP = 5150 - SYS_PIVOT_ROOT = 5151 - SYS__SYSCTL = 5152 - SYS_PRCTL = 5153 - SYS_ADJTIMEX = 5154 - SYS_SETRLIMIT = 5155 - SYS_CHROOT = 5156 - SYS_SYNC = 5157 - SYS_ACCT = 5158 - SYS_SETTIMEOFDAY = 5159 - SYS_MOUNT = 5160 - SYS_UMOUNT2 = 5161 - SYS_SWAPON = 5162 - SYS_SWAPOFF = 5163 - SYS_REBOOT = 5164 - SYS_SETHOSTNAME = 5165 - SYS_SETDOMAINNAME = 5166 - SYS_CREATE_MODULE = 5167 - SYS_INIT_MODULE = 5168 - SYS_DELETE_MODULE = 5169 - SYS_GET_KERNEL_SYMS = 5170 - SYS_QUERY_MODULE = 5171 - SYS_QUOTACTL = 5172 - SYS_NFSSERVCTL = 5173 - SYS_GETPMSG = 5174 - SYS_PUTPMSG = 5175 - SYS_AFS_SYSCALL = 5176 - SYS_RESERVED177 = 5177 - SYS_GETTID = 5178 - SYS_READAHEAD = 5179 - SYS_SETXATTR = 5180 - SYS_LSETXATTR = 5181 - SYS_FSETXATTR = 5182 - SYS_GETXATTR = 5183 - SYS_LGETXATTR = 5184 - SYS_FGETXATTR = 5185 - SYS_LISTXATTR = 5186 - SYS_LLISTXATTR = 5187 - SYS_FLISTXATTR = 5188 - SYS_REMOVEXATTR = 5189 - SYS_LREMOVEXATTR = 5190 - SYS_FREMOVEXATTR = 5191 - SYS_TKILL = 5192 - SYS_RESERVED193 = 5193 - SYS_FUTEX = 5194 - SYS_SCHED_SETAFFINITY = 5195 - SYS_SCHED_GETAFFINITY = 5196 - SYS_CACHEFLUSH = 5197 - SYS_CACHECTL = 5198 - SYS_SYSMIPS = 5199 - SYS_IO_SETUP = 5200 - SYS_IO_DESTROY = 5201 - SYS_IO_GETEVENTS = 5202 - SYS_IO_SUBMIT = 5203 - SYS_IO_CANCEL = 5204 - SYS_EXIT_GROUP = 5205 - SYS_LOOKUP_DCOOKIE = 5206 - SYS_EPOLL_CREATE = 5207 - SYS_EPOLL_CTL = 5208 - SYS_EPOLL_WAIT = 5209 - SYS_REMAP_FILE_PAGES = 5210 - SYS_RT_SIGRETURN = 5211 - SYS_SET_TID_ADDRESS = 5212 - SYS_RESTART_SYSCALL = 5213 - SYS_SEMTIMEDOP = 5214 - SYS_FADVISE64 = 5215 - SYS_TIMER_CREATE = 5216 - SYS_TIMER_SETTIME = 5217 - SYS_TIMER_GETTIME = 5218 - SYS_TIMER_GETOVERRUN = 5219 - SYS_TIMER_DELETE = 5220 - SYS_CLOCK_SETTIME = 5221 - SYS_CLOCK_GETTIME = 5222 - SYS_CLOCK_GETRES = 5223 - SYS_CLOCK_NANOSLEEP = 5224 - SYS_TGKILL = 5225 - SYS_UTIMES = 5226 - SYS_MBIND = 5227 - SYS_GET_MEMPOLICY = 5228 - SYS_SET_MEMPOLICY = 5229 - SYS_MQ_OPEN = 5230 - SYS_MQ_UNLINK = 5231 - SYS_MQ_TIMEDSEND = 5232 - SYS_MQ_TIMEDRECEIVE = 5233 - SYS_MQ_NOTIFY = 5234 - SYS_MQ_GETSETATTR = 5235 - SYS_VSERVER = 5236 - SYS_WAITID = 5237 - SYS_ADD_KEY = 5239 - SYS_REQUEST_KEY = 5240 - SYS_KEYCTL = 5241 - SYS_SET_THREAD_AREA = 5242 - SYS_INOTIFY_INIT = 5243 - SYS_INOTIFY_ADD_WATCH = 5244 - SYS_INOTIFY_RM_WATCH = 5245 - SYS_MIGRATE_PAGES = 5246 - SYS_OPENAT = 5247 - SYS_MKDIRAT = 5248 - SYS_MKNODAT = 5249 - SYS_FCHOWNAT = 5250 - SYS_FUTIMESAT = 5251 - SYS_NEWFSTATAT = 5252 - SYS_UNLINKAT = 5253 - SYS_RENAMEAT = 5254 - SYS_LINKAT = 5255 - SYS_SYMLINKAT = 5256 - SYS_READLINKAT = 5257 - SYS_FCHMODAT = 5258 - SYS_FACCESSAT = 5259 - SYS_PSELECT6 = 5260 - SYS_PPOLL = 5261 - SYS_UNSHARE = 5262 - SYS_SPLICE = 5263 - SYS_SYNC_FILE_RANGE = 5264 - SYS_TEE = 5265 - SYS_VMSPLICE = 5266 - SYS_MOVE_PAGES = 5267 - SYS_SET_ROBUST_LIST = 5268 - SYS_GET_ROBUST_LIST = 5269 - SYS_KEXEC_LOAD = 5270 - SYS_GETCPU = 5271 - SYS_EPOLL_PWAIT = 5272 - SYS_IOPRIO_SET = 5273 - SYS_IOPRIO_GET = 5274 - SYS_UTIMENSAT = 5275 - SYS_SIGNALFD = 5276 - SYS_TIMERFD = 5277 - SYS_EVENTFD = 5278 - SYS_FALLOCATE = 5279 - SYS_TIMERFD_CREATE = 5280 - SYS_TIMERFD_GETTIME = 5281 - SYS_TIMERFD_SETTIME = 5282 - SYS_SIGNALFD4 = 5283 - SYS_EVENTFD2 = 5284 - SYS_EPOLL_CREATE1 = 5285 - SYS_DUP3 = 5286 - SYS_PIPE2 = 5287 - SYS_INOTIFY_INIT1 = 5288 - SYS_PREADV = 5289 - SYS_PWRITEV = 5290 - SYS_RT_TGSIGQUEUEINFO = 5291 - SYS_PERF_EVENT_OPEN = 5292 - SYS_ACCEPT4 = 5293 - SYS_RECVMMSG = 5294 - SYS_FANOTIFY_INIT = 5295 - SYS_FANOTIFY_MARK = 5296 - SYS_PRLIMIT64 = 5297 - SYS_NAME_TO_HANDLE_AT = 5298 - SYS_OPEN_BY_HANDLE_AT = 5299 - SYS_CLOCK_ADJTIME = 5300 - SYS_SYNCFS = 5301 - SYS_SENDMMSG = 5302 - SYS_SETNS = 5303 - SYS_PROCESS_VM_READV = 5304 - SYS_PROCESS_VM_WRITEV = 5305 - SYS_KCMP = 5306 - SYS_FINIT_MODULE = 5307 - SYS_GETDENTS64 = 5308 - SYS_SCHED_SETATTR = 5309 - SYS_SCHED_GETATTR = 5310 - SYS_RENAMEAT2 = 5311 - SYS_SECCOMP = 5312 - SYS_GETRANDOM = 5313 - SYS_MEMFD_CREATE = 5314 - SYS_BPF = 5315 - SYS_EXECVEAT = 5316 - SYS_USERFAULTFD = 5317 - SYS_MEMBARRIER = 5318 - SYS_MLOCK2 = 5319 - SYS_COPY_FILE_RANGE = 5320 - SYS_PREADV2 = 5321 - SYS_PWRITEV2 = 5322 - SYS_PKEY_MPROTECT = 5323 - SYS_PKEY_ALLOC = 5324 - SYS_PKEY_FREE = 5325 - SYS_STATX = 5326 - SYS_RSEQ = 5327 - SYS_IO_PGETEVENTS = 5328 - SYS_PIDFD_SEND_SIGNAL = 5424 - SYS_IO_URING_SETUP = 5425 - SYS_IO_URING_ENTER = 5426 - SYS_IO_URING_REGISTER = 5427 - SYS_OPEN_TREE = 5428 - SYS_MOVE_MOUNT = 5429 - SYS_FSOPEN = 5430 - SYS_FSCONFIG = 5431 - SYS_FSMOUNT = 5432 - SYS_FSPICK = 5433 - SYS_PIDFD_OPEN = 5434 - SYS_CLONE3 = 5435 - SYS_OPENAT2 = 5437 - SYS_PIDFD_GETFD = 5438 + SYS_READ = 5000 + SYS_WRITE = 5001 + SYS_OPEN = 5002 + SYS_CLOSE = 5003 + SYS_STAT = 5004 + SYS_FSTAT = 5005 + SYS_LSTAT = 5006 + SYS_POLL = 5007 + SYS_LSEEK = 5008 + SYS_MMAP = 5009 + SYS_MPROTECT = 5010 + SYS_MUNMAP = 5011 + SYS_BRK = 5012 + SYS_RT_SIGACTION = 5013 + SYS_RT_SIGPROCMASK = 5014 + SYS_IOCTL = 5015 + SYS_PREAD64 = 5016 + SYS_PWRITE64 = 5017 + SYS_READV = 5018 + SYS_WRITEV = 5019 + SYS_ACCESS = 5020 + SYS_PIPE = 5021 + SYS__NEWSELECT = 5022 + SYS_SCHED_YIELD = 5023 + SYS_MREMAP = 5024 + SYS_MSYNC = 5025 + SYS_MINCORE = 5026 + SYS_MADVISE = 5027 + SYS_SHMGET = 5028 + SYS_SHMAT = 5029 + SYS_SHMCTL = 5030 + SYS_DUP = 5031 + SYS_DUP2 = 5032 + SYS_PAUSE = 5033 + SYS_NANOSLEEP = 5034 + SYS_GETITIMER = 5035 + SYS_SETITIMER = 5036 + SYS_ALARM = 5037 + SYS_GETPID = 5038 + SYS_SENDFILE = 5039 + SYS_SOCKET = 5040 + SYS_CONNECT = 5041 + SYS_ACCEPT = 5042 + SYS_SENDTO = 5043 + SYS_RECVFROM = 5044 + SYS_SENDMSG = 5045 + SYS_RECVMSG = 5046 + SYS_SHUTDOWN = 5047 + SYS_BIND = 5048 + SYS_LISTEN = 5049 + SYS_GETSOCKNAME = 5050 + SYS_GETPEERNAME = 5051 + SYS_SOCKETPAIR = 5052 + SYS_SETSOCKOPT = 5053 + SYS_GETSOCKOPT = 5054 + SYS_CLONE = 5055 + SYS_FORK = 5056 + SYS_EXECVE = 5057 + SYS_EXIT = 5058 + SYS_WAIT4 = 5059 + SYS_KILL = 5060 + SYS_UNAME = 5061 + SYS_SEMGET = 5062 + SYS_SEMOP = 5063 + SYS_SEMCTL = 5064 + SYS_SHMDT = 5065 + SYS_MSGGET = 5066 + SYS_MSGSND = 5067 + SYS_MSGRCV = 5068 + SYS_MSGCTL = 5069 + SYS_FCNTL = 5070 + SYS_FLOCK = 5071 + SYS_FSYNC = 5072 + SYS_FDATASYNC = 5073 + SYS_TRUNCATE = 5074 + SYS_FTRUNCATE = 5075 + SYS_GETDENTS = 5076 + SYS_GETCWD = 5077 + SYS_CHDIR = 5078 + SYS_FCHDIR = 5079 + SYS_RENAME = 5080 + SYS_MKDIR = 5081 + SYS_RMDIR = 5082 + SYS_CREAT = 5083 + SYS_LINK = 5084 + SYS_UNLINK = 5085 + SYS_SYMLINK = 5086 + SYS_READLINK = 5087 + SYS_CHMOD = 5088 + SYS_FCHMOD = 5089 + SYS_CHOWN = 5090 + SYS_FCHOWN = 5091 + SYS_LCHOWN = 5092 + SYS_UMASK = 5093 + SYS_GETTIMEOFDAY = 5094 + SYS_GETRLIMIT = 5095 + SYS_GETRUSAGE = 5096 + SYS_SYSINFO = 5097 + SYS_TIMES = 5098 + SYS_PTRACE = 5099 + SYS_GETUID = 5100 + SYS_SYSLOG = 5101 + SYS_GETGID = 5102 + SYS_SETUID = 5103 + SYS_SETGID = 5104 + SYS_GETEUID = 5105 + SYS_GETEGID = 5106 + SYS_SETPGID = 5107 + SYS_GETPPID = 5108 + SYS_GETPGRP = 5109 + SYS_SETSID = 5110 + SYS_SETREUID = 5111 + SYS_SETREGID = 5112 + SYS_GETGROUPS = 5113 + SYS_SETGROUPS = 5114 + SYS_SETRESUID = 5115 + SYS_GETRESUID = 5116 + SYS_SETRESGID = 5117 + SYS_GETRESGID = 5118 + SYS_GETPGID = 5119 + SYS_SETFSUID = 5120 + SYS_SETFSGID = 5121 + SYS_GETSID = 5122 + SYS_CAPGET = 5123 + SYS_CAPSET = 5124 + SYS_RT_SIGPENDING = 5125 + SYS_RT_SIGTIMEDWAIT = 5126 + SYS_RT_SIGQUEUEINFO = 5127 + SYS_RT_SIGSUSPEND = 5128 + SYS_SIGALTSTACK = 5129 + SYS_UTIME = 5130 + SYS_MKNOD = 5131 + SYS_PERSONALITY = 5132 + SYS_USTAT = 5133 + SYS_STATFS = 5134 + SYS_FSTATFS = 5135 + SYS_SYSFS = 5136 + SYS_GETPRIORITY = 5137 + SYS_SETPRIORITY = 5138 + SYS_SCHED_SETPARAM = 5139 + SYS_SCHED_GETPARAM = 5140 + SYS_SCHED_SETSCHEDULER = 5141 + SYS_SCHED_GETSCHEDULER = 5142 + SYS_SCHED_GET_PRIORITY_MAX = 5143 + SYS_SCHED_GET_PRIORITY_MIN = 5144 + SYS_SCHED_RR_GET_INTERVAL = 5145 + SYS_MLOCK = 5146 + SYS_MUNLOCK = 5147 + SYS_MLOCKALL = 5148 + SYS_MUNLOCKALL = 5149 + SYS_VHANGUP = 5150 + SYS_PIVOT_ROOT = 5151 + SYS__SYSCTL = 5152 + SYS_PRCTL = 5153 + SYS_ADJTIMEX = 5154 + SYS_SETRLIMIT = 5155 + SYS_CHROOT = 5156 + SYS_SYNC = 5157 + SYS_ACCT = 5158 + SYS_SETTIMEOFDAY = 5159 + SYS_MOUNT = 5160 + SYS_UMOUNT2 = 5161 + SYS_SWAPON = 5162 + SYS_SWAPOFF = 5163 + SYS_REBOOT = 5164 + SYS_SETHOSTNAME = 5165 + SYS_SETDOMAINNAME = 5166 + SYS_CREATE_MODULE = 5167 + SYS_INIT_MODULE = 5168 + SYS_DELETE_MODULE = 5169 + SYS_GET_KERNEL_SYMS = 5170 + SYS_QUERY_MODULE = 5171 + SYS_QUOTACTL = 5172 + SYS_NFSSERVCTL = 5173 + SYS_GETPMSG = 5174 + SYS_PUTPMSG = 5175 + SYS_AFS_SYSCALL = 5176 + SYS_RESERVED177 = 5177 + SYS_GETTID = 5178 + SYS_READAHEAD = 5179 + SYS_SETXATTR = 5180 + SYS_LSETXATTR = 5181 + SYS_FSETXATTR = 5182 + SYS_GETXATTR = 5183 + SYS_LGETXATTR = 5184 + SYS_FGETXATTR = 5185 + SYS_LISTXATTR = 5186 + SYS_LLISTXATTR = 5187 + SYS_FLISTXATTR = 5188 + SYS_REMOVEXATTR = 5189 + SYS_LREMOVEXATTR = 5190 + SYS_FREMOVEXATTR = 5191 + SYS_TKILL = 5192 + SYS_RESERVED193 = 5193 + SYS_FUTEX = 5194 + SYS_SCHED_SETAFFINITY = 5195 + SYS_SCHED_GETAFFINITY = 5196 + SYS_CACHEFLUSH = 5197 + SYS_CACHECTL = 5198 + SYS_SYSMIPS = 5199 + SYS_IO_SETUP = 5200 + SYS_IO_DESTROY = 5201 + SYS_IO_GETEVENTS = 5202 + SYS_IO_SUBMIT = 5203 + SYS_IO_CANCEL = 5204 + SYS_EXIT_GROUP = 5205 + SYS_LOOKUP_DCOOKIE = 5206 + SYS_EPOLL_CREATE = 5207 + SYS_EPOLL_CTL = 5208 + SYS_EPOLL_WAIT = 5209 + SYS_REMAP_FILE_PAGES = 5210 + SYS_RT_SIGRETURN = 5211 + SYS_SET_TID_ADDRESS = 5212 + SYS_RESTART_SYSCALL = 5213 + SYS_SEMTIMEDOP = 5214 + SYS_FADVISE64 = 5215 + SYS_TIMER_CREATE = 5216 + SYS_TIMER_SETTIME = 5217 + SYS_TIMER_GETTIME = 5218 + SYS_TIMER_GETOVERRUN = 5219 + SYS_TIMER_DELETE = 5220 + SYS_CLOCK_SETTIME = 5221 + SYS_CLOCK_GETTIME = 5222 + SYS_CLOCK_GETRES = 5223 + SYS_CLOCK_NANOSLEEP = 5224 + SYS_TGKILL = 5225 + SYS_UTIMES = 5226 + SYS_MBIND = 5227 + SYS_GET_MEMPOLICY = 5228 + SYS_SET_MEMPOLICY = 5229 + SYS_MQ_OPEN = 5230 + SYS_MQ_UNLINK = 5231 + SYS_MQ_TIMEDSEND = 5232 + SYS_MQ_TIMEDRECEIVE = 5233 + SYS_MQ_NOTIFY = 5234 + SYS_MQ_GETSETATTR = 5235 + SYS_VSERVER = 5236 + SYS_WAITID = 5237 + SYS_ADD_KEY = 5239 + SYS_REQUEST_KEY = 5240 + SYS_KEYCTL = 5241 + SYS_SET_THREAD_AREA = 5242 + SYS_INOTIFY_INIT = 5243 + SYS_INOTIFY_ADD_WATCH = 5244 + SYS_INOTIFY_RM_WATCH = 5245 + SYS_MIGRATE_PAGES = 5246 + SYS_OPENAT = 5247 + SYS_MKDIRAT = 5248 + SYS_MKNODAT = 5249 + SYS_FCHOWNAT = 5250 + SYS_FUTIMESAT = 5251 + SYS_NEWFSTATAT = 5252 + SYS_UNLINKAT = 5253 + SYS_RENAMEAT = 5254 + SYS_LINKAT = 5255 + SYS_SYMLINKAT = 5256 + SYS_READLINKAT = 5257 + SYS_FCHMODAT = 5258 + SYS_FACCESSAT = 5259 + SYS_PSELECT6 = 5260 + SYS_PPOLL = 5261 + SYS_UNSHARE = 5262 + SYS_SPLICE = 5263 + SYS_SYNC_FILE_RANGE = 5264 + SYS_TEE = 5265 + SYS_VMSPLICE = 5266 + SYS_MOVE_PAGES = 5267 + SYS_SET_ROBUST_LIST = 5268 + SYS_GET_ROBUST_LIST = 5269 + SYS_KEXEC_LOAD = 5270 + SYS_GETCPU = 5271 + SYS_EPOLL_PWAIT = 5272 + SYS_IOPRIO_SET = 5273 + SYS_IOPRIO_GET = 5274 + SYS_UTIMENSAT = 5275 + SYS_SIGNALFD = 5276 + SYS_TIMERFD = 5277 + SYS_EVENTFD = 5278 + SYS_FALLOCATE = 5279 + SYS_TIMERFD_CREATE = 5280 + SYS_TIMERFD_GETTIME = 5281 + SYS_TIMERFD_SETTIME = 5282 + SYS_SIGNALFD4 = 5283 + SYS_EVENTFD2 = 5284 + SYS_EPOLL_CREATE1 = 5285 + SYS_DUP3 = 5286 + SYS_PIPE2 = 5287 + SYS_INOTIFY_INIT1 = 5288 + SYS_PREADV = 5289 + SYS_PWRITEV = 5290 + SYS_RT_TGSIGQUEUEINFO = 5291 + SYS_PERF_EVENT_OPEN = 5292 + SYS_ACCEPT4 = 5293 + SYS_RECVMMSG = 5294 + SYS_FANOTIFY_INIT = 5295 + SYS_FANOTIFY_MARK = 5296 + SYS_PRLIMIT64 = 5297 + SYS_NAME_TO_HANDLE_AT = 5298 + SYS_OPEN_BY_HANDLE_AT = 5299 + SYS_CLOCK_ADJTIME = 5300 + SYS_SYNCFS = 5301 + SYS_SENDMMSG = 5302 + SYS_SETNS = 5303 + SYS_PROCESS_VM_READV = 5304 + SYS_PROCESS_VM_WRITEV = 5305 + SYS_KCMP = 5306 + SYS_FINIT_MODULE = 5307 + SYS_GETDENTS64 = 5308 + SYS_SCHED_SETATTR = 5309 + SYS_SCHED_GETATTR = 5310 + SYS_RENAMEAT2 = 5311 + SYS_SECCOMP = 5312 + SYS_GETRANDOM = 5313 + SYS_MEMFD_CREATE = 5314 + SYS_BPF = 5315 + SYS_EXECVEAT = 5316 + SYS_USERFAULTFD = 5317 + SYS_MEMBARRIER = 5318 + SYS_MLOCK2 = 5319 + SYS_COPY_FILE_RANGE = 5320 + SYS_PREADV2 = 5321 + SYS_PWRITEV2 = 5322 + SYS_PKEY_MPROTECT = 5323 + SYS_PKEY_ALLOC = 5324 + SYS_PKEY_FREE = 5325 + SYS_STATX = 5326 + SYS_RSEQ = 5327 + SYS_IO_PGETEVENTS = 5328 + SYS_PIDFD_SEND_SIGNAL = 5424 + SYS_IO_URING_SETUP = 5425 + SYS_IO_URING_ENTER = 5426 + SYS_IO_URING_REGISTER = 5427 + SYS_OPEN_TREE = 5428 + SYS_MOVE_MOUNT = 5429 + SYS_FSOPEN = 5430 + SYS_FSCONFIG = 5431 + SYS_FSMOUNT = 5432 + SYS_FSPICK = 5433 + SYS_PIDFD_OPEN = 5434 + SYS_CLONE3 = 5435 + SYS_CLOSE_RANGE = 5436 + SYS_OPENAT2 = 5437 + SYS_PIDFD_GETFD = 5438 + SYS_FACCESSAT2 = 5439 + SYS_PROCESS_MADVISE = 5440 + SYS_EPOLL_PWAIT2 = 5441 + SYS_MOUNT_SETATTR = 5442 + SYS_QUOTACTL_FD = 5443 + SYS_LANDLOCK_CREATE_RULESET = 5444 + SYS_LANDLOCK_ADD_RULE = 5445 + SYS_LANDLOCK_RESTRICT_SELF = 5446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 4d9aa3003b..45082dd67f 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -1,351 +1,361 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64le && linux // +build mips64le,linux package unix const ( - SYS_READ = 5000 - SYS_WRITE = 5001 - SYS_OPEN = 5002 - SYS_CLOSE = 5003 - SYS_STAT = 5004 - SYS_FSTAT = 5005 - SYS_LSTAT = 5006 - SYS_POLL = 5007 - SYS_LSEEK = 5008 - SYS_MMAP = 5009 - SYS_MPROTECT = 5010 - SYS_MUNMAP = 5011 - SYS_BRK = 5012 - SYS_RT_SIGACTION = 5013 - SYS_RT_SIGPROCMASK = 5014 - SYS_IOCTL = 5015 - SYS_PREAD64 = 5016 - SYS_PWRITE64 = 5017 - SYS_READV = 5018 - SYS_WRITEV = 5019 - SYS_ACCESS = 5020 - SYS_PIPE = 5021 - SYS__NEWSELECT = 5022 - SYS_SCHED_YIELD = 5023 - SYS_MREMAP = 5024 - SYS_MSYNC = 5025 - SYS_MINCORE = 5026 - SYS_MADVISE = 5027 - SYS_SHMGET = 5028 - SYS_SHMAT = 5029 - SYS_SHMCTL = 5030 - SYS_DUP = 5031 - SYS_DUP2 = 5032 - SYS_PAUSE = 5033 - SYS_NANOSLEEP = 5034 - SYS_GETITIMER = 5035 - SYS_SETITIMER = 5036 - SYS_ALARM = 5037 - SYS_GETPID = 5038 - SYS_SENDFILE = 5039 - SYS_SOCKET = 5040 - SYS_CONNECT = 5041 - SYS_ACCEPT = 5042 - SYS_SENDTO = 5043 - SYS_RECVFROM = 5044 - SYS_SENDMSG = 5045 - SYS_RECVMSG = 5046 - SYS_SHUTDOWN = 5047 - SYS_BIND = 5048 - SYS_LISTEN = 5049 - SYS_GETSOCKNAME = 5050 - SYS_GETPEERNAME = 5051 - SYS_SOCKETPAIR = 5052 - SYS_SETSOCKOPT = 5053 - SYS_GETSOCKOPT = 5054 - SYS_CLONE = 5055 - SYS_FORK = 5056 - SYS_EXECVE = 5057 - SYS_EXIT = 5058 - SYS_WAIT4 = 5059 - SYS_KILL = 5060 - SYS_UNAME = 5061 - SYS_SEMGET = 5062 - SYS_SEMOP = 5063 - SYS_SEMCTL = 5064 - SYS_SHMDT = 5065 - SYS_MSGGET = 5066 - SYS_MSGSND = 5067 - SYS_MSGRCV = 5068 - SYS_MSGCTL = 5069 - SYS_FCNTL = 5070 - SYS_FLOCK = 5071 - SYS_FSYNC = 5072 - SYS_FDATASYNC = 5073 - SYS_TRUNCATE = 5074 - SYS_FTRUNCATE = 5075 - SYS_GETDENTS = 5076 - SYS_GETCWD = 5077 - SYS_CHDIR = 5078 - SYS_FCHDIR = 5079 - SYS_RENAME = 5080 - SYS_MKDIR = 5081 - SYS_RMDIR = 5082 - SYS_CREAT = 5083 - SYS_LINK = 5084 - SYS_UNLINK = 5085 - SYS_SYMLINK = 5086 - SYS_READLINK = 5087 - SYS_CHMOD = 5088 - SYS_FCHMOD = 5089 - SYS_CHOWN = 5090 - SYS_FCHOWN = 5091 - SYS_LCHOWN = 5092 - SYS_UMASK = 5093 - SYS_GETTIMEOFDAY = 5094 - SYS_GETRLIMIT = 5095 - SYS_GETRUSAGE = 5096 - SYS_SYSINFO = 5097 - SYS_TIMES = 5098 - SYS_PTRACE = 5099 - SYS_GETUID = 5100 - SYS_SYSLOG = 5101 - SYS_GETGID = 5102 - SYS_SETUID = 5103 - SYS_SETGID = 5104 - SYS_GETEUID = 5105 - SYS_GETEGID = 5106 - SYS_SETPGID = 5107 - SYS_GETPPID = 5108 - SYS_GETPGRP = 5109 - SYS_SETSID = 5110 - SYS_SETREUID = 5111 - SYS_SETREGID = 5112 - SYS_GETGROUPS = 5113 - SYS_SETGROUPS = 5114 - SYS_SETRESUID = 5115 - SYS_GETRESUID = 5116 - SYS_SETRESGID = 5117 - SYS_GETRESGID = 5118 - SYS_GETPGID = 5119 - SYS_SETFSUID = 5120 - SYS_SETFSGID = 5121 - SYS_GETSID = 5122 - SYS_CAPGET = 5123 - SYS_CAPSET = 5124 - SYS_RT_SIGPENDING = 5125 - SYS_RT_SIGTIMEDWAIT = 5126 - SYS_RT_SIGQUEUEINFO = 5127 - SYS_RT_SIGSUSPEND = 5128 - SYS_SIGALTSTACK = 5129 - SYS_UTIME = 5130 - SYS_MKNOD = 5131 - SYS_PERSONALITY = 5132 - SYS_USTAT = 5133 - SYS_STATFS = 5134 - SYS_FSTATFS = 5135 - SYS_SYSFS = 5136 - SYS_GETPRIORITY = 5137 - SYS_SETPRIORITY = 5138 - SYS_SCHED_SETPARAM = 5139 - SYS_SCHED_GETPARAM = 5140 - SYS_SCHED_SETSCHEDULER = 5141 - SYS_SCHED_GETSCHEDULER = 5142 - SYS_SCHED_GET_PRIORITY_MAX = 5143 - SYS_SCHED_GET_PRIORITY_MIN = 5144 - SYS_SCHED_RR_GET_INTERVAL = 5145 - SYS_MLOCK = 5146 - SYS_MUNLOCK = 5147 - SYS_MLOCKALL = 5148 - SYS_MUNLOCKALL = 5149 - SYS_VHANGUP = 5150 - SYS_PIVOT_ROOT = 5151 - SYS__SYSCTL = 5152 - SYS_PRCTL = 5153 - SYS_ADJTIMEX = 5154 - SYS_SETRLIMIT = 5155 - SYS_CHROOT = 5156 - SYS_SYNC = 5157 - SYS_ACCT = 5158 - SYS_SETTIMEOFDAY = 5159 - SYS_MOUNT = 5160 - SYS_UMOUNT2 = 5161 - SYS_SWAPON = 5162 - SYS_SWAPOFF = 5163 - SYS_REBOOT = 5164 - SYS_SETHOSTNAME = 5165 - SYS_SETDOMAINNAME = 5166 - SYS_CREATE_MODULE = 5167 - SYS_INIT_MODULE = 5168 - SYS_DELETE_MODULE = 5169 - SYS_GET_KERNEL_SYMS = 5170 - SYS_QUERY_MODULE = 5171 - SYS_QUOTACTL = 5172 - SYS_NFSSERVCTL = 5173 - SYS_GETPMSG = 5174 - SYS_PUTPMSG = 5175 - SYS_AFS_SYSCALL = 5176 - SYS_RESERVED177 = 5177 - SYS_GETTID = 5178 - SYS_READAHEAD = 5179 - SYS_SETXATTR = 5180 - SYS_LSETXATTR = 5181 - SYS_FSETXATTR = 5182 - SYS_GETXATTR = 5183 - SYS_LGETXATTR = 5184 - SYS_FGETXATTR = 5185 - SYS_LISTXATTR = 5186 - SYS_LLISTXATTR = 5187 - SYS_FLISTXATTR = 5188 - SYS_REMOVEXATTR = 5189 - SYS_LREMOVEXATTR = 5190 - SYS_FREMOVEXATTR = 5191 - SYS_TKILL = 5192 - SYS_RESERVED193 = 5193 - SYS_FUTEX = 5194 - SYS_SCHED_SETAFFINITY = 5195 - SYS_SCHED_GETAFFINITY = 5196 - SYS_CACHEFLUSH = 5197 - SYS_CACHECTL = 5198 - SYS_SYSMIPS = 5199 - SYS_IO_SETUP = 5200 - SYS_IO_DESTROY = 5201 - SYS_IO_GETEVENTS = 5202 - SYS_IO_SUBMIT = 5203 - SYS_IO_CANCEL = 5204 - SYS_EXIT_GROUP = 5205 - SYS_LOOKUP_DCOOKIE = 5206 - SYS_EPOLL_CREATE = 5207 - SYS_EPOLL_CTL = 5208 - SYS_EPOLL_WAIT = 5209 - SYS_REMAP_FILE_PAGES = 5210 - SYS_RT_SIGRETURN = 5211 - SYS_SET_TID_ADDRESS = 5212 - SYS_RESTART_SYSCALL = 5213 - SYS_SEMTIMEDOP = 5214 - SYS_FADVISE64 = 5215 - SYS_TIMER_CREATE = 5216 - SYS_TIMER_SETTIME = 5217 - SYS_TIMER_GETTIME = 5218 - SYS_TIMER_GETOVERRUN = 5219 - SYS_TIMER_DELETE = 5220 - SYS_CLOCK_SETTIME = 5221 - SYS_CLOCK_GETTIME = 5222 - SYS_CLOCK_GETRES = 5223 - SYS_CLOCK_NANOSLEEP = 5224 - SYS_TGKILL = 5225 - SYS_UTIMES = 5226 - SYS_MBIND = 5227 - SYS_GET_MEMPOLICY = 5228 - SYS_SET_MEMPOLICY = 5229 - SYS_MQ_OPEN = 5230 - SYS_MQ_UNLINK = 5231 - SYS_MQ_TIMEDSEND = 5232 - SYS_MQ_TIMEDRECEIVE = 5233 - SYS_MQ_NOTIFY = 5234 - SYS_MQ_GETSETATTR = 5235 - SYS_VSERVER = 5236 - SYS_WAITID = 5237 - SYS_ADD_KEY = 5239 - SYS_REQUEST_KEY = 5240 - SYS_KEYCTL = 5241 - SYS_SET_THREAD_AREA = 5242 - SYS_INOTIFY_INIT = 5243 - SYS_INOTIFY_ADD_WATCH = 5244 - SYS_INOTIFY_RM_WATCH = 5245 - SYS_MIGRATE_PAGES = 5246 - SYS_OPENAT = 5247 - SYS_MKDIRAT = 5248 - SYS_MKNODAT = 5249 - SYS_FCHOWNAT = 5250 - SYS_FUTIMESAT = 5251 - SYS_NEWFSTATAT = 5252 - SYS_UNLINKAT = 5253 - SYS_RENAMEAT = 5254 - SYS_LINKAT = 5255 - SYS_SYMLINKAT = 5256 - SYS_READLINKAT = 5257 - SYS_FCHMODAT = 5258 - SYS_FACCESSAT = 5259 - SYS_PSELECT6 = 5260 - SYS_PPOLL = 5261 - SYS_UNSHARE = 5262 - SYS_SPLICE = 5263 - SYS_SYNC_FILE_RANGE = 5264 - SYS_TEE = 5265 - SYS_VMSPLICE = 5266 - SYS_MOVE_PAGES = 5267 - SYS_SET_ROBUST_LIST = 5268 - SYS_GET_ROBUST_LIST = 5269 - SYS_KEXEC_LOAD = 5270 - SYS_GETCPU = 5271 - SYS_EPOLL_PWAIT = 5272 - SYS_IOPRIO_SET = 5273 - SYS_IOPRIO_GET = 5274 - SYS_UTIMENSAT = 5275 - SYS_SIGNALFD = 5276 - SYS_TIMERFD = 5277 - SYS_EVENTFD = 5278 - SYS_FALLOCATE = 5279 - SYS_TIMERFD_CREATE = 5280 - SYS_TIMERFD_GETTIME = 5281 - SYS_TIMERFD_SETTIME = 5282 - SYS_SIGNALFD4 = 5283 - SYS_EVENTFD2 = 5284 - SYS_EPOLL_CREATE1 = 5285 - SYS_DUP3 = 5286 - SYS_PIPE2 = 5287 - SYS_INOTIFY_INIT1 = 5288 - SYS_PREADV = 5289 - SYS_PWRITEV = 5290 - SYS_RT_TGSIGQUEUEINFO = 5291 - SYS_PERF_EVENT_OPEN = 5292 - SYS_ACCEPT4 = 5293 - SYS_RECVMMSG = 5294 - SYS_FANOTIFY_INIT = 5295 - SYS_FANOTIFY_MARK = 5296 - SYS_PRLIMIT64 = 5297 - SYS_NAME_TO_HANDLE_AT = 5298 - SYS_OPEN_BY_HANDLE_AT = 5299 - SYS_CLOCK_ADJTIME = 5300 - SYS_SYNCFS = 5301 - SYS_SENDMMSG = 5302 - SYS_SETNS = 5303 - SYS_PROCESS_VM_READV = 5304 - SYS_PROCESS_VM_WRITEV = 5305 - SYS_KCMP = 5306 - SYS_FINIT_MODULE = 5307 - SYS_GETDENTS64 = 5308 - SYS_SCHED_SETATTR = 5309 - SYS_SCHED_GETATTR = 5310 - SYS_RENAMEAT2 = 5311 - SYS_SECCOMP = 5312 - SYS_GETRANDOM = 5313 - SYS_MEMFD_CREATE = 5314 - SYS_BPF = 5315 - SYS_EXECVEAT = 5316 - SYS_USERFAULTFD = 5317 - SYS_MEMBARRIER = 5318 - SYS_MLOCK2 = 5319 - SYS_COPY_FILE_RANGE = 5320 - SYS_PREADV2 = 5321 - SYS_PWRITEV2 = 5322 - SYS_PKEY_MPROTECT = 5323 - SYS_PKEY_ALLOC = 5324 - SYS_PKEY_FREE = 5325 - SYS_STATX = 5326 - SYS_RSEQ = 5327 - SYS_IO_PGETEVENTS = 5328 - SYS_PIDFD_SEND_SIGNAL = 5424 - SYS_IO_URING_SETUP = 5425 - SYS_IO_URING_ENTER = 5426 - SYS_IO_URING_REGISTER = 5427 - SYS_OPEN_TREE = 5428 - SYS_MOVE_MOUNT = 5429 - SYS_FSOPEN = 5430 - SYS_FSCONFIG = 5431 - SYS_FSMOUNT = 5432 - SYS_FSPICK = 5433 - SYS_PIDFD_OPEN = 5434 - SYS_CLONE3 = 5435 - SYS_OPENAT2 = 5437 - SYS_PIDFD_GETFD = 5438 + SYS_READ = 5000 + SYS_WRITE = 5001 + SYS_OPEN = 5002 + SYS_CLOSE = 5003 + SYS_STAT = 5004 + SYS_FSTAT = 5005 + SYS_LSTAT = 5006 + SYS_POLL = 5007 + SYS_LSEEK = 5008 + SYS_MMAP = 5009 + SYS_MPROTECT = 5010 + SYS_MUNMAP = 5011 + SYS_BRK = 5012 + SYS_RT_SIGACTION = 5013 + SYS_RT_SIGPROCMASK = 5014 + SYS_IOCTL = 5015 + SYS_PREAD64 = 5016 + SYS_PWRITE64 = 5017 + SYS_READV = 5018 + SYS_WRITEV = 5019 + SYS_ACCESS = 5020 + SYS_PIPE = 5021 + SYS__NEWSELECT = 5022 + SYS_SCHED_YIELD = 5023 + SYS_MREMAP = 5024 + SYS_MSYNC = 5025 + SYS_MINCORE = 5026 + SYS_MADVISE = 5027 + SYS_SHMGET = 5028 + SYS_SHMAT = 5029 + SYS_SHMCTL = 5030 + SYS_DUP = 5031 + SYS_DUP2 = 5032 + SYS_PAUSE = 5033 + SYS_NANOSLEEP = 5034 + SYS_GETITIMER = 5035 + SYS_SETITIMER = 5036 + SYS_ALARM = 5037 + SYS_GETPID = 5038 + SYS_SENDFILE = 5039 + SYS_SOCKET = 5040 + SYS_CONNECT = 5041 + SYS_ACCEPT = 5042 + SYS_SENDTO = 5043 + SYS_RECVFROM = 5044 + SYS_SENDMSG = 5045 + SYS_RECVMSG = 5046 + SYS_SHUTDOWN = 5047 + SYS_BIND = 5048 + SYS_LISTEN = 5049 + SYS_GETSOCKNAME = 5050 + SYS_GETPEERNAME = 5051 + SYS_SOCKETPAIR = 5052 + SYS_SETSOCKOPT = 5053 + SYS_GETSOCKOPT = 5054 + SYS_CLONE = 5055 + SYS_FORK = 5056 + SYS_EXECVE = 5057 + SYS_EXIT = 5058 + SYS_WAIT4 = 5059 + SYS_KILL = 5060 + SYS_UNAME = 5061 + SYS_SEMGET = 5062 + SYS_SEMOP = 5063 + SYS_SEMCTL = 5064 + SYS_SHMDT = 5065 + SYS_MSGGET = 5066 + SYS_MSGSND = 5067 + SYS_MSGRCV = 5068 + SYS_MSGCTL = 5069 + SYS_FCNTL = 5070 + SYS_FLOCK = 5071 + SYS_FSYNC = 5072 + SYS_FDATASYNC = 5073 + SYS_TRUNCATE = 5074 + SYS_FTRUNCATE = 5075 + SYS_GETDENTS = 5076 + SYS_GETCWD = 5077 + SYS_CHDIR = 5078 + SYS_FCHDIR = 5079 + SYS_RENAME = 5080 + SYS_MKDIR = 5081 + SYS_RMDIR = 5082 + SYS_CREAT = 5083 + SYS_LINK = 5084 + SYS_UNLINK = 5085 + SYS_SYMLINK = 5086 + SYS_READLINK = 5087 + SYS_CHMOD = 5088 + SYS_FCHMOD = 5089 + SYS_CHOWN = 5090 + SYS_FCHOWN = 5091 + SYS_LCHOWN = 5092 + SYS_UMASK = 5093 + SYS_GETTIMEOFDAY = 5094 + SYS_GETRLIMIT = 5095 + SYS_GETRUSAGE = 5096 + SYS_SYSINFO = 5097 + SYS_TIMES = 5098 + SYS_PTRACE = 5099 + SYS_GETUID = 5100 + SYS_SYSLOG = 5101 + SYS_GETGID = 5102 + SYS_SETUID = 5103 + SYS_SETGID = 5104 + SYS_GETEUID = 5105 + SYS_GETEGID = 5106 + SYS_SETPGID = 5107 + SYS_GETPPID = 5108 + SYS_GETPGRP = 5109 + SYS_SETSID = 5110 + SYS_SETREUID = 5111 + SYS_SETREGID = 5112 + SYS_GETGROUPS = 5113 + SYS_SETGROUPS = 5114 + SYS_SETRESUID = 5115 + SYS_GETRESUID = 5116 + SYS_SETRESGID = 5117 + SYS_GETRESGID = 5118 + SYS_GETPGID = 5119 + SYS_SETFSUID = 5120 + SYS_SETFSGID = 5121 + SYS_GETSID = 5122 + SYS_CAPGET = 5123 + SYS_CAPSET = 5124 + SYS_RT_SIGPENDING = 5125 + SYS_RT_SIGTIMEDWAIT = 5126 + SYS_RT_SIGQUEUEINFO = 5127 + SYS_RT_SIGSUSPEND = 5128 + SYS_SIGALTSTACK = 5129 + SYS_UTIME = 5130 + SYS_MKNOD = 5131 + SYS_PERSONALITY = 5132 + SYS_USTAT = 5133 + SYS_STATFS = 5134 + SYS_FSTATFS = 5135 + SYS_SYSFS = 5136 + SYS_GETPRIORITY = 5137 + SYS_SETPRIORITY = 5138 + SYS_SCHED_SETPARAM = 5139 + SYS_SCHED_GETPARAM = 5140 + SYS_SCHED_SETSCHEDULER = 5141 + SYS_SCHED_GETSCHEDULER = 5142 + SYS_SCHED_GET_PRIORITY_MAX = 5143 + SYS_SCHED_GET_PRIORITY_MIN = 5144 + SYS_SCHED_RR_GET_INTERVAL = 5145 + SYS_MLOCK = 5146 + SYS_MUNLOCK = 5147 + SYS_MLOCKALL = 5148 + SYS_MUNLOCKALL = 5149 + SYS_VHANGUP = 5150 + SYS_PIVOT_ROOT = 5151 + SYS__SYSCTL = 5152 + SYS_PRCTL = 5153 + SYS_ADJTIMEX = 5154 + SYS_SETRLIMIT = 5155 + SYS_CHROOT = 5156 + SYS_SYNC = 5157 + SYS_ACCT = 5158 + SYS_SETTIMEOFDAY = 5159 + SYS_MOUNT = 5160 + SYS_UMOUNT2 = 5161 + SYS_SWAPON = 5162 + SYS_SWAPOFF = 5163 + SYS_REBOOT = 5164 + SYS_SETHOSTNAME = 5165 + SYS_SETDOMAINNAME = 5166 + SYS_CREATE_MODULE = 5167 + SYS_INIT_MODULE = 5168 + SYS_DELETE_MODULE = 5169 + SYS_GET_KERNEL_SYMS = 5170 + SYS_QUERY_MODULE = 5171 + SYS_QUOTACTL = 5172 + SYS_NFSSERVCTL = 5173 + SYS_GETPMSG = 5174 + SYS_PUTPMSG = 5175 + SYS_AFS_SYSCALL = 5176 + SYS_RESERVED177 = 5177 + SYS_GETTID = 5178 + SYS_READAHEAD = 5179 + SYS_SETXATTR = 5180 + SYS_LSETXATTR = 5181 + SYS_FSETXATTR = 5182 + SYS_GETXATTR = 5183 + SYS_LGETXATTR = 5184 + SYS_FGETXATTR = 5185 + SYS_LISTXATTR = 5186 + SYS_LLISTXATTR = 5187 + SYS_FLISTXATTR = 5188 + SYS_REMOVEXATTR = 5189 + SYS_LREMOVEXATTR = 5190 + SYS_FREMOVEXATTR = 5191 + SYS_TKILL = 5192 + SYS_RESERVED193 = 5193 + SYS_FUTEX = 5194 + SYS_SCHED_SETAFFINITY = 5195 + SYS_SCHED_GETAFFINITY = 5196 + SYS_CACHEFLUSH = 5197 + SYS_CACHECTL = 5198 + SYS_SYSMIPS = 5199 + SYS_IO_SETUP = 5200 + SYS_IO_DESTROY = 5201 + SYS_IO_GETEVENTS = 5202 + SYS_IO_SUBMIT = 5203 + SYS_IO_CANCEL = 5204 + SYS_EXIT_GROUP = 5205 + SYS_LOOKUP_DCOOKIE = 5206 + SYS_EPOLL_CREATE = 5207 + SYS_EPOLL_CTL = 5208 + SYS_EPOLL_WAIT = 5209 + SYS_REMAP_FILE_PAGES = 5210 + SYS_RT_SIGRETURN = 5211 + SYS_SET_TID_ADDRESS = 5212 + SYS_RESTART_SYSCALL = 5213 + SYS_SEMTIMEDOP = 5214 + SYS_FADVISE64 = 5215 + SYS_TIMER_CREATE = 5216 + SYS_TIMER_SETTIME = 5217 + SYS_TIMER_GETTIME = 5218 + SYS_TIMER_GETOVERRUN = 5219 + SYS_TIMER_DELETE = 5220 + SYS_CLOCK_SETTIME = 5221 + SYS_CLOCK_GETTIME = 5222 + SYS_CLOCK_GETRES = 5223 + SYS_CLOCK_NANOSLEEP = 5224 + SYS_TGKILL = 5225 + SYS_UTIMES = 5226 + SYS_MBIND = 5227 + SYS_GET_MEMPOLICY = 5228 + SYS_SET_MEMPOLICY = 5229 + SYS_MQ_OPEN = 5230 + SYS_MQ_UNLINK = 5231 + SYS_MQ_TIMEDSEND = 5232 + SYS_MQ_TIMEDRECEIVE = 5233 + SYS_MQ_NOTIFY = 5234 + SYS_MQ_GETSETATTR = 5235 + SYS_VSERVER = 5236 + SYS_WAITID = 5237 + SYS_ADD_KEY = 5239 + SYS_REQUEST_KEY = 5240 + SYS_KEYCTL = 5241 + SYS_SET_THREAD_AREA = 5242 + SYS_INOTIFY_INIT = 5243 + SYS_INOTIFY_ADD_WATCH = 5244 + SYS_INOTIFY_RM_WATCH = 5245 + SYS_MIGRATE_PAGES = 5246 + SYS_OPENAT = 5247 + SYS_MKDIRAT = 5248 + SYS_MKNODAT = 5249 + SYS_FCHOWNAT = 5250 + SYS_FUTIMESAT = 5251 + SYS_NEWFSTATAT = 5252 + SYS_UNLINKAT = 5253 + SYS_RENAMEAT = 5254 + SYS_LINKAT = 5255 + SYS_SYMLINKAT = 5256 + SYS_READLINKAT = 5257 + SYS_FCHMODAT = 5258 + SYS_FACCESSAT = 5259 + SYS_PSELECT6 = 5260 + SYS_PPOLL = 5261 + SYS_UNSHARE = 5262 + SYS_SPLICE = 5263 + SYS_SYNC_FILE_RANGE = 5264 + SYS_TEE = 5265 + SYS_VMSPLICE = 5266 + SYS_MOVE_PAGES = 5267 + SYS_SET_ROBUST_LIST = 5268 + SYS_GET_ROBUST_LIST = 5269 + SYS_KEXEC_LOAD = 5270 + SYS_GETCPU = 5271 + SYS_EPOLL_PWAIT = 5272 + SYS_IOPRIO_SET = 5273 + SYS_IOPRIO_GET = 5274 + SYS_UTIMENSAT = 5275 + SYS_SIGNALFD = 5276 + SYS_TIMERFD = 5277 + SYS_EVENTFD = 5278 + SYS_FALLOCATE = 5279 + SYS_TIMERFD_CREATE = 5280 + SYS_TIMERFD_GETTIME = 5281 + SYS_TIMERFD_SETTIME = 5282 + SYS_SIGNALFD4 = 5283 + SYS_EVENTFD2 = 5284 + SYS_EPOLL_CREATE1 = 5285 + SYS_DUP3 = 5286 + SYS_PIPE2 = 5287 + SYS_INOTIFY_INIT1 = 5288 + SYS_PREADV = 5289 + SYS_PWRITEV = 5290 + SYS_RT_TGSIGQUEUEINFO = 5291 + SYS_PERF_EVENT_OPEN = 5292 + SYS_ACCEPT4 = 5293 + SYS_RECVMMSG = 5294 + SYS_FANOTIFY_INIT = 5295 + SYS_FANOTIFY_MARK = 5296 + SYS_PRLIMIT64 = 5297 + SYS_NAME_TO_HANDLE_AT = 5298 + SYS_OPEN_BY_HANDLE_AT = 5299 + SYS_CLOCK_ADJTIME = 5300 + SYS_SYNCFS = 5301 + SYS_SENDMMSG = 5302 + SYS_SETNS = 5303 + SYS_PROCESS_VM_READV = 5304 + SYS_PROCESS_VM_WRITEV = 5305 + SYS_KCMP = 5306 + SYS_FINIT_MODULE = 5307 + SYS_GETDENTS64 = 5308 + SYS_SCHED_SETATTR = 5309 + SYS_SCHED_GETATTR = 5310 + SYS_RENAMEAT2 = 5311 + SYS_SECCOMP = 5312 + SYS_GETRANDOM = 5313 + SYS_MEMFD_CREATE = 5314 + SYS_BPF = 5315 + SYS_EXECVEAT = 5316 + SYS_USERFAULTFD = 5317 + SYS_MEMBARRIER = 5318 + SYS_MLOCK2 = 5319 + SYS_COPY_FILE_RANGE = 5320 + SYS_PREADV2 = 5321 + SYS_PWRITEV2 = 5322 + SYS_PKEY_MPROTECT = 5323 + SYS_PKEY_ALLOC = 5324 + SYS_PKEY_FREE = 5325 + SYS_STATX = 5326 + SYS_RSEQ = 5327 + SYS_IO_PGETEVENTS = 5328 + SYS_PIDFD_SEND_SIGNAL = 5424 + SYS_IO_URING_SETUP = 5425 + SYS_IO_URING_ENTER = 5426 + SYS_IO_URING_REGISTER = 5427 + SYS_OPEN_TREE = 5428 + SYS_MOVE_MOUNT = 5429 + SYS_FSOPEN = 5430 + SYS_FSCONFIG = 5431 + SYS_FSMOUNT = 5432 + SYS_FSPICK = 5433 + SYS_PIDFD_OPEN = 5434 + SYS_CLONE3 = 5435 + SYS_CLOSE_RANGE = 5436 + SYS_OPENAT2 = 5437 + SYS_PIDFD_GETFD = 5438 + SYS_FACCESSAT2 = 5439 + SYS_PROCESS_MADVISE = 5440 + SYS_EPOLL_PWAIT2 = 5441 + SYS_MOUNT_SETATTR = 5442 + SYS_QUOTACTL_FD = 5443 + SYS_LANDLOCK_CREATE_RULESET = 5444 + SYS_LANDLOCK_ADD_RULE = 5445 + SYS_LANDLOCK_RESTRICT_SELF = 5446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 64af0707d5..570a857a56 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -1,6 +1,7 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mipsle && linux // +build mipsle,linux package unix @@ -416,6 +417,15 @@ const ( SYS_FSPICK = 4433 SYS_PIDFD_OPEN = 4434 SYS_CLONE3 = 4435 + SYS_CLOSE_RANGE = 4436 SYS_OPENAT2 = 4437 SYS_PIDFD_GETFD = 4438 + SYS_FACCESSAT2 = 4439 + SYS_PROCESS_MADVISE = 4440 + SYS_EPOLL_PWAIT2 = 4441 + SYS_MOUNT_SETATTR = 4442 + SYS_QUOTACTL_FD = 4443 + SYS_LANDLOCK_CREATE_RULESET = 4444 + SYS_LANDLOCK_ADD_RULE = 4445 + SYS_LANDLOCK_RESTRICT_SELF = 4446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go new file mode 100644 index 0000000000..638498d62e --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -0,0 +1,438 @@ +// go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc && linux +// +build ppc,linux + +package unix + +const ( + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86 = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_QUERY_MODULE = 166 + SYS_POLL = 167 + SYS_NFSSERVCTL = 168 + SYS_SETRESGID = 169 + SYS_GETRESGID = 170 + SYS_PRCTL = 171 + SYS_RT_SIGRETURN = 172 + SYS_RT_SIGACTION = 173 + SYS_RT_SIGPROCMASK = 174 + SYS_RT_SIGPENDING = 175 + SYS_RT_SIGTIMEDWAIT = 176 + SYS_RT_SIGQUEUEINFO = 177 + SYS_RT_SIGSUSPEND = 178 + SYS_PREAD64 = 179 + SYS_PWRITE64 = 180 + SYS_CHOWN = 181 + SYS_GETCWD = 182 + SYS_CAPGET = 183 + SYS_CAPSET = 184 + SYS_SIGALTSTACK = 185 + SYS_SENDFILE = 186 + SYS_GETPMSG = 187 + SYS_PUTPMSG = 188 + SYS_VFORK = 189 + SYS_UGETRLIMIT = 190 + SYS_READAHEAD = 191 + SYS_MMAP2 = 192 + SYS_TRUNCATE64 = 193 + SYS_FTRUNCATE64 = 194 + SYS_STAT64 = 195 + SYS_LSTAT64 = 196 + SYS_FSTAT64 = 197 + SYS_PCICONFIG_READ = 198 + SYS_PCICONFIG_WRITE = 199 + SYS_PCICONFIG_IOBASE = 200 + SYS_MULTIPLEXER = 201 + SYS_GETDENTS64 = 202 + SYS_PIVOT_ROOT = 203 + SYS_FCNTL64 = 204 + SYS_MADVISE = 205 + SYS_MINCORE = 206 + SYS_GETTID = 207 + SYS_TKILL = 208 + SYS_SETXATTR = 209 + SYS_LSETXATTR = 210 + SYS_FSETXATTR = 211 + SYS_GETXATTR = 212 + SYS_LGETXATTR = 213 + SYS_FGETXATTR = 214 + SYS_LISTXATTR = 215 + SYS_LLISTXATTR = 216 + SYS_FLISTXATTR = 217 + SYS_REMOVEXATTR = 218 + SYS_LREMOVEXATTR = 219 + SYS_FREMOVEXATTR = 220 + SYS_FUTEX = 221 + SYS_SCHED_SETAFFINITY = 222 + SYS_SCHED_GETAFFINITY = 223 + SYS_TUXCALL = 225 + SYS_SENDFILE64 = 226 + SYS_IO_SETUP = 227 + SYS_IO_DESTROY = 228 + SYS_IO_GETEVENTS = 229 + SYS_IO_SUBMIT = 230 + SYS_IO_CANCEL = 231 + SYS_SET_TID_ADDRESS = 232 + SYS_FADVISE64 = 233 + SYS_EXIT_GROUP = 234 + SYS_LOOKUP_DCOOKIE = 235 + SYS_EPOLL_CREATE = 236 + SYS_EPOLL_CTL = 237 + SYS_EPOLL_WAIT = 238 + SYS_REMAP_FILE_PAGES = 239 + SYS_TIMER_CREATE = 240 + SYS_TIMER_SETTIME = 241 + SYS_TIMER_GETTIME = 242 + SYS_TIMER_GETOVERRUN = 243 + SYS_TIMER_DELETE = 244 + SYS_CLOCK_SETTIME = 245 + SYS_CLOCK_GETTIME = 246 + SYS_CLOCK_GETRES = 247 + SYS_CLOCK_NANOSLEEP = 248 + SYS_SWAPCONTEXT = 249 + SYS_TGKILL = 250 + SYS_UTIMES = 251 + SYS_STATFS64 = 252 + SYS_FSTATFS64 = 253 + SYS_FADVISE64_64 = 254 + SYS_RTAS = 255 + SYS_SYS_DEBUG_SETCONTEXT = 256 + SYS_MIGRATE_PAGES = 258 + SYS_MBIND = 259 + SYS_GET_MEMPOLICY = 260 + SYS_SET_MEMPOLICY = 261 + SYS_MQ_OPEN = 262 + SYS_MQ_UNLINK = 263 + SYS_MQ_TIMEDSEND = 264 + SYS_MQ_TIMEDRECEIVE = 265 + SYS_MQ_NOTIFY = 266 + SYS_MQ_GETSETATTR = 267 + SYS_KEXEC_LOAD = 268 + SYS_ADD_KEY = 269 + SYS_REQUEST_KEY = 270 + SYS_KEYCTL = 271 + SYS_WAITID = 272 + SYS_IOPRIO_SET = 273 + SYS_IOPRIO_GET = 274 + SYS_INOTIFY_INIT = 275 + SYS_INOTIFY_ADD_WATCH = 276 + SYS_INOTIFY_RM_WATCH = 277 + SYS_SPU_RUN = 278 + SYS_SPU_CREATE = 279 + SYS_PSELECT6 = 280 + SYS_PPOLL = 281 + SYS_UNSHARE = 282 + SYS_SPLICE = 283 + SYS_TEE = 284 + SYS_VMSPLICE = 285 + SYS_OPENAT = 286 + SYS_MKDIRAT = 287 + SYS_MKNODAT = 288 + SYS_FCHOWNAT = 289 + SYS_FUTIMESAT = 290 + SYS_FSTATAT64 = 291 + SYS_UNLINKAT = 292 + SYS_RENAMEAT = 293 + SYS_LINKAT = 294 + SYS_SYMLINKAT = 295 + SYS_READLINKAT = 296 + SYS_FCHMODAT = 297 + SYS_FACCESSAT = 298 + SYS_GET_ROBUST_LIST = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_MOVE_PAGES = 301 + SYS_GETCPU = 302 + SYS_EPOLL_PWAIT = 303 + SYS_UTIMENSAT = 304 + SYS_SIGNALFD = 305 + SYS_TIMERFD_CREATE = 306 + SYS_EVENTFD = 307 + SYS_SYNC_FILE_RANGE2 = 308 + SYS_FALLOCATE = 309 + SYS_SUBPAGE_PROT = 310 + SYS_TIMERFD_SETTIME = 311 + SYS_TIMERFD_GETTIME = 312 + SYS_SIGNALFD4 = 313 + SYS_EVENTFD2 = 314 + SYS_EPOLL_CREATE1 = 315 + SYS_DUP3 = 316 + SYS_PIPE2 = 317 + SYS_INOTIFY_INIT1 = 318 + SYS_PERF_EVENT_OPEN = 319 + SYS_PREADV = 320 + SYS_PWRITEV = 321 + SYS_RT_TGSIGQUEUEINFO = 322 + SYS_FANOTIFY_INIT = 323 + SYS_FANOTIFY_MARK = 324 + SYS_PRLIMIT64 = 325 + SYS_SOCKET = 326 + SYS_BIND = 327 + SYS_CONNECT = 328 + SYS_LISTEN = 329 + SYS_ACCEPT = 330 + SYS_GETSOCKNAME = 331 + SYS_GETPEERNAME = 332 + SYS_SOCKETPAIR = 333 + SYS_SEND = 334 + SYS_SENDTO = 335 + SYS_RECV = 336 + SYS_RECVFROM = 337 + SYS_SHUTDOWN = 338 + SYS_SETSOCKOPT = 339 + SYS_GETSOCKOPT = 340 + SYS_SENDMSG = 341 + SYS_RECVMSG = 342 + SYS_RECVMMSG = 343 + SYS_ACCEPT4 = 344 + SYS_NAME_TO_HANDLE_AT = 345 + SYS_OPEN_BY_HANDLE_AT = 346 + SYS_CLOCK_ADJTIME = 347 + SYS_SYNCFS = 348 + SYS_SENDMMSG = 349 + SYS_SETNS = 350 + SYS_PROCESS_VM_READV = 351 + SYS_PROCESS_VM_WRITEV = 352 + SYS_FINIT_MODULE = 353 + SYS_KCMP = 354 + SYS_SCHED_SETATTR = 355 + SYS_SCHED_GETATTR = 356 + SYS_RENAMEAT2 = 357 + SYS_SECCOMP = 358 + SYS_GETRANDOM = 359 + SYS_MEMFD_CREATE = 360 + SYS_BPF = 361 + SYS_EXECVEAT = 362 + SYS_SWITCH_ENDIAN = 363 + SYS_USERFAULTFD = 364 + SYS_MEMBARRIER = 365 + SYS_MLOCK2 = 378 + SYS_COPY_FILE_RANGE = 379 + SYS_PREADV2 = 380 + SYS_PWRITEV2 = 381 + SYS_KEXEC_FILE_LOAD = 382 + SYS_STATX = 383 + SYS_PKEY_ALLOC = 384 + SYS_PKEY_FREE = 385 + SYS_PKEY_MPROTECT = 386 + SYS_RSEQ = 387 + SYS_IO_PGETEVENTS = 388 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_CLOCK_GETTIME64 = 403 + SYS_CLOCK_SETTIME64 = 404 + SYS_CLOCK_ADJTIME64 = 405 + SYS_CLOCK_GETRES_TIME64 = 406 + SYS_CLOCK_NANOSLEEP_TIME64 = 407 + SYS_TIMER_GETTIME64 = 408 + SYS_TIMER_SETTIME64 = 409 + SYS_TIMERFD_GETTIME64 = 410 + SYS_TIMERFD_SETTIME64 = 411 + SYS_UTIMENSAT_TIME64 = 412 + SYS_PSELECT6_TIME64 = 413 + SYS_PPOLL_TIME64 = 414 + SYS_IO_PGETEVENTS_TIME64 = 416 + SYS_RECVMMSG_TIME64 = 417 + SYS_MQ_TIMEDSEND_TIME64 = 418 + SYS_MQ_TIMEDRECEIVE_TIME64 = 419 + SYS_SEMTIMEDOP_TIME64 = 420 + SYS_RT_SIGTIMEDWAIT_TIME64 = 421 + SYS_FUTEX_TIME64 = 422 + SYS_SCHED_RR_GET_INTERVAL_TIME64 = 423 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 +) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index cc3c067ba3..702beebfef 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -1,400 +1,410 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && linux // +build ppc64,linux package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86 = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_QUERY_MODULE = 166 - SYS_POLL = 167 - SYS_NFSSERVCTL = 168 - SYS_SETRESGID = 169 - SYS_GETRESGID = 170 - SYS_PRCTL = 171 - SYS_RT_SIGRETURN = 172 - SYS_RT_SIGACTION = 173 - SYS_RT_SIGPROCMASK = 174 - SYS_RT_SIGPENDING = 175 - SYS_RT_SIGTIMEDWAIT = 176 - SYS_RT_SIGQUEUEINFO = 177 - SYS_RT_SIGSUSPEND = 178 - SYS_PREAD64 = 179 - SYS_PWRITE64 = 180 - SYS_CHOWN = 181 - SYS_GETCWD = 182 - SYS_CAPGET = 183 - SYS_CAPSET = 184 - SYS_SIGALTSTACK = 185 - SYS_SENDFILE = 186 - SYS_GETPMSG = 187 - SYS_PUTPMSG = 188 - SYS_VFORK = 189 - SYS_UGETRLIMIT = 190 - SYS_READAHEAD = 191 - SYS_PCICONFIG_READ = 198 - SYS_PCICONFIG_WRITE = 199 - SYS_PCICONFIG_IOBASE = 200 - SYS_MULTIPLEXER = 201 - SYS_GETDENTS64 = 202 - SYS_PIVOT_ROOT = 203 - SYS_MADVISE = 205 - SYS_MINCORE = 206 - SYS_GETTID = 207 - SYS_TKILL = 208 - SYS_SETXATTR = 209 - SYS_LSETXATTR = 210 - SYS_FSETXATTR = 211 - SYS_GETXATTR = 212 - SYS_LGETXATTR = 213 - SYS_FGETXATTR = 214 - SYS_LISTXATTR = 215 - SYS_LLISTXATTR = 216 - SYS_FLISTXATTR = 217 - SYS_REMOVEXATTR = 218 - SYS_LREMOVEXATTR = 219 - SYS_FREMOVEXATTR = 220 - SYS_FUTEX = 221 - SYS_SCHED_SETAFFINITY = 222 - SYS_SCHED_GETAFFINITY = 223 - SYS_TUXCALL = 225 - SYS_IO_SETUP = 227 - SYS_IO_DESTROY = 228 - SYS_IO_GETEVENTS = 229 - SYS_IO_SUBMIT = 230 - SYS_IO_CANCEL = 231 - SYS_SET_TID_ADDRESS = 232 - SYS_FADVISE64 = 233 - SYS_EXIT_GROUP = 234 - SYS_LOOKUP_DCOOKIE = 235 - SYS_EPOLL_CREATE = 236 - SYS_EPOLL_CTL = 237 - SYS_EPOLL_WAIT = 238 - SYS_REMAP_FILE_PAGES = 239 - SYS_TIMER_CREATE = 240 - SYS_TIMER_SETTIME = 241 - SYS_TIMER_GETTIME = 242 - SYS_TIMER_GETOVERRUN = 243 - SYS_TIMER_DELETE = 244 - SYS_CLOCK_SETTIME = 245 - SYS_CLOCK_GETTIME = 246 - SYS_CLOCK_GETRES = 247 - SYS_CLOCK_NANOSLEEP = 248 - SYS_SWAPCONTEXT = 249 - SYS_TGKILL = 250 - SYS_UTIMES = 251 - SYS_STATFS64 = 252 - SYS_FSTATFS64 = 253 - SYS_RTAS = 255 - SYS_SYS_DEBUG_SETCONTEXT = 256 - SYS_MIGRATE_PAGES = 258 - SYS_MBIND = 259 - SYS_GET_MEMPOLICY = 260 - SYS_SET_MEMPOLICY = 261 - SYS_MQ_OPEN = 262 - SYS_MQ_UNLINK = 263 - SYS_MQ_TIMEDSEND = 264 - SYS_MQ_TIMEDRECEIVE = 265 - SYS_MQ_NOTIFY = 266 - SYS_MQ_GETSETATTR = 267 - SYS_KEXEC_LOAD = 268 - SYS_ADD_KEY = 269 - SYS_REQUEST_KEY = 270 - SYS_KEYCTL = 271 - SYS_WAITID = 272 - SYS_IOPRIO_SET = 273 - SYS_IOPRIO_GET = 274 - SYS_INOTIFY_INIT = 275 - SYS_INOTIFY_ADD_WATCH = 276 - SYS_INOTIFY_RM_WATCH = 277 - SYS_SPU_RUN = 278 - SYS_SPU_CREATE = 279 - SYS_PSELECT6 = 280 - SYS_PPOLL = 281 - SYS_UNSHARE = 282 - SYS_SPLICE = 283 - SYS_TEE = 284 - SYS_VMSPLICE = 285 - SYS_OPENAT = 286 - SYS_MKDIRAT = 287 - SYS_MKNODAT = 288 - SYS_FCHOWNAT = 289 - SYS_FUTIMESAT = 290 - SYS_NEWFSTATAT = 291 - SYS_UNLINKAT = 292 - SYS_RENAMEAT = 293 - SYS_LINKAT = 294 - SYS_SYMLINKAT = 295 - SYS_READLINKAT = 296 - SYS_FCHMODAT = 297 - SYS_FACCESSAT = 298 - SYS_GET_ROBUST_LIST = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_MOVE_PAGES = 301 - SYS_GETCPU = 302 - SYS_EPOLL_PWAIT = 303 - SYS_UTIMENSAT = 304 - SYS_SIGNALFD = 305 - SYS_TIMERFD_CREATE = 306 - SYS_EVENTFD = 307 - SYS_SYNC_FILE_RANGE2 = 308 - SYS_FALLOCATE = 309 - SYS_SUBPAGE_PROT = 310 - SYS_TIMERFD_SETTIME = 311 - SYS_TIMERFD_GETTIME = 312 - SYS_SIGNALFD4 = 313 - SYS_EVENTFD2 = 314 - SYS_EPOLL_CREATE1 = 315 - SYS_DUP3 = 316 - SYS_PIPE2 = 317 - SYS_INOTIFY_INIT1 = 318 - SYS_PERF_EVENT_OPEN = 319 - SYS_PREADV = 320 - SYS_PWRITEV = 321 - SYS_RT_TGSIGQUEUEINFO = 322 - SYS_FANOTIFY_INIT = 323 - SYS_FANOTIFY_MARK = 324 - SYS_PRLIMIT64 = 325 - SYS_SOCKET = 326 - SYS_BIND = 327 - SYS_CONNECT = 328 - SYS_LISTEN = 329 - SYS_ACCEPT = 330 - SYS_GETSOCKNAME = 331 - SYS_GETPEERNAME = 332 - SYS_SOCKETPAIR = 333 - SYS_SEND = 334 - SYS_SENDTO = 335 - SYS_RECV = 336 - SYS_RECVFROM = 337 - SYS_SHUTDOWN = 338 - SYS_SETSOCKOPT = 339 - SYS_GETSOCKOPT = 340 - SYS_SENDMSG = 341 - SYS_RECVMSG = 342 - SYS_RECVMMSG = 343 - SYS_ACCEPT4 = 344 - SYS_NAME_TO_HANDLE_AT = 345 - SYS_OPEN_BY_HANDLE_AT = 346 - SYS_CLOCK_ADJTIME = 347 - SYS_SYNCFS = 348 - SYS_SENDMMSG = 349 - SYS_SETNS = 350 - SYS_PROCESS_VM_READV = 351 - SYS_PROCESS_VM_WRITEV = 352 - SYS_FINIT_MODULE = 353 - SYS_KCMP = 354 - SYS_SCHED_SETATTR = 355 - SYS_SCHED_GETATTR = 356 - SYS_RENAMEAT2 = 357 - SYS_SECCOMP = 358 - SYS_GETRANDOM = 359 - SYS_MEMFD_CREATE = 360 - SYS_BPF = 361 - SYS_EXECVEAT = 362 - SYS_SWITCH_ENDIAN = 363 - SYS_USERFAULTFD = 364 - SYS_MEMBARRIER = 365 - SYS_MLOCK2 = 378 - SYS_COPY_FILE_RANGE = 379 - SYS_PREADV2 = 380 - SYS_PWRITEV2 = 381 - SYS_KEXEC_FILE_LOAD = 382 - SYS_STATX = 383 - SYS_PKEY_ALLOC = 384 - SYS_PKEY_FREE = 385 - SYS_PKEY_MPROTECT = 386 - SYS_RSEQ = 387 - SYS_IO_PGETEVENTS = 388 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86 = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_QUERY_MODULE = 166 + SYS_POLL = 167 + SYS_NFSSERVCTL = 168 + SYS_SETRESGID = 169 + SYS_GETRESGID = 170 + SYS_PRCTL = 171 + SYS_RT_SIGRETURN = 172 + SYS_RT_SIGACTION = 173 + SYS_RT_SIGPROCMASK = 174 + SYS_RT_SIGPENDING = 175 + SYS_RT_SIGTIMEDWAIT = 176 + SYS_RT_SIGQUEUEINFO = 177 + SYS_RT_SIGSUSPEND = 178 + SYS_PREAD64 = 179 + SYS_PWRITE64 = 180 + SYS_CHOWN = 181 + SYS_GETCWD = 182 + SYS_CAPGET = 183 + SYS_CAPSET = 184 + SYS_SIGALTSTACK = 185 + SYS_SENDFILE = 186 + SYS_GETPMSG = 187 + SYS_PUTPMSG = 188 + SYS_VFORK = 189 + SYS_UGETRLIMIT = 190 + SYS_READAHEAD = 191 + SYS_PCICONFIG_READ = 198 + SYS_PCICONFIG_WRITE = 199 + SYS_PCICONFIG_IOBASE = 200 + SYS_MULTIPLEXER = 201 + SYS_GETDENTS64 = 202 + SYS_PIVOT_ROOT = 203 + SYS_MADVISE = 205 + SYS_MINCORE = 206 + SYS_GETTID = 207 + SYS_TKILL = 208 + SYS_SETXATTR = 209 + SYS_LSETXATTR = 210 + SYS_FSETXATTR = 211 + SYS_GETXATTR = 212 + SYS_LGETXATTR = 213 + SYS_FGETXATTR = 214 + SYS_LISTXATTR = 215 + SYS_LLISTXATTR = 216 + SYS_FLISTXATTR = 217 + SYS_REMOVEXATTR = 218 + SYS_LREMOVEXATTR = 219 + SYS_FREMOVEXATTR = 220 + SYS_FUTEX = 221 + SYS_SCHED_SETAFFINITY = 222 + SYS_SCHED_GETAFFINITY = 223 + SYS_TUXCALL = 225 + SYS_IO_SETUP = 227 + SYS_IO_DESTROY = 228 + SYS_IO_GETEVENTS = 229 + SYS_IO_SUBMIT = 230 + SYS_IO_CANCEL = 231 + SYS_SET_TID_ADDRESS = 232 + SYS_FADVISE64 = 233 + SYS_EXIT_GROUP = 234 + SYS_LOOKUP_DCOOKIE = 235 + SYS_EPOLL_CREATE = 236 + SYS_EPOLL_CTL = 237 + SYS_EPOLL_WAIT = 238 + SYS_REMAP_FILE_PAGES = 239 + SYS_TIMER_CREATE = 240 + SYS_TIMER_SETTIME = 241 + SYS_TIMER_GETTIME = 242 + SYS_TIMER_GETOVERRUN = 243 + SYS_TIMER_DELETE = 244 + SYS_CLOCK_SETTIME = 245 + SYS_CLOCK_GETTIME = 246 + SYS_CLOCK_GETRES = 247 + SYS_CLOCK_NANOSLEEP = 248 + SYS_SWAPCONTEXT = 249 + SYS_TGKILL = 250 + SYS_UTIMES = 251 + SYS_STATFS64 = 252 + SYS_FSTATFS64 = 253 + SYS_RTAS = 255 + SYS_SYS_DEBUG_SETCONTEXT = 256 + SYS_MIGRATE_PAGES = 258 + SYS_MBIND = 259 + SYS_GET_MEMPOLICY = 260 + SYS_SET_MEMPOLICY = 261 + SYS_MQ_OPEN = 262 + SYS_MQ_UNLINK = 263 + SYS_MQ_TIMEDSEND = 264 + SYS_MQ_TIMEDRECEIVE = 265 + SYS_MQ_NOTIFY = 266 + SYS_MQ_GETSETATTR = 267 + SYS_KEXEC_LOAD = 268 + SYS_ADD_KEY = 269 + SYS_REQUEST_KEY = 270 + SYS_KEYCTL = 271 + SYS_WAITID = 272 + SYS_IOPRIO_SET = 273 + SYS_IOPRIO_GET = 274 + SYS_INOTIFY_INIT = 275 + SYS_INOTIFY_ADD_WATCH = 276 + SYS_INOTIFY_RM_WATCH = 277 + SYS_SPU_RUN = 278 + SYS_SPU_CREATE = 279 + SYS_PSELECT6 = 280 + SYS_PPOLL = 281 + SYS_UNSHARE = 282 + SYS_SPLICE = 283 + SYS_TEE = 284 + SYS_VMSPLICE = 285 + SYS_OPENAT = 286 + SYS_MKDIRAT = 287 + SYS_MKNODAT = 288 + SYS_FCHOWNAT = 289 + SYS_FUTIMESAT = 290 + SYS_NEWFSTATAT = 291 + SYS_UNLINKAT = 292 + SYS_RENAMEAT = 293 + SYS_LINKAT = 294 + SYS_SYMLINKAT = 295 + SYS_READLINKAT = 296 + SYS_FCHMODAT = 297 + SYS_FACCESSAT = 298 + SYS_GET_ROBUST_LIST = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_MOVE_PAGES = 301 + SYS_GETCPU = 302 + SYS_EPOLL_PWAIT = 303 + SYS_UTIMENSAT = 304 + SYS_SIGNALFD = 305 + SYS_TIMERFD_CREATE = 306 + SYS_EVENTFD = 307 + SYS_SYNC_FILE_RANGE2 = 308 + SYS_FALLOCATE = 309 + SYS_SUBPAGE_PROT = 310 + SYS_TIMERFD_SETTIME = 311 + SYS_TIMERFD_GETTIME = 312 + SYS_SIGNALFD4 = 313 + SYS_EVENTFD2 = 314 + SYS_EPOLL_CREATE1 = 315 + SYS_DUP3 = 316 + SYS_PIPE2 = 317 + SYS_INOTIFY_INIT1 = 318 + SYS_PERF_EVENT_OPEN = 319 + SYS_PREADV = 320 + SYS_PWRITEV = 321 + SYS_RT_TGSIGQUEUEINFO = 322 + SYS_FANOTIFY_INIT = 323 + SYS_FANOTIFY_MARK = 324 + SYS_PRLIMIT64 = 325 + SYS_SOCKET = 326 + SYS_BIND = 327 + SYS_CONNECT = 328 + SYS_LISTEN = 329 + SYS_ACCEPT = 330 + SYS_GETSOCKNAME = 331 + SYS_GETPEERNAME = 332 + SYS_SOCKETPAIR = 333 + SYS_SEND = 334 + SYS_SENDTO = 335 + SYS_RECV = 336 + SYS_RECVFROM = 337 + SYS_SHUTDOWN = 338 + SYS_SETSOCKOPT = 339 + SYS_GETSOCKOPT = 340 + SYS_SENDMSG = 341 + SYS_RECVMSG = 342 + SYS_RECVMMSG = 343 + SYS_ACCEPT4 = 344 + SYS_NAME_TO_HANDLE_AT = 345 + SYS_OPEN_BY_HANDLE_AT = 346 + SYS_CLOCK_ADJTIME = 347 + SYS_SYNCFS = 348 + SYS_SENDMMSG = 349 + SYS_SETNS = 350 + SYS_PROCESS_VM_READV = 351 + SYS_PROCESS_VM_WRITEV = 352 + SYS_FINIT_MODULE = 353 + SYS_KCMP = 354 + SYS_SCHED_SETATTR = 355 + SYS_SCHED_GETATTR = 356 + SYS_RENAMEAT2 = 357 + SYS_SECCOMP = 358 + SYS_GETRANDOM = 359 + SYS_MEMFD_CREATE = 360 + SYS_BPF = 361 + SYS_EXECVEAT = 362 + SYS_SWITCH_ENDIAN = 363 + SYS_USERFAULTFD = 364 + SYS_MEMBARRIER = 365 + SYS_MLOCK2 = 378 + SYS_COPY_FILE_RANGE = 379 + SYS_PREADV2 = 380 + SYS_PWRITEV2 = 381 + SYS_KEXEC_FILE_LOAD = 382 + SYS_STATX = 383 + SYS_PKEY_ALLOC = 384 + SYS_PKEY_FREE = 385 + SYS_PKEY_MPROTECT = 386 + SYS_RSEQ = 387 + SYS_IO_PGETEVENTS = 388 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 4050ff9836..bfc87ea444 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -1,400 +1,410 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64le && linux // +build ppc64le,linux package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAITPID = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_TIME = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BREAK = 17 - SYS_OLDSTAT = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_STIME = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_OLDFSTAT = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_STTY = 31 - SYS_GTTY = 32 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_FTIME = 35 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_PROF = 44 - SYS_BRK = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_LOCK = 53 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_MPX = 56 - SYS_SETPGID = 57 - SYS_ULIMIT = 58 - SYS_OLDOLDUNAME = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SGETMASK = 68 - SYS_SSETMASK = 69 - SYS_SETREUID = 70 - SYS_SETREGID = 71 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRLIMIT = 76 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_GETGROUPS = 80 - SYS_SETGROUPS = 81 - SYS_SELECT = 82 - SYS_SYMLINK = 83 - SYS_OLDLSTAT = 84 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_FCHOWN = 95 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_PROFIL = 98 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_IOPERM = 101 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_OLDUNAME = 109 - SYS_IOPL = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_VM86 = 113 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_MODIFY_LDT = 123 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_SETFSUID = 138 - SYS_SETFSGID = 139 - SYS__LLSEEK = 140 - SYS_GETDENTS = 141 - SYS__NEWSELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_SETRESUID = 164 - SYS_GETRESUID = 165 - SYS_QUERY_MODULE = 166 - SYS_POLL = 167 - SYS_NFSSERVCTL = 168 - SYS_SETRESGID = 169 - SYS_GETRESGID = 170 - SYS_PRCTL = 171 - SYS_RT_SIGRETURN = 172 - SYS_RT_SIGACTION = 173 - SYS_RT_SIGPROCMASK = 174 - SYS_RT_SIGPENDING = 175 - SYS_RT_SIGTIMEDWAIT = 176 - SYS_RT_SIGQUEUEINFO = 177 - SYS_RT_SIGSUSPEND = 178 - SYS_PREAD64 = 179 - SYS_PWRITE64 = 180 - SYS_CHOWN = 181 - SYS_GETCWD = 182 - SYS_CAPGET = 183 - SYS_CAPSET = 184 - SYS_SIGALTSTACK = 185 - SYS_SENDFILE = 186 - SYS_GETPMSG = 187 - SYS_PUTPMSG = 188 - SYS_VFORK = 189 - SYS_UGETRLIMIT = 190 - SYS_READAHEAD = 191 - SYS_PCICONFIG_READ = 198 - SYS_PCICONFIG_WRITE = 199 - SYS_PCICONFIG_IOBASE = 200 - SYS_MULTIPLEXER = 201 - SYS_GETDENTS64 = 202 - SYS_PIVOT_ROOT = 203 - SYS_MADVISE = 205 - SYS_MINCORE = 206 - SYS_GETTID = 207 - SYS_TKILL = 208 - SYS_SETXATTR = 209 - SYS_LSETXATTR = 210 - SYS_FSETXATTR = 211 - SYS_GETXATTR = 212 - SYS_LGETXATTR = 213 - SYS_FGETXATTR = 214 - SYS_LISTXATTR = 215 - SYS_LLISTXATTR = 216 - SYS_FLISTXATTR = 217 - SYS_REMOVEXATTR = 218 - SYS_LREMOVEXATTR = 219 - SYS_FREMOVEXATTR = 220 - SYS_FUTEX = 221 - SYS_SCHED_SETAFFINITY = 222 - SYS_SCHED_GETAFFINITY = 223 - SYS_TUXCALL = 225 - SYS_IO_SETUP = 227 - SYS_IO_DESTROY = 228 - SYS_IO_GETEVENTS = 229 - SYS_IO_SUBMIT = 230 - SYS_IO_CANCEL = 231 - SYS_SET_TID_ADDRESS = 232 - SYS_FADVISE64 = 233 - SYS_EXIT_GROUP = 234 - SYS_LOOKUP_DCOOKIE = 235 - SYS_EPOLL_CREATE = 236 - SYS_EPOLL_CTL = 237 - SYS_EPOLL_WAIT = 238 - SYS_REMAP_FILE_PAGES = 239 - SYS_TIMER_CREATE = 240 - SYS_TIMER_SETTIME = 241 - SYS_TIMER_GETTIME = 242 - SYS_TIMER_GETOVERRUN = 243 - SYS_TIMER_DELETE = 244 - SYS_CLOCK_SETTIME = 245 - SYS_CLOCK_GETTIME = 246 - SYS_CLOCK_GETRES = 247 - SYS_CLOCK_NANOSLEEP = 248 - SYS_SWAPCONTEXT = 249 - SYS_TGKILL = 250 - SYS_UTIMES = 251 - SYS_STATFS64 = 252 - SYS_FSTATFS64 = 253 - SYS_RTAS = 255 - SYS_SYS_DEBUG_SETCONTEXT = 256 - SYS_MIGRATE_PAGES = 258 - SYS_MBIND = 259 - SYS_GET_MEMPOLICY = 260 - SYS_SET_MEMPOLICY = 261 - SYS_MQ_OPEN = 262 - SYS_MQ_UNLINK = 263 - SYS_MQ_TIMEDSEND = 264 - SYS_MQ_TIMEDRECEIVE = 265 - SYS_MQ_NOTIFY = 266 - SYS_MQ_GETSETATTR = 267 - SYS_KEXEC_LOAD = 268 - SYS_ADD_KEY = 269 - SYS_REQUEST_KEY = 270 - SYS_KEYCTL = 271 - SYS_WAITID = 272 - SYS_IOPRIO_SET = 273 - SYS_IOPRIO_GET = 274 - SYS_INOTIFY_INIT = 275 - SYS_INOTIFY_ADD_WATCH = 276 - SYS_INOTIFY_RM_WATCH = 277 - SYS_SPU_RUN = 278 - SYS_SPU_CREATE = 279 - SYS_PSELECT6 = 280 - SYS_PPOLL = 281 - SYS_UNSHARE = 282 - SYS_SPLICE = 283 - SYS_TEE = 284 - SYS_VMSPLICE = 285 - SYS_OPENAT = 286 - SYS_MKDIRAT = 287 - SYS_MKNODAT = 288 - SYS_FCHOWNAT = 289 - SYS_FUTIMESAT = 290 - SYS_NEWFSTATAT = 291 - SYS_UNLINKAT = 292 - SYS_RENAMEAT = 293 - SYS_LINKAT = 294 - SYS_SYMLINKAT = 295 - SYS_READLINKAT = 296 - SYS_FCHMODAT = 297 - SYS_FACCESSAT = 298 - SYS_GET_ROBUST_LIST = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_MOVE_PAGES = 301 - SYS_GETCPU = 302 - SYS_EPOLL_PWAIT = 303 - SYS_UTIMENSAT = 304 - SYS_SIGNALFD = 305 - SYS_TIMERFD_CREATE = 306 - SYS_EVENTFD = 307 - SYS_SYNC_FILE_RANGE2 = 308 - SYS_FALLOCATE = 309 - SYS_SUBPAGE_PROT = 310 - SYS_TIMERFD_SETTIME = 311 - SYS_TIMERFD_GETTIME = 312 - SYS_SIGNALFD4 = 313 - SYS_EVENTFD2 = 314 - SYS_EPOLL_CREATE1 = 315 - SYS_DUP3 = 316 - SYS_PIPE2 = 317 - SYS_INOTIFY_INIT1 = 318 - SYS_PERF_EVENT_OPEN = 319 - SYS_PREADV = 320 - SYS_PWRITEV = 321 - SYS_RT_TGSIGQUEUEINFO = 322 - SYS_FANOTIFY_INIT = 323 - SYS_FANOTIFY_MARK = 324 - SYS_PRLIMIT64 = 325 - SYS_SOCKET = 326 - SYS_BIND = 327 - SYS_CONNECT = 328 - SYS_LISTEN = 329 - SYS_ACCEPT = 330 - SYS_GETSOCKNAME = 331 - SYS_GETPEERNAME = 332 - SYS_SOCKETPAIR = 333 - SYS_SEND = 334 - SYS_SENDTO = 335 - SYS_RECV = 336 - SYS_RECVFROM = 337 - SYS_SHUTDOWN = 338 - SYS_SETSOCKOPT = 339 - SYS_GETSOCKOPT = 340 - SYS_SENDMSG = 341 - SYS_RECVMSG = 342 - SYS_RECVMMSG = 343 - SYS_ACCEPT4 = 344 - SYS_NAME_TO_HANDLE_AT = 345 - SYS_OPEN_BY_HANDLE_AT = 346 - SYS_CLOCK_ADJTIME = 347 - SYS_SYNCFS = 348 - SYS_SENDMMSG = 349 - SYS_SETNS = 350 - SYS_PROCESS_VM_READV = 351 - SYS_PROCESS_VM_WRITEV = 352 - SYS_FINIT_MODULE = 353 - SYS_KCMP = 354 - SYS_SCHED_SETATTR = 355 - SYS_SCHED_GETATTR = 356 - SYS_RENAMEAT2 = 357 - SYS_SECCOMP = 358 - SYS_GETRANDOM = 359 - SYS_MEMFD_CREATE = 360 - SYS_BPF = 361 - SYS_EXECVEAT = 362 - SYS_SWITCH_ENDIAN = 363 - SYS_USERFAULTFD = 364 - SYS_MEMBARRIER = 365 - SYS_MLOCK2 = 378 - SYS_COPY_FILE_RANGE = 379 - SYS_PREADV2 = 380 - SYS_PWRITEV2 = 381 - SYS_KEXEC_FILE_LOAD = 382 - SYS_STATX = 383 - SYS_PKEY_ALLOC = 384 - SYS_PKEY_FREE = 385 - SYS_PKEY_MPROTECT = 386 - SYS_RSEQ = 387 - SYS_IO_PGETEVENTS = 388 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAITPID = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_TIME = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BREAK = 17 + SYS_OLDSTAT = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_STIME = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_OLDFSTAT = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_STTY = 31 + SYS_GTTY = 32 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_FTIME = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_PROF = 44 + SYS_BRK = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_LOCK = 53 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_MPX = 56 + SYS_SETPGID = 57 + SYS_ULIMIT = 58 + SYS_OLDOLDUNAME = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SGETMASK = 68 + SYS_SSETMASK = 69 + SYS_SETREUID = 70 + SYS_SETREGID = 71 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRLIMIT = 76 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_GETGROUPS = 80 + SYS_SETGROUPS = 81 + SYS_SELECT = 82 + SYS_SYMLINK = 83 + SYS_OLDLSTAT = 84 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_FCHOWN = 95 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_PROFIL = 98 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_IOPERM = 101 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_OLDUNAME = 109 + SYS_IOPL = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_VM86 = 113 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_MODIFY_LDT = 123 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_SETFSUID = 138 + SYS_SETFSGID = 139 + SYS__LLSEEK = 140 + SYS_GETDENTS = 141 + SYS__NEWSELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_SETRESUID = 164 + SYS_GETRESUID = 165 + SYS_QUERY_MODULE = 166 + SYS_POLL = 167 + SYS_NFSSERVCTL = 168 + SYS_SETRESGID = 169 + SYS_GETRESGID = 170 + SYS_PRCTL = 171 + SYS_RT_SIGRETURN = 172 + SYS_RT_SIGACTION = 173 + SYS_RT_SIGPROCMASK = 174 + SYS_RT_SIGPENDING = 175 + SYS_RT_SIGTIMEDWAIT = 176 + SYS_RT_SIGQUEUEINFO = 177 + SYS_RT_SIGSUSPEND = 178 + SYS_PREAD64 = 179 + SYS_PWRITE64 = 180 + SYS_CHOWN = 181 + SYS_GETCWD = 182 + SYS_CAPGET = 183 + SYS_CAPSET = 184 + SYS_SIGALTSTACK = 185 + SYS_SENDFILE = 186 + SYS_GETPMSG = 187 + SYS_PUTPMSG = 188 + SYS_VFORK = 189 + SYS_UGETRLIMIT = 190 + SYS_READAHEAD = 191 + SYS_PCICONFIG_READ = 198 + SYS_PCICONFIG_WRITE = 199 + SYS_PCICONFIG_IOBASE = 200 + SYS_MULTIPLEXER = 201 + SYS_GETDENTS64 = 202 + SYS_PIVOT_ROOT = 203 + SYS_MADVISE = 205 + SYS_MINCORE = 206 + SYS_GETTID = 207 + SYS_TKILL = 208 + SYS_SETXATTR = 209 + SYS_LSETXATTR = 210 + SYS_FSETXATTR = 211 + SYS_GETXATTR = 212 + SYS_LGETXATTR = 213 + SYS_FGETXATTR = 214 + SYS_LISTXATTR = 215 + SYS_LLISTXATTR = 216 + SYS_FLISTXATTR = 217 + SYS_REMOVEXATTR = 218 + SYS_LREMOVEXATTR = 219 + SYS_FREMOVEXATTR = 220 + SYS_FUTEX = 221 + SYS_SCHED_SETAFFINITY = 222 + SYS_SCHED_GETAFFINITY = 223 + SYS_TUXCALL = 225 + SYS_IO_SETUP = 227 + SYS_IO_DESTROY = 228 + SYS_IO_GETEVENTS = 229 + SYS_IO_SUBMIT = 230 + SYS_IO_CANCEL = 231 + SYS_SET_TID_ADDRESS = 232 + SYS_FADVISE64 = 233 + SYS_EXIT_GROUP = 234 + SYS_LOOKUP_DCOOKIE = 235 + SYS_EPOLL_CREATE = 236 + SYS_EPOLL_CTL = 237 + SYS_EPOLL_WAIT = 238 + SYS_REMAP_FILE_PAGES = 239 + SYS_TIMER_CREATE = 240 + SYS_TIMER_SETTIME = 241 + SYS_TIMER_GETTIME = 242 + SYS_TIMER_GETOVERRUN = 243 + SYS_TIMER_DELETE = 244 + SYS_CLOCK_SETTIME = 245 + SYS_CLOCK_GETTIME = 246 + SYS_CLOCK_GETRES = 247 + SYS_CLOCK_NANOSLEEP = 248 + SYS_SWAPCONTEXT = 249 + SYS_TGKILL = 250 + SYS_UTIMES = 251 + SYS_STATFS64 = 252 + SYS_FSTATFS64 = 253 + SYS_RTAS = 255 + SYS_SYS_DEBUG_SETCONTEXT = 256 + SYS_MIGRATE_PAGES = 258 + SYS_MBIND = 259 + SYS_GET_MEMPOLICY = 260 + SYS_SET_MEMPOLICY = 261 + SYS_MQ_OPEN = 262 + SYS_MQ_UNLINK = 263 + SYS_MQ_TIMEDSEND = 264 + SYS_MQ_TIMEDRECEIVE = 265 + SYS_MQ_NOTIFY = 266 + SYS_MQ_GETSETATTR = 267 + SYS_KEXEC_LOAD = 268 + SYS_ADD_KEY = 269 + SYS_REQUEST_KEY = 270 + SYS_KEYCTL = 271 + SYS_WAITID = 272 + SYS_IOPRIO_SET = 273 + SYS_IOPRIO_GET = 274 + SYS_INOTIFY_INIT = 275 + SYS_INOTIFY_ADD_WATCH = 276 + SYS_INOTIFY_RM_WATCH = 277 + SYS_SPU_RUN = 278 + SYS_SPU_CREATE = 279 + SYS_PSELECT6 = 280 + SYS_PPOLL = 281 + SYS_UNSHARE = 282 + SYS_SPLICE = 283 + SYS_TEE = 284 + SYS_VMSPLICE = 285 + SYS_OPENAT = 286 + SYS_MKDIRAT = 287 + SYS_MKNODAT = 288 + SYS_FCHOWNAT = 289 + SYS_FUTIMESAT = 290 + SYS_NEWFSTATAT = 291 + SYS_UNLINKAT = 292 + SYS_RENAMEAT = 293 + SYS_LINKAT = 294 + SYS_SYMLINKAT = 295 + SYS_READLINKAT = 296 + SYS_FCHMODAT = 297 + SYS_FACCESSAT = 298 + SYS_GET_ROBUST_LIST = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_MOVE_PAGES = 301 + SYS_GETCPU = 302 + SYS_EPOLL_PWAIT = 303 + SYS_UTIMENSAT = 304 + SYS_SIGNALFD = 305 + SYS_TIMERFD_CREATE = 306 + SYS_EVENTFD = 307 + SYS_SYNC_FILE_RANGE2 = 308 + SYS_FALLOCATE = 309 + SYS_SUBPAGE_PROT = 310 + SYS_TIMERFD_SETTIME = 311 + SYS_TIMERFD_GETTIME = 312 + SYS_SIGNALFD4 = 313 + SYS_EVENTFD2 = 314 + SYS_EPOLL_CREATE1 = 315 + SYS_DUP3 = 316 + SYS_PIPE2 = 317 + SYS_INOTIFY_INIT1 = 318 + SYS_PERF_EVENT_OPEN = 319 + SYS_PREADV = 320 + SYS_PWRITEV = 321 + SYS_RT_TGSIGQUEUEINFO = 322 + SYS_FANOTIFY_INIT = 323 + SYS_FANOTIFY_MARK = 324 + SYS_PRLIMIT64 = 325 + SYS_SOCKET = 326 + SYS_BIND = 327 + SYS_CONNECT = 328 + SYS_LISTEN = 329 + SYS_ACCEPT = 330 + SYS_GETSOCKNAME = 331 + SYS_GETPEERNAME = 332 + SYS_SOCKETPAIR = 333 + SYS_SEND = 334 + SYS_SENDTO = 335 + SYS_RECV = 336 + SYS_RECVFROM = 337 + SYS_SHUTDOWN = 338 + SYS_SETSOCKOPT = 339 + SYS_GETSOCKOPT = 340 + SYS_SENDMSG = 341 + SYS_RECVMSG = 342 + SYS_RECVMMSG = 343 + SYS_ACCEPT4 = 344 + SYS_NAME_TO_HANDLE_AT = 345 + SYS_OPEN_BY_HANDLE_AT = 346 + SYS_CLOCK_ADJTIME = 347 + SYS_SYNCFS = 348 + SYS_SENDMMSG = 349 + SYS_SETNS = 350 + SYS_PROCESS_VM_READV = 351 + SYS_PROCESS_VM_WRITEV = 352 + SYS_FINIT_MODULE = 353 + SYS_KCMP = 354 + SYS_SCHED_SETATTR = 355 + SYS_SCHED_GETATTR = 356 + SYS_RENAMEAT2 = 357 + SYS_SECCOMP = 358 + SYS_GETRANDOM = 359 + SYS_MEMFD_CREATE = 360 + SYS_BPF = 361 + SYS_EXECVEAT = 362 + SYS_SWITCH_ENDIAN = 363 + SYS_USERFAULTFD = 364 + SYS_MEMBARRIER = 365 + SYS_MLOCK2 = 378 + SYS_COPY_FILE_RANGE = 379 + SYS_PREADV2 = 380 + SYS_PWRITEV2 = 381 + SYS_KEXEC_FILE_LOAD = 382 + SYS_STATX = 383 + SYS_PKEY_ALLOC = 384 + SYS_PKEY_FREE = 385 + SYS_PKEY_MPROTECT = 386 + SYS_RSEQ = 387 + SYS_IO_PGETEVENTS = 388 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 529abb6a7f..a390e147d3 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -1,302 +1,312 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build riscv64 && linux // +build riscv64,linux package unix const ( - SYS_IO_SETUP = 0 - SYS_IO_DESTROY = 1 - SYS_IO_SUBMIT = 2 - SYS_IO_CANCEL = 3 - SYS_IO_GETEVENTS = 4 - SYS_SETXATTR = 5 - SYS_LSETXATTR = 6 - SYS_FSETXATTR = 7 - SYS_GETXATTR = 8 - SYS_LGETXATTR = 9 - SYS_FGETXATTR = 10 - SYS_LISTXATTR = 11 - SYS_LLISTXATTR = 12 - SYS_FLISTXATTR = 13 - SYS_REMOVEXATTR = 14 - SYS_LREMOVEXATTR = 15 - SYS_FREMOVEXATTR = 16 - SYS_GETCWD = 17 - SYS_LOOKUP_DCOOKIE = 18 - SYS_EVENTFD2 = 19 - SYS_EPOLL_CREATE1 = 20 - SYS_EPOLL_CTL = 21 - SYS_EPOLL_PWAIT = 22 - SYS_DUP = 23 - SYS_DUP3 = 24 - SYS_FCNTL = 25 - SYS_INOTIFY_INIT1 = 26 - SYS_INOTIFY_ADD_WATCH = 27 - SYS_INOTIFY_RM_WATCH = 28 - SYS_IOCTL = 29 - SYS_IOPRIO_SET = 30 - SYS_IOPRIO_GET = 31 - SYS_FLOCK = 32 - SYS_MKNODAT = 33 - SYS_MKDIRAT = 34 - SYS_UNLINKAT = 35 - SYS_SYMLINKAT = 36 - SYS_LINKAT = 37 - SYS_UMOUNT2 = 39 - SYS_MOUNT = 40 - SYS_PIVOT_ROOT = 41 - SYS_NFSSERVCTL = 42 - SYS_STATFS = 43 - SYS_FSTATFS = 44 - SYS_TRUNCATE = 45 - SYS_FTRUNCATE = 46 - SYS_FALLOCATE = 47 - SYS_FACCESSAT = 48 - SYS_CHDIR = 49 - SYS_FCHDIR = 50 - SYS_CHROOT = 51 - SYS_FCHMOD = 52 - SYS_FCHMODAT = 53 - SYS_FCHOWNAT = 54 - SYS_FCHOWN = 55 - SYS_OPENAT = 56 - SYS_CLOSE = 57 - SYS_VHANGUP = 58 - SYS_PIPE2 = 59 - SYS_QUOTACTL = 60 - SYS_GETDENTS64 = 61 - SYS_LSEEK = 62 - SYS_READ = 63 - SYS_WRITE = 64 - SYS_READV = 65 - SYS_WRITEV = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_PREADV = 69 - SYS_PWRITEV = 70 - SYS_SENDFILE = 71 - SYS_PSELECT6 = 72 - SYS_PPOLL = 73 - SYS_SIGNALFD4 = 74 - SYS_VMSPLICE = 75 - SYS_SPLICE = 76 - SYS_TEE = 77 - SYS_READLINKAT = 78 - SYS_FSTATAT = 79 - SYS_FSTAT = 80 - SYS_SYNC = 81 - SYS_FSYNC = 82 - SYS_FDATASYNC = 83 - SYS_SYNC_FILE_RANGE = 84 - SYS_TIMERFD_CREATE = 85 - SYS_TIMERFD_SETTIME = 86 - SYS_TIMERFD_GETTIME = 87 - SYS_UTIMENSAT = 88 - SYS_ACCT = 89 - SYS_CAPGET = 90 - SYS_CAPSET = 91 - SYS_PERSONALITY = 92 - SYS_EXIT = 93 - SYS_EXIT_GROUP = 94 - SYS_WAITID = 95 - SYS_SET_TID_ADDRESS = 96 - SYS_UNSHARE = 97 - SYS_FUTEX = 98 - SYS_SET_ROBUST_LIST = 99 - SYS_GET_ROBUST_LIST = 100 - SYS_NANOSLEEP = 101 - SYS_GETITIMER = 102 - SYS_SETITIMER = 103 - SYS_KEXEC_LOAD = 104 - SYS_INIT_MODULE = 105 - SYS_DELETE_MODULE = 106 - SYS_TIMER_CREATE = 107 - SYS_TIMER_GETTIME = 108 - SYS_TIMER_GETOVERRUN = 109 - SYS_TIMER_SETTIME = 110 - SYS_TIMER_DELETE = 111 - SYS_CLOCK_SETTIME = 112 - SYS_CLOCK_GETTIME = 113 - SYS_CLOCK_GETRES = 114 - SYS_CLOCK_NANOSLEEP = 115 - SYS_SYSLOG = 116 - SYS_PTRACE = 117 - SYS_SCHED_SETPARAM = 118 - SYS_SCHED_SETSCHEDULER = 119 - SYS_SCHED_GETSCHEDULER = 120 - SYS_SCHED_GETPARAM = 121 - SYS_SCHED_SETAFFINITY = 122 - SYS_SCHED_GETAFFINITY = 123 - SYS_SCHED_YIELD = 124 - SYS_SCHED_GET_PRIORITY_MAX = 125 - SYS_SCHED_GET_PRIORITY_MIN = 126 - SYS_SCHED_RR_GET_INTERVAL = 127 - SYS_RESTART_SYSCALL = 128 - SYS_KILL = 129 - SYS_TKILL = 130 - SYS_TGKILL = 131 - SYS_SIGALTSTACK = 132 - SYS_RT_SIGSUSPEND = 133 - SYS_RT_SIGACTION = 134 - SYS_RT_SIGPROCMASK = 135 - SYS_RT_SIGPENDING = 136 - SYS_RT_SIGTIMEDWAIT = 137 - SYS_RT_SIGQUEUEINFO = 138 - SYS_RT_SIGRETURN = 139 - SYS_SETPRIORITY = 140 - SYS_GETPRIORITY = 141 - SYS_REBOOT = 142 - SYS_SETREGID = 143 - SYS_SETGID = 144 - SYS_SETREUID = 145 - SYS_SETUID = 146 - SYS_SETRESUID = 147 - SYS_GETRESUID = 148 - SYS_SETRESGID = 149 - SYS_GETRESGID = 150 - SYS_SETFSUID = 151 - SYS_SETFSGID = 152 - SYS_TIMES = 153 - SYS_SETPGID = 154 - SYS_GETPGID = 155 - SYS_GETSID = 156 - SYS_SETSID = 157 - SYS_GETGROUPS = 158 - SYS_SETGROUPS = 159 - SYS_UNAME = 160 - SYS_SETHOSTNAME = 161 - SYS_SETDOMAINNAME = 162 - SYS_GETRLIMIT = 163 - SYS_SETRLIMIT = 164 - SYS_GETRUSAGE = 165 - SYS_UMASK = 166 - SYS_PRCTL = 167 - SYS_GETCPU = 168 - SYS_GETTIMEOFDAY = 169 - SYS_SETTIMEOFDAY = 170 - SYS_ADJTIMEX = 171 - SYS_GETPID = 172 - SYS_GETPPID = 173 - SYS_GETUID = 174 - SYS_GETEUID = 175 - SYS_GETGID = 176 - SYS_GETEGID = 177 - SYS_GETTID = 178 - SYS_SYSINFO = 179 - SYS_MQ_OPEN = 180 - SYS_MQ_UNLINK = 181 - SYS_MQ_TIMEDSEND = 182 - SYS_MQ_TIMEDRECEIVE = 183 - SYS_MQ_NOTIFY = 184 - SYS_MQ_GETSETATTR = 185 - SYS_MSGGET = 186 - SYS_MSGCTL = 187 - SYS_MSGRCV = 188 - SYS_MSGSND = 189 - SYS_SEMGET = 190 - SYS_SEMCTL = 191 - SYS_SEMTIMEDOP = 192 - SYS_SEMOP = 193 - SYS_SHMGET = 194 - SYS_SHMCTL = 195 - SYS_SHMAT = 196 - SYS_SHMDT = 197 - SYS_SOCKET = 198 - SYS_SOCKETPAIR = 199 - SYS_BIND = 200 - SYS_LISTEN = 201 - SYS_ACCEPT = 202 - SYS_CONNECT = 203 - SYS_GETSOCKNAME = 204 - SYS_GETPEERNAME = 205 - SYS_SENDTO = 206 - SYS_RECVFROM = 207 - SYS_SETSOCKOPT = 208 - SYS_GETSOCKOPT = 209 - SYS_SHUTDOWN = 210 - SYS_SENDMSG = 211 - SYS_RECVMSG = 212 - SYS_READAHEAD = 213 - SYS_BRK = 214 - SYS_MUNMAP = 215 - SYS_MREMAP = 216 - SYS_ADD_KEY = 217 - SYS_REQUEST_KEY = 218 - SYS_KEYCTL = 219 - SYS_CLONE = 220 - SYS_EXECVE = 221 - SYS_MMAP = 222 - SYS_FADVISE64 = 223 - SYS_SWAPON = 224 - SYS_SWAPOFF = 225 - SYS_MPROTECT = 226 - SYS_MSYNC = 227 - SYS_MLOCK = 228 - SYS_MUNLOCK = 229 - SYS_MLOCKALL = 230 - SYS_MUNLOCKALL = 231 - SYS_MINCORE = 232 - SYS_MADVISE = 233 - SYS_REMAP_FILE_PAGES = 234 - SYS_MBIND = 235 - SYS_GET_MEMPOLICY = 236 - SYS_SET_MEMPOLICY = 237 - SYS_MIGRATE_PAGES = 238 - SYS_MOVE_PAGES = 239 - SYS_RT_TGSIGQUEUEINFO = 240 - SYS_PERF_EVENT_OPEN = 241 - SYS_ACCEPT4 = 242 - SYS_RECVMMSG = 243 - SYS_ARCH_SPECIFIC_SYSCALL = 244 - SYS_WAIT4 = 260 - SYS_PRLIMIT64 = 261 - SYS_FANOTIFY_INIT = 262 - SYS_FANOTIFY_MARK = 263 - SYS_NAME_TO_HANDLE_AT = 264 - SYS_OPEN_BY_HANDLE_AT = 265 - SYS_CLOCK_ADJTIME = 266 - SYS_SYNCFS = 267 - SYS_SETNS = 268 - SYS_SENDMMSG = 269 - SYS_PROCESS_VM_READV = 270 - SYS_PROCESS_VM_WRITEV = 271 - SYS_KCMP = 272 - SYS_FINIT_MODULE = 273 - SYS_SCHED_SETATTR = 274 - SYS_SCHED_GETATTR = 275 - SYS_RENAMEAT2 = 276 - SYS_SECCOMP = 277 - SYS_GETRANDOM = 278 - SYS_MEMFD_CREATE = 279 - SYS_BPF = 280 - SYS_EXECVEAT = 281 - SYS_USERFAULTFD = 282 - SYS_MEMBARRIER = 283 - SYS_MLOCK2 = 284 - SYS_COPY_FILE_RANGE = 285 - SYS_PREADV2 = 286 - SYS_PWRITEV2 = 287 - SYS_PKEY_MPROTECT = 288 - SYS_PKEY_ALLOC = 289 - SYS_PKEY_FREE = 290 - SYS_STATX = 291 - SYS_IO_PGETEVENTS = 292 - SYS_RSEQ = 293 - SYS_KEXEC_FILE_LOAD = 294 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 + SYS_IO_SETUP = 0 + SYS_IO_DESTROY = 1 + SYS_IO_SUBMIT = 2 + SYS_IO_CANCEL = 3 + SYS_IO_GETEVENTS = 4 + SYS_SETXATTR = 5 + SYS_LSETXATTR = 6 + SYS_FSETXATTR = 7 + SYS_GETXATTR = 8 + SYS_LGETXATTR = 9 + SYS_FGETXATTR = 10 + SYS_LISTXATTR = 11 + SYS_LLISTXATTR = 12 + SYS_FLISTXATTR = 13 + SYS_REMOVEXATTR = 14 + SYS_LREMOVEXATTR = 15 + SYS_FREMOVEXATTR = 16 + SYS_GETCWD = 17 + SYS_LOOKUP_DCOOKIE = 18 + SYS_EVENTFD2 = 19 + SYS_EPOLL_CREATE1 = 20 + SYS_EPOLL_CTL = 21 + SYS_EPOLL_PWAIT = 22 + SYS_DUP = 23 + SYS_DUP3 = 24 + SYS_FCNTL = 25 + SYS_INOTIFY_INIT1 = 26 + SYS_INOTIFY_ADD_WATCH = 27 + SYS_INOTIFY_RM_WATCH = 28 + SYS_IOCTL = 29 + SYS_IOPRIO_SET = 30 + SYS_IOPRIO_GET = 31 + SYS_FLOCK = 32 + SYS_MKNODAT = 33 + SYS_MKDIRAT = 34 + SYS_UNLINKAT = 35 + SYS_SYMLINKAT = 36 + SYS_LINKAT = 37 + SYS_UMOUNT2 = 39 + SYS_MOUNT = 40 + SYS_PIVOT_ROOT = 41 + SYS_NFSSERVCTL = 42 + SYS_STATFS = 43 + SYS_FSTATFS = 44 + SYS_TRUNCATE = 45 + SYS_FTRUNCATE = 46 + SYS_FALLOCATE = 47 + SYS_FACCESSAT = 48 + SYS_CHDIR = 49 + SYS_FCHDIR = 50 + SYS_CHROOT = 51 + SYS_FCHMOD = 52 + SYS_FCHMODAT = 53 + SYS_FCHOWNAT = 54 + SYS_FCHOWN = 55 + SYS_OPENAT = 56 + SYS_CLOSE = 57 + SYS_VHANGUP = 58 + SYS_PIPE2 = 59 + SYS_QUOTACTL = 60 + SYS_GETDENTS64 = 61 + SYS_LSEEK = 62 + SYS_READ = 63 + SYS_WRITE = 64 + SYS_READV = 65 + SYS_WRITEV = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_PREADV = 69 + SYS_PWRITEV = 70 + SYS_SENDFILE = 71 + SYS_PSELECT6 = 72 + SYS_PPOLL = 73 + SYS_SIGNALFD4 = 74 + SYS_VMSPLICE = 75 + SYS_SPLICE = 76 + SYS_TEE = 77 + SYS_READLINKAT = 78 + SYS_FSTATAT = 79 + SYS_FSTAT = 80 + SYS_SYNC = 81 + SYS_FSYNC = 82 + SYS_FDATASYNC = 83 + SYS_SYNC_FILE_RANGE = 84 + SYS_TIMERFD_CREATE = 85 + SYS_TIMERFD_SETTIME = 86 + SYS_TIMERFD_GETTIME = 87 + SYS_UTIMENSAT = 88 + SYS_ACCT = 89 + SYS_CAPGET = 90 + SYS_CAPSET = 91 + SYS_PERSONALITY = 92 + SYS_EXIT = 93 + SYS_EXIT_GROUP = 94 + SYS_WAITID = 95 + SYS_SET_TID_ADDRESS = 96 + SYS_UNSHARE = 97 + SYS_FUTEX = 98 + SYS_SET_ROBUST_LIST = 99 + SYS_GET_ROBUST_LIST = 100 + SYS_NANOSLEEP = 101 + SYS_GETITIMER = 102 + SYS_SETITIMER = 103 + SYS_KEXEC_LOAD = 104 + SYS_INIT_MODULE = 105 + SYS_DELETE_MODULE = 106 + SYS_TIMER_CREATE = 107 + SYS_TIMER_GETTIME = 108 + SYS_TIMER_GETOVERRUN = 109 + SYS_TIMER_SETTIME = 110 + SYS_TIMER_DELETE = 111 + SYS_CLOCK_SETTIME = 112 + SYS_CLOCK_GETTIME = 113 + SYS_CLOCK_GETRES = 114 + SYS_CLOCK_NANOSLEEP = 115 + SYS_SYSLOG = 116 + SYS_PTRACE = 117 + SYS_SCHED_SETPARAM = 118 + SYS_SCHED_SETSCHEDULER = 119 + SYS_SCHED_GETSCHEDULER = 120 + SYS_SCHED_GETPARAM = 121 + SYS_SCHED_SETAFFINITY = 122 + SYS_SCHED_GETAFFINITY = 123 + SYS_SCHED_YIELD = 124 + SYS_SCHED_GET_PRIORITY_MAX = 125 + SYS_SCHED_GET_PRIORITY_MIN = 126 + SYS_SCHED_RR_GET_INTERVAL = 127 + SYS_RESTART_SYSCALL = 128 + SYS_KILL = 129 + SYS_TKILL = 130 + SYS_TGKILL = 131 + SYS_SIGALTSTACK = 132 + SYS_RT_SIGSUSPEND = 133 + SYS_RT_SIGACTION = 134 + SYS_RT_SIGPROCMASK = 135 + SYS_RT_SIGPENDING = 136 + SYS_RT_SIGTIMEDWAIT = 137 + SYS_RT_SIGQUEUEINFO = 138 + SYS_RT_SIGRETURN = 139 + SYS_SETPRIORITY = 140 + SYS_GETPRIORITY = 141 + SYS_REBOOT = 142 + SYS_SETREGID = 143 + SYS_SETGID = 144 + SYS_SETREUID = 145 + SYS_SETUID = 146 + SYS_SETRESUID = 147 + SYS_GETRESUID = 148 + SYS_SETRESGID = 149 + SYS_GETRESGID = 150 + SYS_SETFSUID = 151 + SYS_SETFSGID = 152 + SYS_TIMES = 153 + SYS_SETPGID = 154 + SYS_GETPGID = 155 + SYS_GETSID = 156 + SYS_SETSID = 157 + SYS_GETGROUPS = 158 + SYS_SETGROUPS = 159 + SYS_UNAME = 160 + SYS_SETHOSTNAME = 161 + SYS_SETDOMAINNAME = 162 + SYS_GETRLIMIT = 163 + SYS_SETRLIMIT = 164 + SYS_GETRUSAGE = 165 + SYS_UMASK = 166 + SYS_PRCTL = 167 + SYS_GETCPU = 168 + SYS_GETTIMEOFDAY = 169 + SYS_SETTIMEOFDAY = 170 + SYS_ADJTIMEX = 171 + SYS_GETPID = 172 + SYS_GETPPID = 173 + SYS_GETUID = 174 + SYS_GETEUID = 175 + SYS_GETGID = 176 + SYS_GETEGID = 177 + SYS_GETTID = 178 + SYS_SYSINFO = 179 + SYS_MQ_OPEN = 180 + SYS_MQ_UNLINK = 181 + SYS_MQ_TIMEDSEND = 182 + SYS_MQ_TIMEDRECEIVE = 183 + SYS_MQ_NOTIFY = 184 + SYS_MQ_GETSETATTR = 185 + SYS_MSGGET = 186 + SYS_MSGCTL = 187 + SYS_MSGRCV = 188 + SYS_MSGSND = 189 + SYS_SEMGET = 190 + SYS_SEMCTL = 191 + SYS_SEMTIMEDOP = 192 + SYS_SEMOP = 193 + SYS_SHMGET = 194 + SYS_SHMCTL = 195 + SYS_SHMAT = 196 + SYS_SHMDT = 197 + SYS_SOCKET = 198 + SYS_SOCKETPAIR = 199 + SYS_BIND = 200 + SYS_LISTEN = 201 + SYS_ACCEPT = 202 + SYS_CONNECT = 203 + SYS_GETSOCKNAME = 204 + SYS_GETPEERNAME = 205 + SYS_SENDTO = 206 + SYS_RECVFROM = 207 + SYS_SETSOCKOPT = 208 + SYS_GETSOCKOPT = 209 + SYS_SHUTDOWN = 210 + SYS_SENDMSG = 211 + SYS_RECVMSG = 212 + SYS_READAHEAD = 213 + SYS_BRK = 214 + SYS_MUNMAP = 215 + SYS_MREMAP = 216 + SYS_ADD_KEY = 217 + SYS_REQUEST_KEY = 218 + SYS_KEYCTL = 219 + SYS_CLONE = 220 + SYS_EXECVE = 221 + SYS_MMAP = 222 + SYS_FADVISE64 = 223 + SYS_SWAPON = 224 + SYS_SWAPOFF = 225 + SYS_MPROTECT = 226 + SYS_MSYNC = 227 + SYS_MLOCK = 228 + SYS_MUNLOCK = 229 + SYS_MLOCKALL = 230 + SYS_MUNLOCKALL = 231 + SYS_MINCORE = 232 + SYS_MADVISE = 233 + SYS_REMAP_FILE_PAGES = 234 + SYS_MBIND = 235 + SYS_GET_MEMPOLICY = 236 + SYS_SET_MEMPOLICY = 237 + SYS_MIGRATE_PAGES = 238 + SYS_MOVE_PAGES = 239 + SYS_RT_TGSIGQUEUEINFO = 240 + SYS_PERF_EVENT_OPEN = 241 + SYS_ACCEPT4 = 242 + SYS_RECVMMSG = 243 + SYS_ARCH_SPECIFIC_SYSCALL = 244 + SYS_WAIT4 = 260 + SYS_PRLIMIT64 = 261 + SYS_FANOTIFY_INIT = 262 + SYS_FANOTIFY_MARK = 263 + SYS_NAME_TO_HANDLE_AT = 264 + SYS_OPEN_BY_HANDLE_AT = 265 + SYS_CLOCK_ADJTIME = 266 + SYS_SYNCFS = 267 + SYS_SETNS = 268 + SYS_SENDMMSG = 269 + SYS_PROCESS_VM_READV = 270 + SYS_PROCESS_VM_WRITEV = 271 + SYS_KCMP = 272 + SYS_FINIT_MODULE = 273 + SYS_SCHED_SETATTR = 274 + SYS_SCHED_GETATTR = 275 + SYS_RENAMEAT2 = 276 + SYS_SECCOMP = 277 + SYS_GETRANDOM = 278 + SYS_MEMFD_CREATE = 279 + SYS_BPF = 280 + SYS_EXECVEAT = 281 + SYS_USERFAULTFD = 282 + SYS_MEMBARRIER = 283 + SYS_MLOCK2 = 284 + SYS_COPY_FILE_RANGE = 285 + SYS_PREADV2 = 286 + SYS_PWRITEV2 = 287 + SYS_PKEY_MPROTECT = 288 + SYS_PKEY_ALLOC = 289 + SYS_PKEY_FREE = 290 + SYS_STATX = 291 + SYS_IO_PGETEVENTS = 292 + SYS_RSEQ = 293 + SYS_KEXEC_FILE_LOAD = 294 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 2766500109..3e791e6cd2 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -1,365 +1,375 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include -fsigned-char /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build s390x && linux // +build s390x,linux package unix const ( - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_RESTART_SYSCALL = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECVE = 11 - SYS_CHDIR = 12 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_MOUNT = 21 - SYS_UMOUNT = 22 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_RENAME = 38 - SYS_MKDIR = 39 - SYS_RMDIR = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_BRK = 45 - SYS_SIGNAL = 48 - SYS_ACCT = 51 - SYS_UMOUNT2 = 52 - SYS_IOCTL = 54 - SYS_FCNTL = 55 - SYS_SETPGID = 57 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_USTAT = 62 - SYS_DUP2 = 63 - SYS_GETPPID = 64 - SYS_GETPGRP = 65 - SYS_SETSID = 66 - SYS_SIGACTION = 67 - SYS_SIGSUSPEND = 72 - SYS_SIGPENDING = 73 - SYS_SETHOSTNAME = 74 - SYS_SETRLIMIT = 75 - SYS_GETRUSAGE = 77 - SYS_GETTIMEOFDAY = 78 - SYS_SETTIMEOFDAY = 79 - SYS_SYMLINK = 83 - SYS_READLINK = 85 - SYS_USELIB = 86 - SYS_SWAPON = 87 - SYS_REBOOT = 88 - SYS_READDIR = 89 - SYS_MMAP = 90 - SYS_MUNMAP = 91 - SYS_TRUNCATE = 92 - SYS_FTRUNCATE = 93 - SYS_FCHMOD = 94 - SYS_GETPRIORITY = 96 - SYS_SETPRIORITY = 97 - SYS_STATFS = 99 - SYS_FSTATFS = 100 - SYS_SOCKETCALL = 102 - SYS_SYSLOG = 103 - SYS_SETITIMER = 104 - SYS_GETITIMER = 105 - SYS_STAT = 106 - SYS_LSTAT = 107 - SYS_FSTAT = 108 - SYS_LOOKUP_DCOOKIE = 110 - SYS_VHANGUP = 111 - SYS_IDLE = 112 - SYS_WAIT4 = 114 - SYS_SWAPOFF = 115 - SYS_SYSINFO = 116 - SYS_IPC = 117 - SYS_FSYNC = 118 - SYS_SIGRETURN = 119 - SYS_CLONE = 120 - SYS_SETDOMAINNAME = 121 - SYS_UNAME = 122 - SYS_ADJTIMEX = 124 - SYS_MPROTECT = 125 - SYS_SIGPROCMASK = 126 - SYS_CREATE_MODULE = 127 - SYS_INIT_MODULE = 128 - SYS_DELETE_MODULE = 129 - SYS_GET_KERNEL_SYMS = 130 - SYS_QUOTACTL = 131 - SYS_GETPGID = 132 - SYS_FCHDIR = 133 - SYS_BDFLUSH = 134 - SYS_SYSFS = 135 - SYS_PERSONALITY = 136 - SYS_AFS_SYSCALL = 137 - SYS_GETDENTS = 141 - SYS_SELECT = 142 - SYS_FLOCK = 143 - SYS_MSYNC = 144 - SYS_READV = 145 - SYS_WRITEV = 146 - SYS_GETSID = 147 - SYS_FDATASYNC = 148 - SYS__SYSCTL = 149 - SYS_MLOCK = 150 - SYS_MUNLOCK = 151 - SYS_MLOCKALL = 152 - SYS_MUNLOCKALL = 153 - SYS_SCHED_SETPARAM = 154 - SYS_SCHED_GETPARAM = 155 - SYS_SCHED_SETSCHEDULER = 156 - SYS_SCHED_GETSCHEDULER = 157 - SYS_SCHED_YIELD = 158 - SYS_SCHED_GET_PRIORITY_MAX = 159 - SYS_SCHED_GET_PRIORITY_MIN = 160 - SYS_SCHED_RR_GET_INTERVAL = 161 - SYS_NANOSLEEP = 162 - SYS_MREMAP = 163 - SYS_QUERY_MODULE = 167 - SYS_POLL = 168 - SYS_NFSSERVCTL = 169 - SYS_PRCTL = 172 - SYS_RT_SIGRETURN = 173 - SYS_RT_SIGACTION = 174 - SYS_RT_SIGPROCMASK = 175 - SYS_RT_SIGPENDING = 176 - SYS_RT_SIGTIMEDWAIT = 177 - SYS_RT_SIGQUEUEINFO = 178 - SYS_RT_SIGSUSPEND = 179 - SYS_PREAD64 = 180 - SYS_PWRITE64 = 181 - SYS_GETCWD = 183 - SYS_CAPGET = 184 - SYS_CAPSET = 185 - SYS_SIGALTSTACK = 186 - SYS_SENDFILE = 187 - SYS_GETPMSG = 188 - SYS_PUTPMSG = 189 - SYS_VFORK = 190 - SYS_GETRLIMIT = 191 - SYS_LCHOWN = 198 - SYS_GETUID = 199 - SYS_GETGID = 200 - SYS_GETEUID = 201 - SYS_GETEGID = 202 - SYS_SETREUID = 203 - SYS_SETREGID = 204 - SYS_GETGROUPS = 205 - SYS_SETGROUPS = 206 - SYS_FCHOWN = 207 - SYS_SETRESUID = 208 - SYS_GETRESUID = 209 - SYS_SETRESGID = 210 - SYS_GETRESGID = 211 - SYS_CHOWN = 212 - SYS_SETUID = 213 - SYS_SETGID = 214 - SYS_SETFSUID = 215 - SYS_SETFSGID = 216 - SYS_PIVOT_ROOT = 217 - SYS_MINCORE = 218 - SYS_MADVISE = 219 - SYS_GETDENTS64 = 220 - SYS_READAHEAD = 222 - SYS_SETXATTR = 224 - SYS_LSETXATTR = 225 - SYS_FSETXATTR = 226 - SYS_GETXATTR = 227 - SYS_LGETXATTR = 228 - SYS_FGETXATTR = 229 - SYS_LISTXATTR = 230 - SYS_LLISTXATTR = 231 - SYS_FLISTXATTR = 232 - SYS_REMOVEXATTR = 233 - SYS_LREMOVEXATTR = 234 - SYS_FREMOVEXATTR = 235 - SYS_GETTID = 236 - SYS_TKILL = 237 - SYS_FUTEX = 238 - SYS_SCHED_SETAFFINITY = 239 - SYS_SCHED_GETAFFINITY = 240 - SYS_TGKILL = 241 - SYS_IO_SETUP = 243 - SYS_IO_DESTROY = 244 - SYS_IO_GETEVENTS = 245 - SYS_IO_SUBMIT = 246 - SYS_IO_CANCEL = 247 - SYS_EXIT_GROUP = 248 - SYS_EPOLL_CREATE = 249 - SYS_EPOLL_CTL = 250 - SYS_EPOLL_WAIT = 251 - SYS_SET_TID_ADDRESS = 252 - SYS_FADVISE64 = 253 - SYS_TIMER_CREATE = 254 - SYS_TIMER_SETTIME = 255 - SYS_TIMER_GETTIME = 256 - SYS_TIMER_GETOVERRUN = 257 - SYS_TIMER_DELETE = 258 - SYS_CLOCK_SETTIME = 259 - SYS_CLOCK_GETTIME = 260 - SYS_CLOCK_GETRES = 261 - SYS_CLOCK_NANOSLEEP = 262 - SYS_STATFS64 = 265 - SYS_FSTATFS64 = 266 - SYS_REMAP_FILE_PAGES = 267 - SYS_MBIND = 268 - SYS_GET_MEMPOLICY = 269 - SYS_SET_MEMPOLICY = 270 - SYS_MQ_OPEN = 271 - SYS_MQ_UNLINK = 272 - SYS_MQ_TIMEDSEND = 273 - SYS_MQ_TIMEDRECEIVE = 274 - SYS_MQ_NOTIFY = 275 - SYS_MQ_GETSETATTR = 276 - SYS_KEXEC_LOAD = 277 - SYS_ADD_KEY = 278 - SYS_REQUEST_KEY = 279 - SYS_KEYCTL = 280 - SYS_WAITID = 281 - SYS_IOPRIO_SET = 282 - SYS_IOPRIO_GET = 283 - SYS_INOTIFY_INIT = 284 - SYS_INOTIFY_ADD_WATCH = 285 - SYS_INOTIFY_RM_WATCH = 286 - SYS_MIGRATE_PAGES = 287 - SYS_OPENAT = 288 - SYS_MKDIRAT = 289 - SYS_MKNODAT = 290 - SYS_FCHOWNAT = 291 - SYS_FUTIMESAT = 292 - SYS_NEWFSTATAT = 293 - SYS_UNLINKAT = 294 - SYS_RENAMEAT = 295 - SYS_LINKAT = 296 - SYS_SYMLINKAT = 297 - SYS_READLINKAT = 298 - SYS_FCHMODAT = 299 - SYS_FACCESSAT = 300 - SYS_PSELECT6 = 301 - SYS_PPOLL = 302 - SYS_UNSHARE = 303 - SYS_SET_ROBUST_LIST = 304 - SYS_GET_ROBUST_LIST = 305 - SYS_SPLICE = 306 - SYS_SYNC_FILE_RANGE = 307 - SYS_TEE = 308 - SYS_VMSPLICE = 309 - SYS_MOVE_PAGES = 310 - SYS_GETCPU = 311 - SYS_EPOLL_PWAIT = 312 - SYS_UTIMES = 313 - SYS_FALLOCATE = 314 - SYS_UTIMENSAT = 315 - SYS_SIGNALFD = 316 - SYS_TIMERFD = 317 - SYS_EVENTFD = 318 - SYS_TIMERFD_CREATE = 319 - SYS_TIMERFD_SETTIME = 320 - SYS_TIMERFD_GETTIME = 321 - SYS_SIGNALFD4 = 322 - SYS_EVENTFD2 = 323 - SYS_INOTIFY_INIT1 = 324 - SYS_PIPE2 = 325 - SYS_DUP3 = 326 - SYS_EPOLL_CREATE1 = 327 - SYS_PREADV = 328 - SYS_PWRITEV = 329 - SYS_RT_TGSIGQUEUEINFO = 330 - SYS_PERF_EVENT_OPEN = 331 - SYS_FANOTIFY_INIT = 332 - SYS_FANOTIFY_MARK = 333 - SYS_PRLIMIT64 = 334 - SYS_NAME_TO_HANDLE_AT = 335 - SYS_OPEN_BY_HANDLE_AT = 336 - SYS_CLOCK_ADJTIME = 337 - SYS_SYNCFS = 338 - SYS_SETNS = 339 - SYS_PROCESS_VM_READV = 340 - SYS_PROCESS_VM_WRITEV = 341 - SYS_S390_RUNTIME_INSTR = 342 - SYS_KCMP = 343 - SYS_FINIT_MODULE = 344 - SYS_SCHED_SETATTR = 345 - SYS_SCHED_GETATTR = 346 - SYS_RENAMEAT2 = 347 - SYS_SECCOMP = 348 - SYS_GETRANDOM = 349 - SYS_MEMFD_CREATE = 350 - SYS_BPF = 351 - SYS_S390_PCI_MMIO_WRITE = 352 - SYS_S390_PCI_MMIO_READ = 353 - SYS_EXECVEAT = 354 - SYS_USERFAULTFD = 355 - SYS_MEMBARRIER = 356 - SYS_RECVMMSG = 357 - SYS_SENDMMSG = 358 - SYS_SOCKET = 359 - SYS_SOCKETPAIR = 360 - SYS_BIND = 361 - SYS_CONNECT = 362 - SYS_LISTEN = 363 - SYS_ACCEPT4 = 364 - SYS_GETSOCKOPT = 365 - SYS_SETSOCKOPT = 366 - SYS_GETSOCKNAME = 367 - SYS_GETPEERNAME = 368 - SYS_SENDTO = 369 - SYS_SENDMSG = 370 - SYS_RECVFROM = 371 - SYS_RECVMSG = 372 - SYS_SHUTDOWN = 373 - SYS_MLOCK2 = 374 - SYS_COPY_FILE_RANGE = 375 - SYS_PREADV2 = 376 - SYS_PWRITEV2 = 377 - SYS_S390_GUARDED_STORAGE = 378 - SYS_STATX = 379 - SYS_S390_STHYI = 380 - SYS_KEXEC_FILE_LOAD = 381 - SYS_IO_PGETEVENTS = 382 - SYS_RSEQ = 383 - SYS_PKEY_MPROTECT = 384 - SYS_PKEY_ALLOC = 385 - SYS_PKEY_FREE = 386 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_CLONE3 = 435 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_RESTART_SYSCALL = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECVE = 11 + SYS_CHDIR = 12 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_MOUNT = 21 + SYS_UMOUNT = 22 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_RENAME = 38 + SYS_MKDIR = 39 + SYS_RMDIR = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_BRK = 45 + SYS_SIGNAL = 48 + SYS_ACCT = 51 + SYS_UMOUNT2 = 52 + SYS_IOCTL = 54 + SYS_FCNTL = 55 + SYS_SETPGID = 57 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_USTAT = 62 + SYS_DUP2 = 63 + SYS_GETPPID = 64 + SYS_GETPGRP = 65 + SYS_SETSID = 66 + SYS_SIGACTION = 67 + SYS_SIGSUSPEND = 72 + SYS_SIGPENDING = 73 + SYS_SETHOSTNAME = 74 + SYS_SETRLIMIT = 75 + SYS_GETRUSAGE = 77 + SYS_GETTIMEOFDAY = 78 + SYS_SETTIMEOFDAY = 79 + SYS_SYMLINK = 83 + SYS_READLINK = 85 + SYS_USELIB = 86 + SYS_SWAPON = 87 + SYS_REBOOT = 88 + SYS_READDIR = 89 + SYS_MMAP = 90 + SYS_MUNMAP = 91 + SYS_TRUNCATE = 92 + SYS_FTRUNCATE = 93 + SYS_FCHMOD = 94 + SYS_GETPRIORITY = 96 + SYS_SETPRIORITY = 97 + SYS_STATFS = 99 + SYS_FSTATFS = 100 + SYS_SOCKETCALL = 102 + SYS_SYSLOG = 103 + SYS_SETITIMER = 104 + SYS_GETITIMER = 105 + SYS_STAT = 106 + SYS_LSTAT = 107 + SYS_FSTAT = 108 + SYS_LOOKUP_DCOOKIE = 110 + SYS_VHANGUP = 111 + SYS_IDLE = 112 + SYS_WAIT4 = 114 + SYS_SWAPOFF = 115 + SYS_SYSINFO = 116 + SYS_IPC = 117 + SYS_FSYNC = 118 + SYS_SIGRETURN = 119 + SYS_CLONE = 120 + SYS_SETDOMAINNAME = 121 + SYS_UNAME = 122 + SYS_ADJTIMEX = 124 + SYS_MPROTECT = 125 + SYS_SIGPROCMASK = 126 + SYS_CREATE_MODULE = 127 + SYS_INIT_MODULE = 128 + SYS_DELETE_MODULE = 129 + SYS_GET_KERNEL_SYMS = 130 + SYS_QUOTACTL = 131 + SYS_GETPGID = 132 + SYS_FCHDIR = 133 + SYS_BDFLUSH = 134 + SYS_SYSFS = 135 + SYS_PERSONALITY = 136 + SYS_AFS_SYSCALL = 137 + SYS_GETDENTS = 141 + SYS_SELECT = 142 + SYS_FLOCK = 143 + SYS_MSYNC = 144 + SYS_READV = 145 + SYS_WRITEV = 146 + SYS_GETSID = 147 + SYS_FDATASYNC = 148 + SYS__SYSCTL = 149 + SYS_MLOCK = 150 + SYS_MUNLOCK = 151 + SYS_MLOCKALL = 152 + SYS_MUNLOCKALL = 153 + SYS_SCHED_SETPARAM = 154 + SYS_SCHED_GETPARAM = 155 + SYS_SCHED_SETSCHEDULER = 156 + SYS_SCHED_GETSCHEDULER = 157 + SYS_SCHED_YIELD = 158 + SYS_SCHED_GET_PRIORITY_MAX = 159 + SYS_SCHED_GET_PRIORITY_MIN = 160 + SYS_SCHED_RR_GET_INTERVAL = 161 + SYS_NANOSLEEP = 162 + SYS_MREMAP = 163 + SYS_QUERY_MODULE = 167 + SYS_POLL = 168 + SYS_NFSSERVCTL = 169 + SYS_PRCTL = 172 + SYS_RT_SIGRETURN = 173 + SYS_RT_SIGACTION = 174 + SYS_RT_SIGPROCMASK = 175 + SYS_RT_SIGPENDING = 176 + SYS_RT_SIGTIMEDWAIT = 177 + SYS_RT_SIGQUEUEINFO = 178 + SYS_RT_SIGSUSPEND = 179 + SYS_PREAD64 = 180 + SYS_PWRITE64 = 181 + SYS_GETCWD = 183 + SYS_CAPGET = 184 + SYS_CAPSET = 185 + SYS_SIGALTSTACK = 186 + SYS_SENDFILE = 187 + SYS_GETPMSG = 188 + SYS_PUTPMSG = 189 + SYS_VFORK = 190 + SYS_GETRLIMIT = 191 + SYS_LCHOWN = 198 + SYS_GETUID = 199 + SYS_GETGID = 200 + SYS_GETEUID = 201 + SYS_GETEGID = 202 + SYS_SETREUID = 203 + SYS_SETREGID = 204 + SYS_GETGROUPS = 205 + SYS_SETGROUPS = 206 + SYS_FCHOWN = 207 + SYS_SETRESUID = 208 + SYS_GETRESUID = 209 + SYS_SETRESGID = 210 + SYS_GETRESGID = 211 + SYS_CHOWN = 212 + SYS_SETUID = 213 + SYS_SETGID = 214 + SYS_SETFSUID = 215 + SYS_SETFSGID = 216 + SYS_PIVOT_ROOT = 217 + SYS_MINCORE = 218 + SYS_MADVISE = 219 + SYS_GETDENTS64 = 220 + SYS_READAHEAD = 222 + SYS_SETXATTR = 224 + SYS_LSETXATTR = 225 + SYS_FSETXATTR = 226 + SYS_GETXATTR = 227 + SYS_LGETXATTR = 228 + SYS_FGETXATTR = 229 + SYS_LISTXATTR = 230 + SYS_LLISTXATTR = 231 + SYS_FLISTXATTR = 232 + SYS_REMOVEXATTR = 233 + SYS_LREMOVEXATTR = 234 + SYS_FREMOVEXATTR = 235 + SYS_GETTID = 236 + SYS_TKILL = 237 + SYS_FUTEX = 238 + SYS_SCHED_SETAFFINITY = 239 + SYS_SCHED_GETAFFINITY = 240 + SYS_TGKILL = 241 + SYS_IO_SETUP = 243 + SYS_IO_DESTROY = 244 + SYS_IO_GETEVENTS = 245 + SYS_IO_SUBMIT = 246 + SYS_IO_CANCEL = 247 + SYS_EXIT_GROUP = 248 + SYS_EPOLL_CREATE = 249 + SYS_EPOLL_CTL = 250 + SYS_EPOLL_WAIT = 251 + SYS_SET_TID_ADDRESS = 252 + SYS_FADVISE64 = 253 + SYS_TIMER_CREATE = 254 + SYS_TIMER_SETTIME = 255 + SYS_TIMER_GETTIME = 256 + SYS_TIMER_GETOVERRUN = 257 + SYS_TIMER_DELETE = 258 + SYS_CLOCK_SETTIME = 259 + SYS_CLOCK_GETTIME = 260 + SYS_CLOCK_GETRES = 261 + SYS_CLOCK_NANOSLEEP = 262 + SYS_STATFS64 = 265 + SYS_FSTATFS64 = 266 + SYS_REMAP_FILE_PAGES = 267 + SYS_MBIND = 268 + SYS_GET_MEMPOLICY = 269 + SYS_SET_MEMPOLICY = 270 + SYS_MQ_OPEN = 271 + SYS_MQ_UNLINK = 272 + SYS_MQ_TIMEDSEND = 273 + SYS_MQ_TIMEDRECEIVE = 274 + SYS_MQ_NOTIFY = 275 + SYS_MQ_GETSETATTR = 276 + SYS_KEXEC_LOAD = 277 + SYS_ADD_KEY = 278 + SYS_REQUEST_KEY = 279 + SYS_KEYCTL = 280 + SYS_WAITID = 281 + SYS_IOPRIO_SET = 282 + SYS_IOPRIO_GET = 283 + SYS_INOTIFY_INIT = 284 + SYS_INOTIFY_ADD_WATCH = 285 + SYS_INOTIFY_RM_WATCH = 286 + SYS_MIGRATE_PAGES = 287 + SYS_OPENAT = 288 + SYS_MKDIRAT = 289 + SYS_MKNODAT = 290 + SYS_FCHOWNAT = 291 + SYS_FUTIMESAT = 292 + SYS_NEWFSTATAT = 293 + SYS_UNLINKAT = 294 + SYS_RENAMEAT = 295 + SYS_LINKAT = 296 + SYS_SYMLINKAT = 297 + SYS_READLINKAT = 298 + SYS_FCHMODAT = 299 + SYS_FACCESSAT = 300 + SYS_PSELECT6 = 301 + SYS_PPOLL = 302 + SYS_UNSHARE = 303 + SYS_SET_ROBUST_LIST = 304 + SYS_GET_ROBUST_LIST = 305 + SYS_SPLICE = 306 + SYS_SYNC_FILE_RANGE = 307 + SYS_TEE = 308 + SYS_VMSPLICE = 309 + SYS_MOVE_PAGES = 310 + SYS_GETCPU = 311 + SYS_EPOLL_PWAIT = 312 + SYS_UTIMES = 313 + SYS_FALLOCATE = 314 + SYS_UTIMENSAT = 315 + SYS_SIGNALFD = 316 + SYS_TIMERFD = 317 + SYS_EVENTFD = 318 + SYS_TIMERFD_CREATE = 319 + SYS_TIMERFD_SETTIME = 320 + SYS_TIMERFD_GETTIME = 321 + SYS_SIGNALFD4 = 322 + SYS_EVENTFD2 = 323 + SYS_INOTIFY_INIT1 = 324 + SYS_PIPE2 = 325 + SYS_DUP3 = 326 + SYS_EPOLL_CREATE1 = 327 + SYS_PREADV = 328 + SYS_PWRITEV = 329 + SYS_RT_TGSIGQUEUEINFO = 330 + SYS_PERF_EVENT_OPEN = 331 + SYS_FANOTIFY_INIT = 332 + SYS_FANOTIFY_MARK = 333 + SYS_PRLIMIT64 = 334 + SYS_NAME_TO_HANDLE_AT = 335 + SYS_OPEN_BY_HANDLE_AT = 336 + SYS_CLOCK_ADJTIME = 337 + SYS_SYNCFS = 338 + SYS_SETNS = 339 + SYS_PROCESS_VM_READV = 340 + SYS_PROCESS_VM_WRITEV = 341 + SYS_S390_RUNTIME_INSTR = 342 + SYS_KCMP = 343 + SYS_FINIT_MODULE = 344 + SYS_SCHED_SETATTR = 345 + SYS_SCHED_GETATTR = 346 + SYS_RENAMEAT2 = 347 + SYS_SECCOMP = 348 + SYS_GETRANDOM = 349 + SYS_MEMFD_CREATE = 350 + SYS_BPF = 351 + SYS_S390_PCI_MMIO_WRITE = 352 + SYS_S390_PCI_MMIO_READ = 353 + SYS_EXECVEAT = 354 + SYS_USERFAULTFD = 355 + SYS_MEMBARRIER = 356 + SYS_RECVMMSG = 357 + SYS_SENDMMSG = 358 + SYS_SOCKET = 359 + SYS_SOCKETPAIR = 360 + SYS_BIND = 361 + SYS_CONNECT = 362 + SYS_LISTEN = 363 + SYS_ACCEPT4 = 364 + SYS_GETSOCKOPT = 365 + SYS_SETSOCKOPT = 366 + SYS_GETSOCKNAME = 367 + SYS_GETPEERNAME = 368 + SYS_SENDTO = 369 + SYS_SENDMSG = 370 + SYS_RECVFROM = 371 + SYS_RECVMSG = 372 + SYS_SHUTDOWN = 373 + SYS_MLOCK2 = 374 + SYS_COPY_FILE_RANGE = 375 + SYS_PREADV2 = 376 + SYS_PWRITEV2 = 377 + SYS_S390_GUARDED_STORAGE = 378 + SYS_STATX = 379 + SYS_S390_STHYI = 380 + SYS_KEXEC_FILE_LOAD = 381 + SYS_IO_PGETEVENTS = 382 + SYS_RSEQ = 383 + SYS_PKEY_MPROTECT = 384 + SYS_PKEY_ALLOC = 385 + SYS_PKEY_FREE = 386 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLONE3 = 435 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 4dc82bb249..78802a5cf7 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -1,379 +1,389 @@ // go run linux/mksysnum.go -Wall -Werror -static -I/tmp/include /tmp/include/asm/unistd.h // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build sparc64 && linux // +build sparc64,linux package unix const ( - SYS_RESTART_SYSCALL = 0 - SYS_EXIT = 1 - SYS_FORK = 2 - SYS_READ = 3 - SYS_WRITE = 4 - SYS_OPEN = 5 - SYS_CLOSE = 6 - SYS_WAIT4 = 7 - SYS_CREAT = 8 - SYS_LINK = 9 - SYS_UNLINK = 10 - SYS_EXECV = 11 - SYS_CHDIR = 12 - SYS_CHOWN = 13 - SYS_MKNOD = 14 - SYS_CHMOD = 15 - SYS_LCHOWN = 16 - SYS_BRK = 17 - SYS_PERFCTR = 18 - SYS_LSEEK = 19 - SYS_GETPID = 20 - SYS_CAPGET = 21 - SYS_CAPSET = 22 - SYS_SETUID = 23 - SYS_GETUID = 24 - SYS_VMSPLICE = 25 - SYS_PTRACE = 26 - SYS_ALARM = 27 - SYS_SIGALTSTACK = 28 - SYS_PAUSE = 29 - SYS_UTIME = 30 - SYS_ACCESS = 33 - SYS_NICE = 34 - SYS_SYNC = 36 - SYS_KILL = 37 - SYS_STAT = 38 - SYS_SENDFILE = 39 - SYS_LSTAT = 40 - SYS_DUP = 41 - SYS_PIPE = 42 - SYS_TIMES = 43 - SYS_UMOUNT2 = 45 - SYS_SETGID = 46 - SYS_GETGID = 47 - SYS_SIGNAL = 48 - SYS_GETEUID = 49 - SYS_GETEGID = 50 - SYS_ACCT = 51 - SYS_MEMORY_ORDERING = 52 - SYS_IOCTL = 54 - SYS_REBOOT = 55 - SYS_SYMLINK = 57 - SYS_READLINK = 58 - SYS_EXECVE = 59 - SYS_UMASK = 60 - SYS_CHROOT = 61 - SYS_FSTAT = 62 - SYS_FSTAT64 = 63 - SYS_GETPAGESIZE = 64 - SYS_MSYNC = 65 - SYS_VFORK = 66 - SYS_PREAD64 = 67 - SYS_PWRITE64 = 68 - SYS_MMAP = 71 - SYS_MUNMAP = 73 - SYS_MPROTECT = 74 - SYS_MADVISE = 75 - SYS_VHANGUP = 76 - SYS_MINCORE = 78 - SYS_GETGROUPS = 79 - SYS_SETGROUPS = 80 - SYS_GETPGRP = 81 - SYS_SETITIMER = 83 - SYS_SWAPON = 85 - SYS_GETITIMER = 86 - SYS_SETHOSTNAME = 88 - SYS_DUP2 = 90 - SYS_FCNTL = 92 - SYS_SELECT = 93 - SYS_FSYNC = 95 - SYS_SETPRIORITY = 96 - SYS_SOCKET = 97 - SYS_CONNECT = 98 - SYS_ACCEPT = 99 - SYS_GETPRIORITY = 100 - SYS_RT_SIGRETURN = 101 - SYS_RT_SIGACTION = 102 - SYS_RT_SIGPROCMASK = 103 - SYS_RT_SIGPENDING = 104 - SYS_RT_SIGTIMEDWAIT = 105 - SYS_RT_SIGQUEUEINFO = 106 - SYS_RT_SIGSUSPEND = 107 - SYS_SETRESUID = 108 - SYS_GETRESUID = 109 - SYS_SETRESGID = 110 - SYS_GETRESGID = 111 - SYS_RECVMSG = 113 - SYS_SENDMSG = 114 - SYS_GETTIMEOFDAY = 116 - SYS_GETRUSAGE = 117 - SYS_GETSOCKOPT = 118 - SYS_GETCWD = 119 - SYS_READV = 120 - SYS_WRITEV = 121 - SYS_SETTIMEOFDAY = 122 - SYS_FCHOWN = 123 - SYS_FCHMOD = 124 - SYS_RECVFROM = 125 - SYS_SETREUID = 126 - SYS_SETREGID = 127 - SYS_RENAME = 128 - SYS_TRUNCATE = 129 - SYS_FTRUNCATE = 130 - SYS_FLOCK = 131 - SYS_LSTAT64 = 132 - SYS_SENDTO = 133 - SYS_SHUTDOWN = 134 - SYS_SOCKETPAIR = 135 - SYS_MKDIR = 136 - SYS_RMDIR = 137 - SYS_UTIMES = 138 - SYS_STAT64 = 139 - SYS_SENDFILE64 = 140 - SYS_GETPEERNAME = 141 - SYS_FUTEX = 142 - SYS_GETTID = 143 - SYS_GETRLIMIT = 144 - SYS_SETRLIMIT = 145 - SYS_PIVOT_ROOT = 146 - SYS_PRCTL = 147 - SYS_PCICONFIG_READ = 148 - SYS_PCICONFIG_WRITE = 149 - SYS_GETSOCKNAME = 150 - SYS_INOTIFY_INIT = 151 - SYS_INOTIFY_ADD_WATCH = 152 - SYS_POLL = 153 - SYS_GETDENTS64 = 154 - SYS_INOTIFY_RM_WATCH = 156 - SYS_STATFS = 157 - SYS_FSTATFS = 158 - SYS_UMOUNT = 159 - SYS_SCHED_SET_AFFINITY = 160 - SYS_SCHED_GET_AFFINITY = 161 - SYS_GETDOMAINNAME = 162 - SYS_SETDOMAINNAME = 163 - SYS_UTRAP_INSTALL = 164 - SYS_QUOTACTL = 165 - SYS_SET_TID_ADDRESS = 166 - SYS_MOUNT = 167 - SYS_USTAT = 168 - SYS_SETXATTR = 169 - SYS_LSETXATTR = 170 - SYS_FSETXATTR = 171 - SYS_GETXATTR = 172 - SYS_LGETXATTR = 173 - SYS_GETDENTS = 174 - SYS_SETSID = 175 - SYS_FCHDIR = 176 - SYS_FGETXATTR = 177 - SYS_LISTXATTR = 178 - SYS_LLISTXATTR = 179 - SYS_FLISTXATTR = 180 - SYS_REMOVEXATTR = 181 - SYS_LREMOVEXATTR = 182 - SYS_SIGPENDING = 183 - SYS_QUERY_MODULE = 184 - SYS_SETPGID = 185 - SYS_FREMOVEXATTR = 186 - SYS_TKILL = 187 - SYS_EXIT_GROUP = 188 - SYS_UNAME = 189 - SYS_INIT_MODULE = 190 - SYS_PERSONALITY = 191 - SYS_REMAP_FILE_PAGES = 192 - SYS_EPOLL_CREATE = 193 - SYS_EPOLL_CTL = 194 - SYS_EPOLL_WAIT = 195 - SYS_IOPRIO_SET = 196 - SYS_GETPPID = 197 - SYS_SIGACTION = 198 - SYS_SGETMASK = 199 - SYS_SSETMASK = 200 - SYS_SIGSUSPEND = 201 - SYS_OLDLSTAT = 202 - SYS_USELIB = 203 - SYS_READDIR = 204 - SYS_READAHEAD = 205 - SYS_SOCKETCALL = 206 - SYS_SYSLOG = 207 - SYS_LOOKUP_DCOOKIE = 208 - SYS_FADVISE64 = 209 - SYS_FADVISE64_64 = 210 - SYS_TGKILL = 211 - SYS_WAITPID = 212 - SYS_SWAPOFF = 213 - SYS_SYSINFO = 214 - SYS_IPC = 215 - SYS_SIGRETURN = 216 - SYS_CLONE = 217 - SYS_IOPRIO_GET = 218 - SYS_ADJTIMEX = 219 - SYS_SIGPROCMASK = 220 - SYS_CREATE_MODULE = 221 - SYS_DELETE_MODULE = 222 - SYS_GET_KERNEL_SYMS = 223 - SYS_GETPGID = 224 - SYS_BDFLUSH = 225 - SYS_SYSFS = 226 - SYS_AFS_SYSCALL = 227 - SYS_SETFSUID = 228 - SYS_SETFSGID = 229 - SYS__NEWSELECT = 230 - SYS_SPLICE = 232 - SYS_STIME = 233 - SYS_STATFS64 = 234 - SYS_FSTATFS64 = 235 - SYS__LLSEEK = 236 - SYS_MLOCK = 237 - SYS_MUNLOCK = 238 - SYS_MLOCKALL = 239 - SYS_MUNLOCKALL = 240 - SYS_SCHED_SETPARAM = 241 - SYS_SCHED_GETPARAM = 242 - SYS_SCHED_SETSCHEDULER = 243 - SYS_SCHED_GETSCHEDULER = 244 - SYS_SCHED_YIELD = 245 - SYS_SCHED_GET_PRIORITY_MAX = 246 - SYS_SCHED_GET_PRIORITY_MIN = 247 - SYS_SCHED_RR_GET_INTERVAL = 248 - SYS_NANOSLEEP = 249 - SYS_MREMAP = 250 - SYS__SYSCTL = 251 - SYS_GETSID = 252 - SYS_FDATASYNC = 253 - SYS_NFSSERVCTL = 254 - SYS_SYNC_FILE_RANGE = 255 - SYS_CLOCK_SETTIME = 256 - SYS_CLOCK_GETTIME = 257 - SYS_CLOCK_GETRES = 258 - SYS_CLOCK_NANOSLEEP = 259 - SYS_SCHED_GETAFFINITY = 260 - SYS_SCHED_SETAFFINITY = 261 - SYS_TIMER_SETTIME = 262 - SYS_TIMER_GETTIME = 263 - SYS_TIMER_GETOVERRUN = 264 - SYS_TIMER_DELETE = 265 - SYS_TIMER_CREATE = 266 - SYS_VSERVER = 267 - SYS_IO_SETUP = 268 - SYS_IO_DESTROY = 269 - SYS_IO_SUBMIT = 270 - SYS_IO_CANCEL = 271 - SYS_IO_GETEVENTS = 272 - SYS_MQ_OPEN = 273 - SYS_MQ_UNLINK = 274 - SYS_MQ_TIMEDSEND = 275 - SYS_MQ_TIMEDRECEIVE = 276 - SYS_MQ_NOTIFY = 277 - SYS_MQ_GETSETATTR = 278 - SYS_WAITID = 279 - SYS_TEE = 280 - SYS_ADD_KEY = 281 - SYS_REQUEST_KEY = 282 - SYS_KEYCTL = 283 - SYS_OPENAT = 284 - SYS_MKDIRAT = 285 - SYS_MKNODAT = 286 - SYS_FCHOWNAT = 287 - SYS_FUTIMESAT = 288 - SYS_FSTATAT64 = 289 - SYS_UNLINKAT = 290 - SYS_RENAMEAT = 291 - SYS_LINKAT = 292 - SYS_SYMLINKAT = 293 - SYS_READLINKAT = 294 - SYS_FCHMODAT = 295 - SYS_FACCESSAT = 296 - SYS_PSELECT6 = 297 - SYS_PPOLL = 298 - SYS_UNSHARE = 299 - SYS_SET_ROBUST_LIST = 300 - SYS_GET_ROBUST_LIST = 301 - SYS_MIGRATE_PAGES = 302 - SYS_MBIND = 303 - SYS_GET_MEMPOLICY = 304 - SYS_SET_MEMPOLICY = 305 - SYS_KEXEC_LOAD = 306 - SYS_MOVE_PAGES = 307 - SYS_GETCPU = 308 - SYS_EPOLL_PWAIT = 309 - SYS_UTIMENSAT = 310 - SYS_SIGNALFD = 311 - SYS_TIMERFD_CREATE = 312 - SYS_EVENTFD = 313 - SYS_FALLOCATE = 314 - SYS_TIMERFD_SETTIME = 315 - SYS_TIMERFD_GETTIME = 316 - SYS_SIGNALFD4 = 317 - SYS_EVENTFD2 = 318 - SYS_EPOLL_CREATE1 = 319 - SYS_DUP3 = 320 - SYS_PIPE2 = 321 - SYS_INOTIFY_INIT1 = 322 - SYS_ACCEPT4 = 323 - SYS_PREADV = 324 - SYS_PWRITEV = 325 - SYS_RT_TGSIGQUEUEINFO = 326 - SYS_PERF_EVENT_OPEN = 327 - SYS_RECVMMSG = 328 - SYS_FANOTIFY_INIT = 329 - SYS_FANOTIFY_MARK = 330 - SYS_PRLIMIT64 = 331 - SYS_NAME_TO_HANDLE_AT = 332 - SYS_OPEN_BY_HANDLE_AT = 333 - SYS_CLOCK_ADJTIME = 334 - SYS_SYNCFS = 335 - SYS_SENDMMSG = 336 - SYS_SETNS = 337 - SYS_PROCESS_VM_READV = 338 - SYS_PROCESS_VM_WRITEV = 339 - SYS_KERN_FEATURES = 340 - SYS_KCMP = 341 - SYS_FINIT_MODULE = 342 - SYS_SCHED_SETATTR = 343 - SYS_SCHED_GETATTR = 344 - SYS_RENAMEAT2 = 345 - SYS_SECCOMP = 346 - SYS_GETRANDOM = 347 - SYS_MEMFD_CREATE = 348 - SYS_BPF = 349 - SYS_EXECVEAT = 350 - SYS_MEMBARRIER = 351 - SYS_USERFAULTFD = 352 - SYS_BIND = 353 - SYS_LISTEN = 354 - SYS_SETSOCKOPT = 355 - SYS_MLOCK2 = 356 - SYS_COPY_FILE_RANGE = 357 - SYS_PREADV2 = 358 - SYS_PWRITEV2 = 359 - SYS_STATX = 360 - SYS_IO_PGETEVENTS = 361 - SYS_PKEY_MPROTECT = 362 - SYS_PKEY_ALLOC = 363 - SYS_PKEY_FREE = 364 - SYS_RSEQ = 365 - SYS_SEMTIMEDOP = 392 - SYS_SEMGET = 393 - SYS_SEMCTL = 394 - SYS_SHMGET = 395 - SYS_SHMCTL = 396 - SYS_SHMAT = 397 - SYS_SHMDT = 398 - SYS_MSGGET = 399 - SYS_MSGSND = 400 - SYS_MSGRCV = 401 - SYS_MSGCTL = 402 - SYS_PIDFD_SEND_SIGNAL = 424 - SYS_IO_URING_SETUP = 425 - SYS_IO_URING_ENTER = 426 - SYS_IO_URING_REGISTER = 427 - SYS_OPEN_TREE = 428 - SYS_MOVE_MOUNT = 429 - SYS_FSOPEN = 430 - SYS_FSCONFIG = 431 - SYS_FSMOUNT = 432 - SYS_FSPICK = 433 - SYS_PIDFD_OPEN = 434 - SYS_OPENAT2 = 437 - SYS_PIDFD_GETFD = 438 + SYS_RESTART_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAIT4 = 7 + SYS_CREAT = 8 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_EXECV = 11 + SYS_CHDIR = 12 + SYS_CHOWN = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_LCHOWN = 16 + SYS_BRK = 17 + SYS_PERFCTR = 18 + SYS_LSEEK = 19 + SYS_GETPID = 20 + SYS_CAPGET = 21 + SYS_CAPSET = 22 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_VMSPLICE = 25 + SYS_PTRACE = 26 + SYS_ALARM = 27 + SYS_SIGALTSTACK = 28 + SYS_PAUSE = 29 + SYS_UTIME = 30 + SYS_ACCESS = 33 + SYS_NICE = 34 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_STAT = 38 + SYS_SENDFILE = 39 + SYS_LSTAT = 40 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_TIMES = 43 + SYS_UMOUNT2 = 45 + SYS_SETGID = 46 + SYS_GETGID = 47 + SYS_SIGNAL = 48 + SYS_GETEUID = 49 + SYS_GETEGID = 50 + SYS_ACCT = 51 + SYS_MEMORY_ORDERING = 52 + SYS_IOCTL = 54 + SYS_REBOOT = 55 + SYS_SYMLINK = 57 + SYS_READLINK = 58 + SYS_EXECVE = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_FSTAT = 62 + SYS_FSTAT64 = 63 + SYS_GETPAGESIZE = 64 + SYS_MSYNC = 65 + SYS_VFORK = 66 + SYS_PREAD64 = 67 + SYS_PWRITE64 = 68 + SYS_MMAP = 71 + SYS_MUNMAP = 73 + SYS_MPROTECT = 74 + SYS_MADVISE = 75 + SYS_VHANGUP = 76 + SYS_MINCORE = 78 + SYS_GETGROUPS = 79 + SYS_SETGROUPS = 80 + SYS_GETPGRP = 81 + SYS_SETITIMER = 83 + SYS_SWAPON = 85 + SYS_GETITIMER = 86 + SYS_SETHOSTNAME = 88 + SYS_DUP2 = 90 + SYS_FCNTL = 92 + SYS_SELECT = 93 + SYS_FSYNC = 95 + SYS_SETPRIORITY = 96 + SYS_SOCKET = 97 + SYS_CONNECT = 98 + SYS_ACCEPT = 99 + SYS_GETPRIORITY = 100 + SYS_RT_SIGRETURN = 101 + SYS_RT_SIGACTION = 102 + SYS_RT_SIGPROCMASK = 103 + SYS_RT_SIGPENDING = 104 + SYS_RT_SIGTIMEDWAIT = 105 + SYS_RT_SIGQUEUEINFO = 106 + SYS_RT_SIGSUSPEND = 107 + SYS_SETRESUID = 108 + SYS_GETRESUID = 109 + SYS_SETRESGID = 110 + SYS_GETRESGID = 111 + SYS_RECVMSG = 113 + SYS_SENDMSG = 114 + SYS_GETTIMEOFDAY = 116 + SYS_GETRUSAGE = 117 + SYS_GETSOCKOPT = 118 + SYS_GETCWD = 119 + SYS_READV = 120 + SYS_WRITEV = 121 + SYS_SETTIMEOFDAY = 122 + SYS_FCHOWN = 123 + SYS_FCHMOD = 124 + SYS_RECVFROM = 125 + SYS_SETREUID = 126 + SYS_SETREGID = 127 + SYS_RENAME = 128 + SYS_TRUNCATE = 129 + SYS_FTRUNCATE = 130 + SYS_FLOCK = 131 + SYS_LSTAT64 = 132 + SYS_SENDTO = 133 + SYS_SHUTDOWN = 134 + SYS_SOCKETPAIR = 135 + SYS_MKDIR = 136 + SYS_RMDIR = 137 + SYS_UTIMES = 138 + SYS_STAT64 = 139 + SYS_SENDFILE64 = 140 + SYS_GETPEERNAME = 141 + SYS_FUTEX = 142 + SYS_GETTID = 143 + SYS_GETRLIMIT = 144 + SYS_SETRLIMIT = 145 + SYS_PIVOT_ROOT = 146 + SYS_PRCTL = 147 + SYS_PCICONFIG_READ = 148 + SYS_PCICONFIG_WRITE = 149 + SYS_GETSOCKNAME = 150 + SYS_INOTIFY_INIT = 151 + SYS_INOTIFY_ADD_WATCH = 152 + SYS_POLL = 153 + SYS_GETDENTS64 = 154 + SYS_INOTIFY_RM_WATCH = 156 + SYS_STATFS = 157 + SYS_FSTATFS = 158 + SYS_UMOUNT = 159 + SYS_SCHED_SET_AFFINITY = 160 + SYS_SCHED_GET_AFFINITY = 161 + SYS_GETDOMAINNAME = 162 + SYS_SETDOMAINNAME = 163 + SYS_UTRAP_INSTALL = 164 + SYS_QUOTACTL = 165 + SYS_SET_TID_ADDRESS = 166 + SYS_MOUNT = 167 + SYS_USTAT = 168 + SYS_SETXATTR = 169 + SYS_LSETXATTR = 170 + SYS_FSETXATTR = 171 + SYS_GETXATTR = 172 + SYS_LGETXATTR = 173 + SYS_GETDENTS = 174 + SYS_SETSID = 175 + SYS_FCHDIR = 176 + SYS_FGETXATTR = 177 + SYS_LISTXATTR = 178 + SYS_LLISTXATTR = 179 + SYS_FLISTXATTR = 180 + SYS_REMOVEXATTR = 181 + SYS_LREMOVEXATTR = 182 + SYS_SIGPENDING = 183 + SYS_QUERY_MODULE = 184 + SYS_SETPGID = 185 + SYS_FREMOVEXATTR = 186 + SYS_TKILL = 187 + SYS_EXIT_GROUP = 188 + SYS_UNAME = 189 + SYS_INIT_MODULE = 190 + SYS_PERSONALITY = 191 + SYS_REMAP_FILE_PAGES = 192 + SYS_EPOLL_CREATE = 193 + SYS_EPOLL_CTL = 194 + SYS_EPOLL_WAIT = 195 + SYS_IOPRIO_SET = 196 + SYS_GETPPID = 197 + SYS_SIGACTION = 198 + SYS_SGETMASK = 199 + SYS_SSETMASK = 200 + SYS_SIGSUSPEND = 201 + SYS_OLDLSTAT = 202 + SYS_USELIB = 203 + SYS_READDIR = 204 + SYS_READAHEAD = 205 + SYS_SOCKETCALL = 206 + SYS_SYSLOG = 207 + SYS_LOOKUP_DCOOKIE = 208 + SYS_FADVISE64 = 209 + SYS_FADVISE64_64 = 210 + SYS_TGKILL = 211 + SYS_WAITPID = 212 + SYS_SWAPOFF = 213 + SYS_SYSINFO = 214 + SYS_IPC = 215 + SYS_SIGRETURN = 216 + SYS_CLONE = 217 + SYS_IOPRIO_GET = 218 + SYS_ADJTIMEX = 219 + SYS_SIGPROCMASK = 220 + SYS_CREATE_MODULE = 221 + SYS_DELETE_MODULE = 222 + SYS_GET_KERNEL_SYMS = 223 + SYS_GETPGID = 224 + SYS_BDFLUSH = 225 + SYS_SYSFS = 226 + SYS_AFS_SYSCALL = 227 + SYS_SETFSUID = 228 + SYS_SETFSGID = 229 + SYS__NEWSELECT = 230 + SYS_SPLICE = 232 + SYS_STIME = 233 + SYS_STATFS64 = 234 + SYS_FSTATFS64 = 235 + SYS__LLSEEK = 236 + SYS_MLOCK = 237 + SYS_MUNLOCK = 238 + SYS_MLOCKALL = 239 + SYS_MUNLOCKALL = 240 + SYS_SCHED_SETPARAM = 241 + SYS_SCHED_GETPARAM = 242 + SYS_SCHED_SETSCHEDULER = 243 + SYS_SCHED_GETSCHEDULER = 244 + SYS_SCHED_YIELD = 245 + SYS_SCHED_GET_PRIORITY_MAX = 246 + SYS_SCHED_GET_PRIORITY_MIN = 247 + SYS_SCHED_RR_GET_INTERVAL = 248 + SYS_NANOSLEEP = 249 + SYS_MREMAP = 250 + SYS__SYSCTL = 251 + SYS_GETSID = 252 + SYS_FDATASYNC = 253 + SYS_NFSSERVCTL = 254 + SYS_SYNC_FILE_RANGE = 255 + SYS_CLOCK_SETTIME = 256 + SYS_CLOCK_GETTIME = 257 + SYS_CLOCK_GETRES = 258 + SYS_CLOCK_NANOSLEEP = 259 + SYS_SCHED_GETAFFINITY = 260 + SYS_SCHED_SETAFFINITY = 261 + SYS_TIMER_SETTIME = 262 + SYS_TIMER_GETTIME = 263 + SYS_TIMER_GETOVERRUN = 264 + SYS_TIMER_DELETE = 265 + SYS_TIMER_CREATE = 266 + SYS_VSERVER = 267 + SYS_IO_SETUP = 268 + SYS_IO_DESTROY = 269 + SYS_IO_SUBMIT = 270 + SYS_IO_CANCEL = 271 + SYS_IO_GETEVENTS = 272 + SYS_MQ_OPEN = 273 + SYS_MQ_UNLINK = 274 + SYS_MQ_TIMEDSEND = 275 + SYS_MQ_TIMEDRECEIVE = 276 + SYS_MQ_NOTIFY = 277 + SYS_MQ_GETSETATTR = 278 + SYS_WAITID = 279 + SYS_TEE = 280 + SYS_ADD_KEY = 281 + SYS_REQUEST_KEY = 282 + SYS_KEYCTL = 283 + SYS_OPENAT = 284 + SYS_MKDIRAT = 285 + SYS_MKNODAT = 286 + SYS_FCHOWNAT = 287 + SYS_FUTIMESAT = 288 + SYS_FSTATAT64 = 289 + SYS_UNLINKAT = 290 + SYS_RENAMEAT = 291 + SYS_LINKAT = 292 + SYS_SYMLINKAT = 293 + SYS_READLINKAT = 294 + SYS_FCHMODAT = 295 + SYS_FACCESSAT = 296 + SYS_PSELECT6 = 297 + SYS_PPOLL = 298 + SYS_UNSHARE = 299 + SYS_SET_ROBUST_LIST = 300 + SYS_GET_ROBUST_LIST = 301 + SYS_MIGRATE_PAGES = 302 + SYS_MBIND = 303 + SYS_GET_MEMPOLICY = 304 + SYS_SET_MEMPOLICY = 305 + SYS_KEXEC_LOAD = 306 + SYS_MOVE_PAGES = 307 + SYS_GETCPU = 308 + SYS_EPOLL_PWAIT = 309 + SYS_UTIMENSAT = 310 + SYS_SIGNALFD = 311 + SYS_TIMERFD_CREATE = 312 + SYS_EVENTFD = 313 + SYS_FALLOCATE = 314 + SYS_TIMERFD_SETTIME = 315 + SYS_TIMERFD_GETTIME = 316 + SYS_SIGNALFD4 = 317 + SYS_EVENTFD2 = 318 + SYS_EPOLL_CREATE1 = 319 + SYS_DUP3 = 320 + SYS_PIPE2 = 321 + SYS_INOTIFY_INIT1 = 322 + SYS_ACCEPT4 = 323 + SYS_PREADV = 324 + SYS_PWRITEV = 325 + SYS_RT_TGSIGQUEUEINFO = 326 + SYS_PERF_EVENT_OPEN = 327 + SYS_RECVMMSG = 328 + SYS_FANOTIFY_INIT = 329 + SYS_FANOTIFY_MARK = 330 + SYS_PRLIMIT64 = 331 + SYS_NAME_TO_HANDLE_AT = 332 + SYS_OPEN_BY_HANDLE_AT = 333 + SYS_CLOCK_ADJTIME = 334 + SYS_SYNCFS = 335 + SYS_SENDMMSG = 336 + SYS_SETNS = 337 + SYS_PROCESS_VM_READV = 338 + SYS_PROCESS_VM_WRITEV = 339 + SYS_KERN_FEATURES = 340 + SYS_KCMP = 341 + SYS_FINIT_MODULE = 342 + SYS_SCHED_SETATTR = 343 + SYS_SCHED_GETATTR = 344 + SYS_RENAMEAT2 = 345 + SYS_SECCOMP = 346 + SYS_GETRANDOM = 347 + SYS_MEMFD_CREATE = 348 + SYS_BPF = 349 + SYS_EXECVEAT = 350 + SYS_MEMBARRIER = 351 + SYS_USERFAULTFD = 352 + SYS_BIND = 353 + SYS_LISTEN = 354 + SYS_SETSOCKOPT = 355 + SYS_MLOCK2 = 356 + SYS_COPY_FILE_RANGE = 357 + SYS_PREADV2 = 358 + SYS_PWRITEV2 = 359 + SYS_STATX = 360 + SYS_IO_PGETEVENTS = 361 + SYS_PKEY_MPROTECT = 362 + SYS_PKEY_ALLOC = 363 + SYS_PKEY_FREE = 364 + SYS_RSEQ = 365 + SYS_SEMTIMEDOP = 392 + SYS_SEMGET = 393 + SYS_SEMCTL = 394 + SYS_SHMGET = 395 + SYS_SHMCTL = 396 + SYS_SHMAT = 397 + SYS_SHMDT = 398 + SYS_MSGGET = 399 + SYS_MSGSND = 400 + SYS_MSGRCV = 401 + SYS_MSGCTL = 402 + SYS_PIDFD_SEND_SIGNAL = 424 + SYS_IO_URING_SETUP = 425 + SYS_IO_URING_ENTER = 426 + SYS_IO_URING_REGISTER = 427 + SYS_OPEN_TREE = 428 + SYS_MOVE_MOUNT = 429 + SYS_FSOPEN = 430 + SYS_FSCONFIG = 431 + SYS_FSMOUNT = 432 + SYS_FSPICK = 433 + SYS_PIDFD_OPEN = 434 + SYS_CLOSE_RANGE = 436 + SYS_OPENAT2 = 437 + SYS_PIDFD_GETFD = 438 + SYS_FACCESSAT2 = 439 + SYS_PROCESS_MADVISE = 440 + SYS_EPOLL_PWAIT2 = 441 + SYS_MOUNT_SETATTR = 442 + SYS_QUOTACTL_FD = 443 + SYS_LANDLOCK_CREATE_RULESET = 444 + SYS_LANDLOCK_ADD_RULE = 445 + SYS_LANDLOCK_RESTRICT_SELF = 446 ) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go index e66a8c9d39..3a6699eba9 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go @@ -1,6 +1,7 @@ // go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && netbsd // +build 386,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go index 42c788f249..5677cd4f15 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && netbsd // +build amd64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go index 0a0757179b..e784cb6db1 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go @@ -1,6 +1,7 @@ // go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && netbsd // +build arm,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go index 0291c0931b..bd4952efa5 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksysnum.go http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; DO NOT EDIT. +//go:build arm64 && netbsd // +build arm64,netbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go index b0207d1c9b..817edbf95c 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && openbsd // +build 386,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go index f0dec6f0b4..ea453614e6 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && openbsd // +build amd64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go index 33d1dc5404..467971eed6 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && openbsd // +build arm,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go index fe2b689b63..32eec5ed56 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go @@ -1,6 +1,7 @@ // go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && openbsd // +build arm64,openbsd package unix diff --git a/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go new file mode 100644 index 0000000000..a37f773756 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go @@ -0,0 +1,221 @@ +// go run mksysnum.go https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build mips64 && openbsd +// +build mips64,openbsd + +package unix + +const ( + SYS_EXIT = 1 // { void sys_exit(int rval); } + SYS_FORK = 2 // { int sys_fork(void); } + SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); } + SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, size_t nbyte); } + SYS_OPEN = 5 // { int sys_open(const char *path, int flags, ... mode_t mode); } + SYS_CLOSE = 6 // { int sys_close(int fd); } + SYS_GETENTROPY = 7 // { int sys_getentropy(void *buf, size_t nbyte); } + SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, size_t psize); } + SYS_LINK = 9 // { int sys_link(const char *path, const char *link); } + SYS_UNLINK = 10 // { int sys_unlink(const char *path); } + SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage); } + SYS_CHDIR = 12 // { int sys_chdir(const char *path); } + SYS_FCHDIR = 13 // { int sys_fchdir(int fd); } + SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, dev_t dev); } + SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); } + SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, gid_t gid); } + SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break + SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); } + SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, struct rusage *rusage); } + SYS_GETPID = 20 // { pid_t sys_getpid(void); } + SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, int flags, void *data); } + SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); } + SYS_SETUID = 23 // { int sys_setuid(uid_t uid); } + SYS_GETUID = 24 // { uid_t sys_getuid(void); } + SYS_GETEUID = 25 // { uid_t sys_geteuid(void); } + SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, int data); } + SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, int flags); } + SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, const struct msghdr *msg, int flags); } + SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlenaddr); } + SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, socklen_t *anamelen); } + SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, socklen_t *alen); } + SYS_ACCESS = 33 // { int sys_access(const char *path, int amode); } + SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); } + SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); } + SYS_SYNC = 36 // { void sys_sync(void); } + SYS_MSYSCALL = 37 // { int sys_msyscall(void *addr, size_t len); } + SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); } + SYS_GETPPID = 39 // { pid_t sys_getppid(void); } + SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); } + SYS_DUP = 41 // { int sys_dup(int fd); } + SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, struct stat *buf, int flag); } + SYS_GETEGID = 43 // { gid_t sys_getegid(void); } + SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, u_long offset, u_int scale); } + SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, int facs, pid_t pid); } + SYS_SIGACTION = 46 // { int sys_sigaction(int signum, const struct sigaction *nsa, struct sigaction *osa); } + SYS_GETGID = 47 // { gid_t sys_getgid(void); } + SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); } + SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); } + SYS_ACCT = 51 // { int sys_acct(const char *path); } + SYS_SIGPENDING = 52 // { int sys_sigpending(void); } + SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); } + SYS_IOCTL = 54 // { int sys_ioctl(int fd, u_long com, ... void *data); } + SYS_REBOOT = 55 // { int sys_reboot(int opt); } + SYS_REVOKE = 56 // { int sys_revoke(const char *path); } + SYS_SYMLINK = 57 // { int sys_symlink(const char *path, const char *link); } + SYS_READLINK = 58 // { ssize_t sys_readlink(const char *path, char *buf, size_t count); } + SYS_EXECVE = 59 // { int sys_execve(const char *path, char * const *argp, char * const *envp); } + SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); } + SYS_CHROOT = 61 // { int sys_chroot(const char *path); } + SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, int flags); } + SYS_STATFS = 63 // { int sys_statfs(const char *path, struct statfs *buf); } + SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); } + SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, struct statfs *buf); } + SYS_VFORK = 66 // { int sys_vfork(void); } + SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, struct timezone *tzp); } + SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, const struct timezone *tzp); } + SYS_SETITIMER = 69 // { int sys_setitimer(int which, const struct itimerval *itv, struct itimerval *oitv); } + SYS_GETITIMER = 70 // { int sys_getitimer(int which, struct itimerval *itv); } + SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, fd_set *ex, struct timeval *tv); } + SYS_KEVENT = 72 // { int sys_kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } + SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); } + SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, int prot); } + SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, int behav); } + SYS_UTIMES = 76 // { int sys_utimes(const char *path, const struct timeval *tptr); } + SYS_FUTIMES = 77 // { int sys_futimes(int fd, const struct timeval *tptr); } + SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, gid_t *gidset); } + SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, const gid_t *gidset); } + SYS_GETPGRP = 81 // { int sys_getpgrp(void); } + SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, pid_t pgid); } + SYS_FUTEX = 83 // { int sys_futex(uint32_t *f, int op, int val, const struct timespec *timeout, uint32_t *g); } + SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, const struct timespec *times, int flag); } + SYS_FUTIMENS = 85 // { int sys_futimens(int fd, const struct timespec *times); } + SYS_KBIND = 86 // { int sys_kbind(const struct __kbind *param, size_t psize, int64_t proc_cookie); } + SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, struct timespec *tp); } + SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, const struct timespec *tp); } + SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, struct timespec *tp); } + SYS_DUP2 = 90 // { int sys_dup2(int from, int to); } + SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, struct timespec *rmtp); } + SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); } + SYS_ACCEPT4 = 93 // { int sys_accept4(int s, struct sockaddr *name, socklen_t *anamelen, int flags); } + SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, clockid_t clock_id, const struct timespec *tp, void *lock, const int *abort); } + SYS_FSYNC = 95 // { int sys_fsync(int fd); } + SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); } + SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); } + SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); } + SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); } + SYS_PIPE2 = 101 // { int sys_pipe2(int *fdp, int flags); } + SYS_DUP3 = 102 // { int sys_dup3(int from, int to, int flags); } + SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); } + SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, socklen_t namelen); } + SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, const void *val, socklen_t valsize); } + SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); } + SYS_CHFLAGSAT = 107 // { int sys_chflagsat(int fd, const char *path, u_int flags, int atflags); } + SYS_PLEDGE = 108 // { int sys_pledge(const char *promises, const char *execpromises); } + SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, u_int nfds, const struct timespec *ts, const sigset_t *mask); } + SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, fd_set *ex, const struct timespec *ts, const sigset_t *mask); } + SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); } + SYS_SENDSYSLOG = 112 // { int sys_sendsyslog(const char *buf, size_t nbyte, int flags); } + SYS_UNVEIL = 114 // { int sys_unveil(const char *path, const char *permissions); } + SYS___REALPATH = 115 // { int sys___realpath(const char *pathname, char *resolved); } + SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, void *val, socklen_t *avalsize); } + SYS_THRKILL = 119 // { int sys_thrkill(pid_t tid, int signum, void *tcb); } + SYS_READV = 120 // { ssize_t sys_readv(int fd, const struct iovec *iovp, int iovcnt); } + SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, const struct iovec *iovp, int iovcnt); } + SYS_KILL = 122 // { int sys_kill(int pid, int signum); } + SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); } + SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); } + SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); } + SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); } + SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); } + SYS_FLOCK = 131 // { int sys_flock(int fd, int how); } + SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); } + SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); } + SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); } + SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, int protocol, int *rsv); } + SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); } + SYS_RMDIR = 137 // { int sys_rmdir(const char *path); } + SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, struct timeval *olddelta); } + SYS_GETLOGIN_R = 141 // { int sys_getlogin_r(char *namebuf, u_int namelen); } + SYS_SETSID = 147 // { int sys_setsid(void); } + SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, int uid, char *arg); } + SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); } + SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); } + SYS___TMPFD = 164 // { int sys___tmpfd(int flags); } + SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); } + SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, size_t nbyte, int pad, off_t offset); } + SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, size_t nbyte, int pad, off_t offset); } + SYS_SETGID = 181 // { int sys_setgid(gid_t gid); } + SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); } + SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); } + SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); } + SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); } + SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); } + SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, struct rlimit *rlp); } + SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, const struct rlimit *rlp); } + SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, int whence); } + SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, off_t length); } + SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); } + SYS_SYSCTL = 202 // { int sys_sysctl(const int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } + SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); } + SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); } + SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); } + SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, size_t len); } + SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); } + SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); } + SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); } + SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } + SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, int shmflg); } + SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); } + SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, int inherit); } + SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, u_int nfds, int timeout); } + SYS_ISSETUGID = 253 // { int sys_issetugid(void); } + SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); } + SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); } + SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); } + SYS_PIPE = 263 // { int sys_pipe(int *fdp); } + SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); } + SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, const struct iovec *iovp, int iovcnt, int pad, off_t offset); } + SYS_KQUEUE = 269 // { int sys_kqueue(void); } + SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); } + SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); } + SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); } + SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); } + SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); } + SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); } + SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, int flags, int fd, long pad, off_t pos); } + SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); } + SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, struct sigaltstack *oss); } + SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); } + SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, size_t nsops); } + SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, struct stat *sb); } + SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, union semun *arg); } + SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, struct shmid_ds *buf); } + SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, struct msqid_ds *buf); } + SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); } + SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); } + SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, int n); } + SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); } + SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, siginfo_t *info, const struct timespec *timeout); } + SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); } + SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, int64_t *oldfreq); } + SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); } + SYS_GETRTABLE = 311 // { int sys_getrtable(void); } + SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, int amode, int flag); } + SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, mode_t mode, int flag); } + SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, uid_t uid, gid_t gid, int flag); } + SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, const char *path2, int flag); } + SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, mode_t mode); } + SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, mode_t mode); } + SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, mode_t mode, dev_t dev); } + SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, ... mode_t mode); } + SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, char *buf, size_t count); } + SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, int tofd, const char *to); } + SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, const char *link); } + SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, int flag); } + SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); } + SYS___GET_TCB = 330 // { void *sys___get_tcb(void); } +) diff --git a/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go new file mode 100644 index 0000000000..073daad43b --- /dev/null +++ b/vendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go @@ -0,0 +1,2670 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +package unix + +// TODO: auto-generate. + +const ( + SYS_ACOSD128 = 0xB80 + SYS_ACOSD32 = 0xB7E + SYS_ACOSD64 = 0xB7F + SYS_ACOSHD128 = 0xB83 + SYS_ACOSHD32 = 0xB81 + SYS_ACOSHD64 = 0xB82 + SYS_AIO_FSYNC = 0xC69 + SYS_ASCTIME = 0x0AE + SYS_ASCTIME64 = 0xCD7 + SYS_ASCTIME64_R = 0xCD8 + SYS_ASIND128 = 0xB86 + SYS_ASIND32 = 0xB84 + SYS_ASIND64 = 0xB85 + SYS_ASINHD128 = 0xB89 + SYS_ASINHD32 = 0xB87 + SYS_ASINHD64 = 0xB88 + SYS_ATAN2D128 = 0xB8F + SYS_ATAN2D32 = 0xB8D + SYS_ATAN2D64 = 0xB8E + SYS_ATAND128 = 0xB8C + SYS_ATAND32 = 0xB8A + SYS_ATAND64 = 0xB8B + SYS_ATANHD128 = 0xB92 + SYS_ATANHD32 = 0xB90 + SYS_ATANHD64 = 0xB91 + SYS_BIND2ADDRSEL = 0xD59 + SYS_C16RTOMB = 0xD40 + SYS_C32RTOMB = 0xD41 + SYS_CBRTD128 = 0xB95 + SYS_CBRTD32 = 0xB93 + SYS_CBRTD64 = 0xB94 + SYS_CEILD128 = 0xB98 + SYS_CEILD32 = 0xB96 + SYS_CEILD64 = 0xB97 + SYS_CLEARENV = 0x0C9 + SYS_CLEARERR_UNLOCKED = 0xCA1 + SYS_CLOCK = 0x0AA + SYS_CLOGL = 0xA00 + SYS_CLRMEMF = 0x0BD + SYS_CONJ = 0xA03 + SYS_CONJF = 0xA06 + SYS_CONJL = 0xA09 + SYS_COPYSIGND128 = 0xB9E + SYS_COPYSIGND32 = 0xB9C + SYS_COPYSIGND64 = 0xB9D + SYS_COSD128 = 0xBA1 + SYS_COSD32 = 0xB9F + SYS_COSD64 = 0xBA0 + SYS_COSHD128 = 0xBA4 + SYS_COSHD32 = 0xBA2 + SYS_COSHD64 = 0xBA3 + SYS_CPOW = 0xA0C + SYS_CPOWF = 0xA0F + SYS_CPOWL = 0xA12 + SYS_CPROJ = 0xA15 + SYS_CPROJF = 0xA18 + SYS_CPROJL = 0xA1B + SYS_CREAL = 0xA1E + SYS_CREALF = 0xA21 + SYS_CREALL = 0xA24 + SYS_CSIN = 0xA27 + SYS_CSINF = 0xA2A + SYS_CSINH = 0xA30 + SYS_CSINHF = 0xA33 + SYS_CSINHL = 0xA36 + SYS_CSINL = 0xA2D + SYS_CSNAP = 0x0C5 + SYS_CSQRT = 0xA39 + SYS_CSQRTF = 0xA3C + SYS_CSQRTL = 0xA3F + SYS_CTAN = 0xA42 + SYS_CTANF = 0xA45 + SYS_CTANH = 0xA4B + SYS_CTANHF = 0xA4E + SYS_CTANHL = 0xA51 + SYS_CTANL = 0xA48 + SYS_CTIME = 0x0AB + SYS_CTIME64 = 0xCD9 + SYS_CTIME64_R = 0xCDA + SYS_CTRACE = 0x0C6 + SYS_DIFFTIME = 0x0A7 + SYS_DIFFTIME64 = 0xCDB + SYS_DLADDR = 0xC82 + SYS_DYNALLOC = 0x0C3 + SYS_DYNFREE = 0x0C2 + SYS_ERFCD128 = 0xBAA + SYS_ERFCD32 = 0xBA8 + SYS_ERFCD64 = 0xBA9 + SYS_ERFD128 = 0xBA7 + SYS_ERFD32 = 0xBA5 + SYS_ERFD64 = 0xBA6 + SYS_EXP2D128 = 0xBB0 + SYS_EXP2D32 = 0xBAE + SYS_EXP2D64 = 0xBAF + SYS_EXPD128 = 0xBAD + SYS_EXPD32 = 0xBAB + SYS_EXPD64 = 0xBAC + SYS_EXPM1D128 = 0xBB3 + SYS_EXPM1D32 = 0xBB1 + SYS_EXPM1D64 = 0xBB2 + SYS_FABSD128 = 0xBB6 + SYS_FABSD32 = 0xBB4 + SYS_FABSD64 = 0xBB5 + SYS_FDELREC_UNLOCKED = 0xCA2 + SYS_FDIMD128 = 0xBB9 + SYS_FDIMD32 = 0xBB7 + SYS_FDIMD64 = 0xBB8 + SYS_FDOPEN_UNLOCKED = 0xCFC + SYS_FECLEAREXCEPT = 0xAEA + SYS_FEGETENV = 0xAEB + SYS_FEGETEXCEPTFLAG = 0xAEC + SYS_FEGETROUND = 0xAED + SYS_FEHOLDEXCEPT = 0xAEE + SYS_FEOF_UNLOCKED = 0xCA3 + SYS_FERAISEEXCEPT = 0xAEF + SYS_FERROR_UNLOCKED = 0xCA4 + SYS_FESETENV = 0xAF0 + SYS_FESETEXCEPTFLAG = 0xAF1 + SYS_FESETROUND = 0xAF2 + SYS_FETCHEP = 0x0BF + SYS_FETESTEXCEPT = 0xAF3 + SYS_FEUPDATEENV = 0xAF4 + SYS_FE_DEC_GETROUND = 0xBBA + SYS_FE_DEC_SETROUND = 0xBBB + SYS_FFLUSH_UNLOCKED = 0xCA5 + SYS_FGETC_UNLOCKED = 0xC80 + SYS_FGETPOS64 = 0xCEE + SYS_FGETPOS64_UNLOCKED = 0xCF4 + SYS_FGETPOS_UNLOCKED = 0xCA6 + SYS_FGETS_UNLOCKED = 0xC7C + SYS_FGETWC_UNLOCKED = 0xCA7 + SYS_FGETWS_UNLOCKED = 0xCA8 + SYS_FILENO_UNLOCKED = 0xCA9 + SYS_FLDATA = 0x0C1 + SYS_FLDATA_UNLOCKED = 0xCAA + SYS_FLOCATE_UNLOCKED = 0xCAB + SYS_FLOORD128 = 0xBBE + SYS_FLOORD32 = 0xBBC + SYS_FLOORD64 = 0xBBD + SYS_FMA = 0xA63 + SYS_FMAD128 = 0xBC1 + SYS_FMAD32 = 0xBBF + SYS_FMAD64 = 0xBC0 + SYS_FMAF = 0xA66 + SYS_FMAL = 0xA69 + SYS_FMAX = 0xA6C + SYS_FMAXD128 = 0xBC4 + SYS_FMAXD32 = 0xBC2 + SYS_FMAXD64 = 0xBC3 + SYS_FMAXF = 0xA6F + SYS_FMAXL = 0xA72 + SYS_FMIN = 0xA75 + SYS_FMIND128 = 0xBC7 + SYS_FMIND32 = 0xBC5 + SYS_FMIND64 = 0xBC6 + SYS_FMINF = 0xA78 + SYS_FMINL = 0xA7B + SYS_FMODD128 = 0xBCA + SYS_FMODD32 = 0xBC8 + SYS_FMODD64 = 0xBC9 + SYS_FOPEN64 = 0xD49 + SYS_FOPEN64_UNLOCKED = 0xD4A + SYS_FOPEN_UNLOCKED = 0xCFA + SYS_FPRINTF_UNLOCKED = 0xCAC + SYS_FPUTC_UNLOCKED = 0xC81 + SYS_FPUTS_UNLOCKED = 0xC7E + SYS_FPUTWC_UNLOCKED = 0xCAD + SYS_FPUTWS_UNLOCKED = 0xCAE + SYS_FREAD_NOUPDATE = 0xCEC + SYS_FREAD_NOUPDATE_UNLOCKED = 0xCED + SYS_FREAD_UNLOCKED = 0xC7B + SYS_FREEIFADDRS = 0xCE6 + SYS_FREOPEN64 = 0xD4B + SYS_FREOPEN64_UNLOCKED = 0xD4C + SYS_FREOPEN_UNLOCKED = 0xCFB + SYS_FREXPD128 = 0xBCE + SYS_FREXPD32 = 0xBCC + SYS_FREXPD64 = 0xBCD + SYS_FSCANF_UNLOCKED = 0xCAF + SYS_FSEEK64 = 0xCEF + SYS_FSEEK64_UNLOCKED = 0xCF5 + SYS_FSEEKO64 = 0xCF0 + SYS_FSEEKO64_UNLOCKED = 0xCF6 + SYS_FSEEKO_UNLOCKED = 0xCB1 + SYS_FSEEK_UNLOCKED = 0xCB0 + SYS_FSETPOS64 = 0xCF1 + SYS_FSETPOS64_UNLOCKED = 0xCF7 + SYS_FSETPOS_UNLOCKED = 0xCB3 + SYS_FTELL64 = 0xCF2 + SYS_FTELL64_UNLOCKED = 0xCF8 + SYS_FTELLO64 = 0xCF3 + SYS_FTELLO64_UNLOCKED = 0xCF9 + SYS_FTELLO_UNLOCKED = 0xCB5 + SYS_FTELL_UNLOCKED = 0xCB4 + SYS_FUPDATE = 0x0B5 + SYS_FUPDATE_UNLOCKED = 0xCB7 + SYS_FWIDE_UNLOCKED = 0xCB8 + SYS_FWPRINTF_UNLOCKED = 0xCB9 + SYS_FWRITE_UNLOCKED = 0xC7A + SYS_FWSCANF_UNLOCKED = 0xCBA + SYS_GETDATE64 = 0xD4F + SYS_GETIFADDRS = 0xCE7 + SYS_GETIPV4SOURCEFILTER = 0xC77 + SYS_GETSOURCEFILTER = 0xC79 + SYS_GETSYNTX = 0x0FD + SYS_GETS_UNLOCKED = 0xC7D + SYS_GETTIMEOFDAY64 = 0xD50 + SYS_GETWCHAR_UNLOCKED = 0xCBC + SYS_GETWC_UNLOCKED = 0xCBB + SYS_GMTIME = 0x0B0 + SYS_GMTIME64 = 0xCDC + SYS_GMTIME64_R = 0xCDD + SYS_HYPOTD128 = 0xBD1 + SYS_HYPOTD32 = 0xBCF + SYS_HYPOTD64 = 0xBD0 + SYS_ILOGBD128 = 0xBD4 + SYS_ILOGBD32 = 0xBD2 + SYS_ILOGBD64 = 0xBD3 + SYS_ILOGBF = 0xA7E + SYS_ILOGBL = 0xA81 + SYS_INET6_IS_SRCADDR = 0xD5A + SYS_ISBLANK = 0x0FE + SYS_ISWALNUM = 0x0FF + SYS_LDEXPD128 = 0xBD7 + SYS_LDEXPD32 = 0xBD5 + SYS_LDEXPD64 = 0xBD6 + SYS_LGAMMAD128 = 0xBDA + SYS_LGAMMAD32 = 0xBD8 + SYS_LGAMMAD64 = 0xBD9 + SYS_LIO_LISTIO = 0xC6A + SYS_LLRINT = 0xA84 + SYS_LLRINTD128 = 0xBDD + SYS_LLRINTD32 = 0xBDB + SYS_LLRINTD64 = 0xBDC + SYS_LLRINTF = 0xA87 + SYS_LLRINTL = 0xA8A + SYS_LLROUND = 0xA8D + SYS_LLROUNDD128 = 0xBE0 + SYS_LLROUNDD32 = 0xBDE + SYS_LLROUNDD64 = 0xBDF + SYS_LLROUNDF = 0xA90 + SYS_LLROUNDL = 0xA93 + SYS_LOCALTIM = 0x0B1 + SYS_LOCALTIME = 0x0B1 + SYS_LOCALTIME64 = 0xCDE + SYS_LOCALTIME64_R = 0xCDF + SYS_LOG10D128 = 0xBE6 + SYS_LOG10D32 = 0xBE4 + SYS_LOG10D64 = 0xBE5 + SYS_LOG1PD128 = 0xBE9 + SYS_LOG1PD32 = 0xBE7 + SYS_LOG1PD64 = 0xBE8 + SYS_LOG2D128 = 0xBEC + SYS_LOG2D32 = 0xBEA + SYS_LOG2D64 = 0xBEB + SYS_LOGBD128 = 0xBEF + SYS_LOGBD32 = 0xBED + SYS_LOGBD64 = 0xBEE + SYS_LOGBF = 0xA96 + SYS_LOGBL = 0xA99 + SYS_LOGD128 = 0xBE3 + SYS_LOGD32 = 0xBE1 + SYS_LOGD64 = 0xBE2 + SYS_LRINT = 0xA9C + SYS_LRINTD128 = 0xBF2 + SYS_LRINTD32 = 0xBF0 + SYS_LRINTD64 = 0xBF1 + SYS_LRINTF = 0xA9F + SYS_LRINTL = 0xAA2 + SYS_LROUNDD128 = 0xBF5 + SYS_LROUNDD32 = 0xBF3 + SYS_LROUNDD64 = 0xBF4 + SYS_LROUNDL = 0xAA5 + SYS_MBLEN = 0x0AF + SYS_MBRTOC16 = 0xD42 + SYS_MBRTOC32 = 0xD43 + SYS_MEMSET = 0x0A3 + SYS_MKTIME = 0x0AC + SYS_MKTIME64 = 0xCE0 + SYS_MODFD128 = 0xBF8 + SYS_MODFD32 = 0xBF6 + SYS_MODFD64 = 0xBF7 + SYS_NAN = 0xAA8 + SYS_NAND128 = 0xBFB + SYS_NAND32 = 0xBF9 + SYS_NAND64 = 0xBFA + SYS_NANF = 0xAAA + SYS_NANL = 0xAAC + SYS_NEARBYINT = 0xAAE + SYS_NEARBYINTD128 = 0xBFE + SYS_NEARBYINTD32 = 0xBFC + SYS_NEARBYINTD64 = 0xBFD + SYS_NEARBYINTF = 0xAB1 + SYS_NEARBYINTL = 0xAB4 + SYS_NEXTAFTERD128 = 0xC01 + SYS_NEXTAFTERD32 = 0xBFF + SYS_NEXTAFTERD64 = 0xC00 + SYS_NEXTAFTERF = 0xAB7 + SYS_NEXTAFTERL = 0xABA + SYS_NEXTTOWARD = 0xABD + SYS_NEXTTOWARDD128 = 0xC04 + SYS_NEXTTOWARDD32 = 0xC02 + SYS_NEXTTOWARDD64 = 0xC03 + SYS_NEXTTOWARDF = 0xAC0 + SYS_NEXTTOWARDL = 0xAC3 + SYS_NL_LANGINFO = 0x0FC + SYS_PERROR_UNLOCKED = 0xCBD + SYS_POSIX_FALLOCATE = 0xCE8 + SYS_POSIX_MEMALIGN = 0xCE9 + SYS_POSIX_OPENPT = 0xC66 + SYS_POWD128 = 0xC07 + SYS_POWD32 = 0xC05 + SYS_POWD64 = 0xC06 + SYS_PRINTF_UNLOCKED = 0xCBE + SYS_PSELECT = 0xC67 + SYS_PTHREAD_ATTR_GETSTACK = 0xB3E + SYS_PTHREAD_ATTR_SETSTACK = 0xB3F + SYS_PTHREAD_SECURITY_APPLID_NP = 0xCE4 + SYS_PUTS_UNLOCKED = 0xC7F + SYS_PUTWCHAR_UNLOCKED = 0xCC0 + SYS_PUTWC_UNLOCKED = 0xCBF + SYS_QUANTEXPD128 = 0xD46 + SYS_QUANTEXPD32 = 0xD44 + SYS_QUANTEXPD64 = 0xD45 + SYS_QUANTIZED128 = 0xC0A + SYS_QUANTIZED32 = 0xC08 + SYS_QUANTIZED64 = 0xC09 + SYS_REMAINDERD128 = 0xC0D + SYS_REMAINDERD32 = 0xC0B + SYS_REMAINDERD64 = 0xC0C + SYS_RESIZE_ALLOC = 0xCEB + SYS_REWIND_UNLOCKED = 0xCC1 + SYS_RINTD128 = 0xC13 + SYS_RINTD32 = 0xC11 + SYS_RINTD64 = 0xC12 + SYS_RINTF = 0xACB + SYS_RINTL = 0xACD + SYS_ROUND = 0xACF + SYS_ROUNDD128 = 0xC16 + SYS_ROUNDD32 = 0xC14 + SYS_ROUNDD64 = 0xC15 + SYS_ROUNDF = 0xAD2 + SYS_ROUNDL = 0xAD5 + SYS_SAMEQUANTUMD128 = 0xC19 + SYS_SAMEQUANTUMD32 = 0xC17 + SYS_SAMEQUANTUMD64 = 0xC18 + SYS_SCALBLN = 0xAD8 + SYS_SCALBLND128 = 0xC1C + SYS_SCALBLND32 = 0xC1A + SYS_SCALBLND64 = 0xC1B + SYS_SCALBLNF = 0xADB + SYS_SCALBLNL = 0xADE + SYS_SCALBND128 = 0xC1F + SYS_SCALBND32 = 0xC1D + SYS_SCALBND64 = 0xC1E + SYS_SCALBNF = 0xAE3 + SYS_SCALBNL = 0xAE6 + SYS_SCANF_UNLOCKED = 0xCC2 + SYS_SCHED_YIELD = 0xB32 + SYS_SETENV = 0x0C8 + SYS_SETIPV4SOURCEFILTER = 0xC76 + SYS_SETSOURCEFILTER = 0xC78 + SYS_SHM_OPEN = 0xC8C + SYS_SHM_UNLINK = 0xC8D + SYS_SIND128 = 0xC22 + SYS_SIND32 = 0xC20 + SYS_SIND64 = 0xC21 + SYS_SINHD128 = 0xC25 + SYS_SINHD32 = 0xC23 + SYS_SINHD64 = 0xC24 + SYS_SIZEOF_ALLOC = 0xCEA + SYS_SOCKATMARK = 0xC68 + SYS_SQRTD128 = 0xC28 + SYS_SQRTD32 = 0xC26 + SYS_SQRTD64 = 0xC27 + SYS_STRCHR = 0x0A0 + SYS_STRCSPN = 0x0A1 + SYS_STRERROR = 0x0A8 + SYS_STRERROR_R = 0xB33 + SYS_STRFTIME = 0x0B2 + SYS_STRLEN = 0x0A9 + SYS_STRPBRK = 0x0A2 + SYS_STRSPN = 0x0A4 + SYS_STRSTR = 0x0A5 + SYS_STRTOD128 = 0xC2B + SYS_STRTOD32 = 0xC29 + SYS_STRTOD64 = 0xC2A + SYS_STRTOK = 0x0A6 + SYS_TAND128 = 0xC2E + SYS_TAND32 = 0xC2C + SYS_TAND64 = 0xC2D + SYS_TANHD128 = 0xC31 + SYS_TANHD32 = 0xC2F + SYS_TANHD64 = 0xC30 + SYS_TGAMMAD128 = 0xC34 + SYS_TGAMMAD32 = 0xC32 + SYS_TGAMMAD64 = 0xC33 + SYS_TIME = 0x0AD + SYS_TIME64 = 0xCE1 + SYS_TMPFILE64 = 0xD4D + SYS_TMPFILE64_UNLOCKED = 0xD4E + SYS_TMPFILE_UNLOCKED = 0xCFD + SYS_TRUNCD128 = 0xC40 + SYS_TRUNCD32 = 0xC3E + SYS_TRUNCD64 = 0xC3F + SYS_UNGETC_UNLOCKED = 0xCC3 + SYS_UNGETWC_UNLOCKED = 0xCC4 + SYS_UNSETENV = 0xB34 + SYS_VFPRINTF_UNLOCKED = 0xCC5 + SYS_VFSCANF_UNLOCKED = 0xCC7 + SYS_VFWPRINTF_UNLOCKED = 0xCC9 + SYS_VFWSCANF_UNLOCKED = 0xCCB + SYS_VPRINTF_UNLOCKED = 0xCCD + SYS_VSCANF_UNLOCKED = 0xCCF + SYS_VWPRINTF_UNLOCKED = 0xCD1 + SYS_VWSCANF_UNLOCKED = 0xCD3 + SYS_WCSTOD128 = 0xC43 + SYS_WCSTOD32 = 0xC41 + SYS_WCSTOD64 = 0xC42 + SYS_WPRINTF_UNLOCKED = 0xCD5 + SYS_WSCANF_UNLOCKED = 0xCD6 + SYS__FLUSHLBF = 0xD68 + SYS__FLUSHLBF_UNLOCKED = 0xD6F + SYS___ACOSHF_H = 0xA54 + SYS___ACOSHL_H = 0xA55 + SYS___ASINHF_H = 0xA56 + SYS___ASINHL_H = 0xA57 + SYS___ATANPID128 = 0xC6D + SYS___ATANPID32 = 0xC6B + SYS___ATANPID64 = 0xC6C + SYS___CBRTF_H = 0xA58 + SYS___CBRTL_H = 0xA59 + SYS___CDUMP = 0x0C4 + SYS___CLASS = 0xAFA + SYS___CLASS2 = 0xB99 + SYS___CLASS2D128 = 0xC99 + SYS___CLASS2D32 = 0xC97 + SYS___CLASS2D64 = 0xC98 + SYS___CLASS2F = 0xC91 + SYS___CLASS2F_B = 0xC93 + SYS___CLASS2F_H = 0xC94 + SYS___CLASS2L = 0xC92 + SYS___CLASS2L_B = 0xC95 + SYS___CLASS2L_H = 0xC96 + SYS___CLASS2_B = 0xB9A + SYS___CLASS2_H = 0xB9B + SYS___CLASS_B = 0xAFB + SYS___CLASS_H = 0xAFC + SYS___CLOGL_B = 0xA01 + SYS___CLOGL_H = 0xA02 + SYS___CLRENV = 0x0C9 + SYS___CLRMF = 0x0BD + SYS___CODEPAGE_INFO = 0xC64 + SYS___CONJF_B = 0xA07 + SYS___CONJF_H = 0xA08 + SYS___CONJL_B = 0xA0A + SYS___CONJL_H = 0xA0B + SYS___CONJ_B = 0xA04 + SYS___CONJ_H = 0xA05 + SYS___COPYSIGN_B = 0xA5A + SYS___COPYSIGN_H = 0xAF5 + SYS___COSPID128 = 0xC70 + SYS___COSPID32 = 0xC6E + SYS___COSPID64 = 0xC6F + SYS___CPOWF_B = 0xA10 + SYS___CPOWF_H = 0xA11 + SYS___CPOWL_B = 0xA13 + SYS___CPOWL_H = 0xA14 + SYS___CPOW_B = 0xA0D + SYS___CPOW_H = 0xA0E + SYS___CPROJF_B = 0xA19 + SYS___CPROJF_H = 0xA1A + SYS___CPROJL_B = 0xA1C + SYS___CPROJL_H = 0xA1D + SYS___CPROJ_B = 0xA16 + SYS___CPROJ_H = 0xA17 + SYS___CREALF_B = 0xA22 + SYS___CREALF_H = 0xA23 + SYS___CREALL_B = 0xA25 + SYS___CREALL_H = 0xA26 + SYS___CREAL_B = 0xA1F + SYS___CREAL_H = 0xA20 + SYS___CSINF_B = 0xA2B + SYS___CSINF_H = 0xA2C + SYS___CSINHF_B = 0xA34 + SYS___CSINHF_H = 0xA35 + SYS___CSINHL_B = 0xA37 + SYS___CSINHL_H = 0xA38 + SYS___CSINH_B = 0xA31 + SYS___CSINH_H = 0xA32 + SYS___CSINL_B = 0xA2E + SYS___CSINL_H = 0xA2F + SYS___CSIN_B = 0xA28 + SYS___CSIN_H = 0xA29 + SYS___CSNAP = 0x0C5 + SYS___CSQRTF_B = 0xA3D + SYS___CSQRTF_H = 0xA3E + SYS___CSQRTL_B = 0xA40 + SYS___CSQRTL_H = 0xA41 + SYS___CSQRT_B = 0xA3A + SYS___CSQRT_H = 0xA3B + SYS___CTANF_B = 0xA46 + SYS___CTANF_H = 0xA47 + SYS___CTANHF_B = 0xA4F + SYS___CTANHF_H = 0xA50 + SYS___CTANHL_B = 0xA52 + SYS___CTANHL_H = 0xA53 + SYS___CTANH_B = 0xA4C + SYS___CTANH_H = 0xA4D + SYS___CTANL_B = 0xA49 + SYS___CTANL_H = 0xA4A + SYS___CTAN_B = 0xA43 + SYS___CTAN_H = 0xA44 + SYS___CTEST = 0x0C7 + SYS___CTRACE = 0x0C6 + SYS___D1TOP = 0xC9B + SYS___D2TOP = 0xC9C + SYS___D4TOP = 0xC9D + SYS___DYNALL = 0x0C3 + SYS___DYNFRE = 0x0C2 + SYS___EXP2F_H = 0xA5E + SYS___EXP2L_H = 0xA5F + SYS___EXP2_H = 0xA5D + SYS___EXPM1F_H = 0xA5B + SYS___EXPM1L_H = 0xA5C + SYS___FBUFSIZE = 0xD60 + SYS___FLBF = 0xD62 + SYS___FLDATA = 0x0C1 + SYS___FMAF_B = 0xA67 + SYS___FMAF_H = 0xA68 + SYS___FMAL_B = 0xA6A + SYS___FMAL_H = 0xA6B + SYS___FMAXF_B = 0xA70 + SYS___FMAXF_H = 0xA71 + SYS___FMAXL_B = 0xA73 + SYS___FMAXL_H = 0xA74 + SYS___FMAX_B = 0xA6D + SYS___FMAX_H = 0xA6E + SYS___FMA_B = 0xA64 + SYS___FMA_H = 0xA65 + SYS___FMINF_B = 0xA79 + SYS___FMINF_H = 0xA7A + SYS___FMINL_B = 0xA7C + SYS___FMINL_H = 0xA7D + SYS___FMIN_B = 0xA76 + SYS___FMIN_H = 0xA77 + SYS___FPENDING = 0xD61 + SYS___FPENDING_UNLOCKED = 0xD6C + SYS___FPURGE = 0xD69 + SYS___FPURGE_UNLOCKED = 0xD70 + SYS___FP_CAST_D = 0xBCB + SYS___FREADABLE = 0xD63 + SYS___FREADAHEAD = 0xD6A + SYS___FREADAHEAD_UNLOCKED = 0xD71 + SYS___FREADING = 0xD65 + SYS___FREADING_UNLOCKED = 0xD6D + SYS___FSEEK2 = 0xB3C + SYS___FSETERR = 0xD6B + SYS___FSETLOCKING = 0xD67 + SYS___FTCHEP = 0x0BF + SYS___FTELL2 = 0xB3B + SYS___FUPDT = 0x0B5 + SYS___FWRITABLE = 0xD64 + SYS___FWRITING = 0xD66 + SYS___FWRITING_UNLOCKED = 0xD6E + SYS___GETCB = 0x0B4 + SYS___GETGRGID1 = 0xD5B + SYS___GETGRNAM1 = 0xD5C + SYS___GETTHENT = 0xCE5 + SYS___GETTOD = 0xD3E + SYS___HYPOTF_H = 0xAF6 + SYS___HYPOTL_H = 0xAF7 + SYS___ILOGBF_B = 0xA7F + SYS___ILOGBF_H = 0xA80 + SYS___ILOGBL_B = 0xA82 + SYS___ILOGBL_H = 0xA83 + SYS___ISBLANK_A = 0xB2E + SYS___ISBLNK = 0x0FE + SYS___ISWBLANK_A = 0xB2F + SYS___LE_CEEGTJS = 0xD72 + SYS___LE_TRACEBACK = 0xB7A + SYS___LGAMMAL_H = 0xA62 + SYS___LGAMMA_B_C99 = 0xB39 + SYS___LGAMMA_H_C99 = 0xB38 + SYS___LGAMMA_R_C99 = 0xB3A + SYS___LLRINTF_B = 0xA88 + SYS___LLRINTF_H = 0xA89 + SYS___LLRINTL_B = 0xA8B + SYS___LLRINTL_H = 0xA8C + SYS___LLRINT_B = 0xA85 + SYS___LLRINT_H = 0xA86 + SYS___LLROUNDF_B = 0xA91 + SYS___LLROUNDF_H = 0xA92 + SYS___LLROUNDL_B = 0xA94 + SYS___LLROUNDL_H = 0xA95 + SYS___LLROUND_B = 0xA8E + SYS___LLROUND_H = 0xA8F + SYS___LOCALE_CTL = 0xD47 + SYS___LOG1PF_H = 0xA60 + SYS___LOG1PL_H = 0xA61 + SYS___LOGBF_B = 0xA97 + SYS___LOGBF_H = 0xA98 + SYS___LOGBL_B = 0xA9A + SYS___LOGBL_H = 0xA9B + SYS___LOGIN_APPLID = 0xCE2 + SYS___LRINTF_B = 0xAA0 + SYS___LRINTF_H = 0xAA1 + SYS___LRINTL_B = 0xAA3 + SYS___LRINTL_H = 0xAA4 + SYS___LRINT_B = 0xA9D + SYS___LRINT_H = 0xA9E + SYS___LROUNDF_FIXUP = 0xB31 + SYS___LROUNDL_B = 0xAA6 + SYS___LROUNDL_H = 0xAA7 + SYS___LROUND_FIXUP = 0xB30 + SYS___MOSERVICES = 0xD3D + SYS___MUST_STAY_CLEAN = 0xB7C + SYS___NANF_B = 0xAAB + SYS___NANL_B = 0xAAD + SYS___NAN_B = 0xAA9 + SYS___NEARBYINTF_B = 0xAB2 + SYS___NEARBYINTF_H = 0xAB3 + SYS___NEARBYINTL_B = 0xAB5 + SYS___NEARBYINTL_H = 0xAB6 + SYS___NEARBYINT_B = 0xAAF + SYS___NEARBYINT_H = 0xAB0 + SYS___NEXTAFTERF_B = 0xAB8 + SYS___NEXTAFTERF_H = 0xAB9 + SYS___NEXTAFTERL_B = 0xABB + SYS___NEXTAFTERL_H = 0xABC + SYS___NEXTTOWARDF_B = 0xAC1 + SYS___NEXTTOWARDF_H = 0xAC2 + SYS___NEXTTOWARDL_B = 0xAC4 + SYS___NEXTTOWARDL_H = 0xAC5 + SYS___NEXTTOWARD_B = 0xABE + SYS___NEXTTOWARD_H = 0xABF + SYS___O_ENV = 0xB7D + SYS___PASSWD_APPLID = 0xCE3 + SYS___PTOD1 = 0xC9E + SYS___PTOD2 = 0xC9F + SYS___PTOD4 = 0xCA0 + SYS___REGCOMP_STD = 0x0EA + SYS___REMAINDERF_H = 0xAC6 + SYS___REMAINDERL_H = 0xAC7 + SYS___REMQUOD128 = 0xC10 + SYS___REMQUOD32 = 0xC0E + SYS___REMQUOD64 = 0xC0F + SYS___REMQUOF_H = 0xAC9 + SYS___REMQUOL_H = 0xACA + SYS___REMQUO_H = 0xAC8 + SYS___RINTF_B = 0xACC + SYS___RINTL_B = 0xACE + SYS___ROUNDF_B = 0xAD3 + SYS___ROUNDF_H = 0xAD4 + SYS___ROUNDL_B = 0xAD6 + SYS___ROUNDL_H = 0xAD7 + SYS___ROUND_B = 0xAD0 + SYS___ROUND_H = 0xAD1 + SYS___SCALBLNF_B = 0xADC + SYS___SCALBLNF_H = 0xADD + SYS___SCALBLNL_B = 0xADF + SYS___SCALBLNL_H = 0xAE0 + SYS___SCALBLN_B = 0xAD9 + SYS___SCALBLN_H = 0xADA + SYS___SCALBNF_B = 0xAE4 + SYS___SCALBNF_H = 0xAE5 + SYS___SCALBNL_B = 0xAE7 + SYS___SCALBNL_H = 0xAE8 + SYS___SCALBN_B = 0xAE1 + SYS___SCALBN_H = 0xAE2 + SYS___SETENV = 0x0C8 + SYS___SINPID128 = 0xC73 + SYS___SINPID32 = 0xC71 + SYS___SINPID64 = 0xC72 + SYS___SMF_RECORD2 = 0xD48 + SYS___STATIC_REINIT = 0xB3D + SYS___TGAMMAF_H_C99 = 0xB79 + SYS___TGAMMAL_H = 0xAE9 + SYS___TGAMMA_H_C99 = 0xB78 + SYS___TOCSNAME2 = 0xC9A + SYS_CEIL = 0x01F + SYS_CHAUDIT = 0x1E0 + SYS_EXP = 0x01A + SYS_FCHAUDIT = 0x1E1 + SYS_FREXP = 0x01D + SYS_GETGROUPSBYNAME = 0x1E2 + SYS_GETPWUID = 0x1A0 + SYS_GETUID = 0x1A1 + SYS_ISATTY = 0x1A3 + SYS_KILL = 0x1A4 + SYS_LDEXP = 0x01E + SYS_LINK = 0x1A5 + SYS_LOG10 = 0x01C + SYS_LSEEK = 0x1A6 + SYS_LSTAT = 0x1A7 + SYS_MKDIR = 0x1A8 + SYS_MKFIFO = 0x1A9 + SYS_MKNOD = 0x1AA + SYS_MODF = 0x01B + SYS_MOUNT = 0x1AB + SYS_OPEN = 0x1AC + SYS_OPENDIR = 0x1AD + SYS_PATHCONF = 0x1AE + SYS_PAUSE = 0x1AF + SYS_PIPE = 0x1B0 + SYS_PTHREAD_ATTR_DESTROY = 0x1E7 + SYS_PTHREAD_ATTR_GETDETACHSTATE = 0x1EB + SYS_PTHREAD_ATTR_GETSTACKSIZE = 0x1E9 + SYS_PTHREAD_ATTR_GETWEIGHT_NP = 0x1ED + SYS_PTHREAD_ATTR_INIT = 0x1E6 + SYS_PTHREAD_ATTR_SETDETACHSTATE = 0x1EA + SYS_PTHREAD_ATTR_SETSTACKSIZE = 0x1E8 + SYS_PTHREAD_ATTR_SETWEIGHT_NP = 0x1EC + SYS_PTHREAD_CANCEL = 0x1EE + SYS_PTHREAD_CLEANUP_POP = 0x1F0 + SYS_PTHREAD_CLEANUP_PUSH = 0x1EF + SYS_PTHREAD_CONDATTR_DESTROY = 0x1F2 + SYS_PTHREAD_CONDATTR_INIT = 0x1F1 + SYS_PTHREAD_COND_BROADCAST = 0x1F6 + SYS_PTHREAD_COND_DESTROY = 0x1F4 + SYS_PTHREAD_COND_INIT = 0x1F3 + SYS_PTHREAD_COND_SIGNAL = 0x1F5 + SYS_PTHREAD_COND_TIMEDWAIT = 0x1F8 + SYS_PTHREAD_COND_WAIT = 0x1F7 + SYS_PTHREAD_CREATE = 0x1F9 + SYS_PTHREAD_DETACH = 0x1FA + SYS_PTHREAD_EQUAL = 0x1FB + SYS_PTHREAD_EXIT = 0x1E4 + SYS_PTHREAD_GETSPECIFIC = 0x1FC + SYS_PTHREAD_JOIN = 0x1FD + SYS_PTHREAD_KEY_CREATE = 0x1FE + SYS_PTHREAD_KILL = 0x1E5 + SYS_PTHREAD_MUTEXATTR_INIT = 0x1FF + SYS_READ = 0x1B2 + SYS_READDIR = 0x1B3 + SYS_READLINK = 0x1B4 + SYS_REWINDDIR = 0x1B5 + SYS_RMDIR = 0x1B6 + SYS_SETEGID = 0x1B7 + SYS_SETEUID = 0x1B8 + SYS_SETGID = 0x1B9 + SYS_SETPGID = 0x1BA + SYS_SETSID = 0x1BB + SYS_SETUID = 0x1BC + SYS_SIGACTION = 0x1BD + SYS_SIGADDSET = 0x1BE + SYS_SIGDELSET = 0x1BF + SYS_SIGEMPTYSET = 0x1C0 + SYS_SIGFILLSET = 0x1C1 + SYS_SIGISMEMBER = 0x1C2 + SYS_SIGLONGJMP = 0x1C3 + SYS_SIGPENDING = 0x1C4 + SYS_SIGPROCMASK = 0x1C5 + SYS_SIGSETJMP = 0x1C6 + SYS_SIGSUSPEND = 0x1C7 + SYS_SIGWAIT = 0x1E3 + SYS_SLEEP = 0x1C8 + SYS_STAT = 0x1C9 + SYS_SYMLINK = 0x1CB + SYS_SYSCONF = 0x1CC + SYS_TCDRAIN = 0x1CD + SYS_TCFLOW = 0x1CE + SYS_TCFLUSH = 0x1CF + SYS_TCGETATTR = 0x1D0 + SYS_TCGETPGRP = 0x1D1 + SYS_TCSENDBREAK = 0x1D2 + SYS_TCSETATTR = 0x1D3 + SYS_TCSETPGRP = 0x1D4 + SYS_TIMES = 0x1D5 + SYS_TTYNAME = 0x1D6 + SYS_TZSET = 0x1D7 + SYS_UMASK = 0x1D8 + SYS_UMOUNT = 0x1D9 + SYS_UNAME = 0x1DA + SYS_UNLINK = 0x1DB + SYS_UTIME = 0x1DC + SYS_WAIT = 0x1DD + SYS_WAITPID = 0x1DE + SYS_WRITE = 0x1DF + SYS_W_GETPSENT = 0x1B1 + SYS_W_IOCTL = 0x1A2 + SYS_W_STATFS = 0x1CA + SYS_A64L = 0x2EF + SYS_BCMP = 0x2B9 + SYS_BCOPY = 0x2BA + SYS_BZERO = 0x2BB + SYS_CATCLOSE = 0x2B6 + SYS_CATGETS = 0x2B7 + SYS_CATOPEN = 0x2B8 + SYS_CRYPT = 0x2AC + SYS_DBM_CLEARERR = 0x2F7 + SYS_DBM_CLOSE = 0x2F8 + SYS_DBM_DELETE = 0x2F9 + SYS_DBM_ERROR = 0x2FA + SYS_DBM_FETCH = 0x2FB + SYS_DBM_FIRSTKEY = 0x2FC + SYS_DBM_NEXTKEY = 0x2FD + SYS_DBM_OPEN = 0x2FE + SYS_DBM_STORE = 0x2FF + SYS_DRAND48 = 0x2B2 + SYS_ENCRYPT = 0x2AD + SYS_ENDUTXENT = 0x2E1 + SYS_ERAND48 = 0x2B3 + SYS_ERF = 0x02C + SYS_ERFC = 0x02D + SYS_FCHDIR = 0x2D9 + SYS_FFS = 0x2BC + SYS_FMTMSG = 0x2E5 + SYS_FSTATVFS = 0x2B4 + SYS_FTIME = 0x2F5 + SYS_GAMMA = 0x02E + SYS_GETDATE = 0x2A6 + SYS_GETPAGESIZE = 0x2D8 + SYS_GETTIMEOFDAY = 0x2F6 + SYS_GETUTXENT = 0x2E0 + SYS_GETUTXID = 0x2E2 + SYS_GETUTXLINE = 0x2E3 + SYS_HCREATE = 0x2C6 + SYS_HDESTROY = 0x2C7 + SYS_HSEARCH = 0x2C8 + SYS_HYPOT = 0x02B + SYS_INDEX = 0x2BD + SYS_INITSTATE = 0x2C2 + SYS_INSQUE = 0x2CF + SYS_ISASCII = 0x2ED + SYS_JRAND48 = 0x2E6 + SYS_L64A = 0x2F0 + SYS_LCONG48 = 0x2EA + SYS_LFIND = 0x2C9 + SYS_LRAND48 = 0x2E7 + SYS_LSEARCH = 0x2CA + SYS_MEMCCPY = 0x2D4 + SYS_MRAND48 = 0x2E8 + SYS_NRAND48 = 0x2E9 + SYS_PCLOSE = 0x2D2 + SYS_POPEN = 0x2D1 + SYS_PUTUTXLINE = 0x2E4 + SYS_RANDOM = 0x2C4 + SYS_REMQUE = 0x2D0 + SYS_RINDEX = 0x2BE + SYS_SEED48 = 0x2EC + SYS_SETKEY = 0x2AE + SYS_SETSTATE = 0x2C3 + SYS_SETUTXENT = 0x2DF + SYS_SRAND48 = 0x2EB + SYS_SRANDOM = 0x2C5 + SYS_STATVFS = 0x2B5 + SYS_STRCASECMP = 0x2BF + SYS_STRDUP = 0x2C0 + SYS_STRNCASECMP = 0x2C1 + SYS_SWAB = 0x2D3 + SYS_TDELETE = 0x2CB + SYS_TFIND = 0x2CC + SYS_TOASCII = 0x2EE + SYS_TSEARCH = 0x2CD + SYS_TWALK = 0x2CE + SYS_UALARM = 0x2F1 + SYS_USLEEP = 0x2F2 + SYS_WAIT3 = 0x2A7 + SYS_WAITID = 0x2A8 + SYS_Y1 = 0x02A + SYS___ATOE = 0x2DB + SYS___ATOE_L = 0x2DC + SYS___CATTRM = 0x2A9 + SYS___CNVBLK = 0x2AF + SYS___CRYTRM = 0x2B0 + SYS___DLGHT = 0x2A1 + SYS___ECRTRM = 0x2B1 + SYS___ETOA = 0x2DD + SYS___ETOA_L = 0x2DE + SYS___GDTRM = 0x2AA + SYS___OCLCK = 0x2DA + SYS___OPARGF = 0x2A2 + SYS___OPERRF = 0x2A5 + SYS___OPINDF = 0x2A4 + SYS___OPOPTF = 0x2A3 + SYS___RNDTRM = 0x2AB + SYS___SRCTRM = 0x2F4 + SYS___TZONE = 0x2A0 + SYS___UTXTRM = 0x2F3 + SYS_ASIN = 0x03E + SYS_ISXDIGIT = 0x03B + SYS_SETLOCAL = 0x03A + SYS_SETLOCALE = 0x03A + SYS_SIN = 0x03F + SYS_TOLOWER = 0x03C + SYS_TOUPPER = 0x03D + SYS_ACCEPT_AND_RECV = 0x4F7 + SYS_ATOL = 0x04E + SYS_CHECKSCH = 0x4BC + SYS_CHECKSCHENV = 0x4BC + SYS_CLEARERR = 0x04C + SYS_CONNECTS = 0x4B5 + SYS_CONNECTSERVER = 0x4B5 + SYS_CONNECTW = 0x4B4 + SYS_CONNECTWORKMGR = 0x4B4 + SYS_CONTINUE = 0x4B3 + SYS_CONTINUEWORKUNIT = 0x4B3 + SYS_COPYSIGN = 0x4C2 + SYS_CREATEWO = 0x4B2 + SYS_CREATEWORKUNIT = 0x4B2 + SYS_DELETEWO = 0x4B9 + SYS_DELETEWORKUNIT = 0x4B9 + SYS_DISCONNE = 0x4B6 + SYS_DISCONNECTSERVER = 0x4B6 + SYS_FEOF = 0x04D + SYS_FERROR = 0x04A + SYS_FINITE = 0x4C8 + SYS_GAMMA_R = 0x4E2 + SYS_JOINWORK = 0x4B7 + SYS_JOINWORKUNIT = 0x4B7 + SYS_LEAVEWOR = 0x4B8 + SYS_LEAVEWORKUNIT = 0x4B8 + SYS_LGAMMA_R = 0x4EB + SYS_MATHERR = 0x4D0 + SYS_PERROR = 0x04F + SYS_QUERYMET = 0x4BA + SYS_QUERYMETRICS = 0x4BA + SYS_QUERYSCH = 0x4BB + SYS_QUERYSCHENV = 0x4BB + SYS_REWIND = 0x04B + SYS_SCALBN = 0x4D4 + SYS_SIGNIFIC = 0x4D5 + SYS_SIGNIFICAND = 0x4D5 + SYS___ACOSH_B = 0x4DA + SYS___ACOS_B = 0x4D9 + SYS___ASINH_B = 0x4BE + SYS___ASIN_B = 0x4DB + SYS___ATAN2_B = 0x4DC + SYS___ATANH_B = 0x4DD + SYS___ATAN_B = 0x4BF + SYS___CBRT_B = 0x4C0 + SYS___CEIL_B = 0x4C1 + SYS___COSH_B = 0x4DE + SYS___COS_B = 0x4C3 + SYS___DGHT = 0x4A8 + SYS___ENVN = 0x4B0 + SYS___ERFC_B = 0x4C5 + SYS___ERF_B = 0x4C4 + SYS___EXPM1_B = 0x4C6 + SYS___EXP_B = 0x4DF + SYS___FABS_B = 0x4C7 + SYS___FLOOR_B = 0x4C9 + SYS___FMOD_B = 0x4E0 + SYS___FP_SETMODE = 0x4F8 + SYS___FREXP_B = 0x4CA + SYS___GAMMA_B = 0x4E1 + SYS___GDRR = 0x4A1 + SYS___HRRNO = 0x4A2 + SYS___HYPOT_B = 0x4E3 + SYS___ILOGB_B = 0x4CB + SYS___ISNAN_B = 0x4CC + SYS___J0_B = 0x4E4 + SYS___J1_B = 0x4E6 + SYS___JN_B = 0x4E8 + SYS___LDEXP_B = 0x4CD + SYS___LGAMMA_B = 0x4EA + SYS___LOG10_B = 0x4ED + SYS___LOG1P_B = 0x4CE + SYS___LOGB_B = 0x4CF + SYS___LOGIN = 0x4F5 + SYS___LOG_B = 0x4EC + SYS___MLOCKALL = 0x4B1 + SYS___MODF_B = 0x4D1 + SYS___NEXTAFTER_B = 0x4D2 + SYS___OPENDIR2 = 0x4F3 + SYS___OPEN_STAT = 0x4F6 + SYS___OPND = 0x4A5 + SYS___OPPT = 0x4A6 + SYS___OPRG = 0x4A3 + SYS___OPRR = 0x4A4 + SYS___PID_AFFINITY = 0x4BD + SYS___POW_B = 0x4EE + SYS___READDIR2 = 0x4F4 + SYS___REMAINDER_B = 0x4EF + SYS___RINT_B = 0x4D3 + SYS___SCALB_B = 0x4F0 + SYS___SIGACTIONSET = 0x4FB + SYS___SIGGM = 0x4A7 + SYS___SINH_B = 0x4F1 + SYS___SIN_B = 0x4D6 + SYS___SQRT_B = 0x4F2 + SYS___TANH_B = 0x4D8 + SYS___TAN_B = 0x4D7 + SYS___TRRNO = 0x4AF + SYS___TZNE = 0x4A9 + SYS___TZZN = 0x4AA + SYS___UCREATE = 0x4FC + SYS___UFREE = 0x4FE + SYS___UHEAPREPORT = 0x4FF + SYS___UMALLOC = 0x4FD + SYS___Y0_B = 0x4E5 + SYS___Y1_B = 0x4E7 + SYS___YN_B = 0x4E9 + SYS_ABORT = 0x05C + SYS_ASCTIME_R = 0x5E0 + SYS_ATEXIT = 0x05D + SYS_CONNECTE = 0x5AE + SYS_CONNECTEXPORTIMPORT = 0x5AE + SYS_CTIME_R = 0x5E1 + SYS_DN_COMP = 0x5DF + SYS_DN_EXPAND = 0x5DD + SYS_DN_SKIPNAME = 0x5DE + SYS_EXIT = 0x05A + SYS_EXPORTWO = 0x5A1 + SYS_EXPORTWORKUNIT = 0x5A1 + SYS_EXTRACTW = 0x5A5 + SYS_EXTRACTWORKUNIT = 0x5A5 + SYS_FSEEKO = 0x5C9 + SYS_FTELLO = 0x5C8 + SYS_GETGRGID_R = 0x5E7 + SYS_GETGRNAM_R = 0x5E8 + SYS_GETLOGIN_R = 0x5E9 + SYS_GETPWNAM_R = 0x5EA + SYS_GETPWUID_R = 0x5EB + SYS_GMTIME_R = 0x5E2 + SYS_IMPORTWO = 0x5A3 + SYS_IMPORTWORKUNIT = 0x5A3 + SYS_INET_NTOP = 0x5D3 + SYS_INET_PTON = 0x5D4 + SYS_LLABS = 0x5CE + SYS_LLDIV = 0x5CB + SYS_LOCALTIME_R = 0x5E3 + SYS_PTHREAD_ATFORK = 0x5ED + SYS_PTHREAD_ATTR_GETDETACHSTATE_U98 = 0x5FB + SYS_PTHREAD_ATTR_GETGUARDSIZE = 0x5EE + SYS_PTHREAD_ATTR_GETSCHEDPARAM = 0x5F9 + SYS_PTHREAD_ATTR_GETSTACKADDR = 0x5EF + SYS_PTHREAD_ATTR_SETDETACHSTATE_U98 = 0x5FC + SYS_PTHREAD_ATTR_SETGUARDSIZE = 0x5F0 + SYS_PTHREAD_ATTR_SETSCHEDPARAM = 0x5FA + SYS_PTHREAD_ATTR_SETSTACKADDR = 0x5F1 + SYS_PTHREAD_CONDATTR_GETPSHARED = 0x5F2 + SYS_PTHREAD_CONDATTR_SETPSHARED = 0x5F3 + SYS_PTHREAD_DETACH_U98 = 0x5FD + SYS_PTHREAD_GETCONCURRENCY = 0x5F4 + SYS_PTHREAD_GETSPECIFIC_U98 = 0x5FE + SYS_PTHREAD_KEY_DELETE = 0x5F5 + SYS_PTHREAD_SETCANCELSTATE = 0x5FF + SYS_PTHREAD_SETCONCURRENCY = 0x5F6 + SYS_PTHREAD_SIGMASK = 0x5F7 + SYS_QUERYENC = 0x5AD + SYS_QUERYWORKUNITCLASSIFICATION = 0x5AD + SYS_RAISE = 0x05E + SYS_RAND_R = 0x5E4 + SYS_READDIR_R = 0x5E6 + SYS_REALLOC = 0x05B + SYS_RES_INIT = 0x5D8 + SYS_RES_MKQUERY = 0x5D7 + SYS_RES_QUERY = 0x5D9 + SYS_RES_QUERYDOMAIN = 0x5DC + SYS_RES_SEARCH = 0x5DA + SYS_RES_SEND = 0x5DB + SYS_SETJMP = 0x05F + SYS_SIGQUEUE = 0x5A9 + SYS_STRTOK_R = 0x5E5 + SYS_STRTOLL = 0x5B0 + SYS_STRTOULL = 0x5B1 + SYS_TTYNAME_R = 0x5EC + SYS_UNDOEXPO = 0x5A2 + SYS_UNDOEXPORTWORKUNIT = 0x5A2 + SYS_UNDOIMPO = 0x5A4 + SYS_UNDOIMPORTWORKUNIT = 0x5A4 + SYS_WCSTOLL = 0x5CC + SYS_WCSTOULL = 0x5CD + SYS___ABORT = 0x05C + SYS___CONSOLE2 = 0x5D2 + SYS___CPL = 0x5A6 + SYS___DISCARDDATA = 0x5F8 + SYS___DSA_PREV = 0x5B2 + SYS___EP_FIND = 0x5B3 + SYS___FP_SWAPMODE = 0x5AF + SYS___GETUSERID = 0x5AB + SYS___GET_CPUID = 0x5B9 + SYS___GET_SYSTEM_SETTINGS = 0x5BA + SYS___IPDOMAINNAME = 0x5AC + SYS___MAP_INIT = 0x5A7 + SYS___MAP_SERVICE = 0x5A8 + SYS___MOUNT = 0x5AA + SYS___MSGRCV_TIMED = 0x5B7 + SYS___RES = 0x5D6 + SYS___SEMOP_TIMED = 0x5B8 + SYS___SERVER_THREADS_QUERY = 0x5B4 + SYS_FPRINTF = 0x06D + SYS_FSCANF = 0x06A + SYS_PRINTF = 0x06F + SYS_SETBUF = 0x06B + SYS_SETVBUF = 0x06C + SYS_SSCANF = 0x06E + SYS___CATGETS_A = 0x6C0 + SYS___CHAUDIT_A = 0x6F4 + SYS___CHMOD_A = 0x6E8 + SYS___COLLATE_INIT_A = 0x6AC + SYS___CREAT_A = 0x6F6 + SYS___CTYPE_INIT_A = 0x6AF + SYS___DLLLOAD_A = 0x6DF + SYS___DLLQUERYFN_A = 0x6E0 + SYS___DLLQUERYVAR_A = 0x6E1 + SYS___E2A_L = 0x6E3 + SYS___EXECLE_A = 0x6A0 + SYS___EXECLP_A = 0x6A4 + SYS___EXECVE_A = 0x6C1 + SYS___EXECVP_A = 0x6C2 + SYS___EXECV_A = 0x6B1 + SYS___FPRINTF_A = 0x6FA + SYS___GETADDRINFO_A = 0x6BF + SYS___GETNAMEINFO_A = 0x6C4 + SYS___GET_WCTYPE_STD_A = 0x6AE + SYS___ICONV_OPEN_A = 0x6DE + SYS___IF_INDEXTONAME_A = 0x6DC + SYS___IF_NAMETOINDEX_A = 0x6DB + SYS___ISWCTYPE_A = 0x6B0 + SYS___IS_WCTYPE_STD_A = 0x6B2 + SYS___LOCALECONV_A = 0x6B8 + SYS___LOCALECONV_STD_A = 0x6B9 + SYS___LOCALE_INIT_A = 0x6B7 + SYS___LSTAT_A = 0x6EE + SYS___LSTAT_O_A = 0x6EF + SYS___MKDIR_A = 0x6E9 + SYS___MKFIFO_A = 0x6EC + SYS___MKNOD_A = 0x6F0 + SYS___MONETARY_INIT_A = 0x6BC + SYS___MOUNT_A = 0x6F1 + SYS___NL_CSINFO_A = 0x6D6 + SYS___NL_LANGINFO_A = 0x6BA + SYS___NL_LNAGINFO_STD_A = 0x6BB + SYS___NL_MONINFO_A = 0x6D7 + SYS___NL_NUMINFO_A = 0x6D8 + SYS___NL_RESPINFO_A = 0x6D9 + SYS___NL_TIMINFO_A = 0x6DA + SYS___NUMERIC_INIT_A = 0x6C6 + SYS___OPEN_A = 0x6F7 + SYS___PRINTF_A = 0x6DD + SYS___RESP_INIT_A = 0x6C7 + SYS___RPMATCH_A = 0x6C8 + SYS___RPMATCH_C_A = 0x6C9 + SYS___RPMATCH_STD_A = 0x6CA + SYS___SETLOCALE_A = 0x6F9 + SYS___SPAWNP_A = 0x6C5 + SYS___SPAWN_A = 0x6C3 + SYS___SPRINTF_A = 0x6FB + SYS___STAT_A = 0x6EA + SYS___STAT_O_A = 0x6EB + SYS___STRCOLL_STD_A = 0x6A1 + SYS___STRFMON_A = 0x6BD + SYS___STRFMON_STD_A = 0x6BE + SYS___STRFTIME_A = 0x6CC + SYS___STRFTIME_STD_A = 0x6CD + SYS___STRPTIME_A = 0x6CE + SYS___STRPTIME_STD_A = 0x6CF + SYS___STRXFRM_A = 0x6A2 + SYS___STRXFRM_C_A = 0x6A3 + SYS___STRXFRM_STD_A = 0x6A5 + SYS___SYNTAX_INIT_A = 0x6D4 + SYS___TIME_INIT_A = 0x6CB + SYS___TOD_INIT_A = 0x6D5 + SYS___TOWLOWER_A = 0x6B3 + SYS___TOWLOWER_STD_A = 0x6B4 + SYS___TOWUPPER_A = 0x6B5 + SYS___TOWUPPER_STD_A = 0x6B6 + SYS___UMOUNT_A = 0x6F2 + SYS___VFPRINTF_A = 0x6FC + SYS___VPRINTF_A = 0x6FD + SYS___VSPRINTF_A = 0x6FE + SYS___VSWPRINTF_A = 0x6FF + SYS___WCSCOLL_A = 0x6A6 + SYS___WCSCOLL_C_A = 0x6A7 + SYS___WCSCOLL_STD_A = 0x6A8 + SYS___WCSFTIME_A = 0x6D0 + SYS___WCSFTIME_STD_A = 0x6D1 + SYS___WCSXFRM_A = 0x6A9 + SYS___WCSXFRM_C_A = 0x6AA + SYS___WCSXFRM_STD_A = 0x6AB + SYS___WCTYPE_A = 0x6AD + SYS___W_GETMNTENT_A = 0x6F5 + SYS_____CCSIDTYPE_A = 0x6E6 + SYS_____CHATTR_A = 0x6E2 + SYS_____CSNAMETYPE_A = 0x6E7 + SYS_____OPEN_STAT_A = 0x6ED + SYS_____SPAWN2_A = 0x6D2 + SYS_____SPAWNP2_A = 0x6D3 + SYS_____TOCCSID_A = 0x6E4 + SYS_____TOCSNAME_A = 0x6E5 + SYS_ACL_FREE = 0x7FF + SYS_ACL_INIT = 0x7FE + SYS_FWIDE = 0x7DF + SYS_FWPRINTF = 0x7D1 + SYS_FWRITE = 0x07E + SYS_FWSCANF = 0x7D5 + SYS_GETCHAR = 0x07B + SYS_GETS = 0x07C + SYS_M_CREATE_LAYOUT = 0x7C9 + SYS_M_DESTROY_LAYOUT = 0x7CA + SYS_M_GETVALUES_LAYOUT = 0x7CB + SYS_M_SETVALUES_LAYOUT = 0x7CC + SYS_M_TRANSFORM_LAYOUT = 0x7CD + SYS_M_WTRANSFORM_LAYOUT = 0x7CE + SYS_PREAD = 0x7C7 + SYS_PUTC = 0x07D + SYS_PUTCHAR = 0x07A + SYS_PUTS = 0x07F + SYS_PWRITE = 0x7C8 + SYS_TOWCTRAN = 0x7D8 + SYS_TOWCTRANS = 0x7D8 + SYS_UNATEXIT = 0x7B5 + SYS_VFWPRINT = 0x7D3 + SYS_VFWPRINTF = 0x7D3 + SYS_VWPRINTF = 0x7D4 + SYS_WCTRANS = 0x7D7 + SYS_WPRINTF = 0x7D2 + SYS_WSCANF = 0x7D6 + SYS___ASCTIME_R_A = 0x7A1 + SYS___BASENAME_A = 0x7DC + SYS___BTOWC_A = 0x7E4 + SYS___CDUMP_A = 0x7B7 + SYS___CEE3DMP_A = 0x7B6 + SYS___CEILF_H = 0x7F4 + SYS___CEILL_H = 0x7F5 + SYS___CEIL_H = 0x7EA + SYS___CRYPT_A = 0x7BE + SYS___CSNAP_A = 0x7B8 + SYS___CTEST_A = 0x7B9 + SYS___CTIME_R_A = 0x7A2 + SYS___CTRACE_A = 0x7BA + SYS___DBM_OPEN_A = 0x7E6 + SYS___DIRNAME_A = 0x7DD + SYS___FABSF_H = 0x7FA + SYS___FABSL_H = 0x7FB + SYS___FABS_H = 0x7ED + SYS___FGETWC_A = 0x7AA + SYS___FGETWS_A = 0x7AD + SYS___FLOORF_H = 0x7F6 + SYS___FLOORL_H = 0x7F7 + SYS___FLOOR_H = 0x7EB + SYS___FPUTWC_A = 0x7A5 + SYS___FPUTWS_A = 0x7A8 + SYS___GETTIMEOFDAY_A = 0x7AE + SYS___GETWCHAR_A = 0x7AC + SYS___GETWC_A = 0x7AB + SYS___GLOB_A = 0x7DE + SYS___GMTIME_A = 0x7AF + SYS___GMTIME_R_A = 0x7B0 + SYS___INET_PTON_A = 0x7BC + SYS___J0_H = 0x7EE + SYS___J1_H = 0x7EF + SYS___JN_H = 0x7F0 + SYS___LOCALTIME_A = 0x7B1 + SYS___LOCALTIME_R_A = 0x7B2 + SYS___MALLOC24 = 0x7FC + SYS___MALLOC31 = 0x7FD + SYS___MKTIME_A = 0x7B3 + SYS___MODFF_H = 0x7F8 + SYS___MODFL_H = 0x7F9 + SYS___MODF_H = 0x7EC + SYS___OPENDIR_A = 0x7C2 + SYS___OSNAME = 0x7E0 + SYS___PUTWCHAR_A = 0x7A7 + SYS___PUTWC_A = 0x7A6 + SYS___READDIR_A = 0x7C3 + SYS___STRTOLL_A = 0x7A3 + SYS___STRTOULL_A = 0x7A4 + SYS___SYSLOG_A = 0x7BD + SYS___TZZNA = 0x7B4 + SYS___UNGETWC_A = 0x7A9 + SYS___UTIME_A = 0x7A0 + SYS___VFPRINTF2_A = 0x7E7 + SYS___VPRINTF2_A = 0x7E8 + SYS___VSPRINTF2_A = 0x7E9 + SYS___VSWPRNTF2_A = 0x7BB + SYS___WCSTOD_A = 0x7D9 + SYS___WCSTOL_A = 0x7DA + SYS___WCSTOUL_A = 0x7DB + SYS___WCTOB_A = 0x7E5 + SYS___Y0_H = 0x7F1 + SYS___Y1_H = 0x7F2 + SYS___YN_H = 0x7F3 + SYS_____OPENDIR2_A = 0x7BF + SYS_____OSNAME_A = 0x7E1 + SYS_____READDIR2_A = 0x7C0 + SYS_DLCLOSE = 0x8DF + SYS_DLERROR = 0x8E0 + SYS_DLOPEN = 0x8DD + SYS_DLSYM = 0x8DE + SYS_FLOCKFILE = 0x8D3 + SYS_FTRYLOCKFILE = 0x8D4 + SYS_FUNLOCKFILE = 0x8D5 + SYS_GETCHAR_UNLOCKED = 0x8D7 + SYS_GETC_UNLOCKED = 0x8D6 + SYS_PUTCHAR_UNLOCKED = 0x8D9 + SYS_PUTC_UNLOCKED = 0x8D8 + SYS_SNPRINTF = 0x8DA + SYS_VSNPRINTF = 0x8DB + SYS_WCSCSPN = 0x08B + SYS_WCSLEN = 0x08C + SYS_WCSNCAT = 0x08D + SYS_WCSNCMP = 0x08A + SYS_WCSNCPY = 0x08F + SYS_WCSSPN = 0x08E + SYS___ABSF_H = 0x8E7 + SYS___ABSL_H = 0x8E8 + SYS___ABS_H = 0x8E6 + SYS___ACOSF_H = 0x8EA + SYS___ACOSH_H = 0x8EC + SYS___ACOSL_H = 0x8EB + SYS___ACOS_H = 0x8E9 + SYS___ASINF_H = 0x8EE + SYS___ASINH_H = 0x8F0 + SYS___ASINL_H = 0x8EF + SYS___ASIN_H = 0x8ED + SYS___ATAN2F_H = 0x8F8 + SYS___ATAN2L_H = 0x8F9 + SYS___ATAN2_H = 0x8F7 + SYS___ATANF_H = 0x8F2 + SYS___ATANHF_H = 0x8F5 + SYS___ATANHL_H = 0x8F6 + SYS___ATANH_H = 0x8F4 + SYS___ATANL_H = 0x8F3 + SYS___ATAN_H = 0x8F1 + SYS___CBRT_H = 0x8FA + SYS___COPYSIGNF_H = 0x8FB + SYS___COPYSIGNL_H = 0x8FC + SYS___COSF_H = 0x8FE + SYS___COSL_H = 0x8FF + SYS___COS_H = 0x8FD + SYS___DLERROR_A = 0x8D2 + SYS___DLOPEN_A = 0x8D0 + SYS___DLSYM_A = 0x8D1 + SYS___GETUTXENT_A = 0x8C6 + SYS___GETUTXID_A = 0x8C7 + SYS___GETUTXLINE_A = 0x8C8 + SYS___ITOA = 0x8AA + SYS___ITOA_A = 0x8B0 + SYS___LE_CONDITION_TOKEN_BUILD = 0x8A5 + SYS___LE_MSG_ADD_INSERT = 0x8A6 + SYS___LE_MSG_GET = 0x8A7 + SYS___LE_MSG_GET_AND_WRITE = 0x8A8 + SYS___LE_MSG_WRITE = 0x8A9 + SYS___LLTOA = 0x8AE + SYS___LLTOA_A = 0x8B4 + SYS___LTOA = 0x8AC + SYS___LTOA_A = 0x8B2 + SYS___PUTCHAR_UNLOCKED_A = 0x8CC + SYS___PUTC_UNLOCKED_A = 0x8CB + SYS___PUTUTXLINE_A = 0x8C9 + SYS___RESET_EXCEPTION_HANDLER = 0x8E3 + SYS___REXEC_A = 0x8C4 + SYS___REXEC_AF_A = 0x8C5 + SYS___SET_EXCEPTION_HANDLER = 0x8E2 + SYS___SNPRINTF_A = 0x8CD + SYS___SUPERKILL = 0x8A4 + SYS___TCGETATTR_A = 0x8A1 + SYS___TCSETATTR_A = 0x8A2 + SYS___ULLTOA = 0x8AF + SYS___ULLTOA_A = 0x8B5 + SYS___ULTOA = 0x8AD + SYS___ULTOA_A = 0x8B3 + SYS___UTOA = 0x8AB + SYS___UTOA_A = 0x8B1 + SYS___VHM_EVENT = 0x8E4 + SYS___VSNPRINTF_A = 0x8CE + SYS_____GETENV_A = 0x8C3 + SYS_____UTMPXNAME_A = 0x8CA + SYS_CACOSH = 0x9A0 + SYS_CACOSHF = 0x9A3 + SYS_CACOSHL = 0x9A6 + SYS_CARG = 0x9A9 + SYS_CARGF = 0x9AC + SYS_CARGL = 0x9AF + SYS_CASIN = 0x9B2 + SYS_CASINF = 0x9B5 + SYS_CASINH = 0x9BB + SYS_CASINHF = 0x9BE + SYS_CASINHL = 0x9C1 + SYS_CASINL = 0x9B8 + SYS_CATAN = 0x9C4 + SYS_CATANF = 0x9C7 + SYS_CATANH = 0x9CD + SYS_CATANHF = 0x9D0 + SYS_CATANHL = 0x9D3 + SYS_CATANL = 0x9CA + SYS_CCOS = 0x9D6 + SYS_CCOSF = 0x9D9 + SYS_CCOSH = 0x9DF + SYS_CCOSHF = 0x9E2 + SYS_CCOSHL = 0x9E5 + SYS_CCOSL = 0x9DC + SYS_CEXP = 0x9E8 + SYS_CEXPF = 0x9EB + SYS_CEXPL = 0x9EE + SYS_CIMAG = 0x9F1 + SYS_CIMAGF = 0x9F4 + SYS_CIMAGL = 0x9F7 + SYS_CLOGF = 0x9FD + SYS_MEMCHR = 0x09B + SYS_MEMCMP = 0x09A + SYS_STRCOLL = 0x09C + SYS_STRNCMP = 0x09D + SYS_STRRCHR = 0x09F + SYS_STRXFRM = 0x09E + SYS___CACOSHF_B = 0x9A4 + SYS___CACOSHF_H = 0x9A5 + SYS___CACOSHL_B = 0x9A7 + SYS___CACOSHL_H = 0x9A8 + SYS___CACOSH_B = 0x9A1 + SYS___CACOSH_H = 0x9A2 + SYS___CARGF_B = 0x9AD + SYS___CARGF_H = 0x9AE + SYS___CARGL_B = 0x9B0 + SYS___CARGL_H = 0x9B1 + SYS___CARG_B = 0x9AA + SYS___CARG_H = 0x9AB + SYS___CASINF_B = 0x9B6 + SYS___CASINF_H = 0x9B7 + SYS___CASINHF_B = 0x9BF + SYS___CASINHF_H = 0x9C0 + SYS___CASINHL_B = 0x9C2 + SYS___CASINHL_H = 0x9C3 + SYS___CASINH_B = 0x9BC + SYS___CASINH_H = 0x9BD + SYS___CASINL_B = 0x9B9 + SYS___CASINL_H = 0x9BA + SYS___CASIN_B = 0x9B3 + SYS___CASIN_H = 0x9B4 + SYS___CATANF_B = 0x9C8 + SYS___CATANF_H = 0x9C9 + SYS___CATANHF_B = 0x9D1 + SYS___CATANHF_H = 0x9D2 + SYS___CATANHL_B = 0x9D4 + SYS___CATANHL_H = 0x9D5 + SYS___CATANH_B = 0x9CE + SYS___CATANH_H = 0x9CF + SYS___CATANL_B = 0x9CB + SYS___CATANL_H = 0x9CC + SYS___CATAN_B = 0x9C5 + SYS___CATAN_H = 0x9C6 + SYS___CCOSF_B = 0x9DA + SYS___CCOSF_H = 0x9DB + SYS___CCOSHF_B = 0x9E3 + SYS___CCOSHF_H = 0x9E4 + SYS___CCOSHL_B = 0x9E6 + SYS___CCOSHL_H = 0x9E7 + SYS___CCOSH_B = 0x9E0 + SYS___CCOSH_H = 0x9E1 + SYS___CCOSL_B = 0x9DD + SYS___CCOSL_H = 0x9DE + SYS___CCOS_B = 0x9D7 + SYS___CCOS_H = 0x9D8 + SYS___CEXPF_B = 0x9EC + SYS___CEXPF_H = 0x9ED + SYS___CEXPL_B = 0x9EF + SYS___CEXPL_H = 0x9F0 + SYS___CEXP_B = 0x9E9 + SYS___CEXP_H = 0x9EA + SYS___CIMAGF_B = 0x9F5 + SYS___CIMAGF_H = 0x9F6 + SYS___CIMAGL_B = 0x9F8 + SYS___CIMAGL_H = 0x9F9 + SYS___CIMAG_B = 0x9F2 + SYS___CIMAG_H = 0x9F3 + SYS___CLOG = 0x9FA + SYS___CLOGF_B = 0x9FE + SYS___CLOGF_H = 0x9FF + SYS___CLOG_B = 0x9FB + SYS___CLOG_H = 0x9FC + SYS_ISWCTYPE = 0x10C + SYS_ISWXDIGI = 0x10A + SYS_ISWXDIGIT = 0x10A + SYS_MBSINIT = 0x10F + SYS_TOWLOWER = 0x10D + SYS_TOWUPPER = 0x10E + SYS_WCTYPE = 0x10B + SYS_WCSSTR = 0x11B + SYS___RPMTCH = 0x11A + SYS_WCSTOD = 0x12E + SYS_WCSTOK = 0x12C + SYS_WCSTOL = 0x12D + SYS_WCSTOUL = 0x12F + SYS_FGETWC = 0x13C + SYS_FGETWS = 0x13D + SYS_FPUTWC = 0x13E + SYS_FPUTWS = 0x13F + SYS_REGERROR = 0x13B + SYS_REGFREE = 0x13A + SYS_COLLEQUIV = 0x14F + SYS_COLLTOSTR = 0x14E + SYS_ISMCCOLLEL = 0x14C + SYS_STRTOCOLL = 0x14D + SYS_DLLFREE = 0x16F + SYS_DLLQUERYFN = 0x16D + SYS_DLLQUERYVAR = 0x16E + SYS_GETMCCOLL = 0x16A + SYS_GETWMCCOLL = 0x16B + SYS___ERR2AD = 0x16C + SYS_CFSETOSPEED = 0x17A + SYS_CHDIR = 0x17B + SYS_CHMOD = 0x17C + SYS_CHOWN = 0x17D + SYS_CLOSE = 0x17E + SYS_CLOSEDIR = 0x17F + SYS_LOG = 0x017 + SYS_COSH = 0x018 + SYS_FCHMOD = 0x18A + SYS_FCHOWN = 0x18B + SYS_FCNTL = 0x18C + SYS_FILENO = 0x18D + SYS_FORK = 0x18E + SYS_FPATHCONF = 0x18F + SYS_GETLOGIN = 0x19A + SYS_GETPGRP = 0x19C + SYS_GETPID = 0x19D + SYS_GETPPID = 0x19E + SYS_GETPWNAM = 0x19F + SYS_TANH = 0x019 + SYS_W_GETMNTENT = 0x19B + SYS_POW = 0x020 + SYS_PTHREAD_SELF = 0x20A + SYS_PTHREAD_SETINTR = 0x20B + SYS_PTHREAD_SETINTRTYPE = 0x20C + SYS_PTHREAD_SETSPECIFIC = 0x20D + SYS_PTHREAD_TESTINTR = 0x20E + SYS_PTHREAD_YIELD = 0x20F + SYS_SQRT = 0x021 + SYS_FLOOR = 0x022 + SYS_J1 = 0x023 + SYS_WCSPBRK = 0x23F + SYS_BSEARCH = 0x24C + SYS_FABS = 0x024 + SYS_GETENV = 0x24A + SYS_LDIV = 0x24D + SYS_SYSTEM = 0x24B + SYS_FMOD = 0x025 + SYS___RETHROW = 0x25F + SYS___THROW = 0x25E + SYS_J0 = 0x026 + SYS_PUTENV = 0x26A + SYS___GETENV = 0x26F + SYS_SEMCTL = 0x27A + SYS_SEMGET = 0x27B + SYS_SEMOP = 0x27C + SYS_SHMAT = 0x27D + SYS_SHMCTL = 0x27E + SYS_SHMDT = 0x27F + SYS_YN = 0x027 + SYS_JN = 0x028 + SYS_SIGALTSTACK = 0x28A + SYS_SIGHOLD = 0x28B + SYS_SIGIGNORE = 0x28C + SYS_SIGINTERRUPT = 0x28D + SYS_SIGPAUSE = 0x28E + SYS_SIGRELSE = 0x28F + SYS_GETOPT = 0x29A + SYS_GETSUBOPT = 0x29D + SYS_LCHOWN = 0x29B + SYS_SETPGRP = 0x29E + SYS_TRUNCATE = 0x29C + SYS_Y0 = 0x029 + SYS___GDERR = 0x29F + SYS_ISALPHA = 0x030 + SYS_VFORK = 0x30F + SYS__LONGJMP = 0x30D + SYS__SETJMP = 0x30E + SYS_GLOB = 0x31A + SYS_GLOBFREE = 0x31B + SYS_ISALNUM = 0x031 + SYS_PUTW = 0x31C + SYS_SEEKDIR = 0x31D + SYS_TELLDIR = 0x31E + SYS_TEMPNAM = 0x31F + SYS_GETTIMEOFDAY_R = 0x32E + SYS_ISLOWER = 0x032 + SYS_LGAMMA = 0x32C + SYS_REMAINDER = 0x32A + SYS_SCALB = 0x32B + SYS_SYNC = 0x32F + SYS_TTYSLOT = 0x32D + SYS_ENDPROTOENT = 0x33A + SYS_ENDSERVENT = 0x33B + SYS_GETHOSTBYADDR = 0x33D + SYS_GETHOSTBYADDR_R = 0x33C + SYS_GETHOSTBYNAME = 0x33F + SYS_GETHOSTBYNAME_R = 0x33E + SYS_ISCNTRL = 0x033 + SYS_GETSERVBYNAME = 0x34A + SYS_GETSERVBYPORT = 0x34B + SYS_GETSERVENT = 0x34C + SYS_GETSOCKNAME = 0x34D + SYS_GETSOCKOPT = 0x34E + SYS_INET_ADDR = 0x34F + SYS_ISDIGIT = 0x034 + SYS_ISGRAPH = 0x035 + SYS_SELECT = 0x35B + SYS_SELECTEX = 0x35C + SYS_SEND = 0x35D + SYS_SENDTO = 0x35F + SYS_CHROOT = 0x36A + SYS_ISNAN = 0x36D + SYS_ISUPPER = 0x036 + SYS_ULIMIT = 0x36C + SYS_UTIMES = 0x36E + SYS_W_STATVFS = 0x36B + SYS___H_ERRNO = 0x36F + SYS_GRANTPT = 0x37A + SYS_ISPRINT = 0x037 + SYS_TCGETSID = 0x37C + SYS_UNLOCKPT = 0x37B + SYS___TCGETCP = 0x37D + SYS___TCSETCP = 0x37E + SYS___TCSETTABLES = 0x37F + SYS_ISPUNCT = 0x038 + SYS_NLIST = 0x38C + SYS___IPDBCS = 0x38D + SYS___IPDSPX = 0x38E + SYS___IPMSGC = 0x38F + SYS___STHOSTENT = 0x38B + SYS___STSERVENT = 0x38A + SYS_ISSPACE = 0x039 + SYS_COS = 0x040 + SYS_T_ALLOC = 0x40A + SYS_T_BIND = 0x40B + SYS_T_CLOSE = 0x40C + SYS_T_CONNECT = 0x40D + SYS_T_ERROR = 0x40E + SYS_T_FREE = 0x40F + SYS_TAN = 0x041 + SYS_T_RCVREL = 0x41A + SYS_T_RCVUDATA = 0x41B + SYS_T_RCVUDERR = 0x41C + SYS_T_SND = 0x41D + SYS_T_SNDDIS = 0x41E + SYS_T_SNDREL = 0x41F + SYS_GETPMSG = 0x42A + SYS_ISASTREAM = 0x42B + SYS_PUTMSG = 0x42C + SYS_PUTPMSG = 0x42D + SYS_SINH = 0x042 + SYS___ISPOSIXON = 0x42E + SYS___OPENMVSREL = 0x42F + SYS_ACOS = 0x043 + SYS_ATAN = 0x044 + SYS_ATAN2 = 0x045 + SYS_FTELL = 0x046 + SYS_FGETPOS = 0x047 + SYS_SOCK_DEBUG = 0x47A + SYS_SOCK_DO_TESTSTOR = 0x47D + SYS_TAKESOCKET = 0x47E + SYS___SERVER_INIT = 0x47F + SYS_FSEEK = 0x048 + SYS___IPHOST = 0x48B + SYS___IPNODE = 0x48C + SYS___SERVER_CLASSIFY_CREATE = 0x48D + SYS___SERVER_CLASSIFY_DESTROY = 0x48E + SYS___SERVER_CLASSIFY_RESET = 0x48F + SYS___SMF_RECORD = 0x48A + SYS_FSETPOS = 0x049 + SYS___FNWSA = 0x49B + SYS___SPAWN2 = 0x49D + SYS___SPAWNP2 = 0x49E + SYS_ATOF = 0x050 + SYS_PTHREAD_MUTEXATTR_GETPSHARED = 0x50A + SYS_PTHREAD_MUTEXATTR_SETPSHARED = 0x50B + SYS_PTHREAD_RWLOCK_DESTROY = 0x50C + SYS_PTHREAD_RWLOCK_INIT = 0x50D + SYS_PTHREAD_RWLOCK_RDLOCK = 0x50E + SYS_PTHREAD_RWLOCK_TRYRDLOCK = 0x50F + SYS_ATOI = 0x051 + SYS___FP_CLASS = 0x51D + SYS___FP_CLR_FLAG = 0x51A + SYS___FP_FINITE = 0x51E + SYS___FP_ISNAN = 0x51F + SYS___FP_RAISE_XCP = 0x51C + SYS___FP_READ_FLAG = 0x51B + SYS_RAND = 0x052 + SYS_SIGTIMEDWAIT = 0x52D + SYS_SIGWAITINFO = 0x52E + SYS___CHKBFP = 0x52F + SYS___FPC_RS = 0x52C + SYS___FPC_RW = 0x52A + SYS___FPC_SM = 0x52B + SYS_STRTOD = 0x053 + SYS_STRTOL = 0x054 + SYS_STRTOUL = 0x055 + SYS_MALLOC = 0x056 + SYS_SRAND = 0x057 + SYS_CALLOC = 0x058 + SYS_FREE = 0x059 + SYS___OSENV = 0x59F + SYS___W_PIOCTL = 0x59E + SYS_LONGJMP = 0x060 + SYS___FLOORF_B = 0x60A + SYS___FLOORL_B = 0x60B + SYS___FREXPF_B = 0x60C + SYS___FREXPL_B = 0x60D + SYS___LDEXPF_B = 0x60E + SYS___LDEXPL_B = 0x60F + SYS_SIGNAL = 0x061 + SYS___ATAN2F_B = 0x61A + SYS___ATAN2L_B = 0x61B + SYS___COSHF_B = 0x61C + SYS___COSHL_B = 0x61D + SYS___EXPF_B = 0x61E + SYS___EXPL_B = 0x61F + SYS_TMPNAM = 0x062 + SYS___ABSF_B = 0x62A + SYS___ABSL_B = 0x62C + SYS___ABS_B = 0x62B + SYS___FMODF_B = 0x62D + SYS___FMODL_B = 0x62E + SYS___MODFF_B = 0x62F + SYS_ATANL = 0x63A + SYS_CEILF = 0x63B + SYS_CEILL = 0x63C + SYS_COSF = 0x63D + SYS_COSHF = 0x63F + SYS_COSL = 0x63E + SYS_REMOVE = 0x063 + SYS_POWL = 0x64A + SYS_RENAME = 0x064 + SYS_SINF = 0x64B + SYS_SINHF = 0x64F + SYS_SINL = 0x64C + SYS_SQRTF = 0x64D + SYS_SQRTL = 0x64E + SYS_BTOWC = 0x65F + SYS_FREXPL = 0x65A + SYS_LDEXPF = 0x65B + SYS_LDEXPL = 0x65C + SYS_MODFF = 0x65D + SYS_MODFL = 0x65E + SYS_TMPFILE = 0x065 + SYS_FREOPEN = 0x066 + SYS___CHARMAP_INIT_A = 0x66E + SYS___GETHOSTBYADDR_R_A = 0x66C + SYS___GETHOSTBYNAME_A = 0x66A + SYS___GETHOSTBYNAME_R_A = 0x66D + SYS___MBLEN_A = 0x66F + SYS___RES_INIT_A = 0x66B + SYS_FCLOSE = 0x067 + SYS___GETGRGID_R_A = 0x67D + SYS___WCSTOMBS_A = 0x67A + SYS___WCSTOMBS_STD_A = 0x67B + SYS___WCSWIDTH_A = 0x67C + SYS___WCSWIDTH_ASIA = 0x67F + SYS___WCSWIDTH_STD_A = 0x67E + SYS_FFLUSH = 0x068 + SYS___GETLOGIN_R_A = 0x68E + SYS___GETPWNAM_R_A = 0x68C + SYS___GETPWUID_R_A = 0x68D + SYS___TTYNAME_R_A = 0x68F + SYS___WCWIDTH_ASIA = 0x68B + SYS___WCWIDTH_STD_A = 0x68A + SYS_FOPEN = 0x069 + SYS___REGEXEC_A = 0x69A + SYS___REGEXEC_STD_A = 0x69B + SYS___REGFREE_A = 0x69C + SYS___REGFREE_STD_A = 0x69D + SYS___STRCOLL_A = 0x69E + SYS___STRCOLL_C_A = 0x69F + SYS_SCANF = 0x070 + SYS___A64L_A = 0x70C + SYS___ECVT_A = 0x70D + SYS___FCVT_A = 0x70E + SYS___GCVT_A = 0x70F + SYS___STRTOUL_A = 0x70A + SYS_____AE_CORRESTBL_QUERY_A = 0x70B + SYS_SPRINTF = 0x071 + SYS___ACCESS_A = 0x71F + SYS___CATOPEN_A = 0x71E + SYS___GETOPT_A = 0x71D + SYS___REALPATH_A = 0x71A + SYS___SETENV_A = 0x71B + SYS___SYSTEM_A = 0x71C + SYS_FGETC = 0x072 + SYS___GAI_STRERROR_A = 0x72F + SYS___RMDIR_A = 0x72A + SYS___STATVFS_A = 0x72B + SYS___SYMLINK_A = 0x72C + SYS___TRUNCATE_A = 0x72D + SYS___UNLINK_A = 0x72E + SYS_VFPRINTF = 0x073 + SYS___ISSPACE_A = 0x73A + SYS___ISUPPER_A = 0x73B + SYS___ISWALNUM_A = 0x73F + SYS___ISXDIGIT_A = 0x73C + SYS___TOLOWER_A = 0x73D + SYS___TOUPPER_A = 0x73E + SYS_VPRINTF = 0x074 + SYS___CONFSTR_A = 0x74B + SYS___FDOPEN_A = 0x74E + SYS___FLDATA_A = 0x74F + SYS___FTOK_A = 0x74C + SYS___ISWXDIGIT_A = 0x74A + SYS___MKTEMP_A = 0x74D + SYS_VSPRINTF = 0x075 + SYS___GETGRGID_A = 0x75A + SYS___GETGRNAM_A = 0x75B + SYS___GETGROUPSBYNAME_A = 0x75C + SYS___GETHOSTENT_A = 0x75D + SYS___GETHOSTNAME_A = 0x75E + SYS___GETLOGIN_A = 0x75F + SYS_GETC = 0x076 + SYS___CREATEWORKUNIT_A = 0x76A + SYS___CTERMID_A = 0x76B + SYS___FMTMSG_A = 0x76C + SYS___INITGROUPS_A = 0x76D + SYS___MSGRCV_A = 0x76F + SYS_____LOGIN_A = 0x76E + SYS_FGETS = 0x077 + SYS___STRCASECMP_A = 0x77B + SYS___STRNCASECMP_A = 0x77C + SYS___TTYNAME_A = 0x77D + SYS___UNAME_A = 0x77E + SYS___UTIMES_A = 0x77F + SYS_____SERVER_PWU_A = 0x77A + SYS_FPUTC = 0x078 + SYS___CREAT_O_A = 0x78E + SYS___ENVNA = 0x78F + SYS___FREAD_A = 0x78A + SYS___FWRITE_A = 0x78B + SYS___ISASCII = 0x78D + SYS___OPEN_O_A = 0x78C + SYS_FPUTS = 0x079 + SYS___ASCTIME_A = 0x79C + SYS___CTIME_A = 0x79D + SYS___GETDATE_A = 0x79E + SYS___GETSERVBYPORT_A = 0x79A + SYS___GETSERVENT_A = 0x79B + SYS___TZSET_A = 0x79F + SYS_ACL_FROM_TEXT = 0x80C + SYS_ACL_SET_FD = 0x80A + SYS_ACL_SET_FILE = 0x80B + SYS_ACL_SORT = 0x80E + SYS_ACL_TO_TEXT = 0x80D + SYS_UNGETC = 0x080 + SYS___SHUTDOWN_REGISTRATION = 0x80F + SYS_FREAD = 0x081 + SYS_FREEADDRINFO = 0x81A + SYS_GAI_STRERROR = 0x81B + SYS_REXEC_AF = 0x81C + SYS___DYNALLOC_A = 0x81F + SYS___POE = 0x81D + SYS_WCSTOMBS = 0x082 + SYS___INET_ADDR_A = 0x82F + SYS___NLIST_A = 0x82A + SYS_____TCGETCP_A = 0x82B + SYS_____TCSETCP_A = 0x82C + SYS_____W_PIOCTL_A = 0x82E + SYS_MBTOWC = 0x083 + SYS___CABEND = 0x83D + SYS___LE_CIB_GET = 0x83E + SYS___RECVMSG_A = 0x83B + SYS___SENDMSG_A = 0x83A + SYS___SET_LAA_FOR_JIT = 0x83F + SYS_____LCHATTR_A = 0x83C + SYS_WCTOMB = 0x084 + SYS___CBRTL_B = 0x84A + SYS___COPYSIGNF_B = 0x84B + SYS___COPYSIGNL_B = 0x84C + SYS___COTANF_B = 0x84D + SYS___COTANL_B = 0x84F + SYS___COTAN_B = 0x84E + SYS_MBSTOWCS = 0x085 + SYS___LOG1PL_B = 0x85A + SYS___LOG2F_B = 0x85B + SYS___LOG2L_B = 0x85D + SYS___LOG2_B = 0x85C + SYS___REMAINDERF_B = 0x85E + SYS___REMAINDERL_B = 0x85F + SYS_ACOSHF = 0x86E + SYS_ACOSHL = 0x86F + SYS_WCSCPY = 0x086 + SYS___ERFCF_B = 0x86D + SYS___ERFF_B = 0x86C + SYS___LROUNDF_B = 0x86A + SYS___LROUND_B = 0x86B + SYS_COTANL = 0x87A + SYS_EXP2F = 0x87B + SYS_EXP2L = 0x87C + SYS_EXPM1F = 0x87D + SYS_EXPM1L = 0x87E + SYS_FDIMF = 0x87F + SYS_WCSCAT = 0x087 + SYS___COTANL = 0x87A + SYS_REMAINDERF = 0x88A + SYS_REMAINDERL = 0x88B + SYS_REMAINDF = 0x88A + SYS_REMAINDL = 0x88B + SYS_REMQUO = 0x88D + SYS_REMQUOF = 0x88C + SYS_REMQUOL = 0x88E + SYS_TGAMMAF = 0x88F + SYS_WCSCHR = 0x088 + SYS_ERFCF = 0x89B + SYS_ERFCL = 0x89C + SYS_ERFL = 0x89A + SYS_EXP2 = 0x89E + SYS_WCSCMP = 0x089 + SYS___EXP2_B = 0x89D + SYS___FAR_JUMP = 0x89F + SYS_ABS = 0x090 + SYS___ERFCL_H = 0x90A + SYS___EXPF_H = 0x90C + SYS___EXPL_H = 0x90D + SYS___EXPM1_H = 0x90E + SYS___EXP_H = 0x90B + SYS___FDIM_H = 0x90F + SYS_DIV = 0x091 + SYS___LOG2F_H = 0x91F + SYS___LOG2_H = 0x91E + SYS___LOGB_H = 0x91D + SYS___LOGF_H = 0x91B + SYS___LOGL_H = 0x91C + SYS___LOG_H = 0x91A + SYS_LABS = 0x092 + SYS___POWL_H = 0x92A + SYS___REMAINDER_H = 0x92B + SYS___RINT_H = 0x92C + SYS___SCALB_H = 0x92D + SYS___SINF_H = 0x92F + SYS___SIN_H = 0x92E + SYS_STRNCPY = 0x093 + SYS___TANHF_H = 0x93B + SYS___TANHL_H = 0x93C + SYS___TANH_H = 0x93A + SYS___TGAMMAF_H = 0x93E + SYS___TGAMMA_H = 0x93D + SYS___TRUNC_H = 0x93F + SYS_MEMCPY = 0x094 + SYS_VFWSCANF = 0x94A + SYS_VSWSCANF = 0x94E + SYS_VWSCANF = 0x94C + SYS_INET6_RTH_ADD = 0x95D + SYS_INET6_RTH_INIT = 0x95C + SYS_INET6_RTH_REVERSE = 0x95E + SYS_INET6_RTH_SEGMENTS = 0x95F + SYS_INET6_RTH_SPACE = 0x95B + SYS_MEMMOVE = 0x095 + SYS_WCSTOLD = 0x95A + SYS_STRCPY = 0x096 + SYS_STRCMP = 0x097 + SYS_CABS = 0x98E + SYS_STRCAT = 0x098 + SYS___CABS_B = 0x98F + SYS___POW_II = 0x98A + SYS___POW_II_B = 0x98B + SYS___POW_II_H = 0x98C + SYS_CACOSF = 0x99A + SYS_CACOSL = 0x99D + SYS_STRNCAT = 0x099 + SYS___CACOSF_B = 0x99B + SYS___CACOSF_H = 0x99C + SYS___CACOSL_B = 0x99E + SYS___CACOSL_H = 0x99F + SYS_ISWALPHA = 0x100 + SYS_ISWBLANK = 0x101 + SYS___ISWBLK = 0x101 + SYS_ISWCNTRL = 0x102 + SYS_ISWDIGIT = 0x103 + SYS_ISWGRAPH = 0x104 + SYS_ISWLOWER = 0x105 + SYS_ISWPRINT = 0x106 + SYS_ISWPUNCT = 0x107 + SYS_ISWSPACE = 0x108 + SYS_ISWUPPER = 0x109 + SYS_WCTOB = 0x110 + SYS_MBRLEN = 0x111 + SYS_MBRTOWC = 0x112 + SYS_MBSRTOWC = 0x113 + SYS_MBSRTOWCS = 0x113 + SYS_WCRTOMB = 0x114 + SYS_WCSRTOMB = 0x115 + SYS_WCSRTOMBS = 0x115 + SYS___CSID = 0x116 + SYS___WCSID = 0x117 + SYS_STRPTIME = 0x118 + SYS___STRPTM = 0x118 + SYS_STRFMON = 0x119 + SYS_WCSCOLL = 0x130 + SYS_WCSXFRM = 0x131 + SYS_WCSWIDTH = 0x132 + SYS_WCWIDTH = 0x133 + SYS_WCSFTIME = 0x134 + SYS_SWPRINTF = 0x135 + SYS_VSWPRINT = 0x136 + SYS_VSWPRINTF = 0x136 + SYS_SWSCANF = 0x137 + SYS_REGCOMP = 0x138 + SYS_REGEXEC = 0x139 + SYS_GETWC = 0x140 + SYS_GETWCHAR = 0x141 + SYS_PUTWC = 0x142 + SYS_PUTWCHAR = 0x143 + SYS_UNGETWC = 0x144 + SYS_ICONV_OPEN = 0x145 + SYS_ICONV = 0x146 + SYS_ICONV_CLOSE = 0x147 + SYS_COLLRANGE = 0x150 + SYS_CCLASS = 0x151 + SYS_COLLORDER = 0x152 + SYS___DEMANGLE = 0x154 + SYS_FDOPEN = 0x155 + SYS___ERRNO = 0x156 + SYS___ERRNO2 = 0x157 + SYS___TERROR = 0x158 + SYS_MAXCOLL = 0x169 + SYS_DLLLOAD = 0x170 + SYS__EXIT = 0x174 + SYS_ACCESS = 0x175 + SYS_ALARM = 0x176 + SYS_CFGETISPEED = 0x177 + SYS_CFGETOSPEED = 0x178 + SYS_CFSETISPEED = 0x179 + SYS_CREAT = 0x180 + SYS_CTERMID = 0x181 + SYS_DUP = 0x182 + SYS_DUP2 = 0x183 + SYS_EXECL = 0x184 + SYS_EXECLE = 0x185 + SYS_EXECLP = 0x186 + SYS_EXECV = 0x187 + SYS_EXECVE = 0x188 + SYS_EXECVP = 0x189 + SYS_FSTAT = 0x190 + SYS_FSYNC = 0x191 + SYS_FTRUNCATE = 0x192 + SYS_GETCWD = 0x193 + SYS_GETEGID = 0x194 + SYS_GETEUID = 0x195 + SYS_GETGID = 0x196 + SYS_GETGRGID = 0x197 + SYS_GETGRNAM = 0x198 + SYS_GETGROUPS = 0x199 + SYS_PTHREAD_MUTEXATTR_DESTROY = 0x200 + SYS_PTHREAD_MUTEXATTR_SETKIND_NP = 0x201 + SYS_PTHREAD_MUTEXATTR_GETKIND_NP = 0x202 + SYS_PTHREAD_MUTEX_INIT = 0x203 + SYS_PTHREAD_MUTEX_DESTROY = 0x204 + SYS_PTHREAD_MUTEX_LOCK = 0x205 + SYS_PTHREAD_MUTEX_TRYLOCK = 0x206 + SYS_PTHREAD_MUTEX_UNLOCK = 0x207 + SYS_PTHREAD_ONCE = 0x209 + SYS_TW_OPEN = 0x210 + SYS_TW_FCNTL = 0x211 + SYS_PTHREAD_JOIN_D4_NP = 0x212 + SYS_PTHREAD_CONDATTR_SETKIND_NP = 0x213 + SYS_PTHREAD_CONDATTR_GETKIND_NP = 0x214 + SYS_EXTLINK_NP = 0x215 + SYS___PASSWD = 0x216 + SYS_SETGROUPS = 0x217 + SYS_INITGROUPS = 0x218 + SYS_WCSRCHR = 0x240 + SYS_SVC99 = 0x241 + SYS___SVC99 = 0x241 + SYS_WCSWCS = 0x242 + SYS_LOCALECO = 0x243 + SYS_LOCALECONV = 0x243 + SYS___LIBREL = 0x244 + SYS_RELEASE = 0x245 + SYS___RLSE = 0x245 + SYS_FLOCATE = 0x246 + SYS___FLOCT = 0x246 + SYS_FDELREC = 0x247 + SYS___FDLREC = 0x247 + SYS_FETCH = 0x248 + SYS___FETCH = 0x248 + SYS_QSORT = 0x249 + SYS___CLEANUPCATCH = 0x260 + SYS___CATCHMATCH = 0x261 + SYS___CLEAN2UPCATCH = 0x262 + SYS_GETPRIORITY = 0x270 + SYS_NICE = 0x271 + SYS_SETPRIORITY = 0x272 + SYS_GETITIMER = 0x273 + SYS_SETITIMER = 0x274 + SYS_MSGCTL = 0x275 + SYS_MSGGET = 0x276 + SYS_MSGRCV = 0x277 + SYS_MSGSND = 0x278 + SYS_MSGXRCV = 0x279 + SYS___MSGXR = 0x279 + SYS_SHMGET = 0x280 + SYS___GETIPC = 0x281 + SYS_SETGRENT = 0x282 + SYS_GETGRENT = 0x283 + SYS_ENDGRENT = 0x284 + SYS_SETPWENT = 0x285 + SYS_GETPWENT = 0x286 + SYS_ENDPWENT = 0x287 + SYS_BSD_SIGNAL = 0x288 + SYS_KILLPG = 0x289 + SYS_SIGSET = 0x290 + SYS_SIGSTACK = 0x291 + SYS_GETRLIMIT = 0x292 + SYS_SETRLIMIT = 0x293 + SYS_GETRUSAGE = 0x294 + SYS_MMAP = 0x295 + SYS_MPROTECT = 0x296 + SYS_MSYNC = 0x297 + SYS_MUNMAP = 0x298 + SYS_CONFSTR = 0x299 + SYS___NDMTRM = 0x300 + SYS_FTOK = 0x301 + SYS_BASENAME = 0x302 + SYS_DIRNAME = 0x303 + SYS_GETDTABLESIZE = 0x304 + SYS_MKSTEMP = 0x305 + SYS_MKTEMP = 0x306 + SYS_NFTW = 0x307 + SYS_GETWD = 0x308 + SYS_LOCKF = 0x309 + SYS_WORDEXP = 0x310 + SYS_WORDFREE = 0x311 + SYS_GETPGID = 0x312 + SYS_GETSID = 0x313 + SYS___UTMPXNAME = 0x314 + SYS_CUSERID = 0x315 + SYS_GETPASS = 0x316 + SYS_FNMATCH = 0x317 + SYS_FTW = 0x318 + SYS_GETW = 0x319 + SYS_ACOSH = 0x320 + SYS_ASINH = 0x321 + SYS_ATANH = 0x322 + SYS_CBRT = 0x323 + SYS_EXPM1 = 0x324 + SYS_ILOGB = 0x325 + SYS_LOGB = 0x326 + SYS_LOG1P = 0x327 + SYS_NEXTAFTER = 0x328 + SYS_RINT = 0x329 + SYS_SPAWN = 0x330 + SYS_SPAWNP = 0x331 + SYS_GETLOGIN_UU = 0x332 + SYS_ECVT = 0x333 + SYS_FCVT = 0x334 + SYS_GCVT = 0x335 + SYS_ACCEPT = 0x336 + SYS_BIND = 0x337 + SYS_CONNECT = 0x338 + SYS_ENDHOSTENT = 0x339 + SYS_GETHOSTENT = 0x340 + SYS_GETHOSTID = 0x341 + SYS_GETHOSTNAME = 0x342 + SYS_GETNETBYADDR = 0x343 + SYS_GETNETBYNAME = 0x344 + SYS_GETNETENT = 0x345 + SYS_GETPEERNAME = 0x346 + SYS_GETPROTOBYNAME = 0x347 + SYS_GETPROTOBYNUMBER = 0x348 + SYS_GETPROTOENT = 0x349 + SYS_INET_LNAOF = 0x350 + SYS_INET_MAKEADDR = 0x351 + SYS_INET_NETOF = 0x352 + SYS_INET_NETWORK = 0x353 + SYS_INET_NTOA = 0x354 + SYS_IOCTL = 0x355 + SYS_LISTEN = 0x356 + SYS_READV = 0x357 + SYS_RECV = 0x358 + SYS_RECVFROM = 0x359 + SYS_SETHOSTENT = 0x360 + SYS_SETNETENT = 0x361 + SYS_SETPEER = 0x362 + SYS_SETPROTOENT = 0x363 + SYS_SETSERVENT = 0x364 + SYS_SETSOCKOPT = 0x365 + SYS_SHUTDOWN = 0x366 + SYS_SOCKET = 0x367 + SYS_SOCKETPAIR = 0x368 + SYS_WRITEV = 0x369 + SYS_ENDNETENT = 0x370 + SYS_CLOSELOG = 0x371 + SYS_OPENLOG = 0x372 + SYS_SETLOGMASK = 0x373 + SYS_SYSLOG = 0x374 + SYS_PTSNAME = 0x375 + SYS_SETREUID = 0x376 + SYS_SETREGID = 0x377 + SYS_REALPATH = 0x378 + SYS___SIGNGAM = 0x379 + SYS_POLL = 0x380 + SYS_REXEC = 0x381 + SYS___ISASCII2 = 0x382 + SYS___TOASCII2 = 0x383 + SYS_CHPRIORITY = 0x384 + SYS_PTHREAD_ATTR_SETSYNCTYPE_NP = 0x385 + SYS_PTHREAD_ATTR_GETSYNCTYPE_NP = 0x386 + SYS_PTHREAD_SET_LIMIT_NP = 0x387 + SYS___STNETENT = 0x388 + SYS___STPROTOENT = 0x389 + SYS___SELECT1 = 0x390 + SYS_PTHREAD_SECURITY_NP = 0x391 + SYS___CHECK_RESOURCE_AUTH_NP = 0x392 + SYS___CONVERT_ID_NP = 0x393 + SYS___OPENVMREL = 0x394 + SYS_WMEMCHR = 0x395 + SYS_WMEMCMP = 0x396 + SYS_WMEMCPY = 0x397 + SYS_WMEMMOVE = 0x398 + SYS_WMEMSET = 0x399 + SYS___FPUTWC = 0x400 + SYS___PUTWC = 0x401 + SYS___PWCHAR = 0x402 + SYS___WCSFTM = 0x403 + SYS___WCSTOK = 0x404 + SYS___WCWDTH = 0x405 + SYS_T_ACCEPT = 0x409 + SYS_T_GETINFO = 0x410 + SYS_T_GETPROTADDR = 0x411 + SYS_T_GETSTATE = 0x412 + SYS_T_LISTEN = 0x413 + SYS_T_LOOK = 0x414 + SYS_T_OPEN = 0x415 + SYS_T_OPTMGMT = 0x416 + SYS_T_RCV = 0x417 + SYS_T_RCVCONNECT = 0x418 + SYS_T_RCVDIS = 0x419 + SYS_T_SNDUDATA = 0x420 + SYS_T_STRERROR = 0x421 + SYS_T_SYNC = 0x422 + SYS_T_UNBIND = 0x423 + SYS___T_ERRNO = 0x424 + SYS___RECVMSG2 = 0x425 + SYS___SENDMSG2 = 0x426 + SYS_FATTACH = 0x427 + SYS_FDETACH = 0x428 + SYS_GETMSG = 0x429 + SYS_GETCONTEXT = 0x430 + SYS_SETCONTEXT = 0x431 + SYS_MAKECONTEXT = 0x432 + SYS_SWAPCONTEXT = 0x433 + SYS_PTHREAD_GETSPECIFIC_D8_NP = 0x434 + SYS_GETCLIENTID = 0x470 + SYS___GETCLIENTID = 0x471 + SYS_GETSTABLESIZE = 0x472 + SYS_GETIBMOPT = 0x473 + SYS_GETIBMSOCKOPT = 0x474 + SYS_GIVESOCKET = 0x475 + SYS_IBMSFLUSH = 0x476 + SYS_MAXDESC = 0x477 + SYS_SETIBMOPT = 0x478 + SYS_SETIBMSOCKOPT = 0x479 + SYS___SERVER_PWU = 0x480 + SYS_PTHREAD_TAG_NP = 0x481 + SYS___CONSOLE = 0x482 + SYS___WSINIT = 0x483 + SYS___IPTCPN = 0x489 + SYS___SERVER_CLASSIFY = 0x490 + SYS___HEAPRPT = 0x496 + SYS___ISBFP = 0x500 + SYS___FP_CAST = 0x501 + SYS___CERTIFICATE = 0x502 + SYS_SEND_FILE = 0x503 + SYS_AIO_CANCEL = 0x504 + SYS_AIO_ERROR = 0x505 + SYS_AIO_READ = 0x506 + SYS_AIO_RETURN = 0x507 + SYS_AIO_SUSPEND = 0x508 + SYS_AIO_WRITE = 0x509 + SYS_PTHREAD_RWLOCK_TRYWRLOCK = 0x510 + SYS_PTHREAD_RWLOCK_UNLOCK = 0x511 + SYS_PTHREAD_RWLOCK_WRLOCK = 0x512 + SYS_PTHREAD_RWLOCKATTR_GETPSHARED = 0x513 + SYS_PTHREAD_RWLOCKATTR_SETPSHARED = 0x514 + SYS_PTHREAD_RWLOCKATTR_INIT = 0x515 + SYS_PTHREAD_RWLOCKATTR_DESTROY = 0x516 + SYS___CTTBL = 0x517 + SYS_PTHREAD_MUTEXATTR_SETTYPE = 0x518 + SYS_PTHREAD_MUTEXATTR_GETTYPE = 0x519 + SYS___FP_UNORDERED = 0x520 + SYS___FP_READ_RND = 0x521 + SYS___FP_READ_RND_B = 0x522 + SYS___FP_SWAP_RND = 0x523 + SYS___FP_SWAP_RND_B = 0x524 + SYS___FP_LEVEL = 0x525 + SYS___FP_BTOH = 0x526 + SYS___FP_HTOB = 0x527 + SYS___FPC_RD = 0x528 + SYS___FPC_WR = 0x529 + SYS_PTHREAD_SETCANCELTYPE = 0x600 + SYS_PTHREAD_TESTCANCEL = 0x601 + SYS___ATANF_B = 0x602 + SYS___ATANL_B = 0x603 + SYS___CEILF_B = 0x604 + SYS___CEILL_B = 0x605 + SYS___COSF_B = 0x606 + SYS___COSL_B = 0x607 + SYS___FABSF_B = 0x608 + SYS___FABSL_B = 0x609 + SYS___SINF_B = 0x610 + SYS___SINL_B = 0x611 + SYS___TANF_B = 0x612 + SYS___TANL_B = 0x613 + SYS___TANHF_B = 0x614 + SYS___TANHL_B = 0x615 + SYS___ACOSF_B = 0x616 + SYS___ACOSL_B = 0x617 + SYS___ASINF_B = 0x618 + SYS___ASINL_B = 0x619 + SYS___LOGF_B = 0x620 + SYS___LOGL_B = 0x621 + SYS___LOG10F_B = 0x622 + SYS___LOG10L_B = 0x623 + SYS___POWF_B = 0x624 + SYS___POWL_B = 0x625 + SYS___SINHF_B = 0x626 + SYS___SINHL_B = 0x627 + SYS___SQRTF_B = 0x628 + SYS___SQRTL_B = 0x629 + SYS___MODFL_B = 0x630 + SYS_ABSF = 0x631 + SYS_ABSL = 0x632 + SYS_ACOSF = 0x633 + SYS_ACOSL = 0x634 + SYS_ASINF = 0x635 + SYS_ASINL = 0x636 + SYS_ATAN2F = 0x637 + SYS_ATAN2L = 0x638 + SYS_ATANF = 0x639 + SYS_COSHL = 0x640 + SYS_EXPF = 0x641 + SYS_EXPL = 0x642 + SYS_TANHF = 0x643 + SYS_TANHL = 0x644 + SYS_LOG10F = 0x645 + SYS_LOG10L = 0x646 + SYS_LOGF = 0x647 + SYS_LOGL = 0x648 + SYS_POWF = 0x649 + SYS_SINHL = 0x650 + SYS_TANF = 0x651 + SYS_TANL = 0x652 + SYS_FABSF = 0x653 + SYS_FABSL = 0x654 + SYS_FLOORF = 0x655 + SYS_FLOORL = 0x656 + SYS_FMODF = 0x657 + SYS_FMODL = 0x658 + SYS_FREXPF = 0x659 + SYS___CHATTR = 0x660 + SYS___FCHATTR = 0x661 + SYS___TOCCSID = 0x662 + SYS___CSNAMETYPE = 0x663 + SYS___TOCSNAME = 0x664 + SYS___CCSIDTYPE = 0x665 + SYS___AE_CORRESTBL_QUERY = 0x666 + SYS___AE_AUTOCONVERT_STATE = 0x667 + SYS_DN_FIND = 0x668 + SYS___GETHOSTBYADDR_A = 0x669 + SYS___MBLEN_SB_A = 0x670 + SYS___MBLEN_STD_A = 0x671 + SYS___MBLEN_UTF = 0x672 + SYS___MBSTOWCS_A = 0x673 + SYS___MBSTOWCS_STD_A = 0x674 + SYS___MBTOWC_A = 0x675 + SYS___MBTOWC_ISO1 = 0x676 + SYS___MBTOWC_SBCS = 0x677 + SYS___MBTOWC_MBCS = 0x678 + SYS___MBTOWC_UTF = 0x679 + SYS___CSID_A = 0x680 + SYS___CSID_STD_A = 0x681 + SYS___WCSID_A = 0x682 + SYS___WCSID_STD_A = 0x683 + SYS___WCTOMB_A = 0x684 + SYS___WCTOMB_ISO1 = 0x685 + SYS___WCTOMB_STD_A = 0x686 + SYS___WCTOMB_UTF = 0x687 + SYS___WCWIDTH_A = 0x688 + SYS___GETGRNAM_R_A = 0x689 + SYS___READDIR_R_A = 0x690 + SYS___E2A_S = 0x691 + SYS___FNMATCH_A = 0x692 + SYS___FNMATCH_C_A = 0x693 + SYS___EXECL_A = 0x694 + SYS___FNMATCH_STD_A = 0x695 + SYS___REGCOMP_A = 0x696 + SYS___REGCOMP_STD_A = 0x697 + SYS___REGERROR_A = 0x698 + SYS___REGERROR_STD_A = 0x699 + SYS___SWPRINTF_A = 0x700 + SYS___FSCANF_A = 0x701 + SYS___SCANF_A = 0x702 + SYS___SSCANF_A = 0x703 + SYS___SWSCANF_A = 0x704 + SYS___ATOF_A = 0x705 + SYS___ATOI_A = 0x706 + SYS___ATOL_A = 0x707 + SYS___STRTOD_A = 0x708 + SYS___STRTOL_A = 0x709 + SYS___L64A_A = 0x710 + SYS___STRERROR_A = 0x711 + SYS___PERROR_A = 0x712 + SYS___FETCH_A = 0x713 + SYS___GETENV_A = 0x714 + SYS___MKSTEMP_A = 0x717 + SYS___PTSNAME_A = 0x718 + SYS___PUTENV_A = 0x719 + SYS___CHDIR_A = 0x720 + SYS___CHOWN_A = 0x721 + SYS___CHROOT_A = 0x722 + SYS___GETCWD_A = 0x723 + SYS___GETWD_A = 0x724 + SYS___LCHOWN_A = 0x725 + SYS___LINK_A = 0x726 + SYS___PATHCONF_A = 0x727 + SYS___IF_NAMEINDEX_A = 0x728 + SYS___READLINK_A = 0x729 + SYS___EXTLINK_NP_A = 0x730 + SYS___ISALNUM_A = 0x731 + SYS___ISALPHA_A = 0x732 + SYS___A2E_S = 0x733 + SYS___ISCNTRL_A = 0x734 + SYS___ISDIGIT_A = 0x735 + SYS___ISGRAPH_A = 0x736 + SYS___ISLOWER_A = 0x737 + SYS___ISPRINT_A = 0x738 + SYS___ISPUNCT_A = 0x739 + SYS___ISWALPHA_A = 0x740 + SYS___A2E_L = 0x741 + SYS___ISWCNTRL_A = 0x742 + SYS___ISWDIGIT_A = 0x743 + SYS___ISWGRAPH_A = 0x744 + SYS___ISWLOWER_A = 0x745 + SYS___ISWPRINT_A = 0x746 + SYS___ISWPUNCT_A = 0x747 + SYS___ISWSPACE_A = 0x748 + SYS___ISWUPPER_A = 0x749 + SYS___REMOVE_A = 0x750 + SYS___RENAME_A = 0x751 + SYS___TMPNAM_A = 0x752 + SYS___FOPEN_A = 0x753 + SYS___FREOPEN_A = 0x754 + SYS___CUSERID_A = 0x755 + SYS___POPEN_A = 0x756 + SYS___TEMPNAM_A = 0x757 + SYS___FTW_A = 0x758 + SYS___GETGRENT_A = 0x759 + SYS___INET_NTOP_A = 0x760 + SYS___GETPASS_A = 0x761 + SYS___GETPWENT_A = 0x762 + SYS___GETPWNAM_A = 0x763 + SYS___GETPWUID_A = 0x764 + SYS_____CHECK_RESOURCE_AUTH_NP_A = 0x765 + SYS___CHECKSCHENV_A = 0x766 + SYS___CONNECTSERVER_A = 0x767 + SYS___CONNECTWORKMGR_A = 0x768 + SYS_____CONSOLE_A = 0x769 + SYS___MSGSND_A = 0x770 + SYS___MSGXRCV_A = 0x771 + SYS___NFTW_A = 0x772 + SYS_____PASSWD_A = 0x773 + SYS___PTHREAD_SECURITY_NP_A = 0x774 + SYS___QUERYMETRICS_A = 0x775 + SYS___QUERYSCHENV = 0x776 + SYS___READV_A = 0x777 + SYS_____SERVER_CLASSIFY_A = 0x778 + SYS_____SERVER_INIT_A = 0x779 + SYS___W_GETPSENT_A = 0x780 + SYS___WRITEV_A = 0x781 + SYS___W_STATFS_A = 0x782 + SYS___W_STATVFS_A = 0x783 + SYS___FPUTC_A = 0x784 + SYS___PUTCHAR_A = 0x785 + SYS___PUTS_A = 0x786 + SYS___FGETS_A = 0x787 + SYS___GETS_A = 0x788 + SYS___FPUTS_A = 0x789 + SYS___PUTC_A = 0x790 + SYS___AE_THREAD_SETMODE = 0x791 + SYS___AE_THREAD_SWAPMODE = 0x792 + SYS___GETNETBYADDR_A = 0x793 + SYS___GETNETBYNAME_A = 0x794 + SYS___GETNETENT_A = 0x795 + SYS___GETPROTOBYNAME_A = 0x796 + SYS___GETPROTOBYNUMBER_A = 0x797 + SYS___GETPROTOENT_A = 0x798 + SYS___GETSERVBYNAME_A = 0x799 + SYS_ACL_FIRST_ENTRY = 0x800 + SYS_ACL_GET_ENTRY = 0x801 + SYS_ACL_VALID = 0x802 + SYS_ACL_CREATE_ENTRY = 0x803 + SYS_ACL_DELETE_ENTRY = 0x804 + SYS_ACL_UPDATE_ENTRY = 0x805 + SYS_ACL_DELETE_FD = 0x806 + SYS_ACL_DELETE_FILE = 0x807 + SYS_ACL_GET_FD = 0x808 + SYS_ACL_GET_FILE = 0x809 + SYS___ERFL_B = 0x810 + SYS___ERFCL_B = 0x811 + SYS___LGAMMAL_B = 0x812 + SYS___SETHOOKEVENTS = 0x813 + SYS_IF_NAMETOINDEX = 0x814 + SYS_IF_INDEXTONAME = 0x815 + SYS_IF_NAMEINDEX = 0x816 + SYS_IF_FREENAMEINDEX = 0x817 + SYS_GETADDRINFO = 0x818 + SYS_GETNAMEINFO = 0x819 + SYS___DYNFREE_A = 0x820 + SYS___RES_QUERY_A = 0x821 + SYS___RES_SEARCH_A = 0x822 + SYS___RES_QUERYDOMAIN_A = 0x823 + SYS___RES_MKQUERY_A = 0x824 + SYS___RES_SEND_A = 0x825 + SYS___DN_EXPAND_A = 0x826 + SYS___DN_SKIPNAME_A = 0x827 + SYS___DN_COMP_A = 0x828 + SYS___DN_FIND_A = 0x829 + SYS___INET_NTOA_A = 0x830 + SYS___INET_NETWORK_A = 0x831 + SYS___ACCEPT_A = 0x832 + SYS___ACCEPT_AND_RECV_A = 0x833 + SYS___BIND_A = 0x834 + SYS___CONNECT_A = 0x835 + SYS___GETPEERNAME_A = 0x836 + SYS___GETSOCKNAME_A = 0x837 + SYS___RECVFROM_A = 0x838 + SYS___SENDTO_A = 0x839 + SYS___LCHATTR = 0x840 + SYS___WRITEDOWN = 0x841 + SYS_PTHREAD_MUTEX_INIT2 = 0x842 + SYS___ACOSHF_B = 0x843 + SYS___ACOSHL_B = 0x844 + SYS___ASINHF_B = 0x845 + SYS___ASINHL_B = 0x846 + SYS___ATANHF_B = 0x847 + SYS___ATANHL_B = 0x848 + SYS___CBRTF_B = 0x849 + SYS___EXP2F_B = 0x850 + SYS___EXP2L_B = 0x851 + SYS___EXPM1F_B = 0x852 + SYS___EXPM1L_B = 0x853 + SYS___FDIMF_B = 0x854 + SYS___FDIM_B = 0x855 + SYS___FDIML_B = 0x856 + SYS___HYPOTF_B = 0x857 + SYS___HYPOTL_B = 0x858 + SYS___LOG1PF_B = 0x859 + SYS___REMQUOF_B = 0x860 + SYS___REMQUO_B = 0x861 + SYS___REMQUOL_B = 0x862 + SYS___TGAMMAF_B = 0x863 + SYS___TGAMMA_B = 0x864 + SYS___TGAMMAL_B = 0x865 + SYS___TRUNCF_B = 0x866 + SYS___TRUNC_B = 0x867 + SYS___TRUNCL_B = 0x868 + SYS___LGAMMAF_B = 0x869 + SYS_ASINHF = 0x870 + SYS_ASINHL = 0x871 + SYS_ATANHF = 0x872 + SYS_ATANHL = 0x873 + SYS_CBRTF = 0x874 + SYS_CBRTL = 0x875 + SYS_COPYSIGNF = 0x876 + SYS_CPYSIGNF = 0x876 + SYS_COPYSIGNL = 0x877 + SYS_CPYSIGNL = 0x877 + SYS_COTANF = 0x878 + SYS___COTANF = 0x878 + SYS_COTAN = 0x879 + SYS___COTAN = 0x879 + SYS_FDIM = 0x881 + SYS_FDIML = 0x882 + SYS_HYPOTF = 0x883 + SYS_HYPOTL = 0x884 + SYS_LOG1PF = 0x885 + SYS_LOG1PL = 0x886 + SYS_LOG2F = 0x887 + SYS_LOG2 = 0x888 + SYS_LOG2L = 0x889 + SYS_TGAMMA = 0x890 + SYS_TGAMMAL = 0x891 + SYS_TRUNCF = 0x892 + SYS_TRUNC = 0x893 + SYS_TRUNCL = 0x894 + SYS_LGAMMAF = 0x895 + SYS_LGAMMAL = 0x896 + SYS_LROUNDF = 0x897 + SYS_LROUND = 0x898 + SYS_ERFF = 0x899 + SYS___COSHF_H = 0x900 + SYS___COSHL_H = 0x901 + SYS___COTAN_H = 0x902 + SYS___COTANF_H = 0x903 + SYS___COTANL_H = 0x904 + SYS___ERF_H = 0x905 + SYS___ERFF_H = 0x906 + SYS___ERFL_H = 0x907 + SYS___ERFC_H = 0x908 + SYS___ERFCF_H = 0x909 + SYS___FDIMF_H = 0x910 + SYS___FDIML_H = 0x911 + SYS___FMOD_H = 0x912 + SYS___FMODF_H = 0x913 + SYS___FMODL_H = 0x914 + SYS___GAMMA_H = 0x915 + SYS___HYPOT_H = 0x916 + SYS___ILOGB_H = 0x917 + SYS___LGAMMA_H = 0x918 + SYS___LGAMMAF_H = 0x919 + SYS___LOG2L_H = 0x920 + SYS___LOG1P_H = 0x921 + SYS___LOG10_H = 0x922 + SYS___LOG10F_H = 0x923 + SYS___LOG10L_H = 0x924 + SYS___LROUND_H = 0x925 + SYS___LROUNDF_H = 0x926 + SYS___NEXTAFTER_H = 0x927 + SYS___POW_H = 0x928 + SYS___POWF_H = 0x929 + SYS___SINL_H = 0x930 + SYS___SINH_H = 0x931 + SYS___SINHF_H = 0x932 + SYS___SINHL_H = 0x933 + SYS___SQRT_H = 0x934 + SYS___SQRTF_H = 0x935 + SYS___SQRTL_H = 0x936 + SYS___TAN_H = 0x937 + SYS___TANF_H = 0x938 + SYS___TANL_H = 0x939 + SYS___TRUNCF_H = 0x940 + SYS___TRUNCL_H = 0x941 + SYS___COSH_H = 0x942 + SYS___LE_DEBUG_SET_RESUME_MCH = 0x943 + SYS_VFSCANF = 0x944 + SYS_VSCANF = 0x946 + SYS_VSSCANF = 0x948 + SYS_IMAXABS = 0x950 + SYS_IMAXDIV = 0x951 + SYS_STRTOIMAX = 0x952 + SYS_STRTOUMAX = 0x953 + SYS_WCSTOIMAX = 0x954 + SYS_WCSTOUMAX = 0x955 + SYS_ATOLL = 0x956 + SYS_STRTOF = 0x957 + SYS_STRTOLD = 0x958 + SYS_WCSTOF = 0x959 + SYS_INET6_RTH_GETADDR = 0x960 + SYS_INET6_OPT_INIT = 0x961 + SYS_INET6_OPT_APPEND = 0x962 + SYS_INET6_OPT_FINISH = 0x963 + SYS_INET6_OPT_SET_VAL = 0x964 + SYS_INET6_OPT_NEXT = 0x965 + SYS_INET6_OPT_FIND = 0x966 + SYS_INET6_OPT_GET_VAL = 0x967 + SYS___POW_I = 0x987 + SYS___POW_I_B = 0x988 + SYS___POW_I_H = 0x989 + SYS___CABS_H = 0x990 + SYS_CABSF = 0x991 + SYS___CABSF_B = 0x992 + SYS___CABSF_H = 0x993 + SYS_CABSL = 0x994 + SYS___CABSL_B = 0x995 + SYS___CABSL_H = 0x996 + SYS_CACOS = 0x997 + SYS___CACOS_B = 0x998 + SYS___CACOS_H = 0x999 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go index 2c1f815e6f..7a8161c1d1 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go @@ -1,6 +1,7 @@ // cgo -godefs types_aix.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc && aix // +build ppc,aix package unix @@ -219,6 +220,7 @@ const ( SizeofSockaddrUnix = 0x401 SizeofSockaddrDatalink = 0x80 SizeofLinger = 0x8 + SizeofIovec = 0x8 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofIPv6MTUInfo = 0x20 diff --git a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go index b4a069ecbd..07ed733c51 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go @@ -1,6 +1,7 @@ // cgo -godefs types_aix.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && aix // +build ppc64,aix package unix @@ -223,6 +224,7 @@ const ( SizeofSockaddrUnix = 0x401 SizeofSockaddrDatalink = 0x80 SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofIPv6MTUInfo = 0x20 diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go deleted file mode 100644 index 9f47b87c50..0000000000 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go +++ /dev/null @@ -1,499 +0,0 @@ -// cgo -godefs types_darwin.go | go run mkpost.go -// Code generated by the command above; see README.md. DO NOT EDIT. - -// +build 386,darwin - -package unix - -const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int32 - _C_long_long int64 -) - -type Timespec struct { - Sec int32 - Nsec int32 -} - -type Timeval struct { - Sec int32 - Usec int32 -} - -type Timeval32 struct{} - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int32 - Ixrss int32 - Idrss int32 - Isrss int32 - Minflt int32 - Majflt int32 - Nswap int32 - Inblock int32 - Oublock int32 - Msgsnd int32 - Msgrcv int32 - Nsignals int32 - Nvcsw int32 - Nivcsw int32 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 -} - -type Statfs_t struct { - Bsize uint32 - Iosize int32 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Owner uint32 - Type uint32 - Flags uint32 - Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 - Reserved [8]uint32 -} - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 -} - -type Fstore_t struct { - Flags uint32 - Posmode int32 - Offset int64 - Length int64 - Bytesalloc int64 -} - -type Radvisory_t struct { - Offset int64 - Count int32 -} - -type Fbootstraptransfer_t struct { - Offset int64 - Length uint32 - Buffer *byte -} - -type Log2phys_t struct { - Flags uint32 - Contigbytes int64 - Devoffset int64 -} - -type Fsid struct { - Val [2]int32 -} - -type Dirent struct { - Ino uint64 - Seekoff uint64 - Reclen uint16 - Namlen uint16 - Type uint8 - Name [1024]int8 - _ [3]byte -} - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint32 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Iov *Iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet4Pktinfo struct { - Ifindex uint32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint32 - Filter int16 - Flags uint16 - Fflags uint32 - Data int32 - Udata *byte -} - -type FdSet struct { - Bits [32]int32 -} - -const ( - SizeofIfMsghdr = 0x70 - SizeofIfData = 0x60 - SizeofIfaMsghdr = 0x14 - SizeofIfmaMsghdr = 0x10 - SizeofIfmaMsghdr2 = 0x14 - SizeofRtMsghdr = 0x5c - SizeofRtMetrics = 0x38 -) - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data IfData -} - -type IfData struct { - Type uint8 - Typelen uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Recvquota uint8 - Xmitquota uint8 - Unused1 uint8 - Mtu uint32 - Metric uint32 - Baudrate uint32 - Ipackets uint32 - Ierrors uint32 - Opackets uint32 - Oerrors uint32 - Collisions uint32 - Ibytes uint32 - Obytes uint32 - Imcasts uint32 - Omcasts uint32 - Iqdrops uint32 - Noproto uint32 - Recvtiming uint32 - Xmittiming uint32 - Lastchange Timeval - Unused2 uint32 - Hwassist uint32 - Reserved1 uint32 - Reserved2 uint32 -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Metric int32 -} - -type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte -} - -type IfmaMsghdr2 struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Refcount int32 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - _ [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Use int32 - Inits uint32 - Rmx RtMetrics -} - -type RtMetrics struct { - Locks uint32 - Mtu uint32 - Hopcount uint32 - Expire int32 - Recvpipe uint32 - Sendpipe uint32 - Ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Pksent uint32 - Filler [4]uint32 -} - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x8 - SizeofBpfProgram = 0x8 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint32 - Drop uint32 -} - -type BpfProgram struct { - Len uint32 - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [2]byte -} - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} - -const ( - AT_FDCWD = -0x2 - AT_REMOVEDIR = 0x80 - AT_SYMLINK_FOLLOW = 0x40 - AT_SYMLINK_NOFOLLOW = 0x20 -) - -type PollFd struct { - Fd int32 - Events int16 - Revents int16 -} - -const ( - POLLERR = 0x8 - POLLHUP = 0x10 - POLLIN = 0x1 - POLLNVAL = 0x20 - POLLOUT = 0x4 - POLLPRI = 0x2 - POLLRDBAND = 0x80 - POLLRDNORM = 0x40 - POLLWRBAND = 0x100 - POLLWRNORM = 0x4 -) - -type Utsname struct { - Sysname [256]byte - Nodename [256]byte - Release [256]byte - Version [256]byte - Machine [256]byte -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go index 966798a870..7efe5ccba3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_darwin.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && darwin // +build amd64,darwin package unix @@ -70,7 +71,6 @@ type Stat_t struct { Uid uint32 Gid uint32 Rdev int32 - _ [4]byte Atim Timespec Mtim Timespec Ctim Timespec @@ -97,10 +97,11 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 - Reserved [8]uint32 + Fstypename [16]byte + Mntonname [1024]byte + Mntfromname [1024]byte + Flags_ext uint32 + Reserved [7]uint32 } type Flock_t struct { @@ -133,8 +134,7 @@ type Fbootstraptransfer_t struct { type Log2phys_t struct { Flags uint32 - _ [8]byte - _ [8]byte + _ [16]byte } type Fsid struct { @@ -151,6 +151,10 @@ type Dirent struct { _ [3]byte } +const ( + PathMax = 0x400 +) + type RawSockaddrInet4 struct { Len uint8 Family uint8 @@ -196,8 +200,110 @@ type RawSockaddrAny struct { Pad [92]int8 } +type RawSockaddrCtl struct { + Sc_len uint8 + Sc_family uint8 + Ss_sysaddr uint16 + Sc_id uint32 + Sc_unit uint32 + Sc_reserved [5]uint32 +} + +type RawSockaddrVM struct { + Len uint8 + Family uint8 + Reserved1 uint16 + Port uint32 + Cid uint32 +} + +type XVSockPCB struct { + Xv_len uint32 + Xv_vsockpp uint64 + Xvp_local_cid uint32 + Xvp_local_port uint32 + Xvp_remote_cid uint32 + Xvp_remote_port uint32 + Xvp_rxcnt uint32 + Xvp_txcnt uint32 + Xvp_peer_rxhiwat uint32 + Xvp_peer_rxcnt uint32 + Xvp_last_pid int32 + Xvp_gencnt uint64 + Xv_socket XSocket + _ [4]byte +} + +type XSocket struct { + Xso_len uint32 + Xso_so uint32 + So_type int16 + So_options int16 + So_linger int16 + So_state int16 + So_pcb uint32 + Xso_protocol int32 + Xso_family int32 + So_qlen int16 + So_incqlen int16 + So_qlimit int16 + So_timeo int16 + So_error uint16 + So_pgid int32 + So_oobmark uint32 + So_rcv XSockbuf + So_snd XSockbuf + So_uid uint32 +} + +type XSocket64 struct { + Xso_len uint32 + _ [8]byte + So_type int16 + So_options int16 + So_linger int16 + So_state int16 + _ [8]byte + Xso_protocol int32 + Xso_family int32 + So_qlen int16 + So_incqlen int16 + So_qlimit int16 + So_timeo int16 + So_error uint16 + So_pgid int32 + So_oobmark uint32 + So_rcv XSockbuf + So_snd XSockbuf + So_uid uint32 +} + +type XSockbuf struct { + Cc uint32 + Hiwat uint32 + Mbcnt uint32 + Mbmax uint32 + Lowat int32 + Flags int16 + Timeo int16 +} + +type XVSockPgen struct { + Len uint32 + Count uint64 + Gen uint64 + Sogen uint64 +} + type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + type Linger struct { Onoff int32 Linger int32 @@ -213,6 +319,12 @@ type IPMreq struct { Interface [4]byte /* in_addr */ } +type IPMreqn struct { + Multiaddr [4]byte /* in_addr */ + Address [4]byte /* in_addr */ + Ifindex int32 +} + type IPv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Interface uint32 @@ -221,10 +333,8 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen int32 - _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -262,8 +372,17 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 + SizeofSockaddrCtl = 0x20 + SizeofSockaddrVM = 0xc + SizeofXvsockpcb = 0xa8 + SizeofXSocket = 0x64 + SizeofXSockbuf = 0x18 + SizeofXVSockPgen = 0x20 + SizeofXucred = 0x4c SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 SizeofCmsghdr = 0xc @@ -309,7 +428,6 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Data IfData } @@ -352,7 +470,6 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Metric int32 } @@ -373,7 +490,6 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Refcount int32 } @@ -382,7 +498,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -404,7 +519,8 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - Filler [4]uint32 + State uint32 + Filler [3]uint32 } const ( @@ -427,7 +543,6 @@ type BpfStat struct { type BpfProgram struct { Len uint32 - _ [4]byte Insns *BpfInsn } @@ -452,7 +567,6 @@ type Termios struct { Cflag uint64 Lflag uint64 Cc [20]uint8 - _ [4]byte Ispeed uint64 Ospeed uint64 } @@ -507,3 +621,148 @@ type Clockinfo struct { Stathz int32 Profhz int32 } + +type CtlInfo struct { + Id uint32 + Name [96]byte +} + +const SizeofKinfoProc = 0x288 + +type Eproc struct { + Paddr uintptr + Sess uintptr + Pcred Pcred + Ucred Ucred + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Tdev int32 + Tpgid int32 + Tsess uintptr + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Flag int32 + Login [12]int8 + Spare [4]int32 + _ [4]byte +} + +type ExternProc struct { + P_starttime Timeval + P_vmspace *Vmspace + P_sigacts uintptr + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + User_stack *int8 + Exit_thread *byte + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + P_wchan *byte + P_wmesg *int8 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + P_tracep uintptr + P_siglist int32 + P_textvp uintptr + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + P_pgrp uintptr + P_addr uintptr + P_xstat uint16 + P_acflag uint16 + P_ru *Rusage +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Vmspace struct { + Dummy int32 + Dummy2 *int8 + Dummy3 [5]int32 + Dummy4 [3]*int8 +} + +type Pcred struct { + Pc_lock [72]int8 + Pc_ucred uintptr + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + _ [4]byte +} + +type Ucred struct { + Ref int32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + +type SysvIpcPerm struct { + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ uint16 + _ int32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Lpid int32 + Cpid int32 + Nattch uint16 + _ [34]byte +} + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go deleted file mode 100644 index 4fe4c9cd73..0000000000 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go +++ /dev/null @@ -1,500 +0,0 @@ -// NOTE: cgo can't generate struct Stat_t and struct Statfs_t yet -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_darwin.go - -// +build arm,darwin - -package unix - -const ( - SizeofPtr = 0x4 - SizeofShort = 0x2 - SizeofInt = 0x4 - SizeofLong = 0x4 - SizeofLongLong = 0x8 -) - -type ( - _C_short int16 - _C_int int32 - _C_long int32 - _C_long_long int64 -) - -type Timespec struct { - Sec int32 - Nsec int32 -} - -type Timeval struct { - Sec int32 - Usec int32 -} - -type Timeval32 [0]byte - -type Rusage struct { - Utime Timeval - Stime Timeval - Maxrss int32 - Ixrss int32 - Idrss int32 - Isrss int32 - Minflt int32 - Majflt int32 - Nswap int32 - Inblock int32 - Oublock int32 - Msgsnd int32 - Msgrcv int32 - Nsignals int32 - Nvcsw int32 - Nivcsw int32 -} - -type Rlimit struct { - Cur uint64 - Max uint64 -} - -type _Gid_t uint32 - -type Stat_t struct { - Dev int32 - Mode uint16 - Nlink uint16 - Ino uint64 - Uid uint32 - Gid uint32 - Rdev int32 - Atim Timespec - Mtim Timespec - Ctim Timespec - Btim Timespec - Size int64 - Blocks int64 - Blksize int32 - Flags uint32 - Gen uint32 - Lspare int32 - Qspare [2]int64 -} - -type Statfs_t struct { - Bsize uint32 - Iosize int32 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Owner uint32 - Type uint32 - Flags uint32 - Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 - Reserved [8]uint32 -} - -type Flock_t struct { - Start int64 - Len int64 - Pid int32 - Type int16 - Whence int16 -} - -type Fstore_t struct { - Flags uint32 - Posmode int32 - Offset int64 - Length int64 - Bytesalloc int64 -} - -type Radvisory_t struct { - Offset int64 - Count int32 -} - -type Fbootstraptransfer_t struct { - Offset int64 - Length uint32 - Buffer *byte -} - -type Log2phys_t struct { - Flags uint32 - Contigbytes int64 - Devoffset int64 -} - -type Fsid struct { - Val [2]int32 -} - -type Dirent struct { - Ino uint64 - Seekoff uint64 - Reclen uint16 - Namlen uint16 - Type uint8 - Name [1024]int8 - _ [3]byte -} - -type RawSockaddrInet4 struct { - Len uint8 - Family uint8 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]int8 -} - -type RawSockaddrInet6 struct { - Len uint8 - Family uint8 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddrUnix struct { - Len uint8 - Family uint8 - Path [104]int8 -} - -type RawSockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -type RawSockaddr struct { - Len uint8 - Family uint8 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [92]int8 -} - -type _Socklen uint32 - -type Linger struct { - Onoff int32 - Linger int32 -} - -type Iovec struct { - Base *byte - Len uint32 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Msghdr struct { - Name *byte - Namelen uint32 - Iov *Iovec - Iovlen int32 - Control *byte - Controllen uint32 - Flags int32 -} - -type Cmsghdr struct { - Len uint32 - Level int32 - Type int32 -} - -type Inet4Pktinfo struct { - Ifindex uint32 - Spec_dst [4]byte /* in_addr */ - Addr [4]byte /* in_addr */ -} - -type Inet6Pktinfo struct { - Addr [16]byte /* in6_addr */ - Ifindex uint32 -} - -type IPv6MTUInfo struct { - Addr RawSockaddrInet6 - Mtu uint32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -const ( - SizeofSockaddrInet4 = 0x10 - SizeofSockaddrInet6 = 0x1c - SizeofSockaddrAny = 0x6c - SizeofSockaddrUnix = 0x6a - SizeofSockaddrDatalink = 0x14 - SizeofLinger = 0x8 - SizeofIPMreq = 0x8 - SizeofIPv6Mreq = 0x14 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc - SizeofInet4Pktinfo = 0xc - SizeofInet6Pktinfo = 0x14 - SizeofIPv6MTUInfo = 0x20 - SizeofICMPv6Filter = 0x20 -) - -const ( - PTRACE_TRACEME = 0x0 - PTRACE_CONT = 0x7 - PTRACE_KILL = 0x8 -) - -type Kevent_t struct { - Ident uint32 - Filter int16 - Flags uint16 - Fflags uint32 - Data int32 - Udata *byte -} - -type FdSet struct { - Bits [32]int32 -} - -const ( - SizeofIfMsghdr = 0x70 - SizeofIfData = 0x60 - SizeofIfaMsghdr = 0x14 - SizeofIfmaMsghdr = 0x10 - SizeofIfmaMsghdr2 = 0x14 - SizeofRtMsghdr = 0x5c - SizeofRtMetrics = 0x38 -) - -type IfMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Data IfData -} - -type IfData struct { - Type uint8 - Typelen uint8 - Physical uint8 - Addrlen uint8 - Hdrlen uint8 - Recvquota uint8 - Xmitquota uint8 - Unused1 uint8 - Mtu uint32 - Metric uint32 - Baudrate uint32 - Ipackets uint32 - Ierrors uint32 - Opackets uint32 - Oerrors uint32 - Collisions uint32 - Ibytes uint32 - Obytes uint32 - Imcasts uint32 - Omcasts uint32 - Iqdrops uint32 - Noproto uint32 - Recvtiming uint32 - Xmittiming uint32 - Lastchange Timeval - Unused2 uint32 - Hwassist uint32 - Reserved1 uint32 - Reserved2 uint32 -} - -type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Metric int32 -} - -type IfmaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte -} - -type IfmaMsghdr2 struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Refcount int32 -} - -type RtMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Index uint16 - _ [2]byte - Flags int32 - Addrs int32 - Pid int32 - Seq int32 - Errno int32 - Use int32 - Inits uint32 - Rmx RtMetrics -} - -type RtMetrics struct { - Locks uint32 - Mtu uint32 - Hopcount uint32 - Expire int32 - Recvpipe uint32 - Sendpipe uint32 - Ssthresh uint32 - Rtt uint32 - Rttvar uint32 - Pksent uint32 - Filler [4]uint32 -} - -const ( - SizeofBpfVersion = 0x4 - SizeofBpfStat = 0x8 - SizeofBpfProgram = 0x8 - SizeofBpfInsn = 0x8 - SizeofBpfHdr = 0x14 -) - -type BpfVersion struct { - Major uint16 - Minor uint16 -} - -type BpfStat struct { - Recv uint32 - Drop uint32 -} - -type BpfProgram struct { - Len uint32 - Insns *BpfInsn -} - -type BpfInsn struct { - Code uint16 - Jt uint8 - Jf uint8 - K uint32 -} - -type BpfHdr struct { - Tstamp Timeval - Caplen uint32 - Datalen uint32 - Hdrlen uint16 - _ [2]byte -} - -type Termios struct { - Iflag uint32 - Oflag uint32 - Cflag uint32 - Lflag uint32 - Cc [20]uint8 - Ispeed uint32 - Ospeed uint32 -} - -type Winsize struct { - Row uint16 - Col uint16 - Xpixel uint16 - Ypixel uint16 -} - -const ( - AT_FDCWD = -0x2 - AT_REMOVEDIR = 0x80 - AT_SYMLINK_FOLLOW = 0x40 - AT_SYMLINK_NOFOLLOW = 0x20 -) - -type PollFd struct { - Fd int32 - Events int16 - Revents int16 -} - -const ( - POLLERR = 0x8 - POLLHUP = 0x10 - POLLIN = 0x1 - POLLNVAL = 0x20 - POLLOUT = 0x4 - POLLPRI = 0x2 - POLLRDBAND = 0x80 - POLLRDNORM = 0x40 - POLLWRBAND = 0x100 - POLLWRNORM = 0x4 -) - -type Utsname struct { - Sysname [256]byte - Nodename [256]byte - Release [256]byte - Version [256]byte - Machine [256]byte -} - -const SizeofClockinfo = 0x14 - -type Clockinfo struct { - Hz int32 - Tick int32 - Tickadj int32 - Stathz int32 - Profhz int32 -} diff --git a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go index 21999e4b0a..b23a2efe81 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs types_darwin.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && darwin // +build arm64,darwin package unix @@ -70,7 +71,6 @@ type Stat_t struct { Uid uint32 Gid uint32 Rdev int32 - _ [4]byte Atim Timespec Mtim Timespec Ctim Timespec @@ -97,10 +97,11 @@ type Statfs_t struct { Type uint32 Flags uint32 Fssubtype uint32 - Fstypename [16]int8 - Mntonname [1024]int8 - Mntfromname [1024]int8 - Reserved [8]uint32 + Fstypename [16]byte + Mntonname [1024]byte + Mntfromname [1024]byte + Flags_ext uint32 + Reserved [7]uint32 } type Flock_t struct { @@ -133,8 +134,7 @@ type Fbootstraptransfer_t struct { type Log2phys_t struct { Flags uint32 - _ [8]byte - _ [8]byte + _ [16]byte } type Fsid struct { @@ -151,6 +151,10 @@ type Dirent struct { _ [3]byte } +const ( + PathMax = 0x400 +) + type RawSockaddrInet4 struct { Len uint8 Family uint8 @@ -196,8 +200,110 @@ type RawSockaddrAny struct { Pad [92]int8 } +type RawSockaddrCtl struct { + Sc_len uint8 + Sc_family uint8 + Ss_sysaddr uint16 + Sc_id uint32 + Sc_unit uint32 + Sc_reserved [5]uint32 +} + +type RawSockaddrVM struct { + Len uint8 + Family uint8 + Reserved1 uint16 + Port uint32 + Cid uint32 +} + +type XVSockPCB struct { + Xv_len uint32 + Xv_vsockpp uint64 + Xvp_local_cid uint32 + Xvp_local_port uint32 + Xvp_remote_cid uint32 + Xvp_remote_port uint32 + Xvp_rxcnt uint32 + Xvp_txcnt uint32 + Xvp_peer_rxhiwat uint32 + Xvp_peer_rxcnt uint32 + Xvp_last_pid int32 + Xvp_gencnt uint64 + Xv_socket XSocket + _ [4]byte +} + +type XSocket struct { + Xso_len uint32 + Xso_so uint32 + So_type int16 + So_options int16 + So_linger int16 + So_state int16 + So_pcb uint32 + Xso_protocol int32 + Xso_family int32 + So_qlen int16 + So_incqlen int16 + So_qlimit int16 + So_timeo int16 + So_error uint16 + So_pgid int32 + So_oobmark uint32 + So_rcv XSockbuf + So_snd XSockbuf + So_uid uint32 +} + +type XSocket64 struct { + Xso_len uint32 + _ [8]byte + So_type int16 + So_options int16 + So_linger int16 + So_state int16 + _ [8]byte + Xso_protocol int32 + Xso_family int32 + So_qlen int16 + So_incqlen int16 + So_qlimit int16 + So_timeo int16 + So_error uint16 + So_pgid int32 + So_oobmark uint32 + So_rcv XSockbuf + So_snd XSockbuf + So_uid uint32 +} + +type XSockbuf struct { + Cc uint32 + Hiwat uint32 + Mbcnt uint32 + Mbmax uint32 + Lowat int32 + Flags int16 + Timeo int16 +} + +type XVSockPgen struct { + Len uint32 + Count uint64 + Gen uint64 + Sogen uint64 +} + type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + type Linger struct { Onoff int32 Linger int32 @@ -213,6 +319,12 @@ type IPMreq struct { Interface [4]byte /* in_addr */ } +type IPMreqn struct { + Multiaddr [4]byte /* in_addr */ + Address [4]byte /* in_addr */ + Ifindex int32 +} + type IPv6Mreq struct { Multiaddr [16]byte /* in6_addr */ Interface uint32 @@ -221,10 +333,8 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen int32 - _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -262,8 +372,17 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 + SizeofSockaddrCtl = 0x20 + SizeofSockaddrVM = 0xc + SizeofXvsockpcb = 0xa8 + SizeofXSocket = 0x64 + SizeofXSockbuf = 0x18 + SizeofXVSockPgen = 0x20 + SizeofXucred = 0x4c SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 + SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 SizeofCmsghdr = 0xc @@ -309,7 +428,6 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Data IfData } @@ -352,7 +470,6 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Metric int32 } @@ -373,7 +490,6 @@ type IfmaMsghdr2 struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Refcount int32 } @@ -382,7 +498,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -404,7 +519,8 @@ type RtMetrics struct { Rtt uint32 Rttvar uint32 Pksent uint32 - Filler [4]uint32 + State uint32 + Filler [3]uint32 } const ( @@ -427,7 +543,6 @@ type BpfStat struct { type BpfProgram struct { Len uint32 - _ [4]byte Insns *BpfInsn } @@ -452,7 +567,6 @@ type Termios struct { Cflag uint64 Lflag uint64 Cc [20]uint8 - _ [4]byte Ispeed uint64 Ospeed uint64 } @@ -507,3 +621,148 @@ type Clockinfo struct { Stathz int32 Profhz int32 } + +type CtlInfo struct { + Id uint32 + Name [96]byte +} + +const SizeofKinfoProc = 0x288 + +type Eproc struct { + Paddr uintptr + Sess uintptr + Pcred Pcred + Ucred Ucred + Vm Vmspace + Ppid int32 + Pgid int32 + Jobc int16 + Tdev int32 + Tpgid int32 + Tsess uintptr + Wmesg [8]int8 + Xsize int32 + Xrssize int16 + Xccount int16 + Xswrss int16 + Flag int32 + Login [12]int8 + Spare [4]int32 + _ [4]byte +} + +type ExternProc struct { + P_starttime Timeval + P_vmspace *Vmspace + P_sigacts uintptr + P_flag int32 + P_stat int8 + P_pid int32 + P_oppid int32 + P_dupfd int32 + User_stack *int8 + Exit_thread *byte + P_debugger int32 + Sigwait int32 + P_estcpu uint32 + P_cpticks int32 + P_pctcpu uint32 + P_wchan *byte + P_wmesg *int8 + P_swtime uint32 + P_slptime uint32 + P_realtimer Itimerval + P_rtime Timeval + P_uticks uint64 + P_sticks uint64 + P_iticks uint64 + P_traceflag int32 + P_tracep uintptr + P_siglist int32 + P_textvp uintptr + P_holdcnt int32 + P_sigmask uint32 + P_sigignore uint32 + P_sigcatch uint32 + P_priority uint8 + P_usrpri uint8 + P_nice int8 + P_comm [17]int8 + P_pgrp uintptr + P_addr uintptr + P_xstat uint16 + P_acflag uint16 + P_ru *Rusage +} + +type Itimerval struct { + Interval Timeval + Value Timeval +} + +type KinfoProc struct { + Proc ExternProc + Eproc Eproc +} + +type Vmspace struct { + Dummy int32 + Dummy2 *int8 + Dummy3 [5]int32 + Dummy4 [3]*int8 +} + +type Pcred struct { + Pc_lock [72]int8 + Pc_ucred uintptr + P_ruid uint32 + P_svuid uint32 + P_rgid uint32 + P_svgid uint32 + P_refcnt int32 + _ [4]byte +} + +type Ucred struct { + Ref int32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 +} + +type SysvIpcPerm struct { + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ uint16 + _ int32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Lpid int32 + Cpid int32 + Nattch uint16 + _ [34]byte +} + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go index 71ea1d6d23..d0ba8e9b86 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_dragonfly.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && dragonfly // +build amd64,dragonfly package unix @@ -70,11 +71,11 @@ type Stat_t struct { Ctim Timespec Size int64 Blocks int64 - Blksize uint32 + _ uint32 Flags uint32 Gen uint32 Lspare int32 - Qspare1 int64 + Blksize int64 Qspare2 int64 } @@ -91,17 +92,15 @@ type Statfs_t struct { Owner uint32 Type int32 Flags int32 - _ [4]byte Syncwrites int64 Asyncwrites int64 - Fstypename [16]int8 - Mntonname [80]int8 + Fstypename [16]byte + Mntonname [80]byte Syncreads int64 Asyncreads int64 Spares1 int16 - Mntfromname [80]int8 + Mntfromname [80]byte Spares2 int16 - _ [4]byte Spare [2]int64 } @@ -202,10 +201,8 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen int32 - _ [4]byte Control *byte Controllen uint32 Flags int32 @@ -238,6 +235,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 @@ -269,7 +267,7 @@ type FdSet struct { const ( SizeofIfMsghdr = 0xb0 SizeofIfData = 0xa0 - SizeofIfaMsghdr = 0x14 + SizeofIfaMsghdr = 0x18 SizeofIfmaMsghdr = 0x10 SizeofIfAnnounceMsghdr = 0x18 SizeofRtMsghdr = 0x98 @@ -280,10 +278,9 @@ type IfMsghdr struct { Msglen uint16 Version uint8 Type uint8 - Addrs int32 - Flags int32 Index uint16 - _ [2]byte + Flags int32 + Addrs int32 Data IfData } @@ -294,7 +291,6 @@ type IfData struct { Hdrlen uint8 Recvquota uint8 Xmitquota uint8 - _ [2]byte Mtu uint64 Metric uint64 Link_state uint64 @@ -316,24 +312,23 @@ type IfData struct { } type IfaMsghdr struct { - Msglen uint16 - Version uint8 - Type uint8 - Addrs int32 - Flags int32 - Index uint16 - _ [2]byte - Metric int32 + Msglen uint16 + Version uint8 + Type uint8 + Index uint16 + Flags int32 + Addrs int32 + Addrflags int32 + Metric int32 } type IfmaMsghdr struct { Msglen uint16 Version uint8 Type uint8 - Addrs int32 - Flags int32 Index uint16 - _ [2]byte + Flags int32 + Addrs int32 } type IfAnnounceMsghdr struct { @@ -350,7 +345,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -374,7 +368,6 @@ type RtMetrics struct { Hopcount uint64 Mssopt uint16 Pad uint16 - _ [4]byte Msl uint64 Iwmaxsegs uint64 Iwcapsegs uint64 @@ -400,7 +393,6 @@ type BpfStat struct { type BpfProgram struct { Len uint32 - _ [4]byte Insns *BpfInsn } @@ -439,6 +431,9 @@ type Winsize struct { const ( AT_FDCWD = 0xfffafdcd AT_SYMLINK_NOFOLLOW = 0x1 + AT_REMOVEDIR = 0x2 + AT_EACCESS = 0x4 + AT_SYMLINK_FOLLOW = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go index 2a3ec615f7..4eec078e52 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -1,6 +1,7 @@ // cgo -godefs types_freebsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && freebsd // +build 386,freebsd package unix @@ -30,6 +31,8 @@ type Timeval struct { Usec int32 } +type Time_t int32 + type Rusage struct { Utime Timeval Stime Timeval @@ -250,6 +253,14 @@ type RawSockaddrAny struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + type Linger struct { Onoff int32 Linger int32 @@ -312,7 +323,9 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x50 SizeofLinger = 0x8 + SizeofIovec = 0x8 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 @@ -661,9 +674,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go index e11e95499e..7622904a53 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_freebsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && freebsd // +build amd64,freebsd package unix @@ -30,6 +31,8 @@ type Timeval struct { Usec int64 } +type Time_t int64 + type Rusage struct { Utime Timeval Stime Timeval @@ -246,6 +249,14 @@ type RawSockaddrAny struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + type Linger struct { Onoff int32 Linger int32 @@ -308,7 +319,9 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x58 SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 @@ -664,9 +677,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go index b91c2ae0f0..19223ce8ec 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_freebsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && freebsd // +build arm,freebsd package unix @@ -32,6 +33,8 @@ type Timeval struct { _ [4]byte } +type Time_t int32 + type Rusage struct { Utime Timeval Stime Timeval @@ -248,6 +251,14 @@ type RawSockaddrAny struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + type Linger struct { Onoff int32 Linger int32 @@ -310,7 +321,9 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x50 SizeofLinger = 0x8 + SizeofIovec = 0x8 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 @@ -645,9 +658,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go index c6fe1d097d..8e3e33f679 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_freebsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && freebsd // +build arm64,freebsd package unix @@ -30,6 +31,8 @@ type Timeval struct { Usec int64 } +type Time_t int64 + type Rusage struct { Utime Timeval Stime Timeval @@ -246,6 +249,14 @@ type RawSockaddrAny struct { type _Socklen uint32 +type Xucred struct { + Version uint32 + Uid uint32 + Ngroups int16 + Groups [16]uint32 + _ *byte +} + type Linger struct { Onoff int32 Linger int32 @@ -308,7 +319,9 @@ const ( SizeofSockaddrAny = 0x6c SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x36 + SizeofXucred = 0x58 SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc SizeofIPv6Mreq = 0x14 @@ -642,9 +655,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_REMOVEDIR = 0x800 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go new file mode 100644 index 0000000000..4c485261d6 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_illumos_amd64.go @@ -0,0 +1,42 @@ +// cgo -godefs types_illumos.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build amd64 && illumos +// +build amd64,illumos + +package unix + +const ( + TUNNEWPPA = 0x540001 + TUNSETPPA = 0x540002 + + I_STR = 0x5308 + I_POP = 0x5303 + I_PUSH = 0x5302 + I_LINK = 0x530c + I_UNLINK = 0x530d + I_PLINK = 0x5316 + I_PUNLINK = 0x5317 + + IF_UNITSEL = -0x7ffb8cca +) + +type strbuf struct { + Maxlen int32 + Len int32 + Buf *int8 +} + +type Strioctl struct { + Cmd int32 + Timout int32 + Len int32 + Dp *int8 +} + +type Lifreq struct { + Name [32]int8 + Lifru1 [4]byte + Type uint32 + Lifru [336]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux.go b/vendor/golang.org/x/sys/unix/ztypes_linux.go index 27d67ac8f5..249ecfcd4c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -1,5 +1,6 @@ // Code generated by mkmerge.go; DO NOT EDIT. +//go:build linux // +build linux package unix @@ -67,13 +68,45 @@ type Statx_t struct { Rdev_minor uint32 Dev_major uint32 Dev_minor uint32 - _ [14]uint64 + Mnt_id uint64 + _ uint64 + _ [12]uint64 } type Fsid struct { Val [2]int32 } +type FileCloneRange struct { + Src_fd int64 + Src_offset uint64 + Src_length uint64 + Dest_offset uint64 +} + +type RawFileDedupeRange struct { + Src_offset uint64 + Src_length uint64 + Dest_count uint16 + Reserved1 uint16 + Reserved2 uint32 +} + +type RawFileDedupeRangeInfo struct { + Dest_fd int64 + Dest_offset uint64 + Bytes_deduped uint64 + Status int32 + Reserved uint32 +} + +const ( + SizeofRawFileDedupeRange = 0x18 + SizeofRawFileDedupeRangeInfo = 0x20 + FILE_DEDUPE_RANGE_SAME = 0x0 + FILE_DEDUPE_RANGE_DIFFERS = 0x1 +) + type FscryptPolicy struct { Version uint8 Contents_encryption_mode uint8 @@ -138,6 +171,48 @@ type FscryptGetKeyStatusArg struct { _ [13]uint32 } +type DmIoctl struct { + Version [3]uint32 + Data_size uint32 + Data_start uint32 + Target_count uint32 + Open_count int32 + Flags uint32 + Event_nr uint32 + _ uint32 + Dev uint64 + Name [128]byte + Uuid [129]byte + Data [7]byte +} + +type DmTargetSpec struct { + Sector_start uint64 + Length uint64 + Status int32 + Next uint32 + Target_type [16]byte +} + +type DmTargetDeps struct { + Count uint32 + _ uint32 +} + +type DmTargetVersions struct { + Next uint32 + Version [3]uint32 +} + +type DmTargetMsg struct { + Sector uint64 +} + +const ( + SizeofDmIoctl = 0x138 + SizeofDmTargetSpec = 0x28 +) + type KeyctlDHParams struct { Private int32 Prime int32 @@ -229,7 +304,8 @@ type RawSockaddrVM struct { Reserved1 uint16 Port uint32 Cid uint32 - Zero [4]uint8 + Flags uint8 + Zero [3]uint8 } type RawSockaddrXDP struct { @@ -266,6 +342,22 @@ type RawSockaddrL2TPIP6 struct { Conn_id uint32 } +type RawSockaddrIUCV struct { + Family uint16 + Port uint16 + Addr uint32 + Nodeid [8]int8 + User_id [8]int8 + Name [8]int8 +} + +type RawSockaddrNFC struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 +} + type _Socklen uint32 type Linger struct { @@ -360,6 +452,11 @@ type CanFilter struct { Mask uint32 } +type TCPRepairOpt struct { + Code uint32 + Val uint32 +} + const ( SizeofSockaddrInet4 = 0x10 SizeofSockaddrInet6 = 0x1c @@ -378,6 +475,8 @@ const ( SizeofSockaddrTIPC = 0x10 SizeofSockaddrL2TPIP = 0x10 SizeofSockaddrL2TPIP6 = 0x20 + SizeofSockaddrIUCV = 0x20 + SizeofSockaddrNFC = 0x10 SizeofLinger = 0x8 SizeofIPMreq = 0x8 SizeofIPMreqn = 0xc @@ -390,169 +489,111 @@ const ( SizeofUcred = 0xc SizeofTCPInfo = 0x68 SizeofCanFilter = 0x8 + SizeofTCPRepairOpt = 0x8 ) const ( - NDA_UNSPEC = 0x0 - NDA_DST = 0x1 - NDA_LLADDR = 0x2 - NDA_CACHEINFO = 0x3 - NDA_PROBES = 0x4 - NDA_VLAN = 0x5 - NDA_PORT = 0x6 - NDA_VNI = 0x7 - NDA_IFINDEX = 0x8 - NDA_MASTER = 0x9 - NDA_LINK_NETNSID = 0xa - NDA_SRC_VNI = 0xb - NTF_USE = 0x1 - NTF_SELF = 0x2 - NTF_MASTER = 0x4 - NTF_PROXY = 0x8 - NTF_EXT_LEARNED = 0x10 - NTF_OFFLOADED = 0x20 - NTF_ROUTER = 0x80 - NUD_INCOMPLETE = 0x1 - NUD_REACHABLE = 0x2 - NUD_STALE = 0x4 - NUD_DELAY = 0x8 - NUD_PROBE = 0x10 - NUD_FAILED = 0x20 - NUD_NOARP = 0x40 - NUD_PERMANENT = 0x80 - NUD_NONE = 0x0 - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFA_FLAGS = 0x8 - IFA_RT_PRIORITY = 0x9 - IFA_TARGET_NETNSID = 0xa - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_NUM_VF = 0x15 - IFLA_VFINFO_LIST = 0x16 - IFLA_STATS64 = 0x17 - IFLA_VF_PORTS = 0x18 - IFLA_PORT_SELF = 0x19 - IFLA_AF_SPEC = 0x1a - IFLA_GROUP = 0x1b - IFLA_NET_NS_FD = 0x1c - IFLA_EXT_MASK = 0x1d - IFLA_PROMISCUITY = 0x1e - IFLA_NUM_TX_QUEUES = 0x1f - IFLA_NUM_RX_QUEUES = 0x20 - IFLA_CARRIER = 0x21 - IFLA_PHYS_PORT_ID = 0x22 - IFLA_CARRIER_CHANGES = 0x23 - IFLA_PHYS_SWITCH_ID = 0x24 - IFLA_LINK_NETNSID = 0x25 - IFLA_PHYS_PORT_NAME = 0x26 - IFLA_PROTO_DOWN = 0x27 - IFLA_GSO_MAX_SEGS = 0x28 - IFLA_GSO_MAX_SIZE = 0x29 - IFLA_PAD = 0x2a - IFLA_XDP = 0x2b - IFLA_EVENT = 0x2c - IFLA_NEW_NETNSID = 0x2d - IFLA_IF_NETNSID = 0x2e - IFLA_TARGET_NETNSID = 0x2e - IFLA_CARRIER_UP_COUNT = 0x2f - IFLA_CARRIER_DOWN_COUNT = 0x30 - IFLA_NEW_IFINDEX = 0x31 - IFLA_MIN_MTU = 0x32 - IFLA_MAX_MTU = 0x33 - IFLA_MAX = 0x36 - IFLA_INFO_KIND = 0x1 - IFLA_INFO_DATA = 0x2 - IFLA_INFO_XSTATS = 0x3 - IFLA_INFO_SLAVE_KIND = 0x4 - IFLA_INFO_SLAVE_DATA = 0x5 - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTA_MARK = 0x10 - RTA_MFC_STATS = 0x11 - RTA_VIA = 0x12 - RTA_NEWDST = 0x13 - RTA_PREF = 0x14 - RTA_ENCAP_TYPE = 0x15 - RTA_ENCAP = 0x16 - RTA_EXPIRES = 0x17 - RTA_PAD = 0x18 - RTA_UID = 0x19 - RTA_TTL_PROPAGATE = 0x1a - RTA_IP_PROTO = 0x1b - RTA_SPORT = 0x1c - RTA_DPORT = 0x1d - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofIfaCacheinfo = 0x10 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 - SizeofNdUseroptmsg = 0x10 - SizeofNdMsg = 0xc + NDA_UNSPEC = 0x0 + NDA_DST = 0x1 + NDA_LLADDR = 0x2 + NDA_CACHEINFO = 0x3 + NDA_PROBES = 0x4 + NDA_VLAN = 0x5 + NDA_PORT = 0x6 + NDA_VNI = 0x7 + NDA_IFINDEX = 0x8 + NDA_MASTER = 0x9 + NDA_LINK_NETNSID = 0xa + NDA_SRC_VNI = 0xb + NTF_USE = 0x1 + NTF_SELF = 0x2 + NTF_MASTER = 0x4 + NTF_PROXY = 0x8 + NTF_EXT_LEARNED = 0x10 + NTF_OFFLOADED = 0x20 + NTF_ROUTER = 0x80 + NUD_INCOMPLETE = 0x1 + NUD_REACHABLE = 0x2 + NUD_STALE = 0x4 + NUD_DELAY = 0x8 + NUD_PROBE = 0x10 + NUD_FAILED = 0x20 + NUD_NOARP = 0x40 + NUD_PERMANENT = 0x80 + NUD_NONE = 0x0 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFA_FLAGS = 0x8 + IFA_RT_PRIORITY = 0x9 + IFA_TARGET_NETNSID = 0xa + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTA_MARK = 0x10 + RTA_MFC_STATS = 0x11 + RTA_VIA = 0x12 + RTA_NEWDST = 0x13 + RTA_PREF = 0x14 + RTA_ENCAP_TYPE = 0x15 + RTA_ENCAP = 0x16 + RTA_EXPIRES = 0x17 + RTA_PAD = 0x18 + RTA_UID = 0x19 + RTA_TTL_PROPAGATE = 0x1a + RTA_IP_PROTO = 0x1b + RTA_SPORT = 0x1c + RTA_DPORT = 0x1d + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofIfaCacheinfo = 0x10 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 + SizeofNdUseroptmsg = 0x10 + SizeofNdMsg = 0xc ) type NlMsghdr struct { @@ -646,6 +687,16 @@ type NdMsg struct { Type uint8 } +const ( + ICMP_FILTER = 0x1 + + ICMPV6_FILTER = 0x1 + ICMPV6_FILTER_BLOCK = 0x1 + ICMPV6_FILTER_BLOCKOTHERS = 0x3 + ICMPV6_FILTER_PASS = 0x2 + ICMPV6_FILTER_PASSONLY = 0x4 +) + const ( SizeofSockFilter = 0x8 ) @@ -671,6 +722,8 @@ type InotifyEvent struct { const SizeofInotifyEvent = 0x10 +const SI_LOAD_SHIFT = 0x10 + type Utsname struct { Sysname [65]byte Nodename [65]byte @@ -696,6 +749,22 @@ const ( AT_EACCESS = 0x200 ) +type OpenHow struct { + Flags uint64 + Mode uint64 + Resolve uint64 +} + +const SizeofOpenHow = 0x18 + +const ( + RESOLVE_BENEATH = 0x8 + RESOLVE_IN_ROOT = 0x10 + RESOLVE_NO_MAGICLINKS = 0x2 + RESOLVE_NO_SYMLINKS = 0x4 + RESOLVE_NO_XDEV = 0x1 +) + type PollFd struct { Fd int32 Events int16 @@ -736,8 +805,6 @@ type SignalfdSiginfo struct { _ [28]uint8 } -const PERF_IOC_FLAG_GROUP = 0x1 - type Winsize struct { Row uint16 Col uint16 @@ -861,7 +928,10 @@ type PerfEventMmapPage struct { Time_offset uint64 Time_zero uint64 Size uint32 - _ [948]uint8 + _ uint32 + Time_cycles uint64 + Time_mask uint64 + _ [928]uint8 Data_head uint64 Data_tail uint64 Data_offset uint64 @@ -903,13 +973,13 @@ const ( ) const ( - PERF_TYPE_HARDWARE = 0x0 - PERF_TYPE_SOFTWARE = 0x1 - PERF_TYPE_TRACEPOINT = 0x2 - PERF_TYPE_HW_CACHE = 0x3 - PERF_TYPE_RAW = 0x4 - PERF_TYPE_BREAKPOINT = 0x5 - + PERF_TYPE_HARDWARE = 0x0 + PERF_TYPE_SOFTWARE = 0x1 + PERF_TYPE_TRACEPOINT = 0x2 + PERF_TYPE_HW_CACHE = 0x3 + PERF_TYPE_RAW = 0x4 + PERF_TYPE_BREAKPOINT = 0x5 + PERF_TYPE_MAX = 0x6 PERF_COUNT_HW_CPU_CYCLES = 0x0 PERF_COUNT_HW_INSTRUCTIONS = 0x1 PERF_COUNT_HW_CACHE_REFERENCES = 0x2 @@ -920,99 +990,166 @@ const ( PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 0x7 PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 0x8 PERF_COUNT_HW_REF_CPU_CYCLES = 0x9 - - PERF_COUNT_HW_CACHE_L1D = 0x0 - PERF_COUNT_HW_CACHE_L1I = 0x1 - PERF_COUNT_HW_CACHE_LL = 0x2 - PERF_COUNT_HW_CACHE_DTLB = 0x3 - PERF_COUNT_HW_CACHE_ITLB = 0x4 - PERF_COUNT_HW_CACHE_BPU = 0x5 - PERF_COUNT_HW_CACHE_NODE = 0x6 - - PERF_COUNT_HW_CACHE_OP_READ = 0x0 - PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 - PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 - - PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 - PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 - - PERF_COUNT_SW_CPU_CLOCK = 0x0 - PERF_COUNT_SW_TASK_CLOCK = 0x1 - PERF_COUNT_SW_PAGE_FAULTS = 0x2 - PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 - PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 - PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 - PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 - PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 - PERF_COUNT_SW_EMULATION_FAULTS = 0x8 - PERF_COUNT_SW_DUMMY = 0x9 - PERF_COUNT_SW_BPF_OUTPUT = 0xa - - PERF_SAMPLE_IP = 0x1 - PERF_SAMPLE_TID = 0x2 - PERF_SAMPLE_TIME = 0x4 - PERF_SAMPLE_ADDR = 0x8 - PERF_SAMPLE_READ = 0x10 - PERF_SAMPLE_CALLCHAIN = 0x20 - PERF_SAMPLE_ID = 0x40 - PERF_SAMPLE_CPU = 0x80 - PERF_SAMPLE_PERIOD = 0x100 - PERF_SAMPLE_STREAM_ID = 0x200 - PERF_SAMPLE_RAW = 0x400 - PERF_SAMPLE_BRANCH_STACK = 0x800 - - PERF_SAMPLE_BRANCH_USER = 0x1 - PERF_SAMPLE_BRANCH_KERNEL = 0x2 - PERF_SAMPLE_BRANCH_HV = 0x4 - PERF_SAMPLE_BRANCH_ANY = 0x8 - PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 - PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 - PERF_SAMPLE_BRANCH_IND_CALL = 0x40 - PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 - PERF_SAMPLE_BRANCH_IN_TX = 0x100 - PERF_SAMPLE_BRANCH_NO_TX = 0x200 - PERF_SAMPLE_BRANCH_COND = 0x400 - PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 - PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 - PERF_SAMPLE_BRANCH_CALL = 0x2000 - PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 - PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 - PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 - - PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 - PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 - PERF_FORMAT_ID = 0x4 - PERF_FORMAT_GROUP = 0x8 - - PERF_RECORD_MMAP = 0x1 - PERF_RECORD_LOST = 0x2 - PERF_RECORD_COMM = 0x3 - PERF_RECORD_EXIT = 0x4 - PERF_RECORD_THROTTLE = 0x5 - PERF_RECORD_UNTHROTTLE = 0x6 - PERF_RECORD_FORK = 0x7 - PERF_RECORD_READ = 0x8 - PERF_RECORD_SAMPLE = 0x9 - PERF_RECORD_MMAP2 = 0xa - PERF_RECORD_AUX = 0xb - PERF_RECORD_ITRACE_START = 0xc - PERF_RECORD_LOST_SAMPLES = 0xd - PERF_RECORD_SWITCH = 0xe - PERF_RECORD_SWITCH_CPU_WIDE = 0xf - PERF_RECORD_NAMESPACES = 0x10 - - PERF_CONTEXT_HV = -0x20 - PERF_CONTEXT_KERNEL = -0x80 - PERF_CONTEXT_USER = -0x200 - - PERF_CONTEXT_GUEST = -0x800 - PERF_CONTEXT_GUEST_KERNEL = -0x880 - PERF_CONTEXT_GUEST_USER = -0xa00 - - PERF_FLAG_FD_NO_GROUP = 0x1 - PERF_FLAG_FD_OUTPUT = 0x2 - PERF_FLAG_PID_CGROUP = 0x4 - PERF_FLAG_FD_CLOEXEC = 0x8 + PERF_COUNT_HW_MAX = 0xa + PERF_COUNT_HW_CACHE_L1D = 0x0 + PERF_COUNT_HW_CACHE_L1I = 0x1 + PERF_COUNT_HW_CACHE_LL = 0x2 + PERF_COUNT_HW_CACHE_DTLB = 0x3 + PERF_COUNT_HW_CACHE_ITLB = 0x4 + PERF_COUNT_HW_CACHE_BPU = 0x5 + PERF_COUNT_HW_CACHE_NODE = 0x6 + PERF_COUNT_HW_CACHE_MAX = 0x7 + PERF_COUNT_HW_CACHE_OP_READ = 0x0 + PERF_COUNT_HW_CACHE_OP_WRITE = 0x1 + PERF_COUNT_HW_CACHE_OP_PREFETCH = 0x2 + PERF_COUNT_HW_CACHE_OP_MAX = 0x3 + PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0x0 + PERF_COUNT_HW_CACHE_RESULT_MISS = 0x1 + PERF_COUNT_HW_CACHE_RESULT_MAX = 0x2 + PERF_COUNT_SW_CPU_CLOCK = 0x0 + PERF_COUNT_SW_TASK_CLOCK = 0x1 + PERF_COUNT_SW_PAGE_FAULTS = 0x2 + PERF_COUNT_SW_CONTEXT_SWITCHES = 0x3 + PERF_COUNT_SW_CPU_MIGRATIONS = 0x4 + PERF_COUNT_SW_PAGE_FAULTS_MIN = 0x5 + PERF_COUNT_SW_PAGE_FAULTS_MAJ = 0x6 + PERF_COUNT_SW_ALIGNMENT_FAULTS = 0x7 + PERF_COUNT_SW_EMULATION_FAULTS = 0x8 + PERF_COUNT_SW_DUMMY = 0x9 + PERF_COUNT_SW_BPF_OUTPUT = 0xa + PERF_COUNT_SW_MAX = 0xc + PERF_SAMPLE_IP = 0x1 + PERF_SAMPLE_TID = 0x2 + PERF_SAMPLE_TIME = 0x4 + PERF_SAMPLE_ADDR = 0x8 + PERF_SAMPLE_READ = 0x10 + PERF_SAMPLE_CALLCHAIN = 0x20 + PERF_SAMPLE_ID = 0x40 + PERF_SAMPLE_CPU = 0x80 + PERF_SAMPLE_PERIOD = 0x100 + PERF_SAMPLE_STREAM_ID = 0x200 + PERF_SAMPLE_RAW = 0x400 + PERF_SAMPLE_BRANCH_STACK = 0x800 + PERF_SAMPLE_REGS_USER = 0x1000 + PERF_SAMPLE_STACK_USER = 0x2000 + PERF_SAMPLE_WEIGHT = 0x4000 + PERF_SAMPLE_DATA_SRC = 0x8000 + PERF_SAMPLE_IDENTIFIER = 0x10000 + PERF_SAMPLE_TRANSACTION = 0x20000 + PERF_SAMPLE_REGS_INTR = 0x40000 + PERF_SAMPLE_PHYS_ADDR = 0x80000 + PERF_SAMPLE_AUX = 0x100000 + PERF_SAMPLE_CGROUP = 0x200000 + PERF_SAMPLE_DATA_PAGE_SIZE = 0x400000 + PERF_SAMPLE_CODE_PAGE_SIZE = 0x800000 + PERF_SAMPLE_WEIGHT_STRUCT = 0x1000000 + PERF_SAMPLE_MAX = 0x2000000 + PERF_SAMPLE_BRANCH_USER_SHIFT = 0x0 + PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 0x1 + PERF_SAMPLE_BRANCH_HV_SHIFT = 0x2 + PERF_SAMPLE_BRANCH_ANY_SHIFT = 0x3 + PERF_SAMPLE_BRANCH_ANY_CALL_SHIFT = 0x4 + PERF_SAMPLE_BRANCH_ANY_RETURN_SHIFT = 0x5 + PERF_SAMPLE_BRANCH_IND_CALL_SHIFT = 0x6 + PERF_SAMPLE_BRANCH_ABORT_TX_SHIFT = 0x7 + PERF_SAMPLE_BRANCH_IN_TX_SHIFT = 0x8 + PERF_SAMPLE_BRANCH_NO_TX_SHIFT = 0x9 + PERF_SAMPLE_BRANCH_COND_SHIFT = 0xa + PERF_SAMPLE_BRANCH_CALL_STACK_SHIFT = 0xb + PERF_SAMPLE_BRANCH_IND_JUMP_SHIFT = 0xc + PERF_SAMPLE_BRANCH_CALL_SHIFT = 0xd + PERF_SAMPLE_BRANCH_NO_FLAGS_SHIFT = 0xe + PERF_SAMPLE_BRANCH_NO_CYCLES_SHIFT = 0xf + PERF_SAMPLE_BRANCH_TYPE_SAVE_SHIFT = 0x10 + PERF_SAMPLE_BRANCH_HW_INDEX_SHIFT = 0x11 + PERF_SAMPLE_BRANCH_MAX_SHIFT = 0x12 + PERF_SAMPLE_BRANCH_USER = 0x1 + PERF_SAMPLE_BRANCH_KERNEL = 0x2 + PERF_SAMPLE_BRANCH_HV = 0x4 + PERF_SAMPLE_BRANCH_ANY = 0x8 + PERF_SAMPLE_BRANCH_ANY_CALL = 0x10 + PERF_SAMPLE_BRANCH_ANY_RETURN = 0x20 + PERF_SAMPLE_BRANCH_IND_CALL = 0x40 + PERF_SAMPLE_BRANCH_ABORT_TX = 0x80 + PERF_SAMPLE_BRANCH_IN_TX = 0x100 + PERF_SAMPLE_BRANCH_NO_TX = 0x200 + PERF_SAMPLE_BRANCH_COND = 0x400 + PERF_SAMPLE_BRANCH_CALL_STACK = 0x800 + PERF_SAMPLE_BRANCH_IND_JUMP = 0x1000 + PERF_SAMPLE_BRANCH_CALL = 0x2000 + PERF_SAMPLE_BRANCH_NO_FLAGS = 0x4000 + PERF_SAMPLE_BRANCH_NO_CYCLES = 0x8000 + PERF_SAMPLE_BRANCH_TYPE_SAVE = 0x10000 + PERF_SAMPLE_BRANCH_HW_INDEX = 0x20000 + PERF_SAMPLE_BRANCH_MAX = 0x40000 + PERF_BR_UNKNOWN = 0x0 + PERF_BR_COND = 0x1 + PERF_BR_UNCOND = 0x2 + PERF_BR_IND = 0x3 + PERF_BR_CALL = 0x4 + PERF_BR_IND_CALL = 0x5 + PERF_BR_RET = 0x6 + PERF_BR_SYSCALL = 0x7 + PERF_BR_SYSRET = 0x8 + PERF_BR_COND_CALL = 0x9 + PERF_BR_COND_RET = 0xa + PERF_BR_MAX = 0xb + PERF_SAMPLE_REGS_ABI_NONE = 0x0 + PERF_SAMPLE_REGS_ABI_32 = 0x1 + PERF_SAMPLE_REGS_ABI_64 = 0x2 + PERF_TXN_ELISION = 0x1 + PERF_TXN_TRANSACTION = 0x2 + PERF_TXN_SYNC = 0x4 + PERF_TXN_ASYNC = 0x8 + PERF_TXN_RETRY = 0x10 + PERF_TXN_CONFLICT = 0x20 + PERF_TXN_CAPACITY_WRITE = 0x40 + PERF_TXN_CAPACITY_READ = 0x80 + PERF_TXN_MAX = 0x100 + PERF_TXN_ABORT_MASK = -0x100000000 + PERF_TXN_ABORT_SHIFT = 0x20 + PERF_FORMAT_TOTAL_TIME_ENABLED = 0x1 + PERF_FORMAT_TOTAL_TIME_RUNNING = 0x2 + PERF_FORMAT_ID = 0x4 + PERF_FORMAT_GROUP = 0x8 + PERF_FORMAT_MAX = 0x10 + PERF_IOC_FLAG_GROUP = 0x1 + PERF_RECORD_MMAP = 0x1 + PERF_RECORD_LOST = 0x2 + PERF_RECORD_COMM = 0x3 + PERF_RECORD_EXIT = 0x4 + PERF_RECORD_THROTTLE = 0x5 + PERF_RECORD_UNTHROTTLE = 0x6 + PERF_RECORD_FORK = 0x7 + PERF_RECORD_READ = 0x8 + PERF_RECORD_SAMPLE = 0x9 + PERF_RECORD_MMAP2 = 0xa + PERF_RECORD_AUX = 0xb + PERF_RECORD_ITRACE_START = 0xc + PERF_RECORD_LOST_SAMPLES = 0xd + PERF_RECORD_SWITCH = 0xe + PERF_RECORD_SWITCH_CPU_WIDE = 0xf + PERF_RECORD_NAMESPACES = 0x10 + PERF_RECORD_KSYMBOL = 0x11 + PERF_RECORD_BPF_EVENT = 0x12 + PERF_RECORD_CGROUP = 0x13 + PERF_RECORD_TEXT_POKE = 0x14 + PERF_RECORD_MAX = 0x15 + PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0x0 + PERF_RECORD_KSYMBOL_TYPE_BPF = 0x1 + PERF_RECORD_KSYMBOL_TYPE_OOL = 0x2 + PERF_RECORD_KSYMBOL_TYPE_MAX = 0x3 + PERF_BPF_EVENT_UNKNOWN = 0x0 + PERF_BPF_EVENT_PROG_LOAD = 0x1 + PERF_BPF_EVENT_PROG_UNLOAD = 0x2 + PERF_BPF_EVENT_MAX = 0x3 + PERF_CONTEXT_HV = -0x20 + PERF_CONTEXT_KERNEL = -0x80 + PERF_CONTEXT_USER = -0x200 + PERF_CONTEXT_GUEST = -0x800 + PERF_CONTEXT_GUEST_KERNEL = -0x880 + PERF_CONTEXT_GUEST_USER = -0xa00 + PERF_CONTEXT_MAX = -0xfff ) type TCPMD5Sig struct { @@ -1231,6 +1368,401 @@ const ( SizeofTpacketStatsV3 = 0xc ) +const ( + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_TARGET_NETNSID = 0x2e + IFLA_CARRIER_UP_COUNT = 0x2f + IFLA_CARRIER_DOWN_COUNT = 0x30 + IFLA_NEW_IFINDEX = 0x31 + IFLA_MIN_MTU = 0x32 + IFLA_MAX_MTU = 0x33 + IFLA_PROP_LIST = 0x34 + IFLA_ALT_IFNAME = 0x35 + IFLA_PERM_ADDRESS = 0x36 + IFLA_PROTO_DOWN_REASON = 0x37 + IFLA_PROTO_DOWN_REASON_UNSPEC = 0x0 + IFLA_PROTO_DOWN_REASON_MASK = 0x1 + IFLA_PROTO_DOWN_REASON_VALUE = 0x2 + IFLA_PROTO_DOWN_REASON_MAX = 0x2 + IFLA_INET_UNSPEC = 0x0 + IFLA_INET_CONF = 0x1 + IFLA_INET6_UNSPEC = 0x0 + IFLA_INET6_FLAGS = 0x1 + IFLA_INET6_CONF = 0x2 + IFLA_INET6_STATS = 0x3 + IFLA_INET6_MCAST = 0x4 + IFLA_INET6_CACHEINFO = 0x5 + IFLA_INET6_ICMP6STATS = 0x6 + IFLA_INET6_TOKEN = 0x7 + IFLA_INET6_ADDR_GEN_MODE = 0x8 + IFLA_BR_UNSPEC = 0x0 + IFLA_BR_FORWARD_DELAY = 0x1 + IFLA_BR_HELLO_TIME = 0x2 + IFLA_BR_MAX_AGE = 0x3 + IFLA_BR_AGEING_TIME = 0x4 + IFLA_BR_STP_STATE = 0x5 + IFLA_BR_PRIORITY = 0x6 + IFLA_BR_VLAN_FILTERING = 0x7 + IFLA_BR_VLAN_PROTOCOL = 0x8 + IFLA_BR_GROUP_FWD_MASK = 0x9 + IFLA_BR_ROOT_ID = 0xa + IFLA_BR_BRIDGE_ID = 0xb + IFLA_BR_ROOT_PORT = 0xc + IFLA_BR_ROOT_PATH_COST = 0xd + IFLA_BR_TOPOLOGY_CHANGE = 0xe + IFLA_BR_TOPOLOGY_CHANGE_DETECTED = 0xf + IFLA_BR_HELLO_TIMER = 0x10 + IFLA_BR_TCN_TIMER = 0x11 + IFLA_BR_TOPOLOGY_CHANGE_TIMER = 0x12 + IFLA_BR_GC_TIMER = 0x13 + IFLA_BR_GROUP_ADDR = 0x14 + IFLA_BR_FDB_FLUSH = 0x15 + IFLA_BR_MCAST_ROUTER = 0x16 + IFLA_BR_MCAST_SNOOPING = 0x17 + IFLA_BR_MCAST_QUERY_USE_IFADDR = 0x18 + IFLA_BR_MCAST_QUERIER = 0x19 + IFLA_BR_MCAST_HASH_ELASTICITY = 0x1a + IFLA_BR_MCAST_HASH_MAX = 0x1b + IFLA_BR_MCAST_LAST_MEMBER_CNT = 0x1c + IFLA_BR_MCAST_STARTUP_QUERY_CNT = 0x1d + IFLA_BR_MCAST_LAST_MEMBER_INTVL = 0x1e + IFLA_BR_MCAST_MEMBERSHIP_INTVL = 0x1f + IFLA_BR_MCAST_QUERIER_INTVL = 0x20 + IFLA_BR_MCAST_QUERY_INTVL = 0x21 + IFLA_BR_MCAST_QUERY_RESPONSE_INTVL = 0x22 + IFLA_BR_MCAST_STARTUP_QUERY_INTVL = 0x23 + IFLA_BR_NF_CALL_IPTABLES = 0x24 + IFLA_BR_NF_CALL_IP6TABLES = 0x25 + IFLA_BR_NF_CALL_ARPTABLES = 0x26 + IFLA_BR_VLAN_DEFAULT_PVID = 0x27 + IFLA_BR_PAD = 0x28 + IFLA_BR_VLAN_STATS_ENABLED = 0x29 + IFLA_BR_MCAST_STATS_ENABLED = 0x2a + IFLA_BR_MCAST_IGMP_VERSION = 0x2b + IFLA_BR_MCAST_MLD_VERSION = 0x2c + IFLA_BR_VLAN_STATS_PER_PORT = 0x2d + IFLA_BR_MULTI_BOOLOPT = 0x2e + IFLA_BRPORT_UNSPEC = 0x0 + IFLA_BRPORT_STATE = 0x1 + IFLA_BRPORT_PRIORITY = 0x2 + IFLA_BRPORT_COST = 0x3 + IFLA_BRPORT_MODE = 0x4 + IFLA_BRPORT_GUARD = 0x5 + IFLA_BRPORT_PROTECT = 0x6 + IFLA_BRPORT_FAST_LEAVE = 0x7 + IFLA_BRPORT_LEARNING = 0x8 + IFLA_BRPORT_UNICAST_FLOOD = 0x9 + IFLA_BRPORT_PROXYARP = 0xa + IFLA_BRPORT_LEARNING_SYNC = 0xb + IFLA_BRPORT_PROXYARP_WIFI = 0xc + IFLA_BRPORT_ROOT_ID = 0xd + IFLA_BRPORT_BRIDGE_ID = 0xe + IFLA_BRPORT_DESIGNATED_PORT = 0xf + IFLA_BRPORT_DESIGNATED_COST = 0x10 + IFLA_BRPORT_ID = 0x11 + IFLA_BRPORT_NO = 0x12 + IFLA_BRPORT_TOPOLOGY_CHANGE_ACK = 0x13 + IFLA_BRPORT_CONFIG_PENDING = 0x14 + IFLA_BRPORT_MESSAGE_AGE_TIMER = 0x15 + IFLA_BRPORT_FORWARD_DELAY_TIMER = 0x16 + IFLA_BRPORT_HOLD_TIMER = 0x17 + IFLA_BRPORT_FLUSH = 0x18 + IFLA_BRPORT_MULTICAST_ROUTER = 0x19 + IFLA_BRPORT_PAD = 0x1a + IFLA_BRPORT_MCAST_FLOOD = 0x1b + IFLA_BRPORT_MCAST_TO_UCAST = 0x1c + IFLA_BRPORT_VLAN_TUNNEL = 0x1d + IFLA_BRPORT_BCAST_FLOOD = 0x1e + IFLA_BRPORT_GROUP_FWD_MASK = 0x1f + IFLA_BRPORT_NEIGH_SUPPRESS = 0x20 + IFLA_BRPORT_ISOLATED = 0x21 + IFLA_BRPORT_BACKUP_PORT = 0x22 + IFLA_BRPORT_MRP_RING_OPEN = 0x23 + IFLA_BRPORT_MRP_IN_OPEN = 0x24 + IFLA_INFO_UNSPEC = 0x0 + IFLA_INFO_KIND = 0x1 + IFLA_INFO_DATA = 0x2 + IFLA_INFO_XSTATS = 0x3 + IFLA_INFO_SLAVE_KIND = 0x4 + IFLA_INFO_SLAVE_DATA = 0x5 + IFLA_VLAN_UNSPEC = 0x0 + IFLA_VLAN_ID = 0x1 + IFLA_VLAN_FLAGS = 0x2 + IFLA_VLAN_EGRESS_QOS = 0x3 + IFLA_VLAN_INGRESS_QOS = 0x4 + IFLA_VLAN_PROTOCOL = 0x5 + IFLA_VLAN_QOS_UNSPEC = 0x0 + IFLA_VLAN_QOS_MAPPING = 0x1 + IFLA_MACVLAN_UNSPEC = 0x0 + IFLA_MACVLAN_MODE = 0x1 + IFLA_MACVLAN_FLAGS = 0x2 + IFLA_MACVLAN_MACADDR_MODE = 0x3 + IFLA_MACVLAN_MACADDR = 0x4 + IFLA_MACVLAN_MACADDR_DATA = 0x5 + IFLA_MACVLAN_MACADDR_COUNT = 0x6 + IFLA_VRF_UNSPEC = 0x0 + IFLA_VRF_TABLE = 0x1 + IFLA_VRF_PORT_UNSPEC = 0x0 + IFLA_VRF_PORT_TABLE = 0x1 + IFLA_MACSEC_UNSPEC = 0x0 + IFLA_MACSEC_SCI = 0x1 + IFLA_MACSEC_PORT = 0x2 + IFLA_MACSEC_ICV_LEN = 0x3 + IFLA_MACSEC_CIPHER_SUITE = 0x4 + IFLA_MACSEC_WINDOW = 0x5 + IFLA_MACSEC_ENCODING_SA = 0x6 + IFLA_MACSEC_ENCRYPT = 0x7 + IFLA_MACSEC_PROTECT = 0x8 + IFLA_MACSEC_INC_SCI = 0x9 + IFLA_MACSEC_ES = 0xa + IFLA_MACSEC_SCB = 0xb + IFLA_MACSEC_REPLAY_PROTECT = 0xc + IFLA_MACSEC_VALIDATION = 0xd + IFLA_MACSEC_PAD = 0xe + IFLA_MACSEC_OFFLOAD = 0xf + IFLA_XFRM_UNSPEC = 0x0 + IFLA_XFRM_LINK = 0x1 + IFLA_XFRM_IF_ID = 0x2 + IFLA_IPVLAN_UNSPEC = 0x0 + IFLA_IPVLAN_MODE = 0x1 + IFLA_IPVLAN_FLAGS = 0x2 + IFLA_VXLAN_UNSPEC = 0x0 + IFLA_VXLAN_ID = 0x1 + IFLA_VXLAN_GROUP = 0x2 + IFLA_VXLAN_LINK = 0x3 + IFLA_VXLAN_LOCAL = 0x4 + IFLA_VXLAN_TTL = 0x5 + IFLA_VXLAN_TOS = 0x6 + IFLA_VXLAN_LEARNING = 0x7 + IFLA_VXLAN_AGEING = 0x8 + IFLA_VXLAN_LIMIT = 0x9 + IFLA_VXLAN_PORT_RANGE = 0xa + IFLA_VXLAN_PROXY = 0xb + IFLA_VXLAN_RSC = 0xc + IFLA_VXLAN_L2MISS = 0xd + IFLA_VXLAN_L3MISS = 0xe + IFLA_VXLAN_PORT = 0xf + IFLA_VXLAN_GROUP6 = 0x10 + IFLA_VXLAN_LOCAL6 = 0x11 + IFLA_VXLAN_UDP_CSUM = 0x12 + IFLA_VXLAN_UDP_ZERO_CSUM6_TX = 0x13 + IFLA_VXLAN_UDP_ZERO_CSUM6_RX = 0x14 + IFLA_VXLAN_REMCSUM_TX = 0x15 + IFLA_VXLAN_REMCSUM_RX = 0x16 + IFLA_VXLAN_GBP = 0x17 + IFLA_VXLAN_REMCSUM_NOPARTIAL = 0x18 + IFLA_VXLAN_COLLECT_METADATA = 0x19 + IFLA_VXLAN_LABEL = 0x1a + IFLA_VXLAN_GPE = 0x1b + IFLA_VXLAN_TTL_INHERIT = 0x1c + IFLA_VXLAN_DF = 0x1d + IFLA_GENEVE_UNSPEC = 0x0 + IFLA_GENEVE_ID = 0x1 + IFLA_GENEVE_REMOTE = 0x2 + IFLA_GENEVE_TTL = 0x3 + IFLA_GENEVE_TOS = 0x4 + IFLA_GENEVE_PORT = 0x5 + IFLA_GENEVE_COLLECT_METADATA = 0x6 + IFLA_GENEVE_REMOTE6 = 0x7 + IFLA_GENEVE_UDP_CSUM = 0x8 + IFLA_GENEVE_UDP_ZERO_CSUM6_TX = 0x9 + IFLA_GENEVE_UDP_ZERO_CSUM6_RX = 0xa + IFLA_GENEVE_LABEL = 0xb + IFLA_GENEVE_TTL_INHERIT = 0xc + IFLA_GENEVE_DF = 0xd + IFLA_BAREUDP_UNSPEC = 0x0 + IFLA_BAREUDP_PORT = 0x1 + IFLA_BAREUDP_ETHERTYPE = 0x2 + IFLA_BAREUDP_SRCPORT_MIN = 0x3 + IFLA_BAREUDP_MULTIPROTO_MODE = 0x4 + IFLA_PPP_UNSPEC = 0x0 + IFLA_PPP_DEV_FD = 0x1 + IFLA_GTP_UNSPEC = 0x0 + IFLA_GTP_FD0 = 0x1 + IFLA_GTP_FD1 = 0x2 + IFLA_GTP_PDP_HASHSIZE = 0x3 + IFLA_GTP_ROLE = 0x4 + IFLA_BOND_UNSPEC = 0x0 + IFLA_BOND_MODE = 0x1 + IFLA_BOND_ACTIVE_SLAVE = 0x2 + IFLA_BOND_MIIMON = 0x3 + IFLA_BOND_UPDELAY = 0x4 + IFLA_BOND_DOWNDELAY = 0x5 + IFLA_BOND_USE_CARRIER = 0x6 + IFLA_BOND_ARP_INTERVAL = 0x7 + IFLA_BOND_ARP_IP_TARGET = 0x8 + IFLA_BOND_ARP_VALIDATE = 0x9 + IFLA_BOND_ARP_ALL_TARGETS = 0xa + IFLA_BOND_PRIMARY = 0xb + IFLA_BOND_PRIMARY_RESELECT = 0xc + IFLA_BOND_FAIL_OVER_MAC = 0xd + IFLA_BOND_XMIT_HASH_POLICY = 0xe + IFLA_BOND_RESEND_IGMP = 0xf + IFLA_BOND_NUM_PEER_NOTIF = 0x10 + IFLA_BOND_ALL_SLAVES_ACTIVE = 0x11 + IFLA_BOND_MIN_LINKS = 0x12 + IFLA_BOND_LP_INTERVAL = 0x13 + IFLA_BOND_PACKETS_PER_SLAVE = 0x14 + IFLA_BOND_AD_LACP_RATE = 0x15 + IFLA_BOND_AD_SELECT = 0x16 + IFLA_BOND_AD_INFO = 0x17 + IFLA_BOND_AD_ACTOR_SYS_PRIO = 0x18 + IFLA_BOND_AD_USER_PORT_KEY = 0x19 + IFLA_BOND_AD_ACTOR_SYSTEM = 0x1a + IFLA_BOND_TLB_DYNAMIC_LB = 0x1b + IFLA_BOND_PEER_NOTIF_DELAY = 0x1c + IFLA_BOND_AD_INFO_UNSPEC = 0x0 + IFLA_BOND_AD_INFO_AGGREGATOR = 0x1 + IFLA_BOND_AD_INFO_NUM_PORTS = 0x2 + IFLA_BOND_AD_INFO_ACTOR_KEY = 0x3 + IFLA_BOND_AD_INFO_PARTNER_KEY = 0x4 + IFLA_BOND_AD_INFO_PARTNER_MAC = 0x5 + IFLA_BOND_SLAVE_UNSPEC = 0x0 + IFLA_BOND_SLAVE_STATE = 0x1 + IFLA_BOND_SLAVE_MII_STATUS = 0x2 + IFLA_BOND_SLAVE_LINK_FAILURE_COUNT = 0x3 + IFLA_BOND_SLAVE_PERM_HWADDR = 0x4 + IFLA_BOND_SLAVE_QUEUE_ID = 0x5 + IFLA_BOND_SLAVE_AD_AGGREGATOR_ID = 0x6 + IFLA_BOND_SLAVE_AD_ACTOR_OPER_PORT_STATE = 0x7 + IFLA_BOND_SLAVE_AD_PARTNER_OPER_PORT_STATE = 0x8 + IFLA_VF_INFO_UNSPEC = 0x0 + IFLA_VF_INFO = 0x1 + IFLA_VF_UNSPEC = 0x0 + IFLA_VF_MAC = 0x1 + IFLA_VF_VLAN = 0x2 + IFLA_VF_TX_RATE = 0x3 + IFLA_VF_SPOOFCHK = 0x4 + IFLA_VF_LINK_STATE = 0x5 + IFLA_VF_RATE = 0x6 + IFLA_VF_RSS_QUERY_EN = 0x7 + IFLA_VF_STATS = 0x8 + IFLA_VF_TRUST = 0x9 + IFLA_VF_IB_NODE_GUID = 0xa + IFLA_VF_IB_PORT_GUID = 0xb + IFLA_VF_VLAN_LIST = 0xc + IFLA_VF_BROADCAST = 0xd + IFLA_VF_VLAN_INFO_UNSPEC = 0x0 + IFLA_VF_VLAN_INFO = 0x1 + IFLA_VF_LINK_STATE_AUTO = 0x0 + IFLA_VF_LINK_STATE_ENABLE = 0x1 + IFLA_VF_LINK_STATE_DISABLE = 0x2 + IFLA_VF_STATS_RX_PACKETS = 0x0 + IFLA_VF_STATS_TX_PACKETS = 0x1 + IFLA_VF_STATS_RX_BYTES = 0x2 + IFLA_VF_STATS_TX_BYTES = 0x3 + IFLA_VF_STATS_BROADCAST = 0x4 + IFLA_VF_STATS_MULTICAST = 0x5 + IFLA_VF_STATS_PAD = 0x6 + IFLA_VF_STATS_RX_DROPPED = 0x7 + IFLA_VF_STATS_TX_DROPPED = 0x8 + IFLA_VF_PORT_UNSPEC = 0x0 + IFLA_VF_PORT = 0x1 + IFLA_PORT_UNSPEC = 0x0 + IFLA_PORT_VF = 0x1 + IFLA_PORT_PROFILE = 0x2 + IFLA_PORT_VSI_TYPE = 0x3 + IFLA_PORT_INSTANCE_UUID = 0x4 + IFLA_PORT_HOST_UUID = 0x5 + IFLA_PORT_REQUEST = 0x6 + IFLA_PORT_RESPONSE = 0x7 + IFLA_IPOIB_UNSPEC = 0x0 + IFLA_IPOIB_PKEY = 0x1 + IFLA_IPOIB_MODE = 0x2 + IFLA_IPOIB_UMCAST = 0x3 + IFLA_HSR_UNSPEC = 0x0 + IFLA_HSR_SLAVE1 = 0x1 + IFLA_HSR_SLAVE2 = 0x2 + IFLA_HSR_MULTICAST_SPEC = 0x3 + IFLA_HSR_SUPERVISION_ADDR = 0x4 + IFLA_HSR_SEQ_NR = 0x5 + IFLA_HSR_VERSION = 0x6 + IFLA_HSR_PROTOCOL = 0x7 + IFLA_STATS_UNSPEC = 0x0 + IFLA_STATS_LINK_64 = 0x1 + IFLA_STATS_LINK_XSTATS = 0x2 + IFLA_STATS_LINK_XSTATS_SLAVE = 0x3 + IFLA_STATS_LINK_OFFLOAD_XSTATS = 0x4 + IFLA_STATS_AF_SPEC = 0x5 + IFLA_OFFLOAD_XSTATS_UNSPEC = 0x0 + IFLA_OFFLOAD_XSTATS_CPU_HIT = 0x1 + IFLA_XDP_UNSPEC = 0x0 + IFLA_XDP_FD = 0x1 + IFLA_XDP_ATTACHED = 0x2 + IFLA_XDP_FLAGS = 0x3 + IFLA_XDP_PROG_ID = 0x4 + IFLA_XDP_DRV_PROG_ID = 0x5 + IFLA_XDP_SKB_PROG_ID = 0x6 + IFLA_XDP_HW_PROG_ID = 0x7 + IFLA_XDP_EXPECTED_FD = 0x8 + IFLA_EVENT_NONE = 0x0 + IFLA_EVENT_REBOOT = 0x1 + IFLA_EVENT_FEATURES = 0x2 + IFLA_EVENT_BONDING_FAILOVER = 0x3 + IFLA_EVENT_NOTIFY_PEERS = 0x4 + IFLA_EVENT_IGMP_RESEND = 0x5 + IFLA_EVENT_BONDING_OPTIONS = 0x6 + IFLA_TUN_UNSPEC = 0x0 + IFLA_TUN_OWNER = 0x1 + IFLA_TUN_GROUP = 0x2 + IFLA_TUN_TYPE = 0x3 + IFLA_TUN_PI = 0x4 + IFLA_TUN_VNET_HDR = 0x5 + IFLA_TUN_PERSIST = 0x6 + IFLA_TUN_MULTI_QUEUE = 0x7 + IFLA_TUN_NUM_QUEUES = 0x8 + IFLA_TUN_NUM_DISABLED_QUEUES = 0x9 + IFLA_RMNET_UNSPEC = 0x0 + IFLA_RMNET_MUX_ID = 0x1 + IFLA_RMNET_FLAGS = 0x2 +) + const ( NF_INET_PRE_ROUTING = 0x0 NF_INET_LOCAL_IN = 0x1 @@ -1257,6 +1789,8 @@ const ( NFPROTO_NUMPROTO = 0xd ) +const SO_ORIGINAL_DST = 0x50 + type Nfgenmsg struct { Nfgen_family uint8 Version uint8 @@ -1318,7 +1852,7 @@ const ( NFT_MSG_DELOBJ = 0x14 NFT_MSG_GETOBJ_RESET = 0x15 NFT_MSG_MAX = 0x19 - NFTA_LIST_UNPEC = 0x0 + NFTA_LIST_UNSPEC = 0x0 NFTA_LIST_ELEM = 0x1 NFTA_HOOK_UNSPEC = 0x0 NFTA_HOOK_HOOKNUM = 0x1 @@ -1689,6 +2223,21 @@ const ( NFT_NG_RANDOM = 0x1 ) +const ( + NFTA_TARGET_UNSPEC = 0x0 + NFTA_TARGET_NAME = 0x1 + NFTA_TARGET_REV = 0x2 + NFTA_TARGET_INFO = 0x3 + NFTA_MATCH_UNSPEC = 0x0 + NFTA_MATCH_NAME = 0x1 + NFTA_MATCH_REV = 0x2 + NFTA_MATCH_INFO = 0x3 + NFTA_COMPAT_UNSPEC = 0x0 + NFTA_COMPAT_NAME = 0x1 + NFTA_COMPAT_REV = 0x2 + NFTA_COMPAT_TYPE = 0x3 +) + type RTCTime struct { Sec int32 Min int32 @@ -1721,10 +2270,12 @@ const ( ) const ( - NETNSA_NONE = 0x0 - NETNSA_NSID = 0x1 - NETNSA_PID = 0x2 - NETNSA_FD = 0x3 + NETNSA_NONE = 0x0 + NETNSA_NSID = 0x1 + NETNSA_PID = 0x2 + NETNSA_FD = 0x3 + NETNSA_TARGET_NSID = 0x4 + NETNSA_CURRENT_NSID = 0x5 ) type XDPRingOffset struct { @@ -1742,9 +2293,12 @@ type XDPMmapOffsets struct { } type XDPStatistics struct { - Rx_dropped uint64 - Rx_invalid_descs uint64 - Tx_invalid_descs uint64 + Rx_dropped uint64 + Rx_invalid_descs uint64 + Tx_invalid_descs uint64 + Rx_ring_full uint64 + Rx_fill_ring_empty_descs uint64 + Tx_ring_empty_descs uint64 } type XDPDesc struct { @@ -1802,8 +2356,8 @@ const ( SOF_TIMESTAMPING_OPT_PKTINFO = 0x2000 SOF_TIMESTAMPING_OPT_TX_SWHW = 0x4000 - SOF_TIMESTAMPING_LAST = 0x4000 - SOF_TIMESTAMPING_MASK = 0x7fff + SOF_TIMESTAMPING_LAST = 0x8000 + SOF_TIMESTAMPING_MASK = 0xffff SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SCHED = 0x1 @@ -1871,249 +2425,309 @@ const ( ) const ( - BPF_REG_0 = 0x0 - BPF_REG_1 = 0x1 - BPF_REG_2 = 0x2 - BPF_REG_3 = 0x3 - BPF_REG_4 = 0x4 - BPF_REG_5 = 0x5 - BPF_REG_6 = 0x6 - BPF_REG_7 = 0x7 - BPF_REG_8 = 0x8 - BPF_REG_9 = 0x9 - BPF_REG_10 = 0xa - BPF_MAP_CREATE = 0x0 - BPF_MAP_LOOKUP_ELEM = 0x1 - BPF_MAP_UPDATE_ELEM = 0x2 - BPF_MAP_DELETE_ELEM = 0x3 - BPF_MAP_GET_NEXT_KEY = 0x4 - BPF_PROG_LOAD = 0x5 - BPF_OBJ_PIN = 0x6 - BPF_OBJ_GET = 0x7 - BPF_PROG_ATTACH = 0x8 - BPF_PROG_DETACH = 0x9 - BPF_PROG_TEST_RUN = 0xa - BPF_PROG_GET_NEXT_ID = 0xb - BPF_MAP_GET_NEXT_ID = 0xc - BPF_PROG_GET_FD_BY_ID = 0xd - BPF_MAP_GET_FD_BY_ID = 0xe - BPF_OBJ_GET_INFO_BY_FD = 0xf - BPF_PROG_QUERY = 0x10 - BPF_RAW_TRACEPOINT_OPEN = 0x11 - BPF_BTF_LOAD = 0x12 - BPF_BTF_GET_FD_BY_ID = 0x13 - BPF_TASK_FD_QUERY = 0x14 - BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 - BPF_MAP_FREEZE = 0x16 - BPF_BTF_GET_NEXT_ID = 0x17 - BPF_MAP_LOOKUP_BATCH = 0x18 - BPF_MAP_LOOKUP_AND_DELETE_BATCH = 0x19 - BPF_MAP_UPDATE_BATCH = 0x1a - BPF_MAP_DELETE_BATCH = 0x1b - BPF_LINK_CREATE = 0x1c - BPF_LINK_UPDATE = 0x1d - BPF_MAP_TYPE_UNSPEC = 0x0 - BPF_MAP_TYPE_HASH = 0x1 - BPF_MAP_TYPE_ARRAY = 0x2 - BPF_MAP_TYPE_PROG_ARRAY = 0x3 - BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 - BPF_MAP_TYPE_PERCPU_HASH = 0x5 - BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 - BPF_MAP_TYPE_STACK_TRACE = 0x7 - BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 - BPF_MAP_TYPE_LRU_HASH = 0x9 - BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa - BPF_MAP_TYPE_LPM_TRIE = 0xb - BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc - BPF_MAP_TYPE_HASH_OF_MAPS = 0xd - BPF_MAP_TYPE_DEVMAP = 0xe - BPF_MAP_TYPE_SOCKMAP = 0xf - BPF_MAP_TYPE_CPUMAP = 0x10 - BPF_MAP_TYPE_XSKMAP = 0x11 - BPF_MAP_TYPE_SOCKHASH = 0x12 - BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 - BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 - BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 - BPF_MAP_TYPE_QUEUE = 0x16 - BPF_MAP_TYPE_STACK = 0x17 - BPF_MAP_TYPE_SK_STORAGE = 0x18 - BPF_MAP_TYPE_DEVMAP_HASH = 0x19 - BPF_MAP_TYPE_STRUCT_OPS = 0x1a - BPF_PROG_TYPE_UNSPEC = 0x0 - BPF_PROG_TYPE_SOCKET_FILTER = 0x1 - BPF_PROG_TYPE_KPROBE = 0x2 - BPF_PROG_TYPE_SCHED_CLS = 0x3 - BPF_PROG_TYPE_SCHED_ACT = 0x4 - BPF_PROG_TYPE_TRACEPOINT = 0x5 - BPF_PROG_TYPE_XDP = 0x6 - BPF_PROG_TYPE_PERF_EVENT = 0x7 - BPF_PROG_TYPE_CGROUP_SKB = 0x8 - BPF_PROG_TYPE_CGROUP_SOCK = 0x9 - BPF_PROG_TYPE_LWT_IN = 0xa - BPF_PROG_TYPE_LWT_OUT = 0xb - BPF_PROG_TYPE_LWT_XMIT = 0xc - BPF_PROG_TYPE_SOCK_OPS = 0xd - BPF_PROG_TYPE_SK_SKB = 0xe - BPF_PROG_TYPE_CGROUP_DEVICE = 0xf - BPF_PROG_TYPE_SK_MSG = 0x10 - BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 - BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 - BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 - BPF_PROG_TYPE_LIRC_MODE2 = 0x14 - BPF_PROG_TYPE_SK_REUSEPORT = 0x15 - BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 - BPF_PROG_TYPE_CGROUP_SYSCTL = 0x17 - BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE = 0x18 - BPF_PROG_TYPE_CGROUP_SOCKOPT = 0x19 - BPF_PROG_TYPE_TRACING = 0x1a - BPF_PROG_TYPE_STRUCT_OPS = 0x1b - BPF_PROG_TYPE_EXT = 0x1c - BPF_PROG_TYPE_LSM = 0x1d - BPF_CGROUP_INET_INGRESS = 0x0 - BPF_CGROUP_INET_EGRESS = 0x1 - BPF_CGROUP_INET_SOCK_CREATE = 0x2 - BPF_CGROUP_SOCK_OPS = 0x3 - BPF_SK_SKB_STREAM_PARSER = 0x4 - BPF_SK_SKB_STREAM_VERDICT = 0x5 - BPF_CGROUP_DEVICE = 0x6 - BPF_SK_MSG_VERDICT = 0x7 - BPF_CGROUP_INET4_BIND = 0x8 - BPF_CGROUP_INET6_BIND = 0x9 - BPF_CGROUP_INET4_CONNECT = 0xa - BPF_CGROUP_INET6_CONNECT = 0xb - BPF_CGROUP_INET4_POST_BIND = 0xc - BPF_CGROUP_INET6_POST_BIND = 0xd - BPF_CGROUP_UDP4_SENDMSG = 0xe - BPF_CGROUP_UDP6_SENDMSG = 0xf - BPF_LIRC_MODE2 = 0x10 - BPF_FLOW_DISSECTOR = 0x11 - BPF_CGROUP_SYSCTL = 0x12 - BPF_CGROUP_UDP4_RECVMSG = 0x13 - BPF_CGROUP_UDP6_RECVMSG = 0x14 - BPF_CGROUP_GETSOCKOPT = 0x15 - BPF_CGROUP_SETSOCKOPT = 0x16 - BPF_TRACE_RAW_TP = 0x17 - BPF_TRACE_FENTRY = 0x18 - BPF_TRACE_FEXIT = 0x19 - BPF_MODIFY_RETURN = 0x1a - BPF_LSM_MAC = 0x1b - BPF_ANY = 0x0 - BPF_NOEXIST = 0x1 - BPF_EXIST = 0x2 - BPF_F_LOCK = 0x4 - BPF_F_NO_PREALLOC = 0x1 - BPF_F_NO_COMMON_LRU = 0x2 - BPF_F_NUMA_NODE = 0x4 - BPF_F_RDONLY = 0x8 - BPF_F_WRONLY = 0x10 - BPF_F_STACK_BUILD_ID = 0x20 - BPF_F_ZERO_SEED = 0x40 - BPF_F_RDONLY_PROG = 0x80 - BPF_F_WRONLY_PROG = 0x100 - BPF_F_CLONE = 0x200 - BPF_F_MMAPABLE = 0x400 - BPF_STACK_BUILD_ID_EMPTY = 0x0 - BPF_STACK_BUILD_ID_VALID = 0x1 - BPF_STACK_BUILD_ID_IP = 0x2 - BPF_F_RECOMPUTE_CSUM = 0x1 - BPF_F_INVALIDATE_HASH = 0x2 - BPF_F_HDR_FIELD_MASK = 0xf - BPF_F_PSEUDO_HDR = 0x10 - BPF_F_MARK_MANGLED_0 = 0x20 - BPF_F_MARK_ENFORCE = 0x40 - BPF_F_INGRESS = 0x1 - BPF_F_TUNINFO_IPV6 = 0x1 - BPF_F_SKIP_FIELD_MASK = 0xff - BPF_F_USER_STACK = 0x100 - BPF_F_FAST_STACK_CMP = 0x200 - BPF_F_REUSE_STACKID = 0x400 - BPF_F_USER_BUILD_ID = 0x800 - BPF_F_ZERO_CSUM_TX = 0x2 - BPF_F_DONT_FRAGMENT = 0x4 - BPF_F_SEQ_NUMBER = 0x8 - BPF_F_INDEX_MASK = 0xffffffff - BPF_F_CURRENT_CPU = 0xffffffff - BPF_F_CTXLEN_MASK = 0xfffff00000000 - BPF_F_CURRENT_NETNS = -0x1 - BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 - BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 - BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 - BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 - BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff - BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 - BPF_F_SYSCTL_BASE_NAME = 0x1 - BPF_SK_STORAGE_GET_F_CREATE = 0x1 - BPF_F_GET_BRANCH_RECORDS_SIZE = 0x1 - BPF_ADJ_ROOM_NET = 0x0 - BPF_ADJ_ROOM_MAC = 0x1 - BPF_HDR_START_MAC = 0x0 - BPF_HDR_START_NET = 0x1 - BPF_LWT_ENCAP_SEG6 = 0x0 - BPF_LWT_ENCAP_SEG6_INLINE = 0x1 - BPF_LWT_ENCAP_IP = 0x2 - BPF_OK = 0x0 - BPF_DROP = 0x2 - BPF_REDIRECT = 0x7 - BPF_LWT_REROUTE = 0x80 - BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 - BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 - BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 - BPF_SOCK_OPS_RTT_CB_FLAG = 0x8 - BPF_SOCK_OPS_ALL_CB_FLAGS = 0xf - BPF_SOCK_OPS_VOID = 0x0 - BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 - BPF_SOCK_OPS_RWND_INIT = 0x2 - BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 - BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 - BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 - BPF_SOCK_OPS_NEEDS_ECN = 0x6 - BPF_SOCK_OPS_BASE_RTT = 0x7 - BPF_SOCK_OPS_RTO_CB = 0x8 - BPF_SOCK_OPS_RETRANS_CB = 0x9 - BPF_SOCK_OPS_STATE_CB = 0xa - BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb - BPF_SOCK_OPS_RTT_CB = 0xc - BPF_TCP_ESTABLISHED = 0x1 - BPF_TCP_SYN_SENT = 0x2 - BPF_TCP_SYN_RECV = 0x3 - BPF_TCP_FIN_WAIT1 = 0x4 - BPF_TCP_FIN_WAIT2 = 0x5 - BPF_TCP_TIME_WAIT = 0x6 - BPF_TCP_CLOSE = 0x7 - BPF_TCP_CLOSE_WAIT = 0x8 - BPF_TCP_LAST_ACK = 0x9 - BPF_TCP_LISTEN = 0xa - BPF_TCP_CLOSING = 0xb - BPF_TCP_NEW_SYN_RECV = 0xc - BPF_TCP_MAX_STATES = 0xd - TCP_BPF_IW = 0x3e9 - TCP_BPF_SNDCWND_CLAMP = 0x3ea - BPF_DEVCG_ACC_MKNOD = 0x1 - BPF_DEVCG_ACC_READ = 0x2 - BPF_DEVCG_ACC_WRITE = 0x4 - BPF_DEVCG_DEV_BLOCK = 0x1 - BPF_DEVCG_DEV_CHAR = 0x2 - BPF_FIB_LOOKUP_DIRECT = 0x1 - BPF_FIB_LOOKUP_OUTPUT = 0x2 - BPF_FIB_LKUP_RET_SUCCESS = 0x0 - BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 - BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 - BPF_FIB_LKUP_RET_PROHIBIT = 0x3 - BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 - BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 - BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 - BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 - BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 - BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 - BPF_FD_TYPE_TRACEPOINT = 0x1 - BPF_FD_TYPE_KPROBE = 0x2 - BPF_FD_TYPE_KRETPROBE = 0x3 - BPF_FD_TYPE_UPROBE = 0x4 - BPF_FD_TYPE_URETPROBE = 0x5 - BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = 0x1 - BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = 0x2 - BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = 0x4 + BPF_REG_0 = 0x0 + BPF_REG_1 = 0x1 + BPF_REG_2 = 0x2 + BPF_REG_3 = 0x3 + BPF_REG_4 = 0x4 + BPF_REG_5 = 0x5 + BPF_REG_6 = 0x6 + BPF_REG_7 = 0x7 + BPF_REG_8 = 0x8 + BPF_REG_9 = 0x9 + BPF_REG_10 = 0xa + BPF_MAP_CREATE = 0x0 + BPF_MAP_LOOKUP_ELEM = 0x1 + BPF_MAP_UPDATE_ELEM = 0x2 + BPF_MAP_DELETE_ELEM = 0x3 + BPF_MAP_GET_NEXT_KEY = 0x4 + BPF_PROG_LOAD = 0x5 + BPF_OBJ_PIN = 0x6 + BPF_OBJ_GET = 0x7 + BPF_PROG_ATTACH = 0x8 + BPF_PROG_DETACH = 0x9 + BPF_PROG_TEST_RUN = 0xa + BPF_PROG_GET_NEXT_ID = 0xb + BPF_MAP_GET_NEXT_ID = 0xc + BPF_PROG_GET_FD_BY_ID = 0xd + BPF_MAP_GET_FD_BY_ID = 0xe + BPF_OBJ_GET_INFO_BY_FD = 0xf + BPF_PROG_QUERY = 0x10 + BPF_RAW_TRACEPOINT_OPEN = 0x11 + BPF_BTF_LOAD = 0x12 + BPF_BTF_GET_FD_BY_ID = 0x13 + BPF_TASK_FD_QUERY = 0x14 + BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15 + BPF_MAP_FREEZE = 0x16 + BPF_BTF_GET_NEXT_ID = 0x17 + BPF_MAP_LOOKUP_BATCH = 0x18 + BPF_MAP_LOOKUP_AND_DELETE_BATCH = 0x19 + BPF_MAP_UPDATE_BATCH = 0x1a + BPF_MAP_DELETE_BATCH = 0x1b + BPF_LINK_CREATE = 0x1c + BPF_LINK_UPDATE = 0x1d + BPF_LINK_GET_FD_BY_ID = 0x1e + BPF_LINK_GET_NEXT_ID = 0x1f + BPF_ENABLE_STATS = 0x20 + BPF_ITER_CREATE = 0x21 + BPF_LINK_DETACH = 0x22 + BPF_PROG_BIND_MAP = 0x23 + BPF_MAP_TYPE_UNSPEC = 0x0 + BPF_MAP_TYPE_HASH = 0x1 + BPF_MAP_TYPE_ARRAY = 0x2 + BPF_MAP_TYPE_PROG_ARRAY = 0x3 + BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4 + BPF_MAP_TYPE_PERCPU_HASH = 0x5 + BPF_MAP_TYPE_PERCPU_ARRAY = 0x6 + BPF_MAP_TYPE_STACK_TRACE = 0x7 + BPF_MAP_TYPE_CGROUP_ARRAY = 0x8 + BPF_MAP_TYPE_LRU_HASH = 0x9 + BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa + BPF_MAP_TYPE_LPM_TRIE = 0xb + BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc + BPF_MAP_TYPE_HASH_OF_MAPS = 0xd + BPF_MAP_TYPE_DEVMAP = 0xe + BPF_MAP_TYPE_SOCKMAP = 0xf + BPF_MAP_TYPE_CPUMAP = 0x10 + BPF_MAP_TYPE_XSKMAP = 0x11 + BPF_MAP_TYPE_SOCKHASH = 0x12 + BPF_MAP_TYPE_CGROUP_STORAGE = 0x13 + BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14 + BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15 + BPF_MAP_TYPE_QUEUE = 0x16 + BPF_MAP_TYPE_STACK = 0x17 + BPF_MAP_TYPE_SK_STORAGE = 0x18 + BPF_MAP_TYPE_DEVMAP_HASH = 0x19 + BPF_MAP_TYPE_STRUCT_OPS = 0x1a + BPF_MAP_TYPE_RINGBUF = 0x1b + BPF_MAP_TYPE_INODE_STORAGE = 0x1c + BPF_PROG_TYPE_UNSPEC = 0x0 + BPF_PROG_TYPE_SOCKET_FILTER = 0x1 + BPF_PROG_TYPE_KPROBE = 0x2 + BPF_PROG_TYPE_SCHED_CLS = 0x3 + BPF_PROG_TYPE_SCHED_ACT = 0x4 + BPF_PROG_TYPE_TRACEPOINT = 0x5 + BPF_PROG_TYPE_XDP = 0x6 + BPF_PROG_TYPE_PERF_EVENT = 0x7 + BPF_PROG_TYPE_CGROUP_SKB = 0x8 + BPF_PROG_TYPE_CGROUP_SOCK = 0x9 + BPF_PROG_TYPE_LWT_IN = 0xa + BPF_PROG_TYPE_LWT_OUT = 0xb + BPF_PROG_TYPE_LWT_XMIT = 0xc + BPF_PROG_TYPE_SOCK_OPS = 0xd + BPF_PROG_TYPE_SK_SKB = 0xe + BPF_PROG_TYPE_CGROUP_DEVICE = 0xf + BPF_PROG_TYPE_SK_MSG = 0x10 + BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11 + BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12 + BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13 + BPF_PROG_TYPE_LIRC_MODE2 = 0x14 + BPF_PROG_TYPE_SK_REUSEPORT = 0x15 + BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16 + BPF_PROG_TYPE_CGROUP_SYSCTL = 0x17 + BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE = 0x18 + BPF_PROG_TYPE_CGROUP_SOCKOPT = 0x19 + BPF_PROG_TYPE_TRACING = 0x1a + BPF_PROG_TYPE_STRUCT_OPS = 0x1b + BPF_PROG_TYPE_EXT = 0x1c + BPF_PROG_TYPE_LSM = 0x1d + BPF_PROG_TYPE_SK_LOOKUP = 0x1e + BPF_CGROUP_INET_INGRESS = 0x0 + BPF_CGROUP_INET_EGRESS = 0x1 + BPF_CGROUP_INET_SOCK_CREATE = 0x2 + BPF_CGROUP_SOCK_OPS = 0x3 + BPF_SK_SKB_STREAM_PARSER = 0x4 + BPF_SK_SKB_STREAM_VERDICT = 0x5 + BPF_CGROUP_DEVICE = 0x6 + BPF_SK_MSG_VERDICT = 0x7 + BPF_CGROUP_INET4_BIND = 0x8 + BPF_CGROUP_INET6_BIND = 0x9 + BPF_CGROUP_INET4_CONNECT = 0xa + BPF_CGROUP_INET6_CONNECT = 0xb + BPF_CGROUP_INET4_POST_BIND = 0xc + BPF_CGROUP_INET6_POST_BIND = 0xd + BPF_CGROUP_UDP4_SENDMSG = 0xe + BPF_CGROUP_UDP6_SENDMSG = 0xf + BPF_LIRC_MODE2 = 0x10 + BPF_FLOW_DISSECTOR = 0x11 + BPF_CGROUP_SYSCTL = 0x12 + BPF_CGROUP_UDP4_RECVMSG = 0x13 + BPF_CGROUP_UDP6_RECVMSG = 0x14 + BPF_CGROUP_GETSOCKOPT = 0x15 + BPF_CGROUP_SETSOCKOPT = 0x16 + BPF_TRACE_RAW_TP = 0x17 + BPF_TRACE_FENTRY = 0x18 + BPF_TRACE_FEXIT = 0x19 + BPF_MODIFY_RETURN = 0x1a + BPF_LSM_MAC = 0x1b + BPF_TRACE_ITER = 0x1c + BPF_CGROUP_INET4_GETPEERNAME = 0x1d + BPF_CGROUP_INET6_GETPEERNAME = 0x1e + BPF_CGROUP_INET4_GETSOCKNAME = 0x1f + BPF_CGROUP_INET6_GETSOCKNAME = 0x20 + BPF_XDP_DEVMAP = 0x21 + BPF_CGROUP_INET_SOCK_RELEASE = 0x22 + BPF_XDP_CPUMAP = 0x23 + BPF_SK_LOOKUP = 0x24 + BPF_XDP = 0x25 + BPF_LINK_TYPE_UNSPEC = 0x0 + BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1 + BPF_LINK_TYPE_TRACING = 0x2 + BPF_LINK_TYPE_CGROUP = 0x3 + BPF_LINK_TYPE_ITER = 0x4 + BPF_LINK_TYPE_NETNS = 0x5 + BPF_LINK_TYPE_XDP = 0x6 + BPF_ANY = 0x0 + BPF_NOEXIST = 0x1 + BPF_EXIST = 0x2 + BPF_F_LOCK = 0x4 + BPF_F_NO_PREALLOC = 0x1 + BPF_F_NO_COMMON_LRU = 0x2 + BPF_F_NUMA_NODE = 0x4 + BPF_F_RDONLY = 0x8 + BPF_F_WRONLY = 0x10 + BPF_F_STACK_BUILD_ID = 0x20 + BPF_F_ZERO_SEED = 0x40 + BPF_F_RDONLY_PROG = 0x80 + BPF_F_WRONLY_PROG = 0x100 + BPF_F_CLONE = 0x200 + BPF_F_MMAPABLE = 0x400 + BPF_F_PRESERVE_ELEMS = 0x800 + BPF_F_INNER_MAP = 0x1000 + BPF_STATS_RUN_TIME = 0x0 + BPF_STACK_BUILD_ID_EMPTY = 0x0 + BPF_STACK_BUILD_ID_VALID = 0x1 + BPF_STACK_BUILD_ID_IP = 0x2 + BPF_F_RECOMPUTE_CSUM = 0x1 + BPF_F_INVALIDATE_HASH = 0x2 + BPF_F_HDR_FIELD_MASK = 0xf + BPF_F_PSEUDO_HDR = 0x10 + BPF_F_MARK_MANGLED_0 = 0x20 + BPF_F_MARK_ENFORCE = 0x40 + BPF_F_INGRESS = 0x1 + BPF_F_TUNINFO_IPV6 = 0x1 + BPF_F_SKIP_FIELD_MASK = 0xff + BPF_F_USER_STACK = 0x100 + BPF_F_FAST_STACK_CMP = 0x200 + BPF_F_REUSE_STACKID = 0x400 + BPF_F_USER_BUILD_ID = 0x800 + BPF_F_ZERO_CSUM_TX = 0x2 + BPF_F_DONT_FRAGMENT = 0x4 + BPF_F_SEQ_NUMBER = 0x8 + BPF_F_INDEX_MASK = 0xffffffff + BPF_F_CURRENT_CPU = 0xffffffff + BPF_F_CTXLEN_MASK = 0xfffff00000000 + BPF_F_CURRENT_NETNS = -0x1 + BPF_CSUM_LEVEL_QUERY = 0x0 + BPF_CSUM_LEVEL_INC = 0x1 + BPF_CSUM_LEVEL_DEC = 0x2 + BPF_CSUM_LEVEL_RESET = 0x3 + BPF_F_ADJ_ROOM_FIXED_GSO = 0x1 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2 + BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4 + BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8 + BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10 + BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20 + BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff + BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38 + BPF_F_SYSCTL_BASE_NAME = 0x1 + BPF_LOCAL_STORAGE_GET_F_CREATE = 0x1 + BPF_SK_STORAGE_GET_F_CREATE = 0x1 + BPF_F_GET_BRANCH_RECORDS_SIZE = 0x1 + BPF_RB_NO_WAKEUP = 0x1 + BPF_RB_FORCE_WAKEUP = 0x2 + BPF_RB_AVAIL_DATA = 0x0 + BPF_RB_RING_SIZE = 0x1 + BPF_RB_CONS_POS = 0x2 + BPF_RB_PROD_POS = 0x3 + BPF_RINGBUF_BUSY_BIT = 0x80000000 + BPF_RINGBUF_DISCARD_BIT = 0x40000000 + BPF_RINGBUF_HDR_SZ = 0x8 + BPF_SK_LOOKUP_F_REPLACE = 0x1 + BPF_SK_LOOKUP_F_NO_REUSEPORT = 0x2 + BPF_ADJ_ROOM_NET = 0x0 + BPF_ADJ_ROOM_MAC = 0x1 + BPF_HDR_START_MAC = 0x0 + BPF_HDR_START_NET = 0x1 + BPF_LWT_ENCAP_SEG6 = 0x0 + BPF_LWT_ENCAP_SEG6_INLINE = 0x1 + BPF_LWT_ENCAP_IP = 0x2 + BPF_OK = 0x0 + BPF_DROP = 0x2 + BPF_REDIRECT = 0x7 + BPF_LWT_REROUTE = 0x80 + BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 + BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 + BPF_SOCK_OPS_STATE_CB_FLAG = 0x4 + BPF_SOCK_OPS_RTT_CB_FLAG = 0x8 + BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG = 0x10 + BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG = 0x20 + BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = 0x40 + BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7f + BPF_SOCK_OPS_VOID = 0x0 + BPF_SOCK_OPS_TIMEOUT_INIT = 0x1 + BPF_SOCK_OPS_RWND_INIT = 0x2 + BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3 + BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4 + BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5 + BPF_SOCK_OPS_NEEDS_ECN = 0x6 + BPF_SOCK_OPS_BASE_RTT = 0x7 + BPF_SOCK_OPS_RTO_CB = 0x8 + BPF_SOCK_OPS_RETRANS_CB = 0x9 + BPF_SOCK_OPS_STATE_CB = 0xa + BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb + BPF_SOCK_OPS_RTT_CB = 0xc + BPF_SOCK_OPS_PARSE_HDR_OPT_CB = 0xd + BPF_SOCK_OPS_HDR_OPT_LEN_CB = 0xe + BPF_SOCK_OPS_WRITE_HDR_OPT_CB = 0xf + BPF_TCP_ESTABLISHED = 0x1 + BPF_TCP_SYN_SENT = 0x2 + BPF_TCP_SYN_RECV = 0x3 + BPF_TCP_FIN_WAIT1 = 0x4 + BPF_TCP_FIN_WAIT2 = 0x5 + BPF_TCP_TIME_WAIT = 0x6 + BPF_TCP_CLOSE = 0x7 + BPF_TCP_CLOSE_WAIT = 0x8 + BPF_TCP_LAST_ACK = 0x9 + BPF_TCP_LISTEN = 0xa + BPF_TCP_CLOSING = 0xb + BPF_TCP_NEW_SYN_RECV = 0xc + BPF_TCP_MAX_STATES = 0xd + TCP_BPF_IW = 0x3e9 + TCP_BPF_SNDCWND_CLAMP = 0x3ea + TCP_BPF_DELACK_MAX = 0x3eb + TCP_BPF_RTO_MIN = 0x3ec + TCP_BPF_SYN = 0x3ed + TCP_BPF_SYN_IP = 0x3ee + TCP_BPF_SYN_MAC = 0x3ef + BPF_LOAD_HDR_OPT_TCP_SYN = 0x1 + BPF_WRITE_HDR_TCP_CURRENT_MSS = 0x1 + BPF_WRITE_HDR_TCP_SYNACK_COOKIE = 0x2 + BPF_DEVCG_ACC_MKNOD = 0x1 + BPF_DEVCG_ACC_READ = 0x2 + BPF_DEVCG_ACC_WRITE = 0x4 + BPF_DEVCG_DEV_BLOCK = 0x1 + BPF_DEVCG_DEV_CHAR = 0x2 + BPF_FIB_LOOKUP_DIRECT = 0x1 + BPF_FIB_LOOKUP_OUTPUT = 0x2 + BPF_FIB_LKUP_RET_SUCCESS = 0x0 + BPF_FIB_LKUP_RET_BLACKHOLE = 0x1 + BPF_FIB_LKUP_RET_UNREACHABLE = 0x2 + BPF_FIB_LKUP_RET_PROHIBIT = 0x3 + BPF_FIB_LKUP_RET_NOT_FWDED = 0x4 + BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5 + BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6 + BPF_FIB_LKUP_RET_NO_NEIGH = 0x7 + BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8 + BPF_FD_TYPE_RAW_TRACEPOINT = 0x0 + BPF_FD_TYPE_TRACEPOINT = 0x1 + BPF_FD_TYPE_KPROBE = 0x2 + BPF_FD_TYPE_KRETPROBE = 0x3 + BPF_FD_TYPE_UPROBE = 0x4 + BPF_FD_TYPE_URETPROBE = 0x5 + BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = 0x1 + BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = 0x2 + BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = 0x4 ) const ( @@ -2150,6 +2764,7 @@ const ( RTNLGRP_IPV4_MROUTE_R = 0x1e RTNLGRP_IPV6_MROUTE_R = 0x1f RTNLGRP_NEXTHOP = 0x20 + RTNLGRP_BRVLAN = 0x21 ) type CapUserHeader struct { @@ -2244,132 +2859,320 @@ const ( ) const ( - DEVLINK_CMD_UNSPEC = 0x0 - DEVLINK_CMD_GET = 0x1 - DEVLINK_CMD_SET = 0x2 - DEVLINK_CMD_NEW = 0x3 - DEVLINK_CMD_DEL = 0x4 - DEVLINK_CMD_PORT_GET = 0x5 - DEVLINK_CMD_PORT_SET = 0x6 - DEVLINK_CMD_PORT_NEW = 0x7 - DEVLINK_CMD_PORT_DEL = 0x8 - DEVLINK_CMD_PORT_SPLIT = 0x9 - DEVLINK_CMD_PORT_UNSPLIT = 0xa - DEVLINK_CMD_SB_GET = 0xb - DEVLINK_CMD_SB_SET = 0xc - DEVLINK_CMD_SB_NEW = 0xd - DEVLINK_CMD_SB_DEL = 0xe - DEVLINK_CMD_SB_POOL_GET = 0xf - DEVLINK_CMD_SB_POOL_SET = 0x10 - DEVLINK_CMD_SB_POOL_NEW = 0x11 - DEVLINK_CMD_SB_POOL_DEL = 0x12 - DEVLINK_CMD_SB_PORT_POOL_GET = 0x13 - DEVLINK_CMD_SB_PORT_POOL_SET = 0x14 - DEVLINK_CMD_SB_PORT_POOL_NEW = 0x15 - DEVLINK_CMD_SB_PORT_POOL_DEL = 0x16 - DEVLINK_CMD_SB_TC_POOL_BIND_GET = 0x17 - DEVLINK_CMD_SB_TC_POOL_BIND_SET = 0x18 - DEVLINK_CMD_SB_TC_POOL_BIND_NEW = 0x19 - DEVLINK_CMD_SB_TC_POOL_BIND_DEL = 0x1a - DEVLINK_CMD_SB_OCC_SNAPSHOT = 0x1b - DEVLINK_CMD_SB_OCC_MAX_CLEAR = 0x1c - DEVLINK_CMD_ESWITCH_GET = 0x1d - DEVLINK_CMD_ESWITCH_SET = 0x1e - DEVLINK_CMD_DPIPE_TABLE_GET = 0x1f - DEVLINK_CMD_DPIPE_ENTRIES_GET = 0x20 - DEVLINK_CMD_DPIPE_HEADERS_GET = 0x21 - DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET = 0x22 - DEVLINK_CMD_MAX = 0x48 - DEVLINK_PORT_TYPE_NOTSET = 0x0 - DEVLINK_PORT_TYPE_AUTO = 0x1 - DEVLINK_PORT_TYPE_ETH = 0x2 - DEVLINK_PORT_TYPE_IB = 0x3 - DEVLINK_SB_POOL_TYPE_INGRESS = 0x0 - DEVLINK_SB_POOL_TYPE_EGRESS = 0x1 - DEVLINK_SB_THRESHOLD_TYPE_STATIC = 0x0 - DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC = 0x1 - DEVLINK_ESWITCH_MODE_LEGACY = 0x0 - DEVLINK_ESWITCH_MODE_SWITCHDEV = 0x1 - DEVLINK_ESWITCH_INLINE_MODE_NONE = 0x0 - DEVLINK_ESWITCH_INLINE_MODE_LINK = 0x1 - DEVLINK_ESWITCH_INLINE_MODE_NETWORK = 0x2 - DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT = 0x3 - DEVLINK_ESWITCH_ENCAP_MODE_NONE = 0x0 - DEVLINK_ESWITCH_ENCAP_MODE_BASIC = 0x1 - DEVLINK_ATTR_UNSPEC = 0x0 - DEVLINK_ATTR_BUS_NAME = 0x1 - DEVLINK_ATTR_DEV_NAME = 0x2 - DEVLINK_ATTR_PORT_INDEX = 0x3 - DEVLINK_ATTR_PORT_TYPE = 0x4 - DEVLINK_ATTR_PORT_DESIRED_TYPE = 0x5 - DEVLINK_ATTR_PORT_NETDEV_IFINDEX = 0x6 - DEVLINK_ATTR_PORT_NETDEV_NAME = 0x7 - DEVLINK_ATTR_PORT_IBDEV_NAME = 0x8 - DEVLINK_ATTR_PORT_SPLIT_COUNT = 0x9 - DEVLINK_ATTR_PORT_SPLIT_GROUP = 0xa - DEVLINK_ATTR_SB_INDEX = 0xb - DEVLINK_ATTR_SB_SIZE = 0xc - DEVLINK_ATTR_SB_INGRESS_POOL_COUNT = 0xd - DEVLINK_ATTR_SB_EGRESS_POOL_COUNT = 0xe - DEVLINK_ATTR_SB_INGRESS_TC_COUNT = 0xf - DEVLINK_ATTR_SB_EGRESS_TC_COUNT = 0x10 - DEVLINK_ATTR_SB_POOL_INDEX = 0x11 - DEVLINK_ATTR_SB_POOL_TYPE = 0x12 - DEVLINK_ATTR_SB_POOL_SIZE = 0x13 - DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE = 0x14 - DEVLINK_ATTR_SB_THRESHOLD = 0x15 - DEVLINK_ATTR_SB_TC_INDEX = 0x16 - DEVLINK_ATTR_SB_OCC_CUR = 0x17 - DEVLINK_ATTR_SB_OCC_MAX = 0x18 - DEVLINK_ATTR_ESWITCH_MODE = 0x19 - DEVLINK_ATTR_ESWITCH_INLINE_MODE = 0x1a - DEVLINK_ATTR_DPIPE_TABLES = 0x1b - DEVLINK_ATTR_DPIPE_TABLE = 0x1c - DEVLINK_ATTR_DPIPE_TABLE_NAME = 0x1d - DEVLINK_ATTR_DPIPE_TABLE_SIZE = 0x1e - DEVLINK_ATTR_DPIPE_TABLE_MATCHES = 0x1f - DEVLINK_ATTR_DPIPE_TABLE_ACTIONS = 0x20 - DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED = 0x21 - DEVLINK_ATTR_DPIPE_ENTRIES = 0x22 - DEVLINK_ATTR_DPIPE_ENTRY = 0x23 - DEVLINK_ATTR_DPIPE_ENTRY_INDEX = 0x24 - DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES = 0x25 - DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES = 0x26 - DEVLINK_ATTR_DPIPE_ENTRY_COUNTER = 0x27 - DEVLINK_ATTR_DPIPE_MATCH = 0x28 - DEVLINK_ATTR_DPIPE_MATCH_VALUE = 0x29 - DEVLINK_ATTR_DPIPE_MATCH_TYPE = 0x2a - DEVLINK_ATTR_DPIPE_ACTION = 0x2b - DEVLINK_ATTR_DPIPE_ACTION_VALUE = 0x2c - DEVLINK_ATTR_DPIPE_ACTION_TYPE = 0x2d - DEVLINK_ATTR_DPIPE_VALUE = 0x2e - DEVLINK_ATTR_DPIPE_VALUE_MASK = 0x2f - DEVLINK_ATTR_DPIPE_VALUE_MAPPING = 0x30 - DEVLINK_ATTR_DPIPE_HEADERS = 0x31 - DEVLINK_ATTR_DPIPE_HEADER = 0x32 - DEVLINK_ATTR_DPIPE_HEADER_NAME = 0x33 - DEVLINK_ATTR_DPIPE_HEADER_ID = 0x34 - DEVLINK_ATTR_DPIPE_HEADER_FIELDS = 0x35 - DEVLINK_ATTR_DPIPE_HEADER_GLOBAL = 0x36 - DEVLINK_ATTR_DPIPE_HEADER_INDEX = 0x37 - DEVLINK_ATTR_DPIPE_FIELD = 0x38 - DEVLINK_ATTR_DPIPE_FIELD_NAME = 0x39 - DEVLINK_ATTR_DPIPE_FIELD_ID = 0x3a - DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH = 0x3b - DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE = 0x3c - DEVLINK_ATTR_PAD = 0x3d - DEVLINK_ATTR_ESWITCH_ENCAP_MODE = 0x3e - DEVLINK_ATTR_MAX = 0x90 - DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 - DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 - DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 - DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY = 0x0 - DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC = 0x0 - DEVLINK_DPIPE_FIELD_IPV4_DST_IP = 0x0 - DEVLINK_DPIPE_FIELD_IPV6_DST_IP = 0x0 - DEVLINK_DPIPE_HEADER_ETHERNET = 0x0 - DEVLINK_DPIPE_HEADER_IPV4 = 0x1 - DEVLINK_DPIPE_HEADER_IPV6 = 0x2 + DEVLINK_CMD_UNSPEC = 0x0 + DEVLINK_CMD_GET = 0x1 + DEVLINK_CMD_SET = 0x2 + DEVLINK_CMD_NEW = 0x3 + DEVLINK_CMD_DEL = 0x4 + DEVLINK_CMD_PORT_GET = 0x5 + DEVLINK_CMD_PORT_SET = 0x6 + DEVLINK_CMD_PORT_NEW = 0x7 + DEVLINK_CMD_PORT_DEL = 0x8 + DEVLINK_CMD_PORT_SPLIT = 0x9 + DEVLINK_CMD_PORT_UNSPLIT = 0xa + DEVLINK_CMD_SB_GET = 0xb + DEVLINK_CMD_SB_SET = 0xc + DEVLINK_CMD_SB_NEW = 0xd + DEVLINK_CMD_SB_DEL = 0xe + DEVLINK_CMD_SB_POOL_GET = 0xf + DEVLINK_CMD_SB_POOL_SET = 0x10 + DEVLINK_CMD_SB_POOL_NEW = 0x11 + DEVLINK_CMD_SB_POOL_DEL = 0x12 + DEVLINK_CMD_SB_PORT_POOL_GET = 0x13 + DEVLINK_CMD_SB_PORT_POOL_SET = 0x14 + DEVLINK_CMD_SB_PORT_POOL_NEW = 0x15 + DEVLINK_CMD_SB_PORT_POOL_DEL = 0x16 + DEVLINK_CMD_SB_TC_POOL_BIND_GET = 0x17 + DEVLINK_CMD_SB_TC_POOL_BIND_SET = 0x18 + DEVLINK_CMD_SB_TC_POOL_BIND_NEW = 0x19 + DEVLINK_CMD_SB_TC_POOL_BIND_DEL = 0x1a + DEVLINK_CMD_SB_OCC_SNAPSHOT = 0x1b + DEVLINK_CMD_SB_OCC_MAX_CLEAR = 0x1c + DEVLINK_CMD_ESWITCH_GET = 0x1d + DEVLINK_CMD_ESWITCH_SET = 0x1e + DEVLINK_CMD_DPIPE_TABLE_GET = 0x1f + DEVLINK_CMD_DPIPE_ENTRIES_GET = 0x20 + DEVLINK_CMD_DPIPE_HEADERS_GET = 0x21 + DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET = 0x22 + DEVLINK_CMD_RESOURCE_SET = 0x23 + DEVLINK_CMD_RESOURCE_DUMP = 0x24 + DEVLINK_CMD_RELOAD = 0x25 + DEVLINK_CMD_PARAM_GET = 0x26 + DEVLINK_CMD_PARAM_SET = 0x27 + DEVLINK_CMD_PARAM_NEW = 0x28 + DEVLINK_CMD_PARAM_DEL = 0x29 + DEVLINK_CMD_REGION_GET = 0x2a + DEVLINK_CMD_REGION_SET = 0x2b + DEVLINK_CMD_REGION_NEW = 0x2c + DEVLINK_CMD_REGION_DEL = 0x2d + DEVLINK_CMD_REGION_READ = 0x2e + DEVLINK_CMD_PORT_PARAM_GET = 0x2f + DEVLINK_CMD_PORT_PARAM_SET = 0x30 + DEVLINK_CMD_PORT_PARAM_NEW = 0x31 + DEVLINK_CMD_PORT_PARAM_DEL = 0x32 + DEVLINK_CMD_INFO_GET = 0x33 + DEVLINK_CMD_HEALTH_REPORTER_GET = 0x34 + DEVLINK_CMD_HEALTH_REPORTER_SET = 0x35 + DEVLINK_CMD_HEALTH_REPORTER_RECOVER = 0x36 + DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE = 0x37 + DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET = 0x38 + DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR = 0x39 + DEVLINK_CMD_FLASH_UPDATE = 0x3a + DEVLINK_CMD_FLASH_UPDATE_END = 0x3b + DEVLINK_CMD_FLASH_UPDATE_STATUS = 0x3c + DEVLINK_CMD_TRAP_GET = 0x3d + DEVLINK_CMD_TRAP_SET = 0x3e + DEVLINK_CMD_TRAP_NEW = 0x3f + DEVLINK_CMD_TRAP_DEL = 0x40 + DEVLINK_CMD_TRAP_GROUP_GET = 0x41 + DEVLINK_CMD_TRAP_GROUP_SET = 0x42 + DEVLINK_CMD_TRAP_GROUP_NEW = 0x43 + DEVLINK_CMD_TRAP_GROUP_DEL = 0x44 + DEVLINK_CMD_TRAP_POLICER_GET = 0x45 + DEVLINK_CMD_TRAP_POLICER_SET = 0x46 + DEVLINK_CMD_TRAP_POLICER_NEW = 0x47 + DEVLINK_CMD_TRAP_POLICER_DEL = 0x48 + DEVLINK_CMD_HEALTH_REPORTER_TEST = 0x49 + DEVLINK_CMD_MAX = 0x4d + DEVLINK_PORT_TYPE_NOTSET = 0x0 + DEVLINK_PORT_TYPE_AUTO = 0x1 + DEVLINK_PORT_TYPE_ETH = 0x2 + DEVLINK_PORT_TYPE_IB = 0x3 + DEVLINK_SB_POOL_TYPE_INGRESS = 0x0 + DEVLINK_SB_POOL_TYPE_EGRESS = 0x1 + DEVLINK_SB_THRESHOLD_TYPE_STATIC = 0x0 + DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC = 0x1 + DEVLINK_ESWITCH_MODE_LEGACY = 0x0 + DEVLINK_ESWITCH_MODE_SWITCHDEV = 0x1 + DEVLINK_ESWITCH_INLINE_MODE_NONE = 0x0 + DEVLINK_ESWITCH_INLINE_MODE_LINK = 0x1 + DEVLINK_ESWITCH_INLINE_MODE_NETWORK = 0x2 + DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT = 0x3 + DEVLINK_ESWITCH_ENCAP_MODE_NONE = 0x0 + DEVLINK_ESWITCH_ENCAP_MODE_BASIC = 0x1 + DEVLINK_PORT_FLAVOUR_PHYSICAL = 0x0 + DEVLINK_PORT_FLAVOUR_CPU = 0x1 + DEVLINK_PORT_FLAVOUR_DSA = 0x2 + DEVLINK_PORT_FLAVOUR_PCI_PF = 0x3 + DEVLINK_PORT_FLAVOUR_PCI_VF = 0x4 + DEVLINK_PORT_FLAVOUR_VIRTUAL = 0x5 + DEVLINK_PORT_FLAVOUR_UNUSED = 0x6 + DEVLINK_PARAM_CMODE_RUNTIME = 0x0 + DEVLINK_PARAM_CMODE_DRIVERINIT = 0x1 + DEVLINK_PARAM_CMODE_PERMANENT = 0x2 + DEVLINK_PARAM_CMODE_MAX = 0x2 + DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER = 0x0 + DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH = 0x1 + DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK = 0x2 + DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_UNKNOWN = 0x3 + DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_UNKNOWN = 0x0 + DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_ALWAYS = 0x1 + DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_NEVER = 0x2 + DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK = 0x3 + DEVLINK_ATTR_STATS_RX_PACKETS = 0x0 + DEVLINK_ATTR_STATS_RX_BYTES = 0x1 + DEVLINK_ATTR_STATS_RX_DROPPED = 0x2 + DEVLINK_ATTR_STATS_MAX = 0x2 + DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT = 0x0 + DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT = 0x1 + DEVLINK_FLASH_OVERWRITE_MAX_BIT = 0x1 + DEVLINK_TRAP_ACTION_DROP = 0x0 + DEVLINK_TRAP_ACTION_TRAP = 0x1 + DEVLINK_TRAP_ACTION_MIRROR = 0x2 + DEVLINK_TRAP_TYPE_DROP = 0x0 + DEVLINK_TRAP_TYPE_EXCEPTION = 0x1 + DEVLINK_TRAP_TYPE_CONTROL = 0x2 + DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT = 0x0 + DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE = 0x1 + DEVLINK_RELOAD_ACTION_UNSPEC = 0x0 + DEVLINK_RELOAD_ACTION_DRIVER_REINIT = 0x1 + DEVLINK_RELOAD_ACTION_FW_ACTIVATE = 0x2 + DEVLINK_RELOAD_ACTION_MAX = 0x2 + DEVLINK_RELOAD_LIMIT_UNSPEC = 0x0 + DEVLINK_RELOAD_LIMIT_NO_RESET = 0x1 + DEVLINK_RELOAD_LIMIT_MAX = 0x1 + DEVLINK_ATTR_UNSPEC = 0x0 + DEVLINK_ATTR_BUS_NAME = 0x1 + DEVLINK_ATTR_DEV_NAME = 0x2 + DEVLINK_ATTR_PORT_INDEX = 0x3 + DEVLINK_ATTR_PORT_TYPE = 0x4 + DEVLINK_ATTR_PORT_DESIRED_TYPE = 0x5 + DEVLINK_ATTR_PORT_NETDEV_IFINDEX = 0x6 + DEVLINK_ATTR_PORT_NETDEV_NAME = 0x7 + DEVLINK_ATTR_PORT_IBDEV_NAME = 0x8 + DEVLINK_ATTR_PORT_SPLIT_COUNT = 0x9 + DEVLINK_ATTR_PORT_SPLIT_GROUP = 0xa + DEVLINK_ATTR_SB_INDEX = 0xb + DEVLINK_ATTR_SB_SIZE = 0xc + DEVLINK_ATTR_SB_INGRESS_POOL_COUNT = 0xd + DEVLINK_ATTR_SB_EGRESS_POOL_COUNT = 0xe + DEVLINK_ATTR_SB_INGRESS_TC_COUNT = 0xf + DEVLINK_ATTR_SB_EGRESS_TC_COUNT = 0x10 + DEVLINK_ATTR_SB_POOL_INDEX = 0x11 + DEVLINK_ATTR_SB_POOL_TYPE = 0x12 + DEVLINK_ATTR_SB_POOL_SIZE = 0x13 + DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE = 0x14 + DEVLINK_ATTR_SB_THRESHOLD = 0x15 + DEVLINK_ATTR_SB_TC_INDEX = 0x16 + DEVLINK_ATTR_SB_OCC_CUR = 0x17 + DEVLINK_ATTR_SB_OCC_MAX = 0x18 + DEVLINK_ATTR_ESWITCH_MODE = 0x19 + DEVLINK_ATTR_ESWITCH_INLINE_MODE = 0x1a + DEVLINK_ATTR_DPIPE_TABLES = 0x1b + DEVLINK_ATTR_DPIPE_TABLE = 0x1c + DEVLINK_ATTR_DPIPE_TABLE_NAME = 0x1d + DEVLINK_ATTR_DPIPE_TABLE_SIZE = 0x1e + DEVLINK_ATTR_DPIPE_TABLE_MATCHES = 0x1f + DEVLINK_ATTR_DPIPE_TABLE_ACTIONS = 0x20 + DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED = 0x21 + DEVLINK_ATTR_DPIPE_ENTRIES = 0x22 + DEVLINK_ATTR_DPIPE_ENTRY = 0x23 + DEVLINK_ATTR_DPIPE_ENTRY_INDEX = 0x24 + DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES = 0x25 + DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES = 0x26 + DEVLINK_ATTR_DPIPE_ENTRY_COUNTER = 0x27 + DEVLINK_ATTR_DPIPE_MATCH = 0x28 + DEVLINK_ATTR_DPIPE_MATCH_VALUE = 0x29 + DEVLINK_ATTR_DPIPE_MATCH_TYPE = 0x2a + DEVLINK_ATTR_DPIPE_ACTION = 0x2b + DEVLINK_ATTR_DPIPE_ACTION_VALUE = 0x2c + DEVLINK_ATTR_DPIPE_ACTION_TYPE = 0x2d + DEVLINK_ATTR_DPIPE_VALUE = 0x2e + DEVLINK_ATTR_DPIPE_VALUE_MASK = 0x2f + DEVLINK_ATTR_DPIPE_VALUE_MAPPING = 0x30 + DEVLINK_ATTR_DPIPE_HEADERS = 0x31 + DEVLINK_ATTR_DPIPE_HEADER = 0x32 + DEVLINK_ATTR_DPIPE_HEADER_NAME = 0x33 + DEVLINK_ATTR_DPIPE_HEADER_ID = 0x34 + DEVLINK_ATTR_DPIPE_HEADER_FIELDS = 0x35 + DEVLINK_ATTR_DPIPE_HEADER_GLOBAL = 0x36 + DEVLINK_ATTR_DPIPE_HEADER_INDEX = 0x37 + DEVLINK_ATTR_DPIPE_FIELD = 0x38 + DEVLINK_ATTR_DPIPE_FIELD_NAME = 0x39 + DEVLINK_ATTR_DPIPE_FIELD_ID = 0x3a + DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH = 0x3b + DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE = 0x3c + DEVLINK_ATTR_PAD = 0x3d + DEVLINK_ATTR_ESWITCH_ENCAP_MODE = 0x3e + DEVLINK_ATTR_RESOURCE_LIST = 0x3f + DEVLINK_ATTR_RESOURCE = 0x40 + DEVLINK_ATTR_RESOURCE_NAME = 0x41 + DEVLINK_ATTR_RESOURCE_ID = 0x42 + DEVLINK_ATTR_RESOURCE_SIZE = 0x43 + DEVLINK_ATTR_RESOURCE_SIZE_NEW = 0x44 + DEVLINK_ATTR_RESOURCE_SIZE_VALID = 0x45 + DEVLINK_ATTR_RESOURCE_SIZE_MIN = 0x46 + DEVLINK_ATTR_RESOURCE_SIZE_MAX = 0x47 + DEVLINK_ATTR_RESOURCE_SIZE_GRAN = 0x48 + DEVLINK_ATTR_RESOURCE_UNIT = 0x49 + DEVLINK_ATTR_RESOURCE_OCC = 0x4a + DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID = 0x4b + DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS = 0x4c + DEVLINK_ATTR_PORT_FLAVOUR = 0x4d + DEVLINK_ATTR_PORT_NUMBER = 0x4e + DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER = 0x4f + DEVLINK_ATTR_PARAM = 0x50 + DEVLINK_ATTR_PARAM_NAME = 0x51 + DEVLINK_ATTR_PARAM_GENERIC = 0x52 + DEVLINK_ATTR_PARAM_TYPE = 0x53 + DEVLINK_ATTR_PARAM_VALUES_LIST = 0x54 + DEVLINK_ATTR_PARAM_VALUE = 0x55 + DEVLINK_ATTR_PARAM_VALUE_DATA = 0x56 + DEVLINK_ATTR_PARAM_VALUE_CMODE = 0x57 + DEVLINK_ATTR_REGION_NAME = 0x58 + DEVLINK_ATTR_REGION_SIZE = 0x59 + DEVLINK_ATTR_REGION_SNAPSHOTS = 0x5a + DEVLINK_ATTR_REGION_SNAPSHOT = 0x5b + DEVLINK_ATTR_REGION_SNAPSHOT_ID = 0x5c + DEVLINK_ATTR_REGION_CHUNKS = 0x5d + DEVLINK_ATTR_REGION_CHUNK = 0x5e + DEVLINK_ATTR_REGION_CHUNK_DATA = 0x5f + DEVLINK_ATTR_REGION_CHUNK_ADDR = 0x60 + DEVLINK_ATTR_REGION_CHUNK_LEN = 0x61 + DEVLINK_ATTR_INFO_DRIVER_NAME = 0x62 + DEVLINK_ATTR_INFO_SERIAL_NUMBER = 0x63 + DEVLINK_ATTR_INFO_VERSION_FIXED = 0x64 + DEVLINK_ATTR_INFO_VERSION_RUNNING = 0x65 + DEVLINK_ATTR_INFO_VERSION_STORED = 0x66 + DEVLINK_ATTR_INFO_VERSION_NAME = 0x67 + DEVLINK_ATTR_INFO_VERSION_VALUE = 0x68 + DEVLINK_ATTR_SB_POOL_CELL_SIZE = 0x69 + DEVLINK_ATTR_FMSG = 0x6a + DEVLINK_ATTR_FMSG_OBJ_NEST_START = 0x6b + DEVLINK_ATTR_FMSG_PAIR_NEST_START = 0x6c + DEVLINK_ATTR_FMSG_ARR_NEST_START = 0x6d + DEVLINK_ATTR_FMSG_NEST_END = 0x6e + DEVLINK_ATTR_FMSG_OBJ_NAME = 0x6f + DEVLINK_ATTR_FMSG_OBJ_VALUE_TYPE = 0x70 + DEVLINK_ATTR_FMSG_OBJ_VALUE_DATA = 0x71 + DEVLINK_ATTR_HEALTH_REPORTER = 0x72 + DEVLINK_ATTR_HEALTH_REPORTER_NAME = 0x73 + DEVLINK_ATTR_HEALTH_REPORTER_STATE = 0x74 + DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT = 0x75 + DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT = 0x76 + DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS = 0x77 + DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD = 0x78 + DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER = 0x79 + DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME = 0x7a + DEVLINK_ATTR_FLASH_UPDATE_COMPONENT = 0x7b + DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG = 0x7c + DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE = 0x7d + DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL = 0x7e + DEVLINK_ATTR_PORT_PCI_PF_NUMBER = 0x7f + DEVLINK_ATTR_PORT_PCI_VF_NUMBER = 0x80 + DEVLINK_ATTR_STATS = 0x81 + DEVLINK_ATTR_TRAP_NAME = 0x82 + DEVLINK_ATTR_TRAP_ACTION = 0x83 + DEVLINK_ATTR_TRAP_TYPE = 0x84 + DEVLINK_ATTR_TRAP_GENERIC = 0x85 + DEVLINK_ATTR_TRAP_METADATA = 0x86 + DEVLINK_ATTR_TRAP_GROUP_NAME = 0x87 + DEVLINK_ATTR_RELOAD_FAILED = 0x88 + DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS = 0x89 + DEVLINK_ATTR_NETNS_FD = 0x8a + DEVLINK_ATTR_NETNS_PID = 0x8b + DEVLINK_ATTR_NETNS_ID = 0x8c + DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP = 0x8d + DEVLINK_ATTR_TRAP_POLICER_ID = 0x8e + DEVLINK_ATTR_TRAP_POLICER_RATE = 0x8f + DEVLINK_ATTR_TRAP_POLICER_BURST = 0x90 + DEVLINK_ATTR_PORT_FUNCTION = 0x91 + DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER = 0x92 + DEVLINK_ATTR_PORT_LANES = 0x93 + DEVLINK_ATTR_PORT_SPLITTABLE = 0x94 + DEVLINK_ATTR_PORT_EXTERNAL = 0x95 + DEVLINK_ATTR_PORT_CONTROLLER_NUMBER = 0x96 + DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT = 0x97 + DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK = 0x98 + DEVLINK_ATTR_RELOAD_ACTION = 0x99 + DEVLINK_ATTR_RELOAD_ACTIONS_PERFORMED = 0x9a + DEVLINK_ATTR_RELOAD_LIMITS = 0x9b + DEVLINK_ATTR_DEV_STATS = 0x9c + DEVLINK_ATTR_RELOAD_STATS = 0x9d + DEVLINK_ATTR_RELOAD_STATS_ENTRY = 0x9e + DEVLINK_ATTR_RELOAD_STATS_LIMIT = 0x9f + DEVLINK_ATTR_RELOAD_STATS_VALUE = 0xa0 + DEVLINK_ATTR_REMOTE_RELOAD_STATS = 0xa1 + DEVLINK_ATTR_RELOAD_ACTION_INFO = 0xa2 + DEVLINK_ATTR_RELOAD_ACTION_STATS = 0xa3 + DEVLINK_ATTR_PORT_PCI_SF_NUMBER = 0xa4 + DEVLINK_ATTR_MAX = 0xa9 + DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 + DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 + DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 + DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY = 0x0 + DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC = 0x0 + DEVLINK_DPIPE_FIELD_IPV4_DST_IP = 0x0 + DEVLINK_DPIPE_FIELD_IPV6_DST_IP = 0x0 + DEVLINK_DPIPE_HEADER_ETHERNET = 0x0 + DEVLINK_DPIPE_HEADER_IPV4 = 0x1 + DEVLINK_DPIPE_HEADER_IPV6 = 0x2 + DEVLINK_RESOURCE_UNIT_ENTRY = 0x0 + DEVLINK_PORT_FUNCTION_ATTR_UNSPEC = 0x0 + DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR = 0x1 + DEVLINK_PORT_FN_ATTR_STATE = 0x2 + DEVLINK_PORT_FN_ATTR_OPSTATE = 0x3 + DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x3 ) type FsverityDigest struct { @@ -2417,3 +3220,739 @@ const ( NHA_GROUPS = 0x9 NHA_MASTER = 0xa ) + +const ( + CAN_RAW_FILTER = 0x1 + CAN_RAW_ERR_FILTER = 0x2 + CAN_RAW_LOOPBACK = 0x3 + CAN_RAW_RECV_OWN_MSGS = 0x4 + CAN_RAW_FD_FRAMES = 0x5 + CAN_RAW_JOIN_FILTERS = 0x6 +) + +type WatchdogInfo struct { + Options uint32 + Version uint32 + Identity [32]uint8 +} + +type PPSFData struct { + Info PPSKInfo + Timeout PPSKTime +} + +type PPSKParams struct { + Api_version int32 + Mode int32 + Assert_off_tu PPSKTime + Clear_off_tu PPSKTime +} + +type PPSKTime struct { + Sec int64 + Nsec int32 + Flags uint32 +} + +const ( + LWTUNNEL_ENCAP_NONE = 0x0 + LWTUNNEL_ENCAP_MPLS = 0x1 + LWTUNNEL_ENCAP_IP = 0x2 + LWTUNNEL_ENCAP_ILA = 0x3 + LWTUNNEL_ENCAP_IP6 = 0x4 + LWTUNNEL_ENCAP_SEG6 = 0x5 + LWTUNNEL_ENCAP_BPF = 0x6 + LWTUNNEL_ENCAP_SEG6_LOCAL = 0x7 + LWTUNNEL_ENCAP_RPL = 0x8 + LWTUNNEL_ENCAP_MAX = 0x8 + + MPLS_IPTUNNEL_UNSPEC = 0x0 + MPLS_IPTUNNEL_DST = 0x1 + MPLS_IPTUNNEL_TTL = 0x2 + MPLS_IPTUNNEL_MAX = 0x2 +) + +const ( + ETHTOOL_ID_UNSPEC = 0x0 + ETHTOOL_RX_COPYBREAK = 0x1 + ETHTOOL_TX_COPYBREAK = 0x2 + ETHTOOL_PFC_PREVENTION_TOUT = 0x3 + ETHTOOL_TUNABLE_UNSPEC = 0x0 + ETHTOOL_TUNABLE_U8 = 0x1 + ETHTOOL_TUNABLE_U16 = 0x2 + ETHTOOL_TUNABLE_U32 = 0x3 + ETHTOOL_TUNABLE_U64 = 0x4 + ETHTOOL_TUNABLE_STRING = 0x5 + ETHTOOL_TUNABLE_S8 = 0x6 + ETHTOOL_TUNABLE_S16 = 0x7 + ETHTOOL_TUNABLE_S32 = 0x8 + ETHTOOL_TUNABLE_S64 = 0x9 + ETHTOOL_PHY_ID_UNSPEC = 0x0 + ETHTOOL_PHY_DOWNSHIFT = 0x1 + ETHTOOL_PHY_FAST_LINK_DOWN = 0x2 + ETHTOOL_PHY_EDPD = 0x3 + ETHTOOL_LINK_EXT_STATE_AUTONEG = 0x0 + ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE = 0x1 + ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH = 0x2 + ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY = 0x3 + ETHTOOL_LINK_EXT_STATE_NO_CABLE = 0x4 + ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE = 0x5 + ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE = 0x6 + ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE = 0x7 + ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED = 0x8 + ETHTOOL_LINK_EXT_STATE_OVERHEAT = 0x9 + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 0x1 + ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED = 0x2 + ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED = 0x3 + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE = 0x4 + ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE = 0x5 + ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD = 0x6 + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 0x1 + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT = 0x2 + ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY = 0x3 + ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT = 0x4 + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 0x1 + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK = 0x2 + ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS = 0x3 + ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED = 0x4 + ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED = 0x5 + ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 0x1 + ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE = 0x2 + ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 0x1 + ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE = 0x2 + ETHTOOL_FLASH_ALL_REGIONS = 0x0 + ETHTOOL_F_UNSUPPORTED__BIT = 0x0 + ETHTOOL_F_WISH__BIT = 0x1 + ETHTOOL_F_COMPAT__BIT = 0x2 + ETHTOOL_FEC_NONE_BIT = 0x0 + ETHTOOL_FEC_AUTO_BIT = 0x1 + ETHTOOL_FEC_OFF_BIT = 0x2 + ETHTOOL_FEC_RS_BIT = 0x3 + ETHTOOL_FEC_BASER_BIT = 0x4 + ETHTOOL_FEC_LLRS_BIT = 0x5 + ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0x0 + ETHTOOL_LINK_MODE_10baseT_Full_BIT = 0x1 + ETHTOOL_LINK_MODE_100baseT_Half_BIT = 0x2 + ETHTOOL_LINK_MODE_100baseT_Full_BIT = 0x3 + ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 0x4 + ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 0x5 + ETHTOOL_LINK_MODE_Autoneg_BIT = 0x6 + ETHTOOL_LINK_MODE_TP_BIT = 0x7 + ETHTOOL_LINK_MODE_AUI_BIT = 0x8 + ETHTOOL_LINK_MODE_MII_BIT = 0x9 + ETHTOOL_LINK_MODE_FIBRE_BIT = 0xa + ETHTOOL_LINK_MODE_BNC_BIT = 0xb + ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 0xc + ETHTOOL_LINK_MODE_Pause_BIT = 0xd + ETHTOOL_LINK_MODE_Asym_Pause_BIT = 0xe + ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 0xf + ETHTOOL_LINK_MODE_Backplane_BIT = 0x10 + ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 0x11 + ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 0x12 + ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 0x13 + ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 0x14 + ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 0x15 + ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 0x16 + ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 0x17 + ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 0x18 + ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 0x19 + ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 0x1a + ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 0x1b + ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 0x1c + ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 0x1d + ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 0x1e + ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 0x1f + ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 0x20 + ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 0x21 + ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 0x22 + ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 0x23 + ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 0x24 + ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 0x25 + ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 0x26 + ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 0x27 + ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 0x28 + ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 0x29 + ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 0x2a + ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 0x2b + ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 0x2c + ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 0x2d + ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 0x2e + ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 0x2f + ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 0x30 + ETHTOOL_LINK_MODE_FEC_NONE_BIT = 0x31 + ETHTOOL_LINK_MODE_FEC_RS_BIT = 0x32 + ETHTOOL_LINK_MODE_FEC_BASER_BIT = 0x33 + ETHTOOL_LINK_MODE_50000baseKR_Full_BIT = 0x34 + ETHTOOL_LINK_MODE_50000baseSR_Full_BIT = 0x35 + ETHTOOL_LINK_MODE_50000baseCR_Full_BIT = 0x36 + ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT = 0x37 + ETHTOOL_LINK_MODE_50000baseDR_Full_BIT = 0x38 + ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT = 0x39 + ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT = 0x3a + ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT = 0x3b + ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 0x3c + ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT = 0x3d + ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT = 0x3e + ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT = 0x3f + ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 0x40 + ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 0x41 + ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 0x42 + ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 0x43 + ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 0x44 + ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT = 0x45 + ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT = 0x46 + ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 0x47 + ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 0x48 + ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 0x49 + ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 0x4a + ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 0x4b + ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 0x4c + ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 0x4d + ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 0x4e + ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 0x4f + ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 0x50 + ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 0x51 + ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 0x52 + ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 0x53 + ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 0x54 + ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 0x55 + ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 0x56 + ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 0x57 + ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 0x58 + ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 0x59 + ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 0x5a + ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 0x5b + + ETHTOOL_MSG_USER_NONE = 0x0 + ETHTOOL_MSG_STRSET_GET = 0x1 + ETHTOOL_MSG_LINKINFO_GET = 0x2 + ETHTOOL_MSG_LINKINFO_SET = 0x3 + ETHTOOL_MSG_LINKMODES_GET = 0x4 + ETHTOOL_MSG_LINKMODES_SET = 0x5 + ETHTOOL_MSG_LINKSTATE_GET = 0x6 + ETHTOOL_MSG_DEBUG_GET = 0x7 + ETHTOOL_MSG_DEBUG_SET = 0x8 + ETHTOOL_MSG_WOL_GET = 0x9 + ETHTOOL_MSG_WOL_SET = 0xa + ETHTOOL_MSG_FEATURES_GET = 0xb + ETHTOOL_MSG_FEATURES_SET = 0xc + ETHTOOL_MSG_PRIVFLAGS_GET = 0xd + ETHTOOL_MSG_PRIVFLAGS_SET = 0xe + ETHTOOL_MSG_RINGS_GET = 0xf + ETHTOOL_MSG_RINGS_SET = 0x10 + ETHTOOL_MSG_CHANNELS_GET = 0x11 + ETHTOOL_MSG_CHANNELS_SET = 0x12 + ETHTOOL_MSG_COALESCE_GET = 0x13 + ETHTOOL_MSG_COALESCE_SET = 0x14 + ETHTOOL_MSG_PAUSE_GET = 0x15 + ETHTOOL_MSG_PAUSE_SET = 0x16 + ETHTOOL_MSG_EEE_GET = 0x17 + ETHTOOL_MSG_EEE_SET = 0x18 + ETHTOOL_MSG_TSINFO_GET = 0x19 + ETHTOOL_MSG_CABLE_TEST_ACT = 0x1a + ETHTOOL_MSG_CABLE_TEST_TDR_ACT = 0x1b + ETHTOOL_MSG_TUNNEL_INFO_GET = 0x1c + ETHTOOL_MSG_USER_MAX = 0x21 + ETHTOOL_MSG_KERNEL_NONE = 0x0 + ETHTOOL_MSG_STRSET_GET_REPLY = 0x1 + ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2 + ETHTOOL_MSG_LINKINFO_NTF = 0x3 + ETHTOOL_MSG_LINKMODES_GET_REPLY = 0x4 + ETHTOOL_MSG_LINKMODES_NTF = 0x5 + ETHTOOL_MSG_LINKSTATE_GET_REPLY = 0x6 + ETHTOOL_MSG_DEBUG_GET_REPLY = 0x7 + ETHTOOL_MSG_DEBUG_NTF = 0x8 + ETHTOOL_MSG_WOL_GET_REPLY = 0x9 + ETHTOOL_MSG_WOL_NTF = 0xa + ETHTOOL_MSG_FEATURES_GET_REPLY = 0xb + ETHTOOL_MSG_FEATURES_SET_REPLY = 0xc + ETHTOOL_MSG_FEATURES_NTF = 0xd + ETHTOOL_MSG_PRIVFLAGS_GET_REPLY = 0xe + ETHTOOL_MSG_PRIVFLAGS_NTF = 0xf + ETHTOOL_MSG_RINGS_GET_REPLY = 0x10 + ETHTOOL_MSG_RINGS_NTF = 0x11 + ETHTOOL_MSG_CHANNELS_GET_REPLY = 0x12 + ETHTOOL_MSG_CHANNELS_NTF = 0x13 + ETHTOOL_MSG_COALESCE_GET_REPLY = 0x14 + ETHTOOL_MSG_COALESCE_NTF = 0x15 + ETHTOOL_MSG_PAUSE_GET_REPLY = 0x16 + ETHTOOL_MSG_PAUSE_NTF = 0x17 + ETHTOOL_MSG_EEE_GET_REPLY = 0x18 + ETHTOOL_MSG_EEE_NTF = 0x19 + ETHTOOL_MSG_TSINFO_GET_REPLY = 0x1a + ETHTOOL_MSG_CABLE_TEST_NTF = 0x1b + ETHTOOL_MSG_CABLE_TEST_TDR_NTF = 0x1c + ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY = 0x1d + ETHTOOL_MSG_KERNEL_MAX = 0x22 + ETHTOOL_A_HEADER_UNSPEC = 0x0 + ETHTOOL_A_HEADER_DEV_INDEX = 0x1 + ETHTOOL_A_HEADER_DEV_NAME = 0x2 + ETHTOOL_A_HEADER_FLAGS = 0x3 + ETHTOOL_A_HEADER_MAX = 0x3 + ETHTOOL_A_BITSET_BIT_UNSPEC = 0x0 + ETHTOOL_A_BITSET_BIT_INDEX = 0x1 + ETHTOOL_A_BITSET_BIT_NAME = 0x2 + ETHTOOL_A_BITSET_BIT_VALUE = 0x3 + ETHTOOL_A_BITSET_BIT_MAX = 0x3 + ETHTOOL_A_BITSET_BITS_UNSPEC = 0x0 + ETHTOOL_A_BITSET_BITS_BIT = 0x1 + ETHTOOL_A_BITSET_BITS_MAX = 0x1 + ETHTOOL_A_BITSET_UNSPEC = 0x0 + ETHTOOL_A_BITSET_NOMASK = 0x1 + ETHTOOL_A_BITSET_SIZE = 0x2 + ETHTOOL_A_BITSET_BITS = 0x3 + ETHTOOL_A_BITSET_VALUE = 0x4 + ETHTOOL_A_BITSET_MASK = 0x5 + ETHTOOL_A_BITSET_MAX = 0x5 + ETHTOOL_A_STRING_UNSPEC = 0x0 + ETHTOOL_A_STRING_INDEX = 0x1 + ETHTOOL_A_STRING_VALUE = 0x2 + ETHTOOL_A_STRING_MAX = 0x2 + ETHTOOL_A_STRINGS_UNSPEC = 0x0 + ETHTOOL_A_STRINGS_STRING = 0x1 + ETHTOOL_A_STRINGS_MAX = 0x1 + ETHTOOL_A_STRINGSET_UNSPEC = 0x0 + ETHTOOL_A_STRINGSET_ID = 0x1 + ETHTOOL_A_STRINGSET_COUNT = 0x2 + ETHTOOL_A_STRINGSET_STRINGS = 0x3 + ETHTOOL_A_STRINGSET_MAX = 0x3 + ETHTOOL_A_STRINGSETS_UNSPEC = 0x0 + ETHTOOL_A_STRINGSETS_STRINGSET = 0x1 + ETHTOOL_A_STRINGSETS_MAX = 0x1 + ETHTOOL_A_STRSET_UNSPEC = 0x0 + ETHTOOL_A_STRSET_HEADER = 0x1 + ETHTOOL_A_STRSET_STRINGSETS = 0x2 + ETHTOOL_A_STRSET_COUNTS_ONLY = 0x3 + ETHTOOL_A_STRSET_MAX = 0x3 + ETHTOOL_A_LINKINFO_UNSPEC = 0x0 + ETHTOOL_A_LINKINFO_HEADER = 0x1 + ETHTOOL_A_LINKINFO_PORT = 0x2 + ETHTOOL_A_LINKINFO_PHYADDR = 0x3 + ETHTOOL_A_LINKINFO_TP_MDIX = 0x4 + ETHTOOL_A_LINKINFO_TP_MDIX_CTRL = 0x5 + ETHTOOL_A_LINKINFO_TRANSCEIVER = 0x6 + ETHTOOL_A_LINKINFO_MAX = 0x6 + ETHTOOL_A_LINKMODES_UNSPEC = 0x0 + ETHTOOL_A_LINKMODES_HEADER = 0x1 + ETHTOOL_A_LINKMODES_AUTONEG = 0x2 + ETHTOOL_A_LINKMODES_OURS = 0x3 + ETHTOOL_A_LINKMODES_PEER = 0x4 + ETHTOOL_A_LINKMODES_SPEED = 0x5 + ETHTOOL_A_LINKMODES_DUPLEX = 0x6 + ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG = 0x7 + ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE = 0x8 + ETHTOOL_A_LINKMODES_LANES = 0x9 + ETHTOOL_A_LINKMODES_MAX = 0x9 + ETHTOOL_A_LINKSTATE_UNSPEC = 0x0 + ETHTOOL_A_LINKSTATE_HEADER = 0x1 + ETHTOOL_A_LINKSTATE_LINK = 0x2 + ETHTOOL_A_LINKSTATE_SQI = 0x3 + ETHTOOL_A_LINKSTATE_SQI_MAX = 0x4 + ETHTOOL_A_LINKSTATE_EXT_STATE = 0x5 + ETHTOOL_A_LINKSTATE_EXT_SUBSTATE = 0x6 + ETHTOOL_A_LINKSTATE_MAX = 0x6 + ETHTOOL_A_DEBUG_UNSPEC = 0x0 + ETHTOOL_A_DEBUG_HEADER = 0x1 + ETHTOOL_A_DEBUG_MSGMASK = 0x2 + ETHTOOL_A_DEBUG_MAX = 0x2 + ETHTOOL_A_WOL_UNSPEC = 0x0 + ETHTOOL_A_WOL_HEADER = 0x1 + ETHTOOL_A_WOL_MODES = 0x2 + ETHTOOL_A_WOL_SOPASS = 0x3 + ETHTOOL_A_WOL_MAX = 0x3 + ETHTOOL_A_FEATURES_UNSPEC = 0x0 + ETHTOOL_A_FEATURES_HEADER = 0x1 + ETHTOOL_A_FEATURES_HW = 0x2 + ETHTOOL_A_FEATURES_WANTED = 0x3 + ETHTOOL_A_FEATURES_ACTIVE = 0x4 + ETHTOOL_A_FEATURES_NOCHANGE = 0x5 + ETHTOOL_A_FEATURES_MAX = 0x5 + ETHTOOL_A_PRIVFLAGS_UNSPEC = 0x0 + ETHTOOL_A_PRIVFLAGS_HEADER = 0x1 + ETHTOOL_A_PRIVFLAGS_FLAGS = 0x2 + ETHTOOL_A_PRIVFLAGS_MAX = 0x2 + ETHTOOL_A_RINGS_UNSPEC = 0x0 + ETHTOOL_A_RINGS_HEADER = 0x1 + ETHTOOL_A_RINGS_RX_MAX = 0x2 + ETHTOOL_A_RINGS_RX_MINI_MAX = 0x3 + ETHTOOL_A_RINGS_RX_JUMBO_MAX = 0x4 + ETHTOOL_A_RINGS_TX_MAX = 0x5 + ETHTOOL_A_RINGS_RX = 0x6 + ETHTOOL_A_RINGS_RX_MINI = 0x7 + ETHTOOL_A_RINGS_RX_JUMBO = 0x8 + ETHTOOL_A_RINGS_TX = 0x9 + ETHTOOL_A_RINGS_MAX = 0x9 + ETHTOOL_A_CHANNELS_UNSPEC = 0x0 + ETHTOOL_A_CHANNELS_HEADER = 0x1 + ETHTOOL_A_CHANNELS_RX_MAX = 0x2 + ETHTOOL_A_CHANNELS_TX_MAX = 0x3 + ETHTOOL_A_CHANNELS_OTHER_MAX = 0x4 + ETHTOOL_A_CHANNELS_COMBINED_MAX = 0x5 + ETHTOOL_A_CHANNELS_RX_COUNT = 0x6 + ETHTOOL_A_CHANNELS_TX_COUNT = 0x7 + ETHTOOL_A_CHANNELS_OTHER_COUNT = 0x8 + ETHTOOL_A_CHANNELS_COMBINED_COUNT = 0x9 + ETHTOOL_A_CHANNELS_MAX = 0x9 + ETHTOOL_A_COALESCE_UNSPEC = 0x0 + ETHTOOL_A_COALESCE_HEADER = 0x1 + ETHTOOL_A_COALESCE_RX_USECS = 0x2 + ETHTOOL_A_COALESCE_RX_MAX_FRAMES = 0x3 + ETHTOOL_A_COALESCE_RX_USECS_IRQ = 0x4 + ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ = 0x5 + ETHTOOL_A_COALESCE_TX_USECS = 0x6 + ETHTOOL_A_COALESCE_TX_MAX_FRAMES = 0x7 + ETHTOOL_A_COALESCE_TX_USECS_IRQ = 0x8 + ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ = 0x9 + ETHTOOL_A_COALESCE_STATS_BLOCK_USECS = 0xa + ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX = 0xb + ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX = 0xc + ETHTOOL_A_COALESCE_PKT_RATE_LOW = 0xd + ETHTOOL_A_COALESCE_RX_USECS_LOW = 0xe + ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW = 0xf + ETHTOOL_A_COALESCE_TX_USECS_LOW = 0x10 + ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW = 0x11 + ETHTOOL_A_COALESCE_PKT_RATE_HIGH = 0x12 + ETHTOOL_A_COALESCE_RX_USECS_HIGH = 0x13 + ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH = 0x14 + ETHTOOL_A_COALESCE_TX_USECS_HIGH = 0x15 + ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH = 0x16 + ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17 + ETHTOOL_A_COALESCE_MAX = 0x17 + ETHTOOL_A_PAUSE_UNSPEC = 0x0 + ETHTOOL_A_PAUSE_HEADER = 0x1 + ETHTOOL_A_PAUSE_AUTONEG = 0x2 + ETHTOOL_A_PAUSE_RX = 0x3 + ETHTOOL_A_PAUSE_TX = 0x4 + ETHTOOL_A_PAUSE_STATS = 0x5 + ETHTOOL_A_PAUSE_MAX = 0x5 + ETHTOOL_A_PAUSE_STAT_UNSPEC = 0x0 + ETHTOOL_A_PAUSE_STAT_PAD = 0x1 + ETHTOOL_A_PAUSE_STAT_TX_FRAMES = 0x2 + ETHTOOL_A_PAUSE_STAT_RX_FRAMES = 0x3 + ETHTOOL_A_PAUSE_STAT_MAX = 0x3 + ETHTOOL_A_EEE_UNSPEC = 0x0 + ETHTOOL_A_EEE_HEADER = 0x1 + ETHTOOL_A_EEE_MODES_OURS = 0x2 + ETHTOOL_A_EEE_MODES_PEER = 0x3 + ETHTOOL_A_EEE_ACTIVE = 0x4 + ETHTOOL_A_EEE_ENABLED = 0x5 + ETHTOOL_A_EEE_TX_LPI_ENABLED = 0x6 + ETHTOOL_A_EEE_TX_LPI_TIMER = 0x7 + ETHTOOL_A_EEE_MAX = 0x7 + ETHTOOL_A_TSINFO_UNSPEC = 0x0 + ETHTOOL_A_TSINFO_HEADER = 0x1 + ETHTOOL_A_TSINFO_TIMESTAMPING = 0x2 + ETHTOOL_A_TSINFO_TX_TYPES = 0x3 + ETHTOOL_A_TSINFO_RX_FILTERS = 0x4 + ETHTOOL_A_TSINFO_PHC_INDEX = 0x5 + ETHTOOL_A_TSINFO_MAX = 0x5 + ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0 + ETHTOOL_A_CABLE_TEST_HEADER = 0x1 + ETHTOOL_A_CABLE_TEST_MAX = 0x1 + ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC = 0x0 + ETHTOOL_A_CABLE_RESULT_CODE_OK = 0x1 + ETHTOOL_A_CABLE_RESULT_CODE_OPEN = 0x2 + ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT = 0x3 + ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT = 0x4 + ETHTOOL_A_CABLE_PAIR_A = 0x0 + ETHTOOL_A_CABLE_PAIR_B = 0x1 + ETHTOOL_A_CABLE_PAIR_C = 0x2 + ETHTOOL_A_CABLE_PAIR_D = 0x3 + ETHTOOL_A_CABLE_RESULT_UNSPEC = 0x0 + ETHTOOL_A_CABLE_RESULT_PAIR = 0x1 + ETHTOOL_A_CABLE_RESULT_CODE = 0x2 + ETHTOOL_A_CABLE_RESULT_MAX = 0x2 + ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC = 0x0 + ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 0x1 + ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 0x2 + ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = 0x2 + ETHTOOL_A_CABLE_TEST_NTF_STATUS_UNSPEC = 0x0 + ETHTOOL_A_CABLE_TEST_NTF_STATUS_STARTED = 0x1 + ETHTOOL_A_CABLE_TEST_NTF_STATUS_COMPLETED = 0x2 + ETHTOOL_A_CABLE_NEST_UNSPEC = 0x0 + ETHTOOL_A_CABLE_NEST_RESULT = 0x1 + ETHTOOL_A_CABLE_NEST_FAULT_LENGTH = 0x2 + ETHTOOL_A_CABLE_NEST_MAX = 0x2 + ETHTOOL_A_CABLE_TEST_NTF_UNSPEC = 0x0 + ETHTOOL_A_CABLE_TEST_NTF_HEADER = 0x1 + ETHTOOL_A_CABLE_TEST_NTF_STATUS = 0x2 + ETHTOOL_A_CABLE_TEST_NTF_NEST = 0x3 + ETHTOOL_A_CABLE_TEST_NTF_MAX = 0x3 + ETHTOOL_A_CABLE_TEST_TDR_CFG_UNSPEC = 0x0 + ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST = 0x1 + ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST = 0x2 + ETHTOOL_A_CABLE_TEST_TDR_CFG_STEP = 0x3 + ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR = 0x4 + ETHTOOL_A_CABLE_TEST_TDR_CFG_MAX = 0x4 + ETHTOOL_A_CABLE_TEST_TDR_UNSPEC = 0x0 + ETHTOOL_A_CABLE_TEST_TDR_HEADER = 0x1 + ETHTOOL_A_CABLE_TEST_TDR_CFG = 0x2 + ETHTOOL_A_CABLE_TEST_TDR_MAX = 0x2 + ETHTOOL_A_CABLE_AMPLITUDE_UNSPEC = 0x0 + ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 0x1 + ETHTOOL_A_CABLE_AMPLITUDE_mV = 0x2 + ETHTOOL_A_CABLE_AMPLITUDE_MAX = 0x2 + ETHTOOL_A_CABLE_PULSE_UNSPEC = 0x0 + ETHTOOL_A_CABLE_PULSE_mV = 0x1 + ETHTOOL_A_CABLE_PULSE_MAX = 0x1 + ETHTOOL_A_CABLE_STEP_UNSPEC = 0x0 + ETHTOOL_A_CABLE_STEP_FIRST_DISTANCE = 0x1 + ETHTOOL_A_CABLE_STEP_LAST_DISTANCE = 0x2 + ETHTOOL_A_CABLE_STEP_STEP_DISTANCE = 0x3 + ETHTOOL_A_CABLE_STEP_MAX = 0x3 + ETHTOOL_A_CABLE_TDR_NEST_UNSPEC = 0x0 + ETHTOOL_A_CABLE_TDR_NEST_STEP = 0x1 + ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE = 0x2 + ETHTOOL_A_CABLE_TDR_NEST_PULSE = 0x3 + ETHTOOL_A_CABLE_TDR_NEST_MAX = 0x3 + ETHTOOL_A_CABLE_TEST_TDR_NTF_UNSPEC = 0x0 + ETHTOOL_A_CABLE_TEST_TDR_NTF_HEADER = 0x1 + ETHTOOL_A_CABLE_TEST_TDR_NTF_STATUS = 0x2 + ETHTOOL_A_CABLE_TEST_TDR_NTF_NEST = 0x3 + ETHTOOL_A_CABLE_TEST_TDR_NTF_MAX = 0x3 + ETHTOOL_UDP_TUNNEL_TYPE_VXLAN = 0x0 + ETHTOOL_UDP_TUNNEL_TYPE_GENEVE = 0x1 + ETHTOOL_UDP_TUNNEL_TYPE_VXLAN_GPE = 0x2 + ETHTOOL_A_TUNNEL_UDP_ENTRY_UNSPEC = 0x0 + ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT = 0x1 + ETHTOOL_A_TUNNEL_UDP_ENTRY_TYPE = 0x2 + ETHTOOL_A_TUNNEL_UDP_ENTRY_MAX = 0x2 + ETHTOOL_A_TUNNEL_UDP_TABLE_UNSPEC = 0x0 + ETHTOOL_A_TUNNEL_UDP_TABLE_SIZE = 0x1 + ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES = 0x2 + ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY = 0x3 + ETHTOOL_A_TUNNEL_UDP_TABLE_MAX = 0x3 + ETHTOOL_A_TUNNEL_UDP_UNSPEC = 0x0 + ETHTOOL_A_TUNNEL_UDP_TABLE = 0x1 + ETHTOOL_A_TUNNEL_UDP_MAX = 0x1 + ETHTOOL_A_TUNNEL_INFO_UNSPEC = 0x0 + ETHTOOL_A_TUNNEL_INFO_HEADER = 0x1 + ETHTOOL_A_TUNNEL_INFO_UDP_PORTS = 0x2 + ETHTOOL_A_TUNNEL_INFO_MAX = 0x2 +) + +type EthtoolDrvinfo struct { + Cmd uint32 + Driver [32]byte + Version [32]byte + Fw_version [32]byte + Bus_info [32]byte + Erom_version [32]byte + Reserved2 [12]byte + N_priv_flags uint32 + N_stats uint32 + Testinfo_len uint32 + Eedump_len uint32 + Regdump_len uint32 +} + +type ( + HIDRawReportDescriptor struct { + Size uint32 + Value [4096]uint8 + } + HIDRawDevInfo struct { + Bustype uint32 + Vendor int16 + Product int16 + } +) + +const ( + CLOSE_RANGE_UNSHARE = 0x2 + CLOSE_RANGE_CLOEXEC = 0x4 +) + +const ( + NLMSGERR_ATTR_MSG = 0x1 + NLMSGERR_ATTR_OFFS = 0x2 + NLMSGERR_ATTR_COOKIE = 0x3 +) + +type ( + EraseInfo struct { + Start uint32 + Length uint32 + } + EraseInfo64 struct { + Start uint64 + Length uint64 + } + MtdOobBuf struct { + Start uint32 + Length uint32 + Ptr *uint8 + } + MtdOobBuf64 struct { + Start uint64 + Pad uint32 + Length uint32 + Ptr uint64 + } + MtdWriteReq struct { + Start uint64 + Len uint64 + Ooblen uint64 + Data uint64 + Oob uint64 + Mode uint8 + _ [7]uint8 + } + MtdInfo struct { + Type uint8 + Flags uint32 + Size uint32 + Erasesize uint32 + Writesize uint32 + Oobsize uint32 + _ uint64 + } + RegionInfo struct { + Offset uint32 + Erasesize uint32 + Numblocks uint32 + Regionindex uint32 + } + OtpInfo struct { + Start uint32 + Length uint32 + Locked uint32 + } + NandOobinfo struct { + Useecc uint32 + Eccbytes uint32 + Oobfree [8][2]uint32 + Eccpos [32]uint32 + } + NandOobfree struct { + Offset uint32 + Length uint32 + } + NandEcclayout struct { + Eccbytes uint32 + Eccpos [64]uint32 + Oobavail uint32 + Oobfree [8]NandOobfree + } + MtdEccStats struct { + Corrected uint32 + Failed uint32 + Badblocks uint32 + Bbtblocks uint32 + } +) + +const ( + MTD_OPS_PLACE_OOB = 0x0 + MTD_OPS_AUTO_OOB = 0x1 + MTD_OPS_RAW = 0x2 +) + +const ( + MTD_FILE_MODE_NORMAL = 0x0 + MTD_FILE_MODE_OTP_FACTORY = 0x1 + MTD_FILE_MODE_OTP_USER = 0x2 + MTD_FILE_MODE_RAW = 0x3 +) + +const ( + NFC_CMD_UNSPEC = 0x0 + NFC_CMD_GET_DEVICE = 0x1 + NFC_CMD_DEV_UP = 0x2 + NFC_CMD_DEV_DOWN = 0x3 + NFC_CMD_DEP_LINK_UP = 0x4 + NFC_CMD_DEP_LINK_DOWN = 0x5 + NFC_CMD_START_POLL = 0x6 + NFC_CMD_STOP_POLL = 0x7 + NFC_CMD_GET_TARGET = 0x8 + NFC_EVENT_TARGETS_FOUND = 0x9 + NFC_EVENT_DEVICE_ADDED = 0xa + NFC_EVENT_DEVICE_REMOVED = 0xb + NFC_EVENT_TARGET_LOST = 0xc + NFC_EVENT_TM_ACTIVATED = 0xd + NFC_EVENT_TM_DEACTIVATED = 0xe + NFC_CMD_LLC_GET_PARAMS = 0xf + NFC_CMD_LLC_SET_PARAMS = 0x10 + NFC_CMD_ENABLE_SE = 0x11 + NFC_CMD_DISABLE_SE = 0x12 + NFC_CMD_LLC_SDREQ = 0x13 + NFC_EVENT_LLC_SDRES = 0x14 + NFC_CMD_FW_DOWNLOAD = 0x15 + NFC_EVENT_SE_ADDED = 0x16 + NFC_EVENT_SE_REMOVED = 0x17 + NFC_EVENT_SE_CONNECTIVITY = 0x18 + NFC_EVENT_SE_TRANSACTION = 0x19 + NFC_CMD_GET_SE = 0x1a + NFC_CMD_SE_IO = 0x1b + NFC_CMD_ACTIVATE_TARGET = 0x1c + NFC_CMD_VENDOR = 0x1d + NFC_CMD_DEACTIVATE_TARGET = 0x1e + NFC_ATTR_UNSPEC = 0x0 + NFC_ATTR_DEVICE_INDEX = 0x1 + NFC_ATTR_DEVICE_NAME = 0x2 + NFC_ATTR_PROTOCOLS = 0x3 + NFC_ATTR_TARGET_INDEX = 0x4 + NFC_ATTR_TARGET_SENS_RES = 0x5 + NFC_ATTR_TARGET_SEL_RES = 0x6 + NFC_ATTR_TARGET_NFCID1 = 0x7 + NFC_ATTR_TARGET_SENSB_RES = 0x8 + NFC_ATTR_TARGET_SENSF_RES = 0x9 + NFC_ATTR_COMM_MODE = 0xa + NFC_ATTR_RF_MODE = 0xb + NFC_ATTR_DEVICE_POWERED = 0xc + NFC_ATTR_IM_PROTOCOLS = 0xd + NFC_ATTR_TM_PROTOCOLS = 0xe + NFC_ATTR_LLC_PARAM_LTO = 0xf + NFC_ATTR_LLC_PARAM_RW = 0x10 + NFC_ATTR_LLC_PARAM_MIUX = 0x11 + NFC_ATTR_SE = 0x12 + NFC_ATTR_LLC_SDP = 0x13 + NFC_ATTR_FIRMWARE_NAME = 0x14 + NFC_ATTR_SE_INDEX = 0x15 + NFC_ATTR_SE_TYPE = 0x16 + NFC_ATTR_SE_AID = 0x17 + NFC_ATTR_FIRMWARE_DOWNLOAD_STATUS = 0x18 + NFC_ATTR_SE_APDU = 0x19 + NFC_ATTR_TARGET_ISO15693_DSFID = 0x1a + NFC_ATTR_TARGET_ISO15693_UID = 0x1b + NFC_ATTR_SE_PARAMS = 0x1c + NFC_ATTR_VENDOR_ID = 0x1d + NFC_ATTR_VENDOR_SUBCMD = 0x1e + NFC_ATTR_VENDOR_DATA = 0x1f + NFC_SDP_ATTR_UNSPEC = 0x0 + NFC_SDP_ATTR_URI = 0x1 + NFC_SDP_ATTR_SAP = 0x2 +) + +type LandlockRulesetAttr struct { + Access_fs uint64 +} + +type LandlockPathBeneathAttr struct { + Allowed_access uint64 + Parent_fd int32 +} + +const ( + LANDLOCK_RULE_PATH_BENEATH = 0x1 +) + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 + + ipc_64 = 0x100 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 761b67c864..eeeb9aa39a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && linux // +build 386,linux package unix @@ -117,11 +118,27 @@ type Flock_t struct { Pid int32 } +type DmNameList struct { + Dev uint64 + Next uint32 +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -153,10 +170,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( - SizeofIovec = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc ) const ( @@ -597,3 +620,51 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 +} + +const ( + PPS_GETPARAMS = 0x800470a1 + PPS_SETPARAMS = 0x400470a2 + PPS_GETCAP = 0x800470a3 + PPS_FETCH = 0xc00470a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ [2]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Atime_high uint32 + Dtime uint32 + Dtime_high uint32 + Ctime uint32 + Ctime_high uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 201fb3482d..d30e1155cc 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && linux // +build amd64,linux package unix @@ -117,11 +118,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -154,10 +173,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -612,3 +637,49 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x800870a1 + PPS_SETPARAMS = 0x400870a2 + PPS_GETCAP = 0x800870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 8051b56108..69d0297520 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && linux // +build arm,linux package unix @@ -121,11 +122,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -157,10 +176,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( - SizeofIovec = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc ) const ( @@ -589,3 +614,52 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]uint8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x800470a1 + PPS_SETPARAMS = 0x400470a2 + PPS_GETCAP = 0x800470a3 + PPS_FETCH = 0xc00470a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ [2]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Atime_high uint32 + Dtime uint32 + Dtime_high uint32 + Ctime uint32 + Ctime_high uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index a936f21692..28a0455bc9 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && linux // +build arm64,linux package unix @@ -118,11 +119,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -155,10 +174,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -591,3 +616,49 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x800870a1 + PPS_SETPARAMS = 0x400870a2 + PPS_GETCAP = 0x800870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index aaca03dd7d..64a845483d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips && linux // +build mips,linux package unix @@ -120,11 +121,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -156,10 +175,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( - SizeofIovec = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc ) const ( @@ -595,3 +620,51 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400470a1 + PPS_SETPARAMS = 0x800470a2 + PPS_GETCAP = 0x400470a3 + PPS_FETCH = 0xc00470a4 +) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Dtime uint32 + Ctime uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + Atime_high uint16 + Dtime_high uint16 + Ctime_high uint16 + _ uint16 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 2e7f3b8ca4..a1b7dee412 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64 && linux // +build mips64,linux package unix @@ -118,11 +119,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -155,10 +174,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -594,3 +619,49 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400870a1 + PPS_SETPARAMS = 0x800870a2 + PPS_GETCAP = 0x400870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 16add5a257..936fa6a266 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mips64le && linux // +build mips64le,linux package unix @@ -118,11 +119,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -155,10 +174,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -594,3 +619,49 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400870a1 + PPS_SETPARAMS = 0x800870a2 + PPS_GETCAP = 0x400870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 4ed2c8e54c..5dd546fbf0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build mipsle && linux // +build mipsle,linux package unix @@ -120,11 +121,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -156,10 +175,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + const ( - SizeofIovec = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc ) const ( @@ -595,3 +620,51 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400470a1 + PPS_SETPARAMS = 0x800470a2 + PPS_GETCAP = 0x400470a3 + PPS_FETCH = 0xc00470a4 +) + +const ( + PIDFD_NONBLOCK = 0x80 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Dtime uint32 + Ctime uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + Atime_high uint16 + Dtime_high uint16 + Ctime_high uint16 + _ uint16 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go new file mode 100644 index 0000000000..947b32e434 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -0,0 +1,678 @@ +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build ppc && linux +// +build ppc,linux + +package unix + +const ( + SizeofPtr = 0x4 + SizeofLong = 0x4 +) + +type ( + _C_long int32 +) + +type Timespec struct { + Sec int32 + Nsec int32 +} + +type Timeval struct { + Sec int32 + Usec int32 +} + +type Timex struct { + Modes uint32 + Offset int32 + Freq int32 + Maxerror int32 + Esterror int32 + Status int32 + Constant int32 + Precision int32 + Tolerance int32 + Time Timeval + Tick int32 + Ppsfreq int32 + Jitter int32 + Shift int32 + Stabil int32 + Jitcnt int32 + Calcnt int32 + Errcnt int32 + Stbcnt int32 + Tai int32 + _ [44]byte +} + +type Time_t int32 + +type Tms struct { + Utime int32 + Stime int32 + Cutime int32 + Cstime int32 +} + +type Utimbuf struct { + Actime int32 + Modtime int32 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int32 + Ixrss int32 + Idrss int32 + Isrss int32 + Minflt int32 + Majflt int32 + Nswap int32 + Inblock int32 + Oublock int32 + Msgsnd int32 + Msgrcv int32 + Nsignals int32 + Nvcsw int32 + Nivcsw int32 +} + +type Stat_t struct { + Dev uint64 + Ino uint64 + Mode uint32 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev uint64 + _ uint16 + _ [4]byte + Size int64 + Blksize int32 + _ [4]byte + Blocks int64 + Atim Timespec + Mtim Timespec + Ctim Timespec + _ uint32 + _ uint32 +} + +type Dirent struct { + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]uint8 + _ [5]byte +} + +type Flock_t struct { + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte +} + +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + +const ( + FADV_DONTNEED = 0x4 + FADV_NOREUSE = 0x5 +) + +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint32 +} + +type RawSockaddr struct { + Family uint16 + Data [14]uint8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [96]uint8 +} + +type Iovec struct { + Base *byte + Len uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Iov *Iovec + Iovlen uint32 + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type ifreq struct { + Ifrn [16]byte + Ifru [16]byte +} + +const ( + SizeofSockaddrNFCLLCP = 0x58 + SizeofIovec = 0x8 + SizeofMsghdr = 0x1c + SizeofCmsghdr = 0xc +) + +const ( + SizeofSockFprog = 0x8 +) + +type PtraceRegs struct { + Gpr [32]uint32 + Nip uint32 + Msr uint32 + Orig_gpr3 uint32 + Ctr uint32 + Link uint32 + Xer uint32 + Ccr uint32 + Mq uint32 + Trap uint32 + Dar uint32 + Dsisr uint32 + Result uint32 +} + +type FdSet struct { + Bits [32]int32 +} + +type Sysinfo_t struct { + Uptime int32 + Loads [3]uint32 + Totalram uint32 + Freeram uint32 + Sharedram uint32 + Bufferram uint32 + Totalswap uint32 + Freeswap uint32 + Procs uint16 + Pad uint16 + Totalhigh uint32 + Freehigh uint32 + Unit uint32 + _ [8]uint8 +} + +type Ustat_t struct { + Tfree int32 + Tinode uint32 + Fname [6]uint8 + Fpack [6]uint8 +} + +type EpollEvent struct { + Events uint32 + _ int32 + Fd int32 + Pad int32 +} + +const ( + POLLRDHUP = 0x2000 +) + +type Sigset_t struct { + Val [32]uint32 +} + +const _C__NSIG = 0x41 + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [19]uint8 + Line uint8 + Ispeed uint32 + Ospeed uint32 +} + +type Taskstats struct { + Version uint16 + Ac_exitcode uint32 + Ac_flag uint8 + Ac_nice uint8 + _ [4]byte + Cpu_count uint64 + Cpu_delay_total uint64 + Blkio_count uint64 + Blkio_delay_total uint64 + Swapin_count uint64 + Swapin_delay_total uint64 + Cpu_run_real_total uint64 + Cpu_run_virtual_total uint64 + Ac_comm [32]uint8 + Ac_sched uint8 + Ac_pad [3]uint8 + _ [4]byte + Ac_uid uint32 + Ac_gid uint32 + Ac_pid uint32 + Ac_ppid uint32 + Ac_btime uint32 + _ [4]byte + Ac_etime uint64 + Ac_utime uint64 + Ac_stime uint64 + Ac_minflt uint64 + Ac_majflt uint64 + Coremem uint64 + Virtmem uint64 + Hiwater_rss uint64 + Hiwater_vm uint64 + Read_char uint64 + Write_char uint64 + Read_syscalls uint64 + Write_syscalls uint64 + Read_bytes uint64 + Write_bytes uint64 + Cancelled_write_bytes uint64 + Nvcsw uint64 + Nivcsw uint64 + Ac_utimescaled uint64 + Ac_stimescaled uint64 + Cpu_scaled_run_real_total uint64 + Freepages_count uint64 + Freepages_delay_total uint64 + Thrashing_count uint64 + Thrashing_delay_total uint64 + Ac_btime64 uint64 +} + +type cpuMask uint32 + +const ( + _NCPUBITS = 0x20 +) + +const ( + CBitFieldMaskBit0 = 0x8000000000000000 + CBitFieldMaskBit1 = 0x4000000000000000 + CBitFieldMaskBit2 = 0x2000000000000000 + CBitFieldMaskBit3 = 0x1000000000000000 + CBitFieldMaskBit4 = 0x800000000000000 + CBitFieldMaskBit5 = 0x400000000000000 + CBitFieldMaskBit6 = 0x200000000000000 + CBitFieldMaskBit7 = 0x100000000000000 + CBitFieldMaskBit8 = 0x80000000000000 + CBitFieldMaskBit9 = 0x40000000000000 + CBitFieldMaskBit10 = 0x20000000000000 + CBitFieldMaskBit11 = 0x10000000000000 + CBitFieldMaskBit12 = 0x8000000000000 + CBitFieldMaskBit13 = 0x4000000000000 + CBitFieldMaskBit14 = 0x2000000000000 + CBitFieldMaskBit15 = 0x1000000000000 + CBitFieldMaskBit16 = 0x800000000000 + CBitFieldMaskBit17 = 0x400000000000 + CBitFieldMaskBit18 = 0x200000000000 + CBitFieldMaskBit19 = 0x100000000000 + CBitFieldMaskBit20 = 0x80000000000 + CBitFieldMaskBit21 = 0x40000000000 + CBitFieldMaskBit22 = 0x20000000000 + CBitFieldMaskBit23 = 0x10000000000 + CBitFieldMaskBit24 = 0x8000000000 + CBitFieldMaskBit25 = 0x4000000000 + CBitFieldMaskBit26 = 0x2000000000 + CBitFieldMaskBit27 = 0x1000000000 + CBitFieldMaskBit28 = 0x800000000 + CBitFieldMaskBit29 = 0x400000000 + CBitFieldMaskBit30 = 0x200000000 + CBitFieldMaskBit31 = 0x100000000 + CBitFieldMaskBit32 = 0x80000000 + CBitFieldMaskBit33 = 0x40000000 + CBitFieldMaskBit34 = 0x20000000 + CBitFieldMaskBit35 = 0x10000000 + CBitFieldMaskBit36 = 0x8000000 + CBitFieldMaskBit37 = 0x4000000 + CBitFieldMaskBit38 = 0x2000000 + CBitFieldMaskBit39 = 0x1000000 + CBitFieldMaskBit40 = 0x800000 + CBitFieldMaskBit41 = 0x400000 + CBitFieldMaskBit42 = 0x200000 + CBitFieldMaskBit43 = 0x100000 + CBitFieldMaskBit44 = 0x80000 + CBitFieldMaskBit45 = 0x40000 + CBitFieldMaskBit46 = 0x20000 + CBitFieldMaskBit47 = 0x10000 + CBitFieldMaskBit48 = 0x8000 + CBitFieldMaskBit49 = 0x4000 + CBitFieldMaskBit50 = 0x2000 + CBitFieldMaskBit51 = 0x1000 + CBitFieldMaskBit52 = 0x800 + CBitFieldMaskBit53 = 0x400 + CBitFieldMaskBit54 = 0x200 + CBitFieldMaskBit55 = 0x100 + CBitFieldMaskBit56 = 0x80 + CBitFieldMaskBit57 = 0x40 + CBitFieldMaskBit58 = 0x20 + CBitFieldMaskBit59 = 0x10 + CBitFieldMaskBit60 = 0x8 + CBitFieldMaskBit61 = 0x4 + CBitFieldMaskBit62 = 0x2 + CBitFieldMaskBit63 = 0x1 +) + +type SockaddrStorage struct { + Family uint16 + _ [122]uint8 + _ uint32 +} + +type HDGeometry struct { + Heads uint8 + Sectors uint8 + Cylinders uint16 + Start uint32 +} + +type Statfs_t struct { + Type int32 + Bsize int32 + Blocks uint64 + Bfree uint64 + Bavail uint64 + Files uint64 + Ffree uint64 + Fsid Fsid + Namelen int32 + Frsize int32 + Flags int32 + Spare [4]int32 + _ [4]byte +} + +type TpacketHdr struct { + Status uint32 + Len uint32 + Snaplen uint32 + Mac uint16 + Net uint16 + Sec uint32 + Usec uint32 +} + +const ( + SizeofTpacketHdr = 0x18 +) + +type RTCPLLInfo struct { + Ctrl int32 + Value int32 + Max int32 + Min int32 + Posmult int32 + Negmult int32 + Clock int32 +} + +type BlkpgPartition struct { + Start int64 + Length int64 + Pno int32 + Devname [64]uint8 + Volname [64]uint8 + _ [4]byte +} + +const ( + BLKPG = 0x20001269 +) + +type XDPUmemReg struct { + Addr uint64 + Len uint64 + Size uint32 + Headroom uint32 + Flags uint32 + _ [4]byte +} + +type CryptoUserAlg struct { + Name [64]uint8 + Driver_name [64]uint8 + Module_name [64]uint8 + Type uint32 + Mask uint32 + Refcnt uint32 + Flags uint32 +} + +type CryptoStatAEAD struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatAKCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Verify_cnt uint64 + Sign_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatCipher struct { + Type [64]uint8 + Encrypt_cnt uint64 + Encrypt_tlen uint64 + Decrypt_cnt uint64 + Decrypt_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatCompress struct { + Type [64]uint8 + Compress_cnt uint64 + Compress_tlen uint64 + Decompress_cnt uint64 + Decompress_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatHash struct { + Type [64]uint8 + Hash_cnt uint64 + Hash_tlen uint64 + Err_cnt uint64 +} + +type CryptoStatKPP struct { + Type [64]uint8 + Setsecret_cnt uint64 + Generate_public_key_cnt uint64 + Compute_shared_secret_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatRNG struct { + Type [64]uint8 + Generate_cnt uint64 + Generate_tlen uint64 + Seed_cnt uint64 + Err_cnt uint64 +} + +type CryptoStatLarval struct { + Type [64]uint8 +} + +type CryptoReportLarval struct { + Type [64]uint8 +} + +type CryptoReportHash struct { + Type [64]uint8 + Blocksize uint32 + Digestsize uint32 +} + +type CryptoReportCipher struct { + Type [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 +} + +type CryptoReportBlkCipher struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Min_keysize uint32 + Max_keysize uint32 + Ivsize uint32 +} + +type CryptoReportAEAD struct { + Type [64]uint8 + Geniv [64]uint8 + Blocksize uint32 + Maxauthsize uint32 + Ivsize uint32 +} + +type CryptoReportComp struct { + Type [64]uint8 +} + +type CryptoReportRNG struct { + Type [64]uint8 + Seedsize uint32 +} + +type CryptoReportAKCipher struct { + Type [64]uint8 +} + +type CryptoReportKPP struct { + Type [64]uint8 +} + +type CryptoReportAcomp struct { + Type [64]uint8 +} + +type LoopInfo struct { + Number int32 + Device uint32 + Inode uint32 + Rdevice uint32 + Offset int32 + Encrypt_type int32 + Encrypt_key_size int32 + Flags int32 + Name [64]uint8 + Encrypt_key [32]uint8 + Init [2]uint32 + Reserved [4]uint8 +} + +type TIPCSubscr struct { + Seq TIPCServiceRange + Timeout uint32 + Filter uint32 + Handle [8]uint8 +} + +type TIPCSIOCLNReq struct { + Peer uint32 + Id uint32 + Linkname [68]uint8 +} + +type TIPCSIOCNodeIDReq struct { + Peer uint32 + Id [16]uint8 +} + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400470a1 + PPS_SETPARAMS = 0x800470a2 + PPS_GETCAP = 0x400470a3 + PPS_FETCH = 0xc00470a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime_high uint32 + Atime uint32 + Dtime_high uint32 + Dtime uint32 + Ctime_high uint32 + Ctime uint32 + _ uint32 + Segsz uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 + _ [4]byte +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 7415190997..2a606151b0 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64 && linux // +build ppc64,linux package unix @@ -119,11 +120,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -156,10 +175,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -601,3 +626,48 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]uint8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400870a1 + PPS_SETPARAMS = 0x800870a2 + PPS_GETCAP = 0x400870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 046c2debd4..d0d735d02c 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build ppc64le && linux // +build ppc64le,linux package unix @@ -119,11 +120,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -156,10 +175,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -601,3 +626,48 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]uint8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400870a1 + PPS_SETPARAMS = 0x800870a2 + PPS_GETCAP = 0x400870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 0f2f61a6ad..95e3d6d06f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build riscv64 && linux // +build riscv64,linux package unix @@ -118,11 +119,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]uint8 @@ -155,10 +174,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -619,3 +644,49 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]uint8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x800870a1 + PPS_SETPARAMS = 0x400870a2 + PPS_GETCAP = 0x800870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index cca1b6be27..cccf1ef26a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build s390x && linux // +build s390x,linux package unix @@ -117,11 +118,29 @@ type Flock_t struct { _ [4]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x6 FADV_NOREUSE = 0x7 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -154,10 +173,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -615,3 +640,48 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x800870a1 + PPS_SETPARAMS = 0x400870a2 + PPS_GETCAP = 0x800870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x800 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ uint16 + Seq uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 33a73bf183..44fcbe4e9a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -1,6 +1,7 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build sparc64 && linux // +build sparc64,linux package unix @@ -121,11 +122,29 @@ type Flock_t struct { _ [2]byte } +type DmNameList struct { + Dev uint64 + Next uint32 + Name [0]byte + _ [4]byte +} + const ( FADV_DONTNEED = 0x4 FADV_NOREUSE = 0x5 ) +type RawSockaddrNFCLLCP struct { + Sa_family uint16 + Dev_idx uint32 + Target_idx uint32 + Nfc_protocol uint32 + Dsap uint8 + Ssap uint8 + Service_name [63]uint8 + Service_name_len uint64 +} + type RawSockaddr struct { Family uint16 Data [14]int8 @@ -158,10 +177,16 @@ type Cmsghdr struct { Type int32 } +type ifreq struct { + Ifrn [16]byte + Ifru [24]byte +} + const ( - SizeofIovec = 0x10 - SizeofMsghdr = 0x38 - SizeofCmsghdr = 0x10 + SizeofSockaddrNFCLLCP = 0x60 + SizeofIovec = 0x10 + SizeofMsghdr = 0x38 + SizeofCmsghdr = 0x10 ) const ( @@ -596,3 +621,48 @@ type TIPCSIOCNodeIDReq struct { Peer uint32 Id [16]int8 } + +type PPSKInfo struct { + Assert_sequence uint32 + Clear_sequence uint32 + Assert_tu PPSKTime + Clear_tu PPSKTime + Current_mode int32 + _ [4]byte +} + +const ( + PPS_GETPARAMS = 0x400870a1 + PPS_SETPARAMS = 0x800870a2 + PPS_GETCAP = 0x400870a3 + PPS_FETCH = 0xc00870a4 +) + +const ( + PIDFD_NONBLOCK = 0x4000 +) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ uint16 + Seq uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go index a89100c08a..2fd2060e61 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go @@ -1,6 +1,7 @@ // cgo -godefs types_netbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && netbsd // +build 386,netbsd package unix @@ -248,6 +249,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 SizeofLinger = 0x8 + SizeofIovec = 0x8 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x1c @@ -443,8 +445,10 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go index 289184e0b3..6a5a1a8ae5 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_netbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && netbsd // +build amd64,netbsd package unix @@ -255,6 +256,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 @@ -451,8 +453,10 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go index 428c450e4c..84cc8d01e6 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go @@ -1,6 +1,7 @@ // cgo -godefs types_netbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && netbsd // +build arm,netbsd package unix @@ -253,6 +254,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 SizeofLinger = 0x8 + SizeofIovec = 0x8 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x1c @@ -448,8 +450,10 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go index 6f1f2842cc..c844e7096f 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs types_netbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && netbsd // +build arm64,netbsd package unix @@ -255,6 +256,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x14 SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 @@ -451,8 +453,10 @@ type Ptmget struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x400 + AT_EACCESS = 0x100 AT_SYMLINK_NOFOLLOW = 0x200 + AT_SYMLINK_FOLLOW = 0x400 + AT_REMOVEDIR = 0x800 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go index 61ea0019a2..2a8b1e6f73 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go @@ -1,6 +1,7 @@ // cgo -godefs types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build 386 && openbsd // +build 386,openbsd package unix @@ -231,6 +232,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x20 SizeofLinger = 0x8 + SizeofIovec = 0x8 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x1c @@ -436,8 +438,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go index 87a493f68f..b1759cf705 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && openbsd // +build amd64,openbsd package unix @@ -235,6 +236,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x20 SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 @@ -436,8 +438,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go index d80836efab..e807de2065 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm && openbsd // +build arm,openbsd package unix @@ -235,6 +236,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x20 SizeofLinger = 0x8 + SizeofIovec = 0x8 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x1c @@ -437,8 +439,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go index 4e158746f1..ff3aecaee4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go @@ -1,6 +1,7 @@ // cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build arm64 && openbsd // +build arm64,openbsd package unix @@ -231,6 +232,7 @@ const ( SizeofSockaddrUnix = 0x6a SizeofSockaddrDatalink = 0x20 SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 @@ -430,8 +432,10 @@ type Winsize struct { const ( AT_FDCWD = -0x64 - AT_SYMLINK_FOLLOW = 0x4 + AT_EACCESS = 0x1 AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 ) type PollFd struct { diff --git a/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go new file mode 100644 index 0000000000..9ecda69174 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go @@ -0,0 +1,569 @@ +// cgo -godefs -- -fsigned-char types_openbsd.go | go run mkpost.go +// Code generated by the command above; see README.md. DO NOT EDIT. + +//go:build mips64 && openbsd +// +build mips64,openbsd + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +type _Gid_t uint32 + +type Stat_t struct { + Mode uint32 + Dev int32 + Ino uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Rdev int32 + Atim Timespec + Mtim Timespec + Ctim Timespec + Size int64 + Blocks int64 + Blksize int32 + Flags uint32 + Gen uint32 + _ Timespec +} + +type Statfs_t struct { + F_flags uint32 + F_bsize uint32 + F_iosize uint32 + F_blocks uint64 + F_bfree uint64 + F_bavail int64 + F_files uint64 + F_ffree uint64 + F_favail int64 + F_syncwrites uint64 + F_syncreads uint64 + F_asyncwrites uint64 + F_asyncreads uint64 + F_fsid Fsid + F_namemax uint32 + F_owner uint32 + F_ctime uint64 + F_fstypename [16]int8 + F_mntonname [90]int8 + F_mntfromname [90]int8 + F_mntfromspec [90]int8 + _ [2]byte + Mount_info [160]byte +} + +type Flock_t struct { + Start int64 + Len int64 + Pid int32 + Type int16 + Whence int16 +} + +type Dirent struct { + Fileno uint64 + Off int64 + Reclen uint16 + Type uint8 + Namlen uint8 + _ [4]uint8 + Name [256]int8 +} + +type Fsid struct { + Val [2]int32 +} + +const ( + PathMax = 0x400 +) + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]int8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [104]int8 +} + +type RawSockaddrDatalink struct { + Len uint8 + Family uint8 + Index uint16 + Type uint8 + Nlen uint8 + Alen uint8 + Slen uint8 + Data [24]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]int8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + Pad [92]int8 +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Namelen uint32 + Iov *Iovec + Iovlen uint32 + Control *byte + Controllen uint32 + Flags int32 +} + +type Cmsghdr struct { + Len uint32 + Level int32 + Type int32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Filt [8]uint32 +} + +const ( + SizeofSockaddrInet4 = 0x10 + SizeofSockaddrInet6 = 0x1c + SizeofSockaddrAny = 0x6c + SizeofSockaddrUnix = 0x6a + SizeofSockaddrDatalink = 0x20 + SizeofLinger = 0x8 + SizeofIovec = 0x10 + SizeofIPMreq = 0x8 + SizeofIPv6Mreq = 0x14 + SizeofMsghdr = 0x30 + SizeofCmsghdr = 0xc + SizeofInet6Pktinfo = 0x14 + SizeofIPv6MTUInfo = 0x20 + SizeofICMPv6Filter = 0x20 +) + +const ( + PTRACE_TRACEME = 0x0 + PTRACE_CONT = 0x7 + PTRACE_KILL = 0x8 +) + +type Kevent_t struct { + Ident uint64 + Filter int16 + Flags uint16 + Fflags uint32 + Data int64 + Udata *byte +} + +type FdSet struct { + Bits [32]uint32 +} + +const ( + SizeofIfMsghdr = 0xa8 + SizeofIfData = 0x90 + SizeofIfaMsghdr = 0x18 + SizeofIfAnnounceMsghdr = 0x1a + SizeofRtMsghdr = 0x60 + SizeofRtMetrics = 0x38 +) + +type IfMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Xflags int32 + Data IfData +} + +type IfData struct { + Type uint8 + Addrlen uint8 + Hdrlen uint8 + Link_state uint8 + Mtu uint32 + Metric uint32 + Rdomain uint32 + Baudrate uint64 + Ipackets uint64 + Ierrors uint64 + Opackets uint64 + Oerrors uint64 + Collisions uint64 + Ibytes uint64 + Obytes uint64 + Imcasts uint64 + Omcasts uint64 + Iqdrops uint64 + Oqdrops uint64 + Noproto uint64 + Capabilities uint32 + Lastchange Timeval +} + +type IfaMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Pad1 uint8 + Pad2 uint8 + Addrs int32 + Flags int32 + Metric int32 +} + +type IfAnnounceMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + What uint16 + Name [16]int8 +} + +type RtMsghdr struct { + Msglen uint16 + Version uint8 + Type uint8 + Hdrlen uint16 + Index uint16 + Tableid uint16 + Priority uint8 + Mpls uint8 + Addrs int32 + Flags int32 + Fmask int32 + Pid int32 + Seq int32 + Errno int32 + Inits uint32 + Rmx RtMetrics +} + +type RtMetrics struct { + Pksent uint64 + Expire int64 + Locks uint32 + Mtu uint32 + Refcnt uint32 + Hopcount uint32 + Recvpipe uint32 + Sendpipe uint32 + Ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Pad uint32 +} + +type Mclpool struct{} + +const ( + SizeofBpfVersion = 0x4 + SizeofBpfStat = 0x8 + SizeofBpfProgram = 0x10 + SizeofBpfInsn = 0x8 + SizeofBpfHdr = 0x14 +) + +type BpfVersion struct { + Major uint16 + Minor uint16 +} + +type BpfStat struct { + Recv uint32 + Drop uint32 +} + +type BpfProgram struct { + Len uint32 + Insns *BpfInsn +} + +type BpfInsn struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type BpfHdr struct { + Tstamp BpfTimeval + Caplen uint32 + Datalen uint32 + Hdrlen uint16 + _ [2]byte +} + +type BpfTimeval struct { + Sec uint32 + Usec uint32 +} + +type Termios struct { + Iflag uint32 + Oflag uint32 + Cflag uint32 + Lflag uint32 + Cc [20]uint8 + Ispeed int32 + Ospeed int32 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +const ( + AT_FDCWD = -0x64 + AT_EACCESS = 0x1 + AT_SYMLINK_NOFOLLOW = 0x2 + AT_SYMLINK_FOLLOW = 0x4 + AT_REMOVEDIR = 0x8 +) + +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +const ( + POLLERR = 0x8 + POLLHUP = 0x10 + POLLIN = 0x1 + POLLNVAL = 0x20 + POLLOUT = 0x4 + POLLPRI = 0x2 + POLLRDBAND = 0x80 + POLLRDNORM = 0x40 + POLLWRBAND = 0x100 + POLLWRNORM = 0x4 +) + +type Sigset_t uint32 + +type Utsname struct { + Sysname [256]byte + Nodename [256]byte + Release [256]byte + Version [256]byte + Machine [256]byte +} + +const SizeofUvmexp = 0x158 + +type Uvmexp struct { + Pagesize int32 + Pagemask int32 + Pageshift int32 + Npages int32 + Free int32 + Active int32 + Inactive int32 + Paging int32 + Wired int32 + Zeropages int32 + Reserve_pagedaemon int32 + Reserve_kernel int32 + Unused01 int32 + Vnodepages int32 + Vtextpages int32 + Freemin int32 + Freetarg int32 + Inactarg int32 + Wiredmax int32 + Anonmin int32 + Vtextmin int32 + Vnodemin int32 + Anonminpct int32 + Vtextminpct int32 + Vnodeminpct int32 + Nswapdev int32 + Swpages int32 + Swpginuse int32 + Swpgonly int32 + Nswget int32 + Nanon int32 + Unused05 int32 + Unused06 int32 + Faults int32 + Traps int32 + Intrs int32 + Swtch int32 + Softs int32 + Syscalls int32 + Pageins int32 + Unused07 int32 + Unused08 int32 + Pgswapin int32 + Pgswapout int32 + Forks int32 + Forks_ppwait int32 + Forks_sharevm int32 + Pga_zerohit int32 + Pga_zeromiss int32 + Unused09 int32 + Fltnoram int32 + Fltnoanon int32 + Fltnoamap int32 + Fltpgwait int32 + Fltpgrele int32 + Fltrelck int32 + Fltrelckok int32 + Fltanget int32 + Fltanretry int32 + Fltamcopy int32 + Fltnamap int32 + Fltnomap int32 + Fltlget int32 + Fltget int32 + Flt_anon int32 + Flt_acow int32 + Flt_obj int32 + Flt_prcopy int32 + Flt_przero int32 + Pdwoke int32 + Pdrevs int32 + Pdswout int32 + Pdfreed int32 + Pdscans int32 + Pdanscan int32 + Pdobscan int32 + Pdreact int32 + Pdbusy int32 + Pdpageouts int32 + Pdpending int32 + Pddeact int32 + Unused11 int32 + Unused12 int32 + Unused13 int32 + Fpswtch int32 + Kmapent int32 +} + +const SizeofClockinfo = 0x14 + +type Clockinfo struct { + Hz int32 + Tick int32 + Tickadj int32 + Stathz int32 + Profhz int32 +} diff --git a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go index 23ed9fe51d..ad4aad2796 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go @@ -1,6 +1,7 @@ // cgo -godefs types_solaris.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. +//go:build amd64 && solaris // +build amd64,solaris package unix @@ -88,7 +89,6 @@ type Stat_t struct { Mtim Timespec Ctim Timespec Blksize int32 - _ [4]byte Blocks int64 Fstype [16]int8 } @@ -96,7 +96,6 @@ type Stat_t struct { type Flock_t struct { Type int16 Whence int16 - _ [4]byte Start int64 Len int64 Sysid int32 @@ -138,12 +137,12 @@ type RawSockaddrInet4 struct { } type RawSockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 - X__sin6_src_id uint32 + Family uint16 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 + _ uint32 } type RawSockaddrUnix struct { @@ -196,10 +195,8 @@ type IPv6Mreq struct { type Msghdr struct { Name *byte Namelen uint32 - _ [4]byte Iov *Iovec Iovlen int32 - _ [4]byte Accrights *int8 Accrightslen int32 _ [4]byte @@ -228,7 +225,7 @@ type IPv6MTUInfo struct { } type ICMPv6Filter struct { - X__icmp6_filt [8]uint32 + Filt [8]uint32 } const ( @@ -238,6 +235,7 @@ const ( SizeofSockaddrUnix = 0x6e SizeofSockaddrDatalink = 0xfc SizeofLinger = 0x8 + SizeofIovec = 0x10 SizeofIPMreq = 0x8 SizeofIPv6Mreq = 0x14 SizeofMsghdr = 0x30 @@ -291,7 +289,6 @@ type IfMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Data IfData } @@ -299,7 +296,6 @@ type IfData struct { Type uint8 Addrlen uint8 Hdrlen uint8 - _ [1]byte Mtu uint32 Metric uint32 Baudrate uint32 @@ -324,7 +320,6 @@ type IfaMsghdr struct { Addrs int32 Flags int32 Index uint16 - _ [2]byte Metric int32 } @@ -333,7 +328,6 @@ type RtMsghdr struct { Version uint8 Type uint8 Index uint16 - _ [2]byte Flags int32 Addrs int32 Pid int32 @@ -371,15 +365,14 @@ type BpfVersion struct { } type BpfStat struct { - Recv uint64 - Drop uint64 - Capt uint64 - Padding [13]uint64 + Recv uint64 + Drop uint64 + Capt uint64 + _ [13]uint64 } type BpfProgram struct { Len uint32 - _ [4]byte Insns *BpfInsn } @@ -447,3 +440,43 @@ const ( POLLWRBAND = 0x100 POLLWRNORM = 0x4 ) + +type fileObj struct { + Atim Timespec + Mtim Timespec + Ctim Timespec + Pad [3]uint64 + Name *int8 +} + +type portEvent struct { + Events int32 + Source uint16 + Pad uint16 + Object uint64 + User *byte +} + +const ( + PORT_SOURCE_AIO = 0x1 + PORT_SOURCE_TIMER = 0x2 + PORT_SOURCE_USER = 0x3 + PORT_SOURCE_FD = 0x4 + PORT_SOURCE_ALERT = 0x5 + PORT_SOURCE_MQ = 0x6 + PORT_SOURCE_FILE = 0x7 + PORT_ALERT_SET = 0x1 + PORT_ALERT_UPDATE = 0x2 + PORT_ALERT_INVALID = 0x3 + FILE_ACCESS = 0x1 + FILE_MODIFIED = 0x2 + FILE_ATTRIB = 0x4 + FILE_TRUNC = 0x100000 + FILE_NOFOLLOW = 0x10000000 + FILE_DELETE = 0x10 + FILE_RENAME_TO = 0x20 + FILE_RENAME_FROM = 0x40 + UNMOUNTED = 0x20000000 + MOUNTEDOVER = 0x40000000 + FILE_EXCEPTION = 0x60000070 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go new file mode 100644 index 0000000000..4ab638cb94 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/ztypes_zos_s390x.go @@ -0,0 +1,406 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build zos && s390x +// +build zos,s390x + +// Hand edited based on ztypes_linux_s390x.go +// TODO: auto-generate. + +package unix + +const ( + SizeofPtr = 0x8 + SizeofShort = 0x2 + SizeofInt = 0x4 + SizeofLong = 0x8 + SizeofLongLong = 0x8 + PathMax = 0x1000 +) + +const ( + SizeofSockaddrAny = 128 + SizeofCmsghdr = 12 + SizeofIPMreq = 8 + SizeofIPv6Mreq = 20 + SizeofICMPv6Filter = 32 + SizeofIPv6MTUInfo = 32 + SizeofLinger = 8 + SizeofSockaddrInet4 = 16 + SizeofSockaddrInet6 = 28 + SizeofTCPInfo = 0x68 +) + +type ( + _C_short int16 + _C_int int32 + _C_long int64 + _C_long_long int64 +) + +type Timespec struct { + Sec int64 + Nsec int64 +} + +type Timeval struct { + Sec int64 + Usec int64 +} + +type timeval_zos struct { //correct (with padding and all) + Sec int64 + _ [4]byte // pad + Usec int32 +} + +type Tms struct { //clock_t is 4-byte unsigned int in zos + Utime uint32 + Stime uint32 + Cutime uint32 + Cstime uint32 +} + +type Time_t int64 + +type Utimbuf struct { + Actime int64 + Modtime int64 +} + +type Utsname struct { + Sysname [65]byte + Nodename [65]byte + Release [65]byte + Version [65]byte + Machine [65]byte + Domainname [65]byte +} + +type RawSockaddrInet4 struct { + Len uint8 + Family uint8 + Port uint16 + Addr [4]byte /* in_addr */ + Zero [8]uint8 +} + +type RawSockaddrInet6 struct { + Len uint8 + Family uint8 + Port uint16 + Flowinfo uint32 + Addr [16]byte /* in6_addr */ + Scope_id uint32 +} + +type RawSockaddrUnix struct { + Len uint8 + Family uint8 + Path [108]int8 +} + +type RawSockaddr struct { + Len uint8 + Family uint8 + Data [14]uint8 +} + +type RawSockaddrAny struct { + Addr RawSockaddr + _ [112]uint8 // pad +} + +type _Socklen uint32 + +type Linger struct { + Onoff int32 + Linger int32 +} + +type Iovec struct { + Base *byte + Len uint64 +} + +type IPMreq struct { + Multiaddr [4]byte /* in_addr */ + Interface [4]byte /* in_addr */ +} + +type IPv6Mreq struct { + Multiaddr [16]byte /* in6_addr */ + Interface uint32 +} + +type Msghdr struct { + Name *byte + Iov *Iovec + Control *byte + Flags int32 + Namelen int32 + Iovlen int32 + Controllen int32 +} + +type Cmsghdr struct { + Len int32 + Level int32 + Type int32 +} + +type Inet4Pktinfo struct { + Addr [4]byte /* in_addr */ + Ifindex uint32 +} + +type Inet6Pktinfo struct { + Addr [16]byte /* in6_addr */ + Ifindex uint32 +} + +type IPv6MTUInfo struct { + Addr RawSockaddrInet6 + Mtu uint32 +} + +type ICMPv6Filter struct { + Data [8]uint32 +} + +type TCPInfo struct { + State uint8 + Ca_state uint8 + Retransmits uint8 + Probes uint8 + Backoff uint8 + Options uint8 + Rto uint32 + Ato uint32 + Snd_mss uint32 + Rcv_mss uint32 + Unacked uint32 + Sacked uint32 + Lost uint32 + Retrans uint32 + Fackets uint32 + Last_data_sent uint32 + Last_ack_sent uint32 + Last_data_recv uint32 + Last_ack_recv uint32 + Pmtu uint32 + Rcv_ssthresh uint32 + Rtt uint32 + Rttvar uint32 + Snd_ssthresh uint32 + Snd_cwnd uint32 + Advmss uint32 + Reordering uint32 + Rcv_rtt uint32 + Rcv_space uint32 + Total_retrans uint32 +} + +type _Gid_t uint32 + +type rusage_zos struct { + Utime timeval_zos + Stime timeval_zos +} + +type Rusage struct { + Utime Timeval + Stime Timeval + Maxrss int64 + Ixrss int64 + Idrss int64 + Isrss int64 + Minflt int64 + Majflt int64 + Nswap int64 + Inblock int64 + Oublock int64 + Msgsnd int64 + Msgrcv int64 + Nsignals int64 + Nvcsw int64 + Nivcsw int64 +} + +type Rlimit struct { + Cur uint64 + Max uint64 +} + +// { int, short, short } in poll.h +type PollFd struct { + Fd int32 + Events int16 + Revents int16 +} + +type Stat_t struct { //Linux Definition + Dev uint64 + Ino uint64 + Nlink uint64 + Mode uint32 + Uid uint32 + Gid uint32 + _ int32 + Rdev uint64 + Size int64 + Atim Timespec + Mtim Timespec + Ctim Timespec + Blksize int64 + Blocks int64 + _ [3]int64 +} + +type Stat_LE_t struct { + _ [4]byte // eye catcher + Length uint16 + Version uint16 + Mode int32 + Ino uint32 + Dev uint32 + Nlink int32 + Uid int32 + Gid int32 + Size int64 + Atim31 [4]byte + Mtim31 [4]byte + Ctim31 [4]byte + Rdev uint32 + Auditoraudit uint32 + Useraudit uint32 + Blksize int32 + Creatim31 [4]byte + AuditID [16]byte + _ [4]byte // rsrvd1 + File_tag struct { + Ccsid uint16 + Txtflag uint16 // aggregating Txflag:1 deferred:1 rsvflags:14 + } + CharsetID [8]byte + Blocks int64 + Genvalue uint32 + Reftim31 [4]byte + Fid [8]byte + Filefmt byte + Fspflag2 byte + _ [2]byte // rsrvd2 + Ctimemsec int32 + Seclabel [8]byte + _ [4]byte // rsrvd3 + _ [4]byte // rsrvd4 + Atim Time_t + Mtim Time_t + Ctim Time_t + Creatim Time_t + Reftim Time_t + _ [24]byte // rsrvd5 +} + +type Statvfs_t struct { + ID [4]byte + Len int32 + Bsize uint64 + Blocks uint64 + Usedspace uint64 + Bavail uint64 + Flag uint64 + Maxfilesize int64 + _ [16]byte + Frsize uint64 + Bfree uint64 + Files uint32 + Ffree uint32 + Favail uint32 + Namemax31 uint32 + Invarsec uint32 + _ [4]byte + Fsid uint64 + Namemax uint64 +} + +type Statfs_t struct { + Type uint32 + Bsize uint64 + Blocks uint64 + Bfree uint64 + Bavail uint64 + Files uint32 + Ffree uint32 + Fsid uint64 + Namelen uint64 + Frsize uint64 + Flags uint64 +} + +type Dirent struct { + Reclen uint16 + Namlen uint16 + Ino uint32 + Extra uintptr + Name [256]byte +} + +type FdSet struct { + Bits [64]int32 +} + +// This struct is packed on z/OS so it can't be used directly. +type Flock_t struct { + Type int16 + Whence int16 + Start int64 + Len int64 + Pid int32 +} + +type Termios struct { + Cflag uint32 + Iflag uint32 + Lflag uint32 + Oflag uint32 + Cc [11]uint8 +} + +type Winsize struct { + Row uint16 + Col uint16 + Xpixel uint16 + Ypixel uint16 +} + +type W_Mnth struct { + Hid [4]byte + Size int32 + Cur1 int32 //32bit pointer + Cur2 int32 //^ + Devno uint32 + _ [4]byte +} + +type W_Mntent struct { + Fstype uint32 + Mode uint32 + Dev uint32 + Parentdev uint32 + Rootino uint32 + Status byte + Ddname [9]byte + Fstname [9]byte + Fsname [45]byte + Pathlen uint32 + Mountpoint [1024]byte + Jobname [8]byte + PID int32 + Parmoffset int32 + Parmlen int16 + Owner [8]byte + Quiesceowner [8]byte + _ [38]byte +} diff --git a/vendor/golang.org/x/sys/windows/dll_windows.go b/vendor/golang.org/x/sys/windows/dll_windows.go index 82076fb74f..115341fba6 100644 --- a/vendor/golang.org/x/sys/windows/dll_windows.go +++ b/vendor/golang.org/x/sys/windows/dll_windows.go @@ -32,6 +32,8 @@ type DLLError struct { func (e *DLLError) Error() string { return e.Msg } +func (e *DLLError) Unwrap() error { return e.Err } + // A DLL implements access to a single DLL. type DLL struct { Name string @@ -389,7 +391,6 @@ func loadLibraryEx(name string, system bool) (*DLL, error) { var flags uintptr if system { if canDoSearchSystem32() { - const LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 flags = LOAD_LIBRARY_SEARCH_SYSTEM32 } else if isBaseName(name) { // WindowsXP or unpatched Windows machine diff --git a/vendor/golang.org/x/sys/windows/empty.s b/vendor/golang.org/x/sys/windows/empty.s index 69309e4da5..fdbbbcd317 100644 --- a/vendor/golang.org/x/sys/windows/empty.s +++ b/vendor/golang.org/x/sys/windows/empty.s @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !go1.12 // +build !go1.12 // This file is here to allow bodyless functions with go:linkname for Go 1.11 diff --git a/vendor/golang.org/x/sys/windows/exec_windows.go b/vendor/golang.org/x/sys/windows/exec_windows.go index 3606c3a8b3..7a11e83b7e 100644 --- a/vendor/golang.org/x/sys/windows/exec_windows.go +++ b/vendor/golang.org/x/sys/windows/exec_windows.go @@ -6,6 +6,13 @@ package windows +import ( + errorspkg "errors" + "unsafe" + + "golang.org/x/sys/internal/unsafeheader" +) + // EscapeArg rewrites command line argument s as prescribed // in http://msdn.microsoft.com/en-us/library/ms880421. // This function returns "" (2 double quotes) if s is empty. @@ -73,6 +80,40 @@ func EscapeArg(s string) string { return string(qs[:j]) } +// ComposeCommandLine escapes and joins the given arguments suitable for use as a Windows command line, +// in CreateProcess's CommandLine argument, CreateService/ChangeServiceConfig's BinaryPathName argument, +// or any program that uses CommandLineToArgv. +func ComposeCommandLine(args []string) string { + var commandLine string + for i := range args { + if i > 0 { + commandLine += " " + } + commandLine += EscapeArg(args[i]) + } + return commandLine +} + +// DecomposeCommandLine breaks apart its argument command line into unescaped parts using CommandLineToArgv, +// as gathered from GetCommandLine, QUERY_SERVICE_CONFIG's BinaryPathName argument, or elsewhere that +// command lines are passed around. +func DecomposeCommandLine(commandLine string) ([]string, error) { + if len(commandLine) == 0 { + return []string{}, nil + } + var argc int32 + argv, err := CommandLineToArgv(StringToUTF16Ptr(commandLine), &argc) + if err != nil { + return nil, err + } + defer LocalFree(Handle(unsafe.Pointer(argv))) + var args []string + for _, v := range (*argv)[:argc] { + args = append(args, UTF16ToString((*v)[:])) + } + return args, nil +} + func CloseOnExec(fd Handle) { SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) } @@ -95,3 +136,60 @@ func FullPath(name string) (path string, err error) { } } } + +// NewProcThreadAttributeList allocates a new ProcThreadAttributeListContainer, with the requested maximum number of attributes. +func NewProcThreadAttributeList(maxAttrCount uint32) (*ProcThreadAttributeListContainer, error) { + var size uintptr + err := initializeProcThreadAttributeList(nil, maxAttrCount, 0, &size) + if err != ERROR_INSUFFICIENT_BUFFER { + if err == nil { + return nil, errorspkg.New("unable to query buffer size from InitializeProcThreadAttributeList") + } + return nil, err + } + // size is guaranteed to be ≥1 by InitializeProcThreadAttributeList. + al := &ProcThreadAttributeListContainer{data: (*ProcThreadAttributeList)(unsafe.Pointer(&make([]byte, size)[0]))} + err = initializeProcThreadAttributeList(al.data, maxAttrCount, 0, &size) + if err != nil { + return nil, err + } + return al, err +} + +// Update modifies the ProcThreadAttributeList using UpdateProcThreadAttribute. +// Note that the value passed to this function will be copied into memory +// allocated by LocalAlloc, the contents of which should not contain any +// Go-managed pointers, even if the passed value itself is a Go-managed +// pointer. +func (al *ProcThreadAttributeListContainer) Update(attribute uintptr, value unsafe.Pointer, size uintptr) error { + alloc, err := LocalAlloc(LMEM_FIXED, uint32(size)) + if err != nil { + return err + } + var src, dst []byte + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&src)) + hdr.Data = value + hdr.Cap = int(size) + hdr.Len = int(size) + hdr = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) + hdr.Data = unsafe.Pointer(alloc) + hdr.Cap = int(size) + hdr.Len = int(size) + copy(dst, src) + al.heapAllocations = append(al.heapAllocations, alloc) + return updateProcThreadAttribute(al.data, 0, attribute, unsafe.Pointer(alloc), size, nil, nil) +} + +// Delete frees ProcThreadAttributeList's resources. +func (al *ProcThreadAttributeListContainer) Delete() { + deleteProcThreadAttributeList(al.data) + for i := range al.heapAllocations { + LocalFree(Handle(al.heapAllocations[i])) + } + al.heapAllocations = nil +} + +// List returns the actual ProcThreadAttributeList to be passed to StartupInfoEx. +func (al *ProcThreadAttributeListContainer) List() *ProcThreadAttributeList { + return al.data +} diff --git a/vendor/golang.org/x/sys/windows/memory_windows.go b/vendor/golang.org/x/sys/windows/memory_windows.go index e409d76f0f..6dc0920a84 100644 --- a/vendor/golang.org/x/sys/windows/memory_windows.go +++ b/vendor/golang.org/x/sys/windows/memory_windows.go @@ -16,16 +16,33 @@ const ( MEM_RESET_UNDO = 0x01000000 MEM_LARGE_PAGES = 0x20000000 - PAGE_NOACCESS = 0x01 - PAGE_READONLY = 0x02 - PAGE_READWRITE = 0x04 - PAGE_WRITECOPY = 0x08 - PAGE_EXECUTE_READ = 0x20 - PAGE_EXECUTE_READWRITE = 0x40 - PAGE_EXECUTE_WRITECOPY = 0x80 + PAGE_NOACCESS = 0x00000001 + PAGE_READONLY = 0x00000002 + PAGE_READWRITE = 0x00000004 + PAGE_WRITECOPY = 0x00000008 + PAGE_EXECUTE = 0x00000010 + PAGE_EXECUTE_READ = 0x00000020 + PAGE_EXECUTE_READWRITE = 0x00000040 + PAGE_EXECUTE_WRITECOPY = 0x00000080 + PAGE_GUARD = 0x00000100 + PAGE_NOCACHE = 0x00000200 + PAGE_WRITECOMBINE = 0x00000400 + PAGE_TARGETS_INVALID = 0x40000000 + PAGE_TARGETS_NO_UPDATE = 0x40000000 QUOTA_LIMITS_HARDWS_MIN_DISABLE = 0x00000002 QUOTA_LIMITS_HARDWS_MIN_ENABLE = 0x00000001 QUOTA_LIMITS_HARDWS_MAX_DISABLE = 0x00000008 QUOTA_LIMITS_HARDWS_MAX_ENABLE = 0x00000004 ) + +type MemoryBasicInformation struct { + BaseAddress uintptr + AllocationBase uintptr + AllocationProtect uint32 + PartitionId uint16 + RegionSize uintptr + State uint32 + Protect uint32 + Type uint32 +} diff --git a/vendor/golang.org/x/sys/windows/mkerrors.bash b/vendor/golang.org/x/sys/windows/mkerrors.bash index 2163843a11..58e0188fb7 100644 --- a/vendor/golang.org/x/sys/windows/mkerrors.bash +++ b/vendor/golang.org/x/sys/windows/mkerrors.bash @@ -9,6 +9,8 @@ shopt -s nullglob winerror="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/winerror.h | sort -Vr | head -n 1)" [[ -n $winerror ]] || { echo "Unable to find winerror.h" >&2; exit 1; } +ntstatus="$(printf '%s\n' "/mnt/c/Program Files (x86)/Windows Kits/"/*/Include/*/shared/ntstatus.h | sort -Vr | head -n 1)" +[[ -n $ntstatus ]] || { echo "Unable to find ntstatus.h" >&2; exit 1; } declare -A errors @@ -59,5 +61,10 @@ declare -A errors echo "$key $vtype = $value" done < "$winerror" + while read -r line; do + [[ $line =~ ^#define\ (STATUS_[^\s]+)\ +\(\(NTSTATUS\)((0x)?[0-9a-fA-F]+)L?\) ]] || continue + echo "${BASH_REMATCH[1]} NTStatus = ${BASH_REMATCH[2]}" + done < "$ntstatus" + echo ")" } | gofmt > "zerrors_windows.go" diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 9e3c44a855..d414ef13be 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -624,6 +624,7 @@ func (tml *Tokenmandatorylabel) Size() uint32 { // Authorization Functions //sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership +//sys isTokenRestricted(tokenHandle Token) (ret bool, err error) [!failretval] = advapi32.IsTokenRestricted //sys OpenProcessToken(process Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken //sys OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) = advapi32.OpenThreadToken //sys ImpersonateSelf(impersonationlevel uint32) (err error) = advapi32.ImpersonateSelf @@ -837,6 +838,16 @@ func (t Token) IsMember(sid *SID) (bool, error) { return b != 0, nil } +// IsRestricted reports whether the access token t is a restricted token. +func (t Token) IsRestricted() (isRestricted bool, err error) { + isRestricted, err = isTokenRestricted(t) + if !isRestricted && err == syscall.EINVAL { + // If err is EINVAL, this returned ERROR_SUCCESS indicating a non-restricted token. + err = nil + } + return +} + const ( WTS_CONSOLE_CONNECT = 0x1 WTS_CONSOLE_DISCONNECT = 0x2 @@ -878,6 +889,7 @@ type WTS_SESSION_INFO struct { //sys WTSQueryUserToken(session uint32, token *Token) (err error) = wtsapi32.WTSQueryUserToken //sys WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) = wtsapi32.WTSEnumerateSessionsW //sys WTSFreeMemory(ptr uintptr) = wtsapi32.WTSFreeMemory +//sys WTSGetActiveConsoleSessionId() (sessionID uint32) type ACL struct { aclRevision byte @@ -897,6 +909,19 @@ type SECURITY_DESCRIPTOR struct { dacl *ACL } +type SECURITY_QUALITY_OF_SERVICE struct { + Length uint32 + ImpersonationLevel uint32 + ContextTrackingMode byte + EffectiveOnly byte +} + +// Constants for the ContextTrackingMode field of SECURITY_QUALITY_OF_SERVICE. +const ( + SECURITY_STATIC_TRACKING = 0 + SECURITY_DYNAMIC_TRACKING = 1 +) + type SecurityAttributes struct { Length uint32 SecurityDescriptor *SECURITY_DESCRIPTOR @@ -1103,9 +1128,10 @@ type OBJECTS_AND_NAME struct { } //sys getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) = advapi32.GetSecurityInfo -//sys SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) = advapi32.SetSecurityInfo +//sys SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) = advapi32.SetSecurityInfo //sys getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) = advapi32.GetNamedSecurityInfoW //sys SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) = advapi32.SetNamedSecurityInfoW +//sys SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) = advapi32.SetKernelObjectSecurity //sys buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) = advapi32.BuildSecurityDescriptorW //sys initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) = advapi32.InitializeSecurityDescriptor @@ -1309,7 +1335,11 @@ func (absoluteSD *SECURITY_DESCRIPTOR) ToSelfRelative() (selfRelativeSD *SECURIT } func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor() *SECURITY_DESCRIPTOR { - sdLen := (int)(selfRelativeSD.Length()) + sdLen := int(selfRelativeSD.Length()) + const min = int(unsafe.Sizeof(SECURITY_DESCRIPTOR{})) + if sdLen < min { + sdLen = min + } var src []byte h := (*unsafeheader.Slice)(unsafe.Pointer(&src)) @@ -1317,7 +1347,15 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor() h.Len = sdLen h.Cap = sdLen - dst := make([]byte, sdLen) + const psize = int(unsafe.Sizeof(uintptr(0))) + + var dst []byte + h = (*unsafeheader.Slice)(unsafe.Pointer(&dst)) + alloc := make([]uintptr, (sdLen+psize-1)/psize) + h.Data = (*unsafeheader.Slice)(unsafe.Pointer(&alloc)).Data + h.Len = sdLen + h.Cap = sdLen + copy(dst, src) return (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&dst[0])) } diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go index 847e00bc99..b269850d06 100644 --- a/vendor/golang.org/x/sys/windows/service.go +++ b/vendor/golang.org/x/sys/windows/service.go @@ -65,6 +65,7 @@ const ( SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 32 SERVICE_ACCEPT_POWEREVENT = 64 SERVICE_ACCEPT_SESSIONCHANGE = 128 + SERVICE_ACCEPT_PRESHUTDOWN = 256 SERVICE_CONTROL_STOP = 1 SERVICE_CONTROL_PAUSE = 2 @@ -80,6 +81,7 @@ const ( SERVICE_CONTROL_HARDWAREPROFILECHANGE = 12 SERVICE_CONTROL_POWEREVENT = 13 SERVICE_CONTROL_SESSIONCHANGE = 14 + SERVICE_CONTROL_PRESHUTDOWN = 15 SERVICE_ACTIVE = 1 SERVICE_INACTIVE = 2 @@ -126,6 +128,10 @@ const ( SERVICE_NOTIFY_CREATED = 0x00000080 SERVICE_NOTIFY_DELETED = 0x00000100 SERVICE_NOTIFY_DELETE_PENDING = 0x00000200 + + SC_EVENT_DATABASE_CHANGE = 0 + SC_EVENT_PROPERTY_CHANGE = 1 + SC_EVENT_STATUS_CHANGE = 2 ) type SERVICE_STATUS struct { @@ -227,3 +233,5 @@ type QUERY_SERVICE_LOCK_STATUS struct { //sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW //sys QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceStatusEx //sys NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) = advapi32.NotifyServiceStatusChangeW +//sys SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) = sechost.SubscribeServiceChangeNotifications? +//sys UnsubscribeServiceChangeNotifications(subscription uintptr) = sechost.UnsubscribeServiceChangeNotifications? diff --git a/vendor/golang.org/x/sys/windows/setupapierrors_windows.go b/vendor/golang.org/x/sys/windows/setupapierrors_windows.go new file mode 100644 index 0000000000..1681810e04 --- /dev/null +++ b/vendor/golang.org/x/sys/windows/setupapierrors_windows.go @@ -0,0 +1,100 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package windows + +import "syscall" + +const ( + ERROR_EXPECTED_SECTION_NAME syscall.Errno = 0x20000000 | 0xC0000000 | 0 + ERROR_BAD_SECTION_NAME_LINE syscall.Errno = 0x20000000 | 0xC0000000 | 1 + ERROR_SECTION_NAME_TOO_LONG syscall.Errno = 0x20000000 | 0xC0000000 | 2 + ERROR_GENERAL_SYNTAX syscall.Errno = 0x20000000 | 0xC0000000 | 3 + ERROR_WRONG_INF_STYLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x100 + ERROR_SECTION_NOT_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x101 + ERROR_LINE_NOT_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x102 + ERROR_NO_BACKUP syscall.Errno = 0x20000000 | 0xC0000000 | 0x103 + ERROR_NO_ASSOCIATED_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x200 + ERROR_CLASS_MISMATCH syscall.Errno = 0x20000000 | 0xC0000000 | 0x201 + ERROR_DUPLICATE_FOUND syscall.Errno = 0x20000000 | 0xC0000000 | 0x202 + ERROR_NO_DRIVER_SELECTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x203 + ERROR_KEY_DOES_NOT_EXIST syscall.Errno = 0x20000000 | 0xC0000000 | 0x204 + ERROR_INVALID_DEVINST_NAME syscall.Errno = 0x20000000 | 0xC0000000 | 0x205 + ERROR_INVALID_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x206 + ERROR_DEVINST_ALREADY_EXISTS syscall.Errno = 0x20000000 | 0xC0000000 | 0x207 + ERROR_DEVINFO_NOT_REGISTERED syscall.Errno = 0x20000000 | 0xC0000000 | 0x208 + ERROR_INVALID_REG_PROPERTY syscall.Errno = 0x20000000 | 0xC0000000 | 0x209 + ERROR_NO_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x20A + ERROR_NO_SUCH_DEVINST syscall.Errno = 0x20000000 | 0xC0000000 | 0x20B + ERROR_CANT_LOAD_CLASS_ICON syscall.Errno = 0x20000000 | 0xC0000000 | 0x20C + ERROR_INVALID_CLASS_INSTALLER syscall.Errno = 0x20000000 | 0xC0000000 | 0x20D + ERROR_DI_DO_DEFAULT syscall.Errno = 0x20000000 | 0xC0000000 | 0x20E + ERROR_DI_NOFILECOPY syscall.Errno = 0x20000000 | 0xC0000000 | 0x20F + ERROR_INVALID_HWPROFILE syscall.Errno = 0x20000000 | 0xC0000000 | 0x210 + ERROR_NO_DEVICE_SELECTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x211 + ERROR_DEVINFO_LIST_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x212 + ERROR_DEVINFO_DATA_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x213 + ERROR_DI_BAD_PATH syscall.Errno = 0x20000000 | 0xC0000000 | 0x214 + ERROR_NO_CLASSINSTALL_PARAMS syscall.Errno = 0x20000000 | 0xC0000000 | 0x215 + ERROR_FILEQUEUE_LOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x216 + ERROR_BAD_SERVICE_INSTALLSECT syscall.Errno = 0x20000000 | 0xC0000000 | 0x217 + ERROR_NO_CLASS_DRIVER_LIST syscall.Errno = 0x20000000 | 0xC0000000 | 0x218 + ERROR_NO_ASSOCIATED_SERVICE syscall.Errno = 0x20000000 | 0xC0000000 | 0x219 + ERROR_NO_DEFAULT_DEVICE_INTERFACE syscall.Errno = 0x20000000 | 0xC0000000 | 0x21A + ERROR_DEVICE_INTERFACE_ACTIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x21B + ERROR_DEVICE_INTERFACE_REMOVED syscall.Errno = 0x20000000 | 0xC0000000 | 0x21C + ERROR_BAD_INTERFACE_INSTALLSECT syscall.Errno = 0x20000000 | 0xC0000000 | 0x21D + ERROR_NO_SUCH_INTERFACE_CLASS syscall.Errno = 0x20000000 | 0xC0000000 | 0x21E + ERROR_INVALID_REFERENCE_STRING syscall.Errno = 0x20000000 | 0xC0000000 | 0x21F + ERROR_INVALID_MACHINENAME syscall.Errno = 0x20000000 | 0xC0000000 | 0x220 + ERROR_REMOTE_COMM_FAILURE syscall.Errno = 0x20000000 | 0xC0000000 | 0x221 + ERROR_MACHINE_UNAVAILABLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x222 + ERROR_NO_CONFIGMGR_SERVICES syscall.Errno = 0x20000000 | 0xC0000000 | 0x223 + ERROR_INVALID_PROPPAGE_PROVIDER syscall.Errno = 0x20000000 | 0xC0000000 | 0x224 + ERROR_NO_SUCH_DEVICE_INTERFACE syscall.Errno = 0x20000000 | 0xC0000000 | 0x225 + ERROR_DI_POSTPROCESSING_REQUIRED syscall.Errno = 0x20000000 | 0xC0000000 | 0x226 + ERROR_INVALID_COINSTALLER syscall.Errno = 0x20000000 | 0xC0000000 | 0x227 + ERROR_NO_COMPAT_DRIVERS syscall.Errno = 0x20000000 | 0xC0000000 | 0x228 + ERROR_NO_DEVICE_ICON syscall.Errno = 0x20000000 | 0xC0000000 | 0x229 + ERROR_INVALID_INF_LOGCONFIG syscall.Errno = 0x20000000 | 0xC0000000 | 0x22A + ERROR_DI_DONT_INSTALL syscall.Errno = 0x20000000 | 0xC0000000 | 0x22B + ERROR_INVALID_FILTER_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22C + ERROR_NON_WINDOWS_NT_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22D + ERROR_NON_WINDOWS_DRIVER syscall.Errno = 0x20000000 | 0xC0000000 | 0x22E + ERROR_NO_CATALOG_FOR_OEM_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x22F + ERROR_DEVINSTALL_QUEUE_NONNATIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x230 + ERROR_NOT_DISABLEABLE syscall.Errno = 0x20000000 | 0xC0000000 | 0x231 + ERROR_CANT_REMOVE_DEVINST syscall.Errno = 0x20000000 | 0xC0000000 | 0x232 + ERROR_INVALID_TARGET syscall.Errno = 0x20000000 | 0xC0000000 | 0x233 + ERROR_DRIVER_NONNATIVE syscall.Errno = 0x20000000 | 0xC0000000 | 0x234 + ERROR_IN_WOW64 syscall.Errno = 0x20000000 | 0xC0000000 | 0x235 + ERROR_SET_SYSTEM_RESTORE_POINT syscall.Errno = 0x20000000 | 0xC0000000 | 0x236 + ERROR_SCE_DISABLED syscall.Errno = 0x20000000 | 0xC0000000 | 0x238 + ERROR_UNKNOWN_EXCEPTION syscall.Errno = 0x20000000 | 0xC0000000 | 0x239 + ERROR_PNP_REGISTRY_ERROR syscall.Errno = 0x20000000 | 0xC0000000 | 0x23A + ERROR_REMOTE_REQUEST_UNSUPPORTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x23B + ERROR_NOT_AN_INSTALLED_OEM_INF syscall.Errno = 0x20000000 | 0xC0000000 | 0x23C + ERROR_INF_IN_USE_BY_DEVICES syscall.Errno = 0x20000000 | 0xC0000000 | 0x23D + ERROR_DI_FUNCTION_OBSOLETE syscall.Errno = 0x20000000 | 0xC0000000 | 0x23E + ERROR_NO_AUTHENTICODE_CATALOG syscall.Errno = 0x20000000 | 0xC0000000 | 0x23F + ERROR_AUTHENTICODE_DISALLOWED syscall.Errno = 0x20000000 | 0xC0000000 | 0x240 + ERROR_AUTHENTICODE_TRUSTED_PUBLISHER syscall.Errno = 0x20000000 | 0xC0000000 | 0x241 + ERROR_AUTHENTICODE_TRUST_NOT_ESTABLISHED syscall.Errno = 0x20000000 | 0xC0000000 | 0x242 + ERROR_AUTHENTICODE_PUBLISHER_NOT_TRUSTED syscall.Errno = 0x20000000 | 0xC0000000 | 0x243 + ERROR_SIGNATURE_OSATTRIBUTE_MISMATCH syscall.Errno = 0x20000000 | 0xC0000000 | 0x244 + ERROR_ONLY_VALIDATE_VIA_AUTHENTICODE syscall.Errno = 0x20000000 | 0xC0000000 | 0x245 + ERROR_DEVICE_INSTALLER_NOT_READY syscall.Errno = 0x20000000 | 0xC0000000 | 0x246 + ERROR_DRIVER_STORE_ADD_FAILED syscall.Errno = 0x20000000 | 0xC0000000 | 0x247 + ERROR_DEVICE_INSTALL_BLOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x248 + ERROR_DRIVER_INSTALL_BLOCKED syscall.Errno = 0x20000000 | 0xC0000000 | 0x249 + ERROR_WRONG_INF_TYPE syscall.Errno = 0x20000000 | 0xC0000000 | 0x24A + ERROR_FILE_HASH_NOT_IN_CATALOG syscall.Errno = 0x20000000 | 0xC0000000 | 0x24B + ERROR_DRIVER_STORE_DELETE_FAILED syscall.Errno = 0x20000000 | 0xC0000000 | 0x24C + ERROR_UNRECOVERABLE_STACK_OVERFLOW syscall.Errno = 0x20000000 | 0xC0000000 | 0x300 + EXCEPTION_SPAPI_UNRECOVERABLE_STACK_OVERFLOW syscall.Errno = ERROR_UNRECOVERABLE_STACK_OVERFLOW + ERROR_NO_DEFAULT_INTERFACE_DEVICE syscall.Errno = ERROR_NO_DEFAULT_DEVICE_INTERFACE + ERROR_INTERFACE_DEVICE_ACTIVE syscall.Errno = ERROR_DEVICE_INTERFACE_ACTIVE + ERROR_INTERFACE_DEVICE_REMOVED syscall.Errno = ERROR_DEVICE_INTERFACE_REMOVED + ERROR_NO_SUCH_INTERFACE_DEVICE syscall.Errno = ERROR_NO_SUCH_DEVICE_INTERFACE +) diff --git a/vendor/golang.org/x/sys/windows/syscall.go b/vendor/golang.org/x/sys/windows/syscall.go index af828a91bc..6122f557a0 100644 --- a/vendor/golang.org/x/sys/windows/syscall.go +++ b/vendor/golang.org/x/sys/windows/syscall.go @@ -25,17 +25,20 @@ package windows // import "golang.org/x/sys/windows" import ( + "bytes" + "strings" "syscall" + "unsafe" + + "golang.org/x/sys/internal/unsafeheader" ) // ByteSliceFromString returns a NUL-terminated slice of bytes // containing the text of s. If s contains a NUL byte at any // location, it returns (nil, syscall.EINVAL). func ByteSliceFromString(s string) ([]byte, error) { - for i := 0; i < len(s); i++ { - if s[i] == 0 { - return nil, syscall.EINVAL - } + if strings.IndexByte(s, 0) != -1 { + return nil, syscall.EINVAL } a := make([]byte, len(s)+1) copy(a, s) @@ -53,6 +56,41 @@ func BytePtrFromString(s string) (*byte, error) { return &a[0], nil } +// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any +// bytes after the NUL removed. +func ByteSliceToString(s []byte) string { + if i := bytes.IndexByte(s, 0); i != -1 { + s = s[:i] + } + return string(s) +} + +// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string. +// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated +// at a zero byte; if the zero byte is not present, the program may crash. +func BytePtrToString(p *byte) string { + if p == nil { + return "" + } + if *p == 0 { + return "" + } + + // Find NUL terminator. + n := 0 + for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ { + ptr = unsafe.Pointer(uintptr(ptr) + 1) + } + + var s []byte + h := (*unsafeheader.Slice)(unsafe.Pointer(&s)) + h.Data = unsafe.Pointer(p) + h.Len = n + h.Cap = n + + return string(s) +} + // Single-word zero for use when we need a valid pointer to 0 bytes. // See mksyscall.pl. var _zero uintptr diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index 62cf70e9f6..d3b59ae69c 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -8,6 +8,8 @@ package windows import ( errorspkg "errors" + "fmt" + "runtime" "sync" "syscall" "time" @@ -18,9 +20,11 @@ import ( ) type Handle uintptr +type HWND uintptr const ( InvalidHandle = ^Handle(0) + InvalidHWND = ^HWND(0) // Flags for DefineDosDevice. DDD_EXACT_MATCH_ON_REMOVE = 0x00000004 @@ -63,9 +67,8 @@ const ( LOCKFILE_FAIL_IMMEDIATELY = 0x00000001 LOCKFILE_EXCLUSIVE_LOCK = 0x00000002 - // Return values of SleepEx and other APC functions - STATUS_USER_APC = 0x000000C0 - WAIT_IO_COMPLETION = STATUS_USER_APC + // Return value of SleepEx and other APC functions + WAIT_IO_COMPLETION = 0x000000C0 ) // StringToUTF16 is deprecated. Use UTF16FromString instead. @@ -92,11 +95,11 @@ func UTF16FromString(s string) ([]uint16, error) { } // UTF16ToString returns the UTF-8 encoding of the UTF-16 sequence s, -// with a terminating NUL removed. +// with a terminating NUL and any bytes after the NUL removed. func UTF16ToString(s []uint16) string { for i, v := range s { if v == 0 { - s = s[0:i] + s = s[:i] break } } @@ -120,7 +123,7 @@ func UTF16PtrFromString(s string) (*uint16, error) { } // UTF16PtrToString takes a pointer to a UTF-16 sequence and returns the corresponding UTF-8 encoded string. -// If the pointer is nil, this returns the empty string. This assumes that the UTF-16 sequence is terminated +// If the pointer is nil, it returns the empty string. It assumes that the UTF-16 sequence is terminated // at a zero word; if the zero word is not present, the program may crash. func UTF16PtrToString(p *uint16) string { if p == nil { @@ -170,11 +173,19 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetProcAddress(module Handle, procname string) (proc uintptr, err error) //sys GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) = kernel32.GetModuleFileNameW //sys GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) = kernel32.GetModuleHandleExW +//sys SetDefaultDllDirectories(directoryFlags uint32) (err error) +//sys SetDllDirectory(path string) (err error) = kernel32.SetDllDirectoryW //sys GetVersion() (ver uint32, err error) //sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW //sys ExitProcess(exitcode uint32) //sys IsWow64Process(handle Handle, isWow64 *bool) (err error) = IsWow64Process +//sys IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) = IsWow64Process2? //sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW +//sys CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) [failretval==InvalidHandle] = CreateNamedPipeW +//sys ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) +//sys GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) +//sys GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) = GetNamedPipeHandleStateW +//sys SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) = SetNamedPipeHandleState //sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) @@ -187,6 +198,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys FindClose(handle Handle) (err error) //sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) //sys GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) +//sys SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) //sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW //sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW //sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW @@ -202,14 +214,22 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetSystemTimeAsFileTime(time *Filetime) //sys GetSystemTimePreciseAsFileTime(time *Filetime) //sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff] -//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) -//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) -//sys PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) +//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) +//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) +//sys PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) //sys CancelIo(s Handle) (err error) //sys CancelIoEx(s Handle, o *Overlapped) (err error) //sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW +//sys CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = advapi32.CreateProcessAsUserW +//sys initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) = InitializeProcThreadAttributeList +//sys deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) = DeleteProcThreadAttributeList +//sys updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) = UpdateProcThreadAttribute //sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) //sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW +//sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId +//sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow +//sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW +//sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx //sys shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath //sys TerminateProcess(handle Handle, exitcode uint32) (err error) //sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) @@ -238,12 +258,14 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW //sys CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW //sys LocalFree(hmem Handle) (handle Handle, err error) [failretval!=0] +//sys LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) //sys SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) //sys FlushFileBuffers(handle Handle) (err error) //sys GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) = kernel32.GetFullPathNameW //sys GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) = kernel32.GetLongPathNameW //sys GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) = kernel32.GetShortPathNameW -//sys CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) = kernel32.CreateFileMappingW +//sys GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) = kernel32.GetFinalPathNameByHandleW +//sys CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateFileMappingW //sys MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) //sys UnmapViewOfFile(addr uintptr) (err error) //sys FlushViewOfFile(addr uintptr, length uintptr) (err error) @@ -252,27 +274,51 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) = kernel32.VirtualAlloc //sys VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) = kernel32.VirtualFree //sys VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) = kernel32.VirtualProtect +//sys VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) = kernel32.VirtualProtectEx +//sys VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) = kernel32.VirtualQuery +//sys VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) = kernel32.VirtualQueryEx +//sys ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) = kernel32.ReadProcessMemory +//sys WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) = kernel32.WriteProcessMemory //sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile //sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW +//sys FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.FindFirstChangeNotificationW +//sys FindNextChangeNotification(handle Handle) (err error) +//sys FindCloseChangeNotification(handle Handle) (err error) //sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) = crypt32.CertOpenSystemStoreW -//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) [failretval==InvalidHandle] = crypt32.CertOpenStore +//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) = crypt32.CertOpenStore //sys CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) [failretval==nil] = crypt32.CertEnumCertificatesInStore -//sys CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) = crypt32.CertAddCertificateContextToStore +//sys CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) = crypt32.CertAddCertificateContextToStore //sys CertCloseStore(store Handle, flags uint32) (err error) = crypt32.CertCloseStore -//sys CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) = crypt32.CertGetCertificateChain -//sys CertFreeCertificateChain(ctx *CertChainContext) = crypt32.CertFreeCertificateChain -//sys CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) [failretval==nil] = crypt32.CertCreateCertificateContext -//sys CertFreeCertificateContext(ctx *CertContext) (err error) = crypt32.CertFreeCertificateContext -//sys CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) = crypt32.CertVerifyCertificateChainPolicy +//sys CertDeleteCertificateFromStore(certContext *CertContext) (err error) = crypt32.CertDeleteCertificateFromStore +//sys CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) = crypt32.CertDuplicateCertificateContext +//sys PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) = crypt32.PFXImportCertStore +//sys CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) = crypt32.CertGetCertificateChain +//sys CertFreeCertificateChain(ctx *CertChainContext) = crypt32.CertFreeCertificateChain +//sys CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) [failretval==nil] = crypt32.CertCreateCertificateContext +//sys CertFreeCertificateContext(ctx *CertContext) (err error) = crypt32.CertFreeCertificateContext +//sys CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) = crypt32.CertVerifyCertificateChainPolicy +//sys CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) = crypt32.CertGetNameStringW +//sys CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) = crypt32.CertFindExtension +//sys CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) [failretval==nil] = crypt32.CertFindCertificateInStore +//sys CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) [failretval==nil] = crypt32.CertFindChainInStore +//sys CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, parameters unsafe.Pointer, cryptProvOrNCryptKey *Handle, keySpec *uint32, callerFreeProvOrNCryptKey *bool) (err error) = crypt32.CryptAcquireCertificatePrivateKey +//sys CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) = crypt32.CryptQueryObject +//sys CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) = crypt32.CryptDecodeObject +//sys CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) = crypt32.CryptProtectData +//sys CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) = crypt32.CryptUnprotectData +//sys WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) = wintrust.WinVerifyTrustEx //sys RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) = advapi32.RegOpenKeyExW //sys RegCloseKey(key Handle) (regerrno error) = advapi32.RegCloseKey //sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW //sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW //sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW +//sys RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) = advapi32.RegNotifyChangeKeyValue //sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId +//sys ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) = kernel32.ProcessIdToSessionId //sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode //sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode //sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo +//sys setConsoleCursorPosition(console Handle, position uint32) (err error) = kernel32.SetConsoleCursorPosition //sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW //sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW //sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot @@ -285,14 +331,14 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW //sys CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) [failretval&0xff==0] = CreateHardLinkW //sys GetCurrentThreadId() (id uint32) -//sys CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) = kernel32.CreateEventW -//sys CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateEventExW +//sys CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateEventW +//sys CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateEventExW //sys OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenEventW //sys SetEvent(event Handle) (err error) = kernel32.SetEvent //sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent //sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent -//sys CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) = kernel32.CreateMutexW -//sys CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateMutexExW +//sys CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateMutexW +//sys CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) [failretval == 0 || e1 == ERROR_ALREADY_EXISTS] = kernel32.CreateMutexExW //sys OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenMutexW //sys ReleaseMutex(mutex Handle) (err error) = kernel32.ReleaseMutex //sys SleepEx(milliseconds uint32, alertable bool) (ret uint32) = kernel32.SleepEx @@ -303,13 +349,17 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys ResumeThread(thread Handle) (ret uint32, err error) [failretval==0xffffffff] = kernel32.ResumeThread //sys SetPriorityClass(process Handle, priorityClass uint32) (err error) = kernel32.SetPriorityClass //sys GetPriorityClass(process Handle) (ret uint32, err error) = kernel32.GetPriorityClass +//sys QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) = kernel32.QueryInformationJobObject //sys SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) //sys GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) //sys GetProcessId(process Handle) (id uint32, err error) +//sys QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) = kernel32.QueryFullProcessImageNameW //sys OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) //sys SetProcessPriorityBoost(process Handle, disable bool) (err error) = kernel32.SetProcessPriorityBoost //sys GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) //sys SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) +//sys GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) +//sys SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) // Volume Management Functions //sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW @@ -332,8 +382,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW //sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW //sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW -//sys MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW -//sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx //sys InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) = advapi32.InitiateSystemShutdownExW //sys SetProcessShutdownParameters(level uint32, flags uint32) (err error) = kernel32.SetProcessShutdownParameters //sys GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) = kernel32.GetProcessShutdownParameters @@ -341,15 +389,40 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) = ole32.StringFromGUID2 //sys coCreateGuid(pguid *GUID) (ret error) = ole32.CoCreateGuid //sys CoTaskMemFree(address unsafe.Pointer) = ole32.CoTaskMemFree -//sys rtlGetVersion(info *OsVersionInfoEx) (ret error) = ntdll.RtlGetVersion -//sys rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) = ntdll.RtlGetNtVersionNumbers +//sys CoInitializeEx(reserved uintptr, coInit uint32) (ret error) = ole32.CoInitializeEx +//sys CoUninitialize() = ole32.CoUninitialize +//sys CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) = ole32.CoGetObject //sys getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetProcessPreferredUILanguages //sys getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetThreadPreferredUILanguages //sys getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetUserPreferredUILanguages //sys getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) = kernel32.GetSystemPreferredUILanguages +//sys findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) = kernel32.FindResourceW +//sys SizeofResource(module Handle, resInfo Handle) (size uint32, err error) = kernel32.SizeofResource +//sys LoadResource(module Handle, resInfo Handle) (resData Handle, err error) = kernel32.LoadResource +//sys LockResource(resData Handle) (addr uintptr, err error) = kernel32.LockResource // Process Status API (PSAPI) //sys EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) = psapi.EnumProcesses +//sys EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) = psapi.EnumProcessModules +//sys EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) = psapi.EnumProcessModulesEx +//sys GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) = psapi.GetModuleInformation +//sys GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) = psapi.GetModuleFileNameExW +//sys GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) = psapi.GetModuleBaseNameW + +// NT Native APIs +//sys rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) = ntdll.RtlNtStatusToDosErrorNoTeb +//sys rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) = ntdll.RtlGetVersion +//sys rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) = ntdll.RtlGetNtVersionNumbers +//sys RtlGetCurrentPeb() (peb *PEB) = ntdll.RtlGetCurrentPeb +//sys RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) = ntdll.RtlInitUnicodeString +//sys RtlInitString(destinationString *NTString, sourceString *byte) = ntdll.RtlInitString +//sys NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) = ntdll.NtCreateFile +//sys NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) = ntdll.NtCreateNamedPipeFile +//sys RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) = ntdll.RtlDosPathNameToNtPathName_U_WithStatus +//sys RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) = ntdll.RtlDosPathNameToRelativeNtPathName_U_WithStatus +//sys RtlDefaultNpAcl(acl **ACL) (ntstatus error) = ntdll.RtlDefaultNpAcl +//sys NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) = ntdll.NtQueryInformationProcess +//sys NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) = ntdll.NtSetInformationProcess // syscall interface implementation for other packages @@ -387,11 +460,7 @@ func GetProcAddressByOrdinal(module Handle, ordinal uintptr) (proc uintptr, err r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), ordinal, 0) proc = uintptr(r0) if proc == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } @@ -748,6 +817,7 @@ const socket_error = uintptr(^uint32(0)) //sys WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASend //sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecvFrom //sys WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASendTo +//sys WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.WSASocketW //sys GetHostByName(name string) (h *Hostent, err error) [failretval==nil] = ws2_32.gethostbyname //sys GetServByName(name string, proto string) (s *Servent, err error) [failretval==nil] = ws2_32.getservbyname //sys Ntohs(netshort uint16) (u uint16) = ws2_32.ntohs @@ -761,6 +831,7 @@ const socket_error = uintptr(^uint32(0)) //sys GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) = iphlpapi.GetAdaptersInfo //sys SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) = kernel32.SetFileCompletionNotificationModes //sys WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) [failretval==-1] = ws2_32.WSAEnumProtocolsW +//sys WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) = ws2_32.WSAGetOverlappedResult //sys GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) = iphlpapi.GetAdaptersAddresses //sys GetACP() (acp uint32) = kernel32.GetACP //sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar @@ -1088,11 +1159,7 @@ func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlap } r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.sendAddr, 6, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(flags), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return err } @@ -1104,11 +1171,7 @@ func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overl } r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.recvAddr, 5, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(bytesReceived)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0) if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return err } @@ -1487,3 +1550,133 @@ func getUILanguages(flags uint32, f func(flags uint32, numLanguages *uint32, buf return languages, nil } } + +func SetConsoleCursorPosition(console Handle, position Coord) error { + return setConsoleCursorPosition(console, *((*uint32)(unsafe.Pointer(&position)))) +} + +func (s NTStatus) Errno() syscall.Errno { + return rtlNtStatusToDosErrorNoTeb(s) +} + +func langID(pri, sub uint16) uint32 { return uint32(sub)<<10 | uint32(pri) } + +func (s NTStatus) Error() string { + b := make([]uint16, 300) + n, err := FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_FROM_HMODULE|FORMAT_MESSAGE_ARGUMENT_ARRAY, modntdll.Handle(), uint32(s), langID(LANG_ENGLISH, SUBLANG_ENGLISH_US), b, nil) + if err != nil { + return fmt.Sprintf("NTSTATUS 0x%08x", uint32(s)) + } + // trim terminating \r and \n + for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- { + } + return string(utf16.Decode(b[:n])) +} + +// NewNTUnicodeString returns a new NTUnicodeString structure for use with native +// NT APIs that work over the NTUnicodeString type. Note that most Windows APIs +// do not use NTUnicodeString, and instead UTF16PtrFromString should be used for +// the more common *uint16 string type. +func NewNTUnicodeString(s string) (*NTUnicodeString, error) { + var u NTUnicodeString + s16, err := UTF16PtrFromString(s) + if err != nil { + return nil, err + } + RtlInitUnicodeString(&u, s16) + return &u, nil +} + +// Slice returns a uint16 slice that aliases the data in the NTUnicodeString. +func (s *NTUnicodeString) Slice() []uint16 { + var slice []uint16 + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice)) + hdr.Data = unsafe.Pointer(s.Buffer) + hdr.Len = int(s.Length) + hdr.Cap = int(s.MaximumLength) + return slice +} + +func (s *NTUnicodeString) String() string { + return UTF16ToString(s.Slice()) +} + +// NewNTString returns a new NTString structure for use with native +// NT APIs that work over the NTString type. Note that most Windows APIs +// do not use NTString, and instead UTF16PtrFromString should be used for +// the more common *uint16 string type. +func NewNTString(s string) (*NTString, error) { + var nts NTString + s8, err := BytePtrFromString(s) + if err != nil { + return nil, err + } + RtlInitString(&nts, s8) + return &nts, nil +} + +// Slice returns a byte slice that aliases the data in the NTString. +func (s *NTString) Slice() []byte { + var slice []byte + hdr := (*unsafeheader.Slice)(unsafe.Pointer(&slice)) + hdr.Data = unsafe.Pointer(s.Buffer) + hdr.Len = int(s.Length) + hdr.Cap = int(s.MaximumLength) + return slice +} + +func (s *NTString) String() string { + return ByteSliceToString(s.Slice()) +} + +// FindResource resolves a resource of the given name and resource type. +func FindResource(module Handle, name, resType ResourceIDOrString) (Handle, error) { + var namePtr, resTypePtr uintptr + var name16, resType16 *uint16 + var err error + resolvePtr := func(i interface{}, keep **uint16) (uintptr, error) { + switch v := i.(type) { + case string: + *keep, err = UTF16PtrFromString(v) + if err != nil { + return 0, err + } + return uintptr(unsafe.Pointer(*keep)), nil + case ResourceID: + return uintptr(v), nil + } + return 0, errorspkg.New("parameter must be a ResourceID or a string") + } + namePtr, err = resolvePtr(name, &name16) + if err != nil { + return 0, err + } + resTypePtr, err = resolvePtr(resType, &resType16) + if err != nil { + return 0, err + } + resInfo, err := findResource(module, namePtr, resTypePtr) + runtime.KeepAlive(name16) + runtime.KeepAlive(resType16) + return resInfo, err +} + +func LoadResourceData(module, resInfo Handle) (data []byte, err error) { + size, err := SizeofResource(module, resInfo) + if err != nil { + return + } + resData, err := LoadResource(module, resInfo) + if err != nil { + return + } + ptr, err := LockResource(resData) + if err != nil { + return + } + h := (*unsafeheader.Slice)(unsafe.Pointer(&data)) + h.Data = unsafe.Pointer(ptr) + h.Len = int(size) + h.Cap = int(size) + return +} diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go index 809fff0b49..02db2ee5e6 100644 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ b/vendor/golang.org/x/sys/windows/types_windows.go @@ -10,6 +10,10 @@ import ( "unsafe" ) +// NTStatus corresponds with NTSTATUS, error values returned by ntdll.dll and +// other native functions. +type NTStatus uint32 + const ( // Invented values to support what package os expects. O_RDONLY = 0x00000 @@ -62,9 +66,21 @@ var signals = [...]string{ } const ( - FILE_LIST_DIRECTORY = 0x00000001 - FILE_APPEND_DATA = 0x00000004 + FILE_READ_DATA = 0x00000001 + FILE_READ_ATTRIBUTES = 0x00000080 + FILE_READ_EA = 0x00000008 + FILE_WRITE_DATA = 0x00000002 FILE_WRITE_ATTRIBUTES = 0x00000100 + FILE_WRITE_EA = 0x00000010 + FILE_APPEND_DATA = 0x00000004 + FILE_EXECUTE = 0x00000020 + + FILE_GENERIC_READ = STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE + FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE + FILE_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE + + FILE_LIST_DIRECTORY = 0x00000001 + FILE_TRAVERSE = 0x00000020 FILE_SHARE_READ = 0x00000001 FILE_SHARE_WRITE = 0x00000002 @@ -215,6 +231,18 @@ const ( INHERIT_PARENT_AFFINITY = 0x00010000 ) +const ( + // attributes for ProcThreadAttributeList + PROC_THREAD_ATTRIBUTE_PARENT_PROCESS = 0x00020000 + PROC_THREAD_ATTRIBUTE_HANDLE_LIST = 0x00020002 + PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY = 0x00030003 + PROC_THREAD_ATTRIBUTE_PREFERRED_NODE = 0x00020004 + PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR = 0x00030005 + PROC_THREAD_ATTRIBUTE_MITIGATION_POLICY = 0x00020007 + PROC_THREAD_ATTRIBUTE_UMS_THREAD = 0x00030006 + PROC_THREAD_ATTRIBUTE_PROTECTION_LEVEL = 0x0002000b +) + const ( // flags for CreateToolhelp32Snapshot TH32CS_SNAPHEAPLIST = 0x01 @@ -227,7 +255,15 @@ const ( ) const ( - // filters for ReadDirectoryChangesW + // flags for EnumProcessModulesEx + LIST_MODULES_32BIT = 0x01 + LIST_MODULES_64BIT = 0x02 + LIST_MODULES_ALL = 0x03 + LIST_MODULES_DEFAULT = 0x00 +) + +const ( + // filters for ReadDirectoryChangesW and FindFirstChangeNotificationW FILE_NOTIFY_CHANGE_FILE_NAME = 0x001 FILE_NOTIFY_CHANGE_DIR_NAME = 0x002 FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x004 @@ -249,24 +285,27 @@ const ( const ( // wincrypt.h - PROV_RSA_FULL = 1 - PROV_RSA_SIG = 2 - PROV_DSS = 3 - PROV_FORTEZZA = 4 - PROV_MS_EXCHANGE = 5 - PROV_SSL = 6 - PROV_RSA_SCHANNEL = 12 - PROV_DSS_DH = 13 - PROV_EC_ECDSA_SIG = 14 - PROV_EC_ECNRA_SIG = 15 - PROV_EC_ECDSA_FULL = 16 - PROV_EC_ECNRA_FULL = 17 - PROV_DH_SCHANNEL = 18 - PROV_SPYRUS_LYNKS = 20 - PROV_RNG = 21 - PROV_INTEL_SEC = 22 - PROV_REPLACE_OWF = 23 - PROV_RSA_AES = 24 + /* certenrolld_begin -- PROV_RSA_*/ + PROV_RSA_FULL = 1 + PROV_RSA_SIG = 2 + PROV_DSS = 3 + PROV_FORTEZZA = 4 + PROV_MS_EXCHANGE = 5 + PROV_SSL = 6 + PROV_RSA_SCHANNEL = 12 + PROV_DSS_DH = 13 + PROV_EC_ECDSA_SIG = 14 + PROV_EC_ECNRA_SIG = 15 + PROV_EC_ECDSA_FULL = 16 + PROV_EC_ECNRA_FULL = 17 + PROV_DH_SCHANNEL = 18 + PROV_SPYRUS_LYNKS = 20 + PROV_RNG = 21 + PROV_INTEL_SEC = 22 + PROV_REPLACE_OWF = 23 + PROV_RSA_AES = 24 + + /* dwFlags definitions for CryptAcquireContext */ CRYPT_VERIFYCONTEXT = 0xF0000000 CRYPT_NEWKEYSET = 0x00000008 CRYPT_DELETEKEYSET = 0x00000010 @@ -274,6 +313,34 @@ const ( CRYPT_SILENT = 0x00000040 CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080 + /* Flags for PFXImportCertStore */ + CRYPT_EXPORTABLE = 0x00000001 + CRYPT_USER_PROTECTED = 0x00000002 + CRYPT_USER_KEYSET = 0x00001000 + PKCS12_PREFER_CNG_KSP = 0x00000100 + PKCS12_ALWAYS_CNG_KSP = 0x00000200 + PKCS12_ALLOW_OVERWRITE_KEY = 0x00004000 + PKCS12_NO_PERSIST_KEY = 0x00008000 + PKCS12_INCLUDE_EXTENDED_PROPERTIES = 0x00000010 + + /* Flags for CryptAcquireCertificatePrivateKey */ + CRYPT_ACQUIRE_CACHE_FLAG = 0x00000001 + CRYPT_ACQUIRE_USE_PROV_INFO_FLAG = 0x00000002 + CRYPT_ACQUIRE_COMPARE_KEY_FLAG = 0x00000004 + CRYPT_ACQUIRE_NO_HEALING = 0x00000008 + CRYPT_ACQUIRE_SILENT_FLAG = 0x00000040 + CRYPT_ACQUIRE_WINDOW_HANDLE_FLAG = 0x00000080 + CRYPT_ACQUIRE_NCRYPT_KEY_FLAGS_MASK = 0x00070000 + CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG = 0x00010000 + CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG = 0x00020000 + CRYPT_ACQUIRE_ONLY_NCRYPT_KEY_FLAG = 0x00040000 + + /* pdwKeySpec for CryptAcquireCertificatePrivateKey */ + AT_KEYEXCHANGE = 1 + AT_SIGNATURE = 2 + CERT_NCRYPT_KEY_SPEC = 0xFFFFFFFF + + /* Default usage match type is AND with value zero */ USAGE_MATCH_TYPE_AND = 0 USAGE_MATCH_TYPE_OR = 1 @@ -398,6 +465,89 @@ const ( CERT_TRUST_IS_CA_TRUSTED = 0x00004000 CERT_TRUST_IS_COMPLEX_CHAIN = 0x00010000 + /* Certificate Information Flags */ + CERT_INFO_VERSION_FLAG = 1 + CERT_INFO_SERIAL_NUMBER_FLAG = 2 + CERT_INFO_SIGNATURE_ALGORITHM_FLAG = 3 + CERT_INFO_ISSUER_FLAG = 4 + CERT_INFO_NOT_BEFORE_FLAG = 5 + CERT_INFO_NOT_AFTER_FLAG = 6 + CERT_INFO_SUBJECT_FLAG = 7 + CERT_INFO_SUBJECT_PUBLIC_KEY_INFO_FLAG = 8 + CERT_INFO_ISSUER_UNIQUE_ID_FLAG = 9 + CERT_INFO_SUBJECT_UNIQUE_ID_FLAG = 10 + CERT_INFO_EXTENSION_FLAG = 11 + + /* dwFindType for CertFindCertificateInStore */ + CERT_COMPARE_MASK = 0xFFFF + CERT_COMPARE_SHIFT = 16 + CERT_COMPARE_ANY = 0 + CERT_COMPARE_SHA1_HASH = 1 + CERT_COMPARE_NAME = 2 + CERT_COMPARE_ATTR = 3 + CERT_COMPARE_MD5_HASH = 4 + CERT_COMPARE_PROPERTY = 5 + CERT_COMPARE_PUBLIC_KEY = 6 + CERT_COMPARE_HASH = CERT_COMPARE_SHA1_HASH + CERT_COMPARE_NAME_STR_A = 7 + CERT_COMPARE_NAME_STR_W = 8 + CERT_COMPARE_KEY_SPEC = 9 + CERT_COMPARE_ENHKEY_USAGE = 10 + CERT_COMPARE_CTL_USAGE = CERT_COMPARE_ENHKEY_USAGE + CERT_COMPARE_SUBJECT_CERT = 11 + CERT_COMPARE_ISSUER_OF = 12 + CERT_COMPARE_EXISTING = 13 + CERT_COMPARE_SIGNATURE_HASH = 14 + CERT_COMPARE_KEY_IDENTIFIER = 15 + CERT_COMPARE_CERT_ID = 16 + CERT_COMPARE_CROSS_CERT_DIST_POINTS = 17 + CERT_COMPARE_PUBKEY_MD5_HASH = 18 + CERT_COMPARE_SUBJECT_INFO_ACCESS = 19 + CERT_COMPARE_HASH_STR = 20 + CERT_COMPARE_HAS_PRIVATE_KEY = 21 + CERT_FIND_ANY = (CERT_COMPARE_ANY << CERT_COMPARE_SHIFT) + CERT_FIND_SHA1_HASH = (CERT_COMPARE_SHA1_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_MD5_HASH = (CERT_COMPARE_MD5_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_SIGNATURE_HASH = (CERT_COMPARE_SIGNATURE_HASH << CERT_COMPARE_SHIFT) + CERT_FIND_KEY_IDENTIFIER = (CERT_COMPARE_KEY_IDENTIFIER << CERT_COMPARE_SHIFT) + CERT_FIND_HASH = CERT_FIND_SHA1_HASH + CERT_FIND_PROPERTY = (CERT_COMPARE_PROPERTY << CERT_COMPARE_SHIFT) + CERT_FIND_PUBLIC_KEY = (CERT_COMPARE_PUBLIC_KEY << CERT_COMPARE_SHIFT) + CERT_FIND_SUBJECT_NAME = (CERT_COMPARE_NAME< 0 { - _p0 = &buf[0] - } - r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) } return } -func ExitProcess(exitcode uint32) { - syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) +func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) + } return } -func IsWow64Process(handle Handle, isWow64 *bool) (err error) { - var _p0 uint32 - if *isWow64 { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0) - *isWow64 = _p0 != 0 - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) } return } @@ -779,655 +1531,426 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) handle = Handle(r0) if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { - var _p0 *byte - if len(buf) > 0 { - _p0 = &buf[0] - } - r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) + if r1&0xff == 0 { + err = errnoErr(e1) } return } -func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { - var _p0 *byte - if len(buf) > 0 { - _p0 = &buf[0] - } - r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) } return } -func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) { - var _p0 uint32 - if wait { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) } return } -func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { - r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) - newlowoffset = uint32(r0) - if newlowoffset == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) } return } -func CloseHandle(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) { + var _p0 uint32 + if initialOwner { + _p0 = 1 + } + r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 || e1 == ERROR_ALREADY_EXISTS { + err = errnoErr(e1) } return } -func GetStdHandle(stdhandle uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) +func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0) handle = Handle(r0) if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SetStdHandle(stdhandle uint32, handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0) +func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { + var _p0 uint32 + if inheritHandles { + _p0 = 1 } - return -} - -func findNextFile1(handle Handle, data *win32finddata1) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func FindClose(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { + r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) + if r1&0xff == 0 { + err = errnoErr(e1) } return } -func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { - r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) } return } -func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0) +func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func DeleteFile(path *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func SetCurrentDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) { + syscall.Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0) return } -func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { - r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) +func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func RemoveDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) +func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func DeleteFile(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) +func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) { + var _p0 uint32 + if bInheritHandle { + _p0 = 1 + } + r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func MoveFile(from *uint16, to *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func ExitProcess(exitcode uint32) { + syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) return } -func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) +func FindClose(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) +func FindCloseChangeNotification(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procFindCloseChangeNotification.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(path) + if err != nil { + return } - return + return _FindFirstChangeNotification(_p0, watchSubtree, notifyFilter) } -func GetComputerName(buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) { + var _p1 uint32 + if watchSubtree { + _p1 = 1 + } + r0, _, e1 := syscall.Syscall(procFindFirstChangeNotificationW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) } return } -func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) } return } -func SetEndOfFile(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) } return } -func GetSystemTimeAsFileTime(time *Filetime) { - syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) +func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) + } return } -func GetSystemTimePreciseAsFileTime(time *Filetime) { - syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) +func FindNextChangeNotification(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procFindNextChangeNotification.Addr(), 1, uintptr(handle), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } return } -func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) - rc = uint32(r0) - if rc == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func findNextFile1(handle Handle, data *win32finddata1) (err error) { + r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) { + r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + if r1 == 0 { + err = errnoErr(e1) } return } -func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) +func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) { + r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) { + r0, _, e1 := syscall.Syscall(procFindResourceW.Addr(), 3, uintptr(module), uintptr(name), uintptr(resType)) + resInfo = Handle(r0) + if resInfo == 0 { + err = errnoErr(e1) } return } -func CancelIo(s Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) +func FindVolumeClose(findVolume Handle) (err error) { + r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func CancelIoEx(s Handle, o *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) +func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { + r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { - var _p0 uint32 - if inheritHandles { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) +func FlushFileBuffers(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) { - var _p0 uint32 - if inheritHandle { - _p0 = 1 - } else { - _p0 = 0 - } - r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func FlushViewOfFile(addr uintptr, length uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { - r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) - if r1 <= 32 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) { + var _p0 *uint16 + if len(buf) > 0 { + _p0 = &buf[0] + } + r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) } return } -func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) { - r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0) - if r0 != 0 { - ret = syscall.Errno(r0) +func FreeEnvironmentStrings(envs *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func TerminateProcess(handle Handle, exitcode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) +func FreeLibrary(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) +func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetStartupInfo(startupInfo *StartupInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func GetACP() (acp uint32) { + r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) + acp = uint32(r0) return } -func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) +func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { + r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) { - var _p0 uint32 - if bInheritHandle { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func GetCommandLine() (cmd *uint16) { + r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) + cmd = (*uint16)(unsafe.Pointer(r0)) return } -func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { - r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) - event = uint32(r0) - if event == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) + if r1 == 0 { + err = errnoErr(e1) } return } -func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { - var _p0 uint32 - if waitAll { - _p0 = 1 - } else { - _p0 = 0 - } - r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0) - event = uint32(r0) - if event == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetComputerName(buf *uint16, n *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetConsoleMode(console Handle, mode *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) +func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { + r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetFileType(filehandle Handle) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) +func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func GetCurrentProcessId() (pid uint32) { + r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) + pid = uint32(r0) return } -func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func GetCurrentThreadId() (id uint32) { + r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0) + id = uint32(r0) return } -func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { - r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) +func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) { + r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } +func GetDriveType(rootPathName *uint16) (driveType uint32) { + r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) + driveType = uint32(r0) + return +} + func GetEnvironmentStrings() (envs *uint16, err error) { r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0) envs = (*uint16)(unsafe.Pointer(r0)) if envs == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FreeEnvironmentStrings(envs *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } @@ -1436,71 +1959,23 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) n = uint32(r0) if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { - var _p0 uint32 - if inheritExisting { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func DestroyEnvironmentBlock(block *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) +func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func getTickCount64() (ms uint64) { - r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) - ms = uint64(r0) - return -} - -func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) +func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { + r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } @@ -1509,104 +1984,76 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) attrs = uint32(r0) if attrs == INVALID_FILE_ATTRIBUTES { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SetFileAttributes(name *uint16, attrs uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) +func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { + r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { - r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) +func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetCommandLine() (cmd *uint16) { - r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) - cmd = (*uint16)(unsafe.Pointer(r0)) +func GetFileType(filehandle Handle) (n uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) + } return } -func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { - r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) - argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) - if argv == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) { + r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) } return } -func LocalFree(hmem Handle) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) - handle = Handle(r0) - if handle != 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { + r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) } return } -func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetLastError() (lasterr error) { + r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0) + if r0 != 0 { + lasterr = syscall.Errno(r0) } return } -func FlushFileBuffers(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) } return } -func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetLogicalDrives() (drivesBitMask uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0) + drivesBitMask = uint32(r0) + if drivesBitMask == 0 { + err = errnoErr(e1) } return } @@ -1615,2456 +2062,1688 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) n = uint32(r0) if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) +func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) n = uint32(r0) if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) { + r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) + if r1 == 0 { + err = errnoErr(e1) } return } -func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { - r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) - addr = uintptr(r0) - if addr == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { + r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func UnmapViewOfFile(addr uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) +func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func FlushViewOfFile(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) +func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) { + var _p0 uint32 + if wait { + _p0 = 1 + } + r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func VirtualLock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetPriorityClass(process Handle) (ret uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0) + ret = uint32(r0) + if ret == 0 { + err = errnoErr(e1) } return } -func VirtualUnlock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(procname) + if err != nil { + return } - return + return _GetProcAddress(module, _p0) } -func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) { - r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0) - value = uintptr(r0) - if value == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { + r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0) + proc = uintptr(r0) + if proc == 0 { + err = errnoErr(e1) } return } -func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetProcessId(process Handle) (id uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0) + id = uint32(r0) + if id == 0 { + err = errnoErr(e1) } return } -func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0) +func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) +func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { - var _p0 uint32 - if watchSubTree { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) +func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { + r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { - r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) - store = Handle(r0) - if store == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) { + syscall.Syscall6(procGetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags)), 0, 0) return } -func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { - r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) - context = (*CertContext)(unsafe.Pointer(r0)) - if context == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) } return } -func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { - r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) +func GetStartupInfo(startupInfo *StartupInfo) (err error) { + r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func CertCloseStore(store Handle, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetStdHandle(stdhandle uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) } return } -func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { - r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + len = uint32(r0) + if len == 0 { + err = errnoErr(e1) } return } -func CertFreeCertificateChain(ctx *CertChainContext) { - syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) +func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } return } -func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { - r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) - context = (*CertContext)(unsafe.Pointer(r0)) - if context == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func GetSystemTimeAsFileTime(time *Filetime) { + syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) return } -func CertFreeCertificateContext(ctx *CertContext) (err error) { - r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func GetSystemTimePreciseAsFileTime(time *Filetime) { + syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) return } -func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { - r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + len = uint32(r0) + if len == 0 { + err = errnoErr(e1) } return } -func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) +func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) } return } -func RegCloseKey(key Handle) (regerrno error) { - r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) +func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } +func getTickCount64() (ms uint64) { + r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) + ms = uint64(r0) return } -func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) +func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) + rc = uint32(r0) + if rc == 0xffffffff { + err = errnoErr(e1) } return } -func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) - if r0 != 0 { - regerrno = syscall.Errno(r0) +func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func GetCurrentProcessId() (pid uint32) { - r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) - pid = uint32(r0) +func GetVersion() (ver uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0) + ver = uint32(r0) + if ver == 0 { + err = errnoErr(e1) + } return } -func GetConsoleMode(console Handle, mode *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) +func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { + r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SetConsoleMode(console Handle, mode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0) +func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { + r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) +func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { - r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) +func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { - r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) +func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) + len = uint32(r0) + if len == 0 { + err = errnoErr(e1) } return } -func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) +func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) +func IsWow64Process(handle Handle, isWow64 *bool) (err error) { + var _p0 uint32 + if *isWow64 { + _p0 = 1 + } + r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0) + *isWow64 = _p0 != 0 if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) +func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint16) (err error) { + err = procIsWow64Process2.Find() + if err != nil { + return + } + r1, _, e1 := syscall.Syscall(procIsWow64Process2.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine))) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(libname) + if err != nil { + return } - return + return _LoadLibraryEx(_p0, zero, flags) } -func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) } return } -func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) - if r1&0xff == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func LoadLibrary(libname string) (handle Handle, err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(libname) + if err != nil { + return + } + return _LoadLibrary(_p0) +} + +func _LoadLibrary(libname *uint16) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0) + handle = Handle(r0) + if handle == 0 { + err = errnoErr(e1) } return } -func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) - if r1&0xff == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { + r0, _, e1 := syscall.Syscall(procLoadResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) + resData = Handle(r0) + if resData == 0 { + err = errnoErr(e1) } return } -func GetCurrentThreadId() (id uint32) { - r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0) - id = uint32(r0) +func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { + r0, _, e1 := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(flags), uintptr(length), 0) + ptr = uintptr(r0) + if ptr == 0 { + err = errnoErr(e1) + } return } -func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) +func LocalFree(hmem Handle) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + if handle != 0 { + err = errnoErr(e1) } return } -func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) + if r1 == 0 { + err = errnoErr(e1) } return } -func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) { - var _p0 uint32 - if inheritHandle { - _p0 = 1 - } else { - _p0 = 0 +func LockResource(resData Handle) (addr uintptr, err error) { + r0, _, e1 := syscall.Syscall(procLockResource.Addr(), 1, uintptr(resData), 0, 0) + addr = uintptr(r0) + if addr == 0 { + err = errnoErr(e1) } - r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + return +} + +func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { + r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) + addr = uintptr(r0) + if addr == 0 { + err = errnoErr(e1) } return } -func SetEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0) +func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { + r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func ResetEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) +func MoveFile(from *uint16, to *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func PulseEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) { + r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) + nwrite = int32(r0) + if nwrite == 0 { + err = errnoErr(e1) } return } -func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16) (handle Handle, err error) { +func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) { var _p0 uint32 - if initialOwner { + if inheritHandle { _p0 = 1 - } else { - _p0 = 0 } - r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) +func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) { + var _p0 uint32 + if inheritHandle { + _p0 = 1 + } + r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) { +func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error) { var _p0 uint32 if inheritHandle { _p0 = 1 - } else { - _p0 = 0 } - r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) handle = Handle(r0) if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ReleaseMutex(mutex Handle) (err error) { - r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { +func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) { var _p0 uint32 - if alertable { + if inheritHandle { _p0 = 1 - } else { - _p0 = 0 } - r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0) - ret = uint32(r0) - return -} - -func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) + r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) handle = Handle(r0) if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func AssignProcessToJobObject(job Handle, process Handle) (err error) { - r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) +func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func TerminateJobObject(job Handle, exitCode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0) +func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { + r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SetErrorMode(mode uint32) (ret uint32) { - r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0) - ret = uint32(r0) +func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { + r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) + if r1 == 0 { + err = errnoErr(e1) + } return } -func ResumeThread(thread Handle) (ret uint32, err error) { - r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) - ret = uint32(r0) - if ret == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func SetPriorityClass(process Handle, priorityClass uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) +func PulseEvent(event Handle) (err error) { + r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetPriorityClass(process Handle) (ret uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0) - ret = uint32(r0) - if ret == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { + r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) + n = uint32(r0) + if n == 0 { + err = errnoErr(e1) } return } -func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { - r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) - ret = int(r0) - if ret == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procQueryFullProcessImageNameW.Addr(), 4, uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0) +func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetProcessId(process Handle) (id uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0) - id = uint32(r0) - if id == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { + r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (handle Handle, err error) { +func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { var _p0 uint32 - if inheritHandle { + if watchSubTree { _p0 = 1 - } else { - _p0 = 0 } - r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func SetProcessPriorityBoost(process Handle, disable bool) (err error) { - var _p0 uint32 - if disable { - _p0 = 1 - } else { - _p0 = 0 +func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0) + r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) { - syscall.Syscall6(procGetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags)), 0, 0) - return -} - -func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0) +func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) +func ReleaseMutex(mutex Handle) (err error) { + r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0) +func RemoveDirectory(path *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func ResetEvent(event Handle) (err error) { + r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func ResumeThread(thread Handle) (ret uint32, err error) { + r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) + ret = uint32(r0) + if ret == 0xffffffff { + err = errnoErr(e1) } return } -func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) +func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { + r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) +func setConsoleCursorPosition(console Handle, position uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func FindVolumeClose(findVolume Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0) +func SetConsoleMode(console Handle, mode uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0) +func SetCurrentDirectory(path *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) { - r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0) +func SetDefaultDllDirectories(directoryFlags uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetDefaultDllDirectories.Addr(), 1, uintptr(directoryFlags), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetDriveType(rootPathName *uint16) (driveType uint32) { - r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) - driveType = uint32(r0) - return -} - -func GetLogicalDrives() (drivesBitMask uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0) - drivesBitMask = uint32(r0) - if drivesBitMask == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func SetDllDirectory(path string) (err error) { + var _p0 *uint16 + _p0, err = syscall.UTF16PtrFromString(path) + if err != nil { + return } - return + return _SetDllDirectory(_p0) } -func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) +func _SetDllDirectory(path *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procSetDllDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) +func SetEndOfFile(handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) +func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func SetErrorMode(mode uint32) (ret uint32) { + r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0) + ret = uint32(r0) return } -func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0) +func SetEvent(event Handle) (err error) { + r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func SetFileAttributes(name *uint16, attrs uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0) +func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { + r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0) +func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { - r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) - ret = int32(r0) - if ret == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { + r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) + newlowoffset = uint32(r0) + if newlowoffset == 0xffffffff { + err = errnoErr(e1) } return } -func ExitWindowsEx(flags uint32, reason uint32) (err error) { - r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0) +func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { + r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) { - var _p0 uint32 - if forceAppsClosed { - _p0 = 1 - } else { - _p0 = 0 - } - var _p1 uint32 - if rebootAfterShutdown { - _p1 = 1 - } else { - _p1 = 0 - } - r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) +func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { + r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) + ret = int(r0) + if ret == 0 { + err = errnoErr(e1) } return } -func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0) +func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetNamedPipeHandleState.Addr(), 4, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { - r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0) - if r0 != 0 { - ret = syscall.Errno(r0) +func SetPriorityClass(process Handle, priorityClass uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { - r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) - chars = int32(r0) - return -} - -func coCreateGuid(pguid *GUID) (ret error) { - r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0) - if r0 != 0 { - ret = syscall.Errno(r0) +func SetProcessPriorityBoost(process Handle, disable bool) (err error) { + var _p0 uint32 + if disable { + _p0 = 1 } - return -} - -func CoTaskMemFree(address unsafe.Pointer) { - syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) - return -} - -func rtlGetVersion(info *OsVersionInfoEx) (ret error) { - r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0) - if r0 != 0 { - ret = syscall.Errno(r0) + r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) { - syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) - return -} - -func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) +func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { + r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) +func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) +func SetStdHandle(stdhandle uint32, handle Handle) (err error) { + r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) +func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) { - var _p0 *uint32 - if len(processIds) > 0 { - _p0 = &processIds[0] - } - r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned))) +func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { - r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) - if r0 != 0 { - sockerr = syscall.Errno(r0) +func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) { + r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) + size = uint32(r0) + if size == 0 { + err = errnoErr(e1) } return } -func WSACleanup() (err error) { - r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { + var _p0 uint32 + if alertable { + _p0 = 1 } + r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0) + ret = uint32(r0) return } -func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { - r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func TerminateJobObject(job Handle, exitCode uint32) (err error) { + r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func TerminateProcess(handle Handle, exitcode uint32) (err error) { + r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) { - var _p0 *byte - if len(buf) > 0 { - _p0 = &buf[0] - } - r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { + r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) { - var _p0 *byte - if len(buf) > 0 { - _p0 = &buf[0] - } - r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) - n = int32(r0) - if n == -1 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { + r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { - r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { - r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func UnmapViewOfFile(addr uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) { + r1, _, e1 := syscall.Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) { + r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0) + value = uintptr(r0) + if value == 0 { + err = errnoErr(e1) } return } -func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { + r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype)) + if r1 == 0 { + err = errnoErr(e1) } return } -func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func VirtualLock(addr uintptr, length uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func listen(s Handle, backlog int32) (err error) { - r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func shutdown(s Handle, how int32) (err error) { - r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procVirtualProtectEx.Addr(), 5, uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func Closesocket(s Handle) (err error) { - r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + if r1 == 0 { + err = errnoErr(e1) } return } -func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) +func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { - syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) +func VirtualUnlock(addr uintptr, length uintptr) (err error) { + r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) + if r1 == 0 { + err = errnoErr(e1) + } return } -func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func WTSGetActiveConsoleSessionId() (sessionID uint32) { + r0, _, _ := syscall.Syscall(procWTSGetActiveConsoleSessionId.Addr(), 0, 0, 0, 0) + sessionID = uint32(r0) return } -func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) { + var _p0 uint32 + if waitAll { + _p0 = 1 + } + r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0) + event = uint32(r0) + if event == 0xffffffff { + err = errnoErr(e1) } return } -func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { + r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) + event = uint32(r0) + if event == 0xffffffff { + err = errnoErr(e1) } return } -func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { + r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func GetHostByName(name string) (h *Hostent, err error) { +func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { var _p0 *byte - _p0, err = syscall.BytePtrFromString(name) - if err != nil { - return + if len(buf) > 0 { + _p0 = &buf[0] } - return _GetHostByName(_p0) -} - -func _GetHostByName(name *byte) (h *Hostent, err error) { - r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) - h = (*Hostent)(unsafe.Pointer(r0)) - if h == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func GetServByName(name string, proto string) (s *Servent, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(name) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(proto) - if err != nil { - return +func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) { + r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten)), 0) + if r1 == 0 { + err = errnoErr(e1) } - return _GetServByName(_p0, _p1) + return } -func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { - r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) - s = (*Servent)(unsafe.Pointer(r0)) - if s == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { + r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func Ntohs(netshort uint16) (u uint16) { - r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) - u = uint16(r0) +func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { + syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) return } -func GetProtoByName(name string) (p *Protoent, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(name) - if err != nil { - return - } - return _GetProtoByName(_p0) -} - -func _GetProtoByName(name *byte) (p *Protoent, err error) { - r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) - p = (*Protoent)(unsafe.Pointer(r0)) - if p == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { + r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { - var _p0 *uint16 - _p0, status = syscall.UTF16PtrFromString(name) - if status != nil { - return - } - return _DnsQuery(_p0, qtype, options, extra, qrs, pr) -} - -func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { - r0, _, _ := syscall.Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) +func NetApiBufferFree(buf *byte) (neterr error) { + r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0) if r0 != 0 { - status = syscall.Errno(r0) + neterr = syscall.Errno(r0) } return } -func DnsRecordListFree(rl *DNSRecord, freetype uint32) { - syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) +func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { + r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) + if r0 != 0 { + neterr = syscall.Errno(r0) + } return } -func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { - r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0) - same = r0 != 0 +func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { + r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) + if r0 != 0 { + neterr = syscall.Errno(r0) + } return } -func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { - r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0) +func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) { + r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0) if r0 != 0 { - sockerr = syscall.Errno(r0) + ntstatus = NTStatus(r0) } return } -func FreeAddrInfoW(addrinfo *AddrinfoW) { - syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) +func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) { + r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0) + if r0 != 0 { + ntstatus = NTStatus(r0) + } return } -func GetIfEntry(pIfRow *MibIfRow) (errcode error) { - r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) +func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) { + r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0) if r0 != 0 { - errcode = syscall.Errno(r0) + ntstatus = NTStatus(r0) } return } -func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { - r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) +func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) { + r0, _, _ := syscall.Syscall6(procNtSetInformationProcess.Addr(), 4, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), 0, 0) if r0 != 0 { - errcode = syscall.Errno(r0) + ntstatus = NTStatus(r0) } return } -func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { + r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(acl)), 0, 0) + if r0 != 0 { + ntstatus = NTStatus(r0) } return } -func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { - r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) - n = int32(r0) - if n == -1 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { + r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) + if r0 != 0 { + ntstatus = NTStatus(r0) } return } -func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { - r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0) +func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { + r0, _, _ := syscall.Syscall6(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) if r0 != 0 { - errcode = syscall.Errno(r0) + ntstatus = NTStatus(r0) } return } -func GetACP() (acp uint32) { - r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) - acp = uint32(r0) +func RtlGetCurrentPeb() (peb *PEB) { + r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0) + peb = (*PEB)(unsafe.Pointer(r0)) return } -func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) { - r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) - nwrite = int32(r0) - if nwrite == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) { + syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) return } -func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) - if r1&0xff == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { + r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0) + if r0 != 0 { + ntstatus = NTStatus(r0) } return } -func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) - if r1&0xff == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func RtlInitString(destinationString *NTString, sourceString *byte) { + syscall.Syscall(procRtlInitString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) return } -func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { - r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) - if r0 != 0 { - neterr = syscall.Errno(r0) - } +func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) { + syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) return } -func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { - r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) - if r0 != 0 { - neterr = syscall.Errno(r0) - } +func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) { + r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0) + ret = syscall.Errno(r0) return } -func NetApiBufferFree(buf *byte) (neterr error) { - r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0) +func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { + r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0) if r0 != 0 { - neterr = syscall.Errno(r0) + ret = syscall.Errno(r0) } return } -func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func coCreateGuid(pguid *GUID) (ret error) { + r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0) + if r0 != 0 { + ret = syscall.Errno(r0) } return } -func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) { + r0, _, _ := syscall.Syscall6(procCoGetObject.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable)), 0, 0) + if r0 != 0 { + ret = syscall.Errno(r0) } return } -func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { - r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { + r0, _, _ := syscall.Syscall(procCoInitializeEx.Addr(), 2, uintptr(reserved), uintptr(coInit), 0) + if r0 != 0 { + ret = syscall.Errno(r0) } return } -func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { - r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func CoTaskMemFree(address unsafe.Pointer) { + syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) return } -func GetLengthSid(sid *SID) (len uint32) { - r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - len = uint32(r0) +func CoUninitialize() { + syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0) return } -func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { - r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { + r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) + chars = int32(r0) return } -func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) { - r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0) +func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procEnumProcessModules.Addr(), 4, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0) +func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procEnumProcessModulesEx.Addr(), 5, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { - r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0) - isWellKnown = r0 != 0 +func EnumProcesses(processIds []uint32, bytesReturned *uint32) (err error) { + var _p0 *uint32 + if len(processIds) > 0 { + _p0 = &processIds[0] + } + r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(_p0)), uintptr(len(processIds)), uintptr(unsafe.Pointer(bytesReturned))) + if r1 == 0 { + err = errnoErr(e1) + } return } -func FreeSid(sid *SID) (err error) { - r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - if r1 != 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleBaseNameW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size), 0, 0) + if r1 == 0 { + err = errnoErr(e1) } return } -func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { - r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0) - isEqual = r0 != 0 +func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleFileNameExW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } return } -func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) { - r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0)) +func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procGetModuleInformation.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb), 0, 0) + if r1 == 0 { + err = errnoErr(e1) + } return } -func getSidSubAuthorityCount(sid *SID) (count *uint8) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - count = (*uint8)(unsafe.Pointer(r0)) +func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) { + ret = procSubscribeServiceChangeNotifications.Find() + if ret != nil { + return + } + r0, _, _ := syscall.Syscall6(procSubscribeServiceChangeNotifications.Addr(), 5, uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription)), 0) + if r0 != 0 { + ret = syscall.Errno(r0) + } return } -func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) { - r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0) - subAuthority = (*uint32)(unsafe.Pointer(r0)) +func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) { + err = procUnsubscribeServiceChangeNotifications.Find() + if err != nil { + return + } + syscall.Syscall(procUnsubscribeServiceChangeNotifications.Addr(), 1, uintptr(subscription), 0, 0) return } -func isValidSid(sid *SID) (isValid bool) { - r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - isValid = r0 != 0 +func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) + if r1&0xff == 0 { + err = errnoErr(e1) + } return } -func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { - r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) + if r1&0xff == 0 { + err = errnoErr(e1) } return } -func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { + r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) + argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) + if argv == nil { + err = errnoErr(e1) } return } -func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token) (err error) { - var _p0 uint32 - if openAsSelf { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) { + r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0) + if r0 != 0 { + ret = syscall.Errno(r0) } return } -func ImpersonateSelf(impersonationlevel uint32) (err error) { - r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { + r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) + if r1 <= 32 { + err = errnoErr(e1) } return } -func RevertToSelf() (err error) { - r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) +func ExitWindowsEx(flags uint32, reason uint32) (err error) { + r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SetThreadToken(thread *Handle, token Token) (err error) { - r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func GetShellWindow() (shellWindow HWND) { + r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) + shellWindow = HWND(r0) return } -func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { - r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) { + r0, _, e1 := syscall.Syscall(procGetWindowThreadProcessId.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(pid)), 0) + tid = uint32(r0) + if tid == 0 { + err = errnoErr(e1) } return } -func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tokenprivileges, buflen uint32, prevstate *Tokenprivileges, returnlen *uint32) (err error) { - var _p0 uint32 - if disableAllPrivileges { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { + r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) + ret = int32(r0) + if ret == 0 { + err = errnoErr(e1) } return } -func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, buflen uint32, prevstate *Tokengroups, returnlen *uint32) (err error) { +func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) (err error) { var _p0 uint32 - if resetToDefault { + if inheritExisting { _p0 = 1 - } else { - _p0 = 0 } - r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) +func DestroyEnvironmentBlock(block *uint16) (err error) { + r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0) +func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { + r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { - r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) { + r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) + if r0 != 0 { + ret = syscall.Errno(r0) } return } -func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func FreeAddrInfoW(addrinfo *AddrinfoW) { + syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) return } -func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) - len = uint32(r0) - if len == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { + r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0) + if r0 != 0 { + sockerr = syscall.Errno(r0) } return } -func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) - len = uint32(r0) - if len == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func WSACleanup() (err error) { + r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) + if r1 == socket_error { + err = errnoErr(e1) } return } -func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) - len = uint32(r0) - if len == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { + r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) + n = int32(r0) + if n == -1 { + err = errnoErr(e1) } return } -func WTSQueryUserToken(session uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, flags *uint32) (err error) { + var _p0 uint32 + if wait { + _p0 = 1 } - return -} - -func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) + r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func WTSFreeMemory(ptr uintptr) { - syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) +func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { + r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + if r1 == socket_error { + err = errnoErr(e1) + } return } -func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0) - if r0 != 0 { - ret = syscall.Errno(r0) +func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { + r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + if r1 == socket_error { + err = errnoErr(e1) } return } -func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) { - syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) +func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { + r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if r1 == socket_error { + err = errnoErr(e1) + } return } -func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - var _p0 *uint16 - _p0, ret = syscall.UTF16PtrFromString(objectName) - if ret != nil { - return +func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { + r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + if r1 == socket_error { + err = errnoErr(e1) } - return _getNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl, sd) + return } -func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procGetNamedSecurityInfoW.Addr(), 8, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0) - if r0 != 0 { - ret = syscall.Errno(r0) +func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { + r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if r1 == socket_error { + err = errnoErr(e1) } return } -func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { - var _p0 *uint16 - _p0, ret = syscall.UTF16PtrFromString(objectName) - if ret != nil { - return +func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) } - return _SetNamedSecurityInfo(_p0, objectType, securityInformation, owner, group, dacl, sacl) + return } -func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { - r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfoW.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) +func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { + r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) if r0 != 0 { - ret = syscall.Errno(r0) + sockerr = syscall.Errno(r0) } return } -func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.Syscall9(procBuildSecurityDescriptorW.Addr(), 9, uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor))) - if r0 != 0 { - ret = syscall.Errno(r0) +func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { + r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + if r1 == socket_error { + err = errnoErr(e1) } return } -func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) { - r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func Closesocket(s Handle) (err error) { + r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) + if r1 == socket_error { + err = errnoErr(e1) } return } -func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { + r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) + if r1 == socket_error { + err = errnoErr(e1) } return } -func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl **ACL, daclDefaulted *bool) (err error) { - var _p0 uint32 - if *daclPresent { - _p0 = 1 - } else { - _p0 = 0 - } - var _p1 uint32 - if *daclDefaulted { - _p1 = 1 - } else { - _p1 = 0 - } - r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) - *daclPresent = _p0 != 0 - *daclDefaulted = _p1 != 0 - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetHostByName(name string) (h *Hostent, err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(name) + if err != nil { + return } - return + return _GetHostByName(_p0) } -func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl **ACL, saclDefaulted *bool) (err error) { - var _p0 uint32 - if *saclPresent { - _p0 = 1 - } else { - _p0 = 0 - } - var _p1 uint32 - if *saclDefaulted { - _p1 = 1 - } else { - _p1 = 0 - } - r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) - *saclPresent = _p0 != 0 - *saclDefaulted = _p1 != 0 - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func _GetHostByName(name *byte) (h *Hostent, err error) { + r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + h = (*Hostent)(unsafe.Pointer(r0)) + if h == nil { + err = errnoErr(e1) } return } -func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefaulted *bool) (err error) { - var _p0 uint32 - if *ownerDefaulted { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) - *ownerDefaulted = _p0 != 0 - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { + r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if r1 == socket_error { + err = errnoErr(e1) } return } -func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefaulted *bool) (err error) { - var _p0 uint32 - if *groupDefaulted { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) - *groupDefaulted = _p0 != 0 - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func GetProtoByName(name string) (p *Protoent, err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(name) + if err != nil { + return } - return + return _GetProtoByName(_p0) } -func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) { - r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) - len = uint32(r0) +func _GetProtoByName(name *byte) (p *Protoent, err error) { + r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) + p = (*Protoent)(unsafe.Pointer(r0)) + if p == nil { + err = errnoErr(e1) + } return } -func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) { - r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) - if r0 != 0 { - ret = syscall.Errno(r0) +func GetServByName(name string, proto string) (s *Servent, err error) { + var _p0 *byte + _p0, err = syscall.BytePtrFromString(name) + if err != nil { + return } - return + var _p1 *byte + _p1, err = syscall.BytePtrFromString(proto) + if err != nil { + return + } + return _GetServByName(_p0, _p1) } -func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) { - r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) - isValid = r0 != 0 +func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { + r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) + s = (*Servent)(unsafe.Pointer(r0)) + if s == nil { + err = errnoErr(e1) + } return } -func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) { - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { + r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if r1 == socket_error { + err = errnoErr(e1) } return } -func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl *ACL, daclDefaulted bool) (err error) { - var _p0 uint32 - if daclPresent { - _p0 = 1 - } else { - _p0 = 0 - } - var _p1 uint32 - if daclDefaulted { - _p1 = 1 - } else { - _p1 = 0 - } - r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { + r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) + if r1 == socket_error { + err = errnoErr(e1) } return } -func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl *ACL, saclDefaulted bool) (err error) { - var _p0 uint32 - if saclPresent { - _p0 = 1 - } else { - _p0 = 0 - } - var _p1 uint32 - if saclDefaulted { - _p1 = 1 - } else { - _p1 = 0 - } - r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func listen(s Handle, backlog int32) (err error) { + r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) + if r1 == socket_error { + err = errnoErr(e1) } return } -func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaulted bool) (err error) { - var _p0 uint32 - if ownerDefaulted { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func Ntohs(netshort uint16) (u uint16) { + r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) + u = uint16(r0) return } -func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaulted bool) (err error) { - var _p0 uint32 - if groupDefaulted { - _p0 = 1 - } else { - _p0 = 0 +func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen *int32) (n int32, err error) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] } - r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + n = int32(r0) + if n == -1 { + err = errnoErr(e1) } return } -func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) { - syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) +func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) (err error) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) + if r1 == socket_error { + err = errnoErr(e1) + } return } -func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(str) - if err != nil { - return +func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { + r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) + if r1 == socket_error { + err = errnoErr(e1) } - return _convertStringSecurityDescriptorToSecurityDescriptor(_p0, revision, sd, size) + return } -func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func shutdown(s Handle, how int32) (err error) { + r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) + if r1 == socket_error { + err = errnoErr(e1) } return } -func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } +func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { + r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) + handle = Handle(r0) + if handle == InvalidHandle { + err = errnoErr(e1) } return } -func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0) +func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { + r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } + err = errnoErr(e1) } return } -func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } +func WTSFreeMemory(ptr uintptr) { + syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) return } -func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) { - r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0) - if r0 != 0 { - ret = syscall.Errno(r0) +func WTSQueryUserToken(session uint32, token *Token) (err error) { + r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) + if r1 == 0 { + err = errnoErr(e1) } return } diff --git a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go index f8363d8faa..cec819d641 100644 --- a/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go +++ b/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go @@ -50,11 +50,24 @@ func Find(importPath, srcDir string) (filename, path string) { // additional trailing data beyond the end of the export data. func NewReader(r io.Reader) (io.Reader, error) { buf := bufio.NewReader(r) - _, err := gcimporter.FindExportData(buf) - // If we ever switch to a zip-like archive format with the ToC - // at the end, we can return the correct portion of export data, - // but for now we must return the entire rest of the file. - return buf, err + _, size, err := gcimporter.FindExportData(buf) + if err != nil { + return nil, err + } + + if size >= 0 { + // We were given an archive and found the __.PKGDEF in it. + // This tells us the size of the export data, and we don't + // need to return the entire file. + return &io.LimitedReader{ + R: buf, + N: size, + }, nil + } else { + // We were given an object file. As such, we don't know how large + // the export data is and must return the entire file. + return buf, nil + } } // Read reads export data from in, decodes it, and returns type @@ -100,10 +113,34 @@ func Read(in io.Reader, fset *token.FileSet, imports map[string]*types.Package, // Write writes encoded type information for the specified package to out. // The FileSet provides file position information for named objects. func Write(out io.Writer, fset *token.FileSet, pkg *types.Package) error { - b, err := gcimporter.IExportData(fset, pkg) - if err != nil { + if _, err := io.WriteString(out, "i"); err != nil { return err } - _, err = out.Write(b) - return err + return gcimporter.IExportData(out, fset, pkg) +} + +// ReadBundle reads an export bundle from in, decodes it, and returns type +// information for the packages. +// File position information is added to fset. +// +// ReadBundle may inspect and add to the imports map to ensure that references +// within the export bundle to other packages are consistent. +// +// On return, the state of the reader is undefined. +// +// Experimental: This API is experimental and may change in the future. +func ReadBundle(in io.Reader, fset *token.FileSet, imports map[string]*types.Package) ([]*types.Package, error) { + data, err := ioutil.ReadAll(in) + if err != nil { + return nil, fmt.Errorf("reading export bundle: %v", err) + } + return gcimporter.IImportBundle(fset, imports, data) +} + +// WriteBundle writes encoded type information for the specified packages to out. +// The FileSet provides file position information for named objects. +// +// Experimental: This API is experimental and may change in the future. +func WriteBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error { + return gcimporter.IExportBundle(out, fset, pkgs) } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go index a807d0aaa2..0a3cdb9a3b 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go @@ -34,9 +34,6 @@ import ( // (suspected) format errors, and whenever a change is made to the format. const debugFormat = false // default: false -// If trace is set, debugging output is printed to std out. -const trace = false // default: false - // Current export format version. Increase with each format change. // Note: The latest binary (non-indexed) export format is at version 6. // This exporter is still at level 4, but it doesn't matter since @@ -92,16 +89,18 @@ func internalErrorf(format string, args ...interface{}) error { // BExportData returns binary export data for pkg. // If no file set is provided, position info will be missing. func BExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) { - defer func() { - if e := recover(); e != nil { - if ierr, ok := e.(internalError); ok { - err = ierr - return + if !debug { + defer func() { + if e := recover(); e != nil { + if ierr, ok := e.(internalError); ok { + err = ierr + return + } + // Not an internal error; panic again. + panic(e) } - // Not an internal error; panic again. - panic(e) - } - }() + }() + } p := exporter{ fset: fset, diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go index e9f73d14a1..b85de01470 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go @@ -74,9 +74,10 @@ func BImportData(fset *token.FileSet, imports map[string]*types.Package, data [] pathList: []string{""}, // empty string is mapped to 0 fake: fakeFileSet{ fset: fset, - files: make(map[string]*token.File), + files: make(map[string]*fileInfo), }, } + defer p.fake.setLines() // set lines for files in fset // read version info var versionstr string @@ -338,37 +339,49 @@ func (p *importer) pos() token.Pos { // Synthesize a token.Pos type fakeFileSet struct { fset *token.FileSet - files map[string]*token.File + files map[string]*fileInfo } +type fileInfo struct { + file *token.File + lastline int +} + +const maxlines = 64 * 1024 + func (s *fakeFileSet) pos(file string, line, column int) token.Pos { // TODO(mdempsky): Make use of column. - // Since we don't know the set of needed file positions, we - // reserve maxlines positions per file. - const maxlines = 64 * 1024 + // Since we don't know the set of needed file positions, we reserve maxlines + // positions per file. We delay calling token.File.SetLines until all + // positions have been calculated (by way of fakeFileSet.setLines), so that + // we can avoid setting unnecessary lines. See also golang/go#46586. f := s.files[file] if f == nil { - f = s.fset.AddFile(file, -1, maxlines) + f = &fileInfo{file: s.fset.AddFile(file, -1, maxlines)} s.files[file] = f - // Allocate the fake linebreak indices on first use. - // TODO(adonovan): opt: save ~512KB using a more complex scheme? - fakeLinesOnce.Do(func() { - fakeLines = make([]int, maxlines) - for i := range fakeLines { - fakeLines[i] = i - } - }) - f.SetLines(fakeLines) } - if line > maxlines { line = 1 } + if line > f.lastline { + f.lastline = line + } - // Treat the file as if it contained only newlines - // and column=1: use the line number as the offset. - return f.Pos(line - 1) + // Return a fake position assuming that f.file consists only of newlines. + return token.Pos(f.file.Base() + line - 1) +} + +func (s *fakeFileSet) setLines() { + fakeLinesOnce.Do(func() { + fakeLines = make([]int, maxlines) + for i := range fakeLines { + fakeLines[i] = i + } + }) + for _, f := range s.files { + f.file.SetLines(fakeLines[:f.lastline]) + } } var ( @@ -1029,6 +1042,7 @@ func predeclared() []types.Type { // used internally by gc; never used by this package or in .a files anyType{}, } + predecl = append(predecl, additionalPredeclared()...) }) return predecl } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go b/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go index f33dc5613e..f6437feb1c 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go @@ -16,7 +16,7 @@ import ( "strings" ) -func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { +func readGopackHeader(r *bufio.Reader) (name string, size int64, err error) { // See $GOROOT/include/ar.h. hdr := make([]byte, 16+12+6+6+8+10+2) _, err = io.ReadFull(r, hdr) @@ -28,7 +28,8 @@ func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { fmt.Printf("header: %s", hdr) } s := strings.TrimSpace(string(hdr[16+12+6+6+8:][:10])) - size, err = strconv.Atoi(s) + length, err := strconv.Atoi(s) + size = int64(length) if err != nil || hdr[len(hdr)-2] != '`' || hdr[len(hdr)-1] != '\n' { err = fmt.Errorf("invalid archive header") return @@ -42,8 +43,8 @@ func readGopackHeader(r *bufio.Reader) (name string, size int, err error) { // file by reading from it. The reader must be positioned at the // start of the file before calling this function. The hdr result // is the string before the export data, either "$$" or "$$B". -// -func FindExportData(r *bufio.Reader) (hdr string, err error) { +// The size result is the length of the export data in bytes, or -1 if not known. +func FindExportData(r *bufio.Reader) (hdr string, size int64, err error) { // Read first line to make sure this is an object file. line, err := r.ReadSlice('\n') if err != nil { @@ -54,7 +55,7 @@ func FindExportData(r *bufio.Reader) (hdr string, err error) { if string(line) == "!\n" { // Archive file. Scan to __.PKGDEF. var name string - if name, _, err = readGopackHeader(r); err != nil { + if name, size, err = readGopackHeader(r); err != nil { return } @@ -70,6 +71,7 @@ func FindExportData(r *bufio.Reader) (hdr string, err error) { err = fmt.Errorf("can't find export data (%v)", err) return } + size -= int64(len(line)) } // Now at __.PKGDEF in archive or still at beginning of file. @@ -86,8 +88,12 @@ func FindExportData(r *bufio.Reader) (hdr string, err error) { err = fmt.Errorf("can't find export data (%v)", err) return } + size -= int64(len(line)) } hdr = string(line) + if size < 0 { + size = -1 + } return } diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go index 9cf186605f..3ab66830d7 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go @@ -29,8 +29,14 @@ import ( "text/scanner" ) -// debugging/development support -const debug = false +const ( + // Enable debug during development: it adds some additional checks, and + // prevents errors from being recovered. + debug = false + + // If trace is set, debugging output is printed to std out. + trace = false +) var pkgExts = [...]string{".a", ".o"} @@ -179,7 +185,7 @@ func Import(packages map[string]*types.Package, path, srcDir string, lookup func var hdr string buf := bufio.NewReader(rc) - if hdr, err = FindExportData(buf); err != nil { + if hdr, _, err = FindExportData(buf); err != nil { return } @@ -344,7 +350,7 @@ func (p *parser) expectKeyword(keyword string) { // PackageId = string_lit . // -func (p *parser) parsePackageId() string { +func (p *parser) parsePackageID() string { id, err := strconv.Unquote(p.expect(scanner.String)) if err != nil { p.error(err) @@ -384,7 +390,7 @@ func (p *parser) parseDotIdent() string { // func (p *parser) parseQualifiedName() (id, name string) { p.expect('@') - id = p.parsePackageId() + id = p.parsePackageID() p.expect('.') // Per rev f280b8a485fd (10/2/2013), qualified names may be used for anonymous fields. if p.tok == '?' { @@ -491,7 +497,7 @@ func (p *parser) parseMapType(parent *types.Package) types.Type { // // For unqualified and anonymous names, the returned package is the parent // package unless parent == nil, in which case the returned package is the -// package being imported. (The parent package is not nil if the the name +// package being imported. (The parent package is not nil if the name // is an unqualified struct field or interface method name belonging to a // type declared in another package.) // @@ -696,7 +702,7 @@ func (p *parser) parseInterfaceType(parent *types.Package) types.Type { // Complete requires the type's embedded interfaces to be fully defined, // but we do not define any - return types.NewInterface(methods, nil).Complete() + return newInterface(methods, nil).Complete() } // ChanType = ( "chan" [ "<-" ] | "<-" "chan" ) Type . @@ -785,7 +791,7 @@ func (p *parser) parseType(parent *types.Package) types.Type { func (p *parser) parseImportDecl() { p.expectKeyword("import") name := p.parsePackageName() - p.getPkg(p.parsePackageId(), name) + p.getPkg(p.parsePackageID(), name) } // int_lit = [ "+" | "-" ] { "0" ... "9" } . diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go index 4be32a2e55..b4d51f352f 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go @@ -11,6 +11,7 @@ package gcimporter import ( "bytes" "encoding/binary" + "fmt" "go/ast" "go/constant" "go/token" @@ -19,37 +20,54 @@ import ( "math/big" "reflect" "sort" + "strings" + + "golang.org/x/tools/internal/typeparams" ) -// Current indexed export format version. Increase with each format change. -// 0: Go1.11 encoding -const iexportVersion = 0 +// Current bundled export format version. Increase with each format change. +// 0: initial implementation +const bundleVersion = 0 -// IExportData returns the binary export data for pkg. +// IExportData writes indexed export data for pkg to out. // // If no file set is provided, position info will be missing. // The package path of the top-level package will not be recorded, // so that calls to IImportData can override with a provided package path. -func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) { - defer func() { - if e := recover(); e != nil { - if ierr, ok := e.(internalError); ok { - err = ierr - return +func IExportData(out io.Writer, fset *token.FileSet, pkg *types.Package) error { + return iexportCommon(out, fset, false, iexportVersion, []*types.Package{pkg}) +} + +// IExportBundle writes an indexed export bundle for pkgs to out. +func IExportBundle(out io.Writer, fset *token.FileSet, pkgs []*types.Package) error { + return iexportCommon(out, fset, true, iexportVersion, pkgs) +} + +func iexportCommon(out io.Writer, fset *token.FileSet, bundle bool, version int, pkgs []*types.Package) (err error) { + if !debug { + defer func() { + if e := recover(); e != nil { + if ierr, ok := e.(internalError); ok { + err = ierr + return + } + // Not an internal error; panic again. + panic(e) } - // Not an internal error; panic again. - panic(e) - } - }() + }() + } p := iexporter{ - out: bytes.NewBuffer(nil), fset: fset, + version: version, allPkgs: map[*types.Package]bool{}, stringIndex: map[string]uint64{}, declIndex: map[types.Object]uint64{}, + tparamNames: map[types.Object]string{}, typIndex: map[types.Type]uint64{}, - localpkg: pkg, + } + if !bundle { + p.localpkg = pkgs[0] } for i, pt := range predeclared() { @@ -60,10 +78,20 @@ func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) } // Initialize work queue with exported declarations. - scope := pkg.Scope() - for _, name := range scope.Names() { - if ast.IsExported(name) { - p.pushDecl(scope.Lookup(name)) + for _, pkg := range pkgs { + scope := pkg.Scope() + for _, name := range scope.Names() { + if ast.IsExported(name) { + p.pushDecl(scope.Lookup(name)) + } + } + + if bundle { + // Ensure pkg and its imports are included in the index. + p.allPkgs[pkg] = true + for _, imp := range pkg.Imports() { + p.allPkgs[imp] = true + } } } @@ -76,21 +104,35 @@ func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) dataLen := uint64(p.data0.Len()) w := p.newWriter() w.writeIndex(p.declIndex) + + if bundle { + w.uint64(uint64(len(pkgs))) + for _, pkg := range pkgs { + w.pkg(pkg) + imps := pkg.Imports() + w.uint64(uint64(len(imps))) + for _, imp := range imps { + w.pkg(imp) + } + } + } w.flush() // Assemble header. var hdr intWriter - hdr.WriteByte('i') - hdr.uint64(iexportVersion) + if bundle { + hdr.uint64(bundleVersion) + } + hdr.uint64(uint64(p.version)) hdr.uint64(uint64(p.strings.Len())) hdr.uint64(dataLen) // Flush output. - io.Copy(p.out, &hdr) - io.Copy(p.out, &p.strings) - io.Copy(p.out, &p.data0) + io.Copy(out, &hdr) + io.Copy(out, &p.strings) + io.Copy(out, &p.data0) - return p.out.Bytes(), nil + return nil } // writeIndex writes out an object index. mainIndex indicates whether @@ -98,19 +140,26 @@ func IExportData(fset *token.FileSet, pkg *types.Package) (b []byte, err error) // non-compiler tools and includes a complete package description // (i.e., name and height). func (w *exportWriter) writeIndex(index map[types.Object]uint64) { + type pkgObj struct { + obj types.Object + name string // qualified name; differs from obj.Name for type params + } // Build a map from packages to objects from that package. - pkgObjs := map[*types.Package][]types.Object{} + pkgObjs := map[*types.Package][]pkgObj{} // For the main index, make sure to include every package that // we reference, even if we're not exporting (or reexporting) // any symbols from it. - pkgObjs[w.p.localpkg] = nil + if w.p.localpkg != nil { + pkgObjs[w.p.localpkg] = nil + } for pkg := range w.p.allPkgs { pkgObjs[pkg] = nil } for obj := range index { - pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], obj) + name := w.p.indexName(obj) + pkgObjs[obj.Pkg()] = append(pkgObjs[obj.Pkg()], pkgObj{obj, name}) } var pkgs []*types.Package @@ -118,7 +167,7 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { pkgs = append(pkgs, pkg) sort.Slice(objs, func(i, j int) bool { - return objs[i].Name() < objs[j].Name() + return objs[i].name < objs[j].name }) } @@ -135,15 +184,26 @@ func (w *exportWriter) writeIndex(index map[types.Object]uint64) { objs := pkgObjs[pkg] w.uint64(uint64(len(objs))) for _, obj := range objs { - w.string(obj.Name()) - w.uint64(index[obj]) + w.string(obj.name) + w.uint64(index[obj.obj]) } } } +// indexName returns the 'indexed' name of an object. It differs from +// obj.Name() only for type parameter names, where the name is qualified by +// owner. +func (p *iexporter) indexName(obj types.Object) (res string) { + if name := p.tparamNames[obj]; name != "" { + return name + } + return obj.Name() +} + type iexporter struct { - fset *token.FileSet - out *bytes.Buffer + fset *token.FileSet + out *bytes.Buffer + version int localpkg *types.Package @@ -157,9 +217,21 @@ type iexporter struct { strings intWriter stringIndex map[string]uint64 - data0 intWriter - declIndex map[types.Object]uint64 - typIndex map[types.Type]uint64 + data0 intWriter + declIndex map[types.Object]uint64 + tparamNames map[types.Object]string // typeparam->qualified name + typIndex map[types.Type]uint64 + + indent int // for tracing support +} + +func (p *iexporter) trace(format string, args ...interface{}) { + if !trace { + // Call sites should also be guarded, but having this check here allows + // easily enabling/disabling debug trace statements. + return + } + fmt.Printf(strings.Repeat("..", p.indent)+format+"\n", args...) } // stringOff returns the offset of s within the string section. @@ -185,7 +257,7 @@ func (p *iexporter) pushDecl(obj types.Object) { return } - p.declIndex[obj] = ^uint64(0) // mark n present in work queue + p.declIndex[obj] = ^uint64(0) // mark obj present in work queue p.declTodo.pushTail(obj) } @@ -193,10 +265,11 @@ func (p *iexporter) pushDecl(obj types.Object) { type exportWriter struct { p *iexporter - data intWriter - currPkg *types.Package - prevFile string - prevLine int64 + data intWriter + currPkg *types.Package + prevFile string + prevLine int64 + prevColumn int64 } func (w *exportWriter) exportPath(pkg *types.Package) string { @@ -207,6 +280,14 @@ func (w *exportWriter) exportPath(pkg *types.Package) string { } func (p *iexporter) doDecl(obj types.Object) { + if trace { + p.trace("exporting decl %v (%T)", obj, obj) + p.indent++ + defer func() { + p.indent-- + p.trace("=> %s", obj) + }() + } w := p.newWriter() w.setPkg(obj.Pkg(), false) @@ -221,8 +302,23 @@ func (p *iexporter) doDecl(obj types.Object) { if sig.Recv() != nil { panic(internalErrorf("unexpected method: %v", sig)) } - w.tag('F') + + // Function. + if typeparams.ForSignature(sig).Len() == 0 { + w.tag('F') + } else { + w.tag('G') + } w.pos(obj.Pos()) + // The tparam list of the function type is the + // declaration of the type params. So, write out the type + // params right now. Then those type params will be + // referenced via their type offset (via typOff) in all + // other places in the signature and function that they + // are used. + if tparams := typeparams.ForSignature(sig); tparams.Len() > 0 { + w.tparamList(obj, tparams, obj.Pkg()) + } w.signature(sig) case *types.Const: @@ -231,30 +327,54 @@ func (p *iexporter) doDecl(obj types.Object) { w.value(obj.Type(), obj.Val()) case *types.TypeName: + t := obj.Type() + + if tparam, ok := t.(*typeparams.TypeParam); ok { + w.tag('P') + w.pos(obj.Pos()) + constraint := tparam.Constraint() + if p.version >= iexportVersionGo1_18 { + implicit := false + if iface, _ := constraint.(*types.Interface); iface != nil { + implicit = typeparams.IsImplicit(iface) + } + w.bool(implicit) + } + w.typ(constraint, obj.Pkg()) + break + } + if obj.IsAlias() { w.tag('A') w.pos(obj.Pos()) - w.typ(obj.Type(), obj.Pkg()) + w.typ(t, obj.Pkg()) break } // Defined type. - w.tag('T') + named, ok := t.(*types.Named) + if !ok { + panic(internalErrorf("%s is not a defined type", t)) + } + + if typeparams.ForNamed(named).Len() == 0 { + w.tag('T') + } else { + w.tag('U') + } w.pos(obj.Pos()) + if typeparams.ForNamed(named).Len() > 0 { + w.tparamList(obj, typeparams.ForNamed(named), obj.Pkg()) + } + underlying := obj.Type().Underlying() w.typ(underlying, obj.Pkg()) - t := obj.Type() if types.IsInterface(t) { break } - named, ok := t.(*types.Named) - if !ok { - panic(internalErrorf("%s is not a defined type", t)) - } - n := named.NumMethods() w.uint64(uint64(n)) for i := 0; i < n; i++ { @@ -262,6 +382,15 @@ func (p *iexporter) doDecl(obj types.Object) { w.pos(m.Pos()) w.string(m.Name()) sig, _ := m.Type().(*types.Signature) + + // Receiver type parameters are type arguments of the receiver type, so + // their name must be qualified before exporting recv. + rparams := typeparams.RecvTypeParams(sig) + for i := 0; i < rparams.Len(); i++ { + rparam := rparams.At(i) + name := obj.Name() + "." + m.Name() + "." + rparam.Obj().Name() + w.p.tparamNames[rparam.Obj()] = name + } w.param(sig.Recv()) w.signature(sig) } @@ -278,6 +407,48 @@ func (w *exportWriter) tag(tag byte) { } func (w *exportWriter) pos(pos token.Pos) { + if w.p.version >= iexportVersionPosCol { + w.posV1(pos) + } else { + w.posV0(pos) + } +} + +func (w *exportWriter) posV1(pos token.Pos) { + if w.p.fset == nil { + w.int64(0) + return + } + + p := w.p.fset.Position(pos) + file := p.Filename + line := int64(p.Line) + column := int64(p.Column) + + deltaColumn := (column - w.prevColumn) << 1 + deltaLine := (line - w.prevLine) << 1 + + if file != w.prevFile { + deltaLine |= 1 + } + if deltaLine != 0 { + deltaColumn |= 1 + } + + w.int64(deltaColumn) + if deltaColumn&1 != 0 { + w.int64(deltaLine) + if deltaLine&1 != 0 { + w.string(file) + } + } + + w.prevFile = file + w.prevLine = line + w.prevColumn = column +} + +func (w *exportWriter) posV0(pos token.Pos) { if w.p.fset == nil { w.int64(0) return @@ -319,10 +490,11 @@ func (w *exportWriter) pkg(pkg *types.Package) { } func (w *exportWriter) qualifiedIdent(obj types.Object) { + name := w.p.indexName(obj) + // Ensure any referenced declarations are written out too. w.p.pushDecl(obj) - - w.string(obj.Name()) + w.string(name) w.pkg(obj.Pkg()) } @@ -356,11 +528,32 @@ func (w *exportWriter) startType(k itag) { } func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { + if trace { + w.p.trace("exporting type %s (%T)", t, t) + w.p.indent++ + defer func() { + w.p.indent-- + w.p.trace("=> %s", t) + }() + } switch t := t.(type) { case *types.Named: + if targs := typeparams.NamedTypeArgs(t); targs.Len() > 0 { + w.startType(instanceType) + // TODO(rfindley): investigate if this position is correct, and if it + // matters. + w.pos(t.Obj().Pos()) + w.typeList(targs, pkg) + w.typ(typeparams.NamedTypeOrigin(t), pkg) + return + } w.startType(definedType) w.qualifiedIdent(t.Obj()) + case *typeparams.TypeParam: + w.startType(typeParamType) + w.qualifiedIdent(t.Obj()) + case *types.Pointer: w.startType(pointerType) w.typ(t.Elem(), pkg) @@ -421,9 +614,14 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { n := t.NumEmbeddeds() w.uint64(uint64(n)) for i := 0; i < n; i++ { - f := t.Embedded(i) - w.pos(f.Obj().Pos()) - w.typ(f.Obj().Type(), f.Obj().Pkg()) + ft := t.EmbeddedType(i) + tPkg := pkg + if named, _ := ft.(*types.Named); named != nil { + w.pos(named.Obj().Pos()) + } else { + w.pos(token.NoPos) + } + w.typ(ft, tPkg) } n = t.NumExplicitMethods() @@ -436,6 +634,16 @@ func (w *exportWriter) doTyp(t types.Type, pkg *types.Package) { w.signature(sig) } + case *typeparams.Union: + w.startType(unionType) + nt := t.Len() + w.uint64(uint64(nt)) + for i := 0; i < nt; i++ { + term := t.Term(i) + w.bool(term.Tilde()) + w.typ(term.Type(), pkg) + } + default: panic(internalErrorf("unexpected type: %v, %v", t, reflect.TypeOf(t))) } @@ -457,6 +665,25 @@ func (w *exportWriter) signature(sig *types.Signature) { } } +func (w *exportWriter) typeList(ts *typeparams.TypeList, pkg *types.Package) { + w.uint64(uint64(ts.Len())) + for i := 0; i < ts.Len(); i++ { + w.typ(ts.At(i), pkg) + } +} + +func (w *exportWriter) tparamList(owner types.Object, list *typeparams.TypeParamList, pkg *types.Package) { + ll := uint64(list.Len()) + w.uint64(ll) + for i := 0; i < list.Len(); i++ { + tparam := list.At(i) + // Qualify the type parameter name before exporting its type. + name := owner.Name() + "." + tparam.Obj().Name() + w.p.tparamNames[tparam.Obj()] = name + w.typ(list.At(i), pkg) + } +} + func (w *exportWriter) paramList(tup *types.Tuple) { n := tup.Len() w.uint64(uint64(n)) @@ -473,11 +700,14 @@ func (w *exportWriter) param(obj types.Object) { func (w *exportWriter) value(typ types.Type, v constant.Value) { w.typ(typ, nil) + if w.p.version >= iexportVersionGo1_18 { + w.int64(int64(v.Kind())) + } - switch v.Kind() { - case constant.Bool: + switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { + case types.IsBoolean: w.bool(constant.BoolVal(v)) - case constant.Int: + case types.IsInteger: var i big.Int if i64, exact := constant.Int64Val(v); exact { i.SetInt64(i64) @@ -487,25 +717,27 @@ func (w *exportWriter) value(typ types.Type, v constant.Value) { i.SetString(v.ExactString(), 10) } w.mpint(&i, typ) - case constant.Float: + case types.IsFloat: f := constantToFloat(v) w.mpfloat(f, typ) - case constant.Complex: + case types.IsComplex: w.mpfloat(constantToFloat(constant.Real(v)), typ) w.mpfloat(constantToFloat(constant.Imag(v)), typ) - case constant.String: + case types.IsString: w.string(constant.StringVal(v)) - case constant.Unknown: - // package contains type errors default: - panic(internalErrorf("unexpected value %v (%T)", v, v)) + if b.Kind() == types.Invalid { + // package contains type errors + break + } + panic(internalErrorf("unexpected type %v (%v)", typ, typ.Underlying())) } } // constantToFloat converts a constant.Value with kind constant.Float to a // big.Float. func constantToFloat(x constant.Value) *big.Float { - assert(x.Kind() == constant.Float) + x = constant.ToFloat(x) // Use the same floating-point precision (512) as cmd/compile // (see Mpprec in cmd/compile/internal/gc/mpfloat.go). const mpprec = 512 diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go index a31a880263..cdb332cd15 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go @@ -18,6 +18,9 @@ import ( "go/types" "io" "sort" + "strings" + + "golang.org/x/tools/internal/typeparams" ) type intReader struct { @@ -41,6 +44,28 @@ func (r *intReader) uint64() uint64 { return i } +// Keep this in sync with constants in iexport.go. +// +// Temporarily, the x/tools importer accepts generic code at both version 1 and +// 2. However, version 2 contains some breaking changes on top of version 1: +// - the 'implicit' bit is added to exported constraints +// - a 'kind' byte is added to constant values (not yet done) +// +// Once we've completed the bump to version 2 in the standard library, we'll +// remove support for generics here at version 1. +const ( + iexportVersionGo1_11 = 0 + iexportVersionPosCol = 1 + iexportVersionGo1_18 = 2 + // TODO: before release, change this back to 2. + iexportVersionGenerics = iexportVersionPosCol +) + +type ident struct { + pkg string + name string +} + const predeclReserved = 32 type itag uint64 @@ -56,32 +81,63 @@ const ( signatureType structType interfaceType + typeParamType + instanceType + unionType ) // IImportData imports a package from the serialized package data -// and returns the number of bytes consumed and a reference to the package. +// and returns 0 and a reference to the package. // If the export data version is not recognized or the format is otherwise // compromised, an error is returned. -func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (_ int, pkg *types.Package, err error) { +func IImportData(fset *token.FileSet, imports map[string]*types.Package, data []byte, path string) (int, *types.Package, error) { + pkgs, err := iimportCommon(fset, imports, data, false, path) + if err != nil { + return 0, nil, err + } + return 0, pkgs[0], nil +} + +// IImportBundle imports a set of packages from the serialized package bundle. +func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data []byte) ([]*types.Package, error) { + return iimportCommon(fset, imports, data, true, "") +} + +func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data []byte, bundle bool, path string) (pkgs []*types.Package, err error) { const currentVersion = 1 version := int64(-1) - defer func() { - if e := recover(); e != nil { - if version > currentVersion { - err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) - } else { - err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) + if !debug { + defer func() { + if e := recover(); e != nil { + if version > currentVersion { + err = fmt.Errorf("cannot import %q (%v), export data is newer version - update tool", path, e) + } else { + err = fmt.Errorf("cannot import %q (%v), possibly version skew - reinstall package", path, e) + } } - } - }() + }() + } r := &intReader{bytes.NewReader(data), path} + if bundle { + bundleVersion := r.uint64() + switch bundleVersion { + case bundleVersion: + default: + errorf("unknown bundle format version %d", bundleVersion) + } + } + version = int64(r.uint64()) switch version { - case currentVersion, 0: + case iexportVersionGo1_18, iexportVersionPosCol, iexportVersionGo1_11: default: - errorf("unknown iexport format version %d", version) + if version > iexportVersionGo1_18 { + errorf("unstable iexport format version %d, just rebuild compiler and std library", version) + } else { + errorf("unknown iexport format version %d", version) + } } sLen := int64(r.uint64()) @@ -93,8 +149,8 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data [] r.Seek(sLen+dLen, io.SeekCurrent) p := iimporter{ - ipath: path, version: int(version), + ipath: path, stringData: stringData, stringCache: make(map[uint64]string), @@ -103,12 +159,16 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data [] declData: declData, pkgIndex: make(map[*types.Package]map[string]uint64), typCache: make(map[uint64]types.Type), + // Separate map for typeparams, keyed by their package and unique + // name. + tparamIndex: make(map[ident]types.Type), fake: fakeFileSet{ fset: fset, - files: make(map[string]*token.File), + files: make(map[string]*fileInfo), }, } + defer p.fake.setLines() // set lines for files in fset for i, pt := range predeclared() { p.typCache[uint64(i)] = pt @@ -143,54 +203,93 @@ func IImportData(fset *token.FileSet, imports map[string]*types.Package, data [] p.pkgIndex[pkg] = nameIndex pkgList[i] = pkg } - if len(pkgList) == 0 { - errorf("no packages found for %s", path) - panic("unreachable") - } - p.ipkg = pkgList[0] - names := make([]string, 0, len(p.pkgIndex[p.ipkg])) - for name := range p.pkgIndex[p.ipkg] { - names = append(names, name) + + if bundle { + pkgs = make([]*types.Package, r.uint64()) + for i := range pkgs { + pkg := p.pkgAt(r.uint64()) + imps := make([]*types.Package, r.uint64()) + for j := range imps { + imps[j] = p.pkgAt(r.uint64()) + } + pkg.SetImports(imps) + pkgs[i] = pkg + } + } else { + if len(pkgList) == 0 { + errorf("no packages found for %s", path) + panic("unreachable") + } + pkgs = pkgList[:1] + + // record all referenced packages as imports + list := append(([]*types.Package)(nil), pkgList[1:]...) + sort.Sort(byPath(list)) + pkgs[0].SetImports(list) } - sort.Strings(names) - for _, name := range names { - p.doDecl(p.ipkg, name) + + for _, pkg := range pkgs { + if pkg.Complete() { + continue + } + + names := make([]string, 0, len(p.pkgIndex[pkg])) + for name := range p.pkgIndex[pkg] { + names = append(names, name) + } + sort.Strings(names) + for _, name := range names { + p.doDecl(pkg, name) + } + + // package was imported completely and without errors + pkg.MarkComplete() } for _, typ := range p.interfaceList { typ.Complete() } - // record all referenced packages as imports - list := append(([]*types.Package)(nil), pkgList[1:]...) - sort.Sort(byPath(list)) - p.ipkg.SetImports(list) - - // package was imported completely and without errors - p.ipkg.MarkComplete() - - consumed, _ := r.Seek(0, io.SeekCurrent) - return int(consumed), p.ipkg, nil + return pkgs, nil } type iimporter struct { - ipath string - ipkg *types.Package version int + ipath string stringData []byte stringCache map[uint64]string pkgCache map[uint64]*types.Package - declData []byte - pkgIndex map[*types.Package]map[string]uint64 - typCache map[uint64]types.Type + declData []byte + pkgIndex map[*types.Package]map[string]uint64 + typCache map[uint64]types.Type + tparamIndex map[ident]types.Type fake fakeFileSet interfaceList []*types.Interface + + indent int // for tracing support +} + +func (p *iimporter) trace(format string, args ...interface{}) { + if !trace { + // Call sites should also be guarded, but having this check here allows + // easily enabling/disabling debug trace statements. + return + } + fmt.Printf(strings.Repeat("..", p.indent)+format+"\n", args...) } func (p *iimporter) doDecl(pkg *types.Package, name string) { + if debug { + p.trace("import decl %s", name) + p.indent++ + defer func() { + p.indent-- + p.trace("=> %s", name) + }() + } // See if we've already imported this declaration. if obj := pkg.Scope().Lookup(name); obj != nil { return @@ -227,15 +326,12 @@ func (p *iimporter) pkgAt(off uint64) *types.Package { return pkg } path := p.stringAt(off) - if path == p.ipath { - return p.ipkg - } errorf("missing package %q in %q", path, p.ipath) return nil } func (p *iimporter) typAt(off uint64, base *types.Named) types.Type { - if t, ok := p.typCache[off]; ok && (base == nil || !isInterface(t)) { + if t, ok := p.typCache[off]; ok && canReuse(base, t) { return t } @@ -247,12 +343,30 @@ func (p *iimporter) typAt(off uint64, base *types.Named) types.Type { r.declReader.Reset(p.declData[off-predeclReserved:]) t := r.doType(base) - if base == nil || !isInterface(t) { + if canReuse(base, t) { p.typCache[off] = t } return t } +// canReuse reports whether the type rhs on the RHS of the declaration for def +// may be re-used. +// +// Specifically, if def is non-nil and rhs is an interface type with methods, it +// may not be re-used because we have a convention of setting the receiver type +// for interface methods to def. +func canReuse(def *types.Named, rhs types.Type) bool { + if def == nil { + return true + } + iface, _ := rhs.(*types.Interface) + if iface == nil { + return true + } + // Don't use iface.Empty() here as iface may not be complete. + return iface.NumEmbeddeds() == 0 && iface.NumExplicitMethods() == 0 +} + type importReader struct { p *iimporter declReader bytes.Reader @@ -277,17 +391,26 @@ func (r *importReader) obj(name string) { r.declare(types.NewConst(pos, r.currPkg, name, typ, val)) - case 'F': - sig := r.signature(nil) - + case 'F', 'G': + var tparams []*typeparams.TypeParam + if tag == 'G' { + tparams = r.tparamList() + } + sig := r.signature(nil, nil, tparams) r.declare(types.NewFunc(pos, r.currPkg, name, sig)) - case 'T': + case 'T', 'U': // Types can be recursive. We need to setup a stub // declaration before recursing. obj := types.NewTypeName(pos, r.currPkg, name, nil) named := types.NewNamed(obj, nil, nil) + // Declare obj before calling r.tparamList, so the new type name is recognized + // if used in the constraint of one of its own typeparams (see #48280). r.declare(obj) + if tag == 'U' { + tparams := r.tparamList() + typeparams.SetForNamed(named, tparams) + } underlying := r.p.typAt(r.uint64(), named).Underlying() named.SetUnderlying(underlying) @@ -297,12 +420,60 @@ func (r *importReader) obj(name string) { mpos := r.pos() mname := r.ident() recv := r.param() - msig := r.signature(recv) + + // If the receiver has any targs, set those as the + // rparams of the method (since those are the + // typeparams being used in the method sig/body). + base := baseType(recv.Type()) + assert(base != nil) + targs := typeparams.NamedTypeArgs(base) + var rparams []*typeparams.TypeParam + if targs.Len() > 0 { + rparams = make([]*typeparams.TypeParam, targs.Len()) + for i := range rparams { + rparams[i] = targs.At(i).(*typeparams.TypeParam) + } + } + msig := r.signature(recv, rparams, nil) named.AddMethod(types.NewFunc(mpos, r.currPkg, mname, msig)) } } + case 'P': + // We need to "declare" a typeparam in order to have a name that + // can be referenced recursively (if needed) in the type param's + // bound. + if r.p.version < iexportVersionGenerics { + errorf("unexpected type param type") + } + // Remove the "path" from the type param name that makes it unique + ix := strings.LastIndex(name, ".") + if ix < 0 { + errorf("missing path for type param") + } + name0 := name[ix+1:] + tn := types.NewTypeName(pos, r.currPkg, name0, nil) + t := typeparams.NewTypeParam(tn, nil) + + // To handle recursive references to the typeparam within its + // bound, save the partial type in tparamIndex before reading the bounds. + id := ident{r.currPkg.Name(), name} + r.p.tparamIndex[id] = t + var implicit bool + if r.p.version >= iexportVersionGo1_18 { + implicit = r.bool() + } + constraint := r.typ() + if implicit { + iface, _ := constraint.(*types.Interface) + if iface == nil { + errorf("non-interface constraint marked implicit") + } + typeparams.MarkImplicit(iface) + } + typeparams.SetTypeParamConstraint(t, constraint) + case 'V': typ := r.typ() @@ -319,6 +490,10 @@ func (r *importReader) declare(obj types.Object) { func (r *importReader) value() (typ types.Type, val constant.Value) { typ = r.typ() + if r.p.version >= iexportVersionGo1_18 { + // TODO: add support for using the kind. + _ = constant.Kind(r.int64()) + } switch b := typ.Underlying().(*types.Basic); b.Info() & types.IsConstType { case types.IsBoolean: @@ -435,6 +610,14 @@ func (r *importReader) mpfloat(b *types.Basic) constant.Value { switch { case exp > 0: x = constant.Shift(x, token.SHL, uint(exp)) + // Ensure that the imported Kind is Float, else this constant may run into + // bitsize limits on overlarge integers. Eventually we can instead adopt + // the approach of CL 288632, but that CL relies on go/constant APIs that + // were introduced in go1.13. + // + // TODO(rFindley): sync the logic here with tip Go once we no longer + // support go1.12. + x = constant.ToFloat(x) case exp < 0: d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp)) x = constant.BinaryOp(x, token.QUO, d) @@ -453,7 +636,7 @@ func (r *importReader) qualifiedIdent() (*types.Package, string) { } func (r *importReader) pos() token.Pos { - if r.p.version >= 1 { + if r.p.version >= iexportVersionPosCol { r.posv1() } else { r.posv0() @@ -501,8 +684,17 @@ func isInterface(t types.Type) bool { func (r *importReader) pkg() *types.Package { return r.p.pkgAt(r.uint64()) } func (r *importReader) string() string { return r.p.stringAt(r.uint64()) } -func (r *importReader) doType(base *types.Named) types.Type { - switch k := r.kind(); k { +func (r *importReader) doType(base *types.Named) (res types.Type) { + k := r.kind() + if debug { + r.p.trace("importing type %d (base: %s)", k, base) + r.p.indent++ + defer func() { + r.p.indent-- + r.p.trace("=> %s", res) + }() + } + switch k { default: errorf("unexpected kind tag in %q: %v", r.p.ipath, k) return nil @@ -525,7 +717,7 @@ func (r *importReader) doType(base *types.Named) types.Type { return types.NewMap(r.typ(), r.typ()) case signatureType: r.currPkg = r.pkg() - return r.signature(nil) + return r.signature(nil, nil, nil) case structType: r.currPkg = r.pkg() @@ -565,13 +757,56 @@ func (r *importReader) doType(base *types.Named) types.Type { recv = types.NewVar(token.NoPos, r.currPkg, "", base) } - msig := r.signature(recv) + msig := r.signature(recv, nil, nil) methods[i] = types.NewFunc(mpos, r.currPkg, mname, msig) } typ := newInterface(methods, embeddeds) r.p.interfaceList = append(r.p.interfaceList, typ) return typ + + case typeParamType: + if r.p.version < iexportVersionGenerics { + errorf("unexpected type param type") + } + pkg, name := r.qualifiedIdent() + id := ident{pkg.Name(), name} + if t, ok := r.p.tparamIndex[id]; ok { + // We're already in the process of importing this typeparam. + return t + } + // Otherwise, import the definition of the typeparam now. + r.p.doDecl(pkg, name) + return r.p.tparamIndex[id] + + case instanceType: + if r.p.version < iexportVersionGenerics { + errorf("unexpected instantiation type") + } + // pos does not matter for instances: they are positioned on the original + // type. + _ = r.pos() + len := r.uint64() + targs := make([]types.Type, len) + for i := range targs { + targs[i] = r.typ() + } + baseType := r.typ() + // The imported instantiated type doesn't include any methods, so + // we must always use the methods of the base (orig) type. + // TODO provide a non-nil *Environment + t, _ := typeparams.Instantiate(nil, baseType, targs, false) + return t + + case unionType: + if r.p.version < iexportVersionGenerics { + errorf("unexpected instantiation type") + } + terms := make([]*typeparams.Term, r.uint64()) + for i := range terms { + terms[i] = typeparams.NewTerm(r.bool(), r.typ()) + } + return typeparams.NewUnion(terms) } } @@ -579,11 +814,25 @@ func (r *importReader) kind() itag { return itag(r.uint64()) } -func (r *importReader) signature(recv *types.Var) *types.Signature { +func (r *importReader) signature(recv *types.Var, rparams []*typeparams.TypeParam, tparams []*typeparams.TypeParam) *types.Signature { params := r.paramList() results := r.paramList() variadic := params.Len() > 0 && r.bool() - return types.NewSignature(recv, params, results, variadic) + return typeparams.NewSignatureType(recv, rparams, tparams, params, results, variadic) +} + +func (r *importReader) tparamList() []*typeparams.TypeParam { + n := r.uint64() + if n == 0 { + return nil + } + xs := make([]*typeparams.TypeParam, n) + for i := range xs { + // Note: the standard library importer is tolerant of nil types here, + // though would panic in SetTypeParams. + xs[i] = r.typ().(*typeparams.TypeParam) + } + return xs } func (r *importReader) paramList() *types.Tuple { @@ -628,3 +877,13 @@ func (r *importReader) byte() byte { } return x } + +func baseType(typ types.Type) *types.Named { + // pointer receivers are never types.Named types + if p, _ := typ.(*types.Pointer); p != nil { + typ = p.Elem() + } + // receiver base types are always (possibly generic) types.Named types + n, _ := typ.(*types.Named) + return n +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go index 463f252271..8b163e3d05 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build !go1.11 // +build !go1.11 package gcimporter diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go index ab28b95cbb..49984f40fd 100644 --- a/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +//go:build go1.11 // +build go1.11 package gcimporter diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go new file mode 100644 index 0000000000..d892273efb --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go117.go @@ -0,0 +1,16 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.18 +// +build !go1.18 + +package gcimporter + +import "go/types" + +const iexportVersion = iexportVersionGo1_11 + +func additionalPredeclared() []types.Type { + return nil +} diff --git a/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go new file mode 100644 index 0000000000..a993843230 --- /dev/null +++ b/vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go @@ -0,0 +1,23 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.18 +// +build go1.18 + +package gcimporter + +import "go/types" + +const iexportVersion = iexportVersionGenerics + +// additionalPredeclared returns additional predeclared types in go.1.18. +func additionalPredeclared() []types.Type { + return []types.Type{ + // comparable + types.Universe.Lookup("comparable").Type(), + + // any + types.Universe.Lookup("any").Type(), + } +} diff --git a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go index db0c9a7ea6..18a002f82a 100644 --- a/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go +++ b/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go @@ -6,169 +6,44 @@ package packagesdriver import ( - "bytes" "context" - "encoding/json" "fmt" "go/types" - "log" - "os" - "os/exec" "strings" - "time" + + "golang.org/x/tools/internal/gocommand" ) var debug = false -// GetSizes returns the sizes used by the underlying driver with the given parameters. -func GetSizes(ctx context.Context, buildFlags, env []string, dir string, usesExportData bool) (types.Sizes, error) { - // TODO(matloob): Clean this up. This code is mostly a copy of packages.findExternalDriver. - const toolPrefix = "GOPACKAGESDRIVER=" - tool := "" - for _, env := range env { - if val := strings.TrimPrefix(env, toolPrefix); val != env { - tool = val - } - } - - if tool == "" { - var err error - tool, err = exec.LookPath("gopackagesdriver") - if err != nil { - // We did not find the driver, so use "go list". - tool = "off" - } - } - - if tool == "off" { - return GetSizesGolist(ctx, buildFlags, env, dir, usesExportData) - } - - req, err := json.Marshal(struct { - Command string `json:"command"` - Env []string `json:"env"` - BuildFlags []string `json:"build_flags"` - }{ - Command: "sizes", - Env: env, - BuildFlags: buildFlags, - }) - if err != nil { - return nil, fmt.Errorf("failed to encode message to driver tool: %v", err) - } - - buf := new(bytes.Buffer) - cmd := exec.CommandContext(ctx, tool) - cmd.Dir = dir - cmd.Env = env - cmd.Stdin = bytes.NewReader(req) - cmd.Stdout = buf - cmd.Stderr = new(bytes.Buffer) - if err := cmd.Run(); err != nil { - return nil, fmt.Errorf("%v: %v: %s", tool, err, cmd.Stderr) - } - var response struct { - // Sizes, if not nil, is the types.Sizes to use when type checking. - Sizes *types.StdSizes - } - if err := json.Unmarshal(buf.Bytes(), &response); err != nil { - return nil, err - } - return response.Sizes, nil -} - -func GetSizesGolist(ctx context.Context, buildFlags, env []string, dir string, usesExportData bool) (types.Sizes, error) { - args := []string{"list", "-f", "{{context.GOARCH}} {{context.Compiler}}"} - args = append(args, buildFlags...) - args = append(args, "--", "unsafe") - stdout, stderr, err := invokeGo(ctx, env, dir, usesExportData, args...) +func GetSizesGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (types.Sizes, error) { + inv.Verb = "list" + inv.Args = []string{"-f", "{{context.GOARCH}} {{context.Compiler}}", "--", "unsafe"} + stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv) var goarch, compiler string - if err != nil { - if strings.Contains(err.Error(), "cannot find main module") { + if rawErr != nil { + if rawErrMsg := rawErr.Error(); strings.Contains(rawErrMsg, "cannot find main module") || strings.Contains(rawErrMsg, "go.mod file not found") { // User's running outside of a module. All bets are off. Get GOARCH and guess compiler is gc. // TODO(matloob): Is this a problem in practice? - envout, _, enverr := invokeGo(ctx, env, dir, usesExportData, "env", "GOARCH") + inv.Verb = "env" + inv.Args = []string{"GOARCH"} + envout, enverr := gocmdRunner.Run(ctx, inv) if enverr != nil { - return nil, err + return nil, enverr } goarch = strings.TrimSpace(envout.String()) compiler = "gc" } else { - return nil, err + return nil, friendlyErr } } else { fields := strings.Fields(stdout.String()) if len(fields) < 2 { - return nil, fmt.Errorf("could not parse GOARCH and Go compiler in format \" \" from stdout of go command:\n%s\ndir: %s\nstdout: <<%s>>\nstderr: <<%s>>", - cmdDebugStr(env, args...), dir, stdout.String(), stderr.String()) + return nil, fmt.Errorf("could not parse GOARCH and Go compiler in format \" \":\nstdout: <<%s>>\nstderr: <<%s>>", + stdout.String(), stderr.String()) } goarch = fields[0] compiler = fields[1] } return types.SizesFor(compiler, goarch), nil } - -// invokeGo returns the stdout and stderr of a go command invocation. -func invokeGo(ctx context.Context, env []string, dir string, usesExportData bool, args ...string) (*bytes.Buffer, *bytes.Buffer, error) { - if debug { - defer func(start time.Time) { log.Printf("%s for %v", time.Since(start), cmdDebugStr(env, args...)) }(time.Now()) - } - stdout := new(bytes.Buffer) - stderr := new(bytes.Buffer) - cmd := exec.CommandContext(ctx, "go", args...) - // On darwin the cwd gets resolved to the real path, which breaks anything that - // expects the working directory to keep the original path, including the - // go command when dealing with modules. - // The Go stdlib has a special feature where if the cwd and the PWD are the - // same node then it trusts the PWD, so by setting it in the env for the child - // process we fix up all the paths returned by the go command. - cmd.Env = append(append([]string{}, env...), "PWD="+dir) - cmd.Dir = dir - cmd.Stdout = stdout - cmd.Stderr = stderr - if err := cmd.Run(); err != nil { - exitErr, ok := err.(*exec.ExitError) - if !ok { - // Catastrophic error: - // - executable not found - // - context cancellation - return nil, nil, fmt.Errorf("couldn't exec 'go %v': %s %T", args, err, err) - } - - // Export mode entails a build. - // If that build fails, errors appear on stderr - // (despite the -e flag) and the Export field is blank. - // Do not fail in that case. - if !usesExportData { - return nil, nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr) - } - } - - // As of writing, go list -export prints some non-fatal compilation - // errors to stderr, even with -e set. We would prefer that it put - // them in the Package.Error JSON (see https://golang.org/issue/26319). - // In the meantime, there's nowhere good to put them, but they can - // be useful for debugging. Print them if $GOPACKAGESPRINTGOLISTERRORS - // is set. - if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTGOLISTERRORS") != "" { - fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(env, args...), stderr) - } - - // debugging - if false { - fmt.Fprintf(os.Stderr, "%s stdout: <<%s>>\n", cmdDebugStr(env, args...), stdout) - } - - return stdout, stderr, nil -} - -func cmdDebugStr(envlist []string, args ...string) string { - env := make(map[string]string) - for _, kv := range envlist { - split := strings.Split(kv, "=") - k, v := split[0], split[1] - env[k] = v - } - - return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v PWD=%v go %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["PWD"], args) -} diff --git a/vendor/golang.org/x/tools/go/packages/doc.go b/vendor/golang.org/x/tools/go/packages/doc.go index 3799f8ed8b..4bfe28a51f 100644 --- a/vendor/golang.org/x/tools/go/packages/doc.go +++ b/vendor/golang.org/x/tools/go/packages/doc.go @@ -60,8 +60,7 @@ causes Load to run in LoadFiles mode, collecting minimal information. See the documentation for type Config for details. As noted earlier, the Config.Mode controls the amount of detail -reported about the loaded packages, with each mode returning all the data of the -previous mode with some extra added. See the documentation for type LoadMode +reported about the loaded packages. See the documentation for type LoadMode for details. Most tools should pass their command-line arguments (after any flags) diff --git a/vendor/golang.org/x/tools/go/packages/external.go b/vendor/golang.org/x/tools/go/packages/external.go index 6ac3e4f5b5..7242a0a7d2 100644 --- a/vendor/golang.org/x/tools/go/packages/external.go +++ b/vendor/golang.org/x/tools/go/packages/external.go @@ -12,8 +12,8 @@ import ( "bytes" "encoding/json" "fmt" + exec "golang.org/x/sys/execabs" "os" - "os/exec" "strings" ) @@ -84,13 +84,14 @@ func findExternalDriver(cfg *Config) driver { cmd.Stdin = bytes.NewReader(req) cmd.Stdout = buf cmd.Stderr = stderr - if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTDRIVERERRORS") != "" { - fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(cmd, words...), stderr) - } if err := cmd.Run(); err != nil { return nil, fmt.Errorf("%v: %v: %s", tool, err, cmd.Stderr) } + if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTDRIVERERRORS") != "" { + fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(cmd), stderr) + } + var response driverResponse if err := json.Unmarshal(buf.Bytes(), &response); err != nil { return nil, err diff --git a/vendor/golang.org/x/tools/go/packages/golist.go b/vendor/golang.org/x/tools/go/packages/golist.go index 648e364313..0e1e7f11fe 100644 --- a/vendor/golang.org/x/tools/go/packages/golist.go +++ b/vendor/golang.org/x/tools/go/packages/golist.go @@ -6,27 +6,27 @@ package packages import ( "bytes" + "context" "encoding/json" "fmt" "go/types" "io/ioutil" "log" "os" - "os/exec" "path" "path/filepath" "reflect" - "regexp" + "sort" "strconv" "strings" "sync" - "time" "unicode" + exec "golang.org/x/sys/execabs" "golang.org/x/tools/go/internal/packagesdriver" - "golang.org/x/tools/internal/gopathwalk" - "golang.org/x/tools/internal/semver" - "golang.org/x/tools/internal/span" + "golang.org/x/tools/internal/gocommand" + "golang.org/x/tools/internal/packagesinternal" + "golang.org/x/xerrors" ) // debug controls verbose logging. @@ -45,16 +45,21 @@ type responseDeduper struct { dr *driverResponse } -// init fills in r with a driverResponse. -func (r *responseDeduper) init(dr *driverResponse) { - r.dr = dr - r.seenRoots = map[string]bool{} - r.seenPackages = map[string]*Package{} +func newDeduper() *responseDeduper { + return &responseDeduper{ + dr: &driverResponse{}, + seenRoots: map[string]bool{}, + seenPackages: map[string]*Package{}, + } +} + +// addAll fills in r with a driverResponse. +func (r *responseDeduper) addAll(dr *driverResponse) { for _, pkg := range dr.Packages { - r.seenPackages[pkg.ID] = pkg + r.addPackage(pkg) } for _, root := range dr.Roots { - r.seenRoots[root] = true + r.addRoot(root) } } @@ -74,25 +79,51 @@ func (r *responseDeduper) addRoot(id string) { r.dr.Roots = append(r.dr.Roots, id) } -// goInfo contains global information from the go tool. -type goInfo struct { - rootDirs map[string]string - env goEnv +type golistState struct { + cfg *Config + ctx context.Context + + envOnce sync.Once + goEnvError error + goEnv map[string]string + + rootsOnce sync.Once + rootDirsError error + rootDirs map[string]string + + goVersionOnce sync.Once + goVersionError error + goVersion int // The X in Go 1.X. + + // vendorDirs caches the (non)existence of vendor directories. + vendorDirs map[string]bool } -type goEnv struct { - modulesOn bool +// getEnv returns Go environment variables. Only specific variables are +// populated -- computing all of them is slow. +func (state *golistState) getEnv() (map[string]string, error) { + state.envOnce.Do(func() { + var b *bytes.Buffer + b, state.goEnvError = state.invokeGo("env", "-json", "GOMOD", "GOPATH") + if state.goEnvError != nil { + return + } + + state.goEnv = make(map[string]string) + decoder := json.NewDecoder(b) + if state.goEnvError = decoder.Decode(&state.goEnv); state.goEnvError != nil { + return + } + }) + return state.goEnv, state.goEnvError } -func determineEnv(cfg *Config) goEnv { - buf, err := invokeGo(cfg, "env", "GOMOD") +// mustGetEnv is a convenience function that can be used if getEnv has already succeeded. +func (state *golistState) mustGetEnv() map[string]string { + env, err := state.getEnv() if err != nil { - return goEnv{} + panic(fmt.Sprintf("mustGetEnv: %v", err)) } - gomod := bytes.TrimSpace(buf.Bytes()) - - env := goEnv{} - env.modulesOn = len(gomod) > 0 return env } @@ -100,47 +131,38 @@ func determineEnv(cfg *Config) goEnv { // the build system package structure. // See driver for more details. func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) { - var sizes types.Sizes + // Make sure that any asynchronous go commands are killed when we return. + parentCtx := cfg.Context + if parentCtx == nil { + parentCtx = context.Background() + } + ctx, cancel := context.WithCancel(parentCtx) + defer cancel() + + response := newDeduper() + + state := &golistState{ + cfg: cfg, + ctx: ctx, + vendorDirs: map[string]bool{}, + } + + // Fill in response.Sizes asynchronously if necessary. var sizeserr error var sizeswg sync.WaitGroup if cfg.Mode&NeedTypesSizes != 0 || cfg.Mode&NeedTypes != 0 { sizeswg.Add(1) go func() { - sizes, sizeserr = getSizes(cfg) + var sizes types.Sizes + sizes, sizeserr = packagesdriver.GetSizesGolist(ctx, state.cfgInvocation(), cfg.gocmdRunner) + // types.SizesFor always returns nil or a *types.StdSizes. + response.dr.Sizes, _ = sizes.(*types.StdSizes) sizeswg.Done() }() } - defer sizeswg.Wait() - - // start fetching rootDirs - var info goInfo - var rootDirsReady, envReady = make(chan struct{}), make(chan struct{}) - go func() { - info.rootDirs = determineRootDirs(cfg) - close(rootDirsReady) - }() - go func() { - info.env = determineEnv(cfg) - close(envReady) - }() - getGoInfo := func() *goInfo { - <-rootDirsReady - <-envReady - return &info - } - - // Ensure that we don't leak goroutines: Load is synchronous, so callers will - // not expect it to access the fields of cfg after the call returns. - defer getGoInfo() - - // always pass getGoInfo to golistDriver - golistDriver := func(cfg *Config, patterns ...string) (*driverResponse, error) { - return golistDriver(cfg, getGoInfo, patterns...) - } // Determine files requested in contains patterns var containFiles []string - var packagesNamed []string restPatterns := make([]string, 0, len(patterns)) // Extract file= and other [querytype]= patterns. Report an error if querytype // doesn't exist. @@ -156,8 +178,6 @@ extractQueries: containFiles = append(containFiles, value) case "pattern": restPatterns = append(restPatterns, value) - case "iamashamedtousethedisabledqueryname": - packagesNamed = append(packagesNamed, value) case "": // not a reserved query restPatterns = append(restPatterns, pattern) default: @@ -173,107 +193,105 @@ extractQueries: } } - response := &responseDeduper{} - var err error - // See if we have any patterns to pass through to go list. Zero initial // patterns also requires a go list call, since it's the equivalent of // ".". if len(restPatterns) > 0 || len(patterns) == 0 { - dr, err := golistDriver(cfg, restPatterns...) + dr, err := state.createDriverResponse(restPatterns...) if err != nil { return nil, err } - response.init(dr) - } else { - response.init(&driverResponse{}) + response.addAll(dr) } - sizeswg.Wait() - if sizeserr != nil { - return nil, sizeserr - } - // types.SizesFor always returns nil or a *types.StdSizes - response.dr.Sizes, _ = sizes.(*types.StdSizes) - - var containsCandidates []string - if len(containFiles) != 0 { - if err := runContainsQueries(cfg, golistDriver, response, containFiles, getGoInfo); err != nil { + if err := state.runContainsQueries(response, containFiles); err != nil { return nil, err } } - if len(packagesNamed) != 0 { - if err := runNamedQueries(cfg, golistDriver, response, packagesNamed); err != nil { + // Only use go/packages' overlay processing if we're using a Go version + // below 1.16. Otherwise, go list handles it. + if goVersion, err := state.getGoVersion(); err == nil && goVersion < 16 { + modifiedPkgs, needPkgs, err := state.processGolistOverlay(response) + if err != nil { return nil, err } - } - modifiedPkgs, needPkgs, err := processGolistOverlay(cfg, response, getGoInfo) - if err != nil { - return nil, err - } - if len(containFiles) > 0 { - containsCandidates = append(containsCandidates, modifiedPkgs...) - containsCandidates = append(containsCandidates, needPkgs...) - } - if err := addNeededOverlayPackages(cfg, golistDriver, response, needPkgs, getGoInfo); err != nil { - return nil, err - } - // Check candidate packages for containFiles. - if len(containFiles) > 0 { - for _, id := range containsCandidates { - pkg, ok := response.seenPackages[id] - if !ok { - response.addPackage(&Package{ - ID: id, - Errors: []Error{ - { + var containsCandidates []string + if len(containFiles) > 0 { + containsCandidates = append(containsCandidates, modifiedPkgs...) + containsCandidates = append(containsCandidates, needPkgs...) + } + if err := state.addNeededOverlayPackages(response, needPkgs); err != nil { + return nil, err + } + // Check candidate packages for containFiles. + if len(containFiles) > 0 { + for _, id := range containsCandidates { + pkg, ok := response.seenPackages[id] + if !ok { + response.addPackage(&Package{ + ID: id, + Errors: []Error{{ Kind: ListError, Msg: fmt.Sprintf("package %s expected but not seen", id), - }, - }, - }) - continue - } - for _, f := range containFiles { - for _, g := range pkg.GoFiles { - if sameFile(f, g) { - response.addRoot(id) + }}, + }) + continue + } + for _, f := range containFiles { + for _, g := range pkg.GoFiles { + if sameFile(f, g) { + response.addRoot(id) + } } } } } + // Add root for any package that matches a pattern. This applies only to + // packages that are modified by overlays, since they are not added as + // roots automatically. + for _, pattern := range restPatterns { + match := matchPattern(pattern) + for _, pkgID := range modifiedPkgs { + pkg, ok := response.seenPackages[pkgID] + if !ok { + continue + } + if match(pkg.PkgPath) { + response.addRoot(pkg.ID) + } + } + } } + sizeswg.Wait() + if sizeserr != nil { + return nil, sizeserr + } return response.dr, nil } -func addNeededOverlayPackages(cfg *Config, driver driver, response *responseDeduper, pkgs []string, getGoInfo func() *goInfo) error { +func (state *golistState) addNeededOverlayPackages(response *responseDeduper, pkgs []string) error { if len(pkgs) == 0 { return nil } - drivercfg := *cfg - if getGoInfo().env.modulesOn { - drivercfg.BuildFlags = append(drivercfg.BuildFlags, "-mod=readonly") - } - dr, err := driver(&drivercfg, pkgs...) - + dr, err := state.createDriverResponse(pkgs...) if err != nil { return err } for _, pkg := range dr.Packages { response.addPackage(pkg) } - _, needPkgs, err := processGolistOverlay(cfg, response, getGoInfo) + _, needPkgs, err := state.processGolistOverlay(response) if err != nil { return err } - return addNeededOverlayPackages(cfg, driver, response, needPkgs, getGoInfo) + return state.addNeededOverlayPackages(response, needPkgs) } -func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, queries []string, goInfo func() *goInfo) error { +func (state *golistState) runContainsQueries(response *responseDeduper, queries []string) error { for _, query := range queries { // TODO(matloob): Do only one query per directory. fdir := filepath.Dir(query) @@ -283,42 +301,16 @@ func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, q if err != nil { return fmt.Errorf("could not determine absolute path of file= query path %q: %v", query, err) } - dirResponse, err := driver(cfg, pattern) - if err != nil { - var queryErr error - if dirResponse, queryErr = adHocPackage(cfg, driver, pattern, query); queryErr != nil { - return err // return the original error - } - } - // `go list` can report errors for files that are not listed as part of a package's GoFiles. - // In the case of an invalid Go file, we should assume that it is part of package if only - // one package is in the response. The file may have valid contents in an overlay. - if len(dirResponse.Packages) == 1 { - pkg := dirResponse.Packages[0] - for i, err := range pkg.Errors { - s := errorSpan(err) - if !s.IsValid() { - break - } - if len(pkg.CompiledGoFiles) == 0 { - break - } - dir := filepath.Dir(pkg.CompiledGoFiles[0]) - filename := filepath.Join(dir, filepath.Base(s.URI().Filename())) - if info, err := os.Stat(filename); err != nil || info.IsDir() { - break - } - if !contains(pkg.CompiledGoFiles, filename) { - pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, filename) - pkg.GoFiles = append(pkg.GoFiles, filename) - pkg.Errors = append(pkg.Errors[:i], pkg.Errors[i+1:]...) - } - } - } - // A final attempt to construct an ad-hoc package. - if len(dirResponse.Packages) == 1 && len(dirResponse.Packages[0].Errors) == 1 { + dirResponse, err := state.createDriverResponse(pattern) + + // If there was an error loading the package, or the package is returned + // with errors, try to load the file as an ad-hoc package. + // Usually the error will appear in a returned package, but may not if we're + // in module mode and the ad-hoc is located outside a module. + if err != nil || len(dirResponse.Packages) == 1 && len(dirResponse.Packages[0].GoFiles) == 0 && + len(dirResponse.Packages[0].Errors) == 1 { var queryErr error - if dirResponse, queryErr = adHocPackage(cfg, driver, pattern, query); queryErr != nil { + if dirResponse, queryErr = state.adhocPackage(pattern, query); queryErr != nil { return err // return the original error } } @@ -347,377 +339,83 @@ func runContainsQueries(cfg *Config, driver driver, response *responseDeduper, q return nil } -// adHocPackage attempts to construct an ad-hoc package given a query that failed. -func adHocPackage(cfg *Config, driver driver, pattern, query string) (*driverResponse, error) { - // There was an error loading the package. Try to load the file as an ad-hoc package. - // Usually the error will appear in a returned package, but may not if we're in modules mode - // and the ad-hoc is located outside a module. - dirResponse, err := driver(cfg, query) +// adhocPackage attempts to load or construct an ad-hoc package for a given +// query, if the original call to the driver produced inadequate results. +func (state *golistState) adhocPackage(pattern, query string) (*driverResponse, error) { + response, err := state.createDriverResponse(query) if err != nil { return nil, err } - // If we get nothing back from `go list`, try to make this file into its own ad-hoc package. - if len(dirResponse.Packages) == 0 && err == nil { - dirResponse.Packages = append(dirResponse.Packages, &Package{ + // If we get nothing back from `go list`, + // try to make this file into its own ad-hoc package. + // TODO(rstambler): Should this check against the original response? + if len(response.Packages) == 0 { + response.Packages = append(response.Packages, &Package{ ID: "command-line-arguments", PkgPath: query, GoFiles: []string{query}, CompiledGoFiles: []string{query}, Imports: make(map[string]*Package), }) - dirResponse.Roots = append(dirResponse.Roots, "command-line-arguments") + response.Roots = append(response.Roots, "command-line-arguments") } - // Special case to handle issue #33482: - // If this is a file= query for ad-hoc packages where the file only exists on an overlay, - // and exists outside of a module, add the file in for the package. - if len(dirResponse.Packages) == 1 && (dirResponse.Packages[0].ID == "command-line-arguments" || - filepath.ToSlash(dirResponse.Packages[0].PkgPath) == filepath.ToSlash(query)) { - if len(dirResponse.Packages[0].GoFiles) == 0 { - filename := filepath.Join(pattern, filepath.Base(query)) // avoid recomputing abspath - // TODO(matloob): check if the file is outside of a root dir? - for path := range cfg.Overlay { - if path == filename { - dirResponse.Packages[0].Errors = nil - dirResponse.Packages[0].GoFiles = []string{path} - dirResponse.Packages[0].CompiledGoFiles = []string{path} + // Handle special cases. + if len(response.Packages) == 1 { + // golang/go#33482: If this is a file= query for ad-hoc packages where + // the file only exists on an overlay, and exists outside of a module, + // add the file to the package and remove the errors. + if response.Packages[0].ID == "command-line-arguments" || + filepath.ToSlash(response.Packages[0].PkgPath) == filepath.ToSlash(query) { + if len(response.Packages[0].GoFiles) == 0 { + filename := filepath.Join(pattern, filepath.Base(query)) // avoid recomputing abspath + // TODO(matloob): check if the file is outside of a root dir? + for path := range state.cfg.Overlay { + if path == filename { + response.Packages[0].Errors = nil + response.Packages[0].GoFiles = []string{path} + response.Packages[0].CompiledGoFiles = []string{path} + } } } } } - return dirResponse, nil -} - -func contains(files []string, filename string) bool { - for _, f := range files { - if f == filename { - return true - } - } - return false -} - -// errorSpan attempts to parse a standard `go list` error message -// by stripping off the trailing error message. -// -// It works only on errors whose message is prefixed by colon, -// followed by a space (": "). For example: -// -// attributes.go:13:1: expected 'package', found 'type' -// -func errorSpan(err Error) span.Span { - if err.Pos == "" { - input := strings.TrimSpace(err.Msg) - msgIndex := strings.Index(input, ": ") - if msgIndex < 0 { - return span.Parse(input) - } - return span.Parse(input[:msgIndex]) - } - return span.Parse(err.Pos) -} - -// modCacheRegexp splits a path in a module cache into module, module version, and package. -var modCacheRegexp = regexp.MustCompile(`(.*)@([^/\\]*)(.*)`) - -func runNamedQueries(cfg *Config, driver driver, response *responseDeduper, queries []string) error { - // calling `go env` isn't free; bail out if there's nothing to do. - if len(queries) == 0 { - return nil - } - // Determine which directories are relevant to scan. - roots, modRoot, err := roots(cfg) - if err != nil { - return err - } - - // Scan the selected directories. Simple matches, from GOPATH/GOROOT - // or the local module, can simply be "go list"ed. Matches from the - // module cache need special treatment. - var matchesMu sync.Mutex - var simpleMatches, modCacheMatches []string - add := func(root gopathwalk.Root, dir string) { - // Walk calls this concurrently; protect the result slices. - matchesMu.Lock() - defer matchesMu.Unlock() - - path := dir - if dir != root.Path { - path = dir[len(root.Path)+1:] - } - if pathMatchesQueries(path, queries) { - switch root.Type { - case gopathwalk.RootModuleCache: - modCacheMatches = append(modCacheMatches, path) - case gopathwalk.RootCurrentModule: - // We'd need to read go.mod to find the full - // import path. Relative's easier. - rel, err := filepath.Rel(cfg.Dir, dir) - if err != nil { - // This ought to be impossible, since - // we found dir in the current module. - panic(err) - } - simpleMatches = append(simpleMatches, "./"+rel) - case gopathwalk.RootGOPATH, gopathwalk.RootGOROOT: - simpleMatches = append(simpleMatches, path) - } - } - } - - startWalk := time.Now() - gopathwalk.Walk(roots, add, gopathwalk.Options{ModulesEnabled: modRoot != "", Debug: debug}) - cfg.Logf("%v for walk", time.Since(startWalk)) - - // Weird special case: the top-level package in a module will be in - // whatever directory the user checked the repository out into. It's - // more reasonable for that to not match the package name. So, if there - // are any Go files in the mod root, query it just to be safe. - if modRoot != "" { - rel, err := filepath.Rel(cfg.Dir, modRoot) - if err != nil { - panic(err) // See above. - } - - files, err := ioutil.ReadDir(modRoot) - if err != nil { - panic(err) // See above. - } - - for _, f := range files { - if strings.HasSuffix(f.Name(), ".go") { - simpleMatches = append(simpleMatches, rel) - break - } - } - } - - addResponse := func(r *driverResponse) { - for _, pkg := range r.Packages { - response.addPackage(pkg) - for _, name := range queries { - if pkg.Name == name { - response.addRoot(pkg.ID) - break - } - } - } - } - - if len(simpleMatches) != 0 { - resp, err := driver(cfg, simpleMatches...) - if err != nil { - return err - } - addResponse(resp) - } - - // Module cache matches are tricky. We want to avoid downloading new - // versions of things, so we need to use the ones present in the cache. - // go list doesn't accept version specifiers, so we have to write out a - // temporary module, and do the list in that module. - if len(modCacheMatches) != 0 { - // Collect all the matches, deduplicating by major version - // and preferring the newest. - type modInfo struct { - mod string - major string - } - mods := make(map[modInfo]string) - var imports []string - for _, modPath := range modCacheMatches { - matches := modCacheRegexp.FindStringSubmatch(modPath) - mod, ver := filepath.ToSlash(matches[1]), matches[2] - importPath := filepath.ToSlash(filepath.Join(matches[1], matches[3])) - - major := semver.Major(ver) - if prevVer, ok := mods[modInfo{mod, major}]; !ok || semver.Compare(ver, prevVer) > 0 { - mods[modInfo{mod, major}] = ver - } - - imports = append(imports, importPath) - } - - // Build the temporary module. - var gomod bytes.Buffer - gomod.WriteString("module modquery\nrequire (\n") - for mod, version := range mods { - gomod.WriteString("\t" + mod.mod + " " + version + "\n") - } - gomod.WriteString(")\n") - - tmpCfg := *cfg - - // We're only trying to look at stuff in the module cache, so - // disable the network. This should speed things up, and has - // prevented errors in at least one case, #28518. - tmpCfg.Env = append([]string{"GOPROXY=off"}, cfg.Env...) - - var err error - tmpCfg.Dir, err = ioutil.TempDir("", "gopackages-modquery") - if err != nil { - return err - } - defer os.RemoveAll(tmpCfg.Dir) - - if err := ioutil.WriteFile(filepath.Join(tmpCfg.Dir, "go.mod"), gomod.Bytes(), 0777); err != nil { - return fmt.Errorf("writing go.mod for module cache query: %v", err) - } - - // Run the query, using the import paths calculated from the matches above. - resp, err := driver(&tmpCfg, imports...) - if err != nil { - return fmt.Errorf("querying module cache matches: %v", err) - } - addResponse(resp) - } - - return nil -} - -func getSizes(cfg *Config) (types.Sizes, error) { - return packagesdriver.GetSizesGolist(cfg.Context, cfg.BuildFlags, cfg.Env, cfg.Dir, usesExportData(cfg)) -} - -// roots selects the appropriate paths to walk based on the passed-in configuration, -// particularly the environment and the presence of a go.mod in cfg.Dir's parents. -func roots(cfg *Config) ([]gopathwalk.Root, string, error) { - stdout, err := invokeGo(cfg, "env", "GOROOT", "GOPATH", "GOMOD") - if err != nil { - return nil, "", err - } - - fields := strings.Split(stdout.String(), "\n") - if len(fields) != 4 || len(fields[3]) != 0 { - return nil, "", fmt.Errorf("go env returned unexpected output: %q", stdout.String()) - } - goroot, gopath, gomod := fields[0], filepath.SplitList(fields[1]), fields[2] - var modDir string - if gomod != "" { - modDir = filepath.Dir(gomod) - } - - var roots []gopathwalk.Root - // Always add GOROOT. - roots = append(roots, gopathwalk.Root{ - Path: filepath.Join(goroot, "/src"), - Type: gopathwalk.RootGOROOT, - }) - // If modules are enabled, scan the module dir. - if modDir != "" { - roots = append(roots, gopathwalk.Root{ - Path: modDir, - Type: gopathwalk.RootCurrentModule, - }) - } - // Add either GOPATH/src or GOPATH/pkg/mod, depending on module mode. - for _, p := range gopath { - if modDir != "" { - roots = append(roots, gopathwalk.Root{ - Path: filepath.Join(p, "/pkg/mod"), - Type: gopathwalk.RootModuleCache, - }) - } else { - roots = append(roots, gopathwalk.Root{ - Path: filepath.Join(p, "/src"), - Type: gopathwalk.RootGOPATH, - }) - } - } - - return roots, modDir, nil -} - -// These functions were copied from goimports. See further documentation there. - -// pathMatchesQueries is adapted from pkgIsCandidate. -// TODO: is it reasonable to do Contains here, rather than an exact match on a path component? -func pathMatchesQueries(path string, queries []string) bool { - lastTwo := lastTwoComponents(path) - for _, query := range queries { - if strings.Contains(lastTwo, query) { - return true - } - if hasHyphenOrUpperASCII(lastTwo) && !hasHyphenOrUpperASCII(query) { - lastTwo = lowerASCIIAndRemoveHyphen(lastTwo) - if strings.Contains(lastTwo, query) { - return true - } - } - } - return false -} - -// lastTwoComponents returns at most the last two path components -// of v, using either / or \ as the path separator. -func lastTwoComponents(v string) string { - nslash := 0 - for i := len(v) - 1; i >= 0; i-- { - if v[i] == '/' || v[i] == '\\' { - nslash++ - if nslash == 2 { - return v[i:] - } - } - } - return v -} - -func hasHyphenOrUpperASCII(s string) bool { - for i := 0; i < len(s); i++ { - b := s[i] - if b == '-' || ('A' <= b && b <= 'Z') { - return true - } - } - return false -} - -func lowerASCIIAndRemoveHyphen(s string) (ret string) { - buf := make([]byte, 0, len(s)) - for i := 0; i < len(s); i++ { - b := s[i] - switch { - case b == '-': - continue - case 'A' <= b && b <= 'Z': - buf = append(buf, b+('a'-'A')) - default: - buf = append(buf, b) - } - } - return string(buf) + return response, nil } // Fields must match go list; // see $GOROOT/src/cmd/go/internal/load/pkg.go. type jsonPackage struct { - ImportPath string - Dir string - Name string - Export string - GoFiles []string - CompiledGoFiles []string - CFiles []string - CgoFiles []string - CXXFiles []string - MFiles []string - HFiles []string - FFiles []string - SFiles []string - SwigFiles []string - SwigCXXFiles []string - SysoFiles []string - Imports []string - ImportMap map[string]string - Deps []string - TestGoFiles []string - TestImports []string - XTestGoFiles []string - XTestImports []string - ForTest string // q in a "p [q.test]" package, else "" - DepOnly bool - - Error *jsonPackageError + ImportPath string + Dir string + Name string + Export string + GoFiles []string + CompiledGoFiles []string + IgnoredGoFiles []string + IgnoredOtherFiles []string + CFiles []string + CgoFiles []string + CXXFiles []string + MFiles []string + HFiles []string + FFiles []string + SFiles []string + SwigFiles []string + SwigCXXFiles []string + SysoFiles []string + Imports []string + ImportMap map[string]string + Deps []string + Module *Module + TestGoFiles []string + TestImports []string + XTestGoFiles []string + XTestImports []string + ForTest string // q in a "p [q.test]" package, else "" + DepOnly bool + + Error *packagesinternal.PackageError + DepsErrors []*packagesinternal.PackageError } type jsonPackageError struct { @@ -730,10 +428,9 @@ func otherFiles(p *jsonPackage) [][]string { return [][]string{p.CFiles, p.CXXFiles, p.MFiles, p.HFiles, p.FFiles, p.SFiles, p.SwigFiles, p.SwigCXXFiles, p.SysoFiles} } -// golistDriver uses the "go list" command to expand the pattern -// words and return metadata for the specified packages. dir may be -// "" and env may be nil, as per os/exec.Command. -func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driverResponse, error) { +// createDriverResponse uses the "go list" command to expand the pattern +// words and return a response for the specified packages. +func (state *golistState) createDriverResponse(words ...string) (*driverResponse, error) { // go list uses the following identifiers in ImportPath and Imports: // // "p" -- importable package or main (command) @@ -747,11 +444,13 @@ func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driv // Run "go list" for complete // information on the specified packages. - buf, err := invokeGo(cfg, golistargs(cfg, words)...) + buf, err := state.invokeGo("list", golistargs(state.cfg, words)...) if err != nil { return nil, err } seen := make(map[string]*jsonPackage) + pkgs := make(map[string]*Package) + additionalErrors := make(map[string][]Error) // Decode the JSON and convert it to Package form. var response driverResponse for dec := json.NewDecoder(buf); dec.More(); { @@ -782,18 +481,81 @@ func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driv // contained in a known module or GOPATH entry. This will allow the package to be // properly "reclaimed" when overlays are processed. if filepath.IsAbs(p.ImportPath) && p.Error != nil { - pkgPath, ok := getPkgPath(cfg, p.ImportPath, rootsDirs) + pkgPath, ok, err := state.getPkgPath(p.ImportPath) + if err != nil { + return nil, err + } if ok { p.ImportPath = pkgPath } } if old, found := seen[p.ImportPath]; found { - if !reflect.DeepEqual(p, old) { - return nil, fmt.Errorf("internal error: go list gives conflicting information for package %v", p.ImportPath) + // If one version of the package has an error, and the other doesn't, assume + // that this is a case where go list is reporting a fake dependency variant + // of the imported package: When a package tries to invalidly import another + // package, go list emits a variant of the imported package (with the same + // import path, but with an error on it, and the package will have a + // DepError set on it). An example of when this can happen is for imports of + // main packages: main packages can not be imported, but they may be + // separately matched and listed by another pattern. + // See golang.org/issue/36188 for more details. + + // The plan is that eventually, hopefully in Go 1.15, the error will be + // reported on the importing package rather than the duplicate "fake" + // version of the imported package. Once all supported versions of Go + // have the new behavior this logic can be deleted. + // TODO(matloob): delete the workaround logic once all supported versions of + // Go return the errors on the proper package. + + // There should be exactly one version of a package that doesn't have an + // error. + if old.Error == nil && p.Error == nil { + if !reflect.DeepEqual(p, old) { + return nil, fmt.Errorf("internal error: go list gives conflicting information for package %v", p.ImportPath) + } + continue } - // skip the duplicate - continue + + // Determine if this package's error needs to be bubbled up. + // This is a hack, and we expect for go list to eventually set the error + // on the package. + if old.Error != nil { + var errkind string + if strings.Contains(old.Error.Err, "not an importable package") { + errkind = "not an importable package" + } else if strings.Contains(old.Error.Err, "use of internal package") && strings.Contains(old.Error.Err, "not allowed") { + errkind = "use of internal package not allowed" + } + if errkind != "" { + if len(old.Error.ImportStack) < 1 { + return nil, fmt.Errorf(`internal error: go list gave a %q error with empty import stack`, errkind) + } + importingPkg := old.Error.ImportStack[len(old.Error.ImportStack)-1] + if importingPkg == old.ImportPath { + // Using an older version of Go which put this package itself on top of import + // stack, instead of the importer. Look for importer in second from top + // position. + if len(old.Error.ImportStack) < 2 { + return nil, fmt.Errorf(`internal error: go list gave a %q error with an import stack without importing package`, errkind) + } + importingPkg = old.Error.ImportStack[len(old.Error.ImportStack)-2] + } + additionalErrors[importingPkg] = append(additionalErrors[importingPkg], Error{ + Pos: old.Error.Pos, + Msg: old.Error.Err, + Kind: ListError, + }) + } + } + + // Make sure that if there's a version of the package without an error, + // that's the one reported to the user. + if old.Error == nil { + continue + } + + // This package will replace the old one at the end of the loop. } seen[p.ImportPath] = p @@ -803,6 +565,29 @@ func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driv GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles), CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles), OtherFiles: absJoin(p.Dir, otherFiles(p)...), + IgnoredFiles: absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles), + forTest: p.ForTest, + depsErrors: p.DepsErrors, + Module: p.Module, + } + + if (state.cfg.Mode&typecheckCgo) != 0 && len(p.CgoFiles) != 0 { + if len(p.CompiledGoFiles) > len(p.GoFiles) { + // We need the cgo definitions, which are in the first + // CompiledGoFile after the non-cgo ones. This is a hack but there + // isn't currently a better way to find it. We also need the pure + // Go files and unprocessed cgo files, all of which are already + // in pkg.GoFiles. + cgoTypes := p.CompiledGoFiles[len(p.GoFiles)] + pkg.CompiledGoFiles = append([]string{cgoTypes}, pkg.GoFiles...) + } else { + // golang/go#38990: go list silently fails to do cgo processing + pkg.CompiledGoFiles = nil + pkg.Errors = append(pkg.Errors, Error{ + Msg: "go list failed to return CompiledGoFiles. This may indicate failure to perform cgo processing; try building at the command line. See https://golang.org/issue/38990.", + Kind: ListError, + }) + } } // Work around https://golang.org/issue/28749: @@ -878,36 +663,114 @@ func golistDriver(cfg *Config, rootsDirs func() *goInfo, words ...string) (*driv pkg.CompiledGoFiles = pkg.GoFiles } + // Temporary work-around for golang/go#39986. Parse filenames out of + // error messages. This happens if there are unrecoverable syntax + // errors in the source, so we can't match on a specific error message. + if err := p.Error; err != nil && state.shouldAddFilenameFromError(p) { + addFilenameFromPos := func(pos string) bool { + split := strings.Split(pos, ":") + if len(split) < 1 { + return false + } + filename := strings.TrimSpace(split[0]) + if filename == "" { + return false + } + if !filepath.IsAbs(filename) { + filename = filepath.Join(state.cfg.Dir, filename) + } + info, _ := os.Stat(filename) + if info == nil { + return false + } + pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, filename) + pkg.GoFiles = append(pkg.GoFiles, filename) + return true + } + found := addFilenameFromPos(err.Pos) + // In some cases, go list only reports the error position in the + // error text, not the error position. One such case is when the + // file's package name is a keyword (see golang.org/issue/39763). + if !found { + addFilenameFromPos(err.Err) + } + } + if p.Error != nil { + msg := strings.TrimSpace(p.Error.Err) // Trim to work around golang.org/issue/32363. + // Address golang.org/issue/35964 by appending import stack to error message. + if msg == "import cycle not allowed" && len(p.Error.ImportStack) != 0 { + msg += fmt.Sprintf(": import stack: %v", p.Error.ImportStack) + } pkg.Errors = append(pkg.Errors, Error{ - Pos: p.Error.Pos, - Msg: strings.TrimSpace(p.Error.Err), // Trim to work around golang.org/issue/32363. + Pos: p.Error.Pos, + Msg: msg, + Kind: ListError, }) } + pkgs[pkg.ID] = pkg + } + + for id, errs := range additionalErrors { + if p, ok := pkgs[id]; ok { + p.Errors = append(p.Errors, errs...) + } + } + for _, pkg := range pkgs { response.Packages = append(response.Packages, pkg) } + sort.Slice(response.Packages, func(i, j int) bool { return response.Packages[i].ID < response.Packages[j].ID }) return &response, nil } -// getPkgPath finds the package path of a directory if it's relative to a root directory. -func getPkgPath(cfg *Config, dir string, goInfo func() *goInfo) (string, bool) { +func (state *golistState) shouldAddFilenameFromError(p *jsonPackage) bool { + if len(p.GoFiles) > 0 || len(p.CompiledGoFiles) > 0 { + return false + } + + goV, err := state.getGoVersion() + if err != nil { + return false + } + + // On Go 1.14 and earlier, only add filenames from errors if the import stack is empty. + // The import stack behaves differently for these versions than newer Go versions. + if goV < 15 { + return len(p.Error.ImportStack) == 0 + } + + // On Go 1.15 and later, only parse filenames out of error if there's no import stack, + // or the current package is at the top of the import stack. This is not guaranteed + // to work perfectly, but should avoid some cases where files in errors don't belong to this + // package. + return len(p.Error.ImportStack) == 0 || p.Error.ImportStack[len(p.Error.ImportStack)-1] == p.ImportPath +} + +func (state *golistState) getGoVersion() (int, error) { + state.goVersionOnce.Do(func() { + state.goVersion, state.goVersionError = gocommand.GoVersion(state.ctx, state.cfgInvocation(), state.cfg.gocmdRunner) + }) + return state.goVersion, state.goVersionError +} + +// getPkgPath finds the package path of a directory if it's relative to a root +// directory. +func (state *golistState) getPkgPath(dir string) (string, bool, error) { absDir, err := filepath.Abs(dir) if err != nil { - cfg.Logf("error getting absolute path of %s: %v", dir, err) - return "", false + return "", false, err } - for rdir, rpath := range goInfo().rootDirs { - absRdir, err := filepath.Abs(rdir) - if err != nil { - cfg.Logf("error getting absolute path of %s: %v", rdir, err) - continue - } + roots, err := state.determineRootDirs() + if err != nil { + return "", false, err + } + + for rdir, rpath := range roots { // Make sure that the directory is in the module, // to avoid creating a path relative to another module. - if !strings.HasPrefix(absDir, absRdir) { - cfg.Logf("%s does not have prefix %s", absDir, absRdir) + if !strings.HasPrefix(absDir, rdir) { continue } // TODO(matloob): This doesn't properly handle symlinks. @@ -922,11 +785,11 @@ func getPkgPath(cfg *Config, dir string, goInfo func() *goInfo) (string, bool) { // Once the file is saved, gopls, or the next invocation of the tool will get the correct // result straight from golist. // TODO(matloob): Implement module tiebreaking? - return path.Join(rpath, filepath.ToSlash(r)), true + return path.Join(rpath, filepath.ToSlash(r)), true, nil } - return filepath.ToSlash(r), true + return filepath.ToSlash(r), true, nil } - return "", false + return "", false, nil } // absJoin absolutizes and flattens the lists of files. @@ -945,8 +808,8 @@ func absJoin(dir string, fileses ...[]string) (res []string) { func golistargs(cfg *Config, words []string) []string { const findFlags = NeedImports | NeedTypes | NeedSyntax | NeedTypesInfo fullargs := []string{ - "list", "-e", "-json", - fmt.Sprintf("-compiled=%t", cfg.Mode&(NeedCompiledGoFiles|NeedSyntax|NeedTypesInfo|NeedTypesSizes) != 0), + "-e", "-json", + fmt.Sprintf("-compiled=%t", cfg.Mode&(NeedCompiledGoFiles|NeedSyntax|NeedTypes|NeedTypesInfo|NeedTypesSizes) != 0), fmt.Sprintf("-test=%t", cfg.Tests), fmt.Sprintf("-export=%t", usesExportData(cfg)), fmt.Sprintf("-deps=%t", cfg.Mode&NeedImports != 0), @@ -960,26 +823,53 @@ func golistargs(cfg *Config, words []string) []string { return fullargs } +// cfgInvocation returns an Invocation that reflects cfg's settings. +func (state *golistState) cfgInvocation() gocommand.Invocation { + cfg := state.cfg + return gocommand.Invocation{ + BuildFlags: cfg.BuildFlags, + ModFile: cfg.modFile, + ModFlag: cfg.modFlag, + CleanEnv: cfg.Env != nil, + Env: cfg.Env, + Logf: cfg.Logf, + WorkingDir: cfg.Dir, + } +} + // invokeGo returns the stdout of a go command invocation. -func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { - stdout := new(bytes.Buffer) - stderr := new(bytes.Buffer) - cmd := exec.CommandContext(cfg.Context, "go", args...) - // On darwin the cwd gets resolved to the real path, which breaks anything that - // expects the working directory to keep the original path, including the - // go command when dealing with modules. - // The Go stdlib has a special feature where if the cwd and the PWD are the - // same node then it trusts the PWD, so by setting it in the env for the child - // process we fix up all the paths returned by the go command. - cmd.Env = append(append([]string{}, cfg.Env...), "PWD="+cfg.Dir) - cmd.Dir = cfg.Dir - cmd.Stdout = stdout - cmd.Stderr = stderr - defer func(start time.Time) { - cfg.Logf("%s for %v, stderr: <<%s>> stdout: <<%s>>\n", time.Since(start), cmdDebugStr(cmd, args...), stderr, stdout) - }(time.Now()) - - if err := cmd.Run(); err != nil { +func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, error) { + cfg := state.cfg + + inv := state.cfgInvocation() + + // For Go versions 1.16 and above, `go list` accepts overlays directly via + // the -overlay flag. Set it, if it's available. + // + // The check for "list" is not necessarily required, but we should avoid + // getting the go version if possible. + if verb == "list" { + goVersion, err := state.getGoVersion() + if err != nil { + return nil, err + } + if goVersion >= 16 { + filename, cleanup, err := state.writeOverlays() + if err != nil { + return nil, err + } + defer cleanup() + inv.Overlay = filename + } + } + inv.Verb = verb + inv.Args = args + gocmdRunner := cfg.gocmdRunner + if gocmdRunner == nil { + gocmdRunner = &gocommand.Runner{} + } + stdout, stderr, friendlyErr, err := gocmdRunner.RunRaw(cfg.Context, inv) + if err != nil { // Check for 'go' executable not being found. if ee, ok := err.(*exec.Error); ok && ee.Err == exec.ErrNotFound { return nil, fmt.Errorf("'go list' driver requires 'go', but %s", exec.ErrNotFound) @@ -989,7 +879,7 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { if !ok { // Catastrophic error: // - context cancellation - return nil, fmt.Errorf("couldn't exec 'go %v': %s %T", args, err, err) + return nil, xerrors.Errorf("couldn't run 'go': %w", err) } // Old go version? @@ -999,7 +889,7 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { // Related to #24854 if len(stderr.String()) > 0 && strings.Contains(stderr.String(), "unexpected directory layout") { - return nil, fmt.Errorf("%s", stderr.String()) + return nil, friendlyErr } // Is there an error running the C compiler in cgo? This will be reported in the "Error" field @@ -1015,8 +905,18 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { return unicode.IsOneOf([]*unicode.RangeTable{unicode.L, unicode.M, unicode.N, unicode.P, unicode.S}, r) && !strings.ContainsRune("!\"#$%&'()*,:;<=>?[\\]^`{|}\uFFFD", r) } + // golang/go#36770: Handle case where cmd/go prints module download messages before the error. + msg := stderr.String() + for strings.HasPrefix(msg, "go: downloading") { + msg = msg[strings.IndexRune(msg, '\n')+1:] + } if len(stderr.String()) > 0 && strings.HasPrefix(stderr.String(), "# ") { - if strings.HasPrefix(strings.TrimLeftFunc(stderr.String()[len("# "):], isPkgPathRune), "\n") { + msg := msg[len("# "):] + if strings.HasPrefix(strings.TrimLeftFunc(msg, isPkgPathRune), "\n") { + return stdout, nil + } + // Treat pkg-config errors as a special case (golang.org/issue/36770). + if strings.HasPrefix(msg, "pkg-config") { return stdout, nil } } @@ -1102,20 +1002,71 @@ func invokeGo(cfg *Config, args ...string) (*bytes.Buffer, error) { // TODO(matloob): Remove these once we can depend on go list to exit with a zero status with -e even when // packages don't exist or a build fails. if !usesExportData(cfg) && !containsGoFile(args) { - return nil, fmt.Errorf("go %v: %s: %s", args, exitErr, stderr) + return nil, friendlyErr } } + return stdout, nil +} + +// OverlayJSON is the format overlay files are expected to be in. +// The Replace map maps from overlaid paths to replacement paths: +// the Go command will forward all reads trying to open +// each overlaid path to its replacement path, or consider the overlaid +// path not to exist if the replacement path is empty. +// +// From golang/go#39958. +type OverlayJSON struct { + Replace map[string]string `json:"replace,omitempty"` +} - // As of writing, go list -export prints some non-fatal compilation - // errors to stderr, even with -e set. We would prefer that it put - // them in the Package.Error JSON (see https://golang.org/issue/26319). - // In the meantime, there's nowhere good to put them, but they can - // be useful for debugging. Print them if $GOPACKAGESPRINTGOLISTERRORS - // is set. - if len(stderr.Bytes()) != 0 && os.Getenv("GOPACKAGESPRINTGOLISTERRORS") != "" { - fmt.Fprintf(os.Stderr, "%s stderr: <<%s>>\n", cmdDebugStr(cmd, args...), stderr) +// writeOverlays writes out files for go list's -overlay flag, as described +// above. +func (state *golistState) writeOverlays() (filename string, cleanup func(), err error) { + // Do nothing if there are no overlays in the config. + if len(state.cfg.Overlay) == 0 { + return "", func() {}, nil } - return stdout, nil + dir, err := ioutil.TempDir("", "gopackages-*") + if err != nil { + return "", nil, err + } + // The caller must clean up this directory, unless this function returns an + // error. + cleanup = func() { + os.RemoveAll(dir) + } + defer func() { + if err != nil { + cleanup() + } + }() + overlays := map[string]string{} + for k, v := range state.cfg.Overlay { + // Create a unique filename for the overlaid files, to avoid + // creating nested directories. + noSeparator := strings.Join(strings.Split(filepath.ToSlash(k), "/"), "") + f, err := ioutil.TempFile(dir, fmt.Sprintf("*-%s", noSeparator)) + if err != nil { + return "", func() {}, err + } + if _, err := f.Write(v); err != nil { + return "", func() {}, err + } + if err := f.Close(); err != nil { + return "", func() {}, err + } + overlays[k] = f.Name() + } + b, err := json.Marshal(OverlayJSON{Replace: overlays}) + if err != nil { + return "", func() {}, err + } + // Write out the overlay file that contains the filepath mappings. + filename = filepath.Join(dir, "overlay.json") + if err := ioutil.WriteFile(filename, b, 0665); err != nil { + return "", func() {}, err + } + return filename, cleanup, nil } func containsGoFile(s []string) bool { @@ -1127,17 +1078,22 @@ func containsGoFile(s []string) bool { return false } -func cmdDebugStr(cmd *exec.Cmd, args ...string) string { +func cmdDebugStr(cmd *exec.Cmd) string { env := make(map[string]string) for _, kv := range cmd.Env { - split := strings.Split(kv, "=") + split := strings.SplitN(kv, "=", 2) k, v := split[0], split[1] env[k] = v } - var quotedArgs []string - for _, arg := range args { - quotedArgs = append(quotedArgs, strconv.Quote(arg)) - } - return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v PWD=%v go %s", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["PWD"], strings.Join(quotedArgs, " ")) + var args []string + for _, arg := range cmd.Args { + quoted := strconv.Quote(arg) + if quoted[1:len(quoted)-1] != arg || strings.Contains(arg, " ") { + args = append(args, quoted) + } else { + args = append(args, arg) + } + } + return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v GOPROXY=%v PWD=%v %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["GOPROXY"], env["PWD"], strings.Join(args, " ")) } diff --git a/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/vendor/golang.org/x/tools/go/packages/golist_overlay.go index a7de62299d..9576b472f9 100644 --- a/vendor/golang.org/x/tools/go/packages/golist_overlay.go +++ b/vendor/golang.org/x/tools/go/packages/golist_overlay.go @@ -1,14 +1,22 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package packages import ( - "bytes" "encoding/json" "fmt" "go/parser" "go/token" + "os" "path/filepath" + "regexp" + "sort" "strconv" "strings" + + "golang.org/x/tools/internal/gocommand" ) // processGolistOverlay provides rudimentary support for adding @@ -16,15 +24,23 @@ import ( // sometimes incorrect. // TODO(matloob): Handle unsupported cases, including the following: // - determining the correct package to add given a new import path -func processGolistOverlay(cfg *Config, response *responseDeduper, rootDirs func() *goInfo) (modifiedPkgs, needPkgs []string, err error) { +func (state *golistState) processGolistOverlay(response *responseDeduper) (modifiedPkgs, needPkgs []string, err error) { havePkgs := make(map[string]string) // importPath -> non-test package ID needPkgsSet := make(map[string]bool) modifiedPkgsSet := make(map[string]bool) + pkgOfDir := make(map[string][]*Package) for _, pkg := range response.dr.Packages { // This is an approximation of import path to id. This can be // wrong for tests, vendored packages, and a number of other cases. havePkgs[pkg.PkgPath] = pkg.ID + dir, err := commonDir(pkg.GoFiles) + if err != nil { + return nil, nil, err + } + if dir != "" { + pkgOfDir[dir] = append(pkgOfDir[dir], pkg) + } } // If no new imports are added, it is safe to avoid loading any needPkgs. @@ -34,7 +50,23 @@ func processGolistOverlay(cfg *Config, response *responseDeduper, rootDirs func( // potentially modifying the transitive set of dependencies). var overlayAddsImports bool - for opath, contents := range cfg.Overlay { + // If both a package and its test package are created by the overlay, we + // need the real package first. Process all non-test files before test + // files, and make the whole process deterministic while we're at it. + var overlayFiles []string + for opath := range state.cfg.Overlay { + overlayFiles = append(overlayFiles, opath) + } + sort.Slice(overlayFiles, func(i, j int) bool { + iTest := strings.HasSuffix(overlayFiles[i], "_test.go") + jTest := strings.HasSuffix(overlayFiles[j], "_test.go") + if iTest != jTest { + return !iTest // non-tests are before tests. + } + return overlayFiles[i] < overlayFiles[j] + }) + for _, opath := range overlayFiles { + contents := state.cfg.Overlay[opath] base := filepath.Base(opath) dir := filepath.Dir(opath) var pkg *Package // if opath belongs to both a package and its test variant, this will be the test variant @@ -47,6 +79,9 @@ func processGolistOverlay(cfg *Config, response *responseDeduper, rootDirs func( // to the overlay. continue } + // If all the overlay files belong to a different package, change the + // package name to that package. + maybeFixPackageName(pkgName, isTestFile, pkgOfDir[dir]) nextPackage: for _, p := range response.dr.Packages { if pkgName != p.Name && p.ID != "command-line-arguments" { @@ -63,15 +98,19 @@ func processGolistOverlay(cfg *Config, response *responseDeduper, rootDirs func( // because the file is generated in another directory. testVariantOf = p continue nextPackage + } else if !isTestFile && hasTestFiles(p) { + // We're examining a test variant, but the overlaid file is + // a non-test file. Because the overlay implementation + // (currently) only adds a file to one package, skip this + // package, so that we can add the file to the production + // variant of the package. (https://golang.org/issue/36857 + // tracks handling overlays on both the production and test + // variant of a package). + continue nextPackage } if pkg != nil && p != pkg && pkg.PkgPath == p.PkgPath { - // If we've already seen the test variant, - // make sure to label which package it is a test variant of. - if hasTestFiles(pkg) { - testVariantOf = p - continue nextPackage - } - // If we have already seen the package of which this is a test variant. + // We have already seen the production version of the + // for which p is a test variant. if hasTestFiles(p) { testVariantOf = pkg } @@ -82,38 +121,68 @@ func processGolistOverlay(cfg *Config, response *responseDeduper, rootDirs func( } } } - // The overlay could have included an entirely new package. - if pkg == nil { + // The overlay could have included an entirely new package or an + // ad-hoc package. An ad-hoc package is one that we have manually + // constructed from inadequate `go list` results for a file= query. + // It will have the ID command-line-arguments. + if pkg == nil || pkg.ID == "command-line-arguments" { // Try to find the module or gopath dir the file is contained in. // Then for modules, add the module opath to the beginning. - pkgPath, ok := getPkgPath(cfg, dir, rootDirs) + pkgPath, ok, err := state.getPkgPath(dir) + if err != nil { + return nil, nil, err + } if !ok { break } + var forTest string // only set for x tests isXTest := strings.HasSuffix(pkgName, "_test") if isXTest { + forTest = pkgPath pkgPath += "_test" } id := pkgPath - if isTestFile && !isXTest { - id = fmt.Sprintf("%s [%s.test]", pkgPath, pkgPath) - } - // Try to reclaim a package with the same id if it exists in the response. - for _, p := range response.dr.Packages { - if reclaimPackage(p, id, opath, contents) { - pkg = p - break + if isTestFile { + if isXTest { + id = fmt.Sprintf("%s [%s.test]", pkgPath, forTest) + } else { + id = fmt.Sprintf("%s [%s.test]", pkgPath, pkgPath) } } - // Otherwise, create a new package - if pkg == nil { - pkg = &Package{PkgPath: pkgPath, ID: id, Name: pkgName, Imports: make(map[string]*Package)} - response.addPackage(pkg) - havePkgs[pkg.PkgPath] = id - // Add the production package's sources for a test variant. - if isTestFile && !isXTest && testVariantOf != nil { - pkg.GoFiles = append(pkg.GoFiles, testVariantOf.GoFiles...) - pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, testVariantOf.CompiledGoFiles...) + if pkg != nil { + // TODO(rstambler): We should change the package's path and ID + // here. The only issue is that this messes with the roots. + } else { + // Try to reclaim a package with the same ID, if it exists in the response. + for _, p := range response.dr.Packages { + if reclaimPackage(p, id, opath, contents) { + pkg = p + break + } + } + // Otherwise, create a new package. + if pkg == nil { + pkg = &Package{ + PkgPath: pkgPath, + ID: id, + Name: pkgName, + Imports: make(map[string]*Package), + } + response.addPackage(pkg) + havePkgs[pkg.PkgPath] = id + // Add the production package's sources for a test variant. + if isTestFile && !isXTest && testVariantOf != nil { + pkg.GoFiles = append(pkg.GoFiles, testVariantOf.GoFiles...) + pkg.CompiledGoFiles = append(pkg.CompiledGoFiles, testVariantOf.CompiledGoFiles...) + // Add the package under test and its imports to the test variant. + pkg.forTest = testVariantOf.PkgPath + for k, v := range testVariantOf.Imports { + pkg.Imports[k] = &Package{ID: v.ID} + } + } + if isXTest { + pkg.forTest = forTest + } } } } @@ -130,42 +199,47 @@ func processGolistOverlay(cfg *Config, response *responseDeduper, rootDirs func( continue } for _, imp := range imports { - _, found := pkg.Imports[imp] - if !found { - overlayAddsImports = true - // TODO(matloob): Handle cases when the following block isn't correct. - // These include imports of vendored packages, etc. - id, ok := havePkgs[imp] - if !ok { - id = imp - } - pkg.Imports[imp] = &Package{ID: id} - // Add dependencies to the non-test variant version of this package as wel. - if testVariantOf != nil { - testVariantOf.Imports[imp] = &Package{ID: id} + // TODO(rstambler): If the package is an x test and the import has + // a test variant, make sure to replace it. + if _, found := pkg.Imports[imp]; found { + continue + } + overlayAddsImports = true + id, ok := havePkgs[imp] + if !ok { + var err error + id, err = state.resolveImport(dir, imp) + if err != nil { + return nil, nil, err } } + pkg.Imports[imp] = &Package{ID: id} + // Add dependencies to the non-test variant version of this package as well. + if testVariantOf != nil { + testVariantOf.Imports[imp] = &Package{ID: id} + } } - continue } - // toPkgPath tries to guess the package path given the id. - // This isn't always correct -- it's certainly wrong for - // vendored packages' paths. - toPkgPath := func(id string) string { - // TODO(matloob): Handle vendor paths. - i := strings.IndexByte(id, ' ') - if i >= 0 { - return id[:i] + // toPkgPath guesses the package path given the id. + toPkgPath := func(sourceDir, id string) (string, error) { + if i := strings.IndexByte(id, ' '); i >= 0 { + return state.resolveImport(sourceDir, id[:i]) } - return id + return state.resolveImport(sourceDir, id) } - // Do another pass now that new packages have been created to determine the - // set of missing packages. + // Now that new packages have been created, do another pass to determine + // the new set of missing packages. for _, pkg := range response.dr.Packages { for _, imp := range pkg.Imports { - pkgPath := toPkgPath(imp.ID) + if len(pkg.GoFiles) == 0 { + return nil, nil, fmt.Errorf("cannot resolve imports for package %q with no Go files", pkg.PkgPath) + } + pkgPath, err := toPkgPath(filepath.Dir(pkg.GoFiles[0]), imp.ID) + if err != nil { + return nil, nil, err + } if _, ok := havePkgs[pkgPath]; !ok { needPkgsSet[pkgPath] = true } @@ -185,6 +259,52 @@ func processGolistOverlay(cfg *Config, response *responseDeduper, rootDirs func( return modifiedPkgs, needPkgs, err } +// resolveImport finds the ID of a package given its import path. +// In particular, it will find the right vendored copy when in GOPATH mode. +func (state *golistState) resolveImport(sourceDir, importPath string) (string, error) { + env, err := state.getEnv() + if err != nil { + return "", err + } + if env["GOMOD"] != "" { + return importPath, nil + } + + searchDir := sourceDir + for { + vendorDir := filepath.Join(searchDir, "vendor") + exists, ok := state.vendorDirs[vendorDir] + if !ok { + info, err := os.Stat(vendorDir) + exists = err == nil && info.IsDir() + state.vendorDirs[vendorDir] = exists + } + + if exists { + vendoredPath := filepath.Join(vendorDir, importPath) + if info, err := os.Stat(vendoredPath); err == nil && info.IsDir() { + // We should probably check for .go files here, but shame on anyone who fools us. + path, ok, err := state.getPkgPath(vendoredPath) + if err != nil { + return "", err + } + if ok { + return path, nil + } + } + } + + // We know we've hit the top of the filesystem when we Dir / and get /, + // or C:\ and get C:\, etc. + next := filepath.Dir(searchDir) + if next == searchDir { + break + } + searchDir = next + } + return importPath, nil +} + func hasTestFiles(p *Package) bool { for _, f := range p.GoFiles { if strings.HasSuffix(f, "_test.go") { @@ -194,44 +314,75 @@ func hasTestFiles(p *Package) bool { return false } -// determineRootDirs returns a mapping from directories code can be contained in to the -// corresponding import path prefixes of those directories. -// Its result is used to try to determine the import path for a package containing -// an overlay file. -func determineRootDirs(cfg *Config) map[string]string { - // Assume modules first: - out, err := invokeGo(cfg, "list", "-m", "-json", "all") +// determineRootDirs returns a mapping from absolute directories that could +// contain code to their corresponding import path prefixes. +func (state *golistState) determineRootDirs() (map[string]string, error) { + env, err := state.getEnv() if err != nil { - return determineRootDirsGOPATH(cfg) + return nil, err } - m := map[string]string{} - type jsonMod struct{ Path, Dir string } + if env["GOMOD"] != "" { + state.rootsOnce.Do(func() { + state.rootDirs, state.rootDirsError = state.determineRootDirsModules() + }) + } else { + state.rootsOnce.Do(func() { + state.rootDirs, state.rootDirsError = state.determineRootDirsGOPATH() + }) + } + return state.rootDirs, state.rootDirsError +} + +func (state *golistState) determineRootDirsModules() (map[string]string, error) { + // List all of the modules--the first will be the directory for the main + // module. Any replaced modules will also need to be treated as roots. + // Editing files in the module cache isn't a great idea, so we don't + // plan to ever support that. + out, err := state.invokeGo("list", "-m", "-json", "all") + if err != nil { + // 'go list all' will fail if we're outside of a module and + // GO111MODULE=on. Try falling back without 'all'. + var innerErr error + out, innerErr = state.invokeGo("list", "-m", "-json") + if innerErr != nil { + return nil, err + } + } + roots := map[string]string{} + modules := map[string]string{} + var i int for dec := json.NewDecoder(out); dec.More(); { - mod := new(jsonMod) + mod := new(gocommand.ModuleJSON) if err := dec.Decode(mod); err != nil { - return m // Give up and return an empty map. Package won't be found for overlay. + return nil, err } if mod.Dir != "" && mod.Path != "" { // This is a valid module; add it to the map. - m[mod.Dir] = mod.Path + absDir, err := filepath.Abs(mod.Dir) + if err != nil { + return nil, err + } + modules[absDir] = mod.Path + // The first result is the main module. + if i == 0 || mod.Replace != nil && mod.Replace.Path != "" { + roots[absDir] = mod.Path + } } + i++ } - return m + return roots, nil } -func determineRootDirsGOPATH(cfg *Config) map[string]string { +func (state *golistState) determineRootDirsGOPATH() (map[string]string, error) { m := map[string]string{} - out, err := invokeGo(cfg, "env", "GOPATH") - if err != nil { - // Could not determine root dir mapping. Everything is best-effort, so just return an empty map. - // When we try to find the import path for a directory, there will be no root-dir match and - // we'll give up. - return m - } - for _, p := range filepath.SplitList(string(bytes.TrimSpace(out.Bytes()))) { - m[filepath.Join(p, "src")] = "" + for _, dir := range filepath.SplitList(state.mustGetEnv()["GOPATH"]) { + absDir, err := filepath.Abs(dir) + if err != nil { + return nil, err + } + m[filepath.Join(absDir, "src")] = "" } - return m + return m, nil } func extractImports(filename string, contents []byte) ([]string, error) { @@ -291,3 +442,134 @@ func extractPackageName(filename string, contents []byte) (string, bool) { } return f.Name.Name, true } + +// commonDir returns the directory that all files are in, "" if files is empty, +// or an error if they aren't in the same directory. +func commonDir(files []string) (string, error) { + seen := make(map[string]bool) + for _, f := range files { + seen[filepath.Dir(f)] = true + } + if len(seen) > 1 { + return "", fmt.Errorf("files (%v) are in more than one directory: %v", files, seen) + } + for k := range seen { + // seen has only one element; return it. + return k, nil + } + return "", nil // no files +} + +// It is possible that the files in the disk directory dir have a different package +// name from newName, which is deduced from the overlays. If they all have a different +// package name, and they all have the same package name, then that name becomes +// the package name. +// It returns true if it changes the package name, false otherwise. +func maybeFixPackageName(newName string, isTestFile bool, pkgsOfDir []*Package) { + names := make(map[string]int) + for _, p := range pkgsOfDir { + names[p.Name]++ + } + if len(names) != 1 { + // some files are in different packages + return + } + var oldName string + for k := range names { + oldName = k + } + if newName == oldName { + return + } + // We might have a case where all of the package names in the directory are + // the same, but the overlay file is for an x test, which belongs to its + // own package. If the x test does not yet exist on disk, we may not yet + // have its package name on disk, but we should not rename the packages. + // + // We use a heuristic to determine if this file belongs to an x test: + // The test file should have a package name whose package name has a _test + // suffix or looks like "newName_test". + maybeXTest := strings.HasPrefix(oldName+"_test", newName) || strings.HasSuffix(newName, "_test") + if isTestFile && maybeXTest { + return + } + for _, p := range pkgsOfDir { + p.Name = newName + } +} + +// This function is copy-pasted from +// https://github.com/golang/go/blob/9706f510a5e2754595d716bd64be8375997311fb/src/cmd/go/internal/search/search.go#L360. +// It should be deleted when we remove support for overlays from go/packages. +// +// NOTE: This does not handle any ./... or ./ style queries, as this function +// doesn't know the working directory. +// +// matchPattern(pattern)(name) reports whether +// name matches pattern. Pattern is a limited glob +// pattern in which '...' means 'any string' and there +// is no other special syntax. +// Unfortunately, there are two special cases. Quoting "go help packages": +// +// First, /... at the end of the pattern can match an empty string, +// so that net/... matches both net and packages in its subdirectories, like net/http. +// Second, any slash-separated pattern element containing a wildcard never +// participates in a match of the "vendor" element in the path of a vendored +// package, so that ./... does not match packages in subdirectories of +// ./vendor or ./mycode/vendor, but ./vendor/... and ./mycode/vendor/... do. +// Note, however, that a directory named vendor that itself contains code +// is not a vendored package: cmd/vendor would be a command named vendor, +// and the pattern cmd/... matches it. +func matchPattern(pattern string) func(name string) bool { + // Convert pattern to regular expression. + // The strategy for the trailing /... is to nest it in an explicit ? expression. + // The strategy for the vendor exclusion is to change the unmatchable + // vendor strings to a disallowed code point (vendorChar) and to use + // "(anything but that codepoint)*" as the implementation of the ... wildcard. + // This is a bit complicated but the obvious alternative, + // namely a hand-written search like in most shell glob matchers, + // is too easy to make accidentally exponential. + // Using package regexp guarantees linear-time matching. + + const vendorChar = "\x00" + + if strings.Contains(pattern, vendorChar) { + return func(name string) bool { return false } + } + + re := regexp.QuoteMeta(pattern) + re = replaceVendor(re, vendorChar) + switch { + case strings.HasSuffix(re, `/`+vendorChar+`/\.\.\.`): + re = strings.TrimSuffix(re, `/`+vendorChar+`/\.\.\.`) + `(/vendor|/` + vendorChar + `/\.\.\.)` + case re == vendorChar+`/\.\.\.`: + re = `(/vendor|/` + vendorChar + `/\.\.\.)` + case strings.HasSuffix(re, `/\.\.\.`): + re = strings.TrimSuffix(re, `/\.\.\.`) + `(/\.\.\.)?` + } + re = strings.ReplaceAll(re, `\.\.\.`, `[^`+vendorChar+`]*`) + + reg := regexp.MustCompile(`^` + re + `$`) + + return func(name string) bool { + if strings.Contains(name, vendorChar) { + return false + } + return reg.MatchString(replaceVendor(name, vendorChar)) + } +} + +// replaceVendor returns the result of replacing +// non-trailing vendor path elements in x with repl. +func replaceVendor(x, repl string) string { + if !strings.Contains(x, "vendor") { + return x + } + elem := strings.Split(x, "/") + for i := 0; i < len(elem)-1; i++ { + if elem[i] == "vendor" { + elem[i] = repl + } + } + return strings.Join(elem, "/") +} diff --git a/vendor/golang.org/x/tools/go/packages/loadmode_string.go b/vendor/golang.org/x/tools/go/packages/loadmode_string.go index aff94a3fe9..7ea37e7eea 100644 --- a/vendor/golang.org/x/tools/go/packages/loadmode_string.go +++ b/vendor/golang.org/x/tools/go/packages/loadmode_string.go @@ -38,7 +38,7 @@ var modeStrings = []string{ func (mod LoadMode) String() string { m := mod if m == 0 { - return fmt.Sprintf("LoadMode(0)") + return "LoadMode(0)" } var out []string for i, x := range allModes { diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index 050cca43a2..d545b13758 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -21,8 +21,13 @@ import ( "path/filepath" "strings" "sync" + "time" "golang.org/x/tools/go/gcexportdata" + "golang.org/x/tools/internal/gocommand" + "golang.org/x/tools/internal/packagesinternal" + "golang.org/x/tools/internal/typeparams" + "golang.org/x/tools/internal/typesinternal" ) // A LoadMode controls the amount of detail to return when loading. @@ -34,6 +39,9 @@ import ( // Load may return more information than requested. type LoadMode int +// TODO(matloob): When a V2 of go/packages is released, rename NeedExportsFile to +// NeedExportFile to make it consistent with the Package field it's adding. + const ( // NeedName adds Name and PkgPath. NeedName LoadMode = 1 << iota @@ -51,7 +59,7 @@ const ( // NeedDeps adds the fields requested by the LoadMode in the packages in Imports. NeedDeps - // NeedExportsFile adds ExportsFile. + // NeedExportsFile adds ExportFile. NeedExportsFile // NeedTypes adds Types, Fset, and IllTyped. @@ -65,6 +73,13 @@ const ( // NeedTypesSizes adds TypesSizes. NeedTypesSizes + + // typecheckCgo enables full support for type checking cgo. Requires Go 1.15+. + // Modifies CompiledGoFiles and Types, and has no effect on its own. + typecheckCgo + + // NeedModule adds Module. + NeedModule ) const ( @@ -123,10 +138,19 @@ type Config struct { // Env []string + // gocmdRunner guards go command calls from concurrency errors. + gocmdRunner *gocommand.Runner + // BuildFlags is a list of command-line flags to be passed through to // the build system's query tool. BuildFlags []string + // modFile will be used for -modfile in go command invocations. + modFile string + + // modFlag will be used for -modfile in go command invocations. + modFlag string + // Fset provides source position information for syntax trees and types. // If Fset is nil, Load will use a new fileset, but preserve Fset's value. Fset *token.FileSet @@ -160,7 +184,7 @@ type Config struct { Tests bool // Overlay provides a mapping of absolute file paths to file contents. - // If the file with the given path already exists, the parser will use the + // If the file with the given path already exists, the parser will use the // alternative file contents provided by the map. // // Overlays provide incomplete support for when a given file doesn't @@ -174,6 +198,13 @@ type driver func(cfg *Config, patterns ...string) (*driverResponse, error) // driverResponse contains the results for a driver query. type driverResponse struct { + // NotHandled is returned if the request can't be handled by the current + // driver. If an external driver returns a response with NotHandled, the + // rest of the driverResponse is ignored, and go/packages will fallback + // to the next driver. If go/packages is extended in the future to support + // lists of multiple drivers, go/packages will fall back to the next driver. + NotHandled bool + // Sizes, if not nil, is the types.Sizes to use when type checking. Sizes *types.StdSizes @@ -215,14 +246,22 @@ func Load(cfg *Config, patterns ...string) ([]*Package, error) { return l.refine(response.Roots, response.Packages...) } -// defaultDriver is a driver that looks for an external driver binary, and if -// it does not find it falls back to the built in go list driver. +// defaultDriver is a driver that implements go/packages' fallback behavior. +// It will try to request to an external driver, if one exists. If there's +// no external driver, or the driver returns a response with NotHandled set, +// defaultDriver will fall back to the go list driver. func defaultDriver(cfg *Config, patterns ...string) (*driverResponse, error) { driver := findExternalDriver(cfg) if driver == nil { driver = goListDriver } - return driver(cfg, patterns...) + response, err := driver(cfg, patterns...) + if err != nil { + return response, err + } else if response.NotHandled { + return goListDriver(cfg, patterns...) + } + return response, nil } // A Package describes a loaded Go package. @@ -249,7 +288,7 @@ type Package struct { GoFiles []string // CompiledGoFiles lists the absolute file paths of the package's source - // files that were presented to the compiler. + // files that are suitable for type checking. // This may differ from GoFiles if files are processed before compilation. CompiledGoFiles []string @@ -257,6 +296,11 @@ type Package struct { // including assembly, C, C++, Fortran, Objective-C, SWIG, and so on. OtherFiles []string + // IgnoredFiles lists source files that are not part of the package + // using the current build configuration but that might be part of + // the package using other build configurations. + IgnoredFiles []string + // ExportFile is the absolute path to a file containing type // information for the package as provided by the build system. ExportFile string @@ -292,6 +336,56 @@ type Package struct { // TypesSizes provides the effective size function for types in TypesInfo. TypesSizes types.Sizes + + // forTest is the package under test, if any. + forTest string + + // depsErrors is the DepsErrors field from the go list response, if any. + depsErrors []*packagesinternal.PackageError + + // module is the module information for the package if it exists. + Module *Module +} + +// Module provides module information for a package. +type Module struct { + Path string // module path + Version string // module version + Replace *Module // replaced by this module + Time *time.Time // time version was created + Main bool // is this the main module? + Indirect bool // is this module only an indirect dependency of main module? + Dir string // directory holding files for this module, if any + GoMod string // path to go.mod file used when loading this module, if any + GoVersion string // go version used in module + Error *ModuleError // error loading module +} + +// ModuleError holds errors loading a module. +type ModuleError struct { + Err string // the error itself +} + +func init() { + packagesinternal.GetForTest = func(p interface{}) string { + return p.(*Package).forTest + } + packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError { + return p.(*Package).depsErrors + } + packagesinternal.GetGoCmdRunner = func(config interface{}) *gocommand.Runner { + return config.(*Config).gocmdRunner + } + packagesinternal.SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) { + config.(*Config).gocmdRunner = runner + } + packagesinternal.SetModFile = func(config interface{}, value string) { + config.(*Config).modFile = value + } + packagesinternal.SetModFlag = func(config interface{}, value string) { + config.(*Config).modFlag = value + } + packagesinternal.TypecheckCgo = int(typecheckCgo) } // An Error describes a problem with a package's metadata, syntax, or types. @@ -334,6 +428,7 @@ type flatPackage struct { GoFiles []string `json:",omitempty"` CompiledGoFiles []string `json:",omitempty"` OtherFiles []string `json:",omitempty"` + IgnoredFiles []string `json:",omitempty"` ExportFile string `json:",omitempty"` Imports map[string]string `json:",omitempty"` } @@ -356,6 +451,7 @@ func (p *Package) MarshalJSON() ([]byte, error) { GoFiles: p.GoFiles, CompiledGoFiles: p.CompiledGoFiles, OtherFiles: p.OtherFiles, + IgnoredFiles: p.IgnoredFiles, ExportFile: p.ExportFile, } if len(p.Imports) > 0 { @@ -454,6 +550,9 @@ func newLoader(cfg *Config) *loader { if ld.Config.Env == nil { ld.Config.Env = os.Environ() } + if ld.Config.gocmdRunner == nil { + ld.Config.gocmdRunner = &gocommand.Runner{} + } if ld.Context == nil { ld.Context = context.Background() } @@ -500,12 +599,23 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { if i, found := rootMap[pkg.ID]; found { rootIndex = i } + + // Overlays can invalidate export data. + // TODO(matloob): make this check fine-grained based on dependencies on overlaid files + exportDataInvalid := len(ld.Overlay) > 0 || pkg.ExportFile == "" && pkg.PkgPath != "unsafe" + // This package needs type information if the caller requested types and the package is + // either a root, or it's a non-root and the user requested dependencies ... + needtypes := (ld.Mode&NeedTypes|NeedTypesInfo != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0)) + // This package needs source if the call requested source (or types info, which implies source) + // and the package is either a root, or itas a non- root and the user requested dependencies... + needsrc := ((ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && (rootIndex >= 0 || ld.Mode&NeedDeps != 0)) || + // ... or if we need types and the exportData is invalid. We fall back to (incompletely) + // typechecking packages from source if they fail to compile. + (ld.Mode&NeedTypes|NeedTypesInfo != 0 && exportDataInvalid)) && pkg.PkgPath != "unsafe" lpkg := &loaderPackage{ Package: pkg, - needtypes: (ld.Mode&(NeedTypes|NeedTypesInfo) != 0 && ld.Mode&NeedDeps != 0 && rootIndex < 0) || rootIndex >= 0, - needsrc: (ld.Mode&(NeedSyntax|NeedTypesInfo) != 0 && ld.Mode&NeedDeps != 0 && rootIndex < 0) || rootIndex >= 0 || - len(ld.Overlay) > 0 || // Overlays can invalidate export data. TODO(matloob): make this check fine-grained based on dependencies on overlaid files - pkg.ExportFile == "" && pkg.PkgPath != "unsafe", + needtypes: needtypes, + needsrc: needsrc, } ld.pkgs[lpkg.ID] = lpkg if rootIndex >= 0 { @@ -628,7 +738,8 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { result[i] = lpkg.Package } for i := range ld.pkgs { - // Clear all unrequested fields, for extra de-Hyrum-ization. + // Clear all unrequested fields, + // to catch programs that use more than they request. if ld.requestedMode&NeedName == 0 { ld.pkgs[i].Name = "" ld.pkgs[i].PkgPath = "" @@ -636,6 +747,7 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { if ld.requestedMode&NeedFiles == 0 { ld.pkgs[i].GoFiles = nil ld.pkgs[i].OtherFiles = nil + ld.pkgs[i].IgnoredFiles = nil } if ld.requestedMode&NeedCompiledGoFiles == 0 { ld.pkgs[i].CompiledGoFiles = nil @@ -660,6 +772,9 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { if ld.requestedMode&NeedTypesSizes == 0 { ld.pkgs[i].TypesSizes = nil } + if ld.requestedMode&NeedModule == 0 { + ld.pkgs[i].Module = nil + } } return result, nil @@ -713,7 +828,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { // which would then require that such created packages be explicitly // inserted back into the Import graph as a final step after export data loading. // The Diamond test exercises this case. - if !lpkg.needtypes { + if !lpkg.needtypes && !lpkg.needsrc { return } if !lpkg.needsrc { @@ -796,6 +911,7 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { Scopes: make(map[ast.Node]*types.Scope), Selections: make(map[*ast.SelectorExpr]*types.Selection), } + typeparams.InitInstanceInfo(lpkg.TypesInfo) lpkg.TypesSizes = ld.sizes importer := importerFunc(func(path string) (*types.Package, error) { @@ -835,6 +951,15 @@ func (ld *loader) loadPackage(lpkg *loaderPackage) { Error: appendError, Sizes: ld.sizes, } + if (ld.Mode & typecheckCgo) != 0 { + if !typesinternal.SetUsesCgo(tc) { + appendError(Error{ + Msg: "typecheckCgo requires Go 1.15+", + Kind: ListError, + }) + return + } + } types.NewChecker(tc, ld.Fset, lpkg.Types, lpkg.TypesInfo).Files(lpkg.Syntax) lpkg.importErrors = nil // no longer needed diff --git a/vendor/golang.org/x/tools/go/packages/visit.go b/vendor/golang.org/x/tools/go/packages/visit.go index b13cb081fc..a1dcc40b72 100644 --- a/vendor/golang.org/x/tools/go/packages/visit.go +++ b/vendor/golang.org/x/tools/go/packages/visit.go @@ -1,3 +1,7 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package packages import ( diff --git a/vendor/golang.org/x/tools/internal/event/core/event.go b/vendor/golang.org/x/tools/internal/event/core/event.go new file mode 100644 index 0000000000..a6cf0e64a4 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/event.go @@ -0,0 +1,85 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package core provides support for event based telemetry. +package core + +import ( + "fmt" + "time" + + "golang.org/x/tools/internal/event/label" +) + +// Event holds the information about an event of note that occurred. +type Event struct { + at time.Time + + // As events are often on the stack, storing the first few labels directly + // in the event can avoid an allocation at all for the very common cases of + // simple events. + // The length needs to be large enough to cope with the majority of events + // but no so large as to cause undue stack pressure. + // A log message with two values will use 3 labels (one for each value and + // one for the message itself). + + static [3]label.Label // inline storage for the first few labels + dynamic []label.Label // dynamically sized storage for remaining labels +} + +// eventLabelMap implements label.Map for a the labels of an Event. +type eventLabelMap struct { + event Event +} + +func (ev Event) At() time.Time { return ev.at } + +func (ev Event) Format(f fmt.State, r rune) { + if !ev.at.IsZero() { + fmt.Fprint(f, ev.at.Format("2006/01/02 15:04:05 ")) + } + for index := 0; ev.Valid(index); index++ { + if l := ev.Label(index); l.Valid() { + fmt.Fprintf(f, "\n\t%v", l) + } + } +} + +func (ev Event) Valid(index int) bool { + return index >= 0 && index < len(ev.static)+len(ev.dynamic) +} + +func (ev Event) Label(index int) label.Label { + if index < len(ev.static) { + return ev.static[index] + } + return ev.dynamic[index-len(ev.static)] +} + +func (ev Event) Find(key label.Key) label.Label { + for _, l := range ev.static { + if l.Key() == key { + return l + } + } + for _, l := range ev.dynamic { + if l.Key() == key { + return l + } + } + return label.Label{} +} + +func MakeEvent(static [3]label.Label, labels []label.Label) Event { + return Event{ + static: static, + dynamic: labels, + } +} + +// CloneEvent event returns a copy of the event with the time adjusted to at. +func CloneEvent(ev Event, at time.Time) Event { + ev.at = at + return ev +} diff --git a/vendor/golang.org/x/tools/internal/event/core/export.go b/vendor/golang.org/x/tools/internal/event/core/export.go new file mode 100644 index 0000000000..05f3a9a579 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/export.go @@ -0,0 +1,70 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package core + +import ( + "context" + "sync/atomic" + "time" + "unsafe" + + "golang.org/x/tools/internal/event/label" +) + +// Exporter is a function that handles events. +// It may return a modified context and event. +type Exporter func(context.Context, Event, label.Map) context.Context + +var ( + exporter unsafe.Pointer +) + +// SetExporter sets the global exporter function that handles all events. +// The exporter is called synchronously from the event call site, so it should +// return quickly so as not to hold up user code. +func SetExporter(e Exporter) { + p := unsafe.Pointer(&e) + if e == nil { + // &e is always valid, and so p is always valid, but for the early abort + // of ProcessEvent to be efficient it needs to make the nil check on the + // pointer without having to dereference it, so we make the nil function + // also a nil pointer + p = nil + } + atomic.StorePointer(&exporter, p) +} + +// deliver is called to deliver an event to the supplied exporter. +// it will fill in the time. +func deliver(ctx context.Context, exporter Exporter, ev Event) context.Context { + // add the current time to the event + ev.at = time.Now() + // hand the event off to the current exporter + return exporter(ctx, ev, ev) +} + +// Export is called to deliver an event to the global exporter if set. +func Export(ctx context.Context, ev Event) context.Context { + // get the global exporter and abort early if there is not one + exporterPtr := (*Exporter)(atomic.LoadPointer(&exporter)) + if exporterPtr == nil { + return ctx + } + return deliver(ctx, *exporterPtr, ev) +} + +// ExportPair is called to deliver a start event to the supplied exporter. +// It also returns a function that will deliver the end event to the same +// exporter. +// It will fill in the time. +func ExportPair(ctx context.Context, begin, end Event) (context.Context, func()) { + // get the global exporter and abort early if there is not one + exporterPtr := (*Exporter)(atomic.LoadPointer(&exporter)) + if exporterPtr == nil { + return ctx, func() {} + } + ctx = deliver(ctx, *exporterPtr, begin) + return ctx, func() { deliver(ctx, *exporterPtr, end) } +} diff --git a/vendor/golang.org/x/tools/internal/event/core/fast.go b/vendor/golang.org/x/tools/internal/event/core/fast.go new file mode 100644 index 0000000000..06c1d4615e --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/core/fast.go @@ -0,0 +1,77 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package core + +import ( + "context" + + "golang.org/x/tools/internal/event/keys" + "golang.org/x/tools/internal/event/label" +) + +// Log1 takes a message and one label delivers a log event to the exporter. +// It is a customized version of Print that is faster and does no allocation. +func Log1(ctx context.Context, message string, t1 label.Label) { + Export(ctx, MakeEvent([3]label.Label{ + keys.Msg.Of(message), + t1, + }, nil)) +} + +// Log2 takes a message and two labels and delivers a log event to the exporter. +// It is a customized version of Print that is faster and does no allocation. +func Log2(ctx context.Context, message string, t1 label.Label, t2 label.Label) { + Export(ctx, MakeEvent([3]label.Label{ + keys.Msg.Of(message), + t1, + t2, + }, nil)) +} + +// Metric1 sends a label event to the exporter with the supplied labels. +func Metric1(ctx context.Context, t1 label.Label) context.Context { + return Export(ctx, MakeEvent([3]label.Label{ + keys.Metric.New(), + t1, + }, nil)) +} + +// Metric2 sends a label event to the exporter with the supplied labels. +func Metric2(ctx context.Context, t1, t2 label.Label) context.Context { + return Export(ctx, MakeEvent([3]label.Label{ + keys.Metric.New(), + t1, + t2, + }, nil)) +} + +// Start1 sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start1(ctx context.Context, name string, t1 label.Label) (context.Context, func()) { + return ExportPair(ctx, + MakeEvent([3]label.Label{ + keys.Start.Of(name), + t1, + }, nil), + MakeEvent([3]label.Label{ + keys.End.New(), + }, nil)) +} + +// Start2 sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start2(ctx context.Context, name string, t1, t2 label.Label) (context.Context, func()) { + return ExportPair(ctx, + MakeEvent([3]label.Label{ + keys.Start.Of(name), + t1, + t2, + }, nil), + MakeEvent([3]label.Label{ + keys.End.New(), + }, nil)) +} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go b/vendor/golang.org/x/tools/internal/event/doc.go similarity index 53% rename from vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go rename to vendor/golang.org/x/tools/internal/event/doc.go index 0e3f25aca1..5dc6e6babe 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go +++ b/vendor/golang.org/x/tools/internal/event/doc.go @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin,arm,!go1.12 - -package unix - -func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { - return 0, ENOSYS -} +// Package event provides a set of packages that cover the main +// concepts of telemetry in an implementation agnostic way. +package event diff --git a/vendor/golang.org/x/tools/internal/event/event.go b/vendor/golang.org/x/tools/internal/event/event.go new file mode 100644 index 0000000000..4d55e577d1 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/event.go @@ -0,0 +1,127 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package event + +import ( + "context" + + "golang.org/x/tools/internal/event/core" + "golang.org/x/tools/internal/event/keys" + "golang.org/x/tools/internal/event/label" +) + +// Exporter is a function that handles events. +// It may return a modified context and event. +type Exporter func(context.Context, core.Event, label.Map) context.Context + +// SetExporter sets the global exporter function that handles all events. +// The exporter is called synchronously from the event call site, so it should +// return quickly so as not to hold up user code. +func SetExporter(e Exporter) { + core.SetExporter(core.Exporter(e)) +} + +// Log takes a message and a label list and combines them into a single event +// before delivering them to the exporter. +func Log(ctx context.Context, message string, labels ...label.Label) { + core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Msg.Of(message), + }, labels)) +} + +// IsLog returns true if the event was built by the Log function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsLog(ev core.Event) bool { + return ev.Label(0).Key() == keys.Msg +} + +// Error takes a message and a label list and combines them into a single event +// before delivering them to the exporter. It captures the error in the +// delivered event. +func Error(ctx context.Context, message string, err error, labels ...label.Label) { + core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Msg.Of(message), + keys.Err.Of(err), + }, labels)) +} + +// IsError returns true if the event was built by the Error function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsError(ev core.Event) bool { + return ev.Label(0).Key() == keys.Msg && + ev.Label(1).Key() == keys.Err +} + +// Metric sends a label event to the exporter with the supplied labels. +func Metric(ctx context.Context, labels ...label.Label) { + core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Metric.New(), + }, labels)) +} + +// IsMetric returns true if the event was built by the Metric function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsMetric(ev core.Event) bool { + return ev.Label(0).Key() == keys.Metric +} + +// Label sends a label event to the exporter with the supplied labels. +func Label(ctx context.Context, labels ...label.Label) context.Context { + return core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Label.New(), + }, labels)) +} + +// IsLabel returns true if the event was built by the Label function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsLabel(ev core.Event) bool { + return ev.Label(0).Key() == keys.Label +} + +// Start sends a span start event with the supplied label list to the exporter. +// It also returns a function that will end the span, which should normally be +// deferred. +func Start(ctx context.Context, name string, labels ...label.Label) (context.Context, func()) { + return core.ExportPair(ctx, + core.MakeEvent([3]label.Label{ + keys.Start.Of(name), + }, labels), + core.MakeEvent([3]label.Label{ + keys.End.New(), + }, nil)) +} + +// IsStart returns true if the event was built by the Start function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsStart(ev core.Event) bool { + return ev.Label(0).Key() == keys.Start +} + +// IsEnd returns true if the event was built by the End function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsEnd(ev core.Event) bool { + return ev.Label(0).Key() == keys.End +} + +// Detach returns a context without an associated span. +// This allows the creation of spans that are not children of the current span. +func Detach(ctx context.Context) context.Context { + return core.Export(ctx, core.MakeEvent([3]label.Label{ + keys.Detach.New(), + }, nil)) +} + +// IsDetach returns true if the event was built by the Detach function. +// It is intended to be used in exporters to identify the semantics of the +// event when deciding what to do with it. +func IsDetach(ev core.Event) bool { + return ev.Label(0).Key() == keys.Detach +} diff --git a/vendor/golang.org/x/tools/internal/event/keys/keys.go b/vendor/golang.org/x/tools/internal/event/keys/keys.go new file mode 100644 index 0000000000..a02206e301 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/keys.go @@ -0,0 +1,564 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package keys + +import ( + "fmt" + "io" + "math" + "strconv" + + "golang.org/x/tools/internal/event/label" +) + +// Value represents a key for untyped values. +type Value struct { + name string + description string +} + +// New creates a new Key for untyped values. +func New(name, description string) *Value { + return &Value{name: name, description: description} +} + +func (k *Value) Name() string { return k.name } +func (k *Value) Description() string { return k.description } + +func (k *Value) Format(w io.Writer, buf []byte, l label.Label) { + fmt.Fprint(w, k.From(l)) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Value) Get(lm label.Map) interface{} { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return nil +} + +// From can be used to get a value from a Label. +func (k *Value) From(t label.Label) interface{} { return t.UnpackValue() } + +// Of creates a new Label with this key and the supplied value. +func (k *Value) Of(value interface{}) label.Label { return label.OfValue(k, value) } + +// Tag represents a key for tagging labels that have no value. +// These are used when the existence of the label is the entire information it +// carries, such as marking events to be of a specific kind, or from a specific +// package. +type Tag struct { + name string + description string +} + +// NewTag creates a new Key for tagging labels. +func NewTag(name, description string) *Tag { + return &Tag{name: name, description: description} +} + +func (k *Tag) Name() string { return k.name } +func (k *Tag) Description() string { return k.description } + +func (k *Tag) Format(w io.Writer, buf []byte, l label.Label) {} + +// New creates a new Label with this key. +func (k *Tag) New() label.Label { return label.OfValue(k, nil) } + +// Int represents a key +type Int struct { + name string + description string +} + +// NewInt creates a new Key for int values. +func NewInt(name, description string) *Int { + return &Int{name: name, description: description} +} + +func (k *Int) Name() string { return k.name } +func (k *Int) Description() string { return k.description } + +func (k *Int) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int) Of(v int) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int) Get(lm label.Map) int { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int) From(t label.Label) int { return int(t.Unpack64()) } + +// Int8 represents a key +type Int8 struct { + name string + description string +} + +// NewInt8 creates a new Key for int8 values. +func NewInt8(name, description string) *Int8 { + return &Int8{name: name, description: description} +} + +func (k *Int8) Name() string { return k.name } +func (k *Int8) Description() string { return k.description } + +func (k *Int8) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int8) Of(v int8) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int8) Get(lm label.Map) int8 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int8) From(t label.Label) int8 { return int8(t.Unpack64()) } + +// Int16 represents a key +type Int16 struct { + name string + description string +} + +// NewInt16 creates a new Key for int16 values. +func NewInt16(name, description string) *Int16 { + return &Int16{name: name, description: description} +} + +func (k *Int16) Name() string { return k.name } +func (k *Int16) Description() string { return k.description } + +func (k *Int16) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int16) Of(v int16) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int16) Get(lm label.Map) int16 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int16) From(t label.Label) int16 { return int16(t.Unpack64()) } + +// Int32 represents a key +type Int32 struct { + name string + description string +} + +// NewInt32 creates a new Key for int32 values. +func NewInt32(name, description string) *Int32 { + return &Int32{name: name, description: description} +} + +func (k *Int32) Name() string { return k.name } +func (k *Int32) Description() string { return k.description } + +func (k *Int32) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, int64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int32) Of(v int32) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int32) Get(lm label.Map) int32 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int32) From(t label.Label) int32 { return int32(t.Unpack64()) } + +// Int64 represents a key +type Int64 struct { + name string + description string +} + +// NewInt64 creates a new Key for int64 values. +func NewInt64(name, description string) *Int64 { + return &Int64{name: name, description: description} +} + +func (k *Int64) Name() string { return k.name } +func (k *Int64) Description() string { return k.description } + +func (k *Int64) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendInt(buf, k.From(l), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Int64) Of(v int64) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Int64) Get(lm label.Map) int64 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Int64) From(t label.Label) int64 { return int64(t.Unpack64()) } + +// UInt represents a key +type UInt struct { + name string + description string +} + +// NewUInt creates a new Key for uint values. +func NewUInt(name, description string) *UInt { + return &UInt{name: name, description: description} +} + +func (k *UInt) Name() string { return k.name } +func (k *UInt) Description() string { return k.description } + +func (k *UInt) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt) Of(v uint) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt) Get(lm label.Map) uint { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt) From(t label.Label) uint { return uint(t.Unpack64()) } + +// UInt8 represents a key +type UInt8 struct { + name string + description string +} + +// NewUInt8 creates a new Key for uint8 values. +func NewUInt8(name, description string) *UInt8 { + return &UInt8{name: name, description: description} +} + +func (k *UInt8) Name() string { return k.name } +func (k *UInt8) Description() string { return k.description } + +func (k *UInt8) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt8) Of(v uint8) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt8) Get(lm label.Map) uint8 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt8) From(t label.Label) uint8 { return uint8(t.Unpack64()) } + +// UInt16 represents a key +type UInt16 struct { + name string + description string +} + +// NewUInt16 creates a new Key for uint16 values. +func NewUInt16(name, description string) *UInt16 { + return &UInt16{name: name, description: description} +} + +func (k *UInt16) Name() string { return k.name } +func (k *UInt16) Description() string { return k.description } + +func (k *UInt16) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt16) Of(v uint16) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt16) Get(lm label.Map) uint16 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt16) From(t label.Label) uint16 { return uint16(t.Unpack64()) } + +// UInt32 represents a key +type UInt32 struct { + name string + description string +} + +// NewUInt32 creates a new Key for uint32 values. +func NewUInt32(name, description string) *UInt32 { + return &UInt32{name: name, description: description} +} + +func (k *UInt32) Name() string { return k.name } +func (k *UInt32) Description() string { return k.description } + +func (k *UInt32) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, uint64(k.From(l)), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt32) Of(v uint32) label.Label { return label.Of64(k, uint64(v)) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt32) Get(lm label.Map) uint32 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt32) From(t label.Label) uint32 { return uint32(t.Unpack64()) } + +// UInt64 represents a key +type UInt64 struct { + name string + description string +} + +// NewUInt64 creates a new Key for uint64 values. +func NewUInt64(name, description string) *UInt64 { + return &UInt64{name: name, description: description} +} + +func (k *UInt64) Name() string { return k.name } +func (k *UInt64) Description() string { return k.description } + +func (k *UInt64) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendUint(buf, k.From(l), 10)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *UInt64) Of(v uint64) label.Label { return label.Of64(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *UInt64) Get(lm label.Map) uint64 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *UInt64) From(t label.Label) uint64 { return t.Unpack64() } + +// Float32 represents a key +type Float32 struct { + name string + description string +} + +// NewFloat32 creates a new Key for float32 values. +func NewFloat32(name, description string) *Float32 { + return &Float32{name: name, description: description} +} + +func (k *Float32) Name() string { return k.name } +func (k *Float32) Description() string { return k.description } + +func (k *Float32) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendFloat(buf, float64(k.From(l)), 'E', -1, 32)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Float32) Of(v float32) label.Label { + return label.Of64(k, uint64(math.Float32bits(v))) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Float32) Get(lm label.Map) float32 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Float32) From(t label.Label) float32 { + return math.Float32frombits(uint32(t.Unpack64())) +} + +// Float64 represents a key +type Float64 struct { + name string + description string +} + +// NewFloat64 creates a new Key for int64 values. +func NewFloat64(name, description string) *Float64 { + return &Float64{name: name, description: description} +} + +func (k *Float64) Name() string { return k.name } +func (k *Float64) Description() string { return k.description } + +func (k *Float64) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendFloat(buf, k.From(l), 'E', -1, 64)) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Float64) Of(v float64) label.Label { + return label.Of64(k, math.Float64bits(v)) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Float64) Get(lm label.Map) float64 { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return 0 +} + +// From can be used to get a value from a Label. +func (k *Float64) From(t label.Label) float64 { + return math.Float64frombits(t.Unpack64()) +} + +// String represents a key +type String struct { + name string + description string +} + +// NewString creates a new Key for int64 values. +func NewString(name, description string) *String { + return &String{name: name, description: description} +} + +func (k *String) Name() string { return k.name } +func (k *String) Description() string { return k.description } + +func (k *String) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendQuote(buf, k.From(l))) +} + +// Of creates a new Label with this key and the supplied value. +func (k *String) Of(v string) label.Label { return label.OfString(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *String) Get(lm label.Map) string { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return "" +} + +// From can be used to get a value from a Label. +func (k *String) From(t label.Label) string { return t.UnpackString() } + +// Boolean represents a key +type Boolean struct { + name string + description string +} + +// NewBoolean creates a new Key for bool values. +func NewBoolean(name, description string) *Boolean { + return &Boolean{name: name, description: description} +} + +func (k *Boolean) Name() string { return k.name } +func (k *Boolean) Description() string { return k.description } + +func (k *Boolean) Format(w io.Writer, buf []byte, l label.Label) { + w.Write(strconv.AppendBool(buf, k.From(l))) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Boolean) Of(v bool) label.Label { + if v { + return label.Of64(k, 1) + } + return label.Of64(k, 0) +} + +// Get can be used to get a label for the key from a label.Map. +func (k *Boolean) Get(lm label.Map) bool { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return false +} + +// From can be used to get a value from a Label. +func (k *Boolean) From(t label.Label) bool { return t.Unpack64() > 0 } + +// Error represents a key +type Error struct { + name string + description string +} + +// NewError creates a new Key for int64 values. +func NewError(name, description string) *Error { + return &Error{name: name, description: description} +} + +func (k *Error) Name() string { return k.name } +func (k *Error) Description() string { return k.description } + +func (k *Error) Format(w io.Writer, buf []byte, l label.Label) { + io.WriteString(w, k.From(l).Error()) +} + +// Of creates a new Label with this key and the supplied value. +func (k *Error) Of(v error) label.Label { return label.OfValue(k, v) } + +// Get can be used to get a label for the key from a label.Map. +func (k *Error) Get(lm label.Map) error { + if t := lm.Find(k); t.Valid() { + return k.From(t) + } + return nil +} + +// From can be used to get a value from a Label. +func (k *Error) From(t label.Label) error { + err, _ := t.UnpackValue().(error) + return err +} diff --git a/vendor/golang.org/x/tools/internal/event/keys/standard.go b/vendor/golang.org/x/tools/internal/event/keys/standard.go new file mode 100644 index 0000000000..7e95866592 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/keys/standard.go @@ -0,0 +1,22 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package keys + +var ( + // Msg is a key used to add message strings to label lists. + Msg = NewString("message", "a readable message") + // Label is a key used to indicate an event adds labels to the context. + Label = NewTag("label", "a label context marker") + // Start is used for things like traces that have a name. + Start = NewString("start", "span start") + // Metric is a key used to indicate an event records metrics. + End = NewTag("end", "a span end marker") + // Metric is a key used to indicate an event records metrics. + Detach = NewTag("detach", "a span detach marker") + // Err is a key used to add error values to label lists. + Err = NewError("error", "an error that occurred") + // Metric is a key used to indicate an event records metrics. + Metric = NewTag("metric", "a metric event marker") +) diff --git a/vendor/golang.org/x/tools/internal/event/label/label.go b/vendor/golang.org/x/tools/internal/event/label/label.go new file mode 100644 index 0000000000..0f526e1f9a --- /dev/null +++ b/vendor/golang.org/x/tools/internal/event/label/label.go @@ -0,0 +1,215 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package label + +import ( + "fmt" + "io" + "reflect" + "unsafe" +) + +// Key is used as the identity of a Label. +// Keys are intended to be compared by pointer only, the name should be unique +// for communicating with external systems, but it is not required or enforced. +type Key interface { + // Name returns the key name. + Name() string + // Description returns a string that can be used to describe the value. + Description() string + + // Format is used in formatting to append the value of the label to the + // supplied buffer. + // The formatter may use the supplied buf as a scratch area to avoid + // allocations. + Format(w io.Writer, buf []byte, l Label) +} + +// Label holds a key and value pair. +// It is normally used when passing around lists of labels. +type Label struct { + key Key + packed uint64 + untyped interface{} +} + +// Map is the interface to a collection of Labels indexed by key. +type Map interface { + // Find returns the label that matches the supplied key. + Find(key Key) Label +} + +// List is the interface to something that provides an iterable +// list of labels. +// Iteration should start from 0 and continue until Valid returns false. +type List interface { + // Valid returns true if the index is within range for the list. + // It does not imply the label at that index will itself be valid. + Valid(index int) bool + // Label returns the label at the given index. + Label(index int) Label +} + +// list implements LabelList for a list of Labels. +type list struct { + labels []Label +} + +// filter wraps a LabelList filtering out specific labels. +type filter struct { + keys []Key + underlying List +} + +// listMap implements LabelMap for a simple list of labels. +type listMap struct { + labels []Label +} + +// mapChain implements LabelMap for a list of underlying LabelMap. +type mapChain struct { + maps []Map +} + +// OfValue creates a new label from the key and value. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func OfValue(k Key, value interface{}) Label { return Label{key: k, untyped: value} } + +// UnpackValue assumes the label was built using LabelOfValue and returns the value +// that was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) UnpackValue() interface{} { return t.untyped } + +// Of64 creates a new label from a key and a uint64. This is often +// used for non uint64 values that can be packed into a uint64. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func Of64(k Key, v uint64) Label { return Label{key: k, packed: v} } + +// Unpack64 assumes the label was built using LabelOf64 and returns the value that +// was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) Unpack64() uint64 { return t.packed } + +type stringptr unsafe.Pointer + +// OfString creates a new label from a key and a string. +// This method is for implementing new key types, label creation should +// normally be done with the Of method of the key. +func OfString(k Key, v string) Label { + hdr := (*reflect.StringHeader)(unsafe.Pointer(&v)) + return Label{ + key: k, + packed: uint64(hdr.Len), + untyped: stringptr(hdr.Data), + } +} + +// UnpackString assumes the label was built using LabelOfString and returns the +// value that was passed to that constructor. +// This method is for implementing new key types, for type safety normal +// access should be done with the From method of the key. +func (t Label) UnpackString() string { + var v string + hdr := (*reflect.StringHeader)(unsafe.Pointer(&v)) + hdr.Data = uintptr(t.untyped.(stringptr)) + hdr.Len = int(t.packed) + return v +} + +// Valid returns true if the Label is a valid one (it has a key). +func (t Label) Valid() bool { return t.key != nil } + +// Key returns the key of this Label. +func (t Label) Key() Key { return t.key } + +// Format is used for debug printing of labels. +func (t Label) Format(f fmt.State, r rune) { + if !t.Valid() { + io.WriteString(f, `nil`) + return + } + io.WriteString(f, t.Key().Name()) + io.WriteString(f, "=") + var buf [128]byte + t.Key().Format(f, buf[:0], t) +} + +func (l *list) Valid(index int) bool { + return index >= 0 && index < len(l.labels) +} + +func (l *list) Label(index int) Label { + return l.labels[index] +} + +func (f *filter) Valid(index int) bool { + return f.underlying.Valid(index) +} + +func (f *filter) Label(index int) Label { + l := f.underlying.Label(index) + for _, f := range f.keys { + if l.Key() == f { + return Label{} + } + } + return l +} + +func (lm listMap) Find(key Key) Label { + for _, l := range lm.labels { + if l.Key() == key { + return l + } + } + return Label{} +} + +func (c mapChain) Find(key Key) Label { + for _, src := range c.maps { + l := src.Find(key) + if l.Valid() { + return l + } + } + return Label{} +} + +var emptyList = &list{} + +func NewList(labels ...Label) List { + if len(labels) == 0 { + return emptyList + } + return &list{labels: labels} +} + +func Filter(l List, keys ...Key) List { + if len(keys) == 0 { + return l + } + return &filter{keys: keys, underlying: l} +} + +func NewMap(labels ...Label) Map { + return listMap{labels: labels} +} + +func MergeMaps(srcs ...Map) Map { + var nonNil []Map + for _, src := range srcs { + if src != nil { + nonNil = append(nonNil, src) + } + } + if len(nonNil) == 1 { + return nonNil[0] + } + return mapChain{maps: nonNil} +} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go deleted file mode 100644 index 7219c8e9ff..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package fastwalk provides a faster version of filepath.Walk for file system -// scanning tools. -package fastwalk - -import ( - "errors" - "os" - "path/filepath" - "runtime" - "sync" -) - -// TraverseLink is used as a return value from WalkFuncs to indicate that the -// symlink named in the call may be traversed. -var TraverseLink = errors.New("fastwalk: traverse symlink, assuming target is a directory") - -// SkipFiles is a used as a return value from WalkFuncs to indicate that the -// callback should not be called for any other files in the current directory. -// Child directories will still be traversed. -var SkipFiles = errors.New("fastwalk: skip remaining files in directory") - -// Walk is a faster implementation of filepath.Walk. -// -// filepath.Walk's design necessarily calls os.Lstat on each file, -// even if the caller needs less info. -// Many tools need only the type of each file. -// On some platforms, this information is provided directly by the readdir -// system call, avoiding the need to stat each file individually. -// fastwalk_unix.go contains a fork of the syscall routines. -// -// See golang.org/issue/16399 -// -// Walk walks the file tree rooted at root, calling walkFn for -// each file or directory in the tree, including root. -// -// If fastWalk returns filepath.SkipDir, the directory is skipped. -// -// Unlike filepath.Walk: -// * file stat calls must be done by the user. -// The only provided metadata is the file type, which does not include -// any permission bits. -// * multiple goroutines stat the filesystem concurrently. The provided -// walkFn must be safe for concurrent use. -// * fastWalk can follow symlinks if walkFn returns the TraverseLink -// sentinel error. It is the walkFn's responsibility to prevent -// fastWalk from going into symlink cycles. -func Walk(root string, walkFn func(path string, typ os.FileMode) error) error { - // TODO(bradfitz): make numWorkers configurable? We used a - // minimum of 4 to give the kernel more info about multiple - // things we want, in hopes its I/O scheduling can take - // advantage of that. Hopefully most are in cache. Maybe 4 is - // even too low of a minimum. Profile more. - numWorkers := 4 - if n := runtime.NumCPU(); n > numWorkers { - numWorkers = n - } - - // Make sure to wait for all workers to finish, otherwise - // walkFn could still be called after returning. This Wait call - // runs after close(e.donec) below. - var wg sync.WaitGroup - defer wg.Wait() - - w := &walker{ - fn: walkFn, - enqueuec: make(chan walkItem, numWorkers), // buffered for performance - workc: make(chan walkItem, numWorkers), // buffered for performance - donec: make(chan struct{}), - - // buffered for correctness & not leaking goroutines: - resc: make(chan error, numWorkers), - } - defer close(w.donec) - - for i := 0; i < numWorkers; i++ { - wg.Add(1) - go w.doWork(&wg) - } - todo := []walkItem{{dir: root}} - out := 0 - for { - workc := w.workc - var workItem walkItem - if len(todo) == 0 { - workc = nil - } else { - workItem = todo[len(todo)-1] - } - select { - case workc <- workItem: - todo = todo[:len(todo)-1] - out++ - case it := <-w.enqueuec: - todo = append(todo, it) - case err := <-w.resc: - out-- - if err != nil { - return err - } - if out == 0 && len(todo) == 0 { - // It's safe to quit here, as long as the buffered - // enqueue channel isn't also readable, which might - // happen if the worker sends both another unit of - // work and its result before the other select was - // scheduled and both w.resc and w.enqueuec were - // readable. - select { - case it := <-w.enqueuec: - todo = append(todo, it) - default: - return nil - } - } - } - } -} - -// doWork reads directories as instructed (via workc) and runs the -// user's callback function. -func (w *walker) doWork(wg *sync.WaitGroup) { - defer wg.Done() - for { - select { - case <-w.donec: - return - case it := <-w.workc: - select { - case <-w.donec: - return - case w.resc <- w.walk(it.dir, !it.callbackDone): - } - } - } -} - -type walker struct { - fn func(path string, typ os.FileMode) error - - donec chan struct{} // closed on fastWalk's return - workc chan walkItem // to workers - enqueuec chan walkItem // from workers - resc chan error // from workers -} - -type walkItem struct { - dir string - callbackDone bool // callback already called; don't do it again -} - -func (w *walker) enqueue(it walkItem) { - select { - case w.enqueuec <- it: - case <-w.donec: - } -} - -func (w *walker) onDirEnt(dirName, baseName string, typ os.FileMode) error { - joined := dirName + string(os.PathSeparator) + baseName - if typ == os.ModeDir { - w.enqueue(walkItem{dir: joined}) - return nil - } - - err := w.fn(joined, typ) - if typ == os.ModeSymlink { - if err == TraverseLink { - // Set callbackDone so we don't call it twice for both the - // symlink-as-symlink and the symlink-as-directory later: - w.enqueue(walkItem{dir: joined, callbackDone: true}) - return nil - } - if err == filepath.SkipDir { - // Permit SkipDir on symlinks too. - return nil - } - } - return err -} - -func (w *walker) walk(root string, runUserCallback bool) error { - if runUserCallback { - err := w.fn(root, os.ModeDir) - if err == filepath.SkipDir { - return nil - } - if err != nil { - return err - } - } - - return readDir(root, w.onDirEnt) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go deleted file mode 100644 index ccffec5adc..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build freebsd openbsd netbsd - -package fastwalk - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Fileno) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go deleted file mode 100644 index ab7fbc0a9a..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux darwin -// +build !appengine - -package fastwalk - -import "syscall" - -func direntInode(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Ino) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go deleted file mode 100644 index e880d358b1..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux -// +build !appengine - -package fastwalk - -import ( - "bytes" - "syscall" - "unsafe" -) - -func direntNamlen(dirent *syscall.Dirent) uint64 { - const fixedHdr = uint16(unsafe.Offsetof(syscall.Dirent{}.Name)) - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - const nameBufLen = uint16(len(nameBuf)) - limit := dirent.Reclen - fixedHdr - if limit > nameBufLen { - limit = nameBufLen - } - nameLen := bytes.IndexByte(nameBuf[:limit], 0) - if nameLen < 0 { - panic("failed to find terminating 0 byte in dirent") - } - return uint64(nameLen) -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go deleted file mode 100644 index a906b87595..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build appengine !linux,!darwin,!freebsd,!openbsd,!netbsd - -package fastwalk - -import ( - "io/ioutil" - "os" -) - -// readDir calls fn for each directory entry in dirName. -// It does not descend into directories or follow symlinks. -// If fn returns a non-nil error, readDir returns with that error -// immediately. -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fis, err := ioutil.ReadDir(dirName) - if err != nil { - return err - } - skipFiles := false - for _, fi := range fis { - if fi.Mode().IsRegular() && skipFiles { - continue - } - if err := fn(dirName, fi.Name(), fi.Mode()&os.ModeType); err != nil { - if err == SkipFiles { - skipFiles = true - continue - } - return err - } - } - return nil -} diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go b/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go deleted file mode 100644 index 3369b1a0b2..0000000000 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build linux darwin freebsd openbsd netbsd -// +build !appengine - -package fastwalk - -import ( - "fmt" - "os" - "syscall" - "unsafe" -) - -const blockSize = 8 << 10 - -// unknownFileMode is a sentinel (and bogus) os.FileMode -// value used to represent a syscall.DT_UNKNOWN Dirent.Type. -const unknownFileMode os.FileMode = os.ModeNamedPipe | os.ModeSocket | os.ModeDevice - -func readDir(dirName string, fn func(dirName, entName string, typ os.FileMode) error) error { - fd, err := syscall.Open(dirName, 0, 0) - if err != nil { - return &os.PathError{Op: "open", Path: dirName, Err: err} - } - defer syscall.Close(fd) - - // The buffer must be at least a block long. - buf := make([]byte, blockSize) // stack-allocated; doesn't escape - bufp := 0 // starting read position in buf - nbuf := 0 // end valid data in buf - skipFiles := false - for { - if bufp >= nbuf { - bufp = 0 - nbuf, err = syscall.ReadDirent(fd, buf) - if err != nil { - return os.NewSyscallError("readdirent", err) - } - if nbuf <= 0 { - return nil - } - } - consumed, name, typ := parseDirEnt(buf[bufp:nbuf]) - bufp += consumed - if name == "" || name == "." || name == ".." { - continue - } - // Fallback for filesystems (like old XFS) that don't - // support Dirent.Type and have DT_UNKNOWN (0) there - // instead. - if typ == unknownFileMode { - fi, err := os.Lstat(dirName + "/" + name) - if err != nil { - // It got deleted in the meantime. - if os.IsNotExist(err) { - continue - } - return err - } - typ = fi.Mode() & os.ModeType - } - if skipFiles && typ.IsRegular() { - continue - } - if err := fn(dirName, name, typ); err != nil { - if err == SkipFiles { - skipFiles = true - continue - } - return err - } - } -} - -func parseDirEnt(buf []byte) (consumed int, name string, typ os.FileMode) { - // golang.org/issue/15653 - dirent := (*syscall.Dirent)(unsafe.Pointer(&buf[0])) - if v := unsafe.Offsetof(dirent.Reclen) + unsafe.Sizeof(dirent.Reclen); uintptr(len(buf)) < v { - panic(fmt.Sprintf("buf size of %d smaller than dirent header size %d", len(buf), v)) - } - if len(buf) < int(dirent.Reclen) { - panic(fmt.Sprintf("buf size %d < record length %d", len(buf), dirent.Reclen)) - } - consumed = int(dirent.Reclen) - if direntInode(dirent) == 0 { // File absent in directory. - return - } - switch dirent.Type { - case syscall.DT_REG: - typ = 0 - case syscall.DT_DIR: - typ = os.ModeDir - case syscall.DT_LNK: - typ = os.ModeSymlink - case syscall.DT_BLK: - typ = os.ModeDevice - case syscall.DT_FIFO: - typ = os.ModeNamedPipe - case syscall.DT_SOCK: - typ = os.ModeSocket - case syscall.DT_UNKNOWN: - typ = unknownFileMode - default: - // Skip weird things. - // It's probably a DT_WHT (http://lwn.net/Articles/325369/) - // or something. Revisit if/when this package is moved outside - // of goimports. goimports only cares about regular files, - // symlinks, and directories. - return - } - - nameBuf := (*[unsafe.Sizeof(dirent.Name)]byte)(unsafe.Pointer(&dirent.Name[0])) - nameLen := direntNamlen(dirent) - - // Special cases for common things: - if nameLen == 1 && nameBuf[0] == '.' { - name = "." - } else if nameLen == 2 && nameBuf[0] == '.' && nameBuf[1] == '.' { - name = ".." - } else { - name = string(nameBuf[:nameLen]) - } - return -} diff --git a/vendor/golang.org/x/tools/internal/gocommand/invoke.go b/vendor/golang.org/x/tools/internal/gocommand/invoke.go new file mode 100644 index 0000000000..8659a0c5da --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/invoke.go @@ -0,0 +1,273 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package gocommand is a helper for calling the go command. +package gocommand + +import ( + "bytes" + "context" + "fmt" + exec "golang.org/x/sys/execabs" + "io" + "os" + "regexp" + "strconv" + "strings" + "sync" + "time" + + "golang.org/x/tools/internal/event" +) + +// An Runner will run go command invocations and serialize +// them if it sees a concurrency error. +type Runner struct { + // once guards the runner initialization. + once sync.Once + + // inFlight tracks available workers. + inFlight chan struct{} + + // serialized guards the ability to run a go command serially, + // to avoid deadlocks when claiming workers. + serialized chan struct{} +} + +const maxInFlight = 10 + +func (runner *Runner) initialize() { + runner.once.Do(func() { + runner.inFlight = make(chan struct{}, maxInFlight) + runner.serialized = make(chan struct{}, 1) + }) +} + +// 1.13: go: updates to go.mod needed, but contents have changed +// 1.14: go: updating go.mod: existing contents have changed since last read +var modConcurrencyError = regexp.MustCompile(`go:.*go.mod.*contents have changed`) + +// Run is a convenience wrapper around RunRaw. +// It returns only stdout and a "friendly" error. +func (runner *Runner) Run(ctx context.Context, inv Invocation) (*bytes.Buffer, error) { + stdout, _, friendly, _ := runner.RunRaw(ctx, inv) + return stdout, friendly +} + +// RunPiped runs the invocation serially, always waiting for any concurrent +// invocations to complete first. +func (runner *Runner) RunPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) error { + _, err := runner.runPiped(ctx, inv, stdout, stderr) + return err +} + +// RunRaw runs the invocation, serializing requests only if they fight over +// go.mod changes. +func (runner *Runner) RunRaw(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { + // Make sure the runner is always initialized. + runner.initialize() + + // First, try to run the go command concurrently. + stdout, stderr, friendlyErr, err := runner.runConcurrent(ctx, inv) + + // If we encounter a load concurrency error, we need to retry serially. + if friendlyErr == nil || !modConcurrencyError.MatchString(friendlyErr.Error()) { + return stdout, stderr, friendlyErr, err + } + event.Error(ctx, "Load concurrency error, will retry serially", err) + + // Run serially by calling runPiped. + stdout.Reset() + stderr.Reset() + friendlyErr, err = runner.runPiped(ctx, inv, stdout, stderr) + return stdout, stderr, friendlyErr, err +} + +func (runner *Runner) runConcurrent(ctx context.Context, inv Invocation) (*bytes.Buffer, *bytes.Buffer, error, error) { + // Wait for 1 worker to become available. + select { + case <-ctx.Done(): + return nil, nil, nil, ctx.Err() + case runner.inFlight <- struct{}{}: + defer func() { <-runner.inFlight }() + } + + stdout, stderr := &bytes.Buffer{}, &bytes.Buffer{} + friendlyErr, err := inv.runWithFriendlyError(ctx, stdout, stderr) + return stdout, stderr, friendlyErr, err +} + +func (runner *Runner) runPiped(ctx context.Context, inv Invocation, stdout, stderr io.Writer) (error, error) { + // Make sure the runner is always initialized. + runner.initialize() + + // Acquire the serialization lock. This avoids deadlocks between two + // runPiped commands. + select { + case <-ctx.Done(): + return nil, ctx.Err() + case runner.serialized <- struct{}{}: + defer func() { <-runner.serialized }() + } + + // Wait for all in-progress go commands to return before proceeding, + // to avoid load concurrency errors. + for i := 0; i < maxInFlight; i++ { + select { + case <-ctx.Done(): + return nil, ctx.Err() + case runner.inFlight <- struct{}{}: + // Make sure we always "return" any workers we took. + defer func() { <-runner.inFlight }() + } + } + + return inv.runWithFriendlyError(ctx, stdout, stderr) +} + +// An Invocation represents a call to the go command. +type Invocation struct { + Verb string + Args []string + BuildFlags []string + ModFlag string + ModFile string + Overlay string + // If CleanEnv is set, the invocation will run only with the environment + // in Env, not starting with os.Environ. + CleanEnv bool + Env []string + WorkingDir string + Logf func(format string, args ...interface{}) +} + +func (i *Invocation) runWithFriendlyError(ctx context.Context, stdout, stderr io.Writer) (friendlyError error, rawError error) { + rawError = i.run(ctx, stdout, stderr) + if rawError != nil { + friendlyError = rawError + // Check for 'go' executable not being found. + if ee, ok := rawError.(*exec.Error); ok && ee.Err == exec.ErrNotFound { + friendlyError = fmt.Errorf("go command required, not found: %v", ee) + } + if ctx.Err() != nil { + friendlyError = ctx.Err() + } + friendlyError = fmt.Errorf("err: %v: stderr: %s", friendlyError, stderr) + } + return +} + +func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error { + log := i.Logf + if log == nil { + log = func(string, ...interface{}) {} + } + + goArgs := []string{i.Verb} + + appendModFile := func() { + if i.ModFile != "" { + goArgs = append(goArgs, "-modfile="+i.ModFile) + } + } + appendModFlag := func() { + if i.ModFlag != "" { + goArgs = append(goArgs, "-mod="+i.ModFlag) + } + } + appendOverlayFlag := func() { + if i.Overlay != "" { + goArgs = append(goArgs, "-overlay="+i.Overlay) + } + } + + switch i.Verb { + case "env", "version": + goArgs = append(goArgs, i.Args...) + case "mod": + // mod needs the sub-verb before flags. + goArgs = append(goArgs, i.Args[0]) + appendModFile() + goArgs = append(goArgs, i.Args[1:]...) + case "get": + goArgs = append(goArgs, i.BuildFlags...) + appendModFile() + goArgs = append(goArgs, i.Args...) + + default: // notably list and build. + goArgs = append(goArgs, i.BuildFlags...) + appendModFile() + appendModFlag() + appendOverlayFlag() + goArgs = append(goArgs, i.Args...) + } + cmd := exec.Command("go", goArgs...) + cmd.Stdout = stdout + cmd.Stderr = stderr + // On darwin the cwd gets resolved to the real path, which breaks anything that + // expects the working directory to keep the original path, including the + // go command when dealing with modules. + // The Go stdlib has a special feature where if the cwd and the PWD are the + // same node then it trusts the PWD, so by setting it in the env for the child + // process we fix up all the paths returned by the go command. + if !i.CleanEnv { + cmd.Env = os.Environ() + } + cmd.Env = append(cmd.Env, i.Env...) + if i.WorkingDir != "" { + cmd.Env = append(cmd.Env, "PWD="+i.WorkingDir) + cmd.Dir = i.WorkingDir + } + defer func(start time.Time) { log("%s for %v", time.Since(start), cmdDebugStr(cmd)) }(time.Now()) + + return runCmdContext(ctx, cmd) +} + +// runCmdContext is like exec.CommandContext except it sends os.Interrupt +// before os.Kill. +func runCmdContext(ctx context.Context, cmd *exec.Cmd) error { + if err := cmd.Start(); err != nil { + return err + } + resChan := make(chan error, 1) + go func() { + resChan <- cmd.Wait() + }() + + select { + case err := <-resChan: + return err + case <-ctx.Done(): + } + // Cancelled. Interrupt and see if it ends voluntarily. + cmd.Process.Signal(os.Interrupt) + select { + case err := <-resChan: + return err + case <-time.After(time.Second): + } + // Didn't shut down in response to interrupt. Kill it hard. + cmd.Process.Kill() + return <-resChan +} + +func cmdDebugStr(cmd *exec.Cmd) string { + env := make(map[string]string) + for _, kv := range cmd.Env { + split := strings.SplitN(kv, "=", 2) + k, v := split[0], split[1] + env[k] = v + } + + var args []string + for _, arg := range cmd.Args { + quoted := strconv.Quote(arg) + if quoted[1:len(quoted)-1] != arg || strings.Contains(arg, " ") { + args = append(args, quoted) + } else { + args = append(args, arg) + } + } + return fmt.Sprintf("GOROOT=%v GOPATH=%v GO111MODULE=%v GOPROXY=%v PWD=%v %v", env["GOROOT"], env["GOPATH"], env["GO111MODULE"], env["GOPROXY"], env["PWD"], strings.Join(args, " ")) +} diff --git a/vendor/golang.org/x/tools/internal/gocommand/vendor.go b/vendor/golang.org/x/tools/internal/gocommand/vendor.go new file mode 100644 index 0000000000..5e75bd6d8f --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/vendor.go @@ -0,0 +1,107 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gocommand + +import ( + "bytes" + "context" + "fmt" + "os" + "path/filepath" + "regexp" + "strings" + "time" + + "golang.org/x/mod/semver" +) + +// ModuleJSON holds information about a module. +type ModuleJSON struct { + Path string // module path + Version string // module version + Versions []string // available module versions (with -versions) + Replace *ModuleJSON // replaced by this module + Time *time.Time // time version was created + Update *ModuleJSON // available update, if any (with -u) + Main bool // is this the main module? + Indirect bool // is this module only an indirect dependency of main module? + Dir string // directory holding files for this module, if any + GoMod string // path to go.mod file used when loading this module, if any + GoVersion string // go version used in module +} + +var modFlagRegexp = regexp.MustCompile(`-mod[ =](\w+)`) + +// VendorEnabled reports whether vendoring is enabled. It takes a *Runner to execute Go commands +// with the supplied context.Context and Invocation. The Invocation can contain pre-defined fields, +// of which only Verb and Args are modified to run the appropriate Go command. +// Inspired by setDefaultBuildMod in modload/init.go +func VendorEnabled(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, bool, error) { + mainMod, go114, err := getMainModuleAnd114(ctx, inv, r) + if err != nil { + return nil, false, err + } + + // We check the GOFLAGS to see if there is anything overridden or not. + inv.Verb = "env" + inv.Args = []string{"GOFLAGS"} + stdout, err := r.Run(ctx, inv) + if err != nil { + return nil, false, err + } + goflags := string(bytes.TrimSpace(stdout.Bytes())) + matches := modFlagRegexp.FindStringSubmatch(goflags) + var modFlag string + if len(matches) != 0 { + modFlag = matches[1] + } + if modFlag != "" { + // Don't override an explicit '-mod=' argument. + return mainMod, modFlag == "vendor", nil + } + if mainMod == nil || !go114 { + return mainMod, false, nil + } + // Check 1.14's automatic vendor mode. + if fi, err := os.Stat(filepath.Join(mainMod.Dir, "vendor")); err == nil && fi.IsDir() { + if mainMod.GoVersion != "" && semver.Compare("v"+mainMod.GoVersion, "v1.14") >= 0 { + // The Go version is at least 1.14, and a vendor directory exists. + // Set -mod=vendor by default. + return mainMod, true, nil + } + } + return mainMod, false, nil +} + +// getMainModuleAnd114 gets the main module's information and whether the +// go command in use is 1.14+. This is the information needed to figure out +// if vendoring should be enabled. +func getMainModuleAnd114(ctx context.Context, inv Invocation, r *Runner) (*ModuleJSON, bool, error) { + const format = `{{.Path}} +{{.Dir}} +{{.GoMod}} +{{.GoVersion}} +{{range context.ReleaseTags}}{{if eq . "go1.14"}}{{.}}{{end}}{{end}} +` + inv.Verb = "list" + inv.Args = []string{"-m", "-f", format} + stdout, err := r.Run(ctx, inv) + if err != nil { + return nil, false, err + } + + lines := strings.Split(stdout.String(), "\n") + if len(lines) < 5 { + return nil, false, fmt.Errorf("unexpected stdout: %q", stdout.String()) + } + mod := &ModuleJSON{ + Path: lines[0], + Dir: lines[1], + GoMod: lines[2], + GoVersion: lines[3], + Main: true, + } + return mod, lines[4] == "go1.14", nil +} diff --git a/vendor/golang.org/x/tools/internal/gocommand/version.go b/vendor/golang.org/x/tools/internal/gocommand/version.go new file mode 100644 index 0000000000..7130436802 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/gocommand/version.go @@ -0,0 +1,51 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gocommand + +import ( + "context" + "fmt" + "strings" +) + +// GoVersion checks the go version by running "go list" with modules off. +// It returns the X in Go 1.X. +func GoVersion(ctx context.Context, inv Invocation, r *Runner) (int, error) { + inv.Verb = "list" + inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`, `--`, `unsafe`} + inv.Env = append(append([]string{}, inv.Env...), "GO111MODULE=off") + // Unset any unneeded flags, and remove them from BuildFlags, if they're + // present. + inv.ModFile = "" + inv.ModFlag = "" + var buildFlags []string + for _, flag := range inv.BuildFlags { + // Flags can be prefixed by one or two dashes. + f := strings.TrimPrefix(strings.TrimPrefix(flag, "-"), "-") + if strings.HasPrefix(f, "mod=") || strings.HasPrefix(f, "modfile=") { + continue + } + buildFlags = append(buildFlags, flag) + } + inv.BuildFlags = buildFlags + stdoutBytes, err := r.Run(ctx, inv) + if err != nil { + return 0, err + } + stdout := stdoutBytes.String() + if len(stdout) < 3 { + return 0, fmt.Errorf("bad ReleaseTags output: %q", stdout) + } + // Split up "[go1.1 go1.15]" + tags := strings.Fields(stdout[1 : len(stdout)-2]) + for i := len(tags) - 1; i >= 0; i-- { + var version int + if _, err := fmt.Sscanf(tags[i], "go1.%d", &version); err != nil { + continue + } + return version, nil + } + return 0, fmt.Errorf("no parseable ReleaseTags in %v", tags) +} diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go deleted file mode 100644 index 9a61bdbf5d..0000000000 --- a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package gopathwalk is like filepath.Walk but specialized for finding Go -// packages, particularly in $GOPATH and $GOROOT. -package gopathwalk - -import ( - "bufio" - "bytes" - "fmt" - "go/build" - "io/ioutil" - "log" - "os" - "path/filepath" - "strings" - "time" - - "golang.org/x/tools/internal/fastwalk" -) - -// Options controls the behavior of a Walk call. -type Options struct { - Debug bool // Enable debug logging - ModulesEnabled bool // Search module caches. Also disables legacy goimports ignore rules. -} - -// RootType indicates the type of a Root. -type RootType int - -const ( - RootUnknown RootType = iota - RootGOROOT - RootGOPATH - RootCurrentModule - RootModuleCache - RootOther -) - -// A Root is a starting point for a Walk. -type Root struct { - Path string - Type RootType -} - -// SrcDirsRoots returns the roots from build.Default.SrcDirs(). Not modules-compatible. -func SrcDirsRoots(ctx *build.Context) []Root { - var roots []Root - roots = append(roots, Root{filepath.Join(ctx.GOROOT, "src"), RootGOROOT}) - for _, p := range filepath.SplitList(ctx.GOPATH) { - roots = append(roots, Root{filepath.Join(p, "src"), RootGOPATH}) - } - return roots -} - -// Walk walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. -// For each package found, add will be called (concurrently) with the absolute -// paths of the containing source directory and the package directory. -// add will be called concurrently. -func Walk(roots []Root, add func(root Root, dir string), opts Options) { - WalkSkip(roots, add, func(Root, string) bool { return false }, opts) -} - -// WalkSkip walks Go source directories ($GOROOT, $GOPATH, etc) to find packages. -// For each package found, add will be called (concurrently) with the absolute -// paths of the containing source directory and the package directory. -// For each directory that will be scanned, skip will be called (concurrently) -// with the absolute paths of the containing source directory and the directory. -// If skip returns false on a directory it will be processed. -// add will be called concurrently. -// skip will be called concurrently. -func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root, dir string) bool, opts Options) { - for _, root := range roots { - walkDir(root, add, skip, opts) - } -} - -func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) bool, opts Options) { - if _, err := os.Stat(root.Path); os.IsNotExist(err) { - if opts.Debug { - log.Printf("skipping nonexistent directory: %v", root.Path) - } - return - } - start := time.Now() - if opts.Debug { - log.Printf("gopathwalk: scanning %s", root.Path) - } - w := &walker{ - root: root, - add: add, - skip: skip, - opts: opts, - } - w.init() - if err := fastwalk.Walk(root.Path, w.walk); err != nil { - log.Printf("gopathwalk: scanning directory %v: %v", root.Path, err) - } - - if opts.Debug { - log.Printf("gopathwalk: scanned %s in %v", root.Path, time.Since(start)) - } -} - -// walker is the callback for fastwalk.Walk. -type walker struct { - root Root // The source directory to scan. - add func(Root, string) // The callback that will be invoked for every possible Go package dir. - skip func(Root, string) bool // The callback that will be invoked for every dir. dir is skipped if it returns true. - opts Options // Options passed to Walk by the user. - - ignoredDirs []os.FileInfo // The ignored directories, loaded from .goimportsignore files. -} - -// init initializes the walker based on its Options. -func (w *walker) init() { - var ignoredPaths []string - if w.root.Type == RootModuleCache { - ignoredPaths = []string{"cache"} - } - if !w.opts.ModulesEnabled && w.root.Type == RootGOPATH { - ignoredPaths = w.getIgnoredDirs(w.root.Path) - ignoredPaths = append(ignoredPaths, "v", "mod") - } - - for _, p := range ignoredPaths { - full := filepath.Join(w.root.Path, p) - if fi, err := os.Stat(full); err == nil { - w.ignoredDirs = append(w.ignoredDirs, fi) - if w.opts.Debug { - log.Printf("Directory added to ignore list: %s", full) - } - } else if w.opts.Debug { - log.Printf("Error statting ignored directory: %v", err) - } - } -} - -// getIgnoredDirs reads an optional config file at /.goimportsignore -// of relative directories to ignore when scanning for go files. -// The provided path is one of the $GOPATH entries with "src" appended. -func (w *walker) getIgnoredDirs(path string) []string { - file := filepath.Join(path, ".goimportsignore") - slurp, err := ioutil.ReadFile(file) - if w.opts.Debug { - if err != nil { - log.Print(err) - } else { - log.Printf("Read %s", file) - } - } - if err != nil { - return nil - } - - var ignoredDirs []string - bs := bufio.NewScanner(bytes.NewReader(slurp)) - for bs.Scan() { - line := strings.TrimSpace(bs.Text()) - if line == "" || strings.HasPrefix(line, "#") { - continue - } - ignoredDirs = append(ignoredDirs, line) - } - return ignoredDirs -} - -func (w *walker) shouldSkipDir(fi os.FileInfo, dir string) bool { - for _, ignoredDir := range w.ignoredDirs { - if os.SameFile(fi, ignoredDir) { - return true - } - } - if w.skip != nil { - // Check with the user specified callback. - return w.skip(w.root, dir) - } - return false -} - -func (w *walker) walk(path string, typ os.FileMode) error { - dir := filepath.Dir(path) - if typ.IsRegular() { - if dir == w.root.Path && (w.root.Type == RootGOROOT || w.root.Type == RootGOPATH) { - // Doesn't make sense to have regular files - // directly in your $GOPATH/src or $GOROOT/src. - return fastwalk.SkipFiles - } - if !strings.HasSuffix(path, ".go") { - return nil - } - - w.add(w.root, dir) - return fastwalk.SkipFiles - } - if typ == os.ModeDir { - base := filepath.Base(path) - if base == "" || base[0] == '.' || base[0] == '_' || - base == "testdata" || - (w.root.Type == RootGOROOT && w.opts.ModulesEnabled && base == "vendor") || - (!w.opts.ModulesEnabled && base == "node_modules") { - return filepath.SkipDir - } - fi, err := os.Lstat(path) - if err == nil && w.shouldSkipDir(fi, path) { - return filepath.SkipDir - } - return nil - } - if typ == os.ModeSymlink { - base := filepath.Base(path) - if strings.HasPrefix(base, ".#") { - // Emacs noise. - return nil - } - fi, err := os.Lstat(path) - if err != nil { - // Just ignore it. - return nil - } - if w.shouldTraverse(dir, fi) { - return fastwalk.TraverseLink - } - } - return nil -} - -// shouldTraverse reports whether the symlink fi, found in dir, -// should be followed. It makes sure symlinks were never visited -// before to avoid symlink loops. -func (w *walker) shouldTraverse(dir string, fi os.FileInfo) bool { - path := filepath.Join(dir, fi.Name()) - target, err := filepath.EvalSymlinks(path) - if err != nil { - return false - } - ts, err := os.Stat(target) - if err != nil { - fmt.Fprintln(os.Stderr, err) - return false - } - if !ts.IsDir() { - return false - } - if w.shouldSkipDir(ts, dir) { - return false - } - // Check for symlink loops by statting each directory component - // and seeing if any are the same file as ts. - for { - parent := filepath.Dir(path) - if parent == path { - // Made it to the root without seeing a cycle. - // Use this symlink. - return true - } - parentInfo, err := os.Stat(parent) - if err != nil { - return false - } - if os.SameFile(ts, parentInfo) { - // Cycle. Don't traverse. - return false - } - path = parent - } - -} diff --git a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go new file mode 100644 index 0000000000..9702094c59 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go @@ -0,0 +1,28 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package packagesinternal exposes internal-only fields from go/packages. +package packagesinternal + +import ( + "golang.org/x/tools/internal/gocommand" +) + +var GetForTest = func(p interface{}) string { return "" } +var GetDepsErrors = func(p interface{}) []*PackageError { return nil } + +type PackageError struct { + ImportStack []string // shortest path from package named on command line to this one + Pos string // position of error (if present, file:line:col) + Err string // the error itself +} + +var GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return nil } + +var SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) {} + +var TypecheckCgo int + +var SetModFlag = func(config interface{}, value string) {} +var SetModFile = func(config interface{}, value string) {} diff --git a/vendor/golang.org/x/tools/internal/span/parse.go b/vendor/golang.org/x/tools/internal/span/parse.go deleted file mode 100644 index b3f268a38a..0000000000 --- a/vendor/golang.org/x/tools/internal/span/parse.go +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package span - -import ( - "strconv" - "strings" - "unicode/utf8" -) - -// Parse returns the location represented by the input. -// All inputs are valid locations, as they can always be a pure filename. -// The returned span will be normalized, and thus if printed may produce a -// different string. -func Parse(input string) Span { - // :0:0#0-0:0#0 - valid := input - var hold, offset int - hadCol := false - suf := rstripSuffix(input) - if suf.sep == "#" { - offset = suf.num - suf = rstripSuffix(suf.remains) - } - if suf.sep == ":" { - valid = suf.remains - hold = suf.num - hadCol = true - suf = rstripSuffix(suf.remains) - } - switch { - case suf.sep == ":": - return New(NewURI(suf.remains), NewPoint(suf.num, hold, offset), Point{}) - case suf.sep == "-": - // we have a span, fall out of the case to continue - default: - // separator not valid, rewind to either the : or the start - return New(NewURI(valid), NewPoint(hold, 0, offset), Point{}) - } - // only the span form can get here - // at this point we still don't know what the numbers we have mean - // if have not yet seen a : then we might have either a line or a column depending - // on whether start has a column or not - // we build an end point and will fix it later if needed - end := NewPoint(suf.num, hold, offset) - hold, offset = 0, 0 - suf = rstripSuffix(suf.remains) - if suf.sep == "#" { - offset = suf.num - suf = rstripSuffix(suf.remains) - } - if suf.sep != ":" { - // turns out we don't have a span after all, rewind - return New(NewURI(valid), end, Point{}) - } - valid = suf.remains - hold = suf.num - suf = rstripSuffix(suf.remains) - if suf.sep != ":" { - // line#offset only - return New(NewURI(valid), NewPoint(hold, 0, offset), end) - } - // we have a column, so if end only had one number, it is also the column - if !hadCol { - end = NewPoint(suf.num, end.v.Line, end.v.Offset) - } - return New(NewURI(suf.remains), NewPoint(suf.num, hold, offset), end) -} - -type suffix struct { - remains string - sep string - num int -} - -func rstripSuffix(input string) suffix { - if len(input) == 0 { - return suffix{"", "", -1} - } - remains := input - num := -1 - // first see if we have a number at the end - last := strings.LastIndexFunc(remains, func(r rune) bool { return r < '0' || r > '9' }) - if last >= 0 && last < len(remains)-1 { - number, err := strconv.ParseInt(remains[last+1:], 10, 64) - if err == nil { - num = int(number) - remains = remains[:last+1] - } - } - // now see if we have a trailing separator - r, w := utf8.DecodeLastRuneInString(remains) - if r != ':' && r != '#' && r == '#' { - return suffix{input, "", -1} - } - remains = remains[:len(remains)-w] - return suffix{remains, string(r), num} -} diff --git a/vendor/golang.org/x/tools/internal/span/span.go b/vendor/golang.org/x/tools/internal/span/span.go deleted file mode 100644 index 4d2ad09866..0000000000 --- a/vendor/golang.org/x/tools/internal/span/span.go +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package span contains support for representing with positions and ranges in -// text files. -package span - -import ( - "encoding/json" - "fmt" - "path" -) - -// Span represents a source code range in standardized form. -type Span struct { - v span -} - -// Point represents a single point within a file. -// In general this should only be used as part of a Span, as on its own it -// does not carry enough information. -type Point struct { - v point -} - -type span struct { - URI URI `json:"uri"` - Start point `json:"start"` - End point `json:"end"` -} - -type point struct { - Line int `json:"line"` - Column int `json:"column"` - Offset int `json:"offset"` -} - -// Invalid is a span that reports false from IsValid -var Invalid = Span{v: span{Start: invalidPoint.v, End: invalidPoint.v}} - -var invalidPoint = Point{v: point{Line: 0, Column: 0, Offset: -1}} - -// Converter is the interface to an object that can convert between line:column -// and offset forms for a single file. -type Converter interface { - //ToPosition converts from an offset to a line:column pair. - ToPosition(offset int) (int, int, error) - //ToOffset converts from a line:column pair to an offset. - ToOffset(line, col int) (int, error) -} - -func New(uri URI, start Point, end Point) Span { - s := Span{v: span{URI: uri, Start: start.v, End: end.v}} - s.v.clean() - return s -} - -func NewPoint(line, col, offset int) Point { - p := Point{v: point{Line: line, Column: col, Offset: offset}} - p.v.clean() - return p -} - -func Compare(a, b Span) int { - if r := CompareURI(a.URI(), b.URI()); r != 0 { - return r - } - if r := comparePoint(a.v.Start, b.v.Start); r != 0 { - return r - } - return comparePoint(a.v.End, b.v.End) -} - -func ComparePoint(a, b Point) int { - return comparePoint(a.v, b.v) -} - -func comparePoint(a, b point) int { - if !a.hasPosition() { - if a.Offset < b.Offset { - return -1 - } - if a.Offset > b.Offset { - return 1 - } - return 0 - } - if a.Line < b.Line { - return -1 - } - if a.Line > b.Line { - return 1 - } - if a.Column < b.Column { - return -1 - } - if a.Column > b.Column { - return 1 - } - return 0 -} - -func (s Span) HasPosition() bool { return s.v.Start.hasPosition() } -func (s Span) HasOffset() bool { return s.v.Start.hasOffset() } -func (s Span) IsValid() bool { return s.v.Start.isValid() } -func (s Span) IsPoint() bool { return s.v.Start == s.v.End } -func (s Span) URI() URI { return s.v.URI } -func (s Span) Start() Point { return Point{s.v.Start} } -func (s Span) End() Point { return Point{s.v.End} } -func (s *Span) MarshalJSON() ([]byte, error) { return json.Marshal(&s.v) } -func (s *Span) UnmarshalJSON(b []byte) error { return json.Unmarshal(b, &s.v) } - -func (p Point) HasPosition() bool { return p.v.hasPosition() } -func (p Point) HasOffset() bool { return p.v.hasOffset() } -func (p Point) IsValid() bool { return p.v.isValid() } -func (p *Point) MarshalJSON() ([]byte, error) { return json.Marshal(&p.v) } -func (p *Point) UnmarshalJSON(b []byte) error { return json.Unmarshal(b, &p.v) } -func (p Point) Line() int { - if !p.v.hasPosition() { - panic(fmt.Errorf("position not set in %v", p.v)) - } - return p.v.Line -} -func (p Point) Column() int { - if !p.v.hasPosition() { - panic(fmt.Errorf("position not set in %v", p.v)) - } - return p.v.Column -} -func (p Point) Offset() int { - if !p.v.hasOffset() { - panic(fmt.Errorf("offset not set in %v", p.v)) - } - return p.v.Offset -} - -func (p point) hasPosition() bool { return p.Line > 0 } -func (p point) hasOffset() bool { return p.Offset >= 0 } -func (p point) isValid() bool { return p.hasPosition() || p.hasOffset() } -func (p point) isZero() bool { - return (p.Line == 1 && p.Column == 1) || (!p.hasPosition() && p.Offset == 0) -} - -func (s *span) clean() { - //this presumes the points are already clean - if !s.End.isValid() || (s.End == point{}) { - s.End = s.Start - } -} - -func (p *point) clean() { - if p.Line < 0 { - p.Line = 0 - } - if p.Column <= 0 { - if p.Line > 0 { - p.Column = 1 - } else { - p.Column = 0 - } - } - if p.Offset == 0 && (p.Line > 1 || p.Column > 1) { - p.Offset = -1 - } -} - -// Format implements fmt.Formatter to print the Location in a standard form. -// The format produced is one that can be read back in using Parse. -func (s Span) Format(f fmt.State, c rune) { - fullForm := f.Flag('+') - preferOffset := f.Flag('#') - // we should always have a uri, simplify if it is file format - //TODO: make sure the end of the uri is unambiguous - uri := string(s.v.URI) - if c == 'f' { - uri = path.Base(uri) - } else if !fullForm { - uri = s.v.URI.Filename() - } - fmt.Fprint(f, uri) - if !s.IsValid() || (!fullForm && s.v.Start.isZero() && s.v.End.isZero()) { - return - } - // see which bits of start to write - printOffset := s.HasOffset() && (fullForm || preferOffset || !s.HasPosition()) - printLine := s.HasPosition() && (fullForm || !printOffset) - printColumn := printLine && (fullForm || (s.v.Start.Column > 1 || s.v.End.Column > 1)) - fmt.Fprint(f, ":") - if printLine { - fmt.Fprintf(f, "%d", s.v.Start.Line) - } - if printColumn { - fmt.Fprintf(f, ":%d", s.v.Start.Column) - } - if printOffset { - fmt.Fprintf(f, "#%d", s.v.Start.Offset) - } - // start is written, do we need end? - if s.IsPoint() { - return - } - // we don't print the line if it did not change - printLine = fullForm || (printLine && s.v.End.Line > s.v.Start.Line) - fmt.Fprint(f, "-") - if printLine { - fmt.Fprintf(f, "%d", s.v.End.Line) - } - if printColumn { - if printLine { - fmt.Fprint(f, ":") - } - fmt.Fprintf(f, "%d", s.v.End.Column) - } - if printOffset { - fmt.Fprintf(f, "#%d", s.v.End.Offset) - } -} - -func (s Span) WithPosition(c Converter) (Span, error) { - if err := s.update(c, true, false); err != nil { - return Span{}, err - } - return s, nil -} - -func (s Span) WithOffset(c Converter) (Span, error) { - if err := s.update(c, false, true); err != nil { - return Span{}, err - } - return s, nil -} - -func (s Span) WithAll(c Converter) (Span, error) { - if err := s.update(c, true, true); err != nil { - return Span{}, err - } - return s, nil -} - -func (s *Span) update(c Converter, withPos, withOffset bool) error { - if !s.IsValid() { - return fmt.Errorf("cannot add information to an invalid span") - } - if withPos && !s.HasPosition() { - if err := s.v.Start.updatePosition(c); err != nil { - return err - } - if s.v.End.Offset == s.v.Start.Offset { - s.v.End = s.v.Start - } else if err := s.v.End.updatePosition(c); err != nil { - return err - } - } - if withOffset && (!s.HasOffset() || (s.v.End.hasPosition() && !s.v.End.hasOffset())) { - if err := s.v.Start.updateOffset(c); err != nil { - return err - } - if s.v.End.Line == s.v.Start.Line && s.v.End.Column == s.v.Start.Column { - s.v.End.Offset = s.v.Start.Offset - } else if err := s.v.End.updateOffset(c); err != nil { - return err - } - } - return nil -} - -func (p *point) updatePosition(c Converter) error { - line, col, err := c.ToPosition(p.Offset) - if err != nil { - return err - } - p.Line = line - p.Column = col - return nil -} - -func (p *point) updateOffset(c Converter) error { - offset, err := c.ToOffset(p.Line, p.Column) - if err != nil { - return err - } - p.Offset = offset - return nil -} diff --git a/vendor/golang.org/x/tools/internal/span/token.go b/vendor/golang.org/x/tools/internal/span/token.go deleted file mode 100644 index 4028eafa78..0000000000 --- a/vendor/golang.org/x/tools/internal/span/token.go +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package span - -import ( - "fmt" - "go/token" -) - -// Range represents a source code range in token.Pos form. -// It also carries the FileSet that produced the positions, so that it is -// self contained. -type Range struct { - FileSet *token.FileSet - Start token.Pos - End token.Pos - Converter Converter -} - -// TokenConverter is a Converter backed by a token file set and file. -// It uses the file set methods to work out the conversions, which -// makes it fast and does not require the file contents. -type TokenConverter struct { - fset *token.FileSet - file *token.File -} - -// NewRange creates a new Range from a FileSet and two positions. -// To represent a point pass a 0 as the end pos. -func NewRange(fset *token.FileSet, start, end token.Pos) Range { - return Range{ - FileSet: fset, - Start: start, - End: end, - } -} - -// NewTokenConverter returns an implementation of Converter backed by a -// token.File. -func NewTokenConverter(fset *token.FileSet, f *token.File) *TokenConverter { - return &TokenConverter{fset: fset, file: f} -} - -// NewContentConverter returns an implementation of Converter for the -// given file content. -func NewContentConverter(filename string, content []byte) *TokenConverter { - fset := token.NewFileSet() - f := fset.AddFile(filename, -1, len(content)) - f.SetLinesForContent(content) - return &TokenConverter{fset: fset, file: f} -} - -// IsPoint returns true if the range represents a single point. -func (r Range) IsPoint() bool { - return r.Start == r.End -} - -// Span converts a Range to a Span that represents the Range. -// It will fill in all the members of the Span, calculating the line and column -// information. -func (r Range) Span() (Span, error) { - f := r.FileSet.File(r.Start) - if f == nil { - return Span{}, fmt.Errorf("file not found in FileSet") - } - var s Span - var err error - var startFilename string - startFilename, s.v.Start.Line, s.v.Start.Column, err = position(f, r.Start) - if err != nil { - return Span{}, err - } - s.v.URI = FileURI(startFilename) - if r.End.IsValid() { - var endFilename string - endFilename, s.v.End.Line, s.v.End.Column, err = position(f, r.End) - if err != nil { - return Span{}, err - } - // In the presence of line directives, a single File can have sections from - // multiple file names. - if endFilename != startFilename { - return Span{}, fmt.Errorf("span begins in file %q but ends in %q", startFilename, endFilename) - } - } - s.v.Start.clean() - s.v.End.clean() - s.v.clean() - if r.Converter != nil { - return s.WithOffset(r.Converter) - } - if startFilename != f.Name() { - return Span{}, fmt.Errorf("must supply Converter for file %q containing lines from %q", f.Name(), startFilename) - } - return s.WithOffset(NewTokenConverter(r.FileSet, f)) -} - -func position(f *token.File, pos token.Pos) (string, int, int, error) { - off, err := offset(f, pos) - if err != nil { - return "", 0, 0, err - } - return positionFromOffset(f, off) -} - -func positionFromOffset(f *token.File, offset int) (string, int, int, error) { - if offset > f.Size() { - return "", 0, 0, fmt.Errorf("offset %v is past the end of the file %v", offset, f.Size()) - } - pos := f.Pos(offset) - p := f.Position(pos) - if offset == f.Size() { - return p.Filename, p.Line + 1, 1, nil - } - return p.Filename, p.Line, p.Column, nil -} - -// offset is a copy of the Offset function in go/token, but with the adjustment -// that it does not panic on invalid positions. -func offset(f *token.File, pos token.Pos) (int, error) { - if int(pos) < f.Base() || int(pos) > f.Base()+f.Size() { - return 0, fmt.Errorf("invalid pos") - } - return int(pos) - f.Base(), nil -} - -// Range converts a Span to a Range that represents the Span for the supplied -// File. -func (s Span) Range(converter *TokenConverter) (Range, error) { - s, err := s.WithOffset(converter) - if err != nil { - return Range{}, err - } - // go/token will panic if the offset is larger than the file's size, - // so check here to avoid panicking. - if s.Start().Offset() > converter.file.Size() { - return Range{}, fmt.Errorf("start offset %v is past the end of the file %v", s.Start(), converter.file.Size()) - } - if s.End().Offset() > converter.file.Size() { - return Range{}, fmt.Errorf("end offset %v is past the end of the file %v", s.End(), converter.file.Size()) - } - return Range{ - FileSet: converter.fset, - Start: converter.file.Pos(s.Start().Offset()), - End: converter.file.Pos(s.End().Offset()), - Converter: converter, - }, nil -} - -func (l *TokenConverter) ToPosition(offset int) (int, int, error) { - _, line, col, err := positionFromOffset(l.file, offset) - return line, col, err -} - -func (l *TokenConverter) ToOffset(line, col int) (int, error) { - if line < 0 { - return -1, fmt.Errorf("line is not valid") - } - lineMax := l.file.LineCount() + 1 - if line > lineMax { - return -1, fmt.Errorf("line is beyond end of file %v", lineMax) - } else if line == lineMax { - if col > 1 { - return -1, fmt.Errorf("column is beyond end of file") - } - // at the end of the file, allowing for a trailing eol - return l.file.Size(), nil - } - pos := lineStart(l.file, line) - if !pos.IsValid() { - return -1, fmt.Errorf("line is not in file") - } - // we assume that column is in bytes here, and that the first byte of a - // line is at column 1 - pos += token.Pos(col - 1) - return offset(l.file, pos) -} diff --git a/vendor/golang.org/x/tools/internal/span/token111.go b/vendor/golang.org/x/tools/internal/span/token111.go deleted file mode 100644 index bf7a5406b6..0000000000 --- a/vendor/golang.org/x/tools/internal/span/token111.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build !go1.12 - -package span - -import ( - "go/token" -) - -// lineStart is the pre-Go 1.12 version of (*token.File).LineStart. For Go -// versions <= 1.11, we borrow logic from the analysisutil package. -// TODO(rstambler): Delete this file when we no longer support Go 1.11. -func lineStart(f *token.File, line int) token.Pos { - // Use binary search to find the start offset of this line. - - min := 0 // inclusive - max := f.Size() // exclusive - for { - offset := (min + max) / 2 - pos := f.Pos(offset) - posn := f.Position(pos) - if posn.Line == line { - return pos - (token.Pos(posn.Column) - 1) - } - - if min+1 >= max { - return token.NoPos - } - - if posn.Line < line { - min = offset - } else { - max = offset - } - } -} diff --git a/vendor/golang.org/x/tools/internal/span/token112.go b/vendor/golang.org/x/tools/internal/span/token112.go deleted file mode 100644 index 017aec9c13..0000000000 --- a/vendor/golang.org/x/tools/internal/span/token112.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.12 - -package span - -import ( - "go/token" -) - -// TODO(rstambler): Delete this file when we no longer support Go 1.11. -func lineStart(f *token.File, line int) token.Pos { - return f.LineStart(line) -} diff --git a/vendor/golang.org/x/tools/internal/span/uri.go b/vendor/golang.org/x/tools/internal/span/uri.go deleted file mode 100644 index e05a9e6ef5..0000000000 --- a/vendor/golang.org/x/tools/internal/span/uri.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package span - -import ( - "fmt" - "net/url" - "os" - "path" - "path/filepath" - "runtime" - "strings" - "unicode" -) - -const fileScheme = "file" - -// URI represents the full URI for a file. -type URI string - -// Filename returns the file path for the given URI. -// It is an error to call this on a URI that is not a valid filename. -func (uri URI) Filename() string { - filename, err := filename(uri) - if err != nil { - panic(err) - } - return filepath.FromSlash(filename) -} - -func filename(uri URI) (string, error) { - if uri == "" { - return "", nil - } - u, err := url.ParseRequestURI(string(uri)) - if err != nil { - return "", err - } - if u.Scheme != fileScheme { - return "", fmt.Errorf("only file URIs are supported, got %q from %q", u.Scheme, uri) - } - if isWindowsDriveURI(u.Path) { - u.Path = u.Path[1:] - } - return u.Path, nil -} - -// NewURI returns a span URI for the string. -// It will attempt to detect if the string is a file path or uri. -func NewURI(s string) URI { - if u, err := url.PathUnescape(s); err == nil { - s = u - } - if strings.HasPrefix(s, fileScheme+"://") { - return URI(s) - } - return FileURI(s) -} - -func CompareURI(a, b URI) int { - if equalURI(a, b) { - return 0 - } - if a < b { - return -1 - } - return 1 -} - -func equalURI(a, b URI) bool { - if a == b { - return true - } - // If we have the same URI basename, we may still have the same file URIs. - if !strings.EqualFold(path.Base(string(a)), path.Base(string(b))) { - return false - } - fa, err := filename(a) - if err != nil { - return false - } - fb, err := filename(b) - if err != nil { - return false - } - // Stat the files to check if they are equal. - infoa, err := os.Stat(filepath.FromSlash(fa)) - if err != nil { - return false - } - infob, err := os.Stat(filepath.FromSlash(fb)) - if err != nil { - return false - } - return os.SameFile(infoa, infob) -} - -// FileURI returns a span URI for the supplied file path. -// It will always have the file scheme. -func FileURI(path string) URI { - if path == "" { - return "" - } - // Handle standard library paths that contain the literal "$GOROOT". - // TODO(rstambler): The go/packages API should allow one to determine a user's $GOROOT. - const prefix = "$GOROOT" - if len(path) >= len(prefix) && strings.EqualFold(prefix, path[:len(prefix)]) { - suffix := path[len(prefix):] - path = runtime.GOROOT() + suffix - } - if !isWindowsDrivePath(path) { - if abs, err := filepath.Abs(path); err == nil { - path = abs - } - } - // Check the file path again, in case it became absolute. - if isWindowsDrivePath(path) { - path = "/" + path - } - path = filepath.ToSlash(path) - u := url.URL{ - Scheme: fileScheme, - Path: path, - } - uri := u.String() - if unescaped, err := url.PathUnescape(uri); err == nil { - uri = unescaped - } - return URI(uri) -} - -// isWindowsDrivePath returns true if the file path is of the form used by -// Windows. We check if the path begins with a drive letter, followed by a ":". -func isWindowsDrivePath(path string) bool { - if len(path) < 4 { - return false - } - return unicode.IsLetter(rune(path[0])) && path[1] == ':' -} - -// isWindowsDriveURI returns true if the file URI is of the format used by -// Windows URIs. The url.Parse package does not specially handle Windows paths -// (see https://golang.org/issue/6027). We check if the URI path has -// a drive prefix (e.g. "/C:"). If so, we trim the leading "/". -func isWindowsDriveURI(uri string) bool { - if len(uri) < 4 { - return false - } - return uri[0] == '/' && unicode.IsLetter(rune(uri[1])) && uri[2] == ':' -} diff --git a/vendor/golang.org/x/tools/internal/span/utf16.go b/vendor/golang.org/x/tools/internal/span/utf16.go deleted file mode 100644 index 561b3fa50a..0000000000 --- a/vendor/golang.org/x/tools/internal/span/utf16.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package span - -import ( - "fmt" - "unicode/utf16" - "unicode/utf8" -) - -// ToUTF16Column calculates the utf16 column expressed by the point given the -// supplied file contents. -// This is used to convert from the native (always in bytes) column -// representation and the utf16 counts used by some editors. -func ToUTF16Column(p Point, content []byte) (int, error) { - if content == nil { - return -1, fmt.Errorf("ToUTF16Column: missing content") - } - if !p.HasPosition() { - return -1, fmt.Errorf("ToUTF16Column: point is missing position") - } - if !p.HasOffset() { - return -1, fmt.Errorf("ToUTF16Column: point is missing offset") - } - offset := p.Offset() // 0-based - colZero := p.Column() - 1 // 0-based - if colZero == 0 { - // 0-based column 0, so it must be chr 1 - return 1, nil - } else if colZero < 0 { - return -1, fmt.Errorf("ToUTF16Column: column is invalid (%v)", colZero) - } - // work out the offset at the start of the line using the column - lineOffset := offset - colZero - if lineOffset < 0 || offset > len(content) { - return -1, fmt.Errorf("ToUTF16Column: offsets %v-%v outside file contents (%v)", lineOffset, offset, len(content)) - } - // Use the offset to pick out the line start. - // This cannot panic: offset > len(content) and lineOffset < offset. - start := content[lineOffset:] - - // Now, truncate down to the supplied column. - start = start[:colZero] - - // and count the number of utf16 characters - // in theory we could do this by hand more efficiently... - return len(utf16.Encode([]rune(string(start)))) + 1, nil -} - -// FromUTF16Column advances the point by the utf16 character offset given the -// supplied line contents. -// This is used to convert from the utf16 counts used by some editors to the -// native (always in bytes) column representation. -func FromUTF16Column(p Point, chr int, content []byte) (Point, error) { - if !p.HasOffset() { - return Point{}, fmt.Errorf("FromUTF16Column: point is missing offset") - } - // if chr is 1 then no adjustment needed - if chr <= 1 { - return p, nil - } - if p.Offset() >= len(content) { - return p, fmt.Errorf("FromUTF16Column: offset (%v) greater than length of content (%v)", p.Offset(), len(content)) - } - remains := content[p.Offset():] - // scan forward the specified number of characters - for count := 1; count < chr; count++ { - if len(remains) <= 0 { - return Point{}, fmt.Errorf("FromUTF16Column: chr goes beyond the content") - } - r, w := utf8.DecodeRune(remains) - if r == '\n' { - // Per the LSP spec: - // - // > If the character value is greater than the line length it - // > defaults back to the line length. - break - } - remains = remains[w:] - if r >= 0x10000 { - // a two point rune - count++ - // if we finished in a two point rune, do not advance past the first - if count >= chr { - break - } - } - p.v.Column += w - p.v.Offset += w - } - return p, nil -} diff --git a/vendor/golang.org/x/tools/internal/typeparams/common.go b/vendor/golang.org/x/tools/internal/typeparams/common.go new file mode 100644 index 0000000000..961d036fdb --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/common.go @@ -0,0 +1,32 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package typeparams provides functions to work indirectly with type parameter +// data stored in go/ast and go/types objects, while these API are guarded by a +// build constraint. +// +// This package exists to make it easier for tools to work with generic code, +// while also compiling against older Go versions. +package typeparams + +import ( + "go/ast" + "go/token" + "go/types" +) + +// A IndexExprData holds data from both ast.IndexExpr and the new +// ast.MultiIndexExpr, which was introduced in Go 1.18. +type IndexExprData struct { + X ast.Expr // expression + Lbrack token.Pos // position of "[" + Indices []ast.Expr // index expressions + Rbrack token.Pos // position of "]" +} + +// IsTypeParam reports whether t is a type parameter. +func IsTypeParam(t types.Type) bool { + _, ok := t.(*TypeParam) + return ok +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go b/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go new file mode 100644 index 0000000000..18212390e1 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/enabled_go117.go @@ -0,0 +1,12 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.18 +// +build !go1.18 + +package typeparams + +// Enabled reports whether type parameters are enabled in the current build +// environment. +const Enabled = false diff --git a/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go b/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go new file mode 100644 index 0000000000..d67148823c --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/enabled_go118.go @@ -0,0 +1,15 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.18 +// +build go1.18 + +package typeparams + +// Note: this constant is in a separate file as this is the only acceptable +// diff between the <1.18 API of this package and the 1.18 API. + +// Enabled reports whether type parameters are enabled in the current build +// environment. +const Enabled = true diff --git a/vendor/golang.org/x/tools/internal/typeparams/normalize.go b/vendor/golang.org/x/tools/internal/typeparams/normalize.go new file mode 100644 index 0000000000..090f142a5f --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/normalize.go @@ -0,0 +1,216 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package typeparams + +import ( + "errors" + "fmt" + "go/types" + "os" + "strings" +) + +//go:generate go run copytermlist.go + +const debug = false + +var ErrEmptyTypeSet = errors.New("empty type set") + +// StructuralTerms returns a slice of terms representing the normalized +// structural type restrictions of a type parameter, if any. +// +// Structural type restrictions of a type parameter are created via +// non-interface types embedded in its constraint interface (directly, or via a +// chain of interface embeddings). For example, in the declaration +// type T[P interface{~int; m()}] int +// the structural restriction of the type parameter P is ~int. +// +// With interface embedding and unions, the specification of structural type +// restrictions may be arbitrarily complex. For example, consider the +// following: +// +// type A interface{ ~string|~[]byte } +// +// type B interface{ int|string } +// +// type C interface { ~string|~int } +// +// type T[P interface{ A|B; C }] int +// +// In this example, the structural type restriction of P is ~string|int: A|B +// expands to ~string|~[]byte|int|string, which reduces to ~string|~[]byte|int, +// which when intersected with C (~string|~int) yields ~string|int. +// +// StructuralTerms computes these expansions and reductions, producing a +// "normalized" form of the embeddings. A structural restriction is normalized +// if it is a single union containing no interface terms, and is minimal in the +// sense that removing any term changes the set of types satisfying the +// constraint. It is left as a proof for the reader that, modulo sorting, there +// is exactly one such normalized form. +// +// Because the minimal representation always takes this form, StructuralTerms +// returns a slice of tilde terms corresponding to the terms of the union in +// the normalized structural restriction. An error is returned if the +// constraint interface is invalid, exceeds complexity bounds, or has an empty +// type set. In the latter case, StructuralTerms returns ErrEmptyTypeSet. +// +// StructuralTerms makes no guarantees about the order of terms, except that it +// is deterministic. +func StructuralTerms(tparam *TypeParam) ([]*Term, error) { + constraint := tparam.Constraint() + if constraint == nil { + return nil, fmt.Errorf("%s has nil constraint", tparam) + } + iface, _ := constraint.Underlying().(*types.Interface) + if iface == nil { + return nil, fmt.Errorf("constraint is %T, not *types.Interface", constraint.Underlying()) + } + return InterfaceTermSet(iface) +} + +// InterfaceTermSet computes the normalized terms for a constraint interface, +// returning an error if the term set cannot be computed or is empty. In the +// latter case, the error will be ErrEmptyTypeSet. +// +// See the documentation of StructuralTerms for more information on +// normalization. +func InterfaceTermSet(iface *types.Interface) ([]*Term, error) { + return computeTermSet(iface) +} + +// UnionTermSet computes the normalized terms for a union, returning an error +// if the term set cannot be computed or is empty. In the latter case, the +// error will be ErrEmptyTypeSet. +// +// See the documentation of StructuralTerms for more information on +// normalization. +func UnionTermSet(union *Union) ([]*Term, error) { + return computeTermSet(union) +} + +func computeTermSet(typ types.Type) ([]*Term, error) { + tset, err := computeTermSetInternal(typ, make(map[types.Type]*termSet), 0) + if err != nil { + return nil, err + } + if tset.terms.isEmpty() { + return nil, ErrEmptyTypeSet + } + if tset.terms.isAll() { + return nil, nil + } + var terms []*Term + for _, term := range tset.terms { + terms = append(terms, NewTerm(term.tilde, term.typ)) + } + return terms, nil +} + +// A termSet holds the normalized set of terms for a given type. +// +// The name termSet is intentionally distinct from 'type set': a type set is +// all types that implement a type (and includes method restrictions), whereas +// a term set just represents the structural restrictions on a type. +type termSet struct { + complete bool + terms termlist +} + +func indentf(depth int, format string, args ...interface{}) { + fmt.Fprintf(os.Stderr, strings.Repeat(".", depth)+format+"\n", args...) +} + +func computeTermSetInternal(t types.Type, seen map[types.Type]*termSet, depth int) (res *termSet, err error) { + if t == nil { + panic("nil type") + } + + if debug { + indentf(depth, "%s", t.String()) + defer func() { + if err != nil { + indentf(depth, "=> %s", err) + } else { + indentf(depth, "=> %s", res.terms.String()) + } + }() + } + + const maxTermCount = 100 + if tset, ok := seen[t]; ok { + if !tset.complete { + return nil, fmt.Errorf("cycle detected in the declaration of %s", t) + } + return tset, nil + } + + // Mark the current type as seen to avoid infinite recursion. + tset := new(termSet) + defer func() { + tset.complete = true + }() + seen[t] = tset + + switch u := t.Underlying().(type) { + case *types.Interface: + // The term set of an interface is the intersection of the term sets of its + // embedded types. + tset.terms = allTermlist + for i := 0; i < u.NumEmbeddeds(); i++ { + embedded := u.EmbeddedType(i) + if _, ok := embedded.Underlying().(*TypeParam); ok { + return nil, fmt.Errorf("invalid embedded type %T", embedded) + } + tset2, err := computeTermSetInternal(embedded, seen, depth+1) + if err != nil { + return nil, err + } + tset.terms = tset.terms.intersect(tset2.terms) + } + case *Union: + // The term set of a union is the union of term sets of its terms. + tset.terms = nil + for i := 0; i < u.Len(); i++ { + t := u.Term(i) + var terms termlist + switch t.Type().Underlying().(type) { + case *types.Interface: + tset2, err := computeTermSetInternal(t.Type(), seen, depth+1) + if err != nil { + return nil, err + } + terms = tset2.terms + case *TypeParam, *Union: + // A stand-alone type parameter or union is not permitted as union + // term. + return nil, fmt.Errorf("invalid union term %T", t) + default: + if t.Type() == types.Typ[types.Invalid] { + continue + } + terms = termlist{{t.Tilde(), t.Type()}} + } + tset.terms = tset.terms.union(terms) + if len(tset.terms) > maxTermCount { + return nil, fmt.Errorf("exceeded max term count %d", maxTermCount) + } + } + case *TypeParam: + panic("unreachable") + default: + // For all other types, the term set is just a single non-tilde term + // holding the type itself. + if u != types.Typ[types.Invalid] { + tset.terms = termlist{{false, t}} + } + } + return tset, nil +} + +// under is a facade for the go/types internal function of the same name. It is +// used by typeterm.go. +func under(t types.Type) types.Type { + return t.Underlying() +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/termlist.go b/vendor/golang.org/x/tools/internal/typeparams/termlist.go new file mode 100644 index 0000000000..10857d504c --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/termlist.go @@ -0,0 +1,172 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by copytermlist.go DO NOT EDIT. + +package typeparams + +import ( + "bytes" + "go/types" +) + +// A termlist represents the type set represented by the union +// t1 ∪ y2 ∪ ... tn of the type sets of the terms t1 to tn. +// A termlist is in normal form if all terms are disjoint. +// termlist operations don't require the operands to be in +// normal form. +type termlist []*term + +// allTermlist represents the set of all types. +// It is in normal form. +var allTermlist = termlist{new(term)} + +// String prints the termlist exactly (without normalization). +func (xl termlist) String() string { + if len(xl) == 0 { + return "∅" + } + var buf bytes.Buffer + for i, x := range xl { + if i > 0 { + buf.WriteString(" ∪ ") + } + buf.WriteString(x.String()) + } + return buf.String() +} + +// isEmpty reports whether the termlist xl represents the empty set of types. +func (xl termlist) isEmpty() bool { + // If there's a non-nil term, the entire list is not empty. + // If the termlist is in normal form, this requires at most + // one iteration. + for _, x := range xl { + if x != nil { + return false + } + } + return true +} + +// isAll reports whether the termlist xl represents the set of all types. +func (xl termlist) isAll() bool { + // If there's a 𝓤 term, the entire list is 𝓤. + // If the termlist is in normal form, this requires at most + // one iteration. + for _, x := range xl { + if x != nil && x.typ == nil { + return true + } + } + return false +} + +// norm returns the normal form of xl. +func (xl termlist) norm() termlist { + // Quadratic algorithm, but good enough for now. + // TODO(gri) fix asymptotic performance + used := make([]bool, len(xl)) + var rl termlist + for i, xi := range xl { + if xi == nil || used[i] { + continue + } + for j := i + 1; j < len(xl); j++ { + xj := xl[j] + if xj == nil || used[j] { + continue + } + if u1, u2 := xi.union(xj); u2 == nil { + // If we encounter a 𝓤 term, the entire list is 𝓤. + // Exit early. + // (Note that this is not just an optimization; + // if we continue, we may end up with a 𝓤 term + // and other terms and the result would not be + // in normal form.) + if u1.typ == nil { + return allTermlist + } + xi = u1 + used[j] = true // xj is now unioned into xi - ignore it in future iterations + } + } + rl = append(rl, xi) + } + return rl +} + +// If the type set represented by xl is specified by a single (non-𝓤) term, +// structuralType returns that type. Otherwise it returns nil. +func (xl termlist) structuralType() types.Type { + if nl := xl.norm(); len(nl) == 1 { + return nl[0].typ // if nl.isAll() then typ is nil, which is ok + } + return nil +} + +// union returns the union xl ∪ yl. +func (xl termlist) union(yl termlist) termlist { + return append(xl, yl...).norm() +} + +// intersect returns the intersection xl ∩ yl. +func (xl termlist) intersect(yl termlist) termlist { + if xl.isEmpty() || yl.isEmpty() { + return nil + } + + // Quadratic algorithm, but good enough for now. + // TODO(gri) fix asymptotic performance + var rl termlist + for _, x := range xl { + for _, y := range yl { + if r := x.intersect(y); r != nil { + rl = append(rl, r) + } + } + } + return rl.norm() +} + +// equal reports whether xl and yl represent the same type set. +func (xl termlist) equal(yl termlist) bool { + // TODO(gri) this should be more efficient + return xl.subsetOf(yl) && yl.subsetOf(xl) +} + +// includes reports whether t ∈ xl. +func (xl termlist) includes(t types.Type) bool { + for _, x := range xl { + if x.includes(t) { + return true + } + } + return false +} + +// supersetOf reports whether y ⊆ xl. +func (xl termlist) supersetOf(y *term) bool { + for _, x := range xl { + if y.subsetOf(x) { + return true + } + } + return false +} + +// subsetOf reports whether xl ⊆ yl. +func (xl termlist) subsetOf(yl termlist) bool { + if yl.isEmpty() { + return xl.isEmpty() + } + + // each term x of xl must be a subset of yl + for _, x := range xl { + if !yl.supersetOf(x) { + return false // x is not a subset yl + } + } + return true +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go new file mode 100644 index 0000000000..e509daf7be --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go117.go @@ -0,0 +1,224 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !go1.18 +// +build !go1.18 + +package typeparams + +import ( + "go/ast" + "go/token" + "go/types" +) + +func unsupported() { + panic("type parameters are unsupported at this go version") +} + +// GetIndexExprData extracts data from *ast.IndexExpr nodes. +// For other nodes, GetIndexExprData returns nil. +func GetIndexExprData(n ast.Node) *IndexExprData { + if e, _ := n.(*ast.IndexExpr); e != nil { + return &IndexExprData{ + X: e.X, + Lbrack: e.Lbrack, + Indices: []ast.Expr{e.Index}, + Rbrack: e.Rbrack, + } + } + return nil +} + +// PackIndexExpr returns an *ast.IndexExpr with the given index. +// Calling PackIndexExpr with len(indices) != 1 will panic. +func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr { + switch len(indices) { + case 0: + panic("empty indices") + case 1: + return &ast.IndexExpr{ + X: x, + Lbrack: lbrack, + Index: indices[0], + Rbrack: rbrack, + } + default: + panic("cannot pack multiple indices at this go version") + } +} + +// IndexListExpr is a placeholder type, as type parameters are not supported at +// this Go version. Its methods panic on use. +type IndexListExpr struct { + ast.Expr + X ast.Expr // expression + Lbrack token.Pos // position of "[" + Indices []ast.Expr // index expressions + Rbrack token.Pos // position of "]" +} + +// ForTypeSpec returns an empty field list, as type parameters on not supported +// at this Go version. +func ForTypeSpec(*ast.TypeSpec) *ast.FieldList { + return nil +} + +// ForFuncType returns an empty field list, as type parameters are not +// supported at this Go version. +func ForFuncType(*ast.FuncType) *ast.FieldList { + return nil +} + +// TypeParam is a placeholder type, as type parameters are not supported at +// this Go version. Its methods panic on use. +type TypeParam struct{ types.Type } + +func (*TypeParam) Index() int { unsupported(); return 0 } +func (*TypeParam) Constraint() types.Type { unsupported(); return nil } +func (*TypeParam) Obj() *types.TypeName { unsupported(); return nil } + +// TypeParamList is a placeholder for an empty type parameter list. +type TypeParamList struct{} + +func (*TypeParamList) Len() int { return 0 } +func (*TypeParamList) At(int) *TypeParam { unsupported(); return nil } + +// TypeList is a placeholder for an empty type list. +type TypeList struct{} + +func (*TypeList) Len() int { return 0 } +func (*TypeList) At(int) types.Type { unsupported(); return nil } + +// NewTypeParam is unsupported at this Go version, and panics. +func NewTypeParam(name *types.TypeName, constraint types.Type) *TypeParam { + unsupported() + return nil +} + +// SetTypeParamConstraint is unsupported at this Go version, and panics. +func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) { + unsupported() +} + +// NewSignatureType calls types.NewSignature, panicking if recvTypeParams or +// typeParams is non-empty. +func NewSignatureType(recv *types.Var, recvTypeParams, typeParams []*TypeParam, params, results *types.Tuple, variadic bool) *types.Signature { + if len(recvTypeParams) != 0 || len(typeParams) != 0 { + panic("signatures cannot have type parameters at this Go version") + } + return types.NewSignature(recv, params, results, variadic) +} + +// ForSignature returns an empty slice. +func ForSignature(*types.Signature) *TypeParamList { + return nil +} + +// RecvTypeParams returns a nil slice. +func RecvTypeParams(sig *types.Signature) *TypeParamList { + return nil +} + +// IsComparable returns false, as no interfaces are type-restricted at this Go +// version. +func IsComparable(*types.Interface) bool { + return false +} + +// IsMethodSet returns true, as no interfaces are type-restricted at this Go +// version. +func IsMethodSet(*types.Interface) bool { + return true +} + +// IsImplicit returns false, as no interfaces are implicit at this Go version. +func IsImplicit(*types.Interface) bool { + return false +} + +// MarkImplicit does nothing, because this Go version does not have implicit +// interfaces. +func MarkImplicit(*types.Interface) {} + +// ForNamed returns an empty type parameter list, as type parameters are not +// supported at this Go version. +func ForNamed(*types.Named) *TypeParamList { + return nil +} + +// SetForNamed panics if tparams is non-empty. +func SetForNamed(_ *types.Named, tparams []*TypeParam) { + if len(tparams) > 0 { + unsupported() + } +} + +// NamedTypeArgs returns nil. +func NamedTypeArgs(*types.Named) *TypeList { + return nil +} + +// NamedTypeOrigin is the identity method at this Go version. +func NamedTypeOrigin(named *types.Named) types.Type { + return named +} + +// Term holds information about a structural type restriction. +type Term struct { + tilde bool + typ types.Type +} + +func (m *Term) Tilde() bool { return m.tilde } +func (m *Term) Type() types.Type { return m.typ } +func (m *Term) String() string { + pre := "" + if m.tilde { + pre = "~" + } + return pre + m.typ.String() +} + +// NewTerm is unsupported at this Go version, and panics. +func NewTerm(tilde bool, typ types.Type) *Term { + return &Term{tilde, typ} +} + +// Union is a placeholder type, as type parameters are not supported at this Go +// version. Its methods panic on use. +type Union struct{ types.Type } + +func (*Union) Len() int { return 0 } +func (*Union) Term(i int) *Term { unsupported(); return nil } + +// NewUnion is unsupported at this Go version, and panics. +func NewUnion(terms []*Term) *Union { + unsupported() + return nil +} + +// InitInstanceInfo is a noop at this Go version. +func InitInstanceInfo(*types.Info) {} + +// Instance is a placeholder type, as type parameters are not supported at this +// Go version. +type Instance struct { + TypeArgs *TypeList + Type types.Type +} + +// GetInstances returns a nil map, as type parameters are not supported at this +// Go version. +func GetInstances(info *types.Info) map[*ast.Ident]Instance { return nil } + +// Context is a placeholder type, as type parameters are not supported at +// this Go version. +type Context struct{} + +// Instantiate is unsupported on this Go version, and panics. +func Instantiate(ctxt *Context, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { + unsupported() + return nil, nil +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go new file mode 100644 index 0000000000..e45896fb02 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/typeparams_go118.go @@ -0,0 +1,196 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.18 +// +build go1.18 + +package typeparams + +import ( + "go/ast" + "go/token" + "go/types" +) + +// GetIndexExprData extracts data from AST nodes that represent index +// expressions. +// +// For an ast.IndexExpr, the resulting IndexExprData will have exactly one +// index expression. For an ast.IndexListExpr (go1.18+), it may have a +// variable number of index expressions. +// +// For nodes that don't represent index expressions, GetIndexExprData returns +// nil. +// TODO(rfindley): remove this function in favor of using the alias below. +func GetIndexExprData(n ast.Node) *IndexExprData { + switch e := n.(type) { + case *ast.IndexExpr: + return &IndexExprData{ + X: e.X, + Lbrack: e.Lbrack, + Indices: []ast.Expr{e.Index}, + Rbrack: e.Rbrack, + } + case *ast.IndexListExpr: + return (*IndexExprData)(e) + } + return nil +} + +// PackIndexExpr returns an *ast.IndexExpr or *ast.IndexListExpr, depending on +// the cardinality of indices. Calling PackIndexExpr with len(indices) == 0 +// will panic. +func PackIndexExpr(x ast.Expr, lbrack token.Pos, indices []ast.Expr, rbrack token.Pos) ast.Expr { + switch len(indices) { + case 0: + panic("empty indices") + case 1: + return &ast.IndexExpr{ + X: x, + Lbrack: lbrack, + Index: indices[0], + Rbrack: rbrack, + } + default: + return &ast.IndexListExpr{ + X: x, + Lbrack: lbrack, + Indices: indices, + Rbrack: rbrack, + } + } +} + +// IndexListExpr is an alias for ast.IndexListExpr. +type IndexListExpr = ast.IndexListExpr + +// ForTypeSpec returns n.TypeParams. +func ForTypeSpec(n *ast.TypeSpec) *ast.FieldList { + if n == nil { + return nil + } + return n.TypeParams +} + +// ForFuncType returns n.TypeParams. +func ForFuncType(n *ast.FuncType) *ast.FieldList { + if n == nil { + return nil + } + return n.TypeParams +} + +// TypeParam is an alias for types.TypeParam +type TypeParam = types.TypeParam + +// TypeParamList is an alias for types.TypeParamList +type TypeParamList = types.TypeParamList + +// TypeList is an alias for types.TypeList +type TypeList = types.TypeList + +// NewTypeParam calls types.NewTypeParam. +func NewTypeParam(name *types.TypeName, constraint types.Type) *TypeParam { + return types.NewTypeParam(name, constraint) +} + +// SetTypeParamConstraint calls tparam.SetConstraint(constraint). +func SetTypeParamConstraint(tparam *TypeParam, constraint types.Type) { + tparam.SetConstraint(constraint) +} + +// NewSignatureType calls types.NewSignatureType. +func NewSignatureType(recv *types.Var, recvTypeParams, typeParams []*TypeParam, params, results *types.Tuple, variadic bool) *types.Signature { + return types.NewSignatureType(recv, recvTypeParams, typeParams, params, results, variadic) +} + +// ForSignature returns sig.TypeParams() +func ForSignature(sig *types.Signature) *TypeParamList { + return sig.TypeParams() +} + +// RecvTypeParams returns sig.RecvTypeParams(). +func RecvTypeParams(sig *types.Signature) *TypeParamList { + return sig.RecvTypeParams() +} + +// IsComparable calls iface.IsComparable(). +func IsComparable(iface *types.Interface) bool { + return iface.IsComparable() +} + +// IsMethodSet calls iface.IsMethodSet(). +func IsMethodSet(iface *types.Interface) bool { + return iface.IsMethodSet() +} + +// IsImplicit calls iface.IsImplicit(). +func IsImplicit(iface *types.Interface) bool { + return iface.IsImplicit() +} + +// MarkImplicit calls iface.MarkImplicit(). +func MarkImplicit(iface *types.Interface) { + iface.MarkImplicit() +} + +// ForNamed extracts the (possibly empty) type parameter object list from +// named. +func ForNamed(named *types.Named) *TypeParamList { + return named.TypeParams() +} + +// SetForNamed sets the type params tparams on n. Each tparam must be of +// dynamic type *types.TypeParam. +func SetForNamed(n *types.Named, tparams []*TypeParam) { + n.SetTypeParams(tparams) +} + +// NamedTypeArgs returns named.TypeArgs(). +func NamedTypeArgs(named *types.Named) *TypeList { + return named.TypeArgs() +} + +// NamedTypeOrigin returns named.Orig(). +func NamedTypeOrigin(named *types.Named) types.Type { + return named.Origin() +} + +// Term is an alias for types.Term. +type Term = types.Term + +// NewTerm calls types.NewTerm. +func NewTerm(tilde bool, typ types.Type) *Term { + return types.NewTerm(tilde, typ) +} + +// Union is an alias for types.Union +type Union = types.Union + +// NewUnion calls types.NewUnion. +func NewUnion(terms []*Term) *Union { + return types.NewUnion(terms) +} + +// InitInstanceInfo initializes info to record information about type and +// function instances. +func InitInstanceInfo(info *types.Info) { + info.Instances = make(map[*ast.Ident]types.Instance) +} + +// Instance is an alias for types.Instance. +type Instance = types.Instance + +// GetInstances returns info.Instances. +func GetInstances(info *types.Info) map[*ast.Ident]Instance { + return info.Instances +} + +// Context is an alias for types.Context. +type Context = types.Context + +// Instantiate calls types.Instantiate. +func Instantiate(ctxt *Context, typ types.Type, targs []types.Type, validate bool) (types.Type, error) { + return types.Instantiate(ctxt, typ, targs, validate) +} diff --git a/vendor/golang.org/x/tools/internal/typeparams/typeterm.go b/vendor/golang.org/x/tools/internal/typeparams/typeterm.go new file mode 100644 index 0000000000..7ddee28d98 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typeparams/typeterm.go @@ -0,0 +1,170 @@ +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by copytermlist.go DO NOT EDIT. + +package typeparams + +import "go/types" + +// A term describes elementary type sets: +// +// ∅: (*term)(nil) == ∅ // set of no types (empty set) +// 𝓤: &term{} == 𝓤 // set of all types (𝓤niverse) +// T: &term{false, T} == {T} // set of type T +// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type t +// +type term struct { + tilde bool // valid if typ != nil + typ types.Type +} + +func (x *term) String() string { + switch { + case x == nil: + return "∅" + case x.typ == nil: + return "𝓤" + case x.tilde: + return "~" + x.typ.String() + default: + return x.typ.String() + } +} + +// equal reports whether x and y represent the same type set. +func (x *term) equal(y *term) bool { + // easy cases + switch { + case x == nil || y == nil: + return x == y + case x.typ == nil || y.typ == nil: + return x.typ == y.typ + } + // ∅ ⊂ x, y ⊂ 𝓤 + + return x.tilde == y.tilde && types.Identical(x.typ, y.typ) +} + +// union returns the union x ∪ y: zero, one, or two non-nil terms. +func (x *term) union(y *term) (_, _ *term) { + // easy cases + switch { + case x == nil && y == nil: + return nil, nil // ∅ ∪ ∅ == ∅ + case x == nil: + return y, nil // ∅ ∪ y == y + case y == nil: + return x, nil // x ∪ ∅ == x + case x.typ == nil: + return x, nil // 𝓤 ∪ y == 𝓤 + case y.typ == nil: + return y, nil // x ∪ 𝓤 == 𝓤 + } + // ∅ ⊂ x, y ⊂ 𝓤 + + if x.disjoint(y) { + return x, y // x ∪ y == (x, y) if x ∩ y == ∅ + } + // x.typ == y.typ + + // ~t ∪ ~t == ~t + // ~t ∪ T == ~t + // T ∪ ~t == ~t + // T ∪ T == T + if x.tilde || !y.tilde { + return x, nil + } + return y, nil +} + +// intersect returns the intersection x ∩ y. +func (x *term) intersect(y *term) *term { + // easy cases + switch { + case x == nil || y == nil: + return nil // ∅ ∩ y == ∅ and ∩ ∅ == ∅ + case x.typ == nil: + return y // 𝓤 ∩ y == y + case y.typ == nil: + return x // x ∩ 𝓤 == x + } + // ∅ ⊂ x, y ⊂ 𝓤 + + if x.disjoint(y) { + return nil // x ∩ y == ∅ if x ∩ y == ∅ + } + // x.typ == y.typ + + // ~t ∩ ~t == ~t + // ~t ∩ T == T + // T ∩ ~t == T + // T ∩ T == T + if !x.tilde || y.tilde { + return x + } + return y +} + +// includes reports whether t ∈ x. +func (x *term) includes(t types.Type) bool { + // easy cases + switch { + case x == nil: + return false // t ∈ ∅ == false + case x.typ == nil: + return true // t ∈ 𝓤 == true + } + // ∅ ⊂ x ⊂ 𝓤 + + u := t + if x.tilde { + u = under(u) + } + return types.Identical(x.typ, u) +} + +// subsetOf reports whether x ⊆ y. +func (x *term) subsetOf(y *term) bool { + // easy cases + switch { + case x == nil: + return true // ∅ ⊆ y == true + case y == nil: + return false // x ⊆ ∅ == false since x != ∅ + case y.typ == nil: + return true // x ⊆ 𝓤 == true + case x.typ == nil: + return false // 𝓤 ⊆ y == false since y != 𝓤 + } + // ∅ ⊂ x, y ⊂ 𝓤 + + if x.disjoint(y) { + return false // x ⊆ y == false if x ∩ y == ∅ + } + // x.typ == y.typ + + // ~t ⊆ ~t == true + // ~t ⊆ T == false + // T ⊆ ~t == true + // T ⊆ T == true + return !x.tilde || y.tilde +} + +// disjoint reports whether x ∩ y == ∅. +// x.typ and y.typ must not be nil. +func (x *term) disjoint(y *term) bool { + if debug && (x.typ == nil || y.typ == nil) { + panic("invalid argument(s)") + } + ux := x.typ + if y.tilde { + ux = under(ux) + } + uy := y.typ + if x.tilde { + uy = under(uy) + } + return !types.Identical(ux, uy) +} diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go new file mode 100644 index 0000000000..fa2834e2ab --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode.go @@ -0,0 +1,1368 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package typesinternal + +//go:generate stringer -type=ErrorCode + +type ErrorCode int + +// This file defines the error codes that can be produced during type-checking. +// Collectively, these codes provide an identifier that may be used to +// implement special handling for certain types of errors. +// +// Error codes should be fine-grained enough that the exact nature of the error +// can be easily determined, but coarse enough that they are not an +// implementation detail of the type checking algorithm. As a rule-of-thumb, +// errors should be considered equivalent if there is a theoretical refactoring +// of the type checker in which they are emitted in exactly one place. For +// example, the type checker emits different error messages for "too many +// arguments" and "too few arguments", but one can imagine an alternative type +// checker where this check instead just emits a single "wrong number of +// arguments", so these errors should have the same code. +// +// Error code names should be as brief as possible while retaining accuracy and +// distinctiveness. In most cases names should start with an adjective +// describing the nature of the error (e.g. "invalid", "unused", "misplaced"), +// and end with a noun identifying the relevant language object. For example, +// "DuplicateDecl" or "InvalidSliceExpr". For brevity, naming follows the +// convention that "bad" implies a problem with syntax, and "invalid" implies a +// problem with types. + +const ( + _ ErrorCode = iota + + // Test is reserved for errors that only apply while in self-test mode. + Test + + /* package names */ + + // BlankPkgName occurs when a package name is the blank identifier "_". + // + // Per the spec: + // "The PackageName must not be the blank identifier." + BlankPkgName + + // MismatchedPkgName occurs when a file's package name doesn't match the + // package name already established by other files. + MismatchedPkgName + + // InvalidPkgUse occurs when a package identifier is used outside of a + // selector expression. + // + // Example: + // import "fmt" + // + // var _ = fmt + InvalidPkgUse + + /* imports */ + + // BadImportPath occurs when an import path is not valid. + BadImportPath + + // BrokenImport occurs when importing a package fails. + // + // Example: + // import "amissingpackage" + BrokenImport + + // ImportCRenamed occurs when the special import "C" is renamed. "C" is a + // pseudo-package, and must not be renamed. + // + // Example: + // import _ "C" + ImportCRenamed + + // UnusedImport occurs when an import is unused. + // + // Example: + // import "fmt" + // + // func main() {} + UnusedImport + + /* initialization */ + + // InvalidInitCycle occurs when an invalid cycle is detected within the + // initialization graph. + // + // Example: + // var x int = f() + // + // func f() int { return x } + InvalidInitCycle + + /* decls */ + + // DuplicateDecl occurs when an identifier is declared multiple times. + // + // Example: + // var x = 1 + // var x = 2 + DuplicateDecl + + // InvalidDeclCycle occurs when a declaration cycle is not valid. + // + // Example: + // import "unsafe" + // + // type T struct { + // a [n]int + // } + // + // var n = unsafe.Sizeof(T{}) + InvalidDeclCycle + + // InvalidTypeCycle occurs when a cycle in type definitions results in a + // type that is not well-defined. + // + // Example: + // import "unsafe" + // + // type T [unsafe.Sizeof(T{})]int + InvalidTypeCycle + + /* decls > const */ + + // InvalidConstInit occurs when a const declaration has a non-constant + // initializer. + // + // Example: + // var x int + // const _ = x + InvalidConstInit + + // InvalidConstVal occurs when a const value cannot be converted to its + // target type. + // + // TODO(findleyr): this error code and example are not very clear. Consider + // removing it. + // + // Example: + // const _ = 1 << "hello" + InvalidConstVal + + // InvalidConstType occurs when the underlying type in a const declaration + // is not a valid constant type. + // + // Example: + // const c *int = 4 + InvalidConstType + + /* decls > var (+ other variable assignment codes) */ + + // UntypedNil occurs when the predeclared (untyped) value nil is used to + // initialize a variable declared without an explicit type. + // + // Example: + // var x = nil + UntypedNil + + // WrongAssignCount occurs when the number of values on the right-hand side + // of an assignment or or initialization expression does not match the number + // of variables on the left-hand side. + // + // Example: + // var x = 1, 2 + WrongAssignCount + + // UnassignableOperand occurs when the left-hand side of an assignment is + // not assignable. + // + // Example: + // func f() { + // const c = 1 + // c = 2 + // } + UnassignableOperand + + // NoNewVar occurs when a short variable declaration (':=') does not declare + // new variables. + // + // Example: + // func f() { + // x := 1 + // x := 2 + // } + NoNewVar + + // MultiValAssignOp occurs when an assignment operation (+=, *=, etc) does + // not have single-valued left-hand or right-hand side. + // + // Per the spec: + // "In assignment operations, both the left- and right-hand expression lists + // must contain exactly one single-valued expression" + // + // Example: + // func f() int { + // x, y := 1, 2 + // x, y += 1 + // return x + y + // } + MultiValAssignOp + + // InvalidIfaceAssign occurs when a value of type T is used as an + // interface, but T does not implement a method of the expected interface. + // + // Example: + // type I interface { + // f() + // } + // + // type T int + // + // var x I = T(1) + InvalidIfaceAssign + + // InvalidChanAssign occurs when a chan assignment is invalid. + // + // Per the spec, a value x is assignable to a channel type T if: + // "x is a bidirectional channel value, T is a channel type, x's type V and + // T have identical element types, and at least one of V or T is not a + // defined type." + // + // Example: + // type T1 chan int + // type T2 chan int + // + // var x T1 + // // Invalid assignment because both types are named + // var _ T2 = x + InvalidChanAssign + + // IncompatibleAssign occurs when the type of the right-hand side expression + // in an assignment cannot be assigned to the type of the variable being + // assigned. + // + // Example: + // var x []int + // var _ int = x + IncompatibleAssign + + // UnaddressableFieldAssign occurs when trying to assign to a struct field + // in a map value. + // + // Example: + // func f() { + // m := make(map[string]struct{i int}) + // m["foo"].i = 42 + // } + UnaddressableFieldAssign + + /* decls > type (+ other type expression codes) */ + + // NotAType occurs when the identifier used as the underlying type in a type + // declaration or the right-hand side of a type alias does not denote a type. + // + // Example: + // var S = 2 + // + // type T S + NotAType + + // InvalidArrayLen occurs when an array length is not a constant value. + // + // Example: + // var n = 3 + // var _ = [n]int{} + InvalidArrayLen + + // BlankIfaceMethod occurs when a method name is '_'. + // + // Per the spec: + // "The name of each explicitly specified method must be unique and not + // blank." + // + // Example: + // type T interface { + // _(int) + // } + BlankIfaceMethod + + // IncomparableMapKey occurs when a map key type does not support the == and + // != operators. + // + // Per the spec: + // "The comparison operators == and != must be fully defined for operands of + // the key type; thus the key type must not be a function, map, or slice." + // + // Example: + // var x map[T]int + // + // type T []int + IncomparableMapKey + + // InvalidIfaceEmbed occurs when a non-interface type is embedded in an + // interface. + // + // Example: + // type T struct {} + // + // func (T) m() + // + // type I interface { + // T + // } + InvalidIfaceEmbed + + // InvalidPtrEmbed occurs when an embedded field is of the pointer form *T, + // and T itself is itself a pointer, an unsafe.Pointer, or an interface. + // + // Per the spec: + // "An embedded field must be specified as a type name T or as a pointer to + // a non-interface type name *T, and T itself may not be a pointer type." + // + // Example: + // type T *int + // + // type S struct { + // *T + // } + InvalidPtrEmbed + + /* decls > func and method */ + + // BadRecv occurs when a method declaration does not have exactly one + // receiver parameter. + // + // Example: + // func () _() {} + BadRecv + + // InvalidRecv occurs when a receiver type expression is not of the form T + // or *T, or T is a pointer type. + // + // Example: + // type T struct {} + // + // func (**T) m() {} + InvalidRecv + + // DuplicateFieldAndMethod occurs when an identifier appears as both a field + // and method name. + // + // Example: + // type T struct { + // m int + // } + // + // func (T) m() {} + DuplicateFieldAndMethod + + // DuplicateMethod occurs when two methods on the same receiver type have + // the same name. + // + // Example: + // type T struct {} + // func (T) m() {} + // func (T) m(i int) int { return i } + DuplicateMethod + + /* decls > special */ + + // InvalidBlank occurs when a blank identifier is used as a value or type. + // + // Per the spec: + // "The blank identifier may appear as an operand only on the left-hand side + // of an assignment." + // + // Example: + // var x = _ + InvalidBlank + + // InvalidIota occurs when the predeclared identifier iota is used outside + // of a constant declaration. + // + // Example: + // var x = iota + InvalidIota + + // MissingInitBody occurs when an init function is missing its body. + // + // Example: + // func init() + MissingInitBody + + // InvalidInitSig occurs when an init function declares parameters or + // results. + // + // Example: + // func init() int { return 1 } + InvalidInitSig + + // InvalidInitDecl occurs when init is declared as anything other than a + // function. + // + // Example: + // var init = 1 + InvalidInitDecl + + // InvalidMainDecl occurs when main is declared as anything other than a + // function, in a main package. + InvalidMainDecl + + /* exprs */ + + // TooManyValues occurs when a function returns too many values for the + // expression context in which it is used. + // + // Example: + // func ReturnTwo() (int, int) { + // return 1, 2 + // } + // + // var x = ReturnTwo() + TooManyValues + + // NotAnExpr occurs when a type expression is used where a value expression + // is expected. + // + // Example: + // type T struct {} + // + // func f() { + // T + // } + NotAnExpr + + /* exprs > const */ + + // TruncatedFloat occurs when a float constant is truncated to an integer + // value. + // + // Example: + // var _ int = 98.6 + TruncatedFloat + + // NumericOverflow occurs when a numeric constant overflows its target type. + // + // Example: + // var x int8 = 1000 + NumericOverflow + + /* exprs > operation */ + + // UndefinedOp occurs when an operator is not defined for the type(s) used + // in an operation. + // + // Example: + // var c = "a" - "b" + UndefinedOp + + // MismatchedTypes occurs when operand types are incompatible in a binary + // operation. + // + // Example: + // var a = "hello" + // var b = 1 + // var c = a - b + MismatchedTypes + + // DivByZero occurs when a division operation is provable at compile + // time to be a division by zero. + // + // Example: + // const divisor = 0 + // var x int = 1/divisor + DivByZero + + // NonNumericIncDec occurs when an increment or decrement operator is + // applied to a non-numeric value. + // + // Example: + // func f() { + // var c = "c" + // c++ + // } + NonNumericIncDec + + /* exprs > ptr */ + + // UnaddressableOperand occurs when the & operator is applied to an + // unaddressable expression. + // + // Example: + // var x = &1 + UnaddressableOperand + + // InvalidIndirection occurs when a non-pointer value is indirected via the + // '*' operator. + // + // Example: + // var x int + // var y = *x + InvalidIndirection + + /* exprs > [] */ + + // NonIndexableOperand occurs when an index operation is applied to a value + // that cannot be indexed. + // + // Example: + // var x = 1 + // var y = x[1] + NonIndexableOperand + + // InvalidIndex occurs when an index argument is not of integer type, + // negative, or out-of-bounds. + // + // Example: + // var s = [...]int{1,2,3} + // var x = s[5] + // + // Example: + // var s = []int{1,2,3} + // var _ = s[-1] + // + // Example: + // var s = []int{1,2,3} + // var i string + // var _ = s[i] + InvalidIndex + + // SwappedSliceIndices occurs when constant indices in a slice expression + // are decreasing in value. + // + // Example: + // var _ = []int{1,2,3}[2:1] + SwappedSliceIndices + + /* operators > slice */ + + // NonSliceableOperand occurs when a slice operation is applied to a value + // whose type is not sliceable, or is unaddressable. + // + // Example: + // var x = [...]int{1, 2, 3}[:1] + // + // Example: + // var x = 1 + // var y = 1[:1] + NonSliceableOperand + + // InvalidSliceExpr occurs when a three-index slice expression (a[x:y:z]) is + // applied to a string. + // + // Example: + // var s = "hello" + // var x = s[1:2:3] + InvalidSliceExpr + + /* exprs > shift */ + + // InvalidShiftCount occurs when the right-hand side of a shift operation is + // either non-integer, negative, or too large. + // + // Example: + // var ( + // x string + // y int = 1 << x + // ) + InvalidShiftCount + + // InvalidShiftOperand occurs when the shifted operand is not an integer. + // + // Example: + // var s = "hello" + // var x = s << 2 + InvalidShiftOperand + + /* exprs > chan */ + + // InvalidReceive occurs when there is a channel receive from a value that + // is either not a channel, or is a send-only channel. + // + // Example: + // func f() { + // var x = 1 + // <-x + // } + InvalidReceive + + // InvalidSend occurs when there is a channel send to a value that is not a + // channel, or is a receive-only channel. + // + // Example: + // func f() { + // var x = 1 + // x <- "hello!" + // } + InvalidSend + + /* exprs > literal */ + + // DuplicateLitKey occurs when an index is duplicated in a slice, array, or + // map literal. + // + // Example: + // var _ = []int{0:1, 0:2} + // + // Example: + // var _ = map[string]int{"a": 1, "a": 2} + DuplicateLitKey + + // MissingLitKey occurs when a map literal is missing a key expression. + // + // Example: + // var _ = map[string]int{1} + MissingLitKey + + // InvalidLitIndex occurs when the key in a key-value element of a slice or + // array literal is not an integer constant. + // + // Example: + // var i = 0 + // var x = []string{i: "world"} + InvalidLitIndex + + // OversizeArrayLit occurs when an array literal exceeds its length. + // + // Example: + // var _ = [2]int{1,2,3} + OversizeArrayLit + + // MixedStructLit occurs when a struct literal contains a mix of positional + // and named elements. + // + // Example: + // var _ = struct{i, j int}{i: 1, 2} + MixedStructLit + + // InvalidStructLit occurs when a positional struct literal has an incorrect + // number of values. + // + // Example: + // var _ = struct{i, j int}{1,2,3} + InvalidStructLit + + // MissingLitField occurs when a struct literal refers to a field that does + // not exist on the struct type. + // + // Example: + // var _ = struct{i int}{j: 2} + MissingLitField + + // DuplicateLitField occurs when a struct literal contains duplicated + // fields. + // + // Example: + // var _ = struct{i int}{i: 1, i: 2} + DuplicateLitField + + // UnexportedLitField occurs when a positional struct literal implicitly + // assigns an unexported field of an imported type. + UnexportedLitField + + // InvalidLitField occurs when a field name is not a valid identifier. + // + // Example: + // var _ = struct{i int}{1: 1} + InvalidLitField + + // UntypedLit occurs when a composite literal omits a required type + // identifier. + // + // Example: + // type outer struct{ + // inner struct { i int } + // } + // + // var _ = outer{inner: {1}} + UntypedLit + + // InvalidLit occurs when a composite literal expression does not match its + // type. + // + // Example: + // type P *struct{ + // x int + // } + // var _ = P {} + InvalidLit + + /* exprs > selector */ + + // AmbiguousSelector occurs when a selector is ambiguous. + // + // Example: + // type E1 struct { i int } + // type E2 struct { i int } + // type T struct { E1; E2 } + // + // var x T + // var _ = x.i + AmbiguousSelector + + // UndeclaredImportedName occurs when a package-qualified identifier is + // undeclared by the imported package. + // + // Example: + // import "go/types" + // + // var _ = types.NotAnActualIdentifier + UndeclaredImportedName + + // UnexportedName occurs when a selector refers to an unexported identifier + // of an imported package. + // + // Example: + // import "reflect" + // + // type _ reflect.flag + UnexportedName + + // UndeclaredName occurs when an identifier is not declared in the current + // scope. + // + // Example: + // var x T + UndeclaredName + + // MissingFieldOrMethod occurs when a selector references a field or method + // that does not exist. + // + // Example: + // type T struct {} + // + // var x = T{}.f + MissingFieldOrMethod + + /* exprs > ... */ + + // BadDotDotDotSyntax occurs when a "..." occurs in a context where it is + // not valid. + // + // Example: + // var _ = map[int][...]int{0: {}} + BadDotDotDotSyntax + + // NonVariadicDotDotDot occurs when a "..." is used on the final argument to + // a non-variadic function. + // + // Example: + // func printArgs(s []string) { + // for _, a := range s { + // println(a) + // } + // } + // + // func f() { + // s := []string{"a", "b", "c"} + // printArgs(s...) + // } + NonVariadicDotDotDot + + // MisplacedDotDotDot occurs when a "..." is used somewhere other than the + // final argument to a function call. + // + // Example: + // func printArgs(args ...int) { + // for _, a := range args { + // println(a) + // } + // } + // + // func f() { + // a := []int{1,2,3} + // printArgs(0, a...) + // } + MisplacedDotDotDot + + // InvalidDotDotDotOperand occurs when a "..." operator is applied to a + // single-valued operand. + // + // Example: + // func printArgs(args ...int) { + // for _, a := range args { + // println(a) + // } + // } + // + // func f() { + // a := 1 + // printArgs(a...) + // } + // + // Example: + // func args() (int, int) { + // return 1, 2 + // } + // + // func printArgs(args ...int) { + // for _, a := range args { + // println(a) + // } + // } + // + // func g() { + // printArgs(args()...) + // } + InvalidDotDotDotOperand + + // InvalidDotDotDot occurs when a "..." is used in a non-variadic built-in + // function. + // + // Example: + // var s = []int{1, 2, 3} + // var l = len(s...) + InvalidDotDotDot + + /* exprs > built-in */ + + // UncalledBuiltin occurs when a built-in function is used as a + // function-valued expression, instead of being called. + // + // Per the spec: + // "The built-in functions do not have standard Go types, so they can only + // appear in call expressions; they cannot be used as function values." + // + // Example: + // var _ = copy + UncalledBuiltin + + // InvalidAppend occurs when append is called with a first argument that is + // not a slice. + // + // Example: + // var _ = append(1, 2) + InvalidAppend + + // InvalidCap occurs when an argument to the cap built-in function is not of + // supported type. + // + // See https://golang.org/ref/spec#Lengthand_capacity for information on + // which underlying types are supported as arguments to cap and len. + // + // Example: + // var s = 2 + // var x = cap(s) + InvalidCap + + // InvalidClose occurs when close(...) is called with an argument that is + // not of channel type, or that is a receive-only channel. + // + // Example: + // func f() { + // var x int + // close(x) + // } + InvalidClose + + // InvalidCopy occurs when the arguments are not of slice type or do not + // have compatible type. + // + // See https://golang.org/ref/spec#Appendingand_copying_slices for more + // information on the type requirements for the copy built-in. + // + // Example: + // func f() { + // var x []int + // y := []int64{1,2,3} + // copy(x, y) + // } + InvalidCopy + + // InvalidComplex occurs when the complex built-in function is called with + // arguments with incompatible types. + // + // Example: + // var _ = complex(float32(1), float64(2)) + InvalidComplex + + // InvalidDelete occurs when the delete built-in function is called with a + // first argument that is not a map. + // + // Example: + // func f() { + // m := "hello" + // delete(m, "e") + // } + InvalidDelete + + // InvalidImag occurs when the imag built-in function is called with an + // argument that does not have complex type. + // + // Example: + // var _ = imag(int(1)) + InvalidImag + + // InvalidLen occurs when an argument to the len built-in function is not of + // supported type. + // + // See https://golang.org/ref/spec#Lengthand_capacity for information on + // which underlying types are supported as arguments to cap and len. + // + // Example: + // var s = 2 + // var x = len(s) + InvalidLen + + // SwappedMakeArgs occurs when make is called with three arguments, and its + // length argument is larger than its capacity argument. + // + // Example: + // var x = make([]int, 3, 2) + SwappedMakeArgs + + // InvalidMake occurs when make is called with an unsupported type argument. + // + // See https://golang.org/ref/spec#Makingslices_maps_and_channels for + // information on the types that may be created using make. + // + // Example: + // var x = make(int) + InvalidMake + + // InvalidReal occurs when the real built-in function is called with an + // argument that does not have complex type. + // + // Example: + // var _ = real(int(1)) + InvalidReal + + /* exprs > assertion */ + + // InvalidAssert occurs when a type assertion is applied to a + // value that is not of interface type. + // + // Example: + // var x = 1 + // var _ = x.(float64) + InvalidAssert + + // ImpossibleAssert occurs for a type assertion x.(T) when the value x of + // interface cannot have dynamic type T, due to a missing or mismatching + // method on T. + // + // Example: + // type T int + // + // func (t *T) m() int { return int(*t) } + // + // type I interface { m() int } + // + // var x I + // var _ = x.(T) + ImpossibleAssert + + /* exprs > conversion */ + + // InvalidConversion occurs when the argument type cannot be converted to the + // target. + // + // See https://golang.org/ref/spec#Conversions for the rules of + // convertibility. + // + // Example: + // var x float64 + // var _ = string(x) + InvalidConversion + + // InvalidUntypedConversion occurs when an there is no valid implicit + // conversion from an untyped value satisfying the type constraints of the + // context in which it is used. + // + // Example: + // var _ = 1 + "" + InvalidUntypedConversion + + /* offsetof */ + + // BadOffsetofSyntax occurs when unsafe.Offsetof is called with an argument + // that is not a selector expression. + // + // Example: + // import "unsafe" + // + // var x int + // var _ = unsafe.Offsetof(x) + BadOffsetofSyntax + + // InvalidOffsetof occurs when unsafe.Offsetof is called with a method + // selector, rather than a field selector, or when the field is embedded via + // a pointer. + // + // Per the spec: + // + // "If f is an embedded field, it must be reachable without pointer + // indirections through fields of the struct. " + // + // Example: + // import "unsafe" + // + // type T struct { f int } + // type S struct { *T } + // var s S + // var _ = unsafe.Offsetof(s.f) + // + // Example: + // import "unsafe" + // + // type S struct{} + // + // func (S) m() {} + // + // var s S + // var _ = unsafe.Offsetof(s.m) + InvalidOffsetof + + /* control flow > scope */ + + // UnusedExpr occurs when a side-effect free expression is used as a + // statement. Such a statement has no effect. + // + // Example: + // func f(i int) { + // i*i + // } + UnusedExpr + + // UnusedVar occurs when a variable is declared but unused. + // + // Example: + // func f() { + // x := 1 + // } + UnusedVar + + // MissingReturn occurs when a function with results is missing a return + // statement. + // + // Example: + // func f() int {} + MissingReturn + + // WrongResultCount occurs when a return statement returns an incorrect + // number of values. + // + // Example: + // func ReturnOne() int { + // return 1, 2 + // } + WrongResultCount + + // OutOfScopeResult occurs when the name of a value implicitly returned by + // an empty return statement is shadowed in a nested scope. + // + // Example: + // func factor(n int) (i int) { + // for i := 2; i < n; i++ { + // if n%i == 0 { + // return + // } + // } + // return 0 + // } + OutOfScopeResult + + /* control flow > if */ + + // InvalidCond occurs when an if condition is not a boolean expression. + // + // Example: + // func checkReturn(i int) { + // if i { + // panic("non-zero return") + // } + // } + InvalidCond + + /* control flow > for */ + + // InvalidPostDecl occurs when there is a declaration in a for-loop post + // statement. + // + // Example: + // func f() { + // for i := 0; i < 10; j := 0 {} + // } + InvalidPostDecl + + // InvalidChanRange occurs when a send-only channel used in a range + // expression. + // + // Example: + // func sum(c chan<- int) { + // s := 0 + // for i := range c { + // s += i + // } + // } + InvalidChanRange + + // InvalidIterVar occurs when two iteration variables are used while ranging + // over a channel. + // + // Example: + // func f(c chan int) { + // for k, v := range c { + // println(k, v) + // } + // } + InvalidIterVar + + // InvalidRangeExpr occurs when the type of a range expression is not array, + // slice, string, map, or channel. + // + // Example: + // func f(i int) { + // for j := range i { + // println(j) + // } + // } + InvalidRangeExpr + + /* control flow > switch */ + + // MisplacedBreak occurs when a break statement is not within a for, switch, + // or select statement of the innermost function definition. + // + // Example: + // func f() { + // break + // } + MisplacedBreak + + // MisplacedContinue occurs when a continue statement is not within a for + // loop of the innermost function definition. + // + // Example: + // func sumeven(n int) int { + // proceed := func() { + // continue + // } + // sum := 0 + // for i := 1; i <= n; i++ { + // if i % 2 != 0 { + // proceed() + // } + // sum += i + // } + // return sum + // } + MisplacedContinue + + // MisplacedFallthrough occurs when a fallthrough statement is not within an + // expression switch. + // + // Example: + // func typename(i interface{}) string { + // switch i.(type) { + // case int64: + // fallthrough + // case int: + // return "int" + // } + // return "unsupported" + // } + MisplacedFallthrough + + // DuplicateCase occurs when a type or expression switch has duplicate + // cases. + // + // Example: + // func printInt(i int) { + // switch i { + // case 1: + // println("one") + // case 1: + // println("One") + // } + // } + DuplicateCase + + // DuplicateDefault occurs when a type or expression switch has multiple + // default clauses. + // + // Example: + // func printInt(i int) { + // switch i { + // case 1: + // println("one") + // default: + // println("One") + // default: + // println("1") + // } + // } + DuplicateDefault + + // BadTypeKeyword occurs when a .(type) expression is used anywhere other + // than a type switch. + // + // Example: + // type I interface { + // m() + // } + // var t I + // var _ = t.(type) + BadTypeKeyword + + // InvalidTypeSwitch occurs when .(type) is used on an expression that is + // not of interface type. + // + // Example: + // func f(i int) { + // switch x := i.(type) {} + // } + InvalidTypeSwitch + + // InvalidExprSwitch occurs when a switch expression is not comparable. + // + // Example: + // func _() { + // var a struct{ _ func() } + // switch a /* ERROR cannot switch on a */ { + // } + // } + InvalidExprSwitch + + /* control flow > select */ + + // InvalidSelectCase occurs when a select case is not a channel send or + // receive. + // + // Example: + // func checkChan(c <-chan int) bool { + // select { + // case c: + // return true + // default: + // return false + // } + // } + InvalidSelectCase + + /* control flow > labels and jumps */ + + // UndeclaredLabel occurs when an undeclared label is jumped to. + // + // Example: + // func f() { + // goto L + // } + UndeclaredLabel + + // DuplicateLabel occurs when a label is declared more than once. + // + // Example: + // func f() int { + // L: + // L: + // return 1 + // } + DuplicateLabel + + // MisplacedLabel occurs when a break or continue label is not on a for, + // switch, or select statement. + // + // Example: + // func f() { + // L: + // a := []int{1,2,3} + // for _, e := range a { + // if e > 10 { + // break L + // } + // println(a) + // } + // } + MisplacedLabel + + // UnusedLabel occurs when a label is declared but not used. + // + // Example: + // func f() { + // L: + // } + UnusedLabel + + // JumpOverDecl occurs when a label jumps over a variable declaration. + // + // Example: + // func f() int { + // goto L + // x := 2 + // L: + // x++ + // return x + // } + JumpOverDecl + + // JumpIntoBlock occurs when a forward jump goes to a label inside a nested + // block. + // + // Example: + // func f(x int) { + // goto L + // if x > 0 { + // L: + // print("inside block") + // } + // } + JumpIntoBlock + + /* control flow > calls */ + + // InvalidMethodExpr occurs when a pointer method is called but the argument + // is not addressable. + // + // Example: + // type T struct {} + // + // func (*T) m() int { return 1 } + // + // var _ = T.m(T{}) + InvalidMethodExpr + + // WrongArgCount occurs when too few or too many arguments are passed by a + // function call. + // + // Example: + // func f(i int) {} + // var x = f() + WrongArgCount + + // InvalidCall occurs when an expression is called that is not of function + // type. + // + // Example: + // var x = "x" + // var y = x() + InvalidCall + + /* control flow > suspended */ + + // UnusedResults occurs when a restricted expression-only built-in function + // is suspended via go or defer. Such a suspension discards the results of + // these side-effect free built-in functions, and therefore is ineffectual. + // + // Example: + // func f(a []int) int { + // defer len(a) + // return i + // } + UnusedResults + + // InvalidDefer occurs when a deferred expression is not a function call, + // for example if the expression is a type conversion. + // + // Example: + // func f(i int) int { + // defer int32(i) + // return i + // } + InvalidDefer + + // InvalidGo occurs when a go expression is not a function call, for example + // if the expression is a type conversion. + // + // Example: + // func f(i int) int { + // go int32(i) + // return i + // } + InvalidGo +) diff --git a/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go b/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go new file mode 100644 index 0000000000..3e5842a5f0 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typesinternal/errorcode_string.go @@ -0,0 +1,153 @@ +// Code generated by "stringer -type=ErrorCode"; DO NOT EDIT. + +package typesinternal + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[Test-1] + _ = x[BlankPkgName-2] + _ = x[MismatchedPkgName-3] + _ = x[InvalidPkgUse-4] + _ = x[BadImportPath-5] + _ = x[BrokenImport-6] + _ = x[ImportCRenamed-7] + _ = x[UnusedImport-8] + _ = x[InvalidInitCycle-9] + _ = x[DuplicateDecl-10] + _ = x[InvalidDeclCycle-11] + _ = x[InvalidTypeCycle-12] + _ = x[InvalidConstInit-13] + _ = x[InvalidConstVal-14] + _ = x[InvalidConstType-15] + _ = x[UntypedNil-16] + _ = x[WrongAssignCount-17] + _ = x[UnassignableOperand-18] + _ = x[NoNewVar-19] + _ = x[MultiValAssignOp-20] + _ = x[InvalidIfaceAssign-21] + _ = x[InvalidChanAssign-22] + _ = x[IncompatibleAssign-23] + _ = x[UnaddressableFieldAssign-24] + _ = x[NotAType-25] + _ = x[InvalidArrayLen-26] + _ = x[BlankIfaceMethod-27] + _ = x[IncomparableMapKey-28] + _ = x[InvalidIfaceEmbed-29] + _ = x[InvalidPtrEmbed-30] + _ = x[BadRecv-31] + _ = x[InvalidRecv-32] + _ = x[DuplicateFieldAndMethod-33] + _ = x[DuplicateMethod-34] + _ = x[InvalidBlank-35] + _ = x[InvalidIota-36] + _ = x[MissingInitBody-37] + _ = x[InvalidInitSig-38] + _ = x[InvalidInitDecl-39] + _ = x[InvalidMainDecl-40] + _ = x[TooManyValues-41] + _ = x[NotAnExpr-42] + _ = x[TruncatedFloat-43] + _ = x[NumericOverflow-44] + _ = x[UndefinedOp-45] + _ = x[MismatchedTypes-46] + _ = x[DivByZero-47] + _ = x[NonNumericIncDec-48] + _ = x[UnaddressableOperand-49] + _ = x[InvalidIndirection-50] + _ = x[NonIndexableOperand-51] + _ = x[InvalidIndex-52] + _ = x[SwappedSliceIndices-53] + _ = x[NonSliceableOperand-54] + _ = x[InvalidSliceExpr-55] + _ = x[InvalidShiftCount-56] + _ = x[InvalidShiftOperand-57] + _ = x[InvalidReceive-58] + _ = x[InvalidSend-59] + _ = x[DuplicateLitKey-60] + _ = x[MissingLitKey-61] + _ = x[InvalidLitIndex-62] + _ = x[OversizeArrayLit-63] + _ = x[MixedStructLit-64] + _ = x[InvalidStructLit-65] + _ = x[MissingLitField-66] + _ = x[DuplicateLitField-67] + _ = x[UnexportedLitField-68] + _ = x[InvalidLitField-69] + _ = x[UntypedLit-70] + _ = x[InvalidLit-71] + _ = x[AmbiguousSelector-72] + _ = x[UndeclaredImportedName-73] + _ = x[UnexportedName-74] + _ = x[UndeclaredName-75] + _ = x[MissingFieldOrMethod-76] + _ = x[BadDotDotDotSyntax-77] + _ = x[NonVariadicDotDotDot-78] + _ = x[MisplacedDotDotDot-79] + _ = x[InvalidDotDotDotOperand-80] + _ = x[InvalidDotDotDot-81] + _ = x[UncalledBuiltin-82] + _ = x[InvalidAppend-83] + _ = x[InvalidCap-84] + _ = x[InvalidClose-85] + _ = x[InvalidCopy-86] + _ = x[InvalidComplex-87] + _ = x[InvalidDelete-88] + _ = x[InvalidImag-89] + _ = x[InvalidLen-90] + _ = x[SwappedMakeArgs-91] + _ = x[InvalidMake-92] + _ = x[InvalidReal-93] + _ = x[InvalidAssert-94] + _ = x[ImpossibleAssert-95] + _ = x[InvalidConversion-96] + _ = x[InvalidUntypedConversion-97] + _ = x[BadOffsetofSyntax-98] + _ = x[InvalidOffsetof-99] + _ = x[UnusedExpr-100] + _ = x[UnusedVar-101] + _ = x[MissingReturn-102] + _ = x[WrongResultCount-103] + _ = x[OutOfScopeResult-104] + _ = x[InvalidCond-105] + _ = x[InvalidPostDecl-106] + _ = x[InvalidChanRange-107] + _ = x[InvalidIterVar-108] + _ = x[InvalidRangeExpr-109] + _ = x[MisplacedBreak-110] + _ = x[MisplacedContinue-111] + _ = x[MisplacedFallthrough-112] + _ = x[DuplicateCase-113] + _ = x[DuplicateDefault-114] + _ = x[BadTypeKeyword-115] + _ = x[InvalidTypeSwitch-116] + _ = x[InvalidExprSwitch-117] + _ = x[InvalidSelectCase-118] + _ = x[UndeclaredLabel-119] + _ = x[DuplicateLabel-120] + _ = x[MisplacedLabel-121] + _ = x[UnusedLabel-122] + _ = x[JumpOverDecl-123] + _ = x[JumpIntoBlock-124] + _ = x[InvalidMethodExpr-125] + _ = x[WrongArgCount-126] + _ = x[InvalidCall-127] + _ = x[UnusedResults-128] + _ = x[InvalidDefer-129] + _ = x[InvalidGo-130] +} + +const _ErrorCode_name = "TestBlankPkgNameMismatchedPkgNameInvalidPkgUseBadImportPathBrokenImportImportCRenamedUnusedImportInvalidInitCycleDuplicateDeclInvalidDeclCycleInvalidTypeCycleInvalidConstInitInvalidConstValInvalidConstTypeUntypedNilWrongAssignCountUnassignableOperandNoNewVarMultiValAssignOpInvalidIfaceAssignInvalidChanAssignIncompatibleAssignUnaddressableFieldAssignNotATypeInvalidArrayLenBlankIfaceMethodIncomparableMapKeyInvalidIfaceEmbedInvalidPtrEmbedBadRecvInvalidRecvDuplicateFieldAndMethodDuplicateMethodInvalidBlankInvalidIotaMissingInitBodyInvalidInitSigInvalidInitDeclInvalidMainDeclTooManyValuesNotAnExprTruncatedFloatNumericOverflowUndefinedOpMismatchedTypesDivByZeroNonNumericIncDecUnaddressableOperandInvalidIndirectionNonIndexableOperandInvalidIndexSwappedSliceIndicesNonSliceableOperandInvalidSliceExprInvalidShiftCountInvalidShiftOperandInvalidReceiveInvalidSendDuplicateLitKeyMissingLitKeyInvalidLitIndexOversizeArrayLitMixedStructLitInvalidStructLitMissingLitFieldDuplicateLitFieldUnexportedLitFieldInvalidLitFieldUntypedLitInvalidLitAmbiguousSelectorUndeclaredImportedNameUnexportedNameUndeclaredNameMissingFieldOrMethodBadDotDotDotSyntaxNonVariadicDotDotDotMisplacedDotDotDotInvalidDotDotDotOperandInvalidDotDotDotUncalledBuiltinInvalidAppendInvalidCapInvalidCloseInvalidCopyInvalidComplexInvalidDeleteInvalidImagInvalidLenSwappedMakeArgsInvalidMakeInvalidRealInvalidAssertImpossibleAssertInvalidConversionInvalidUntypedConversionBadOffsetofSyntaxInvalidOffsetofUnusedExprUnusedVarMissingReturnWrongResultCountOutOfScopeResultInvalidCondInvalidPostDeclInvalidChanRangeInvalidIterVarInvalidRangeExprMisplacedBreakMisplacedContinueMisplacedFallthroughDuplicateCaseDuplicateDefaultBadTypeKeywordInvalidTypeSwitchInvalidExprSwitchInvalidSelectCaseUndeclaredLabelDuplicateLabelMisplacedLabelUnusedLabelJumpOverDeclJumpIntoBlockInvalidMethodExprWrongArgCountInvalidCallUnusedResultsInvalidDeferInvalidGo" + +var _ErrorCode_index = [...]uint16{0, 4, 16, 33, 46, 59, 71, 85, 97, 113, 126, 142, 158, 174, 189, 205, 215, 231, 250, 258, 274, 292, 309, 327, 351, 359, 374, 390, 408, 425, 440, 447, 458, 481, 496, 508, 519, 534, 548, 563, 578, 591, 600, 614, 629, 640, 655, 664, 680, 700, 718, 737, 749, 768, 787, 803, 820, 839, 853, 864, 879, 892, 907, 923, 937, 953, 968, 985, 1003, 1018, 1028, 1038, 1055, 1077, 1091, 1105, 1125, 1143, 1163, 1181, 1204, 1220, 1235, 1248, 1258, 1270, 1281, 1295, 1308, 1319, 1329, 1344, 1355, 1366, 1379, 1395, 1412, 1436, 1453, 1468, 1478, 1487, 1500, 1516, 1532, 1543, 1558, 1574, 1588, 1604, 1618, 1635, 1655, 1668, 1684, 1698, 1715, 1732, 1749, 1764, 1778, 1792, 1803, 1815, 1828, 1845, 1858, 1869, 1882, 1894, 1903} + +func (i ErrorCode) String() string { + i -= 1 + if i < 0 || i >= ErrorCode(len(_ErrorCode_index)-1) { + return "ErrorCode(" + strconv.FormatInt(int64(i+1), 10) + ")" + } + return _ErrorCode_name[_ErrorCode_index[i]:_ErrorCode_index[i+1]] +} diff --git a/vendor/golang.org/x/tools/internal/typesinternal/types.go b/vendor/golang.org/x/tools/internal/typesinternal/types.go new file mode 100644 index 0000000000..7c77c2fbc0 --- /dev/null +++ b/vendor/golang.org/x/tools/internal/typesinternal/types.go @@ -0,0 +1,50 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package typesinternal provides access to internal go/types APIs that are not +// yet exported. +package typesinternal + +import ( + "go/token" + "go/types" + "reflect" + "unsafe" +) + +func SetUsesCgo(conf *types.Config) bool { + v := reflect.ValueOf(conf).Elem() + + f := v.FieldByName("go115UsesCgo") + if !f.IsValid() { + f = v.FieldByName("UsesCgo") + if !f.IsValid() { + return false + } + } + + addr := unsafe.Pointer(f.UnsafeAddr()) + *(*bool)(addr) = true + + return true +} + +// ReadGo116ErrorData extracts additional information from types.Error values +// generated by Go version 1.16 and later: the error code, start position, and +// end position. If all positions are valid, start <= err.Pos <= end. +// +// If the data could not be read, the final result parameter will be false. +func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) { + var data [3]int + // By coincidence all of these fields are ints, which simplifies things. + v := reflect.ValueOf(err) + for i, name := range []string{"go116code", "go116start", "go116end"} { + f := v.FieldByName(name) + if !f.IsValid() { + return 0, 0, 0, false + } + data[i] = int(f.Int()) + } + return ErrorCode(data[0]), token.Pos(data[1]), token.Pos(data[2]), true +} diff --git a/vendor/golang.org/x/xerrors/LICENSE b/vendor/golang.org/x/xerrors/LICENSE new file mode 100644 index 0000000000..e4a47e17f1 --- /dev/null +++ b/vendor/golang.org/x/xerrors/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2019 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/xerrors/PATENTS b/vendor/golang.org/x/xerrors/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/golang.org/x/xerrors/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/xerrors/README b/vendor/golang.org/x/xerrors/README new file mode 100644 index 0000000000..aac7867a56 --- /dev/null +++ b/vendor/golang.org/x/xerrors/README @@ -0,0 +1,2 @@ +This repository holds the transition packages for the new Go 1.13 error values. +See golang.org/design/29934-error-values. diff --git a/vendor/golang.org/x/xerrors/adaptor.go b/vendor/golang.org/x/xerrors/adaptor.go new file mode 100644 index 0000000000..4317f24833 --- /dev/null +++ b/vendor/golang.org/x/xerrors/adaptor.go @@ -0,0 +1,193 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import ( + "bytes" + "fmt" + "io" + "reflect" + "strconv" +) + +// FormatError calls the FormatError method of f with an errors.Printer +// configured according to s and verb, and writes the result to s. +func FormatError(f Formatter, s fmt.State, verb rune) { + // Assuming this function is only called from the Format method, and given + // that FormatError takes precedence over Format, it cannot be called from + // any package that supports errors.Formatter. It is therefore safe to + // disregard that State may be a specific printer implementation and use one + // of our choice instead. + + // limitations: does not support printing error as Go struct. + + var ( + sep = " " // separator before next error + p = &state{State: s} + direct = true + ) + + var err error = f + + switch verb { + // Note that this switch must match the preference order + // for ordinary string printing (%#v before %+v, and so on). + + case 'v': + if s.Flag('#') { + if stringer, ok := err.(fmt.GoStringer); ok { + io.WriteString(&p.buf, stringer.GoString()) + goto exit + } + // proceed as if it were %v + } else if s.Flag('+') { + p.printDetail = true + sep = "\n - " + } + case 's': + case 'q', 'x', 'X': + // Use an intermediate buffer in the rare cases that precision, + // truncation, or one of the alternative verbs (q, x, and X) are + // specified. + direct = false + + default: + p.buf.WriteString("%!") + p.buf.WriteRune(verb) + p.buf.WriteByte('(') + switch { + case err != nil: + p.buf.WriteString(reflect.TypeOf(f).String()) + default: + p.buf.WriteString("") + } + p.buf.WriteByte(')') + io.Copy(s, &p.buf) + return + } + +loop: + for { + switch v := err.(type) { + case Formatter: + err = v.FormatError((*printer)(p)) + case fmt.Formatter: + v.Format(p, 'v') + break loop + default: + io.WriteString(&p.buf, v.Error()) + break loop + } + if err == nil { + break + } + if p.needColon || !p.printDetail { + p.buf.WriteByte(':') + p.needColon = false + } + p.buf.WriteString(sep) + p.inDetail = false + p.needNewline = false + } + +exit: + width, okW := s.Width() + prec, okP := s.Precision() + + if !direct || (okW && width > 0) || okP { + // Construct format string from State s. + format := []byte{'%'} + if s.Flag('-') { + format = append(format, '-') + } + if s.Flag('+') { + format = append(format, '+') + } + if s.Flag(' ') { + format = append(format, ' ') + } + if okW { + format = strconv.AppendInt(format, int64(width), 10) + } + if okP { + format = append(format, '.') + format = strconv.AppendInt(format, int64(prec), 10) + } + format = append(format, string(verb)...) + fmt.Fprintf(s, string(format), p.buf.String()) + } else { + io.Copy(s, &p.buf) + } +} + +var detailSep = []byte("\n ") + +// state tracks error printing state. It implements fmt.State. +type state struct { + fmt.State + buf bytes.Buffer + + printDetail bool + inDetail bool + needColon bool + needNewline bool +} + +func (s *state) Write(b []byte) (n int, err error) { + if s.printDetail { + if len(b) == 0 { + return 0, nil + } + if s.inDetail && s.needColon { + s.needNewline = true + if b[0] == '\n' { + b = b[1:] + } + } + k := 0 + for i, c := range b { + if s.needNewline { + if s.inDetail && s.needColon { + s.buf.WriteByte(':') + s.needColon = false + } + s.buf.Write(detailSep) + s.needNewline = false + } + if c == '\n' { + s.buf.Write(b[k:i]) + k = i + 1 + s.needNewline = true + } + } + s.buf.Write(b[k:]) + if !s.inDetail { + s.needColon = true + } + } else if !s.inDetail { + s.buf.Write(b) + } + return len(b), nil +} + +// printer wraps a state to implement an xerrors.Printer. +type printer state + +func (s *printer) Print(args ...interface{}) { + if !s.inDetail || s.printDetail { + fmt.Fprint((*state)(s), args...) + } +} + +func (s *printer) Printf(format string, args ...interface{}) { + if !s.inDetail || s.printDetail { + fmt.Fprintf((*state)(s), format, args...) + } +} + +func (s *printer) Detail() bool { + s.inDetail = true + return s.printDetail +} diff --git a/vendor/golang.org/x/xerrors/codereview.cfg b/vendor/golang.org/x/xerrors/codereview.cfg new file mode 100644 index 0000000000..3f8b14b64e --- /dev/null +++ b/vendor/golang.org/x/xerrors/codereview.cfg @@ -0,0 +1 @@ +issuerepo: golang/go diff --git a/vendor/golang.org/x/xerrors/doc.go b/vendor/golang.org/x/xerrors/doc.go new file mode 100644 index 0000000000..eef99d9d54 --- /dev/null +++ b/vendor/golang.org/x/xerrors/doc.go @@ -0,0 +1,22 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package xerrors implements functions to manipulate errors. +// +// This package is based on the Go 2 proposal for error values: +// https://golang.org/design/29934-error-values +// +// These functions were incorporated into the standard library's errors package +// in Go 1.13: +// - Is +// - As +// - Unwrap +// +// Also, Errorf's %w verb was incorporated into fmt.Errorf. +// +// Use this package to get equivalent behavior in all supported Go versions. +// +// No other features of this package were included in Go 1.13, and at present +// there are no plans to include any of them. +package xerrors // import "golang.org/x/xerrors" diff --git a/vendor/golang.org/x/xerrors/errors.go b/vendor/golang.org/x/xerrors/errors.go new file mode 100644 index 0000000000..e88d3772d8 --- /dev/null +++ b/vendor/golang.org/x/xerrors/errors.go @@ -0,0 +1,33 @@ +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import "fmt" + +// errorString is a trivial implementation of error. +type errorString struct { + s string + frame Frame +} + +// New returns an error that formats as the given text. +// +// The returned error contains a Frame set to the caller's location and +// implements Formatter to show this information when printed with details. +func New(text string) error { + return &errorString{text, Caller(1)} +} + +func (e *errorString) Error() string { + return e.s +} + +func (e *errorString) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *errorString) FormatError(p Printer) (next error) { + p.Print(e.s) + e.frame.Format(p) + return nil +} diff --git a/vendor/golang.org/x/xerrors/fmt.go b/vendor/golang.org/x/xerrors/fmt.go new file mode 100644 index 0000000000..829862ddf6 --- /dev/null +++ b/vendor/golang.org/x/xerrors/fmt.go @@ -0,0 +1,187 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import ( + "fmt" + "strings" + "unicode" + "unicode/utf8" + + "golang.org/x/xerrors/internal" +) + +const percentBangString = "%!" + +// Errorf formats according to a format specifier and returns the string as a +// value that satisfies error. +// +// The returned error includes the file and line number of the caller when +// formatted with additional detail enabled. If the last argument is an error +// the returned error's Format method will return it if the format string ends +// with ": %s", ": %v", or ": %w". If the last argument is an error and the +// format string ends with ": %w", the returned error implements an Unwrap +// method returning it. +// +// If the format specifier includes a %w verb with an error operand in a +// position other than at the end, the returned error will still implement an +// Unwrap method returning the operand, but the error's Format method will not +// return the wrapped error. +// +// It is invalid to include more than one %w verb or to supply it with an +// operand that does not implement the error interface. The %w verb is otherwise +// a synonym for %v. +func Errorf(format string, a ...interface{}) error { + format = formatPlusW(format) + // Support a ": %[wsv]" suffix, which works well with xerrors.Formatter. + wrap := strings.HasSuffix(format, ": %w") + idx, format2, ok := parsePercentW(format) + percentWElsewhere := !wrap && idx >= 0 + if !percentWElsewhere && (wrap || strings.HasSuffix(format, ": %s") || strings.HasSuffix(format, ": %v")) { + err := errorAt(a, len(a)-1) + if err == nil { + return &noWrapError{fmt.Sprintf(format, a...), nil, Caller(1)} + } + // TODO: this is not entirely correct. The error value could be + // printed elsewhere in format if it mixes numbered with unnumbered + // substitutions. With relatively small changes to doPrintf we can + // have it optionally ignore extra arguments and pass the argument + // list in its entirety. + msg := fmt.Sprintf(format[:len(format)-len(": %s")], a[:len(a)-1]...) + frame := Frame{} + if internal.EnableTrace { + frame = Caller(1) + } + if wrap { + return &wrapError{msg, err, frame} + } + return &noWrapError{msg, err, frame} + } + // Support %w anywhere. + // TODO: don't repeat the wrapped error's message when %w occurs in the middle. + msg := fmt.Sprintf(format2, a...) + if idx < 0 { + return &noWrapError{msg, nil, Caller(1)} + } + err := errorAt(a, idx) + if !ok || err == nil { + // Too many %ws or argument of %w is not an error. Approximate the Go + // 1.13 fmt.Errorf message. + return &noWrapError{fmt.Sprintf("%sw(%s)", percentBangString, msg), nil, Caller(1)} + } + frame := Frame{} + if internal.EnableTrace { + frame = Caller(1) + } + return &wrapError{msg, err, frame} +} + +func errorAt(args []interface{}, i int) error { + if i < 0 || i >= len(args) { + return nil + } + err, ok := args[i].(error) + if !ok { + return nil + } + return err +} + +// formatPlusW is used to avoid the vet check that will barf at %w. +func formatPlusW(s string) string { + return s +} + +// Return the index of the only %w in format, or -1 if none. +// Also return a rewritten format string with %w replaced by %v, and +// false if there is more than one %w. +// TODO: handle "%[N]w". +func parsePercentW(format string) (idx int, newFormat string, ok bool) { + // Loosely copied from golang.org/x/tools/go/analysis/passes/printf/printf.go. + idx = -1 + ok = true + n := 0 + sz := 0 + var isW bool + for i := 0; i < len(format); i += sz { + if format[i] != '%' { + sz = 1 + continue + } + // "%%" is not a format directive. + if i+1 < len(format) && format[i+1] == '%' { + sz = 2 + continue + } + sz, isW = parsePrintfVerb(format[i:]) + if isW { + if idx >= 0 { + ok = false + } else { + idx = n + } + // "Replace" the last character, the 'w', with a 'v'. + p := i + sz - 1 + format = format[:p] + "v" + format[p+1:] + } + n++ + } + return idx, format, ok +} + +// Parse the printf verb starting with a % at s[0]. +// Return how many bytes it occupies and whether the verb is 'w'. +func parsePrintfVerb(s string) (int, bool) { + // Assume only that the directive is a sequence of non-letters followed by a single letter. + sz := 0 + var r rune + for i := 1; i < len(s); i += sz { + r, sz = utf8.DecodeRuneInString(s[i:]) + if unicode.IsLetter(r) { + return i + sz, r == 'w' + } + } + return len(s), false +} + +type noWrapError struct { + msg string + err error + frame Frame +} + +func (e *noWrapError) Error() string { + return fmt.Sprint(e) +} + +func (e *noWrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *noWrapError) FormatError(p Printer) (next error) { + p.Print(e.msg) + e.frame.Format(p) + return e.err +} + +type wrapError struct { + msg string + err error + frame Frame +} + +func (e *wrapError) Error() string { + return fmt.Sprint(e) +} + +func (e *wrapError) Format(s fmt.State, v rune) { FormatError(e, s, v) } + +func (e *wrapError) FormatError(p Printer) (next error) { + p.Print(e.msg) + e.frame.Format(p) + return e.err +} + +func (e *wrapError) Unwrap() error { + return e.err +} diff --git a/vendor/golang.org/x/xerrors/format.go b/vendor/golang.org/x/xerrors/format.go new file mode 100644 index 0000000000..1bc9c26b97 --- /dev/null +++ b/vendor/golang.org/x/xerrors/format.go @@ -0,0 +1,34 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +// A Formatter formats error messages. +type Formatter interface { + error + + // FormatError prints the receiver's first error and returns the next error in + // the error chain, if any. + FormatError(p Printer) (next error) +} + +// A Printer formats error messages. +// +// The most common implementation of Printer is the one provided by package fmt +// during Printf (as of Go 1.13). Localization packages such as golang.org/x/text/message +// typically provide their own implementations. +type Printer interface { + // Print appends args to the message output. + Print(args ...interface{}) + + // Printf writes a formatted string. + Printf(format string, args ...interface{}) + + // Detail reports whether error detail is requested. + // After the first call to Detail, all text written to the Printer + // is formatted as additional detail, or ignored when + // detail has not been requested. + // If Detail returns false, the caller can avoid printing the detail at all. + Detail() bool +} diff --git a/vendor/golang.org/x/xerrors/frame.go b/vendor/golang.org/x/xerrors/frame.go new file mode 100644 index 0000000000..0de628ec50 --- /dev/null +++ b/vendor/golang.org/x/xerrors/frame.go @@ -0,0 +1,56 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import ( + "runtime" +) + +// A Frame contains part of a call stack. +type Frame struct { + // Make room for three PCs: the one we were asked for, what it called, + // and possibly a PC for skipPleaseUseCallersFrames. See: + // https://go.googlesource.com/go/+/032678e0fb/src/runtime/extern.go#169 + frames [3]uintptr +} + +// Caller returns a Frame that describes a frame on the caller's stack. +// The argument skip is the number of frames to skip over. +// Caller(0) returns the frame for the caller of Caller. +func Caller(skip int) Frame { + var s Frame + runtime.Callers(skip+1, s.frames[:]) + return s +} + +// location reports the file, line, and function of a frame. +// +// The returned function may be "" even if file and line are not. +func (f Frame) location() (function, file string, line int) { + frames := runtime.CallersFrames(f.frames[:]) + if _, ok := frames.Next(); !ok { + return "", "", 0 + } + fr, ok := frames.Next() + if !ok { + return "", "", 0 + } + return fr.Function, fr.File, fr.Line +} + +// Format prints the stack as error detail. +// It should be called from an error's Format implementation +// after printing any other error detail. +func (f Frame) Format(p Printer) { + if p.Detail() { + function, file, line := f.location() + if function != "" { + p.Printf("%s\n ", function) + } + if file != "" { + p.Printf("%s:%d\n", file, line) + } + } +} diff --git a/vendor/golang.org/x/xerrors/go.mod b/vendor/golang.org/x/xerrors/go.mod new file mode 100644 index 0000000000..870d4f612d --- /dev/null +++ b/vendor/golang.org/x/xerrors/go.mod @@ -0,0 +1,3 @@ +module golang.org/x/xerrors + +go 1.11 diff --git a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go b/vendor/golang.org/x/xerrors/internal/internal.go similarity index 50% rename from vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go rename to vendor/golang.org/x/xerrors/internal/internal.go index a3b26a7bae..89f4eca5df 100644 --- a/vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go +++ b/vendor/golang.org/x/xerrors/internal/internal.go @@ -2,12 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin freebsd openbsd netbsd +package internal -package fastwalk - -import "syscall" - -func direntNamlen(dirent *syscall.Dirent) uint64 { - return uint64(dirent.Namlen) -} +// EnableTrace indicates whether stack information should be recorded in errors. +var EnableTrace = true diff --git a/vendor/golang.org/x/xerrors/wrap.go b/vendor/golang.org/x/xerrors/wrap.go new file mode 100644 index 0000000000..9a3b510374 --- /dev/null +++ b/vendor/golang.org/x/xerrors/wrap.go @@ -0,0 +1,106 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package xerrors + +import ( + "reflect" +) + +// A Wrapper provides context around another error. +type Wrapper interface { + // Unwrap returns the next error in the error chain. + // If there is no next error, Unwrap returns nil. + Unwrap() error +} + +// Opaque returns an error with the same error formatting as err +// but that does not match err and cannot be unwrapped. +func Opaque(err error) error { + return noWrapper{err} +} + +type noWrapper struct { + error +} + +func (e noWrapper) FormatError(p Printer) (next error) { + if f, ok := e.error.(Formatter); ok { + return f.FormatError(p) + } + p.Print(e.error) + return nil +} + +// Unwrap returns the result of calling the Unwrap method on err, if err implements +// Unwrap. Otherwise, Unwrap returns nil. +func Unwrap(err error) error { + u, ok := err.(Wrapper) + if !ok { + return nil + } + return u.Unwrap() +} + +// Is reports whether any error in err's chain matches target. +// +// An error is considered to match a target if it is equal to that target or if +// it implements a method Is(error) bool such that Is(target) returns true. +func Is(err, target error) bool { + if target == nil { + return err == target + } + + isComparable := reflect.TypeOf(target).Comparable() + for { + if isComparable && err == target { + return true + } + if x, ok := err.(interface{ Is(error) bool }); ok && x.Is(target) { + return true + } + // TODO: consider supporing target.Is(err). This would allow + // user-definable predicates, but also may allow for coping with sloppy + // APIs, thereby making it easier to get away with them. + if err = Unwrap(err); err == nil { + return false + } + } +} + +// As finds the first error in err's chain that matches the type to which target +// points, and if so, sets the target to its value and returns true. An error +// matches a type if it is assignable to the target type, or if it has a method +// As(interface{}) bool such that As(target) returns true. As will panic if target +// is not a non-nil pointer to a type which implements error or is of interface type. +// +// The As method should set the target to its value and return true if err +// matches the type to which target points. +func As(err error, target interface{}) bool { + if target == nil { + panic("errors: target cannot be nil") + } + val := reflect.ValueOf(target) + typ := val.Type() + if typ.Kind() != reflect.Ptr || val.IsNil() { + panic("errors: target must be a non-nil pointer") + } + if e := typ.Elem(); e.Kind() != reflect.Interface && !e.Implements(errorType) { + panic("errors: *target must be interface or implement error") + } + targetType := typ.Elem() + for err != nil { + if reflect.TypeOf(err).AssignableTo(targetType) { + val.Elem().Set(reflect.ValueOf(err)) + return true + } + if x, ok := err.(interface{ As(interface{}) bool }); ok && x.As(target) { + return true + } + err = Unwrap(err) + } + return false +} + +var errorType = reflect.TypeOf((*error)(nil)).Elem() diff --git a/vendor/gopkg.in/yaml.v2/.travis.yml b/vendor/gopkg.in/yaml.v2/.travis.yml index 9f556934d8..7348c50c0c 100644 --- a/vendor/gopkg.in/yaml.v2/.travis.yml +++ b/vendor/gopkg.in/yaml.v2/.travis.yml @@ -1,12 +1,17 @@ language: go go: - - 1.4 - - 1.5 - - 1.6 - - 1.7 - - 1.8 - - 1.9 - - tip + - "1.4.x" + - "1.5.x" + - "1.6.x" + - "1.7.x" + - "1.8.x" + - "1.9.x" + - "1.10.x" + - "1.11.x" + - "1.12.x" + - "1.13.x" + - "1.14.x" + - "tip" go_import_path: gopkg.in/yaml.v2 diff --git a/vendor/gopkg.in/yaml.v2/apic.go b/vendor/gopkg.in/yaml.v2/apic.go index 1f7e87e672..acf71402cf 100644 --- a/vendor/gopkg.in/yaml.v2/apic.go +++ b/vendor/gopkg.in/yaml.v2/apic.go @@ -79,6 +79,8 @@ func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { parser.encoding = encoding } +var disableLineWrapping = false + // Create a new emitter object. func yaml_emitter_initialize(emitter *yaml_emitter_t) { *emitter = yaml_emitter_t{ @@ -87,6 +89,9 @@ func yaml_emitter_initialize(emitter *yaml_emitter_t) { states: make([]yaml_emitter_state_t, 0, initial_stack_size), events: make([]yaml_event_t, 0, initial_queue_size), } + if disableLineWrapping { + emitter.best_width = -1 + } } // Destroy an emitter object. diff --git a/vendor/gopkg.in/yaml.v2/decode.go b/vendor/gopkg.in/yaml.v2/decode.go index e4e56e28e0..129bc2a97d 100644 --- a/vendor/gopkg.in/yaml.v2/decode.go +++ b/vendor/gopkg.in/yaml.v2/decode.go @@ -229,6 +229,10 @@ type decoder struct { mapType reflect.Type terrors []string strict bool + + decodeCount int + aliasCount int + aliasDepth int } var ( @@ -314,7 +318,43 @@ func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unm return out, false, false } +const ( + // 400,000 decode operations is ~500kb of dense object declarations, or + // ~5kb of dense object declarations with 10000% alias expansion + alias_ratio_range_low = 400000 + + // 4,000,000 decode operations is ~5MB of dense object declarations, or + // ~4.5MB of dense object declarations with 10% alias expansion + alias_ratio_range_high = 4000000 + + // alias_ratio_range is the range over which we scale allowed alias ratios + alias_ratio_range = float64(alias_ratio_range_high - alias_ratio_range_low) +) + +func allowedAliasRatio(decodeCount int) float64 { + switch { + case decodeCount <= alias_ratio_range_low: + // allow 99% to come from alias expansion for small-to-medium documents + return 0.99 + case decodeCount >= alias_ratio_range_high: + // allow 10% to come from alias expansion for very large documents + return 0.10 + default: + // scale smoothly from 99% down to 10% over the range. + // this maps to 396,000 - 400,000 allowed alias-driven decodes over the range. + // 400,000 decode operations is ~100MB of allocations in worst-case scenarios (single-item maps). + return 0.99 - 0.89*(float64(decodeCount-alias_ratio_range_low)/alias_ratio_range) + } +} + func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) { + d.decodeCount++ + if d.aliasDepth > 0 { + d.aliasCount++ + } + if d.aliasCount > 100 && d.decodeCount > 1000 && float64(d.aliasCount)/float64(d.decodeCount) > allowedAliasRatio(d.decodeCount) { + failf("document contains excessive aliasing") + } switch n.kind { case documentNode: return d.document(n, out) @@ -353,7 +393,9 @@ func (d *decoder) alias(n *node, out reflect.Value) (good bool) { failf("anchor '%s' value contains itself", n.value) } d.aliases[n] = true + d.aliasDepth++ good = d.unmarshal(n.alias, out) + d.aliasDepth-- delete(d.aliases, n) return good } @@ -746,8 +788,7 @@ func (d *decoder) merge(n *node, out reflect.Value) { case mappingNode: d.unmarshal(n, out) case aliasNode: - an, ok := d.doc.anchors[n.value] - if ok && an.kind != mappingNode { + if n.alias != nil && n.alias.kind != mappingNode { failWantMap() } d.unmarshal(n, out) @@ -756,8 +797,7 @@ func (d *decoder) merge(n *node, out reflect.Value) { for i := len(n.children) - 1; i >= 0; i-- { ni := n.children[i] if ni.kind == aliasNode { - an, ok := d.doc.anchors[ni.value] - if ok && an.kind != mappingNode { + if ni.alias != nil && ni.alias.kind != mappingNode { failWantMap() } } else if ni.kind != mappingNode { diff --git a/vendor/gopkg.in/yaml.v2/encode.go b/vendor/gopkg.in/yaml.v2/encode.go index a14435e82f..0ee738e11b 100644 --- a/vendor/gopkg.in/yaml.v2/encode.go +++ b/vendor/gopkg.in/yaml.v2/encode.go @@ -13,6 +13,19 @@ import ( "unicode/utf8" ) +// jsonNumber is the interface of the encoding/json.Number datatype. +// Repeating the interface here avoids a dependency on encoding/json, and also +// supports other libraries like jsoniter, which use a similar datatype with +// the same interface. Detecting this interface is useful when dealing with +// structures containing json.Number, which is a string under the hood. The +// encoder should prefer the use of Int64(), Float64() and string(), in that +// order, when encoding this type. +type jsonNumber interface { + Float64() (float64, error) + Int64() (int64, error) + String() string +} + type encoder struct { emitter yaml_emitter_t event yaml_event_t @@ -89,6 +102,21 @@ func (e *encoder) marshal(tag string, in reflect.Value) { } iface := in.Interface() switch m := iface.(type) { + case jsonNumber: + integer, err := m.Int64() + if err == nil { + // In this case the json.Number is a valid int64 + in = reflect.ValueOf(integer) + break + } + float, err := m.Float64() + if err == nil { + // In this case the json.Number is a valid float64 + in = reflect.ValueOf(float) + break + } + // fallback case - no number could be obtained + in = reflect.ValueOf(m.String()) case time.Time, *time.Time: // Although time.Time implements TextMarshaler, // we don't want to treat it as a string for YAML diff --git a/vendor/gopkg.in/yaml.v2/go.mod b/vendor/gopkg.in/yaml.v2/go.mod index 1934e87694..2cbb85aeac 100644 --- a/vendor/gopkg.in/yaml.v2/go.mod +++ b/vendor/gopkg.in/yaml.v2/go.mod @@ -1,5 +1,5 @@ -module "gopkg.in/yaml.v2" +module gopkg.in/yaml.v2 -require ( - "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 -) +go 1.15 + +require gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 diff --git a/vendor/gopkg.in/yaml.v2/resolve.go b/vendor/gopkg.in/yaml.v2/resolve.go index 6c151db6fb..4120e0c916 100644 --- a/vendor/gopkg.in/yaml.v2/resolve.go +++ b/vendor/gopkg.in/yaml.v2/resolve.go @@ -81,7 +81,7 @@ func resolvableTag(tag string) bool { return false } -var yamlStyleFloat = regexp.MustCompile(`^[-+]?[0-9]*\.?[0-9]+([eE][-+][0-9]+)?$`) +var yamlStyleFloat = regexp.MustCompile(`^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$`) func resolve(tag string, in string) (rtag string, out interface{}) { if !resolvableTag(tag) { diff --git a/vendor/gopkg.in/yaml.v2/scannerc.go b/vendor/gopkg.in/yaml.v2/scannerc.go index 077fd1dd2d..0b9bb6030a 100644 --- a/vendor/gopkg.in/yaml.v2/scannerc.go +++ b/vendor/gopkg.in/yaml.v2/scannerc.go @@ -626,30 +626,17 @@ func trace(args ...interface{}) func() { func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { // While we need more tokens to fetch, do it. for { - // Check if we really need to fetch more tokens. - need_more_tokens := false - - if parser.tokens_head == len(parser.tokens) { - // Queue is empty. - need_more_tokens = true - } else { - // Check if any potential simple key may occupy the head position. - if !yaml_parser_stale_simple_keys(parser) { + if parser.tokens_head != len(parser.tokens) { + // If queue is non-empty, check if any potential simple key may + // occupy the head position. + head_tok_idx, ok := parser.simple_keys_by_tok[parser.tokens_parsed] + if !ok { + break + } else if valid, ok := yaml_simple_key_is_valid(parser, &parser.simple_keys[head_tok_idx]); !ok { return false + } else if !valid { + break } - - for i := range parser.simple_keys { - simple_key := &parser.simple_keys[i] - if simple_key.possible && simple_key.token_number == parser.tokens_parsed { - need_more_tokens = true - break - } - } - } - - // We are finished. - if !need_more_tokens { - break } // Fetch the next token. if !yaml_parser_fetch_next_token(parser) { @@ -678,11 +665,6 @@ func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { return false } - // Remove obsolete potential simple keys. - if !yaml_parser_stale_simple_keys(parser) { - return false - } - // Check the indentation level against the current column. if !yaml_parser_unroll_indent(parser, parser.mark.column) { return false @@ -837,29 +819,30 @@ func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { "found character that cannot start any token") } -// Check the list of potential simple keys and remove the positions that -// cannot contain simple keys anymore. -func yaml_parser_stale_simple_keys(parser *yaml_parser_t) bool { - // Check for a potential simple key for each flow level. - for i := range parser.simple_keys { - simple_key := &parser.simple_keys[i] - - // The specification requires that a simple key - // - // - is limited to a single line, - // - is shorter than 1024 characters. - if simple_key.possible && (simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index) { - - // Check if the potential simple key to be removed is required. - if simple_key.required { - return yaml_parser_set_scanner_error(parser, - "while scanning a simple key", simple_key.mark, - "could not find expected ':'") - } - simple_key.possible = false +func yaml_simple_key_is_valid(parser *yaml_parser_t, simple_key *yaml_simple_key_t) (valid, ok bool) { + if !simple_key.possible { + return false, true + } + + // The 1.2 specification says: + // + // "If the ? indicator is omitted, parsing needs to see past the + // implicit key to recognize it as such. To limit the amount of + // lookahead required, the “:” indicator must appear at most 1024 + // Unicode characters beyond the start of the key. In addition, the key + // is restricted to a single line." + // + if simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index { + // Check if the potential simple key to be removed is required. + if simple_key.required { + return false, yaml_parser_set_scanner_error(parser, + "while scanning a simple key", simple_key.mark, + "could not find expected ':'") } + simple_key.possible = false + return false, true } - return true + return true, true } // Check if a simple key may start at the current position and add it if @@ -879,13 +862,14 @@ func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { possible: true, required: required, token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + mark: parser.mark, } - simple_key.mark = parser.mark if !yaml_parser_remove_simple_key(parser) { return false } parser.simple_keys[len(parser.simple_keys)-1] = simple_key + parser.simple_keys_by_tok[simple_key.token_number] = len(parser.simple_keys) - 1 } return true } @@ -900,19 +884,33 @@ func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { "while scanning a simple key", parser.simple_keys[i].mark, "could not find expected ':'") } + // Remove the key from the stack. + parser.simple_keys[i].possible = false + delete(parser.simple_keys_by_tok, parser.simple_keys[i].token_number) } - // Remove the key from the stack. - parser.simple_keys[i].possible = false return true } +// max_flow_level limits the flow_level +const max_flow_level = 10000 + // Increase the flow level and resize the simple key list if needed. func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { // Reset the simple key on the next level. - parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{ + possible: false, + required: false, + token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), + mark: parser.mark, + }) // Increase the flow level. parser.flow_level++ + if parser.flow_level > max_flow_level { + return yaml_parser_set_scanner_error(parser, + "while increasing flow level", parser.simple_keys[len(parser.simple_keys)-1].mark, + fmt.Sprintf("exceeded max depth of %d", max_flow_level)) + } return true } @@ -920,11 +918,16 @@ func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { if parser.flow_level > 0 { parser.flow_level-- - parser.simple_keys = parser.simple_keys[:len(parser.simple_keys)-1] + last := len(parser.simple_keys) - 1 + delete(parser.simple_keys_by_tok, parser.simple_keys[last].token_number) + parser.simple_keys = parser.simple_keys[:last] } return true } +// max_indents limits the indents stack size +const max_indents = 10000 + // Push the current indentation level to the stack and set the new level // the current column is greater than the indentation level. In this case, // append or insert the specified token into the token queue. @@ -939,6 +942,11 @@ func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml // indentation level. parser.indents = append(parser.indents, parser.indent) parser.indent = column + if len(parser.indents) > max_indents { + return yaml_parser_set_scanner_error(parser, + "while increasing indent level", parser.simple_keys[len(parser.simple_keys)-1].mark, + fmt.Sprintf("exceeded max depth of %d", max_indents)) + } // Create a token and insert it into the queue. token := yaml_token_t{ @@ -989,6 +997,8 @@ func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { // Initialize the simple key stack. parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) + parser.simple_keys_by_tok = make(map[int]int) + // A simple key is allowed at the beginning of the stream. parser.simple_key_allowed = true @@ -1270,7 +1280,11 @@ func yaml_parser_fetch_value(parser *yaml_parser_t) bool { simple_key := &parser.simple_keys[len(parser.simple_keys)-1] // Have we found a simple key? - if simple_key.possible { + if valid, ok := yaml_simple_key_is_valid(parser, simple_key); !ok { + return false + + } else if valid { + // Create the KEY token and insert it into the queue. token := yaml_token_t{ typ: yaml_KEY_TOKEN, @@ -1288,6 +1302,7 @@ func yaml_parser_fetch_value(parser *yaml_parser_t) bool { // Remove the simple key. simple_key.possible = false + delete(parser.simple_keys_by_tok, simple_key.token_number) // A simple key cannot follow another simple key. parser.simple_key_allowed = false diff --git a/vendor/gopkg.in/yaml.v2/yaml.go b/vendor/gopkg.in/yaml.v2/yaml.go index de85aa4cdb..30813884c0 100644 --- a/vendor/gopkg.in/yaml.v2/yaml.go +++ b/vendor/gopkg.in/yaml.v2/yaml.go @@ -89,7 +89,7 @@ func UnmarshalStrict(in []byte, out interface{}) (err error) { return unmarshal(in, out, true) } -// A Decorder reads and decodes YAML values from an input stream. +// A Decoder reads and decodes YAML values from an input stream. type Decoder struct { strict bool parser *parser @@ -175,7 +175,7 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // Zero valued structs will be omitted if all their public // fields are zero, unless they implement an IsZero // method (see the IsZeroer interface type), in which -// case the field will be included if that method returns true. +// case the field will be excluded if IsZero returns true. // // flow Marshal using a flow style (useful for structs, // sequences and maps). @@ -464,3 +464,15 @@ func isZero(v reflect.Value) bool { } return false } + +// FutureLineWrap globally disables line wrapping when encoding long strings. +// This is a temporary and thus deprecated method introduced to faciliate +// migration towards v3, which offers more control of line lengths on +// individual encodings, and has a default matching the behavior introduced +// by this function. +// +// The default formatting of v2 was erroneously changed in v2.3.0 and reverted +// in v2.4.0, at which point this function was introduced to help migration. +func FutureLineWrap() { + disableLineWrapping = true +} diff --git a/vendor/gopkg.in/yaml.v2/yamlh.go b/vendor/gopkg.in/yaml.v2/yamlh.go index e25cee563b..f6a9c8e34b 100644 --- a/vendor/gopkg.in/yaml.v2/yamlh.go +++ b/vendor/gopkg.in/yaml.v2/yamlh.go @@ -579,6 +579,7 @@ type yaml_parser_t struct { simple_key_allowed bool // May a simple key occur at the current position? simple_keys []yaml_simple_key_t // The stack of simple keys. + simple_keys_by_tok map[int]int // possible simple_key indexes indexed by token_number // Parser stuff diff --git a/vendor/modules.txt b/vendor/modules.txt index 12c9de7016..876db52727 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,33 +1,61 @@ +# github.com/cilium/ebpf v0.7.0 +## explicit +github.com/cilium/ebpf +github.com/cilium/ebpf/asm +github.com/cilium/ebpf/internal +github.com/cilium/ebpf/internal/btf +github.com/cilium/ebpf/internal/unix +github.com/cilium/ebpf/link +github.com/cilium/ebpf/ringbuf # github.com/cosiner/argv v0.1.0 +## explicit github.com/cosiner/argv -# github.com/cpuguy83/go-md2man v1.0.10 -github.com/cpuguy83/go-md2man/md2man +# github.com/cpuguy83/go-md2man/v2 v2.0.0 +github.com/cpuguy83/go-md2man/v2/md2man # github.com/creack/pty v1.1.9 +## explicit github.com/creack/pty -# github.com/google/go-dap v0.2.0 +# github.com/derekparker/trie v0.0.0-20200317170641-1fdf38b7b0e9 +## explicit +github.com/derekparker/trie +# github.com/google/go-dap v0.6.0 +## explicit github.com/google/go-dap # github.com/hashicorp/golang-lru v0.5.4 +## explicit github.com/hashicorp/golang-lru/simplelru # github.com/inconshreveable/mousetrap v1.0.0 github.com/inconshreveable/mousetrap # github.com/konsorten/go-windows-terminal-sequences v1.0.3 github.com/konsorten/go-windows-terminal-sequences -# github.com/mattn/go-colorable v0.0.0-20170327083344-ded68f7a9561 +# github.com/mattn/go-colorable v0.0.9 +## explicit github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.3 +## explicit github.com/mattn/go-isatty -# github.com/peterh/liner v0.0.0-20170317030525-88609521dc4b +# github.com/mattn/go-runewidth v0.0.3 +github.com/mattn/go-runewidth +# github.com/peterh/liner v1.2.1 +## explicit github.com/peterh/liner -# github.com/russross/blackfriday v1.5.2 -github.com/russross/blackfriday +# github.com/russross/blackfriday/v2 v2.0.1 +github.com/russross/blackfriday/v2 +# github.com/shurcooL/sanitized_anchor_name v1.0.0 +github.com/shurcooL/sanitized_anchor_name # github.com/sirupsen/logrus v1.6.0 +## explicit github.com/sirupsen/logrus -# github.com/spf13/cobra v0.0.0-20170417170307-b6cb39589372 +# github.com/spf13/cobra v1.1.3 +## explicit github.com/spf13/cobra github.com/spf13/cobra/doc -# github.com/spf13/pflag v0.0.0-20170417173400-9e4c21054fa1 +# github.com/spf13/pflag v1.0.5 github.com/spf13/pflag +# github.com/stretchr/testify v1.7.0 +## explicit # go.starlark.net v0.0.0-20200821142938-949cc6f4b097 +## explicit go.starlark.net/internal/compile go.starlark.net/internal/spell go.starlark.net/resolve @@ -37,18 +65,31 @@ go.starlark.net/syntax golang.org/x/arch/arm/armasm golang.org/x/arch/arm64/arm64asm golang.org/x/arch/x86/x86asm -# golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae +# golang.org/x/mod v0.5.1 +golang.org/x/mod/semver +# golang.org/x/sys v0.0.0-20211019181941-9d821ace8654 +## explicit +golang.org/x/sys/execabs golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/tools v0.0.0-20191127201027-ecd32218bd7f +# golang.org/x/tools v0.1.8 +## explicit golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/internal/gcimporter golang.org/x/tools/go/internal/packagesdriver golang.org/x/tools/go/packages -golang.org/x/tools/internal/fastwalk -golang.org/x/tools/internal/gopathwalk -golang.org/x/tools/internal/semver -golang.org/x/tools/internal/span -# gopkg.in/yaml.v2 v2.2.1 +golang.org/x/tools/internal/event +golang.org/x/tools/internal/event/core +golang.org/x/tools/internal/event/keys +golang.org/x/tools/internal/event/label +golang.org/x/tools/internal/gocommand +golang.org/x/tools/internal/packagesinternal +golang.org/x/tools/internal/typeparams +golang.org/x/tools/internal/typesinternal +# golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 +golang.org/x/xerrors +golang.org/x/xerrors/internal +# gopkg.in/yaml.v2 v2.4.0 +## explicit gopkg.in/yaml.v2